Get faces which are fully in subdomain.
338807
def get_edge_mask(self, subdomain=None):
        
        if subdomain is None:
            # https://stackoverflow.com/a/42392791/353337
            return numpy.s_[:]

        if subdomain not in self.subdomains:
            self._mark_vertices(subdomain)

        # A face is inside if all its edges are in.
        # An edge is inside if all its nodes are in.
        is_in = self.subdomains[subdomain]["vertices"][self.idx_hierarchy]
        # Take `all()` over the first index
        is_inside = numpy.all(is_in, axis=tuple(range(1)))

        if subdomain.is_boundary_only:
            # Filter for boundary
            is_inside = is_inside & self.is_boundary_edge

        return is_inside
807393
function getDomains (display, height, width, bounds, options) {
  var xmin = bounds[0][0]
  var xmax = bounds[1][0]
  var ymin = bounds[0][1]
  var ymax = bounds[1][1]
  var xRange = xmax - xmin
  var yRange = ymax - ymin

  var paddingFactor = (options && options.paddingFactor)
    ? options.paddingFactor
    : 0.1

  var margins = getMargins(options)

  var usableHeight = height - margins.top - margins.bottom
  var usableWidth = width - margins.left - margins.right
  var displayAspect = width / height
  var usableDisplayAspect = usableWidth / usableHeight
  var graphAspect = xRange / (yRange === 0 ? -Infinity : yRange)

  var padding
  var dispX1, dispX2, dispY1, dispY2
  var dispXRange, dispYRange

  if (usableDisplayAspect > graphAspect) { // y-axis is limiting
    padding = paddingFactor * yRange
    dispY1 = ymin - padding
    dispY2 = ymax + padding
    dispYRange = yRange + 2 * padding
    var addedYRange = (height / usableHeight * dispYRange) - dispYRange
    if (margins.top > 0 || margins.bottom > 0) {
      dispY1 -= margins.bottom / (margins.bottom + margins.top) * addedYRange
      dispY2 += margins.top / (margins.bottom + margins.top) * addedYRange
    }
    dispXRange = (dispY2 - dispY1) * displayAspect
    var xOffset = (margins.left - margins.right) / width
    var xMidpoint = (xmax + xmin - dispXRange * xOffset) / 2
    dispX1 = xMidpoint - dispXRange / 2
    dispX2 = xMidpoint + dispXRange / 2
  } else { // x-axis limiting
    padding = paddingFactor * xRange
    dispX1 = xmin - padding
    dispX2 = xmax + padding
    dispXRange = xRange + 2 * padding
    var addedXRange = (width / usableWidth * dispXRange) - dispXRange
    if (margins.left > 0 || margins.right > 0) {
      dispX1 -= margins.left / (margins.left + margins.right) * addedXRange
      dispX2 += margins.right / (margins.left + margins.right) * addedXRange
    }

    dispYRange = (dispX2 - dispX1) / displayAspect
    var yOffset = (margins.bottom - margins.top) / height
    var yMidpoint = (ymax + ymin - dispYRange * yOffset) / 2
    dispY1 = yMidpoint - dispYRange / 2
    dispY2 = yMidpoint + dispYRange / 2
  }

  return [
    [dispX1, dispX2],
    [dispY1, dispY2]
  ]
}
426724
def get_subdomain(url):
        

        if url not in URLHelper.__cache:
            URLHelper.__cache[url] = urlparse(url)

        return ".".join(URLHelper.__cache[url].netloc.split(".")[:-2])
953645
def get_DID_subdomain(did, db_path=None, zonefiles_dir=None, atlasdb_path=None, check_pending=False):
    
    opts = get_blockstack_opts()
    if not is_subdomains_enabled(opts):
        log.warn("Subdomain support is disabled")
        return None

    if db_path is None:
        db_path = opts['subdomaindb_path']

    if zonefiles_dir is None:
        zonefiles_dir = opts['zonefiles']
    
    if atlasdb_path is None:
        atlasdb_path = opts['atlasdb_path']

    db = SubdomainDB(db_path, zonefiles_dir)
    try:
        subrec = db.get_DID_subdomain(did)
    except Exception as e:
        if BLOCKSTACK_DEBUG:
            log.exception(e)

        log.warn("Failed to load subdomain for {}".format(did))
        return None

    if check_pending:
        # make sure that all of the zone files between this subdomain's
        # domain's creation and this subdomain's zone file index are present,
        # minus the ones that are allowed to be missing.
        subrec.pending = db.subdomain_check_pending(subrec, atlasdb_path)

    return subrec
435573
def get(self, request, *args, **kwargs):
        """"""

        form_class = self.get_form_class()
        form = self.get_form(form_class)

        top_value = self.get_top_level_facet_value()
        subfacets = SEARCH_SUBFACETS.get(top_value, [])
        self.active_facets = [self.top_facet] + subfacets

        if form.is_valid():
            self.query = form.cleaned_data.get(self.search_field)
        else:
            self.query = ""

        sqs = self.pre_facet_sqs()

        for facet in self.active_facets:
            sqs = facet.set_on_sqs(sqs)

        facet_counts = sqs.facet_counts()

        for facet in self.active_facets:
            facet.set_values_from_sqs_facet_counts(facet_counts)
            facet.apply_request_and_page_to_values(self.request, self.fluent_page)

        for facet in self.active_facets:
            sqs = facet.narrow_sqs(sqs)

        context = self.get_context_data(**{
            self.form_name: form,
            'facets': self.active_facets,
            'top_facet': self.top_facet,
            'query': self.query,
            'object_list': sqs,
            'page': self.fluent_page,
            'show_placeholders': self.show_placeholders()
        })
        return self.render_to_response(context)
