Show More
@@ -74,6 +74,11 b' username = platform.username' | |||
|
74 | 74 | |
|
75 | 75 | # Python compatibility |
|
76 | 76 | |
|
77 | _notset = object() | |
|
78 | ||
|
79 | def safehasattr(thing, attr): | |
|
80 | return getattr(thing, attr, _notset) is not _notset | |
|
81 | ||
|
77 | 82 | def sha1(s=''): |
|
78 | 83 | ''' |
|
79 | 84 | Low-overhead wrapper around Python's SHA support |
@@ -87,10 +92,6 b" def sha1(s=''):" | |||
|
87 | 92 | |
|
88 | 93 | return _fastsha1(s) |
|
89 | 94 | |
|
90 | _notset = object() | |
|
91 | def safehasattr(thing, attr): | |
|
92 | return getattr(thing, attr, _notset) is not _notset | |
|
93 | ||
|
94 | 95 | def _fastsha1(s=''): |
|
95 | 96 | # This function will import sha1 from hashlib or sha (whichever is |
|
96 | 97 | # available) and overwrite itself with it on the first call. |
General Comments 0
You need to be logged in to leave comments.
Login now