Skip to content

Commit f5a9a7e

Browse files
author
Pedro Angelo
committed
formatting
1 parent 76eee72 commit f5a9a7e

4 files changed

Lines changed: 79 additions & 61 deletions

File tree

ns1/__init__.py

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,13 @@ def loadZone(self, zone, callback=None, errback=None):
248248
return zone.load(callback=callback, errback=errback)
249249

250250
def searchZone(
251-
self, query, type="all", expand=True, max=None, callback=None, errback=None,
251+
self,
252+
query,
253+
type="all",
254+
expand=True,
255+
max=None,
256+
callback=None,
257+
errback=None,
252258
):
253259
"""
254260
This method was updated since NS1 deprecated v1/search/zones
@@ -261,11 +267,12 @@ def searchZone(
261267
:return: list of zones searched
262268
"""
263269
from ns1.rest.zones import Zones
270+
264271
rest_zone = Zones(self.config)
265272
return rest_zone.search(query, type, expand, max, callback, errback)
266273

267274
def createZone(
268-
self, zone, zoneFile=None, callback=None, errback=None, **kwargs
275+
self, zone, zoneFile=None, callback=None, errback=None, **kwargs
269276
):
270277
"""
271278
Create a new zone, and return an associated high level Zone object.
@@ -293,7 +300,7 @@ def createZone(
293300
)
294301

295302
def loadRecord(
296-
self, domain, type, zone=None, callback=None, errback=None, **kwargs
303+
self, domain, type, zone=None, callback=None, errback=None, **kwargs
297304
):
298305
"""
299306
Load an existing record into a high level Record object.
@@ -370,7 +377,7 @@ def loadNetworkbyName(self, name, callback=None, errback=None):
370377
return network.load(callback=callback, errback=errback)
371378

372379
def createNetwork(
373-
self, name, scope_group_id=None, callback=None, errback=None, **kwargs
380+
self, name, scope_group_id=None, callback=None, errback=None, **kwargs
374381
):
375382
"""
376383
Create a new Network
@@ -403,7 +410,7 @@ def loadAddressbyID(self, id, callback=None, errback=None):
403410
return address.load(callback=callback, errback=errback)
404411

405412
def loadAddressbyPrefix(
406-
self, prefix, status, network_id, callback=None, errback=None
413+
self, prefix, status, network_id, callback=None, errback=None
407414
):
408415
"""
409416
Load an existing address by prefix, status and network into a high level Address object
@@ -422,7 +429,7 @@ def loadAddressbyPrefix(
422429
return address.load(callback=callback, errback=errback)
423430

424431
def createAddress(
425-
self, prefix, status, network_id, callback=None, errback=None, **kwargs
432+
self, prefix, status, network_id, callback=None, errback=None, **kwargs
426433
):
427434
"""
428435
Create a new Address
@@ -454,14 +461,14 @@ def loadScopeGroup(self, id, callback=None, errback=None):
454461
return scope_group.load(callback=callback, errback=errback)
455462

456463
def createScopeGroup(
457-
self,
458-
name,
459-
service_def_id,
460-
dhcp4,
461-
dhcp6,
462-
callback=None,
463-
errback=None,
464-
**kwargs
464+
self,
465+
name,
466+
service_def_id,
467+
dhcp4,
468+
dhcp6,
469+
callback=None,
470+
errback=None,
471+
**kwargs
465472
):
466473
"""
467474
Create a new Scope Group
@@ -487,14 +494,14 @@ def createScopeGroup(
487494
)
488495

489496
def createReservation(
490-
self,
491-
scopegroup_id,
492-
address_id,
493-
mac,
494-
dhcp_options=None,
495-
callback=None,
496-
errback=None,
497-
**kwargs
497+
self,
498+
scopegroup_id,
499+
address_id,
500+
mac,
501+
dhcp_options=None,
502+
callback=None,
503+
errback=None,
504+
**kwargs
498505
):
499506
"""
500507
Create a new Reservation
@@ -518,12 +525,12 @@ def createReservation(
518525
return reservation.create(callback=callback, errback=errback, **kwargs)
519526

520527
def loadReservation(
521-
self,
522-
scopegroup_id,
523-
address_id,
524-
reservation_id=None,
525-
callback=None,
526-
errback=None,
528+
self,
529+
scopegroup_id,
530+
address_id,
531+
reservation_id=None,
532+
callback=None,
533+
errback=None,
527534
):
528535
import ns1.ipam
529536

@@ -534,13 +541,13 @@ def loadReservation(
534541
return reservation.load(callback=callback, errback=errback)
535542

536543
def createScope(
537-
self,
538-
scopegroup_id,
539-
address_id,
540-
dhcp_options=None,
541-
callback=None,
542-
errback=None,
543-
**kwargs
544+
self,
545+
scopegroup_id,
546+
address_id,
547+
dhcp_options=None,
548+
callback=None,
549+
errback=None,
550+
**kwargs
544551
):
545552
"""
546553
Create a new Scope
@@ -559,7 +566,7 @@ def createScope(
559566
return scope.create(callback=callback, errback=errback, **kwargs)
560567

561568
def loadScope(
562-
self, scopegroup_id, address_id, callback=None, errback=None
569+
self, scopegroup_id, address_id, callback=None, errback=None
563570
):
564571
import ns1.ipam
565572

@@ -568,13 +575,13 @@ def loadScope(
568575
return scope.load(callback=callback, errback=errback)
569576

570577
def loadLeases(
571-
self,
572-
scope_group_id=None,
573-
scope_id=None,
574-
limit=None,
575-
offset=None,
576-
callback=None,
577-
errback=None,
578+
self,
579+
scope_group_id=None,
580+
scope_id=None,
581+
limit=None,
582+
offset=None,
583+
callback=None,
584+
errback=None,
578585
):
579586
import ns1.ipam
580587

ns1/helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from threading import Lock
44

5+
56
class SingletonMixin(object):
67
"""double-locked thread safe singleton"""
78

ns1/rest/zones.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def _buildBody(self, zone, **kwargs):
2929
return body
3030

3131
def import_file(
32-
self, zone, zoneFile, callback=None, errback=None, **kwargs
32+
self, zone, zoneFile, callback=None, errback=None, **kwargs
3333
):
3434
files = [("zonefile", (zoneFile, open(zoneFile, "rb"), "text/plain"))]
3535
return self._make_request(
@@ -86,8 +86,18 @@ def retrieve(self, zone, callback=None, errback=None):
8686
pagination_handler=zone_retrieve_pagination,
8787
)
8888

89-
def search(self, query, type="all", expand=True, max=None, callback=None, errback=None):
90-
request = "{}?q={}&type={}&expand={}".format(self.SEARCH_ROOT, query, type, expand)
89+
def search(
90+
self,
91+
query,
92+
type="all",
93+
expand=True,
94+
max=None,
95+
callback=None,
96+
errback=None,
97+
):
98+
request = "{}?q={}&type={}&expand={}".format(
99+
self.SEARCH_ROOT, query, type, expand
100+
)
91101
if max is not None:
92102
request += "&max=" + str(max)
93103
return self._make_request(

ns1/zones.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def add_X(domain, answers, callback=None, errback=None, **kwargs):
138138
return add_X
139139

140140
def createLinkToSelf(
141-
self, new_zone, callback=None, errback=None, **kwargs
141+
self, new_zone, callback=None, errback=None, **kwargs
142142
):
143143
"""
144144
Create a new linked zone, linking to ourselves. All records in this
@@ -152,13 +152,13 @@ def createLinkToSelf(
152152
return zone.create(callback=callback, errback=errback, **kwargs)
153153

154154
def linkRecord(
155-
self,
156-
existing_domain,
157-
new_domain,
158-
rtype,
159-
callback=None,
160-
errback=None,
161-
**kwargs
155+
self,
156+
existing_domain,
157+
new_domain,
158+
rtype,
159+
callback=None,
160+
errback=None,
161+
**kwargs
162162
):
163163

164164
"""
@@ -188,13 +188,13 @@ def linkRecord(
188188
)
189189

190190
def cloneRecord(
191-
self,
192-
existing_domain,
193-
new_domain,
194-
rtype,
195-
zone=None,
196-
callback=None,
197-
errback=None,
191+
self,
192+
existing_domain,
193+
new_domain,
194+
rtype,
195+
zone=None,
196+
callback=None,
197+
errback=None,
198198
):
199199
"""
200200
Clone the given record to a new record such that their configs are

0 commit comments

Comments
 (0)