Skip to content

Instantly share code, notes, and snippets.

@radfish
Last active June 27, 2020 21:45
Show Gist options
  • Save radfish/8bf3f64bc47c8ec123c469421ab293de to your computer and use it in GitHub Desktop.
Save radfish/8bf3f64bc47c8ec123c469421ab293de to your computer and use it in GitHub Desktop.
patch on top of ipfshttpclient4ipwb 0.6.0 released on PyPI to fix tests
diff -U3 -r a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py 2020-06-27 17:33:20.358686654 -0400
+++ b/docs/conf.py 2020-06-27 17:37:46.772497763 -0400
@@ -373,7 +373,7 @@
def import_object(self):
"""Prevent client class objects from being marked as “properties”."""
if super().import_object():
- # Document the shadowed `ipfshttpclient4ipwb.client.base.Section` type
+ # Document the shadowed `ipfshttpclient.client.base.Section` type
# rather then its (uninteresting) property wrapper
self.doc_as_attr = False
return True
diff -U3 -r a/docs/publish.py b/docs/publish.py
--- a/docs/publish.py 2020-06-27 17:33:20.362020034 -0400
+++ b/docs/publish.py 2020-06-27 17:37:46.775831144 -0400
@@ -5,7 +5,7 @@
sys.path.insert(0, os.path.join(__dir__, ".."))
import sphinx.cmd.build
-import ipfshttpclient4ipwb
+import ipfshttpclient
# Ensure working directory is script directory
os.chdir(__dir__)
@@ -24,7 +24,7 @@
print()
print("Exporting files to IPFS…")
- client = ipfshttpclient4ipwb.connect()
+ client = ipfshttpclient.connect()
hash_docs = client.add("build/html", recursive=True, raw_leaves=True, pin=False)[-1]["Hash"]
hash_main = client.object.new("unixfs-dir")["Hash"]
hash_main = client.object.patch.add_link(hash_main, "docs", hash_docs)["Hash"]
diff -U3 -r a/ipfshttpclient4ipwb/client/base.py b/ipfshttpclient4ipwb/client/base.py
--- a/ipfshttpclient4ipwb/client/base.py 2020-06-27 17:33:20.362020034 -0400
+++ b/ipfshttpclient4ipwb/client/base.py 2020-06-27 17:37:46.795831434 -0400
@@ -104,7 +104,7 @@
chunk_size : int
The size of the chunks to break uploaded files and text content into
session : bool
- Create this :class:`~ipfshttpclient4ipwb.Client` instance with a session
+ Create this :class:`~ipfshttpclient.Client` instance with a session
already open? (Useful for long-running client objects.)
"""
diff -U3 -r a/ipfshttpclient4ipwb/client/block.py b/ipfshttpclient4ipwb/client/block.py
--- a/ipfshttpclient4ipwb/client/block.py 2020-06-27 17:33:20.362020034 -0400
+++ b/ipfshttpclient4ipwb/client/block.py 2020-06-27 17:37:46.795831434 -0400
@@ -50,7 +50,7 @@
dict
Information about the new block
- See :meth:`~ipfshttpclient4ipwb.Client.block.stat`
+ See :meth:`~ipfshttpclient.Client.block.stat`
"""
body, headers = multipart.stream_files(file, chunk_size=self.chunk_size)
return self._client.request('/block/put', decoder='json', data=body,
diff -U3 -r a/ipfshttpclient4ipwb/client/dht.py b/ipfshttpclient4ipwb/client/dht.py
--- a/ipfshttpclient4ipwb/client/dht.py 2020-06-27 17:33:20.362020034 -0400
+++ b/ipfshttpclient4ipwb/client/dht.py 2020-06-27 17:37:46.799164815 -0400
@@ -130,7 +130,7 @@
You may only use keytypes that are supported in your ``ipfs`` binary:
``go-ipfs`` currently only supports the ``/ipns/`` keytype. Unless you
have a relatively deep understanding of the key's internal structure,
- you likely want to be using the :meth:`~ipfshttpclient4ipwb.Client.name_publish`
+ you likely want to be using the :meth:`~ipfshttpclient.Client.name_publish`
instead.
Value is arbitrary text.
diff -U3 -r a/ipfshttpclient4ipwb/client/files.py b/ipfshttpclient4ipwb/client/files.py
--- a/ipfshttpclient4ipwb/client/files.py 2020-06-27 17:33:20.362020034 -0400
+++ b/ipfshttpclient4ipwb/client/files.py 2020-06-27 17:37:46.802498197 -0400
@@ -267,7 +267,7 @@
The set of files and directories included in the upload may be restricted
by passing any combination of glob matching strings, compiled regular
- expression objects and custom :class:`~ipfshttpclient4ipwb.filescanner.Matcher`
+ expression objects and custom :class:`~ipfshttpclient.filescanner.Matcher`
objects. A file or directory will be included if it matches of the
patterns provided. For regular expressions please note that as predicting
which directories are relevant to the given pattern is impossible to do
diff -U3 -r a/ipfshttpclient4ipwb/client/__init__.py b/ipfshttpclient4ipwb/client/__init__.py
--- a/ipfshttpclient4ipwb/client/__init__.py 2020-06-27 17:33:20.362020034 -0400
+++ b/ipfshttpclient4ipwb/client/__init__.py 2020-06-27 17:37:46.805831578 -0400
@@ -44,7 +44,7 @@
Raises
------
- ~ipfshttpclient4ipwb.exceptions.VersionMismatch
+ ~ipfshttpclient.exceptions.VersionMismatch
Parameters
----------
@@ -72,25 +72,25 @@
def connect(addr=DEFAULT_ADDR, base=DEFAULT_BASE, *,
chunk_size=multipart.default_chunk_size,
session=False, **defaults):
- """Create a new :class:`~ipfshttpclient4ipwb.Client` instance and connect to the
+ """Create a new :class:`~ipfshttpclient.Client` instance and connect to the
daemon to validate that its version is supported.
Raises
------
- ~ipfshttpclient4ipwb.exceptions.VersionMismatch
- ~ipfshttpclient4ipwb.exceptions.ErrorResponse
- ~ipfshttpclient4ipwb.exceptions.ConnectionError
- ~ipfshttpclient4ipwb.exceptions.ProtocolError
- ~ipfshttpclient4ipwb.exceptions.StatusError
- ~ipfshttpclient4ipwb.exceptions.TimeoutError
+ ~ipfshttpclient.exceptions.VersionMismatch
+ ~ipfshttpclient.exceptions.ErrorResponse
+ ~ipfshttpclient.exceptions.ConnectionError
+ ~ipfshttpclient.exceptions.ProtocolError
+ ~ipfshttpclient.exceptions.StatusError
+ ~ipfshttpclient.exceptions.TimeoutError
All parameters are identical to those passed to the constructor of the
- :class:`~ipfshttpclient4ipwb.Client` class.
+ :class:`~ipfshttpclient.Client` class.
Returns
-------
- :class:`~ipfshttpclient4ipwb.Client`
+ :class:`~ipfshttpclient.Client`
"""
# Create client instance
client = Client(addr, base, chunk_size=chunk_size, session=session, **defaults)
@@ -130,13 +130,13 @@
The easiest way of using this “session management” facility is using a
context manager::
- with ipfshttpclient4ipwb.connect() as client:
+ with ipfshttpclient.connect() as client:
print(client.version()) # These calls…
print(client.version()) # …will reuse their TCP connection
A client object may be re-opened several times::
- client = ipfshttpclient4ipwb.connect()
+ client = ipfshttpclient.connect()
print(client.version()) # Perform API call on separate TCP connection
with client:
print(client.version()) # These calls…
@@ -149,7 +149,7 @@
class Consumer:
def __init__(self):
- self._client = ipfshttpclient4ipwb.connect(session=True)
+ self._client = ipfshttpclient.connect(session=True)
# … other code …
@@ -190,7 +190,7 @@
resources.
If there was no session currently open this method does nothing. An open
- session is not a requirement for using a :class:`~ipfshttpclient4ipwb.Client`
+ session is not a requirement for using a :class:`~ipfshttpclient.Client`
object and as such all method defined on it will continue to work, but
a new TCP connection will be established for each and every API call
invoked. Such a usage should therefor be avoided and may cause a warning
diff -U3 -r a/ipfshttpclient4ipwb/client/key.py b/ipfshttpclient4ipwb/client/key.py
--- a/ipfshttpclient4ipwb/client/key.py 2020-06-27 17:33:20.365353414 -0400
+++ b/ipfshttpclient4ipwb/client/key.py 2020-06-27 17:37:46.805831578 -0400
@@ -8,7 +8,7 @@
@base.returns_single_item
def gen(self, key_name, type, size=2048, **kwargs):
"""Adds a new public key that can be used for
- :meth:`~ipfshttpclient4ipwb.Client.name.publish`.
+ :meth:`~ipfshttpclient.Client.name.publish`.
.. code-block:: python
@@ -52,7 +52,7 @@
@base.returns_single_item
def list(self, **kwargs):
"""Returns a list of generated public keys that can be used with
- :meth:`~ipfshttpclient4ipwb.Client.name.publish`.
+ :meth:`~ipfshttpclient.Client.name.publish`.
.. code-block:: python
diff -U3 -r a/ipfshttpclient4ipwb/client/miscellaneous.py b/ipfshttpclient4ipwb/client/miscellaneous.py
--- a/ipfshttpclient4ipwb/client/miscellaneous.py 2020-06-27 17:33:20.365353414 -0400
+++ b/ipfshttpclient4ipwb/client/miscellaneous.py 2020-06-27 17:37:46.809164960 -0400
@@ -169,7 +169,7 @@
"""Stop the connected IPFS daemon instance.
Sending any further requests after this will fail with
- :class:`~ipfshttpclient4ipwb.exceptions.ConnectionError`, until you start
+ :class:`~ipfshttpclient.exceptions.ConnectionError`, until you start
another IPFS daemon instance.
"""
try:
diff -U3 -r a/ipfshttpclient4ipwb/client/object.py b/ipfshttpclient4ipwb/client/object.py
--- a/ipfshttpclient4ipwb/client/object.py 2020-06-27 17:33:20.365353414 -0400
+++ b/ipfshttpclient4ipwb/client/object.py 2020-06-27 17:37:46.812498342 -0400
@@ -316,7 +316,7 @@
dict
Hash and links of the created DAG object
- See the :meth:`~ipfshttpclient4ipwb.Client.object.links` method for
+ See the :meth:`~ipfshttpclient.Client.object.links` method for
details.
"""
body, headers = multipart.stream_files(file, chunk_size=self.chunk_size)
diff -U3 -r a/ipfshttpclient4ipwb/client/pin.py b/ipfshttpclient4ipwb/client/pin.py
--- a/ipfshttpclient4ipwb/client/pin.py 2020-06-27 17:33:20.365353414 -0400
+++ b/ipfshttpclient4ipwb/client/pin.py 2020-06-27 17:37:46.815831723 -0400
@@ -58,7 +58,7 @@
'QmNNPMA1eGUbKxeph6yqV8ZmRkdVat … YMuz': {'Type': 'recursive'}}}
>>> client.pin.ls('/ipfs/QmdBCSn4UJP82MjhRVwpABww48tXL3 … mA6z')
- ipfshttpclient4ipwb.exceptions.ErrorResponse:
+ ipfshttpclient.exceptions.ErrorResponse:
path '/ipfs/QmdBCSn4UJP82MjhRVwpABww48tXL3 … mA6z' is not pinned
Parameters
@@ -135,8 +135,8 @@
Updates one pin to another, making sure that all objects in the new pin
are local. Then removes the old pin. This is an optimized version of
- using first using :meth:`~ipfshttpclient4ipwb.Client.pin.add` to add a new pin
- for an object and then using :meth:`~ipfshttpclient4ipwb.Client.pin.rm` to remove
+ using first using :meth:`~ipfshttpclient.Client.pin.add` to add a new pin
+ for an object and then using :meth:`~ipfshttpclient.Client.pin.rm` to remove
the pin for the old object.
.. code-block:: python
diff -U3 -r a/ipfshttpclient4ipwb/client/unstable.py b/ipfshttpclient4ipwb/client/unstable.py
--- a/ipfshttpclient4ipwb/client/unstable.py 2020-06-27 17:33:20.365353414 -0400
+++ b/ipfshttpclient4ipwb/client/unstable.py 2020-06-27 17:37:46.819165105 -0400
@@ -126,7 +126,7 @@
"""Returns a list of hashes of objects referenced by the given hash.
**This API is subject to future change or removal!** You likely want to
- use :meth:`~ipfshttpclient4ipwb.object.links` instead.
+ use :meth:`~ipfshttpclient.object.links` instead.
.. code-block:: python
diff -U3 -r a/ipfshttpclient4ipwb/encoding.py b/ipfshttpclient4ipwb/encoding.py
--- a/ipfshttpclient4ipwb/encoding.py 2020-06-27 17:33:20.365353414 -0400
+++ b/ipfshttpclient4ipwb/encoding.py 2020-06-27 17:37:46.875832592 -0400
@@ -27,7 +27,7 @@
Raises
------
- ~ipfshttpclient4ipwb.exceptions.DecodingError
+ ~ipfshttpclient.exceptions.DecodingError
Parameters
----------
@@ -45,7 +45,7 @@
Raises
------
- ~ipfshttpclient4ipwb.exceptions.DecodingError
+ ~ipfshttpclient.exceptions.DecodingError
Returns
-------
@@ -58,7 +58,7 @@
Raises
------
- ~ipfshttpclient4ipwb.exceptions.DecodingError
+ ~ipfshttpclient.exceptions.DecodingError
Parameters
----------
@@ -79,7 +79,7 @@
Raises
------
- ~ipfshttpclient4ipwb.exceptions.EncodingError
+ ~ipfshttpclient.exceptions.EncodingError
Parameters
----------
@@ -140,7 +140,7 @@
Raises
------
- ~ipfshttpclient4ipwb.exceptions.DecodingError
+ ~ipfshttpclient.exceptions.DecodingError
Returns
-------
@@ -232,7 +232,7 @@
Raises
------
- ~ipfshttpclient4ipwb.exceptions.DecodingError
+ ~ipfshttpclient.exceptions.DecodingError
Returns
-------
@@ -262,7 +262,7 @@
Raises
------
- ~ipfshttpclient4ipwb.exceptions.EncodingError
+ ~ipfshttpclient.exceptions.EncodingError
Parameters
----------
@@ -306,7 +306,7 @@
Raises
------
- ~ipfshttpclient4ipwb.exceptions.EncoderMissingError
+ ~ipfshttpclient.exceptions.EncoderMissingError
Parameters
----------
diff -U3 -r a/ipfshttpclient4ipwb/http.py b/ipfshttpclient4ipwb/http.py
--- a/ipfshttpclient4ipwb/http.py 2020-06-27 17:33:20.368686795 -0400
+++ b/ipfshttpclient4ipwb/http.py 2020-06-27 17:37:46.879165973 -0400
@@ -146,13 +146,13 @@
timeout : Union[numbers.Real, Tuple[numbers.Real, numbers.Real], NoneType]
The default number of seconds to wait when establishing a connection to
the daemon and waiting for returned data before throwing
- :exc:`~ipfshttpclient4ipwb.exceptions.TimeoutError`; if the value is a tuple
+ :exc:`~ipfshttpclient.exceptions.TimeoutError`; if the value is a tuple
its contents will be interpreted as the values for the connection and
receiving phases respectively, otherwise the value will apply to both
phases; if the value is ``None`` then all timeouts will be disabled
defaults : dict
The default parameters to be passed to
- :meth:`~ipfshttpclient4ipwb.http.HTTPClient.request`
+ :meth:`~ipfshttpclient.http.HTTPClient.request`
"""
__metaclass__ = abc.ABCMeta
@@ -227,7 +227,7 @@
def close_session(self):
"""Close a session opened by
- :meth:`~ipfshttpclient4ipwb.http.HTTPClient.open_session`.
+ :meth:`~ipfshttpclient.http.HTTPClient.open_session`.
If there is no session currently open (ie: it was already closed), then
this method does nothing."""
@@ -309,11 +309,11 @@
Raises
------
- ~ipfshttpclient4ipwb.exceptions.ErrorResponse
- ~ipfshttpclient4ipwb.exceptions.ConnectionError
- ~ipfshttpclient4ipwb.exceptions.ProtocolError
- ~ipfshttpclient4ipwb.exceptions.StatusError
- ~ipfshttpclient4ipwb.exceptions.TimeoutError
+ ~ipfshttpclient.exceptions.ErrorResponse
+ ~ipfshttpclient.exceptions.ConnectionError
+ ~ipfshttpclient.exceptions.ProtocolError
+ ~ipfshttpclient.exceptions.StatusError
+ ~ipfshttpclient.exceptions.TimeoutError
Parameters
----------
@@ -387,11 +387,11 @@
Raises
------
- ~ipfshttpclient4ipwb.exceptions.ErrorResponse
- ~ipfshttpclient4ipwb.exceptions.ConnectionError
- ~ipfshttpclient4ipwb.exceptions.ProtocolError
- ~ipfshttpclient4ipwb.exceptions.StatusError
- ~ipfshttpclient4ipwb.exceptions.TimeoutError
+ ~ipfshttpclient.exceptions.ErrorResponse
+ ~ipfshttpclient.exceptions.ConnectionError
+ ~ipfshttpclient.exceptions.ProtocolError
+ ~ipfshttpclient.exceptions.StatusError
+ ~ipfshttpclient.exceptions.TimeoutError
Parameters
----------
diff -U3 -r a/ipfshttpclient4ipwb/multipart.py b/ipfshttpclient4ipwb/multipart.py
--- a/ipfshttpclient4ipwb/multipart.py 2020-06-27 17:33:20.368686795 -0400
+++ b/ipfshttpclient4ipwb/multipart.py 2020-06-27 17:37:46.882499355 -0400
@@ -293,7 +293,7 @@
A buffered generator that encodes an array of files as
:mimetype:`multipart/form-data`. This is a concrete implementation of
- :class:`~ipfshttpclient4ipwb.multipart.StreamBase`.
+ :class:`~ipfshttpclient.multipart.StreamBase`.
Parameters
----------
diff -U3 -r a/PKG-INFO b/PKG-INFO
--- a/PKG-INFO 1969-12-31 19:00:00.000000000 -0500
+++ b/PKG-INFO 2020-06-27 17:37:47.032501526 -0400
@@ -1,5 +1,5 @@
Metadata-Version: 1.1
-Name: ipfshttpclient4ipwb
+Name: ipfshttpclient
Version: 0.6.0
Summary: Python IPFS HTTP CLIENT library
Home-page: https://ipfs.io/ipns/12D3KooWEqnTdgqHnkkwarSrJjeMP2ZJiADWLYADaNvUb6SQNyPF/
diff -U3 -r a/pyproject.toml b/pyproject.toml
--- a/pyproject.toml 2020-06-24 09:49:51.876663400 -0400
+++ b/pyproject.toml 2020-06-27 17:37:46.905833026 -0400
@@ -3,7 +3,7 @@
build-backend = "flit_core.buildapi"
[tool.flit.metadata]
-module = "ipfshttpclient4ipwb"
+module = "ipfshttpclient"
author = "py-ipfs-http-client team"
author-email = ""
diff -U3 -r a/setup.py b/setup.py
--- a/setup.py 1969-12-31 19:00:00.000000000 -0500
+++ b/setup.py 2020-06-27 17:37:47.029168145 -0400
@@ -4,7 +4,7 @@
from distutils.core import setup
packages = \
-['ipfshttpclient4ipwb', 'ipfshttpclient4ipwb.client']
+['ipfshttpclient', 'ipfshttpclient.client']
package_data = \
{'': ['*']}
@@ -12,7 +12,7 @@
install_requires = \
['multiaddr>=0.0.7', 'requests>=2.11']
-setup(name='ipfshttpclient4ipwb',
+setup(name='ipfshttpclient',
version='0.6.0',
description='Python IPFS HTTP CLIENT library',
author='py-ipfs-http-client team',
diff -U3 -r a/test/functional/conftest.py b/test/functional/conftest.py
--- a/test/functional/conftest.py 2020-06-27 17:33:20.368686795 -0400
+++ b/test/functional/conftest.py 2020-06-27 17:37:46.952500368 -0400
@@ -4,7 +4,7 @@
import pytest
-import ipfshttpclient4ipwb
+import ipfshttpclient
TEST_DIR = pathlib.Path(__file__).parent
@@ -19,13 +19,13 @@
if not isinstance(__is_available, bool):
try:
- ipfshttpclient4ipwb.connect()
- except ipfshttpclient4ipwb.exceptions.Error as error:
+ ipfshttpclient.connect()
+ except ipfshttpclient.exceptions.Error as error:
print("connect failed", error)
__is_available = False
# Make sure version incompatibility is displayed to users
- if isinstance(error, ipfshttpclient4ipwb.exceptions.VersionMismatch):
+ if isinstance(error, ipfshttpclient.exceptions.VersionMismatch):
raise
else:
__is_available = True
@@ -39,7 +39,7 @@
def get_client(offline=False):
if is_available():
- return ipfshttpclient4ipwb.Client(offline=offline)
+ return ipfshttpclient.Client(offline=offline)
else:
pytest.skip("Running IPFS node required")
diff -U3 -r a/test/functional/test_files.py b/test/functional/test_files.py
--- a/test/functional/test_files.py 2020-06-27 17:33:20.368686795 -0400
+++ b/test/functional/test_files.py 2020-06-27 17:37:46.955833750 -0400
@@ -5,8 +5,8 @@
import pytest
import pytest_cid
-import ipfshttpclient4ipwb.exceptions
-import ipfshttpclient4ipwb.filescanner
+import ipfshttpclient.exceptions
+import ipfshttpclient.filescanner
import conftest
@@ -205,7 +205,7 @@
error_msg = None
try:
client.add(FAKE_FILE1_PATH, nocopy=True, raw_leaves=False)
- except ipfshttpclient4ipwb.exceptions.ErrorResponse as exc:
+ except ipfshttpclient.exceptions.ErrorResponse as exc:
error_msg = exc.args[0]
assert error_msg is not None and "--raw-leaves" in error_msg
@@ -238,7 +238,7 @@
error_msg = None
try:
client.add(calc_path_rel_to_cwd(FAKE_FILE1_PATH), nocopy=True)
- except ipfshttpclient4ipwb.exceptions.ErrorResponse as exc:
+ except ipfshttpclient.exceptions.ErrorResponse as exc:
error_msg = exc.args[0]
# For relative paths, multipart streaming layer won't append the
@@ -259,16 +259,16 @@
assert conftest.sort_by_key(res) == conftest.sort_by_key(FAKE_DIR_FNPATTERN1_HASH)
[email protected](not ipfshttpclient4ipwb.filescanner.HAVE_FWALK,
[email protected](not ipfshttpclient.filescanner.HAVE_FWALK,
reason="No point in disabling os.fwalk if it isn't actually supported")
def test_add_filepattern_from_dirname_nofwalk(client, cleanup_pins, monkeypatch):
- monkeypatch.setattr(ipfshttpclient4ipwb.filescanner, "HAVE_FWALK", False)
+ monkeypatch.setattr(ipfshttpclient.filescanner, "HAVE_FWALK", False)
res = client.add(FAKE_DIR_PATH, pattern=FAKE_DIR_FNPATTERN1)
assert conftest.sort_by_key(res) == conftest.sort_by_key(FAKE_DIR_FNPATTERN1_HASH)
[email protected](not ipfshttpclient4ipwb.filescanner.HAVE_FWALK,
[email protected](not ipfshttpclient.filescanner.HAVE_FWALK,
reason="Passing directory as file descriptor requires os.fwalk")
def test_add_filepattern_from_dirfd(client, cleanup_pins):
fd = os.open(str(FAKE_DIR_PATH), os.O_RDONLY | O_DIRECTORY) # type: int
@@ -284,10 +284,10 @@
assert conftest.sort_by_key(res) == conftest.sort_by_key(FAKE_DIR_FNPATTERN1_RECURSIVE_HASH)
[email protected](not ipfshttpclient4ipwb.filescanner.HAVE_FWALK,
[email protected](not ipfshttpclient.filescanner.HAVE_FWALK,
reason="No point in disabling os.fwalk if it isn't actually supported")
def test_add_filepattern_from_dirname_recursive_nofwalk(client, cleanup_pins, monkeypatch):
- monkeypatch.setattr(ipfshttpclient4ipwb.filescanner, "HAVE_FWALK", False)
+ monkeypatch.setattr(ipfshttpclient.filescanner, "HAVE_FWALK", False)
res = client.add(FAKE_DIR_PATH, pattern=FAKE_DIR_FNPATTERN1, recursive=True)
assert conftest.sort_by_key(res) == conftest.sort_by_key(FAKE_DIR_FNPATTERN1_RECURSIVE_HASH)
@@ -296,7 +296,7 @@
@pytest.mark.skipif(sys.platform.startswith("win"),
reason="Opening directory FDs does not work on Windows")
def test_add_filepattern_from_dirfd_recursive_nofwalk(client, cleanup_pins, monkeypatch):
- monkeypatch.setattr(ipfshttpclient4ipwb.filescanner, "HAVE_FWALK", False)
+ monkeypatch.setattr(ipfshttpclient.filescanner, "HAVE_FWALK", False)
with pytest.raises(NotImplementedError):
fd = os.open(str(FAKE_DIR_PATH), os.O_RDONLY | O_DIRECTORY) # type: int
@@ -306,7 +306,7 @@
os.close(fd)
[email protected](not ipfshttpclient4ipwb.filescanner.HAVE_FWALK,
[email protected](not ipfshttpclient.filescanner.HAVE_FWALK,
reason="Passing directory as file descriptor requires os.fwalk")
def test_add_filepattern_from_dirfd_recursive(client, cleanup_pins):
fd = os.open(str(FAKE_DIR_PATH), os.O_RDONLY | O_DIRECTORY) # type: int
@@ -323,10 +323,10 @@
assert conftest.sort_by_key(res) == conftest.sort_by_key(FAKE_DIR_FNPATTERN1_RECURSIVE_HASH)
[email protected](not ipfshttpclient4ipwb.filescanner.HAVE_FWALK,
[email protected](not ipfshttpclient.filescanner.HAVE_FWALK,
reason="No point in disabling os.fwalk if it isn't actually supported")
def test_add_filepattern_from_dirname_recursive_nofwalk_binary(client, cleanup_pins, monkeypatch):
- monkeypatch.setattr(ipfshttpclient4ipwb.filescanner, "HAVE_FWALK", False)
+ monkeypatch.setattr(ipfshttpclient.filescanner, "HAVE_FWALK", False)
res = client.add(os.fsencode(str(FAKE_DIR_PATH)),
pattern=os.fsencode(FAKE_DIR_FNPATTERN1), recursive=True)
@@ -491,5 +491,5 @@
# Remove directory
client.files.rm(TEST_MFS_DIRECTORY, recursive=True)
- with pytest.raises(ipfshttpclient4ipwb.exceptions.Error):
+ with pytest.raises(ipfshttpclient.exceptions.Error):
client.files.stat(TEST_MFS_DIRECTORY)
\ No newline at end of file
diff -U3 -r a/test/functional/test_other.py b/test/functional/test_other.py
--- a/test/functional/test_other.py 2020-06-27 17:33:20.368686795 -0400
+++ b/test/functional/test_other.py 2020-06-27 17:37:46.959167131 -0400
@@ -1,4 +1,4 @@
-import ipfshttpclient4ipwb
+import ipfshttpclient
import conftest
@@ -10,7 +10,7 @@
"""
assert conftest.is_available(), \
"Functional tests require an IPFS node to be available at: {0}" \
- .format(ipfshttpclient4ipwb.DEFAULT_ADDR)
+ .format(ipfshttpclient.DEFAULT_ADDR)
def test_add_json(client, cleanup_pins):
diff -U3 -r a/test/functional/test_pin.py b/test/functional/test_pin.py
--- a/test/functional/test_pin.py 2020-06-27 17:33:20.368686795 -0400
+++ b/test/functional/test_pin.py 2020-06-27 17:37:46.962500513 -0400
@@ -1,6 +1,6 @@
import pytest
-import ipfshttpclient4ipwb.exceptions
+import ipfshttpclient.exceptions
class Resources:
@@ -25,7 +25,7 @@
try:
resp = client.pin.ls(path)
assert path.split("/")[-1] in resp["Keys"]
- except ipfshttpclient4ipwb.exceptions.ErrorResponse as exc:
+ except ipfshttpclient.exceptions.ErrorResponse as exc:
error_msg = exc.args[0]
if "not pinned" in error_msg:
return False
diff -U3 -r a/test/run-tests.py b/test/run-tests.py
--- a/test/run-tests.py 2020-06-27 17:33:20.368686795 -0400
+++ b/test/run-tests.py 2020-06-27 17:37:47.025834763 -0400
@@ -155,7 +155,7 @@
coveragerc.file.writelines(map(lambda s: s + "\n", [
"[run]",
"omit =",
- " ipfshttpclient4ipwb/requests_wrapper.py",
+ " ipfshttpclient/requests_wrapper.py",
"[report]",
"# Exclude lines specific to some other Python version from coverage",
"exclude_lines ="
@@ -163,7 +163,7 @@
coveragerc.file.flush()
coverage_args = [
- "--cov=ipfshttpclient4ipwb",
+ "--cov=ipfshttpclient",
"--cov-branch",
"--cov-config={0}".format(coveragerc.name),
"--cov-fail-under=87",
diff -U3 -r a/test/unit/test_client.py b/test/unit/test_client.py
--- a/test/unit/test_client.py 2020-06-27 17:33:20.368686795 -0400
+++ b/test/unit/test_client.py 2020-06-27 17:37:46.995834328 -0400
@@ -1,27 +1,27 @@
import pytest
-import ipfshttpclient4ipwb
+import ipfshttpclient
def test_assert_version():
# Minimum required version
- ipfshttpclient4ipwb.assert_version("0.1.0", "0.1.0", "0.2.0", ["0.1.2"])
+ ipfshttpclient.assert_version("0.1.0", "0.1.0", "0.2.0", ["0.1.2"])
# Too high version
- with pytest.raises(ipfshttpclient4ipwb.exceptions.VersionMismatch):
- ipfshttpclient4ipwb.assert_version("0.2.0", "0.1.0", "0.2.0", ["0.1.2"])
+ with pytest.raises(ipfshttpclient.exceptions.VersionMismatch):
+ ipfshttpclient.assert_version("0.2.0", "0.1.0", "0.2.0", ["0.1.2"])
# Too low version
- with pytest.raises(ipfshttpclient4ipwb.exceptions.VersionMismatch):
- ipfshttpclient4ipwb.assert_version("0.0.5", "0.1.0", "0.2.0", ["0.1.2"])
+ with pytest.raises(ipfshttpclient.exceptions.VersionMismatch):
+ ipfshttpclient.assert_version("0.0.5", "0.1.0", "0.2.0", ["0.1.2"])
# Blacklisted version
- with pytest.raises(ipfshttpclient4ipwb.exceptions.VersionMismatch):
- ipfshttpclient4ipwb.assert_version("0.1.2-1", "0.1.0", "0.2.0", ["0.1.2"])
+ with pytest.raises(ipfshttpclient.exceptions.VersionMismatch):
+ ipfshttpclient.assert_version("0.1.2-1", "0.1.0", "0.2.0", ["0.1.2"])
def test_client_session_param():
- client = ipfshttpclient4ipwb.Client(session=True)
+ client = ipfshttpclient.Client(session=True)
assert client._client._session is not None
try:
with pytest.raises(Exception):
@@ -34,7 +34,7 @@
def test_client_session_context():
- client = ipfshttpclient4ipwb.Client()
+ client = ipfshttpclient.Client()
assert client._client._session is None
with client:
assert client._client._session is not None
diff -U3 -r a/test/unit/test_encoding.py b/test/unit/test_encoding.py
--- a/test/unit/test_encoding.py 2020-06-27 17:33:20.372020175 -0400
+++ b/test/unit/test_encoding.py 2020-06-27 17:37:46.995834328 -0400
@@ -3,14 +3,14 @@
import pytest
-import ipfshttpclient4ipwb.encoding
-import ipfshttpclient4ipwb.exceptions
+import ipfshttpclient.encoding
+import ipfshttpclient.exceptions
@pytest.fixture
def json_encoder():
- return ipfshttpclient4ipwb.encoding.Json()
+ return ipfshttpclient.encoding.Json()
def test_json_parse(json_encoder):
@@ -39,7 +39,7 @@
assert list(json_encoder.parse_finalize()) == []
# String containing broken UTF-8
- with pytest.raises(ipfshttpclient4ipwb.exceptions.DecodingError):
+ with pytest.raises(ipfshttpclient.exceptions.DecodingError):
list(json_encoder.parse_partial(b'{"hello": "\xc3ber world!"}'))
assert list(json_encoder.parse_finalize()) == []
@@ -59,11 +59,11 @@
def test_json_parse_incomplete(json_encoder):
"""Tests if feeding the JSON parse incomplete data correctly produces an error."""
list(json_encoder.parse_partial(b'{"bla":'))
- with pytest.raises(ipfshttpclient4ipwb.exceptions.DecodingError):
+ with pytest.raises(ipfshttpclient.exceptions.DecodingError):
json_encoder.parse_finalize()
list(json_encoder.parse_partial(b'{"\xc3')) # Incomplete UTF-8 sequence
- with pytest.raises(ipfshttpclient4ipwb.exceptions.DecodingError):
+ with pytest.raises(ipfshttpclient.exceptions.DecodingError):
json_encoder.parse_finalize()
@@ -100,11 +100,11 @@
def test_get_encoder_by_name():
"""Tests the process of obtaining an Encoder object given the named encoding."""
- encoder = ipfshttpclient4ipwb.encoding.get_encoding('json')
+ encoder = ipfshttpclient.encoding.get_encoding('json')
assert encoder.name == 'json'
def test_get_invalid_encoder():
"""Tests the exception handling given an invalid named encoding."""
- with pytest.raises(ipfshttpclient4ipwb.exceptions.EncoderMissingError):
- ipfshttpclient4ipwb.encoding.get_encoding('fake')
+ with pytest.raises(ipfshttpclient.exceptions.EncoderMissingError):
+ ipfshttpclient.encoding.get_encoding('fake')
diff -U3 -r a/test/unit/test_filescanner.py b/test/unit/test_filescanner.py
--- a/test/unit/test_filescanner.py 2020-06-27 17:33:20.372020175 -0400
+++ b/test/unit/test_filescanner.py 2020-06-27 17:37:46.999167710 -0400
@@ -5,7 +5,7 @@
import pytest
-from ipfshttpclient4ipwb import filescanner
+from ipfshttpclient import filescanner
TEST_FILE_DIR = os.path.join(os.path.dirname(__file__), "..", "functional") # type: str
diff -U3 -r a/test/unit/test_http.py b/test/unit/test_http.py
--- a/test/unit/test_http.py 2020-06-27 17:33:20.372020175 -0400
+++ b/test/unit/test_http.py 2020-06-27 17:37:47.002501092 -0400
@@ -13,8 +13,8 @@
import pytest
import pytest_localserver.http
-import ipfshttpclient4ipwb.http
-import ipfshttpclient4ipwb.exceptions
+import ipfshttpclient.http
+import ipfshttpclient.exceptions
@@ -33,9 +33,9 @@
@pytest.fixture
def http_client(http_server):
- return ipfshttpclient4ipwb.http.HTTPClient(
+ return ipfshttpclient.http.HTTPClient(
"/ip4/{0}/tcp/{1}/http".format(*http_server.server_address),
- ipfshttpclient4ipwb.DEFAULT_BASE
+ ipfshttpclient.DEFAULT_BASE
)
@@ -73,7 +73,7 @@
"""Tests that a failed http request raises an HTTPError."""
http_server.serve_content("fail", 500)
- with pytest.raises(ipfshttpclient4ipwb.exceptions.StatusError):
+ with pytest.raises(ipfshttpclient.exceptions.StatusError):
http_client.request("/fail")
def test_http_client_failure(http_client, http_server):
@@ -82,7 +82,7 @@
"Message": "Someone set us up the bomb"
}), 500)
- with pytest.raises(ipfshttpclient4ipwb.exceptions.ErrorResponse):
+ with pytest.raises(ipfshttpclient.exceptions.ErrorResponse):
http_client.request("/http_client_fail")
def test_http_client_late_failure(http_client, http_server):
@@ -94,7 +94,7 @@
"Message": "request failed after all"
}), 200)
- with pytest.raises(ipfshttpclient4ipwb.exceptions.PartialErrorResponse):
+ with pytest.raises(ipfshttpclient.exceptions.PartialErrorResponse):
http_client.request("/http_client_fail_late", decoder="json")
def test_stream(http_client, http_server):
@@ -137,14 +137,14 @@
"Message": "Someone set us up the bomb"
}), 500)
- with pytest.raises(ipfshttpclient4ipwb.exceptions.EncoderMissingError):
+ with pytest.raises(ipfshttpclient.exceptions.EncoderMissingError):
http_client.request("/http_client_fail", decoder="xyz")
def test_failed_decoder(http_client, http_server):
"""Tests that a failed encoding parse raises an exception."""
http_server.serve_content("okay", 200)
- with pytest.raises(ipfshttpclient4ipwb.exceptions.DecodingError):
+ with pytest.raises(ipfshttpclient.exceptions.DecodingError):
http_client.request("/okay", decoder="json")
"""TODO: Test successful download
@@ -157,27 +157,27 @@
"""Tests that a failed download raises an HTTPError."""
http_server.serve_content("fail", 500)
- with pytest.raises(ipfshttpclient4ipwb.exceptions.StatusError):
+ with pytest.raises(ipfshttpclient.exceptions.StatusError):
http_client.download("/fail")
def test_download_timeout(slow_http_server):
"""Tests that a timed-out download raises a TimeoutError."""
- http_client = ipfshttpclient4ipwb.http.HTTPClient(
+ http_client = ipfshttpclient.http.HTTPClient(
"/ip4/{0}/tcp/{1}/http".format(*slow_http_server.server_address),
- ipfshttpclient4ipwb.DEFAULT_BASE
+ ipfshttpclient.DEFAULT_BASE
)
- with pytest.raises(ipfshttpclient4ipwb.exceptions.TimeoutError):
+ with pytest.raises(ipfshttpclient.exceptions.TimeoutError):
http_client.download('/timeout', timeout=0.1)
def test_request_timeout(slow_http_server):
"""Tests that a timed-out request raises a TimeoutError."""
- http_client = ipfshttpclient4ipwb.http.HTTPClient(
+ http_client = ipfshttpclient.http.HTTPClient(
"/ip4/{0}/tcp/{1}/http".format(*slow_http_server.server_address),
- ipfshttpclient4ipwb.DEFAULT_BASE
+ ipfshttpclient.DEFAULT_BASE
)
- with pytest.raises(ipfshttpclient4ipwb.exceptions.TimeoutError):
+ with pytest.raises(ipfshttpclient.exceptions.TimeoutError):
http_client.request('/timeout', timeout=0.1)
def test_session(http_client, http_server):
@@ -196,20 +196,20 @@
def test_stream_close(mocker, http_client, http_server):
- mocker.patch("ipfshttpclient4ipwb.http._notify_stream_iter_closed")
+ mocker.patch("ipfshttpclient.http._notify_stream_iter_closed")
http_server.serve_content("okay", 200)
with http_client.request("/okay", stream=True) as response_iter:
- assert ipfshttpclient4ipwb.http._notify_stream_iter_closed.call_count == 0
- assert ipfshttpclient4ipwb.http._notify_stream_iter_closed.call_count == 1
+ assert ipfshttpclient.http._notify_stream_iter_closed.call_count == 0
+ assert ipfshttpclient.http._notify_stream_iter_closed.call_count == 1
response_iter = http_client.request("/okay", stream=True)
- assert ipfshttpclient4ipwb.http._notify_stream_iter_closed.call_count == 1
+ assert ipfshttpclient.http._notify_stream_iter_closed.call_count == 1
response_iter.close()
- assert ipfshttpclient4ipwb.http._notify_stream_iter_closed.call_count == 2
+ assert ipfshttpclient.http._notify_stream_iter_closed.call_count == 2
http_client.request("/okay")
- assert ipfshttpclient4ipwb.http._notify_stream_iter_closed.call_count == 3
+ assert ipfshttpclient.http._notify_stream_iter_closed.call_count == 3
def test_basic_auth(http_client, http_server):
diff -U3 -r a/test/unit/test_multipart.py b/test/unit/test_multipart.py
--- a/test/unit/test_multipart.py 2020-06-27 17:33:20.372020175 -0400
+++ b/test/unit/test_multipart.py 2020-06-27 17:37:47.005834473 -0400
@@ -18,7 +18,7 @@
import pytest
-import ipfshttpclient4ipwb.multipart
+import ipfshttpclient.multipart
# !! ALL Expected output should match /ipns/docs.ipfs.io/reference/http/api/#request-body !! #
@@ -38,36 +38,36 @@
def test_content_disposition_headers(self):
"""Check that content_disposition defaults properly"""
expected = {'Content-Disposition': 'form-data; name="file"; filename="example.txt"'}
- actual = ipfshttpclient4ipwb.multipart.content_disposition_headers('example.txt')
+ actual = ipfshttpclient.multipart.content_disposition_headers('example.txt')
assert expected == actual
def test_content_disposition_headers_with_type(self):
"""Check that content_disposition handles given disposition type"""
expected = {'Content-Disposition': 'attachment; filename="example.txt"'}
- actual = ipfshttpclient4ipwb.multipart.content_disposition_headers('example.txt', 'attachment')
+ actual = ipfshttpclient.multipart.content_disposition_headers('example.txt', 'attachment')
assert expected == actual
def test_content_type_headers(self):
"""Check the content_type guessing functionality."""
- actual = ipfshttpclient4ipwb.multipart.content_type_headers('example.txt')
+ actual = ipfshttpclient.multipart.content_type_headers('example.txt')
expected = {'Content-Type': 'text/plain'}
assert expected == actual
- actual = ipfshttpclient4ipwb.multipart.content_type_headers('example.jpeg')
+ actual = ipfshttpclient.multipart.content_type_headers('example.jpeg')
expected = {'Content-Type': 'image/jpeg'}
assert expected == actual
- actual = ipfshttpclient4ipwb.multipart.content_type_headers('example')
+ actual = ipfshttpclient.multipart.content_type_headers('example')
expected = {'Content-Type': 'application/octet-stream'}
assert expected == actual
def test_multipart_content_type_headers(self):
"""Check test_multipart_content_type_headers functionality."""
- actual = ipfshttpclient4ipwb.multipart.multipart_content_type_headers('8K5rNKlLQVyreRNncxOTeg')
+ actual = ipfshttpclient.multipart.multipart_content_type_headers('8K5rNKlLQVyreRNncxOTeg')
expected = {'Content-Type': 'multipart/mixed; boundary="8K5rNKlLQVyreRNncxOTeg"'}
assert expected == actual
- actual = ipfshttpclient4ipwb.multipart.multipart_content_type_headers('8K5rNKlLQVyreRNncxOTeg', 'alt')
+ actual = ipfshttpclient.multipart.multipart_content_type_headers('8K5rNKlLQVyreRNncxOTeg', 'alt')
expected = {'Content-Type': 'multipart/alt; boundary="8K5rNKlLQVyreRNncxOTeg"'}
assert expected == actual
@@ -90,11 +90,11 @@
yield output
-class StreamBaseSub(ipfshttpclient4ipwb.multipart.StreamBase):
+class StreamBaseSub(ipfshttpclient.multipart.StreamBase):
def _body(self):
raise NotImplementedError()
-class StreamFileMixinSub(ipfshttpclient4ipwb.multipart.StreamBase, ipfshttpclient4ipwb.multipart.StreamFileMixin):
+class StreamFileMixinSub(ipfshttpclient.multipart.StreamBase, ipfshttpclient.multipart.StreamFileMixin):
def _body(self):
raise NotImplementedError()
@@ -299,7 +299,7 @@
def test_body_absolute(self):
filenames_list= self.prep_test_body()
- instance = ipfshttpclient4ipwb.multipart.FilesStream(filenames_list)
+ instance = ipfshttpclient.multipart.FilesStream(filenames_list)
self.check_test_body(instance, abspath=True)
def test_body_relative(self):
@@ -309,7 +309,7 @@
relative_paths_list = [os.path.relpath(cur_path, os.getcwd())
for cur_path in filenames_list]
- instance = ipfshttpclient4ipwb.multipart.FilesStream(relative_paths_list)
+ instance = ipfshttpclient.multipart.FilesStream(relative_paths_list)
self.check_test_body(instance, abspath=False)
def check_test_body(self, instance, abspath):
@@ -338,7 +338,7 @@
# Get OS-agnostic path to test files
path = os.path.join(os.path.dirname(os.path.dirname(__file__)),
"functional", "fake_dir")
- instance = ipfshttpclient4ipwb.multipart.DirectoryStream(path)
+ instance = ipfshttpclient.multipart.DirectoryStream(path)
expected = b"^(--\\S+\r\nContent-Disposition: form-data; name=\"file\"; filename=\"\\S+\""\
+ b"\r\nContent-Type: application/\\S+\r\n\r\n(.|\n)*"\
+ b"\r\n)+--\\S+--\r\n$"
@@ -357,7 +357,7 @@
"""Check the multipart HTTP body for the streamed directory."""
# Get OS-agnostic path to test files
text = b"Here is some text for this test."
- instance = ipfshttpclient4ipwb.multipart.BytesFileStream(text)
+ instance = ipfshttpclient.multipart.BytesFileStream(text)
expected = b"(--\\S+\r\nContent-Disposition: form-data; name=\"file\"; filename=\"\\S+\""\
+ b"\r\nContent-Type: application/\\S+\r\n"\
+ b"\r\n(.|\n)*\r\n)+--\\S+--\r\n"
diff -U3 -r a/test/unit/test_utils.py b/test/unit/test_utils.py
--- a/test/unit/test_utils.py 2020-06-27 17:33:20.372020175 -0400
+++ b/test/unit/test_utils.py 2020-06-27 17:37:47.005834473 -0400
@@ -9,7 +9,7 @@
import sys
import unittest
-import ipfshttpclient4ipwb.utils as utils
+import ipfshttpclient.utils as utils
class TestUtils(unittest.TestCase):
"""Contains unit tests for utils.py.
diff -U3 -r a/tox.ini b/tox.ini
--- a/tox.ini 2020-06-27 17:33:20.372020175 -0400
+++ b/tox.ini 2020-06-27 17:37:47.032501526 -0400
@@ -71,7 +71,7 @@
# - requests_wrapper.py: Lots of symbols exported that we specifically don't use but that make sense in a reusable module
# - test_*.py: Aligning `assert … not in …` and `assert … in …` kind of statements
per-file-ignores =
- ./ipfshttpclient4ipwb/requests_wrapper.py:E401,E402,F401
+ ./ipfshttpclient/requests_wrapper.py:E401,E402,F401
./test/functional/test_*.py:E272
@@ -79,7 +79,7 @@
addopts = -ra --verbose
console_output_style = progress
testpaths =
- ipfshttpclient4ipwb
+ ipfshttpclient
test/unit
test/functional
diff -U3 -r a/docs/conf.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/docs/conf.py
--- a/docs/conf.py 2020-06-24 09:44:14.294069500 -0400
+++ b/docs/conf.py 2020-06-27 17:06:07.758415966 -0400
@@ -373,7 +373,7 @@
def import_object(self):
"""Prevent client class objects from being marked as “properties”."""
if super().import_object():
- # Document the shadowed `ipfshttpclient.client.base.Section` type
+ # Document the shadowed `ipfshttpclient4ipwb.client.base.Section` type
# rather then its (uninteresting) property wrapper
self.doc_as_attr = False
return True
diff -U3 -r a/docs/publish.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/docs/publish.py
--- a/docs/publish.py 2020-06-24 09:44:14.295566000 -0400
+++ b/docs/publish.py 2020-06-27 17:06:07.761749276 -0400
@@ -5,7 +5,7 @@
sys.path.insert(0, os.path.join(__dir__, ".."))
import sphinx.cmd.build
-import ipfshttpclient
+import ipfshttpclient4ipwb
# Ensure working directory is script directory
os.chdir(__dir__)
@@ -24,7 +24,7 @@
print()
print("Exporting files to IPFS…")
- client = ipfshttpclient.connect()
+ client = ipfshttpclient4ipwb.connect()
hash_docs = client.add("build/html", recursive=True, raw_leaves=True, pin=False)[-1]["Hash"]
hash_main = client.object.new("unixfs-dir")["Hash"]
hash_main = client.object.patch.add_link(hash_main, "docs", hash_docs)["Hash"]
diff -U3 -r a/ipfshttpclient4ipwb/client/base.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/ipfshttpclient4ipwb/client/base.py
--- a/ipfshttpclient4ipwb/client/base.py 2020-06-24 09:44:14.300772400 -0400
+++ b/ipfshttpclient4ipwb/client/base.py 2020-06-27 17:06:07.768415894 -0400
@@ -104,7 +104,7 @@
chunk_size : int
The size of the chunks to break uploaded files and text content into
session : bool
- Create this :class:`~ipfshttpclient.Client` instance with a session
+ Create this :class:`~ipfshttpclient4ipwb.Client` instance with a session
already open? (Useful for long-running client objects.)
"""
diff -U3 -r a/ipfshttpclient4ipwb/client/block.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/ipfshttpclient4ipwb/client/block.py
--- a/ipfshttpclient4ipwb/client/block.py 2020-06-24 09:44:14.302069200 -0400
+++ b/ipfshttpclient4ipwb/client/block.py 2020-06-27 17:06:07.775082512 -0400
@@ -50,7 +50,7 @@
dict
Information about the new block
- See :meth:`~ipfshttpclient.Client.block.stat`
+ See :meth:`~ipfshttpclient4ipwb.Client.block.stat`
"""
body, headers = multipart.stream_files(file, chunk_size=self.chunk_size)
return self._client.request('/block/put', decoder='json', data=body,
diff -U3 -r a/ipfshttpclient4ipwb/client/dht.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/ipfshttpclient4ipwb/client/dht.py
--- a/ipfshttpclient4ipwb/client/dht.py 2020-06-24 09:44:14.305841700 -0400
+++ b/ipfshttpclient4ipwb/client/dht.py 2020-06-27 17:06:07.781749131 -0400
@@ -130,7 +130,7 @@
You may only use keytypes that are supported in your ``ipfs`` binary:
``go-ipfs`` currently only supports the ``/ipns/`` keytype. Unless you
have a relatively deep understanding of the key's internal structure,
- you likely want to be using the :meth:`~ipfshttpclient.Client.name_publish`
+ you likely want to be using the :meth:`~ipfshttpclient4ipwb.Client.name_publish`
instead.
Value is arbitrary text.
diff -U3 -r a/ipfshttpclient4ipwb/client/files.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/ipfshttpclient4ipwb/client/files.py
--- a/ipfshttpclient4ipwb/client/files.py 2020-06-24 09:44:14.306989700 -0400
+++ b/ipfshttpclient4ipwb/client/files.py 2020-06-27 17:06:07.785082440 -0400
@@ -267,7 +267,7 @@
The set of files and directories included in the upload may be restricted
by passing any combination of glob matching strings, compiled regular
- expression objects and custom :class:`~ipfshttpclient.filescanner.Matcher`
+ expression objects and custom :class:`~ipfshttpclient4ipwb.filescanner.Matcher`
objects. A file or directory will be included if it matches of the
patterns provided. For regular expressions please note that as predicting
which directories are relevant to the given pattern is impossible to do
diff -U3 -r a/ipfshttpclient4ipwb/client/__init__.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/ipfshttpclient4ipwb/client/__init__.py
--- a/ipfshttpclient4ipwb/client/__init__.py 2020-06-24 09:44:14.299559800 -0400
+++ b/ipfshttpclient4ipwb/client/__init__.py 2020-06-27 17:06:07.768415894 -0400
@@ -44,7 +44,7 @@
Raises
------
- ~ipfshttpclient.exceptions.VersionMismatch
+ ~ipfshttpclient4ipwb.exceptions.VersionMismatch
Parameters
----------
@@ -72,25 +72,25 @@
def connect(addr=DEFAULT_ADDR, base=DEFAULT_BASE, *,
chunk_size=multipart.default_chunk_size,
session=False, **defaults):
- """Create a new :class:`~ipfshttpclient.Client` instance and connect to the
+ """Create a new :class:`~ipfshttpclient4ipwb.Client` instance and connect to the
daemon to validate that its version is supported.
Raises
------
- ~ipfshttpclient.exceptions.VersionMismatch
- ~ipfshttpclient.exceptions.ErrorResponse
- ~ipfshttpclient.exceptions.ConnectionError
- ~ipfshttpclient.exceptions.ProtocolError
- ~ipfshttpclient.exceptions.StatusError
- ~ipfshttpclient.exceptions.TimeoutError
+ ~ipfshttpclient4ipwb.exceptions.VersionMismatch
+ ~ipfshttpclient4ipwb.exceptions.ErrorResponse
+ ~ipfshttpclient4ipwb.exceptions.ConnectionError
+ ~ipfshttpclient4ipwb.exceptions.ProtocolError
+ ~ipfshttpclient4ipwb.exceptions.StatusError
+ ~ipfshttpclient4ipwb.exceptions.TimeoutError
All parameters are identical to those passed to the constructor of the
- :class:`~ipfshttpclient.Client` class.
+ :class:`~ipfshttpclient4ipwb.Client` class.
Returns
-------
- :class:`~ipfshttpclient.Client`
+ :class:`~ipfshttpclient4ipwb.Client`
"""
# Create client instance
client = Client(addr, base, chunk_size=chunk_size, session=session, **defaults)
@@ -130,13 +130,13 @@
The easiest way of using this “session management” facility is using a
context manager::
- with ipfshttpclient.connect() as client:
+ with ipfshttpclient4ipwb.connect() as client:
print(client.version()) # These calls…
print(client.version()) # …will reuse their TCP connection
A client object may be re-opened several times::
- client = ipfshttpclient.connect()
+ client = ipfshttpclient4ipwb.connect()
print(client.version()) # Perform API call on separate TCP connection
with client:
print(client.version()) # These calls…
@@ -149,7 +149,7 @@
class Consumer:
def __init__(self):
- self._client = ipfshttpclient.connect(session=True)
+ self._client = ipfshttpclient4ipwb.connect(session=True)
# … other code …
@@ -190,7 +190,7 @@
resources.
If there was no session currently open this method does nothing. An open
- session is not a requirement for using a :class:`~ipfshttpclient.Client`
+ session is not a requirement for using a :class:`~ipfshttpclient4ipwb.Client`
object and as such all method defined on it will continue to work, but
a new TCP connection will be established for each and every API call
invoked. Such a usage should therefor be avoided and may cause a warning
diff -U3 -r a/ipfshttpclient4ipwb/client/key.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/ipfshttpclient4ipwb/client/key.py
--- a/ipfshttpclient4ipwb/client/key.py 2020-06-24 09:44:14.307409000 -0400
+++ b/ipfshttpclient4ipwb/client/key.py 2020-06-27 17:06:07.785082440 -0400
@@ -8,7 +8,7 @@
@base.returns_single_item
def gen(self, key_name, type, size=2048, **kwargs):
"""Adds a new public key that can be used for
- :meth:`~ipfshttpclient.Client.name.publish`.
+ :meth:`~ipfshttpclient4ipwb.Client.name.publish`.
.. code-block:: python
@@ -52,7 +52,7 @@
@base.returns_single_item
def list(self, **kwargs):
"""Returns a list of generated public keys that can be used with
- :meth:`~ipfshttpclient.Client.name.publish`.
+ :meth:`~ipfshttpclient4ipwb.Client.name.publish`.
.. code-block:: python
diff -U3 -r a/ipfshttpclient4ipwb/client/miscellaneous.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/ipfshttpclient4ipwb/client/miscellaneous.py
--- a/ipfshttpclient4ipwb/client/miscellaneous.py 2020-06-24 09:44:14.307839600 -0400
+++ b/ipfshttpclient4ipwb/client/miscellaneous.py 2020-06-27 17:06:07.788415749 -0400
@@ -169,7 +169,7 @@
"""Stop the connected IPFS daemon instance.
Sending any further requests after this will fail with
- :class:`~ipfshttpclient.exceptions.ConnectionError`, until you start
+ :class:`~ipfshttpclient4ipwb.exceptions.ConnectionError`, until you start
another IPFS daemon instance.
"""
try:
diff -U3 -r a/ipfshttpclient4ipwb/client/object.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/ipfshttpclient4ipwb/client/object.py
--- a/ipfshttpclient4ipwb/client/object.py 2020-06-24 09:44:14.308242300 -0400
+++ b/ipfshttpclient4ipwb/client/object.py 2020-06-27 17:06:07.791749058 -0400
@@ -316,7 +316,7 @@
dict
Hash and links of the created DAG object
- See the :meth:`~ipfshttpclient.Client.object.links` method for
+ See the :meth:`~ipfshttpclient4ipwb.Client.object.links` method for
details.
"""
body, headers = multipart.stream_files(file, chunk_size=self.chunk_size)
diff -U3 -r a/ipfshttpclient4ipwb/client/pin.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/ipfshttpclient4ipwb/client/pin.py
--- a/ipfshttpclient4ipwb/client/pin.py 2020-06-24 09:44:14.308711000 -0400
+++ b/ipfshttpclient4ipwb/client/pin.py 2020-06-27 17:06:07.795082367 -0400
@@ -58,7 +58,7 @@
'QmNNPMA1eGUbKxeph6yqV8ZmRkdVat … YMuz': {'Type': 'recursive'}}}
>>> client.pin.ls('/ipfs/QmdBCSn4UJP82MjhRVwpABww48tXL3 … mA6z')
- ipfshttpclient.exceptions.ErrorResponse:
+ ipfshttpclient4ipwb.exceptions.ErrorResponse:
path '/ipfs/QmdBCSn4UJP82MjhRVwpABww48tXL3 … mA6z' is not pinned
Parameters
@@ -135,8 +135,8 @@
Updates one pin to another, making sure that all objects in the new pin
are local. Then removes the old pin. This is an optimized version of
- using first using :meth:`~ipfshttpclient.Client.pin.add` to add a new pin
- for an object and then using :meth:`~ipfshttpclient.Client.pin.rm` to remove
+ using first using :meth:`~ipfshttpclient4ipwb.Client.pin.add` to add a new pin
+ for an object and then using :meth:`~ipfshttpclient4ipwb.Client.pin.rm` to remove
the pin for the old object.
.. code-block:: python
Only in b/ipfshttpclient4ipwb/client: __pycache__
diff -U3 -r a/ipfshttpclient4ipwb/client/unstable.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/ipfshttpclient4ipwb/client/unstable.py
--- a/ipfshttpclient4ipwb/client/unstable.py 2020-06-24 09:44:14.309484200 -0400
+++ b/ipfshttpclient4ipwb/client/unstable.py 2020-06-27 17:06:07.805082295 -0400
@@ -126,7 +126,7 @@
"""Returns a list of hashes of objects referenced by the given hash.
**This API is subject to future change or removal!** You likely want to
- use :meth:`~ipfshttpclient.object.links` instead.
+ use :meth:`~ipfshttpclient4ipwb.object.links` instead.
.. code-block:: python
diff -U3 -r a/ipfshttpclient4ipwb/encoding.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/ipfshttpclient4ipwb/encoding.py
--- a/ipfshttpclient4ipwb/encoding.py 2020-06-24 09:44:14.309892200 -0400
+++ b/ipfshttpclient4ipwb/encoding.py 2020-06-27 17:06:07.808415604 -0400
@@ -27,7 +27,7 @@
Raises
------
- ~ipfshttpclient.exceptions.DecodingError
+ ~ipfshttpclient4ipwb.exceptions.DecodingError
Parameters
----------
@@ -45,7 +45,7 @@
Raises
------
- ~ipfshttpclient.exceptions.DecodingError
+ ~ipfshttpclient4ipwb.exceptions.DecodingError
Returns
-------
@@ -58,7 +58,7 @@
Raises
------
- ~ipfshttpclient.exceptions.DecodingError
+ ~ipfshttpclient4ipwb.exceptions.DecodingError
Parameters
----------
@@ -79,7 +79,7 @@
Raises
------
- ~ipfshttpclient.exceptions.EncodingError
+ ~ipfshttpclient4ipwb.exceptions.EncodingError
Parameters
----------
@@ -140,7 +140,7 @@
Raises
------
- ~ipfshttpclient.exceptions.DecodingError
+ ~ipfshttpclient4ipwb.exceptions.DecodingError
Returns
-------
@@ -232,7 +232,7 @@
Raises
------
- ~ipfshttpclient.exceptions.DecodingError
+ ~ipfshttpclient4ipwb.exceptions.DecodingError
Returns
-------
@@ -262,7 +262,7 @@
Raises
------
- ~ipfshttpclient.exceptions.EncodingError
+ ~ipfshttpclient4ipwb.exceptions.EncodingError
Parameters
----------
@@ -306,7 +306,7 @@
Raises
------
- ~ipfshttpclient.exceptions.EncoderMissingError
+ ~ipfshttpclient4ipwb.exceptions.EncoderMissingError
Parameters
----------
diff -U3 -r a/ipfshttpclient4ipwb/http.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/ipfshttpclient4ipwb/http.py
--- a/ipfshttpclient4ipwb/http.py 2020-06-24 09:44:14.311029000 -0400
+++ b/ipfshttpclient4ipwb/http.py 2020-06-27 17:06:41.688195002 -0400
@@ -146,13 +146,13 @@
timeout : Union[numbers.Real, Tuple[numbers.Real, numbers.Real], NoneType]
The default number of seconds to wait when establishing a connection to
the daemon and waiting for returned data before throwing
- :exc:`~ipfshttpclient.exceptions.TimeoutError`; if the value is a tuple
+ :exc:`~ipfshttpclient4ipwb.exceptions.TimeoutError`; if the value is a tuple
its contents will be interpreted as the values for the connection and
receiving phases respectively, otherwise the value will apply to both
phases; if the value is ``None`` then all timeouts will be disabled
defaults : dict
The default parameters to be passed to
- :meth:`~ipfshttpclient.http.HTTPClient.request`
+ :meth:`~ipfshttpclient4ipwb.http.HTTPClient.request`
"""
__metaclass__ = abc.ABCMeta
@@ -227,7 +227,7 @@
def close_session(self):
"""Close a session opened by
- :meth:`~ipfshttpclient.http.HTTPClient.open_session`.
+ :meth:`~ipfshttpclient4ipwb.http.HTTPClient.open_session`.
If there is no session currently open (ie: it was already closed), then
this method does nothing."""
@@ -309,11 +309,11 @@
Raises
------
- ~ipfshttpclient.exceptions.ErrorResponse
- ~ipfshttpclient.exceptions.ConnectionError
- ~ipfshttpclient.exceptions.ProtocolError
- ~ipfshttpclient.exceptions.StatusError
- ~ipfshttpclient.exceptions.TimeoutError
+ ~ipfshttpclient4ipwb.exceptions.ErrorResponse
+ ~ipfshttpclient4ipwb.exceptions.ConnectionError
+ ~ipfshttpclient4ipwb.exceptions.ProtocolError
+ ~ipfshttpclient4ipwb.exceptions.StatusError
+ ~ipfshttpclient4ipwb.exceptions.TimeoutError
Parameters
----------
@@ -387,11 +387,11 @@
Raises
------
- ~ipfshttpclient.exceptions.ErrorResponse
- ~ipfshttpclient.exceptions.ConnectionError
- ~ipfshttpclient.exceptions.ProtocolError
- ~ipfshttpclient.exceptions.StatusError
- ~ipfshttpclient.exceptions.TimeoutError
+ ~ipfshttpclient4ipwb.exceptions.ErrorResponse
+ ~ipfshttpclient4ipwb.exceptions.ConnectionError
+ ~ipfshttpclient4ipwb.exceptions.ProtocolError
+ ~ipfshttpclient4ipwb.exceptions.StatusError
+ ~ipfshttpclient4ipwb.exceptions.TimeoutError
Parameters
----------
diff -U3 -r a/ipfshttpclient4ipwb/multipart.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/ipfshttpclient4ipwb/multipart.py
--- a/ipfshttpclient4ipwb/multipart.py 2020-06-24 09:44:14.311402600 -0400
+++ b/ipfshttpclient4ipwb/multipart.py 2020-06-27 17:06:07.815082223 -0400
@@ -293,7 +293,7 @@
A buffered generator that encodes an array of files as
:mimetype:`multipart/form-data`. This is a concrete implementation of
- :class:`~ipfshttpclient.multipart.StreamBase`.
+ :class:`~ipfshttpclient4ipwb.multipart.StreamBase`.
Parameters
----------
diff -U3 -r a/test/functional/conftest.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/test/functional/conftest.py
--- a/test/functional/conftest.py 2020-06-24 09:44:14.314385700 -0400
+++ b/test/functional/conftest.py 2020-06-27 17:06:07.855081933 -0400
@@ -4,7 +4,7 @@
import pytest
-import ipfshttpclient
+import ipfshttpclient4ipwb
TEST_DIR = pathlib.Path(__file__).parent
@@ -19,12 +19,13 @@
if not isinstance(__is_available, bool):
try:
- ipfshttpclient.connect()
- except ipfshttpclient.exceptions.Error as error:
+ ipfshttpclient4ipwb.connect()
+ except ipfshttpclient4ipwb.exceptions.Error as error:
+ print("connect failed", error)
__is_available = False
# Make sure version incompatibility is displayed to users
- if isinstance(error, ipfshttpclient.exceptions.VersionMismatch):
+ if isinstance(error, ipfshttpclient4ipwb.exceptions.VersionMismatch):
raise
else:
__is_available = True
@@ -38,7 +39,7 @@
def get_client(offline=False):
if is_available():
- return ipfshttpclient.Client(offline=offline)
+ return ipfshttpclient4ipwb.Client(offline=offline)
else:
pytest.skip("Running IPFS node required")
diff -U3 -r a/test/functional/test_files.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/test/functional/test_files.py
--- a/test/functional/test_files.py 2020-06-24 09:44:14.317904000 -0400
+++ b/test/functional/test_files.py 2020-06-27 17:06:07.851748623 -0400
@@ -5,8 +5,8 @@
import pytest
import pytest_cid
-import ipfshttpclient.exceptions
-import ipfshttpclient.filescanner
+import ipfshttpclient4ipwb.exceptions
+import ipfshttpclient4ipwb.filescanner
import conftest
@@ -205,7 +205,7 @@
error_msg = None
try:
client.add(FAKE_FILE1_PATH, nocopy=True, raw_leaves=False)
- except ipfshttpclient.exceptions.ErrorResponse as exc:
+ except ipfshttpclient4ipwb.exceptions.ErrorResponse as exc:
error_msg = exc.args[0]
assert error_msg is not None and "--raw-leaves" in error_msg
@@ -238,7 +238,7 @@
error_msg = None
try:
client.add(calc_path_rel_to_cwd(FAKE_FILE1_PATH), nocopy=True)
- except ipfshttpclient.exceptions.ErrorResponse as exc:
+ except ipfshttpclient4ipwb.exceptions.ErrorResponse as exc:
error_msg = exc.args[0]
# For relative paths, multipart streaming layer won't append the
@@ -259,16 +259,16 @@
assert conftest.sort_by_key(res) == conftest.sort_by_key(FAKE_DIR_FNPATTERN1_HASH)
[email protected](not ipfshttpclient.filescanner.HAVE_FWALK,
[email protected](not ipfshttpclient4ipwb.filescanner.HAVE_FWALK,
reason="No point in disabling os.fwalk if it isn't actually supported")
def test_add_filepattern_from_dirname_nofwalk(client, cleanup_pins, monkeypatch):
- monkeypatch.setattr(ipfshttpclient.filescanner, "HAVE_FWALK", False)
+ monkeypatch.setattr(ipfshttpclient4ipwb.filescanner, "HAVE_FWALK", False)
res = client.add(FAKE_DIR_PATH, pattern=FAKE_DIR_FNPATTERN1)
assert conftest.sort_by_key(res) == conftest.sort_by_key(FAKE_DIR_FNPATTERN1_HASH)
[email protected](not ipfshttpclient.filescanner.HAVE_FWALK,
[email protected](not ipfshttpclient4ipwb.filescanner.HAVE_FWALK,
reason="Passing directory as file descriptor requires os.fwalk")
def test_add_filepattern_from_dirfd(client, cleanup_pins):
fd = os.open(str(FAKE_DIR_PATH), os.O_RDONLY | O_DIRECTORY) # type: int
@@ -284,10 +284,10 @@
assert conftest.sort_by_key(res) == conftest.sort_by_key(FAKE_DIR_FNPATTERN1_RECURSIVE_HASH)
[email protected](not ipfshttpclient.filescanner.HAVE_FWALK,
[email protected](not ipfshttpclient4ipwb.filescanner.HAVE_FWALK,
reason="No point in disabling os.fwalk if it isn't actually supported")
def test_add_filepattern_from_dirname_recursive_nofwalk(client, cleanup_pins, monkeypatch):
- monkeypatch.setattr(ipfshttpclient.filescanner, "HAVE_FWALK", False)
+ monkeypatch.setattr(ipfshttpclient4ipwb.filescanner, "HAVE_FWALK", False)
res = client.add(FAKE_DIR_PATH, pattern=FAKE_DIR_FNPATTERN1, recursive=True)
assert conftest.sort_by_key(res) == conftest.sort_by_key(FAKE_DIR_FNPATTERN1_RECURSIVE_HASH)
@@ -296,7 +296,7 @@
@pytest.mark.skipif(sys.platform.startswith("win"),
reason="Opening directory FDs does not work on Windows")
def test_add_filepattern_from_dirfd_recursive_nofwalk(client, cleanup_pins, monkeypatch):
- monkeypatch.setattr(ipfshttpclient.filescanner, "HAVE_FWALK", False)
+ monkeypatch.setattr(ipfshttpclient4ipwb.filescanner, "HAVE_FWALK", False)
with pytest.raises(NotImplementedError):
fd = os.open(str(FAKE_DIR_PATH), os.O_RDONLY | O_DIRECTORY) # type: int
@@ -306,7 +306,7 @@
os.close(fd)
[email protected](not ipfshttpclient.filescanner.HAVE_FWALK,
[email protected](not ipfshttpclient4ipwb.filescanner.HAVE_FWALK,
reason="Passing directory as file descriptor requires os.fwalk")
def test_add_filepattern_from_dirfd_recursive(client, cleanup_pins):
fd = os.open(str(FAKE_DIR_PATH), os.O_RDONLY | O_DIRECTORY) # type: int
@@ -323,10 +323,10 @@
assert conftest.sort_by_key(res) == conftest.sort_by_key(FAKE_DIR_FNPATTERN1_RECURSIVE_HASH)
[email protected](not ipfshttpclient.filescanner.HAVE_FWALK,
[email protected](not ipfshttpclient4ipwb.filescanner.HAVE_FWALK,
reason="No point in disabling os.fwalk if it isn't actually supported")
def test_add_filepattern_from_dirname_recursive_nofwalk_binary(client, cleanup_pins, monkeypatch):
- monkeypatch.setattr(ipfshttpclient.filescanner, "HAVE_FWALK", False)
+ monkeypatch.setattr(ipfshttpclient4ipwb.filescanner, "HAVE_FWALK", False)
res = client.add(os.fsencode(str(FAKE_DIR_PATH)),
pattern=os.fsencode(FAKE_DIR_FNPATTERN1), recursive=True)
@@ -491,5 +491,5 @@
# Remove directory
client.files.rm(TEST_MFS_DIRECTORY, recursive=True)
- with pytest.raises(ipfshttpclient.exceptions.Error):
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.Error):
client.files.stat(TEST_MFS_DIRECTORY)
\ No newline at end of file
diff -U3 -r a/test/functional/test_other.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/test/functional/test_other.py
--- a/test/functional/test_other.py 2020-06-24 09:44:14.319764000 -0400
+++ b/test/functional/test_other.py 2020-06-27 17:06:07.858415242 -0400
@@ -1,4 +1,4 @@
-import ipfshttpclient
+import ipfshttpclient4ipwb
import conftest
@@ -10,7 +10,7 @@
"""
assert conftest.is_available(), \
"Functional tests require an IPFS node to be available at: {0}" \
- .format(ipfshttpclient.DEFAULT_ADDR)
+ .format(ipfshttpclient4ipwb.DEFAULT_ADDR)
def test_add_json(client, cleanup_pins):
diff -U3 -r a/test/functional/test_pin.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/test/functional/test_pin.py
--- a/test/functional/test_pin.py 2020-06-24 09:44:14.320140100 -0400
+++ b/test/functional/test_pin.py 2020-06-27 17:06:07.861748551 -0400
@@ -1,6 +1,6 @@
import pytest
-import ipfshttpclient.exceptions
+import ipfshttpclient4ipwb.exceptions
class Resources:
@@ -25,7 +25,7 @@
try:
resp = client.pin.ls(path)
assert path.split("/")[-1] in resp["Keys"]
- except ipfshttpclient.exceptions.ErrorResponse as exc:
+ except ipfshttpclient4ipwb.exceptions.ErrorResponse as exc:
error_msg = exc.args[0]
if "not pinned" in error_msg:
return False
diff -U3 -r a/test/run-tests.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/test/run-tests.py
--- a/test/run-tests.py 2020-06-24 09:44:14.321125000 -0400
+++ b/test/run-tests.py 2020-06-27 17:08:03.054517133 -0400
@@ -155,7 +155,7 @@
coveragerc.file.writelines(map(lambda s: s + "\n", [
"[run]",
"omit =",
- " ipfshttpclient/requests_wrapper.py",
+ " ipfshttpclient4ipwb/requests_wrapper.py",
"[report]",
"# Exclude lines specific to some other Python version from coverage",
"exclude_lines ="
@@ -163,7 +163,7 @@
coveragerc.file.flush()
coverage_args = [
- "--cov=ipfshttpclient",
+ "--cov=ipfshttpclient4ipwb",
"--cov-branch",
"--cov-config={0}".format(coveragerc.name),
"--cov-fail-under=87",
diff -U3 -r a/test/unit/test_client.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/test/unit/test_client.py
--- a/test/unit/test_client.py 2020-06-24 09:44:14.321444000 -0400
+++ b/test/unit/test_client.py 2020-06-27 17:06:07.868415169 -0400
@@ -1,27 +1,27 @@
import pytest
-import ipfshttpclient
+import ipfshttpclient4ipwb
def test_assert_version():
# Minimum required version
- ipfshttpclient.assert_version("0.1.0", "0.1.0", "0.2.0", ["0.1.2"])
+ ipfshttpclient4ipwb.assert_version("0.1.0", "0.1.0", "0.2.0", ["0.1.2"])
# Too high version
- with pytest.raises(ipfshttpclient.exceptions.VersionMismatch):
- ipfshttpclient.assert_version("0.2.0", "0.1.0", "0.2.0", ["0.1.2"])
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.VersionMismatch):
+ ipfshttpclient4ipwb.assert_version("0.2.0", "0.1.0", "0.2.0", ["0.1.2"])
# Too low version
- with pytest.raises(ipfshttpclient.exceptions.VersionMismatch):
- ipfshttpclient.assert_version("0.0.5", "0.1.0", "0.2.0", ["0.1.2"])
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.VersionMismatch):
+ ipfshttpclient4ipwb.assert_version("0.0.5", "0.1.0", "0.2.0", ["0.1.2"])
# Blacklisted version
- with pytest.raises(ipfshttpclient.exceptions.VersionMismatch):
- ipfshttpclient.assert_version("0.1.2-1", "0.1.0", "0.2.0", ["0.1.2"])
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.VersionMismatch):
+ ipfshttpclient4ipwb.assert_version("0.1.2-1", "0.1.0", "0.2.0", ["0.1.2"])
def test_client_session_param():
- client = ipfshttpclient.Client(session=True)
+ client = ipfshttpclient4ipwb.Client(session=True)
assert client._client._session is not None
try:
with pytest.raises(Exception):
@@ -34,7 +34,7 @@
def test_client_session_context():
- client = ipfshttpclient.Client()
+ client = ipfshttpclient4ipwb.Client()
assert client._client._session is None
with client:
assert client._client._session is not None
diff -U3 -r a/test/unit/test_encoding.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/test/unit/test_encoding.py
--- a/test/unit/test_encoding.py 2020-06-24 09:44:14.321695000 -0400
+++ b/test/unit/test_encoding.py 2020-06-27 17:06:07.871748479 -0400
@@ -3,14 +3,14 @@
import pytest
-import ipfshttpclient.encoding
-import ipfshttpclient.exceptions
+import ipfshttpclient4ipwb.encoding
+import ipfshttpclient4ipwb.exceptions
@pytest.fixture
def json_encoder():
- return ipfshttpclient.encoding.Json()
+ return ipfshttpclient4ipwb.encoding.Json()
def test_json_parse(json_encoder):
@@ -39,7 +39,7 @@
assert list(json_encoder.parse_finalize()) == []
# String containing broken UTF-8
- with pytest.raises(ipfshttpclient.exceptions.DecodingError):
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.DecodingError):
list(json_encoder.parse_partial(b'{"hello": "\xc3ber world!"}'))
assert list(json_encoder.parse_finalize()) == []
@@ -59,11 +59,11 @@
def test_json_parse_incomplete(json_encoder):
"""Tests if feeding the JSON parse incomplete data correctly produces an error."""
list(json_encoder.parse_partial(b'{"bla":'))
- with pytest.raises(ipfshttpclient.exceptions.DecodingError):
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.DecodingError):
json_encoder.parse_finalize()
list(json_encoder.parse_partial(b'{"\xc3')) # Incomplete UTF-8 sequence
- with pytest.raises(ipfshttpclient.exceptions.DecodingError):
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.DecodingError):
json_encoder.parse_finalize()
@@ -100,11 +100,11 @@
def test_get_encoder_by_name():
"""Tests the process of obtaining an Encoder object given the named encoding."""
- encoder = ipfshttpclient.encoding.get_encoding('json')
+ encoder = ipfshttpclient4ipwb.encoding.get_encoding('json')
assert encoder.name == 'json'
def test_get_invalid_encoder():
"""Tests the exception handling given an invalid named encoding."""
- with pytest.raises(ipfshttpclient.exceptions.EncoderMissingError):
- ipfshttpclient.encoding.get_encoding('fake')
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.EncoderMissingError):
+ ipfshttpclient4ipwb.encoding.get_encoding('fake')
diff -U3 -r a/test/unit/test_filescanner.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/test/unit/test_filescanner.py
--- a/test/unit/test_filescanner.py 2020-06-24 09:44:14.322051500 -0400
+++ b/test/unit/test_filescanner.py 2020-06-27 17:06:07.865081860 -0400
@@ -5,7 +5,7 @@
import pytest
-from ipfshttpclient import filescanner
+from ipfshttpclient4ipwb import filescanner
TEST_FILE_DIR = os.path.join(os.path.dirname(__file__), "..", "functional") # type: str
diff -U3 -r a/test/unit/test_http.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/test/unit/test_http.py
--- a/test/unit/test_http.py 2020-06-24 09:44:14.322451800 -0400
+++ b/test/unit/test_http.py 2020-06-27 17:06:07.871748479 -0400
@@ -13,8 +13,8 @@
import pytest
import pytest_localserver.http
-import ipfshttpclient.http
-import ipfshttpclient.exceptions
+import ipfshttpclient4ipwb.http
+import ipfshttpclient4ipwb.exceptions
@@ -33,9 +33,9 @@
@pytest.fixture
def http_client(http_server):
- return ipfshttpclient.http.HTTPClient(
+ return ipfshttpclient4ipwb.http.HTTPClient(
"/ip4/{0}/tcp/{1}/http".format(*http_server.server_address),
- ipfshttpclient.DEFAULT_BASE
+ ipfshttpclient4ipwb.DEFAULT_BASE
)
@@ -73,7 +73,7 @@
"""Tests that a failed http request raises an HTTPError."""
http_server.serve_content("fail", 500)
- with pytest.raises(ipfshttpclient.exceptions.StatusError):
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.StatusError):
http_client.request("/fail")
def test_http_client_failure(http_client, http_server):
@@ -82,7 +82,7 @@
"Message": "Someone set us up the bomb"
}), 500)
- with pytest.raises(ipfshttpclient.exceptions.ErrorResponse):
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.ErrorResponse):
http_client.request("/http_client_fail")
def test_http_client_late_failure(http_client, http_server):
@@ -94,7 +94,7 @@
"Message": "request failed after all"
}), 200)
- with pytest.raises(ipfshttpclient.exceptions.PartialErrorResponse):
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.PartialErrorResponse):
http_client.request("/http_client_fail_late", decoder="json")
def test_stream(http_client, http_server):
@@ -137,14 +137,14 @@
"Message": "Someone set us up the bomb"
}), 500)
- with pytest.raises(ipfshttpclient.exceptions.EncoderMissingError):
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.EncoderMissingError):
http_client.request("/http_client_fail", decoder="xyz")
def test_failed_decoder(http_client, http_server):
"""Tests that a failed encoding parse raises an exception."""
http_server.serve_content("okay", 200)
- with pytest.raises(ipfshttpclient.exceptions.DecodingError):
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.DecodingError):
http_client.request("/okay", decoder="json")
"""TODO: Test successful download
@@ -157,27 +157,27 @@
"""Tests that a failed download raises an HTTPError."""
http_server.serve_content("fail", 500)
- with pytest.raises(ipfshttpclient.exceptions.StatusError):
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.StatusError):
http_client.download("/fail")
def test_download_timeout(slow_http_server):
"""Tests that a timed-out download raises a TimeoutError."""
- http_client = ipfshttpclient.http.HTTPClient(
+ http_client = ipfshttpclient4ipwb.http.HTTPClient(
"/ip4/{0}/tcp/{1}/http".format(*slow_http_server.server_address),
- ipfshttpclient.DEFAULT_BASE
+ ipfshttpclient4ipwb.DEFAULT_BASE
)
- with pytest.raises(ipfshttpclient.exceptions.TimeoutError):
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.TimeoutError):
http_client.download('/timeout', timeout=0.1)
def test_request_timeout(slow_http_server):
"""Tests that a timed-out request raises a TimeoutError."""
- http_client = ipfshttpclient.http.HTTPClient(
+ http_client = ipfshttpclient4ipwb.http.HTTPClient(
"/ip4/{0}/tcp/{1}/http".format(*slow_http_server.server_address),
- ipfshttpclient.DEFAULT_BASE
+ ipfshttpclient4ipwb.DEFAULT_BASE
)
- with pytest.raises(ipfshttpclient.exceptions.TimeoutError):
+ with pytest.raises(ipfshttpclient4ipwb.exceptions.TimeoutError):
http_client.request('/timeout', timeout=0.1)
def test_session(http_client, http_server):
@@ -196,20 +196,20 @@
def test_stream_close(mocker, http_client, http_server):
- mocker.patch("ipfshttpclient.http._notify_stream_iter_closed")
+ mocker.patch("ipfshttpclient4ipwb.http._notify_stream_iter_closed")
http_server.serve_content("okay", 200)
with http_client.request("/okay", stream=True) as response_iter:
- assert ipfshttpclient.http._notify_stream_iter_closed.call_count == 0
- assert ipfshttpclient.http._notify_stream_iter_closed.call_count == 1
+ assert ipfshttpclient4ipwb.http._notify_stream_iter_closed.call_count == 0
+ assert ipfshttpclient4ipwb.http._notify_stream_iter_closed.call_count == 1
response_iter = http_client.request("/okay", stream=True)
- assert ipfshttpclient.http._notify_stream_iter_closed.call_count == 1
+ assert ipfshttpclient4ipwb.http._notify_stream_iter_closed.call_count == 1
response_iter.close()
- assert ipfshttpclient.http._notify_stream_iter_closed.call_count == 2
+ assert ipfshttpclient4ipwb.http._notify_stream_iter_closed.call_count == 2
http_client.request("/okay")
- assert ipfshttpclient.http._notify_stream_iter_closed.call_count == 3
+ assert ipfshttpclient4ipwb.http._notify_stream_iter_closed.call_count == 3
def test_basic_auth(http_client, http_server):
diff -U3 -r a/test/unit/test_multipart.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/test/unit/test_multipart.py
--- a/test/unit/test_multipart.py 2020-06-24 09:44:14.322752200 -0400
+++ b/test/unit/test_multipart.py 2020-06-27 17:06:07.878415097 -0400
@@ -18,7 +18,7 @@
import pytest
-import ipfshttpclient.multipart
+import ipfshttpclient4ipwb.multipart
# !! ALL Expected output should match /ipns/docs.ipfs.io/reference/http/api/#request-body !! #
@@ -38,36 +38,36 @@
def test_content_disposition_headers(self):
"""Check that content_disposition defaults properly"""
expected = {'Content-Disposition': 'form-data; name="file"; filename="example.txt"'}
- actual = ipfshttpclient.multipart.content_disposition_headers('example.txt')
+ actual = ipfshttpclient4ipwb.multipart.content_disposition_headers('example.txt')
assert expected == actual
def test_content_disposition_headers_with_type(self):
"""Check that content_disposition handles given disposition type"""
expected = {'Content-Disposition': 'attachment; filename="example.txt"'}
- actual = ipfshttpclient.multipart.content_disposition_headers('example.txt', 'attachment')
+ actual = ipfshttpclient4ipwb.multipart.content_disposition_headers('example.txt', 'attachment')
assert expected == actual
def test_content_type_headers(self):
"""Check the content_type guessing functionality."""
- actual = ipfshttpclient.multipart.content_type_headers('example.txt')
+ actual = ipfshttpclient4ipwb.multipart.content_type_headers('example.txt')
expected = {'Content-Type': 'text/plain'}
assert expected == actual
- actual = ipfshttpclient.multipart.content_type_headers('example.jpeg')
+ actual = ipfshttpclient4ipwb.multipart.content_type_headers('example.jpeg')
expected = {'Content-Type': 'image/jpeg'}
assert expected == actual
- actual = ipfshttpclient.multipart.content_type_headers('example')
+ actual = ipfshttpclient4ipwb.multipart.content_type_headers('example')
expected = {'Content-Type': 'application/octet-stream'}
assert expected == actual
def test_multipart_content_type_headers(self):
"""Check test_multipart_content_type_headers functionality."""
- actual = ipfshttpclient.multipart.multipart_content_type_headers('8K5rNKlLQVyreRNncxOTeg')
+ actual = ipfshttpclient4ipwb.multipart.multipart_content_type_headers('8K5rNKlLQVyreRNncxOTeg')
expected = {'Content-Type': 'multipart/mixed; boundary="8K5rNKlLQVyreRNncxOTeg"'}
assert expected == actual
- actual = ipfshttpclient.multipart.multipart_content_type_headers('8K5rNKlLQVyreRNncxOTeg', 'alt')
+ actual = ipfshttpclient4ipwb.multipart.multipart_content_type_headers('8K5rNKlLQVyreRNncxOTeg', 'alt')
expected = {'Content-Type': 'multipart/alt; boundary="8K5rNKlLQVyreRNncxOTeg"'}
assert expected == actual
@@ -90,11 +90,11 @@
yield output
-class StreamBaseSub(ipfshttpclient.multipart.StreamBase):
+class StreamBaseSub(ipfshttpclient4ipwb.multipart.StreamBase):
def _body(self):
raise NotImplementedError()
-class StreamFileMixinSub(ipfshttpclient.multipart.StreamBase, ipfshttpclient.multipart.StreamFileMixin):
+class StreamFileMixinSub(ipfshttpclient4ipwb.multipart.StreamBase, ipfshttpclient4ipwb.multipart.StreamFileMixin):
def _body(self):
raise NotImplementedError()
@@ -299,7 +299,7 @@
def test_body_absolute(self):
filenames_list= self.prep_test_body()
- instance = ipfshttpclient.multipart.FilesStream(filenames_list)
+ instance = ipfshttpclient4ipwb.multipart.FilesStream(filenames_list)
self.check_test_body(instance, abspath=True)
def test_body_relative(self):
@@ -309,7 +309,7 @@
relative_paths_list = [os.path.relpath(cur_path, os.getcwd())
for cur_path in filenames_list]
- instance = ipfshttpclient.multipart.FilesStream(relative_paths_list)
+ instance = ipfshttpclient4ipwb.multipart.FilesStream(relative_paths_list)
self.check_test_body(instance, abspath=False)
def check_test_body(self, instance, abspath):
@@ -338,7 +338,7 @@
# Get OS-agnostic path to test files
path = os.path.join(os.path.dirname(os.path.dirname(__file__)),
"functional", "fake_dir")
- instance = ipfshttpclient.multipart.DirectoryStream(path)
+ instance = ipfshttpclient4ipwb.multipart.DirectoryStream(path)
expected = b"^(--\\S+\r\nContent-Disposition: form-data; name=\"file\"; filename=\"\\S+\""\
+ b"\r\nContent-Type: application/\\S+\r\n\r\n(.|\n)*"\
+ b"\r\n)+--\\S+--\r\n$"
@@ -357,7 +357,7 @@
"""Check the multipart HTTP body for the streamed directory."""
# Get OS-agnostic path to test files
text = b"Here is some text for this test."
- instance = ipfshttpclient.multipart.BytesFileStream(text)
+ instance = ipfshttpclient4ipwb.multipart.BytesFileStream(text)
expected = b"(--\\S+\r\nContent-Disposition: form-data; name=\"file\"; filename=\"\\S+\""\
+ b"\r\nContent-Type: application/\\S+\r\n"\
+ b"\r\n(.|\n)*\r\n)+--\\S+--\r\n"
diff -U3 -r a/test/unit/test_utils.py src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/test/unit/test_utils.py
--- a/test/unit/test_utils.py 2020-06-24 09:44:14.323083400 -0400
+++ b/test/unit/test_utils.py 2020-06-27 17:06:07.875081788 -0400
@@ -9,7 +9,7 @@
import sys
import unittest
-import ipfshttpclient.utils as utils
+import ipfshttpclient4ipwb.utils as utils
class TestUtils(unittest.TestCase):
"""Contains unit tests for utils.py.
diff -U3 -r a/tox.ini src.0.6.passes/src/ipfshttpclient4ipwb-0.6.0/tox.ini
--- a/tox.ini 2020-06-24 09:44:14.323548800 -0400
+++ b/tox.ini 2020-06-27 16:46:09.867786532 -0400
@@ -71,7 +71,7 @@
# - requests_wrapper.py: Lots of symbols exported that we specifically don't use but that make sense in a reusable module
# - test_*.py: Aligning `assert … not in …` and `assert … in …` kind of statements
per-file-ignores =
- ./ipfshttpclient/requests_wrapper.py:E401,E402,F401
+ ./ipfshttpclient4ipwb/requests_wrapper.py:E401,E402,F401
./test/functional/test_*.py:E272
@@ -79,7 +79,7 @@
addopts = -ra --verbose
console_output_style = progress
testpaths =
- ipfshttpclient
+ ipfshttpclient4ipwb
test/unit
test/functional
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment