Skip to content

Commit 15d2b1d

Browse files
Witte, Juliusjuwitte
authored andcommitted
fix: remove redundant None from list type
1 parent 5e90a56 commit 15d2b1d

File tree

4 files changed

+35
-26
lines changed

4 files changed

+35
-26
lines changed

src/microbial_strain_data_model/classes/actors.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,21 @@ class Collection(Organization):
5252
axenic: bool | None = Field(
5353
default=None, title="Axenic Culture", alias="axenicCulture"
5454
)
55-
supply_forms: list[SupplyForm] | None = Field(
55+
supply_forms: list[SupplyForm] = Field(
5656
default_factory=list, title="Supply Forms", alias="supplyForms"
5757
)
5858
history: str | None = Field(default=None, title="History", alias="history")
59-
date: Annotated[
60-
str,
61-
StringConstraints(
62-
strip_whitespace=True,
63-
to_upper=True,
64-
pattern=r"^(?:\d{4}[-\._]?\d{0,2}[-\._]?\d{0,2})?/?(?:\d{4}[-\._]?\d{0,2}[-\._]?\d{0,2})?$",
65-
),
66-
] | None = Field(default=None, title="Deposition Date", alias="depositionDate")
59+
date: (
60+
Annotated[
61+
str,
62+
StringConstraints(
63+
strip_whitespace=True,
64+
to_upper=True,
65+
pattern=r"^(?:\d{4}[-\._]?\d{0,2}[-\._]?\d{0,2})?/?(?:\d{4}[-\._]?\d{0,2}[-\._]?\d{0,2})?$",
66+
),
67+
]
68+
| None
69+
) = Field(default=None, title="Deposition Date", alias="depositionDate")
6770
depositor: Person | None = Field(default=None, title="Depositor", alias="depositor")
6871
source: Annotated[str, StringConstraints(pattern=r"^\/sources\/\d+$")] = Field(
6972
title="Source", alias="source", description="JSON path to source object"

src/microbial_strain_data_model/classes/isolation.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@
77
class Isolation(BaseModel):
88
"""Isolation event information"""
99

10-
date: Annotated[
11-
str,
12-
StringConstraints(
13-
strip_whitespace=True,
14-
to_upper=True,
15-
pattern=r"^(?:\d{4}[-\._]?\d{0,2}[-\._]?\d{0,2})?/?(?:\d{4}[-\._]?\d{0,2}[-\._]?\d{0,2})?$",
16-
),
17-
] | None = Field(default=None, title="Date", alias="date")
10+
date: (
11+
Annotated[
12+
str,
13+
StringConstraints(
14+
strip_whitespace=True,
15+
to_upper=True,
16+
pattern=r"^(?:\d{4}[-\._]?\d{0,2}[-\._]?\d{0,2})?/?(?:\d{4}[-\._]?\d{0,2}[-\._]?\d{0,2})?$",
17+
),
18+
]
19+
| None
20+
) = Field(default=None, title="Date", alias="date")
1821
isolator: Organization | Person | None = Field(
1922
default=None, title="Isolated At", alias="isolatedAt"
2023
)

src/microbial_strain_data_model/classes/sample.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,17 @@ def check_isolation_tag(self) -> Self:
3232
class Sample(BaseModel):
3333
"""Information on the Sampling event of that Strain"""
3434

35-
date: Annotated[
36-
str,
37-
StringConstraints(
38-
strip_whitespace=True,
39-
to_upper=True,
40-
pattern=r"^(?:\d{4}[-\._]?\d{0,2}[-\._]?\d{0,2})?/?(?:\d{4}[-\._]?\d{0,2}[-\._]?\d{0,2})?$",
41-
),
42-
] | None = Field(default=None, title="Date", alias="date")
35+
date: (
36+
Annotated[
37+
str,
38+
StringConstraints(
39+
strip_whitespace=True,
40+
to_upper=True,
41+
pattern=r"^(?:\d{4}[-\._]?\d{0,2}[-\._]?\d{0,2})?/?(?:\d{4}[-\._]?\d{0,2}[-\._]?\d{0,2})?$",
42+
),
43+
]
44+
| None
45+
) = Field(default=None, title="Date", alias="date")
4346
country: Country | None = Field(default=None, title="Country", alias="country")
4447
description: str | None = Field(
4548
default=None, title="Description", alias="description"

tests/test_microbe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from microbial_strain_data_model.microbe import Microbe
55

66

7-
@pytest.fixture()
7+
@pytest.fixture
88
def micro():
99
return Microbe(
1010
organismType=OrganismType.bacteria,

0 commit comments

Comments
 (0)