Skip to content

Commit

Permalink
fix mypy failure due to termcolor upgrade (apache#44313)
Browse files Browse the repository at this point in the history
* add type to Color

* fix
  • Loading branch information
rawwar authored Nov 23, 2024
1 parent 21238d1 commit d2c4c12
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions airflow/cli/commands/standalone_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
from airflow.utils.providers_configuration_loader import providers_configuration_loaded

if TYPE_CHECKING:
from termcolor.termcolor import Color

from airflow.jobs.base_job_runner import BaseJobRunner


Expand Down Expand Up @@ -141,14 +143,14 @@ def print_output(self, name: str, output):
You can pass multiple lines to output if you wish; it will be split for you.
"""
color = {
color: dict[str, Color] = {
"fastapi-api": "magenta",
"webserver": "green",
"scheduler": "blue",
"triggerer": "cyan",
"standalone": "white",
}.get(name, "white")
colorised_name = colored(f"{name:10}", color)
}
colorised_name = colored(f"{name:10}", color.get(name, "white"))
for line in output.splitlines():
print(f"{colorised_name} | {line.strip()}")

Expand Down

0 comments on commit d2c4c12

Please sign in to comment.