pylint: yield from

This commit is contained in:
The MMGen Project 2024-09-20 09:36:05 +00:00
commit 70bc4ffa8f
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
6 changed files with 8 additions and 16 deletions

View file

@ -41,8 +41,7 @@ class AddrIdxList(tuple,InitErrors,MMGenObject):
elif len(j) == 2:
if j[0] > j[1]:
raise ValueError(f'{i}: invalid range')
for k in range(j[0], j[1] + 1):
yield k
yield from range(j[0], j[1] + 1)
else:
raise ValueError(f'{i}: invalid range')
idx_list = tuple(gen())

View file

@ -163,8 +163,7 @@ class coin_msg:
for n,(k,v) in enumerate(self.sigs.items()):
yield ''
yield f'{n+1:>3}) {k}'
for res in gen_entry(v):
yield res
yield from gen_entry(v)
def gen_single():
for k,v in hdr_data.items():
@ -176,8 +175,7 @@ class coin_msg:
MMGenID(self.proto,req_addr) )
if k not in self.sigs:
die(1,f'{k}: address not found in signature data')
for res in gen_entry(self.sigs[k]):
yield res
yield from gen_entry(self.sigs[k])
hdr_data = {
'message': ('Message:', grnbg ),

View file

@ -213,13 +213,11 @@ class RPCBackends:
def gen_opts():
for k,v in caller.http_hdrs.items():
for s in ('--header',f'{k}: {v}'):
yield s
yield from ('--header', f'{k}: {v}')
if caller.auth_type:
# Authentication with curl is insecure, as it exposes the user's credentials
# via the command line. Use for testing only.
for s in ('--user',f'{caller.auth.user}:{caller.auth.passwd}'):
yield s
yield from ('--user', f'{caller.auth.user}:{caller.auth.passwd}')
if caller.auth_type == 'digest':
yield '--digest'
if caller.network_proto == 'https' and caller.verify_server is False:

View file

@ -106,8 +106,7 @@ def make_help(cfg,proto,opts_data,opt_filter):
if 'notes' in c:
arg_tuple = tuple(gen_arg_tuple(c['notes'],notes_text))
notes_text = c['notes'](*arg_tuple)
for line in notes_text.splitlines():
yield line
yield from notes_text.splitlines()
return nl.join(gen_text()) + '\n'

View file

@ -429,8 +429,7 @@ def get_subclasses(cls,names=False):
def gen(cls):
for i in cls.__subclasses__():
yield i
for j in gen(i):
yield j
yield from gen(i)
return tuple((c.__name__ for c in gen(cls)) if names else gen(cls))
def async_run(coro):

View file

@ -95,8 +95,7 @@ class xmrseed(baseconv):
def gen():
for i in range(len(bytestr)//4):
for e in num2base_monero( int.from_bytes( bytestr[i*4:i*4+4][::-1], 'big' ) ):
yield e
yield from num2base_monero(int.from_bytes( bytestr[i*4:i*4+4][::-1], 'big' ))
o = list(gen())
o.append( self.monero_mn_checksum(o) )