Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/news/bibliography.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Changed:**

* Changed `collection.bibliography` to a cached_property.
13 changes: 11 additions & 2 deletions unitpackage/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
# along with unitpackage. If not, see <https://www.gnu.org/licenses/>.
# ********************************************************************
import logging
from functools import cached_property

from frictionless import Package

Expand Down Expand Up @@ -133,7 +134,7 @@ def create_example(cls):
package=package,
)

@property
@cached_property
def bibliography(self):
r"""
Return a pybtex database of all bibtex bibliography files,
Expand All @@ -150,7 +151,15 @@ def bibliography(self):
('engstfeld_2018_polycrystalline_17743', Entry('article',
...

A collection with entries without bibliography.
A derived collection includes only the bibliographic entries of the remaining entries::

>>> collection.filter(lambda entry: entry.source.citationKey != 'alves_2011_electrochemistry_6010').bibliography
BibliographyData(
entries=OrderedCaseInsensitiveDict([
('engstfeld_2018_polycrystalline_17743', Entry('article',
...

A collection with entries without bibliography::

>>> collection = Collection.create_example()["no_bibliography"]
>>> collection.bibliography
Expand Down
Loading