Skip to content

Commit

Permalink
add pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
190nm committed Jul 11, 2021
1 parent 6739b49 commit ebbcba5
Show file tree
Hide file tree
Showing 13 changed files with 1,133 additions and 37 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
.vscode
.python-version
.pre-commit-config.yaml
resources/
octocacheevai
exports/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
10 changes: 9 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
17 changes: 7 additions & 10 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,30 @@
kuro_dir = Path(__file__).resolve().parent.joinpath("ReinKuro")
clibs_dir = kuro_dir.joinpath("_clibs")
kuro_ext_config = dict(
include_dirs=[
str(clibs_dir.joinpath("kuro"))
],
sources=[
str(clibs_dir.joinpath("kuro/kuro.c")),
str(clibs_dir.joinpath("kuromodule.c"))
]
include_dirs=[str(clibs_dir.joinpath("kuro"))],
sources=[str(clibs_dir.joinpath("kuro/kuro.c")), str(clibs_dir.joinpath("kuromodule.c"))],
)

ext_modules = [Extension("reinkuro._clibs.kuro", **kuro_ext_config)]


class BuildFailed(Exception):
pass

class ExtBuilder(build_ext):

class ExtBuilder(build_ext):
def run(self):
try:
build_ext.run(self)
except (DistutilsPlatformError, FileNotFoundError):
print('Could not compile C extension.')
print("Could not compile C extension.")

def build_extension(self, ext):
try:
build_ext.build_extension(self, ext)
except (CCompilerError, DistutilsExecError, DistutilsPlatformError, ValueError):
print('Could not compile C extension.')
print("Could not compile C extension.")


def build(setup_kwargs: Dict[str, Any]) -> None:
setup_kwargs.update(
Expand Down
213 changes: 211 additions & 2 deletions poetry.lock

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,38 @@ build = "build.py"
python = "^3.8"
rich = "^10.5.0"
pycryptodome = "^3.10.1"
protobuf = "^3.17.3"

[tool.poetry.dev-dependencies]
pytest = "^5.2"
pytest-cov = "^2.12.1"
pre-commit = "^2.13.0"
flake8 = "^3.9.2"
black = {version = "^21.6b0", allow-prereleases = true}

[tool.black]
line-length = 120
target-version = ['py38']
include = '\.pyi?$'
exclude = '''
(
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
| foo.py # also separately exclude a file named foo.py in
# the root of the project
)
'''

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
2 changes: 1 addition & 1 deletion reinkuro/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.0'
__version__ = "0.1.0"
3 changes: 2 additions & 1 deletion reinkuro/kuro.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from reinkuro._clibs import kuro

def cryptbystring(input:bytes, mask:str) -> bytes:

def cryptbystring(input: bytes, mask: str) -> bytes:
"""Decrypts assets by applying a byte mask to the file.
Args:
Expand Down
Loading

0 comments on commit ebbcba5

Please sign in to comment.