21
21
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22
22
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23
23
# POSSIBILITY OF SUCH DAMAGE.
24
- from typing import List , Union , Iterable
25
24
import re
26
- import libiocage .lib .Jail
25
+ from typing import Iterable , List , Union
26
+
27
27
import libiocage .lib .errors
28
+ import libiocage .lib .Jail
28
29
29
30
30
31
def match_filter (value : str , filter_string : str ):
@@ -54,7 +55,7 @@ def __init__(self, key, values=list()):
54
55
55
56
list .__init__ (self , data )
56
57
57
- def matches_jail (self , jail : libiocage .lib .Jail .JailGenerator ) -> bool :
58
+ def matches_jail (self , jail : ' libiocage.lib.Jail.JailGenerator' ) -> bool :
58
59
return self .matches (jail .getstring (self .key ))
59
60
60
61
def matches (self , value : str ) -> bool :
@@ -83,7 +84,7 @@ def _filter_string_has_globs(self, filter_string: str) -> bool:
83
84
return False
84
85
85
86
def _split_filter_values (self , user_input : str ) -> List [str ]:
86
- values = []
87
+ values : List [ str ] = []
87
88
escaped_comma_blocks = map (
88
89
lambda block : block .split ("," ),
89
90
user_input .split ("\\ ," )
@@ -124,9 +125,9 @@ class Terms(list):
124
125
This can be interpreted as logical AND
125
126
"""
126
127
127
- def __init__ (self , terms : Iterable [Union [Term , str ]]= None ):
128
+ def __init__ (self , terms : Iterable [Union [Term , str ]]= None ) -> None :
128
129
129
- data = []
130
+ data : List [ Union [ Term , str ]] = []
130
131
131
132
if terms is not None :
132
133
@@ -138,7 +139,7 @@ def __init__(self, terms: Iterable[Union[Term, str]]=None):
138
139
139
140
list .__init__ (self , data )
140
141
141
- def match_jail (self , jail : libiocage .lib .Jail .JailGenerator ) -> bool :
142
+ def match_jail (self , jail : ' libiocage.lib.Jail.JailGenerator' ) -> bool :
142
143
"""
143
144
Returns True if all Terms match the jail
144
145
"""
0 commit comments