-
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.
Code formatting, linting and pre-commit hooks
- Loading branch information
Showing
15 changed files
with
129 additions
and
68 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
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 |
---|---|---|
|
@@ -8,3 +8,5 @@ __pycache__ | |
|
||
.python-version | ||
.dir-locals.el | ||
|
||
*.temp |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 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 | ||
rev: v3.2.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
exclude: ^src/ | ||
- id: end-of-file-fixer | ||
exclude: ^src/ | ||
- id: check-yaml | ||
exclude: ^src/ | ||
- id: check-added-large-files | ||
exclude: ^src/ | ||
- repo: https://github.com/psf/black | ||
rev: 22.10.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 7.0.0 | ||
hooks: | ||
- id: flake8 | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.8.0 | ||
hooks: | ||
- id: mypy |
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,4 +1,4 @@ | ||
include VERSION COPYING README.md | ||
include VERSION LICENSE README.md | ||
graft src | ||
graft python | ||
graft tests |
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 +1 @@ | ||
1.0.2 | ||
1.0.2 |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
flake8 | ||
mypy | ||
pre-commit | ||
pytest |
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,4 +1,42 @@ | ||
[flake8] | ||
max_line_length=132 | ||
[metadata] | ||
name = sfst-transduce | ||
version = file: VERSION | ||
author = Gregor Middell | ||
author_email = [email protected] | ||
project_urls = | ||
Homepage = https://github.com/gremid/sfst-transduce | ||
Repository = https://github.com/gremid/sfst-transduce.git | ||
description = Python bindings for SFST focusing on transducer usage | ||
long_description = file: README.md, LICENSE | ||
long_description_content_type = text/markdown | ||
license = GNU GPL2 | ||
license_files = LICENSE | ||
keywords = | ||
Finite-state Transducer | ||
Morphological Analysis | ||
Natural Language Processing | ||
NLP | ||
SFST | ||
classifiers = | ||
Development Status :: 5 - Production/Stable | ||
Intended Audience :: Developers | ||
Intended Audience :: Science/Research | ||
License :: OSI Approved :: GNU General Public License v2 (GPLv2) | ||
Operating System :: MacOS | ||
Operating System :: Microsoft :: Windows | ||
Operating System :: POSIX :: Linux | ||
Programming Language :: C++ | ||
Programming Language :: Python | ||
Programming Language :: Python :: 3.8 | ||
Programming Language :: Python :: 3.9 | ||
Programming Language :: Python :: 3.10 | ||
Programming Language :: Python :: 3.11 | ||
Programming Language :: Python :: Implementation | ||
Programming Language :: Python :: Implementation :: CPython | ||
Programming Language :: Python :: Implementation :: PyPy | ||
Topic :: Education | ||
Topic :: Scientific/Engineering | ||
Topic :: Text Processing :: Linguistic | ||
|
||
[tool.pytest] | ||
[options] | ||
python_requires = >=3.6 |
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 |
---|---|---|
|
@@ -2,39 +2,24 @@ | |
from pybind11.setup_helpers import Pybind11Extension, build_ext | ||
from setuptools import setup | ||
|
||
__version__ = open('VERSION').read().strip() | ||
|
||
setup( | ||
name="sfst-transduce", | ||
version=__version__, | ||
author="Gregor Middell", | ||
author_email="[email protected]", | ||
description="Python bindings for SFST focusing on transducer usage", | ||
long_description=open('README.md').read(), | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/gremid/sfst-transduce", | ||
license="GPLv2", | ||
ext_modules=[Pybind11Extension( | ||
"sfst_transduce", | ||
["src/basic.cpp", | ||
"src/compact.cpp", | ||
"src/utf8.cpp", | ||
"src/alphabet.cpp", | ||
"src/fst.cpp", | ||
"src/operators.cpp", | ||
"src/determinise.cpp", | ||
"src/hopcroft.cpp", | ||
"python/sfst_transduce.cpp"], | ||
define_macros=[("SFST_VERSION", __version__)] | ||
)], | ||
cmdclass={"build_ext": build_ext}, | ||
#package_dir={"": "python"}, | ||
ext_modules=[ | ||
Pybind11Extension( | ||
"sfst_transduce", | ||
[ | ||
"src/basic.cpp", | ||
"src/compact.cpp", | ||
"src/utf8.cpp", | ||
"src/alphabet.cpp", | ||
"src/fst.cpp", | ||
"src/operators.cpp", | ||
"src/determinise.cpp", | ||
"src/hopcroft.cpp", | ||
"python/sfst_transduce.cpp", | ||
], | ||
define_macros=[("SFST_VERSION", open("VERSION").read().strip())], | ||
) | ||
], | ||
zip_safe=False, | ||
extras_require={ | ||
'dev': [ | ||
'pytest', | ||
'autoflake', | ||
'flake8' | ||
] | ||
} | ||
) |
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,3 +1 @@ | ||
pytest_plugins = [ | ||
'tests.fixtures' | ||
] | ||
pytest_plugins = ["tests.fixtures"] |
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,16 +1,17 @@ | ||
from pathlib import Path | ||
|
||
from pytest import fixture | ||
|
||
import sfst_transduce | ||
|
||
tests_dir = (Path(__file__) / '..').resolve() | ||
tests_dir = (Path(__file__) / "..").resolve() | ||
|
||
|
||
@fixture | ||
def transducer(): | ||
return sfst_transduce.Transducer((tests_dir / 'easy.a').as_posix()) | ||
return sfst_transduce.Transducer((tests_dir / "easy.a").as_posix()) | ||
|
||
|
||
@fixture | ||
def compact_transducer(): | ||
return sfst_transduce.CompactTransducer((tests_dir / 'easy.ca').as_posix()) | ||
return sfst_transduce.CompactTransducer((tests_dir / "easy.ca").as_posix()) |
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