Skip to content

Commit ab3971b

Browse files
authored
git - Merge pull request #94 from DinoTools/pre_commit_hook
Pre commit hook
2 parents 553f90b + ba8adea commit ab3971b

File tree

18 files changed

+378
-45
lines changed

18 files changed

+378
-45
lines changed

.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[run]
2-
source = overpy
2+
source = overpy

.flake8

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-FileCopyrightText: none
2+
# SPDX-License-Identifier: CC0-1.0
3+
4+
[flake8]
5+
max-line-length = 120
6+
extend-exclude =
7+
venv/
8+
docs/source/conf.py

.github/workflows/pre-commit.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-python@v2
14+
- uses: pre-commit/action@v2.0.0

.gitignore

Lines changed: 232 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,233 @@
1-
__pycache__
2-
*.pyc
3-
*.pyo
4-
*.swp
5-
/build/
6-
/dist/
7-
/docs/build/
8-
/.idea/
1+
### Python template
2+
# Byte-compiled / optimized / DLL files
3+
__pycache__/
4+
*.py[cod]
5+
*$py.class
6+
7+
# C extensions
8+
*.so
9+
10+
# Distribution / packaging
11+
.Python
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
share/python-wheels/
925
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
cover/
54+
55+
# Translations
56+
*.mo
57+
*.pot
58+
59+
# Django stuff:
60+
*.log
61+
local_settings.py
62+
db.sqlite3
63+
db.sqlite3-journal
64+
65+
# Flask stuff:
66+
instance/
67+
.webassets-cache
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
.pybuilder/
77+
target/
78+
79+
# Jupyter Notebook
80+
.ipynb_checkpoints
81+
82+
# IPython
83+
profile_default/
84+
ipython_config.py
85+
86+
# pyenv
87+
# For a library or package, you might want to ignore these files since the code is
88+
# intended to run in multiple environments; otherwise, check them in:
89+
# .python-version
90+
91+
# pipenv
92+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
94+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
95+
# install all needed dependencies.
96+
#Pipfile.lock
97+
98+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
99+
__pypackages__/
100+
101+
# Celery stuff
102+
celerybeat-schedule
103+
celerybeat.pid
104+
105+
# SageMath parsed files
106+
*.sage.py
107+
108+
# Environments
109+
.env
110+
.venv
111+
env/
112+
venv/
113+
ENV/
114+
env.bak/
115+
venv.bak/
116+
117+
# Spyder project settings
118+
.spyderproject
119+
.spyproject
120+
121+
# Rope project settings
122+
.ropeproject
123+
124+
# mkdocs documentation
125+
/site
126+
127+
# mypy
128+
.mypy_cache/
129+
.dmypy.json
130+
dmypy.json
131+
132+
# Pyre type checker
133+
.pyre/
134+
135+
# pytype static type analyzer
136+
.pytype/
137+
138+
# Cython debug symbols
139+
cython_debug/
140+
141+
### JetBrains template
142+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
143+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
144+
145+
# User-specific stuff
146+
.idea/**/workspace.xml
147+
.idea/**/tasks.xml
148+
.idea/**/usage.statistics.xml
149+
.idea/**/dictionaries
150+
.idea/**/shelf
151+
152+
# Generated files
153+
.idea/**/contentModel.xml
154+
155+
# Sensitive or high-churn files
156+
.idea/**/dataSources/
157+
.idea/**/dataSources.ids
158+
.idea/**/dataSources.local.xml
159+
.idea/**/sqlDataSources.xml
160+
.idea/**/dynamic.xml
161+
.idea/**/uiDesigner.xml
162+
.idea/**/dbnavigator.xml
163+
164+
# Gradle
165+
.idea/**/gradle.xml
166+
.idea/**/libraries
167+
168+
# Gradle and Maven with auto-import
169+
# When using Gradle or Maven with auto-import, you should exclude module files,
170+
# since they will be recreated, and may cause churn. Uncomment if using
171+
# auto-import.
172+
# .idea/artifacts
173+
# .idea/compiler.xml
174+
# .idea/jarRepositories.xml
175+
# .idea/modules.xml
176+
# .idea/*.iml
177+
# .idea/modules
178+
# *.iml
179+
# *.ipr
180+
181+
# CMake
182+
cmake-build-*/
183+
184+
# Mongo Explorer plugin
185+
.idea/**/mongoSettings.xml
186+
187+
# File-based project format
188+
*.iws
189+
190+
# IntelliJ
191+
out/
192+
193+
# mpeltonen/sbt-idea plugin
194+
.idea_modules/
195+
196+
# JIRA plugin
197+
atlassian-ide-plugin.xml
198+
199+
# Cursive Clojure plugin
200+
.idea/replstate.xml
201+
202+
# Crashlytics plugin (for Android Studio and IntelliJ)
203+
com_crashlytics_export_strings.xml
204+
crashlytics.properties
205+
crashlytics-build.properties
206+
fabric.properties
207+
208+
# Editor-based Rest Client
209+
.idea/httpRequests
210+
211+
# Android studio 3.1+ serialized cache file
212+
.idea/caches/build_file_checksums.ser
213+
214+
### Vim template
215+
# Swap
216+
[._]*.s[a-v][a-z]
217+
!*.svg # comment out if you don't need vector files
218+
[._]*.sw[a-p]
219+
[._]s[a-rt-v][a-z]
220+
[._]ss[a-gi-z]
221+
[._]sw[a-p]
222+
223+
# Session
224+
Session.vim
225+
Sessionx.vim
226+
227+
# Temporary
228+
.netrwhist
229+
*~
230+
# Auto-generated tag files
231+
tags
232+
# Persistent undo
233+
[._]*.un~

.pre-commit-config.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# SPDX-FileCopyrightText: none
2+
# SPDX-License-Identifier: CC0-1.0
3+
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v3.2.0
7+
hooks:
8+
# Forbid files which have a UTF-8 byte-order marker
9+
- id: check-byte-order-marker
10+
# Require literal syntax when initializing empty or zero Python builtin types
11+
- id: check-builtin-literals
12+
# Check for files that would conflict in case-insensitive filesystems
13+
- id: check-case-conflict
14+
# Ensures that (non-binary) executables have a shebang
15+
- id: check-executables-have-shebangs
16+
# Check for files that contain merge conflict strings
17+
- id: check-merge-conflict
18+
# Checks for symlinks which do not point to anything
19+
- id: check-symlinks
20+
# This hook checks yaml files for parseable syntax
21+
- id: check-yaml
22+
files: .drone.yml
23+
# Drone CI config allows and requires multiple documents
24+
args: [--allow-multiple-documents]
25+
- id: check-yaml
26+
exclude: .drone.yml
27+
# Detects the presence of private keys
28+
- id: detect-private-key
29+
# Ensures that a file is either empty, or ends with one newline
30+
- id: end-of-file-fixer
31+
exclude: ^tests/(json|response|xml)/
32+
# Replaces or checks mixed line ending
33+
- id: mixed-line-ending
34+
exclude: ^tests/(json|response|xml)/
35+
# This hook trims trailing whitespace
36+
- id: trailing-whitespace
37+
exclude: ^tests/(json|response|xml)/
38+
39+
- repo: https://github.com/pre-commit/pygrep-hooks
40+
rev: v1.6.0
41+
hooks:
42+
# Enforce that `noqa` annotations always occur with specific codes
43+
- id: python-check-blanket-noqa
44+
# Prevent common mistakes of `assert mck.not_called()`, `assert mck.called_once_with(...)` and `mck.assert_called`
45+
- id: python-check-mock-methods
46+
# A quick check for the `eval()` built-in function
47+
- id: python-no-eval
48+
# A quick check for the deprecated `.warn()` method of python loggers
49+
- id: python-no-log-warn
50+
# ToDo: Fix code
51+
# # Enforce that python3.6+ type annotations are used instead of type comments
52+
# - id: python-use-type-annotations
53+
# Detect common mistake of using single backticks when writing rst
54+
- id: rst-backticks
55+
# Detect mistake of inline code touching normal text in rst
56+
- id: rst-inline-touching-normal
57+
# Forbid files which have a UTF-8 Unicode replacement character
58+
- id: text-unicode-replacement-char
59+
60+
- repo: https://gitlab.com/pycqa/flake8
61+
rev: 3.8.2
62+
hooks:
63+
- id: flake8
64+
additional_dependencies:
65+
- flake8-bugbear
66+
- flake8-implicit-str-concat
67+
68+
- repo: https://github.com/pre-commit/mirrors-mypy
69+
rev: v0.782
70+
hooks:
71+
- id: mypy
72+
args: [--no-strict-optional, --ignore-missing-imports, --allow-untyped-global]
73+
exclude: ^(docs/)
74+
75+
# # Check for missing licensing and copyright information.
76+
# # The REUSE helper tool assists with achieving and confirming REUSE compliance.
77+
# # See: https://reuse.software/
78+
# - repo: https://github.com/fsfe/reuse-tool
79+
# rev: v0.11.1
80+
# hooks:
81+
# - id: reuse
82+
# exclude: ^tests/(json|response|xml)/

LICENSE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-

docs/source/changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.. include:: ../../CHANGELOG.rst
1+
.. include:: ../../CHANGELOG.rst

docs/source/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
.. include:: ../../CONTRIBUTING.rst
1+
.. include:: ../../CONTRIBUTING.rst

examples/get_ways.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
print(" Highway: %s" % way.tags.get("highway", "n/a"))
1616
print(" Nodes:")
1717
for node in way.nodes:
18-
print(f" Lat: {node.lat:f}, Lon: {node.lon:f}")
18+
print(f" Lat: {node.lat:f}, Lon: {node.lon:f}")

0 commit comments

Comments
 (0)