code
stringlengths
22
1.05M
apis
listlengths
1
3.31k
extract_api
stringlengths
75
3.25M
from django.http import HttpResponse from django.shortcuts import get_object_or_404 from django.template import Context, Template from .models import Person def get_person(request, pk): person = get_object_or_404(Person, pk=pk) return HttpResponse(person.name) def no_template_used(request): ...
[ "django.template.Template", "django.http.HttpResponse", "django.shortcuts.get_object_or_404", "django.template.Context" ]
[((210, 242), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Person'], {'pk': 'pk'}), '(Person, pk=pk)\n', (227, 242), False, 'from django.shortcuts import get_object_or_404\n'), ((255, 280), 'django.http.HttpResponse', 'HttpResponse', (['person.name'], {}), '(person.name)\n', (267, 280), False, 'from dj...
"""Implementation of custom session system. Credit for this can go to the warehouse project where I find how to implement custom session system with redis. Differences are noted: - Warehouse use it's own implementation for the TimestampSigner and BadSignature - The factory session does not initialize Redis exac...
[ "os.urandom", "msgpack.packb", "zope.interface.implementer", "functools.wraps", "msgpack.unpackb", "itsdangerous.TimestampSigner", "redis.StrictRedis", "time.time" ]
[((1140, 1161), 'zope.interface.implementer', 'implementer', (['ISession'], {}), '(ISession)\n', (1151, 1161), False, 'from zope.interface import implementer\n'), ((6055, 6083), 'zope.interface.implementer', 'implementer', (['ISessionFactory'], {}), '(ISessionFactory)\n', (6066, 6083), False, 'from zope.interface impor...
"""add proto type settings for dial vpn. Revision ID: 45c7c3141a21 Revises: 313c830f061c Create Date: 2014-10-10 10:22:23.395475 """ # revision identifiers, used by Alembic. revision = '45c7c3141a21' down_revision = '313c830f061c' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto...
[ "sqlalchemy.String", "alembic.op.drop_column" ]
[((575, 615), 'alembic.op.drop_column', 'op.drop_column', (['"""dial_settings"""', '"""proto"""'], {}), "('dial_settings', 'proto')\n", (589, 615), False, 'from alembic import op\n'), ((417, 437), 'sqlalchemy.String', 'sa.String', ([], {'length': '(80)'}), '(length=80)\n', (426, 437), True, 'import sqlalchemy as sa\n')...
#!/usr/bin/env python """Wrapper script with bjobs functionality.""" from __future__ import print_function import sys import re import argparse from utility import color from useraliases import lookupalias from shortcuts import ejobsshortcuts from readjobs import readjobs from printjobs import printjobs from groupj...
[ "shortcuts.ejobsshortcuts.items", "readhosts.readhosts", "argparse.ArgumentParser", "utility.color", "re.match", "readjobs.readjobs", "printjobs.printjobs", "re.sub", "sumjobs.sumjobs", "printhosts.printhosts", "groupjobs.groupjobs" ]
[((1435, 1457), 'shortcuts.ejobsshortcuts.items', 'ejobsshortcuts.items', ([], {}), '()\n', (1455, 1457), False, 'from shortcuts import ejobsshortcuts\n'), ((2056, 2091), 'readjobs.readjobs', 'readjobs', (['bjobsargs'], {'fast': 'args.fast'}), '(bjobsargs, fast=args.fast)\n', (2064, 2091), False, 'from readjobs import ...
from collections import namedtuple Transition = namedtuple('Transition', ('state', 'action', 'next_state', 'reward')) class DotDict(dict): """dot.notation access to dictionary attributes Refer: https://stackoverflow.com/questions/2352181/how-to-use-a-dot-to-access-members-of-dictiona...
[ "collections.namedtuple" ]
[((50, 119), 'collections.namedtuple', 'namedtuple', (['"""Transition"""', "('state', 'action', 'next_state', 'reward')"], {}), "('Transition', ('state', 'action', 'next_state', 'reward'))\n", (60, 119), False, 'from collections import namedtuple\n')]
from web3 import ( Web3, ) class EthSigner(): def __init__( self, keystore: str, privkey_name: str, privkey_pwd: str ) -> None: self.web3 = Web3() self.eth_privkey = self.web3.eth.account.decrypt( keystore, privkey_pwd) acct = self.web3.e...
[ "web3.Web3" ]
[((194, 200), 'web3.Web3', 'Web3', ([], {}), '()\n', (198, 200), False, 'from web3 import Web3\n')]
# Look for #IMPLEMENT tags in this file. These tags indicate what has # to be implemented to complete the warehouse domain. # You may add only standard python imports---i.e., ones that are automatically # available on TEACH.CS # You may not remove any imports. # You may not import or otherwise source any o...
[ "os.times" ]
[((8966, 8976), 'os.times', 'os.times', ([], {}), '()\n', (8974, 8976), False, 'import os\n'), ((10803, 10813), 'os.times', 'os.times', ([], {}), '()\n', (10811, 10813), False, 'import os\n'), ((10199, 10209), 'os.times', 'os.times', ([], {}), '()\n', (10207, 10209), False, 'import os\n'), ((11906, 11916), 'os.times', ...
''' Created on 15 Oct 2015 @author: mbrandaoca ''' from migrate.versioning import api from config import SQLALCHEMY_DATABASE_URI from config import SQLALCHEMY_MIGRATE_REPO from gameevents_app import db, create_app import os.path import sys app = create_app() with app.app_context(): db.create_all() #...
[ "random.choice", "gameevents_app.db.session.add", "gameevents_app.create_app", "gameevents_app.db.session.flush", "gameevents_app.models.client.Client", "gameevents_app.db.session.rollback", "gameevents_app.db.create_all", "gameevents_app.db.session.commit", "sys.stdout.write" ]
[((248, 260), 'gameevents_app.create_app', 'create_app', ([], {}), '()\n', (258, 260), False, 'from gameevents_app import db, create_app\n'), ((289, 304), 'gameevents_app.db.create_all', 'db.create_all', ([], {}), '()\n', (302, 304), False, 'from gameevents_app import db, create_app\n'), ((619, 663), 'gameevents_app.mo...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import sys from setuptools import setup def get_version(package): """ Return package version as listed in `__version__` in `init.py`. """ init_py = open(os.path.join(package, '__init__.py')).read() return re.search("__version__ = ...
[ "os.path.join", "os.walk", "re.search" ]
[((295, 350), 're.search', 're.search', (['"""__version__ = [\'"]([^\'"]+)[\'"]"""', 'init_py'], {}), '(\'__version__ = [\\\'"]([^\\\'"]+)[\\\'"]\', init_py)\n', (304, 350), False, 'import re\n'), ((646, 662), 'os.walk', 'os.walk', (['package'], {}), '(package)\n', (653, 662), False, 'import os\n'), ((239, 275), 'os.pa...
import unittest from appium import webdriver # Test from time import sleep class InvitationAppTestAppium(unittest.TestCase): def setUp(self): desired_caps = {} desired_caps['platformName']='Android' desired_caps['platformVersion']='5.1' desired_caps['deviceName']='RGS8DUAU...
[ "unittest.TestLoader", "unittest.TextTestRunner", "time.sleep", "appium.webdriver.Remote" ]
[((477, 539), 'appium.webdriver.Remote', 'webdriver.Remote', (['"""http://localhost:4723/wd/hub"""', 'desired_caps'], {}), "('http://localhost:4723/wd/hub', desired_caps)\n", (493, 539), False, 'from appium import webdriver\n'), ((712, 720), 'time.sleep', 'sleep', (['(5)'], {}), '(5)\n', (717, 720), False, 'from time i...
# builtin packages import os import numpy as np from tqdm import tqdm # torch import torch from torch import optim from torch.utils.data import DataLoader # from my module from depth_completion.data import DepthDataset from depth_completion.data import customed_collate_fn import depth_completion.utils.loss_func as lo...
[ "numpy.mean", "torch.ones_like", "torch.nn.parallel.data_parallel", "depth_completion.data.customed_collate_fn", "os.path.isdir", "os.mkdir", "torch.no_grad", "torch.cat", "depth_completion.data.DepthDataset" ]
[((6279, 6304), 'numpy.mean', 'np.mean', (['total_valid_loss'], {}), '(total_valid_loss)\n', (6286, 6304), True, 'import numpy as np\n'), ((7833, 7858), 'numpy.mean', 'np.mean', (['total_train_loss'], {}), '(total_train_loss)\n', (7840, 7858), True, 'import numpy as np\n'), ((8583, 8639), 'torch.cat', 'torch.cat', (['[...
"""Runway deploy environment object.""" from __future__ import annotations import json import logging import os import sys from pathlib import Path from typing import TYPE_CHECKING, Any, Dict, Optional, cast import click from ...compat import cached_property from ...type_defs import EnvVarsAwsCredentialsTypeDef from...
[ "click.prompt", "pathlib.Path.cwd", "json.dumps", "os.environ.copy", "os.cpu_count", "sys.exit" ]
[((1706, 1716), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (1714, 1716), False, 'from pathlib import Path\n'), ((1748, 1765), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (1763, 1765), False, 'import os\n'), ((12154, 12243), 'click.prompt', 'click.prompt', (['"""Deploy environment name"""'], {'default...
from random import randint import os.path import pytest import dataactcore.config # Load all models so we can access them through baseModel.Base.metadata from dataactcore.models import ( # noqa baseModel, domainModels, fsrs, errorModels, jobModels, stagingModels, userModel, validationModels) from dataactco...
[ "dataactcore.scripts.databaseSetup.createDatabase", "dataactcore.interfaces.db.dbConnection", "dataactcore.scripts.setupUserDB.insertCodes", "dataactcore.scripts.setupJobTrackerDB.insertCodes", "dataactcore.scripts.databaseSetup.runMigrations", "dataactcore.scripts.databaseSetup.dropDatabase", "pytest.f...
[((520, 551), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (534, 551), False, 'import pytest\n'), ((1237, 1253), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1251, 1253), False, 'import pytest\n'), ((1574, 1590), 'pytest.fixture', 'pytest.fixture', ([], {}), '()...
import os import logging DOCKER_PID_CMD = "docker inspect {} --format='{{{{.State.Pid}}}}'" NSS_CMD = "lsns -p {} -t pid | tail -n 1 | awk '{{print $1}}'" def replace_namespace(text, args): nss = None text = text.replace("SAVE_NAMESPACE", """ struct task_struct *t = (struct task_struct *) bpf_get_curre...
[ "logging.exception" ]
[((771, 809), 'logging.exception', 'logging.exception', (['msg', 'args.container'], {}), '(msg, args.container)\n', (788, 809), False, 'import logging\n')]
""" This file is the main object running the KarelCraft application. Author : <NAME> ThanksTo: pokepetter (Ursina) <NAME>, <NAME>, <NAME> (stanfordkarel module) clear-code-projects (Minecraft-in-Python) StanislavPetrovV License: MIT Version: 1.0.0 Date of Creation: 5/17/2021 Last Modified: 9...
[ "random.choice", "karelcraft.utils.helpers.vec2tup", "pathlib.Path", "karelcraft.entities.karel.Karel", "karelcraft.entities.dropdown_menu.DropdownMenu", "karelcraft.entities.dropdown_menu.DropdownMenuButton", "karelcraft.entities.file_browser_save.FileBrowserSave", "karelcraft.entities.radial_menu.Ra...
[((1347, 1379), 'karelcraft.entities.karel.Karel', 'Karel', (['world_file', 'self.textures'], {}), '(world_file, self.textures)\n', (1352, 1379), False, 'from karelcraft.entities.karel import Karel\n'), ((1700, 1725), 'random.choice', 'random.choice', (['COLOR_LIST'], {}), '(COLOR_LIST)\n', (1713, 1725), False, 'import...
import sys sys.path.append('/Users/bryanwhiting/Dropbox/interviews/downstream/DataScienceInterview-Bryan/src') import numpy as np import plotnine as g import pandas as pd from bryan.mcmc import MCMC # TODO: Placeholder for unit tests # Testing the code (would do unit tests w/more time) k = 26 n_fake_datapoints = 10...
[ "numpy.random.normal", "numpy.mean", "numpy.random.exponential", "bryan.mcmc.MCMC", "sys.path.append" ]
[((11, 120), 'sys.path.append', 'sys.path.append', (['"""/Users/bryanwhiting/Dropbox/interviews/downstream/DataScienceInterview-Bryan/src"""'], {}), "(\n '/Users/bryanwhiting/Dropbox/interviews/downstream/DataScienceInterview-Bryan/src'\n )\n", (26, 120), False, 'import sys\n'), ((597, 623), 'bryan.mcmc.MCMC', 'M...
import pickle import base64 from flask import Flask, request app = Flask(__name__) @app.route("/") def index(): try: user = base64.b64decode(request.cookies.get('user')) user = pickle.loads(user) username = user["username"] except: username = "Guest" return "Hello %s" % us...
[ "pickle.loads", "flask.request.cookies.get", "flask.Flask" ]
[((68, 83), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (73, 83), False, 'from flask import Flask, request\n'), ((199, 217), 'pickle.loads', 'pickle.loads', (['user'], {}), '(user)\n', (211, 217), False, 'import pickle\n'), ((155, 182), 'flask.request.cookies.get', 'request.cookies.get', (['"""user"""']...
"""Components for searching for taxa""" from logging import getLogger from typing import Optional from pyinaturalist import RANKS, IconPhoto, Taxon from PySide6.QtCore import QSize, Qt, Signal, Slot from PySide6.QtGui import QIcon from PySide6.QtWidgets import QApplication, QComboBox, QLabel, QPushButton, QWidget fro...
[ "logging.getLogger", "PySide6.QtCore.Signal", "PySide6.QtWidgets.QLabel", "PySide6.QtCore.Slot", "naturtag.widgets.ToggleSwitch", "naturtag.constants.SELECTABLE_ICONIC_TAXA.items", "naturtag.widgets.TaxonAutocomplete", "naturtag.widgets.images.IconLabel", "naturtag.app.style.fa_icon", "PySide6.QtW...
[((836, 855), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (845, 855), False, 'from logging import getLogger\n'), ((934, 946), 'PySide6.QtCore.Signal', 'Signal', (['list'], {}), '(list)\n', (940, 946), False, 'from PySide6.QtCore import QSize, Qt, Signal, Slot\n'), ((997, 1005), 'PySide6.QtCore...
from __future__ import print_function import sys import argparse import os import re from PIL import Image #from PIL.ExifTags import TAGS #print(TAGS[306]) folder_re = re.compile("(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)") def determine_image_dimensions(infile): with Image.open(infile) as im: return im.size[0:2...
[ "PIL.Image.open", "argparse.ArgumentParser", "re.compile", "os.makedirs", "os.rename", "os.path.join", "os.path.split", "os.walk" ]
[((171, 217), 're.compile', 're.compile', (['"""(\\\\d\\\\d\\\\d\\\\d)-(\\\\d\\\\d)-(\\\\d\\\\d)"""'], {}), "('(\\\\d\\\\d\\\\d\\\\d)-(\\\\d\\\\d)-(\\\\d\\\\d)')\n", (181, 217), False, 'import re\n'), ((567, 633), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Sort photos in a directory....
# -- coding: utf-8 -- import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # 建立连接 s.connect(('1172.16.31.10', 8899)) # 接收消息 wel = s.recv(1024).decode('utf-8') print(wel) # 发送消息 for data in (b'Michael', b'Tracy', b'Sarah'): s.send(data) back = s.recv(1024).decode('utf-8') print(back) s.sen...
[ "socket.socket" ]
[((41, 90), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (54, 90), False, 'import socket\n')]
import sys sys.path.append("./MPC/ThermalModels") sys.path.append("..") import numpy as np import utils # TODO distinguish between actions and add different noise correspondingly. class SimulationTstat: def __init__(self, mpc_thermal_model, curr_temperature): self.mpc_thermal_model = mpc_thermal_model ...
[ "numpy.random.normal", "sys.path.append" ]
[((12, 50), 'sys.path.append', 'sys.path.append', (['"""./MPC/ThermalModels"""'], {}), "('./MPC/ThermalModels')\n", (27, 50), False, 'import sys\n'), ((51, 72), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (66, 72), False, 'import sys\n'), ((3689, 3734), 'numpy.random.normal', 'np.random.normal...
#./usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: <NAME> (1459333) """ from __future__ import absolute_import, division, print_function, unicode_literals from os import path import timeit import numpy as np from Pyfhel import PyCtxt, Pyfhel from .util import createDir class Encryption: def __in...
[ "os.path.exists", "timeit.default_timer", "numpy.argmax", "Pyfhel.Pyfhel", "numpy.array", "numpy.empty", "numpy.load", "Pyfhel.PyCtxt", "numpy.save" ]
[((1640, 1648), 'Pyfhel.Pyfhel', 'Pyfhel', ([], {}), '()\n', (1646, 1648), False, 'from Pyfhel import PyCtxt, Pyfhel\n'), ((2128, 2148), 'os.path.exists', 'path.exists', (['context'], {}), '(context)\n', (2139, 2148), False, 'from os import path\n'), ((2700, 2726), 'os.path.exists', 'path.exists', (['self.keys_dir'], {...
# coding: utf-8 from __future__ import division, print_function, unicode_literals from formatcode.convert.utils import split_tokens from formatcode.lexer.tokens import (BlockDelimiter, ColorToken, ConditionToken, DotDelimiter, ZeroToken) def test_split_tokens(): zero = ZeroT...
[ "formatcode.lexer.tokens.ConditionToken", "formatcode.lexer.tokens.DotDelimiter", "formatcode.convert.utils.split_tokens", "formatcode.lexer.tokens.BlockDelimiter", "formatcode.lexer.tokens.ZeroToken", "formatcode.lexer.tokens.ColorToken" ]
[((315, 329), 'formatcode.lexer.tokens.ZeroToken', 'ZeroToken', (['"""0"""'], {}), "('0')\n", (324, 329), False, 'from formatcode.lexer.tokens import BlockDelimiter, ColorToken, ConditionToken, DotDelimiter, ZeroToken\n'), ((340, 357), 'formatcode.lexer.tokens.DotDelimiter', 'DotDelimiter', (['"""."""'], {}), "('.')\n"...
"""update model. Revision ID: b049c50f01a6 Revises: <KEY> Create Date: 2021-04-15 09:34:16.783824 """ from alembic import op import sqlalchemy as sa from sqlalchemy.orm.session import Session from lccs_db.models import LucClassificationSystem from sample_db.models import Datasets, CollectMethod, DatasetView from sam...
[ "alembic.op.get_bind", "sqlalchemy.text", "alembic.op.create_foreign_key", "alembic.op.drop_constraint", "alembic.op.alter_column", "alembic.op.drop_column", "alembic.op.f", "sample_db.models.dataset_table.DatasetType", "sqlalchemy.VARCHAR", "sqlalchemy.Boolean", "sqlalchemy.Integer", "sqlalch...
[((702, 715), 'sample_db.models.dataset_table.DatasetType', 'DatasetType', ([], {}), '()\n', (713, 715), False, 'from sample_db.models.dataset_table import DatasetType\n'), ((1159, 1274), 'alembic.op.alter_column', 'op.alter_column', (['"""datasets"""', '"""observation_table_name"""'], {'new_column_name': '"""dataset_t...
import os import shutil root_path = os.path.split(os.path.dirname(os.path.realpath( __file__ )))[0] pjoin = os.path.join class CurrentsExporterException(Exception): pass def copy_while_creating_directories(srcpath, dstpath): base_directory = os.path.split(dstpath)[0] if not os.path.isdir(base_directory): ...
[ "os.listdir", "os.makedirs", "os.path.split", "shutil.copytree", "os.path.realpath", "os.path.isdir", "shutil.copy" ]
[((363, 385), 'os.path.isdir', 'os.path.isdir', (['srcpath'], {}), '(srcpath)\n', (376, 385), False, 'import os\n'), ((252, 274), 'os.path.split', 'os.path.split', (['dstpath'], {}), '(dstpath)\n', (265, 274), False, 'import os\n'), ((289, 318), 'os.path.isdir', 'os.path.isdir', (['base_directory'], {}), '(base_directo...
import json import logging from datetime import datetime, timedelta import pymongo from ecn import StationKind, PPTIK_GRAVITY, StationState class StationaryV1Handler: logger = logging.getLogger(__name__) SAMPLE_RATE = 40 def __init__(self, db: pymongo.database.Database): self.db: pymongo.databa...
[ "logging.getLogger", "datetime.timedelta", "json.loads", "datetime.datetime.utcnow" ]
[((184, 211), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (201, 211), False, 'import logging\n'), ((527, 543), 'json.loads', 'json.loads', (['body'], {}), '(body)\n', (537, 543), False, 'import json\n'), ((1165, 1182), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (1...
#!/usr/bin/env python3 ''' tsarchiver - Archive tagesschau, tagesthemen and nachtmagazin ''' import os import sys import json import time import re from zipfile import ZipFile, ZIP_DEFLATED from datetime import datetime import subprocess import shutil import sqlite3 import hashlib import pytz from bs4 import Beautiful...
[ "zipfile.ZipFile", "sys.exit", "os.remove", "re.search", "pytz.timezone", "shutil.move", "subprocess.Popen", "hashlib.sha256", "json.loads", "subconvert.convertEBU", "os.path.splitext", "requests.get", "os.path.isfile", "datetime.datetime.timestamp", "time.time", "datetime.datetime.fro...
[((918, 955), 'os.path.join', 'os.path.join', (['directory', '"""archive.db"""'], {}), "(directory, 'archive.db')\n", (930, 955), False, 'import os\n'), ((963, 985), 'os.path.isfile', 'os.path.isfile', (['dbFile'], {}), '(dbFile)\n', (977, 985), False, 'import os\n'), ((7970, 8012), 'os.path.join', 'os.path.join', (['d...
from Optimithon import Base from Optimithon import QuasiNewton from numpy import array, sin, pi from scipy.optimize import minimize fun = lambda x: sin(x[0] + x[1]) + (x[0] - x[1]) ** 2 - 1.5 * x[0] + 2.5 * x[1] + 1. x0 = array((0., 0.)) print(fun(x0)) sol1 = minimize(fun, x0, method='COBYLA') sol2 = minimize(fun, x0,...
[ "numpy.sin", "numpy.array", "scipy.optimize.minimize", "Optimithon.Base" ]
[((223, 240), 'numpy.array', 'array', (['(0.0, 0.0)'], {}), '((0.0, 0.0))\n', (228, 240), False, 'from numpy import array, sin, pi\n'), ((261, 295), 'scipy.optimize.minimize', 'minimize', (['fun', 'x0'], {'method': '"""COBYLA"""'}), "(fun, x0, method='COBYLA')\n", (269, 295), False, 'from scipy.optimize import minimize...
"""Test Service EHA client""" # -*- coding: utf-8 -*- import pytest import allure @pytest.fixture() def maket3_test_5_con1(test_server_5_1, check_side_mea809, data_maket_mea809, ): return test_server_5_1(data_maket_mea809, data_maket_mea809["server_port1"], "test_5") @allure.step("Test connect_from EHA_port...
[ "pytest.fixture", "allure.step", "pytest.allure.step" ]
[((89, 105), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (103, 105), False, 'import pytest\n'), ((281, 323), 'allure.step', 'allure.step', (['"""Test connect_from EHA_port1"""'], {}), "('Test connect_from EHA_port1')\n", (292, 323), False, 'import allure\n'), ((530, 563), 'pytest.allure.step', 'pytest.allure....
import attr @attr.dataclass(slots=True) class DataKeyDoc: key: str doc_count: float
[ "attr.dataclass" ]
[((15, 41), 'attr.dataclass', 'attr.dataclass', ([], {'slots': '(True)'}), '(slots=True)\n', (29, 41), False, 'import attr\n')]
import os import faker import pandas as pd from django.test import TestCase from django_datajsonar.models import Node from elasticsearch_dsl.connections import connections from series_tiempo_ar_api.apps.dump.generator import constants from series_tiempo_ar_api.apps.dump.generator.dta import DtaGenerator from series_t...
[ "series_tiempo_ar_api.apps.dump.models.DumpFile.objects.get", "pandas.read_csv", "elasticsearch_dsl.connections.connections.get_connection", "pandas.read_stata", "series_tiempo_ar_api.apps.dump.tasks.enqueue_write_csv_task", "series_tiempo_ar_api.apps.dump.models.GenerateDumpTask.objects.create", "os.pa...
[((612, 625), 'faker.Faker', 'faker.Faker', ([], {}), '()\n', (623, 625), False, 'import faker\n'), ((564, 590), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (580, 590), False, 'import os\n'), ((874, 898), 'series_tiempo_ar_api.apps.dump.tasks.enqueue_write_csv_task', 'enqueue_write_csv_t...
"""Utility to load datasets.""" import pandas as pd import pickle as pkl import numpy as np import os def load_food_search_trends(groups=False): """ Data from: http://foodb.ca/ https://www.google.com/intl/es419/search/about/ """ filename = os.path.join(os.path.dirname(__file__), "food_search_trend...
[ "os.path.dirname", "pickle.load", "pandas.read_csv" ]
[((344, 378), 'pandas.read_csv', 'pd.read_csv', (['filename'], {'index_col': '(0)'}), '(filename, index_col=0)\n', (355, 378), True, 'import pandas as pd\n'), ((275, 300), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (290, 300), False, 'import os\n'), ((1190, 1224), 'pandas.read_csv', 'pd.r...
""" PyGPSClient - Main tkinter application class. Created on 12 Sep 2020 :author: semuadmin :copyright: SEMU Consulting © 2020 :license: BSD 3-Clause """ from threading import Thread from tkinter import Tk, Frame, N, S, E, W, PhotoImage, font from .strings import ( TITLE, MENUHIDESE, MEN...
[ "tkinter.Frame.__init__", "tkinter.font.Font", "tkinter.Tk", "tkinter.PhotoImage", "threading.Thread" ]
[((11644, 11648), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (11646, 11648), False, 'from tkinter import Tk, Frame, N, S, E, W, PhotoImage, font\n'), ((1732, 1784), 'tkinter.Frame.__init__', 'Frame.__init__', (['self', 'self.__master', '*args'], {}), '(self, self.__master, *args, **kwargs)\n', (1746, 1784), False, 'from tki...
from project.database import Base from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, func, Boolean, Date, Enum, Table from sqlalchemy.orm import backref, relationship import enum class onderwijstypeEnum(enum.Enum): Vmbo_T = "Vmbo_T" Vmbo_K = "Vmbo_K" Vmbo_B = "Vmbo_B" Havo = "Havo...
[ "sqlalchemy.orm.relationship", "sqlalchemy.ForeignKey", "sqlalchemy.Column" ]
[((960, 993), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (966, 993), False, 'from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, func, Boolean, Date, Enum, Table\n'), ((1007, 1021), 'sqlalchemy.Column', 'Column', (['String'], {}), '(String...
import logging import time import psycopg2 from psycopg2._json import Json from xqa.commons import configuration class StorageService: def __init__(self, host=configuration.storage_host, port=configuration.storage_port): logging.debug('connecting to: %s@%s:%s' % ...
[ "psycopg2.connect", "json.loads", "logging.debug", "logging.warning", "time.sleep", "logging.info" ]
[((272, 369), 'logging.debug', 'logging.debug', (["('connecting to: %s@%s:%s' % (configuration.storage_database_name, host, port))"], {}), "('connecting to: %s@%s:%s' % (configuration.\n storage_database_name, host, port))\n", (285, 369), False, 'import logging\n'), ((1407, 1456), 'logging.info', 'logging.info', (["...
from icemet_web.app import app from icemet_web.models.database import database_inst, stats_databases from icemet_web.util import render, api import flask from datetime import datetime @app.route("/api/stats/<string:database>/<string:table>/", methods=["POST"]) def stats_api_route(database, table): databases = stats...
[ "icemet_web.util.api", "icemet_web.models.database.stats_databases", "datetime.datetime.strptime", "flask.request.form.get", "icemet_web.models.database.database_inst", "icemet_web.util.render", "icemet_web.app.app.route", "flask.abort" ]
[((188, 263), 'icemet_web.app.app.route', 'app.route', (['"""/api/stats/<string:database>/<string:table>/"""'], {'methods': "['POST']"}), "('/api/stats/<string:database>/<string:table>/', methods=['POST'])\n", (197, 263), False, 'from icemet_web.app import app\n'), ((1248, 1318), 'icemet_web.app.app.route', 'app.route'...
"""Core application configuration to pass around the application""" from __future__ import annotations from dataclasses import InitVar, dataclass, field from rich.console import Console __all__ = ['ApplicationContext'] @dataclass class ApplicationContext: """Application-wide context object""" #: Whether to...
[ "rich.console.Console", "dataclasses.field" ]
[((682, 699), 'dataclasses.field', 'field', ([], {'init': '(False)'}), '(init=False)\n', (687, 699), False, 'from dataclasses import InitVar, dataclass, field\n'), ((750, 767), 'dataclasses.field', 'field', ([], {'init': '(False)'}), '(init=False)\n', (755, 767), False, 'from dataclasses import InitVar, dataclass, fiel...
# !/usr/bin/env python # -*- coding: utf-8 -*- """ @author: mango @contact: <EMAIL> @create: 16/7/1 hail hydra! """ __author__ = "mango" __version__ = "0.1" import os from flask import Flask, request, Response from flask import render_template, url_for, redirect, send_from_directory from flask import send_file, ma...
[ "flask.render_template", "application.app.route" ]
[((592, 623), 'application.app.route', 'app.route', (['"""/"""'], {'methods': "['GET']"}), "('/', methods=['GET'])\n", (601, 623), False, 'from application import app\n'), ((655, 684), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (670, 684), False, 'from flask import rende...
""" WSGI config for medical project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application from django.contrib.staticfiles.hand...
[ "os.environ.setdefault", "django.core.wsgi.get_wsgi_application" ]
[((352, 419), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""medical.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'medical.settings')\n", (373, 419), False, 'import os\n'), ((562, 584), 'django.core.wsgi.get_wsgi_application', 'get_wsgi_application', ([], {}), '()\n', (582, 5...
""" Module containing flask init and several """ from flask import request, render_template, redirect, url_for import hashlib import os from application.factories import make_flask_app # from celery_app import celery_app environment = os.environ.get('ENVIRONMENT') app = make_flask_app("log-parser", environment) def ...
[ "flask.render_template", "os.listdir", "application.factories.make_flask_app", "hashlib.md5", "os.environ.get", "os.path.splitext", "os.path.join", "flask.url_for" ]
[((236, 265), 'os.environ.get', 'os.environ.get', (['"""ENVIRONMENT"""'], {}), "('ENVIRONMENT')\n", (250, 265), False, 'import os\n'), ((272, 313), 'application.factories.make_flask_app', 'make_flask_app', (['"""log-parser"""', 'environment'], {}), "('log-parser', environment)\n", (286, 313), False, 'from application.f...
from __future__ import division from tkinter import Button, Label, Tk import threading import pyaudio import numpy as np from core.stream import Stream from core.tone2frequency import tone2frequency from data.key_midi_mapping import midi_key_mapping class ThreadPlayer: def __init__(self, **kwargs): sel...
[ "tkinter.Tk", "tkinter.Label", "pyaudio.PyAudio", "core.tone2frequency.tone2frequency", "numpy.arange" ]
[((417, 434), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (432, 434), False, 'import pyaudio\n'), ((953, 970), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (968, 970), False, 'import pyaudio\n'), ((2159, 2184), 'core.tone2frequency.tone2frequency', 'tone2frequency', (['self.tone'], {}), '(self.to...
# -*- coding: utf-8 -*- __author__ = 'raek' __updated__ = 'kmu' import requests # import datetime # import getdangers as gd # import makelogs as md # import types def get_warnings_as_json(region_ids, start_date, end_date, lang_key=1, simple=False, recursive_count=5): """Selects warnings and returns the json stru...
[ "pandas.DataFrame", "datetime.date", "requests.get" ]
[((5910, 5937), 'pandas.DataFrame', 'pd.DataFrame', (['warns_json[0]'], {}), '(warns_json[0])\n', (5922, 5937), True, 'import pandas as pd\n'), ((5481, 5500), 'datetime.date', 'dt.date', (['(2016)', '(4)', '(1)'], {}), '(2016, 4, 1)\n', (5488, 5500), True, 'import datetime as dt\n'), ((5502, 5521), 'datetime.date', 'dt...
from __future__ import print_function import FWCore.ParameterSet.Config as cms import copy process = cms.Process("zpdfsys") process.maxEvents = cms.untracked.PSet( #input = cms.untracked.int32(-1) input = cms.untracked.int32(-1) ) ## process.source = cms.Source("PoolSource", ## debugVerbosity = cms.untr...
[ "FWCore.ParameterSet.Config.string", "FWCore.ParameterSet.Config.untracked.double", "FWCore.ParameterSet.Config.untracked.string", "FWCore.ParameterSet.Config.OutputModule", "FWCore.ParameterSet.Config.EndPath", "FWCore.ParameterSet.Config.InputTag", "FWCore.ParameterSet.Config.untracked.int32", "copy...
[((102, 124), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""zpdfsys"""'], {}), "('zpdfsys')\n", (113, 124), True, 'import FWCore.ParameterSet.Config as cms\n'), ((944, 981), 'FWCore.ParameterSet.Config.OutputModule', 'cms.OutputModule', (['"""AsciiOutputModule"""'], {}), "('AsciiOutputModule')\n", (960, 98...
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: pogoprotos/data/quests/quest_goal.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf i...
[ "google.protobuf.symbol_database.Default", "google.protobuf.descriptor.FieldDescriptor" ]
[((506, 532), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (530, 532), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((1368, 1694), 'google.protobuf.descriptor.FieldDescriptor', '_descriptor.FieldDescriptor', ([], {'name': '"""condition"""', 'ful...
import os import json import datetime from mock import patch, Mock, call from freezegun import freeze_time os.environ["DYNAMO_ASSETS_TABLE_NAME"] = "test" os.environ["DYNAMO_EVENT_MAPPING_TABLE_NAME"] = "mappings" os.environ["AWS_REGION"] = "us-east-1" from handler import process_event mock_assets_cache = Mock() mo...
[ "mock.patch", "mock.Mock", "datetime.datetime.now", "handler.process_event", "json.load", "freezegun.freeze_time" ]
[((311, 317), 'mock.Mock', 'Mock', ([], {}), '()\n', (315, 317), False, 'from mock import patch, Mock, call\n'), ((340, 346), 'mock.Mock', 'Mock', ([], {}), '()\n', (344, 346), False, 'from mock import patch, Mock, call\n'), ((369, 375), 'mock.Mock', 'Mock', ([], {}), '()\n', (373, 375), False, 'from mock import patch,...
""" Console scripts for the tools provided by KWIVER. These scripts are used in the wheel setup the environment to kwiver tools and launch them in a subprocess. """ import os import subprocess import kwiver import sys from pkg_resources import iter_entry_points from typing import Dict, List from kwiver.vital import...
[ "os.path.exists", "kwiver.vital.util.initial_plugin_path.get_initial_plugin_path", "pkg_resources.iter_entry_points", "subprocess.run", "os.environ.get", "os.path.join", "kwiver.vital.vital_logging.getLogger", "os.environ.items", "os.path.abspath", "kwiver.vital.vital_logging._configure_logging" ]
[((562, 595), 'kwiver.vital.vital_logging.getLogger', 'vital_logging.getLogger', (['__name__'], {}), '(__name__)\n', (585, 595), False, 'from kwiver.vital import vital_logging\n'), ((1068, 1115), 'pkg_resources.iter_entry_points', 'iter_entry_points', (['"""kwiver.env.ld_library_path"""'], {}), "('kwiver.env.ld_library...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible_collections.community.general.tests.unit.compat import unittest from ansible_collections.manala.roles.plugins.filter.users_groups import users_groups from ansible.errors import AnsibleFilterError class Test(unittest...
[ "ansible_collections.manala.roles.plugins.filter.users_groups.users_groups" ]
[((435, 463), 'ansible_collections.manala.roles.plugins.filter.users_groups.users_groups', 'users_groups', (['NotImplemented'], {}), '(NotImplemented)\n', (447, 463), False, 'from ansible_collections.manala.roles.plugins.filter.users_groups import users_groups\n'), ((684, 716), 'ansible_collections.manala.roles.plugins...
# -*-coding:utf-8 -*- ''' @File : test_helper.py @Author : <NAME> @Date : 2020/8/2 @Desc : ''' import tensorflow as tf import numpy as np from QuestionAnswerSummaryAndReasoning.seq2seq_tf2.batcher import output_to_words from tqdm import tqdm def greedy_decode(model, dataset, vocab, params): ...
[ "tensorflow.math.log", "QuestionAnswerSummaryAndReasoning.seq2seq_tf2.batcher.output_to_words", "tensorflow.argmax", "tensorflow.constant", "tensorflow.convert_to_tensor", "tensorflow.expand_dims", "tensorflow.squeeze", "tensorflow.stack" ]
[((1122, 1154), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['batch_data'], {}), '(batch_data)\n', (1142, 1154), True, 'import tensorflow as tf\n'), ((1468, 1497), 'tensorflow.constant', 'tf.constant', (['([2] * batch_size)'], {}), '([2] * batch_size)\n', (1479, 1497), True, 'import tensorflow as tf\n'), (...
# -*- coding: utf-8 -*- import scrapy class JiankeItem(scrapy.Item): title = scrapy.Field() link = scrapy.Field() desc = scrapy.Field() class JiankeSpider(scrapy.Spider): name = 'jianke' allowed_domains = ['www.xxbiquge.com'] start_urls = ['http://www.xxbiquge.com/2_2327/'] def parse(se...
[ "scrapy.Field", "scrapy.Request" ]
[((83, 97), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (95, 97), False, 'import scrapy\n'), ((109, 123), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (121, 123), False, 'import scrapy\n'), ((135, 149), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (147, 149), False, 'import scrapy\n'), ((475, 528), 'scr...
# https://atcoder.jp/contests/abc087/tasks/arc090_b from collections import deque N, M = map(int, input().split()) link = [[] for _ in range(N)] for _ in range(M): l, r, d = map(int, input().split()) link[l - 1].append([r - 1, d]) link[r - 1].append([l - 1, -d]) def bfs(s): que = deque([s]) while ...
[ "collections.deque" ]
[((299, 309), 'collections.deque', 'deque', (['[s]'], {}), '([s])\n', (304, 309), False, 'from collections import deque\n')]
import os import subprocess import sys import tarfile import tempfile from dataclasses import asdict import numpy as np import onnxruntime as ort import tensorflow as tf import yaml from tvm.contrib.download import download from arachne.data import ModelSpec, TensorSpec from arachne.tools.openvino2tf import OpenVINO2...
[ "tensorflow.saved_model.load", "tempfile.TemporaryDirectory", "tarfile.open", "numpy.random.rand", "dataclasses.asdict", "numpy.testing.assert_allclose", "subprocess.run", "onnxruntime.InferenceSession", "arachne.data.TensorSpec", "arachne.tools.openvino2tf.OpenVINO2TFConfig", "os.chdir", "ara...
[((620, 654), 'tensorflow.saved_model.load', 'tf.saved_model.load', (['tf_model_path'], {}), '(tf_model_path)\n', (639, 654), True, 'import tensorflow as tf\n'), ((839, 912), 'onnxruntime.InferenceSession', 'ort.InferenceSession', (['onnx_model_path'], {'providers': "['CPUExecutionProvider']"}), "(onnx_model_path, prov...
# Generated by Django 2.1.2 on 2018-12-19 22:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('payments', '0001_initial'), ] operations = [ migrations.AlterField( model_name='subscriptionpayment', name='journal_...
[ "django.db.models.BigIntegerField" ]
[((343, 404), 'django.db.models.BigIntegerField', 'models.BigIntegerField', ([], {'db_index': '(True)', 'default': '(0)', 'unique': '(True)'}), '(db_index=True, default=0, unique=True)\n', (365, 404), False, 'from django.db import migrations, models\n')]
from django import forms class CreateWorkoutForm(forms.Form): """Form for creating a workout from a routine.""" routine = forms.ChoiceField() class UpdateWorkoutForm(forms.Form): """Form for updating the progress of a workout.""" is_completed = forms.BooleanField() class CreateSetForm(forms.Form...
[ "django.forms.ChoiceField", "django.forms.BooleanField", "django.forms.IntegerField", "django.forms.CharField" ]
[((133, 152), 'django.forms.ChoiceField', 'forms.ChoiceField', ([], {}), '()\n', (150, 152), False, 'from django import forms\n'), ((267, 287), 'django.forms.BooleanField', 'forms.BooleanField', ([], {}), '()\n', (285, 287), False, 'from django import forms\n'), ((377, 397), 'django.forms.IntegerField', 'forms.IntegerF...
# -*- coding: utf-8 -*- """ Created on Wed Jun 19 23:11:51 2019 @author: Wei-Hsiang, Shen """ from tensorflow.keras import layers class ResBlock(object): """ Residual block (non bottleneck, 2 blocks) """ def __init__(self, num_feature_in, num_feature_out, strides=(1,1)): self.num_feature_in ...
[ "tensorflow.keras.layers.ReLU", "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.add", "tensorflow.keras.layers.BatchNormalization" ]
[((1138, 1163), 'tensorflow.keras.layers.add', 'layers.add', (['[x, shortcut]'], {}), '([x, shortcut])\n', (1148, 1163), False, 'from tensorflow.keras import layers\n'), ((2483, 2508), 'tensorflow.keras.layers.add', 'layers.add', (['[x, shortcut]'], {}), '([x, shortcut])\n', (2493, 2508), False, 'from tensorflow.keras ...
import click from chakin.cli import pass_context from chakin.decorators import custom_exception, list_output @click.command('get_organisms') @click.option( "--organism_id", help="organism_id filter", type=int ) @click.option( "--genus", help="genus filter", type=str ) @click.option( "--spe...
[ "click.option", "click.command" ]
[((112, 142), 'click.command', 'click.command', (['"""get_organisms"""'], {}), "('get_organisms')\n", (125, 142), False, 'import click\n'), ((144, 210), 'click.option', 'click.option', (['"""--organism_id"""'], {'help': '"""organism_id filter"""', 'type': 'int'}), "('--organism_id', help='organism_id filter', type=int)...
''' TODO: Test ''' from sim_geometry import * import carpet.physics.kuramoto_numba as physics # Physics period = 31.25 # [ms] period of cilia beat freq = 2 * np.pi / period # [rad/ms] angular frequency freq_vec = freq * np.ones(N) sin_str = 0.0016 * freq # coupling strength # Load frequencies period = 2...
[ "carpet.physics.kuramoto_numba.define_right_side_of_ODE_kuramoto" ]
[((393, 478), 'carpet.physics.kuramoto_numba.define_right_side_of_ODE_kuramoto', 'physics.define_right_side_of_ODE_kuramoto', (['NN', 'freq_vec', 'sin_str'], {'use_numba': '(True)'}), '(NN, freq_vec, sin_str, use_numba=True\n )\n', (434, 478), True, 'import carpet.physics.kuramoto_numba as physics\n'), ((702, 792), ...
import qcore from qcore.asserts import AssertRaises class Foo(metaclass=qcore.DisallowInheritance): pass def test_disallow_inheritance(): with AssertRaises(TypeError): class Bar(Foo): pass
[ "qcore.asserts.AssertRaises" ]
[((155, 178), 'qcore.asserts.AssertRaises', 'AssertRaises', (['TypeError'], {}), '(TypeError)\n', (167, 178), False, 'from qcore.asserts import AssertRaises\n')]
# https://www.youtube.com/watch?v=G-Rp41BzGxg&list=PLCC34OHNcOtpz7PJQ7Tv7hqFBP_xDDjqg&index=44 from kivymd.app import MDApp from kivy.lang import Builder class Codemy_Tutorial_App(MDApp): def build(self): self.theme_cls.theme_style = 'Dark' self.theme_cls.primary_palette = 'BlueGray' retu...
[ "kivy.lang.Builder.load_file" ]
[((323, 369), 'kivy.lang.Builder.load_file', 'Builder.load_file', (['"""codemy_KivyMd_31_Login.kv"""'], {}), "('codemy_KivyMd_31_Login.kv')\n", (340, 369), False, 'from kivy.lang import Builder\n')]
#!/usr/bin/env python import utils from torchvision import models import os from PIL import Image import matplotlib.pyplot as plt import torch from detector import Detector import torchvision.transforms.functional as TF class ImageProcessor(): def __init__(self, model_path, ann_path): self.device = torch...
[ "torchvision.transforms.functional.to_tensor", "utils.load_model", "detector.Detector", "utils.add_bounding_boxes_pil", "torch.stack", "torch.no_grad", "utils.get_category_dict", "torch.device" ]
[((315, 334), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (327, 334), False, 'import torch\n'), ((464, 520), 'utils.load_model', 'utils.load_model', (['self.detector', 'model_path', 'self.device'], {}), '(self.detector, model_path, self.device)\n', (480, 520), False, 'import utils\n'), ((607, 640)...
"""Cartesian product of manifolds.""" import tensorflow as tf from functools import reduce from operator import mul from tensorflow_riemopt.manifolds.manifold import Manifold class Product(Manifold): """Product space of manifolds.""" name = "Product" ndims = 1 def __init__(self, *manifolds): ...
[ "tensorflow.shape", "functools.reduce", "tensorflow.reduce_sum", "tensorflow.math.sqrt", "tensorflow.concat", "tensorflow.reshape" ]
[((2003, 2033), 'functools.reduce', 'reduce', (['tf.logical_and', 'checks'], {}), '(tf.logical_and, checks)\n', (2009, 2033), False, 'from functools import reduce\n'), ((2316, 2346), 'functools.reduce', 'reduce', (['tf.logical_and', 'checks'], {}), '(tf.logical_and, checks)\n', (2322, 2346), False, 'from functools impo...
import sys from itertools import chain from typing import Iterator, List, Sequence, Tuple Instruction = Tuple[str, int] # name, value ExecutionResult = Tuple[int, bool] # accumulator, did_terminate def execute(instructions: Sequence[Instruction]) -> ExecutionResult: accumulator = 0 instruction_pointer = 0 ...
[ "sys.stdin.read" ]
[((1962, 1978), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (1976, 1978), False, 'import sys\n')]
import unittest from unittest.mock import patch from click.testing import CliRunner from data_pipelines_cli.cli import _cli from data_pipelines_cli.cli_commands import update from data_pipelines_cli.errors import NotAProjectDirectoryError class UpdateCommandTestCase(unittest.TestCase): def setUp(self) -> None: ...
[ "data_pipelines_cli.cli_commands.update.update", "unittest.mock.patch", "click.testing.CliRunner" ]
[((625, 664), 'unittest.mock.patch', 'patch', (['"""copier.copy"""', 'self._mock_copier'], {}), "('copier.copy', self._mock_copier)\n", (630, 664), False, 'from unittest.mock import patch\n'), ((687, 714), 'click.testing.CliRunner', 'CliRunner', ([], {'mix_stderr': '(False)'}), '(mix_stderr=False)\n', (696, 714), False...
from database import util """ This file holds methods to update data in a table """ # Update data def update(table, changes, conditions): query = "UPDATE {0} SET".format(table) query = add_set(query, changes) query += " WHERE " query = util.add_conditions(query, conditions) util....
[ "database.util.add_conditions", "database.util.commit_query" ]
[((269, 307), 'database.util.add_conditions', 'util.add_conditions', (['query', 'conditions'], {}), '(query, conditions)\n', (288, 307), False, 'from database import util\n'), ((315, 339), 'database.util.commit_query', 'util.commit_query', (['query'], {}), '(query)\n', (332, 339), False, 'from database import util\n')]
import pickle class message: message = input("Type what you want to be turned into saved data (string): ") while True: try: number = int(input("Type what you want to be turned into saved data (int): ")) break except: print("Try again!") dictionary = {"Mes...
[ "pickle.dumps" ]
[((386, 409), 'pickle.dumps', 'pickle.dumps', (['message_1'], {}), '(message_1)\n', (398, 409), False, 'import pickle\n')]
'''Drawer base class.''' import abc import six @six.add_metaclass(abc.ABCMeta) class Drawer(object): '''The base class for all data structure drawers.''' @staticmethod @abc.abstractmethod def draw(data_structure, description): '''Draws an image of the given data structure. Args: ...
[ "six.add_metaclass" ]
[((52, 82), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (69, 82), False, 'import six\n')]
import numpy as np import tensorflow as tf class BruteForceKNN(object): def __init__(self, buffersize, dimension, X): self.size = buffersize self.dimension = dimension # self.X = X self.knn = self.build_graph() def build_graph(self): self.X = tf.placeholder(tf.float32,...
[ "tensorflow.placeholder", "tensorflow.transpose", "tensorflow.nn.top_k" ]
[((294, 350), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[None, self.dimension]'}), '(tf.float32, shape=[None, self.dimension])\n', (308, 350), True, 'import tensorflow as tf\n'), ((372, 428), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[None, self.dimension]'}),...
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import csv import StringIO import unittest import webapp2 import webtest from dashboard import graph_csv from dashboard.common import datastore_hooks from ...
[ "StringIO.StringIO", "dashboard.common.datastore_hooks.InstallHooks", "dashboard.models.graph_data.Bot", "dashboard.common.testing_common.SetIpWhitelist", "dashboard.models.graph_data.TestMetadata", "webtest.TestApp", "dashboard.common.utils.GetTestContainerKey", "webapp2.WSGIApplication", "unittest...
[((6364, 6379), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6377, 6379), False, 'import unittest\n'), ((549, 617), 'webapp2.WSGIApplication', 'webapp2.WSGIApplication', (["[('/graph_csv', graph_csv.GraphCsvHandler)]"], {}), "([('/graph_csv', graph_csv.GraphCsvHandler)])\n", (572, 617), False, 'import webapp2\n...
import requests leagueID = 582628976 # leagueID = 835952 year = 2021 # url = f"https://fantasy.espn.com/apis/v3/games/fba/seasons/{str(year)}/segments/0/leagues/{str(leagueID)}" # url = f"https://fantasy.espn.com/basketball/team?leagueId={str(year)}&teamId=3" # url = "https://fantasy.espn.com/apis/v3/games/fba/seasons...
[ "requests.get" ]
[((1218, 1621), 'requests.get', 'requests.get', (['url'], {'cookies': "{'swid': '{23A4936D-D6C7-4DE4-81D9-9188358D2F69}', 'espn_s2':\n 'AECb%2F6kEWSUPzUA1BEQB9DyFnpFwAucrxLZpHQvim4x%2BaUpNiZ2Azgd9EmZFk09B%2BlKACKtqYAl6FWk%2BGicGf4LMMYnHR0Nl9gU1L4jO2iNxIOZSL0%2B4Blgd%2BKqzOkzbsUn1YkzEhflxt%2FD1RNGYHutwoUPocda2XCJCkIY...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from webbreaker.webbreakerlogger import Logger json_scan_settings = { "settingsName": "", "overrides": { "scanName": "" } } def formatted_settings_payload(settings, scan_name, runenv, scan_mode, scan_scope, login_macro, scan_polic...
[ "os.getenv" ]
[((596, 618), 'os.getenv', 'os.getenv', (['"""BUILD_TAG"""'], {}), "('BUILD_TAG')\n", (605, 618), False, 'import os\n')]
import json from copy import deepcopy def _post_request(client, endpoint, data): mimetype = "application/json" headers = {"Content-Type": mimetype, "Accept": mimetype} return client.post(endpoint, data=json.dumps(data), headers=headers) def test_fixed_values(client, mongodb): """ check that sche...
[ "json.loads", "json.dumps" ]
[((1797, 1822), 'json.loads', 'json.loads', (['response.data'], {}), '(response.data)\n', (1807, 1822), False, 'import json\n'), ((216, 232), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (226, 232), False, 'import json\n')]
from django.contrib import admin from .models import Board, List, Item, Label, Comment, Attachment, Notification admin.site.register(Board) admin.site.register(List) admin.site.register(Item) admin.site.register(Label) admin.site.register(Comment) admin.site.register(Attachment) admin.site.register(Notification)
[ "django.contrib.admin.site.register" ]
[((114, 140), 'django.contrib.admin.site.register', 'admin.site.register', (['Board'], {}), '(Board)\n', (133, 140), False, 'from django.contrib import admin\n'), ((141, 166), 'django.contrib.admin.site.register', 'admin.site.register', (['List'], {}), '(List)\n', (160, 166), False, 'from django.contrib import admin\n'...
import numpy as np import matplotlib.pyplot as plt import time, psutil, sys, gc useColab = False if useColab: #!pip3 install hdf5storage from google.colab import drive drive.mount('/content/gdrive') import hdf5storage as hdf def loadData(filename): #Get data return hdf.loadmat(filename) def...
[ "hdf5storage.loadmat", "numpy.unique", "google.colab.drive.mount", "matplotlib.pyplot.plot", "psutil.virtual_memory", "numpy.array", "matplotlib.pyplot.show" ]
[((5277, 5314), 'matplotlib.pyplot.plot', 'plt.plot', (['inData[featuresName][23, :]'], {}), '(inData[featuresName][23, :])\n', (5285, 5314), True, 'import matplotlib.pyplot as plt\n'), ((5339, 5349), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (5347, 5349), True, 'import matplotlib.pyplot as plt\n'), ((182...
from django.test import TestCase from django.contrib.auth import get_user_model from django.test import Client from suite.views import ClubCreate from django.urls import reverse from suite.models import Club class View_Club_Search_TestCase(TestCase): def setUp(self): self.client = Client() self.cl...
[ "django.urls.reverse", "django.contrib.auth.get_user_model", "suite.models.Club.objects.create", "django.test.Client" ]
[((295, 303), 'django.test.Client', 'Client', ([], {}), '()\n', (301, 303), False, 'from django.test import Client\n'), ((323, 413), 'suite.models.Club.objects.create', 'Club.objects.create', ([], {'club_name': '"""Cool club"""', 'club_type': '"""PUB"""', 'club_description': '"""a club"""'}), "(club_name='Cool club', c...
"""Setup script for crawl.""" from setuptools import find_packages from setuptools import setup REQUIRED_PACKAGES = [ 'selenium' ] setup( name='crawl', version='0.1', include_package_data=True, author='<NAME>', author_email='<EMAIL>', packages=find_packages(), install_requires=REQUI...
[ "setuptools.find_packages" ]
[((277, 292), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (290, 292), False, 'from setuptools import find_packages\n')]
#!/usr/bin/env python # coding: utf-8 import itertools import math testData = [ 1721, 979, 366, 299, 675, 1456 ] def getCombinations(numberList, numberToChoose): return list(itertools.combinations(numberList, numberToChoose)) def findTarget(numbersToCheck, target): for group in n...
[ "itertools.combinations", "math.prod" ]
[((209, 259), 'itertools.combinations', 'itertools.combinations', (['numberList', 'numberToChoose'], {}), '(numberList, numberToChoose)\n', (231, 259), False, 'import itertools\n'), ((387, 403), 'math.prod', 'math.prod', (['group'], {}), '(group)\n', (396, 403), False, 'import math\n')]
import pytest from playbacker.tempo import TimeSignature from playbacker.track import Shared, StreamBuilder from playbacker.tracks.countdown import ( CountdownSounds, CountdownTrack, countdown_schemes, ) from tests.conftest import TIME_SIGNATURES, get_audiofile_mock, get_tempo @pytest.mark.parametrize("p...
[ "tests.conftest.get_tempo", "pytest.mark.parametrize", "tests.conftest.get_audiofile_mock", "playbacker.track.Shared" ]
[((342, 400), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""time_signature"""', 'TIME_SIGNATURES'], {}), "('time_signature', TIME_SIGNATURES)\n", (365, 400), False, 'import pytest\n'), ((868, 897), 'tests.conftest.get_tempo', 'get_tempo', ([], {'sig': 'time_signature'}), '(sig=time_signature)\n', (877, 89...
import os from .deviceflasher import DeviceFlasher from .versions import (micropython as micropython_version, pixel32 as pixel32_version) class MicroPythonFlasher(DeviceFlasher): def run(self): micropython_path = os.path.join( os.path.dirname(__file__), 'firmw...
[ "os.path.dirname" ]
[((275, 300), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (290, 300), False, 'import os\n'), ((441, 466), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (456, 466), False, 'import os\n')]
import quilt3 p = quilt3.Package.browse('aleksey/hurdat', 's3://quilt-example') print(p["requirements.txt"]) print(p["notebooks"]) p["notebooks"]["QuickStart.ipynb"].fetch()
[ "quilt3.Package.browse" ]
[((19, 80), 'quilt3.Package.browse', 'quilt3.Package.browse', (['"""aleksey/hurdat"""', '"""s3://quilt-example"""'], {}), "('aleksey/hurdat', 's3://quilt-example')\n", (40, 80), False, 'import quilt3\n')]
import random print("dice roller") dice1 = random.randint(1,6) dice2 = random.randint(1,6) sum = dice1 + dice2 if dice1 == dice2: print("move %d spaces" %(sum)) print("roll again") else: print("move %d spaces" %(sum)) print("Next player's turn")
[ "random.randint" ]
[((46, 66), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (60, 66), False, 'import random\n'), ((74, 94), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (88, 94), False, 'import random\n')]
from __future__ import absolute_import import sys def this_is_a_bug(): o = object() if hasattr(o, "__call__"): sys.stdout.write("Ooh, callable! Or is it?\n") if getattr(o, "__call__", False): sys.stdout.write("Ooh, callable! Or is it?\n") def this_is_fine(): o = object() if call...
[ "sys.stdout.write" ]
[((130, 176), 'sys.stdout.write', 'sys.stdout.write', (['"""Ooh, callable! Or is it?\n"""'], {}), "('Ooh, callable! Or is it?\\n')\n", (146, 176), False, 'import sys\n'), ((223, 269), 'sys.stdout.write', 'sys.stdout.write', (['"""Ooh, callable! Or is it?\n"""'], {}), "('Ooh, callable! Or is it?\\n')\n", (239, 269), Fal...
# search_bar.py # # MIT License # # Copyright (c) 2020 <NAME> <<EMAIL>> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use...
[ "gi.repository.Gtk.Button.new_from_icon_name", "gi.repository.Gtk.Grid", "gettext.gettext", "gi.repository.GObject.Signal", "gi.repository.Gtk.FlowBoxChild" ]
[((3347, 3397), 'gi.repository.GObject.Signal', 'GObject.Signal', ([], {'flags': 'GObject.SignalFlags.RUN_LAST'}), '(flags=GObject.SignalFlags.RUN_LAST)\n', (3361, 3397), False, 'from gi.repository import Gtk, GObject\n'), ((2013, 2090), 'gi.repository.Gtk.Button.new_from_icon_name', 'Gtk.Button.new_from_icon_name', ([...
import tensorflow as tf import numpy as np import sys class utils(): def check_params(u, params): # CHECKS PARAMETERS ARE IN THE INITIALISATION DICTIONARY #______________________________________________________________ # CALLED FROM (DEFINED IN IMNN.py) # __init__(dict) ...
[ "sys.exit" ]
[((33078, 33088), 'sys.exit', 'sys.exit', ([], {}), '()\n', (33086, 33088), False, 'import sys\n'), ((6932, 6942), 'sys.exit', 'sys.exit', ([], {}), '()\n', (6940, 6942), False, 'import sys\n'), ((8431, 8441), 'sys.exit', 'sys.exit', ([], {}), '()\n', (8439, 8441), False, 'import sys\n'), ((9827, 9837), 'sys.exit', 'sy...
# MAIN import simplex import search import tree import marking import numpy as np from prettytable import PrettyTable # Данные варианта 18 c = np.array( [7, 7, 6], float) b = np.array( [8, 2, 6], float) A = np.array( [ [2, 1, 1], [1, 2, 0], [0, 0.5, 4] ], float) print ("ДАННЫЕ ВАРИ...
[ "prettytable.PrettyTable", "tree.Branch", "marking.fillMarks", "numpy.size", "search.bruteForce", "numpy.append", "numpy.array", "simplex.Simplex" ]
[((146, 172), 'numpy.array', 'np.array', (['[7, 7, 6]', 'float'], {}), '([7, 7, 6], float)\n', (154, 172), True, 'import numpy as np\n'), ((178, 204), 'numpy.array', 'np.array', (['[8, 2, 6]', 'float'], {}), '([8, 2, 6], float)\n', (186, 204), True, 'import numpy as np\n'), ((211, 263), 'numpy.array', 'np.array', (['[[...
""" .. See the NOTICE file distributed with this work for additional information regarding copyright ownership. 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....
[ "basic_modules.metadata.Metadata", "pandas.read_csv", "pandas.testing.assert_frame_equal", "CHiC.tool.run_pyCHiC.run_pyCHiC", "os.remove" ]
[((2932, 2957), 'CHiC.tool.run_pyCHiC.run_pyCHiC', 'run_pyCHiC', (['configuration'], {}), '(configuration)\n', (2942, 2957), False, 'from CHiC.tool.run_pyCHiC import run_pyCHiC\n'), ((3076, 3109), 'pandas.read_csv', 'pd.read_csv', (['output_loc'], {'sep': '"""\t"""'}), "(output_loc, sep='\\t')\n", (3087, 3109), True, '...
import numpy as np import random import time from sudoku.node import Node class Sudoku(): def __init__(self, size=9, custom=None, verbose=False, debug=False): # assume size is perfect square (TODO: assert square) # size is defined as the length of one side """ Custom s...
[ "random.choice", "numpy.sqrt", "random.shuffle", "sudoku.node.Node", "time.time" ]
[((596, 607), 'time.time', 'time.time', ([], {}), '()\n', (605, 607), False, 'import time\n'), ((8201, 8212), 'time.time', 'time.time', ([], {}), '()\n', (8210, 8212), False, 'import time\n'), ((560, 573), 'numpy.sqrt', 'np.sqrt', (['size'], {}), '(size)\n', (567, 573), True, 'import numpy as np\n'), ((736, 747), 'time...
from functools import wraps from ratelimit import limits def ratelimit_by_args(*args, **kwargs): """ Decorator to rate limit a function using its parameters values. The function call is rate limited, meaning that a new rate limit will be created each time the function is called with values that haven't b...
[ "ratelimit.limits", "functools.wraps" ]
[((393, 404), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (398, 404), False, 'from functools import wraps\n'), ((817, 851), 'ratelimit.limits', 'limits', (['*args'], {'name': 'name'}), '(*args, **kwargs, name=name)\n', (823, 851), False, 'from ratelimit import limits\n')]
#NAME-Pratishtha #This is my code to extract image frames from Multiple Videos to avoid having to run code for every video separately import cv2 import os no_pain_videos=glob.glob('D:/OneDrive/Desktop/aibabies') # I have passed the source folder where the videos(whose frames are to be extracted) are present np_video_li...
[ "cv2.imwrite", "cv2.VideoCapture" ]
[((784, 812), 'cv2.VideoCapture', 'cv2.VideoCapture', (['video_data'], {}), '(video_data)\n', (800, 812), False, 'import cv2\n'), ((1145, 1169), 'cv2.imwrite', 'cv2.imwrite', (['name', 'frame'], {}), '(name, frame)\n', (1156, 1169), False, 'import cv2\n')]
# built-in import re from typing import Dict, List, Optional # external import requests rex_version = re.compile(r'[0-9]+\.[0-9]+\.[0-9]+') _VERSION_REX = r'(?:[vV]\.?)?([0-9\.]+)' rexes = ( # `Version 1.2.3 ...` re.compile(r'(?:Version|Release) {}.*'.format(_VERSION_REX)), # `## 2.3.4 ...` re.compi...
[ "requests.get", "re.compile" ]
[((105, 143), 're.compile', 're.compile', (['"""[0-9]+\\\\.[0-9]+\\\\.[0-9]+"""'], {}), "('[0-9]+\\\\.[0-9]+\\\\.[0-9]+')\n", (115, 143), False, 'import re\n'), ((385, 409), 're.compile', 're.compile', (['_VERSION_REX'], {}), '(_VERSION_REX)\n', (395, 409), False, 'import re\n'), ((1460, 1485), 'requests.get', 'request...
from bisect import bisect_right from collections import deque, namedtuple from math import gcd, hypot, inf, sqrt eps = 1e-14 Line2 = namedtuple("Line2", ["a", "b", "c"]) vec3_base = namedtuple("vec3_base", ["x", "y", "z"]) vec2_base = namedtuple("vec2_base", ["x", "y"]) class Vec2(vec2_base): def __add__(self, o...
[ "collections.namedtuple", "collections.deque", "math.gcd", "math.sqrt", "math.hypot" ]
[((134, 170), 'collections.namedtuple', 'namedtuple', (['"""Line2"""', "['a', 'b', 'c']"], {}), "('Line2', ['a', 'b', 'c'])\n", (144, 170), False, 'from collections import deque, namedtuple\n'), ((183, 223), 'collections.namedtuple', 'namedtuple', (['"""vec3_base"""', "['x', 'y', 'z']"], {}), "('vec3_base', ['x', 'y', ...
# -*- encoding: utf-8 -*- from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): help = 'Installs initial_data' def handle(self, *args, **options): from test_app.conftest import initial_data initial_data()
[ "test_app.conftest.initial_data" ]
[((257, 271), 'test_app.conftest.initial_data', 'initial_data', ([], {}), '()\n', (269, 271), False, 'from test_app.conftest import initial_data\n')]
# neural network functions and classes import numpy as np import random import json import cma from es import SimpleGA, CMAES, PEPG, OpenES from env import make_env def sigmoid(x): return 1 / (1 + np.exp(-x)) def relu(x): return np.maximum(x, 0) def passthru(x): return x # useful for discrete actions def sof...
[ "numpy.product", "numpy.multiply", "numpy.tanh", "numpy.random.multinomial", "numpy.exp", "numpy.array", "numpy.split", "numpy.zeros", "numpy.max", "numpy.matmul", "numpy.concatenate", "json.load", "env.make_env", "numpy.maximum", "numpy.random.randn" ]
[((236, 252), 'numpy.maximum', 'np.maximum', (['x', '(0)'], {}), '(x, 0)\n', (246, 252), True, 'import numpy as np\n'), ((455, 482), 'numpy.random.multinomial', 'np.random.multinomial', (['(1)', 'p'], {}), '(1, p)\n', (476, 482), True, 'import numpy as np\n'), ((694, 724), 'numpy.concatenate', 'np.concatenate', (['(x, ...
from sqlalchemy import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import class_mapper Base = declarative_base() def model_to_dict(model): model_dict = {} for key, column in class_mapper(model.__class__).c.items(): model_dict[column.name] = getattr(model, key, None)...
[ "sqlalchemy.orm.class_mapper", "sqlalchemy.ext.declarative.declarative_base" ]
[((130, 148), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (146, 148), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((220, 249), 'sqlalchemy.orm.class_mapper', 'class_mapper', (['model.__class__'], {}), '(model.__class__)\n', (232, 249), False, 'from sqlal...
#!/usr/bin/python3 import os import veles from veles.config import root from veles.downloader import Downloader from veles.loader.file_image import FileListImageLoader def create_forward(workflow, normalizer, labels_mapping, loader_config): # Disable plotters: workflow.plotters_are_enabled = False # L...
[ "veles.loader.file_image.FileListImageLoader", "os.path.join", "veles.downloader.Downloader", "veles" ]
[((401, 564), 'veles.downloader.Downloader', 'Downloader', (['workflow'], {'url': '"""https://s3-eu-west-1.amazonaws.com/veles.forge/MNIST/mnist_test.tar"""', 'directory': 'root.common.dirs.datasets', 'files': "['mnist_test']"}), "(workflow, url=\n 'https://s3-eu-west-1.amazonaws.com/veles.forge/MNIST/mnist_test.tar...
""" Copyright (C) 2017 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-ND 4.0 license (https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode). """ from cocogan_nets_da import * from init import * from helpers import get_model_list, _compute_fake_acc2, _compute_true_acc2 import torch import t...
[ "torch.log", "torch.load", "torch.max", "torch.pow", "torch.from_numpy", "torch.nn.MSELoss", "os.path.dirname", "torch.nn.functional.cross_entropy", "helpers.get_model_list", "helpers._compute_fake_acc2", "helpers._compute_true_acc2", "torch.cat" ]
[((1339, 1357), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {}), '()\n', (1355, 1357), False, 'import torch\n'), ((2045, 2061), 'torch.pow', 'torch.pow', (['mu', '(2)'], {}), '(mu, 2)\n', (2054, 2061), False, 'import torch\n'), ((2073, 2089), 'torch.pow', 'torch.pow', (['sd', '(2)'], {}), '(sd, 2)\n', (2082, 2089), Fa...
import copy import numpy as np class Objective(): pass class MeanSquaredError(): def calc_acc(self,y_hat,y): return 0 def calc_loss(self,y_hat,y): loss = np.mean(np.sum(np.power(y_hat-y,2),axis=1)) return 0.5*loss def backward(self,y_hat,y): ...
[ "numpy.ones_like", "numpy.prod", "numpy.mean", "numpy.power", "numpy.where", "numpy.arange", "numpy.absolute", "numpy.log", "numpy.asarray", "numpy.argmax", "numpy.sum", "copy.deepcopy", "numpy.divide" ]
[((687, 710), 'numpy.where', 'np.where', (['(y_hat - y < 0)'], {}), '(y_hat - y < 0)\n', (695, 710), True, 'import numpy as np\n'), ((723, 742), 'numpy.ones_like', 'np.ones_like', (['y_hat'], {}), '(y_hat)\n', (735, 742), True, 'import numpy as np\n'), ((2168, 2193), 'numpy.prod', 'np.prod', (['y_hat.shape[:-1]'], {}),...
from yawf.exceptions import ResourcePermissionDeniedError class WorkflowResource(object): def __init__(self, handler, resource_id, permission_checker, description=None, slug=None): super(WorkflowResource, self...
[ "yawf.exceptions.ResourcePermissionDeniedError" ]
[((707, 758), 'yawf.exceptions.ResourcePermissionDeniedError', 'ResourcePermissionDeniedError', (['self.id', 'obj', 'sender'], {}), '(self.id, obj, sender)\n', (736, 758), False, 'from yawf.exceptions import ResourcePermissionDeniedError\n')]
from setuptools import setup, find_packages, Extension from os import path # Add Native Extensions # See https://docs.python.org/3/extending/building.html on details ext_modules = [] #ext_modules.append(Extension('demo', sources = ['demo.c'])) # Parse requirements.txt with open(path.join(path.abspath(path.dirname(__f...
[ "os.path.dirname", "setuptools.find_packages" ]
[((721, 783), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['docs', 'images', 'tests', 'examples']"}), "(exclude=['docs', 'images', 'tests', 'examples'])\n", (734, 783), False, 'from setuptools import setup, find_packages, Extension\n'), ((304, 326), 'os.path.dirname', 'path.dirname', (['__file__'], {...
from __future__ import print_function, absolute_import, division import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt from IPython.core.pylabtools import figsize figsize(12, 4) import os import sys os.environ['THEANO_FLAGS'] = "device=cpu,optimizer=fast_run" DATA_DIR = os.path.join('/res', 'dat...
[ "IPython.core.pylabtools.figsize", "matplotlib.use", "numpy.where", "matplotlib.pyplot.plot", "os.path.join", "numpy.tanh", "numpy.exp", "matplotlib.pyplot.figure", "numpy.linspace", "matplotlib.pyplot.show" ]
[((83, 104), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (97, 104), False, 'import matplotlib\n'), ((186, 200), 'IPython.core.pylabtools.figsize', 'figsize', (['(12)', '(4)'], {}), '(12, 4)\n', (193, 200), False, 'from IPython.core.pylabtools import figsize\n'), ((295, 323), 'os.path.join', 'o...
import pandas as pd import pickle import os import argparse import sys if './' not in sys.path: sys.path.append('./') from src.train import FrankModelTrainer, Trainer from src.dataset import get_datasets from src.utils.eval_values import frank_m2_similarity from src.comparators.activation_comparator import Activ...
[ "src.train.Trainer", "src.train.FrankModelTrainer.from_data_dict", "argparse.ArgumentParser", "pandas.read_csv", "os.makedirs", "src.utils.eval_values.frank_m2_similarity", "os.path.join", "pickle.load", "src.dataset.get_datasets", "src.comparators.activation_comparator.ActivationComparator.from_f...
[((102, 123), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (117, 123), False, 'import sys\n'), ((372, 427), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Simple settings."""'}), "(description='Simple settings.')\n", (395, 427), False, 'import argparse\n'), ((100...
import argparse import ast import collections import configparser import logging import os import sys import typing from abc import ABCMeta from argparse import Action, ArgumentParser from enum import Enum from pathlib import Path from types import MappingProxyType from typing import ( Any, Callable, Dict, Iterable...
[ "collections.OrderedDict", "configparser.ConfigParser", "os.getenv", "argparse.ArgumentParser", "types.MappingProxyType", "pathlib.Path", "os.environ.pop", "ast.literal_eval", "collections.defaultdict", "argparse.ArgumentError", "typing.TypeVar" ]
[((425, 437), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (432, 437), False, 'from typing import Any, Callable, Dict, Iterable, Mapping, MutableMapping, NamedTuple, Optional, Sequence, Set, Tuple, Type, TypeVar, Union\n'), ((744, 779), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '...