Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if pargs.pyservoce_version:
print(zencad.version.__pyservoce_version__)
sys.exit(0)
if pargs.debug:
zencad.configure.verbose(True)
if pargs.info:
zencad.configure.info(True)
if pargs.no_sleeped:
zencad.configure.CONFIGURE_SLEEPED_OPTIMIZATION = False
if pargs.no_cache:
zencad.configure.CONFIGURE_DISABLE_LAZY=True
zencad.lazifier.disable_lazy()
if pargs.no_screen:
zencad.configure.CONFIGURE_SCREEN_SAVER_TRANSLATE = False
if pargs.debugcomm:
zencad.configure.CONFIGURE_PRINT_COMMUNICATION_DUMP = True
if pargs.no_evalcache_notify:
zencad.configure.CONFIGURE_WITHOUT_EVALCACHE_NOTIFIES = True
if pargs.no_embed:
zencad.configure.CONFIGURE_NO_EMBEDING_WINDOWS = True
if pargs.no_restore:
zencad.configure.CONFIGURE_NO_RESTORE = True
if pargs.module != "zencad":
print("module opt is not equal 'zencad'")
if pargs.version:
print(zencad.version.__version__)
sys.exit(0)
if pargs.pyservoce_version:
print(zencad.version.__pyservoce_version__)
sys.exit(0)
if pargs.debug:
zencad.configure.verbose(True)
if pargs.info:
zencad.configure.info(True)
if pargs.no_sleeped:
zencad.configure.CONFIGURE_SLEEPED_OPTIMIZATION = False
if pargs.no_cache:
zencad.configure.CONFIGURE_DISABLE_LAZY=True
zencad.lazifier.disable_lazy()
if pargs.no_screen:
zencad.configure.CONFIGURE_SCREEN_SAVER_TRANSLATE = False
if pargs.debugcomm:
zencad.configure.CONFIGURE_PRINT_COMMUNICATION_DUMP = True
if pargs.no_evalcache_notify:
zencad.configure.CONFIGURE_WITHOUT_EVALCACHE_NOTIFIES = True
if pargs.no_sleeped:
zencad.configure.CONFIGURE_SLEEPED_OPTIMIZATION = False
if pargs.no_cache:
zencad.configure.CONFIGURE_DISABLE_LAZY=True
zencad.lazifier.disable_lazy()
if pargs.no_screen:
zencad.configure.CONFIGURE_SCREEN_SAVER_TRANSLATE = False
if pargs.debugcomm:
zencad.configure.CONFIGURE_PRINT_COMMUNICATION_DUMP = True
if pargs.no_evalcache_notify:
zencad.configure.CONFIGURE_WITHOUT_EVALCACHE_NOTIFIES = True
if pargs.no_embed:
zencad.configure.CONFIGURE_NO_EMBEDING_WINDOWS = True
if pargs.no_restore:
zencad.configure.CONFIGURE_NO_RESTORE = True
trace(f"__MAIN__ ({os.getpid()})", sys.argv)
trace(pargs)
if pargs.mpath:
print(zencad.moduledir)
return
pargs.nodaemon = True
def send(self, obj):
if zencad.configure.CONFIGURE_COMMUNICATOR_TRACE:
strobj = str(obj)
if len(strobj) > 100: strobj=strobj[:101]
print_to_stderr("communicator send to {}: {}".format(self.subproc_pid(), strobj))
sendstr_bytes = base64.b64encode(pickle.dumps(obj)) + b"\n"
sendstr = sendstr_bytes.decode("utf-8")
try:
self.ofile.write(sendstr)
self.ofile.flush()
if zencad.configure.CONFIGURE_PRINT_COMMUNICATION_DUMP:
print_to_stderr(f"Send: pipe:{self.ofile} recver:{self.subproc_pid()} len:{len(sendstr)} dump50:{[sendstr[:50]]}")
print_to_stderr(f"Send: pipe:{self.ofile} recver:{self.subproc_pid()} unpickle:{obj}")
return True
except Exception as ex:
if zencad.configure.CONFIGURE_COMMUNICATOR_TRACE:
if pargs.no_cache:
zencad.configure.CONFIGURE_DISABLE_LAZY=True
zencad.lazifier.disable_lazy()
if pargs.no_screen:
zencad.configure.CONFIGURE_SCREEN_SAVER_TRANSLATE = False
if pargs.debugcomm:
zencad.configure.CONFIGURE_PRINT_COMMUNICATION_DUMP = True
if pargs.no_evalcache_notify:
zencad.configure.CONFIGURE_WITHOUT_EVALCACHE_NOTIFIES = True
if pargs.no_embed:
zencad.configure.CONFIGURE_NO_EMBEDING_WINDOWS = True
if pargs.no_restore:
zencad.configure.CONFIGURE_NO_RESTORE = True
trace(f"__MAIN__ ({os.getpid()})", sys.argv)
trace(pargs)
if pargs.mpath:
print(zencad.moduledir)
return
pargs.nodaemon = True
# Подчинённый режим работы gui.
# Используется при создании gui из в ходе работы интерпретатора.
if pargs.info:
zencad.configure.info(True)
if pargs.no_sleeped:
zencad.configure.CONFIGURE_SLEEPED_OPTIMIZATION = False
if pargs.no_cache:
zencad.configure.CONFIGURE_DISABLE_LAZY=True
zencad.lazifier.disable_lazy()
if pargs.no_screen:
zencad.configure.CONFIGURE_SCREEN_SAVER_TRANSLATE = False
if pargs.debugcomm:
zencad.configure.CONFIGURE_PRINT_COMMUNICATION_DUMP = True
if pargs.no_evalcache_notify:
zencad.configure.CONFIGURE_WITHOUT_EVALCACHE_NOTIFIES = True
if pargs.no_embed:
zencad.configure.CONFIGURE_NO_EMBEDING_WINDOWS = True
if pargs.no_restore:
zencad.configure.CONFIGURE_NO_RESTORE = True
trace(f"__MAIN__ ({os.getpid()})", sys.argv)
trace(pargs)
if pargs.mpath:
print(zencad.moduledir)
def restore_default_lazyopts():
lazy.cache = evalcache.dircache_v2.DirCache_v2(cachepath)
if zencad.configure.CONFIGURE_DISABLE_LAZY:
lazy.encache = False
lazy.decache = False
lazy.diag = False
lazy.diag_values = False
lazy.print_invokes = False
else:
lazy.encache = True
lazy.decache = True
lazy.diag = False
lazy.diag_values = False
lazy.print_invokes = False
if pargs.debug:
zencad.configure.verbose(True)
if pargs.info:
zencad.configure.info(True)
if pargs.no_sleeped:
zencad.configure.CONFIGURE_SLEEPED_OPTIMIZATION = False
if pargs.no_cache:
zencad.configure.CONFIGURE_DISABLE_LAZY=True
zencad.lazifier.disable_lazy()
if pargs.no_screen:
zencad.configure.CONFIGURE_SCREEN_SAVER_TRANSLATE = False
if pargs.debugcomm:
zencad.configure.CONFIGURE_PRINT_COMMUNICATION_DUMP = True
if pargs.no_evalcache_notify:
zencad.configure.CONFIGURE_WITHOUT_EVALCACHE_NOTIFIES = True
if pargs.no_embed:
zencad.configure.CONFIGURE_NO_EMBEDING_WINDOWS = True
if pargs.no_restore:
zencad.configure.CONFIGURE_NO_RESTORE = True
trace(f"__MAIN__ ({os.getpid()})", sys.argv)
trace(pargs)
def trace(*args):
if zencad.configure.CONFIGURE_MAINWINDOW_TRACE:
print_to_stderr("MAINWINDOW:", *args)
zencad.lazifier.disable_lazy()
if pargs.no_screen:
zencad.configure.CONFIGURE_SCREEN_SAVER_TRANSLATE = False
if pargs.debugcomm:
zencad.configure.CONFIGURE_PRINT_COMMUNICATION_DUMP = True
if pargs.no_evalcache_notify:
zencad.configure.CONFIGURE_WITHOUT_EVALCACHE_NOTIFIES = True
if pargs.no_embed:
zencad.configure.CONFIGURE_NO_EMBEDING_WINDOWS = True
if pargs.no_restore:
zencad.configure.CONFIGURE_NO_RESTORE = True
trace(f"__MAIN__ ({os.getpid()})", sys.argv)
trace(pargs)
if pargs.mpath:
print(zencad.moduledir)
return
pargs.nodaemon = True
# Подчинённый режим работы gui.
# Используется при создании gui из в ходе работы интерпретатора.
if pargs.subproc:
if pargs.tgtpath == None:
print_to_stderr("Error: subproc mode without tgtpath")