Skip to content

Commit

Permalink
PyDocStyle: No whitespaces allowed surrounding docstring text (#10533)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaxil committed Aug 25, 2020
1 parent 133837c commit d760265
Show file tree
Hide file tree
Showing 42 changed files with 107 additions and 108 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Expand Up @@ -192,7 +192,7 @@ repos:
name: Run pydocstyle
args:
- --convention=pep257
- --add-ignore=D100,D102,D104,D105,D106,D107,D200,D202,D204,D205,D207,D208,D210,D400,D401
- --add-ignore=D100,D102,D104,D105,D106,D107,D200,D202,D204,D205,D207,D208,D400,D401
exclude: ^tests/.*\.py$|^scripts/.*\.py$|^dev|^backport_packages|^kubernetes_tests
- repo: local
hooks:
Expand Down
2 changes: 1 addition & 1 deletion airflow/api/auth/backend/kerberos_auth.py
Expand Up @@ -60,7 +60,7 @@


class KerberosService: # pylint: disable=too-few-public-methods
"""Class to keep information about the Kerberos Service initialized """
"""Class to keep information about the Kerberos Service initialized"""
def __init__(self):
self.service_name = None

Expand Down
12 changes: 6 additions & 6 deletions airflow/api_connexion/schemas/config_schema.py
Expand Up @@ -21,36 +21,36 @@


class ConfigOptionSchema(Schema):
""" Config Option Schema """
"""Config Option Schema"""
key = fields.String(required=True)
value = fields.String(required=True)


class ConfigOption(NamedTuple):
""" Config option """
"""Config option"""
key: str
value: str


class ConfigSectionSchema(Schema):
""" Config Section Schema"""
"""Config Section Schema"""
name = fields.String(required=True)
options = fields.List(fields.Nested(ConfigOptionSchema))


class ConfigSection(NamedTuple):
""" List of config options within a section """
"""List of config options within a section"""
name: str
options: List[ConfigOption]


class ConfigSchema(Schema):
""" Config Schema"""
"""Config Schema"""
sections = fields.List(fields.Nested(ConfigSectionSchema))


class Config(NamedTuple):
""" List of config sections with their options """
"""List of config sections with their options"""
sections: List[ConfigSection]


Expand Down
6 changes: 3 additions & 3 deletions airflow/api_connexion/schemas/connection_schema.py
Expand Up @@ -29,7 +29,7 @@ class ConnectionCollectionItemSchema(SQLAlchemySchema):
"""

class Meta:
""" Meta """
"""Meta"""
model = Connection

connection_id = auto_field('conn_id', required=True)
Expand All @@ -50,13 +50,13 @@ class ConnectionSchema(ConnectionCollectionItemSchema): # pylint: disable=too-m


class ConnectionCollection(NamedTuple):
""" List of Connections with meta"""
"""List of Connections with meta"""
connections: List[Connection]
total_entries: int


class ConnectionCollectionSchema(Schema):
""" Connection Collection Schema"""
"""Connection Collection Schema"""
connections = fields.List(fields.Nested(ConnectionCollectionItemSchema))
total_entries = fields.Int()

Expand Down
8 changes: 4 additions & 4 deletions airflow/api_connexion/schemas/dag_run_schema.py
Expand Up @@ -29,7 +29,7 @@


class ConfObject(fields.Field):
""" The conf field"""
"""The conf field"""
def _serialize(self, value, attr, obj, **kwargs):
if not value:
return {}
Expand All @@ -47,7 +47,7 @@ class DAGRunSchema(SQLAlchemySchema):
"""

class Meta:
""" Meta """
"""Meta"""

model = DagRun
dateformat = "iso"
Expand Down Expand Up @@ -90,10 +90,10 @@ class DAGRunCollectionSchema(Schema):


class DagRunsBatchFormSchema(Schema):
""" Schema to validate and deserialize the Form(request payload) submitted to DagRun Batch endpoint"""
"""Schema to validate and deserialize the Form(request payload) submitted to DagRun Batch endpoint"""

class Meta:
""" Meta """
"""Meta"""
datetimeformat = 'iso'
strict = True

Expand Down
2 changes: 1 addition & 1 deletion airflow/api_connexion/schemas/enum_schemas.py
Expand Up @@ -21,7 +21,7 @@


class DagStateField(fields.String):
""" Schema for DagState Enum"""
"""Schema for DagState Enum"""
def __init__(self, **metadata):
super().__init__(**metadata)
self.validators = (
Expand Down
2 changes: 1 addition & 1 deletion airflow/api_connexion/schemas/error_schema.py
Expand Up @@ -44,7 +44,7 @@ class ImportErrorCollection(NamedTuple):


class ImportErrorCollectionSchema(Schema):
""" Import error collection schema """
"""Import error collection schema"""

import_errors = fields.List(fields.Nested(ImportErrorSchema))
total_entries = fields.Int()
Expand Down
8 changes: 4 additions & 4 deletions airflow/api_connexion/schemas/event_log_schema.py
Expand Up @@ -24,10 +24,10 @@


class EventLogSchema(SQLAlchemySchema):
""" Event log schema """
"""Event log schema"""

class Meta:
""" Meta """
"""Meta"""
model = Log

id = auto_field(data_key='event_log_id', dump_only=True)
Expand All @@ -41,13 +41,13 @@ class Meta:


class EventLogCollection(NamedTuple):
""" List of import errors with metadata """
"""List of import errors with metadata"""
event_logs: List[Log]
total_entries: int


class EventLogCollectionSchema(Schema):
""" EventLog Collection Schema """
"""EventLog Collection Schema"""

event_logs = fields.List(fields.Nested(EventLogSchema))
total_entries = fields.Int()
Expand Down
4 changes: 2 additions & 2 deletions airflow/api_connexion/schemas/health_schema.py
Expand Up @@ -28,12 +28,12 @@ class MetaDatabaseInfoSchema(BaseInfoSchema):


class SchedulerInfoSchema(BaseInfoSchema):
""" Schema for Metadatabase info"""
"""Schema for Metadatabase info"""
latest_scheduler_heartbeat = fields.String(dump_only=True)


class HeathInfoSchema(Schema):
""" Schema for the Health endpoint """
"""Schema for the Health endpoint"""

metadatabase = fields.Nested(MetaDatabaseInfoSchema)
scheduler = fields.Nested(SchedulerInfoSchema)
Expand Down
4 changes: 2 additions & 2 deletions airflow/api_connexion/schemas/log_schema.py
Expand Up @@ -20,14 +20,14 @@


class LogsSchema(Schema):
""" Schema for logs """
"""Schema for logs"""

content = fields.Str()
continuation_token = fields.Str()


class LogResponseObject(NamedTuple):
""" Log Response Object """
"""Log Response Object"""
content: str
continuation_token: str

Expand Down
4 changes: 2 additions & 2 deletions airflow/api_connexion/schemas/variable_schema.py
Expand Up @@ -19,13 +19,13 @@


class VariableSchema(Schema):
""" Variable Schema """
"""Variable Schema"""
key = fields.String(required=True)
value = fields.String(attribute="val", required=True)


class VariableCollectionSchema(Schema):
""" Variable Collection Schema """
"""Variable Collection Schema"""
variables = fields.List(fields.Nested(VariableSchema))
total_entries = fields.Int()

Expand Down
6 changes: 3 additions & 3 deletions airflow/api_connexion/schemas/xcom_schema.py
Expand Up @@ -28,7 +28,7 @@ class XComCollectionItemSchema(SQLAlchemySchema):
"""

class Meta:
""" Meta """
"""Meta"""
model = XCom

key = auto_field()
Expand All @@ -47,13 +47,13 @@ class XComSchema(XComCollectionItemSchema):


class XComCollection(NamedTuple):
""" List of XComs with meta"""
"""List of XComs with meta"""
xcom_entries: List[XCom]
total_entries: int


class XComCollectionSchema(Schema):
""" XCom Collection Schema"""
"""XCom Collection Schema"""
xcom_entries = fields.List(fields.Nested(XComCollectionItemSchema))
total_entries = fields.Int()

Expand Down
2 changes: 1 addition & 1 deletion airflow/cli/commands/legacy_commands.py
Expand Up @@ -49,7 +49,7 @@


def check_legacy_command(action, value):
""" Checks command value and raise error if value is in removed command """
"""Checks command value and raise error if value is in removed command"""
new_command = COMMAND_MAP.get(value)
if new_command is not None:
msg = f"`airflow {value}` command, has been removed, please use `airflow {new_command}`"
Expand Down
4 changes: 2 additions & 2 deletions airflow/models/base.py
Expand Up @@ -37,11 +37,11 @@

# used for typing
class Operator:
""" Class just used for Typing """
"""Class just used for Typing"""


def get_id_collation_args():
""" Get SQLAlchemy args to use for COLLATION """
"""Get SQLAlchemy args to use for COLLATION"""
collation = conf.get('core', 'sql_engine_collation_for_ids', fallback=None)
if collation:
return {'collation': collation}
Expand Down
2 changes: 1 addition & 1 deletion airflow/models/baseoperator.py
Expand Up @@ -1299,7 +1299,7 @@ def xcom_pull(

@cached_property
def extra_links(self) -> List[str]:
"""@property: extra links for the task. """
"""@property: extra links for the task"""
return list(set(self.operator_extra_link_dict.keys())
.union(self.global_operator_extra_link_dict.keys()))

Expand Down
2 changes: 1 addition & 1 deletion airflow/models/connection.py
Expand Up @@ -308,7 +308,7 @@ def extra(cls): # pylint: disable=no-self-argument
descriptor=property(cls.get_extra, cls.set_extra))

def rotate_fernet_key(self):
"""Encrypts data with a new key. See: :ref:`security/fernet`. """
"""Encrypts data with a new key. See: :ref:`security/fernet`"""
fernet = get_fernet()
if self._password and self.is_encrypted:
self._password = fernet.rotate(self._password.encode('utf-8')).decode()
Expand Down
2 changes: 1 addition & 1 deletion airflow/models/dagrun.py
Expand Up @@ -523,7 +523,7 @@ def is_backfill(self):
@classmethod
@provide_session
def get_latest_runs(cls, session=None):
"""Returns the latest DagRun for each DAG. """
"""Returns the latest DagRun for each DAG"""
subquery = (
session
.query(
Expand Down
2 changes: 1 addition & 1 deletion airflow/models/pool.py
Expand Up @@ -30,7 +30,7 @@


class PoolStats(TypedDict):
""" Dictionary containing Pool Stats """
"""Dictionary containing Pool Stats"""
total: int
running: int
queued: int
Expand Down
2 changes: 1 addition & 1 deletion airflow/models/renderedtifields.py
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.
"""Save Rendered Template Fields """
"""Save Rendered Template Fields"""
from typing import Optional

import sqlalchemy_jsonfield
Expand Down
3 changes: 1 addition & 2 deletions airflow/models/skipmixin.py
Expand Up @@ -35,8 +35,7 @@


class SkipMixin(LoggingMixin):
""" A Mixin to skip Tasks Instances """

"""A Mixin to skip Tasks Instances"""
def _set_state_to_skipped(self, dag_run, execution_date, tasks, session):
"""
Used internally to set state of task instances to skipped from the same dag run.
Expand Down
2 changes: 1 addition & 1 deletion airflow/models/taskinstance.py
Expand Up @@ -268,7 +268,7 @@ def __init__(self, task, execution_date: datetime, state: Optional[str] = None):

@reconstructor
def init_on_load(self):
""" Initialize the attributes that aren't stored in the DB. """
"""Initialize the attributes that aren't stored in the DB"""
self.test_mode = False # can be changed when calling 'run'

@property
Expand Down
2 changes: 1 addition & 1 deletion airflow/models/variable.py
Expand Up @@ -177,7 +177,7 @@ def delete(cls, key: str, session: Session = None) -> int:
return session.query(cls).filter(cls.key == key).delete()

def rotate_fernet_key(self):
""" Rotate Fernet Key """
"""Rotate Fernet Key"""
fernet = get_fernet()
if self._val and self.is_encrypted:
self._val = fernet.rotate(self._val.encode('utf-8')).decode()
2 changes: 1 addition & 1 deletion airflow/providers/apache/hive/hooks/hive.py
Expand Up @@ -491,7 +491,7 @@ def kill(self) -> None:


class HiveMetastoreHook(BaseHook):
""" Wrapper to interact with the Hive Metastore"""
"""Wrapper to interact with the Hive Metastore"""

# java short max val
MAX_PART_COUNT = 32767
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/apache/spark/operators/spark_sql.py
Expand Up @@ -109,7 +109,7 @@ def on_kill(self) -> None:
self._hook.kill()

def _get_hook(self) -> SparkSqlHook:
""" Get SparkSqlHook """
"""Get SparkSqlHook"""
return SparkSqlHook(sql=self._sql,
conf=self._conf,
conn_id=self._conn_id,
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/elasticsearch/log/es_task_handler.py
Expand Up @@ -281,7 +281,7 @@ def close(self) -> None:

@property
def log_name(self) -> str:
""" The log name"""
"""The log name"""
return self.LOG_NAME

def get_external_log_url(self, task_instance: TaskInstance, try_number: int) -> str:
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/facebook/ads/hooks/ads.py
Expand Up @@ -72,7 +72,7 @@ def __init__(
"account_id"]

def _get_service(self) -> FacebookAdsApi:
""" Returns Facebook Ads Client using a service account"""
"""Returns Facebook Ads Client using a service account"""
config = self.facebook_ads_config
return FacebookAdsApi.init(app_id=config["app_id"],
app_secret=config["app_secret"],
Expand Down

0 comments on commit d760265

Please sign in to comment.