Return a dashboard with properties from parents.
541500
def _inherited_dashboard(dashboard, base_dashboards_from_pillar, ret):
    ''''''
    base_dashboards = []
    for base_dashboard_from_pillar in base_dashboards_from_pillar:
        base_dashboard = __salt__['pillar.get'](base_dashboard_from_pillar)
        if base_dashboard:
            base_dashboards.append(base_dashboard)
        elif base_dashboard_from_pillar != _DEFAULT_DASHBOARD_PILLAR:
            ret.setdefault('warnings', [])
            warning_message = 'Cannot find dashboard pillar "{0}".'.format(
                base_dashboard_from_pillar)
            if warning_message not in ret['warnings']:
                ret['warnings'].append(warning_message)
    base_dashboards.append(dashboard)

    result_dashboard = {}
    tags = set()
    for dashboard in base_dashboards:
        tags.update(dashboard.get('tags', []))
        result_dashboard.update(dashboard)
    result_dashboard['tags'] = list(tags)
    return result_dashboard
88054
def get_parent_objects(self, context):
        
        parent_object = api.get_parent(context)
        portal_type = api.get_portal_type(context)
        return parent_object.objectValues(portal_type)
522377
def horizon_main_nav(context):
    """"""
    if 'request' not in context:
        return {}
    current_dashboard = context['request'].horizon.get('dashboard', None)
    dashboards = []
    for dash in Horizon.get_dashboards():
        if dash.can_access(context):
            if callable(dash.nav) and dash.nav(context):
                dashboards.append(dash)
            elif dash.nav:
                dashboards.append(dash)
    return {'components': dashboards,
            'user': context['request'].user,
            'current': current_dashboard,
            'request': context['request']}
245930
def get_property_by_name(pif, name):
    """"""
    return next((x for x in pif.properties if x.name == name), None)
748167
def item_properties(self, handle):
        """"""
        logger.debug("Getting properties for handle: {}".format(handle))
        properties = {
            'size_in_bytes': self.get_size_in_bytes(handle),
            'utc_timestamp': self.get_utc_timestamp(handle),
            'hash': self.get_hash(handle),
            'relpath': self.get_relpath(handle)
        }
        logger.debug("{} properties: {}".format(handle, properties))
        return properties
292882
def horizon_dashboard_nav(context):
    """"""
    if 'request' not in context:
        return {}
    dashboard = context['request'].horizon['dashboard']
    panel_groups = dashboard.get_panel_groups()
    non_empty_groups = []

    for group in panel_groups.values():
        allowed_panels = []
        for panel in group:
            if (callable(panel.nav) and panel.nav(context) and
                    panel.can_access(context)):
                allowed_panels.append(panel)
            elif (not callable(panel.nav) and panel.nav and
                    panel.can_access(context)):
                allowed_panels.append(panel)
        if allowed_panels:
            if group.name is None:
                non_empty_groups.append((dashboard.name, allowed_panels))
            else:
                non_empty_groups.append((group.name, allowed_panels))

    return {'components': OrderedDict(non_empty_groups),
            'user': context['request'].user,
            'current': context['request'].horizon['panel'].slug,
            'request': context['request']}
1089884
def dashboard(self, request):
        ""
        # TODO: these should be ajax
        module_set = []
        for namespace, module in self.get_modules():
            home_url = module.get_home_url(request)

            if hasattr(module, 'render_on_dashboard'):
                # Show by default, unless a permission is required
                if not module.permission or request.user.has_perm(module.permission):
                    module_set.append((module.get_dashboard_title(), module.render_on_dashboard(request), home_url))

        return self.render_to_response('nexus/dashboard.html', {
            'module_set': module_set,
        }, request)
1055664
def get_properties(cls_def):
    
    # pdb.set_trace()
    prop_list = {prop: value for prop, value in cls_def.items() \
                 if 'rdf_Property' in value.get('rdf_type', "") or \
                 value.get('rdfs_domain')}

    return prop_list
