From f53d9c23cae265ffd2e83952b9eaa9d2e0f547c4 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Fri, 10 Jul 2020 12:36:19 +0200 Subject: [PATCH] Add param defs to the doc strings [ci skip] --- pyvarint/varint.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pyvarint/varint.py b/pyvarint/varint.py index 3cd3940..26f35df 100644 --- a/pyvarint/varint.py +++ b/pyvarint/varint.py @@ -4,7 +4,10 @@ from io import BytesIO def encode(number: int) -> bytes: - """Encode to varint""" + """Encode to varint + + :param number: the integer to encode + """ buf = b"" while True: @@ -20,7 +23,10 @@ def encode(number: int) -> bytes: def decode(buf: bytes) -> int: - """Decode to bytes""" + """Decode to bytes + + :param buf: the buffer to decode to an integer + """ stream = BytesIO(buf) shift = 0 @@ -43,7 +49,10 @@ def decode(buf: bytes) -> int: def encoding_length(n: int) -> int: - """The number of bytes this number will be encoded as.""" + """The number of bytes this number will be encoded as. + + :param n: the number for which the encoding length will be calculated + """ N1 = pow(2, 7) N2 = pow(2, 14) N3 = pow(2, 21)