Skip to content

Commit

Permalink
PulseStorage now "implements" MutableMapping.
Browse files Browse the repository at this point in the history
Implementations of __len__ and __iter__ curently raise NotImplementedError s.

Signed-off-by: Lukas Prediger <lukas.prediger@rwth-aachen.de>
  • Loading branch information
lumip committed Jul 12, 2018
1 parent 9ef8a0f commit 2befd6b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion qctoolkit/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ def deserialize(self, representation: Union[str, Dict[str, Any]]) -> Serializabl
return serializable


class PulseStorage:
class PulseStorage(MutableMapping):
StorageEntry = NamedTuple('StorageEntry', [('serialization', str), ('serializable', Serializable)])

def __init__(self,
Expand Down Expand Up @@ -687,6 +687,16 @@ def __delitem__(self, identifier: str) -> None:
except KeyError:
pass

def __len__(self) -> None:
raise NotImplementedError("len(PulseStorage) has currently no meaningful semantics and is not implemented."
" If you require this feature, please create a feature request at \n"
"https://github.com/qutech/qc-toolkit/issues/new")

def __iter__(self) -> None:
raise NotImplementedError("iter(PulseStorage) has currently no meaningful semantics and is not implemented."
" If you require this feature, please create a feature request at \n"
"https://github.com/qutech/qc-toolkit/issues/new")

def overwrite(self, identifier: str, serializable: Serializable) -> None:
"""Use this method actively change a pulse"""

Expand Down

0 comments on commit 2befd6b

Please sign in to comment.