def _delete_wals_before(self, segment_info):
wal_key_depth = self.layout.wal_directory().count('<STR_LIT:/>') + <NUM_LIT:1><EOL>for key in self._backup_list(prefix=self.layout.wal_directory()):<EOL><INDENT>key_name = self.layout.key_name(key)<EOL>bucket = self._container_name(key)<EOL>url = '<STR_LIT>'.format(scm=self.layout.scheme,<EOL>bucket=bucket,<EOL>name=key_name)<EOL>key_parts = key_name.split('<STR_LIT:/>')<EOL>key_depth = len(key_parts)<EOL>if key_depth != wal_key_depth:<EOL><INDENT>logger.warning(<EOL>msg="<STR_LIT>",<EOL>detail=(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(url)),<EOL>hint=generic_weird_key_hint_message)<EOL><DEDENT>elif key_depth == wal_key_depth:<EOL><INDENT>segment_match = (re.match(storage.SEGMENT_REGEXP + r'<STR_LIT>',<EOL>key_parts[-<NUM_LIT:1>]))<EOL>label_match = (re.match(storage.SEGMENT_REGEXP +<EOL>r'<STR_LIT>',<EOL>key_parts[-<NUM_LIT:1>]))<EOL>history_match = re.match(r'<STR_LIT>',<EOL>key_parts[-<NUM_LIT:1>])<EOL>all_matches = [segment_match, label_match, history_match]<EOL>non_matches = len(list(m for m in all_matches if m is None))<EOL>assert non_matches in (len(all_matches) - <NUM_LIT:1>, len(all_matches))<EOL>if non_matches == len(all_matches):<EOL><INDENT>logger.warning(<EOL>msg="<STR_LIT>",<EOL>detail=('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>.format(url)),<EOL>hint=generic_weird_key_hint_message)<EOL><DEDENT>elif segment_match is not None:<EOL><INDENT>scanned_sn = self._groupdict_to_segment_number(<EOL>segment_match.groupdict())<EOL>self._delete_if_before(segment_info, scanned_sn, key,<EOL>'<STR_LIT>')<EOL><DEDENT>elif label_match is not None:<EOL><INDENT>scanned_sn = self._groupdict_to_segment_number(<EOL>label_match.groupdict())<EOL>self._delete_if_before(segment_info, scanned_sn, key,<EOL>'<STR_LIT>')<EOL><DEDENT>elif history_match is not None:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>assert False<EOL><DEDENT><DEDENT>else:<EOL><INDENT>assert False<EOL><DEDENT><DEDENT>
Delete all WAL files before segment_info.

Doesn't delete any base-backup data.