mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 10:36:52 -07:00
Update jaraco-windows to 3.9.2
Also updates: - importlib-metadata-0.7 - jaraco-windows - jaraco.classes-1.5 - jaraco.collections-1.6.0 - jaraco.functools-1.20 - jaraco.structures-1.1.2 - jaraco.text-1.10.1 - jaraco.ui-1.6 - more-itertools-4.3.0 - path.py-11.5.0 - six-1.12.0
This commit is contained in:
parent
aa769627bd
commit
8d43b8ea39
92 changed files with 7515 additions and 996 deletions
|
@ -6,9 +6,12 @@ import ctypes
|
|||
import ctypes.wintypes
|
||||
|
||||
import six
|
||||
|
||||
builtins = six.moves.builtins
|
||||
|
||||
|
||||
__import__('jaraco.windows.api.memory')
|
||||
|
||||
|
||||
def format_system_message(errno):
|
||||
"""
|
||||
Call FormatMessage with a system error number to retrieve
|
||||
|
@ -35,7 +38,7 @@ def format_system_message(errno):
|
|||
ctypes.byref(result_buffer),
|
||||
buffer_size,
|
||||
arguments,
|
||||
)
|
||||
)
|
||||
# note the following will cause an infinite loop if GetLastError
|
||||
# repeatedly returns an error that cannot be formatted, although
|
||||
# this should not happen.
|
||||
|
@ -46,13 +49,16 @@ def format_system_message(errno):
|
|||
|
||||
|
||||
class WindowsError(builtins.WindowsError):
|
||||
"more info about errors at http://msdn.microsoft.com/en-us/library/ms681381(VS.85).aspx"
|
||||
"""
|
||||
More info about errors at
|
||||
http://msdn.microsoft.com/en-us/library/ms681381(VS.85).aspx
|
||||
"""
|
||||
|
||||
def __init__(self, value=None):
|
||||
if value is None:
|
||||
value = ctypes.windll.kernel32.GetLastError()
|
||||
strerror = format_system_message(value)
|
||||
if sys.version_info > (3,3):
|
||||
if sys.version_info > (3, 3):
|
||||
args = 0, strerror, None, value
|
||||
else:
|
||||
args = value, strerror
|
||||
|
@ -72,6 +78,7 @@ class WindowsError(builtins.WindowsError):
|
|||
def __repr__(self):
|
||||
return '{self.__class__.__name__}({self.winerror})'.format(**vars())
|
||||
|
||||
|
||||
def handle_nonzero_success(result):
|
||||
if result == 0:
|
||||
raise WindowsError()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue