code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import re
import pytest
import responses
from quickbuild import QBError
DASHBOARDS_XML = r"""<?xml version="1.0" encoding="UTF-8"?>
<list>
<com.pmease.quickbuild.model.Dashboard>
<id>1</id>
<user>1</user>
<name>Default</name>
<description>System default dashboard</description>
<primary>false</... | [
"pytest.raises",
"re.compile"
] | [((3498, 3530), 're.compile', 're.compile', (['""".*/rest/dashboards"""'], {}), "('.*/rest/dashboards')\n", (3508, 3530), False, 'import re\n'), ((3987, 4019), 're.compile', 're.compile', (['""".*/rest/dashboards"""'], {}), "('.*/rest/dashboards')\n", (3997, 4019), False, 'import re\n'), ((4425, 4457), 're.compile', 'r... |
import pandas as pd
import bayesianpy
from bayesianpy.network import Builder as builder
import logging
import os
import numpy as np
import scipy.stats as ss
import matplotlib.pyplot as plt
import seaborn as sns
def main():
logger = logging.getLogger()
logger.addHandler(logging.StreamHandler())
logger.se... | [
"logging.getLogger",
"bayesianpy.network.Builder.create_cluster_variable",
"logging.StreamHandler",
"bayesianpy.model.InferenceEngine",
"matplotlib.pyplot.show",
"bayesianpy.network.create_network",
"os.path.join",
"bayesianpy.utils.get_path_to_parent_dir",
"bayesianpy.visual.JointDistribution",
"... | [((240, 259), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (257, 259), False, 'import logging\n'), ((346, 375), 'bayesianpy.jni.attach', 'bayesianpy.jni.attach', (['logger'], {}), '(logger)\n', (367, 375), False, 'import bayesianpy\n'), ((393, 442), 'bayesianpy.utils.get_path_to_parent_dir', 'bayesianpy.... |
"""
Provide functionality for test fixtures, settings and helpers.
"""
import pytest
from gimmeremmetokensbot.database import (
create_db_tables,
drop_db_tables,
insert_starter_user_info,
)
@pytest.fixture
def insert_user_info():
"""
Insert starter user information for testing purposes.
"""
... | [
"gimmeremmetokensbot.database.insert_starter_user_info",
"gimmeremmetokensbot.database.drop_db_tables",
"gimmeremmetokensbot.database.create_db_tables"
] | [((323, 589), 'gimmeremmetokensbot.database.insert_starter_user_info', 'insert_starter_user_info', ([], {'chat_id': '(33667738)', 'nickname': '"""pickles"""', 'address': '"""112007725c102f8166397a343707421b1adaa09f4a64347b79dc4217df825123hb34jk"""', 'public_key': '"""02b2cde4828e9800d4740f37de8118cfef59a8508163b3f1b0c9... |
# -*- coding: utf-8 -*-
def main():
from bisect import bisect
n = int(input())
h = [int(input()) for _ in range(n)]
set_h = sorted(set(h))
for i in range(n):
print(bisect(set_h, h[i]))
if __name__ == '__main__':
main()
| [
"bisect.bisect"
] | [((207, 226), 'bisect.bisect', 'bisect', (['set_h', 'h[i]'], {}), '(set_h, h[i])\n', (213, 226), False, 'from bisect import bisect\n')] |
from core.models import ProviderType
from api.v2.serializers.details import ProviderTypeSerializer
from api.v2.views.base import AuthModelViewSet
class ProviderTypeViewSet(AuthModelViewSet):
"""
API endpoint that allows instance actions to be viewed or edited.
"""
queryset = ProviderType.objects.all()... | [
"core.models.ProviderType.objects.all"
] | [((294, 320), 'core.models.ProviderType.objects.all', 'ProviderType.objects.all', ([], {}), '()\n', (318, 320), False, 'from core.models import ProviderType\n')] |
import dash_bootstrap_components as dbc
from dash import html
from .util import make_subheading
form = html.Div(
[
make_subheading("Form", "form"),
dbc.Form(
[
html.Div(
[
dbc.Label("Username"),
dbc.Inp... | [
"dash_bootstrap_components.Label",
"dash_bootstrap_components.Input",
"dash.html.A"
] | [((266, 287), 'dash_bootstrap_components.Label', 'dbc.Label', (['"""Username"""'], {}), "('Username')\n", (275, 287), True, 'import dash_bootstrap_components as dbc\n'), ((313, 370), 'dash_bootstrap_components.Input', 'dbc.Input', ([], {'placeholder': '"""Enter your username"""', 'type': '"""text"""'}), "(placeholder='... |
from functools import partial
from graphql.validation import UniqueArgumentNamesRule
from graphql.validation.rules.unique_argument_names import duplicate_arg_message
from .harness import assert_validation_errors
assert_errors = partial(assert_validation_errors, UniqueArgumentNamesRule)
assert_valid = partial(assert_... | [
"functools.partial",
"graphql.validation.rules.unique_argument_names.duplicate_arg_message"
] | [((230, 288), 'functools.partial', 'partial', (['assert_validation_errors', 'UniqueArgumentNamesRule'], {}), '(assert_validation_errors, UniqueArgumentNamesRule)\n', (237, 288), False, 'from functools import partial\n'), ((305, 338), 'functools.partial', 'partial', (['assert_errors'], {'errors': '[]'}), '(assert_errors... |
from distutils.core import setup
setup(
name = 'speechdb',
packages = ['speechdb'],
version = '0.1',
description = 'A library that simplifies the usability of the predominant speech databases.',
author = '<NAME>',
author_email = '<EMAIL>',
url = 'https://github.com/YuanGongND/Speech_DB_Engi... | [
"distutils.core.setup"
] | [((34, 436), 'distutils.core.setup', 'setup', ([], {'name': '"""speechdb"""', 'packages': "['speechdb']", 'version': '"""0.1"""', 'description': '"""A library that simplifies the usability of the predominant speech databases."""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/... |
"""surfinBH
========
Surrogate final black hole properties for mergers of binary black holes.
See https://pypi.org/project/surfinBH/ for more details.
"""
__copyright__ = "Copyright (C) 2018 <NAME>"
__email__ = "<EMAIL>"
__status__ = "testing"
__author__ = "<NAME>"
__version__ = "1.1.7"
__license__ = """
Permission is... | [
"numpy.copy",
"numpy.random.choice",
"numpy.sin",
"numpy.array",
"numpy.sum",
"numpy.cos",
"numpy.random.uniform",
"warnings.warn",
"numpy.atleast_1d"
] | [((7008, 7027), 'numpy.atleast_1d', 'np.atleast_1d', (['chiA'], {}), '(chiA)\n', (7021, 7027), True, 'import numpy as np\n'), ((7043, 7062), 'numpy.atleast_1d', 'np.atleast_1d', (['chiB'], {}), '(chiB)\n', (7056, 7062), True, 'import numpy as np\n'), ((8613, 8660), 'numpy.random.uniform', 'np.random.uniform', (['(1)', ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import math
import itertools
from scipy.linalg import svd, norm
# general messages for LM/etc optimization
TERMINATION_MESSAGES = {
None: "Status returned `None`. Error.",
-1: "Improper input parameters status returned from `leastsq`",
0: ... | [
"numpy.sqrt",
"numpy.linalg.multi_dot",
"math.log",
"numpy.mean",
"numpy.max",
"numpy.dot",
"numpy.matmul",
"numpy.empty",
"numpy.min",
"numpy.abs",
"itertools.cycle",
"numpy.isnan",
"scipy.linalg.svd",
"itertools.islice",
"math.isclose",
"numpy.errstate",
"numpy.sum",
"numpy.empty... | [((3224, 3241), 'numpy.load', 'np.load', (['npz_file'], {}), '(npz_file)\n', (3231, 3241), True, 'import numpy as np\n'), ((5271, 5289), 'numpy.empty_like', 'np.empty_like', (['cov'], {}), '(cov)\n', (5284, 5289), True, 'import numpy as np\n'), ((5964, 5991), 'scipy.linalg.svd', 'svd', (['A'], {'full_matrices': '(False... |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# 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 ap... | [
"paddle.sparse.sparse_coo_tensor",
"paddle.fluid.framework._test_eager_guard",
"paddle.sparse.sparse_csr_tensor",
"paddle.to_tensor",
"unittest.main",
"paddle.fluid.core.CPUPlace"
] | [((6905, 6920), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6918, 6920), False, 'import unittest\n'), ((886, 905), 'paddle.fluid.framework._test_eager_guard', '_test_eager_guard', ([], {}), '()\n', (903, 905), False, 'from paddle.fluid.framework import _test_eager_guard\n'), ((1082, 1116), 'paddle.to_tensor', ... |
import os
import datetime
# Variables set on environment when possible
# Required
TOKEN = os.environ.get("TOKEN", "")
NAME = os.environ.get("NAME", "")
HOUR = int(os.environ.get("HOUR", 10))
MINUTE = int(os.environ.get("MINUTE", 00))
DAILY_TIME = datetime.time(hour=HOUR, minute=MINUTE)
# File locations
START_FILE =... | [
"datetime.time",
"os.environ.get"
] | [((93, 120), 'os.environ.get', 'os.environ.get', (['"""TOKEN"""', '""""""'], {}), "('TOKEN', '')\n", (107, 120), False, 'import os\n'), ((128, 154), 'os.environ.get', 'os.environ.get', (['"""NAME"""', '""""""'], {}), "('NAME', '')\n", (142, 154), False, 'import os\n'), ((250, 289), 'datetime.time', 'datetime.time', ([]... |
from uuid import uuid4
class methods:
def search(typeArg, location, maxdist, service, time):
foundflag = False
shopinst = []
for cshop in shoplist:
if cshop.typeArg == typeArg and cshop.location == location and service in cshop.services and time in cshop.timetable:
... | [
"uuid.uuid4"
] | [((1208, 1215), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (1213, 1215), False, 'from uuid import uuid4\n')] |
"""Views related to the statistics module"""
from datetime import date, timedelta
# pylint: disable=redefined-builtin
from requests.exceptions import ConnectionError, InvalidURL
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect
... | [
"django.utils.decorators.method_decorator",
"datetime.timedelta",
"django.shortcuts.redirect",
"django.utils.translation.ugettext",
"datetime.date.today"
] | [((605, 654), 'django.utils.decorators.method_decorator', 'method_decorator', (['login_required'], {'name': '"""dispatch"""'}), "(login_required, name='dispatch')\n", (621, 654), False, 'from django.utils.decorators import method_decorator\n'), ((656, 717), 'django.utils.decorators.method_decorator', 'method_decorator'... |
from __future__ import absolute_import, unicode_literals
import datetime
import traceback
from decimal import Decimal, InvalidOperation
import logging
from uuid import uuid4
from enum import Enum
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.d... | [
"logging.getLogger",
"temba_client.v2.types.ObjectRef.create",
"django.db.models.Manager.from_queryset",
"django.core.exceptions.ValidationError",
"tracpro.groups.models.Region.get_all",
"django.utils.dateparse.parse_datetime",
"temba_client.v2.types.Contact.create",
"tracpro.groups.models.Group.get_a... | [((1002, 1029), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1019, 1029), False, 'import logging\n'), ((1749, 1794), 'django.db.models.Manager.from_queryset', 'models.Manager.from_queryset', (['ContactQuerySet'], {}), '(ContactQuerySet)\n', (1777, 1794), False, 'from django.db import m... |
"""
Copyright (c) 2021, CRAI
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import List, Union, Tuple
import torch
import torch.nn as nn
from ..swish import MemoryEfficientSwish, Swish
from ..utils im... | [
"torch.nn.ReLU",
"torch.nn.InstanceNorm2d",
"torch.sum",
"torch.nn.ParameterList",
"torch.nn.ConvTranspose2d",
"torch.ones"
] | [((6416, 6455), 'torch.nn.ParameterList', 'nn.ParameterList', (['self.middle_attention'], {}), '(self.middle_attention)\n', (6432, 6455), True, 'import torch.nn as nn\n'), ((6485, 6521), 'torch.nn.ParameterList', 'nn.ParameterList', (['self.out_attention'], {}), '(self.out_attention)\n', (6501, 6521), True, 'import tor... |
"""Tests for the command-line interface."""
from click.testing import CliRunner
from kafkaconnect.cli import main
def test_help() -> None:
"""Test help for main commands and subcommands."""
runner = CliRunner()
result = runner.invoke(main, ["-h"])
assert result.exit_code == 0
assert "Commands:"... | [
"click.testing.CliRunner"
] | [((211, 222), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (220, 222), False, 'from click.testing import CliRunner\n'), ((978, 989), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (987, 989), False, 'from click.testing import CliRunner\n'), ((1440, 1451), 'click.testing.CliRunner', 'CliRunner', ... |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# 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... | [
"tensorflow.unstack",
"tensor2tensor.layers.common_video.tinyify",
"tensorflow.logical_not",
"tensor2tensor.layers.common_layers.shape_list",
"tensorflow.split",
"tensorflow.control_dependencies",
"tensorflow.scan",
"tensorflow.reduce_mean",
"tensorflow.summary.image",
"tensorflow.concat",
"tens... | [((1447, 1498), 'tensor2tensor.layers.common_video.tinyify', 'common_video.tinyify', (['array', 'self.hparams.tiny_mode'], {}), '(array, self.hparams.tiny_mode)\n', (1467, 1498), False, 'from tensor2tensor.layers import common_video\n'), ((1684, 1734), 'tensor2tensor.layers.common_video.swap_time_and_batch_axes', 'comm... |
import tkinter as tk
from tkinter import Event, StringVar
from tkinter.constants import DISABLED
import tkinter.ttk as ttk
import time
from typing import Sequence
from scipy.spatial.transform import rotation
from setuptools.command.easy_install import main
import sim_hexa as simhexa
import math
main_window = tk.Tk()... | [
"tkinter.IntVar",
"tkinter.ttk.Checkbutton",
"tkinter.LabelFrame",
"sim_hexa.egg_shake",
"sim_hexa.egg_twerk",
"sim_hexa.reset_robot",
"tkinter.ttk.Frame",
"tkinter.ttk.Label",
"tkinter.Scale",
"tkinter.StringVar",
"tkinter.Radiobutton",
"tkinter.Tk",
"sim_hexa.egg_wave",
"tkinter.DoubleVa... | [((313, 320), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (318, 320), True, 'import tkinter as tk\n'), ((516, 530), 'tkinter.DoubleVar', 'tk.DoubleVar', ([], {}), '()\n', (528, 530), True, 'import tkinter as tk\n'), ((546, 560), 'tkinter.DoubleVar', 'tk.DoubleVar', ([], {}), '()\n', (558, 560), True, 'import tkinter as tk... |
"""
End-to-end tests
"""
import asyncio
from subprocess import check_output
import pytest
from snakeskin.config import BlockchainConfig
from snakeskin.operations import query_installed_chaincodes, query_instantiated_chaincodes
from snakeskin.events import OrdererEvents
from snakeskin.models import Channel
@py... | [
"subprocess.check_output",
"snakeskin.operations.query_instantiated_chaincodes",
"snakeskin.operations.query_installed_chaincodes",
"pytest.yield_fixture",
"pytest.fixture",
"asyncio.get_event_loop",
"snakeskin.config.BlockchainConfig.from_file",
"snakeskin.models.Channel"
] | [((318, 355), 'pytest.yield_fixture', 'pytest.yield_fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (338, 355), False, 'import pytest\n'), ((521, 589), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""', 'name': '"""network_config"""', 'autouse': '(True)'}), "(scope='session', name='n... |
import torch
import torchvision as tv
from tqdm import tqdm
from classifier_divergence.h_discrepancy import Discrepancy
from classifier_divergence.h_discrepancy import NoSchedule
from classifier_divergence.h_discrepancy import Default
IMAGE_MEAN = 0.1307
IMAGE_STD = 0.3081
def get_datasets():
source_transform =... | [
"torch.nn.ReLU",
"torch.nn.CrossEntropyLoss",
"torch.utils.data.DataLoader",
"torchvision.transforms.RandomRotation",
"torch.nn.Flatten",
"tqdm.tqdm",
"torchvision.transforms.Resize",
"torchvision.transforms.Grayscale",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"classifier_divergence.h_discrepanc... | [((554, 632), 'torchvision.datasets.MNIST', 'tv.datasets.MNIST', (['"""./"""'], {'train': '(True)', 'download': '(True)', 'transform': 'source_transform'}), "('./', train=True, download=True, transform=source_transform)\n", (571, 632), True, 'import torchvision as tv\n'), ((947, 1025), 'torchvision.datasets.MNIST', 'tv... |
import pytest
from django.contrib.auth import get_user_model
from rest_framework.reverse import reverse
from boards.models import Column, Board, Task
User = get_user_model()
@pytest.fixture
def board(create_user):
user = create_user()
uni_board = Board.objects.create(name="University", owner=user)
uni_b... | [
"django.contrib.auth.get_user_model",
"boards.models.Board.objects.create",
"boards.models.Column.objects.create",
"boards.models.Column.objects.filter",
"boards.models.Board.objects.filter",
"pytest.mark.parametrize",
"boards.models.Board.objects.all",
"boards.models.Task.objects.filter",
"boards.m... | [((159, 175), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (173, 175), False, 'from django.contrib.auth import get_user_model\n'), ((5503, 5745), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""post_data,expected_status_code"""', "[({'order': [1, 2]}, 200), ({'order': [1, 1]}, 4... |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(input())
if n == 1:
print(0)
sys.exit(0)
import math
prime_factorization = []
copy_n = n
for i in range(2, math.ceil(math.sqrt(n)) + 1):
if copy_n % i != 0:
continue
else:
ex = 0
while copy_n % i ==... | [
"sys.setrecursionlimit",
"math.sqrt",
"sys.exit"
] | [((38, 68), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10 ** 7)'], {}), '(10 ** 7)\n', (59, 68), False, 'import sys\n'), ((116, 127), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (124, 127), False, 'import sys\n'), ((207, 219), 'math.sqrt', 'math.sqrt', (['n'], {}), '(n)\n', (216, 219), False, 'import mat... |
# -----------------------------------
#
# 01_02 线性回归
#
# -----------------------------------
import numpy as np
import tensorflow as tf
tf.enable_eager_execution()
# -----------------------------------
# 1. 数据
# -----------------------------------
X_raw = np.array([2013, 2014, 2015, 2016, 2017], dtype=np.float32)
... | [
"tensorflow.get_variable",
"tensorflow.enable_eager_execution",
"tensorflow.train.GradientDescentOptimizer",
"numpy.array",
"tensorflow.GradientTape",
"tensorflow.constant",
"tensorflow.square"
] | [((139, 166), 'tensorflow.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (164, 166), True, 'import tensorflow as tf\n'), ((261, 319), 'numpy.array', 'np.array', (['[2013, 2014, 2015, 2016, 2017]'], {'dtype': 'np.float32'}), '([2013, 2014, 2015, 2016, 2017], dtype=np.float32)\n', (269, 319), Tru... |
import cv2
import numpy as np
drawing = False # true if mouse is pressed
mode = True # if True, draw rectangle. Press 'm' to toggle to curve
ix,iy = -1,-1
# mouse callback function
def draw_circle(event,x,y,flags,param):
global ix,iy,drawing,mode
if event == cv2.EVENT_LBUTTONDOWN:
drawing = True
... | [
"cv2.setMouseCallback",
"cv2.rectangle",
"cv2.imshow",
"numpy.zeros",
"cv2.circle",
"cv2.destroyAllWindows",
"cv2.waitKey",
"cv2.namedWindow"
] | [((783, 816), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)', 'np.uint8'], {}), '((512, 512, 3), np.uint8)\n', (791, 816), True, 'import numpy as np\n'), ((817, 841), 'cv2.namedWindow', 'cv2.namedWindow', (['"""image"""'], {}), "('image')\n", (832, 841), False, 'import cv2\n'), ((842, 884), 'cv2.setMouseCallback', 'cv2.s... |
import random
import discord
from discord.ext import commands
from .inputs import responses, fortunes, quo, nerd, tech, rost, bk, cmp, blurt, jk
from .utils import COLOR
class Fun(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command(aliases=["8ball"])
async def magicb... | [
"random.choice",
"discord.Embed",
"discord.ext.commands.command"
] | [((264, 299), 'discord.ext.commands.command', 'commands.command', ([], {'aliases': "['8ball']"}), "(aliases=['8ball'])\n", (280, 299), False, 'from discord.ext import commands\n'), ((625, 661), 'discord.ext.commands.command', 'commands.command', ([], {'aliases': "['future']"}), "(aliases=['future'])\n", (641, 661), Fal... |
#!/usr/bin/env python3
# use this to add metadata to the pheno-list.json file: endpoint names, categories, case/control n, gc lambda, num gw sig hits
# TODO make part of the import wdl, not using the cov_pheno file but precalculating Ns so can be done without red data
# python3 /mnt/nfs/juha/pheweb/pheweb/load/phenoli... | [
"json.load",
"json.dumps",
"gzip.open"
] | [((793, 805), 'json.load', 'json.load', (['f'], {}), '(f)\n', (802, 805), False, 'import json\n'), ((865, 877), 'json.load', 'json.load', (['f'], {}), '(f)\n', (874, 877), False, 'import json\n'), ((2082, 2110), 'gzip.open', 'gzip.open', (['sys.argv[6]', '"""rt"""'], {}), "(sys.argv[6], 'rt')\n", (2091, 2110), False, '... |
import tensorflow as tf
import numpy as np
import math
class NeuInfer(object):
"""
The proposed NeuInfer model
"""
def g_theta(self, o_i, o_j, scope='g_theta', reuse=tf.AUTO_REUSE):
"""
g_theta: Obtain the interaction vector of the o_i (hrt) and o_j (aivi)
"""
with tf.var... | [
"tensorflow.nn.embedding_lookup",
"tensorflow.reduce_min",
"tensorflow.equal",
"tensorflow.variable_scope",
"tensorflow.placeholder",
"tensorflow.contrib.layers.fully_connected",
"math.sqrt",
"tensorflow.global_variables",
"tensorflow.concat",
"tensorflow.nn.sigmoid",
"tensorflow.random_uniform"... | [((1419, 1452), 'tensorflow.concat', 'tf.concat', (['[a_embed, v_embed]', '(-1)'], {}), '([a_embed, v_embed], -1)\n', (1428, 1452), True, 'import tensorflow as tf\n'), ((2196, 2256), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[batch_size, None]'], {'name': '"""input_x"""'}), "(tf.int32, [batch_size, Non... |
import sys
from PIL import Image
import argparse
import os
import numpy as np
import torch
import cv2
torch.set_printoptions(sci_mode=False, precision=4)
np.set_printoptions(suppress=True, precision=4)
def save_matrix(filename, mat, print_stats=False):
import matplotlib.pyplot as plt
# corr = F.avg_pool2d(co... | [
"cv2.rectangle",
"numpy.count_nonzero",
"matplotlib.pyplot.imshow",
"os.path.exists",
"torch.set_printoptions",
"argparse.ArgumentParser",
"cv2.addWeighted",
"numpy.abs",
"matplotlib.pyplot.savefig",
"os.path.splitext",
"cv2.resize",
"cv2.imread",
"numpy.set_printoptions",
"cv2.applyColorM... | [((104, 155), 'torch.set_printoptions', 'torch.set_printoptions', ([], {'sci_mode': '(False)', 'precision': '(4)'}), '(sci_mode=False, precision=4)\n', (126, 155), False, 'import torch\n'), ((156, 203), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)', 'precision': '(4)'}), '(suppress=True, p... |
from flask import Flask, url_for, redirect, request, Markup, render_template, session, flash
import json, datetime
import config
app = Flask(__name__)
app.config.from_object('config')
# DISABLE DEBUG FOR PRODUCTION!
app.debug = False
def clear_session():
session['last_action'] = None
# using session.clear()... | [
"flask.render_template",
"flask.request.args.get",
"flask.flash",
"flask.Flask",
"flask.url_for",
"datetime.datetime.now"
] | [((136, 151), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (141, 151), False, 'from flask import Flask, url_for, redirect, request, Markup, render_template, session, flash\n'), ((693, 716), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (714, 716), False, 'import json, datetime\n'), ... |
from django.shortcuts import render
def index(request):
return render(request, 'index.html', {})
def team(request):
team_sisi ='hello mates!'
return render(request, 'team.html', {'team_sisi': team_sisi}) | [
"django.shortcuts.render"
] | [((65, 98), 'django.shortcuts.render', 'render', (['request', '"""index.html"""', '{}'], {}), "(request, 'index.html', {})\n", (71, 98), False, 'from django.shortcuts import render\n'), ((155, 209), 'django.shortcuts.render', 'render', (['request', '"""team.html"""', "{'team_sisi': team_sisi}"], {}), "(request, 'team.h... |
import io
from twisted.internet import reactor
from ygo.card import Card
from ygo.duel_reader import DuelReader
from ygo.parsers.duel_parser import DuelParser
from ygo.utils import process_duel
def msg_select_unselect_card(self, data):
data = io.BytesIO(data[1:])
player = self.read_u8(data)
finishabl... | [
"twisted.internet.reactor.callLater",
"io.BytesIO",
"ygo.card.Card"
] | [((256, 276), 'io.BytesIO', 'io.BytesIO', (['data[1:]'], {}), '(data[1:])\n', (266, 276), False, 'import io\n'), ((598, 608), 'ygo.card.Card', 'Card', (['code'], {}), '(code)\n', (602, 608), False, 'from ygo.card import Card\n'), ((838, 848), 'ygo.card.Card', 'Card', (['code'], {}), '(code)\n', (842, 848), False, 'from... |
import utils.env_loader as env_loader
env = env_loader.load()
from flask import Flask
if env.get("FLASK_ENV") == "production":
app = Flask("app", template_folder="templates_production")
from app import configs
app.config.from_object(configs.Production)
socketio_kwargs = {
"async_mode": "geve... | [
"app.socketio_event_handlers.project_namespace.SocketIOProjectNamespace",
"boto3.client",
"utils.env_loader.load",
"flask.Flask",
"flask_socketio.SocketIO",
"flask_bcrypt.Bcrypt",
"app.socketio_event_handlers.global_namespace.SocketIOGlobalNamespace",
"app.auth.login_manager.init_app",
"flask_sqlalc... | [((44, 61), 'utils.env_loader.load', 'env_loader.load', ([], {}), '()\n', (59, 61), True, 'import utils.env_loader as env_loader\n'), ((1018, 1050), 'flask_socketio.SocketIO', 'SocketIO', (['app'], {}), '(app, **socketio_kwargs)\n', (1026, 1050), False, 'from flask_socketio import SocketIO\n'), ((1118, 1133), 'flask_sq... |
# @Time : 2022/1/1
# @Author : <NAME>
# @email : <EMAIL>
import ipdb
import math
import torch
import numpy as np
import torch.nn.functional as F
from loguru import logger
from torch import nn
import os
from crslab.model.base import BaseModel
from crslab.model.utils.modules.info_nce_loss import info_nce_lo... | [
"torch.nn.Dropout",
"numpy.sqrt",
"torch.nn.CrossEntropyLoss",
"math.sqrt",
"torch.nn.init.xavier_normal_",
"crslab.model.utils.modules.transformer.TransformerFFN",
"crslab.model.utils.modules.transformer.create_position_codes",
"torch.nn.functional.softmax",
"torch.arange",
"torch.nn.functional.l... | [((2147, 2187), 'crslab.model.utils.functions.edge_to_pyg_format', 'edge_to_pyg_format', (['entity_edges', '"""RGCN"""'], {}), "(entity_edges, 'RGCN')\n", (2165, 2187), False, 'from crslab.model.utils.functions import edge_to_pyg_format\n'), ((3280, 3321), 'torch.nn.Linear', 'nn.Linear', (['self.kg_emb_dim', 'self.ffn_... |
"""
Implementation of a standard financial plot visualization using Chaco
renderers and scales. This differs from the financial_plot.py example
in that it uses a date-oriented axis.
"""
# Major library imports
from numpy import abs, cumprod, linspace, random
import time
# Enthought library imports
from enable.api im... | [
"chaco.api.FilledLinePlot",
"traits.api.Instance",
"numpy.random.normal",
"chaco.tools.api.PanTool",
"chaco.tools.api.ZoomTool",
"numpy.cumprod",
"chaco.scales.api.CalendarScaleSystem",
"chaco.api.add_default_grids",
"chaco.api.BarPlot",
"chaco.api.DataRange1D",
"chaco.api.ArrayDataSource",
"n... | [((1169, 1180), 'time.time', 'time.time', ([], {}), '()\n', (1178, 1180), False, 'import time\n'), ((1219, 1265), 'numpy.linspace', 'linspace', (['now', '(now + numpoints * dt)', 'numpoints'], {}), '(now, now + numpoints * dt, numpoints)\n', (1227, 1265), False, 'from numpy import abs, cumprod, linspace, random\n'), ((... |
# implementation based on DeepLTL https://github.com/reactive-systems/deepltl
from timeit import default_timer as timer
import math
import sys
from contextlib import contextmanager
import multiprocessing as mp
@contextmanager
def nice_open(filename=None, mode='r'): # thanks to https://stackoverflow.com/questions/176... | [
"math.floor",
"timeit.default_timer",
"multiprocessing.Process",
"matplotlib.pyplot.close",
"math.log10",
"multiprocessing.Pipe",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((2292, 2301), 'multiprocessing.Pipe', 'mp.Pipe', ([], {}), '()\n', (2299, 2301), True, 'import multiprocessing as mp\n'), ((2313, 2367), 'multiprocessing.Process', 'mp.Process', ([], {'target': '_wrapped_target', 'args': '(child_conn,)'}), '(target=_wrapped_target, args=(child_conn,))\n', (2323, 2367), True, 'import ... |
# coding=utf-8
import copy
import time
from service.mahjong.models.hutype.basetype import BaseType
from service.mahjong.constants.carddefine import CardType
from service.mahjong.models.hutype.basetype import BaseType
from service.mahjong.constants.carddefine import CardType, CARD_SIZE
from service.mahjong.models.card.... | [
"service.mahjong.models.card.hand_card.HandCard",
"time.time",
"service.mahjong.models.utils.cardanalyse.CardAnalyse"
] | [((1429, 1442), 'service.mahjong.models.utils.cardanalyse.CardAnalyse', 'CardAnalyse', ([], {}), '()\n', (1440, 1442), False, 'from service.mahjong.models.utils.cardanalyse import CardAnalyse\n'), ((1459, 1476), 'service.mahjong.models.card.hand_card.HandCard', 'HandCard', (['(0)', 'None'], {}), '(0, None)\n', (1467, 1... |
# Copyright 2019 IBM Corporation
#
# 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, ... | [
"numpy.dtype",
"lale.lib.lale.Hyperopt",
"lale.lib.sklearn.LogisticRegression",
"lale.lib.autoai_libs.float32_transform",
"lale.lib.lale.NoOp",
"lale.lib.lale.ConcatFeatures"
] | [((1824, 1875), 'lale.lib.lale.Hyperopt', 'Hyperopt', ([], {'estimator': 'trainable_pipeline', 'max_evals': '(1)'}), '(estimator=trainable_pipeline, max_evals=1)\n', (1832, 1875), False, 'from lale.lib.lale import Hyperopt, ConcatFeatures, NoOp\n'), ((2391, 2442), 'lale.lib.lale.Hyperopt', 'Hyperopt', ([], {'estimator'... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-10-09 03:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('notifications', '0005_learnerprogressnotification_assignment_collections'),
]
oper... | [
"django.db.models.CharField"
] | [((473, 686), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'choices': "[('Answered', 'Answered'), ('Completed', 'Completed'), ('Denied', 'Denied'),\n ('Help', 'HelpNeeded'), ('Promoted', 'Promoted'), ('Started', 'Started')]", 'max_length': '(200)'}), "(blank=True, choices=[('Answered', ... |
# Generated by Django 2.2.3 on 2019-07-24 10:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0006_auto_20190723_1502'),
]
operations = [
migrations.AddField(
model_name='articlephotoreport',
name='main'... | [
"django.db.models.BooleanField"
] | [((340, 488), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'help_text': '"""Если отмечено несколько картинок, то выбирается любая"""', 'verbose_name': '"""Отображать в preview"""'}), "(default=False, help_text=\n 'Если отмечено несколько картинок, то выбирается любая', verbose_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python version: 3.6
import models.func as fc
# from models.func import node_deleting
import models.test as ts
# from models.test import test_part
import copy
import torch
import operator
import test
from torch import nn
from numpy import linalg as LA
import logging
import... | [
"logging.getLogger",
"numpy.random.get_state",
"numpy.random.set_state",
"numpy.linalg.norm",
"test",
"numpy.random.seed",
"copy.deepcopy",
"operator.itemgetter",
"copy.copy",
"models.test.test_part",
"models.func.node_deleting",
"torch.FloatTensor",
"numpy.random.shuffle"
] | [((374, 403), 'logging.getLogger', 'logging.getLogger', (['"""main_fed"""'], {}), "('main_fed')\n", (391, 403), False, 'import logging\n'), ((812, 840), 'copy.deepcopy', 'copy.deepcopy', (['value_list[0]'], {}), '(value_list[0])\n', (825, 840), False, 'import copy\n'), ((1104, 1125), 'copy.copy', 'copy.copy', (['idxs_u... |
"""
Base class for wrapping
"""
__authors__ = "<NAME>"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["<NAME>", "<NAME>"]
__license__ = "3-clause BSD"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
"""
This module may contain code copied directly or modified from cuda-convnet.
The copyri... | [
"warnings.warn",
"pylearn2.sandbox.cuda_convnet.convnet_compile.convnet_available",
"theano.compat.get_unbound_function"
] | [((5607, 5648), 'theano.compat.get_unbound_function', 'get_unbound_function', (['BaseActs.make_thunk'], {}), '(BaseActs.make_thunk)\n', (5627, 5648), False, 'from theano.compat import get_unbound_function\n'), ((3114, 3187), 'warnings.warn', 'warnings.warn', (["('No C-code cache version for %s' % self.__class__.__name_... |
# -*- coding: utf-8 -*-
# Created on 07/01/2022 15:51:23
# @author: ErwingForero
#
from os import path
#Project constants
MACRO_EXTRACT_TABLE_SHEET = "ExtraerTablaHoja"
#routes
PRINCIPAL_FILE_SOURCE = ""
ROOT_DIR = path.abspath(path.join(__file__ ,"../../..")) | [
"os.path.join"
] | [((240, 271), 'os.path.join', 'path.join', (['__file__', '"""../../.."""'], {}), "(__file__, '../../..')\n", (249, 271), False, 'from os import path\n')] |
import requests
from pony.orm import db_session
from chatbot import handlers
import _token
from chatbot.models import UserState, Registration
try:
import settings
except ImportError:
exit('Do cp settings.py.default settings.py and set token!')
from vk_api import VkApi
from vk_api.bot_longpoll import VkBotLon... | [
"logging.getLogger",
"logging.StreamHandler",
"requests.post",
"logging.Formatter",
"vk_api.bot_longpoll.VkBotLongPoll",
"vk_api.VkApi",
"logging.FileHandler",
"chatbot.models.Registration",
"random.randint"
] | [((379, 403), 'logging.getLogger', 'logging.getLogger', (['"""bot"""'], {}), "('bot')\n", (396, 403), False, 'import logging\n'), ((452, 475), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (473, 475), False, 'import logging\n'), ((653, 683), 'logging.FileHandler', 'logging.FileHandler', (['"""bot.... |
# coding: utf8
import geocoder
location = 'Ottawa'
coordinates = {'lat': 41.005407, 'lng': 28.978349}
def test_yandex():
g = geocoder.yandex(location)
assert g.ok
def test_yandex_reverse():
g = geocoder.yandex(coordinates, method='reverse')
assert g.ok
def test_multi_results():
g = geocoder.... | [
"geocoder.yandex"
] | [((133, 158), 'geocoder.yandex', 'geocoder.yandex', (['location'], {}), '(location)\n', (148, 158), False, 'import geocoder\n'), ((212, 258), 'geocoder.yandex', 'geocoder.yandex', (['coordinates'], {'method': '"""reverse"""'}), "(coordinates, method='reverse')\n", (227, 258), False, 'import geocoder\n'), ((311, 347), '... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# 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 app... | [
"paddle.fluid.layers.resize_nearest",
"numpy.allclose",
"paddle.fluid.data",
"numpy.ones",
"numpy.random.random",
"paddle.fluid.default_startup_program",
"paddle.fluid.core.CUDAPlace",
"paddle.enable_static",
"paddle.fluid.default_main_program",
"numpy.zeros",
"paddle.fluid.Executor",
"numpy.a... | [((1809, 1839), 'numpy.zeros', 'np.zeros', (['(n, c, out_h, out_w)'], {}), '((n, c, out_h, out_w))\n', (1817, 1839), True, 'import numpy as np\n'), ((17166, 17188), 'paddle.enable_static', 'paddle.enable_static', ([], {}), '()\n', (17186, 17188), False, 'import paddle\n'), ((17193, 17208), 'unittest.main', 'unittest.ma... |
from __future__ import annotations
import typing as t
import discord
from discord.ext import commands
from ..core import Context
if t.TYPE_CHECKING:
from ..core import Bot
class Config(commands.Cog):
def __init__(self, bot: Bot):
self.bot = bot
async def cog_check(self, ctx: Context) -> bool:... | [
"discord.ext.commands.group",
"discord.ext.commands.guild_only",
"discord.ext.commands.has_permissions"
] | [((385, 428), 'discord.ext.commands.group', 'commands.group', ([], {'invoke_without_command': '(True)'}), '(invoke_without_command=True)\n', (399, 428), False, 'from discord.ext import commands\n'), ((434, 477), 'discord.ext.commands.has_permissions', 'commands.has_permissions', ([], {'manage_guild': '(True)'}), '(mana... |
import numpy as np
import pytest
def test_camera_display_create():
from ctapipe.visualization.bokeh import CameraDisplay
CameraDisplay()
def test_camera_geom(example_event, example_subarray):
from ctapipe.visualization.bokeh import CameraDisplay
t = list(example_event.r0.tel.keys())[0]
geom = ... | [
"numpy.sqrt",
"numpy.ones",
"ctapipe.visualization.bokeh.CameraDisplay",
"ctapipe.visualization.bokeh.FastCameraDisplay",
"pytest.raises",
"ctapipe.visualization.bokeh.intensity_to_hex",
"ctapipe.visualization.bokeh.WaveformDisplay",
"numpy.arange"
] | [((132, 147), 'ctapipe.visualization.bokeh.CameraDisplay', 'CameraDisplay', ([], {}), '()\n', (145, 147), False, 'from ctapipe.visualization.bokeh import CameraDisplay\n'), ((376, 395), 'ctapipe.visualization.bokeh.CameraDisplay', 'CameraDisplay', (['geom'], {}), '(geom)\n', (389, 395), False, 'from ctapipe.visualizati... |
# Copyright (c) 2016-present, Facebook, Inc.
#
# 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... | [
"os.close",
"caffe2.python.workspace.C.create_db",
"tempfile.mkstemp"
] | [((989, 1007), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {}), '()\n', (1005, 1007), False, 'import tempfile\n'), ((1016, 1032), 'os.close', 'os.close', (['handle'], {}), '(handle)\n', (1024, 1032), False, 'import os\n'), ((1270, 1341), 'caffe2.python.workspace.C.create_db', 'workspace.C.create_db', (['"""minidb"""',... |
#! /usr/bin/env python
# -*- coding:utf-8 -*-
"""
file used to give the slot
numbers of the parking_lot slots
where a particular colour car is parked
"""
import argparse
from functional_spec.spec.parking_lot import ParkingLot
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="find... | [
"functional_spec.spec.parking_lot.ParkingLot",
"argparse.ArgumentParser"
] | [((270, 384), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""find the slot number of the cars parked in parkin lot using its colour"""'}), "(description=\n 'find the slot number of the cars parked in parkin lot using its colour')\n", (293, 384), False, 'import argparse\n'), ((676, 746... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 30 16:23:35 2020
@author: elizabeth_mckenzie
"""
import numpy as np
from scipy.ndimage.interpolation import rotate as ndrotate
import tensorflow as tf
from skimage.transform import resize
import matplotlib.pyplot as plt
order = 0
# input_shape = (... | [
"tensorflow.py_function",
"numpy.random.uniform",
"tensorflow.constant",
"numpy.expand_dims",
"tensorflow.ones_like",
"tensorflow.cast",
"skimage.transform.resize",
"numpy.load"
] | [((4569, 4586), 'numpy.load', 'np.load', (['npy_name'], {}), '(npy_name)\n', (4576, 4586), True, 'import numpy as np\n'), ((4621, 4648), 'skimage.transform.resize', 'resize', (['img', '(32, 256, 256)'], {}), '(img, (32, 256, 256))\n', (4627, 4648), False, 'from skimage.transform import resize\n'), ((1210, 1238), 'tenso... |
import os
import pytest
import renderapi
import json
from test_data import (
render_params, example_env,
render_json_template, TEST_DATA_ROOT)
from asap.point_match_optimization.pt_match_optimization import (
PtMatchOptimization
)
pt_match_opts_example = {
"render": render_params,
"SIFT_option... | [
"os.path.exists",
"renderapi.stack.get_stack_tileIds",
"renderapi.connect",
"test_data.render_json_template",
"renderapi.tilespec.TileSpec",
"asap.point_match_optimization.pt_match_optimization.PtMatchOptimization",
"json.load",
"os.path.isfile",
"renderapi.client.import_tilespecs",
"renderapi.sta... | [((1131, 1234), 'test_data.render_json_template', 'render_json_template', (['example_env', '"""point_match_opts_tilespecs.json"""'], {'test_data_root': 'TEST_DATA_ROOT'}), "(example_env, 'point_match_opts_tilespecs.json',\n test_data_root=TEST_DATA_ROOT)\n", (1151, 1234), False, 'from test_data import render_params,... |
import collections
import itertools
import logging
import operator
from typing import Any, Callable, DefaultDict, Dict, List, Optional, Sequence, Tuple, Union
import networkx as nx
import numpy as np
from cytoolz import itertoolz
from spacy.tokens import Span, Token
from . import utils as ke_utils
LOGGER = logging.g... | [
"logging.getLogger",
"numpy.tile",
"numpy.abs",
"networkx.pagerank_scipy",
"numpy.flatnonzero",
"networkx.Graph",
"cytoolz.itertoolz.sliding_window",
"numpy.diag",
"itertools.combinations",
"numpy.sum",
"numpy.dot",
"cytoolz.itertoolz.peek",
"collections.defaultdict",
"operator.itemgetter"... | [((311, 338), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (328, 338), False, 'import logging\n'), ((2597, 2618), 'cytoolz.itertoolz.peek', 'itertoolz.peek', (['terms'], {}), '(terms)\n', (2611, 2618), False, 'from cytoolz import itertoolz\n'), ((3063, 3073), 'networkx.Graph', 'nx.Graph... |
from functools import lru_cache
import datetime
from typing import Tuple, List, Optional
import sqlalchemy
from sqlalchemy import exc
import pandas as pd
def get_securities():
return pd.read_sql('securities', con=sqlalchemy.create_engine('sqlite:///../../data/jq.db'))
@lru_cache(maxsize=1)
def get_profit_forec... | [
"pandas.DataFrame",
"functools.lru_cache",
"sqlalchemy.create_engine",
"datetime.datetime.now"
] | [((279, 299), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(1)'}), '(maxsize=1)\n', (288, 299), False, 'from functools import lru_cache\n'), ((681, 701), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(1)'}), '(maxsize=1)\n', (690, 701), False, 'from functools import lru_cache\n'), ((1054, 1074), 'funct... |
"""Module containing the logic for the collection of data structure."""
import yaml
import json
import re
from functools import partial
from pprint import pprint
from dlapp.argumenthelper import validate_argument_type
from dlapp import utils
from dlapp.parser import SelectParser
from dlapp.validation import OpValidati... | [
"json.loads",
"dlapp.argumenthelper.validate_argument_type",
"re.escape",
"dlapp.parser.SelectParser",
"dlapp.utils.convert_wildcard_to_regex",
"re.match",
"yaml.load",
"functools.partial",
"re.finditer",
"json.load",
"pprint.pprint",
"re.search"
] | [((962, 1005), 're.match', 're.match', (['"""index(?P<index>_?[0-9]+)$"""', 'attr'], {}), "('index(?P<index>_?[0-9]+)$', attr)\n", (970, 1005), False, 'import re\n'), ((6399, 6461), 'dlapp.parser.SelectParser', 'SelectParser', (['select_statement'], {'on_exception': 'self.on_exception'}), '(select_statement, on_excepti... |
import sys
import os
sys.path.append(os.pardir)
from uuid import uuid4
from chatdollkit.models import (
AnimatedVoiceRequest,
ChatdollKitException,
Response,
TTSConfiguration,
VoiceSource,
ApiResponseBase
)
def test_add_voice():
req = AnimatedVoiceRequest()
req.AddVoice("voice_01")
... | [
"chatdollkit.models.TTSConfiguration",
"chatdollkit.models.ChatdollKitException",
"chatdollkit.models.Response",
"chatdollkit.models.AnimatedVoiceRequest",
"chatdollkit.models.ApiResponseBase.from_exception",
"sys.path.append"
] | [((21, 47), 'sys.path.append', 'sys.path.append', (['os.pardir'], {}), '(os.pardir)\n', (36, 47), False, 'import sys\n'), ((265, 287), 'chatdollkit.models.AnimatedVoiceRequest', 'AnimatedVoiceRequest', ([], {}), '()\n', (285, 287), False, 'from chatdollkit.models import AnimatedVoiceRequest, ChatdollKitException, Respo... |
# __init__.py
from os import pardir, path
import sys
dir_path = path.dirname( path.abspath(__file__) )
sys.path.append( dir_path )
from cgi_utils import *
from datatable_utils import *
from handover_execution import *
from handover_generation import *
from interval_utils import *
from parse_filters import *
from pars... | [
"os.path.abspath",
"sys.path.append"
] | [((104, 129), 'sys.path.append', 'sys.path.append', (['dir_path'], {}), '(dir_path)\n', (119, 129), False, 'import sys\n'), ((79, 101), 'os.path.abspath', 'path.abspath', (['__file__'], {}), '(__file__)\n', (91, 101), False, 'from os import pardir, path\n')] |
# Copyright (c) 2019 <NAME>.
# Uranium is released under the terms of the LGPLv3 or higher.
import threading
import time
from UM.Logger import Logger
from UM.Operations.Operation import Operation
from UM.Signal import Signal, signalemitter
from typing import List
## A stack of operations.
#
# This maintains the ... | [
"threading.Lock",
"time.time",
"UM.Signal.Signal"
] | [((4086, 4094), 'UM.Signal.Signal', 'Signal', ([], {}), '()\n', (4092, 4094), False, 'from UM.Signal import Signal, signalemitter\n'), ((642, 658), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (656, 658), False, 'import threading\n'), ((1865, 1876), 'time.time', 'time.time', ([], {}), '()\n', (1874, 1876), Fal... |
import json
from django import forms
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from rest_framework.exceptions import PermissionDenied
from rest_framework import status
from wagtail.core.fields import RichTextField
from wagtail.adm... | [
"django.contrib.auth.get_user_model",
"django.db.models.ForeignKey",
"django.forms.NumberInput",
"json.dumps",
"django.db.models.BooleanField",
"wagtail.core.fields.RichTextField",
"wagtail.admin.edit_handlers.FieldPanel",
"wagtail.admin.edit_handlers.InlinePanel",
"modelcluster.fields.ParentalKey",... | [((879, 956), 'modelcluster.fields.ParentalKey', 'ParentalKey', (['"""PollPage"""'], {'on_delete': 'models.CASCADE', 'related_name': '"""form_fields"""'}), "('PollPage', on_delete=models.CASCADE, related_name='form_fields')\n", (890, 956), False, 'from modelcluster.fields import ParentalKey\n'), ((975, 1050), 'django.d... |
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | [
"st2common.models.db.MongoDBAccess",
"st2common.models.db.stormbase.TagsMixin.get_indices",
"mongoengine.EmbeddedDocumentField",
"st2common.fields.ComplexDateTimeField",
"mongoengine.StringField"
] | [((2884, 2916), 'st2common.models.db.MongoDBAccess', 'MongoDBAccess', (['RuleEnforcementDB'], {}), '(RuleEnforcementDB)\n', (2897, 2916), False, 'from st2common.models.db import MongoDBAccess\n'), ((1089, 1164), 'mongoengine.StringField', 'me.StringField', ([], {'unique': '(False)', 'help_text': '"""Reference to rule."... |
"""
File: boggle.py
Name: 陳名娟 <NAME>
----------------------------------------
When user inputs 4*4 letters, the program will find all vocabularies.
"""
import time
# This is the file name of the dictionary txt file
# we will be checking if a word exists by searching through it
FILE = 'dictionary.txt'
# global variab... | [
"time.time"
] | [((443, 454), 'time.time', 'time.time', ([], {}), '()\n', (452, 454), False, 'import time\n'), ((1240, 1251), 'time.time', 'time.time', ([], {}), '()\n', (1249, 1251), False, 'import time\n')] |
# 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
# distributed under t... | [
"openstack.resource.URI",
"openstack.resource.Body"
] | [((958, 979), 'openstack.resource.Body', 'resource.Body', (['"""type"""'], {}), "('type')\n", (971, 979), False, 'from openstack import resource\n'), ((1025, 1056), 'openstack.resource.Body', 'resource.Body', (['"""used"""'], {'type': 'int'}), "('used', type=int)\n", (1038, 1056), False, 'from openstack import resource... |
"""
Python implementation of the LiNGAM algorithms.
The LiNGAM Project: https://sites.google.com/site/sshimizu06/lingam
"""
import itertools
import numbers
import warnings
import numpy as np
from sklearn.utils import check_array, resample
from .bootstrap import BootstrapResult
from .direct_lingam import DirectLiNGAM
... | [
"numpy.copy",
"numpy.abs",
"numpy.mean",
"numpy.reshape",
"numpy.argmax",
"numpy.array",
"sklearn.utils.resample",
"numpy.dot",
"sklearn.utils.check_array",
"numpy.std",
"warnings.warn",
"numpy.arange"
] | [((2618, 2645), 'numpy.arange', 'np.arange', (['self._n_features'], {}), '(self._n_features)\n', (2627, 2645), True, 'import numpy as np\n'), ((9286, 9303), 'numpy.array', 'np.array', (['X_list_'], {}), '(X_list_)\n', (9294, 9303), True, 'import numpy as np\n'), ((2680, 2690), 'numpy.copy', 'np.copy', (['X'], {}), '(X)... |
import requests
from requests_toolbelt import sessions
class UndersideApi(object):
session = sessions.BaseUrlSession(base_url='https://underside.tjcache.pw/api/v1/message/')
trans_table = str.maketrans('\u200e\u200b', '01')
encr_table = str.maketrans('01', '\u200e\u200b')
@staticmethod
def bin2as... | [
"requests_toolbelt.sessions.BaseUrlSession"
] | [((99, 184), 'requests_toolbelt.sessions.BaseUrlSession', 'sessions.BaseUrlSession', ([], {'base_url': '"""https://underside.tjcache.pw/api/v1/message/"""'}), "(base_url='https://underside.tjcache.pw/api/v1/message/'\n )\n", (122, 184), False, 'from requests_toolbelt import sessions\n')] |
try:
import logging
except ImportError:
class logging:
def debug(self, *args, **kwargs):
pass
def __assert_data_tuple(data, num):
"""Internal helper to ensure data is a tuple of given `num` length."""
if not isinstance(data, tuple):
data = (data,)
if not len(data) == nu... | [
"logging.error",
"logging.debug"
] | [((703, 744), 'logging.debug', 'logging.debug', (['""" out: value = %d"""', 'val'], {}), "(' out: value = %d', val)\n", (716, 744), False, 'import logging\n'), ((851, 892), 'logging.debug', 'logging.debug', (['""" in: value = %d"""', 'val'], {}), "(' in: value = %d', val)\n", (864, 892), False, 'import lo... |
#External libs
import boto3
import sys
import json
import os
import datetime
from botocore.exceptions import ClientError
#Get our config
import maestro.config.lambda_config as lambda_config
#This is only here for printing pretty colors
class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033... | [
"boto3.resource",
"json.dumps",
"boto3.client",
"json.loads"
] | [((527, 548), 'boto3.resource', 'boto3.resource', (['"""ec2"""'], {}), "('ec2')\n", (541, 548), False, 'import boto3\n'), ((558, 577), 'boto3.client', 'boto3.client', (['"""ec2"""'], {}), "('ec2')\n", (570, 577), False, 'import boto3\n'), ((884, 914), 'json.dumps', 'json.dumps', (['response'], {'indent': '(4)'}), '(res... |
import os
from pathlib import Path
from typing import Iterable
from .ext import Date
from .ext import make_weekday_calendar, parse_calendar, make_const_calendar
from .weekday import parse_weekdays
#-------------------------------------------------------------------------------
def load_calendar_file(path, ... | [
"pathlib.Path"
] | [((731, 741), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (735, 741), False, 'from pathlib import Path\n'), ((2029, 2039), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (2033, 2039), False, 'from pathlib import Path\n'), ((2681, 2695), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (2685, 269... |
import pybullet as p
def render(height, width, view_matrix, projection_matrix,
shadow=1, light_direction=[1, 1, 1],
renderer=p.ER_BULLET_HARDWARE_OPENGL):
# ER_BULLET_HARDWARE_OPENGL
img_tuple = p.getCameraImage(width,
height,
... | [
"pybullet.getCameraImage",
"pybullet.computeProjectionMatrixFOV",
"pybullet.computeViewMatrixFromYawPitchRoll"
] | [((228, 362), 'pybullet.getCameraImage', 'p.getCameraImage', (['width', 'height', 'view_matrix', 'projection_matrix'], {'shadow': 'shadow', 'lightDirection': 'light_direction', 'renderer': 'renderer'}), '(width, height, view_matrix, projection_matrix, shadow=\n shadow, lightDirection=light_direction, renderer=render... |
import datetime
import threading
from django.utils.html import escape as html_escape
from mongoengine import EmbeddedDocument
try:
from mongoengine.base import ValidationError
except ImportError:
from mongoengine.errors import ValidationError
from mongoengine.base.datastructures import BaseList
from mongoengi... | [
"crits.core.user_tools.user_sources",
"threading.Lock",
"crits.core.class_mapper.class_from_id",
"crits.core.user_tools.get_subscribed_users",
"crits.core.user.CRITsUser.objects",
"crits.notifications.processor.ChangeParser.get_changed_field_handler",
"datetime.datetime.now",
"crits.notifications.proc... | [((1465, 1479), 'crits.notifications.notification.Notification', 'Notification', ([], {}), '()\n', (1477, 1479), False, 'from crits.notifications.notification import Notification\n'), ((4488, 4502), 'crits.notifications.notification.Notification', 'Notification', ([], {}), '()\n', (4500, 4502), False, 'from crits.notif... |
from django.contrib import admin
from .models import TaskerSkill, BusinessPhoto, Timeslot, TaskerAvailability
admin.site.register(BusinessPhoto)
admin.site.register(Timeslot)
admin.site.register(TaskerSkill)
admin.site.register(TaskerAvailability)
# Register your models here.
| [
"django.contrib.admin.site.register"
] | [((111, 145), 'django.contrib.admin.site.register', 'admin.site.register', (['BusinessPhoto'], {}), '(BusinessPhoto)\n', (130, 145), False, 'from django.contrib import admin\n'), ((146, 175), 'django.contrib.admin.site.register', 'admin.site.register', (['Timeslot'], {}), '(Timeslot)\n', (165, 175), False, 'from django... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function, unicode_literals, with_statement
import argparse
import contextlib
import requests
import sys
import csv
import matplotlib
# Anti-Grain Geometry (AGG) backend so PyGeoIpMap can be used 'headless'
matplotlib.use('Agg')
import matplotlib.pyplot... | [
"argparse.FileType",
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"matplotlib.use",
"requests.get",
"mpl_toolkits.basemap.Basemap",
"contextlib.closing",
"pygeoip.GeoIP",
"csv.reader"
] | [((274, 295), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (288, 295), False, 'import matplotlib\n'), ((3340, 3389), 'matplotlib.pyplot.savefig', 'plt.savefig', (['output'], {'dpi': '(300)', 'bbox_inches': '"""tight"""'}), "(output, dpi=300, bbox_inches='tight')\n", (3351, 3389), True, 'import ... |
from typing import List, Union, Dict
from unittest import TestCase
from unittest.mock import ANY, patch, Mock
from parameterized import parameterized
from samcli.lib.cookiecutter.question import Question, QuestionKind, Choice, Confirm, Info, QuestionFactory
class TestQuestion(TestCase):
_ANY_TEXT = "any text"
... | [
"unittest.mock.Mock",
"parameterized.parameterized.expand",
"samcli.lib.cookiecutter.question.Confirm",
"samcli.lib.cookiecutter.question.QuestionFactory.create_question_from_json",
"samcli.lib.cookiecutter.question.Choice",
"samcli.lib.cookiecutter.question.Info",
"unittest.mock.patch",
"samcli.lib.c... | [((3001, 3048), 'unittest.mock.patch', 'patch', (['"""samcli.lib.cookiecutter.question.click"""'], {}), "('samcli.lib.cookiecutter.question.click')\n", (3006, 3048), False, 'from unittest.mock import ANY, patch, Mock\n'), ((3352, 3399), 'unittest.mock.patch', 'patch', (['"""samcli.lib.cookiecutter.question.click"""'], ... |
"""
This file contains the solution to the problem
2.8.4 of the book `Nonlinear Dynamics and Chaos` by <NAME>.
"""
import numpy as np
import matplotlib.pyplot as plt
def exact_solution(t, x0=1.0):
"""
The implementation of the exact solution to the differential equation
x' = -x
with the initial condit... | [
"numpy.abs",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.log",
"matplotlib.pyplot.minorticks_on",
"numpy.exp",
"numpy.array",
"numpy.linspace",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.title",
"matplotlib.pypl... | [((3112, 3134), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(100)'], {}), '(0, 1, 100)\n', (3123, 3134), True, 'import numpy as np\n'), ((3178, 3220), 'matplotlib.pyplot.plot', 'plt.plot', (['exact_time', 'exact'], {'label': '"""exact"""'}), "(exact_time, exact, label='exact')\n", (3186, 3220), True, 'import matp... |
# -*- coding: utf-8 -*-
"""
Testing class for field-optiongroup endpoints of the Castor EDC API Wrapper.
Link: https://data.castoredc.com/api#/field-optiongroup
@author: <NAME>
https://orcid.org/0000-0003-3052-596X
"""
import pytest
from tests.test_api_endpoints.data_models import field_opt_model
from exceptions.exce... | [
"pytest.fixture",
"pytest.raises",
"tests.test_api_endpoints.data_models.field_opt_model.keys"
] | [((397, 419), 'tests.test_api_endpoints.data_models.field_opt_model.keys', 'field_opt_model.keys', ([], {}), '()\n', (417, 419), False, 'from tests.test_api_endpoints.data_models import field_opt_model\n'), ((1606, 1635), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (1620, 16... |
from django.conf.urls import url
from . import constants, views # isort:skip
urlpatterns = [
url(
r'^create-alias/$',
views.create_alias_view,
name=constants.CREATE_ALIAS_URL_NAME,
),
url(
r'^aliases/$',
views.CategoryListView.as_view(),
name=constants.CA... | [
"django.conf.urls.url"
] | [((102, 192), 'django.conf.urls.url', 'url', (['"""^create-alias/$"""', 'views.create_alias_view'], {'name': 'constants.CREATE_ALIAS_URL_NAME'}), "('^create-alias/$', views.create_alias_view, name=constants.\n CREATE_ALIAS_URL_NAME)\n", (105, 192), False, 'from django.conf.urls import url\n'), ((507, 609), 'django.c... |
import os
import time
import IPython
import numpy as np
import scipy.stats as st
from sklearn.metrics import confusion_matrix
import gym
import torch
import torch.nn.functional as F
from torch.autograd import Variable
def get_action(actions, env):
if type(env.action_space) is gym.spaces.Discrete:
# Get ... | [
"numpy.mean",
"torch.manual_seed",
"numpy.prod",
"torch.nn.functional.nll_loss",
"os.path.join",
"scipy.stats.norm.interval",
"torch.from_numpy",
"numpy.random.randint",
"scipy.stats.sem",
"torch.autograd.Variable",
"torch.zeros",
"sklearn.metrics.confusion_matrix"
] | [((4493, 4509), 'numpy.mean', 'np.mean', (['returns'], {}), '(returns)\n', (4500, 4509), True, 'import numpy as np\n'), ((4535, 4550), 'scipy.stats.sem', 'st.sem', (['returns'], {}), '(returns)\n', (4541, 4550), True, 'import scipy.stats as st\n'), ((8138, 8176), 'sklearn.metrics.confusion_matrix', 'confusion_matrix', ... |
import jax.numpy as jnp
from jax import jit
from jax import nn
__EPS__ = 1e-12
@jit
def predict_proba(params, teamA_rating, teamB_rating, has_tie):
dr = (teamA_rating - teamB_rating + params["homeAdv"]) * params["beta"]
gamma = nn.relu(params["gamma"]) * has_tie
pA = jnp.clip(nn.sigmoid(dr - gamma), __EPS... | [
"jax.numpy.log",
"jax.numpy.array",
"jax.numpy.maximum",
"jax.nn.relu",
"jax.nn.sigmoid"
] | [((453, 477), 'jax.numpy.maximum', 'jnp.maximum', (['pD', '__EPS__'], {}), '(pD, __EPS__)\n', (464, 477), True, 'import jax.numpy as jnp\n'), ((238, 262), 'jax.nn.relu', 'nn.relu', (["params['gamma']"], {}), "(params['gamma'])\n", (245, 262), False, 'from jax import nn\n'), ((291, 313), 'jax.nn.sigmoid', 'nn.sigmoid', ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from loss.dice_loss import DiceLoss
from loss.cross_entropy import CrossentropyLoss, TopKLoss
class BCEPlusDice(nn.Module):
"""Dice loss, need one hot encode input
Args:
weight: An array of shape [num_classes,]
ignore_index: c... | [
"torch.nn.BCEWithLogitsLoss",
"loss.dice_loss.DiceLoss",
"loss.cross_entropy.CrossentropyLoss",
"loss.cross_entropy.TopKLoss"
] | [((931, 1006), 'loss.dice_loss.DiceLoss', 'DiceLoss', ([], {'weight': 'self.weight', 'ignore_index': 'self.ignore_index'}), '(weight=self.weight, ignore_index=self.ignore_index, **self.kwargs)\n', (939, 1006), False, 'from loss.dice_loss import DiceLoss\n'), ((1067, 1100), 'torch.nn.BCEWithLogitsLoss', 'nn.BCEWithLogit... |
from notify.models import Notification
from rest_framework import serializers
from core.serializers import DynamicModelSerializer
from users.models.custom_user import CustomUser
from users.serializers.user_serializers import AuthorStampSerializer
class NotificationSerializer(DynamicModelSerializer):
class Meta:... | [
"users.models.custom_user.CustomUser.objects.get",
"users.serializers.user_serializers.AuthorStampSerializer"
] | [((476, 527), 'users.models.custom_user.CustomUser.objects.get', 'CustomUser.objects.get', ([], {'pk': 'instance.actor_object_id'}), '(pk=instance.actor_object_id)\n', (498, 527), False, 'from users.models.custom_user import CustomUser\n'), ((606, 634), 'users.serializers.user_serializers.AuthorStampSerializer', 'Autho... |
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import namedtuple
import torch
import torch.nn.functional as F
from tests import utils
class SimpleConvTranspose2dModule(torch.nn.Module):
def __init__(self, stride=1, padding=0, output_padding=0, dilation=1, gro... | [
"torch.nn.functional.conv_transpose2d",
"tests.utils.compare_tracing_methods",
"torch.randn",
"torch.nn.functional.relu"
] | [((631, 808), 'torch.nn.functional.conv_transpose2d', 'F.conv_transpose2d', (['inputs', 'filters'], {'bias': 'bias', 'stride': 'self.stride', 'padding': 'self.padding', 'output_padding': 'self.output_padding', 'groups': 'self.groups', 'dilation': 'self.dilation'}), '(inputs, filters, bias=bias, stride=self.stride, padd... |
import os
import sys
from pathlib import Path
def replace_file_extension(input_file):
"""
read {train/val/test/trainval}.txt file (downloaded from https://github.com/fxia22/pointnet.pytorch/issues/52#issuecomment-561013797)
These files contain list of .ply models. ModelNet40 dataset now contains .off file... | [
"os.path.join",
"pathlib.Path"
] | [((503, 519), 'pathlib.Path', 'Path', (['input_file'], {}), '(input_file)\n', (507, 519), False, 'from pathlib import Path\n'), ((1106, 1147), 'os.path.join', 'os.path.join', (['dataset_folder', '"""train.txt"""'], {}), "(dataset_folder, 'train.txt')\n", (1118, 1147), False, 'import os\n'), ((1176, 1215), 'os.path.join... |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | [
"unittest.main",
"numpy.array",
"numpy.fromstring"
] | [((8409, 8424), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8422, 8424), False, 'import unittest\n'), ((1325, 1354), 'numpy.fromstring', 'np.fromstring', (['s'], {'dtype': '"""|S1"""'}), "(s, dtype='|S1')\n", (1338, 1354), True, 'import numpy as np\n'), ((1378, 1410), 'numpy.fromstring', 'np.fromstring', (['s'... |
import copy
import logging
import dask
import numpy as np
import xarray as xr
from numcodecs.compat import ensure_ndarray
from xarray.backends.zarr import (
DIMENSION_KEY,
encode_zarr_attr_value,
encode_zarr_variable,
extract_zarr_variable_encoding,
)
from zarr.meta import encode_fill_value
from zarr.s... | [
"logging.getLogger",
"zarr.meta.encode_fill_value",
"xarray.backends.zarr.encode_zarr_attr_value",
"numpy.asarray",
"numcodecs.compat.ensure_ndarray",
"numpy.empty_like",
"zarr.util.normalize_shape",
"xarray.backends.zarr.encode_zarr_variable",
"copy.deepcopy",
"xarray.backends.zarr.extract_zarr_v... | [((599, 623), 'logging.getLogger', 'logging.getLogger', (['"""api"""'], {}), "('api')\n", (616, 623), False, 'import logging\n'), ((1529, 1565), 'zarr.meta.encode_fill_value', 'encode_fill_value', (['fill_value', 'dtype'], {}), '(fill_value, dtype)\n', (1546, 1565), False, 'from zarr.meta import encode_fill_value\n'), ... |
# Copyright 2018 DeepMind Technologies Limited. All rights reserved.
#
# 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 ... | [
"acme.agents.jax.actors.GenericActor",
"acme.datasets.reverb.make_reverb_dataset",
"optax.adam",
"reverb.selectors.Fifo",
"acme.adders.reverb.NStepTransitionAdder.signature",
"acme.jax.variable_utils.VariableClient",
"acme.adders.reverb.NStepTransitionAdder",
"acme.agents.jax.dqn.actor.alternating_eps... | [((3171, 3235), 'acme.jax.variable_utils.VariableClient', 'variable_utils.VariableClient', (['variable_source', '""""""'], {'device': '"""cpu"""'}), "(variable_source, '', device='cpu')\n", (3200, 3235), False, 'from acme.jax import variable_utils\n'), ((3402, 3478), 'acme.agents.jax.dqn.actor.alternating_epsilons_acto... |
import requests
response = requests.get('https://www.dropbox.com/s/3tlfdh7ws54dum3/user.json?dl=0 ')
print(response.text) | [
"requests.get"
] | [((28, 103), 'requests.get', 'requests.get', (['"""https://www.dropbox.com/s/3tlfdh7ws54dum3/user.json?dl=0 """'], {}), "('https://www.dropbox.com/s/3tlfdh7ws54dum3/user.json?dl=0 ')\n", (40, 103), False, 'import requests\n')] |
import numpy as np
import dynet as dy
from xnmt import logger
import xnmt.batcher
from xnmt.events import register_xnmt_handler, handle_xnmt_event
from xnmt.expression_sequence import ExpressionSequence, LazyNumpyExpressionSequence
from xnmt.linear import Linear
from xnmt.param_collection import ParamManager
from xnmt... | [
"dynet.parameter",
"xnmt.param_collection.ParamManager.my_params",
"numpy.sqrt",
"dynet.affine_transform",
"xnmt.logger.info",
"xnmt.persistence.bare",
"dynet.zeros",
"numpy.zeros",
"numpy.random.uniform",
"numpy.empty",
"dynet.pick_batch",
"dynet.pick",
"xnmt.persistence.Ref",
"dynet.l2_n... | [((6731, 6766), 'xnmt.persistence.Ref', 'Ref', (['"""exp_global.default_layer_dim"""'], {}), "('exp_global.default_layer_dim')\n", (6734, 6766), False, 'from xnmt.persistence import serializable_init, Serializable, Ref, Path, bare\n'), ((6796, 6839), 'xnmt.persistence.Ref', 'Ref', (['"""exp_global.weight_noise"""'], {'... |
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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 a... | [
"collections.deque",
"asyncio.sleep",
"importlib.import_module",
"asyncio.Event",
"sys.exc_info",
"collections.defaultdict",
"asyncio.wait_for",
"asyncio.gather",
"functools.lru_cache",
"time.time",
"asyncio.get_running_loop",
"asyncio.create_task"
] | [((7162, 7185), 'functools.lru_cache', 'functools.lru_cache', (['(30)'], {}), '(30)\n', (7181, 7185), False, 'import functools\n'), ((2779, 2794), 'asyncio.Event', 'asyncio.Event', ([], {}), '()\n', (2792, 2794), False, 'import asyncio\n'), ((5331, 5338), 'collections.deque', 'deque', ([], {}), '()\n', (5336, 5338), Fa... |
import ctypes as ct
import numpy as np
import scipy.io as scio
import matplotlib.pyplot as plt
# Init ctypes types
DOUBLE = ct.c_double
PtrDOUBLE = ct.POINTER(DOUBLE)
PtrPtrDOUBLE = ct.POINTER(PtrDOUBLE)
PtrPtrPtrDOUBLE = ct.POINTER(PtrPtrDOUBLE)
class TestStruct(ct.Structure):
_fields_ = [
("Sca... | [
"matplotlib.pyplot.imshow",
"ctypes.byref",
"ctypes.POINTER",
"scipy.io.savemat",
"scipy.io.loadmat",
"numpy.zeros",
"matplotlib.pyplot.figure",
"ctypes.CDLL",
"matplotlib.pyplot.show"
] | [((149, 167), 'ctypes.POINTER', 'ct.POINTER', (['DOUBLE'], {}), '(DOUBLE)\n', (159, 167), True, 'import ctypes as ct\n'), ((183, 204), 'ctypes.POINTER', 'ct.POINTER', (['PtrDOUBLE'], {}), '(PtrDOUBLE)\n', (193, 204), True, 'import ctypes as ct\n'), ((223, 247), 'ctypes.POINTER', 'ct.POINTER', (['PtrPtrDOUBLE'], {}), '(... |
import pygame
from .base_screen import BaseScreen
from ..graphic_utils import ScreenObjectsManager, TouchAndTextItem
from ..input import InputManager
class Keyboard(BaseScreen):
def __init__(self, size, base_size, manager, fonts, listener):
BaseScreen.__init__(self, size, base_size, manager, fonts)
... | [
"pygame.font.SysFont"
] | [((570, 612), 'pygame.font.SysFont', 'pygame.font.SysFont', (['"""arial"""', '(size[1] // 6)'], {}), "('arial', size[1] // 6)\n", (589, 612), False, 'import pygame\n')] |
import os
import time
import pymysql
try:
DBHOST = os.environ['DBHOST']
DBUSER = os.environ['DBUSER']
DBPASSWD = os.environ['DBPASSWD']
DATABASE = os.environ['DATABASE']
except KeyError:
DBHOST, DBUSER, DBPASSWD, DATABASE = None, None, None, None
class DatabaseError(Exception):
pass
class ... | [
"pymysql.connect",
"time.sleep"
] | [((522, 636), 'pymysql.connect', 'pymysql.connect', ([], {'user': 'username', 'password': 'password', 'host': 'server', 'database': 'database', 'port': 'port', 'charset': 'charset'}), '(user=username, password=password, host=server, database=\n database, port=port, charset=charset)\n', (537, 636), False, 'import pym... |
from selenium.webdriver.common.keys import Keys
import time
#Helper function for Selenium
# Scroll to end of page
def scrollToBottomOfPage(driver, maxScrollAttempt: int, scrollPauseTime = 2):
# Get scroll height
last_height = driver.execute_script("return document.body.scrollHeight")
elm = driver.find_el... | [
"time.sleep"
] | [((535, 562), 'time.sleep', 'time.sleep', (['scrollPauseTime'], {}), '(scrollPauseTime)\n', (545, 562), False, 'import time\n'), ((652, 665), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (662, 665), False, 'import time\n'), ((706, 719), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (716, 719), False, 'impo... |
# 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
# distributed under t... | [
"openstack.network.v2.network.DHCPAgentHostingNetwork",
"openstack.network.v2.network.Network"
] | [((1491, 1508), 'openstack.network.v2.network.Network', 'network.Network', ([], {}), '()\n', (1506, 1508), False, 'from openstack.network.v2 import network\n'), ((1982, 2008), 'openstack.network.v2.network.Network', 'network.Network', ([], {}), '(**EXAMPLE)\n', (1997, 2008), False, 'from openstack.network.v2 import net... |
import sys
from .account import Account, Identity
from .attachments import FileAttachment, ItemAttachment
from .autodiscover import discover
from .configuration import Configuration
from .credentials import DELEGATE, IMPERSONATION, Credentials, OAuth2Credentials, \
OAuth2AuthorizationCodeCredentials
from .ewsdatet... | [
"backports.datetime_fromisoformat.MonkeyPatch.patch_fromisoformat"
] | [((2355, 2388), 'backports.datetime_fromisoformat.MonkeyPatch.patch_fromisoformat', 'MonkeyPatch.patch_fromisoformat', ([], {}), '()\n', (2386, 2388), False, 'from backports.datetime_fromisoformat import MonkeyPatch\n')] |
import argparse
import cv2
import numpy as np
import torch.nn.functional as F
from torchvision.transforms.functional import normalize
from facexlib.matting import init_matting_model
from facexlib.utils import img2tensor
def main(args):
modnet = init_matting_model()
# read image
img = cv2.imread(args.img... | [
"numpy.repeat",
"argparse.ArgumentParser",
"facexlib.utils.img2tensor",
"torch.nn.functional.interpolate",
"numpy.full",
"torchvision.transforms.functional.normalize",
"facexlib.matting.init_matting_model",
"cv2.imread"
] | [((252, 272), 'facexlib.matting.init_matting_model', 'init_matting_model', ([], {}), '()\n', (270, 272), False, 'from facexlib.matting import init_matting_model\n'), ((560, 603), 'facexlib.utils.img2tensor', 'img2tensor', (['img'], {'bgr2rgb': '(True)', 'float32': '(True)'}), '(img, bgr2rgb=True, float32=True)\n', (570... |
# Image-based testing borrowed from vispy
"""
Procedure for unit-testing with images:
1. Run unit tests at least once; this initializes a git clone of
pyqtgraph/test-data in ~/.pyqtgraph.
2. Run individual test scripts with the PYQTGRAPH_AUDIT environment variable set:
$ PYQTGRAPH_AUDIT=1 python pyqtgraph... | [
"numpy.clip",
"base64.b64encode",
"time.sleep",
"numpy.array",
"sys.exc_info",
"httplib.HTTPConnection",
"subprocess.Popen",
"subprocess.CalledProcessError",
"os.path.split",
"os.path.isdir",
"numpy.empty",
"os.path.expanduser",
"numpy.round",
"numpy.abs",
"subprocess.check_call",
"os.... | [((3948, 3993), 'os.path.join', 'os.path.join', (['dataPath', "(standardFile + '.png')"], {}), "(dataPath, standardFile + '.png')\n", (3960, 3993), False, 'import os\n'), ((8885, 8916), 'numpy.empty', 'np.empty', (['shape'], {'dtype': 'np.ubyte'}), '(shape, dtype=np.ubyte)\n', (8893, 8916), True, 'import numpy as np\n'... |
from os import path, sys
# Good overview of what is going on here:
# https://stackoverflow.com/questions/11536764/how-to-fix-attempted-relative-import-in-non-package-even-with-init-py
# Once we have a stable package name for core, it should be easier to do away with something like this
# for now we add the core compon... | [
"os.path.abspath",
"os.sys.path.append"
] | [((585, 615), 'os.sys.path.append', 'sys.path.append', (['component_dir'], {}), '(component_dir)\n', (600, 615), False, 'from os import path, sys\n'), ((434, 456), 'os.path.abspath', 'path.abspath', (['__file__'], {}), '(__file__)\n', (446, 456), False, 'from os import path, sys\n')] |
"""Setup for the decore package."""
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import versioneer
README_RST = ''
with open('README.rst') as f:
README_RST = f.read()
INSTALL_REQUIRES = []
TEST_REQUIRES = [
'pytest>=4.6', 'coverage', 'pytest-cov==2.5.1',
]
... | [
"versioneer.get_cmdclass",
"versioneer.get_version"
] | [((515, 539), 'versioneer.get_version', 'versioneer.get_version', ([], {}), '()\n', (537, 539), False, 'import versioneer\n'), ((554, 579), 'versioneer.get_cmdclass', 'versioneer.get_cmdclass', ([], {}), '()\n', (577, 579), False, 'import versioneer\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from pathlib import Path
from unittest import TestCase
from funity import FUnityEditor, UnityProject
class FUnityEditorTestCase(TestCase):
def test_set_serialization_mode(self):
editor = FUnityEditor(str(FUnityEditor.find_all()[0]))
self.assertIs... | [
"funity.FUnityEditor.find_all",
"pathlib.Path"
] | [((359, 373), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (363, 373), False, 'from pathlib import Path\n'), ((269, 292), 'funity.FUnityEditor.find_all', 'FUnityEditor.find_all', ([], {}), '()\n', (290, 292), False, 'from funity import FUnityEditor, UnityProject\n')] |
import torch
from torch import nn
import torch.nn.functional as F
class LabelSmoothingCrossEntropy(nn.Module):
"""
NLL loss with label smoothing.
"""
def __init__(self, smoothing=0.1):
"""
Constructor for the LabelSmoothing module.
:param smoothing: label smoothing factor
... | [
"torch.sort",
"torch.nn.functional.log_softmax"
] | [((547, 571), 'torch.nn.functional.log_softmax', 'F.log_softmax', (['x'], {'dim': '(-1)'}), '(x, dim=-1)\n', (560, 571), True, 'import torch.nn.functional as F\n'), ((1434, 1467), 'torch.sort', 'torch.sort', (['loss'], {'descending': '(True)'}), '(loss, descending=True)\n', (1444, 1467), False, 'import torch\n')] |
import pyz3r
from alttprbot.alttprgen.preset import fetch_preset, SMZ3_ENVIRONMENTS
from alttprbot.exceptions import SahasrahBotException
class PresetNotFoundException(SahasrahBotException):
pass
async def generate_multiworld(preset, players, tournament=False, randomizer='smz3', seed_number=None):
preset_dic... | [
"alttprbot.alttprgen.preset.fetch_preset"
] | [((330, 373), 'alttprbot.alttprgen.preset.fetch_preset', 'fetch_preset', (['preset'], {'randomizer': 'randomizer'}), '(preset, randomizer=randomizer)\n', (342, 373), False, 'from alttprbot.alttprgen.preset import fetch_preset, SMZ3_ENVIRONMENTS\n')] |