Skip to content

Commit

Permalink
Remove (object) from class declarations. (#6658)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertnishihara authored and pcmoritz committed Jan 3, 2020
1 parent f1b56fa commit 39a3459
Show file tree
Hide file tree
Showing 162 changed files with 397 additions and 398 deletions.
12 changes: 6 additions & 6 deletions python/ray/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def method(*args, **kwargs):
.. code-block:: python
@ray.remote
class Foo(object):
class Foo:
@ray.method(num_return_vals=2)
def bar(self):
return 1, 2
Expand All @@ -54,7 +54,7 @@ def annotate_method(method):

# Create objects to wrap method invocations. This is done so that we can
# invoke methods with actor.method.remote() instead of actor.method().
class ActorMethod(object):
class ActorMethod:
"""A class used to invoke an actor method.
Note: This class only keeps a weak ref to the actor, unless it has been
Expand Down Expand Up @@ -143,7 +143,7 @@ def __setstate__(self, state):
hardref=True)


class ActorClassMetadata(object):
class ActorClassMetadata:
"""Metadata for an actor class.
Attributes:
Expand Down Expand Up @@ -234,7 +234,7 @@ def __init__(self):
method.__ray_invocation_decorator__)


class ActorClass(object):
class ActorClass:
"""An actor class.
This is a decorated class. It can be used to create actors.
Expand Down Expand Up @@ -339,7 +339,7 @@ def options(self, **options):

actor_cls = self

class ActorOptionWrapper(object):
class ActorOptionWrapper:
def remote(self, *args, **kwargs):
return actor_cls._remote(args=args, kwargs=kwargs, **options)

Expand Down Expand Up @@ -518,7 +518,7 @@ def _remote(self,
return actor_handle


class ActorHandle(object):
class ActorHandle:
"""A handle to an actor.
The fields in this class are prefixed with _ray_ to hide them from the user
Expand Down
6 changes: 3 additions & 3 deletions python/ray/autoscaler/autoscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
}


class LoadMetrics(object):
class LoadMetrics:
"""Container for cluster load metrics.
Metrics here are updated from raylet heartbeats. The autoscaler
Expand Down Expand Up @@ -355,7 +355,7 @@ def log(self, statement):
logger.info(prefix + " {}".format(statement))


class ConcurrentCounter(object):
class ConcurrentCounter:
def __init__(self):
self._value = 0
self._lock = threading.Lock()
Expand All @@ -377,7 +377,7 @@ def value(self):
return self._value


class StandardAutoscaler(object):
class StandardAutoscaler:
"""The autoscaling control loop for a Ray cluster.
There are two ways to start an autoscaling cluster: manually by running
Expand Down
2 changes: 1 addition & 1 deletion python/ray/autoscaler/local/node_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
filelock_logger.setLevel(logging.WARNING)


class ClusterState(object):
class ClusterState:
def __init__(self, lock_path, save_path, provider_config):
self.lock = RLock()
self.file_lock = FileLock(lock_path)
Expand Down
2 changes: 1 addition & 1 deletion python/ray/autoscaler/log_timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
logger = logging.getLogger(__name__)


class LogTimer(object):
class LogTimer:
def __init__(self, message):
self._message = message

Expand Down
2 changes: 1 addition & 1 deletion python/ray/autoscaler/node_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def get_default_config(provider_config):
return defaults


