Fix linting issues #2
|
@ -6,6 +6,7 @@ import sys
|
||||||
import json
|
import json
|
||||||
from allspice import AllSpice
|
from allspice import AllSpice
|
||||||
|
|
||||||
|
|
||||||
def hello_world(task_type, source_file, output_file, additional_params):
|
def hello_world(task_type, source_file, output_file, additional_params):
|
||||||
print(f"Hello, World! Performing task: {task_type}")
|
print(f"Hello, World! Performing task: {task_type}")
|
||||||
print(f"Source file: {source_file}")
|
print(f"Source file: {source_file}")
|
||||||
|
@ -17,6 +18,7 @@ def hello_world(task_type, source_file, output_file, additional_params):
|
||||||
sch_ver = params.get("SCH_VER", "3")
|
sch_ver = params.get("SCH_VER", "3")
|
||||||
print(f"Schematic version: {sch_ver}")
|
print(f"Schematic version: {sch_ver}")
|
||||||
|
|
||||||
|
|
||||||
def test_allspice_connection(allspice_hub_url, auth_token):
|
def test_allspice_connection(allspice_hub_url, auth_token):
|
||||||
try:
|
try:
|
||||||
allspice = AllSpice(token_text=auth_token, allspice_hub_url=allspice_hub_url)
|
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}")
|
print(f"Error connecting to AllSpice API: {e}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog="hardware_devops_action",
|
prog="hardware_devops_action",
|
||||||
description="Perform hardware development tasks such as Schematic-Review, PCB-Review, ECO-Review, and Release."
|
description="Perform hardware development tasks such as Schematic-Review, PCB-Review, ECO-Review, and Release.",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--source_file",
|
"--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(
|
parser.add_argument(
|
||||||
"--task_type",
|
"--task_type",
|
||||||
|
@ -62,20 +65,16 @@ if __name__ == "__main__":
|
||||||
"--allspice_token",
|
"--allspice_token",
|
||||||
help="Your AllSpice application token. Generate a token: https://hub.allspice.io/user/settings/applications",
|
help="Your AllSpice application token. Generate a token: https://hub.allspice.io/user/settings/applications",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument("--config_file", help="Path to config file")
|
||||||
"--config_file",
|
parser.add_argument("--input_file", help="path/to/input_file")
|
||||||
help="Path to config file"
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"--input_file",
|
|
||||||
help="path/to/input_file"
|
|
||||||
)
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
auth_token = os.environ.get("ALLSPICE_TOKEN") or args.allspice_token
|
auth_token = os.environ.get("ALLSPICE_TOKEN") or args.allspice_token
|
||||||
if auth_token is None:
|
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)
|
exit(1)
|
||||||
|
|
||||||
# Test connection to AllSpice API
|
# Test connection to AllSpice API
|
||||||
|
|
Loading…
Reference in New Issue