Return dictionary of relation status of interfaces and any missing
        required context data. Example:
            {'amqp': {'missing_data': ['rabbitmq_password'], 'related': True},
             'zeromq-configuration': {'related': False}}
493972
def get_incomplete_context_data(self, interfaces):
        '''
        
        '''
        incomplete_context_data = {}

        for i in six.itervalues(self.templates):
            for context in i.contexts:
                for interface in interfaces:
                    related = False
                    if interface in context.interfaces:
                        related = context.get_related()
                        missing_data = context.missing_data
                        if missing_data:
                            incomplete_context_data[interface] = {'missing_data': missing_data}
                        if related:
                            if incomplete_context_data.get(interface):
                                incomplete_context_data[interface].update({'related': True})
                            else:
                                incomplete_context_data[interface] = {'related': True}
                        else:
                            incomplete_context_data[interface] = {'related': False}
        return incomplete_context_data
1060148
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'relations') and self.relations is not None:
            _dict['relations'] = [x._to_dict() for x in self.relations]
        return _dict
150266
def role_and_interface_to_relations(role, interface_name):
    
    _metadata = metadata()
    results = []
    for relation_name, relation in _metadata.get(role, {}).items():
        if relation['interface'] == interface_name:
            results.append(relation_name)
    return results
1269316
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        if hasattr(self, 'message') and self.message is not None:
            _dict['message'] = self.message
        return _dict
850146
def as_dict(self):
        
        if self.has_omp:
            raise NotImplementedError('as_dict method of QueueAdapter not yet implemented when OpenMP is activated')
        return {'@module': self.__class__.__module__,
                '@class': self.__class__.__name__,
                'priority': self.priority,
                'hardware': self.hw.as_dict(),
                'queue': {'qtype': self.QTYPE,
                          'qname': self._qname,
                          'qnodes': self.qnodes,
                          'qparams': self._qparams},
                'limits': {'timelimit_hard': self._timelimit_hard,
                           'timelimit': self._timelimit,
                           'min_cores': self.min_cores,
                           'max_cores': self.max_cores,
                           'min_mem_per_proc': self.min_mem_per_proc,
                           'max_mem_per_proc': self.max_mem_per_proc,
                           'memory_policy': self.memory_policy
                           },
                'job': {},
                'mpi_procs': self._mpi_procs,
                'mem_per_proc': self._mem_per_proc,
                'master_mem_overhead': self._master_mem_overhead
                }
1052399
def report(self):
        
        return {
            'connections': {
                'busy': len(self.busy_connections),
                'closed': len(self.closed_connections),
                'executing': len(self.executing_connections),
                'idle': len(self.idle_connections),
                'locked': len(self.busy_connections)
            },
            'exceptions': sum([c.exceptions
                               for c in self.connections.values()]),
            'executions': sum([c.executions
                               for c in self.connections.values()]),
            'full': self.is_full,
            'idle': {
                'duration': self.idle_duration,
                'ttl': self.idle_ttl
            },
            'max_size': self.max_size
        }
431681
def status(self, **kwargs):
        
        self.services = dict(
            init_system=self.init_system,
            services=[]
        )
696692
def context_complete(self, ctxt):
        
        # Fresh start
        self.complete = False
        self.missing_data = []
        for k, v in six.iteritems(ctxt):
            if v is None or v == '':
                if k not in self.missing_data:
                    self.missing_data.append(k)

        if self.missing_data:
            self.complete = False
            log('Missing required data: %s' % ' '.join(self.missing_data),
                level=INFO)
        else:
            self.complete = True
        return self.complete
650349
def get_context_data(self, **kwargs):
        
        #noinspection PyUnresolvedReferences
        query_str           = self.request.GET.get('q', None)
        queryset            = kwargs.pop('object_list', self.object_list)
        context_object_name = self.get_context_object_name(queryset)

        # Build the context dictionary.
        context = {
            'ordering':     self.get_ordering(),
            'query_string': query_str,
            'is_searching': bool(query_str),
        }

        # Add extra variables to context for non-AJAX requests.
        #noinspection PyUnresolvedReferences
        if not self.request.is_ajax() or kwargs.get('force_search', False):
            context.update({
                'search_form':  self.get_search_form(),
                'popular_tags': self.model.popular_tags()
            })

        if context_object_name is not None:
            context[context_object_name] = queryset

        # Update context with any additional keyword arguments.
        context.update(kwargs)

        return super(IndexView, self).get_context_data(**context)
937073
def get_status(self):
        """"""

        result = ''
        if self._data_struct is not None:
            result = self._data_struct[KEY_STATUS]
        return result
826990
def get_connection_params(self):
        
        return {
            'uri': self.settings_dict['NAME'],
            'tls': self.settings_dict.get('TLS', False),
            'bind_dn': self.settings_dict['USER'],
            'bind_pw': self.settings_dict['PASSWORD'],
            'retry_max': self.settings_dict.get('RETRY_MAX', 1),
            'retry_delay': self.settings_dict.get('RETRY_DELAY', 60.0),
            'options': {
                k if isinstance(k, int) else k.lower(): v
                for k, v in self.settings_dict.get('CONNECTION_OPTIONS', {}).items()
            },
        }
2681
def get_context_dict(self):
        
        context_dict = {}
        for s in self.sections():
            for k, v in self.manifest.items(s):
                context_dict["%s:%s" % (s, k)] = v
        for k, v in self.inputs.values().items():
            context_dict["config:{0}".format(k)] = v
        context_dict.update(self.additional_context_variables.items())
        context_dict.update(dict([("%s|escaped" % k, re.escape(str(v) or "")) for k, v in context_dict.items()]))
        return context_dict
521864
def to_dict(self):
        

        rv = {
            'id': self.id,
            'type': self.type,
            'priority': self.priority
        }
        if self.recip_keys:
            rv['routingKeys'] = [canon_ref(k.did, k.id, '#') for k in  self.recip_keys]
        if self.routing_keys:
            rv['routingKeys'] = [canon_ref(k.did, k.id, '#') for k in self.routing_keys]
        rv['serviceEndpoint'] = self.endpoint

        return rv
895867
def list_connections(self, status=None):
        '''  '''
        if status is None:
            status = 'ALL'
        response, status_code = self.__pod__.Connection.get_v1_connection_list(
            sessionToken=self.__session__,
            status=status
        ).result()
        self.logger.debug('%s: %s' % (status_code, response))
        return status_code, response
690725
def relation_ids(self):
        
        if self.scope == scopes.GLOBAL:
            # the namespace is the relation name and this conv speaks for all
            # connected instances of that relation
            return hookenv.relation_ids(self.namespace)
        else:
            # the namespace is the relation ID
            return [self.namespace]
385934
def as_dict(self):
        
        my_info = {}
        if self.platform:
            my_info["model"] = self.platform
        if self.resource_id:
            my_info["sn"] = self.resource_id
        if self.vendor:
            my_info["vendor"] = self.vendor
        if self.provider:
            my_info["provider"] = self.provider
        return my_info
1289110
def get_info(self):
        '''  '''
        return {
            'Connected': self.is_connected(),
            'Port': self.port,
            'Bytes Waiting': self.ser.in_waiting if self.ser else 0
        }