Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format all files (without excepions) by black #12091

Merged
merged 2 commits into from Nov 4, 2020

Conversation

mik-laj
Copy link
Member

@mik-laj mik-laj commented Nov 4, 2020

More info: 4a5ce39#r517012913

  • commented inline

^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

@boring-cyborg boring-cyborg bot added area:dev-tools k8s provider:google Google (including GCP) related issues labels Nov 4, 2020
'SequentialExecutor',
)
is_sqlite = "sqlite" in self.get('core', 'sql_alchemy_conn')
if is_executor_without_sqlie_support and is_sqlite:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This piece of code couldn't handle black, so I wrote it a bit differently.

tempfile.TemporaryDirectory() as gcloud_config_tmp, \
patch_environ({'CLOUDSDK_CONFIG': gcloud_config_tmp}):
with ExitStack() as exit_stack:
exit_stack.enter_context(self.provide_gcp_credential_file_as_context())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This piece of code couldn't handle black, so I wrote it a bit differently.

priority_class_name: Optional[str] = None,
termination_grace_period: Optional[int] = None,
**kwargs) -> None:
def __init__( # pylint: disable=too-many-arguments,too-many-locals
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Black moved the comment down one line so I had to turn off the formatting.

if (
self.get("core", "executor") not in ('DebugExecutor', 'SequentialExecutor') and
"sqlite" in self.get('core', 'sql_alchemy_conn')):
is_executor_without_sqlie_support = self.get("core", "executor") not in (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
is_executor_without_sqlie_support = self.get("core", "executor") not in (
is_executor_without_sqlite_support = self.get("core", "executor") not in (

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. 0ec21f5

'SequentialExecutor',
)
is_sqlite = "sqlite" in self.get('core', 'sql_alchemy_conn')
if is_executor_without_sqlie_support and is_sqlite:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if is_executor_without_sqlie_support and is_sqlite:
if is_executor_without_sqlite_support and is_sqlite:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. 0ec21f5


raise AirflowConfigException(
"section/key [{section}/{key}] not found "
"in config".format(section=section, key=key))
"section/key [{section}/{key}] not found " "in config".format(section=section, key=key)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"section/key [{section}/{key}] not found " "in config".format(section=section, key=key)
"section/key [{section}/{key}] not found in config".format(section=section, key=key)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. 0ec21f5

Copy link
Member

@kaxil kaxil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few suggestions added


if process.returncode != 0:
raise AirflowConfigException(
"Cannot execute {}. Error code is: {}. Output: {}, Stderr: {}"
.format(command, process.returncode, output, stderr)
"Cannot execute {}. Error code is: {}. Output: {}, Stderr: {}".format(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be f-string?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. 0ec21f5

@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Nov 4, 2020
@github-actions
Copy link

github-actions bot commented Nov 4, 2020

The PR needs to run all tests because it modifies core of Airflow! Please rebase it to latest master or ask committer to re-run it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dev-tools full tests needed We need to run full set of tests for this PR to merge provider:google Google (including GCP) related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants