def starting_character_position_length(self, value: str) -> None: """Length of the starting-character-position portion (21).""" if len(value) != 1: raise BadLeaderValue( "Length of the starting-character-position portion is 1 char field, got %s" % value) self._replace_values(position=21, value=value)
def implementation_defined_length(self, value: str) -> None: """Length of the starting-character-position portion (22).""" if len(value) != 1: raise BadLeaderValue( "Length of the implementation-defined portion is 1 char field, got %s" % value) self._replace_values(position=22, value=value)
def multipart_ressource(self, value: str) -> None: """Multipart resource record level (19).""" if len(value) != 1: raise BadLeaderValue( "Multipart resource record level is 1 char field, got %s" % value) self._replace_values(position=19, value=value)
def length_of_field_length(self, value: str) -> None: """Length of the length-of-field portion (20).""" if len(value) != 1: raise BadLeaderValue( "Length of the length-of-field portion is 1 char field, got %s" % value) self._replace_values(position=20, value=value)
def cataloging_form(self, value): # type: (str) -> str """Descriptive cataloging form (18).""" if len(value) != 1: raise BadLeaderValue( "Descriptive cataloging form is 1 char field, got %s" % value) self._replace_values(position=18, value=value)
def record_length(self, value): # type: (str) -> str """Record length (00-04).""" if len(value) != 5: raise BadLeaderValue("Record length is 4 chars field, got %s" % value) self._replace_values(position=0, value=value)
def base_address(self, value): # type: (str) -> str """Base address of data (12-16).""" if len(value) != 5: raise BadLeaderValue( "Base address of data is 4 chars field, got %s" % value) self._replace_values(position=12, value=value)
def encoding_level(self, value): # type: (str) -> str """Encoding level (17).""" if len(value) != 1: raise BadLeaderValue("Encoding level is 1 char field, got %s" % value) self._replace_values(position=17, value=value)
def indicator_count(self, value): # type: (str) -> str """Indicator count (10).""" if len(value) != 1: raise BadLeaderValue("Indicator count is 1 char field, got %s" % value) self._replace_values(position=10, value=value)
def subfield_code_count(self, value): # type: (str) -> str """Subfield code count (11).""" if len(value) != 1: raise BadLeaderValue( "Subfield code count is 1 char field, got %s" % value) self._replace_values(position=11, value=value)
def coding_scheme(self, value): # type: (str) -> str """Character coding scheme (09).""" if len(value) != 1: raise BadLeaderValue( "Character coding scheme is 1 char field, got %s" % value) self._replace_values(position=9, value=value)
def type_of_control(self, value): # type: (str) -> str """Type of control (08).""" if len(value) != 1: raise BadLeaderValue("Type of control is 1 char field, got %s" % value) self._replace_values(position=8, value=value)
def bibliographic_level(self, value): # type: (str) -> str """Bibliographic level (07).""" if len(value) != 1: raise BadLeaderValue( "Bibliographic level is 1 char field, got %s" % value) self._replace_values(position=7, value=value)
def type_of_record(self, value): # type: (str) -> str """Type of record (06).""" if len(value) != 1: raise BadLeaderValue("Type of record is 1 char field, got %s" % value) self._replace_values(position=6, value=value)
def record_status(self, value): # type: (str) -> str """Record status (05).""" if len(value) != 1: raise BadLeaderValue("Record status is 1 char field, got %s" % value) self._replace_values(position=5, value=value)
def _replace_values(self, position: int, value: str) -> None: """Replaces the values in the leader at `position` by `value`.""" if position < 0: raise IndexError("Position must be positive") after = position + len(value) if after > LEADER_LEN: raise BadLeaderValue("%s is too long to be inserted at %d" % (value, position)) self.leader = self.leader[:position] + value + self.leader[after:]