-
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
1.0 alpha 7 (Sourcery refactored) #278
Conversation
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._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
)
year_month_day_match = year_month_day.match(datestr) | ||
if year_month_day_match: | ||
if year_month_day_match := year_month_day.match(datestr): |
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 KmlDateTime.parse
refactored with the following changes:
- Use named expression to simplify assignment and conditional (
use-named-expression
)
text = str(self.begin) | ||
if text: | ||
if text := str(self.begin): | ||
begin = config.etree.SubElement( # type: ignore[attr-defined] | ||
element, | ||
f"{self.ns}begin", | ||
) | ||
begin.text = text | ||
if self.end is not None: | ||
text = str(self.end) | ||
if text: | ||
if text := str(self.end): |
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 TimeSpan.etree_element
refactored with the following changes:
- Use named expression to simplify assignment and conditional [×2] (
use-named-expression
)
element = cast( | ||
types.Element, | ||
config.etree.Element(config.KMLNS + "Base"), # type: ignore[attr-defined] | ||
) | ||
element = cast(types.Element, config.etree.Element(f"{config.KMLNS}Base")) |
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 TestStdLibrary.test_base_from_element_raises
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
This removes the following comments ( why? ):
# type: ignore[attr-defined]
@@ -226,16 +225,14 @@ def etree_element( | |||
) -> Element: | |||
element = super().etree_element(precision=precision, verbosity=verbosity) | |||
if self.begin is not None: | |||
text = str(self.begin) | |||
if text: | |||
if text := str(self.begin): |
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. |
PR Summary
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #278 +/- ##
===========================================
+ Coverage 93.05% 93.13% +0.07%
===========================================
Files 33 33
Lines 4838 4819 -19
===========================================
- Hits 4502 4488 -14
+ Misses 336 331 -5 ☔ View full report in Codecov by Sentry. |
Pull Request #277 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
develop
branch, then run:Help us improve this pull request!