Skip to content

Commit ff1bde9

Browse files
arturdryomovhashhar
authored andcommitted
Add pre-commit as a Flake8 and MyPy delegate
1 parent a2331a5 commit ff1bde9

File tree

4 files changed

+37
-10
lines changed

4 files changed

+37
-10
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@ name: ci
33
on: [push, pull_request]
44

55
jobs:
6+
checks:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: "Checkout the source code"
10+
uses: actions/checkout@v2
11+
12+
- name: "Install Python"
13+
uses: actions/setup-python@v2
14+
15+
- name: "Install pre-commit"
16+
run: pip install pre-commit
17+
18+
- name: "Run pre-commit checks"
19+
run: pre-commit run --all-files
20+
621
build:
722
runs-on: ubuntu-latest
823
strategy:
@@ -27,6 +42,3 @@ jobs:
2742
- name: Run tests
2843
run: |
2944
pytest -s tests/ integration_tests/
30-
- name: Run linter
31-
run: |
32-
flake8

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
repos:
2+
- repo: "https://github.com/PyCQA/flake8"
3+
rev: "3.9.2"
4+
hooks:
5+
- id: "flake8"
6+
name: "Python: analysis"
7+
8+
- repo: "https://github.com/pre-commit/mirrors-mypy"
9+
rev: "v0.910"
10+
hooks:
11+
- id: "mypy"
12+
name: "Python: types"
13+
additional_dependencies:
14+
- "types-pytz"
15+
- "types-requests"

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222

2323

2424
with open("trino/__init__.py", "rb") as f:
25-
version = str(
26-
ast.literal_eval(_version_re.search(f.read().decode("utf-8")).group(1))
27-
)
25+
trino_version = _version_re.search(f.read().decode("utf-8"))
26+
assert trino_version is not None
27+
version = str(ast.literal_eval(trino_version.group(1)))
2828

2929

3030
kerberos_require = ["requests_kerberos"]
3131

32-
all_require = [kerberos_require]
32+
all_require = kerberos_require + []
3333

34-
tests_require = all_require + ["httpretty", "pytest", "pytest-runner", "pytz", "flake8", "click"]
34+
tests_require = all_require + ["httpretty", "pytest", "pytest-runner", "pytz", "click"]
3535

3636
setup(
3737
name="trino",

trino/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
if SOCKS_PROXY:
5353
PROXIES = {"http": "socks5://" + SOCKS_PROXY, "https": "socks5://" + SOCKS_PROXY}
5454
else:
55-
PROXIES = None
55+
PROXIES = {}
5656

5757

5858
class ClientSession(object):
@@ -313,7 +313,7 @@ def statement_url(self) -> str:
313313
return self.get_url(constants.URL_STATEMENT_PATH)
314314

315315
@property
316-
def next_uri(self) -> str:
316+
def next_uri(self) -> Optional[str]:
317317
return self._next_uri
318318

319319
def post(self, sql, additional_http_headers=None):

0 commit comments

Comments
 (0)