3030
3131logger = logging .getLogger (__name__ )
3232
33-
3433BLANK_DATABASE_FILENAME = "blank_database.kdbx"
3534BLANK_DATABASE_LOCATION = os .path .join (os .path .dirname (os .path .realpath (__file__ )), BLANK_DATABASE_FILENAME )
3635BLANK_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