mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Run flake8 linter on python code (#474)
* Run-flake8-linter-on-Python-code * Remove hardware/unicorn/scripts/checklib.js
This commit is contained in:
parent
6793fd2596
commit
e57223f1a8
13
.travis.yml
13
.travis.yml
@ -4,6 +4,19 @@ node_js:
|
|||||||
- "6"
|
- "6"
|
||||||
- "8"
|
- "8"
|
||||||
- "10"
|
- "10"
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- python: 2.7
|
||||||
|
language: python
|
||||||
|
before_script: pip install flake8
|
||||||
|
script: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
|
||||||
|
- python: 3.7
|
||||||
|
language: python
|
||||||
|
dist: xenial # required for Python 3.7 (travis-ci/travis-ci#9069)
|
||||||
|
sudo: required # required for Python 3.7 (travis-ci/travis-ci#9069)
|
||||||
|
before_script: pip install flake8
|
||||||
|
script: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
# Remove the './node_modules/.bin:' entry, see https://github.com/travis-ci/travis-ci/issues/8813
|
# Remove the './node_modules/.bin:' entry, see https://github.com/travis-ci/travis-ci/issues/8813
|
||||||
- npm i -g npm
|
- npm i -g npm
|
||||||
|
@ -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")
|
|
||||||
}
|
|
@ -2,13 +2,19 @@
|
|||||||
|
|
||||||
# Import library functions we need
|
# Import library functions we need
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import unicornhat as UH
|
|
||||||
|
|
||||||
if sys.version_info >= (3,0):
|
import sys
|
||||||
print("Sorry - currently only configured to work with python 2.x")
|
|
||||||
sys.exit(1)
|
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
|
brightness = float(sys.argv[1])/100
|
||||||
UH.off()
|
UH.off()
|
||||||
|
Loading…
Reference in New Issue
Block a user