Improve typing for import_from_yaml and export_to_yaml#134
Open
Morwenn wants to merge 2 commits into
Open
Conversation
Owner
|
Hello, Thanks for the suggested change and the explanations. Are there other places where a filepath is expected and accepting a Path object makes sense? Could you check and apply your change, so that we uniformly and consistently accept Path objects as well? Thanks! |
Author
|
I searched for all instances of |
Owner
|
Thanks, I'll also check on my side (I think there are a few other places where we support file paths such as in the bdd cli). I'll be away for a few days so don't worry if this pr remains open for now :-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, thanks for the great library.
I regularly need to send
pathlike.Pathobjects to thefilepathparameter ofimport_from_yaml. It does already work correctly becausefilepathis simply forwarded toopen, but it breaks the typing, forcing me to either use#type: ignoreor to convert the path to a string explicitly, which becomes a bit noisy when there's many occurrences.This MR changes the expected type of
filepathfromstrtoUnion[str, bytes, os.PathLike], mirroring whatopenaccepts.I modified
export_to_yamlas a drive-by fix for consistency, since it also just forwards its parameter toopen.