Skip to content

Commit

Permalink
move around python imports
Browse files Browse the repository at this point in the history
  • Loading branch information
fritz-astronomer committed Jun 7, 2024
1 parent ce76566 commit 66ae5b5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions astronomer_starship/starship_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
from airflow.www.app import csrf
from flask import Blueprint, request, jsonify
from flask_appbuilder import expose, BaseView
import os
from typing import Any, Dict, List, Union
import base64
import logging
from json import JSONDecodeError

from astronomer_starship.compat.starship_compatability import (
StarshipCompatabilityLayer,
Expand All @@ -21,11 +16,14 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from typing import Callable
from typing import Callable, Any, Dict, List, Union


def get_json_or_clean_str(o: str) -> Union[List[Any], Dict[Any, Any], Any]:
"""For Aeroscope - Either load JSON (if we can) or strip and split the string, while logging the error"""
from json import JSONDecodeError
import logging

try:
return json.loads(o)
except (JSONDecodeError, TypeError) as e:
Expand All @@ -44,6 +42,8 @@ def clean_airflow_report_output(log_string: str) -> Union[dict, str]:
... )
{'output': 'hello world'}
"""
from json import JSONDecodeError
import base64

log_lines = log_string.split("\n")
enumerated_log_lines = list(enumerate(log_lines))
Expand Down Expand Up @@ -182,6 +182,7 @@ def telescope(self):
from contextlib import redirect_stdout, redirect_stderr
from urllib.error import HTTPError
from datetime import datetime, timezone
import os

aero_version = os.getenv("TELESCOPE_REPORT_RELEASE_VERSION", "latest")
a = "airflow_report.pyz"
Expand Down

0 comments on commit 66ae5b5

Please sign in to comment.