Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
82 changes: 2 additions & 80 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,8 @@
# Edit at https://www.gitignore.io/?templates=python,pycharm,visualstudiocode

### PyCharm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

# JetBrains templates
**___jb_tmp___

### PyCharm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint
.idea/
*.iml

### Python ###
# Byte-compiled / optimized / DLL files
Expand Down
4 changes: 0 additions & 4 deletions .idea/encodings.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

13 changes: 0 additions & 13 deletions .idea/pyffi.iml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/vcs.xml

This file was deleted.

6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ We love tests, they help guarantee that things keep working they way
they should. You can run them yourself with the following::

source venv/bin/activate
nosetest -v test
pytest

or::
To run tests for all Python versions, use nox::

source venv/bin/activate
py.test -v tests
nox

Documentation
-------------
Expand Down
11 changes: 11 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import nox

PYTHON_VERSIONS = ["3.10", "3.11", "3.12", "3.13", "3.14"]

nox.options.default_venv_backend = "uv|virtualenv"


@nox.session(python=PYTHON_VERSIONS)
def tests(session):
"""Run all tests."""
session.run("pytest")
2 changes: 1 addition & 1 deletion pyffi/formats/bsa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
... except Exception:
... print(
... "Warning: read failed due corrupt file,"
... " corrupt format description, or bug.") # doctest: +REPORT_NDIFF
... " corrupt format description, or bug.")
reading tests/formats/bsa/test.bsa

Create an BSA file from scratch and write to file
Expand Down
50 changes: 25 additions & 25 deletions pyffi/formats/cgf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
>>> for i in range(4): #recurse up to root repo dir
... dirpath = dirname(dirpath)
>>> repo_root = dirpath
>>> format_root = os.path.join(repo_root, 'tests', 'formats', 'cgf')
>>> format_root = os.path.join(repo_root, 'tests', 'spells', 'cgf', 'files')
>>> stream = open(os.path.join(format_root, 'test.cgf'), 'rb')
>>> data = CgfFormat.Data()
>>> # read chunk table only
Expand All @@ -35,17 +35,17 @@
>>> data.read(stream)
>>> # get all chunks
>>> for chunk in data.chunks:
... print(chunk) # doctest: +ELLIPSIS
<class '...SourceInfoChunk'> instance at ...
... print(chunk)
<struct '...SourceInfoChunk'> instance at ...
* source_file : <None>
* date : Fri Sep 28 22:40:44 2007
* author : blender@BLENDER
<BLANKLINE>
<class '...TimingChunk'> instance at ...
<struct '...TimingChunk'> instance at ...
* secs_per_tick : 0.0002083333...
* ticks_per_frame : 160
* global_range :
<class '...RangeEntity'> instance at ...
<struct '...RangeEntity'> instance at ...
* name : GlobalRange
* start : 0
* end : 100
Expand All @@ -69,14 +69,14 @@
... # do something with the chunks
... for chunk in data.chunks:
... chunk.apply_scale(2.0)
reading tests/formats/cgf/invalid.cgf
reading spells/cgf/files/invalid.cgf
Warning: read failed due corrupt file, corrupt format description, or bug.
0
reading tests/formats/cgf/monkey.cgf
reading spells/cgf/files/monkey.cgf
14
reading tests/formats/cgf/test.cgf
reading spells/cgf/files/test.cgf
2
reading tests/formats/cgf/vcols.cgf
reading spells/cgf/files/vcols.cgf
6

Create a CGF file from scratch
Expand Down Expand Up @@ -105,8 +105,8 @@
>>> data.read(stream)
>>> # get all chunks
>>> for chunk in data.chunks:
... print(chunk) # doctest: +ELLIPSIS +REPORT_NDIFF
<class 'pyffi.formats.cgf.NodeChunk'> instance at 0x...
... print(chunk)
<struct 'NodeChunk'> instance at 0x...
* name : hello
* object : None
* parent : None
Expand All @@ -125,7 +125,7 @@
[ 0.000 0.000 0.000 0.000 ]
* pos : [ 0.000 0.000 0.000 ]
* rot :
<class 'pyffi.formats.cgf.Quat'> instance at 0x...
<struct 'Quat'> instance at 0x...
* x : 0.0
* y : 0.0
* z : 0.0
Expand All @@ -139,7 +139,7 @@
<class 'pyffi.object_models.xml.array.Array'> instance at 0x...
0: <class 'pyffi.formats.cgf.NodeChunk'> instance at 0x...
<BLANKLINE>
<class 'pyffi.formats.cgf.NodeChunk'> instance at 0x...
<struct 'NodeChunk'> instance at 0x...
* name : world
* object : None
* parent : None
Expand All @@ -158,7 +158,7 @@
[ 0.000 0.000 0.000 0.000 ]
* pos : [ 0.000 0.000 0.000 ]
* rot :
<class 'pyffi.formats.cgf.Quat'> instance at 0x...
<struct 'Quat'> instance at 0x...
* x : 0.0
* y : 0.0
* z : 0.0
Expand Down Expand Up @@ -426,7 +426,7 @@ def fix_links(self, data):
except KeyError:
# make this raise an exception when all reference errors
# are sorted out
logger.warn("invalid chunk reference (%i)" % block_index)
logger.warning("invalid chunk reference (%i)" % block_index)
self._value = None
return
if not isinstance(block, self._template):
Expand All @@ -437,7 +437,7 @@ def fix_links(self, data):
else:
# make this raise an exception when all reference errors
# are sorted out
logger.warn("""\
logger.warning("""\
expected instance of %s
but got instance of %s""" % (self._template, block.__class__))
self._value = block
Expand Down Expand Up @@ -850,7 +850,7 @@ def read(self, stream):
size += padlen
# check size
if size != chunk_sizes[chunknum]:
logger.warn("""\
logger.warning("""\
chunk size mismatch when reading %s at 0x%08X
%i bytes available, but actual bytes read is %i"""
% (chunk.__class__.__name__,
Expand Down Expand Up @@ -1944,7 +1944,7 @@ def set_geometry(self,
... uvslist = [uvs1, uvs2],
... matlist = [2,5],
... colorslist = [colors1, colors_2])
>>> print(chunk) # doctest: +ELLIPSIS +REPORT_UDIFF
>>> print(chunk)
<class 'pyffi.formats.cgf.MeshChunk'> instance at ...
* has_vertex_weights : False
* has_vertex_colors : True
Expand Down Expand Up @@ -2138,7 +2138,7 @@ def set_geometry(self,
16: 0
etc...
<BLANKLINE>
>>> print(chunk.mesh_subsets) # doctest: +ELLIPSIS
>>> print(chunk.mesh_subsets)
<class 'pyffi.formats.cgf.MeshSubsetsChunk'> instance at ...
* flags :
<class 'pyffi.formats.cgf.MeshSubsetsFlags'> instance at ...
Expand Down Expand Up @@ -2167,7 +2167,7 @@ def set_geometry(self,
* radius : 0.7071067...
* center : [ 0.500 0.500 1.000 ]
<BLANKLINE>
>>> print(chunk.vertices_data) # doctest: +ELLIPSIS
>>> print(chunk.vertices_data)
<class 'pyffi.formats.cgf.DataStreamChunk'> instance at ...
* flags : 0
* data_stream_type : VERTICES
Expand All @@ -2186,7 +2186,7 @@ def set_geometry(self,
6: [ 1.000 0.000 1.000 ]
7: [ 1.000 1.000 1.000 ]
<BLANKLINE>
>>> print(chunk.normals_data) # doctest: +ELLIPSIS
>>> print(chunk.normals_data)
<class 'pyffi.formats.cgf.DataStreamChunk'> instance at ...
* flags : 0
* data_stream_type : NORMALS
Expand All @@ -2205,7 +2205,7 @@ def set_geometry(self,
6: [ 0.000 0.000 1.000 ]
7: [ 0.000 0.000 1.000 ]
<BLANKLINE>
>>> print(chunk.indices_data) # doctest: +ELLIPSIS
>>> print(chunk.indices_data)
<class 'pyffi.formats.cgf.DataStreamChunk'> instance at ...
* flags : 0
* data_stream_type : INDICES
Expand All @@ -2228,7 +2228,7 @@ def set_geometry(self,
10: 5
11: 7
<BLANKLINE>
>>> print(chunk.uvs_data) # doctest: +ELLIPSIS
>>> print(chunk.uvs_data)
<class 'pyffi.formats.cgf.DataStreamChunk'> instance at ...
* flags : 0
* data_stream_type : UVS
Expand Down Expand Up @@ -2263,7 +2263,7 @@ def set_geometry(self,
* u : 1.0
* v : 0.0
<BLANKLINE>
>>> print(chunk.tangents_data) # doctest: +ELLIPSIS
>>> print(chunk.tangents_data)
<class 'pyffi.formats.cgf.DataStreamChunk'> instance at ...
* flags : 0
* data_stream_type : TANGENTS
Expand Down Expand Up @@ -2354,7 +2354,7 @@ def set_geometry(self,
* z : 0
* w : 32767
<BLANKLINE>
>>> print(chunk.colors_data) # doctest: +ELLIPSIS
>>> print(chunk.colors_data)
<class 'pyffi.formats.cgf.DataStreamChunk'> instance at ...
* flags : 0
* data_stream_type : COLORS
Expand Down
6 changes: 3 additions & 3 deletions pyffi/formats/dae/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
^^^^^^^^^^^^^^^^^

>>> daedata = DaeFormat.Data()
>>> print(daedata.collada) # doctest: +ELLIPSIS
>>> print(daedata.collada)
<...Collada object at ...>

Read a DAE file
Expand All @@ -35,7 +35,7 @@
>>> # check and read dae file
>>> stream = open(os.path.join(format_root, 'cube.dae'), 'rb')
>>> daedata = DaeFormat.Data()
>>> daedata.read(stream) # doctest: +ELLIPSIS
>>> daedata.read(stream)
Traceback (most recent call last):
...
NotImplementedError
Expand Down Expand Up @@ -65,7 +65,7 @@
>>> daedata = DaeFormat.Data()
>>> from tempfile import TemporaryFile
>>> stream = TemporaryFile()
>>> daedata.write(stream) # doctest: +ELLIPSIS
>>> daedata.write(stream)
Traceback (most recent call last):
...
NotImplementedError
Expand Down
2 changes: 1 addition & 1 deletion pyffi/formats/dds/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
... except Exception:
... print(
... "Warning: read failed due corrupt file,"
... " corrupt format description, or bug.") # doctest: +REPORT_NDIFF
... " corrupt format description, or bug.")
reading tests/formats/dds/test.dds

Create a DDS file from scratch and write to file
Expand Down
Loading