ϪfUdZddlZddlZddlmZddlmZdZdZdZ dZ e ed dZ Gd d e Zeed d ddddd  eZe ed<eed d dddddej$dZej$dZdZdZGddZej1j2Zy#e$reZYlwxYw)z Win32 utilities. See also twisted.python.shortcut. @var O_BINARY: the 'binary' mode flag on Windows, or 0 on other platforms, so it may safely be OR'ed into a mask for os.open. N)Version)deprecatedModuleAttribute{i O_BINARYceZdZdZy)FakeWindowsErrorz\ Stand-in for sometimes-builtin exception on platforms for which it is missing. N)__name__ __module__ __qualname____doc__6/usr/lib/python3/dist-packages/twisted/python/win32.pyr r srr Twistedz9Catch OSError and check presence of 'winerror' attribute.ztwisted.python.win32 WindowsErrorz(\\*)"z(\\+)\Zcd|vxsd|vxs d|vxs|dk(xrdxsd}|tjdtjd|z|zS)aL Internal method for quoting a single command-line argument. @param s: an unquoted string that you want to quote so that something that does cmd.exe-style unquoting will interpret it as a single argument, even if it contains spaces. @type s: C{str} @return: a quoted string. @rtype: C{str}   "z\1\1z\1\1\\")_cmdLineQuoteRe2sub_cmdLineQuoteRe)squotes r cmdLineQuoter>seQh ?DAI ?3!8 ?R HS NBE   w(;(;J(J K L  rc\dj|Dcgc] }t|c}Scc}w)a` Quote an iterable of command-line arguments for passing to CreateProcess or a similar API. This allows the list passed to C{reactor.spawnProcess} to match the child process's C{sys.argv} properly. @param arguments: an iterable of C{str}, each unquoted. @return: a single string, with the given sequence quoted as necessary. r)joinr) argumentsas rquoteArgumentsr$Rs% 88i8\!_8 998s)c,eZdZdZdZedZdZy)_ErrorFormattera{ Formatter for Windows error messages. @ivar winError: A callable which takes one integer error number argument and returns a L{WindowsError} instance for that error (like L{ctypes.WinError}). @ivar formatMessage: A callable which takes one integer error number argument and returns a C{str} giving the message for that error (like U{win32api.FormatMessage}). @ivar errorTab: A mapping from integer error numbers to C{str} messages which correspond to those erorrs (like I{socket.errorTab}). c.||_||_||_y)N)winError formatMessageerrorTab)selfWinError FormatMessager*s r__init__z_ErrorFormatter.__init__ps  *  rc ddlm} ddlm} ddlm}||||S#t$rd}Y%wxYw#t$rd}Y/wxYw#t$rd}Y9wxYw)z Get as many of the platform-specific error translation objects as possible and return an instance of C{cls} created with them. r)r,N)r-)r*)ctypesr, ImportErrorwin32apir-socketr*)clsr,r-r*s rfromEnvironmentz_ErrorFormatter.fromEnvironmentusk   ' ! .  '8]H55 H  ! M ! H s) 1A .. ?? AAc |j|j|jS|j|j|S|j|jj |}||St j|S)a Returns the string associated with a Windows error message, such as the ones found in socket.error. Attempts direct lookup against the win32 API via ctypes and then pywin32 if available), then in the error table in the socket module, then finally defaulting to C{os.strerror}. @param errorcode: the Windows error code @type errorcode: C{int} @return: The error message string @rtype: C{str} )r(strerrorr)r*getos)r+ errorcoderesults r formatErrorz_ErrorFormatter.formatErrorsx == $==+44 4    )%%i0 0 == $]]&&y1F! {{9%%rN)r r r rr. classmethodr5r<rrrr&r&_s% ! 66&&rr&)rr9re incrementalrtwisted.python.deprecaterERROR_FILE_NOT_FOUNDERROR_PATH_NOT_FOUNDERROR_INVALID_NAMEERROR_DIRECTORYgetattrrOSErrorr r__annotations__ NameErrorcompilerrrr$r&r5r<rrrrJs  > 2z1 %w Ir1a ? $(L'( Ir1a ? "**Y'2::j)( :A&A&H--/;; i$#L$s B44B>=B>