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 -*-
import os
import builtins
import sys
import codecs
from urllib.parse import quote
@ -190,79 +191,12 @@ def initEnv():
g.current_fileno = current_fileno
g.get_config_value = get_config_value
g.get_definition = get_definition
set_builtins()
def set_builtins():
all_f="""abs
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"""
all_builtins = [ i for i in dir(builtins) if not i.startswith('_')]
g = ServerEnv()
for l in all_f.aplit('\n'):
if l != '':
g[l] = l
gg = globals()
for l in all_builtins:
exec(f'g["{l}"] = {l}',{'g':g})
print(f'{g.sorted=}, {sorted=}, globalEnv.py')