Fetch all of the existing bases for the given unit. A base is a
conversion factor that was directly added, or the inverse of one that
was directly added.
483951
private List<Unit> getBases(Unit unit) {
    Map<Unit, UnitFactor> map = factors.get(unit);
    if (map != null) {
      return map.values().stream().map(u -> u.unit()).collect(Collectors.toList());
    }
    return Collections.emptyList();
  }
961743
def basis(self, n):
        
        if n == 0:
            return self(np.array([1.]))
        vals = np.ones(n+1)
        vals[1::2] = -1
        return self(vals)
1085107
def convert_base(arg, from_base, to_base):
    
    return ops.BaseConvert(arg, from_base, to_base).to_expr()
381399
async def gen(self, name):
        '''
        
        '''
        if self.ctor is None:
            raise s_exc.NoSuchCtor(name=name, mesg='BaseRef.gen() requires ctor')

        base = self.base_by_name.get(name)

        if base is None:
            base = await self.ctor(name)
            self.put(name, base)
        else:
            base.incref()

        return base
283357
def merge(base: Dict[Any, Any], extension: Dict[Any, Any]) -> Dict[Any, Any]:
    '''

    '''

    _ = copy.deepcopy(base)

    for key, value in extension.items():
        if isinstance(value, Dict) and key in _:
            _[key] = merge(_[key], value)
        else:
            _[key] = value

    return _
332646
def getListOfBases():
    
    downer = Downloader()
    data = downer.download(ALEPH_URL + "/F/?func=file&file_name=base-list")
    dom = dhtmlparser.parseString(data.lower())

    # from default aleph page filter links containing local_base in their href
    base_links = filter(
        lambda x: "href" in x.params and "local_base" in x.params["href"],
        dom.find("a")
    )

    # split links by & - we will need only XXX from link.tld/..&local_base=XXX
    base_links = map(
        lambda x: x.params["href"].replace("?", "&", 1).split("&"),
        base_links
    )

    # filter only sections containing bases
    bases = map(
        lambda link: filter(lambda base: "local_base=" in base, link)[0],
        base_links
    )

    # filter bases from base sections
    bases = map(lambda x: x.split("=")[1].strip(), bases)

    return list(set(bases))
657436
def in_base(self, base):
        
        if base == self.base:
            return copy.deepcopy(self)
        (result, _) = Radices.from_rational(self.as_rational(), base)
        return result
543293
def _get_mixins_(bases):
        
        if not bases or Enum is None:
            return object, Enum


        # double check that we are not subclassing a class with existing
        # enumeration members; while we're at it, see if any other data
        # type has been mixed in so we can use the correct __new__
        member_type = first_enum = None
        for base in bases:
            if  (base is not Enum and
                    issubclass(base, Enum) and
                    base._member_names_):
                raise TypeError("Cannot extend enumerations")
        # base is now the last base in bases
        if not issubclass(base, Enum):
            raise TypeError("new enumerations must be created as "
                    "`ClassName([mixin_type,] enum_type)`")

        # get correct mix-in type (either mix-in type of Enum subclass, or
        # first base if last base is Enum)
        if not issubclass(bases[0], Enum):
            member_type = bases[0]     # first data type
            first_enum = bases[-1]  # enum type
        else:
            for base in bases[0].__mro__:
                # most common: (IntEnum, int, Enum, object)
                # possible:    (<Enum 'AutoIntEnum'>, <Enum 'IntEnum'>,
                #               <class 'int'>, <Enum 'Enum'>,
                #               <class 'object'>)
                if issubclass(base, Enum):
                    if first_enum is None:
                        first_enum = base
                else:
                    if member_type is None:
                        member_type = base

        return member_type, first_enum
714936
def convertbase(number, base=10):
    

    integer = number
    if not integer:
        return '0'
    sign = 1 if integer > 0 else -1
    alphanum = string.digits + string.ascii_lowercase
    nums = alphanum[:base]
    res = ''
    integer *= sign
    while integer:
        integer, mod = divmod(integer, base)
        res += nums[mod]
    return ('' if sign == 1 else '-') + res[::-1]
422001
public static double getHaltonNumberForGivenBase(long index, int base) {
		index += 1;

		double x = 0.0;
		double factor = 1.0 / base;
		while(index > 0) {
			x += (index % base) * factor;
			factor /= base;
			index /= base;
		}

		return x;
	}
954036
def get_counter(data, base):
    

    b0 = data[base]
    b1 = data[base + 1]
    b2 = data[base + 2]
    b3 = data[base + 3]

    counter = b3
    position = (b1 << 8) + b2

    return counter, position
583536
function Base (source, layer, options) {
  options = options || {};
  this._id = options.id || Base.$generateId();
}
1094303
public Double getBaseDouble()
    {
        return (this.value == null) || (this.uom == null)
               ? null
               : this.uom.getBaseDouble(((Number) this.value).doubleValue());
    }
970937
public Iterator getAllBaseTypes()
    {
        ArrayList baseTypes = new ArrayList();

        baseTypes.addAll(_directBaseTypes.values());

        for (int idx = baseTypes.size() - 1; idx >= 0; idx--)
        {
            ClassDescriptorDef curClassDef = (ClassDescriptorDef)baseTypes.get(idx);

            for (Iterator it = curClassDef.getDirectBaseTypes(); it.hasNext();)
            {
                ClassDescriptorDef curBaseTypeDef = (ClassDescriptorDef)it.next();

                if (!baseTypes.contains(curBaseTypeDef))
                {
                    baseTypes.add(0, curBaseTypeDef);
                    idx++;
                }
            }
        }
        return baseTypes.iterator();
    }
366268
def list_reference_bases(self, id_, start=0, end=None):
        
        request = protocol.ListReferenceBasesRequest()
        request.start = pb.int(start)
        request.end = pb.int(end)
        request.reference_id = id_
        not_done = True
        # TODO We should probably use a StringIO here to make string buffering
        # a bit more efficient.
        bases_list = []
        while not_done:
            response = self._run_list_reference_bases_page_request(request)
            bases_list.append(response.sequence)
            not_done = bool(response.next_page_token)
            request.page_token = response.next_page_token
        return "".join(bases_list)
178552
def base(self, du):
        """"""
        parameter = 'base'
        if parameter not in self._by:
            self._by[parameter] = {}
            for clb in self.upi.values():
                if clb.floor == 0:
                    self._by[parameter][clb.du] = clb
        return self._by[parameter][du]
1091229
def sorted_bases(bases):
    '''
    '''
    ret = []

    for base in bases:
        # lst = [super(base), super(super(base)), ..., highest_base]
        lst = _bases(base)

        if not ret:
            ret = lst
        elif not any(b in ret for b in lst):
            ret += lst
        else:
            buf = []
            for b in lst:
                if b in ret:
                    if buf:
                        ret = graft(ret, buf, ret.index(b))
                        buf = []
                else:
                    buf.append(b)
            if buf:
                ret += buf

    return ret