-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from EURODEO/simple-format
Simplify output format handling
- Loading branch information
Showing
8 changed files
with
104 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,13 @@ | ||
import importlib | ||
import logging | ||
import pkgutil | ||
from enum import Enum | ||
|
||
import formatters | ||
from . import covjson | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def get_EDR_formatters() -> dict: | ||
""" | ||
This method should grab all available formatters and make them reachable in a dict | ||
This way we can dynamicly grab all available formats and skip configuring this. | ||
Should aliases be made available, and how do one make formatters present in openapi doc? | ||
""" | ||
available_formatters = {} | ||
class Formats(str, Enum): | ||
covjson = "CoverageJSON" # According to EDR spec | ||
|
||
formatter_plugins = [ | ||
importlib.import_module("formatters." + i.name) | ||
for i in pkgutil.iter_modules(formatters.__path__) | ||
if i.name != "base_formatter" | ||
] | ||
logger.info(f"Loaded plugins : {formatter_plugins}") | ||
for formatter_module in formatter_plugins: | ||
# Make instance of formatter and save | ||
available_formatters[formatter_module.__name__.split(".")[-1]] = getattr( | ||
formatter_module, formatter_module.formatter_name | ||
)() | ||
|
||
# Should also setup dict for alias discover | ||
|
||
return available_formatters | ||
formatters = {"CoverageJSON": covjson.convert_to_covjson} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
5fe658d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API Unit Test Coverage Report
API Unit Test Coverage Summary