MCPcopy
hub / github.com/Textualize/rich / normalize

Method normalize

rich/measure.py:24–32  ·  view source on GitHub ↗

Get measurement that ensures that minimum <= maximum and minimum >= 0 Returns: Measurement: A normalized measurement.

(self)

Source from the content-addressed store, hash-verified

22 return self.maximum - self.minimum
23
24 def normalize(self) -> "Measurement":
25 """Get measurement that ensures that minimum <= maximum and minimum >= 0
26
27 Returns:
28 Measurement: A normalized measurement.
29 """
30 minimum, maximum = self
31 minimum = min(max(0, minimum), maximum)
32 return Measurement(max(0, minimum), max(0, max(minimum, maximum)))
33
34 def with_maximum(self, width: int) -> "Measurement":
35 """Get a RenderableWith where the widths are <= width.

Callers 1

getMethod · 0.45

Calls 1

MeasurementClass · 0.85

Tested by

no test coverage detected