code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pytest_mock
from yarl import URL
import pybotters.auth
import pybotters.request
async def test_request_without_auth(mocker: pytest_mock.MockerFixture):
m_auth = mocker.MagicMock(side_effect=lambda args, kwargs: args)
items = {
'example.com': pybotters.auth.Item('example', m_auth),
... | [
"yarl.URL"
] | [((531, 556), 'yarl.URL', 'URL', (['"""http://example.com"""'], {}), "('http://example.com')\n", (534, 556), False, 'from yarl import URL\n'), ((650, 683), 'yarl.URL', 'URL', (['"""http://example.com?foo=bar"""'], {}), "('http://example.com?foo=bar')\n", (653, 683), False, 'from yarl import URL\n'), ((1187, 1212), 'yar... |
# Lint as: python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | [
"tensorflow.compat.v2.sort",
"tensorflow.compat.v2.searchsorted",
"tensorflow.compat.v2.size",
"tensorflow.compat.v2.eye",
"tf_quant_finance.models.utils.generate_mc_normal_draws",
"tensorflow.compat.v2.math.exp",
"tensorflow.compat.v2.cast",
"tf_quant_finance.models.utils.maybe_update_along_axis",
... | [((42189, 42220), 'tensorflow.compat.v2.sparse.to_dense', 'tf.sparse.to_dense', (['mask_sparse'], {}), '(mask_sparse)\n', (42207, 42220), True, 'import tensorflow.compat.v2 as tf\n'), ((32115, 32189), 'tensorflow.compat.v2.zeros', 'tf.zeros', (['(num_samples, num_requested_times, self._dim)'], {'dtype': 'self._dtype'})... |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | [
"os.path.join",
"kafkatest.services.kafka.directory.kafka_dir"
] | [((2266, 2303), 'os.path.join', 'os.path.join', (['PERSISTENT_ROOT', '"""logs"""'], {}), "(PERSISTENT_ROOT, 'logs')\n", (2278, 2303), False, 'import os\n'), ((2325, 2385), 'os.path.join', 'os.path.join', (['PERSISTENT_ROOT', '"""consumer_performance.stdout"""'], {}), "(PERSISTENT_ROOT, 'consumer_performance.stdout')\n"... |
import os
from flask import Flask, render_template, request, url_for, redirect
from flask_cors import CORS
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.sql import func
import json
def row2dict(row):
d = {}
for column in row.__table__.columns:
d[column.name] = str(getattr(row, column.name))... | [
"json.loads",
"flask_cors.CORS",
"flask.Flask",
"json.dumps",
"os.path.join",
"os.path.dirname",
"flask_sqlalchemy.SQLAlchemy"
] | [((396, 411), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (401, 411), False, 'from flask import Flask, render_template, request, url_for, redirect\n'), ((570, 585), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (580, 585), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((5... |
from .common import (BaseAccount, get_fallback_private_key,
get_verification_buffer, get_public_key)
from eth_account.messages import encode_defunct
from eth_account import Account
class ETHAccount(BaseAccount):
CHAIN = "ETH"
CURVE = "secp256k1"
def __init__(self, private_key=Non... | [
"eth_account.Account.from_key"
] | [((387, 421), 'eth_account.Account.from_key', 'Account.from_key', (['self.private_key'], {}), '(self.private_key)\n', (403, 421), False, 'from eth_account import Account\n')] |
#-*-coding:utf-8-*-
"""
@author: hjx
评测算法性能
"""
from algorithms import usercf
from algorithms import itemcf
from algorithms import useriif
from algorithms import itemiuf
from util import user_book_reader
from util import evaluation
import time
#usercf 将数据分成8份,选取不同的k值进行8次实验,避免过拟合
recall = 0
precision = 0
coverage... | [
"util.evaluation.popularity",
"util.evaluation.recall",
"util.evaluation.precision",
"util.evaluation.coverage",
"algorithms.itemcf.ItemCF",
"algorithms.itemiuf.ItemIUF",
"algorithms.usercf.UserCF",
"algorithms.useriif.UserIIF",
"util.user_book_reader.read_rating_data"
] | [((408, 446), 'util.user_book_reader.read_rating_data', 'user_book_reader.read_rating_data', ([], {'k': 'k'}), '(k=k)\n', (441, 446), False, 'from util import user_book_reader\n'), ((541, 564), 'algorithms.usercf.UserCF', 'usercf.UserCF', (['trainset'], {}), '(trainset)\n', (554, 564), False, 'from algorithms import us... |
'''The main interface for using the `rpa_logger` package.
This module contains the `rpa_logger.logger.Logger` class and default
functions it uses for its callback parameters.
'''
from sys import stdout
from textwrap import indent
from threading import Event, Thread
from typing import Callable, Hashable, Tuple, TextIO... | [
"threading.Event",
"threading.Thread",
"textwrap.indent"
] | [((4202, 4209), 'threading.Event', 'Event', ([], {}), '()\n', (4207, 4209), False, 'from threading import Event, Thread\n'), ((6064, 6190), 'threading.Thread', 'Thread', ([], {'target': 'print_spinner_and_text', 'args': '[text, self._spinner_stop_event, self.options.target, self.options.ascii_only]'}), '(target=print_s... |
"""Tests for `exercise` package."""
import pytest
from exercise import linker
LINKS_TO_CHECK = [
('https://github.com', [
'#home-community',
'https://www.facebook.com/GitHub',
]),
('https://www.esmvaltool.org/gallery.html', [
'https://docs.esmvaltool.org/en/latest/recipes/recipe_p... | [
"exercise.linker.get_http_links",
"pytest.mark.parametrize",
"exercise.linker.get_links",
"exercise.linker.get_ftp_links"
] | [((558, 618), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('url', 'expected')", 'LINKS_TO_CHECK'], {}), "(('url', 'expected'), LINKS_TO_CHECK)\n", (581, 618), False, 'import pytest\n'), ((764, 824), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('url', 'expected')", 'LINKS_TO_CHECK'], {}), "(('u... |
import dataclasses
import pathlib
import torch
BASE_DIR = pathlib.Path(__file__).parent.parent.absolute()
@dataclasses.dataclass
class ProjectPaths:
data_dir = BASE_DIR.joinpath('data')
checkpoints_dir = BASE_DIR.joinpath('model_checkpoints')
@dataclasses.dataclass
class Config:
random_seed = 7462294
... | [
"pathlib.Path",
"torch.device"
] | [((412, 432), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (424, 432), False, 'import torch\n'), ((60, 82), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (72, 82), False, 'import pathlib\n')] |
from django.core.management.base import CommandError
from django.conf import settings
from dimagi.utils.parsing import json_format_datetime
from corehq.apps.reminders.models import CaseReminderHandler, CaseReminder
from corehq.apps.reminders.tasks import fire_reminder
from hqscripts.generic_queue import GenericEnqueuin... | [
"corehq.apps.reminders.models.CaseReminder.view",
"corehq.apps.reminders.tasks.fire_reminder.delay",
"dimagi.utils.parsing.json_format_datetime"
] | [((677, 705), 'dimagi.utils.parsing.json_format_datetime', 'json_format_datetime', (['utcnow'], {}), '(utcnow)\n', (697, 705), False, 'from dimagi.utils.parsing import json_format_datetime\n'), ((1069, 1093), 'corehq.apps.reminders.tasks.fire_reminder.delay', 'fire_reminder.delay', (['_id'], {}), '(_id)\n', (1088, 1093... |
# Copyright 2017 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 datetime import datetime
import mock
from common.waterfall import failure_type
from dto.dict_of_basestring import DictOfBasestring
from libs import tim... | [
"datetime.datetime",
"services.parameters.FailureToCulpritMap.FromSerializable",
"model.wf_suspected_cl.WfSuspectedCL.Create",
"dto.dict_of_basestring.DictOfBasestring",
"services.parameters.BuildKey",
"mock.patch.object",
"services.test_failure.test_culprit_action.GetCulpritsShouldTakeActions",
"serv... | [((2116, 2189), 'mock.patch.object', 'mock.patch.object', (['waterfall_config', '"""GetActionSettings"""'], {'return_value': '{}'}), "(waterfall_config, 'GetActionSettings', return_value={})\n", (2133, 2189), False, 'import mock\n'), ((2332, 2428), 'mock.patch.object', 'mock.patch.object', (['test_culprit_action', '"""... |
"""Sentiment analysis section"""
from extractor import filter_documents
from collections import Counter
import matplotlib.pyplot as mplt
def get_words(pos=True):
f_name = "positive.txt" if pos else "negative.txt"
words = []
with open(("swen/core/sentiment/" + f_name)) as fp:
for line in fp.readli... | [
"matplotlib.pyplot.plot",
"extractor.filter_documents",
"matplotlib.pyplot.show"
] | [((629, 690), 'extractor.filter_documents', 'filter_documents', (['sentence'], {'sort': "[{'date': {'order': 'asc'}}]"}), "(sentence, sort=[{'date': {'order': 'asc'}}])\n", (645, 690), False, 'from extractor import filter_documents\n'), ((1331, 1354), 'matplotlib.pyplot.plot', 'mplt.plot', (['x', 'sentiment'], {}), '(x... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.StationDetailInfo import StationDetailInfo
class AlipayCommerceCityfacilitatorStationQueryResponse(AlipayResponse):
def __init__(self):
sup... | [
"alipay.aop.api.domain.StationDetailInfo.StationDetailInfo.from_alipay_dict"
] | [((853, 890), 'alipay.aop.api.domain.StationDetailInfo.StationDetailInfo.from_alipay_dict', 'StationDetailInfo.from_alipay_dict', (['i'], {}), '(i)\n', (887, 890), False, 'from alipay.aop.api.domain.StationDetailInfo import StationDetailInfo\n')] |
import yaml
import pytest
from unittest import mock
import kubernetes
from kubernetes.config.config_exception import ConfigException
from mlflow.projects import kubernetes as kb
from mlflow.exceptions import ExecutionException
from mlflow.entities import RunStatus
def test_run_command_creation(): # pylint: disable... | [
"kubernetes.config.config_exception.ConfigException",
"unittest.mock.Mock",
"mlflow.projects.kubernetes.run_kubernetes_job",
"kubernetes.client.models.V1JobCondition",
"unittest.mock.MagicMock",
"mlflow.projects.kubernetes._get_run_command",
"kubernetes.client.models.V1JobStatus",
"kubernetes.client.m... | [((537, 565), 'mlflow.projects.kubernetes._get_run_command', 'kb._get_run_command', (['command'], {}), '(command)\n', (556, 565), True, 'from mlflow.projects import kubernetes as kb\n'), ((950, 1299), 'yaml.safe_load', 'yaml.safe_load', (['"""apiVersion: batch/v1\nkind: Job\nmetadata:\n name: pi-with-ttl\nspec:\n ttl... |
from django.db import models
from django.contrib.auth.models import User
from django.contrib import admin
class Profile(models.Model):
user = models.OneToOneField(User)
created_at = models.DateTimeField(auto_now_add=True)
modified_at = models.DateTimeField(auto_now=True)
handle = models.CharField(max_... | [
"django.db.models.OneToOneField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.contrib.admin.site.register",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((1032, 1060), 'django.contrib.admin.site.register', 'admin.site.register', (['Profile'], {}), '(Profile)\n', (1051, 1060), False, 'from django.contrib import admin\n'), ((1061, 1089), 'django.contrib.admin.site.register', 'admin.site.register', (['Payment'], {}), '(Payment)\n', (1080, 1089), False, 'from django.contr... |
import argparse
import os
import windows
import windows.debug.symbols as symbols
parser = argparse.ArgumentParser(prog=__file__, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('pattern')
parser.add_argument('file', help="The PE file to load")
parser.add_argument('--addr', type=lambda x: ... | [
"windows.debug.symbols.VirtualSymbolHandler",
"argparse.ArgumentParser",
"windows.debug.symbols.set_dbghelp_path"
] | [((93, 192), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '__file__', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(prog=__file__, formatter_class=argparse.\n ArgumentDefaultsHelpFormatter)\n', (116, 192), False, 'import argparse\n'), ((787, 817), 'windows.debug.symbols.Virt... |
# -*- coding: utf-8 -*-
import unittest
from .. import distributions
from scipy.integrate import quad
import numpy as np
import scipy.stats
class test_distributions(unittest.TestCase):
def _check_pdfintegral(self, integral, integrale, theory):
integrale = max(integrale, 1e-5)
limits = integral ... | [
"unittest.TestSuite",
"scipy.integrate.quad",
"numpy.array",
"numpy.linspace",
"sys.exit",
"unittest.TextTestRunner",
"matplotlib.pyplot.show"
] | [((2506, 2526), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (2524, 2526), False, 'import unittest\n'), ((2687, 2712), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (2710, 2712), False, 'import unittest\n'), ((458, 474), 'scipy.integrate.quad', 'quad', (['func', 'a', 'b'], {})... |
#Exercício: Ler uma imagem, converter em escala de cinza,
# utilizando a seguinte fórmula:
# Gr = R*0,25 + G*0,65 + B*0,1
#ler o seu histograma e verificar qual o nível de cor
# possui maior intensidade na imagem. Imprima o histograma.
# A partir da imagem do histograma, identifique um limiar
# para fazer a limiarizaçã... | [
"cv2.calcHist",
"cv2.threshold",
"matplotlib.pyplot.plot",
"numpy.argmax",
"cv2.imshow",
"numpy.zeros",
"cv2.waitKey",
"matplotlib.pyplot.xlim",
"cv2.imread",
"matplotlib.pyplot.show"
] | [((464, 480), 'cv2.imread', 'cv2.imread', (['path'], {}), '(path)\n', (474, 480), False, 'import cv2\n'), ((502, 534), 'cv2.imshow', 'cv2.imshow', (['"""IMG Original """', 'img'], {}), "('IMG Original ', img)\n", (512, 534), False, 'import cv2\n'), ((559, 585), 'numpy.zeros', 'np.zeros', (['(h, w)', 'np.uint8'], {}), '... |
import numpy as np
from dask import array as da
from typing import Tuple, List, Iterable
import pyqtgraph as pg
import skbeam.core.correlation as corr
from xicam.SAXS.patches.pyFAI import AzimuthalIntegrator
from xicam.core.intents import PlotIntent
from xicam.core import msg
from xicam.plugins.operationplugin import... | [
"xicam.plugins.operationplugin.output_names",
"xicam.plugins.operationplugin.visible",
"numpy.mean",
"xicam.plugins.operationplugin.intent",
"numpy.flipud",
"xicam.core.msg.notifyMessage",
"numpy.min",
"xicam.plugins.operationplugin.display_name",
"xicam.plugins.operationplugin.input_names",
"xica... | [((514, 548), 'xicam.plugins.operationplugin.display_name', 'display_name', (['"""1-time Correlation"""'], {}), "('1-time Correlation')\n", (526, 548), False, 'from xicam.plugins.operationplugin import operation, describe_input, describe_output, visible, input_names, output_names, display_name, categories, intent\n'), ... |
from __future__ import print_function
import os
import sys
import time
import traceback
from unittest import TestResult, TextTestResult
from unittest.result import failfast
from jinja2 import Template
DEFAULT_TEMPLATE = os.path.join(os.path.dirname(__file__), "template", "report_template.html")
def load_template(t... | [
"os.path.exists",
"os.makedirs",
"sys.stderr.getvalue",
"os.path.join",
"traceback.format_exception",
"unittest.TestResult.startTest",
"jinja2.Template",
"os.path.dirname",
"unittest.TextTestResult.stopTest",
"unittest.TextTestResult.__init__",
"sys.stdout.getvalue",
"time.time",
"os.path.re... | [((236, 261), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (251, 261), False, 'import os\n'), ((950, 973), 'jinja2.Template', 'Template', (['template_file'], {}), '(template_file)\n', (958, 973), False, 'from jinja2 import Template\n'), ((4020, 4082), 'unittest.TextTestResult.__init__', 'Te... |
import random
import string
letters = list(string.ascii_letters)
numbers = list(string.digits)
symbols = list(string.punctuation)
# Greeting and ask how many digit they want for their password.
print("Welcome to password generator!")
# Check if input is digit and valid number (valid: total_digit > 0).
total_digit =... | [
"random.choice",
"random.shuffle"
] | [((3182, 3211), 'random.shuffle', 'random.shuffle', (['password_list'], {}), '(password_list)\n', (3196, 3211), False, 'import random\n'), ((2982, 3004), 'random.choice', 'random.choice', (['letters'], {}), '(letters)\n', (2995, 3004), False, 'import random\n'), ((3073, 3095), 'random.choice', 'random.choice', (['numbe... |
from django.test import TestCase
from wagtail.tests.utils import WagtailTestUtils
from wagtail.wagtailcore.models import Page
from wagtail.wagtailadmin.tasks import send_email_task
from django.core.urlresolvers import reverse
from django.core import mail
class TestHome(TestCase, WagtailTestUtils):
def setUp(self)... | [
"wagtail.wagtailadmin.tasks.send_email_task",
"wagtail.wagtailcore.models.Page.objects.get",
"django.core.urlresolvers.reverse"
] | [((602, 624), 'wagtail.wagtailcore.models.Page.objects.get', 'Page.objects.get', ([], {'id': '(2)'}), '(id=2)\n', (618, 624), False, 'from wagtail.wagtailcore.models import Page\n'), ((1514, 1585), 'wagtail.wagtailadmin.tasks.send_email_task', 'send_email_task', (['"""Test subject"""', '"""Test content"""', "['<EMAIL>'... |
import setuptools
import re
import os.path
# get version from top level __init__ file
VERSION_RE = re.compile('^__version__ = "(.+)"$', flags=re.MULTILINE)
with open(os.path.join(os.path.dirname(__file__), "recurly", "__init__.py")) as PACKAGE:
VERSION = VERSION_RE.search(PACKAGE.read()).group(1)
with open("READM... | [
"setuptools.find_packages",
"re.compile"
] | [((100, 156), 're.compile', 're.compile', (['"""^__version__ = "(.+)"$"""'], {'flags': 're.MULTILINE'}), '(\'^__version__ = "(.+)"$\', flags=re.MULTILINE)\n', (110, 156), False, 'import re\n'), ((733, 759), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (757, 759), False, 'import setuptools\n... |
from math import ceil
from docx import Document
from docx.enum.table import WD_ROW_HEIGHT_RULE, WD_TABLE_ALIGNMENT, WD_ALIGN_VERTICAL
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.shared import Cm, Pt, Length
from docx.table import Table
import argparse
def setup_margins(doc: Document, margin: float):
s... | [
"math.ceil",
"docx.shared.Pt",
"argparse.ArgumentParser",
"docx.shared.Cm",
"docx.Document"
] | [((1210, 1222), 'docx.shared.Pt', 'Pt', (['fontsize'], {}), '(fontsize)\n', (1212, 1222), False, 'from docx.shared import Cm, Pt, Length\n'), ((1395, 1407), 'docx.shared.Pt', 'Pt', (['fontsize'], {}), '(fontsize)\n', (1397, 1407), False, 'from docx.shared import Cm, Pt, Length\n'), ((1463, 1548), 'argparse.ArgumentPars... |
"""
2D–3D Geometric Fusion network using Multi-Neighbourhood Graph Convolution for RGB-D indoor scene classification
2021 <NAME> <<EMAIL>>
"""
import torch
import os
import argparse
from tqdm import tqdm
import twostream_network as models
from pc_img_h5_dataset import PCIMGH5Dataset, custom_collate
from Fus... | [
"Fusion2D3DMUNEGC.utilities.utils.read_string_list",
"argparse.ArgumentParser",
"Fusion2D3DMUNEGC.utilities.metrics.ConfusionMatrixMeter",
"tqdm.tqdm",
"os.path.join",
"os.path.isfile",
"pc_img_h5_dataset.PCIMGH5Dataset",
"torch.utils.data.DataLoader",
"Fusion2D3DMUNEGC.utilities.utils.load_checkpoi... | [((407, 422), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (420, 422), False, 'import torch\n'), ((502, 525), 'tqdm.tqdm', 'tqdm', (['loader'], {'ncols': '(100)'}), '(loader, ncols=100)\n', (506, 525), False, 'from tqdm import tqdm\n'), ((535, 590), 'Fusion2D3DMUNEGC.utilities.metrics.ConfusionMatrixMeter', 'met... |
# Author: <NAME> <<EMAIL>>
# My imports
from . import constants
# Regular imports
from datetime import datetime
from copy import deepcopy
from scipy import signal
import numpy as np
import warnings
import librosa
import random
import torch
# TODO - torch Tensor compatibility
# TODO - try to ensure these won't brea... | [
"scipy.signal.convolve",
"librosa.midi_to_hz",
"torch.from_numpy",
"numpy.argsort",
"numpy.array",
"librosa.util.pad_center",
"copy.deepcopy",
"librosa.hz_to_midi",
"numpy.arange",
"numpy.mean",
"numpy.savez",
"numpy.reshape",
"numpy.where",
"numpy.sort",
"numpy.diff",
"numpy.max",
"... | [((1234, 1250), 'numpy.empty', 'np.empty', (['[0, 3]'], {}), '([0, 3])\n', (1242, 1250), True, 'import numpy as np\n'), ((2053, 2094), 'librosa.midi_to_hz', 'librosa.midi_to_hz', (['batched_notes[..., 2]'], {}), '(batched_notes[..., 2])\n', (2071, 2094), False, 'import librosa\n'), ((2583, 2624), 'librosa.hz_to_midi', ... |
# Copyright 2010-2017 Google
# 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, so... | [
"ortools.constraint_solver.pywrapcp.Solver"
] | [((1158, 1189), 'ortools.constraint_solver.pywrapcp.Solver', 'pywrapcp.Solver', (['"""jobshop ft06"""'], {}), "('jobshop ft06')\n", (1173, 1189), False, 'from ortools.constraint_solver import pywrapcp\n')] |
#!/usr/bin/env python3
import sys
def check(tree, weights, root):
if not tree[root]: return weights[root]
kids_weights = [check(tree, weights, k) for k in tree[root]]
right = kids_weights[0]
if not all(w == right for w in kids_weights):
# For my original version I didn't actually solve the pr... | [
"sys.exit"
] | [((888, 899), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (896, 899), False, 'import sys\n')] |
#
# Copyright (C) BlueWave Studio - All Rights Reserved
#
import threading
import common.Api_pb2 as oap_api
from common.Client import Client, ClientEventHandler
class EventHandler(ClientEventHandler):
def __init__(self):
self._id = 0
self._transient = False
self._timer = None
def o... | [
"common.Api_pb2.AudioFocusChangeRequest",
"common.Client.Client",
"threading.Timer",
"common.Api_pb2.UnregisterAudioFocusReceiver",
"common.Api_pb2.RegisterAudioFocusReceiverRequest"
] | [((2412, 2443), 'common.Client.Client', 'Client', (['"""audio focus transient"""'], {}), "('audio focus transient')\n", (2418, 2443), False, 'from common.Client import Client, ClientEventHandler\n'), ((700, 743), 'common.Api_pb2.RegisterAudioFocusReceiverRequest', 'oap_api.RegisterAudioFocusReceiverRequest', ([], {}), ... |
# -*- coding: utf-8 -*-
import logging
from flask import request
from flask_restful import Resource
from werkzeug.exceptions import BadRequest
from server import api
from server.exceptions import HTTPBadRequest
from server.models import Users, Products
logger = logging.getLogger(__name__)
def _is_valid_user(user_... | [
"logging.getLogger",
"flask.request.args.get",
"server.exceptions.HTTPBadRequest",
"server.models.Products.get",
"server.models.Users.get",
"flask.request.get_json",
"server.api.url_for"
] | [((266, 293), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (283, 293), False, 'import logging\n'), ((536, 554), 'server.models.Users.get', 'Users.get', (['user_id'], {}), '(user_id)\n', (545, 554), False, 'from server.models import Users, Products\n'), ((1288, 1306), 'server.models.User... |
import json
from six import StringIO
import requests
def post(url, repo_token, service_job_id, service_name, git, source_files, parallel):
json_file = build_file(repo_token, service_job_id, service_name, git, source_files, parallel)
return requests.post(url, files={'json_file': json_file})
def build_file(re... | [
"json.dumps",
"requests.post"
] | [((250, 300), 'requests.post', 'requests.post', (['url'], {'files': "{'json_file': json_file}"}), "(url, files={'json_file': json_file})\n", (263, 300), False, 'import requests\n'), ((684, 703), 'json.dumps', 'json.dumps', (['content'], {}), '(content)\n', (694, 703), False, 'import json\n')] |
import numpy as np
def integrand_sin(x):
return x**2 * np.sin(x)
def simpson(f, a, b, nstrips):
x, dx = np.linspace(a, b, num=2*nstrips+1, endpoint=True, retstep=True)
return dx / 3 * (f(x[0]) + f(x[-1]) + 4 * np.sum(f(x[1:-1:2])) + 2 * np.sum(f(x[2:-1:2])))
nstrips_all = 10 * 2**np.arange(8)
dx = 1 / ns... | [
"numpy.sin",
"numpy.linspace",
"numpy.cos",
"numpy.arange"
] | [((114, 181), 'numpy.linspace', 'np.linspace', (['a', 'b'], {'num': '(2 * nstrips + 1)', 'endpoint': '(True)', 'retstep': '(True)'}), '(a, b, num=2 * nstrips + 1, endpoint=True, retstep=True)\n', (125, 181), True, 'import numpy as np\n'), ((60, 69), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (66, 69), True, 'import n... |
import pandas as pd
# Read in the data
hockey_players = pd.read_csv('data/canucks.csv')
# Find the column names of hockey_players
# Save it as columns_hockey
____
# Display it by writing the object name
____
| [
"pandas.read_csv"
] | [((58, 89), 'pandas.read_csv', 'pd.read_csv', (['"""data/canucks.csv"""'], {}), "('data/canucks.csv')\n", (69, 89), True, 'import pandas as pd\n')] |
"""
Tests for domain helpers.
"""
# pylint: disable=missing-docstring
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import numpy.testing as nt
import scipy.optimize as spop
import copy
import reggie.core.domains as domains
### BASE ... | [
"numpy.testing.assert_allclose",
"reggie.core.domains.Log",
"numpy.array",
"copy.deepcopy",
"copy.copy",
"scipy.optimize.approx_fprime",
"reggie.core.domains.Identity"
] | [((660, 685), 'copy.copy', 'copy.copy', (['self.transform'], {}), '(self.transform)\n', (669, 685), False, 'import copy\n'), ((699, 728), 'copy.deepcopy', 'copy.deepcopy', (['self.transform'], {}), '(self.transform)\n', (712, 728), False, 'import copy\n'), ((811, 832), 'numpy.array', 'np.array', (['self.bounds'], {}), ... |
import requests
def hello():
response = requests.get('https://api.github.com')
print(response.status_code)
| [
"requests.get"
] | [((46, 84), 'requests.get', 'requests.get', (['"""https://api.github.com"""'], {}), "('https://api.github.com')\n", (58, 84), False, 'import requests\n')] |
"""Test Modem Caller ID config flow."""
from unittest.mock import AsyncMock, MagicMock, patch
import phone_modem
import serial.tools.list_ports
from homeassistant.components import usb
from homeassistant.components.modem_callerid.const import DOMAIN
from homeassistant.config_entries import SOURCE_USB, SOURCE_USER
fro... | [
"homeassistant.components.usb.human_readable_device_name",
"unittest.mock.MagicMock",
"unittest.mock.patch",
"unittest.mock.AsyncMock"
] | [((803, 892), 'unittest.mock.patch', 'patch', (['"""homeassistant.components.modem_callerid.async_setup_entry"""'], {'return_value': '(True)'}), "('homeassistant.components.modem_callerid.async_setup_entry',\n return_value=True)\n", (808, 892), False, 'from unittest.mock import AsyncMock, MagicMock, patch\n'), ((280... |
"""
Authors: <NAME>, <NAME>, <NAME>
"""
import numpy as np
import scipy.stats as spst
import scipy.linalg as la
class LQFilter:
def __init__(self, d, h, y_m, r=None, h_eps=None, β=None):
"""
Parameters
----------
d : list or numpy.array (1-D or a 2-D column vector)
... | [
"scipy.linalg.lu",
"numpy.eye",
"numpy.linalg.solve",
"numpy.prod",
"numpy.asarray",
"numpy.roots",
"numpy.diag",
"scipy.linalg.cholesky",
"numpy.zeros",
"numpy.vstack",
"numpy.poly1d",
"scipy.linalg.inv",
"numpy.arange"
] | [((983, 996), 'numpy.asarray', 'np.asarray', (['d'], {}), '(d)\n', (993, 996), True, 'import numpy as np\n'), ((1054, 1069), 'numpy.asarray', 'np.asarray', (['y_m'], {}), '(y_m)\n', (1064, 1069), True, 'import numpy as np\n'), ((1417, 1441), 'numpy.zeros', 'np.zeros', (['(2 * self.m + 1)'], {}), '(2 * self.m + 1)\n', (... |
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from ..layers.LayerSandPileReservoir import LayerSandPileReservoir
from ..layers.LayerLinearRegression import LayerLinearRegression
from .LayeredModel import LayeredModel
class SandPileModel(LayeredModel):
def __init__(self, input_size, ou... | [
"numpy.shape",
"matplotlib.pyplot.plot",
"seaborn.heatmap"
] | [((2025, 2051), 'seaborn.heatmap', 'sns.heatmap', (['signals_shape'], {}), '(signals_shape)\n', (2036, 2051), True, 'import seaborn as sns\n'), ((2061, 2071), 'matplotlib.pyplot.plot', 'plt.plot', ([], {}), '()\n', (2069, 2071), True, 'import matplotlib.pyplot as plt\n'), ((1947, 1964), 'numpy.shape', 'np.shape', (['si... |
# Online learning of a 2d binary logistic regression model p(y=1|x,w) = sigmoid(w'x),
# using the Exponential-family Extended Kalman Filter (EEKF) algorithm
# described in "Online natural gradient as a Kalman filter", <NAME>, 2018.
# https://projecteuclid.org/euclid.ejs/1537257630.
# The latent state corresponds to th... | [
"jax.numpy.zeros",
"jax.random.PRNGKey",
"jax.random.multivariate_normal",
"jax.numpy.eye",
"matplotlib.pyplot.show",
"jsl.nlds.base.NLDS",
"jsl.demos.logreg_biclusters.plot_posterior_predictive",
"jax.numpy.diagonal",
"jax.numpy.arange",
"jax.numpy.exp",
"jax.numpy.einsum",
"jsl.nlds.extended... | [((802, 813), 'jsl.demos.logreg_biclusters.main', 'demo.main', ([], {}), '()\n', (811, 813), True, 'from jsl.demos import logreg_biclusters as demo\n'), ((1661, 1673), 'jax.numpy.zeros', 'jnp.zeros', (['M'], {}), '(M)\n', (1670, 1673), True, 'import jax.numpy as jnp\n'), ((1739, 1759), 'jsl.nlds.base.NLDS', 'NLDS', (['... |
# pylint: skip-file
# type: ignore
# -*- coding: utf-8 -*-
#
# tests.analyses.milhdbk217f.models.relay_unit_test.py is part of The RAMSTK
# Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""Test class for the relay module."""
# Thir... | [
"ramstk.analyses.milhdbk217f.relay.get_environment_factor",
"ramstk.analyses.milhdbk217f.relay._set_default_contact_rating",
"ramstk.analyses.milhdbk217f.relay._set_default_quality",
"ramstk.analyses.milhdbk217f.relay.get_part_count_lambda_b",
"ramstk.analyses.milhdbk217f.relay._set_default_contact_form",
... | [((443, 492), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""subcategory_id"""', '[1, 2]'], {}), "('subcategory_id', [1, 2])\n", (466, 492), False, 'import pytest\n'), ((494, 536), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""type_id"""', '[1, 2]'], {}), "('type_id', [1, 2])\n", (517, 536), ... |
import pytest
from scopt.instances import Instance
class TestInstance:
def test_instance(self) -> None:
instance = Instance(4, 32)
assert instance.num_cores == 4
assert instance.memory_size == 32
def test_default_instance(self) -> None:
instance = Instance()
assert in... | [
"scopt.instances.Instance",
"pytest.raises"
] | [((130, 145), 'scopt.instances.Instance', 'Instance', (['(4)', '(32)'], {}), '(4, 32)\n', (138, 145), False, 'from scopt.instances import Instance\n'), ((292, 302), 'scopt.instances.Instance', 'Instance', ([], {}), '()\n', (300, 302), False, 'from scopt.instances import Instance\n'), ((444, 469), 'pytest.raises', 'pyte... |
from Camera import Camera
import cv2
winname = "Tester"
def localCamera():
# read from active local camera 0
camera_settings = [["CAP_PROP_AUTOEXPOSURE",1.0]]
camera_memory = [['deque',100,1]]
camera = Camera("camera",0,camera_settings,camera_memory)
camera.start()
i=0
while Tr... | [
"cv2.moveWindow",
"Camera.Camera",
"cv2.resizeWindow",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.waitKey",
"cv2.namedWindow"
] | [((229, 280), 'Camera.Camera', 'Camera', (['"""camera"""', '(0)', 'camera_settings', 'camera_memory'], {}), "('camera', 0, camera_settings, camera_memory)\n", (235, 280), False, 'from Camera import Camera\n'), ((815, 918), 'Camera.Camera', 'Camera', (['"""file"""', '"""c:\\\\devt\\\\python\\\\videos\\\\senorAndrew2.mp4... |
# -*- coding: utf-8 -*-
# :Project: python-rapidjson -- Packaging
# :Author: <NAME> <<EMAIL>>
# :License: MIT License
# :Copyright: © 2015 <NAME>
# :Copyright: © 2016, 2017, 2018, 2019, 2020, 2021, 2022 Lele Gaifax
#
import os.path
import sys
try:
from setuptools import setup, Extension
try:
# ... | [
"distutils.core.Extension",
"distutils.sysconfig.get_config_vars",
"distutils.sysconfig.get_config_var",
"sys.argv.pop"
] | [((2063, 2094), 'distutils.sysconfig.get_config_var', 'sysconfig.get_config_var', (['"""CXX"""'], {}), "('CXX')\n", (2087, 2094), False, 'from distutils import sysconfig\n'), ((914, 931), 'sys.argv.pop', 'sys.argv.pop', (['idx'], {}), '(idx)\n', (926, 931), False, 'import sys\n'), ((2221, 2254), 'distutils.sysconfig.ge... |
import os
import subprocess
import speech_recognition as sr
from gtts import gTTS
r = sr.Recognizer()
async def stt ( file ):
with sr.AudioFile ( file ) as source:
r.adjust_for_ambient_noise ( source )
audio = r.record ( source )
try:
recognized_text = r.recognize_google ( audio, language = "pt" )
return r... | [
"os.listdir",
"speech_recognition.AudioFile",
"subprocess.run",
"speech_recognition.Recognizer",
"gtts.gTTS",
"os.mkdir",
"os.remove"
] | [((87, 102), 'speech_recognition.Recognizer', 'sr.Recognizer', ([], {}), '()\n', (100, 102), True, 'import speech_recognition as sr\n'), ((792, 813), 'gtts.gTTS', 'gTTS', (['text'], {'lang': '"""pt"""'}), "(text, lang='pt')\n", (796, 813), False, 'from gtts import gTTS\n'), ((1638, 1653), 'os.remove', 'os.remove', (['f... |
# encoding: utf-8
from __future__ import unicode_literals
from textwrap import dedent
# The quick brown fox jumps over the lazy dog
data1 = dedent("""
1\tThe\tthe\tDET\tDT\tDefinite=Def|PronType=Art\t4\tdet\t_\t_
2\tquick\tquick\tADJ\tJJ\tDegree=Pos\t4\tamod\t_\t_
3\tbrown\tbrown\tADJ\tJJ\tDegree=Pos\t4\ta... | [
"textwrap.dedent"
] | [((141, 683), 'textwrap.dedent', 'dedent', (['"""\n 1\tThe\tthe\tDET\tDT\tDefinite=Def|PronType=Art\t4\tdet\t_\t_\n 2\tquick\tquick\tADJ\tJJ\tDegree=Pos\t4\tamod\t_\t_\n 3\tbrown\tbrown\tADJ\tJJ\tDegree=Pos\t4\tamod\t_\t_\n 4\tfox\tfox\tNOUN\tNN\tNumber=Sing\t5\tnsubj\t_\t_\n 5\tjumps\tjump\tVERB\tVBZ\tM... |
"""
Loads historical data and upload it to BQ.
Years Files should be in json and GZIP Format.
This script will do:
1- Locate (devices and messages).
2- Per each device ID will list all the messages ID.
3- Add the device info in the message info and save a NEWLINEJSON.
4- Compress again in a separate folder.
Ex.
pytho... | [
"google.cloud.storage.Client",
"os.path.exists",
"argparse.ArgumentParser",
"pathlib.Path",
"datetime.datetime.strptime",
"os.makedirs",
"gzip.open",
"datetime.date",
"csv.reader",
"datetime.timedelta",
"time.time",
"json.dump",
"re.search"
] | [((1207, 1233), 'google.cloud.storage.Client', 'storage.Client', (['PROJECT_ID'], {}), '(PROJECT_ID)\n', (1221, 1233), False, 'from google.cloud import storage\n'), ((1251, 1291), 're.search', 're.search', (['"""gs://([^/]*)/(.*)"""', 'gcs_path'], {}), "('gs://([^/]*)/(.*)', gcs_path)\n", (1260, 1291), False, 'import a... |
from classic_tetris_project import discord
from classic_tetris_project.env import env
@discord.client.event
async def on_ready():
import csv
from tqdm import tqdm
from classic_tetris_project import discord
from classic_tetris_project.countries import countries
from classic_tetris_project.models im... | [
"csv.DictWriter",
"classic_tetris_project.discord.client.logout",
"classic_tetris_project.models.User.objects.all",
"classic_tetris_project.env.env"
] | [((2009, 2029), 'classic_tetris_project.env.env', 'env', (['"""DISCORD_TOKEN"""'], {}), "('DISCORD_TOKEN')\n", (2012, 2029), False, 'from classic_tetris_project.env import env\n'), ((390, 591), 'csv.DictWriter', 'csv.DictWriter', (['csvfile'], {'fieldnames': "['twitch_id', 'twitch_username', 'discord_id', 'discord_user... |
from rest_framework import viewsets
from rest_framework.generics import get_object_or_404
from rest_framework.response import Response
from .models import Client, MailDrop, MailRecipient
from .serializers import (ClientSerializer, MailDropSerializer,
MailRecipientSerializer)
# class UserView... | [
"rest_framework.response.Response",
"rest_framework.generics.get_object_or_404"
] | [((1272, 1297), 'rest_framework.response.Response', 'Response', (['serializer.data'], {}), '(serializer.data)\n', (1280, 1297), False, 'from rest_framework.response import Response\n'), ((1401, 1435), 'rest_framework.generics.get_object_or_404', 'get_object_or_404', (['queryset'], {'pk': 'pk'}), '(queryset, pk=pk)\n', ... |
import numpy as np
from torch.utils.data import DataLoader, TensorDataset
from torch.utils.data.sampler import SequentialSampler, RandomSampler, SubsetRandomSampler
def split_train_val(train_size, network_input, network_output, batch_size):
'''
Divide the dataset into train/val
Parameters:
- train... | [
"torch.utils.data.sampler.SequentialSampler",
"torch.utils.data.TensorDataset",
"torch.utils.data.DataLoader"
] | [((801, 829), 'torch.utils.data.sampler.SequentialSampler', 'SequentialSampler', (['train_idx'], {}), '(train_idx)\n', (818, 829), False, 'from torch.utils.data.sampler import SequentialSampler, RandomSampler, SubsetRandomSampler\n'), ((848, 874), 'torch.utils.data.sampler.SequentialSampler', 'SequentialSampler', (['va... |
from pylons import session, tmpl_context as c
from strings import message_codes_map
# Show an information message in the web interface.
def ui_info(code=None, message=None, hide_after_ms=None):
uim = UIMessage.info(code=code, message=message, hide_after_ms=hide_after_ms)
c.glob_messages.append(uim)
# Show a ... | [
"pylons.session.save",
"strings.message_codes_map.has_key",
"pylons.tmpl_context.glob_messages.append"
] | [((282, 309), 'pylons.tmpl_context.glob_messages.append', 'c.glob_messages.append', (['uim'], {}), '(uim)\n', (304, 309), True, 'from pylons import session, tmpl_context as c\n'), ((502, 529), 'pylons.tmpl_context.glob_messages.append', 'c.glob_messages.append', (['uim'], {}), '(uim)\n', (524, 529), True, 'from pylons ... |
class OceanScriptError(Exception):
"""The base exception for all oceanscript related errors."""
pass
class ForbiddenSquareError(OceanScriptError):
"""This exception is now deprecated with the addition of numbers."""
def __init__(self):
import warnings
warnings.warn(
"For... | [
"warnings.warn"
] | [((289, 438), 'warnings.warn', 'warnings.warn', (['"""ForbiddenSquareError is no longer used and will be removed in a future release."""'], {'category': 'DeprecationWarning', 'stacklevel': '(3)'}), "(\n 'ForbiddenSquareError is no longer used and will be removed in a future release.'\n , category=DeprecationWarni... |
from pydantic import ValidationError
from pytest import raises
from app.settings import Environment
from tests.conftest import get_test_settings
def test_env_is_set_from_env(monkeypatch):
expected = Environment.PRODUCTION.value
monkeypatch.setenv("ENV", expected)
assert get_test_settings().ENV == expecte... | [
"tests.conftest.get_test_settings",
"pytest.raises"
] | [((456, 479), 'pytest.raises', 'raises', (['ValidationError'], {}), '(ValidationError)\n', (462, 479), False, 'from pytest import raises\n'), ((489, 508), 'tests.conftest.get_test_settings', 'get_test_settings', ([], {}), '()\n', (506, 508), False, 'from tests.conftest import get_test_settings\n'), ((286, 305), 'tests.... |
import datetime
import decimal
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
from unittest.mock import Mock, patch
from fpl.models import (ClassicLeague, HeadToHeadLeague, HeadToHeadMatch, HeadToHeadPerformance, Gamewee... | [
"fpl.models.Manager.objects.get",
"fpl.models.HeadToHeadLeague.objects.get",
"fpl.models.HeadToHeadPayout.objects.all",
"fpl.models.ClassicPayout.objects.all",
"fpl.models.ClassicLeague.objects.create",
"django.urls.reverse",
"fpl.models.ClassicPayout.objects.get",
"fpl.models.HeadToHeadPerformance.ob... | [((1657, 1710), 'unittest.mock.patch', 'patch', (['"""fpl.models.Manager.retrieve_performance_data"""'], {}), "('fpl.models.Manager.retrieve_performance_data')\n", (1662, 1710), False, 'from unittest.mock import Mock, patch\n'), ((1716, 1744), 'unittest.mock.patch', 'patch', (['"""fpl.models.datetime"""'], {}), "('fpl.... |
#!/usr/bin/python
from bogoSort import bogoSort
from bubbleSort import bubbleSort
from cocktailShakerSort import cocktailShakerSort
from combSort import combSort
from gnomeSort import gnomeSort
from insertionSort import insertionSort
from utils import randomSequence
import sys
args = sys.argv[1:]
for target in args... | [
"utils.randomSequence",
"bogoSort.bogoSort"
] | [((548, 571), 'utils.randomSequence', 'randomSequence', (['(0)', '(1000)'], {}), '(0, 1000)\n', (562, 571), False, 'from utils import randomSequence\n'), ((375, 395), 'utils.randomSequence', 'randomSequence', (['(0)', '(5)'], {}), '(0, 5)\n', (389, 395), False, 'from utils import randomSequence\n'), ((445, 468), 'bogoS... |
#!/usr/bin/env python3
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
"""A script to replace deprecated uses of `globs`, `rglobs`, and `zglobs` in BUILD files with a
direct list of files and globs.
Run `python3 fix_deprecated_globs_us... | [
"logging.basicConfig",
"argparse.ArgumentParser",
"logging.warning",
"re.match",
"functools.partial",
"ast.parse"
] | [((1543, 1652), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Modernize BUILD files to no longer use globs, rglobs, and zglobs."""'}), "(description=\n 'Modernize BUILD files to no longer use globs, rglobs, and zglobs.')\n", (1566, 1652), False, 'import argparse\n'), ((13444, 13502),... |
from mock import Mock, PropertyMock, patch
from patroni.postgresql import Postgresql
from patroni.postgresql.cancellable import CancellableSubprocess
from patroni.postgresql.rewind import Rewind
from . import BaseTestPostgresql, MockCursor, psycopg2_connect
@patch('subprocess.call', Mock(return_value=0))
@patch('ps... | [
"mock.patch",
"mock.Mock",
"mock.patch.object",
"patroni.postgresql.rewind.Rewind",
"mock.PropertyMock"
] | [((311, 354), 'mock.patch', 'patch', (['"""psycopg2.connect"""', 'psycopg2_connect'], {}), "('psycopg2.connect', psycopg2_connect)\n", (316, 354), False, 'from mock import Mock, PropertyMock, patch\n'), ((994, 1037), 'mock.patch.object', 'patch.object', (['CancellableSubprocess', '"""call"""'], {}), "(CancellableSubpro... |
from __future__ import absolute_import, division, print_function
import numpy as np
from simdna.util import DEFAULT_LETTER_TO_INDEX
from simdna import util
import math
class PWM(object):
def __init__(self, name, letterToIndex=DEFAULT_LETTER_TO_INDEX):
self.name = name
self.letterToIndex = letterT... | [
"numpy.array",
"numpy.log",
"simdna.util.sampleFromProbsArr",
"numpy.argmax"
] | [((941, 961), 'numpy.array', 'np.array', (['self._rows'], {}), '(self._rows)\n', (949, 961), True, 'import numpy as np\n'), ((1182, 1200), 'numpy.log', 'np.log', (['self._rows'], {}), '(self._rows)\n', (1188, 1200), True, 'import numpy as np\n'), ((1969, 1997), 'simdna.util.sampleFromProbsArr', 'util.sampleFromProbsArr... |
import datetime
import itertools
import json
from typing import Iterable, Tuple
def human_readable_size(size, decimal_places=1):
"""
Convert size in bytes to human readable size.
:param size: Size in bytes
:param decimal_places: Number of decimal places
:return: Human readable size
"""
fo... | [
"itertools.islice",
"json.dumps",
"datetime.datetime.fromtimestamp"
] | [((1116, 1131), 'json.dumps', 'json.dumps', (['obj'], {}), '(obj)\n', (1126, 1131), False, 'import json\n'), ((795, 847), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['unix_time', 'timezone'], {}), '(unix_time, timezone)\n', (826, 847), False, 'import datetime\n'), ((1488, 1514), 'itertools.i... |
# Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/)
#
# 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 appli... | [
"luigi.run",
"luigi.LocalTarget",
"luigi.util.inherits"
] | [((816, 841), 'luigi.util.inherits', 'inherits', (['DefaultPipeline'], {}), '(DefaultPipeline)\n', (824, 841), False, 'from luigi.util import inherits\n'), ((1379, 1390), 'luigi.run', 'luigi.run', ([], {}), '()\n', (1388, 1390), False, 'import luigi\n'), ((932, 962), 'luigi.LocalTarget', 'luigi.LocalTarget', (['"""./tm... |
import os.path as op
import sys
_CANONICAL_YAML_FNAME = op.join(op.dirname(__file__), 'data', 'canonical.yml')
_EXCLUDED_KEYS = (
# Should be defined per machine
'sws_dir',
'sws_ssh',
'sws_port',
# methods
'freeze',
'unfreeze',
'convert_subjects',
'save',
# Properties
'repo... | [
"os.path.dirname",
"yaml.load",
"yaml.dump"
] | [((65, 85), 'os.path.dirname', 'op.dirname', (['__file__'], {}), '(__file__)\n', (75, 85), True, 'import os.path as op\n'), ((1674, 1712), 'yaml.load', 'yaml.load', (['fid'], {'Loader': 'yaml.SafeLoader'}), '(fid, Loader=yaml.SafeLoader)\n', (1683, 1712), False, 'import yaml\n'), ((2334, 2420), 'yaml.dump', 'yaml.dump'... |
from unittest.case import TestCase
import unittest
import pandas as pd
import numpy as np
from datetime import datetime
from qlib import init
from qlib.config import C
from qlib.log import TimeInspector
from qlib.utils.time import cal_sam_minute as cal_sam_minute_new, get_min_cal
def cal_sam_minute(x, sam_minutes):
... | [
"datetime.datetime",
"qlib.utils.time.get_min_cal",
"numpy.random.choice",
"pandas.Timedelta",
"qlib.utils.time.cal_sam_minute",
"qlib.log.TimeInspector.logt",
"qlib.init",
"unittest.main"
] | [((3232, 3247), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3245, 3247), False, 'import unittest\n'), ((2048, 2054), 'qlib.init', 'init', ([], {}), '()\n', (2052, 2054), False, 'from qlib import init\n'), ((2172, 2185), 'qlib.utils.time.get_min_cal', 'get_min_cal', ([], {}), '()\n', (2183, 2185), False, 'from ... |
import logging
import vision
from django.contrib.auth.models import User
from django.db import models
from django.utils.timezone import now, timedelta
from django.utils.translation import ugettext_lazy as _
from survey.models import Survey, Video, VideoCategory
from vision.track.interpolation import LinearFill
from p... | [
"survey.models.Video.objects.filter",
"django.db.models.EmailField",
"django.db.models.FloatField",
"django.utils.translation.ugettext_lazy",
"django.db.models.TextField",
"logging.debug",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"pyano2.vatic.qa.tolerable",
"vision.Box",
... | [((486, 541), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'default': '"""Shoplifting"""'}), "(max_length=255, default='Shoplifting')\n", (502, 541), False, 'from django.db import models\n'), ((562, 631), 'django.db.models.ForeignKey', 'models.ForeignKey', (['VideoCategory'], {'on_dele... |
from opac.mailers import HoldingCreatedMailer, MailerError
from opac.queries import QueryError, HoldingCancelQuery
from opac.queries.errors import AlreadyExistsError
from opac.services import \
FirstReservationHoldingAlreadyExistsError, ServiceError
class HoldingCancelService:
"""取置の取り消しを行うサービス。
Paramete... | [
"opac.services.ServiceError",
"opac.services.FirstReservationHoldingAlreadyExistsError",
"opac.queries.HoldingCancelQuery",
"opac.mailers.HoldingCreatedMailer"
] | [((810, 854), 'opac.services.FirstReservationHoldingAlreadyExistsError', 'FirstReservationHoldingAlreadyExistsError', (['e'], {}), '(e)\n', (851, 854), False, 'from opac.services import FirstReservationHoldingAlreadyExistsError, ServiceError\n'), ((920, 935), 'opac.services.ServiceError', 'ServiceError', (['e'], {}), '... |
import numpy as np
import cv2,os
cam=cv2.VideoCapture(0)
face_cascade=cv2.CascadeClassifier("haarcascade_frontalface_alt.xml")
face_data=[]
path="./data/"
if not os.path.exists(path):
os.mkdir(path)
file_name=input("Enter the name")
cnt=0
while True:
ret,frame=cam.read()
if ret==False:
break
faces=face_cascade.de... | [
"cv2.rectangle",
"os.path.exists",
"numpy.asarray",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"os.mkdir",
"cv2.CascadeClassifier",
"cv2.resize",
"cv2.waitKey",
"numpy.save"
] | [((37, 56), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (53, 56), False, 'import cv2, os\n'), ((70, 126), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haarcascade_frontalface_alt.xml"""'], {}), "('haarcascade_frontalface_alt.xml')\n", (91, 126), False, 'import cv2, os\n'), ((798, 819), 'n... |
#! /usr/bin/env python
"""
Module for generating an RBF approximation
of temporal dynamics in POD basis space
"""
import numpy as np
import scipy
from scipy.spatial.distance import cdist
from numpy.lib.scimath import sqrt as csqrt
from scipy import interpolate
import pod as pod
import greedy as gdy
import rom as rom... | [
"numpy.prod",
"numpy.linalg.solve",
"numpy.sqrt",
"numpy.amin",
"numpy.power",
"numpy.searchsorted",
"scipy.spatial.distance.cdist",
"numpy.linalg.cond",
"numpy.exp",
"numpy.zeros",
"numpy.empty",
"numpy.nonzero",
"numpy.linalg.norm",
"numpy.amax",
"numpy.arange"
] | [((2977, 3006), 'numpy.zeros', 'np.zeros', (['(nw_total, Nt)', '"""d"""'], {}), "((nw_total, Nt), 'd')\n", (2985, 3006), True, 'import numpy as np\n'), ((4260, 4289), 'numpy.zeros', 'np.zeros', (['(nw_total, Nt)', '"""d"""'], {}), "((nw_total, Nt), 'd')\n", (4268, 4289), True, 'import numpy as np\n'), ((10679, 10712), ... |
from typing import Dict, Union
from urllib.parse import urljoin
from pathlib import Path
from zipfile import ZipFile
from io import BytesIO
import logging
import requests
from ..working_directory import working_directory
from .geography import Geography
from .us import state_to_fips
"""Maps year to congressional di... | [
"logging.debug",
"logging.warning",
"io.BytesIO",
"requests.get",
"urllib.parse.urljoin",
"logging.info"
] | [((2543, 2646), 'logging.info', 'logging.info', (['"""Not using chached directory. Downloading shapefile from: {url}; to: {save_to}"""'], {}), "(\n 'Not using chached directory. Downloading shapefile from: {url}; to: {save_to}'\n )\n", (2555, 2646), False, 'import logging\n'), ((2671, 2701), 'requests.get', 'requ... |
# Generated by Django 3.2.7 on 2021-10-11 19:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('order', '0006_auto_20211007_2343'),
]
operations = [
migrations.AddField(
model_name='order',
name='total_price_with... | [
"django.db.models.PositiveIntegerField"
] | [((350, 436), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'null': '(True)', 'verbose_name': '"""total_price_with_discount """'}), "(null=True, verbose_name=\n 'total_price_with_discount ')\n", (377, 436), False, 'from django.db import migrations, models\n')] |
from Models.SoftmaxPredictor import SoftmaxPredictor
from TrainingData.data_sets.save_load_data import load_bimodal_data_set
from Eval.functions import results_to_disk, write_preds_to_file, plot_2D_embeddings, plot_metric
from Eval.functions import get_f1_and_classification_report
def run():
for training_conditi... | [
"Eval.functions.results_to_disk",
"Eval.functions.get_f1_and_classification_report",
"Models.SoftmaxPredictor.SoftmaxPredictor",
"Eval.functions.plot_metric",
"Eval.functions.write_preds_to_file",
"Eval.functions.plot_2D_embeddings",
"TrainingData.data_sets.save_load_data.load_bimodal_data_set"
] | [((554, 595), 'TrainingData.data_sets.save_load_data.load_bimodal_data_set', 'load_bimodal_data_set', (['training_condition'], {}), '(training_condition)\n', (575, 595), False, 'from TrainingData.data_sets.save_load_data import load_bimodal_data_set\n'), ((683, 778), 'Models.SoftmaxPredictor.SoftmaxPredictor', 'Softmax... |
# harmonypy - A data alignment algorithm.
# Copyright (C) 2018 <NAME>
# 2019 <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, o... | [
"logging.getLogger",
"logging.StreamHandler",
"numpy.log",
"numpy.array_split",
"numpy.array",
"numpy.isfinite",
"numpy.linalg.norm",
"numpy.arange",
"numpy.multiply",
"scipy.cluster.vq.kmeans",
"numpy.repeat",
"numpy.max",
"numpy.exp",
"numpy.dot",
"numpy.random.seed",
"numpy.round",
... | [((864, 894), 'logging.getLogger', 'logging.getLogger', (['"""harmonypy"""'], {}), "('harmonypy')\n", (881, 894), False, 'import logging\n'), ((931, 954), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (952, 954), False, 'import logging\n'), ((994, 1067), 'logging.Formatter', 'logging.Formatter', (... |
from __future__ import absolute_import
from sentry.testutils import APITestCase
from clims.plugins.demo.dnaseq import DemoDnaSeqPlugin
class TaskDefinitionTest(APITestCase):
endpoint = 'clims-api-0-task-definition'
def setUp(self):
self.clean_workflow_engine_state()
self.app.plugins.install_... | [
"clims.plugins.demo.dnaseq.models.ExamplePlate",
"clims.plugins.demo.dnaseq.workflows.sequence.SequenceSimple"
] | [((634, 660), 'clims.plugins.demo.dnaseq.models.ExamplePlate', 'ExamplePlate', ([], {'name': '"""cont1"""'}), "(name='cont1')\n", (646, 660), False, 'from clims.plugins.demo.dnaseq.models import ExamplePlate, ExampleSample\n'), ((840, 856), 'clims.plugins.demo.dnaseq.workflows.sequence.SequenceSimple', 'SequenceSimple'... |
from numbers import Real, Integral
import numpy as np
import openmc.checkvalue as cv
from .angle_energy import AngleEnergy
from .endf import get_cont_record
class NBodyPhaseSpace(AngleEnergy):
"""N-body phase space distribution
Parameters
----------
total_mass : float
Total mass of product p... | [
"openmc.checkvalue.check_greater_than",
"numpy.string_",
"openmc.checkvalue.check_type"
] | [((1479, 1516), 'openmc.checkvalue.check_type', 'cv.check_type', (['name', 'total_mass', 'Real'], {}), '(name, total_mass, Real)\n', (1492, 1516), True, 'import openmc.checkvalue as cv\n'), ((1525, 1569), 'openmc.checkvalue.check_greater_than', 'cv.check_greater_than', (['name', 'total_mass', '(0.0)'], {}), '(name, tot... |
import csv
import matplotlib.pyplot as plt
from numpy import *
from numpy.linalg import *
def print_points(points, title = None):
var_names = ['x', 'y', 'z']
if title is not None:
print('{}:'.format(title))
for i in range(len(points)):
output = ''
for j in range(len(points[i])):... | [
"matplotlib.pyplot.gca",
"csv.reader",
"matplotlib.pyplot.subplots"
] | [((3471, 3485), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (3483, 3485), True, 'import matplotlib.pyplot as plt\n'), ((4210, 4219), 'matplotlib.pyplot.gca', 'plt.gca', ([], {}), '()\n', (4217, 4219), True, 'import matplotlib.pyplot as plt\n'), ((2302, 2401), 'csv.reader', 'csv.reader', (['csvfile']... |
import discord
from discord.ext import commands
class Select(discord.ui.Select):
def __init__(self):
options=[
discord.SelectOption(label="Page 1",description="This is help page 1!"),
discord.SelectOption(label="Page 2",description="This is help page 2!"),
discor... | [
"discord.Colour.dark_gold",
"discord.ext.commands.command",
"discord.SelectOption"
] | [((5094, 5112), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (5110, 5112), False, 'from discord.ext import commands\n'), ((142, 214), 'discord.SelectOption', 'discord.SelectOption', ([], {'label': '"""Page 1"""', 'description': '"""This is help page 1!"""'}), "(label='Page 1', description='This... |
"""
Copyright (c) 2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | [
"os.path.abspath",
"os.path.join"
] | [((1104, 1133), 'os.path.join', 'osp.join', (['root_data_dir', 'name'], {}), '(root_data_dir, name)\n', (1112, 1133), True, 'import os.path as osp\n'), ((734, 755), 'os.path.abspath', 'osp.abspath', (['__file__'], {}), '(__file__)\n', (745, 755), True, 'import os.path as osp\n')] |
from flask_restful import Resource
from flask import request, jsonify, g
from marshmallow import ValidationError
from ..models import Todo , todo_schema, todos_schema, todo_schema_include_items
from ..util import validate_request, jwt_required
class TodoListResource(Resource):
@validate_request
@jwt_required... | [
"flask.request.get_json"
] | [((359, 377), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (375, 377), False, 'from flask import request, jsonify, g\n'), ((1847, 1865), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (1863, 1865), False, 'from flask import request, jsonify, g\n')] |
# -*- coding: utf-8 -*-
"""Test CLR property support."""
import pytest
from Python.Test import PropertyTest
def test_public_instance_property():
"""Test public instance properties."""
ob = PropertyTest()
assert ob.PublicProperty == 0
ob.PublicProperty = 1
assert ob.PublicProperty == 1
with... | [
"System.Collections.Hashtable",
"System.Collections.ICollection",
"Python.Test.PropertyTest",
"pytest.raises"
] | [((201, 215), 'Python.Test.PropertyTest', 'PropertyTest', ([], {}), '()\n', (213, 215), False, 'from Python.Test import PropertyTest\n'), ((476, 490), 'Python.Test.PropertyTest', 'PropertyTest', ([], {}), '()\n', (488, 490), False, 'from Python.Test import PropertyTest\n'), ((1010, 1024), 'Python.Test.PropertyTest', 'P... |
from PIL import Image
import numpy as np
import math
def symmetric_pad_img(origin_img, pad_pixel=100):
origin_img_array = np.array(origin_img)
padded_img_array = np.pad(origin_img_array,
pad_width=((pad_pixel, pad_pixel), (pad_pixel, pad_pixel), (0, 0)),
... | [
"PIL.Image.fromarray",
"PIL.Image.open",
"math.ceil",
"PIL.Image.new",
"numpy.array",
"numpy.pad"
] | [((134, 154), 'numpy.array', 'np.array', (['origin_img'], {}), '(origin_img)\n', (142, 154), True, 'import numpy as np\n'), ((179, 293), 'numpy.pad', 'np.pad', (['origin_img_array'], {'pad_width': '((pad_pixel, pad_pixel), (pad_pixel, pad_pixel), (0, 0))', 'mode': '"""symmetric"""'}), "(origin_img_array, pad_width=((pa... |
import json
from django.contrib.auth import get_user_model
from django.core import serializers
from django.contrib.auth.models import User
from webapp1.models.m_user_profile import Profile
# ------- ------ -------------- -------
# 1 2 3 4
# 1. アプリケーション フォルダー名
# 2. ディレクトリー名
#... | [
"django.contrib.auth.get_user_model",
"json.loads",
"django.contrib.auth.models.User.objects.filter",
"webapp1.models.m_user_profile.Profile.objects.filter",
"django.core.serializers.serialize",
"django.contrib.auth.models.User.objects.all"
] | [((454, 470), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (468, 470), False, 'from django.contrib.auth import get_user_model\n'), ((577, 595), 'django.contrib.auth.models.User.objects.all', 'User.objects.all', ([], {}), '()\n', (593, 595), False, 'from django.contrib.auth.models import Use... |
import sys
import operator
class Program:
def __init__(self, memory):
self._memory = memory.copy()
self._instr_ptr = 0
def run(self, noun, verb):
self._memory[1] = noun
self._memory[2] = verb
while self._memory[self._instr_ptr] != 99:
self._process_instruction()
return self._memory[... | [
"sys.stdin.read"
] | [((1177, 1193), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (1191, 1193), False, 'import sys\n')] |
from pprint import pprint
import psycopg2
import psycopg2.extras
from prettytable import PrettyTable
from .config import get_config
COLUMNS = {
'column_name': 'name',
'data_type': 'type',
'character_maximum_length': 'maxlen',
'is_nullable': 'null',
'numeric_precision': 'prec',
'numeric_precisi... | [
"prettytable.PrettyTable"
] | [((1784, 1797), 'prettytable.PrettyTable', 'PrettyTable', ([], {}), '()\n', (1795, 1797), False, 'from prettytable import PrettyTable\n')] |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from sympy import *
def session2():
a = np.array([1, 2, 3])
b = np.array([4, 5, 6])
c = a + b
print("矩阵加法", c)
d = a - b
print("矩阵减法", d)
e = a * b
print("矩阵乘法", e)
f = np.dot(a, b)
... | [
"sklearn.preprocessing.PolynomialFeatures",
"pandas.read_csv",
"numpy.arange",
"sklearn.model_selection.train_test_split",
"numpy.size",
"matplotlib.pyplot.plot",
"sklearn.datasets.load_boston",
"tushare.get_hist_data",
"sklearn.preprocessing.StandardScaler",
"numpy.array",
"numpy.dot",
"numpy... | [((146, 165), 'numpy.array', 'np.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (154, 165), True, 'import numpy as np\n'), ((174, 193), 'numpy.array', 'np.array', (['[4, 5, 6]'], {}), '([4, 5, 6])\n', (182, 193), True, 'import numpy as np\n'), ((307, 319), 'numpy.dot', 'np.dot', (['a', 'b'], {}), '(a, b)\n', (313, 319),... |
import pytest
import yaml
from datetime import datetime
from app.utility.base_world import BaseWorld
class TestBaseWorld:
default_config = dict(name='main', config={'app.contact.http': '0.0.0.0', 'plugins': ['sandcat', 'stockpile']})
default_yaml = dict(test_dir=1, implant_name='unittesting', test_int=1234... | [
"app.utility.base_world.BaseWorld.walk_file_path",
"app.utility.base_world.BaseWorld.apply_config",
"yaml.dump",
"app.utility.base_world.BaseWorld.get_current_timestamp",
"app.utility.base_world.BaseWorld.strip_yml",
"app.utility.base_world.BaseWorld.get_config",
"app.utility.base_world.BaseWorld.decode... | [((932, 971), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""reset_config"""'], {}), "('reset_config')\n", (955, 971), False, 'import pytest\n'), ((1257, 1296), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""reset_config"""'], {}), "('reset_config')\n", (1280, 1296), False, 'import pytest\n'),... |
from typing import Any, Mapping, Optional
from foundation.exceptions import ValueValidationError
from foundation.value_objects import Color
from marshmallow import ValidationError, fields
class ColorField(fields.String):
def _serialize(self, value: Any, attr: str, obj: Any, **kwargs) -> str:
return getat... | [
"foundation.value_objects.Color",
"marshmallow.ValidationError"
] | [((499, 511), 'foundation.value_objects.Color', 'Color', (['value'], {}), '(value)\n', (504, 511), False, 'from foundation.value_objects import Color\n'), ((337, 344), 'foundation.value_objects.Color', 'Color', ([], {}), '()\n', (342, 344), False, 'from foundation.value_objects import Color\n'), ((576, 607), 'marshmall... |
import pandapower as pp
import pytest
from numpy import array
@pytest.fixture()
def base_net():
net = pp.create_empty_network()
pp.create_bus(net, vn_kv=10)
pp.create_bus(net, vn_kv=10)
pp.create_ext_grid(net, 0)
pp.create_load(net, 1, p_kw=200, controllable=False)
pp.create_line_from_parameter... | [
"pandapower.create_sgen",
"pandapower.create_ext_grid",
"pandapower.create_empty_network",
"pandapower.create_line_from_parameters",
"pandapower.create_load",
"pandapower.runopp",
"pandapower.create_gen",
"pytest.main",
"numpy.array",
"pytest.fixture",
"pandapower.runpp",
"pandapower.create_bu... | [((64, 80), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (78, 80), False, 'import pytest\n'), ((107, 132), 'pandapower.create_empty_network', 'pp.create_empty_network', ([], {}), '()\n', (130, 132), True, 'import pandapower as pp\n'), ((137, 165), 'pandapower.create_bus', 'pp.create_bus', (['net'], {'vn_kv': '... |
#!/usr/bin/env python3
"""
Problem : Majority Element
URL : http://rosalind.info/problems/maj/
Author : <NAME>
"""
import math
import collections
if __name__ == "__main__":
with open("majIn.txt", "r") as infile, open("majOut.txt", "w") as outfile:
res = list()
infile.readline()
for ... | [
"collections.Counter"
] | [((411, 438), 'collections.Counter', 'collections.Counter', (['curLst'], {}), '(curLst)\n', (430, 438), False, 'import collections\n')] |
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
from functools import lru_cache
import cupy as cp
from cupyx.scipy.sparse import csr_matrix as csr_gpu
import itertools
import time
import os
import pickle
import scipy
import random
import correlation_module
import sys
sys.path.insert(0, "../../.... | [
"sys.path.insert",
"pickle.dump",
"numpy.random.rand",
"cupy.random.rand",
"networkx.adjacency_matrix",
"networkx.selfloop_edges",
"networkx.DiGraph",
"networkx.generators.degree_seq.configuration_model",
"numpy.random.pareto",
"numpy.count_nonzero",
"numpy.array",
"scipy.sparse.coo_matrix",
... | [((293, 327), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../../lib"""'], {}), "(0, '../../../lib')\n", (308, 327), False, 'import sys\n'), ((385, 416), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../lib"""'], {}), "(0, '../../lib')\n", (400, 416), False, 'import sys\n'), ((1311, 1336), 'numpy.array... |
from django.db import models
from .item_post import ItemPost
from versatileimagefield.fields import VersatileImageField
# image 업로드 경로 지정
def image_upload_to(instance, imagename):
return 'posts_images/%s/%s/%s' % (instance.post.user.username, instance.post.id, imagename)
class BookImage(models.Model):
po... | [
"versatileimagefield.fields.VersatileImageField",
"django.db.models.PositiveIntegerField",
"django.db.models.ForeignKey"
] | [((325, 354), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""ItemPost"""'], {}), "('ItemPost')\n", (342, 354), False, 'from django.db import models\n'), ((395, 512), 'versatileimagefield.fields.VersatileImageField', 'VersatileImageField', ([], {'upload_to': 'image_upload_to', 'height_field': '"""height"""', ... |
from unittest import TestCase, main, skip
import mesh_client
from requests import HTTPError
class EndpointConnectivityTest(TestCase):
@skip("This test needs N3 connectivity, talks to real endpoints, and is Python 3 only, so don't run it by default")
def test_connectivity(self):
for key, endpoint in li... | [
"unittest.main",
"mesh_client.MeshClient",
"unittest.skip",
"mesh_client.__dict__.items"
] | [((141, 265), 'unittest.skip', 'skip', (['"""This test needs N3 connectivity, talks to real endpoints, and is Python 3 only, so don\'t run it by default"""'], {}), '(\n "This test needs N3 connectivity, talks to real endpoints, and is Python 3 only, so don\'t run it by default"\n )\n', (145, 265), False, 'from un... |
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Configuration(Base):
__tablename__ = "configuration"
id = Column(Integer, primary_key=True)
username = Column(String)
auth_token = Column(String)
class Repository(... | [
"sqlalchemy.Column",
"sqlalchemy.ext.declarative.declarative_base"
] | [((112, 130), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (128, 130), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((205, 238), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (211, 238), False, 'f... |
from setuptools import setup, find_packages
with open('README.md') as fd:
readme = fd.read()
setup(
name="mzmlripper",
version="1.3.1",
author="<NAME>",
author_email="<EMAIL>",
description="Extractor for MS1-MS4 level spectra from mzML file format",
long_description=readme,
long_descri... | [
"setuptools.find_packages"
] | [((419, 434), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (432, 434), False, 'from setuptools import setup, find_packages\n')] |
"""
Tagging related views.
"""
from django.http import Http404
from django.utils.translation import ugettext as _
from django.views.generic.list_detail import object_list
def tagged_object_list(request, queryset_or_model=None, tag_model=None, tags=None,
related_tags=False, related_tag_counts=True, **kwargs):
... | [
"django.utils.translation.ugettext",
"django.views.generic.list_detail.object_list"
] | [((2012, 2052), 'django.views.generic.list_detail.object_list', 'object_list', (['request', 'queryset'], {}), '(request, queryset, **kwargs)\n', (2023, 2052), False, 'from django.views.generic.list_detail import object_list\n'), ((1099, 1165), 'django.utils.translation.ugettext', '_', (['"""tagged_object_list must be c... |
"""
Simulation of binary floating point representation at arbitrary fixed or
infinite precision (including greater than 64 bit).
:name: Simfloat
:author: <NAME>
:version: 0.2
:date: August 2008
Updated to version 0.2 for full Python 3 compatibility in 2020.
"""
import numpy as np
import math
import decimal
from dec... | [
"decimal.getcontext",
"numpy.alltrue",
"numpy.sometrue",
"numpy.array",
"numpy.zeros",
"numpy.isfinite",
"numpy.sign",
"decimal.Decimal"
] | [((1497, 1517), 'decimal.getcontext', 'decimal.getcontext', ([], {}), '()\n', (1515, 1517), False, 'import decimal\n'), ((42488, 42555), 'numpy.alltrue', 'np.alltrue', (["[(n in ('0', '1', '.', 'e', '+', '-')) for n in s_rest]"], {}), "([(n in ('0', '1', '.', 'e', '+', '-')) for n in s_rest])\n", (42498, 42555), True, ... |
import os
from pkg_resources import resource_filename
def get_fun(name):
"""Get the full path to one of the reference files shipped for testing
These files are in torsionfit/testing/reference
:param
name: str
Name of file to load
:returns
fn : str
full pa... | [
"os.path.exists",
"os.path.join"
] | [((381, 421), 'os.path.join', 'os.path.join', (['"""tests"""', '"""reference"""', 'name'], {}), "('tests', 'reference', name)\n", (393, 421), False, 'import os\n'), ((435, 453), 'os.path.exists', 'os.path.exists', (['fn'], {}), '(fn)\n', (449, 453), False, 'import os\n')] |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
Author: <NAME>
File: tf_test_model.py
Date: 2021/1/15 11:25
LastEditors: <NAME>
LastEditTime: 2021/1/15 11:21
Description: Test the .pb model saved in path:./model .
'''
import tensorflow as tf
from tensorflow.python.platform import gfile
from data_object import prov... | [
"tensorflow.compat.v1.GraphDef",
"cifar_10.Cifar_10",
"data_object.preprocess",
"tensorflow.Session",
"tensorflow.python.platform.gfile.FastGFile",
"tensorflow.import_graph_def",
"data_object.provide_data",
"tensorflow.compat.v1.global_variables_initializer"
] | [((1153, 1182), 'data_object.preprocess', 'preprocess', (['batch_images', '(224)'], {}), '(batch_images, 224)\n', (1163, 1182), False, 'from data_object import preprocess\n'), ((1676, 1688), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (1686, 1688), True, 'import tensorflow as tf\n'), ((2144, 2154), 'cifar_10.... |
"""
Program entry point
"""
import sys
from PyQt5.QtWidgets import QApplication
from jvs import MainWindow
def main():
app = QApplication(sys.argv)
w: MainWindow = MainWindow()
w.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main()
| [
"jvs.MainWindow",
"PyQt5.QtWidgets.QApplication"
] | [((132, 154), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (144, 154), False, 'from PyQt5.QtWidgets import QApplication\n'), ((175, 187), 'jvs.MainWindow', 'MainWindow', ([], {}), '()\n', (185, 187), False, 'from jvs import MainWindow\n')] |
from json import dumps, loads
from django.contrib.auth import get_user_model
from django.utils.encoding import force_text
from django.utils.http import urlsafe_base64_decode, urlsafe_base64_encode
from rest_framework import status
from rest_framework.reverse import reverse
from rest_framework.utils.serializer_helpers ... | [
"django.contrib.auth.get_user_model",
"rest_framework.reverse.reverse"
] | [((460, 476), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (474, 476), False, 'from django.contrib.auth import get_user_model\n'), ((492, 532), 'rest_framework.reverse.reverse', 'reverse', (['"""articles:list_create_articles"""'], {}), "('articles:list_create_articles')\n", (499, 532), Fals... |
# -*- coding: utf-8 -*-
import tkinter
import serial
import serial.tools.list_ports
import threading
from tkinter import filedialog
from tkinter import *
import sys
import os
from tkinter import messagebox
from tkinter.scrolledtext import ScrolledText
import matplotlib.pyplot as plt
import matplotlib.animat... | [
"serial.tools.list_ports.comports",
"tkinter.messagebox.askokcancel",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.clf",
"tkinter.filedialog.asksaveasfilename",
"matplotlib.pyplot.close",
"os.execl",
"tkinter.scrolledtext.ScrolledText",
"tkinter.Tk",
"matplotlib.pyplot.figure",
"os.p... | [((10770, 10782), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (10780, 10782), False, 'import tkinter\n'), ((10978, 11012), 'serial.tools.list_ports.comports', 'serial.tools.list_ports.comports', ([], {}), '()\n', (11010, 11012), False, 'import serial\n'), ((14420, 14458), 'tkinter.scrolledtext.ScrolledText', 'Scrolle... |
#!/usr/bin/python
from __future__ import print_function
from difflib import SequenceMatcher
from collections import OrderedDict
import dicom
import sys
import os
import io
try:
import cPickle as pkl
except ImportError:
import pickle as pkl
# Proprietary imports:
from thicom.components import find_dcm, find_dcmd... | [
"os.path.exists",
"thicom.components.find_dcmdir",
"os.listdir",
"dicom.read_file",
"os.rename",
"difflib.SequenceMatcher",
"io.BytesIO",
"thicom.components.is_dicom",
"os.path.join",
"os.getcwd",
"os.chdir",
"thicom.components.find_dcm",
"os.path.split",
"os.path.isdir",
"os.mkdir",
"... | [((22204, 22228), 'os.path.exists', 'os.path.exists', (['dcm_path'], {}), '(dcm_path)\n', (22218, 22228), False, 'import os\n'), ((2187, 2198), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2196, 2198), False, 'import os\n'), ((7194, 7208), 'os.chdir', 'os.chdir', (['curr'], {}), '(curr)\n', (7202, 7208), False, 'import... |
from PIL import Image
import sys
import os
# Jet color scheme adapted from https://stackoverflow.com/questions/7706339/grayscale-to-red-green-blue-matlab-jet-color-scale
def interpolate( val, y0, x0, y1, x1 ):
return (val-x0)*(y1-y0)/(x1-x0) + y0
def blue( grayscale ):
if ( grayscale < -0.33 ): return 1.0
elif ... | [
"PIL.Image.new",
"os.path.isdir",
"os.mkdir",
"PIL.Image.open"
] | [((921, 946), 'PIL.Image.new', 'Image.new', (['"""RGB"""', 'ir.size'], {}), "('RGB', ir.size)\n", (930, 946), False, 'from PIL import Image\n'), ((1550, 1575), 'PIL.Image.new', 'Image.new', (['"""RGB"""', 'ir.size'], {}), "('RGB', ir.size)\n", (1559, 1575), False, 'from PIL import Image\n'), ((2140, 2171), 'os.path.isd... |
from odoo.exceptions import AccessError
from odoo.tests.common import TransactionCase, tagged
@tagged("at_install", "post_install")
class TestAllowImplied(TransactionCase):
def _get_classified_groups(self, config):
groups = config._get_classified_fields()["group"]
return [g[0] for g in groups]
... | [
"odoo.tests.common.tagged"
] | [((97, 133), 'odoo.tests.common.tagged', 'tagged', (['"""at_install"""', '"""post_install"""'], {}), "('at_install', 'post_install')\n", (103, 133), False, 'from odoo.tests.common import TransactionCase, tagged\n')] |