-
Notifications
You must be signed in to change notification settings - Fork 92
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
#263 refactor stylespy (Sourcery refactored) #272
Conversation
WatermelonAI SummaryAI Summary deactivated by sourcery-ai[bot] GitHub PRs
No results found in Jira Tickets :( No results found in Confluence Docs :( No results found in Slack Threads :( No results found in Notion Pages :( No results found in Linear Tickets :( No results found in Asana Tasks :( fastkml is an open repo and Watermelon will serve it for free. |
PR Summary
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## 263-refactor-stylespy #272 +/- ##
=========================================================
+ Coverage 93.05% 93.13% +0.08%
=========================================================
Files 34 34
Lines 4865 4849 -16
=========================================================
- Hits 4527 4516 -11
+ Misses 338 333 -5 ☔ View full report in Codecov by Sentry. |
9fb3c58
to
b1d1589
Compare
WatermelonAI SummaryAI Summary deactivated by sourcery-ai[bot] GitHub PRs
No results found in Jira Tickets :( No results found in Confluence Docs :( No results found in Slack Threads :( No results found in Notion Pages :( No results found in Linear Tickets :( No results found in Asana Tasks :( fastkml is an open repo and Watermelon will serve it for free. |
b1d1589
to
2cae864
Compare
WatermelonAI SummaryAI Summary deactivated by sourcery-ai[bot] GitHub PRs
No results found in Jira Tickets :( No results found in Confluence Docs :( No results found in Slack Threads :( No results found in Notion Pages :( No results found in Linear Tickets :( No results found in Asana Tasks :( fastkml is an open repo and Watermelon will serve it for free. |
2cae864
to
d3f214a
Compare
@@ -210,9 +210,7 @@ def style_url(self) -> Optional[str]: | |||
Returns the url only, not a full StyleUrl object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file contains at least one console log. Please remove any present.
WatermelonAI SummaryAI Summary deactivated by sourcery-ai[bot] GitHub PRs
No results found in Jira Tickets :( No results found in Confluence Docs :( No results found in Slack Threads :( No results found in Notion Pages :( No results found in Linear Tickets :( No results found in Asana Tasks :( fastkml is an open repo and Watermelon will serve it for free. |
return str(value) | ||
return value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function DataType.convert
refactored with the following changes:
- Remove unnecessary casts to int, str, float or bool (
remove-unnecessary-cast
)
if isinstance(self._style_url, StyleUrl): | ||
return self._style_url.url | ||
return None | ||
return self._style_url.url if isinstance(self._style_url, StyleUrl) else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function _Feature.style_url
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
if self._atom_author: | ||
return self._atom_author.name | ||
return None | ||
return self._atom_author.name if self._atom_author else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function _Feature.author
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
text = self._snippet.get("text") | ||
if text: | ||
if text := self._snippet.get("text"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function _Feature.snippet
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
if self._address: | ||
return self._address | ||
return None | ||
return self._address if self._address else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function _Feature.address
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
if self._phone_number: | ||
return self._phone_number | ||
return None | ||
return self._phone_number if self._phone_number else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function _Feature.phone_number
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
for style in self.styles(): | ||
if style.id == id: | ||
return style | ||
return None | ||
return next((style for style in self.styles() if style.id == id), None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Document.get_style_by_url
refactored with the following changes:
- Use the built-in function
next
instead of a for-loop (use-next
)
if self._geometry is not None: | ||
return self._geometry.geometry | ||
return None | ||
return self._geometry.geometry if self._geometry is not None else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function Placemark.geometry
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
if val == "true": | ||
return 1 | ||
return int(float(val)) | ||
return 1 if val == "true" else int(float(val)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function strtobool
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
Pull Request #271 refactored by Sourcery.
If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
263-refactor-stylespy
branch, then run:Help us improve this pull request!