devinit.py: MMGenObject -> MMGenObjectDevTools
This commit is contained in:
parent
5682e7f74e
commit
041963d556
2 changed files with 6 additions and 4 deletions
|
|
@ -35,7 +35,7 @@ def MMGenObject_call(methodname,*args,**kwargs):
|
|||
from .devtools import MMGenObjectMethods
|
||||
return getattr(MMGenObjectMethods,methodname)(*args,**kwargs)
|
||||
|
||||
class MMGenObject:
|
||||
class MMGenObjectDevTools:
|
||||
|
||||
pmsg = lambda *args,**kwargs: MMGenObject_call('pmsg',*args,**kwargs)
|
||||
pdie = lambda *args,**kwargs: MMGenObject_call('pdie',*args,**kwargs)
|
||||
|
|
@ -63,6 +63,8 @@ class MMGenObject:
|
|||
|
||||
def init_dev():
|
||||
import builtins
|
||||
setattr(builtins,'MMGenObject',MMGenObject)
|
||||
# MMGenObject is added to the namespace by objmethods.py, so we must name the builtin differently
|
||||
# to avoid inadvertently adding MMGenObject to the global namespace here:
|
||||
setattr(builtins,'MMGenObjectDevTools',MMGenObjectDevTools)
|
||||
for funcname,func in devtools_funcs.items():
|
||||
setattr(builtins,funcname,func)
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ import unicodedata
|
|||
from .globalvars import g
|
||||
import mmgen.color as color_mod
|
||||
|
||||
if 'MMGenObject' in __builtins__: # added to builtins by devinit.init_dev()
|
||||
MMGenObject = __builtins__['MMGenObject']
|
||||
if 'MMGenObjectDevTools' in __builtins__: # added to builtins by devinit.init_dev()
|
||||
MMGenObject = __builtins__['MMGenObjectDevTools']
|
||||
else:
|
||||
class MMGenObject:
|
||||
'placeholder - overridden when testing'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue