Skip to content

Commit

Permalink
Merge pull request #529 from bioimage-io/disable_url_suffix_checks
Browse files Browse the repository at this point in the history
Disable url suffix checks
  • Loading branch information
FynnBe authored Oct 17, 2023
2 parents 333cfaa + 8d8cf2d commit 03183a1
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 32 deletions.
4 changes: 2 additions & 2 deletions bioimageio/spec/VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.4.9post2"
}
"version": "0.4.9post3"
}
20 changes: 11 additions & 9 deletions bioimageio/spec/model/v0_3/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
from copy import deepcopy
from types import ModuleType

from marshmallow import RAISE, ValidationError, missing as missing_, post_load, pre_dump, pre_load, validates_schema
from marshmallow import (
RAISE,
ValidationError,
post_load,
pre_dump,
pre_load,
validates_schema,
)
from marshmallow import missing as missing_

from bioimageio.spec.rdf import v0_2 as rdf
from bioimageio.spec.shared import field_validators, fields
Expand All @@ -15,6 +23,7 @@
SharedProcessingSchema,
)
from bioimageio.spec.shared.utils import get_ref_url

from . import raw_nodes

Author = rdf.schema.Author
Expand Down Expand Up @@ -503,14 +512,7 @@ class Meta:
documentation = fields.Union(
[
fields.URL(),
fields.Path(
validate=field_validators.Attribute(
"suffix",
field_validators.Equal(
".md", error="{!r} is invalid; expected markdown file with '.md' extension."
),
)
),
fields.Path(),
],
required=True,
bioimageio_description="Relative path to file with additional documentation in markdown. This means: 1) only "
Expand Down
41 changes: 30 additions & 11 deletions bioimageio/spec/model/v0_4/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,49 @@
from types import ModuleType

import numpy
from marshmallow import RAISE, ValidationError, missing, pre_load, validates, validates_schema
from marshmallow import (
RAISE,
ValidationError,
missing,
pre_load,
validates,
validates_schema,
)

from bioimageio.spec.dataset.v0_2.schema import Dataset as _Dataset
from bioimageio.spec.model.v0_3.schema import (
KerasHdf5WeightsEntry as KerasHdf5WeightsEntry03,
)
from bioimageio.spec.model.v0_3.schema import (
OnnxWeightsEntry as OnnxWeightsEntry03,
)
from bioimageio.spec.model.v0_3.schema import (
Postprocessing as Postprocessing03,
)
from bioimageio.spec.model.v0_3.schema import (
Preprocessing as Preprocessing03,
)
from bioimageio.spec.model.v0_3.schema import (
TensorflowJsWeightsEntry as TensorflowJsWeightsEntry03,
)
from bioimageio.spec.model.v0_3.schema import (
TensorflowSavedModelBundleWeightsEntry as TensorflowSavedModelBundleWeightsEntry03,
_WeightsEntryBase as _WeightsEntryBase03,
)
from bioimageio.spec.model.v0_3.schema import (
_common_sha256_hint,
)
from bioimageio.spec.model.v0_3.schema import (
_WeightsEntryBase as _WeightsEntryBase03,
)
from bioimageio.spec.rdf import v0_2 as rdf
from bioimageio.spec.shared import LICENSES, field_validators, fields
from bioimageio.spec.shared.common import get_args, get_args_flat
from bioimageio.spec.shared.schema import ImplicitOutputShape, ParametrizedInputShape, SharedBioImageIOSchema
from bioimageio.spec.shared.schema import (
ImplicitOutputShape,
ParametrizedInputShape,
SharedBioImageIOSchema,
)

from . import raw_nodes


Expand Down Expand Up @@ -356,14 +382,7 @@ def warn_on_missing_cite(self, data: dict, **kwargs):
documentation = fields.Union(
[
fields.URL(),
fields.Path(
validate=field_validators.Attribute(
"suffix",
field_validators.Equal(
".md", error="{!r} is invalid; expected markdown file with '.md' extension."
),
)
),
fields.Path(),
],
required=True,
bioimageio_description="Relative path or URL to file with additional documentation in markdown. "
Expand Down
14 changes: 4 additions & 10 deletions bioimageio/spec/shared/fields.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"""fields to be used in the versioned schemas (may return shared raw nodes on `deserialize`"""
import datetime
import packaging.version
import logging
import pathlib
import typing

import marshmallow_union
import numpy
from marshmallow import Schema, ValidationError, fields as marshmallow_fields, missing
import packaging.version
from marshmallow import Schema, ValidationError, missing
from marshmallow import fields as marshmallow_fields

from . import field_validators, raw_nodes
from .utils._docs import resolve_bioimageio_descrcription
Expand Down Expand Up @@ -361,14 +362,7 @@ def _deserialize(self, *args, **kwargs) -> typing.Any:
source_file_field = Union(
[
URL(),
Path(
validate=field_validators.Attribute(
"suffix",
field_validators.Equal(
".py", error="{!r} is invalid; expected python source file with '.py' extension."
),
)
),
Path(),
]
)
return raw_nodes.ImportableSourceFile(
Expand Down

0 comments on commit 03183a1

Please sign in to comment.