mercurial/util.py
branchstable
changeset 15392 d7bfbc92a1c0
parent 15390 fffe49886a51
child 15452 de7e2fba4326
child 15488 6eff984d8e76
equal deleted inserted replaced
15391:a5a6a9b7f3b9 15392:d7bfbc92a1c0
    72 username = platform.username
    72 username = platform.username
    73 
    73 
    74 # Python compatibility
    74 # Python compatibility
    75 
    75 
    76 def sha1(s=''):
    76 def sha1(s=''):
       
    77     '''
       
    78     Low-overhead wrapper around Python's SHA support
       
    79 
       
    80     >>> f = _fastsha1
       
    81     >>> a = sha1()
       
    82     >>> a = f()
       
    83     >>> a.hexdigest()
       
    84     'da39a3ee5e6b4b0d3255bfef95601890afd80709'
       
    85     '''
       
    86 
    77     return _fastsha1(s)
    87     return _fastsha1(s)
    78 
    88 
    79 _notset = object()
    89 _notset = object()
    80 def safehasattr(thing, attr):
    90 def safehasattr(thing, attr):
    81     return getattr(thing, attr, _notset) is not _notset
    91     return getattr(thing, attr, _notset) is not _notset