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

Python system.System类代码示例

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

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



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

示例1: BRTest

class BRTest(unittest.TestCase):
    def showMsg(self, msg):
        print "[%s/%s/%s] %s" % (self.testname, self.testinstance,
                                 datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
                                 msg)
    def setUp(self):
        if os.getenv("REUSE_BUILD"):
            self.builddir = os.getenv("REUSE_BUILD").rstrip("/")
            skip_build = True
        else:
            skip_build = False
            b = subprocess.check_output(["mktemp", "-d", "buildroot.XXXXX"],
                                        cwd=configtest.builddir)
            b = b.strip()
            self.builddir = os.path.join(configtest.builddir, b)
        self.testname = self.__class__.__name__
        self.testinstance = os.path.basename(self.builddir)
        self.buildlog = self.builddir + "-build.log"
        self.runlog = self.builddir + "-run.log"
        self.s = None
        self.showMsg("Starting")
        self.b = Builder(self.__class__.config, self.builddir, self.buildlog)
        if not skip_build:
            self.showMsg("Building")
            self.b.build()
            self.showMsg("Building done")
        self.s = System(self.runlog)

    def tearDown(self):
        self.showMsg("Cleaning up")
        if self.s:
            self.s.stop()
        if self.b and os.getenv("KEEP_BUILD"):
            self.b.delete()
开发者ID:linux4hach,项目名称:buildroot-runtime-test,代码行数:34,代码来源:basetest.py


示例2: main

def main():
    # Solar system data comes from
    #   http://hyperphysics.phy-astr.gsu.edu/hbase/solar/soldata2.html
    sun = Body(1.98892e30, 0, 0, 0, 0, 15, 1, 1, 0)
    mercury = Body(.06 * EM, -.3871 * AU, 0, 0, 47890, 3, 1, .4, 0)
    venus = Body(.82 * EM, -.7233 * AU, 0, 0, 35040, 6, 0, .6, .2)
    earth = Body(1.0 * EM, -1.0 * AU, 0, 0, 29790, 7, 0, .4, 1)
    mars = Body(.11 * EM, -1.524 * AU, 0, 0, 24140, 4, .8, .2, 0)
    
    solar_system = System([sun, mercury, venus, earth, mars])

    set_clear_color(0, 0, 0)    # black background
    enable_smoothing()
    
    while not window_closed():
        clear()

        # Draw the system in its current state.   
        solar_system.draw(WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2, PIXELS_PER_METER)

        # Update the system for its next state.
        solar_system.update(TIMESTEP * TIME_SCALE)

        # Draw the frame and take a brief nap.
        request_redraw()
        sleep(TIMESTEP)
开发者ID:CS98,项目名称:TheOneRepo,代码行数:26,代码来源:solar.py


示例3: __init__

    def __init__(self):
        global _requests

        self.camip = "sonycam.msgroup.ucla.edu"
        self.ourip = socket.gethostbyaddr(socket.gethostname())[-1][0]
        self.port = 9218
        self.camtool = "./camctrl"
        self.pan=0
        self.tilt=0
        self.zoom=0
        self.setCam()
        
        print "Start parsing xml file"
        espmlFile = 'sonyCamSystem.xml'
        espmlDocObject = espml.parse(espmlFile)
        systemElement = espmlDocObject.getSystem()
        systemElement.setId('http://'+str(self.ourip)+':'+self.port)
        espmlDocObject.export(file(espmlFile, 'w'), 0)
        
        System.__init__(self, self.port, "http://128.97.93.5:1718/", "sonyCamSystem.xml")
        print "Registered system"
        

        #the next call is blocking!
        print "starting..."
        self.start()
        
        raw_input("Press a key when done")
开发者ID:nesl,项目名称:esp,代码行数:28,代码来源:sonyCamSystem.py


示例4: BaseTest

class BaseTest(unittest.TestCase):
    def __init__(self, *args, **kwargs):
        super(BaseTest, self).__init__(*args, **kwargs)
        self.auto_power_on = True

    def setUp(self):
        obc_com = config['OBC_COM']
        sys_bus_com = config['SYS_BUS_COM']
        payload_bus_com = config['PAYLOAD_BUS_COM']
        use_single_bus = config['SINGLE_BUS']
        gpio_com = config['GPIO_COM']

        self.gpio = Pins(gpio_com)

        extensions.set_up(test_id=self.id())

        self.system = System(obc_com, sys_bus_com, payload_bus_com, use_single_bus, self.gpio, self.auto_power_on)

    def tearDown(self):
        self.system.close()
        self.gpio.close()
        extensions.tear_down(test_id=self.id())

    def power_on_obc(self):
        self.system.obc.power_on()

    def power_on_and_wait(self):
        self.power_on_obc()
        self.system.obc.wait_to_start()
