Skip to content

Commit f2cc64c

Browse files
committed
build docs with pdoc
1 parent de19108 commit f2cc64c

4 files changed

Lines changed: 22 additions & 12 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ Pipfile.lock
1111
.idea
1212
.venv*
1313
TMPNOTES
14+
docs/

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ tag:
4646

4747
.PHONY: docs
4848
docs:
49-
lazydocs pykeepass --overview-file README.md
49+
pdoc -o docs --docformat google --no-search pykeepass '!pykeepass.icons'
5050
ghp-import -f -p -b docs docs

pykeepass/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1+
"""
2+
.. include:: ../README.md
3+
"""
4+
15
from .pykeepass import PyKeePass, create_database
6+
from .entry import Entry
7+
from .group import Group
8+
from .attachment import Attachment
9+
from .icons import icons as icons
210
from .version import __version__
311

4-
__all__ = ["PyKeePass", "create_database", "__version__"]
12+
__all__ = ["PyKeePass", "Entry", "Group", "Attachment", "icons", "create_database", "__version__"]

pykeepass/pykeepass.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
logger = logging.getLogger(__name__)
3232

33-
3433
BLANK_DATABASE_FILENAME = "blank_database.kdbx"
3534
BLANK_DATABASE_LOCATION = os.path.join(os.path.dirname(os.path.realpath(__file__)), BLANK_DATABASE_FILENAME)
3635
BLANK_DATABASE_PASSWORD = "password"
@@ -323,7 +322,7 @@ def dump_xml(self, filename):
323322
with open(filename, 'wb') as f:
324323
f.write(self.xml())
325324

326-
def _xpath(self, xpath_str, tree=None, first=False, cast=False, **kwargs):
325+
def xpath(self, xpath_str, tree=None, first=False, cast=False, **kwargs):
327326
"""Look up elements in the XML payload and return corresponding object.
328327
329328
Internal function which searches the payload lxml ElementTree for
@@ -332,18 +331,18 @@ def _xpath(self, xpath_str, tree=None, first=False, cast=False, **kwargs):
332331
is raised.
333332
334333
Args:
335-
xpath_str (str): XPath query for finding element(s)
336-
tree (:obj:`_ElementTree`, :obj:`Element`, optional): use this
334+
xpath_str (`str`): XPath query for finding element(s)
335+
tree (`_ElementTree`, `Element`, optional): use this
337336
element as root node when searching
338-
first (bool): If True, function returns first result or None. If
339-
False, function returns list of matches or empty list. Default
340-
is False.
341-
cast (bool): If True, matches are instead instantiated as
337+
first (`bool`): If True, function returns first result or None. If
338+
False, function returns list of matches or empty list.
339+
(default `False`).
340+
cast (`bool`): If True, matches are instead instantiated as
342341
pykeepass Group, Entry, or Attachment objects. An exception
343-
is raised if a match cannot be cast. Default is False.
342+
is raised if a match cannot be cast. (default `False`)
344343
345344
Returns:
346-
`Group`, `Entry`, `Attachment`, or `lxml.etree.Element`
345+
`list` of `Group`, `Entry`, `Attachment`, or `lxml.etree.Element`
347346
"""
348347

349348
if tree is None:
@@ -373,6 +372,8 @@ def _xpath(self, xpath_str, tree=None, first=False, cast=False, **kwargs):
373372

374373
return res
375374

375+
_xpath = xpath
376+
376377
def _find(self, prefix, keys_xp, path=None, tree=None, first=False,
377378
history=False, regex=False, flags=None, **kwargs):
378379
"""Internal function for converting a search into an XPath string"""

0 commit comments

Comments
 (0)