|
3 | 3 | import os |
4 | 4 | import pkgutil |
5 | 5 | from pathlib import Path |
6 | | -from typing import Any, Dict, List, Optional, Tuple, Union |
| 6 | +from typing import Any, Optional, Union |
7 | 7 |
|
8 | 8 | import yaml |
9 | 9 |
|
|
14 | 14 |
|
15 | 15 |
|
16 | 16 | class ProspectorProfile: |
17 | | - def __init__(self, name: str, profile_dict: Dict[str, Any], inherit_order: List[str]): |
| 17 | + def __init__(self, name: str, profile_dict: dict[str, Any], inherit_order: list[str]): |
18 | 18 | self.name = name |
19 | 19 | self.inherit_order = inherit_order |
20 | 20 |
|
@@ -43,7 +43,7 @@ def __init__(self, name: str, profile_dict: Dict[str, Any], inherit_order: List[ |
43 | 43 | tool_conf = profile_dict.get(tool, {}) |
44 | 44 |
|
45 | 45 | # set the defaults for everything |
46 | | - conf: Dict[str, Any] = {"disable": [], "enable": [], "run": None, "options": {}} |
| 46 | + conf: dict[str, Any] = {"disable": [], "enable": [], "run": None, "options": {}} |
47 | 47 | # use the "old" tool name |
48 | 48 | conf.update(tool_conf) |
49 | 49 |
|
@@ -96,9 +96,9 @@ def as_yaml(self): |
96 | 96 | @staticmethod |
97 | 97 | def load( |
98 | 98 | name_or_path: Union[str, Path], |
99 | | - profile_path: List[Path], |
| 99 | + profile_path: list[Path], |
100 | 100 | allow_shorthand: bool = True, |
101 | | - forced_inherits: Optional[List[str]] = None, |
| 101 | + forced_inherits: Optional[list[str]] = None, |
102 | 102 | ): |
103 | 103 | # First simply load all of the profiles and those that it explicitly inherits from |
104 | 104 | data, inherits = _load_and_merge( |
@@ -333,10 +333,10 @@ def _append_profiles(name, profile_path, data, inherit_list, allow_shorthand=Fal |
333 | 333 |
|
334 | 334 | def _load_and_merge( |
335 | 335 | name_or_path: Union[str, Path], |
336 | | - profile_path: List[Path], |
| 336 | + profile_path: list[Path], |
337 | 337 | allow_shorthand: bool = True, |
338 | | - forced_inherits: List[str] = None, |
339 | | -) -> Tuple[Dict[str, Any], List[str]]: |
| 338 | + forced_inherits: Optional[list[str]] = None, |
| 339 | +) -> tuple[dict[str, Any], list[str]]: |
340 | 340 | # First simply load all of the profiles and those that it explicitly inherits from |
341 | 341 | data, inherit_list, shorthands_found = _load_profile( |
342 | 342 | str(name_or_path), |
@@ -419,12 +419,12 @@ def _transform_legacy(profile_dict): |
419 | 419 |
|
420 | 420 |
|
421 | 421 | def _load_profile( |
422 | | - name_or_path, |
423 | | - profile_path, |
424 | | - shorthands_found=None, |
425 | | - already_loaded=None, |
426 | | - allow_shorthand=True, |
427 | | - forced_inherits=None, |
| 422 | + name_or_path: Union[str, Path], |
| 423 | + profile_path: list[Path], |
| 424 | + shorthands_found: Optional[set[str]] = None, |
| 425 | + already_loaded: Optional[list[Union[str, Path]]] = None, |
| 426 | + allow_shorthand: bool = True, |
| 427 | + forced_inherits: Optional[list[str]] = None, |
428 | 428 | ): |
429 | 429 | # recursively get the contents of the basic profile and those it inherits from |
430 | 430 | base_contents = _load_content(name_or_path, profile_path) |
|
0 commit comments