MCPcopy Index your code
hub / github.com/python/cpython / parse_iv

Method parse_iv

Lib/test/test_zlib.py:128–139  ·  view source on GitHub ↗

Parse an IV value. - The default IV is returned if *iv* is None. - A random IV is returned if *iv* is -1. - Otherwise, *iv* is returned as is.

(self, iv)

Source from the content-addressed store, hash-verified

126 default_iv: int
127
128 def parse_iv(self, iv):
129 """Parse an IV value.
130
131 - The default IV is returned if *iv* is None.
132 - A random IV is returned if *iv* is -1.
133 - Otherwise, *iv* is returned as is.
134 """
135 if iv is None:
136 return self.default_iv
137 if iv == -1:
138 return random.randint(1, 0x80000000)
139 return iv
140
141 def checksum(self, data, init=None):
142 """Compute the checksum of data with a given initial value.

Callers 2

checksumMethod · 0.95
get_random_dataMethod · 0.95

Calls 1

randintMethod · 0.80

Tested by

no test coverage detected