code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pytest
from dbt.tests.adapter.basic.test_adapter_methods import BaseAdapterMethod
from dbt.tests.adapter.basic.test_base import BaseSimpleMaterializations
from dbt.tests.adapter.basic.test_singular_tests import BaseSingularTests
from dbt.tests.adapter.basic.test_singular_tests_ephemeral import BaseSingularTests... | [
"pytest.mark.xfail"
] | [((1243, 1306), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'reason': '"""Snapshot not supported in dbt-trino"""'}), "(reason='Snapshot not supported in dbt-trino')\n", (1260, 1306), False, 'import pytest\n'), ((1376, 1439), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'reason': '"""Snapshot not supported in dbt... |
"""
author: deadc0de6 (https://github.com/deadc0de6)
Copyright (c) 2017, deadc0de6
basic unittest for the import function
"""
import unittest
import os
import yaml
from dotdrop.dotdrop import importer
from tests.helpers import *
class TestImport(unittest.TestCase):
CONFIG_BACKUP = False
CONFIG_CREATE = T... | [
"unittest.main",
"os.mkdir",
"yaml.load",
"os.path.join",
"os.path.exists",
"dotdrop.dotdrop.importer",
"os.path.expanduser"
] | [((5039, 5054), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5052, 5054), False, 'import unittest\n'), ((786, 809), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (804, 809), False, 'import os\n'), ((3562, 3590), 'dotdrop.dotdrop.importer', 'importer', (['opts', 'conf', 'dfiles'], {})... |
import os
import sys
os.environ["OMP_NUM_THREADS"] = "1"
import tensorflow as tf
import numpy as np
import time
n = 8192
dtype = tf.float32
with tf.device("/gpu:0"):
matrix1 = tf.Variable(tf.ones((n, n), dtype=dtype))
matrix2 = tf.Variable(tf.ones((n, n), dtype=dtype))
product = tf.matmul(matrix1, matrix... | [
"tensorflow.ones",
"tensorflow.global_variables_initializer",
"tensorflow.device",
"tensorflow.Session",
"numpy.ones",
"tensorflow.OptimizerOptions",
"time.time",
"tensorflow.matmul",
"numpy.matmul"
] | [((500, 525), 'tensorflow.Session', 'tf.Session', ([], {'config': 'config'}), '(config=config)\n', (510, 525), True, 'import tensorflow as tf\n'), ((626, 637), 'time.time', 'time.time', ([], {}), '()\n', (635, 637), False, 'import time\n'), ((690, 701), 'time.time', 'time.time', ([], {}), '()\n', (699, 701), False, 'im... |
from functools import singledispatch
from typing import Collection, Hashable
import numpy
import pandas
import xarray
from .proper_unstack import proper_unstack
@singledispatch
def cast(obj, brief_dims: Collection[Hashable]):
"""Helper function of :func:`recursive_diff`.
Cast objects into simpler object ty... | [
"pandas.RangeIndex",
"xarray.DataArray"
] | [((2203, 2224), 'xarray.DataArray', 'xarray.DataArray', (['obj'], {}), '(obj)\n', (2219, 2224), False, 'import xarray\n'), ((2261, 2284), 'pandas.RangeIndex', 'pandas.RangeIndex', (['size'], {}), '(size)\n', (2278, 2284), False, 'import pandas\n'), ((6651, 6672), 'xarray.DataArray', 'xarray.DataArray', (['obj'], {}), '... |
# Modulos
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
np.set_printoptions(suppress=True)
# Declaracion de clases
class Adeline:
def __init__(self, r, landa, training_type, iter):
self.iter = iter
self.training_type = train... | [
"numpy.random.uniform",
"numpy.set_printoptions",
"sklearn.model_selection.train_test_split",
"numpy.zeros",
"numpy.transpose",
"numpy.array",
"numpy.exp",
"sklearn.metrics.mean_squared_error"
] | [((129, 163), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)'}), '(suppress=True)\n', (148, 163), True, 'import numpy as np\n'), ((1979, 2002), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)'], {}), '(0, 1)\n', (1996, 2002), True, 'import numpy as np\n'), ((2304, 2317), 'numpy.ar... |
import serial.tools.list_ports
import serial
import sys
import glob
class SerialPorts():
def __init__(self, include_links = True):
# Items are returned in no particular order. It may make sense to sort the items.
# Also note that the reported strings are different across platforms and operating sy... | [
"serial.Serial",
"sys.platform.startswith",
"serial.tools.list_ports.comports",
"glob.glob"
] | [((384, 445), 'serial.tools.list_ports.comports', 'serial.tools.list_ports.comports', ([], {'include_links': 'include_links'}), '(include_links=include_links)\n', (416, 445), False, 'import serial\n'), ((1182, 1212), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (1205, 1212), F... |
# -*- coding: utf-8 -*-
import pandas as pd
# Read in track metadata with genre labels
tracks = pd.read_csv('datasets/fma-rock-vs-hiphop.csv')
# Read in track metrics with the features
echonest_metrics = pd.read_json('datasets/echonest-metrics.json', precise_float=True)
# Merge the relevant columns of tracks and ec... | [
"sklearn.preprocessing.StandardScaler",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.model_selection.cross_val_score",
"pandas.read_json",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.metrics.classification_report",
"numpy.cumsum",
"sklearn.linear_model.LogisticRegressi... | [((98, 144), 'pandas.read_csv', 'pd.read_csv', (['"""datasets/fma-rock-vs-hiphop.csv"""'], {}), "('datasets/fma-rock-vs-hiphop.csv')\n", (109, 144), True, 'import pandas as pd\n'), ((207, 273), 'pandas.read_json', 'pd.read_json', (['"""datasets/echonest-metrics.json"""'], {'precise_float': '(True)'}), "('datasets/echon... |
import KratosMultiphysics as KM
import KratosMultiphysics.KratosUnittest as KratosUnittest
from KratosMultiphysics.CoSimulationApplication.coupling_interface_data import CouplingInterfaceData
from KratosMultiphysics.CoSimulationApplication.factories import coupling_operation_factory
from testing_utilities import Dummy... | [
"KratosMultiphysics.CoSimulationApplication.factories.coupling_operation_factory.CreateCouplingOperation",
"math.sqrt",
"KratosMultiphysics.KratosUnittest.main",
"KratosMultiphysics.Model",
"KratosMultiphysics.ProcessInfo",
"testing_utilities.DummySolverWrapper",
"KratosMultiphysics.Parameters",
"Krat... | [((5340, 5361), 'KratosMultiphysics.KratosUnittest.main', 'KratosUnittest.main', ([], {}), '()\n', (5359, 5361), True, 'import KratosMultiphysics.KratosUnittest as KratosUnittest\n'), ((458, 468), 'KratosMultiphysics.Model', 'KM.Model', ([], {}), '()\n', (466, 468), True, 'import KratosMultiphysics as KM\n'), ((892, 10... |
"""This is to be executed after there are some data within ./data/memory/."""
import os
import nn.CattleV2 as Cattle
import nnutils
import matplotlib.pyplot as plt
import pylab
import pickle
import sys
# os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
name = 'G2'
CATTLE = cattle = Cattle.Cattle((nnutils.input_size,), nnut... | [
"os.remove",
"nn.CattleV2.Cattle",
"os.path.isfile",
"os.path.join",
"os.listdir"
] | [((279, 342), 'nn.CattleV2.Cattle', 'Cattle.Cattle', (['(nnutils.input_size,)', 'nnutils.output_size', 'name'], {}), '((nnutils.input_size,), nnutils.output_size, name)\n', (292, 342), True, 'import nn.CattleV2 as Cattle\n'), ((516, 554), 'os.path.isfile', 'os.path.isfile', (["(dir + 'loss_historyv2')"], {}), "(dir + '... |
import json
import re
import subprocess as s
import os
from pathlib import Path
from time import sleep as zzz
from colorama import Fore, Style
# print ascii art logo
def welcome():
print(f"{Fore.MAGENTA} ")
print(r"""
_____ _____ _____ _ _
| __ \_ _/ ____| | | | |
| |_... | [
"json.dump",
"pathlib.Path",
"os.scandir",
"time.sleep"
] | [((798, 804), 'time.sleep', 'zzz', (['(5)'], {}), '(5)\n', (801, 804), True, 'from time import sleep as zzz\n'), ((885, 901), 'os.scandir', 'os.scandir', (['path'], {}), '(path)\n', (895, 901), False, 'import os\n'), ((1704, 1718), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (1708, 1718), False, 'from p... |
# The following source code was originally obtained from:
# https://github.com/keras-team/keras/blob/r2.6/keras/layers/preprocessing/normalization.py#L27-L282
# https://github.com/keras-team/keras/blob/r2.6/keras/layers/core.py#L55-L119
# ==============================================================================
#... | [
"tensorflow.compat.v2.convert_to_tensor",
"tensorflow.compat.v2.math.is_finite",
"tensorflow.compat.v2.cast",
"tensorflow.compat.v2.TensorShape"
] | [((1632, 1659), 'tensorflow.compat.v2.TensorShape', 'tf.TensorShape', (['input_shape'], {}), '(input_shape)\n', (1646, 1659), True, 'import tensorflow.compat.v2 as tf\n'), ((2128, 2153), 'tensorflow.compat.v2.math.is_finite', 'tf.math.is_finite', (['inputs'], {}), '(inputs)\n', (2145, 2153), True, 'import tensorflow.co... |
import os.path
from os import listdir
from typing import List
class FileInfo:
def __init__(
self,
filename: str,
schema: str,
dialect: str,
version: int,
api_level: int,
) -> None:
self.filename = filename
self.schema = schema
self.dialec... | [
"os.listdir"
] | [((1043, 1061), 'os.listdir', 'listdir', (['directory'], {}), '(directory)\n', (1050, 1061), False, 'from os import listdir\n')] |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from data_worker.data_worker import combine_batches, split_into_batches, \
unpickle, unpack_data, display_img
from torch_lib.Interface import Interface
from torch_lib.Nets import MediumNet
from torch_lib.data_worker import suit4p... | [
"data_worker.data_worker.unpack_data",
"numpy.argmax",
"data_worker.data_worker.unpickle",
"data_worker.data_worker.combine_batches",
"torch_lib.Interface.Interface",
"torch_lib.data_worker.suit4pytorch",
"torch_lib.Nets.MediumNet",
"data_worker.data_worker.split_into_batches"
] | [((833, 866), 'data_worker.data_worker.combine_batches', 'combine_batches', (['unpacked_batches'], {}), '(unpacked_batches)\n', (848, 866), False, 'from data_worker.data_worker import combine_batches, split_into_batches, unpickle, unpack_data, display_img\n'), ((911, 938), 'data_worker.data_worker.split_into_batches', ... |
from inspect import currentframe, getframeinfo
print(getframeinfo(currentframe()).lineno)
import pycuda.driver as drv
print(getframeinfo(currentframe()).lineno)
import pycuda.tools
print(getframeinfo(currentframe()).lineno)
#import pycuda.autoinit
print(getframeinfo(currentframe()).lineno)
from pycuda.compiler import S... | [
"pycuda.compiler.SourceModule",
"pycuda.driver.In",
"inspect.currentframe",
"pycuda.driver.Out",
"pycuda.driver.init"
] | [((437, 447), 'pycuda.driver.init', 'drv.init', ([], {}), '()\n', (445, 447), True, 'import pycuda.driver as drv\n'), ((597, 749), 'pycuda.compiler.SourceModule', 'SourceModule', (['"""\n__global__ void multiply_them(float *dest, float *a, float *b)\n{\n const int i = threadIdx.x;\n dest[i] = a[i] * b[i];\n}\n"""'], ... |
#!/usr/bin/env python
#
# test_inject_config.py - test cases for the COTInjectConfig class
#
# December 2014, <NAME>
# Copyright (c) 2013-2017 the COT project developers.
# See the COPYRIGHT.txt file at the top-level directory of this distribution
# and at https://github.com/glennmatthews/cot/blob/master/COPYRIGHT.txt.... | [
"mock.patch.object",
"COT.disks.DiskRepresentation.from_file",
"COT.ui.UI",
"shutil.copy",
"re.search",
"logging.getLogger"
] | [((1275, 1302), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1292, 1302), False, 'import logging\n'), ((18174, 18212), 'shutil.copy', 'shutil.copy', (['self.input_ovf', 'extra_dir'], {}), '(self.input_ovf, extra_dir)\n', (18185, 18212), False, 'import shutil\n'), ((18221, 18261), 'shut... |
'''
<NAME> 2012-2013
<<EMAIL>>
'''
import numpy as np
import scipy.io as sio
def create_icosahedron(height=1.,payloadR=0.3):
'''
Creates a tensegrity icosahedron
'''
#create points
points = np.zeros((3,2*6+2))
phi = (1+np.sqrt(5))*0.5
offest = 0.792
points[:,0] = (-phi,0,1*offest)
... | [
"numpy.eye",
"numpy.zeros",
"numpy.sqrt"
] | [((214, 238), 'numpy.zeros', 'np.zeros', (['(3, 2 * 6 + 2)'], {}), '((3, 2 * 6 + 2))\n', (222, 238), True, 'import numpy as np\n'), ((1188, 1216), 'numpy.zeros', 'np.zeros', (['(6 + 1, 6 * 2 + 2)'], {}), '((6 + 1, 6 * 2 + 2))\n', (1196, 1216), True, 'import numpy as np\n'), ((1228, 1241), 'numpy.eye', 'np.eye', (['(6 +... |
import numpy as np
import pandas as pd
def Preprc(raw_data: object, flag: object = 0) -> object:
"""
Function to compute the decoded values in motionsense HRV sensors and
interploate the timestamps given the decoded sequence numbers
:param raw_data:
:param flag:
:return:
"""
# process... | [
"numpy.stack",
"pandas.DataFrame",
"numpy.uint8",
"numpy.copy",
"numpy.zeros",
"numpy.diff",
"numpy.where"
] | [((493, 517), 'numpy.copy', 'np.copy', (['data_arr2[:, 1]'], {}), '(data_arr2[:, 1])\n', (500, 517), True, 'import numpy as np\n'), ((552, 564), 'numpy.diff', 'np.diff', (['seq'], {}), '(seq)\n', (559, 564), True, 'import numpy as np\n'), ((2056, 2077), 'numpy.zeros', 'np.zeros', (['num_samples'], {}), '(num_samples)\n... |
import discord, os, time, random, datetime, validators, asyncio, logging
from asyncio import sleep
from discord.ext import commands
from dateutil.parser import parse
PATH = "/home/nice/necibot"
logging.basicConfig(filename='necibot.log', level=logging.INFO)
logging.basicConfig(format='%(asctime)s %(message)s')
intent... | [
"dateutil.parser.parse",
"logging.basicConfig",
"asyncio.sleep",
"logging.warning",
"time.strftime",
"validators.url",
"random.choice",
"discord.Game",
"discord.Intents",
"discord.ext.commands.Bot",
"discord.ext.commands.has_role",
"datetime.datetime.now",
"os.getenv"
] | [((195, 258), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""necibot.log"""', 'level': 'logging.INFO'}), "(filename='necibot.log', level=logging.INFO)\n", (214, 258), False, 'import discord, os, time, random, datetime, validators, asyncio, logging\n'), ((259, 312), 'logging.basicConfig', 'logging.b... |
from os import remove
from pyrogram import filters
from YorForger import DEV_USERS, SUPPORT_USERS, WHITELIST_USERS, pbot as app
from YorForger.modules.wall import arq
from YorForger.utlis.error import capture_err
from YorForger.modules.helper_funcs.chun import adminsOnly
from YorForger.modules.sql.nsfw_sql import is_ns... | [
"os.remove",
"YorForger.modules.sql.nsfw_sql.rem_nsfw",
"pyrogram.filters.command",
"YorForger.modules.sql.nsfw_sql.is_nsfw",
"YorForger.pbot.on_message",
"YorForger.modules.sql.nsfw_sql.set_nsfw",
"YorForger.modules.wall.arq.nsfw_scan",
"YorForger.modules.helper_funcs.chun.adminsOnly",
"YorForger.p... | [((1335, 1471), 'YorForger.pbot.on_message', 'app.on_message', (['((filters.document | filters.photo | filters.sticker | filters.animation |\n filters.video) & ~filters.private)'], {'group': '(8)'}), '((filters.document | filters.photo | filters.sticker |\n filters.animation | filters.video) & ~filters.private, g... |
#/usr/bin/env python3
import numpy as np
# Try importing matplotlib; if it works show a plot of generated data
try:
import matplotlib.pyplot as plt
except ImportError:
MAKE_PLOT = False
else:
MAKE_PLOT = True
FILTERSIZE = 50
def smooth(x, window_len=11, window='hanning'):
"""smooth the data using a... | [
"numpy.random.rand",
"matplotlib.pyplot.show",
"numpy.ones"
] | [((2053, 2075), 'numpy.random.rand', 'np.random.rand', (['(360000)'], {}), '(360000)\n', (2067, 2075), True, 'import numpy as np\n'), ((1890, 1914), 'numpy.ones', 'np.ones', (['window_len', '"""d"""'], {}), "(window_len, 'd')\n", (1897, 1914), True, 'import numpy as np\n'), ((2301, 2311), 'matplotlib.pyplot.show', 'plt... |
from pylsa.rbc1d import solve_rbc1d,solve_rbc1d_neutral
# Parameters
Ny = 51
alpha = 3.1
Ra = 1708
Pr = 1.0
# Find the growth rates for given Ra
evals,evecs = solve_rbc1d(Ny=Ny,Ra=Ra,Pr=Pr,
alpha=alpha,plot=True)
# Find Rac where the growth rate is zero
evals,evecs = solve_rbc1d_neutral(Ny=Ny,Pr=Pr,
alpha... | [
"pylsa.rbc1d.solve_rbc1d_neutral",
"pylsa.rbc1d.solve_rbc1d"
] | [((170, 226), 'pylsa.rbc1d.solve_rbc1d', 'solve_rbc1d', ([], {'Ny': 'Ny', 'Ra': 'Ra', 'Pr': 'Pr', 'alpha': 'alpha', 'plot': '(True)'}), '(Ny=Ny, Ra=Ra, Pr=Pr, alpha=alpha, plot=True)\n', (181, 226), False, 'from pylsa.rbc1d import solve_rbc1d, solve_rbc1d_neutral\n'), ((281, 338), 'pylsa.rbc1d.solve_rbc1d_neutral', 'so... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dnsalloc', '0005_auto_20161228_1014'),
]
operations = [
migrations.RenameField(
model_name='service',
... | [
"django.db.migrations.RenameField"
] | [((252, 348), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""service"""', 'old_name': '"""plain_password"""', 'new_name': '"""password"""'}), "(model_name='service', old_name='plain_password',\n new_name='password')\n", (274, 348), False, 'from django.db import migrations, mode... |
from django.db import models
from django.contrib.auth.models import User
import re
from django.core.validators import RegexValidator
from TWT.apps.timathon.models import Team
from TWT.apps.challenges.models import Challenge
class Submission(models.Model):
id = models.AutoField(
primary_key=True,
h... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"re.compile"
] | [((267, 373), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)', 'help_text': '"""A Submission ID, automatically generated by Postgres."""'}), "(primary_key=True, help_text=\n 'A Submission ID, automatically generated by Postgres.')\n", (283, 373), False, 'from django.db import models\n... |
from setuptools import setup
setup(name='eralchemy-magic',
packages=['eralchemy_magic'],
install_requires=['ipython-sql'],
dependency_links=['git+https://github.com/psychemedia/eralchemy.git']
) | [
"setuptools.setup"
] | [((30, 203), 'setuptools.setup', 'setup', ([], {'name': '"""eralchemy-magic"""', 'packages': "['eralchemy_magic']", 'install_requires': "['ipython-sql']", 'dependency_links': "['git+https://github.com/psychemedia/eralchemy.git']"}), "(name='eralchemy-magic', packages=['eralchemy_magic'],\n install_requires=['ipython... |
# Generated by Django 3.0.8 on 2020-08-20 1:21
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auctions', '0001_initial'),
]
operations = [
... | [
"django.db.models.URLField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((1891, 1980), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(True)', 'related_name': '"""user_watch"""', 'to': '"""auctions.Listing"""'}), "(blank=True, related_name='user_watch', to=\n 'auctions.Listing')\n", (1913, 1980), False, 'from django.db import migrations, models\n'), ((418... |
from __future__ import annotations
from typing import Tuple, NoReturn
from ...base import BaseEstimator
import numpy as np
from itertools import product
class DecisionStump(BaseEstimator):
"""
A decision stump classifier for {-1,1} labels according to the CART algorithm
Attributes
----------
self... | [
"numpy.full",
"numpy.tril_indices",
"numpy.abs",
"numpy.argmax",
"numpy.argsort",
"numpy.sign"
] | [((2399, 2422), 'numpy.full', 'np.full', (['X.shape[0]', '(-1)'], {}), '(X.shape[0], -1)\n', (2406, 2422), True, 'import numpy as np\n'), ((3600, 3618), 'numpy.argsort', 'np.argsort', (['values'], {}), '(values)\n', (3610, 3618), True, 'import numpy as np\n'), ((3758, 3790), 'numpy.full', 'np.full', (['(size, size + 1)... |
from django.contrib.auth.models import Group
from social_core.pipeline.partial import partial
@partial
def verify_user(strategy, details, user=None, is_new=False, *args, **kwargs):
user.groups.add(Group.objects.get(name='Verified Users'))
user.save() | [
"django.contrib.auth.models.Group.objects.get"
] | [((204, 244), 'django.contrib.auth.models.Group.objects.get', 'Group.objects.get', ([], {'name': '"""Verified Users"""'}), "(name='Verified Users')\n", (221, 244), False, 'from django.contrib.auth.models import Group\n')] |
import torch
import torch.nn as nn
from numpy.random import random_sample
def make_rand_coords(input_size=(256,256,256), patch_size=(64,64,64)):
return [get_dims(input_size[0] - patch_size[0]), \
get_dims(input_size[1] - patch_size[1]), \
get_dims(input_size[2] - patch_size[2])]
def get_di... | [
"torch.nn.PReLU",
"numpy.random.random_sample",
"torch.nn.Conv3d",
"model.VNetAttention.EncoderBlock",
"model.VNetAttention.BottleNeck",
"torch.nn.GroupNorm",
"model.VNetSE.DecoderBlock",
"torchsummary.summary",
"model.VNetSE.BottleNeck",
"model.VNetSE.EncoderBlock",
"torch.device",
"model.VNe... | [((3296, 3316), 'model.VNetSE.EncoderBlock', 'EncoderBlock', (['params'], {}), '(params)\n', (3308, 3316), False, 'from model.VNetSE import EncoderBlock, BottleNeck, DecoderBlock\n'), ((3550, 3570), 'model.VNetSE.EncoderBlock', 'EncoderBlock', (['params'], {}), '(params)\n', (3562, 3570), False, 'from model.VNetSE impo... |
# Copyright 2015 Intel Corporation.
# 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 requir... | [
"oslo_log.log.getLogger",
"neutron.common.utils.exception_logger",
"nuage_neutron.plugins.common.nuagedb.get_nuage_l2bridge_id_for_network"
] | [((855, 882), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (872, 882), True, 'from oslo_log import log as logging\n'), ((1270, 1294), 'neutron.common.utils.exception_logger', 'utils.exception_logger', ([], {}), '()\n', (1292, 1294), False, 'from neutron.common import utils\n'), ((1... |
# -*- coding: utf-8 -*-
import stripe
from django.core.management.base import BaseCommand
from aa_stripe.models import StripeCoupon
from aa_stripe.settings import stripe_settings
from aa_stripe.utils import timestamp_to_timezone_aware_date
class Command(BaseCommand):
help = "Update the coupon list from Stripe AP... | [
"aa_stripe.models.StripeCoupon",
"aa_stripe.utils.timestamp_to_timezone_aware_date",
"stripe.Coupon.list",
"aa_stripe.models.StripeCoupon.objects.exclude"
] | [((1874, 1929), 'aa_stripe.models.StripeCoupon.objects.exclude', 'StripeCoupon.objects.exclude', ([], {'pk__in': 'active_coupons_ids'}), '(pk__in=active_coupons_ids)\n', (1902, 1929), False, 'from aa_stripe.models import StripeCoupon\n'), ((639, 692), 'stripe.Coupon.list', 'stripe.Coupon.list', ([], {'starting_after': ... |
from copy import copy
from django.forms import formsets
from django.contrib import messages
from django.db.models import Q
from django.forms.formsets import formset_factory, BaseFormSet, all_valid
from detail import *
from edit import *
class SearchFormViewMixin(BaseFormView):
ignore_get_keys = ("page", ) # T... | [
"django.db.models.Q"
] | [((3625, 3628), 'django.db.models.Q', 'Q', ([], {}), '()\n', (3626, 3628), False, 'from django.db.models import Q\n')] |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
import pytest
import numpy as np
import scipy.sparse as sparse
import cntk as C
csr... | [
"cntk.ops.tests.ops_test_utils.cntk_device",
"cntk.input",
"cntk.asvalue",
"cntk.tests.test_utils._to_csr",
"numpy.asarray",
"cntk.cpu",
"cntk.parameter",
"pytest.raises",
"numpy.array",
"cntk.tests.test_utils._to_dense",
"numpy.array_equal",
"pytest.mark.parametrize",
"cntk.internal._value_... | [((3041, 3169), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""data, num_of_dynamic_axes, expected_value_shape, expected_array_shapes"""', 'DENSE_CONFIGURATIONS'], {}), "(\n 'data, num_of_dynamic_axes, expected_value_shape, expected_array_shapes',\n DENSE_CONFIGURATIONS)\n", (3064, 3169), False, 'imp... |
# MIT License
#
# Copyright (c) 2019-2021 Tskit Developers
#
# 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, copy, modif... | [
"msprime.RecombinationMap.uniform_map",
"numpy.empty",
"numpy.ones",
"msprime.InfiniteSites",
"numpy.arange",
"pytest.mark.parametrize",
"pytest.mark.skip",
"numpy.zeros_like",
"random.randint",
"pytest.warns",
"tskit.TableCollection",
"itertools.permutations",
"itertools.zip_longest",
"py... | [((1739, 1767), 'tests.test_highlevel.get_example_tree_sequences', 'get_example_tree_sequences', ([], {}), '()\n', (1765, 1767), False, 'from tests.test_highlevel import get_example_tree_sequences\n'), ((2312, 2365), 'numpy.zeros', 'np.zeros', (['(ts.num_nodes, ts.num_sites)'], {'dtype': 'np.int8'}), '((ts.num_nodes, t... |
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2020 <NAME>
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, copy, modif... | [
"numpy.isin",
"sys.path.remove",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"numpy.logical_and",
"scripts.DrawCameras.camera_draw",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.scatter",
"numpy.eye",
"numpy.zeros",
"numpy.transpose",
"numpy.identity",
"numpy.where",
"numpy.array"... | [((2049, 2144), 'numpy.array', 'np.array', (['[[568.996140852, 0, 643.21055941], [0, 568.988362396, 477.982801038], [0, 0, 1]\n ]'], {}), '([[568.996140852, 0, 643.21055941], [0, 568.988362396, \n 477.982801038], [0, 0, 1]])\n', (2057, 2144), True, 'import numpy as np\n'), ((2240, 2284), 'numpy.array', 'np.array'... |
"""Function for extracting tiff tiles."""
import os
from abc import abstractmethod
from math import ceil
import struct
from cogdumper.errors import TIFFError
from cogdumper.jpegreader import insert_tables
from cogdumper.tifftags import compression as CompressionType
from cogdumper.tifftags import sizes as TIFFSizes
... | [
"os.environ.get",
"cogdumper.jpegreader.insert_tables",
"cogdumper.errors.TIFFError",
"struct.unpack"
] | [((8290, 8343), 'os.environ.get', 'os.environ.get', (['"""COG_INGESTED_BYTES_AT_OPEN"""', '"""16384"""'], {}), "('COG_INGESTED_BYTES_AT_OPEN', '16384')\n", (8304, 8343), False, 'import os\n'), ((8558, 8609), 'struct.unpack', 'struct.unpack', (['f"""{self._endian}H"""', 'self.header[2:4]'], {}), "(f'{self._endian}H', se... |
import errno
import gc
import mmap
import os
import time
pjoin = os.path.join
import pytest
from snakeoil import _fileutils, currying, fileutils
from snakeoil.fileutils import AtomicWriteFile, write_file
from snakeoil.test.fixtures import RandomPath, TempDir
class TestTouch(RandomPath):
def test_file_creation(... | [
"os.read",
"os.open",
"os.stat",
"os.path.exists",
"time.sleep",
"os.umask",
"gc.collect",
"snakeoil.fileutils.touch",
"snakeoil.fileutils.write_file",
"snakeoil.fileutils.readfile_ascii",
"pytest.raises",
"snakeoil.currying.post_curry",
"os.close",
"os.listdir"
] | [((345, 356), 'os.umask', 'os.umask', (['(0)'], {}), '(0)\n', (353, 356), False, 'import os\n'), ((529, 554), 'os.path.exists', 'os.path.exists', (['self.path'], {}), '(self.path)\n', (543, 554), False, 'import os\n'), ((654, 680), 'snakeoil.fileutils.touch', 'fileutils.touch', (['self.path'], {}), '(self.path)\n', (66... |
import numpy as _np
from openpnm.utils import Docorator
__all__ = ["pore_coords"]
docstr = Docorator()
@docstr.dedent
def pore_coords(target):
r"""
Calculate throat centroid values by averaging adjacent pore coordinates
Parameters
----------
%(models.target.parameters)s
Returns
-------... | [
"numpy.mean",
"openpnm.utils.Docorator"
] | [((93, 104), 'openpnm.utils.Docorator', 'Docorator', ([], {}), '()\n', (102, 104), False, 'from openpnm.utils import Docorator\n'), ((567, 598), 'numpy.mean', '_np.mean', (['coords[conns]'], {'axis': '(1)'}), '(coords[conns], axis=1)\n', (575, 598), True, 'import numpy as _np\n')] |
from typing import List, Dict
import pytrec_eval
def get_metric(qrels: str, run: str, metric: str = 'map') -> float:
# Read the qrel file
with open(qrels, 'r') as f_qrel:
qrel_dict = pytrec_eval.parse_qrel(f_qrel)
# Read the run file
with open(run, 'r') as f_run:
run_dict = pytrec_e... | [
"pytrec_eval.parse_run",
"pytrec_eval.parse_qrel",
"pytrec_eval.RelevanceEvaluator"
] | [((373, 446), 'pytrec_eval.RelevanceEvaluator', 'pytrec_eval.RelevanceEvaluator', (['qrel_dict', 'pytrec_eval.supported_measures'], {}), '(qrel_dict, pytrec_eval.supported_measures)\n', (403, 446), False, 'import pytrec_eval\n'), ((203, 233), 'pytrec_eval.parse_qrel', 'pytrec_eval.parse_qrel', (['f_qrel'], {}), '(f_qre... |
from django.db import migrations
def remove_ct_from_source_locations(apps, schema_editor):
ConcordanceIdentifier = apps.get_model("core", "ConcordanceIdentifier")
ConcordanceIdentifier.source_locations.through.objects.filter(
concordanceidentifier__authority__in=("ct_covidvaccinefinder_gov", "ct_gov")... | [
"django.db.migrations.RunPython"
] | [((613, 717), 'django.db.migrations.RunPython', 'migrations.RunPython', (['remove_ct_from_source_locations'], {'reverse_code': '(lambda apps, schema_editor: None)'}), '(remove_ct_from_source_locations, reverse_code=lambda\n apps, schema_editor: None)\n', (633, 717), False, 'from django.db import migrations\n')] |
import numpy as np
from ldpc import bposd_decoder
from panqec.codes import StabilizerCode
from panqec.error_models import BaseErrorModel
from panqec.decoders import BaseDecoder
class BeliefPropagationOSDDecoder(BaseDecoder):
label = 'BP-OSD decoder'
def __init__(self,
code: StabilizerCode,
... | [
"numpy.zeros",
"time.time",
"numpy.random.default_rng",
"numpy.hstack",
"numpy.array",
"panqec.error_models.PauliErrorModel",
"panqec.codes.XCubeCode",
"ldpc.bposd_decoder",
"numpy.concatenate"
] | [((5722, 5745), 'numpy.random.default_rng', 'np.random.default_rng', ([], {}), '()\n', (5743, 5745), True, 'import numpy as np\n'), ((5769, 5787), 'panqec.codes.XCubeCode', 'XCubeCode', (['L', 'L', 'L'], {}), '(L, L, L)\n', (5778, 5787), False, 'from panqec.codes import XCubeCode\n'), ((5866, 5896), 'panqec.error_model... |
import numpy as np
import pandas as pd
import random
from sklearn.model_selection import train_test_split
class SVM:
def __init__(self, max_iterations=1000, C=1, epsilon=0.001):
self.max_iterations = max_iterations
self.C = C
self.epsilon = epsilon
def fit(self, X, y):
# Ens... | [
"numpy.sum",
"random.randint",
"numpy.copy",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.zeros",
"numpy.where",
"numpy.array",
"numpy.linalg.norm",
"numpy.matmul",
"numpy.dot"
] | [((4792, 4840), 'pandas.read_csv', 'pd.read_csv', (['"""data/breast-cancer-wisconsin.data"""'], {}), "('data/breast-cancer-wisconsin.data')\n", (4803, 4840), True, 'import pandas as pd\n'), ((5051, 5088), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)'}), '(X, y, test_... |
from phantasm import Parser
if __name__ == '__main__':
with open('add.wasm', 'rb') as f:
parser = Parser(f)
print(parser.parse())
| [
"phantasm.Parser"
] | [((111, 120), 'phantasm.Parser', 'Parser', (['f'], {}), '(f)\n', (117, 120), False, 'from phantasm import Parser\n')] |
#!/usr/bin/env python
#-*- coding:utf-8 _*-
"""
@author:liruihui
@file: train.py
@time: 2019/09/17
@contact: <EMAIL>
@github: https://liruihui.github.io/
@description:
"""
import os
import pprint
pp = pprint.PrettyPrinter()
from datetime import datetime
from Generation.model_test import Model
from Generation.co... | [
"pprint.PrettyPrinter",
"Generation.model_test.Model"
] | [((208, 230), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {}), '()\n', (228, 230), False, 'import pprint\n'), ((456, 467), 'Generation.model_test.Model', 'Model', (['opts'], {}), '(opts)\n', (461, 467), False, 'from Generation.model_test import Model\n')] |
import torch
import torch.nn as nn
import torch.nn.functional as F
class myResnet(nn.Module):
def __init__(self, resnet):
super(myResnet, self).__init__()
self.resnet = resnet
self.last_conv = nn.Conv2d(2048, 512, [1, 1])
def forward(self, img, att_size=7):
x = img # .unsquee... | [
"torch.nn.Conv2d",
"torch.nn.functional.adaptive_avg_pool1d"
] | [((223, 251), 'torch.nn.Conv2d', 'nn.Conv2d', (['(2048)', '(512)', '[1, 1]'], {}), '(2048, 512, [1, 1])\n', (232, 251), True, 'import torch.nn as nn\n'), ((1546, 1577), 'torch.nn.functional.adaptive_avg_pool1d', 'F.adaptive_avg_pool1d', (['att', '(512)'], {}), '(att, 512)\n', (1567, 1577), True, 'import torch.nn.functi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 4 14:13:34 2020
Testing out the ADS1115 ADC with the raspberry pi
@author: nlourie
"""
import board
import busio
import time
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from datetime import datetime
import numpy as... | [
"adafruit_ads1x15.ads1115.ADS1115",
"matplotlib.pyplot.show",
"busio.I2C",
"matplotlib.animation.FuncAnimation",
"datetime.datetime.utcnow",
"matplotlib.pyplot.figure",
"numpy.int",
"adafruit_ads1x15.analog_in.AnalogIn"
] | [((333, 364), 'busio.I2C', 'busio.I2C', (['board.SCL', 'board.SDA'], {}), '(board.SCL, board.SDA)\n', (342, 364), False, 'import busio\n'), ((460, 476), 'adafruit_ads1x15.ads1115.ADS1115', 'ADS.ADS1115', (['i2c'], {}), '(i2c)\n', (471, 476), True, 'import adafruit_ads1x15.ads1115 as ADS\n'), ((485, 506), 'adafruit_ads1... |
from django.urls import path
from authors.apps.articles.share_articles import (
ShareEmailAPIView, ShareFacebookAPIView, ShareTwitterAPIView)
from .views import (
ArticlesListCreateAPIView, ArticleRetrieveUpdateDestroy,
ArticleRetrieveBySlugAPIView, CommentListCreateView,
ThreadListCreateView, CommentD... | [
"authors.apps.articles.share_articles.ShareFacebookAPIView.as_view",
"authors.apps.articles.share_articles.ShareTwitterAPIView.as_view",
"authors.apps.articles.share_articles.ShareEmailAPIView.as_view"
] | [((2164, 2191), 'authors.apps.articles.share_articles.ShareEmailAPIView.as_view', 'ShareEmailAPIView.as_view', ([], {}), '()\n', (2189, 2191), False, 'from authors.apps.articles.share_articles import ShareEmailAPIView, ShareFacebookAPIView, ShareTwitterAPIView\n'), ((2270, 2300), 'authors.apps.articles.share_articles.S... |
from django.contrib.sessions.models import Session
from tracking.models import Visitor
from datetime import datetime
class UserRestrictMiddleware(object):
"""Prevents more than one user logging in at once from two different IPs.
"""
def __init__(self, get_response):
self.get_response = get_respons... | [
"django.contrib.sessions.models.Session.objects.filter",
"datetime.datetime.now",
"tracking.models.Visitor.objects.filter"
] | [((564, 578), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (576, 578), False, 'from datetime import datetime\n'), ((618, 659), 'tracking.models.Visitor.objects.filter', 'Visitor.objects.filter', ([], {'user': 'request.user'}), '(user=request.user)\n', (640, 659), False, 'from tracking.models import Visito... |
#!/usr/bin/env python
#
# Copyright (c) 2017-2018, SyLabs, Inc. All rights reserved.
# Copyright (c) 2017, SingularityWare, LLC. All rights reserved.
# Copyright (c) 2017, <NAME>. All rights reserved.
#
# See the COPYRIGHT.md file at the top-level directory of this
# distribution and at https://github.com/singularitywa... | [
"urllib2.urlopen",
"urllib2.Request",
"re.findall",
"platform.linux_distribution",
"re.search",
"os.chdir",
"sys.exit"
] | [((957, 986), 'platform.linux_distribution', 'platform.linux_distribution', ([], {}), '()\n', (984, 986), False, 'import platform\n'), ((1114, 1128), 'os.chdir', 'os.chdir', (['base'], {}), '(base)\n', (1122, 1128), False, 'import os\n'), ((1446, 1492), 'urllib2.Request', 'Request', (["('%s/%s/%s' % (base, release, fil... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# IMPORTS
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
from __future__ import annotations;
from src.local.system import *;
from src.local.maths import *;
from src.local.typing impor... | [
"src.core.utils.getFullPath",
"src.core.utils.PythonCommand"
] | [((1618, 1633), 'src.core.utils.PythonCommand', 'PythonCommand', ([], {}), '()\n', (1631, 1633), False, 'from src.core.utils import PythonCommand\n'), ((3951, 3976), 'src.core.utils.getFullPath', 'getFullPath', (["(value or '.')"], {}), "(value or '.')\n", (3962, 3976), False, 'from src.core.utils import getFullPath\n'... |
import sys
import string
from itertools import product
import scipy.constants as co
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import LogNorm
from scipy import stats
import h5py
plt.rc('text', usetex=True)
plt.rc('text.latex', preamble=r'\usepackage[varg]{txfonts}')
plt.rc('axes'... | [
"matplotlib.pyplot.subplot",
"h5py.File",
"matplotlib.pyplot.gca",
"numpy.amax",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.rc",
"numpy.arange",
"itertools.product",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.savefig"
] | [((218, 245), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (224, 245), True, 'from matplotlib import pyplot as plt\n'), ((246, 306), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text.latex"""'], {'preamble': '"""\\\\usepackage[varg]{txfonts}"""'}), "('text.latex', prea... |
# -*- coding: utf-8 -*-
r"""
Created on Fri Nov 24 21:38:04 2017
@author: _Lantian
Instructions for pyinstaller:
after install pyinstaller using pip install,
use pyinstaller.exe from ...\Scripts the same way as we use pip install
and type -F path after the exe (-F means put all info into one exe)
Example: p... | [
"tkinter.StringVar",
"os.listdir",
"tkinter.ttk.Label",
"tkinter.ttk.Entry",
"csv.writer",
"tkinter.messagebox.showinfo",
"os.path.isfile",
"tkinter.ttk.Button",
"os.path.join",
"tkinter.Tk"
] | [((1743, 1750), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (1748, 1750), True, 'import tkinter as tk\n'), ((1970, 1984), 'tkinter.StringVar', 'tk.StringVar', ([], {}), '()\n', (1982, 1984), True, 'import tkinter as tk\n'), ((1998, 2041), 'tkinter.ttk.Entry', 'ttk.Entry', (['win'], {'width': '(70)', 'textvariable': 'name'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#
from kubernetes.utils import is_valid_string, filter_model
from kubernetes.models.v1.KeyToPath import KeyToPath
class ConfigMapProjection(ob... | [
"kubernetes.utils.is_valid_string",
"kubernetes.utils.filter_model",
"kubernetes.models.v1.KeyToPath.KeyToPath"
] | [((1017, 1036), 'kubernetes.utils.filter_model', 'filter_model', (['model'], {}), '(model)\n', (1029, 1036), False, 'from kubernetes.utils import is_valid_string, filter_model\n'), ((1763, 1781), 'kubernetes.models.v1.KeyToPath.KeyToPath', 'KeyToPath', ([], {'model': 'i'}), '(model=i)\n', (1772, 1781), False, 'from kub... |
from drf_problems import PROBLEM_CODE_CHOICES, PROBLEM_EXCEPTION_MAP
def register_exception(exc_cls):
code = getattr(exc_cls, 'code', exc_cls.default_code)
PROBLEM_EXCEPTION_MAP[code] = exc_cls
PROBLEM_CODE_CHOICES.append((code, code))
class register(object):
def __init__(self, cls):
self.cl... | [
"drf_problems.PROBLEM_CODE_CHOICES.append"
] | [((208, 249), 'drf_problems.PROBLEM_CODE_CHOICES.append', 'PROBLEM_CODE_CHOICES.append', (['(code, code)'], {}), '((code, code))\n', (235, 249), False, 'from drf_problems import PROBLEM_CODE_CHOICES, PROBLEM_EXCEPTION_MAP\n')] |
"""
A file for all models' weight initialization functions
"""
import torch
from torch import nn
import numpy as np
import graphs
import math
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Conv') != -1:
nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlineari... | [
"torch.nn.init.kaiming_normal_",
"math.sqrt",
"torch.nn.init.xavier_uniform_",
"torch.nn.init.constant_",
"torch.nn.init.orthogonal_"
] | [((260, 330), 'torch.nn.init.kaiming_normal_', 'nn.init.kaiming_normal_', (['m.weight'], {'mode': '"""fan_out"""', 'nonlinearity': '"""relu"""'}), "(m.weight, mode='fan_out', nonlinearity='relu')\n", (283, 330), False, 'from torch import nn\n'), ((848, 881), 'torch.nn.init.xavier_uniform_', 'nn.init.xavier_uniform_', (... |
"""
This setup file installs packages to test mypy's PEP 561 implementation
"""
from distutils.core import setup
setup(
name='typedpkg_ns_b-stubs',
author="The mypy team",
version='0.1',
namespace_packages=['typedpkg_ns-stubs'],
package_data={'typedpkg_ns-stubs.b': ['__init__.pyi', 'bbb... | [
"distutils.core.setup"
] | [((121, 350), 'distutils.core.setup', 'setup', ([], {'name': '"""typedpkg_ns_b-stubs"""', 'author': '"""The mypy team"""', 'version': '"""0.1"""', 'namespace_packages': "['typedpkg_ns-stubs']", 'package_data': "{'typedpkg_ns-stubs.b': ['__init__.pyi', 'bbb.pyi']}", 'packages': "['typedpkg_ns-stubs.b']"}), "(name='typed... |
import tensorflow as tf
from tensorflow.python.layers import core as layers_core
from tensorflow.contrib.tensorboard.plugins import projector
# useful libraries for data preprocessing
import tensorlayer as tl
from tensorlayer.layers import *
import numpy as np
import time
import os
from gen_data import m... | [
"tensorflow.reduce_sum",
"tensorflow.global_variables",
"tensorflow.contrib.tensorboard.plugins.projector.ProjectorConfig",
"tensorflow.contrib.seq2seq.BasicDecoder",
"tensorflow.complex",
"tensorflow.contrib.tensorboard.plugins.projector.visualize_embeddings",
"tensorflow.get_variable",
"tensorflow.p... | [((9037, 9049), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (9047, 9049), True, 'import tensorflow as tf\n'), ((13958, 14012), 'tensorflow.contrib.tensorboard.plugins.projector.visualize_embeddings', 'projector.visualize_embeddings', (['summary_writer', 'config'], {}), '(summary_writer, config)\n', (13988, 14... |
"""An instance of an FMOD Studio Event."""
from ctypes import byref, c_bool, c_float, c_int, c_void_p
from ..channel_group import ChannelGroup
from ..utils import prepare_str
from .enums import PLAYBACK_STATE
from .studio_object import StudioObject
class EventInstance(StudioObject):
"""An instance of an FMOD St... | [
"ctypes.c_int",
"ctypes.byref",
"ctypes.c_bool",
"ctypes.c_float",
"ctypes.c_void_p"
] | [((800, 808), 'ctypes.c_bool', 'c_bool', ([], {}), '()\n', (806, 808), False, 'from ctypes import byref, c_bool, c_float, c_int, c_void_p\n'), ((1289, 1296), 'ctypes.c_int', 'c_int', ([], {}), '()\n', (1294, 1296), False, 'from ctypes import byref, c_bool, c_float, c_int, c_void_p\n'), ((1545, 1554), 'ctypes.c_float', ... |
import yaml
import io
class Config:
CONFIG_PATH = 'config.yaml'
def __init__(self):
self.config = self._load_config()
self.access_token = self.config['access_token']
self.wall_id = self.config['wall_id']
self.telegram_token = self.config['telegram_token']
self.teleg... | [
"yaml.load",
"yaml.dump",
"io.open"
] | [((667, 684), 'yaml.load', 'yaml.load', (['stream'], {}), '(stream)\n', (676, 684), False, 'import yaml\n'), ((750, 799), 'io.open', 'io.open', (['Config.CONFIG_PATH', '"""w"""'], {'encoding': '"""utf8"""'}), "(Config.CONFIG_PATH, 'w', encoding='utf8')\n", (757, 799), False, 'import io\n'), ((824, 901), 'yaml.dump', 'y... |
import os
# from catalogue.models import MediaUpload
def get_upload_media_name(instance, filename):
"""
Generic method to manage model media
- Use a uuid string to avoid name conflicts
- Added a 's' to media type to generate a plural folder
"""
dirname = "media/" + instance.media_type + "s/"
... | [
"os.path.splitext"
] | [((336, 362), 'os.path.splitext', 'os.path.splitext', (['filename'], {}), '(filename)\n', (352, 362), False, 'import os\n')] |
from __future__ import absolute_import
from sentry.api.serializers import Serializer, register, serialize
from sentry.models import Activity
@register(Activity)
class ActivitySerializer(Serializer):
def serialize(self, obj, attrs, user):
d = {
'id': str(obj.id),
'user': serialize(... | [
"sentry.api.serializers.serialize",
"sentry.api.serializers.register"
] | [((145, 163), 'sentry.api.serializers.register', 'register', (['Activity'], {}), '(Activity)\n', (153, 163), False, 'from sentry.api.serializers import Serializer, register, serialize\n'), ((310, 329), 'sentry.api.serializers.serialize', 'serialize', (['obj.user'], {}), '(obj.user)\n', (319, 329), False, 'from sentry.a... |
from setuptools import setup, find_packages
NAME = 'linkml_model_enrichment'
DESCRIPTION = 'A Python library and set of command line utilities for exchanging Knowledge Graphs (KGs) that conform to or are aligned to the Biolink Model.'
URL = 'https://github.com/NCATS-Tangerine/linkml_model_enrichment'
AUTHOR = '<NAME>'... | [
"setuptools.find_packages"
] | [((791, 858), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['*.tests', '*.tests.*', 'tests.*', 'tests']"}), "(exclude=['*.tests', '*.tests.*', 'tests.*', 'tests'])\n", (804, 858), False, 'from setuptools import setup, find_packages\n')] |
import asyncio
from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, StartTime, bot
from userbot.utils import bash, edit_or_reply, zelda_cmd
hpx_thumb = "https://telegra.ph/file/6443a8f61a0194b065221.mp4"
@zelda_cmd(pattern="hcm (.*)")
async def amireallycuan(cuan):
user = await bot.get_me()
r... | [
"asyncio.sleep",
"userbot.utils.edit_or_reply",
"userbot.bot.send_file",
"userbot.CMD_HELP.update",
"userbot.bot.get_me",
"userbot.utils.zelda_cmd"
] | [((224, 253), 'userbot.utils.zelda_cmd', 'zelda_cmd', ([], {'pattern': '"""hcm (.*)"""'}), "(pattern='hcm (.*)')\n", (233, 253), False, 'from userbot.utils import bash, edit_or_reply, zelda_cmd\n'), ((1229, 1422), 'userbot.CMD_HELP.update', 'CMD_HELP.update', (['{\'ch_hpx\':\n f"""**Plugin : **`Content CH` \n... |
from django.core.management.base import BaseCommand, CommandError
import os
import concurrent.futures
import time
class Command(BaseCommand):
help = 'Load all data from csv file to database'
command_list = ['load_land', 'load_building', 'load_place', 'load_item']
def handle(self, *args, **options):
... | [
"django.core.management.base.CommandError",
"os.system",
"time.time"
] | [((332, 343), 'time.time', 'time.time', ([], {}), '()\n', (341, 343), False, 'import time\n'), ((610, 645), 'os.system', 'os.system', (['f"""./manage.py {command}"""'], {}), "(f'./manage.py {command}')\n", (619, 645), False, 'import os\n'), ((421, 432), 'time.time', 'time.time', ([], {}), '()\n', (430, 432), False, 'im... |
import json as stdlib_json # Don't conflict with `corehq.util.json`
from traceback import format_exception_only
from django.utils.functional import Promise
from .couch import get_document_or_404 # noqa: F401
from .view_utils import reverse # noqa: F401
def flatten_list(elements):
return [item for sublist in ... | [
"json.dumps"
] | [((1506, 1540), 'json.dumps', 'stdlib_json.dumps', (['value'], {'indent': '(2)'}), '(value, indent=2)\n', (1523, 1540), True, 'import json as stdlib_json\n')] |
import torch
import torch.nn as nn
from models.layers_384 import Conv, Hourglass, Residual
class Convert(nn.Module):
def __init__(self, in_channel, out_channel):
super(Convert, self).__init__()
self.conv = nn.Conv2d(in_channel, out_channel, 1)
def forward(self, x):
return self.conv(x)... | [
"models.layers_384.Conv",
"torch.nn.Conv2d",
"models.layers_384.Hourglass",
"models.layers_384.Residual",
"torch.nn.MaxPool2d"
] | [((228, 265), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_channel', 'out_channel', '(1)'], {}), '(in_channel, out_channel, 1)\n', (237, 265), True, 'import torch.nn as nn\n'), ((550, 587), 'models.layers_384.Conv', 'Conv', (['(3)', '(64)', '(7)', '(2)'], {'bn': '(True)', 'relu': '(True)'}), '(3, 64, 7, 2, bn=True, relu=True)... |
from html.parser import HTMLParser
from bs4 import BeautifulSoup
import csv
data = []
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
print("Start tag:", tag)
for attr in attrs:
print(" attr:", attr)
def handle_endtag(self, tag):
print("End tag :"... | [
"bs4.BeautifulSoup",
"csv.DictWriter"
] | [((457, 496), 'bs4.BeautifulSoup', 'BeautifulSoup', (['read_data', '"""html.parser"""'], {}), "(read_data, 'html.parser')\n", (470, 496), False, 'from bs4 import BeautifulSoup\n'), ((1363, 1409), 'csv.DictWriter', 'csv.DictWriter', (['csvfile'], {'fieldnames': 'fieldnames'}), '(csvfile, fieldnames=fieldnames)\n', (1377... |
from datetime import datetime
from dataclasses import dataclass
from marshmallow import Schema, fields, post_load
class LogMessageCommandType:
INBOUND_SMS = "INBOUND_SMS"
STATUS_UPDATE = "STATUS_UPDATE"
OUTBOUND_SMS = "OUTBOUND_SMS"
@dataclass
class LogMessageCommand:
command_type: str
payload: ... | [
"marshmallow.fields.Str",
"marshmallow.fields.DateTime",
"marshmallow.fields.Dict"
] | [((419, 444), 'marshmallow.fields.Str', 'fields.Str', ([], {'required': '(True)'}), '(required=True)\n', (429, 444), False, 'from marshmallow import Schema, fields, post_load\n'), ((459, 485), 'marshmallow.fields.Dict', 'fields.Dict', ([], {'required': '(True)'}), '(required=True)\n', (470, 485), False, 'from marshmall... |
from pathlib import Path
from fastapi.testclient import TestClient
import deciphon_api.data as data
from deciphon_api.main import settings
def _upload(
client: TestClient, file_type: str, file_field: str, path: Path, with_api_key=True
):
api_prefix = settings.api_prefix
api_key = settings.api_key
if... | [
"deciphon_api.data.filepath"
] | [((760, 800), 'deciphon_api.data.filepath', 'data.filepath', (['data.FileName.minifam_hmm'], {}), '(data.FileName.minifam_hmm)\n', (773, 800), True, 'import deciphon_api.data as data\n'), ((938, 977), 'deciphon_api.data.filepath', 'data.filepath', (['data.FileName.minifam_db'], {}), '(data.FileName.minifam_db)\n', (951... |
import json
import os
from django.conf import settings
exam_data_path = os.path.join(settings.PROJECT_ROOT, "train\\tests.json")
exams_college = json.loads(open(exam_data_path).read())
college_data_path = os.path.join(
settings.PROJECT_ROOT, "train\\orignal_data.json")
college_data = json.loads(open(college_da... | [
"os.path.join"
] | [((74, 130), 'os.path.join', 'os.path.join', (['settings.PROJECT_ROOT', '"""train\\\\tests.json"""'], {}), "(settings.PROJECT_ROOT, 'train\\\\tests.json')\n", (86, 130), False, 'import os\n'), ((209, 272), 'os.path.join', 'os.path.join', (['settings.PROJECT_ROOT', '"""train\\\\orignal_data.json"""'], {}), "(settings.PR... |
# Copyright 2021 Sony Group 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 ... | [
"numpy.abs",
"nnabla.ext_utils.get_extension_context",
"nnabla.Variable.from_numpy_array",
"click.option",
"nnabla.get_parameters",
"numpy.random.randint",
"nnabla.functions.add2",
"nnabla.functions.dropout",
"numpy.full",
"nnabla.logger.logger.info",
"numpy.random.randn",
"nnabla.solvers.Sgd"... | [((13790, 13805), 'click.command', 'click.command', ([], {}), '()\n', (13803, 13805), False, 'import click\n'), ((13807, 13853), 'click.option', 'click.option', (['"""--loop/--no-loop"""'], {'default': '(True)'}), "('--loop/--no-loop', default=True)\n", (13819, 13853), False, 'import click\n'), ((13855, 13918), 'click.... |
# Copyright (c) 2017-2020 Neogeo-Technologies.
# 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... | [
"django.contrib.auth.decorators.login_required",
"idgo_admin.shortcuts.user_and_profile",
"idgo_admin.shortcuts.render_with_info_profile",
"django.utils.decorators.method_decorator",
"idgo_admin.shortcuts.get_object_or_404_extended"
] | [((1844, 1889), 'django.utils.decorators.method_decorator', 'method_decorator', (['decorators'], {'name': '"""dispatch"""'}), "(decorators, name='dispatch')\n", (1860, 1889), False, 'from django.utils.decorators import method_decorator\n'), ((1795, 1839), 'django.contrib.auth.decorators.login_required', 'login_required... |
from unittest import TestCase
import unittest
from binary_tree import BinaryTree, BinaryTreeNode
class TestBinaryTree(TestCase):
def setUp(self):
self.root_value = "42"
self.some_value = "Gomu Gomu No!"
def test_instance(self):
# arrange/act
tree = BinaryTree()
# asse... | [
"unittest.main",
"binary_tree.BinaryTree"
] | [((3037, 3052), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3050, 3052), False, 'import unittest\n'), ((293, 305), 'binary_tree.BinaryTree', 'BinaryTree', ([], {}), '()\n', (303, 305), False, 'from binary_tree import BinaryTree, BinaryTreeNode\n'), ((437, 449), 'binary_tree.BinaryTree', 'BinaryTree', ([], {}),... |
# author: <NAME>
# date: 2020-11-27
"""Load a csv / feather data file from a local input file and split into test and training data set and write to 2 separate local output files. The output file will be either a csv or a feather file format, which is determined by the extension.
Usage: src/cleanup_data.py --in_file=... | [
"feather.read_dataframe",
"os.makedirs",
"feather.write_dataframe",
"docopt.docopt",
"pandas.read_csv",
"os.path.dirname",
"os.path.exists"
] | [((1248, 1263), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (1254, 1263), False, 'from docopt import docopt\n'), ((1575, 1595), 'pandas.read_csv', 'pd.read_csv', (['in_file'], {}), '(in_file)\n', (1586, 1595), True, 'import pandas as pd\n'), ((2180, 2205), 'os.path.dirname', 'os.path.dirname', (['out_f... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.template import Library
from django.utils.translation import gettext as _
from tasks.views import UserTasksView
register = Library()
# @register.inclusion_tag('dashboard/assets/top-bar/tasks.html', takes_context=True)
@register... | [
"django.template.Library",
"tasks.views.UserTasksView"
] | [((212, 221), 'django.template.Library', 'Library', ([], {}), '()\n', (219, 221), False, 'from django.template import Library\n'), ((445, 477), 'tasks.views.UserTasksView', 'UserTasksView', ([], {'user': 'request.user'}), '(user=request.user)\n', (458, 477), False, 'from tasks.views import UserTasksView\n')] |
import chainer
import chainer.functions as F
import chainer.links as L
class ResidualBlock(chainer.Chain):
def __init__(self, filter_size, dilation,
residual_channels, dilated_channels, skip_channels):
super(ResidualBlock, self).__init__()
with self.init_scope():
self.... | [
"chainer.functions.split_axis",
"chainer.links.Convolution1D",
"chainer.functions.concat",
"chainer.functions.sigmoid",
"chainer.functions.tanh"
] | [((997, 1023), 'chainer.functions.split_axis', 'F.split_axis', (['h', '(2)'], {'axis': '(1)'}), '(h, 2, axis=1)\n', (1009, 1023), True, 'import chainer.functions as F\n'), ((1671, 1714), 'chainer.functions.concat', 'F.concat', (['(self.queue[:, :, 1:], x)'], {'axis': '(2)'}), '((self.queue[:, :, 1:], x), axis=2)\n', (1... |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
def readme():
try:
with open('README.md') as f:
return f.read()
except:
pass
setup(
name='iterapi',
version='1.2.2',
description='Python... | [
"os.path.dirname",
"codecs.open"
] | [((109, 131), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (121, 131), False, 'from os import path\n'), ((170, 187), 'codecs.open', 'open', (['"""README.md"""'], {}), "('README.md')\n", (174, 187), False, 'from codecs import open\n')] |
from collections import namedtuple
import raccoon as rc
def test_iterrows():
df = rc.DataFrame({'first': [1, 2, 3, 4, 5], 'second': ['a', 2, 'b', None, 5]})
expected = [{'index': 0, 'first': 1, 'second': 'a'},
{'index': 1, 'first': 2, 'second': 2},
{'index': 2, 'first': 3, 's... | [
"collections.namedtuple",
"raccoon.DataFrame"
] | [((89, 163), 'raccoon.DataFrame', 'rc.DataFrame', (["{'first': [1, 2, 3, 4, 5], 'second': ['a', 2, 'b', None, 5]}"], {}), "({'first': [1, 2, 3, 4, 5], 'second': ['a', 2, 'b', None, 5]})\n", (101, 163), True, 'import raccoon as rc\n'), ((581, 655), 'raccoon.DataFrame', 'rc.DataFrame', (["{'first': [1, 2, 3, 4, 5], 'seco... |
import os
from PIL import Image
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
from users.models import Profile
from django.urls import reverse
from django.conf import settings
def get_image_path(instance, filename):
return os.path.join('posts', str(inst... | [
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"PIL.Image.open",
"django.db.models.ImageField",
"django.urls.reverse",
"django.db.models.DateTimeField"
] | [((384, 451), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': 'get_image_path', 'null': '(True)', 'blank': '(False)'}), '(upload_to=get_image_path, null=True, blank=False)\n', (401, 451), False, 'from django.db import models\n'), ((466, 522), 'django.db.models.TextField', 'models.TextField', ([],... |
import torch
from torch import nn, Tensor
import torch.nn.functional as F
from torch.nn.modules import ModuleList
from util.misc import inverse_sigmoid
from modules.transformer import PreProccessor, TransformerEncoderLayer, TransformerDecoderLayer, TransformerEncoder
import copy
from typing import Optional, List
c... | [
"util.misc.inverse_sigmoid",
"copy.deepcopy",
"torch.stack"
] | [((2674, 2704), 'torch.stack', 'torch.stack', (['intermediate_attn'], {}), '(intermediate_attn)\n', (2685, 2704), False, 'import torch\n'), ((2889, 2910), 'copy.deepcopy', 'copy.deepcopy', (['module'], {}), '(module)\n', (2902, 2910), False, 'import copy\n'), ((2535, 2560), 'torch.stack', 'torch.stack', (['intermediate... |
# Copyright 2012 OpenStack Foundation.
# 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 req... | [
"oslo_utils.netutils.is_valid_mac",
"oslo_utils.netutils._get_my_ipv4_address",
"oslo_utils.netutils.is_valid_port",
"oslo_utils.netutils.set_tcp_keepalive",
"oslo_utils.netutils.urlsplit",
"oslo_utils.netutils.is_valid_icmp_code",
"oslo_utils.netutils.escape_ipv6",
"oslo_utils.netutils.is_valid_cidr"... | [((11680, 11707), 'unittest.mock.patch', 'mock.patch', (['"""socket.socket"""'], {}), "('socket.socket')\n", (11690, 11707), False, 'from unittest import mock\n'), ((11713, 11767), 'unittest.mock.patch', 'mock.patch', (['"""oslo_utils.netutils._get_my_ipv4_address"""'], {}), "('oslo_utils.netutils._get_my_ipv4_address'... |
""" Extracts data from GPX file and writes data to CSV """
# Imports
import os
import pandas as pd
import mansfield_gpx as mfx
# Define relative path to GPX file
double_up_gpx_path = os.path.join(
"02-raw-data", "mansfield-double-up-course.gpx")
# Define list of GPX attributes
attribute_list = [
"latitude", ... | [
"mansfield_gpx.extract_gpx_data",
"os.path.join"
] | [((185, 246), 'os.path.join', 'os.path.join', (['"""02-raw-data"""', '"""mansfield-double-up-course.gpx"""'], {}), "('02-raw-data', 'mansfield-double-up-course.gpx')\n", (197, 246), False, 'import os\n'), ((656, 728), 'os.path.join', 'os.path.join', (['"""03-processed-data"""', '"""mansfield-double-up-course-data.csv""... |
#!/usr/bin/env python3
import networkx as nx
import sqlite3
import logging
import json
import argparse
import pandas as pd
from pathlib import Path
from cdlib.algorithms import leiden
import networkx as nx
import sqlite3
import logging
import json
import argparse
import pandas as pd
from pathlib import Path
from cdlib... | [
"json.dump",
"argparse.ArgumentParser",
"logging.FileHandler",
"pathlib.Path.home",
"logging.StreamHandler",
"logging.info",
"networkx.spring_layout",
"networkx.Graph",
"sqlite3.connect"
] | [((375, 411), 'logging.info', 'logging.info', (['f"""Loading from {path}"""'], {}), "(f'Loading from {path}')\n", (387, 411), False, 'import logging\n'), ((423, 444), 'sqlite3.connect', 'sqlite3.connect', (['path'], {}), '(path)\n', (438, 444), False, 'import sqlite3\n'), ((1446, 1476), 'logging.info', 'logging.info', ... |
# Copyright 2017-2019 TensorHub, 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 to in writ... | [
"guild.op_util.init_logging",
"guild.batch_util.batch_run",
"logging.getLogger",
"guild.batch_util.handle_trials",
"sys.exit"
] | [((768, 794), 'logging.getLogger', 'logging.getLogger', (['"""guild"""'], {}), "('guild')\n", (785, 794), False, 'import logging\n'), ((837, 859), 'guild.op_util.init_logging', 'op_util.init_logging', ([], {}), '()\n', (857, 859), False, 'from guild import op_util\n'), ((876, 898), 'guild.batch_util.batch_run', 'batch_... |
#!/usr/bin/python3
import socket
from JIM import *
class User():
def __init__(self, socket, user_id):
self.socket = socket
self.user_id = user_id
self.status = True
def __repr__(self):
if self.status == True:
status_str = "online"
else:
status_str = "offline"
return 'This is objects %s with status... | [
"socket.send"
] | [((454, 470), 'socket.send', 'socket.send', (['msg'], {}), '(msg)\n', (465, 470), False, 'import socket\n')] |
"""Static files."""
from __future__ import absolute_import, unicode_literals
import os
def get_file(*args):
# type: (*str) -> str
"""Get filename for static file."""
return os.path.join(os.path.abspath(os.path.dirname(__file__)), *args)
def logo():
# type: () -> bytes
"""Celery logo image."""
... | [
"os.path.dirname"
] | [((217, 242), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (232, 242), False, 'import os\n')] |
#importing required libraries
import heapq
import matplotlib.pyplot as plt
import numpy as np
import math
import time
start_time = time.time()
startx =int(input("please enter start point x coordinate: "))
starty =int(input("please enter start point y coordinate: "))
goalx =int(input("please enter goa... | [
"heapq.heappush",
"matplotlib.pyplot.plot",
"math.sqrt",
"matplotlib.pyplot.scatter",
"heapq.heappop",
"time.time",
"matplotlib.pyplot.pause"
] | [((141, 152), 'time.time', 'time.time', ([], {}), '()\n', (150, 152), False, 'import time\n'), ((572, 606), 'matplotlib.pyplot.plot', 'plt.plot', (['start[0]', 'start[1]', '"""Dr"""'], {}), "(start[0], start[1], 'Dr')\n", (580, 606), True, 'import matplotlib.pyplot as plt\n'), ((608, 640), 'matplotlib.pyplot.plot', 'pl... |
from functools import wraps
import time
from hashlib import md5
import threading
class memoize(object):
""" Memoize the results of a function. Supports an optional timeout
for automatic cache expiration.
If the optional manual_flush argument is True, a function called
"flush_cache" will b... | [
"threading.RLock",
"functools.wraps",
"time.time"
] | [((918, 935), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (933, 935), False, 'import threading\n'), ((2133, 2142), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (2138, 2142), False, 'from functools import wraps\n'), ((1011, 1020), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (1016, 1020), False... |
import unittest
import doctest
import str_util
class TestStrUtil(unittest.TestCase):
def test_side_effects(self):
list = ['B', 'A', 'C', 'C', '']
length = len(list)
new_list = str_util.trim(list)
new_list = str_util.sort(list)
new_list = str_util.unique(list)
new_li... | [
"unittest.main",
"str_util.replace_substring",
"str_util.to_string",
"unittest.TextTestRunner",
"unittest.TestSuite",
"str_util.is_empty",
"doctest.DocTestSuite",
"str_util.contains",
"str_util.is_string",
"str_util.unique",
"str_util.to_list",
"str_util.lowercase",
"str_util.sort",
"str_u... | [((2931, 2946), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2944, 2946), False, 'import unittest\n'), ((206, 225), 'str_util.trim', 'str_util.trim', (['list'], {}), '(list)\n', (219, 225), False, 'import str_util\n'), ((245, 264), 'str_util.sort', 'str_util.sort', (['list'], {}), '(list)\n', (258, 264), False,... |
# PyZX - Python library for quantum circuit rewriting
# and optimisation using the ZX-calculus
# Copyright (C) 2021 - <NAME> and <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
... | [
"sys.path.append",
"pyzx.optimize.basic_optimization",
"pyzx.simplify.full_reduce"
] | [((1096, 1117), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (1111, 1117), False, 'import sys\n'), ((1919, 1937), 'pyzx.simplify.full_reduce', 'full_reduce', (['g_tmp'], {}), '(g_tmp)\n', (1930, 1937), False, 'from pyzx.simplify import full_reduce\n'), ((2026, 2047), 'pyzx.optimize.basic_optimi... |
from struct import pack, unpack
# NS_ANDROID_URI = 'http://schemas.android.com/apk/res/android'
# AXML FORMAT ########################################
# Translated from
# http://code.google.com/p/android4me/source/browse/src/android/content/res/AXmlResourceParser.java
UTF8_FLAG = 0x00000100
CHUNK_STRINGPOOL_TYPE = 0... | [
"struct.unpack",
"struct.pack"
] | [((4419, 4478), 'struct.unpack', 'unpack', (['fmt', 'self.m_charbuff[offset:offset + sizeof_2chars]'], {}), '(fmt, self.m_charbuff[offset:offset + sizeof_2chars])\n', (4425, 4478), False, 'from struct import pack, unpack\n'), ((5602, 5633), 'struct.pack', 'pack', (['self.__size', 'self.__value'], {}), '(self.__size, se... |
import unittest
import uuid
import py3crdt
from py3crdt.gset import GSet
class TestLWW(unittest.TestCase):
def setUp(self):
# Create a GSet
self.gset1 = GSet(uuid.uuid4())
# Create another GSet
self.gset2 = GSet(uuid.uuid4())
# Add elements to gset1
self.gset1.add... | [
"unittest.main",
"uuid.uuid4"
] | [((2132, 2147), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2145, 2147), False, 'import unittest\n'), ((180, 192), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (190, 192), False, 'import uuid\n'), ((251, 263), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (261, 263), False, 'import uuid\n')] |
# -*- coding: utf-8 -*-
""" Define the Attention Layer of the model.
"""
from __future__ import print_function, division
import torch
from torch.autograd import Variable
from torch.nn import Module
from torch.nn.parameter import Parameter
class Attention(Module):
"""
Computes a weighted average of the diffe... | [
"torch.FloatTensor",
"torch.LongTensor"
] | [((971, 1004), 'torch.FloatTensor', 'torch.FloatTensor', (['attention_size'], {}), '(attention_size)\n', (988, 1004), False, 'import torch\n'), ((1958, 1983), 'torch.LongTensor', 'torch.LongTensor', (['max_len'], {}), '(max_len)\n', (1974, 1983), False, 'import torch\n')] |
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.16.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class Release(object):
"""NOTE: This class is auto ge... | [
"six.iteritems"
] | [((10549, 10582), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (10562, 10582), False, 'import six\n')] |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
# Modified 2017 Microsoft 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... | [
"tensorflow.app.flags.DEFINE_float",
"tensorflow.nn.zero_fraction",
"tensorflow.get_collection",
"tensorflow.train.RMSPropOptimizer",
"tensorflow.logging.set_verbosity",
"tensorflow.app.flags.DEFINE_boolean",
"numpy.random.randint",
"tensorflow.train.latest_checkpoint",
"tensorflow.python.ops.contro... | [((1201, 1324), 'tensorflow.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['"""train_dir"""', '"""D:\\\\tf\\\\models"""', '"""Directory where checkpoints and event logs are written to."""'], {}), "('train_dir', 'D:\\\\tf\\\\models',\n 'Directory where checkpoints and event logs are written to.')\n", (1227... |
import datetime
from tornado.web import RequestHandler
from websdk.db_context import DBContext
from libs.aws.session import get_aws_session
from libs.base_handler import BaseHandler
from libs.web_logs import ins_log
from models.com_ami import ComAmi
from models.uncom_ec2 import UnComEc2
from settings import settings
... | [
"datetime.datetime.strftime",
"websdk.db_context.DBContext",
"datetime.datetime.strptime",
"libs.web_logs.ins_log.read_log",
"settings.settings.get",
"datetime.timedelta",
"datetime.datetime.now"
] | [((494, 508), 'websdk.db_context.DBContext', 'DBContext', (['"""w"""'], {}), "('w')\n", (503, 508), False, 'from websdk.db_context import DBContext\n'), ((1716, 1775), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['times', '"""%Y-%m-%dT%H:%M:%S.000Z"""'], {}), "(times, '%Y-%m-%dT%H:%M:%S.000Z')\n", (174... |
import jieba
import pandas as pd
import numpy as np
from sklearn import feature_extraction
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_extraction.text import CountVectorizer
import time
import os
import re
def readExcel(url):
df=pd.read_excel(url,na_values='')
return df
d... | [
"pandas.DataFrame",
"sklearn.feature_extraction.text.CountVectorizer",
"os.path.abspath",
"jieba.cut",
"os.walk",
"time.clock",
"pandas.read_excel",
"numpy.array",
"numpy.dot",
"pandas.ExcelWriter",
"re.compile"
] | [((272, 304), 'pandas.read_excel', 'pd.read_excel', (['url'], {'na_values': '""""""'}), "(url, na_values='')\n", (285, 304), True, 'import pandas as pd\n'), ((358, 377), 'pandas.ExcelWriter', 'pd.ExcelWriter', (['url'], {}), '(url)\n', (372, 377), True, 'import pandas as pd\n'), ((566, 614), 'pandas.DataFrame', 'pd.Dat... |
# ============================================================================
# 第十章 家電・調理
# Ver.04(エネルギー消費性能計算プログラム(住宅版)Ver.02~)
# ============================================================================
import numpy as np
from pyhees.section11_3 import load_schedule, get_schedule_app, get_schedule_cc
# =======... | [
"pyhees.section11_3.get_schedule_cc",
"pyhees.section11_3.get_schedule_app",
"numpy.zeros",
"pyhees.section11_3.load_schedule",
"numpy.repeat"
] | [((823, 838), 'pyhees.section11_3.load_schedule', 'load_schedule', ([], {}), '()\n', (836, 838), False, 'from pyhees.section11_3 import load_schedule, get_schedule_app, get_schedule_cc\n'), ((858, 884), 'pyhees.section11_3.get_schedule_app', 'get_schedule_app', (['schedule'], {}), '(schedule)\n', (874, 884), False, 'fr... |
import pytest
import traceback
from flask_unchained.bundles.security.commands.roles import list_roles, create_role, delete_role
class TestRolesCommands:
@pytest.mark.roles(dict(name='role1'),
dict(name='role2'),
dict(name='role3'))
def test_list_roles(self, roles... | [
"pytest.mark.role",
"traceback.print_exception"
] | [((1165, 1195), 'pytest.mark.role', 'pytest.mark.role', ([], {'name': '"""role1"""'}), "(name='role1')\n", (1181, 1195), False, 'import pytest\n'), ((420, 463), 'traceback.print_exception', 'traceback.print_exception', (['*result.exc_info'], {}), '(*result.exc_info)\n', (445, 463), False, 'import traceback\n'), ((993, ... |
#!/usr/bin/python
# This scripts loads a pretrained model and a raw .txt files. It then performs sentence splitting and tokenization and passes
# the input sentences to the model for tagging. Prints the tokens and the tags in a CoNLL format to stdout
# Usage: python RunModel.py modelPath inputPath
# For pretrained mode... | [
"util.preprocessing.addCharInformation",
"util.preprocessing.createMatrices",
"jieba.cut",
"nltk.sent_tokenize",
"util.preprocessing.addCasingInformation",
"time.time",
"neuralnets.BiLSTM.BiLSTM.loadModel",
"nltk.word_tokenize"
] | [((1356, 1384), 'neuralnets.BiLSTM.BiLSTM.loadModel', 'BiLSTM.loadModel', (['model_path'], {}), '(model_path)\n', (1372, 1384), False, 'from neuralnets.BiLSTM import BiLSTM\n'), ((1877, 1906), 'util.preprocessing.addCharInformation', 'addCharInformation', (['sentences'], {}), '(sentences)\n', (1895, 1906), False, 'from... |
from web3 import Web3
from constants import Constants
w3 = Web3(Web3.HTTPProvider("https://api.avax.network/ext/bc/C/rpc"))
if not w3.isConnected():
print("Error web3 can't connect")
ipefi_contract = w3.eth.contract(address=Constants.IPEFI_ADDRESS, abi=Constants.IPEFI_ABI)
def getIPefiRatio():
return w3.from... | [
"web3.Web3.HTTPProvider"
] | [((66, 124), 'web3.Web3.HTTPProvider', 'Web3.HTTPProvider', (['"""https://api.avax.network/ext/bc/C/rpc"""'], {}), "('https://api.avax.network/ext/bc/C/rpc')\n", (83, 124), False, 'from web3 import Web3\n')] |