Skip to content

Commit 0ed4ef1

Browse files
authored
Merge pull request #21 from tekktrik/dev/fix-pylint-errors
Fix pylint errors
2 parents c96c7ff + 90efc66 commit 0ed4ef1

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

adafruit_datetime.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ def fromutc(self, dt: "datetime") -> "datetime":
628628

629629
dtoff = dt.utcoffset()
630630
if dtoff is None:
631-
raise ValueError("fromutc() requires a non-None utcoffset() " "result")
631+
raise ValueError("fromutc() requires a non-None utcoffset() result")
632632
return dt + self._offset
633633

634634

@@ -841,7 +841,7 @@ def __new__(
841841
)
842842
if offset.microseconds != 0 or offset.seconds % 60 != 0:
843843
raise ValueError(
844-
"offset must be a timedelta" " representing a whole number of minutes"
844+
"offset must be a timedelta representing a whole number of minutes"
845845
)
846846
cls._offset = offset
847847
cls._name = name
@@ -860,14 +860,14 @@ def _create(cls, offset: timedelta, name: Optional[str] = None) -> "timezone":
860860
def utcoffset(self, dt: Optional["datetime"]) -> timedelta:
861861
if isinstance(dt, datetime) or dt is None:
862862
return self._offset
863-
raise TypeError("utcoffset() argument must be a datetime instance" " or None")
863+
raise TypeError("utcoffset() argument must be a datetime instance or None")
864864

865865
def tzname(self, dt: Optional["datetime"]) -> str:
866866
if isinstance(dt, datetime) or dt is None:
867867
if self._name is None:
868868
return self._name_from_offset(self._offset)
869869
return self._name
870-
raise TypeError("tzname() argument must be a datetime instance" " or None")
870+
raise TypeError("tzname() argument must be a datetime instance or None")
871871

872872
# Comparison to other timezone objects
873873
def __eq__(self, other: Any) -> bool:
@@ -1362,7 +1362,7 @@ def _fromtimestamp(cls, t: float, utc: bool, tz: Optional["tzinfo"]) -> "datetim
13621362
result = tz.fromutc(result)
13631363
return result
13641364

1365-
## pylint: disable=arguments-differ
1365+
## pylint: disable=arguments-differ, arguments-renamed
13661366
@classmethod
13671367
def fromtimestamp(
13681368
cls, timestamp: float, tz: Optional["tzinfo"] = None

tests/test_date.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# SPDX-License-Identifier: Python-2.0
1010
# Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py
1111
# NOTE: This test is based off CPython and therefore linting is disabled within this file.
12-
# pylint:disable=invalid-name, no-member, wrong-import-position, undefined-variable, no-self-use, cell-var-from-loop, misplaced-comparison-constant, too-many-public-methods, fixme, import-outside-toplevel, unused-argument, too-few-public-methods
12+
# pylint:disable=invalid-name, no-member, wrong-import-position, undefined-variable, no-self-use, cell-var-from-loop, too-many-public-methods, fixme, import-outside-toplevel, unused-argument, too-few-public-methods
1313
import sys
1414
import unittest
1515

@@ -225,23 +225,23 @@ def test_strftime(self):
225225

226226
def test_format(self):
227227
dt = cpy_date(2007, 9, 10)
228-
self.assertEqual(dt.__format__(""), str(dt))
228+
self.assertEqual(format(dt, ""), str(dt))
229229

230230
# check that a derived class's __str__() gets called
231231
class A(cpy_date):
232232
def __str__(self):
233233
return "A"
234234

235235
a = A(2007, 9, 10)
236-
self.assertEqual(a.__format__(""), "A")
236+
self.assertEqual(format(a, ""), "A")
237237

238238
# check that a derived class's strftime gets called
239239
class B(cpy_date):
240240
def strftime(self, format_spec):
241241
return "B"
242242

243243
b = B(2007, 9, 10)
244-
self.assertEqual(b.__format__(""), str(dt))
244+
self.assertEqual(format(b, ""), str(dt))
245245

246246
# date strftime not implemented in CircuitPython, skip
247247
"""for fmt in ["m:%m d:%d y:%y",

tests/test_datetime.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -239,35 +239,35 @@ def test_isoformat_timezone(self):
239239
@unittest.skip("strftime not implemented in datetime")
240240
def test_format(self):
241241
dt = self.theclass(2007, 9, 10, 4, 5, 1, 123)
242-
self.assertEqual(dt.__format__(""), str(dt))
242+
self.assertEqual(format(dt, ""), str(dt))
243243

244244
with self.assertRaisesRegex(TypeError, "must be str, not int"):
245-
dt.__format__(123)
245+
format(dt, 123)
246246

247247
# check that a derived class's __str__() gets called
248248
class A(self.theclass):
249249
def __str__(self):
250250
return "A"
251251

252252
a = A(2007, 9, 10, 4, 5, 1, 123)
253-
self.assertEqual(a.__format__(""), "A")
253+
self.assertEqual(format(a, ""), "A")
254254

255255
# check that a derived class's strftime gets called
256256
class B(self.theclass):
257257
def strftime(self, format_spec):
258258
return "B"
259259

260260
b = B(2007, 9, 10, 4, 5, 1, 123)
261-
self.assertEqual(b.__format__(""), str(dt))
261+
self.assertEqual(format(b, ""), str(dt))
262262

263263
for fmt in [
264264
"m:%m d:%d y:%y",
265265
"m:%m d:%d y:%y H:%H M:%M S:%S",
266266
"%z %Z",
267267
]:
268-
self.assertEqual(dt.__format__(fmt), dt.strftime(fmt))
269-
self.assertEqual(a.__format__(fmt), dt.strftime(fmt))
270-
self.assertEqual(b.__format__(fmt), "B")
268+
self.assertEqual(format(dt, fmt), dt.strftime(fmt))
269+
self.assertEqual(format(a, fmt), dt.strftime(fmt))
270+
self.assertEqual(format(b, fmt), "B")
271271

272272
@unittest.skip("ctime not implemented")
273273
def test_more_ctime(self):

tests/test_time.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -237,33 +237,33 @@ def test_strftime(self):
237237
@unittest.skip("strftime not implemented for CircuitPython time objects")
238238
def test_format(self):
239239
t = self.theclass(1, 2, 3, 4)
240-
self.assertEqual(t.__format__(""), str(t))
240+
self.assertEqual(format(t, ""), str(t))
241241

242242
with self.assertRaisesRegex(TypeError, "must be str, not int"):
243-
t.__format__(123)
243+
format(t, 123)
244244

245245
# check that a derived class's __str__() gets called
246246
class A(self.theclass):
247247
def __str__(self):
248248
return "A"
249249

250250
a = A(1, 2, 3, 4)
251-
self.assertEqual(a.__format__(""), "A")
251+
self.assertEqual(format(a, ""), "A")
252252

253253
# check that a derived class's strftime gets called
254254
class B(self.theclass):
255255
def strftime(self, format_spec):
256256
return "B"
257257

258258
b = B(1, 2, 3, 4)
259-
self.assertEqual(b.__format__(""), str(t))
259+
self.assertEqual(format(b, ""), str(t))
260260

261261
for fmt in [
262262
"%H %M %S",
263263
]:
264-
self.assertEqual(t.__format__(fmt), t.strftime(fmt))
265-
self.assertEqual(a.__format__(fmt), t.strftime(fmt))
266-
self.assertEqual(b.__format__(fmt), "B")
264+
self.assertEqual(format(t, fmt), t.strftime(fmt))
265+
self.assertEqual(format(a, fmt), t.strftime(fmt))
266+
self.assertEqual(format(b, fmt), "B")
267267

268268
def test_str(self):
269269
self.assertEqual(str(self.theclass(1, 2, 3, 4)), "01:02:03.000004")

0 commit comments

Comments
 (0)