MCPcopy Create free account
hub / github.com/PageBot/PageBot / Mm

Class Mm

Lib/pagebot/toolbox/units.py:1024–1064  ·  view source on GitHub ↗

Answers the millimetre instance. >>> u = Mm(210) >>> u 210mm >>> u = mm('297mm') # A4 >>> u 297mm >>> u/2 148.5mm >>> u-100 197mm >>> u+100 397mm >>> u.v # Raw value of the Unit instance 297 >>> isinstance(u.v, (int, float)) True >

Source from the content-addressed store, hash-verified

1022 return u
1023
1024class Mm(Unit):
1025 """Answers the millimetre instance.
1026
1027 >>> u = Mm(210)
1028 >>> u
1029 210mm
1030 >>> u = mm('297mm') # A4
1031 >>> u
1032 297mm
1033 >>> u/2
1034 148.5mm
1035 >>> u-100
1036 197mm
1037 >>> u+100
1038 397mm
1039 >>> u.v # Raw value of the Unit instance
1040 297
1041 >>> isinstance(u.v, (int, float))
1042 True
1043 >>> pt(u).rounded # Rounded A4 --> pts
1044 842pt
1045 >>> mm(10, 11, 12) # Multiple arguments create a list of tuple mm
1046 (10mm, 11mm, 12mm)
1047 >>> mm((10, 11, 12, 13)) # Arguments can be submitted as list or tuple
1048 (10mm, 11mm, 12mm, 13mm)
1049 >>> mm(pt(5), p(6), '3"') # Arguments can be a list of other units types.
1050 (1.76mm, 25.4mm, 76.2mm)
1051 """
1052 PT_FACTOR = MM # mm <---> points
1053 UNIT = 'mm'
1054
1055 def _get_mm(self):
1056 """Just answer the self.rv value.
1057
1058 >>> mm(5).mm
1059 5
1060 >>> 10 * mm(5).mm
1061 50
1062 """
1063 return self.rv
1064 mm = property(_get_mm)
1065
1066# Cm
1067

Callers 1

mmFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected