character-encoding-utils 0.0.6__tar.gz → 0.0.8__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.
Files changed (20) hide show
  1. character_encoding_utils-0.0.8/.github/workflows/publish.yml +29 -0
  2. character_encoding_utils-0.0.8/.github/workflows/test.yml +24 -0
  3. {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.8}/PKG-INFO +2 -2
  4. {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.8}/pyproject.toml +1 -1
  5. character_encoding_utils-0.0.8/requirements.txt +1 -0
  6. {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.8}/src/character_encoding_utils/big5.py +12 -4
  7. {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.8}/src/character_encoding_utils/gb2312.py +12 -4
  8. {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.8}/src/character_encoding_utils/ksx1001.py +12 -4
  9. {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.8}/src/character_encoding_utils/shiftjis.py +12 -4
  10. character_encoding_utils-0.0.6/.github/workflows/python-package.yml +0 -40
  11. character_encoding_utils-0.0.6/.github/workflows/python-publish.yml +0 -39
  12. character_encoding_utils-0.0.6/requirements.txt +0 -1
  13. {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.8}/.gitignore +0 -0
  14. {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.8}/LICENSE +0 -0
  15. {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.8}/README.md +0 -0
  16. {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.8}/src/character_encoding_utils/__init__.py +0 -0
  17. {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.8}/tests/test_big5.py +0 -0
  18. {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.8}/tests/test_gb2312.py +0 -0
  19. {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.8}/tests/test_ksx1001.py +0 -0
  20. {character_encoding_utils-0.0.6 → character_encoding_utils-0.0.8}/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
1
+ Metadata-Version: 2.3
2
2
  Name: character-encoding-utils
3
- Version: 0.0.6
3
+ Version: 0.0.8
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "character-encoding-utils"
7
- version = "0.0.6"
7
+ version = "0.0.8"
8
8
  description = "Some character encoding utils."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT License" }
@@ -0,0 +1 @@
1
+ pytest==8.2.0
@@ -4,22 +4,30 @@ class Big5Exception(Exception):
4
4
 
5
5
 
6
6
  class Big5EncodeError(Big5Exception):
7
+ object: str
8
+ position: int
9
+ reason: str
10
+
7
11
  def __init__(self, obj: str, position: int, reason: str):
12
+ super().__init__(f"'big5' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
8
13
  self.object = obj
9
14
  self.position = position
10
15
  self.reason = reason
11
- super().__init__(f"'big5' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
12
16
 
13
17
 
14
18
  class Big5DecodeError(Big5Exception):
19
+ object: bytes
20
+ position: int
21
+ reason: str
22
+
15
23
  def __init__(self, obj: bytes, position: int, reason: str):
16
- self.object = obj
17
- self.position = position
18
- self.reason = reason
19
24
  if len(obj) <= 1:
20
25
  super().__init__(f"'big5' codec can't decode byte 0x{obj[0]:x} in position {position}: {reason}")
21
26
  else:
22
27
  super().__init__(f"'big5' codec can't decode bytes in position {position}-{position + len(obj) - 1}: {reason}")
28
+ self.object = obj
29
+ self.position = position
30
+ self.reason = reason
23
31
 
24
32
 
25
33
  def encode(cs: str) -> bytes:
@@ -7,22 +7,30 @@ class GB2312Exception(Exception):
7
7
 
8
8
 
9
9
  class GB2312EncodeError(GB2312Exception):
10
+ object: str
11
+ position: int
12
+ reason: str
13
+
10
14
  def __init__(self, obj: str, position: int, reason: str):
15
+ super().__init__(f"'gb2312' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
11
16
  self.object = obj
12
17
  self.position = position
13
18
  self.reason = reason
14
- super().__init__(f"'gb2312' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
15
19
 
16
20
 
17
21
  class GB2312DecodeError(GB2312Exception):
22
+ object: bytes
23
+ position: int
24
+ reason: str
25
+
18
26
  def __init__(self, obj: bytes, position: int, reason: str):
19
- self.object = obj
20
- self.position = position
21
- self.reason = reason
22
27
  if len(obj) <= 1:
23
28
  super().__init__(f"'gb2312' codec can't decode byte 0x{obj[0]:x} in position {position}: {reason}")
24
29
  else:
25
30
  super().__init__(f"'gb2312' codec can't decode bytes in position {position}-{position + len(obj) - 1}: {reason}")
31
+ self.object = obj
32
+ self.position = position
33
+ self.reason = reason
26
34
 
27
35
 
28
36
  def encode(cs: str) -> bytes:
@@ -7,22 +7,30 @@ class KSX1001Exception(Exception):
7
7
 
8
8
 
9
9
  class KSX1001EncodeError(KSX1001Exception):
10
+ object: str
11
+ position: int
12
+ reason: str
13
+
10
14
  def __init__(self, obj: str, position: int, reason: str):
15
+ super().__init__(f"'ksx1001' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
11
16
  self.object = obj
12
17
  self.position = position
13
18
  self.reason = reason
14
- super().__init__(f"'ksx1001' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
15
19
 
16
20
 
17
21
  class KSX1001DecodeError(KSX1001Exception):
22
+ object: bytes
23
+ position: int
24
+ reason: str
25
+
18
26
  def __init__(self, obj: bytes, position: int, reason: str):
19
- self.object = obj
20
- self.position = position
21
- self.reason = reason
22
27
  if len(obj) <= 1:
23
28
  super().__init__(f"'ksx1001' codec can't decode byte 0x{obj[0]:x} in position {position}: {reason}")
24
29
  else:
25
30
  super().__init__(f"'ksx1001' codec can't decode bytes in position {position}-{position + len(obj) - 1}: {reason}")
31
+ self.object = obj
32
+ self.position = position
33
+ self.reason = reason
26
34
 
27
35
 
28
36
  def encode(cs: str) -> bytes:
@@ -6,22 +6,30 @@ class ShiftJISException(Exception):
6
6
 
7
7
 
8
8
  class ShiftJISEncodeError(ShiftJISException):
9
+ object: str
10
+ position: int
11
+ reason: str
12
+
9
13
  def __init__(self, obj: str, position: int, reason: str):
14
+ super().__init__(f"'shift-jis' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
10
15
  self.object = obj
11
16
  self.position = position
12
17
  self.reason = reason
13
- super().__init__(f"'shift-jis' codec can't encode character '\\u{ord(obj):x}' in position {position}: {reason}")
14
18
 
15
19
 
16
20
  class ShiftJISDecodeError(ShiftJISException):
21
+ object: bytes
22
+ position: int
23
+ reason: str
24
+
17
25
  def __init__(self, obj: bytes, position: int, reason: str):
18
- self.object = obj
19
- self.position = position
20
- self.reason = reason
21
26
  if len(obj) <= 1:
22
27
  super().__init__(f"'shift-jis' codec can't decode byte 0x{obj[0]:x} in position {position}: {reason}")
23
28
  else:
24
29
  super().__init__(f"'shift-jis' codec can't decode bytes in position {position}-{position + len(obj) - 1}: {reason}")
30
+ self.object = obj
31
+ self.position = position
32
+ self.reason = reason
25
33
 
26
34
 
27
35
  def encode(cs: str) -> bytes:
@@ -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