From 1156bf9fe04fc1fcb28328ac98f7492fcd646cfe Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 16:06:35 +0200 Subject: [PATCH 01/25] refactor package name to goap. --- {Goap => goap}/Action.py | 0 {Goap => goap}/Automaton.py | 0 {Goap => goap}/Errors.py | 0 {Goap => goap}/Planner.py | 0 {Goap => goap}/Sensor.py | 0 {Goap => goap}/WorldState.py | 0 {Goap => goap}/__init__.py | 0 {Goap => goap}/utils/__init__.py | 0 {Goap => goap}/utils/aws/__init__.py | 0 {Goap => goap}/utils/aws/actions.py | 0 {Goap => goap}/utils/aws/sensors.py | 0 {Goap => goap}/utils/command/__init__.py | 0 {Goap => goap}/utils/commons/__init__.py | 0 {Goap => goap}/utils/gcp/__init__.py | 0 {Goap => goap}/utils/os/TODO.md | 0 {Goap => goap}/utils/os/__init__.py | 0 Goap/utils/os/ShellCommand.py => goap/utils/os/shell_command.py | 0 17 files changed, 0 insertions(+), 0 deletions(-) rename {Goap => goap}/Action.py (100%) rename {Goap => goap}/Automaton.py (100%) rename {Goap => goap}/Errors.py (100%) rename {Goap => goap}/Planner.py (100%) rename {Goap => goap}/Sensor.py (100%) rename {Goap => goap}/WorldState.py (100%) rename {Goap => goap}/__init__.py (100%) rename {Goap => goap}/utils/__init__.py (100%) rename {Goap => goap}/utils/aws/__init__.py (100%) rename {Goap => goap}/utils/aws/actions.py (100%) rename {Goap => goap}/utils/aws/sensors.py (100%) rename {Goap => goap}/utils/command/__init__.py (100%) rename {Goap => goap}/utils/commons/__init__.py (100%) rename {Goap => goap}/utils/gcp/__init__.py (100%) rename {Goap => goap}/utils/os/TODO.md (100%) rename {Goap => goap}/utils/os/__init__.py (100%) rename Goap/utils/os/ShellCommand.py => goap/utils/os/shell_command.py (100%) diff --git a/Goap/Action.py b/goap/Action.py similarity index 100% rename from Goap/Action.py rename to goap/Action.py diff --git a/Goap/Automaton.py b/goap/Automaton.py similarity index 100% rename from Goap/Automaton.py rename to goap/Automaton.py diff --git a/Goap/Errors.py b/goap/Errors.py similarity index 100% rename from Goap/Errors.py rename to goap/Errors.py diff --git a/Goap/Planner.py b/goap/Planner.py similarity index 100% rename from Goap/Planner.py rename to goap/Planner.py diff --git a/Goap/Sensor.py b/goap/Sensor.py similarity index 100% rename from Goap/Sensor.py rename to goap/Sensor.py diff --git a/Goap/WorldState.py b/goap/WorldState.py similarity index 100% rename from Goap/WorldState.py rename to goap/WorldState.py diff --git a/Goap/__init__.py b/goap/__init__.py similarity index 100% rename from Goap/__init__.py rename to goap/__init__.py diff --git a/Goap/utils/__init__.py b/goap/utils/__init__.py similarity index 100% rename from Goap/utils/__init__.py rename to goap/utils/__init__.py diff --git a/Goap/utils/aws/__init__.py b/goap/utils/aws/__init__.py similarity index 100% rename from Goap/utils/aws/__init__.py rename to goap/utils/aws/__init__.py diff --git a/Goap/utils/aws/actions.py b/goap/utils/aws/actions.py similarity index 100% rename from Goap/utils/aws/actions.py rename to goap/utils/aws/actions.py diff --git a/Goap/utils/aws/sensors.py b/goap/utils/aws/sensors.py similarity index 100% rename from Goap/utils/aws/sensors.py rename to goap/utils/aws/sensors.py diff --git a/Goap/utils/command/__init__.py b/goap/utils/command/__init__.py similarity index 100% rename from Goap/utils/command/__init__.py rename to goap/utils/command/__init__.py diff --git a/Goap/utils/commons/__init__.py b/goap/utils/commons/__init__.py similarity index 100% rename from Goap/utils/commons/__init__.py rename to goap/utils/commons/__init__.py diff --git a/Goap/utils/gcp/__init__.py b/goap/utils/gcp/__init__.py similarity index 100% rename from Goap/utils/gcp/__init__.py rename to goap/utils/gcp/__init__.py diff --git a/Goap/utils/os/TODO.md b/goap/utils/os/TODO.md similarity index 100% rename from Goap/utils/os/TODO.md rename to goap/utils/os/TODO.md diff --git a/Goap/utils/os/__init__.py b/goap/utils/os/__init__.py similarity index 100% rename from Goap/utils/os/__init__.py rename to goap/utils/os/__init__.py diff --git a/Goap/utils/os/ShellCommand.py b/goap/utils/os/shell_command.py similarity index 100% rename from Goap/utils/os/ShellCommand.py rename to goap/utils/os/shell_command.py From ec11e863bdbc1cc76c336ca66fb76073eab58ee3 Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 16:08:38 +0200 Subject: [PATCH 02/25] refactor package name in docs and usage in the internal packages --- Config/__init__.py | 0 README.md | 8 +++--- examples/README.md | 6 ++--- .../directory_handler/directory_handler.py | 8 +++--- examples/vuln_scanner/macos_vuln_scanner.py | 8 +++--- goap/Action.py | 4 +-- goap/Automaton.py | 26 +++++++++---------- goap/Planner.py | 2 +- goap/Sensor.py | 2 +- goap/__init__.py | 19 ++++++++------ goap/utils/aws/sensors.py | 10 +++---- pyproject.toml | 9 ++++--- setup.py | 6 ++--- tests/Action_test.py | 6 ++--- tests/Automaton_test.py | 8 +++--- tests/Planner_test.py | 12 ++++----- tests/Sensor_test.py | 4 +-- tests/Version_test.py | 4 +-- tests/utils/test_ShellCommand.py | 2 +- 19 files changed, 74 insertions(+), 70 deletions(-) delete mode 100644 Config/__init__.py diff --git a/Config/__init__.py b/Config/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md index 485d1b7..81acd7f 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,10 @@ To perform the search the planner sets a graph using the possible world states a From the AutomatonController class perspective the usage and interaction should be: ```python -from Goap.utils.os.ShellCommand import ShellCommand -from Goap.Action import Actions -from Goap.Sensor import Sensors -from Goap.Automaton import AutomatonController +from goap.utils.os.shell_command import ShellCommand +from goap.Action import Actions +from goap.Sensor import Sensors +from goap.Automaton import AutomatonController def setup_sensors(): diff --git a/examples/README.md b/examples/README.md index 929aa14..397685f 100644 --- a/examples/README.md +++ b/examples/README.md @@ -10,9 +10,9 @@ Based on the state of the directory the automaton would make the decision on wh ### Code ```python -from Goap.Action import Actions -from Goap.Sensor import Sensors -from Goap.Automaton import AutomatonController +from goap.Action import Actions +from goap.Sensor import Sensors +from goap.Automaton import AutomatonController def setup_sensors(): diff --git a/examples/directory_handler/directory_handler.py b/examples/directory_handler/directory_handler.py index 1454493..90e436c 100644 --- a/examples/directory_handler/directory_handler.py +++ b/examples/directory_handler/directory_handler.py @@ -1,7 +1,7 @@ -from Goap.utils.os.ShellCommand import ShellCommand -from Goap.Action import Actions -from Goap.Sensor import Sensors -from Goap.Automaton import AutomatonController +from goap.utils.os.shell_command import ShellCommand +from goap.Action import Actions +from goap.Sensor import Sensors +from goap.Automaton import AutomatonController def setup_sensors(): diff --git a/examples/vuln_scanner/macos_vuln_scanner.py b/examples/vuln_scanner/macos_vuln_scanner.py index 57ba7eb..74c7ec6 100644 --- a/examples/vuln_scanner/macos_vuln_scanner.py +++ b/examples/vuln_scanner/macos_vuln_scanner.py @@ -1,7 +1,7 @@ -from Goap.utils.os.ShellCommand import ShellCommand -from Goap.Action import Actions -from Goap.Sensor import Sensors -from Goap.Automaton import AutomatonController +from goap.utils.os.shell_command import ShellCommand +from goap.Action import Actions +from goap.Sensor import Sensors +from goap.Automaton import AutomatonController TARGET_FILE_PATH = '/tmp/target_hosts.txt' diff --git a/goap/Action.py b/goap/Action.py index 55648fd..dac49c9 100644 --- a/goap/Action.py +++ b/goap/Action.py @@ -1,6 +1,6 @@ -# from Goap.Action import ActionResponse +# from goap.Action import ActionResponse from typing import Callable, List, Optional -from Goap.Errors import ActionAlreadyInCollectionError +from goap.Errors import ActionAlreadyInCollectionError class Action: diff --git a/goap/Automaton.py b/goap/Automaton.py index 60b1970..e333c41 100644 --- a/goap/Automaton.py +++ b/goap/Automaton.py @@ -1,10 +1,9 @@ from datetime import datetime from automat import MethodicalMachine -from Goap.Sensor import Sensors -from Goap.Action import Actions -from Goap.Planner import Planner -from Goap.WorldState import WorldState -from rx import Observable +from goap.Sensor import Sensors +from goap.Action import Actions +from goap.Planner import Planner +from goap.WorldState import WorldState from time import sleep @@ -62,19 +61,20 @@ def __init__( self.goal = {} def __sense_environment(self): - Observable.from_( - self.sensors). subscribe( - lambda sensor: self.working_memory.append( + for sensor in self.sensors: + self.working_memory.append( Fact( sensor=sensor.name, data=sensor.exec(), - binding=sensor.binding))) - Observable.from_( - self.working_memory). subscribe( - lambda fact: setattr( + binding=sensor.binding + ) + ) + for fact in self.working_memory: + setattr( self.world_state, fact.binding, - fact.data.response)) + fact.data.response + ) def __set_action_plan(self): self.action_plan = self.planner.plan(self.world_state, self.goal) diff --git a/goap/Planner.py b/goap/Planner.py index 50c59a2..5604713 100644 --- a/goap/Planner.py +++ b/goap/Planner.py @@ -1,4 +1,4 @@ -from Goap.Action import Actions +from goap.Action import Actions import networkx as nx diff --git a/goap/Sensor.py b/goap/Sensor.py index 520245c..8dbb3aa 100644 --- a/goap/Sensor.py +++ b/goap/Sensor.py @@ -1,6 +1,6 @@ from typing import Callable, List -from Goap.Errors import SensorAlreadyInCollectionError, SensorDoesNotExistError +from goap.Errors import SensorAlreadyInCollectionError, SensorDoesNotExistError class Sensor: diff --git a/goap/__init__.py b/goap/__init__.py index fb158a4..1437cec 100644 --- a/goap/__init__.py +++ b/goap/__init__.py @@ -1,14 +1,16 @@ -from Goap.Action import Action, Actions -from Goap.Sensor import Sensor, Sensors -from Goap import Automaton -from Goap import WorldState -from Goap.Planner import Planner -from Goap import Errors +from goap.Action import Action, Actions +from goap.Sensor import Sensor, Sensors +from goap import Automaton +from goap import WorldState +from goap.Planner import Planner +from goap import Errors -name = 'Goap' -__version__ = '0.2.1' +name = 'goap' +__name__ = 'goap' +__version__ = '0.3.0' __all__ = [ 'Action', + 'Actions', 'Automaton', 'Errors', 'Planner', @@ -16,5 +18,6 @@ 'Sensors', 'WorldState', 'name', + '__name__', '__version__', ] diff --git a/goap/utils/aws/sensors.py b/goap/utils/aws/sensors.py index 9e044b9..6a7d81e 100644 --- a/goap/utils/aws/sensors.py +++ b/goap/utils/aws/sensors.py @@ -37,10 +37,10 @@ def __desc(self): response = self.client.describe_instances(Filters=self.filters) return response except IOError as e: - raise IOError(f'{e}' + raise IOError(f'{e}') def __get_item(self, key): - vpcs=self.__desc() + vpcs = self.__desc() return [vpc[key] for vpc in vpcs].pop() def exec(self): @@ -59,13 +59,13 @@ def __desc(self): :rtype: json """ try: - response=self.client.describe_vpcs(Filters=self.filters) + response = self.client.describe_vpcs(Filters=self.filters) return response except IOError as e: raise('{}'.format(e)) def __get_item(self, key): - vpcs=self.__desc() + vpcs = self.__desc() return [vpc[key] for vpc in vpcs].pop() def exec(self): @@ -75,7 +75,7 @@ def exec(self): class AWSCheckVPCUnique(VPCClient): def is_unique(self): - vpcs=self.__desc() + vpcs = self.__desc() if len(vpcs) >= 2: return False else: diff --git a/pyproject.toml b/pyproject.toml index 1b11930..8767fbc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,19 +1,19 @@ [tool.poetry] authors = ["Leonardo Pepe de Freitas "] description = "Goal Oriented Action Planning alghorithm implementation in Python" -name = "goapy" -version = "0.2.1" +name = "goap" +version = "0.3.0" [tool.poetry.dependencies] Automat = "0.8.0" networkx = "2.3" python = "^3.8.5" -rx = "1.6.0" typing = "^3.7.4" [tool.poetry.dev-dependencies] Sphinx = "1.5.2" autopep8 = "1.5.2" +boto3 = "^1.16.23" conversion = "0.0.7" docutils = "0.13.1" flake8 = "^3.7.9" @@ -22,7 +22,8 @@ pylint = "2.5.2" pytest = "5.3.5" rope = "^0.17.0" rx = "1.6.0" -boto3 = "^1.16.23" +toml = "^0.10.2" +coveralls = "^3.2.0" [build-system] build-backend = "poetry.masonry.api" diff --git a/setup.py b/setup.py index d450a80..bbe4931 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- from setuptools import setup, find_packages -from Goap import name, __version__ as version +from goap import name, __version__ as version with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() @@ -9,6 +9,7 @@ name=name, version=version, packages=find_packages(), + test_suite='tests', url='https://github.com/leopepe/GOApy', project_urls={ "Bug Tracker": "https://github.com/leopepe/GOApy/issues", @@ -19,11 +20,10 @@ description='Goal Oriented Action Planning (GOAP) algorithm implemented in Python', long_description=long_description, long_description_content_type="text/markdown", - test_suite='tests', + python_requires='>=3.7', classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: BSD License", "Operating System :: POSIX :: Linux", ], - python_requires='>=3.7', ) diff --git a/tests/Action_test.py b/tests/Action_test.py index 0c1bf51..37c872d 100644 --- a/tests/Action_test.py +++ b/tests/Action_test.py @@ -1,9 +1,9 @@ from typing import Optional import unittest -from Goap.utils.os.ShellCommand import ShellCommand -from Goap.Action import Actions, Action -from Goap.Errors import ActionAlreadyInCollectionError +from goap.utils.os.shell_command import ShellCommand +from goap.Action import Actions, Action +from goap.Errors import ActionAlreadyInCollectionError class ActionTest(unittest.TestCase): diff --git a/tests/Automaton_test.py b/tests/Automaton_test.py index 40877f9..02dca80 100644 --- a/tests/Automaton_test.py +++ b/tests/Automaton_test.py @@ -3,10 +3,10 @@ from os import path from pprint import PrettyPrinter -from Goap.Action import Action, Actions -from Goap.Automaton import Automaton -from Goap.Sensor import Sensor, Sensors -from Goap.utils.os.ShellCommand import ShellCommand +from goap.Action import Action, Actions +from goap.Automaton import Automaton +from goap.Sensor import Sensor, Sensors +from goap.utils.os.shell_command import ShellCommand ENV_DIR = '/tmp/goap_tmp' diff --git a/tests/Planner_test.py b/tests/Planner_test.py index e9d7fd0..078ba8e 100644 --- a/tests/Planner_test.py +++ b/tests/Planner_test.py @@ -1,4 +1,4 @@ -from Goap.utils.os.ShellCommand import ShellCommand +from goap.utils.os.shell_command import ShellCommand from os import path import unittest import subprocess @@ -6,9 +6,9 @@ import networkx as nx -from Goap.WorldState import WorldState -from Goap.Action import Actions -from Goap.Planner import Planner +from goap.WorldState import WorldState +from goap.Action import Actions +from goap.Planner import Planner class PlannerTest(unittest.TestCase): @@ -104,8 +104,8 @@ def test_set_goal(self): assert self.gs == self.planner.goal def test_graph_isomorphic(self): - from Goap.Planner import Node - from Goap.Planner import Edge + from goap.Planner import Node + from goap.Planner import Edge acts = Actions() acts.add( diff --git a/tests/Sensor_test.py b/tests/Sensor_test.py index f8fcb93..6c0e13a 100644 --- a/tests/Sensor_test.py +++ b/tests/Sensor_test.py @@ -1,8 +1,8 @@ from typing import Callable import unittest -from Goap.Sensor import Sensors, Sensor -from Goap.utils.os.ShellCommand import ShellCommand +from goap.Sensor import Sensors, Sensor +from goap.utils.os.shell_command import ShellCommand class SensorResponseTest(unittest.TestCase): diff --git a/tests/Version_test.py b/tests/Version_test.py index 195eac2..28cf8a2 100644 --- a/tests/Version_test.py +++ b/tests/Version_test.py @@ -1,6 +1,6 @@ import toml from pathlib import Path -import Goap +import goap def test_versions_are_in_sync(): @@ -10,6 +10,6 @@ def test_versions_are_in_sync(): pyproject = toml.loads(open(str(path)).read()) pyproject_version = pyproject["tool"]["poetry"]["version"] - package_init_version = Goap.__version__ + package_init_version = goap.__version__ assert package_init_version == pyproject_version diff --git a/tests/utils/test_ShellCommand.py b/tests/utils/test_ShellCommand.py index 81fcac1..a7370d5 100644 --- a/tests/utils/test_ShellCommand.py +++ b/tests/utils/test_ShellCommand.py @@ -1,4 +1,4 @@ -from Goap.utils.os.ShellCommand import ShellCommand +from goap.utils.os.shell_command import ShellCommand def test_command_output(): From b9be22b29c5889c7baa3f07825d4eb61be7d7c8c Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 16:08:46 +0200 Subject: [PATCH 03/25] cleanup --- goap/Action.py | 1 - 1 file changed, 1 deletion(-) diff --git a/goap/Action.py b/goap/Action.py index dac49c9..51b5a04 100644 --- a/goap/Action.py +++ b/goap/Action.py @@ -1,4 +1,3 @@ -# from goap.Action import ActionResponse from typing import Callable, List, Optional from goap.Errors import ActionAlreadyInCollectionError From 6da830e61abd75019c70512108085500f31fec4d Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 16:09:26 +0200 Subject: [PATCH 04/25] upadate at todo and improved makefile targets (using poetry) --- Makefile | 15 ++++++--------- TODO.md | 4 ++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 39c9ade..5104506 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ VERSION=$(shell poetry version|cut -d" " -f2) SHELL=/bin/bash -PYTHON_VERSION=3.8.5 +PYTHON_VERSION=3.8.10 PYTHON_MINOR_VERSION=3.8 all: venv install-in-venv test @@ -67,20 +67,17 @@ install: python setup.py install format: venv - autopep8 --in-place --aggressive --aggressive --aggressive --recursive Goap/ + autopep8 --in-place --aggressive --aggressive --aggressive --recursive goap/ install-in-venv: venv install - python setup.py install + poetry run python setup.py install unittest: install-in-venv @echo "Running unit tests" - pytest -v -s tests/ - -install-coveralls: venv install-in-venv - pip install coveralls + poetry run pytest -v -s tests/ -test-coverage: install-coveralls - coverage run --source=Goap/ setup.py test +test-coverage: venv + poetry run coverage run --source=goap/ setup.py test docker-build: docker build -t goapy:$(shell poetry version|cut -d" " -f2) . diff --git a/TODO.md b/TODO.md index edf22b8..2629801 100644 --- a/TODO.md +++ b/TODO.md @@ -20,6 +20,10 @@ NOTES: The automatons need to be reactive: Change of states needs to trigger a plan The automatons need to communicate to each other and combine plans +# DONE: v0.3.0 +* Removed rx depdenency +* Make module and package name compatible with PEP-8 (rename to goap) + # DONE: v0.2.1 * Test coverage obove 80% * Refactor Actions and Sensors to receive func: Callable as parameter (no more ShellCommandAction and ObjectAction) From eace882127593c3582e5ee11b82cbefbba6eed47 Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 16:09:52 +0200 Subject: [PATCH 05/25] updated package dependencies --- poetry.lock | 444 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 265 insertions(+), 179 deletions(-) diff --git a/poetry.lock b/poetry.lock index bbad640..7b214b2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,53 +1,52 @@ [[package]] -category = "dev" -description = "A configurable sidebar-enabled Sphinx theme" name = "alabaster" +version = "0.7.12" +description = "A configurable sidebar-enabled Sphinx theme" +category = "dev" optional = false python-versions = "*" -version = "0.7.12" [[package]] -category = "dev" -description = "An abstract syntax tree for Python with inference support." name = "astroid" +version = "2.5" +description = "An abstract syntax tree for Python with inference support." +category = "dev" optional = false python-versions = ">=3.6" -version = "2.5" [package.dependencies] lazy-object-proxy = ">=1.4.0" wrapt = ">=1.11,<1.13" [[package]] -category = "dev" -description = "Atomic file writes." -marker = "sys_platform == \"win32\"" name = "atomicwrites" +version = "1.4.0" +description = "Atomic file writes." +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "1.4.0" [[package]] -category = "main" -description = "Classes Without Boilerplate" name = "attrs" +version = "21.2.0" +description = "Classes Without Boilerplate" +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "21.2.0" [package.extras] -dev = ["coverage (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit"] +dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit"] docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] -tests = ["coverage (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface"] -tests_no_zope = ["coverage (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins"] +tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface"] +tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins"] [[package]] -category = "main" -description = "Self-service finite-state machines for the programmer on the go." name = "automat" +version = "0.8.0" +description = "Self-service finite-state machines for the programmer on the go." +category = "main" optional = false python-versions = "*" -version = "0.8.0" [package.dependencies] attrs = ">=16.1.0" @@ -57,47 +56,47 @@ six = "*" visualize = ["graphviz (>0.5.1)", "Twisted (>=16.1.1)"] [[package]] -category = "dev" -description = "A tool that automatically formats Python code to conform to the PEP 8 style guide" name = "autopep8" +version = "1.5.2" +description = "A tool that automatically formats Python code to conform to the PEP 8 style guide" +category = "dev" optional = false python-versions = "*" -version = "1.5.2" [package.dependencies] pycodestyle = ">=2.5.0" [[package]] -category = "dev" -description = "Internationalization utilities" name = "babel" +version = "2.9.1" +description = "Internationalization utilities" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "2.9.1" [package.dependencies] pytz = ">=2015.7" [[package]] -category = "dev" -description = "The AWS SDK for Python" name = "boto3" +version = "1.18.12" +description = "The AWS SDK for Python" +category = "dev" optional = false python-versions = ">= 3.6" -version = "1.18.11" [package.dependencies] -botocore = ">=1.21.11,<1.22.0" +botocore = ">=1.21.12,<1.22.0" jmespath = ">=0.7.1,<1.0.0" s3transfer = ">=0.5.0,<0.6.0" [[package]] -category = "dev" -description = "Low-level, data-driven core of boto 3." name = "botocore" +version = "1.21.12" +description = "Low-level, data-driven core of boto 3." +category = "dev" optional = false python-versions = ">= 3.6" -version = "1.21.11" [package.dependencies] jmespath = ">=0.7.1,<1.0.0" @@ -105,68 +104,101 @@ python-dateutil = ">=2.1,<3.0.0" urllib3 = ">=1.25.4,<1.27" [package.extras] -crt = ["awscrt (0.11.24)"] +crt = ["awscrt (==0.11.24)"] [[package]] -category = "dev" -description = "Python package for providing Mozilla's CA Bundle." name = "certifi" +version = "2021.5.30" +description = "Python package for providing Mozilla's CA Bundle." +category = "dev" optional = false python-versions = "*" -version = "2021.5.30" [[package]] -category = "dev" -description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." -marker = "python_version >= \"3\"" name = "charset-normalizer" +version = "2.0.4" +description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +category = "dev" optional = false python-versions = ">=3.5.0" -version = "2.0.4" [package.extras] unicode_backport = ["unicodedata2"] [[package]] -category = "dev" -description = "Cross-platform colored terminal text." -marker = "sys_platform == \"win32\"" name = "colorama" +version = "0.4.4" +description = "Cross-platform colored terminal text." +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "0.4.4" [[package]] -category = "dev" -description = "Utility functions to convert strings to Python types" name = "conversion" +version = "0.0.7" +description = "Utility functions to convert strings to Python types" +category = "dev" optional = false python-versions = "*" -version = "0.0.7" [[package]] -category = "main" -description = "Decorators for Humans" +name = "coverage" +version = "5.5" +description = "Code coverage measurement for Python" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" + +[package.extras] +toml = ["toml"] + +[[package]] +name = "coveralls" +version = "3.2.0" +description = "Show coverage stats online via coveralls.io" +category = "dev" +optional = false +python-versions = ">= 3.5" + +[package.dependencies] +coverage = ">=4.1,<6.0" +docopt = ">=0.6.1" +requests = ">=1.0.0" + +[package.extras] +yaml = ["PyYAML (>=3.10)"] + +[[package]] name = "decorator" +version = "5.0.9" +description = "Decorators for Humans" +category = "main" optional = false python-versions = ">=3.5" -version = "5.0.9" [[package]] +name = "docopt" +version = "0.6.2" +description = "Pythonic argument parser, that will make you smile" category = "dev" -description = "Docutils -- Python Documentation Utilities" -name = "docutils" optional = false python-versions = "*" -version = "0.13.1" [[package]] +name = "docutils" +version = "0.13.1" +description = "Docutils -- Python Documentation Utilities" category = "dev" -description = "the modular source code checker: pep8 pyflakes and co" +optional = false +python-versions = "*" + +[[package]] name = "flake8" +version = "3.9.2" +description = "the modular source code checker: pep8 pyflakes and co" +category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" -version = "3.9.2" [package.dependencies] mccabe = ">=0.6.0,<0.7.0" @@ -174,29 +206,28 @@ pycodestyle = ">=2.7.0,<2.8.0" pyflakes = ">=2.3.0,<2.4.0" [[package]] -category = "dev" -description = "Internationalized Domain Names in Applications (IDNA)" -marker = "python_version >= \"3\"" name = "idna" +version = "3.2" +description = "Internationalized Domain Names in Applications (IDNA)" +category = "dev" optional = false python-versions = ">=3.5" -version = "3.2" [[package]] -category = "dev" -description = "Getting image size from png/jpeg/jpeg2000/gif file" name = "imagesize" +version = "1.2.0" +description = "Getting image size from png/jpeg/jpeg2000/gif file" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "1.2.0" [[package]] -category = "dev" -description = "A Python utility / library to sort Python imports." name = "isort" +version = "4.3.21" +description = "A Python utility / library to sort Python imports." +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "4.3.21" [package.extras] pipfile = ["pipreqs", "requirementslib"] @@ -205,12 +236,12 @@ requirements = ["pipreqs", "pip-api"] xdg_home = ["appdirs (>=1.4.0)"] [[package]] -category = "dev" -description = "A very fast and expressive template engine." name = "jinja2" +version = "3.0.1" +description = "A very fast and expressive template engine." +category = "dev" optional = false python-versions = ">=3.6" -version = "3.0.1" [package.dependencies] MarkupSafe = ">=2.0" @@ -219,52 +250,52 @@ MarkupSafe = ">=2.0" i18n = ["Babel (>=2.7)"] [[package]] -category = "dev" -description = "JSON Matching Expressions" name = "jmespath" +version = "0.10.0" +description = "JSON Matching Expressions" +category = "dev" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -version = "0.10.0" [[package]] -category = "dev" -description = "A fast and thorough lazy object proxy." name = "lazy-object-proxy" +version = "1.6.0" +description = "A fast and thorough lazy object proxy." +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" -version = "1.6.0" [[package]] -category = "dev" -description = "Safely add untrusted strings to HTML/XML markup." name = "markupsafe" +version = "2.0.1" +description = "Safely add untrusted strings to HTML/XML markup." +category = "dev" optional = false python-versions = ">=3.6" -version = "2.0.1" [[package]] -category = "dev" -description = "McCabe checker, plugin for flake8" name = "mccabe" +version = "0.6.1" +description = "McCabe checker, plugin for flake8" +category = "dev" optional = false python-versions = "*" -version = "0.6.1" [[package]] -category = "dev" -description = "More routines for operating on iterables, beyond itertools" name = "more-itertools" +version = "8.8.0" +description = "More routines for operating on iterables, beyond itertools" +category = "dev" optional = false python-versions = ">=3.5" -version = "8.8.0" [[package]] -category = "main" -description = "Python package for creating and manipulating graphs and networks" name = "networkx" +version = "2.3" +description = "Python package for creating and manipulating graphs and networks" +category = "main" optional = false python-versions = ">=3.5" -version = "2.3" [package.dependencies] decorator = ">=4.3.0" @@ -283,94 +314,94 @@ pyyaml = ["pyyaml"] scipy = ["scipy"] [[package]] -category = "dev" -description = "Core utilities for Python packages" name = "packaging" +version = "21.0" +description = "Core utilities for Python packages" +category = "dev" optional = false python-versions = ">=3.6" -version = "21.0" [package.dependencies] pyparsing = ">=2.0.2" [[package]] -category = "dev" -description = "plugin and hook calling mechanisms for python" name = "pluggy" +version = "0.13.1" +description = "plugin and hook calling mechanisms for python" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "0.13.1" [package.extras] dev = ["pre-commit", "tox"] [[package]] -category = "dev" -description = "library with cross-python path, ini-parsing, io, code, log facilities" name = "py" +version = "1.10.0" +description = "library with cross-python path, ini-parsing, io, code, log facilities" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "1.10.0" [[package]] -category = "dev" -description = "Python style guide checker" name = "pycodestyle" +version = "2.7.0" +description = "Python style guide checker" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "2.7.0" [[package]] -category = "dev" -description = "passive checker of Python programs" name = "pyflakes" +version = "2.3.1" +description = "passive checker of Python programs" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "2.3.1" [[package]] -category = "dev" -description = "Pygments is a syntax highlighting package written in Python." name = "pygments" +version = "2.9.0" +description = "Pygments is a syntax highlighting package written in Python." +category = "dev" optional = false python-versions = ">=3.5" -version = "2.9.0" [[package]] -category = "dev" -description = "python code static checker" name = "pylint" +version = "2.5.2" +description = "python code static checker" +category = "dev" optional = false python-versions = ">=3.5.*" -version = "2.5.2" [package.dependencies] astroid = ">=2.4.0,<=2.5" -colorama = "*" +colorama = {version = "*", markers = "sys_platform == \"win32\""} isort = ">=4.2.5,<5" mccabe = ">=0.6,<0.7" toml = ">=0.7.1" [[package]] -category = "dev" -description = "Python parsing module" name = "pyparsing" +version = "2.4.7" +description = "Python parsing module" +category = "dev" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -version = "2.4.7" [[package]] -category = "dev" -description = "pytest: simple powerful testing with Python" name = "pytest" +version = "5.3.5" +description = "pytest: simple powerful testing with Python" +category = "dev" optional = false python-versions = ">=3.5" -version = "5.3.5" [package.dependencies] -atomicwrites = ">=1.0" +atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} attrs = ">=17.4.0" -colorama = "*" +colorama = {version = "*", markers = "sys_platform == \"win32\""} more-itertools = ">=4.0.0" packaging = "*" pluggy = ">=0.12,<1.0" @@ -378,117 +409,111 @@ py = ">=1.5.0" wcwidth = "*" [package.extras] -checkqa-mypy = ["mypy (v0.761)"] +checkqa-mypy = ["mypy (==v0.761)"] testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] [[package]] -category = "dev" -description = "Extensions to the standard Python datetime module" name = "python-dateutil" +version = "2.8.2" +description = "Extensions to the standard Python datetime module" +category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" -version = "2.8.2" [package.dependencies] six = ">=1.5" [[package]] -category = "dev" -description = "World timezone definitions, modern and historical" name = "pytz" +version = "2021.1" +description = "World timezone definitions, modern and historical" +category = "dev" optional = false python-versions = "*" -version = "2021.1" [[package]] -category = "dev" -description = "Python HTTP for Humans." name = "requests" +version = "2.26.0" +description = "Python HTTP for Humans." +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" -version = "2.26.0" [package.dependencies] certifi = ">=2017.4.17" +charset-normalizer = {version = ">=2.0.0,<2.1.0", markers = "python_version >= \"3\""} +idna = {version = ">=2.5,<4", markers = "python_version >= \"3\""} urllib3 = ">=1.21.1,<1.27" -[package.dependencies.charset-normalizer] -python = ">=3" -version = ">=2.0.0,<2.1.0" - -[package.dependencies.idna] -python = ">=3" -version = ">=2.5,<4" - [package.extras] -socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"] +socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"] use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"] [[package]] -category = "dev" -description = "a python refactoring library..." name = "rope" +version = "0.17.0" +description = "a python refactoring library..." +category = "dev" optional = false python-versions = "*" -version = "0.17.0" [package.extras] dev = ["pytest"] [[package]] -category = "main" -description = "Reactive Extensions (Rx) for Python" name = "rx" +version = "1.6.0" +description = "Reactive Extensions (Rx) for Python" +category = "dev" optional = false python-versions = "*" -version = "1.6.0" [[package]] -category = "dev" -description = "An Amazon S3 Transfer Manager" name = "s3transfer" +version = "0.5.0" +description = "An Amazon S3 Transfer Manager" +category = "dev" optional = false python-versions = ">= 3.6" -version = "0.5.0" [package.dependencies] botocore = ">=1.12.36,<2.0a.0" [package.extras] -crt = ["botocore (>=1.20.29,<2.0a.0)"] +crt = ["botocore[crt] (>=1.20.29,<2.0a.0)"] [[package]] -category = "main" -description = "Python 2 and 3 compatibility utilities" name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" -version = "1.16.0" [[package]] -category = "dev" -description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms." name = "snowballstemmer" +version = "2.1.0" +description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms." +category = "dev" optional = false python-versions = "*" -version = "2.1.0" [[package]] -category = "dev" -description = "Python documentation generator" name = "sphinx" +version = "1.5.2" +description = "Python documentation generator" +category = "dev" optional = false python-versions = "*" -version = "1.5.2" [package.dependencies] -Jinja2 = ">=2.3" -Pygments = ">=2.0" alabaster = ">=0.7,<0.8" babel = ">=1.3,<2.0 || >2.0" -colorama = ">=0.3.5" +colorama = {version = ">=0.3.5", markers = "sys_platform == \"win32\""} docutils = ">=0.11" imagesize = "*" +Jinja2 = ">=2.3" +Pygments = ">=2.0" requests = ">=2.4.0" six = ">=1.5" snowballstemmer = ">=1.1" @@ -498,54 +523,54 @@ test = ["html5lib", "mock", "nose", "simplejson"] websupport = ["sqlalchemy (>=0.9)", "whoosh (>=2.0)"] [[package]] -category = "dev" -description = "Python Library for Tom's Obvious, Minimal Language" name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +category = "dev" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -version = "0.10.2" [[package]] -category = "main" -description = "Type Hints for Python" name = "typing" +version = "3.7.4.3" +description = "Type Hints for Python" +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "3.7.4.3" [[package]] -category = "dev" -description = "HTTP library with thread-safe connection pooling, file post, and more." name = "urllib3" +version = "1.26.6" +description = "HTTP library with thread-safe connection pooling, file post, and more." +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" -version = "1.26.6" [package.extras] brotli = ["brotlipy (>=0.6.0)"] secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] -socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"] +socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] [[package]] -category = "dev" -description = "Measures the displayed width of unicode strings in a terminal" name = "wcwidth" +version = "0.2.5" +description = "Measures the displayed width of unicode strings in a terminal" +category = "dev" optional = false python-versions = "*" -version = "0.2.5" [[package]] -category = "dev" -description = "Module for decorators, wrappers and monkey patching." name = "wrapt" +version = "1.12.1" +description = "Module for decorators, wrappers and monkey patching." +category = "dev" optional = false python-versions = "*" -version = "1.12.1" [metadata] -content-hash = "4f571cc2c1073dbb87c1bdbc775f874b37559447d79c115a8fcb2a8a50eac143" -lock-version = "1.0" +lock-version = "1.1" python-versions = "^3.8.5" +content-hash = "b01127cd29f041b7c3fd9742eee67c274015de7ca46d1ac59575427582bf0b16" [metadata.files] alabaster = [ @@ -576,12 +601,12 @@ babel = [ {file = "Babel-2.9.1.tar.gz", hash = "sha256:bc0c176f9f6a994582230df350aa6e05ba2ebe4b3ac317eab29d9be5d2768da0"}, ] boto3 = [ - {file = "boto3-1.18.11-py3-none-any.whl", hash = "sha256:4c1638a31da2948180bf66fac2971e0350b6b04c1b90910cd15247c77209ccaf"}, - {file = "boto3-1.18.11.tar.gz", hash = "sha256:ca675c724fa0fe05e992a7146cc5e1a3b3262c4323c83c7a8fcc69f9e5e47f8b"}, + {file = "boto3-1.18.12-py3-none-any.whl", hash = "sha256:e5abbb2b5ebe5ad1157a3af8f28c5c944e9c6eff0dd3e778008894e018bc7e09"}, + {file = "boto3-1.18.12.tar.gz", hash = "sha256:596fb9df00a816780db8620d9f62982eb783b3eb63a75947e172101d0785e6aa"}, ] botocore = [ - {file = "botocore-1.21.11-py3-none-any.whl", hash = "sha256:601f820ed340a85ed62d91b4eaeb768b9ff0529add75a074592fb7c51db7bd00"}, - {file = "botocore-1.21.11.tar.gz", hash = "sha256:b5e9128a259fc0fe5a8c2b717f5d7e8a1321321981b5d5679939e12d4142c0f3"}, + {file = "botocore-1.21.12-py3-none-any.whl", hash = "sha256:7b205f96bf0e2e1017301339e4fba9fd6dfdf54680196eb43e60e60581d7d5cb"}, + {file = "botocore-1.21.12.tar.gz", hash = "sha256:8710d03b9de3e3d94ed410f3e83809ca02050b091100d68c22ff7bf986f29fb6"}, ] certifi = [ {file = "certifi-2021.5.30-py2.py3-none-any.whl", hash = "sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8"}, @@ -598,10 +623,71 @@ colorama = [ conversion = [ {file = "conversion-0.0.7.tar.gz", hash = "sha256:4d6840e684912a7e9e96d67498842d65dd32fe2d8a3f4051bab892bc51214a2b"}, ] +coverage = [ + {file = "coverage-5.5-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:b6d534e4b2ab35c9f93f46229363e17f63c53ad01330df9f2d6bd1187e5eaacf"}, + {file = "coverage-5.5-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:b7895207b4c843c76a25ab8c1e866261bcfe27bfaa20c192de5190121770672b"}, + {file = "coverage-5.5-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:c2723d347ab06e7ddad1a58b2a821218239249a9e4365eaff6649d31180c1669"}, + {file = "coverage-5.5-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:900fbf7759501bc7807fd6638c947d7a831fc9fdf742dc10f02956ff7220fa90"}, + {file = "coverage-5.5-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:004d1880bed2d97151facef49f08e255a20ceb6f9432df75f4eef018fdd5a78c"}, + {file = "coverage-5.5-cp27-cp27m-win32.whl", hash = "sha256:06191eb60f8d8a5bc046f3799f8a07a2d7aefb9504b0209aff0b47298333302a"}, + {file = "coverage-5.5-cp27-cp27m-win_amd64.whl", hash = "sha256:7501140f755b725495941b43347ba8a2777407fc7f250d4f5a7d2a1050ba8e82"}, + {file = "coverage-5.5-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:372da284cfd642d8e08ef606917846fa2ee350f64994bebfbd3afb0040436905"}, + {file = "coverage-5.5-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:8963a499849a1fc54b35b1c9f162f4108017b2e6db2c46c1bed93a72262ed083"}, + {file = "coverage-5.5-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:869a64f53488f40fa5b5b9dcb9e9b2962a66a87dab37790f3fcfb5144b996ef5"}, + {file = "coverage-5.5-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:4a7697d8cb0f27399b0e393c0b90f0f1e40c82023ea4d45d22bce7032a5d7b81"}, + {file = "coverage-5.5-cp310-cp310-macosx_10_14_x86_64.whl", hash = "sha256:8d0a0725ad7c1a0bcd8d1b437e191107d457e2ec1084b9f190630a4fb1af78e6"}, + {file = "coverage-5.5-cp310-cp310-manylinux1_x86_64.whl", hash = "sha256:51cb9476a3987c8967ebab3f0fe144819781fca264f57f89760037a2ea191cb0"}, + {file = "coverage-5.5-cp310-cp310-win_amd64.whl", hash = "sha256:c0891a6a97b09c1f3e073a890514d5012eb256845c451bd48f7968ef939bf4ae"}, + {file = "coverage-5.5-cp35-cp35m-macosx_10_9_x86_64.whl", hash = "sha256:3487286bc29a5aa4b93a072e9592f22254291ce96a9fbc5251f566b6b7343cdb"}, + {file = "coverage-5.5-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:deee1077aae10d8fa88cb02c845cfba9b62c55e1183f52f6ae6a2df6a2187160"}, + {file = "coverage-5.5-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:f11642dddbb0253cc8853254301b51390ba0081750a8ac03f20ea8103f0c56b6"}, + {file = "coverage-5.5-cp35-cp35m-manylinux2010_i686.whl", hash = "sha256:6c90e11318f0d3c436a42409f2749ee1a115cd8b067d7f14c148f1ce5574d701"}, + {file = "coverage-5.5-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:30c77c1dc9f253283e34c27935fded5015f7d1abe83bc7821680ac444eaf7793"}, + {file = "coverage-5.5-cp35-cp35m-win32.whl", hash = "sha256:9a1ef3b66e38ef8618ce5fdc7bea3d9f45f3624e2a66295eea5e57966c85909e"}, + {file = "coverage-5.5-cp35-cp35m-win_amd64.whl", hash = "sha256:972c85d205b51e30e59525694670de6a8a89691186012535f9d7dbaa230e42c3"}, + {file = "coverage-5.5-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:af0e781009aaf59e25c5a678122391cb0f345ac0ec272c7961dc5455e1c40066"}, + {file = "coverage-5.5-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:74d881fc777ebb11c63736622b60cb9e4aee5cace591ce274fb69e582a12a61a"}, + {file = "coverage-5.5-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:92b017ce34b68a7d67bd6d117e6d443a9bf63a2ecf8567bb3d8c6c7bc5014465"}, + {file = "coverage-5.5-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:d636598c8305e1f90b439dbf4f66437de4a5e3c31fdf47ad29542478c8508bbb"}, + {file = "coverage-5.5-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:41179b8a845742d1eb60449bdb2992196e211341818565abded11cfa90efb821"}, + {file = "coverage-5.5-cp36-cp36m-win32.whl", hash = "sha256:040af6c32813fa3eae5305d53f18875bedd079960822ef8ec067a66dd8afcd45"}, + {file = "coverage-5.5-cp36-cp36m-win_amd64.whl", hash = "sha256:5fec2d43a2cc6965edc0bb9e83e1e4b557f76f843a77a2496cbe719583ce8184"}, + {file = "coverage-5.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:18ba8bbede96a2c3dde7b868de9dcbd55670690af0988713f0603f037848418a"}, + {file = "coverage-5.5-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:2910f4d36a6a9b4214bb7038d537f015346f413a975d57ca6b43bf23d6563b53"}, + {file = "coverage-5.5-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:f0b278ce10936db1a37e6954e15a3730bea96a0997c26d7fee88e6c396c2086d"}, + {file = "coverage-5.5-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:796c9c3c79747146ebd278dbe1e5c5c05dd6b10cc3bcb8389dfdf844f3ead638"}, + {file = "coverage-5.5-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:53194af30d5bad77fcba80e23a1441c71abfb3e01192034f8246e0d8f99528f3"}, + {file = "coverage-5.5-cp37-cp37m-win32.whl", hash = "sha256:184a47bbe0aa6400ed2d41d8e9ed868b8205046518c52464fde713ea06e3a74a"}, + {file = "coverage-5.5-cp37-cp37m-win_amd64.whl", hash = "sha256:2949cad1c5208b8298d5686d5a85b66aae46d73eec2c3e08c817dd3513e5848a"}, + {file = "coverage-5.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:217658ec7187497e3f3ebd901afdca1af062b42cfe3e0dafea4cced3983739f6"}, + {file = "coverage-5.5-cp38-cp38-manylinux1_i686.whl", hash = "sha256:1aa846f56c3d49205c952d8318e76ccc2ae23303351d9270ab220004c580cfe2"}, + {file = "coverage-5.5-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:24d4a7de75446be83244eabbff746d66b9240ae020ced65d060815fac3423759"}, + {file = "coverage-5.5-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:d1f8bf7b90ba55699b3a5e44930e93ff0189aa27186e96071fac7dd0d06a1873"}, + {file = "coverage-5.5-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:970284a88b99673ccb2e4e334cfb38a10aab7cd44f7457564d11898a74b62d0a"}, + {file = "coverage-5.5-cp38-cp38-win32.whl", hash = "sha256:01d84219b5cdbfc8122223b39a954820929497a1cb1422824bb86b07b74594b6"}, + {file = "coverage-5.5-cp38-cp38-win_amd64.whl", hash = "sha256:2e0d881ad471768bf6e6c2bf905d183543f10098e3b3640fc029509530091502"}, + {file = "coverage-5.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d1f9ce122f83b2305592c11d64f181b87153fc2c2bbd3bb4a3dde8303cfb1a6b"}, + {file = "coverage-5.5-cp39-cp39-manylinux1_i686.whl", hash = "sha256:13c4ee887eca0f4c5a247b75398d4114c37882658300e153113dafb1d76de529"}, + {file = "coverage-5.5-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:52596d3d0e8bdf3af43db3e9ba8dcdaac724ba7b5ca3f6358529d56f7a166f8b"}, + {file = "coverage-5.5-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:2cafbbb3af0733db200c9b5f798d18953b1a304d3f86a938367de1567f4b5bff"}, + {file = "coverage-5.5-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:44d654437b8ddd9eee7d1eaee28b7219bec228520ff809af170488fd2fed3e2b"}, + {file = "coverage-5.5-cp39-cp39-win32.whl", hash = "sha256:d314ed732c25d29775e84a960c3c60808b682c08d86602ec2c3008e1202e3bb6"}, + {file = "coverage-5.5-cp39-cp39-win_amd64.whl", hash = "sha256:13034c4409db851670bc9acd836243aeee299949bd5673e11844befcb0149f03"}, + {file = "coverage-5.5-pp36-none-any.whl", hash = "sha256:f030f8873312a16414c0d8e1a1ddff2d3235655a2174e3648b4fa66b3f2f1079"}, + {file = "coverage-5.5-pp37-none-any.whl", hash = "sha256:2a3859cb82dcbda1cfd3e6f71c27081d18aa251d20a17d87d26d4cd216fb0af4"}, + {file = "coverage-5.5.tar.gz", hash = "sha256:ebe78fe9a0e874362175b02371bdfbee64d8edc42a044253ddf4ee7d3c15212c"}, +] +coveralls = [ + {file = "coveralls-3.2.0-py2.py3-none-any.whl", hash = "sha256:aedfcc5296b788ebaf8ace8029376e5f102f67c53d1373f2e821515c15b36527"}, + {file = "coveralls-3.2.0.tar.gz", hash = "sha256:15a987d9df877fff44cd81948c5806ffb6eafb757b3443f737888358e96156ee"}, +] decorator = [ {file = "decorator-5.0.9-py3-none-any.whl", hash = "sha256:6e5c199c16f7a9f0e3a61a4a54b3d27e7dad0dbdde92b944426cb20914376323"}, {file = "decorator-5.0.9.tar.gz", hash = "sha256:72ecfba4320a893c53f9706bebb2d55c270c1e51a28789361aa93e4a21319ed5"}, ] +docopt = [ + {file = "docopt-0.6.2.tar.gz", hash = "sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491"}, +] docutils = [ {file = "docutils-0.13.1-py2-none-any.whl", hash = "sha256:de454f1015958450b72641165c08afe7023cd7e3944396448f2fb1b0ccba9d77"}, {file = "docutils-0.13.1-py3-none-any.whl", hash = "sha256:cb3ebcb09242804f84bdbf0b26504077a054da6772c6f4d625f335cc53ebf94d"}, From 1e3be6004be8a7e57530dd343f84d3dbd5d4e9da Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 16:16:11 +0200 Subject: [PATCH 06/25] no need to upgrade the python version here --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5104506..38159fe 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,9 @@ VERSION=$(shell poetry version|cut -d" " -f2) SHELL=/bin/bash -PYTHON_VERSION=3.8.10 +# the python version must be inline with: +# * poetry, travis, docker +PYTHON_VERSION=3.8.5 PYTHON_MINOR_VERSION=3.8 all: venv install-in-venv test From c02c94e6a331681ebc4ac03fcfa40fd243589789 Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 16:27:34 +0200 Subject: [PATCH 07/25] improved dev interactive loop (pyenv first try to pyenv local the correct version if fails it install from scratch --- Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 38159fe..ee7f421 100644 --- a/Makefile +++ b/Makefile @@ -26,11 +26,15 @@ ifeq ($(shell which pyenv), "pyenv not found") curl https://pyenv.run | bash endif ifneq ($(shell python --version|cut -d" " -f2), ${PYTHON_VERSION}) + @echo "Local python version must be ${PYTHON_VERSION}" + pyenv local ${PYTHON_MINOR_VERSION} +endif +ifeq ($(?), 1) @echo "Installing Python version ${PYTHON_VERSION}" pyenv install ${PYTHON_VERSION} -endif - pyenv local ${PYTHON_VERSION} + pyenv local ${PYTHON_MINOR_VERSION} pip install poetry virtualenv +endif patch: poetry version patch @@ -66,7 +70,10 @@ venv: req poetry install install: - python setup.py install + poetry run python setup.py install + +lint: format + poetry run flake8 goap/ format: venv autopep8 --in-place --aggressive --aggressive --aggressive --recursive goap/ From 3e036bc3d3dd3091646a45ea61b996f9adb7f346 Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 17:04:03 +0200 Subject: [PATCH 08/25] fixed codacy reported issue: builtin __name__ redefined --- goap/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/goap/__init__.py b/goap/__init__.py index 1437cec..e477e68 100644 --- a/goap/__init__.py +++ b/goap/__init__.py @@ -6,7 +6,6 @@ from goap import Errors name = 'goap' -__name__ = 'goap' __version__ = '0.3.0' __all__ = [ 'Action', @@ -18,6 +17,5 @@ 'Sensors', 'WorldState', 'name', - '__name__', '__version__', ] From 7922d21f09447aecfebdf6def49b01bc78869eb5 Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 17:04:16 +0200 Subject: [PATCH 09/25] improved dev workflow --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ee7f421..c735e17 100644 --- a/Makefile +++ b/Makefile @@ -26,15 +26,16 @@ ifeq ($(shell which pyenv), "pyenv not found") curl https://pyenv.run | bash endif ifneq ($(shell python --version|cut -d" " -f2), ${PYTHON_VERSION}) +ifeq ("v$(shell pyenv versions|grep ${PYTHON_VERSION}|cut -d' ' -f2)", "v${PYTHON_VERSION}") @echo "Local python version must be ${PYTHON_VERSION}" - pyenv local ${PYTHON_MINOR_VERSION} -endif -ifeq ($(?), 1) - @echo "Installing Python version ${PYTHON_VERSION}" + pyenv local ${PYTHON_VERSION} +else + @echo "Python ${PYTHON_VERSION} not in local pyenv versions. Installing python ${PYTHON_VERSION}" pyenv install ${PYTHON_VERSION} - pyenv local ${PYTHON_MINOR_VERSION} + pyenv local ${PYTHON_VERSION} pip install poetry virtualenv endif +endif patch: poetry version patch From c69495ad028d344d975dff6ee5980dee5f9dd4e9 Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 17:11:47 +0200 Subject: [PATCH 10/25] fixed the version recognition while checking the local pyenv installed versionos --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c735e17..6ee7caa 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ ifeq ($(shell which pyenv), "pyenv not found") curl https://pyenv.run | bash endif ifneq ($(shell python --version|cut -d" " -f2), ${PYTHON_VERSION}) -ifeq ("v$(shell pyenv versions|grep ${PYTHON_VERSION}|cut -d' ' -f2)", "v${PYTHON_VERSION}") +ifeq ("v$(shell pyenv versions|grep ${PYTHON_VERSION}|sed 's/^[[:space:]]*//g')", "v${PYTHON_VERSION}") @echo "Local python version must be ${PYTHON_VERSION}" pyenv local ${PYTHON_VERSION} else From fce06e08f09da9c4ba1ee222efa9b0bcb6a903b6 Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 17:34:54 +0200 Subject: [PATCH 11/25] added utils submodule --- goap/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/goap/__init__.py b/goap/__init__.py index e477e68..690a7fb 100644 --- a/goap/__init__.py +++ b/goap/__init__.py @@ -4,6 +4,7 @@ from goap import WorldState from goap.Planner import Planner from goap import Errors +from goap import utils name = 'goap' __version__ = '0.3.0' @@ -16,6 +17,7 @@ 'Sensor', 'Sensors', 'WorldState', + 'utils', 'name', '__version__', ] From c91c212f1a818bd39b72904fbfc1c661f6c5e927 Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 17:35:29 +0200 Subject: [PATCH 12/25] v0.3.0 release --- .release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.release b/.release index 0c62199..0d91a54 100644 --- a/.release +++ b/.release @@ -1 +1 @@ -0.2.1 +0.3.0 From f63e5565315f2638ba596aa355a4096ebc27db08 Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 22:30:40 +0200 Subject: [PATCH 13/25] add world state basic test, checking if the object has the same attributes as expected --- tests/WordState_test.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/WordState_test.py diff --git a/tests/WordState_test.py b/tests/WordState_test.py new file mode 100644 index 0000000..027b100 --- /dev/null +++ b/tests/WordState_test.py @@ -0,0 +1,15 @@ +from goap.WorldState import WorldState +import unittest + + +class WorldStateTest(unittest.TestCase): + def setUp(self): + self.world_state = WorldState({ + 'tmp_dir_state': 'not_exist', + 'tmp_dir_content': 'token_not_found'}) + + def test_world_state(self): + assert self.world_state == { + 'tmp_dir_state': 'not_exist', + 'tmp_dir_content': 'token_not_found' + } From 74b0e1a4047b3107d269e35a72af1a7718ec2ae1 Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 23:49:48 +0200 Subject: [PATCH 14/25] cleanup of empty actions.py module --- goap/utils/aws/actions.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 goap/utils/aws/actions.py diff --git a/goap/utils/aws/actions.py b/goap/utils/aws/actions.py deleted file mode 100644 index e69de29..0000000 From ffef4808018d1cf5be5f536700e26b1c2fd9ebbd Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Tue, 3 Aug 2021 23:50:42 +0200 Subject: [PATCH 15/25] removed utils/aws/sensors.py and moved the aws clients to todo.md it is just an idea of implemenatation. --- goap/utils/aws/{sensors.py => TODO.md} | 7 +++++++ 1 file changed, 7 insertions(+) rename goap/utils/aws/{sensors.py => TODO.md} (98%) diff --git a/goap/utils/aws/sensors.py b/goap/utils/aws/TODO.md similarity index 98% rename from goap/utils/aws/sensors.py rename to goap/utils/aws/TODO.md index 6a7d81e..4f86a55 100644 --- a/goap/utils/aws/sensors.py +++ b/goap/utils/aws/TODO.md @@ -1,3 +1,8 @@ +# TODO + +* create clients and tests + +```python import boto3 @@ -132,3 +137,5 @@ def __instances_with_old_ami(self): class AWSCheckOrphanEBS(EC2Client): pass + +``` From 4e9ef64d1de6468fc0a6e2296a5e3c4301e4d8fa Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Wed, 4 Aug 2021 00:00:34 +0200 Subject: [PATCH 16/25] markdown fix --- goap/utils/aws/TODO.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/goap/utils/aws/TODO.md b/goap/utils/aws/TODO.md index 4f86a55..9138231 100644 --- a/goap/utils/aws/TODO.md +++ b/goap/utils/aws/TODO.md @@ -1,6 +1,5 @@ # TODO - -* create clients and tests + * create clients and tests ```python import boto3 From 092e9d018a05af0df677cf056d4630a6112bb736 Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Wed, 4 Aug 2021 00:13:56 +0200 Subject: [PATCH 17/25] refactoring pre_conditions to conditions. --- .../directory_handler/directory_handler.py | 4 +-- examples/vuln_scanner/macos_vuln_scanner.py | 2 +- goap/Action.py | 19 +++++++++----- goap/Planner.py | 4 +-- tests/Action_test.py | 26 +++++++++---------- tests/Automaton_test.py | 4 +-- tests/Planner_test.py | 14 +++++----- 7 files changed, 40 insertions(+), 33 deletions(-) diff --git a/examples/directory_handler/directory_handler.py b/examples/directory_handler/directory_handler.py index 90e436c..8d63859 100644 --- a/examples/directory_handler/directory_handler.py +++ b/examples/directory_handler/directory_handler.py @@ -33,7 +33,7 @@ def setup_actions(): actions = Actions() actions.add( name='CreateTmpDir', - pre_conditions={ + conditions={ 'tmp_dir_state': 'not_exist', 'tmp_dir_content': 'token_not_found'}, effects={ @@ -42,7 +42,7 @@ def setup_actions(): func=mkdir) actions.add( name='CreateToken', - pre_conditions={ + conditions={ 'tmp_dir_state': 'exist', 'tmp_dir_content': 'token_not_found'}, effects={ diff --git a/examples/vuln_scanner/macos_vuln_scanner.py b/examples/vuln_scanner/macos_vuln_scanner.py index 74c7ec6..257aa38 100644 --- a/examples/vuln_scanner/macos_vuln_scanner.py +++ b/examples/vuln_scanner/macos_vuln_scanner.py @@ -56,7 +56,7 @@ def setup_actions() -> Actions: actions = Actions() actions.add( name="scan_http_hosts", - pre_conditions={}, + conditions={}, effects={}, func=scan_http_hosts, cost=0.2 diff --git a/goap/Action.py b/goap/Action.py index 51b5a04..25b931d 100644 --- a/goap/Action.py +++ b/goap/Action.py @@ -3,16 +3,23 @@ class Action: + """ The Action class defines the interface used by the planner + to convert the actions into graph node's edges + func: Callable, a function or callable object + name: Action name used as ID + conditions: + """ + def __init__( self, func: Callable, name: str, - pre_conditions: dict, + conditions: dict, effects: dict, cost: float = 0.1): self.func = func self.name = name - self.pre_conditions = pre_conditions + self.conditions = conditions self.effects = effects self.cost = cost self._response: Optional[ActionResponse] = None @@ -173,7 +180,7 @@ def get_by_pre_conditions( pre_conditions: dict) -> Optional[List[Action]]: result = [] for action in self.actions: - if action.pre_conditions == pre_conditions: + if action.conditions == pre_conditions: result.append(action) return result @@ -189,7 +196,7 @@ def get_by_effects( def add( self, name: str, - pre_conditions: dict, + conditions: dict, effects: dict, func: Callable, cost: float = 0.1): @@ -198,7 +205,7 @@ def add( f"The action name {name} is already in use" ) self.actions.append( - Action(func, name, pre_conditions, effects, cost) + Action(func, name, conditions, effects, cost) ) def remove(self, name: str): @@ -219,7 +226,7 @@ def run_all(self) -> list: def compare_actions(action1: Action, action2: Action) -> bool: result = False if ( - action1.pre_conditions == action2.pre_conditions + action1.conditions == action2.conditions and action1.effects == action2.effects ): diff --git a/goap/Planner.py b/goap/Planner.py index 5604713..609cc33 100644 --- a/goap/Planner.py +++ b/goap/Planner.py @@ -188,7 +188,7 @@ def __generate_states(self, actions: Actions, world_state: dict, goal: dict): self.states.add(Node(world_state)) self.states.add(Node(goal)) for action in actions: - pre = {**world_state, **action.pre_conditions} + pre = {**world_state, **action.conditions} eff = {**pre, **action.effects} self.states.add(Node(attributes=pre)) self.states.add(Node(attributes=eff)) @@ -196,7 +196,7 @@ def __generate_states(self, actions: Actions, world_state: dict, goal: dict): def __generate_transitions(self, actions, states): for action in actions: for state in states: - if action.pre_conditions.items() <= state.attributes.items(): + if action.conditions.items() <= state.attributes.items(): attr = {**state.attributes, **action.effects} suc = self.states.get(attr) self.transitions.add( diff --git a/tests/Action_test.py b/tests/Action_test.py index 37c872d..7a11ac3 100644 --- a/tests/Action_test.py +++ b/tests/Action_test.py @@ -16,7 +16,7 @@ def setUp(self): def test_add_action(self): self.actions.add( name='create_dir', - pre_conditions={'dir': False}, + conditions={'dir': False}, effects={'dir': True}, cost=0.1, func=ShellCommand('/bin/sh -c "ls -ltr /tmp/"') @@ -28,14 +28,14 @@ def test_add_multiple_actions(self): actions = [ Action( name='create_dir', - pre_conditions={'dir': False}, + conditions={'dir': False}, effects={'dir': True}, cost=0.1, func=ShellCommand('/bin/sh -c "ls -ltr /tmp/"') ), Action( name='create_vpc', - pre_conditions={'vpc_status': 'exist'}, + conditions={'vpc_status': 'exist'}, effects={'vpc_status': 'exist'}, cost=0.1, func=ShellCommand("/bin/sh -c 'echo create_vpc'") @@ -47,7 +47,7 @@ def test_add_multiple_actions(self): def test_remove_existing_action(self): self.actions.add( name='create_gcp', - pre_conditions={'gcp_account_status': 'exist'}, + conditions={'gcp_account_status': 'exist'}, effects={'gcp_account_status': 'exist'}, cost=0.1, func=ShellCommand("/bin/sh -c 'echo create_gcp_account'") @@ -62,14 +62,14 @@ def test_remove_non_existing_action(self): def test_get_by_precondition(self): self.actions.add( name='ls_call_home', - pre_conditions={'directories': 'None'}, + conditions={'directories': 'None'}, effects={'directories': 'some_dirs'}, cost=0.1, func=ShellCommand('ls $HOME') ) self.actions.add( name='create_vpc', - pre_conditions={'vpc_status': 'exist'}, + conditions={'vpc_status': 'exist'}, effects={'vpc_status': 'exist'}, cost=0.1, func=ShellCommand("/bin/sh -c 'echo create_vpc'") @@ -82,14 +82,14 @@ def test_get_by_precondition(self): def test_get_by_effects(self): self.actions.add( name='dummy', - pre_conditions={'dummy': 'None'}, + conditions={'dummy': 'None'}, effects={'dummy': 'some_dirs'}, cost=0.1, func=ShellCommand('ls $HOME') ) self.actions.add( name='dummy2', - pre_conditions={'vpc_status': 'exist'}, + conditions={'vpc_status': 'exist'}, effects={'vpc_status': 'exist'}, cost=0.1, func=ShellCommand("/bin/sh -c 'echo create") @@ -102,7 +102,7 @@ def test_get_by_effects(self): def test_unique_action_name(self): self.actions.add( name='create_gcp', - pre_conditions={'gcp_account_status': 'exist'}, + conditions={'gcp_account_status': 'exist'}, effects={'gcp_account_status': 'exist'}, cost=0.1, func=ShellCommand("/bin/sh -c 'echo create_gcp_account'") @@ -110,7 +110,7 @@ def test_unique_action_name(self): with self.assertRaises(ActionAlreadyInCollectionError): self.actions.add( name='create_gcp', - pre_conditions={'gcp_account_status': 'exist'}, + conditions={'gcp_account_status': 'exist'}, effects={'gcp_account_status': 'exist'}, cost=0.1, func=ShellCommand("/bin/sh -c 'echo create_gcp_account'") @@ -119,7 +119,7 @@ def test_unique_action_name(self): def test_fail_call_action(self): self.actions.add( name="failed", - pre_conditions={'state': 'none'}, + conditions={'state': 'none'}, effects={'state': 'done'}, cost=0.1, func=ShellCommand(command='exit 1') @@ -131,7 +131,7 @@ def test_fail_call_action(self): def test_call_action(self): self.actions.add( name="echo", - pre_conditions={'state': 'none'}, + conditions={'state': 'none'}, effects={'state': 'done'}, cost=0.1, func=self.echo @@ -144,7 +144,7 @@ def test_call_action(self): def test_run_all(self): self.actions.add( name="test_run_all", - pre_conditions={'state': 'none'}, + conditions={'state': 'none'}, effects={'state': 'done'}, cost=0.1, func=self.echo diff --git a/tests/Automaton_test.py b/tests/Automaton_test.py index 02dca80..4fdff40 100644 --- a/tests/Automaton_test.py +++ b/tests/Automaton_test.py @@ -43,7 +43,7 @@ def setupSensors(self): def setupActions(self): self.create_dir = Action( name='CreateDir', - pre_conditions={ + conditions={ 'tmp_dir_state': 'not_exist', 'tmp_dir_content': 'token_not_found'}, effects={ @@ -53,7 +53,7 @@ def setupActions(self): ) self.create_file_token = Action( name='CreateFileToken', - pre_conditions={ + conditions={ 'tmp_dir_state': 'exist', 'tmp_dir_content': 'token_not_found'}, effects={ diff --git a/tests/Planner_test.py b/tests/Planner_test.py index 078ba8e..1a7436b 100644 --- a/tests/Planner_test.py +++ b/tests/Planner_test.py @@ -52,13 +52,13 @@ def tearDown(self) -> None: def setUpDirHandlerCMD(self): self.dir_handler_cmd.add( name='CreateTmpDir', - pre_conditions={'tmp_dir_state': False, 'tmp_dir_content': False}, + conditions={'tmp_dir_state': False, 'tmp_dir_content': False}, effects={'tmp_dir_state': True, 'tmp_dir_content': False}, func=self.mkdir ) self.dir_handler_cmd.add( name='CreateToken', - pre_conditions={'tmp_dir_state': True, 'tmp_dir_content': False}, + conditions={'tmp_dir_state': True, 'tmp_dir_content': False}, effects={'tmp_dir_state': True, 'tmp_dir_content': True}, func=self.mktoken ) @@ -66,7 +66,7 @@ def setUpDirHandlerCMD(self): def setUpLvmCMD(self): self.lv_act.add( name='ExpandLV', - pre_conditions={ + conditions={ 'lv_need_expansion': True, 'vg_need_expansion': False, }, @@ -78,7 +78,7 @@ def setUpLvmCMD(self): ) self.lv_act.add( name='ExpandVG', - pre_conditions={ + conditions={ 'vg_need_expansion': True, 'pv_need_expansion': False, }, @@ -89,7 +89,7 @@ def setUpLvmCMD(self): ) self.lv_act.add( name='ExpandPV', - pre_conditions={ + conditions={ 'pv_need_expansion': True, }, effects={ @@ -110,13 +110,13 @@ def test_graph_isomorphic(self): acts = Actions() acts.add( name='CreateTmpDirIso', - pre_conditions={'tmp_dir_state': False, 'tmp_dir_content': False}, + conditions={'tmp_dir_state': False, 'tmp_dir_content': False}, effects={'tmp_dir_state': True, 'tmp_dir_content': False}, func=self.mkdir ) acts.add( name='CreateTokenIso', - pre_conditions={'tmp_dir_state': True, 'tmp_dir_content': False}, + conditions={'tmp_dir_state': True, 'tmp_dir_content': False}, effects={'tmp_dir_state': True, 'tmp_dir_content': True}, func=self.mktoken ) From 45c453958a2e3a783ca6896ce2ac1de188cc289a Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Wed, 4 Aug 2021 13:21:44 +0200 Subject: [PATCH 18/25] markdown lint and doc improvement --- goap/Action.py | 4 +++- goap/utils/aws/TODO.md | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/goap/Action.py b/goap/Action.py index 25b931d..5f9701b 100644 --- a/goap/Action.py +++ b/goap/Action.py @@ -7,7 +7,9 @@ class Action: to convert the actions into graph node's edges func: Callable, a function or callable object name: Action name used as ID - conditions: + conditions: the world state condition required for + this action to be executed + effect: what is the expected world state after the action execution """ def __init__( diff --git a/goap/utils/aws/TODO.md b/goap/utils/aws/TODO.md index 9138231..4f86a55 100644 --- a/goap/utils/aws/TODO.md +++ b/goap/utils/aws/TODO.md @@ -1,5 +1,6 @@ # TODO - * create clients and tests + +* create clients and tests ```python import boto3 From 8ec35f127caa23c0bb9fb7915a93b0dda668f6a1 Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Wed, 4 Aug 2021 13:47:35 +0200 Subject: [PATCH 19/25] cleanup --- goap/utils/aws/TODO.md | 141 ----------------------------------------- 1 file changed, 141 deletions(-) delete mode 100644 goap/utils/aws/TODO.md diff --git a/goap/utils/aws/TODO.md b/goap/utils/aws/TODO.md deleted file mode 100644 index 4f86a55..0000000 --- a/goap/utils/aws/TODO.md +++ /dev/null @@ -1,141 +0,0 @@ -# TODO - -* create clients and tests - -```python -import boto3 - - -class AWSClient: - def __init__(self, client: str, filters: list = [], tag: dict = {}): - self.filters = filters - self.tag = tag - self.client = boto3.client(client) - if self.tag != {}: - self.filters = self.__dict_into_filter(tag) - - @staticmethod - def __dict_into_filter(tag: dict): - """ - - :param tag: Key / Value pair dict type - :return: An AWS Filter format [{'Name': filter-name, 'Values': [val1, val2, ...]] - """ - key = 'tag:{key}'.format(key=[*tag.keys()].pop()) - val = [*tag.values()].pop() - return [{'Name': key, 'Values': [val]}] - - def __get_item(self, key): - pass - - def exec(self): - pass - - -class EC2Client(AWSClient): - - def __init__(self): - super().__init__(client='ec2') - - def __desc(self): - try: - response = self.client.describe_instances(Filters=self.filters) - return response - except IOError as e: - raise IOError(f'{e}') - - def __get_item(self, key): - vpcs = self.__desc() - return [vpc[key] for vpc in vpcs].pop() - - def exec(self): - pass - - -class VPCClient(AWSClient): - - def __init__(self): - super().__init__(client='ec2') - - def __desc(self): - """ describe vpcs - - :return: AWS API Response - :rtype: json - """ - try: - response = self.client.describe_vpcs(Filters=self.filters) - return response - except IOError as e: - raise('{}'.format(e)) - - def __get_item(self, key): - vpcs = self.__desc() - return [vpc[key] for vpc in vpcs].pop() - - def exec(self): - pass - - -class AWSCheckVPCUnique(VPCClient): - - def is_unique(self): - vpcs = self.__desc() - if len(vpcs) >= 2: - return False - else: - return True - - def exec(self): - return self.is_unique() - - -class AWSCheckVPCStatus(VPCClient): - - def status(self): - return self.__get_item(key='State') - - def exec(self): - return self.status() - - -class AWSCheckVPCIsDefault(VPCClient): - - def is_default(self): - return self.__get_item(key='IsDefault') - - def exec(self): - return self.is_default() - - -class AWSCheckInstancesCapacity(EC2Client): - - def __instances_cpu_utilization(self, instance_id: str): - pass - - def exec(self): - pass - - -class AWSCheckLatestProjectAMI(EC2Client): - - def __last_project_ami(self, version): - pass - - def exec(self): - pass - - -class AWSCheckInstancesWithOldAMI(EC2Client): - - def __instances_with_old_ami(self): - """ - - :return: list of instances ids with AMI with an old version - """ - - -class AWSCheckOrphanEBS(EC2Client): - pass - -``` From dbd4adecb29b4b059087480a7b80ffc91abfacf2 Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Wed, 4 Aug 2021 16:45:03 +0200 Subject: [PATCH 20/25] refactor on another function making reference to pre_conditions --- goap/Action.py | 6 +++--- tests/Action_test.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/goap/Action.py b/goap/Action.py index 5f9701b..8a3cdce 100644 --- a/goap/Action.py +++ b/goap/Action.py @@ -177,12 +177,12 @@ def get(self, name: str) -> Optional[Action]: return result - def get_by_pre_conditions( + def get_by_conditions( self, - pre_conditions: dict) -> Optional[List[Action]]: + conditions: dict) -> Optional[List[Action]]: result = [] for action in self.actions: - if action.conditions == pre_conditions: + if action.conditions == conditions: result.append(action) return result diff --git a/tests/Action_test.py b/tests/Action_test.py index 7a11ac3..5c37c8f 100644 --- a/tests/Action_test.py +++ b/tests/Action_test.py @@ -74,8 +74,8 @@ def test_get_by_precondition(self): cost=0.1, func=ShellCommand("/bin/sh -c 'echo create_vpc'") ) - actions = self.actions.get_by_pre_conditions( - pre_conditions={'directories': 'None'} + actions = self.actions.get_by_conditions( + conditions={'directories': 'None'} ) assert len(actions) == 1 From 36ae42899666b7c92e9506876224548777e7712c Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Wed, 4 Aug 2021 16:57:10 +0200 Subject: [PATCH 21/25] reorg on targets and defaults --- Makefile | 81 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/Makefile b/Makefile index 6ee7caa..b1bfe3b 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,22 @@ .PHONY: all +# the python version must be inline with: +# * poetry, travis, docker +PYTHON_VERSION=3.8.5 +PYTHON_MINOR_VERSION=3.8 +# docker REGISTRY_HOST=docker.io USERNAME=$(USER) NAME=$(shell basename $(PWD)) - -BRANCH := $(shell git rev-parse --abbrev-ref HEAD) IMAGE=$(shell tr '[:upper:]' '[:lower:]' <<< $(NAME)) - +# +BRANCH := $(shell git rev-parse --abbrev-ref HEAD) VERSION=$(shell poetry version|cut -d" " -f2) - SHELL=/bin/bash -# the python version must be inline with: -# * poetry, travis, docker -PYTHON_VERSION=3.8.5 -PYTHON_MINOR_VERSION=3.8 - -all: venv install-in-venv test +all: test build -test: unittest test-coverage +test: format lint unittest test-coverage req: ifeq ($(shell which pyenv), "pyenv not found") @@ -37,6 +35,38 @@ else endif endif +venv: req + poetry install + +install: + poetry run python setup.py install + +format: venv + poetry run autopep8 --in-place --aggressive --aggressive --aggressive --recursive goap/ + +lint: format + poetry run flake8 goap/ + +install-in-venv: venv install + poetry run python setup.py install + +unittest: install-in-venv + @echo "Running unit tests" + poetry run pytest -v -s tests/ + +test-coverage: venv + poetry run coverage run --source=goap/ setup.py test + +build: + poetry build + +docker-build: + docker build -t goapy:$(shell poetry version|cut -d" " -f2) . + +.PHONY: version +version: + @poetry version|cut -d" " -f2 + patch: poetry version patch poetry version|cut -d" " -f2 > .release @@ -49,10 +79,6 @@ major: poetry version major poetry version|cut -d" " -f2 > .release -.PHONY: version -version: - @poetry version|cut -d" " -f2 - release-minor: minor tag tag: TAG=$(shell cat .release) @@ -67,31 +93,6 @@ tag: check-status check-status: test -n "$(git status -s .)" || (echo "ERROR: there are still outstanding changes" >&2 && exit 1) ; -venv: req - poetry install - -install: - poetry run python setup.py install - -lint: format - poetry run flake8 goap/ - -format: venv - autopep8 --in-place --aggressive --aggressive --aggressive --recursive goap/ - -install-in-venv: venv install - poetry run python setup.py install - -unittest: install-in-venv - @echo "Running unit tests" - poetry run pytest -v -s tests/ - -test-coverage: venv - poetry run coverage run --source=goap/ setup.py test - -docker-build: - docker build -t goapy:$(shell poetry version|cut -d" " -f2) . - clean-venv: rm -rf .venv/ From 91b60a396eab4a7b0a995d107c30a7b4d1825f8f Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Wed, 4 Aug 2021 17:21:33 +0200 Subject: [PATCH 22/25] added weight field on astar_path so it will be considered --- goap/Planner.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/goap/Planner.py b/goap/Planner.py index 609cc33..fd2b22e 100644 --- a/goap/Planner.py +++ b/goap/Planner.py @@ -141,7 +141,7 @@ def search_node(self, attr: dict = None): def path(self, src: dict, dst: dict): if not self.__is_dst(src, dst): - return nx.astar_path(self.directed, src, dst) + return nx.astar_path(self.directed, src, dst, weight='weight') def plot(self, file_path: str): try: @@ -213,12 +213,12 @@ def plan(self, state: dict, goal: dict) -> list: self.__generate_states(self.actions, self.world_state, self.goal) self.__generate_transitions(self.actions, self.states) self.graph = Graph(self.states, self.transitions) - ws_node = self.states.get(state) - gs_node = self.states.get(goal) + world_state_node = self.states.get(state) + goal_node = self.states.get(goal) plan = [] if state != goal: try: - path = self.graph.path(ws_node, gs_node) + path = self.graph.path(world_state_node, goal_node) except EnvironmentError as e: print(f"No possible path: {e}") From 4fe1763b9948dd29c9395c0e03336970f96fb447 Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Wed, 4 Aug 2021 17:21:40 +0200 Subject: [PATCH 23/25] cleanup --- goap/Action.py | 1 - 1 file changed, 1 deletion(-) diff --git a/goap/Action.py b/goap/Action.py index 8a3cdce..1e00b73 100644 --- a/goap/Action.py +++ b/goap/Action.py @@ -230,7 +230,6 @@ def compare_actions(action1: Action, action2: Action) -> bool: if ( action1.conditions == action2.conditions and action1.effects == action2.effects - ): result = True From 14e1603dd5209af52a2007d56940b24173aba0cf Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Sat, 2 Oct 2021 09:00:33 +0200 Subject: [PATCH 24/25] projet version in readme.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 81acd7f..fc3bf2d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # GOAPy [![Build Status](https://travis-ci.com/leopepe/GOApy.svg?branch=master)](https://travis-ci.com/leopepe/GOApy) [![Coverage Status](https://coveralls.io/repos/github/leopepe/GOApy/badge.svg?branch=master)](https://coveralls.io/github/leopepe/GOApy?branch=master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/41a49ddaaf54400d9dd3d08f7bb1852a)](https://www.codacy.com/manual/lpepefreitas/GOApy?utm_source=github.com&utm_medium=referral&utm_content=leopepe/GOApy&utm_campaign=Badge_Grade) [![PyPI version](https://badge.fury.io/py/Goap.svg)](https://badge.fury.io/py/Goap) [![Python Formater](https://github.com/leopepe/GOApy/actions/workflows/autopep8.yml/badge.svg?branch=master)](https://github.com/leopepe/GOApy/actions/workflows/autopep8.yml) -**Version**: 0.2.1 +**Version**: 0.3.0 ![GOAPy](docs/_static/rdaneelolivaw.jpg "Oh my god, it's full of stars!") From 127cc63716ee7e61c827502e1d4cf8bbaca3547a Mon Sep 17 00:00:00 2001 From: Leonardo Pepe Date: Sat, 2 Oct 2021 09:05:22 +0200 Subject: [PATCH 25/25] major, and patch makefile targets --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index b1bfe3b..9f340af 100644 --- a/Makefile +++ b/Makefile @@ -79,7 +79,9 @@ major: poetry version major poetry version|cut -d" " -f2 > .release +release-patch: paatch tag release-minor: minor tag +release-major: major tag tag: TAG=$(shell cat .release) tag: check-status