开发者ID:PW-Sat2,项目名称:PWSat2OBC,代码行数:29,代码来源:base.py


示例5: __init__

    def __init__(self):
        global _requests

        System.__init__(self, 8081, "http://128.97.93.154:8080/", "sos_system.xml")
        # start the SOAP server
        
        self.sossrvClient = sossrv_tools.SossrvClient()

        _requests = {'field_getCurrent': {},
                     'field_average': {},
                     'sensor_getCurrentValue': {},
                     'sensor_getAverageValue': {}
                     }

        self.sensorModule = SensorModule()
        self.sossrvClient.register_module(self.sensorModule)
        # connect to the sossrv application
        self.sossrvClient.connect()

        SocketServer.TCPServer.__init__(self, ('128.97.93.154', 8082) , ESPRequestHandler)
        esphttpserver = thread.start_new_thread(self.serve_forever, ())

        #the next call is blocking!
        print "starting..."
        self.start()
        
        raw_input("Press a key when done")
开发者ID:nesl,项目名称:esp,代码行数:27,代码来源:basestation.py


示例6: menu

def menu(arguments):
    if arguments['list']:
        if arguments['--YAML'] or arguments['--JSON']:
            where = dict(name=arguments['<name>']) if arguments['<name>'] else dict()
            systems = System.list(**where)
            common.dump(systems, toyaml=arguments['--YAML'], tojson=arguments['--JSON'], entry=lambda item: item.__dict__)

        else:
            _system_list_table(arguments)

    elif system_execute(arguments):
        pass

    else:
        try:
            if arguments['create']:
                System.create(**_system_create_kwargs(arguments))

            elif arguments['read']:
                system_read(arguments)

            elif arguments['set']:
                system_set(arguments)

            elif arguments['delete']:
                System(arguments['<name>']).delete()

            elif arguments['reset']:
                system_reset(arguments)

        except NameError as exc:
            print(PACKAGE_NAME, 'Error!', exc)
            sys.exit(1)
开发者ID:avitalyahel,项目名称:autolite,代码行数:33,代码来源:autolite_system.py


示例7: __init__

    def __init__(self, engine):
        """Constructor"""
        System.__init__(self, engine)
        ogre.FrameListener.__init__(self)
        ogre.WindowEventListener.__init__(self)
        OIS.KeyListener.__init__(self)
        OIS.MouseListener.__init__(self)
        OIS.JoyStickListener.__init__(self)

        self.handlers = [dict() for x in range(InputEvent.NUM)]
        self.mouse_handlers = [dict() for x in range(MouseEvent.NUM)]
        self.joy_handlers = [dict() for x in range(JoyEvent.NUM)]
        self.key_states = {}
        self.keys_down = list()
        self.mouse_buttons_down = {}
        self.mouse_down_pos = {}
        self.mouse_down_over = {}
        self.mouse_down_modifiers = {}
        self.input_locks = {}
        for mb in MouseButton.LIST:
            self.mouse_buttons_down[mb] = False
            self.mouse_down_pos[mb] = None
            self.mouse_down_over[mb] = None
            self.mouse_down_modifiers[mb] = [False for x in range(Modifier.NUM)]
            self.input_locks[mb] = InputLock()
        self.mouse_state = None

        #box selection
        #self.selection_dd_context = self.engine.debugDrawSystem.getContext()
        #self.boxSelection = None
        #self.maintainDDContext = self.engine.debugDrawSystem.getContext()
        self.translation_to_apply = vector3(0,0,0)

        self.translation_to_apply_time_left = 0
开发者ID:kyphelps,项目名称:pynecraft,代码行数:34,代码来源:input_system.py


示例8: set_screen

 def set_screen(target, on=True):
     log = logging.getLogger('Screen')
     if not on:
         log.info('Setting screen OFF')
         System.sleep(target)
         return
     log.info('Setting screen ON')
     System.wakeup(target)
开发者ID:msrasmussen,项目名称:lisa,代码行数:8,代码来源:screen.py


示例9: startup

	def startup(self, verbosity):
		'''Initialisation for the objects that have variable startup behaviour'''
		self.myInfoDisplay = infodisplay.InfoDisplay()
#		self.myKey = keyboardpoller.KeyboardPoller()
#		self.myKey.start()
		try:
			if keys.board == 'emulator':
				import gpio_emulator
				import mpc_emulator
				self.myGpio = gpio_emulator.Gpio()
				self.myMpc = mpc_emulator.Mpc()
				host = 'dummy host'
				self.programmename = 'dummy prog\nTest\nSecond row'
			if keys.board == 'lcd':
				host = 'rotary host'
				import rotary
				self.myGpio = rotary.Rotary()
				self.myVol = rotary.Rotary(1)
				self.myMpc = mpc2.Mpc()
				print 'mpc has been setup'
