Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove object subclasses from Python classes. #250

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler_gym/datasets/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler_gym/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler_gym/datasets/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler_gym/envs/llvm/llvm_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down
4 changes: 2 additions & 2 deletions compiler_gym/service/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler_gym/third_party/inst2vec/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)


class Inst2vecEncoder(object):
class Inst2vecEncoder:
"""An LLVM encoder for inst2vec."""

def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion compiler_gym/util/shell_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any


class ShellFormatCodes(object):
class ShellFormatCodes:
"""Shell escape codes for pretty-printing."""

PURPLE = "\033[95m"
Expand Down
2 changes: 1 addition & 1 deletion compiler_gym/util/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion compiler_gym/views/observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion compiler_gym/views/observation_space_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion compiler_gym/views/reward.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
]


class CompilationSession(object):
class CompilationSession:
"""Represents an instance of an interactive compilation session."""

def __init__(self, benchmark: str):
Expand Down
6 changes: 3 additions & 3 deletions tests/util/minimize_trajectory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions tests/views/observation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions tests/views/reward_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 []))
Expand All @@ -21,7 +21,7 @@ def update(self, *args, **kwargs):
return ret


class MockObservationView(object):
class MockObservationView:
pass


Expand Down