1
1
import random
2
+ from typing import Iterable , Optional
3
+
4
+ from lxml .etree import Element
2
5
3
6
from pyff .constants import NS , config
4
7
from pyff .logs import get_log
5
8
from pyff .resource import Resource , ResourceOpts
6
9
from 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
8
11
from pyff .utils import is_text , make_default_scheduler
9
12
10
13
log = get_log (__name__ )
@@ -43,17 +46,14 @@ def _lookup(self, member, store=None):
43
46
log .debug ("calling store lookup %s" % member )
44
47
return store .lookup (member )
45
48
46
- def lookup (self , member , xp = None , store = None ):
49
+ def lookup (self , member : str , xp : str = None , store : Optional [ SAMLStoreBase ] = None ) -> Iterable [ Element ] :
47
50
"""
48
51
Lookup elements in the working metadata repository
49
52
50
53
:param member: A selector (cf below)
51
- :type member: basestring
52
54
:param xp: An optional xpath filter
53
- :type xp: basestring
54
55
:param store: the store to operate on
55
56
:return: An iterable of EntityDescriptor elements
56
- :rtype: etree.Element
57
57
58
58
59
59
**Selector Syntax**
@@ -67,7 +67,7 @@ def lookup(self, member, xp=None, store=None):
67
67
The first form results in the intersection of the results of doing a lookup on the selectors. The second form
68
68
results in the EntityDescriptor elements from the source (defaults to all EntityDescriptors) that match the
69
69
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
71
71
the EntitiesDescriptor) or the entityID of single EntityDescriptors. If member is a URI but isn't part of
72
72
the metadata repository then it is fetched an treated as a list of (one per line) of selectors. If all else
73
73
fails an empty list is returned.
0 commit comments