Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check-dco.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request, workflow_dispatch]
jobs:
check-dco:
name: Check Developer's Certificate of Origin
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request, workflow_dispatch]
jobs:
lint:
name: Lint with flake8
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
deploy:
name: Publish to Pypi
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on: [push, pull_request, workflow_dispatch]
jobs:
tests:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.8", "pypy3.9", "pypy3.10"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "pypy3.10"]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:

finish:
needs: tests
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ ipmitool command:
Compatibility
-------------

Python > 3.6 is currently supported. Python 2.x is deprecated.
Python >= 3.10 is currently supported. Python 2.x is deprecated.

Contributing
------------
Expand Down
30 changes: 6 additions & 24 deletions pyipmi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from __future__ import annotations

import sys
import codecs
from array import array
from typing import Any, Generator, TYPE_CHECKING
Expand All @@ -30,35 +29,22 @@
from .msgs import Message


_PY3 = (sys.version_info >= (3,))


def py3enc_unic_bytes_fix(dat: Any) -> Any:
# python 3 unicode fix
if isinstance(dat, str) and _PY3:
if isinstance(dat, str):
dat = dat.encode('raw_unicode_escape')
return dat


def py3dec_unic_bytes_fix(dat: bytes) -> str:
# python 3 unicode fix
if _PY3:
return dat.decode('raw_unicode_escape')
return dat
return dat.decode('raw_unicode_escape')


def py3_array_frombytes(msg: array, data: bytes) -> None:
if _PY3:
return msg.frombytes(data)
else:
return msg.fromstring(data)
return msg.frombytes(data)


def py3_array_tobytes(msg: array) -> bytes:
if _PY3:
return msg.tobytes()
else:
return msg.tostring()
return msg.tobytes()


def check_completion_code(cc: int) -> None:
Expand Down Expand Up @@ -112,7 +98,7 @@ def pop_unsigned_int(self, length: int) -> int:
return value

def push_string(self, value: str | bytes) -> None:
if _PY3 and isinstance(value, str):
if isinstance(value, str):
# Encode Unicode to UTF-8
value = value.encode()
py3_array_frombytes(self.array, value)
Expand All @@ -121,7 +107,6 @@ def pop_string(self, length: int) -> bytes:
string = self.array[0:length]
del self.array[0:length]
return py3_array_tobytes(string)
# return py3dec_unic_bytes_fix(string.tostring())

def pop_slice(self, length: int) -> ByteBuffer:
if len(self.array) < length:
Expand Down Expand Up @@ -167,8 +152,6 @@ def bcd_decode(encoded_input: Any) -> tuple[str, int]:
chars = list()
try:
for data in encoded_input:
if not _PY3:
data = ord(data)
chars.append(BCD_MAP[data >> 4 & 0xf] + BCD_MAP[data & 0xf])
return (''.join(chars), len(encoded_input) * 2)
except IndexError:
Expand All @@ -183,5 +166,4 @@ def bcd_search(name: str) -> codecs.CodecInfo | None:


def is_string(string: Any) -> bool:
if _PY3:
return isinstance(string, str)
return isinstance(string, str)
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,19 @@ def git_pep440_version():
packages=find_packages(exclude=['tests*']),
license='LGPLv2+',
platforms=["any"],
python_requires='>=3.10',
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Console',
'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
'Topic :: Software Development :: Libraries :: Python Modules',
],
entry_points={
Expand Down
Loading