mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
fix remaining typing errors (#5079)
This commit is contained in:
@@ -5,7 +5,7 @@ from collections import OrderedDict
|
||||
from collections.abc import Mapping
|
||||
from datetime import date, datetime
|
||||
from itertools import groupby
|
||||
from typing import Iterable, Optional
|
||||
from typing import Dict, Iterable, Optional
|
||||
|
||||
import dvc.prompt as prompt
|
||||
from dvc.command.base import CmdBase, append_doc_link, fix_subparsers
|
||||
@@ -56,7 +56,7 @@ def _filter_names(
|
||||
ret = OrderedDict({name: None for name in names})
|
||||
|
||||
if exclude:
|
||||
to_remove = {}
|
||||
to_remove: Dict[str, Optional[str]] = {}
|
||||
_filter(exclude, to_remove.update)
|
||||
for key in to_remove:
|
||||
if key in ret:
|
||||
|
||||
@@ -103,7 +103,7 @@ class DataResolver:
|
||||
except (ContextError, VarsAlreadyLoaded) as exc:
|
||||
format_and_raise(exc, "'vars'", self.relpath)
|
||||
|
||||
self.tracked_vars = {}
|
||||
self.tracked_vars: Dict[str, Mapping] = {}
|
||||
|
||||
@staticmethod
|
||||
def check_loaded(path, item, keys, skip_imports):
|
||||
@@ -222,7 +222,7 @@ class DataResolver:
|
||||
return {name: resolved}
|
||||
|
||||
def _get_vars(self, context: Context):
|
||||
tracked = defaultdict(dict)
|
||||
tracked: Dict[str, dict] = defaultdict(dict)
|
||||
for path, vars_ in context.tracked.items():
|
||||
for var in vars_:
|
||||
tracked[path][var] = context.select(var, unwrap=True)
|
||||
|
||||
@@ -5,7 +5,7 @@ from collections.abc import Mapping, MutableMapping, MutableSequence, Sequence
|
||||
from contextlib import contextmanager
|
||||
from copy import deepcopy
|
||||
from dataclasses import dataclass, field, replace
|
||||
from typing import Any, List, Optional, Union
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from funcy import identity, rpartial
|
||||
|
||||
@@ -283,7 +283,7 @@ class Context(CtxDict):
|
||||
params_file.update(keys)
|
||||
|
||||
@property
|
||||
def tracked(self):
|
||||
def tracked(self) -> Dict[str, set]:
|
||||
return self._tracked_data
|
||||
|
||||
def select(
|
||||
|
||||
@@ -454,7 +454,9 @@ def parse_target(
|
||||
return ret if is_valid_filename(target) else ret[::-1]
|
||||
|
||||
if not path:
|
||||
logger.trace("Assuming file to be '%s'", default)
|
||||
logger.trace( # type: ignore[attr-defined]
|
||||
"Assuming file to be '%s'", default
|
||||
)
|
||||
|
||||
return path or default, name
|
||||
|
||||
|
||||
Reference in New Issue
Block a user