10
0
mirror of https://github.com/LCPQ/EMSL_Basis_Set_Exchange_Local synced 2024-12-31 08:35:49 +01:00

Static method from list_format

This commit is contained in:
Thomas Applencourt 2015-03-23 15:12:23 +01:00
parent 9a70c61df8
commit db5695b4bf
2 changed files with 8 additions and 6 deletions

View File

@ -141,8 +141,7 @@ if __name__ == '__main__':
# | |___| \__ \ |_ | || (_) | | | | | | | | (_| | |_\__ \ # | |___| \__ \ |_ | || (_) | | | | | | | | (_| | |_\__ \
# \_____/_|___/\__| |_| \___/|_| |_| |_| |_|\__,_|\__|___/ # \_____/_|___/\__| |_| \___/|_| |_| |_| |_|\__,_|\__|___/
elif arguments["list_formats"]: elif arguments["list_formats"]:
e = EMSL_dump() for i in EMSL_dump.get_list_format():
for i in e.get_list_format():
print i print i
# _____ _ _ _ # _____ _ _ _

View File

@ -63,7 +63,8 @@ class EMSL_dump:
finally: finally:
self.requests = requests self.requests = requests
def get_list_format(self): @staticmethod
def get_list_format():
"""List all the format available in EMSL""" """List all the format available in EMSL"""
from src.parser_handler import parser_dict from src.parser_handler import parser_dict
return parser_dict.keys() return parser_dict.keys()
@ -135,6 +136,7 @@ class EMSL_dump:
name = tup[1] name = tup[1]
elts = re.sub('[["\ \]]', '', tup[3]).split(',') elts = re.sub('[["\ \]]', '', tup[3]).split(',')
des = re.sub('\s+', ' ', tup[-1]) des = re.sub('\s+', ' ', tup[-1])
d[name] = [name, xml_path, des, elts] d[name] = [name, xml_path, des, elts]
@ -148,7 +150,7 @@ class EMSL_dump:
# | \__/\ | | __/ (_| | || __/ # | \__/\ | | __/ (_| | || __/
# \____/_| \___|\__,_|\__\___| # \____/_| \___|\__,_|\__\___|
# #
def create_sql(self, dict_basis_list): def create_and_populate_sql(self, dict_basis_list):
"""Create the sql from strach. """Create the sql from strach.
Take the list of basis available data, Take the list of basis available data,
download her, put her in sql""" download her, put her in sql"""
@ -216,7 +218,8 @@ class EMSL_dump:
url = "https://bse.pnl.gov:443/bse/portal/user/anon/js_peid/11535052407933/action/portlets.BasisSetAction/template/courier_content/panel/Main/" url = "https://bse.pnl.gov:443/bse/portal/user/anon/js_peid/11535052407933/action/portlets.BasisSetAction/template/courier_content/panel/Main/"
url += "/eventSubmit_doDownload/true" url += "/eventSubmit_doDownload/true"
params = {'bsurl': path_xml, 'bsname': name, params = {'bsurl': path_xml,
'bsname': name,
'elts': " ".join(elts), 'elts': " ".join(elts),
'format': self.format, 'format': self.format,
'minimize': self.contraction} 'minimize': self.contraction}
@ -289,4 +292,4 @@ class EMSL_dump:
_data = self.dwl_basis_list_raw() _data = self.dwl_basis_list_raw()
array_basis = self.basis_list_raw_to_array(_data) array_basis = self.basis_list_raw_to_array(_data)
self.create_sql(array_basis) self.create_and_populate_sql(array_basis)