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

Support stdin #1

Closed
wants to merge 3 commits into from
Closed

Support stdin #1

wants to merge 3 commits into from

Conversation

beck
Copy link

@beck beck commented Oct 8, 2015

flake8-isort blew up my IDE because it did not support stdin.

To duplicate:

$ pip install flake8-isort
$ touch test.py
$ flake8 '-' < test.py
...
IOError: [Errno 2] No such file or directory: '/Users/doug/Projects/flake8-isort/stdin'

These changes ensure flake8 will not blowup.

But I noticed that flake8 checkers fail when contents are piped in:

$ echo "print 'hello world'" > test.py
$ flake8 '-' < test.py
Flake8Isort: stdin is empty

This is an issue upstream and am unsure the best way to fix. I opened:
PyCQA/pycodestyle#443

Also added:

  • silenced output from isort
  • provided a slightly better line number

@gforcada
Copy link
Owner

gforcada commented Oct 8, 2015

First of all thanks for the pull request!

Would you mind to change the context manager for testfixtures.OutputCapture? You can see it in action on run_test.py. This will kill some lines.

def __init__(self, tree, filename):
self.filename = filename
def __init__(self, tree, filename, builtins=None):
self.content = Read.tree(tree) or Read.file(filename) or Read.stdin()
Copy link
Owner

Choose a reason for hiding this comment

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

I would rather prefer to have something like:
self.content = Read(tree, filename)

and returns the expected value, i.e. hiding the complexity inside Read instead of having it on Flake8Isort.

@gforcada
Copy link
Owner

@beck ping :-)

@gforcada
Copy link
Owner

@beck friendly ping :-)

@gforcada
Copy link
Owner

gforcada commented Mar 5, 2016

Fixed on #7 by @mjacksonw and released by yours truly as 1.2. Enjoy!

@gforcada gforcada closed this Mar 5, 2016
@beck beck deleted the doug/support-stdin branch April 24, 2016 18:21
@beck
Copy link
Author

beck commented Apr 24, 2016

👍

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

Successfully merging this pull request may close these issues.

None yet

2 participants