mirror of
https://github.com/wassname/ray.git
synced 2026-06-30 15:00:17 +08:00
Remove typing module.
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ import shlex
|
||||
|
||||
# These 4 lines added to enable ReadTheDocs to work.
|
||||
import mock
|
||||
MOCK_MODULES = ["libraylib", "IPython", "numpy", "typing", "funcsigs", "subprocess32", "protobuf", "colorama", "graphviz", "cloudpickle", "ray.internal.graph_pb2"]
|
||||
MOCK_MODULES = ["libraylib", "IPython", "numpy", "funcsigs", "subprocess32", "protobuf", "colorama", "graphviz", "cloudpickle", "ray.internal.graph_pb2"]
|
||||
for mod_name in MOCK_MODULES:
|
||||
sys.modules[mod_name] = mock.Mock()
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ brew update
|
||||
brew install git cmake automake autoconf libtool boost graphviz
|
||||
sudo easy_install pip
|
||||
sudo pip install ipython --user
|
||||
sudo pip install numpy typing funcsigs subprocess32 protobuf colorama graphviz cloudpickle --ignore-installed six
|
||||
sudo pip install numpy funcsigs subprocess32 protobuf colorama graphviz cloudpickle --ignore-installed six
|
||||
```
|
||||
|
||||
## Build
|
||||
|
||||
@@ -15,7 +15,7 @@ First install the dependencies. We currently do not support Python 3.
|
||||
```
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y git cmake build-essential autoconf curl libtool python-dev python-numpy python-pip libboost-all-dev unzip graphviz
|
||||
sudo pip install ipython typing funcsigs subprocess32 protobuf colorama graphviz cloudpickle
|
||||
sudo pip install ipython funcsigs subprocess32 protobuf colorama graphviz cloudpickle
|
||||
```
|
||||
|
||||
## Build
|
||||
|
||||
@@ -6,7 +6,7 @@ RUN apt-get update
|
||||
RUN apt-get -y install apt-utils
|
||||
RUN apt-get -y install sudo
|
||||
RUN apt-get install -y git cmake build-essential autoconf curl libtool python-dev python-numpy python-pip libboost-all-dev unzip graphviz
|
||||
RUN pip install ipython typing funcsigs subprocess32 protobuf colorama graphviz cloudpickle
|
||||
RUN pip install ipython funcsigs subprocess32 protobuf colorama graphviz cloudpickle
|
||||
RUN adduser --gecos --ingroup ray-user --disabled-login --gecos ray-user
|
||||
RUN adduser ray-user sudo
|
||||
RUN sed -i "s|%sudo\tALL=(ALL:ALL) ALL|%sudo\tALL=NOPASSWD: ALL|" /etc/sudoers
|
||||
|
||||
@@ -6,7 +6,7 @@ RUN apt-get update
|
||||
RUN apt-get -y install apt-utils
|
||||
RUN apt-get -y install sudo
|
||||
RUN apt-get install -y git cmake build-essential autoconf curl libtool python-dev python-numpy python-pip libboost-all-dev unzip graphviz
|
||||
RUN pip install ipython typing funcsigs subprocess32 protobuf colorama graphviz cloudpickle
|
||||
RUN pip install ipython funcsigs subprocess32 protobuf colorama graphviz cloudpickle
|
||||
RUN adduser --gecos --ingroup ray-user --disabled-login --gecos ray-user --uid 500
|
||||
RUN adduser ray-user sudo
|
||||
RUN sed -i "s|%sudo\tALL=(ALL:ALL) ALL|%sudo\tALL=NOPASSWD: ALL|" /etc/sudoers
|
||||
|
||||
@@ -7,7 +7,7 @@ RUN apt-get update
|
||||
RUN apt-get -y install apt-utils
|
||||
RUN apt-get -y install sudo
|
||||
RUN apt-get install -y git cmake build-essential autoconf curl libtool python-dev python-numpy python-pip libboost-all-dev unzip graphviz
|
||||
RUN pip install ipython typing funcsigs subprocess32 protobuf colorama graphviz cloudpickle
|
||||
RUN pip install ipython funcsigs subprocess32 protobuf colorama graphviz cloudpickle
|
||||
RUN adduser --gecos --ingroup ray-user --disabled-login --gecos ray-user
|
||||
RUN adduser ray-user sudo
|
||||
RUN sed -i "s|%sudo\tALL=(ALL:ALL) ALL|%sudo\tALL=NOPASSWD: ALL|" /etc/sudoers
|
||||
|
||||
@@ -7,7 +7,6 @@ import tarfile, io
|
||||
import boto3
|
||||
import PIL.Image as Image
|
||||
import tensorflow as tf
|
||||
from typing import List, Tuple
|
||||
|
||||
import ray.array.remote as ra
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ if [[ $platform == "linux" ]]; then
|
||||
# These commands must be kept in sync with the installation instructions.
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y git cmake build-essential autoconf curl libtool python-dev python-numpy python-pip libboost-all-dev unzip graphviz
|
||||
sudo pip install ipython typing funcsigs subprocess32 protobuf colorama graphviz cloudpickle
|
||||
sudo pip install ipython funcsigs subprocess32 protobuf colorama graphviz cloudpickle
|
||||
elif [[ $platform == "macosx" ]]; then
|
||||
# These commands must be kept in sync with the installation instructions.
|
||||
brew install git cmake automake autoconf libtool boost graphviz
|
||||
sudo easy_install pip
|
||||
sudo pip install ipython --user
|
||||
sudo pip install numpy typing funcsigs subprocess32 protobuf colorama graphviz cloudpickle --ignore-installed six
|
||||
sudo pip install numpy funcsigs subprocess32 protobuf colorama graphviz cloudpickle --ignore-installed six
|
||||
fi
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from typing import List
|
||||
import numpy as np
|
||||
import ray.array.remote as ra
|
||||
import ray
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from typing import List
|
||||
|
||||
import numpy as np
|
||||
import ray.array.remote as ra
|
||||
import ray
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from typing import List, Any
|
||||
import numpy as np
|
||||
import ray
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from typing import List
|
||||
import numpy as np
|
||||
import ray
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from typing import List
|
||||
import numpy as np
|
||||
import ray
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Note that a little bit of code here is taken and slightly modified from the pickler because it was not possible to change its behavior otherwise.
|
||||
|
||||
import sys
|
||||
import typing
|
||||
from ctypes import c_void_p
|
||||
from cloudpickle import pickle, cloudpickle, CloudPickler, load, loads
|
||||
|
||||
@@ -38,9 +37,6 @@ def _fill_function(func, globals, defaults, closure, dict):
|
||||
pythonapi.PyCell_Set(c_void_p(id(result.__closure__[i])), c_void_p(id(v)))
|
||||
return result
|
||||
|
||||
def _create_type(type_repr):
|
||||
return eval(type_repr.replace("~", ""), None, (lambda d: d.setdefault("typing", typing) and None or d)(dict(typing.__dict__)))
|
||||
|
||||
class BetterPickler(CloudPickler):
|
||||
def save_function_tuple(self, func):
|
||||
code, f_globals, defaults, closure, dct, base_globals = self.extract_func_data(func)
|
||||
@@ -63,10 +59,5 @@ class BetterPickler(CloudPickler):
|
||||
self.save(cloudpickle._make_cell)
|
||||
self.save((obj.cell_contents,))
|
||||
self.write(pickle.REDUCE)
|
||||
def save_type(self, obj):
|
||||
self.save(_create_type)
|
||||
self.save((repr(obj),))
|
||||
self.write(pickle.REDUCE)
|
||||
dispatch = CloudPickler.dispatch.copy()
|
||||
dispatch[(lambda _: lambda: _)(0).__closure__[0].__class__] = save_cell
|
||||
# dispatch[typing.GenericMeta] = save_type
|
||||
|
||||
@@ -4,7 +4,6 @@ import time
|
||||
import traceback
|
||||
import copy
|
||||
import logging
|
||||
import typing
|
||||
import funcsigs
|
||||
import numpy as np
|
||||
import colorama
|
||||
@@ -192,13 +191,13 @@ class Reusable(object):
|
||||
|
||||
def __init__(self, initializer, reinitializer=None):
|
||||
"""Initialize a Reusable object."""
|
||||
if not isinstance(initializer, typing.Callable):
|
||||
if not callable(initializer):
|
||||
raise Exception("When creating a RayReusable, initializer must be a function.")
|
||||
self.initializer = initializer
|
||||
if reinitializer is None:
|
||||
# If no reinitializer is passed in, use a wrapped version of the initializer.
|
||||
reinitializer = lambda value: initializer()
|
||||
if not isinstance(reinitializer, typing.Callable):
|
||||
if not callable(reinitializer):
|
||||
raise Exception("When creating a RayReusable, reinitializer must be a function.")
|
||||
self.reinitializer = reinitializer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user