-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from david-rohrschneider/autocomplete-api
Feature: autocomplete api
- Loading branch information
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from semanticscholar.SemanticScholarObject import SemanticScholarObject | ||
|
||
|
||
class Autocomplete(SemanticScholarObject): | ||
def __init__(self, data: dict) -> None: | ||
super().__init__() | ||
self._id = None | ||
self._title = None | ||
self._authors_year = None | ||
self._init_attributes(data) | ||
|
||
def _init_attributes(self, data: dict) -> None: | ||
self._data = data | ||
|
||
if "id" in data: | ||
self._id = data["id"] | ||
|
||
if "title" in data: | ||
self._title = data["title"] | ||
|
||
if "authorsYear" in data: | ||
self._authors_year = data["authorsYear"] | ||
|
||
@property | ||
def id(self) -> str: | ||
return self._id | ||
|
||
@property | ||
def title(self) -> str: | ||
return self._title | ||
|
||
@property | ||
def authors_year(self) -> str: | ||
return self._authors_year |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters