• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python update.update函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中update.update函数的典型用法代码示例。如果您正苦于以下问题:Python update函数的具体用法?Python update怎么用?Python update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了update函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: main

def main():
	print "- Starting ZeroNet..."
	import sys, os
	main = None
	try:
		sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src")) # Imports relative to src
		import main
		main.start()
		if main.update_after_shutdown: # Updater
			import update, sys, os, gc
			# Update
			update.update()

			# Close log files
			logger = sys.modules["main"].logging.getLogger()

			for handler in logger.handlers[:]:
				handler.flush()
				handler.close()
				logger.removeHandler(handler)

	except Exception, err: # Prevent closing
		import traceback
		traceback.print_exc()
		raw_input("-- Error happened, press enter to close --")
开发者ID:TigerND,项目名称:ZeroNet,代码行数:25,代码来源:zeronet.py


示例2: main

def main():
    print "- Starting ZeroNet..."

    main = None
    try:
        sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src/lib"))  # External liblary directory
        sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src"))  # Imports relative to src
        import main
        main.start()
        if main.update_after_shutdown:  # Updater
            import gc
            import update
            # Try cleanup openssl
            try:
                if "lib.opensslVerify" in sys.modules:
                    sys.modules["lib.opensslVerify"].opensslVerify.closeLibrary()
            except Exception, err:
                print "Error closing opensslVerify lib", err
            try:
                if "lib.pyelliptic" in sys.modules:
                    sys.modules["lib.pyelliptic"].openssl.closeLibrary()
            except Exception, err:
                print "Error closing pyelliptic lib", err

            # Update
            update.update()

            # Close log files
            logger = sys.modules["main"].logging.getLogger()

            for handler in logger.handlers[:]:
                handler.flush()
                handler.close()
                logger.removeHandler(handler)
开发者ID:Black-Umbrella,项目名称:ZeroNet,代码行数:34,代码来源:zeronet.py


示例3: do_config

def do_config(action,data):
    #=========================================================================#
    if action=="reboot":
        for name in sub_routines:
            sub_routines[name].stop()
            sub_routines[name].start()
        #TODO: do anything else
    #=========================================================================#
    elif action=="update":
        update.update()
    #=========================================================================#
    elif action=="script":
        if "script" in data:
            script=data["script"]
            with open("temp_script","w") as tsf:
                tsf.write(script)
                tsf.close()
                subprocess.call(["chmod","+x","temp_script"])
                subprocess.call(["temp_script"])
        else:
            pass
    #=========================================================================#
    elif action=="calibrate":
        if "Sender" in sub_routines:
            mult=data.get("mult_by",1.0)
            add=data.get("add_by",0.0)
            sub_routines["Sender"].getInterface().Calibrate(mult,add)
    #=========================================================================#
    else:
        pass
开发者ID:H2NCH2COOH,项目名称:pcDuino-Dustdatacollect,代码行数:30,代码来源:remote_config.py


示例4: main

def main():
    print "- Starting ZeroNet..."

    main = None
    try:
        app_dir = os.path.dirname(os.path.abspath(__file__))
        os.chdir(app_dir)  # Change working dir to zeronet.py dir
        sys.path.insert(0, os.path.join(app_dir, "src/lib"))  # External liblary directory
        sys.path.insert(0, os.path.join(app_dir, "src"))  # Imports relative to src
        import main
        main.start()
        if main.update_after_shutdown:  # Updater
            import gc
            import update
            import atexit
            # Try cleanup openssl
            try:
                if "lib.opensslVerify" in sys.modules:
                    sys.modules["lib.opensslVerify"].opensslVerify.closeLibrary()
            except Exception, err:
                print "Error closing opensslVerify lib", err
            try:
                if "lib.pyelliptic" in sys.modules:
                    sys.modules["lib.pyelliptic"].openssl.closeLibrary()
            except Exception, err:
                print "Error closing pyelliptic lib", err

            # Close lock file
            sys.modules["main"].lock.close()

            # Update
            try:
                update.update()
            except Exception, err:
                print "Update error: %s" % err
开发者ID:qci133,项目名称:ZeroNet,代码行数:35,代码来源:zeronet.py


示例5: main

def main():
	print "- Starting ZeroNet..."
	import sys, os
	main = None
	try:
		sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src")) # Imports relative to src
		import main
		main.start()
		if main.update_after_shutdown: # Updater
			import update, sys, os, gc
			# Try cleanup openssl
			try:
				if "lib.opensslVerify" in sys.modules:
					sys.modules["lib.opensslVerify"].opensslVerify.close()
			except Exception, err:
				print "Error closing openssl", err

			# Update
			update.update()

			# Close log files
			logger = sys.modules["main"].logging.getLogger()

			for handler in logger.handlers[:]:
				handler.flush()
				handler.close()
				logger.removeHandler(handler)

	except Exception, err: # Prevent closing
		import traceback
		traceback.print_exc()
		traceback.print_exc(file=open("log/error.log", "a"))
开发者ID:shea256,项目名称:ZeroNet,代码行数:32,代码来源:zeronet.py


示例6: main

def main():

	pygame.init()
	globals.pygame = pygame # assign global pygame for other modules to reference
	globals.inputs = Inputs(pygame) # assign global inputs for other modules to reference
	update_display_mode() # now that the global display properties have been set up, update the display
	clock = pygame.time.Clock() # clock to tick / manage delta

	entities = [] # contains every object that will be drawn in the game

	entities.append(Entity()) # our testing entity will be the default entity

	loop = True # for controlling the game loop

	while(loop):
		clock.tick(60) # tick the clock with a target 60 fps
		globals.window.fill((255, 255, 255))

		globals.inputs.update() # refresh inputs

		update(entities) # update all entities
		render(entities) # draw all entities

		if(globals.inputs.isKeyDown("space")): toggle_fullscreen() # space bar toggles fullscreen
		if(globals.inputs.isKeyDown("escape")): loop = False # escape key exits game
		if(globals.inputs.isQuitPressed()): loop = False # red 'x' button exits game

		pygame.display.flip() # flip the display, which finally shows our render

	pygame.quit() # unload pygame modules
开发者ID:ctjprogramming,项目名称:PygameFullscreenToggleDemo,代码行数:30,代码来源:game.py


示例7: sudoku

def sudoku(A):
    # =====================================================================
    # A: 9x9 np.array int, stores the real sudoku matrix
    # B: 9x9 np.array int, corresponds to A
    #	 undecided position: stores number of options
    #    filled position: stores 10
    # C: 9x9 2d list set of int's
    #    undecided position: stores a set of  all options for each position
    #    filled position: 0
    # =====================================================================
    B = np.zeros((9,9), dtype=int)
    C = [[0 for x in xrange(9)] for x in xrange(9)]
    
    #pivot_stack:
    #   A stack storing all pivot points that facilitate back-tracing algorithm
    pivot_stack = []
    StackElem = namedtuple('StackElem', 'ind choice A')
   
    A_old = A.copy()
    conflict = update(A,B,C)
#    update_counter = 1
#    print "="*30
#    print "Update %d" %update_counter
#    update_counter = update_counter + 1

    #sudoku_print(A)

#    color_print(A_old, A)
    #sudoku_print(A)
    while(A.min() == 0):
        if(not conflict):
            i,j = get_leastopt_ind(B)
            elem = StackElem((i,j), list(C[i][j]), A.copy())
            pivot_stack.append(elem)
        else:
            if(len(pivot_stack[-1].choice) > 1):
                del pivot_stack[-1].choice[0]
            else:
                while(len(pivot_stack[-1].choice) == 1):
                    del pivot_stack[-1]
                del pivot_stack[-1].choice[0]
            np.copyto(A, pivot_stack[-1].A)

        i,j = pivot_stack[-1].ind
        np.copyto(A_old, A)

        A[i,j] = pivot_stack[-1].choice[0]
        conflict = update(A,B,C)
开发者ID:AkiraKane,项目名称:Project_Euler,代码行数:48,代码来源:prob_96.py


示例8: do_update

    def do_update(self, event):
        # Action name
        action = strings.UPDATING_APPSNAP
        
        # Disable GUI
        self.disable_gui()
        
        # Update statusbar
        self.update_status_bar(action, strings.DOWNLOADING + ' ...')

        # Perform the update
        update_obj = update.update(self.configuration, self.curl_instance)
        returned = update_obj.update_appsnap()
        
        if returned == update.SUCCESS:
            self.update_status_bar(action, strings.RELOADING_APPSNAP + ' ...')
            time.sleep(defines.SLEEP_GUI_DB_UPDATE_STEP)
            self.do_restart()
        elif returned == update.UNCHANGED:
            self.update_status_bar(action, strings.NO_CHANGES_FOUND)
            time.sleep(defines.SLEEP_GUI_DB_UPDATE_STEP)
        elif returned == update.NEW_BUILD:
            return self.error_out(action, strings.NEW_BUILD_REQUIRED)
        elif returned == update.READ_ERROR:
            return self.error_out(action, strings.UNABLE_TO_READ_APPSNAP)
        elif returned == update.WRITE_ERROR:
            return self.error_out(action, strings.UNABLE_TO_WRITE_APPSNAP)
        elif returned == update.DOWNLOAD_FAILURE:
            return self.error_out(action, strings.DOWNLOAD_FAILED)

        # Reset the GUI
        self.update_status_bar('', '')
        self.enable_gui()
