示例#1
0
def main(args):
    suffix = args.module.rsplit('.', 1)[-1]
    if suffix in ('so', 'pyd', 'pyx'):
        utils.compiler(args.setup)
    compute_julia = utils.importer(args.module, args.function)
    jla, time = compute_julia(args.cr, args.ci, args.N, 2.0, 4., args.cutoff)
    print "Compute time: %fs" % time
示例#2
0
def main(args):
    suffix = args.module.rsplit('.', 1)[-1]
    if suffix in ('so', 'pyd', 'pyx'):
        utils.compiler(args.setup)
    compute_julia = utils.importer(args.module, args.function)
    jla, time = compute_julia(args.cr, args.ci, args.N, 2.0, 4., args.cutoff)
    print "Compute time: %fs" % time
示例#3
0
def main(args):
    suffix = args.module.rsplit('.', 1)[-1]
    if suffix in ('so', 'pyd', 'pyx'):
        utils.compiler(args.setup)
    compute_julia = utils.importer(args.module, args.function)
    julia = Julia(compute_julia=compute_julia)
    jui = JuliaUI(model=julia)
    jui.configure_traits()
示例#4
0
def text_reply(bot, update):
    ds = {
        'Arrays' : 'array-data-structure/',
        'Linked list' : 'data-structures/linked-list/',
        'Stack' : 'stack-data-structure/',
        'Queue' : 'queue-data-structure/',
        'Binary Tree' : 'binary-tree-data-structure/',
        'Binary Search Tree' : 'binary-search-tree-data-structure/',
        'Heap' : 'heap-data-structure/',
        'Hashing' : 'hashing-data-structure/',
        'Graph' : 'graph-data-structure-and-algorithms/',
        'Advance Data Structure' : 'advanced-data-structures/',
        'Matrix' : 'matrix/',
        'Strings' : 'string-data-structure/'
    }

    lang = {
        "c++": "cpp14",
        "c": "c",
        "php": "php",
        "java": "java",
        "python": "python3"
    }

    text = update.message.text

    lines = text.split(" ")
    if lines[0]=="!code":
        language = lines[1].lower()
        if language in lang.keys():
            count=0
            for idx,char in enumerate(text):
                if count == 2:
                    break

                if char == ' ':
                    count += 1
            
            logger.info("Started compiling...!!!")
            data = compiler(code=text[idx:], lang=lang[language])
            bot.send_message(chat_id=update.message.chat_id, text="<b>Output-</b>\n"+data['output'], parse_mode=ParseMode.HTML)


        else:
            logger.error("{} caused error {}".format(lines[1],"Language not supported"))
            lang_error = "Language not supported. Make sure you have given a valid language. For more info- Text '/language' to the bot"
            bot.send_message(chat_id=update.message.chat_id, text=lang_error)



    else:
        response = detect_intent_from_text(text,update.message.chat_id)
    
        if response.fulfillment_text:
            reply = response.fulfillment_text
            bot.send_message(chat_id=update.message.chat_id, text=reply)
        elif bool(dict(response.parameters)):
            data = dict(response.parameters)
            topic = data['topic']

            logger.info("Fetching data and articles on {}.".format(topic))
            with open("scraper.bat", 'w') as fp:				#For linux, create "scraper.sh", a script file to run
                fp.write("cd botSpider\n")
                fp.write("scrapy crawl bot -a category="+ds[topic]+'\n')
                fp.write("cd ..\n")

            subprocess.call([r'scraper.bat'])					#For linux, call for ['sh', 'scraper.sh'] instead of [r'scraper.bat']

            with open("botSpider/article.txt",'r') as f:
                reply = f.read()
        
            try:
                bot.send_message(chat_id=update.message.chat_id, text=reply)
                
            except:
                bot.send_message(chat_id=update.message.chat_id, text="Article is too long to display")
            
            logger.info("Getting video information...!!!")
            links = video_links(query=topic+'Data structures')
            for l in links:
                bot.send_message(chat_id=update.message.chat_id, text=l)
示例#5
0
 def compileAndSignApkOne(self):
     comp = compiler(self.path)
     cmd = comp.apktool()
     self.path_two = comp.newApk()
     self.processTool(self.path, cmd, self.label_2, self.compileAndSignApkTwo)
     self.progressApk(self.printLoadingCompile)
示例#6
0
 def compileApk(self):
     cmd = compiler(self.path).apktool()
     self.processTool(self.path, cmd, self.label_2, self.endProcess)
     self.progressApk(self.printLoadingCompile)