assignment expressions (3 files)
This commit is contained in:
parent
df5d6e3bce
commit
0869482874
3 changed files with 5 additions and 8 deletions
|
|
@ -79,11 +79,9 @@ class cfg_file:
|
|||
def get_lines(self):
|
||||
def gen_lines():
|
||||
for lineno, line in enumerate(self.data, 1):
|
||||
line = strip_comment(line)
|
||||
if line == '':
|
||||
if (line := strip_comment(line)) == '':
|
||||
continue
|
||||
m = re.fullmatch(r'(\w+)(\s+)(.*)', line)
|
||||
if m:
|
||||
if m := re.fullmatch(r'(\w+)(\s+)(.*)', line):
|
||||
yield self.line_data(m[1], m[3], lineno, None)
|
||||
else:
|
||||
die('CfgFileParseError', f'Parse error in file {self.fn!r}, line {lineno}')
|
||||
|
|
|
|||
|
|
@ -69,8 +69,7 @@ class New:
|
|||
def get_unspent_nums_from_user(self, unspent):
|
||||
from ....ui import line_input
|
||||
while True:
|
||||
reply = line_input(self.cfg, 'Enter an account to spend from: ').strip()
|
||||
if reply:
|
||||
if reply := line_input(self.cfg, 'Enter an account to spend from: ').strip():
|
||||
if not is_int(reply):
|
||||
msg('Account number must be an integer')
|
||||
elif int(reply) < 1:
|
||||
|
|
|
|||
|
|
@ -120,8 +120,8 @@ def int2bytespec(n, spec, fmt, *, print_sym=True, strip=False, add_space=False):
|
|||
+ ((' ' if add_space else '') + spec if print_sym else ''))
|
||||
|
||||
def parse_bytespec(nbytes):
|
||||
m = re.match(r'([0123456789.]+)(.*)', nbytes)
|
||||
if m:
|
||||
|
||||
if m := re.match(r'([0123456789.]+)(.*)', nbytes):
|
||||
if m.group(2):
|
||||
for k, v in bytespec_map:
|
||||
if k == m.group(2):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue