From d27a235ef86a6f16a1c75883d503e02d6ddbc78c Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Thu, 19 Jan 2023 14:52:08 -0800 Subject: [PATCH 1/5] Remove unneeded filterwarning --- pandas/tests/io/formats/test_format.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/tests/io/formats/test_format.py b/pandas/tests/io/formats/test_format.py index 70a2fc7dcc9dd..75aa9fb253bbc 100644 --- a/pandas/tests/io/formats/test_format.py +++ b/pandas/tests/io/formats/test_format.py @@ -3461,7 +3461,6 @@ def test_filepath_or_buffer_arg( assert_filepath_or_buffer_equals(expected) -@pytest.mark.filterwarnings("ignore::FutureWarning") @pytest.mark.parametrize("method", ["to_string", "to_html", "to_latex"]) def test_filepath_or_buffer_bad_arg_raises(float_frame, method): if method in ["to_latex"]: # uses styler implementation From ad16876728594be422c418baeb503aaec3663e35 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Thu, 19 Jan 2023 14:58:22 -0800 Subject: [PATCH 2/5] Remove running _print_verions as script --- pandas/util/_print_versions.py | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/pandas/util/_print_versions.py b/pandas/util/_print_versions.py index 91d518d1ab496..2526fafe5851f 100644 --- a/pandas/util/_print_versions.py +++ b/pandas/util/_print_versions.py @@ -132,29 +132,3 @@ def show_versions(as_json: str | bool = False) -> None: print("") for k, v in deps.items(): print(f"{k:<{maxlen}}: {v}") - - -def main() -> int: - from optparse import OptionParser - - parser = OptionParser() - parser.add_option( - "-j", - "--json", - metavar="FILE", - nargs=1, - help="Save output as JSON into file, pass in '-' to output to stdout", - ) - - (options, args) = parser.parse_args() - - if options.json == "-": - options.json = True - - show_versions(as_json=options.json) - - return 0 - - -if __name__ == "__main__": - sys.exit(main()) From b63d948c155f75dba9d105181e9db7db1978bb08 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Fri, 20 Jan 2023 14:35:23 -0800 Subject: [PATCH 3/5] Remove unneeded None typing --- pandas/core/util/hashing.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pandas/core/util/hashing.py b/pandas/core/util/hashing.py index e0b18047aa0ec..79e1dc10f3f77 100644 --- a/pandas/core/util/hashing.py +++ b/pandas/core/util/hashing.py @@ -85,7 +85,7 @@ def hash_pandas_object( obj: Index | DataFrame | Series, index: bool = True, encoding: str = "utf8", - hash_key: str | None = _default_hash_key, + hash_key: str = _default_hash_key, categorize: bool = True, ) -> Series: """ @@ -98,7 +98,7 @@ def hash_pandas_object( Include the index in the hash (if Series/DataFrame). encoding : str, default 'utf8' Encoding for data & key when strings. - hash_key : str, default _default_hash_key + hash_key : str, default '0123456789123456' Hash_key for string key to encode. categorize : bool, default True Whether to first categorize object arrays before hashing. This is more @@ -110,9 +110,6 @@ def hash_pandas_object( """ from pandas import Series - if hash_key is None: - hash_key = _default_hash_key - if isinstance(obj, ABCMultiIndex): return Series(hash_tuples(obj, encoding, hash_key), dtype="uint64", copy=False) From a840f67b653792af9569c64415163fd777ebd2e1 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Fri, 20 Jan 2023 16:00:18 -0800 Subject: [PATCH 4/5] Remove RANDU_CHARS --- pandas/_testing/_random.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pandas/_testing/_random.py b/pandas/_testing/_random.py index 52e5d5f58b01f..7cfd92efb5d5f 100644 --- a/pandas/_testing/_random.py +++ b/pandas/_testing/_random.py @@ -5,10 +5,6 @@ from pandas._typing import NpDtype RANDS_CHARS = np.array(list(string.ascii_letters + string.digits), dtype=(np.str_, 1)) -RANDU_CHARS = np.array( - list("".join(map(chr, range(1488, 1488 + 26))) + string.digits), - dtype=(np.unicode_, 1), -) def rands_array(nchars, size, dtype: NpDtype = "O", replace: bool = True) -> np.ndarray: From 5ce3bcaf2b3aa51b4ad843e98101c6ac7c165ba3 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Wed, 1 Feb 2023 15:46:36 -0800 Subject: [PATCH 5/5] Revert "Remove unneeded None typing" This reverts commit b63d948c155f75dba9d105181e9db7db1978bb08. --- pandas/core/util/hashing.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pandas/core/util/hashing.py b/pandas/core/util/hashing.py index 30755be56c276..350914cc50556 100644 --- a/pandas/core/util/hashing.py +++ b/pandas/core/util/hashing.py @@ -87,7 +87,7 @@ def hash_pandas_object( obj: Index | DataFrame | Series, index: bool = True, encoding: str = "utf8", - hash_key: str = _default_hash_key, + hash_key: str | None = _default_hash_key, categorize: bool = True, ) -> Series: """ @@ -100,7 +100,7 @@ def hash_pandas_object( Include the index in the hash (if Series/DataFrame). encoding : str, default 'utf8' Encoding for data & key when strings. - hash_key : str, default '0123456789123456' + hash_key : str, default _default_hash_key Hash_key for string key to encode. categorize : bool, default True Whether to first categorize object arrays before hashing. This is more @@ -112,6 +112,9 @@ def hash_pandas_object( """ from pandas import Series + if hash_key is None: + hash_key = _default_hash_key + if isinstance(obj, ABCMultiIndex): return Series(hash_tuples(obj, encoding, hash_key), dtype="uint64", copy=False)