generated from ArcanaFramework/fileformats-extension-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from ArcanaFramework/mypy-ci
Updated to use Binary|UnicodeFile types and validated_property
- Loading branch information
Showing
7 changed files
with
68 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,35 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- repo: https://github.com/psf/black | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- repo: https://github.com/psf/black | ||
rev: 22.3.0 | ||
hooks: | ||
- id: black | ||
- id: black | ||
exclude: ^(arcana/_version\.py|versioneer\.py)$ | ||
args: | ||
- -l 88 | ||
- repo: https://github.com/codespell-project/codespell | ||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.1.0 | ||
hooks: | ||
- id: codespell | ||
- id: codespell | ||
exclude: ^(xnat_checks/_version\.py|versioneer\.py)$ | ||
args: | ||
- --ignore-words=.codespell-ignorewords | ||
- repo: https://github.com/PyCQA/flake8 | ||
- --ignore-words=.codespell-ignorewords | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 4.0.1 | ||
hooks: | ||
- id: flake8 | ||
- id: flake8 | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.11.2 | ||
hooks: | ||
- id: mypy | ||
args: [--strict, --install-types, --non-interactive] | ||
exclude: tests | ||
additional_dependencies: [pytest, fileformats>=0.13.0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,61 @@ | ||
from fileformats.core.mixin import WithMagicNumber | ||
from fileformats.generic import File | ||
from fileformats.generic import UnicodeFile, BinaryFile | ||
|
||
|
||
class Data(File): | ||
iana_mime = None | ||
binary = True | ||
class Data: | ||
... | ||
|
||
|
||
class TextVector(Data): | ||
class TextVector(Data, UnicodeFile): | ||
"""space-delimited text file containing a single vector of values""" | ||
binary = False | ||
|
||
... | ||
|
||
|
||
class TextArray(Data): | ||
class TextArray(Data, UnicodeFile): | ||
"""space-delimited text file containing a 2-d array of values""" | ||
binary = False | ||
|
||
... | ||
|
||
|
||
class TextMatrix(Data): | ||
class TextMatrix(Data, UnicodeFile): | ||
ext = ".mat" | ||
binary = False | ||
|
||
|
||
class RData(WithMagicNumber, Data): | ||
class RData(WithMagicNumber, Data, BinaryFile): | ||
"""Data-file created by the R statistical package""" | ||
|
||
ext = ".rData" | ||
binary = True | ||
magic_number = "1f8b0800" | ||
|
||
|
||
class MatFile(WithMagicNumber, Data): | ||
class MatFile(WithMagicNumber, Data, BinaryFile): | ||
"""MATLAB Mat-File (https://au.mathworks.com/help/matlab/import_export/mat-file-versions.html)""" | ||
|
||
ext = ".mat" | ||
magic_number = "4D41544C" | ||
binary = True | ||
|
||
|
||
class DatFile(Data): | ||
"""Generic binary data file""" | ||
binary = True | ||
|
||
ext = ".dat" | ||
|
||
|
||
class Hdf5(WithMagicNumber, Data): | ||
class Hdf5(WithMagicNumber, Data, BinaryFile): | ||
"""Hierarchical Data Format (HDF) Version 5 | ||
An open source file format that supports large, complex, heterogeneous data. | ||
HDF5 uses a "file directory" like structure that allows you to organize data within | ||
the file in many different structured ways, as you might do with files on your computer.""" | ||
the file in many different structured ways, as you might do with files on your computer. | ||
""" | ||
|
||
binary = True | ||
ext = ".h5" | ||
magic_number = "894844460d0a1a0a" | ||
|
||
|
||
class VtkDataFile(WithMagicNumber, Data): | ||
class VtkDataFile(WithMagicNumber, Data, BinaryFile): | ||
|
||
binary = True | ||
ext = ".vtk" | ||
magic_number = b"#vtk DataFile Version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
from fileformats.generic import File | ||
from fileformats.generic import BinaryFile | ||
from fileformats.core.mixin import WithMagicNumber | ||
from fileformats.application import Gzip | ||
|
||
|
||
class ObjectSerialisation(File): | ||
iana_mime = None | ||
binary = True | ||
class ObjectSerialisation(BinaryFile): | ||
... | ||
|
||
|
||
class Pickle(WithMagicNumber, ObjectSerialisation): | ||
"""Python's native byte-encoded serialization format""" | ||
|
||
ext = ".pkl" | ||
magic_number = "8004" | ||
|
||
|
||
class Pickle__Gzip(Gzip[Pickle]): | ||
class Pickle__Gzip(Gzip[Pickle]): # type: ignore[type-arg] | ||
"""Python pickle file that has been gzipped""" | ||
|
||
ext = "pkl.gz" | ||
alternate_exts = (".pklz",) | ||
iana_mime = "application/x-pickle+gzip" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters