1
1
# coding=utf-8
2
- import collections
2
+ try :
3
+ from collections import Iterable
4
+ except :
5
+ from collections .abc import Iterable
3
6
import csv
4
7
import io
5
8
import itertools
@@ -1320,7 +1323,7 @@ def get_rule_documentation_by_device_id_and_rule_id(self, device_id, rule_id):
1320
1323
def get_rule_base (self , get_documentation = False , device_ids = None ):
1321
1324
"""Get the rules for each of the devices configured in SecureTrack.
1322
1325
1323
- :type device_ids: collections. Iterable[int]
1326
+ :type device_ids: Iterable[int]
1324
1327
:param device_ids: If specified, get the rule base only for the specified devices.
1325
1328
:param get_documentation: Whether or not to get the rule documentation together with the rule base.
1326
1329
:type get_documentation: bool
@@ -2140,13 +2143,13 @@ def get_services_by_device_and_object_ids(self, device_id, service_ids):
2140
2143
:param device_id: The device ID for which we want to get network objects.
2141
2144
:type device_id: int
2142
2145
:param service_ids: The ID of the service
2143
- :type service_ids: int|collections. Iterable[int]
2146
+ :type service_ids: int|Iterable[int]
2144
2147
:return: The service for the specified device with the specified ID.
2145
2148
:rtype: Single_Service|Group_Service
2146
2149
:raise ValueError: If a device with the specified ID does not exist.
2147
2150
:raise IOError: If there was a communication problem trying to get the network objects.
2148
2151
"""
2149
- if isinstance (service_ids , collections . Iterable ):
2152
+ if isinstance (service_ids , Iterable ):
2150
2153
service_ids = "," .join ([str (service_id ) for service_id in service_ids ])
2151
2154
logger .info ("Getting service with ID %s for device %s." , service_ids , device_id )
2152
2155
try :
@@ -2169,13 +2172,13 @@ def get_services_by_revision_and_object_ids(self, revision_id, service_ids=""):
2169
2172
:param revision_id: The revision ID for which we want to get network objects.
2170
2173
:type revision_id: int
2171
2174
:param service_ids: The ID of the service
2172
- :type service_ids: int|collections. Iterable[int]
2175
+ :type service_ids: int|Iterable[int]
2173
2176
:return: The service for the specified revision with the specified ID.
2174
2177
:rtype: Services_List
2175
2178
:raise ValueError: If a revision with the specified ID does not exist.
2176
2179
:raise IOError: If there was a communication problem trying to get the services.
2177
2180
"""
2178
- if isinstance (service_ids , collections . Iterable ):
2181
+ if isinstance (service_ids , Iterable ):
2179
2182
service_ids = "," .join ([str (service_id ) for service_id in service_ids ])
2180
2183
logger .info ("Getting service with ID %s for revision %s." , service_ids , revision_id )
2181
2184
try :
@@ -2198,14 +2201,14 @@ def get_network_objects_by_revision_and_object_ids(self, revision_id, network_ob
2198
2201
:param revision_id: The revision ID for which we want to get network objects.
2199
2202
:type revision_id: int
2200
2203
:param network_object_ids: The ID of the network object to get
2201
- :type network_object_ids: int|collections. Iterable[int]
2204
+ :type network_object_ids: int|Iterable[int]
2202
2205
:return: The network objects for the specified revision.
2203
2206
:rtype: Network_Objects_List
2204
2207
:raise ValueError: If a revision with the specified ID does not exist.
2205
2208
:raise IOError: Ifp there was a communication problem trying to get the network objects.
2206
2209
"""
2207
2210
logger .info ("Getting network object with ID %s for revision %s." , network_object_ids , revision_id )
2208
- if isinstance (network_object_ids , collections . Iterable ):
2211
+ if isinstance (network_object_ids , Iterable ):
2209
2212
network_object_ids = "," .join ([str (network_object_id ) for network_object_id in network_object_ids ])
2210
2213
try :
2211
2214
response_string = self .get_uri (
@@ -2227,14 +2230,14 @@ def get_network_objects_by_device_and_object_ids(self, device_id, network_object
2227
2230
:param device_id: The device ID for which we want to get network objects.
2228
2231
:type device_id: int
2229
2232
:param network_object_ids: The ID of the network object to get
2230
- :type network_object_ids: int|collections. Iterable[int]
2233
+ :type network_object_ids: int|Iterable[int]
2231
2234
:return: The network objects for the specified device.
2232
2235
:rtype: Network_Objects_List
2233
2236
:raise ValueError: If a device with the specified ID does not exist.
2234
2237
:raise IOError: Ifp there was a communication problem trying to get the network objects.
2235
2238
"""
2236
2239
logger .info ("Getting network object with ID %s for device %s." , network_object_ids , device_id )
2237
- if isinstance (network_object_ids , collections . Iterable ):
2240
+ if isinstance (network_object_ids , Iterable ):
2238
2241
network_object_ids = "," .join ([str (network_object_id ) for network_object_id in network_object_ids ])
2239
2242
try :
2240
2243
response_string = self .get_uri (
0 commit comments