开发者ID:Alwnikrotikz,项目名称:appsnap,代码行数:33,代码来源:guisetup.py


示例9: __init__

    def __init__(self):
        #
        QtGui.QDialog.__init__(self)
        self.setupUi(self)
        #self.__about = aboutDialog()
        self.__options = optionsDialog()
        self.__aboutDialog = aboutDialog()
        self.__logsDialog = logsDialog()
        self.__update = update()


        #Aliases for GUI objects
        self.__status = self.label_3
        self.__ip = self.label_4
        self.__ipStatus = self.label_12
        self.__lastupdateIp = self.label_7
        self.__lastupdateTime = self.label_9


        #Get user dialogs and decriptions
        self.i18n()

        #Refresh
        self.on_pushButton_9_clicked()

        self.__options.load()
开发者ID:alierkanimrek,项目名称:pog,代码行数:26,代码来源:main.py


示例10: main

def main():
    """Main game function."""
    try:
        data = load_data()
        data = update.update(data)
    except:
        # print(sys.exc_info())
        data_constructor.build_data()
        data = load_data()
    data["want_to_play"] = True
    data["start"] = time.time()
    actions = {"quit": quit,
               "look": check_status,
               "shop": buy_menu.menu,
               "yard": placement.menu,
               "collect money": collect_money,
               "check food": placement.check_food,
               "help": print_help}
    banner()
    data["prefix"] = "{.BLUE}[Welcome!]{.ENDC}".format(
        printer.PColors, printer.PColors)
    check_status(data)
    data["prefix"] = "[Main Menu]"
    while data["want_to_play"] is True:
        data["prefix"] = "{.MAIN}[Main Menu]{.ENDC}".format(
            printer.PColors, printer.PColors)
        printer.prompt(data["prefix"], actions.keys())
        inp = input("{0} Choose an action! ".format(data["prefix"]))
        # pdb.set_trace()
        if inp in actions:
            actions[inp](data)
            continue
        else:
            printer.invalid(data["prefix"])
开发者ID:tennysonholloway,项目名称:nekoatsume,代码行数:34,代码来源:display.py


示例11: newest_version

 def newest_version(self):
     if(self.satisfy()):
         ud = update(self);
         return ud.check();
     else:
         # pretend we are up to date if not installed
         return True;
开发者ID:newman,项目名称:pybombs,代码行数:7,代码来源:recipe.py


示例12: main

def main():
    print ("test")
    #inialize
    ldr = LightSensor(4) ;
    var = 1
    value = 1
    #have the  program loop forever or until the user close the file
    while var != 0:
        var = 1
        if ldr.value != 0:
            toaddr = "[email protected]"  #email address to send email to
            now = datetime.datetime.now()           #time and date that the laser is tripped
            filename = str(now) + ".JPG"                   #name of picture file to send
            #take a picture
            newcam = cam(filename)
            newcam.takePic()
            #send the notification that the wire is tripped with the photo
            newEmail = Email(toaddr, filename)
            newEmail.SendEmail()
            #update the html
            up = update(filename)
            up.updateHTML()
            #upload the file to update the website
            upload = FTPClass()
            upload.UploadFile(filename)
            upload.UploadFile("index.html")
        #won't anymore picture to be taken until the laser hit the sensor
	    while ldr.value !=0:
		    print('0')
	else:
	    print('X')
开发者ID:quoc125,项目名称:TripWire,代码行数:31,代码来源:main.py


示例13: run

	def run(self):
		time.sleep(5)
	#	print self.name
		# 更新文件信息
		mp3 = update.update(self.Data,self.mylock)
		mp3.search()
	#	print self.Data[0] + '/' +self.Data[1] + '.mp3'
		self.data.get()
开发者ID:ikimi,项目名称:douban,代码行数:8,代码来源:queue.py


示例14: __init__

    def __init__(self):
        ShowBase.__init__(self)

        self.world = createWorld(self.render)
        self.player = spawnPlayer(self.render, 0)
        self.player_cam = cameraControl("reparent", self.render.find("player_node"))
        self.create_filter = filters()
        self.update = update(self.render)
开发者ID:flips30240,项目名称:Run-Free,代码行数:8,代码来源:main.py


示例15: testUpdate

 def testUpdate(self):
     for inp, outp in self.update_cases.iteritems():
         # convert integers into boolean arrays
         inp_arr = i2a(*inp)
         outp_arr = i2a(*outp)
         # run the input array
         test_out = update.update(inp_arr, n1_wrap, rules.wolfram(30))
         # compare to the output array
         assert(numpy.all(test_out == outp_arr))
开发者ID:btbonval,项目名称:onedimensionalcellularautomata,代码行数:9,代码来源:tests.py


示例16: main

def main():
    print "- Starting ZeroNet..."

    main = None
    try:
        sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src"))  # Imports relative to src
        import main
        main.start()
        if main.update_after_shutdown:  # Updater
            import gc
            import update
            # Try cleanup openssl
            try:
                if "lib.opensslVerify" in sys.modules:
                    sys.modules["lib.opensslVerify"].opensslVerify.closeLibrary()
            except Exception, err:
                print "Error closing openssl", err

            # Update
            update.update()

            # Close log files
            logger = sys.modules["main"].logging.getLogger()

            for handler in logger.handlers[:]:
                handler.flush()
                handler.close()
                logger.removeHandler(handler)

    except (Exception, ):  # Prevent closing
        import traceback
        traceback.print_exc()
        traceback.print_exc(file=open("log/error.log", "a"))

    if main and main.update_after_shutdown:  # Updater
        # Restart
        gc.collect()  # Garbage collect
        print "Restarting..."
        args = sys.argv[:]
        args.insert(0, sys.executable)
        if sys.platform == 'win32':
            args = ['"%s"' % arg for arg in args]
        os.execv(sys.executable, args)
        print "Bye."
开发者ID:TamtamHero,项目名称:ZeroNet,代码行数:44,代码来源:zeronet.py


示例17: update

	def update(self,key,value=None):
		uri_backup = self.uri
		Data = self.data
		
		result = update(key,value,Data)
		try:
			self.__init__(result)
			#print result
		except:
			self.uri = uri_backup
			self.data = Data
			raise Exception("syntax error in updating '%s' key"%(key))
开发者ID:pravj,项目名称:pyURI,代码行数:12,代码来源:uri.py


示例18: _libInit

	def _libInit (self):
		try:
			# Initialize the main plugin engine
			self.plug = plug (self)
			self.update = update (self)
			self.ui = ui (self)
			self.support = support (self)
		
			self.logger.threaddebug("Dynamic libraries complete")
			
		except Exception as e:
			self.logger.error (ext.getException(e))	
开发者ID:Colorado4Wheeler,项目名称:Powermiser,代码行数:12,代码来源:eps.py


示例19: main

def main():
    if len(sys.argv) > 1:
        global outputdir
        update.outputdir = outputdir = sys.argv[1]

    for station, code in eismoinfo.EismoInfo.ids.items():
        print station
        text = requests.get(URL.format(code, 1500)).text
        data = json.loads(text.split('<!DOCTYPE')[0])
        data.sort(key=lambda d: d["surinkimo_data_unix"])
        for chunk in grouper(100, data):
            sys.stdout.write(".")
            sys.stdout.flush()
            maxes = []
            avgs = []
            dirs = []
            for item in chunk:
                if item is None:
                    break
                item["irenginys"] = station
                readout = eismoinfo.Station(item)
                maxes.append((readout.timestamp, readout.max))
                avgs.append((readout.timestamp, readout.avg))
                dirs.append((readout.timestamp, readout.dir))
            # TODO: bunch up updates into a single command
            update.update("%s-max.rrd" % station, maxes)
            update.update("%s-avg.rrd" % station, avgs)
            update.update("%s-dir.rrd" % station, dirs)
        print

    os.system("sh graph.sh %s > /dev/null 2>&1 " % outputdir)
开发者ID:alga,项目名称:vejas,代码行数:31,代码来源:populate.py


示例20: run

def run():
	# Login and save the html file to gen
	logging.info('Login and saving notice board html to gen')
	tpo = TpoSession()
	tpo.login()

	# From the html file, extract and save the notices
	logging.info('Extracting notice from notice board html.')
	num = insert.insert()
	if num is None:
		logging.error("Error encountered during extraction. Exiting.")
		exit()
	logging.info("Inserted %d notices.", num)

	# Update the json files to include the notice details and attachments
	logging.info('Updating json files')
	update.update()

	# Send the unsent notices
	logging.info('Sending unsent notices.')
	send.send_unsent()

	logging.info("Finished running script.")
开发者ID:nitingera1996,项目名称:tpo-forum-notification,代码行数:23,代码来源:run.py



注:本文中的update.update函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python update_from_github.current_version函数代码示例发布时间:2022-05-27
下一篇:
Python kicad.KiCAD类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap