from __future__ import absolute_import import atexit from pacu.util.path import Path from pacu.util.newtype.incremental_hash import IncrementalHash try: from ctypes import wintypes as ctypes from ctypes import windll as cdll lib_basepath = Path.here('win') except: import ctypes from ctypes import cdll lib_basepath = Path.here('linux') class CDLLDescriptor(IncrementalHash): dll = None def __get__(self, inst, type): return self.dll if inst else self def __key_set__(self, key): try: self.dll = cdll.LoadLibrary(lib_basepath.joinpath(key).str) except OSError as e: print 'CDLL OSError:', e self.dll = NotImplemented return key
from pacu.util.path import Path import ujson as json raw_json = Path.here('all.json').read() features = json.loads(raw_json)