/usr/share/pyshared/statsmodels/tools/compatibility.py is in python-statsmodels 0.4.2-1.2.
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 | import numpy as np
try:
from numpy.linalg import slogdet as np_slogdet
except:
def np_slogdet(x):
return 1, np.log(np.linalg.det(x))
def getZipFile():
'''return ZipFile class with open method for python < 2.6
for python < 2.6, the open method returns a StringIO.StringIO file_like
Examples
--------
ZipFile = getZipFile()
...
not fully tested yet
written for pyecon
'''
import sys, zipfile
if sys.version >= '2.6':
return zipfile.ZipFile
else:
class ZipFile(zipfile.ZipFile):
def open(self, filename):
fullfilename = [f for f in self.namelist() if filename in f][0]
import StringIO
return StringIO.StringIO(self.read(fullfilename))
return ZipFile
|