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

Use module variables in __init__.py for static values #78

Merged
merged 1 commit into from
Jun 23, 2023
Merged
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
19 changes: 8 additions & 11 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""KNX Frontend."""
from typing import Final

from .constants import FILE_HASH


Expand All @@ -7,16 +9,11 @@ def locate_dir() -> str:
return __path__[0]


def get_build_id() -> str:
"""Get the panel build id."""
return FILE_HASH


def is_dev_build() -> bool:
"""Check if this is a dev build."""
return FILE_HASH == "dev"
# Filename of the entrypoint.js to import the panel
entrypoint_js: Final = f"entrypoint-{FILE_HASH}.js"

# The webcomponent name that loads the panel (main.ts)
webcomponent_name: Final = "knx-frontend"

def entrypoint_js() -> str:
"""Return the name of the entrypoint js file."""
return f"entrypoint-{FILE_HASH}.js"
is_dev_build: Final = FILE_HASH == "dev"
is_prod_build: Final = not is_dev_build