Coverage for /opt/obspy/update-docs/src/obspy/obspy/xseed/blockette/blockette : 80%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
""" Wrong blockette length detected. """
""" General Blockette Parser Exception. """
""" General blockette handling. """ # default field for each blockette Integer(1, "Blockette type", 3), Integer(2, "Length of blockette", 4, optional=True) ]
# debug if self.debug: print("----") print(str(self)) # filter versions specific fields
""" Pretty prints the informations stored in the blockette. """ temp = 'Blockette %s: %s Blockette' % (self.blockette_id, utils.toString(self.blockette_name)) + os.linesep keys = self.__dict__.keys() keys = sorted(keys) for key in keys: if key in utils.IGNORE_ATTR: continue temp += '%30s: %s' % (utils.toString(key), self.__dict__[key]) temp += os.linesep return temp.strip()
# Check XML-SEED version field.xseed_version != xseed_version: # Check SEED version continue
""" Parse given data for blockette fields and create attributes. """ # convert to stream for test issues # debug if self.debug: print(' DATA: %s' % (data.read(expected_length))) data.seek(-expected_length, 1) # loop over all blockette fields # if blockette length reached break with warning if isinstance(field, Loop): break msg = "End of blockette " + self.blockette_id + " reached " + \ "without parsing all expected fields, here: " + \ str(field) if self.strict: raise BlocketteLengthException(msg) else: warnings.warn(msg, category=Warning) break # strict tests # check length # wrong length expected_length, self.record_id or 0) else: warnings.warn(msg, category=Warning)
""" Converts the blockette to a valid SEED string and returns it. """ # loop over all blockette fields # add blockette id and length
""" Reads lxml etree and fills the blockette with the values of it. """
xseed_version=DEFAULT_XSEED_VERSION): """ Returns a XML document representing this blockette. """ # root element # loop over all blockette fields |