From 1554e10d05155a46fb5bac6328c07c2612f3b71c Mon Sep 17 00:00:00 2001 From: sswallace Date: Sat, 10 Dec 2022 15:33:33 -0500 Subject: [PATCH] just starting to create functions --- main.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..33f46d9 --- /dev/null +++ b/main.py @@ -0,0 +1,45 @@ +import rov +import csv +from pathlib import * + +manrs_asns = [] +manrs_csv_filename = "manrs.csv" + +def read_manrs_participant_file(filename): + global manrs_asns + read_manrs_participant = Path.cwd() / filename + with open(read_manrs_participant) as csvfile: + fi_reader = csv.DictReader(csvfile, delimiter=',', quotechar='"') + for row in fi_reader: + for asn in row['ASNs'].split(','): + asn = asn.strip() + manrs_asns.append(asn) + + +def is_manrs_participant(asn): + global manrs_asns + if len(manrs_asns) == 0: + read_manrs_participant_file(manrs_csv_filename) + if asn.strip() in manrs_asns: + return True + else: + return False + + +# This is a sample Python script. + +# Press ⌃R to execute it or replace it with your code. +# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings. + + +def print_hi(name): + # Use a breakpoint in the code line below to debug your script. + print(f'Hi, {name}') # Press ⌘F8 to toggle the breakpoint. + + +# Press the green button in the gutter to run the script. +if __name__ == '__main__': + print(f"is ASN 123 {is_manrs_participant('123')}") + print_hi('PyCharm') + +# See PyCharm help at https://www.jetbrains.com/help/pycharm/