Fix linting issues #2

Merged
AllSpiceAlice merged 1 commits from dd/dev into main 2024-07-22 01:17:21 +00:00
1 changed files with 13 additions and 14 deletions

View File

@ -6,6 +6,7 @@ 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}")
@ -17,6 +18,7 @@ def hello_world(task_type, source_file, output_file, 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."
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