We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The current default hash is sensitive to whitespace, which is not great, and ought to be replaced with something better... OTOH this might work:
def robust_hash_python_code_tokenize(code): try: tokens = [] g = tokenize.generate_tokens(io.StringIO(code).readline) for toknum, tokval, _, _, _ in g: if toknum not in (tokenize.COMMENT, tokenize.NL, tokenize.ENDMARKER, tokenize.DEDENT, tokenize.INDENT): tokens.append((toknum, tokval)) token_string = str(tokens).encode('utf-8') return hashlib.sha256(token_string).hexdigest() except tokenize.TokenError: return None
See also airspeed-velocity/asv#1456 (comment)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The current default hash is sensitive to whitespace, which is not great, and ought to be replaced with something better... OTOH this might work:
See also airspeed-velocity/asv#1456 (comment)
The text was updated successfully, but these errors were encountered: