Skip to content

Commit 03183a1

Browse files
authored
Merge pull request #529 from bioimage-io/disable_url_suffix_checks
Disable url suffix checks
2 parents 333cfaa + 8d8cf2d commit 03183a1

File tree

4 files changed

+47
-32
lines changed

4 files changed

+47
-32
lines changed

bioimageio/spec/VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "0.4.9post2"
3-
}
2+
"version": "0.4.9post3"
3+
}

bioimageio/spec/model/v0_3/schema.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
from copy import deepcopy
44
from types import ModuleType
55

6-
from marshmallow import RAISE, ValidationError, missing as missing_, post_load, pre_dump, pre_load, validates_schema
6+
from marshmallow import (
7+
RAISE,
8+
ValidationError,
9+
post_load,
10+
pre_dump,
11+
pre_load,
12+
validates_schema,
13+
)
14+
from marshmallow import missing as missing_
715

816
from bioimageio.spec.rdf import v0_2 as rdf
917
from bioimageio.spec.shared import field_validators, fields
@@ -15,6 +23,7 @@
1523
SharedProcessingSchema,
1624
)
1725
from bioimageio.spec.shared.utils import get_ref_url
26+
1827
from . import raw_nodes
1928

2029
Author = rdf.schema.Author
@@ -503,14 +512,7 @@ class Meta:
503512
documentation = fields.Union(
504513
[
505514
fields.URL(),
506-
fields.Path(
507-
validate=field_validators.Attribute(
508-
"suffix",
509-
field_validators.Equal(
510-
".md", error="{!r} is invalid; expected markdown file with '.md' extension."
511-
),
512-
)
513-
),
515+
fields.Path(),
514516
],
515517
required=True,
516518
bioimageio_description="Relative path to file with additional documentation in markdown. This means: 1) only "

bioimageio/spec/model/v0_4/schema.py

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,49 @@
33
from types import ModuleType
44

55
import numpy
6-
from marshmallow import RAISE, ValidationError, missing, pre_load, validates, validates_schema
6+
from marshmallow import (
7+
RAISE,
8+
ValidationError,
9+
missing,
10+
pre_load,
11+
validates,
12+
validates_schema,
13+
)
714

815
from bioimageio.spec.dataset.v0_2.schema import Dataset as _Dataset
916
from bioimageio.spec.model.v0_3.schema import (
1017
KerasHdf5WeightsEntry as KerasHdf5WeightsEntry03,
18+
)
19+
from bioimageio.spec.model.v0_3.schema import (
1120
OnnxWeightsEntry as OnnxWeightsEntry03,
21+
)
22+
from bioimageio.spec.model.v0_3.schema import (
1223
Postprocessing as Postprocessing03,
24+
)
25+
from bioimageio.spec.model.v0_3.schema import (
1326
Preprocessing as Preprocessing03,
27+
)
28+
from bioimageio.spec.model.v0_3.schema import (
1429
TensorflowJsWeightsEntry as TensorflowJsWeightsEntry03,
30+
)
31+
from bioimageio.spec.model.v0_3.schema import (
1532
TensorflowSavedModelBundleWeightsEntry as TensorflowSavedModelBundleWeightsEntry03,
16-
_WeightsEntryBase as _WeightsEntryBase03,
33+
)
34+
from bioimageio.spec.model.v0_3.schema import (
1735
_common_sha256_hint,
1836
)
37+
from bioimageio.spec.model.v0_3.schema import (
38+
_WeightsEntryBase as _WeightsEntryBase03,
39+
)
1940
from bioimageio.spec.rdf import v0_2 as rdf
2041
from bioimageio.spec.shared import LICENSES, field_validators, fields
2142
from bioimageio.spec.shared.common import get_args, get_args_flat
22-
from bioimageio.spec.shared.schema import ImplicitOutputShape, ParametrizedInputShape, SharedBioImageIOSchema
43+
from bioimageio.spec.shared.schema import (
44+
ImplicitOutputShape,
45+
ParametrizedInputShape,
46+
SharedBioImageIOSchema,
47+
)
48+
2349
from . import raw_nodes
2450

2551

@@ -356,14 +382,7 @@ def warn_on_missing_cite(self, data: dict, **kwargs):
356382
documentation = fields.Union(
357383
[
358384
fields.URL(),
359-
fields.Path(
360-
validate=field_validators.Attribute(
361-
"suffix",
362-
field_validators.Equal(
363-
".md", error="{!r} is invalid; expected markdown file with '.md' extension."
364-
),
365-
)
366-
),
385+
fields.Path(),
367386
],
368387
required=True,
369388
bioimageio_description="Relative path or URL to file with additional documentation in markdown. "

bioimageio/spec/shared/fields.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
"""fields to be used in the versioned schemas (may return shared raw nodes on `deserialize`"""
22
import datetime
3-
import packaging.version
43
import logging
54
import pathlib
65
import typing
76

87
import marshmallow_union
98
import numpy
10-
from marshmallow import Schema, ValidationError, fields as marshmallow_fields, missing
9+
import packaging.version
10+
from marshmallow import Schema, ValidationError, missing
11+
from marshmallow import fields as marshmallow_fields
1112

1213
from . import field_validators, raw_nodes
1314
from .utils._docs import resolve_bioimageio_descrcription
@@ -361,14 +362,7 @@ def _deserialize(self, *args, **kwargs) -> typing.Any:
361362
source_file_field = Union(
362363
[
363364
URL(),
364-
Path(
365-
validate=field_validators.Attribute(
366-
"suffix",
367-
field_validators.Equal(
368-
".py", error="{!r} is invalid; expected python source file with '.py' extension."
369-
),
370-
)
371-
),
365+
Path(),
372366
]
373367
)
374368
return raw_nodes.ImportableSourceFile(

0 commit comments

Comments
 (0)