Skip to content

Commit ea055be

Browse files
Peter HamfeltPeter Hamfelt
authored andcommitted
Update checker using safe_infer
1 parent 506251e commit ea055be

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pylint_ml/checkers/numpy/numpy_nan_comparison.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class NumpyNaNComparisonChecker(LibraryBaseChecker):
3131
@classmethod
3232
def __is_np_nan_call(cls, node: nodes.Attribute) -> bool:
3333
"""Check if the node represents a call to np.nan."""
34-
return node.attrname in NUMPY_NAN and (infer_specific_module_from_attribute(node=node, module_name="numpy"))
34+
return node.attrname in NUMPY_NAN and (infer_specific_module_from_attribute(node=node, module_name=NUMPY))
3535

3636
@only_required_for_messages("numpy-nan-compare")
3737
def visit_compare(self, node: nodes.Compare) -> None:

pylint_ml/checkers/pandas/pandas_dataframe_iterrows.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from pylint_ml.checkers.config import PANDAS
1414
from pylint_ml.checkers.library_base_checker import LibraryBaseChecker
15+
from pylint_ml.checkers.utils import infer_specific_module_from_attribute
1516

1617

1718
class PandasIterrowsChecker(LibraryBaseChecker):
@@ -30,7 +31,10 @@ def visit_call(self, node: nodes.Call) -> None:
3031
if not self.is_library_imported_and_version_valid(lib_name=PANDAS, required_version=None):
3132
return
3233

33-
if isinstance(node.func, nodes.Attribute):
34+
if (
35+
isinstance(node.func, nodes.Attribute)
36+
and infer_specific_module_from_attribute(node=node.func, module_name=PANDAS)
37+
):
3438
method_name = getattr(node.func, "attrname", None)
3539
if method_name == "iterrows":
3640
object_name = getattr(node.func.expr, "name", None)

0 commit comments

Comments
 (0)