Skip to content

Commit 9cfdac3

Browse files
Drop support for Python 3.8
1 parent 675afeb commit 9cfdac3

16 files changed

+97
-97
lines changed

pybliometrics/sciencedirect/article_metadata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from collections import namedtuple
2-
from typing import List, NamedTuple, Optional, Tuple, Union
2+
from typing import Optional, Union
33

44
from pybliometrics.superclasses import Search
55
from pybliometrics.utils import check_field_consistency, chained_get, \
@@ -9,7 +9,7 @@
99

1010
class ArticleMetadata(Search):
1111
@property
12-
def results(self) -> Optional[List[NamedTuple]]:
12+
def results(self) -> Optional[list[namedtuple]]:
1313
"""A list of namedtuples in the form `(authorKeywords authors available_online_date
1414
first_author abstract_text doi title eid link openArchiveArticle openaccess_status
1515
openaccessArticle openaccessUserLicense pii aggregationType copyright coverDate
@@ -87,7 +87,7 @@ def __init__(self,
8787
view: str = None,
8888
verbose: bool = False,
8989
download: bool = True,
90-
integrity_fields: Union[List[str], Tuple[str, ...]] = None,
90+
integrity_fields: Union[list[str], tuple[str, ...]] = None,
9191
integrity_action: str = "raise",
9292
subscriber: bool = True,
9393
**kwds: str

pybliometrics/sciencedirect/sciencedirect_search.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from collections import namedtuple
2-
from typing import List, NamedTuple, Optional, Tuple, Union
2+
from typing import Optional, Union
33

44
from pybliometrics.superclasses import Search
55
from pybliometrics.utils import check_field_consistency, chained_get, \
@@ -9,7 +9,7 @@
99

1010
class ScienceDirectSearch(Search):
1111
@property
12-
def results(self) -> Optional[List[NamedTuple]]:
12+
def results(self) -> Optional[list[namedtuple]]:
1313
"""A list of namedtuples in the form `(authors first_author doi title link
1414
load_date openaccess_status pii coverDate endingPage publicationName startingPage
1515
api_link volume)`.
@@ -76,7 +76,7 @@ def __init__(self,
7676
view: Optional[str] = None,
7777
verbose: bool = False,
7878
download: bool = True,
79-
integrity_fields: Optional[Union[List[str], Tuple[str, ...]]] = None,
79+
integrity_fields: Optional[Union[list[str], tuple[str, ...]]] = None,
8080
integrity_action: str = "raise",
8181
subscriber: bool = True,
8282
**kwds: str

pybliometrics/scopus/abstract_citation.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from collections import namedtuple
22
from datetime import datetime
33
from hashlib import md5
4-
from typing import List, NamedTuple, Optional, Tuple, Union
4+
from typing import Optional, Union
55
from warnings import warn
66

77
from pybliometrics.superclasses import Retrieval
@@ -10,7 +10,7 @@
1010

1111
class CitationOverview(Retrieval):
1212
@property
13-
def authors(self) -> Optional[List[Optional[NamedTuple]]]:
13+
def authors(self) -> Optional[list[Optional[namedtuple]]]:
1414
"""A list of lists of namedtuples storing author information,
1515
where each namedtuple corresponds to one author and each sub-list to
1616
one document.
@@ -34,7 +34,7 @@ def authors(self) -> Optional[List[Optional[NamedTuple]]]:
3434
return _maybe_return_list(outer)
3535

3636
@property
37-
def cc(self) -> List[List[Tuple[int, int]]]:
37+
def cc(self) -> list[list[tuple[int, int]]]:
3838
"""List of lists of tuples of yearly number of citations for specified
3939
years, where each sub-list corresponds to one document.
4040
"""
@@ -54,32 +54,32 @@ def cc(self) -> List[List[Tuple[int, int]]]:
5454
return _maybe_return_list(outer)
5555

5656
@property
57-
def citationType_long(self) -> Optional[List[str]]:
57+
def citationType_long(self) -> Optional[list[str]]:
5858
"""Type (long version) of the documents (e.g. article, review)."""
5959
path = ["citationType", "$"]
6060
out = [chained_get(e, path) for e in self._citeInfoMatrix]
6161
return _maybe_return_list(out)
6262

6363
@property
64-
def citationType_short(self) -> Optional[List[str]]:
64+
def citationType_short(self) -> Optional[list[str]]:
6565
"""Type (short version) of the documents (e.g. ar, re)."""
6666
path = ["citationType", "@code"]
6767
out = [chained_get(e, path) for e in self._citeInfoMatrix]
6868
return _maybe_return_list(out)
6969

7070
@property
71-
def columnTotal(self) -> int:
71+
def columnTotal(self) -> list[int]:
7272
"""The yearly number of citations for all documents combined."""
7373
return [int(d["$"]) for d in self._citeCountHeader["columnTotal"]]
7474

7575
@property
76-
def doi(self) -> Optional[List[str]]:
76+
def doi(self) -> Optional[list[str]]:
7777
"""Document Object Identifier (DOI) of the documents."""
7878
out = [e.get('doi') for e in self._identifierlegend]
7979
return _maybe_return_list(out)
8080

8181
@property
82-
def endingPage(self) -> Optional[List[str]]:
82+
def endingPage(self) -> Optional[list[str]]:
8383
"""Ending pages of the documents."""
8484
out = [e.get('endingPage') for e in self._citeInfoMatrix]
8585
return _maybe_return_list(out)
@@ -95,7 +95,7 @@ def h_index(self) -> int:
9595
return int(self._data['h-index'])
9696

9797
@property
98-
def issn(self) -> Optional[List[Optional[Union[str, Tuple[str, str]]]]]:
98+
def issn(self) -> Optional[list[Optional[Union[str, tuple[str, str]]]]]:
9999
"""ISSN of the publishers of the documents.
100100
Note: If E-ISSN is known to Scopus, this returns both
101101
ISSN and E-ISSN in random order separated by blank space.
@@ -104,7 +104,7 @@ def issn(self) -> Optional[List[Optional[Union[str, Tuple[str, str]]]]]:
104104
return _maybe_return_list(out)
105105

106106
@property
107-
def issueIdentifier(self) -> Optional[List[Optional[str]]]:
107+
def issueIdentifier(self) -> Optional[list[Optional[str]]]:
108108
"""Issue numbers of the documents."""
109109
out = [e.get('issueIdentifier') for e in self._citeInfoMatrix]
110110
return _maybe_return_list(out)
@@ -117,17 +117,17 @@ def laterColumnTotal(self) -> int:
117117
return int(self._citeCountHeader["laterColumnTotal"])
118118

119119
@property
120-
def lcc(self) -> List[int]:
120+
def lcc(self) -> list[int]:
121121
"""Number of citations after the end year of each document."""
122122
return [int(m['lcc']) for m in self._citeInfoMatrix]
123123

124124
@property
125-
def pcc(self) -> int:
125+
def pcc(self) -> list[int]:
126126
"""Number of citations before the start year."""
127127
return [int(m['pcc']) for m in self._citeInfoMatrix]
128128

129129
@property
130-
def pii(self) -> Optional[List[Optional[str]]]:
130+
def pii(self) -> Optional[list[Optional[str]]]:
131131
"""The Publication Item Identifier (PII) of the documents."""
132132
out = [e.get('pii') for e in self._identifierlegend]
133133
return _maybe_return_list(out)
@@ -147,45 +147,45 @@ def rangeColumnTotal(self) -> int:
147147
return int(self._citeCountHeader["rangeColumnTotal"])
148148

149149
@property
150-
def rangeCount(self) -> List[int]:
150+
def rangeCount(self) -> list[int]:
151151
"""Total citation count over the specified year range for
152152
each document.
153153
"""
154154
return [int(e['rangeCount']) for e in self._citeInfoMatrix]
155155

156156
@property
157-
def rowTotal(self) -> List[int]:
157+
def rowTotal(self) -> list[int]:
158158
"""Total number of citations (specified and omitted years) for each
159159
document.
160160
"""
161161
return [int(e['rowTotal']) for e in self._citeInfoMatrix]
162162

163163
@property
164-
def scopus_id(self) -> List[int]:
164+
def scopus_id(self) -> list[int]:
165165
"""The Scopus ID(s) of the documents. Might differ from the
166166
ones provided.
167167
"""
168168
return [int(e['scopus_id']) for e in self._identifierlegend]
169169

170170
@property
171-
def sortTitle(self) -> Optional[List[Optional[str]]]:
171+
def sortTitle(self) -> Optional[list[Optional[str]]]:
172172
"""Name of source the documents are published in (e.g. the Journal)."""
173173
out = [e.get('sortTitle') for e in self._citeInfoMatrix]
174174
return _maybe_return_list(out)
175175

176176
@property
177-
def startingPage(self) -> Optional[List[Optional[str]]]:
177+
def startingPage(self) -> Optional[list[Optional[str]]]:
178178
"""Starting page."""
179179
out = [e.get('startingPage') for e in self._citeInfoMatrix]
180180
return _maybe_return_list(out)
181181

182182
@property
183-
def title(self) -> List[str]:
183+
def title(self) -> list[str]:
184184
"""Titles of each document."""
185185
return [e["title"] for e in self._citeInfoMatrix]
186186

187187
@property
188-
def url(self) -> List[str]:
188+
def url(self) -> list[str]:
189189
"""URL(s) to Citation Overview API view of each document."""
190190
return [e["url"] for e in self._citeInfoMatrix]
191191

@@ -196,7 +196,7 @@ def volume(self) -> Optional[str]:
196196
return _maybe_return_list(out)
197197

198198
def __init__(self,
199-
identifier: List[Union[int, str]],
199+
identifier: list[Union[int, str]],
200200
date: Optional[str] = None,
201201
start: Optional[Union[int, str]] = None,
202202
end: Optional[Union[int, str]] = None,

pybliometrics/scopus/abstract_retrieval.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from collections import defaultdict, namedtuple
2-
from typing import List, NamedTuple, Optional, Tuple, Union
2+
from typing import Optional, Union
33

44
from pybliometrics.superclasses import Retrieval
55
from pybliometrics.utils import chained_get, check_parameter_value, \
@@ -16,7 +16,7 @@ def abstract(self) -> Optional[str]:
1616
return self._head.get('abstracts')
1717

1818
@property
19-
def affiliation(self) -> Optional[List[NamedTuple]]:
19+
def affiliation(self) -> Optional[list[namedtuple]]:
2020
"""A list of namedtuples representing listed affiliations in
2121
the form `(id, name, city, country)`.
2222
"""
@@ -36,7 +36,7 @@ def aggregationType(self) -> str:
3636
return chained_get(self._json, ['coredata', 'prism:aggregationType'])
3737

3838
@property
39-
def authkeywords(self) -> Optional[List[str]]:
39+
def authkeywords(self) -> Optional[list[str]]:
4040
"""List of author-provided keywords of the document."""
4141
keywords = self._json.get('authkeywords')
4242
if not keywords:
@@ -48,7 +48,7 @@ def authkeywords(self) -> Optional[List[str]]:
4848
return [keywords['author-keyword']['$']]
4949

5050
@property
51-
def authorgroup(self) -> Optional[List[NamedTuple]]:
51+
def authorgroup(self) -> Optional[list[namedtuple]]:
5252
"""A list of namedtuples representing the article's authors and collaborations
5353
organized by affiliation, in the form `(affiliation_id, collaboration_id, dptid,
5454
organization, city, postalcode, addresspart, country, auid, orcid,
@@ -102,7 +102,7 @@ def authorgroup(self) -> Optional[List[NamedTuple]]:
102102
return out or None
103103

104104
@property
105-
def authors(self) -> Optional[List[NamedTuple]]:
105+
def authors(self) -> Optional[list[namedtuple]]:
106106
"""A list of namedtuples representing the article's authors, in the
107107
form `(auid, indexed_name, surname, given_name, affiliation)`. In case
108108
multiple affiliation IDs are given, they are joined on `";"`.
@@ -137,7 +137,7 @@ def citedby_link(self) -> str:
137137
return get_link(self._json, 2)
138138

139139
@property
140-
def chemicals(self) -> Optional[List[NamedTuple]]:
140+
def chemicals(self) -> Optional[list[namedtuple]]:
141141
"""List of namedtuples representing chemical entities in the form
142142
`(source, chemical_name, cas_registry_number)`. In case multiple
143143
numbers given, they are joined on `";"`.
@@ -165,7 +165,7 @@ def confcode(self) -> Optional[int]:
165165
return make_int_if_possible(self._confevent.get('confcode'))
166166

167167
@property
168-
def confdate(self) -> Optional[Tuple[Tuple[int, int], Tuple[int, int]]]:
168+
def confdate(self) -> Optional[tuple[int, int], tuple[int, int]]:
169169
"""Date range of the conference the document belongs to represented
170170
by two tuples in the form (YYYY, MM, DD).
171171
"""
@@ -189,7 +189,7 @@ def confname(self) -> Optional[str]:
189189
return self._confevent.get('confname')
190190

191191
@property
192-
def confsponsor(self) -> Optional[Union[List[str], str]]:
192+
def confsponsor(self) -> Optional[Union[list[str], str]]:
193193
"""Sponsor(s) of the conference the document belongs to."""
194194
path = ['confsponsors', 'confsponsor']
195195
sponsors = chained_get(self._confevent, path, [])
@@ -200,7 +200,7 @@ def confsponsor(self) -> Optional[Union[List[str], str]]:
200200
return sponsors
201201

202202
@property
203-
def contributor_group(self) -> Optional[List[NamedTuple]]:
203+
def contributor_group(self) -> Optional[list[namedtuple]]:
204204
"""List of namedtuples representing contributors compiled by Scopus,
205205
in the form `(given_name, initials, surname, indexed_name, role)`.
206206
"""
@@ -231,7 +231,7 @@ def copyright_type(self) -> str:
231231
return chained_get(self._json, path)
232232

233233
@property
234-
def correspondence(self) -> Optional[List[NamedTuple]]:
234+
def correspondence(self) -> Optional[list[namedtuple]]:
235235
"""List of namedtuples representing the authors to whom correspondence
236236
should be addressed, in the form ´(surname, initials, organization,
237237
country, city_group)´. Multiple organziations are joined on semicolon.
@@ -263,7 +263,7 @@ def coverDate(self) -> str:
263263
return chained_get(self._json, ['coredata', 'prism:coverDate'])
264264

265265
@property
266-
def date_created(self) -> Optional[Tuple[int, int, int]]:
266+
def date_created(self) -> Optional[tuple[int, int, int]]:
267267
"""Return the `date_created` of a record.
268268
"""
269269
path = ["item", "bibrecord", "item-info", "history"]
@@ -309,7 +309,7 @@ def endingPage(self) -> Optional[str]:
309309
return ending
310310

311311
@property
312-
def funding(self) -> Optional[List[NamedTuple]]:
312+
def funding(self) -> Optional[list[namedtuple]]:
313313
"""List of namedtuples parsed funding information in the form
314314
`(agency, agency_id, string, funding_id, acronym, country)`.
315315
"""
@@ -343,7 +343,7 @@ def funding_text(self) -> Optional[str]:
343343
return chained_get(self._json, path)
344344

345345
@property
346-
def isbn(self) -> Optional[Tuple[str, ...]]:
346+
def isbn(self) -> Optional[tuple[str, ...]]:
347347
"""ISBNs `Optional[str]` to publicationName as tuple of variying length,
348348
(e.g. ISBN-10 or ISBN-13)."""
349349
isbns = listify(chained_get(self._head, ['source', 'isbn'], []))
@@ -353,7 +353,7 @@ def isbn(self) -> Optional[Tuple[str, ...]]:
353353
return tuple((i['$'] for i in isbns))
354354

355355
@property
356-
def issn(self) -> Optional[NamedTuple]:
356+
def issn(self) -> Optional[namedtuple]:
357357
"""Namedtuple in the form `(print electronic)`.
358358
Note: If the source has an E-ISSN, the META view will return None.
359359
Use FULL view instead.
@@ -393,7 +393,7 @@ def identifier(self) -> int:
393393
return get_id(self._json)
394394

395395
@property
396-
def idxterms(self) -> Optional[List[str]]:
396+
def idxterms(self) -> Optional[list[str]]:
397397
"""List of index terms (these are just one category of those
398398
Scopus provides in the web version)
399399
."""
@@ -494,7 +494,7 @@ def refcount(self) -> Optional[int]:
494494
return None
495495

496496
@property
497-
def references(self) -> Optional[List[NamedTuple]]:
497+
def references(self) -> Optional[list[namedtuple]]:
498498
"""List of namedtuples representing references listed in the document,
499499
in the form `(position, id, doi, title, authors, authors_auid,
500500
authors_affiliationid, sourcetitle, publicationyear, coverDate, volume,
@@ -589,7 +589,7 @@ def self_link(self) -> str:
589589
return get_link(self._json, 0)
590590

591591
@property
592-
def sequencebank(self) -> Optional[List[NamedTuple]]:
592+
def sequencebank(self) -> Optional[list[namedtuple]]:
593593
"""List of namedtuples representing biological entities defined or
594594
mentioned in the text, in the form `(name, sequence_number, type)`.
595595
"""
@@ -636,7 +636,7 @@ def startingPage(self) -> Optional[str]:
636636
return starting
637637

638638
@property
639-
def subject_areas(self) -> Optional[List[NamedTuple]]:
639+
def subject_areas(self) -> Optional[list[namedtuple]]:
640640
"""List of namedtuples containing subject areas of the article
641641
in the form `(area abbreviation code)`.
642642
Note: Requires the FULL view of the article.

0 commit comments

Comments
 (0)