new: dev: annotation for some function

This commit is contained in:
rachmadaniHaryono 2019-05-14 04:55:23 +08:00
parent 695c45158a
commit 26e33f87d3

26
buku
View File

@ -749,13 +749,13 @@ class BukuDb:
def update_rec( def update_rec(
self, self,
index, index: int,
url=None, url: Optional[str] = None,
title_in=None, title_in: Optional[str] = None,
tags_in=None, tags_in: Optional[str] = None,
desc=None, desc: Optional[str] = None,
immutable=-1, immutable: Optional[int] = -1,
threads=4): threads: Optional[int]=4) -> bool:
"""Update an existing record at index. """Update an existing record at index.
Update all records if index is 0 and url is not specified. Update all records if index is 0 and url is not specified.
@ -786,7 +786,7 @@ class BukuDb:
True on success, False on Failure. True on success, False on Failure.
""" """
arguments = [] arguments = [] # type: List[Any]
query = 'UPDATE bookmarks SET' query = 'UPDATE bookmarks SET'
to_update = False to_update = False
tag_modified = False tag_modified = False
@ -1163,7 +1163,13 @@ class BukuDb:
return None return None
return self.cur.fetchall() return self.cur.fetchall()
def searchdb(self, keywords, all_keywords=False, deep=False, regex=False): def searchdb(
self,
keywords: List[str],
all_keywords: Optional[bool] = False,
deep: Optional[bool] = False,
regex: Optional[bool] = False
) -> Union[List[Any], None]:
"""Search DB for entries where tags, URL, or title fields match keywords. """Search DB for entries where tags, URL, or title fields match keywords.
Parameters Parameters
@ -1196,7 +1202,7 @@ class BukuDb:
'URL REGEXP ? OR ' 'URL REGEXP ? OR '
'metadata REGEXP ? OR ' 'metadata REGEXP ? OR '
'desc REGEXP ?) ') 'desc REGEXP ?) ')
qargs = [] qargs = [] # type: List[Any]
case_statement = lambda x: 'CASE WHEN ' + x + ' THEN 1 ELSE 0 END' case_statement = lambda x: 'CASE WHEN ' + x + ' THEN 1 ELSE 0 END'
if regex: if regex: