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

Make ProcessEnv.bin always return a str #378

Merged
merged 1 commit into from
Feb 8, 2021
Merged

Make ProcessEnv.bin always return a str #378

merged 1 commit into from
Feb 8, 2021

Conversation

jdufresne
Copy link
Contributor

@jdufresne jdufresne commented Jan 1, 2021

The property now never returns None. This simplifies user code containing
types that already knows a bin directory must exist. It avoids the need
to pepper calling code with:

assert session.bin is not None

Or

# type: ignore

For example, in pip:
https://github.com/pypa/pip/blob/062f0e54d99f58e53be36be5a45adad89e2429fb/tools/automation/release/__init__.py#L29

A noxfile that tries to access a bin directory that doesn't exist will
now raise an exception.

The property never returns None. This simplifies user code containing
types that already knows a bin directory must exist. It avoids the need
to pepper calling code with:

    assert session.bin is not None

Or

    # type: ignore

For example, in pip:
https://github.com/pypa/pip/blob/062f0e54d99f58e53be36be5a45adad89e2429fb/tools/automation/release/__init__.py#L29

A noxfile that tries to access a bin directory that doesn't exist will
now raise an exception.
Copy link
Collaborator

@crwilcox crwilcox left a comment

Choose a reason for hiding this comment

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

This LGTM. I am not 100% on it, but I am not sure you could ever get None from bin_paths.

@theacodes theacodes merged commit 1025682 into wntrblm:master Feb 8, 2021
@theacodes
Copy link
Collaborator

Thank you!

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

Successfully merging this pull request may close these issues.

3 participants