diff options
| author | Dennis Fink | 2019-08-28 13:16:29 +0200 |
|---|---|---|
| committer | Dennis Fink | 2019-08-28 13:16:29 +0200 |
| commit | 7ac2c9f056927312645509d236585d4958805621 (patch) | |
| tree | d95b65f175050074b7d346accd55ce34bb7b4a79 | |
| parent | ffbd03cdd6771bbfbeff412cb0df2d355d9f7599 (diff) | |
| download | patternutils-7ac2c9f056927312645509d236585d4958805621.tar.gz patternutils-7ac2c9f056927312645509d236585d4958805621.zip | |
Added correct type annotations
Diffstat (limited to '')
| -rw-r--r-- | patternutils/commands/pmatch.py | 4 | ||||
| -rw-r--r-- | patternutils/config.py | 4 | ||||
| -rw-r--r-- | patternutils/match.py | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/patternutils/commands/pmatch.py b/patternutils/commands/pmatch.py index 35285db..5f473e8 100644 --- a/patternutils/commands/pmatch.py +++ b/patternutils/commands/pmatch.py @@ -26,9 +26,9 @@ def walk(dir: str, recursive: bool = False, match_directories: bool = False) -> def apply_regex( walk_function: Iterator[Any], - regex_pattern: Pattern, + regex_pattern: Pattern[str], match_full_path: bool, -) -> Tuple[List[Dict], bool]: +) -> Tuple[List[Dict[str, str]], bool]: matches = [] has_invalid_matches = False diff --git a/patternutils/config.py b/patternutils/config.py index 1613fb9..4b95cf4 100644 --- a/patternutils/config.py +++ b/patternutils/config.py @@ -3,7 +3,7 @@ import glob import click -from typing import Tuple, List +from typing import Tuple, List, Optional CONFIG_PATH = click.get_app_dir('patternutils') @@ -31,7 +31,7 @@ def load_template(template_name: str, command_name: str) -> Tuple[str, str]: return output_pattern, template_engine -def find_templates(template_name: str, command_name: str = None) -> List[str]: +def find_templates(template_name: str, command_name: Optional[str] = None) -> List[str]: template_glob = '{}.*'.format(template_name) command_glob = '*' if command_name is None else command_name command_glob = os.path.join(CONFIG_PATH, command_glob) diff --git a/patternutils/match.py b/patternutils/match.py index e4bf470..01411c2 100644 --- a/patternutils/match.py +++ b/patternutils/match.py @@ -1,7 +1,7 @@ from typing import Pattern, Dict -def apply(subject: str, regex_pattern: Pattern) -> Dict[str, str]: +def apply(subject: str, regex_pattern: Pattern[str]) -> Dict[str, str]: match = regex_pattern.search(subject) if match is not None: groupdict = match.groupdict() |
