Skip to content

Commit 5e00d18

Browse files
authored
✨ Adding missing default allow_inplace_modification (#459)
1 parent 0eaf264 commit 5e00d18

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

bibtexparser/middlewares/month.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class _MonthInterpolator(BlockMiddleware, abc.ABC):
1212
"""Abstract class to handle month-conversions."""
1313

1414
# docstr-coverage: inherited
15-
def __init__(self, allow_inplace_modification: bool):
15+
def __init__(self, allow_inplace_modification: bool = True):
1616
super().__init__(
1717
allow_inplace_modification=allow_inplace_modification,
1818
allow_parallel_execution=True,

docs/source/customize.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The core functionality of bibtexparser is deliberately kept simple:
1616
* Upon writing, the splitting is reversed and the blocks are joined together again, with few formatting options.
1717

1818
Advanced transformations of blocks, such as sorting, encoding, cross-referencing, etc. are not part of the core functionality,
19-
but can be optionally added to the parse stack by using the corresponging middleware layers:
19+
but can be optionally added to the parse stack by using the corresponding middleware layers:
2020
Middleware layers helper classes providing the functionality take a library object and return a new, transformed version of said library.
2121

2222
Middleware Layers
@@ -28,9 +28,9 @@ Middleware Layers
2828
2929
# We want to add three new middleware layers to our parse stack:
3030
layers = [
31-
m.MonthIntMiddleware(True), # Months should be represented as int (0-12)
32-
m.SeparateCoAuthors(True), # Co-authors should be separated as list of strings
33-
m.SplitNameParts(True) # Individual Names should be split into first, von, last, jr parts
31+
m.MonthIntMiddleware(), # Months should be represented as int (0-12)
32+
m.SeparateCoAuthors(), # Co-authors should be separated as list of strings
33+
m.SplitNameParts() # Individual Names should be split into first, von, last, jr parts
3434
]
3535
library = bibtexparser.parse_file('bibtex.bib', append_middleware=layers)
3636
@@ -147,4 +147,4 @@ Specifically, a user may pass a :class:`bibtexparser.BibtexFormatter` object to
147147
bib_str = bibtexparser.write_string(library, bibtex_format=bibtex_format)
148148
149149
A few more options are provided and we refer to the docstrings of :class:`bibtexparser.BibtexFormat` for details.
150-
Note: Sorting of blocks and fields is done with the corresponding middleware, as described above.
150+
Note: Sorting of blocks and fields is done with the corresponding middleware, as described above.

examples/middelware.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@
101101
"\n",
102102
"# We want to add three new middleware layers to our parse stack:\n",
103103
"layers = [\n",
104-
" m.MonthIntMiddleware(True), # Months should be represented as int (0-12)\n",
105-
" m.SeparateCoAuthors(True), # Co-authors should be separated\n",
106-
" m.SplitNameParts(True) # Names should be split into first, von, last, jr parts\n",
104+
" m.MonthIntMiddleware(), # Months should be represented as int (0-12)\n",
105+
" m.SeparateCoAuthors(), # Co-authors should be separated\n",
106+
" m.SplitNameParts() # Names should be split into first, von, last, jr parts\n",
107107
"]\n",
108108
"library_append_pstack = bibtexparser.parse_file('bibtex.bib', append_middleware=layers)\n",
109109
"\n",

0 commit comments

Comments
 (0)