[PR #2816] [CLOSED] chore: Fix some PEP issues in the backend #44158

Closed
opened 2026-04-29 18:07:43 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/2816
Author: @franciscovelez
Created: 6/4/2024
Status: Closed

Base: devHead: fix-some-pep


📝 Commits (5)

  • 71c40e3 remove unused imported modules
  • ca608b2 fix comparisons to None which are not using the is operator
  • bcc7304 Fix duplicated names
  • 1b6d459 Remove unused vars
  • 8ce54dd More linting things

📊 Changes

31 files changed (+85 additions, -158 deletions)

View changed files

📝 backend/apps/audio/main.py (+2 -6)
📝 backend/apps/images/main.py (+8 -14)
📝 backend/apps/images/utils/comfyui.py (+0 -1)
📝 backend/apps/ollama/main.py (+14 -21)
📝 backend/apps/openai/main.py (+3 -5)
📝 backend/apps/rag/main.py (+6 -6)
📝 backend/apps/rag/search/google_pse.py (+0 -1)
📝 backend/apps/rag/search/serpstack.py (+0 -1)
📝 backend/apps/webui/main.py (+1 -3)
📝 backend/apps/webui/models/auths.py (+1 -2)
📝 backend/apps/webui/models/chats.py (+1 -1)
📝 backend/apps/webui/models/documents.py (+1 -3)
📝 backend/apps/webui/models/memories.py (+1 -2)
📝 backend/apps/webui/models/models.py (+1 -3)
📝 backend/apps/webui/models/prompts.py (+1 -4)
📝 backend/apps/webui/models/tags.py (+4 -5)
📝 backend/apps/webui/models/users.py (+1 -2)
📝 backend/apps/webui/routers/auths.py (+2 -4)
📝 backend/apps/webui/routers/chats.py (+4 -9)
📝 backend/apps/webui/routers/configs.py (+3 -11)

...and 11 more files

📄 Description

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests for validating the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Label: To cleary categorize this pull request, assign a relevant label to the pull request title, using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

I have been checking some PEP style issues in the backend code finding a lot of unused imports & vars and other more severe things like duplicated function names in the same file. This changes does not affect to the performance or application behaviour however, I think will provide a cleaner code.

Removed

  • 130 imported but unused modules

Changed

  • 29 occurrences of None comparisons with == or != instead of is or is not
  • Multiple imports on one line to several lines

Fixed

  • Duplicated function names (get_image_size, update_image_size , get_user_chats and get_app_config) on some files
  • f-strings without any placeholders

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/2816 **Author:** [@franciscovelez](https://github.com/franciscovelez) **Created:** 6/4/2024 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix-some-pep` --- ### 📝 Commits (5) - [`71c40e3`](https://github.com/open-webui/open-webui/commit/71c40e3a79f90d3e6d83f4c8e8214f5cd277d01a) remove unused imported modules - [`ca608b2`](https://github.com/open-webui/open-webui/commit/ca608b2909bec1debc8a57ffe2e0f6bef2223a96) fix comparisons to `None` which are not using the `is` operator - [`bcc7304`](https://github.com/open-webui/open-webui/commit/bcc7304973d7c6d80432597d62b5d46aea3f701a) Fix duplicated names - [`1b6d459`](https://github.com/open-webui/open-webui/commit/1b6d459baaac015f92f87a39eb7ecc7c4fa80413) Remove unused vars - [`8ce54dd`](https://github.com/open-webui/open-webui/commit/8ce54dd7f1fe7c021277842a7b33fedda9320415) More linting things ### 📊 Changes **31 files changed** (+85 additions, -158 deletions) <details> <summary>View changed files</summary> 📝 `backend/apps/audio/main.py` (+2 -6) 📝 `backend/apps/images/main.py` (+8 -14) 📝 `backend/apps/images/utils/comfyui.py` (+0 -1) 📝 `backend/apps/ollama/main.py` (+14 -21) 📝 `backend/apps/openai/main.py` (+3 -5) 📝 `backend/apps/rag/main.py` (+6 -6) 📝 `backend/apps/rag/search/google_pse.py` (+0 -1) 📝 `backend/apps/rag/search/serpstack.py` (+0 -1) 📝 `backend/apps/webui/main.py` (+1 -3) 📝 `backend/apps/webui/models/auths.py` (+1 -2) 📝 `backend/apps/webui/models/chats.py` (+1 -1) 📝 `backend/apps/webui/models/documents.py` (+1 -3) 📝 `backend/apps/webui/models/memories.py` (+1 -2) 📝 `backend/apps/webui/models/models.py` (+1 -3) 📝 `backend/apps/webui/models/prompts.py` (+1 -4) 📝 `backend/apps/webui/models/tags.py` (+4 -5) 📝 `backend/apps/webui/models/users.py` (+1 -2) 📝 `backend/apps/webui/routers/auths.py` (+2 -4) 📝 `backend/apps/webui/routers/chats.py` (+4 -9) 📝 `backend/apps/webui/routers/configs.py` (+3 -11) _...and 11 more files_ </details> ### 📄 Description # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request. **Before submitting, make sure you've checked the following:** - [x] **Target branch:** Please verify that the pull request targets the `dev` branch. - [x] **Description:** Provide a concise description of the changes made in this pull request. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [ ] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? - [ ] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [ ] **Testing:** Have you written and run sufficient tests for validating the changes? - [ ] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [x] **Label:** To cleary categorize this pull request, assign a relevant label to the pull request title, using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Description I have been checking some PEP style issues in the backend code finding a lot of unused imports & vars and other more severe things like duplicated function names in the same file. This changes does not affect to the performance or application behaviour however, I think will provide a cleaner code. ### Removed - 130 imported but unused modules ### Changed - 29 occurrences of None comparisons with `==` or `!=` instead of `is` or `is not` - Multiple imports on one line to several lines ### Fixed - Duplicated function names (`get_image_size`, `update_image_size` , `get_user_chats` and `get_app_config`) on some files - f-strings without any placeholders --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-29 18:07:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#44158