import importdir import os importdir.do(os.getcwd(), globals())
# Create Bottle instance rootapp = Bottle() #### Dynamically import addons import importdir, glob addons = [] addonmenus = {} addondescriptions = {} if not os.path.exists(APPDIR +'/addons/'): os.mkdir(APPDIR +'/addons/') for i in glob.glob(os.path.dirname(APPDIR +'/addons/')+"/*/"): try: importdir.do(i, globals()) addons.append(os.path.split(os.path.realpath(i))[1]) modulename = addons[-1] rootapp.mount('/'+modulename, eval((modulename + '.app'))) except Exception, err: log.error("Error importing module: %s" % err) # Build Addon menu for a in addons: try: addonmenus[a] = eval(a).menuitems() addondescriptions[a] = eval(a).describe() except Exception, err: log.error("Error importing %s: %s" %(a, err)) d['addonmenus'] = addonmenus
import tgl #Import commands import importdir importdir.do("commands", globals()) importdir.get_names("commands") module_list = importdir.module_list tgl.PEER_USER = 1 tgl.PEER_CHAT = 2 tgl.PEER_ENCR_CHAT = 4 allow_messages = False bot_id = "" def on_binlog_replay_end(): "This is called when replay of old events end. Any updates prior this call were already received by this client some time ago." def on_get_difference_end(): "This is called after first get_difference call. So we received all updates after last client execute." #Finished launching, allowing commands now global allow_messages allow_messages = True def on_our_id(our_id): "Informs about id of currently logged in user." global bot_id bot_id = our_id def on_msg_receive(msg):
from colorclass import Color print(Color('{autored}[{/red}{autoyellow}+{/yellow}{autored}]{/red} {autocyan}Cargando plugins...{/cyan}')) from config import * import importdir import sys ################################################# # BOT BODY # ################################################# if sys.version_info.major < 3: raise Exception("Must be using Python 3") importdir.do('plugins', globals()) print(Color('{autored}[{/red}{autoyellow}+{/yellow}{autored}]{/red} {autocyan}Plugins cargados.{/cyan}')) try: logBot.send_message( 52033876, "@League_of_Legends_bot ha sido encendido") except Exception as e: bot.send_message( 52033876, str(e)) print(Color('{autored}[{/red}{autoyellow}+{/yellow}{autored}]{/red} {autocyan}@League_of_Legends_bot ha sido encendido.{/cyan}\n')) ################################################# # POLLING # #################################################
from eppy import modeleditor from eppy.modeleditor import IDF import csv import importdir # Initialization #1 importdir.do("Functions",globals()) IDDFile = 'C:\EnergyPlusV8-3-0\Energy+.idd' IDF.setiddname(IDDFile) BatchProcesingFile = open("BatchProcessing.csv","r") BatchProcessing = list(csv.reader(BatchProcesingFile, delimiter=',', quotechar=chr(34))) Idx = 0 for i in range(0,len(BatchProcessing)): # Display the progress of the script if Idx >= 2: print "Creating "+str(Idx-1)+" out of "+str(len(BatchProcessing)-2)+" models." # Initialization #2 NbRows = BatchProcessing[i] if NbRows[0] <> 'idf' and NbRows[0] <> '-': # Initialization #3 idf_file = IDF(NbRows[0]) # Iterates throught the CSV file and execute the specified functions for j in range(2,len(NbRows)): # Retrieve the user input arguments arguments = NbRows[j].split(",") #print str(len(arguments))+" " +str(arguments[0])
#!/usr/bin/env python # -*- coding: utf-8 -*- from utils import * import importdir importdir.do("plugins", globals()) try: bot.send_message(adminid, "*Bot loaded and ready for action!*", parse_mode="Markdown") except: pass def poll(option): if option == "debug": print "Bot: debug mode" bot.polling(True) else: try: print "Bot: running" bot.polling(none_stop=False, interval=0) except KeyboardInterrupt: pass except: try: print "\nUnexpected error:", sys.exc_info()[0] print "\n\t" + unicode(sys.exc_info()[1]) + "\n" bot.send_message( adminid, "\n*Unexpected error:*\n"
from __future__ import with_statement from alembic import context from sqlalchemy import engine_from_config, pool from logging.config import fileConfig import importdir importdir.do('models', globals()) from utils import Base # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config # Interpret the config file for Python logging. # This line sets up loggers basically. fileConfig(config.config_file_name) # add your model's MetaData object here # for 'autogenerate' support # target_metadata = mymodel.Base.metadata target_metadata = Base.metadata # other values from the config, defined by the needs of env.py, # can be acquired: # my_important_option = config.get_main_option("my_important_option") # ... etc. def run_migrations_offline(): """Run migrations in 'offline' mode. This configures the context with just a URL