Skip to content

Commit

Permalink
Enable & Fix Whitespace related PyDocStyle Checks (#9458)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaxil committed Jun 21, 2020
1 parent 74f7db0 commit e13a14c
Show file tree
Hide file tree
Showing 40 changed files with 158 additions and 123 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ metastore_browser/templates/.*\\.html$|.*\\.jinja2"
hooks:
- id: pydocstyle
args:
- --select=D300,D301,D302,D101
- --select=D300,D301,D302,D101,D201,D206,D207,D208,D209,D211,D414
exclude: ^tests/.*\.py$|^scripts/.*\.py$|^dev|^backport_packages|^kubernetes_tests
- repo: local
hooks:
Expand Down
4 changes: 2 additions & 2 deletions airflow/api/common/experimental/mark_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ def get_all_dag_task_query(dag, session, state, task_ids, confirmed_dates):

def get_subdag_runs(dag, session, state, task_ids, commit, confirmed_dates):
"""Go through subdag operators and create dag runs. We will only work
within the scope of the subdag. We wont propagate to the parent dag,
but we will propagate from parent to subdag.
within the scope of the subdag. We wont propagate to the parent dag,
but we will propagate from parent to subdag.
"""
dags = [dag]
sub_dag_ids = []
Expand Down
4 changes: 3 additions & 1 deletion airflow/contrib/hooks/azure_container_instance_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
# specific language governing permissions and limitations
# under the License.
"""This module is deprecated.
Please use `airflow.providers.microsoft.azure.hooks.azure_container_instance`."""
Please use `airflow.providers.microsoft.azure.hooks.azure_container_instance`.
"""

import warnings

Expand Down
6 changes: 3 additions & 3 deletions airflow/contrib/operators/awsbatch_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

"""This module is deprecated. Please use:
- `airflow.providers.amazon.aws.operators.batch`
- `airflow.providers.amazon.aws.hooks.batch_client`
- `airflow.providers.amazon.aws.hooks.batch_waiters`
- `airflow.providers.amazon.aws.operators.batch`
- `airflow.providers.amazon.aws.hooks.batch_client`
- `airflow.providers.amazon.aws.hooks.batch_waiters``
"""

import warnings
Expand Down
12 changes: 8 additions & 4 deletions airflow/contrib/operators/oracle_to_oracle_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""This module is deprecated. Please use `airflow.providers.oracle.transfers.oracle_to_oracle`."""
"""This module is deprecated.
Please use `airflow.providers.oracle.transfers.oracle_to_oracle`.
"""

import warnings

Expand All @@ -29,10 +32,11 @@


class OracleToOracleTransfer(OracleToOracleOperator):
"""
This class is deprecated.
"""This class is deprecated.
Please use:
`airflow.providers.oracle.transfers.oracle_to_oracle.OracleToOracleOperator`."""
`airflow.providers.oracle.transfers.oracle_to_oracle.OracleToOracleOperator`.
"""

def __init__(self, *args, **kwargs):
warnings.warn(
Expand Down
24 changes: 13 additions & 11 deletions airflow/contrib/operators/pubsub_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
# specific language governing permissions and limitations
# under the License.
"""This module is deprecated.
Please use `airflow.providers.google.cloud.operators.pubsub`."""
Please use `airflow.providers.google.cloud.operators.pubsub`.
"""

import warnings

Expand All @@ -34,8 +36,8 @@


class PubSubPublishOperator(PubSubPublishMessageOperator):
"""
This class is deprecated.
"""This class is deprecated.
Please use `airflow.providers.google.cloud.operators.pubsub.PubSubPublishMessageOperator`.
"""

Expand All @@ -50,8 +52,8 @@ def __init__(self, *args, **kwargs):


class PubSubSubscriptionCreateOperator(PubSubCreateSubscriptionOperator):
"""
This class is deprecated.
"""This class is deprecated.
Please use `airflow.providers.google.cloud.operators.pubsub.PubSubCreateSubscriptionOperator`.
"""

Expand All @@ -66,8 +68,8 @@ def __init__(self, *args, **kwargs):


class PubSubSubscriptionDeleteOperator(PubSubDeleteSubscriptionOperator):
"""
This class is deprecated.
"""This class is deprecated.
Please use `airflow.providers.google.cloud.operators.pubsub.PubSubDeleteSubscriptionOperator`.
"""

Expand All @@ -82,8 +84,8 @@ def __init__(self, *args, **kwargs):


class PubSubTopicCreateOperator(PubSubCreateTopicOperator):
"""
This class is deprecated.
"""This class is deprecated.
Please use `airflow.providers.google.cloud.operators.pubsub.PubSubCreateTopicOperator`.
"""

Expand All @@ -98,8 +100,8 @@ def __init__(self, *args, **kwargs):


class PubSubTopicDeleteOperator(PubSubDeleteTopicOperator):
"""
This class is deprecated.
"""This class is deprecated.
Please use `airflow.providers.google.cloud.operators.pubsub.PubSubDeleteTopicOperator`.
"""

Expand Down
12 changes: 8 additions & 4 deletions airflow/contrib/operators/vertica_to_hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""This module is deprecated. Please use `airflow.providers.apache.hive.transfers.vertica_to_hive`."""
"""This module is deprecated.
Please use `airflow.providers.apache.hive.transfers.vertica_to_hive`.
"""

import warnings

Expand All @@ -28,10 +31,11 @@


class VerticaToHiveTransfer(VerticaToHiveOperator):
"""
This class is deprecated.
"""This class is deprecated.
Please use:
`airflow.providers.apache.hive.transfers.vertica_to_hive.VerticaToHiveOperator`."""
`airflow.providers.apache.hive.transfers.vertica_to_hive.VerticaToHiveOperator`.
"""

def __init__(self, *args, **kwargs):
warnings.warn(
Expand Down
12 changes: 8 additions & 4 deletions airflow/contrib/operators/vertica_to_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""This module is deprecated. Please use `airflow.providers.mysql.transfers.vertica_to_mysql`."""
"""This module is deprecated.
Please use `airflow.providers.mysql.transfers.vertica_to_mysql`.
"""

import warnings

Expand All @@ -29,10 +32,11 @@


class VerticaToMySqlTransfer(VerticaToMySqlOperator):
"""
This class is deprecated.
"""This class is deprecated.
Please use:
`airflow.providers.mysql.transfers.vertica_to_mysql.VerticaToMySqlOperator`."""
`airflow.providers.mysql.transfers.vertica_to_mysql.VerticaToMySqlOperator`.
"""

def __init__(self, *args, **kwargs):
warnings.warn(
Expand Down
8 changes: 5 additions & 3 deletions airflow/contrib/sensors/gcp_transfer_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
# specific language governing permissions and limitations
# under the License.
"""This module is deprecated.
Please use `airflow.providers.google.cloud.sensors.cloud_storage_transfer_service`."""
Please use `airflow.providers.google.cloud.sensors.cloud_storage_transfer_service`.
"""

import warnings

Expand All @@ -32,8 +34,8 @@


class GCPTransferServiceWaitForJobStatusSensor(CloudDataTransferServiceJobStatusSensor):
"""
This class is deprecated.
"""This class is deprecated.
Please use `airflow.providers.google.cloud.sensors.transfer.CloudDataTransferServiceJobStatusSensor`.
"""
def __init__(self, *args, **kwargs):
Expand Down
19 changes: 12 additions & 7 deletions airflow/contrib/sensors/hdfs_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""This module is deprecated. Please use `airflow.providers.apache.hdfs.sensors.hdfs`."""
"""This module is deprecated.
Please use `airflow.providers.apache.hdfs.sensors.hdfs`.
"""

import warnings

Expand All @@ -30,10 +33,11 @@

# pylint: disable=too-many-ancestors
class HdfsSensorFolder(HdfsFolderSensor):
"""
This class is deprecated.
"""This class is deprecated.
Please use:
`airflow.providers.apache.hdfs.sensors.hdfs.HdfsFolderSensor`."""
`airflow.providers.apache.hdfs.sensors.hdfs.HdfsFolderSensor`.
"""

def __init__(self, *args, **kwargs):
warnings.warn(
Expand All @@ -47,10 +51,11 @@ def __init__(self, *args, **kwargs):

# pylint: disable=too-many-ancestors
class HdfsSensorRegex(HdfsRegexSensor):
"""
This class is deprecated.
"""This class is deprecated.
Please use:
`airflow.providers.apache.hdfs.sensors.hdfs.HdfsRegexSensor`."""
`airflow.providers.apache.hdfs.sensors.hdfs.HdfsRegexSensor`.
"""

def __init__(self, *args, **kwargs):
warnings.warn(
Expand Down
4 changes: 3 additions & 1 deletion airflow/contrib/utils/mlengine_prediction_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
# specific language governing permissions and limitations
# under the License.
"""This module is deprecated.
Please use `airflow.providers.google.cloud.utils.mlengine_prediction_summary`."""
Please use `airflow.providers.google.cloud.utils.mlengine_prediction_summary`.
"""

import warnings

Expand Down
2 changes: 1 addition & 1 deletion airflow/executors/local_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def execute_async(self,
:param command: the command to execute
:param queue: name of the queue
:param executor_config: configuration for the executor
"""
"""
if not self.queue:
raise AirflowException(NOT_STARTED_MESSAGE)
self.queue.put((key, command))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,17 @@ def downgrade():

def get_table_constraints(conn, table_name):
"""
This function return primary and unique constraint
along with column name. some tables like task_instance
is missing primary key constraint name and the name is
auto-generated by sql server. so this function helps to
retrieve any primary or unique constraint name.
:param conn: sql connection object
:param table_name: table name
:return: a dictionary of ((constraint name, constraint type), column name) of table
:rtype: defaultdict(list)
"""
This function return primary and unique constraint
along with column name. some tables like task_instance
is missing primary key constraint name and the name is
auto-generated by sql server. so this function helps to
retrieve any primary or unique constraint name.
:param conn: sql connection object
:param table_name: table name
:return: a dictionary of ((constraint name, constraint type), column name) of table
:rtype: defaultdict(list)
"""
query = """SELECT tc.CONSTRAINT_NAME , tc.CONSTRAINT_TYPE, ccu.COLUMN_NAME
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS tc
JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE AS ccu ON ccu.CONSTRAINT_NAME = tc.CONSTRAINT_NAME
Expand Down Expand Up @@ -305,18 +305,18 @@ def create_constraint(operator, constraint_dict):

def modify_execution_date_with_constraint(conn, batch_operator, table_name, type_, nullable):
"""
Helper function changes type of column execution_date by
dropping and recreating any primary/unique constraint associated with
the column
:param conn: sql connection object
:param batch_operator: batch_alter_table for the table
:param table_name: table name
:param type_: DB column type
:param nullable: nullable (boolean)
:return: a dictionary of ((constraint name, constraint type), column name) of table
:rtype: defaultdict(list)
"""
Helper function changes type of column execution_date by
dropping and recreating any primary/unique constraint associated with
the column
:param conn: sql connection object
:param batch_operator: batch_alter_table for the table
:param table_name: table name
:param type_: DB column type
:param nullable: nullable (boolean)
:return: a dictionary of ((constraint name, constraint type), column name) of table
:rtype: defaultdict(list)
"""
constraint_dict = get_table_constraints(conn, table_name)
drop_constraint(batch_operator, constraint_dict)
batch_operator.alter_column(
Expand Down
11 changes: 6 additions & 5 deletions airflow/operators/google_api_to_s3_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""
This module is deprecated.
"""This module is deprecated.
Please use `airflow.providers.amazon.aws.transfers.google_api_to_s3`.
"""

Expand All @@ -32,10 +32,11 @@


class GoogleApiToS3Transfer(GoogleApiToS3Operator):
"""
This class is deprecated.
"""This class is deprecated.
Please use:
`airflow.providers.amazon.aws.transfers.google_api_to_s3.GoogleApiToS3Operator`."""
`airflow.providers.amazon.aws.transfers.google_api_to_s3.GoogleApiToS3Operator`.
"""

def __init__(self, *args, **kwargs):
warnings.warn(
Expand Down
12 changes: 8 additions & 4 deletions airflow/operators/hive_to_druid.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""This module is deprecated. Please use `airflow.providers.apache.druid.transfers.hive_to_druid`."""
"""This module is deprecated.
Please use `airflow.providers.apache.druid.transfers.hive_to_druid`.
"""

import warnings

Expand All @@ -29,10 +32,11 @@


class HiveToDruidTransfer(HiveToDruidOperator):
"""
This class is deprecated.
"""This class is deprecated.
Please use:
`airflow.providers.apache.druid.transfers.hive_to_druid.HiveToDruidOperator`."""
`airflow.providers.apache.druid.transfers.hive_to_druid.HiveToDruidOperator`.
"""

def __init__(self, *args, **kwargs):
warnings.warn(
Expand Down

0 comments on commit e13a14c

Please sign in to comment.