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

Fix linting #55

Merged
merged 2 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
max-line-length = 120
max-complexity = 10
ignore =
E501, # line too long, it is covered by pylint
E722, # bare except, bad practice, to be removed in the future
F401, # imported but unused, too many violations, to be removed in the future
F811, # redefinition of unused, to be removed in the future
C901 # code flow is too complex, too many violations, to be removed in the future
W503 # line break before binary operator effect on readability is subjective
W504 # line break after binary operator effect on readability is subjective
# line too long, it is covered by pylint
E501,
# bare except, bad practice, to be removed in the future
E722,
# imported but unused, too many violations, to be removed in the future
F401,
# redefinition of unused, to be removed in the future
F811,
# code flow is too complex, too many violations, to be removed in the future
C901,
# line break before binary operator effect on readability is subjective
W503,
# line break after binary operator effect on readability is subjective
W504
exclude =
*/vendored_sdks
docs
Expand Down
12 changes: 6 additions & 6 deletions src/aosm/azext_aosm/deploy/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ def upload(self, artifact_config: Union[ArtifactConfig, HelmPackageConfig]) -> N

:param artifact_config: configuration for the artifact being uploaded
"""
if type(self.artifact_client) == OrasClient:
if type(artifact_config) == HelmPackageConfig:
if isinstance(self.artifact_client, OrasClient):
if isinstance(artifact_config, HelmPackageConfig):
self._upload_helm_to_acr(artifact_config)
elif type(artifact_config) == ArtifactConfig:
elif isinstance(artifact_config, ArtifactConfig):
self._upload_arm_to_acr(artifact_config)
else:
raise ValueError(f"Unsupported artifact type: {type(artifact_config)}.")
Expand All @@ -52,7 +52,7 @@ def _upload_arm_to_acr(self, artifact_config: ArtifactConfig) -> None:

:param artifact_config: configuration for the artifact being uploaded
"""
assert type(self.artifact_client) == OrasClient
assert isinstance(self.artifact_client, OrasClient)

if artifact_config.file_path:
if not self.artifact_client.remote.hostname:
Expand Down Expand Up @@ -110,8 +110,8 @@ def _upload_to_storage_account(self, artifact_config: ArtifactConfig) -> None:

:param artifact_config: configuration for the artifact being uploaded
"""
assert type(self.artifact_client) == BlobClient
assert type(artifact_config) == ArtifactConfig
assert isinstance(self.artifact_client, BlobClient)
assert isinstance(artifact_config, ArtifactConfig)

# If the file path is given, upload the artifact, else, copy it from an existing blob.
if artifact_config.file_path:
Expand Down
4 changes: 3 additions & 1 deletion src/aosm/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ git checkout add-aosm-extension
# Install all the python dependencies you need
azdev setup --cli /home/developer/code/azure-cli --repo .

# Install pyYAML types
python3 -m pip install types-PyYAML

# Add the extension to your local CLI
azdev extension add aosm
```
Expand Down Expand Up @@ -165,4 +168,3 @@ To trigger a pipeline you need to create a PR against main.
Until we do the initial merge to main we don't want to have a PR to main for every code review.
Instead we have a single PR for the `add-aosm-extension` branch: https://github.com/Azure/azure-cli-extensions/pull/6426
Once you have merged your changes to `add-aosm-extension` then look at the Azure Pipelines under https://github.com/Azure/azure-cli-extensions/pull/6426/checks, click on the link that says `<X> errors / <Y> warnings`.