Open
Conversation
Sourcery refactored this code to make it cleaner and more readable. If you want Sourcery to review the full project or all new pull requests, add [Sourcery](https://github.com/sourcery-ai/sourcery) to your repo. We try to only open PRs that are helpful. If this isn't helpful or you have any feedback for us - please [let us know](mailto:github@sourcery.ai)!
SourceryAI
commented
Nov 15, 2021
| if r in items: | ||
| valid_permission = True | ||
| break | ||
| valid_permission = any(r in items for r in roles) |
Author
There was a problem hiding this comment.
Function perm_roles.wrap.func refactored with the following changes:
- Use any() instead of for loop (use-any)
SourceryAI
commented
Nov 15, 2021
Comment on lines
+571
to
+575
| elif self.prefetch_queries: | ||
| items = await self.application.objects.prefetch(qs, | ||
| *self.prefetch_queries) | ||
| else: | ||
| if self.prefetch_queries: | ||
| items = await self.application.objects.prefetch(qs, | ||
| *self.prefetch_queries) | ||
| else: | ||
| items = await self.application.objects.execute(qs) | ||
| items = await self.application.objects.execute(qs) |
Author
There was a problem hiding this comment.
Function ApiListHandler._get_items refactored with the following changes:
- Merge else clause's nested if statement into elif (merge-else-if-into-elif)
SourceryAI
commented
Nov 15, 2021
Comment on lines
-221
to
+224
| properties = {} | ||
| for prop, subschema in self._properties.items(): | ||
| properties[prop] = subschema.to_dict() | ||
| return properties | ||
| return { | ||
| prop: subschema.to_dict() | ||
| for prop, subschema in self._properties.items() | ||
| } |
Author
There was a problem hiding this comment.
Function Schema._get_properties refactored with the following changes:
- Convert for loop into dictionary comprehension (dict-comprehension)
- Inline variable that is immediately returned (inline-immediately-returned-variable)
SourceryAI
commented
Nov 15, 2021
| val_type = JS_TYPES[val] | ||
| else: | ||
| val_type = JS_TYPES[type(val)] | ||
| val_type = JS_TYPES[val] if val in JS_TYPES.keys() else JS_TYPES[type(val)] |
Author
There was a problem hiding this comment.
Function Schema._generate_basic refactored with the following changes:
- Replace if statement with if expression (assign-if-exp)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sourcery refactored this code to make it cleaner and more readable.
If you want Sourcery to review the full project or all new pull requests, add Sourcery to your repo.
We try to only open PRs that are helpful. If this isn't helpful or you have any feedback for us - please let us know!