Add type annotations
Codecov Report
Merging #154 (177935e) into develop (79d635c) will increase coverage by
0.46%. The diff coverage is98.68%.
Additional details and impacted files
@@ Coverage Diff @@
## develop #154 +/- ##
===========================================
+ Coverage 97.41% 97.87% +0.46%
===========================================
Files 9 19 +10
Lines 3090 3481 +391
===========================================
+ Hits 3010 3407 +397
+ Misses 80 74 -6
Hello @cleder! Thanks for updating this PR. We checked the lines you've touched for PEPΒ 8 issues, and found:
- In the file
fastkml/tests/atom_test.py:
Line 29:9: E741 ambiguous variable name 'l' Line 36:9: E741 ambiguous variable name 'l' Line 56:9: E741 ambiguous variable name 'l' Line 70:9: E741 ambiguous variable name 'l' Line 136:9: E741 ambiguous variable name 'l'
- In the file
fastkml/tests/base_test.py:
Line 38:13: W503 line break before binary operator Line 38:90: E501 line too long (105 > 89 characters) Line 46:90: E501 line too long (113 > 89 characters) Line 77:90: E501 line too long (94 > 89 characters) Line 90:13: W503 line break before binary operator Line 98:90: E501 line too long (114 > 89 characters)
- In the file
fastkml/tests/geometry_test.py:
Line 18:1: F401 'typing.cast' imported but unused Line 20:1: F401 'pytest' imported but unused Line 22:1: F401 'fastkml.config' imported but unused Line 23:1: F401 'fastkml.geometry' imported but unused Line 24:1: F401 'fastkml.types' imported but unused
- In the file
fastkml/tests/gx_test.py:
Line 18:1: F401 'typing.cast' imported but unused Line 20:1: F401 'pytest' imported but unused Line 22:1: F401 'fastkml.config' imported but unused Line 23:1: F401 'fastkml.gx' imported but unused Line 24:1: F401 'fastkml.types' imported but unused
- In the file
fastkml/tests/kml_test.py:
Line 18:1: F401 'typing.cast' imported but unused Line 20:1: F401 'pytest' imported but unused Line 22:1: F401 'fastkml.config' imported but unused Line 23:1: F401 'fastkml.kml' imported but unused Line 24:1: F401 'fastkml.types' imported but unused
- In the file
fastkml/tests/oldunit_test.py:
Line 138:13: W503 line break before binary operator Line 1720:90: E501 line too long (99 > 89 characters) Line 1734:90: E501 line too long (99 > 89 characters) Line 1749:90: E501 line too long (99 > 89 characters) Line 1753:90: E501 line too long (104 > 89 characters) Line 1789:90: E501 line too long (99 > 89 characters) Line 1793:90: E501 line too long (104 > 89 characters) Line 1797:90: E501 line too long (99 > 89 characters) Line 1818:90: E501 line too long (99 > 89 characters)
- In the file
fastkml/tests/styles_test.py:
Line 321:90: E501 line too long (98 > 89 characters) Line 361:90: E501 line too long (91 > 89 characters) Line 371:90: E501 line too long (109 > 89 characters)
Comment last updated at 2022-02-05 18:44:01 UTC
Sourcery Code Quality Report
β Β Merging this PR will decrease code quality in the affected files by 2.55%.
| Quality metrics | Before | After | Change |
|---|---|---|---|
| Complexity | 2.96 β | 5.80 β | 2.84 π |
| Method Length | 72.84 π | 58.75 β | -14.09 π |
| Working memory | 6.08 β | 6.57 π | 0.49 π |
| Quality | 74.32% π | 71.77% π | -2.55% π |
| Other metrics | Before | After | Change |
|---|---|---|---|
| Lines | 4480 | 2133 | -2347 |
| Changed files | Quality Before | Quality After | Quality Change |
|---|---|---|---|
| setup.py | 94.14% β | 94.13% β | -0.01% π |
| fastkml/atom.py | 76.91% β | 86.96% β | 10.05% π |
| fastkml/base.py | 88.91% β | 89.46% β | 0.55% π |
| fastkml/config.py | 73.49% π | 92.93% β | 19.44% π |
| fastkml/geometry.py | 66.45% π | 65.31% π | -1.14% π |
| fastkml/kml.py | 70.34% π | 70.37% π | 0.03% π |
| fastkml/styles.py | 73.91% π | 75.11% β | 1.20% π |
Here are some functions in these files that still need a tune-up:
| File | Function | Complexity | Length | Working Memory | Quality | Recommendation |
|---|---|---|---|---|---|---|
| fastkml/geometry.py | Geometry._get_multigeometry | 20 π | 265 β | 11 π | 34.76% π | Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions |
| fastkml/kml.py | _Feature.from_element | 21 π | 483 β | 8 π | 35.98% π | Refactor to reduce nesting. Try splitting into smaller methods |
| fastkml/kml.py | _Feature.etree_element | 21 π | 381 β | 7 π | 39.34% π | Refactor to reduce nesting. Try splitting into smaller methods |
| fastkml/kml.py | Placemark.from_element | 7 β | 298 β | 9 π | 48.44% π | Try splitting into smaller methods |
| fastkml/styles.py | StyleMap.from_element | 15 π | 163 π | 9 π | 49.59% π | Try splitting into smaller methods |
Legend and Explanation
The emojis denote the absolute quality of the code:
- β excellent
- π good
- π poor
- β very poor
The π and π indicate whether the quality has improved or gotten worse with this pull request.
Please see our documentation here for details on how these metrics are calculated.
We are actively working on this report - lots more documentation and extra metrics to come!
Help us improve this quality report!
π Click on the image for a new way to code review
-
Make big changes easier β review code in small groups of related files
-
Know where to start β see the whole change at a glance
-
Take a code tour β explore the change with an interactive tour
-
Make comments and review β all fully syncβed with github
Legend

:warning: The sha of the head commit of this PR conflicts with #170. Mergify cannot evaluate rules on this PR. :warning: