golden hour
/opt/alt/python311/lib64/python3.11
⬆️ Go Up
Upload
File/Folder
Size
Actions
LICENSE.txt
13.61 KB
Del
OK
__future__.py
5.1 KB
Del
OK
__hello__.py
227 B
Del
OK
__pycache__
-
Del
OK
_aix_support.py
3.31 KB
Del
OK
_bootsubprocess.py
2.61 KB
Del
OK
_collections_abc.py
29.49 KB
Del
OK
_compat_pickle.py
8.56 KB
Del
OK
_compression.py
5.55 KB
Del
OK
_markupbase.py
14.31 KB
Del
OK
_osx_support.py
21.51 KB
Del
OK
_py_abc.py
6.04 KB
Del
OK
_pydecimal.py
223.83 KB
Del
OK
_pyio.py
91.99 KB
Del
OK
_sitebuiltins.py
3.05 KB
Del
OK
_strptime.py
24.58 KB
Del
OK
_sysconfigdata__linux_x86_64-linux-gnu.py
57.93 KB
Del
OK
_sysconfigdata_d_linux_x86_64-linux-gnu.py
57.16 KB
Del
OK
_threading_local.py
7.05 KB
Del
OK
_weakrefset.py
5.75 KB
Del
OK
abc.py
6.38 KB
Del
OK
aifc.py
33.41 KB
Del
OK
antigravity.py
500 B
Del
OK
argparse.py
97.93 KB
Del
OK
ast.py
60 KB
Del
OK
asynchat.py
11.3 KB
Del
OK
asyncio
-
Del
OK
asyncore.py
19.83 KB
Del
OK
base64.py
20.55 KB
Del
OK
bdb.py
31.7 KB
Del
OK
bisect.py
3.06 KB
Del
OK
bz2.py
11.57 KB
Del
OK
cProfile.py
6.21 KB
Del
OK
calendar.py
24.15 KB
Del
OK
cgi.py
33.63 KB
Del
OK
cgitb.py
12.13 KB
Del
OK
chunk.py
5.37 KB
Del
OK
cmd.py
14.52 KB
Del
OK
code.py
10.37 KB
Del
OK
codecs.py
36.28 KB
Del
OK
codeop.py
5.77 KB
Del
OK
collections
-
Del
OK
colorsys.py
3.97 KB
Del
OK
compileall.py
19.78 KB
Del
OK
concurrent
-
Del
OK
config-3.11-x86_64-linux-gnu
-
Del
OK
configparser.py
54.36 KB
Del
OK
contextlib.py
26.77 KB
Del
OK
contextvars.py
129 B
Del
OK
copy.py
8.48 KB
Del
OK
copyreg.py
7.5 KB
Del
OK
crypt.py
3.82 KB
Del
OK
csv.py
15.65 KB
Del
OK
ctypes
-
Del
OK
curses
-
Del
OK
dataclasses.py
57.1 KB
Del
OK
datetime.py
89.68 KB
Del
OK
dbm
-
Del
OK
decimal.py
320 B
Del
OK
difflib.py
81.36 KB
Del
OK
dis.py
28.23 KB
Del
OK
distutils
-
Del
OK
doctest.py
103.81 KB
Del
OK
email
-
Del
OK
encodings
-
Del
OK
ensurepip
-
Del
OK
enum.py
77.72 KB
Del
OK
filecmp.py
9.94 KB
Del
OK
fileinput.py
15.35 KB
Del
OK
fnmatch.py
5.86 KB
Del
OK
fractions.py
28 KB
Del
OK
ftplib.py
34.98 KB
Del
OK
functools.py
37.51 KB
Del
OK
genericpath.py
5.12 KB
Del
OK
getopt.py
7.31 KB
Del
OK
getpass.py
5.85 KB
Del
OK
gettext.py
20.82 KB
Del
OK
glob.py
8.53 KB
Del
OK
graphlib.py
9.43 KB
Del
OK
gzip.py
23.51 KB
Del
OK
hashlib.py
11.49 KB
Del
OK
heapq.py
22.48 KB
Del
OK
hmac.py
7.54 KB
Del
OK
html
-
Del
OK
http
-
Del
OK
imaplib.py
53.92 KB
Del
OK
imghdr.py
3.86 KB
Del
OK
imp.py
10.36 KB
Del
OK
importlib
-
Del
OK
inspect.py
120.53 KB
Del
OK
io.py
4.22 KB
Del
OK
ipaddress.py
79.51 KB
Del
OK
json
-
Del
OK
keyword.py
1.04 KB
Del
OK
lib-dynload
-
Del
OK
lib2to3
-
Del
OK
linecache.py
5.52 KB
Del
OK
locale.py
77.24 KB
Del
OK
logging
-
Del
OK
lzma.py
12.97 KB
Del
OK
mailbox.py
76.98 KB
Del
OK
mailcap.py
9.15 KB
Del
OK
mimetypes.py
22.42 KB
Del
OK
modulefinder.py
23.14 KB
Del
OK
multiprocessing
-
Del
OK
netrc.py
6.77 KB
Del
OK
nntplib.py
40.12 KB
Del
OK
ntpath.py
28.09 KB
Del
OK
nturl2path.py
2.82 KB
Del
OK
numbers.py
10.11 KB
Del
OK
opcode.py
10.2 KB
Del
OK
operator.py
10.71 KB
Del
OK
optparse.py
58.95 KB
Del
OK
os.py
38.6 KB
Del
OK
pathlib.py
47.43 KB
Del
OK
pdb.py
62.68 KB
Del
OK
pickle.py
63.61 KB
Del
OK
pickletools.py
91.66 KB
Del
OK
pipes.py
8.77 KB
Del
OK
pkgutil.py
24.06 KB
Del
OK
platform.py
41.3 KB
Del
OK
plistlib.py
27.92 KB
Del
OK
poplib.py
14.84 KB
Del
OK
posixpath.py
16.67 KB
Del
OK
pprint.py
24.01 KB
Del
OK
profile.py
22.36 KB
Del
OK
pstats.py
28.67 KB
Del
OK
pty.py
6.17 KB
Del
OK
py_compile.py
7.65 KB
Del
OK
pyclbr.py
11.13 KB
Del
OK
pydoc.py
110.02 KB
Del
OK
pydoc_data
-
Del
OK
queue.py
11.23 KB
Del
OK
quopri.py
7.11 KB
Del
OK
random.py
31.41 KB
Del
OK
re
-
Del
OK
reprlib.py
5.31 KB
Del
OK
rlcompleter.py
7.64 KB
Del
OK
runpy.py
12.85 KB
Del
OK
sched.py
6.2 KB
Del
OK
secrets.py
1.98 KB
Del
OK
selectors.py
19.21 KB
Del
OK
shelve.py
8.36 KB
Del
OK
shlex.py
13.18 KB
Del
OK
shutil.py
55.19 KB
Del
OK
signal.py
2.44 KB
Del
OK
site-packages
-
Del
OK
site.py
22.45 KB
Del
OK
smtpd.py
30.44 KB
Del
OK
smtplib.py
44.37 KB
Del
OK
sndhdr.py
7.27 KB
Del
OK
socket.py
36.68 KB
Del
OK
socketserver.py
26.94 KB
Del
OK
sqlite3
-
Del
OK
sre_compile.py
231 B
Del
OK
sre_constants.py
232 B
Del
OK
sre_parse.py
229 B
Del
OK
ssl.py
53.03 KB
Del
OK
stat.py
5.36 KB
Del
OK
statistics.py
46.59 KB
Del
OK
string.py
11.51 KB
Del
OK
stringprep.py
12.61 KB
Del
OK
struct.py
257 B
Del
OK
subprocess.py
86.65 KB
Del
OK
sunau.py
18.05 KB
Del
OK
symtable.py
10.13 KB
Del
OK
sysconfig.py
29.6 KB
Del
OK
tabnanny.py
11.05 KB
Del
OK
tarfile.py
109.33 KB
Del
OK
telnetlib.py
22.75 KB
Del
OK
tempfile.py
31.13 KB
Del
OK
textwrap.py
19.26 KB
Del
OK
this.py
1003 B
Del
OK
threading.py
56.87 KB
Del
OK
timeit.py
13.21 KB
Del
OK
token.py
2.33 KB
Del
OK
tokenize.py
25.72 KB
Del
OK
tomllib
-
Del
OK
trace.py
28.51 KB
Del
OK
traceback.py
39.6 KB
Del
OK
tracemalloc.py
17.62 KB
Del
OK
tty.py
879 B
Del
OK
types.py
9.83 KB
Del
OK
typing.py
118.12 KB
Del
OK
unittest
-
Del
OK
urllib
-
Del
OK
uu.py
7.17 KB
Del
OK
uuid.py
26.95 KB
Del
OK
venv
-
Del
OK
warnings.py
20.62 KB
Del
OK
wave.py
21.31 KB
Del
OK
weakref.py
21.01 KB
Del
OK
webbrowser.py
24.56 KB
Del
OK
wsgiref
-
Del
OK
xdrlib.py
5.84 KB
Del
OK
xml
-
Del
OK
xmlrpc
-
Del
OK
zipapp.py
7.36 KB
Del
OK
zipfile.py
92.23 KB
Del
OK
zipimport.py
30.17 KB
Del
OK
zoneinfo
-
Del
OK
Edit: pty.py
"""Pseudo terminal utilities.""" # Bugs: No signal handling. Doesn't set slave termios and window size. # Only tested on Linux, FreeBSD, and macOS. # See: W. Richard Stevens. 1992. Advanced Programming in the # UNIX Environment. Chapter 19. # Author: Steen Lumholt -- with additions by Guido. from select import select import os import sys import tty # names imported directly for test mocking purposes from os import close, waitpid from tty import setraw, tcgetattr, tcsetattr __all__ = ["openpty", "fork", "spawn"] STDIN_FILENO = 0 STDOUT_FILENO = 1 STDERR_FILENO = 2 CHILD = 0 def openpty(): """openpty() -> (master_fd, slave_fd) Open a pty master/slave pair, using os.openpty() if possible.""" try: return os.openpty() except (AttributeError, OSError): pass master_fd, slave_name = _open_terminal() slave_fd = slave_open(slave_name) return master_fd, slave_fd def master_open(): """master_open() -> (master_fd, slave_name) Open a pty master and return the fd, and the filename of the slave end. Deprecated, use openpty() instead.""" try: master_fd, slave_fd = os.openpty() except (AttributeError, OSError): pass else: slave_name = os.ttyname(slave_fd) os.close(slave_fd) return master_fd, slave_name return _open_terminal() def _open_terminal(): """Open pty master and return (master_fd, tty_name).""" for x in 'pqrstuvwxyzPQRST': for y in '0123456789abcdef': pty_name = '/dev/pty' + x + y try: fd = os.open(pty_name, os.O_RDWR) except OSError: continue return (fd, '/dev/tty' + x + y) raise OSError('out of pty devices') def slave_open(tty_name): """slave_open(tty_name) -> slave_fd Open the pty slave and acquire the controlling terminal, returning opened filedescriptor. Deprecated, use openpty() instead.""" result = os.open(tty_name, os.O_RDWR) try: from fcntl import ioctl, I_PUSH except ImportError: return result try: ioctl(result, I_PUSH, "ptem") ioctl(result, I_PUSH, "ldterm") except OSError: pass return result def fork(): """fork() -> (pid, master_fd) Fork and make the child a session leader with a controlling terminal.""" try: pid, fd = os.forkpty() except (AttributeError, OSError): pass else: if pid == CHILD: try: os.setsid() except OSError: # os.forkpty() already set us session leader pass return pid, fd master_fd, slave_fd = openpty() pid = os.fork() if pid == CHILD: # Establish a new session. os.setsid() os.close(master_fd) # Slave becomes stdin/stdout/stderr of child. os.dup2(slave_fd, STDIN_FILENO) os.dup2(slave_fd, STDOUT_FILENO) os.dup2(slave_fd, STDERR_FILENO) if slave_fd > STDERR_FILENO: os.close(slave_fd) # Explicitly open the tty to make it become a controlling tty. tmp_fd = os.open(os.ttyname(STDOUT_FILENO), os.O_RDWR) os.close(tmp_fd) else: os.close(slave_fd) # Parent and child process. return pid, master_fd def _read(fd): """Default read function.""" return os.read(fd, 1024) def _copy(master_fd, master_read=_read, stdin_read=_read): """Parent copy loop. Copies pty master -> standard output (master_read) standard input -> pty master (stdin_read)""" if os.get_blocking(master_fd): # If we write more than tty/ndisc is willing to buffer, we may block # indefinitely. So we set master_fd to non-blocking temporarily during # the copy operation. os.set_blocking(master_fd, False) try: _copy(master_fd, master_read=master_read, stdin_read=stdin_read) finally: # restore blocking mode for backwards compatibility os.set_blocking(master_fd, True) return high_waterlevel = 4096 stdin_avail = master_fd != STDIN_FILENO stdout_avail = master_fd != STDOUT_FILENO i_buf = b'' o_buf = b'' while 1: rfds = [] wfds = [] if stdin_avail and len(i_buf) < high_waterlevel: rfds.append(STDIN_FILENO) if stdout_avail and len(o_buf) < high_waterlevel: rfds.append(master_fd) if stdout_avail and len(o_buf) > 0: wfds.append(STDOUT_FILENO) if len(i_buf) > 0: wfds.append(master_fd) rfds, wfds, _xfds = select(rfds, wfds, []) if STDOUT_FILENO in wfds: try: n = os.write(STDOUT_FILENO, o_buf) o_buf = o_buf[n:] except OSError: stdout_avail = False if master_fd in rfds: # Some OSes signal EOF by returning an empty byte string, # some throw OSErrors. try: data = master_read(master_fd) except OSError: data = b"" if not data: # Reached EOF. return # Assume the child process has exited and is # unreachable, so we clean up. o_buf += data if master_fd in wfds: n = os.write(master_fd, i_buf) i_buf = i_buf[n:] if stdin_avail and STDIN_FILENO in rfds: data = stdin_read(STDIN_FILENO) if not data: stdin_avail = False else: i_buf += data def spawn(argv, master_read=_read, stdin_read=_read): """Create a spawned process.""" if type(argv) == type(''): argv = (argv,) sys.audit('pty.spawn', argv) pid, master_fd = fork() if pid == CHILD: os.execlp(argv[0], *argv) try: mode = tcgetattr(STDIN_FILENO) setraw(STDIN_FILENO) restore = True except tty.error: # This is the same as termios.error restore = False try: _copy(master_fd, master_read, stdin_read) finally: if restore: tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode) close(master_fd) return waitpid(pid, 0)[1]
Save