Skip to content

Commit e4c74d1

Browse files
committed
Updated docs for Unit
1 parent 6995515 commit e4c74d1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

domdf_python_tools/pagesizes/units.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
# stdlib
3434
import math
3535
from decimal import ROUND_HALF_UP, Decimal
36-
from typing import Union
36+
from typing import SupportsFloat, Union
3737

3838
# this package
3939
from domdf_python_tools.doctools import prettify_docstrings
@@ -62,7 +62,7 @@ def _rounders(val_to_round: Union[str, int, float, Decimal], round_format: str)
6262

6363
@prettify_docstrings
6464
class Unit(float):
65-
"""
65+
r"""
6666
Represents a unit, such as a point.
6767
6868
Behaves much like a float (which it inherits from).
@@ -139,7 +139,7 @@ class Unit(float):
139139
140140
**Division**
141141
142-
:class:`~domdf_python_tools.pagesizes.units.Unit`s can only be divided by :class:`float` and :class:`int` objects:
142+
:class:`~domdf_python_tools.pagesizes.units.Unit`\s can only be divided by :class:`float` and :class:`int` objects:
143143
144144
.. code-block:: python
145145
@@ -281,8 +281,14 @@ def from_pt(cls, value: float) -> "Unit":
281281

282282
return cls(value / cls._in_pt)
283283

284-
def __call__(self, *args, **kwargs) -> "Unit":
285-
return self.__class__(*args, **kwargs)
284+
def __call__(self, value: Union[SupportsFloat, str, bytes, bytearray] = 0.0) -> "Unit":
285+
"""
286+
Returns an instance of the :class:`Unit` with the given value.
287+
288+
:param value:
289+
"""
290+
291+
return self.__class__(value)
286292

287293

288294
class Unitpt(Unit):

0 commit comments

Comments
 (0)