Browse Source

assignment expressions (3 files)

The MMGen Project 2 months ago
parent
commit
0869482874
3 changed files with 5 additions and 8 deletions
  1. 2 4
      mmgen/cfgfile.py
  2. 1 2
      mmgen/proto/vm/tx/new.py
  3. 2 2
      mmgen/util2.py

+ 2 - 4
mmgen/cfgfile.py

@@ -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}')

+ 1 - 2
mmgen/proto/vm/tx/new.py

@@ -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:

+ 2 - 2
mmgen/util2.py

@@ -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):