Skip to content

Commit 8617ab2

Browse files
committed
Revert "Addressing PR comments"
This reverts commit 759b573.
1 parent 759b573 commit 8617ab2

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

powerdns_api_proxy/models.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ProxyConfigZone(BaseModel):
3131

3232
name: str
3333
regex: bool = False
34-
description: str = ''
34+
description: str = ""
3535
records: list[str] = []
3636
regex_records: list[str] = []
3737
services: ProxyConfigServices = ProxyConfigServices(acme=False)
@@ -44,8 +44,7 @@ def __init__(self, **data):
4444
super().__init__(**data)
4545
if len(self.records) == 0 and len(self.regex_records) == 0:
4646
logger.debug(
47-
f'Setting all_records to True for zone {self.name}, because '
48-
f'no records are defined'
47+
f"Setting all_records to True for zone {self.name}, because no records are defined"
4948
)
5049
self.all_records = True
5150
self.services.acme = True
@@ -61,32 +60,31 @@ class ProxyConfigEnvironment(BaseModel):
6160
_zones_lookup: dict[str, ProxyConfigZone] = {}
6261
metrics_proxy: bool = False
6362

64-
@field_validator('name')
63+
@field_validator("name")
6564
@classmethod
6665
def name_defined(cls, v):
6766
if len(v) == 0:
68-
raise ValueError('name must a non-empty string')
67+
raise ValueError("name must a non-empty string")
6968
return v
7069

71-
@field_validator('token_sha512')
70+
@field_validator("token_sha512")
7271
@classmethod
7372
def validate_token(cls, token_sha512):
7473
if len(token_sha512) != 128:
75-
raise ValueError('A SHA512 hash must be 128 digits long')
74+
raise ValueError("A SHA512 hash must be 128 digits long")
7675
return token_sha512
7776

7877
@model_validator(mode='after')
7978
def validate_zones_or_global_read_only(self):
8079
if not self.zones and not self.global_read_only:
81-
raise ValueError( # noqa: Q003, Q000
82-
"Either 'zones' must be non-empty or 'global_read_only' " # noqa
83-
"must be True" # noqa
80+
raise ValueError(
81+
"Either 'zones' must be non-empty or 'global_read_only' must be True"
8482
)
8583
return self
8684

8785
def __init__(self, **data):
8886
super().__init__(**data)
89-
87+
9088
# populate zones lookup
9189
for zone in self.zones:
9290
self._zones_lookup[zone.name] = zone
@@ -162,8 +160,7 @@ class ProxyConfig(BaseModel):
162160
<center>
163161
<h1>PowerDNS API Proxy</h1>
164162
<p><a href="/docs">Swagger Docs</a></p>
165-
<q>The Domain Name Server (DNS) is the Achilles heel of the
166-
Web.<br>
163+
<q>The Domain Name Server (DNS) is the Achilles heel of the Web.<br>
167164
The important thing is that it's managed responsibly.</q>
168165
</center>
169166
</body>
@@ -172,18 +169,18 @@ class ProxyConfig(BaseModel):
172169
# Dictionary for fast token lookups
173170
token_env_map: dict[str, ProxyConfigEnvironment] = {}
174171

175-
@field_validator('pdns_api_url')
172+
@field_validator("pdns_api_url")
176173
@classmethod
177174
def api_url_defined(cls, v):
178175
if len(v) == 0:
179-
raise ValueError('pdns_api_url must a non-empty string')
176+
raise ValueError("pdns_api_url must a non-empty string")
180177
return v
181178

182-
@field_validator('pdns_api_token')
179+
@field_validator("pdns_api_token")
183180
@classmethod
184181
def api_token_defined(cls, v):
185182
if len(v) == 0:
186-
raise ValueError('pdns_api_token must a non-empty string')
183+
raise ValueError("pdns_api_token must a non-empty string")
187184
return v
188185

189186
def __init__(self, **data):

0 commit comments

Comments
 (0)