Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix code style issues in easybuild.tools + add flake8 linting test #3282

Merged
merged 6 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Static Analysis
on: [push, pull_request]
jobs:
python-linting:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- name: set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: install Python packages
run: |
pip install --upgrade pip
pip install --upgrade flake8

- name: Run flake8
run: |
flake8 easybuild/tools
boegel marked this conversation as resolved.
Show resolved Hide resolved

10 changes: 6 additions & 4 deletions easybuild/tools/asyncprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,15 @@
"""

import errno
import fcntl
import os
Flamefire marked this conversation as resolved.
Show resolved Hide resolved
import select
import subprocess
import time

PIPE = subprocess.PIPE
STDOUT = subprocess.STDOUT

import select #@UnresolvedImport
import fcntl #@UnresolvedImport


class Popen(subprocess.Popen):

Expand Down Expand Up @@ -117,7 +116,7 @@ def send(self, inp):
try:
written = os.write(self.stdin.fileno(), inp.encode())
except OSError as why:
if why[0] == errno.EPIPE: #broken pipe
if why[0] == errno.EPIPE: # broken pipe
return self._close('stdin')
raise

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


message = "Other end disconnected!"


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


def send_all(p, data):
while len(data):
sent = p.send(data)
Expand Down
Loading