diff --git a/compiler_gym/datasets/benchmark.py b/compiler_gym/datasets/benchmark.py index 7a50c21c2..6e64eaab3 100644 --- a/compiler_gym/datasets/benchmark.py +++ b/compiler_gym/datasets/benchmark.py @@ -38,7 +38,7 @@ def __repr__(self) -> str: return str(self.filename) -class Benchmark(object): +class Benchmark: """A benchmark represents a particular program that is being compiled. A benchmark is a program that can be used by a :class:`CompilerEnv diff --git a/compiler_gym/datasets/dataset.py b/compiler_gym/datasets/dataset.py index 915eac9e7..0e034a0c9 100644 --- a/compiler_gym/datasets/dataset.py +++ b/compiler_gym/datasets/dataset.py @@ -17,7 +17,7 @@ from compiler_gym.util.debug_util import get_logging_level -class Dataset(object): +class Dataset: """A dataset is a collection of benchmarks. The Dataset class has methods for installing and managing groups of diff --git a/compiler_gym/datasets/datasets.py b/compiler_gym/datasets/datasets.py index 2c4b0e00f..fd6c285e0 100644 --- a/compiler_gym/datasets/datasets.py +++ b/compiler_gym/datasets/datasets.py @@ -33,7 +33,7 @@ def round_robin_iterables(iters: Iterable[Iterable[T]]) -> Iterable[T]: yield from iters.popleft() -class Datasets(object): +class Datasets: """A collection of datasets. This class provides a dictionary-like interface for indexing and iterating diff --git a/compiler_gym/envs/llvm/llvm_benchmark.py b/compiler_gym/envs/llvm/llvm_benchmark.py index 31d510c3e..58cc4f10e 100644 --- a/compiler_gym/envs/llvm/llvm_benchmark.py +++ b/compiler_gym/envs/llvm/llvm_benchmark.py @@ -107,7 +107,7 @@ def get_system_includes() -> List[Path]: return _SYSTEM_INCLUDES -class ClangInvocation(object): +class ClangInvocation: """Class to represent a single invocation of the clang compiler.""" def __init__( diff --git a/compiler_gym/service/connection.py b/compiler_gym/service/connection.py index ba123cd28..fbd4031ab 100644 --- a/compiler_gym/service/connection.py +++ b/compiler_gym/service/connection.py @@ -134,7 +134,7 @@ def __call__( StubMethod = Callable[[Request], Reply] -class Connection(object): +class Connection: """Base class for service connections.""" def __init__(self, channel, url: str, logger: logging.Logger): @@ -477,7 +477,7 @@ def __repr__(self): return self.url -class CompilerGymServiceConnection(object): +class CompilerGymServiceConnection: """A connection to a compiler gym service. There are two types of service connections: managed and unmanaged. The type diff --git a/compiler_gym/third_party/inst2vec/__init__.py b/compiler_gym/third_party/inst2vec/__init__.py index cfcef729e..31704fdde 100644 --- a/compiler_gym/third_party/inst2vec/__init__.py +++ b/compiler_gym/third_party/inst2vec/__init__.py @@ -15,7 +15,7 @@ ) -class Inst2vecEncoder(object): +class Inst2vecEncoder: """An LLVM encoder for inst2vec.""" def __init__(self): diff --git a/compiler_gym/util/shell_format.py b/compiler_gym/util/shell_format.py index 9a3f74f35..abf1b18ce 100644 --- a/compiler_gym/util/shell_format.py +++ b/compiler_gym/util/shell_format.py @@ -5,7 +5,7 @@ from typing import Any -class ShellFormatCodes(object): +class ShellFormatCodes: """Shell escape codes for pretty-printing.""" PURPLE = "\033[95m" diff --git a/compiler_gym/util/timer.py b/compiler_gym/util/timer.py index f4c2d51c1..9d3562896 100644 --- a/compiler_gym/util/timer.py +++ b/compiler_gym/util/timer.py @@ -29,7 +29,7 @@ def humanize_duration_hms(seconds: float) -> str: return f"{seconds // 3600}:{(seconds % 3600) // 60:02d}:{seconds % 60:02d}" -class Timer(object): +class Timer: """A very simple scoped timer. Example: diff --git a/compiler_gym/views/observation.py b/compiler_gym/views/observation.py index c7de881b2..253030a2d 100644 --- a/compiler_gym/views/observation.py +++ b/compiler_gym/views/observation.py @@ -9,7 +9,7 @@ from compiler_gym.views.observation_space_spec import ObservationSpaceSpec -class ObservationView(object): +class ObservationView: """A view into the available observation spaces of a service. Example usage: diff --git a/compiler_gym/views/observation_space_spec.py b/compiler_gym/views/observation_space_spec.py index 6940ab910..3b5bdecd8 100644 --- a/compiler_gym/views/observation_space_spec.py +++ b/compiler_gym/views/observation_space_spec.py @@ -22,7 +22,7 @@ def _json2nx(observation): ) -class ObservationSpaceSpec(object): +class ObservationSpaceSpec: """Specification of an observation space. :ivar id: The name of the observation space. diff --git a/compiler_gym/views/reward.py b/compiler_gym/views/reward.py index 7f3f78c6f..b7142c5e3 100644 --- a/compiler_gym/views/reward.py +++ b/compiler_gym/views/reward.py @@ -10,7 +10,7 @@ from compiler_gym.views.observation import ObservationView -class RewardView(object): +class RewardView: """A view into a set of reward spaces. Example usage: diff --git a/examples/example_compiler_gym_service/service_py/example_service.py b/examples/example_compiler_gym_service/service_py/example_service.py index 0335b8db1..4c46b7d49 100755 --- a/examples/example_compiler_gym_service/service_py/example_service.py +++ b/examples/example_compiler_gym_service/service_py/example_service.py @@ -86,7 +86,7 @@ ] -class CompilationSession(object): +class CompilationSession: """Represents an instance of an interactive compilation session.""" def __init__(self, benchmark: str): diff --git a/tests/util/minimize_trajectory_test.py b/tests/util/minimize_trajectory_test.py index 5cb33a6a1..b9e7597e4 100644 --- a/tests/util/minimize_trajectory_test.py +++ b/tests/util/minimize_trajectory_test.py @@ -18,14 +18,14 @@ logging.basicConfig(level=logging.DEBUG) -class MockActionSpace(object): +class MockActionSpace: """A mock action space for use by MockEnv.""" def __init__(self, actions): self.flags = {a: str(a) for a in set(actions)} -class MockValidationResult(object): +class MockValidationResult: """A mock validation result for use by MockEnv.""" def __init__(self, okay): @@ -35,7 +35,7 @@ def okay(self): return self._okay -class MockEnv(object): +class MockEnv: """A mock environment for testing trajectory minimization.""" def __init__(self, actions: List[int], validate=lambda env: True): diff --git a/tests/views/observation_test.py b/tests/views/observation_test.py index b3edc34f9..a8d7cccef 100644 --- a/tests/views/observation_test.py +++ b/tests/views/observation_test.py @@ -21,12 +21,12 @@ from tests.test_main import main -class MockGetObservationReply(object): +class MockGetObservationReply: def __init__(self, value): self.observation = [value] -class MockGetObservation(object): +class MockGetObservation: """Mock for the get_observation callack of ObservationView.""" def __init__(self, ret=None): diff --git a/tests/views/reward_test.py b/tests/views/reward_test.py index d51294dd2..eb7e48123 100644 --- a/tests/views/reward_test.py +++ b/tests/views/reward_test.py @@ -9,7 +9,7 @@ from tests.test_main import main -class MockReward(object): +class MockReward: def __init__(self, id, ret=None): self.id = id self.ret = list(reversed(ret or [])) @@ -21,7 +21,7 @@ def update(self, *args, **kwargs): return ret -class MockObservationView(object): +class MockObservationView: pass