Skip to content

Commit d1a8490

Browse files
committed
bump ver and minor changes to FileCommand
1 parent fb42bc0 commit d1a8490

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

ipfsApi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
from .client import *
44

55

6-
__version__ = '0.1.12'
6+
__version__ = '0.2.0'

ipfsApi/commands.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ def __init__(self, path, accept_multiple=True):
3838

3939
def request(self, client, f, **kwargs):
4040
if kwargs.pop('recursive', False):
41-
return self.recursive(client, f, **kwargs)
41+
return self.directory(client, f, recursive=True, **kwargs)
4242
if isinstance(f, (list, tuple)):
4343
return self.multiple(client, f, **kwargs)
4444
if isinstance(f, six.string_types) and os.path.isdir(f):
45-
ls = [os.path.join(f, p) for p in os.listdir(f)]
46-
fs = [p for p in ls if os.path.isfile(p)]
47-
return self.multiple(client, fs, **kwargs)
45+
return self.directory(client, f, **kwargs)
4846
else:
4947
return self.single(client, f, **kwargs)
5048

@@ -65,7 +63,8 @@ def multiple(self, client, files, **kwargs):
6563
body, headers = multipart.stream_files(files)
6664
return client.request(self.path, data=body, headers=headers, **kwargs)
6765

68-
def recursive(self, client, dirname, fnpattern='*', **kwargs):
66+
def directory(self, client, dirname,
67+
fnpattern='*', recursive=False, **kwargs):
6968
"""
7069
Loads a directory recursively into IPFS, files are matched against the
7170
given pattern.
@@ -75,7 +74,7 @@ def recursive(self, client, dirname, fnpattern='*', **kwargs):
7574
"[%s] does not accept multiple files." % self.path)
7675
body, headers = multipart.stream_directory(dirname,
7776
fnpattern=fnpattern,
78-
recursive=True)
77+
recursive=recursive)
7978
return client.request(self.path, data=body, headers=headers, **kwargs)
8079

8180

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Versions should comply with PEP440. For a discussion on single-sourcing
88
# the version across setup.py and the project code, see
99
# https://packaging.python.org/en/latest/single_source_version.html
10-
version='0.1.12',
10+
version='0.2.0',
1111

1212
description='IPFS API Bindings for Python',
1313

0 commit comments

Comments
 (0)