Skip to content

Commit

Permalink
Merge pull request #59 from c-w/cleanup/flake8
Browse files Browse the repository at this point in the history
Switch to flake8 linter and fix warnings
  • Loading branch information
daknob committed Oct 16, 2017
2 parents 505738c + f27e80a commit 2987c46
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ python:
- "3.5-dev"
- "3.6-dev"
- "nightly"
install: pip install pep8
script: pep8 .
install: pip install flake8
script: flake8 .
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,24 @@ Try to keep it clear and concise.
We use [PEP8](https://www.python.org/dev/peps/pep-0008/) as coding style
convention. There's probably no need to read the whole thing, though: just
make sure your code looks like what's already there. You can install a command
line utility called `pep8` using:
line utility called `flake8` using:

```bash
sudo pip install pep8
sudo pip install flake8
```

Afterwards, by running `pep8 file.py` you will see all the changes you must
Afterwards, by running `flake8 file.py` you will see all the changes you must
make in order to be fully compliant.

One method you can follow is write your code, but before you commit it, open
two windows, side by side, one having your editor, and the other being a
terminal. Afterwards, run in the terminal:

```bash
watch -n1 pep8 file.py
watch -n1 flake8 file.py
```

This will show you the output of the `pep8` command and it will automatically
This will show you the output of the `flake8` command and it will automatically
update every one second, so as soon as you save your file, you will see the
changes being reflected in the command output. If you run macOS and don't have
`watch` installed, you can install it by using `brew install watch`.
Expand Down
9 changes: 8 additions & 1 deletion torpaste.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
import logic
from subprocess import check_output

from flask import *
from flask import Flask
from flask import Response
from flask import redirect
from flask import render_template
from flask import request

app = Flask(__name__)

Expand Down Expand Up @@ -188,6 +192,7 @@ def additional_headers(response):
response.headers["Content-Security-Policy"] += config['CSP_REPORT_URI']
return response


# Required Initialization Code

# necessary for local modules import (backends, exceptions)
Expand Down Expand Up @@ -279,6 +284,7 @@ def load_config():
"b": b
}


config = load_config()
b = config['b']

Expand All @@ -289,5 +295,6 @@ def load_config():
print("Failed to initialize backend")
exit(1)


if __name__ == '__main__':
app.run(host="0.0.0.0")

0 comments on commit 2987c46

Please sign in to comment.