run poet pre to fix lint, and avoid updating flask and Flask-SQLAlchemy to squelch warnings

This commit is contained in:
burnettk 2022-10-05 20:50:33 -04:00
parent 510eec3f6a
commit 11f4fd3933
4 changed files with 48 additions and 47 deletions

35
poetry.lock generated
View File

@ -566,7 +566,7 @@ restructuredtext-lint = "*"
[[package]]
name = "Flask"
version = "2.2.2"
version = "2.1.3"
description = "A simple framework for building complex web applications."
category = "main"
optional = false
@ -577,7 +577,7 @@ click = ">=8.0"
importlib-metadata = {version = ">=3.6.0", markers = "python_version < \"3.10\""}
itsdangerous = ">=2.0"
Jinja2 = ">=3.0"
Werkzeug = ">=2.2.2"
Werkzeug = ">=2.0"
[package.extras]
async = ["asgiref (>=3.2)"]
@ -717,15 +717,15 @@ docs = ["sphinx"]
[[package]]
name = "flask-sqlalchemy"
version = "3.0.0"
description = "Add SQLAlchemy support to your Flask application."
version = "2.5.1"
description = "Adds SQLAlchemy support to your Flask application."
category = "main"
optional = false
python-versions = ">=3.7"
python-versions = ">= 2.7, != 3.0.*, != 3.1.*, != 3.2.*, != 3.3.*"
[package.dependencies]
Flask = ">=2.2"
SQLAlchemy = ">=1.4.18"
Flask = ">=0.10"
SQLAlchemy = ">=0.8.0"
[[package]]
name = "furo"
@ -2166,7 +2166,7 @@ testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>=
[metadata]
lock-version = "1.1"
python-versions = ">=3.9,<3.11"
content-hash = "1baed77013bb149fc8da553aa3826b872522d72b54bcf236f7d20e5366c20871"
content-hash = "f64a06b52db52800be7400b19d7ab7906a54d5b3ecc625dd2fc886e69ff775ac"
[metadata.files]
alabaster = [
@ -2412,8 +2412,8 @@ flake8-rst-docstrings = [
{file = "flake8_rst_docstrings-0.2.7-py3-none-any.whl", hash = "sha256:5d56075dce360bcc9c6775bfe7cb431aa395de600ca7e8d40580a28d50b2a803"},
]
Flask = [
{file = "Flask-2.2.2-py3-none-any.whl", hash = "sha256:b9c46cc36662a7949f34b52d8ec7bb59c0d74ba08ba6cb9ce9adc1d8676d9526"},
{file = "Flask-2.2.2.tar.gz", hash = "sha256:642c450d19c4ad482f96729bd2a8f6d32554aa1e231f4f6b4e7e5264b16cca2b"},
{file = "Flask-2.1.3-py3-none-any.whl", hash = "sha256:9013281a7402ad527f8fd56375164f3aa021ecfaff89bfe3825346c24f87e04c"},
{file = "Flask-2.1.3.tar.gz", hash = "sha256:15972e5017df0575c3d6c090ba168b6db90259e620ac8d7ea813a396bad5b6cb"},
]
Flask-Admin = [
{file = "Flask-Admin-1.6.0.tar.gz", hash = "sha256:424ffc79b7b0dfff051555686ea12e86e48dffacac14beaa319fb4502ac40988"},
@ -2443,8 +2443,8 @@ Flask-RESTful = [
{file = "Flask_RESTful-0.3.9-py2.py3-none-any.whl", hash = "sha256:4970c49b6488e46c520b325f54833374dc2b98e211f1b272bd4b0c516232afe2"},
]
flask-sqlalchemy = [
{file = "Flask-SQLAlchemy-3.0.0.tar.gz", hash = "sha256:b54939fd5f48184742b7d5b222d86983e233b43140c1071a36327353e86f3b56"},
{file = "Flask_SQLAlchemy-3.0.0-py3-none-any.whl", hash = "sha256:741dabf0903569a89e4793667e25be5bb9581e614fa0eeb81a395cc7dee40c4b"},
{file = "Flask-SQLAlchemy-2.5.1.tar.gz", hash = "sha256:2bda44b43e7cacb15d4e05ff3cc1f8bc97936cc464623424102bfc2c35e95912"},
{file = "Flask_SQLAlchemy-2.5.1-py2.py3-none-any.whl", hash = "sha256:f12c3d4cc5cc7fdcc148b9527ea05671718c3ea45d50c7e732cceb33f574b390"},
]
furo = [
{file = "furo-2022.9.29-py3-none-any.whl", hash = "sha256:559ee17999c0f52728481dcf6b1b0cf8c9743e68c5e3a18cb45a7992747869a9"},
@ -2901,7 +2901,18 @@ py = [
{file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"},
]
pyasn1 = [
{file = "pyasn1-0.4.8-py2.4.egg", hash = "sha256:fec3e9d8e36808a28efb59b489e4528c10ad0f480e57dcc32b4de5c9d8c9fdf3"},
{file = "pyasn1-0.4.8-py2.5.egg", hash = "sha256:0458773cfe65b153891ac249bcf1b5f8f320b7c2ce462151f8fa74de8934becf"},
{file = "pyasn1-0.4.8-py2.6.egg", hash = "sha256:5c9414dcfede6e441f7e8f81b43b34e834731003427e5b09e4e00e3172a10f00"},
{file = "pyasn1-0.4.8-py2.7.egg", hash = "sha256:6e7545f1a61025a4e58bb336952c5061697da694db1cae97b116e9c46abcf7c8"},
{file = "pyasn1-0.4.8-py2.py3-none-any.whl", hash = "sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d"},
{file = "pyasn1-0.4.8-py3.1.egg", hash = "sha256:78fa6da68ed2727915c4767bb386ab32cdba863caa7dbe473eaae45f9959da86"},
{file = "pyasn1-0.4.8-py3.2.egg", hash = "sha256:08c3c53b75eaa48d71cf8c710312316392ed40899cb34710d092e96745a358b7"},
{file = "pyasn1-0.4.8-py3.3.egg", hash = "sha256:03840c999ba71680a131cfaee6fab142e1ed9bbd9c693e285cc6aca0d555e576"},
{file = "pyasn1-0.4.8-py3.4.egg", hash = "sha256:7ab8a544af125fb704feadb008c99a88805126fb525280b2270bb25cc1d78a12"},
{file = "pyasn1-0.4.8-py3.5.egg", hash = "sha256:e89bf84b5437b532b0803ba5c9a5e054d21fec423a89952a74f87fa2c9b7bce2"},
{file = "pyasn1-0.4.8-py3.6.egg", hash = "sha256:014c0e9976956a08139dc0712ae195324a75e142284d5f87f1a87ee1b068a359"},
{file = "pyasn1-0.4.8-py3.7.egg", hash = "sha256:99fcc3c8d804d1bc6d9a099921e39d827026409a58f2a720dcdb89374ea0c776"},
{file = "pyasn1-0.4.8.tar.gz", hash = "sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba"},
]
pycodestyle = [

View File

@ -18,7 +18,7 @@ Changelog = "https://github.com/sartography/spiffworkflow-backend/releases"
[tool.poetry.dependencies]
python = ">=3.9,<3.11"
click = "^8.0.1"
flask = "*"
flask = "2.1.3"
flask-admin = "*"
flask-bcrypt = "*"
flask-cors = "*"
@ -53,6 +53,7 @@ APScheduler = "^3.9.1"
types-requests = "^2.28.6"
Jinja2 = "^3.1.2"
RestrictedPython = "^5.2"
Flask-SQLAlchemy = "^2.5.1"
[tool.poetry.dev-dependencies]

View File

@ -1,9 +1,10 @@
"""Process_instance_processor."""
import decimal
import json
import logging
import os
import time
from datetime import datetime
from typing import Any
from typing import Callable
from typing import Dict
@ -17,9 +18,12 @@ from flask import current_app
from flask_bpmn.api.api_error import ApiError
from flask_bpmn.models.db import db
from lxml import etree # type: ignore
from RestrictedPython import safe_globals # type: ignore
from SpiffWorkflow.bpmn.exceptions import WorkflowTaskExecException # type: ignore
from SpiffWorkflow.exceptions import WorkflowException # type: ignore
from SpiffWorkflow.bpmn.parser.ValidationException import ValidationException # type: ignore
from SpiffWorkflow.bpmn.PythonScriptEngine import Box # type: ignore
from SpiffWorkflow.bpmn.PythonScriptEngine import DEFAULT_GLOBALS
from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine
from SpiffWorkflow.bpmn.serializer import BpmnWorkflowSerializer # type: ignore
from SpiffWorkflow.bpmn.specs.BpmnProcessSpec import BpmnProcessSpec # type: ignore
from SpiffWorkflow.bpmn.specs.events import CancelEventDefinition # type: ignore
@ -27,6 +31,7 @@ from SpiffWorkflow.bpmn.specs.events import EndEvent
from SpiffWorkflow.bpmn.workflow import BpmnWorkflow # type: ignore
from SpiffWorkflow.dmn.parser.BpmnDmnParser import BpmnDmnParser # type: ignore
from SpiffWorkflow.dmn.serializer import BusinessRuleTaskConverter # type: ignore
from SpiffWorkflow.exceptions import WorkflowException # type: ignore
from SpiffWorkflow.serializer.exceptions import MissingSpecError # type: ignore
from SpiffWorkflow.spiff.parser.process import SpiffBpmnParser # type: ignore
from SpiffWorkflow.spiff.serializer import BoundaryEventConverter # type: ignore
@ -74,37 +79,30 @@ from spiffworkflow_backend.services.process_model_service import ProcessModelSer
from spiffworkflow_backend.services.service_task_service import ServiceTaskService
from spiffworkflow_backend.services.spec_file_service import SpecFileService
from spiffworkflow_backend.services.user_service import UserService
from spiffworkflow_backend.services.service_task_service import ServiceTaskService
from spiffworkflow_backend.scripts.script import Script
# Sorry about all this crap. I wanted to move this thing to another file, but
# importing a bunch of types causes circular imports.
from RestrictedPython import safe_globals # type: ignore
from datetime import datetime
import time
import decimal
from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine # type: ignore
from SpiffWorkflow.bpmn.PythonScriptEngine import Box
from SpiffWorkflow.bpmn.PythonScriptEngine import DEFAULT_GLOBALS
DEFAULT_GLOBALS.update({
"datetime": datetime,
"time": time,
"decimal": decimal,
})
DEFAULT_GLOBALS.update(
{
"datetime": datetime,
"time": time,
"decimal": decimal,
}
)
# This will overwrite the standard builtins
DEFAULT_GLOBALS.update(safe_globals)
class CustomBpmnScriptEngine(PythonScriptEngine): # type: ignore
"""This is a custom script processor that can be easily injected into Spiff Workflow.
It will execute python code read in from the bpmn. It will also make any scripts in the
scripts directory available for execution.
"""
def __init__(self) -> None:
"""__init__."""
super().__init__(default_globals=DEFAULT_GLOBALS)
def __get_augment_methods(self, task: SpiffTask) -> Dict[str, Callable]:

View File

@ -1,19 +1,14 @@
"""Test_various_bpmn_constructs."""
import pytest
from flask.app import Flask
from flask_bpmn.api.api_error import ApiError
from tests.spiffworkflow_backend.helpers.base_test import BaseTest
from tests.spiffworkflow_backend.helpers.test_data import load_test_spec
from spiffworkflow_backend.services.process_instance_processor import (
ProcessInstanceProcessor,
)
from spiffworkflow_backend.services.process_instance_service import (
ProcessInstanceService,
)
from flask_bpmn.api.api_error import ApiError
class TestOpenFile(BaseTest):
"""TestVariousBpmnConstructs."""
@ -27,7 +22,7 @@ class TestOpenFile(BaseTest):
bpmn_file_name="read_etc_passwd.bpmn",
process_model_source_directory="dangerous-scripts",
)
current_user = self.find_or_create_user()
self.find_or_create_user()
process_instance = self.create_process_instance_from_process_model(
process_model
@ -36,9 +31,8 @@ class TestOpenFile(BaseTest):
with pytest.raises(ApiError) as exception:
processor.do_engine_steps(save=True)
assert f"name 'open' is not defined" in str(
exception.value
)
assert "name 'open' is not defined" in str(exception.value)
class TestImportModule(BaseTest):
"""TestVariousBpmnConstructs."""
@ -52,7 +46,7 @@ class TestImportModule(BaseTest):
bpmn_file_name="read_env.bpmn",
process_model_source_directory="dangerous-scripts",
)
current_user = self.find_or_create_user()
self.find_or_create_user()
process_instance = self.create_process_instance_from_process_model(
process_model
@ -61,7 +55,4 @@ class TestImportModule(BaseTest):
with pytest.raises(ApiError) as exception:
processor.do_engine_steps(save=True)
assert f"ImportError:__import__ not found" in str(
exception.value
)
assert "ImportError:__import__ not found" in str(exception.value)