code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.urls import path
from grammers.views import GrammerView, ProgrammersExample10_1View, ProgrammersExample10_2View, ProgrammersExample10_3View, ProgrammersExample10_4View, ProgrammersExample11View, ProgrammersExample12View, ProgrammersExample13View, ProgrammersExample14View, ProgrammersExample15View, Programm... | [
"grammers.views.ProgrammersExample8View.as_view",
"grammers.views.ProgrammersExample4View.as_view",
"grammers.views.ProgrammersExample9View.as_view",
"grammers.views.ProgrammersExample10_2View.as_view",
"grammers.views.ProgrammersExample12View.as_view",
"grammers.views.ProgrammersExample15View.as_view",
... | [((551, 572), 'grammers.views.GrammerView.as_view', 'GrammerView.as_view', ([], {}), '()\n', (570, 572), False, 'from grammers.views import GrammerView, ProgrammersExample10_1View, ProgrammersExample10_2View, ProgrammersExample10_3View, ProgrammersExample10_4View, ProgrammersExample11View, ProgrammersExample12View, Pro... |
# Generated by Django 3.1.4 on 2020-12-19 09:35
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.UUIDField"
] | [((288, 345), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (319, 345), False, 'from django.db import migrations, models\n'), ((477, 568), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'default': 'uuid.uuid4'... |
"""
Disctrict Cooling Network Calculations.
Calculate which technologies need to be activated to meet the cooling energy demand and determine the cost and emissions
that result from the activation of these cooling technologies.
"""
import numpy as np
import pandas as pd
from cea.constants import HOURS_IN_YEAR
from c... | [
"numpy.amax",
"numpy.average",
"cea.technologies.chiller_vapor_compression.VaporCompressionChiller",
"cea.optimization.master.cost_model.calc_generation_costs_capacity_installed_cooling",
"cea.optimization.master.cost_model.calc_network_costs_cooling",
"numpy.array",
"numpy.zeros",
"cea.optimization.s... | [((6856, 6948), 'cea.technologies.cogeneration.calc_cop_CCGT', 'calc_cop_CCGT', (['master_to_slave_variables.NG_Trigen_ACH_size_W', 'ACH_T_IN_FROM_CHP_K', '"""NG"""'], {}), "(master_to_slave_variables.NG_Trigen_ACH_size_W,\n ACH_T_IN_FROM_CHP_K, 'NG')\n", (6869, 6948), False, 'from cea.technologies.cogeneration impo... |
"""
Copyright 2019 hiraokusky
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | [
"bs4.BeautifulSoup",
"rdflib.Graph",
"selenium.webdriver.Chrome",
"selenium.webdriver.chrome.options.Options"
] | [((1046, 1060), 'rdflib.Graph', 'rdflib.Graph', ([], {}), '()\n', (1058, 1060), False, 'import rdflib\n'), ((1130, 1139), 'selenium.webdriver.chrome.options.Options', 'Options', ([], {}), '()\n', (1137, 1139), False, 'from selenium.webdriver.chrome.options import Options\n'), ((1199, 1239), 'selenium.webdriver.Chrome',... |
# coding: utf-8
import sys
import sublime
st_version = 2
if sublime.version() == '' or int(sublime.version()) > 3000:
st_version = 3
from imp import reload
mod_prefix = ''
reload_mods = []
for mod in sys.modules:
if mod.startswith('JoomlaPack') and sys.modules[mod] is not None:
reload_mods.appen... | [
"sublime.version",
"imp.reload",
"sublime.error_message"
] | [((62, 79), 'sublime.version', 'sublime.version', ([], {}), '()\n', (77, 79), False, 'import sublime\n'), ((93, 110), 'sublime.version', 'sublime.version', ([], {}), '()\n', (108, 110), False, 'import sublime\n'), ((976, 1000), 'imp.reload', 'reload', (['sys.modules[mod]'], {}), '(sys.modules[mod])\n', (982, 1000), Fal... |
import numpy as np
import cv2
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
filename = "obama.jpg"
# Show the original image
img = cv2.imread(filename)
# Convert to grayscale, show it
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
for ... | [
"cv2.CascadeClassifier",
"cv2.imread",
"cv2.destroyAllWindows",
"cv2.cvtColor"
] | [((46, 106), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haarcascade_frontalface_default.xml"""'], {}), "('haarcascade_frontalface_default.xml')\n", (67, 106), False, 'import cv2\n'), ((164, 184), 'cv2.imread', 'cv2.imread', (['filename'], {}), '(filename)\n', (174, 184), False, 'import cv2\n'), ((225, 262)... |
import panda3d as p3d
import numpy as np
from itertools import izip
from plyfile import PlyData, PlyElement, make2d as PlyMake2D # pip install plyfile
from renderer_util import compute_vertex_normals
class PLYNode(p3d.core.GeomNode):
# TODO (True): large point clouds will overrun the buffer; so, we'll have to
... | [
"panda3d.core.Geom",
"panda3d.core.GeomTriangles",
"numpy.column_stack",
"numpy.array",
"panda3d.core.GeomPoints",
"renderer_util.compute_vertex_normals",
"panda3d.core.GeomVertexData",
"plyfile.make2d",
"plyfile.PlyData.read",
"numpy.all",
"panda3d.core.GeomVertexFormat"
] | [((546, 568), 'plyfile.PlyData.read', 'PlyData.read', (['ply_file'], {}), '(ply_file)\n', (558, 568), False, 'from plyfile import PlyData, PlyElement, make2d as PlyMake2D\n'), ((1448, 1494), 'plyfile.make2d', 'PlyMake2D', (["mesh['face'].data['vertex_indices']"], {}), "(mesh['face'].data['vertex_indices'])\n", (1457, 1... |
try:
from psutil import virtual_memory, net_if_addrs, cpu_percent, getloadavg, disk_usage
except:
from .mockpsutil import virtual_memory, net_if_addrs, cpu_percent, getloadavg, disk_usage
import logging
from enum import Enum
from pprint import PrettyPrinter
from sys import stdout
import socket
import requests
... | [
"logging.getLogger",
"os.path.exists",
"psutil.getloadavg",
"psutil.cpu_percent",
"os.makedirs",
"psutil.disk_usage",
"datetime.datetime.strptime",
"pathlib.Path.home",
"json.dumps",
"threading.RLock",
"psutil.virtual_memory",
"os.getcwd",
"os.getlogin",
"datetime.datetime.now",
"pprint.... | [((539, 566), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (556, 566), False, 'import logging\n'), ((944, 987), 'datetime.datetime.strptime', 'datetime.strptime', (['dts', '"""%Y.%m.%d:%H.%M.%S"""'], {}), "(dts, '%Y.%m.%d:%H.%M.%S')\n", (961, 987), False, 'from datetime import datetime,... |
# 7/6/2020 Initial
########################################################
import json
from pandas.io.json import json_normalize
import pandas as pd
import os,sys,time,platform
strabspath=os.path.abspath(__file__)
strdirname=os.path.dirname(strabspath)
str_split=os.path.split(strdirname)
prevdirname=str_split[0]
dir... | [
"db_sqlite.DB_sqlite",
"os.path.join",
"os.path.split",
"json.load",
"os.path.dirname",
"platform.system",
"time.time",
"os.path.abspath",
"time.localtime",
"sys.path.append"
] | [((191, 216), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (206, 216), False, 'import os, sys, time, platform\n'), ((228, 255), 'os.path.dirname', 'os.path.dirname', (['strabspath'], {}), '(strabspath)\n', (243, 255), False, 'import os, sys, time, platform\n'), ((266, 291), 'os.path.split',... |
import generate
def encrypt(path,key,outfile):
print("\n-------Encrypting-------")
plain_text = open(str(path),"r")
encoding = open("./encode/"+"C_en","r")
duration = open("./encode/duration","r")
cipher_text = open("c_text","w")
cipher_dur = open("c_dur","w")
#Getting plain text
for l... | [
"generate.generate"
] | [((1676, 1707), 'generate.generate', 'generate.generate', (['key', 'outfile'], {}), '(key, outfile)\n', (1693, 1707), False, 'import generate\n')] |
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
class GaussianLayer(nn.Module):
def __init__(self, max_sigma, normalize=True):
super().__init__()
self.max_sigma = max_sigma
self.kernel_size = math.ceil(6*self.max_sigma)
if self.kernel_size % 2 =... | [
"torch.nn.functional.conv2d",
"math.ceil",
"torch.exp",
"torch.tensor",
"torch.meshgrid",
"torch.arange"
] | [((259, 288), 'math.ceil', 'math.ceil', (['(6 * self.max_sigma)'], {}), '(6 * self.max_sigma)\n', (268, 288), False, 'import math\n'), ((485, 512), 'torch.tensor', 'torch.tensor', (['(max_sigma / 2)'], {}), '(max_sigma / 2)\n', (497, 512), False, 'import torch\n'), ((644, 687), 'torch.arange', 'torch.arange', (['(-self... |
'''
信号源,网口控制,测试灵敏度需要用到
'''
import time
import logging
from commoninterface.smbvbase import SMBVBase
logger = logging.getLogger('ghost')
class SMBV(SMBVBase):
def __init__(self):
SMBVBase.__init__(self)
if __name__ == '__main__':
smbv = SMBV()
smbv.init_smbv('192.168.1.12')
smbv.set_smbv... | [
"logging.getLogger",
"commoninterface.smbvbase.SMBVBase.__init__"
] | [((111, 137), 'logging.getLogger', 'logging.getLogger', (['"""ghost"""'], {}), "('ghost')\n", (128, 137), False, 'import logging\n'), ((194, 217), 'commoninterface.smbvbase.SMBVBase.__init__', 'SMBVBase.__init__', (['self'], {}), '(self)\n', (211, 217), False, 'from commoninterface.smbvbase import SMBVBase\n')] |
"""
By <NAME>, Nov 29, 2019
"""
from examples.PlannerExample import Planner_Example, np
if __name__ == "__main__":
random_seed = np.random.randint(0, 10000, (2,))
# random_seed = [8881, 7511]
Planner_Example(method="AStar", display_result=True, update_nearby_grd=False,
random_s... | [
"examples.PlannerExample.np.random.randint",
"examples.PlannerExample.Planner_Example"
] | [((140, 173), 'examples.PlannerExample.np.random.randint', 'np.random.randint', (['(0)', '(10000)', '(2,)'], {}), '(0, 10000, (2,))\n', (157, 173), False, 'from examples.PlannerExample import Planner_Example, np\n'), ((213, 346), 'examples.PlannerExample.Planner_Example', 'Planner_Example', ([], {'method': '"""AStar"""... |
from django import forms
from sysrev.api import PubMed
from sysrev.models import *
from widgets import *
class ProfileForm(forms.ModelForm):
class Meta:
model = User
fields = ("email",)
def clean_email(self):
email = self.cleaned_data.get('email')
if self.instance and self.i... | [
"sysrev.api.PubMed.get_data_from_query",
"sysrev.api.PubMed.get_query_limit",
"django.forms.CharField",
"django.forms.ValidationError"
] | [((580, 633), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(128)', 'label': '"""Review Title"""'}), "(max_length=128, label='Review Title')\n", (595, 633), False, 'from django import forms\n'), ((652, 706), 'django.forms.CharField', 'forms.CharField', ([], {'widget': 'forms.Textarea', 'required': '... |
import time
import zmq
server_context = zmq.context()
| [
"zmq.context"
] | [((41, 54), 'zmq.context', 'zmq.context', ([], {}), '()\n', (52, 54), False, 'import zmq\n')] |
# *******************************************************************************************
# *******************************************************************************************
#
# Name : make_tok.py
# Purpose : Create tokenisation test.
# Date : 12th June 2019
# Author : <NAME> (<EMAIL>)
#
# *******... | [
"random.randint",
"random.seed"
] | [((1068, 1081), 'random.seed', 'random.seed', ([], {}), '()\n', (1079, 1081), False, 'import random\n'), ((1089, 1113), 'random.randint', 'random.randint', (['(0)', '(99999)'], {}), '(0, 99999)\n', (1103, 1113), False, 'import random\n'), ((1158, 1175), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1169, 1... |
import boto3
import os
def get_boto_client():
print("AUTH_METHOD: " + str(os.getenv('AUTH_METHOD')))
if os.getenv('AUTH_METHOD') == 'SSO':
boto3.setup_default_session(profile_name=os.getenv('SSO_PROFILE'))
print("SSO Authentication")
else:
print("AWS KEYS a... | [
"os.getenv"
] | [((122, 146), 'os.getenv', 'os.getenv', (['"""AUTH_METHOD"""'], {}), "('AUTH_METHOD')\n", (131, 146), False, 'import os\n'), ((84, 108), 'os.getenv', 'os.getenv', (['"""AUTH_METHOD"""'], {}), "('AUTH_METHOD')\n", (93, 108), False, 'import os\n'), ((210, 234), 'os.getenv', 'os.getenv', (['"""SSO_PROFILE"""'], {}), "('SS... |
'''Copyright 2017, Deepak
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions i... | [
"re.findall",
"functools.partial",
"datetime.date"
] | [((1596, 1633), 'datetime.date', 'date', (['self.year', 'self.month', 'self.day'], {}), '(self.year, self.month, self.day)\n', (1600, 1633), False, 'from datetime import date, datetime\n'), ((3167, 3197), 're.findall', 're.findall', (['regex', 'matchstring'], {}), '(regex, matchstring)\n', (3177, 3197), False, 'import ... |
from flask_restful import Resource, reqparse, fields, marshal_with
# from com_cheese_api.usr.user import UserDto
from com_cheese_api.ext.db import db, openSession
from com_cheese_api.usr.user.model.user_dto import UserDto
from com_cheese_api.cop.itm.cheese.model.cheese_dto import CheeseDto
# ==========================... | [
"com_cheese_api.ext.db.db.String",
"com_cheese_api.ext.db.db.Column",
"com_cheese_api.ext.db.db.ForeignKey"
] | [((884, 935), 'com_cheese_api.ext.db.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)', 'index': '(True)'}), '(db.Integer, primary_key=True, index=True)\n', (893, 935), False, 'from com_cheese_api.ext.db import db, openSession\n'), ((975, 989), 'com_cheese_api.ext.db.db.String', 'db.String', (['(100)']... |
# Copyright 2016 Intel
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar... | [
"syntribos.extensions.nova.client.get_aggregate_id",
"mock.patch",
"syntribos.extensions.nova.client.get_hypervisor_id",
"syntribos.utils.config_fixture.ConfFixture"
] | [((1471, 1563), 'mock.patch', 'mock.patch', (['"""syntribos.extensions.nova.client._get_client"""'], {'side_effect': 'fake_get_client'}), "('syntribos.extensions.nova.client._get_client', side_effect=\n fake_get_client)\n", (1481, 1563), False, 'import mock\n'), ((1733, 1825), 'mock.patch', 'mock.patch', (['"""syntr... |
from enum import Enum
import asyncio
import random
import logging
import time
logger = logging.getLogger(__name__)
class PeerState(Enum):
LEADER = 1
CANDIDATE = 2
FOLLOWER = 3
TERMINATING = 4
class RaftConsensus:
def __init__(self,
communicator,
registry,
... | [
"logging.getLogger",
"random.uniform",
"asyncio.sleep",
"asyncio.Event",
"asyncio.wait_for",
"asyncio.gather",
"time.time"
] | [((88, 115), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (105, 115), False, 'import logging\n'), ((948, 963), 'asyncio.Event', 'asyncio.Event', ([], {}), '()\n', (961, 963), False, 'import asyncio\n'), ((1075, 1125), 'random.uniform', 'random.uniform', (['self.min_timeout', 'self.max_t... |
from keras.models import Sequential, load_model
from keras.layers import Dense, Reshape, Flatten, Conv2D, Conv2DTranspose, BatchNormalization, Activation
from keras.layers.advanced_activations import LeakyReLU
from keras.optimizers import Adam, SGD
from keras.backend import clear_session
import numpy as np
import os
i... | [
"numpy.random.normal",
"keras.optimizers.Adam",
"keras.layers.Conv2D",
"keras.models.load_model",
"scipy.misc.imsave",
"os.path.join",
"logging.info",
"keras.layers.advanced_activations.LeakyReLU",
"app.utils.mkdir_p",
"keras.models.Sequential",
"numpy.array",
"keras.layers.Conv2DTranspose",
... | [((1072, 1092), 'keras.models.load_model', 'load_model', (['filename'], {}), '(filename)\n', (1082, 1092), False, 'from keras.models import Sequential, load_model\n'), ((1277, 1297), 'keras.models.load_model', 'load_model', (['filename'], {}), '(filename)\n', (1287, 1297), False, 'from keras.models import Sequential, l... |
import os
import glob
import picamera
import cv2
import numpy as np
import importlib.util
from datetime import datetime
import videorecorder as vr
import time
from collections import Counter
# If using TPU, need to load a different library
# from tensorflow.lite.python.interpreter import Interpreter
def take_picture... | [
"cv2.rectangle",
"time.sleep",
"cv2.imshow",
"glob.glob",
"numpy.float32",
"picamera.PiCamera",
"cv2.putText",
"cv2.cvtColor",
"cv2.getTextSize",
"cv2.resize",
"cv2.imread",
"os.path.join",
"videorecorder.VideoRecorder",
"os.getcwd",
"collections.Counter",
"datetime.datetime.now",
"t... | [((397, 416), 'picamera.PiCamera', 'picamera.PiCamera', ([], {}), '()\n', (414, 416), False, 'import picamera\n'), ((744, 774), 'os.path.join', 'os.path.join', (['path', 'cone_color'], {}), '(path, cone_color)\n', (756, 774), False, 'import os\n'), ((802, 831), 'videorecorder.VideoRecorder', 'vr.VideoRecorder', (['path... |
from torch.utils.data import Dataset, DataLoader
import os
import json
import sys
import csv
import itertools
import numpy as np
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
UTILS_DIR = os.path.abspath(os.path.join(BASE_DIR, '..', 'utils'))
sys.path.append(UTILS_DIR)
from data_helper import *
from coord_helpe... | [
"torch.manual_seed",
"os.path.exists",
"numpy.ones",
"rotation_lib.angle_axis_from_quaternion",
"os.path.join",
"numpy.append",
"numpy.stack",
"numpy.zeros",
"numpy.array",
"rotation_lib.quat2mat",
"torch.utils.data.DataLoader",
"os.path.abspath",
"numpy.load",
"sys.path.append",
"torch.... | [((250, 276), 'sys.path.append', 'sys.path.append', (['UTILS_DIR'], {}), '(UTILS_DIR)\n', (265, 276), False, 'import sys\n'), ((156, 181), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (171, 181), False, 'import os\n'), ((211, 248), 'os.path.join', 'os.path.join', (['BASE_DIR', '""".."""', '... |
import os
import sys
import pysam
from itertools import chain, tee, izip
import cPickle as pickle
from collections import defaultdict, Counter, namedtuple
#--------------------------------------------------------------------------
# os
#--------------------------------------------------------------------------
def mkd... | [
"cPickle.dump",
"os.makedirs",
"os.utime",
"os.getcwd",
"os.chdir",
"os.path.isdir",
"itertools.izip",
"itertools.tee",
"cPickle.load",
"pysam.FastaFile"
] | [((1201, 1245), 'cPickle.dump', 'pickle.dump', (['obj', 'f', 'pickle.HIGHEST_PROTOCOL'], {}), '(obj, f, pickle.HIGHEST_PROTOCOL)\n', (1212, 1245), True, 'import cPickle as pickle\n'), ((1329, 1343), 'cPickle.load', 'pickle.load', (['f'], {}), '(f)\n', (1340, 1343), True, 'import cPickle as pickle\n'), ((1570, 1583), 'i... |
import sys
import os
this_path = os.path.dirname(os.path.realpath(__file__))
root_path = os.path.abspath(os.path.join(this_path, os.pardir, os.pardir, os.pardir, os.pardir))
sys.path.append(root_path)
from utilities import paths
import torch
from models.baseline.vqa.cyanogenoid.model import Net
import models.baseline... | [
"torch.manual_seed",
"PIL.Image.open",
"os.path.join",
"models.baseline.vqa.cyanogenoid.preprocess_images.Net",
"os.path.realpath",
"utilities.paths.resources_path",
"torch.tensor",
"models.baseline.vqa.cyanogenoid.utils.resize_image",
"models.baseline.vqa.cyanogenoid.utils.normalized_tensor_image",... | [((175, 201), 'sys.path.append', 'sys.path.append', (['root_path'], {}), '(root_path)\n', (190, 201), False, 'import sys\n'), ((50, 76), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (66, 76), False, 'import os\n'), ((106, 173), 'os.path.join', 'os.path.join', (['this_path', 'os.pardir', '... |
import torch
def flipud(tensor):
"""
Flips a given tensor along the first dimension (up to down)
Parameters
----------
tensor
a tensor at least two-dimensional
Returns
-------
Tensor
the flipped tensor
"""
return torch.flip(tensor, dims=[0])
| [
"torch.flip"
] | [((274, 302), 'torch.flip', 'torch.flip', (['tensor'], {'dims': '[0]'}), '(tensor, dims=[0])\n', (284, 302), False, 'import torch\n')] |
from pygments import highlight
from pygments.formatters.terminal256 import Terminal256Formatter
from pygments.lexers.python import Python3Lexer
from pygments.styles import get_style_by_name
from pygments.util import ClassNotFound
from piston.colorschemes import scheme_dict
from piston.utils.constants import CONSOLE, T... | [
"pygments.formatters.terminal256.Terminal256Formatter",
"piston.utils.constants.CONSOLE.print",
"pygments.styles.get_style_by_name",
"pygments.lexers.python.Python3Lexer"
] | [((465, 541), 'piston.utils.constants.CONSOLE.print', 'CONSOLE.print', (['f"""[bold red underline]Theme {theme}: [/bold red underline]\n"""'], {}), "(f'[bold red underline]Theme {theme}: [/bold red underline]\\n')\n", (478, 541), False, 'from piston.utils.constants import CONSOLE, THEME_PREVIEW, themes\n'), ((575, 599)... |
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import pins
from esphome.components import sensor
from esphome.const import (
CONF_ID,
CONF_CLOCK_PIN,
CONF_DATA_PIN,
CONF_CO2,
CONF_TEMPERATURE,
CONF_HUMIDITY,
DEVICE_CLASS_CARBON_DIOXIDE,
DEVICE_CLASS_HUMI... | [
"esphome.codegen.new_Pvariable",
"esphome.components.sensor.new_sensor",
"esphome.codegen.register_component",
"esphome.config_validation.polling_component_schema",
"esphome.cpp_helpers.gpio_pin_expression",
"esphome.config_validation.Optional",
"esphome.config_validation.All",
"esphome.config_validat... | [((539, 572), 'esphome.codegen.esphome_ns.namespace', 'cg.esphome_ns.namespace', (['"""zyaura"""'], {}), "('zyaura')\n", (562, 572), True, 'import esphome.codegen as cg\n'), ((1696, 1730), 'esphome.config_validation.polling_component_schema', 'cv.polling_component_schema', (['"""60s"""'], {}), "('60s')\n", (1723, 1730)... |
import pytest
from basic_shopify_api import Options
def test_options_version():
opts = Options()
opts.version = "unstable"
assert opts.version == "unstable"
def test_options_failed_version():
with pytest.raises(ValueError):
opts = Options()
opts.version = "oops"
def test_options_ty... | [
"pytest.raises",
"basic_shopify_api.Options"
] | [((93, 102), 'basic_shopify_api.Options', 'Options', ([], {}), '()\n', (100, 102), False, 'from basic_shopify_api import Options\n'), ((337, 346), 'basic_shopify_api.Options', 'Options', ([], {}), '()\n', (344, 346), False, 'from basic_shopify_api import Options\n'), ((217, 242), 'pytest.raises', 'pytest.raises', (['Va... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | [
"pytest.mark.credential_file",
"textwrap.dedent",
"urllib.parse.urlparse",
"tests.test_utils.gcp_system_helpers.GoogleSystemTest._project_id",
"json.dumps",
"os.environ.get",
"requests.get",
"shlex.quote",
"tests.test_utils.gcp_system_helpers.provide_gcp_context",
"tempfile.NamedTemporaryFile",
... | [((1452, 1492), 'pytest.mark.backend', 'pytest.mark.backend', (['"""mysql"""', '"""postgres"""'], {}), "('mysql', 'postgres')\n", (1471, 1492), False, 'import pytest\n'), ((1494, 1539), 'pytest.mark.credential_file', 'pytest.mark.credential_file', (['GCP_DATAFLOW_KEY'], {}), '(GCP_DATAFLOW_KEY)\n', (1521, 1539), False,... |
"""
<NAME>
descriptor.py
Takes in a directory of sub-directories of images and produces a descriptor
file for all the images found in the sub-directories.
,:'/ _..._
// ( `""-.._.'
\| / 6\___
... | [
"os.listdir",
"pickle.dump",
"numpy.histogramdd",
"numpy.hstack",
"numpy.empty",
"sys.exit",
"cv2.imread"
] | [((1863, 1884), 'os.listdir', 'os.listdir', (['train_dir'], {}), '(train_dir)\n', (1873, 1884), False, 'import os\n'), ((2230, 2245), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (2240, 2245), False, 'import os\n'), ((2738, 2771), 'numpy.histogramdd', 'np.histogramdd', (['pixels', '(t, t, t)'], {}), '(pixels, ... |
from donut import email_utils
import flask
import smtplib
from donut.modules.core.helpers import get_name_and_email
from donut.modules.groups import helpers as groups
def get_past_messages(group_id, limit=5):
"""Returns a list of past sent messages"""
query = """
SELECT newsgroup_post_id, subject, messag... | [
"donut.modules.core.helpers.get_name_and_email",
"donut.email_utils.send_email",
"flask.g.pymysql_db.cursor"
] | [((444, 471), 'flask.g.pymysql_db.cursor', 'flask.g.pymysql_db.cursor', ([], {}), '()\n', (469, 471), False, 'import flask\n'), ((721, 748), 'flask.g.pymysql_db.cursor', 'flask.g.pymysql_db.cursor', ([], {}), '()\n', (746, 748), False, 'import flask\n'), ((1402, 1429), 'flask.g.pymysql_db.cursor', 'flask.g.pymysql_db.c... |
import pytest
from bitey.computer.computer import Computer
def build_computer():
computer = None
with open("chip/6502.json") as f:
chip_data = f.read()
computer = Computer.build_from_json(chip_data)
return computer
return None
# module scope means run once per test module
@pyte... | [
"pytest.fixture",
"bitey.computer.computer.Computer.build_from_json"
] | [((316, 346), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (330, 346), False, 'import pytest\n'), ((190, 225), 'bitey.computer.computer.Computer.build_from_json', 'Computer.build_from_json', (['chip_data'], {}), '(chip_data)\n', (214, 225), False, 'from bitey.computer.compu... |
#! /usr/bin/env python
#-******************************************************************************
#
# Copyright (c) 2012-2013,
# Sony Pictures Imageworks Inc. and
# Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
#
# All rights reserved.
#
# Redistribution and use in source and bina... | [
"colorsys.hsv_to_rgb"
] | [((2358, 2381), 'colorsys.hsv_to_rgb', 'colorsys.hsv_to_rgb', (['*x'], {}), '(*x)\n', (2377, 2381), False, 'import colorsys\n')] |
import datetime
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
# 日期列表
events = [
datetime.date(2015, 1, 23),
datetime.date(2015, 1, 28),
datetime.date(2015, 2, 3),
datetime.date(2015, 2, 21),
datetime.date(2015, 3, 15),
datetime.date(2015, 3, 24),
datetime.date(2015, 4, ... | [
"matplotlib.dates.MonthLocator",
"matplotlib.dates.DateFormatter",
"matplotlib.pyplot.plot",
"datetime.date",
"matplotlib.dates.DayLocator",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((444, 465), 'matplotlib.dates.MonthLocator', 'mdates.MonthLocator', ([], {}), '()\n', (463, 465), True, 'import matplotlib.dates as mdates\n'), ((473, 492), 'matplotlib.dates.DayLocator', 'mdates.DayLocator', ([], {}), '()\n', (490, 492), True, 'import matplotlib.dates as mdates\n'), ((503, 532), 'matplotlib.dates.Da... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-14 18:01
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('vtn', '0022_auto_20171114_1718'),
]
... | [
"datetime.datetime",
"django.db.migrations.DeleteModel",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((1229, 1286), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""reports"""', 'name': '"""site"""'}), "(model_name='reports', name='site')\n", (1251, 1286), False, 'from django.db import migrations, models\n'), ((2109, 2147), 'django.db.migrations.DeleteModel', 'migrations.DeleteMod... |
from setuptools import find_packages, setup
setup(
name='seizurecast',
packages=find_packages(),
version='0.1.0',
description='ReReal-time forecasting epileptic seizure using electroencephalogram',
author='<NAME>',
license='MIT',
)
| [
"setuptools.find_packages"
] | [((89, 104), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (102, 104), False, 'from setuptools import find_packages, setup\n')] |
import logging
from testplan import test_plan
from testplan.report import Status
from testplan.report.testing.styles import Style, StyleEnum
from testplan.testing.base import ASSERTION_INDENT
from testplan.testing.multitest import MultiTest, testsuite, testcase
from testplan.testing.multitest.logging import (
Capt... | [
"logging.getLogger",
"testplan.report.testing.styles.Style"
] | [((4539, 4616), 'testplan.report.testing.styles.Style', 'Style', ([], {'passing': 'StyleEnum.ASSERTION_DETAIL', 'failing': 'StyleEnum.ASSERTION_DETAIL'}), '(passing=StyleEnum.ASSERTION_DETAIL, failing=StyleEnum.ASSERTION_DETAIL)\n', (4544, 4616), False, 'from testplan.report.testing.styles import Style, StyleEnum\n'), ... |
import os
import json
import logging
import argparse
import sys
from blocksec2go.comm.pyscard import open_pyscard
from blocksec2go.comm.scp03 import SCP03, SECLEVEL_CMAC
from binascii import unhexlify, hexlify
from Crypto.Cipher import AES
def select_ISD(reader):
aid = bytes.fromhex('A000000151000000')
respon... | [
"os.path.exists",
"argparse.ArgumentParser",
"blocksec2go.comm.scp03.SCP03",
"blocksec2go.comm.pyscard.open_pyscard",
"json.load",
"binascii.unhexlify"
] | [((476, 483), 'blocksec2go.comm.scp03.SCP03', 'SCP03', ([], {}), '()\n', (481, 483), False, 'from blocksec2go.comm.scp03 import SCP03, SECLEVEL_CMAC\n'), ((1703, 1852), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': 'prog', 'description': '"""Command line interface to replace keys for Infineon\'s B... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-21 20:11
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('remotes', '0002_initial_data'),
... | [
"django.db.models.CharField"
] | [((956, 1023), 'django.db.models.CharField', 'models.CharField', ([], {'default': 'django.utils.timezone.now', 'max_length': '(255)'}), '(default=django.utils.timezone.now, max_length=255)\n', (972, 1023), False, 'from django.db import migrations, models\n')] |
# -*- coding: utf-8 -*-
# @version : Python3.6
# @Time : 2017/4/7 11:03
# @Author : Jianyang-Hu
# @contact : <EMAIL>
# @File : socket-client_0407.py
# @Software: PyCharm
# 解决粘包的问题
import socket
ip_address = '192.168.56.1'
port = 8888
conn_address = (ip_address,port)
client = socket.socket()
client.connect(conn... | [
"socket.socket"
] | [((285, 300), 'socket.socket', 'socket.socket', ([], {}), '()\n', (298, 300), False, 'import socket\n')] |
from iris_global_object import IrisGlobalObject
from employee import SalaryEmployee
# print(SalaryEmployee(1,'me',123).__dict__)
obj1 = IrisGlobalObject()
obj1.prop1 = 'Prop1'
obj1.prop2 = 123
obj1.prop3 = 123.456
obj1.prop4 = True
obj1.prop5 = None
emp = SalaryEmployee(10,'me',123)
emp.note = 'note note note...'
obj... | [
"employee.SalaryEmployee",
"inspect.signature",
"iris_global_object.IrisGlobalObject"
] | [((138, 156), 'iris_global_object.IrisGlobalObject', 'IrisGlobalObject', ([], {}), '()\n', (154, 156), False, 'from iris_global_object import IrisGlobalObject\n'), ((258, 287), 'employee.SalaryEmployee', 'SalaryEmployee', (['(10)', '"""me"""', '(123)'], {}), "(10, 'me', 123)\n", (272, 287), False, 'from employee import... |
import os
import tld
datas = [(os.path.dirname(tld.__file__) + "/res/*.txt", "tld/res/")] | [
"os.path.dirname"
] | [((32, 61), 'os.path.dirname', 'os.path.dirname', (['tld.__file__'], {}), '(tld.__file__)\n', (47, 61), False, 'import os\n')] |
#!/usr/bin/env python
"""
A simple coin flipping example. The model is written in PyMC3.
Inspired by Stan's toy example.
Probability model
Prior: Beta
Likelihood: Bernoulli
Variational model
Likelihood: Mean-field Beta
"""
import edward as ed
import pymc3 as pm
import numpy as np
import theano
from edward... | [
"edward.MFVI",
"edward.models.Beta",
"pymc3.Beta",
"edward.models.PyMC3Model",
"numpy.array",
"numpy.zeros",
"pymc3.Model",
"edward.models.Variational",
"pymc3.Bernoulli"
] | [((650, 680), 'edward.models.PyMC3Model', 'PyMC3Model', (['model', 'data_shared'], {}), '(model, data_shared)\n', (660, 680), False, 'from edward.models import PyMC3Model, Variational, Beta\n'), ((695, 708), 'edward.models.Variational', 'Variational', ([], {}), '()\n', (706, 708), False, 'from edward.models import PyMC... |
""" Usage:
merge_pandas_conll --out=OUTPUT_FN <filenames>...
Merge a list of data frames in csv format and print to output file.
"""
from docopt import docopt
import pandas as pd
import logging
logging.basicConfig(level = logging.DEBUG)
if __name__ == "__main__":
args = docopt(__doc__)
logging.debug(args)... | [
"logging.basicConfig",
"logging.debug",
"docopt.docopt",
"pandas.read_csv"
] | [((199, 239), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (218, 239), False, 'import logging\n'), ((281, 296), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (287, 296), False, 'from docopt import docopt\n'), ((301, 320), 'logging.debug', 'log... |
# **************************************************************************
# Copyright 2018-2019 eBay Inc.
# Author/Developers: --
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https:... | [
"pandas.np.float",
"distutils.util.strtobool",
"pandas.np.bool"
] | [((887, 902), 'distutils.util.strtobool', 'strtobool', (['data'], {}), '(data)\n', (896, 902), False, 'from distutils.util import strtobool\n'), ((918, 940), 'pandas.np.bool', 'pd.np.bool', (['bool_value'], {}), '(bool_value)\n', (928, 940), True, 'import pandas as pd\n'), ((1088, 1105), 'pandas.np.float', 'pd.np.float... |
from core.base_environment import *
import numpy as np
from overrides import overrides
from pyhelper_fns import vis_utils
def str2action(cmd):
cmd = cmd.strip()
if cmd == 'w':
#up
ctrl = [0, 0.1]
elif cmd == 'a':
#left
ctrl = [-0.1, 0]
elif cmd == 'd':
#right
ctrl = [0.1, 0]
elif cmd ... | [
"numpy.clip",
"pyhelper_fns.vis_utils.MyAnimation",
"numpy.where",
"numpy.array",
"numpy.zeros",
"numpy.linspace",
"numpy.sum"
] | [((1424, 1438), 'numpy.zeros', 'np.zeros', (['(2,)'], {}), '((2,))\n', (1432, 1438), True, 'import numpy as np\n'), ((1470, 1484), 'numpy.zeros', 'np.zeros', (['(2,)'], {}), '((2,))\n', (1478, 1484), True, 'import numpy as np\n'), ((1516, 1530), 'numpy.zeros', 'np.zeros', (['(2,)'], {}), '((2,))\n', (1524, 1530), True,... |
from autodp.mechanism_zoo import PureDP_Mechanism
from autodp.transformer_zoo import Composition
# Example: pure DP mechanism and composition of it
eps = 0.3
mech = PureDP_Mechanism(eps, name='Laplace')
import matplotlib.pyplot as plt
fpr_list, fnr_list = mech.plot_fDP()
plt.figure(1)
plt.plot(fpr_list,fnr_list,... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"autodp.transformer_zoo.Composition",
"autodp.mechanism_zoo.PureDP_Mechanism",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((170, 207), 'autodp.mechanism_zoo.PureDP_Mechanism', 'PureDP_Mechanism', (['eps'], {'name': '"""Laplace"""'}), "(eps, name='Laplace')\n", (186, 207), False, 'from autodp.mechanism_zoo import PureDP_Mechanism\n'), ((279, 292), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (289, 292), True, 'import ... |
from flask import Flask
from developers import developers
app = Flask(__name__)
app.register_blueprint(developers)
@app.route('/')
def index():
return 'Index Page'
if __name__ == '__main__':
app.run(debug=False, host='0.0.0.0')
| [
"flask.Flask"
] | [((65, 80), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (70, 80), False, 'from flask import Flask\n')] |
from asyncio_rpc.base import AbstractRPCCommLayer
from asyncio_rpc.models import RPCBase
from aioprocessing import AioQueue
class AiopQueueCommLayer(AbstractRPCCommLayer):
"""
aioprocessing.Queue remote procedure call communication layer
"""
@classmethod
def create_pair(cls):
q1, q2 = AioQu... | [
"aioprocessing.AioQueue"
] | [((315, 325), 'aioprocessing.AioQueue', 'AioQueue', ([], {}), '()\n', (323, 325), False, 'from aioprocessing import AioQueue\n'), ((327, 337), 'aioprocessing.AioQueue', 'AioQueue', ([], {}), '()\n', (335, 337), False, 'from aioprocessing import AioQueue\n')] |
import inspect
from typing import Union, get_origin, get_args
def f(x: int, y: int | None ) -> int:
return x + y
a = inspect.get_annotations(f)
print(a)
y = a['y']
print(y)
t = type(y)
print(t)
#print(t.__dict__)
print(get_args(y))
| [
"inspect.get_annotations",
"typing.get_args"
] | [((124, 150), 'inspect.get_annotations', 'inspect.get_annotations', (['f'], {}), '(f)\n', (147, 150), False, 'import inspect\n'), ((226, 237), 'typing.get_args', 'get_args', (['y'], {}), '(y)\n', (234, 237), False, 'from typing import Union, get_origin, get_args\n')] |
'''
Created November 2018
@author: <NAME>
'''
from dragonfly import Key
from castervoice.lib.actions import Text
from castervoice.rules.ccr.standard import SymbolSpecs
from castervoice.lib.const import CCRType
from castervoice.lib.ctrl.mgr.rule_details import RuleDetails
from castervoice.lib.merge.mergerule import Mer... | [
"castervoice.lib.ctrl.mgr.rule_details.RuleDetails",
"castervoice.lib.actions.Text",
"dragonfly.Key"
] | [((2887, 2922), 'castervoice.lib.ctrl.mgr.rule_details.RuleDetails', 'RuleDetails', ([], {'ccrtype': 'CCRType.GLOBAL'}), '(ccrtype=CCRType.GLOBAL)\n', (2898, 2922), False, 'from castervoice.lib.ctrl.mgr.rule_details import RuleDetails\n'), ((891, 904), 'castervoice.lib.actions.Text', 'Text', (['"""break"""'], {}), "('b... |
import torch
def sample_laplace_noise(loc, scale, shape, dtype, device):
'''
https://github.com/pytorch/pytorch/blob/6911ce19d7fcf06e7af241e6494b23acdc320dc4/torch/distributions/laplace.py
'''
finfo = torch.finfo(dtype)
u = torch.zeros(shape, dtype=dtype, device=device).uniform_(finfo.eps - 1, 1)
... | [
"torch.zeros",
"torch.finfo"
] | [((218, 236), 'torch.finfo', 'torch.finfo', (['dtype'], {}), '(dtype)\n', (229, 236), False, 'import torch\n'), ((245, 291), 'torch.zeros', 'torch.zeros', (['shape'], {'dtype': 'dtype', 'device': 'device'}), '(shape, dtype=dtype, device=device)\n', (256, 291), False, 'import torch\n')] |
import pickle, os, sys
from base64 import b64encode, b64decode
if len(sys.argv) <=2 or sys.argv[1] != "-p":
print ("[!] Usage: python3 pickleme.py -p PAYLOAD_HERE")
sys.exit()
cmd = sys.argv[2]
class RCE(object):
def __reduce__ (self):
return (os.system, (cmd,))
def exploit():
payload = ... | [
"pickle.dumps",
"sys.exit"
] | [((174, 184), 'sys.exit', 'sys.exit', ([], {}), '()\n', (182, 184), False, 'import pickle, os, sys\n'), ((358, 379), 'pickle.dumps', 'pickle.dumps', (['payload'], {}), '(payload)\n', (370, 379), False, 'import pickle, os, sys\n')] |
import torch
import torch.nn as nn
from torch.nn.utils.rnn import PackedSequence
class Data2Tensor():
def __init__(self, all_letters, all_categories):
self.all_letters = all_letters
self.all_categories = all_categories
self.n_letters = len(all_letters)
self.n_categories = len(all_c... | [
"torch.nn.Sigmoid",
"torch.split",
"torch.nn.Tanh",
"torch.load",
"torch.tensor",
"torch.nn.NLLLoss",
"torch.save",
"torch.nn.Linear",
"torch.nn.LogSoftmax",
"torch.zeros",
"torch.cat"
] | [((613, 643), 'torch.zeros', 'torch.zeros', (['(1)', 'self.n_letters'], {}), '(1, self.n_letters)\n', (624, 643), False, 'import torch\n'), ((1216, 1262), 'torch.tensor', 'torch.tensor', (['[category_idx]'], {'dtype': 'torch.long'}), '([category_idx], dtype=torch.long)\n', (1228, 1262), False, 'import torch\n'), ((2193... |
#
# Copyright (c) 2020 The rlutils authors
#
# This source code is licensed under an MIT license found in the LICENSE file in the root directory of this project.
#
from unittest import TestCase
class TestLinearInterpolatedVariableSchedule(TestCase):
def test(self):
import rlutils as rl
schedule =... | [
"rlutils.schedule.LinearInterpolatedVariableSchedule"
] | [((321, 383), 'rlutils.schedule.LinearInterpolatedVariableSchedule', 'rl.schedule.LinearInterpolatedVariableSchedule', (['[0, 1]', '[0, 1]'], {}), '([0, 1], [0, 1])\n', (367, 383), True, 'import rlutils as rl\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 20 09:17:52 2019
@author: <NAME>, https://github.com/zhaofenqiang
Contact: <EMAIL>
"""
import numpy as np
from interp_numpy import resampleSphereSurf, bilinearResampleSphereSurfImg
# from utils import get_neighs_order
def get_rot_mat_zyz(z1, y... | [
"numpy.mean",
"interp_numpy.bilinearResampleSphereSurfImg",
"interp_numpy.resampleSphereSurf",
"numpy.squeeze",
"numpy.array",
"numpy.linspace",
"numpy.cos",
"numpy.sin",
"numpy.transpose",
"numpy.amax"
] | [((1698, 1723), 'numpy.amax', 'np.amax', (['moving_xyz[:, 0]'], {}), '(moving_xyz[:, 0])\n', (1705, 1723), True, 'import numpy as np\n'), ((2101, 2176), 'numpy.linspace', 'np.linspace', (['(Center1 - SearchWidth)', '(Center1 + SearchWidth)'], {'num': 'numIntervals'}), '(Center1 - SearchWidth, Center1 + SearchWidth, num... |
'''
MIT License
Optimal Testing and Containment Strategies for Universities in Mexico amid COVID-19
Copyright © 2021 Test and Contain. <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,and <NAME>. https://www.testandcontain.com/
Permission is hereby granted, free of charge, to any person obtaining a copy of thi... | [
"json.loads",
"pandas.read_csv",
"numpy.trunc",
"dash.dependencies.Output",
"dash_core_components.Location",
"dash.dependencies.Input",
"dash.callback_context.response.set_cookie",
"preprocess._",
"pandas.DataFrame",
"dash.dependencies.State",
"time.time",
"random.randint",
"dash_html_compon... | [((1966, 2000), 'dash.dependencies.Output', 'Output', (['"""page-content"""', '"""children"""'], {}), "('page-content', 'children')\n", (1972, 2000), False, 'from dash.dependencies import Input, Output, State, MATCH, ALL\n'), ((5528, 5554), 'dash.dependencies.Input', 'Input', (['"""campus_id"""', '"""data"""'], {}), "(... |
# encoding = UTF-8
import numpy as np
import message_passing
import nn
import randomtest
import matplotlib.pyplot as plt
def draw_graph(result, k):
x_values = range(1, k+2)
y_values = result
'''
scatter()
x:横坐标 y:纵坐标 s:点的尺寸
'''
plt.scatter(x_values, y_values, s=10)
# 设置图表标题并给坐标轴加上标签... | [
"numpy.random.random_sample",
"matplotlib.pyplot.ylabel",
"numpy.average",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.tick_params",
"numpy.diag",
"numpy.zeros",
"numpy.random.randint",
"numpy.dot",
"matplotlib.pyplot.scatter",
"numpy.linalg.svd",
"matplotlib.pyplot.title",
"matplotlib.py... | [((705, 721), 'numpy.zeros', 'np.zeros', (['(M, N)'], {}), '((M, N))\n', (713, 721), True, 'import numpy as np\n'), ((726, 737), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (734, 737), True, 'import numpy as np\n'), ((749, 769), 'numpy.zeros', 'np.zeros', (['[N, 10000]'], {}), '([N, 10000])\n', (757, 769), True, '... |
from collections import defaultdict
import timeit as t
import random
def solve_n_queens(problem_size):
return NQueens(problem_size).solve()
def verify_solution(solution):
return solution.is_solved()
def arg_random_el(arr, el):
return random.choice([id for id, val in enumerate(arr) if val == el])
def a... | [
"timeit.default_timer",
"random.randrange"
] | [((4829, 4846), 'timeit.default_timer', 't.default_timer', ([], {}), '()\n', (4844, 4846), True, 'import timeit as t\n'), ((583, 616), 'random.randrange', 'random.randrange', (['(0)', 'problem_size'], {}), '(0, problem_size)\n', (599, 616), False, 'import random\n'), ((4906, 4923), 'timeit.default_timer', 't.default_ti... |
"""
Generic algorithms for data structure processing, etc.
"""
from itertools import groupby
##
# Generic matrix and vector processing tasks.
##
def index_vector(v):
"""
Return an index for values in the given sequence
>>> index_vector( (9, 8, 7))
{9: 0, 8: 1, 7: 2}
"""
retur... | [
"itertools.groupby"
] | [((3057, 3088), 'itertools.groupby', 'groupby', (['sparse_matrix', 'row_key'], {}), '(sparse_matrix, row_key)\n', (3064, 3088), False, 'from itertools import groupby\n')] |
import random
import itertools
import argparse
import time
import copy
class Playgame_vscode:
def __init__(self,ans=None,mode="manual") -> None:
self.digits = 5
self.count = 0
self.history = []
self.list_num_place = []
self.list_possible_ans_combination = []
self.lis... | [
"random.sample",
"random.choice",
"argparse.ArgumentParser",
"itertools.combinations",
"itertools.permutations"
] | [((8108, 8163), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Hit&Blow, 数当てゲーム"""'}), "(description='Hit&Blow, 数当てゲーム')\n", (8131, 8163), False, 'import argparse\n'), ((685, 721), 'random.sample', 'random.sample', (['Tuple_16', 'self.digits'], {}), '(Tuple_16, self.digits)\n', (698, 721... |
import numpy as np
import time
import md_simple
import md_nnps
from compyle.config import get_config
def solve(n, backend, solver_algo, tf=0.5, dt=0.02, use_count_sort=False):
solver = solver_algo(n, backend=backend.replace("_omp", ""))
start = time.time()
solver.solve(tf, dt)
end = time.time()
p... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.loglog",
"argparse.ArgumentParser",
"matplotlib.pyplot.ylabel",
"compyle.config.get_config",
"matplotlib.pyplot.semilogx",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.figure",
"time.time",
"ma... | [((256, 267), 'time.time', 'time.time', ([], {}), '()\n', (265, 267), False, 'import time\n'), ((303, 314), 'time.time', 'time.time', ([], {}), '()\n', (312, 314), False, 'import time\n'), ((1684, 1745), 'matplotlib.pyplot.loglog', 'plt.loglog', (['n_list', 'nnps_tlist[backend]', '"""x-"""'], {'label': '"""Linear"""'})... |
import pytest
from decimal import Decimal
from importer.page_importer import PageImporter
from pages.event_page.models import EventPage
import pages.event_page.fixtures as fixtures
from pages.event_page.factories import EventPageFactory
import pages.event_page.fixtures.helpers.components as components
@pytest.mark.d... | [
"pages.event_page.fixtures.three_fees",
"pages.event_page.fixtures.title",
"pytest.mark.skip",
"pages.event_page.fixtures.helpers.components.remote_location_block",
"pages.event_page.fixtures.at_remote_location",
"pages.event_page.fixtures.helpers.components.city_location_block",
"pages.event_page.fixtu... | [((2371, 2404), 'pytest.mark.skip', 'pytest.mark.skip', (['"""importer test"""'], {}), "('importer test')\n", (2387, 2404), False, 'import pytest\n'), ((3386, 3419), 'pytest.mark.skip', 'pytest.mark.skip', (['"""importer test"""'], {}), "('importer test')\n", (3402, 3419), False, 'import pytest\n'), ((5010, 5043), 'pyt... |
# -*- coding: future_fstrings -*-
import colorsys
import logging
from approxeng.hwsupport.css4_colours import CSS4_COLOURS
from approxeng.hwsupport.util import check_positive, check_positive_range
LOGGER = logging.getLogger(name='approxeng.hwsupport.leds')
LEDS = 'leds'
class LED:
def __init__(self, led, boar... | [
"logging.getLogger",
"approxeng.hwsupport.util.check_positive_range",
"approxeng.hwsupport.util.check_positive",
"colorsys.hsv_to_rgb",
"colorsys.rgb_to_hsv"
] | [((209, 259), 'logging.getLogger', 'logging.getLogger', ([], {'name': '"""approxeng.hwsupport.leds"""'}), "(name='approxeng.hwsupport.leds')\n", (226, 259), False, 'import logging\n'), ((1327, 1357), 'colorsys.hsv_to_rgb', 'colorsys.hsv_to_rgb', (['*self.hsv'], {}), '(*self.hsv)\n', (1346, 1357), False, 'import colorsy... |
from bs4 import BeautifulSoup
from splinter import Browser
import pandas as pd
from webdriver_manager.chrome import ChromeDriverManager
import requests
def init_browser():
executable_path = {'executable_path': ChromeDriverManager().install()}
return Browser('chrome', **executable_path, headless=False)
def sc... | [
"bs4.BeautifulSoup",
"splinter.Browser",
"webdriver_manager.chrome.ChromeDriverManager",
"pandas.read_html"
] | [((260, 312), 'splinter.Browser', 'Browser', (['"""chrome"""'], {'headless': '(False)'}), "('chrome', **executable_path, headless=False)\n", (267, 312), False, 'from splinter import Browser\n'), ((476, 510), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (489, 510)... |
import pymysql
from pymysql.cursors import DictCursor
DOMAIN = 'https://lucky-spb.online/'
def execute_target():
connection = pymysql.connect(
host='localhost',
user='django',
password='<PASSWORD>',
db='SellBuildKRD',
charset='utf8mb4',
cursorclass=DictCursor
)
... | [
"pymysql.connect"
] | [((132, 270), 'pymysql.connect', 'pymysql.connect', ([], {'host': '"""localhost"""', 'user': '"""django"""', 'password': '"""<PASSWORD>"""', 'db': '"""SellBuildKRD"""', 'charset': '"""utf8mb4"""', 'cursorclass': 'DictCursor'}), "(host='localhost', user='django', password='<PASSWORD>', db=\n 'SellBuildKRD', charset='... |
from dynaconf import settings
from orwell.bot import bot
if __name__ == '__main__':
bot.run(settings.TOKEN)
| [
"orwell.bot.bot.run"
] | [((89, 112), 'orwell.bot.bot.run', 'bot.run', (['settings.TOKEN'], {}), '(settings.TOKEN)\n', (96, 112), False, 'from orwell.bot import bot\n')] |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright 2021 <NAME> <<EMAIL>>
# Description: Utilities for pretty-printing Kokkos::UnorderedMap
#
# Distributed under terms of the 3-clause BSD license.
import gdb
import argparse
import numpy as np
import pandas as pd
from collections.abc import It... | [
"GDBKokkos.printView.view2NumpyArray",
"GDBKokkos.printView.getKokkosViewValueType",
"argparse.ArgumentParser",
"pandas.option_context",
"gdb.parse_and_eval"
] | [((676, 729), 'GDBKokkos.printView.view2NumpyArray', 'view2NumpyArray', (["m['m_available_indexes']['m_blocks']"], {}), "(m['m_available_indexes']['m_blocks'])\n", (691, 729), False, 'from GDBKokkos.printView import view2NumpyArray, getKokkosViewValueType\n'), ((1449, 1481), 'GDBKokkos.printView.view2NumpyArray', 'view... |
import itertools
import numpy as np
import numpy.testing as npt
import pytest
from quara.objects.composite_system import CompositeSystem
from quara.objects.composite_system_typical import generate_composite_system
from quara.objects.elemental_system import ElementalSystem
from quara.objects.matrix_basis import get_no... | [
"quara.minimization_algorithm.projected_gradient_descent_backtracking.ProjectedGradientDescentBacktracking",
"quara.protocol.qtomography.standard.standard_qmpt.StandardQmpt",
"numpy.array",
"quara.objects.composite_system.CompositeSystem",
"quara.objects.composite_system_typical.generate_composite_system",
... | [((12343, 12406), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""on_para_eq_constraint"""', '[True, False]'], {}), "('on_para_eq_constraint', [True, False])\n", (12366, 12406), False, 'import pytest\n'), ((13872, 13935), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""on_para_eq_constraint"""',... |
#!/usr/bin/env python3
import os
import pathlib
import re
import subprocess
import sys
from typing import List
def main():
os.chdir(str(get_toplevel_dir()))
check_unstaged_changes()
files = get_tracked_files()
check_go_source(files)
make('build')
make('test')
make('test-large')
def che... | [
"pathlib.Path",
"subprocess.run",
"sys.exit",
"re.findall",
"re.search"
] | [((2134, 2237), 'subprocess.run', 'subprocess.run', (["['git', 'ls-tree', '-r', 'HEAD', '--name-only']"], {'check': '(True)', 'stdout': 'subprocess.PIPE'}), "(['git', 'ls-tree', '-r', 'HEAD', '--name-only'], check=True,\n stdout=subprocess.PIPE)\n", (2148, 2237), False, 'import subprocess\n'), ((2437, 2533), 'subpro... |
from leapp.models import Model, fields
from leapp.topics import SystemInfoTopic
class NtpMigrationDecision(Model):
topic = SystemInfoTopic
migrate_services = fields.List(fields.String())
config_tgz64 = fields.String()
| [
"leapp.models.fields.String"
] | [((216, 231), 'leapp.models.fields.String', 'fields.String', ([], {}), '()\n', (229, 231), False, 'from leapp.models import Model, fields\n'), ((180, 195), 'leapp.models.fields.String', 'fields.String', ([], {}), '()\n', (193, 195), False, 'from leapp.models import Model, fields\n')] |
#!/bin/python
import unittest
import roomai.bridge
import roomai
import roomai.common
from functools import cmp_to_key
class BridgeTester(unittest.TestCase):
def testInit(self):
env = roomai.bridge.BridgeEnv()
env.init()
def testForward(self):
env = roomai.bridge.BridgeEnv()
in... | [
"functools.cmp_to_key",
"roomai.bridge.AllBridgePlayingPokerCards.values",
"roomai.bridge.BridgeEnv",
"time.time",
"roomai.bridge.BridgeAction.lookup"
] | [((4821, 4832), 'time.time', 'time.time', ([], {}), '()\n', (4830, 4832), False, 'import time\n'), ((6037, 6048), 'time.time', 'time.time', ([], {}), '()\n', (6046, 6048), False, 'import time\n'), ((197, 222), 'roomai.bridge.BridgeEnv', 'roomai.bridge.BridgeEnv', ([], {}), '()\n', (220, 222), False, 'import roomai\n'),... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
with open('cisco_documentation/VERSION', 'r') as f:
version = f.read()
setuptools.setup(
name="cisco-documentation",
version=version,
author="<NAME>",
author_email="<EMAIL>",
description="Gather information ... | [
"setuptools.find_packages"
] | [((533, 559), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (557, 559), False, 'import setuptools\n')] |
# Generated by Django 2.2.4 on 2019-10-22 17:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('email_verification', '0002_auto_20190415_1718'),
]
operations = [
migrations.CreateModel(
name='SessionState',
field... | [
"django.db.models.TextField",
"django.db.models.AutoField",
"django.db.models.UUIDField"
] | [((347, 440), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (363, 440), False, 'from django.db import migrations, models\... |
import sys
import numpy as np
import dimod
from dwave.system.samplers import DWaveSampler
from dwave.system.composites import EmbeddingComposite
def loadFile(filename):
commands= {}
with open(filename) as fh:
for line in fh:
if line[0] != "#":
command, description = line.st... | [
"numpy.argmin",
"dwave.system.samplers.DWaveSampler",
"numpy.save",
"dimod.BinaryQuadraticModel"
] | [((873, 945), 'dimod.BinaryQuadraticModel', 'dimod.BinaryQuadraticModel', (['linear', 'quadratic', 'const', 'dimod.Vartype.SPIN'], {}), '(linear, quadratic, const, dimod.Vartype.SPIN)\n', (899, 945), False, 'import dimod\n'), ((1538, 1559), 'numpy.argmin', 'np.argmin', (['energy_vec'], {}), '(energy_vec)\n', (1547, 155... |
from json import load, dumps
from .utils import populate_ast
class TokenStream(object):
def __init__(self, input_):
self.input = input_
self.current = None
self.keywords = 'if then else true false'.split()
self.datatypes = ['U0', 'U8', 'U16', 'U32', 'U64',
... | [
"json.dumps"
] | [((835, 863), 'json.dumps', 'dumps', (['self.tokens'], {'indent': '(2)'}), '(self.tokens, indent=2)\n', (840, 863), False, 'from json import load, dumps\n')] |
from collections import deque
d = deque()
N = int(input())
for _ in range(N):
cmd = input().split()
if cmd[0] == 'append':
d.append(cmd[1])
elif cmd[0] == 'appendleft':
d.appendleft(cmd[1])
elif cmd[0] == 'pop':
d.pop()
elif cmd[0] == 'popleft':
d.popleft()
print(' '.... | [
"collections.deque"
] | [((34, 41), 'collections.deque', 'deque', ([], {}), '()\n', (39, 41), False, 'from collections import deque\n')] |
import os
import sys
import re
import fanc
from fanc.architecture.domains import InsulationScores
import logging
logging.basicConfig(level=logging.INFO)
input_file = sys.argv[1]
def write_insulation(hic_file):
logging.info("working on %s", hic_file)
hic = fanc.load(hic_file, mode='r')
prefix = os.path.b... | [
"logging.basicConfig",
"os.path.join",
"fanc.load",
"os.path.basename",
"logging.info"
] | [((113, 152), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (132, 152), False, 'import logging\n'), ((218, 257), 'logging.info', 'logging.info', (['"""working on %s"""', 'hic_file'], {}), "('working on %s', hic_file)\n", (230, 257), False, 'import logging\n'), ... |
# This example demonstrates a simple temperature sensor peripheral
# with Battery Service (Level and Power State)
#
# Connected Mode: The sensor's local value updates every 30 seconds
# When Battery Level is over 90 % or under 10 % it notifies the Central
# with the Battery Power State
#
# Save Energy Mode: To save Bat... | [
"upynotify.NOTIFYER",
"ble_advertising.advertising_payload",
"machine.Timer",
"machine.deepsleep",
"struct.pack",
"micropython.const",
"bluetooth.UUID",
"machine.Pin",
"time.sleep",
"init_ADS.MY_ADS",
"os.uname"
] | [((1075, 1088), 'micropython.const', 'const', (['(1 << 0)'], {}), '(1 << 0)\n', (1080, 1088), False, 'from micropython import const\n'), ((1115, 1128), 'micropython.const', 'const', (['(1 << 1)'], {}), '(1 << 1)\n', (1120, 1128), False, 'from micropython import const\n'), ((1148, 1161), 'micropython.const', 'const', ([... |
import pyautogui
pyautogui.FAILSAFE = True
pyautogui.PAUSE = 1
def currentMousePosition():
try:
mul = 0
while True:
position = str(pyautogui.position())
print('\b'*mul+position, end = '', flush = True)
mul = len(position)
except:
input('\nDone')
pri... | [
"pyautogui.position",
"pyautogui.size"
] | [((323, 339), 'pyautogui.size', 'pyautogui.size', ([], {}), '()\n', (337, 339), False, 'import pyautogui\n'), ((165, 185), 'pyautogui.position', 'pyautogui.position', ([], {}), '()\n', (183, 185), False, 'import pyautogui\n')] |
from multiprocessing import Process, Queue
from urllib.parse import urlparse
import pandas as pd
import sqlalchemy as s
import requests, time, logging, json, os
from datetime import datetime
from workers.worker_base import Worker
class GitHubWorker(Worker):
""" Worker that collects data from the Github API and sto... | [
"urllib.parse.urlparse",
"requests.get"
] | [((2512, 2532), 'urllib.parse.urlparse', 'urlparse', (['github_url'], {}), '(github_url)\n', (2520, 2532), False, 'from urllib.parse import urlparse\n'), ((17223, 17272), 'requests.get', 'requests.get', ([], {'url': 'cntrb_url', 'headers': 'self.headers'}), '(url=cntrb_url, headers=self.headers)\n', (17235, 17272), Fal... |
from daiquiri.core.utils import send_mail, get_admin_emails, get_permission_emails
def get_manager_emails():
return get_permission_emails((
'daiquiri_meetings.view_meeting',
'daiquiri_meetings.view_participant',
'daiquiri_meetings.view_contribution',
)) + get_admin_emails()
def send_... | [
"daiquiri.core.utils.get_admin_emails",
"daiquiri.core.utils.get_permission_emails",
"daiquiri.core.utils.send_mail"
] | [((705, 864), 'daiquiri.core.utils.send_mail', 'send_mail', (['request', '"""meetings/email/registration"""', "{'meeting': meeting, 'participant': participant, 'contribution': contribution}", '[participant.email]'], {}), "(request, 'meetings/email/registration', {'meeting': meeting,\n 'participant': participant, 'co... |
import re
import logging
import traceback
from gs1.utils import AI_BY_LENGTH
from gs1.constants import REGEX_ROUND_BRACKETS, REGEX_BRACKETED
from gs1.constants import AI_REGEX
from gs1.constants import FIXED_LENGTH_TABLE
logger = logging.getLogger('__name__')
def extract_from_element_strings(element_strings: str):
... | [
"logging.getLogger",
"traceback.format_exc",
"gs1.constants.FIXED_LENGTH_TABLE.get",
"gs1.constants.REGEX_BRACKETED.match",
"gs1.constants.AI_REGEX.keys",
"gs1.constants.FIXED_LENGTH_TABLE.keys",
"gs1.constants.REGEX_ROUND_BRACKETS.match",
"re.sub",
"re.findall"
] | [((232, 261), 'logging.getLogger', 'logging.getLogger', (['"""__name__"""'], {}), "('__name__')\n", (249, 261), False, 'import logging\n'), ((773, 822), 're.sub', 're.sub', (['"""^(]C1|]e0|]d2|]Q3)"""', '""""""', 'element_strings'], {}), "('^(]C1|]e0|]d2|]Q3)', '', element_strings)\n", (779, 822), False, 'import re\n')... |
"""
Inter Rising Edge Timer:
This example outlines the use of the single channel inter rising edge time measurement function of the time controller.
Tis example showcases its use by generating a histogram of signal at CH1.
First, the start_iretimer() function must be called which will start the hardware module for it.... | [
"logging.getLogger",
"logging.basicConfig",
"pyqtgraph.Qt.QtGui.QApplication.instance",
"pyqtgraph.Qt.QtCore.QRectF",
"pyqtgraph.plot",
"time.perf_counter",
"time.sleep",
"numpy.zeros",
"pyqtgraph.Qt.QtGui.QApplication",
"numpy.linspace",
"_thread.start_new_thread",
"pyqtgraph.Qt.QtCore.QTimer... | [((915, 942), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (932, 942), False, 'import logging\n'), ((943, 1053), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s [%(levelname)7s] %(module)s -- %(message)s"""'}), "(level=logging.DEBU... |
from abc import ABC
from tensorflow.keras.utils import to_categorical
import tensorflow_addons as tfa
import tensorflow as tf
class EncoderNetwork(tf.keras.Model, ABC):
"""Encoder module."""
def __init__(self, input_vocab_size, embedding_dims, rnn_units):
super().__init__()
self.encoder_embe... | [
"tensorflow.keras.layers.LSTMCell",
"tensorflow_addons.seq2seq.BasicDecoder",
"tensorflow_addons.seq2seq.AttentionWrapper",
"tensorflow_addons.seq2seq.BahdanauAttention",
"tensorflow.keras.layers.Embedding",
"tensorflow.keras.layers.LSTM",
"tensorflow.keras.layers.Dense",
"tensorflow_addons.seq2seq.Lu... | [((328, 413), 'tensorflow.keras.layers.Embedding', 'tf.keras.layers.Embedding', ([], {'input_dim': 'input_vocab_size', 'output_dim': 'embedding_dims'}), '(input_dim=input_vocab_size, output_dim=embedding_dims\n )\n', (353, 413), True, 'import tensorflow as tf\n'), ((441, 514), 'tensorflow.keras.layers.LSTM', 'tf.ker... |
from db.models.tensorboards import TensorboardJob
from libs.base_clean import BaseCleanCommand
from lifecycles.jobs import JobLifeCycle
from scheduler import tensorboard_scheduler
class Command(BaseCleanCommand):
@staticmethod
def _clean() -> None:
for job in TensorboardJob.objects.filter(
... | [
"db.models.tensorboards.TensorboardJob.objects.filter",
"scheduler.tensorboard_scheduler.stop_tensorboard"
] | [((278, 355), 'db.models.tensorboards.TensorboardJob.objects.filter', 'TensorboardJob.objects.filter', ([], {'status__status__in': 'JobLifeCycle.RUNNING_STATUS'}), '(status__status__in=JobLifeCycle.RUNNING_STATUS)\n', (307, 355), False, 'from db.models.tensorboards import TensorboardJob\n'), ((386, 578), 'scheduler.ten... |
"""
AVA's primary commands file
Located here are all of AVA's core commands
"""
def speak(text=None):
"""
The voice of AVA
"""
import pyttsx3
# Initialize the engine
engine = pyttsx3.init(driverName=None, debug=True)
# Get and set female voice, because in this case Ava is a female.
v... | [
"pyttsx3.init",
"requests.get"
] | [((202, 243), 'pyttsx3.init', 'pyttsx3.init', ([], {'driverName': 'None', 'debug': '(True)'}), '(driverName=None, debug=True)\n', (214, 243), False, 'import pyttsx3\n'), ((918, 951), 'requests.get', 'requests.get', (['"""http://google.com"""'], {}), "('http://google.com')\n", (930, 951), False, 'import requests\n')] |
#!/usr/bin/env python3
import os
import struct
from pwn import *
context.arch = "amd64"
def generate_number(num):
code = "iqiq"
code += "ij"
for i in range(64):
if (num >> i) & 1:
code += "+rj"
code += "*jq"
return code
def generate_shellcode(shellcode):
while len(shellcode) % 8 > 0:
shellcode += b"\... | [
"struct.unpack"
] | [((385, 424), 'struct.unpack', 'struct.unpack', (['"""<Q"""', 'shellcode[i:i + 8]'], {}), "('<Q', shellcode[i:i + 8])\n", (398, 424), False, 'import struct\n')] |
import numpy as np
from VariableUnittest import VariableUnitTest
from gwlfe.Input.WaterBudget import GroundWatLE
class TestGroundWatLE(VariableUnitTest):
def test_GroundWatLE_ground_truth(self):
z = self.z
np.testing.assert_array_almost_equal(
np.load(self.basepath + "/GroundWatLE.np... | [
"numpy.load",
"gwlfe.Input.WaterBudget.GroundWatLE.GroundWatLE_f",
"gwlfe.Input.WaterBudget.GroundWatLE.GroundWatLE"
] | [((280, 323), 'numpy.load', 'np.load', (["(self.basepath + '/GroundWatLE.npy')"], {}), "(self.basepath + '/GroundWatLE.npy')\n", (287, 323), True, 'import numpy as np\n'), ((337, 620), 'gwlfe.Input.WaterBudget.GroundWatLE.GroundWatLE', 'GroundWatLE.GroundWatLE', (['z.NYrs', 'z.DaysMonth', 'z.Temp', 'z.InitSnow_0', 'z.P... |
import functools
from spaceone.api.inventory.v1 import ip_address_pb2
from spaceone.core.pygrpc.message_type import *
from spaceone.inventory.model.ip_address_model import IPAddress
from spaceone.inventory.info.subnet_info import SubnetInfo
from spaceone.inventory.info.network_info import NetworkInfo
from spaceone.inv... | [
"spaceone.api.inventory.v1.ip_address_pb2.Resource",
"spaceone.inventory.info.network_info.NetworkInfo",
"spaceone.inventory.info.subnet_info.SubnetInfo",
"functools.partial",
"spaceone.inventory.info.zone_info.ZoneInfo",
"spaceone.api.inventory.v1.ip_address_pb2.IPInfo"
] | [((509, 540), 'spaceone.api.inventory.v1.ip_address_pb2.Resource', 'ip_address_pb2.Resource', ([], {}), '(**info)\n', (532, 540), False, 'from spaceone.api.inventory.v1 import ip_address_pb2\n'), ((1555, 1584), 'spaceone.api.inventory.v1.ip_address_pb2.IPInfo', 'ip_address_pb2.IPInfo', ([], {}), '(**info)\n', (1576, 15... |
import numpy as np
from example import algs
def test_bubblesort():
#Empty vector
x = []
#check
if algs.only_integers(x) == x:
assert np.array_equal(algs.bubblesort(x), sorted(x))
else:
print(algs.only_integers(x))
#One entry
x = [1]
#check
if algs.only_integers(x) == x:
assert np.array_e... | [
"example.algs.quicksort",
"example.algs.only_integers",
"example.algs.bubblesort"
] | [((107, 128), 'example.algs.only_integers', 'algs.only_integers', (['x'], {}), '(x)\n', (125, 128), False, 'from example import algs\n'), ((271, 292), 'example.algs.only_integers', 'algs.only_integers', (['x'], {}), '(x)\n', (289, 292), False, 'from example import algs\n'), ((447, 468), 'example.algs.only_integers', 'a... |
"""
Copyright 2013 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | [
"cafe.drivers.unittest.decorators.tags",
"cloudcafe.common.tools.datagen.rand_name",
"unittest2.skipUnless",
"cloudcafe.images.config.ImagesConfig"
] | [((812, 826), 'cloudcafe.images.config.ImagesConfig', 'ImagesConfig', ([], {}), '()\n', (824, 826), False, 'from cloudcafe.images.config import ImagesConfig\n'), ((882, 953), 'unittest2.skipUnless', 'unittest.skipUnless', (['allow_post_images', '"""Endpoint has incorrect access"""'], {}), "(allow_post_images, 'Endpoint... |
from pyoram import log
from pyoram.core import config
from pyoram.core.map import FileMap, PositionMap
from pyoram.core.stash import Stash
from pyoram.exceptions import FileSizeError
logger = log.get_logger(__name__)
PADDING = b'0'
class ChunkFile:
def __init__(self, aes_crypto=None):
self.aes_crypto = ... | [
"pyoram.core.map.PositionMap",
"pyoram.log.get_logger",
"pyoram.core.stash.Stash",
"pyoram.core.map.FileMap",
"pyoram.exceptions.FileSizeError"
] | [((193, 217), 'pyoram.log.get_logger', 'log.get_logger', (['__name__'], {}), '(__name__)\n', (207, 217), False, 'from pyoram import log\n'), ((2156, 2221), 'pyoram.exceptions.FileSizeError', 'FileSizeError', (['"""File size of the downloaded file is not correct."""'], {}), "('File size of the downloaded file is not cor... |
from sklearn.neighbors import KNeighborsClassifier
from PIL import Image
import numpy as np
import json
import time
import sys
import argparse
import os
from datetime import datetime
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
def get_output_file_name(path):
head, tail = os.pat... | [
"os.path.exists",
"PIL.Image.fromarray",
"PIL.Image.open",
"argparse.ArgumentParser",
"os.makedirs",
"PIL.Image.new",
"sklearn.neighbors.KNeighborsClassifier",
"numpy.asarray",
"os.path.split",
"json.load",
"numpy.array",
"datetime.datetime.now",
"os.path.basename",
"warnings.simplefilter"... | [((200, 262), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (221, 262), False, 'import warnings\n'), ((314, 333), 'os.path.split', 'os.path.split', (['path'], {}), '(path)\n', (327, 333), False, 'import os\... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import struct
import numpy as np
import subprocess
import matplotlib.pyplot as plt
from collections import namedtuple
# N - number of oscillators
# freq - oscillator frequency (N elements)
# phase - oscillator phases (N elements)
# k - coupling coeffici... | [
"os.path.exists",
"numpy.fromfile",
"collections.namedtuple",
"matplotlib.pyplot.savefig",
"os.makedirs",
"os.path.join",
"struct.pack",
"os.path.split",
"matplotlib.pyplot.close",
"subprocess.call",
"os.remove"
] | [((351, 404), 'collections.namedtuple', 'namedtuple', (['"""DataPreset"""', "['N', 'k', 'freq', 'phase']"], {}), "('DataPreset', ['N', 'k', 'freq', 'phase'])\n", (361, 404), False, 'from collections import namedtuple\n'), ((5386, 5419), 'os.path.join', 'os.path.join', (['directory', 'filename'], {}), '(directory, filen... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 10 17:19:24 2021
@author: tungdang
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 10 14:16:33 2021
@author: tungbioinfo
"""
import warnings
from abc import ABCMeta, abstractmethod
from time import time
import math
fro... | [
"scipy.special.digamma",
"scipy.special.gammaln",
"numpy.ones",
"math.factorial",
"numpy.log",
"numpy.exp",
"numpy.sum",
"numpy.dot",
"numpy.errstate",
"numpy.empty",
"numpy.finfo",
"pandas.DataFrame",
"numpy.cumsum",
"scipy.special.logsumexp",
"numpy.nan_to_num"
] | [((924, 959), 'numpy.ones', 'np.ones', (['(n_components, n_features)'], {}), '((n_components, n_features))\n', (931, 959), True, 'import numpy as np\n'), ((972, 1007), 'numpy.ones', 'np.ones', (['(n_components, n_features)'], {}), '((n_components, n_features))\n', (979, 1007), True, 'import numpy as np\n'), ((1128, 116... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"numpy.prod",
"torch.nn.Unfold",
"numpy.random.RandomState",
"torch.nn.Fold",
"torch.flatten"
] | [((754, 786), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': 'seed'}), '(seed=seed)\n', (775, 786), True, 'import numpy as np\n'), ((803, 821), 'numpy.prod', 'np.prod', (['image_chw'], {}), '(image_chw)\n', (810, 821), True, 'import numpy as np\n'), ((1441, 1473), 'numpy.random.RandomState', 'np.ran... |
#!/bin/python
import csv
import json
def get_bool(entry):
if entry == "y":
return True;
if entry == "n":
return False;
raise Exception("Unexpected boolean: " + entry);
def is_present(entry):
return entry and not entry == "na"
def get_images(pictures, credits):
images = [];
fo... | [
"json.dumps",
"csv.reader"
] | [((1231, 1254), 'csv.reader', 'csv.reader', (['groups_file'], {}), '(groups_file)\n', (1241, 1254), False, 'import csv\n'), ((2270, 2294), 'csv.reader', 'csv.reader', (['species_file'], {}), '(species_file)\n', (2280, 2294), False, 'import csv\n'), ((4148, 4297), 'json.dumps', 'json.dumps', (["{'species_data': species_... |