@@ -33,17 +33,13 @@ def __init__(
3333
3434 def check_compat_args (self ):
3535 version_re = re .compile (r"^etcd version:\s+(\d)\.(\d)" , re .I )
36- version_data = subprocess .check_output (
37- [self .proc_name , "--version" ]
38- ).decode ("utf-8" )
36+ version_data = subprocess .check_output ([self .proc_name , "--version" ]).decode ("utf-8" )
3937 match = version_re .match (version_data )
4038 if match is not None :
4139 etcd_version = (int (match .group (1 )), int (match .group (2 )))
4240 else :
4341 etcd_version = (0 , 0 )
44- if etcd_version [0 ] < 3 or (
45- etcd_version [0 ] == 3 and etcd_version [1 ] < 4
46- ):
42+ if etcd_version [0 ] < 3 or (etcd_version [0 ] == 3 and etcd_version [1 ] < 4 ):
4743 return []
4844 else :
4945 return ["--enable-v2=true" ]
@@ -70,9 +66,7 @@ def run(self, number=1, proc_args=[]):
7066 proc_args .extend (
7167 [
7268 "-initial-cluster" ,
73- "test-node-0=http://127.0.0.1:{}" .format (
74- self .internal_port_range_start
75- ),
69+ "test-node-0=http://127.0.0.1:{}" .format (self .internal_port_range_start ),
7670 "-initial-cluster-state" ,
7771 "new" ,
7872 ]
@@ -88,9 +82,7 @@ def stop(self):
8882
8983 def add_one (self , slot , proc_args = None ):
9084 log = logging .getLogger ()
91- directory = tempfile .mkdtemp (
92- dir = self .base_directory , prefix = "python-etcd.%d-" % slot
93- )
85+ directory = tempfile .mkdtemp (dir = self .base_directory , prefix = "python-etcd.%d-" % slot )
9486
9587 log .debug ("Created directory %s" % directory )
9688 client = "%s127.0.0.1:%d" % (self .schema , self .port_range_start + slot )
@@ -193,16 +185,10 @@ def create_test_ca_certificate(cls, cert_path, key_path, cn=None):
193185 cert .sign (k , "sha1" )
194186
195187 with open (cert_path , "w" ) as f :
196- f .write (
197- crypto .dump_certificate (crypto .FILETYPE_PEM , cert ).decode (
198- "utf-8"
199- )
200- )
188+ f .write (crypto .dump_certificate (crypto .FILETYPE_PEM , cert ).decode ("utf-8" ))
201189
202190 with open (key_path , "w" ) as f :
203- f .write (
204- crypto .dump_privatekey (crypto .FILETYPE_PEM , k ).decode ("utf-8" )
205- )
191+ f .write (crypto .dump_privatekey (crypto .FILETYPE_PEM , k ).decode ("utf-8" ))
206192
207193 return cert , k
208194
@@ -231,9 +217,7 @@ def create_test_certificate(cls, ca, ca_key, cert_path, key_path, cn=None):
231217 crypto .X509Extension (
232218 "keyUsage" .encode ("ascii" ),
233219 False ,
234- "nonRepudiation,digitalSignature,keyEncipherment" .encode (
235- "ascii"
236- ),
220+ "nonRepudiation,digitalSignature,keyEncipherment" .encode ("ascii" ),
237221 ),
238222 crypto .X509Extension (
239223 "extendedKeyUsage" .encode ("ascii" ),
@@ -257,13 +241,7 @@ def create_test_certificate(cls, ca, ca_key, cert_path, key_path, cn=None):
257241 cert .sign (ca_key , "sha1" )
258242
259243 with open (cert_path , "w" ) as f :
260- f .write (
261- crypto .dump_certificate (crypto .FILETYPE_PEM , cert ).decode (
262- "utf-8"
263- )
264- )
244+ f .write (crypto .dump_certificate (crypto .FILETYPE_PEM , cert ).decode ("utf-8" ))
265245
266246 with open (key_path , "w" ) as f :
267- f .write (
268- crypto .dump_privatekey (crypto .FILETYPE_PEM , k ).decode ("utf-8" )
269- )
247+ f .write (crypto .dump_privatekey (crypto .FILETYPE_PEM , k ).decode ("utf-8" ))
0 commit comments