Skip to content

Commit 564ed94

Browse files
Attempt to clean up pylint errors on landscape.io. SubfieldBase has been replaced with type, and this causes calls to super() to throw warnings, although valid.
1 parent 02fca38 commit 564ed94

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

timezone_utils/fields.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
# ==============================================================================
3333
# MODEL FIELDS
3434
# ==============================================================================
35+
# pylint: disable=E0239
3536
class TimeZoneField(with_metaclass(TimeZoneFieldBase, CharField)):
3637
# Enforce the minimum length of max_length to be the length of the longest
3738
# pytz timezone string
@@ -60,13 +61,15 @@ def __init__(self, *args, **kwargs):
6061
category=UserWarning,
6162
)
6263

64+
# pylint: disable=newstyle
6365
super(TimeZoneField, self).__init__(*args, **kwargs)
6466

6567
def validate(self, value, model_instance):
6668
"""
6769
Validates value and throws ValidationError. Subclasses should override
6870
this to provide validation logic.
6971
"""
72+
# pylint: disable=newstyle
7073
super(TimeZoneField, self).validate(
7174
value=self.get_prep_value(value),
7275
model_instance=model_instance
@@ -76,10 +79,12 @@ def validate(self, value, model_instance):
7679
self.to_python(value)
7780

7881
def run_validators(self, value):
82+
# pylint: disable=newstyle
7983
super(TimeZoneField, self).run_validators(self.get_prep_value(value))
8084

8185
def get_prep_value(self, value):
8286
"""Converts timezone instances to strings for db storage."""
87+
# pylint: disable=newstyle
8388
value = super(TimeZoneField, self).get_prep_value(value)
8489

8590
if isinstance(value, tzinfo):
@@ -99,6 +104,7 @@ def from_db_value(self, value, expression, connection, context): # noqa
99104

100105
def to_python(self, value):
101106
"""Returns a datetime.tzinfo instance for the value."""
107+
# pylint: disable=newstyle
102108
value = super(TimeZoneField, self).to_python(value)
103109

104110
if not value:
@@ -221,12 +227,14 @@ def _check_choices_attribute(self): # pragma: no cover
221227
return []
222228

223229

230+
# pylint: disable=E0239
224231
class LinkedTZDateTimeField(with_metaclass(TimeZoneFieldBase, DateTimeField)):
225232
def __init__(self, *args, **kwargs):
226233
self.populate_from = kwargs.pop('populate_from', None)
227234
self.time_override = kwargs.pop('time_override', None)
228235
self.timezone = get_default_timezone()
229236

237+
# pylint: disable=newstyle
230238
super(LinkedTZDateTimeField, self).__init__(*args, **kwargs)
231239

232240
def from_db_value(self, value, expression, connection, context): # noqa
@@ -236,7 +244,7 @@ def from_db_value(self, value, expression, connection, context): # noqa
236244

237245
def to_python(self, value):
238246
"""Convert the value to the appropriate timezone."""
239-
247+
# pylint: disable=newstyle
240248
value = super(LinkedTZDateTimeField, self).to_python(value)
241249

242250
if not value:
@@ -252,7 +260,7 @@ def pre_save(self, model_instance, add):
252260
Converts the value being saved based on `populate_from` and
253261
`time_override`
254262
"""
255-
263+
# pylint: disable=newstyle
256264
# Retrieve the currently entered datetime
257265
value = super(
258266
LinkedTZDateTimeField,

0 commit comments

Comments
 (0)