-
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
Release 1.0.alpha.6 (Sourcery refactored) #248
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,9 +352,7 @@ def strtobool(val: str) -> int: | |
val = val.lower() | ||
if val == "false": | ||
return 0 | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
super().from_element(element) | ||
fill = element.find(f"{self.ns}fill") | ||
|
@@ -628,7 +626,7 @@ def from_element(self, element: Element) -> None: | |
key = pair.find(f"{self.ns}key") | ||
style = pair.find(f"{self.ns}Style") | ||
style_url = pair.find(f"{self.ns}styleUrl") | ||
if key is None: | ||
if key is None or key.text not in ["highlight", "normal"]: | ||
Comment on lines
-631
to
+629
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
raise ValueError | ||
elif key.text == "highlight": | ||
if style is not None: | ||
|
@@ -640,7 +638,7 @@ def from_element(self, element: Element) -> None: | |
else: | ||
raise ValueError | ||
self.highlight = highlight | ||
elif key.text == "normal": | ||
else: | ||
if style is not None: | ||
normal = Style(self.ns) | ||
normal.from_element(style) | ||
|
@@ -650,8 +648,6 @@ def from_element(self, element: Element) -> None: | |
else: | ||
raise ValueError | ||
self.normal = normal | ||
else: | ||
raise ValueError | ||
|
||
def etree_element( | ||
self, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,10 +75,7 @@ class Test(base._BaseObject): | |
|
||
def test_base_from_element_raises(self) -> None: | ||
be = base._BaseObject() | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Function
This removes the following comments ( why? ):
|
||
|
||
with pytest.raises(TypeError): | ||
be.from_element(element=element) | ||
|
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:reintroduce-else
)assign-if-exp
)