You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several strings (user, group, server, service, etc) that are used throughout the code base as keys, for loop items and the likes. These could be considered constants and be moved to one or more enum.
Despite making the code more verbose, it would help avoiding pitfalls usually associated with typos just as wrong keys and would trigger explicit errors.
As an example, the content of the scopes.py where there's a lot of checks and data extraction using such strings.
Alternative options
Don't change anything
Who would use this feature?
Developers of JupyterHub as well as people reading through code for better understanding.
(Optional): Suggest a solution
Analyse the strings used in the code base
Establish one or more Enum to replace them (for example Resources for user, group, server, service.
Update strings use with Enum.
The text was updated successfully, but these errors were encountered:
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋
I think this is worth trying on one of the proposed enum types first, so we can evaluate tradeoffs in how they're implemented. E.g. __str__ can be overridden to return Enum.item.value instead of the default representation making it easier to use in strings, at the expense of not behaving how Enums normally behave.
Proposed change
There are several strings (
user
,group
,server
,service
, etc) that are used throughout the code base as keys, for loop items and the likes. These could be considered constants and be moved to one or more enum.Despite making the code more verbose, it would help avoiding pitfalls usually associated with typos just as wrong keys and would trigger explicit errors.
As an example, the content of the
scopes.py
where there's a lot of checks and data extraction using such strings.Alternative options
Don't change anything
Who would use this feature?
Developers of JupyterHub as well as people reading through code for better understanding.
(Optional): Suggest a solution
user
,group
,server
,service
.The text was updated successfully, but these errors were encountered: