/usr/share/psi/python/qcdb/dbproc.py is in psi4-data 1:0.3-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | #
#@BEGIN LICENSE
#
# PSI4: an ab initio quantum chemistry software package
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#@END LICENSE
#
r"""File to
"""
import sys
import os
import glob
import ast
def useful():
print "in qcdb.useful()"
return 'qcdb successfully accessed'
def drop_duplicates(seq):
"""Function that given an array or array of arrays *seq*, returns an
array without any duplicate entries. There is no guarantee of which
duplicate entry is dropped.
"""
noDupes = []
seq2 = sum(seq, [])
[noDupes.append(i) for i in seq2 if not noDupes.count(i)]
return noDupes
def dictify_database_docstrings():
"""
"""
db_path = os.path.dirname(__file__) + '/../databases'
DSD = {}
module_choices = []
for module in glob.glob(db_path + '/*.py'):
filename = os.path.split(module)[1]
basename = os.path.splitext(filename)[0]
div = '=' * len(basename)
module_choices.append(basename)
DSD[basename] = {}
M = ast.parse(''.join(open(module)))
DS = ast.get_docstring(M)
if not DS:
DS = ""
DS = str.replace(DS, '|dl|', '-->')
DS = str.replace(DS, '|dr|', '<--')
DS = str.replace(DS, "``'", '')
DS = str.replace(DS, "'``", '')
lst = DS.split("\n- **")
#DSD[basename]['general'] = str.replace(lst[0], '|', '')
DSD[basename]['general'] = lst[0].split('\n')
try:
DSD[basename]['cp'] = [section for section in lst if section.startswith("cp")][0]
except IndexError:
DSD[basename]['cp'] = None
try:
DSD[basename]['rlxd'] = [section for section in lst if section.startswith("rlxd")][0]
except IndexError:
DSD[basename]['rlxd'] = None
try:
DSD[basename]['benchmark'] = [section for section in lst if section.startswith("benchmark")][0]
except IndexError:
DSD[basename]['benchmark'] = None
try:
#DSD[basename]['subset'] = [section for section in lst if section.startswith("subset")][0]
temp = [section for section in lst if section.startswith("subset")][0].splitlines()
temp = temp[2:]
result = {}
for item in temp:
item = item.lstrip(" -")
try:
key, val = item.split(" ", 1)
result[key] = val
except ValueError:
result[item] = ""
DSD[basename]['subset'] = result
except IndexError:
DSD[basename]['subset'] = {"": 'No subsets available'}
return DSD
# print '\ngeneral\n\n', DSD[basename]['general']
# print '\ncp\n\n', DSD[basename]['cp']
# print '\nrlxd\n\n', DSD[basename]['rlxd']
# print '\nbenchmark\n\n', DSD[basename]['benchmark']
# print '\nsubset\n\n', DSD[basename]['subset']
#print ' %-12s %s' % ('[' + basename + ']', DSD[basename]['general'][0])
#print 'DSD2\n', DSD['S22']['subset']
|