1
0
Fork 0

linting for W0621

resolving name conflicts between variables and functions

Signed-off-by: Corey Shields <cshields@gmail.com>
merge-requests/399/head
Corey Shields 2019-07-13 17:38:04 -04:00
parent 0d4701b100
commit fe1f989d7b
2 changed files with 16 additions and 17 deletions

View File

@ -19,7 +19,6 @@ disable=
R0915, R0915,
R1705, R1705,
W0511, W0511,
W0621,
W0703, W0703,
W1201, W1201,
W1202, W1202,

View File

@ -37,17 +37,17 @@ def home(request):
satellites = Satellite.objects.all() satellites = Satellite.objects.all()
transmitter_suggestions = TransmitterSuggestion.objects.count() transmitter_suggestions = TransmitterSuggestion.objects.count()
contributors = User.objects.filter(is_active=1).count() contributors = User.objects.filter(is_active=1).count()
statistics = cache.get('stats_transmitters') cached_stats = cache.get('stats_transmitters')
if not statistics: if not cached_stats:
try: try:
cache_statistics() cache_statistics()
statistics = cache.get('stats_transmitters') cached_stats = cache.get('stats_transmitters')
except OperationalError: except OperationalError:
pass pass
return render( return render(
request, 'base/home.html', { request, 'base/home.html', {
'satellites': satellites, 'satellites': satellites,
'statistics': statistics, 'statistics': cached_stats,
'contributors': contributors, 'contributors': contributors,
'transmitter_suggestions': transmitter_suggestions 'transmitter_suggestions': transmitter_suggestions
} }
@ -85,14 +85,14 @@ def satellite(request, norad):
:returns: base/satellite.html :returns: base/satellite.html
""" """
satellite = get_object_or_404(Satellite.objects, norad_cat_id=norad) satellite_obj = get_object_or_404(Satellite.objects, norad_cat_id=norad)
transmitter_suggestions = TransmitterSuggestion.objects.filter(satellite=satellite) transmitter_suggestions = TransmitterSuggestion.objects.filter(satellite=satellite_obj)
for transmitter_suggestion in transmitter_suggestions: for suggestion in transmitter_suggestions:
try: try:
original_transmitter = satellite.transmitters.get(uuid=transmitter_suggestion.uuid) original_transmitter = satellite_obj.transmitters.get(uuid=suggestion.uuid)
transmitter_suggestion.transmitter = original_transmitter suggestion.transmitter = original_transmitter
except Transmitter.DoesNotExist: except Transmitter.DoesNotExist:
transmitter_suggestion.transmitter = None suggestion.transmitter = None
modes = Mode.objects.all() modes = Mode.objects.all()
types = TRANSMITTER_TYPE types = TRANSMITTER_TYPE
services = SERVICE_TYPE services = SERVICE_TYPE
@ -104,13 +104,13 @@ def satellite(request, norad):
sats_cache = [] sats_cache = []
try: try:
latest_frame = DemodData.objects.filter(satellite=satellite).order_by('-id')[0] latest_frame = DemodData.objects.filter(satellite=satellite_obj).order_by('-id')[0]
except Exception: except Exception:
latest_frame = '' latest_frame = ''
return render( return render(
request, 'base/satellite.html', { request, 'base/satellite.html', {
'satellite': satellite, 'satellite': satellite_obj,
'transmitter_suggestions': transmitter_suggestions, 'transmitter_suggestions': transmitter_suggestions,
'modes': modes, 'modes': modes,
'types': types, 'types': types,
@ -239,11 +239,11 @@ def statistics(request):
:returns: JsonResponse of statistics :returns: JsonResponse of statistics
""" """
statistics = cache.get('stats_transmitters') cached_stats = cache.get('stats_transmitters')
if not statistics: if not cached_stats:
cache_statistics() cache_statistics()
statistics = [] cached_stats = []
return JsonResponse(statistics, safe=False) return JsonResponse(cached_stats, safe=False)
# TODO: this is confusing as we call it "edit" but it is the users "settings" # TODO: this is confusing as we call it "edit" but it is the users "settings"