Skip to content

Commit

Permalink
Rename demo.py to __main__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tronikos committed Jun 9, 2024
1 parent 6a96b93 commit 6cd65ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ Since this library is used by Home Assistant, see <https://www.home-assistant.io
So follow that advice and try to scrape all fields at once, similar to the `get_form_action_url_and_hidden_inputs` in helpers.py.

## Example

See [demo.py](https://github.com/tronikos/opower/blob/main/src/demo.py)

## Development environment

```sh
Expand Down Expand Up @@ -78,10 +74,10 @@ isort . ; black . ; flake8 . ; ruff . --fix ; mypy --install-types .
python -m pip install pytest python-dotenv
pytest

# Run demo
python src/demo.py --help
# Run command line
python -m opower --help
# To output debug logs and API responses to a file run:
python src/demo.py -vv 2> out.txt
python -m opower -vv 2> out.txt

# Build package
python -m pip install build
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ ignore = [
fixture-parentheses = false

[tool.ruff.per-file-ignores]
# Allow for demo script to write to stdout
"demo.py" = ["T201"]
# Allow for main script to write to stdout
"__main__.py" = ["T201"]

[tool.ruff.mccabe]
max-complexity = 25
Expand Down
3 changes: 2 additions & 1 deletion src/demo.py → src/opower/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,5 @@ async def _main() -> None:
print()


asyncio.run(_main())
if __name__ == "__main__":
asyncio.run(_main())

0 comments on commit 6cd65ce

Please sign in to comment.