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

Adding io-registration more explicitly #28

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Adding io-registration more explicitly #28

wants to merge 4 commits into from

Conversation

marcromeyn
Copy link
Collaborator

No description provided.

@@ -36,15 +36,18 @@
from typing_extensions import Annotated, ParamSpec, Self

import nemo_run.exceptions as run_exceptions
from nemo_run.io.api import _IO_REGISTRY, get, register

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
nemo_run.io.api
begins an import cycle.
import fiddle as fdl
import fiddle._src.experimental.dataclasses as fdl_dc

from nemo_run.io.capture import _CaptureContext

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
nemo_run.io.capture
begins an import cycle.
self._context: Optional[_CaptureContext] = None

@overload
def __call__(self, func: Callable[..., _T]) -> Callable[..., _T]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
def __call__(self, func: Callable[..., _T]) -> Callable[..., _T]: ...

@overload
def __call__(self) -> "capture": ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
Returns:
Any: The processed argument.
"""
from nemo_run.config import Config

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
nemo_run.config
begins an import cycle.

# If we've reached the top of the inheritance chain, create the Config
if len(capture_context.arg_stack) == len(cls.__mro__) - 1: # -1 to exclude 'object'
from nemo_run.config import Config

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
nemo_run.config
begins an import cycle.

with pytest.raises(TestException):
with run.io.capture():
obj = self.DummyClass(42)

Check notice

Code scanning / CodeQL

Unused local variable Note test

Variable obj is not used.
raise TestException("Test exception")

# The object should still be captured despite the exception
assert isinstance(run.io.get(obj), run.Config)

Check warning

Code scanning / CodeQL

Unreachable code Warning test

This statement is unreachable.

with pytest.raises(TestException):
with run.io.capture():
obj = self.DummyClass(42)

Check notice

Code scanning / CodeQL

Unused local variable Note test

Variable obj is not used.
raise TestException("Test exception")

# The object should still be captured despite the exception
assert isinstance(run.io.get(obj), run.Config)

Check warning

Code scanning / CodeQL

Unreachable code Warning test

This statement is unreachable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant