Skip to content

Commit 06024c0

Browse files
remove empty property and unused logic
1 parent de42c0a commit 06024c0

4 files changed

Lines changed: 205 additions & 299 deletions

File tree

src/allotropy/parsers/ctl_immunospot/ctl_immunospot_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def fix_line(line: str) -> str:
213213

214214
def split_multi_key_line(line: str) -> list[str]:
215215
"""Split lines that contain multiple key-value pairs into separate lines."""
216-
line = line.strip().strip('"').strip() # Clean up quotes and whitespace
216+
line = line.strip(' "') # Clean up quotes and whitespace
217217

218218
# Case 1: Parenthetical format: (Auto Areas: Estimated, Manual Areas: Normalized)
219219
if line.startswith("(") and line.endswith(")") and "," in line:

src/allotropy/parsers/ctl_immunospot/ctl_immunospot_structure.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ def _create_measurement(
3636
header_data: dict[str, float | str | None],
3737
) -> Measurement:
3838
location_identifier = f"{well_row}{well_col}"
39+
data_processing_document = {
40+
"Min. SpotSize": header_data.pop("Min. SpotSize", None),
41+
"Max. SpotSize": header_data.pop("Max. SpotSize", None),
42+
"Spot Separation": header_data.pop("Spot Separation", None),
43+
}
44+
has_data = any(
45+
value is not None and str(value).strip() != ""
46+
for value in data_processing_document.values()
47+
)
3948
return Measurement(
4049
type_=MeasurementType.OPTICAL_IMAGING,
4150
device_type=constants.DEVICE_TYPE,
@@ -46,11 +55,7 @@ def _create_measurement(
4655
detection_type=constants.DETECTION_TYPE,
4756
processed_data=ProcessedData(
4857
identifier=random_uuid_str(),
49-
data_processing_document={
50-
"Min. SpotSize": header_data.pop("Min. SpotSize", None),
51-
"Max. SpotSize": header_data.pop("Max. SpotSize", None),
52-
"Spot Separation": header_data.pop("Spot Separation", None),
53-
},
58+
data_processing_document=data_processing_document if has_data else None,
5459
features=[
5560
ImageFeature(
5661
identifier=random_uuid_str(),

src/allotropy/parsers/utils/pandas.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,8 @@ def _key_matches(self, match_key: str, key: str) -> bool:
279279
# "++" can cause re.compile to fail. Since it is never a valid regex expression
280280
# it is safe to escape it to prevent the error.
281281
match_key = match_key.replace("++", r"\+\+")
282-
try:
283-
return bool(re.fullmatch(match_key, key))
284-
except re.error:
285-
# If the regex pattern is invalid, treat it as a literal string match
286-
return key == match_key
282+
283+
return bool(re.fullmatch(match_key, key))
287284

288285
def _get_matching_keys(self, key_or_keys: str | set[str]) -> set[str]:
289286
return {

0 commit comments

Comments
 (0)