Skip to content

Commit 2c82e2c

Browse files
committed
Moved checksums to dedicated folder
1 parent 283db47 commit 2c82e2c

File tree

6 files changed

+25
-12
lines changed

6 files changed

+25
-12
lines changed

.github/workflows/python-package.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ jobs:
6464
with:
6565
fetch-depth: 0
6666
ref: ${{ github.head_ref || github.ref_name }}
67-
- name: Sync with remote
68-
run: |
69-
git fetch origin
70-
git rebase origin/${{ github.ref_name }}
7167
- name: Set up Python ${{ env.python_version }}
7268
uses: actions/setup-python@v6
7369
with:

src/codext/checksums/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# -*- coding: UTF-8 -*-
2+
from .adler import *
3+
from .crc import *
4+

src/codext/checksums/adler.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- coding: UTF-8 -*-
2+
"""Adler Codecs - Adler32 checksum algorithm.
3+
4+
This is a codec for computing checksums, for use with other codecs in encoding chains.
5+
6+
These codecs:
7+
- transform strings from str to str
8+
- transform strings from bytes to bytes
9+
- transform file content from str to bytes (write)
10+
"""
11+
from zlib import adler32
12+
13+
from ..__common__ import add, b
14+
15+
16+
add("adler32", lambda data, error="strict": (adler32(b(data)) & 0xffffffff, len(data)), guess=None)
17+
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
# -*- coding: UTF-8 -*-
2-
"""Checksum Codecs - string common checksums.
2+
"""CRC Codecs - Cyclic Redundancy Check checksum algorithm.
33
4-
These are codecs for hashing strings, for use with other codecs in encoding chains.
4+
This is a codec for computing checksums, for use with other codecs in encoding chains.
55
66
These codecs:
77
- transform strings from str to str
88
- transform strings from bytes to bytes
99
- transform file content from str to bytes (write)
1010
"""
11-
from zlib import adler32
12-
13-
from ..__common__ import add, b
11+
from ..__common__ import add
1412

1513

1614
CRC = {
@@ -261,7 +259,6 @@ def _encode(data, error="strict"):
261259
return _crc
262260

263261

264-
add("adler32", lambda data, error="strict": (adler32(b(data)) & 0xffffffff, len(data)), guess=None)
265262
add("crca", crc_checksum(), pattern=_pattern(), guess=None)
266263
for i in CRC.keys():
267264
if isinstance(i, int):

src/codext/hashing/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: UTF-8 -*-
22
from .blake import *
3-
from .checksums import *
43
from .crypt import *
54
from .md import *
65
from .mmh3 import *

tests/test_manual.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from codext.__common__ import *
1111
from codext.binary.baudot import _check_alphabet
12-
from codext.hashing.checksums import CRC
12+
from codext.checksums.crc import CRC
1313

1414

1515
class ComplementaryTestCase(TestCase):

0 commit comments

Comments
 (0)