code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pygame
WHITE = (48, 48, 48)
displaywidth = 470
displayheight = 840
displayobj = None
clock = None
imgbackA = pygame.image.load('image/back.png')
imgbackB = imgbackA.copy()
def iotsetcaption(caption):
pygame.display.set_caption(caption)
def iotbackdraw(image, x, y):
global... | [
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.init",
"pygame.display.update",
"pygame.image.load",
"pygame.display.set_caption",
"pygame.time.Clock",
"pygame.key.get_pressed"
] | [((142, 177), 'pygame.image.load', 'pygame.image.load', (['"""image/back.png"""'], {}), "('image/back.png')\n", (159, 177), False, 'import pygame\n'), ((243, 278), 'pygame.display.set_caption', 'pygame.display.set_caption', (['caption'], {}), '(caption)\n', (269, 278), False, 'import pygame\n'), ((1070, 1083), 'pygame.... |
import inspect
from django.http.response import JsonResponse
from django.shortcuts import render, redirect
from django.contrib.auth import login, logout
from django.http import HttpResponseBadRequest
from Login.models import M_User, T_Attr
from utils.make_display_data import make_user_config_data
from utils.nee... | [
"utils.make_display_data.make_user_config_data",
"Login.models.M_User",
"Login.models.T_Attr.objects.filter",
"Login.models.T_Attr.objects.get",
"Login.models.M_User.objects.filter",
"django.shortcuts.redirect",
"django.http.response.JsonResponse",
"django.http.HttpResponseBadRequest",
"Login.models... | [((3320, 3392), 'utils.need_login.need_login', 'need_login', ([], {'redirect_field_name': '"""index.html"""', 'err_msg': '"""サインアップ、ログインが必要です"""'}), "(redirect_field_name='index.html', err_msg='サインアップ、ログインが必要です')\n", (3330, 3392), False, 'from utils.need_login import need_login\n'), ((3285, 3315), 'django.shortcuts.ren... |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
target = ["True", "False"]
el_decay = ["True", "False"]
error = np.array([[4.478, 3.483],
[3.647, 2.502]])
fig, ax = plt.subplots()
im = ax.imshow(error)
# We want to show all ticks...
ax.set_xticks(np.arange(len(el_decay)))
a... | [
"numpy.array",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((135, 177), 'numpy.array', 'np.array', (['[[4.478, 3.483], [3.647, 2.502]]'], {}), '([[4.478, 3.483], [3.647, 2.502]])\n', (143, 177), True, 'import numpy as np\n'), ((210, 224), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (222, 224), True, 'import matplotlib.pyplot as plt\n'), ((986, 996), 'matpl... |
# Import from system libraries
from flask_mongoengine import MongoEngine
# MongoEngine load to db variable
db = MongoEngine()
# Function to initialize db to app
def initialize_db(app):
db.init_app(app)
| [
"flask_mongoengine.MongoEngine"
] | [((113, 126), 'flask_mongoengine.MongoEngine', 'MongoEngine', ([], {}), '()\n', (124, 126), False, 'from flask_mongoengine import MongoEngine\n')] |
"""Provide variant calling with VarScan from TGI at Wash U.
http://varscan.sourceforge.net/
"""
import os
import sys
from bcbio import broad, utils
from bcbio.distributed.transaction import file_transaction, tx_tmpdir
from bcbio.pipeline import config_utils
from bcbio.provenance import do
from bcbio.variation import... | [
"os.remove",
"bcbio.variation.samtools.prep_mpileup",
"bcbio.variation.vcfutils.fix_ambiguous_cl",
"bcbio.pipeline.config_utils.adjust_opts",
"bcbio.utils.local_path_export",
"bcbio.distributed.transaction.tx_tmpdir",
"bcbio.variation.vcfutils.combine_variant_files",
"bcbio.distributed.transaction.fil... | [((622, 656), 'bcbio.variation.vcfutils.get_paired_bams', 'get_paired_bams', (['align_bams', 'items'], {}), '(align_bams, items)\n', (637, 656), False, 'from bcbio.variation.vcfutils import combine_variant_files, write_empty_vcf, get_paired_bams, bgzip_and_index\n'), ((1546, 1591), 'bcbio.pipeline.config_utils.get_reso... |
from django.db import models
class Deletable(models.Model):
deleted = models.BooleanField(default=False)
def delete(self, *args, **kwargs):
self.deleted = True
return self.save()
class Meta:
abstract = True
| [
"django.db.models.BooleanField"
] | [((76, 110), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (95, 110), False, 'from django.db import models\n')] |
bl_info = {
"name": "RTE Debug",
"author": "<NAME>",
"blender": (2, 75, 0),
"location": "Info header, render engine menu",
"description": "Debug implementation of the Realtime Engine Framework",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"support": 'TESTING',
"category": "... | [
"imp.reload",
"bpy.utils.register_module",
"bpy.utils.unregister_module"
] | [((371, 388), 'imp.reload', 'imp.reload', (['addon'], {}), '(addon)\n', (381, 388), False, 'import imp\n'), ((704, 739), 'bpy.utils.register_module', 'bpy.utils.register_module', (['__name__'], {}), '(__name__)\n', (729, 739), False, 'import bpy\n'), ((1005, 1042), 'bpy.utils.unregister_module', 'bpy.utils.unregister_m... |
import math
def segment_builder(arg, tail):
req_list = arg[0]
divisions = arg[1]
division_dec = divisions / 100
# number of segments to be created in the element passed
partition_count = int(math.ceil(100 / divisions))
if len(arg) == 3:
segments = arg[2]
else:
g = int(1... | [
"math.ceil"
] | [((212, 238), 'math.ceil', 'math.ceil', (['(100 / divisions)'], {}), '(100 / divisions)\n', (221, 238), False, 'import math\n')] |
import io
from fastapi import FastAPI
from fastapi.responses import StreamingResponse
from fastapi.staticfiles import StaticFiles
app = FastAPI()
# create a 'static files' directory
# create a '/static' prefix for all files
# serve files from the 'media/' directory under the '/static/' route
# /Big_Buck_Bunny_1080... | [
"fastapi.responses.StreamingResponse",
"fastapi.staticfiles.StaticFiles",
"fastapi.FastAPI"
] | [((138, 147), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (145, 147), False, 'from fastapi import FastAPI\n'), ((436, 466), 'fastapi.staticfiles.StaticFiles', 'StaticFiles', ([], {'directory': '"""media"""'}), "(directory='media')\n", (447, 466), False, 'from fastapi.staticfiles import StaticFiles\n'), ((701, 749),... |
import numpy as np
import copy
class Particle:
def __init__(self, lb, ub):
"""Initialize the particle.
Attributes
----------
lb : float
lower bounds for initial values
ub : float
upper bounds for initial values
"""
self.lb = lb
... | [
"numpy.random.uniform",
"copy.deepcopy",
"numpy.square",
"numpy.array"
] | [((362, 405), 'numpy.random.uniform', 'np.random.uniform', (['lb', 'ub'], {'size': 'lb.shape[0]'}), '(lb, ub, size=lb.shape[0])\n', (379, 405), True, 'import numpy as np\n'), ((430, 473), 'numpy.random.uniform', 'np.random.uniform', (['lb', 'ub'], {'size': 'lb.shape[0]'}), '(lb, ub, size=lb.shape[0])\n', (447, 473), Tr... |
import pygame
from pygame.locals import *
from constants import *
from copy import deepcopy
import numpy as np
from heuristic import *
class Player(object):
def __init__(self, color, player_num):
self.color = color
self.direction = UP
self.player_num = player_num
self.move_counter =... | [
"pygame.draw.rect",
"copy.deepcopy",
"numpy.zeros"
] | [((1204, 1220), 'copy.deepcopy', 'deepcopy', (['player'], {}), '(player)\n', (1212, 1220), False, 'from copy import deepcopy\n'), ((1417, 1478), 'numpy.zeros', 'np.zeros', (['(GAME_HEIGHT / CELL_WIDTH, GAME_WIDTH / CELL_WIDTH)'], {}), '((GAME_HEIGHT / CELL_WIDTH, GAME_WIDTH / CELL_WIDTH))\n', (1425, 1478), True, 'impor... |
import paho.mqtt.client as pmqtt
import paho.mqtt.subscribe as smqtt
import json
import time
import logging
class mqtt:
def __init__(self, broker: str, username: str, password: str, port=1883):
self.client = ""
self.broker = broker
self.port = port
self.username = username
s... | [
"paho.mqtt.client.Client",
"time.sleep",
"logging.debug",
"paho.mqtt.subscribe.callback"
] | [((413, 427), 'paho.mqtt.client.Client', 'pmqtt.Client', ([], {}), '()\n', (425, 427), True, 'import paho.mqtt.client as pmqtt\n'), ((959, 1004), 'logging.debug', 'logging.debug', (['"""Starting the MQTT subscriber"""'], {}), "('Starting the MQTT subscriber')\n", (972, 1004), False, 'import logging\n'), ((1013, 1061), ... |
import re
from typing import Iterator, Tuple
import requests
from bs4 import BeautifulSoup
from ...db.models import BeerDB
from ...db.tables import Shop as DBShop
from . import NoBeersError, NotABeerError, Shop, ShopBeer
DIGITS = set("0123456789")
def keep_until_japanese(text: str) -> str:
chars = []
for ... | [
"bs4.BeautifulSoup",
"re.search",
"requests.get"
] | [((1514, 1551), 're.search', 're.search', (['"""[((]([^))]*)[))]$"""', 'title'], {}), "('[((]([^))]*)[))]$', title)\n", (1523, 1551), False, 'import re\n'), ((1772, 1809), 're.search', 're.search', (['"""税込([0-9,]+)円"""', 'price_text'], {}), "('税込([0-9,]+)円', price_text)\n", (1781, 1809), False, 'import re\n'), ((742, ... |
#= -------------------------------------------------------------------------
# @file hello_world.py
#
# @date 02/14/16 10:41:21
# @author <NAME>
# @email <EMAIL>
#
# @brief
#
# @detail
#
# Licence:
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Lic... | [
"kivy.require",
"kivy.uix.button.Label"
] | [((854, 875), 'kivy.require', 'kivy.require', (['"""1.9.0"""'], {}), "('1.9.0')\n", (866, 875), False, 'import kivy\n'), ((995, 1020), 'kivy.uix.button.Label', 'Label', ([], {'text': '"""Hello World"""'}), "(text='Hello World')\n", (1000, 1020), False, 'from kivy.uix.button import Label\n')] |
import folium as folium
from flask import Flask, render_template
import rethinkdb as rtdb
import os
from dotenv import load_dotenv
import requests
import json
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
def get_route_polyline(route):
# "http://routesapi.chartr.in/transit/... | [
"json.loads",
"flask.Flask",
"rethinkdb.RethinkDB",
"dotenv.load_dotenv",
"folium.Map",
"requests.get",
"flask.render_template",
"folium.PolyLine",
"folium.CircleMarker",
"os.getenv",
"folium.Icon"
] | [((166, 181), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (171, 181), False, 'from flask import Flask, render_template\n'), ((476, 493), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (488, 493), False, 'import requests\n'), ((514, 539), 'json.loads', 'json.loads', (['response.text'], {}), '(... |
from baseconv import BaseConverter, BASE16_ALPHABET
from uuid import UUID, uuid4
BASE = 16
HEX_DOUBLE_WORD_LENGTH = 8
HEX_DOUBLE_WORD_UPPER_BYTE = slice(-HEX_DOUBLE_WORD_LENGTH, -(HEX_DOUBLE_WORD_LENGTH - 2))
MAX_DOUBLE_WORD = (1 << 31)
OLD_BIT_FLAG = 0x80
NEW_BIT_FLAG_MASK = OLD_BIT_FLAG - 1
BASE16 = BaseConverter(BA... | [
"uuid.uuid4",
"baseconv.BASE16_ALPHABET.lower",
"uuid.UUID"
] | [((318, 341), 'baseconv.BASE16_ALPHABET.lower', 'BASE16_ALPHABET.lower', ([], {}), '()\n', (339, 341), False, 'from baseconv import BaseConverter, BASE16_ALPHABET\n'), ((1180, 1305), 'uuid.UUID', 'UUID', (['(replacer1 + myid[HEX_DOUBLE_WORD_LENGTH:-HEX_DOUBLE_WORD_LENGTH] +\n replacer2 + myid[-(HEX_DOUBLE_WORD_LENGT... |
import board
import neopixel
import time
from time import sleep
pixel_pin = board.D18
num_pixels = 8
ORDER = neopixel.RGB
ColorDict = { "black":0x000000, "white":0x101010, "red":0x100000, "blue":0x000010, "green":0x001000, "yellow":0x101000, "orange":0x100600, "pink":0x100508, "teal":0x100508, "teal":0x000808, "purple... | [
"neopixel.NeoPixel",
"time.sleep"
] | [((722, 817), 'neopixel.NeoPixel', 'neopixel.NeoPixel', (['pixel_pin', 'num_pixels'], {'brightness': '(1)', 'auto_write': '(False)', 'pixel_order': 'ORDER'}), '(pixel_pin, num_pixels, brightness=1, auto_write=False,\n pixel_order=ORDER)\n', (739, 817), False, 'import neopixel\n'), ((897, 992), 'neopixel.NeoPixel', '... |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"unittest.main",
"mock.patch.object",
"argparse.Namespace",
"google.appengine.tools.devappserver2.devappserver2.DevelopmentServer._create_module_to_setting",
"platform.system.assert_called_once_with",
"platform.system.assert_not_called",
"google.appengine.tools.devappserver2.devappserver2.DevelopmentSer... | [((2268, 2324), 'mock.patch.object', 'mock.patch.object', (['os.path', '"""exists"""'], {'return_value': '(False)'}), "(os.path, 'exists', return_value=False)\n", (2285, 2324), False, 'import mock\n'), ((2328, 2436), 'mock.patch.object', 'mock.patch.object', (['devappserver2.DevelopmentServer', '"""_correct_datastore_e... |
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from . import views
app_name = 'users'
urlpatterns = [
# ex: /users/signup
url(r'^signup/', views.SignupView.as_view(), name='signup'),
# ex: /users/login
url(r'^login/', auth_views.login, name='login'),
# ex: /use... | [
"django.conf.urls.url"
] | [((257, 303), 'django.conf.urls.url', 'url', (['"""^login/"""', 'auth_views.login'], {'name': '"""login"""'}), "('^login/', auth_views.login, name='login')\n", (260, 303), False, 'from django.conf.urls import url\n'), ((334, 383), 'django.conf.urls.url', 'url', (['"""^logout/"""', 'auth_views.logout'], {'name': '"""log... |
import numpy as np
def to_array(image):
array = np.array(image, dtype=np.float32)[..., :3]
array = array / 255.
return array
def l2_normalize(x, axis=0):
norm = np.linalg.norm(x, axis=axis, keepdims=True)
return x / norm
def distance(a, b):
# Euclidean distance
# return np.linalg.norm(a... | [
"numpy.array",
"numpy.dot",
"numpy.linalg.norm"
] | [((180, 223), 'numpy.linalg.norm', 'np.linalg.norm', (['x'], {'axis': 'axis', 'keepdims': '(True)'}), '(x, axis=axis, keepdims=True)\n', (194, 223), True, 'import numpy as np\n'), ((498, 510), 'numpy.dot', 'np.dot', (['a', 'b'], {}), '(a, b)\n', (504, 510), True, 'import numpy as np\n'), ((53, 86), 'numpy.array', 'np.a... |
# coding: utf-8
#------------------------------
# [从]服务器上报
#------------------------------
import sys
import os
import json
import time
import threading
import subprocess
import shutil
sys.path.append("/usr/local/lib/python2.7/site-packages")
import psutil
root_dir = os.getcwd()
sys.path.append(root_dir + "/class/co... | [
"sys.path.append",
"threading.Thread",
"json.loads",
"os.getcwd",
"os.getloadavg",
"common.getSysKV",
"time.sleep",
"common.getDate",
"common.M",
"sys.setdefaultencoding",
"psutil.cpu_count"
] | [((187, 244), 'sys.path.append', 'sys.path.append', (['"""/usr/local/lib/python2.7/site-packages"""'], {}), "('/usr/local/lib/python2.7/site-packages')\n", (202, 244), False, 'import sys\n'), ((271, 282), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (280, 282), False, 'import os\n'), ((283, 324), 'sys.path.append', 'sys... |
from spydashserver.plugins import PluginConfig
plugin_config = PluginConfig("notes", "notes.Notes", models='notes.models')
| [
"spydashserver.plugins.PluginConfig"
] | [((64, 123), 'spydashserver.plugins.PluginConfig', 'PluginConfig', (['"""notes"""', '"""notes.Notes"""'], {'models': '"""notes.models"""'}), "('notes', 'notes.Notes', models='notes.models')\n", (76, 123), False, 'from spydashserver.plugins import PluginConfig\n')] |
''' control systems - ode simulation
@link https://www.youtube.com/watch?v=yp5x8RMNi7o
'''
import numpy as np
from scipy.integrate import odeint
from matplotlib import pyplot as plt
def sys_ode(x, t):
# set system constants
c = 4 # damping constant
k = 2 # spring stiffness constant
m = 20 # point-mass
F... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"scipy.integrate.odeint",
"matplotlib.pyplot.legend",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid"
] | [((611, 638), 'numpy.arange', 'np.arange', (['t_0', 't_f', 'period'], {}), '(t_0, t_f, period)\n', (620, 638), True, 'import numpy as np\n'), ((645, 671), 'scipy.integrate.odeint', 'odeint', (['sys_ode', 'x_init', 't'], {}), '(sys_ode, x_init, t)\n', (651, 671), False, 'from scipy.integrate import odeint\n'), ((704, 71... |
import random
from fineract.objects.hook import Hook
number = random.randint(0, 10000)
def test_create_hook(fineract):
events = [
{
'actionName': 'DISBURSE',
'entityName': 'LOAN'
},
{
'actionName': 'REPAYMENT',
'entityName': 'LOAN'
... | [
"fineract.objects.hook.Hook.get",
"fineract.objects.hook.Hook.template",
"random.randint"
] | [((64, 88), 'random.randint', 'random.randint', (['(0)', '(10000)'], {}), '(0, 10000)\n', (78, 88), False, 'import random\n'), ((805, 844), 'fineract.objects.hook.Hook.template', 'Hook.template', (['fineract.request_handler'], {}), '(fineract.request_handler)\n', (818, 844), False, 'from fineract.objects.hook import Ho... |
from django.db import models
from django.contrib.postgres.fields import JSONField, ArrayField
from users.models import User
from django.contrib.auth.models import Group
from django.conf import settings
from asset.models import Host, HostGroup
class Line(models.Model):
name = models.CharField(max_length=255, uniqu... | [
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.DateTimeField",
"django.db.models.FilePathField"
] | [((282, 348), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'unique': '(True)', 'verbose_name': 'u"""产品线"""'}), "(max_length=255, unique=True, verbose_name=u'产品线')\n", (298, 348), False, 'from django.db import models\n'), ((368, 429), 'django.db.models.DateTimeField', 'models.DateTimeFi... |
import numpy as np
a_matris = [[2,0,0],
[0,2,0],
[0,0,2]]
x_matris = []
b_matris = [2, 4, 9]
u_a_matris = np.triu(a_matris)
x3 = float(b_matris[2])/u_a_matris[2][2]
x2 = float(b_matris[1] - x3*u_a_matris[1][2])/u_a_matris[1][1]
x1 = float(b_matris[0] - x2*u_a_matris[0][1] - x3*u_a_matris[0][2... | [
"numpy.triu"
] | [((132, 149), 'numpy.triu', 'np.triu', (['a_matris'], {}), '(a_matris)\n', (139, 149), True, 'import numpy as np\n')] |
import os
import logging
import galsim
import galsim.config
import piff
import numpy as np
import ngmix
if ngmix.__version__[0:2] == "v1":
NGMIX_V2 = False
from ngmix.fitting import LMSimple
from ngmix.admom import Admom
else:
NGMIX_V2 = True
from ngmix.fitting import Fitter
from ngmix.admom ... | [
"galsim.config.BuildGSObject",
"numpy.empty",
"numpy.clip",
"numpy.mean",
"ngmix.gmix.make_gmix_model",
"galsim.PixelScale",
"galsim.config.GetAllParams",
"galsim.config.GetInputObj",
"galsim.PositionD",
"galsim.ImageD",
"galsim.config.RegisterObjectType",
"numpy.isfinite",
"numpy.random.Ran... | [((407, 434), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (424, 434), False, 'import logging\n'), ((12281, 12383), 'galsim.config.RegisterObjectType', 'galsim.config.RegisterObjectType', (['"""DES_Piff"""', 'BuildDES_Piff_with_substitute'], {'input_type': '"""des_piff"""'}), "('DES_Pif... |
from django.contrib import admin
from .models import *
admin.site.register(BlogList)
admin.site.register(Blog)
admin.site.register(Comment)
| [
"django.contrib.admin.site.register"
] | [((56, 85), 'django.contrib.admin.site.register', 'admin.site.register', (['BlogList'], {}), '(BlogList)\n', (75, 85), False, 'from django.contrib import admin\n'), ((86, 111), 'django.contrib.admin.site.register', 'admin.site.register', (['Blog'], {}), '(Blog)\n', (105, 111), False, 'from django.contrib import admin\n... |
import json
from io import BytesIO
def test_ping(app):
client = app.test_client()
resp = client.get('/ping')
data = json.loads(resp.data.decode())
assert resp.status_code == 200
assert 'records' in data['message']
assert 'success' in data['status']
def test_add_user(app):
"""Ensure a ne... | [
"io.BytesIO"
] | [((493, 521), 'io.BytesIO', 'BytesIO', (["b'my file contents'"], {}), "(b'my file contents')\n", (500, 521), False, 'from io import BytesIO\n')] |
"""Functions for sending DNS queries and checking recieved answers checking"""
# pylint: disable=C0301
# flake8: noqa
from ipaddress import IPv4Address, IPv6Address
import random
from typing import Iterable, Optional, Set, Union
import dns.message
import dns.flags
import pydnstest.matchpart
import pydnstest.mock_cli... | [
"random.randint"
] | [((2650, 2670), 'random.randint', 'random.randint', (['(0)', '(1)'], {}), '(0, 1)\n', (2664, 2670), False, 'import random\n')] |
from django.conf.urls import url
from django.urls import path
from . import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('', views.index, name='index'),
path('login/', views.login, name='login'),
] | [
"django.urls.path"
] | [((181, 216), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (185, 216), False, 'from django.urls import path\n'), ((222, 263), 'django.urls.path', 'path', (['"""login/"""', 'views.login'], {'name': '"""login"""'}), "('login/', views.login, name='l... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2015, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#----------------------------------------... | [
"flask.flash",
"flask.session.pop",
"uuid.uuid4",
"flask.session.get",
"flask.request.values.get",
"flask.jsonify",
"flask.url_for",
"flask.render_template",
"logging.getLogger"
] | [((438, 465), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (455, 465), False, 'import logging\n'), ((5278, 5307), 'flask.session.get', 'session.get', (['"""username"""', 'None'], {}), "('username', None)\n", (5289, 5307), False, 'from flask import request, session, flash, redirect, url_... |
from wtforms import StringField, validators
from kaira.app import App
from kaira.response import response
from kaira.wtf import KairaForm
app = App()
class SigninForm(KairaForm):
username = StringField('Username', [validators.Length(min=4, max=25)])
password = StringField('Password', [validators.Length(mi... | [
"wtforms.validators.Length",
"kaira.app.App",
"kaira.response.response.text",
"kaira.response.response.template",
"kaira.response.response.redirect"
] | [((148, 153), 'kaira.app.App', 'App', ([], {}), '()\n', (151, 153), False, 'from kaira.app import App\n'), ((526, 571), 'kaira.response.response.template', 'response.template', (['"""boostrap.html"""'], {'form': 'form'}), "('boostrap.html', form=form)\n", (543, 571), False, 'from kaira.response import response\n'), ((6... |
# 调整图像,使其累积直方图与另一幅图像相匹配,各个通道独立匹配。
import matplotlib.pyplot as plt
from skimage import data, img_as_float, io
from skimage import exposure
from skimage.exposure import match_histograms
reference = io.imread('/home/qiao/PythonProjects/Scikit-image_On_CT/Test_Img/9.jpg')
image = io.imread('/home/qiao/PythonProjects/Sci... | [
"skimage.exposure.match_histograms",
"matplotlib.pyplot.show",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.tight_layout",
"skimage.io.imread"
] | [((198, 270), 'skimage.io.imread', 'io.imread', (['"""/home/qiao/PythonProjects/Scikit-image_On_CT/Test_Img/9.jpg"""'], {}), "('/home/qiao/PythonProjects/Scikit-image_On_CT/Test_Img/9.jpg')\n", (207, 270), False, 'from skimage import data, img_as_float, io\n'), ((280, 353), 'skimage.io.imread', 'io.imread', (['"""/home... |
import logging
import os
from datetime import datetime
import tempfile
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
from apimetrics_agent import VERSION
from .controller import handle_api_request
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
cl... | [
"tempfile.NamedTemporaryFile",
"os.remove",
"requests.adapters.HTTPAdapter",
"requests.Session",
"datetime.datetime.utcnow",
"urllib3.util.retry.Retry",
"logging.getLogger"
] | [((256, 283), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (273, 283), False, 'import logging\n'), ((3681, 3699), 'requests.Session', 'requests.Session', ([], {}), '()\n', (3697, 3699), False, 'import requests\n'), ((3718, 3825), 'urllib3.util.retry.Retry', 'Retry', ([], {'total': '(5)'... |
from django.contrib import admin
from .models import (Assignment, CourseDocuments, CourseVideo, Forum,
ForumReply, Quiz, QuizQuestion, QuizResult, StudentAnswer,
StudentAssignment)
admin.site.register(CourseDocuments)
admin.site.register(CourseVideo)
admin.site.register(Quiz)... | [
"django.contrib.admin.site.register"
] | [((225, 261), 'django.contrib.admin.site.register', 'admin.site.register', (['CourseDocuments'], {}), '(CourseDocuments)\n', (244, 261), False, 'from django.contrib import admin\n'), ((262, 294), 'django.contrib.admin.site.register', 'admin.site.register', (['CourseVideo'], {}), '(CourseVideo)\n', (281, 294), False, 'f... |
from tempfile import mkdtemp
import hashlib
from shutil import rmtree, copy
import os
import os.path
import subprocess
import struct
import sys
import unittest
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric.utils import Prehashed
from cryptography.hazmat.primiti... | [
"os.mkdir",
"os.walk",
"shutil.rmtree",
"hashlib.sha512",
"os.path.join",
"unittest.main",
"cryptography.hazmat.primitives.asymmetric.ec.ECDSA",
"os.path.abspath",
"cryptography.hazmat.primitives.hashes.SHA256",
"cryptography.hazmat.primitives.hashes.SHA384",
"cryptography.hazmat.primitives.asym... | [((9595, 9617), 'cryptography.hazmat.primitives.asymmetric.utils.Prehashed', 'Prehashed', (['crypto_algo'], {}), '(crypto_algo)\n', (9604, 9617), False, 'from cryptography.hazmat.primitives.asymmetric.utils import Prehashed\n'), ((10391, 10424), 'struct.unpack', 'struct.unpack', (['""">H"""', 'ima_sig[7:9]'], {}), "('>... |
"""
Usage:
arduCryoFridgeCLI.py [--port=<USBportname>] configure [--ontime=<ontime>] [--offtime=<offtime>]
arduCryoFridgeCLI.py [--port=<USBportname>] switch [--on | --off] [--now | --delay=<delay>]
arduCryoFridgeCLI.py [--port=<USBportname>] (-s | --status)
arduCryoFridgeCLI.py [--port=<USBportname>] -q
ardu... | [
"serial.Serial",
"serial.tools.list_ports.comports",
"docopt.docopt"
] | [((1115, 1149), 'serial.tools.list_ports.comports', 'serial.tools.list_ports.comports', ([], {}), '()\n', (1147, 1149), False, 'import serial\n'), ((1806, 1821), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (1812, 1821), False, 'from docopt import docopt\n'), ((1994, 2029), 'serial.Serial', 'serial.Seri... |
import aoc_common as ac
import numpy as np
from aocd.models import Puzzle
puzzle = Puzzle(year=2019, day=11)
ram = [int(x) for x in puzzle.input_data.split(",")]
pointer = 0
relative_base = 0
painting = {(0, 0): 0}
coord = (0, 0)
color = 0 # Part One
color = 1 # Part Two
direction = "N"
our_computer = ac.full_intco... | [
"aoc_common.robot_turner",
"numpy.zeros",
"aoc_common.screen",
"aocd.models.Puzzle"
] | [((84, 109), 'aocd.models.Puzzle', 'Puzzle', ([], {'year': '(2019)', 'day': '(11)'}), '(year=2019, day=11)\n', (90, 109), False, 'from aocd.models import Puzzle\n'), ((960, 977), 'numpy.zeros', 'np.zeros', (['[6, 43]'], {}), '([6, 43])\n', (968, 977), True, 'import numpy as np\n'), ((1042, 1061), 'aoc_common.screen', '... |
"""
This python function is triggered when a new audio file is dropped into the S3 bucket that has
been configured for audio ingestion. It will ensure that no Transcribe job already exists for this
filename, and will then trigger the main Step Functions workflow to process this file.
Copyright Amazon.com, Inc. or its... | [
"pcaconfiguration.isAutoLanguageDetectionSet",
"boto3.client",
"json.dumps",
"pcaconfiguration.generateJobName",
"pcaconfiguration.loadConfiguration"
] | [((540, 562), 'pcaconfiguration.loadConfiguration', 'cf.loadConfiguration', ([], {}), '()\n', (560, 562), True, 'import pcaconfiguration as cf\n'), ((632, 650), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (644, 650), False, 'import boto3\n'), ((1191, 1214), 'pcaconfiguration.generateJobName', 'cf.ge... |
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import os
import plot_voltage
import pdn_params as pdn
from cython.sim_pdn import sim_throttling_wrapper
TEST_LIST_spec=[
"429.mcf",
"433.milc",
"435.gromacs",
"436.cactusADM",
"437.leslie3d",... | [
"plot_voltage.print_power",
"numpy.set_printoptions",
"numpy.copy",
"plot_voltage.get_voltage",
"plot_voltage.get_data",
"plot_voltage.plot",
"matplotlib.use",
"plot_voltage.get_pwr_scaling",
"cython.sim_pdn.sim_throttling_wrapper"
] | [((28, 49), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (42, 49), False, 'import matplotlib\n'), ((899, 1010), 'cython.sim_pdn.sim_throttling_wrapper', 'sim_throttling_wrapper', (['power', 'pwr_throttle', 'THRES', 'L', 'C', 'R', 'VDC', 'CLK', 'CLK_THROTTLE', 'LEADTIME', 'THROTTLE_DUR'], {}), '... |
from django.contrib import auth
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.shortcuts import redirect
from era.utils.functools import unidec, omit
@unidec
def role_required(method, req, *args, **kw):
if req.user.role in kw.get('allow', ... | [
"django.shortcuts.redirect",
"django.contrib.auth.logout",
"era.utils.functools.omit",
"django.core.exceptions.PermissionDenied"
] | [((390, 408), 'django.core.exceptions.PermissionDenied', 'PermissionDenied', ([], {}), '()\n', (406, 408), False, 'from django.core.exceptions import PermissionDenied\n'), ((553, 569), 'django.contrib.auth.logout', 'auth.logout', (['req'], {}), '(req)\n', (564, 569), False, 'from django.contrib import auth\n'), ((652, ... |
""" Test Beacon command """
import json
from f5sdk.cs import ManagementClient
from f5sdk.cs.beacon.insights import InsightsClient
from f5sdk.cs.beacon.declare import DeclareClient
from f5sdk.cs.beacon.token import TokenClient
from f5cli.config import AuthConfigurationClient
from f5cli.commands.cmd_cs import cli
fro... | [
"json.dumps"
] | [((2178, 2229), 'json.dumps', 'json.dumps', (['mock_response'], {'indent': '(4)', 'sort_keys': '(True)'}), '(mock_response, indent=4, sort_keys=True)\n', (2188, 2229), False, 'import json\n'), ((3103, 3154), 'json.dumps', 'json.dumps', (['mock_response'], {'indent': '(4)', 'sort_keys': '(True)'}), '(mock_response, inde... |
import os
import os.path
import sys
import logging
logger = logging.getLogger(__name__)
import numpy as np
import inspect
import datetime
import hashlib
import functools
import h5py
import filelock
import multiprocessing
import itertools
import random
from tqdm.auto import tqdm
#
# utilities for my hdf5 dataset... | [
"h5py.File",
"numpy.void",
"hashlib.sha1",
"os.path.basename",
"filelock.FileLock",
"os.path.dirname",
"numpy.all",
"logging.getLogger",
"inspect.signature",
"phfnbutils.TimeThis",
"numpy.printoptions",
"numpy.issubdtype"
] | [((61, 88), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (78, 88), False, 'import logging\n'), ((19202, 19224), 'inspect.signature', 'inspect.signature', (['fun'], {}), '(fun)\n', (19219, 19224), False, 'import inspect\n'), ((3862, 3890), 'numpy.issubdtype', 'np.issubdtype', (['t', 'np.... |
from tracker import (
GitFile,
TranslationGitFile,
GitPatch,
TranslationTrack,
ToCreateTranslationTrack,
ToInitTranslationTrack,
ToUpdateTranslationTrack,
UpToDateTranslationTrack,
OrphanTranslationTrack,
Status
)
from pathlib import Path
import os.path
from github_utils import (... | [
"github_utils.compare_url"
] | [((9415, 9512), 'github_utils.compare_url', 'compare_url', (['repo.full_name', 'track.base_original.commit.hexsha', 'track.original.commit.hexsha'], {}), '(repo.full_name, track.base_original.commit.hexsha, track.\n original.commit.hexsha)\n', (9426, 9512), False, 'from github_utils import file_url, raw_file_url, co... |
from .problem import Problem
from .trig_defs import RightAngleTrigFunction
from enum import Enum
from typing import List
import random
class TransformationType(Enum):
VerticalTranslation = 1
HorizontalTranslation = 2
VerticalStretchCompression = 3
HorizontalStretchCompression = 4
class GraphTransfo... | [
"random.shuffle",
"random.randint"
] | [((3614, 3640), 'random.shuffle', 'random.shuffle', (['transforms'], {}), '(transforms)\n', (3628, 3640), False, 'import random\n'), ((1228, 1248), 'random.randint', 'random.randint', (['(0)', '(3)'], {}), '(0, 3)\n', (1242, 1248), False, 'import random\n'), ((1851, 1871), 'random.randint', 'random.randint', (['(1)', '... |
"""
HyperOne
HyperOne API # noqa: E501
The version of the OpenAPI document: 0.1.0
Generated by: https://openapi-generator.tech
"""
import unittest
import h1
from h1.api.website_project_instance_api import WebsiteProjectInstanceApi # noqa: E501
class TestWebsiteProjectInstanceApi(unittest.TestCa... | [
"unittest.main",
"h1.api.website_project_instance_api.WebsiteProjectInstanceApi"
] | [((10465, 10480), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10478, 10480), False, 'import unittest\n'), ((418, 445), 'h1.api.website_project_instance_api.WebsiteProjectInstanceApi', 'WebsiteProjectInstanceApi', ([], {}), '()\n', (443, 445), False, 'from h1.api.website_project_instance_api import WebsiteProje... |
import os
import subprocess
folder = r"./examples"
example = [
"eit_dynamic_bp.py",
"eit_dynamic_greit.py",
"eit_dynamic_jac.py",
"eit_dynamic_jac3d.py",
"eit_dynamic_stack.py",
"eit_dynamic_svd.py",
"eit_sensitivity2d.py",
"eit_static_GN_3D.py",
"eit_static_jac.py",
"fem_forwar... | [
"subprocess.call",
"os.path.join"
] | [((1194, 1219), 'os.path.join', 'os.path.join', (['folder', 'ex_'], {}), '(folder, ex_)\n', (1206, 1219), False, 'import os\n'), ((1279, 1311), 'subprocess.call', 'subprocess.call', (['cmd'], {'shell': '(True)'}), '(cmd, shell=True)\n', (1294, 1311), False, 'import subprocess\n')] |
from unittest import TestCase
from regal import BaseInfo
from regal.grouping import GroupAlgorithm
from regal.check_interface import AlgorithmABC
# Run Method: python -m unittest -v tests.py
class TestBaseInfoInitial(TestCase):
def test_empty_info(self):
ab = BaseInfo('', '', '')
with self.assert... | [
"regal.BaseInfo",
"regal.grouping.GroupAlgorithm"
] | [((275, 295), 'regal.BaseInfo', 'BaseInfo', (['""""""', '""""""', '""""""'], {}), "('', '', '')\n", (283, 295), False, 'from regal import BaseInfo\n'), ((435, 455), 'regal.BaseInfo', 'BaseInfo', (['{}', '""""""', '""""""'], {}), "({}, '', '')\n", (443, 455), False, 'from regal import BaseInfo\n'), ((549, 573), 'regal.B... |
import sys
from storage.models import Database
if len(sys.argv) != 2:
print("Usage: python insert.py <file> # file should contain one A Number per line.")
sys.exit(1)
alien_numbers = [line.strip().replace('-', '') for line in open(sys.argv[1])]
db = Database()
db.create_table() # checks if already exists
db.... | [
"storage.models.Database",
"sys.exit"
] | [((261, 271), 'storage.models.Database', 'Database', ([], {}), '()\n', (269, 271), False, 'from storage.models import Database\n'), ((165, 176), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (173, 176), False, 'import sys\n')] |
import re
from datetime import date, datetime, time
import dateparser
import pytz
import requests
from bs4 import BeautifulSoup
import sessionize
def get(url):
res = requests.get(url)
return BeautifulSoup(res.text, 'html.parser')
def parse_page(root):
for evt_elm in root.select('.CalMEvent a'):
... | [
"sessionize.parse_event",
"datetime.date",
"datetime.date.today",
"requests.get",
"bs4.BeautifulSoup",
"datetime.time",
"re.search"
] | [((173, 190), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (185, 190), False, 'import requests\n'), ((202, 240), 'bs4.BeautifulSoup', 'BeautifulSoup', (['res.text', '"""html.parser"""'], {}), "(res.text, 'html.parser')\n", (215, 240), False, 'from bs4 import BeautifulSoup\n'), ((768, 780), 'datetime.date.t... |
#-----------------------------------------------------------------------------
# Title : PyRogue AMC Carrier Cryo Demo Board Application
#-----------------------------------------------------------------------------
# File : AppCore.py
# Created : 2017-04-03
#----------------------------------------------... | [
"AmcCarrierCore.AppTop._AppTop.AppTop",
"AmcCarrierCore.AmcCarrierCore"
] | [((2803, 2982), 'AmcCarrierCore.AmcCarrierCore', 'amccCore.AmcCarrierCore', ([], {'offset': '(0)', 'enablePwrI2C': 'enablePwrI2C', 'enableBsa': 'enableBsa', 'enableMps': 'enableMps', 'numWaveformBuffers': 'numWaveformBuffers', 'enableTpgMini': 'enableTpgMini'}), '(offset=0, enablePwrI2C=enablePwrI2C, enableBsa=\n en... |
'''
import numpy as np
import pandas as pd
import nltk
nltk.download('punkt') # one time execution
import re
we_df = pd.read_hdf('mini.h5', start = 0, stop = 100) # (362891, 300)
pi(we_df.shape)
words = we_df.index
pi(words)
pi(words[50000])
pi(we_df.iloc[50000])
mes = 'This is some demo text,... | [
"pandas.read_hdf",
"networkx.pagerank",
"pandas.read_csv",
"numpy.zeros",
"networkx.from_numpy_array",
"nltk.tokenize.sent_tokenize",
"pandas.Series",
"nltk.corpus.stopwords.words"
] | [((772, 794), 'pandas.read_hdf', 'pd.read_hdf', (['"""mini.h5"""'], {}), "('mini.h5')\n", (783, 794), True, 'import pandas as pd\n'), ((1847, 1879), 'pandas.read_csv', 'pd.read_csv', (['"""demo_articles.csv"""'], {}), "('demo_articles.csv')\n", (1858, 1879), True, 'import pandas as pd\n'), ((2488, 2514), 'nltk.corpus.s... |
"""
Usage:
paaws instance detail [ --instance-id=<instance_id> ] [ --name=<app_name> --process=<process> --platform=<platform> --env=<env> ] --region=<region>
paaws instance list [ --instance-ids=<instance_ids> ] [ --name=<app_name> ] [ --process=<process> ] [ --platform=<platform> ] [ --env=<env> ] --region=<r... | [
"paaws.helpers.parsers.to_table",
"paaws.config.Config.get_default_config"
] | [((2028, 2051), 'paaws.helpers.parsers.to_table', 'to_table', (['instance_data'], {}), '(instance_data)\n', (2036, 2051), False, 'from paaws.helpers.parsers import to_table\n'), ((1061, 1117), 'paaws.config.Config.get_default_config', 'Config.get_default_config', ([], {'space': '"""paaws"""', 'key': '"""platform"""'}),... |
import time
import sys
from textEditor import TextEditor
from core import curses
# import completion
raise Exception
class TextSmartEditor(TextEditor):
'''
option-o to write out
option-q to quit
'''
def __init__(self):
super(TextSmartEditor, self).__init__()
self.marginRight = s... | [
"sys.exit",
"core.curses.color_pair"
] | [((1795, 1806), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1803, 1806), False, 'import sys\n'), ((1662, 1682), 'core.curses.color_pair', 'curses.color_pair', (['(0)'], {}), '(0)\n', (1679, 1682), False, 'from core import curses\n'), ((1176, 1196), 'core.curses.color_pair', 'curses.color_pair', (['(0)'], {}), '(0)... |
# Copyright 2019 NEC 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 writi... | [
"web_app.models.mail_models.MailDriver.objects.filter",
"libs.commonlibs.oase_logger.OaseLogger.get_instance",
"libs.backyardlibs.action_driver.mail.mail_driver.mailManager.analysis_parameters",
"libs.commonlibs.common.DriverCommon.has_right_reserved_value",
"traceback.format_exc",
"web_app.models.mail_mo... | [((968, 993), 'libs.commonlibs.oase_logger.OaseLogger.get_instance', 'OaseLogger.get_instance', ([], {}), '()\n', (991, 993), False, 'from libs.commonlibs.oase_logger import OaseLogger\n'), ((1391, 1430), 'libs.backyardlibs.action_driver.mail.mail_driver.mailManager.analysis_parameters', 'mailManager.analysis_parameter... |
import numpy as np
import torch
import torch.nn.init as init
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
from .layer_norm import LayerNorm
def maybe_mask(attn, attn_mask):
if attn_mask is not None:
assert attn_mask.size() == attn.size(), \
'Atten... | [
"torch.nn.Dropout",
"torch.nn.init.xavier_normal",
"torch.bmm",
"numpy.power",
"torch.split",
"torch.FloatTensor",
"torch.cat",
"torch.nn.functional.softmax",
"torch.nn.Softmax",
"torch.nn.Linear",
"torch.tanh"
] | [((2039, 2057), 'numpy.power', 'np.power', (['dim', '(0.5)'], {}), '(dim, 0.5)\n', (2047, 2057), True, 'import numpy as np\n'), ((2081, 2105), 'torch.nn.Dropout', 'nn.Dropout', (['attn_dropout'], {}), '(attn_dropout)\n', (2091, 2105), True, 'import torch.nn as nn\n'), ((2129, 2147), 'torch.nn.Softmax', 'nn.Softmax', ([... |
"""Unit testing of the Edit Post view"""
from django.test import TestCase, tag
from django.urls import reverse
from BookClub.models import User, ForumPost, Club
from BookClub.tests.helpers import reverse_with_next
@tag('views', 'forum', 'edit_post')
class EditPostViewTestCase(TestCase):
"""Tests of the Edit Post... | [
"BookClub.models.User.objects.get",
"BookClub.models.ForumPost.objects.get",
"BookClub.models.Club.objects.get",
"BookClub.tests.helpers.reverse_with_next",
"django.urls.reverse",
"django.test.tag"
] | [((218, 252), 'django.test.tag', 'tag', (['"""views"""', '"""forum"""', '"""edit_post"""'], {}), "('views', 'forum', 'edit_post')\n", (221, 252), False, 'from django.test import TestCase, tag\n'), ((673, 709), 'BookClub.models.User.objects.get', 'User.objects.get', ([], {'username': '"""johndoe"""'}), "(username='johnd... |
#! /usr/bin/env python
# Copyright (c) 2008, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of c... | [
"re.compile"
] | [((3912, 3956), 're.compile', 're.compile', (['"""^General Purpose Register Dump"""'], {}), "('^General Purpose Register Dump')\n", (3922, 3956), False, 'import re, sys\n'), ((4004, 4036), 're.compile', 're.compile', (['"""r24=(..) +r25=(..)"""'], {}), "('r24=(..) +r25=(..)')\n", (4014, 4036), False, 'import re, sys\n'... |
# 根据图片和音乐合成带节奏的相册视频
from typing import Tuple, Union, Any
import moviepy.editor
from moviepy.video.fx.speedx import speedx
import wave
import numpy as np
import re
from progressbar import *
from common import python_box
from common import gui
import psutil
import time
import math
import moviepy.audio.fx.all
class Ffm... | [
"wave.open",
"common.tools.plot_list",
"numpy.abs",
"math.fabs",
"common.python_box.write_file",
"moviepy.video.fx.speedx.speedx",
"common.python_box.FileSys",
"common.python_box.dir_list",
"time.time",
"numpy.append",
"common.gui.select_file",
"numpy.where",
"numpy.array",
"common.gui.sel... | [((2845, 2882), 'common.python_box.dir_list', 'python_box.dir_list', (['directory', '"""mp4"""'], {}), "(directory, 'mp4')\n", (2864, 2882), False, 'from common import python_box\n'), ((3636, 3648), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (3644, 3648), True, 'import numpy as np\n'), ((4129, 4156), 'numpy.whe... |
import decimal
import math
import warnings
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
from decimal import Decimal, localcontext
from itertools import repeat
from pathlib import Path
from time import time
from typing import List, Optional, Union
import numpy as np
import pandas as pd
from tq... | [
"pandas.DataFrame",
"numpy.random.seed",
"decimal.Decimal",
"concurrent.futures.ProcessPoolExecutor",
"math.floor",
"time.time",
"numpy.random.randint",
"numpy.arange",
"decimal.localcontext",
"pandas.Series",
"warnings.warn",
"concurrent.futures.ThreadPoolExecutor",
"pandas.concat",
"iter... | [((4358, 4404), 'pandas.DataFrame', 'pd.DataFrame', (['ssn_outcomes'], {'columns': "['L_RAND']"}), "(ssn_outcomes, columns=['L_RAND'])\n", (4370, 4404), True, 'import pandas as pd\n'), ((5383, 5410), 'numpy.arange', 'np.arange', (['ssn_min', 'ssn_max'], {}), '(ssn_min, ssn_max)\n', (5392, 5410), True, 'import numpy as ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021-2022 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 app... | [
"neural_compressor.ux.utils.utils.parse_bool_value",
"neural_compressor.ux.utils.exceptions.ClientErrorException",
"neural_compressor.ux.utils.utils.parse_to_string_list",
"neural_compressor.ux.utils.utils.parse_to_float_list"
] | [((2165, 2192), 'neural_compressor.ux.utils.utils.parse_to_string_list', 'parse_to_string_list', (['value'], {}), '(value)\n', (2185, 2192), False, 'from neural_compressor.ux.utils.utils import parse_bool_value, parse_to_float_list, parse_to_string_list\n'), ((2446, 2472), 'neural_compressor.ux.utils.utils.parse_to_flo... |
import socket
import base64
from random import sample,shuffle
import pickle
import time
def name_generator(_len_ = 16, onlyText = False):
lower_case = list("abcdefghijklmnopqrstuvwxyz")
upper_case = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
special = list("!@#$%&*?")
number = list("0123456789")
if onlyTe... | [
"random.sample",
"random.shuffle",
"socket.socket",
"pickle.dumps"
] | [((446, 460), 'random.shuffle', 'shuffle', (['_all_'], {}), '(_all_)\n', (453, 460), False, 'from random import sample, shuffle\n'), ((557, 572), 'socket.socket', 'socket.socket', ([], {}), '()\n', (570, 572), False, 'import socket\n'), ((480, 500), 'random.sample', 'sample', (['_all_', '_len_'], {}), '(_all_, _len_)\n... |
#!/usr/bin/env python
# The Expat License
#
# Copyright (c) 2017, <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to u... | [
"re.findall"
] | [((1464, 1495), 're.findall', 're.findall', (['"""[0-9]+"""', 'factors_s'], {}), "('[0-9]+', factors_s)\n", (1474, 1495), False, 'import re\n')] |
# Once for All: Train One Network and Specialize it for Efficient Deployment
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
# International Conference on Learning Representations (ICLR), 2020.
import os
import torch
import argparse
from ofa.stereo_matching.data_providers.stereo import StereoDataProvider
from ofa.stereo_mat... | [
"ofa.stereo_matching.elastic_nn.networks.ofa_aanet.OFAAANet",
"torch.cuda.synchronize",
"torch.cuda.Event",
"numpy.sum",
"argparse.ArgumentParser",
"numpy.std",
"torch.load",
"numpy.zeros",
"torch.randn",
"torch.cuda.device_count",
"ofa.utils.pytorch_utils.get_net_info",
"torch.no_grad"
] | [((608, 633), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (631, 633), False, 'import argparse\n'), ((1213, 1321), 'ofa.stereo_matching.elastic_nn.networks.ofa_aanet.OFAAANet', 'OFAAANet', ([], {'ks_list': '[3, 5, 7]', 'expand_ratio_list': '[2, 4, 6, 8]', 'depth_list': '[2, 3, 4]', 'scale_lis... |
import pytest
from dddpy.domain.book import Book, Isbn
class TestBook:
def test_constructor_should_create_instance(self):
book = Book(
id="book_01",
isbn=Isbn("978-0321125217"),
title="Domain-Driven Design: Tackling Complexity in the Heart of Softwares",
pa... | [
"pytest.mark.parametrize",
"dddpy.domain.book.Isbn"
] | [((1473, 1522), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""read_page"""', '[0, 1, 320]'], {}), "('read_page', [0, 1, 320])\n", (1496, 1522), False, 'import pytest\n'), ((1962, 2054), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""read_page, expected"""', '[(0, False), (559, False), (560, T... |
import os
import sys
from PIL import Image
import numpy as np
import random
import matplotlib.pyplot as plt
size_image = (256, 256)
class LSB:
# convert integer to 8-bit binary
def int2bin(self, image):
r, g, b = image
return (f'{r:08b}', f'{g:08b}', f'{b:08b}')
# conve... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"PIL.Image.new",
"matplotlib.pyplot.show",
"numpy.random.shuffle",
"matplotlib.pyplot.imshow",
"PIL.Image.open",
"matplotlib.pyplot.figure",
"os.listdir",
"matplotlib.pyplot.savefig"
] | [((1580, 1608), 'os.listdir', 'os.listdir', (['"""./images_test/"""'], {}), "('./images_test/')\n", (1590, 1608), False, 'import os\n'), ((1722, 1752), 'numpy.random.shuffle', 'np.random.shuffle', (['test_images'], {}), '(test_images)\n', (1739, 1752), True, 'import numpy as np\n'), ((2470, 2497), 'matplotlib.pyplot.fi... |
import os, sys
from PIL import Image, ImageDraw, ImageFont
import random, time
import telebot
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
from telebot import types
TELEGRAM_TOKEN = '<KEY>'
bot = telebot.TeleBot(TELEGRAM_TOKEN)
channelId = -1001390673326
user_dict = {}
msgDict = ... | [
"PIL.Image.new",
"random.randint",
"telebot.types.InlineKeyboardButton",
"telebot.types.ReplyKeyboardMarkup",
"telebot.types.KeyboardButton",
"random.choice",
"time.sleep",
"PIL.ImageFont.truetype",
"PIL.Image.open",
"PIL.Image.alpha_composite",
"telebot.types.InlineKeyboardMarkup",
"PIL.Image... | [((231, 262), 'telebot.TeleBot', 'telebot.TeleBot', (['TELEGRAM_TOKEN'], {}), '(TELEGRAM_TOKEN)\n', (246, 262), False, 'import telebot\n'), ((1013, 1035), 'random.choice', 'random.choice', (['msgDict'], {}), '(msgDict)\n', (1026, 1035), False, 'import random, time\n'), ((1654, 1702), 'PIL.Image.new', 'Image.new', (['""... |
def kwargs_remover(f, kwargs, check_list = None, clone = True):
'''Removes all the keys from a kwargs-list, that a given function does not understand.
The keys removed can optionally be restricted, so only keys from check_list are removed.'''
import inspect
if check_list == None: check_list = kwargs.k... | [
"leak.MemLeak",
"functools.wraps"
] | [((4655, 4673), 'leak.MemLeak', 'leak.MemLeak', (['func'], {}), '(func)\n', (4667, 4673), False, 'import leak\n'), ((4010, 4034), 'functools.wraps', 'functools.wraps', (['wrapped'], {}), '(wrapped)\n', (4025, 4034), False, 'import functools\n')] |
import datetime
import itertools
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.utils import dateparse, timezone
from furl import furl
from rest_framework.authtoken.models import Token
from rest_framework.test import APIRequestFactory, force_authenticate
from .. import vie... | [
"rest_framework.authtoken.models.Token.objects.create",
"django.utils.timezone.now",
"rest_framework.test.APIRequestFactory",
"furl.furl",
"django.contrib.auth.get_user_model",
"datetime.timedelta",
"rest_framework.test.force_authenticate",
"itertools.product",
"django.utils.dateparse.parse_datetime... | [((480, 499), 'rest_framework.test.APIRequestFactory', 'APIRequestFactory', ([], {}), '()\n', (497, 499), False, 'from rest_framework.test import APIRequestFactory, force_authenticate\n'), ((1142, 1194), 'rest_framework.test.force_authenticate', 'force_authenticate', (['self.get_request'], {'user': 'self.user'}), '(sel... |
#!/usr/bin/python
import sys
import os
fn = "pileup.txt"
coverage_thresh = 5
if not os.path.isfile(fn):
print("File not found...")
sys.exit()
with open(fn) as fp:
hotspot_count = 0
hotspot_read_count = 0
in_hotspot = False
max_coverage = 0
hotspot_chr = ""
hotspot_start = 0
hot... | [
"os.path.isfile",
"sys.exit"
] | [((87, 105), 'os.path.isfile', 'os.path.isfile', (['fn'], {}), '(fn)\n', (101, 105), False, 'import os\n'), ((142, 152), 'sys.exit', 'sys.exit', ([], {}), '()\n', (150, 152), False, 'import sys\n')] |
import numpy as np
import torch
import torch.nn as nn
def conv(in_channels, out_channels, kernel_size, bias=True):
return nn.Conv2d(
in_channels, out_channels, kernel_size,
padding=(kernel_size//2), bias=bias)
class MappingNet(nn.Module):
def __init__(self, opt):
super().__init__()
... | [
"torch.nn.ReLU",
"torch.nn.Sequential",
"numpy.log2",
"torch.nn.Conv2d",
"torch.nn.Upsample",
"torch.nn.BatchNorm2d",
"torch.nn.Linear"
] | [((129, 219), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_channels', 'out_channels', 'kernel_size'], {'padding': '(kernel_size // 2)', 'bias': 'bias'}), '(in_channels, out_channels, kernel_size, padding=kernel_size // 2,\n bias=bias)\n', (138, 219), True, 'import torch.nn as nn\n'), ((782, 804), 'torch.nn.Sequential', 'nn... |
# Generated by Django 4.0 on 2021-12-22 04:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('practice_app', '0009_alter_museumapicsv_additionalimages_and_more'),
]
operations = [
migrations.AlterField(
model_name='museumapi... | [
"django.db.models.CharField"
] | [((380, 411), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (396, 411), False, 'from django.db import migrations, models\n')] |
#!usr/bin/env python
# -*-coding:utf8-*-
from bank import Bank
from bank import Account
import socket
import time
from server import Server
from server_logger import log
__doc__ = """
* This module provide bcs_server class to access the bcs server.
* This extends the Server class.
"""
class BcsServer(Server... | [
"server_logger.log.debug",
"bank.Account",
"server_logger.log.info",
"bank.Bank",
"server_logger.log.error"
] | [((398, 404), 'bank.Bank', 'Bank', ([], {}), '()\n', (402, 404), False, 'from bank import Bank\n'), ((510, 552), 'server_logger.log.info', 'log.info', (["('Session started with %s' % addr)"], {}), "('Session started with %s' % addr)\n", (518, 552), False, 'from server_logger import log\n'), ((4208, 4263), 'server_logge... |
""" This script uploads created music files in directories to youtube music library """
import time
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
from ytmusicapi import YTMusic
import music_tag
from datetime import date
import os
directories = ["D:\Kwan\Desktop", "D:\... | [
"music_tag.load_file",
"os.path.basename",
"datetime.date.today",
"time.sleep",
"ytmusicapi.YTMusic",
"watchdog.events.PatternMatchingEventHandler",
"watchdog.observers.Observer"
] | [((458, 486), 'ytmusicapi.YTMusic', 'YTMusic', (['"""ytmusic_auth.json"""'], {}), "('ytmusic_auth.json')\n", (465, 486), False, 'from ytmusicapi import YTMusic\n'), ((668, 691), 'music_tag.load_file', 'music_tag.load_file', (['fn'], {}), '(fn)\n', (687, 691), False, 'import music_tag\n'), ((1654, 1748), 'watchdog.event... |
import numpy as np
from copy import copy
from .utils.thresholdcurator import ThresholdCurator
from .quality_metric import QualityMetric
import spiketoolkit as st
import spikemetrics.metrics as metrics
from spikemetrics.utils import printProgressBar
from spikemetrics.metrics import find_neighboring_channels
from collect... | [
"spikemetrics.metrics.find_neighboring_channels",
"numpy.random.seed",
"numpy.sum",
"numpy.concatenate",
"numpy.abs",
"numpy.median",
"numpy.asarray",
"spiketoolkit.postprocessing.get_unit_waveforms",
"numpy.zeros",
"numpy.sort",
"numpy.linalg.svd",
"numpy.mean",
"numpy.arange",
"collectio... | [((611, 754), 'collections.OrderedDict', 'OrderedDict', (["[('num_channels_to_compare', 13), ('max_spikes_per_unit_for_noise_overlap',\n 1000), ('num_features', 10), ('num_knn', 6)]"], {}), "([('num_channels_to_compare', 13), (\n 'max_spikes_per_unit_for_noise_overlap', 1000), ('num_features', 10), (\n 'num_kn... |
"""
FLAME - Fuzzy clustering by Local Approximation of MEmbership
"""
from __future__ import print_function
import numpy as np
from scipy import sparse
from scipy.sparse import csr_matrix, lil_matrix
from sklearn.base import BaseEstimator, ClusterMixin
from sklearn.utils import check_array
from sklearn.metrics.pairw... | [
"numpy.absolute",
"sklearn.metrics.pairwise.pairwise_distances",
"math.sqrt",
"numpy.argmax",
"sklearn.utils.check_array",
"scipy.sparse.issparse",
"numpy.asarray",
"numpy.zeros",
"numpy.argpartition",
"scipy.sparse.lil_matrix",
"numpy.where",
"numpy.array",
"sklearn.preprocessing.normalize"... | [((7213, 7338), 'numpy.array', 'np.array', (['[[0, 0, 0], [1.1, 0, 0], [0, 0.8, 0], [0, 0, 1.3], [10, 10, 10], [11.1, 10,\n 10], [10, 10.8, 10], [10, 11, 12]]'], {}), '([[0, 0, 0], [1.1, 0, 0], [0, 0.8, 0], [0, 0, 1.3], [10, 10, 10], [\n 11.1, 10, 10], [10, 10.8, 10], [10, 11, 12]])\n', (7221, 7338), True, 'impor... |
import json
import os
import subprocess
import time
subid = raw_input('Enter subject id (i.e. s999): ')
training = raw_input('Enter 0 for training, 1 for main tasks: ')
if training == '1':
run_file = 'scanner_tasks_order1'
else:
run_file = 'practice_tasks'
taskset = raw_input('Enter task group (1, 2 or 3): '... | [
"time.sleep"
] | [((1264, 1277), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1274, 1277), False, 'import time\n')] |
'''OpenGL extension ARB.sync
This module customises the behaviour of the
OpenGL.raw.GL.ARB.sync to provide a more
Python-friendly API
Overview (from the spec)
This extension introduces the concept of "sync objects". Sync
objects are a synchronization primitive - a representation of events
whose completion stat... | [
"OpenGL.constants.GLint",
"OpenGL.arrays.GLintArray.zeros"
] | [((2478, 2506), 'OpenGL.arrays.GLintArray.zeros', 'GLintArray.zeros', (['(bufSize,)'], {}), '((bufSize,))\n', (2494, 2506), False, 'from OpenGL.arrays import GLintArray\n'), ((2549, 2556), 'OpenGL.constants.GLint', 'GLint', ([], {}), '()\n', (2554, 2556), False, 'from OpenGL.constants import GLint\n')] |
# -*- coding: utf-8 -*-
"""
This module
"""
import attr
import typing
from ..core.model import (
Property, Resource, Tag, GetAtt, TypeHint, TypeCheck,
)
from ..core.constant import AttrMeta
#--- Property declaration ---
#--- Resource declaration ---
@attr.s
class ResourceShare(Resource):
"""
AWS Obje... | [
"attr.validators.instance_of"
] | [((1601, 1658), 'attr.validators.instance_of', 'attr.validators.instance_of', (['TypeCheck.intrinsic_str_type'], {}), '(TypeCheck.intrinsic_str_type)\n', (1628, 1658), False, 'import attr\n'), ((1969, 2002), 'attr.validators.instance_of', 'attr.validators.instance_of', (['bool'], {}), '(bool)\n', (1996, 2002), False, '... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | [
"bpy.ops.mesh.select_all",
"bpy.ops.mesh.quads_convert_to_tris",
"bpy.ops.object.mode_set"
] | [((1420, 1456), 'bpy.ops.object.mode_set', 'bpy.ops.object.mode_set', ([], {'mode': '"""EDIT"""'}), "(mode='EDIT')\n", (1443, 1456), False, 'import bpy\n'), ((1472, 1512), 'bpy.ops.mesh.select_all', 'bpy.ops.mesh.select_all', ([], {'action': '"""SELECT"""'}), "(action='SELECT')\n", (1495, 1512), False, 'import bpy\n'),... |
import copy
import numpy as np
import tensorflow as tf
from ammf.utils.wavedata.tools.obj_detection import obj_utils
from ammf.utils.wavedata.tools.obj_detection import evaluation
from ammf.core import anchor_projector
from ammf.core import box_3d_encoder
COLOUR_SCHEME_PREDICTIONS = {
"Easy GT": (255, 255, 0), ... | [
"ammf.core.box_3d_encoder.box_3d_to_3d_iou_format",
"copy.deepcopy",
"tensorflow.convert_to_tensor",
"ammf.core.anchor_projector.tf_project_to_image_space",
"tensorflow.Session",
"ammf.utils.wavedata.tools.obj_detection.evaluation.three_d_iou",
"numpy.amax",
"ammf.utils.wavedata.tools.obj_detection.ob... | [((632, 681), 'ammf.utils.wavedata.tools.obj_detection.obj_utils.read_labels', 'obj_utils.read_labels', (['dataset.label_dir', 'img_idx'], {}), '(dataset.label_dir, img_idx)\n', (653, 681), False, 'from ammf.utils.wavedata.tools.obj_detection import obj_utils\n'), ((2679, 2720), 'tensorflow.convert_to_tensor', 'tf.conv... |
import argparse
import pprint
from colorama import Fore
from classroom_tools import github_utils
parser = argparse.ArgumentParser(
'Create a protected branch to freeze assignment submissions using the latest commit on master')
parser.add_argument(
'--token',
required=True,
help='GitHub personal acces... | [
"classroom_tools.github_utils.get_students_repositories",
"classroom_tools.github_utils.verify_token",
"argparse.ArgumentParser"
] | [((109, 238), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Create a protected branch to freeze assignment submissions using the latest commit on master"""'], {}), "(\n 'Create a protected branch to freeze assignment submissions using the latest commit on master'\n )\n", (132, 238), False, 'import a... |
from datetime import datetime
from pytz import timezone
from elastalert.enhancements import BaseEnhancement
from elastalert.util import ts_to_dt, pretty_ts, elastalert_logger
"""
This Class will convert the incoming Timezone object of UTC offset to Taiwan/India Standard Timezone
"""
class ConvertTzInfo(BaseEnhancemen... | [
"elastalert.util.pretty_ts",
"elastalert.util.elastalert_logger.info",
"pytz.timezone",
"elastalert.util.ts_to_dt"
] | [((566, 634), 'elastalert.util.elastalert_logger.info', 'elastalert_logger.info', (["('Received UTC Time %s' % match['@timestamp'])"], {}), "('Received UTC Time %s' % match['@timestamp'])\n", (588, 634), False, 'from elastalert.util import ts_to_dt, pretty_ts, elastalert_logger\n'), ((778, 801), 'pytz.timezone', 'timez... |
import ipaddress
import socket
import json
from . import ovsdb_query
from .bridge import OvsBridge
from .port import OvsPort
from datetime import datetime, timedelta
from . import ovspy_error
import sys
import time
class OvsClient:
SEND_DEBUG = False
RECV_DEBUG = False
def __init__(self, ovsdb_port, o... | [
"json.loads",
"socket.socket",
"ipaddress.ip_address",
"json.dumps",
"datetime.timedelta",
"sys.stderr.write",
"datetime.datetime.now"
] | [((396, 426), 'ipaddress.ip_address', 'ipaddress.ip_address', (['ovsdb_ip'], {}), '(ovsdb_ip)\n', (416, 426), False, 'import ipaddress\n'), ((593, 642), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (606, 642), False, 'import socket\n'), ((95... |
"""
Utilities based on building baseline machine learning models.
"""
from typing import Union, Optional
from pandas import DataFrame, Series
from numpy import mean, tile, empty, std, square, sqrt, log as nplog, reciprocal
from scipy.stats import boxcox, normaltest, mode
from sklearn.compose import ColumnTransformer
f... | [
"sklearn.preprocessing.FunctionTransformer",
"sklearn.preprocessing.StandardScaler",
"sklearn.model_selection.train_test_split",
"numpy.empty",
"sklearn.mixture.GaussianMixture",
"sklearn.compose.ColumnTransformer",
"numpy.mean",
"sklearn.impute.SimpleImputer",
"numpy.std",
"scipy.stats.normaltest... | [((1737, 1781), 'sklearn.utils._testing.ignore_warnings', 'ignore_warnings', ([], {'category': 'ConvergenceWarning'}), '(category=ConvergenceWarning)\n', (1752, 1781), False, 'from sklearn.utils._testing import ignore_warnings\n'), ((2755, 2802), 'sklearn.utils._testing.ignore_warnings', 'ignore_warnings', ([], {'categ... |
# Copyright 2019-2020 by <NAME>, MGLAND animation studio. All rights reserved.
# This file is part of IUTest, and is released under the "MIT License Agreement".
# Please see the LICENSE file that should have been included as part of this package.
import logging
import os
from iutest.core import appsettings
from iutest... | [
"iutest.core.appsettings.get",
"iutest.qt.QtCore.QProcess",
"iutest.qt.Signal",
"os.path.isfile",
"iutest.qt.QtCore.QObject.__init__",
"logging.getLogger"
] | [((390, 417), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (407, 417), False, 'import logging\n'), ((504, 515), 'iutest.qt.Signal', 'Signal', (['str'], {}), '(str)\n', (510, 515), False, 'from iutest.qt import QtCore, Signal\n'), ((922, 966), 'iutest.qt.QtCore.QObject.__init__', 'QtCore... |
from pathlib import Path
import numpy as np
from PIL import ImageFont
from scipy.ndimage import convolve
from scipy.spatial import cKDTree
resource_dir = (Path(__file__) / "../resources").absolute()
class Particle:
def __init__(self, x, y, color, ball_size=1):
self.pos = np.array([x, y]).astype(float)
... | [
"numpy.empty",
"numpy.zeros",
"scipy.ndimage.convolve",
"pathlib.Path",
"numpy.where",
"numpy.array",
"numpy.rot90",
"numpy.linalg.norm",
"scipy.spatial.cKDTree"
] | [((1668, 1684), 'numpy.empty', 'np.empty', (['a.size'], {}), '(a.size)\n', (1676, 1684), True, 'import numpy as np\n'), ((1825, 1848), 'numpy.where', 'np.where', (['(out > 0)', '(1)', '(0)'], {}), '(out > 0, 1, 0)\n', (1833, 1848), True, 'import numpy as np\n'), ((1859, 1872), 'numpy.rot90', 'np.rot90', (['out'], {}), ... |
import os.path
from flask import Flask, render_template, jsonify, request
from pywhale.whale import PyWhale
curr_file = os.path.abspath(os.path.dirname(__file__))
app_path = os.path.join(curr_file)
static_path = os.path.join(curr_file, 'static')
template_path = os.path.join(curr_file, 'templates')
app = Flask("PyWh... | [
"flask.jsonify",
"flask.Flask",
"flask.render_template",
"flask.request.form.get"
] | [((309, 376), 'flask.Flask', 'Flask', (['"""PyWhale"""'], {'root_path': 'app_path', 'template_folder': 'template_path'}), "('PyWhale', root_path=app_path, template_folder=template_path)\n", (314, 376), False, 'from flask import Flask, render_template, jsonify, request\n'), ((455, 482), 'flask.render_template', 'render_... |
from natch.core import Decoration
from natch.rules import Eq
eq = Decoration.make_rule_decorator(Eq)
| [
"natch.core.Decoration.make_rule_decorator"
] | [((68, 102), 'natch.core.Decoration.make_rule_decorator', 'Decoration.make_rule_decorator', (['Eq'], {}), '(Eq)\n', (98, 102), False, 'from natch.core import Decoration\n')] |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
from config_file import *
class Identity_TransformerBlock(nn.Module):
def __init__(self):
super(Identity_TransformerBlock, self).__init__()
def forward(self, Q, K, V, episilon=1e-8):
# assert (Q ==... | [
"torch.ones_like",
"torch.nn.ReLU",
"torch.rand",
"torch.where",
"torch.nn.Tanh",
"torch.sqrt",
"torch.nn.init.xavier_uniform_",
"torch.nn.init.xavier_normal_",
"torch.cat",
"torch.nn.functional.softmax",
"torch.softmax",
"torch.nn.LayerNorm",
"torch.einsum",
"torch.nn.init.constant_",
"... | [((13178, 13201), 'torch.rand', 'torch.rand', (['(16)', '(25)', '(300)'], {}), '(16, 25, 300)\n', (13188, 13201), False, 'import torch\n'), ((13212, 13235), 'torch.rand', 'torch.rand', (['(16)', '(25)', '(300)'], {}), '(16, 25, 300)\n', (13222, 13235), False, 'import torch\n'), ((742, 751), 'torch.nn.ReLU', 'nn.ReLU', ... |
from django.shortcuts import reverse
from apps.notifications.models import Notification
def connection_notifications(backend, user, response, *args, **kwargs):
if backend.name in ['sharemyhealth']:
# Dismiss the notification prompting the user to connect
notifications = Notification.objects.filte... | [
"apps.notifications.models.Notification.objects.filter",
"django.shortcuts.reverse",
"apps.notifications.models.Notification.objects.create"
] | [((687, 736), 'django.shortcuts.reverse', 'reverse', (['"""social:disconnect"""'], {'args': '[backend.name]'}), "('social:disconnect', args=[backend.name])\n", (694, 736), False, 'from django.shortcuts import reverse\n'), ((761, 873), 'apps.notifications.models.Notification.objects.filter', 'Notification.objects.filter... |
#!/usr/bin/python3
"""Calculate IoU of part segmentation task."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import argparse
import data_utils
import numpy as np
def main():
parser = argparse.ArgumentParser()
... | [
"numpy.sum",
"numpy.amin",
"argparse.ArgumentParser",
"numpy.logical_and",
"numpy.amax",
"numpy.finfo",
"numpy.array",
"numpy.loadtxt",
"numpy.logical_or",
"os.path.join",
"os.listdir"
] | [((293, 318), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (316, 318), False, 'import argparse\n'), ((1247, 1273), 'os.listdir', 'os.listdir', (['args.folder_gt'], {}), '(args.folder_gt)\n', (1257, 1273), False, 'import os\n'), ((1369, 1407), 'os.path.join', 'os.path.join', (['args.folder_gt'... |
GAME_SIZE = 4
SCORE_TO_WIN = 2048
from game2048.game import Game
from game2048.agents import ExpectiMaxAgent
# save the dataset
f_256 = open("dataset_256.txt", "w")
f_512 = open("dataset_512.txt", "w")
f_1024 = open("dataset_1024.txt", "w")
for i in range(30000):
print("i = ", i)
game = Game(size=GAME_SIZE)
... | [
"game2048.agents.ExpectiMaxAgent",
"game2048.game.Game"
] | [((299, 319), 'game2048.game.Game', 'Game', ([], {'size': 'GAME_SIZE'}), '(size=GAME_SIZE)\n', (303, 319), False, 'from game2048.game import Game\n'), ((332, 358), 'game2048.agents.ExpectiMaxAgent', 'ExpectiMaxAgent', ([], {'game': 'game'}), '(game=game)\n', (347, 358), False, 'from game2048.agents import ExpectiMaxAge... |
# Implementations of approval-based multi-winner voting rules
from __future__ import print_function
import math
import sys
from itertools import combinations
try:
from gmpy2 import mpq as Fraction
except ImportError:
from fractions import Fraction
from rules_approval_ilp import compute_monroe_ilp, compute_th... | [
"committees.enough_approved_candidates",
"score_functions.additional_thiele_scores",
"rules_approval_ilp.compute_minimaxav_ilp",
"rules_approval_ilp.compute_monroe_ilp",
"committees.print_committees",
"rules_approval_ilp.compute_optphragmen_ilp",
"rules_approval_ilp.compute_thiele_methods_ilp",
"math.... | [((5779, 5829), 'committees.enough_approved_candidates', 'enough_approved_candidates', (['profile', 'committeesize'], {}), '(profile, committeesize)\n', (5805, 5829), False, 'from committees import sort_committees, enough_approved_candidates, print_committees\n'), ((5845, 5889), 'score_functions.get_scorefct', 'sf.get_... |
"""Setup xorca."""
from setuptools import setup
setup(name='xorca',
description='Work on the ORCA grid with XGCM and Xarray',
packages=['xorca'],
package_dir={'xorca': 'xorca'},
install_requires=['setuptools', ],
zip_safe=False)
| [
"setuptools.setup"
] | [((50, 241), 'setuptools.setup', 'setup', ([], {'name': '"""xorca"""', 'description': '"""Work on the ORCA grid with XGCM and Xarray"""', 'packages': "['xorca']", 'package_dir': "{'xorca': 'xorca'}", 'install_requires': "['setuptools']", 'zip_safe': '(False)'}), "(name='xorca', description=\n 'Work on the ORCA grid ... |
"""Import tasks for the Nearby Supernova Factory.
"""
import csv
import os
from glob import glob
from astrocats.catalog.utils import jd_to_mjd, pbar, pretty_num, uniq_cdl
from astropy.time import Time as astrotime
from decimal import Decimal
from ..supernova import SUPERNOVA
def do_snf_aliases(catalog):
file_p... | [
"csv.reader",
"os.path.basename",
"decimal.Decimal",
"astropy.time.Time",
"astrocats.catalog.utils.uniq_cdl",
"astrocats.catalog.utils.pbar",
"glob.glob"
] | [((1246, 1274), 'astrocats.catalog.utils.pbar', 'pbar', (['eventfolders', 'task_str'], {}), '(eventfolders, task_str)\n', (1250, 1274), False, 'from astrocats.catalog.utils import jd_to_mjd, pbar, pretty_num, uniq_cdl\n'), ((1987, 2017), 'astrocats.catalog.utils.uniq_cdl', 'uniq_cdl', (['[source, sec_source]'], {}), '(... |
from __future__ import print_function
import os
import numpy as np
import torch
from torchvision import datasets, transforms
from .smallnorb_dataset_helper import smallnorb, smallnorb_equivariance
from .utils import random_split, CustomDataset
def get_dataset(args):
if args.dataset == "cifar10":
... | [
"torchvision.transforms.ColorJitter",
"torchvision.datasets.FashionMNIST",
"torch.utils.data.DataLoader",
"torchvision.transforms.RandomHorizontalFlip",
"os.path.join",
"torchvision.transforms.ToPILImage",
"torchvision.datasets.CIFAR10",
"torchvision.transforms.Pad",
"numpy.array",
"numpy.repeat",... | [((1265, 1350), 'torchvision.datasets.CIFAR10', 'datasets.CIFAR10', (['"""./data"""'], {'train': '(True)', 'download': '(True)', 'transform': 'train_transform'}), "('./data', train=True, download=True, transform=train_transform\n )\n", (1281, 1350), False, 'from torchvision import datasets, transforms\n'), ((1369, 1... |
from Creating_Synthetic_Dataset import x_train, y_train
import tensorflow as tf
from scipy.fft import fft, fftfreq
#global variables
l = 50000
low_lim = 100
high_lim = 150
fs = 512
sep_ind = int(0.8*l)
length_of_input = 60
# Size of FFT analysis
N = 60
def fir_freqz(b):
# Get the frequency response
X = np.ff... | [
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.Conv1D",
"tensorflow.keras.layers.Input",
"tensorflow.keras.Sequential",
"tensorflow.keras.layers.Flatten"
] | [((1568, 1589), 'tensorflow.keras.Sequential', 'tf.keras.Sequential', ([], {}), '()\n', (1587, 1589), True, 'import tensorflow as tf\n'), ((1600, 1636), 'tensorflow.keras.layers.Input', 'tf.keras.layers.Input', ([], {'shape': '(60, 1)'}), '(shape=(60, 1))\n', (1621, 1636), True, 'import tensorflow as tf\n'), ((1647, 17... |
from ChessRender.RenderFsmCommon.button_fsm import ButtonFsm
from ChessRender.RenderFsmCommon.screen_states import ScreenState
from ChessRender.RenderFsmCommon.screen_text_fsm import ScreenTextFsm
from ChessRender.RenderFsmCommon.text_field_fsm import TextFieldFsm
class FsmStateRegistration(ScreenState):
def __in... | [
"ChessRender.RenderFsmCommon.screen_text_fsm.ScreenTextFsm",
"ChessRender.RenderFsmCommon.text_field_fsm.TextFieldFsm",
"ChessRender.RenderFsmCommon.button_fsm.ButtonFsm",
"ChessRender.RenderFsmCommon.screen_states.ScreenState.__init__"
] | [((355, 381), 'ChessRender.RenderFsmCommon.screen_states.ScreenState.__init__', 'ScreenState.__init__', (['self'], {}), '(self)\n', (375, 381), False, 'from ChessRender.RenderFsmCommon.screen_states import ScreenState\n'), ((438, 472), 'ChessRender.RenderFsmCommon.button_fsm.ButtonFsm', 'ButtonFsm', (['"""Confirm"""', ... |