Skip to content

Commit 950e9c4

Browse files
committed
fix ruff errors
1 parent 4742fcc commit 950e9c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+149
-113
lines changed

dvc/api/dataset.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,4 @@ def get(name: str) -> Union[DatachainDataset, DVCDataset, URLDataset]:
6464
for file in dataset.lock.files
6565
]
6666
return URLDataset(type="url", files=files, path=versioned_path)
67+
raise AssertionError("unreachable")

dvc/commands/check_ignore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self, args):
1616

1717
def _show_results(self, result: "CheckIgnoreResult"):
1818
if not result.match and not self.args.details:
19-
return
19+
return None
2020

2121
if self.args.details:
2222
pattern_infos = result.pattern_infos

dvc/commands/dataset.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def display(self, name: str, dataset: "Dataset", new: "Dataset"):
8383
return CmdDatasetAdd.display(name, new, action)
8484
if dataset == new:
8585
ui.write("[yellow]Nothing to update[/]", styled=True)
86-
return
86+
return None
8787

8888
assert new.lock
8989

@@ -112,6 +112,7 @@ def display(self, name: str, dataset: "Dataset", new: "Dataset"):
112112
assert new.type == "url"
113113
stats = diff_files(dataset.lock.files, new.lock.files)
114114
log_changes(stats)
115+
return None
115116

116117
def run(self):
117118
from difflib import get_close_matches

dvc/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def get_dir(cls, level):
139139
return global_config_dir()
140140
if level == "system":
141141
return system_config_dir()
142+
return None
142143

143144
@cached_property
144145
def files(self) -> dict[str, str]:

dvc/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_connection(self, onerror: Optional[Callable[[], Any]] = None) -> None:
8484
except Exception as exc:
8585
if callable(onerror):
8686
onerror()
87-
logger.exception(
87+
logger.exception( # noqa: LOG007
8888
"Could not connect to the database. "
8989
"Check your database credentials and try again.",
9090
exc_info=False,

dvc/dvcfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def dump(self, stage, **kwargs) -> None:
203203

204204
def dump_stages(self, stages, **kwargs) -> None:
205205
if not stages:
206-
return
206+
return None
207207

208208
assert len(stages) == 1, "SingleStageFile can only dump one stage."
209209
return self.dump(stages[0], **kwargs)

dvc/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from dvc.stage import Stage
1010

1111

12-
class DvcException(Exception):
12+
class DvcException(Exception): # noqa: N818
1313
"""Base class for all dvc exceptions."""
1414

1515
def __init__(self, msg, *args):

dvc/logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def log_to_root(message, *args, **kwargs):
5555
setattr(logging, method_name, log_to_root)
5656

5757

58-
class LoggingException(Exception):
58+
class LoggingException(Exception): # noqa: N818
5959
def __init__(self, record):
6060
msg = f"failed to log {record!s}"
6161
super().__init__(msg)

dvc/output.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,12 +1473,13 @@ def merge_version_meta(
14731473
):
14741474
"""Merge version meta for files which are unchanged from other."""
14751475
if not self.hash_info:
1476-
return
1476+
return None
14771477
if self.hash_info.isdir:
14781478
return self._merge_dir_version_meta(old_hi, old_obj)
14791479
if self.hash_info != old_hi:
1480-
return
1480+
return None
14811481
self.meta = old_meta
1482+
return None
14821483

14831484
def _merge_dir_version_meta(
14841485
self, old_hi: "HashInfo", old_obj: Optional[Union["HashFile", "Tree"]]

dvc/parsing/context.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class ParamsLoadError(ContextError):
6666
pass
6767

6868

69-
class KeyNotInContext(ContextError, KeyError):
69+
class KeyNotInContext(ContextError, KeyError): # noqa: N818
7070
def __init__(self, key: str) -> None:
7171
self.key: str = key
7272
super().__init__(f"Could not find '{key}'")
@@ -75,7 +75,7 @@ def __str__(self):
7575
return self.msg
7676

7777

78-
class VarsAlreadyLoaded(ContextError):
78+
class VarsAlreadyLoaded(ContextError): # noqa: N818
7979
pass
8080

8181

@@ -272,7 +272,7 @@ def __setitem__(self, key, value):
272272
if not isinstance(key, str):
273273
# limitation for the interpolation
274274
# ignore other kinds of keys
275-
return
275+
return None
276276
return super().__setitem__(key, value)
277277

278278
def merge_update(self, other, overwrite=False):

0 commit comments

Comments
 (0)