-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add __all__ to more files #594
Conversation
Reviewer's Guide by SourceryThis pull request adds all declarations to multiple files to control module exports, refactors type aliasing and type hinting for improved clarity and type safety, and simplifies error handling using match-case statements. Class diagram showing updated type hierarchy for ProtoKCell and related classesclassDiagram
class GeometricObject~TUnit~ {
<<abstract>>
+kcl: KCLayout
+bbox(layer: int|None): BoxLike~TUnit~
+transform(trans: Trans|DTrans|ICplxTrans|DCplxTrans)
}
class ProtoKCell~TUnit,TBaseCell~ {
<<abstract>>
-_base_kcell: TBaseCell
+locked: bool
}
class ProtoTKCell~TUnit~ {
<<abstract>>
}
class VKCell {
-_shapes: dict[int, VShapes]
-_name: str|None
}
GeometricObject <|-- ProtoKCell
ProtoKCell <|-- ProtoTKCell
ProtoKCell <|-- VKCell
note for ProtoKCell "Updated to use generic TBaseCell"
Class diagram showing updated type aliases and relationshipsclassDiagram
class AnyKCell {
<<type alias>>
}
class AnyTKCell {
<<type alias>>
}
class ProtoKCell
class ProtoTKCell
AnyKCell .. ProtoKCell : ProtoKCell[Any, Any]
AnyTKCell .. ProtoTKCell : ProtoTKCell[Any]
note for AnyKCell "New type alias for generic ProtoKCell"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this 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.
@@ -766,15 +772,15 @@ def insert_into_flat( | |||
@overload | |||
def insert_into_flat( | |||
self, | |||
cell: ProtoTKCell[Any] | VKCell, | |||
cell: AnyKCell, | |||
*, | |||
trans: kdb.DCplxTrans | None = None, | |||
levels: int, | |||
) -> None: ... | |||
|
|||
def insert_into_flat( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (code-quality): We've found these issues:
- Swap if/else branches (
swap-if-else-branches
) - Merge else clause's nested if statement into elif (
merge-else-if-into-elif
) - Low code quality found in VInstance.insert_into_flat - 25% (
low-code-quality
)
Explanation
The quality score for this function is below the quality threshold of 25%.
This score is a combination of the method length, cognitive complexity and working memory.
How can you solve this?
It might be worth refactoring this function to make it shorter and more readable.
- Reduce the function length by extracting pieces of functionality out into
their own functions. This is the most important thing you can do - ideally a
function should be less than 10 lines. - Reduce nesting, perhaps by introducing guard clauses to return early.
- Ensure that variables are tightly scoped, so that code using related concepts
sits together within the function rather than being scattered.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #594 +/- ##
==========================================
+ Coverage 63.50% 63.61% +0.11%
==========================================
Files 64 64
Lines 9573 9561 -12
Branches 1785 1777 -8
==========================================
+ Hits 6079 6082 +3
+ Misses 2943 2928 -15
Partials 551 551 ☔ View full report in Codecov by Sentry. |
Summary by Sourcery
Enhance module encapsulation by adding all declarations to various files, refactor type annotations to use new type aliases AnyKCell and AnyTKCell, and simplify error handling in switch cases.
Enhancements: