PATH:
usr
/
lib64
/
python3.6
"""Drop-in replacement for the thread module. Meant to be used as a brain-dead substitute so that threaded code does not need to be rewritten for when the thread module is not present. Suggested usage is:: try: import _thread except ImportError: import _dummy_thread as _thread """ # Exports only things specified by thread documentation; # skipping obsolete synonyms allocate(), start_new(), exit_thread(). __all__ = ['error', 'start_new_thread', 'exit', 'get_ident', 'allocate_lock', 'interrupt_main', 'LockType'] # A dummy value TIMEOUT_MAX = 2**31 # NOTE: this module can be imported early in the extension building process, # and so top level imports of other modules should be avoided. Instead, all # imports are done when needed on a function-by-function basis. Since threads # are disabled, the import lock should not be an issue anyway (??). error = RuntimeError def start_new_thread(function, args, kwargs={}): """Dummy implementation of _thread.start_new_thread(). Compatibility is maintained by making sure that ``args`` is a tuple and ``kwargs`` is a dictionary. If an exception is raised and it is SystemExit (which can be done by _thread.exit()) it is caught and nothing is done; all other exceptions are printed out by using traceback.print_exc(). If the executed function calls interrupt_main the KeyboardInterrupt will be raised when the function returns. """ if type(args) != type(tuple()): raise TypeError("2nd arg must be a tuple") if type(kwargs) != type(dict()): raise TypeError("3rd arg must be a dict") global _main _main = False try: function(*args, **kwargs) except SystemExit: pass except: import traceback traceback.print_exc() _main = True global _interrupt if _interrupt: _interrupt = False raise KeyboardInterrupt def exit(): """Dummy implementation of _thread.exit().""" raise SystemExit def get_ident(): """Dummy implementation of _thread.get_ident(). Since this module should only be used when _threadmodule is not available, it is safe to assume that the current process is the only thread. Thus a constant can be safely returned. """ return -1 def allocate_lock(): """Dummy implementation of _thread.allocate_lock().""" return LockType() def stack_size(size=None): """Dummy implementation of _thread.stack_size().""" if size is not None: raise error("setting thread stack size not supported") return 0 def _set_sentinel(): """Dummy implementation of _thread._set_sentinel().""" return LockType() class LockType(object): """Class implementing dummy implementation of _thread.LockType. Compatibility is maintained by maintaining self.locked_status which is a boolean that stores the state of the lock. Pickling of the lock, though, should not be done since if the _thread module is then used with an unpickled ``lock()`` from here problems could occur from this class not having atomic methods. """ def __init__(self): self.locked_status = False def acquire(self, waitflag=None, timeout=-1): """Dummy implementation of acquire(). For blocking calls, self.locked_status is automatically set to True and returned appropriately based on value of ``waitflag``. If it is non-blocking, then the value is actually checked and not set if it is already acquired. This is all done so that threading.Condition's assert statements aren't triggered and throw a little fit. """ if waitflag is None or waitflag: self.locked_status = True return True else: if not self.locked_status: self.locked_status = True return True else: if timeout > 0: import time time.sleep(timeout) return False __enter__ = acquire def __exit__(self, typ, val, tb): self.release() def release(self): """Release the dummy lock.""" # XXX Perhaps shouldn't actually bother to test? Could lead # to problems for complex, threaded code. if not self.locked_status: raise error self.locked_status = False return True def locked(self): return self.locked_status def __repr__(self): return "<%s %s.%s object at %s>" % ( "locked" if self.locked_status else "unlocked", self.__class__.__module__, self.__class__.__qualname__, hex(id(self)) ) # Used to signal that interrupt_main was called in a "thread" _interrupt = False # True when not executing in a "thread" _main = True def interrupt_main(): """Set _interrupt flag to True to have start_new_thread raise KeyboardInterrupt upon exiting.""" if _main: raise KeyboardInterrupt else: global _interrupt _interrupt = True
[+]
..
[-] __phello__.foo.py
[edit]
[-] zipfile.py
[edit]
[-] _dummy_thread.py
[edit]
[-] signal.py
[edit]
[-] tabnanny.py
[edit]
[-] cmd.py
[edit]
[-] cProfile.py
[edit]
[-] tempfile.py
[edit]
[-] argparse.py
[edit]
[-] platform.py
[edit]
[-] binhex.py
[edit]
[-] antigravity.py
[edit]
[+]
curses
[-] _compat_pickle.py
[edit]
[-] statistics.py
[edit]
[-] inspect.py
[edit]
[-] ipaddress.py
[edit]
[-] sunau.py
[edit]
[-] imghdr.py
[edit]
[-] random.py
[edit]
[-] macpath.py
[edit]
[-] hmac.py
[edit]
[-] base64.py
[edit]
[-] cgitb.py
[edit]
[-] stringprep.py
[edit]
[-] ast.py
[edit]
[-] textwrap.py
[edit]
[-] enum.py
[edit]
[-] _compression.py
[edit]
[-] dis.py
[edit]
[+]
venv
[-] chunk.py
[edit]
[-] this.py
[edit]
[-] py_compile.py
[edit]
[-] fnmatch.py
[edit]
[+]
xml
[-] opcode.py
[edit]
[+]
site-packages
[-] sre_compile.py
[edit]
[-] _pyio.py
[edit]
[-] pty.py
[edit]
[-] datetime.py
[edit]
[-] macurl2path.py
[edit]
[+]
lib2to3
[+]
wsgiref
[-] heapq.py
[edit]
[-] keyword.py
[edit]
[-] codecs.py
[edit]
[+]
ensurepip
[-] pickletools.py
[edit]
[-] compileall.py
[edit]
[-] nturl2path.py
[edit]
[-] warnings.py
[edit]
[-] shutil.py
[edit]
[-] socket.py
[edit]
[-] pdb.py
[edit]
[-] zipapp.py
[edit]
[-] formatter.py
[edit]
[-] _sitebuiltins.py
[edit]
[-] _markupbase.py
[edit]
[-] types.py
[edit]
[-] runpy.py
[edit]
[-] uu.py
[edit]
[-] typing.py
[edit]
[-] pathlib.py
[edit]
[-] _threading_local.py
[edit]
[-] mailcap.py
[edit]
[-] bisect.py
[edit]
[-] linecache.py
[edit]
[-] colorsys.py
[edit]
[-] glob.py
[edit]
[-] sndhdr.py
[edit]
[-] ssl.py
[edit]
[-] _strptime.py
[edit]
[-] _sysconfigdata_m_linux_x86_64-linux-gnu.py
[edit]
[-] imp.py
[edit]
[-] contextlib.py
[edit]
[-] copyreg.py
[edit]
[-] filecmp.py
[edit]
[+]
logging
[-] operator.py
[edit]
[-] token.py
[edit]
[-] gzip.py
[edit]
[-] string.py
[edit]
[-] genericpath.py
[edit]
[-] _osx_support.py
[edit]
[-] stat.py
[edit]
[-] lzma.py
[edit]
[-] __future__.py
[edit]
[+]
distutils
[-] dummy_threading.py
[edit]
[+]
asyncio
[-] webbrowser.py
[edit]
[-] symtable.py
[edit]
[+]
lib-dynload
[-] getopt.py
[edit]
[-] wave.py
[edit]
[-] codeop.py
[edit]
[-] _sysconfigdata_dm_linux_x86_64-linux-gnu.py
[edit]
[-] abc.py
[edit]
[+]
config-3.6m-x86_64-linux-gnu
[+]
pydoc_data
[-] telnetlib.py
[edit]
[+]
unittest
[-] fileinput.py
[edit]
[-] ftplib.py
[edit]
[+]
ctypes
[-] _bootlocale.py
[edit]
[-] pipes.py
[edit]
[-] aifc.py
[edit]
[-] pprint.py
[edit]
[-] queue.py
[edit]
[-] difflib.py
[edit]
[+]
__pycache__
[-] uuid.py
[edit]
[-] reprlib.py
[edit]
[-] threading.py
[edit]
[+]
http
[-] sre_parse.py
[edit]
[-] subprocess.py
[edit]
[+]
importlib
[-] selectors.py
[edit]
[-] getpass.py
[edit]
[-] trace.py
[edit]
[-] struct.py
[edit]
[-] tracemalloc.py
[edit]
[-] plistlib.py
[edit]
[-] asynchat.py
[edit]
[-] fractions.py
[edit]
[-] shlex.py
[edit]
[-] bdb.py
[edit]
[-] locale.py
[edit]
[-] calendar.py
[edit]
[-] poplib.py
[edit]
[-] posixpath.py
[edit]
[-] imaplib.py
[edit]
[+]
concurrent
[-] pickle.py
[edit]
[-] timeit.py
[edit]
[+]
json
[-] traceback.py
[edit]
[+]
multiprocessing
[-] shelve.py
[edit]
[-] csv.py
[edit]
[-] tarfile.py
[edit]
[-] numbers.py
[edit]
[-] optparse.py
[edit]
[-] cgi.py
[edit]
[-] pstats.py
[edit]
[-] crypt.py
[edit]
[+]
collections
[-] site.py
[edit]
[-] pkgutil.py
[edit]
[-] re.py
[edit]
[-] pyclbr.py
[edit]
[-] socketserver.py
[edit]
[-] _pydecimal.py
[edit]
[-] pydoc.py
[edit]
[-] sre_constants.py
[edit]
[-] xdrlib.py
[edit]
[-] nntplib.py
[edit]
[-] mimetypes.py
[edit]
[+]
email
[-] quopri.py
[edit]
[-] doctest.py
[edit]
[-] profile.py
[edit]
[-] sched.py
[edit]
[-] hashlib.py
[edit]
[+]
urllib
[-] secrets.py
[edit]
[-] functools.py
[edit]
[-] smtplib.py
[edit]
[-] copy.py
[edit]
[+]
dbm
[-] tty.py
[edit]
[-] os.py
[edit]
[-] _collections_abc.py
[edit]
[-] configparser.py
[edit]
[-] _weakrefset.py
[edit]
[-] netrc.py
[edit]
[-] code.py
[edit]
[-] asyncore.py
[edit]
[-] tokenize.py
[edit]
[+]
encodings
[-] io.py
[edit]
[-] smtpd.py
[edit]
[-] sysconfig.py
[edit]
[-] decimal.py
[edit]
[+]
sqlite3
[-] rlcompleter.py
[edit]
[-] ntpath.py
[edit]
[+]
test
[-] weakref.py
[edit]
[-] symbol.py
[edit]
[-] modulefinder.py
[edit]
[+]
xmlrpc
[-] bz2.py
[edit]
[-] gettext.py
[edit]
[-] mailbox.py
[edit]
[+]
html