Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refurish python code by applying Pylint linter rules #8322

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

bowenliang123
Copy link
Contributor

@bowenliang123 bowenliang123 commented Sep 12, 2024

Checklist:

Important

Please review the checklist below before submitting your pull request.

  • Please open an issue before creating a PR or link to an existing issue
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

Description

  • apply auto-fixable rules from PyLint by ruff: https://docs.astral.sh/ruff/rules/#pylint-pl
  • no behaviour changes, some notable improvement:
    • avoid using from {module} import {name} in lieu of alias
    • use a set literal when testing for membership
    • avoid unnecessary dunder call to {method}. {replacement}.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update, included: Dify Document
  • Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
  • Dependency upgrade

Testing Instructions

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 🐍 python Pull requests that update Python code 💪 enhancement New feature or request labels Sep 12, 2024
@bowenliang123
Copy link
Contributor Author

cc @laipz8200

@laipz8200 laipz8200 self-requested a review September 12, 2024 12:16
@bowenliang123
Copy link
Contributor Author

With this PR merged, there are no more Ruff's linter rules required to apply from my prospective.

@laipz8200
Copy link
Collaborator

I think it would be best to exclude the migrations directory from the linter, since it mostly contains code generated by Alembic.

@bowenliang123
Copy link
Contributor Author

I think it would be best to exclude the migrations directory from the linter, since it mostly contains code generated by Alembic.

Have prevented changes in migrations. Now the migration path has been added to Ruff setting's [tool.ruff] section for exclusion in both linting and reformatting, which is more easy to maintain.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 13, 2024
@laipz8200 laipz8200 merged commit a1104ab into langgenius:main Sep 13, 2024
6 checks passed
ZhouhaoJiang added a commit that referenced this pull request Sep 14, 2024
* main: (40 commits)
  feat: allow users to specify timeout for text generations and workflows by environment variable (#8395)
  Fix: operation postion of answer in logs (#8411)
  fix: when the variable does not exist, an error should be prompted (#8413)
  fix(workflow): the answer node after the iteration node containing the answer was output prematurely (#8419)
  fix:logs and rm unused codes in CacheEmbedding (#8409)
  fix: resolve runtime error when self.folder is None (#8401)
  Fix: Support Bedrock cross region inference #8190 (Update Model name to distinguish between different region groups) (#8402)
  fix(docker): aliyun oss path env key (#8394)
  fix: pyproject.toml typo (#8396)
  fix: o1-mini 65563 -> 65536 (#8388)
  fix: sandbox issue related httpx and requests (#8397)
  chore: improve usage of striping prefix or suffix of string with Ruff 0.6.5 (#8392)
  fix (#8322 followup): resolve the violation of pylint rules (#8391)
  chore: refurish python code by applying Pylint linter rules (#8322)
  support hunyuan-turbo (#8372)
  chore: update firecrawl scrape to V1 api (#8367)
  fix(workflow): both parallel and single branch errors occur in if-else (#8378)
  fix: edit load balancing not pass id (#8370)
  fix: add before send to remove langfuse defaultErrorResponse (#8361)
  fix: when edit load balancing config not pass the empty filed value hidden (#8366)
  ...
ZhouhaoJiang added a commit that referenced this pull request Sep 14, 2024
* feat/new-login: (27 commits)
  chore: format
  feat: add fulfill_login_params_from_env
  feat: update message
  feat: update mismatch description
  feat: remove env example
  chore: PLR6201 Use a set literal when testing for membership
  feat: update EmailOrPasswordMismatchError
  feat: allow users to specify timeout for text generations and workflows by environment variable (#8395)
  Fix: operation postion of answer in logs (#8411)
  fix: when the variable does not exist, an error should be prompted (#8413)
  fix(workflow): the answer node after the iteration node containing the answer was output prematurely (#8419)
  fix:logs and rm unused codes in CacheEmbedding (#8409)
  fix: resolve runtime error when self.folder is None (#8401)
  Fix: Support Bedrock cross region inference #8190 (Update Model name to distinguish between different region groups) (#8402)
  fix(docker): aliyun oss path env key (#8394)
  fix: pyproject.toml typo (#8396)
  fix: o1-mini 65563 -> 65536 (#8388)
  fix: sandbox issue related httpx and requests (#8397)
  chore: improve usage of striping prefix or suffix of string with Ruff 0.6.5 (#8392)
  fix (#8322 followup): resolve the violation of pylint rules (#8391)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 enhancement New feature or request lgtm This PR has been approved by a maintainer 🐍 python Pull requests that update Python code size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants