Ϫf$gdZddlZddlZddlZddlmZddlmZdefdZ dddd d d Z Gd d Z e Z e jZy) )secondsshortPythonVersionPlatformplatform platformTypeN)time)Optionalreturnc.dtjddzS)z? Returns the Python version as a dot-separated string. z%s.%s.%sN)sys version_info8/usr/lib/python3/dist-packages/twisted/python/runtime.pyrrs ((!, ,,rwin32posixjava)ntcerrzorg.python.modules.osc4eZdZUdZej ejZe e e d<e e Z ejZ dde e de e ddfdZdefdZde e fd Zdefd Zdefd Zdefd Zdefd ZdefdZdde defdZdefdZdefdZdefdZy)rzC Gives us information about the platform we're running on. typeNnamerr cP|tj||_|||_yy)N)knownPlatformsgetr _platform)selfrrs r__init__zPlatform.__init__,s.  &**40DI  %DN rc |jdk7S)z Do we know about this platform? @return: Boolean indicating whether this is a known platform or not. Nrrs risKnownzPlatform.isKnown4s yyD  rc|jS)zX Get platform type. @return: Either 'posix', 'win32' or 'java' r!r"s rgetTypezPlatform.getType<s yyrc |jdk(S)z Check if current platform is macOS. @return: C{True} if the current platform has been detected as macOS. darwin)rr"s risMacOSXzPlatform.isMacOSXDs ~~))rcZtjdtd|jS)a  Are we running in Windows NT? This is deprecated and always returns C{True} on win32 because Twisted only supports Windows NT-derived platforms at this point. @return: C{True} if the current platform has been detected as Windows NT. zgtwisted.python.runtime.Platform.isWinNT was deprecated in Twisted 13.0. Use Platform.isWindows instead.) stacklevel)warningswarnDeprecationWarning isWindowsr"s risWinNTzPlatform.isWinNTLs*   <   ~~rc(|jdk(S)z Are we running in Windows? @return: C{True} if the current platform has been detected as Windows. r)r%r"s rr/zPlatform.isWindows^s||~((rcntjdk(xr!tjjdk(S)z Check if current platform is Windows Vista or Windows Server 2008. @return: C{True} if the current platform has been detected as Vista r)r rgetwindowsversionmajorr"s risVistazPlatform.isVistags, ||w&M3+@+@+B+H+HA+MMrc8|jjdS)z Check if current platform is Linux. @return: C{True} if the current platform has been detected as Linux. linux)r startswithr"s risLinuxzPlatform.isLinuxos ~~((11r_initCGroupLocationc:|jsyddlm}||}|jrg|j j dDcgc]}|j d}}|D]'}t |dk(s|djds'y ycc}w) z Check if the current platform is Linux in a Docker container. @return: C{True} if the current platform has been detected as Linux inside a Docker container. Fr)FilePath :r r*s/docker/T)r:twisted.python.filepathr=exists getContentsplitlenr9)rr;r= initCGroupsx controlGroupsgroups risDockerzPlatform.isDockerws||~423    (3'='='?'E'Ee'L"# M' u:?uQx':':;'G sBcf|jry tjy#t$rYywxYw)z Check for symlink support usable for Twisted's purposes. @return: C{True} if symlinks are supported on the current platform, otherwise C{False}. FT)r/ossymlinkAttributeErrorr"s r_supportsSymlinkszPlatform._supportsSymlinkss8 >>   "  s $ 00c2 ddl}|duS#t$rYywxYw)zy Can threads be created? @return: C{True} if the threads are supported on the current platform. rNF) threading ImportError)rrPs rsupportsThreadszPlatform.supportsThreadss'   D( (  s  c ddlm}m} t j |y#t$rYywxYw#|$rYywxYw)zf Return C{True} if we can use the inotify API on this platform. @since: 10.1 r) INotifyErrorinitFT)twisted.python._inotifyrTrUrQrKclose)rrTrUs rsupportsINotifyzPlatform.supportsINotifysI   B  HHTV      s&5 22==)NN)z/proc/1/cgroup)__name__ __module__ __qualname____doc__rrrKrrr str__annotations__ staticmethodrr rrrboolr#r%r(r0r/r6r:rIrNrRrXrrrrr#s),,RWW5D(3-57#G IEI&SM&4rcse    -C-    # eeP :! r