Fix warnings.

This commit is contained in:
Sergey Vartanov 2021-10-11 00:43:45 +03:00
parent 84f7e1cef5
commit 9f770a35cc
11 changed files with 47 additions and 36 deletions

View file

@ -21,7 +21,7 @@ This action is not that easy as it supposed to be. We use [Moire](http://github.
Modify the code
---------------
First of all, configure your workspace.
First configure your workspace.
* Install formatter, linter and test system: `pip install black flake8 pytest`.
* Be sure to run `git config --local core.hooksPath data/githooks` to enable Git hooks.

View file

@ -3,7 +3,7 @@
**Map Machine** project consists of
* Python [OpenStreetMap](http://openstreetmap.org) renderer and tile generator (see [usage](#usage-example), [renderer documentation](#map-generation), [tile generation](#tile-generation)),
* [Röntgen icon set](#icon-set): unique CC-BY 4.0 icons.
* [Röntgen icon set](#röntgen-icon-set): unique CC-BY 4.0 icons.
The idea behind the Map Machine project is to **show all the richness of the OpenStreetMap data**: to have a possibility to *display any map feature* represented by OpenStreetMap data tags by means of colors, shapes, and icons. Map Machine is created for OpenStreetMap contributors: to display all changes one made on the map even if they are small, and for users: to dig down into the map and find every detail that was mapped.
@ -132,7 +132,7 @@ pip install .
Map generation
--------------
Command `render` is used to generates SVG map from OpenStreetMap data. You can run it using:
Command `render` is used to generate SVG map from OpenStreetMap data. You can run it using:
```bash
map-machine render \

View file

@ -1,28 +1,36 @@
<component name="ProjectDictionaryState">
<dictionary name="%USERNAME%">
<words>
<w>addr</w>
<w>arecaceae</w>
<w>betula</w>
<w>carto</w>
<w>changeset</w>
<w>dasharray</w>
<w>defs</w>
<w>dharmachakra</w>
<w>flinger</w>
<w>githooks</w>
<w>housenumber</w>
<w>josm</w>
<w>landuse</w>
<w>levelname</w>
<w>linalg</w>
<w>linecap</w>
<w>linejoin</w>
<w>lunokhod</w>
<w>mapcss</w>
<w>maxlat</w>
<w>maxlon</w>
<w>maxspeed</w>
<w>minlat</w>
<w>minlon</w>
<w>needleleaved</w>
<w>noninfringement</w>
<w>osmic</w>
<w>portolan</w>
<w>rasterize</w>
<w>rasterized</w>
<w>röntgen</w>
<w>subparser</w>
<w>svgwrite</w>

View file

@ -30,7 +30,7 @@ def check_file(file_name: str) -> Optional[str]:
def check_commit_message(parts: List[str]) -> Optional[str]:
"""Check whether the commit message is well-formed."""
short_message: str = parts[0]
if short_message[0] != short_message[0].upper():
@ -77,7 +77,8 @@ def check_commit_message(parts: List[str]) -> Optional[str]:
+ '\nCommit message should end with ".".'
)
def up(text: str):
def first_letter_uppercase(text: str):
"""Change first letter to upper case."""
return text[0].upper() + text[1:]
verbs_1 = ["add", "fix", "check", "refactor"]
@ -101,16 +102,18 @@ def check_commit_message(parts: List[str]) -> Optional[str]:
for verb in verbs:
if short_message.startswith(f"{verb} ") or short_message.startswith(
f"{up(verb)} "
f"{first_letter_uppercase(verb)} "
):
return (
f'Commit message should start with the verb in infinitive '
f'form. Please, use "{up(verbs[verb])} ..." instead of '
f'"{up(verb)} ...".'
f'form. Please, use '
f'"{first_letter_uppercase(verbs[verb])} ..." instead of '
f'"{first_letter_uppercase(verb)} ...".'
)
def check(commit_message):
def check(commit_message: str) -> None:
"""Print commit_message and checking result."""
print("\033[33m" + commit_message + "\033[0m")
print(check_commit_message(commit_message.split("\n")))
@ -120,7 +123,7 @@ def test():
check("Added foo.")
check("Created foo.")
check("Doesn't end with dot")
check("Tooooooooooooooooooooooooooooooooooooooooooooo long")
check("To-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o long")
if __name__ == "__main__":

View file

@ -20,7 +20,7 @@ This action is not that easy as it supposed to be. We use \ref {http://github.c
\2 {Modify the code} {}
First of all, configure your workspace.
First configure your workspace.
\list
{Install formatter, linter and test system\: \m {pip install black flake8 pytest}.}

View file

@ -5,7 +5,7 @@
\list
{Python \ref {http://openstreetmap.org} {OpenStreetMap} renderer and tile generator (see \ref {#usage-example} {usage}, \ref {#map-generation} {renderer documentation}, \ref {#tile-generation} {tile generation}),}
{\ref {#icon-set} {Röntgen icon set}\: unique CC-BY 4.0 icons.}
{\ref {#röntgen-icon-set} {Röntgen icon set}\: unique CC-BY 4.0 icons.}
The idea behind the Map Machine project is to \b {show all the richness of the OpenStreetMap data}\: to have a possibility to \i {display any map feature} represented by OpenStreetMap data tags by means of colors, shapes, and icons. Map Machine is created for OpenStreetMap contributors\: to display all changes one made on the map even if they are small, and for users\: to dig down into the map and find every detail that was mapped.
@ -178,7 +178,7 @@ Requirements\: Python 3.9/* or higher*/.
\2 {Map generation} {map-generation}
Command \m {render} is used to generates SVG map from OpenStreetMap data. You can run it using\:
Command \m {render} is used to generate SVG map from OpenStreetMap data. You can run it using\:
\code {map-machine render \\
-b \formal {min longitude},\formal {min latitude},\formal {max longitude},\formal {max latitude} \\

View file

@ -193,7 +193,7 @@
"comb_and_scissors": {
"name": "comb and scissors"
},
"contrclockwise": {},
"counterclockwise": {},
"crater": {
"name": "crater"
},
@ -293,7 +293,7 @@
"emoji": "🧯"
},
"fire_hydrant": {},
"firepit": {
"fire_pit": {
"name": "fire pit"
},
"fireplace": {},
@ -362,7 +362,7 @@
"emoji": "H",
"name": "H letter"
},
"hifi": {
"hi_fi": {
"name": "Hi-Fi"
},
"historic": {},

View file

@ -2738,7 +2738,7 @@
inkscape:label="#path4425"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:Sans;-inkscape-font-specification:Sans;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;baseline-shift:baseline;text-anchor:start;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2;marker:none;enable-background:accumulate"
d="m 600.09375,147 c 0.5236,0.0245 0.97767,0.52328 0.95313,1.04687 -0.0246,0.5236 -0.52328,0.97767 -1.04688,0.95313 -1.6687,0 -3,1.3313 -3,3 0,1.6687 1.3313,3 3,3 1.6687,0 3,-1.3313 3,-3 -2,0 -2,0 -2,0 l 3,-3 3,3 c 0,0 0,0 -2,0 0,2.74958 -2.25042,5 -5,5 -2.74958,0 -5,-2.25042 -5,-5 0,-2.74958 2.25042,-5 5,-5 0.0312,-0.001 0.0625,-0.001 0.0937,0 z"
id="contrclockwise"
id="counterclockwise"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cscsscccccsscc" />
<rect
@ -18139,7 +18139,7 @@
<path
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="M 375.57812,84.640625 C 374.39317,85.091847 373.98682,86.298595 374,87.5 c 7e-5,0.535824 0.28596,1.030917 0.75,1.298828 0.4641,0.267949 1.0359,0.267949 1.5,0 0.46403,-0.267911 0.74992,-0.763004 0.75,-1.298828 0,-0.818561 -0.36781,-1.344673 -0.70703,-1.796875 0.004,0.464275 -0.17551,0.807863 -0.41602,1.009766 -0.63673,-0.526641 -0.71293,-1.200797 -0.29883,-2.072266 z m -4.09765,5.357422 a 0.50005,0.50005 0 0 0 -0.15625,0.970703 l 2.75,1.03125 -2.75,1.03125 a 0.50062478,0.50062478 0 1 0 0.35156,0.9375 l 3.82422,-1.433594 3.82422,1.433594 a 0.50062478,0.50062478 0 0 0 0.35156,-0.9375 l -2.75,-1.03125 2.75,-1.03125 a 0.50005,0.50005 0 0 0 -0.16992,-0.970703 0.50005,0.50005 0 0 0 -0.18164,0.0332 L 375.5,91.464844 371.67578,90.03125 a 0.50005,0.50005 0 0 0 -0.19531,-0.0332 z"
id="firepit"
id="fire_pit"
inkscape:label="#path13147"
inkscape:connector-curvature="0">
<title
@ -19428,7 +19428,7 @@
<path
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.10000002;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 325,50 c -0.554,0 -1,0.446 -1,1 l 0,10 c 0,0.554 0.446,1 1,1 l 6,0 c 0.554,0 1,-0.446 1,-1 l 0,-10 c 0,-0.554 -0.446,-1 -1,-1 l -6,0 z m 3,1.859375 A 1.1407001,1.1407001 0 0 1 329.14062,53 1.1407001,1.1407001 0 0 1 328,54.140625 1.1407001,1.1407001 0 0 1 326.85938,53 1.1407001,1.1407001 0 0 1 328,51.859375 Z m 0.041,3.3125 A 2.8284373,2.8284373 0 0 1 330,56 a 2.8284373,2.8284373 0 0 1 0,4 2.8284373,2.8284373 0 0 1 -4,0 2.8284373,2.8284373 0 0 1 0,-4 2.8284373,2.8284373 0 0 1 2.04102,-0.828125 z M 328,56.859375 A 1.1407001,1.1407001 0 0 0 326.85938,58 1.1407001,1.1407001 0 0 0 328,59.140625 1.1407001,1.1407001 0 0 0 329.14062,58 1.1407001,1.1407001 0 0 0 328,56.859375 Z"
id="hifi"
id="hi_fi"
inkscape:label="#rect7691"
inkscape:connector-curvature="0">
<title

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Before After
Before After

View file

@ -362,7 +362,7 @@ class Scheme:
:return: color specification
"""
if color in self.colors:
specification = self.colors[color]
specification: Union[str, dict] = self.colors[color]
if isinstance(specification, str):
return Color(self.colors[color])
else:

View file

@ -512,7 +512,7 @@ node_icons:
- tags: {shop: hardware}
shapes: [wretch_and_hammer]
- tags: {shop: hifi}
shapes: [{shape: hifi, color: sell_color}]
shapes: [{shape: hi_fi, color: sell_color}]
- tags: {shop: houseware}
shapes: [{shape: pan, color: sell_color}]
- tags: {shop: jewelry}
@ -1280,7 +1280,7 @@ node_icons:
- tags: {amenity: bbq}
shapes: [bbq]
- tags: {leisure: firepit}
shapes: [firepit]
shapes: [fire_pit]
- tags: {man_made: cross}
shapes: [cross]
- tags: {man_made: flagpole}
@ -1452,8 +1452,8 @@ node_icons:
add_shapes: [lock]
- tags: {direction: clockwise}
add_shapes: [clockwise]
- tags: {direction: contrclockwise}
add_shapes: [contrclockwise]
- tags: {direction: anticlockwise}
add_shapes: [counterclockwise]
- tags: {atm: "yes"}
add_shapes: [atm]
- tags: {tactile_paving: "yes"}

View file

@ -13,14 +13,14 @@ ROOT: float = np.sqrt(2)
def test_compute_angle() -> None:
"""Test angle computing for all angles between 0 and 2π with step π / 4."""
assert np.allclose(compute_angle((1, 0)), 0)
assert np.allclose(compute_angle((ROOT, ROOT)), np.pi * 0.25)
assert np.allclose(compute_angle((0, 1)), np.pi * 0.5)
assert np.allclose(compute_angle((-ROOT, ROOT)), np.pi * 0.75)
assert np.allclose(compute_angle((-1, 0)), np.pi)
assert np.allclose(compute_angle((-ROOT, -ROOT)), np.pi * 1.25)
assert np.allclose(compute_angle((0, -1)), np.pi * 1.5)
assert np.allclose(compute_angle((ROOT, -ROOT)), np.pi * 1.75)
assert np.allclose(compute_angle(np.array((1, 0))), 0)
assert np.allclose(compute_angle(np.array((ROOT, ROOT))), np.pi * 0.25)
assert np.allclose(compute_angle(np.array((0, 1))), np.pi * 0.5)
assert np.allclose(compute_angle(np.array((-ROOT, ROOT))), np.pi * 0.75)
assert np.allclose(compute_angle(np.array((-1, 0))), np.pi)
assert np.allclose(compute_angle(np.array((-ROOT, -ROOT))), np.pi * 1.25)
assert np.allclose(compute_angle(np.array((0, -1))), np.pi * 1.5)
assert np.allclose(compute_angle(np.array((ROOT, -ROOT))), np.pi * 1.75)
def test_turn_by_compute_angle() -> None: