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

pkg_resources: fix stub for get_metadata_lines #2776



Copy link

commented Jan 30, 2019

The corresponding code is:

    def get_metadata_lines(self, name):
        return yield_lines(self.get_metadata(name))

def yield_lines(strs):
    """Yield non-empty/non-comment lines of a string or sequence"""
    if isinstance(strs, six.string_types):
        for s in strs.splitlines():
            s = s.strip()
            # skip blank lines/comments
            if s and not s.startswith('#'):
                yield s
        for ss in strs:
            for s in yield_lines(ss):
                yield s

This should always yield strings, not lists of strings.

(Do you want me to do a single PR with #2775 ?)

@JelleZijlstra JelleZijlstra merged commit caefaa6 into python:master Feb 1, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

This comment has been minimized.

Copy link

commented Feb 1, 2019

Thanks! Small, focused PRs are good, but with small changes like these it may be more efficient to merge the PRs—it's up to you.

@ewjoachim ewjoachim deleted the ewjoachim:pkg_resources_get_metadata_lines branch Feb 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.