Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
topscoder committed May 16, 2024
1 parent 5224c70 commit 8c61e47
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/lib/download_worker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from threading import Thread
from lib.parsers.WordfenceParser import WordfenceParser
from lib.wordfence_parser import WordfenceParser


class DownloadWorker(Thread):
Expand Down
File renamed without changes.
File renamed without changes.
Empty file removed src/lib/parsers/__init__.py
Empty file.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from src.lib.colors import red, green, yellow
from src.lib.logger import logger
from .colors import red, green, yellow
from .logger import logger
import hashlib
import json
import os
Expand Down Expand Up @@ -58,8 +58,13 @@ def execute(self, source, is_local=False, overwrite=False, force=False, overwrit
self.tpl_main_no_ref = template.read()

if is_local is True:
file_path = source # "./vulnerabilities.production.json"
with open(file_path, "r") as file:
if not source.lower().endswith(".json"):
return False

if not os.path.exists(source):
return False

with open(source, "r") as file:
vulnerabilities = json.load(file)

# Print the vulnerabilities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import requests
import re

from lib.parsers.parser_interface import ParserInterface
from lib.parser_interface import ParserInterface


class WordfenceParser(ParserInterface):
Expand Down
4 changes: 2 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

from lib.colors import yellow
from lib.logger import logger
from lib.parsers.wordfence_api_parser import WordfenceAPIParser
from lib.parsers.wordfence_parser import WordfenceParser
from lib.wordfence_api_parser import WordfenceAPIParser
from lib.wordfence_parser import WordfenceParser


def main():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_wordfence_api_parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest
from src.lib.parsers.wordfence_api_parser import WordfenceAPIParser
from src.lib.wordfence_api_parser import WordfenceAPIParser


class TestWordfenceAPIParser(unittest.TestCase):
Expand Down

0 comments on commit 8c61e47

Please sign in to comment.