mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-01-27 09:45:12 +00:00
make this thing a config and clean up lint
This commit is contained in:
parent
5f8ff4b5aa
commit
0552eaeb7b
@ -1,19 +1,23 @@
|
||||
"""This is used by bin/codemod/remove_all_unused_functions to remove a function from a file."""
|
||||
from bowler import Query
|
||||
from bowler.types import Leaf
|
||||
|
||||
# This came about because vulture (actually dead, from the list of Similar programs at https://pypi.org/project/vulture/)
|
||||
# actually found unused stuff, and I wanted to remove it.
|
||||
# See also https://github.com/craigds/decrapify
|
||||
|
||||
|
||||
def remove_function(filename: str, function_name: str) -> None:
|
||||
"""Does the dirty work of actually removing the function from the file in place, or failing if it cannot."""
|
||||
|
||||
def remove_statement(node, capture, filename):
|
||||
node.remove()
|
||||
|
||||
bowler_query = (Query(filename)
|
||||
bowler_query = (
|
||||
Query(filename)
|
||||
.select_function(function_name)
|
||||
.modify(remove_statement)
|
||||
.execute(write=True, silent=True, interactive=False))
|
||||
.execute(write=True, silent=True, interactive=False)
|
||||
)
|
||||
|
||||
if len(bowler_query.exceptions) > 0:
|
||||
print(f"Failed to remove function {function_name} from {filename}.")
|
||||
|
@ -11,6 +11,8 @@ from spiffworkflow_backend.services.process_instance_processor import (
|
||||
from spiffworkflow_backend.services.process_instance_service import (
|
||||
ProcessInstanceService,
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
"""Main."""
|
||||
app = get_hacked_up_app_for_script()
|
||||
|
@ -153,3 +153,9 @@ SPIFFWORKFLOW_BACKEND_FEATURE_ELEMENT_UNITS_ENABLED = (
|
||||
SPIFFWORKFLOW_BACKEND_ELEMENT_UNITS_CACHE_DIR = environ.get(
|
||||
"SPIFFWORKFLOW_BACKEND_ELEMENT_UNITS_CACHE_DIR", default=None
|
||||
)
|
||||
|
||||
# adds the ProxyFix to Flask on http by processing the 'X-Forwarded-Proto' header
|
||||
# to make SpiffWorkflow aware that it should return https for the server urls etc rather than http.
|
||||
SPIFFWORKFLOW_BACKEND_USE_WERKZEUG_MIDDLEWARE_PROXY_FIX = (
|
||||
environ.get("SPIFFWORKFLOW_BACKEND_USE_WERKZEUG_MIDDLEWARE_PROXY_FIX", default="false") == "true"
|
||||
)
|
||||
|
@ -7,8 +7,10 @@ from spiffworkflow_backend.services.acceptance_test_fixtures import (
|
||||
)
|
||||
|
||||
app = create_app()
|
||||
if os.environ.get("SPIFFWORKFLOW_BACKEND_USE_WERKZEUG_MIDDLEWARE_PROXY_FIX") == "true":
|
||||
|
||||
if app.config["SPIFFWORKFLOW_BACKEND_USE_WERKZEUG_MIDDLEWARE_PROXY_FIX"]:
|
||||
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
|
||||
app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1)
|
||||
|
||||
# this is in here because when we put it in the create_app function,
|
||||
|
Loading…
x
Reference in New Issue
Block a user