code stringlengths 20 1.04M | apis sequence | extract_api stringlengths 75 9.94M |
|---|---|---|
import os
import pytest
# No CLI test due to sc-show
@pytest.mark.eda
@pytest.mark.quick
def test_py(setup_example_test):
setup_example_test('fibone')
import fibone
fibone.main()
assert os.path.isfile('build/mkFibOne/job0/export/0/outputs/mkFibOne.gds')
| [
"fibone.main",
"os.path.isfile"
] | [((181, 194), 'fibone.main', 'fibone.main', ([], {}), '()\n', (192, 194), False, 'import fibone\n'), ((207, 274), 'os.path.isfile', 'os.path.isfile', (['"""build/mkFibOne/job0/export/0/outputs/mkFibOne.gds"""'], {}), "('build/mkFibOne/job0/export/0/outputs/mkFibOne.gds')\n", (221, 274), False, 'import os\n')] |
from setuptools import setup
from setuptools.command.develop import develop
setup(name='retroprime',
py_modules=['retroprime']) | [
"setuptools.setup"
] | [((78, 129), 'setuptools.setup', 'setup', ([], {'name': '"""retroprime"""', 'py_modules': "['retroprime']"}), "(name='retroprime', py_modules=['retroprime'])\n", (83, 129), False, 'from setuptools import setup\n')] |
# import the necessary packages
from tensorflow.keras.models import load_model
from image_classification.data import DataDispatcher
from image_classification.utils import config
from image_classification.layers import Mish
import numpy as np
import argparse
# construct an argument parser to parse the command line argu... | [
"tensorflow.keras.models.load_model",
"image_classification.data.DataDispatcher",
"numpy.ceil",
"argparse.ArgumentParser",
"numpy.round"
] | [((331, 356), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (354, 356), False, 'import argparse\n'), ((491, 507), 'image_classification.data.DataDispatcher', 'DataDispatcher', ([], {}), '()\n', (505, 507), False, 'from image_classification.data import DataDispatcher\n'), ((563, 621), 'tensorfl... |
import folium
from pathlib import Path
from sportgems import parse_fit_data, find_fastest_section
# desired fastest sections to parse, note larges must come first in
# order to be able to render the smaller sections on top of the larger ones
sections = [5000, 3000, 2000, 1000]
colors = ["yellow", "blue", "green", "red... | [
"folium.PolyLine",
"pathlib.Path",
"sportgems.find_fastest_section",
"folium.Map"
] | [((658, 696), 'folium.PolyLine', 'folium.PolyLine', (['coords'], {'color': '"""black"""'}), "(coords, color='black')\n", (673, 696), False, 'import folium\n'), ((707, 768), 'folium.Map', 'folium.Map', ([], {'location': 'fit_data.coordinates[300]', 'zoom_start': '(15)'}), '(location=fit_data.coordinates[300], zoom_start... |
from flask import Flask, render_template, abort
from fauxsnow import ResortModel, ForecastAPILoader, ForecastModel
app = Flask(__name__)
view_count = 0
@app.route("/")
def welcome():
resort_model = ResortModel()
resorts = resort_model.get_all_resorts()
return render_template("welcome.html", resorts=res... | [
"flask.Flask",
"fauxsnow.ForecastModel",
"flask.abort",
"fauxsnow.ForecastAPILoader",
"fauxsnow.ResortModel",
"flask.render_template"
] | [((122, 137), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (127, 137), False, 'from flask import Flask, render_template, abort\n'), ((207, 220), 'fauxsnow.ResortModel', 'ResortModel', ([], {}), '()\n', (218, 220), False, 'from fauxsnow import ResortModel, ForecastAPILoader, ForecastModel\n'), ((277, 325)... |
from PyQt5.QtCore import Qt, QSize
from PyQt5.QtWidgets import QToolButton
from PyQt5 import QtGui
import filedockstylesheet as style
class FolderButton(QToolButton):
def __init__(self, folderNumber, layoutPosition, path, clicked, parent=None):
super(FolderButton, self).__init__(parent)
self.... | [
"PyQt5.QtGui.QIcon",
"PyQt5.QtCore.QSize"
] | [((621, 634), 'PyQt5.QtCore.QSize', 'QSize', (['(50)', '(50)'], {}), '(50, 50)\n', (626, 634), False, 'from PyQt5.QtCore import Qt, QSize\n'), ((656, 692), 'PyQt5.QtGui.QIcon', 'QtGui.QIcon', (['"""assets/folderIcon.png"""'], {}), "('assets/folderIcon.png')\n", (667, 692), False, 'from PyQt5 import QtGui\n')] |
import random
from typing import TypeVar, MutableSequence
T = TypeVar('T')
def sample_items_inplace(items: MutableSequence[T], sample_size: int, item_limit: int = None):
"""Moves sampled elements to the end of items list.
When sample size is equal to the size of the items list it
shuffles items in-place... | [
"typing.TypeVar",
"random.randrange"
] | [((63, 75), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (70, 75), False, 'from typing import TypeVar, MutableSequence\n'), ((772, 804), 'random.randrange', 'random.randrange', (['(item_limit - i)'], {}), '(item_limit - i)\n', (788, 804), False, 'import random\n')] |
import re
def capture(input: str, regex: str, pattern_flags: int = 0, groupnum: int = 1, fail_gently: bool = False) -> str:
pattern = re.compile(regex, pattern_flags)
match = pattern.search(input)
if match is None:
if not fail_gently:
raise Warning(f'Attempt to match {regex} on {input}... | [
"re.compile"
] | [((140, 172), 're.compile', 're.compile', (['regex', 'pattern_flags'], {}), '(regex, pattern_flags)\n', (150, 172), False, 'import re\n')] |
# -*- coding: utf-8 -*-
import io
import re
import demjson3
import pandas as pd
import requests
from zvt.api.utils import china_stock_code_to_id
from zvt.contract.api import df_to_db
from zvt.contract.recorder import Recorder
from zvt.domain import EtfStock, Etf
from zvt.recorders.consts import DEFAULT_SH_ETF_LIST_H... | [
"pandas.DataFrame",
"pandas.read_html",
"io.BytesIO",
"zvt.utils.time_utils.now_pd_timestamp",
"zvt.contract.api.df_to_db",
"zvt.api.utils.china_stock_code_to_id",
"demjson3.decode",
"requests.get",
"re.search",
"pandas.concat"
] | [((772, 825), 'requests.get', 'requests.get', (['url'], {'headers': 'DEFAULT_SH_ETF_LIST_HEADER'}), '(url, headers=DEFAULT_SH_ETF_LIST_HEADER)\n', (784, 825), False, 'import requests\n'), ((850, 880), 'demjson3.decode', 'demjson3.decode', (['response.text'], {}), '(response.text)\n', (865, 880), False, 'import demjson3... |
# Copyright (c) 2020, <NAME>, Honda Research Institute Europe GmbH, and
# Technical University of Darmstadt.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code mus... | [
"torch.mean",
"pyrado.PathErr",
"pyrado.utils.argparser.get_argparser",
"numpy.argsort",
"pyrado.ValueErr",
"torch.std",
"torch.max",
"pyrado.utils.experiments.load_rollouts_from_dir",
"tabulate.tabulate",
"pyrado.logger.experiment.ask_for_experiment",
"os.path.join",
"os.listdir"
] | [((2432, 2462), 'pyrado.utils.experiments.load_rollouts_from_dir', 'load_rollouts_from_dir', (['ex_dir'], {}), '(ex_dir)\n', (2454, 2462), False, 'from pyrado.utils.experiments import load_rollouts_from_dir\n'), ((2548, 2566), 'os.listdir', 'os.listdir', (['ex_dir'], {}), '(ex_dir)\n', (2558, 2566), False, 'import os\n... |
import sys
if __name__ == '__main__':
N = int(sys.stdin.readline())
rating = [int(sys.stdin.readline()) for i in range(N)]
candies = [1] * N
for i in range(N - 1):
if rating[i + 1] > rating[i]:
candies[i + 1] = candies[i] + 1
for i in reversed(range(N - 1)):
if rating... | [
"sys.stdin.readline"
] | [((51, 71), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (69, 71), False, 'import sys\n'), ((91, 111), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (109, 111), False, 'import sys\n')] |
import numpy as np
def one_step_lookahead(environment, state, V, discount_factor):
"""
Helper function to calculate a state-value function.
:param environment: Initialized OpenAI gym environment object.
:param state: Agent's state to consider (integer).
:param V: The value to use as an estimator.... | [
"numpy.abs",
"numpy.argmax",
"numpy.zeros",
"numpy.ones",
"numpy.max",
"numpy.eye"
] | [((502, 526), 'numpy.zeros', 'np.zeros', (['environment.nA'], {}), '(environment.nA)\n', (510, 526), True, 'import numpy as np\n'), ((1553, 1577), 'numpy.zeros', 'np.zeros', (['environment.nS'], {}), '(environment.nS)\n', (1561, 1577), True, 'import numpy as np\n'), ((5437, 5461), 'numpy.zeros', 'np.zeros', (['environm... |
# BuildTarget: images/interfaceDefaultLightPlug.png
# BuildTarget: images/interfaceLightLinkSetupGraphEditor.png
# BuildTarget: images/interfaceLightSetGraphEditor.png
# BuildTarget: images/interfaceLightSetNodeEditor.png
# BuildTarget: images/interfaceLinkedLightsPlug.png
# BuildTarget: images/taskLightLinkingSetExpre... | [
"GafferScene.Sphere",
"GafferUI.PlugValueWidget.acquire",
"GafferUI.WidgetAlgo.grab",
"GafferSceneUI.SceneInspector",
"GafferUI.ScriptWindow.acquire",
"GafferAppleseed.AppleseedLight",
"GafferScene.StandardAttributes",
"IECore.PathMatcher",
"GafferScene.Group",
"GafferUI.NodeEditor.acquire",
"Ga... | [((607, 644), 'GafferUI.ScriptWindow.acquire', 'GafferUI.ScriptWindow.acquire', (['script'], {}), '(script)\n', (636, 644), False, 'import GafferUI\n'), ((901, 921), 'GafferScene.Sphere', 'GafferScene.Sphere', ([], {}), '()\n', (919, 921), False, 'import GafferScene\n'), ((940, 959), 'GafferScene.Group', 'GafferScene.G... |
import numpy as np
def hit_rate(array1, array2):
"""
calculate the hit rate based upon 2 boolean maps. (i.e. where are both 1)
"""
# count the number of cells that are flooded in both array1 and 2
idx_both = np.sum(np.logical_and(array1, array2))
idx_1 = np.sum(array1)
return float(idx... | [
"numpy.sum",
"numpy.logical_and",
"numpy.zeros",
"numpy.logical_or",
"numpy.int16"
] | [((280, 294), 'numpy.sum', 'np.sum', (['array1'], {}), '(array1)\n', (286, 294), True, 'import numpy as np\n'), ((665, 679), 'numpy.sum', 'np.sum', (['array2'], {}), '(array2)\n', (671, 679), True, 'import numpy as np\n'), ((1640, 1662), 'numpy.zeros', 'np.zeros', (['array1.shape'], {}), '(array1.shape)\n', (1648, 1662... |
import apsis.actions
import apsis.lib.json
from apsis.lib.py import tupleize
from apsis.lib import email
#-------------------------------------------------------------------------------
# FIXME: jinja2?
TEMPLATE = """<!doctype html>
<html>
<head>
<title>{subject}</title>
</head>
<body>
<p>
program: <code>{pro... | [
"apsis.lib.py.tupleize",
"apsis.lib.email.send_html"
] | [((554, 566), 'apsis.lib.py.tupleize', 'tupleize', (['to'], {}), '(to)\n', (562, 566), False, 'from apsis.lib.py import tupleize\n'), ((1730, 1809), 'apsis.lib.email.send_html', 'email.send_html', (['self.__to', 'subject', 'body'], {'from_': 'self.__from', 'smtp_cfg': 'smtp_cfg'}), '(self.__to, subject, body, from_=sel... |
# -*- coding:utf-8 -*-
"""
Asynchronous driven quantitative trading framework.
Author: HuangTao
Date: 2017/04/26
Email: <EMAIL>
"""
import signal
import asyncio
from quant.utils import logger
from quant.config import config
class Quant:
""" Asynchronous driven quantitative trading framework.
"""
d... | [
"asyncio.get_event_loop",
"quant.event.EventCenter",
"quant.utils.logger.initLogger",
"quant.utils.logger.info",
"quant.config.config.loads",
"quant.config.config.log.get",
"signal.signal"
] | [((955, 1003), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'keyboard_interrupt'], {}), '(signal.SIGINT, keyboard_interrupt)\n', (968, 1003), False, 'import signal\n'), ((1013, 1058), 'quant.utils.logger.info', 'logger.info', (['"""start io loop ..."""'], {'caller': 'self'}), "('start io loop ...', caller=self)... |
"""
extract configuration
"""
import re
_prompt = "ConfigExtractor > "
def _printConfig(str):
print('%s%s' % (_prompt,str))
def _Service(str):
tmpSvcNew = None
tmpSvcOld = None
# get new service
try:
svcMgr = theApp.serviceMgr()
tmpSvcNew = getattr(svcMgr,str)
except Excepti... | [
"re.search",
"AthenaCommon.AlgSequence.AlgSequence",
"ROOT.gROOT.GetListOfFiles",
"re.sub"
] | [((17136, 17163), 'ROOT.gROOT.GetListOfFiles', 'ROOT.gROOT.GetListOfFiles', ([], {}), '()\n', (17161, 17163), False, 'import ROOT\n'), ((4625, 4638), 'AthenaCommon.AlgSequence.AlgSequence', 'AlgSequence', ([], {}), '()\n', (4636, 4638), False, 'from AthenaCommon.AlgSequence import AlgSequence\n'), ((7126, 7163), 're.se... |
# Project: File Volume Indexer
# Author: <NAME>
# Date Started: February 28, 2019
# Copyright: (c) Copyright 2019 <NAME>
# Module: FrameScroller
# Purpose: View for managing scans of volumes and sub volumes.
# Development:
# Instructions for use:
# Sinc... | [
"tkinter.Text",
"tkinter.LabelFrame.__init__",
"tkinter.Scrollbar",
"tkinter.Frame",
"tkinter.Tk"
] | [((3122, 3126), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (3124, 3126), False, 'from tkinter import Frame, LabelFrame, Tk, Text, Scrollbar, Label, BOTTOM, W, RIGHT, X, Y, VERTICAL, HORIZONTAL, BOTH, INSERT\n'), ((1595, 1642), 'tkinter.LabelFrame.__init__', 'LabelFrame.__init__', (['self', 'container'], {'name': 'name'}), '... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | [
"unittest.mock.patch.object",
"ironic.tests.unit.api.utils.post_get_test_deploy_template",
"ironic.common.exception.DeployTemplateAlreadyExists",
"ironic.api.controllers.v1.max_version",
"oslo_utils.uuidutils.generate_uuid",
"oslo_utils.timeutils.parse_isotime",
"ironic.tests.unit.objects.utils.create_t... | [((13665, 13729), 'unittest.mock.patch.object', 'mock.patch.object', (['objects.DeployTemplate', '"""save"""'], {'autospec': '(True)'}), "(objects.DeployTemplate, 'save', autospec=True)\n", (13682, 13729), False, 'from unittest import mock\n'), ((39676, 39743), 'unittest.mock.patch.object', 'mock.patch.object', (['obje... |
import pandas as pd
import glob
import os
import yaml
import sys
def namesToReads(reference_dir, names_to_reads, salmon_dir):
if os.path.isfile(os.path.join(reference_dir,names_to_reads)):
print("Salmon reads file previously created; new file will not be created from Salmon directory.")
sys.exit(0... | [
"pandas.read_csv",
"os.path.join",
"sys.exit"
] | [((150, 193), 'os.path.join', 'os.path.join', (['reference_dir', 'names_to_reads'], {}), '(reference_dir, names_to_reads)\n', (162, 193), False, 'import os\n'), ((310, 321), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (318, 321), False, 'import sys\n'), ((352, 387), 'os.path.join', 'os.path.join', (['salmon_dir', '... |
import time
import pandas as pd
import numpy as np
CITY_DATA = { 'chicago': 'chicago.csv',
'new york city': 'new_york_city.csv',
'washington': 'washington.csv' }
month_list = ['January', 'February', 'March', 'April', 'May', 'June']
day_list = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', ... | [
"pandas.read_csv",
"pandas.to_datetime",
"time.time"
] | [((3531, 3559), 'pandas.read_csv', 'pd.read_csv', (['CITY_DATA[city]'], {}), '(CITY_DATA[city])\n', (3542, 3559), True, 'import pandas as pd\n'), ((3583, 3615), 'pandas.to_datetime', 'pd.to_datetime', (["df['Start Time']"], {}), "(df['Start Time'])\n", (3597, 3615), True, 'import pandas as pd\n'), ((5451, 5462), 'time.... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 3