Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow RDF #310

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add root_path arg to resolve_raw_node()
FynnBe committed Mar 3, 2023
commit 0a2a27f8de774955dcce6545f909d48db30003be
13 changes: 10 additions & 3 deletions bioimageio/core/resource_io/utils.py
Original file line number Diff line number Diff line change
@@ -79,7 +79,9 @@ def transform_LocalCallableFromModule(self, node: raw_nodes.LocalCallableFromMod
return nodes.ImportedCallable(call=getattr(module, node.callable_name))

@staticmethod
def transform_ResolvedCallableFromSourceFile(node: raw_nodes.ResolvedCallableFromSourceFile) -> nodes.ImportedCallable:
def transform_ResolvedCallableFromSourceFile(
node: raw_nodes.ResolvedCallableFromSourceFile,
) -> nodes.ImportedCallable:
module_path = resolve_source(node.source_file)
module_name = f"module_from_source.{module_path.stem}"
importlib_spec = importlib.util.spec_from_file_location(module_name, module_path)
@@ -119,10 +121,15 @@ def all_sources_available(


def resolve_raw_node(
raw_rd: GenericRawNode, nodes_module: typing.Any, uri_only_if_in_package: bool = True
raw_rd: GenericRawNode,
nodes_module: typing.Any,
uri_only_if_in_package: bool = True,
root_path: typing.Optional[pathlib.Path] = None,
) -> GenericResolvedNode:
"""resolve all uris and paths (that are included when packaging)"""
rd = UriNodeTransformer(root_path=raw_rd.root_path, uri_only_if_in_package=uri_only_if_in_package).transform(raw_rd)
rd = UriNodeTransformer(
root_path=root_path or raw_rd.root_path, uri_only_if_in_package=uri_only_if_in_package
).transform(raw_rd)
rd = CallableNodeTransformer().transform(rd)
rd = RawNodeTypeTransformer(nodes_module).transform(rd)
return rd