diff --git a/.github/workflows/test-and-lint.yml b/.github/workflows/test-and-lint.yml index defc77c..f6cc5b5 100644 --- a/.github/workflows/test-and-lint.yml +++ b/.github/workflows/test-and-lint.yml @@ -12,12 +12,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] - + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -29,3 +28,4 @@ jobs: - name: Testing run: | poetry run python -m unittest discover . + diff --git a/c3d/c3d.py b/c3d/c3d.py index 0f5ec8d..becd1a6 100644 --- a/c3d/c3d.py +++ b/c3d/c3d.py @@ -1513,7 +1513,7 @@ def first_frame(self): # ACTUAL_START_FIELD is encoded in two 16 byte words... # return param.uint32_value words = param.uint16_array - return words[0] + words[1] * 65535 + return int(words[0]) + int(words[1]) * 65535 return self.header.first_frame @property @@ -1529,7 +1529,7 @@ def last_frame(self) -> int: # Manual refer to parsing the parameter as 2 16-bit words, generally equivalent to an uint32 # end_frame = param.uint32_value words = param.uint16_array - end_frame = words[0] + words[1] * 65536 + end_frame = int(words[0]) + int(words[1]) * 65536 if hlf <= end_frame: return end_frame param = self.get('POINT:LONG_FRAMES') @@ -2205,11 +2205,11 @@ def add_frames(self, frames, index=None): index : int or None Insert the frame or sequence at the index (the first sequence frame will be inserted at give index). Note that the index should be relative to 0 rather then the frame number provided by read_frames()! - ''' + ''' sh = np.array(frames, dtype=object).shape # Single frame if len(sh) != 2: - frames = [frames] + frames = np.array([frames], dtype=object) sh = np.shape(frames) # Sequence of invalid shape if sh[1] != 2: @@ -2424,7 +2424,7 @@ def _write_metadata(self, handle): # Padding self._pad_block(handle) - while handle.tell() != 512 * (self.header.data_block - 1): + while handle.tell() != 512 * (int(self.header.data_block) - 1): handle.write(b'\x00' * 512) def _write_frames(self, handle): @@ -2436,7 +2436,7 @@ def _write_frames(self, handle): Write metadata and C3D motion frames to the given file handle. The writer does not close the handle. ''' - assert handle.tell() == 512 * (self._header.data_block - 1) + assert handle.tell() == 512 * (int(self._header.data_block) - 1) scale_mag = abs(self.point_scale) is_float = self.point_scale < 0 if is_float: diff --git a/pyproject.toml b/pyproject.toml index b71b1c5..dc6c381 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,8 +24,8 @@ c3d-metatdata = 'c3d.scripts.c3d_metatdata:main' c3d-viewer = 'c3d.scripts.c3d_viewer:main' [tool.poetry.dependencies] -python = "^3.7" -numpy = "^1" +python = "^3.9" +numpy = ">=1.0.0" pyglet = {version = "^1.5.21", optional = true} [tool.poetry.dev-dependencies] diff --git a/test/test_frame_count_encodings.py b/test/test_frame_count_encodings.py index f48462b..0d21e99 100644 --- a/test/test_frame_count_encodings.py +++ b/test/test_frame_count_encodings.py @@ -52,7 +52,7 @@ class Sample19(FrameCountEncodingTest, AnalogSampleCountEncodingTest, verify.Rea frame_count = [34672] sample_count = [624096] - zip_files = ['sample19/sample19.c3d'] + zip_files = ['sample19.c3d'] class Sample31(FrameCountEncodingTest, AnalogSampleCountEncodingTest, verify.ReadTest, Base): diff --git a/test/test_proc_format.py b/test/test_proc_format.py index ca392f2..8dfa2ef 100644 --- a/test/test_proc_format.py +++ b/test/test_proc_format.py @@ -115,8 +115,8 @@ class Sample02(FormatTest, Base): ZIP = 'sample02.zip' INTEL_INT = 'pc_int.c3d' INTEL_REAL = 'pc_real.c3d' - DEC_INT = 'DEC_INT.C3D' - DEC_REAL = 'Dec_real.c3d' + DEC_INT = 'dec_int.c3d' + DEC_REAL = 'dec_real.c3d' MIPS_INT = 'sgi_int.c3d' MIPS_REAL = 'sgi_real.c3d' diff --git a/test/verify.py b/test/verify.py index 17e6d05..53f21b3 100644 --- a/test/verify.py +++ b/test/verify.py @@ -68,7 +68,7 @@ def check_zipfile(file_path): # Allow self.zipfiles on form: # ['FILE', ..] # [('FOLDER', ['FILE', ..])] - if len(np.shape(self.zip_files)) == 1: + if len(np.array(self.zip_files, dtype=object).shape) == 1: for file in self.zip_files: check_zipfile(file) else: @@ -130,7 +130,7 @@ def check_zipfile(file_path): print('----------------------------') print(type(self)) print('----------------------------') - if len(np.shape(self.zip_files)) == 1: + if len(np.array(self.zip_files, dtype=object).shape) == 1: for file in self.zip_files: check_zipfile(file) else: diff --git a/test/zipload.py b/test/zipload.py index bcc9f30..4d6cefa 100644 --- a/test/zipload.py +++ b/test/zipload.py @@ -8,12 +8,12 @@ TEMP = os.path.join(tempfile.gettempdir(), 'c3d-test') ZIPS = ( ('https://www.c3d.org/data/Sample00.zip', 'sample00.zip'), - ('https://www.c3d.org/data/sample01.zip', 'sample01.zip'), - ('https://www.c3d.org/data/sample02.zip', 'sample02.zip'), - ('https://www.c3d.org/data/sample07.zip', 'sample07.zip'), - ('https://www.c3d.org/data/sample08.zip', 'sample08.zip'), - ('https://www.c3d.org/data/sample19.zip', 'sample19.zip'), - ('https://www.c3d.org/data/sample31.zip', 'sample31.zip'), + ('https://www.c3d.org/data/Sample01.zip', 'sample01.zip'), + ('https://www.c3d.org/data/Sample02.zip', 'sample02.zip'), + ('https://www.c3d.org/data/Sample07.zip', 'sample07.zip'), + ('https://www.c3d.org/data/Sample08.zip', 'sample08.zip'), + ('https://www.c3d.org/data/Sample19.zip', 'sample19.zip'), + ('https://www.c3d.org/data/Sample31.zip', 'sample31.zip'), ('https://www.c3d.org/data/Sample36.zip', 'sample36.zip'), )