Пример #1
0
 def from_file(cls, filename):
     """For historical HST types,  build type info from a spec file derived from CDBS specs like
     reference_file_defs.xml or cdbscatalog.dat.  For new CRDS-only types,  use a prototype rmap
     with an enhanced header to define the type.   Prototypes should be submissible but should not
     contain references.
     """
     log.verbose("Loading type spec", repr(filename), verbosity=75)
     if filename.endswith(".spec"):
         return cls(utils.evalfile(filename))
     else:
         return cls(rmap.load_mapping(filename).header)
Пример #2
0
 def from_file(cls, filename):
     """For historical HST types,  build type info from a spec file derived from CDBS specs like
     reference_file_defs.xml or cdbscatalog.dat.  For new CRDS-only types,  use a prototype rmap
     with an enhanced header to define the type.   Prototypes should be submissible but should not
     contain references.
     """
     log.verbose("Loading type spec", repr(filename), verbosity=75)
     if filename.endswith(".spec"):
         return cls(utils.evalfile(filename))
     else:
         return cls(rmap.load_mapping(filename).header)
Пример #3
0
 def history_start(self):
     """Return the starting item for processing."""
     if self.args.starting_context:
         item = self.convert_context(self.args.starting_context)
     else:  # read the start from the file recording the last successful processing index.
         if os.path.exists(self.last_processed_path) and not self.args.list_history:
             try:
                 last_tuple = utils.evalfile(self.last_processed_path)
                 item = int(last_tuple[0])
                 log.verbose("Loaded last processed:", last_tuple)
             except Exception as exc:
                 self.fatal_error(self.last_processed_path, "already exists but was unusable:", str(exc))
         else:
             item = 0
     return item