Skip to content

Fix httpcore dependency; fix style linting #257

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/.project
/.settings
/.vscode
/venv

# Stuff that never was meant to be public
/+junk
Expand All @@ -27,4 +28,4 @@ docs/build/
go-ipfs/
.coverage
.pytest_cache/
.tox/
.tox/
4 changes: 2 additions & 2 deletions ipfshttpclient/encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def __init__(self) -> None:
self._decoder2 = json.JSONDecoder()
self._lasterror = None # type: ty.Optional[ValueError]

@ty.no_type_check # It works just fine and I don't want to rewrite it just
# because mypy doesn't understand… # noqa: E114, E116
# It works just fine and I don't want to rewrite it just because mypy doesn't understand…
@ty.no_type_check
def parse_partial(self, data: bytes) -> ty.Generator[utils.json_value_t, ty.Any, ty.Any]:
"""Incrementally decodes JSON data sets into Python objects.

Expand Down
4 changes: 2 additions & 2 deletions ipfshttpclient/filescanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def __init__(
#
# Note: `os.fwalk` support for binary paths was only added in 3.7+.
directory_str_or_fd = directory_str # type: ty.Union[ty.AnyStr, int]
if HAVE_FWALK and (not isinstance(directory_str, bytes) or HAVE_FWALK_BYTES): # type: ignore[unreachable] # noqa: E501
if HAVE_FWALK and (not isinstance(directory_str, bytes) or HAVE_FWALK_BYTES):
self._close_fd = directory_str_or_fd = os.open(directory_str, os.O_RDONLY | O_DIRECTORY)

self._generator = self._walk(
Expand Down Expand Up @@ -583,7 +583,7 @@ def _walk(
) -> ty.Generator[FSNodeEntry, ty.Any, None]:
if directory_str is not None:
sep = utils.maybe_fsencode(os.path.sep, directory_str)
elif matcher is not None and matcher.is_binary: # type: ignore[unreachable]
elif matcher is not None and matcher.is_binary:
sep = os.fsencode(os.path.sep) # type: ignore[assignment]
else:
sep = os.path.sep # type: ignore[assignment]
Expand Down
16 changes: 8 additions & 8 deletions test/functional/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,17 +371,17 @@ def test_add_recursive(client, cleanup_pins):


def test_add_cid_version_0(client, cleanup_pins):
with tempfile.TemporaryDirectory() as empty_dir:
response = client.add(empty_dir, cid_version=0)
assert len(response) == 1
assert response[0]["Hash"] == "QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"
with tempfile.TemporaryDirectory() as empty_dir:
response = client.add(empty_dir, cid_version=0)
assert len(response) == 1
assert response[0]["Hash"] == "QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn"


def test_add_cid_version_1(client, cleanup_pins):
with tempfile.TemporaryDirectory() as empty_dir:
response = client.add(empty_dir, cid_version=1)
assert len(response) == 1
assert response[0]["Hash"] == "bafybeiczsscdsbs7ffqz55asqdf3smv6klcw3gofszvwlyarci47bgf354"
with tempfile.TemporaryDirectory() as empty_dir:
response = client.add(empty_dir, cid_version=1)
assert len(response) == 1
assert response[0]["Hash"] == "bafybeiczsscdsbs7ffqz55asqdf3smv6klcw3gofszvwlyarci47bgf354"


@pytest.mark.dependency(depends=["test_add_recursive"])
Expand Down
26 changes: 16 additions & 10 deletions test/run-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def pytest_pyfunc_call(self, pyfuncitem):
else:
# Exclude the past
exclusions.append(r"\#PY2")
# Exclude code only used for compatiblity with a previous Python version
# Exclude code only used for compatibility with a previous Python version
exclusions.append(r"\#PY3({0})([^\d+]|$)".format(
"|".join(map(str, range(0, sys.version_info.minor)))
))
Expand All @@ -173,15 +173,21 @@ def pytest_pyfunc_call(self, pyfuncitem):
exclusions.append(r"\# pragma: http-backend=httpx")

# Create temporary file with extended *coverage.py* configuration data
coveragerc.file.writelines(map(lambda s: s + "\n", itertools.chain((
"[run]",
"omit =",
), map(lambda s: "\t" + s, omitted_files),
(
"[report]",
"# Exclude lines specific to some other Python version from coverage",
"exclude_lines =",
), map(lambda s: "\t" + s, exclusions))))
coveragerc.file.writelines(
map(
lambda s: s + "\n",
itertools.chain(
(
"[run]",
"omit =",
),
map(lambda s: "\t" + s, omitted_files),
(
"[report]",
"# Exclude lines specific to some other Python version from coverage",
"exclude_lines =",
),
map(lambda s: "\t" + s, exclusions))))
coveragerc.file.flush()

coverage_args = [
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ deps =
[testenv:py3-httpx]
deps-exclusive =
httpx (~= 0.14.0)
httpcore (~= 0.10.2) # Has Unix domain socket support
httpcore (~= 0.10.2)
deps =
{[testenv]deps}
{[testenv:py3-httpx]deps-exclusive}
Expand Down Expand Up @@ -95,7 +95,7 @@ commands =


[flake8]
exclude = .git,.tox,+junk,coverage,dist,doc,*egg,build,tools,test/unit,docs,*__init__.py
exclude = .git,.tox,+junk,coverage,dist,doc,*egg,build,tools,test/unit,docs,*__init__.py,venv

# E221: Multiple spaces before operator
# E241: Multiple spaces after ',': Breaks element alignment collections
Expand Down