Skip to content

GitConfigParser.items doesn't @need_value (i.e. requires a prior call to .read() ) #888

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

Open
maiamcc opened this issue Jul 3, 2019 · 1 comment

Comments

@maiamcc
Copy link

maiamcc commented Jul 3, 2019

  • a call to GitConfigParser.items("somesection") fails with NoSectionError even when "somesection" exists.
  • however, with a prior call to GitConfigParser.sections() OR .get_value() -- as far as I can tell, anything that trips assure_data_present -- the call to items("somesection") succeeds

I'm not quite sure what's going on under the hood here, but my understanding after poking through the source code a bit:

GitConfigParser.items is not marked with a @needs_values decorator, nor is it a base class method (automatically decorated in MetaParserBuilder.__new__), nor does it call to a base class method with this decorator (as .get_value does) -- without a prior call to a func decorated with @needs_values (or some other call to read()), I assume that .items will always fail. Is this intentional?

@Byron
Copy link
Member

Byron commented Jul 20, 2019

Thanks for the precise description and for digging in.

To me it sounds like an oversight, too. Recently the config parser was upgraded to support multiple values, it may be it learned some tricks and became more ergonomic. I hope to publish a new release this weekend.

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

No branches or pull requests

2 participants