Skip to content

Commit

Permalink
Upgrade requirements (#347)
Browse files Browse the repository at this point in the history
* remove versions from pillow and make psycopg install the binary version

* fix prompt client edge case bug

* lint

* fixed how the chatbot presents answers, tickets #331 and #342

* lint

* fix smartlink bug

* lint

* get juiceshop importer to create embeddings based on tags

* smaller requirements txt file

* new requirements and fixed tests

* fixed how the chatbot presents answers, tickets #331 and #342

* lint

* lint

* add coverage

* fix tests
  • Loading branch information
northdpole authored Sep 4, 2023
1 parent 085be48 commit 5ac2bf7
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 210 deletions.
2 changes: 1 addition & 1 deletion application/database/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def get_nodes_with_pagination(
ntype=ntype,
description=description,
sectionID=sectionID,
).paginate(int(page), items_per_page, False)
).paginate(page=int(page), per_page=items_per_page, error_out=False)
total_pages = dbnodes.pages
if dbnodes.items:
for dbnode in dbnodes.items:
Expand Down
2 changes: 1 addition & 1 deletion application/tests/capec_parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ def tearDown(self) -> None:

def setUp(self) -> None:
self.app = create_app(mode="test")
sqla.create_all(app=self.app)
self.app_context = self.app.app_context()
self.app_context.push()
sqla.create_all()
self.collection = db.Node_collection()

