cutcutcodec 1.0.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.

Potentially problematic release.


This version of cutcutcodec might be problematic. Click here for more details.

Files changed (233) hide show
  1. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/__init__.py +6 -0
  2. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/__main__.py +38 -0
  3. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/c_build.py +33 -0
  4. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/__init__.py +3 -0
  5. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/__init__.py +3 -0
  6. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/_helper_properties.py +52 -0
  7. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/audio/__init__.py +3 -0
  8. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/audio/properties/__init__.py +3 -0
  9. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/audio/properties/duration.py +83 -0
  10. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/ffprobe.py +637 -0
  11. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/graph/__init__.py +3 -0
  12. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/graph/find.py +82 -0
  13. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/graph/time_backprop.py +68 -0
  14. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/__init__.py +3 -0
  15. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/rate_audio.py +239 -0
  16. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/rate_video.py +97 -0
  17. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/shape.py +107 -0
  18. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/time_backprop.py +183 -0
  19. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/__init__.py +3 -0
  20. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/__init__.py +3 -0
  21. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/duration.py +162 -0
  22. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/nb_frames.py +159 -0
  23. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/rate.py +102 -0
  24. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/timestamps.py +194 -0
  25. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/__init__.py +3 -0
  26. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/container.py +40 -0
  27. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/encoder.py +152 -0
  28. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/filter.py +33 -0
  29. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/frame.py +127 -0
  30. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/frame_audio.py +205 -0
  31. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/frame_video.py +322 -0
  32. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/layout.py +206 -0
  33. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/meta_filter.py +41 -0
  34. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/muxer.py +184 -0
  35. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/node.py +164 -0
  36. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/stream.py +182 -0
  37. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/stream_audio.py +130 -0
  38. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/stream_video.py +193 -0
  39. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/__init__.py +7 -0
  40. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/ast_to_file.py +125 -0
  41. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/__init__.py +6 -0
  42. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/compatibility.py +734 -0
  43. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/default.py +99 -0
  44. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/encodec.py +40 -0
  45. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/muxer.py +8 -0
  46. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/rate.py +133 -0
  47. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/graph_to_ast.py +477 -0
  48. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/graph_to_json.py +104 -0
  49. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/graph_to_tree.py +190 -0
  50. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/json_to_graph.py +114 -0
  51. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/parse.py +123 -0
  52. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/__init__.py +15 -0
  53. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/dynamic.py +544 -0
  54. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/lambdify.py +612 -0
  55. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/preprocess.py +698 -0
  56. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/printer.py +926 -0
  57. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/tree_to_graph.py +168 -0
  58. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/__init__.py +3 -0
  59. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/decision/__init__.py +8 -0
  60. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/operation/__init__.py +3 -0
  61. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/operation/add.py +73 -0
  62. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/operation/remove.py +476 -0
  63. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/exceptions.py +60 -0
  64. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/__init__.py +3 -0
  65. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/__init__.py +3 -0
  66. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/add.py +170 -0
  67. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/cat.py +60 -0
  68. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/cut.py +112 -0
  69. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/delay.py +85 -0
  70. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/equation.py +261 -0
  71. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/fir.py +231 -0
  72. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/identity.py +48 -0
  73. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/resample.py +451 -0
  74. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/subclip.py +91 -0
  75. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/cut.py +74 -0
  76. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/mix/__init__.py +3 -0
  77. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/mix/audio_cast.py +208 -0
  78. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/mix/video_cast.py +197 -0
  79. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/subclip.py +53 -0
  80. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/__init__.py +3 -0
  81. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/add.py +331 -0
  82. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/cat.py +60 -0
  83. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/cut.py +113 -0
  84. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/delay.py +84 -0
  85. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/equation.py +265 -0
  86. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/identity.py +48 -0
  87. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/pad.py +99 -0
  88. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/subclip.py +91 -0
  89. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/__init__.py +3 -0
  90. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/audio/__init__.py +3 -0
  91. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/audio/empty.py +73 -0
  92. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/audio/equation.py +56 -0
  93. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/audio/noise.py +243 -0
  94. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/__init__.py +3 -0
  95. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/c_fractal.cpython-312-x86_64-linux-gnu.so +0 -0
  96. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/empty.py +69 -0
  97. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/equation.py +109 -0
  98. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/fractal/__init__.py +3 -0
  99. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/fractal/fractal.c +116 -0
  100. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/fractal/geometry.py +100 -0
  101. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/fractal/mandelbrot.py +176 -0
  102. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/noise.py +112 -0
  103. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/interfaces/__init__.py +3 -0
  104. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/interfaces/seedable.py +82 -0
  105. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/__init__.py +3 -0
  106. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/read_ffmpeg.py +904 -0
  107. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/read_svg.py +145 -0
  108. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/scheduler.py +356 -0
  109. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/write.py +340 -0
  110. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/__init__.py +3 -0
  111. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/__init__.py +3 -0
  112. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/basic.py +35 -0
  113. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/clean/__init__.py +3 -0
  114. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/clean/graph.py +80 -0
  115. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/hashes/__init__.py +3 -0
  116. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/hashes/graph.py +81 -0
  117. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/singleton.py +47 -0
  118. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cuda/__init__.py +3 -0
  119. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/factor/__init__.py +5 -0
  120. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/factor/proba.py +189 -0
  121. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/generalize/__init__.py +5 -0
  122. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/generalize/delay_to_fir.py +88 -0
  123. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/graph.py +17 -0
  124. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/parallel/__init__.py +3 -0
  125. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/parallel/buffer.py +90 -0
  126. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/utils.py +34 -0
  127. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/audio_5.1_narration.oga +0 -0
  128. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/intro.webm +0 -0
  129. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/logo.svg +13 -0
  130. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/project.json +226 -0
  131. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/video.mp4 +0 -0
  132. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/__init__.py +8 -0
  133. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/__main__.py +25 -0
  134. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/actions.py +63 -0
  135. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/app/__init__.py +3 -0
  136. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/app/app.py +248 -0
  137. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/base.py +50 -0
  138. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/__init__.py +3 -0
  139. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/__init__.py +3 -0
  140. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/container_input_ffmpeg.py +90 -0
  141. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_audio_delay.py +9 -0
  142. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_audio_equation.py +45 -0
  143. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_audio_fir.py +58 -0
  144. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_audio_subclip.py +9 -0
  145. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_cut.py +82 -0
  146. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_delay.py +20 -0
  147. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_subclip.py +21 -0
  148. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_video_delay.py +9 -0
  149. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_video_equation.py +53 -0
  150. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_video_subclip.py +9 -0
  151. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_audio_equation.py +14 -0
  152. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_audio_noise.py +19 -0
  153. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_video_equation.py +13 -0
  154. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_video_mandelbrot.py +60 -0
  155. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_video_noise.py +18 -0
  156. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/base.py +99 -0
  157. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/default.py +27 -0
  158. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/documentation.py +47 -0
  159. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/general.py +71 -0
  160. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/interface.py +305 -0
  161. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/loader.py +41 -0
  162. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/main.py +62 -0
  163. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edition_tabs.py +34 -0
  164. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry/__init__.py +3 -0
  165. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry/base.py +122 -0
  166. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry/filters.py +42 -0
  167. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry/generators.py +42 -0
  168. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry_tabs.py +46 -0
  169. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/__init__.py +3 -0
  170. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/_helper.py +54 -0
  171. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/container.py +226 -0
  172. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/doc.py +67 -0
  173. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/encodec.py +289 -0
  174. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/main.py +173 -0
  175. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/flowchart/__init__.py +3 -0
  176. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/flowchart/edge_properties.py +56 -0
  177. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/flowchart/main.py +280 -0
  178. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/flowchart/node.py +44 -0
  179. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/main.py +151 -0
  180. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/menu.py +21 -0
  181. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/preferences/__init__.py +3 -0
  182. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/preferences/audio_settings.py +183 -0
  183. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/preferences/main.py +41 -0
  184. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/preferences/video_settings.py +257 -0
  185. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/run.py +71 -0
  186. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/__init__.py +3 -0
  187. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/main.py +30 -0
  188. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/slider.py +286 -0
  189. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/track.py +97 -0
  190. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/view.py +90 -0
  191. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/toolbar.py +29 -0
  192. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/tools.py +23 -0
  193. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/__init__.py +3 -0
  194. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/audio_player.py +103 -0
  195. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/control.py +96 -0
  196. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/frame_extractor.py +254 -0
  197. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/main.py +115 -0
  198. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/__init__.py +8 -0
  199. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/__main__.py +27 -0
  200. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/coding_style.py +49 -0
  201. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/generation.py +52 -0
  202. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/install.py +72 -0
  203. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/run.py +58 -0
  204. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/abstract.py +215 -0
  205. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/audio_cast.py +35 -0
  206. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/audio_equation.py +71 -0
  207. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/c_memory.py +132 -0
  208. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/compatibility.py +27 -0
  209. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/compile.py +42 -0
  210. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/encoder.py +23 -0
  211. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/filter_cut.py +107 -0
  212. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/filter_delay.py +71 -0
  213. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/filter_empty.py +40 -0
  214. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/fir.py +143 -0
  215. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/hashes.py +23 -0
  216. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/initialisation.py +24 -0
  217. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/muxer.py +22 -0
  218. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/nan_snapshot.py +39 -0
  219. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/read.py +192 -0
  220. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/serialization_equality.py +50 -0
  221. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/snapshot_shape.py +21 -0
  222. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/sympy_to_torch.py +135 -0
  223. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/thread_safe.py +77 -0
  224. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/time_range.py +55 -0
  225. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/video_equation.py +77 -0
  226. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/write.py +95 -0
  227. cutcutcodec-1.0.post3.data/platlib/cutcutcodec/utils.py +40 -0
  228. cutcutcodec-1.0.post3.dist-info/LICENSE +7 -0
  229. cutcutcodec-1.0.post3.dist-info/METADATA +271 -0
  230. cutcutcodec-1.0.post3.dist-info/RECORD +233 -0
  231. cutcutcodec-1.0.post3.dist-info/WHEEL +5 -0
  232. cutcutcodec-1.0.post3.dist-info/entry_points.txt +6 -0
  233. cutcutcodec-1.0.post3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,476 @@
1
+ #!/usr/bin/env python3
2
+
3
+ """Allow to remove elements from the graph by managing collateral damage."""
4
+
5
+ import typing
6
+
7
+ import networkx
8
+
9
+
10
+ def remove_edge(
11
+ graph: networkx.MultiDiGraph, edge: tuple[str, str, str]
12
+ ) -> dict[tuple[str, str, str], typing.Union[None, tuple[str, str, str]]]:
13
+ """Delete an edge from the graph.
14
+
15
+ Parameters
16
+ ----------
17
+ graph : network.MultiDiGraph
18
+ The assembly graph containing the edge to be deleted.
19
+ The operations on this graph will be performed in-place.
20
+ edge : tuple[str, str, str]
21
+ The name of the edge to delete from the graph (src_node, dst_node, key).
22
+
23
+ Returns
24
+ -------
25
+ edges : dict
26
+ Each old edge name is associated with its new name.
27
+ If the new name is None, it means that the edge has been deleted.
28
+ This allows to be informed of all the operations performed.
29
+
30
+ Raises
31
+ ------
32
+ KeyError
33
+ If the edge is not in the graph.
34
+
35
+ Examples
36
+ --------
37
+ >>> from pprint import pprint
38
+ >>> from cutcutcodec.core.classes.container import ContainerOutput
39
+ >>> from cutcutcodec.core.compilation.tree_to_graph import tree_to_graph
40
+ >>> from cutcutcodec.core.edit.operation.remove import remove_edge
41
+ >>> from cutcutcodec.core.io.read_ffmpeg import ContainerInputFFMPEG
42
+ >>> with ContainerInputFFMPEG("cutcutcodec/examples/intro.webm") as container:
43
+ ... tree = ContainerOutput(container.out_streams)
44
+ ...
45
+ >>> graph = tree_to_graph(tree)
46
+ >>> pprint(list(graph.edges))
47
+ [('container_input_ffmpeg_1', 'container_output_1', '0->0'),
48
+ ('container_input_ffmpeg_1', 'container_output_1', '1->1'),
49
+ ('container_input_ffmpeg_1', 'container_output_1', '2->2'),
50
+ ('container_input_ffmpeg_1', 'container_output_1', '3->3')]
51
+ >>> pprint(remove_edge(graph, ('container_input_ffmpeg_1', 'container_output_1', '1->1')))
52
+ {('container_input_ffmpeg_1', 'container_output_1', '1->1'): None,
53
+ ('container_input_ffmpeg_1', 'container_output_1', '2->2'): ('container_input_ffmpeg_1',
54
+ 'container_output_1',
55
+ '2->1'),
56
+ ('container_input_ffmpeg_1', 'container_output_1', '3->3'): ('container_input_ffmpeg_1',
57
+ 'container_output_1',
58
+ '3->2')}
59
+ >>> pprint(list(graph.edges))
60
+ [('container_input_ffmpeg_1', 'container_output_1', '0->0'),
61
+ ('container_input_ffmpeg_1', 'container_output_1', '2->1'),
62
+ ('container_input_ffmpeg_1', 'container_output_1', '3->2')]
63
+ >>>
64
+ """
65
+ assert isinstance(graph, networkx.MultiDiGraph), graph.__class__.__name__
66
+ assert isinstance(edge, tuple), edge.__class__.__name__
67
+ assert len(edge) == 3, edge
68
+ for name in edge:
69
+ assert isinstance(name, str), name.__class__.__name__
70
+ if not graph.has_edge(*edge):
71
+ raise KeyError(f"the edge {edge} is not in the graph")
72
+
73
+ transformations = {edge: None}
74
+ attrs = {}
75
+ ref_index = int(edge[2].split("->")[1])
76
+ for edge_name in graph.in_edges(edge[1], keys=True):
77
+ src, dst, key = edge_name
78
+ if (current_index := int(key.split("->")[1])) <= ref_index:
79
+ continue
80
+ transformations[edge_name] = (src, dst, f"{key.split('->')[0]}->{current_index-1}")
81
+ attrs[transformations[edge_name]] = graph.edges[src, dst, key]
82
+ graph.remove_edges_from(transformations)
83
+ for edge_name, attr in attrs.items():
84
+ graph.add_edge(*edge_name, **attr)
85
+
86
+ return transformations
87
+
88
+
89
+ def remove_edges(
90
+ graph: networkx.MultiDiGraph, edges: typing.Iterable[tuple[str, str, str]]
91
+ ) -> dict[tuple[str, str, str], typing.Union[None, tuple[str, str, str]]]:
92
+ """Delete several edges from the graph.
93
+
94
+ Parameters
95
+ ----------
96
+ graph : network.MultiDiGraph
97
+ The assembly graph containing the edges to be deleted.
98
+ The operations on this graph will be performed in-place.
99
+ edges : typing.Iterable[tuple[str, str, str]]
100
+ The name of the edges to delete from the graph [(src_node, dst_node, key), ...].
101
+
102
+ Returns
103
+ -------
104
+ edges : dict
105
+ Each old edge name is associated with its new name.
106
+ If the new name is None, it means that the edge has been deleted.
107
+ This allows to be informed of all the operations performed.
108
+
109
+ Raises
110
+ ------
111
+ KeyError
112
+ If one of the edges is not in the graph.
113
+
114
+ Examples
115
+ --------
116
+ >>> from pprint import pprint
117
+ >>> from cutcutcodec.core.classes.container import ContainerOutput
118
+ >>> from cutcutcodec.core.compilation.tree_to_graph import tree_to_graph
119
+ >>> from cutcutcodec.core.edit.operation.remove import remove_edges
120
+ >>> from cutcutcodec.core.io.read_ffmpeg import ContainerInputFFMPEG
121
+ >>> with ContainerInputFFMPEG("cutcutcodec/examples/intro.webm") as container:
122
+ ... tree = ContainerOutput(container.out_streams)
123
+ ...
124
+ >>> graph = tree_to_graph(tree)
125
+ >>> pprint(list(graph.edges))
126
+ [('container_input_ffmpeg_1', 'container_output_1', '0->0'),
127
+ ('container_input_ffmpeg_1', 'container_output_1', '1->1'),
128
+ ('container_input_ffmpeg_1', 'container_output_1', '2->2'),
129
+ ('container_input_ffmpeg_1', 'container_output_1', '3->3')]
130
+ >>> pprint(remove_edges(
131
+ ... graph,
132
+ ... [
133
+ ... ('container_input_ffmpeg_1', 'container_output_1', '1->1'),
134
+ ... ('container_input_ffmpeg_1', 'container_output_1', '2->2'),
135
+ ... ],
136
+ ... ))
137
+ {('container_input_ffmpeg_1', 'container_output_1', '1->1'): None,
138
+ ('container_input_ffmpeg_1', 'container_output_1', '2->2'): None,
139
+ ('container_input_ffmpeg_1', 'container_output_1', '3->3'): ('container_input_ffmpeg_1',
140
+ 'container_output_1',
141
+ '3->1')}
142
+ >>> pprint(list(graph.edges))
143
+ [('container_input_ffmpeg_1', 'container_output_1', '0->0'),
144
+ ('container_input_ffmpeg_1', 'container_output_1', '3->1')]
145
+ >>>
146
+ """
147
+ assert isinstance(graph, networkx.MultiDiGraph), graph.__class__.__name__
148
+ assert isinstance(edges, typing.Iterable), edges.__class__.__name__
149
+ edges = list(edges)
150
+ assert all(isinstance(e, tuple) for e in edges), edges
151
+ assert all(len(e) == 3 for e in edges), edges
152
+ for i in range(3):
153
+ assert all(isinstance(e[i], str) for e in edges), edges
154
+ if not all(graph.has_edge(*e) for e in edges):
155
+ raise KeyError(f"one of the edges {edges} is not in the graph")
156
+
157
+ inv_trans = {}
158
+ del_list = []
159
+ edges = list(set(edges)) # eliminates redundancies
160
+ while edges: # as long as there are edges to remove
161
+ local_trans = remove_edge(graph, edges.pop())
162
+ edges = [local_trans.get(e, e) for e in edges]
163
+ for old, new in local_trans.items():
164
+ inv_trans[new] = inv_trans.get(old, old)
165
+ if new is None:
166
+ del_list.append(inv_trans[new])
167
+ if old in inv_trans: # case renamed for second time
168
+ del inv_trans[old]
169
+ trans = {old: new for new, old in inv_trans.items()} | {el: None for el in del_list}
170
+
171
+ return trans
172
+
173
+
174
+ def remove_element(
175
+ graph: networkx.MultiDiGraph, element: typing.Union[str, tuple[str, str, str]]
176
+ ) -> dict[typing.Union[str, tuple[str, str, str]], typing.Union[None, tuple[str, str, str]]]:
177
+ """Alias to ``cutcutcodec.core.edit.operation.remove.remove_elements``."""
178
+ return remove_elements(graph, [element])
179
+
180
+
181
+ def remove_elements(
182
+ graph: networkx.MultiDiGraph, elements: typing.Iterable[typing.Union[str, tuple[str, str, str]]]
183
+ ) -> dict[typing.Union[str, tuple[str, str, str]], typing.Union[None, tuple[str, str, str]]]:
184
+ """Delete several nodes or edges from the graph.
185
+
186
+ Parameters
187
+ ----------
188
+ graph : network.MultiDiGraph
189
+ The assembly graph containing the nodes and edges to be deleted.
190
+ The operations on this graph will be performed in-place.
191
+ elements : typing.Iterable[typing.Union[str, tuple[str, str, str]]]
192
+ The name of nodes and edges to delete from the graph.
193
+
194
+ Returns
195
+ -------
196
+ transformations : dict
197
+ Each old edge or node name is associated with its new name.
198
+ If the new name is None, it means that the element has been deleted.
199
+ This allows to be informed of all the operations performed.
200
+
201
+ Raises
202
+ ------
203
+ KeyError
204
+ If one of the elements is not in the graph.
205
+
206
+ Examples
207
+ --------
208
+ >>> from pprint import pprint
209
+ >>> from cutcutcodec.core.classes.container import ContainerOutput
210
+ >>> from cutcutcodec.core.compilation.tree_to_graph import tree_to_graph
211
+ >>> from cutcutcodec.core.edit.operation.remove import remove_elements
212
+ >>> from cutcutcodec.core.io.read_ffmpeg import ContainerInputFFMPEG
213
+ >>> with (
214
+ ... ContainerInputFFMPEG("cutcutcodec/examples/intro.webm") as container_1,
215
+ ... ContainerInputFFMPEG("cutcutcodec/examples/intro.webm") as container_2,
216
+ ... ):
217
+ ... tree = ContainerOutput([*container_1.out_streams, *container_2.out_streams])
218
+ ...
219
+ >>> graph = tree_to_graph(tree)
220
+ >>> pprint(list(graph.edges))
221
+ [('container_input_ffmpeg_1', 'container_output_1', '0->0'),
222
+ ('container_input_ffmpeg_1', 'container_output_1', '1->1'),
223
+ ('container_input_ffmpeg_1', 'container_output_1', '2->2'),
224
+ ('container_input_ffmpeg_1', 'container_output_1', '3->3'),
225
+ ('container_input_ffmpeg_2', 'container_output_1', '0->4'),
226
+ ('container_input_ffmpeg_2', 'container_output_1', '1->5'),
227
+ ('container_input_ffmpeg_2', 'container_output_1', '2->6'),
228
+ ('container_input_ffmpeg_2', 'container_output_1', '3->7')]
229
+ >>> pprint(list(graph.nodes))
230
+ ['container_output_1', 'container_input_ffmpeg_1', 'container_input_ffmpeg_2']
231
+ >>> pprint(remove_elements(
232
+ ... graph,
233
+ ... ["container_input_ffmpeg_1", ('container_input_ffmpeg_2', 'container_output_1', '1->5')]
234
+ ... ))
235
+ {'container_input_ffmpeg_1': None,
236
+ ('container_input_ffmpeg_1', 'container_output_1', '0->0'): None,
237
+ ('container_input_ffmpeg_1', 'container_output_1', '1->1'): None,
238
+ ('container_input_ffmpeg_1', 'container_output_1', '2->2'): None,
239
+ ('container_input_ffmpeg_1', 'container_output_1', '3->3'): None,
240
+ ('container_input_ffmpeg_2', 'container_output_1', '0->4'): ('container_input_ffmpeg_2',
241
+ 'container_output_1',
242
+ '0->0'),
243
+ ('container_input_ffmpeg_2', 'container_output_1', '1->5'): None,
244
+ ('container_input_ffmpeg_2', 'container_output_1', '2->6'): ('container_input_ffmpeg_2',
245
+ 'container_output_1',
246
+ '2->1'),
247
+ ('container_input_ffmpeg_2', 'container_output_1', '3->7'): ('container_input_ffmpeg_2',
248
+ 'container_output_1',
249
+ '3->2')}
250
+ >>> pprint(list(graph.edges))
251
+ [('container_input_ffmpeg_2', 'container_output_1', '0->0'),
252
+ ('container_input_ffmpeg_2', 'container_output_1', '2->1'),
253
+ ('container_input_ffmpeg_2', 'container_output_1', '3->2')]
254
+ >>> pprint(list(graph.nodes))
255
+ ['container_output_1', 'container_input_ffmpeg_2']
256
+ >>>
257
+ """
258
+ assert isinstance(graph, networkx.MultiDiGraph), graph.__class__.__name__
259
+ assert isinstance(elements, typing.Iterable), elements.__class__.__name__
260
+ elements = list(elements)
261
+
262
+ # separate nodes and edges
263
+ nodes = [n for n in elements if isinstance(n, str)]
264
+ if not all(n in graph for n in nodes):
265
+ raise KeyError(f"one of the nodes {nodes} is not in the graph")
266
+ edges = [e for e in elements if isinstance(e, tuple)]
267
+ assert len(nodes) + len(edges) == len(elements)
268
+
269
+ edges.extend([edge for node in nodes for edge in graph.out_edges(node, keys=True)])
270
+ edges.extend([edge for node in nodes for edge in graph.in_edges(node, keys=True)])
271
+ transformations = remove_edges(graph, edges)
272
+ transformations.update(remove_nodes(graph, nodes))
273
+
274
+ return transformations
275
+
276
+
277
+ def remove_node(
278
+ graph: networkx.MultiDiGraph, node: str
279
+ ) -> dict[typing.Union[str, tuple[str, str, str]], typing.Union[None, tuple[str, str, str]]]:
280
+ """Delete a node from the graph.
281
+
282
+ Also deletes the edges linked to this node.
283
+
284
+ Parameters
285
+ ----------
286
+ graph : network.MultiDiGraph
287
+ The assembly graph containing the node to be deleted.
288
+ The operations on this graph will be performed in-place.
289
+ node : str
290
+ The name of the node to delete from the graph.
291
+
292
+ Returns
293
+ -------
294
+ transformations : dict
295
+ Each old edge or node name is associated with its new name.
296
+ If the new name is None, it means that the element has been deleted.
297
+ This allows to be informed of all the operations performed.
298
+
299
+ Raises
300
+ ------
301
+ KeyError
302
+ If the node is not in the graph.
303
+
304
+ Examples
305
+ --------
306
+ >>> from pprint import pprint
307
+ >>> from cutcutcodec.core.classes.container import ContainerOutput
308
+ >>> from cutcutcodec.core.compilation.tree_to_graph import tree_to_graph
309
+ >>> from cutcutcodec.core.edit.operation.remove import remove_node
310
+ >>> from cutcutcodec.core.io.read_ffmpeg import ContainerInputFFMPEG
311
+ >>> with (
312
+ ... ContainerInputFFMPEG("cutcutcodec/examples/intro.webm") as container_1,
313
+ ... ContainerInputFFMPEG("cutcutcodec/examples/intro.webm") as container_2,
314
+ ... ):
315
+ ... tree = ContainerOutput([*container_1.out_streams, *container_2.out_streams])
316
+ ...
317
+ >>> graph = tree_to_graph(tree)
318
+ >>> pprint(list(graph.edges))
319
+ [('container_input_ffmpeg_1', 'container_output_1', '0->0'),
320
+ ('container_input_ffmpeg_1', 'container_output_1', '1->1'),
321
+ ('container_input_ffmpeg_1', 'container_output_1', '2->2'),
322
+ ('container_input_ffmpeg_1', 'container_output_1', '3->3'),
323
+ ('container_input_ffmpeg_2', 'container_output_1', '0->4'),
324
+ ('container_input_ffmpeg_2', 'container_output_1', '1->5'),
325
+ ('container_input_ffmpeg_2', 'container_output_1', '2->6'),
326
+ ('container_input_ffmpeg_2', 'container_output_1', '3->7')]
327
+ >>> pprint(list(graph.nodes))
328
+ ['container_output_1', 'container_input_ffmpeg_1', 'container_input_ffmpeg_2']
329
+ >>> pprint(remove_node(graph, "container_input_ffmpeg_1"))
330
+ {'container_input_ffmpeg_1': None,
331
+ ('container_input_ffmpeg_1', 'container_output_1', '0->0'): None,
332
+ ('container_input_ffmpeg_1', 'container_output_1', '1->1'): None,
333
+ ('container_input_ffmpeg_1', 'container_output_1', '2->2'): None,
334
+ ('container_input_ffmpeg_1', 'container_output_1', '3->3'): None,
335
+ ('container_input_ffmpeg_2', 'container_output_1', '0->4'): ('container_input_ffmpeg_2',
336
+ 'container_output_1',
337
+ '0->0'),
338
+ ('container_input_ffmpeg_2', 'container_output_1', '1->5'): ('container_input_ffmpeg_2',
339
+ 'container_output_1',
340
+ '1->1'),
341
+ ('container_input_ffmpeg_2', 'container_output_1', '2->6'): ('container_input_ffmpeg_2',
342
+ 'container_output_1',
343
+ '2->2'),
344
+ ('container_input_ffmpeg_2', 'container_output_1', '3->7'): ('container_input_ffmpeg_2',
345
+ 'container_output_1',
346
+ '3->3')}
347
+ >>> pprint(list(graph.edges))
348
+ [('container_input_ffmpeg_2', 'container_output_1', '0->0'),
349
+ ('container_input_ffmpeg_2', 'container_output_1', '1->1'),
350
+ ('container_input_ffmpeg_2', 'container_output_1', '2->2'),
351
+ ('container_input_ffmpeg_2', 'container_output_1', '3->3')]
352
+ >>> pprint(list(graph.nodes))
353
+ ['container_output_1', 'container_input_ffmpeg_2']
354
+ >>>
355
+ """
356
+ assert isinstance(graph, networkx.MultiDiGraph), graph.__class__.__name__
357
+ assert isinstance(node, str), node.__class__.__name__
358
+ if node not in graph:
359
+ raise KeyError(f"the node {node} is not in the graph")
360
+
361
+ transformations = {edge: None for edge in graph.in_edges(node, keys=True)}
362
+ graph.remove_edges_from(transformations)
363
+ transformations.update(remove_edges(graph, graph.out_edges(node, keys=True)))
364
+ transformations[node] = None
365
+ graph.remove_node(node)
366
+
367
+ return transformations
368
+
369
+
370
+ def remove_nodes(
371
+ graph: networkx.MultiDiGraph, nodes: typing.Iterable[str]
372
+ ) -> dict[typing.Union[str, tuple[str, str, str]], typing.Union[None, tuple[str, str, str]]]:
373
+ """Delete several nodes from the graph.
374
+
375
+ Parameters
376
+ ----------
377
+ graph : network.MultiDiGraph
378
+ The assembly graph containing the nodes to be deleted.
379
+ The operations on this graph will be performed in-place.
380
+ nodes : typing.Iterable[str]
381
+ The name of the nodes to delete from the graph.
382
+
383
+ Returns
384
+ -------
385
+ transformations : dict
386
+ Each old edge or node name is associated with its new name.
387
+ If the new name is None, it means that the element has been deleted.
388
+ This allows to be informed of all the operations performed.
389
+
390
+ Raises
391
+ ------
392
+ KeyError
393
+ If one of the nodes is not in the graph.
394
+
395
+ Examples
396
+ --------
397
+ >>> from pprint import pprint
398
+ >>> from cutcutcodec.core.classes.container import ContainerOutput
399
+ >>> from cutcutcodec.core.compilation.tree_to_graph import tree_to_graph
400
+ >>> from cutcutcodec.core.edit.operation.remove import remove_nodes
401
+ >>> from cutcutcodec.core.io.read_ffmpeg import ContainerInputFFMPEG
402
+ >>> with (
403
+ ... ContainerInputFFMPEG("cutcutcodec/examples/intro.webm") as container_1,
404
+ ... ContainerInputFFMPEG("cutcutcodec/examples/intro.webm") as container_2,
405
+ ... ContainerInputFFMPEG("cutcutcodec/examples/intro.webm") as container_3,
406
+ ... ):
407
+ ... tree = ContainerOutput(
408
+ ... [*container_1.out_streams, *container_2.out_streams, *container_3.out_streams]
409
+ ... )
410
+ ...
411
+ >>> graph = tree_to_graph(tree)
412
+ >>> pprint(list(graph.edges))
413
+ [('container_input_ffmpeg_1', 'container_output_1', '0->0'),
414
+ ('container_input_ffmpeg_1', 'container_output_1', '1->1'),
415
+ ('container_input_ffmpeg_1', 'container_output_1', '2->2'),
416
+ ('container_input_ffmpeg_1', 'container_output_1', '3->3'),
417
+ ('container_input_ffmpeg_2', 'container_output_1', '0->4'),
418
+ ('container_input_ffmpeg_2', 'container_output_1', '1->5'),
419
+ ('container_input_ffmpeg_2', 'container_output_1', '2->6'),
420
+ ('container_input_ffmpeg_2', 'container_output_1', '3->7'),
421
+ ('container_input_ffmpeg_3', 'container_output_1', '0->8'),
422
+ ('container_input_ffmpeg_3', 'container_output_1', '1->9'),
423
+ ('container_input_ffmpeg_3', 'container_output_1', '2->10'),
424
+ ('container_input_ffmpeg_3', 'container_output_1', '3->11')]
425
+ >>> pprint(list(graph.nodes))
426
+ ['container_output_1',
427
+ 'container_input_ffmpeg_1',
428
+ 'container_input_ffmpeg_2',
429
+ 'container_input_ffmpeg_3']
430
+ >>> pprint(remove_nodes(graph, ["container_input_ffmpeg_1", "container_input_ffmpeg_2"]))
431
+ {'container_input_ffmpeg_1': None,
432
+ 'container_input_ffmpeg_2': None,
433
+ ('container_input_ffmpeg_1', 'container_output_1', '0->0'): None,
434
+ ('container_input_ffmpeg_1', 'container_output_1', '1->1'): None,
435
+ ('container_input_ffmpeg_1', 'container_output_1', '2->2'): None,
436
+ ('container_input_ffmpeg_1', 'container_output_1', '3->3'): None,
437
+ ('container_input_ffmpeg_2', 'container_output_1', '0->4'): None,
438
+ ('container_input_ffmpeg_2', 'container_output_1', '1->5'): None,
439
+ ('container_input_ffmpeg_2', 'container_output_1', '2->6'): None,
440
+ ('container_input_ffmpeg_2', 'container_output_1', '3->7'): None,
441
+ ('container_input_ffmpeg_3', 'container_output_1', '0->8'): ('container_input_ffmpeg_3',
442
+ 'container_output_1',
443
+ '0->0'),
444
+ ('container_input_ffmpeg_3', 'container_output_1', '1->9'): ('container_input_ffmpeg_3',
445
+ 'container_output_1',
446
+ '1->1'),
447
+ ('container_input_ffmpeg_3', 'container_output_1', '2->10'): ('container_input_ffmpeg_3',
448
+ 'container_output_1',
449
+ '2->2'),
450
+ ('container_input_ffmpeg_3', 'container_output_1', '3->11'): ('container_input_ffmpeg_3',
451
+ 'container_output_1',
452
+ '3->3')}
453
+ >>> pprint(list(graph.edges))
454
+ [('container_input_ffmpeg_3', 'container_output_1', '0->0'),
455
+ ('container_input_ffmpeg_3', 'container_output_1', '1->1'),
456
+ ('container_input_ffmpeg_3', 'container_output_1', '2->2'),
457
+ ('container_input_ffmpeg_3', 'container_output_1', '3->3')]
458
+ >>> pprint(list(graph.nodes))
459
+ ['container_output_1', 'container_input_ffmpeg_3']
460
+ >>>
461
+ """
462
+ assert isinstance(graph, networkx.MultiDiGraph), graph.__class__.__name__
463
+ assert isinstance(nodes, typing.Iterable), nodes.__class__.__name__
464
+ nodes = list(nodes)
465
+ assert all(isinstance(n, str) for n in nodes), nodes
466
+ if not all(n in graph for n in nodes):
467
+ raise KeyError(f"one of the nodes {nodes} is not in the graph")
468
+
469
+ transformations = {edge: None for node in nodes for edge in graph.in_edges(node, keys=True)}
470
+ graph.remove_edges_from(transformations)
471
+ edges = {edge for node in nodes for edge in graph.out_edges(node, keys=True)}
472
+ transformations.update(remove_edges(graph, edges))
473
+ transformations.update({node: None for node in nodes})
474
+ graph.remove_nodes_from(set(nodes))
475
+
476
+ return transformations
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env python3
2
+
3
+ """Groups the exceptions specific to ``cutcutcodec``.
4
+
5
+ Rather than returning too general exceptions, these exceptions allow a much more precise debugging.
6
+ """
7
+
8
+
9
+ class CutcutcodecException(Exception):
10
+ """Base class for exceptions specific to this module."""
11
+
12
+
13
+ class CompilationError(CutcutcodecException, RuntimeError):
14
+ """When a dynamic compilation or execution failed."""
15
+
16
+
17
+ class DecodeError(CutcutcodecException, OSError):
18
+ """When failed to decode a multimedia file or a stream."""
19
+
20
+
21
+ class EncodeError(CutcutcodecException, OSError):
22
+ """When failed to encode a multimedia file or a stream."""
23
+
24
+
25
+ class IncompatibleSettings(CutcutcodecException, RuntimeError):
26
+ """When parameters are incompatible with each other.
27
+
28
+ This exception may mean that a choice is not possible.
29
+ """
30
+
31
+
32
+ class MissingFrameError(CutcutcodecException, OSError):
33
+ """When a frame is missing in a stream.
34
+
35
+ This exception can be thrown if the readed frames have a strange behavior.
36
+ """
37
+
38
+
39
+ class MissingInformation(CutcutcodecException, ValueError):
40
+ """When information is unreadable or missing from the metadata.
41
+
42
+ It can be raised when trying to access a tag that is not defined
43
+ or that returns a surprising value.
44
+ """
45
+
46
+
47
+ class MissingStreamError(CutcutcodecException, OSError):
48
+ """When a stream is missing in a file.
49
+
50
+ This exception can be raised when looking for a video,
51
+ audio or image stream in a media that does not contain any or that is unreadable.
52
+ """
53
+
54
+
55
+ class OutOfTimeRange(CutcutcodecException, EOFError):
56
+ """Access outside the definition range.
57
+
58
+ This exception is raised when accessing or writing
59
+ outside the range in which the stream is defined.
60
+ """
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env python3
2
+
3
+ """Provide effects and filters."""
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env python3
2
+
3
+ """Provide audio effects and filters."""