diff --git a/Makefile b/Makefile index 9df6e61..84c2a1a 100644 --- a/Makefile +++ b/Makefile @@ -30,9 +30,7 @@ format: .pdm .PHONY: lint ## Lint python source files lint: .pdm - pdm run isort --check-only $(sources) pdm run ruff check $(sources) - pdm run black -l 79 $(sources) --check --diff pdm run mypy $(sources) .PHONY: codespell ## Use Codespell to do spellchecking diff --git a/README.md b/README.md index 47efa00..8c842b6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Python: Shell Recharge + Python 3 package to retrieve public EV charger data from Shell Recharge [![GitHub Release][releases-shield]][releases] @@ -18,12 +19,11 @@ I build it to create a home-assistant integration, it can be done with rest call pip3 install shellrecharge ``` - ## Development To create a development environment to commit code. -``` +```bash python3 -m venv .venv source .venv/bin/activate pip3 install pdm @@ -33,15 +33,18 @@ pdm init sudo apt install pre-commit pip3 install pre-commit ``` + Run checks before PR/Commit: -``` + +```bash make all ``` ## Example + Below provides example on how to use the library. -``` +```python #!/usr/bin/env python3 """Example code.""" import asyncio @@ -87,7 +90,6 @@ if __name__ == "__main__": [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/cyberjunkynl/) [![Sponsor][sponsor-shield]][sponsor] -[python-shellrecharge]: https://github.com/cyberjunky/python-shellrecharge [commits-shield]: https://img.shields.io/github/commit-activity/y/cyberjunky/python-shellrecharge.svg?style=for-the-badge [commits]: https://github.com/cyberjunky/python-shellrecharge/commits/main [license-shield]: https://img.shields.io/github/license/cyberjunky/python-shellrecharge.svg?style=for-the-badge diff --git a/shellrecharge/user.py b/shellrecharge/user.py index 22f6698..d7dd0f1 100644 --- a/shellrecharge/user.py +++ b/shellrecharge/user.py @@ -47,9 +47,7 @@ async def authenticate(self) -> None: raise ShellPageChangedError() # Find the var declaration for lift_page - script_text = soup.find( - "script", string=compile(r"var\s+lift_page\s*=\s*") - ) + script_text = soup.find("script", string=compile(r"var\s+lift_page\s*=\s*")) if type(script_text) is not Tag: raise ShellPageChangedError() lift_page_match = search( diff --git a/shellrecharge/usermodels.py b/shellrecharge/usermodels.py index 2ff6da5..5896c2d 100644 --- a/shellrecharge/usermodels.py +++ b/shellrecharge/usermodels.py @@ -6,9 +6,7 @@ DateTimeISO8601 = str ChargePointStatus = Literal["Available", "Unavailable", "Occupied", "Unknown"] -ChargePointDetailedStatus = Literal[ - "available", "preparing", "charging", "suspendedev" -] +ChargePointDetailedStatus = Literal["available", "preparing", "charging", "suspendedev"] Vendor = Literal["NewMotion"]