-
Notifications
You must be signed in to change notification settings - Fork 33
✨ Add permission handler #378
✨ Add permission handler #378
Conversation
Codecov Report
@@ Coverage Diff @@
## main #378 +/- ##
==========================================
+ Coverage 90.54% 91.17% +0.63%
==========================================
Files 8 9 +1
Lines 74 102 +28
==========================================
+ Hits 67 93 +26
- Misses 7 9 +2
Continue to review full report at Codecov.
|
|
|
I feel like the whole purpose of this class is to ease the use of permissions, wouldn't a similar implementation to this kind of defeat the purpose of this class |
pincer/objects/guild/permissions.py
Outdated
| from typing import Tuple, Optional | ||
|
|
||
|
|
||
| class PermissionEnums(Enum): |
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.
| class PermissionEnums(Enum): | |
| class Permissions(Enum): |
|
Ignore what I said about |= |
Co-authored-by: Lunarmagpie <[email protected]>
Co-authored-by: Lunarmagpie <[email protected]>
Co-authored-by: trag1c <[email protected]>
Co-authored-by: trag1c <[email protected]>
…er/Pincer into add-permission-handler
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.
I agree with trag1c
pincer/objects/guild/permissions.py
Outdated
| elif isinstance(object, tuple): | ||
| return self.to_int() == 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.
I not sure there is any scenario where int can be equal to tuple.
| elif isinstance(object, tuple): | |
| return self.to_int() == 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.
The function returns a tuple of ints. Maybe the function name should be changed because I was confused by this too.
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.
A few ideas:
- to_ints
- to_tuple
- convert
I changed it to_tuple for now
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.
I think you should do to_ints since it matches with from_ints
My other idea is to_permission_tuple but thats kinda long.
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.
Actually do what tragic says then I will approve
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 2.02%.
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! Help us improve this quality report! |
Changes
This adds a permission handler which can convert integers in the correct permission and vice versa.
Check off the following