File tree Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Original file line number Diff line number Diff line change 10
10
11
11
12
12
class FilterModule (object ):
13
+
13
14
"""Define useful filter in collection."""
14
15
15
16
def filters (self ):
@@ -19,25 +20,26 @@ def filters(self):
19
20
:rtype: dict
20
21
"""
21
22
return {
22
- 'is_subnet' : self . is_subnet ,
23
+ 'is_subnet' : is_subnet ,
23
24
}
24
25
25
- def is_subnet (self , children , parent ):
26
- """Check if a subnet belongs to another.
27
26
28
- First argument is a subnet second another. If the first subnet belongs to second
27
+ def is_subnet (children , parent ):
28
+ """Check if a subnet belongs to another.
29
29
30
- :param children: [description]
31
- :type children: [type]
32
- :param parent: [description]
33
- :type parent: [type]
34
- :return: [description]
35
- :rtype: [type]
36
- """
37
- c = ipaddress .ip_network (children )
38
- p = ipaddress .ip_network (parent )
30
+ First argument is a subnet second another. If the first subnet belongs to second
31
+
32
+ :param children: [description]
33
+ :type children: [type]
34
+ :param parent: [description]
35
+ :type parent: [type]
36
+ :return: [description]
37
+ :rtype: [type]
38
+ """
39
+ c = ipaddress .ip_network (children )
40
+ p = ipaddress .ip_network (parent )
39
41
40
- if not c .subnet_of (p ) or c == p :
41
- return False
42
- else :
43
- return c .subnet_of (p )
42
+ if not c .subnet_of (p ) or c == p :
43
+ return False
44
+ else :
45
+ return c .subnet_of (p )
You can’t perform that action at this time.
0 commit comments