mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
[Airflow
] Make AIR312
example error out-of-the-box (#18989)
## Summary Part of #18972 This PR makes [airflow3-suggested-to-move-to-provider (AIR312)](https://docs.astral.sh/ruff/rules/airflow3-suggested-to-move-to-provider/#airflow3-suggested-to-move-to-provider-air312)'s example error out-of-the-box [Old example](https://play.ruff.rs/1be0d654-1ed5-4a0b-8791-cc5db73333d5) ```py from airflow.operators.python import PythonOperator ``` [New example](https://play.ruff.rs/b6260206-fa19-4ab2-8d45-ddd43c46a759) ```py from airflow.operators.python import PythonOperator def print_context(ds=None, **kwargs): print(kwargs) print(ds) print_the_context = PythonOperator( task_id="print_the_context", python_callable=print_context ) ``` ## Test Plan <!-- How was it tested? --> N/A, no functionality/tests affected
This commit is contained in:
parent
315adba906
commit
68f98cfcd8
1 changed files with 20 additions and 0 deletions
|
@ -24,11 +24,31 @@ use ruff_text_size::TextRange;
|
|||
/// ## Example
|
||||
/// ```python
|
||||
/// from airflow.operators.python import PythonOperator
|
||||
///
|
||||
///
|
||||
/// def print_context(ds=None, **kwargs):
|
||||
/// print(kwargs)
|
||||
/// print(ds)
|
||||
///
|
||||
///
|
||||
/// print_the_context = PythonOperator(
|
||||
/// task_id="print_the_context", python_callable=print_context
|
||||
/// )
|
||||
/// ```
|
||||
///
|
||||
/// Use instead:
|
||||
/// ```python
|
||||
/// from airflow.providers.standard.operators.python import PythonOperator
|
||||
///
|
||||
///
|
||||
/// def print_context(ds=None, **kwargs):
|
||||
/// print(kwargs)
|
||||
/// print(ds)
|
||||
///
|
||||
///
|
||||
/// print_the_context = PythonOperator(
|
||||
/// task_id="print_the_context", python_callable=print_context
|
||||
/// )
|
||||
/// ```
|
||||
#[derive(ViolationMetadata)]
|
||||
pub(crate) struct Airflow3SuggestedToMoveToProvider<'a> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue