Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taking the latest of all. #120

Merged
merged 10 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .safety-policy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
security:
ignore-vulnerabilities:
70612:
reason: "This seems to refer to a broken vulnerability for every Jinja version."
49 changes: 25 additions & 24 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,33 @@ url = "https://pypi.org/simple"
verify_ssl = true

[packages]
lark = ">=1.1.5,<1.2.0"
click = ">=8.1.3,<9.0.0"

[dev-packages]
pytest = "<7.4.0,>=7.3.1"
pytest-cov = "<4.2.0,>=4.1.0"
pytest-randomly = "<3.13.0,>=3.12.0"
pytest-lazy-fixture = "<0.7.0,>=0.6.3"
tox = ">=4.4.12,<4.5.0"
ipython = ">=8.14.0,<8.15.0"
codecov = "<2.2.0,>=2.1.13"
black = "<23.4.0,>=23.3.0"
mypy = ">=1.3.0,<1.4.0"
flake8 = "<6.1.0,>=6.0.0"
flake8-docstrings = "<1.8.0,>=1.7.0"
mkdocs = ">=1.4.3,<1.5.0"
markdown-include = ">=0.8.1,<0.9.0"
isort = "<5.13.0,>=5.12.0"
mistune = ">=2.0.5,<2.1.0"
mkdocs-material = ">=9.1.15,<9.2.0"
types-click = "<7.2.0,>=7.1.8"
vulture = ">=2.7.0,<2.8.0"
flake8-bugbear = "<23.4.0,>=23.3.12"
pymdown-extensions = "<10.1.0,>=10.0.1"
flake8-isort = ">=6.0.0,<6.1.0"
safety = "<2.5.0,>=2.4.0b1"
bandit = "<1.8.0,>=1.7.5"
types-pytest-lazy-fixture = "<0.6.4.0,>=0.6.3.3"
pytest = "*"
pytest-cov = "*"
pytest-randomly = "*"
pytest-lazy-fixtures = "*"
tox = "*"
ipython = "*"
codecov = "*"
black = "*"
mypy = "*"
flake8 = "*"
flake8-docstrings = "*"
mkdocs = "*"
markdown-include = "*"
isort = "*"
mistune = "*"
mkdocs-material = "*"
types-click = "*"
vulture = "*"
flake8-bugbear = "*"
pymdown-extensions = "*"
flake8-isort = "*"
safety = "*"
bandit = "*"

[requires]
python_version = "3.10"
1,663 changes: 973 additions & 690 deletions Pipfile.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pddl/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ def __init__(
self._domain, self._domain_name = self._parse_domain_and_domain_name(
domain, domain_name
)
self._requirements: Optional[
AbstractSet[Requirements]
] = self._parse_requirements(domain, requirements)
self._requirements: Optional[AbstractSet[Requirements]] = (
self._parse_requirements(domain, requirements)
)
self._objects: AbstractSet[Constant] = ensure_set(objects)
self._init: AbstractSet[Formula] = ensure_set(init)
self._goal: Formula = ensure(goal, And())
Expand Down
2 changes: 1 addition & 1 deletion pddl/helpers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class RegexConstrainedString(str):

def __new__(cls, value, *args, **kwargs):
"""Instantiate a new object."""
if type(value) == cls:
if type(value) is cls:
return value
else:
inst = super(RegexConstrainedString, cls).__new__(cls, value)
Expand Down
8 changes: 5 additions & 3 deletions pddl/parser/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,11 @@ def atomic_formula_name(self, args):
else:
name = args[1]
terms = [
Constant(str(_term_name))
if self._objects_by_name.get(str(_term_name)) is None
else self._objects_by_name.get(str(_term_name))
(
Constant(str(_term_name))
if self._objects_by_name.get(str(_term_name)) is None
else self._objects_by_name.get(str(_term_name))
)
for _term_name in args[2:-1]
]
return Predicate(name, *terms)
Expand Down
14 changes: 7 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import mistune
import pytest
from pytest_lazyfixture import lazy_fixture
from pytest_lazy_fixtures import lf

import pddl
from pddl.parser.domain import DomainParser
Expand Down Expand Up @@ -111,14 +111,14 @@ def markdown_parser():
)

pddl_objects_domains = [
lazy_fixture("blocksworld_domain"), # type:ignore
lazy_fixture("triangle_tireworld_domain"), # type:ignore
lazy_fixture("blocksworld_fond_domain"), # type:ignore
lf("blocksworld_domain"), # type:ignore
lf("triangle_tireworld_domain"), # type:ignore
lf("blocksworld_fond_domain"), # type:ignore
]
pddl_objects_problems = [
lazy_fixture("blocksworld_fond_01"), # type:ignore
lazy_fixture("blocksworld_problem_01"), # type:ignore
lazy_fixture("triangle_tireworld_problem_01"), # type:ignore
lf("blocksworld_fond_01"), # type:ignore
lf("blocksworld_problem_01"), # type:ignore
lf("triangle_tireworld_problem_01"), # type:ignore
]

#################################################
Expand Down
7 changes: 4 additions & 3 deletions tests/test_docs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from typing import Dict, List, Optional

import mistune
import mistune.renderers
import pytest

MISTUNE_BLOCK_CODE_ID = "block_code"
Expand Down Expand Up @@ -55,7 +56,7 @@ def setup_class(cls):
if cls.MD_FILE is None:
raise ValueError("cannot set up method as MD_FILE is None")
content = cls.MD_FILE.read_text()
markdown_parser = mistune.create_markdown(renderer=mistune.AstRenderer())
markdown_parser = mistune.create_markdown(renderer="ast")
cls.blocks = markdown_parser(content)
cls.code_blocks = list(filter(cls.block_code_filter, cls.blocks))

Expand All @@ -78,7 +79,7 @@ def type_filter(type_: Optional[str], b: Dict) -> bool:
"""
if type_ is None:
return True
return b["info"].strip() == type_ if b["info"] is not None else False
return b["type"].strip() == type_ if b["type"] is not None else False

@classmethod
def extract_code_blocks(cls, filter_: Optional[str] = None):
Expand All @@ -105,7 +106,7 @@ def setup_class(cls):
@classmethod
def _python_selector(cls, block: Dict) -> bool:
return block["type"] == MISTUNE_BLOCK_CODE_ID and (
block["info"].strip() == "python" if block["info"] else False
block["type"].strip() == "python" if block["type"] else False
)

def _assert(self, locals_, *mocks):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_parser/test_parametrized.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pathlib import Path

import pytest
from pytest import lazy_fixture # type:ignore # noqa
from pytest_lazy_fixtures import lf as lazy_fixture # type:ignore # noqa

from pddl.core import Domain, Problem
from tests.conftest import (
Expand Down
54 changes: 27 additions & 27 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ labels =
setenv =
PYTHONPATH = {toxinidir}
deps =
pytest<7.4.0,>=7.3.1
pytest-cov>=4.1.0,<4.2.0
pytest-randomly>=3.12.0,<3.13.0
pytest-lazy-fixture<0.7.0,>=0.6.3
mistune>=2.0.5,<2.1.0
pytest
pytest-cov
pytest-randomly
pytest-lazy-fixtures
mistune

commands =
pytest --basetemp={envtmpdir} --doctest-modules \
Expand All @@ -29,76 +29,76 @@ commands =
[testenv:flake8]
skip_install = True
deps =
flake8<6.1.0,>=6.0.0
flake8-docstrings<1.8.0,>=1.7.0
flake8-bugbear>=23.3.12,<23.4.0
flake8-isort>=6.0.0,<6.1.0
flake8
flake8-docstrings
flake8-bugbear
flake8-isort
commands =
flake8 pddl tests

[testenv:mypy]
deps =
mypy>=1.3.0,<1.4.0
types-click>=7.1.8,<7.2.0
types-pytest-lazy-fixture>=0.6.3.3,<0.6.4.0
mypy
types-click
pytest-lazy-fixtures
commands =
mypy pddl tests

[testenv:black]
skip_install = True
deps = black<23.4.0,>=23.3.0
deps = black
commands = black pddl tests

[testenv:black-check]
skip_install = True
deps = black<23.4.0,>=23.3.0
deps = black
commands = black pddl tests --check --verbose

[testenv:isort]
skip_install = True
deps = isort<5.13.0,>=5.12.0
deps = isort
commands = isort pddl tests

[testenv:isort-check]
skip_install = True
deps = isort<5.13.0,>=5.12.0
deps = isort
commands = isort --check-only pddl tests

[testenv:bandit]
skipsdist = True
skip_install = True
deps = bandit>=1.7.5,<1.8.0
deps = bandit
commands = bandit --configfile .bandit.yml --recursive pddl tests scripts

[testenv:safety]
skipsdist = False
skip_install = False
deps = safety>=2.4.0b1,<2.5.0
deps = safety
commands = safety check

[testenv:vulture]
skipsdist = True
skip_install = True
deps = vulture>=2.7.0,<2.8.0
deps = vulture
commands = vulture pddl scripts/whitelist.py

[testenv:docs]
skip_install = True
deps =
mkdocs>=1.4.3,<1.5.0
mkdocs-material>=9.1.15,<9.2.0
markdown-include>=0.8.1,<0.9.0
pymdown-extensions>=10.0.1,<10.1.0
mkdocs
mkdocs-material
markdown-include
pymdown-extensions
commands =
mkdocs build --clean

[testenv:docs-serve]
skip_install = True
deps =
mkdocs>=1.4.3,<1.5.0
mkdocs-material>=9.1.15,<9.2.0
markdown-include>=0.8.1,<0.9.0
pymdown-extensions>=10.0.1,<10.1.0
mkdocs
mkdocs-material
markdown-include
pymdown-extensions
commands =
mkdocs build --clean
python -c 'print("###### Starting local server. Press Control+C to stop server ######")'
Expand Down
Loading