We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
modin/pandas/test/test_io.py::TestCsv::test_read_csv_compression tests fail with numpy>1.20.3
### System information
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**:

Ubuntu 20.04.1 LTS

- **Modin version** (`modin.__version__`):

0.10.0+6.gf9c99c38

- **Python version**:

Python 3.8.6

- **Code we can use to reproduce**:

Update numpy to the latest version (currently 1.21.0) and run modin/pandas/test/test_io.py::TestCsv::test_read_csv_compression tests. When they are ran together, tests with python engine fail with exception.

```
Traceback (most recent call last):
  File "/localdisk/gashiman/modin/modin/pandas/test/utils.py", line 668, in execute_callable
    pd_result = fn(pandas_df, **pd_kwargs)
  File "/localdisk/gashiman/modin/modin/pandas/test/utils.py", line 756, in applyier
    result = getattr(module, fn_name)(*args, **kwargs)
  File "/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/pandas/io/parsers.py", line 610, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/pandas/io/parsers.py", line 468, in _read
    return parser.read(nrows)
  File "/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/pandas/io/parsers.py", line 1057, in read
    index, columns, col_dict = self._engine.read(nrows)
  File "/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/pandas/io/parsers.py", line 2502, in read
    data = self._convert_data(data)
  File "/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/pandas/io/parsers.py", line 2582, in _convert_data
    return self._convert_to_ndarrays(
  File "/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/pandas/io/parsers.py", line 1704, in _convert_to_ndarrays
    cvals, na_count = self._infer_types(
  File "/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/pandas/io/parsers.py", line 1765, in _infer_types
    na_count = isna(result).sum()
  File "/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/numpy/core/_methods.py", line 48, in _sum
    return umr_sum(a, axis, dtype, out, keepdims, initial, where)
TypeError: int() argument must be a string, a bytes-like object or a number, not '_NoValueType'
```

<!--
You can obtain the Modin version with

python -c "import modin; print(modin.__version__)"
-->

### Describe the problem
<!-- Describe the problem clearly here. -->

### Source code / logs
<!-- Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem. -->


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 from setuptools import setup, find_packages
2 import versioneer
3 import os
4 from setuptools.dist import Distribution
5 
6 try:
7     from wheel.bdist_wheel import bdist_wheel
8 
9     HAS_WHEEL = True
10 except ImportError:
11     HAS_WHEEL = False
12 
13 with open("README.md", "r", encoding="utf-8") as fh:
14     long_description = fh.read()
15 
16 if HAS_WHEEL:
17 
18     class ModinWheel(bdist_wheel):
19         def finalize_options(self):
20             bdist_wheel.finalize_options(self)
21             self.root_is_pure = False
22 
23         def get_tag(self):
24             _, _, plat = bdist_wheel.get_tag(self)
25             py = "py3"
26             abi = "none"
27             return py, abi, plat
28 
29 
30 class ModinDistribution(Distribution):
31     def __init__(self, *attrs):
32         Distribution.__init__(self, *attrs)
33         if HAS_WHEEL:
34             self.cmdclass["bdist_wheel"] = ModinWheel
35 
36     def is_pure(self):
37         return False
38 
39 
40 dask_deps = ["dask>=2.12.0,<=2.19.0", "distributed>=2.12.0,<=2.19.0"]
41 ray_deps = ["ray>=1.4.0", "pyarrow>=1.0"]
42 remote_deps = ["rpyc==4.1.5", "cloudpickle==1.4.1", "boto3==1.4.8"]
43 spreadsheet_deps = ["modin-spreadsheet>=0.1.0"]
44 sql_deps = ["dfsql>=0.2.6"]
45 all_deps = dask_deps + ray_deps + remote_deps + spreadsheet_deps
46 
47 # dfsql does not support Windows yet
48 if os.name != 'nt':
49     all_deps += sql_deps
50 
51 setup(
52     name="modin",
53     version=versioneer.get_version(),
54     cmdclass=versioneer.get_cmdclass(),
55     distclass=ModinDistribution,
56     description="Modin: Make your pandas code run faster by changing one line of code.",
57     packages=find_packages(),
58     include_package_data=True,
59     license="Apache 2",
60     url="https://github.com/modin-project/modin",
61     long_description=long_description,
62     long_description_content_type="text/markdown",
63     # Restrition for numpy upper version is because of #3182
64     install_requires=["pandas==1.2.5", "packaging", "numpy>=1.16.5,<=1.20.3"],
65     extras_require={
66         # can be installed by pip install modin[dask]
67         "dask": dask_deps,
68         "ray": ray_deps,
69         "remote": remote_deps,
70         "spreadsheet": spreadsheet_deps,
71         "sql": sql_deps,
72         "all": all_deps,
73     },
74     python_requires=">=3.7.1",
75 )
76
```

Path: `modin/experimental/pandas/numpy_wrap.py`
Content:
```
1 # Licensed to Modin Development Team under one or more contributor license agreements.
2 # See the NOTICE file distributed with this work for additional information regarding
3 # copyright ownership.  The Modin Development Team licenses this file to you under the
4 # Apache License, Version 2.0 (the "License"); you may not use this file except in
5 # compliance with the License.  You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software distributed under
10 # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11 # ANY KIND, either express or implied. See the License for the specific language
12 # governing permissions and limitations under the License.
13 
14 """
15 The module replaces real NumPy from future "import numpy" statements.
16 
17 Replacement occurs with a wrapping module that serves attributes from either
18 local or "remote" NumPy depending on active execution context.
19 """
20 
21 import sys
22 
23 _CAUGHT_NUMPY = "numpy" not in sys.modules
24 try:
25     import numpy as real_numpy
26 except ImportError:
27     pass
28 else:
29     import types
30     import copyreg
31     from modin.config import Engine
32     from modin.data_management.factories import REMOTE_ENGINES
33     import modin
34     import pandas
35     import os
36 
37     _EXCLUDE_MODULES = [modin, pandas]
38     try:
39         import rpyc
40     except ImportError:
41         pass
42     else:
43         _EXCLUDE_MODULES.append(rpyc)
44     _EXCLUDE_PATHS = tuple(
45         os.path.dirname(mod.__file__) + os.sep for mod in _EXCLUDE_MODULES
46     )
47 
48     class InterceptedNumpy(types.ModuleType):
49         """
50         The class is intended to replace the "numpy" module as seen by outer world.
51 
52         Replacement occurs by getting attributes from either local NumPy or remote one when remote context
53         is activated.
54         It also registers helpers for pickling local NumPy objects in remote context
55         and vice versa.
56 
57         Attributes
58         ----------
59         __own_attrs__ : set
60             Attributes that are defined in this class so access to them must never be proxied.
61         __current_numpy : ModuleType
62             The module to which getting NumPy attributes redirects. For example,
63             NumPy on remote machine.
64         __prev_numpy : ModuleType
65             The previous module that was accessed to get the NumPy attributes.
66         __has_to_warn : bool
67             Determines the situation when it is necessary to give a warning.
68         __reducers : dict
69             Custom routines that Pickle calls to serialize an instance of a class.
70         """
71 
72         __own_attrs__ = set(["__own_attrs__"])
73 
74         __spec__ = real_numpy.__spec__
75         __current_numpy = real_numpy
76         __prev_numpy = real_numpy
77         __has_to_warn = not _CAUGHT_NUMPY
78         __reducers = {}
79 
80         def __init__(self):
81             self.__own_attrs__ = set(type(self).__dict__.keys())
82             Engine.subscribe(self.__update_engine)
83 
84         def __swap_numpy(self, other_numpy=None):
85             self.__current_numpy, self.__prev_numpy = (
86                 other_numpy or self.__prev_numpy,
87                 self.__current_numpy,
88             )
89             if self.__current_numpy is not real_numpy and self.__has_to_warn:
90                 import warnings
91 
92                 warnings.warn(
93                     "Was not able to intercept all numpy imports. "
94                     "To intercept all of these please do 'import modin.experimental.pandas' as early as possible"
95                 )
96                 self.__has_to_warn = False
97 
98         def __update_engine(self, _):
99             if Engine.get() in REMOTE_ENGINES:
100                 from modin.experimental.cloud import get_connection
101 
102                 self.__swap_numpy(get_connection().modules["numpy"])
103             else:
104                 self.__swap_numpy()
105 
106         def __make_reducer(self, name):
107             """
108             Prepare a "reducer" routine - the one Pickle calls to serialize an instance of a class.
109 
110             Note that we need this to allow pickling a local numpy object in "remote numpy" context,
111             because without a custom reduce callback pickle complains that what it reduced has a
112             different "numpy" class than original.
113             """
114             try:
115                 reducer = self.__reducers[name]
116             except KeyError:
117 
118                 def reducer(
119                     obj,
120                     real_obj=getattr(real_numpy, name),
121                     real_obj_reducer=getattr(real_numpy, name).__reduce__,
122                 ):
123                     # See details on __reduce__ protocol in Python docs:
124                     # https://docs.python.org/3.6/library/pickle.html#object.__reduce__
125                     reduced = real_obj_reducer(obj)
126                     if not isinstance(reduced, tuple):
127                         return reduced
128                     assert isinstance(
129                         reduced[0],
130                         (type, types.FunctionType, types.BuiltinFunctionType),
131                     ), "Do not know how to support this reconstructor"
132 
133                     modobj = self.__current_numpy
134                     for submod in reduced[0].__module__.split(".")[1:]:
135                         modobj = getattr(modobj, submod)
136                     reconstruct = getattr(modobj, reduced[0].__name__)
137                     # TODO: see if replacing all "real numpy" things in reduced[1:] is needed
138                     return (reconstruct,) + reduced[1:]
139 
140                 self.__reducers[name] = reducer
141             return reducer
142 
143         def __get_numpy(self):
144             frame = sys._getframe()
145             try:
146                 # get the path to module where caller of caller is defined;
147                 # this function is expected to be called from one of
148                 # __getattr__, __setattr__ or __delattr__, so this
149                 # "caller_file" should point to the file that wants a
150                 # numpy attribute; we want to always give local numpy
151                 # to modin, numpy and rpyc as it's all internal for us
152                 caller_file = frame.f_back.f_back.f_code.co_filename
153             except AttributeError:
154                 return self.__current_numpy
155             finally:
156                 del frame
157             if any(caller_file.startswith(mod_path) for mod_path in _EXCLUDE_PATHS):
158                 return real_numpy
159             return self.__current_numpy
160 
161         def __getattr__(self, name):  # noqa: D105
162             # note that __getattr__ is not symmetric to __setattr__, as it is
163             # only called when an attribute is not found by usual lookups
164             obj = getattr(self.__get_numpy(), name)
165             if isinstance(obj, type):
166                 # register a special callback for pickling
167                 copyreg.pickle(obj, self.__make_reducer(name))
168             return obj
169 
170         def __setattr__(self, name, value):  # noqa: D105
171             # set our own attributes on the self instance, but pass through
172             # setting other attributes to numpy being wrapped
173             if name in self.__own_attrs__:
174                 super().__setattr__(name, value)
175             else:
176                 setattr(self.__get_numpy(), name, value)
177 
178         def __delattr__(self, name):  # noqa: D105
179             # do not allow to delete our own attributes, pass through
180             # deletion of others to numpy being wrapped
181             if name not in self.__own_attrs__:
182                 delattr(self.__get_numpy(), name)
183 
184     sys.modules["numpy"] = InterceptedNumpy()
185
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/modin/experimental/pandas/numpy_wrap.py b/modin/experimental/pandas/numpy_wrap.py
--- a/modin/experimental/pandas/numpy_wrap.py
+++ b/modin/experimental/pandas/numpy_wrap.py
@@ -34,7 +34,7 @@
     import pandas
     import os
 
-    _EXCLUDE_MODULES = [modin, pandas]
+    _EXCLUDE_MODULES = [modin, pandas, real_numpy]
     try:
         import rpyc
     except ImportError:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -60,8 +60,7 @@
     url="https://github.com/modin-project/modin",
     long_description=long_description,
     long_description_content_type="text/markdown",
-    # Restrition for numpy upper version is because of #3182
-    install_requires=["pandas==1.2.5", "packaging", "numpy>=1.16.5,<=1.20.3"],
+    install_requires=["pandas==1.2.5", "packaging", "numpy>=1.16.5"],
     extras_require={
         # can be installed by pip install modin[dask]
         "dask": dask_deps,

{"golden_diff": "diff --git a/modin/experimental/pandas/numpy_wrap.py b/modin/experimental/pandas/numpy_wrap.py\n--- a/modin/experimental/pandas/numpy_wrap.py\n+++ b/modin/experimental/pandas/numpy_wrap.py\n@@ -34,7 +34,7 @@\n     import pandas\n     import os\n \n-    _EXCLUDE_MODULES = [modin, pandas]\n+    _EXCLUDE_MODULES = [modin, pandas, real_numpy]\n     try:\n         import rpyc\n     except ImportError:\ndiff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -60,8 +60,7 @@\n     url=\"https://github.com/modin-project/modin\",\n     long_description=long_description,\n     long_description_content_type=\"text/markdown\",\n-    # Restrition for numpy upper version is because of #3182\n-    install_requires=[\"pandas==1.2.5\", \"packaging\", \"numpy>=1.16.5,<=1.20.3\"],\n+    install_requires=[\"pandas==1.2.5\", \"packaging\", \"numpy>=1.16.5\"],\n     extras_require={\n         # can be installed by pip install modin[dask]\n         \"dask\": dask_deps,\n", "issue": "modin/pandas/test/test_io.py::TestCsv::test_read_csv_compression tests fail with numpy>1.20.3\n### System information\r\n- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**:\r\n\r\nUbuntu 20.04.1 LTS\r\n\r\n- **Modin version** (`modin.__version__`):\r\n\r\n0.10.0+6.gf9c99c38\r\n\r\n- **Python version**:\r\n\r\nPython 3.8.6\r\n\r\n- **Code we can use to reproduce**:\r\n\r\nUpdate numpy to the latest version (currently 1.21.0) and run modin/pandas/test/test_io.py::TestCsv::test_read_csv_compression tests. When they are ran together, tests with python engine fail with exception.\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/localdisk/gashiman/modin/modin/pandas/test/utils.py\", line 668, in execute_callable\r\n    pd_result = fn(pandas_df, **pd_kwargs)\r\n  File \"/localdisk/gashiman/modin/modin/pandas/test/utils.py\", line 756, in applyier\r\n    result = getattr(module, fn_name)(*args, **kwargs)\r\n  File \"/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/pandas/io/parsers.py\", line 610, in read_csv\r\n    return _read(filepath_or_buffer, kwds)\r\n  File \"/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/pandas/io/parsers.py\", line 468, in _read\r\n    return parser.read(nrows)\r\n  File \"/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/pandas/io/parsers.py\", line 1057, in read\r\n    index, columns, col_dict = self._engine.read(nrows)\r\n  File \"/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/pandas/io/parsers.py\", line 2502, in read\r\n    data = self._convert_data(data)\r\n  File \"/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/pandas/io/parsers.py\", line 2582, in _convert_data\r\n    return self._convert_to_ndarrays(\r\n  File \"/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/pandas/io/parsers.py\", line 1704, in _convert_to_ndarrays\r\n    cvals, na_count = self._infer_types(\r\n  File \"/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/pandas/io/parsers.py\", line 1765, in _infer_types\r\n    na_count = isna(result).sum()\r\n  File \"/localdisk/gashiman/miniconda3/envs/modin/lib/python3.8/site-packages/numpy/core/_methods.py\", line 48, in _sum\r\n    return umr_sum(a, axis, dtype, out, keepdims, initial, where)\r\nTypeError: int() argument must be a string, a bytes-like object or a number, not '_NoValueType'\r\n```\r\n\r\n<!--\r\nYou can obtain the Modin version with\r\n\r\npython -c \"import modin; print(modin.__version__)\"\r\n-->\r\n\r\n### Describe the problem\r\n<!-- Describe the problem clearly here. -->\r\n\r\n### Source code / logs\r\n<!-- Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem. -->\r\n\n", "before_files": [{"content": "from setuptools import setup, find_packages\nimport versioneer\nimport os\nfrom setuptools.dist import Distribution\n\ntry:\n    from wheel.bdist_wheel import bdist_wheel\n\n    HAS_WHEEL = True\nexcept ImportError:\n    HAS_WHEEL = False\n\nwith open(\"README.md\", \"r\", encoding=\"utf-8\") as fh:\n    long_description = fh.read()\n\nif HAS_WHEEL:\n\n    class ModinWheel(bdist_wheel):\n        def finalize_options(self):\n            bdist_wheel.finalize_options(self)\n            self.root_is_pure = False\n\n        def get_tag(self):\n            _, _, plat = bdist_wheel.get_tag(self)\n            py = \"py3\"\n            abi = \"none\"\n            return py, abi, plat\n\n\nclass ModinDistribution(Distribution):\n    def __init__(self, *attrs):\n        Distribution.__init__(self, *attrs)\n        if HAS_WHEEL:\n            self.cmdclass[\"bdist_wheel\"] = ModinWheel\n\n    def is_pure(self):\n        return False\n\n\ndask_deps = [\"dask>=2.12.0,<=2.19.0\", \"distributed>=2.12.0,<=2.19.0\"]\nray_deps = [\"ray>=1.4.0\", \"pyarrow>=1.0\"]\nremote_deps = [\"rpyc==4.1.5\", \"cloudpickle==1.4.1\", \"boto3==1.4.8\"]\nspreadsheet_deps = [\"modin-spreadsheet>=0.1.0\"]\nsql_deps = [\"dfsql>=0.2.6\"]\nall_deps = dask_deps + ray_deps + remote_deps + spreadsheet_deps\n\n# dfsql does not support Windows yet\nif os.name != 'nt':\n    all_deps += sql_deps\n\nsetup(\n    name=\"modin\",\n    version=versioneer.get_version(),\n    cmdclass=versioneer.get_cmdclass(),\n    distclass=ModinDistribution,\n    description=\"Modin: Make your pandas code run faster by changing one line of code.\",\n    packages=find_packages(),\n    include_package_data=True,\n    license=\"Apache 2\",\n    url=\"https://github.com/modin-project/modin\",\n    long_description=long_description,\n    long_description_content_type=\"text/markdown\",\n    # Restrition for numpy upper version is because of #3182\n    install_requires=[\"pandas==1.2.5\", \"packaging\", \"numpy>=1.16.5,<=1.20.3\"],\n    extras_require={\n        # can be installed by pip install modin[dask]\n        \"dask\": dask_deps,\n        \"ray\": ray_deps,\n        \"remote\": remote_deps,\n        \"spreadsheet\": spreadsheet_deps,\n        \"sql\": sql_deps,\n        \"all\": all_deps,\n    },\n    python_requires=\">=3.7.1\",\n)\n", "path": "setup.py"}, {"content": "# Licensed to Modin Development Team under one or more contributor license agreements.\n# See the NOTICE file distributed with this work for additional information regarding\n# copyright ownership.  The Modin Development Team licenses this file to you under the\n# Apache License, Version 2.0 (the \"License\"); you may not use this file except in\n# compliance with the License.  You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software distributed under\n# the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n# ANY KIND, either express or implied. See the License for the specific language\n# governing permissions and limitations under the License.\n\n\"\"\"\nThe module replaces real NumPy from future \"import numpy\" statements.\n\nReplacement occurs with a wrapping module that serves attributes from either\nlocal or \"remote\" NumPy depending on active execution context.\n\"\"\"\n\nimport sys\n\n_CAUGHT_NUMPY = \"numpy\" not in sys.modules\ntry:\n    import numpy as real_numpy\nexcept ImportError:\n    pass\nelse:\n    import types\n    import copyreg\n    from modin.config import Engine\n    from modin.data_management.factories import REMOTE_ENGINES\n    import modin\n    import pandas\n    import os\n\n    _EXCLUDE_MODULES = [modin, pandas]\n    try:\n        import rpyc\n    except ImportError:\n        pass\n    else:\n        _EXCLUDE_MODULES.append(rpyc)\n    _EXCLUDE_PATHS = tuple(\n        os.path.dirname(mod.__file__) + os.sep for mod in _EXCLUDE_MODULES\n    )\n\n    class InterceptedNumpy(types.ModuleType):\n        \"\"\"\n        The class is intended to replace the \"numpy\" module as seen by outer world.\n\n        Replacement occurs by getting attributes from either local NumPy or remote one when remote context\n        is activated.\n        It also registers helpers for pickling local NumPy objects in remote context\n        and vice versa.\n\n        Attributes\n        ----------\n        __own_attrs__ : set\n            Attributes that are defined in this class so access to them must never be proxied.\n        __current_numpy : ModuleType\n            The module to which getting NumPy attributes redirects. For example,\n            NumPy on remote machine.\n        __prev_numpy : ModuleType\n            The previous module that was accessed to get the NumPy attributes.\n        __has_to_warn : bool\n            Determines the situation when it is necessary to give a warning.\n        __reducers : dict\n            Custom routines that Pickle calls to serialize an instance of a class.\n        \"\"\"\n\n        __own_attrs__ = set([\"__own_attrs__\"])\n\n        __spec__ = real_numpy.__spec__\n        __current_numpy = real_numpy\n        __prev_numpy = real_numpy\n        __has_to_warn = not _CAUGHT_NUMPY\n        __reducers = {}\n\n        def __init__(self):\n            self.__own_attrs__ = set(type(self).__dict__.keys())\n            Engine.subscribe(self.__update_engine)\n\n        def __swap_numpy(self, other_numpy=None):\n            self.__current_numpy, self.__prev_numpy = (\n                other_numpy or self.__prev_numpy,\n                self.__current_numpy,\n            )\n            if self.__current_numpy is not real_numpy and self.__has_to_warn:\n                import warnings\n\n                warnings.warn(\n                    \"Was not able to intercept all numpy imports. \"\n                    \"To intercept all of these please do 'import modin.experimental.pandas' as early as possible\"\n                )\n                self.__has_to_warn = False\n\n        def __update_engine(self, _):\n            if Engine.get() in REMOTE_ENGINES:\n                from modin.experimental.cloud import get_connection\n\n                self.__swap_numpy(get_connection().modules[\"numpy\"])\n            else:\n                self.__swap_numpy()\n\n        def __make_reducer(self, name):\n            \"\"\"\n            Prepare a \"reducer\" routine - the one Pickle calls to serialize an instance of a class.\n\n            Note that we need this to allow pickling a local numpy object in \"remote numpy\" context,\n            because without a custom reduce callback pickle complains that what it reduced has a\n            different \"numpy\" class than original.\n            \"\"\"\n            try:\n                reducer = self.__reducers[name]\n            except KeyError:\n\n                def reducer(\n                    obj,\n                    real_obj=getattr(real_numpy, name),\n                    real_obj_reducer=getattr(real_numpy, name).__reduce__,\n                ):\n                    # See details on __reduce__ protocol in Python docs:\n                    # https://docs.python.org/3.6/library/pickle.html#object.__reduce__\n                    reduced = real_obj_reducer(obj)\n                    if not isinstance(reduced, tuple):\n                        return reduced\n                    assert isinstance(\n                        reduced[0],\n                        (type, types.FunctionType, types.BuiltinFunctionType),\n                    ), \"Do not know how to support this reconstructor\"\n\n                    modobj = self.__current_numpy\n                    for submod in reduced[0].__module__.split(\".\")[1:]:\n                        modobj = getattr(modobj, submod)\n                    reconstruct = getattr(modobj, reduced[0].__name__)\n                    # TODO: see if replacing all \"real numpy\" things in reduced[1:] is needed\n                    return (reconstruct,) + reduced[1:]\n\n                self.__reducers[name] = reducer\n            return reducer\n\n        def __get_numpy(self):\n            frame = sys._getframe()\n            try:\n                # get the path to module where caller of caller is defined;\n                # this function is expected to be called from one of\n                # __getattr__, __setattr__ or __delattr__, so this\n                # \"caller_file\" should point to the file that wants a\n                # numpy attribute; we want to always give local numpy\n                # to modin, numpy and rpyc as it's all internal for us\n                caller_file = frame.f_back.f_back.f_code.co_filename\n            except AttributeError:\n                return self.__current_numpy\n            finally:\n                del frame\n            if any(caller_file.startswith(mod_path) for mod_path in _EXCLUDE_PATHS):\n                return real_numpy\n            return self.__current_numpy\n\n        def __getattr__(self, name):  # noqa: D105\n            # note that __getattr__ is not symmetric to __setattr__, as it is\n            # only called when an attribute is not found by usual lookups\n            obj = getattr(self.__get_numpy(), name)\n            if isinstance(obj, type):\n                # register a special callback for pickling\n                copyreg.pickle(obj, self.__make_reducer(name))\n            return obj\n\n        def __setattr__(self, name, value):  # noqa: D105\n            # set our own attributes on the self instance, but pass through\n            # setting other attributes to numpy being wrapped\n            if name in self.__own_attrs__:\n                super().__setattr__(name, value)\n            else:\n                setattr(self.__get_numpy(), name, value)\n\n        def __delattr__(self, name):  # noqa: D105\n            # do not allow to delete our own attributes, pass through\n            # deletion of others to numpy being wrapped\n            if name not in self.__own_attrs__:\n                delattr(self.__get_numpy(), name)\n\n    sys.modules[\"numpy\"] = InterceptedNumpy()\n", "path": "modin/experimental/pandas/numpy_wrap.py"}], "after_files": [{"content": "from setuptools import setup, find_packages\nimport versioneer\nimport os\nfrom setuptools.dist import Distribution\n\ntry:\n    from wheel.bdist_wheel import bdist_wheel\n\n    HAS_WHEEL = True\nexcept ImportError:\n    HAS_WHEEL = False\n\nwith open(\"README.md\", \"r\", encoding=\"utf-8\") as fh:\n    long_description = fh.read()\n\nif HAS_WHEEL:\n\n    class ModinWheel(bdist_wheel):\n        def finalize_options(self):\n            bdist_wheel.finalize_options(self)\n            self.root_is_pure = False\n\n        def get_tag(self):\n            _, _, plat = bdist_wheel.get_tag(self)\n            py = \"py3\"\n            abi = \"none\"\n            return py, abi, plat\n\n\nclass ModinDistribution(Distribution):\n    def __init__(self, *attrs):\n        Distribution.__init__(self, *attrs)\n        if HAS_WHEEL:\n            self.cmdclass[\"bdist_wheel\"] = ModinWheel\n\n    def is_pure(self):\n        return False\n\n\ndask_deps = [\"dask>=2.12.0,<=2.19.0\", \"distributed>=2.12.0,<=2.19.0\"]\nray_deps = [\"ray>=1.4.0\", \"pyarrow>=1.0\"]\nremote_deps = [\"rpyc==4.1.5\", \"cloudpickle==1.4.1\", \"boto3==1.4.8\"]\nspreadsheet_deps = [\"modin-spreadsheet>=0.1.0\"]\nsql_deps = [\"dfsql>=0.2.6\"]\nall_deps = dask_deps + ray_deps + remote_deps + spreadsheet_deps\n\n# dfsql does not support Windows yet\nif os.name != 'nt':\n    all_deps += sql_deps\n\nsetup(\n    name=\"modin\",\n    version=versioneer.get_version(),\n    cmdclass=versioneer.get_cmdclass(),\n    distclass=ModinDistribution,\n    description=\"Modin: Make your pandas code run faster by changing one line of code.\",\n    packages=find_packages(),\n    include_package_data=True,\n    license=\"Apache 2\",\n    url=\"https://github.com/modin-project/modin\",\n    long_description=long_description,\n    long_description_content_type=\"text/markdown\",\n    install_requires=[\"pandas==1.2.5\", \"packaging\", \"numpy>=1.16.5\"],\n    extras_require={\n        # can be installed by pip install modin[dask]\n        \"dask\": dask_deps,\n        \"ray\": ray_deps,\n        \"remote\": remote_deps,\n        \"spreadsheet\": spreadsheet_deps,\n        \"sql\": sql_deps,\n        \"all\": all_deps,\n    },\n    python_requires=\">=3.7.1\",\n)\n", "path": "setup.py"}, {"content": "# Licensed to Modin Development Team under one or more contributor license agreements.\n# See the NOTICE file distributed with this work for additional information regarding\n# copyright ownership.  The Modin Development Team licenses this file to you under the\n# Apache License, Version 2.0 (the \"License\"); you may not use this file except in\n# compliance with the License.  You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software distributed under\n# the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n# ANY KIND, either express or implied. See the License for the specific language\n# governing permissions and limitations under the License.\n\n\"\"\"\nThe module replaces real NumPy from future \"import numpy\" statements.\n\nReplacement occurs with a wrapping module that serves attributes from either\nlocal or \"remote\" NumPy depending on active execution context.\n\"\"\"\n\nimport sys\n\n_CAUGHT_NUMPY = \"numpy\" not in sys.modules\ntry:\n    import numpy as real_numpy\nexcept ImportError:\n    pass\nelse:\n    import types\n    import copyreg\n    from modin.config import Engine\n    from modin.data_management.factories import REMOTE_ENGINES\n    import modin\n    import pandas\n    import os\n\n    _EXCLUDE_MODULES = [modin, pandas, real_numpy]\n    try:\n        import rpyc\n    except ImportError:\n        pass\n    else:\n        _EXCLUDE_MODULES.append(rpyc)\n    _EXCLUDE_PATHS = tuple(\n        os.path.dirname(mod.__file__) + os.sep for mod in _EXCLUDE_MODULES\n    )\n\n    class InterceptedNumpy(types.ModuleType):\n        \"\"\"\n        The class is intended to replace the \"numpy\" module as seen by outer world.\n\n        Replacement occurs by getting attributes from either local NumPy or remote one when remote context\n        is activated.\n        It also registers helpers for pickling local NumPy objects in remote context\n        and vice versa.\n\n        Attributes\n        ----------\n        __own_attrs__ : set\n            Attributes that are defined in this class so access to them must never be proxied.\n        __current_numpy : ModuleType\n            The module to which getting NumPy attributes redirects. For example,\n            NumPy on remote machine.\n        __prev_numpy : ModuleType\n            The previous module that was accessed to get the NumPy attributes.\n        __has_to_warn : bool\n            Determines the situation when it is necessary to give a warning.\n        __reducers : dict\n            Custom routines that Pickle calls to serialize an instance of a class.\n        \"\"\"\n\n        __own_attrs__ = set([\"__own_attrs__\"])\n\n        __spec__ = real_numpy.__spec__\n        __current_numpy = real_numpy\n        __prev_numpy = real_numpy\n        __has_to_warn = not _CAUGHT_NUMPY\n        __reducers = {}\n\n        def __init__(self):\n            self.__own_attrs__ = set(type(self).__dict__.keys())\n            Engine.subscribe(self.__update_engine)\n\n        def __swap_numpy(self, other_numpy=None):\n            self.__current_numpy, self.__prev_numpy = (\n                other_numpy or self.__prev_numpy,\n                self.__current_numpy,\n            )\n            if self.__current_numpy is not real_numpy and self.__has_to_warn:\n                import warnings\n\n                warnings.warn(\n                    \"Was not able to intercept all numpy imports. \"\n                    \"To intercept all of these please do 'import modin.experimental.pandas' as early as possible\"\n                )\n                self.__has_to_warn = False\n\n        def __update_engine(self, _):\n            if Engine.get() in REMOTE_ENGINES:\n                from modin.experimental.cloud import get_connection\n\n                self.__swap_numpy(get_connection().modules[\"numpy\"])\n            else:\n                self.__swap_numpy()\n\n        def __make_reducer(self, name):\n            \"\"\"\n            Prepare a \"reducer\" routine - the one Pickle calls to serialize an instance of a class.\n\n            Note that we need this to allow pickling a local numpy object in \"remote numpy\" context,\n            because without a custom reduce callback pickle complains that what it reduced has a\n            different \"numpy\" class than original.\n            \"\"\"\n            try:\n                reducer = self.__reducers[name]\n            except KeyError:\n\n                def reducer(\n                    obj,\n                    real_obj=getattr(real_numpy, name),\n                    real_obj_reducer=getattr(real_numpy, name).__reduce__,\n                ):\n                    # See details on __reduce__ protocol in Python docs:\n                    # https://docs.python.org/3.6/library/pickle.html#object.__reduce__\n                    reduced = real_obj_reducer(obj)\n                    if not isinstance(reduced, tuple):\n                        return reduced\n                    assert isinstance(\n                        reduced[0],\n                        (type, types.FunctionType, types.BuiltinFunctionType),\n                    ), \"Do not know how to support this reconstructor\"\n\n                    modobj = self.__current_numpy\n                    for submod in reduced[0].__module__.split(\".\")[1:]:\n                        modobj = getattr(modobj, submod)\n                    reconstruct = getattr(modobj, reduced[0].__name__)\n                    # TODO: see if replacing all \"real numpy\" things in reduced[1:] is needed\n                    return (reconstruct,) + reduced[1:]\n\n                self.__reducers[name] = reducer\n            return reducer\n\n        def __get_numpy(self):\n            frame = sys._getframe()\n            try:\n                # get the path to module where caller of caller is defined;\n                # this function is expected to be called from one of\n                # __getattr__, __setattr__ or __delattr__, so this\n                # \"caller_file\" should point to the file that wants a\n                # numpy attribute; we want to always give local numpy\n                # to modin, numpy and rpyc as it's all internal for us\n                caller_file = frame.f_back.f_back.f_code.co_filename\n            except AttributeError:\n                return self.__current_numpy\n            finally:\n                del frame\n            if any(caller_file.startswith(mod_path) for mod_path in _EXCLUDE_PATHS):\n                return real_numpy\n            return self.__current_numpy\n\n        def __getattr__(self, name):  # noqa: D105\n            # note that __getattr__ is not symmetric to __setattr__, as it is\n            # only called when an attribute is not found by usual lookups\n            obj = getattr(self.__get_numpy(), name)\n            if isinstance(obj, type):\n                # register a special callback for pickling\n                copyreg.pickle(obj, self.__make_reducer(name))\n            return obj\n\n        def __setattr__(self, name, value):  # noqa: D105\n            # set our own attributes on the self instance, but pass through\n            # setting other attributes to numpy being wrapped\n            if name in self.__own_attrs__:\n                super().__setattr__(name, value)\n            else:\n                setattr(self.__get_numpy(), name, value)\n\n        def __delattr__(self, name):  # noqa: D105\n            # do not allow to delete our own attributes, pass through\n            # deletion of others to numpy being wrapped\n            if name not in self.__own_attrs__:\n                delattr(self.__get_numpy(), name)\n\n    sys.modules[\"numpy\"] = InterceptedNumpy()\n", "path": "modin/experimental/pandas/numpy_wrap.py"}]}