5959
6060class BaseSize (namedtuple ("__BaseSize" , "width, height" )):
6161 """
62- Base class namedtuple representing a page size, in point
63-
64- :param width: The page width
65- :type width: |AnyNumber|
66- :param height: The page height
67- :type height: |AnyNumber|
62+ Base class namedtuple representing a page size, in point.
6863 """
6964
7065 __slots__ : List [str ] = []
7166 _unit : Unit = pt
67+
68+ #: The page width.
7269 width : Unit
70+
71+ #: The page height.
7372 height : Unit
7473
7574 def __new__ (cls , width : AnyNumber , height : AnyNumber ):
75+ """
76+ Create a new :class:`~.BaseSize` object.
77+
78+ :param width: The page width.
79+ :param height: The page height.
80+ """
81+
7682 return super ().__new__ (
7783 cls ,
7884 cls ._unit (width ),
@@ -88,10 +94,10 @@ def from_pt(cls, size: Tuple[float, float]):
8894 Create a :class:`~domdf_python_tools.pagesizes.classes.BaseSize` object from a
8995 page size in point.
9096
91- :param size: The size, in point, to convert from
97+ :param size: The size, in point, to convert from.
9298
9399 :rtype: A subclass of :class:`~domdf_python_tools.pagesizes.classes.BaseSize`
94- """
100+ """ # noqa D400
95101
96102 assert isinstance (size , PageSize )
97103
@@ -100,35 +106,35 @@ def from_pt(cls, size: Tuple[float, float]):
100106 @classmethod
101107 def from_size (cls , size : Tuple [AnyNumber , AnyNumber ]) -> "BaseSize" :
102108 """
103- Create a :class:`~domdf_python_tools.pagesizes.classes.BaseSize` object from a tuple
109+ Create a :class:`~domdf_python_tools.pagesizes.classes.BaseSize` object from a tuple.
104110 """
105111
106112 return cls (* size )
107113
108114 def is_landscape (self ) -> bool :
109115 """
110- Returns whether the page is in the landscape orientation
116+ Returns whether the page is in the landscape orientation.
111117 """
112118
113119 return self .width >= self .height
114120
115121 def is_portrait (self ) -> bool :
116122 """
117- Returns whether the page is in the portrait orientation
123+ Returns whether the page is in the portrait orientation.
118124 """
119125
120126 return self .width < self .height
121127
122128 def is_square (self ) -> bool :
123129 """
124- Returns whether the given pagesize is square
130+ Returns whether the given pagesize is square.
125131 """
126132
127133 return self .width == self .height
128134
129135 def landscape (self ) -> "BaseSize" :
130136 """
131- Returns the pagesize in landscape orientation
137+ Returns the pagesize in landscape orientation.
132138 """
133139
134140 if self .is_portrait ():
@@ -138,7 +144,7 @@ def landscape(self) -> "BaseSize":
138144
139145 def portrait (self ) -> "BaseSize" :
140146 """
141- Returns the pagesize in portrait orientation
147+ Returns the pagesize in portrait orientation.
142148 """
143149
144150 if self .is_landscape ():
@@ -148,7 +154,7 @@ def portrait(self) -> "BaseSize":
148154
149155 def to_pt (self ) -> "PageSize" :
150156 """
151- Returns the page size in point
157+ Returns the page size in point.
152158 """
153159
154160 return PageSize (self .width .as_pt (), self .height .as_pt ())
@@ -159,83 +165,50 @@ def to_pt(self) -> "PageSize":
159165
160166class Size_mm (BaseSize ):
161167 """
162- Subclass of :class:`~domdf_python_tools.pagesizes.classes.BaseSize`
163- representing a pagesize in millimeters.
164-
165- :param width: The page width
166- :type width: |AnyNumber|
167- :param height: The page height
168- :type height: |AnyNumber|
168+ Represents a pagesize in millimeters.
169169 """
170170
171171 _unit = mm
172172
173173
174174class Size_inch (BaseSize ):
175175 """
176- Subclass of :class:`~domdf_python_tools.pagesizes.classes.BaseSize`
177- representing a pagesize in inches.
178-
179- :param width: The page width
180- :type width: |AnyNumber|
181- :param height: The page height
182- :type height: |AnyNumber|
176+ Represents a pagesize in inches.
183177 """
184178
185179 _unit = inch
186180
187181
188182class Size_cm (BaseSize ):
189183 """
190- Subclass of :class:`~domdf_python_tools.pagesizes.classes.BaseSize`
191- representing a pagesize in centimeters.
192-
193- :param width: The page width
194- :type width: |AnyNumber|
195- :param height: The page height
196- :type height: |AnyNumber|
184+ Represents a pagesize in centimeters.
197185 """
198186
199187 _unit = cm
200188
201189
202190class Size_um (BaseSize ):
203191 """
204- Subclass of :class:`~domdf_python_tools.pagesizes.classes.BaseSize`
205- representing a pagesize in micrometers.
206-
207- :param width: The page width
208- :type width: |AnyNumber|
209- :param height: The page height
210- :type height: |AnyNumber|
192+ Represents a pagesize in micrometers.
211193 """
212194
213195 _unit = um
214196
215197
216198class Size_pica (BaseSize ):
217199 """
218- Subclass of :class:`~domdf_python_tools.pagesizes.classes.BaseSize`
219- representing a pagesize in pica.
220-
221- :param width: The page width
222- :type width: |AnyNumber|
223- :param height: The page height
224- :type height: |AnyNumber|
200+ Represents a pagesize in pica.
225201 """
226202
227203 _unit = pica
228204
229205
230206class PageSize (BaseSize ):
231207 """
232- Subclass of :class:`~domdf_python_tools.pagesizes.classes.BaseSize`
233- representing a pagesize in point.
208+ Represents a pagesize in point.
234209
235210 :param width: The page width
236- :type width: |AnyNumber|
237211 :param height: The page height
238- :type height: |AnyNumber|
239212
240213 The pagesize can be converted to other units using the properties below.
241214 """
@@ -246,8 +219,8 @@ def __new__(cls, width: AnyNumber, height: AnyNumber, unit: AnyNumber = pt):
246219 """
247220 Create a new :class:`~domdf_python_tools.pagesizes.classes.PageSize` object.
248221
249- :param width:
250- :param height:
222+ :param width: The page width.
223+ :param height: The page height.
251224 :param unit:
252225 """
253226
0 commit comments