ytdl-sub 2025.12.31.post2__py3-none-any.whl → 2025.12.31.post4__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.post2";__local_version__ = "2025.12.31+7ac525f"
1
+ __pypi_version__ = "2025.12.31.post4";__local_version__ = "2025.12.31+c46de04"
@@ -1,5 +1,7 @@
1
1
  import math
2
+ from typing import Optional
2
3
 
4
+ from ytdl_sub.script.types.array import Array
3
5
  from ytdl_sub.script.types.resolvable import AnyArgument
4
6
  from ytdl_sub.script.types.resolvable import Float
5
7
  from ytdl_sub.script.types.resolvable import Integer
@@ -96,3 +98,18 @@ class NumericFunctions:
96
98
  Returns min of all values.
97
99
  """
98
100
  return _to_numeric(min(val.value for val in values))
101
+
102
+ @staticmethod
103
+ def range(
104
+ end: Integer, start: Optional[Integer] = None, step: Optional[Integer] = None
105
+ ) -> Array:
106
+ """
107
+ :description:
108
+ Returns the desired range of Integers in the form of an Array.
109
+ """
110
+ if start is None:
111
+ start = Integer(0)
112
+ if step is None:
113
+ step = Integer(1)
114
+
115
+ return Array(value=[Integer(idx) for idx in range(start.value, end.value, step.value)])
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(
@@ -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):
@@ -160,9 +160,20 @@ class VariableDependency(ABC):
160
160
  raise UNREACHABLE
161
161
 
162
162
  @final
163
- def _custom_function_dependencies(
163
+ def custom_function_dependencies(
164
164
  self, custom_function_definitions: Dict[str, "VariableDependency"]
165
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
+ """
166
177
  custom_functions = self.custom_functions
167
178
  for lambda_func in self.lambdas:
168
179
  if lambda_func.value in custom_function_definitions:
@@ -185,7 +196,7 @@ class VariableDependency(ABC):
185
196
  True if it contains all input variables as a dependency. False otherwise.
186
197
  """
187
198
  # If there are lambdas, see if they are custom functions. If so, check them
188
- for custom_function in self._custom_function_dependencies(custom_function_definitions):
199
+ for custom_function in self.custom_function_dependencies(custom_function_definitions):
189
200
  if not custom_function_definitions[custom_function.name].is_subset_of(
190
201
  variables=variables, custom_function_definitions=custom_function_definitions
191
202
  ):
@@ -205,7 +216,7 @@ class VariableDependency(ABC):
205
216
  True if it contains any of the input variables. False otherwise.
206
217
  """
207
218
  # If there are lambdas, see if they are custom functions. If so, check them
208
- for custom_function in self._custom_function_dependencies(custom_function_definitions):
219
+ for custom_function in self.custom_function_dependencies(custom_function_definitions):
209
220
  if custom_function_definitions[custom_function.name].contains(
210
221
  variables=variables, custom_function_definitions=custom_function_definitions
211
222
  ):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ytdl-sub
3
- Version: 2025.12.31.post2
3
+ Version: 2025.12.31.post4
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=HxJKWoK917bwDiKevLduTUXIl0jiNh_iIIW46HIsIVI,79
1
+ ytdl_sub/__init__.py,sha256=B08vEZY-LmzTe-uIzKBt32_P9K6jiLzMXUML5-9YMm8,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=EK4L4l8OTao_SPuB9uBrWEfOGwh-pMYdnQ61_OKj5ss,26967
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
@@ -103,7 +103,7 @@ ytdl_sub/script/functions/date_functions.py,sha256=q_lfLM7WlXeeLZ0uQTCp_zS_1Zn1M
103
103
  ytdl_sub/script/functions/error_functions.py,sha256=stF7lYoIE3lg131I2wyBbxjmp7BYX_BoVdZ7VJaroWU,2507
104
104
  ytdl_sub/script/functions/json_functions.py,sha256=4Sq5T5lg5_zsiHAIKZL2qb2fYi20llKgI46N9GqcHFY,1351
105
105
  ytdl_sub/script/functions/map_functions.py,sha256=RC1jBaxWeyMf_RPwRRGxt_QUIIrCfd9P_ezH04GdRUE,4181
106
- ytdl_sub/script/functions/numeric_functions.py,sha256=i8r6Sq6vAzQABLq9sPrDpHyUMbdMbt5dXOi5yxJwAbQ,2665
106
+ ytdl_sub/script/functions/numeric_functions.py,sha256=llg9_pwuVzZmKb_pttbq003xH30_B210Xw7eLxUETC8,3203
107
107
  ytdl_sub/script/functions/print_functions.py,sha256=s-EhqdUvDcH3zIkt95LIDGxvlACY0oJwHqiqZ1XA4dM,2274
108
108
  ytdl_sub/script/functions/regex_functions.py,sha256=d6omjhD9FjkP0BVjUaMsJfXVt-reh-MI52cUhXdL4S4,6744
109
109
  ytdl_sub/script/functions/string_functions.py,sha256=rZbOuP2V9FvoKzMG94R7vsvj-GxHK_hwgVDMa_Yeftw,6095
@@ -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=IaHg9CFIxGf2Ce2xTz1T1IMlrspj46cZ_J8_dOabvvk,7094
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
@@ -158,9 +158,9 @@ ytdl_sub/validators/string_select_validator.py,sha256=KFXNKWX2J80WGt08m5gVYphPMH
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.post2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
162
- ytdl_sub-2025.12.31.post2.dist-info/METADATA,sha256=5UMswbJAxaE7_3pFboKmQ66RiJDV3aPoV1DkOX3d6e8,51426
163
- ytdl_sub-2025.12.31.post2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
164
- ytdl_sub-2025.12.31.post2.dist-info/entry_points.txt,sha256=K3T5235NlAI-WLmHCg5tzLZHqc33OLN5IY5fOGc9t10,48
165
- ytdl_sub-2025.12.31.post2.dist-info/top_level.txt,sha256=6z-JWazl6jXspC2DNyxOnGnEqYyGzVbgcBDoXfbkUhI,9
166
- ytdl_sub-2025.12.31.post2.dist-info/RECORD,,
161
+ ytdl_sub-2025.12.31.post4.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
162
+ ytdl_sub-2025.12.31.post4.dist-info/METADATA,sha256=UktKdJ6kXQPhMz5aXYIDErgFzWJ-L3k5-UY7ZxjfhvU,51426
163
+ ytdl_sub-2025.12.31.post4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
164
+ ytdl_sub-2025.12.31.post4.dist-info/entry_points.txt,sha256=K3T5235NlAI-WLmHCg5tzLZHqc33OLN5IY5fOGc9t10,48
165
+ ytdl_sub-2025.12.31.post4.dist-info/top_level.txt,sha256=6z-JWazl6jXspC2DNyxOnGnEqYyGzVbgcBDoXfbkUhI,9
166
+ ytdl_sub-2025.12.31.post4.dist-info/RECORD,,