11import random
2+ from typing import Iterable , Optional
3+
4+ from lxml .etree import Element
25
36from pyff .constants import NS , config
47from pyff .logs import get_log
58from pyff .resource import Resource , ResourceOpts
69from pyff .samlmd import entitiesdescriptor , root
7- from pyff .store import make_icon_store_instance , make_store_instance
10+ from pyff .store import SAMLStoreBase , make_icon_store_instance , make_store_instance
811from pyff .utils import is_text , make_default_scheduler
912
1013log = get_log (__name__ )
@@ -43,17 +46,14 @@ def _lookup(self, member, store=None):
4346 log .debug ("calling store lookup %s" % member )
4447 return store .lookup (member )
4548
46- def lookup (self , member , xp = None , store = None ):
49+ def lookup (self , member : str , xp : str = None , store : Optional [ SAMLStoreBase ] = None ) -> Iterable [ Element ] :
4750 """
4851 Lookup elements in the working metadata repository
4952
5053 :param member: A selector (cf below)
51- :type member: basestring
5254 :param xp: An optional xpath filter
53- :type xp: basestring
5455 :param store: the store to operate on
5556 :return: An iterable of EntityDescriptor elements
56- :rtype: etree.Element
5757
5858
5959 **Selector Syntax**
@@ -67,7 +67,7 @@ def lookup(self, member, xp=None, store=None):
6767 The first form results in the intersection of the results of doing a lookup on the selectors. The second form
6868 results in the EntityDescriptor elements from the source (defaults to all EntityDescriptors) that match the
6969 xpath expression. The attribute-value forms results in the EntityDescriptors that contain the specified entity
70- attribute pair. If non of these forms apply, the lookup is done using either source ID (normally @Name from
70+ attribute pair. If none of these forms apply, the lookup is done using either source ID (normally @Name from
7171 the EntitiesDescriptor) or the entityID of single EntityDescriptors. If member is a URI but isn't part of
7272 the metadata repository then it is fetched an treated as a list of (one per line) of selectors. If all else
7373 fails an empty list is returned.
0 commit comments