-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: salihuDickson <[email protected]>
- Loading branch information
1 parent
9eca261
commit 069397f
Showing
16 changed files
with
782 additions
and
498 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
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,30 +1,37 @@ | ||
import click | ||
import json | ||
|
||
import click | ||
|
||
from crategen.converter_manager import ConverterManager | ||
|
||
|
||
@click.command() | ||
@click.option('--input', prompt='Input file', help='Path to the input JSON file.') | ||
@click.option('--output', prompt='Output file', help='Path to the output JSON file.') | ||
@click.option('--conversion-type', prompt='Conversion type', type=click.Choice(['tes-to-wrroc', 'wes-to-wrroc']), help='Type of conversion to perform.') | ||
@click.option("--input", prompt="Input file", help="Path to the input JSON file.") | ||
@click.option("--output", prompt="Output file", help="Path to the output JSON file.") | ||
@click.option( | ||
"--conversion-type", | ||
prompt="Conversion type", | ||
type=click.Choice(["tes-to-wrroc", "wes-to-wrroc"]), | ||
help="Type of conversion to perform.", | ||
) | ||
def cli(input, output, conversion_type): | ||
""" | ||
Command Line Interface for converting TES/WES to WRROC. | ||
""" | ||
"""Command Line Interface for converting TES/WES to WRROC.""" | ||
manager = ConverterManager() | ||
|
||
# Load input data from JSON file | ||
with open(input, 'r') as input_file: | ||
with open(input) as input_file: | ||
data = json.load(input_file) | ||
|
||
# Perform the conversion based on the specified type | ||
if conversion_type == 'tes-to-wrroc': | ||
if conversion_type == "tes-to-wrroc": | ||
result = manager.convert_tes_to_wrroc(data) | ||
elif conversion_type == 'wes-to-wrroc': | ||
elif conversion_type == "wes-to-wrroc": | ||
result = manager.convert_wes_to_wrroc(data) | ||
|
||
# Save the result to the output JSON file | ||
with open(output, 'w') as output_file: | ||
with open(output, "w") as output_file: | ||
json.dump(result, output_file, indent=4) | ||
|
||
if __name__ == '__main__': | ||
|
||
if __name__ == "__main__": | ||
cli() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
from abc import ABC, abstractmethod | ||
|
||
|
||
class AbstractConverter(ABC): | ||
@abstractmethod | ||
def convert_to_wrroc(self, data): | ||
"""Convert data to WRROC format""" | ||
|
||
@abstractmethod | ||
def convert_from_wrroc(self, wrroc_data): | ||
"""Convert WRROC data to the original format""" |
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.