#				count = self.myMpc.podcounter()
				self.mySystem = System()
				host = self.mySystem.return_hostname()
				print 'Hostname:', host
				self.programmename = self.myMpc.progname()
				print 'Prog:', self.programmename
#				remaining = self.myMpc.check_time_left()
			else:
				from mpc2 import Mpc
				import gpio
				self.myGpio = gpio.Gpio()
				self.myMpc = Mpc(False, True)		# Test mode, podmode
				count = self.myMpc.podcounter()
				self.mySystem = System()
				host = self.mySystem.return_hostname()
				self.programmename = self.myMpc.progname()
				remaining = self.myMpc.check_time_left()
		except:
			self.cleanup('Failed to start gpio')
#		self.myInfoDisplay.writerow(0,host)
#		self.myInfoDisplay.update_display()
		self.myInfoDisplay.prog = self.programmename
		self.myInfoDisplay.start()
		time.sleep(2)
		self.myInfoDisplay.prog = self.myMpc.progname()
		self.ending = False
		self.t = threading.Timer(AUDIOTIMEOUT, self.audiofunc)
		self.t.start()
		self.t.name = 'audiot'
		print threading.enumerate()		# helps debug
		print 'Thread count: ', threading.active_count()
#		self.check_threads()
		if False:								# set to true for testing
			self.cleanup('Forced cleanup')
		self.dt = threading.Timer(DEBUGTIMEOUT, self.debugfunc)
#		self.dt.start()
		self.dt.name = 'debugt'
开发者ID:andytopham,项目名称:podplayer,代码行数:57,代码来源:executive.py


示例10: __init__

    def __init__(self):
        global _requests

        System.__init__(self, 7082, "128.97.93.5:1817", "sensorbase_system.xml")

        #the next call is blocking!
        print "starting..."
        self.start()
        
        raw_input("Press a key when done")
开发者ID:nesl,项目名称:esp,代码行数:10,代码来源:sensorbase.py


示例11: __init__

    def __init__(self):
        global _requests

        System.__init__(self, 7081, "http://128.97.93.154:8080/", "soundscape_system.xml")

        #the next call is blocking!
        print "starting..."
        self.start()
        
        raw_input("Press a key when done")
开发者ID:nesl,项目名称:esp,代码行数:10,代码来源:soundscape.py


示例12: qa_linker

def qa_linker():
    import time
    from gnuradio import window
    from system import System
    from signal_psk31 import PSK31Signal

    def mag(c):
        """Magnitude of complex number."""
        return (c*c.conjugate()).real

    src = gr.wavfile_source("../example.WAV", False)
    samp_rate = 44100
    tb = gr.top_block()
    system = System(tb, src, samp_rate, throttle=False, src_is_float=True,
                    center_freq=0)
    linker = Linker(1000, 80, samp_rate)
    snk = gr.null_sink(gr.sizeof_gr_complex)
    system.connect(system.out, linker, snk)
    system.refresh()
    system.start()
    time.sleep(5)
    system.stop()
    data = linker.probe.level()
    print(data[:10])
    print(linker.samp_rate)
    plot_fft([mag(x) for x in data], linker.samp_rate)
开发者ID:benreynwar,项目名称:gr-ham,代码行数:26,代码来源:channelizer.py


示例13: __init__

    def __init__(self):
        global _requests

        print "Start parsing xml file"
        System.__init__(self, 8081, "http://127.0.0.1:8080/", "iTunesSystem.xml")
        print "Registered system"
        

        #the next call is blocking!
        print "starting..."
        self.start()
        
        raw_input("Press a key when done")
开发者ID:nesl,项目名称:esp,代码行数:13,代码来源:iTunesSystem.py


示例14: Alive

class Alive(object):

    def __init__(self):

        self.system = System()
        logging.info('Alive Initialization Succeeded!')

    def data(self):

        cpu = self.system.cpu()
        memory = self.system.memory()
        message = "Cpu %s / Memory %s" % (cpu, memory)
        logging.info(message)
开发者ID:xe1gyq,项目名称:EekMex,代码行数:13,代码来源:alive.py


示例15: __init__

    def __init__(self):
        global _requests

        print "Start parsing xml file"
        System.__init__(self, 9181, "http://128.97.93.154:8080/", "beachCamSystem.xml")
        print "Registered system"
        

        #the next call is blocking!
        print "starting..."
        self.start()
        
        raw_input("Press a key when done")
开发者ID:nesl,项目名称:esp,代码行数:13,代码来源:beachCamSystem.py


示例16: test_next

 def test_next(self):
     rules = [
         Rule("A", 0, 1, True, "B"),
         Rule("B", 0, 1, False, "A"),
         Rule("C", 0, 1, False, "B"),
         Rule("A", 1, 1, False, "C"),
         Rule("B", 1, 1, True, "B"),
         Rule("C", 1, 1, True, "HALT"),
     ]
     m = Machine(rules)
     t = Tape()
     s = System(m, t)
     s.next()
     self.assertEqual(s.steps, 1)
开发者ID:nahumj,项目名称:turing-ga,代码行数:14,代码来源:test_system.py


示例17: test_iterate_until_halt_max

 def test_iterate_until_halt_max(self):
     rules = [
         Rule("A", 0, 1, True, "B"),
         Rule("B", 0, 1, False, "A"),
         Rule("C", 0, 1, False, "B"),
         Rule("A", 1, 1, False, "C"),
         Rule("B", 1, 1, True, "B"),
         Rule("C", 1, 1, True, "HALT"),
     ]
     m = Machine(rules)
     t = Tape()
     s = System(m, t)
     with self.assertRaises(DidNotHalt):
         s.iterate_until_halt(max_steps=10)
     self.assertNotEqual(s.machine.state, "HALT")
开发者ID:nahumj,项目名称:turing-ga,代码行数:15,代码来源:test_system.py


示例18: main

def main():

    # load in the images for all the planets
    # like hitting ctrl+r and loading your blitz
    suni = load_image("sun.png")
    merci = load_image("mercury.gif")
    venusi = load_image("venus.gif")
    earthi = load_image("earth.png")
    marsi = load_image("mars.png")

    # initialize all the planets as an object
    # hope that the values are all correct
    sun = Body(1.98892e30, 0, 0, 0, 0, 12, 1, 1, 0,suni,17,17,0,17,17)
    mercury = Body(.06*EM,0,.3871*AU,47890,0,3,1,0,0,merci,8,8,.2,16,16)
    venus = Body(.82*EM,0,-.7233*AU,-35040,0,8,0,1,0,venusi,10,9,.3,20,18)
    earth = Body(EM,AU,0,0,-29790,6,0,0,1,earthi,13,13,.4,26,26)
    mars = Body(.11*EM,-1.524*AU,0,0,24140,4,0,1,1,marsi,10,10,.3,20,20)

    listp = [sun,mercury,venus,earth,mars]

    # put em in a list, for safekeeping
    # as of now, the planets are still sleeping
    solar = System(listp)

    # kill the backlights, set up the stage,
    # draw things inside the page
    set_clear_color(0, 0, 0)
    enable_smoothing()
    player = Spaceship(3*WINDOW_HEIGHT/4,3*WINDOW_HEIGHT/4)


    while not window_closed():

        # draw the spaceship yo
        clear()
        player.spaceshipupdate()
        player.draw()


        # Draw the system in its current state.
        solar.draw(WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2, PIXELS_PER_METER)

        # Update the system for its next state.
        solar.update(SEC_PER_FRAME)

        # Draw the frame and take a brief nap.
        request_redraw()
        sleep(TIMESTEP)
开发者ID:edwardcdy,项目名称:planets,代码行数:48,代码来源:solar.py


示例19: __init__

    def __init__(self):
        global _requests

        print "Start parsing xml file"
        System.__init__(self, 9081, "http://128.97.93.154:8080/", "weatherSystem.xml")
        print "Registered system"
        
        # start the SOAP server
        
        SocketServer.TCPServer.__init__(self, ('128.97.93.154', 9082) , ESPRequestHandler)
        esphttpserver = thread.start_new_thread(self.serve_forever, ())

        #the next call is blocking!
        print "starting..."
        self.start()
        
        raw_input("Press a key when done")
开发者ID:nesl,项目名称:esp,代码行数:17,代码来源:weatherSystem.py


示例20: test_get_state_tape_contents_and_index

 def test_get_state_tape_contents_and_index(self):
     rules = [
         Rule("A", 0, 1, True, "B"),
         Rule("B", 0, 1, False, "A"),
         Rule("C", 0, 1, False, "B"),
         Rule("A", 1, 1, False, "C"),
         Rule("B", 1, 1, True, "B"),
         Rule("C", 1, 1, True, "HALT"),
     ]
     m = Machine(rules)
     t = Tape()
     s = System(m, t)
     s.next()
     state, contents, index = s.get_state_tape_contents_and_head_index()
     self.assertEqual(state, "B")
     self.assertEqual(contents, [1, 0])
     self.assertEqual(index, 1)
开发者ID:nahumj,项目名称:turing-ga,代码行数:17,代码来源:test_system.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python command_manager.CommandManager类代码示例发布时间:2022-05-27
下一篇:
Python system.MogamiLog类代码示例发布时间: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