Skip to content

Commit eb66a53

Browse files
authored
Merge pull request #3282 from Flamefire/autopep8-first
fix code style issues in easybuild.tools + add flake8 linting test
2 parents b51aceb + b95a827 commit eb66a53

29 files changed

+151
-266
lines changed

.github/workflows/linting.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Static Analysis
2+
on: [push, pull_request]
3+
jobs:
4+
python-linting:
5+
runs-on: ubuntu-18.04
6+
steps:
7+
- uses: actions/checkout@v2
8+
9+
- name: set up Python
10+
uses: actions/setup-python@v1
11+
with:
12+
python-version: 3.8
13+
14+
- name: install Python packages
15+
run: |
16+
pip install --upgrade pip
17+
pip install --upgrade flake8
18+
19+
- name: Run flake8
20+
run: |
21+
flake8 easybuild/tools
22+

easybuild/tools/asyncprocess.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,15 @@
6666
"""
6767

6868
import errno
69+
import fcntl
6970
import os
71+
import select
7072
import subprocess
7173
import time
7274

7375
PIPE = subprocess.PIPE
7476
STDOUT = subprocess.STDOUT
7577

76-
import select #@UnresolvedImport
77-
import fcntl #@UnresolvedImport
78-
7978

8079
class Popen(subprocess.Popen):
8180

@@ -117,7 +116,7 @@ def send(self, inp):
117116
try:
118117
written = os.write(self.stdin.fileno(), inp.encode())
119118
except OSError as why:
120-
if why[0] == errno.EPIPE: #broken pipe
119+
if why[0] == errno.EPIPE: # broken pipe
121120
return self._close('stdin')
122121
raise
123122

@@ -147,8 +146,10 @@ def _recv(self, which, maxsize):
147146
if not conn.closed:
148147
fcntl.fcntl(conn, fcntl.F_SETFL, flags)
149148

149+
150150
message = "Other end disconnected!"
151151

152+
152153
def recv_some(p, t=.2, e=1, tr=5, stderr=0):
153154
if tr < 1:
154155
tr = 1
@@ -171,6 +172,7 @@ def recv_some(p, t=.2, e=1, tr=5, stderr=0):
171172
time.sleep(max((x - time.time()) / tr, 0))
172173
return b''.join(y)
173174

175+
174176
def send_all(p, data):
175177
while len(data):
176178
sent = p.send(data)

0 commit comments

Comments
 (0)