refactor(party): split party.py into helpers.py, views.py, and cog#173
Merged
Conversation
Closes #166 - helpers.py: pure functions (parse_settings_text, parse_roles_from_text, validate_roles, parse_scheduled_time, _parse_roles_from_args, parse_allow_multiple, _parse_bool_value, format_timestamp) + constants - views.py: all discord.ui.Modal and discord.ui.View classes - party.py: Party(commands.Cog) only, imports from the above modules Consolidates two inline _fmt_ts local functions into format_timestamp(). Replaces inline role-parsing in party_create with _parse_roles_from_args(). No behaviour change.
- helpers.py:51 W291 trailing whitespace in string literal - party.py F401 unused imports (parse_allow_multiple, EditPartyFullModal) - views.py F401 unused import (EMBED_FIELD_MAX_LENGTH) - views.py W391 blank line at end of file
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.
Closes #166
What
Splits the monolithic
party/party.py(2397 lines) into three focused modules:party/helpers.pyparse_settings_text,parse_roles_from_text,validate_roles,parse_scheduled_time,_parse_roles_from_args,parse_allow_multiple,format_timestamp+ constantsparty/views.pydiscord.ui.Modalanddiscord.ui.Viewclassesparty/party.pyParty(commands.Cog)only — commands and instance methodsparty.pyis still over 1k because it holds all commands — subsequent issues (#164, #167, #168) will bring it down further.Bonus cleanups included
_fmt_tslocal functions into a singleformat_timestamp()in helpers.pyparty_createwith a call to_parse_roles_from_args()(also covers refactor(party): party_create re-implements _parse_roles_from_args inline — call the method #169)No behaviour change
Validated:
python -m py_compile party/helpers.py party/views.py party/party.py— cleanflake8 party/ --select=F821,E9— clean