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

feat: convert to async #48

Merged
merged 9 commits into from
Nov 13, 2019
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
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# SPDX-License-Identifier: WTFPL
# Based on code from https://github.com/bachya/simplisafe-python/blob/dev/Makefile
black:
pipenv run black teslajsonpy
coverage:
#Not implemented yet
#pipenv run py.test -s --verbose --cov-report term-missing --cov-report xml --cov=teslajsonpy tests
Expand Down
8 changes: 6 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ url = "https://pypi.python.org/simple"
verify_ssl = true

[dev-packages]
"flake8" = "*"
flake8 = "*"
detox = "*"
mypy = "*"
pydocstyle = "*"
Expand All @@ -12,6 +12,10 @@ pytest-cov = "*"
tox = "*"
twine = "*"
python-semantic-release = "*"
black = "*"

[packages]
requests = "*"
aiohttp = "*"

[pipenv]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's freeze versions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we rely on the Pipfile.lock file?

allow_prereleases = true
164 changes: 117 additions & 47 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# teslajsonpy

Python module for Tesla API primarily for enabling Home-Assistant.
Async python module for Tesla API primarily for enabling Home-Assistant.

**NOTE:** Tesla has no official API; therefore, this library may stop
working at any time without warning.
Expand Down
6 changes: 5 additions & 1 deletion pylintrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
[MASTER]

[MESSAGES CONTROL]
# Reasons disabled:
# format - handled by black
# unnecessary-pass - This can hurt readability
# too-many-instance-attributes - This should be refactored later
# duplicate-code - This should be refactored later as architecture has redundant Home-assistant devices.
# too-many-arguments
disable=
unnecessary-pass,too-many-instance-attributes,duplicate-code
format,unnecessary-pass,too-many-instance-attributes,duplicate-code,too-many-arguments,too-many-boolean-expressions

[REPORTS]
reports=no
Expand Down
56 changes: 54 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,58 @@
[semantic_release]
version_variable=teslajsonpy/__version__.py:__version__
upload_to_pypi=false
upload_to_pypi=true
check_build_status=false
remove_dist=false
hvcs=github
hvcs=github

[pydocstyle]
ignore = D202, D212, D416, D213, D203, D407

[flake8]
exclude = .venv,.git,.tox,docs,venv,bin,lib,deps,build
# To work with Black
max-line-length = 88
# E501: line too long
zabuldon marked this conversation as resolved.
Show resolved Hide resolved
# H301: on mport per line
# W503: Line break occurred before a binary operator
# E203: Whitespace before ':'
# D202 No blank lines allowed after function docstring
# W504 line break after binary operator
# H102 missing apache
ignore =
E501,
H301,
W503,
E203,
D202,
W504,
H102

[isort]
# https://github.com/timothycrosley/isort
# https://github.com/timothycrosley/isort/wiki/isort-Settings
# splits long import on multiple lines indented by 4 spaces
multi_line_output = 3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88
indent = " "
# by default isort don't check module indexes
not_skip = __init__.py
# will group `import x` and `from x import` of the same module.
force_sort_within_sections = true
sections = FUTURE,STDLIB,INBETWEENS,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
default_section = THIRDPARTY
known_first_party = teslajsonpy,tests
forced_separate = tests
combine_as_imports = true

[mypy]
python_version = 3.6
ignore_errors = true
follow_imports = silent
ignore_missing_imports = true
warn_incomplete_stub = true
warn_redundant_casts = true
warn_unused_configs = true
37 changes: 22 additions & 15 deletions teslajsonpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
"""
Python Package for controlling Tesla API.

For more details about this api, please refer to the documentation at
https://github.com/zabuldon/teslajsonpy
"""
from teslajsonpy.battery_sensor import (Battery, Range)
from teslajsonpy.binary_sensor import (ChargerConnectionSensor, ParkingSensor)
from teslajsonpy.charger import (ChargerSwitch, RangeSwitch)
from teslajsonpy.climate import (Climate, TempSensor)
from teslajsonpy.battery_sensor import Battery, Range
from teslajsonpy.binary_sensor import ChargerConnectionSensor, ParkingSensor
from teslajsonpy.charger import ChargerSwitch, ChargingSensor, RangeSwitch
from teslajsonpy.climate import Climate, TempSensor
from teslajsonpy.controller import Controller
from teslajsonpy.exceptions import TeslaException
from teslajsonpy.gps import GPS, Odometer
from teslajsonpy.lock import Lock

from .__version__ import __version__

__all__ = ['Battery', 'Range',
'ChargerConnectionSensor', 'ParkingSensor',
'ChargerSwitch', 'RangeSwitch',
'Climate', 'TempSensor',
'Controller',
'TeslaException',
'GPS', 'Odometer',
'Lock',
'__version__']
__all__ = [
"Battery",
"Range",
"ChargerConnectionSensor",
"ChargingSensor",
"ParkingSensor",
"ChargerSwitch",
"RangeSwitch",
"Climate",
"TempSensor",
"Controller",
"TeslaException",
"GPS",
"Odometer",
"Lock",
"__version__",
]
4 changes: 1 addition & 3 deletions teslajsonpy/__version__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
"""
Python Package for controlling Tesla API.
Expand All @@ -8,4 +6,4 @@
https://github.com/zabuldon/teslajsonpy
"""

__version__ = '0.1.0'
__version__ = "0.1.0"
Loading