Get transmissions in the network.

        status { "all", "received", "pending" }
        failed { False, True, "all" }
        To get transmissions from a specific vector, see the
        transmissions() method in class Vector.
976174
def transmissions(self, status="all", failed=False):
        
        if status not in ["all", "pending", "received"]:
            raise ValueError(
                "You cannot get transmission of status {}.".format(status)
                + "Status can only be pending, received or all"
            )
        if failed not in ["all", False, True]:
            raise ValueError("{} is not a valid failed".format(failed))

        if status == "all":
            if failed == "all":
                return Transmission.query.filter_by(network_id=self.id).all()
            else:
                return Transmission.query.filter_by(
                    network_id=self.id, failed=failed
                ).all()
        else:
            if failed == "all":
                return Transmission.query.filter_by(
                    network_id=self.id, status=status
                ).all()
            else:
                return Transmission.query.filter_by(
                    network_id=self.id, status=status, failed=failed
                ).all()
292534
def get_sent(self, *args, **kwargs):
        
        return self.get_content(self.config['sent'], *args, **kwargs)
283115
def get_connections(self, data=False):
        
        if data:
            return self._connections
        return list(self._connections.keys())
463374
def vectors(self, direction="all", failed=False):
        
        # check direction
        if direction not in ["all", "incoming", "outgoing"]:
            raise ValueError(
                "{} is not a valid vector direction. "
                "Must be all, incoming or outgoing.".format(direction))

        if failed not in ["all", False, True]:
            raise ValueError("{} is not a valid vector failed".format(failed))

        # get the vectors
        if failed == "all":
            if direction == "all":
                return Vector.query\
                    .filter(or_(Vector.destination_id == self.id,
                                Vector.origin_id == self.id))\
                    .all()

            if direction == "incoming":
                return Vector.query\
                    .filter_by(destination_id=self.id)\
                    .all()

            if direction == "outgoing":
                return Vector.query\
                    .filter_by(origin_id=self.id)\
                    .all()
        else:
            if direction == "all":
                return Vector.query\
                    .filter(and_(Vector.failed == failed,
                            or_(Vector.destination_id == self.id,
                                Vector.origin_id == self.id)))\
                    .all()

            if direction == "incoming":
                return Vector.query\
                    .filter_by(destination_id=self.id, failed=failed)\
                    .all()

            if direction == "outgoing":
                return Vector.query\
                    .filter_by(origin_id=self.id, failed=failed)\
                    .all()
945630
def receive(self, decode=True):
        
        payload = self.socket.recv()
        payload = self.verify(payload)
        if decode:
            payload = self.decode(payload)
        return payload
949068
def receive(self):
        '''
        
        '''
        try:
            msg, addr = self.skt.recvfrom(self.buffer_size)
        except socket.error as error:
            log.error('Received listener socket error: %s', error, exc_info=True)
            raise ListenerException(error)
        log.debug('[%s] Received %s from %s', msg, addr, time.time())
        return msg, addr[0]
1120428
def recv(self, blocking=True):
        """"""
        length = struct.unpack("<I", self.sock.recv(4))[0]
        return self._get_next_obj(length)
896094
def get_updates(self, offset=None, limit=None, timeout=None):
        
        payload = dict(offset=offset, limit=limit, timeout=timeout)
        return self._get('getUpdates', payload)
398269
def get_networks(project_id, include_data='N', **kwargs):
    
    log.info("Getting networks for project %s", project_id)
    user_id = kwargs.get('user_id')
    project = _get_project(project_id)
    project.check_read_permission(user_id)

    rs = db.DBSession.query(Network.id, Network.status).filter(Network.project_id==project_id).all()
    networks=[]
    for r in rs:
        if r.status != 'A':
            continue
        try:
            net = network.get_network(r.id, summary=True, include_data=include_data, **kwargs)
            log.info("Network %s retrieved", net.name)
            networks.append(net)
        except PermissionError:
            log.info("Not returning network %s as user %s does not have "
                         "permission to read it."%(r.id, user_id))

    return networks
682436
def get(self, timeout):
        

        # At first get we return a ping so the client immediately receives data
        if self._first:
            self._first = False
            return ("ping", PingStats.get(), {})

        try:
            (action, msg, kwargs) = yield from asyncio.wait_for(super().get(), timeout)
        except asyncio.futures.TimeoutError:
            return ("ping", PingStats.get(), {})
        return (action, msg, kwargs)
291461
def receive(self, siz):
        
        result = bytearray()
        data = 'x'
        while len(data) > 0:
            data = self.sock.recv(siz - len(result))
            result += data
            if len(result) == siz:
                return result
            if len(result) > siz:
                raise Exception('Received more bytes than expected')
        raise Exception('Error receiving data. %d bytes received'%len(result))
1179968
def _get_network(self):
        '''
        
        '''
        data = dict()
        data['interfaces'] = salt.utils.network.interfaces()
        data['subnets'] = salt.utils.network.subnets()

        return data
178075
def get_clients(self, limit=None, offset=None):
        
        data = {}
        if limit:
            data['limit'] = limit
        if offset:
            data['offset'] = offset
        result = self._request('GET', '/clients', data=json.dumps(data))
        return result.json()
670485
def try_recv(self):
        """"""
        try:
            lenstr = self.sock.recv(4, socket.MSG_DONTWAIT)
        except socket.error:
            return None
        if len(lenstr) < 4:
            raise EOFError("Socket closed")
        length = struct.unpack("<I", lenstr)[0]
        return self._get_next_obj(length)
663918
def get_network(self):
        
        props = self.get_chain_properties()
        chain_id = props["chain_id"]
        for k, v in known_chains.items():
            if v["chain_id"] == chain_id:
                return v
        raise Exception("Connecting to unknown network!")
1289110
def get_info(self):
        '''  '''
        return {
            'Connected': self.is_connected(),
            'Port': self.port,
            'Bytes Waiting': self.ser.in_waiting if self.ser else 0
        }
581858
def get_network(self):
        
        props = self.get_chain_properties()
        chain_id = props["chain_id"]
        for k, v in known_chains.items():
            if v["chain_id"] == chain_id:
                return v
        raise exceptions.UnknownNetworkException(
            "Connecting to unknown network (chain_id: {})!".format(props["chain_id"])
        )