Skip to content

Commit

Permalink
Python 2 compatibility. (#5887)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertnishihara committed Oct 11, 2019
1 parent c3b2ae2 commit 523c764
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ To use Ray's actor model:
ray.init()
@ray.remote
class Counter():
class Counter(object):
def __init__(self):
self.n = 0
Expand Down
2 changes: 1 addition & 1 deletion ci/performance_tests/test_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def no_op(*values):


@ray.remote
class Actor():
class Actor(object):
def ping(self, *values):
pass

Expand Down
2 changes: 1 addition & 1 deletion doc/examples/doc_code/tf_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def random_one_hot_labels(shape):
# Use GPU wth
# @ray.remote(num_gpus=1)
@ray.remote
class Network():
class Network(object):
def __init__(self):
self.model = create_keras_model()
self.dataset = np.random.random((1000, 32))
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/doc_code/torch_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def dataset_creators(use_cuda):
import torch.optim as optim


class Network():
class Network(object):
def __init__(self, lr=0.01, momentum=0.5):
use_cuda = torch.cuda.is_available()
self.device = device = torch.device("cuda" if use_cuda else "cpu")
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/plot_pong_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def rollout(model, env):
# given an input, which in our case is an observation.


class Model():
class Model(object):
"""This class holds the neural network weights."""

def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ To use Ray's actor model:
ray.init()
@ray.remote
class Counter():
class Counter(object):
def __init__(self):
self.n = 0
Expand Down
2 changes: 1 addition & 1 deletion python/ray/autoscaler/autoscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def log(self, statement):
logger.info(prefix + " {}".format(statement))


class ConcurrentCounter():
class ConcurrentCounter(object):
def __init__(self):
self._value = 0
self._lock = threading.Lock()
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():
class LogTimer(object):
def __init__(self, message):
self._message = message

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 @@ -9,7 +9,7 @@
@pytest.fixture(scope="session")
def start_target_actor(ray_instance):
@ray.remote
class Target():
class Target(object):
def __init__(self):
self.counter_value = 0

Expand Down
2 changes: 1 addition & 1 deletion python/ray/tune/log_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def log_sync_template():
).format(ssh_key=quote(ssh_key))


class NodeSyncMixin():
class NodeSyncMixin(object):
"""Mixin for syncing files to/from a remote dir to a local dir."""

def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion python/ray/tune/schedulers/hyperband.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def _unpause_trial(self, trial_runner, trial):
trial_runner.trial_executor.unpause_trial(trial)


class Bracket():
class Bracket(object):
"""Logical object for tracking Hyperband bracket progress. Keeps track
of proper parameters as designated by HyperBand.
Expand Down
2 changes: 1 addition & 1 deletion python/ray/tune/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from ray.tune.result import CONFIG_PREFIX


class Capturing():
class Capturing(object):
def __enter__(self):
self._stdout = sys.stdout
sys.stdout = self._stringio = StringIO()
Expand Down

0 comments on commit 523c764

Please sign in to comment.