code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
Copyright 2020 Inmanta
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 ... | [
"inmanta.server.bootloader.InmantaBootloader",
"pytest.mark.asyncio",
"os.path.dirname"
] | [((1429, 1460), 'pytest.mark.asyncio', 'pytest.mark.asyncio', ([], {'timeout': '(20)'}), '(timeout=20)\n', (1448, 1460), False, 'import pytest\n'), ((1277, 1296), 'inmanta.server.bootloader.InmantaBootloader', 'InmantaBootloader', ([], {}), '()\n', (1294, 1296), False, 'from inmanta.server.bootloader import InmantaBoot... |
# -*- encoding: utf-8 -*-
'''Main module for the application.'''
# pylint: disable=invalid-name, wrong-import-position
# Hide pygame's support prompt.
from os import environ
environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
import sys
import pygame
from pygame.locals import KEYDOWN, QUIT, K_q, K_ESCAPE, MOUSEBUTTONDOWN # p... | [
"pygame.mouse.set_visible",
"manager.Manager",
"pygame.mixer.init",
"manager.TreeManager",
"pygame.init",
"sys.exit",
"pygame.display.set_caption",
"pygame.mixer.Sound"
] | [((439, 452), 'pygame.init', 'pygame.init', ([], {}), '()\n', (450, 452), False, 'import pygame\n'), ((481, 500), 'pygame.mixer.init', 'pygame.mixer.init', ([], {}), '()\n', (498, 500), False, 'import pygame\n'), ((501, 536), 'pygame.display.set_caption', 'pygame.display.set_caption', (['"""开心消消乐"""'], {}), "('开心消消乐')\... |
import os
from flask import request
from flask_restful import Resource, reqparse, url_for
from models.user import User, UserSchema
from marshmallow import ValidationError
from werkzeug import datastructures
from werkzeug.utils import secure_filename
from flask_jwt_extended import jwt_required
from uuid import uuid4
fr... | [
"models.user.UserSchema",
"utils.db_helper.insert",
"utils.db_helper.only_save",
"utils.db_helper.delete",
"models.user.User.get_user_by_id",
"os.path.join",
"flask.request.get_json",
"utils.utils.allowed_file",
"utils.custom_response.ok",
"datetime.datetime.now",
"utils.utils.get_file_extension... | [((588, 612), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ([], {}), '()\n', (610, 612), False, 'from flask_restful import Resource, reqparse, url_for\n'), ((773, 816), 'models.user.UserSchema', 'UserSchema', ([], {'many': '(True)', 'exclude': "['password']"}), "(many=True, exclude=['password'])\n"... |
from hypothesis import given
from tests.binding_tests.utils import BoundPolygonKind
from tests.integration_tests.utils import (
BoundPortedFillKindsPair,
BoundPortedMultipolygonsPair,
BoundPortedWagyusPair,
are_bound_ported_multipolygons_equal,
are_bound_ported_wagyus_equal)
from tests.port_tests.u... | [
"tests.integration_tests.utils.are_bound_ported_wagyus_equal",
"tests.integration_tests.utils.are_bound_ported_multipolygons_equal",
"hypothesis.given"
] | [((378, 540), 'hypothesis.given', 'given', (['strategies.wagyus_pairs', 'strategies.multipolygons_pairs', 'strategies.multipolygons_pairs', 'strategies.fill_kinds_pairs', 'strategies.fill_kinds_pairs'], {}), '(strategies.wagyus_pairs, strategies.multipolygons_pairs, strategies.\n multipolygons_pairs, strategies.fill... |
import io
import aiofiles
import aiohttp
from PIL import Image, ImageFont, ImageDraw
def GetMiddle(x, y):
return (x - y) / 2
def GetBlendColor(Rarity):
if Rarity == "frozen":
blendColor = (148, 223, 255)
elif Rarity == "lava":
blendColor = (234, 141, 35)
elif Rarity == "legendary":
... | [
"PIL.Image.new",
"aiofiles.open",
"PIL.ImageFont.truetype",
"aiohttp.ClientSession",
"PIL.ImageDraw.Draw"
] | [((3306, 3332), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['Background'], {}), '(Background)\n', (3320, 3332), False, 'from PIL import Image, ImageFont, ImageDraw\n'), ((3347, 3417), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['f"""assets/Fonts/BurbankBigCondensed-Black.otf"""', '(100)'], {}), "(f'assets/Fonts/Bur... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"absl.testing.absltest.main",
"jax.disable_jit",
"jax.numpy.log2",
"aqt.jax.primitives.round_and_clip_to_signed_int",
"jax.random.PRNGKey",
"aqt.jax.quantization.quantized_dot_general",
"aqt.jax.test_utils.configure_jax",
"aqt.jax.quantization.quantized_dot",
"unittest.mock.patch.object",
"aqt.jax... | [((1250, 1276), 'aqt.jax.test_utils.configure_jax', 'test_utils.configure_jax', ([], {}), '()\n', (1274, 1276), False, 'from aqt.jax import test_utils\n'), ((28850, 28891), 'unittest.mock.patch.object', 'mock.patch.object', (['jax.lax', '"""dot_general"""'], {}), "(jax.lax, 'dot_general')\n", (28867, 28891), False, 'fr... |
import codecs
import logging
import os
import sys
from pathlib import Path
import methodtools
import regex
import toml
from timebudget import timebudget
from jyotisha import custom_transliteration
from jyotisha.panchaanga.temporal import names
from sanskrit_data.schema import common
from indic_transliteration import ... | [
"jyotisha.custom_transliteration.tr",
"pathlib.Path",
"jyotisha.panchaanga.temporal.festival.rules.summary.get_description_str_with_shlokas",
"jyotisha.panchaanga.temporal.time.Date.from_julian_date",
"os.path.join",
"codecs.open",
"logging.warning",
"os.path.dirname",
"jyotisha.panchaanga.temporal.... | [((8806, 8843), 'os.path.join', 'os.path.join', (['DATA_ROOT', '"""repos.toml"""'], {}), "(DATA_ROOT, 'repos.toml')\n", (8818, 8843), False, 'import os\n'), ((12750, 12803), 'sanskrit_data.schema.common.update_json_class_index', 'common.update_json_class_index', (['sys.modules[__name__]'], {}), '(sys.modules[__name__])... |
import rNet as rNet
import numpy as np
def generate(net,seed_,num_to_gen):
net.reset()
x=np.zeros((1,1,vocab_size))
x[0,0,seed_]=1
out=index_to_char[seed_]
for t in range(0,num_to_gen):
p=net(x)[0,0,:]
ix = np.random.choice(range(vocab_size), p=p.ravel())
x=np.zeros(x.shape)... | [
"rNet.rNet",
"numpy.zeros_like",
"numpy.log",
"rNet.LSTM",
"numpy.zeros",
"numpy.clip",
"numpy.random.randint",
"numpy.array",
"rNet.softmax",
"rNet.softmax_loss",
"numpy.sqrt"
] | [((859, 870), 'rNet.rNet', 'rNet.rNet', ([], {}), '()\n', (868, 870), True, 'import rNet as rNet\n'), ((1052, 1071), 'rNet.softmax_loss', 'rNet.softmax_loss', ([], {}), '()\n', (1069, 1071), True, 'import rNet as rNet\n'), ((1426, 1488), 'numpy.random.randint', 'np.random.randint', (['(data_size - time_steps - 1)'], {'... |
# Copyright 2004-2021 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish,... | [
"os.makedirs",
"os.path.basename",
"os.path.dirname",
"os.path.exists",
"re.match",
"time.strftime",
"renpy.parser.elide_filename",
"collections.defaultdict",
"renpy.translation.quote_unicode",
"os.path.normpath",
"os.path.relpath",
"shutil.copy",
"os.path.join",
"re.sub"
] | [((3245, 3285), 'os.path.normpath', 'os.path.normpath', (['renpy.config.commondir'], {}), '(renpy.config.commondir)\n', (3261, 3285), False, 'import os\n'), ((3300, 3338), 'os.path.normpath', 'os.path.normpath', (['renpy.config.gamedir'], {}), '(renpy.config.gamedir)\n', (3316, 3338), False, 'import os\n'), ((3887, 396... |
# -*- coding: utf-8 -*-
"""
Convert ECoG to NWB.
:Author: <NAME>, <NAME>
Modified by <NAME> on May 30, 2020
"""
from __future__ import print_function
import os
from datetime import datetime
from os import path
from pathlib import Path
import numpy as np
import pandas as pd
from hdmf.backends.hdf5 import H5DataIO
from... | [
"scipy.io.loadmat",
"pandas.read_csv",
"hdmf.backends.hdf5.H5DataIO",
"scipy.io.wavfile.read",
"numpy.argsort",
"os.path.isfile",
"pathlib.Path",
"numpy.arange",
"pynwb.NWBFile",
"os.path.join",
"numpy.unique",
"numpy.zeros_like",
"os.path.exists",
"numpy.isfinite",
"ndx_bipolar_scheme.E... | [((765, 778), 'pynwb.get_manager', 'get_manager', ([], {}), '()\n', (776, 778), False, 'from pynwb import NWBFile, TimeSeries, get_manager, NWBHDF5IO\n'), ((1076, 1100), 'os.path.isfile', 'os.path.isfile', (['wav_path'], {}), '(wav_path)\n', (1090, 1100), False, 'import os\n'), ((1268, 1292), 'os.path.isfile', 'os.path... |
"""Fruit Basket CLI."""
import argparse
import sys
from fruit_basket import __version__, FruitBasket, report
from fruit_basket.exceptions import FruitBasketError
def _create_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(description="Fruit Basket CLI Help", allow_abbrev=False)
parser.... | [
"fruit_basket.FruitBasket",
"argparse.ArgumentParser",
"sys.exit",
"argparse.FileType"
] | [((227, 312), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Fruit Basket CLI Help"""', 'allow_abbrev': '(False)'}), "(description='Fruit Basket CLI Help', allow_abbrev=False\n )\n", (250, 312), False, 'import argparse\n'), ((482, 501), 'argparse.FileType', 'argparse.FileType', ([], {... |
from functools import partial
import colossalai
from colossalai.utils.cuda import get_current_device
import pytest
import torch
import torch.multiprocessing as mp
from colossalai.amp import convert_to_apex_amp
from colossalai.nn.optimizer import CPUAdam
from colossalai.testing import parameterize, rerun_on_ex... | [
"colossalai.utils.free_port",
"colossalai.context.MOE_CONTEXT.reset_loss",
"torch.multiprocessing.spawn",
"tests.test_zero_data_parallel.common.check_sharded_model_params",
"colossalai.testing.parameterize",
"colossalai.zero.sharded_model.utils.col_model_deepcopy",
"colossalai.zero.sharded_optim.Sharded... | [((1697, 1739), 'colossalai.testing.parameterize', 'parameterize', (['"""cpu_offload"""', '[True, False]'], {}), "('cpu_offload', [True, False])\n", (1709, 1739), False, 'from colossalai.testing import parameterize, rerun_on_exception\n'), ((1742, 1784), 'colossalai.testing.parameterize', 'parameterize', (['"""use_cpua... |
from aula05082019.ListaDuplamenteLigada import ListaDuplamenteLigada
listaDuplamenteLigada = ListaDuplamenteLigada()
listaDuplamenteLigada.inserirInicio(2)
listaDuplamenteLigada.inserirInicio(1)
listaDuplamenteLigada.inserirFim(3)
listaDuplamenteLigada.inserir(100, 3)
print('---Imprimir Diretamente:')
listaDuplamente... | [
"aula05082019.ListaDuplamenteLigada.ListaDuplamenteLigada"
] | [((94, 117), 'aula05082019.ListaDuplamenteLigada.ListaDuplamenteLigada', 'ListaDuplamenteLigada', ([], {}), '()\n', (115, 117), False, 'from aula05082019.ListaDuplamenteLigada import ListaDuplamenteLigada\n')] |
import setuptools
def readme():
with open('README.md', encoding='utf8') as fp:
return fp.read()
def requirements():
with open('requirements.txt') as fp:
return fp.readlines()
setuptools.setup(
name = 'nr.dnn',
version = '1.0.0',
author = '<NAME>',
author_email = '<EMAIL>',
description = 'git',... | [
"setuptools.find_packages"
] | [((533, 564), 'setuptools.find_packages', 'setuptools.find_packages', (['"""src"""'], {}), "('src')\n", (557, 564), False, 'import setuptools\n')] |
from __future__ import absolute_import, division, print_function
# LIBTBX_SET_DISPATCHER_NAME phenix.fake_f_obs
from cctbx import adptbx
from cctbx.array_family import flex
import random, math, sys, os
import iotbx.pdb
import mmtbx.utils
from libtbx import easy_run
import mmtbx.dynamics.cartesian_dynamics as cartesian... | [
"cctbx.array_family.flex.set_random_seed",
"mmtbx.tls.ladp.set_ladp",
"six.moves.range",
"cctbx.array_family.flex.std_string",
"os.path.basename",
"cctbx.adptbx.random_u_cart",
"mmtbx.utils.run_reduce_with_timeout",
"cctbx.adptbx.u_as_b",
"mmtbx.monomer_library.server.server",
"random.seed",
"ra... | [((692, 706), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (703, 706), False, 'import random, math, sys, os\n'), ((709, 732), 'cctbx.array_family.flex.set_random_seed', 'flex.set_random_seed', (['(0)'], {}), '(0)\n', (729, 732), False, 'from cctbx.array_family import flex\n'), ((3527, 3666), 'mmtbx.tls.ladp.se... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os,time,cv2,scipy.io
import tensorflow as tf
# import tensorflow.contrib.slim as slim
import scipy.misc as sic
# import network as network
import subprocess
import numpy as np
from matplotlib.co... | [
"cv2.GaussianBlur",
"numpy.load",
"numpy.maximum",
"numpy.ones",
"numpy.random.randint",
"numpy.tile",
"glob.glob",
"tensorflow.abs",
"numpy.power",
"numpy.max",
"numpy.int",
"numpy.reshape",
"numpy.linspace",
"tensorflow.atan",
"tensorflow.equal",
"numpy.uint8",
"numpy.minimum",
"... | [((554, 576), 'glob.glob', 'glob', (["(data_path + '/*')"], {}), "(data_path + '/*')\n", (558, 576), False, 'from glob import glob\n'), ((1701, 1754), 'glob.glob', 'glob', (['"""../data_new/Data_Polar_Clean/MMR_1/train/*npy"""'], {}), "('../data_new/Data_Polar_Clean/MMR_1/train/*npy')\n", (1705, 1754), False, 'from glo... |
import cadquery as cq
import cadquery.selectors as cqs
import logging, importlib
from types import SimpleNamespace as Measures
import utilities # local directory import
# Outline shape of an X-Mount Type M socket for smartphones and other small mobile devices.
# Selective reloading to pick up changes made between scr... | [
"importlib.reload",
"cadquery.Workplane",
"types.SimpleNamespace",
"logging.getLogger"
] | [((407, 434), 'importlib.reload', 'importlib.reload', (['utilities'], {}), '(utilities)\n', (423, 434), False, 'import logging, importlib\n'), ((442, 469), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (459, 469), False, 'import logging, importlib\n'), ((10147, 10305), 'types.SimpleNames... |
import os, uuid, pathlib, base64, json
import sys
ROOT_DIR = os.path.abspath("../../../")
sys.path.append(ROOT_DIR)
from layoutlm.data.convert import convert_img_to_xml
from examples.classification.predict import make_prediction
from mapping import get_template_id
# assumes model exists and is in same directory as th... | [
"sys.path.append",
"os.mkdir",
"os.path.abspath",
"uuid.uuid4",
"layoutlm.data.convert.convert_img_to_xml",
"base64.b64decode",
"examples.classification.predict.make_prediction",
"mapping.get_template_id",
"os.path.join"
] | [((61, 89), 'os.path.abspath', 'os.path.abspath', (['"""../../../"""'], {}), "('../../../')\n", (76, 89), False, 'import os, uuid, pathlib, base64, json\n'), ((90, 115), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (105, 115), False, 'import sys\n'), ((580, 624), 'os.path.join', 'os.path.jo... |
"""Hyperboloid manifold."""
import torch
from manifolds.base import Manifold
from manifolds.poincare import PoincareBall
from utils.math_utils import arcosh, cosh, sinh
class Hyperboloid(Manifold):
"""
Hyperboloid manifold class.
We use the following convention: -x0^2 + x1^2 + ... + xd^2 = -K
c ... | [
"torch.ones_like",
"manifolds.poincare.PoincareBall.from_hyperboloid",
"torch.ones",
"torch.zeros_like",
"utils.math_utils.cosh",
"torch.norm",
"utils.math_utils.arcosh",
"torch.cat",
"torch.clamp",
"utils.math_utils.sinh",
"torch.sum",
"manifolds.poincare.PoincareBall.concat"
] | [((1260, 1318), 'torch.clamp', 'torch.clamp', (['(-prod / K)'], {'min': '(1.0 + Hyperboloid.eps[x.dtype])'}), '(-prod / K, min=1.0 + Hyperboloid.eps[x.dtype])\n', (1271, 1318), False, 'import torch\n'), ((1436, 1465), 'torch.clamp', 'torch.clamp', (['sqdist'], {'max': '(50.0)'}), '(sqdist, max=50.0)\n', (1447, 1465), F... |
import PIL
from PIL import Image, ImageDraw
import math
def generate(width, height, fg, bkg, n, steps, substeps, length, angleincr, angle, exportPath):
bkg_color = (int(bkg[1:3], base=16), int(bkg[3:5], base=16), int(bkg[5:7], base=16))
image = Image.new('RGB', (width, height), color=bkg_color)
draw = Imag... | [
"PIL.ImageDraw.Draw",
"PIL.Image.new",
"math.radians"
] | [((254, 304), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(width, height)'], {'color': 'bkg_color'}), "('RGB', (width, height), color=bkg_color)\n", (263, 304), False, 'from PIL import Image, ImageDraw\n'), ((316, 337), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['image'], {}), '(image)\n', (330, 337), False, 'from PIL... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import pickle
from keras import Sequential
from keras.layers import Bidirectional, Dense, Embedding, LSTM, TimeDistributed
from keras_contrib.layers.crf import CRF
from keras_contrib.losses import crf_loss
from keras_contrib.metrics import crf_viterbi_accuracy
... | [
"keras.Sequential",
"keras.layers.LSTM",
"pickle.dump",
"keras.layers.Dense"
] | [((1312, 1324), 'keras.Sequential', 'Sequential', ([], {}), '()\n', (1322, 1324), False, 'from keras import Sequential\n'), ((1186, 1220), 'pickle.dump', 'pickle.dump', (['hist.history', 'file_pi'], {}), '(hist.history, file_pi)\n', (1197, 1220), False, 'import pickle\n'), ((1652, 1690), 'keras.layers.LSTM', 'LSTM', ([... |
from __future__ import absolute_import
from django.contrib.auth.models import Group
from django.test import TestCase
from hs_core import hydroshare
class TestGroupFromId(TestCase):
def setUp(self):
self.group, _ = Group.objects.get_or_create(name='Resource Author')
self.user = hydroshare.create... | [
"hs_core.hydroshare.create_account",
"django.contrib.auth.models.Group.objects.get_or_create",
"hs_core.hydroshare.group_from_id"
] | [((231, 282), 'django.contrib.auth.models.Group.objects.get_or_create', 'Group.objects.get_or_create', ([], {'name': '"""Resource Author"""'}), "(name='Resource Author')\n", (258, 282), False, 'from django.contrib.auth.models import Group\n'), ((303, 425), 'hs_core.hydroshare.create_account', 'hydroshare.create_account... |
import os
import tempfile
import unittest
from django.test.simple import DjangoTestSuiteRunner, build_suite, reorder_suite
from django.test import TestCase as DjangoTestCase
from django.test._doctest import DocTestCase
from django.db.models import get_app, get_apps
from django.db import transaction, connections, DEFAU... | [
"os.environ.get",
"os.path.dirname",
"django.utils.importlib.import_module",
"junitxml.JUnitXmlResult"
] | [((522, 558), 'os.environ.get', 'os.environ.get', (['"""HUMFREY_JUNIT_TEST"""'], {}), "('HUMFREY_JUNIT_TEST')\n", (536, 558), False, 'import os\n'), ((631, 656), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (646, 656), False, 'import os\n'), ((762, 793), 'junitxml.JUnitXmlResult', 'junitxml... |
from django.conf.urls import url
from drugs import views
urlpatterns = [
url(r'^drugbrowser', views.drugbrowser, name='drugbrowser'),
url(r'^drugstatistics', views.drugstatistics, name='drugstatistics'),
url(r'^drugmapping', views.drugmapping, name='drugmapping'),
] | [
"django.conf.urls.url"
] | [((79, 137), 'django.conf.urls.url', 'url', (['"""^drugbrowser"""', 'views.drugbrowser'], {'name': '"""drugbrowser"""'}), "('^drugbrowser', views.drugbrowser, name='drugbrowser')\n", (82, 137), False, 'from django.conf.urls import url\n'), ((145, 212), 'django.conf.urls.url', 'url', (['"""^drugstatistics"""', 'views.dr... |
from datetime import date, datetime
import pandas as pd
import pytest
from alpaca_trade_api.rest import TimeFrame
from pytz import timezone
from liualgotrader.common import config
from liualgotrader.common.data_loader import DataLoader # type: ignore
from liualgotrader.common.types import DataConnectorType, TimeScal... | [
"liualgotrader.common.data_loader.DataLoader",
"liualgotrader.data.alpaca.AlpacaData",
"datetime.date",
"pytz.timezone"
] | [((392, 420), 'pytz.timezone', 'timezone', (['"""America/New_York"""'], {}), "('America/New_York')\n", (400, 420), False, 'from pytz import timezone\n'), ((500, 512), 'liualgotrader.data.alpaca.AlpacaData', 'AlpacaData', ([], {}), '()\n', (510, 512), False, 'from liualgotrader.data.alpaca import AlpacaData, AlpacaStrea... |
from __future__ import print_function
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.views.generic.base import RedirectView
from django.views.generic import CreateView, TemplateView
from django.views.generic.edit import UpdateView
from django.conf import settings
from djan... | [
"django.core.urlresolvers.reverse",
"django.shortcuts.redirect",
"carton.cart.Cart",
"django.shortcuts.get_object_or_404",
"mcat_order.models.Order.objects.create",
"mcat_order.models.OrderedProduct.objects.create",
"mcat_order.models.Customer.objects.filter",
"django.template.RequestContext"
] | [((878, 899), 'carton.cart.Cart', 'Cart', (['request.session'], {}), '(request.session)\n', (882, 899), False, 'from carton.cart import Cart\n'), ((918, 955), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Product'], {'slug': 'slug'}), '(Product, slug=slug)\n', (935, 955), False, 'from django.shortcuts i... |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | [
"marshmallow.fields.Str",
"marshmallow.validate.OneOf"
] | [((2603, 2628), 'marshmallow.fields.Str', 'fields.Str', ([], {'required': '(True)'}), '(required=True)\n', (2613, 2628), False, 'from marshmallow import fields, validate\n'), ((2517, 2561), 'marshmallow.validate.OneOf', 'validate.OneOf', (['V1EventKind.allowable_values'], {}), '(V1EventKind.allowable_values)\n', (2531,... |
from astropy import units as u
from glue.core.message import (DataCollectionAddMessage,
DataCollectionDeleteMessage)
from glue.core import Data
from glue.core.link_helpers import LinkSame
from spectral_cube import SpectralCube
from specutils import SpectralRegion
from traitlets import Lis... | [
"traitlets.Int",
"traitlets.List",
"glue.core.link_helpers.LinkSame",
"jdaviz.utils.load_template",
"jdaviz.core.events.SnackbarMessage",
"specutils.SpectralRegion.from_center",
"traitlets.Unicode",
"astropy.units.add_enabled_units",
"glue.core.Data",
"jdaviz.core.registries.tray_registry",
"tra... | [((652, 681), 'astropy.units.add_enabled_units', 'u.add_enabled_units', (['[spaxel]'], {}), '([spaxel])\n', (671, 681), True, 'from astropy import units as u\n'), ((839, 884), 'jdaviz.core.registries.tray_registry', 'tray_registry', (['"""g-collapse"""'], {'label': '"""Collapse"""'}), "('g-collapse', label='Collapse')\... |
from abc import ABCMeta, abstractmethod, abstractstaticmethod
from typing import List
import requests
from bs4 import BeautifulSoup
from anime_cli.anime import Anime
class SearchApi(metaclass=ABCMeta):
def __init__(self, mirror: str):
self.url = f"https://example.{mirror}"
self.request_headers =... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((890, 958), 'requests.get', 'requests.get', (['f"""{self.url}/{location}"""'], {'headers': 'self.request_headers'}), "(f'{self.url}/{location}', headers=self.request_headers)\n", (902, 958), False, 'import requests\n'), ((974, 1019), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.content'], {'features': '"""html5lib"""'}... |
import os, sys, time
import numpy as np
from skimage import io
def cropframes(clip_dir, image_files, clip_path):
clip = clip_path.split('/')[-1]
clip_name = clip.split('.')[0]
crop_dir = clip_dir + 'cropped/'
# crop_dir = '/home/sxg755/dataset/train/all_frames/cropped/'
if not os.path.exists(crop_dir):
os.ma... | [
"os.path.exists",
"os.makedirs",
"skimage.io.imread"
] | [((287, 311), 'os.path.exists', 'os.path.exists', (['crop_dir'], {}), '(crop_dir)\n', (301, 311), False, 'import os, sys, time\n'), ((315, 336), 'os.makedirs', 'os.makedirs', (['crop_dir'], {}), '(crop_dir)\n', (326, 336), False, 'import os, sys, time\n'), ((410, 426), 'skimage.io.imread', 'io.imread', (['image'], {}),... |
import openpyxl as op
from os.path import exists
from src.pyion.objects.PyionData import PyionData
def check_headers(sheet) -> None:
if sheet is None:
raise Exception("Sheet cannot be null")
headers = list(sheet.rows)[0]
if len(headers) != 6:
raise Exception("Number of columns is off, shou... | [
"openpyxl.load_workbook",
"os.path.exists",
"src.pyion.objects.PyionData.PyionData"
] | [((1461, 1477), 'os.path.exists', 'exists', (['file_loc'], {}), '(file_loc)\n', (1467, 1477), False, 'from os.path import exists\n'), ((1617, 1628), 'src.pyion.objects.PyionData.PyionData', 'PyionData', ([], {}), '()\n', (1626, 1628), False, 'from src.pyion.objects.PyionData import PyionData\n'), ((1642, 1700), 'openpy... |
import json
import os
import re
import subprocess
os.environ['PATH'] += ':' + os.environ['LAMBDA_TASK_ROOT']
BASES = [
'A',
'C',
'G',
'T',
'N',
]
all_count_pattern = re.compile('[0-9]+')
get_all_calls = all_count_pattern.findall
def perform_query(reference_bases, region, end_min, end_max, alter... | [
"subprocess.Popen",
"json.dumps",
"re.compile"
] | [((189, 209), 're.compile', 're.compile', (['"""[0-9]+"""'], {}), "('[0-9]+')\n", (199, 209), False, 'import re\n'), ((571, 647), 'subprocess.Popen', 'subprocess.Popen', (['args'], {'stdout': 'subprocess.PIPE', 'cwd': '"""/tmp"""', 'encoding': '"""ascii"""'}), "(args, stdout=subprocess.PIPE, cwd='/tmp', encoding='ascii... |
#!/usr/bin/env python
from setuptools import setup
import glob
package_name = 'apex_launchtest'
setup(
name=package_name,
version='0.1',
description='Apex integration test runner and utilities',
author='<NAME>',
author_email='<EMAIL>',
data_files=[
('share/ament_index/resource_index... | [
"glob.glob"
] | [((395, 428), 'glob.glob', 'glob.glob', (['"""example_processes/**"""'], {}), "('example_processes/**')\n", (404, 428), False, 'import glob\n'), ((479, 507), 'glob.glob', 'glob.glob', (['"""examples/[!_]**"""'], {}), "('examples/[!_]**')\n", (488, 507), False, 'import glob\n')] |
import pyclesperanto_prototype as cle
import numpy as np
def test_maximum_y_projection():
test1 = cle.push(np.asarray([
[
[1, 0, 0, 0, 9],
[0, 2, 0, 8, 0],
[3, 0, 1, 0, 10],
[0, 4, 0, 7, 0],
[5, 0, 6, 0, 10]
], [
[0, 2, 0, 8, 0... | [
"numpy.array_equal",
"pyclesperanto_prototype.maximum_y_projection",
"numpy.asarray",
"pyclesperanto_prototype.pull",
"pyclesperanto_prototype.create"
] | [((1129, 1150), 'pyclesperanto_prototype.create', 'cle.create', (['reference'], {}), '(reference)\n', (1139, 1150), True, 'import pyclesperanto_prototype as cle\n'), ((1155, 1194), 'pyclesperanto_prototype.maximum_y_projection', 'cle.maximum_y_projection', (['test1', 'result'], {}), '(test1, result)\n', (1179, 1194), T... |
import graphlab as gl
import pandas as pd
import numpy as np
import os
from .core import TrajRecord
def createTrajRecordFromPandasDF(df):
user_daily_loc = gl.SFrame(data = df)
return createTrajRecordFromSFrame(user_daily_loc)
def createTrajRecordFromSparkDF(df, sparkContext):
user_daily_loc = gl.SFrame.f... | [
"pandas.Timestamp",
"pandas.date_range",
"os.makedirs",
"graphlab.aggregate.CONCAT",
"os.path.isdir",
"graphlab.SFrame.from_rdd",
"graphlab.SFrame",
"pandas.Timedelta",
"os.path.join",
"graphlab.SFrame.read_csv"
] | [((161, 179), 'graphlab.SFrame', 'gl.SFrame', ([], {'data': 'df'}), '(data=df)\n', (170, 179), True, 'import graphlab as gl\n'), ((309, 345), 'graphlab.SFrame.from_rdd', 'gl.SFrame.from_rdd', (['df', 'sparkContext'], {}), '(df, sparkContext)\n', (327, 345), True, 'import graphlab as gl\n'), ((462, 506), 'graphlab.SFram... |
import sys
sys.path.insert(0, "../../../")
import argparse
import torch
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data as data_utils
import numpy as np
from paper_experiments.rotated_MNIST.mnist_loader_shifted_label_distribution_rotate import MnistRotatedDist
from paper_experimen... | [
"paper_experiments.rotated_MNIST.mnist_loader_shifted_label_distribution_rotate.MnistRotatedDist",
"torch.utils.data.ConcatDataset",
"numpy.random.seed",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"paper_experiments.rotated_MNIST.mnist_loader.MnistRotated",
"paper_experiments.rotated_MNIS... | [((11, 42), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../../"""'], {}), "(0, '../../../')\n", (26, 42), False, 'import sys\n'), ((1679, 1739), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch MNIST Example"""'}), "(description='PyTorch MNIST Example')\n", (1702, 1739), ... |
"""Scanning tests with fake mDNS responder.."""
from ipaddress import ip_address
import pytest
from pyatv.const import Protocol
from tests import fake_udns
from tests.conftest import Scanner
from tests.utils import assert_device
IP_1 = "10.0.0.1"
AIRPLAY_NAME = "AirPlay ATV"
AIRPLAY_ID = "AA:BB:CC:DD:EE:FF"
pyte... | [
"ipaddress.ip_address",
"tests.fake_udns.airplay_service"
] | [((472, 541), 'tests.fake_udns.airplay_service', 'fake_udns.airplay_service', (['AIRPLAY_NAME', 'AIRPLAY_ID'], {'addresses': '[IP_1]'}), '(AIRPLAY_NAME, AIRPLAY_ID, addresses=[IP_1])\n', (497, 541), False, 'from tests import fake_udns\n'), ((723, 739), 'ipaddress.ip_address', 'ip_address', (['IP_1'], {}), '(IP_1)\n', (... |
__author__ = 'sibirrer'
import numpy as np
from astropy.cosmology import default_cosmology
from lenstronomy.Util import class_creator
from lenstronomy.Util import constants as const
from lenstronomy.Cosmo.lens_cosmo import LensCosmo
from lenstronomy.Analysis.kinematics_api import KinematicsAPI
class TDCosmography(... | [
"lenstronomy.Cosmo.lens_cosmo.LensCosmo",
"numpy.var",
"astropy.cosmology.default_cosmology.get",
"numpy.mean",
"lenstronomy.Util.class_creator.create_class_instances"
] | [((2250, 2321), 'lenstronomy.Cosmo.lens_cosmo.LensCosmo', 'LensCosmo', ([], {'z_lens': 'z_lens', 'z_source': 'z_source', 'cosmo': 'self._cosmo_fiducial'}), '(z_lens=z_lens, z_source=z_source, cosmo=self._cosmo_fiducial)\n', (2259, 2321), False, 'from lenstronomy.Cosmo.lens_cosmo import LensCosmo\n'), ((2422, 2542), 'le... |
#!/usr/bin/python
#
# Copyright 2018 The boardgame.io Authors
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
#
# pylint: disable=invalid-name,multiple-imports,global-statement
# To play against this bot, start the tict... | [
"boardgameio.Bot.__init__",
"logging.basicConfig",
"signal.signal",
"logging.getLogger"
] | [((1770, 1795), 'logging.getLogger', 'logging.getLogger', (['"""main"""'], {}), "('main')\n", (1787, 1795), False, 'import signal, random, logging\n'), ((1796, 1835), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (1815, 1835), False, 'import signal, random, log... |
import os
import random
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
def save_parameters(options, filename):
with open(filename, "w+") as f:
for key in options.keys():
f.write("{}... | [
"matplotlib.pyplot.title",
"seaborn.lineplot",
"numpy.random.seed",
"matplotlib.pyplot.show",
"pandas.read_csv",
"torch.manual_seed",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.close",
"random.seed",
"seaborn.distplot",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig"
] | [((469, 486), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (480, 486), False, 'import random\n'), ((536, 556), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (550, 556), True, 'import numpy as np\n'), ((561, 584), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (57... |
# NEVER CALL THIS FROM A SERVICE OR MODEL, ONLY FROM VIEWS/API VIEWS/URLS
import datetime
import logging
import pytz
from django.http import HttpResponse
from django.views.generic import View
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from channels import service as channels_s... | [
"shows.service.fetch_randomized_suggestions",
"shows.service.get_unused_interval_list",
"logging.basicConfig",
"django.http.HttpResponse",
"django.core.urlresolvers.reverse",
"django.shortcuts.redirect",
"shows.service.set_show_interval_random_player",
"shows.service.set_voting_options",
"datetime.d... | [((371, 410), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (390, 410), False, 'import logging\n'), ((420, 447), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (437, 447), False, 'import logging\n'), ((4308, 4366), 'shows.service.... |
from django.contrib import admin
from adminsortable.admin import SortableAdmin
from merlin.music.models import Song, Category
# Register your models here.
class SongAdmin(SortableAdmin):
list_display = ['__str__', 'artist', 'category', 'fan_votes']
admin.site.register(Category, SortableAdmin)
admin.site.registe... | [
"django.contrib.admin.site.register"
] | [((257, 301), 'django.contrib.admin.site.register', 'admin.site.register', (['Category', 'SortableAdmin'], {}), '(Category, SortableAdmin)\n', (276, 301), False, 'from django.contrib import admin\n'), ((302, 338), 'django.contrib.admin.site.register', 'admin.site.register', (['Song', 'SongAdmin'], {}), '(Song, SongAdmi... |
"""
Miscellaneous utility functions used in other modules.
"""
import glob
from typing import Dict, List, Optional, Tuple, Union
import networkx as nx
import pandas as pd
def get_paths_to_files_in_directory(
directory: str, file_dsc: str = "*"
) -> List[str]:
"""Get paths of all files matching file_dsc in d... | [
"pandas.DataFrame",
"pandas.tseries.frequencies.to_offset",
"pandas.infer_freq",
"networkx.relabel_nodes",
"glob.glob"
] | [((389, 408), 'glob.glob', 'glob.glob', (['template'], {}), '(template)\n', (398, 408), False, 'import glob\n'), ((655, 674), 'glob.glob', 'glob.glob', (['template'], {}), '(template)\n', (664, 674), False, 'import glob\n'), ((1216, 1247), 'networkx.relabel_nodes', 'nx.relabel_nodes', (['new_g', 'labels'], {}), '(new_g... |
from lightspider import Spider, light, DEFAULT_PROXY
from lxml import etree
import re
# 编写页面解析函数
@light
def parser(response):
"""
必要的页面解析函数
:param response: 执行Request请求后得到的Response对象,可以自由选择xpath或BeautifulSoup等方式解析处理
:return: type:tuple:(解析得到的数据对象, 解析页面得到的新的tasks(要么为List,要么为None)
"""
html = et... | [
"lightspider.Spider",
"lxml.etree.HTML"
] | [((958, 1075), 'lightspider.Spider', 'Spider', ([], {'base_url': 'base_url', 'save_format': 'save_format', 'save_path': '"""D:\\\\Data\\\\NLP\\\\corpus\\\\test"""', 'proxy': 'DEFAULT_PROXY'}), "(base_url=base_url, save_format=save_format, save_path=\n 'D:\\\\Data\\\\NLP\\\\corpus\\\\test', proxy=DEFAULT_PROXY)\n", (... |
import numpy
from numpy import dot, sqrt
def binarize_vector(u):
return u > 0
def cosine_distance(u, v, binary=False):
"""Return the cosine distance between two vectors."""
if binary:
return cosine_distance_binary(u, v)
return 1.0 - dot(u, v) / (sqrt(dot(u, u)) * sqrt(dot(v, v)))
def cosin... | [
"numpy.dot",
"numpy.asarray",
"numpy.bitwise_or"
] | [((1346, 1362), 'numpy.asarray', 'numpy.asarray', (['u'], {}), '(u)\n', (1359, 1362), False, 'import numpy\n'), ((1371, 1387), 'numpy.asarray', 'numpy.asarray', (['v'], {}), '(v)\n', (1384, 1387), False, 'import numpy\n'), ((592, 607), 'numpy.dot', 'dot', (['diff', 'diff'], {}), '(diff, diff)\n', (595, 607), False, 'fr... |
import random
import logging
from . import scheme
__all__ = ('MTProtoSessionData',)
log = logging.getLogger(__package__)
class MTProtoSessionData:
def __init__(self, id):
if id is None:
id = random.SystemRandom().getrandbits(64)
log.debug('no session_id provided,... | [
"random.SystemRandom",
"logging.getLogger"
] | [((100, 130), 'logging.getLogger', 'logging.getLogger', (['__package__'], {}), '(__package__)\n', (117, 130), False, 'import logging\n'), ((235, 256), 'random.SystemRandom', 'random.SystemRandom', ([], {}), '()\n', (254, 256), False, 'import random\n')] |
__title__ = "sql2statsd"
__version__ = "1.2.5"
import os
import click
import psycopg2
from statsd import StatsClient
from sql2statsd.utils import YamlFile, log
APP_DIR = click.get_app_dir(__title__)
def ensure_app_dir():
log("Ensuring app dir exists...")
try:
os.makedirs(APP_DIR)
except OSErro... | [
"statsd.StatsClient",
"os.makedirs",
"click.get_app_dir",
"sql2statsd.utils.log",
"sql2statsd.utils.YamlFile",
"os.path.join",
"psycopg2.connect"
] | [((174, 202), 'click.get_app_dir', 'click.get_app_dir', (['__title__'], {}), '(__title__)\n', (191, 202), False, 'import click\n'), ((231, 264), 'sql2statsd.utils.log', 'log', (['"""Ensuring app dir exists..."""'], {}), "('Ensuring app dir exists...')\n", (234, 264), False, 'from sql2statsd.utils import YamlFile, log\n... |
import sympy as sp, math as m
x = sp.symbols('x')
sp.init_printing(use_unicode=True)
#f=sp.Lambda(x, x*sp.cos(x)-x**2*sp.sin(x))
#f=sp.Lambda(x, sp.exp(sp.sin(x)**2-2))
"""
def f(x):
#return x*m.cos(x)-x**2*m.sin(x)
return m.exp(3*x)*m.sin(3*x)/(x**4+1)
"""
def trapecio_compuesta(f, a, b, n):
h = (... | [
"sympy.symbols",
"sympy.cos",
"sympy.init_printing"
] | [((35, 50), 'sympy.symbols', 'sp.symbols', (['"""x"""'], {}), "('x')\n", (45, 50), True, 'import sympy as sp, math as m\n'), ((51, 85), 'sympy.init_printing', 'sp.init_printing', ([], {'use_unicode': '(True)'}), '(use_unicode=True)\n', (67, 85), True, 'import sympy as sp, math as m\n'), ((680, 697), 'sympy.cos', 'sp.co... |
# Copyright (c) 2012-2013 SHIFT.com
#
# 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, modify, merge, publish, dist... | [
"thunderdome.gremlin.parse",
"os.path.dirname"
] | [((1417, 1435), 'thunderdome.gremlin.parse', 'parse', (['groovy_file'], {}), '(groovy_file)\n', (1422, 1435), False, 'from thunderdome.gremlin import parse\n'), ((1345, 1370), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1360, 1370), False, 'import os\n')] |
from typing import Dict, Optional, List, Any, Set, TYPE_CHECKING, Tuple
from bxutils import logging
from bxcommon.feed.feed import Feed, FeedKey
from bxcommon.feed.subscriber import Subscriber
if TYPE_CHECKING:
from bxcommon.connections.abstract_node import AbstractNode
logger = logging.get_logger(__name__)
c... | [
"bxcommon.feed.feed.FeedKey",
"bxutils.logging.get_logger"
] | [((288, 316), 'bxutils.logging.get_logger', 'logging.get_logger', (['__name__'], {}), '(__name__)\n', (306, 316), False, 'from bxutils import logging\n'), ((644, 657), 'bxcommon.feed.feed.FeedKey', 'FeedKey', (['item'], {}), '(item)\n', (651, 657), False, 'from bxcommon.feed.feed import Feed, FeedKey\n')] |
# Copyright The PyTorch Lightning team.
#
# 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 i... | [
"functools.partial",
"re.split",
"rouge_score.rouge_scorer.RougeScorer",
"torch.argmax",
"rouge_score.scoring.BootstrapAggregator",
"numpy.isclose",
"pytest.mark.skipif",
"torchmetrics.text.rouge.ROUGEScore",
"pytest.raises",
"torchmetrics.functional.text.rouge.rouge_score",
"pytest.mark.paramet... | [((2936, 3004), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not _NLTK_AVAILABLE)'], {'reason': '"""test requires nltk"""'}), "(not _NLTK_AVAILABLE, reason='test requires nltk')\n", (2954, 3004), False, 'import pytest\n'), ((3006, 3429), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["['pl_rouge_metric_key'... |
from vraapiclient import catalog
from st2actions.runners.pythonrunner import Action
class vRealizeAutomationAction(Action):
def __init__(self, config):
super(vRealizeAutomationAction, self).__init__(config)
self.vra7 = self._get_client()
def _get_client(self):
hostname = self.config['... | [
"vraapiclient.catalog.ConsumerClient"
] | [((474, 534), 'vraapiclient.catalog.ConsumerClient', 'catalog.ConsumerClient', (['hostname', 'username', 'password', 'tenant'], {}), '(hostname, username, password, tenant)\n', (496, 534), False, 'from vraapiclient import catalog\n')] |
#!/usr/bin/python
# Note : This is designed for Python 3
import numpy as np
class orthogonal_optimization:
def __init__(self, db):
self.cost_function = db['compute_cost']
self.gradient_function = db['compute_gradient']
self.x_opt = None
self.cost_opt = None
self.db = {}
#self.db['run_debug_2'] = True
... | [
"numpy.eye",
"numpy.linalg.qr",
"numpy.linalg.inv",
"numpy.linalg.norm"
] | [((667, 676), 'numpy.eye', 'np.eye', (['d'], {}), '(d)\n', (673, 676), True, 'import numpy as np\n'), ((1154, 1163), 'numpy.eye', 'np.eye', (['d'], {}), '(d)\n', (1160, 1163), True, 'import numpy as np\n'), ((1197, 1219), 'numpy.linalg.norm', 'np.linalg.norm', (['x_init'], {}), '(x_init)\n', (1211, 1219), True, 'import... |
#!/usr/bin/env python
import sys
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
w = Gtk.Window()
screen = Gdk.Screen.get_default()
print ("Montors: %d" % screen.get_n_monitors())
if len(sys.argv) > 1:
n = int(sys.argv[1])
else:
n = 0
l = Gtk.Button(l... | [
"gi.require_version",
"gi.repository.Gtk.main",
"gi.repository.Gdk.Screen.get_default",
"gi.repository.Gtk.Window"
] | [((45, 77), 'gi.require_version', 'gi.require_version', (['"""Gtk"""', '"""3.0"""'], {}), "('Gtk', '3.0')\n", (63, 77), False, 'import gi\n'), ((144, 156), 'gi.repository.Gtk.Window', 'Gtk.Window', ([], {}), '()\n', (154, 156), False, 'from gi.repository import Gtk\n'), ((167, 191), 'gi.repository.Gdk.Screen.get_defaul... |
import logging
import threading
import time
from django.db import close_old_connections
from meeting.views import StopMeetingAPI
from utils import cache
thread_id = 0
refresh_interval = 20 # 20 seconds
logger = logging.getLogger(__name__)
# Create your views here.
def start_delay_task():
if thread_id != 0:
... | [
"threading.Thread",
"utils.cache.delay_queue.retrieve",
"django.db.close_old_connections",
"threading.get_ident",
"time.sleep",
"meeting.views.StopMeetingAPI.stop_meeting",
"logging.getLogger"
] | [((215, 242), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (232, 242), False, 'import logging\n'), ((587, 608), 'threading.get_ident', 'threading.get_ident', ([], {}), '()\n', (606, 608), False, 'import threading\n'), ((1054, 1082), 'time.sleep', 'time.sleep', (['refresh_interval'], {})... |
"""
Tests for contingency table analyses.
"""
import os
import warnings
import numpy as np
import statsmodels.stats.contingency_tables as ctab
import pandas as pd
from numpy.testing import assert_allclose, assert_equal
import statsmodels.api as sm
cur_dir = os.path.dirname(os.path.abspath(__file__))
fname = "conting... | [
"numpy.random.seed",
"pandas.read_csv",
"numpy.ones",
"numpy.random.randint",
"numpy.arange",
"os.path.join",
"pandas.DataFrame",
"numpy.full",
"os.path.abspath",
"warnings.simplefilter",
"statsmodels.stats.contingency_tables.mcnemar",
"warnings.catch_warnings",
"numpy.testing.assert_equal",... | [((354, 393), 'os.path.join', 'os.path.join', (['cur_dir', '"""results"""', 'fname'], {}), "(cur_dir, 'results', fname)\n", (366, 393), False, 'import os\n'), ((406, 424), 'pandas.read_csv', 'pd.read_csv', (['fpath'], {}), '(fpath)\n', (417, 424), True, 'import pandas as pd\n'), ((468, 500), 'numpy.asarray', 'np.asarra... |
# -*- coding: utf-8 -*-
"""Tests for the variant_denovo_filtration workflow starting off variant_phasing.
"""
import textwrap
import pytest
import ruamel.yaml as yaml
from snakemake.io import Wildcards
from snappy_pipeline.workflows.variant_denovo_filtration import VariantDeNovoFiltrationWorkflow
from .common impor... | [
"snappy_pipeline.workflows.variant_denovo_filtration.VariantDeNovoFiltrationWorkflow",
"textwrap.dedent",
"pytest.fixture",
"snakemake.io.Wildcards"
] | [((431, 461), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (445, 461), False, 'import pytest\n'), ((3162, 3296), 'snappy_pipeline.workflows.variant_denovo_filtration.VariantDeNovoFiltrationWorkflow', 'VariantDeNovoFiltrationWorkflow', (['dummy_workflow', 'minimal_config', '... |
#!/pxrpythonsubst
#
# Copyright 2016 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... | [
"unittest.main"
] | [((1977, 1992), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1990, 1992), False, 'import unittest\n')] |
import os
from dotenv import load_dotenv
import asyncio
from time import sleep
load_dotenv()
DICORD_BOT_NAME = os.getenv('DICORD_BOT_NAME')
async def wait_for_msg(testing_bot, channel, content):
sleep(0.6)
try:
return await testing_bot.wait_for('message', timeout=2, check=lambda x: x.guild.id == chann... | [
"dotenv.load_dotenv",
"os.getenv",
"time.sleep"
] | [((80, 93), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (91, 93), False, 'from dotenv import load_dotenv\n'), ((112, 140), 'os.getenv', 'os.getenv', (['"""DICORD_BOT_NAME"""'], {}), "('DICORD_BOT_NAME')\n", (121, 140), False, 'import os\n'), ((201, 211), 'time.sleep', 'sleep', (['(0.6)'], {}), '(0.6)\n', (20... |
from src.python.preprocess2 import *
from src.python.geneontology import *
from src.python.baselines import *
from src.python.digo_utils import *
from tqdm import tqdm
import itertools
def get_metric(metric):
cache = dict()
def do_metric(seq1, seq2):
key1 = (seq1.uid, seq2.uid)
key2 = (s... | [
"pymongo.MongoClient",
"itertools.combinations"
] | [((7376, 7417), 'pymongo.MongoClient', 'MongoClient', (['"""mongodb://localhost:27017/"""'], {}), "('mongodb://localhost:27017/')\n", (7387, 7417), False, 'from pymongo import MongoClient\n'), ((2121, 2157), 'itertools.combinations', 'itertools.combinations', (['sample_in', '(2)'], {}), '(sample_in, 2)\n', (2143, 2157)... |
import numpy as np
#add 1 to each array element
np.add(arr, 1)
#subtract 2 from each array element
np.subtract(arr, 2)
#multiply each array element by 3
np.multiply(arr, 3)
#divide each array element by 4 (returns np.nan for division by zero)
np.divide(arr, 4)
#raise each array element to 5th power
np.power(arr, 5)
| [
"numpy.divide",
"numpy.multiply",
"numpy.subtract",
"numpy.power",
"numpy.add"
] | [((49, 63), 'numpy.add', 'np.add', (['arr', '(1)'], {}), '(arr, 1)\n', (55, 63), True, 'import numpy as np\n'), ((100, 119), 'numpy.subtract', 'np.subtract', (['arr', '(2)'], {}), '(arr, 2)\n', (111, 119), True, 'import numpy as np\n'), ((154, 173), 'numpy.multiply', 'np.multiply', (['arr', '(3)'], {}), '(arr, 3)\n', (... |
from django.db import models
from ..models import SafeDeleteModel
from .testcase import SafeDeleteTestCase
class InvisibleModel(SafeDeleteModel):
# SafeDeleteModel subclasses automatically have their visibility set to invisible.
name = models.CharField(
max_length=100
)
class VisibilityTestCas... | [
"django.db.models.CharField"
] | [((248, 280), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (264, 280), False, 'from django.db import models\n')] |
# -*- coding: utf-8 -*-
"""Main module"""
import click
def start():
click.echo('Starting')
def stop():
click.echo('Stopping')
| [
"click.echo"
] | [((75, 97), 'click.echo', 'click.echo', (['"""Starting"""'], {}), "('Starting')\n", (85, 97), False, 'import click\n'), ((116, 138), 'click.echo', 'click.echo', (['"""Stopping"""'], {}), "('Stopping')\n", (126, 138), False, 'import click\n')] |
# -*- coding: utf-8 -*-
import math
import random
import re
from chaoslib.exceptions import ActivityFailed
from chaoslib.types import Secrets
from kubernetes import client
from logzero import logger
from chaosk8s import create_k8s_api_client
__all__ = ["terminate_pods"]
def terminate_pods(label_selector: str = Non... | [
"kubernetes.client.V1DeleteOptions",
"chaosk8s.create_k8s_api_client",
"random.sample",
"kubernetes.client.CoreV1Api",
"re.compile"
] | [((1786, 1816), 'chaosk8s.create_k8s_api_client', 'create_k8s_api_client', (['secrets'], {}), '(secrets)\n', (1807, 1816), False, 'from chaosk8s import create_k8s_api_client\n'), ((1827, 1848), 'kubernetes.client.CoreV1Api', 'client.CoreV1Api', (['api'], {}), '(api)\n', (1843, 1848), False, 'from kubernetes import clie... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.
"""Abstract based class for cclib methods."""
import logging
import sys
class Method(object):
"""Abst... | [
"logging.Formatter",
"logging.StreamHandler",
"logging.getLogger",
"doctest.testmod"
] | [((1837, 1867), 'doctest.testmod', 'doctest.testmod', ([], {'verbose': '(False)'}), '(verbose=False)\n', (1852, 1867), False, 'import doctest\n'), ((1456, 1510), 'logging.getLogger', 'logging.getLogger', (["('%s %s' % (self.logname, self.data))"], {}), "('%s %s' % (self.logname, self.data))\n", (1473, 1510), False, 'im... |
# lint as: python3
# Copyright 2021 The Ivy Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | [
"pathlib.Path",
"setuptools.find_packages"
] | [((3067, 3081), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (3071, 3081), False, 'from pathlib import Path\n'), ((3893, 3919), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (3917, 3919), False, 'import setuptools\n')] |
"""
Shanghai Metro database definitions
"""
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy import Column, Integer, Text, Float
ShmDbModel = declarative_base()
# Section for lines
class Line(ShmDbModel):
"""Shangh... | [
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.ForeignKey",
"sqlalchemy.orm.relationship",
"sqlalchemy.Column"
] | [((242, 260), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (258, 260), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((380, 413), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (386, 413), False, 'f... |
import numpy as np
import pandas as pd
import itertools
from sklearn.metrics import roc_auc_score, roc_curve, auc
def augment_agg(X):
mean = np.array(X.mean(axis = 1)).reshape(X.shape[0],1)
std = np.array(X.std(axis = 1)).reshape(X.shape[0],1)
rang = np.array((X.max(axis = 1) - X.min(axis = 1))).reshape(X.... | [
"sklearn.metrics.roc_curve",
"numpy.isinf",
"numpy.append",
"sklearn.metrics.auc",
"pandas.Series",
"itertools.groupby"
] | [((341, 362), 'numpy.append', 'np.append', (['X', 'mean', '(1)'], {}), '(X, mean, 1)\n', (350, 362), True, 'import numpy as np\n'), ((369, 389), 'numpy.append', 'np.append', (['X', 'std', '(1)'], {}), '(X, std, 1)\n', (378, 389), True, 'import numpy as np\n'), ((396, 417), 'numpy.append', 'np.append', (['X', 'rang', '(... |
### Language models and functions
## <NAME>
## Created: March 2020
import pandas as pd
import numpy as np
import math
from scipy.special import comb
## Zipf pmf and cdf
def zipf(k,a):
power_law = np.divide(1,np.power(k,a))
H = np.sum(np.divide(1,np.power(k,a)))
pmf = np.divide(power_law,H)
cdf = [np.sum(pmf[0:i])... | [
"pandas.DataFrame",
"numpy.divide",
"numpy.matrix",
"numpy.multiply",
"numpy.random.seed",
"numpy.sum",
"numpy.std",
"numpy.power",
"scipy.special.comb",
"numpy.mean",
"numpy.sin",
"numpy.exp",
"numpy.cos",
"numpy.random.choice",
"numpy.unique",
"numpy.sqrt"
] | [((273, 296), 'numpy.divide', 'np.divide', (['power_law', 'H'], {}), '(power_law, H)\n', (282, 296), True, 'import numpy as np\n'), ((1608, 1632), 'numpy.random.seed', 'np.random.seed', (['set_seed'], {}), '(set_seed)\n', (1622, 1632), True, 'import numpy as np\n'), ((2192, 2220), 'numpy.multiply', 'np.multiply', (['pm... |
# -*- coding: UTF-8 -*-
import os
import time
import simplejson as json
from django.conf import settings
from django.contrib.auth.decorators import permission_required
from django.http import HttpResponse
from common.config import SysConfig
from common.utils.extend_json_encoder import ExtendJSONEncoder
from sql.engin... | [
"django.contrib.auth.decorators.permission_required",
"simplejson.dumps",
"time.time",
"sql.plugins.schemasync.SchemaSync",
"common.config.SysConfig",
"sql.engines.get_engine",
"os.path.join",
"time.localtime"
] | [((448, 510), 'django.contrib.auth.decorators.permission_required', 'permission_required', (['"""sql.menu_instance"""'], {'raise_exception': '(True)'}), "('sql.menu_instance', raise_exception=True)\n", (467, 510), False, 'from django.contrib.auth.decorators import permission_required\n'), ((1835, 1897), 'django.contrib... |
from eve.auth import TokenAuth
from werkzeug.security import check_password_hash
import random
import string
from personal_finances.run import app
class RolesAuth(TokenAuth):
def check_auth(self, token, allowed_roles, resource, method):
# use Eve's own db driver; no additional connections/resources are u... | [
"random.choice"
] | [((819, 856), 'random.choice', 'random.choice', (['string.ascii_uppercase'], {}), '(string.ascii_uppercase)\n', (832, 856), False, 'import random\n')] |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise Runtime... | [
"_snowboydetect.SnowboyDetect_SetSensitivity",
"_snowboydetect.SnowboyDetect_UpdateModel",
"_snowboydetect.SnowboyDetect_NumHotwords",
"_snowboydetect.SnowboyVad_RunVad",
"_snowboydetect.SnowboyVad_ApplyFrontend",
"_snowboydetect.SnowboyDetect_NumChannels",
"_snowboydetect.SnowboyVad_SampleRate",
"_sn... | [((3770, 3826), '_snowboydetect.SnowboyDetect_swigregister', '_snowboydetect.SnowboyDetect_swigregister', (['SnowboyDetect'], {}), '(SnowboyDetect)\n', (3811, 3826), False, 'import _snowboydetect\n'), ((4888, 4938), '_snowboydetect.SnowboyVad_swigregister', '_snowboydetect.SnowboyVad_swigregister', (['SnowboyVad'], {})... |
import os
def get_hook_script_dir():
return os.path.join(os.path.dirname(__file__), 'hook_scripts')
def get_hook_names():
return os.listdir(get_hook_script_dir())
| [
"os.path.dirname"
] | [((63, 88), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (78, 88), False, 'import os\n')] |
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torch import optim
import matplotlib.pyplot as plt
import random
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
print(device)
# Build dataset
class Diagnos... | [
"numpy.pad",
"torch.nn.Dropout",
"torch.utils.data.DataLoader",
"torch.nn.Embedding",
"torch.load",
"torch.nn.CrossEntropyLoss",
"torch.nn.functional.softmax",
"numpy.mean",
"torch.cuda.is_available",
"torch.max",
"numpy.array",
"torch.nn.Linear",
"torch.nn.LSTM",
"torch.no_grad"
] | [((2338, 2411), 'numpy.pad', 'np.pad', (['x_array', '(0, len2pad)'], {'mode': '"""constant"""', 'constant_values': 'pad_value'}), "(x_array, (0, len2pad), mode='constant', constant_values=pad_value)\n", (2344, 2411), True, 'import numpy as np\n'), ((2680, 2737), 'torch.utils.data.DataLoader', 'DataLoader', (['trainset'... |
import logging
_console_handler = logging.StreamHandler()
_console_handler.setLevel(logging.DEBUG)
_formatter = logging.Formatter('[%(asctime)s] [%(levelname)s] %(message)s')
_console_handler.setFormatter(_formatter)
log = logging.getLogger('electrum-merchant')
log.setLevel(logging.DEBUG)
log.addHandler(_console_hand... | [
"logging.Formatter",
"logging.StreamHandler",
"logging.getLogger"
] | [((35, 58), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (56, 58), False, 'import logging\n'), ((113, 175), 'logging.Formatter', 'logging.Formatter', (['"""[%(asctime)s] [%(levelname)s] %(message)s"""'], {}), "('[%(asctime)s] [%(levelname)s] %(message)s')\n", (130, 175), False, 'import logging\n'... |
#!/usr/bin/env python
"""
Setup a movement GUI.
Move Mip based on the GUI
mip_test_continuous_drive_gui2.py -i hci0 -b D0:39:72:C4:7A:01 [-c|--carzy}
"""
#from Tkinter import *
import Tkinter
from movement_canvas import MovementCanvas
import logging
import mippy
import argparse
carzy = 0
def updateMovement():
#... | [
"logging.debug",
"argparse.ArgumentParser",
"logging.basicConfig",
"Tkinter.Tk",
"mippy.GattTool",
"mippy.add_arguments",
"movement_canvas.MovementCanvas",
"mippy.Mip"
] | [((1054, 1114), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Continuous Drive GUI."""'}), "(description='Continuous Drive GUI.')\n", (1077, 1114), False, 'import argparse\n'), ((1119, 1146), 'mippy.add_arguments', 'mippy.add_arguments', (['parser'], {}), '(parser)\n', (1138, 1146), Fal... |
if "bpy" in locals():
import imp
imp.reload(engine)
else:
import bpy
from brte import engine
class DebugEngine(bpy.types.RenderEngine, engine.RealTimeEngine):
bl_idname = 'RTE_DEBUG'
bl_label = 'RTE Debug'
| [
"imp.reload"
] | [((41, 59), 'imp.reload', 'imp.reload', (['engine'], {}), '(engine)\n', (51, 59), False, 'import imp\n')] |
# Copyright (C) 2013-2015 eNovance SAS <<EMAIL>>
# Author: <NAME> <<EMAIL>>
#
# 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 r... | [
"collections.defaultdict",
"os.remove",
"os.system"
] | [((1016, 1045), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (1039, 1045), False, 'import collections\n'), ((3003, 3075), 'os.system', 'os.system', (['("diff -ub --from-file %s > \'%s\'" % (groups_name, output_file))'], {}), '("diff -ub --from-file %s > \'%s\'" % (groups_name, outpu... |
import pytest
import tasks
def test_add_TypeError(tasks_db):
with pytest.raises(TypeError):
tasks.add(task='not a Task object')
def test_list_TypeError(tasks_db):
with pytest.raises(TypeError):
tasks.list(owner=123)
def test_get_TypeError(tasks_db):
with pytest.raises(TypeError):
... | [
"tasks.get",
"tasks.delete",
"tasks.start_tasks_db",
"tasks.add",
"tasks.list",
"tasks.Task",
"pytest.raises",
"tasks.update"
] | [((71, 95), 'pytest.raises', 'pytest.raises', (['TypeError'], {}), '(TypeError)\n', (84, 95), False, 'import pytest\n'), ((105, 140), 'tasks.add', 'tasks.add', ([], {'task': '"""not a Task object"""'}), "(task='not a Task object')\n", (114, 140), False, 'import tasks\n'), ((186, 210), 'pytest.raises', 'pytest.raises', ... |
from __future__ import absolute_import, unicode_literals
from appearance.classes import Icon
icon_key_setup = Icon(driver_name='fontawesome', symbol='key')
icon_keyserver_search = Icon(driver_name='fontawesome', symbol='search')
| [
"appearance.classes.Icon"
] | [((112, 157), 'appearance.classes.Icon', 'Icon', ([], {'driver_name': '"""fontawesome"""', 'symbol': '"""key"""'}), "(driver_name='fontawesome', symbol='key')\n", (116, 157), False, 'from appearance.classes import Icon\n'), ((182, 230), 'appearance.classes.Icon', 'Icon', ([], {'driver_name': '"""fontawesome"""', 'symbo... |
import datetime
import numbers
import numpy as np
from past.builtins import basestring
import netCDF4
def validate_calendar(calendar):
"""Validate calendar string for CF Conventions.
Parameters
----------
calendar : str
Returns
-------
out : str
same as input if the calendar is ... | [
"netCDF4.Dataset",
"numpy.abs",
"netCDF4.date2num",
"datetime.datetime",
"netCDF4.num2date",
"netCDF4.netcdftime.datetime",
"netCDF4.netcdftime.netcdftime"
] | [((3029, 3058), 'netCDF4.Dataset', 'netCDF4.Dataset', (['nc_file', '"""r"""'], {}), "(nc_file, 'r')\n", (3044, 3058), False, 'import netCDF4\n'), ((3678, 3707), 'netCDF4.Dataset', 'netCDF4.Dataset', (['nc_file', '"""r"""'], {}), "(nc_file, 'r')\n", (3693, 3707), False, 'import netCDF4\n'), ((8254, 8307), 'netCDF4.num2d... |
# coding=utf8
import nuke
import random
MAX_POINTS_COUNTS = 300000
def create_cloud_point():
file_path, max_points = select_plyfile_dialog()
if not file_path:
return
node_name = file_path.split("/")[-1]
read_data = scan_ply_data(file_path, max_points)
create_node(node_name, read_data)
d... | [
"random.shuffle",
"nuke.createNode",
"nuke.Panel"
] | [((356, 383), 'nuke.Panel', 'nuke.Panel', (['""".ply importer"""'], {}), "('.ply importer')\n", (366, 383), False, 'import nuke\n'), ((1929, 1958), 'random.shuffle', 'random.shuffle', (['shuffledItems'], {}), '(shuffledItems)\n', (1943, 1958), False, 'import random\n'), ((2102, 2136), 'nuke.createNode', 'nuke.createNod... |
from dataclasses import asdict
import flask
from expungeservice.util import DateWithFuture as date
from expungeservice.models.record import Record
from expungeservice.models.record_summary import RecordSummary
class ExpungeModelEncoder(flask.json.JSONEncoder):
def record_summary_to_json(self, record_summary):
... | [
"flask.json.JSONEncoder.default"
] | [((3071, 3110), 'flask.json.JSONEncoder.default', 'flask.json.JSONEncoder.default', (['self', 'o'], {}), '(self, o)\n', (3101, 3110), False, 'import flask\n')] |
# Copyright 2019 TheGreatGeek
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | [
"enum.auto"
] | [((683, 689), 'enum.auto', 'auto', ([], {}), '()\n', (687, 689), False, 'from enum import Enum, auto\n'), ((703, 709), 'enum.auto', 'auto', ([], {}), '()\n', (707, 709), False, 'from enum import Enum, auto\n')] |
import numpy as np
import torch
from mmdet.core.bbox.builder import BBOX_CODERS
from mmdet.core.bbox.coder.base_bbox_coder import BaseBBoxCoder
@BBOX_CODERS.register_module()
class DeltaOBBCoder(BaseBBoxCoder):
def __init__(self,
target_means=(0., 0., 0., 0., 0.),
target_stds=(0... | [
"numpy.stack",
"torch.stack",
"numpy.log",
"torch.addcmul",
"numpy.ones",
"torch.log",
"mmdet.core.bbox.builder.BBOX_CODERS.register_module"
] | [((148, 177), 'mmdet.core.bbox.builder.BBOX_CODERS.register_module', 'BBOX_CODERS.register_module', ([], {}), '()\n', (175, 177), False, 'from mmdet.core.bbox.builder import BBOX_CODERS\n'), ((2220, 2238), 'torch.log', 'torch.log', (['(gw / pw)'], {}), '(gw / pw)\n', (2229, 2238), False, 'import torch\n'), ((2248, 2266... |
from threading import Thread
n = 0
def add1(N):
# Global n and "n=0" above are the same variable
# global is needed to change n from the global scope
global n
while n < N:
n = n + 1
print('Add1: %d' % n)
class Adder(Thread):
def __init__(self, changeN, N):
Thread.__init... | [
"threading.Thread",
"threading.Thread.__init__"
] | [((557, 594), 'threading.Thread', 'Thread', ([], {'target': 'add1', 'args': '(maxCount,)'}), '(target=add1, args=(maxCount,))\n', (563, 594), False, 'from threading import Thread\n'), ((307, 328), 'threading.Thread.__init__', 'Thread.__init__', (['self'], {}), '(self)\n', (322, 328), False, 'from threading import Threa... |
import argparse
import torch
import pytorch_lightning as pl
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning.plugins import DDPPlugin
from hparams import cfg
from torch.utils.data import DataLoader, random_split
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=... | [
"pytorch_lightning.callbacks.ModelCheckpoint",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"datasets.deepTextRecog_dataset.DatasetSYNTH",
"pytorch_lightning.plugins.DDPPlugin",
"models.craft_pl.CRAFT",
"torch.cuda.device_count",
"datasets.deepTextRecog_dataset.AlignCollate",
"pytorch_l... | [((284, 346), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""TRAIN OCR-ENGINE MODULE"""'}), "(description='TRAIN OCR-ENGINE MODULE')\n", (307, 346), False, 'import argparse\n'), ((2194, 2301), 'torch.utils.data.DataLoader', 'DataLoader', (['trainDataset'], {'batch_size': 'args.batch_size... |
import turtle
t = turtle.Pen()
turtle.bgcolor('black')
colors = ['red', 'yellow', 'blue', 'green']
t.speed(0)
for x in range(100):
t.pencolor(colors[x % 4])
t.circle(x)
t.left(1)
turtle.done() | [
"turtle.Pen",
"turtle.done",
"turtle.bgcolor"
] | [((19, 31), 'turtle.Pen', 'turtle.Pen', ([], {}), '()\n', (29, 31), False, 'import turtle\n'), ((32, 55), 'turtle.bgcolor', 'turtle.bgcolor', (['"""black"""'], {}), "('black')\n", (46, 55), False, 'import turtle\n'), ((193, 206), 'turtle.done', 'turtle.done', ([], {}), '()\n', (204, 206), False, 'import turtle\n')] |
# -*- coding: utf-8 -*-
import bs4
import urllib.request
import urllib.parse
import os
import sys
import json
from typing import Tuple
def formating_URL(query: str) -> Tuple[str, str]:
"""与えられたクエリから検索用のURLを作成し,返す
Args:
query (str): クエリ
Returns:
Tuple[str, str]: 検索用URL, クエリ
"""
qu... | [
"os.mkdir",
"json.loads",
"os.path.exists",
"bs4.BeautifulSoup",
"os.listdir",
"sys.exit"
] | [((985, 1026), 'bs4.BeautifulSoup', 'bs4.BeautifulSoup', (['request', '"""html.parser"""'], {}), "(request, 'html.parser')\n", (1002, 1026), False, 'import bs4\n'), ((1232, 1251), 'os.path.exists', 'os.path.exists', (['DIR'], {}), '(DIR)\n', (1246, 1251), False, 'import os\n'), ((1261, 1274), 'os.mkdir', 'os.mkdir', ([... |
import json,random
#Unused couldnt be arsed removing, it has too much emotional value to me.
usedNames = []
with open('first-names.json', 'r', encoding = "utf-8-sig") as outfile:
data = json.load(outfile)
class Critter(object):
"""a virtual pet"""
total = 0
@staticmethod
def status(... | [
"json.load"
] | [((198, 216), 'json.load', 'json.load', (['outfile'], {}), '(outfile)\n', (207, 216), False, 'import json, random\n')] |
from dataclasses import dataclass
from typing import Callable, Any
from rxbp.mixins.flowablemixin import FlowableMixin
from rxbp.multicast.observables.flatmergenobackpressureobservable import FlatMergeNoBackpressureObservable
from rxbp.scheduler import Scheduler
from rxbp.subscriber import Subscriber
from rxbp.subscri... | [
"rxbp.multicast.observables.flatmergenobackpressureobservable.FlatMergeNoBackpressureObservable"
] | [((992, 1174), 'rxbp.multicast.observables.flatmergenobackpressureobservable.FlatMergeNoBackpressureObservable', 'FlatMergeNoBackpressureObservable', ([], {'source': 'subscription.observable', 'selector': 'observable_selector', 'scheduler': 'subscriber.scheduler', 'subscribe_scheduler': 'self.subscribe_scheduler'}), '(... |
from .Player import Player
from .TileCollection import TileCollection
from .Center import Center
from .TileColor import TileColor
from .AzulAction import AzulAction
import random
import numpy as np
import math
class AzulBoard():
def __init__(self):
self.player1 = Player(1)
self.player2 ... | [
"numpy.random.uniform",
"numpy.random.randint",
"numpy.random.choice"
] | [((1423, 1489), 'numpy.random.choice', 'np.random.choice', ([], {'a': '[True, False]', 'size': '(5, 5)', 'p': '[prob, 1 - prob]'}), '(a=[True, False], size=(5, 5), p=[prob, 1 - prob])\n', (1439, 1489), True, 'import numpy as np\n'), ((2122, 2145), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)'], {}), '(0, ... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"azure.cli.core.commands.CliCommandType"
] | [((2015, 2138), 'azure.cli.core.commands.CliCommandType', 'CliCommandType', ([], {'operations_tmpl': '"""azext_devops.dev.pipelines.build#{}"""', 'exception_handler': 'azure_devops_exception_handler'}), "(operations_tmpl='azext_devops.dev.pipelines.build#{}',\n exception_handler=azure_devops_exception_handler)\n", (... |
# This function an HTTP starter function for Durable Functions.
# Before running this sample, please:
# - create a Durable orchestration function
# - create a Durable activity function (default name is "Hello")
# - add azure-functions-durable to requirements.txt
# - run pip install -r requirements.txt
import logging
... | [
"azure.durable_functions.DurableOrchestrationClient",
"logging.info"
] | [((477, 515), 'azure.durable_functions.DurableOrchestrationClient', 'df.DurableOrchestrationClient', (['starter'], {}), '(starter)\n', (506, 515), True, 'import azure.durable_functions as df\n'), ((608, 673), 'logging.info', 'logging.info', (['f"""Started orchestration with ID = \'{instance_id}\'."""'], {}), '(f"Starte... |
# Uses a learnable embedding for the countries which is fed as input to both encoders (at the respective dense layers).
# Copyright 2020 (c) Cognizant Digital Business, Evolutionary AI. All rights reserved. Issued under the Apache 2.0 License.
import os
import urllib.request
# Suppress noisy Tensorflow debug logging... | [
"ongoing.predictors.base.convert_ratios_to_total_deaths",
"numpy.ones",
"numpy.clip",
"keras.backend.abs",
"numpy.argmin",
"keras.models.Model",
"pandas.offsets.Day",
"keras.layers.Input",
"keras.layers.Reshape",
"numpy.copy",
"pandas.Timedelta",
"numpy.stack",
"pandas.DataFrame.from_dict",
... | [((1081, 1089), 'keras.backend.abs', 'K.abs', (['w'], {}), '(w)\n', (1086, 1089), True, 'import keras.backend as K\n'), ((6557, 6589), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['forecast'], {}), '(forecast)\n', (6579, 6589), True, 'import pandas as pd\n'), ((7180, 7216), 'numpy.array', 'np.array', (['cn... |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 26 14:52:43 EDT 2017
@author: ben
Genrate ui pyuic5 -x ndust.ui -o ndustgui.py
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2017, <NAME>"
__license__ = "MIT"
__version__ = "0.1.0"
__email__ = "<EMAIL>"
__status__ = "Development"
import sys
import os
#from PyQt5... | [
"PyQt5.QtWidgets.QErrorMessage",
"ndustgui.Ui_MainWindow",
"mgrid.VDWaals",
"mgrid.QSections",
"mgrid.GridSystem",
"mplasma.Description",
"mplasma.Ions",
"mnano.Density",
"mnano.Rates",
"mnano.Nanoparticles",
"h5py.File",
"mgrid.compute_sections",
"mplasma.Metastables",
"mgrid.EInteraction... | [((935, 950), 'ndustgui.Ui_MainWindow', 'Ui_MainWindow', ([], {}), '()\n', (948, 950), False, 'from ndustgui import Ui_MainWindow\n'), ((1012, 1041), 'PyQt5.QtWidgets.QErrorMessage', 'QtWidgets.QErrorMessage', (['self'], {}), '(self)\n', (1035, 1041), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((5766, 5827... |
import os
from unittest import mock
from castero.datafile import DataFile
from castero.downloadqueue import DownloadQueue
def test_datafile_download(display):
display.change_status = mock.MagicMock(name="change_status")
mydownloadqueue = DownloadQueue()
url = "https://travis-ci.org/"
DataFile.downloa... | [
"os.remove",
"unittest.mock.MagicMock",
"castero.downloadqueue.DownloadQueue",
"os.path.exists",
"castero.datafile.DataFile.download_to_file"
] | [((190, 226), 'unittest.mock.MagicMock', 'mock.MagicMock', ([], {'name': '"""change_status"""'}), "(name='change_status')\n", (204, 226), False, 'from unittest import mock\n'), ((249, 264), 'castero.downloadqueue.DownloadQueue', 'DownloadQueue', ([], {}), '()\n', (262, 264), False, 'from castero.downloadqueue import Do... |
"""
.. todo::
WRITEME
"""
import numpy as np
def is_iterable(obj):
"""
Robustly test whether an object is iterable.
Parameters
----------
obj : object
The object to be checked.
Returns
-------
is_iterable : bool
`True` if the object is iterable, `False` otherwise... | [
"numpy.nanmin",
"numpy.min",
"numpy.max",
"numpy.nanmax"
] | [((1887, 1898), 'numpy.min', 'np.min', (['arr'], {}), '(arr)\n', (1893, 1898), True, 'import numpy as np\n'), ((2575, 2589), 'numpy.nanmax', 'np.nanmax', (['arr'], {}), '(arr)\n', (2584, 2589), True, 'import numpy as np\n'), ((2603, 2617), 'numpy.nanmin', 'np.nanmin', (['arr'], {}), '(arr)\n', (2612, 2617), True, 'impo... |
import os
import pytest
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']
).get_hosts('all')
solr_base_dir = "/opt/solr/alfresco-search-services"
solr_rerank_conf_dir = f"{solr_base_dir}/data/solrhome/templates/rerank/conf"... | [
"pytest.mark.parametrize"
] | [((513, 553), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""svc"""', "['solr']"], {}), "('svc', ['solr'])\n", (536, 553), False, 'import pytest\n'), ((700, 743), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""port"""', '[8983, 22]'], {}), "('port', [8983, 22])\n", (723, 743), False, 'import p... |
from collections import defaultdict
import random
from protocolbuffers import GameplaySaveData_pb2
from autonomy.autonomy_preference import ObjectPreferenceTag, AutonomyPreferenceType
from distributor.rollback import ProtocolBufferRollback
from event_testing.resolver import SingleSimResolver
from event_testing.tests im... | [
"services.get_roommate_service",
"distributor.rollback.ProtocolBufferRollback",
"services.current_zone_id",
"protocolbuffers.GameplaySaveData_pb2.ObjectPreferenceTracker",
"collections.defaultdict",
"event_testing.resolver.SingleSimResolver",
"sims4.tuning.tunable.TunableEnumEntry",
"services.get_pers... | [((580, 641), 'sims4.log.Logger', 'sims4.log.Logger', (['"""ObjectPreference"""'], {'default_owner': '"""nabaker"""'}), "('ObjectPreference', default_owner='nabaker')\n", (596, 641), False, 'import sims4\n'), ((3741, 4055), 'sims4.tuning.tunable.TunableEnumSet', 'TunableEnumSet', ([], {'description': '"""\n The ... |