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

straight propagates to route filter in get_bundle #914

Merged
merged 1 commit into from Nov 23, 2022
Merged

straight propagates to route filter in get_bundle #914

merged 1 commit into from Nov 23, 2022

Conversation

joamatab
Copy link
Contributor

@joamatab joamatab commented Nov 23, 2022

Now we also allow to use custom straight functions in get_bundle

    c = gf.Component("demo")
    c1 = c << gf.components.mmi2x2()
    c2 = c << gf.components.mmi2x2()
    c2.move((100, 40))
    routes = get_bundle(
        [c1.ports["o2"], c1.ports["o1"]],
        [c2.ports["o1"], c2.ports["o2"]],
        radius=5,
        # layer=(2, 0),
        straight=gf.partial(gf.components.straight, layer=(1, 0), width=1),
    )
    for route in routes:
        c.add(route.references)
    c.show(show_ports=True)

fixes #910

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 23, 2022

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.06%.

Quality metrics Before After Change
Complexity 27.62 😞 27.64 😞 0.02 👎
Method Length 180.20 😞 180.48 😞 0.28 👎
Working memory 18.44 ⛔ 18.45 ⛔ 0.01 👎
Quality 31.93% 😞 31.87% 😞 -0.06% 👎
Other metrics Before After Change
Lines 2875 2888 13
Changed files Quality Before Quality After Quality Change
gdsfactory/routing/get_bundle.py 34.79% 😞 34.61% 😞 -0.18% 👎
gdsfactory/routing/get_bundle_u.py 18.80% ⛔ 18.62% ⛔ -0.18% 👎
gdsfactory/routing/get_route.py 58.88% 🙂 58.88% 🙂 0.00%
gdsfactory/routing/manhattan.py 30.18% 😞 30.18% 😞 0.00%
gdsfactory/routing/path_length_matching.py 44.04% 😞 44.04% 😞 0.00%

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
gdsfactory/routing/manhattan.py round_corners 80 ⛔ 1341 ⛔ 42 ⛔ 0.67% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
gdsfactory/routing/manhattan.py _generate_route_manhattan_points 52 ⛔ 741 ⛔ 25 ⛔ 4.78% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
gdsfactory/routing/get_bundle_u.py _get_bundle_uindirect_waypoints 38 ⛔ 667 ⛔ 9.42% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
gdsfactory/routing/get_bundle.py get_bundle 29 😞 402 ⛔ 18 ⛔ 16.80% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
gdsfactory/routing/get_bundle_u.py _get_bundle_udirect_waypoints 21 😞 552 ⛔ 24 ⛔ 17.26% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@joamatab joamatab merged commit 982732c into master Nov 23, 2022
@joamatab joamatab deleted the 624c branch November 23, 2022 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The straight=<function straight> parameter in get_bundle is not active
1 participant