mirror of
https://github.com/LCPQ/EMSL_Basis_Set_Exchange_Local
synced 2024-10-31 19:23:42 +01:00
PEP 8 format
This commit is contained in:
parent
2ca24930a4
commit
6347860b10
@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import re
|
import re
|
||||||
import sys, os
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
debug = True
|
||||||
|
|
||||||
debug=True
|
|
||||||
|
|
||||||
class EMSL_dump:
|
class EMSL_dump:
|
||||||
|
|
||||||
@ -28,19 +30,19 @@ class EMSL_dump:
|
|||||||
|
|
||||||
url = "https://bse.pnl.gov/bse/portal/user/anon/js_peid/11535052407933/panel/Main/template/content"
|
url = "https://bse.pnl.gov/bse/portal/user/anon/js_peid/11535052407933/panel/Main/template/content"
|
||||||
if debug:
|
if debug:
|
||||||
import cPickle as pickle
|
import cPickle as pickle
|
||||||
dbcache = 'db/cache'
|
dbcache = 'db/cache'
|
||||||
if not os.path.isfile(dbcache):
|
if not os.path.isfile(dbcache):
|
||||||
page = self.requests.get(url).text
|
page = self.requests.get(url).text
|
||||||
file=open(dbcache,'w')
|
file = open(dbcache, 'w')
|
||||||
pickle.dump(page,file)
|
pickle.dump(page, file)
|
||||||
else:
|
else:
|
||||||
file=open(dbcache,'r')
|
file = open(dbcache, 'r')
|
||||||
page = pickle.load(file)
|
page = pickle.load(file)
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
page = self.requests.get(url).text
|
page = self.requests.get(url).text
|
||||||
|
|
||||||
print "Done"
|
print "Done"
|
||||||
|
|
||||||
@ -121,23 +123,24 @@ class EMSL_dump:
|
|||||||
import Queue
|
import Queue
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
num_worker_threads=7
|
num_worker_threads = 7
|
||||||
q_in = Queue.Queue(num_worker_threads)
|
q_in = Queue.Queue(num_worker_threads)
|
||||||
q_out = Queue.Queue(num_worker_threads)
|
q_out = Queue.Queue(num_worker_threads)
|
||||||
|
|
||||||
basis_raw = {}
|
basis_raw = {}
|
||||||
|
|
||||||
def worker():
|
def worker():
|
||||||
while True:
|
while True:
|
||||||
[name, url, des, elts] = q_in.get()
|
[name, url, des, elts] = q_in.get()
|
||||||
url = self.create_url(url, name, elts)
|
url = self.create_url(url, name, elts)
|
||||||
q_out.put ( ([name, url, des, elts], self.requests.get(url).text) )
|
q_out.put(
|
||||||
q_in.task_done()
|
([name, url, des, elts], self.requests.get(url).text))
|
||||||
|
q_in.task_done()
|
||||||
|
|
||||||
def enqueue():
|
def enqueue():
|
||||||
for [name, url, des, elts] in list_basis_array:
|
for [name, url, des, elts] in list_basis_array:
|
||||||
q_in.put( ([name, url, des, elts]) )
|
q_in.put(([name, url, des, elts]))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
t = threading.Thread(target=enqueue)
|
t = threading.Thread(target=enqueue)
|
||||||
t.daemon = True
|
t.daemon = True
|
||||||
@ -148,7 +151,7 @@ class EMSL_dump:
|
|||||||
t.daemon = True
|
t.daemon = True
|
||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
for i in range(len(list_basis_array)):
|
for i in range(len(list_basis_array)):
|
||||||
[name, url, des, elts], basis_raw = q_out.get()
|
[name, url, des, elts], basis_raw = q_out.get()
|
||||||
try:
|
try:
|
||||||
basis_data = self.basis_data_row_to_array(
|
basis_data = self.basis_data_row_to_array(
|
||||||
@ -158,7 +161,7 @@ class EMSL_dump:
|
|||||||
conn.commit()
|
conn.commit()
|
||||||
print i, name
|
print i, name
|
||||||
except:
|
except:
|
||||||
print name, url, des, elts
|
print name, url, des, elts
|
||||||
pass
|
pass
|
||||||
conn.close()
|
conn.close()
|
||||||
q_in.join()
|
q_in.join()
|
||||||
@ -226,23 +229,23 @@ class EMSL_local:
|
|||||||
return d
|
return d
|
||||||
|
|
||||||
format_dict = \
|
format_dict = \
|
||||||
{
|
{
|
||||||
"g94": "Gaussian94" ,
|
"g94": "Gaussian94",
|
||||||
"gamess-us": "GAMESS-US" ,
|
"gamess-us": "GAMESS-US",
|
||||||
"gamess-uk": "GAMESS-UK" ,
|
"gamess-uk": "GAMESS-UK",
|
||||||
"turbomole": "Turbomole" ,
|
"turbomole": "Turbomole",
|
||||||
"tx93" : "TX93" ,
|
"tx93": "TX93",
|
||||||
"molpro" : "Molpro" ,
|
"molpro": "Molpro",
|
||||||
"molproint" : "MolproInt" ,
|
"molproint": "MolproInt",
|
||||||
"hondo" : "Hondo" ,
|
"hondo": "Hondo",
|
||||||
"supermolecule" : "SuperMolecule" ,
|
"supermolecule": "SuperMolecule",
|
||||||
"molcas" : "Molcas" ,
|
"molcas": "Molcas",
|
||||||
"hyperchem" : "HyperChem" ,
|
"hyperchem": "HyperChem",
|
||||||
"dalton" : "Dalton" ,
|
"dalton": "Dalton",
|
||||||
"demon-ks" : "deMon-KS" ,
|
"demon-ks": "deMon-KS",
|
||||||
"demon2k" : "deMon2k" ,
|
"demon2k": "deMon2k",
|
||||||
"aces2" : "AcesII" ,
|
"aces2": "AcesII",
|
||||||
}
|
}
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user