Get all codes of one type (i.e., 'anisotropy_estimation')
966769
def get_one_meth_type(self, mtype, method_list):
        
        cond = method_list['dtype'] == mtype
        codes = method_list[cond]
        return codes
589038
def get_evcodes(self, inc_set=None, exc_set=None):
        """'"""
        codes = self.get_evcodes_all(inc_set, exc_set)
        codes.discard('ND')
        return codes
207387
def type(self):
        """"""
        if self is FeatureType.TIMESTAMP:
            return list
        if self is FeatureType.BBOX:
            return BBox
        return dict
336482
def ctype_for_encoding(self, encoding):
        """"""
        if encoding in self.typecodes:
            return self.typecodes[encoding]
        elif encoding[0:1] == b'^' and encoding[1:] in self.typecodes:
            return POINTER(self.typecodes[encoding[1:]])
        elif encoding[0:1] == b'^' and encoding[1:] in [CGImageEncoding,
                                                        NSZoneEncoding]:
            return c_void_p
        elif encoding[0:1] == b'r' and encoding[1:] in self.typecodes:
            return self.typecodes[encoding[1:]]
        elif encoding[0:2] == b'r^' and encoding[2:] in self.typecodes:
            return POINTER(self.typecodes[encoding[2:]])
        else:
            raise Exception('unknown encoding for %s: %s'
                            % (self.name, encoding))
604512
def get_types(func):
    
    return _get_types(func, util.is_classmethod(func), util.is_method(func))
425920
def _get_bins(self, kind, order, reverse=False):
        

        if kind == "radius":
            start = self.max_radius * self.radius_inner
            end = self.max_radius

        elif kind == "angle":
            start = self.start_angle
            end = self.start_angle + 2 * np.pi

        bounds = np.linspace(start, end, len(order) + 1)
        bins = np.vstack([bounds[:-1], bounds[1:]]).T

        if reverse:
            bins = bins[::-1]

        return dict(zip(order, bins))
93466
def get_code(self):
        """"""

        result = ''
        if self._data_struct is not None:
            result = self._data_struct[KEY_CODE]
        return result
1138901
def _get_all(self, _type):
        
        if _type not in self.modules:
            raise ValueError("No such module, %s" % _type)
        if not self.insts_implementing.get(_type, None):
            raise ValueError("No instance implementing %s" % _type)
        return self.insts_implementing[_type]
1282408
def get_spatial_type(spatial_model):
    """"""

    if spatial_model in ['SkyDirFunction', 'PointSource',
                         'Gaussian']:
        return 'SkyDirFunction'
    elif spatial_model in ['SpatialMap']:
        return 'SpatialMap'
    elif spatial_model in ['RadialGaussian', 'RadialDisk']:
        try:
            import pyLikelihood
            if hasattr(pyLikelihood, 'RadialGaussian'):
                return spatial_model
            else:
                return 'SpatialMap'
        except Exception:
            return spatial_model
    else:
        return spatial_model
389948
def combine_argtype(observations):
    
    assert len(observations) > 0
    assert is_Tuple(observations[0])
    if len(observations) > 1:
        prms = [get_Tuple_params(observations[0])]
        ln = len(prms[0])
        for obs in observations[1:]:
            assert is_Tuple(obs)
            prms.append(get_Tuple_params(obs))
            assert len(prms[-1]) == ln
        if simplify:
            prms = map(list, zip(*prms))
            if not isinstance(prms, list):
                # special care for Python 3
                prms = list(prms)
            for type_list in prms:
                simplify_for_Union(type_list)
            prms = map(tuple, prms)
        else:
            prms = map(tuple, zip(*prms))
        prms = map(Union.__getitem__, prms)
        return Tuple[tuple(prms)]
    else:
        return observations[0]
1053416
def get_code(self):
        
        stub = []

        for deco in self.decorators:
            if (deco in DECORATORS) or deco.endswith(".setter"):
                stub.append("@" + deco)

        parameters = []
        for name, type_, has_default in self.parameters:
            decl = "%(n)s%(t)s%(d)s" % {
                "n": name,
                "t": ": " + type_ if type_ else "",
                "d": " = ..." if has_default else "",
            }
            parameters.append(decl)

        slots = {
            "a": "async " if self._async else "",
            "n": self.name,
            "p": ", ".join(parameters),
            "r": self.rtype,
        }

        prototype = "%(a)sdef %(n)s(%(p)s) -> %(r)s: ..." % slots
        if len(prototype) <= LINE_LENGTH_LIMIT:
            stub.append(prototype)
        elif len(INDENT + slots["p"]) <= LINE_LENGTH_LIMIT:
            stub.append("%(a)sdef %(n)s(" % slots)
            stub.append(INDENT + slots["p"])
            stub.append(") -> %(r)s: ..." % slots)
        else:
            stub.append("%(a)sdef %(n)s(" % slots)
            for param in parameters:
                stub.append(INDENT + param + ",")
            stub.append(") -> %(r)s: ..." % slots)

        return stub
851726
def _get_obs_array(self, k, use_raw=False, layer='X'):
        """"""
        in_raw_var_names = k in self.raw.var_names if self.raw is not None else False

        if use_raw and self.raw is None:
            raise ValueError('.raw doesn\'t exist')

        if k in self.obs.keys():
            x = self._obs[k]
        elif in_raw_var_names and use_raw and layer == 'X':
            x = self.raw[:, k].X
        elif k in self.var_names and not use_raw and (layer == 'X' or layer in self.layers.keys()):
            x = self[:, k].X if layer=='X' else self[:, k].layers[layer]
        elif use_raw and layer != 'X':
            raise ValueError('No layers in .raw')
        elif layer != 'X' and layer not in self.layers.keys():
            raise ValueError('Did not find {} in layers.keys.'
                             .format(layer))
        else:
            raise ValueError('Did not find {} in obs.keys or var_names.'
                             .format(k))
        return x
572986
def pycode(argcount,
           kwonlyargcount,
           nlocals,
           stacksize,
           flags,
           codestring,
           constants,
           names,
           varnames,
           filename,
           name,
           firstlineno,
           lnotab,
           freevars=(),
           cellvars=()):
    
    return CodeType(
        argcount,
        kwonlyargcount,
        nlocals,
        stacksize,
        flags,
        codestring,
        constants,
        names,
        varnames,
        filename,
        name,
        firstlineno,
        lnotab,
        freevars,
        cellvars,
    )
344702
def _get_codes_for_sorting(self):
        
        from pandas.core.arrays import Categorical

        def cats(level_codes):
            return np.arange(np.array(level_codes).max() + 1 if
                             len(level_codes) else 0,
                             dtype=level_codes.dtype)

        return [Categorical.from_codes(level_codes, cats(level_codes),
                                       ordered=True)
                for level_codes in self.codes]
563186
def _getAdditionalSpecs(poolerClass=_getDefaultPoolerClass(), poolerType="union"):
  
  typeNames = {int: "UInt32", float: "Real32", str: "Byte", bool: "bool",
               tuple: "tuple"}

  def getArgType(arg):
    t = typeNames.get(type(arg), "Byte")
    count = 0 if t == "Byte" else 1
    if t == "tuple":
      t = typeNames.get(type(arg[0]), "Byte")
      count = len(arg)
    if t == "bool":
      t = "UInt32"
    return (t, count)

  def getConstraints(arg):
    t = typeNames.get(type(arg), "Byte")
    if t == "Byte":
      return "multiple"
    elif t == "bool":
      return "bool"
    else:
      return ""

  # Get arguments from pooler constructors, figure out types of
  # variables and populate poolerSpec.
  pArgTuples = _buildArgs(poolerClass)
  poolerSpec = {}
  for argTuple in pArgTuples:
    d = dict(
      description=argTuple[1],
      accessMode="ReadWrite",
      dataType=getArgType(argTuple[2])[0],
      count=getArgType(argTuple[2])[1],
      constraints=getConstraints(argTuple[2]))
    poolerSpec[argTuple[0]] = d

  # Get arguments from spatial pooler constructors, figure out types of
  # variables and populate poolerSpec.
  # This allows setting SP parameters
  pArgTuples = _buildArgs(_getParentSpatialPoolerClass(poolerType))
  for argTuple in pArgTuples:
    d = dict(
      description=argTuple[1],
      accessMode="ReadWrite",
      dataType=getArgType(argTuple[2])[0],
      count=getArgType(argTuple[2])[1],
      constraints=getConstraints(argTuple[2]))
    poolerSpec[argTuple[0]] = d

  # Add special parameters that weren't handled automatically
  # Pooler parameters only
  poolerSpec.update(dict(
    columnCount=dict(
      description="Total number of columns (coincidences).",
      accessMode="ReadWrite",
      dataType="UInt32",
      count=1,
      constraints=""),

    inputWidth=dict(
      description="Size of inputs to the UP.",
      accessMode="ReadWrite",
      dataType="UInt32",
      count=1,
      constraints=""),

    historyLength=dict(
      description="The union window length",
      accessMode="ReadWrite",
      dataType="UInt32",
      count=1,
      constraints=""),

    minHistory=dict(
      description="don't perform union (output all zeros) until buffer"
                  " length >= minHistory",
      accessMode="ReadWrite",
      dataType="UInt32",
      count=1,
      constraints=""),

     poolerType=dict(
      description="Type of pooler to use: union",
      accessMode="ReadWrite",
      dataType="Byte",
      count=0,
      constraints="enum: union"),
     ))


  # The last group is for parameters that aren't specific to pooler
  otherSpec = dict(
    learningMode=dict(
      description="1 if the node is learning (default 1).",
      accessMode="ReadWrite",
      dataType="UInt32",
      count=1,
      constraints="bool"),

    inferenceMode=dict(
      description="1 if the node outputs current inference (default 1).",
      accessMode="ReadWrite",
      dataType="UInt32",
      count=1,
      constraints="bool"),



  )

  return poolerSpec, otherSpec
85600
def code(*content, sep=' '):
    
    return _md(_join(*content, sep=sep), symbols=MD_SYMBOLS[2])
921959
def _get_data_dtype(self):
        """"""

        pkhrec = [
            ('GP_PK_HEADER', GSDTRecords.gp_pk_header),
            ('GP_PK_SH1', GSDTRecords.gp_pk_sh1)
        ]
        pk_head_dtype = np.dtype(pkhrec)

        def get_lrec(cols):
            lrec = [
                ("gp_pk", pk_head_dtype),
                ("version", np.uint8),
                ("satid", np.uint16),
                ("time", (np.uint16, 5)),
                ("lineno", np.uint32),
                ("chan_id", np.uint8),
                ("acq_time", (np.uint16, 3)),
                ("line_validity", np.uint8),
                ("line_rquality", np.uint8),
                ("line_gquality", np.uint8),
                ("line_data", (np.uint8, cols))
            ]

            return lrec

        # each pixel is 10-bits -> one line of data has 25% more bytes
        # than the number of columns suggest (10/8 = 1.25)
        visir_rec = get_lrec(int(self.mda['number_of_columns'] * 1.25))
        number_of_visir_channels = len(
            [s for s in self.mda['channel_list'] if not s == 'HRV'])
        drec = [('visir', (visir_rec, number_of_visir_channels))]

        if self.mda['available_channels']['HRV']:
            hrv_rec = get_lrec(int(self.mda['hrv_number_of_columns'] * 1.25))
            drec.append(('hrv', (hrv_rec, 3)))

        return np.dtype(drec)