Skip to content

Add FullLoader class to third_party/2and3/yaml/loader.pyi #3035

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

Merged
merged 2 commits into from
Jun 6, 2019

Conversation

markedwards
Copy link

The yaml module has added the FullLoader class, and it is recommended in their documentation when calling yaml.load(). Adding a type definition here.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Thank you, one remark.

@@ -8,6 +8,9 @@ from yaml.resolver import BaseResolver, Resolver
class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, BaseResolver):
def __init__(self, stream) -> None: ...

class FullLoader(Reader, Scanner, Parser, Composer, SafeConstructor, Resolver):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This actually derives from FullConstructor, which is a sub-class of SafeConstructor. Since we don't have stubs for that class, yet, I see two options:

  • Add FullConstructor to yaml.constructor.pyi, possible marked with # incomplete and use that.
  • Just add a comment explaining that FullConstructor would be correct here.

Copy link
Author

Choose a reason for hiding this comment

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

Doh! Thanks for catching that. Fixed in a second commit.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Thanks!

@srittau srittau merged commit 5c94b58 into python:master Jun 6, 2019
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