mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 22:01:47 +00:00

<!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> As discussed in https://github.com/astral-sh/ruff/issues/14626#issuecomment-2766146129, we're to separate suggested changes from required changes. The following symbols have been moved to AIR311 from AIR301. They still work in Airflow 3.0, but they're suggested to be changed as they're expected to be removed in a future version. * arguments * `airflow..DAG | dag` * `sla_miss_callback` * operators * `sla` * name * `airflow.Dataset] | [airflow.datasets.Dataset` → `airflow.sdk.Asset` * `airflow.datasets, rest @ ..` * `DatasetAlias` → `airflow.sdk.AssetAlias` * `DatasetAll` → `airflow.sdk.AssetAll` * `DatasetAny` → `airflow.sdk.AssetAny` * `expand_alias_to_datasets` → `airflow.sdk.expand_alias_to_assets` * `metadata.Metadata` → `airflow.sdk.Metadata` <!--airflow.models.baseoperator--> * `airflow.models.baseoperator.chain` → `airflow.sdk.chain` * `airflow.models.baseoperator.chain_linear` → `airflow.sdk.chain_linear` * `airflow.models.baseoperator.cross_downstream` → `airflow.sdk.cross_downstream` * `airflow.models.baseoperatorlink.BaseOperatorLink` → `airflow.sdk.definitions.baseoperatorlink.BaseOperatorLink` * `airflow.timetables, rest @ ..` * `datasets.DatasetOrTimeSchedule` → * `airflow.timetables.assets.AssetOrTimeSchedule` * `airflow.utils, rest @ ..` <!--airflow.utils.dag_parsing_context--> * `dag_parsing_context.get_parsing_context` → `airflow.sdk.get_parsing_context` ## Test Plan <!-- How was it tested? --> The test fixture has been updated acccordingly
242 lines
5.5 KiB
Python
242 lines
5.5 KiB
Python
from __future__ import annotations
|
|
|
|
from airflow import (
|
|
PY36,
|
|
PY37,
|
|
PY38,
|
|
PY39,
|
|
PY310,
|
|
PY311,
|
|
PY312,
|
|
)
|
|
from airflow.api_connexion.security import requires_access, requires_access_dataset
|
|
from airflow.auth.managers.base_auth_manager import is_authorized_dataset
|
|
from airflow.auth.managers.models.resource_details import DatasetDetails
|
|
from airflow.configuration import (
|
|
as_dict,
|
|
get,
|
|
getboolean,
|
|
getfloat,
|
|
getint,
|
|
has_option,
|
|
remove_option,
|
|
set,
|
|
)
|
|
from airflow.contrib.aws_athena_hook import AWSAthenaHook
|
|
from airflow.datasets import DatasetAliasEvent
|
|
from airflow.datasets.manager import (
|
|
DatasetManager,
|
|
dataset_manager,
|
|
resolve_dataset_manager,
|
|
)
|
|
from airflow.hooks.base_hook import BaseHook
|
|
from airflow.lineage.hook import DatasetLineageInfo
|
|
from airflow.listeners.spec.dataset import on_dataset_changed, on_dataset_created
|
|
from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
|
from airflow.operators.subdag import SubDagOperator
|
|
from airflow.providers.amazon.aws.auth_manager.avp.entities import AvpEntities
|
|
from airflow.providers.amazon.aws.datasets import s3
|
|
from airflow.providers.common.io.datasets import file as common_io_file
|
|
from airflow.providers.fab.auth_manager import fab_auth_manager
|
|
from airflow.providers.google.datasets import bigquery, gcs
|
|
from airflow.providers.mysql.datasets import mysql
|
|
from airflow.providers.openlineage.utils.utils import (
|
|
DatasetInfo,
|
|
translate_airflow_dataset,
|
|
)
|
|
from airflow.providers.postgres.datasets import postgres
|
|
from airflow.providers.trino.datasets import trino
|
|
from airflow.secrets.local_filesystem import LocalFilesystemBackend, load_connections
|
|
from airflow.security.permissions import RESOURCE_DATASET
|
|
from airflow.sensors.base_sensor_operator import BaseSensorOperator
|
|
from airflow.timetables.simple import DatasetTriggeredTimetable
|
|
from airflow.triggers.external_task import TaskStateTrigger
|
|
from airflow.utils import dates
|
|
from airflow.utils.dag_cycle_tester import test_cycle
|
|
from airflow.utils.dates import (
|
|
date_range,
|
|
datetime_to_nano,
|
|
days_ago,
|
|
infer_time_unit,
|
|
parse_execution_date,
|
|
round_time,
|
|
scale_time_units,
|
|
)
|
|
from airflow.utils.db import create_session
|
|
from airflow.utils.decorators import apply_defaults
|
|
from airflow.utils.file import TemporaryDirectory, mkdirs
|
|
from airflow.utils.helpers import chain as helper_chain
|
|
from airflow.utils.helpers import cross_downstream as helper_cross_downstream
|
|
from airflow.utils.log import secrets_masker
|
|
from airflow.utils.state import SHUTDOWN, terminating_states
|
|
from airflow.utils.trigger_rule import TriggerRule
|
|
from airflow.www.auth import has_access, has_access_dataset
|
|
from airflow.www.utils import get_sensitive_variables_fields, should_hide_value_for_key
|
|
|
|
# airflow root
|
|
PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
|
DatasetFromRoot()
|
|
|
|
# airflow.api_connexion.security
|
|
requires_access, requires_access_dataset
|
|
|
|
# airflow.auth.managers
|
|
is_authorized_dataset
|
|
DatasetDetails()
|
|
|
|
# airflow.configuration
|
|
get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
|
|
|
|
|
# airflow.contrib.*
|
|
AWSAthenaHook()
|
|
|
|
|
|
# airflow.datasets
|
|
DatasetAliasEvent()
|
|
|
|
# airflow.datasets.manager
|
|
DatasetManager()
|
|
dataset_manager
|
|
resolve_dataset_manager
|
|
|
|
# airflow.hooks
|
|
BaseHook()
|
|
|
|
# airflow.lineage.hook
|
|
DatasetLineageInfo()
|
|
|
|
# airflow.listeners.spec.dataset
|
|
on_dataset_changed
|
|
on_dataset_created
|
|
|
|
# airflow.metrics.validators
|
|
AllowListValidator()
|
|
BlockListValidator()
|
|
|
|
|
|
# airflow.operators.branch_operator
|
|
BaseBranchOperator()
|
|
|
|
# airflow.operators.dagrun_operator
|
|
TriggerDagRunLink()
|
|
TriggerDagRunOperator()
|
|
|
|
# airflow.operators.email_operator
|
|
EmailOperator()
|
|
|
|
# airflow.operators.latest_only_operator
|
|
LatestOnlyOperator()
|
|
|
|
# airflow.operators.python_operator
|
|
BranchPythonOperator()
|
|
PythonOperator()
|
|
PythonVirtualenvOperator()
|
|
ShortCircuitOperator()
|
|
|
|
# airflow.operators.subdag.*
|
|
SubDagOperator()
|
|
|
|
# airflow.providers.amazon
|
|
AvpEntities.DATASET
|
|
s3.create_dataset
|
|
s3.convert_dataset_to_openlineage
|
|
s3.sanitize_uri
|
|
|
|
# airflow.providers.common.io
|
|
common_io_file.convert_dataset_to_openlineage
|
|
common_io_file.create_dataset
|
|
common_io_file.sanitize_uri
|
|
|
|
# airflow.providers.fab
|
|
fab_auth_manager.is_authorized_dataset
|
|
|
|
# airflow.providers.google
|
|
bigquery.sanitize_uri
|
|
|
|
gcs.create_dataset
|
|
gcs.sanitize_uri
|
|
gcs.convert_dataset_to_openlineage
|
|
|
|
# airflow.providers.mysql
|
|
mysql.sanitize_uri
|
|
|
|
# airflow.providers.openlineage
|
|
DatasetInfo()
|
|
translate_airflow_dataset
|
|
|
|
# airflow.providers.postgres
|
|
postgres.sanitize_uri
|
|
|
|
# airflow.providers.trino
|
|
trino.sanitize_uri
|
|
|
|
# airflow.secrets
|
|
# get_connection
|
|
LocalFilesystemBackend()
|
|
load_connections
|
|
|
|
# airflow.security.permissions
|
|
RESOURCE_DATASET
|
|
|
|
# airflow.sensors.base_sensor_operator
|
|
BaseSensorOperator()
|
|
|
|
|
|
# airflow.timetables
|
|
DatasetTriggeredTimetable()
|
|
|
|
# airflow.triggers.external_task
|
|
TaskStateTrigger()
|
|
|
|
# airflow.utils.date
|
|
dates.date_range
|
|
dates.days_ago
|
|
|
|
date_range
|
|
days_ago
|
|
infer_time_unit
|
|
parse_execution_date
|
|
round_time
|
|
scale_time_units
|
|
|
|
# This one was not deprecated.
|
|
datetime_to_nano
|
|
dates.datetime_to_nano
|
|
|
|
# airflow.utils.dag_cycle_tester
|
|
test_cycle
|
|
|
|
|
|
# airflow.utils.db
|
|
create_session
|
|
|
|
# airflow.utils.decorators
|
|
apply_defaults
|
|
|
|
# airflow.utils.file
|
|
TemporaryDirectory()
|
|
mkdirs
|
|
|
|
# airflow.utils.helpers
|
|
helper_chain
|
|
helper_cross_downstream
|
|
|
|
# airflow.utils.log
|
|
secrets_masker
|
|
|
|
# airflow.utils.state
|
|
SHUTDOWN
|
|
terminating_states
|
|
|
|
# airflow.utils.trigger_rule
|
|
TriggerRule.DUMMY
|
|
TriggerRule.NONE_FAILED_OR_SKIPPED
|
|
|
|
# airflow.www.auth
|
|
has_access
|
|
has_access_dataset
|
|
|
|
# airflow.www.utils
|
|
get_sensitive_variables_fields
|
|
should_hide_value_for_key
|