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

: pass parameters if given initial_input #305

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

MattCatz
Copy link

Description

If read_callback is given an initial_input, then read_callback does a write and recursively calls itself. Only the callback parameter is passed to that recursive call, preventing any other parameter from having an effect.

fix issue #304

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

All unit tests pass

Checklist:

  • My code follows the style guidelines of this project (no GitHub actions complaints! run make lint before
    committing!)
  • New and existing unit tests pass locally with my changes

@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
scrapli/driver/generic/async_driver.py 94.25% <100.00%> (ø)
scrapli/driver/generic/sync_driver.py 94.11% <100.00%> (ø)

📢 Thoughts on this report? Let us know!.

@carlmontanari
Copy link
Owner

Bam! LGTM -- thanks a bunch @MattCatz !

btw, read_callback, yay? nay? it came out of boxen use cases but seemed like it would be handy. anyway, will smack merge when CI is happy (darglint will pass but will take forever)

@MattCatz
Copy link
Author

Bam! LGTM -- thanks a bunch @MattCatz !

btw, read_callback, yay? nay? it came out of boxen use cases but seemed like it would be handy. anyway, will smack merge when CI is happy (darglint will pass but will take forever)

I haven't done anything really complicated with it yet. I find the main benefit being it is the only way to change transport_timeout on a per command basis. The timeout_modifier decorator only modifies timeout_ops. It is also helpful if you are talking to devices have the same commands but slightly different responses.

@carlmontanari
Copy link
Owner

I find the main benefit being it is the only way to change transport_timeout on a per command basis

ah ok interesting -- ive pretty much defaulted to always setting timeout_transport -> 0 for the last long while basically. its one less timeout to process (yay less threads) and the channel/ops timeout seems to always catch everything, though I think there may be a place or two (during initial connection) where this could block forever but been a while so not 100% offhand.

yeah the rest makes sense! thanks again!

@carlmontanari carlmontanari merged commit 4ae027a into carlmontanari:main Oct 25, 2023
@MattCatz MattCatz deleted the parameters branch January 8, 2025 19:19
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.

2 participants