diff --git a/dvc/__pyinstaller/hook-celery.py b/dvc/__pyinstaller/hook-celery.py index 6e106be0c..9feea5d0f 100644 --- a/dvc/__pyinstaller/hook-celery.py +++ b/dvc/__pyinstaller/hook-celery.py @@ -1,5 +1,5 @@ # ruff: noqa: N999 -# pylint: disable=import-error + from PyInstaller.utils.hooks import collect_submodules, is_module_or_submodule # Celery dynamically imports most celery internals at runtime diff --git a/dvc/__pyinstaller/hook-dvc_task.py b/dvc/__pyinstaller/hook-dvc_task.py index 6f6972b88..9a619080f 100644 --- a/dvc/__pyinstaller/hook-dvc_task.py +++ b/dvc/__pyinstaller/hook-dvc_task.py @@ -1,5 +1,5 @@ # ruff: noqa: N999 -# pylint: disable=import-error + from PyInstaller.utils.hooks import collect_submodules hiddenimports = collect_submodules("dvc_task") diff --git a/dvc/_debug.py b/dvc/_debug.py index c40327e14..072e03794 100644 --- a/dvc/_debug.py +++ b/dvc/_debug.py @@ -14,7 +14,7 @@ def viztracer_profile( log_async: bool = False, ): try: - import viztracer # pylint: disable=import-error + import viztracer except ImportError: print("Failed to run profiler, viztracer is not installed") # noqa: T201 yield @@ -36,7 +36,7 @@ def yappi_profile( separate_threads: Optional[bool] = False, ): try: - import yappi # pylint: disable=import-error + import yappi except ImportError: print("Failed to run profiler, yappi is not installed") # noqa: T201 yield @@ -76,7 +76,7 @@ def yappi_profile( def instrument(html_output=False): """Run a statistical profiler""" try: - from pyinstrument import Profiler # pylint: disable=import-error + from pyinstrument import Profiler except ImportError: print("Failed to run profiler, pyinstrument is not installed") # noqa: T201 yield @@ -115,7 +115,7 @@ def profile(dump_path: Optional[str] = None): def debug(): try: yield - except Exception: # pylint: disable=broad-except + except Exception: try: import ipdb as pdb # noqa: T100, pylint: disable=import-error except ImportError: diff --git a/dvc/api/__init__.py b/dvc/api/__init__.py index c82de3b24..82cc13242 100644 --- a/dvc/api/__init__.py +++ b/dvc/api/__init__.py @@ -1,8 +1,7 @@ from dvc.fs.dvc import _DVCFileSystem as DVCFileSystem from .artifacts import artifacts_show -from .data import open # pylint: disable=redefined-builtin -from .data import get_url, read +from .data import get_url, open, read from .experiments import exp_save, exp_show from .scm import all_branches, all_commits, all_tags from .show import metrics_show, params_show diff --git a/dvc/api/data.py b/dvc/api/data.py index d9951b4ce..de638fb50 100644 --- a/dvc/api/data.py +++ b/dvc/api/data.py @@ -55,7 +55,7 @@ def get_url(path, repo=None, rev=None, remote=None): class _OpenContextManager(GCM): - def __init__(self, func, args, kwds): # pylint: disable=super-init-not-called + def __init__(self, func, args, kwds): self.gen = func(*args, **kwds) self.func, self.args, self.kwds = ( # type: ignore[assignment] func, diff --git a/dvc/cachemgr.py b/dvc/cachemgr.py index 2300323da..13ce73644 100644 --- a/dvc/cachemgr.py +++ b/dvc/cachemgr.py @@ -137,7 +137,7 @@ def migrate_2_to_3(repo: "Repo", dry: bool = False): src = repo.cache.legacy dest = repo.cache.local if dry: - oids = list(src._list_oids()) # pylint: disable=protected-access + oids = list(src._list_oids()) ui.write( f"{len(oids)} files will be re-hashed and migrated to the DVC 3.0 cache " "location." diff --git a/dvc/cli/__init__.py b/dvc/cli/__init__.py index 85c3e812e..a5dd55e5d 100644 --- a/dvc/cli/__init__.py +++ b/dvc/cli/__init__.py @@ -165,9 +165,9 @@ def main(argv=None): # noqa: C901, PLR0912, PLR0915 # the copied parent's standard file descriptors. If we make any logging # calls in this state it will cause an exception due to writing to a closed # file descriptor. - if not sys.stderr or sys.stderr.closed: # pylint: disable=using-constant-test + if not sys.stderr or sys.stderr.closed: logging.disable() - elif not sys.stdout or sys.stdout.closed: # pylint: disable=using-constant-test + elif not sys.stdout or sys.stdout.closed: logging.disable(logging.INFO) args = None @@ -231,7 +231,6 @@ def main(argv=None): # noqa: C901, PLR0912, PLR0915 except DvcParserError: ret = 254 except Exception as exc: # noqa: BLE001, pylint: disable=broad-except - # pylint: disable=no-member ret = _log_exceptions(exc) or 255 try: diff --git a/dvc/cli/command.py b/dvc/cli/command.py index 3d66c7449..8dc1db5b7 100644 --- a/dvc/cli/command.py +++ b/dvc/cli/command.py @@ -31,7 +31,7 @@ class CmdBase(ABC): class CmdBaseNoRepo(CmdBase): - def __init__(self, args): # pylint: disable=super-init-not-called + def __init__(self, args): self.args = args os.chdir(args.cd) diff --git a/dvc/cli/parser.py b/dvc/cli/parser.py index a71b9fb94..00110ce81 100644 --- a/dvc/cli/parser.py +++ b/dvc/cli/parser.py @@ -95,12 +95,12 @@ COMMANDS = [ def _find_parser(parser, cmd_cls): - defaults = parser._defaults # pylint: disable=protected-access + defaults = parser._defaults if not cmd_cls or cmd_cls == defaults.get("func"): parser.print_help() raise DvcParserError - actions = parser._actions # pylint: disable=protected-access + actions = parser._actions for action in actions: if not isinstance(action.choices, dict): # NOTE: we are only interested in subparsers @@ -112,7 +112,7 @@ def _find_parser(parser, cmd_cls): class DvcParser(argparse.ArgumentParser): """Custom parser class for dvc CLI.""" - def error(self, message, cmd_cls=None): # pylint: disable=arguments-differ + def error(self, message, cmd_cls=None): logger.error(message) _find_parser(self, cmd_cls) diff --git a/dvc/config.py b/dvc/config.py index c5d1fcdf2..9178cb901 100644 --- a/dvc/config.py +++ b/dvc/config.py @@ -96,7 +96,7 @@ class Config(dict): config: Optional["DictStrAny"] = None, remote: Optional[str] = None, remote_config: Optional["DictStrAny"] = None, - ): # pylint: disable=super-init-not-called + ): from dvc.fs import LocalFileSystem dvc_dir = os.fspath(dvc_dir) if dvc_dir else None diff --git a/dvc/daemon.py b/dvc/daemon.py index a589faa4b..fe6c518c3 100644 --- a/dvc/daemon.py +++ b/dvc/daemon.py @@ -75,18 +75,18 @@ def _fork_process() -> int: return pid except OSError: logger.exception("failed at first fork") - os._exit(1) # pylint: disable=protected-access + os._exit(1) - os.setsid() # type: ignore[attr-defined] # pylint: disable=no-member + os.setsid() # type: ignore[attr-defined] try: # pylint: disable-next=no-member pid = os.fork() # type: ignore[attr-defined] if pid > 0: - os._exit(0) # pylint: disable=protected-access + os._exit(0) except OSError: logger.exception("failed at second fork") - os._exit(1) # pylint: disable=protected-access + os._exit(1) # disconnect from the terminal fd = os.open(os.devnull, os.O_RDWR) diff --git a/dvc/dagascii.py b/dvc/dagascii.py index 56ffc8dfd..725dc7390 100644 --- a/dvc/dagascii.py +++ b/dvc/dagascii.py @@ -22,17 +22,16 @@ class VertexViewer: HEIGHT = 3 # top and bottom box edges + text def __init__(self, name): - # pylint: disable=invalid-name self._h = self.HEIGHT # top and bottom box edges + text self._w = len(name) + 2 # right and left bottom edges + text @property - def h(self): # pylint: disable=invalid-name + def h(self): """Height of the box.""" return self._h @property - def w(self): # pylint: disable=invalid-name + def w(self): """Width of the box.""" return self._w @@ -90,7 +89,6 @@ class AsciiCanvas: y1 (int): y coordinate where the line should end. char (str): character to draw the line with. """ - # pylint: disable=too-many-arguments, too-many-branches if x0 > x1: x1, x0 = x0, x1 y1, y0 = y0, y1 @@ -234,11 +232,11 @@ def draw(vertices, edges): | 1 | +---+ """ - # pylint: disable=too-many-locals + # NOTE: coordinates might me negative, so we need to shift # everything to the positive plane before we actually draw it. - Xs = [] # noqa: N806, pylint: disable=invalid-name - Ys = [] # noqa: N806, pylint: disable=invalid-name + Xs = [] # noqa: N806 + Ys = [] # noqa: N806 sug = _build_sugiyama_layout(vertices, edges) @@ -250,7 +248,7 @@ def draw(vertices, edges): Ys.append(vertex.view.xy[1] + vertex.view.h) for edge in sug.g.sE: - for x, y in edge.view._pts: # pylint: disable=protected-access + for x, y in edge.view._pts: Xs.append(x) Ys.append(y) @@ -266,7 +264,6 @@ def draw(vertices, edges): # NOTE: first draw edges so that node boxes could overwrite them for edge in sug.g.sE: - # pylint: disable=protected-access assert len(edge.view._pts) > 1 for index in range(1, len(edge.view._pts)): start = edge.view._pts[index - 1] diff --git a/dvc/dvcfile.py b/dvc/dvcfile.py index 67ee60794..bb71eb232 100644 --- a/dvc/dvcfile.py +++ b/dvc/dvcfile.py @@ -237,9 +237,7 @@ class ProjectFile(FileMixin): self.__dict__.pop("resolver", None) self.__dict__.pop("stages", None) - def dump( - self, stage, update_pipeline=True, update_lock=True, **kwargs - ): # pylint: disable=arguments-differ + def dump(self, stage, update_pipeline=True, update_lock=True, **kwargs): """Dumps given stage appropriately in the dvcfile.""" from dvc.stage import PipelineStage diff --git a/dvc/fs/__init__.py b/dvc/fs/__init__.py index 76605801e..bbe169eff 100644 --- a/dvc/fs/__init__.py +++ b/dvc/fs/__init__.py @@ -5,8 +5,6 @@ from dvc_http import HTTPFileSystem, HTTPSFileSystem # noqa: F401 from dvc.config import ConfigError as RepoConfigError from dvc.config_schema import SCHEMA, Invalid - -# pylint: disable=unused-import from dvc_objects.fs import ( # noqa: F401 LocalFileSystem, MemoryFileSystem, diff --git a/dvc/fs/callbacks.py b/dvc/fs/callbacks.py index 6fb4658b8..dd4ce3f38 100644 --- a/dvc/fs/callbacks.py +++ b/dvc/fs/callbacks.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-import from contextlib import ExitStack from typing import TYPE_CHECKING, Any, BinaryIO, Dict, Optional, Union diff --git a/dvc/fs/data.py b/dvc/fs/data.py index 3156d48e9..1691012e9 100644 --- a/dvc/fs/data.py +++ b/dvc/fs/data.py @@ -22,7 +22,7 @@ class DataFileSystem(FileSystem): return config @functools.cached_property - def fs( # pylint: disable=invalid-overridden-method + def fs( self, ) -> "_DataFileSystem": from dvc_data.fs import DataFileSystem as _DataFileSystem diff --git a/dvc/fs/dvc.py b/dvc/fs/dvc.py index 440dd9544..d6c9865e4 100644 --- a/dvc/fs/dvc.py +++ b/dvc/fs/dvc.py @@ -72,7 +72,7 @@ def _get_dvc_path(dvc_fs, subkey): return dvc_fs.path.join(*subkey) if subkey else "" -class _DVCFileSystem(AbstractFileSystem): # pylint:disable=abstract-method +class _DVCFileSystem(AbstractFileSystem): cachable = False root_marker = "/" @@ -84,9 +84,7 @@ class _DVCFileSystem(AbstractFileSystem): # pylint:disable=abstract-method subrepos: bool = False, repo_factory: Optional[RepoFactory] = None, fo: Optional[str] = None, - # pylint:disable-next=unused-argument target_options: Optional[Dict[str, Any]] = None, # noqa: ARG002 - # pylint:disable-next=unused-argument target_protocol: Optional[str] = None, # noqa: ARG002 config: Optional["DictStrAny"] = None, remote: Optional[str] = None, @@ -146,7 +144,7 @@ class _DVCFileSystem(AbstractFileSystem): # pylint:disable=abstract-method remote_config=remote_config, ) assert repo is not None - # pylint: disable=protected-access + repo_factory = repo._fs_conf["repo_factory"] self._repo_stack.enter_context(repo) @@ -282,9 +280,7 @@ class _DVCFileSystem(AbstractFileSystem): # pylint:disable=abstract-method dvc_fs = self._datafss.get(repo_key) return repo, dvc_fs, subkey - def _open( - self, path, mode="rb", **kwargs - ): # pylint: disable=arguments-renamed, arguments-differ + def _open(self, path, mode="rb", **kwargs): if mode != "rb": raise OSError(errno.EROFS, os.strerror(errno.EROFS)) @@ -307,9 +303,7 @@ class _DVCFileSystem(AbstractFileSystem): # pylint:disable=abstract-method except FileNotFoundError: return False - def ls( # pylint: disable=arguments-differ # noqa: C901 - self, path, detail=True, dvc_only=False, **kwargs - ): + def ls(self, path, detail=True, dvc_only=False, **kwargs): # noqa: C901 key = self._get_key_from_relative(path) repo, dvc_fs, subkey = self._get_subrepo_info(key) @@ -414,7 +408,7 @@ class _DVCFileSystem(AbstractFileSystem): # pylint:disable=abstract-method info["name"] = path return info - def get_file(self, rpath, lpath, **kwargs): # pylint: disable=arguments-differ + def get_file(self, rpath, lpath, **kwargs): key = self._get_key_from_relative(rpath) fs_path = self._from_key(key) try: @@ -439,7 +433,6 @@ class DVCFileSystem(FileSystem): return config @functools.cached_property - # pylint: disable-next=invalid-overridden-method def fs(self) -> "_DVCFileSystem": return _DVCFileSystem(**self.fs_args) @@ -451,7 +444,7 @@ class DVCFileSystem(FileSystem): return self.fs.isdvc(path, **kwargs) @property - def path(self) -> Path: # pylint: disable=invalid-overridden-method + def path(self) -> Path: return self.fs.path @property diff --git a/dvc/fs/git.py b/dvc/fs/git.py index fc8715ff9..c1da16745 100644 --- a/dvc/fs/git.py +++ b/dvc/fs/git.py @@ -39,7 +39,7 @@ class GitFileSystem(FileSystem): # pylint:disable=abstract-method ) @functools.cached_property - def fs( # pylint: disable=invalid-overridden-method + def fs( self, ) -> "FsspecGitFileSystem": from scmrepo.fs import GitFileSystem as FsspecGitFileSystem @@ -47,7 +47,7 @@ class GitFileSystem(FileSystem): # pylint:disable=abstract-method return FsspecGitFileSystem(**self.fs_args) @functools.cached_property - def path(self): # pylint: disable=invalid-overridden-method + def path(self): return self.fs.path @property diff --git a/dvc/lock.py b/dvc/lock.py index a147ba668..9a58c090a 100644 --- a/dvc/lock.py +++ b/dvc/lock.py @@ -59,7 +59,7 @@ class LockBase(ABC): class LockNoop(LockBase): - def __init__(self, *args, **kwargs): # pylint: disable=super-init-not-called + def __init__(self, *args, **kwargs): self._lock = False def lock(self): @@ -149,9 +149,7 @@ class HardlinkLock(flufl.lock.Lock, LockBase): tmp_dir (str): a directory to store claim files. """ - def __init__( - self, lockfile, tmp_dir=None, **kwargs - ): # pylint: disable=super-init-not-called + def __init__(self, lockfile, tmp_dir=None, **kwargs): import socket self._tmp_dir = tmp_dir @@ -176,7 +174,7 @@ class HardlinkLock(flufl.lock.Lock, LockBase): self._owned = True self._retry_errnos = [] - def lock(self): # pylint: disable=arguments-differ + def lock(self): try: super().lock(timedelta(seconds=DEFAULT_TIMEOUT)) except flufl.lock.TimeOutError: diff --git a/dvc/logger.py b/dvc/logger.py index 4abff4a75..da4a4a650 100644 --- a/dvc/logger.py +++ b/dvc/logger.py @@ -33,7 +33,6 @@ def add_logging_level(level_name, level_num, method_name=None): def log_for_level(self, message, *args, **kwargs): if self.isEnabledFor(level_num): - # pylint: disable=protected-access self._log(level_num, message, args, **kwargs) def log_to_root(message, *args, **kwargs): diff --git a/dvc/output.py b/dvc/output.py index f2fd7bb5f..0e1fdd771 100644 --- a/dvc/output.py +++ b/dvc/output.py @@ -679,8 +679,6 @@ class Output: return False return self.fs.isfile(self.fs_path) - # pylint: disable=no-member - def ignore(self) -> None: if not self.use_scm_ignore: return @@ -1021,7 +1019,6 @@ class Output: self.ignore_remove() def move(self, out): - # pylint: disable=no-member if self.protocol == "local" and self.use_scm_ignore: self.repo.scm_context.ignore_remove(self.fspath) @@ -1132,7 +1129,7 @@ class Output: try: self.get_dir_cache(jobs=jobs, remote=remote) - except RemoteMissingDepsError: # pylint: disable=try-except-raise + except RemoteMissingDepsError: raise except DvcException: logger.debug("failed to pull cache for '%s'", self) diff --git a/dvc/parsing/context.py b/dvc/parsing/context.py index 6484f0829..1842c77e8 100644 --- a/dvc/parsing/context.py +++ b/dvc/parsing/context.py @@ -324,9 +324,7 @@ class Context(CtxDict): keys = [keys] if isinstance(keys, str) else keys params_file.update({key: node.value for key in keys}) - def select( - self, key: str, unwrap: bool = False - ): # pylint: disable=arguments-differ + def select(self, key: str, unwrap: bool = False): """Select the item using key, similar to `__getitem__` but can track the usage of the data on interpolation as well and can get from nested data structure by using diff --git a/dvc/repo/__init__.py b/dvc/repo/__init__.py index 3c7698b84..670f5423a 100644 --- a/dvc/repo/__init__.py +++ b/dvc/repo/__init__.py @@ -37,7 +37,6 @@ logger = logging.getLogger(__name__) @contextmanager def lock_repo(repo: "Repo"): - # pylint: disable=protected-access depth: int = repo._lock_depth repo._lock_depth += 1 @@ -588,7 +587,7 @@ class Repo: path = os.path.join(self.tmp_dir, "btime") try: - with open(path, "x"): # pylint: disable=unspecified-encoding + with open(path, "x"): pass except FileNotFoundError: return None @@ -658,7 +657,7 @@ class Repo: self._data_index.close() def _reset(self): - self.scm._reset() # pylint: disable=protected-access + self.scm._reset() self.state.close() if "dvcfs" in self.__dict__: self.dvcfs.close() diff --git a/dvc/repo/add.py b/dvc/repo/add.py index 4a1c58082..0e630fbd2 100644 --- a/dvc/repo/add.py +++ b/dvc/repo/add.py @@ -140,7 +140,6 @@ def progress_iter(stages: Dict[str, StageInfo]) -> Iterator[Tuple[str, StageInfo pbar.refresh() yield item, stage_info if total == 1: # restore bar format for stats - # pylint: disable=no-member pbar.bar_format = pbar.BAR_FMT_DEFAULT diff --git a/dvc/repo/artifacts.py b/dvc/repo/artifacts.py index 363730055..a772e6a48 100644 --- a/dvc/repo/artifacts.py +++ b/dvc/repo/artifacts.py @@ -101,7 +101,7 @@ class Artifacts: for ( dvcfile, dvcfile_artifacts, - ) in self.repo.index._artifacts.items(): # pylint: disable=protected-access + ) in self.repo.index._artifacts.items(): dvcyaml = relpath(dvcfile, self.repo.root_dir) artifacts[dvcyaml] = {} for name, value in dvcfile_artifacts.items(): diff --git a/dvc/repo/brancher.py b/dvc/repo/brancher.py index 509ec0390..9526ba26b 100644 --- a/dvc/repo/brancher.py +++ b/dvc/repo/brancher.py @@ -103,7 +103,7 @@ def brancher( # noqa: E302 self.fs = saved_fs self.root_dir = saved_root self.dvc_dir = saved_dvc_dir - self._reset() # pylint: disable=protected-access + self._reset() def _switch_fs( @@ -129,7 +129,7 @@ def _switch_fs( repo.fs = fs repo.root_dir = root_dir repo.dvc_dir = fs.path.join(root_dir, repo.DVC_DIR) - repo._reset() # pylint: disable=protected-access + repo._reset() if cwd_parts: cwd = repo.fs.path.join("/", *cwd_parts) @@ -162,4 +162,4 @@ def switch(repo: "Repo", rev: str) -> Iterator[str]: repo.fs = saved_fs repo.root_dir = saved_root repo.dvc_dir = saved_dvc_dir - repo._reset() # pylint: disable=protected-access + repo._reset() diff --git a/dvc/repo/checkout.py b/dvc/repo/checkout.py index cf9ae35e1..85ab8d4ee 100644 --- a/dvc/repo/checkout.py +++ b/dvc/repo/checkout.py @@ -129,7 +129,7 @@ def checkout( # noqa: C901 ), ): raise CheckoutErrorSuggestGit(target) from exc - raise # pylint: disable=misplaced-bare-raise + raise view = self.index.targets_view( targets, diff --git a/dvc/repo/commit.py b/dvc/repo/commit.py index 28e5f1a40..4b3b1b6c5 100644 --- a/dvc/repo/commit.py +++ b/dvc/repo/commit.py @@ -104,8 +104,8 @@ def commit_2_to_3(repo: "Repo", dry: bool = False): ui.write("Entries in following DVC files will be migrated to the 3.0 format:") ui.write("\n".join(sorted(f"\t{file}" for file in migrated))) return - for stage, filter_info in view._stage_infos: # pylint: disable=protected-access - outs_filter = view._outs_filter # pylint: disable=protected-access + for stage, filter_info in view._stage_infos: + outs_filter = view._outs_filter outs = { out for out in stage.filter_outs(filter_info) diff --git a/dvc/repo/experiments/executor/base.py b/dvc/repo/experiments/executor/base.py index 3b5f41d17..97a03ce50 100644 --- a/dvc/repo/experiments/executor/base.py +++ b/dvc/repo/experiments/executor/base.py @@ -259,7 +259,7 @@ class BaseExecutor(ABC): chain( _collect_top_level_metrics(repo), _collect_top_level_params(repo), - repo.index._plot_sources, # pylint: disable=protected-access + repo.index._plot_sources, ) ) diff --git a/dvc/repo/experiments/queue/remove.py b/dvc/repo/experiments/queue/remove.py index d709ff8ad..76d7f0bd9 100644 --- a/dvc/repo/experiments/queue/remove.py +++ b/dvc/repo/experiments/queue/remove.py @@ -39,7 +39,7 @@ def remove_tasks( # noqa: C901, PLR0912 for ( msg, queue_entry, - ) in celery_queue._iter_queued(): # pylint: disable=protected-access + ) in celery_queue._iter_queued(): if queue_entry.stash_rev in stash_revs and msg.delivery_tag: celery_queue.celery.reject(msg.delivery_tag) finally: @@ -49,7 +49,7 @@ def remove_tasks( # noqa: C901, PLR0912 for ( msg, queue_entry, - ) in celery_queue._iter_processed(): # pylint: disable=protected-access + ) in celery_queue._iter_processed(): if queue_entry not in done_entry_set: continue task_id = msg.headers["id"] diff --git a/dvc/repo/experiments/queue/tasks.py b/dvc/repo/experiments/queue/tasks.py index 4a2696f5e..d886619c3 100644 --- a/dvc/repo/experiments/queue/tasks.py +++ b/dvc/repo/experiments/queue/tasks.py @@ -72,7 +72,7 @@ def collect_exp( else: logger.debug("Experiment failed (Exec result was None)") celery_queue.stash_failed(entry) - except Exception: # pylint: disable=broad-except + except Exception: # Log exceptions but do not re-raise so that task chain execution # continues logger.exception("Failed to collect experiment") diff --git a/dvc/repo/experiments/queue/workspace.py b/dvc/repo/experiments/queue/workspace.py index c9218b52f..0be3a92bc 100644 --- a/dvc/repo/experiments/queue/workspace.py +++ b/dvc/repo/experiments/queue/workspace.py @@ -158,7 +158,7 @@ class WorkspaceQueue(BaseStashQueue): return None @staticmethod - def collect_executor( # pylint: disable=unused-argument + def collect_executor( exp: "Experiments", executor: "BaseExecutor", # noqa: ARG004 exec_result: "ExecutorResult", diff --git a/dvc/repo/experiments/show.py b/dvc/repo/experiments/show.py index ffa8cc68f..109664664 100644 --- a/dvc/repo/experiments/show.py +++ b/dvc/repo/experiments/show.py @@ -144,11 +144,7 @@ def _build_rows( row["Created"] = format_time( baseline.data.timestamp, fill_value=fill_value, **kwargs ) - row.update( - _data_cells( # pylint: disable=missing-kwoa - baseline, fill_value=fill_value, **kwargs - ) - ) + row.update(_data_cells(baseline, fill_value=fill_value, **kwargs)) yield tuple(row.values()) if baseline.experiments: if sort_by: @@ -262,11 +258,7 @@ def _exp_range_rows( row["Created"] = format_time( exp.data.timestamp, fill_value=fill_value, **kwargs ) - row.update( - _data_cells( # pylint: disable=missing-kwoa - exp, fill_value=fill_value, **kwargs - ) - ) + row.update(_data_cells(exp, fill_value=fill_value, **kwargs)) yield tuple(row.values()) diff --git a/dvc/repo/experiments/stash.py b/dvc/repo/experiments/stash.py index 1ac1cf86b..4d62b5db8 100644 --- a/dvc/repo/experiments/stash.py +++ b/dvc/repo/experiments/stash.py @@ -150,7 +150,7 @@ class ApplyStash(Stash): yield stash_rev if stash_rev: self._apply_difference(stash_rev, rev) - except Exception: # pylint: disable=broad-except + except Exception: self.revert_workspace() raise diff --git a/dvc/repo/experiments/utils.py b/dvc/repo/experiments/utils.py index bf8916128..6c6fbe35f 100644 --- a/dvc/repo/experiments/utils.py +++ b/dvc/repo/experiments/utils.py @@ -68,7 +68,7 @@ def unlocked_repo(f): @wraps(f) def wrapper(exp, *args, **kwargs): exp.repo.lock.unlock() - exp.repo._reset() # pylint: disable=protected-access + exp.repo._reset() try: ret = f(exp, *args, **kwargs) finally: diff --git a/dvc/repo/fetch.py b/dvc/repo/fetch.py index 52d6f9744..bd20dc0e3 100644 --- a/dvc/repo/fetch.py +++ b/dvc/repo/fetch.py @@ -62,7 +62,7 @@ def _collect_indexes( # noqa: PLR0913 idx.data["repo"].onerror = _make_index_onerror(onerror, rev) indexes[rev or "workspace"] = idx - except Exception as exc: # pylint: disable=broad-except + except Exception as exc: if onerror: onerror(rev, None, exc) collection_exc = exc @@ -167,7 +167,7 @@ def fetch( # noqa: C901, PLR0913 data, jobs=jobs, callback=pb.as_callback(), - ) # pylint: disable=assignment-from-no-return + ) finally: for fs_index in data: fs_index.close() diff --git a/dvc/repo/index.py b/dvc/repo/index.py index 011e751b9..a7a5c51ab 100644 --- a/dvc/repo/index.py +++ b/dvc/repo/index.py @@ -243,7 +243,6 @@ class Index: onerror = onerror or repo.stage_collection_error_handler for _, idx in collect_files(repo, onerror=onerror): - # pylint: disable=protected-access stages.extend(idx.stages) metrics.update(idx._metrics) plots.update(idx._plots) @@ -505,7 +504,7 @@ class Index: if not onerror: def onerror(_target, _exc): - raise # pylint: disable=misplaced-bare-raise + raise targets = ensure_list(targets) if not targets: @@ -616,7 +615,7 @@ class _DataPrefixes(NamedTuple): class IndexView: """Read-only view of Index.data using filtered stages.""" - def __init__( # pylint: disable=redefined-outer-name + def __init__( self, index: Index, stage_infos: Iterable["StageInfo"], diff --git a/dvc/repo/metrics/diff.py b/dvc/repo/metrics/diff.py index 157ca5865..5fc6a35bb 100644 --- a/dvc/repo/metrics/diff.py +++ b/dvc/repo/metrics/diff.py @@ -51,7 +51,7 @@ def diff( repo: "Repo", a_rev: str = "HEAD", b_rev: str = "workspace", - all: bool = False, # noqa: A002 # pylint: disable=redefined-builtin + all: bool = False, # noqa: A002 **kwargs, ) -> DiffResult: if repo.scm.no_commits: diff --git a/dvc/repo/metrics/show.py b/dvc/repo/metrics/show.py index f4847f67d..6b61878c4 100644 --- a/dvc/repo/metrics/show.py +++ b/dvc/repo/metrics/show.py @@ -33,7 +33,7 @@ logger = logging.getLogger(__name__) def _collect_top_level_metrics(repo: "Repo") -> Iterator[str]: - top_metrics = repo.index._metrics # pylint: disable=protected-access + top_metrics = repo.index._metrics for dvcfile, metrics in top_metrics.items(): wdir = repo.fs.path.relpath(repo.fs.path.parent(dvcfile), repo.root_dir) for file in metrics: diff --git a/dvc/repo/params/diff.py b/dvc/repo/params/diff.py index 6a7c9748f..0d4669f7d 100644 --- a/dvc/repo/params/diff.py +++ b/dvc/repo/params/diff.py @@ -9,7 +9,7 @@ def diff( repo: "Repo", a_rev: str = "HEAD", b_rev: str = "workspace", - all: bool = False, # noqa: A002 # pylint: disable=redefined-builtin + all: bool = False, # noqa: A002 **kwargs, ) -> "DiffResult": if repo.scm.no_commits: diff --git a/dvc/repo/params/show.py b/dvc/repo/params/show.py index 21c1d43a7..cf3eb4b52 100644 --- a/dvc/repo/params/show.py +++ b/dvc/repo/params/show.py @@ -19,7 +19,7 @@ logger = logging.getLogger(__name__) def _collect_top_level_params(repo: "Repo") -> Iterator[str]: - top_params = repo.index._params # pylint: disable=protected-access + top_params = repo.index._params for dvcfile, params in top_params.items(): wdir = repo.fs.path.relpath(repo.fs.path.parent(dvcfile), repo.root_dir) for file in params: diff --git a/dvc/repo/plots/__init__.py b/dvc/repo/plots/__init__.py index 4225e3a50..961bca9dc 100644 --- a/dvc/repo/plots/__init__.py +++ b/dvc/repo/plots/__init__.py @@ -474,7 +474,7 @@ def _resolve_definitions( def _collect_pipeline_files(repo, targets: List[str], props, onerror=None): result: Dict[str, Dict] = {} - top_plots = repo.index._plots # pylint: disable=protected-access + top_plots = repo.index._plots for dvcfile, plots_def in top_plots.items(): dvcfile_path = _relpath(repo.dvcfs, dvcfile) dvcfile_defs_dict: Dict[str, Union[Dict, None]] = {} diff --git a/dvc/repo/push.py b/dvc/repo/push.py index b73babd96..d01638637 100644 --- a/dvc/repo/push.py +++ b/dvc/repo/push.py @@ -116,7 +116,7 @@ def push( # noqa: C901, PLR0913 data, jobs=jobs, callback=pb.as_callback(), - ) # pylint: disable=assignment-from-no-return + ) finally: ws_idx = indexes.get("workspace") if ws_idx is not None: diff --git a/dvc/repo/scm_context.py b/dvc/repo/scm_context.py index 6228405e9..5982c47ba 100644 --- a/dvc/repo/scm_context.py +++ b/dvc/repo/scm_context.py @@ -136,12 +136,12 @@ class SCMContext: self.files_to_track = set() def __enter__(self) -> "SCMContext": - self._cm = self() # pylint: disable=attribute-defined-outside-init - return self._cm.__enter__() # pylint: disable=no-member + self._cm = self() + return self._cm.__enter__() def __exit__(self, *exc_args) -> None: assert self._cm - self._cm.__exit__(*exc_args) # pylint: disable=no-member + self._cm.__exit__(*exc_args) def scm_context(method, autostage: Optional[bool] = None, quiet: Optional[bool] = None): diff --git a/dvc/repo/worktree.py b/dvc/repo/worktree.py index b13ff3eac..e9f6c95e9 100644 --- a/dvc/repo/worktree.py +++ b/dvc/repo/worktree.py @@ -37,8 +37,6 @@ def worktree_view_by_remotes( push: bool = False, **kwargs: Any, ) -> Iterable[Tuple[Optional[str], "IndexView"]]: - # pylint: disable=protected-access - from dvc.repo.index import IndexView def outs_filter(view: "IndexView", remote: Optional[str]): diff --git a/dvc/scm.py b/dvc/scm.py index 945fb33cf..3bf43bead 100644 --- a/dvc/scm.py +++ b/dvc/scm.py @@ -100,9 +100,7 @@ def SCM( ... -def SCM( - root_dir, *, search_parent_directories=True, no_scm=False -): # pylint: disable=invalid-name +def SCM(root_dir, *, search_parent_directories=True, no_scm=False): """Returns SCM instance that corresponds to a repo at the specified path. diff --git a/dvc/stage/__init__.py b/dvc/stage/__init__.py index ef5b6ab8b..9a26d07dd 100644 --- a/dvc/stage/__init__.py +++ b/dvc/stage/__init__.py @@ -125,7 +125,7 @@ def restore_fields(stage: "Stage") -> None: return # will be used to restore comments later - # pylint: disable=protected-access + stage._stage_text = old._stage_text stage.meta = old.meta stage.desc = old.desc @@ -809,7 +809,7 @@ class PipelineStage(Stage): assert isinstance(self.dvcfile, ProjectFile) - self.dvcfile._reset() # pylint: disable=protected-access + self.dvcfile._reset() return self.dvcfile.stages[self.name] def _status_stage(self, ret) -> None: diff --git a/dvc/stage/decorators.py b/dvc/stage/decorators.py index db0012f97..1d6672a20 100644 --- a/dvc/stage/decorators.py +++ b/dvc/stage/decorators.py @@ -16,7 +16,7 @@ def rwlocked(call, read=None, write=None): if write is None: write = [] - stage = call._args[0] # pylint: disable=protected-access + stage = call._args[0] assert stage.repo.lock.is_locked @@ -47,7 +47,7 @@ def unlocked_repo(f): @wraps(f) def wrapper(stage, *args, **kwargs): stage.repo.lock.unlock() - stage.repo._reset() # pylint: disable=protected-access + stage.repo._reset() try: ret = f(stage, *args, **kwargs) finally: @@ -65,7 +65,7 @@ def relock_repo(f): ret = f(stage, *args, **kwargs) finally: stage.repo.lock.unlock() - stage.repo._reset() # pylint: disable=protected-access + stage.repo._reset() return ret return wrapper diff --git a/dvc/stage/loader.py b/dvc/stage/loader.py index b5be16cfc..f2ffa221c 100644 --- a/dvc/stage/loader.py +++ b/dvc/stage/loader.py @@ -123,7 +123,7 @@ class StageLoader(Mapping): def lockfile_needs_update(self): # if lockfile does not have all of the entries that dvc.yaml says it # should have, provide a debug message once - # pylint: disable=protected-access + lockfile = self.dvcfile._lockfile.relpath logger.debug("Lockfile '%s' needs to be updated.", lockfile) @@ -207,7 +207,7 @@ class SingleStageLoader(Mapping): dvcfile.repo.fs, dvcfile.path, d.get(Stage.PARAM_WDIR) ) stage = loads_from(Stage, dvcfile.repo, path, wdir, d) - stage._stage_text = stage_text # pylint: disable=protected-access + stage._stage_text = stage_text stage.deps = dependency.loadd_from(stage, d.get(Stage.PARAM_DEPS) or []) stage.outs = output.loadd_from(stage, d.get(Stage.PARAM_OUTS) or []) return stage diff --git a/dvc/stage/run.py b/dvc/stage/run.py index 53d84ce50..76e3db11d 100644 --- a/dvc/stage/run.py +++ b/dvc/stage/run.py @@ -74,7 +74,6 @@ def get_executable(): def _run(executable, cmd, **kwargs): - # pylint: disable=protected-access main_thread = isinstance( threading.current_thread(), threading._MainThread, # type: ignore[attr-defined] diff --git a/dvc/stage/serialize.py b/dvc/stage/serialize.py index a22b0ad94..8038f6513 100644 --- a/dvc/stage/serialize.py +++ b/dvc/stage/serialize.py @@ -209,7 +209,7 @@ def to_single_stage_file(stage: "Stage", **kwargs): # - reparse the same yaml text with a slow but smart ruamel yaml parser # - apply changes to a returned structure # - serialize it - text = stage._stage_text # pylint: disable=protected-access + text = stage._stage_text if text is None: return state diff --git a/dvc/stage/utils.py b/dvc/stage/utils.py index 3a104750d..9ae7d6274 100644 --- a/dvc/stage/utils.py +++ b/dvc/stage/utils.py @@ -294,7 +294,7 @@ def _get_stage_files(stage: "Stage") -> List[str]: file = stage.dvcfile ret.append(file.relpath) if isinstance(file, ProjectFile): - ret.append(file._lockfile.relpath) # pylint: disable=protected-access + ret.append(file._lockfile.relpath) for dep in stage.deps: if ( diff --git a/dvc/testing/api_tests.py b/dvc/testing/api_tests.py index 1f0932a74..bd780450d 100644 --- a/dvc/testing/api_tests.py +++ b/dvc/testing/api_tests.py @@ -4,8 +4,6 @@ from dvc import api from dvc.api import DVCFileSystem from dvc.utils.fs import remove -# pylint: disable=unused-argument - class TestAPI: def test_get_url(self, tmp_dir, dvc, remote): diff --git a/dvc/testing/benchmarks/cli/commands/test_add.py b/dvc/testing/benchmarks/cli/commands/test_add.py index dc46c6b19..9aadbaea1 100644 --- a/dvc/testing/benchmarks/cli/commands/test_add.py +++ b/dvc/testing/benchmarks/cli/commands/test_add.py @@ -1,3 +1,2 @@ -# pylint: disable=unused-argument def test_add(bench_dvc, tmp_dir, dvc, dataset): bench_dvc("add", dataset) diff --git a/dvc/testing/benchmarks/cli/commands/test_checkout.py b/dvc/testing/benchmarks/cli/commands/test_checkout.py index 9c3af95a6..2fe295a37 100644 --- a/dvc/testing/benchmarks/cli/commands/test_checkout.py +++ b/dvc/testing/benchmarks/cli/commands/test_checkout.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument import os import pytest diff --git a/dvc/testing/benchmarks/cli/commands/test_data_status.py b/dvc/testing/benchmarks/cli/commands/test_data_status.py index 465584d4c..d02a2c70b 100644 --- a/dvc/testing/benchmarks/cli/commands/test_data_status.py +++ b/dvc/testing/benchmarks/cli/commands/test_data_status.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument from shutil import rmtree import pytest diff --git a/dvc/testing/benchmarks/cli/commands/test_diff.py b/dvc/testing/benchmarks/cli/commands/test_diff.py index f3218ee52..2abcbc2a9 100644 --- a/dvc/testing/benchmarks/cli/commands/test_diff.py +++ b/dvc/testing/benchmarks/cli/commands/test_diff.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument def test_diff(bench_dvc, tmp_dir, scm, dvc, make_dataset): dataset = make_dataset(cache=True, files=True, dvcfile=True, commit=True) bench_dvc("diff") diff --git a/dvc/testing/benchmarks/cli/commands/test_exp_show.py b/dvc/testing/benchmarks/cli/commands/test_exp_show.py index 7feec4854..2b1ace509 100644 --- a/dvc/testing/benchmarks/cli/commands/test_exp_show.py +++ b/dvc/testing/benchmarks/cli/commands/test_exp_show.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument import pytest diff --git a/dvc/testing/benchmarks/cli/commands/test_gc.py b/dvc/testing/benchmarks/cli/commands/test_gc.py index 47599d0a0..3e5d6b224 100644 --- a/dvc/testing/benchmarks/cli/commands/test_gc.py +++ b/dvc/testing/benchmarks/cli/commands/test_gc.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument def test_gc(bench_dvc, tmp_dir, dvc, make_dataset): make_dataset(files=False, cache=True, dvcfile=False) bench_dvc("gc", "-f", "-w") diff --git a/dvc/testing/benchmarks/cli/commands/test_get.py b/dvc/testing/benchmarks/cli/commands/test_get.py index 3ecd9cfaf..806b44399 100644 --- a/dvc/testing/benchmarks/cli/commands/test_get.py +++ b/dvc/testing/benchmarks/cli/commands/test_get.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument def test_get(bench_dvc, tmp_dir, scm, dvc, make_dataset, remote): dataset = make_dataset( cache=False, files=False, dvcfile=True, commit=True, remote=True diff --git a/dvc/testing/benchmarks/cli/commands/test_get_url.py b/dvc/testing/benchmarks/cli/commands/test_get_url.py index 91cc4e6ea..426e84e36 100644 --- a/dvc/testing/benchmarks/cli/commands/test_get_url.py +++ b/dvc/testing/benchmarks/cli/commands/test_get_url.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument def test_get_url(bench_dvc, tmp_dir, scm, dvc, make_dataset): dataset = make_dataset( cache=False, files=True, dvcfile=False, commit=False, remote=False diff --git a/dvc/testing/benchmarks/cli/commands/test_import.py b/dvc/testing/benchmarks/cli/commands/test_import.py index 66d3a43f1..c40733e39 100644 --- a/dvc/testing/benchmarks/cli/commands/test_import.py +++ b/dvc/testing/benchmarks/cli/commands/test_import.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument def test_import(bench_dvc, tmp_dir, scm, dvc, make_dataset, remote): dataset = make_dataset( cache=False, files=False, dvcfile=True, commit=True, remote=True diff --git a/dvc/testing/benchmarks/cli/commands/test_import_url.py b/dvc/testing/benchmarks/cli/commands/test_import_url.py index f3e29bb10..a8b6298bd 100644 --- a/dvc/testing/benchmarks/cli/commands/test_import_url.py +++ b/dvc/testing/benchmarks/cli/commands/test_import_url.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument def test_import_url(bench_dvc, tmp_dir, scm, dvc, make_dataset): dataset = make_dataset( cache=False, files=True, dvcfile=False, commit=False, remote=False diff --git a/dvc/testing/benchmarks/cli/commands/test_init.py b/dvc/testing/benchmarks/cli/commands/test_init.py index cfd49e1fe..83f38260c 100644 --- a/dvc/testing/benchmarks/cli/commands/test_init.py +++ b/dvc/testing/benchmarks/cli/commands/test_init.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument import shutil diff --git a/dvc/testing/benchmarks/cli/commands/test_ls.py b/dvc/testing/benchmarks/cli/commands/test_ls.py index 2843a91f9..897d756e4 100644 --- a/dvc/testing/benchmarks/cli/commands/test_ls.py +++ b/dvc/testing/benchmarks/cli/commands/test_ls.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument def test_list(bench_dvc, tmp_dir, scm, dvc, make_dataset, remote): make_dataset(cache=False, files=False, dvcfile=True, commit=True, remote=True) bench_dvc("list", tmp_dir) diff --git a/dvc/testing/benchmarks/cli/commands/test_plots.py b/dvc/testing/benchmarks/cli/commands/test_plots.py index 29fecb520..2ed3210da 100644 --- a/dvc/testing/benchmarks/cli/commands/test_plots.py +++ b/dvc/testing/benchmarks/cli/commands/test_plots.py @@ -3,10 +3,6 @@ import pytest from dvc.repo import Repo from dvc.testing.benchmarks.fixtures import _pull -# pylint: disable=redefined-outer-name,unused-argument - -# pylint: disable=unused-argument - @pytest.mark.requires(minversion=(2, 34, 0), reason="top-level plots not supported") def test_plots(project, bench_dvc): diff --git a/dvc/testing/benchmarks/cli/commands/test_pull.py b/dvc/testing/benchmarks/cli/commands/test_pull.py index 286dd96f7..71ba264d3 100644 --- a/dvc/testing/benchmarks/cli/commands/test_pull.py +++ b/dvc/testing/benchmarks/cli/commands/test_pull.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument def test_pull(bench_dvc, tmp_dir, dvc, make_dataset, remote): make_dataset(cache=False, dvcfile=True, files=False, remote=True) bench_dvc("pull") diff --git a/dvc/testing/benchmarks/cli/commands/test_push.py b/dvc/testing/benchmarks/cli/commands/test_push.py index 2b979a616..17f2f1b50 100644 --- a/dvc/testing/benchmarks/cli/commands/test_push.py +++ b/dvc/testing/benchmarks/cli/commands/test_push.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument def test_push(bench_dvc, tmp_dir, dvc, make_dataset, remote): make_dataset(cache=True, dvcfile=True, files=False) bench_dvc("push") diff --git a/dvc/testing/benchmarks/cli/commands/test_status.py b/dvc/testing/benchmarks/cli/commands/test_status.py index ce5717187..6ba2b35d3 100644 --- a/dvc/testing/benchmarks/cli/commands/test_status.py +++ b/dvc/testing/benchmarks/cli/commands/test_status.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument def test_status(bench_dvc, tmp_dir, dvc, make_dataset): dataset = make_dataset(files=True, dvcfile=True, cache=True) bench_dvc("status") diff --git a/dvc/testing/benchmarks/cli/commands/test_update.py b/dvc/testing/benchmarks/cli/commands/test_update.py index 3ca4b8aa2..bb4fa7a83 100644 --- a/dvc/testing/benchmarks/cli/commands/test_update.py +++ b/dvc/testing/benchmarks/cli/commands/test_update.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-argument def test_update(bench_dvc, tmp_dir, dvc, make_dataset): dataset = make_dataset( cache=False, files=True, dvcfile=False, commit=False, remote=False diff --git a/dvc/testing/benchmarks/cli/stories/test_modify_data.py b/dvc/testing/benchmarks/cli/stories/test_modify_data.py index 7c0776101..cb315e613 100644 --- a/dvc/testing/benchmarks/cli/stories/test_modify_data.py +++ b/dvc/testing/benchmarks/cli/stories/test_modify_data.py @@ -9,8 +9,6 @@ import sys import pytest -# pylint: disable=unused-argument,unexpected-keyword-arg - @pytest.mark.skipif(sys.version_info < (3, 10), reason="requires 3.10 glob.glob") def test_partial_add(bench_dvc, tmp_dir, dvc, dataset, remote): diff --git a/dvc/testing/benchmarks/cli/stories/use_cases/test_sharing.py b/dvc/testing/benchmarks/cli/stories/use_cases/test_sharing.py index 268412dfe..0340a20fd 100644 --- a/dvc/testing/benchmarks/cli/stories/use_cases/test_sharing.py +++ b/dvc/testing/benchmarks/cli/stories/use_cases/test_sharing.py @@ -1,7 +1,5 @@ import shutil -# pylint: disable=unused-argument - def test_sharing(bench_dvc, tmp_dir, dvc, dataset, remote): bench_dvc("add", dataset) diff --git a/dvc/testing/benchmarks/conftest.py b/dvc/testing/benchmarks/conftest.py index ac47567f7..2d6446097 100644 --- a/dvc/testing/benchmarks/conftest.py +++ b/dvc/testing/benchmarks/conftest.py @@ -1 +1 @@ -from .fixtures import * # noqa: F403 # pylint: disable=wildcard-import +from .fixtures import * # noqa: F403 diff --git a/dvc/testing/benchmarks/fixtures.py b/dvc/testing/benchmarks/fixtures.py index 0122f8625..0982bb011 100644 --- a/dvc/testing/benchmarks/fixtures.py +++ b/dvc/testing/benchmarks/fixtures.py @@ -8,8 +8,6 @@ from dulwich.porcelain import clone from funcy import first from packaging import version -# pylint: disable=redefined-outer-name,unused-argument - @pytest.fixture(scope="session") def bench_config(request): diff --git a/dvc/testing/fixtures.py b/dvc/testing/fixtures.py index 8f03e1950..553a3ed3a 100644 --- a/dvc/testing/fixtures.py +++ b/dvc/testing/fixtures.py @@ -7,8 +7,6 @@ import pytest from .scripts import copy_script -# pylint: disable=redefined-outer-name,unused-argument - __all__ = [ "make_tmp_dir", "tmp_dir", @@ -40,7 +38,7 @@ CACHE: Dict[Tuple[bool, bool, bool], str] = {} @pytest.fixture(scope="session") def make_tmp_dir(tmp_path_factory, request, worker_id): - def make(name, *, scm=False, dvc=False, subdir=False): # pylint: disable=W0621 + def make(name, *, scm=False, dvc=False, subdir=False): from shutil import copytree, ignore_patterns from dvc.repo import Repo @@ -129,7 +127,7 @@ def local_cloud(make_cloud): @pytest.fixture def make_remote(tmp_dir, dvc, make_cloud): # noqa: ARG001 def _make_remote(name, typ="local", **kwargs): - cloud = make_cloud(typ) # pylint: disable=W0621 + cloud = make_cloud(typ) tmp_dir.add_remote(name=name, config=cloud.config, **kwargs) return cloud @@ -139,7 +137,7 @@ def make_remote(tmp_dir, dvc, make_cloud): # noqa: ARG001 @pytest.fixture def make_remote_version_aware(tmp_dir, dvc, make_cloud_version_aware): # noqa: ARG001 def _make_remote(name, typ="local", **kwargs): - cloud = make_cloud_version_aware(typ) # pylint: disable=W0621 + cloud = make_cloud_version_aware(typ) config = dict(cloud.config) config["version_aware"] = True tmp_dir.add_remote(name=name, config=config, **kwargs) @@ -151,7 +149,7 @@ def make_remote_version_aware(tmp_dir, dvc, make_cloud_version_aware): # noqa: @pytest.fixture def make_remote_worktree(tmp_dir, dvc, make_cloud_version_aware): # noqa: ARG001 def _make_remote(name, typ="local", **kwargs): - cloud = make_cloud_version_aware(typ) # pylint: disable=W0621 + cloud = make_cloud_version_aware(typ) config = dict(cloud.config) config["worktree"] = True tmp_dir.add_remote(name=name, config=config, **kwargs) @@ -188,7 +186,7 @@ def make_workspace(tmp_dir, dvc, make_cloud): def _make_workspace(name, typ="local"): from dvc.cachemgr import CacheManager - cloud = make_cloud(typ) # pylint: disable=W0621 + cloud = make_cloud(typ) tmp_dir.add_remote(name=name, config=cloud.config, default=False) tmp_dir.add_remote( diff --git a/dvc/testing/path_info.py b/dvc/testing/path_info.py index af7a6a257..959dbf25e 100644 --- a/dvc/testing/path_info.py +++ b/dvc/testing/path_info.py @@ -1,4 +1,3 @@ -# pylint: disable=protected-access import os import pathlib import posixpath @@ -32,9 +31,7 @@ class PathInfo(pathlib.PurePath, _BasePath): def __new__(cls, *args): # Construct a proper subclass depending on current os if cls is PathInfo: - cls = ( # pylint: disable=self-cls-assignment - WindowsPathInfo if os.name == "nt" else PosixPathInfo - ) + cls = WindowsPathInfo if os.name == "nt" else PosixPathInfo return cls._from_parts(args) # type: ignore[attr-defined] @@ -82,7 +79,7 @@ class PathInfo(pathlib.PurePath, _BasePath): and self._cparts[:n] == other._cparts # type: ignore[attr-defined] ) - def relative_to(self, other): # pylint: disable=arguments-differ + def relative_to(self, other): # pathlib relative_to raises exception when one path is not a direct # descendant of the other when os.path.relpath would return abspath. # For DVC PathInfo we only need the relpath behavior. @@ -209,7 +206,7 @@ class URLInfo(_BasePath): return self._spath @cached_property - def _path( # pylint: disable=method-hidden + def _path( self, ) -> "_URLPathInfo": return _URLPathInfo(self._spath) @@ -296,7 +293,7 @@ class HTTPURLInfo(URLInfo): params=None, query=None, fragment=None, - ): # pylint: disable=arguments-differ + ): assert bool(host) ^ bool(netloc) if netloc is not None: diff --git a/dvc/testing/remote_tests.py b/dvc/testing/remote_tests.py index e72d3ad9e..a33ccefef 100644 --- a/dvc/testing/remote_tests.py +++ b/dvc/testing/remote_tests.py @@ -7,8 +7,6 @@ from dvc.stage.cache import RunCacheNotSupported from dvc.utils.fs import remove from dvc_data.hashfile.tree import Tree -# pylint: disable=unused-argument - def _check_status(status, **kwargs): for key in ("ok", "missing", "new", "deleted"): @@ -17,7 +15,7 @@ def _check_status(status, **kwargs): class TestRemote: - def test(self, tmp_dir, dvc, remote): # pylint: disable=W0613 + def test(self, tmp_dir, dvc, remote): (stage,) = tmp_dir.dvc_gen("foo", "foo") out = stage.outs[0] cache = out.cache_path @@ -169,9 +167,7 @@ class TestRemote: class TestRemoteVersionAware: - def test_file( - self, tmp_dir, dvc, run_copy, remote_version_aware - ): # pylint: disable=W0613 + def test_file(self, tmp_dir, dvc, run_copy, remote_version_aware): (stage,) = tmp_dir.dvc_gen("foo", "foo") run_copy("foo", "foo_copy", name="copy") @@ -200,9 +196,7 @@ class TestRemoteVersionAware: assert (tmp_dir / "foo.dvc").read_text() == foo_dvc assert (tmp_dir / "dvc.lock").read_text() == dvc_lock - def test_dir( - self, tmp_dir, dvc, run_copy, remote_version_aware - ): # pylint: disable=W0613 + def test_dir(self, tmp_dir, dvc, run_copy, remote_version_aware): (stage,) = tmp_dir.dvc_gen( { "data_dir": { @@ -249,7 +243,7 @@ class TestRemoteVersionAware: class TestRemoteWorktree: - def test_file(self, tmp_dir, dvc, remote_worktree): # pylint: disable=W0613 + def test_file(self, tmp_dir, dvc, remote_worktree): (stage,) = tmp_dir.dvc_gen("foo", "foo") dvc.push() @@ -264,7 +258,7 @@ class TestRemoteWorktree: dvc.pull() assert (tmp_dir / "foo").read_text() == "foo" - def test_dir(self, tmp_dir, dvc, remote_worktree): # pylint: disable=W0613 + def test_dir(self, tmp_dir, dvc, remote_worktree): (stage,) = tmp_dir.dvc_gen( { "data_dir": { @@ -294,9 +288,7 @@ class TestRemoteWorktree: tmp_dir / "data_dir" / "data_sub_dir" / "data_sub" ).read_text() == "data_sub" - def test_deletion( - self, tmp_dir, dvc, scm, remote_worktree # pylint: disable=W0613 - ): + def test_deletion(self, tmp_dir, dvc, scm, remote_worktree): tmp_dir.dvc_gen( { "data_dir": { @@ -325,7 +317,7 @@ class TestRemoteWorktree: dvc.pull() assert (tmp_dir / "data_dir" / "data").read_text() == "data" - def test_update(self, tmp_dir, dvc, remote_worktree): # pylint: disable=W0613 + def test_update(self, tmp_dir, dvc, remote_worktree): (foo_stage,) = tmp_dir.dvc_gen("foo", "foo") (data_dir_stage,) = tmp_dir.dvc_gen( { diff --git a/dvc/testing/tmp_dir.py b/dvc/testing/tmp_dir.py index d0b00f078..c7d881af0 100644 --- a/dvc/testing/tmp_dir.py +++ b/dvc/testing/tmp_dir.py @@ -43,8 +43,6 @@ from global repo template to creating everything inplace, which: - does not create unnecessary files """ -# pylint: disable=redefined-outer-name, attribute-defined-outside-init - import os import pathlib import sys @@ -71,19 +69,16 @@ class TmpDir(pathlib.Path): def __new__(cls, *args, **kwargs): if cls is TmpDir: - cls = ( # pylint: disable=self-cls-assignment - WindowsTmpDir if os.name == "nt" else PosixTmpDir - ) + cls = WindowsTmpDir if os.name == "nt" else PosixTmpDir # init parameter and `_init` method has been removed in Python 3.10. kw = {"init": False} if sys.version_info < (3, 10) else {} - # pylint: disable-next=unexpected-keyword-arg self = cls._from_parts(args, **kw) # type: ignore[attr-defined] if not self._flavour.is_supported: raise NotImplementedError( f"cannot instantiate {cls.__name__!r} on your system" ) if sys.version_info < (3, 10): - self._init() # pylint: disable=no-member + self._init() return self def init(self, *, scm=False, dvc=False, subdir=False): @@ -222,7 +217,7 @@ class TmpDir(pathlib.Path): finally: self.scm.checkout(old) - def read_text(self, *args, **kwargs): # pylint: disable=signature-differs + def read_text(self, *args, **kwargs): # NOTE: on windows we'll get PermissionError instead of # IsADirectoryError when we try to `open` a directory, so we can't # rely on exception flow control diff --git a/dvc/ui/pager.py b/dvc/ui/pager.py index c4b92ec69..f23153df1 100644 --- a/dvc/ui/pager.py +++ b/dvc/ui/pager.py @@ -55,7 +55,6 @@ def find_pager(): if not Console.isatty(): return None - # pylint: disable=redefined-outer-name pager = os.getenv(DVC_PAGER) if not pager: pager = os.getenv(PAGER_ENV) diff --git a/dvc/ui/table.py b/dvc/ui/table.py index e7e27f9ad..55c64f423 100644 --- a/dvc/ui/table.py +++ b/dvc/ui/table.py @@ -54,7 +54,6 @@ def console_width(table: "Table", console: "RichConsole", val: int) -> Iterator[ # NOTE: rich does not have native support for unlimited width # via pager. we override rich table compression by setting # console width to the full width of the table - # pylint: disable=protected-access console_options = console.options original = console_options.max_width diff --git a/dvc/updater.py b/dvc/updater.py index a047ede6c..128e76f95 100644 --- a/dvc/updater.py +++ b/dvc/updater.py @@ -77,7 +77,7 @@ class Updater: try: info = json.load(fobj) latest = info["version"] - except Exception as e: # noqa: BLE001 # pylint: disable=W0703 + except Exception as e: # noqa: BLE001 logger.trace("", exc_info=True) # type: ignore[attr-defined] logger.debug("'%s' is not a valid json: %s", self.updater_file, e) self.fetch() diff --git a/dvc/utils/hydra.py b/dvc/utils/hydra.py index 91eecff0b..f9682a8d1 100644 --- a/dvc/utils/hydra.py +++ b/dvc/utils/hydra.py @@ -94,7 +94,7 @@ def apply_overrides(path: "StrPath", overrides: List[str]) -> None: flags={"allow_objects": True}, ) OmegaConf.set_struct(new_data, True) - # pylint: disable=protected-access + ConfigLoaderImpl._apply_overrides_to_config(parsed, new_data) new_data = OmegaConf.to_object(new_data) except hydra_errors as e: diff --git a/dvc/utils/table.py b/dvc/utils/table.py index f045b6679..3330eef64 100644 --- a/dvc/utils/table.py +++ b/dvc/utils/table.py @@ -7,9 +7,7 @@ if TYPE_CHECKING: class Table(RichTable): - def add_column( # pylint: disable=arguments-differ - self, *args: Any, collapse: bool = False, **kwargs: Any - ) -> None: + def add_column(self, *args: Any, collapse: bool = False, **kwargs: Any) -> None: super().add_column(*args, **kwargs) self.columns[-1].collapse = collapse # type: ignore[attr-defined] @@ -48,7 +46,6 @@ class Table(RichTable): return widths def _collapse_widths( # type: ignore[override] - # pylint: disable=arguments-differ self, widths: List[int], wrapable: List[bool], diff --git a/dvc/utils/threadpool.py b/dvc/utils/threadpool.py index 0c58e8eb7..73e0e0d79 100644 --- a/dvc/utils/threadpool.py +++ b/dvc/utils/threadpool.py @@ -43,8 +43,7 @@ class ThreadPoolExecutor(futures.ThreadPoolExecutor): tasks.update(create_taskset(len(done))) def shutdown(self, wait=True, *, cancel_futures=False): - if sys.version_info > (3, 9): # pylint: disable=no-else-return - # pylint: disable=unexpected-keyword-arg + if sys.version_info > (3, 9): return super().shutdown(wait=wait, cancel_futures=cancel_futures) else: # noqa: RET505 with self._shutdown_lock: diff --git a/dvc/version.py b/dvc/version.py index 98b65d2a0..c9275fd77 100644 --- a/dvc/version.py +++ b/dvc/version.py @@ -1,4 +1,3 @@ -# pylint: disable=unused-import try: from ._dvc_version import version as __version__ # type: ignore[import] from ._dvc_version import version_tuple # type: ignore[import]