Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_query(self):
with patch.object(feedparser, "parse", new_callable=get_parse_callable):
result = query(
query="sth",
max_results=341)
self.assertEqual(len(result), 341)
def test_invalid_id(self):
self.assertEqual(len(query(id_list=["1912.08031"])), 0)
def test_query_iterator(self):
iterator = query(
query="sth",
max_results=200,
max_chunk_results=111,
iterative=True)
with patch.object(feedparser, "parse", new_callable=get_parse_callable):
results = [r for r in iterator()]
self.assertEqual(len(results), 200)
def setUpClass(self):
self.paper_query = arxiv.query(id_list=["1605.08386"])[0]
self.paper_dict = {
"pdf_url": "http://arxiv.org/pdf/1605.08386v1",
"title": "The Paper Title"}
def main(wf):
import argparse
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('query', default=None, type=str)
args = parser.parse_args()
log.debug('args : {}'.format(args))
query = args.query
# FUCK arxiv.py is too stupid why it is not quoting
ret = arxiv.query(urllib.quote(query),
max_results=25)
if not ret:
wf.add_item('No matchings', icon=workflow.ICON_WARNING)
for entry in ret:
title = entry['title']
authors = ', '.join(entry['authors'])
bundle = ', '.join(t['term'] for t in entry['tags'])
url = entry['id']
identifier, version = parse_arxiv_url(url) # 1704.12345
canonical_url = 'https://arxiv.org/abs/%s' % identifier
item = wf.add_item(
title="[%s] %s" % (identifier, title),