Skip to content

Extract shared geography primitives into _dependencies/common/geo.py#919

Merged
volodkindv merged 3 commits into
mainfrom
feature/geo-common
Jul 10, 2026
Merged

Extract shared geography primitives into _dependencies/common/geo.py#919
volodkindv merged 3 commits into
mainfrom
feature/geo-common

Conversation

@volodkindv

Copy link
Copy Markdown
Collaborator
  • Centralised FEDERAL_DISTRICTS, compact_region_name(), REGION_EMOJI_LEGEND

  • RegionCallbackPayload dataclass with JSON serialisation

  • paginate_regions() helper for paginated region lists

  • NavButton constants (← назад, ещё →, Завершить и т.д.)

  • get_fed_district_normalised/label() lookup helpers

  • district_prompt() shared message builder

  • VK bot: removed duplicated _compact_region_name + emoji legend, now imports from _dependencies.common.geo

  • MAX bot: same cleanup

Кот added 3 commits July 10, 2026 12:09
- Centralised FEDERAL_DISTRICTS, compact_region_name(), REGION_EMOJI_LEGEND
- RegionCallbackPayload dataclass with JSON serialisation
- paginate_regions() helper for paginated region lists
- NavButton constants (← назад, ещё →, Завершить и т.д.)
- get_fed_district_normalised/label() lookup helpers
- district_prompt() shared message builder

VK bot: removed duplicated _compact_region_name + emoji legend, now
        imports from _dependencies.common.geo
MAX bot: same cleanup

ruff format + ruff check + mypy + 275 VK tests — all green.
…encies/common/geo.py

- NavButton (BACK/NEXT/FINISH/BACK_TO_START) replaces duplicate BTN_* constants
- FEDERAL_DISTRICTS replaces duplicate BTN_DISTRICT_* lists
- paginate_regions() replaces manual pagination in paginated_regions_inline()
- RegionCallbackPayload replaces hand-rolled callback payload dicts
- CMD_* constants replace hardcoded cmd strings
- REGION_EMOJI_LEGEND in MAX message_formatter now imported from geo.py
- -87 lines net, 873 tests pass
…ants in VK

- Remove unused NavButton.CHOOSE_OTHER, NavButton.FED_DIST_PICK_OTHER
- Remove accidental '✅ завершённые поиски' from emoji legend/suffix map
- Remove dead code: REGION_SELECTION_INTRO, REGION_LIST_PROMPT, district_prompt()
- Fix REGION_TOGGLED_OFF_FMT: удалён → удален (match VK existing text)
- Derive VK _KNOWN_DISTRICTS from FEDERAL_DISTRICTS (single source of truth)
- Replace hardcoded strings in VK region_select_handlers with shared constants
- Fix misplaced section comment in MAX message_formatter.py
@volodkindv volodkindv force-pushed the feature/geo-common branch from 60299ce to c3c0854 Compare July 10, 2026 10:33
@volodkindv volodkindv merged commit ec3116d into main Jul 10, 2026
1 of 2 checks passed
@volodkindv volodkindv deleted the feature/geo-common branch July 10, 2026 10:35
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.

1 participant