Skip to content

Update#4

Merged
MrIbrahem merged 10 commits intomainfrom
update
Jan 31, 2026
Merged

Update#4
MrIbrahem merged 10 commits intomainfrom
update

Conversation

@MrIbrahem
Copy link
Copy Markdown
Contributor

This pull request introduces several improvements and refactorings across the mw_api package, focusing on code readability, logging standardization, and import organization. The most significant changes include replacing custom print-based logging with Python's standard logging module, cleaning up imports, and improving code formatting for better maintainability.

Logging and Output Refactoring:

  • Replaced all uses of the custom printe.output and printe.warn functions with calls to the standard logging module across various modules, including api_utils/botEdit.py, api_utils/ask_bot.py, api/api/client.py, and api/token_manager.py. This standardizes logging practices and makes log management more flexible. [1] [2] [3] [4]

Import and Initialization Cleanup:

  • Cleaned up and reorganized imports throughout the codebase for clarity and consistency, e.g., in __init__.py, all_apis.py, db_bot.py, and pymysql_bot.py. This includes grouping imports, removing redundant imports, and updating import order. [1] [2] [3] [4]

API Client and Utility Improvements:

  • Updated MediaWikiApiClient and TokenManager to use logging, improved parameter formatting, and made function signatures more consistent and readable. [1] [2] [3] [4] [5] [6]

Code Formatting and Readability:

  • Reformatted function definitions and calls that had long parameter lists to use multi-line formatting for better readability, especially in db_bot.py, pymysql_bot.py, and related files. [1] [2] [3] [4]

Other Minor Cleanups:

  • Removed unused or redundant code and docstrings, and made small code quality improvements throughout the codebase. [1] [2] [3]

These changes collectively improve the maintainability, readability, and consistency of the codebase.

Introduced mw_api/logging_config.py to provide logging setup with colored output using colorlog. Updated requirements.in to include colorlog. Minor import fix in printe.py and removed a commented line in bot.py.
Logger messages across multiple modules were shortened and standardized by removing redundant method names and clarifying outputs. This improves log readability and consistency throughout the codebase.
Imported and called setup_logging in mw_api/__init__.py to configure logging for the package namespace. Modified setup_logging to accept a logger name parameter for more flexible configuration.
@MrIbrahem MrIbrahem merged commit dd20149 into main Jan 31, 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