Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_stdin_seek(self):
"""We shouldn't be able to seek anywhere in standard input."""
wrapper = cclib.parser.logfileparser.FileWrapper(sys.stdin)
self.assertRaises(IOError, wrapper.seek, 0, 0)
self.assertRaises(IOError, wrapper.seek, 0, 1)
def setUp(self):
self.data = cclib.parser.logfileparser.ccData()
def test_file_seek(self):
"""Can we seek anywhere in a file object?"""
fpath = os.path.join(__datadir__,"data/ADF/basicADF2007.01/dvb_gopt.adfout")
with open(fpath, 'r') as fobject:
wrapper = cclib.parser.logfileparser.FileWrapper(fobject)
wrapper.seek(0, 0)
self.assertEqual(wrapper.pos, 0)
wrapper.seek(10, 0)
self.assertEqual(wrapper.pos, 10)
wrapper.seek(0, 2)
self.assertEqual(wrapper.pos, wrapper.size)
"""Deleting frequencies relating to translations or rotations"""
i = 0
while i < len(vibfreqs):
if vibfreqs[i] == 0.0:
# Deleting frequencies that have value 0 since they
# do not correspond to vibrations.
del vibfreqs[i], vibdisps[i], vibirs[i]
i -= 1
i += 1
def after_parsing(self):
if hasattr(self, 'vibfreqs'):
self.deleting_modes(self.vibfreqs, self.vibdisps, self.vibirs)
class OldTurbomole(logfileparser.Logfile):
"""A Turbomole output file. Code is outdated and is not being used."""
def __init__(self, *args):
# Call the __init__ method of the superclass
super(Turbomole, self).__init__(logname="Turbomole", *args)
def __str__(self):
"""Return a string representation of the object."""
return "Turbomole output file %s" % (self.filename)
def __repr__(self):
"""Return a representation of the object."""
return 'Turbomole("%s")' % (self.filename)
def atlist(self, atstr):
# turn atstr from atoms section into array