Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 15, 2024
1 parent 22afd91 commit 6970f48
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 39 deletions.
9 changes: 3 additions & 6 deletions src/neuro_flow/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -1269,8 +1269,7 @@ def check_module_call_is_local(action_name: str, call_ast: ast.BaseModuleCall) -

class SupportsAstMerge(Protocol):
@property
def _specified_fields(self) -> AbstractSet[str]:
...
def _specified_fields(self) -> AbstractSet[str]: ...


_MergeTarget = TypeVar("_MergeTarget", bound=SupportsAstMerge)
Expand Down Expand Up @@ -1308,12 +1307,10 @@ async def merge_asts(child: _MergeTarget, parent: SupportsAstMerge) -> _MergeTar

class MixinApplyTarget(Protocol):
@property
def mixins(self) -> Optional[Sequence[StrExpr]]:
...
def mixins(self) -> Optional[Sequence[StrExpr]]: ...

@property
def _specified_fields(self) -> AbstractSet[str]:
...
def _specified_fields(self) -> AbstractSet[str]: ...


_MixinApplyTarget = TypeVar("_MixinApplyTarget", bound=MixinApplyTarget)
Expand Down
18 changes: 6 additions & 12 deletions src/neuro_flow/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,21 @@

@runtime_checkable
class ContainerT(Protocol):
def __getattr__(self, attr: str) -> TypeT:
...
def __getattr__(self, attr: str) -> TypeT: ...


@runtime_checkable
class MappingT(Protocol):
def __getitem__(self, key: LiteralT) -> TypeT:
...
def __getitem__(self, key: LiteralT) -> TypeT: ...

def __iter__(self) -> Iterator[LiteralT]:
...
def __iter__(self) -> Iterator[LiteralT]: ...


@runtime_checkable
class SequenceT(Protocol):
def __getitem__(self, idx: LiteralT) -> TypeT:
...
def __getitem__(self, idx: LiteralT) -> TypeT: ...

def __iter__(self) -> Iterator[TypeT]:
...
def __iter__(self) -> Iterator[TypeT]: ...


class RootABC(abc.ABC):
Expand All @@ -109,8 +104,7 @@ def client(self) -> AsyncContextManager[Client]:

@property
@abc.abstractmethod
def dry_run(self) -> bool:
...
def dry_run(self) -> bool: ...


class LocalScope(RootABC):
Expand Down
22 changes: 12 additions & 10 deletions src/neuro_flow/storage/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,13 +561,15 @@ async def create_bake(
"name": name,
"tags": tags,
"meta": {
"git_info": {
"sha": meta.git_info.sha,
"branch": meta.git_info.branch,
"tags": meta.git_info.tags,
}
if meta.git_info
else None,
"git_info": (
{
"sha": meta.git_info.sha,
"branch": meta.git_info.branch,
"tags": meta.git_info.tags,
}
if meta.git_info
else None
),
},
}
return await self._raw_client.create(
Expand Down Expand Up @@ -820,9 +822,9 @@ async def create_bake_image(
"yaml_defs": [_id_to_json(yaml_id) for yaml_id in yaml_defs],
"ref": ref,
"status": status.value,
"context_on_storage": str(context_on_storage)
if context_on_storage
else None,
"context_on_storage": (
str(context_on_storage) if context_on_storage else None
),
"dockerfile_rel": dockerfile_rel,
"builder_job_id": builder_job_id,
}
Expand Down
9 changes: 3 additions & 6 deletions src/neuro_flow/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,10 @@ async def run_subproc(exe: str, *args: str) -> None:

class GlobalOptions(Protocol):
@property
def verbosity(self) -> int:
...
def verbosity(self) -> int: ...

@property
def show_traceback(self) -> bool:
...
def show_traceback(self) -> bool: ...


def encode_global_options(options: GlobalOptions) -> List[str]:
Expand All @@ -133,8 +131,7 @@ def encode_global_options(options: GlobalOptions) -> List[str]:


class CommandRunner(Protocol):
async def __call__(self, *args: str) -> None:
...
async def __call__(self, *args: str) -> None: ...


def make_cmd_exec(exe: str, *, global_options: Iterable[str] = ()) -> CommandRunner:
Expand Down
8 changes: 5 additions & 3 deletions tests/unit/test_batch_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,11 @@ async def _fake_run_cli(*args: str) -> None:
"--recursive",
"--update",
"--no-target-directory",
str(assets / "batch_images/dir")
if ref == "image:main"
else str(assets / "batch_images/subdir"),
(
str(assets / "batch_images/dir")
if ref == "image:main"
else str(assets / "batch_images/subdir")
),
str(img.context_on_storage),
)
for run in runs
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ def __call__(
tags: TagsCtx = frozenset(),
dry_run: bool = False,
volumes: Optional[VolumesCtx] = None,
) -> LiveContext:
...
) -> LiveContext: ...


@pytest.fixture
Expand Down

0 comments on commit 6970f48

Please sign in to comment.