code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.contrib import admin
from .models import Student
@admin.register(Student)
class StudentAdmin(admin.ModelAdmin):
list_display = ("last_name", "first_name", "age")
list_filter = ("age", "last_name")
search_fields = ("last_name__startswith", ) | [
"django.contrib.admin.register"
] | [((65, 88), 'django.contrib.admin.register', 'admin.register', (['Student'], {}), '(Student)\n', (79, 88), False, 'from django.contrib import admin\n')] |
"""add colum i
Revision ID: <KEY>
Revises:
Create Date: 2017-12-01 18:28:08.328807
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic... | [
"alembic.op.drop_column",
"sqlalchemy.Integer"
] | [((539, 568), 'alembic.op.drop_column', 'op.drop_column', (['"""groups"""', '"""i"""'], {}), "('groups', 'i')\n", (553, 568), False, 'from alembic import op\n'), ((385, 397), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (395, 397), True, 'import sqlalchemy as sa\n')] |
import scanpy as sc
import numpy as np
import licorice
import matplotlib.pyplot as plt
import vinplots
def _build_plot(geneset_score_key):
fig = vinplots.Plot()
fig.construct(
nplots=5,
ncols=5,
width_ratios=[2, 2, 2, 2, 0.05],
wspace=0.15,
figsize_width=1,
)
f... | [
"matplotlib.pyplot.colorbar",
"scanpy.tl.score_genes",
"vinplots.Plot",
"scanpy.pl.umap"
] | [((152, 167), 'vinplots.Plot', 'vinplots.Plot', ([], {}), '()\n', (165, 167), False, 'import vinplots\n'), ((2533, 2587), 'matplotlib.pyplot.colorbar', 'plt.colorbar', (['im0'], {'cax': 'axes[4]', 'orientation': '"""vertical"""'}), "(im0, cax=axes[4], orientation='vertical')\n", (2545, 2587), True, 'import matplotlib.p... |
import numpy as np
def sigmoid(x):
indp = np.where(x>=0)
indn = np.where(x<0)
tx = np.zeros(x.shape)
tx[indp] = 1./(1.+np.exp(-x[indp]))
tx[indn] = np.exp(x[indn])/(1.+np.exp(x[indn]))
return tx
def sigmoid_prime(x):
return sigmoid(x) * (1 - sigmoid(x))
def KL_divergence(x, y)... | [
"numpy.tile",
"numpy.sqrt",
"numpy.where",
"numpy.random.random",
"numpy.log",
"numpy.exp",
"numpy.sum",
"numpy.zeros"
] | [((57, 73), 'numpy.where', 'np.where', (['(x >= 0)'], {}), '(x >= 0)\n', (65, 73), True, 'import numpy as np\n'), ((83, 98), 'numpy.where', 'np.where', (['(x < 0)'], {}), '(x < 0)\n', (91, 98), True, 'import numpy as np\n'), ((106, 123), 'numpy.zeros', 'np.zeros', (['x.shape'], {}), '(x.shape)\n', (114, 123), True, 'im... |
from unittest.mock import patch
import pytest
from pycbc.handlers import check
@pytest.fixture(autouse=True)
def override_config(config):
with patch('pycbc.handlers.check.load') as mock:
mock.return_value = config
yield mock
@pytest.fixture
def invalid_event():
return {
'queryStrin... | [
"pytest.fixture",
"unittest.mock.patch",
"pycbc.handlers.check.handler"
] | [((84, 112), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (98, 112), False, 'import pytest\n'), ((704, 738), 'pycbc.handlers.check.handler', 'check.handler', (['invalid_event', 'None'], {}), '(invalid_event, None)\n', (717, 738), False, 'from pycbc.handlers import check\n'), ((90... |
import time
import wandb
import torch
import torch.nn as nn
from torch.nn.parallel import DistributedDataParallel as DDP
from distiller.models import model_extractor, Embed, ConvReg, LinearEmbed
from distiller.models import Connector, Translator, Paraphraser, Rescaler, MLP
from distiller.dataset.loaders import build... | [
"wandb.log",
"torch.nn.CrossEntropyLoss",
"distiller.helper.parser.parse_option_student",
"distiller.models.Connector",
"wandb.init",
"torch.nn.MSELoss",
"torch.cuda.is_available",
"distiller.distiller_zoo.PKT",
"distiller.distiller_zoo.DistillKL",
"torch.cuda.max_memory_reserved",
"distiller.mo... | [((1026, 1037), 'time.time', 'time.time', ([], {}), '()\n', (1035, 1037), False, 'import time\n'), ((1085, 1107), 'distiller.helper.parser.parse_option_student', 'parse_option_student', ([], {}), '()\n', (1105, 1107), False, 'from distiller.helper.parser import parse_option_student\n'), ((1112, 1143), 'distiller.helper... |
from brownie import (
accounts, ERC20KP3ROracle, UniswapV2Oracle, ProxyOracle, CoreOracle,
CurveOracle, WERC20, UbeswapV1Oracle, HomoraBank, UniswapV2SpellV1, SafeBox,
SimpleOracle, WStakingRewards
)
from brownie import interface
from .utils import *
import json
def main():
deployer = accounts.load('ad... | [
"brownie.HomoraBank.at",
"brownie.UniswapV2SpellV1.at",
"brownie.SimpleOracle.deploy",
"brownie.interface.IERC20Ex",
"brownie.WStakingRewards.at",
"brownie.accounts.load",
"brownie.CoreOracle.at",
"json.load"
] | [((303, 325), 'brownie.accounts.load', 'accounts.load', (['"""admin"""'], {}), "('admin')\n", (316, 325), False, 'from brownie import accounts, ERC20KP3ROracle, UniswapV2Oracle, ProxyOracle, CoreOracle, CurveOracle, WERC20, UbeswapV1Oracle, HomoraBank, UniswapV2SpellV1, SafeBox, SimpleOracle, WStakingRewards\n'), ((338... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... | [
"pulumi.getter",
"pulumi.set",
"pulumi.ResourceOptions",
"pulumi.get"
] | [((5810, 5839), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""axfrIps"""'}), "(name='axfrIps')\n", (5823, 5839), False, 'import pulumi\n'), ((6698, 6729), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""expireSec"""'}), "(name='expireSec')\n", (6711, 6729), False, 'import pulumi\n'), ((7622, 7653), 'pulumi.ge... |
from census import Census
from census_tract_race_population import CensusTractRacePopulation
import sys
from us import states
if __name__ == '__main__':
if len(sys.argv) == 1:
print('Provide your Census API token as an argument when running this script.')
sys.exit()
api_key = sys.argv[1]
i... | [
"census_tract_race_population.CensusTractRacePopulation.get_race_display",
"sys.exit",
"census_tract_race_population.CensusTractRacePopulation.get_all_races",
"census_tract_race_population.CensusTractRacePopulation.fetch"
] | [((456, 578), 'census_tract_race_population.CensusTractRacePopulation.fetch', 'CensusTractRacePopulation.fetch', (['api_key', 'states.MO.fips', 'CensusTractRacePopulation.COUNTY_CODE_JACKSON_MO', 'Census.ALL'], {}), '(api_key, states.MO.fips,\n CensusTractRacePopulation.COUNTY_CODE_JACKSON_MO, Census.ALL)\n', (487, ... |
"""
Callback signatures for typing.
Since these signatures contain a lot of copy-pasted kwargs and are
not so important for the codebase, they are moved to this separate module.
"""
import logging
from typing import NewType, Any, Union, Optional
from typing_extensions import Protocol
from kopf.structs import bodies
... | [
"typing.NewType"
] | [((559, 591), 'typing.NewType', 'NewType', (['"""HandlerResult"""', 'object'], {}), "('HandlerResult', object)\n", (566, 591), False, 'from typing import NewType, Any, Union, Optional\n')] |
import json
import traceback
import uuid
import datetime
from isodate import duration_isoformat
from motorway.utils import DateTimeAwareJsonEncoder
import logging
class Message(object):
"""
:param ramp_unique_id: the unique message ID delivered back upon completion to the ramp
:param content: any json ser... | [
"isodate.duration_isoformat",
"datetime.datetime.now",
"traceback.format_exc",
"uuid.uuid4"
] | [((1283, 1306), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1304, 1306), False, 'import datetime\n'), ((4584, 4617), 'isodate.duration_isoformat', 'duration_isoformat', (['time_consumed'], {}), '(time_consumed)\n', (4602, 4617), False, 'from isodate import duration_isoformat\n'), ((879, 891), '... |
import numpy as np
import torch
class Compose(object):
"""Composes several transforms together.
Args:
transforms (list of ``Transform`` objects): list of transforms
to compose.
Example:
>>> transforms.Compose([
>>> transforms.MriNoise(),
... | [
"numpy.absolute",
"numpy.reshape"
] | [((722, 755), 'numpy.reshape', 'np.reshape', (['dat', '((1,) + dat.shape)'], {}), '(dat, (1,) + dat.shape)\n', (732, 755), True, 'import numpy as np\n'), ((822, 851), 'numpy.absolute', 'np.absolute', (["sample['target']"], {}), "(sample['target'])\n", (833, 851), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
import lasagne
def slicpad_layers(layer, number_of_convs, filter_size, BATCH_SIZE, VOCAB, SEQ_SIZE, form='whole'):
""" Slices and pads convolutional layer.
Outputs: the padding layer """
mini_seqs = []
if form == 'whole':
for i in range(0, len(VOCAB) * SEQ_SIZE - ... | [
"lasagne.layers.ConcatLayer",
"lasagne.layers.DimshuffleLayer"
] | [((754, 809), 'lasagne.layers.ConcatLayer', 'lasagne.layers.ConcatLayer', ([], {'incomings': 'mini_seqs', 'axis': '(1)'}), '(incomings=mini_seqs, axis=1)\n', (780, 809), False, 'import lasagne\n'), ((2242, 2300), 'lasagne.layers.ConcatLayer', 'lasagne.layers.ConcatLayer', ([], {'incomings': 'convolutions', 'axis': '(1)... |
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2014, <NAME> <<EMAIL>>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice, this... | [
"solvcon.gendata.AttributeDict"
] | [((1981, 2004), 'solvcon.gendata.AttributeDict', 'gendata.AttributeDict', ([], {}), '()\n', (2002, 2004), False, 'from solvcon import gendata\n')] |
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.mixture import GaussianMixture
import matplotlib.pyplot as plt
from sklearn.neighbors import KernelDensity
import numpy as np
data = load_iris()
data.feature_names, data.target_names
X_train, X_test, y_train, y_t... | [
"sklearn.datasets.load_iris",
"sklearn.mixture.GaussianMixture",
"sklearn.model_selection.train_test_split",
"sklearn.neighbors.KernelDensity",
"numpy.exp",
"matplotlib.pyplot.title",
"sklearn.metrics.accuracy_score",
"matplotlib.pyplot.show"
] | [((239, 250), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (248, 250), False, 'from sklearn.datasets import load_iris\n'), ((326, 398), 'sklearn.model_selection.train_test_split', 'train_test_split', (['data.data', 'data.target'], {'test_size': '(0.33)', 'random_state': '(3)'}), '(data.data, data.target... |
import contextlib
from typing import Optional, Set
import gevent
from celery.app.task import Task as CeleryTask
from celery.signals import celeryd_init, worker_shutting_down
from celery.utils.log import get_task_logger
from redis.exceptions import LockError
from .redis import get_redis
from .utils import close_gevent... | [
"redis.exceptions.LockError",
"psycogreen.gevent.patch_psycopg",
"gevent.spawn",
"celery.utils.log.get_task_logger"
] | [((345, 370), 'celery.utils.log.get_task_logger', 'get_task_logger', (['__name__'], {}), '(__name__)\n', (360, 370), False, 'from celery.utils.log import get_task_logger\n'), ((954, 969), 'psycogreen.gevent.patch_psycopg', 'patch_psycopg', ([], {}), '()\n', (967, 969), False, 'from psycogreen.gevent import patch_psycop... |
import numpy as np
import collections
from PIL import Image
from generic.data_provider.batchifier import AbstractBatchifier
from generic.data_provider.image_preprocessors import get_spatial_feat, resize_image
from generic.data_provider.nlp_utils import padder,padder_3d,padder_4d
from generic.data_provider.nlp_utils im... | [
"PIL.Image.fromarray",
"generic.data_provider.nlp_utils.Embeddings",
"generic.data_provider.nlp_utils.get_embeddings",
"numpy.asarray",
"generic.data_provider.nlp_utils.padder_4d",
"numpy.array",
"numpy.zeros",
"collections.defaultdict",
"generic.data_provider.nlp_utils.padder",
"generic.data_prov... | [((698, 733), 'numpy.array', 'np.array', (['[1, 0, 0]'], {'dtype': 'np.int32'}), '([1, 0, 0], dtype=np.int32)\n', (706, 733), True, 'import numpy as np\n'), ((748, 783), 'numpy.array', 'np.array', (['[0, 1, 0]'], {'dtype': 'np.int32'}), '([0, 1, 0], dtype=np.int32)\n', (756, 783), True, 'import numpy as np\n'), ((799, ... |
################################################################################
#
# Project manager class
#
################################################################################
from SCons.Script import *
import glob
from scons.buildconfig import BuildConfig
class Project:
def __init__(self, name, env,... | [
"scons.buildconfig.BuildConfig",
"glob.glob"
] | [((407, 420), 'scons.buildconfig.BuildConfig', 'BuildConfig', ([], {}), '()\n', (418, 420), False, 'from scons.buildconfig import BuildConfig\n'), ((2969, 3000), 'glob.glob', 'glob.glob', (["(directory + '/*.cpp')"], {}), "(directory + '/*.cpp')\n", (2978, 3000), False, 'import glob\n'), ((3050, 3079), 'glob.glob', 'gl... |
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from django.http import Http404
from django.template import loader
from .models import File
from django.views.generic.edit import CreateView
from django.views import generic
# Create your views here.
def index(request):
all_fi... | [
"django.shortcuts.render"
] | [((507, 556), 'django.shortcuts.render', 'render', (['request', '"""uploadfile/index.html"""', 'context'], {}), "(request, 'uploadfile/index.html', context)\n", (513, 556), False, 'from django.shortcuts import render, get_object_or_404\n')] |
# Copyright 2021 <NAME>
# Copyright 2021 <NAME>
# Copyright 2021 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by ... | [
"rpyc.utils.registry.UDPRegistryClient",
"rpyc.connect"
] | [((1913, 1932), 'rpyc.utils.registry.UDPRegistryClient', 'UDPRegistryClient', ([], {}), '()\n', (1930, 1932), False, 'from rpyc.utils.registry import UDPRegistryClient\n'), ((4708, 4730), 'rpyc.connect', 'rpyc.connect', (['ip', 'port'], {}), '(ip, port)\n', (4720, 4730), False, 'import rpyc\n'), ((3063, 3085), 'rpyc.co... |
#This file was created by <NAME>
import unittest
from Slice import Slice
#These tests are set to test the recent addition of the actualBrightess variable within Slice
class SliceTestHarness(unittest.TestCase):
def testObjectCreation(self):
slice = Slice(2000, 2500, "Star 1", 30, 20000)
... | [
"Slice.Slice"
] | [((274, 312), 'Slice.Slice', 'Slice', (['(2000)', '(2500)', '"""Star 1"""', '(30)', '(20000)'], {}), "(2000, 2500, 'Star 1', 30, 20000)\n", (279, 312), False, 'from Slice import Slice\n'), ((642, 680), 'Slice.Slice', 'Slice', (['(2000)', '(2500)', '"""Star 1"""', '(50)', '(20000)'], {}), "(2000, 2500, 'Star 1', 50, 200... |
import sys
from math import sqrt, floor, log
sys.argv.pop(0)
board_size = floor(sqrt(len(sys.argv)))
args = list(map(int, sys.argv))
sol_cnt = floor(log(max(args), 2))
for sol in range(1, sol_cnt+1):
for i in range(board_size):
for j in range(board_size):
if args[i*board_size + j] & (1 << sol)... | [
"sys.argv.pop"
] | [((46, 61), 'sys.argv.pop', 'sys.argv.pop', (['(0)'], {}), '(0)\n', (58, 61), False, 'import sys\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 13 14:10:46 2019
@author: gui
"""
import sys, pygame
import numpy as np
from pygame.locals import *
import pygame.freetype
w = 600
h = 600
scale = 100
WHITE = (255, 255, 255)
BLUE = (0, 0, 255)
score = max_score = 0
pygame.init()
screen = pygame.... | [
"pygame.event.clear",
"pygame.init",
"pygame.draw.line",
"pygame.Surface",
"sys.exit",
"pygame.display.set_mode",
"numpy.random.choice",
"pygame.time.Clock",
"numpy.count_nonzero",
"pygame.event.wait",
"numpy.zeros",
"numpy.random.randint",
"pygame.display.set_caption",
"pygame.freetype.Sy... | [((290, 303), 'pygame.init', 'pygame.init', ([], {}), '()\n', (301, 303), False, 'import sys, pygame\n'), ((313, 344), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(w, h)'], {}), '((w, h))\n', (336, 344), False, 'import sys, pygame\n'), ((344, 389), 'pygame.display.set_caption', 'pygame.display.set_caption'... |
#!/usr/bin/env python3
import xcffib.xproto as xproto
import xcffib
import time
from common import set_window_name
conn = xcffib.connect()
setup = conn.get_setup()
root = setup.roots[0].root
visual = setup.roots[0].root_visual
depth = setup.roots[0].root_depth
name = "_NET_WM_STATE"
name_atom = conn.core.InternAtom(... | [
"xcffib.connect",
"time.sleep"
] | [((124, 140), 'xcffib.connect', 'xcffib.connect', ([], {}), '()\n', (138, 140), False, 'import xcffib\n'), ((821, 836), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (831, 836), False, 'import time\n'), ((922, 937), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (932, 937), False, 'import time\n'), (... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="turbigen",
version="0.1.0",
author="<NAME>",
author_email="<EMAIL>",
description="Axial turbine design system.",
long_description=long_description,
long_description_content_type="t... | [
"setuptools.setup"
] | [((88, 639), 'setuptools.setup', 'setuptools.setup', ([], {'name': '"""turbigen"""', 'version': '"""0.1.0"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""Axial turbine design system."""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', '... |
# Useless
from nltk.chat.util import Chat, reflections
pairs = [
[
r"(.*)my name is (.*)",
["Hello %2, How are you today ?",]
],[
r"(.*) your name ?",
["My name is chat_bot.",]
],[
r"quit",
["Bye", "F off",]
],
]
chat = Chat(pairs, reflections)
chat.con... | [
"nltk.chat.util.Chat"
] | [((287, 311), 'nltk.chat.util.Chat', 'Chat', (['pairs', 'reflections'], {}), '(pairs, reflections)\n', (291, 311), False, 'from nltk.chat.util import Chat, reflections\n')] |
from django.db import transaction
class AtomicMixin(object):
"""
Ensures we rollback db transactions on exceptions.
Idea from https://github.com/tomchristie/django-rest-framework/pull/1204
"""
@transaction.atomic()
def dispatch(self, *args, **kwargs):
return super(AtomicMixin, self).dis... | [
"django.db.transaction.set_rollback",
"django.db.transaction.atomic"
] | [((215, 235), 'django.db.transaction.atomic', 'transaction.atomic', ([], {}), '()\n', (233, 235), False, 'from django.db import transaction\n'), ((616, 646), 'django.db.transaction.set_rollback', 'transaction.set_rollback', (['(True)'], {}), '(True)\n', (640, 646), False, 'from django.db import transaction\n')] |
import os
import sys
import cv2
img_path = 'data1/images'
#gt_path = 'didi3/images2'
def read_path(file_pathname):
#遍历该目录下的所有图片文件
for filename in os.listdir(file_pathname):
#print(filename)
img = cv2.imread(file_pathname+'/'+filename)
new_image = cv2.resize(img, (1640,590), interpolat... | [
"cv2.imwrite",
"cv2.resize",
"os.listdir",
"cv2.imread"
] | [((157, 182), 'os.listdir', 'os.listdir', (['file_pathname'], {}), '(file_pathname)\n', (167, 182), False, 'import os\n'), ((223, 265), 'cv2.imread', 'cv2.imread', (["(file_pathname + '/' + filename)"], {}), "(file_pathname + '/' + filename)\n", (233, 265), False, 'import cv2\n'), ((282, 340), 'cv2.resize', 'cv2.resize... |
from packerlicious import builder, provisioner, Template
template = Template()
template.add_builder(
builder.vmware-iso(
)
)
{
"description": "Packer Windows Server 2016 build template file.",
"_comment": "Template file provides framework for subsequent packer builds.",
"variables": {
"os-iso-pa... | [
"packerlicious.Template"
] | [((68, 78), 'packerlicious.Template', 'Template', ([], {}), '()\n', (76, 78), False, 'from packerlicious import builder, provisioner, Template\n')] |
from django.shortcuts import render, get_object_or_404
from .forms import PostForm, CommentForm
from .models import Post, Group, User, Comment, Follow
from django.utils import timezone
from django.shortcuts import redirect
from django import forms
from django.core.paginator import Paginator
from django.http import Http... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"django.shortcuts.get_object_or_404",
"django.core.paginator.Paginator"
] | [((716, 740), 'django.core.paginator.Paginator', 'Paginator', (['post_list', '(10)'], {}), '(post_list, 10)\n', (725, 740), False, 'from django.core.paginator import Paginator\n'), ((1051, 1138), 'django.shortcuts.render', 'render', (['request', '"""index.html"""', "{'page': page, 'paginator': paginator, 'form': form}"... |
from datetime import datetime, timedelta
from tempfile import NamedTemporaryFile
from unittest import TestCase
import os
from filesystems.exceptions import FileExists
from venvs import _config
from venvs.tests.utils import CLIMixin
class TestConverge(CLIMixin, TestCase):
def test_it_creates_missing_virtualenvs(... | [
"datetime.datetime.fromtimestamp",
"os.path.expandvars",
"tempfile.NamedTemporaryFile",
"os.path.getmtime",
"datetime.timedelta",
"os.path.expanduser"
] | [((4068, 4100), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', ([], {'delete': '(False)'}), '(delete=False)\n', (4086, 4100), False, 'from tempfile import NamedTemporaryFile\n'), ((4163, 4190), 'os.path.getmtime', 'os.path.getmtime', (['file.name'], {}), '(file.name)\n', (4179, 4190), False, 'import os\n'), ((492... |
from mock import patch, mock, ANY
from pathlib import Path
from context_cli.core import (
start_and_end_delimiter_context_factory_creator, single_delimiter_context_factory_creator,
get_context_factory_from_args, build_pipeline, construct_arg_parser,
parse_args, main
)
from context_cli.util import TypeArgDo... | [
"mock.patch",
"context_cli.core.construct_arg_parser",
"context_cli.core.single_delimiter_context_factory_creator",
"context_cli.core.build_pipeline",
"context_cli.core.parse_args",
"pathlib.Path",
"context_cli.core.get_context_factory_from_args",
"mock.mock.MagicMock",
"context_cli.core.start_and_e... | [((367, 462), 'mock.patch', 'patch', (['"""context_cli.context.StartAndEndDelimiterContextFactory.__init__"""'], {'return_value': 'None'}), "('context_cli.context.StartAndEndDelimiterContextFactory.__init__',\n return_value=None)\n", (372, 462), False, 'from mock import patch, mock, ANY\n'), ((1472, 1562), 'mock.pat... |
"""
DMRG for XXZ model.
"""
from typing import Type, Text
import tensornetwork as tn
import numpy as np
tn.set_default_backend('pytorch')
def initialize_spin_mps(N: int, D: int, dtype: Type[np.number]):
return tn.FiniteMPS.random([2] * N, [D] * (N - 1), dtype=dtype)
def initialize_XXZ_mpo(Jz: np.ndarray, Jxy: np.... | [
"numpy.ones",
"tensornetwork.set_default_backend",
"numpy.zeros",
"tensornetwork.FiniteDMRG",
"tensornetwork.FiniteXXZ",
"tensornetwork.FiniteMPS.random"
] | [((106, 139), 'tensornetwork.set_default_backend', 'tn.set_default_backend', (['"""pytorch"""'], {}), "('pytorch')\n", (128, 139), True, 'import tensornetwork as tn\n'), ((214, 270), 'tensornetwork.FiniteMPS.random', 'tn.FiniteMPS.random', (['([2] * N)', '([D] * (N - 1))'], {'dtype': 'dtype'}), '([2] * N, [D] * (N - 1)... |
from ctreport_selenium.ctreport_html.testdetail import summary,details
def content(status, tests, reference):
c = '''
<div id="test-view" class="wrapper" style="display: none;">
<div class="container-fluid">
<section class="pading">
<div class="row mt-3">
... | [
"ctreport_selenium.ctreport_html.testdetail.summary.content",
"ctreport_selenium.ctreport_html.testdetail.details.content"
] | [((486, 508), 'ctreport_selenium.ctreport_html.testdetail.details.content', 'details.content', (['tests'], {}), '(tests)\n', (501, 508), False, 'from ctreport_selenium.ctreport_html.testdetail import summary, details\n'), ((372, 413), 'ctreport_selenium.ctreport_html.testdetail.summary.content', 'summary.content', (['s... |
# Copyright (C) 2019 New York University.
#
# This file is part of REANA Templates. REANA Templates is free software; you
# can redistribute it and/or modify it under the terms of the MIT License; see
# LICENSE file for more details.
"""The REANA template store is used to maintain workflow templates as well as
any fix... | [
"os.listdir",
"os.path.join",
"reanatempl.util.template.base.TemplateHandle.create",
"os.path.isdir",
"reanatempl.util.template.base.TemplateHandle.load",
"shutil.rmtree",
"os.path.abspath"
] | [((1532, 1558), 'os.path.abspath', 'os.path.abspath', (['directory'], {}), '(directory)\n', (1547, 1558), False, 'import os\n'), ((1742, 1768), 'os.listdir', 'os.listdir', (['self.directory'], {}), '(self.directory)\n', (1752, 1768), False, 'import os\n'), ((3181, 3378), 'reanatempl.util.template.base.TemplateHandle.cr... |
# Copyright 2015 Google Inc. 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 applicable law or ... | [
"models.custom_modules.Module",
"modules.course_theme.settings.CourseThemeSettings.register"
] | [((986, 1025), 'modules.course_theme.settings.CourseThemeSettings.register', 'settings.CourseThemeSettings.register', ([], {}), '()\n', (1023, 1025), False, 'from modules.course_theme import settings\n'), ((1072, 1192), 'models.custom_modules.Module', 'custom_modules.Module', (['MODULE_NAME', '"""Provides library to re... |
"""
Tool to generate python api code from swagger spec
"""
import inflection
import jinja2
swagger_types = {
'string': 'str',
'integer': 'int',
'int64': 'int',
'int32': 'int',
'uint64': 'int',
'boolean': 'bool',
'byte': 'str',
'object': 'dict'
}
def swagger_type(prop):
if prop._i... | [
"os.path.exists",
"jinja2.Environment",
"etcd3.swagger_helper.SwaggerSpec",
"yapf.yapflib.yapf_api.FormatCode",
"os.path.join",
"os.path.dirname",
"os.mkdir"
] | [((521, 557), 'jinja2.Environment', 'jinja2.Environment', ([], {'autoescape': '(False)'}), '(autoescape=False)\n', (539, 557), False, 'import jinja2\n'), ((3135, 3164), 'etcd3.swagger_helper.SwaggerSpec', 'SwaggerSpec', (['rpc_swagger_json'], {}), '(rpc_swagger_json)\n', (3146, 3164), False, 'from etcd3.swagger_helper ... |
from flask import Flask
from flask import render_template
from flask import request
from flask import session
from flask import redirect # I will learn after that will use
from flask import url_for # I will learn after that will use
from flask import flash # I will learn after that will use
import pymysql.cursors
i... | [
"flask.render_template",
"flask.session.get",
"flask.Flask",
"os.urandom",
"flask.redirect"
] | [((381, 396), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (386, 396), False, 'from flask import Flask\n'), ((1478, 1557), 'flask.render_template', 'render_template', (['"""category.html"""'], {'result': 'records', 'signed_in_text': 'signed_in_text'}), "('category.html', result=records, signed_in_text=si... |
from .main import BasicBuild
from .csv_export import export_csvs
import zipfile
import os
import pandas as pd
from pathlib import Path
from datetime import datetime
from importlib import resources
from reportlab.platypus import (
SimpleDocTemplate,
ListFlowable,
Paragraph,
Spacer,
Image,
PageBre... | [
"reportlab.platypus.PageBreak",
"reportlab.platypus.Image",
"math.ceil",
"zipfile.ZipFile",
"pathlib.Path.cwd",
"importlib.resources.path",
"basicsynbio.utils.clips_data_from_pandas",
"reportlab.platypus.Paragraph",
"reportlab.platypus.Spacer",
"datetime.datetime.now",
"reportlab.platypus.Simple... | [((1483, 1651), 'pandas.DataFrame', 'pd.DataFrame', (["{'Component': ['Promega T4 DNA Ligase 10x Buffer', 'Water', 'NEB BsaI-HFv2',\n 'Promega T4 DNA Ligase'], 'Volume per clip (µL)': [3, 15.5, 1, 0.5]}"], {}), "({'Component': ['Promega T4 DNA Ligase 10x Buffer', 'Water',\n 'NEB BsaI-HFv2', 'Promega T4 DNA Ligase... |
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
from supernodes import views as supernode_views
from nodes import views as node_views
from sensors import views as sensor_views
urlpatterns = [
url(r'^$', supernode_views.SuperNodesList.as_view(), name="supernodes-all"),... | [
"sensors.views.SupernodeSensorDetail.as_view",
"sensors.views.SupernodeSensorsList.as_view",
"supernodes.views.SupernodeDetail.as_view",
"supernodes.views.SuperNodesList.as_view",
"nodes.views.NodesList.as_view",
"rest_framework.urlpatterns.format_suffix_patterns"
] | [((777, 812), 'rest_framework.urlpatterns.format_suffix_patterns', 'format_suffix_patterns', (['urlpatterns'], {}), '(urlpatterns)\n', (799, 812), False, 'from rest_framework.urlpatterns import format_suffix_patterns\n'), ((255, 295), 'supernodes.views.SuperNodesList.as_view', 'supernode_views.SuperNodesList.as_view', ... |
import torch.nn as nn
import torch.nn.functional as F
__all__ = [
'NeuralCF',
]
class NeuralCF(nn.Module):
''' Neural Collaborative Filtering Recommender System '''
def __init__(self, num_users=100, user_embedding_dim=256, item_embedding_dim=512, num_cf_layers=4):
super(NeuralCF, self).__init__(... | [
"torch.nn.Sigmoid",
"torch.nn.ReLU",
"torch.nn.Tanh",
"torch.nn.functional.binary_cross_entropy",
"torch.nn.Linear",
"torch.nn.Embedding"
] | [((608, 651), 'torch.nn.Embedding', 'nn.Embedding', (['num_users', 'user_embedding_dim'], {}), '(num_users, user_embedding_dim)\n', (620, 651), True, 'import torch.nn as nn\n'), ((1468, 1505), 'torch.nn.functional.binary_cross_entropy', 'F.binary_cross_entropy', (['input', 'target'], {}), '(input, target)\n', (1490, 15... |
import random
import sys
import uuid
import gevent
from locust import events, HttpLocust, TaskSet, task
from ws import RyuStarReconnectingWebsocketClient
class UserWithAccount(TaskSet):
def on_start(self):
# Client creates account when user chooses to vote
# So always perform a vote immediately ... | [
"locust.task",
"ws.RyuStarReconnectingWebsocketClient",
"gevent.getcurrent",
"uuid.uuid4",
"sys.exc_info",
"random.random"
] | [((371, 378), 'locust.task', 'task', (['(1)'], {}), '(1)\n', (375, 378), False, 'from locust import events, HttpLocust, TaskSet, task\n'), ((482, 490), 'locust.task', 'task', (['(30)'], {}), '(30)\n', (486, 490), False, 'from locust import events, HttpLocust, TaskSet, task\n'), ((539, 546), 'locust.task', 'task', (['(5... |
from ftplib import FTP
class FTPInterface(object):
"""
Interface for an FTP wrapper class.
"""
def change_dir(self, target):
raise NotImplemented
def download(self, target, destination):
raise NotImplemented
def upload(self, target, destination):
raise NotImplemented
... | [
"ftplib.FTP"
] | [((796, 812), 'ftplib.FTP', 'FTP', (['domain_name'], {}), '(domain_name)\n', (799, 812), False, 'from ftplib import FTP\n')] |
import argparse
import asyncio
import logging
import sys
import yaml
from senor_octopus import __version__
from senor_octopus.graph import build_dag
from senor_octopus.lib import render_dag
from senor_octopus.scheduler import Scheduler
__author__ = "<NAME>"
__copyright__ = "<NAME>"
__license__ = "MIT"
_logger = logg... | [
"logging.getLogger",
"logging.basicConfig",
"senor_octopus.scheduler.Scheduler",
"argparse.ArgumentParser",
"yaml.load",
"senor_octopus.graph.build_dag",
"senor_octopus.lib.render_dag"
] | [((316, 343), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (333, 343), False, 'import logging\n'), ((626, 683), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Schedule pipelines"""'}), "(description='Schedule pipelines')\n", (649, 683), False, 'import arg... |
import os
from ..train import da_learner
from ..train import networks
from ..data import mnist
from ..data import usps
DEFAULT_LOG_DIR = os.path.join(os.getenv('HOME', '/'), 'tmp/da-relax/test')
class Config(da_learner.DALearnerConfig):
def _set_default_flags(self):
super()._set_default_flags()
... | [
"os.getenv"
] | [((152, 174), 'os.getenv', 'os.getenv', (['"""HOME"""', '"""/"""'], {}), "('HOME', '/')\n", (161, 174), False, 'import os\n')] |
# -*- coding: utf-8 -*-
"""Top-level package for phenotype."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# __all__ = [ 'Access', 'Assignment', 'Func' ]
from sys import path as __sys_path__
from os.path impor... | [
"os.path.abspath",
"pkgutil.extend_path"
] | [((179, 210), 'pkgutil.extend_path', 'extend_path', (['__path__', '__name__'], {}), '(__path__, __name__)\n', (190, 210), False, 'from pkgutil import extend_path\n'), ((369, 386), 'os.path.abspath', '__abs_path__', (['"""."""'], {}), "('.')\n", (381, 386), True, 'from os.path import abspath as __abs_path__\n')] |
from ggmodel_dev.graphmodel import GraphModel, concatenate_graph_specs
from ggmodel_dev.utils import get_model_properties
AGRI_nodes = {
'NTRACTORS':{
'type': 'input',
'name': 'Number of tractors',
'unit':'1',
},
'FUELTRACTORS':{
'type': 'input',
'name': 'Diesel dema... | [
"ggmodel_dev.graphmodel.GraphModel",
"ggmodel_dev.graphmodel.concatenate_graph_specs",
"ggmodel_dev.utils.get_model_properties"
] | [((2215, 2271), 'ggmodel_dev.graphmodel.concatenate_graph_specs', 'concatenate_graph_specs', (['[AGRI_nodes, RESIDENTIAL_nodes]'], {}), '([AGRI_nodes, RESIDENTIAL_nodes])\n', (2238, 2271), False, 'from ggmodel_dev.graphmodel import GraphModel, concatenate_graph_specs\n'), ((2288, 2313), 'ggmodel_dev.graphmodel.GraphMod... |
# -*- coding: utf-8 -*-
import logging
from lndtap.config import config
from lndtap.lnrpc.client import Client
async def context_middleware(request):
cert = await config.read_lnd_cert()
macaroon = await config.read_macaroon() if config.LND_MACROON_ENABLED else None
request["context"] = {
"config... | [
"lndtap.lnrpc.client.Client",
"lndtap.config.config.read_lnd_cert",
"logging.getLogger",
"lndtap.config.config.read_macaroon"
] | [((170, 192), 'lndtap.config.config.read_lnd_cert', 'config.read_lnd_cert', ([], {}), '()\n', (190, 192), False, 'from lndtap.config import config\n'), ((348, 396), 'lndtap.lnrpc.client.Client', 'Client', (['config.LND_NODE', 'cert'], {'macaroon': 'macaroon'}), '(config.LND_NODE, cert, macaroon=macaroon)\n', (354, 396)... |
"""
This script deals with trigram word embedding in a NLP context, where words are
being represented by latent features in the matrix to simulate semantic
similarities. The presumption of this method is that words of close meanings
tend to appear near each other.
"""
import torch
import torch.autograd as autograd
impo... | [
"torch.manual_seed",
"torch.LongTensor",
"matplotlib.pyplot.plot",
"torch.Tensor",
"torch.nn.NLLLoss",
"torch.nn.Linear",
"torch.nn.functional.log_softmax",
"torch.nn.Embedding",
"matplotlib.pyplot.show"
] | [((450, 473), 'torch.manual_seed', 'torch.manual_seed', (['(1122)'], {}), '(1122)\n', (467, 473), False, 'import torch\n'), ((3177, 3189), 'torch.nn.NLLLoss', 'nn.NLLLoss', ([], {}), '()\n', (3187, 3189), True, 'import torch.nn as nn\n'), ((4206, 4222), 'matplotlib.pyplot.plot', 'plt.plot', (['losses'], {}), '(losses)\... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:/Users/lupeng/Desktop/dev/AsyncPyside/ui/asyncPysideWindows.ui'
#
# Created: Wed Aug 12 16:11:06 2020
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide impor... | [
"PySide.QtGui.QStatusBar",
"PySide.QtCore.QMetaObject.connectSlotsByName",
"PySide.QtGui.QMenuBar",
"PySide.QtGui.QPushButton",
"PySide.QtGui.QVBoxLayout",
"PySide.QtGui.QWidget",
"PySide.QtCore.QRect",
"PySide.QtGui.QApplication.translate"
] | [((574, 610), 'PySide.QtGui.QWidget', 'QtGui.QWidget', (['AsyncPysideMainWindow'], {}), '(AsyncPysideMainWindow)\n', (587, 610), False, 'from PySide import QtCore, QtGui\n'), ((701, 738), 'PySide.QtGui.QVBoxLayout', 'QtGui.QVBoxLayout', (['self.centralwidget'], {}), '(self.centralwidget)\n', (718, 738), False, 'from Py... |
# Classes to handle creation on BabyConnect Types programmatically.
# Methods also support a to_json and from_json method so they can be
# dumped and reloaded from a json file
from datetime import datetime
class Diaper(object):
'''
Class to handle a diaper type request.
'''
type=None
id=None
... | [
"datetime.datetime.now",
"datetime.datetime.fromtimestamp"
] | [((2004, 2018), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (2016, 2018), False, 'from datetime import datetime\n'), ((2041, 2070), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (['epoch'], {}), '(epoch)\n', (2063, 2070), False, 'from datetime import datetime\n'), ((3158, 3172), 'datetime.... |
# coding=utf-8
from django.conf.urls import url
from django.contrib import admin
from item.views import ItemCategoryListCreateAPIView,\
ItemCategoryRetrieveUpdateDestroyAPIView, ItemListCreateAPIView, ItemRetrieveUpdateDestroyAPIView, \
ItemWithCategoryIDListAPIView, ItemCategoryWithGroupIDListAPIView, ItemWit... | [
"item.views.ItemWithCategoryIDListView.as_view",
"item.views.CategoryEditView.as_view",
"item.views.ItemDetailView.as_view"
] | [((444, 480), 'item.views.ItemWithCategoryIDListView.as_view', 'ItemWithCategoryIDListView.as_view', ([], {}), '()\n', (478, 480), False, 'from item.views import ItemCategoryListCreateAPIView, ItemCategoryRetrieveUpdateDestroyAPIView, ItemListCreateAPIView, ItemRetrieveUpdateDestroyAPIView, ItemWithCategoryIDListAPIVie... |
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from cornflow.commands import *
from cornflow.app import create_app, db
env_name = "development"
app = create_app(env_name)
migrate = Migrate(app=app, db=db)
manager = Manager(app=app)
# Database commands
manager.add_command("db", Mi... | [
"cornflow.app.create_app",
"flask_script.Manager",
"flask_migrate.Migrate"
] | [((188, 208), 'cornflow.app.create_app', 'create_app', (['env_name'], {}), '(env_name)\n', (198, 208), False, 'from cornflow.app import create_app, db\n'), ((220, 243), 'flask_migrate.Migrate', 'Migrate', ([], {'app': 'app', 'db': 'db'}), '(app=app, db=db)\n', (227, 243), False, 'from flask_migrate import Migrate, Migr... |
"""Add document model, who save company data in aws cloud
Revision ID: <KEY>
Revises: b617ced24fdf
Create Date: 2021-12-15 17:28:00.606856
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = 'b617ced24fdf'
branch_labels = None
depends_on = N... | [
"sqlalchemy.text",
"sqlalchemy.DateTime",
"alembic.op.drop_table",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Integer",
"sqlalchemy.String"
] | [((857, 883), 'alembic.op.drop_table', 'op.drop_table', (['"""documents"""'], {}), "('documents')\n", (870, 883), False, 'from alembic import op\n'), ((697, 726), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""id"""'], {}), "('id')\n", (720, 726), True, 'import sqlalchemy as sa\n'), ((460, 472), 's... |
from stock_predictor import Predictor
from train import symbols, pkey
def main():
prd = Predictor(symbol=symbols, key=pkey)
print(symbols, prd.predict())
if __name__ == "__main__":
main() | [
"stock_predictor.Predictor"
] | [((93, 128), 'stock_predictor.Predictor', 'Predictor', ([], {'symbol': 'symbols', 'key': 'pkey'}), '(symbol=symbols, key=pkey)\n', (102, 128), False, 'from stock_predictor import Predictor\n')] |
from PIL import Image
import glob, os, sys, face_recognition, itertools, subprocess, concurrent.futures, face_util, datetime
global dir_images
global dir_faces
global dir_exclude_arg
global face_tolerance
global is_verbose
global is_exiftool
def print_help():
print(" ")
print("Recognize persons in images and... | [
"os.path.exists",
"os.path.isabs",
"os.path.join",
"os.path.dirname",
"datetime.datetime.now",
"face_util.read_known_faces",
"os.mkdir",
"face_util.compare_face",
"sys.exit",
"face_util.collect_faces_of_dir",
"os.walk"
] | [((6298, 6323), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (6313, 6323), False, 'import glob, os, sys, face_recognition, itertools, subprocess, concurrent.futures, face_util, datetime\n'), ((6485, 6510), 'os.path.isabs', 'os.path.isabs', (['dir_images'], {}), '(dir_images)\n', (6498, 6510... |
"""
This file is part of Totara Enterprise Extensions.
Copyright (C) 2021 onward Totara Learning Solutions LTD
Totara Enterprise Extensions is provided only to Totara
Learning Solutions LTD's customers and partners, pursuant to
the terms and conditions of a separate agreement with Totara
Learning Solutions LTD or its... | [
"unittest.mock.MagicMock",
"service.communicator.totara_files.TotaraFiles",
"unittest.mock.patch",
"requests.exceptions.ConnectionError",
"time.time"
] | [((3619, 3672), 'unittest.mock.patch', 'patch', ([], {'target': '"""service.communicator.totara_files.get"""'}), "(target='service.communicator.totara_files.get')\n", (3624, 3672), False, 'from unittest.mock import patch, MagicMock\n'), ((5295, 5374), 'unittest.mock.patch', 'patch', ([], {'target': '"""service.communic... |
import math
import wave
#fdt = wave.open("sample_music.wav", "r")
#
#
#for i in range(fdt.getnframes()):
# print(fdt.readframes(i))
# i += 1
duration = 5
fps = 1000
amplitude = 0
fdt = wave.open("test.wav", "w")
fdt.setnchannels(1)
fdt.setsampwidth(2)
fdt.setframerate(fps)
for i in range(duration*fps):
... | [
"wave.open"
] | [((195, 221), 'wave.open', 'wave.open', (['"""test.wav"""', '"""w"""'], {}), "('test.wav', 'w')\n", (204, 221), False, 'import wave\n')] |
import pytest
@pytest.mark.parametrize(('f', 't'), [(sum, list), (len, int)])
def test_foo(f, t):
assert isinstance(f([[1], [2]]), t)
def test_bar(): # unparametrized
pass
| [
"pytest.mark.parametrize"
] | [((17, 79), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('f', 't')", '[(sum, list), (len, int)]'], {}), "(('f', 't'), [(sum, list), (len, int)])\n", (40, 79), False, 'import pytest\n')] |
# Copyright (c) 2021 <NAME>
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# This file is based on egg.core.util.py
import torch
import numpy as np
from typing import Optional
def find_lengths(
stop_seq: torch.Tensor,
st... | [
"torch.zeros_like",
"torch.exp"
] | [((938, 968), 'torch.zeros_like', 'torch.zeros_like', (['stop_logprob'], {}), '(stop_logprob)\n', (954, 968), False, 'import torch\n'), ((1207, 1225), 'torch.exp', 'torch.exp', (['lengths'], {}), '(lengths)\n', (1216, 1225), False, 'import torch\n'), ((735, 758), 'torch.exp', 'torch.exp', (['stop_logprob'], {}), '(stop... |
import logging
from gym import spaces
import numpy as np
from vizdoomgym.envs import VizdoomEnv
log = logging.getLogger(__name__)
class VizdoomRandomMapEnv(VizdoomEnv):
def __init__(self, level, num_levels, **kwargs):
super(VizdoomRandomMapEnv, self).__init__(level, **kwargs)
self.num_levels = n... | [
"logging.getLogger"
] | [((105, 132), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (122, 132), False, 'import logging\n')] |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
"oci.util.formatted_flat_dict",
"oci.util.value_allowed_none_or_none_sentinel"
] | [((29575, 29600), 'oci.util.formatted_flat_dict', 'formatted_flat_dict', (['self'], {}), '(self)\n', (29594, 29600), False, 'from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel\n'), ((12172, 12239), 'oci.util.value_allowed_none_or_none_sentinel', 'value_allowed_none_or_none_sent... |
#!/usr/local/bin/python3.6
# -*- coding:utf-8 -*-
# ========================================
# Description :
# 工具类
# 反射类、数据仓库类、路径加工、缓存
# Created : 2020.10.14
# Author : <NAME>
# ========================================
from promise import Promise
import os
import inspect
from dataclasses import dataclass
# 字典反射对... | [
"os.path.exists",
"os.listdir",
"os.makedirs",
"os.path.join",
"inspect.getfile",
"os.path.split",
"os.path.realpath",
"os.path.isdir",
"os.path.abspath"
] | [((2287, 2306), 'os.path.split', 'os.path.split', (['path'], {}), '(path)\n', (2300, 2306), False, 'import os\n'), ((2067, 2094), 'inspect.getfile', 'inspect.getfile', (['model_func'], {}), '(model_func)\n', (2082, 2094), False, 'import inspect\n'), ((2522, 2541), 'os.path.split', 'os.path.split', (['head'], {}), '(hea... |
# -*- coding: utf-8 -*-
# Copyright 2020 The GraphicsFuzz Project 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | [
"gfauto.cov_merge.add_line_counts_unsafe",
"collections.Counter"
] | [((992, 1063), 'gfauto.cov_merge.add_line_counts_unsafe', 'cov_merge.add_line_counts_unsafe', (['input_line_counts', 'output_line_counts'], {}), '(input_line_counts, output_line_counts)\n', (1024, 1063), False, 'from gfauto import cov_merge, cov_util\n'), ((789, 818), 'collections.Counter', 'Counter', (['{(1): 500, (2)... |
import os
import math
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn import svm
from sklearn.metrics import classification_report
from sklearn.externals import joblib
# MrSenti class
class MrSenti:
"""A wrapper class for sentimental analysis with sklearn
Perform sentiment analysis on... | [
"os.listdir",
"sklearn.metrics.classification_report",
"sklearn.svm.LinearSVC",
"os.path.join",
"sklearn.feature_extraction.text.TfidfVectorizer",
"math.exp"
] | [((514, 584), 'sklearn.feature_extraction.text.TfidfVectorizer', 'TfidfVectorizer', ([], {'min_df': '(5)', 'max_df': '(0.8)', 'sublinear_tf': '(True)', 'use_idf': '(True)'}), '(min_df=5, max_df=0.8, sublinear_tf=True, use_idf=True)\n', (529, 584), False, 'from sklearn.feature_extraction.text import TfidfVectorizer\n'),... |
from pypdevs.DEVS import AtomicDEVS
# Define the state of the processor as a structured object
class ProcessorState(object):
def __init__(self):
# State only contains the current event
self.evt = None
class Processor(AtomicDEVS):
def __init__(self, nr, proc_param):
AtomicDEVS.__init__(... | [
"pypdevs.DEVS.AtomicDEVS.__init__"
] | [((300, 346), 'pypdevs.DEVS.AtomicDEVS.__init__', 'AtomicDEVS.__init__', (['self', "('Processor_%i' % nr)"], {}), "(self, 'Processor_%i' % nr)\n", (319, 346), False, 'from pypdevs.DEVS import AtomicDEVS\n')] |
import re
from flask import current_app
from database import get_db
from geocoder import geocode
def _query_data(lon, lat):
db = get_db()
cursor = db.execute(
'select data from grids where (? between x1 and x2) and (? between y3 and y1)',
(lon, lat)
)
res = cursor.fetchone()
if re... | [
"re.sub",
"geocoder.geocode",
"database.get_db"
] | [((136, 144), 'database.get_db', 'get_db', ([], {}), '()\n', (142, 144), False, 'from database import get_db\n'), ((397, 405), 'database.get_db', 'get_db', ([], {}), '()\n', (403, 405), False, 'from database import get_db\n'), ((615, 623), 'database.get_db', 'get_db', ([], {}), '()\n', (621, 623), False, 'from database... |
import time
import requests
import base64
from colorama import Fore, Back, Style
import os
# 0.2 alpha
# Автор - V1rusTeam(Koder) #
# При копипасте пожалуйста указывайте меня как Автора и не удаляйте эти строки
# Telegram - @ArtemZi, @V1rusCode
def clear():
if os.name == 'nt':
_ = os.system('cls')
els... | [
"os.system",
"base64.b64decode",
"time.sleep",
"requests.get"
] | [((2848, 2863), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (2858, 2863), False, 'import time\n'), ((5545, 5560), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (5555, 5560), False, 'import time\n'), ((5665, 5680), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (5675, 5680), False, 'import... |
#!/usr/bin/env python3
from doxhooks.main import Doxhooks, add_output_roots
from doxhooks.preprocessor_contexts import PreprocessorContext
from doxhooks.resource_configs import ResourceConfiguration as _
from doxhooks.resources import PreprocessedResource
class FeatureContext(PreprocessorContext):
child = "child ... | [
"doxhooks.main.add_output_roots",
"doxhooks.resource_configs.ResourceConfiguration",
"doxhooks.main.Doxhooks"
] | [((726, 837), 'doxhooks.resource_configs.ResourceConfiguration', '_', (['FeaturePreprocessedResource'], {'input_filename': '"""input/_root.txt"""', 'output_filename': '"""output/preprocessed.txt"""'}), "(FeaturePreprocessedResource, input_filename='input/_root.txt',\n output_filename='output/preprocessed.txt')\n", (... |
"""user field matcher models"""
import re
from django.db import models
from django.utils.translation import gettext as _
from rest_framework.serializers import BaseSerializer
from structlog.stdlib import get_logger
from authentik.policies.models import Policy
from authentik.policies.types import PolicyRequest, Policy... | [
"authentik.policies.types.PolicyResult",
"django.db.models.TextField",
"django.utils.translation.gettext",
"re.compile",
"structlog.stdlib.get_logger",
"django.db.models.PositiveIntegerField"
] | [((399, 411), 'structlog.stdlib.get_logger', 'get_logger', ([], {}), '()\n', (409, 411), False, 'from structlog.stdlib import get_logger\n'), ((423, 442), 're.compile', 're.compile', (['"""[a-z]"""'], {}), "('[a-z]')\n", (433, 442), False, 'import re\n'), ((454, 473), 're.compile', 're.compile', (['"""[A-Z]"""'], {}), ... |
"""002_addISBN_10
Revision ID: 04659e2c3a9a
Revises: 69a9f86e5636
Create Date: 2022-01-21 02:01:57.474589
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '04659e2c3a9a'
down_revision = '69a9f86e5636'
branch_labels = None
depends_on = None
def upgrade():
#... | [
"sqlalchemy.String",
"alembic.op.drop_column"
] | [((591, 625), 'alembic.op.drop_column', 'op.drop_column', (['"""books"""', '"""ISBN_10"""'], {}), "('books', 'ISBN_10')\n", (605, 625), False, 'from alembic import op\n'), ((429, 449), 'sqlalchemy.String', 'sa.String', ([], {'length': '(10)'}), '(length=10)\n', (438, 449), True, 'import sqlalchemy as sa\n')] |
from __future__ import division
import numpy as np
import math
import fractions
from nltk.util import ngrams
from collections import Counter
from fractions import Fraction
def sentence_bleu(references, hypothesis, weights=(0.25, 0.25, 0.25, 0.25),
smoothing_function=None):
"""
:param refere... | [
"fractions.Fraction",
"math.log",
"collections.Counter",
"nltk.util.ngrams",
"math.fsum",
"math.exp"
] | [((1321, 1330), 'collections.Counter', 'Counter', ([], {}), '()\n', (1328, 1330), False, 'from collections import Counter\n'), ((1408, 1417), 'collections.Counter', 'Counter', ([], {}), '()\n', (1415, 1417), False, 'from collections import Counter\n'), ((4880, 4930), 'fractions.Fraction', 'Fraction', (['numerator', 'de... |
from jax.scipy.linalg import solve
from jax.lax import scan
from optimism.JaxConfig import *
from optimism import Interpolants
from optimism import Mesh
from optimism import QuadratureRule
from optimism.TensorMath import tensor_2D_to_3D
FunctionSpace = namedtuple('FunctionSpace', ['shapes', 'vols', 'shapeGrads', 'mes... | [
"optimism.Interpolants.compute_shapes_on_tri",
"jax.scipy.linalg.solve",
"optimism.Interpolants.compute_shapeGrads_on_tri"
] | [((6889, 6943), 'optimism.Interpolants.compute_shapes_on_tri', 'Interpolants.compute_shapes_on_tri', (['master', 'evalPoints'], {}), '(master, evalPoints)\n', (6923, 6943), False, 'from optimism import Interpolants\n'), ((7539, 7603), 'optimism.Interpolants.compute_shapeGrads_on_tri', 'Interpolants.compute_shapeGrads_o... |
from typing import Any
from pyppeteer.page import Page
from PuppeteerLibrary.locators.SelectorAbstraction import SelectorAbstraction
from robot.utils import timestr_to_secs
class SPage(Page):
def __init__(self):
super(Page, self).__init__()
async def click_with_selenium_locator(self, selenium_locato... | [
"PuppeteerLibrary.locators.SelectorAbstraction.SelectorAbstraction.get_selector",
"PuppeteerLibrary.locators.SelectorAbstraction.SelectorAbstraction.is_xpath",
"robot.utils.timestr_to_secs"
] | [((391, 441), 'PuppeteerLibrary.locators.SelectorAbstraction.SelectorAbstraction.get_selector', 'SelectorAbstraction.get_selector', (['selenium_locator'], {}), '(selenium_locator)\n', (423, 441), False, 'from PuppeteerLibrary.locators.SelectorAbstraction import SelectorAbstraction\n'), ((453, 499), 'PuppeteerLibrary.lo... |
import base64
import json
from manual_test.manual_test_base import ManualTestBase
from pathlib import Path
from typing import Any, Dict, Optional
GET_ALL_FILES_ROUTE = '/nifile/v1/service-groups/Default/files'
GET_FILE_ROUTE_FORMAT = '/nifile/v1/service-groups/Default/files/?id={file_id}'
UPLOAD_ROUTE = '/nifile/v1/se... | [
"base64.b64encode",
"json.dumps",
"pathlib.Path"
] | [((370, 384), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (374, 384), False, 'from pathlib import Path\n'), ((2406, 2428), 'json.dumps', 'json.dumps', (['properties'], {}), '(properties)\n', (2416, 2428), False, 'import json\n'), ((4208, 4242), 'base64.b64encode', 'base64.b64encode', (['response.content... |
#!/usr/bin/python
###############################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache License Version 2.0 (the "License"). Y... | [
"boto3.session.Session",
"botocore.config.Config",
"CreateAccessLoggingBucket_createloggingbucket.create_logging_bucket",
"botocore.stub.Stubber",
"pytest_mock.mocker.patch"
] | [((1386, 1409), 'boto3.session.Session', 'boto3.session.Session', ([], {}), '()\n', (1407, 1409), False, 'import boto3\n'), ((1659, 1718), 'botocore.config.Config', 'Config', ([], {'retries': "{'mode': 'standard'}", 'region_name': 'my_region'}), "(retries={'mode': 'standard'}, region_name=my_region)\n", (1665, 1718), F... |
#
# Copyright (c) 2022, NVIDIA 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 required by appl... | [
"IPython.core.display.display",
"IPython.display.clear_output"
] | [((1854, 1893), 'IPython.display.clear_output', 'IPython.display.clear_output', ([], {'wait': '(True)'}), '(wait=True)\n', (1882, 1893), False, 'import IPython\n'), ((1902, 1929), 'IPython.core.display.display', 'display', (['self.choice_widget'], {}), '(self.choice_widget)\n', (1909, 1929), False, 'from IPython.core.d... |
from __future__ import absolute_import
import textwrap
from django.contrib.admindocs.views import simplify_regex
from django.utils.importlib import import_module
from django.utils.text import slugify
from sentry.api.base import Endpoint
from sentry.constants import HTTP_METHODS
from sentry.web.frontend.base import B... | [
"textwrap.dedent",
"django.contrib.admindocs.views.simplify_regex",
"django.utils.importlib.import_module"
] | [((457, 489), 'django.utils.importlib.import_module', 'import_module', (['"""sentry.api.urls"""'], {}), "('sentry.api.urls')\n", (470, 489), False, 'from django.utils.importlib import import_module\n'), ((2680, 2717), 'django.contrib.admindocs.views.simplify_regex', 'simplify_regex', (['pattern.regex.pattern'], {}), '(... |
import os
import sys
from datetime import datetime
from shutil import copyfile
import glob
import copy
import yaml
import torch
import networkx as nx
import numpy as np
from models.fourier_nn import FourierNet
from problems.dist_online_dense_problem import DistOnlineDensityProblem
from optimizers.dinno import DiNNO
f... | [
"optimizers.dinno.DiNNO",
"numpy.hstack",
"floorplans.lidar.lidar.RandomPoseLidarDataset",
"torch.nn.L1Loss",
"torch.nn.MSELoss",
"torch.cuda.is_available",
"torch.sum",
"copy.deepcopy",
"torch.profiler.schedule",
"os.path.exists",
"floorplans.lidar.lidar.OnlineTrajectoryLidarDataset",
"proble... | [((535, 584), 'torch.set_default_tensor_type', 'torch.set_default_tensor_type', (['torch.DoubleTensor'], {}), '(torch.DoubleTensor)\n', (564, 584), False, 'import torch\n'), ((1264, 1342), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['train_set', "conf['train_batch_size']"], {'shuffle': '(True)'}), "... |
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
import numpy as np
import argparse
import datetime
import pickle
import csv
X, y = [], []
def load_dataset(infile):
global X, y... | [
"csv.DictReader",
"argparse.ArgumentParser",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.mean_squared_error",
"numpy.array",
"sklearn.metrics.r2_score",
"sklearn.linear_model.LinearRegression"
] | [((773, 784), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (781, 784), True, 'import numpy as np\n'), ((844, 881), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)'}), '(X, y, test_size=0.2)\n', (860, 881), False, 'from sklearn.model_selection import train_test_split... |
import wx
import shell_util as exec_cmd
import multiprocessing
import time
import os
import subprocess
from subprocess import call
import images as img
import time
# from wx.lib.pubsub import setuparg1
# from wx.lib.pubsub import pub as Publisher
from pubsub import pub as Publisher
import threading
from threading impor... | [
"wx.Notebook",
"time.sleep",
"wx.BitmapButton",
"wx.Font",
"wx.Panel.__init__",
"shell_util.createProcess",
"threading.Thread.__init__",
"pubsub.pub.subscribe",
"subprocess.Popen",
"wx.Image",
"wx.CallAfter",
"wx.Frame.__init__",
"ctypes.py_object",
"threading._active.items",
"wx.TextCtr... | [((1854, 2034), 'shell_util.createProcess', 'exec_cmd.createProcess', (['"""lxterminal --command=\'openssl s_server -cert CAsigned_rsa_cert.crt -accept 4433 -keyform engine -engine tpm2tss -key rsa_server.tss\'"""', 'server_log'], {}), '(\n "lxterminal --command=\'openssl s_server -cert CAsigned_rsa_cert.crt -accept... |
from sre_parse import Pattern, SubPattern, parse
from sre_compile import compile as sre_compile
from sre_constants import BRANCH, SUBPATTERN
class _ScanMatch(object):
def __init__(self, match, rule, start, end):
self._match = match
self._start = start
self._end = end
self._rule = ... | [
"sre_parse.parse",
"sre_parse.SubPattern",
"sre_parse.Pattern"
] | [((1944, 1953), 'sre_parse.Pattern', 'Pattern', ([], {}), '()\n', (1951, 1953), False, 'from sre_parse import Pattern, SubPattern, parse\n'), ((2530, 2582), 'sre_parse.SubPattern', 'SubPattern', (['pattern', '[(BRANCH, (None, subpatterns))]'], {}), '(pattern, [(BRANCH, (None, subpatterns))])\n', (2540, 2582), False, 'f... |
'''
python programfor convert text to speech
gTTS = Google Text to Speech
'''
from gtts import gTTS
import os
#Pyhton program for change text to speech
sampletext = input('')
language = 'en'
engine = gTTS(text = sampletext, lang= language, slow= False)
#FIle Be Saved in same folder
engine.save('welcome1.mp3')
| [
"gtts.gTTS"
] | [((202, 250), 'gtts.gTTS', 'gTTS', ([], {'text': 'sampletext', 'lang': 'language', 'slow': '(False)'}), '(text=sampletext, lang=language, slow=False)\n', (206, 250), False, 'from gtts import gTTS\n')] |
import pandas as pd
import numpy as np
from os.path import join, exists, split
from os import mkdir, makedirs, listdir
import gc
import matplotlib.pyplot as plt
import seaborn
from copy import deepcopy
from time import time
import pickle
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('split_na... | [
"pickle.dump",
"argparse.ArgumentParser",
"numpy.logical_and",
"os.path.join",
"numpy.diff",
"numpy.datetime64",
"gc.collect",
"numpy.concatenate",
"numpy.timedelta64",
"time.time"
] | [((265, 290), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (288, 290), False, 'import argparse\n'), ((938, 960), 'numpy.timedelta64', 'np.timedelta64', (['(2)', '"""h"""'], {}), "(2, 'h')\n", (952, 960), True, 'import numpy as np\n'), ((1179, 1322), 'os.path.join', 'join', (['bern_path', '"""... |
import libsbml
import importlib
import amici
import os
import sys
import pandas as pd
import petab.sbml
# SBML model we want to import
sbml_file = 'CS_Signalling_ERBB_RAS_AKT_petab.xml'
# Name of the model that will also be the name of the python module
model_name = 'ERBB_RAS_AKT_Drugs'
# Directory to which the genera... | [
"libsbml.writeSBMLToFile",
"importlib.import_module",
"pandas.read_csv",
"amici.SbmlImporter",
"os.path.abspath"
] | [((393, 422), 'amici.SbmlImporter', 'amici.SbmlImporter', (['sbml_file'], {}), '(sbml_file)\n', (411, 422), False, 'import amici\n'), ((487, 581), 'libsbml.writeSBMLToFile', 'libsbml.writeSBMLToFile', (['sbml_importer.sbml_doc', '"""CS_Signalling_ERBB_RAS_AKT_modified.xml"""'], {}), "(sbml_importer.sbml_doc,\n 'CS_S... |
#!/usr/bin/python3
#-*- coding:utf-8 -*-
import time
import sys
import datetime
import _thread
from DataUpdate import *
import tkinter as tk
import tkinter.messagebox
from tkinter import *
'''for test only
mode =2
def setMode(new):
global mode
mode = new
return mode
def getMode():
return mode
'''
#Global
Wi... | [
"tkinter.Tk",
"time.sleep",
"_thread.start_new_thread"
] | [((560, 584), 'tkinter.Tk', 'tk.Tk', ([], {'screenName': '""":0.0"""'}), "(screenName=':0.0')\n", (565, 584), True, 'import tkinter as tk\n'), ((1426, 1472), '_thread.start_new_thread', '_thread.start_new_thread', (['normal_loop', '(info,)'], {}), '(normal_loop, (info,))\n', (1450, 1472), False, 'import _thread\n'), ((... |
"""Python Setup File."""
from setuptools import setup
with open("requirements.txt") as f:
requirements = f.read().splitlines()
setup(
name="opensda_flasher",
version="0.3.0",
description="Tool to flash DEVKIT-MPC57xx devices with OpenSDA.",
url="https://github.com/jed-frey/opensda_flas... | [
"setuptools.setup"
] | [((141, 645), 'setuptools.setup', 'setup', ([], {'name': '"""opensda_flasher"""', 'version': '"""0.3.0"""', 'description': '"""Tool to flash DEVKIT-MPC57xx devices with OpenSDA."""', 'url': '"""https://github.com/jed-frey/opensda_flasher"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""BSD... |
import unittest
from pprint import pprint
from rdflib import Graph, Namespace
from pyshex import ShExEvaluator
rdf = """
@prefix : <http://example.org/model/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schem... | [
"unittest.main",
"pyshex.ShExEvaluator",
"rdflib.Graph",
"rdflib.Namespace",
"pyshex.evaluate.evaluate"
] | [((1358, 1398), 'rdflib.Namespace', 'Namespace', (['"""http://example.org/context/"""'], {}), "('http://example.org/context/')\n", (1367, 1398), False, 'from rdflib import Graph, Namespace\n'), ((1405, 1453), 'rdflib.Namespace', 'Namespace', (['"""http://example.org/sample/example1/"""'], {}), "('http://example.org/sam... |
import threading
import etcd
from oslo_log import log
from networking_ovn.common import config
LOG = log.getLogger(__name__)
class OVSDBWatchLeaderThread(threading.Thread):
def __init__(self, hosts):
self.ovsDbNbOvnIdls = []
threading.Thread.__init__(self)
self.client = etcd.Client(hosts... | [
"threading.Thread.__init__",
"networking_ovn.common.config.get_ovn_ovsdb_certificate_file",
"networking_ovn.common.config.get_ovn_ovsdb_ca_cert_file",
"networking_ovn.common.config.get_ovn_ovsdb_private_key_file",
"oslo_log.log.getLogger"
] | [((102, 125), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (115, 125), False, 'from oslo_log import log\n'), ((249, 280), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {}), '(self)\n', (274, 280), False, 'import threading\n'), ((691, 726), 'networking_ovn.common.... |
#-----------------------------------------------------------------------------#
# #
# I M P O R T L I B R A R I E S #
# #
... | [
"torch.nn.GroupNorm",
"torch.nn.ReLU",
"torch.nn.BatchNorm2d",
"numpy.sqrt",
"torch.nn.Sequential",
"torch.load",
"torch.nn.functional.avg_pool2d",
"torch.nn.Conv2d",
"torch.nn.functional.normalize",
"torch.nn.BatchNorm1d",
"torchvision.models.resnet.ResNet",
"torch.nn.MaxPool2d",
"torch.nn.... | [((12003, 12051), 'torchvision.models.resnet.ResNet', 'ResNet', (['BasicBlock', '[1, 1, 1, 1]'], {'num_classes': '(10)'}), '(BasicBlock, [1, 1, 1, 1], num_classes=10)\n', (12009, 12051), False, 'from torchvision.models.resnet import ResNet, BasicBlock\n'), ((12078, 12126), 'torchvision.models.resnet.ResNet', 'ResNet', ... |
#!/usr/bin/env python
"""Prints the top files in terms of sizes.
Prints the top files in terms of sizes under a directory or its subdirectories
in terms of the size
Copyright 2014 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with t... | [
"argparse.ArgumentParser",
"heapq.heapreplace",
"heapq.heappop",
"heapq.heappush",
"os.walk"
] | [((2415, 2463), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'description'}), '(description=description)\n', (2438, 2463), False, 'import argparse\n'), ((1333, 1349), 'os.walk', 'os.walk', (['dirpath'], {}), '(dirpath)\n', (1340, 1349), False, 'import os\n'), ((1657, 1670), 'heapq.heappop'... |
import locale
import os.path
import pickle
import re
from contextlib import contextmanager
from typing import Any, Dict, List, Optional
from unicodedata import normalize
from urllib.parse import parse_qs, urlencode, urlparse
from parsel import Selector
from asianbookie import settings
def parse_player_url(url_text:... | [
"pickle.dump",
"urllib.parse.urlparse",
"locale.setlocale",
"pickle.load",
"urllib.parse.parse_qs",
"locale.getlocale",
"unicodedata.normalize",
"urllib.parse.urlencode",
"re.sub",
"re.findall"
] | [((353, 371), 'urllib.parse.urlparse', 'urlparse', (['url_text'], {}), '(url_text)\n', (361, 371), False, 'from urllib.parse import parse_qs, urlencode, urlparse\n'), ((388, 416), 'urllib.parse.parse_qs', 'parse_qs', (['parse_result.query'], {}), '(parse_result.query)\n', (396, 416), False, 'from urllib.parse import pa... |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# Copyright (c) 2013, Intel Corporation.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free ... | [
"mic.msger.warning",
"mic.utils.runner.runtool",
"mic.msger.debug",
"mic.msger.error"
] | [((1210, 1252), 'mic.msger.debug', 'msger.debug', (["('exec_cmd: %s' % cmd_and_args)"], {}), "('exec_cmd: %s' % cmd_and_args)\n", (1221, 1252), False, 'from mic import msger\n'), ((1289, 1306), 'mic.msger.debug', 'msger.debug', (['args'], {}), '(args)\n', (1300, 1306), False, 'from mic import msger\n'), ((1463, 1541), ... |
import numpy as np
import pandas as pd
from vimms.old_unused_experimental.PythonMzmine import get_base_scoring_df
from vimms.Roi import make_roi
QCB_MZML2CHEMS_DICT = {'min_ms1_intensity': 1.75E5,
'mz_tol': 2,
'mz_units': 'ppm',
'min_length': 1,
... | [
"numpy.logical_and",
"vimms.old_unused_experimental.PythonMzmine.get_base_scoring_df",
"numpy.where",
"numpy.array",
"vimms.Roi.make_roi",
"numpy.nonzero",
"pandas.DataFrame",
"pandas.concat"
] | [((538, 788), 'vimms.Roi.make_roi', 'make_roi', (['mzml'], {'mz_tol': "mzml2chems_dict['mz_tol']", 'mz_units': "mzml2chems_dict['mz_units']", 'min_length': 'min_roi_length', 'min_intensity': "mzml2chems_dict['min_intensity']", 'start_rt': "mzml2chems_dict['start_rt']", 'stop_rt': "mzml2chems_dict['stop_rt']"}), "(mzml,... |
from typing import Optional, Callable, Any, List, Dict
import numpy as np
from functools import partial
import torch.nn as nn
import torch
from torch import Tensor
from ..layers.activations import lookup_act
from ..initialisations import lookup_normal_init
from .abs_block import AbsBlock
__all__ = ['FullyConnected',... | [
"torch.nn.Dropout",
"torch.nn.Sequential",
"torch.nn.ModuleList",
"numpy.floor",
"torch.nn.init.zeros_",
"numpy.sum",
"torch.nn.Linear",
"torch.nn.AlphaDropout",
"torch.cat"
] | [((6802, 6824), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (6815, 6824), True, 'import torch.nn as nn\n'), ((12441, 12467), 'torch.nn.ModuleList', 'nn.ModuleList', (['self.blocks'], {}), '(self.blocks)\n', (12454, 12467), True, 'import torch.nn as nn\n'), ((12911, 12941), 'torch.nn.init.z... |
from netCDF4 import Dataset, num2date, date2num, date2index
import eodatasets
from eodatasets import type as ptype
class BomModisDriver(eodatasets.DatasetDriver):
"""
Extend EODatasets to read metadata about alternative inputs for the datacube
In this case, Bom-Modis data
"""
def get_id(self):
... | [
"netCDF4.Dataset",
"eodatasets.type.ExtentMetadata",
"netCDF4.num2date"
] | [((801, 823), 'eodatasets.type.ExtentMetadata', 'ptype.ExtentMetadata', ([], {}), '()\n', (821, 823), True, 'from eodatasets import type as ptype\n'), ((838, 851), 'netCDF4.Dataset', 'Dataset', (['path'], {}), '(path)\n', (845, 851), False, 'from netCDF4 import Dataset, num2date, date2num, date2index\n'), ((1094, 1141)... |
#!/usr/bin/python
import argparse
import os
import numpy as np
from dolfyn.adv.rotate import orient2euler
import dolfyn.adv.api as avm
from dolfyn.adv.motion import correct_motion
# TODO: add option to rotate into earth or principal frame (include
# principal_angle_True in output).
script_dir = os.path.dirname(__fil... | [
"dolfyn.adv.motion.correct_motion",
"dolfyn.adv.rotate.orient2euler",
"argparse.ArgumentParser",
"os.path.dirname",
"numpy.array",
"dolfyn.adv.api.read_nortek"
] | [((299, 324), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (314, 324), False, 'import os\n'), ((335, 574), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""\n Perform motion correction of a Nortek Vector(.vec)\n file and save the output in earth(u: East, ... |
import shutil
import glob
import tempfile
import os
import pytest
import artm
def test_func():
topic_selection_tau = 1.0
num_collection_passes = 3
num_document_passes = 10
num_topics = 15
data_path = os.path.abspath(os.path.join(os.getcwd(), os.pardir))
batches_folder = tempfile.mkdtemp()
... | [
"artm.TopicSelectionThetaRegularizer",
"artm.ARTM",
"artm.Dictionary",
"os.getcwd",
"tempfile.mkdtemp",
"shutil.rmtree",
"artm.TopicMassPhiScore",
"artm.BatchVectorizer",
"artm.PerplexityScore"
] | [((299, 317), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (315, 317), False, 'import tempfile\n'), ((463, 584), 'artm.BatchVectorizer', 'artm.BatchVectorizer', ([], {'data_path': 'data_path', 'data_format': '"""bow_uci"""', 'collection_name': '"""kos"""', 'target_folder': 'batches_folder'}), "(data_path=d... |
# Licensed to the Apache Software Foundation (ASF) 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 ... | [
"tvm.relay.nn.dense",
"tvm.relay.Tuple",
"tvm.relay.op.contrib.dnnl.partition_for_dnnl",
"tvm.relay.Function",
"tvm.relay.create_executor",
"tvm.relay.cast",
"tvm.relay.nn.conv2d",
"tvm.relay.add",
"pytest.main",
"tvm.IRModule",
"tvm.transform.PassContext",
"tvm.relay.sigmoid",
"tvm.IRModule... | [((1700, 1738), 'itertools.combinations', 'itertools.combinations', (['result_dict', '(2)'], {}), '(result_dict, 2)\n', (1722, 1738), False, 'import itertools\n'), ((2222, 2231), 'tvm.cpu', 'tvm.cpu', ([], {}), '()\n', (2229, 2231), False, 'import tvm\n'), ((4040, 4082), 'tvm.relay.var', 'relay.var', (['"""x"""'], {'sh... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-31 21:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pcari', '0028_auto_20160831_2041'),
]
operations = [
migrations.AddField(
... | [
"django.db.models.BooleanField"
] | [((400, 434), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (419, 434), False, 'from django.db import migrations, models\n'), ((557, 591), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (576, 591), F... |