Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 27, 2025

Addresses feedback that unimod_database initialized at module import time hurts testability and prevents database refresh scenarios.

Changes

  • Lazy initialization: Replace eager unimod_database = UnimodDatabase() with a get_unimod_database() getter that creates the instance on first access
  • Cache pattern: Store instance in _unimod_database module variable, enabling tests to reset by setting to None
  • Update callsite: get_mod() now uses get_unimod_database().modifications
_unimod_database = None

def get_unimod_database():
    global _unimod_database
    if _unimod_database is None:
        _unimod_database = UnimodDatabase()
    return _unimod_database

Benefits: faster module imports, easier mocking in tests, database only created when needed.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

@ypriverol ypriverol marked this pull request as ready for review November 27, 2025 07:33
@qodo-code-review
Copy link

PR Code Suggestions ✨

No code suggestions found for the PR.

Copilot AI changed the title [WIP] Fix feedback on PTM diann handling updates Implement lazy initialization for UnimodDatabase Nov 27, 2025
Copilot AI requested a review from ypriverol November 27, 2025 07:37
Copilot finished work on behalf of ypriverol November 27, 2025 07:37
@ypriverol ypriverol merged commit 372dbeb into dev Nov 27, 2025
5 checks passed
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.

2 participants