706390
def get_dashboard_full(self, db_name):
        """"""
        objects = {}
        dashboards = self.get_objects("type", "dashboard")
        vizs = self.get_objects("type", "visualization")
        searches = self.get_objects("type", "search")
        if db_name not in dashboards:
            return None
        self.pr_inf("Found dashboard: " + db_name)
        objects[db_name] = dashboards[db_name]
        panels = json.loads(dashboards[db_name]['_source']['panelsJSON'])
        for panel in panels:
            if 'id' not in panel:
                continue
            pid = panel['id']
            if pid in searches:
                self.pr_inf("Found search:    " + pid)
                objects[pid] = searches[pid]
            elif pid in vizs:
                self.pr_inf("Found vis:       " + pid)
                objects[pid] = vizs[pid]
                emb = vizs[pid].get('_source', {}).get('savedSearchId', None)
                if emb is not None and emb not in objects:
                    if emb not in searches:
                        self.pr_err('Missing search %s' % emb)
                        return objects
                    objects[emb] = searches[emb]
        return objects
41963
def get_all_parents(self):
        
        ownership = Ownership.objects.filter(child=self)
        parents = Company.objects.filter(parent__in=ownership)
        for parent in parents:
            parents = parents | parent.get_all_parents()
        return parents
488511
@Override
    public List<Dashboard> getDashboards() {
        
       
            JAXBContext context;
            try {
                context = JAXBContext.newInstance(Dashboard.class.getPackage().getName());
            } catch (JAXBException e) {
                throw new IllegalArgumentException("Could not create JAXBContext", e);
            }
            List<Dashboard> dashboards = new ArrayList<Dashboard>();
            try {
                Configuration config = (Configuration) context.createUnmarshaller().unmarshal(sourceXml.getInputStream());
                dashboards.addAll(config.getDashboard());
            } catch (Exception e) {
                throw new IllegalStateException("Could not load dashboards configuration from " + sourceXml.toString(), e);
            }
            /*
            if(additionalSourceXml != null) {
                if (additionalSourceXml.isReadable()) {
            
                    try {
                        Configuration config = (Configuration) context.createUnmarshaller().unmarshal(additionalSourceXml.getInputStream());
                        dashboards.addAll(config.getDashboard());
                    } catch (Exception e) {
                    throw new IllegalStateException("Could not load dashboards configuration from " + additionalSourceXml.toString(), e);
                    }
                } else {
                    throw new IllegalStateException("Could not read configuration from " + additionalSourceXml.toString());
                }
            }
            */
            Collections.sort(dashboards);
            return dashboards;
      
       
    }
816583
def get_properties(self):
        
        node_prop = self.node.find('properties')
        if node_prop is not None:
            obj_properties = Cproperties(node_prop,self.type)
            for prop in obj_properties:
                yield prop
1176812
def get_parents():
    """"""
    distributions = get_installed_distributions(user_only=ENABLE_USER_SITE)
    remaining = {d.project_name.lower() for d in distributions}
    requirements = {r.project_name.lower() for d in distributions for
                    r in d.requires()}

    return get_realnames(remaining - requirements)
232621
function (contextModel, properties, parentContext) {

                if (!(contextModel || properties && _.size(properties))) {
                    // no contextModel OR no properties or empty object passed
                    return this.root();
                }

                parentContext = parentContext || this.root();
                return parentContext.getContext(contextModel, properties);

            }
199042
def house(self):
        
        house = self.chart.houses.getObjectHouse(self.obj)
        return house
463957
def import_dashboards(session, data_stream, import_time=None):
    """"""
    current_tt = int(time.time())
    import_time = current_tt if import_time is None else import_time
    data = json.loads(data_stream.read(), object_hook=decode_dashboards)
    # TODO: import DRUID datasources
    for table in data['datasources']:
        type(table).import_obj(table, import_time=import_time)
    session.commit()
    for dashboard in data['dashboards']:
        Dashboard.import_obj(
            dashboard, import_time=import_time)
    session.commit()
1226253
def get_usrgos_w_parents(self, hdrgos, usrgos_all=None):
        """"""
        usrgos = set()
        _go2parents = self.gosubdag.rcntobj.go2parents
        if usrgos_all is None:
            usrgos_all = self.usrgos
        for usrgo in usrgos_all:
            all_usrgo_parents = _go2parents.get(usrgo)
            sel_usrgo_parents = all_usrgo_parents.intersection(hdrgos)
            if sel_usrgo_parents:
                usrgos.add(usrgo)
        return usrgos