Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/smanonr..../lib64/python3..../asyncio
File: __main__.py
import ast
[0] Fix | Delete
import asyncio
[1] Fix | Delete
import code
[2] Fix | Delete
import concurrent.futures
[3] Fix | Delete
import inspect
[4] Fix | Delete
import sys
[5] Fix | Delete
import threading
[6] Fix | Delete
import types
[7] Fix | Delete
import warnings
[8] Fix | Delete
[9] Fix | Delete
from . import futures
[10] Fix | Delete
[11] Fix | Delete
[12] Fix | Delete
class AsyncIOInteractiveConsole(code.InteractiveConsole):
[13] Fix | Delete
[14] Fix | Delete
def __init__(self, locals, loop):
[15] Fix | Delete
super().__init__(locals)
[16] Fix | Delete
self.compile.compiler.flags |= ast.PyCF_ALLOW_TOP_LEVEL_AWAIT
[17] Fix | Delete
[18] Fix | Delete
self.loop = loop
[19] Fix | Delete
[20] Fix | Delete
def runcode(self, code):
[21] Fix | Delete
future = concurrent.futures.Future()
[22] Fix | Delete
[23] Fix | Delete
def callback():
[24] Fix | Delete
global repl_future
[25] Fix | Delete
global repl_future_interrupted
[26] Fix | Delete
[27] Fix | Delete
repl_future = None
[28] Fix | Delete
repl_future_interrupted = False
[29] Fix | Delete
[30] Fix | Delete
func = types.FunctionType(code, self.locals)
[31] Fix | Delete
try:
[32] Fix | Delete
coro = func()
[33] Fix | Delete
except SystemExit:
[34] Fix | Delete
raise
[35] Fix | Delete
except KeyboardInterrupt as ex:
[36] Fix | Delete
repl_future_interrupted = True
[37] Fix | Delete
future.set_exception(ex)
[38] Fix | Delete
return
[39] Fix | Delete
except BaseException as ex:
[40] Fix | Delete
future.set_exception(ex)
[41] Fix | Delete
return
[42] Fix | Delete
[43] Fix | Delete
if not inspect.iscoroutine(coro):
[44] Fix | Delete
future.set_result(coro)
[45] Fix | Delete
return
[46] Fix | Delete
[47] Fix | Delete
try:
[48] Fix | Delete
repl_future = self.loop.create_task(coro)
[49] Fix | Delete
futures._chain_future(repl_future, future)
[50] Fix | Delete
except BaseException as exc:
[51] Fix | Delete
future.set_exception(exc)
[52] Fix | Delete
[53] Fix | Delete
loop.call_soon_threadsafe(callback)
[54] Fix | Delete
[55] Fix | Delete
try:
[56] Fix | Delete
return future.result()
[57] Fix | Delete
except SystemExit:
[58] Fix | Delete
raise
[59] Fix | Delete
except BaseException:
[60] Fix | Delete
if repl_future_interrupted:
[61] Fix | Delete
self.write("\nKeyboardInterrupt\n")
[62] Fix | Delete
else:
[63] Fix | Delete
self.showtraceback()
[64] Fix | Delete
[65] Fix | Delete
[66] Fix | Delete
class REPLThread(threading.Thread):
[67] Fix | Delete
[68] Fix | Delete
def run(self):
[69] Fix | Delete
try:
[70] Fix | Delete
banner = (
[71] Fix | Delete
f'asyncio REPL {sys.version} on {sys.platform}\n'
[72] Fix | Delete
f'Use "await" directly instead of "asyncio.run()".\n'
[73] Fix | Delete
f'Type "help", "copyright", "credits" or "license" '
[74] Fix | Delete
f'for more information.\n'
[75] Fix | Delete
f'{getattr(sys, "ps1", ">>> ")}import asyncio'
[76] Fix | Delete
)
[77] Fix | Delete
[78] Fix | Delete
console.interact(
[79] Fix | Delete
banner=banner,
[80] Fix | Delete
exitmsg='exiting asyncio REPL...')
[81] Fix | Delete
finally:
[82] Fix | Delete
warnings.filterwarnings(
[83] Fix | Delete
'ignore',
[84] Fix | Delete
message=r'^coroutine .* was never awaited$',
[85] Fix | Delete
category=RuntimeWarning)
[86] Fix | Delete
[87] Fix | Delete
loop.call_soon_threadsafe(loop.stop)
[88] Fix | Delete
[89] Fix | Delete
[90] Fix | Delete
if __name__ == '__main__':
[91] Fix | Delete
loop = asyncio.new_event_loop()
[92] Fix | Delete
asyncio.set_event_loop(loop)
[93] Fix | Delete
[94] Fix | Delete
repl_locals = {'asyncio': asyncio}
[95] Fix | Delete
for key in {'__name__', '__package__',
[96] Fix | Delete
'__loader__', '__spec__',
[97] Fix | Delete
'__builtins__', '__file__'}:
[98] Fix | Delete
repl_locals[key] = locals()[key]
[99] Fix | Delete
[100] Fix | Delete
console = AsyncIOInteractiveConsole(repl_locals, loop)
[101] Fix | Delete
[102] Fix | Delete
repl_future = None
[103] Fix | Delete
repl_future_interrupted = False
[104] Fix | Delete
[105] Fix | Delete
try:
[106] Fix | Delete
import readline # NoQA
[107] Fix | Delete
except ImportError:
[108] Fix | Delete
pass
[109] Fix | Delete
[110] Fix | Delete
repl_thread = REPLThread()
[111] Fix | Delete
repl_thread.daemon = True
[112] Fix | Delete
repl_thread.start()
[113] Fix | Delete
[114] Fix | Delete
while True:
[115] Fix | Delete
try:
[116] Fix | Delete
loop.run_forever()
[117] Fix | Delete
except KeyboardInterrupt:
[118] Fix | Delete
if repl_future and not repl_future.done():
[119] Fix | Delete
repl_future.cancel()
[120] Fix | Delete
repl_future_interrupted = True
[121] Fix | Delete
continue
[122] Fix | Delete
else:
[123] Fix | Delete
break
[124] Fix | Delete
[125] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function