733591
def face_index(vertices):
    """"""
    new_verts = []
    face_indices = []
    for wall in vertices:
        face_wall = []
        for vert in wall:
            if new_verts:
                if not np.isclose(vert, new_verts).all(axis=1).any():
                    new_verts.append(vert)
            else:
                    new_verts.append(vert)
            face_index = np.where(np.isclose(vert, new_verts).all(axis=1))[0][0]
            face_wall.append(face_index)
        face_indices.append(face_wall)
    return np.array(new_verts), np.array(face_indices)
1038394
def get_subdomain_entry(self, fqn, accepted=True, cur=None):
        
        get_cmd = "SELECT * FROM {} WHERE fully_qualified_subdomain=? {} ORDER BY sequence DESC, parent_zonefile_index DESC LIMIT 1;".format(self.subdomain_table, 'AND accepted=1' if accepted else '')
        cursor = None
        if cur is None:
            cursor = self.conn.cursor()
        else:
            cursor = cur

        db_query_execute(cursor, get_cmd, (fqn,))

        try:
            rowdata = cursor.fetchone()
            assert rowdata
        except Exception as e:
            raise SubdomainNotFound(fqn)

        return self._extract_subdomain(rowdata)
539758
def rpc_get_all_subdomains( self, offset, count, **conf_info):
        
        if not check_offset(offset):
            return {'error': 'invalid offset', 'http_status': 400}

        if not check_count(count, 100):
            return {'error': 'invalid count', 'http_status': 400}

        all_subdomains = get_all_subdomains(offset = offset,
                                            count = count)

        return self.success_response( {'names': all_subdomains} )
572413
function getDomainsForBitField(oModel, bitfield) {
    return oModel.domains.filter(domain => (getDomainBitIndex(domain, oModel) & bitfield));
}
238523
def get_subdomain_info(fqn, db_path=None, atlasdb_path=None, zonefiles_dir=None, check_pending=False, include_did=False):
    
    opts = get_blockstack_opts()
    if not is_subdomains_enabled(opts):
        log.warn("Subdomain support is disabled")
        return None

    if db_path is None:
        db_path = opts['subdomaindb_path']

    if zonefiles_dir is None:
        zonefiles_dir = opts['zonefiles']

    if atlasdb_path is None:
        atlasdb_path = opts['atlasdb_path']

    db = SubdomainDB(db_path, zonefiles_dir)
    try:
        subrec = db.get_subdomain_entry(fqn)
    except SubdomainNotFound:
        log.warn("No such subdomain: {}".format(fqn))
        return None

    if check_pending:
        # make sure that all of the zone files between this subdomain's
        # domain's creation and this subdomain's zone file index are present,
        # minus the ones that are allowed to be missing.
        subrec.pending = db.subdomain_check_pending(subrec, atlasdb_path)

    if include_did:
        # include the DID 
        subrec.did_info = db.get_subdomain_DID_info(fqn)

    return subrec
623650
def n_faces(self):
        """"""
        if self._faces is not None:
            return self._faces.shape[0]
        elif self._vertices_indexed_by_faces is not None:
            return self._vertices_indexed_by_faces.shape[0]
385699
def list_subdomains(self, limit=None, offset=None):
        
        return self.manager.list_subdomains(self, limit=limit, offset=offset)
465698
def get_subdomains_owned_by_address(self, owner, cur=None):
        
        get_cmd = "SELECT fully_qualified_subdomain, MAX(sequence) FROM {} WHERE owner = ? AND accepted=1 GROUP BY fully_qualified_subdomain".format(self.subdomain_table)

        cursor = None
        if cur is None:
            cursor = self.conn.cursor()
        else:
            cursor = cur

        db_query_execute(cursor, get_cmd, (owner,))

        try:
            return [ x['fully_qualified_subdomain'] for x in cursor.fetchall() ]
        except Exception as e:
            if BLOCKSTACK_DEBUG:
                log.exception(e)

            return []
20401
def _label_faces(self):
        
        '''
        coords = sp.around(self['pore.coords'], decimals=10)
        min_labels = ['front', 'left', 'bottom']
        max_labels = ['back', 'right', 'top']
        min_coords = sp.amin(coords, axis=0)
        max_coords = sp.amax(coords, axis=0)
        for ax in range(3):
            self['pore.' + min_labels[ax]] = coords[:, ax] == min_coords[ax]
            self['pore.' + max_labels[ax]] = coords[:, ax] == max_coords[ax]
580162
def load_definitions(self):
        """"""
        self.data = dict(json.load(open(self.data_fp))['data'])
        self.all_faces = set(self.data.pop("__all__"))
        self.locations = set(self.data.keys())
334005
public function getBrowsableInterfaces(){
        $rest = $this->getService( self::API_LAN_BROWSER_INTERFACES);
        $rest->GET();

        return $rest->getResultAsArray( models\LAN\LanInterface::class);
    }
1050253
def faces(self, sites, permutation=None):
        
        if permutation is None:
            coords = [site.coords for site in sites]
        else:
            coords = [sites[ii].coords for ii in permutation]
        return [[coords[ii] for ii in f] for f in self._faces]