Skip to content

Commit

Permalink
feat: convert to async
Browse files Browse the repository at this point in the history
This version contains numerous changes in addition to the async conversion. It includes a new charging sensor, support for oauth, performance tweaks, and incorporation of black for formatting.
BREAKING CHANGE: API calls now require async
Closes #44, #47
  • Loading branch information
alandtse committed Oct 28, 2019
1 parent 585ca54 commit 3bc94ad
Show file tree
Hide file tree
Showing 17 changed files with 921 additions and 561 deletions.
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]
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
7 changes: 6 additions & 1 deletion pylintrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
[MASTER]
ignore=tests

[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
54 changes: 53 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,56 @@ version_variable=teslajsonpy/__version__.py:__version__
upload_to_pypi=false
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
# 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 = homeassistant,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__",
]
2 changes: 0 additions & 2 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 Down
Loading

0 comments on commit 3bc94ad

Please sign in to comment.