From 078c0928712324a1f0bfab965a2eaa97fe805e28 Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Fri, 12 Jan 2024 05:42:57 -0800 Subject: [PATCH 01/10] Make intermediate proxy types picklable --- python/cudf/cudf/core/_internals/where.py | 2 +- python/cudf/cudf/pandas/fast_slow_proxy.py | 52 ++++++++++++------- python/cudf/cudf/testing/testing.py | 2 +- .../cudf_pandas_tests/test_cudf_pandas.py | 8 +++ 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/python/cudf/cudf/core/_internals/where.py b/python/cudf/cudf/core/_internals/where.py index ef6b10f66c1..2f7827521a0 100644 --- a/python/cudf/cudf/core/_internals/where.py +++ b/python/cudf/cudf/core/_internals/where.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023, NVIDIA CORPORATION. +# Copyright (c) 2021-2024, NVIDIA CORPORATION. import warnings from typing import Tuple, Union diff --git a/python/cudf/cudf/pandas/fast_slow_proxy.py b/python/cudf/cudf/pandas/fast_slow_proxy.py index 3dc6a59cc16..59095f45a75 100644 --- a/python/cudf/cudf/pandas/fast_slow_proxy.py +++ b/python/cudf/cudf/pandas/fast_slow_proxy.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +# SPDX-FileCopyrightText: Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. # All rights reserved. # SPDX-License-Identifier: Apache-2.0 @@ -95,6 +95,24 @@ def __call__(self): return object.__new__(self._type) +def __proxy_reduce__(self): + # Need a local import to avoid circular import issues + from .module_accelerator import disable_module_accelerator + + with disable_module_accelerator(): + pickled_wrapped_obj = pickle.dumps(self._fsproxy_wrapped) + return (_PickleConstructor(type(self)), (), pickled_wrapped_obj) + + +def __proxy_setstate__(self, state): + # Need a local import to avoid circular import issues + from .module_accelerator import disable_module_accelerator + + with disable_module_accelerator(): + unpickled_wrapped_obj = pickle.loads(state) + self._fsproxy_wrapped = unpickled_wrapped_obj + + _DELETE = object() @@ -109,6 +127,7 @@ def make_final_proxy_type( additional_attributes: Mapping[str, Any] | None = None, postprocess: Callable[[_FinalProxy, Any, Any], Any] | None = None, bases: Tuple = (), + picklable: bool = True, ) -> Type[_FinalProxy]: """ Defines a fast-slow proxy type for a pair of "final" fast and slow @@ -139,7 +158,8 @@ def make_final_proxy_type( construct said unwrapped object. See also `_maybe_wrap_result`. bases Optional tuple of base classes to insert into the mro. - + picklable: bool + Whether or not the proxy object should be picklable Notes ----- As a side-effect, this function adds `fast_type` and `slow_type` @@ -189,22 +209,6 @@ def _fsproxy_state(self) -> _State: else _State.SLOW ) - def __reduce__(self): - # Need a local import to avoid circular import issues - from .module_accelerator import disable_module_accelerator - - with disable_module_accelerator(): - pickled_wrapped_obj = pickle.dumps(self._fsproxy_wrapped) - return (_PickleConstructor(type(self)), (), pickled_wrapped_obj) - - def __setstate__(self, state): - # Need a local import to avoid circular import issues - from .module_accelerator import disable_module_accelerator - - with disable_module_accelerator(): - unpickled_wrapped_obj = pickle.loads(state) - self._fsproxy_wrapped = unpickled_wrapped_obj - slow_dir = dir(slow_type) cls_dict = { "__init__": __init__, @@ -215,9 +219,11 @@ def __setstate__(self, state): "_fsproxy_slow_to_fast": _fsproxy_slow_to_fast, "_fsproxy_fast_to_slow": _fsproxy_fast_to_slow, "_fsproxy_state": _fsproxy_state, - "__reduce__": __reduce__, - "__setstate__": __setstate__, } + if picklable: + cls_dict["__reduce__"] = __proxy_reduce__ + cls_dict["__setstate__"] = __proxy_setstate__ + if additional_attributes is None: additional_attributes = {} for method in _SPECIAL_METHODS: @@ -257,6 +263,7 @@ def make_intermediate_proxy_type( slow_type: type, *, module: Optional[str] = None, + picklable: bool = True, ) -> Type[_IntermediateProxy]: """ Defines a proxy type for a pair of "intermediate" fast and slow @@ -273,6 +280,8 @@ def make_intermediate_proxy_type( The name of the class returned fast_type: type slow_type: type + picklable: bool + Whether or not the proxy object should be picklable """ def __init__(self, *args, **kwargs): @@ -322,6 +331,9 @@ def _fsproxy_fast_to_slow(self): "_fsproxy_fast_to_slow": _fsproxy_fast_to_slow, "_fsproxy_state": _fsproxy_state, } + if picklable: + cls_dict["__reduce__"] = __proxy_reduce__ + cls_dict["__setstate__"] = __proxy_setstate__ for method in _SPECIAL_METHODS: if getattr(slow_type, method, False): diff --git a/python/cudf/cudf/testing/testing.py b/python/cudf/cudf/testing/testing.py index 6c2f073b7ac..20e454245ab 100644 --- a/python/cudf/cudf/testing/testing.py +++ b/python/cudf/cudf/testing/testing.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023, NVIDIA CORPORATION. +# Copyright (c) 2020-2024, NVIDIA CORPORATION. from __future__ import annotations diff --git a/python/cudf/cudf_pandas_tests/test_cudf_pandas.py b/python/cudf/cudf_pandas_tests/test_cudf_pandas.py index bd8ca9f1640..aff24650434 100644 --- a/python/cudf/cudf_pandas_tests/test_cudf_pandas.py +++ b/python/cudf/cudf_pandas_tests/test_cudf_pandas.py @@ -1233,3 +1233,11 @@ def test_concat_fast(): def test_func_namespace(): # note: this test is sensitive to Pandas' internal module layout assert xpd.concat is xpd.core.reshape.concat.concat + + +def test_groupby_pickling(dataframe): + pdf, df = dataframe + pgb = pdf.groupby('a') + gb = df.groupby('a') + gb = pickle.loads(pickle.dumps(gb)) + tm.assert_equal(pgb.sum(), gb.sum()) From 43896e1463d95bfc678623a573d140d29f309b6d Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Fri, 12 Jan 2024 05:43:12 -0800 Subject: [PATCH 02/10] Style --- python/cudf/cudf_pandas_tests/test_cudf_pandas.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/cudf/cudf_pandas_tests/test_cudf_pandas.py b/python/cudf/cudf_pandas_tests/test_cudf_pandas.py index aff24650434..56a359037bd 100644 --- a/python/cudf/cudf_pandas_tests/test_cudf_pandas.py +++ b/python/cudf/cudf_pandas_tests/test_cudf_pandas.py @@ -1237,7 +1237,7 @@ def test_func_namespace(): def test_groupby_pickling(dataframe): pdf, df = dataframe - pgb = pdf.groupby('a') - gb = df.groupby('a') + pgb = pdf.groupby("a") + gb = df.groupby("a") gb = pickle.loads(pickle.dumps(gb)) tm.assert_equal(pgb.sum(), gb.sum()) From 3d361dba604c2dc9992c6bdd57410dc35efec182 Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Fri, 12 Jan 2024 08:36:37 -0800 Subject: [PATCH 03/10] Ensure we're pickling the method chain --- python/cudf/cudf/pandas/fast_slow_proxy.py | 79 +++++++++++++------ python/cudf/cudf/pandas/module_accelerator.py | 3 + 2 files changed, 56 insertions(+), 26 deletions(-) diff --git a/python/cudf/cudf/pandas/fast_slow_proxy.py b/python/cudf/cudf/pandas/fast_slow_proxy.py index 59095f45a75..f0bbe0c3b85 100644 --- a/python/cudf/cudf/pandas/fast_slow_proxy.py +++ b/python/cudf/cudf/pandas/fast_slow_proxy.py @@ -25,6 +25,11 @@ from .annotation import nvtx + +def call_operator(fn, args, kwargs): + return fn(*args, **kwargs) + + _CUDF_PANDAS_NVTX_COLORS = { "COPY_SLOW_TO_FAST": 0xCA0020, "COPY_FAST_TO_SLOW": 0xF4A582, @@ -95,24 +100,6 @@ def __call__(self): return object.__new__(self._type) -def __proxy_reduce__(self): - # Need a local import to avoid circular import issues - from .module_accelerator import disable_module_accelerator - - with disable_module_accelerator(): - pickled_wrapped_obj = pickle.dumps(self._fsproxy_wrapped) - return (_PickleConstructor(type(self)), (), pickled_wrapped_obj) - - -def __proxy_setstate__(self, state): - # Need a local import to avoid circular import issues - from .module_accelerator import disable_module_accelerator - - with disable_module_accelerator(): - unpickled_wrapped_obj = pickle.loads(state) - self._fsproxy_wrapped = unpickled_wrapped_obj - - _DELETE = object() @@ -220,9 +207,6 @@ def _fsproxy_state(self) -> _State: "_fsproxy_fast_to_slow": _fsproxy_fast_to_slow, "_fsproxy_state": _fsproxy_state, } - if picklable: - cls_dict["__reduce__"] = __proxy_reduce__ - cls_dict["__setstate__"] = __proxy_setstate__ if additional_attributes is None: additional_attributes = {} @@ -319,7 +303,7 @@ def _fsproxy_fast_to_slow(self): if self._fsproxy_state is _State.FAST: return super(type(self), self)._fsproxy_fast_to_slow() return self._fsproxy_wrapped - + slow_dir = dir(slow_type) cls_dict = { "__init__": __init__, @@ -331,9 +315,6 @@ def _fsproxy_fast_to_slow(self): "_fsproxy_fast_to_slow": _fsproxy_fast_to_slow, "_fsproxy_state": _fsproxy_state, } - if picklable: - cls_dict["__reduce__"] = __proxy_reduce__ - cls_dict["__setstate__"] = __proxy_setstate__ for method in _SPECIAL_METHODS: if getattr(slow_type, method, False): @@ -729,6 +710,28 @@ def _fsproxy_wrap(cls, value, func): return proxy + def __reduce__(self): + """ + In conjunction with `__proxy_setstate__`, this effectively enables + proxy types to be pickled and unpickled by pickling and unpickling + the underlying wrapped types. + """ + from .module_accelerator import disable_module_accelerator + + with disable_module_accelerator(): + pickled_wrapped_obj = pickle.dumps(self._fsproxy_wrapped) + return (_PickleConstructor(type(self)), (), pickled_wrapped_obj) + + + def __setstate__(self, state): + # Need a local import to avoid circular import issues + from .module_accelerator import disable_module_accelerator + + with disable_module_accelerator(): + unpickled_wrapped_obj = pickle.loads(state) + self._fsproxy_wrapped = unpickled_wrapped_obj + + class _IntermediateProxy(_FastSlowProxy): """ Proxy type for a pair of "intermediate" types that appear as @@ -783,6 +786,30 @@ def _fsproxy_fast_to_slow(self) -> Any: func, args, kwargs = self._method_chain args, kwargs = _slow_arg(args), _slow_arg(kwargs) return func(*args, **kwargs) + + def __reduce__(self): + """ + In conjunction with `__proxy_setstate__`, this effectively enables + proxy types to be pickled and unpickled by pickling and unpickling + the underlying wrapped types. + """ + from .module_accelerator import disable_module_accelerator + + with disable_module_accelerator(): + pickled_wrapped_obj = pickle.dumps(self._fsproxy_wrapped) + pickled_method_chain = pickle.dumps(self._method_chain) + return (_PickleConstructor(type(self)), (), (pickled_wrapped_obj, pickled_method_chain)) + + + def __setstate__(self, state): + # Need a local import to avoid circular import issues + from .module_accelerator import disable_module_accelerator + + with disable_module_accelerator(): + unpickled_wrapped_obj = pickle.loads(state[0]) + unpickled_method_chain = pickle.loads(state[1]) + self._fsproxy_wrapped = unpickled_wrapped_obj + self._method_chain = unpickled_method_chain class _CallableProxyMixin: @@ -800,7 +827,7 @@ def __call__(self, *args, **kwargs) -> Any: # _fast_slow_function_call) to avoid infinite recursion. # TODO: When Python 3.11 is the minimum supported Python version # this can use operator.call - lambda fn, args, kwargs: fn(*args, **kwargs), + call_operator, self, args, kwargs, diff --git a/python/cudf/cudf/pandas/module_accelerator.py b/python/cudf/cudf/pandas/module_accelerator.py index 180d75d96e8..c55ccc59fa2 100644 --- a/python/cudf/cudf/pandas/module_accelerator.py +++ b/python/cudf/cudf/pandas/module_accelerator.py @@ -551,6 +551,7 @@ def getattr_real_or_wrapped( # release the lock after reading this value) use_real = not loader._use_fast_lib if not use_real: + CUDF_PANDAS_PATH = __file__.rsplit("/", 1)[0] # Only need to check the denylist if we're not turned off. frame = sys._getframe() # We cannot possibly be at the top level. @@ -559,6 +560,8 @@ def getattr_real_or_wrapped( use_real = any( calling_module.is_relative_to(path) for path in loader._denylist + ) and not calling_module.is_relative_to( + CUDF_PANDAS_PATH ) try: if use_real: From 006f94da43d55e975dd9c5c9c488ddbc1c450da2 Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Tue, 16 Jan 2024 06:04:19 -0800 Subject: [PATCH 04/10] Style --- python/cudf/cudf/pandas/fast_slow_proxy.py | 15 ++++++++------- python/cudf/cudf/pandas/module_accelerator.py | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/python/cudf/cudf/pandas/fast_slow_proxy.py b/python/cudf/cudf/pandas/fast_slow_proxy.py index f0bbe0c3b85..077dde55c83 100644 --- a/python/cudf/cudf/pandas/fast_slow_proxy.py +++ b/python/cudf/cudf/pandas/fast_slow_proxy.py @@ -303,7 +303,7 @@ def _fsproxy_fast_to_slow(self): if self._fsproxy_state is _State.FAST: return super(type(self), self)._fsproxy_fast_to_slow() return self._fsproxy_wrapped - + slow_dir = dir(slow_type) cls_dict = { "__init__": __init__, @@ -709,7 +709,6 @@ def _fsproxy_wrap(cls, value, func): proxy._fsproxy_wrapped = value return proxy - def __reduce__(self): """ In conjunction with `__proxy_setstate__`, this effectively enables @@ -722,7 +721,6 @@ def __reduce__(self): pickled_wrapped_obj = pickle.dumps(self._fsproxy_wrapped) return (_PickleConstructor(type(self)), (), pickled_wrapped_obj) - def __setstate__(self, state): # Need a local import to avoid circular import issues from .module_accelerator import disable_module_accelerator @@ -730,7 +728,7 @@ def __setstate__(self, state): with disable_module_accelerator(): unpickled_wrapped_obj = pickle.loads(state) self._fsproxy_wrapped = unpickled_wrapped_obj - + class _IntermediateProxy(_FastSlowProxy): """ @@ -786,7 +784,7 @@ def _fsproxy_fast_to_slow(self) -> Any: func, args, kwargs = self._method_chain args, kwargs = _slow_arg(args), _slow_arg(kwargs) return func(*args, **kwargs) - + def __reduce__(self): """ In conjunction with `__proxy_setstate__`, this effectively enables @@ -798,8 +796,11 @@ def __reduce__(self): with disable_module_accelerator(): pickled_wrapped_obj = pickle.dumps(self._fsproxy_wrapped) pickled_method_chain = pickle.dumps(self._method_chain) - return (_PickleConstructor(type(self)), (), (pickled_wrapped_obj, pickled_method_chain)) - + return ( + _PickleConstructor(type(self)), + (), + (pickled_wrapped_obj, pickled_method_chain), + ) def __setstate__(self, state): # Need a local import to avoid circular import issues diff --git a/python/cudf/cudf/pandas/module_accelerator.py b/python/cudf/cudf/pandas/module_accelerator.py index c55ccc59fa2..e2b74028e72 100644 --- a/python/cudf/cudf/pandas/module_accelerator.py +++ b/python/cudf/cudf/pandas/module_accelerator.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +# SPDX-FileCopyrightText: Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. # All rights reserved. # SPDX-License-Identifier: Apache-2.0 From adad376547ef76de688434cde62b1a625130e90b Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Tue, 16 Jan 2024 06:04:35 -0800 Subject: [PATCH 05/10] Style --- python/cudf/cudf/pandas/module_accelerator.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python/cudf/cudf/pandas/module_accelerator.py b/python/cudf/cudf/pandas/module_accelerator.py index e2b74028e72..f137dd009d0 100644 --- a/python/cudf/cudf/pandas/module_accelerator.py +++ b/python/cudf/cudf/pandas/module_accelerator.py @@ -560,9 +560,7 @@ def getattr_real_or_wrapped( use_real = any( calling_module.is_relative_to(path) for path in loader._denylist - ) and not calling_module.is_relative_to( - CUDF_PANDAS_PATH - ) + ) and not calling_module.is_relative_to(CUDF_PANDAS_PATH) try: if use_real: return real[name] From b9b3e5eaf35e8e3073f11f9232c7653ffc15a4ed Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Tue, 16 Jan 2024 07:25:01 -0800 Subject: [PATCH 06/10] Rename test --- python/cudf/cudf_pandas_tests/test_cudf_pandas.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/python/cudf/cudf_pandas_tests/test_cudf_pandas.py b/python/cudf/cudf_pandas_tests/test_cudf_pandas.py index 56a359037bd..2b8f21cfa95 100644 --- a/python/cudf/cudf_pandas_tests/test_cudf_pandas.py +++ b/python/cudf/cudf_pandas_tests/test_cudf_pandas.py @@ -1235,9 +1235,17 @@ def test_func_namespace(): assert xpd.concat is xpd.core.reshape.concat.concat -def test_groupby_pickling(dataframe): +def test_pickle_groupby(dataframe): pdf, df = dataframe pgb = pdf.groupby("a") gb = df.groupby("a") gb = pickle.loads(pickle.dumps(gb)) tm.assert_equal(pgb.sum(), gb.sum()) + + +def test_pickle_groupby_rolling(dataframe): + pdf, df = dataframe + pgb = pdf.groupby("a").rolling(2) + gb = df.groupby("a").rolling(2) + gb = pickle.loads(pickle.dumps(gb)) + tm.assert_equal(pgb.sum(), gb.sum()) From a170b0e4c10133a129d458d47c175ce8ea1de270 Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Tue, 16 Jan 2024 10:52:45 -0800 Subject: [PATCH 07/10] Can't pickle rolling objects with cudf --- python/cudf/cudf_pandas_tests/test_cudf_pandas.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/python/cudf/cudf_pandas_tests/test_cudf_pandas.py b/python/cudf/cudf_pandas_tests/test_cudf_pandas.py index 2b8f21cfa95..7b75bb3d9d9 100644 --- a/python/cudf/cudf_pandas_tests/test_cudf_pandas.py +++ b/python/cudf/cudf_pandas_tests/test_cudf_pandas.py @@ -1241,11 +1241,3 @@ def test_pickle_groupby(dataframe): gb = df.groupby("a") gb = pickle.loads(pickle.dumps(gb)) tm.assert_equal(pgb.sum(), gb.sum()) - - -def test_pickle_groupby_rolling(dataframe): - pdf, df = dataframe - pgb = pdf.groupby("a").rolling(2) - gb = df.groupby("a").rolling(2) - gb = pickle.loads(pickle.dumps(gb)) - tm.assert_equal(pgb.sum(), gb.sum()) From c760f330ad8dc09fa39877854d18bbeb430477a6 Mon Sep 17 00:00:00 2001 From: Ashwin Srinath Date: Fri, 19 Jan 2024 13:08:49 -0500 Subject: [PATCH 08/10] Reviews --- python/cudf/cudf/core/_internals/where.py | 2 +- python/cudf/cudf/pandas/fast_slow_proxy.py | 8 ++------ python/cudf/cudf/pandas/module_accelerator.py | 6 ++++-- python/cudf/cudf/testing/testing.py | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/python/cudf/cudf/core/_internals/where.py b/python/cudf/cudf/core/_internals/where.py index 2f7827521a0..ef6b10f66c1 100644 --- a/python/cudf/cudf/core/_internals/where.py +++ b/python/cudf/cudf/core/_internals/where.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024, NVIDIA CORPORATION. +# Copyright (c) 2021-2023, NVIDIA CORPORATION. import warnings from typing import Tuple, Union diff --git a/python/cudf/cudf/pandas/fast_slow_proxy.py b/python/cudf/cudf/pandas/fast_slow_proxy.py index 077dde55c83..258446b2002 100644 --- a/python/cudf/cudf/pandas/fast_slow_proxy.py +++ b/python/cudf/cudf/pandas/fast_slow_proxy.py @@ -114,7 +114,6 @@ def make_final_proxy_type( additional_attributes: Mapping[str, Any] | None = None, postprocess: Callable[[_FinalProxy, Any, Any], Any] | None = None, bases: Tuple = (), - picklable: bool = True, ) -> Type[_FinalProxy]: """ Defines a fast-slow proxy type for a pair of "final" fast and slow @@ -145,8 +144,6 @@ def make_final_proxy_type( construct said unwrapped object. See also `_maybe_wrap_result`. bases Optional tuple of base classes to insert into the mro. - picklable: bool - Whether or not the proxy object should be picklable Notes ----- As a side-effect, this function adds `fast_type` and `slow_type` @@ -247,7 +244,6 @@ def make_intermediate_proxy_type( slow_type: type, *, module: Optional[str] = None, - picklable: bool = True, ) -> Type[_IntermediateProxy]: """ Defines a proxy type for a pair of "intermediate" fast and slow @@ -264,8 +260,6 @@ def make_intermediate_proxy_type( The name of the class returned fast_type: type slow_type: type - picklable: bool - Whether or not the proxy object should be picklable """ def __init__(self, *args, **kwargs): @@ -715,6 +709,7 @@ def __reduce__(self): proxy types to be pickled and unpickled by pickling and unpickling the underlying wrapped types. """ + # Need a local import to avoid circular import issues from .module_accelerator import disable_module_accelerator with disable_module_accelerator(): @@ -791,6 +786,7 @@ def __reduce__(self): proxy types to be pickled and unpickled by pickling and unpickling the underlying wrapped types. """ + # Need a local import to avoid circular import issues from .module_accelerator import disable_module_accelerator with disable_module_accelerator(): diff --git a/python/cudf/cudf/pandas/module_accelerator.py b/python/cudf/cudf/pandas/module_accelerator.py index f137dd009d0..e97d6e4af24 100644 --- a/python/cudf/cudf/pandas/module_accelerator.py +++ b/python/cudf/cudf/pandas/module_accelerator.py @@ -557,10 +557,12 @@ def getattr_real_or_wrapped( # We cannot possibly be at the top level. assert frame.f_back calling_module = pathlib.PurePath(frame.f_back.f_code.co_filename) - use_real = any( + use_real = not calling_module.is_relative_to( + CUDF_PANDAS_PATH + ) and any( calling_module.is_relative_to(path) for path in loader._denylist - ) and not calling_module.is_relative_to(CUDF_PANDAS_PATH) + ) try: if use_real: return real[name] diff --git a/python/cudf/cudf/testing/testing.py b/python/cudf/cudf/testing/testing.py index 20e454245ab..6c2f073b7ac 100644 --- a/python/cudf/cudf/testing/testing.py +++ b/python/cudf/cudf/testing/testing.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2024, NVIDIA CORPORATION. +# Copyright (c) 2020-2023, NVIDIA CORPORATION. from __future__ import annotations From e29694e03467790d6f4292da51c94dd73ea1e219 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Fri, 19 Jan 2024 14:42:01 -0500 Subject: [PATCH 09/10] Add missing newline --- python/cudf/cudf/pandas/fast_slow_proxy.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/cudf/cudf/pandas/fast_slow_proxy.py b/python/cudf/cudf/pandas/fast_slow_proxy.py index 258446b2002..d132116af61 100644 --- a/python/cudf/cudf/pandas/fast_slow_proxy.py +++ b/python/cudf/cudf/pandas/fast_slow_proxy.py @@ -144,6 +144,7 @@ def make_final_proxy_type( construct said unwrapped object. See also `_maybe_wrap_result`. bases Optional tuple of base classes to insert into the mro. + Notes ----- As a side-effect, this function adds `fast_type` and `slow_type` From 2799aa6ef4a5ea6bc25260c5561d3342f37b6497 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Fri, 19 Jan 2024 16:37:36 -0500 Subject: [PATCH 10/10] Style --- python/cudf/cudf_pandas_tests/test_cudf_pandas.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/cudf/cudf_pandas_tests/test_cudf_pandas.py b/python/cudf/cudf_pandas_tests/test_cudf_pandas.py index 0d21e8334a4..738ff24f374 100644 --- a/python/cudf/cudf_pandas_tests/test_cudf_pandas.py +++ b/python/cudf/cudf_pandas_tests/test_cudf_pandas.py @@ -1242,7 +1242,7 @@ def test_pickle_groupby(dataframe): gb = pickle.loads(pickle.dumps(gb)) tm.assert_equal(pgb.sum(), gb.sum()) - + def test_isinstance_base_offset(): offset = xpd.tseries.frequencies.to_offset("1s") - assert isinstance(offset, xpd.tseries.offsets.BaseOffset) \ No newline at end of file + assert isinstance(offset, xpd.tseries.offsets.BaseOffset)