Skip to content

Up2#132

Merged
MrIbrahem merged 2 commits intomainfrom
up2
Feb 16, 2026
Merged

Up2#132
MrIbrahem merged 2 commits intomainfrom
up2

Conversation

@MrIbrahem
Copy link
Collaborator

This pull request refactors and simplifies the page and account modules in the newapi package. The main focus is on unifying and modernizing the implementation of page-related modules by removing duplicate logic, eliminating legacy code, and standardizing how user account information and API access are handled. Several files that previously contained redundant or outdated code have been removed, and the main page modules now use a consistent, cached approach to API initialization.

Key changes include:

Major refactoring and code cleanup

  • Removed legacy or redundant files: newapi/pages_bots/wiki_page.py, newapi/pages_bots/mdwiki_page.py, newapi/pages_bots/ncc_page.py, newapi/pages_bots/toolforge_page.py, newapi/pages_bots/new_wiki_pages.py, and the corresponding thin wrappers newapi/mdwiki_page.py, newapi/ncc_page.py, newapi/new_wiki_pages.py. These files either duplicated logic or are now obsolete due to the new unified approach. [1] [2] [3] [4] [5] [6] [7] [8]

  • Refactored newapi/pages_bots/page.py to use a single, cached API loader (load_main_api) for all page operations (MainPage, CatDepth, NEW_API), removing the need for manual login management and custom wrappers. [1] [2]

User account management simplification

  • Removed old user account files: newapi/accounts/user_account_new.py and newapi/accounts/user_account_ncc.py, consolidating account management and reducing duplication. [1] [2]

Documentation and diagram updates

  • Updated Diagram.md to remove references to obsolete modules, reflecting the new, simplified structure.

Test and debug code removal

  • Removed inline test/debug code from utility modules (newapi/api_utils/except_err.py, newapi/api_utils/printe.py, newapi/api_utils/txtlib.py) to keep the codebase clean and production-ready. [1] [2] [3]

Centralize API/bot loading and remove inline test code across utilities. Key changes:

- pages_bots/page.py: replace LoginWrap usage with a cached ALL_APIS loader (functools.lru_cache), update MainPage/CatDepth/NEW_API to use the main_bot interface, and clean imports.
- newapi/super/S_Page/super_page.py: rename local category key variables for clarity (tit -> category_title) and add a create() wrapper delegating to Create().
- newapi/super/bot.py, newapi/super/bot_new.py, newapi/super/mwclient/client.py: standardize log_error formatting to include params/action and adjust logger/import ordering; tidy logins_count placement.
- Removed interactive / __main__ demo/test blocks from multiple utility modules to avoid side-effect execution (except_err.py, printe.py, txtlib.py, pformat.py, ar_err.py, catdepth_new.py).
- Diagram.md: remove outdated ncc_page link.

These changes reduce accidental execution of test code, centralize API instantiation with caching for reuse, and make error logging more informative for debugging.
Delete a set of legacy/duplicated newapi modules and page wrappers: newapi/accounts/user_account_ncc.py, newapi/accounts/user_account_new.py, newapi/mdwiki_page.py, newapi/ncc_page.py, newapi/new_wiki_pages.py, newapi/pages_bots/* (mdwiki_page.py, ncc_page.py, new_wiki_pages.py, toolforge_page.py, wiki_page.py), newapi/pages_bots_backup/mdwiki_page.py, newapi/toolforge_page.py, newapi/tt.py, and newapi/wiki_page.py. This is a cleanup to remove obsolete code and top-level shims; note that any imports or callers referencing these files will need to be updated to use the current implementations or removed to avoid import errors.
@MrIbrahem MrIbrahem merged commit 9e2deb7 into main Feb 16, 2026
1 check 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.

1 participant