Source code for bibble.io._interface

 1#!/usr/bin/env python3
 2"""
 3
 4"""
 5# Imports:
 6from __future__ import annotations
 7
 8from bibtexparser.writer import BibtexFormat
 9
10# ##-- types
11# isort: off
12import abc
13import collections.abc
14from typing import TYPE_CHECKING, cast, assert_type, assert_never
15from typing import Generic, NewType
16# Protocols:
17from typing import Protocol, runtime_checkable
18# Typing Decorators:
19from typing import no_type_check, final, override, overload
20
21if TYPE_CHECKING:
22    from jgdv import Maybe
23    from typing import Final
24    from typing import ClassVar, Any, LiteralString
25    from typing import Never, Self, Literal
26    from typing import TypeGuard
27    from collections.abc import Iterable, Iterator, Callable, Generator
28    from collections.abc import Sequence, Mapping, MutableMapping, Hashable
29
30##--|
31
32# isort: on
33# ##-- end types
34
35# Vars:
36VAL_SEP      : Final[str] = " = "
37FAIL_COMMENT : Final[str] = "% WARNING Processing failed for the following {n} lines.\n% Error: {err}.\n% Raw Original:"
38FAIL_PARTIAL : Final[str] = "% Partially Processed Block:"
39FAIL_END     : Final[str] = "% End of Error Report"
40
41# Body:
42
[docs] 43def default_format() -> BibtexFormat: 44 """ Build a default formatter """ 45 fmt = BibtexFormat() 46 fmt.value_column = 15 47 fmt.indent = " " 48 fmt.block_separator = "\n" 49 fmt.trailing_comma = True 50 fmt.parsing_failed_comment = FAIL_COMMENT 51 return fmt