character-encoding-utils 0.0.6__tar.gz → 0.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- character_encoding_utils-0.0.7/.github/workflows/publish.yml +29 -0
- character_encoding_utils-0.0.7/.github/workflows/test.yml +24 -0
- {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.7}/PKG-INFO +2 -2
- {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.7}/pyproject.toml +1 -1
- character_encoding_utils-0.0.7/requirements.txt +1 -0
- character_encoding_utils-0.0.6/.github/workflows/python-package.yml +0 -40
- character_encoding_utils-0.0.6/.github/workflows/python-publish.yml +0 -39
- character_encoding_utils-0.0.6/requirements.txt +0 -1
- {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.7}/.gitignore +0 -0
- {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.7}/LICENSE +0 -0
- {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.7}/README.md +0 -0
- {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.7}/src/character_encoding_utils/__init__.py +0 -0
- {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.7}/src/character_encoding_utils/big5.py +4 -4
- {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.7}/src/character_encoding_utils/gb2312.py +4 -4
- {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.7}/src/character_encoding_utils/ksx1001.py +4 -4
- {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.7}/src/character_encoding_utils/shiftjis.py +4 -4
- {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.7}/tests/test_big5.py +0 -0
- {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.7}/tests/test_gb2312.py +0 -0
- {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.7}/tests/test_ksx1001.py +0 -0
- {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.7}/tests/test_shiftjis.py +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
environment:
|
|
11
|
+
name: pypi
|
|
12
|
+
url: https://pypi.org/project/character-encoding-utils/
|
|
13
|
+
permissions:
|
|
14
|
+
id-token: write
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
- name: Setup Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: '3.x'
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: |
|
|
24
|
+
python -m pip install pip --upgrade
|
|
25
|
+
python -m pip install build
|
|
26
|
+
- name: Build
|
|
27
|
+
run: python -m build
|
|
28
|
+
- name: Publish
|
|
29
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
strategy:
|
|
9
|
+
fail-fast: false
|
|
10
|
+
matrix:
|
|
11
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
- name: Setup Python
|
|
16
|
+
uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: ${{ matrix.python-version }}
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: |
|
|
21
|
+
python -m pip install pip --upgrade
|
|
22
|
+
python -m pip install -r requirements.txt
|
|
23
|
+
- name: Test
|
|
24
|
+
run: python -m pytest
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: character-encoding-utils
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Summary: Some character encoding utils.
|
|
5
5
|
Project-URL: homepage, https://github.com/TakWolf/character-encoding-utils
|
|
6
6
|
Project-URL: source, https://github.com/TakWolf/character-encoding-utils
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pytest==8.2.0
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
3
|
-
|
|
4
|
-
name: Python package
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches: [ "master" ]
|
|
9
|
-
pull_request:
|
|
10
|
-
branches: [ "master" ]
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
build:
|
|
14
|
-
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
strategy:
|
|
17
|
-
fail-fast: false
|
|
18
|
-
matrix:
|
|
19
|
-
python-version: ["3.10", "3.11"]
|
|
20
|
-
|
|
21
|
-
steps:
|
|
22
|
-
- uses: actions/checkout@v3
|
|
23
|
-
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
-
uses: actions/setup-python@v3
|
|
25
|
-
with:
|
|
26
|
-
python-version: ${{ matrix.python-version }}
|
|
27
|
-
- name: Install dependencies
|
|
28
|
-
run: |
|
|
29
|
-
python -m pip install --upgrade pip
|
|
30
|
-
python -m pip install flake8 pytest
|
|
31
|
-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
32
|
-
- name: Lint with flake8
|
|
33
|
-
run: |
|
|
34
|
-
# stop the build if there are Python syntax errors or undefined names
|
|
35
|
-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
36
|
-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
|
37
|
-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
|
38
|
-
- name: Test with pytest
|
|
39
|
-
run: |
|
|
40
|
-
pytest
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# This workflow will upload a Python Package using Twine when a release is created
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
|
3
|
-
|
|
4
|
-
# This workflow uses actions that are not certified by GitHub.
|
|
5
|
-
# They are provided by a third-party and are governed by
|
|
6
|
-
# separate terms of service, privacy policy, and support
|
|
7
|
-
# documentation.
|
|
8
|
-
|
|
9
|
-
name: Upload Python Package
|
|
10
|
-
|
|
11
|
-
on:
|
|
12
|
-
release:
|
|
13
|
-
types: [published]
|
|
14
|
-
|
|
15
|
-
permissions:
|
|
16
|
-
contents: read
|
|
17
|
-
|
|
18
|
-
jobs:
|
|
19
|
-
deploy:
|
|
20
|
-
|
|
21
|
-
runs-on: ubuntu-latest
|
|
22
|
-
|
|
23
|
-
steps:
|
|
24
|
-
- uses: actions/checkout@v3
|
|
25
|
-
- name: Set up Python
|
|
26
|
-
uses: actions/setup-python@v3
|
|
27
|
-
with:
|
|
28
|
-
python-version: '3.x'
|
|
29
|
-
- name: Install dependencies
|
|
30
|
-
run: |
|
|
31
|
-
python -m pip install --upgrade pip
|
|
32
|
-
pip install build
|
|
33
|
-
- name: Build package
|
|
34
|
-
run: python -m build
|
|
35
|
-
- name: Publish package
|
|
36
|
-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
|
|
37
|
-
with:
|
|
38
|
-
user: __token__
|
|
39
|
-
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
pytest==7.4.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -5,21 +5,21 @@ class Big5Exception(Exception):
|
|
|
5
5
|
|
|
6
6
|
class Big5EncodeError(Big5Exception):
|
|
7
7
|
def __init__(self, obj: str, position: int, reason: str):
|
|
8
|
+
super().__init__(f"'big5' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
8
9
|
self.object = obj
|
|
9
10
|
self.position = position
|
|
10
11
|
self.reason = reason
|
|
11
|
-
super().__init__(f"'big5' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class Big5DecodeError(Big5Exception):
|
|
15
15
|
def __init__(self, obj: bytes, position: int, reason: str):
|
|
16
|
-
self.object = obj
|
|
17
|
-
self.position = position
|
|
18
|
-
self.reason = reason
|
|
19
16
|
if len(obj) <= 1:
|
|
20
17
|
super().__init__(f"'big5' codec can't decode byte 0x{obj[0]:x} in position {position}: {reason}")
|
|
21
18
|
else:
|
|
22
19
|
super().__init__(f"'big5' codec can't decode bytes in position {position}-{position + len(obj) - 1}: {reason}")
|
|
20
|
+
self.object = obj
|
|
21
|
+
self.position = position
|
|
22
|
+
self.reason = reason
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
def encode(cs: str) -> bytes:
|
|
@@ -8,21 +8,21 @@ class GB2312Exception(Exception):
|
|
|
8
8
|
|
|
9
9
|
class GB2312EncodeError(GB2312Exception):
|
|
10
10
|
def __init__(self, obj: str, position: int, reason: str):
|
|
11
|
+
super().__init__(f"'gb2312' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
11
12
|
self.object = obj
|
|
12
13
|
self.position = position
|
|
13
14
|
self.reason = reason
|
|
14
|
-
super().__init__(f"'gb2312' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class GB2312DecodeError(GB2312Exception):
|
|
18
18
|
def __init__(self, obj: bytes, position: int, reason: str):
|
|
19
|
-
self.object = obj
|
|
20
|
-
self.position = position
|
|
21
|
-
self.reason = reason
|
|
22
19
|
if len(obj) <= 1:
|
|
23
20
|
super().__init__(f"'gb2312' codec can't decode byte 0x{obj[0]:x} in position {position}: {reason}")
|
|
24
21
|
else:
|
|
25
22
|
super().__init__(f"'gb2312' codec can't decode bytes in position {position}-{position + len(obj) - 1}: {reason}")
|
|
23
|
+
self.object = obj
|
|
24
|
+
self.position = position
|
|
25
|
+
self.reason = reason
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def encode(cs: str) -> bytes:
|
|
@@ -8,21 +8,21 @@ class KSX1001Exception(Exception):
|
|
|
8
8
|
|
|
9
9
|
class KSX1001EncodeError(KSX1001Exception):
|
|
10
10
|
def __init__(self, obj: str, position: int, reason: str):
|
|
11
|
+
super().__init__(f"'ksx1001' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
11
12
|
self.object = obj
|
|
12
13
|
self.position = position
|
|
13
14
|
self.reason = reason
|
|
14
|
-
super().__init__(f"'ksx1001' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class KSX1001DecodeError(KSX1001Exception):
|
|
18
18
|
def __init__(self, obj: bytes, position: int, reason: str):
|
|
19
|
-
self.object = obj
|
|
20
|
-
self.position = position
|
|
21
|
-
self.reason = reason
|
|
22
19
|
if len(obj) <= 1:
|
|
23
20
|
super().__init__(f"'ksx1001' codec can't decode byte 0x{obj[0]:x} in position {position}: {reason}")
|
|
24
21
|
else:
|
|
25
22
|
super().__init__(f"'ksx1001' codec can't decode bytes in position {position}-{position + len(obj) - 1}: {reason}")
|
|
23
|
+
self.object = obj
|
|
24
|
+
self.position = position
|
|
25
|
+
self.reason = reason
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def encode(cs: str) -> bytes:
|
|
@@ -7,21 +7,21 @@ class ShiftJISException(Exception):
|
|
|
7
7
|
|
|
8
8
|
class ShiftJISEncodeError(ShiftJISException):
|
|
9
9
|
def __init__(self, obj: str, position: int, reason: str):
|
|
10
|
+
super().__init__(f"'shift-jis' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
10
11
|
self.object = obj
|
|
11
12
|
self.position = position
|
|
12
13
|
self.reason = reason
|
|
13
|
-
super().__init__(f"'shift-jis' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class ShiftJISDecodeError(ShiftJISException):
|
|
17
17
|
def __init__(self, obj: bytes, position: int, reason: str):
|
|
18
|
-
self.object = obj
|
|
19
|
-
self.position = position
|
|
20
|
-
self.reason = reason
|
|
21
18
|
if len(obj) <= 1:
|
|
22
19
|
super().__init__(f"'shift-jis' codec can't decode byte 0x{obj[0]:x} in position {position}: {reason}")
|
|
23
20
|
else:
|
|
24
21
|
super().__init__(f"'shift-jis' codec can't decode bytes in position {position}-{position + len(obj) - 1}: {reason}")
|
|
22
|
+
self.object = obj
|
|
23
|
+
self.position = position
|
|
24
|
+
self.reason = reason
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
def encode(cs: str) -> bytes:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|