Skip to content

Commit 3ef890b

Browse files
committed
docs(docstrings): remove backslashes to fix formatting issues
1 parent 085d990 commit 3ef890b

File tree

3 files changed

+170
-145
lines changed

3 files changed

+170
-145
lines changed

semanticscholar/ApiRequester.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class ApiRequester:
1919

2020
def __init__(self, timeout, retry: bool = True) -> None:
2121
'''
22-
:param float timeout: an exception is raised \
23-
if the server has not issued a response for timeout seconds.
22+
:param float timeout: an exception is raised
23+
if the server has not issued a response for timeout seconds.
2424
:param bool retry: enable retry mode.
2525
'''
2626
self.timeout = timeout
@@ -76,7 +76,8 @@ async def get_data_async(
7676
headers: dict,
7777
payload: dict = None
7878
) -> Union[dict, List[dict]]:
79-
'''Get data from Semantic Scholar API
79+
'''
80+
Get data from Semantic Scholar API
8081
8182
:param str url: absolute URL to API endpoint.
8283
:param str parameters: the parameters to add in the URL.

semanticscholar/AsyncSemanticScholar.py

Lines changed: 83 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def __init__(
3535
retry: bool = True,
3636
) -> None:
3737
'''
38-
:param float timeout: (optional) an exception is raised\
39-
if the server has not issued a response for timeout seconds.
38+
:param float timeout: (optional) an exception is raised
39+
if the server has not issued a response for timeout seconds.
4040
:param str api_key: (optional) private API key.
4141
:param str api_url: (optional) custom API url.
4242
:param bool debug: (optional) enable debug mode.
@@ -124,13 +124,14 @@ async def get_paper(
124124
paper_id: str,
125125
fields: list = None
126126
) -> Paper:
127-
'''Paper lookup
127+
'''
128+
Paper lookup
128129
129130
:calls: `GET /graph/v1/paper/{paper_id} \
130131
<https://api.semanticscholar.org/api-docs/graph#tag/Paper-Data\
131132
/operation/get_graph_get_paper>`_
132133
133-
:param str paper_id: S2PaperId, CorpusId, DOI, ArXivId, MAG, ACL, \
134+
:param str paper_id: S2PaperId, CorpusId, DOI, ArXivId, MAG, ACL,
134135
PMID, PMCID, or URL from:
135136
136137
- semanticscholar.org
@@ -165,13 +166,14 @@ async def get_papers(
165166
fields: list = None,
166167
return_not_found: bool = False
167168
) -> Union[List[Paper], Tuple[List[Paper], List[str]]]:
168-
'''Get details for multiple papers at once
169+
'''
170+
Get details for multiple papers at once
169171
170172
:calls: `POST /graph/v1/paper/batch \
171173
<https://api.semanticscholar.org/api-docs/graph#tag/Paper-Data\
172174
/operation/post_graph_get_papers>`_
173175
174-
:param str paper_ids: list of IDs (must be <= 500) - S2PaperId,\
176+
:param str paper_ids: list of IDs (must be <= 500) - S2PaperId,
175177
CorpusId, DOI, ArXivId, MAG, ACL, PMID, PMCID, or URL from:
176178
177179
- semanticscholar.org
@@ -181,13 +183,13 @@ async def get_papers(
181183
- biorxiv.org
182184
183185
:param list fields: (optional) list of the fields to be returned.
184-
:param bool return_not_found: (optional) flag to include not found IDs\
185-
in the return, except for IDs in URL:<url> format.
186+
:param bool return_not_found: (optional) flag to include not found IDs
187+
in the return, except for IDs in URL:<url> format.
186188
:returns: papers data, and optionally list of IDs not found.
187-
:rtype: :class:`List` of :class:`semanticscholar.Paper.Paper`\
188-
or :class:`Tuple` [:class:`List` of\
189-
:class:`semanticscholar.Paper.Paper`,\
190-
:class:`List` of :class:`str`]
189+
:rtype: :class:`List` of :class:`semanticscholar.Paper.Paper`
190+
or :class:`Tuple` [:class:`List` of
191+
:class:`semanticscholar.Paper.Paper`,
192+
:class:`List` of :class:`str`]
191193
:raises: BadQueryParametersException: if no paper was found.
192194
'''
193195

@@ -251,13 +253,14 @@ async def get_paper_authors(
251253
fields: list = None,
252254
limit: int = 100
253255
) -> PaginatedResults:
254-
'''Get details about a paper's authors
256+
'''
257+
Get details about a paper's authors
255258
256259
:calls: `POST /graph/v1/paper/{paper_id}/authors \
257260
<https://api.semanticscholar.org/api-docs/graph#tag/Paper-Data\
258261
/operation/get_graph_get_paper_authors>`_
259262
260-
:param str paper_id: S2PaperId, CorpusId, DOI, ArXivId, MAG, ACL,\
263+
:param str paper_id: S2PaperId, CorpusId, DOI, ArXivId, MAG, ACL,
261264
PMID, PMCID, or URL from:
262265
263266
- semanticscholar.org
@@ -267,7 +270,7 @@ async def get_paper_authors(
267270
- biorxiv.org
268271
269272
:param list fields: (optional) list of the fields to be returned.
270-
:param int limit: (optional) maximum number of results to return\
273+
:param int limit: (optional) maximum number of results to return
271274
(must be <= 1000).
272275
'''
273276

@@ -298,13 +301,14 @@ async def get_paper_citations(
298301
fields: list = None,
299302
limit: int = 100
300303
) -> PaginatedResults:
301-
'''Get details about a paper's citations
304+
'''
305+
Get details about a paper's citations
302306
303307
:calls: `POST /graph/v1/paper/{paper_id}/citations \
304308
<https://api.semanticscholar.org/api-docs/graph#tag/Paper-Data\
305309
/operation/get_graph_get_paper_citations>`_
306310
307-
:param str paper_id: S2PaperId, CorpusId, DOI, ArXivId, MAG, ACL,\
311+
:param str paper_id: S2PaperId, CorpusId, DOI, ArXivId, MAG, ACL,
308312
PMID, PMCID, or URL from:
309313
310314
- semanticscholar.org
@@ -314,7 +318,7 @@ async def get_paper_citations(
314318
- biorxiv.org
315319
316320
:param list fields: (optional) list of the fields to be returned.
317-
:param int limit: (optional) maximum number of results to return\
321+
:param int limit: (optional) maximum number of results to return
318322
(must be <= 1000).
319323
'''
320324

@@ -344,13 +348,14 @@ async def get_paper_references(
344348
fields: list = None,
345349
limit: int = 100
346350
) -> PaginatedResults:
347-
'''Get details about a paper's references
351+
'''
352+
Get details about a paper's references
348353
349354
:calls: `POST /graph/v1/paper/{paper_id}/references \
350355
<https://api.semanticscholar.org/api-docs/graph#tag/Paper-Data\
351356
/operation/get_graph_get_paper_references>`_
352357
353-
:param str paper_id: S2PaperId, CorpusId, DOI, ArXivId, MAG, ACL,\
358+
:param str paper_id: S2PaperId, CorpusId, DOI, ArXivId, MAG, ACL,
354359
PMID, PMCID, or URL from:
355360
356361
- semanticscholar.org
@@ -360,7 +365,7 @@ async def get_paper_references(
360365
- biorxiv.org
361366
362367
:param list fields: (optional) list of the fields to be returned.
363-
:param int limit: (optional) maximum number of results to return\
368+
:param int limit: (optional) maximum number of results to return
364369
(must be <= 1000).
365370
'''
366371

@@ -400,50 +405,51 @@ async def search_paper(
400405
sort: str = None,
401406
match_title: bool = False
402407
) -> Union[PaginatedResults, Paper]:
403-
'''Search for papers by keyword. Performs a search query based on the \
404-
S2 search relevance algorithm, or a bulk retrieval of basic paper \
405-
data without search relevance (if bulk=True). Paper relevance \
406-
search is the default behavior and returns up to 1,000 results. \
407-
Bulk retrieval instead returns up to 10,000,000 results (1,000 \
408-
in each page).
408+
'''
409+
Search for papers by keyword. Performs a search query based on the
410+
S2 search relevance algorithm, or a bulk retrieval of basic paper
411+
data without search relevance (if bulk=True). Paper relevance
412+
search is the default behavior and returns up to 1,000 results.
413+
Bulk retrieval instead returns up to 10,000,000 results (1,000
414+
in each page).
409415
410416
:calls: `GET /graph/v1/paper/search \
411-
<https://api.semanticscholar.org/api-docs/graph#tag/Paper-Data\
412-
/operation/get_graph_paper_relevance_search>`_
417+
<https://api.semanticscholar.org/api-docs/graph#tag/\
418+
Paper-Data/operation/get_graph_paper_relevance_search>`_
413419
:calls: `GET /graph/v1/paper/search/bulk \
414-
<https://api.semanticscholar.org/api-docs/graph#tag/Paper-Data\
415-
/operation/get_graph_paper_bulk_search>`_
420+
<https://api.semanticscholar.org/api-docs/graph#tag/\
421+
Paper-Data/operation/get_graph_paper_bulk_search>`_
416422
417423
:param str query: plain-text search query string.
418-
:param str year: (optional) restrict results to the given range of \
424+
:param str year: (optional) restrict results to the given range of
419425
publication year.
420-
:param list publication_type: (optional) restrict results to the given \
426+
:param list publication_type: (optional) restrict results to the given
421427
publication type list.
422-
:param bool open_access_pdf: (optional) restrict results to papers \
428+
:param bool open_access_pdf: (optional) restrict results to papers
423429
with public PDFs.
424430
:param list venue: (optional) restrict results to the given venue list.
425-
:param list fields_of_study: (optional) restrict results to given \
431+
:param list fields_of_study: (optional) restrict results to given
426432
field-of-study list, using the s2FieldsOfStudy paper field.
427433
:param list fields: (optional) list of the fields to be returned.
428-
:param str publication_date_or_year: (optional) restrict results to \
429-
the given range of publication date in the format \
430-
<start_date>:<end_date>, where dates are in the format \
434+
:param str publication_date_or_year: (optional) restrict results to
435+
the given range of publication date in the format
436+
<start_date>:<end_date>, where dates are in the format
431437
YYYY-MM-DD, YYYY-MM, or YYYY.
432-
:param int min_citation_count: (optional) restrict results to papers \
438+
:param int min_citation_count: (optional) restrict results to papers
433439
with at least the given number of citations.
434-
:param int limit: (optional) maximum number of results to return \
440+
:param int limit: (optional) maximum number of results to return
435441
(must be <= 100).
436-
:param bool bulk: (optional) bulk retrieval of basic paper data \
437-
without search relevance (ignores the limit parameter if True \
442+
:param bool bulk: (optional) bulk retrieval of basic paper data
443+
without search relevance (ignores the limit parameter if True
438444
and returns up to 1,000 results in each page).
439-
:param str sort: (optional) sorts results (only if bulk=True) using \
440-
<field>:<order> format, where "field" is either paperId, \
441-
publicationDate, or citationCount, and "order" is asc \
445+
:param str sort: (optional) sorts results (only if bulk=True) using
446+
<field>:<order> format, where "field" is either paperId,
447+
publicationDate, or citationCount, and "order" is asc
442448
(ascending) or desc (descending).
443-
:param bool match_title: (optional) retrieve a single paper whose \
449+
:param bool match_title: (optional) retrieve a single paper whose
444450
title best matches the given query.
445451
:returns: query results.
446-
:rtype: :class:`semanticscholar.PaginatedResults.PaginatedResults` or \
452+
:rtype: :class:`semanticscholar.PaginatedResults.PaginatedResults` or
447453
:class:`semanticscholar.Paper.Paper`
448454
'''
449455

@@ -521,7 +527,8 @@ async def get_author(
521527
author_id: str,
522528
fields: list = None
523529
) -> Author:
524-
'''Author lookup
530+
'''
531+
Author lookup
525532
526533
:calls: `GET /graph/v1/author/{author_id} \
527534
<https://api.semanticscholar.org/api-docs/graph#tag/Author-Data\
@@ -553,18 +560,19 @@ async def get_authors(
553560
fields: list = None,
554561
return_not_found: bool = False
555562
) -> Union[List[Author], Tuple[List[Author], List[str]]]:
556-
'''Get details for multiple authors at once
563+
'''
564+
Get details for multiple authors at once
557565
558566
:calls: `POST /graph/v1/author/batch \
559567
<https://api.semanticscholar.org/api-docs/graph#tag/Author-Data\
560568
/operation/get_graph_get_author>`_
561569
562570
:param str author_ids: list of S2AuthorId (must be <= 1000).
563571
:returns: author data, and optionally list of IDs not found.
564-
:rtype: :class:`List` of :class:`semanticscholar.Author.Author`\
565-
or :class:`Tuple` [:class:`List` of\
566-
:class:`semanticscholar.Author.Author`,\
567-
:class:`List` of :class:`str`]
572+
:rtype: :class:`List` of :class:`semanticscholar.Author.Author`
573+
or :class:`Tuple` [:class:`List` of
574+
:class:`semanticscholar.Author.Author`,
575+
:class:`List` of :class:`str`]
568576
:raises: BadQueryParametersException: if no author was found.
569577
'''
570578

@@ -601,13 +609,14 @@ async def get_author_papers(
601609
fields: list = None,
602610
limit: int = 100
603611
) -> PaginatedResults:
604-
'''Get details about a author's papers
612+
'''
613+
Get details about a author's papers
605614
606615
:calls: `POST /graph/v1/paper/{author_id}/papers \
607616
<https://api.semanticscholar.org/api-docs/graph#tag/Paper-Data\
608617
/operation/get_graph_get_author_papers>`_
609618
610-
:param str paper_id: S2PaperId, CorpusId, DOI, ArXivId, MAG, ACL,\
619+
:param str paper_id: S2PaperId, CorpusId, DOI, ArXivId, MAG, ACL,
611620
PMID, PMCID, or URL from:
612621
613622
- semanticscholar.org
@@ -617,7 +626,7 @@ async def get_author_papers(
617626
- biorxiv.org
618627
619628
:param list fields: (optional) list of the fields to be returned.
620-
:param int limit: (optional) maximum number of results to return\
629+
:param int limit: (optional) maximum number of results to return
621630
(must be <= 1000).
622631
'''
623632

@@ -647,15 +656,16 @@ async def search_author(
647656
fields: list = None,
648657
limit: int = 100
649658
) -> PaginatedResults:
650-
'''Search for authors by name
659+
'''
660+
Search for authors by name
651661
652662
:calls: `GET /graph/v1/author/search \
653663
<https://api.semanticscholar.org/api-docs/graph#tag/Author-Data\
654664
/operation/get_graph_get_author_search>`_
655665
656666
:param str query: plain-text search query string.
657667
:param list fields: (optional) list of the fields to be returned.
658-
:param int limit: (optional) maximum number of results to return \
668+
:param int limit: (optional) maximum number of results to return
659669
(must be <= 1000).
660670
:returns: query results.
661671
:rtype: :class:`semanticscholar.PaginatedResults.PaginatedResults`
@@ -691,13 +701,14 @@ async def get_recommended_papers(
691701
limit: int = 100,
692702
pool_from: Literal["recent", "all-cs"] = "recent"
693703
) -> List[Paper]:
694-
'''Get recommended papers for a single positive example.
704+
'''
705+
Get recommended papers for a single positive example.
695706
696707
:calls: `GET /recommendations/v1/papers/forpaper/{paper_id} \
697708
<https://api.semanticscholar.org/api-docs/recommendations#\
698709
tag/Paper-Recommendations/operation/get_papers_for_paper>`_
699710
700-
:param str paper_id: S2PaperId, CorpusId, DOI, ArXivId, MAG, ACL,\
711+
:param str paper_id: S2PaperId, CorpusId, DOI, ArXivId, MAG, ACL,
701712
PMID, PMCID, or URL from:
702713
703714
- semanticscholar.org
@@ -707,10 +718,10 @@ async def get_recommended_papers(
707718
- biorxiv.org
708719
709720
:param list fields: (optional) list of the fields to be returned.
710-
:param int limit: (optional) maximum number of recommendations to \
711-
return (must be <= 500).
712-
:param str pool_from: (optional) which pool of papers to recommend \
713-
from. Must be either "recent" or "all-cs".
721+
:param int limit: (optional) maximum number of recommendations to
722+
return (must be <= 500).
723+
:param str pool_from: (optional) which pool of papers to recommend
724+
from. Must be either "recent" or "all-cs".
714725
:returns: list of recommendations.
715726
:rtype: :class:`List` of :class:`semanticscholar.Paper.Paper`
716727
'''
@@ -744,19 +755,20 @@ async def get_recommended_papers_from_lists(
744755
fields: list = None,
745756
limit: int = 100
746757
) -> List[Paper]:
747-
'''Get recommended papers for lists of positive and negative examples.
758+
'''
759+
Get recommended papers for lists of positive and negative examples.
748760
749761
:calls: `POST /recommendations/v1/papers/ \
750762
<https://api.semanticscholar.org/api-docs/recommendations#\
751763
tag/Paper-Recommendations/operation/post_papers>`_
752764
753-
:param list positive_paper_ids: list of paper IDs \
754-
that the returned papers should be related to.
755-
:param list negative_paper_ids: (optional) list of paper IDs \
756-
that the returned papers should not be related to.
765+
:param list positive_paper_ids: list of paper IDs
766+
that the returned papers should be related to.
767+
:param list negative_paper_ids: (optional) list of paper IDs
768+
that the returned papers should not be related to.
757769
:param list fields: (optional) list of the fields to be returned.
758-
:param int limit: (optional) maximum number of recommendations to \
759-
return (must be <= 500).
770+
:param int limit: (optional) maximum number of recommendations to
771+
return (must be <= 500).
760772
:returns: list of recommendations.
761773
:rtype: :class:`List` of :class:`semanticscholar.Paper.Paper`
762774
'''

0 commit comments

Comments
 (0)