-
Notifications
You must be signed in to change notification settings - Fork 29
Add publish version method (Sourcery refactored) #141
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
Add publish version method (Sourcery refactored) #141
Conversation
f9c586b to
f0db4d9
Compare
| ref = self.client._perform_json("POST", "/projects/%s/duplicate/" % self.project_key, body = obj) | ||
| return ref | ||
| return self.client._perform_json( | ||
| "POST", "/projects/%s/duplicate/" % self.project_key, body=obj | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function DSSProject.duplicate refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| if as_type == "listitems" or as_type == "listitem": | ||
| if as_type in ["listitems", "listitem"]: | ||
| return [DSSDatasetListItem(self.client, item) for item in items] | ||
| elif as_type == "objects" or as_type == "object": | ||
| elif as_type in ["objects", "object"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function DSSProject.list_datasets refactored with the following changes:
- Replace multiple comparisons of same variable with
inoperator (merge-comparisons)
| if as_type == "listitems" or as_type == "listitem": | ||
| if as_type in ["listitems", "listitem"]: | ||
| return [DSSStreamingEndpointListItem(self.client, item) for item in items] | ||
| elif as_type == "objects" or as_type == "object": | ||
| elif as_type in ["objects", "object"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function DSSProject.list_streaming_endpoints refactored with the following changes:
- Replace multiple comparisons of same variable with
inoperator (merge-comparisons)
| if as_type == "objects" or as_type == "object": | ||
| if as_type in ["objects", "object"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function DSSProject.list_model_evaluation_stores refactored with the following changes:
- Replace multiple comparisons of same variable with
inoperator (merge-comparisons)
| if as_type == "listitems" or as_type == "listitem": | ||
| if as_type in ["listitems", "listitem"]: | ||
| return [DSSJupyterNotebookListItem(self.client, notebook_item) for notebook_item in notebook_items] | ||
| elif as_type == "objects" or as_type == "object": | ||
| elif as_type in ["objects", "object"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function DSSProject.list_jupyter_notebooks refactored with the following changes:
- Replace multiple comparisons of same variable with
inoperator (merge-comparisons)
| if not "standard" in obj: | ||
| if "standard" not in obj: | ||
| raise ValueError("Missing 'standard' key in argument") | ||
| if not "local" in obj: | ||
| if "local" not in obj: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function DSSProject.set_variables refactored with the following changes:
- Simplify logical expression using De Morgan identities (
de-morgan)
| if as_type == "listitems" or as_type == "listitem": | ||
| if as_type in ["listitems", "listitem"]: | ||
| return [DSSRecipeListItem(self.client, item) for item in items] | ||
| elif as_type == "objects" or as_type == "object": | ||
| elif as_type in ["objects", "object"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function DSSProject.list_recipes refactored with the following changes:
- Replace multiple comparisons of same variable with
inoperator (merge-comparisons)
| elif type == "prepare" or type == "shaker": | ||
| elif type in ["prepare", "shaker"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function DSSProject.new_recipe refactored with the following changes:
- Replace multiple comparisons of same variable with
inoperator (merge-comparisons)
| already_exists = False | ||
| for rule in found_eo["rules"]: | ||
| if rule["targetProject"] == target_project: | ||
| already_exists = True | ||
| break | ||
| already_exists = any( | ||
| rule["targetProject"] == target_project for rule in found_eo["rules"] | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function DSSProjectSettings.add_exposed_object refactored with the following changes:
- Use any() instead of for loop (
use-any)
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 0.46%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Let us know what you think of it by mentioning @sourcery-ai in a comment. |
Pull Request #140 refactored by Sourcery.
If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
NOTE: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings as
necessary. If Sourcery finds no refactorings at any point, this Pull Request
will be closed automatically.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
task/dss90-add-publish-version-methodbranch, then run: