view mercurial/utils/hashutil.py @ 49576:d12446766a35 stable

upgrade: byteify requirement changes written to output ui.write() expects bytes, and internally uses `b''` as the default when getting the `label` keyword from `*args`. So either we're missing test coverage, or there's some very subtle conversion from unicode somewhere. Also, slip in a type hint to flag this in the future.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 06 Nov 2022 12:15:35 -0500
parents 6000f5b25c9b
children
line wrap: on
line source

import hashlib

try:
    from ..thirdparty import sha1dc  # pytype: disable=import-error

    sha1 = sha1dc.sha1
except (ImportError, AttributeError):
    sha1 = hashlib.sha1