Skip to content

Commit

Permalink
fix read me examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jdidion committed Nov 7, 2016
1 parent 47b0912 commit a180e2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ myfile = xopen('infile.gz')
stdin = xopen(STDIN)

# We have to tell xopen what kind of compression
# to use when writing
# to use when writing to stdout
stdout = xopen(STDOUT, compression='gz')

# Print all lines in a compressed file...
Expand All @@ -49,11 +49,11 @@ def dostuff(path_or_file):
print(line)

# Read all lines in a compressed file into a list
from xphyle.utils import safe_file_iter
from xphyle.utils import safe_iter
lines = list(safe_iter('infile.gz'))

# Sum the rows in a compressed file where each line is an integer value
total = sum(i for i in safe_iter('infile.gz', convert=int))
total = sum(safe_iter('infile.gz', convert=int))
```

See the [Documentation](https://xphyle.readthedocs.io) for full usage information.
Expand Down
2 changes: 1 addition & 1 deletion xphyle/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def safe_iter(path : 'str', convert : 'callable' = None,
try:
path = check_readable_file(path)
except IOError:
return
return ()
with open_(path, **kwargs) as f:
itr = f
if strip_linesep:
Expand Down

0 comments on commit a180e2b

Please sign in to comment.