summaryrefslogtreecommitdiff
path: root/src/hydrilla/item_infos.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/hydrilla/item_infos.py')
-rw-r--r--src/hydrilla/item_infos.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/hydrilla/item_infos.py b/src/hydrilla/item_infos.py
index a01fe3a..2b89600 100644
--- a/src/hydrilla/item_infos.py
+++ b/src/hydrilla/item_infos.py
@@ -181,7 +181,7 @@ class ItemInfoBase(ABC, ItemIdentity, Categorizable):
item_obj['source_copyright']
)
- version = versions.normalize_version(item_obj['version'])
+ version = versions.normalize(item_obj['version'])
perms_obj = item_obj.get('permissions', {})
@@ -262,14 +262,14 @@ class ResourceInfo(ItemInfoBase):
@staticmethod
def load(
- instance_or_path: json_instances.InstanceOrPathOrIO,
- repo: str = '<dummyrepo>',
- repo_iteration: int = -1
+ instance_source: json_instances.InstanceSource,
+ repo: str = '<dummyrepo>',
+ repo_iteration: int = -1
) -> 'ResourceInfo':
"""...."""
return _load_item_info(
ResourceInfo,
- instance_or_path,
+ instance_source,
repo,
repo_iteration
)
@@ -291,7 +291,8 @@ class MappingInfo(ItemInfoBase):
"""...."""
type_name: t.ClassVar[str] = 'mapping'
- payloads: t.Mapping[ParsedPattern, ItemSpecifier] = dc.field(hash=False, compare=False)
+ payloads: t.Mapping[ParsedPattern, ItemSpecifier] = \
+ dc.field(hash=False, compare=False)
@staticmethod
def make(
@@ -316,14 +317,14 @@ class MappingInfo(ItemInfoBase):
@staticmethod
def load(
- instance_or_path: json_instances.InstanceOrPathOrIO,
- repo: str = '<dummyrepo>',
- repo_iteration: int = -1
+ instance_source: json_instances.InstanceSource,
+ repo: str = '<dummyrepo>',
+ repo_iteration: int = -1
) -> 'MappingInfo':
"""...."""
return _load_item_info(
MappingInfo,
- instance_or_path,
+ instance_source,
repo,
repo_iteration
)
@@ -349,13 +350,13 @@ AnyInfo = t.Union[ResourceInfo, MappingInfo]
LoadedType = t.TypeVar('LoadedType', ResourceInfo, MappingInfo)
def _load_item_info(
- info_type: t.Type[LoadedType],
- instance_or_path: json_instances.InstanceOrPathOrIO,
- repo: str,
- repo_iteration: int
+ info_type: t.Type[LoadedType],
+ instance_source: json_instances.InstanceSource,
+ repo: str,
+ repo_iteration: int
) -> LoadedType:
"""Read, validate and autocomplete a mapping/resource description."""
- instance = json_instances.read_instance(instance_or_path)
+ instance = json_instances.read_instance(instance_source)
schema_fmt = f'api_{info_type.type_name}_description-{{}}.schema.json'