Skip to content

refactor(party): split party.py into helpers.py, views.py, and cog#173

Merged
psykzz merged 3 commits into
mainfrom
refactor/party-split-modules
Jun 19, 2026
Merged

refactor(party): split party.py into helpers.py, views.py, and cog#173
psykzz merged 3 commits into
mainfrom
refactor/party-split-modules

Conversation

@psykzz

@psykzz psykzz commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Closes #166

What

Splits the monolithic party/party.py (2397 lines) into three focused modules:

File Lines Contents
party/helpers.py 146 Pure functions: parse_settings_text, parse_roles_from_text, validate_roles, parse_scheduled_time, _parse_roles_from_args, parse_allow_multiple, format_timestamp + constants
party/views.py 924 All discord.ui.Modal and discord.ui.View classes
party/party.py 1266 Party(commands.Cog) only — commands and instance methods

party.py is still over 1k because it holds all commands — subsequent issues (#164, #167, #168) will bring it down further.

Bonus cleanups included

No behaviour change

Validated:

  • python -m py_compile party/helpers.py party/views.py party/party.py — clean
  • flake8 party/ --select=F821,E9 — clean

psykzz added 3 commits June 19, 2026 20:38
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
@psykzz psykzz merged commit 78991e2 into main Jun 19, 2026
3 checks passed
@psykzz psykzz deleted the refactor/party-split-modules branch June 19, 2026 20:42
@psykzz psykzz restored the refactor/party-split-modules branch June 19, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(party): split party.py into views.py, helpers.py, and cog

1 participant