mirror of
https://github.com/enzet/map-machine.git
synced 2025-07-28 05:48:57 +02:00
Fix Pylint warnings.
This commit is contained in:
parent
890d554a84
commit
d812058ecb
4 changed files with 17 additions and 16 deletions
|
@ -51,11 +51,11 @@ class ArgumentParser(argparse.ArgumentParser):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs) -> None:
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
self.arguments: list[dict[str, Any]] = []
|
self.arguments: list[dict[str, Any]] = []
|
||||||
super(ArgumentParser, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def add_argument(self, *args, **kwargs) -> None:
|
def add_argument(self, *args, **kwargs) -> None:
|
||||||
"""Just store argument with options."""
|
"""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]}
|
argument: dict[str, Any] = {"arguments": [x for x in args]}
|
||||||
|
|
||||||
for key in kwargs:
|
for key in kwargs:
|
||||||
|
|
|
@ -166,7 +166,8 @@ class Matcher:
|
||||||
)
|
)
|
||||||
if is_matched == MatchingType.NOT_MATCHED:
|
if is_matched == MatchingType.NOT_MATCHED:
|
||||||
return False, {}
|
return False, {}
|
||||||
elif matched_groups:
|
|
||||||
|
if matched_groups:
|
||||||
for index, element in enumerate(matched_groups):
|
for index, element in enumerate(matched_groups):
|
||||||
groups[f"#{config_tag_key}{index}"] = element
|
groups[f"#{config_tag_key}{index}"] = element
|
||||||
|
|
||||||
|
|
|
@ -496,8 +496,8 @@ def ui(options: argparse.Namespace) -> None:
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
osm_data: OSMData = min_tile.load_osm_data(Path(options.cache))
|
osm_data: OSMData = min_tile.load_osm_data(Path(options.cache))
|
||||||
except NetworkError as e:
|
except NetworkError as error:
|
||||||
raise NetworkError(f"Map is not loaded. {e.message}")
|
raise NetworkError(f"Map is not loaded. {error.message}")
|
||||||
|
|
||||||
for zoom_level in zoom_levels:
|
for zoom_level in zoom_levels:
|
||||||
tile: Tile = Tile.from_coordinates(
|
tile: Tile = Tile.from_coordinates(
|
||||||
|
@ -508,8 +508,8 @@ def ui(options: argparse.Namespace) -> None:
|
||||||
options, zoom_level
|
options, zoom_level
|
||||||
)
|
)
|
||||||
tile.draw_with_osm_data(osm_data, directory, configuration)
|
tile.draw_with_osm_data(osm_data, directory, configuration)
|
||||||
except NetworkError as e:
|
except NetworkError as error:
|
||||||
logging.fatal(e.message)
|
logging.fatal(error.message)
|
||||||
elif options.tile:
|
elif options.tile:
|
||||||
zoom_level, x, y = map(int, options.tile.split("/"))
|
zoom_level, x, y = map(int, options.tile.split("/"))
|
||||||
tile: Tile = Tile(x, y, zoom_level)
|
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)
|
min_tiles: Tiles = Tiles.from_boundary_box(boundary_box, min_zoom_level)
|
||||||
try:
|
try:
|
||||||
osm_data: OSMData = min_tiles.load_osm_data(Path(options.cache))
|
osm_data: OSMData = min_tiles.load_osm_data(Path(options.cache))
|
||||||
except NetworkError as e:
|
except NetworkError as error:
|
||||||
raise NetworkError(f"Map is not loaded. {e.message}")
|
raise NetworkError(f"Map is not loaded. {error.message}")
|
||||||
|
|
||||||
for zoom_level in zoom_levels:
|
for zoom_level in zoom_levels:
|
||||||
if EXTEND_TO_BIGGER_TILE:
|
if EXTEND_TO_BIGGER_TILE:
|
||||||
|
|
|
@ -18,15 +18,13 @@ class ArgumentParser(argparse.ArgumentParser):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs) -> None:
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
self.arguments: list[dict[str, Any]] = []
|
self.arguments: list[dict[str, Any]] = []
|
||||||
super(ArgumentParser, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def add_argument(self, *args, **kwargs) -> None:
|
def add_argument(self, *args, **kwargs) -> None:
|
||||||
"""Just store argument with options."""
|
"""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]}
|
argument: dict[str, Any] = {"arguments": args}
|
||||||
|
argument |= kwargs
|
||||||
for key in kwargs:
|
|
||||||
argument[key] = kwargs[key]
|
|
||||||
|
|
||||||
self.arguments.append(argument)
|
self.arguments.append(argument)
|
||||||
|
|
||||||
|
@ -85,6 +83,8 @@ def completion_commands() -> str:
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
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:
|
with completions_path.open("w+") as output_file:
|
||||||
output_file.write(completion_commands())
|
output_file.write(completion_commands())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue