diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 69e0c0a..0b567b2 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -614,9 +614,9 @@ class QrCode(object): return z - # Can only be called immediately after a white run is added, and - # returns either 0, 1, or 2. A helper function for _get_penalty_score(). def _finder_penalty_count_patterns(self, runhistory): + """Can only be called immediately after a white run is added, and + returns either 0, 1, or 2. A helper function for _get_penalty_score().""" n = runhistory[1] assert n <= self._size * 3 core = n > 0 and (runhistory[2] == runhistory[4] == runhistory[5] == n) and runhistory[3] == n * 3 @@ -624,8 +624,8 @@ class QrCode(object): + (1 if (core and runhistory[6] >= n * 4 and runhistory[0] >= n) else 0) - # Must be called at the end of a line (row or column) of modules. A helper function for _get_penalty_score(). def _finder_penalty_terminate_and_count(self, currentruncolor, currentrunlength, runhistory): + """Must be called at the end of a line (row or column) of modules. A helper function for _get_penalty_score().""" if currentruncolor: # Terminate black run runhistory.appendleft(currentrunlength) currentrunlength = 0 diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 4a2748a..37ccb4c 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -814,8 +814,8 @@ impl QrCode { } - // Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result - // are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8. + // Returns the product of the two given field elements modulo GF(2^8/0x11D). + // All inputs are valid. This could be implemented as a 256*256 lookup table. fn reed_solomon_multiply(x: u8, y: u8) -> u8 { // Russian peasant multiplication let mut z: u8 = 0;