Browse Source

Fix some codacy issues with python files

softuart
Xose Pérez 6 years ago
parent
commit
437b0dd929
5 changed files with 9 additions and 16 deletions
  1. +1
    -1
      README.md
  2. +0
    -3
      code/espurna/config/build.h
  3. +2
    -2
      code/extra_scripts.py
  4. +2
    -2
      code/memanalyzer.py
  5. +4
    -8
      code/ota.py

+ 1
- 1
README.md View File

@ -6,7 +6,7 @@ It uses the Arduino Core for ESP8266 framework and a number of 3rd party librari
[![version](https://img.shields.io/badge/version-1.12.4a-brightgreen.svg)](CHANGELOG.md) [![version](https://img.shields.io/badge/version-1.12.4a-brightgreen.svg)](CHANGELOG.md)
![branch](https://img.shields.io/badge/branch-dev-orange.svg) ![branch](https://img.shields.io/badge/branch-dev-orange.svg)
[![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=dev)](https://travis-ci.org/xoseperez/espurna) [![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=dev)](https://travis-ci.org/xoseperez/espurna)
[![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/dev.svg)](https://www.codacy.com/app/xoseperez/espurna/dashboard)[![license](https://img.shields.io/github/license/xoseperez/espurna.svg)](LICENSE)
[![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/dev.svg)](https://www.codacy.com/app/xoseperez/espurna/dashboard)
[![donate](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=xose%2eperez%40gmail%2ecom&lc=US&no_note=0&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHostedGuest) [![donate](https://img.shields.io/badge/donate-PayPal-blue.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=xose%2eperez%40gmail%2ecom&lc=US&no_note=0&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHostedGuest)
[![twitter](https://img.shields.io/twitter/follow/xoseperez.svg?style=social)](https://twitter.com/intent/follow?screen_name=xoseperez) [![twitter](https://img.shields.io/twitter/follow/xoseperez.svg?style=social)](https://twitter.com/intent/follow?screen_name=xoseperez)


+ 0
- 3
code/espurna/config/build.h View File

@ -1,3 +0,0 @@
// DO NOT EDIT THIS FILE MANUALLY
// This file is modified by PlatformIO
#define APP_BUILD_FLAGS ""

+ 2
- 2
code/extra_scripts.py View File

@ -6,7 +6,7 @@ Import("env")
# Utils # Utils
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
class Color:
class Color(object):
BLACK = '\x1b[1;30m' BLACK = '\x1b[1;30m'
RED = '\x1b[1;31m' RED = '\x1b[1;31m'
GREEN = '\x1b[1;32m' GREEN = '\x1b[1;32m'
@ -32,7 +32,7 @@ def clr(color, text):
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
def check_size(source, target, env): def check_size(source, target, env):
time.sleep(1)
time.sleep(2)
size = target[0].get_size() size = target[0].get_size()
print clr(Color.LIGHT_BLUE, "Binary size: %s bytes" % size) print clr(Color.LIGHT_BLUE, "Binary size: %s bytes" % size)
#if size > 512000: #if size > 512000:


+ 2
- 2
code/memanalyzer.py View File

@ -50,7 +50,7 @@ description = "ESPurna Memory Analyzer v0.1"
def file_size(file): def file_size(file):
try: try:
return os.stat(file).st_size return os.stat(file).st_size
except:
except OSError:
return 0 return 0
@ -65,7 +65,7 @@ def analyse_memory(elf_file):
# print("------------------------------------------------------------------------------"); # print("------------------------------------------------------------------------------");
ret = {} ret = {}
for (id_, descr) in list(sections.items()):
for (id_, _) in list(sections.items()):
section_start_token = " _%s_start" % id_ section_start_token = " _%s_start" % id_
section_end_token = " _%s_end" % id_ section_end_token = " _%s_end" % id_
section_start = -1 section_start = -1


+ 4
- 8
code/ota.py View File

@ -155,7 +155,7 @@ def input_board():
# Choose the board # Choose the board
try: try:
index = int(input("Choose the board you want to flash (empty if none of these): ")) index = int(input("Choose the board you want to flash (empty if none of these): "))
except:
except ValueError:
index = 0 index = 0
if index < 0 or len(devices) < index: if index < 0 or len(devices) < index:
print("Board number must be between 1 and %s\n" % str(len(devices))) print("Board number must be between 1 and %s\n" % str(len(devices)))
@ -175,7 +175,7 @@ def input_board():
print() print()
try: try:
index = int(input("Choose the board type you want to flash: ")) index = int(input("Choose the board type you want to flash: "))
except:
except ValueError:
index = 0 index = 0
if index < 1 or len(boards) < index: if index < 1 or len(boards) < index:
print("Board number must be between 1 and %s\n" % str(len(boards))) print("Board number must be between 1 and %s\n" % str(len(boards)))
@ -186,17 +186,13 @@ def input_board():
if board.get('size', 0) == 0: if board.get('size', 0) == 0:
try: try:
board['size'] = int(input("Board memory size (1 for 1M, 4 for 4M): ")) board['size'] = int(input("Board memory size (1 for 1M, 4 for 4M): "))
except:
except ValueError:
print("Wrong memory size") print("Wrong memory size")
return None return None
# Choose IP of none before # Choose IP of none before
if len(board.get('ip', '')) == 0: if len(board.get('ip', '')) == 0:
try:
board['ip'] = input("IP of the device to flash (empty for 192.168.4.1): ") or "192.168.4.1"
except:
print("Wrong IP")
return None
board['ip'] = input("IP of the device to flash (empty for 192.168.4.1): ") or "192.168.4.1"
return board return board


Loading…
Cancel
Save