Skip to content

Commit

Permalink
add type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
Forthoney committed Jan 28, 2024
1 parent 400dbf8 commit 56e1941
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compiler/shell_ast/transformation_options.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from abc import ABC, abstractmethod
from enum import Enum
import pickle
from typing import Iterator

from shell_ast.ast_util import *
from shasta.json_to_ast import to_ast_node
Expand Down Expand Up @@ -200,13 +201,13 @@ def __init__(self):
self._task_ids = self._id_generator()

@staticmethod
def _id_generator():
def _id_generator() -> Iterator[int]:
i = 0
while True:
yield i
i += 1

def _ast_to_airflow(self, ast):
def _ast_to_airflow(self, ast) -> str:
id = next(self._task_ids)
if isinstance(ast, UnparsedScript):
return f"command_{id} = BashOperator(task_id='command_{id}', bash_command='{ast.text}'"
Expand Down

0 comments on commit 56e1941

Please sign in to comment.