-
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
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 |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. This file contains at least one console log. Please remove any present. |
||
if you need the full StyleUrl object use _style_url. | ||
""" | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
@style_url.setter | ||
def style_url(self, styleurl: Union[str, StyleUrl, None]) -> None: | ||
|
@@ -262,9 +260,7 @@ def link(self, url) -> None: | |
|
||
@property | ||
def author(self) -> None: | ||
if self._atom_author: | ||
return self._atom_author.name | ||
return None | ||
return self._atom_author.name if self._atom_author else None | ||
Comment on lines
-265
to
+263
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
|
||
|
||
@author.setter | ||
def author(self, name) -> None: | ||
|
@@ -300,8 +296,7 @@ def snippet(self) -> Optional[Dict[str, Any]]: | |
if not self._snippet: | ||
return None | ||
if isinstance(self._snippet, dict): | ||
text = self._snippet.get("text") | ||
if text: | ||
if text := self._snippet.get("text"): | ||
Comment on lines
-303
to
+299
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
|
||
assert isinstance(text, str) | ||
max_lines = self._snippet.get("maxLines", None) | ||
if max_lines is None: | ||
|
@@ -339,9 +334,7 @@ def snippet(self, snip=None) -> None: | |
|
||
@property | ||
def address(self) -> None: | ||
if self._address: | ||
return self._address | ||
return None | ||
return self._address if self._address else None | ||
Comment on lines
-342
to
+337
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
|
||
|
||
@address.setter | ||
def address(self, address) -> None: | ||
|
@@ -354,9 +347,7 @@ def address(self, address) -> None: | |
|
||
@property | ||
def phone_number(self) -> None: | ||
if self._phone_number: | ||
return self._phone_number | ||
return None | ||
return self._phone_number if self._phone_number else None | ||
Comment on lines
-357
to
+350
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
|
||
|
||
@phone_number.setter | ||
def phone_number(self, phone_number) -> None: | ||
|
@@ -1641,10 +1632,7 @@ def etree_element( | |
|
||
def get_style_by_url(self, style_url: str) -> Union[Style, StyleMap]: | ||
id = urlparse.urlparse(style_url).fragment | ||
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) | ||
Comment on lines
-1644
to
+1635
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
|
||
|
||
|
||
class Folder(_Container): | ||
|
@@ -1711,9 +1699,7 @@ def __init__( | |
|
||
@property | ||
def geometry(self) -> Optional[AnyGeometryType]: | ||
if self._geometry is not None: | ||
return self._geometry.geometry | ||
return None | ||
return self._geometry.geometry if self._geometry is not None else None | ||
Comment on lines
-1714
to
+1702
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
|
||
|
||
def from_element(self, element: Element, strict=False) -> None: | ||
super().from_element(element) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,9 +46,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
|
||
|
||
|
||
class StyleUrl(_BaseObject): | ||
|
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-cast
)