format script
This commit is contained in:
parent
7e244a55c5
commit
fc4104a087
|
@ -1,17 +1,16 @@
|
||||||
#Cellario modules
|
# Cellario modules
|
||||||
from HRB.Cellario.Scripting import *
|
from HRB.Cellario.Scripting import *
|
||||||
from HRB.Cellario.Scripting.API import *
|
from HRB.Cellario.Scripting.API import *
|
||||||
import json
|
import json
|
||||||
from sys import argv
|
|
||||||
from os import path, listdir
|
from os import path, listdir
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
|
||||||
def Execute(api : PythonScriptingApi):
|
def Execute(api: PythonScriptingApi):
|
||||||
available_barcodes = "C:/temp/availabletubes.txt"
|
available_barcodes = "C:/temp/availabletubes.txt"
|
||||||
letter_dir = "C:/temp/letters"
|
letter_dir = "C:/temp/letters"
|
||||||
input = "EH"
|
input = "EH"
|
||||||
|
|
||||||
available_tubes = read_available(available_barcodes)
|
available_tubes = read_available(available_barcodes)
|
||||||
letters = []
|
letters = []
|
||||||
for letter in input:
|
for letter in input:
|
||||||
|
@ -23,10 +22,11 @@ def Execute(api : PythonScriptingApi):
|
||||||
letters += x
|
letters += x
|
||||||
|
|
||||||
output = letter_tubes_to_obj(letters)
|
output = letter_tubes_to_obj(letters)
|
||||||
|
|
||||||
api.Messaging.WriteDiagnostic(ScriptLogLevel.Normal, json.dumps(output))
|
api.Messaging.WriteDiagnostic(ScriptLogLevel.Normal, json.dumps(output))
|
||||||
list(api.CurrentRun.RunOrderParameters)[0].ParameterValue = json.dumps(output)
|
list(api.CurrentRun.RunOrderParameters)[
|
||||||
|
0].ParameterValue = json.dumps(output)
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class Tube:
|
class Tube:
|
||||||
|
@ -85,4 +85,4 @@ def validate_word(input: str, letter_dir: str) -> bool:
|
||||||
def get_letter_positions(letter: str, letter_dir: str):
|
def get_letter_positions(letter: str, letter_dir: str):
|
||||||
filename = [f for f in listdir(letter_dir) if f[0] == letter][0]
|
filename = [f for f in listdir(letter_dir) if f[0] == letter][0]
|
||||||
with open(path.join(letter_dir, filename), 'r') as file:
|
with open(path.join(letter_dir, filename), 'r') as file:
|
||||||
return [int(x.strip()) for x in file.readlines()]
|
return [int(x.strip()) for x in file.readlines()]
|
||||||
|
|
Loading…
Reference in New Issue