ytdl-sub 2025.12.31.post1__py3-none-any.whl → 2025.12.31.post3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ytdl_sub/__init__.py CHANGED
@@ -1 +1 @@
1
- __pypi_version__ = "2025.12.31.post1";__local_version__ = "2025.12.31+d373935"
1
+ __pypi_version__ = "2025.12.31.post3";__local_version__ = "2025.12.31+869fc0b"
ytdl_sub/script/script.py CHANGED
@@ -66,6 +66,22 @@ class Script:
66
66
  deps=deps + [dep.name],
67
67
  )
68
68
 
69
+ for custom_func in variable_dependency.custom_function_dependencies(
70
+ custom_function_definitions=self._functions
71
+ ):
72
+ for dep in self._functions[custom_func.name].variables:
73
+ self._ensure_no_cycle(
74
+ name=variable_name,
75
+ dep=dep.name,
76
+ deps=deps + [custom_func.definition_name()],
77
+ definitions=self._variables,
78
+ )
79
+ self._traverse_variable_dependencies(
80
+ variable_name=variable_name,
81
+ variable_dependency=self._variables[dep.name],
82
+ deps=deps + [custom_func.definition_name(), dep.name],
83
+ )
84
+
69
85
  def _ensure_no_variable_cycles(self, variables: Dict[str, SyntaxTree]):
70
86
  for variable_name, variable_definition in variables.items():
71
87
  self._traverse_variable_dependencies(
@@ -288,6 +304,14 @@ class Script:
288
304
  unresolvable=unresolvable,
289
305
  )
290
306
 
307
+ for lambda_func in current_var.lambdas:
308
+ if lambda_func.value in self._functions:
309
+ subset_to_resolve |= self._recursive_get_unresolved_output_filter_variables(
310
+ current_var=self._functions[lambda_func.value],
311
+ subset_to_resolve=subset_to_resolve,
312
+ unresolvable=unresolvable,
313
+ )
314
+
291
315
  return subset_to_resolve
292
316
 
293
317
  def _get_unresolved_output_filter(
@@ -193,6 +193,14 @@ class NamedCustomFunction(NamedArgument, ABC):
193
193
  class ParsedCustomFunction(NamedCustomFunction):
194
194
  num_input_args: int
195
195
 
196
+ def definition_name(self) -> str:
197
+ """
198
+ Returns
199
+ -------
200
+ The function definition name, including the %
201
+ """
202
+ return f"%{self.name}"
203
+
196
204
 
197
205
  @dataclass(frozen=True)
198
206
  class FunctionType(NamedArgument, ABC):
@@ -114,7 +114,6 @@ class VariableDependency(ABC):
114
114
  output.add(ParsedCustomFunction(name=arg.name, num_input_args=len(arg.args)))
115
115
  if isinstance(arg, VariableDependency):
116
116
  output.update(arg.custom_functions)
117
- # if isinstance(arg, Lambda)
118
117
 
119
118
  return output
120
119
 
@@ -160,6 +159,31 @@ class VariableDependency(ABC):
160
159
 
161
160
  raise UNREACHABLE
162
161
 
162
+ @final
163
+ def custom_function_dependencies(
164
+ self, custom_function_definitions: Dict[str, "VariableDependency"]
165
+ ) -> Set[ParsedCustomFunction]:
166
+ """
167
+ Parameters
168
+ ----------
169
+ custom_function_definitions
170
+ Definition of all currently existing custom functions. Needed to check whether
171
+ a lambda function's input function is custom or not.
172
+
173
+ Returns
174
+ -------
175
+ All custom function dependencies
176
+ """
177
+ custom_functions = self.custom_functions
178
+ for lambda_func in self.lambdas:
179
+ if lambda_func.value in custom_function_definitions:
180
+ custom_functions.add(
181
+ ParsedCustomFunction(
182
+ name=lambda_func.value, num_input_args=lambda_func.num_input_args()
183
+ )
184
+ )
185
+ return custom_functions
186
+
163
187
  @final
164
188
  def is_subset_of(
165
189
  self,
@@ -171,7 +195,8 @@ class VariableDependency(ABC):
171
195
  -------
172
196
  True if it contains all input variables as a dependency. False otherwise.
173
197
  """
174
- for custom_function in self.custom_functions:
198
+ # If there are lambdas, see if they are custom functions. If so, check them
199
+ for custom_function in self.custom_function_dependencies(custom_function_definitions):
175
200
  if not custom_function_definitions[custom_function.name].is_subset_of(
176
201
  variables=variables, custom_function_definitions=custom_function_definitions
177
202
  ):
@@ -191,16 +216,7 @@ class VariableDependency(ABC):
191
216
  True if it contains any of the input variables. False otherwise.
192
217
  """
193
218
  # If there are lambdas, see if they are custom functions. If so, check them
194
- custom_functions_to_check = self.custom_functions
195
- for lambda_func in self.lambdas:
196
- if lambda_func.value in custom_function_definitions:
197
- custom_functions_to_check.add(
198
- ParsedCustomFunction(
199
- name=lambda_func.value, num_input_args=lambda_func.num_input_args()
200
- )
201
- )
202
-
203
- for custom_function in custom_functions_to_check:
219
+ for custom_function in self.custom_function_dependencies(custom_function_definitions):
204
220
  if custom_function_definitions[custom_function.name].contains(
205
221
  variables=variables, custom_function_definitions=custom_function_definitions
206
222
  ):
@@ -241,6 +241,11 @@ def _validate_formatter(
241
241
  variable_names = {var.name for var in parsed.variables}
242
242
  custom_function_names = {f"%{func.name}" for func in parsed.custom_functions}
243
243
 
244
+ # Add lambda functions to custom function names, if it's custom
245
+ for lambda_func in parsed.lambdas:
246
+ if lambda_func in mock_script.function_names:
247
+ custom_function_names.add(lambda_func.value)
248
+
244
249
  if not variable_names.issubset(mock_script.variable_names):
245
250
  raise StringFormattingVariableNotFoundException(
246
251
  "contains the following variables that do not exist: "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ytdl-sub
3
- Version: 2025.12.31.post1
3
+ Version: 2025.12.31.post3
4
4
  Summary: Automate downloading metadata generation with YoutubeDL
5
5
  Author: Jesse Bannon
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -1,4 +1,4 @@
1
- ytdl_sub/__init__.py,sha256=WrW7vK-7xEGvZMFgyjkq_NA4CjXzPSZv3q1IzcatKCI,79
1
+ ytdl_sub/__init__.py,sha256=lHu_dXH2FOotkLTpWoLxrGAi9eMsD4C43OWFwUAHL18,79
2
2
  ytdl_sub/main.py,sha256=4Rf9wXxSKW7IPnWqG5YtTZ814PjP1n9WtoFDivaainE,1004
3
3
  ytdl_sub/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  ytdl_sub/cli/entrypoint.py,sha256=XXjUH4HiOP_BB2ZA_bNcyt5-o6YLAdZmj0EP3xtOtD8,9496
@@ -93,7 +93,7 @@ ytdl_sub/prebuilt_presets/tv_show/tv_show_by_date.yaml,sha256=0OgIOzxSPNVqwcZnL6
93
93
  ytdl_sub/prebuilt_presets/tv_show/tv_show_collection.yaml,sha256=XCtt4i4-zAgyfh-p4SXSGd0FI56lWCrPOMmB6mdf-AE,238393
94
94
  ytdl_sub/script/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
95
95
  ytdl_sub/script/parser.py,sha256=LUvmUIxg346njE8-uDx06nOW6ZDX5QS6aUtp4lsgwpk,22115
96
- ytdl_sub/script/script.py,sha256=4fP5leu1GQdbbOQLzrWGEo_zaIUeZwGY0btFqdpQmpI,26582
96
+ ytdl_sub/script/script.py,sha256=ufW-Zr0amTh0vkdW63oOca6MndojgaTaXxpOFk25U48,27688
97
97
  ytdl_sub/script/script_output.py,sha256=5SIamnI-1D3xMA0qQzjf9xrIy8j6BVhGCKrl_Q1d2M8,1381
98
98
  ytdl_sub/script/functions/__init__.py,sha256=rzl6O5G0IEqFYHQECIM9bRvcuQj-ytC_p-Xl2TTa6j0,2932
99
99
  ytdl_sub/script/functions/array_functions.py,sha256=yg9rcZP67-aVzhu4oZZzUu3-AHiHltbQDWEs8GW1DJ4,7193
@@ -111,10 +111,10 @@ ytdl_sub/script/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
111
111
  ytdl_sub/script/types/array.py,sha256=1yEJEWtwS6T4W8KZN2IdNAGpi3SUa1qqzCXQfjo-P2M,1711
112
112
  ytdl_sub/script/types/function.py,sha256=rnKb5L8frQ6sG95lMFj_AS6qQw7tt88z26tyWrCWPhY,12341
113
113
  ytdl_sub/script/types/map.py,sha256=Y3zlm__IHcnycGFv0xbU_P7wgiQgtgddatPLQypjCvU,2254
114
- ytdl_sub/script/types/resolvable.py,sha256=OinvpfKsVjgU_mnE0uYONQftUxNLa1zY2jA74bywwBQ,5302
114
+ ytdl_sub/script/types/resolvable.py,sha256=YeMEhPTRTDSr5AVmK4NRpUbqxh1YQT6a2dGUIPKoFkI,5482
115
115
  ytdl_sub/script/types/syntax_tree.py,sha256=4xWluTMPJqA6yYuQ4XCcncSFt5cDZ9ZIT2AIOOH4bT0,2336
116
116
  ytdl_sub/script/types/variable.py,sha256=aVJ3ocUr3WpDoolOq6y3NV71b3EQQYPAGrIT0FtIqc4,813
117
- ytdl_sub/script/types/variable_dependency.py,sha256=J9XzVVrkyt-Ae2acHbb6xFnl6NIeOcL6wLOH9SvzKcA,6796
117
+ ytdl_sub/script/types/variable_dependency.py,sha256=w0NrgSoom9joLaLMWHbma0zekmljYVXdhYW-k_g1n0I,7419
118
118
  ytdl_sub/script/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
119
119
  ytdl_sub/script/utils/exception_formatters.py,sha256=hZDX2w90vU4lY2xiEM-qxQofQz2dmqPwhkSeWaJRsQ4,4645
120
120
  ytdl_sub/script/utils/exceptions.py,sha256=cag5ZLM6as1w-RsrOwO-oe4YFpwlFu_8U0QNGv_jQ68,2774
@@ -153,14 +153,14 @@ ytdl_sub/validators/regex_validator.py,sha256=jS8No927eg3zcpYEOv5g0gykePV0DCZaIr
153
153
  ytdl_sub/validators/source_variable_validator.py,sha256=ziG4PVIyzj5ky-Okle0FB2d2P5DWs3-jYF81hMvBTEQ,922
154
154
  ytdl_sub/validators/strict_dict_validator.py,sha256=RduK_3pOEbEQQuugAUeKKqM0Tv5x2vxSSb7vROyo2vQ,1661
155
155
  ytdl_sub/validators/string_datetime.py,sha256=GpbBiZH1FHTMeo0Zk134-uMdTMk2JD3Re3TnvuPx2OU,1125
156
- ytdl_sub/validators/string_formatter_validators.py,sha256=dQ_8l1wl101vPkaOlfJuXprYI5EnfHQ6jLWjGk92raA,11858
156
+ ytdl_sub/validators/string_formatter_validators.py,sha256=q_3Bn0y5id5Y8mcV1MlVrMHpQEDXOdqRLQ4i46_lvJc,12077
157
157
  ytdl_sub/validators/string_select_validator.py,sha256=KFXNKWX2J80WGt08m5gVYphPMHYxhHlgfcoXAQMq6zw,1086
158
158
  ytdl_sub/validators/validators.py,sha256=JC3-c9fSrozFADUY5jqZEhXpM2q3sfserlooQxT2DK8,9133
159
159
  ytdl_sub/ytdl_additions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
160
160
  ytdl_sub/ytdl_additions/enhanced_download_archive.py,sha256=Lsc0wjHdx9d8dYJCskZYAUGDAQ_QzQ-_xbQlyrBSzfk,24884
161
- ytdl_sub-2025.12.31.post1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
162
- ytdl_sub-2025.12.31.post1.dist-info/METADATA,sha256=aCbLYK2DK2szieUQ05O-SzJc0r5erfgVXBjnTGKrW0k,51426
163
- ytdl_sub-2025.12.31.post1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
164
- ytdl_sub-2025.12.31.post1.dist-info/entry_points.txt,sha256=K3T5235NlAI-WLmHCg5tzLZHqc33OLN5IY5fOGc9t10,48
165
- ytdl_sub-2025.12.31.post1.dist-info/top_level.txt,sha256=6z-JWazl6jXspC2DNyxOnGnEqYyGzVbgcBDoXfbkUhI,9
166
- ytdl_sub-2025.12.31.post1.dist-info/RECORD,,
161
+ ytdl_sub-2025.12.31.post3.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
162
+ ytdl_sub-2025.12.31.post3.dist-info/METADATA,sha256=VpMBojwuKGjYrA1tfA4Sn4o6w3E1WqKA0-qUC53KGMw,51426
163
+ ytdl_sub-2025.12.31.post3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
164
+ ytdl_sub-2025.12.31.post3.dist-info/entry_points.txt,sha256=K3T5235NlAI-WLmHCg5tzLZHqc33OLN5IY5fOGc9t10,48
165
+ ytdl_sub-2025.12.31.post3.dist-info/top_level.txt,sha256=6z-JWazl6jXspC2DNyxOnGnEqYyGzVbgcBDoXfbkUhI,9
166
+ ytdl_sub-2025.12.31.post3.dist-info/RECORD,,