1
0
Fork 0

pylint: Remove unnecessary 'else' statements

Signed-off-by: Vasilis Tsiligiannis <acinonyx@openwrt.gr>
merge-requests/773/head
Vasilis Tsiligiannis 2019-09-24 20:12:27 +03:00
parent c6b8fdd2da
commit 6025914422
9 changed files with 12 additions and 26 deletions

View File

@ -19,7 +19,6 @@ disable=
R0913,
R0914,
R0915,
R1705,
R1710,
W0201,
W0221,

View File

@ -19,7 +19,6 @@ disable=
R0913,
R0914,
R0915,
R1705,
R1710,
W0201,
W0221,

View File

@ -314,8 +314,7 @@ class JobSerializer(serializers.ModelSerializer):
frequency_drift = obj.transmitter_downlink_drift
if frequency_drift is None:
return frequency
else:
return int(round(frequency + ((frequency * frequency_drift) / float(pow(10, 9)))))
return int(round(frequency + ((frequency * frequency_drift) / float(pow(10, 9)))))
def get_transmitter(self, obj):
return obj.transmitter_uuid

View File

@ -9,16 +9,14 @@ def analytics(request):
"""Returns analytics code."""
if settings.ENVIRONMENT == 'production':
return {'analytics_code': render_to_string('includes/analytics.html')}
else:
return {'analytics_code': ''}
return {'analytics_code': ''}
def stage_notice(request):
"""Displays stage notice."""
if settings.ENVIRONMENT == 'stage':
return {'stage_notice': render_to_string('includes/stage_notice.html')}
else:
return {'stage_notice': ''}
return {'stage_notice': ''}
def user_processor(request):
@ -27,21 +25,18 @@ def user_processor(request):
author=request.user, vetted_status='unknown', end__lt=now()
).count()
return {'owner_vetting_count': owner_vetting_count}
else:
return {'owner_vetting_count': ''}
return {'owner_vetting_count': ''}
def auth_block(request):
"""Displays auth links local vs auth0."""
if settings.AUTH0:
return {'auth_block': render_to_string('includes/auth_auth0.html')}
else:
return {'auth_block': render_to_string('includes/auth_local.html')}
return {'auth_block': render_to_string('includes/auth_local.html')}
def logout_block(request):
"""Displays logout links local vs auth0."""
if settings.AUTH0:
return {'logout_block': render_to_string('includes/logout_auth0.html')}
else:
return {'logout_block': render_to_string('includes/logout_local.html')}
return {'logout_block': render_to_string('includes/logout_local.html')}

View File

@ -9,8 +9,7 @@ def admin_required(function):
return redirect(reverse('account_login'))
if request.user.is_superuser:
return function(request, *args, **kwargs)
else:
return redirect(reverse('base:home'))
return redirect(reverse('base:home'))
return wrap

View File

@ -183,8 +183,7 @@ class Station(models.Model):
def get_image(self):
if self.image and hasattr(self.image, 'url'):
return self.image.url
else:
return settings.STATION_DEFAULT_IMAGE
return settings.STATION_DEFAULT_IMAGE
@property
def is_online(self):
@ -284,8 +283,7 @@ class Satellite(models.Model):
def get_image(self):
if self.image:
return self.image
else:
return settings.SATELLITE_DEFAULT_IMAGE
return settings.SATELLITE_DEFAULT_IMAGE
def __unicode__(self):
return self.name

View File

@ -42,8 +42,7 @@ def max_altitude_in_window(observer, satellite, pass_tca, window_start, window_e
# Observation window in the first half of the pass
# Thus highest altitude right at the end of the window
return get_altitude(observer, satellite, window_end)
else:
return get_altitude(observer, satellite, pass_tca)
return get_altitude(observer, satellite, pass_tca)
def resolve_overlaps(scheduled_obs, start, end):

View File

@ -57,8 +57,7 @@ def check_start_end_datetimes(start, end):
def downlink_low_is_in_range(antenna, transmitter):
if transmitter['downlink_low'] is not None:
return antenna.frequency <= transmitter['downlink_low'] <= antenna.frequency_max
else:
return False
return False
def is_transmitter_in_station_range(transmitter, station):

View File

@ -21,8 +21,7 @@ class User(AbstractUser):
def displayname(self):
if self.get_full_name():
return self.get_full_name()
else:
return self.username
return self.username
def __unicode__(self):
return self.username