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

Include options in loader #414

Open
PS-OnGit opened this issue Jun 29, 2020 · 4 comments
Open

Include options in loader #414

PS-OnGit opened this issue Jun 29, 2020 · 4 comments
Labels

Comments

@PS-OnGit
Copy link

Hello,
since using PyYaml as a input file reader for my project i stumbled upon the "truthy" option.
I know, that it's possible to dissable the option using a yaml configuration file.. But since this would be the only instance of changeing this option, it might be easier having the option to add some options in the loader instead of an external config file.

Thanks in advance!

Cheers,
PS

@perlpunk
Copy link
Member

perlpunk commented Jun 29, 2020

PyYAML doesn't have a truthy option, and it also doesn't read such an option from a config file... What does/should it do?

@PS-OnGit
Copy link
Author

It seems to be a functionality in yaml, which deals with the interpretation of keywords (e.g. yes/YES/Yes/on/On as True, or no/NO/No/off as False).
To be more precise, it's called a Rule which can be used in the yamllint..

Since I have a data structure using off/Off as keys, this is an impractical complication..

@perlpunk
Copy link
Member

It's not possible to influence that in PyYAML via an option.
yamllint is built on top of PyYAML, but uses its own configuration/options.

You can just put your keys in single quotes, or wait until PyYAML implements the YAML 1.2 Core Schema, where things like on and off are not booleans any more: https://perlpunk.github.io/yaml-test-schema/schemas.html

@PS-OnGit
Copy link
Author

Thanks, but its too bad that there is no workaround for this issue..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants