-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: flake8 cleanup of core.internals #19202
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 1 commit
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 |
---|---|---|
|
@@ -191,6 +191,13 @@ def fill_value(self): | |
def mgr_locs(self): | ||
return self._mgr_locs | ||
|
||
@mgr_locs.setter | ||
def mgr_locs(self, new_mgr_locs): | ||
if not isinstance(new_mgr_locs, BlockPlacement): | ||
new_mgr_locs = BlockPlacement(new_mgr_locs) | ||
|
||
self._mgr_locs = new_mgr_locs | ||
|
||
@property | ||
def array_dtype(self): | ||
""" the dtype to return if I want to construct this block as an | ||
|
@@ -224,13 +231,6 @@ def make_block_same_class(self, values, placement=None, fastpath=True, | |
return make_block(values, placement=placement, klass=self.__class__, | ||
fastpath=fastpath, **kwargs) | ||
|
||
@mgr_locs.setter | ||
def mgr_locs(self, new_mgr_locs): | ||
if not isinstance(new_mgr_locs, BlockPlacement): | ||
new_mgr_locs = BlockPlacement(new_mgr_locs) | ||
|
||
self._mgr_locs = new_mgr_locs | ||
|
||
def __unicode__(self): | ||
|
||
# don't want to print out all of the items here | ||
|
@@ -633,7 +633,7 @@ def _astype(self, dtype, copy=False, errors='raise', values=None, | |
|
||
newb = make_block(values, placement=self.mgr_locs, dtype=dtype, | ||
klass=klass) | ||
except: | ||
except Exception: | ||
if errors == 'raise': | ||
raise | ||
newb = self.copy() if copy else self | ||
|
@@ -840,7 +840,7 @@ def setitem(self, indexer, value, mgr=None): | |
|
||
transf = (lambda x: x.T) if self.ndim == 2 else (lambda x: x) | ||
values = transf(values) | ||
l = len(values) | ||
vlen = len(values) | ||
|
||
# length checking | ||
# boolean with truth values == len of the value is ok too | ||
|
@@ -855,7 +855,7 @@ def setitem(self, indexer, value, mgr=None): | |
# slice | ||
elif isinstance(indexer, slice): | ||
|
||
if is_list_like(value) and l: | ||
if is_list_like(value) and vlen: | ||
if len(value) != length_of_indexer(indexer, values): | ||
raise ValueError("cannot set using a slice indexer with a " | ||
"different length than the value") | ||
|
@@ -1108,7 +1108,8 @@ def check_int_bool(self, inplace): | |
# a fill na type method | ||
try: | ||
m = missing.clean_fill_method(method) | ||
except: | ||
except Exception: | ||
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. the entire point of correctly lining is to catch a more specific error 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. Do you know the appropriate exceptions to catch? I was going to fix these but didn't know what could be raised, and didn't want to break things. 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. you simply put a breakpoint in the exception and run the tests 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. Well looking at clean_fill_method the only thing it'll raise is ValueError, so this one I can make specific. 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. Ditto for clean_interp_method. |
||
# TODO: Catch something more specific? | ||
m = None | ||
|
||
if m is not None: | ||
|
@@ -1123,7 +1124,8 @@ def check_int_bool(self, inplace): | |
# try an interp method | ||
try: | ||
m = missing.clean_interp_method(method, **kwargs) | ||
except: | ||
except Exception: | ||
# TODO: Catch something more specific? | ||
m = None | ||
|
||
if m is not None: | ||
|
@@ -2166,7 +2168,7 @@ def set(self, locs, values, check=False): | |
try: | ||
if (self.values[locs] == values).all(): | ||
return | ||
except: | ||
except Exception: | ||
pass | ||
try: | ||
self.values[locs] = values | ||
|
@@ -2807,7 +2809,8 @@ def _astype(self, dtype, copy=False, errors='raise', values=None, | |
def __len__(self): | ||
try: | ||
return self.sp_index.length | ||
except: | ||
except Exception: | ||
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. enumerate these 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. Please read my previous comment. 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. I did it was not helpful. you need to specify here. 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.
Of course it wasn't helpful. It was asking for help! Screw it, closing. 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.
@jreback was the comment @jbrockmendel referred to. Saying it was "not helpful" is driving away contributors. 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. @jbrockmendel my point is that saying ping I am ready when you haven't answer my questions is not helpful. 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. I spend an enormous amounts of my time reviewing PR's and we have a lot of them. I do except answers to comments that I make. 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. I'm guessing these last two comments are about a "ping" over in #19139, where I had answered the question but that answer was ignored. |
||
# TODO: Catch something more specific? | ||
return 0 | ||
|
||
def copy(self, deep=True, mgr=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.
It looks like this is only used in one place (line 858). Is there a reason to make it a variable in this case? Seems like we could just replace the one instance where
vlen
is used withlen(values)
.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.
Sounds good, will change.