pycaption 2.2.25__tar.gz → 2.2.27__tar.gz

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.
Files changed (61) hide show
  1. {pycaption-2.2.25/pycaption.egg-info → pycaption-2.2.27}/PKG-INFO +1 -1
  2. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/geometry.py +10 -4
  3. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/scc/specialized_collections.py +10 -6
  4. pycaption-2.2.27/pycaption/webvtt.py +857 -0
  5. {pycaption-2.2.25 → pycaption-2.2.27/pycaption.egg-info}/PKG-INFO +1 -1
  6. {pycaption-2.2.25 → pycaption-2.2.27}/setup.py +1 -1
  7. {pycaption-2.2.25 → pycaption-2.2.27}/tests/conftest.py +2 -0
  8. {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/webvtt.py +35 -0
  9. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_scc.py +4 -4
  10. pycaption-2.2.27/tests/test_webvtt.py +714 -0
  11. pycaption-2.2.27/tests/test_webvtt_conversion.py +252 -0
  12. pycaption-2.2.25/pycaption/webvtt.py +0 -467
  13. pycaption-2.2.25/tests/test_webvtt.py +0 -204
  14. pycaption-2.2.25/tests/test_webvtt_conversion.py +0 -116
  15. {pycaption-2.2.25 → pycaption-2.2.27}/LICENSE +0 -0
  16. {pycaption-2.2.25 → pycaption-2.2.27}/MANIFEST.in +0 -0
  17. {pycaption-2.2.25 → pycaption-2.2.27}/README.rst +0 -0
  18. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/__init__.py +0 -0
  19. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/base.py +0 -0
  20. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/dfxp/__init__.py +0 -0
  21. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/dfxp/base.py +0 -0
  22. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/dfxp/extras.py +0 -0
  23. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/exceptions.py +0 -0
  24. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/microdvd.py +0 -0
  25. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/sami.py +0 -0
  26. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/scc/__init__.py +0 -0
  27. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/scc/constants.py +0 -0
  28. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/scc/state_machines.py +0 -0
  29. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/scc/translator.py +0 -0
  30. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/srt.py +0 -0
  31. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/transcript.py +0 -0
  32. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/utils.py +0 -0
  33. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption.egg-info/SOURCES.txt +0 -0
  34. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption.egg-info/dependency_links.txt +0 -0
  35. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption.egg-info/requires.txt +0 -0
  36. {pycaption-2.2.25 → pycaption-2.2.27}/pycaption.egg-info/top_level.txt +0 -0
  37. {pycaption-2.2.25 → pycaption-2.2.27}/setup.cfg +0 -0
  38. {pycaption-2.2.25 → pycaption-2.2.27}/tests/__init__.py +0 -0
  39. {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/__init__.py +0 -0
  40. {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/dfxp.py +0 -0
  41. {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/microdvd.py +0 -0
  42. {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/sami.py +0 -0
  43. {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/scc.py +0 -0
  44. {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/srt.py +0 -0
  45. {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/translated_scc.py +0 -0
  46. {pycaption-2.2.25 → pycaption-2.2.27}/tests/mixins.py +0 -0
  47. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_base.py +0 -0
  48. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_dfxp.py +0 -0
  49. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_dfxp_conversion.py +0 -0
  50. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_dfxp_extras.py +0 -0
  51. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_functions.py +0 -0
  52. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_geometry.py +0 -0
  53. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_microdvd.py +0 -0
  54. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_microdvd_conversion.py +0 -0
  55. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_sami.py +0 -0
  56. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_sami_conversion.py +0 -0
  57. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_scc_conversion.py +0 -0
  58. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_scc_translator.py +0 -0
  59. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_scc_writer.py +0 -0
  60. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_srt.py +0 -0
  61. {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_srt_conversion.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycaption
3
- Version: 2.2.25
3
+ Version: 2.2.27
4
4
  Summary: Closed caption converter
5
5
  Author: Joe Norton
6
6
  Author-email: joey@nortoncrew.com
@@ -213,9 +213,15 @@ class Stretch(TwoDimensionalObject):
213
213
 
214
214
 
215
215
  class Region:
216
- """Represents the spatial coordinates of a rectangle
217
-
218
- Don't instantiate by hand. use Region.from_points or Region.from_extent
216
+ """Represents the spatial coordinates of a rectangle.
217
+
218
+ NOTE: This class is currently dead code — not imported or used anywhere in
219
+ the codebase. It also contains known bugs (align_from_origin returns
220
+ inconsistent types, add_extent method does not exist on Point). We left it
221
+ here because it may serve as a starting point if we ever need geometric
222
+ rectangle operations beyond what Layout class provides (e.g. region
223
+ intersection or point-in-region checks).
224
+ If we'll ever need it, fix the bugs first.
219
225
  """
220
226
 
221
227
  @classmethod
@@ -846,7 +852,7 @@ class Layout:
846
852
  found_absolute_unit = False
847
853
  if bottom_right.x.unit != UnitEnum.PERCENT:
848
854
  found_absolute_unit = True
849
- elif bottom_right.x.unit != UnitEnum.PERCENT:
855
+ elif bottom_right.y.unit != UnitEnum.PERCENT:
850
856
  found_absolute_unit = True
851
857
 
852
858
  if found_absolute_unit:
@@ -26,6 +26,9 @@ from .constants import (
26
26
 
27
27
  PopOnCue = collections.namedtuple("PopOnCue", "buffer, start, end")
28
28
 
29
+ # First two hex chars of SCC codes that produce punctuation ['.', '!', '?', ',']
30
+ _PUNCTUATION_PREFIXES = frozenset(["ae", "a1", "bf", "2c"])
31
+
29
32
 
30
33
  class PreCaption:
31
34
  """
@@ -444,8 +447,7 @@ class InstructionNodeCreator:
444
447
  # handle mid-row codes that follows a text node
445
448
  # don't add space if the next command adds one of
446
449
  # ['.', '!', '?', ',']
447
- punctuation = ["ae", "a1", "bf", "2c"]
448
- next_is_punctuation = next_command and next_command[:2] in punctuation
450
+ next_is_punctuation = next_command and next_command[:2] in _PUNCTUATION_PREFIXES
449
451
  prev_text_node = self.get_previous_text_node()
450
452
  prev_node_is_break = prev_text_node is not None and any(
451
453
  x.is_explicit_break()
@@ -501,9 +503,9 @@ class InstructionNodeCreator:
501
503
  if len(collection) == 0:
502
504
  return False
503
505
  for element in collection[::-1]:
504
- if element._type == 0:
506
+ if element._type == _InstructionNode.TEXT:
505
507
  return False
506
- elif element._type == 1:
508
+ elif element._type == _InstructionNode.BREAK:
507
509
  return True
508
510
  return False
509
511
 
@@ -782,6 +784,8 @@ def _format_italics(collection):
782
784
 
783
785
 
784
786
  def _remove_spaces_at_end_of_the_line(collection):
787
+ if not collection:
788
+ return collection
785
789
  for idx, node in enumerate(collection):
786
790
  if (
787
791
  idx > 0
@@ -826,7 +830,7 @@ def _remove_noop_on_off_italics(collection):
826
830
  return new_collection
827
831
 
828
832
 
829
- def _remove_noon_off_on_italics(collection):
833
+ def _remove_noop_off_on_italics(collection):
830
834
  """Removes pairs of off-on italics nodes, that don't surround any other
831
835
  node
832
836
 
@@ -867,7 +871,7 @@ def _remove_noop_italics(collection):
867
871
  """
868
872
  new_collection = _remove_noop_on_off_italics(collection)
869
873
 
870
- new_collection = _remove_noon_off_on_italics(new_collection)
874
+ new_collection = _remove_noop_off_on_italics(new_collection)
871
875
 
872
876
  return new_collection
873
877