Fix Pylint warnings.

This commit is contained in:
Sergey Vartanov 2021-11-07 05:18:48 +03:00
parent 890d554a84
commit d812058ecb
4 changed files with 17 additions and 16 deletions

View file

@ -51,11 +51,11 @@ class ArgumentParser(argparse.ArgumentParser):
def __init__(self, *args, **kwargs) -> None:
self.arguments: list[dict[str, Any]] = []
super(ArgumentParser, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
def add_argument(self, *args, **kwargs) -> None:
"""Just store argument with options."""
super(ArgumentParser, self).add_argument(*args, **kwargs)
super().add_argument(*args, **kwargs)
argument: dict[str, Any] = {"arguments": [x for x in args]}
for key in kwargs:

View file

@ -166,7 +166,8 @@ class Matcher:
)
if is_matched == MatchingType.NOT_MATCHED:
return False, {}
elif matched_groups:
if matched_groups:
for index, element in enumerate(matched_groups):
groups[f"#{config_tag_key}{index}"] = element

View file

@ -496,8 +496,8 @@ def ui(options: argparse.Namespace) -> None:
)
try:
osm_data: OSMData = min_tile.load_osm_data(Path(options.cache))
except NetworkError as e:
raise NetworkError(f"Map is not loaded. {e.message}")
except NetworkError as error:
raise NetworkError(f"Map is not loaded. {error.message}")
for zoom_level in zoom_levels:
tile: Tile = Tile.from_coordinates(
@ -508,8 +508,8 @@ def ui(options: argparse.Namespace) -> None:
options, zoom_level
)
tile.draw_with_osm_data(osm_data, directory, configuration)
except NetworkError as e:
logging.fatal(e.message)
except NetworkError as error:
logging.fatal(error.message)
elif options.tile:
zoom_level, x, y = map(int, options.tile.split("/"))
tile: Tile = Tile(x, y, zoom_level)
@ -526,8 +526,8 @@ def ui(options: argparse.Namespace) -> None:
min_tiles: Tiles = Tiles.from_boundary_box(boundary_box, min_zoom_level)
try:
osm_data: OSMData = min_tiles.load_osm_data(Path(options.cache))
except NetworkError as e:
raise NetworkError(f"Map is not loaded. {e.message}")
except NetworkError as error:
raise NetworkError(f"Map is not loaded. {error.message}")
for zoom_level in zoom_levels:
if EXTEND_TO_BIGGER_TILE:

View file

@ -18,15 +18,13 @@ class ArgumentParser(argparse.ArgumentParser):
def __init__(self, *args, **kwargs) -> None:
self.arguments: list[dict[str, Any]] = []
super(ArgumentParser, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
def add_argument(self, *args, **kwargs) -> None:
"""Just store argument with options."""
super(ArgumentParser, self).add_argument(*args, **kwargs)
argument: dict[str, Any] = {"arguments": [x for x in args]}
for key in kwargs:
argument[key] = kwargs[key]
super().add_argument(*args, **kwargs)
argument: dict[str, Any] = {"arguments": args}
argument |= kwargs
self.arguments.append(argument)
@ -85,6 +83,8 @@ def completion_commands() -> str:
if __name__ == "__main__":
completions_path: Path = Path("~/.config/fish/completions/map-machine.fish")
completions_path: Path = (
Path.home() / ".config/fish/completions/map-machine.fish"
)
with completions_path.open("w+") as output_file:
output_file.write(completion_commands())