SeanIFitch / icarus_v2

Monitoring software for the Icarus NMR pressure jump apparatus
MIT License
2 stars 0 forks source link

Style refactor #121

Closed gianlucazhang2 closed 1 week ago

gianlucazhang2 commented 1 week ago

Summary by Sourcery

Enhancements:

sourcery-ai[bot] commented 1 week ago

Reviewer's Guide by Sourcery

This pull request refactors the svg_class.py file by removing the color-related classes and functions, and importing a Color class from a separate color_class.py file. The changes simplify the file structure and improve code organization by separating color-related functionality into its own module.

Class diagram for refactored color handling

classDiagram
    class Color {
        +rgba: _RGBA
        +hsla: _HSLA
        +from_rgba(r: int, g: int, b: int, a: int): Color
        +from_hex(hex: str): Color
        +to_hex_argb(): str
        +to_svg_tiny_color_format(): str
        +lighten(factor: float): Color
        +darken(factor: float): Color
        +transparent(factor: float): Color
    }
    class _RGBA {
        -r: int
        -g: int
        -b: int
        -a: float
    }
    class _HSLA {
        -h: int
        -s: float
        -l: float
        -a: float
    }
    Color --> _RGBA
    Color --> _HSLA

File-Level Changes

Change Details Files
Removed color-related classes and functions
  • Removed _RGBA class
  • Removed _HSLA class
  • Removed Color class and its methods
  • Removed _round_float function
src/svg_class.py
Imported Color class from a separate module
  • Added import statement: from color_class import Color
src/svg_class.py
Simplified file structure
  • Removed unused imports (colorsys, math)
  • Kept SVG_RESOURCES constant and _svg_resources function
  • Kept Svg class (partially shown in the diff)
src/svg_class.py

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](https://app.sourcery.ai) 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 - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).