Changeset 654e8e0 in sasview for src/sas/sascalc/dataloader
- Timestamp:
- Sep 1, 2016 2:36:07 PM (8 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 7b2d6fb
- Parents:
- a3f1c11e
- git-author:
- Jeff Krzywon <krzywon@…> (09/01/16 14:36:07)
- git-committer:
- Jeff KRzywon <krzywon@…> (09/01/16 14:36:07)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/dataloader/readers/cansas_reader.py
r5f26aa4 r654e8e0 62 62 type_name = "canSAS" 63 63 invalid = True 64 frm = "" 64 65 ## Log messages and errors 65 66 logging = None … … 138 139 for entry in entry_list: 139 140 # Create a new DataInfo object for every <SASentry> 140 141 141 142 142 # Set the file name and then parse the entry. … … 183 183 return self.output 184 184 185 def _parse_entry(self, dom ):185 def _parse_entry(self, dom, recurse=False): 186 186 """ 187 187 Parse a SASEntry - new recursive method for parsing the dom of … … 192 192 """ 193 193 194 frm = inspect.stack()[1] 195 if not self._is_call_local(frm): 194 if not self._is_call_local() and not recurse: 196 195 self.reset_state() 197 196 self.add_data_set() … … 201 200 self.base_ns = "{0}{1}{2}".format("{", \ 202 201 CANSAS_NS.get(self.cansas_version).get("ns"), "}") 203 tagname = ''204 tagname_original = ''205 202 206 203 # Go through each child in the parent element … … 225 222 self._initialize_new_data_set() 226 223 ## Recursion step to access data within the group 227 self._parse_entry(node )224 self._parse_entry(node, True) 228 225 if tagname == "SASsample": 229 226 self.current_datainfo.sample.name = name … … 437 434 length = len(self.names) - 1 438 435 self.parent_class = self.names[length] 439 if not self._is_call_local(frm): 436 if not self._is_call_local() and not recurse: 437 self.frm = "" 440 438 self.add_data_set() 441 439 empty = None … … 448 446 449 447 450 def _is_call_local(self , frm=""):451 """ 452 453 :return:454 """455 if frm == "":456 frm = inspect.stack()[1]457 mod_name = frm[1].replace("\\", "/").replace(".pyc", "")448 def _is_call_local(self): 449 """ 450 451 """ 452 if self.frm == "": 453 inter = inspect.stack() 454 self.frm = inter[2] 455 mod_name = self.frm[1].replace("\\", "/").replace(".pyc", "") 458 456 mod_name = mod_name.replace(".py", "") 459 457 mod = mod_name.split("sas/") … … 836 834 # If the calling function was not the cansas reader, return a minidom 837 835 # object rather than an lxml object. 838 frm = inspect.stack()[1]839 doc, entry_node = self._check_origin(entry_node, doc , frm)836 self.frm = inspect.stack()[1] 837 doc, entry_node = self._check_origin(entry_node, doc) 840 838 return doc, entry_node 841 839 … … 1232 1230 self.append(node, entry_node) 1233 1231 1234 def _check_origin(self, entry_node, doc , frm):1232 def _check_origin(self, entry_node, doc): 1235 1233 """ 1236 1234 Return the document, and the SASentry node associated with … … 1242 1240 :param doc: entire xml tree 1243 1241 """ 1244 if not frm:1245 frm = inspect.stack()[1]1246 mod_name = frm[1].replace("\\", "/").replace(".pyc", "")1242 if not self.frm: 1243 self.frm = inspect.stack()[1] 1244 mod_name = self.frm[1].replace("\\", "/").replace(".pyc", "") 1247 1245 mod_name = mod_name.replace(".py", "") 1248 1246 mod = mod_name.split("sas/")
Note: See TracChangeset
for help on using the changeset viewer.