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

Python API - fix pylint warnings #43

Merged
merged 3 commits into from
Apr 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions apis/python/razel.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ class Tag(str, Enum):
"""always show verbose output"""
CONDITION = 'razel:condition'
"""keep running and don't be verbose if command failed"""
NO_CACHE = 'razel:no-cache',
NO_CACHE = 'razel:no-cache'
"""always execute a command without caching"""
NO_REMOTE_CACHE = 'razel:no-remote-cache',
NO_REMOTE_CACHE = 'razel:no-remote-cache'
"""don't use remote cache"""
NO_SANDBOX = 'razel:no-sandbox',
NO_SANDBOX = 'razel:no-sandbox'
"""disable sandbox and also cache - for commands with unspecified input/output files"""

def __init__(self, workspace_dir: str) -> None:
Expand Down Expand Up @@ -71,8 +71,8 @@ def ensure_equal(self, arg1: File | Command, arg2: File | Command) -> None:
"""Add a task to compare two files. In case of two commands, all output files will be compared."""
if isinstance(arg1, Command) and isinstance(arg2, Command):
assert len(arg1.outputs) == len(arg2.outputs), "Commands to compare have different number of output files!"
for i in range(len(arg1.outputs)):
self.ensure_equal(arg1.outputs[i], arg2.outputs[i])
for a, b in zip(arg1.outputs, arg2.outputs):
self.ensure_equal(a, b)
else:
file1 = _map_arg_to_output_file(arg1)
file2 = _map_arg_to_output_file(arg2)
Expand All @@ -83,8 +83,8 @@ def ensure_not_equal(self, arg1: File | Command, arg2: File | Command) -> None:
"""Add a task to compare two files. In case of two commands, all output files will be compared."""
if isinstance(arg1, Command) and isinstance(arg2, Command):
assert len(arg1.outputs) == len(arg2.outputs), "Commands to compare have different number of output files!"
for i in range(len(arg1.outputs)):
self.ensure_equal(arg1.outputs[i], arg2.outputs[i])
for a, b in zip(arg1.outputs, arg2.outputs):
self.ensure_equal(a, b)
else:
file1 = _map_arg_to_output_file(arg1)
file2 = _map_arg_to_output_file(arg2)
Expand Down Expand Up @@ -387,7 +387,7 @@ def json_for_comparing_to_existing_command(self) -> Mapping[str, Any]:
def _map_arg_to_output_path(arg: str | File | Command) -> str:
if isinstance(arg, Command):
return arg.output.file_name
elif isinstance(arg, File):
if isinstance(arg, File):
return arg.file_name
return arg

Expand Down