pylint: Remove unnecessary 'else' statements
Signed-off-by: Vasilis Tsiligiannis <acinonyx@openwrt.gr>merge-requests/773/head
parent
c6b8fdd2da
commit
6025914422
|
@ -19,7 +19,6 @@ disable=
|
||||||
R0913,
|
R0913,
|
||||||
R0914,
|
R0914,
|
||||||
R0915,
|
R0915,
|
||||||
R1705,
|
|
||||||
R1710,
|
R1710,
|
||||||
W0201,
|
W0201,
|
||||||
W0221,
|
W0221,
|
||||||
|
|
|
@ -19,7 +19,6 @@ disable=
|
||||||
R0913,
|
R0913,
|
||||||
R0914,
|
R0914,
|
||||||
R0915,
|
R0915,
|
||||||
R1705,
|
|
||||||
R1710,
|
R1710,
|
||||||
W0201,
|
W0201,
|
||||||
W0221,
|
W0221,
|
||||||
|
|
|
@ -314,8 +314,7 @@ class JobSerializer(serializers.ModelSerializer):
|
||||||
frequency_drift = obj.transmitter_downlink_drift
|
frequency_drift = obj.transmitter_downlink_drift
|
||||||
if frequency_drift is None:
|
if frequency_drift is None:
|
||||||
return frequency
|
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):
|
def get_transmitter(self, obj):
|
||||||
return obj.transmitter_uuid
|
return obj.transmitter_uuid
|
||||||
|
|
|
@ -9,16 +9,14 @@ def analytics(request):
|
||||||
"""Returns analytics code."""
|
"""Returns analytics code."""
|
||||||
if settings.ENVIRONMENT == 'production':
|
if settings.ENVIRONMENT == 'production':
|
||||||
return {'analytics_code': render_to_string('includes/analytics.html')}
|
return {'analytics_code': render_to_string('includes/analytics.html')}
|
||||||
else:
|
return {'analytics_code': ''}
|
||||||
return {'analytics_code': ''}
|
|
||||||
|
|
||||||
|
|
||||||
def stage_notice(request):
|
def stage_notice(request):
|
||||||
"""Displays stage notice."""
|
"""Displays stage notice."""
|
||||||
if settings.ENVIRONMENT == 'stage':
|
if settings.ENVIRONMENT == 'stage':
|
||||||
return {'stage_notice': render_to_string('includes/stage_notice.html')}
|
return {'stage_notice': render_to_string('includes/stage_notice.html')}
|
||||||
else:
|
return {'stage_notice': ''}
|
||||||
return {'stage_notice': ''}
|
|
||||||
|
|
||||||
|
|
||||||
def user_processor(request):
|
def user_processor(request):
|
||||||
|
@ -27,21 +25,18 @@ def user_processor(request):
|
||||||
author=request.user, vetted_status='unknown', end__lt=now()
|
author=request.user, vetted_status='unknown', end__lt=now()
|
||||||
).count()
|
).count()
|
||||||
return {'owner_vetting_count': owner_vetting_count}
|
return {'owner_vetting_count': owner_vetting_count}
|
||||||
else:
|
return {'owner_vetting_count': ''}
|
||||||
return {'owner_vetting_count': ''}
|
|
||||||
|
|
||||||
|
|
||||||
def auth_block(request):
|
def auth_block(request):
|
||||||
"""Displays auth links local vs auth0."""
|
"""Displays auth links local vs auth0."""
|
||||||
if settings.AUTH0:
|
if settings.AUTH0:
|
||||||
return {'auth_block': render_to_string('includes/auth_auth0.html')}
|
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):
|
def logout_block(request):
|
||||||
"""Displays logout links local vs auth0."""
|
"""Displays logout links local vs auth0."""
|
||||||
if settings.AUTH0:
|
if settings.AUTH0:
|
||||||
return {'logout_block': render_to_string('includes/logout_auth0.html')}
|
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')}
|
|
||||||
|
|
|
@ -9,8 +9,7 @@ def admin_required(function):
|
||||||
return redirect(reverse('account_login'))
|
return redirect(reverse('account_login'))
|
||||||
if request.user.is_superuser:
|
if request.user.is_superuser:
|
||||||
return function(request, *args, **kwargs)
|
return function(request, *args, **kwargs)
|
||||||
else:
|
return redirect(reverse('base:home'))
|
||||||
return redirect(reverse('base:home'))
|
|
||||||
|
|
||||||
return wrap
|
return wrap
|
||||||
|
|
||||||
|
|
|
@ -183,8 +183,7 @@ class Station(models.Model):
|
||||||
def get_image(self):
|
def get_image(self):
|
||||||
if self.image and hasattr(self.image, 'url'):
|
if self.image and hasattr(self.image, 'url'):
|
||||||
return self.image.url
|
return self.image.url
|
||||||
else:
|
return settings.STATION_DEFAULT_IMAGE
|
||||||
return settings.STATION_DEFAULT_IMAGE
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_online(self):
|
def is_online(self):
|
||||||
|
@ -284,8 +283,7 @@ class Satellite(models.Model):
|
||||||
def get_image(self):
|
def get_image(self):
|
||||||
if self.image:
|
if self.image:
|
||||||
return self.image
|
return self.image
|
||||||
else:
|
return settings.SATELLITE_DEFAULT_IMAGE
|
||||||
return settings.SATELLITE_DEFAULT_IMAGE
|
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
|
@ -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
|
# Observation window in the first half of the pass
|
||||||
# Thus highest altitude right at the end of the window
|
# Thus highest altitude right at the end of the window
|
||||||
return get_altitude(observer, satellite, window_end)
|
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):
|
def resolve_overlaps(scheduled_obs, start, end):
|
||||||
|
|
|
@ -57,8 +57,7 @@ def check_start_end_datetimes(start, end):
|
||||||
def downlink_low_is_in_range(antenna, transmitter):
|
def downlink_low_is_in_range(antenna, transmitter):
|
||||||
if transmitter['downlink_low'] is not None:
|
if transmitter['downlink_low'] is not None:
|
||||||
return antenna.frequency <= transmitter['downlink_low'] <= antenna.frequency_max
|
return antenna.frequency <= transmitter['downlink_low'] <= antenna.frequency_max
|
||||||
else:
|
return False
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def is_transmitter_in_station_range(transmitter, station):
|
def is_transmitter_in_station_range(transmitter, station):
|
||||||
|
|
|
@ -21,8 +21,7 @@ class User(AbstractUser):
|
||||||
def displayname(self):
|
def displayname(self):
|
||||||
if self.get_full_name():
|
if self.get_full_name():
|
||||||
return self.get_full_name()
|
return self.get_full_name()
|
||||||
else:
|
return self.username
|
||||||
return self.username
|
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.username
|
return self.username
|
||||||
|
|
Loading…
Reference in New Issue