diff --git a/boltons/funcutils.py b/boltons/funcutils.py index d11593a..3cd2b1b 100644 --- a/boltons/funcutils.py +++ b/boltons/funcutils.py @@ -932,7 +932,7 @@ class FunctionBuilder: try: self.kwonlyargs.remove(arg_name) except (AttributeError, ValueError): - # py2, or py3 and missing from both + # missing from both exc = MissingArgument('arg %r not found in %s argument list:' ' %r' % (arg_name, self.name, args)) exc.arg_name = arg_name diff --git a/boltons/iterutils.py b/boltons/iterutils.py index 98f4309..fb3d366 100644 --- a/boltons/iterutils.py +++ b/boltons/iterutils.py @@ -1398,10 +1398,7 @@ class GUIDerator: self.salt = '-'.join([str(self.pid), socket.gethostname() or '', str(time.time()), - codecs.encode(os.urandom(6), - 'hex_codec').decode('ascii')]) - # that codecs trick is the best/only way to get a bytes to - # hexbytes in py2/3 + os.urandom(6).hex()]) return def __iter__(self): diff --git a/boltons/statsutils.py b/boltons/statsutils.py index a2d726c..36a8223 100644 --- a/boltons/statsutils.py +++ b/boltons/statsutils.py @@ -128,6 +128,7 @@ system instrumentation package. import bisect from math import floor, ceil +from collections import Counter class _StatsProperty: @@ -595,12 +596,7 @@ class Stats: bins = sorted(set(bins)) idxs = [bisect.bisect(bins, d) - 1 for d in self.data] - count_map = {} # would have used Counter, but py26 support - for idx in idxs: - try: - count_map[idx] += 1 - except KeyError: - count_map[idx] = 1 + count_map = Counter(idxs) bin_counts = [(b, count_map.get(i, 0)) for i, b in enumerate(bins)] diff --git a/docs/timeutils.rst b/docs/timeutils.rst index 090c28c..1eb8e41 100644 --- a/docs/timeutils.rst +++ b/docs/timeutils.rst @@ -28,11 +28,18 @@ working with them: .. _UTC: https://en.wikipedia.org/wiki/Coordinated_Universal_Time +.. note:: + + These days, Python has a `built-in UTC`_, and the UTC tzinfo here, + while equivalent, is just for backwards compat. + .. autoattribute:: boltons.timeutils.UTC .. autodata:: boltons.timeutils.LocalTZ .. autoclass:: boltons.timeutils.ConstantTZInfo +.. _built-in UTC: https://docs.python.org/3/library/datetime.html#datetime.timezone.utc + US timezones ------------ diff --git a/tests/test_fileutils.py b/tests/test_fileutils.py index b7c6d61..6d61c13 100644 --- a/tests/test_fileutils.py +++ b/tests/test_fileutils.py @@ -14,6 +14,6 @@ def test_fileperms(): assert repr(up) == "FilePerms(user='rwx', group='rwx', other='')" assert up.user == 'rwx' - assert oct(int(up)).endswith('770') # 0770 on py2 and 0o770 on py3 + assert oct(int(up)) == '0o770' assert int(FilePerms()) == 0