class NodeProvider(object):
class NodeProvider:
"""Interface for getting and returning nodes from a Cloud.
NodeProviders are namespaced by the `cluster_name` parameter; they only
Expand Down
6 changes: 3 additions & 3 deletions python/ray/autoscaler/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def with_interactive(cmd):
return ["bash", "--login", "-c", "-i", quote(force_interactive + cmd)]


class KubernetesCommandRunner(object):
class KubernetesCommandRunner:
def __init__(self, log_prefix, namespace, node_id, auth_config,
process_runner):

Expand Down Expand Up @@ -149,7 +149,7 @@ def remote_shell_command_str(self):
self.node_id)


class SSHCommandRunner(object):
class SSHCommandRunner:
def __init__(self, log_prefix, node_id, provider, auth_config,
cluster_name, process_runner, use_internal_ip):

Expand Down Expand Up @@ -284,7 +284,7 @@ def remote_shell_command_str(self):
self.ssh_ip)


class NodeUpdater(object):
class NodeUpdater:
"""A process for syncing files and running init commands on a node."""

def __init__(self,
Expand Down
2 changes: 1 addition & 1 deletion python/ray/cluster_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
logger = logging.getLogger(__name__)


class Cluster(object):
class Cluster:
def __init__(self,
initialize_head=False,
connect=False,
Expand Down
2 changes: 1 addition & 1 deletion python/ray/dashboard/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def format_reply(reply):
format_reply(item)


class Dashboard(object):
class Dashboard:
"""A dashboard process for monitoring Ray nodes.
This dashboard is made up of a REST API which collates data published by
Expand Down
2 changes: 1 addition & 1 deletion python/ray/experimental/actor_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import ray


class ActorPool(object):
class ActorPool:
"""Utility class to operate on a fixed pool of actors.
Arguments:
Expand Down
2 changes: 1 addition & 1 deletion python/ray/experimental/array/distributed/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
BLOCK_SIZE = 10


class DistArray(object):
class DistArray:
def __init__(self, shape, objectids=None):
self.shape = shape
self.ndim = len(shape)
Expand Down
2 changes: 1 addition & 1 deletion python/ray/experimental/async_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
protocol = None


class _ThreadSafeProxy(object):
class _ThreadSafeProxy:
"""This class is used to create a thread-safe proxy for a given object.
Every method call will be guarded with a lock.
Expand Down
2 changes: 1 addition & 1 deletion python/ray/experimental/gcs_flush_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import ray.cloudpickle as pickle


class GcsFlushPolicy(object):
class GcsFlushPolicy:
"""Experimental: a policy to control GCS flushing.
Used by Monitor to enable automatic control of memory usage.
Expand Down
8 changes: 4 additions & 4 deletions python/ray/experimental/multiprocessing/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def next_ready_index(self, timeout=None):
raise TimeoutError


class AsyncResult(object):
class AsyncResult:
"""An asynchronous interface to task results.
This should not be constructed directly.
Expand Down Expand Up @@ -168,7 +168,7 @@ def successful(self):
return not self._result_thread.got_error()


class IMapIterator(object):
class IMapIterator:
"""Base class for OrderedIMapIterator and UnorderedIMapIterator."""

def __init__(self, pool, func, iterable, chunksize=None):
Expand Down Expand Up @@ -273,7 +273,7 @@ def next(self, timeout=None):


@ray.remote
class PoolActor(object):
class PoolActor:
"""Actor used to process tasks submitted to a Pool."""

def __init__(self, initializer=None, initargs=None):
Expand All @@ -298,7 +298,7 @@ def run_batch(self, func, batch):


# https://docs.python.org/3/library/multiprocessing.html#module-multiprocessing.pool
class Pool(object):
class Pool:
"""A pool of actor processes that is used to process tasks in parallel.
Args:
Expand Down
2 changes: 1 addition & 1 deletion python/ray/experimental/no_return.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import print_function


class NoReturn(object):
class NoReturn:
"""Do not store the return value in the object store.
If a task returns this object, then Ray will not store this object in the
Expand Down
4 changes: 2 additions & 2 deletions python/ray/experimental/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Full(Exception):
pass


