Invalid hash for (package) using archive (archive.name)
Package:
poetry
16152

Exception Class:
RuntimeError
Raise code
"sha256:"
+ FileDependency(
package.name,
Path(archive.path) if isinstance(archive, Link) else archive,
).hash()
)
if archive_hash not in {f["hash"] for f in package.files}:
raise RuntimeError(
f"Invalid hash for {package} using archive {archive.name}"
)
self._hashes[package.name] = archive_hash
return archive
def _downloa
Links to the raise (1)
https://github.com/python-poetry/poetry/blob/9591e88492508d4dba260952d53266a0032c04c7/poetry/installation/executor.py#L682Ways to fix
The valid optional parameters should be in the following list.
options = ("quote_attr_values",
"quote_char",
"use_best_quote_char",
"omit_optional_tags",
"minimize_boolean_attributes",
"use_trailing_solidus",
"space_before_trailing_solidus",
"escape_lt_in_attrs",
"escape_rcdata",
"resolve_entities",
"alphabetical_attributes",
"inject_meta_charset",
"strip_whitespace",
"sanitize")
Any other parameter name causes this exception
Code to reproduce the exception:
from html5lib.html5parser import parse
from html5lib.serializer import serialize
token_stream = parse('<html><body><p>Hi!</p></body></html>')
serialize(token_stream, omit_optional_tag=False)
The error output:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-0a6c1b2a6780> in <module>() 2 from html5lib.serializer import serialize 3 token_stream = parse('<html><body><p>Hi!</p></body></html>') ----> 4 serialize(token_stream, omit_optional_tag=False)
/usr/local/lib/python3.7/dist-packages/html5lib/serializer.py in serialize(input, tree, encoding, **serializer_opts) 98 # XXX: Should we cache this? 99 walker = treewalkers.getTreeWalker(tree) --> 100 s = HTMLSerializer(**serializer_opts) 101 return s.render(walker(input), encoding) 102
/usr/local/lib/python3.7/dist-packages/html5lib/serializer.py in __init__(self, **kwargs) 214 unexpected_args = frozenset(kwargs) - frozenset(self.options) 215 if len(unexpected_args) > 0: --> 216 raise TypeError("__init__() got an unexpected keyword argument '%s'" % next(iter(unexpected_args))) 217 if 'quote_char' in kwargs: 218 self.use_best_quote_char = False
TypeError: __init__() got an unexpected keyword argument 'omit_optional_tag'
Fixed version of the code:
from html5lib.html5parser import parse
from html5lib.serializer import serialize
token_stream = parse('<html><body><p>Hi!</p></body></html>')
serialize(token_stream, omit_optional_tags=False)
'<html><head></head><body><p>Hi!</p></body></html>'
'
Add a possible fix
Please authorize to post fix