1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

Merge pull request #1568 from authmillenon/pyterm-printf-style

pyterm: Use only printf-style String Formatting
This commit is contained in:
Oleg Hahm 2014-08-12 18:32:54 -04:00
commit 1db984a755

View File

@ -126,9 +126,8 @@ class SerCmd(cmd.Cmd):
pass
### create Logging object
my_millis = "{:.4f}".format(time.time())
date_str = '{}.{}'.format(time.strftime('%Y%m%d-%H:%M:%S'),
my_millis[-4:])
my_millis = "%.4f" % (time.time())
date_str = '%s.%s' % (time.strftime('%Y%m%d-%H:%M:%S'), my_millis[-4:])
self.startup = date_str
# create formatter
formatter = logging.Formatter(self.fmt_str)
@ -234,7 +233,7 @@ class SerCmd(cmd.Cmd):
"""Auto completion for date string.
"""
date = time.strftime("%Y-%m-%d %H:%M:%S")
return ["{}".format(date)]
return ["%s" % (date)]
def do_PYTERM_reset(self, line):
"""Pyterm command: Send a reset to the node.
@ -317,8 +316,7 @@ class SerCmd(cmd.Cmd):
"""
if line.endswith("list"):
for alias in self.aliases:
self.logger.info("{} = {}".format(alias,
self.aliases[alias]))
self.logger.info("%s = %s" % (alias, self.aliases[alias]))
return
if not line.count("="):
sys.stderr.write("Usage: /alias <ALIAS> = <CMD>\n")