ruff: set, dict comprehensions
This commit is contained in:
parent
414769baef
commit
7b111c17e4
2 changed files with 6 additions and 5 deletions
|
|
@ -151,7 +151,7 @@ class BlocksInfo:
|
|||
def parse_cslist(cls, uarg, full_set, dfl_set, desc):
|
||||
|
||||
def make_list(m, func):
|
||||
groups_lc = [set(e.lower() for e in gi.split(',')) for gi in m.groups()]
|
||||
groups_lc = [{e.lower() for e in gi.split(',')} for gi in m.groups()]
|
||||
for group in groups_lc:
|
||||
for e in group:
|
||||
if e not in full_set_lc:
|
||||
|
|
@ -159,8 +159,8 @@ class BlocksInfo:
|
|||
# display elements in order:
|
||||
return [e for e in full_set if e.lower() in func(groups_lc)]
|
||||
|
||||
full_set_lc = set(e.lower() for e in full_set)
|
||||
dfl_set_lc = set(e.lower() for e in dfl_set)
|
||||
full_set_lc = {e.lower() for e in full_set}
|
||||
dfl_set_lc = {e.lower() for e in dfl_set}
|
||||
cspat = r'(\w+(?:,\w+)*)'
|
||||
|
||||
for pat, func in (
|
||||
|
|
|
|||
|
|
@ -308,8 +308,9 @@ class fake_data:
|
|||
|
||||
def gen_blocks_data(iterations):
|
||||
for peer,blocks_str in fake_data.blocks.items():
|
||||
iter_strs = dict([s.lstrip().split(maxsplit=1) for s in blocks_str.strip().split('\n') if ' ' in s])
|
||||
yield (peer,dict((i,iter_strs.get(i,'').split()) for i in iterations))
|
||||
iter_strs = dict(s.lstrip().split(maxsplit=1)
|
||||
for s in blocks_str.strip().split('\n') if ' ' in s)
|
||||
yield (peer, {i: iter_strs.get(i,'').split() for i in iterations})
|
||||
|
||||
def make_peerinfo(peer_id,blocks,iter_no):
|
||||
d = address_data[peer_id]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue