code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pywhatkit as py
import keyboard
import time
from datetime import datetime
def sendMessage(numbers, message, price):
for number in numbers:
py.sendwhatmsg(number, "{}: {:.10f}".format(message, price), datetime.now().hour,
datetime.now().minute + 2)
keyboard.press_and_r... | [
"datetime.datetime.now",
"keyboard.press_and_release",
"time.sleep"
] | [((300, 336), 'keyboard.press_and_release', 'keyboard.press_and_release', (['"""ctrl+w"""'], {}), "('ctrl+w')\n", (326, 336), False, 'import keyboard\n'), ((345, 358), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (355, 358), False, 'import time\n'), ((367, 402), 'keyboard.press_and_release', 'keyboard.press_and_... |
from django.shortcuts import render, redirect
from .forms import *
from django.contrib import messages
# Create your views here.
def supplier_create(request):
form = SupplierCreateForm
if request.method == 'POST':
form = SupplierCreateForm(request.POST)
if form.is_valid():
form.sa... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"django.contrib.messages.success"
] | [((491, 544), 'django.shortcuts.render', 'render', (['request', '"""supplier/supplier_create.html"""', 'ctx'], {}), "(request, 'supplier/supplier_create.html', ctx)\n", (497, 544), False, 'from django.shortcuts import render, redirect\n'), ((671, 722), 'django.shortcuts.render', 'render', (['request', '"""supplier/supp... |
#! /usr/bin/python2
# -*- coding: utf8 -*-
import pykka
import time
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.pipeline import Pipeline
from sklearn.cluster import SpectralClustering, AffinityPropagation
from datetime import datetime
class Learner(pykka.ThreadingActor):... | [
"sklearn.feature_extraction.text.CountVectorizer",
"datetime.datetime.now",
"sklearn.cluster.SpectralClustering",
"sklearn.feature_extraction.text.TfidfTransformer"
] | [((643, 743), 'sklearn.cluster.SpectralClustering', 'SpectralClustering', ([], {'n_clusters': 'k', 'random_state': '(42)', 'affinity': '"""rbf"""', 'n_neighbors': '(15)', 'eigen_tol': '(0.0)'}), "(n_clusters=k, random_state=42, affinity='rbf',\n n_neighbors=15, eigen_tol=0.0)\n", (661, 743), False, 'from sklearn.clu... |
"""Test Tokenization module"""
import unittest
from pororo import Pororo
class PororoTokenizerTester(unittest.TestCase):
def test_modules(self):
mecab = Pororo(task="tokenize", lang="ko", model="mecab_ko")
mecab_res = mecab("안녕 나는 민이라고 해.")
self.assertIsInstance(mecab_res, list)
... | [
"unittest.main",
"pororo.Pororo"
] | [((1379, 1394), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1392, 1394), False, 'import unittest\n'), ((170, 222), 'pororo.Pororo', 'Pororo', ([], {'task': '"""tokenize"""', 'lang': '"""ko"""', 'model': '"""mecab_ko"""'}), "(task='tokenize', lang='ko', model='mecab_ko')\n", (176, 222), False, 'from pororo impo... |
from brownie import network, config, PasswordlessAuthentication
from scripts.utils import get_account, is_network_local
from scripts.passwordless.deploy import deploy
import pytest
def test_passwordlessDeployment():
if not is_network_local():
pytest.skip("Only for unit testing")
contract = deploy()
... | [
"pytest.skip",
"scripts.passwordless.deploy.deploy",
"scripts.utils.is_network_local",
"scripts.utils.get_account"
] | [((309, 317), 'scripts.passwordless.deploy.deploy', 'deploy', ([], {}), '()\n', (315, 317), False, 'from scripts.passwordless.deploy import deploy\n'), ((436, 444), 'scripts.passwordless.deploy.deploy', 'deploy', ([], {}), '()\n', (442, 444), False, 'from scripts.passwordless.deploy import deploy\n'), ((460, 474), 'scr... |
"""
Place in a directory to rename any rooms with the name 'Room Root' to their filename.
Any rooms built from 'room_CANVAS.tscn' will be called 'Room Root'
"""
from pathlib import Path
path = Path.cwd()
SEARCH = "Room Root"
for f in path.iterdir():
if not f.name.endswith('py') and f.name.endswith('tscn'):
... | [
"pathlib.Path.cwd"
] | [((195, 205), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (203, 205), False, 'from pathlib import Path\n')] |
from django.conf.urls import url, include
from django.contrib import admin
from django.conf import settings
from django.views.generic import TemplateView
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
url(r'^accoun... | [
"django.conf.urls.include",
"django.conf.urls.url"
] | [((181, 212), 'django.conf.urls.url', 'url', (['"""^admin/"""', 'admin.site.urls'], {}), "('^admin/', admin.site.urls)\n", (184, 212), False, 'from django.conf.urls import url, include\n'), ((239, 297), 'django.conf.urls.include', 'include', (['"""rest_framework.urls"""'], {'namespace': '"""rest_framework"""'}), "('res... |
import socket
ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #creates a socket object
server = "chat.freenode.net" # Server
channel = "##bot-testing" # Channel
botnick = "IamaPythonBot" # Your bots nick
adminname = "OrderChaos23" #Your IRC nickname. On IRC (and most other places) I go by OrderChaos ... | [
"socket.socket"
] | [((27, 76), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (40, 76), False, 'import socket\n')] |
from __future__ import unicode_literals
import re
class LineBuffer(object):
r"""
Buffer bytes read in from a connection and serve complete lines back.
>>> b = LineBuffer()
>>> len(b)
0
>>> b.feed(b'foo\nbar')
>>> len(b)
7
>>> list(b.lines()) == [b'foo']
True
>>> len(b)
... | [
"re.compile"
] | [((767, 787), 're.compile', 're.compile', (["b'\\r?\\n'"], {}), "(b'\\r?\\n')\n", (777, 787), False, 'import re\n')] |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#-------------------------------------------------------------------------------
"""pyzombie HTTP RESTful server handler returning the representation of an
executable."""
__author__ = ('<NAME>',)
__version__ = '1.0.1'
__copyright__ = """Copyright 2009 <NAME> (<EMAIL>)"""
__... | [
"io.StringIO",
"json.dump"
] | [((4173, 4219), 'json.dump', 'json.dump', (['state', 'fp'], {'sort_keys': '(True)', 'indent': '(4)'}), '(state, fp, sort_keys=True, indent=4)\n', (4182, 4219), False, 'import json\n'), ((1666, 1679), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (1677, 1679), False, 'import io\n')] |
#!/usr/bin/python
import psycopg2
import datetime
from von_pipeline.config import config
from von_pipeline.eventprocessor import EventProcessor
with EventProcessor() as event_processor:
event_processor.process_event_queue()
| [
"von_pipeline.eventprocessor.EventProcessor"
] | [((151, 167), 'von_pipeline.eventprocessor.EventProcessor', 'EventProcessor', ([], {}), '()\n', (165, 167), False, 'from von_pipeline.eventprocessor import EventProcessor\n')] |
import argparse
from typing import Sequence
class CLI:
def __init__(self, description: str, args: Sequence[str]):
self._cli_args = args
self._parser = argparse.ArgumentParser(description=description)
def set_up_log(self) -> None:
pass
def logfile(self) -> str:
# TODO: yyy... | [
"argparse.ArgumentParser"
] | [((173, 221), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'description'}), '(description=description)\n', (196, 221), False, 'import argparse\n')] |
from pathlib import Path
from sintax.formats import criterion
def test_build_results(fixture_directory):
test_csv = Path(fixture_directory) / "valid_criterion.csv"
output = list(criterion._build_results(test_csv))
assert len(output) == 3
assert output[0] == {
"cpu_time": "915000",
"... | [
"sintax.formats.criterion.reader",
"sintax.formats.criterion._build_results",
"pathlib.Path"
] | [((123, 146), 'pathlib.Path', 'Path', (['fixture_directory'], {}), '(fixture_directory)\n', (127, 146), False, 'from pathlib import Path\n'), ((190, 224), 'sintax.formats.criterion._build_results', 'criterion._build_results', (['test_csv'], {}), '(test_csv)\n', (214, 224), False, 'from sintax.formats import criterion\n... |
from collections import OrderedDict
import numpy as np
from multiworld.envs.mujoco.classic_mujoco.all_ant_environments.ant_goal import AntGoalEnv
from multiworld.envs.env_util import get_stat_in_paths, create_stats_ordered_dict, get_asset_full_path
class AntGoalDisabledJointsEnv(AntGoalEnv):
def __init__(self, act... | [
"numpy.clip",
"multiworld.envs.mujoco.classic_mujoco.all_ant_environments.ant_goal.AntGoalEnv.__init__",
"numpy.square",
"numpy.linalg.norm"
] | [((577, 685), 'multiworld.envs.mujoco.classic_mujoco.all_ant_environments.ant_goal.AntGoalEnv.__init__', 'AntGoalEnv.__init__', (['self'], {'action_scale': 'action_scale', 'frame_skip': 'frame_skip', 'goal_position': 'goal_position'}), '(self, action_scale=action_scale, frame_skip=frame_skip,\n goal_position=goal_po... |
import psutil
#import cmt_globals as cmt
from cmt_shared import Check, CheckItem
def check_cpu(c):
'''Get CPU percentage. No alert. Send cpu float value.'''
cpu = psutil.cpu_percent(interval=2)
# c.persist['cpu'] = cpu
i = CheckItem('cpu',cpu,"CPU Percentage", unit='%')
c.add_item(i)
... | [
"psutil.cpu_percent",
"cmt_shared.CheckItem"
] | [((178, 208), 'psutil.cpu_percent', 'psutil.cpu_percent', ([], {'interval': '(2)'}), '(interval=2)\n', (196, 208), False, 'import psutil\n'), ((249, 298), 'cmt_shared.CheckItem', 'CheckItem', (['"""cpu"""', 'cpu', '"""CPU Percentage"""'], {'unit': '"""%"""'}), "('cpu', cpu, 'CPU Percentage', unit='%')\n", (258, 298), F... |
from browser import document
def on_press_key(key): # key.code: PageUp, Enter, q, w, e, r, t, y, " ", ...
if key.code == "PageUp":
slide("slides/злой.svg")
elif key.code == "PageDown":
slide("slides/грустный.svg")
document.bind("keydown", on_press_key)
async def face():
await key("Enter")
slide("slides/нейтра... | [
"browser.document.bind"
] | [((221, 259), 'browser.document.bind', 'document.bind', (['"""keydown"""', 'on_press_key'], {}), "('keydown', on_press_key)\n", (234, 259), False, 'from browser import document\n')] |
import numpy as np
import torch
import time
import gym
from a2c_ppo_acktr import utils
from a2c_ppo_acktr.envs import make_vec_envs
from common.common import *
import pyrobotdesign as rd
def evaluate(args, actor_critic, ob_rms, env_name, seed, num_processes, device):
eval_envs = make_vec_envs(env_name, seed + nu... | [
"numpy.mean",
"numpy.sqrt",
"time.sleep",
"a2c_ppo_acktr.utils.get_vec_normalize",
"numpy.zeros",
"pyrobotdesign.GLFWViewer",
"torch.tensor",
"numpy.linalg.norm",
"torch.no_grad",
"a2c_ppo_acktr.envs.make_vec_envs",
"time.time",
"torch.zeros"
] | [((287, 377), 'a2c_ppo_acktr.envs.make_vec_envs', 'make_vec_envs', (['env_name', '(seed + num_processes)', 'num_processes', 'None', 'None', 'device', '(True)'], {}), '(env_name, seed + num_processes, num_processes, None, None,\n device, True)\n', (300, 377), False, 'from a2c_ppo_acktr.envs import make_vec_envs\n'), ... |
import discord
from modules.botModule import *
import shlex
import time
from tinydb import TinyDB, Query
class Moderation(BotModule):
name = 'moderation'
description = 'Moderation tools for moderators.'
help_text = '**These tools are only available for moderators/admins.** \n' \
'`!mod w... | [
"shlex.split",
"tinydb.Query",
"discord.Embed",
"time.time"
] | [((1143, 1150), 'tinydb.Query', 'Query', ([], {}), '()\n', (1148, 1150), False, 'from tinydb import TinyDB, Query\n'), ((2264, 2271), 'tinydb.Query', 'Query', ([], {}), '()\n', (2269, 2271), False, 'from tinydb import TinyDB, Query\n'), ((2509, 2537), 'shlex.split', 'shlex.split', (['message.content'], {}), '(message.c... |
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
import sys
import tensorflow as tf
import matplotlib
from PIL import Image
import matplotlib.patches as patches
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as vis_util
import argparse... | [
"tensorflow.Graph",
"PIL.Image.open",
"tensorflow.compat.v1.GraphDef",
"argparse.ArgumentParser",
"tensorflow.import_graph_def",
"numpy.expand_dims",
"pandas.DataFrame",
"tensorflow.compat.v2.io.gfile.GFile",
"object_detection.utils.label_map_util.load_labelmap",
"object_detection.utils.label_map_... | [((430, 455), 'glob.glob', 'glob.glob', (['"""images/*.jpg"""'], {}), "('images/*.jpg')\n", (439, 455), False, 'import glob\n'), ((527, 589), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['image', 'result', 'score', 'position']"}), "(columns=['image', 'result', 'score', 'position'])\n", (539, 589), True, 'impo... |
# Copyright IBM All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------------------
# -----------------------------------------------------------------------------------
# OptimizationEngine
# -------------------------------------------------... | [
"docplex.mp.model.Model",
"docplex.mp.conflict_refiner.ConflictRefiner",
"scenariomanager.ScenarioManager.add_data_file_to_project_s",
"os.rename",
"os.path.join",
"scenariomanager.ScenarioManager.env_is_cpd25",
"docplex.mp.progress.SolutionListener.__init__",
"scenariomanager.ScenarioManager",
"pan... | [((1582, 1598), 'docplex.mp.model.Model', 'Model', ([], {'name': 'name'}), '(name=name)\n', (1587, 1598), False, 'from docplex.mp.model import Model\n'), ((4652, 4700), 'pandas.DataFrame', 'pd.DataFrame', (['all_kpis'], {'columns': "['kpi', 'value']"}), "(all_kpis, columns=['kpi', 'value'])\n", (4664, 4700), True, 'imp... |
import numpy as np
import torch
import torchvision
from torchvision import transforms
from torch.utils.data import DataLoader, random_split
import cv2
import matplotlib.pyplot as plt
from torchvision.datasets import CIFAR10
from PIL import Image
def to_RGB(image:Image)->Image:
if image.mode == 'RGB':return image
... | [
"matplotlib.pyplot.imshow",
"cv2.open",
"cv2.merge",
"torchvision.transforms.ToPILImage",
"numpy.float32",
"PIL.Image.new",
"torchvision.transforms.Grayscale",
"matplotlib.pyplot.close",
"numpy.array",
"torchvision.datasets.CIFAR10",
"numpy.zeros",
"cv2.split",
"torch.utils.data.DataLoader",... | [((3113, 3148), 'torchvision.transforms.ToPILImage', 'torchvision.transforms.ToPILImage', ([], {}), '()\n', (3146, 3148), False, 'import torchvision\n'), ((3165, 3186), 'torchvision.transforms.ToTensor', 'transforms.ToTensor', ([], {}), '()\n', (3184, 3186), False, 'from torchvision import transforms\n'), ((3260, 3294)... |
#Project: GBS Tool
# Author: Dr. <NAME>, <EMAIL>, denamics GmbH
# Date: January 16, 2018
# License: MIT License (see LICENSE file of this package for more information)
# Contains the main flow of the optimization as it is to be called from the GBSController.
import os
import time
import numpy as np
import pandas as ... | [
"numpy.log10",
"numpy.isfinite",
"Model.Operational.generateRuns.generateRuns",
"numpy.asarray",
"Analyzer.PerformanceAnalyzers.getFuelUse.getFuelUse",
"Analyzer.DataRetrievers.getDataSubsets.getDataSubsets",
"numpy.linspace",
"Optimizer.OptimizationBoundaryCalculators.getOptimizationBoundaries.getOpt... | [((3051, 3118), 'os.path.join', 'os.path.join', (['self.thisPath', '"""../../GBSProjects/"""', 'self.projectName'], {}), "(self.thisPath, '../../GBSProjects/', self.projectName)\n", (3063, 3118), False, 'import os\n'), ((3434, 3504), 'os.path.join', 'os.path.join', (['self.rootProjectPath', '"""InputData/Setup/"""', 'c... |
from eth_utils import (
ValidationError,
)
from eth2._utils.tuple import (
update_tuple_item,
)
from eth2.configs import (
CommitteeConfig,
)
from eth2.beacon.committee_helpers import (
get_beacon_proposer_index,
)
from eth2.beacon.helpers import (
get_delayed_activation_exit_epoch,
get_effecti... | [
"eth2.beacon.helpers.get_epoch_start_slot",
"eth_utils.ValidationError",
"eth2.beacon.committee_helpers.get_beacon_proposer_index",
"eth2._utils.tuple.update_tuple_item",
"eth2.beacon.helpers.get_effective_balance"
] | [((3851, 3939), 'eth2.beacon.helpers.get_effective_balance', 'get_effective_balance', (['state.validator_balances', 'validator_index', 'max_deposit_amount'], {}), '(state.validator_balances, validator_index,\n max_deposit_amount)\n', (3872, 3939), False, 'from eth2.beacon.helpers import get_delayed_activation_exit_e... |
#!/usr/bin/env python3
"""
See: https://api.jensenlab.org/About
"""
###
import sys,os,re,argparse,time,json,logging
#
from .. import jensenlab
#
##############################################################################
if __name__=='__main__':
CHANNELS= ['Knowledge', 'Experiments', 'Textmining', 'All']
parser ... | [
"logging.basicConfig",
"re.split",
"time.time",
"argparse.ArgumentParser"
] | [((322, 386), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""JensenLab REST API client"""'}), "(description='JensenLab REST API client')\n", (345, 386), False, 'import sys, os, re, argparse, time, json, logging\n'), ((1163, 1281), 'logging.basicConfig', 'logging.basicConfig', ([], {'form... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import timedelta
from django.test import TestCase
from django.urls import reverse
from infinite_scroll_pagination.serializers import to_page_key
from ...core.tests import utils
from .models import TopicUnread
from ...comment.bookmark.mode... | [
"datetime.timedelta",
"infinite_scroll_pagination.serializers.to_page_key",
"django.urls.reverse"
] | [((1534, 1570), 'django.urls.reverse', 'reverse', (['"""spirit:topic:unread:index"""'], {}), "('spirit:topic:unread:index')\n", (1541, 1570), False, 'from django.urls import reverse\n'), ((1743, 1779), 'django.urls.reverse', 'reverse', (['"""spirit:topic:unread:index"""'], {}), "('spirit:topic:unread:index')\n", (1750,... |
#!/usr/bin/python
from threading import Thread
import path_finder
import config
import dependency_manager
import os, sys
import platform
import zipfile
import version_checker
#log_file = open("debug.log","w")
#sys.stdout = log_file
if len(os.path.dirname(sys.argv[0])) > 0:
os.chdir(os.path.dirname(sys.argv[0]))
... | [
"os.path.exists",
"path_finder.set_nwn_path",
"os.makedirs",
"zipfile.ZipFile",
"os.path.join",
"os.path.dirname",
"threading.Thread",
"config.load_config",
"path_finder.get_nwn_path"
] | [((847, 875), 'config.load_config', 'config.load_config', (['"""config"""'], {}), "('config')\n", (865, 875), False, 'import config\n'), ((1004, 1030), 'path_finder.get_nwn_path', 'path_finder.get_nwn_path', ([], {}), '()\n', (1028, 1030), False, 'import path_finder\n'), ((1242, 1294), 'threading.Thread', 'Thread', ([]... |
from math import floor
from layeredGraphLayouter.containers.constants import NodeType, PortConstraints,\
PortSide, PortType
from layeredGraphLayouter.containers.lEdge import LEdge
from layeredGraphLayouter.containers.lGraph import LGraph, LNodeLayer
from layeredGraphLayouter.containers.lNode import LNode
from laye... | [
"layeredGraphLayouter.containers.lPort.LPort",
"math.floor"
] | [((4003, 4023), 'math.floor', 'floor', (['(thickness / 2)'], {}), '(thickness / 2)\n', (4008, 4023), False, 'from math import floor\n'), ((4092, 4139), 'layeredGraphLayouter.containers.lPort.LPort', 'LPort', (['dummyNode', 'PortType.INPUT', 'PortSide.WEST'], {}), '(dummyNode, PortType.INPUT, PortSide.WEST)\n', (4097, 4... |
import asyncio
import queue as lib_queue
import time
import nats
import failures
class Publisher(object):
"""Publisher provides an NATS helper for publishing input events."""
def __init__(self, key, alive_gap=0.1, queue_cap=1024):
"""alive_gap defines the maximum idle waiting time before sending an... | [
"nats.connect",
"failures.posthook",
"queue.Queue",
"asyncio.get_event_loop",
"time.time"
] | [((425, 459), 'queue.Queue', 'lib_queue.Queue', ([], {'maxsize': 'queue_cap'}), '(maxsize=queue_cap)\n', (440, 459), True, 'import queue as lib_queue\n'), ((1459, 1483), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (1481, 1483), False, 'import asyncio\n'), ((730, 752), 'nats.connect', 'nats.con... |
'''
Source codes for Python Machine Learning By Example 3rd Edition (Packt Publishing)
Chapter 10 Discovering Underlying Topics in the Newsgroups Dataset with Clustering and Topic Modeling
Author: Yuxi (Hayden) Liu (<EMAIL>)
'''
from sklearn import datasets
from sklearn.cluster import KMeans
import numpy as np
from... | [
"sklearn.datasets.load_iris",
"sklearn.cluster.KMeans",
"numpy.where",
"matplotlib.pyplot.plot",
"numpy.linalg.norm",
"matplotlib.pyplot.show"
] | [((361, 381), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (379, 381), False, 'from sklearn import datasets\n'), ((856, 882), 'matplotlib.pyplot.plot', 'plt.plot', (['k_list', 'sse_list'], {}), '(k_list, sse_list)\n', (864, 882), True, 'from matplotlib import pyplot as plt\n'), ((883, 893), 'ma... |
from .vggs import vgg_all
from lc.models.torch.nincif import nincif_bn
__all__ = ["nin_all"]
class nin_all(vgg_all):
def __init__(self):
super(nin_all, self).__init__("nin_all", nincif_bn(), 'nincif_bn') | [
"lc.models.torch.nincif.nincif_bn"
] | [((186, 197), 'lc.models.torch.nincif.nincif_bn', 'nincif_bn', ([], {}), '()\n', (195, 197), False, 'from lc.models.torch.nincif import nincif_bn\n')] |
#☆𝒐𝒎𝒂𝒋𝒊𝒏𝒂𝒊☆#
import sys
import math
from math import ceil, floor
import itertools
from functools import lru_cache,reduce
from collections import deque
inf=10**20
sys.setrecursionlimit(10000000)
input=lambda : sys.stdin.readline().rstrip()
'''''✂'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
n=int(in... | [
"functools.reduce",
"sys.setrecursionlimit",
"sys.stdin.readline"
] | [((162, 193), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10000000)'], {}), '(10000000)\n', (183, 193), False, 'import sys\n'), ((359, 388), 'functools.reduce', 'reduce', (['(lambda x, y: x ^ y)', 'a'], {}), '(lambda x, y: x ^ y, a)\n', (365, 388), False, 'from functools import lru_cache, reduce\n'), ((209, 2... |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2013 Contributor
#
# 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 Li... | [
"aquilon.aqdb.column_types.AqStr",
"sqlalchemy.orm.relation",
"aquilon.aqdb.column_types.AqMac",
"sqlalchemy.ForeignKey",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.String",
"sqlalchemy.Sequence",
"sqlalchemy.Column"
] | [((2626, 2653), 'sqlalchemy.Column', 'Column', (['IPV4'], {'nullable': '(True)'}), '(IPV4, nullable=True)\n', (2632, 2653), False, 'from sqlalchemy import Table, Integer, DateTime, Sequence, String, Column, ForeignKey, UniqueConstraint\n'), ((3064, 3083), 'sqlalchemy.orm.relation', 'relation', (['DnsDomain'], {}), '(Dn... |
import json
import time
import traceback
from transport.rabbitmq import connection, exchanges, pool
def publish_without_producer(body: dict, exchange: str, routing_key: str):
with pool.acquire() as channel:
prod = connection.Producer(channel)
prod.publish(body,
exchange=excha... | [
"traceback.format_exc",
"transport.rabbitmq.pool.acquire",
"transport.rabbitmq.connection.Producer",
"time.time",
"transport.rabbitmq.exchanges.get"
] | [((187, 201), 'transport.rabbitmq.pool.acquire', 'pool.acquire', ([], {}), '()\n', (199, 201), False, 'from transport.rabbitmq import connection, exchanges, pool\n'), ((229, 257), 'transport.rabbitmq.connection.Producer', 'connection.Producer', (['channel'], {}), '(channel)\n', (248, 257), False, 'from transport.rabbit... |
import numpy as np
import numba as nb
from scipy.stats import rankdata
from functools import partial
import os
import sys
from sklearn.base import BaseEstimator, TransformerMixin
from julia import Julia
jl = Julia(compiled_modules=False)
class ECRelieff(BaseEstimator, TransformerMixin):
"""sklearn compatible ... | [
"numpy.abs",
"numpy.float",
"numpy.unique",
"numpy.amin",
"numpy.repeat",
"numpy.argpartition",
"numpy.where",
"numpy.log",
"julia.Julia",
"numpy.sum",
"numpy.zeros",
"numpy.int",
"numpy.empty",
"numpy.vstack",
"os.path.abspath",
"numpy.amax",
"numpy.arange"
] | [((211, 240), 'julia.Julia', 'Julia', ([], {'compiled_modules': '(False)'}), '(compiled_modules=False)\n', (216, 240), False, 'from julia import Julia\n'), ((1211, 1236), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (1226, 1236), False, 'import os\n'), ((3497, 3540), 'numpy.unique', 'np.uni... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | [
"argparse.ArgumentParser",
"mindspore.context.set_context",
"mindspore.train.serialization.load_checkpoint",
"numpy.zeros",
"src.resnet.resnet152",
"mindspore.train.serialization.export"
] | [((1031, 1087), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""resnet152 export """'}), "(description='resnet152 export ')\n", (1054, 1087), False, 'import argparse\n'), ((1866, 1944), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE', 'device_tar... |
from distutils.core import setup
setup(
name='py_wizard',
version='2.0',
author='<NAME>',
author_email='<EMAIL>',
package_dir={'': 'src', },
packages=[
'py_wizard',
'py_wizard.console_wiz_iface',
'py_wizard.questions',
'py_wizard.tk_wizard_iface',
],
... | [
"distutils.core.setup"
] | [((34, 258), 'distutils.core.setup', 'setup', ([], {'name': '"""py_wizard"""', 'version': '"""2.0"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'package_dir': "{'': 'src'}", 'packages': "['py_wizard', 'py_wizard.console_wiz_iface', 'py_wizard.questions',\n 'py_wizard.tk_wizard_iface']"}), "(name='p... |
import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
url = "https://en.wikipedia.org/wiki/Wikipedia:Main_Page/1"
CHROME_DRIVER = os.environ.get('CHROME_DRIVER')
driver = webdriver.Chrome(executable_path=CHROME_DRIVER)
driver.get(url)
# getting the number of articles (Articles count)... | [
"selenium.webdriver.Chrome",
"os.environ.get"
] | [((166, 197), 'os.environ.get', 'os.environ.get', (['"""CHROME_DRIVER"""'], {}), "('CHROME_DRIVER')\n", (180, 197), False, 'import os\n'), ((207, 254), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'executable_path': 'CHROME_DRIVER'}), '(executable_path=CHROME_DRIVER)\n', (223, 254), False, 'from selenium impo... |
#! /usr/bin/env python3
#
# Copyright 2018 California Institute of Technology
#
# 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
#
# Unle... | [
"scipy.real",
"collections.OrderedDict",
"scipy.optimize.least_squares",
"logging.debug",
"common.svd_inv",
"scipy.zeros",
"logging.warning",
"inverse_simple.invert_simple",
"scipy.array",
"scipy.concatenate",
"scipy.logical_and",
"time.time",
"common.svd_inv_sqrt"
] | [((1304, 1315), 'time.time', 'time.time', ([], {}), '()\n', (1313, 1315), False, 'import time\n'), ((1407, 1420), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1418, 1420), False, 'from collections import OrderedDict\n'), ((2141, 2163), 'scipy.array', 's.array', (['()'], {'dtype': 'int'}), '((), dtype=in... |
# coding: utf-8
'''
The entry point of canvas's CLI.
'''
# Ensure canvas is importable.
import sys
sys.path.insert(0, '.')
# Import and invoke the launch handler.
from canvas import launch_cli
launch_cli((str(),) if len(sys.argv) == 1 else sys.argv[1:])
| [
"sys.path.insert"
] | [((100, 123), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""."""'], {}), "(0, '.')\n", (115, 123), False, 'import sys\n')] |
""" Define train and test data for One versus Rest or Rest versus One in cross validation fashion
The result summary of this operation contains one dataset for every
dataset of the *input_path*, which uses data from this dataset as test
data and the data of all other datasets as training data. For instance, if
the inp... | [
"pySPACE.resources.dataset_defs.base.BaseDataset.load",
"pySPACE.resources.dataset_defs.base.BaseDataset.load_meta_data",
"time.strftime",
"os.sep.join",
"pySPACE.resources.dataset_defs.base.BaseDataset.store_meta_data",
"multiprocessing.Queue",
"pySPACE.tools.filesystem.get_author"
] | [((5113, 5131), 'multiprocessing.Queue', 'processing.Queue', ([], {}), '()\n', (5129, 5131), True, 'import multiprocessing as processing\n'), ((17409, 17454), 'pySPACE.resources.dataset_defs.base.BaseDataset.load', 'BaseDataset.load', (['source_collection_pathes[0]'], {}), '(source_collection_pathes[0])\n', (17425, 174... |
#######################################################
#Reference: https://github.com/experiencor/keras-yolo3#
#######################################################
import numpy as np
import os
import cv2
from scipy.special import expit
class BoundBox:
def __init__(self, xmin, ymin, xmax, ymax, c = None, class... | [
"numpy.argmax",
"scipy.special.expit",
"numpy.exp",
"numpy.zeros",
"numpy.argsort",
"numpy.expand_dims",
"numpy.finfo",
"numpy.maximum",
"numpy.full",
"cv2.resize",
"numpy.amax"
] | [((950, 958), 'scipy.special.expit', 'expit', (['x'], {}), '(x)\n', (955, 958), False, 'from scipy.special import expit\n'), ((1040, 1049), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (1046, 1049), True, 'import numpy as np\n'), ((1243, 1268), 'cv2.resize', 'cv2.resize', (['img', '(nw, nh)'], {}), '(img, (nw, nh))\n',... |
"""
stanCode Breakout Project
Adapted from <NAME>'s Breakout by
<NAME>, <NAME>, <NAME>,
and <NAME>
YOUR DESCRIPTION HERE
"""
from campy.graphics.gwindow import GWindow
from campy.graphics.gobjects import GOval, GRect, GLabel
from campy.gui.events.mouse import onmouseclicked, onmousemoved
from campy.gui.events.timer i... | [
"campy.gui.events.mouse.onmousemoved",
"campy.graphics.gobjects.GRect",
"campy.graphics.gwindow.GWindow",
"campy.graphics.gobjects.GOval",
"random.random",
"random.randint",
"campy.gui.events.mouse.onmouseclicked"
] | [((1881, 1953), 'campy.graphics.gwindow.GWindow', 'GWindow', ([], {'width': 'self.window_width', 'height': 'self.window_height', 'title': 'title'}), '(width=self.window_width, height=self.window_height, title=title)\n', (1888, 1953), False, 'from campy.graphics.gwindow import GWindow\n'), ((2003, 2150), 'campy.graphics... |
import numpy as np
import cv2
img = cv2.imread('images/plane_noisy.png', cv2.IMREAD_GRAYSCALE)
img_out = img.copy()
height = img.shape[0]
width = img.shape[1]
for i in np.arange(3, height-3):
for j in np.arange(3, width-3):
neighbors = []
for k in np.arange(-3, 4):
for l ... | [
"cv2.imwrite",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.waitKey",
"numpy.arange",
"cv2.imread"
] | [((40, 98), 'cv2.imread', 'cv2.imread', (['"""images/plane_noisy.png"""', 'cv2.IMREAD_GRAYSCALE'], {}), "('images/plane_noisy.png', cv2.IMREAD_GRAYSCALE)\n", (50, 98), False, 'import cv2\n'), ((180, 204), 'numpy.arange', 'np.arange', (['(3)', '(height - 3)'], {}), '(3, height - 3)\n', (189, 204), True, 'import numpy as... |
# coding: utf-8
# Copyright (c) Materials Virtual Lab
# Distributed under the terms of the BSD License.
from __future__ import division, print_function, unicode_literals, \
absolute_import
import itertools
import subprocess
import io
import re
import numpy as np
import pandas as pd
from monty.io import zopen
from... | [
"veidt.potential.lammps.calcs.SpectralNeighborAnalysis",
"numpy.unique",
"veidt.potential.soap.SOAPotential",
"veidt.potential.nnp.NNPotential",
"monty.os.path.which",
"re.compile",
"monty.io.zopen",
"itertools.combinations_with_replacement",
"numpy.exp",
"numpy.array",
"veidt.potential.processi... | [((1991, 2094), 'veidt.potential.lammps.calcs.SpectralNeighborAnalysis', 'SpectralNeighborAnalysis', (['rcutfac', 'twojmax', 'element_profile', 'rfac0', 'rmin0', 'diagonalstyle', 'quadratic'], {}), '(rcutfac, twojmax, element_profile, rfac0, rmin0,\n diagonalstyle, quadratic)\n', (2015, 2094), False, 'from veidt.pot... |
import batoid
import numpy as np
from test_helpers import timer, do_pickle
@timer
def test_sag():
import random
random.seed(57)
for i in range(100):
plane = batoid.Plane()
for j in range(10):
x = random.gauss(0.0, 1.0)
y = random.gauss(0.0, 1.0)
result =... | [
"numpy.random.normal",
"batoid.Ray",
"batoid.Plane",
"test_helpers.do_pickle",
"numpy.testing.assert_allclose",
"batoid.RayVector",
"random.seed",
"random.gauss"
] | [((122, 137), 'random.seed', 'random.seed', (['(57)'], {}), '(57)\n', (133, 137), False, 'import random\n'), ((904, 920), 'random.seed', 'random.seed', (['(577)'], {}), '(577)\n', (915, 920), False, 'import random\n'), ((1529, 1546), 'random.seed', 'random.seed', (['(5772)'], {}), '(5772)\n', (1540, 1546), False, 'impo... |
# -*- Python -*-
# This file is licensed under a pytorch-style license
# See LICENSE.pytorch for license information.
# Helpers for the other tests.
import torch
from torch._C import CompilationUnit
# RUN: %PYTHON %s
# Import TorchScript IR string as ScriptFunction.
def create_script_function(func_name, ts_ir_str):... | [
"torch._C.CompilationUnit",
"torch._C.parse_ir"
] | [((330, 347), 'torch._C.CompilationUnit', 'CompilationUnit', ([], {}), '()\n', (345, 347), False, 'from torch._C import CompilationUnit\n'), ((389, 417), 'torch._C.parse_ir', 'torch._C.parse_ir', (['ts_ir_str'], {}), '(ts_ir_str)\n', (406, 417), False, 'import torch\n')] |
import json
import random
import vk_api
from vk_api.longpoll import VkLongPoll
def write_msg(peer_id: int, message: str):
vk.method('messages.send', {'peer_id': peer_id, 'message': message, 'random_id': random.randint(0, 2048),
'disable_mentions': 1})
def edit_msg(peer_id, messa... | [
"vk_api.VkApi",
"random.randint",
"vk_api.longpoll.VkLongPoll"
] | [((890, 931), 'vk_api.VkApi', 'vk_api.VkApi', ([], {'app_id': '(6146827)', 'token': 'token'}), '(app_id=6146827, token=token)\n', (902, 931), False, 'import vk_api\n'), ((967, 989), 'vk_api.longpoll.VkLongPoll', 'VkLongPoll', (['vk'], {'wait': '(0)'}), '(vk, wait=0)\n', (977, 989), False, 'from vk_api.longpoll import V... |
#!/usr/bin/env python3
import json
from flask import Flask
from flask.json import jsonify
from vosk import KaldiRecognizer, Model, SetLogLevel
app = Flask(__name__)
@app.route('/hello', methods=['GET'])
def hello_world():
return jsonify({'hello': 'world!!!'})
def main():
app.run(debug=True)
if __name__ == "... | [
"flask.json.jsonify",
"flask.Flask"
] | [((150, 165), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (155, 165), False, 'from flask import Flask\n'), ((235, 265), 'flask.json.jsonify', 'jsonify', (["{'hello': 'world!!!'}"], {}), "({'hello': 'world!!!'})\n", (242, 265), False, 'from flask.json import jsonify\n')] |
from elasticsearch import Elasticsearch, RequestsHttpConnection
from aws_requests_auth.boto_utils import BotoAWSRequestsAuth
ES_CLIENT = None
def get_es_client(config):
global ES_CLIENT
aws_es = config.get('AWS_ES', False)
aws_region = config.get('AWS_REGION')
es_host = config.get('ES_HOST', '127.... | [
"elasticsearch.Elasticsearch",
"aws_requests_auth.boto_utils.BotoAWSRequestsAuth"
] | [((829, 858), 'elasticsearch.Elasticsearch', 'Elasticsearch', ([], {'hosts': '[es_url]'}), '(hosts=[es_url])\n', (842, 858), False, 'from elasticsearch import Elasticsearch, RequestsHttpConnection\n'), ((538, 616), 'aws_requests_auth.boto_utils.BotoAWSRequestsAuth', 'BotoAWSRequestsAuth', ([], {'aws_host': 'es_host', '... |
"""
Copyright (c) 2018-2020 Qualcomm Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:
Redistributions of source code must retain... | [
"app.db.String",
"app.db.session.add",
"app.db.Column",
"app.db.ForeignKey",
"app.db.session.rollback"
] | [((2342, 2381), 'app.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (2351, 2381), False, 'from app import db\n'), ((2403, 2416), 'app.db.String', 'db.String', (['(16)'], {}), '(16)\n', (2412, 2416), False, 'from app import db\n'), ((2456, 2510), 'app.db.Foreign... |
from datetime import datetime
from typing import List
from marshmallow import Schema, fields, post_load
from src.dto.common.base_dto import BaseDto
class ConsoleGamesListDto(BaseDto):
def __init__(self, console_code: str = None,
reference_id: str = None,
title: str = None,
... | [
"marshmallow.fields.Int",
"marshmallow.fields.Nested",
"marshmallow.fields.Str"
] | [((631, 643), 'marshmallow.fields.Str', 'fields.Str', ([], {}), '()\n', (641, 643), False, 'from marshmallow import Schema, fields, post_load\n'), ((663, 675), 'marshmallow.fields.Str', 'fields.Str', ([], {}), '()\n', (673, 675), False, 'from marshmallow import Schema, fields, post_load\n'), ((688, 700), 'marshmallow.f... |
from app.exc import DataNotFound, UnauthorizedAccessError
from app.models.address_model import AddressModel
from flask_restful import reqparse
from flask_jwt_extended import get_jwt_identity
from flask import jsonify
from http import HTTPStatus
from app.models.users_model import UserModel
from app.services.helper impor... | [
"app.exc.DataNotFound",
"flask_restful.reqparse.RequestParser",
"app.models.address_model.AddressModel",
"app.models.users_model.UserModel.query.get",
"app.models.address_model.AddressModel.query.get",
"flask_jwt_extended.get_jwt_identity",
"flask.jsonify"
] | [((474, 492), 'flask_jwt_extended.get_jwt_identity', 'get_jwt_identity', ([], {}), '()\n', (490, 492), False, 'from flask_jwt_extended import get_jwt_identity\n'), ((511, 535), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ([], {}), '()\n', (533, 535), False, 'from flask_restful import reqparse\n'),... |
from django.db import models
from apps.users.models import User
# Create your models here.
class ShippingAddress(models.Model):
user = models.ForeignKey(User, null=False, blank=False, on_delete=models.CASCADE)
line1 = models.CharField(max_length=200)
line2 = models.CharField(max_length=200, null=True, bl... | [
"django.db.models.DateTimeField",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.ForeignKey"
] | [((142, 216), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'null': '(False)', 'blank': '(False)', 'on_delete': 'models.CASCADE'}), '(User, null=False, blank=False, on_delete=models.CASCADE)\n', (159, 216), False, 'from django.db import models\n'), ((229, 261), 'django.db.models.CharField', 'models.Ch... |
#! /usr/bin/env python3
# coding: utf-8
"""Test the map module."""
from pygame import display
from pygame.sprite import Sprite
from core.modules.map_file import import_map
from core.modules.images import collect_images
from core.modules.constants import SCREEN_SIZE
from core.game.map import Map
def test_map():
... | [
"core.game.map.Map",
"core.modules.images.collect_images",
"pygame.display.init",
"pygame.display.set_mode",
"core.modules.map_file.import_map"
] | [((352, 366), 'pygame.display.init', 'display.init', ([], {}), '()\n', (364, 366), False, 'from pygame import display\n'), ((371, 400), 'pygame.display.set_mode', 'display.set_mode', (['SCREEN_SIZE'], {}), '(SCREEN_SIZE)\n', (387, 400), False, 'from pygame import display\n'), ((414, 430), 'core.modules.images.collect_i... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
import platform
import unittest
im... | [
"unittest.main",
"nimbusml.preprocessing.ToKeyImputer",
"platform.linux_distribution"
] | [((1086, 1101), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1099, 1101), False, 'import unittest\n'), ((936, 950), 'nimbusml.preprocessing.ToKeyImputer', 'ToKeyImputer', ([], {}), '()\n', (948, 950), False, 'from nimbusml.preprocessing import ToKeyImputer\n'), ((436, 465), 'platform.linux_distribution', 'platf... |
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from lib import Demand
from lib import Spot | [
"os.path.dirname"
] | [((70, 95), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (85, 95), False, 'import os\n')] |
# Generated by Django 2.0.5 on 2018-06-26 12:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0019_delete_filter'),
('home', '0003_standardpage'),
]
operations = [
migrations.A... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.PositiveIntegerField",
"django.db.models.ForeignKey"
] | [((413, 457), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'default': '(1000000)'}), '(default=1000000)\n', (440, 457), False, 'from django.db import migrations, models\n'), ((580, 619), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'null': '(True)'}), '(bla... |
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, <NAME> (@dagwieers) <<EMAIL>>
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""This file implements the Kodi xbmcgui module, either using stubs or alternative functionality"""
# pylint: disable=invalid-name,unused-argument
fr... | [
"xbmcextra.kodi_to_ansi"
] | [((773, 794), 'xbmcextra.kodi_to_ansi', 'kodi_to_ansi', (['heading'], {}), '(heading)\n', (785, 794), False, 'from xbmcextra import kodi_to_ansi\n'), ((813, 834), 'xbmcextra.kodi_to_ansi', 'kodi_to_ansi', (['message'], {}), '(message)\n', (825, 834), False, 'from xbmcextra import kodi_to_ansi\n'), ((1174, 1193), 'xbmce... |
# Generated by Django 2.0.13 on 2020-03-04 14:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ddcz', '0023_skills'),
]
operations = [
migrations.RenameModel(
old_name='Dovednosti',
new_name='Skill',
),
]
| [
"django.db.migrations.RenameModel"
] | [((213, 276), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""Dovednosti"""', 'new_name': '"""Skill"""'}), "(old_name='Dovednosti', new_name='Skill')\n", (235, 276), False, 'from django.db import migrations\n')] |
import math
ang = float(input('Digite o valor do Ângulo: '))
seno = float(math.sin(math.radians(ang)))
coso = float(math.cos(math.radians(ang)))
tang = float(math.tan(math.radians(ang)))
print('O Seno Do Ângulo {0} é {1:.3f}\nO Cosseno Do Ângulo {0} é {2:.3f}\nA Tangente Do Ângulo {0} é {3:.3f}'.format(ang, seno, ... | [
"math.radians"
] | [((85, 102), 'math.radians', 'math.radians', (['ang'], {}), '(ang)\n', (97, 102), False, 'import math\n'), ((128, 145), 'math.radians', 'math.radians', (['ang'], {}), '(ang)\n', (140, 145), False, 'import math\n'), ((171, 188), 'math.radians', 'math.radians', (['ang'], {}), '(ang)\n', (183, 188), False, 'import math\n'... |
# coding=utf-8
import indigo
import json
from ..Shelly import Shelly
class Shelly_Addon(Shelly):
"""
The Shelly Temperature Add-on is a sensor tht attaches to a host device.
The host devices can be a Shelly 1 or Shelly 1PM.
"""
def __init__(self, device):
Shelly.__init__(self, device)
... | [
"indigo.activePlugin.pluginPrefs.get",
"indigo.Dict"
] | [((3949, 3962), 'indigo.Dict', 'indigo.Dict', ([], {}), '()\n', (3960, 3962), False, 'import indigo\n'), ((5425, 5490), 'indigo.activePlugin.pluginPrefs.get', 'indigo.activePlugin.pluginPrefs.get', (['"""addon-address-format"""', 'None'], {}), "('addon-address-format', None)\n", (5460, 5490), False, 'import indigo\n')] |
# from yapic.di.injector import Injector
# from yapic.di.injector_new import Injector
from yapic.di import Injector, VALUE
# def test_scope_get(benchmark):
# s = Scope()
# s["hello"] = 1
# benchmark(lambda s: s["hello"], s)
# def test_scope_inherit_get(benchmark):
# s = Scope()
# s["hello"] = 1
... | [
"yapic.di.Injector"
] | [((990, 1000), 'yapic.di.Injector', 'Injector', ([], {}), '()\n', (998, 1000), False, 'from yapic.di import Injector, VALUE\n'), ((1232, 1242), 'yapic.di.Injector', 'Injector', ([], {}), '()\n', (1240, 1242), False, 'from yapic.di import Injector, VALUE\n'), ((1469, 1479), 'yapic.di.Injector', 'Injector', ([], {}), '()... |
from django.contrib import admin
from .models import NewCarModel
# Register your models here.
admin.site.register(NewCarModel)
| [
"django.contrib.admin.site.register"
] | [((95, 127), 'django.contrib.admin.site.register', 'admin.site.register', (['NewCarModel'], {}), '(NewCarModel)\n', (114, 127), False, 'from django.contrib import admin\n')] |
from algorithm.hdpview import HDPView
"""
For data synthesis task.
"""
class HDPViewSampler:
@classmethod
def make_model(cls, prng):
return cls(prng)
def __init__(self, prng):
self.prng = prng
def train(self, ct, epsilon, label_attr, ratio=0.9, alpha=1.6, beta=1.2, g... | [
"algorithm.hdpview.HDPView"
] | [((384, 477), 'algorithm.hdpview.HDPView', 'HDPView', (['ct', 'epsilon', 'self.prng', 'ratio', 'alpha', 'beta', 'gamma', 'is_classification', 'label_attr'], {}), '(ct, epsilon, self.prng, ratio, alpha, beta, gamma,\n is_classification, label_attr)\n', (391, 477), False, 'from algorithm.hdpview import HDPView\n')] |
import requests
import json
from django.conf import settings
def Check_rich_munu_to_user (userId):
LINE_API = 'https://api.line.me/v2/bot/user/' + Main_rich_memu_id + '/richmenu'
PARAMS = {'userId' : userId}
Authorization = 'Bearer {}'.format(Channel_access_token)
headers = {'Authorization': Authoriza... | [
"requests.post",
"requests.get",
"requests.delete"
] | [((335, 389), 'requests.get', 'requests.get', (['LINE_API'], {'headers': 'headers', 'params': 'PARAMS'}), '(LINE_API, headers=headers, params=PARAMS)\n', (347, 389), False, 'import requests\n'), ((857, 912), 'requests.post', 'requests.post', (['LINE_API'], {'headers': 'headers', 'params': 'PARAMS'}), '(LINE_API, header... |
from random import randint
from main.custom_types import RequestT
from main.custom_types import ResponseT
from main.util import render_template
TEMPLATE = "index.html"
def handler(_request: RequestT) -> ResponseT:
context = {"random_number": randint(100000, 999999)}
document = render_template(TEMPLATE, con... | [
"random.randint",
"main.custom_types.ResponseT",
"main.util.render_template"
] | [((291, 325), 'main.util.render_template', 'render_template', (['TEMPLATE', 'context'], {}), '(TEMPLATE, context)\n', (306, 325), False, 'from main.util import render_template\n'), ((342, 369), 'main.custom_types.ResponseT', 'ResponseT', ([], {'payload': 'document'}), '(payload=document)\n', (351, 369), False, 'from ma... |
#!/usr/bin/python3
"""FileStorage module"""
import json
from models.base_model import BaseModel
from models.user import User
from models.state import State
from models.city import City
from models.amenity import Amenity
from models.place import Place
from models.review import Review
class FileStorage:
"""class Fi... | [
"json.load",
"json.dumps"
] | [((1182, 1202), 'json.dumps', 'json.dumps', (['obj_dict'], {}), '(obj_dict)\n', (1192, 1202), False, 'import json\n'), ((1500, 1512), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1509, 1512), False, 'import json\n')] |
import os
import unittest
from textwrap import dedent
from unittest import mock
from unittest.mock import patch
from codecarbon.core.config import (
clean_env_key,
get_hierarchical_config,
parse_env_config,
parse_gpu_ids,
)
from codecarbon.emissions_tracker import EmissionsTracker
from tests.testutils ... | [
"textwrap.dedent",
"codecarbon.core.config.parse_gpu_ids",
"tests.testutils.get_custom_mock_open",
"unittest.mock.patch.dict",
"codecarbon.emissions_tracker.EmissionsTracker",
"codecarbon.core.config.clean_env_key",
"codecarbon.core.config.parse_env_config",
"codecarbon.core.config.get_hierarchical_co... | [((1244, 1368), 'unittest.mock.patch.dict', 'mock.patch.dict', (['os.environ', "{'USER': 'yes', 'CODECARBON_TEST': 'test-VALUE', 'CODECARBON_TEST_KEY':\n 'this_other_value'}"], {}), "(os.environ, {'USER': 'yes', 'CODECARBON_TEST': 'test-VALUE',\n 'CODECARBON_TEST_KEY': 'this_other_value'})\n", (1259, 1368), False... |
# Importing Library and creating Socket Instance
import socket
s = socket.socket()
print ("Socket successfully created")
#Port
port = 5056
s.bind(('127.0.0.1', port))
#It can listen upto 5 connection
s.listen(5)
print ("socket is listening" )
wh... | [
"socket.socket"
] | [((83, 98), 'socket.socket', 'socket.socket', ([], {}), '()\n', (96, 98), False, 'import socket\n')] |
import unittest
import translator
class TestTranslate(unittest.TestCase):
def test_translateReturnZero(self):
self.assertEqual(translator.translate(0), "zero")
self.assertEqual(translator.translate(00000), "zero")
self.assertEqual(translator.translate(-0), "zero")
self.assertEqual(... | [
"unittest.main",
"translator.translate"
] | [((4477, 4492), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4490, 4492), False, 'import unittest\n'), ((141, 164), 'translator.translate', 'translator.translate', (['(0)'], {}), '(0)\n', (161, 164), False, 'import translator\n'), ((199, 222), 'translator.translate', 'translator.translate', (['(0)'], {}), '(0)\... |
import json
import re
from datetime import timedelta
from types import SimpleNamespace
from janny.config import API_HOST
from janny.auth import SESSION
def get(path: str) -> SimpleNamespace:
"""Convert a JSON response into a Python object"""
s = SESSION
data = s.get(API_HOST + path).content
obj = jso... | [
"datetime.timedelta",
"types.SimpleNamespace",
"re.compile"
] | [((515, 557), 're.compile', 're.compile', (['timedelta_regex', 're.IGNORECASE'], {}), '(timedelta_regex, re.IGNORECASE)\n', (525, 557), False, 'import re\n'), ((995, 1007), 'datetime.timedelta', 'timedelta', (['(0)'], {}), '(0)\n', (1004, 1007), False, 'from datetime import timedelta\n'), ((965, 983), 'datetime.timedel... |
from textwrap import wrap
import os.path
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
from pickle import dump as pickle_dump
from datetime import datetime
import numpy as np
import seaborn as sns
DPI = 120 #: DPI to use for the figures
FIGSIZE = (16, 9) #: Figure size,... | [
"pickle.dump",
"matplotlib.pyplot.savefig",
"seaborn.color_palette",
"seaborn.husl_palette",
"matplotlib.pyplot.close",
"matplotlib.pyplot.get_current_fig_manager",
"seaborn.hls_palette",
"matplotlib.pyplot.show"
] | [((1442, 1471), 'matplotlib.pyplot.get_current_fig_manager', 'plt.get_current_fig_manager', ([], {}), '()\n', (1469, 1471), True, 'import matplotlib.pyplot as plt\n'), ((955, 987), 'seaborn.color_palette', 'sns.color_palette', (['"""viridis"""', 'nb'], {}), "('viridis', nb)\n", (972, 987), True, 'import seaborn as sns\... |
import numpy as np
import pandas as pd
import dask.dataframe as dd
import dask.array as da
import matplotlib.pyplot as plt
import seaborn as sns
from dask.diagnostics import ProgressBar
ProgressBar().register()
dists = np.load('saved_tensors/java-huge-bpe-2000/test_proj_dist_cache.npy')
ranks = np.load('saved_tensors/... | [
"dask.array.stack",
"dask.array.from_array",
"matplotlib.pyplot.savefig",
"seaborn.scatterplot",
"dask.diagnostics.ProgressBar",
"numpy.load",
"matplotlib.pyplot.subplots",
"numpy.arange",
"dask.dataframe.from_array"
] | [((220, 288), 'numpy.load', 'np.load', (['"""saved_tensors/java-huge-bpe-2000/test_proj_dist_cache.npy"""'], {}), "('saved_tensors/java-huge-bpe-2000/test_proj_dist_cache.npy')\n", (227, 288), True, 'import numpy as np\n'), ((297, 365), 'numpy.load', 'np.load', (['"""saved_tensors/java-huge-bpe-2000/test_proj_rank_cach... |
import argparse
import keras.backend as K
from keras.layers import Input, Conv2D, Add
from keras.models import Model
from keras.utils import plot_model
import utils
from config import img_size, channel, kernel
def build_model(scale, num_layers=32, feature_size=256, scaling_factor=0.1):
input_tensor = Input(shap... | [
"keras.layers.Conv2D",
"utils.upsample",
"argparse.ArgumentParser",
"utils.res_block",
"keras.utils.plot_model",
"keras.layers.Input",
"keras.models.Model",
"keras.backend.clear_session",
"keras.layers.Add"
] | [((310, 352), 'keras.layers.Input', 'Input', ([], {'shape': '(img_size, img_size, channel)'}), '(shape=(img_size, img_size, channel))\n', (315, 352), False, 'from keras.layers import Input, Conv2D, Add\n'), ((1835, 1873), 'utils.upsample', 'utils.upsample', (['x', 'scale', 'feature_size'], {}), '(x, scale, feature_size... |
import os
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def check_ver_func():
test = os.popen('youtube-dl --version').read()
prin... | [
"os.popen"
] | [((272, 304), 'os.popen', 'os.popen', (['"""youtube-dl --version"""'], {}), "('youtube-dl --version')\n", (280, 304), False, 'import os\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from pykg2vec.core.KGMeta import ModelMeta
class TransD(ModelMeta):
""" `Knowledge Graph Embedding via Dynamic Mapping Matrix`_
... | [
"tensorflow.nn.embedding_lookup",
"tensorflow.nn.l2_normalize",
"tensorflow.placeholder",
"tensorflow.reduce_sum",
"tensorflow.nn.top_k",
"tensorflow.contrib.layers.xavier_initializer",
"tensorflow.name_scope",
"tensorflow.maximum",
"tensorflow.expand_dims",
"tensorflow.squeeze",
"tensorflow.abs... | [((2307, 2339), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[None]'], {}), '(tf.int32, [None])\n', (2321, 2339), True, 'import tensorflow as tf\n'), ((2361, 2393), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[None]'], {}), '(tf.int32, [None])\n', (2375, 2393), True, 'import tensorflow as t... |
from datetime import datetime
import peewee
from bolt.database import EnumField, Model
from .types import InfractionType
class Infraction(Model):
guild_id = peewee.BigIntegerField()
created_on = peewee.DateTimeField(default=datetime.utcnow)
edited_on = peewee.DateTimeField(default=None, null=True) # ON... | [
"peewee.DateTimeField",
"peewee.CharField",
"bolt.database.EnumField",
"peewee.BigIntegerField"
] | [((165, 189), 'peewee.BigIntegerField', 'peewee.BigIntegerField', ([], {}), '()\n', (187, 189), False, 'import peewee\n'), ((207, 252), 'peewee.DateTimeField', 'peewee.DateTimeField', ([], {'default': 'datetime.utcnow'}), '(default=datetime.utcnow)\n', (227, 252), False, 'import peewee\n'), ((269, 314), 'peewee.DateTim... |
import cld3
def detect_language(text: str) -> str:
prediction = cld3.get_language(text)
if prediction and prediction.is_reliable:
return prediction.language
| [
"cld3.get_language"
] | [((70, 93), 'cld3.get_language', 'cld3.get_language', (['text'], {}), '(text)\n', (87, 93), False, 'import cld3\n')] |
import pitch
p = pitch.find_pitch(r'"D:\project\Cornell-Birdcall-Identification\data\birdsong-recognition\train_audio_resampled\aldfly\XC2628.wav"')
print('pitch =', p) | [
"pitch.find_pitch"
] | [((18, 165), 'pitch.find_pitch', 'pitch.find_pitch', (['""""D:\\\\project\\\\Cornell-Birdcall-Identification\\\\data\\\\birdsong-recognition\\\\train_audio_resampled\\\\aldfly\\\\XC2628.wav\\""""'], {}), '(\n \'"D:\\\\project\\\\Cornell-Birdcall-Identification\\\\data\\\\birdsong-recognition\\\\train_audio_resampled... |
import base64
import time
import hashlib
import json
from tqdm import tqdm
from DB import DB
import sys
sys.path.append('../../caller/')
from utils import get_transaction_info
from ST import ServiceToken
from NFT import NFT
class Fantopia:
def __init__(
self,
owner: dict,
config: dict,
... | [
"ST.ServiceToken",
"json.dumps",
"time.sleep",
"DB.DB",
"json.load",
"utils.get_transaction_info",
"NFT.NFT",
"sys.path.append",
"pprint.pprint"
] | [((106, 138), 'sys.path.append', 'sys.path.append', (['"""../../caller/"""'], {}), "('../../caller/')\n", (121, 138), False, 'import sys\n'), ((6631, 6642), 'pprint.pprint', 'pprint', (['res'], {}), '(res)\n', (6637, 6642), False, 'from pprint import pprint\n'), ((587, 621), 'NFT.NFT', 'NFT', (['self.tokenType', 'owner... |
from app.utils.permissions import IsBotPermission
from django.contrib.auth import get_user_model
from rest_framework import status
from rest_framework.decorators import action
from rest_framework.mixins import ListModelMixin, RetrieveModelMixin, UpdateModelMixin
from rest_framework.response import Response
from rest_fr... | [
"django.contrib.auth.get_user_model",
"rest_framework.response.Response",
"rest_framework.decorators.action"
] | [((408, 424), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (422, 424), False, 'from django.contrib.auth import get_user_model\n'), ((774, 811), 'rest_framework.decorators.action', 'action', ([], {'detail': '(False)', 'methods': "['GET']"}), "(detail=False, methods=['GET'])\n", (780, 811), F... |
"""
main.py
"""
import re
import os
import os.path
import sys
import multiprocessing
import importlib
import os.path
import timeit
import cProfile
import tsscraper
class Application(object):
thread_count = 8
threads = None
target_directory = None
target_exporter = None
def print_usage(sel... | [
"tsscraper.TSScraper",
"importlib.import_module",
"os.path.splitext",
"os.path.isdir",
"os.mkdir",
"timeit.timeit",
"os.walk"
] | [((600, 620), 'os.walk', 'os.walk', (['"""exporters"""'], {}), "('exporters')\n", (607, 620), False, 'import os\n'), ((2688, 2763), 'tsscraper.TSScraper', 'tsscraper.TSScraper', (['self.target_directory', 'self.thread_count', 'base_results'], {}), '(self.target_directory, self.thread_count, base_results)\n', (2707, 276... |
import pymysql.cursors
import json
from decimal import *
import time
connection = pymysql.connect(host='localhost',
user='root',
passwd='<PASSWORD>',
db='gotham',
charset='utf8mb4',
... | [
"json.loads"
] | [((463, 484), 'json.loads', 'json.loads', (['json_data'], {}), '(json_data)\n', (473, 484), False, 'import json\n')] |
from websocket import create_connection
import requests, json, threading, select, multiprocessing, time, os
from datetime import datetime
class User:
def __init__(self, user_id, username, avatar, discriminator, public_flags, nick=None):
self.user_id = user_id
self.username = username
self.n... | [
"multiprocessing.Queue",
"requests.Session",
"json.loads"
] | [((1213, 1231), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1229, 1231), False, 'import requests, json, threading, select, multiprocessing, time, os\n'), ((1383, 1406), 'multiprocessing.Queue', 'multiprocessing.Queue', ([], {}), '()\n', (1404, 1406), False, 'import requests, json, threading, select, mult... |
"""
Django settings for production environment.
"""
from .settings import *
# Disable debug mode
DEBUG = False
# Restrict allowed hosts
ALLOWED_HOSTS = [
'127.0.0.1',
'localhost',
'playlists.eu-west-2.elasticbeanstalk.com',
'playlists.ml',
'playlists.xor.pt',
'playlists-app.herokuapp.com'
]
... | [
"django.utils.crypto.get_random_string"
] | [((773, 801), 'django.utils.crypto.get_random_string', 'get_random_string', (['(50)', 'chars'], {}), '(50, chars)\n', (790, 801), False, 'from django.utils.crypto import get_random_string\n')] |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import mock
import pytest
from swagger_spec_compatibility.util import EntityMapping
from swagger_spec_compatibility.util import is_path_in_top_level_paths
from swagger_spec_comp... | [
"pytest.mark.parametrize",
"swagger_spec_compatibility.util.is_path_in_top_level_paths",
"swagger_spec_compatibility.util.wrap",
"swagger_spec_compatibility.util.EntityMapping"
] | [((350, 618), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""input_string, width, expected_result"""', '[(\'this is a string\', 50, \'this is a string\'), (\'this is a string\', 5,\n """this\nis a\nstring"""), (\'this is a string\', 5,\n """this\nis a\nstring"""), (\'this_is_a_string\', 5, \'this_is... |
import cv2
import numpy as np
from pathfinding.domain.coord import Coord
from vision.domain.iCameraCalibration import ICameraCalibration, table_width_mm, table_height_mm, obstacle_height_mm, \
robot_height_mm
from vision.domain.iPlayAreaFinder import IPlayAreaFinder
from vision.domain.image import Image
from visio... | [
"numpy.multiply",
"vision.infrastructure.cvImageDisplay.CvImageDisplay",
"cv2.undistort",
"pathfinding.domain.coord.Coord",
"cv2.getOptimalNewCameraMatrix",
"numpy.array",
"numpy.linalg.inv"
] | [((665, 681), 'vision.infrastructure.cvImageDisplay.CvImageDisplay', 'CvImageDisplay', ([], {}), '()\n', (679, 681), False, 'from vision.infrastructure.cvImageDisplay import CvImageDisplay\n'), ((870, 983), 'cv2.getOptimalNewCameraMatrix', 'cv2.getOptimalNewCameraMatrix', (['self._camera_matrix', 'self._distortion_coef... |
import json
import os
import random
import requests
import sys
import time
CHAIN_API_KEY = os.environ.get('CHAIN_API_KEY', None)
CHAIN_API_SECRET = os.environ.get('CHAIN_API_SECRET', None)
def get_from_chain(url_adder):
url = 'https://api.chain.com/v2/bitcoin/%s' % (url_adder)
ok = False
while not ok:
... | [
"json.loads",
"random.randrange",
"os.environ.get",
"requests.get",
"time.sleep",
"json.dump"
] | [((92, 129), 'os.environ.get', 'os.environ.get', (['"""CHAIN_API_KEY"""', 'None'], {}), "('CHAIN_API_KEY', None)\n", (106, 129), False, 'import os\n'), ((149, 189), 'os.environ.get', 'os.environ.get', (['"""CHAIN_API_SECRET"""', 'None'], {}), "('CHAIN_API_SECRET', None)\n", (163, 189), False, 'import os\n'), ((690, 708... |
#!/usr/bin/env python
import sys, os
import argparse
import numpy as np
#import atomsinmolecule as mol
import topology as topo
import math
import pandas as pd
class topologyDiff(object):
def __init__(self, molecule1, molecule2, covRadFactor=1.3):
errors = {}
requirements_for_comparison(molecule1, ... | [
"argparse.FileType",
"topology.topology",
"argparse.ArgumentParser",
"json.dumps",
"xyz2molecule.parse_XYZ",
"numpy.subtract",
"numpy.array",
"numpy.sign",
"sys.exit",
"pandas.DataFrame"
] | [((11784, 11809), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (11807, 11809), False, 'import argparse\n'), ((13567, 13595), 'xyz2molecule.parse_XYZ', 'xyz.parse_XYZ', (['path_to_file1'], {}), '(path_to_file1)\n', (13580, 13595), True, 'import xyz2molecule as xyz\n'), ((13612, 13640), 'xyz2mo... |
from jsonobject import (BooleanProperty, DefaultProperty, IntegerProperty,
JsonObject, ListProperty, StringProperty)
class TlsResult(JsonObject):
ips_scanned = IntegerProperty()
protocols = ListProperty(StringProperty())
hsts_present = BooleanProperty()
trusted = BooleanPropert... | [
"jsonobject.StringProperty",
"jsonobject.BooleanProperty",
"jsonobject.DefaultProperty",
"jsonobject.IntegerProperty"
] | [((190, 207), 'jsonobject.IntegerProperty', 'IntegerProperty', ([], {}), '()\n', (205, 207), False, 'from jsonobject import BooleanProperty, DefaultProperty, IntegerProperty, JsonObject, ListProperty, StringProperty\n'), ((274, 291), 'jsonobject.BooleanProperty', 'BooleanProperty', ([], {}), '()\n', (289, 291), False, ... |
from __future__ import print_function
from urllib.request import Request, urlopen
import urllib
base_uri = 'http://127.0.0.1:8000?text='
def coref(text, no_detail=False):
def get_raw_data_from_web(a_uri):
req = Request(a_uri, headers={'User-Agent': 'PythonBook/1.0'})
http_response = urlopen(req)
data ... | [
"urllib.request.Request",
"urllib.parse.quote",
"urllib.request.urlopen"
] | [((377, 410), 'urllib.parse.quote', 'urllib.parse.quote', (['text'], {'safe': '""""""'}), "(text, safe='')\n", (395, 410), False, 'import urllib\n'), ((221, 277), 'urllib.request.Request', 'Request', (['a_uri'], {'headers': "{'User-Agent': 'PythonBook/1.0'}"}), "(a_uri, headers={'User-Agent': 'PythonBook/1.0'})\n", (22... |
# coding: utf-8
from dl_core import db
import sqlalchemy.exc as SA
def init_db():
db.create_all()
def _already_exist(db_model, obj, data):
row = db.session.using_bind("slave").query(db_model).filter(obj == data).first()
if row:
return True
else:
return False
def already_exist(db_model, ... | [
"dl_core.db.String",
"dl_core.db.Column",
"dl_core.db.session.using_bind",
"dl_core.db.Enum",
"dl_core.db.relationship",
"dl_core.db.create_all",
"dl_core.db.ForeignKey"
] | [((86, 101), 'dl_core.db.create_all', 'db.create_all', ([], {}), '()\n', (99, 101), False, 'from dl_core import db\n'), ((1913, 1968), 'dl_core.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)', 'info': '"""데이터 인덱스"""'}), "(db.Integer, primary_key=True, info='데이터 인덱스')\n", (1922, 1968), False, 'from dl... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-02-29 11:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('iiits', '0005_auto_20160228_1200'),
]
operations = [
migrations.CreateModel(
... | [
"django.db.models.TextField",
"django.db.models.FileField",
"django.db.models.DateTimeField",
"django.db.models.AutoField",
"django.db.models.ImageField",
"django.db.models.CharField"
] | [((1048, 1108), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""/static/iiits/images/faculty/"""'}), "(upload_to='/static/iiits/images/faculty/')\n", (1065, 1108), False, 'from django.db import migrations, models\n'), ((388, 481), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_... |
from django.http import HttpResponse
from django.views import View
import json
class StatusView(View):
def get(self, request, format=None):
response_object = {
"status": "running"
}
return HttpResponse(json.dumps(response_object))
| [
"json.dumps"
] | [((244, 271), 'json.dumps', 'json.dumps', (['response_object'], {}), '(response_object)\n', (254, 271), False, 'import json\n')] |
import pandas as pd
import torch
from torch.utils.data import Dataset
from typing import Tuple, List, Callable
class Corpus(Dataset):
"""Corpus class"""
def __init__(self, filepath: str, transform_fn: Callable[[str], List[int]]) -> None:
"""Instantiating Corpus class
Args:
filepat... | [
"torch.tensor",
"pandas.read_csv"
] | [((451, 482), 'pandas.read_csv', 'pd.read_csv', (['filepath'], {'sep': '"""\t"""'}), "(filepath, sep='\\t')\n", (462, 482), True, 'import pandas as pd\n'), ((842, 868), 'torch.tensor', 'torch.tensor', (['is_duplicate'], {}), '(is_duplicate)\n', (854, 868), False, 'import torch\n'), ((772, 789), 'torch.tensor', 'torch.t... |
import numpy as np
import cv2 as cv
def visualizador(complexo_img):
magnitude = np.log(np.abs(complexo_img) + 10**-10)
magnitude = magnitude / np.max(magnitude)
fase = (np.angle(complexo_img) + np.pi) / (np.pi * 2)
return magnitude, fase
def dft_np(img, vis=False, shift=False):
complexo = np.f... | [
"numpy.sqrt",
"numpy.log",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.getBuildInformation",
"numpy.tanh",
"numpy.fft.fft2",
"numpy.max",
"numpy.real",
"numpy.exp",
"numpy.min",
"cv2.waitKey",
"numpy.abs",
"cv2.cvtColor",
"cv2.createTrackbar",
"cv2.namedWindow",
"numpy.fft.ifft2",
... | [((316, 332), 'numpy.fft.fft2', 'np.fft.fft2', (['img'], {}), '(img)\n', (327, 332), True, 'import numpy as np\n'), ((650, 672), 'numpy.fft.ifft2', 'np.fft.ifft2', (['complexo'], {}), '(complexo)\n', (662, 672), True, 'import numpy as np\n'), ((683, 700), 'numpy.real', 'np.real', (['img_comp'], {}), '(img_comp)\n', (69... |
"""
Created on Mon Apr 23 16:35:00 2018
@author: jercas
"""
import numpy as np
def stepBased_decay(epoch):
# Initialize the base initial learning rate α, drop factor and epochs to drop every set of epochs.
initialAlpha = 0.01
# Drop learning rate by a factor of 0.25 every 5 epochs.
factor = 0.5
#factor = 0.5
dr... | [
"numpy.floor"
] | [((416, 449), 'numpy.floor', 'np.floor', (['((1 + epoch) / dropEvery)'], {}), '((1 + epoch) / dropEvery)\n', (424, 449), True, 'import numpy as np\n')] |
from django.db import models
class HashTag(models.Model):
name = models.CharField(primary_key=True, max_length=20)
def __str__(self):
return self.name
class MBTI(models.Model):
name = models.CharField(primary_key=True, max_length=20)
def __str__(self):
return self.name
class Part... | [
"django.db.models.IntegerField",
"django.db.models.ManyToManyField",
"django.db.models.BigAutoField",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((71, 120), 'django.db.models.CharField', 'models.CharField', ([], {'primary_key': '(True)', 'max_length': '(20)'}), '(primary_key=True, max_length=20)\n', (87, 120), False, 'from django.db import models\n'), ((209, 258), 'django.db.models.CharField', 'models.CharField', ([], {'primary_key': '(True)', 'max_length': '(... |
"""개미집단 최적화
"""
import matplotlib.pyplot as plt
import numpy as np
area = np.ones([20, 20]) # 지역 생성
start = (1, 1) # 개미 출발지점
goal = (19, 14) # 도착해야 하는 지점
path_count = 40 # 경로를 만들 개미 수
path_max_len = 20 * 20 # 최대 경로 길이
pheromone = 1.0 # 페로몬 가산치
volatility = 0.3 # 스탭 당 페로몬 휘발율
def get_neighbors(x, y):
"""x... | [
"matplotlib.pyplot.imshow",
"numpy.ones",
"matplotlib.pyplot.plot",
"numpy.array",
"numpy.sum",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show"
] | [((75, 92), 'numpy.ones', 'np.ones', (['[20, 20]'], {}), '([20, 20])\n', (82, 92), True, 'import numpy as np\n'), ((1752, 1782), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y', '"""b"""'], {'alpha': '(0.3)'}), "(x, y, 'b', alpha=0.3)\n", (1760, 1782), True, 'import matplotlib.pyplot as plt\n'), ((1787, 1820), 'matplo... |
import pytest
import numpy as np
import multiprocess as mp
from ecogdata.parallel.jobrunner import JobRunner, ParallelWorker
from ecogdata.parallel.mproc import parallel_context
from . import with_start_methods
@with_start_methods
def test_process_types():
jr = JobRunner(np.var)
# create 3 workers and check t... | [
"numpy.random.randint",
"pytest.raises",
"numpy.isnan",
"ecogdata.parallel.jobrunner.JobRunner",
"numpy.arange"
] | [((268, 285), 'ecogdata.parallel.jobrunner.JobRunner', 'JobRunner', (['np.var'], {}), '(np.var)\n', (277, 285), False, 'from ecogdata.parallel.jobrunner import JobRunner, ParallelWorker\n'), ((955, 985), 'ecogdata.parallel.jobrunner.JobRunner', 'JobRunner', (['np.sum'], {'n_workers': '(4)'}), '(np.sum, n_workers=4)\n',... |