Skip to content

Commit e2ebc57

Browse files
author
Tim Bielawa
committed
Add docstrings to properties
1 parent bbcb860 commit e2ebc57

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

bitmath/__init__.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -251,30 +251,29 @@ def _norm(self, value):
251251
# Properties
252252

253253
#: The mathematical base of an instance
254-
base = property(lambda s: s._base)
254+
base = property(lambda s: s._base,
255+
doc="The mathematical base of the unit of the instance (this will be 2 or 10)")
255256

256-
binary = property(lambda s: bin(int(s.bits)))
257-
"""The binary representation of an instance in binary 1s and 0s. Note
257+
binary = property(lambda s: bin(int(s.bits)),
258+
doc="""The binary representation of an instance in binary 1s and 0s. Note
258259
that for very large numbers this will mean a lot of 1s and 0s. For
259-
example, GiB(100) would be represented as::
260+
example, GiB(100) would be represented in Python as::
260261
261262
0b1100100000000000000000000000000000000000
262-
263263
That leading ``0b`` is normal. That's how Python represents binary.
264-
265-
"""
264+
""")
266265

267266
#: Alias for :attr:`binary`
268-
bin = property(lambda s: s.binary)
267+
bin = property(lambda s: s.binary, doc="Alias for the 'binary' property")
269268

270269
#: The number of bits in an instance
271-
bits = property(lambda s: s._bit_value)
270+
bits = property(lambda s: s._bit_value, doc="The number of bits in an instance")
272271

273272
#: The number of bytes in an instance
274-
bytes = property(lambda s: s._byte_value)
273+
bytes = property(lambda s: s._byte_value, doc="The number of bytes in an instance")
275274

276275
#: The mathematical power of an instance
277-
power = property(lambda s: s._power)
276+
power = property(lambda s: s._power, doc="The mathematical power of an instance")
278277

279278
@property
280279
def system(self):
@@ -304,7 +303,6 @@ def unit(self):
304303
>>> Byte(1).unit == 'Byte'
305304
>>> Byte(1.1).unit == 'Bytes'
306305
>>> Gb(2).unit == 'Gbs'
307-
308306
"""
309307
global format_plural
310308

@@ -328,7 +326,6 @@ def unit_plural(self):
328326
>>> KiB(1).unit_plural == 'KiB'
329327
>>> Byte(1024).unit_plural == 'Bytes'
330328
>>> Gb(1).unit_plural == 'Gb'
331-
332329
"""
333330
return self._name_plural
334331

0 commit comments

Comments
 (0)