Skip to content
6 changes: 3 additions & 3 deletions airflow/providers/airbyte/hooks/airbyte.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

class AirbyteHook(HttpHook):
"""
Hook for Airbyte API
Hook for Airbyte API.

:param airbyte_conn_id: Optional. The name of the Airflow connection to get
connection information for Airbyte. Defaults to "airbyte_default".
Expand Down Expand Up @@ -109,7 +109,7 @@ def get_job(self, job_id: int) -> Any:

def cancel_job(self, job_id: int) -> Any:
"""
Cancel the job when task is cancelled
Cancel the job when task is cancelled.

:param job_id: Required. Id of the Airbyte job
"""
Expand All @@ -120,7 +120,7 @@ def cancel_job(self, job_id: int) -> Any:
)

def test_connection(self):
"""Tests the Airbyte connection by hitting the health API"""
"""Tests the Airbyte connection by hitting the health API."""
self.method = "GET"
try:
res = self.run(
Expand Down
4 changes: 2 additions & 2 deletions airflow/providers/airbyte/operators/airbyte.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(
self.asynchronous = asynchronous

def execute(self, context: Context) -> None:
"""Create Airbyte Job and wait to finish"""
"""Create Airbyte Job and wait to finish."""
self.hook = AirbyteHook(airbyte_conn_id=self.airbyte_conn_id, api_version=self.api_version)
job_object = self.hook.submit_sync_connection(connection_id=self.connection_id)
self.job_id = job_object.json()["job"]["id"]
Expand All @@ -83,7 +83,7 @@ def execute(self, context: Context) -> None:
return self.job_id

def on_kill(self):
"""Cancel the job if task is cancelled"""
"""Cancel the job if task is cancelled."""
if self.job_id:
self.log.info("on_kill: cancel the airbyte Job %s", self.job_id)
self.hook.cancel_job(self.job_id)
24 changes: 12 additions & 12 deletions airflow/providers/alibaba/cloud/hooks/oss.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def object_exists(self, key: str, bucket_name: str | None = None) -> bool:
@provide_bucket_name
def get_bucket(self, bucket_name: str | None = None) -> oss2.api.Bucket:
"""
Returns a oss2.Bucket object
Returns a oss2.Bucket object.

:param bucket_name: the name of the bucket
:return: the bucket object to the bucket name.
Expand All @@ -150,7 +150,7 @@ def get_bucket(self, bucket_name: str | None = None) -> oss2.api.Bucket:
@unify_bucket_name_and_key
def load_string(self, key: str, content: str, bucket_name: str | None = None) -> None:
"""
Loads a string to OSS
Loads a string to OSS.

:param key: the path of the object
:param content: str to set as content for the key.
Expand All @@ -170,7 +170,7 @@ def upload_local_file(
bucket_name: str | None = None,
) -> None:
"""
Upload a local file to OSS
Upload a local file to OSS.

:param key: the OSS path of the object
:param file: local file to upload.
Expand All @@ -190,7 +190,7 @@ def download_file(
bucket_name: str | None = None,
) -> str | None:
"""
Download file from OSS
Download file from OSS.

:param key: key of the file-like object to download.
:param local_file: local path + file name to save.
Expand All @@ -212,7 +212,7 @@ def delete_object(
bucket_name: str | None = None,
) -> None:
"""
Delete object from OSS
Delete object from OSS.

:param key: key of the object to delete.
:param bucket_name: the name of the bucket
Expand All @@ -231,7 +231,7 @@ def delete_objects(
bucket_name: str | None = None,
) -> None:
"""
Delete objects from OSS
Delete objects from OSS.

:param key: keys list of the objects to delete.
:param bucket_name: the name of the bucket
Expand All @@ -248,7 +248,7 @@ def delete_bucket(
bucket_name: str | None = None,
) -> None:
"""
Delete bucket from OSS
Delete bucket from OSS.

:param bucket_name: the name of the bucket
"""
Expand All @@ -264,7 +264,7 @@ def create_bucket(
bucket_name: str | None = None,
) -> None:
"""
Create bucket
Create bucket.

:param bucket_name: the name of the bucket
"""
Expand All @@ -278,7 +278,7 @@ def create_bucket(
@unify_bucket_name_and_key
def append_string(self, bucket_name: str | None, content: str, key: str, pos: int) -> None:
"""
Append string to a remote existing file
Append string to a remote existing file.

:param bucket_name: the name of the bucket
:param content: content to be appended
Expand All @@ -296,7 +296,7 @@ def append_string(self, bucket_name: str | None, content: str, key: str, pos: in
@unify_bucket_name_and_key
def read_key(self, bucket_name: str | None, key: str) -> str:
"""
Read oss remote object content with the specified key
Read oss remote object content with the specified key.

:param bucket_name: the name of the bucket
:param key: oss bucket key
Expand All @@ -312,7 +312,7 @@ def read_key(self, bucket_name: str | None, key: str) -> str:
@unify_bucket_name_and_key
def head_key(self, bucket_name: str | None, key: str) -> oss2.models.HeadObjectResult:
"""
Get meta info of the specified remote object
Get meta info of the specified remote object.

:param bucket_name: the name of the bucket
:param key: oss bucket key
Expand All @@ -328,7 +328,7 @@ def head_key(self, bucket_name: str | None, key: str) -> oss2.models.HeadObjectR
@unify_bucket_name_and_key
def key_exist(self, bucket_name: str | None, key: str) -> bool:
"""
Find out whether the specified key exists in the oss remote storage
Find out whether the specified key exists in the oss remote storage.

:param bucket_name: the name of the bucket
:param key: oss bucket key
Expand Down
7 changes: 4 additions & 3 deletions airflow/providers/alibaba/cloud/log/oss_task_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@


def get_default_delete_local_copy():
"""Load delete_local_logs conf if Airflow version > 2.6 and return False if not
"""Load delete_local_logs conf if Airflow version > 2.6 and return False if not.

TODO: delete this function when min airflow version >= 2.6
"""
from airflow.version import version
Expand Down Expand Up @@ -77,7 +78,7 @@ def hook(self):
)

def set_context(self, ti):
"""This function is used to set the context of the handler"""
"""This function is used to set the context of the handler."""
super().set_context(ti)
# Local location and remote location is needed to open and
# upload local log file to OSS remote storage.
Expand Down Expand Up @@ -143,7 +144,7 @@ def _read(self, ti, try_number, metadata=None):

def oss_log_exists(self, remote_log_location):
"""
Check if remote_log_location exists in remote storage
Check if remote_log_location exists in remote storage.

:param remote_log_location: log's location in remote storage
:return: True if location exists else False
Expand Down
12 changes: 6 additions & 6 deletions airflow/providers/alibaba/cloud/operators/oss.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

class OSSCreateBucketOperator(BaseOperator):
"""
This operator creates an OSS bucket
This operator creates an OSS bucket.

:param region: OSS region you want to create bucket
:param bucket_name: This is bucket name you want to create
Expand All @@ -55,7 +55,7 @@ def execute(self, context: Context):

class OSSDeleteBucketOperator(BaseOperator):
"""
This operator to delete an OSS bucket
This operator to delete an OSS bucket.

:param region: OSS region you want to create bucket
:param bucket_name: This is bucket name you want to delete
Expand All @@ -81,7 +81,7 @@ def execute(self, context: Context):

class OSSUploadObjectOperator(BaseOperator):
"""
This operator to upload an file-like object
This operator to upload an file-like object.

:param key: the OSS path of the object
:param file: local file to upload.
Expand Down Expand Up @@ -113,7 +113,7 @@ def execute(self, context: Context):

class OSSDownloadObjectOperator(BaseOperator):
"""
This operator to Download an OSS object
This operator to Download an OSS object.

:param key: key of the object to download.
:param local_file: local path + file name to save.
Expand Down Expand Up @@ -145,7 +145,7 @@ def execute(self, context: Context):

class OSSDeleteBatchObjectOperator(BaseOperator):
"""
This operator to delete OSS objects
This operator to delete OSS objects.

:param key: key list of the objects to delete.
:param region: OSS region
Expand Down Expand Up @@ -174,7 +174,7 @@ def execute(self, context: Context):

class OSSDeleteObjectOperator(BaseOperator):
"""
This operator to delete an OSS object
This operator to delete an OSS object.

:param key: key of the object to delete.
:param region: OSS region
Expand Down
9 changes: 5 additions & 4 deletions airflow/providers/alibaba/cloud/sensors/oss_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ def __init__(
def poke(self, context: Context):
"""
Check if the object exists in the bucket to pull key.
@param self - the object itself
@param context - the context of the object
@returns True if the object exists, False otherwise

:param self: the object itself
:param context: the context of the object
:returns: True if the object exists, False otherwise
"""
if self.bucket_name is None:
parsed_url = urlsplit(self.bucket_key)
Expand All @@ -88,7 +89,7 @@ def poke(self, context: Context):

@cached_property
def get_hook(self) -> OSSHook:
"""Create and return an OSSHook"""
"""Create and return an OSSHook."""
if self.hook:
return self.hook

Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/arangodb/operators/arangodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

class AQLOperator(BaseOperator):
"""
Executes AQL query in a ArangoDB database
Executes AQL query in a ArangoDB database.

.. seealso::
For more information on how to use this operator, take a look at the guide:
Expand Down
3 changes: 1 addition & 2 deletions airflow/providers/arangodb/sensors/arangodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

class AQLSensor(BaseSensorOperator):
"""
Checks for the existence of a document which
matches the given query in ArangoDB. Example:
Checks for the existence of a document which matches the given query in ArangoDB.

:param collection: Target DB collection.
:param query: The query to poke, or you can provide .sql file having the query
Expand Down
8 changes: 4 additions & 4 deletions airflow/providers/asana/hooks/asana.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def get_conn(self) -> Client:

@staticmethod
def get_connection_form_widgets() -> dict[str, Any]:
"""Returns connection widgets to add to connection form"""
"""Returns connection widgets to add to connection form."""
from flask_appbuilder.fieldwidgets import BS3TextFieldWidget
from flask_babel import lazy_gettext
from wtforms import StringField
Expand All @@ -101,7 +101,7 @@ def get_connection_form_widgets() -> dict[str, Any]:
@staticmethod
@_ensure_prefixes(conn_type="asana")
def get_ui_field_behaviour() -> dict[str, Any]:
"""Returns custom field behaviour"""
"""Returns custom field behaviour."""
return {
"hidden_fields": ["port", "host", "login", "schema"],
"relabeling": {},
Expand All @@ -114,7 +114,7 @@ def get_ui_field_behaviour() -> dict[str, Any]:

@cached_property
def client(self) -> Client:
"""Instantiates python-asana Client"""
"""Instantiates python-asana Client."""
if not self.connection.password:
raise ValueError(
"Asana connection password must contain a personal access token: "
Expand Down Expand Up @@ -261,7 +261,7 @@ def create_project(self, params: dict) -> dict:
@staticmethod
def _validate_create_project_parameters(params: dict) -> None:
"""
Check that user provided the minimum required parameters for project creation
Check that user provided the minimum required parameters for project creation.

:param params: Attributes that the new project should have
:return: None; raises a ValueError if `params` does not contain the minimum required attributes.
Expand Down
4 changes: 2 additions & 2 deletions airflow/providers/asana/operators/asana_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class AsanaCreateTaskOperator(BaseOperator):
"""
This operator can be used to create Asana tasks. For more information on
Asana optional task parameters, see https://developers.asana.com/docs/create-a-task
Asana optional task parameters, see https://developers.asana.com/docs/create-a-task.

.. seealso::
For more information on how to use this operator, take a look at the guide:
Expand Down Expand Up @@ -68,7 +68,7 @@ class AsanaUpdateTaskOperator(BaseOperator):
"""
This operator can be used to update Asana tasks.
For more information on Asana optional task parameters, see
https://developers.asana.com/docs/update-a-task
https://developers.asana.com/docs/update-a-task.

.. seealso::
For more information on how to use this operator, take a look at the guide:
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/atlassian/jira/hooks/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""Hook for JIRA"""
"""Hook for JIRA."""
from __future__ import annotations

from typing import Any
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/atlassian/jira/operators/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class JiraOperator(BaseOperator):
"""
JiraOperator to interact and perform action on Jira issue tracking system.
This operator is designed to use Atlassian Jira SDK: https://atlassian-python-api.readthedocs.io/jira.html
This operator is designed to use Atlassian Jira SDK: https://atlassian-python-api.readthedocs.io/jira.html.

:param jira_conn_id: Reference to a pre-defined Jira Connection.
:param jira_method: Method name from Atlassian Jira Python SDK to be called.
Expand Down
4 changes: 2 additions & 2 deletions airflow/providers/cloudant/hooks/cloudant.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""Hook for Cloudant"""
"""Hook for Cloudant."""
from __future__ import annotations

from typing import Any
Expand All @@ -42,7 +42,7 @@ class CloudantHook(BaseHook):

@staticmethod
def get_ui_field_behaviour() -> dict[str, Any]:
"""Returns custom field behaviour"""
"""Returns custom field behaviour."""
return {
"hidden_fields": ["port", "extra"],
"relabeling": {"host": "Account", "login": "Username (or API Key)", "schema": "Database"},
Expand Down
Loading