Skip to content

Commit 2e4c806

Browse files
author
Andrea Del Fante
committed
All set for first release!
1 parent ae4690f commit 2e4c806

File tree

6 files changed

+17
-11
lines changed

6 files changed

+17
-11
lines changed

.github/workflows/pylint.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ jobs:
1818
run: |
1919
python -m pip install --upgrade pip
2020
python -m pip install -r requirements.txt
21-
pip install pylint
2221
- name: Analysing the code with pylint
2322
run: |
2423
pylint $(git ls-files '*.py')

hlpy_business_rule_engine/rule.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22
import re
3+
from typing import List
34

45
INDENTATION_PATTERN = re.compile(r"([\t ]+).+")
56

@@ -11,9 +12,9 @@ def __repr__(self) -> str:
1112

1213
DEFAULT_PRIORITY = 10000
1314

14-
def __init__(self, rule_name: str, conditions=[], actions="", priority=DEFAULT_PRIORITY) -> None:
15+
def __init__(self, rule_name: str, conditions: List[str] = [], actions="", priority=DEFAULT_PRIORITY) -> None:
1516
self.rule_name: str = rule_name
16-
self.conditions: list[str] = conditions
17+
self.conditions: List[str] = conditions
1718
self.actions: str = RuleParser.normalize_indentation(actions)
1819
self.priority: int = priority
1920

@@ -65,7 +66,7 @@ def parsestr(self, text: str) -> Rule:
6566
is_action = False
6667
if line.lower().strip().startswith('then'):
6768
if is_then:
68-
#TODO change this exception
69+
# TODO change this exception
6970
raise Exception('using multiple "then" in one rule is not allowed')
7071
is_then = True
7172
ignore_line = True

hlpy_business_rule_engine/rule_engine.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import os
21
import logging
3-
from .rule import Rule, RuleParser
2+
import os
43
import re
54

5+
from .rule import Rule, RuleParser
66

77

88
class RuleEngine:
9-
109
CUSTOM_FUNCTIONS = {}
1110

1211
def __init__(self):
@@ -133,4 +132,4 @@ def register_function(cls, function, function_name: str = None) -> None:
133132
@classmethod
134133
def unregister_function(cls, function, function_name: str = None) -> None:
135134
custom_function_name = function_name or function.__name__
136-
del(cls.CUSTOM_FUNCTIONS[custom_function_name])
135+
del (cls.CUSTOM_FUNCTIONS[custom_function_name])

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
-e .
33

44
# Testing
5+
pylint
56
pytest
67
coverage
78

89
# Packaging
9-
twine
10+
build

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[metadata]
2+
description-file = README.md

setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
setuptools.setup(
77
name="hlpy_business_rule_engine",
88
version=version,
9-
author="hlpy",
10-
author_email="info@hlpy.co",
9+
license='MIT',
1110
description="The hlpy business rule engine.",
11+
author="hlpy",
12+
author_email="hlpy-IT@hlpy.co",
13+
url='https://github.com/hlpy-co/business-rule-engine',
14+
download_url=f'https://github.com/hlpy-co/business-rule-engine/archive/{version}.tar.gz',
1215
packages=setuptools.find_packages(exclude=['tests/']),
1316
classifiers=[
1417
"Programming Language :: Python :: 3",
18+
"Programming Language :: Python :: 3.8",
1519
"Operating System :: OS Independent",
1620
],
1721
python_requires='>=3.8',

0 commit comments

Comments
 (0)