forked from home-assistant/intents
-
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.
- Loading branch information
1 parent
fa75328
commit a54c50d
Showing
16 changed files
with
271 additions
and
3 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 |
---|---|---|
|
@@ -11,3 +11,4 @@ htmlcov | |
.projectile | ||
.venv/ | ||
.mypy_cache/ | ||
*.egg-info/ |
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,6 @@ | ||
[settings] | ||
multi_line_output=3 | ||
include_trailing_comma=True | ||
force_grid_wrap=0 | ||
use_parentheses=True | ||
line_length=88 |
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,10 @@ | ||
[mypy] | ||
|
||
[mypy-setuptools.*] | ||
ignore_missing_imports = True | ||
|
||
[mypy-pytest.*] | ||
ignore_missing_imports = True | ||
|
||
[mypy-yaml.*] | ||
ignore_missing_imports = True |
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 @@ | ||
0.0.1 |
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,19 @@ | ||
"""Shared access to package resources""" | ||
import os | ||
import typing | ||
from pathlib import Path | ||
|
||
try: | ||
import importlib.resources | ||
|
||
files = importlib.resources.files | ||
except (ImportError, AttributeError): | ||
# Backport for Python < 3.9 | ||
import importlib_resources # type: ignore | ||
|
||
files = importlib_resources.files | ||
|
||
_PACKAGE = "hassil" | ||
_DIR = Path(typing.cast(os.PathLike, files(_PACKAGE))) | ||
|
||
__version__ = (_DIR / "VERSION").read_text(encoding="utf-8").strip() |
Empty file.
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,18 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
# Directory of *this* script | ||
this_dir="$( cd "$( dirname "$0" )" && pwd )" | ||
|
||
# Base directory of repo | ||
base_dir="$(realpath "${this_dir}/..")" | ||
|
||
# Path to virtual environment | ||
: "${venv:=${base_dir}/.venv}" | ||
|
||
if [ -d "${venv}" ]; then | ||
# Activate virtual environment if available | ||
source "${venv}/bin/activate" | ||
fi | ||
|
||
pytest -vv "${base_dir}/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env python3 | ||
from pathlib import Path | ||
|
||
import setuptools | ||
from setuptools import setup | ||
|
||
this_dir = Path(__file__).parent | ||
module_dir = this_dir / "hassil" | ||
|
||
# ----------------------------------------------------------------------------- | ||
|
||
# Load README in as long description | ||
long_description: str = "" | ||
readme_path = this_dir / "README.md" | ||
if readme_path.is_file(): | ||
long_description = readme_path.read_text(encoding="utf-8") | ||
|
||
requirements = [] | ||
requirements_path = this_dir / "requirements.txt" | ||
if requirements_path.is_file(): | ||
with open(requirements_path, "r", encoding="utf-8") as requirements_file: | ||
requirements = requirements_file.read().splitlines() | ||
|
||
version_path = module_dir / "VERSION" | ||
with open(version_path, "r", encoding="utf-8") as version_file: | ||
version = version_file.read().strip() | ||
|
||
# ----------------------------------------------------------------------------- | ||
|
||
setup( | ||
name="hassil", | ||
version=version, | ||
description="The Home Assistant Intent Language parser", | ||
long_description=long_description, | ||
url="http://github.com/rhasspy/hassil", | ||
author="Michael Hansen", | ||
author_email="[email protected]", | ||
license="Apache-2.0", | ||
packages=setuptools.find_packages(), | ||
package_data={ | ||
"hassil": ["VERSION", "py.typed"], | ||
}, | ||
install_requires=requirements, | ||
extras_require={':python_version<"3.9"': ["importlib_resources"]}, | ||
entry_points={ | ||
"console_scripts": [ | ||
"hassil = hassil.__main__:main", | ||
] | ||
}, | ||
classifiers=[ | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Developers", | ||
"Topic :: Text Processing :: Linguistic", | ||
"License :: OSI Approved :: License :: OSI Approved :: Apache Software License", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
], | ||
keywords="home assistant intent recognition", | ||
) |
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,40 @@ | ||
[MESSAGES CONTROL] | ||
disable= | ||
format, | ||
abstract-class-little-used, | ||
abstract-method, | ||
cyclic-import, | ||
duplicate-code, | ||
global-statement, | ||
import-outside-toplevel, | ||
inconsistent-return-statements, | ||
locally-disabled, | ||
not-context-manager, | ||
redefined-variable-type, | ||
too-few-public-methods, | ||
too-many-arguments, | ||
too-many-branches, | ||
too-many-instance-attributes, | ||
too-many-lines, | ||
too-many-locals, | ||
too-many-public-methods, | ||
too-many-return-statements, | ||
too-many-statements, | ||
too-many-boolean-expressions, | ||
unnecessary-pass, | ||
unused-argument, | ||
broad-except, | ||
too-many-nested-blocks, | ||
invalid-name, | ||
unused-import, | ||
no-self-use, | ||
fixme, | ||
useless-super-delegation, | ||
missing-module-docstring, | ||
missing-class-docstring, | ||
missing-function-docstring, | ||
import-error, | ||
consider-using-with | ||
|
||
[FORMAT] | ||
expected-line-ending-format=LF |
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,8 @@ | ||
hassil~=0.0.1 | ||
PyYAML==6.0 | ||
|
||
black==22.3.0 | ||
flake8==3.7.9 | ||
mypy==0.910 | ||
pylint==2.10.2 | ||
pytest==5.4.1 |
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,27 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
# Directory of *this* script | ||
this_dir="$( cd "$( dirname "$0" )" && pwd )" | ||
|
||
base_dir="$(realpath "${this_dir}/..")" | ||
|
||
# Path to virtual environment | ||
: "${venv:=${base_dir}/.venv}" | ||
|
||
if [ -d "${venv}" ]; then | ||
# Activate virtual environment if available | ||
source "${venv}/bin/activate" | ||
fi | ||
|
||
python_files=() | ||
python_files+=("${base_dir}/tests"/*.py) | ||
|
||
# Format code | ||
black "${python_files[@]}" | ||
isort "${python_files[@]}" | ||
|
||
# Check | ||
flake8 "${python_files[@]}" | ||
pylint "${python_files[@]}" | ||
mypy "${python_files[@]}" |
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,38 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
# Directory of *this* script | ||
this_dir="$( cd "$( dirname "$0" )" && pwd )" | ||
|
||
# Base directory of repo | ||
base_dir="$(realpath "${this_dir}/..")" | ||
|
||
# Path to virtual environment | ||
: "${venv:=${base_dir}/.venv}" | ||
|
||
# Python binary to use | ||
: "${PYTHON=python3}" | ||
|
||
python_version="$(${PYTHON} --version)" | ||
|
||
# Create virtual environment | ||
echo "Creating virtual environment at ${venv} (${python_version})" | ||
rm -rf "${venv}" | ||
"${PYTHON}" -m venv "${venv}" | ||
source "${venv}/bin/activate" | ||
|
||
# Install Python dependencies | ||
echo 'Installing Python dependencies' | ||
pip3 install --upgrade pip | ||
pip3 install --upgrade wheel setuptools | ||
|
||
# Install HassIL parser | ||
pushd "${base_dir}/parser" 2>/dev/null | ||
pip3 install -e '.' | ||
popd 2>/dev/null | ||
|
||
pip3 install -r "${base_dir}/requirements.txt" | ||
|
||
# ----------------------------------------------------------------------------- | ||
|
||
echo "OK" |
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,18 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
# Directory of *this* script | ||
this_dir="$( cd "$( dirname "$0" )" && pwd )" | ||
|
||
# Base directory of repo | ||
base_dir="$(realpath "${this_dir}/..")" | ||
|
||
# Path to virtual environment | ||
: "${venv:=${base_dir}/.venv}" | ||
|
||
if [ -d "${venv}" ]; then | ||
# Activate virtual environment if available | ||
source "${venv}/bin/activate" | ||
fi | ||
|
||
pytest -vv "${base_dir}/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[flake8] | ||
# To work with Black | ||
max-line-length = 88 | ||
# E501: line too long | ||
# W503: Line break occurred before a binary operator | ||
# E203: Whitespace before ':' | ||
# D202 No blank lines allowed after function docstring | ||
# W504 line break after binary operator | ||
ignore = | ||
E501, | ||
W503, | ||
E203, | ||
D202, | ||
W504 | ||
|
||
[isort] | ||
multi_line_output = 3 | ||
include_trailing_comma=True | ||
force_grid_wrap=0 | ||
use_parentheses=True | ||
line_length=88 | ||
indent = " " |
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