-
Notifications
You must be signed in to change notification settings - Fork 102
Glob #161
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
base: master
Are you sure you want to change the base?
Glob #161
Conversation
|
I resolved all 2.7 compatibility issues. Would appreciate if somebody can point me at the right direction to deal with "Failed to establish a new connection: [Errno 111] Connection refused',))" failures. Looks like it has nothing to do with the source code but rather an environment problem. |
mtth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hdfs/glob.py
Outdated
| import fnmatch | ||
| import re | ||
|
|
||
| from hdfs import Client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from .client import Client|
|
||
|
|
||
| def glob(client, hdfs_path): | ||
| """Return a list of paths matching a pathname pattern. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good doc!
hdfs/glob.py
Outdated
| Sample usages: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| glob(client, './foo/bar/*') | ||
| glob(client, './foo/bar/file[0-9].txt') | ||
| glob(client, './foo/bar/file?.txt') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unindent sample usage? Same for iglob below.
| glob(client, './foo/bar/file?.txt') | ||
|
|
||
| """ | ||
| return list(iglob(client, hdfs_path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glob provides little value over iglob: it saves just the list call. What do you think about only exposing iglob, possibly renaming it to glob?
hdfs/glob.py
Outdated
| yield posixpath.join(dirname, name) | ||
|
|
||
|
|
||
| def glob1(client, dirname, pattern): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefix this (and the other functions below) with an underscore?
|
Hey @mtth any opinion on my latest updates and comments? Are you good with the changes? |
Glob module for HDFS client. The source code was ported from Python 3.4 and tested.