diff --git a/mobile_cv/common/misc/cache_counter.py b/mobile_cv/common/misc/cache_counter.py index 11f6ceea..08369c1b 100644 --- a/mobile_cv/common/misc/cache_counter.py +++ b/mobile_cv/common/misc/cache_counter.py @@ -62,7 +62,7 @@ def get_stat_str(cls, counter): return ret -class CacheCounter(object): +class CacheCounter: def __init__( self, name, diff --git a/mobile_cv/common/misc/iter_utils.py b/mobile_cv/common/misc/iter_utils.py index 05c65cc3..9797c77b 100644 --- a/mobile_cv/common/misc/iter_utils.py +++ b/mobile_cv/common/misc/iter_utils.py @@ -7,7 +7,7 @@ from typing import Any, Callable, List, Optional, Tuple, Union -class ValueKeepingGenerator(object): +class ValueKeepingGenerator: def __init__(self, g): self.gen = g self.value = None @@ -233,7 +233,7 @@ def create_pair(lhs, rhs): @dataclass -class Pair(object): +class Pair: lhs: Any rhs: Any diff --git a/mobile_cv/common/misc/local_cache.py b/mobile_cv/common/misc/local_cache.py index 6096960a..c8c9c571 100644 --- a/mobile_cv/common/misc/local_cache.py +++ b/mobile_cv/common/misc/local_cache.py @@ -10,7 +10,7 @@ import diskcache -class Timer(object): +class Timer: def __init__(self): self.reset() @@ -42,7 +42,7 @@ def reset(self): self.diff = 0.0 -class TimerDict(object): +class TimerDict: def __init__(self): self.timers = {} @@ -67,7 +67,7 @@ def print(self): print(f"{name}: {item.average_time} ({item.total_time}, {item.calls})") -class LocalCache(object): +class LocalCache: @classmethod def Create(cls, prefix, num_shards, use_timer=False): tmp_dir = tempfile.gettempdir() diff --git a/mobile_cv/common/misc/py.py b/mobile_cv/common/misc/py.py index 915d63b9..c51edfb6 100644 --- a/mobile_cv/common/misc/py.py +++ b/mobile_cv/common/misc/py.py @@ -145,7 +145,7 @@ def new_func(*args, **kwargs): # Copied from detectron2/utils/serialize.py -class PicklableWrapper(object): +class PicklableWrapper: """ Wrap an object to make it more picklable, note that it uses heavy weight serialization libraries that are slower than pickle. diff --git a/mobile_cv/common/misc/test_utils.py b/mobile_cv/common/misc/test_utils.py index a8decb9c..7c91e8c3 100644 --- a/mobile_cv/common/misc/test_utils.py +++ b/mobile_cv/common/misc/test_utils.py @@ -14,7 +14,7 @@ from mobile_cv.common.misc.oss_utils import fb_overwritable -class SubPackageInitFileTestMixin(object): +class SubPackageInitFileTestMixin: """ A helper for creating test to check every subpackage has an __init__.py file. diff --git a/mobile_cv/common/tests/test_iter_utils.py b/mobile_cv/common/tests/test_iter_utils.py index e21ab2ae..ebd30846 100644 --- a/mobile_cv/common/tests/test_iter_utils.py +++ b/mobile_cv/common/tests/test_iter_utils.py @@ -203,11 +203,11 @@ def test_linearize_remap(self): to the original structure""" @dataclass - class Type1(object): + class Type1: name: str @dataclass - class Type2(object): + class Type2: name: str adict = { @@ -262,21 +262,21 @@ def test_linearize_remap_nested(self): to the original structure""" @dataclass - class Type1(object): + class Type1: name: str def process(self, _): return self.name + "_t1" @dataclass - class Type2(object): + class Type2: name: str def process(self, _): return self.name + "_t2" @dataclass - class TypeChoice(object): + class TypeChoice: name: str data: List[Any]