Skip to content

Commit

Permalink
[AIRFLOW-7041] make bowler dependency local (#7691)
Browse files Browse the repository at this point in the history
  • Loading branch information
potiuk committed Mar 11, 2020
1 parent 3aff653 commit 462225a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
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

0 comments on commit 462225a

Please sign in to comment.