This commit is contained in:
yumoqing 2024-04-10 14:53:03 +08:00
parent fb309002ca
commit 5f00823b3c

View File

@ -1,5 +1,6 @@
# -*- coding:utf8 -*- # -*- coding:utf8 -*-
import os import os
import builtins
import sys import sys
import codecs import codecs
from urllib.parse import quote from urllib.parse import quote
@ -190,79 +191,12 @@ def initEnv():
g.current_fileno = current_fileno g.current_fileno = current_fileno
g.get_config_value = get_config_value g.get_config_value = get_config_value
g.get_definition = get_definition g.get_definition = get_definition
set_builtins()
def set_builtins(): def set_builtins():
all_f="""abs all_builtins = [ i for i in dir(builtins) if not i.startswith('_')]
aiter
all
anext
any
ascii
bin
bool
breakpoint
bytearray
bytes
callable
chr
classmethod
compile
complex
delattr
dict
dir
divmod
enumerate
eval
exec
filter
float
format
frozenset
getattr
globals
hasattr
hash
help
hex
id
input
int
isinstance
issubclass
iter
len
list
locals
map
max
memoryview
min
next
object
oct
open
ord
pow
print
property
range
repr
reversed
round
set
setattr
slice
sorted
staticmethod
str
sum
super
tuple
type
vars
zip"""
g = ServerEnv() g = ServerEnv()
for l in all_f.aplit('\n'): gg = globals()
if l != '': for l in all_builtins:
g[l] = l exec(f'g["{l}"] = {l}',{'g':g})
print(f'{g.sorted=}, {sorted=}, globalEnv.py')