Skip to content

Commit

Permalink
don't change behavior yet
Browse files Browse the repository at this point in the history
  • Loading branch information
topherinternational committed Jan 4, 2024
1 parent aabb034 commit dc8347d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 2 additions & 7 deletions src/pylint_airflow/checkers/xcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from typing import Set, Dict, Tuple

import astroid
from astroid import AttributeInferenceError
from pylint import checkers
from pylint.checkers import utils

Expand Down Expand Up @@ -78,12 +77,8 @@ def get_xcoms_from_tasks(
if callable_func_name == "<lambda>": # TODO support lambdas
continue

try:
module_attribute = node.getattr(callable_func_name)
except AttributeInferenceError:
continue
else:
callable_func = module_attribute[0]
callable_func = node.getattr(callable_func_name)[0]
# ^ TODO: handle builtins and attribute imports that will raise on this call

if not isinstance(callable_func, astroid.FunctionDef):
continue # Callable_func is str not FunctionDef when imported
Expand Down
7 changes: 6 additions & 1 deletion tests/pylint_airflow/checkers/test_xcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def test_should_detect_imported_callable_as_attribute(self):

assert result == expected_result

@pytest.mark.xfail(reason="Not yet implemented", raises=AssertionError, strict=True)
def test_should_detect_imported_callable_as_name(self):
test_code = """
from airflow.operators.python_operator import PythonOperator
Expand Down Expand Up @@ -162,6 +161,9 @@ def test_should_skip_lambda_callable(self):

assert result == ({}, set())

@pytest.mark.xfail(
reason="Not yet implemented", raises=astroid.AttributeInferenceError, strict=True
)
def test_should_skip_builtin_callable(self):
test_code = """
from airflow.operators.python_operator import PythonOperator
Expand All @@ -178,6 +180,9 @@ def test_should_skip_builtin_callable(self):

assert result == ({}, set())

@pytest.mark.xfail(
reason="Not yet implemented", raises=astroid.AttributeInferenceError, strict=True
)
def test_should_skip_imported_callable_as_attribute(self):
test_code = """
from airflow.operators.python_operator import PythonOperator
Expand Down

0 comments on commit dc8347d

Please sign in to comment.