Get startups based on which companies are raising funding
19334
def get_startups_filtered_by(self, filter_='raising'):
    
    url = _STARTUP_RAISING.format(c_api=_C_API_BEGINNING,
                                                                         api=_API_VERSION,
                                                                         filter_=filter_,
                                                                         at=self.access_token)
    return _get_request(url)
897508
def _getUpcomingEvents(self, request):
        """"""
        home = request.site.root_page
        return getAllUpcomingEvents(request, home=home)
386614
def _get_parts_list(to_go, so_far=[[]], ticker=None):
    
    try:
        part = to_go.pop(0)
    except IndexError:
        return so_far, ticker

    # Lists of input groups
    if isinstance(part, list) and any(isinstance(e, list) for e in part):
        while len(part) > 0:
            so_far, ticker = _get_parts_list(part, so_far, ticker)
            ticker.tick()
    # Input Group
    elif isinstance(part, list) and any(isinstance(e, Input) for e in part):
        while len(part) > 0:
            so_far, ticker = _get_parts_list(part, so_far, ticker)
    # Magic Inputs
    elif isinstance(part, Input) and part.is_magic:
        inputs = part.eval()
        while len(inputs) > 0:
            so_far, ticker = _get_parts_list(inputs, so_far, ticker)
            ticker.tick()
    # Normal inputs
    elif isinstance(part, Input) and not part.is_magic:
        so_far[ticker.value].append(part)
    # Everything else
    else:
        so_far = _append(so_far, part)

    return so_far, ticker
208405
def get_banks(self):
        """"""
        # Implemented from kitosid template for -
        # osid.resource.BinLookupSession.get_bins_template
        catalogs = self._get_provider_session('bank_lookup_session').get_banks()
        cat_list = []
        for cat in catalogs:
            cat_list.append(Bank(self._provider_manager, cat, self._runtime, self._proxy))
        return BankList(cat_list)
364470
def getReward(self):
        
        t = self.env.market.period

        # Compute revenue minus costs.
        totalEarnings = 0.0
        for g in self.env.generators:
            # Compute costs in $ (not $/hr).
            costs = g.total_cost(round(g.p, 4),
                                 self.env._g0[g]["p_cost"],
                                 self.env._g0[g]["pcost_model"])

            offbids = [ob for ob in self.env._lastAction if ob.generator == g]

            revenue = t * sum([ob.revenue for ob in offbids])
            if offbids:
                revenue += offbids[0].noLoadCost

            if g.is_load:
                earnings = costs - revenue
            else:
                earnings = revenue - costs#(fixedCost + variableCost)

            logger.debug("Generator [%s] earnings: %.2f (%.2f, %.2f)" %
                         (g.name, earnings, revenue, costs))

            totalEarnings += earnings

        # Startup/shutdown costs.
        onlineCosts = 0.0
        for i, g in enumerate(self.env.generators):
            if self._gOnline[i] and not g.online:
                onlineCosts += g.c_shutdown
            elif not self._gOnline[i] and g.online:
                onlineCosts += g.c_startup
        self._gOnline = [g.online for g in self.env.generators]

        reward = totalEarnings - onlineCosts
        self.addReward(reward)

        logger.debug("Task reward: %.2f (%.2f - %.2f)" %
                     (reward, totalEarnings, onlineCosts))

        return reward
595154
def works(self, funder_id):
        
        context = '%s/%s' % (self.ENDPOINT, str(funder_id))
        return Works(context=context)
1344302
def relevant_items(df):
    
    start_date = datetime(2013, 1, 1)

    df['DataProjeto'] = pd.to_datetime(df['DataProjeto'])

    # get only projects newer than start_date
    # and items with price > 0
    df = df[df.DataProjeto >= start_date]
    df = df[df.VlUnitarioAprovado > 0.0]

    return df
607448
def get_leads(self, *guids, **options):
        """"""
        original_options = options
        options = self.camelcase_search_options(options.copy())
        params = {}
        for i in xrange(len(guids)):
            params['guids[%s]'%i] = guids[i]
        for k in options.keys():
            if k in SEARCH_OPTIONS:
                params[k] = options[k]
                del options[k]
        leads = self._call('list/', params, **options)
        self.log.info("retrieved %s leads through API ( %soptions=%s )" % 
                (len(leads), guids and 'guids=%s, '%guids or '', original_options))
        return leads
1297430
def fundertree2json(self, tree, oai_id):
        """"""
        try:
            tree = self.get_subtree(tree, 'fundingtree')[0]
        except IndexError:  # pragma: nocover
            pass

        funder_node = self.get_subtree(tree, 'funder')
        subfunder_node = self.get_subtree(tree, '//funding_level_0')

        funder_id = self.get_text_node(funder_node[0], './id') \
            if funder_node else None
        subfunder_id = self.get_text_node(subfunder_node[0], './id') \
            if subfunder_node else None
        funder_name = self.get_text_node(funder_node[0], './shortname') \
            if funder_node else ""
        subfunder_name = self.get_text_node(subfunder_node[0], './name') \
            if subfunder_node else ""

        # Try to resolve the subfunder first, on failure try to resolve the
        # main funder, on failure raise an error.
        funder_doi_url = None
        if subfunder_id:
            funder_doi_url = self.funder_resolver.resolve_by_id(subfunder_id)
        if not funder_doi_url:
            if funder_id:
                funder_doi_url = self.funder_resolver.resolve_by_id(funder_id)
        if not funder_doi_url:
            funder_doi_url = self.funder_resolver.resolve_by_oai_id(oai_id)
        if not funder_doi_url:
            raise FunderNotFoundError(oai_id, funder_id, subfunder_id)

        funder_doi = FundRefDOIResolver.strip_doi_host(funder_doi_url)
        if not funder_name:
            # Grab name from FundRef record.
            resolver = Resolver(
                pid_type='frdoi', object_type='rec', getter=Record.get_record)
            try:
                dummy_pid, funder_rec = resolver.resolve(funder_doi)
                funder_name = funder_rec['acronyms'][0]
            except PersistentIdentifierError:
                raise OAIRELoadingError(
                    "Please ensure that funders have been loaded prior to"
                    "loading grants. Could not resolve funder {0}".format(
                        funder_doi))

        return dict(
            doi=funder_doi,
            url=funder_doi_url,
            name=funder_name,
            program=subfunder_name,
        )
726460
def run(self):
        """"""
        self._assure_output_dir(self.output)
        companies = self.read()
        print '%s CNPJs found' % len(companies)

        pbar = ProgressBar(
            widgets=[Counter(), ' ', Percentage(), ' ', Bar(), ' ', Timer()],
            maxval=len(companies)).start()

        resolved = 0
        runner = Runner(companies, self.days, self.token)

        try:
            for data in runner:
                self.write(data)
                resolved = resolved + 1
                pbar.update(resolved)
        except KeyboardInterrupt:
            print '\naborted: waiting current requests to finish.'
            runner.stop()
            return

        pbar.finish()
228632
def get_status_updates(self, startup_id):
    
    return _get_request(_STATUS_U.format(c_api=_C_API_BEGINNING,
                                                             api=_API_VERSION,
                                                             startup_id=startup_id,
                                                             at=self.access_token))
751133
async function () {
    logger.info('* Funding required users with ST\'');
    logger.info('* Utility Chain Owner funding ST\' on utility chain to staker');
    await setupFundManager.transferSTP(utilityChainOwnerAddr, utilityChainOwnerPassphrase, stakerAddr,
      MIN_FUND.mul(100).toString(10));

    logger.info('* Utility Chain Owner funding ST\' on utility chain to redeemer');
    await setupFundManager.transferSTP(utilityChainOwnerAddr, utilityChainOwnerPassphrase, redeemerAddr,
      MIN_FUND.mul(100).toString(10));

    logger.info('* Utility Chain Owner funding ST\' on utility chain to utilityRegistrar');
    await setupFundManager.transferSTP(utilityChainOwnerAddr, utilityChainOwnerPassphrase, utilityRegistrarAddr,
      MIN_FUND.mul(100).toString(10));

    logger.info('* Utility Chain Owner funding ST\' on utility chain to utilityOps');
    await setupFundManager.transferSTP(utilityChainOwnerAddr, utilityChainOwnerPassphrase, utilityOpsAddr,
      MIN_FUND.mul(100).toString(10));

    logger.info('* Utility Chain Owner funding ST\' on utility chain to utilityDeployer');
    await setupFundManager.transferSTP(utilityChainOwnerAddr, utilityChainOwnerPassphrase, utilityDeployerAddr,
      MIN_FUND.mul(100).toString(10));

    return Promise.resolve();
  }
24582
def full_award_group_funding_source(tag):
    
    award_group_funding_sources = []
    funding_source_nodes = extract_nodes(tag, "funding-source")
    for funding_source_node in funding_source_nodes:

        award_group_funding_source = {}

        institution_nodes = extract_nodes(funding_source_node, 'institution')

        institution_node = first(institution_nodes)
        if institution_node:
            award_group_funding_source['institution'] = node_text(institution_node)
            if 'content-type' in institution_node.attrs:
                award_group_funding_source['institution-type'] = institution_node['content-type']

        institution_id_nodes = extract_nodes(funding_source_node, 'institution-id')
        institution_id_node = first(institution_id_nodes)
        if institution_id_node:
            award_group_funding_source['institution-id'] = node_text(institution_id_node)
            if 'institution-id-type' in institution_id_node.attrs:
                award_group_funding_source['institution-id-type'] = institution_id_node['institution-id-type']

        award_group_funding_sources.append(award_group_funding_source)

    return award_group_funding_sources
640827
def get_startup_roles(self, user_id=None, startup_id=None, role=None, direction='incoming'):
    

    if user_id is None and startup_id is None:
      raise Exception("You need to provide at least one parameter")
    url = _STARTUP_R.format(c_api=_C_API_BEGINNING,
                                          api=_API_VERSION,
                                          at=self.access_token)
    if user_id is not None:
      url += '&user_id=' + str(user_id)
    if startup_id is not None:
      url += '&startup_id=' + str(startup_id)
    if role is not None:
      url += '&role=' + role
    url += '&direction' + direction
    return _get_request(url)
121574
def _get_convergence_plans(project, service_names):
    '''
    
    '''
    ret = {}
    plans = project._get_convergence_plans(project.get_services(service_names),
                                           ConvergenceStrategy.changed)
    for cont in plans:
        (action, container) = plans[cont]
        if action == 'create':
            ret[cont] = 'Creating container'
        elif action == 'recreate':
            ret[cont] = 'Re-creating container'
        elif action == 'start':
            ret[cont] = 'Starting container'
        elif action == 'noop':
            ret[cont] = 'Container is up to date'
    return ret
1077032
def company(self):
        
        pattern = self.random_element(self.formats)
        return self.generator.parse(pattern)
83943
function getTrendingTags(options, callback) {
    if (!options) options = {};

    return this._request({
      api: '/tags',
      endpoint: '/trending',
      method: 'GET'
    }, callback);
  }