def open_modules(): """ Function that will load all modules """ dirs = os.listdir(path + "modules/") modules = {} for dir in dirs: modules[dir] = Module(dir, path) return modules
def lipo(self, platform, *frameworks): merged = super(FrameworkModule, self).lipo(platform, *frameworks) framework_module = FrameworkModule(Module( merged.name, merged.library_path, glob('{}/Headers/*.h'.format(merged.framework_path)), self.module.umbrella_header, self.module.submodules )) framework_module.framework_path = 'Frameworks/{}/{}.framework'.format( platform.name, self.name) framework_module.is_created = True framework_module.abs_path = os.path.abspath(merged.framework_path) return framework_module
def dice(d, file): """Output a Tracery module simulating a given dice roll using NdS notation.""" n, s = d.split('d') n = int(n) s = int(s) possibility_space = itertools.product([i+1 for i in range(s)], repeat=n) possibility_space = [sum(x) for x in possibility_space] virtual_name = 'dice({0})'.format(d) return Module( name=virtual_name, file_path='!dice({0})'.format(d), productions={ virtual_name: ['{0}'.format(x) for x in possibility_space] }, external=True, variables=set(), links=set() )
if manufacturer is None: return [ i['inverter'] for i in json.loads(open(SPATH + '/si.json').read()) ] else: a = [] for i in json.loads(open(SPATH + '/si.json').read()): if i['inverter'].find(manufacturer) != -1: a.append(i['inverter']) return a if __name__ == "__main__": from modules import Module, Array PANEL = Module('Mage Solar : Powertec Plus 245-6 PL *') INVERTER = Inverter("Enphase Energy: M215-60-SIE-S2x 240V", Array(PANEL, [{ 'series': 1 }])) print INVERTER.array print "" print INVERTER.dump() # si = sb6000us(s) print INVERTER.p_ac(950) print INVERTER.i_ac(960, 240) INVERTER = Inverter("SMA America: SB7000US-11 277V", Array(PANEL, [{ 'series': 11,
def p_newMod(p): 'modName : MODULE NAME' nonlocal curentMod curentMod = Module(p[2])