class Queue(object):
class Queue:
"""Queue implementation on Ray.
Args:
Expand Down Expand Up @@ -132,7 +132,7 @@ def get_nowait(self):


@ray.remote
class _QueueActor(object):
class _QueueActor:
def __init__(self, maxsize):
self.maxsize = maxsize
self._init(maxsize)
Expand Down
2 changes: 1 addition & 1 deletion python/ray/experimental/serve/tests/test_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@pytest.fixture(scope="session")
def start_target_actor(ray_instance):
@ray.remote
class Target(object):
class Target:
def __init__(self):
self.counter_value = 0

Expand Down
2 changes: 1 addition & 1 deletion python/ray/experimental/sgd/pytorch/pytorch_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
logger = logging.getLogger(__name__)


class PyTorchRunner(object):
class PyTorchRunner:
"""Manages a PyTorch model for training."""

def __init__(self,
Expand Down
2 changes: 1 addition & 1 deletion python/ray/experimental/sgd/pytorch/pytorch_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
logger = logging.getLogger(__name__)


class PyTorchTrainer(object):
class PyTorchTrainer:
"""Train a PyTorch model using distributed PyTorch.
Launches a set of actors which connect via distributed PyTorch and
Expand Down
2 changes: 1 addition & 1 deletion python/ray/experimental/sgd/pytorch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def validate(model, val_iterator, criterion, config):
return stats


class AverageMeter(object):
class AverageMeter:
"""Computes and stores the average and current value."""

def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion python/ray/experimental/sgd/tf/tf_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def _try_import_strategy():
return tf.distribute.experimental.MultiWorkerMirroredStrategy


class TFRunner(object):
class TFRunner:
"""Manages a TensorFlow model for training."""

def __init__(self, model_creator, data_creator, config=None,
Expand Down
2 changes: 1 addition & 1 deletion python/ray/experimental/sgd/tf/tf_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
logger = logging.getLogger(__name__)


class TFTrainer(object):
class TFTrainer:
def __init__(self,
model_creator,
data_creator,
Expand Down
4 changes: 2 additions & 2 deletions python/ray/experimental/sgd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import time


class TimerStat(object):
class TimerStat:
"""A running stat for conveniently logging the duration of a code block.
Note that this class is *not* thread-safe.
Expand Down Expand Up @@ -108,7 +108,7 @@ def find_free_port():
return s.getsockname()[1]


class AverageMeter(object):
class AverageMeter:
"""Computes and stores the average and current value."""

def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion python/ray/experimental/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
logger = logging.getLogger(__name__)


class Signal(object):
class Signal:
"""Base class for Ray signals."""
pass

Expand Down
2 changes: 1 addition & 1 deletion python/ray/experimental/tf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def unflatten(vector, shapes):
return arrays


class TensorFlowVariables(object):
class TensorFlowVariables:
"""A class used to set and get weights for Tensorflow networks.
Attributes:
Expand Down
6 changes: 3 additions & 3 deletions python/ray/function_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
logger = logging.getLogger(__name__)


class FunctionDescriptor(object):
class FunctionDescriptor:
"""A class used to describe a python function.
Attributes:
Expand Down Expand Up @@ -259,7 +259,7 @@ def is_actor_method(self):
return len(self._class_name) > 0


class FunctionActorManager(object):
class FunctionActorManager:
"""A class used to export/load remote functions and actors.
Attributes:
Expand Down Expand Up @@ -658,7 +658,7 @@ def _load_actor_from_local(self, job_id, function_descriptor):
class_name))

def _create_fake_actor_class(self, actor_class_name, actor_method_names):
class TemporaryActor(object):
class TemporaryActor:
pass

def temporary_actor_method(*args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion python/ray/import_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
logger = logging.getLogger(__name__)


class ImportThread(object):
class ImportThread:
"""A thread used to import exports from the driver or other workers.
Note: The driver also has an import thread, which is used only to import
Expand Down
2 changes: 1 addition & 1 deletion python/ray/local_mode_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __deepcopy__(self, memo=None):
return new


class LocalModeManager(object):
class LocalModeManager:
"""Used to emulate remote operations when running in local mode."""

def __init__(self):
Expand Down
Loading

0 comments on commit 39a3459

Please sign in to comment.