Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c732bef

Browse filesBrowse files
fix: reduce branching (selwin#112)
This is a very minor thing, but this will prevent 3x branches, and make the code slightly cleaner :)
1 parent 2f0d119 commit c732bef
Copy full SHA for c732bef

File tree

Expand file treeCollapse file tree

1 file changed

+4
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-8
lines changed

‎user_agents/parsers.py

Copy file name to clipboardExpand all lines: user_agents/parsers.py
+4-8Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,8 @@ def __unicode__(self):
159159
def _is_android_tablet(self):
160160
# Newer Android tablets don't have "Mobile" in their user agent string,
161161
# older ones like Galaxy Tab still have "Mobile" though they're not
162-
if ('Mobile Safari' not in self.ua_string and
163-
self.browser.family != "Firefox Mobile"):
164-
return True
165-
return False
162+
return ('Mobile Safari' not in self.ua_string and
163+
self.browser.family != "Firefox Mobile")
166164

167165
def _is_blackberry_touch_capable_device(self):
168166
# A helper to determine whether a BB phone has touch capabilities
@@ -269,13 +267,11 @@ def is_pc(self):
269267

270268
@property
271269
def is_bot(self):
272-
return True if self.device.family == 'Spider' else False
270+
return self.device.family == 'Spider'
273271

274272
@property
275273
def is_email_client(self):
276-
if self.browser.family in EMAIL_PROGRAM_FAMILIES:
277-
return True
278-
return False
274+
return self.browser.family in EMAIL_PROGRAM_FAMILIES
279275

280276

281277
def parse(user_agent_string):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.