Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced old string format and changed to f strings #140

Merged
merged 2 commits into from
Oct 22, 2021

Conversation

Kishore-abhimanyu
Copy link
Contributor

No description provided.

@pep8speaks
Copy link

pep8speaks commented Oct 15, 2021

Hello @Kishore-abhimanyu! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-10-15 11:58:37 UTC

@cleder
Copy link
Owner

cleder commented Oct 15, 2021

Changed target to python3 branch, please resolve the merge conflicts

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 15, 2021

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.61%.

Quality metrics Before After Change
Complexity 2.98 ⭐ 2.64 ⭐ -0.34 👍
Method Length 58.68 ⭐ 58.74 ⭐ 0.06 👎
Working memory 6.36 🙂 6.18 ⭐ -0.18 👍
Quality 75.98% 76.59% 0.61% 👍
Other metrics Before After Change
Lines 4399 4049 -350
Changed files Quality Before Quality After Quality Change
fastkml/atom.py 78.88% ⭐ 79.10% ⭐ 0.22% 👍
fastkml/geometry.py 68.68% 🙂 % %
fastkml/gx.py 80.35% ⭐ 80.14% ⭐ -0.21% 👎
fastkml/kml.py 72.06% 🙂 72.15% 🙂 0.09% 👍
fastkml/styles.py 76.48% ⭐ 76.59% ⭐ 0.11% 👍
fastkml/test_main.py 78.94% ⭐ 78.94% ⭐ 0.00%

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
fastkml/kml.py _Feature.from_element 21 😞 408 ⛔ 8 🙂 36.62% 😞 Refactor to reduce nesting. Try splitting into smaller methods
fastkml/kml.py _Feature.etree_element 21 😞 292 ⛔ 6 ⭐ 43.97% 😞 Refactor to reduce nesting. Try splitting into smaller methods
fastkml/kml.py Placemark.from_element 7 ⭐ 246 ⛔ 10 😞 48.59% 😞 Try splitting into smaller methods. Extract out complex expressions
fastkml/styles.py StyleMap.from_element 15 🙂 138 😞 9 🙂 52.23% 🙂 Try splitting into smaller methods
fastkml/kml.py _TimePrimitive.parse_str 6 ⭐ 146 😞 12 😞 53.78% 🙂 Try splitting into smaller methods. Extract out complex expressions

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!

@Kishore-abhimanyu
Copy link
Contributor Author

Merge conflicts have been resolved.

Copy link
Owner

@cleder cleder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flake8 reports the following errors:

fastkml/geometry.py:1:1: E902 IndentationError: unindent does not match any outer indentation level
fastkml/geometry.py:153:44: FS001 '%' operator used
fastkml/geometry.py:155:35: FS001 '%' operator used
fastkml/geometry.py:162:34: FS001 '%' operator used
fastkml/atom.py:42:9: FS003 f-string missing prefix
fastkml/kml.py:317:13: G010 Logging statement uses 'warn' instead of 'warning'
fastkml/kml.py:404:44: FS003 f-string missing prefix
fastkml/kml.py:421:17: FS003 f-string missing prefix
fastkml/kml.py:1081:22: G004 Logging statement uses f-string
fastkml/test_main.py:112:14: FS003 f-string missing prefix
fastkml/test_main.py:117:14: FS003 f-string missing prefix
fastkml/test_main.py:151:14: FS003 f-string missing prefix
fastkml/test_main.py:167:14: FS003 f-string missing prefix
fastkml/test_main.py:181:14: FS003 f-string missing prefix
fastkml/test_main.py:210:14: FS003 f-string missing prefix
fastkml/test_main.py:227:14: FS003 f-string missing prefix
fastkml/test_main.py:259:14: FS003 f-string missing prefix
fastkml/test_main.py:289:14: FS003 f-string missing prefix
fastkml/config.py:35:9: FS003 f-string missing prefix
fastkml/config.py:36:10: FS003 f-string missing prefix
fastkml/config.py:37:8: FS003 f-string missing prefix
examples/CreateKml.py:8:6: FS003 f-string missing prefix

the FS003 f-string missing prefix and FS001 '%' operator used seem to be a red herring, check them and if my hunch is true just add a # noqa: FS003 comment to these lines.

ibs = [
self._get_linear_ring(inner_boundary)
for inner_boundary in inner_boundaries
]
return Polygon.from_linear_rings(ob, *ibs)
if element.tag == ("%sLinearRing" % self.ns):
return Polygon.from_linear_rings(ob, *ibs)
Copy link
Owner

@cleder cleder Oct 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR you submitted does not compile:

E File "/home/runner/work/fastkml/fastkml/fastkml/geometry.py", line 342
E return Polygon.from_linear_rings(ob, *ibs)
E ^
E IndentationError: unindent does not match any outer indentation level

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run (in a virtual environment)

pip install -r test-requirements.txt
isort fastkml examples docs
black fastkml examples docs
flake8 fastkml examples docs

@cleder cleder merged commit 7aedd74 into cleder:python3 Oct 22, 2021
cleder added a commit that referenced this pull request Oct 22, 2021
cleder added a commit that referenced this pull request Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants