Optimize imports.

This commit is contained in:
Sergey Vartanov 2021-11-08 03:27:36 +03:00
parent 5746edaa3f
commit 221b0bace6
11 changed files with 34 additions and 34 deletions

View file

@ -12,3 +12,7 @@ disable=
too-many-return-statements
good-names=i,j,x,y,a,b,c,n
[SIMILARITIES]
ignore-imports=yes

View file

@ -10,6 +10,7 @@ import numpy as np
from colour import Color
from map_machine.color import get_gradient_color
from map_machine.feature.road import Road, Roads
from map_machine.figure import (
Building,
Crater,
@ -18,14 +19,6 @@ from map_machine.figure import (
Tree,
)
from map_machine.geometry.flinger import Flinger
from map_machine.pictogram.icon import (
DEFAULT_SMALL_SHAPE_ID,
Icon,
IconSet,
Shape,
ShapeExtractor,
ShapeSpecification,
)
from map_machine.map_configuration import DrawingMode, MapConfiguration
from map_machine.osm.osm_reader import (
OSMData,
@ -34,8 +27,15 @@ from map_machine.osm.osm_reader import (
OSMWay,
parse_levels,
)
from map_machine.pictogram.icon import (
DEFAULT_SMALL_SHAPE_ID,
Icon,
IconSet,
Shape,
ShapeExtractor,
ShapeSpecification,
)
from map_machine.pictogram.point import Point
from map_machine.feature.road import Road, Roads
from map_machine.scheme import DEFAULT_COLOR, LineStyle, RoadMatcher, Scheme
from map_machine.text import Label
from map_machine.ui.cli import BuildingMode

View file

@ -9,8 +9,8 @@ from typing import Any, Union
from moire.default import Default, DefaultHTML, DefaultMarkdown, DefaultWiki
from moire.moire import Tag
from map_machine.ui import cli
from map_machine.pictogram.icon import ShapeExtractor
from map_machine.ui import cli
from map_machine.ui.cli import COMMAND_LINES
from map_machine.workspace import workspace

View file

@ -15,8 +15,6 @@ from svgwrite.shapes import Circle
from map_machine.drawing import PathCommands
from map_machine.geometry.flinger import Flinger
from map_machine.osm.osm_reader import OSMNode, Tagged
from map_machine.scheme import RoadMatcher
from map_machine.geometry.vector import (
Line,
Polyline,
@ -24,6 +22,8 @@ from map_machine.geometry.vector import (
norm,
turn_by_angle,
)
from map_machine.osm.osm_reader import OSMNode, Tagged
from map_machine.scheme import RoadMatcher
__author__ = "Sergey Vartanov"
__email__ = "me@enzet.ru"

View file

@ -10,8 +10,8 @@ from svgwrite.container import Group
from svgwrite.gradients import RadialGradient
from svgwrite.path import Path
from map_machine.feature.direction import DirectionSet, Sector
from map_machine.drawing import PathCommands
from map_machine.feature.direction import DirectionSet, Sector
from map_machine.geometry.flinger import Flinger
from map_machine.osm.osm_reader import OSMNode, Tagged
from map_machine.scheme import LineStyle, Scheme

View file

@ -9,9 +9,9 @@ from typing import Optional, TextIO
from colour import Color
from map_machine import __project__, __url__
from map_machine.pictogram.icon_collection import IconCollection
from map_machine.pictogram.icon import ShapeExtractor
from map_machine.osm.osm_reader import STAGES_OF_DECAY
from map_machine.pictogram.icon import ShapeExtractor
from map_machine.pictogram.icon_collection import IconCollection
from map_machine.scheme import Matcher, Scheme
from map_machine.workspace import workspace

View file

@ -14,16 +14,16 @@ from svgwrite.container import Group
from svgwrite.path import Path as SVGPath
from svgwrite.shapes import Rect
from map_machine.geometry.boundary_box import BoundaryBox
from map_machine.constructor import Constructor
from map_machine.feature.road import Intersection, Road, RoadPart
from map_machine.figure import StyledFigure
from map_machine.geometry.boundary_box import BoundaryBox
from map_machine.geometry.flinger import Flinger
from map_machine.pictogram.icon import ShapeExtractor
from map_machine.map_configuration import LabelMode, MapConfiguration
from map_machine.osm.osm_getter import NetworkError, get_osm
from map_machine.osm.osm_reader import OSMData, OSMNode
from map_machine.pictogram.icon import ShapeExtractor
from map_machine.pictogram.point import Occupied, Point
from map_machine.feature.road import Intersection, Road, RoadPart
from map_machine.scheme import Scheme
from map_machine.ui.cli import BuildingMode
from map_machine.workspace import workspace

View file

@ -7,9 +7,9 @@ import numpy as np
import svgwrite
from colour import Color
from map_machine.pictogram.icon import Icon, IconSet
from map_machine.map_configuration import LabelMode
from map_machine.osm.osm_reader import Tagged
from map_machine.pictogram.icon import Icon, IconSet
from map_machine.text import Label
__author__ = "Sergey Vartanov"

View file

@ -13,6 +13,7 @@ import yaml
from colour import Color
from map_machine.feature.direction import DirectionSet
from map_machine.map_configuration import MapConfiguration, LabelMode
from map_machine.pictogram.icon import (
DEFAULT_COLOR,
DEFAULT_SHAPE_ID,
@ -22,7 +23,6 @@ from map_machine.pictogram.icon import (
ShapeExtractor,
ShapeSpecification,
)
from map_machine.map_configuration import MapConfiguration, LabelMode
from map_machine.text import Label, construct_text
__author__ = "Sergey Vartanov"

View file

@ -15,14 +15,14 @@ import numpy as np
import svgwrite
from PIL import Image
from map_machine.geometry.boundary_box import BoundaryBox
from map_machine.constructor import Constructor
from map_machine.geometry.boundary_box import BoundaryBox
from map_machine.geometry.flinger import Flinger
from map_machine.pictogram.icon import ShapeExtractor
from map_machine.map_configuration import MapConfiguration
from map_machine.mapper import Map
from map_machine.osm.osm_getter import NetworkError, get_osm
from map_machine.osm.osm_reader import OSMData
from map_machine.pictogram.icon import ShapeExtractor
from map_machine.scheme import Scheme
from map_machine.workspace import workspace

View file

@ -3,36 +3,32 @@ Test icon generation for nodes.
"""
from typing import Optional
import pytest
from colour import Color
from map_machine.pictogram.icon_collection import IconCollection
from map_machine.pictogram.icon import IconSet, ShapeSpecification, Icon
from map_machine.pictogram.icon_collection import IconCollection
from tests import SCHEME, SHAPE_EXTRACTOR, workspace
__author__ = "Sergey Vartanov"
__email__ = "me@enzet.ru"
@pytest.fixture
def init_collection() -> IconCollection:
"""Create collection of all possible icon sets."""
return IconCollection.from_scheme(SCHEME, SHAPE_EXTRACTOR)
COLLECTION: IconCollection = IconCollection.from_scheme(SCHEME, SHAPE_EXTRACTOR)
def test_grid(init_collection: IconCollection) -> None:
def test_grid() -> None:
"""Test grid drawing."""
init_collection.draw_grid(workspace.output_path / "grid.svg")
COLLECTION.draw_grid(workspace.output_path / "grid.svg")
def test_icons_by_id(init_collection: IconCollection) -> None:
def test_icons_by_id() -> None:
"""Test individual icons drawing."""
init_collection.draw_icons(workspace.get_icons_by_id_path())
COLLECTION.draw_icons(workspace.get_icons_by_id_path())
def test_icons_by_name(init_collection: IconCollection) -> None:
def test_icons_by_name() -> None:
"""Test drawing individual icons that have names."""
init_collection.draw_icons(workspace.get_icons_by_name_path(), by_name=True)
COLLECTION.draw_icons(workspace.get_icons_by_name_path(), by_name=True)
def get_icon(tags: dict[str, str]) -> IconSet: