aboutsummaryrefslogtreecommitdiff
path: root/rsa/varblock.py
diff options
context:
space:
mode:
Diffstat (limited to 'rsa/varblock.py')
-rw-r--r--rsa/varblock.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/rsa/varblock.py b/rsa/varblock.py
index 51e04fc..d5a342b 100644
--- a/rsa/varblock.py
+++ b/rsa/varblock.py
@@ -13,7 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-'''VARBLOCK file support
+"""VARBLOCK file support
The VARBLOCK file format is as follows, where || denotes byte concatenation:
@@ -30,13 +30,13 @@ The VARBLOCK file format is as follows, where || denotes byte concatenation:
This file format is called the VARBLOCK format, in line with the varint format
used to denote the block sizes.
-'''
+"""
from rsa._compat import byte
VARBLOCK_VERSION = 1
def read_varint(infile):
- '''Reads a varint from the file.
+ """Reads a varint from the file.
When the first byte to be read indicates EOF, (0, 0) is returned. When an
EOF occurs when at least one byte has been read, an EOFError exception is
@@ -45,7 +45,7 @@ def read_varint(infile):
@param infile: the file-like object to read from. It should have a read()
method.
@returns (varint, length), the read varint and the number of read bytes.
- '''
+ """
varint = 0
read_bytes = 0
@@ -67,12 +67,12 @@ def read_varint(infile):
return (varint, read_bytes)
def write_varint(outfile, value):
- '''Writes a varint to a file.
+ """Writes a varint to a file.
@param outfile: the file-like object to write to. It should have a write()
method.
@returns the number of written bytes.
- '''
+ """
# there is a big difference between 'write the value 0' (this case) and
# 'there is nothing left to write' (the false-case of the while loop)
@@ -96,12 +96,12 @@ def write_varint(outfile, value):
def yield_varblocks(infile):
- '''Generator, yields each block in the input file.
+ """Generator, yields each block in the input file.
@param infile: file to read, is expected to have the VARBLOCK format as
described in the module's docstring.
@yields the contents of each block.
- '''
+ """
# Check the version number
first_char = infile.read(1)
@@ -130,11 +130,11 @@ def yield_varblocks(infile):
yield block
def yield_fixedblocks(infile, blocksize):
- '''Generator, yields each block of ``blocksize`` bytes in the input file.
+ """Generator, yields each block of ``blocksize`` bytes in the input file.
:param infile: file to read and separate in blocks.
:returns: a generator that yields the contents of each block
- '''
+ """
while True:
block = infile.read(blocksize)