Merge branch 'pr/fix_R0201' into 'master'
Ignore no-self-use error for serialization and ModelAdmin member functions (R0201) See merge request librespacefoundation/satnogs/satnogs-network!814merge-requests/814/merge
commit
2042b53334
|
@ -8,7 +8,6 @@ disable=
|
|||
C0412,
|
||||
E1101,
|
||||
E1121,
|
||||
R0201,
|
||||
R0401,
|
||||
R0801, # needs to remain disabled see https://github.com/PyCQA/pylint/issues/214
|
||||
R0901,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""SatNOGS Network API serializers, django rest framework"""
|
||||
# pylint: disable=no-self-use
|
||||
from rest_framework import serializers
|
||||
|
||||
from network.base.db_api import DBConnectionError, \
|
||||
|
|
|
@ -20,11 +20,11 @@ class AntennaAdmin(admin.ModelAdmin):
|
|||
'antenna_type',
|
||||
)
|
||||
|
||||
def antenna_count(self, obj):
|
||||
def antenna_count(self, obj): # pylint: disable=no-self-use
|
||||
"""Return the number of antennas"""
|
||||
return obj.stations.all().count()
|
||||
|
||||
def station_list(self, obj):
|
||||
def station_list(self, obj): # pylint: disable=no-self-use
|
||||
"""Return stations that use the antenna"""
|
||||
return ",\n".join([str(s.id) for s in obj.stations.all()])
|
||||
|
||||
|
@ -43,11 +43,11 @@ class StationAdmin(admin.ModelAdmin):
|
|||
export_as_csv.short_description = "Export selected as CSV"
|
||||
export_station_status.short_description = "Export selected status"
|
||||
|
||||
def created_date(self, obj):
|
||||
def created_date(self, obj): # pylint: disable=no-self-use
|
||||
"""Return when the station was created"""
|
||||
return obj.created.strftime('%d.%m.%Y, %H:%M')
|
||||
|
||||
def get_email(self, obj):
|
||||
def get_email(self, obj): # pylint: disable=no-self-use
|
||||
"""Return station owner email address"""
|
||||
return obj.owner.email
|
||||
|
||||
|
@ -80,7 +80,7 @@ class TleAdmin(admin.ModelAdmin):
|
|||
list_display = ('satellite_name', 'tle0', 'tle1', 'updated')
|
||||
list_filter = ('satellite__name', )
|
||||
|
||||
def satellite_name(self, obj):
|
||||
def satellite_name(self, obj): # pylint: disable=no-self-use
|
||||
"""Return the satellite name"""
|
||||
return obj.satellite.name
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class StationSerializer(serializers.ModelSerializer):
|
|||
model = Station
|
||||
fields = ('name', 'lat', 'lng', 'id', 'status', 'status_display')
|
||||
|
||||
def get_status_display(self, obj):
|
||||
def get_status_display(self, obj): # pylint: disable=no-self-use
|
||||
"""Returns the station status"""
|
||||
try:
|
||||
return obj.get_status_display()
|
||||
|
|
Loading…
Reference in New Issue