Run flake8 linter on python code (#474)

* Run-flake8-linter-on-Python-code

* Remove hardware/unicorn/scripts/checklib.js
This commit is contained in:
cclauss
2018-08-15 15:18:33 +02:00
committed by Dave Conway-Jones
parent 6793fd2596
commit e57223f1a8
3 changed files with 25 additions and 19 deletions

View File

@@ -1,13 +0,0 @@
#!/usr/bin/env node
var fs = require('fs');
if (!fs.existsSync('/usr/local/lib/python2.7/dist-packages/unicornhat.py')) {
console.warn("WARNING : Can't find required python library");
console.warn("WARNING : Please install using the following command");
console.warn("WARNING : Note: this uses root...");
console.warn("WARNING : curl -sS get.pimoroni.com/unicornhat | bash\n");
//process.exit(1);
}
else {
console.log("Python library found OK.\n")
}

View File

@@ -2,13 +2,19 @@
# Import library functions we need
from __future__ import print_function
import sys
import os
import unicornhat as UH
if sys.version_info >= (3,0):
print("Sorry - currently only configured to work with python 2.x")
sys.exit(1)
import sys
try:
import unicornhat as UH
except ImportError:
print("run: pip install --user --upgrade unicornhat\n before trying again.")
sys.exit(0)
try:
raw_input # Python 2
except NameError:
raw_input = input # Python 3
brightness = float(sys.argv[1])/100
UH.off()