ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- lib64/python3.8/asyncio/__main__.py000064400000006417152343612440013011 0ustar00import ast import asyncio import code import concurrent.futures import inspect import sys import threading import types import warnings from . import futures class AsyncIOInteractiveConsole(code.InteractiveConsole): def __init__(self, locals, loop): super().__init__(locals) self.compile.compiler.flags |= ast.PyCF_ALLOW_TOP_LEVEL_AWAIT self.loop = loop def runcode(self, code): future = concurrent.futures.Future() def callback(): global repl_future global repl_future_interrupted repl_future = None repl_future_interrupted = False func = types.FunctionType(code, self.locals) try: coro = func() except SystemExit: raise except KeyboardInterrupt as ex: repl_future_interrupted = True future.set_exception(ex) return except BaseException as ex: future.set_exception(ex) return if not inspect.iscoroutine(coro): future.set_result(coro) return try: repl_future = self.loop.create_task(coro) futures._chain_future(repl_future, future) except BaseException as exc: future.set_exception(exc) loop.call_soon_threadsafe(callback) try: return future.result() except SystemExit: raise except BaseException: if repl_future_interrupted: self.write("\nKeyboardInterrupt\n") else: self.showtraceback() class REPLThread(threading.Thread): def run(self): try: banner = ( f'asyncio REPL {sys.version} on {sys.platform}\n' f'Use "await" directly instead of "asyncio.run()".\n' f'Type "help", "copyright", "credits" or "license" ' f'for more information.\n' f'{getattr(sys, "ps1", ">>> ")}import asyncio' ) console.interact( banner=banner, exitmsg='exiting asyncio REPL...') finally: warnings.filterwarnings( 'ignore', message=r'^coroutine .* was never awaited$', category=RuntimeWarning) loop.call_soon_threadsafe(loop.stop) if __name__ == '__main__': loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) repl_locals = {'asyncio': asyncio} for key in {'__name__', '__package__', '__loader__', '__spec__', '__builtins__', '__file__'}: repl_locals[key] = locals()[key] console = AsyncIOInteractiveConsole(repl_locals, loop) repl_future = None repl_future_interrupted = False try: import readline # NoQA except ImportError: pass repl_thread = REPLThread() repl_thread.daemon = True repl_thread.start() while True: try: loop.run_forever() except KeyboardInterrupt: if repl_future and not repl_future.done(): repl_future.cancel() repl_future_interrupted = True continue else: break lib64/python3.8/venv/__main__.py000064400000000221152344452500012305 0ustar00import sys from . import main rc = 1 try: main() rc = 0 except Exception as e: print('Error: %s' % e, file=sys.stderr) sys.exit(rc) lib64/python3.6/venv/__main__.py000064400000000221152344557470012317 0ustar00import sys from . import main rc = 1 try: main() rc = 0 except Exception as e: print('Error: %s' % e, file=sys.stderr) sys.exit(rc) lib64/python3.8/ensurepip/__main__.py000064400000000130152345564550013352 0ustar00import ensurepip import sys if __name__ == "__main__": sys.exit(ensurepip._main()) lib64/python3.12/venv/__main__.py000064400000000221152345566660012376 0ustar00import sys from . import main rc = 1 try: main() rc = 0 except Exception as e: print('Error: %s' % e, file=sys.stderr) sys.exit(rc) usr/lib64/python3.6/ensurepip/__main__.py000064400000000130152345604740014155 0ustar00import ensurepip import sys if __name__ == "__main__": sys.exit(ensurepip._main()) lib64/python3.6/unittest/__main__.py000064400000000745152345646550013232 0ustar00"""Main entry point""" import sys if sys.argv[0].endswith("__main__.py"): import os.path # We change sys.argv[0] to make help message more useful # use executable without path, unquoted # (it's just a hint anyway) # (if you have spaces in your executable you get what you deserve!) executable = os.path.basename(sys.executable) sys.argv[0] = executable + " -m unittest" del os __unittest = True from .main import main, TestProgram main(module=None) usr/lib64/python3.12/asyncio/__main__.py000064400000006643152345707120013700 0ustar00import ast import asyncio import code import concurrent.futures import contextvars import inspect import sys import threading import types import warnings from . import futures class AsyncIOInteractiveConsole(code.InteractiveConsole): def __init__(self, locals, loop): super().__init__(locals) self.compile.compiler.flags |= ast.PyCF_ALLOW_TOP_LEVEL_AWAIT self.loop = loop self.context = contextvars.copy_context() def runcode(self, code): future = concurrent.futures.Future() def callback(): global repl_future global repl_future_interrupted repl_future = None repl_future_interrupted = False func = types.FunctionType(code, self.locals) try: coro = func() except SystemExit: raise except KeyboardInterrupt as ex: repl_future_interrupted = True future.set_exception(ex) return except BaseException as ex: future.set_exception(ex) return if not inspect.iscoroutine(coro): future.set_result(coro) return try: repl_future = self.loop.create_task(coro, context=self.context) futures._chain_future(repl_future, future) except BaseException as exc: future.set_exception(exc) loop.call_soon_threadsafe(callback, context=self.context) try: return future.result() except SystemExit: raise except BaseException: if repl_future_interrupted: self.write("\nKeyboardInterrupt\n") else: self.showtraceback() class REPLThread(threading.Thread): def run(self): try: banner = ( f'asyncio REPL {sys.version} on {sys.platform}\n' f'Use "await" directly instead of "asyncio.run()".\n' f'Type "help", "copyright", "credits" or "license" ' f'for more information.\n' f'{getattr(sys, "ps1", ">>> ")}import asyncio' ) console.interact( banner=banner, exitmsg='exiting asyncio REPL...') finally: warnings.filterwarnings( 'ignore', message=r'^coroutine .* was never awaited$', category=RuntimeWarning) loop.call_soon_threadsafe(loop.stop) if __name__ == '__main__': sys.audit("cpython.run_stdin") loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) repl_locals = {'asyncio': asyncio} for key in {'__name__', '__package__', '__loader__', '__spec__', '__builtins__', '__file__'}: repl_locals[key] = locals()[key] console = AsyncIOInteractiveConsole(repl_locals, loop) repl_future = None repl_future_interrupted = False try: import readline # NoQA except ImportError: pass repl_thread = REPLThread() repl_thread.daemon = True repl_thread.start() while True: try: loop.run_forever() except KeyboardInterrupt: if repl_future and not repl_future.done(): repl_future.cancel() repl_future_interrupted = True continue else: break usr/lib64/python3.8/unittest/__main__.py000064400000000730152345711340014025 0ustar00"""Main entry point""" import sys if sys.argv[0].endswith("__main__.py"): import os.path # We change sys.argv[0] to make help message more useful # use executable without path, unquoted # (it's just a hint anyway) # (if you have spaces in your executable you get what you deserve!) executable = os.path.basename(sys.executable) sys.argv[0] = executable + " -m unittest" del os __unittest = True from .main import main main(module=None) lib64/python3.8/unittest/__main__.py000064400000000730152345723710013220 0ustar00"""Main entry point""" import sys if sys.argv[0].endswith("__main__.py"): import os.path # We change sys.argv[0] to make help message more useful # use executable without path, unquoted # (it's just a hint anyway) # (if you have spaces in your executable you get what you deserve!) executable = os.path.basename(sys.executable) sys.argv[0] = executable + " -m unittest" del os __unittest = True from .main import main main(module=None) usr/lib64/python2.7/unittest/__main__.py000064400000000356152346117530014031 0ustar00"""Main entry point""" import sys if sys.argv[0].endswith("__main__.py"): sys.argv[0] = "python -m unittest" __unittest = True from .main import main, TestProgram, USAGE_AS_MAIN TestProgram.USAGE = USAGE_AS_MAIN main(module=None) lib64/python2.7/lib2to3/__main__.py000064400000000103152346147700012607 0ustar00import sys from .main import main sys.exit(main("lib2to3.fixes")) usr/lib64/python3.12/venv/__main__.py000064400000000221152346212450013171 0ustar00import sys from . import main rc = 1 try: main() rc = 0 except Exception as e: print('Error: %s' % e, file=sys.stderr) sys.exit(rc) lib64/python3.12/zipfile/__main__.py000064400000000072152346236130013051 0ustar00from . import main if __name__ == "__main__": main() lib64/python3.12/ensurepip/__main__.py000064400000000130152346512410013412 0ustar00import ensurepip import sys if __name__ == "__main__": sys.exit(ensurepip._main()) usr/lib64/python3.12/unittest/__main__.py000064400000000730152346726240014106 0ustar00"""Main entry point""" import sys if sys.argv[0].endswith("__main__.py"): import os.path # We change sys.argv[0] to make help message more useful # use executable without path, unquoted # (it's just a hint anyway) # (if you have spaces in your executable you get what you deserve!) executable = os.path.basename(sys.executable) sys.argv[0] = executable + " -m unittest" del os __unittest = True from .main import main main(module=None) usr/lib64/python3.6/lib2to3/__main__.py000064400000000103152347136240013416 0ustar00import sys from .main import main sys.exit(main("lib2to3.fixes")) usr/lib64/python3.12/ensurepip/__main__.py000064400000000130152347246620014233 0ustar00import ensurepip import sys if __name__ == "__main__": sys.exit(ensurepip._main()) usr/lib/python3.6/site-packages/pip/__main__.py000064400000001110152347265660015306 0ustar00from __future__ import absolute_import import os import sys # If we are running from a wheel, add the wheel to sys.path # This allows the usage python pip-*.whl/pip install pip-*.whl if __package__ == '': # __file__ is pip-*.whl/pip/__main__.py # first dirname call strips of '/__main__.py', second strips off '/pip' # Resulting path is the name of the wheel itself # Add that to sys.path so we can import pip path = os.path.dirname(os.path.dirname(__file__)) sys.path.insert(0, path) import pip # noqa if __name__ == '__main__': sys.exit(pip.main()) lib64/python3.12/lib2to3/__main__.py000064400000000103152347547150012670 0ustar00import sys from .main import main sys.exit(main("lib2to3.fixes")) usr/lib/python3.8/site-packages/pip/__main__.py000064400000001164152350141130015274 0ustar00from __future__ import absolute_import import os import sys # If we are running from a wheel, add the wheel to sys.path # This allows the usage python pip-*.whl/pip install pip-*.whl if __package__ == '': # __file__ is pip-*.whl/pip/__main__.py # first dirname call strips of '/__main__.py', second strips off '/pip' # Resulting path is the name of the wheel itself # Add that to sys.path so we can import pip path = os.path.dirname(os.path.dirname(__file__)) sys.path.insert(0, path) from pip._internal.main import main as _main # isort:skip # noqa if __name__ == '__main__': sys.exit(_main()) usr/lib64/python2.7/ensurepip/__main__.py000064400000000130152350146170014147 0ustar00import ensurepip import sys if __name__ == "__main__": sys.exit(ensurepip._main()) lib64/python3.8/tkinter/__main__.py000064400000000224152350171360013011 0ustar00"""Main entry point""" import sys if sys.argv[0].endswith("__main__.py"): sys.argv[0] = "python -m tkinter" from . import _test as main main() lib64/python3.12/asyncio/__main__.py000064400000006643152350754570013076 0ustar00import ast import asyncio import code import concurrent.futures import contextvars import inspect import sys import threading import types import warnings from . import futures class AsyncIOInteractiveConsole(code.InteractiveConsole): def __init__(self, locals, loop): super().__init__(locals) self.compile.compiler.flags |= ast.PyCF_ALLOW_TOP_LEVEL_AWAIT self.loop = loop self.context = contextvars.copy_context() def runcode(self, code): future = concurrent.futures.Future() def callback(): global repl_future global repl_future_interrupted repl_future = None repl_future_interrupted = False func = types.FunctionType(code, self.locals) try: coro = func() except SystemExit: raise except KeyboardInterrupt as ex: repl_future_interrupted = True future.set_exception(ex) return except BaseException as ex: future.set_exception(ex) return if not inspect.iscoroutine(coro): future.set_result(coro) return try: repl_future = self.loop.create_task(coro, context=self.context) futures._chain_future(repl_future, future) except BaseException as exc: future.set_exception(exc) loop.call_soon_threadsafe(callback, context=self.context) try: return future.result() except SystemExit: raise except BaseException: if repl_future_interrupted: self.write("\nKeyboardInterrupt\n") else: self.showtraceback() class REPLThread(threading.Thread): def run(self): try: banner = ( f'asyncio REPL {sys.version} on {sys.platform}\n' f'Use "await" directly instead of "asyncio.run()".\n' f'Type "help", "copyright", "credits" or "license" ' f'for more information.\n' f'{getattr(sys, "ps1", ">>> ")}import asyncio' ) console.interact( banner=banner, exitmsg='exiting asyncio REPL...') finally: warnings.filterwarnings( 'ignore', message=r'^coroutine .* was never awaited$', category=RuntimeWarning) loop.call_soon_threadsafe(loop.stop) if __name__ == '__main__': sys.audit("cpython.run_stdin") loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) repl_locals = {'asyncio': asyncio} for key in {'__name__', '__package__', '__loader__', '__spec__', '__builtins__', '__file__'}: repl_locals[key] = locals()[key] console = AsyncIOInteractiveConsole(repl_locals, loop) repl_future = None repl_future_interrupted = False try: import readline # NoQA except ImportError: pass repl_thread = REPLThread() repl_thread.daemon = True repl_thread.start() while True: try: loop.run_forever() except KeyboardInterrupt: if repl_future and not repl_future.done(): repl_future.cancel() repl_future_interrupted = True continue else: break usr/lib64/python3.8/asyncio/__main__.py000064400000006417152351012420013611 0ustar00import ast import asyncio import code import concurrent.futures import inspect import sys import threading import types import warnings from . import futures class AsyncIOInteractiveConsole(code.InteractiveConsole): def __init__(self, locals, loop): super().__init__(locals) self.compile.compiler.flags |= ast.PyCF_ALLOW_TOP_LEVEL_AWAIT self.loop = loop def runcode(self, code): future = concurrent.futures.Future() def callback(): global repl_future global repl_future_interrupted repl_future = None repl_future_interrupted = False func = types.FunctionType(code, self.locals) try: coro = func() except SystemExit: raise except KeyboardInterrupt as ex: repl_future_interrupted = True future.set_exception(ex) return except BaseException as ex: future.set_exception(ex) return if not inspect.iscoroutine(coro): future.set_result(coro) return try: repl_future = self.loop.create_task(coro) futures._chain_future(repl_future, future) except BaseException as exc: future.set_exception(exc) loop.call_soon_threadsafe(callback) try: return future.result() except SystemExit: raise except BaseException: if repl_future_interrupted: self.write("\nKeyboardInterrupt\n") else: self.showtraceback() class REPLThread(threading.Thread): def run(self): try: banner = ( f'asyncio REPL {sys.version} on {sys.platform}\n' f'Use "await" directly instead of "asyncio.run()".\n' f'Type "help", "copyright", "credits" or "license" ' f'for more information.\n' f'{getattr(sys, "ps1", ">>> ")}import asyncio' ) console.interact( banner=banner, exitmsg='exiting asyncio REPL...') finally: warnings.filterwarnings( 'ignore', message=r'^coroutine .* was never awaited$', category=RuntimeWarning) loop.call_soon_threadsafe(loop.stop) if __name__ == '__main__': loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) repl_locals = {'asyncio': asyncio} for key in {'__name__', '__package__', '__loader__', '__spec__', '__builtins__', '__file__'}: repl_locals[key] = locals()[key] console = AsyncIOInteractiveConsole(repl_locals, loop) repl_future = None repl_future_interrupted = False try: import readline # NoQA except ImportError: pass repl_thread = REPLThread() repl_thread.daemon = True repl_thread.start() while True: try: loop.run_forever() except KeyboardInterrupt: if repl_future and not repl_future.done(): repl_future.cancel() repl_future_interrupted = True continue else: break usr/lib64/python3.8/ensurepip/__main__.py000064400000000130152351235370014153 0ustar00import ensurepip import sys if __name__ == "__main__": sys.exit(ensurepip._main()) usr/lib64/python3.12/lib2to3/__main__.py000064400000000103152351646770013504 0ustar00import sys from .main import main sys.exit(main("lib2to3.fixes")) usr/lib64/python3.8/tkinter/__main__.py000064400000000224152351677740013640 0ustar00"""Main entry point""" import sys if sys.argv[0].endswith("__main__.py"): sys.argv[0] = "python -m tkinter" from . import _test as main main() usr/lib64/python3.12/sqlite3/__main__.py000064400000007417152352006310013606 0ustar00"""A simple SQLite CLI for the sqlite3 module. Apart from using 'argparse' for the command-line interface, this module implements the REPL as a thin wrapper around the InteractiveConsole class from the 'code' stdlib module. """ import sqlite3 import sys from argparse import ArgumentParser from code import InteractiveConsole from textwrap import dedent def execute(c, sql, suppress_errors=True): """Helper that wraps execution of SQL code. This is used both by the REPL and by direct execution from the CLI. 'c' may be a cursor or a connection. 'sql' is the SQL string to execute. """ try: for row in c.execute(sql): print(row) except sqlite3.Error as e: tp = type(e).__name__ try: print(f"{tp} ({e.sqlite_errorname}): {e}", file=sys.stderr) except AttributeError: print(f"{tp}: {e}", file=sys.stderr) if not suppress_errors: sys.exit(1) class SqliteInteractiveConsole(InteractiveConsole): """A simple SQLite REPL.""" def __init__(self, connection): super().__init__() self._con = connection self._cur = connection.cursor() def runsource(self, source, filename="", symbol="single"): """Override runsource, the core of the InteractiveConsole REPL. Return True if more input is needed; buffering is done automatically. Return False is input is a complete statement ready for execution. """ match source: case ".version": print(f"{sqlite3.sqlite_version}") case ".help": print("Enter SQL code and press enter.") case ".quit": sys.exit(0) case _: if not sqlite3.complete_statement(source): return True execute(self._cur, source) return False def main(*args): parser = ArgumentParser( description="Python sqlite3 CLI", prog="python -m sqlite3", ) parser.add_argument( "filename", type=str, default=":memory:", nargs="?", help=( "SQLite database to open (defaults to ':memory:'). " "A new database is created if the file does not previously exist." ), ) parser.add_argument( "sql", type=str, nargs="?", help=( "An SQL query to execute. " "Any returned rows are printed to stdout." ), ) parser.add_argument( "-v", "--version", action="version", version=f"SQLite version {sqlite3.sqlite_version}", help="Print underlying SQLite library version", ) args = parser.parse_args(*args) if args.filename == ":memory:": db_name = "a transient in-memory database" else: db_name = repr(args.filename) # Prepare REPL banner and prompts. if sys.platform == "win32" and "idlelib.run" not in sys.modules: eofkey = "CTRL-Z" else: eofkey = "CTRL-D" banner = dedent(f""" sqlite3 shell, running on SQLite version {sqlite3.sqlite_version} Connected to {db_name} Each command will be run using execute() on the cursor. Type ".help" for more information; type ".quit" or {eofkey} to quit. """).strip() sys.ps1 = "sqlite> " sys.ps2 = " ... " con = sqlite3.connect(args.filename, isolation_level=None) try: if args.sql: # SQL statement provided on the command-line; execute it directly. execute(con, args.sql, suppress_errors=False) else: # No SQL provided; start the REPL. console = SqliteInteractiveConsole(con) console.interact(banner, exitmsg="") finally: con.close() sys.exit(0) if __name__ == "__main__": main(sys.argv[1:]) lib64/python3.12/tkinter/__main__.py000064400000000224152352165160013067 0ustar00"""Main entry point""" import sys if sys.argv[0].endswith("__main__.py"): sys.argv[0] = "python -m tkinter" from . import _test as main main() usr/lib64/python3.12/zipfile/__main__.py000064400000000072152357620300013660 0ustar00from . import main if __name__ == "__main__": main() usr/lib64/python3.6/unittest/__main__.py000064400000000745152357745520014043 0ustar00"""Main entry point""" import sys if sys.argv[0].endswith("__main__.py"): import os.path # We change sys.argv[0] to make help message more useful # use executable without path, unquoted # (it's just a hint anyway) # (if you have spaces in your executable you get what you deserve!) executable = os.path.basename(sys.executable) sys.argv[0] = executable + " -m unittest" del os __unittest = True from .main import main, TestProgram main(module=None) usr/lib64/python3.8/lib2to3/__main__.py000064400000000103152360053060013411 0ustar00import sys from .main import main sys.exit(main("lib2to3.fixes")) lib64/python3.12/sqlite3/__main__.py000064400000007417152360477400013010 0ustar00"""A simple SQLite CLI for the sqlite3 module. Apart from using 'argparse' for the command-line interface, this module implements the REPL as a thin wrapper around the InteractiveConsole class from the 'code' stdlib module. """ import sqlite3 import sys from argparse import ArgumentParser from code import InteractiveConsole from textwrap import dedent def execute(c, sql, suppress_errors=True): """Helper that wraps execution of SQL code. This is used both by the REPL and by direct execution from the CLI. 'c' may be a cursor or a connection. 'sql' is the SQL string to execute. """ try: for row in c.execute(sql): print(row) except sqlite3.Error as e: tp = type(e).__name__ try: print(f"{tp} ({e.sqlite_errorname}): {e}", file=sys.stderr) except AttributeError: print(f"{tp}: {e}", file=sys.stderr) if not suppress_errors: sys.exit(1) class SqliteInteractiveConsole(InteractiveConsole): """A simple SQLite REPL.""" def __init__(self, connection): super().__init__() self._con = connection self._cur = connection.cursor() def runsource(self, source, filename="", symbol="single"): """Override runsource, the core of the InteractiveConsole REPL. Return True if more input is needed; buffering is done automatically. Return False is input is a complete statement ready for execution. """ match source: case ".version": print(f"{sqlite3.sqlite_version}") case ".help": print("Enter SQL code and press enter.") case ".quit": sys.exit(0) case _: if not sqlite3.complete_statement(source): return True execute(self._cur, source) return False def main(*args): parser = ArgumentParser( description="Python sqlite3 CLI", prog="python -m sqlite3", ) parser.add_argument( "filename", type=str, default=":memory:", nargs="?", help=( "SQLite database to open (defaults to ':memory:'). " "A new database is created if the file does not previously exist." ), ) parser.add_argument( "sql", type=str, nargs="?", help=( "An SQL query to execute. " "Any returned rows are printed to stdout." ), ) parser.add_argument( "-v", "--version", action="version", version=f"SQLite version {sqlite3.sqlite_version}", help="Print underlying SQLite library version", ) args = parser.parse_args(*args) if args.filename == ":memory:": db_name = "a transient in-memory database" else: db_name = repr(args.filename) # Prepare REPL banner and prompts. if sys.platform == "win32" and "idlelib.run" not in sys.modules: eofkey = "CTRL-Z" else: eofkey = "CTRL-D" banner = dedent(f""" sqlite3 shell, running on SQLite version {sqlite3.sqlite_version} Connected to {db_name} Each command will be run using execute() on the cursor. Type ".help" for more information; type ".quit" or {eofkey} to quit. """).strip() sys.ps1 = "sqlite> " sys.ps2 = " ... " con = sqlite3.connect(args.filename, isolation_level=None) try: if args.sql: # SQL statement provided on the command-line; execute it directly. execute(con, args.sql, suppress_errors=False) else: # No SQL provided; start the REPL. console = SqliteInteractiveConsole(con) console.interact(banner, exitmsg="") finally: con.close() sys.exit(0) if __name__ == "__main__": main(sys.argv[1:]) lib64/python3.12/unittest/__main__.py000064400000000730152361415360013270 0ustar00"""Main entry point""" import sys if sys.argv[0].endswith("__main__.py"): import os.path # We change sys.argv[0] to make help message more useful # use executable without path, unquoted # (it's just a hint anyway) # (if you have spaces in your executable you get what you deserve!) executable = os.path.basename(sys.executable) sys.argv[0] = executable + " -m unittest" del os __unittest = True from .main import main main(module=None) lib64/python2.7/ensurepip/__main__.py000064400000000130152361425240013336 0ustar00import ensurepip import sys if __name__ == "__main__": sys.exit(ensurepip._main())