Fix linting issues #2
@ -6,17 +6,19 @@ import sys
|
||||
import json
|
||||
from allspice import AllSpice
|
||||
|
||||
|
||||
def hello_world(task_type, source_file, output_file, additional_params):
|
||||
print(f"Hello, World! Performing task: {task_type}")
|
||||
print(f"Source file: {source_file}")
|
||||
print(f"Output file: {output_file}")
|
||||
print(f"Additional parameters: {additional_params}")
|
||||
|
||||
|
||||
# Parse additional_params
|
||||
params = json.loads(additional_params)
|
||||
sch_ver = params.get("SCH_VER", "3")
|
||||
print(f"Schematic version: {sch_ver}")
|
||||
|
||||
|
||||
def test_allspice_connection(allspice_hub_url, auth_token):
|
||||
try:
|
||||
allspice = AllSpice(token_text=auth_token, allspice_hub_url=allspice_hub_url)
|
||||
@ -26,14 +28,15 @@ def test_allspice_connection(allspice_hub_url, auth_token):
|
||||
print(f"Error connecting to AllSpice API: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="hardware_devops_action",
|
||||
description="Perform hardware development tasks such as Schematic-Review, PCB-Review, ECO-Review, and Release."
|
||||
prog="hardware_devops_action",
|
||||
description="Perform hardware development tasks such as Schematic-Review, PCB-Review, ECO-Review, and Release.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--source_file",
|
||||
help="The path to the source file used for the task. Example: 'Archimajor.PrjPcb', 'Schematics/Beagleplay.dsn'."
|
||||
help="The path to the source file used for the task. Example: 'Archimajor.PrjPcb', 'Schematics/Beagleplay.dsn'.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--task_type",
|
||||
@ -62,20 +65,16 @@ if __name__ == "__main__":
|
||||
"--allspice_token",
|
||||
help="Your AllSpice application token. Generate a token: https://hub.allspice.io/user/settings/applications",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--config_file",
|
||||
help="Path to config file"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--input_file",
|
||||
help="path/to/input_file"
|
||||
)
|
||||
parser.add_argument("--config_file", help="Path to config file")
|
||||
parser.add_argument("--input_file", help="path/to/input_file")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
auth_token = os.environ.get("ALLSPICE_TOKEN") or args.allspice_token
|
||||
if auth_token is None:
|
||||
print("Please set the environment variable ALLSPICE_TOKEN or supply a token with --allspice_token <your_token>. Generate a token: https://hub.allspice.io/user/settings/applications")
|
||||
print(
|
||||
"Please set the environment variable ALLSPICE_TOKEN or supply a token with --allspice_token <your_token>. Generate a token: https://hub.allspice.io/user/settings/applications"
|
||||
)
|
||||
exit(1)
|
||||
|
||||
# Test connection to AllSpice API
|
||||
@ -87,4 +86,4 @@ if __name__ == "__main__":
|
||||
source_file=args.source_file,
|
||||
output_file=args.output_file,
|
||||
additional_params=args.additional_params,
|
||||
)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user