Commit 4ce6d75 1 parent cf01e37 commit 4ce6d75 Copy full SHA for 4ce6d75
File tree 9 files changed +15
-13
lines changed
9 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ install:
15
15
- python setup.py sdist bdist_wheel
16
16
script :
17
17
- pytest --verbose --color=yes
18
- # if the following command fails, run `black .` locally to reformat the code
18
+ # if the following command fails, run `black .` locally to reformat the code.
19
+ # ensure your local version of black matches the version installed on Travis,
20
+ # which will usually be the latest version from https://pypi.org/project/black/
19
21
- black --check --diff .
20
22
# temporary workaround for portray "Module not found" error https://git.io/JeR9C
21
23
- export PYTHONPATH=.
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def get_arxiv_csl_item(arxiv_id):
36
36
37
37
# Parse XML
38
38
xml_tree = xml .etree .ElementTree .fromstring (response .text )
39
- entry , = xml_tree .findall (prefix + "entry" )
39
+ ( entry ,) = xml_tree .findall (prefix + "entry" )
40
40
41
41
# Create dictionary for CSL Item
42
42
csl_item = collections .OrderedDict ()
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ def prune_against_schema(self):
115
115
"""
116
116
from .citeproc import remove_jsonschema_errors
117
117
118
- csl_item , = remove_jsonschema_errors ([self ], in_place = True )
118
+ ( csl_item ,) = remove_jsonschema_errors ([self ], in_place = True )
119
119
assert csl_item is self
120
120
return self
121
121
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ def get_isbn_csl_item_citoid(isbn):
57
57
f"Unable to extract CSL from JSON metadata for ISBN { isbn } :\n "
58
58
f"{ json .dumps (result .text )} "
59
59
)
60
- mediawiki , = result
60
+ ( mediawiki ,) = result
61
61
csl_item = collections .OrderedDict ()
62
62
csl_item ["type" ] = mediawiki .get ("itemType" , "book" )
63
63
if "title" in mediawiki :
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ def get_pubmed_csl_item(pmid):
81
81
response = requests .get (url , params , headers = headers )
82
82
try :
83
83
element_tree = xml .etree .ElementTree .fromstring (response .text )
84
- element_tree , = list (element_tree )
84
+ ( element_tree ,) = list (element_tree )
85
85
except Exception as error :
86
86
logging .error (
87
87
f"Error fetching PubMed metadata for { pmid } .\n "
@@ -248,7 +248,7 @@ def get_pmcid_and_pmid_for_doi(doi):
248
248
f"Response from { response .url } :\n { response .text } "
249
249
)
250
250
return {}
251
- record , = records
251
+ ( record ,) = records
252
252
if record .findtext ("status" , default = "okay" ) == "error" :
253
253
return {}
254
254
id_dict = {}
@@ -288,7 +288,7 @@ def get_pmid_for_doi(doi):
288
288
f"Response from { response .url } :\n { response .text } "
289
289
)
290
290
return None
291
- id_elem , = id_elems
291
+ ( id_elem ,) = id_elems
292
292
return id_elem .text
293
293
294
294
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ def test_cite_command_stdout():
30
30
)
31
31
print (process .stderr )
32
32
assert process .returncode == 0
33
- csl , = json .loads (process .stdout )
33
+ ( csl ,) = json .loads (process .stdout )
34
34
assert csl ["URL" ] == "https://arxiv.org/abs/1806.05726v1"
35
35
36
36
@@ -44,7 +44,7 @@ def test_cite_command_file(tmpdir):
44
44
print (process .stderr .decode ())
45
45
assert process .returncode == 0
46
46
with path .open () as read_file :
47
- csl , = json .load (read_file )
47
+ ( csl ,) = json .load (read_file )
48
48
assert csl ["URL" ] == "https://arxiv.org/abs/1806.05726v1"
49
49
50
50
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ def test_web_query_returns_single_result_legacy_manubot_url():
71
71
zotero_metadata = web_query (url )
72
72
assert isinstance (zotero_metadata , list )
73
73
assert len (zotero_metadata ) == 1
74
- zotero_metadata , = zotero_metadata
74
+ ( zotero_metadata ,) = zotero_metadata
75
75
assert (
76
76
zotero_metadata ["title" ]
77
77
== "Sci-Hub provides access to nearly all scholarly literature"
@@ -92,7 +92,7 @@ def test_web_query_returns_single_result_pubmed_url():
92
92
zotero_metadata = web_query (url )
93
93
assert isinstance (zotero_metadata , list )
94
94
assert len (zotero_metadata ) == 1
95
- zotero_metadata , = zotero_metadata
95
+ ( zotero_metadata ,) = zotero_metadata
96
96
assert zotero_metadata ["title" ] == "sci-hub[title] - PubMed - NCBI"
97
97
98
98
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ def get_url_csl_item_zotero(url):
32
32
33
33
zotero_data = web_query (url )
34
34
csl_data = export_as_csl (zotero_data )
35
- csl_item , = csl_data
35
+ ( csl_item ,) = csl_data
36
36
return csl_item
37
37
38
38
Original file line number Diff line number Diff line change @@ -112,5 +112,5 @@ def get_csl_item(identifier: str):
112
112
"""
113
113
zotero_data = search_query (identifier )
114
114
csl_data = export_as_csl (zotero_data )
115
- csl_item , = csl_data
115
+ ( csl_item ,) = csl_data
116
116
return csl_item
You can’t perform that action at this time.
0 commit comments