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

Update ruff version #503

Merged
merged 3 commits into from
Nov 27, 2024
Merged

Update ruff version #503

merged 3 commits into from
Nov 27, 2024

Conversation

joamatab
Copy link
Contributor

@joamatab joamatab commented Nov 27, 2024

Summary by Sourcery

Reorganize import statements across multiple modules for improved code clarity and maintainability. Simplify the 'get_instances' function in the spice_to_yaml module by optimizing list comprehensions and removing redundant code. Update the ruff version in the pre-commit configuration to v0.8.0.

Enhancements:

  • Reorganize import statements in various modules for better readability and maintainability.
  • Simplify the logic in the 'get_instances' function by using list comprehensions and removing unnecessary code.

Build:

  • Update the ruff version in the pre-commit configuration from v0.7.4 to v0.8.0.

Copy link
Contributor

sourcery-ai bot commented Nov 27, 2024

Reviewer's Guide by Sourcery

This PR primarily focuses on code organization and cleanup, particularly around import statements and module exports. The changes include explicit imports instead of wildcard imports, alphabetical ordering of all lists, and an update to the ruff linter version.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Replace wildcard imports with explicit imports in Jupyter notebooks
  • Replace 'from gplugins.process.implant_tables import *' with explicit imports of specific functions
  • Remove redundant matplotlib import
  • Replace 'from gplugins.process.diffusion import *' with specific function imports
notebooks/tcad_02_analytical_process.ipynb
Optimize and clean up code in SPICE to YAML converter
  • Simplify model names list comprehension
  • Move pattern definition outside the loop
  • Improve string formatting in error messages
  • Optimize instance filtering logic
gplugins/spice/spice_to_yaml.py
Alphabetically sort all lists across multiple modules
  • Reorder exported symbols alphabetically
  • Maintain consistent formatting across module exports
gplugins/gmeep/__init__.py
gplugins/modes/__init__.py
gplugins/devsim/__init__.py
gplugins/tidy3d/__init__.py
gplugins/gmsh/__init__.py
gplugins/sax/__init__.py
gplugins/__init__.py
gplugins/femwell/__init__.py
gplugins/lumerical/__init__.py
Update ruff linter version
  • Upgrade ruff from v0.7.4 to v0.8.0
.pre-commit-config.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.

Comment on lines 460 to 462
instance["params"][param] = (
float(match.group(1)) * CONVERSION[match.group(2)]
float(match[1]) * CONVERSION[match.group(2)]
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Replace m.group(x) with m[x] for re.Match objects (use-getitem-for-re-match-groups)

Suggested change
instance["params"][param] = (
float(match.group(1)) * CONVERSION[match.group(2)]
float(match[1]) * CONVERSION[match.group(2)]
)
instance["params"][param] = float(match[1]) * CONVERSION[match[2]]

@joamatab joamatab added the github_actions Pull requests that update GitHub Actions code label Nov 27, 2024
@joamatab joamatab merged commit 535533b into main Nov 27, 2024
2 of 6 checks passed
@joamatab joamatab deleted the update_ruff_version branch November 27, 2024 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github_actions Pull requests that update GitHub Actions code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant