Changeset cc2cd5a in sasview for src/sas/sascalc/dataloader/readers


Ignore:
Timestamp:
Mar 30, 2019 6:15:53 PM (6 years ago)
Author:
GitHub <noreply@…>
Parents:
d4cde37 (diff), 0e0c645 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jeff Krzywon <krzywon@…> (03/30/19 18:15:53)
git-committer:
GitHub <noreply@…> (03/30/19 18:15:53)
Message:

Merge 0e0c645bd0457e2a1f474d1abf25ea989689caf6 into d4cde3775cc19e3e8ac413babb90e5015eb330e7

Location:
src/sas/sascalc/dataloader/readers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/readers/cansas_reader.py

    r8c9e65c rcc2cd5a  
    1717# For saving individual sections of data 
    1818from ..data_info import Data1D, Data2D, DataInfo, plottable_1D, plottable_2D, \ 
    19     Collimation, TransmissionSpectrum, Detector, Process, Aperture, \ 
    20     combine_data_info_with_plottable as combine_data 
     19    Collimation, TransmissionSpectrum, Detector, Process, Aperture 
    2120from ..loader_exceptions import FileContentsException, DefaultReaderException, \ 
    2221    DataReaderException 
    2322from . import xml_reader 
    2423from .xml_reader import XMLreader 
    25 from .cansas_constants import CansasConstants, CurrentLevel 
     24from .cansas_constants import CansasConstants 
    2625 
    2726logger = logging.getLogger(__name__) 
     
    5958    type = ["XML files (*.xml)|*.xml", "SasView Save Files (*.svs)|*.svs"] 
    6059    # List of allowed extensions 
    61     ext = ['.xml', '.XML', '.svs', '.SVS'] 
     60    ext = ['.xml', '.svs'] 
    6261    # Flag to bypass extension check 
    6362    allow_all = True 
     
    8180        self.encoding = None 
    8281 
    83     def read(self, xml_file, schema_path="", invalid=True): 
     82    def _read(self, xml_file, schema_path="", invalid=True): 
    8483        if schema_path != "" or not invalid: 
    8584            # read has been called from self.get_file_contents because xml file doens't conform to schema 
     
    9089        return super(XMLreader, self).read(xml_file) 
    9190 
    92     def get_file_contents(self, xml_file=None, schema_path="", invalid=True): 
     91    def get_file_contents(self): 
     92        return self._get_file_contents(xml_file=None, schema_path="", invalid=True) 
     93 
     94    def _get_file_contents(self, xml_file=None, schema_path="", invalid=True): 
    9395        # Reset everything since we're loading a new file 
    9496        self.reset_state() 
     
    124126                try: 
    125127                    # Load data with less strict schema 
    126                     self.read(xml_file, invalid_schema, False) 
     128                    self._get_file_contents(xml_file, invalid_schema, False) 
    127129 
    128130                    # File can still be read but doesn't match schema, so raise exception 
     
    493495                self.current_datainfo.errors.add(error) 
    494496            self.data_cleanup() 
    495             self.sort_one_d_data() 
    496             self.sort_two_d_data() 
     497            self.sort_data() 
    497498            self.reset_data_list() 
    498499            return self.output[0], None 
  • src/sas/sascalc/dataloader/readers/associations.py

    rc7c8143 r8c9e65c  
    5454                exec("loader.associate_file_type('%s', %s)" 
    5555                     % (ext.upper(), reader)) 
    56             except: 
     56            except Exception as exc: 
    5757                msg = "read_associations: skipping association" 
    58                 msg += " for %s\n  %s" % (ext.lower(), sys.exc_value) 
     58                msg += " for %s\n  %s" % (ext.lower(), exc) 
    5959                logger.error(msg) 
Note: See TracChangeset for help on using the changeset viewer.