def test_register_capec(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion application/tests/cheatsheets_parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def tearDown(self) -> None:

def setUp(self) -> None:
self.app = create_app(mode="test")
sqla.create_all(app=self.app)
self.app_context = self.app.app_context()
self.app_context.push()
sqla.create_all()
self.collection = db.Node_collection()

def test_register_cheatsheet(self) -> None:
Expand Down
4 changes: 2 additions & 2 deletions application/tests/cre_main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ def tearDown(self) -> None:
for tmpdir in self.tmpdirs:
shutil.rmtree(tmpdir)
sqla.session.remove()
sqla.drop_all(app=self.app)
sqla.drop_all()
self.app_context.pop()

def setUp(self) -> None:
self.tmpdirs: List[str] = []
self.app = create_app(mode="test")
sqla.create_all(app=self.app)
self.app_context = self.app.app_context()
self.app_context.push()
sqla.create_all()
self.collection = db.Node_collection()

def test_register_node_with_links(self) -> None:
Expand Down
6 changes: 3 additions & 3 deletions application/tests/db_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ def tearDown(self) -> None:

def setUp(self) -> None:
self.app = create_app(mode="test")
sqla.create_all(app=self.app)

self.app_context = self.app.app_context()
self.app_context.push()
sqla.create_all()

self.collection = db.Node_collection()
collection = self.collection
collection.graph.graph = db.CRE_Graph.load_cre_graph(sqla.session)
Expand Down Expand Up @@ -1214,7 +1214,7 @@ def test_get_root_cres(self):
dbnodes = []
sqla.session.remove()
sqla.drop_all()
sqla.create_all(app=self.app)
sqla.create_all()
collection = db.Node_collection()
collection.graph.graph = db.CRE_Graph.load_cre_graph(sqla.session)

Expand Down
2 changes: 1 addition & 1 deletion application/tests/mdutils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ def tearDown(self) -> None:

def setUp(self) -> None:
self.app = create_app(mode="test")
sqla.create_all(app=self.app)
self.app_context = self.app.app_context()
self.app_context.push()
sqla.create_all()

def test_cre_to_md(self) -> None:
standards = [
Expand Down
2 changes: 1 addition & 1 deletion application/tests/osib_defs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Osib_node,
)
from application.defs.cre_defs import LinkTypes
from networkx import networkx as nx
import networkx as nx
from networkx.algorithms.simple_paths import all_simple_paths


Expand Down
8 changes: 3 additions & 5 deletions application/tests/spreadsheet_parsers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,11 +460,9 @@ def test_parse_export_format(self) -> None:
result = parse_export_format(input_data)
self.maxDiff = None
for key, val in result.items():
self.assertDictEqual(expected[key].todict(), val.todict())

# self.assertDictEqual(expected[key].todict(), val.todict())
expected[key].links = []
val.links = []

self.assertDictEqual(val.todict(), expected[key].todict())

def test_parse_uknown_key_val_standards_spreadsheet(self) -> None:
Expand Down Expand Up @@ -602,8 +600,8 @@ def test_parse_hierarchical_export_format(self) -> None:
)
sASVS = defs.Standard(
name="ASVS",
section="V1.2.3",
sectionID="10",
section="10",
sectionID="V1.2.3",
hyperlink="https://example.com/asvs",
)
sCWE = defs.Standard(
Expand Down
3 changes: 1 addition & 2 deletions application/tests/spreadsheet_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ def tearDown(self) -> None:

def setUp(self) -> None:
self.app = create_app(mode="test")
sqla.create_all(app=self.app)

self.app_context = self.app.app_context()
self.app_context.push()
sqla.create_all()
self.collection = db.Node_collection()

def test_prepare_spreadsheet_standards(self) -> None:
Expand Down
4 changes: 2 additions & 2 deletions application/tests/web_main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
class TestMain(unittest.TestCase):
def tearDown(self) -> None:
sqla.session.remove()
sqla.drop_all(app=self.app)
sqla.drop_all()
self.app_context.pop()

def setUp(self) -> None:
self.app = create_app(mode="test")
sqla.create_all(app=self.app)
self.app_context = self.app.app_context()
self.app_context.push()
sqla.create_all()

def test_extend_cre_with_tag_links(self) -> None:
"""
Expand Down
3 changes: 2 additions & 1 deletion application/tests/zap_alerts_parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ def tearDown(self) -> None:

def setUp(self) -> None:
self.app = create_app(mode="test")
sqla.create_all(app=self.app)
self.app_context = self.app.app_context()
self.app_context.push()
sqla.create_all()

self.collection = db.Node_collection()

def test_register_zap_alert_top_10_tags(self) -> None:
Expand Down
216 changes: 26 additions & 190 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,193 +1,29 @@
aiohttp==3.8.4
aiosignal==1.3.1
alembic==1.7.1
anyio==3.6.2
argcomplete==2.0.0
astroid==2.7.2
async-timeout==4.0.2
attrs==19.3.0
bcrypt==4.0.1
beautifulsoup4==4.12.2
black
Brotli==1.0.9
cachetools==4.1.1
certifi==2020.6.20
cffi==1.15.1
chardet==3.0.4
charset-normalizer==2.0.12
click==8.1.3
click-didyoumean==0.0.3
click-plugins==1.1.1
click-repl==0.2.0
cmarkgfm==0.6.0
compliance-trestle==1.2.0
coverage==5.5
cryptography==39.0.0
cycler==0.11.0
dacite==1.6.0
dataclasses-json==0.5.6
datamodel-code-generator==0.17.0
decorator==4.4.2
defusedxml==0.7.1
Deprecated==1.2.10
dnspython==2.3.0
docutils==0.19
email-validator==1.3.1
et-xmlfile==1.1.0
exceptiongroup==1.1.1
Flask==2.2.2
Flask-Cache==0.13.1
Flask-Caching==1.10.1
Flask-Compress==1.10.1
Flask-Cors==3.0.10
Flask-Migrate==3.1.0
Flask-SQLAlchemy==2.5.1
flask-sqlalchemy-stubs==0.2
fonttools==4.33.3
frozenlist==1.3.3
furl==2.1.3
genson==1.2.2
gevent==22.10.2
gitdb==4.0.5
github2==0.6.2
GitPython==3.1.9
google-api-core==2.11.0
google-auth==2.18.1
google-auth-oauthlib==1.0.0
google-cloud-aiplatform==1.25.0
google-cloud-bigquery==3.10.0
google-cloud-core==2.3.2
google-cloud-resource-manager==1.10.1
google-cloud-storage==2.9.0
google-crc32c==1.5.0
google-resumable-media==2.5.0
googleapis-common-protos==1.59.0
graphviz==0.20
greenlet==2.0.1
grpc-google-iam-v1==0.12.6
grpcio==1.54.2
grpcio-status==1.54.2
gspread==3.6.0
gunicorn==20.1.0
h11==0.14.0
html5lib==1.1
httpcore==0.16.3
httplib2==0.19.0
httpx==0.23.3
idna==2.10
ilcli==0.3.2
importlib-metadata==2.0.0
importlib-resources==5.10.2
inflect==5.6.2
iniconfig==2.0.0
isort==5.9.3
itsdangerous==2.1.2
Jinja2==3.1.2
joblib==1.2.0
jsonschema==4.17.3
jsonschema-spec==0.1.3
kiwisolver==1.4.3
lazy-object-proxy==1.9.0
lxml==4.9.2
Mako==1.1.5
MarkupSafe==2.1.2
marshmallow==3.14.1
marshmallow-enum==1.5.1
matplotlib
mccabe==0.6.1
more-itertools==7.0.0
multidict==6.0.4
mypy==0.910
mypy-extensions==0.4.3
networkx==2.5.1
coverage
dacite
docx==0.2.4
Flask_Caching==2.0.2
flask_compress==1.13
Flask_Cors==4.0.0
Flask_Migrate==4.0.4
gitpython
google-api-core
google_auth_oauthlib
google-cloud-aiplatform
grpcio_status
grpcio
gspread==5.10.0
networkx
nltk==3.8.1
nose==1.3.7
numpy==1.23.0
oauthlib==3.1.0
openai==0.27.6
openapi-schema-validator==0.3.4
openapi-spec-validator==0.5.1
openpyxl==3.1.0
orderedmultidict==1.0.1
orjson==3.8.5
packaging
paramiko==3.0.0
pathable==0.4.3
pathspec==0.9.0
pbr==5.8.0
pep517==0.8.2
Pillow
pip-autoremove==0.9.1
platformdirs==2.2.0
playwright==1.33.0
pluggy==1.0.0
prance
prompt-toolkit==3.0.19
proto-plus==1.22.2
protobuf==4.23.1
psycopg2-binary
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycodestyle==2.7.0
pycparser==2.21
pydantic==1.10.4
pyee==9.0.4
pyflakes==2.3.1
PyGithub==1.53
PyJWT==1.7.1
PyNaCl==1.5.0
pyparsing==2.4.6
pyrsistent==0.17.3
PySnooper==1.1.1
pytest==7.3.1
pytest-base-url==2.0.0
pytest-playwright==0.3.3
python-dateutil==2.8.1
python-docx==0.8.11
python-dotenv==0.21.1
python-frontmatter==1.0.0
python-markdown-maker==1.0
python-slugify==8.0.1
PyYAML==5.3.1
regex==2021.11.10
requests==2.27.1
requests-oauthlib==1.3.1
rfc3986==1.5.0
rsa==4.7
ruamel.yaml==0.17.21
ruamel.yaml.clib==0.2.7
scikit-learn==1.2.2
scipy==1.10.1
semver==2.13.0
Shapely==1.8.5.post1
simplify-docx==0.1.2
six==1.15.0
smmap==3.0.4
sniffio==1.3.0
soupsieve==2.4.1
SQLAlchemy==1.3.23
sqlalchemy-stubs==0.4
testresources==2.0.1
text-unidecode==1.3
threadpoolctl==3.1.0
toml==0.10.2
tomli==1.2.2
tqdm==4.65.0
typed-ast==1.5.4
types-PyYAML==5.4.8
typing-inspect==0.7.1
typing_extensions==4.4.0
untangle==1.1.1
urllib3==1.26.8
oauthlib==3.2.2
openai==0.27.9
playwright
pygithub
python_markdown_maker==1.0
scikit_learn==1.3.0
scipy==1.11.2
semver
setuptools==66.1.1
simplify_docx==0.1.2
compliance-trestle
vertexai==0.0.1
wcwidth==0.2.5
webencodings==0.5.1
Werkzeug==2.2.2
wincertstore==0.2
wrapt==1.12.1
xmltodict==0.13.0
yamlable==1.0.3
yarl==1.9.2
zipp==3.5.0
zope.event==4.6
zope.interface==6.0

0 comments on commit 5ac2bf7

Please sign in to comment.