Skip to content

Commit

Permalink
fix: type hinted CONTENT_TYPES dict (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
hairmare authored Dec 27, 2021
1 parent 51bd5cb commit 5e37ce0
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions nowplaypadgen/dlplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from __future__ import annotations

import datetime
from typing import TypedDict

import pytz

Expand All @@ -55,7 +56,8 @@
# - Add an DL Plus object container
# - Linking of DL Plus objects

CATEGORIES = [

CATEGORIES: list[str] = [
"Dummy",
"Item",
"Info",
Expand All @@ -69,7 +71,17 @@
:meta hide-value:
"""

CONTENT_TYPES = {

class _ContentType(TypedDict):
"""Type definition for the :attr:`CONTENT_TYPES` dictionary."""

code: int
category: str
id3v1: str | None
id3v2: str | None


CONTENT_TYPES: dict[str, _ContentType] = {
"DUMMY": {"code": 0, "category": CATEGORIES[0], "id3v1": None, "id3v2": None},
"ITEM.TITLE": {
"code": 1,
Expand Down Expand Up @@ -704,7 +716,7 @@ def __init__(self, content_type: str):
#: The content type according to ETSI TS 102 980, Annex A, Table A.1
self.content_type = content_type
#: Store content_type info for later lookups
self._content_type = CONTENT_TYPES[content_type]
self._content_type: _ContentType = CONTENT_TYPES[content_type]

def get_code(self) -> int:
"""Get the content type code.
Expand Down

0 comments on commit 5e37ce0

Please sign in to comment.