当前位置: 首页>>代码示例>>Python>>正文


Python connector.Connector类代码示例

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


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

示例1: setupGraphics

    def setupGraphics(self):
        n1 = Nand2(self, "N1", self.scale1((80, 30)))  # Nand Gate
        i1 = Inv(self,   "I1")  # Inverter for n1.A
        i2 = Inv(self,   "I2")  # Inverter for n1.B
        # external connectorself. Same depth as xor circuit
        i1.align(i1.B, n1.A, -40, -20)  # inverter precedes Nand
        i2.align(i2.B, n1.B, -40,  20)  # inverter precedes Nand
        self.A = Connector(self, "A", ((i1.A.x(-20), i1.A.y())))
        self.B = Connector(self, "B", ((i2.A.x(-20), i2.B.y())))
        self.C = Connector(self, "C", ((n1.C.x( 20), n1.C.y())))
        self.output = self.C       # who is output

        self.gates = (i1, i2, n1)
        self.i1, self.i2, self.n1 = (i1, i2, n1)

        i1.B.addWire(n1.A)
        i2.B.addWire(n1.B)
        self.A.addWire(i1.A)
        self.B.addWire(i2.A)
        n1.C.addWire(self.C)

        if self.encapsulated():  # if encapsulated re-work externals
            self.A.pos, self.B.pos, self.C.pos = self.scaleM(( 0,  5),
                                                             ( 0, 35),
                                                             (20, 20))
开发者ID:kjcole,项目名称:LogicCircuits,代码行数:25,代码来源:or2.py

示例2: setUp

    def setUp (self):
        c = omero.client(pmap=['--Ice.Config='+(os.environ.get("ICE_CONFIG"))])
        try:
            self.root_password = c.ic.getProperties().getProperty('omero.rootpass')
            omero_host = c.ic.getProperties().getProperty('omero.host')
        finally:
            c.__del__()

        blitz = Server.find(host=omero_host)
        if blitz is None:
            Server.reset()
            for s in settings.SERVER_LIST:
                server = (len(s) > 2) and unicode(s[2]) or None
                Server(host=unicode(s[0]), port=int(s[1]), server=server)
            Server.freeze()
            blitz = Server.find(server=omero_host)
        
        if len(blitz):
            self.server_id = blitz[0].id
            connector = Connector(self.server_id, True)
            self.rootconn = connector.create_connection('TEST.webadmin', 'root', self.root_password)

            if self.rootconn is None or not self.rootconn.isConnected() or not self.rootconn.keepAlive():
                raise exceptions.Exception("Cannot connect")
        else:
            raise exceptions.Exception("'%s' is not on omero.web.server_list" % omero_host)
开发者ID:DirkHaehnel,项目名称:openmicroscopy,代码行数:26,代码来源:webadmin_test_library.py

示例3: test_loginFromForm

    def test_loginFromForm(self):
        params = {
            'username': 'root',
            'password': self.root_password,
            'server':self.server_id,
            'ssl':'on'
        }        
        request = fakeRequest(method="post", params=params)
        
        server_id = request.REQUEST.get('server')
        form = LoginForm(data=request.REQUEST.copy())
        if form.is_valid():
            username = form.cleaned_data['username']
            password = form.cleaned_data['password']
            server_id = form.cleaned_data['server']
            is_secure = toBoolean(form.cleaned_data['ssl'])

            connector = Connector(server_id, is_secure)
            conn = connector.create_connection('OMERO.web', username, password)
            if conn is None:
                self.fail('Cannot connect')
            
            conn.seppuku()
            if conn.isConnected() and conn.keepAlive():
                self.fail('Connection was not closed')
            
        else:
            errors = form.errors.as_text()
            self.fail(errors)
开发者ID:hflynn,项目名称:openmicroscopy,代码行数:29,代码来源:unittests.py

示例4: fill_gen_assign_workshop_attendee

def fill_gen_assign_workshop_attendee():

    connector = Connector()
    conn = connector.connect(secretpassword)
    cursor = conn.cursor()

    workshop_attendees = []

    cursor.execute("select distinct Attendees.AttendeeID, WorkshopReservations.WReservationID "
                   "from Attendees "
                   "inner join Participation on Participation.AttendeeID = Attendees.AttendeeID "
                   "inner join Reservations on Reservations.ReservationID = Participation.ReservationID "
                   "inner join WorkshopReservations on WorkshopReservations.ReservationID = Reservations.ReservationID")

    row = cursor.fetchone()

    while row:
        workshop_attendees.append((row[0], row[1]))
        row = cursor.fetchone()

    filler = Connector()

    workshop_attendees_size = len(workshop_attendees)
    filler.apply_proc_multi('AssignParticipantToWorkshop', workshop_attendees, workshop_attendees_size)



    conn.close()
开发者ID:onegrx,项目名称:db-gen,代码行数:28,代码来源:generator.py

