Skip to content

Commit aa7341f

Browse files
committed
Add missing docstrings.
1 parent 6e25dc2 commit aa7341f

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

mh_utils/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ def __deepcopy__(self, memodict={}):
8282

8383
@abstractmethod
8484
def to_dict(self):
85+
"""
86+
Return a dictionary representation of the class.
87+
"""
88+
8589
return {} # pragma: no cover (abc)
8690

8791
def __eq__(self, other) -> bool:

mh_utils/cef_parser/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ def __init__(
142142
raise TypeError(f"'matches' must be a dictionary, not {type(matches)}")
143143

144144
def to_dict(self):
145+
"""
146+
Return a dictionary representation of the class.
147+
"""
148+
145149
return dict(
146150
name=self.name,
147151
formula=self.formula,
@@ -317,6 +321,10 @@ def __init__(
317321
]
318322

319323
def to_dict(self):
324+
"""
325+
Return a dictionary representation of the class.
326+
"""
327+
320328
data = {}
321329
for key in self.__slots__:
322330
data[key] = getattr(self, key)
@@ -611,6 +619,10 @@ def __init__(
611619
self.spectra = []
612620

613621
def to_dict(self):
622+
"""
623+
Return a dictionary representation of the class.
624+
"""
625+
614626
return dict(
615627
algo=self.algo,
616628
location=self.location,

mh_utils/csv_parser/classes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ def __repr__(self):
204204
return f"Sample({self.sample_name})"
205205

206206
def to_dict(self):
207+
"""
208+
Return a dictionary representation of the class.
209+
"""
210+
207211
return AlphaDict(
208212
sample_name=self.sample_name,
209213
sample_type=self.sample_type,
@@ -425,6 +429,10 @@ def __repr__(self):
425429
return f"Result({self.name}; {self.formula}; {self.rt}; {self.score})"
426430

427431
def to_dict(self):
432+
"""
433+
Return a dictionary representation of the class.
434+
"""
435+
428436
return AlphaDict(
429437
cas=self._cas,
430438
name=self.name,

mh_utils/worklist_parser/classes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ def from_xml(
111111
)
112112

113113
def to_dict(self):
114+
"""
115+
Return a dictionary representation of the class.
116+
"""
117+
114118
data = {}
115119
for key in self.__slots__:
116120
if key == "id":
@@ -161,6 +165,10 @@ def __init__(
161165
__slots__ = ["version", "user_columns", "jobs", "checksum", "locked_run_mode", "instrument_name", "params"]
162166

163167
def to_dict(self):
168+
"""
169+
Return a dictionary representation of the class.
170+
"""
171+
164172
data = {}
165173
for key in self.__slots__:
166174
data[key] = getattr(self, key)

0 commit comments

Comments
 (0)