Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Be kinder if the package is a requirements file #111

Merged

Conversation

peterbe
Copy link
Owner

@peterbe peterbe commented Mar 6, 2019

Fixes #104

@mythmon r?

It's a small and conservative change. I've been bitten by it so many times when running hashin -u -i requirements/default.txt and it essentially complaining at me when it assumes that requirements/default.txt is the name of a python package.

Copy link
Contributor

@mythmon mythmon left a comment

Choose a reason for hiding this comment

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

I think this is a nice quality of life improvement. I don't think it's going to cause any trbouel, since you are checking that the passed argument is a file that ends in .txt.

and args.packages
and len(args.packages) == 1
and os.path.isfile(args.packages[0])
and args.packages[0].endswith(".txt")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would a small improvement to re-arrange these so that the file existence check happens last, since that is going to be the most expensive one.

@peterbe peterbe merged commit 5ef4660 into master Mar 6, 2019
@peterbe peterbe deleted the 104-be-kinder-if-the-package-is-a-requirements-file branch March 6, 2019 20:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants