Skip to content

Commit d043588

Browse files
authored
chore: add pyright, ruff and ruff format to pre-commit (sammchardy#1487)
1 parent 39bbd87 commit d043588

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
9+
- repo: https://github.com/astral-sh/ruff-pre-commit
10+
rev: v0.8.1
11+
hooks:
12+
- id: ruff
13+
- id: ruff-format
14+
15+
- repo: https://github.com/RobertCraigie/pyright-python
16+
rev: v1.1.389
17+
hooks:
18+
- id: pyright

examples/save_historical_data.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ def date_to_milliseconds(date_str):
1818
:type date_str: str
1919
"""
2020
# get epoch value in UTC
21+
assert date_str is not None
2122
epoch = datetime.utcfromtimestamp(0).replace(tzinfo=pytz.utc)
2223
# parse our date string
2324
d = dateparser.parse(date_str)
25+
assert d is not None
2426
# if the date is not timezone aware apply UTC timezone
2527
if d.tzinfo is None or d.tzinfo.utcoffset(d) is None:
2628
d = d.replace(tzinfo=pytz.utc)
@@ -82,7 +84,7 @@ def get_historical_klines(symbol, interval, start_str, end_str=None):
8284

8385
# convert interval to useful value in seconds
8486
timeframe = interval_to_milliseconds(interval)
85-
87+
assert timeframe is not None
8688
# convert our date strings to milliseconds
8789
start_ts = date_to_milliseconds(start_str)
8890

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
setup(
2121
name="python-binance",
2222
version=version,
23-
packages=find_packages(exclude=['tests', 'examples']),
23+
packages=find_packages(exclude=["tests", "examples"]),
2424
description="Binance REST API python implementation",
2525
long_description=long_description,
2626
long_description_content_type="text/x-rst",

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ requests-mock
88
tox
99
setuptools
1010
aioresponses
11+
pre-commit

0 commit comments

Comments
 (0)