Skip to content

Commit

Permalink
remove typing
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Taylor <steve@deployhub.com>
  • Loading branch information
sbtaylor15 committed Feb 26, 2024
1 parent be1ee1a commit f0a6c8e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# hadolint global ignore=DL3041,DL3013
# hadolint global ignore=DL3041,DL3013,DL4006
FROM amazonlinux:2023@sha256:d8323b3ea56d286d65f9a7469359bb29519c636d7d009671ac00b5c12ddbacf0

WORKDIR /app
Expand All @@ -7,11 +7,11 @@ COPY . /app
RUN dnf update -y; \
dnf upgrade -y; \
dnf install -y python3.11; \
dnf clean all; \
rm /usr/bin/python3; \
ln -s /usr/bin/python3.11 /usr/bin/python3;
RUN python3 -m ensurepip --upgrade; \
pip3 install --no-cache-dir --requirement requirements.in
RUN python3 main.py --loaddata
dnf clean all

ENTRYPOINT ["python3", "main.py"]
RUN curl -sL https://bootstrap.pypa.io/get-pip.py | python3.11 - ; \
python3.11 -m pip install --no-cache-dir -r requirements.in

RUN python3.11 main.py --loaddata

ENTRYPOINT ["python3.11", "main.py"]
7 changes: 3 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import argparse
import os
import re
from typing import Any, List

import joblib
import stanza
Expand Down Expand Up @@ -48,7 +47,7 @@
stanza.download("en") # Download English model for Stanza
nlp = stanza.Pipeline(lang="en", processors="tokenize,mwt,pos,lemma,depparse")
vectorizer = TfidfVectorizer()
mitre_data: List[Any] = []
mitre_data = [] # type: ignore

app = Flask(__name__)

Expand Down Expand Up @@ -95,8 +94,8 @@ def calculate_similarity(doc1, doc2, vectorizer):
return combined_similarity


def load_mitre(nlp, mitre_data_file) -> List[Any]:
mitre_data: List[Any] = []
def load_mitre(nlp, mitre_data_file):
mitre_data = []

if os.path.exists(mitre_data_file):
# Load mitre_data from the file if it exists
Expand Down
1 change: 0 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ mitreattack-python==3.0.2
numpy==1.26.4 # This is a common dependency for scikit-learn
scikit-learn==1.4.1.post1
stanza==1.8.0
typing==3.7.4.3

0 comments on commit f0a6c8e

Please sign in to comment.