Skip to content

Sourcery refactored master branch #1

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Jun 1, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

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 master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from donc310 June 1, 2023 12:59
EMAIL_PROGRAM_FAMILIES = set((
'Outlook',
'Windows Live Mail',
EMAIL_PROGRAM_FAMILIES = {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 69-86 refactored with the following changes:

device = self.is_pc and "PC" or self.device.family
os = ("%s %s" % (self.os.family, self.os.version_string)).strip()
browser = ("%s %s" % (self.browser.family, self.browser.version_string)).strip()
device = "PC" if self.is_pc else self.device.family
os = f"{self.os.family} {self.os.version_string}".strip()
browser = f"{self.browser.family} {self.browser.version_string}".strip()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UserAgent.__str__ refactored with the following changes:

Comment on lines -154 to +155
if ('Mobile Safari' not in self.ua_string and
self.browser.family != "Firefox Mobile"):
return True
return False
return (
'Mobile Safari' not in self.ua_string
and self.browser.family != "Firefox Mobile"
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UserAgent._is_android_tablet refactored with the following changes:

Comment on lines -164 to +162
if 'Blackberry 95' in self.device.family: # BB Storm devices
return True
if 'Blackberry 95' in self.device.family: # BB Torch devices
return True
return False
return 'Blackberry 95' in self.device.family
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UserAgent._is_blackberry_touch_capable_device refactored with the following changes:

This removes the following comments ( why? ):

# BB Storm devices
# BB Torch devices

Comment on lines -178 to +172
if self.os.family == 'Firefox OS' and 'Mobile' not in self.browser.family:
return True
return False
return self.os.family == 'Firefox OS' and 'Mobile' not in self.browser.family
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UserAgent.is_tablet refactored with the following changes:

Comment on lines -226 to +218
if 'BlackBerry' in self.os.family and self._is_blackberry_touch_capable_device():
return True
return False
return bool(
'BlackBerry' in self.os.family
and self._is_blackberry_touch_capable_device()
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UserAgent.is_touch_capable refactored with the following changes:

Comment on lines -234 to +224
self.os.family == 'Windows' and self.os.version_string == 'ME':
self.os.family == 'Windows' and self.os.version_string == 'ME':
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UserAgent.is_pc refactored with the following changes:

Comment on lines -250 to +238
return True if self.device.family == 'Spider' else False
return self.device.family == 'Spider'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UserAgent.is_bot refactored with the following changes:

Comment on lines -254 to +242
if self.browser.family in EMAIL_PROGRAM_FAMILIES:
return True
return False
return self.browser.family in EMAIL_PROGRAM_FAMILIES
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function UserAgent.is_email_client refactored with the following changes:

setattr(UserAgentsTest, 'test_' + device, test_wrapper(items))
setattr(UserAgentsTest, f'test_{device}', test_wrapper(items))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 268-268 refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants