Skip to content

Commit c732bef

Browse 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

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

‎user_agents/parsers.py‎

Lines 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)