Skip to content

Commit

Permalink
Remove unnecessary typing info from docstrings
Browse files Browse the repository at this point in the history
Sphinx supports PEP 484 type annotations now
  • Loading branch information
PrOF-kk committed Sep 27, 2022
1 parent 72dea82 commit 3c7cc55
Showing 1 changed file with 41 additions and 41 deletions.
82 changes: 41 additions & 41 deletions gkeepapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,9 @@ def login(self, email: str, password: str, state: Optional[Dict] = None, sync=Tr
"""Authenticate to Google with the provided credentials & sync.
Args:
email (str): The account to use.
password (str): The account password.
state (dict): Serialized state to load.
email: The account to use.
password: The account password.
state: Serialized state to load.
Raises:
LoginException: If there was a problem logging in.
Expand All @@ -699,9 +699,9 @@ def resume(self, email: str, master_token: str, state: Optional[Dict] = None, sy
"""Authenticate to Google with the provided master token & sync.
Args:
email (str): The account to use.
master_token (str): The master token.
state (dict): Serialized state to load.
email: The account to use.
master_token: The master token.
state: Serialized state to load.
Raises:
LoginException: If there was a problem logging in.
Expand All @@ -719,15 +719,15 @@ def getMasterToken(self) -> str:
"""Get master token for resuming.
Returns:
str: The master token.
The master token.
"""
return self._keep_api.getAuth().getMasterToken()

def load(self, auth: APIAuth, state: Optional[Dict] = None, sync=True) -> None:
"""Authenticate to Google with a prepared authentication object & sync.
Args:
auth (APIAuth): Authentication object.
state (dict): Serialized state to load.
auth: Authentication object.
state: Serialized state to load.
Raises:
LoginException: If there was a problem logging in.
Expand All @@ -744,7 +744,7 @@ def dump(self) -> Dict:
"""Serialize note data.
Returns:
dict: Serialized state.
Serialized state.
"""
# Find all nodes manually, as the Keep object isn't aware of new
# ListItems until they've been synced to the server.
Expand All @@ -763,7 +763,7 @@ def restore(self, state: Dict) -> None:
"""Unserialize saved note data.
Args:
state (dict): Serialized state to load.
state: Serialized state to load.
"""
self._clear()
self._parseUserInfo({'labels': state['labels']})
Expand All @@ -774,10 +774,10 @@ def get(self, node_id: str) -> _node.TopLevelNode:
"""Get a note with the given ID.
Args:
node_id (str): The note ID.
node_id: The note ID.
Returns:
gkeepapi.node.TopLevelNode: The Note or None if not found.
The Note or None if not found.
"""
return \
self._nodes[_node.Root.ID].get(node_id) or \
Expand All @@ -789,7 +789,7 @@ def add(self, node: _node.Node) -> None:
LoginException: If :py:meth:`login` has not been called.
Args:
node (gkeepapi.node.Node): The node to sync.
node: The node to sync.
Raises:
InvalidException: If the parent node is not found.
Expand All @@ -813,16 +813,16 @@ def find(
"""Find Notes based on the specified criteria.
Args:
query (Union[_sre.SRE_Pattern, str, None]): A str or regular expression to match against the title and text.
func (Union[callable, None]): A filter function.
labels (Union[List[str], None]): A list of label ids or objects to match. An empty list matches notes with no labels.
colors (Union[List[str], None]): A list of colors to match.
pinned (Union[bool, None]): Whether to match pinned notes.
archived (Union[bool, None]): Whether to match archived notes.
trashed (Union[bool, None]): Whether to match trashed notes.
query: A str or regular expression to match against the title and text.
func: A filter function.
labels: A list of label ids or objects to match. An empty list matches notes with no labels.
colors: A list of colors to match.
pinned: Whether to match pinned notes.
archived: Whether to match archived notes.
trashed: Whether to match trashed notes.
Return:
Generator[gkeepapi.node.TopLevelNode]: Results.
Search results.
"""
if labels is not None:
labels = [i.id if isinstance(i, _node.Label) else i for i in labels]
Expand Down Expand Up @@ -856,11 +856,11 @@ def createNote(self, title: Optional[str] = None, text: Optional[str] = None) ->
"""Create a new managed note. Any changes to the note will be uploaded when :py:meth:`sync` is called.
Args:
title (str): The title of the note.
text (str): The text of the note.
title: The title of the note.
text: The text of the note.
Returns:
gkeepapi.node.List: The new note.
The new note.
"""
node = _node.Note()
if title is not None:
Expand All @@ -874,11 +874,11 @@ def createList(self, title: Optional[str] = None, items: Optional[List[Tuple[str
"""Create a new list and populate it. Any changes to the note will be uploaded when :py:meth:`sync` is called.
Args:
title (str): The title of the list.
items (List[(str, bool)]): A list of tuples. Each tuple represents the text and checked status of the listitem.
title: The title of the list.
items: A list of tuples. Each tuple represents the text and checked status of the listitem.
Returns:
gkeepapi.node.List: The new list.
The new list.
"""
if items is None:
items = []
Expand All @@ -898,10 +898,10 @@ def createLabel(self, name: str) -> _node.Label:
"""Create a new label.
Args:
name (str): Label name.
name: Label name.
Returns:
gkeepapi.node.Label: The new label.
The new label.
Raises:
LabelException: If the label exists.
Expand All @@ -917,11 +917,11 @@ def findLabel(self, query: Union[re.Pattern, str], create=False) -> Optional[_no
"""Find a label with the given name.
Args:
name (Union[_sre.SRE_Pattern, str]): A str or regular expression to match against the name.
create (bool): Whether to create the label if it doesn't exist (only if name is a str).
name: A str or regular expression to match against the name.
create: Whether to create the label if it doesn't exist (only if name is a str).
Returns:
Union[gkeepapi.node.Label, None]: The label.
The label.
"""
is_str = isinstance(query, str)
name = None
Expand All @@ -941,18 +941,18 @@ def getLabel(self, label_id: str) -> Optional[_node.Label]:
"""Get an existing label.
Args:
label_id (str): Label id.
label_id: Label id.
Returns:
Union[gkeepapi.node.Label, None]: The label.
The label.
"""
return self._labels.get(label_id)

def deleteLabel(self, label_id: str) -> None:
"""Deletes a label.
Args:
label_id (str): Label id.
label_id: Label id.
"""
if label_id not in self._labels:
return
Expand All @@ -966,34 +966,34 @@ def labels(self) -> List[_node.Label]:
"""Get all labels.
Returns:
List[gkeepapi.node.Label]: Labels
Labels
"""
return self._labels.values()

def getMediaLink(self, blob: _node.Blob) -> str:
"""Get the canonical link to media.
Args:
blob (gkeepapi.node.Blob): The media resource.
blob: The media resource.
Returns:
str: A link to the media.
A link to the media.
"""
return self._media_api.get(blob)

def all(self) -> List[_node.TopLevelNode]:
"""Get all Notes.
Returns:
List[gkeepapi.node.TopLevelNode]: Notes
Notes
"""
return self._nodes[_node.Root.ID].children

def sync(self, resync=False) -> None:
"""Sync the local Keep tree with the server. If resyncing, local changes will be destroyed. Otherwise, local changes to notes, labels and reminders will be detected and synced up.
Args:
resync (bool): Whether to resync data.
resync: Whether to resync data.
Raises:
SyncException: If there is a consistency issue.
Expand Down

0 comments on commit 3c7cc55

Please sign in to comment.