From c77e94ba7a7b22c06014e46edd967fbbbba0b234 Mon Sep 17 00:00:00 2001 From: Ryan Jarvis Date: Tue, 5 Feb 2019 15:41:37 -0800 Subject: [PATCH] PEP8. Remove noop code --- code/memanalyzer.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/code/memanalyzer.py b/code/memanalyzer.py index 2b886dd3..2d849cc1 100644 --- a/code/memanalyzer.py +++ b/code/memanalyzer.py @@ -19,15 +19,16 @@ import argparse import os import re import shlex +import subprocess import sys from collections import OrderedDict + from sortedcontainers import SortedDict -import subprocess -if (sys.version_info > (3, 0)): - from subprocess import getstatusoutput as getstatusoutput +if sys.version_info > (3, 0): + from subprocess import getstatusoutput else: - from commands import getstatusoutput as getstatusoutput + from commands import getstatusoutput # ------------------------------------------------------------------------------- @@ -105,11 +106,13 @@ def run(env_, modules_): command = "ESPURNA_BOARD=\"WEMOS_D1_MINI_RELAYSHIELD\" ESPURNA_FLAGS=\"%s\" platformio run --silent --environment %s 2>/dev/null" % (flags, env_) subprocess.check_call(command, shell=True) + def calc_free(module): free = 80 * 1024 - module['data'] - module['rodata'] - module['bss'] free = free + (16 - free % 16) module['free'] = free + def modules_get(): modules_ = SortedDict() for line in open("espurna/config/arduino.h"): @@ -120,7 +123,8 @@ def modules_get(): del modules_['NETBIOS'] return modules_ -try: + +if __name__ == '__main__': # Parse command line options parser = argparse.ArgumentParser(description=description) @@ -279,7 +283,5 @@ try: total['size'], )) -except: - raise print("\n")