Skip to content

Commit

Permalink
Make frozendict picklable (#69)
Browse files Browse the repository at this point in the history
* Replace frozendict implementation by existing stdlib thing
  which behaves more or less the same, but coops with pickle
  • Loading branch information
tmi authored Dec 5, 2024
1 parent 04e2550 commit 62fff47
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/anemoi/inference/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import warnings
from collections import defaultdict
from functools import cached_property
from types import MappingProxyType as frozendict
from typing import Literal

import numpy as np
Expand All @@ -37,15 +38,6 @@ def _remove_full_paths(x):
return x


class frozendict(dict):
def __deepcopy__(self, memo):
# As this is a frozendict, we can return the same object
return self

def __setitem__(self, key, value):
raise TypeError("frozendict is immutable")


class Metadata(PatchMixin, LegacyMixin):
"""An object that holds metadata of a checkpoint."""

Expand Down

0 comments on commit 62fff47

Please sign in to comment.