mirror of
https://github.com/ipfs-shipyard/py-ipfs-http-client.git
synced 2021-08-30 00:23:11 +03:00
flake8 linting corrections; ignore venv created by PyCharm
This commit is contained in:
committed by
Alexander Schlarb
parent
52c1d2a28a
commit
c06b62b6fc
3
.gitignore
vendored
3
.gitignore
vendored
@@ -11,6 +11,7 @@
|
||||
/.project
|
||||
/.settings
|
||||
/.vscode
|
||||
/venv
|
||||
|
||||
# Stuff that never was meant to be public
|
||||
/+junk
|
||||
@@ -27,4 +28,4 @@ docs/build/
|
||||
go-ipfs/
|
||||
.coverage
|
||||
.pytest_cache/
|
||||
.tox/
|
||||
.tox/
|
||||
|
||||
@@ -105,8 +105,9 @@ class Json(Encoding[utils.json_value_t]):
|
||||
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…
|
||||
# noqa: E114, E116
|
||||
@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.
|
||||
|
||||
|
||||
@@ -512,7 +512,7 @@ class walk(ty.Generator[FSNodeEntry, ty.Any, None], ty.Generic[ty.AnyStr]):
|
||||
#
|
||||
# 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): # noqa: E501
|
||||
self._close_fd = directory_str_or_fd = os.open(directory_str, os.O_RDONLY | O_DIRECTORY)
|
||||
|
||||
self._generator = self._walk(
|
||||
@@ -583,7 +583,7 @@ class walk(ty.Generator[FSNodeEntry, ty.Any, None], ty.Generic[ty.AnyStr]):
|
||||
) -> 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]
|
||||
|
||||
@@ -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"])
|
||||
|
||||
@@ -177,11 +177,11 @@ try:
|
||||
"[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))))
|
||||
(
|
||||
"[report]",
|
||||
"# Exclude lines specific to some other Python version from coverage",
|
||||
"exclude_lines =",
|
||||
), map(lambda s: "\t" + s, exclusions))))
|
||||
coveragerc.file.flush()
|
||||
|
||||
coverage_args = [
|
||||
|
||||
2
tox.ini
2
tox.ini
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user