示例5: fetch_news_by_feed_list

	def fetch_news_by_feed_list(self, news_data):
		conn = Connector()
		for n in news_data['news_items']:
			print("INF: Fetching news page for '{}'".format(n['link']))
			news_item_page = conn.send_req('GET', url=n['link'])
			if news_item_page is None:
				continue

			self.__get_article_from_html__(n, news_item_page.data)
开发者ID:KseniyaYakil,项目名称:news_sentiment_analys,代码行数:9,代码来源:news_parser.py

示例6: main

def main():
    config = SafeConfigParser()
    config.read(PROPERTIES_FILE)
    ctor = Connector(config)
    report = ctor.get_result()

    prsr = Parser()
    prsr.parse(report)
    prsr.format()
开发者ID:vogxn,项目名称:jenkins2email,代码行数:9,代码来源:main.py

示例7: loginAsUser

 def loginAsUser(self, username, password):
     blitz = Server.get(pk=self.server_id) 
     if blitz is not None:
         connector = Connector(self.server_id, True)
         conn = connector.create_connection('TEST.webadmin', username, password)
         if conn is None or not conn.isConnected() or not conn.keepAlive():
             raise Exception("Cannot connect")
         return conn
     else:
         raise Exception("'%s' is not on omero.web.server_list"  % self.omero_host)
开发者ID:emilroz,项目名称:openmicroscopy,代码行数:10,代码来源:test_webadmin.py

示例8: __init__

class MainController:
    def __init__(self, app):
        self.deviceData = DeviceData()
        self.view = MainView(None)
        self.view.scanForDevices.Bind(wx.EVT_BUTTON, self.ScanForDevices)
        self.view.syncActivities.Bind(wx.EVT_BUTTON, self.SyncActivities)
        self.view.Bind(wx.EVT_MENU, self.OnAbout, self.view.aboutMenuItem)
        self.view.Bind(wx.EVT_MENU, self.OnExit, self.view.exitMenuItem)
        self.view.Show()
        self.scanner = Scanner()
        ## TODO Preferences for Selected Scanners
        self.scanner.addScanner(AntScanner())
        self.connector = Connector()
        ## TODO Preferences for Selected Connectors
        self.connector.addConnector(GarminConnector())
        pub.subscribe(self.ScanningStarted, "SCANNING STARTED")
        pub.subscribe(self.DeviceDetected, "DEVICE DETECTED")
        pub.subscribe(self.ActivityRetrieved, "ACTIVITY RETRIEVED")
        pub.subscribe(self.ScanningEnded, "SCANNING ENDED")
        pub.subscribe(self.SyncStarted, "SYNC STARTED")
        pub.subscribe(self.SyncEnded, "SYNC ENDED")
        pub.subscribe(self.LoginSuccesful, "LOGIN SUCCESFUL")
        pub.subscribe(self.LoginFailed, "LOGIN FAILED")
        pub.subscribe(self.ActivitiesUploaded, "ACTIVITIES UPLOADED")
    def ScanForDevices(self, evt):
        self.scanner.scan()
    def ScanningStarted(self, evt):
        self.view.setStatus("Scanning started")
    def ScanningEnded(self, evt):
        self.view.setStatus("Scanning ended")
    def DeviceDetected(self, evt):
        self.view.setStatus("Device detected")
    def ActivityRetrieved(self, evt):
        self.view.setStatus("Retrieved activity")
    def SyncActivities(self, evt):
        self.connector.sync()
    def SyncStarted(self, evt):
        self.view.setStatus("Sync started")
    def SyncEnded(self, evt):
        self.view.setStatus("Sync ended")
    def LoginSuccesful(self, evt):
        self.view.setStatus("Login Succesful")
    def LoginFailed(self, evt):
        self.view.setStatus("Login Failed")
    def ActivitiesUploaded(self, evt):
        self.view.setStatus("Activities Uploaded")
    def OnExit(self,e):
        self.Close(True)
    def OnAbout(self, event):
        dlg = wx.MessageDialog( self.view, "A community-developed Linux version of the ANT Agent. Supports Garmin-based fitness devices that communicate either over USB serial or via the ANT USB connector. Developed by Philip Whitehouse, based on work by Braiden Kindt, Gustav Tiger and Collin (cpfair). Copyright 2014", "About ANT Agent for Linux", wx.OK);
        dlg.ShowModal()
        dlg.Destroy()
开发者ID:philipwhiuk,项目名称:garmin-Ant-GUI,代码行数:52,代码来源:main.py

示例9: inject_metric

  def inject_metric(self,quiet):
    if self.value == None:
      self.load_value()

    if quiet == False:
      self.print_metric()

    cw = Connector()
    retval = cw.inject(self.metricname,self.namespace,self.value,self.units,self.dimensions)
    
    if retval == -1:
      sys.stderr.write("\033[91mERROR: Monitor [" + self.monid + "] failed to be injected into CloudWatch.\n")
      sys.stderr.write("  -- Check JSON entry and that command is returning proper value and format.\033[0m\n")
开发者ID:wbates,项目名称:cloudwatch_inject,代码行数:13,代码来源:monitor.py

示例10: __init__

 def __init__(self, p12_path, p12_password, p12_buffer=None, production=True, request_timeout=2.0, proxy=None):
     self.connector = Connector(p12_path=p12_path,
                                p12_password=p12_password,
                                p12_buffer=p12_buffer,
                                production=production,
                                request_timeout=request_timeout,
                                proxy=proxy)
开发者ID:boris-savic,项目名称:python-furs-fiscal,代码行数:7,代码来源:base_api.py

示例11: __init__

    def __init__(self, slave=False, protocol=None, address=None, port=None, target_name=None):
        self.config = Configurator()
        self.is_connected = False
        self.is_slave = slave
        self.parameters = None
        self.datastream_queue = None
        self.datastream_poller = None
        self.datastream_collector = None
        self.signal_structure = None

        # Sets basic configurations
        if protocol:
            self.config.setAttr("protocol", protocol)

        if address:
            self.config.setAttr("address", address)

        if port:
            self.config.setAttr("port", port)

        if target_name:
            self.config.setAttr("target_name", target_name)

        # Initializes connection
        self.connection = Connector(self.config)
开发者ID:tommyblue,项目名称:pyRTAI,代码行数:25,代码来源:target.py

示例12: setUp

    def setUp (self):
        c = omero.client(pmap=['--Ice.Config='+(os.environ.get("ICE_CONFIG"))])
        try:
            self.root_password = c.ic.getProperties().getProperty('omero.rootpass')
            self.omero_host = c.ic.getProperties().getProperty('omero.host')
            self.omero_port = c.ic.getProperties().getProperty('omero.port')
            Server.reset()
            Server(host=self.omero_host, port=self.omero_port)
        finally:
            c.__del__()

        self.server_id = 1
        connector = Connector(self.server_id, True)
        self.rootconn = connector.create_connection('TEST.webadmin', 'root', self.root_password)
        if self.rootconn is None or not self.rootconn.isConnected() or not self.rootconn.keepAlive():
            raise Exception("Cannot connect")
开发者ID:emilroz,项目名称:openmicroscopy,代码行数:16,代码来源:test_webadmin.py

示例13: __init__

 def __init__(self, ip, port, automatic = True, control_buf_size = 32, data_buf_size = 128, \
     m_to = 0.01, socket_to = 0.005):
     """
     Constructor, initialize the modem and the connector. Connect the
     modem to the submerged node
     @param self pointer to the class object
     @param ip string cointaining the IP address of the TCP server
     @param port string with the port of the TCP server socket
     @param control_buf_size: int with the control buffer size, in bytes
     @param data_buf_size: int with the data buffer size, in bytes
     @param m_to: float value time out of the cycle, in [s]
     @param socket_to: time out of the socket checking operation, [s]
     """
     self.conn = Connector(ip, port, control_buf_size, data_buf_size, socket_to)
     self.conn.connect()
     self.m_to = m_to
     self.status = Modem.Status.IDLE
     self.node_status = 0
     self.automatic = automatic
     self.interpreter = Interpreter()
     self.mainPID = os.getpid()
     self.error_status = Modem.ErrorDict.NONE
     self.commands_queue = "".split(Interpreter.END_COMMAND)
     if automatic:
         thread.start_new_thread(self.run,())
开发者ID:marinetech,项目名称:Udoo,代码行数:25,代码来源:modem.py

示例14: __init__

	def __init__(self):
		# initialize file table
		self.maxFiles = 1024
#		self.files = [dict(path=None, dirty=False, data=None)] * self.maxFiles
		self.files = [None] * self.maxFiles
		for i in range(0, self.maxFiles):
			self.files[i] = dict(path=None, dirty=False, data=None)
		self.conn = Connector()
开发者ID:sangla1,项目名称:CloudFS,代码行数:8,代码来源:cloudfs.py

示例15: clone_repo

def clone_repo(src, dest):
    """
    Clone a repository.
    
    Arguments:
    src  -- URL of to the repository to clone from.
    dest -- URL of the target directory of the clone.
    
    Returns:
    A clone of the supplied repository.
    """
    src_connector = Connector.from_string(src)
    with src_connector.connected():
        origin = repo.Repo.load_from_disk(src_connector)
        dest = os.path.join(dest, origin.name)  # make clone at "<dest>/<name>"
        dest_connector = Connector.from_string(dest)
        with dest_connector.connected():
            clone = repo.Repo.clone(origin, dest_connector)
    init_repo_logging(clone)
    log.info("Cloned repository from %s to %s" % (src, dest))
    return clone
开发者ID:irvpriddy,项目名称:picture_clerk,代码行数:21,代码来源:app.py


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