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 1010
1111
1212class FilterModule (object ):
13+
1314 """Define useful filter in collection."""
1415
1516 def filters (self ):
@@ -19,25 +20,26 @@ def filters(self):
1920 :rtype: dict
2021 """
2122 return {
22- 'is_subnet' : self . is_subnet ,
23+ 'is_subnet' : is_subnet ,
2324 }
2425
25- def is_subnet (self , children , parent ):
26- """Check if a subnet belongs to another.
2726
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.
2929
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 )
3941
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