Skip to content
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

[AIRFLOW-7041] make bowler dependency local #7691

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions backport_packages/.flake8
31 changes: 14 additions & 17 deletions backport_packages/setup_backport_packages.py
Expand Up @@ -29,12 +29,8 @@
from shutil import copyfile, copytree, rmtree
from typing import Dict, List

from bowler import LN, TOKEN, BowlerTool, Capture, Filename, Query
from fissix.pytree import Leaf
from setuptools import Command, find_packages, setup as setuptools_setup

BowlerTool.IN_PROCESS = True

logger = logging.getLogger(__name__)

# Kept manually in sync with airflow.__version__
Expand Down Expand Up @@ -143,6 +139,20 @@ def run(self):


def change_import_paths_to_deprecated():
from bowler import LN, TOKEN, Capture, Filename, Query
from fissix.pytree import Leaf

def remove_tags_modifier(node: LN, capture: Capture, filename: Filename) -> None:
for node in capture['function_arguments'][0].post_order():
if isinstance(node, Leaf) and node.value == "tags" and node.type == TOKEN.NAME:
if node.parent.next_sibling and node.parent.next_sibling.value == ",":
node.parent.next_sibling.remove()
node.parent.remove()

def pure_airflow_models_filter(node: LN, capture: Capture, filename: Filename) -> bool:
"""Check if select is exactly [airflow, . , models]"""
return len([ch for ch in node.children[1].leaves()]) == 3

changes = [
("airflow.operators.bash", "airflow.operators.bash_operator"),
("airflow.operators.python", "airflow.operators.python_operator"),
Expand Down Expand Up @@ -194,19 +204,6 @@ def change_import_paths_to_deprecated():
qry.execute(write=True, silent=False, interactive=False)


def remove_tags_modifier(node: LN, capture: Capture, filename: Filename) -> None:
for node in capture['function_arguments'][0].post_order():
if isinstance(node, Leaf) and node.value == "tags" and node.type == TOKEN.NAME:
if node.parent.next_sibling and node.parent.next_sibling.value == ",":
node.parent.next_sibling.remove()
node.parent.remove()


def pure_airflow_models_filter(node: LN, capture: Capture, filename: Filename) -> bool:
"""Check if select is exactly [airflow, . , models]"""
return len([ch for ch in node.children[1].leaves()]) == 3


def copy_provider_sources():
build_dir = os.path.join(dirname(__file__), "build")
if os.path.isdir(build_dir):
Expand Down