Skip to content

Commit 6d0956e

Browse files
committed
Make input default to empty list by directly editing python files
1 parent de2ef35 commit 6d0956e

File tree

9 files changed

+1361
-1341
lines changed

9 files changed

+1361
-1341
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ gen-project: $(PYMODEL)
114114
# Format with black
115115
$(RUN) black $(PYMODEL)/_models.py
116116
$(RUN) black $(DEST)/*/*.py
117+
# Use default_factory=list for input field
118+
$(RUN) python modify_input_default.py
117119

118120

119121
test: test-schema test-python test-examples

modify_input_default.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import re
2+
3+
with open("src/opencloning_linkml/datamodel/_models.py", "r") as f:
4+
content = f.read()
5+
6+
new_content = []
7+
change_next_line = False
8+
for line in content.split("\n"):
9+
new_line = line
10+
if re.match(r"^\s+input:", line):
11+
change_next_line = True
12+
elif change_next_line:
13+
new_line = new_line.replace("default=None", "default_factory=list")
14+
change_next_line = False
15+
new_content.append(new_line)
16+
17+
with open("src/opencloning_linkml/datamodel/_models.py", "w") as f:
18+
f.write("\n".join(new_content))
0 Bytes
Binary file not shown.

project/jsonld/opencloning_linkml.context.jsonld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"comments": {
33
"description": "Auto generated by LinkML jsonld context generator",
4-
"generation_date": "2025-10-03T14:02:10",
4+
"generation_date": "2025-10-20T16:29:26",
55
"source": "opencloning_linkml.yaml"
66
},
77
"@context": {

project/jsonld/opencloning_linkml.jsonld

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3542,9 +3542,9 @@
35423542
],
35433543
"metamodel_version": "1.7.0",
35443544
"source_file": "opencloning_linkml.yaml",
3545-
"source_file_date": "2025-10-03T13:59:29",
3545+
"source_file_date": "2025-10-20T16:11:45",
35463546
"source_file_size": 26051,
3547-
"generation_date": "2025-10-03T14:02:11",
3547+
"generation_date": "2025-10-20T16:29:26",
35483548
"@type": "SchemaDefinition",
35493549
"@context": [
35503550
"project/jsonld/opencloning_linkml.context.jsonld",

project/owl/opencloning_linkml.owl.ttl

Lines changed: 499 additions & 499 deletions
Large diffs are not rendered by default.

project/python/opencloning_linkml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Auto generated from opencloning_linkml.yaml by pythongen.py version: 0.0.1
2-
# Generation date: 2025-10-03T14:02:12
2+
# Generation date: 2025-10-20T16:29:27
33
# Schema: OpenCloning_LinkML
44
#
55
# id: https://opencloning.github.io/OpenCloning_LinkML

project/shacl/opencloning_linkml.shacl.ttl

Lines changed: 805 additions & 805 deletions
Large diffs are not rendered by default.

src/opencloning_linkml/datamodel/_models.py

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ class Source(NamedThing):
590590
},
591591
)
592592
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
593-
default=None,
593+
default_factory=list,
594594
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
595595
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
596596
)
@@ -650,7 +650,7 @@ class DatabaseSource(Source):
650650
json_schema_extra={"linkml_meta": {"alias": "output_name", "domain_of": ["Source"]}},
651651
)
652652
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
653-
default=None,
653+
default_factory=list,
654654
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
655655
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
656656
)
@@ -735,7 +735,7 @@ class CollectionSource(Source):
735735
},
736736
)
737737
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
738-
default=None,
738+
default_factory=list,
739739
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
740740
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
741741
)
@@ -964,7 +964,7 @@ class ManuallyTypedSource(Source):
964964
},
965965
)
966966
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
967-
default=None,
967+
default_factory=list,
968968
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
969969
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
970970
)
@@ -1066,7 +1066,7 @@ class UploadedFileSource(Source):
10661066
},
10671067
)
10681068
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
1069-
default=None,
1069+
default_factory=list,
10701070
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
10711071
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
10721072
)
@@ -1130,7 +1130,7 @@ class RepositoryIdSource(Source):
11301130
},
11311131
)
11321132
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
1133-
default=None,
1133+
default_factory=list,
11341134
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
11351135
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
11361136
)
@@ -1214,7 +1214,7 @@ class AddgeneIdSource(RepositoryIdSource):
12141214
},
12151215
)
12161216
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
1217-
default=None,
1217+
default_factory=list,
12181218
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
12191219
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
12201220
)
@@ -1320,7 +1320,7 @@ class WekWikGeneIdSource(RepositoryIdSource):
13201320
},
13211321
)
13221322
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
1323-
default=None,
1323+
default_factory=list,
13241324
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
13251325
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
13261326
)
@@ -1448,7 +1448,7 @@ class SEVASource(RepositoryIdSource):
14481448
},
14491449
)
14501450
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
1451-
default=None,
1451+
default_factory=list,
14521452
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
14531453
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
14541454
)
@@ -1551,7 +1551,7 @@ class BenchlingUrlSource(RepositoryIdSource):
15511551
},
15521552
)
15531553
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
1554-
default=None,
1554+
default_factory=list,
15551555
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
15561556
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
15571557
)
@@ -1648,7 +1648,7 @@ class SnapGenePlasmidSource(RepositoryIdSource):
16481648
},
16491649
)
16501650
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
1651-
default=None,
1651+
default_factory=list,
16521652
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
16531653
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
16541654
)
@@ -1736,7 +1736,7 @@ class EuroscarfSource(RepositoryIdSource):
17361736
},
17371737
)
17381738
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
1739-
default=None,
1739+
default_factory=list,
17401740
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
17411741
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
17421742
)
@@ -1847,7 +1847,7 @@ class IGEMSource(RepositoryIdSource):
18471847
},
18481848
)
18491849
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
1850-
default=None,
1850+
default_factory=list,
18511851
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
18521852
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
18531853
)
@@ -1952,7 +1952,7 @@ class OpenDNACollectionsSource(RepositoryIdSource):
19521952
},
19531953
)
19541954
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
1955-
default=None,
1955+
default_factory=list,
19561956
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
19571957
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
19581958
)
@@ -2059,7 +2059,7 @@ class GenomeCoordinatesSource(Source):
20592059
},
20602060
)
20612061
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
2062-
default=None,
2062+
default_factory=list,
20632063
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
20642064
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
20652065
)
@@ -2132,7 +2132,7 @@ class SequenceCutSource(Source):
21322132
},
21332133
)
21342134
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
2135-
default=None,
2135+
default_factory=list,
21362136
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
21372137
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
21382138
)
@@ -2205,7 +2205,7 @@ class RestrictionEnzymeDigestionSource(SequenceCutSource):
22052205
},
22062206
)
22072207
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
2208-
default=None,
2208+
default_factory=list,
22092209
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
22102210
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
22112211
)
@@ -2315,7 +2315,7 @@ class AssemblySource(Source):
23152315
},
23162316
)
23172317
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
2318-
default=None,
2318+
default_factory=list,
23192319
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
23202320
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
23212321
)
@@ -2387,7 +2387,7 @@ class PCRSource(AssemblySource):
23872387
},
23882388
)
23892389
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
2390-
default=None,
2390+
default_factory=list,
23912391
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
23922392
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
23932393
)
@@ -2452,7 +2452,7 @@ class LigationSource(AssemblySource):
24522452
},
24532453
)
24542454
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
2455-
default=None,
2455+
default_factory=list,
24562456
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
24572457
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
24582458
)
@@ -2517,7 +2517,7 @@ class HomologousRecombinationSource(AssemblySource):
25172517
},
25182518
)
25192519
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
2520-
default=None,
2520+
default_factory=list,
25212521
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
25222522
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
25232523
)
@@ -2582,7 +2582,7 @@ class GibsonAssemblySource(AssemblySource):
25822582
},
25832583
)
25842584
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
2585-
default=None,
2585+
default_factory=list,
25862586
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
25872587
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
25882588
)
@@ -2647,7 +2647,7 @@ class InFusionSource(AssemblySource):
26472647
},
26482648
)
26492649
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
2650-
default=None,
2650+
default_factory=list,
26512651
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
26522652
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
26532653
)
@@ -2712,7 +2712,7 @@ class OverlapExtensionPCRLigationSource(AssemblySource):
27122712
},
27132713
)
27142714
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
2715-
default=None,
2715+
default_factory=list,
27162716
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
27172717
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
27182718
)
@@ -2777,7 +2777,7 @@ class InVivoAssemblySource(AssemblySource):
27772777
},
27782778
)
27792779
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
2780-
default=None,
2780+
default_factory=list,
27812781
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
27822782
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
27832783
)
@@ -2857,7 +2857,7 @@ class RestrictionAndLigationSource(AssemblySource):
28572857
},
28582858
)
28592859
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
2860-
default=None,
2860+
default_factory=list,
28612861
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
28622862
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
28632863
)
@@ -2932,7 +2932,7 @@ class GatewaySource(AssemblySource):
29322932
},
29332933
)
29342934
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
2935-
default=None,
2935+
default_factory=list,
29362936
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
29372937
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
29382938
)
@@ -2997,7 +2997,7 @@ class CreLoxRecombinationSource(AssemblySource):
29972997
},
29982998
)
29992999
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
3000-
default=None,
3000+
default_factory=list,
30013001
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
30023002
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
30033003
)
@@ -3062,7 +3062,7 @@ class CRISPRSource(HomologousRecombinationSource):
30623062
},
30633063
)
30643064
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
3065-
default=None,
3065+
default_factory=list,
30663066
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
30673067
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
30683068
)
@@ -3127,7 +3127,7 @@ class OligoHybridizationSource(Source):
31273127
},
31283128
)
31293129
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
3130-
default=None,
3130+
default_factory=list,
31313131
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
31323132
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
31333133
)
@@ -3182,7 +3182,7 @@ class PolymeraseExtensionSource(Source):
31823182
},
31833183
)
31843184
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
3185-
default=None,
3185+
default_factory=list,
31863186
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
31873187
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
31883188
)
@@ -3458,7 +3458,7 @@ class AnnotationSource(Source):
34583458
},
34593459
)
34603460
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
3461-
default=None,
3461+
default_factory=list,
34623462
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
34633463
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
34643464
)
@@ -3513,7 +3513,7 @@ class ReverseComplementSource(Source):
35133513
},
35143514
)
35153515
input: Optional[list[Union[SourceInput, AssemblyFragment]]] = Field(
3516-
default=None,
3516+
default_factory=list,
35173517
description="""The inputs to this source. If the source represents external import of a sequence, it's empty.""",
35183518
json_schema_extra={"linkml_meta": {"alias": "input", "domain_of": ["Source"], "slot_uri": "schema:object"}},
35193519
)

0 commit comments

Comments
 (0)