diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e12ad12..7715c90 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -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. @@ -29,7 +29,7 @@ First of all, configure your workspace. If you are using Pycharm, you may want to set up user dictionary as well: * `cp data/dictionary.xml .idea/dictionaries/.xml` - * in `.idea/dictionaries/.xml` change `%USERNAME%` to your user name, + * in `.idea/dictionaries/.xml` change `%USERNAME%` to your username, * restart Pycharm. ### Code style ### diff --git a/README.md b/README.md index a2a764f..edf042a 100644 --- a/README.md +++ b/README.md @@ -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 \ diff --git a/data/dictionary.xml b/data/dictionary.xml index c871f63..2978abf 100644 --- a/data/dictionary.xml +++ b/data/dictionary.xml @@ -1,28 +1,36 @@ + addr arecaceae betula carto changeset dasharray + defs + dharmachakra flinger githooks + housenumber josm landuse levelname linalg linecap linejoin + lunokhod mapcss maxlat maxlon + maxspeed minlat minlon needleleaved + noninfringement osmic portolan rasterize + rasterized röntgen subparser svgwrite diff --git a/data/githooks/commit-msg b/data/githooks/commit-msg index 76600b9..8065e28 100755 --- a/data/githooks/commit-msg +++ b/data/githooks/commit-msg @@ -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__": diff --git a/doc/contributing.moi b/doc/contributing.moi index 7a9f4a7..a125f1f 100644 --- a/doc/contributing.moi +++ b/doc/contributing.moi @@ -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}.} @@ -30,7 +30,7 @@ If you are using Pycharm, you may want to set up user dictionary as well: \list {\m {cp data/dictionary.xml .idea/dictionaries/.xml}} - {in \m {.idea/dictionaries/.xml} change \m {%USERNAME%} to your user name,} + {in \m {.idea/dictionaries/.xml} change \m {%USERNAME%} to your username,} {restart Pycharm.} \3 {Code style} {code-style} diff --git a/doc/readme.moi b/doc/readme.moi index 9b26740..938d331 100644 --- a/doc/readme.moi +++ b/doc/readme.moi @@ -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} \\ diff --git a/map_machine/icons/config.json b/map_machine/icons/config.json index c4d6fc7..3d7da7d 100644 --- a/map_machine/icons/config.json +++ b/map_machine/icons/config.json @@ -193,7 +193,7 @@ "comb_and_scissors": { "name": "comb and scissors" }, - "contrclockwise": {}, + "counterclockwise": {}, "crater": { "name": "crater" }, @@ -293,8 +293,8 @@ "emoji": "🧯" }, "fire_hydrant": {}, - "firepit": { - "name": "firepit" + "fire_pit": { + "name": "fire pit" }, "fireplace": {}, "fishing_angle": { @@ -362,7 +362,7 @@ "emoji": "H", "name": "H letter" }, - "hifi": { + "hi_fi": { "name": "Hi-Fi" }, "historic": {}, diff --git a/map_machine/icons/icons.svg b/map_machine/icons/icons.svg index 1c10bea..4fe1f07 100644 --- a/map_machine/icons/icons.svg +++ b/map_machine/icons/icons.svg @@ -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" /> firepit + id="title13158">fire pit 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: