-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
STYLE: fix pylint redefined-oute-name warnings (pandas-dev#49656) #49668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
""" | ||
from __future__ import annotations | ||
|
||
import copy | ||
import copy as _copy_ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment as above |
||
import datetime | ||
from functools import partial | ||
import string | ||
|
@@ -1637,7 +1637,7 @@ def get_join_indexers( | |
|
||
lkey, rkey, count = _factorize_keys(lkey, rkey, sort=sort, how=how) | ||
# preserve left frame order if how == 'left' and sort == False | ||
kwargs = copy.copy(kwargs) | ||
kwargs = _copy_.copy(kwargs) | ||
if how in ("left", "right"): | ||
kwargs["sort"] = sort | ||
join_func = { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,10 @@ | |
|
||
import numpy as np | ||
|
||
from pandas._libs import json | ||
from pandas._libs.json import ( | ||
loads, | ||
dumps, | ||
) | ||
from pandas._libs.tslibs import iNaT | ||
from pandas._typing import ( | ||
CompressionOptions, | ||
|
@@ -73,9 +76,6 @@ | |
|
||
FrameSeriesStrT = TypeVar("FrameSeriesStrT", bound=Literal["frame", "series"]) | ||
|
||
loads = json.loads | ||
dumps = json.dumps | ||
|
||
|
||
# interface to/from | ||
@overload | ||
|
@@ -912,7 +912,7 @@ def read(self) -> DataFrame | Series: | |
self.close() | ||
return obj | ||
|
||
def _get_object_parser(self, json) -> DataFrame | Series: | ||
def _get_object_parser(self, json_object) -> DataFrame | Series: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you're no longer import |
||
""" | ||
Parses a json document into a pandas object. | ||
""" | ||
|
@@ -929,12 +929,12 @@ def _get_object_parser(self, json) -> DataFrame | Series: | |
} | ||
obj = None | ||
if typ == "frame": | ||
obj = FrameParser(json, **kwargs).parse() | ||
obj = FrameParser(json_object, **kwargs).parse() | ||
|
||
if typ == "series" or obj is None: | ||
if not isinstance(dtype, bool): | ||
kwargs["dtype"] = dtype | ||
obj = SeriesParser(json, **kwargs).parse() | ||
obj = SeriesParser(json_object, **kwargs).parse() | ||
|
||
return obj | ||
|
||
|
@@ -1009,7 +1009,7 @@ class Parser: | |
|
||
def __init__( | ||
self, | ||
json, | ||
json_object, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
orient, | ||
dtype: DtypeArg | None = None, | ||
convert_axes: bool = True, | ||
|
@@ -1018,7 +1018,7 @@ def __init__( | |
precise_float: bool = False, | ||
date_unit=None, | ||
) -> None: | ||
self.json = json | ||
self.json_object = json_object | ||
|
||
if orient is None: | ||
orient = self._default_orient | ||
|
@@ -1214,7 +1214,7 @@ class SeriesParser(Parser): | |
_split_keys = ("name", "index", "data") | ||
|
||
def _parse(self) -> None: | ||
data = loads(self.json, precise_float=self.precise_float) | ||
data = loads(self.json_object, precise_float=self.precise_float) | ||
|
||
if self.orient == "split": | ||
decoded = {str(k): v for k, v in data.items()} | ||
|
@@ -1239,31 +1239,31 @@ class FrameParser(Parser): | |
|
||
def _parse(self) -> None: | ||
|
||
json = self.json | ||
json_object = self.json_object | ||
orient = self.orient | ||
|
||
if orient == "columns": | ||
self.obj = DataFrame( | ||
loads(json, precise_float=self.precise_float), dtype=None | ||
loads(json_object, precise_float=self.precise_float), dtype=None | ||
) | ||
elif orient == "split": | ||
decoded = { | ||
str(k): v | ||
for k, v in loads(json, precise_float=self.precise_float).items() | ||
for k, v in loads(json_object, precise_float=self.precise_float).items() | ||
} | ||
self.check_keys_split(decoded) | ||
self.obj = DataFrame(dtype=None, **decoded) | ||
elif orient == "index": | ||
self.obj = DataFrame.from_dict( | ||
loads(json, precise_float=self.precise_float), | ||
loads(json_object, precise_float=self.precise_float), | ||
dtype=None, | ||
orient="index", | ||
) | ||
elif orient == "table": | ||
self.obj = parse_table_schema(json, precise_float=self.precise_float) | ||
self.obj = parse_table_schema(json_object, precise_float=self.precise_float) | ||
else: | ||
self.obj = DataFrame( | ||
loads(json, precise_float=self.precise_float), dtype=None | ||
loads(json_object, precise_float=self.precise_float), dtype=None | ||
) | ||
|
||
def _process_converter(self, f, filt=None) -> None: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about
import copy as stdlib_copy
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, i am working on that.