"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "modules/pymol/parser.py" between
pymol-open-source-2.2.0.tar.gz and pymol-open-source-2.3.0.tar.gz

About: PyMOL is a Python-enhanced molecular graphics tool. It excels at 3D visualization of proteins, small molecules, density, surfaces, and trajectories. It also includes molecular editing, ray tracing, and movies. Open Source version.

parser.py  (pymol-open-source-2.2.0):parser.py  (pymol-open-source-2.3.0)
skipping to change at line 28 skipping to change at line 28
from __future__ import absolute_import from __future__ import absolute_import
# Don't import __future__.print_function # Don't import __future__.print_function
class SecurityException(Exception): class SecurityException(Exception):
pass pass
SCRIPT_TOPLEVEL = 'toplevel' SCRIPT_TOPLEVEL = 'toplevel'
if __name__=='pymol.parser': if True:
import pymol import pymol
import traceback import traceback
import collections
import re import re
import glob import glob
import sys import sys
import os import os
import __main__
from . import parsing from . import parsing
from . import colorprinting from . import colorprinting
from .cmd import _feedback,fb_module,fb_mask,exp_path from .cmd import _feedback,fb_module,fb_mask,exp_path
QuietException = parsing.QuietException QuietException = parsing.QuietException
CmdException = pymol.CmdException CmdException = pymol.CmdException
py_delims = { '=' : 1, '+=' : 1, '-=' : 1, '*=' : 1, py_delims = { '=' : 1, '+=' : 1, '-=' : 1, '*=' : 1,
'/=' :1, '//=' : 1, '%=' : 1, '&=' : 1, '/=' :1, '//=' : 1, '%=' : 1, '&=' : 1,
skipping to change at line 110 skipping to change at line 110
self.embed_dict = {} self.embed_dict = {}
self.next = [] self.next = []
class Parser: class Parser:
def __init__(self,cmd): def __init__(self,cmd):
cmd = cmd._weakrefproxy cmd = cmd._weakrefproxy
self.cmd = cmd self.cmd = cmd
self.nest = 0 self.nest = 0
self.layer = { 0: NestLayer() } self.layer = collections.defaultdict(NestLayer)
self.pymol_names = self.cmd._pymol.__dict__ self.pymol_names = self.cmd._pymol.__dict__
# parsing state implemented with dictionaries to enable safe recursi on # parsing state implemented with dictionaries to enable safe recursi on
# to arbitrary depths # to arbitrary depths
#com0 = {} # verbose line, as read in #com0 = {} # verbose line, as read in
#com1 = {} # line w/o trailing whitespace #com1 = {} # line w/o trailing whitespace
#com2 = {} # non-compound command #com2 = {} # non-compound command
#cont = {} # continued characters from previous lines (i.e., befo re \ ) #cont = {} # continued characters from previous lines (i.e., befo re \ )
#script = {} # file handles #script = {} # file handles
skipping to change at line 161 skipping to change at line 161
# for meaningful line number in error messages # for meaningful line number in error messages
blanklines = layer.lineno - 1 - s.count('\n') blanklines = layer.lineno - 1 - s.count('\n')
s = '\n' * blanklines + s + '\n' s = '\n' * blanklines + s + '\n'
s = compile(s, layer.sc_path, 'exec') s = compile(s, layer.sc_path, 'exec')
exec(s, self.pymol_names, self.pymol_names) exec(s, self.pymol_names, self.pymol_names)
# main parser routine # main parser routine
def parse(self,s,secure=0): def parse(self,s,secure=0):
layer = self.layer.get(self.nest,None) try:
self.nest += 1
return self._parse(s, secure)
finally:
self.nest -= 1
def _parse(self, s, secure):
layer = self.layer[self.nest]
self.result = None self.result = None
# report any uncaught errors... # report any uncaught errors...
# WLD: this is problematic if parse is called inside an exception...removed. # WLD: this is problematic if parse is called inside an exception...removed.
# if sys.exc_info()!=(None,None,None): # if sys.exc_info()!=(None,None,None):
# traceback.print_exc() # traceback.print_exc()
# sys.exc_clear() # sys.exc_clear()
def parse_embed(): def parse_embed():
if s.strip() == layer.embed_sentinel: if s.strip() == layer.embed_sentinel:
etn = layer.embed_type etn = layer.embed_type
if etn == 0: # embedded data if etn == 0: # embedded data
 End of changes. 5 change blocks. 
4 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)