File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,14 @@ class StreamMetadata:
4141 def __repr__ (self ):
4242 s = self .__class__ .__name__ + ":\n "
4343 for field in dataclasses .fields (self ):
44- s += f"{ SPACES } { field .name } : { getattr (self , field .name )} \n "
44+ attr = getattr (self , field .name )
45+ if isinstance (attr , Fraction ):
46+ # Fractions are displayed as integers when possible,
47+ # but we want to always display num/den. Once we
48+ # require Python >=3.13 we can use format(.., "#").
49+ s += f"{ SPACES } { field .name } : { attr .numerator } /{ attr .denominator } \n "
50+ else :
51+ s += f"{ SPACES } { field .name } : { attr } \n "
4552 return s
4653
4754
Original file line number Diff line number Diff line change @@ -254,7 +254,7 @@ def test_repr():
254254 num_frames_from_header: 390
255255 num_frames_from_content: 390
256256 average_fps_from_header: 29.97003
257- pixel_aspect_ratio: 1
257+ pixel_aspect_ratio: 1/1
258258 duration_seconds: 13.013
259259 begin_stream_seconds: 0.0
260260 end_stream_seconds: 13.013
You can’t perform that action at this time.
0 commit comments