[BACKEND] Remove cast and legacy_bracket_safety usage (#1414)
Removes unused casts and calls to the legacy_bracket_safety function.
This commit is contained in:
parent
3a07d058aa
commit
41a5bf60aa
2 changed files with 8 additions and 16 deletions
|
|
@ -22,7 +22,6 @@ VariableT = TypeVar("VariableT", bound="Variable")
|
||||||
|
|
||||||
|
|
||||||
def _get(
|
def _get(
|
||||||
cast: str,
|
|
||||||
metadata_variable_name: str,
|
metadata_variable_name: str,
|
||||||
metadata_key: str,
|
metadata_key: str,
|
||||||
variable_name: Optional[str],
|
variable_name: Optional[str],
|
||||||
|
|
@ -47,7 +46,7 @@ def _get(
|
||||||
return as_type(
|
return as_type(
|
||||||
variable_name=variable_name or metadata_key,
|
variable_name=variable_name or metadata_key,
|
||||||
metadata_key=metadata_key,
|
metadata_key=metadata_key,
|
||||||
definition=f"{{ %legacy_bracket_safety(%{cast}({out})) }}",
|
definition=f"{{ {out} }}",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -182,7 +181,6 @@ class MapMetadataVariable(MetadataVariable, MapVariable):
|
||||||
Creates a map variable from entry metadata
|
Creates a map variable from entry metadata
|
||||||
"""
|
"""
|
||||||
return _get(
|
return _get(
|
||||||
"map",
|
|
||||||
metadata_variable_name=ENTRY_METADATA_VARIABLE_NAME,
|
metadata_variable_name=ENTRY_METADATA_VARIABLE_NAME,
|
||||||
metadata_key=metadata_key,
|
metadata_key=metadata_key,
|
||||||
variable_name=variable_name,
|
variable_name=variable_name,
|
||||||
|
|
@ -204,7 +202,6 @@ class ArrayMetadataVariable(MetadataVariable, ArrayVariable):
|
||||||
Creates an array variable from entry metadata
|
Creates an array variable from entry metadata
|
||||||
"""
|
"""
|
||||||
return _get(
|
return _get(
|
||||||
"array",
|
|
||||||
metadata_variable_name=ENTRY_METADATA_VARIABLE_NAME,
|
metadata_variable_name=ENTRY_METADATA_VARIABLE_NAME,
|
||||||
metadata_key=metadata_key,
|
metadata_key=metadata_key,
|
||||||
variable_name=variable_name,
|
variable_name=variable_name,
|
||||||
|
|
@ -226,7 +223,6 @@ class StringMetadataVariable(MetadataVariable, StringVariable):
|
||||||
Creates a string variable from entry metadata
|
Creates a string variable from entry metadata
|
||||||
"""
|
"""
|
||||||
return _get(
|
return _get(
|
||||||
"string",
|
|
||||||
metadata_variable_name=ENTRY_METADATA_VARIABLE_NAME,
|
metadata_variable_name=ENTRY_METADATA_VARIABLE_NAME,
|
||||||
metadata_key=metadata_key,
|
metadata_key=metadata_key,
|
||||||
variable_name=variable_name,
|
variable_name=variable_name,
|
||||||
|
|
@ -245,7 +241,6 @@ class StringMetadataVariable(MetadataVariable, StringVariable):
|
||||||
Creates a string variable from playlist metadata
|
Creates a string variable from playlist metadata
|
||||||
"""
|
"""
|
||||||
return _get(
|
return _get(
|
||||||
"string",
|
|
||||||
metadata_variable_name=PLAYLIST_METADATA_VARIABLE_NAME,
|
metadata_variable_name=PLAYLIST_METADATA_VARIABLE_NAME,
|
||||||
metadata_key=metadata_key,
|
metadata_key=metadata_key,
|
||||||
variable_name=variable_name,
|
variable_name=variable_name,
|
||||||
|
|
@ -264,7 +259,6 @@ class StringMetadataVariable(MetadataVariable, StringVariable):
|
||||||
Creates a string variable from source metadata
|
Creates a string variable from source metadata
|
||||||
"""
|
"""
|
||||||
return _get(
|
return _get(
|
||||||
"string",
|
|
||||||
metadata_variable_name=SOURCE_METADATA_VARIABLE_NAME,
|
metadata_variable_name=SOURCE_METADATA_VARIABLE_NAME,
|
||||||
metadata_key=metadata_key,
|
metadata_key=metadata_key,
|
||||||
variable_name=variable_name,
|
variable_name=variable_name,
|
||||||
|
|
@ -301,7 +295,6 @@ class IntegerMetadataVariable(MetadataVariable, IntegerVariable):
|
||||||
Creates an int variable from entry metadata
|
Creates an int variable from entry metadata
|
||||||
"""
|
"""
|
||||||
return _get(
|
return _get(
|
||||||
"int",
|
|
||||||
metadata_variable_name=ENTRY_METADATA_VARIABLE_NAME,
|
metadata_variable_name=ENTRY_METADATA_VARIABLE_NAME,
|
||||||
metadata_key=metadata_key,
|
metadata_key=metadata_key,
|
||||||
variable_name=variable_name,
|
variable_name=variable_name,
|
||||||
|
|
@ -320,7 +313,6 @@ class IntegerMetadataVariable(MetadataVariable, IntegerVariable):
|
||||||
Creates an int variable from playlist metadata
|
Creates an int variable from playlist metadata
|
||||||
"""
|
"""
|
||||||
return _get(
|
return _get(
|
||||||
"int",
|
|
||||||
metadata_variable_name=PLAYLIST_METADATA_VARIABLE_NAME,
|
metadata_variable_name=PLAYLIST_METADATA_VARIABLE_NAME,
|
||||||
metadata_key=metadata_key,
|
metadata_key=metadata_key,
|
||||||
variable_name=variable_name,
|
variable_name=variable_name,
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,8 @@ def mock_entry_to_dict(
|
||||||
"epoch": 1596878400,
|
"epoch": 1596878400,
|
||||||
"epoch_date": "20200808",
|
"epoch_date": "20200808",
|
||||||
"epoch_hour": "09",
|
"epoch_hour": "09",
|
||||||
"title": "entry {title}",
|
"title": "entry {title}",
|
||||||
"title_sanitized": "entry {title}",
|
"title_sanitized": "entry {title}",
|
||||||
"ext": ext,
|
"ext": ext,
|
||||||
"description": "",
|
"description": "",
|
||||||
"creator": "abc123",
|
"creator": "abc123",
|
||||||
|
|
@ -113,8 +113,8 @@ def mock_entry_to_dict(
|
||||||
"playlist_count": 1,
|
"playlist_count": 1,
|
||||||
"playlist_max_upload_year": 2021,
|
"playlist_max_upload_year": 2021,
|
||||||
"playlist_max_upload_year_truncated": 21,
|
"playlist_max_upload_year_truncated": 21,
|
||||||
"playlist_title": "entry {title}",
|
"playlist_title": "entry {title}",
|
||||||
"playlist_title_sanitized": "entry {title}",
|
"playlist_title_sanitized": "entry {title}",
|
||||||
"playlist_description": "",
|
"playlist_description": "",
|
||||||
"playlist_webpage_url": "https://yourname.here",
|
"playlist_webpage_url": "https://yourname.here",
|
||||||
"playlist_uid": "abc123",
|
"playlist_uid": "abc123",
|
||||||
|
|
@ -126,15 +126,15 @@ def mock_entry_to_dict(
|
||||||
"source_description": "",
|
"source_description": "",
|
||||||
"source_index": 1,
|
"source_index": 1,
|
||||||
"source_index_padded": "01",
|
"source_index_padded": "01",
|
||||||
"source_title": "entry {title}",
|
"source_title": "entry {title}",
|
||||||
"source_title_sanitized": "entry {title}",
|
"source_title_sanitized": "entry {title}",
|
||||||
"source_webpage_url": "https://yourname.here",
|
"source_webpage_url": "https://yourname.here",
|
||||||
"source_uid": "abc123",
|
"source_uid": "abc123",
|
||||||
"source_uploader": "abc123",
|
"source_uploader": "abc123",
|
||||||
"source_uploader_id": "abc123",
|
"source_uploader_id": "abc123",
|
||||||
"source_uploader_url": "https://yourname.here",
|
"source_uploader_url": "https://yourname.here",
|
||||||
"uid_sanitized_plex": "abc123",
|
"uid_sanitized_plex": "abc123",
|
||||||
"title_sanitized_plex": "entry {title}",
|
"title_sanitized_plex": "entry {title}",
|
||||||
"release_date": upload_date,
|
"release_date": upload_date,
|
||||||
"release_date_standardized": "2021-01-12",
|
"release_date_standardized": "2021-01-12",
|
||||||
"release_year": 2021,
|
"release_year": 2021,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue