Skip to content

Commit c827af8

Browse files
committed
docs: add more docstrings
1 parent 780a86f commit c827af8

2 files changed

Lines changed: 28 additions & 4 deletions

File tree

cellengine/resources/fcs_file.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def experiment_id(self) -> str:
6262

6363
@property
6464
def filename(self) -> str:
65+
"""The filename."""
6566
return self._properties["filename"]
6667

6768
@filename.setter
@@ -80,18 +81,22 @@ def name(self, val: str):
8081

8182
@property
8283
def md5(self) -> str:
84+
"""The MD5 sum for the file, hex-encoded."""
8385
return self._properties["md5"]
8486

8587
@property
8688
def crc32c(self) -> str:
89+
"""The CRC32c sum for the file, hex-encoded, per RFC 4960 Appendix B."""
8790
return self._properties["crc32c"]
8891

8992
@property
9093
def size(self) -> int:
94+
"""The number of bytes in the file."""
9195
return self._properties["size"]
9296

9397
@property
9498
def gates_locked(self) -> bool:
99+
"""If true, no gates that apply to this file can be changed."""
95100
return self._properties["gatesLocked"]
96101

97102
@gates_locked.setter
@@ -101,6 +106,8 @@ def gates_locked(self, val: bool):
101106

102107
@property
103108
def deleted(self) -> Union[datetime, None]:
109+
"""If set, the file has been soft-deleted and may be permanently deleted
110+
later."""
104111
deleted = self._properties["deleted"]
105112
return timestamp_to_datetime(deleted) if deleted else None
106113

@@ -113,10 +120,15 @@ def deleted(self, deleted: Union[datetime, None]):
113120

114121
@property
115122
def is_control(self) -> bool:
123+
"""Whether or not this is a control file. Control files are hidden from
124+
most of the Web UI, and can be used to exclude compensation or
125+
calibration beads from analysis, for example."""
116126
return self._properties["isControl"]
117127

118128
@property
119129
def panel_name(self) -> str:
130+
"""The name of the file's panel. Files with the same panelName are
131+
grouped into a panel."""
120132
return self._properties["panelName"]
121133

122134
@property
@@ -125,6 +137,8 @@ def panel(self) -> List[Channel]:
125137

126138
@property
127139
def compensation(self) -> Union[FileCompensations, None]:
140+
"""Used with per-file compensation to indicate the compensation to apply
141+
to this file."""
128142
return self._properties["compensation"]
129143

130144
@property
@@ -163,15 +177,20 @@ def annotations(self, val: bool):
163177

164178
@property
165179
def event_count(self) -> int:
180+
"""The number of events (rows) in the file."""
166181
return self._properties["eventCount"]
167182

168183
@property
169184
def has_file_internal_comp(self) -> bool:
185+
"""Whether or not this file has a valid file-internal compensation
186+
matrix."""
170187
return self._properties["hasFileInternalComp"]
171188

172189
@property
173190
def spill_string(self) -> str:
174-
"""Note: this property may be fetched lazily."""
191+
"""The file-internal compensation, if present (see
192+
`has_file_internal_comp`). Note: this property may be fetched lazily due
193+
to its size."""
175194
if "spillString" not in self._properties and self.has_file_internal_comp:
176195
base_url = ce.APIClient().base_url
177196
self._properties["spillString"] = ce.APIClient()._get(
@@ -195,14 +214,15 @@ def data(self) -> Dict[str, Any]:
195214

196215
@property
197216
def sample_name(self) -> Optional[str]:
217+
"""The sample name extracted from the file header."""
198218
return self._properties["sampleName"]
199219

200220
def __repr__(self):
201221
return f"FcsFile(_id='{self._id}', name='{self.filename}')"
202222

203223
@property
204224
def channels(self) -> List[str]:
205-
"""Return all channels in the file"""
225+
"""Return all channels in the file."""
206226
return [f["channel"] for f in self.panel]
207227

208228
def channel_for_reagent(self, reagent: str) -> Union[str, None]:

cellengine/resources/folder.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@ def name(self, name):
3232

3333
@property
3434
def created(self) -> datetime:
35+
"""The date on which the folder was created."""
3536
created = self._properties["created"]
3637
return timestamp_to_datetime(created)
3738

3839
@property
3940
def deleted(self) -> Union[datetime, None]:
41+
"""If the folder is soft-deleted, the date on which it was soft-deleted.
42+
"""
4043
deleted = self._properties["deleted"]
4144
return timestamp_to_datetime(deleted) if deleted else None
4245

@@ -53,6 +56,7 @@ def creator(self) -> Dict[str, Any]:
5356

5457
@property
5558
def path(self) -> List[str]:
59+
"""The list of IDs of parent folders."""
5660
return self._properties["path"]
5761

5862
@path.setter
@@ -68,7 +72,7 @@ def permissions(self) -> List[Dict[str, Any]]:
6872

6973
@classmethod
7074
def get(cls, _id: Optional[str] = None, name: Optional[str] = None) -> Folder:
71-
"""Get a Folder name or ID. Either `name` or `_id` must be specified.
75+
"""Get a Folder by name or ID. Either `name` or `_id` must be specified.
7276
7377
Args:
7478
_id (optional): ID of the folder.
@@ -79,7 +83,7 @@ def get(cls, _id: Optional[str] = None, name: Optional[str] = None) -> Folder:
7983

8084
@staticmethod
8185
def create(name: str, path: Optional[List[str]] = []) -> Folder:
82-
"""Create a folder.
86+
"""Creates a folder.
8387
8488
Args:
8589
name (str): Name of the folder

0 commit comments

Comments
 (0)