Start discovering and listing to connections.
346982
def start(self, block=True):
        """"""
        if self._state == INIT:
            if not any(self.on_message.receivers_for(blinker.ANY)):
                raise RuntimeError('no receivers connected to on_message')

            self.logger.debug('starting %s...', self.name)
            self._state = RUNNING
            self.query_nsqd()

            if self.lookupds:
                self.query_lookupd()
                self._killables.add(self._workers.spawn(self._poll_lookupd))

            self._killables.add(self._workers.spawn(self._poll_ready))

        else:
            self.logger.warn('%s already started', self.name)

        if block:
            self.join()
838417
def connections(self):
        """"""
        self._check_session()
        status, data = self._rest.get_request('connections')
        return data
1127933
def _begin_connection_action(self, action):
        

        conn_id = action.data['connection_id']
        int_id = action.data['internal_id']
        callback = action.data['callback']

        # Make sure we are not reusing an id that is currently connected to something
        if self._get_connection_state(conn_id) != self.Disconnected:
            print(self._connections[conn_id])
            callback(conn_id, self.id, False, 'Connection ID is already in use for another connection')
            return

        if self._get_connection_state(int_id) != self.Disconnected:
            callback(conn_id, self.id, False, 'Internal ID is already in use for another connection')
            return

        conn_data = {
            'state': self.Connecting,
            'microstate': None,
            'conn_id': conn_id,
            'int_id': int_id,
            'callback': callback,
            'timeout': action.timeout,
            'context': action.data['context']
        }

        self._connections[conn_id] = conn_data
        self._int_connections[int_id] = conn_data
1042858
def make_connection(self):
        """"""
        if self._created_connections[self._pattern_idx] >= self.max_connections_per_pattern:
            raise ConnectionError("Too many connections")
        self._created_connections[self._pattern_idx] += 1
        conn = self.connection_class(**self.patterns[self._pattern_idx])
        conn._pattern_idx = self._pattern_idx
        return conn
795324
def connect(self):
        ""
        log.info("connecting")

        # don't have the connection attempt reconnects, because when it goes
        # down we are going to cycle to the next potential peer from the Client
        self._peer = connection.Peer(
                None, self._dispatcher, self._addrs.popleft(),
                backend.Socket(), reconnect=False)
        self._peer.start()
269615
def start_loop(self, datapath):
        """"""
        self._datapath = datapath
        self._querier_thread = hub.spawn(self._send_query)
        self.logger.info("started a querier.")
164520
def add_find_links(self, urls):
        """"""
        for url in urls:
            if (
                self.to_scan is None  # if we have already "gone online"
                or not URL_SCHEME(url)  # or it's a local file/directory
                or url.startswith('file:')
                or list(distros_for_url(url))  # or a direct package link
            ):
                # then go ahead and process it now
                self.scan_url(url)
            else:
                # otherwise, defer retrieval till later
                self.to_scan.append(url)
39008
def on_discovery_add(self, discovery):
        
        discovery.connect()

        for cluster in self.configurables[Cluster].values():
            if cluster.discovery != discovery.name:
                continue

            self.launch_thread(
                cluster.name, discovery.start_watching,
                cluster, self.sync_balancer_files
            )

        self.sync_balancer_files()
559013
def makeNetwork(self):
        """"""
        if "weight" in self.data_friendships.keys():
            self.G=G=x.DiGraph()
        else:
            self.G=G=x.Graph()
        F=self.data_friends
        for friendn in range(self.n_friends):
            if "posts" in F.keys():
                G.add_node(F["name"][friendn],
                             label=F["label"][friendn],
                             posts=F["posts"][friendn])
            elif "agerank" in F.keys():
                G.add_node(F["name"][friendn],
                             label=F["label"][friendn],
                             gender=F["sex"][friendn],
                             locale=F["locale"][friendn], 
                             agerank=F["agerank"][friendn])
            else:
                G.add_node(F["name"][friendn],
                             label=F["label"][friendn],
                             gender=F["sex"][friendn],
                             locale=F["locale"][friendn])
        F=self.data_friendships
        for friendshipn in range(self.n_friendships):
            if "weight" in F.keys():
                G.add_edge(F["node1"][friendshipn],F["node2"][friendshipn],weight=F["weight"][friendshipn])
            else:
                G.add_edge(F["node1"][friendshipn],F["node2"][friendshipn])
205768
def initialize_connections(self):
        
        n, m = self.connections.visible_to_hidden.shape
        self.connections.visible_to_hidden = np.zeros((n, m))

        for i in range(n):
            random_vector = self._random.rand(m)
            # norm          = np.sqrt( np.sum(random_vector * random_vector) )
            self.connections.visible_to_hidden[i]  = random_vector
768575
def _connect_signals():
    """"""
    for index in settings.get_index_names():
        for model in settings.get_index_models(index):
            _connect_model_signals(model)
264522
async def discover(ignore_list=[], max_wait=30, loop=None):
    """"""
    stbs = []
    try:
        async with timeout(max_wait, loop=loop):
            def responses_callback(notify):
                """Queue notify messages."""
                _LOGGER.debug("Found: %s", notify.ip_address)
                stbs.append(notify.ip_address)

            mr_protocol = await install_mediaroom_protocol(responses_callback=responses_callback)
            await asyncio.sleep(max_wait)
    except asyncio.TimeoutError:
        mr_protocol.close()
        _LOGGER.debug("discover() timeout!")

    return list(set([stb for stb in stbs if stb not in ignore_list]))
157120
def open_connections(self):
        """"""
        return [(host, len(li)) for (host, li) in self._cm.get_all().items()]
919569
def _discover(self):
        """"""
        for ep in pkg_resources.iter_entry_points('yamlsettings10'):
            ext = ep.load()
            if callable(ext):
                ext = ext()
            self.add(ext)
242891
def connect(self):
    """"""
    if self._connected or self.is_alive():
      raise ConnectionExistsError("Already connected")
    # After starting the thread we wait for it to post us
    # an event signifying that connection is established. This
    # ensures that the caller only resumes when we are fully connected.
    self.start()
    with self._lock:
      self._connect_cond.wait_for(lambda: self._connected)
198156
def start(self):
        """"""
        if self.closed:
            raise ConnectionClosed()

        self.read_watcher.start()
        if self.write == self.buffered_write:
            self.write_watcher.start()
578303
def _startup(cls):
        
        for endpoint_name in sorted(hookenv.relation_types()):
            # populate context based on attached relations
            relf = relation_factory(endpoint_name)
            if not relf or not issubclass(relf, cls):
                continue

            rids = sorted(hookenv.relation_ids(endpoint_name))
            # ensure that relation IDs have the endpoint name prefix, in case
            # juju decides to drop it at some point
            rids = ['{}:{}'.format(endpoint_name, rid) if ':' not in rid
                    else rid for rid in rids]
            endpoint = relf(endpoint_name, rids)
            cls._endpoints[endpoint_name] = endpoint
            endpoint.register_triggers()
            endpoint._manage_departed()
            endpoint._manage_flags()
            for relation in endpoint.relations:
                hookenv.atexit(relation._flush_data)