code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
""" Simple Example using coreali to access a register model. Needs no h^ardware"""
# Import dependencies and compile register model with systemrdl-compiler
from systemrdl import RDLCompiler
import coreali
import numpy as np
import os
from coreali import RegisterModel
rdlc = RDLCompiler()
rdlc.compile_file(os.path.di... | [
"os.path.dirname",
"systemrdl.RDLCompiler",
"coreali.RegisterModel",
"numpy.uint8"
] | [((278, 291), 'systemrdl.RDLCompiler', 'RDLCompiler', ([], {}), '()\n', (289, 291), False, 'from systemrdl import RDLCompiler\n'), ((502, 526), 'coreali.RegisterModel', 'RegisterModel', (['root', 'rio'], {}), '(root, rio)\n', (515, 526), False, 'from coreali import RegisterModel\n'), ((310, 335), 'os.path.dirname', 'os... |
import json
import requests
from enum import Enum
from typing import Dict
from ..exceptions import JsonDecodeError, UnexpectedResponse, RequestError, BaseApiRequestError
class MockRequesterMixin:
"""
Набор методов для моков реквестеров
"""
class ERRORS(Enum):
ERROR_TOKEN = 'error'
BAD_... | [
"json.loads",
"requests.Response"
] | [((1339, 1356), 'json.loads', 'json.loads', (['token'], {}), '(token)\n', (1349, 1356), False, 'import json\n'), ((2929, 2948), 'requests.Response', 'requests.Response', ([], {}), '()\n', (2946, 2948), False, 'import requests\n'), ((3997, 4016), 'requests.Response', 'requests.Response', ([], {}), '()\n', (4014, 4016), ... |
from filelock import FileLock, Timeout
import os
import time
class ProcessFileLock(FileLock):
"""
FileLock that is unique per path in each process (for, eg., reentrance)
"""
locks = {}
def __new__(cls, path, *args, **kwargs):
if path in ProcessFileLock.locks:
return P... | [
"os.path.join",
"time.sleep",
"sample_hyperparameters.TrainableSampleGenerator",
"os.path.isfile",
"filelock.Timeout",
"time.time",
"os.remove"
] | [((3654, 3665), 'time.time', 'time.time', ([], {}), '()\n', (3663, 3665), False, 'import time\n'), ((3681, 3706), 'os.path.isfile', 'os.path.isfile', (['self.path'], {}), '(self.path)\n', (3695, 3706), False, 'import os\n'), ((1113, 1148), 'os.path.join', 'os.path.join', (['dir', '"""histories.lock"""'], {}), "(dir, 'h... |
# Django REST Framework
from rest_framework import serializers
# Model
from todo.management.models import Task
# Utils
from todo.utils.tasks import TaskMetrics
from todo.utils.serializer_fields import CompleteNameUser
class TaskModelSerializer(serializers.ModelSerializer):
"""Modelo serializer del circulo"""
... | [
"todo.management.models.Task.objects.create",
"todo.utils.serializer_fields.CompleteNameUser",
"todo.utils.tasks.TaskMetrics"
] | [((330, 358), 'todo.utils.serializer_fields.CompleteNameUser', 'CompleteNameUser', ([], {'many': '(False)'}), '(many=False)\n', (346, 358), False, 'from todo.utils.serializer_fields import CompleteNameUser\n'), ((936, 974), 'todo.management.models.Task.objects.create', 'Task.objects.create', ([], {'user': 'user'}), '(u... |
#Negative Indexes
spam = ['cat', 'bat', 'rat', 'elephant']
spam[-1] # elepant
spam[-3] # bat
# Getting a List from another List with Slices
spam = ['cat', 'bat', 'rat', 'elephant']
spam[0:4] # ['cat', 'bat', 'rat', 'elephant']
spam[1:3] # ['bat', 'rat']
spam[0:-1] # ['cat', 'bat', 'rat']
spam[:2] # ['cat', 'bat']
spa... | [
"random.choice",
"random.shuffle"
] | [((2482, 2501), 'random.choice', 'random.choice', (['pets'], {}), '(pets)\n', (2495, 2501), False, 'import random\n'), ((2502, 2521), 'random.choice', 'random.choice', (['pets'], {}), '(pets)\n', (2515, 2521), False, 'import random\n'), ((2522, 2541), 'random.choice', 'random.choice', (['pets'], {}), '(pets)\n', (2535,... |
import pandas as pd
path = "Resources/cities.csv"
data = pd.read_csv(path)
data_html = data.to_html("data.html", bold_rows = True) | [
"pandas.read_csv"
] | [((57, 74), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (68, 74), True, 'import pandas as pd\n')] |
# Copyright (C) 2020 Red Hat Inc.
#
# Authors:
# <NAME> <<EMAIL>>
#
# This work is licensed under the terms of the GNU GPL, version 2. See
# the COPYING file in the top-level directory.
from tempfile import NamedTemporaryFile
from .patching import FileInfo, FileMatch, Patch, FileList
from .regexps import *
class Bas... | [
"tempfile.NamedTemporaryFile"
] | [((613, 637), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', (['"""wt"""'], {}), "('wt')\n", (631, 637), False, 'from tempfile import NamedTemporaryFile\n'), ((1643, 1667), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', (['"""wt"""'], {}), "('wt')\n", (1661, 1667), False, 'from tempfile import NamedTemporar... |
import sys
def readInput():
labels, features, all_features, labelCount = [], [], [], {}
l = sys.stdin.readline().strip().split(' ')
while len(l)> 1:
label = l[0]
if label not in labelCount:
labelCount[label] = 0
labelCount[label] += 1
labels.append(label)
... | [
"sys.stdin.readline"
] | [((100, 120), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (118, 120), False, 'import sys\n'), ((525, 545), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (543, 545), False, 'import sys\n')] |
# Importamos la librería para leer archivos json
import json
# Abrimos el archivo master en modo lectura ('r') con todos los id de los archivos descargados
with open('master.json', 'r') as f:
# Guardamos en la variable lista el contenido de master
lista = json.load(f)
# En este ejemplo se representa cómo se a... | [
"json.load"
] | [((265, 277), 'json.load', 'json.load', (['f'], {}), '(f)\n', (274, 277), False, 'import json\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file contains the generators and their inverses for common archimedean copulas.
"""
import numpy as np
def boundsConditions(x):
if x < 0 or x > 1:
raise ValueError("Unable to compute generator for x equals to {}".format(x))
def claytonGenerator(... | [
"numpy.exp",
"numpy.log",
"numpy.divide"
] | [((2585, 2622), 'numpy.log', 'np.log', (['((1.0 - theta * (1.0 - x)) / x)'], {}), '((1.0 - theta * (1.0 - x)) / x)\n', (2591, 2622), True, 'import numpy as np\n'), ((2141, 2173), 'numpy.log', 'np.log', (['(1.0 - (1.0 - x) ** theta)'], {}), '(1.0 - (1.0 - x) ** theta)\n', (2147, 2173), True, 'import numpy as np\n'), ((1... |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2021-03-02 13:32
from typing import Optional, Union, Dict, Any
import torch
from torch import nn
from transformers import PreTrainedTokenizer
from elit.components.mtl.attn.attn import TaskAttention
from elit.components.mtl.attn.transformer import JointEncoder
from elit.... | [
"elit.layers.transformers.utils.pick_tensor_for_each_token"
] | [((2256, 2333), 'elit.layers.transformers.utils.pick_tensor_for_each_token', 'pick_tensor_for_each_token', (['encoder_output', 'token_span', 'self.average_subwords'], {}), '(encoder_output, token_span, self.average_subwords)\n', (2282, 2333), False, 'from elit.layers.transformers.utils import pick_tensor_for_each_token... |
"""Implementations of algorithms for continuous control."""
import functools
from typing import Optional, Sequence, Tuple
import jax
import jax.numpy as jnp
import numpy as np
import optax
from jaxrl.agents.sac import temperature
from jaxrl.agents.sac.actor import update as update_actor
from jaxrl.agents.sac.critic ... | [
"jaxrl.networks.critic_net.ValueCritic",
"numpy.clip",
"optax.adam",
"jax.random.PRNGKey",
"jaxrl.agents.sac.temperature.update",
"jaxrl.networks.policies.sample_actions",
"jaxrl.networks.common.Model.create",
"jaxrl.agents.sac_v1.critic.update_q",
"numpy.asarray",
"jaxrl.agents.sac.actor.update",... | [((542, 601), 'functools.partial', 'functools.partial', (['jax.jit'], {'static_argnames': '"""update_target"""'}), "(jax.jit, static_argnames='update_target')\n", (559, 601), False, 'import functools\n'), ((907, 954), 'jaxrl.agents.sac_v1.critic.update_q', 'update_q', (['critic', 'target_value', 'batch', 'discount'], {... |
"""Example revision
Revision ID: fdf0cf6487a3
Revises:
Create Date: 2021-08-09 17:55:19.491713
"""
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... | [
"alembic.op.drop_table",
"sqlalchemy.Integer"
] | [((586, 615), 'alembic.op.drop_table', 'op.drop_table', (['"""measurements"""'], {}), "('measurements')\n", (599, 615), False, 'from alembic import op\n'), ((425, 437), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (435, 437), True, 'import sqlalchemy as sa\n')] |
# -*- Python -*-
import os
# Setup config name.
config.name = 'MemorySanitizer' + getattr(config, 'name_suffix', 'default')
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
# Setup default compiler flags used with -fsanitize=memory option.
clang_msan_cflags = (["-fsanitize=memory",
... | [
"os.path.dirname"
] | [((174, 199), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (189, 199), False, 'import os\n')] |
#
# nuna_sql_tools: Copyright 2022 Nuna Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | [
"dataclasses.is_dataclass",
"dataclasses.fields",
"typing.NewType"
] | [((2196, 2240), 'typing.NewType', 'NewType', (['f"""Annotated_{_CLASS_ID}"""', 'supertype'], {}), "(f'Annotated_{_CLASS_ID}', supertype)\n", (2203, 2240), False, 'from typing import NewType, Union\n'), ((8773, 8801), 'dataclasses.fields', 'dataclasses.fields', (['self.cls'], {}), '(self.cls)\n', (8791, 8801), False, 'i... |
#!/usr/bin/python
# Classification (U)
"""Program: slaverep_isslverror.py
Description: Unit testing of SlaveRep.is_slv_error in mysql_class.py.
Usage:
test/unit/mysql_class/slaverep_isslverror.py
Arguments:
"""
# Libraries and Global Variables
# Standard
import sys
import os
if sys.version... | [
"unittest.main",
"mysql_class.SlaveRep",
"os.getcwd"
] | [((435, 446), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (444, 446), False, 'import os\n'), ((3651, 3666), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3664, 3666), False, 'import unittest\n'), ((1649, 1779), 'mysql_class.SlaveRep', 'mysql_class.SlaveRep', (['self.name', 'self.server_id', 'self.sql_user', 'sel... |
"""
108. 将有序数组转换为二叉搜索树
"""
from TreeNode import TreeNode
class Solution:
def sortedArrayToBST(self, nums: [int]) -> TreeNode:
def dfs(left, right):
if left > right:
return None
mid = left + (right - left) // 2
root = TreeNode(nums[mid])
roo... | [
"TreeNode.TreeNode"
] | [((285, 304), 'TreeNode.TreeNode', 'TreeNode', (['nums[mid]'], {}), '(nums[mid])\n', (293, 304), False, 'from TreeNode import TreeNode\n')] |
import sys
from os.path import dirname, abspath, join
cur_folder = dirname(abspath(__file__))
sys.path.insert(0, join(dirname(cur_folder), 'src'))
sys.path.insert(0, dirname(cur_folder))
print(cur_folder) | [
"os.path.abspath",
"os.path.dirname"
] | [((76, 93), 'os.path.abspath', 'abspath', (['__file__'], {}), '(__file__)\n', (83, 93), False, 'from os.path import dirname, abspath, join\n'), ((167, 186), 'os.path.dirname', 'dirname', (['cur_folder'], {}), '(cur_folder)\n', (174, 186), False, 'from os.path import dirname, abspath, join\n'), ((119, 138), 'os.path.dir... |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [
"os.path.dirname",
"Products.Five.browser.pagetemplatefile.ViewPageTemplateFile"
] | [((1320, 1350), 'Products.Five.browser.pagetemplatefile.ViewPageTemplateFile', 'ViewPageTemplateFile', (['template'], {}), '(template)\n', (1340, 1350), False, 'from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile\n'), ((1768, 1793), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file_... |
#!/usr/bin/env python3
"""Unpack a MIME message into a directory of files."""
import os
import email
import mimetypes
from email.policy import default
from argparse import ArgumentParser
def main():
parser = ArgumentParser(description="""\
Unpack a MIME message into a directory of files.
""")
parser.add_a... | [
"email.message_from_binary_file",
"os.path.join",
"os.mkdir",
"argparse.ArgumentParser"
] | [((218, 303), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Unpack a MIME message into a directory of files.\n"""'}), "(description='Unpack a MIME message into a directory of files.\\n'\n )\n", (232, 303), False, 'from argparse import ArgumentParser\n'), ((671, 721), 'email.message_from_binar... |
import sys, os
import logging
import datetime
module_name = 'Streetview_Module'
debug_mode = True
class LoggingWrapper(object):
def __init__(self, log_folder_path=None):
self.debug_mode = debug_mode
# Create logger with module name
logger = logging.getLogger(module_name)
logger.s... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.Formatter",
"os.path.join",
"datetime.datetime.now",
"logging.FileHandler"
] | [((273, 303), 'logging.getLogger', 'logging.getLogger', (['module_name'], {}), '(module_name)\n', (290, 303), False, 'import logging\n'), ((419, 442), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (440, 442), False, 'import datetime\n'), ((1020, 1043), 'logging.StreamHandler', 'logging.StreamHandl... |
# asandbox.py
#
# Authors:
# - <NAME> <<EMAIL>>
"""An asynchronous implementation of the Sandbox API."""
import io
import json
import os
from contextlib import AbstractAsyncContextManager
from typing import BinaryIO, Optional, Union
import aiohttp
from .exceptions import status_exceptions
from .utils import ENDP... | [
"aiohttp.ClientTimeout",
"json.dumps",
"aiohttp.FormData"
] | [((4665, 4683), 'aiohttp.FormData', 'aiohttp.FormData', ([], {}), '()\n', (4681, 4683), False, 'import aiohttp\n'), ((5388, 5406), 'aiohttp.FormData', 'aiohttp.FormData', ([], {}), '()\n', (5404, 5406), False, 'import aiohttp\n'), ((6024, 6042), 'aiohttp.FormData', 'aiohttp.FormData', ([], {}), '()\n', (6040, 6042), Fa... |
import datetime
from uuid import UUID
from api.actions import storage
from fastapi import HTTPException
from api.models.usuario import Usuario
from starlette.requests import Request
from api.dependencies import validar_email, validar_formato_fecha,validar_edad
FORMATO_FECHA = "%Y-%m-%d"
EDAD_MINIMA = 18
EDAD_MAXIMA = ... | [
"fastapi.HTTPException",
"datetime.datetime.strptime",
"api.actions.storage.get_all",
"api.actions.storage.update",
"api.actions.storage.add",
"api.actions.storage.delete",
"api.actions.storage.get_by_id",
"api.dependencies.validar_edad",
"api.dependencies.validar_formato_fecha"
] | [((1409, 1468), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['fecha_nacimiento', 'FORMATO_FECHA'], {}), '(fecha_nacimiento, FORMATO_FECHA)\n', (1435, 1468), False, 'import datetime\n'), ((1735, 1764), 'api.actions.storage.add', 'storage.add', (['usuario', 'request'], {}), '(usuario, request)\n', (1746,... |
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from recipe_engine import post_process
from PB.recipes.infra.windows_image_builder import windows_image_builder as wib
from PB.recipes.infra.windows_image_b... | [
"RECIPE_MODULES.infra.windows_scripts_executor.test_helper.ADD_FILE",
"RECIPE_MODULES.infra.windows_scripts_executor.test_helper.WPE_IMAGE",
"RECIPE_MODULES.infra.windows_scripts_executor.test_helper.GIT_PIN_FILE",
"RECIPE_MODULES.infra.windows_scripts_executor.test_helper.MOCK_WPE_INIT_DEINIT_SUCCESS",
"PB... | [((3084, 3134), 'RECIPE_MODULES.infra.windows_scripts_executor.test_helper.ADD_FILE', 't.ADD_FILE', (['api', 'wpe_image', 'wpe_cust', 'STARTNET_URL'], {}), '(api, wpe_image, wpe_cust, STARTNET_URL)\n', (3094, 3134), True, 'from RECIPE_MODULES.infra.windows_scripts_executor import test_helper as t\n'), ((2084, 2174), 'P... |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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... | [
"mcfw.restapi.register_postcall_hook",
"rogerthat.utils.transactions.on_trans_committed",
"mcfw.rpc.get_type_details",
"rogerthat.rpc.users.get_current_user",
"google.appengine.api.users.get_current_user"
] | [((1919, 1966), 'mcfw.restapi.register_postcall_hook', 'register_postcall_hook', (['log_restapi_call_result'], {}), '(log_restapi_call_result)\n', (1941, 1966), False, 'from mcfw.restapi import register_postcall_hook, INJECTED_FUNCTIONS\n'), ((2135, 2173), 'rogerthat.utils.transactions.on_trans_committed', 'on_trans_co... |
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2021 <EMAIL>
"""
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from apps.user import views as user_views
from.views import... | [
"django.contrib.auth.views.PasswordResetDoneView.as_view",
"django.contrib.auth.views.PasswordResetCompleteView.as_view",
"apps.user.views.EditProfilePage.as_view",
"django.contrib.auth.views.LogoutView.as_view",
"django.contrib.auth.views.PasswordResetConfirmView.as_view",
"django.contrib.auth.views.Logi... | [((369, 400), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (373, 400), False, 'from django.urls import path, include\n'), ((406, 461), 'django.urls.path', 'path', (['"""register/"""', 'user_views.register'], {'name': '"""register"""'}), "('register/', user_view... |
#! /usr/bin/env python
import cv2
import matplotlib.pyplot as plt
import skimage
import skimage.io
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.pyplot import cm
from mpl_toolkits.axes_grid1 import make_axes_locatable
from numpy import ... | [
"numpy.sqrt",
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.close",
"numpy.linspace",
"numpy.dot",
"mpl_toolkits.axes_grid1.make_axes_locatable",
"numpy.dtype",
"numpy.tile",
"numpy.ceil",
"cv2.putText",
"skimage.io.imread",
"cv2.cvtColor",
"matplotlib.pyplot.title",
"cv2.getTextSize... | [((1017, 1036), 'numpy.array', 'array', (['arr', '"""uint8"""'], {}), "(arr, 'uint8')\n", (1022, 1036), False, 'from numpy import arange, array, newaxis, tile, linspace, pad, expand_dims, fromstring, ceil, dtype, float32, sqrt, dot, zeros\n'), ((1633, 1655), 'matplotlib.figure.Figure', 'Figure', ([], {'figsize': '(5, 5... |
import pygame.font
import copy
class Text:
"""Draws a text to the screen."""
def __init__(self, rect, size, color, screen, text):
self.screen = screen
self.rect = copy.deepcopy(rect)
self.text = text
self.color = color
self.font = pygame.font.SysFont(None, size)
... | [
"copy.deepcopy"
] | [((190, 209), 'copy.deepcopy', 'copy.deepcopy', (['rect'], {}), '(rect)\n', (203, 209), False, 'import copy\n')] |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | [
"pytest.mark.xfail_safari",
"selenium.webdriver.support.wait.WebDriverWait"
] | [((3004, 3110), 'pytest.mark.xfail_safari', 'pytest.mark.xfail_safari', ([], {'raises': 'WebDriverException', 'reason': '"""Get Window Rect command not implemented"""'}), "(raises=WebDriverException, reason=\n 'Get Window Rect command not implemented')\n", (3028, 3110), False, 'import pytest\n'), ((3360, 3466), 'pyt... |
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__version__= '2.2'
__status__ = "Research"
__date__ = "28/1/2018"
__license__= "MIT License"
import os
import numpy as np
import glob
import subprocess
import platform
import sys
import pkg_resources
import torch
import PIL as Image
try:
import cv2
except:
print("W... | [
"os.listdir",
"platform.platform",
"os.path.splitext",
"os.path.join",
"os.path.split",
"os.path.isfile",
"os.path.isdir",
"pkg_resources.get_distribution",
"glob.glob",
"torch.backends.cudnn.version"
] | [((478, 497), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (491, 497), False, 'import os\n'), ((1235, 1286), 'os.path.join', 'os.path.join', (['dataset_path', 'splits_path', 'split_name'], {}), '(dataset_path, splits_path, split_name)\n', (1247, 1286), False, 'import os\n'), ((1299, 1314), 'glob.glob',... |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: aghast_generated
import flatbuffers
class Slice(object):
__slots__ = ["_tab"]
# Slice
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# Slice
def Start(self):
return self._... | [
"flatbuffers.table.Table",
"flatbuffers.number_types.UOffsetTFlags.py_type"
] | [((231, 264), 'flatbuffers.table.Table', 'flatbuffers.table.Table', (['buf', 'pos'], {}), '(buf, pos)\n', (254, 264), False, 'import flatbuffers\n'), ((406, 455), 'flatbuffers.number_types.UOffsetTFlags.py_type', 'flatbuffers.number_types.UOffsetTFlags.py_type', (['(0)'], {}), '(0)\n', (452, 455), False, 'import flatbu... |
import concurrent
import os
import re
import shutil
import xml.etree.ElementTree as ET # TODO do we have this as requirement?
from concurrent.futures import as_completed
from concurrent.futures._base import as_completed
from pathlib import Path
import ffmpeg
import pandas as pd
import webrtcvad
from audio_korpora_pi... | [
"re.compile",
"audio_korpora_pipeline.metamodel.mediasession.WrittenResource",
"re.search",
"audio_korpora_pipeline.inputadapter.audiosplit.splitter.Splitter",
"os.listdir",
"xml.etree.ElementTree.parse",
"pathlib.Path",
"audio_korpora_pipeline.metamodel.mediasession.Sex.toSexEnum",
"shutil.move",
... | [((1766, 1776), 'audio_korpora_pipeline.inputadapter.audiosplit.splitter.Splitter', 'Splitter', ([], {}), '()\n', (1774, 1776), False, 'from audio_korpora_pipeline.inputadapter.audiosplit.splitter import Splitter\n'), ((4142, 4206), 'audio_korpora_pipeline.metamodel.mediasession.MediaSession', 'MediaSession', (['self.A... |
import decimal
from unittest import mock
from django.conf import settings
from django.test import modify_settings
from rest_framework import test
from rest_framework.reverse import reverse
import stripe
from restshop import serializers
from restshop.models import Order
from paymentmethods.stripejs.models import Strip... | [
"restshop.models.Order.objects.get",
"stripe.Token.create",
"decimal.Decimal",
"restshop.tests.test_product.products_and_price",
"django.test.modify_settings",
"stripe.CardError",
"restshop.models.Order.objects.create",
"unittest.mock.patch",
"restshop.serializers.OrderSerializer",
"rest_framework... | [((418, 496), 'django.test.modify_settings', 'modify_settings', ([], {'INSTALLED_APPS': "{'append': 'restshop.paymentmethods.stripejs'}"}), "(INSTALLED_APPS={'append': 'restshop.paymentmethods.stripejs'})\n", (433, 496), False, 'from django.test import modify_settings\n'), ((2044, 2078), 'unittest.mock.patch', 'mock.pa... |
from tnnt.settings import UNIQUE_DEATH_REJECTIONS, UNIQUE_DEATH_NORMALIZATIONS
import re
def normalize(death):
# Given a death string, apply normalizations from settings.
for regtuple in UNIQUE_DEATH_NORMALIZATIONS:
death = re.sub(regtuple[0], regtuple[1], death)
return death
def reject(death):
... | [
"re.sub",
"re.search"
] | [((241, 280), 're.sub', 're.sub', (['regtuple[0]', 'regtuple[1]', 'death'], {}), '(regtuple[0], regtuple[1], death)\n', (247, 280), False, 'import re\n'), ((478, 501), 're.search', 're.search', (['regex', 'death'], {}), '(regex, death)\n', (487, 501), False, 'import re\n')] |
# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, <NAME> and <NAME>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistribut... | [
"scipy.sparse.isspmatrix_csc",
"scipy.sparse.isspmatrix_csr",
"numpy.abs",
"qutip.cy.graph_utils._maximum_bipartite_matching",
"qutip.cy.graph_utils._breadth_first_search",
"qutip.cy.graph_utils._node_degrees",
"numpy.diff",
"qutip.cy.graph_utils._reverse_cuthill_mckee",
"numpy.any",
"numpy.argsor... | [((2836, 2882), 'qutip.cy.graph_utils._node_degrees', '_node_degrees', (['A.indices', 'A.indptr', 'A.shape[0]'], {}), '(A.indices, A.indptr, A.shape[0])\n', (2849, 2882), False, 'from qutip.cy.graph_utils import _breadth_first_search, _node_degrees, _reverse_cuthill_mckee, _maximum_bipartite_matching, _weighted_biparti... |
import pytest
from daisy.workflow import build_combinations
def test_one_option():
assert build_combinations(
{"option1": ["value1", "value2"]}) == \
[{'option1': 'value1'},
{'option1': 'value2'}]
def test_two_options():
assert build_combinations(
{'option1': ["value1", "val... | [
"daisy.workflow.build_combinations"
] | [((96, 149), 'daisy.workflow.build_combinations', 'build_combinations', (["{'option1': ['value1', 'value2']}"], {}), "({'option1': ['value1', 'value2']})\n", (114, 149), False, 'from daisy.workflow import build_combinations\n'), ((265, 339), 'daisy.workflow.build_combinations', 'build_combinations', (["{'option1': ['va... |
import time
from config import get_password, get_username
from playwright.sync_api import Page
def login(page: Page, url: str, landing_url: str):
raise RuntimeError("default login not supported")
def login_kenan_flagler(page: Page, url: str, landing_url: str) -> None:
page.goto(url)
page.wait_for_load_... | [
"config.get_username",
"config.get_password",
"time.sleep"
] | [((480, 495), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (490, 495), False, 'import time\n'), ((646, 659), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (656, 659), False, 'import time\n'), ((1291, 1306), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (1301, 1306), False, 'import time\n'), (... |
import asyncio
import json
import os
import pty
import shutil
import sys
import tty
import termios
import time
import threading
import tornado.iostream
from tornado.ioloop import IOLoop
from tornado.websocket import websocket_connect
ioloop = tornado.ioloop.IOLoop.instance()
SSH_LOGIN = "root"
SSH_PASSWORD = "<PASS... | [
"sys.stdin.fileno",
"json.loads",
"pty.spawn",
"shutil.which",
"time.sleep",
"threading.Event",
"termios.tcsetattr",
"tornado.ioloop.IOLoop.instance",
"tornado.websocket.websocket_connect",
"os.read",
"tty.setraw"
] | [((2503, 2520), 'threading.Event', 'threading.Event', ([], {}), '()\n', (2518, 2520), False, 'import threading\n'), ((2825, 2838), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (2835, 2838), False, 'import time\n'), ((2849, 2912), 'pty.spawn', 'pty.spawn', (['args'], {'master_read': 'master_read', 'stdin_read': '... |
import abc
import logging
from typing import Any, Dict, List, Optional
from homeassistant.components.water_heater import WaterHeaterEntity
from homeassistant.const import (
TEMP_FAHRENHEIT,
TEMP_CELSIUS
)
from gehomesdk import ErdCode, ErdMeasurementUnits
from ...const import DOMAIN
from .ge_erd_entity import ... | [
"logging.getLogger"
] | [((340, 367), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (357, 367), False, 'import logging\n')] |
import json
from scrapy.item import BaseItem
from scrapy.http import Request
from scrapy.exceptions import ContractFail
from scrapy.contracts import Contract
# contracts
class UrlContract(Contract):
""" Contract to set the url of the request (mandatory)
@url http://scrapy.org
"""
name = 'url'
... | [
"scrapy.exceptions.ContractFail"
] | [((2209, 2297), 'scrapy.exceptions.ContractFail', 'ContractFail', (["('Returned %s %s, expected %s' % (occurrences, self.obj_name, expected))"], {}), "('Returned %s %s, expected %s' % (occurrences, self.obj_name,\n expected))\n", (2221, 2297), False, 'from scrapy.exceptions import ContractFail\n')] |
import click
import pickle
import numpy as np
from collections import defaultdict
from utils import reset_seeds, get_dataset, load_embeddings
from mlp_multilabel_wrapper import PowersetKerasWrapper, MultiOutputKerasWrapper
from mlp_utils import CrossLabelDependencyLoss
def get_random_sample(dataset_name='bbc', train_... | [
"mlp_multilabel_wrapper.MultiOutputKerasWrapper",
"click.option",
"utils.get_dataset",
"mlp_utils.CrossLabelDependencyLoss",
"collections.defaultdict",
"mlp_multilabel_wrapper.PowersetKerasWrapper",
"utils.load_embeddings",
"utils.reset_seeds",
"click.command",
"numpy.arange"
] | [((912, 927), 'click.command', 'click.command', ([], {}), '()\n', (925, 927), False, 'import click\n'), ((929, 968), 'click.option', 'click.option', (['"""--n-samples"""'], {'default': '(10)'}), "('--n-samples', default=10)\n", (941, 968), False, 'import click\n'), ((970, 1031), 'click.option', 'click.option', (['"""--... |
#!/usr/bin/env python
# encoding: utf-8
"""
evaluate.py
Created by Shuailong on 2016-12-2.
Evaluate model accuracy on test set.
"""
from __future__ import print_function
from time import time
from keras.models import load_model
import os
from utils import true_accuracy
from dataset import get_data
from train imp... | [
"os.path.join",
"dataset.get_data",
"time.time",
"train.data_generator"
] | [((410, 416), 'time.time', 'time', ([], {}), '()\n', (414, 416), False, 'from time import time\n'), ((459, 480), 'dataset.get_data', 'get_data', ([], {'force': '(False)'}), '(force=False)\n', (467, 480), False, 'from dataset import get_data\n'), ((672, 707), 'os.path.join', 'os.path.join', (['MODEL_DIR', 'MODEL_FILE'],... |
#!/usr/bin/env python
# Copyright (c) 2013, Digium, Inc.
# Copyright (c) 2014-2016, Yelp, Inc.
import os
from setuptools import setup
import bravado
setup(
name="bravado",
# cloudlock version, no twisted dependency
version=bravado.version + "cl",
license="BSD 3-Clause License",
description="Lib... | [
"os.path.dirname"
] | [((402, 427), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (417, 427), False, 'import os\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2018-08-02 07:58
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('website', '0002_enable_compression'),
]
operations... | [
"django.db.models.IntegerField"
] | [((434, 548), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'choices': "[(1, 'MODIFIED'), (2, 'PROCESSING'), (3, 'PROCESSED')]", 'default': '(1)', 'editable': '(False)'}), "(choices=[(1, 'MODIFIED'), (2, 'PROCESSING'), (3,\n 'PROCESSED')], default=1, editable=False)\n", (453, 548), False, 'from djang... |
# for normalization we need to have the maxima of x and y values with the help of which
# we can normalise the given values
import csv
filename = "values.csv"
fields = []
rows = []
with open(filename,'r') as csvfile:
reader = csv.reader(csvfile)
fields = next(reader)
for row in reader:
... | [
"csv.reader"
] | [((238, 257), 'csv.reader', 'csv.reader', (['csvfile'], {}), '(csvfile)\n', (248, 257), False, 'import csv\n')] |
from pygdp import _execute_request
from pygdp import _get_geotype
from owslib.util import log
def submitFeatureWeightedGridStatistics(geoType, dataSetURI, varID, startTime, endTime, attribute, value, gmlIDs,
verbose, coverage, delim, stat, grpby, timeStep, summAttr, weighted, WF... | [
"pygdp._execute_request._executeRequest",
"pygdp._get_geotype._getFeatureCollectionGeoType",
"owslib.util.log.info",
"pygdp._execute_request.dodsReplace"
] | [((744, 784), 'pygdp._execute_request.dodsReplace', '_execute_request.dodsReplace', (['dataSetURI'], {}), '(dataSetURI)\n', (772, 784), False, 'from pygdp import _execute_request\n'), ((794, 836), 'owslib.util.log.info', 'log.info', (['"""Generating feature collection."""'], {}), "('Generating feature collection.')\n",... |
import sys
import socket
conn = socket.create_connection(('0.0.0.0', 8080))
msgs = [
# 0 Keep-Alive, Transfer-Encoding chunked
'GET / HTTP/1.1\r\nConnection: Keep-Alive\r\n\r\n',
# 1,2,3 Close, EOF "encoding"
'GET / HTTP/1.1\r\n\r\n',
'GET / HTTP/1.1\r\nConnection: close\r\n\r\n',
'GET / HTTP/... | [
"socket.create_connection"
] | [((33, 76), 'socket.create_connection', 'socket.create_connection', (["('0.0.0.0', 8080)"], {}), "(('0.0.0.0', 8080))\n", (57, 76), False, 'import socket\n')] |
"""
Django settings for TusPachangas project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
import django
import dj_database_url
# Build paths inside the project li... | [
"os.path.dirname",
"os.path.join",
"os.environ.get",
"dj_database_url.config"
] | [((438, 473), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""templates"""'], {}), "(BASE_DIR, 'templates')\n", (450, 473), False, 'import os\n'), ((2029, 2051), 'os.environ.get', 'os.environ.get', (['"""PORT"""'], {}), "('PORT')\n", (2043, 2051), False, 'import os\n'), ((2555, 2587), 'os.path.join', 'os.path.join', ... |
# -*- coding: utf-8 -*-
from gi.repository.GdkPixbuf import Pixbuf
from os import makedirs
def main():
for size in (16, 22, 24, 32, 48, 64, 128, 256, 512):
icon = Pixbuf.new_from_file_at_scale("formiko.svg", size, size, True)
makedirs("%dx%d" % (size, size))
icon.savev("%dx%d/formiko.png"... | [
"gi.repository.GdkPixbuf.Pixbuf.new_from_file_at_scale",
"os.makedirs"
] | [((178, 240), 'gi.repository.GdkPixbuf.Pixbuf.new_from_file_at_scale', 'Pixbuf.new_from_file_at_scale', (['"""formiko.svg"""', 'size', 'size', '(True)'], {}), "('formiko.svg', size, size, True)\n", (207, 240), False, 'from gi.repository.GdkPixbuf import Pixbuf\n'), ((249, 281), 'os.makedirs', 'makedirs', (["('%dx%d' % ... |
from typing import Optional
import pandas as pd
from ruptures import Binseg
from ruptures.base import BaseCost
from sklearn.linear_model import LinearRegression
from etna.transforms.base import PerSegmentWrapper
from etna.transforms.decomposition.change_points_trend import BaseEstimator
from etna.transforms.decomposi... | [
"sklearn.linear_model.LinearRegression",
"ruptures.Binseg"
] | [((3774, 3792), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (3790, 3792), False, 'from sklearn.linear_model import LinearRegression\n'), ((5504, 5603), 'ruptures.Binseg', 'Binseg', ([], {'model': 'self.model', 'custom_cost': 'self.custom_cost', 'min_size': 'self.min_size', 'jump': 'se... |
import xarray as xr
import pytest
import warnings
import argopy
from argopy import IndexFetcher as ArgoIndexFetcher
from argopy.errors import InvalidFetcherAccessPoint, InvalidFetcher, ErddapServerError, DataNotFound
from . import (
AVAILABLE_INDEX_SOURCES,
requires_fetcher_index,
requires_connected_erddap... | [
"pytest.mark.skip",
"argopy.IndexFetcher",
"pytest.raises",
"argopy.tutorial.open_dataset",
"argopy.set_options"
] | [((2985, 3076), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""Waiting for https://github.com/euroargodev/argopy/issues/16"""'}), "(reason=\n 'Waiting for https://github.com/euroargodev/argopy/issues/16')\n", (3001, 3076), False, 'import pytest\n'), ((3625, 3716), 'pytest.mark.skip', 'pytest.mark.skip',... |
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from homeassistant.const import CONF_HOST, CONF_NAME
from .acthor import test_connection
from .const import DEVICE_NAME, DOMAIN
class ACThorConfigFlow(ConfigFlow, domain=DOMAIN):
async def async_step_user(self, user_input: dict = None) ... | [
"voluptuous.Required"
] | [((818, 862), 'voluptuous.Required', 'vol.Required', (['CONF_NAME'], {'default': 'DEVICE_NAME'}), '(CONF_NAME, default=DEVICE_NAME)\n', (830, 862), True, 'import voluptuous as vol\n'), ((885, 908), 'voluptuous.Required', 'vol.Required', (['CONF_HOST'], {}), '(CONF_HOST)\n', (897, 908), True, 'import voluptuous as vol\n... |
""" docnado.py
A rapid documentation tool that will blow you away.
"""
import os
import re
import sys
import csv
import glob
import time
import signal
import shutil
import urllib
import base64
import hashlib
import argparse
import tempfile
import datetime
import threading
import traceback
import subprocess
import pl... | [
"flask.render_template",
"subprocess.getoutput",
"datetime.datetime.utcfromtimestamp",
"glob.iglob",
"re.compile",
"flask.Flask",
"time.sleep",
"sys.exit",
"os.walk",
"os.remove",
"re.search",
"os.path.exists",
"flask_frozen.Freezer",
"argparse.ArgumentParser",
"urllib.request.urlretriev... | [((12509, 12752), 're.compile', 're.compile', (['"""^(p|div|h[1-6]|blockquote|pre|dl|ol|ul|script|noscript|form|fieldset|math|hr|hr/|style|li|dt|dd|thead|tbody|tr|th|td|section|footer|header|group|figure|figcaption|article|canvas|output|progress|nav|main)$"""', 're.IGNORECASE'], {}), "(\n '^(p|div|h[1-6]|blockquote|... |
# MIT License
#
# Copyright (c) 2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pub... | [
"sys.print_exception",
"sys.exc_info"
] | [((2448, 2479), 'sys.print_exception', 'sys.print_exception', (['e', '_stream'], {}), '(e, _stream)\n', (2467, 2479), False, 'import sys\n'), ((2535, 2549), 'sys.exc_info', 'sys.exc_info', ([], {}), '()\n', (2547, 2549), False, 'import sys\n')] |
# Generated by Django 3.1.6 on 2021-02-12 19:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assessments', '0002_auto_20210212_1904'),
]
operations = [
migrations.AlterField(
model_name='country',
name='region... | [
"django.db.models.CharField"
] | [((341, 525), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'choices': "[('america', 'Americas'), ('europe', 'Europe'), ('africa', 'Africa'), (\n 'asia', 'Asia'), ('oceania', 'Oceania')]", 'max_length': '(100)', 'null': '(True)'}), "(blank=True, choices=[('america', 'Americas'), ('europe... |
from abc import (
abstractmethod,
)
from typing import (
Any,
Callable,
cast,
FrozenSet,
Generic,
Type,
TypeVar,
)
from cancel_token import (
CancelToken,
)
from p2p.exceptions import (
PeerConnectionLost,
)
from p2p.kademlia import Node
from p2p.peer import (
BasePeer,
... | [
"typing.cast",
"p2p.exceptions.PeerConnectionLost",
"typing.TypeVar"
] | [((705, 737), 'typing.TypeVar', 'TypeVar', (['"""TPeer"""'], {'bound': 'BasePeer'}), "('TPeer', bound=BasePeer)\n", (712, 737), False, 'from typing import Any, Callable, cast, FrozenSet, Generic, Type, TypeVar\n'), ((753, 798), 'typing.TypeVar', 'TypeVar', (['"""TStreamEvent"""'], {'bound': 'HasRemoteEvent'}), "('TStre... |
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from payments.models import Invoice, RazorpayKeys
from payments.razorpay.razorpay_payments import RazorpayPayments
from payments.models import Payment, Order
import json
@csrf_exempt
def webhook(request):
if request.method ... | [
"payments.models.Payment.objects.filter",
"json.loads",
"django.http.JsonResponse",
"payments.models.Order.objects.filter",
"payments.models.Invoice.objects.get",
"payments.models.Invoice.objects.all",
"payments.models.RazorpayKeys.objects.first",
"payments.razorpay.razorpay_payments.RazorpayPayments"... | [((1090, 1137), 'django.http.JsonResponse', 'JsonResponse', (["{'message': 'Method Not Allowed'}"], {}), "({'message': 'Method Not Allowed'})\n", (1102, 1137), False, 'from django.http import JsonResponse\n'), ((1170, 1198), 'payments.models.RazorpayKeys.objects.first', 'RazorpayKeys.objects.first', ([], {}), '()\n', (... |
import configparser
import os
import sys
from time import localtime, strftime, mktime
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
from net import Net
from geo_helper import store_image_bounds
from image_helper import CLASSES
from image_helper import save_image
f... | [
"net.Net",
"torch.nn.CrossEntropyLoss",
"configparser.ConfigParser",
"image_helper.validation_set_loader",
"image_helper.save_image",
"torch.max",
"image_helper.train_set_loader",
"geo_helper.store_image_bounds",
"image_helper.test_set_loader",
"time.localtime",
"torch.autograd.Variable"
] | [((459, 486), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (484, 486), False, 'import configparser\n'), ((1035, 1056), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (1054, 1056), True, 'import torch.nn as nn\n'), ((5163, 5191), 'net.Net', 'Net', ([], {'in_channels'... |
import tkinter as tk
from tkinter import filedialog
import csv
import matplotlib.pyplot as plt
root = tk.Tk(screenName=':0.0')
root.withdraw()
file_path = filedialog.askopenfilename()
lastIndex = len(file_path.split('/')) - 1
v0 = [0, 0, 0]
x0 = [0, 0, 0]
fToA = 1
error = 0.28
errorZ = 3
t = []
time... | [
"tkinter.Tk",
"csv.reader",
"matplotlib.pyplot.subplots",
"tkinter.filedialog.askopenfilename",
"matplotlib.pyplot.show"
] | [((108, 132), 'tkinter.Tk', 'tk.Tk', ([], {'screenName': '""":0.0"""'}), "(screenName=':0.0')\n", (113, 132), True, 'import tkinter as tk\n'), ((165, 193), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {}), '()\n', (191, 193), False, 'from tkinter import filedialog\n'), ((2223, 2238), 'matplo... |
# Generated by Django 2.2.3 on 2019-07-15 19:24
from django.db import migrations, models
def backpopulate_incomplete_profiles(apps, schema):
"""Backpopulate users who don't have a profile record"""
User = apps.get_model("users", "User")
Profile = apps.get_model("users", "Profile")
for user in User.o... | [
"django.db.models.IntegerField",
"django.db.models.OuterRef",
"django.db.migrations.RunPython",
"django.db.models.Q",
"django.db.models.CharField"
] | [((2522, 2622), 'django.db.migrations.RunPython', 'migrations.RunPython', (['backpopulate_incomplete_profiles'], {'reverse_code': 'remove_incomplete_profiles'}), '(backpopulate_incomplete_profiles, reverse_code=\n remove_incomplete_profiles)\n', (2542, 2622), False, 'from django.db import migrations, models\n'), ((1... |
from __future__ import division
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import sys
import os
import time
#
# TORCH INSTALLATION: refer to https://pytorch.org/get-started/locally/
#
def update_progress(job_t... | [
"numpy.sqrt",
"torch.det",
"torch.t",
"torch.mm",
"torch.tensor",
"numpy.zeros",
"numpy.savetxt",
"torch.dot",
"os.system",
"sys.stdout.flush",
"torch.empty",
"torch.inverse",
"sys.stdout.write"
] | [((1336, 1402), 'torch.tensor', 'torch.tensor', (['coords_data'], {'requires_grad': '(True)', 'dtype': 'torch.float64'}), '(coords_data, requires_grad=True, dtype=torch.float64)\n', (1348, 1402), False, 'import torch\n'), ((2061, 2127), 'torch.tensor', 'torch.tensor', (['val_r_data'], {'requires_grad': '(False)', 'dtyp... |
"""
OSR (LOTFP) stat generator.
"""
import random
def d(num_sides):
"""
Represents rolling a die of size 'num_sides'.
Returns random number from that size die
"""
return random.randint(1, num_sides)
def xdy(num_dice, num_sides):
""" represents rolling num_dice of size num_sides.
Re... | [
"random.randint"
] | [((198, 226), 'random.randint', 'random.randint', (['(1)', 'num_sides'], {}), '(1, num_sides)\n', (212, 226), False, 'import random\n')] |
import logging
import os
import random
import string
import time
import unittest
import neurolib.utils.paths as paths
import neurolib.utils.pypetUtils as pu
import numpy as np
import pytest
import xarray as xr
from neurolib.models.aln import ALNModel
from neurolib.models.fhn import FHNModel
from neurolib.models.multim... | [
"neurolib.optimize.exploration.BoxSearch",
"random.choice",
"numpy.random.rand",
"numpy.ones",
"neurolib.models.multimodel.MultiModel",
"os.path.join",
"neurolib.utils.parameterSpace.ParameterSpace",
"neurolib.utils.loadData.Dataset",
"neurolib.models.aln.ALNModel",
"numpy.array",
"numpy.linspac... | [((10456, 10471), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10469, 10471), False, 'import unittest\n'), ((1635, 1679), 'neurolib.utils.parameterSpace.ParameterSpace', 'ParameterSpace', (["{'mue_ext_mean': [1.0, 2.0]}"], {}), "({'mue_ext_mean': [1.0, 2.0]})\n", (1649, 1679), False, 'from neurolib.utils.parame... |
from django import forms
from django.contrib.auth.forms import PasswordResetForm, SetPasswordForm
# from .models import RegionModel
# from .models import SERVICE_CHOICES, REGION_CHOICES
from django.contrib.auth import authenticate
# from django.contrib.auth.forms import UserCreationForm, UserChangeForm
# from .models i... | [
"django.contrib.auth.authenticate",
"django.forms.ValidationError",
"django.forms.TextInput"
] | [((736, 786), 'django.contrib.auth.authenticate', 'authenticate', ([], {'username': 'username', 'password': 'password'}), '(username=username, password=password)\n', (748, 786), False, 'from django.contrib.auth import authenticate\n'), ((1127, 1177), 'django.contrib.auth.authenticate', 'authenticate', ([], {'username':... |
# newly added libraries
import copy
import wandb
import time
import math
import csv
import shutil
from tqdm import tqdm
import torch
import numpy as np
import pandas as pd
from client import Client
from config import *
import scheduler as sch
class FedAvgTrainer(object):
def __init__(self, dataset, model, device... | [
"wandb.log",
"numpy.random.rand",
"torch.nn.CrossEntropyLoss",
"numpy.array",
"client.Client",
"copy.deepcopy",
"numpy.arange",
"numpy.asarray",
"numpy.max",
"numpy.isinf",
"scheduler.Scheduler_PN_method_1",
"csv.writer",
"torch.norm",
"numpy.isnan",
"scheduler.Scheduler_PN_method_3",
... | [((4042, 4076), 'numpy.zeros', 'np.zeros', (['(1, client_num_in_total)'], {}), '((1, client_num_in_total))\n', (4050, 4076), True, 'import numpy as np\n'), ((23990, 24031), 'math.ceil', 'math.ceil', (['(TIME_COMPRESSION_RATIO * tmp_t)'], {}), '(TIME_COMPRESSION_RATIO * tmp_t)\n', (23999, 24031), False, 'import math\n')... |
from viewdom import html, render, use_context, Context
expected = '<h1>My Todos</h1><ul><li>Item: first</li></ul>'
# start-after
title = 'My Todos'
todos = ['first']
def Todo(label):
prefix = use_context('prefix')
return html('<li>{prefix}{label}</li>')
def TodoList(todos):
return html('<ul>{[Todo(lab... | [
"viewdom.html",
"viewdom.use_context"
] | [((200, 221), 'viewdom.use_context', 'use_context', (['"""prefix"""'], {}), "('prefix')\n", (211, 221), False, 'from viewdom import html, render, use_context, Context\n'), ((233, 265), 'viewdom.html', 'html', (['"""<li>{prefix}{label}</li>"""'], {}), "('<li>{prefix}{label}</li>')\n", (237, 265), False, 'from viewdom im... |
###
### This file was automatically generated
###
from archinfo.arch import register_arch, Endness, Register
from .common import ArchPcode
class ArchPcode_PowerPC_LE_32_QUICC(ArchPcode):
name = 'PowerPC:LE:32:QUICC'
pcode_arch = 'PowerPC:LE:32:QUICC'
description = 'PowerQUICC-III 32-bit little endian fa... | [
"archinfo.arch.register_arch",
"archinfo.arch.Register"
] | [((127376, 127465), 'archinfo.arch.register_arch', 'register_arch', (["['powerpc:le:32:quicc']", '(32)', 'Endness.LE', 'ArchPcode_PowerPC_LE_32_QUICC'], {}), "(['powerpc:le:32:quicc'], 32, Endness.LE,\n ArchPcode_PowerPC_LE_32_QUICC)\n", (127389, 127465), False, 'from archinfo.arch import register_arch, Endness, Reg... |
# -*- coding: utf-8 -*-
import json
import pdb
import os
from os.path import join as pj
import networkx as nx
import pandas as pd
from networkx.readwrite.json_graph import node_link_data
def chain():
g = nx.Graph()
# Horizontal
for i in range(11, 15):
g.add_edge(i, i + 1)
for i in range(... | [
"os.path.exists",
"networkx.spectral_layout",
"os.makedirs",
"networkx.circular_layout",
"networkx.DiGraph",
"networkx.spring_layout",
"networkx.Graph",
"os.path.join",
"networkx.draw_networkx_nodes",
"networkx.draw_networkx_labels",
"networkx.readwrite.json_graph.node_link_data",
"networkx.dr... | [((213, 223), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (221, 223), True, 'import networkx as nx\n'), ((1131, 1152), 'networkx.spectral_layout', 'nx.spectral_layout', (['g'], {}), '(g)\n', (1149, 1152), True, 'import networkx as nx\n'), ((1157, 1188), 'networkx.draw', 'nx.draw', (['g', 'pos'], {'node_color': '"""... |
from importlib import _bootstrap
from . import util
import collections
import imp
import sys
import unittest
class PathHookTests(unittest.TestCase):
"""Test the path hook for extension modules."""
# XXX Should it only succeed for pre-existing directories?
# XXX Should it only work for directories contai... | [
"test.support.run_unittest",
"importlib._bootstrap._file_path_hook"
] | [((682, 709), 'test.support.run_unittest', 'run_unittest', (['PathHookTests'], {}), '(PathHookTests)\n', (694, 709), False, 'from test.support import run_unittest\n'), ((389, 422), 'importlib._bootstrap._file_path_hook', '_bootstrap._file_path_hook', (['entry'], {}), '(entry)\n', (415, 422), False, 'from importlib impo... |
import os
from glob import iglob
from concurrent.futures import ThreadPoolExecutor
def count_words_file(path):
if not os.path.isfile(path):
return 0
with open(path) as file:
return sum(len(line.split()) for line in file)
def count_words_sequential(pattern):
return sum(map(count_words_fil... | [
"os.path.isfile",
"concurrent.futures.ThreadPoolExecutor",
"glob.iglob"
] | [((124, 144), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (138, 144), False, 'import os\n'), ((387, 407), 'concurrent.futures.ThreadPoolExecutor', 'ThreadPoolExecutor', ([], {}), '()\n', (405, 407), False, 'from concurrent.futures import ThreadPoolExecutor\n'), ((323, 337), 'glob.iglob', 'iglob', ([... |
# -*- coding: UTF-8 -*-
# !/usr/bin/python
# @time :2019/6/5 21:04
# @author :Mo
# @function :file of path
import os
import pathlib
import sys
# 项目的根目录
path_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
path_root = path_root.replace('\\', '/')
path_top = str(pathlib.P... | [
"os.path.abspath",
"os.path.dirname"
] | [((212, 237), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (227, 237), False, 'import os\n'), ((324, 349), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (339, 349), False, 'import os\n')] |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Created by <NAME>
import pytest
import asyncio
from pandas.testing import assert_frame_equal
from apyhgnc import apyhgnc
# apyhgnc.info
def test_info_searchableFields(searchable_fields):
result = apyhgnc.info().searchableFields
assert result == searchable_field... | [
"apyhgnc.apyhgnc.afetch",
"apyhgnc.apyhgnc.asearch",
"apyhgnc.apyhgnc.search",
"apyhgnc.apyhgnc.info",
"pandas.testing.assert_frame_equal",
"asyncio.get_event_loop",
"apyhgnc.apyhgnc.fetch"
] | [((634, 665), 'apyhgnc.apyhgnc.fetch', 'apyhgnc.fetch', (['"""symbol"""', '"""ZNF3"""'], {}), "('symbol', 'ZNF3')\n", (647, 665), False, 'from apyhgnc import apyhgnc\n'), ((670, 718), 'pandas.testing.assert_frame_equal', 'assert_frame_equal', (['result', 'df_fetch_symbol_znf3'], {}), '(result, df_fetch_symbol_znf3)\n',... |
# -*- coding: utf-8 -*-
from sklearn import preprocessing
from torch.autograd import Variable
from models_gat import GAT
import os
import torch
import numpy as np
import argparse
import pickle
import sklearn.metrics as metrics
import cross_val
import time
import random
torch.manual_seed(0)
np.random.seed(0)
random.s... | [
"numpy.hstack",
"torch.max",
"cross_val.stratify_splits",
"torch.from_numpy",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"torch.cuda.is_available",
"torch.squeeze",
"cross_val.model_selection_split",
"os.remove",
"os.path.exists",
"numpy.mean",
"argparse.ArgumentParse... | [((273, 293), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (290, 293), False, 'import torch\n'), ((294, 311), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (308, 311), True, 'import numpy as np\n'), ((312, 326), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (323, 326), Fals... |
import copy
import numbers
import struct
from ._common import *
from ._exif import *
TIFF_HEADER_LENGTH = 8
def dump(exif_dict_original):
"""
py:function:: piexif.load(data)
Return exif as bytes.
:param dict exif: Exif data({"0th":dict, "Exif":dict, "GPS":dict, "Interop":dict, "1st":dict, "thumbn... | [
"struct.pack",
"copy.deepcopy"
] | [((393, 426), 'copy.deepcopy', 'copy.deepcopy', (['exif_dict_original'], {}), '(exif_dict_original)\n', (406, 426), False, 'import copy\n'), ((11003, 11028), 'struct.pack', 'struct.pack', (['""">I"""', 'length'], {}), "('>I', length)\n", (11014, 11028), False, 'import struct\n'), ((11176, 11204), 'struct.pack', 'struct... |
import pygame
import random
from pygame import *
pygame.init()
width, height = 740, 500
screen = pygame.display.set_mode((width, height))
player = [pygame.transform.scale(pygame.image.load("Resources/Balljump-1(2).png"), (100,100)), pygame.t... | [
"pygame.display.set_caption",
"pygame.init",
"pygame.time.get_ticks",
"pygame.event.get",
"pygame.quit",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.key.get_pressed",
"pygame.time.Clock",
"pygame.image.load",
"pygame.font.Font"
] | [((127, 140), 'pygame.init', 'pygame.init', ([], {}), '()\n', (138, 140), False, 'import pygame\n'), ((176, 216), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(width, height)'], {}), '((width, height))\n', (199, 216), False, 'import pygame\n'), ((1288, 1307), 'pygame.time.Clock', 'pygame.time.Clock', ([], {... |
import asyncio
from io import BytesIO
import logging
import os
import random
import time
from typing import List
from urllib.parse import urlparse
import aiohttp
from aiohttp import ClientSession, TCPConnector
import requests
from requests import Response
from tqdm import tqdm
from nogi import REQUEST_HEADERS
from no... | [
"logging.getLogger",
"traceback.format_exc",
"urllib.parse.urlparse",
"os.path.join",
"io.BytesIO",
"requests.get",
"time.sleep",
"nogi.utils.parsers.generate_post_key",
"asyncio.gather",
"aiohttp.TCPConnector",
"asyncio.get_event_loop",
"random.randint"
] | [((526, 545), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (543, 545), False, 'import logging\n'), ((1157, 1198), 'os.path.join', 'os.path.join', (["member['roma_name']", '"""post"""'], {}), "(member['roma_name'], 'post')\n", (1169, 1198), False, 'import os\n'), ((1240, 1280), 'os.path.join', 'os.path.jo... |
from Jumpscale import j
import signal
from .. import templates
DNSMASQ = "/bin/dnsmasq --conf-file=/etc/dnsmasq.conf -d"
class DHCP:
def __init__(self, container, domain, networks):
self.container = container
self.domain = domain
self.networks = networks
def apply_config(self):
... | [
"Jumpscale.j.tools.timer.execute_until",
"Jumpscale.j.exceptions.Base"
] | [((774, 822), 'Jumpscale.j.tools.timer.execute_until', 'j.tools.timer.execute_until', (['self.is_running', '(10)'], {}), '(self.is_running, 10)\n', (801, 822), False, 'from Jumpscale import j\n'), ((842, 884), 'Jumpscale.j.exceptions.Base', 'j.exceptions.Base', (['"""Failed to run dnsmasq"""'], {}), "('Failed to run dn... |
#!/usr/bin/env python3
"""UrsaLeo LEDdebug board LED demo
Turn the LED's on one at a time, then all off"""
import time
ON = 1
OFF = 0
DELAY = 0.5 # seconds
try:
from LEDdebug import LEDdebug
except ImportError:
try:
import sys
import os
sys.path.append("..")
sys.path.appen... | [
"os.path.dirname",
"LEDdebug.LEDdebug",
"sys.path.append",
"time.sleep"
] | [((570, 580), 'LEDdebug.LEDdebug', 'LEDdebug', ([], {}), '()\n', (578, 580), False, 'from LEDdebug import LEDdebug\n'), ((725, 742), 'time.sleep', 'time.sleep', (['DELAY'], {}), '(DELAY)\n', (735, 742), False, 'import time\n'), ((276, 297), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (291, 297... |
import time
import random
import requests
from lxml import etree
import pymongo
from .url_file import mjx_weibo, mjx_dy, mjx_ks, mjx_xhs
class DBMongo:
def __init__(self):
self.my_client = pymongo.MongoClient("mongodb://localhost:27017/")
# 连接数据库
self.db = self.my_client["mcn"]
def i... | [
"random.choice",
"time.sleep",
"requests.get",
"lxml.etree.HTML",
"pymongo.MongoClient"
] | [((203, 252), 'pymongo.MongoClient', 'pymongo.MongoClient', (['"""mongodb://localhost:27017/"""'], {}), "('mongodb://localhost:27017/')\n", (222, 252), False, 'import pymongo\n'), ((2201, 2257), 'requests.get', 'requests.get', (['url'], {'headers': 'self.headers', 'proxies': 'proxies'}), '(url, headers=self.headers, pr... |
import numpy as np
from keras.utils import np_utils
import pandas as pd
import sys
from sklearn.preprocessing import LabelEncoder
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis as QDA
from sklearn.decomposition import PCA
import os
from sklearn.externals import joblib
from sklearn.metrics impor... | [
"os.path.exists",
"sklearn.preprocessing.LabelEncoder",
"sklearn.metrics.f1_score",
"os.makedirs",
"pandas.read_csv",
"sklearn.decomposition.PCA",
"sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis",
"sklearn.externals.joblib.dump"
] | [((440, 503), 'pandas.read_csv', 'pd.read_csv', ([], {'filepath_or_buffer': 'trainName', 'header': 'None', 'sep': '""","""'}), "(filepath_or_buffer=trainName, header=None, sep=',')\n", (451, 503), True, 'import pandas as pd\n'), ((513, 575), 'pandas.read_csv', 'pd.read_csv', ([], {'filepath_or_buffer': 'testName', 'hea... |
## to change recursion limit
import sys
print(sys.getrecursionlimit()) #Return the current value of the recursion limit
#1000
## change the limit
sys.setrecursionlimit(2000) # change value of the recursion limit
#2000
i=0
def greet():
global i
i+=1
print('hellow',i)
greet()
greet() # hellow... | [
"sys.setrecursionlimit",
"sys.getrecursionlimit"
] | [((152, 179), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(2000)'], {}), '(2000)\n', (173, 179), False, 'import sys\n'), ((49, 72), 'sys.getrecursionlimit', 'sys.getrecursionlimit', ([], {}), '()\n', (70, 72), False, 'import sys\n')] |
from django.test import TestCase, override_settings
from django.urls import reverse
from pages.models import Article, HomePage
@override_settings(USE_I18N=False)
class PageViewTest(TestCase):
@classmethod
def setUpTestData(cls):
print("\nTest page views")
# Set up non-modified objects used by... | [
"pages.models.HomePage.objects.all",
"pages.models.Article.objects.create",
"django.test.override_settings",
"pages.models.HomePage.objects.create",
"django.urls.reverse"
] | [((131, 164), 'django.test.override_settings', 'override_settings', ([], {'USE_I18N': '(False)'}), '(USE_I18N=False)\n', (148, 164), False, 'from django.test import TestCase, override_settings\n'), ((346, 384), 'pages.models.HomePage.objects.create', 'HomePage.objects.create', ([], {'title': '"""Title"""'}), "(title='T... |
from decimal import Decimal as D
from django.test import TestCase
from oscar.apps.basket.models import Basket
from oscar.apps.partner import strategy
from oscar.test import factories
from oscar.apps.catalogue.models import Option
class TestAddingAProductToABasket(TestCase):
def setUp(self):
self.basket... | [
"oscar.test.factories.create_stockinfo",
"oscar.test.factories.create_product",
"oscar.apps.catalogue.models.Option.objects.create",
"oscar.apps.partner.strategy.Default",
"decimal.Decimal",
"oscar.apps.basket.models.Basket"
] | [((323, 331), 'oscar.apps.basket.models.Basket', 'Basket', ([], {}), '()\n', (329, 331), False, 'from oscar.apps.basket.models import Basket\n'), ((363, 381), 'oscar.apps.partner.strategy.Default', 'strategy.Default', ([], {}), '()\n', (379, 381), False, 'from oscar.apps.partner import strategy\n'), ((405, 431), 'oscar... |
import pytest
import os
import sqlalchemy
import contextlib
@pytest.fixture(scope="session")
def engine_uri(test_dir):
database_path = test_dir.joinpath("pytest_meltano.db")
try:
database_path.unlink()
except FileNotFoundError:
pass
return f"sqlite:///{database_path}"
| [
"pytest.fixture"
] | [((63, 94), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (77, 94), False, 'import pytest\n')] |
#
# This file is part of LiteX.
#
# Copyright (c) 2014-2019 <NAME> <<EMAIL>>
# Copyright (c) 2019 msloniewski <<EMAIL>>
# Copyright (c) 2019 vytautasb <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
import os
import subprocess
import sys
import math
from shutil import which
from migen.fhdl.structure import _Fragmen... | [
"os.makedirs",
"math.floor",
"shutil.which",
"os.getcwd",
"os.chdir",
"litex.build.tools.get_litex_git_revision",
"os.path.dirname",
"subprocess.call",
"litex.build.generic_platform.Pins",
"litex.build.tools.write_to_file"
] | [((6393, 6459), 'litex.build.tools.write_to_file', 'tools.write_to_file', (['script_file', 'script_contents'], {'force_unix': '(True)'}), '(script_file, script_contents, force_unix=True)\n', (6412, 6459), False, 'from litex.build import tools\n'), ((6627, 6647), 'shutil.which', 'which', (['"""quartus_map"""'], {}), "('... |
from rest_framework.routers import DefaultRouter
from records.views import RecordViewSet
router = DefaultRouter()
router.register('', RecordViewSet, basename='records')
urlpatterns = router.urls
| [
"rest_framework.routers.DefaultRouter"
] | [((100, 115), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (113, 115), False, 'from rest_framework.routers import DefaultRouter\n')] |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import os
from rhea import RheaError
from rhea import parser as rhea_parser
from azure.common import AzureHttpError
from azure.storage.blob.models import BlobPrefix
from polystores.clients.azure_client import get_blob_service_c... | [
"polystores.utils.append_basename",
"polystores.utils.get_files_in_current_directory",
"polystores.exceptions.PolyaxonStoresException",
"os.makedirs",
"os.path.join",
"rhea.parser.parse_wasbs_path",
"polystores.clients.azure_client.get_blob_service_connection",
"polystores.utils.check_dirname_exists",... | [((1913, 2034), 'polystores.clients.azure_client.get_blob_service_connection', 'get_blob_service_connection', ([], {'account_name': 'account_name', 'account_key': 'account_key', 'connection_string': 'connection_string'}), '(account_name=account_name, account_key=\n account_key, connection_string=connection_string)\n... |
"""
Copyright (c) 2016 Jet Propulsion Laboratory,
California Institute of Technology. All rights reserved
"""
import sys
import numpy as np
import logging
import time
import types
from datetime import datetime
from netCDF4 import Dataset
from nexustiles.nexustiles import NexusTileService
from webservice.webmodel impor... | [
"logging.getLogger",
"numpy.ma.max",
"inspect.getmembers",
"numpy.flipud",
"numpy.where",
"webservice.webmodel.NexusProcessingException",
"netCDF4.Dataset",
"time.time",
"functools.wraps",
"numpy.max",
"numpy.linspace",
"numpy.min",
"numpy.all",
"numpy.ma.min",
"nexustiles.nexustiles.Nex... | [((442, 469), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (459, 469), False, 'import logging\n'), ((822, 849), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (839, 849), False, 'import logging\n'), ((2833, 2860), 'logging.getLogger', 'logging.getLogger', ... |
import numpy as np
from collections import defaultdict, Counter
from .rbbox_np import rbbox_iou
def get_ap(recall, precision):
recall = [0] + list(recall) + [1]
precision = [0] + list(precision) + [0]
for i in range(len(precision) - 1, 0, -1):
precision[i - 1] = max(precision[i - 1], precision[i... | [
"numpy.any",
"numpy.max",
"collections.Counter",
"numpy.stack",
"numpy.linspace",
"numpy.zeros",
"collections.defaultdict",
"numpy.cumsum"
] | [((522, 558), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(11)'], {'endpoint': '(True)'}), '(0, 1, 11, endpoint=True)\n', (533, 558), True, 'import numpy as np\n'), ((598, 610), 'numpy.any', 'np.any', (['mask'], {}), '(mask)\n', (604, 610), True, 'import numpy as np\n'), ((1134, 1167), 'collections.Counter', 'Cou... |
import json
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import simulation
from eval_functions import oks_score_multi
import utils
def alter_location(points, x_offset, y_offset):
x, y = points.T
return np.array([x + x_offset, y + y_offset]).T
def alter_rotation(points, radians):... | [
"numpy.random.normal",
"numpy.mean",
"eval_functions.oks_score_multi",
"numpy.random.beta",
"utils.bounded_cauchy",
"numpy.reshape",
"numpy.random.choice",
"utils.make_categorical",
"numpy.exp",
"numpy.array",
"json.load",
"simulation.create_sim_df",
"numpy.linspace",
"numpy.sign",
"nump... | [((336, 359), 'numpy.mean', 'np.mean', (['points'], {'axis': '(0)'}), '(points, axis=0)\n', (343, 359), True, 'import numpy as np\n'), ((496, 519), 'numpy.mean', 'np.mean', (['points'], {'axis': '(0)'}), '(points, axis=0)\n', (503, 519), True, 'import numpy as np\n'), ((2047, 2067), 'pandas.DataFrame', 'pd.DataFrame', ... |
from typing import Dict, Union
from graphql import (
GraphQLBoolean,
GraphQLFloat,
GraphQLInputField,
GraphQLInt,
GraphQLList,
GraphQLNonNull,
GraphQLScalarType,
GraphQLString,
)
from sqlalchemy import ARRAY, Boolean, Float, Integer
from sqlalchemy.dialects.postgresql import ARRAY as PG... | [
"graphql.GraphQLInputField",
"graphql.GraphQLNonNull"
] | [((979, 1010), 'graphql.GraphQLInputField', 'GraphQLInputField', (['graphql_type'], {}), '(graphql_type)\n', (996, 1010), False, 'from graphql import GraphQLBoolean, GraphQLFloat, GraphQLInputField, GraphQLInt, GraphQLList, GraphQLNonNull, GraphQLScalarType, GraphQLString\n'), ((1028, 1059), 'graphql.GraphQLInputField'... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
from .shared import Conv_Block
from ..utils.utils import zeros, mean_cube, last_frame, ENS
class Residual(nn.Module):
def __init__(self, fn):
super().__init__()
self.fn = fn
def f... | [
"torch.mul",
"torch.split",
"numpy.power",
"torch.nn.ModuleList",
"torch.nn.LayerNorm",
"torch.sin",
"torch.stack",
"einops.rearrange",
"torch.nn.Conv2d",
"torch.cos",
"torch.cuda.is_available",
"torch.concat",
"torch.moveaxis",
"torch.nn.functional.softmax"
] | [((494, 511), 'torch.nn.LayerNorm', 'nn.LayerNorm', (['dim'], {}), '(dim)\n', (506, 511), True, 'import torch.nn as nn\n'), ((2972, 3000), 'torch.stack', 'torch.stack', (['([K] * s)'], {'dim': '(-2)'}), '([K] * s, dim=-2)\n', (2983, 3000), False, 'import torch\n'), ((3017, 3045), 'torch.stack', 'torch.stack', (['([V] *... |
# Copyright (C) 2017 O.S. Systems Software LTDA.
# This software is released under the MIT License
import unittest
from hydra import Hydra, Client
class ClientsTestCase(unittest.TestCase):
def setUp(self):
self.hydra = Hydra('http://localhost:4444', 'client', 'secret')
self.client = Client(
... | [
"hydra.Client",
"hydra.Hydra"
] | [((236, 286), 'hydra.Hydra', 'Hydra', (['"""http://localhost:4444"""', '"""client"""', '"""secret"""'], {}), "('http://localhost:4444', 'client', 'secret')\n", (241, 286), False, 'from hydra import Hydra, Client\n'), ((309, 439), 'hydra.Client', 'Client', ([], {'name': '"""new-client"""', 'secret': '"""client-secret"""... |
import asyncio
import click
from precon.devices_handlers.distance_sensor import show_distance as show_distance_func
from precon.remote_control import steer_vehicle, Screen
try:
import RPi.GPIO as GPIO
except (RuntimeError, ModuleNotFoundError):
import fake_rpi
GPIO = fake_rpi.RPi.GPIO
@click.command(n... | [
"RPi.GPIO.cleanup",
"click.command",
"precon.remote_control.steer_vehicle",
"precon.remote_control.Screen",
"asyncio.get_event_loop",
"precon.devices_handlers.distance_sensor.show_distance"
] | [((305, 329), 'click.command', 'click.command', ([], {'name': '"""rc"""'}), "(name='rc')\n", (318, 329), False, 'import click\n'), ((687, 722), 'click.command', 'click.command', ([], {'name': '"""show-distance"""'}), "(name='show-distance')\n", (700, 722), False, 'import click\n'), ((371, 395), 'asyncio.get_event_loop'... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc
# 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
# no... | [
"os.path.exists",
"monolithe.lib.Printer.success",
"monolithe.lib.Printer.log",
"monolithe.generators.managers.MainManager",
"os.path.join",
"shutil.rmtree",
"monolithe.generators.managers.VanillaManager",
"monolithe.generators.managers.CLIManager",
"os.remove"
] | [((2126, 2156), 'os.path.exists', 'os.path.exists', (['overrides_path'], {}), '(overrides_path)\n', (2140, 2156), False, 'import os\n'), ((2293, 2328), 'os.path.exists', 'os.path.exists', (['attrs_defaults_path'], {}), '(attrs_defaults_path)\n', (2307, 2328), False, 'import os\n'), ((2459, 2491), 'os.path.exists', 'os.... |
import atexit
import sys
if sys.version_info[0] == 2:
from Queue import Empty
else:
from queue import Empty
from multiprocessing import Process, Queue
from rllab.sampler.utils import rollout
import numpy as np
__all__ = [
'init_worker',
'init_plot',
'update_plot'
]
process = None
queue = None
de... | [
"multiprocessing.Queue",
"rllab.sampler.utils.rollout",
"atexit.register",
"multiprocessing.Process"
] | [((1499, 1506), 'multiprocessing.Queue', 'Queue', ([], {}), '()\n', (1504, 1506), False, 'from multiprocessing import Process, Queue\n'), ((1521, 1550), 'multiprocessing.Process', 'Process', ([], {'target': '_worker_start'}), '(target=_worker_start)\n', (1528, 1550), False, 'from multiprocessing import Process, Queue\n... |
import re, scrapy
from crawler.items import *
class BenchmarkSpider(scrapy.Spider):
drop_params = True
# Spider name, for use with the scrapy crawl command
name = "benchmarks"
# Constants to get url parts
FULL, PROTOCOL, USER, PASSWORD, SUBDOMAIN, DOMAIN, TOP_LEVEL_DOMAIN, PORT_NUM, PATH, PAGE, GE... | [
"scrapy.Request",
"re.search"
] | [((2021, 2044), 're.search', 're.search', (['pattern', 'url'], {}), '(pattern, url)\n', (2030, 2044), False, 'import re, scrapy\n'), ((2776, 2799), 're.search', 're.search', (['pattern', 'url'], {}), '(pattern, url)\n', (2785, 2799), False, 'import re, scrapy\n'), ((5064, 5110), 'scrapy.Request', 'scrapy.Request', (['n... |
import re
import logging
import httplib
import view_base
from models import rt_proxy
LOG = logging.getLogger('ryu.gui')
class RtAddrDel(view_base.ViewBase):
def __init__(self, host, port, dpid, address_id, status=None):
super(RtAddrDel, self).__init__()
self.host = host
self.port = port
... | [
"logging.getLogger",
"models.rt_proxy.delete_router_address"
] | [((93, 121), 'logging.getLogger', 'logging.getLogger', (['"""ryu.gui"""'], {}), "('ryu.gui')\n", (110, 121), False, 'import logging\n'), ((855, 917), 'models.rt_proxy.delete_router_address', 'rt_proxy.delete_router_address', (['address', 'address_no', 'self.dpid'], {}), '(address, address_no, self.dpid)\n', (885, 917),... |
"""This module contains tests for the helper module.
"""
from pywrangler.util.helper import get_param_names
def test_get_param_names():
def func():
pass
assert get_param_names(func) == []
def func1(a, b=4, c=6):
pass
assert get_param_names(func1) == ["a", "b", "c"]
assert get... | [
"pywrangler.util.helper.get_param_names"
] | [((182, 203), 'pywrangler.util.helper.get_param_names', 'get_param_names', (['func'], {}), '(func)\n', (197, 203), False, 'from pywrangler.util.helper import get_param_names\n'), ((264, 286), 'pywrangler.util.helper.get_param_names', 'get_param_names', (['func1'], {}), '(func1)\n', (279, 286), False, 'from pywrangler.u... |
import numpy as np
import photon_stream as ps
import photon_stream_production as psp
import pkg_resources
import os
runinfo_path = pkg_resources.resource_filename(
'photon_stream_production',
os.path.join('tests', 'resources', 'runinfo_20161115_to_20170103.csv')
)
drs_fRunID_for_obs_run = psp.drs_run._drs_fRu... | [
"photon_stream_production.drs_run.assign_drs_runs",
"photon_stream_production.runinfo.read",
"os.path.join",
"numpy.isnan"
] | [((201, 271), 'os.path.join', 'os.path.join', (['"""tests"""', '"""resources"""', '"""runinfo_20161115_to_20170103.csv"""'], {}), "('tests', 'resources', 'runinfo_20161115_to_20170103.csv')\n", (213, 271), False, 'import os\n'), ((379, 409), 'photon_stream_production.runinfo.read', 'psp.runinfo.read', (['runinfo_path']... |