-
Notifications
You must be signed in to change notification settings - Fork 714
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
Python style fixes #484
Python style fixes #484
Changes from all commits
25309a2
9eeb37f
caae889
d1d0a80
d94fdb6
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 |
---|---|---|
|
@@ -9,14 +9,8 @@ def __init__(self, group_id=None, groups_to_display=None): | |
:param groups_to_display: Unsubscribe groups to display | ||
:type groups_to_display: list(int), optional | ||
""" | ||
self._group_id = None | ||
self._groups_to_display = None | ||
|
||
if group_id is not None: | ||
self._group_id = group_id | ||
|
||
if groups_to_display is not None: | ||
self._groups_to_display = groups_to_display | ||
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. # Shouldn't this...
self._groups_to_display = groups_to_display
# be this?
self.groups_to_display = groups_to_display 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. Will fix in next push. 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. You deleted this code already too... |
||
self.group_id = group_id | ||
self.groups_to_display = groups_to_display | ||
|
||
@property | ||
def group_id(self): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
try: | ||
import rfc822 | ||
except ImportError: | ||
import email.utils as rfc822 | ||
|
||
|
||
class Email(object): | ||
"""An email address with an optional name.""" | ||
|
||
|
@@ -11,17 +17,13 @@ def __init__(self, email=None, name=None): | |
:param name: Name for this sender or recipient. | ||
:type name: string | ||
""" | ||
self._name = None | ||
self._email = None | ||
if name or email: | ||
if not name: | ||
# allows passing emails as "dude Fella <[email protected]>" | ||
self.parse_email(email) | ||
else: | ||
# allows backwards compatibility for Email(email, name) | ||
if email is not None: | ||
self.email = email | ||
self.name = name | ||
if email and not name: | ||
# allows passing emails as "dude Fella <[email protected]>" | ||
self.parse_email(email) | ||
else: | ||
# allows backwards compatibility for Email(email, name) | ||
self.email = email | ||
self.name = name | ||
|
||
@property | ||
def name(self): | ||
|
@@ -65,11 +67,6 @@ def get(self): | |
return email | ||
|
||
def parse_email(self, email_info): | ||
try: | ||
import rfc822 | ||
except ImportError: | ||
import email.utils as rfc822 | ||
|
||
name, email = rfc822.parseaddr(email_info) | ||
|
||
# more than likely a string was passed here instead of an email address | ||
|
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.
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.
Thanks for the catch - will fix typo in next commit.
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.
@gabrielkrell ,
I'm not sure how you are going to do this since you deleted this code already...
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.
Oh shoot - I thought that my replacement code had the typo, not the original. Github's not too great on mobile but I'll poke at it soon.
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.
Yeah so with this and the other changes I kept the typo - my new code should use the setter and not assign directly to the private variables. Oops!