Skip to content

Commit

Permalink
Minor edits (#208)
Browse files Browse the repository at this point in the history
* fix : .keys() removed

* fix : setup.py author section updated

* fix : .keys() removed

* fix : autopep8
  • Loading branch information
sepandhaghighi authored Dec 28, 2023
1 parent f0b1e84 commit a7641a9
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion opem/Dynamic/Chakraborty.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def Dynamic_Analysis(
print("###########")
print(Simulation_Title + "-Model Simulation")
print("###########")
OutputParamsKeys = sorted(OutputParams.keys())
OutputParamsKeys = sorted(OutputParams)
Output_Dict = dict(
zip(OutputParamsKeys, [None] * len(OutputParamsKeys)))
if not TestMode:
Expand Down
2 changes: 1 addition & 1 deletion opem/Dynamic/Padulles1.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def Dynamic_Analysis(
print("###########")
print(Simulation_Title + "-Model Simulation")
print("###########")
OutputParamsKeys = sorted(OutputParams.keys())
OutputParamsKeys = sorted(OutputParams)
Output_Dict = dict(
zip(OutputParamsKeys, [None] * len(OutputParamsKeys)))
if not TestMode:
Expand Down
2 changes: 1 addition & 1 deletion opem/Dynamic/Padulles2.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def Dynamic_Analysis(
print("###########")
print(Simulation_Title + "-Model Simulation")
print("###########")
OutputParamsKeys = sorted(OutputParams.keys())
OutputParamsKeys = sorted(OutputParams)
Output_Dict = dict(
zip(OutputParamsKeys, [None] * len(OutputParamsKeys)))
if not TestMode:
Expand Down
2 changes: 1 addition & 1 deletion opem/Dynamic/Padulles_Amphlett.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def Dynamic_Analysis(
print("###########")
print(Simulation_Title + "-Model Simulation")
print("###########")
OutputParamsKeys = sorted(OutputParams.keys())
OutputParamsKeys = sorted(OutputParams)
Output_Dict = dict(
zip(OutputParamsKeys, [None] * len(OutputParamsKeys)))
if not TestMode:
Expand Down
2 changes: 1 addition & 1 deletion opem/Dynamic/Padulles_Hauer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def Dynamic_Analysis(
print("###########")
print(Simulation_Title + "-Model Simulation")
print("###########")
OutputParamsKeys = sorted(OutputParams.keys())
OutputParamsKeys = sorted(OutputParams)
Output_Dict = dict(
zip(OutputParamsKeys, [None] * len(OutputParamsKeys)))
if not TestMode:
Expand Down
16 changes: 8 additions & 8 deletions opem/Functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ def filter_default(input_dict, params_default):
:type params_default : dict
:return: modified input_dict as dict
"""
for i in params_default.keys():
if i not in input_dict.keys():
for i in params_default:
if i not in input_dict:
input_dict[i] = params_default[i]
return input_dict

Expand Down Expand Up @@ -209,7 +209,7 @@ def Get_Input(InputParams, input_item=input, params_default={}):
:return: input dictionary
"""
try:
Input_Keys = sorted(InputParams.keys())
Input_Keys = sorted(InputParams)
Input_Values = []
Name = ""
while(True):
Expand All @@ -227,7 +227,7 @@ def Get_Input(InputParams, input_item=input, params_default={}):
if isfloat(Input_Item):
Input_Flag = True
else:
if item in params_default.keys():
if item in params_default:
Input_Item = params_default[item]
Input_Flag = True
else:
Expand Down Expand Up @@ -318,7 +318,7 @@ def Output_Init(InputDict, Title, Name, Folder):
opem_file.write(Title + " Model" + spliter * 2)
opem_file.write("**********" + spliter)
opem_file.write("Simulation Inputs : " + spliter * 2)
Input_Keys = sorted(InputDict.keys())
Input_Keys = sorted(InputDict)
for key in Input_Keys:
opem_file.write(key + " : " + str(InputDict[key]) + spliter)
opem_file.write("**********" + spliter)
Expand Down Expand Up @@ -474,7 +474,7 @@ def HTML_Input_Table(Input_Dict, Input_Params, file):
:return: None
"""
file.write(HTML_Input_Table_Template1)
Input_Params_Keys = sorted(Input_Params.keys())
Input_Params_Keys = sorted(Input_Params)
for key in Input_Params_Keys:
file.write(
HTML_Input_Table_Template2.format(
Expand Down Expand Up @@ -502,7 +502,7 @@ def HTML_Overall_Params_Table(
if header:
file.write('<h2 style="color:#ff7600;">Overall Parameters</h2>\n')
file.write(HTML_Overall_Params_Table_Template)
Input_Params_Keys = sorted(Input_Params.keys())
Input_Params_Keys = sorted(Input_Params)
for key in Input_Params_Keys:
file.write(
HTML_Input_Table_Template2.format(
Expand Down Expand Up @@ -674,7 +674,7 @@ def description_control(
line()
print(Analysis_Name.replace("_", " ") + " Standard Test Vector\n")
Test_Vector = Vectors_Dict[Analysis_Name]
for i in Test_Vector.keys():
for i in Test_Vector:
print(i + " : " + str(Test_Vector[i]))
print("\n")
line()
Expand Down
2 changes: 1 addition & 1 deletion opem/Static/Amphlett.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ def Static_Analysis(
print("###########")
print(Simulation_Title + "-Model Simulation")
print("###########")
OutputParamsKeys = sorted(OutputParams.keys())
OutputParamsKeys = sorted(OutputParams)
Output_Dict = dict(
zip(OutputParamsKeys, [None] * len(OutputParamsKeys)))
if not TestMode:
Expand Down
2 changes: 1 addition & 1 deletion opem/Static/Chamberline_Kim.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def Static_Analysis(
print("###########")
print(Simulation_Title + "-Model Simulation")
print("###########")
OutputParamsKeys = sorted(OutputParams.keys())
OutputParamsKeys = sorted(OutputParams)
Output_Dict = dict(
zip(OutputParamsKeys, [None] * len(OutputParamsKeys)))
if not TestMode:
Expand Down
2 changes: 1 addition & 1 deletion opem/Static/Larminie_Dicks.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def Static_Analysis(
print("###########")
print(Simulation_Title + "-Model Simulation")
print("###########")
OutputParamsKeys = sorted(OutputParams.keys())
OutputParamsKeys = sorted(OutputParams)
Output_Dict = dict(
zip(OutputParamsKeys, [None] * len(OutputParamsKeys)))
if not TestMode:
Expand Down
2 changes: 1 addition & 1 deletion opem/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def main():
"(Dynamic) Padulles Hauer Analysis": "Padulles_Hauer Analysis (Dynamic)",
"(Dynamic) Padulles Amphlett Analysis": "Padulles_Amphlett Analysis (Dynamic)",
"(Dynamic) Chakraborty Analysis": "Chakraborty_Analysis (Dynamic)"}
MENUKEYS = sorted(MENU.keys())
MENUKEYS = sorted(MENU)
EXITFLAG = False
parser = argparse.ArgumentParser()
parser.add_argument('--version', help='version', nargs="?", const=1)
Expand Down
2 changes: 1 addition & 1 deletion otherfile/notebook_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
print("\nCopying ...")
for index, item in enumerate(sorted(COPY_DICT)):
shutil.copy(item, COPY_DICT[item])
print("\t{0}.{1} --> {2} [OK]".format(index+1, item, COPY_DICT[item]))
print("\t{0}.{1} --> {2} [OK]".format(index + 1, item, COPY_DICT[item]))
4 changes: 2 additions & 2 deletions otherfile/version_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
os.path.join("otherfile", "meta.yaml"): META_ITEMS,
}

TEST_NUMBER = len(FILES.keys()) + 1
TEST_NUMBER = len(FILES) + 1


def print_result(failed=False):
Expand All @@ -78,7 +78,7 @@ def print_result(failed=False):


if __name__ == "__main__":
for file_name in FILES.keys():
for file_name in FILES:
try:
file_content = codecs.open(
file_name, "r", "utf-8", 'ignore').read()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def read_description():
description='Open Source PEM Cell Simulation Tool',
long_description=read_description(),
long_description_content_type='text/markdown',
author='Sepand Haghighi,Kasra Askari,Sarmin Hamidi,Mohammad Mahdi Rahimi',
author='ECSIM Development Team',
author_email='opem@ecsim.ir',
url='https://github.com/ecsim/opem',
download_url='https://github.com/ecsim/opem/tarball/v1.3',
Expand Down
2 changes: 1 addition & 1 deletion test/test_Functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
>>> filter_range(500,0,-0.1)
[0, 500, 0.1]
>>> Input_dict=Get_Input({"T": "Cell Operation Temperature [K]", "PH2": "Partial Pressure [atm]", "PO2": "Partial Pressure [atm]"},input_item=input_test)
>>> Input_keys=list(Input_dict.keys())
>>> Input_keys=list(Input_dict)
>>> Input_keys.sort()
>>> print(Input_keys)
['Name', 'PH2', 'PO2', 'T']
Expand Down

0 comments on commit a7641a9

Please sign in to comment.