pylint & black

This commit is contained in:
Alexander Popov 2021-07-22 00:44:39 +03:00
parent 43580bc790
commit 24a0a263ae
Signed by: iiiypuk
GPG Key ID: 398FC73478D97286
9 changed files with 67 additions and 16 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
venv/
.tox/
minecraft_libs/__pycache__/
version.json

2
.pylintrc Normal file
View File

@ -0,0 +1,2 @@
[BASIC]
good-names = f

1
DESC.md Normal file
View File

@ -0,0 +1 @@
Parse version.json file and return libs

View File

@ -1,2 +1,2 @@
* `make_libs_list.py` - parse `version.json` file and return libs
Moved to [iiiypuk/minecraft-libs-parser](https://github.com/iiiypuk/minecraft-libs-parser).
## minecraft_libs
Parse `version.json` file and return libs

4
dev_requiments.txt Normal file
View File

@ -0,0 +1,4 @@
black==21.7b0
click==8.0.1
flit==3.2.0
pylint==2.9.5

View File

@ -0,0 +1,3 @@
"""Parse version.json file and return libs"""
__version__ = "1.0.3"

View File

@ -1,19 +1,15 @@
#!/usr/bin/env python3
"""Parse version.json file and return libs"""
import sys
import json
import click
__author__ = "Alexander Popov"
__version__ = "1.0.2"
__license__ = "Unlicense"
@click.command()
@click.option("--platform", default=sys.platform, help="Output platform (win32, linux, darwin).")
@click.option("--output", default="tty", help="Output option (tty, txt).")
def make_output(platform, output):
""" Return libraries list """
"""Return libraries list"""
libraries = parse_libs()
@ -38,7 +34,7 @@ def make_output(platform, output):
if platform == "win32":
print("\nWindows generate libraries list complete!")
elif platform == "linux" or platform == "darwin":
elif ("linux", "darwin") in platform:
print("\nUnix generate libraries list complete!")
elif output == "txt":
with open("./libs.txt", "w", encoding="utf-8") as f:
@ -46,23 +42,27 @@ def make_output(platform, output):
if platform == "win32":
print("\nWindows generate libraries list complete!\n" "See libs.txt file.")
elif platform == "linux" or platform == "darwin":
elif ("linux", "darwin") in platform:
print("\nUnix generate libraries list complete!\n" "See libs.txt file.")
def parse_libs():
""" Make libraries list from version.json file """
"""Make libraries list from version.json file"""
_ = []
with open("./version.json", "r", encoding="utf-8") as f:
file_data = json.loads(f.read())
try:
with open("./version.json", "r", encoding="utf-8") as f:
file_data = json.loads(f.read())
for lib in file_data["libraries"]:
_.append(lib["downloads"]["artifact"]["path"])
for lib in file_data["libraries"]:
_.append(lib["downloads"]["artifact"]["path"])
except FileNotFoundError:
print("ERROR: File version.json not found.")
sys.exit(-1)
return _
if __name__ == "__main__":
make_output()
make_output(platform=sys.platform, output="tty")

25
pyproject.toml Normal file
View File

@ -0,0 +1,25 @@
[build-system]
requires = ["flit_core >=2,<4"]
build-backend = "flit_core.buildapi"
[tool.flit.metadata]
module = "minecraft_libs"
author = "Alexander Popov"
author-email = "iiiypuk@iiiypuk.me"
requires = [ "click==7.1.2" ]
description-file = "DESC.md"
classifiers = [
'License :: Public Domain',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
]
requires-python = ">=3"
keywords = "iOS,splashscreen,splash-screen"
[tool.flit.metadata.requires-extra]
dev = ["pylint == 2.7.1", "black == 20.8b1"]
[tool.black]
line-length = 99

12
tox.ini Normal file
View File

@ -0,0 +1,12 @@
[tox]
isolated_build = True
envlist = py37,py38,py39
[testenv]
deps =
black
pylint
pytest
commands =
black minecraft_libs
pylint minecraft_libs