@@ -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,7 +44,8 @@ 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 no records are defined"
47+ f'Setting all_records to True for zone { self .name } , because '
48+ f'no records are defined'
4849 )
4950 self .all_records = True
5051 self .services .acme = True
@@ -60,31 +61,32 @@ class ProxyConfigEnvironment(BaseModel):
6061 _zones_lookup : dict [str , ProxyConfigZone ] = {}
6162 metrics_proxy : bool = False
6263
63- @field_validator (" name" )
64+ @field_validator (' name' )
6465 @classmethod
6566 def name_defined (cls , v ):
6667 if len (v ) == 0 :
67- raise ValueError (" name must a non-empty string" )
68+ raise ValueError (' name must a non-empty string' )
6869 return v
6970
70- @field_validator (" token_sha512" )
71+ @field_validator (' token_sha512' )
7172 @classmethod
7273 def validate_token (cls , token_sha512 ):
7374 if len (token_sha512 ) != 128 :
74- raise ValueError (" A SHA512 hash must be 128 digits long" )
75+ raise ValueError (' A SHA512 hash must be 128 digits long' )
7576 return token_sha512
7677
7778 @model_validator (mode = 'after' )
7879 def validate_zones_or_global_read_only (self ):
7980 if not self .zones and not self .global_read_only :
80- raise ValueError (
81- "Either 'zones' must be non-empty or 'global_read_only' must be True"
81+ raise ValueError ( # noqa: Q003, Q000
82+ "Either 'zones' must be non-empty or 'global_read_only' " # noqa
83+ "must be True" # noqa
8284 )
8385 return self
8486
8587 def __init__ (self , ** data ):
8688 super ().__init__ (** data )
87-
89+
8890 # populate zones lookup
8991 for zone in self .zones :
9092 self ._zones_lookup [zone .name ] = zone
@@ -160,7 +162,8 @@ class ProxyConfig(BaseModel):
160162 <center>
161163 <h1>PowerDNS API Proxy</h1>
162164 <p><a href="/docs">Swagger Docs</a></p>
163- <q>The Domain Name Server (DNS) is the Achilles heel of the Web.<br>
165+ <q>The Domain Name Server (DNS) is the Achilles heel of the
166+ Web.<br>
164167 The important thing is that it's managed responsibly.</q>
165168 </center>
166169 </body>
@@ -169,18 +172,18 @@ class ProxyConfig(BaseModel):
169172 # Dictionary for fast token lookups
170173 token_env_map : dict [str , ProxyConfigEnvironment ] = {}
171174
172- @field_validator (" pdns_api_url" )
175+ @field_validator (' pdns_api_url' )
173176 @classmethod
174177 def api_url_defined (cls , v ):
175178 if len (v ) == 0 :
176- raise ValueError (" pdns_api_url must a non-empty string" )
179+ raise ValueError (' pdns_api_url must a non-empty string' )
177180 return v
178181
179- @field_validator (" pdns_api_token" )
182+ @field_validator (' pdns_api_token' )
180183 @classmethod
181184 def api_token_defined (cls , v ):
182185 if len (v ) == 0 :
183- raise ValueError (" pdns_api_token must a non-empty string" )
186+ raise ValueError (' pdns_api_token must a non-empty string' )
184187 return v
185188
186189 def __init__ (self , ** data ):
0 commit comments