Skip to content

Commit

Permalink
Use module variables in __init__.py for static values (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
farmio committed Jun 23, 2023
1 parent 18b8d39 commit adf7c9f
Showing 1 changed file with 8 additions and 11 deletions.
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

0 comments on commit adf7c9f

Please sign in to comment.