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

more_robust_updk_import #2722

Merged
merged 1 commit into from
May 6, 2024
Merged

more_robust_updk_import #2722

merged 1 commit into from
May 6, 2024

Conversation

joamatab
Copy link
Contributor

@joamatab joamatab commented May 6, 2024

No description provided.

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.

Hey @joamatab - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟡 Testing: 1 issue found
  • 🟢 Complexity: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

if hasattr(block, "parameters"):
parameters = block.parameters
else:
print(f"{block_name=}, {block=} does not have parameters")
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_refinement): Consider replacing print statement with logging.

Using logging instead of print allows better control over the output and can be configured to include more information such as timestamps or log levels.

Suggested change
print(f"{block_name=}, {block=} does not have parameters")
import logging
logger = logging.getLogger(__name__)
if hasattr(block, "parameters"):
parameters = block.parameters
else:
logger.warning(f"{block_name=}, {block=} does not have parameters")
continue

Comment on lines +108 to +112
if hasattr(block, "parameters"):
parameters = block.parameters
else:
print(f"{block_name=}, {block=} does not have parameters")
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (testing): Missing test for the new conditional logic handling blocks without parameters.

The addition of conditional checks for 'parameters' attribute in blocks requires corresponding unit tests to verify that blocks without parameters are handled correctly and that the function continues as expected.

Copy link

codecov bot commented May 6, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 71.73%. Comparing base (d21b5ed) to head (2c4ad79).
Report is 1 commits behind head on main.

Files Patch % Lines
gdsfactory/read/from_updk.py 25.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2722      +/-   ##
==========================================
- Coverage   71.74%   71.73%   -0.01%     
==========================================
  Files         366      366              
  Lines       23815    23818       +3     
  Branches     3882     3883       +1     
==========================================
  Hits        17086    17086              
- Misses       5603     5605       +2     
- Partials     1126     1127       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@joamatab joamatab added the maintenance patch label May 6, 2024
@joamatab joamatab merged commit a588f3c into main May 6, 2024
11 of 14 checks passed
@joamatab joamatab deleted the more_robust_updk_import branch May 6, 2024 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant