OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python3
/
dist-packages
/
twisted
/
python
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
03/31/2022 06:22:38 AM
rwxr-xr-x
📄
__init__.py
674 bytes
09/08/2017 10:38:35 AM
rw-r--r--
📁
__pycache__
-
03/31/2022 06:22:39 AM
rwxr-xr-x
📄
_appdirs.py
788 bytes
09/08/2017 10:38:35 AM
rw-r--r--
📄
_inotify.py
3.37 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
_oldstyle.py
2.53 KB
09/08/2017 10:38:35 AM
rw-r--r--
📁
_pydoctortemplates
-
03/31/2022 06:22:38 AM
rwxr-xr-x
📄
_release.py
18.03 KB
09/08/2017 10:38:35 AM
rw-r--r--
📄
_sendmsg.c
15.42 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
_setup.py
12.6 KB
09/23/2017 05:51:46 AM
rw-r--r--
📄
_shellcomp.py
23.76 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
_textattributes.py
8.87 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
_tzhelper.py
3.12 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
_url.py
253 bytes
09/08/2017 10:38:35 AM
rw-r--r--
📄
compat.py
21.91 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
components.py
13.96 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
constants.py
544 bytes
09/08/2017 10:38:35 AM
rw-r--r--
📄
context.py
3.93 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
deprecate.py
26.15 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
failure.py
23.38 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
fakepwd.py
5.99 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
filepath.py
57.51 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
formmethod.py
11.19 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
htmlizer.py
3.27 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
lockfile.py
7.54 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
log.py
21.95 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
logfile.py
9.85 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
modules.py
26.5 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
monkey.py
2.17 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
procutils.py
1.39 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
randbytes.py
3.87 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
rebuild.py
9.04 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
reflect.py
19.02 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
release.py
1.16 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
roots.py
7.23 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
runtime.py
6.13 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
sendmsg.py
3.34 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
shortcut.py
2.2 KB
09/08/2017 10:38:35 AM
rw-r--r--
📄
syslog.py
3.64 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
systemd.py
2.77 KB
09/08/2017 10:38:36 AM
rw-r--r--
📁
test
-
03/31/2022 06:22:38 AM
rwxr-xr-x
📄
text.py
5.35 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
threadable.py
3.22 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
threadpool.py
9.61 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
twisted-completion.zsh
1.33 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
url.py
244 bytes
09/08/2017 10:38:36 AM
rw-r--r--
📄
urlpath.py
8.87 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
usage.py
34.19 KB
03/22/2022 11:03:56 AM
rw-r--r--
📄
util.py
27.29 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
versions.py
322 bytes
09/08/2017 10:38:35 AM
rw-r--r--
📄
win32.py
5.42 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
zippath.py
9.02 KB
09/08/2017 10:38:36 AM
rw-r--r--
📄
zipstream.py
9.53 KB
09/08/2017 10:38:36 AM
rw-r--r--
Editing: runtime.py
Close
# -*- test-case-name: twisted.python.test.test_runtime -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import division, absolute_import import os import sys import time import warnings from twisted.python._oldstyle import _oldStyle def shortPythonVersion(): """ Returns the Python version as a dot-separated string. """ return "%s.%s.%s" % sys.version_info[:3] knownPlatforms = { 'nt': 'win32', 'ce': 'win32', 'posix': 'posix', 'java': 'java', 'org.python.modules.os': 'java', } _timeFunctions = { #'win32': time.clock, 'win32': time.time, } @_oldStyle class Platform: """ Gives us information about the platform we're running on. """ type = knownPlatforms.get(os.name) seconds = staticmethod(_timeFunctions.get(type, time.time)) _platform = sys.platform def __init__(self, name=None, platform=None): if name is not None: self.type = knownPlatforms.get(name) self.seconds = _timeFunctions.get(self.type, time.time) if platform is not None: self._platform = platform def isKnown(self): """ Do we know about this platform? @return: Boolean indicating whether this is a known platform or not. @rtype: C{bool} """ return self.type != None def getType(self): """ Get platform type. @return: Either 'posix', 'win32' or 'java' @rtype: C{str} """ return self.type def isMacOSX(self): """ Check if current platform is Mac OS X. @return: C{True} if the current platform has been detected as OS X. @rtype: C{bool} """ return self._platform == "darwin" def isWinNT(self): """ 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. @rtype: C{bool} """ warnings.warn( "twisted.python.runtime.Platform.isWinNT was deprecated in " "Twisted 13.0. Use Platform.isWindows instead.", DeprecationWarning, stacklevel=2) return self.isWindows() def isWindows(self): """ Are we running in Windows? @return: C{True} if the current platform has been detected as Windows. @rtype: C{bool} """ return self.getType() == 'win32' def isVista(self): """ Check if current platform is Windows Vista or Windows Server 2008. @return: C{True} if the current platform has been detected as Vista @rtype: C{bool} """ if getattr(sys, "getwindowsversion", None) is not None: return sys.getwindowsversion()[0] == 6 else: return False def isLinux(self): """ Check if current platform is Linux. @return: C{True} if the current platform has been detected as Linux. @rtype: C{bool} """ return self._platform.startswith("linux") def isDocker(self, _initCGroupLocation="/proc/1/cgroup"): """ 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. @rtype: C{bool} """ if not self.isLinux(): return False from twisted.python.filepath import FilePath # Ask for the cgroups of init (pid 1) initCGroups = FilePath(_initCGroupLocation) if initCGroups.exists(): # The cgroups file looks like "2:cpu:/". The third element will # begin with /docker if it is inside a Docker container. controlGroups = [x.split(b":") for x in initCGroups.getContent().split(b"\n")] for group in controlGroups: if len(group) == 3 and group[2].startswith(b"/docker/"): # If it starts with /docker/, we're in a docker container return True return False def _supportsSymlinks(self): """ Check for symlink support usable for Twisted's purposes. @return: C{True} if symlinks are supported on the current platform, otherwise C{False}. @rtype: L{bool} """ if self.isWindows(): # We do the isWindows() check as newer Pythons support the symlink # support in Vista+, but only if you have some obscure permission # (SeCreateSymbolicLinkPrivilege), which can only be given on # platforms with msc.exe (so, Business/Enterprise editions). # This uncommon requirement makes the Twisted test suite test fail # in 99.99% of cases as general users don't have permission to do # it, even if there is "symlink support". return False else: # If we're not on Windows, check for existence of os.symlink. try: os.symlink except AttributeError: return False else: return True def supportsThreads(self): """ Can threads be created? @return: C{True} if the threads are supported on the current platform. @rtype: C{bool} """ try: import threading return threading is not None # shh pyflakes except ImportError: return False def supportsINotify(self): """ Return C{True} if we can use the inotify API on this platform. @since: 10.1 """ try: from twisted.python._inotify import INotifyError, init except ImportError: return False if self.isDocker(): return False try: os.close(init()) except INotifyError: return False return True platform = Platform() platformType = platform.getType() seconds = platform.seconds