code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import AgentControl
import Config
import Memory
import numpy as np
import itertools
class Agent:
# Role of Agent class is to coordinate between AgentControll where we do all calculations
# and Memory where we store all of the data
def __init__(self, state_size, action_size, batch_size):
s... | [
"numpy.mean",
"AgentControl.AgentControl",
"Memory.Memory",
"numpy.max",
"numpy.round"
] | [((340, 413), 'AgentControl.AgentControl', 'AgentControl.AgentControl', ([], {'state_size': 'state_size', 'action_size': 'action_size'}), '(state_size=state_size, action_size=action_size)\n', (365, 413), False, 'import AgentControl\n'), ((437, 487), 'Memory.Memory', 'Memory.Memory', (['state_size', 'action_size', 'batc... |
# -*- coding: utf-8 -*-
import json
import re
import time
from ..base.account import BaseAccount
class EuroshareEu(BaseAccount):
__name__ = "EuroshareEu"
__type__ = "account"
__version__ = "0.12"
__status__ = "testing"
__pyload_version__ = "0.5"
__description__ = """Euroshare.eu account pl... | [
"re.search"
] | [((596, 722), 're.search', 're.search', (['"""<span class="btn btn--nav green darken-3">Premium account until: (\\\\d+/\\\\d+/\\\\d+ \\\\d+:\\\\d+:\\\\d+)<"""', 'html'], {}), '(\n \'<span class="btn btn--nav green darken-3">Premium account until: (\\\\d+/\\\\d+/\\\\d+ \\\\d+:\\\\d+:\\\\d+)<\'\n , html)\n', (605, ... |
# -*- coding: utf-8 -*-
import factory
from TWLight.resources.factories import PartnerFactory
from TWLight.users.factories import EditorFactory
from TWLight.applications.models import Application
class ApplicationFactory(factory.django.DjangoModelFactory):
class Meta:
model = Application
strat... | [
"factory.SubFactory"
] | [((364, 397), 'factory.SubFactory', 'factory.SubFactory', (['EditorFactory'], {}), '(EditorFactory)\n', (382, 397), False, 'import factory\n'), ((412, 446), 'factory.SubFactory', 'factory.SubFactory', (['PartnerFactory'], {}), '(PartnerFactory)\n', (430, 446), False, 'import factory\n')] |
"""
<NAME>
Pygame Menu System
Last Edit: 1 January 2021
"""
# Imports
import pygame
import string
# Initialize pygame
pygame.init()
# Settings
menu_manager_settings = {
"element_colorkey" : [0, 0, 0],
"menu_background_color" : [0, 0, 0],
"menu_fps" : 60
}
class Action:
"""
Holds function and a... | [
"pygame.init",
"pygame.event.get",
"pygame.display.flip",
"pygame.mouse.get_pos",
"pygame.image.load"
] | [((120, 133), 'pygame.init', 'pygame.init', ([], {}), '()\n', (131, 133), False, 'import pygame\n'), ((1927, 1951), 'pygame.image.load', 'pygame.image.load', (['image'], {}), '(image)\n', (1944, 1951), False, 'import pygame\n'), ((8186, 8210), 'pygame.image.load', 'pygame.image.load', (['image'], {}), '(image)\n', (820... |
# -*- coding: utf-8 -*-
import numpy as np
import speechpy
from scipy.io import wavfile
from python_speech_features import mfcc
class PythonMFCCFeatureExtraction():
def __init__(self):
pass
def audio2features(self, input_path):
(rate, sig) = wavfile.read(input_path)
mfcc_feat = mfcc(... | [
"python_speech_features.mfcc",
"speechpy.processing.cmvnw",
"scipy.io.wavfile.read",
"numpy.append"
] | [((270, 294), 'scipy.io.wavfile.read', 'wavfile.read', (['input_path'], {}), '(input_path)\n', (282, 294), False, 'from scipy.io import wavfile\n'), ((315, 393), 'python_speech_features.mfcc', 'mfcc', (['sig'], {'dither': '(0)', 'highfreq': '(7700)', 'useEnergy': '(True)', 'wintype': '"""povey"""', 'numcep': '(23)'}), ... |
from enum import Enum
import logging
from blatann.nrf.nrf_dll_load import driver
import blatann.nrf.nrf_driver_types as util
from blatann.nrf.nrf_types.enums import *
logger = logging.getLogger(__name__)
class BLEGapSecMode(object):
def __init__(self, sec_mode, level):
self.sm = sec_mode
... | [
"logging.getLogger",
"blatann.nrf.nrf_dll_load.driver.ble_gap_conn_sec_mode_t",
"blatann.nrf.nrf_dll_load.driver.ble_gap_sec_keys_t",
"blatann.nrf.nrf_dll_load.driver.ble_gap_master_id_t",
"blatann.nrf.nrf_dll_load.driver.ble_gap_addr_t",
"blatann.nrf.nrf_dll_load.driver.ble_gap_sec_keyset_t",
"blatann.... | [((185, 212), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (202, 212), False, 'import logging\n'), ((386, 418), 'blatann.nrf.nrf_dll_load.driver.ble_gap_conn_sec_mode_t', 'driver.ble_gap_conn_sec_mode_t', ([], {}), '()\n', (416, 418), False, 'from blatann.nrf.nrf_dll_load import driver\... |
from direct.showbase.ShowBase import ShowBase
from panda3d.core import CardMaker, NodePath, loadPrcFileData
from panda3d.core import *
import sys
configVars = """
win-size 1920 1080
show-frame-rate-meter 0
"""
loadPrcFileData("", configVars)
class mymenu(ShowBase):
def __init__(self):
Sho... | [
"panda3d.core.loadPrcFileData",
"direct.showbase.ShowBase.ShowBase.__init__"
] | [((224, 255), 'panda3d.core.loadPrcFileData', 'loadPrcFileData', (['""""""', 'configVars'], {}), "('', configVars)\n", (239, 255), False, 'from panda3d.core import CardMaker, NodePath, loadPrcFileData\n'), ((317, 340), 'direct.showbase.ShowBase.ShowBase.__init__', 'ShowBase.__init__', (['self'], {}), '(self)\n', (334, ... |
import django
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
django.setup()
from django.contrib.auth import get_user_model
from importer.utils import import_ratings_from_csv
from titles.models import Title
from tmdb.api import TmdbWrapper, TitleDetailsGetter
User = get_user_model()
d... | [
"os.environ.setdefault",
"django.contrib.auth.get_user_model",
"django.setup",
"titles.models.Title.objects.get",
"importer.utils.import_ratings_from_csv",
"tmdb.api.TitleDetailsGetter"
] | [((26, 92), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""mysite.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'mysite.settings')\n", (47, 92), False, 'import os\n'), ((93, 107), 'django.setup', 'django.setup', ([], {}), '()\n', (105, 107), False, 'import django\n'), ((300, 3... |
# -*- coding: utf-8 -*-
import pygame
import random
import tinytag
import groups
from constants import *
"""
Pitää sisällään seuraavaa:
class MusicPlayer(pygame.sprite.Sprite): taustamusiikin soittajaclass, osaa näyttää infoblurbin biisistä
class MusicFile(object): lukee tiedoston tagit ja tallettaa tiedon siitä, mi... | [
"pygame.init",
"pygame.quit",
"pygame.mixer.music.set_volume",
"pygame.font.Font",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.draw.rect",
"pygame.mixer.music.load",
"random.shuffle",
"pygame.Surface",
"pygame.time.Clock",
"pygame.mixer.music.play",
"groups.TextGroup.update",
... | [((8446, 8481), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(800, 600)'], {}), '((800, 600))\n', (8469, 8481), False, 'import pygame\n'), ((8486, 8526), 'pygame.display.set_caption', 'pygame.display.set_caption', (['"""Music test"""'], {}), "('Music test')\n", (8512, 8526), False, 'import pygame\n'), ((853... |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | [
"tensorflow.python.util.deprecation.deprecated",
"tensorflow.python.util.tf_export.tf_export"
] | [((945, 1013), 'tensorflow.python.util.deprecation.deprecated', 'deprecation.deprecated', (['None', '"""Use `tf.data.Dataset.take_while(...)"""'], {}), "(None, 'Use `tf.data.Dataset.take_while(...)')\n", (967, 1013), False, 'from tensorflow.python.util import deprecation\n'), ((1015, 1056), 'tensorflow.python.util.tf_e... |
from datetime import timezone
from airflow.models import DagRun, TaskInstance
from airflow.utils.types import DagRunType
NORMALISE_NOTICE_METADATA_TASK_ID = "normalise_notice_metadata"
CHECK_ELIGIBILITY_FOR_TRANSFORMATION_TASK_ID = "check_eligibility_for_transformation"
PREPROCESS_XML_MANIFESTATION_TASK_ID = "preproc... | [
"airflow.models.DagRun.generate_run_id",
"airflow.models.TaskInstance",
"datetime.timezone.utcnow"
] | [((3430, 3461), 'airflow.models.TaskInstance', 'TaskInstance', (['task'], {'run_id': 'None'}), '(task, run_id=None)\n', (3442, 3461), False, 'from airflow.models import DagRun, TaskInstance\n'), ((2952, 2969), 'datetime.timezone.utcnow', 'timezone.utcnow', ([], {}), '()\n', (2967, 2969), False, 'from datetime import ti... |
import os
import re
import math
import subprocess
import argparse
from wand.image import Image
class Tiler:
'''Scale a tile map up and down in powers of 2.'''
def __init__(self, filename='{x},{z}.png', path='.', zoomOut=4, zoomIn=1, verbose=False):
self.path = path
if not os.path.isdir(self.pat... | [
"os.listdir",
"argparse.ArgumentParser",
"math.floor",
"wand.image.Image",
"os.path.isfile",
"os.path.isdir",
"subprocess.call",
"os.mkdir",
"os.path.getmtime"
] | [((3545, 3643), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""tiler"""', 'description': '"""Scale the image tiles up and down.\n """'}), "(prog='tiler', description=\n 'Scale the image tiles up and down.\\n ')\n", (3568, 3643), False, 'import argparse\n'), ((1037, 1053), 'os.listdir',... |
from collections import namedtuple
from turtle import fd, heading, lt, pd, position, pu, rt, setheading, setposition # pylint: disable=no-name-in-module
from pudzu.utils import weighted_choice
class LSystem:
Rule = namedtuple("Rule", "predecessor successor weight", defaults=(1.0,))
def __init__(self, axio... | [
"turtle.position",
"turtle.setheading",
"collections.namedtuple",
"turtle.heading",
"turtle.lt",
"turtle.pu",
"turtle.rt",
"turtle.fd",
"turtle.setposition",
"turtle.pd"
] | [((224, 291), 'collections.namedtuple', 'namedtuple', (['"""Rule"""', '"""predecessor successor weight"""'], {'defaults': '(1.0,)'}), "('Rule', 'predecessor successor weight', defaults=(1.0,))\n", (234, 291), False, 'from collections import namedtuple\n'), ((1149, 1157), 'turtle.fd', 'fd', (['size'], {}), '(size)\n', (... |
# Copyright (c) 2014, <NAME>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following dis... | [
"rospy.ServiceProxy",
"nao_dcm_msgs.srv.BoolServiceRequest",
"rospy.Subscriber",
"roslib.load_manifest"
] | [((1535, 1580), 'roslib.load_manifest', 'roslib.load_manifest', (['"""nao_dcm_rqt_dashboard"""'], {}), "('nao_dcm_rqt_dashboard')\n", (1555, 1580), False, 'import roslib\n'), ((2196, 2260), 'rospy.Subscriber', 'rospy.Subscriber', (['"""/nao_dcm/stiffnesses"""', 'Float32', 'self.callback'], {}), "('/nao_dcm/stiffnesses'... |
import torch
from torch import nn
import torch.nn.functional as nf
from torch.nn import init
from torch.autograd import Variable
import numpy as np
from chainer.links.loss.hierarchical_softmax import TreeParser
#class HSM(nn.Module):
# def __init__(self, input_size, vocab_size):
class HSBad(nn.Module):
def __ini... | [
"chainer.links.loss.hierarchical_softmax.TreeParser",
"torch.Tensor",
"torch.from_numpy",
"torch.cat",
"torch.nn.functional.cross_entropy",
"torch.nn.Linear",
"numpy.cumsum",
"torch.autograd.Variable",
"torch.nn.init.kaiming_normal",
"torch.nn.Embedding"
] | [((463, 528), 'torch.nn.Linear', 'nn.Linear', ([], {'in_features': 'self.input_size', 'out_features': 'self.n_vocab'}), '(in_features=self.input_size, out_features=self.n_vocab)\n', (472, 528), False, 'from torch import nn\n'), ((648, 670), 'torch.nn.functional.cross_entropy', 'nf.cross_entropy', (['v', 't'], {}), '(v,... |
# coding: utf-8
"""yieldについてのサンプルです。
元ネタは、stackoverflowの以下のページ。
https://stackoverflow.com/questions/231767/what-does-the-yield-keyword-do-in-python/231855#231855
回答がとてもわかり易いので、自分用のメモとしても残しておく。
"""
import time
from datetime import datetime
from trypython.common.commoncls import SampleBase
from trypython.common.common... | [
"datetime.datetime.now",
"time.sleep",
"trypython.common.commonfunc.pr"
] | [((2931, 2960), 'trypython.common.commonfunc.pr', 'pr', (['"""generator-object"""', 'gen01'], {}), "('generator-object', gen01)\n", (2933, 2960), False, 'from trypython.common.commonfunc import pr\n'), ((3766, 3795), 'trypython.common.commonfunc.pr', 'pr', (['"""generator-object"""', 'gen02'], {}), "('generator-object'... |
# -*- coding: utf-8 -*-
# 版权所有 2019 深圳米筐科技有限公司(下称“米筐科技”)
#
# 除非遵守当前许可,否则不得使用本软件。
#
# * 非商业用途(非商业用途指个人出于非商业目的使用本软件,或者高校、研究所等非营利机构出于教育、科研等目的使用本软件):
# 遵守 Apache License 2.0(下称“Apache 2.0 许可”),您可以在以下位置获得 Apache 2.0 许可的副本:http://www.apache.org/licenses/LICENSE-2.0。
# 除非法律有要求或以书面形式达成协议,否则本软件分发时需保持当前许可“原样”... | [
"rqalpha.environment.Environment.get_instance"
] | [((1358, 1384), 'rqalpha.environment.Environment.get_instance', 'Environment.get_instance', ([], {}), '()\n', (1382, 1384), False, 'from rqalpha.environment import Environment\n')] |
# plot daily box-whisker graphs of GHI data
# Use standard config_handler with .yaml config to parse arguments
from config_handler import handle_config
from datetime import datetime,timezone,date
import pandas as pd
import matplotlib.pyplot as plt
import pysolar.solar as ps
import sys
import time
# note: pathlibs Path ... | [
"config_handler.handle_config",
"pandas.read_csv",
"pathlib.Path"
] | [((442, 518), 'config_handler.handle_config', 'handle_config', ([], {'metadata': "{'invoking_script': 'GHIplot'}", 'header': '"""diagnostics"""'}), "(metadata={'invoking_script': 'GHIplot'}, header='diagnostics')\n", (455, 518), False, 'from config_handler import handle_config\n'), ((625, 652), 'pathlib.Path', 'Path', ... |
#Desafio 015: escreva um programa que pergunte a quantidade de km percorridos por um carro alugado e a quantidade de dias pelos quais ele foi alugado. Calcule o preço a pagar, sabendo que o carro custa R$60 por dia e R$0.15 por km rodado.
from math import ceil
n1 = float(input('Quantos dias você ficou com o carro? '))... | [
"math.ceil"
] | [((365, 373), 'math.ceil', 'ceil', (['n1'], {}), '(n1)\n', (369, 373), False, 'from math import ceil\n')] |
from starling_sim.basemodel.output.kpis import KPI
import logging
import pandas as pd
class KpiOutput:
def __init__(self, population_names, kpi_list, kpi_name=None):
# name of the kpi, will compose the kpi filename : <kpi_name>.csv
if kpi_name is None:
if isinstance(population_names... | [
"pandas.DataFrame",
"logging.info",
"pandas.concat"
] | [((2893, 2907), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2905, 2907), True, 'import pandas as pd\n'), ((3257, 3310), 'logging.info', 'logging.info', (["('Generating KPI output in file ' + path)"], {}), "('Generating KPI output in file ' + path)\n", (3269, 3310), False, 'import logging\n'), ((3885, 3899), ... |
import torch
from torch import nn as nn
from torch.nn import functional as F
from torch.autograd import Variable
from model.tensorized_layers.graphsage import BatchedGraphSAGE
class DiffPoolAssignment(nn.Module):
def __init__(self, nfeat, nnext):
super().__init__()
self.assign_mat = BatchedGraph... | [
"model.tensorized_layers.graphsage.BatchedGraphSAGE",
"torch.nn.functional.softmax"
] | [((308, 351), 'model.tensorized_layers.graphsage.BatchedGraphSAGE', 'BatchedGraphSAGE', (['nfeat', 'nnext'], {'use_bn': '(True)'}), '(nfeat, nnext, use_bn=True)\n', (324, 351), False, 'from model.tensorized_layers.graphsage import BatchedGraphSAGE\n'), ((452, 479), 'torch.nn.functional.softmax', 'F.softmax', (['s_l_ini... |
import os
import pyblish.api
from openpype.lib import OpenPypeMongoConnection
class IntegrateContextToLog(pyblish.api.ContextPlugin):
""" Adds context information to log document for displaying in front end"""
label = "Integrate Context to Log"
order = pyblish.api.IntegratorOrder - 0.1
hosts = ["web... | [
"openpype.lib.OpenPypeMongoConnection.get_mongo_client"
] | [((439, 481), 'openpype.lib.OpenPypeMongoConnection.get_mongo_client', 'OpenPypeMongoConnection.get_mongo_client', ([], {}), '()\n', (479, 481), False, 'from openpype.lib import OpenPypeMongoConnection\n')] |
from heapq import heappush, heappop
class PriorityQueue:
def __init__(self):
self.item_heap = [] # [ [priority, item] ]
self.dummy = '<dummy entry>'
self.item_dict = {} # { item: [priority, item] }
def __bool__(self):
return bool(self.item_dict)
def add(self, item, prio... | [
"heapq.heappush",
"heapq.heappop"
] | [((457, 490), 'heapq.heappush', 'heappush', (['self.item_heap', 'wrapper'], {}), '(self.item_heap, wrapper)\n', (465, 490), False, 'from heapq import heappush, heappop\n'), ((794, 817), 'heapq.heappop', 'heappop', (['self.item_heap'], {}), '(self.item_heap)\n', (801, 817), False, 'from heapq import heappush, heappop\n'... |
from django.db import models
from django.utils import timezone
# Create your models here.
class Creator(models.Model):
fullname = models.CharField(max_length=30)
profile_picture_url = models.URLField()
def __str__(self):
return self.fullname
class Customer(models.Model):
pass
class File(m... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.DateTimeField",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((136, 167), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (152, 167), False, 'from django.db import models\n'), ((194, 211), 'django.db.models.URLField', 'models.URLField', ([], {}), '()\n', (209, 211), False, 'from django.db import models\n'), ((349, 366), 'djan... |
# -*- coding: utf-8 -*-
"""Classifying Images with Pre-trained ImageNet CNNs.
Let’s learn how to classify images with pre-trained Convolutional Neural Networks
using the Keras library.
Example:
$ python imagenet_pretrained.py --image example_images/example_01.jpg --model vgg16
$ python imagenet_pretrained.py ... | [
"keras.preprocessing.image.img_to_array",
"cv2.imread",
"argparse.ArgumentParser",
"cv2.imshow",
"cv2.waitKey",
"numpy.expand_dims",
"keras.applications.imagenet_utils.decode_predictions",
"keras.preprocessing.image.load_img"
] | [((1752, 1777), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1775, 1777), False, 'import argparse\n'), ((3554, 3602), 'keras.preprocessing.image.load_img', 'load_img', (["args['image']"], {'target_size': 'input_shape'}), "(args['image'], target_size=input_shape)\n", (3562, 3602), False, 'fro... |
import numpy as np
from matplotlib import pyplot as plt
N = 30
y = np.random.rand(N)
plt.plot(y,'bo') | [
"matplotlib.pyplot.plot",
"numpy.random.rand"
] | [((68, 85), 'numpy.random.rand', 'np.random.rand', (['N'], {}), '(N)\n', (82, 85), True, 'import numpy as np\n'), ((87, 104), 'matplotlib.pyplot.plot', 'plt.plot', (['y', '"""bo"""'], {}), "(y, 'bo')\n", (95, 104), True, 'from matplotlib import pyplot as plt\n')] |
import functools
import types
def define_module_exporter():
all_list = []
def export(obj):
all_list.append(obj.__name__)
return obj
return export, all_list
def copy_func(fn):
if type(fn) is not types.FunctionType:
return functools.wraps(fn)(lambda *args, **kwargs: fn(*args, *... | [
"functools.wraps",
"functools.update_wrapper"
] | [((513, 547), 'functools.update_wrapper', 'functools.update_wrapper', (['copy', 'fn'], {}), '(copy, fn)\n', (537, 547), False, 'import functools\n'), ((265, 284), 'functools.wraps', 'functools.wraps', (['fn'], {}), '(fn)\n', (280, 284), False, 'import functools\n'), ((690, 715), 'functools.wraps', 'functools.wraps', ([... |
""":mod:`autotweet.twitter` --- Twitter utilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains Twitter API key and some useful methods.
"""
from __future__ import unicode_literals
import cgi
import re
import tweepy
import webbrowser
try:
from HTMLParser import HTMLParser
except ImportErr... | [
"re.compile",
"cgi.parse_qs",
"webbrowser.open",
"tweepy.API",
"html.parser.HTMLParser",
"urllib.parse.urlencode",
"urllib.request.urlopen",
"tweepy.OAuthHandler"
] | [((785, 815), 're.compile', 're.compile', (['"""https?://[^\\\\s]+"""'], {}), "('https?://[^\\\\s]+')\n", (795, 815), False, 'import re\n'), ((834, 853), 're.compile', 're.compile', (['"""@\\\\w+"""'], {}), "('@\\\\w+')\n", (844, 853), False, 'import re\n'), ((868, 880), 'html.parser.HTMLParser', 'HTMLParser', ([], {})... |
import json
import discord
import os
from discord.ext import commands
import discord_components
import ErrorHandling
import Reactions
import Help
with open('Bot_Secrets.json', 'r') as botSecrets:
settings = json.load(botSecrets)
TOKEN = settings['BotToken']
intents = discord.Intents.default()
intents.members ... | [
"discord.Game",
"discord.ext.commands.Bot",
"Help.setup",
"ErrorHandling.setup",
"discord_components.DiscordComponents",
"json.load",
"Reactions.setup",
"discord.Intents.default"
] | [((278, 303), 'discord.Intents.default', 'discord.Intents.default', ([], {}), '()\n', (301, 303), False, 'import discord\n'), ((358, 418), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'intents': 'intents', 'command_prefix': 'command_prefix'}), '(intents=intents, command_prefix=command_prefix)\n', (370, 418), False... |
'''
Etapas do logger
'''
import logging
# Instancia do objeto getLogger()
logger = logging.getLogger()
# Definindo o level do logger
logger.setLevel(logging.DEBUG)
# formatador do log
formatter = logging.Formatter(
'Data/Hora: %(asctime)s | level: %(levelname)s | file: %(filename)s | mensagem: %(message)s',
... | [
"logging.getLogger",
"logging.Formatter",
"logging.StreamHandler"
] | [((90, 109), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (107, 109), False, 'import logging\n'), ((203, 356), 'logging.Formatter', 'logging.Formatter', (['"""Data/Hora: %(asctime)s | level: %(levelname)s | file: %(filename)s | mensagem: %(message)s"""'], {'datefmt': '"""%d/%m/%Y %H:%M:%S %p"""'}), "(\n ... |
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
m = int(readline())
n = int(readline())
a = [list(map(int, readline().split())) for _ in range(n)]
ans = 0
def dfs(y, x, cnt):
a[y][x] = 0
v = cnt + 1
for dy,... | [
"sys.setrecursionlimit"
] | [((116, 146), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10 ** 7)'], {}), '(10 ** 7)\n', (137, 146), False, 'import sys\n')] |
# Copyright 2017 SrMouraSilva
#
# 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,... | [
"pluginsmanager.model.bank.Bank",
"pluginsmanager.observer.autosaver.index_file.IndexFile"
] | [((794, 821), 'pluginsmanager.observer.autosaver.index_file.IndexFile', 'IndexFile', ([], {'path': '"""/dev/null"""'}), "(path='/dev/null')\n", (803, 821), False, 'from pluginsmanager.observer.autosaver.index_file import IndexFile\n'), ((918, 937), 'pluginsmanager.model.bank.Bank', 'Bank', ([], {'name': '"""Bank 1"""'}... |
from pprint import pprint
import httplib2
from file_path_collect import output_cache_path_dir as cache
httplib2.debuglevel = 1
h = httplib2.Http(cache)
# 网址换成简书
jianshu = 'https://www.jianshu.com/'
# 首先 cache 一遍
response0, content0 = h.request(jianshu)
print()
response, content = h.request(jianshu)
print()
print(... | [
"httplib2.Http"
] | [((134, 154), 'httplib2.Http', 'httplib2.Http', (['cache'], {}), '(cache)\n', (147, 154), False, 'import httplib2\n')] |
import tensorflow as tf
from robust_offline_contextual_bandits.named_results import NamedResults
import numpy as np
class NamedResultsTest(tf.test.TestCase):
def setUp(self):
np.random.seed(42)
def test_creation(self):
patient = NamedResults(np.random.normal(size=[10, 3]))
assert pati... | [
"numpy.random.normal",
"numpy.random.seed",
"tensorflow.test.main"
] | [((663, 677), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (675, 677), True, 'import tensorflow as tf\n'), ((189, 207), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (203, 207), True, 'import numpy as np\n'), ((269, 299), 'numpy.random.normal', 'np.random.normal', ([], {'size': '[10, 3]'... |
"""
Multiple Servers linked via broadcaster example.
To run this example.
- 0. Setup a broadcast medium and pass its configuration to the endpoint (e.g. postgres on 'postgres://localhost:5432/' )
- 1. run this script for the servers (as many instances as you'd like) - use the PORT env-variable to run them on differ... | [
"fastapi.routing.APIRouter",
"fastapi.FastAPI",
"uvicorn.run",
"os.environ.get",
"fastapi_websocket_pubsub.PubSubEndpoint",
"os.path.basename",
"asyncio.sleep"
] | [((972, 981), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (979, 981), False, 'from fastapi import FastAPI\n'), ((991, 1002), 'fastapi.routing.APIRouter', 'APIRouter', ([], {}), '()\n', (1000, 1002), False, 'from fastapi.routing import APIRouter\n'), ((1014, 1070), 'fastapi_websocket_pubsub.PubSubEndpoint', 'PubSubE... |
"""
Testing all methods from oap.utils.sizing
"""
import unittest
import oap
from tests.data import array01_original as array
class TestUtilsSizing(unittest.TestCase):
def test_xy_diameter(self):
x, y = oap.xy_diameter(array)
self.assertEqual(x, 43)
self.assertEqual(y, 45)
def test... | [
"oap.xy_diameter",
"oap.sphere_surface",
"oap.sphere_volume",
"oap.x_diameter",
"oap.y_diameter",
"oap.hexprism_volume",
"oap.max_diameter",
"oap.hexprism_surface",
"oap.min_diameter"
] | [((220, 242), 'oap.xy_diameter', 'oap.xy_diameter', (['array'], {}), '(array)\n', (235, 242), False, 'import oap\n'), ((364, 385), 'oap.x_diameter', 'oap.x_diameter', (['array'], {}), '(array)\n', (378, 385), False, 'import oap\n'), ((448, 469), 'oap.y_diameter', 'oap.y_diameter', (['array'], {}), '(array)\n', (462, 46... |
from typing import Iterable
from copy import deepcopy
from advent_of_code.runner import PuzzleTemplate
from dataclasses import dataclass, field
@dataclass
class Board:
# board juts for visualization purpose
board: list[list[int]] = field(default_factory=lambda: [[None] * 5 for _ in range(5)])
# number can... | [
"dataclasses.field",
"copy.deepcopy"
] | [((434, 461), 'dataclasses.field', 'field', ([], {'default_factory': 'dict'}), '(default_factory=dict)\n', (439, 461), False, 'from dataclasses import dataclass, field\n'), ((539, 565), 'dataclasses.field', 'field', ([], {'default_factory': 'set'}), '(default_factory=set)\n', (544, 565), False, 'from dataclasses import... |
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from clovars.scientific import Gaussian, get_curve
if TYPE_CHECKING:
from clovars.scientific import Curve
class Treatment:
"""Class representing a Treatment that influences Cells."""
def __init__(
self,
na... | [
"clovars.scientific.get_curve",
"clovars.scientific.Gaussian"
] | [((732, 742), 'clovars.scientific.Gaussian', 'Gaussian', ([], {}), '()\n', (740, 742), False, 'from clovars.scientific import Gaussian, get_curve\n'), ((846, 856), 'clovars.scientific.Gaussian', 'Gaussian', ([], {}), '()\n', (854, 856), False, 'from clovars.scientific import Gaussian, get_curve\n'), ((2373, 2400), 'clo... |
import unittest
import requests
import json
class TestServer(unittest.TestCase):
@classmethod
def setUpClass(self):
self.port = 80
self.URL_BASE = 'http://localhost:{}'.format( self.port )
self.URL_USERS = self.URL_BASE + '/rest/users'
self.URL_USERS_ALL = self.URL_USE... | [
"requests.post",
"requests.get",
"requests.delete",
"requests.put",
"unittest.main"
] | [((3614, 3629), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3627, 3629), False, 'import unittest\n'), ((341, 376), 'requests.delete', 'requests.delete', (['self.URL_USERS_ALL'], {}), '(self.URL_USERS_ALL)\n', (356, 376), False, 'import requests\n'), ((435, 470), 'requests.delete', 'requests.delete', (['self.UR... |
__author__ = "<NAME>"
__version__ = "1.0.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
"""
Description: This is batch job for uploading result file to S3.
"""
import os
import argparse
from libraries.botoClass import botoHandler
## argparse setting
parser = argparse.ArgumentParser(prog='step3_upload_to_s3.py')
... | [
"libraries.botoClass.botoHandler",
"argparse.ArgumentParser"
] | [((265, 318), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""step3_upload_to_s3.py"""'}), "(prog='step3_upload_to_s3.py')\n", (288, 318), False, 'import argparse\n'), ((700, 729), 'libraries.botoClass.botoHandler', 'botoHandler', (['uploadDataBucket'], {}), '(uploadDataBucket)\n', (711, 729), F... |
#-------------------------------------------------------------------------------
# Add Two Numbers
#-------------------------------------------------------------------------------
# By <NAME>
# https://leetcode.com/problems/add-two-numbers/
# Completed 12/3/20
#-------------------------------------------------------... | [
"unittest.main"
] | [((1908, 1923), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1921, 1923), False, 'import unittest\n')] |
import matplotlib.pyplot as plt
import numpy as np
def plot_convolution(f, g):
fig, (ax1, ax2, ax3) = plt.subplots(3, 1)
ax1.set_yticklabels([])
ax1.set_xticklabels([])
ax1.plot(f, color='blue', label='f')
ax1.legend()
ax2.set_yticklabels([])
ax2.set_xticklabels([])
ax2.plot(g, color=... | [
"numpy.convolve",
"numpy.roll",
"numpy.zeros",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1427, 1442), 'numpy.zeros', 'np.zeros', (['(30000)'], {}), '(30000)\n', (1435, 1442), True, 'import numpy as np\n'), ((1477, 1492), 'numpy.zeros', 'np.zeros', (['(30000)'], {}), '(30000)\n', (1485, 1492), True, 'import numpy as np\n'), ((1515, 1539), 'numpy.linspace', 'np.linspace', (['(1)', '(0)', '(10000)'], {}), ... |
import threading
import copy
import time
from VisionROS.ROS_CONSTANTS import *
from VisionUtils.TableDimensions import TableDimensions
try:
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
from geometry_msgs.msg import Point
from std_msgs.msg import Int32... | [
"rospy.Subscriber",
"rospy.get_param",
"VisionUtils.TableDimensions.TableDimensions",
"time.sleep",
"copy.deepcopy",
"rospy.Publisher"
] | [((1725, 1798), 'rospy.Publisher', 'rospy.Publisher', (['ROS_SUBSCRIBER_CONFIG_H_TOPIC_NAME', 'Int32'], {'queue_size': '(10)'}), '(ROS_SUBSCRIBER_CONFIG_H_TOPIC_NAME, Int32, queue_size=10)\n', (1740, 1798), False, 'import rospy\n'), ((1816, 1889), 'rospy.Publisher', 'rospy.Publisher', (['ROS_SUBSCRIBER_CONFIG_S_TOPIC_N... |
from __future__ import print_function
from amd.rali.plugin.tf import RALIIterator
from amd.rali.pipeline import Pipeline
import amd.rali.ops as ops
import amd.rali.types as types
import sys
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import numpy as np
############################### HYPER PARAMETERS F... | [
"tensorflow.compat.v1.disable_v2_behavior",
"tensorflow.compat.v1.train.AdamOptimizer",
"tensorflow.compat.v1.FixedLenFeature",
"tensorflow.compat.v1.Session",
"tensorflow.compat.v1.nn.relu",
"tensorflow.compat.v1.placeholder",
"tensorflow.compat.v1.nn.softmax",
"tensorflow.compat.v1.argmax",
"tenso... | [((225, 249), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (247, 249), True, 'import tensorflow.compat.v1 as tf\n'), ((1547, 1566), 'tensorflow.compat.v1.nn.relu', 'tf.nn.relu', (['layer_1'], {}), '(layer_1)\n', (1557, 1566), True, 'import tensorflow.compat.v1 as tf\n'), ((164... |
# coding=utf8
# Main executable for download
import sys, traceback
import pprint
from youtube_mp3 import YouTubeMP3
if __name__ == '__main__':
if len(sys.argv) != 2:
raise ValueError("Missing URL argument")
yt = YouTubeMP3()
url = sys.argv[1]
data_list = yt.download(url)
print(data_list)
... | [
"youtube_mp3.YouTubeMP3"
] | [((231, 243), 'youtube_mp3.YouTubeMP3', 'YouTubeMP3', ([], {}), '()\n', (241, 243), False, 'from youtube_mp3 import YouTubeMP3\n')] |
import random
import pytest
from rolling_backup import backup
CONTENT = "Hello"
def create_backups(image_file, num: int):
for i in range(num):
image_file.write(f"{CONTENT} - {i}")
assert backup(str(image_file), num_to_keep=num)
d = image_file.dirpath()
should = d / f... | [
"pytest.fixture",
"rolling_backup.backup"
] | [((569, 601), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (583, 601), False, 'import pytest\n'), ((1707, 1726), 'rolling_backup.backup', 'backup', (['"""xxxyyyzzz"""'], {}), "('xxxyyyzzz')\n", (1713, 1726), False, 'from rolling_backup import backup\n')] |
from django.shortcuts import render, redirect, get_object_or_404
from django.utils import timezone
from .models import Post, Category
from taggit.models import Tag
from .forms import AddPostForm
#from .validator import group_required
# complex lookups (for searching)
from django.db.models import Q
from django.urls ... | [
"django.utils.timezone.now",
"django.db.models.Q",
"django.urls.reverse_lazy"
] | [((6239, 6266), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""posts:index"""'], {}), "('posts:index')\n", (6251, 6266), False, 'from django.urls import reverse_lazy\n'), ((5363, 5377), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (5375, 5377), False, 'from django.utils import timezone\n'), ((5428,... |
import logging
import math
import torch
import torch.nn as nn
from vedastr.models.bodies import build_sequence_decoder
from vedastr.models.utils import build_torch_nn
from vedastr.models.weight_init import init_weights
from .registry import HEADS
logger = logging.getLogger()
@HEADS.register_module
class Transforme... | [
"logging.getLogger",
"torch.ones",
"vedastr.models.utils.build_torch_nn",
"vedastr.models.bodies.build_sequence_decoder",
"torch.cat",
"torch.argmax"
] | [((259, 278), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (276, 278), False, 'import logging\n'), ((586, 617), 'vedastr.models.bodies.build_sequence_decoder', 'build_sequence_decoder', (['decoder'], {}), '(decoder)\n', (608, 617), False, 'from vedastr.models.bodies import build_sequence_decoder\n'), ((6... |
from constants import Constants
import numpy as np
# TODO finish implementing all regions of the atmosphere
class ISA(Constants):
def __init__(self, altitude=0):
""" Calculates International Standard Atmosphere properties for the specified geo-potential altitude
:param float altitude: Geo-potent... | [
"numpy.exp"
] | [((1141, 1189), 'numpy.exp', 'np.exp', (['(-1 * (self.g * (h - 11000.0) / (R * T0)))'], {}), '(-1 * (self.g * (h - 11000.0) / (R * T0)))\n', (1147, 1189), True, 'import numpy as np\n')] |
from django.db import models
__all__ = ('PostSaveImageField',)
class PostSaveImageField(models.ImageField):
def __init__(self, *args, **kwargs):
kwargs['null'] = True
kwargs['blank'] = True
super(PostSaveImageField, self).__init__(*args, **kwargs)
def contribute_to_class(self, cls,... | [
"django.db.models.signals.post_save.connect"
] | [((407, 467), 'django.db.models.signals.post_save.connect', 'models.signals.post_save.connect', (['self.save_file'], {'sender': 'cls'}), '(self.save_file, sender=cls)\n', (439, 467), False, 'from django.db import models\n')] |
import time
import pyautogui
def typer(command):
pyautogui.typewrite(command)
pyautogui.typewrite('\n')
def open_valve(axis, step):
typer("G91G0" + axis + "-" + str(step))
def close_valve(axis, step):
typer("G91G0" + axis + str(step))
def give_me_some_white_bottle(duration):
if duration == 0:... | [
"time.sleep",
"pyautogui.typewrite"
] | [((712, 725), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (722, 725), False, 'import time\n'), ((54, 82), 'pyautogui.typewrite', 'pyautogui.typewrite', (['command'], {}), '(command)\n', (73, 82), False, 'import pyautogui\n'), ((87, 112), 'pyautogui.typewrite', 'pyautogui.typewrite', (['"""\n"""'], {}), "('\\n')... |
import sys
import soundcard
import numpy
import pytest
skip_if_not_linux = pytest.mark.skipif(sys.platform != 'linux', reason='Only implemented for PulseAudio so far')
ones = numpy.ones(1024)
signal = numpy.concatenate([[ones], [-ones]]).T
def test_speakers():
for speaker in soundcard.all_speakers():
ass... | [
"soundcard.get_microphone",
"soundcard.all_speakers",
"soundcard.get_name",
"soundcard.all_microphones",
"numpy.ones",
"soundcard.default_microphone",
"soundcard.default_speaker",
"soundcard.set_name",
"pytest.mark.parametrize",
"soundcard.get_speaker",
"numpy.concatenate",
"pytest.mark.skipif... | [((76, 173), 'pytest.mark.skipif', 'pytest.mark.skipif', (["(sys.platform != 'linux')"], {'reason': '"""Only implemented for PulseAudio so far"""'}), "(sys.platform != 'linux', reason=\n 'Only implemented for PulseAudio so far')\n", (94, 173), False, 'import pytest\n'), ((177, 193), 'numpy.ones', 'numpy.ones', (['(1... |
"""
@copyright: 2012-2016 <NAME> (as file __init__.py)
@copyright: 2016-2018 <NAME>
@license: MIT (see LICENSE.txt) - THIS PROGRAM COMES WITH NO WARRANTY
"""
import os, sys
sys.path.insert(1, os.path.dirname(sys.path[0]))
import errno, fnmatch, glob, shutil, re
import unittest, difflib, logging, imp
import gettext... | [
"difflib.unified_diff",
"main.wxGladeArtProvider",
"wx.App",
"gettext.translation",
"os.path.exists",
"common.init_paths",
"wxglade.init_localization",
"shutil.copy2",
"main.wxGladeFrame",
"log.deinit",
"wxglade.init_stage2",
"os.mkdir",
"common.init_preferences",
"wx.SafeYield",
"common... | [((325, 397), 'gettext.translation', 'gettext.translation', ([], {'domain': '"""wxglade"""', 'localedir': '"""locale"""', 'fallback': '(True)'}), "(domain='wxglade', localedir='locale', fallback=True)\n", (344, 397), False, 'import gettext\n'), ((434, 457), 'common.init_paths', 'common.init_paths', (['None'], {}), '(No... |
#! /usr/bin/env python3
import sh
import click
import re
def real_git(*args, **kwargs):
mock_git(*args, **kwargs)
return sh.git(*args, **kwargs)
def mock_git(*args, **kwargs):
click.echo(sh.git.bake(*args, **kwargs), err=True)
return ""
def branch_exists(name):
try:
get_commit_hash(na... | [
"click.UsageError",
"click.argument",
"click.option",
"sh.git.bake",
"re.match",
"sh.git",
"click.echo",
"click.command"
] | [((559, 574), 'click.command', 'click.command', ([], {}), '()\n', (572, 574), False, 'import click\n'), ((576, 610), 'click.argument', 'click.argument', (['"""commit"""'], {'type': 'str'}), "('commit', type=str)\n", (590, 610), False, 'import click\n'), ((612, 646), 'click.argument', 'click.argument', (['"""branch"""']... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-05-03 14:34
from __future__ import unicode_literals
from django.db import migrations, models
import space_manager.branches.models
class Migration(migrations.Migration):
dependencies = [
('branches', '0010_branch_lounge_img_cabinet'),
]
... | [
"django.db.models.ImageField"
] | [((449, 562), 'django.db.models.ImageField', 'models.ImageField', ([], {'null': '(True)', 'upload_to': '""""""', 'validators': '[space_manager.branches.models.Branch.validate_image]'}), "(null=True, upload_to='', validators=[space_manager.\n branches.models.Branch.validate_image])\n", (466, 562), False, 'from django... |
# Generated by Django 2.2.15 on 2020-08-26 03:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cv', '0002_experience_experience_name'),
]
operations = [
migrations.AlterField(
model_name='experience',
name='exp... | [
"django.db.models.TextField"
] | [((353, 387), 'django.db.models.TextField', 'models.TextField', ([], {'default': '"""Intern"""'}), "(default='Intern')\n", (369, 387), False, 'from django.db import migrations, models\n')] |
"""Wikidump reader and processor module.
"""
import os
with open(os.path.join(
os.path.dirname(__file__),
'scripts',
'DUMP_VERSION')) as f:
DUMP_VERSION = f.readline().strip()
with open(os.path.join(
os.path.dirname(__file__),
'scripts',
'TORRENT_HASH')) as f:
... | [
"os.path.dirname",
"os.path.join"
] | [((432, 461), 'os.path.join', 'os.path.join', (['"""data"""', 'BZ_FILE'], {}), "('data', BZ_FILE)\n", (444, 461), False, 'import os\n'), ((90, 115), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (105, 115), False, 'import os\n'), ((240, 265), 'os.path.dirname', 'os.path.dirname', (['__file__... |
# Generated by Django 3.1 on 2020-08-12 18:03
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('userclass', '0002_auto_20200812_1731'),
]
operations = [
... | [
"django.db.migrations.RenameModel",
"django.db.migrations.swappable_dependency"
] | [((184, 241), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (215, 241), False, 'from django.db import migrations\n'), ((327, 395), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""Use... |
from .base_trainer import BaseTrainer
import torch
import os
class TPUTrainer(BaseTrainer):
r"""TPUTrainer: Trains the vathos model on TPU
"""
def __init__(self, *args, **kwargs):
super(TPUTrainer, self).__init__(*args, **kwargs)
import torch_xla
import torch_xla.core.xla_model ... | [
"torch_xla.core.xla_model.xla_device",
"torch_xla.distributed.parallel_loader.ParallelLoader",
"torch_xla.core.xla_model.mark_step",
"torch_xla.core.xla_model.optimizer_step"
] | [((552, 567), 'torch_xla.core.xla_model.xla_device', 'xm.xla_device', ([], {}), '()\n', (565, 567), True, 'import torch_xla.core.xla_model as xm\n'), ((590, 631), 'torch_xla.distributed.parallel_loader.ParallelLoader', 'pl.ParallelLoader', (['train_loader', '[device]'], {}), '(train_loader, [device])\n', (607, 631), Tr... |
#!/usr/bin/env python
#
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Packages test dependencies as tar.gz file."""
import argparse
import json
import logging
import os
import sys
import tarfile
pa... | [
"logging.basicConfig",
"tarfile.open",
"argparse.ArgumentParser",
"os.path.join",
"os.path.normpath",
"sys.exit",
"json.load",
"logging.info",
"logging.error"
] | [((327, 413), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Package test dependencies as tar.gz files."""'}), "(description=\n 'Package test dependencies as tar.gz files.')\n", (350, 413), False, 'import argparse\n'), ((1830, 1873), 'logging.info', 'logging.info', (['"""Filtering: %s... |
import copy as cp
s = input()
t = input()
u = list(s)
v = list(t)
w = cp.deepcopy(u)
p = 0
q = 0
for h in range(len(u) - 1, -1, -1):
if q == 1:
break
if v[-1] == u[h]:
#w[i] = v[0]
for j in range(len(v)):
if (v[-1 - j] == u[h - j]) and h - j >= 0:
pass
... | [
"copy.deepcopy"
] | [((70, 84), 'copy.deepcopy', 'cp.deepcopy', (['u'], {}), '(u)\n', (81, 84), True, 'import copy as cp\n')] |
import logging
import os
from lisa.trace import FtraceCollector, Trace
from lisa.utils import setup_logging
from lisa.target import Target, TargetConf
from lisa.wlgen.rta import RTA, Periodic
from lisa.datautils import df_filter_task_ids
import pandas as pd
setup_logging()
target = Target.from_one_conf('conf/lisa/qemu... | [
"lisa.utils.setup_logging",
"os.path.join",
"lisa.trace.Trace",
"lisa.wlgen.rta.Periodic",
"lisa.datautils.df_filter_task_ids",
"lisa.target.Target.from_one_conf",
"lisa.wlgen.rta.RTA.by_profile",
"lisa.trace.FtraceCollector"
] | [((259, 274), 'lisa.utils.setup_logging', 'setup_logging', ([], {}), '()\n', (272, 274), False, 'from lisa.utils import setup_logging\n'), ((284, 341), 'lisa.target.Target.from_one_conf', 'Target.from_one_conf', (['"""conf/lisa/qemu_target_default.yml"""'], {}), "('conf/lisa/qemu_target_default.yml')\n", (304, 341), Fa... |
import bisect
breakpoints = [60, 70, 80, 90]
grades = 'FDCBA'
scores = [33, 99, 77, 70, 89, 90, 100]
def grade(score, breakpoints=breakpoints, grades=grades):
i = bisect.bisect(breakpoints, score)
return grades[i]
print('breakpoints:', breakpoints)
print('grades:', grades)
print('scores:', scores)
print([grade... | [
"bisect.bisect"
] | [((167, 200), 'bisect.bisect', 'bisect.bisect', (['breakpoints', 'score'], {}), '(breakpoints, score)\n', (180, 200), False, 'import bisect\n')] |
"""
Functions for displaying text to the screen.
Text rendering in pygame does not allow for line breaks. This can lead to
issues when attempting to render text, particularly if one is unsure of the
width and height of a to-be-rendered string in a given font. The functions
here handle these difficulties.
This module ... | [
"pygame.event.get",
"pygame.Surface",
"pygame.display.get_surface",
"pygame.display.list_modes",
"cogandmem.generic.terminate",
"pygame.key.name",
"pygame.time.Clock",
"pygame.display.update",
"pygame.Rect"
] | [((4994, 5022), 'pygame.display.get_surface', 'pygame.display.get_surface', ([], {}), '()\n', (5020, 5022), False, 'import pygame\n'), ((22783, 22814), 'pygame.Surface', 'pygame.Surface', (['(width, height)'], {}), '((width, height))\n', (22797, 22814), False, 'import pygame\n'), ((27751, 27779), 'pygame.display.get_su... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 01_preprocessor.ipynb (unless otherwise specified).
__all__ = ['PreProcessor']
# Cell
from .dataframeloader import *
from .logger import *
# Cell
# hide
from sklearn.compose import ColumnTransformer, make_column_transformer
from sklearn.pipeline import Pipeline
from sklear... | [
"sklearn.preprocessing.LabelEncoder",
"sklearn.preprocessing.OneHotEncoder",
"sklearn.preprocessing.StandardScaler",
"sklearn.impute.SimpleImputer",
"sklearn.compose.ColumnTransformer",
"sklearn.pipeline.Pipeline"
] | [((1555, 1633), 'sklearn.pipeline.Pipeline', 'Pipeline', ([], {'steps': "[('imputer', num_cols__imputer), ('scaler', num_cols__scaler)]"}), "(steps=[('imputer', num_cols__imputer), ('scaler', num_cols__scaler)])\n", (1563, 1633), False, 'from sklearn.pipeline import Pipeline\n'), ((1897, 1982), 'sklearn.pipeline.Pipeli... |
import os
from sys import argv, stdout
os.environ["CUDA_VISIBLE_DEVICES"]="-1"
import tensorflow as tf
import numpy as np
import scipy
import scipy.io
from itertools import product as prod
import time
from tensorflow.python.client import timeline
import cProfile
from sys import argv, stdout
from get_data import *
impo... | [
"tensorflow.reset_default_graph",
"numpy.reshape",
"tensorflow.placeholder",
"tensorflow.train.Saver",
"tensorflow.Session",
"numpy.array",
"numpy.linalg.norm",
"tensorflow.ConfigProto",
"numpy.shape"
] | [((3720, 3787), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, params.n_ts, params.controls_nb]'], {}), '(tf.float32, [None, params.n_ts, params.controls_nb])\n', (3734, 3787), True, 'import tensorflow as tf\n'), ((3822, 3899), 'tensorflow.placeholder', 'tf.placeholder', (['tf.complex128', '[None, ... |
from __future__ import print_function
import os
from time import strftime, sleep
import requests
import time
def main(BLUE_ENV_NAME, boto_authenticated_client):
beanstalkclient = boto_authenticated_client.client('elasticbeanstalk')
wait_until_env_be_ready(beanstalkclient, BLUE_ENV_NAME)
if os.getenv("RELEASE_H... | [
"requests.get",
"time.sleep",
"os.getenv"
] | [((300, 341), 'os.getenv', 'os.getenv', (['"""RELEASE_HEALTH_CHECKING_PATH"""'], {}), "('RELEASE_HEALTH_CHECKING_PATH')\n", (309, 341), False, 'import os\n'), ((625, 667), 'requests.get', 'requests.get', (['blue_env_cname'], {'verify': '(False)'}), '(blue_env_cname, verify=False)\n', (637, 667), False, 'import requests... |
from pycoin.networks.bitcoinish import create_bitcoinish_network
network = create_bitcoinish_network(
network_name="Monacoin", symbol="MONA", subnet_name="mainnet",
wif_prefix_hex="b0", sec_prefix="MONASEC:", address_prefix_hex="32", pay_to_script_prefix_hex="37",
bip32_prv_prefix_hex="0488ade4", bip32_pu... | [
"pycoin.networks.bitcoinish.create_bitcoinish_network"
] | [((77, 458), 'pycoin.networks.bitcoinish.create_bitcoinish_network', 'create_bitcoinish_network', ([], {'network_name': '"""Monacoin"""', 'symbol': '"""MONA"""', 'subnet_name': '"""mainnet"""', 'wif_prefix_hex': '"""b0"""', 'sec_prefix': '"""MONASEC:"""', 'address_prefix_hex': '"""32"""', 'pay_to_script_prefix_hex': '"... |
def generatePostscriptNameMap(glyphList):
"""
Generate a PostScript Name Map to be stored in the "public.postscriptNames" lib.
Used to rename glyphs during generation, like so:
{"indianrupee.tab": "uni20B9.tab"}
Args:
glyphList (list): A list of Glyph objects or a Font object (Defcon or F... | [
"re.split"
] | [((1545, 1580), 're.split', 're.split', (['"""((?<!^)[\\\\W\\\\_\\\\-]+)"""', 'k'], {}), "('((?<!^)[\\\\W\\\\_\\\\-]+)', k)\n", (1553, 1580), False, 'import re\n')] |
import csv
import argparse
def get_striked_header_pairs(strikethrough):
if strikethrough is not None:
return [pair.split('--') for pair in strikethrough]
else:
return []
def build_colored_str(v, cancelled):
if (v < 0.20):
return '\\textcolor{cor-very-weak}{' + str(cancelled) + "}... | [
"csv.reader",
"argparse.ArgumentParser"
] | [((2814, 2989), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""This program pretty-prints a CSV correlations matrix for usage in latex"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description=\n 'This program pretty-prints a CSV correlations matrix for usage i... |
from ..utils.GPIO_utils import setup_output, output, GPIO_Base
from time import sleep
import random
def keep_decorate(func):
def func_wrapper(self, keep=None):
func(self, keep)
if keep is None: keep = self.keep
if keep > 0:
sleep(keep)
self._stop()
return func_wrapper
class L289N(GPIO_Base... | [
"time.sleep"
] | [((245, 256), 'time.sleep', 'sleep', (['keep'], {}), '(keep)\n', (250, 256), False, 'from time import sleep\n')] |
from matplotlib import pyplot as plt
def leibniz(n):
lz = 0
ret = list()
for i in range(n + 1):
lz += ((-1) ** i) * (4 / (2 * i + 1))
ret.append(lz)
return lz, ret
lz, ret = leibniz(1000)
plt.plot(ret)
plt.show()
| [
"matplotlib.pyplot.plot",
"matplotlib.pyplot.show"
] | [((198, 211), 'matplotlib.pyplot.plot', 'plt.plot', (['ret'], {}), '(ret)\n', (206, 211), True, 'from matplotlib import pyplot as plt\n'), ((212, 222), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (220, 222), True, 'from matplotlib import pyplot as plt\n')] |
from typing import Dict, List, Any
import numpy
from overrides import overrides
from ..instance import TextInstance, IndexedInstance
from ...data_indexer import DataIndexer
class TaggingInstance(TextInstance):
"""
A ``TaggingInstance`` represents a passage of text and a tag sequence over that text.
The... | [
"numpy.asarray"
] | [((3384, 3431), 'numpy.asarray', 'numpy.asarray', (['self.text_indices'], {'dtype': '"""int32"""'}), "(self.text_indices, dtype='int32')\n", (3397, 3431), False, 'import numpy\n'), ((3454, 3494), 'numpy.asarray', 'numpy.asarray', (['self.label'], {'dtype': '"""int32"""'}), "(self.label, dtype='int32')\n", (3467, 3494),... |
#<NAME>
# todo mov not working
import nuke
from PySide import QtGui
def run(node):
clipboard = QtGui.QApplication.clipboard()
filename = node['file'].evaluate()
filesplit = filename.rsplit('.',-2)
filesplit[1] = '%0'+str(len(filesplit[1]))+'d'
filep = '.'.join(filesplit)
filenameFrame = nuke.getFileN... | [
"PySide.QtGui.QApplication.clipboard",
"nuke.nodePaste"
] | [((98, 128), 'PySide.QtGui.QApplication.clipboard', 'QtGui.QApplication.clipboard', ([], {}), '()\n', (126, 128), False, 'from PySide import QtGui\n'), ((424, 453), 'nuke.nodePaste', 'nuke.nodePaste', (['"""%clipboard%"""'], {}), "('%clipboard%')\n", (438, 453), False, 'import nuke\n')] |
import sublime
def pkg_settings():
# NOTE: The sublime.load_settings(...) call has to be deferred to this function,
# rather than just being called immediately and assigning a module-level variable,
# because of: https://www.sublimetext.com/docs/3/api_reference.html#plugin_lifecycle
return sublime.loa... | [
"sublime.load_settings"
] | [((309, 360), 'sublime.load_settings', 'sublime.load_settings', (['"""Git blame.sublime-settings"""'], {}), "('Git blame.sublime-settings')\n", (330, 360), False, 'import sublime\n')] |
import json
with open('train.json','r') as f:
gt = json.load(f)
def parse(f):
imgid_2_anno = {}
imgid_2_img = {}
annotations = f['annotations']
images = f['images']
print (len(images))
categories = f['categories']
for img in images:
id = img['id']
imgid_2_i... | [
"json.load",
"json.dump"
] | [((56, 68), 'json.load', 'json.load', (['f'], {}), '(f)\n', (65, 68), False, 'import json\n'), ((1125, 1146), 'json.dump', 'json.dump', (['ret_obj', 'f'], {}), '(ret_obj, f)\n', (1134, 1146), False, 'import json\n')] |
import time
from sanic.response import HTTPResponse
from sanic.server import HttpProtocol
from insanic.log import access_logger
class InsanicHttpProtocol(HttpProtocol):
def log_response(self, response: HTTPResponse) -> None:
"""
Logs the response. More expressive than Sanic's implmenetation.
... | [
"insanic.log.access_logger.exception",
"time.time",
"insanic.log.access_logger.info"
] | [((1775, 1844), 'insanic.log.access_logger.exception', 'access_logger.exception', (['""""""'], {'extra': 'extra', 'exc_info': 'response.exception'}), "('', extra=extra, exc_info=response.exception)\n", (1798, 1844), False, 'from insanic.log import access_logger\n'), ((1917, 1952), 'insanic.log.access_logger.info', 'acc... |
# %%
import pandas as pd
# %%
# path to data, see
# res stock meta: https://data.openei.org/s3_viewer?bucket=oedi-data-lake&prefix=nrel-pds-building-stock%2Fend-use-load-profiles-for-us-building-stock%2F2021%2Fresstock_amy2018_release_1%2Ftimeseries_aggregates_metadata%2F
# com stock meta: https://data.openei.org/s3_vi... | [
"pandas.read_csv"
] | [((622, 657), 'pandas.read_csv', 'pd.read_csv', (['comStockPath'], {'sep': '"""\t"""'}), "(comStockPath, sep='\\t')\n", (633, 657), True, 'import pandas as pd\n'), ((669, 704), 'pandas.read_csv', 'pd.read_csv', (['resStockPath'], {'sep': '"""\t"""'}), "(resStockPath, sep='\\t')\n", (680, 704), True, 'import pandas as p... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 23 19:53:22 2021
@author: <NAME> (<EMAIL>) at USTC
This script refers to some theories and codes of Obspy/MoPaD/Introduction to Seismology (Yongge Wan):
1) The MoPaD program (https://github.com/geophysics/MoPaD);
2) str_dip_rake to mt;
3... | [
"numpy.trace",
"numpy.log10",
"numpy.linalg.eig",
"numpy.cross",
"math.acos",
"math.tan",
"math.sqrt",
"math.cos",
"numpy.array",
"numpy.linspace",
"numpy.argsort",
"numpy.outer",
"math.atan2",
"numpy.linalg.norm",
"math.sin"
] | [((5395, 5409), 'numpy.cross', 'np.cross', (['P', 'T'], {}), '(P, T)\n', (5403, 5409), True, 'import numpy as np\n'), ((6191, 6207), 'numpy.linalg.eig', 'np.linalg.eig', (['M'], {}), '(M)\n', (6204, 6207), True, 'import numpy as np\n'), ((7085, 7106), 'math.sqrt', 'sqrt', (['(x ** 2 + y ** 2)'], {}), '(x ** 2 + y ** 2)... |
"""
djlime.forms.widgets
~~~~~~~~~~~~~~
Extended django form widgets.
:copyright: (c) 2012 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
from itertools import chain
from django.forms import widgets
from django.forms.util import flatatt
from django.utils.encoding import force_unicode... | [
"itertools.chain",
"django.utils.encoding.force_unicode",
"django.forms.util.flatatt"
] | [((2921, 2941), 'django.utils.encoding.force_unicode', 'force_unicode', (['value'], {}), '(value)\n', (2934, 2941), False, 'from django.utils.encoding import force_unicode\n'), ((858, 890), 'django.utils.encoding.force_unicode', 'force_unicode', (['self.choice_label'], {}), '(self.choice_label)\n', (871, 890), False, '... |
import torch
from torch import nn, Tensor
from typing import Tuple
from ..components import ResidualRNN
__all__ = ['Encoder', 'RNNEncoder', 'GRUEncoder']
class Encoder(nn.Module):
def __init__(self, input_size, hidden_size, embedding_dim, num_layers, bidirectional, device, pad_token=0, drop_rate=0.1):
s... | [
"torch.nn.Dropout",
"torch.nn.LSTM",
"torch.zeros",
"torch.nn.Embedding",
"torch.nn.GRU"
] | [((612, 680), 'torch.nn.Embedding', 'nn.Embedding', (['input_size', 'self._embedding_dim'], {'padding_idx': 'pad_token'}), '(input_size, self._embedding_dim, padding_idx=pad_token)\n', (624, 680), False, 'from torch import nn, Tensor\n'), ((705, 726), 'torch.nn.Dropout', 'nn.Dropout', (['drop_rate'], {}), '(drop_rate)\... |
import torch
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
class LabelSmoothingCrossEntropy(torch.nn.Module):
def __init__(self):
super(LabelSmoothingCrossEntropy, self).__init__()
def forward(self, x, target, smoothing=0.1):
confidence = 1. - smoothing... | [
"torch.mul",
"torch.mode",
"torch.nn.functional.nll_loss",
"torch.mean",
"sklearn.metrics.auc",
"torch.nn.L1Loss",
"torch.nn.NLLLoss",
"torch.nn.functional.log_softmax",
"torch.nn.functional.cross_entropy",
"utils.AverageMeter",
"torch.no_grad",
"torch.zeros_like",
"time.time",
"torch.nn.f... | [((3492, 3510), 'torch.nn.NLLLoss', 'torch.nn.NLLLoss', ([], {}), '()\n', (3508, 3510), False, 'import torch\n'), ((6393, 6427), 'utils.AverageMeter', 'utils.AverageMeter', (['"""Loss"""', '""":.4e"""'], {}), "('Loss', ':.4e')\n", (6411, 6427), False, 'import utils\n'), ((6696, 6707), 'time.time', 'time.time', ([], {})... |
import matplotlib
import numpy as np
import time
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
VOC_BBOX_LABEL_NAMES = (
'fly',
'bike',
'bird',
'boat',
'pin',
'bus',
'c',
'cat',
'chair',
'cow',
'table',
'dog',
'horse',
'moto',
'p',
'plant',
... | [
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"numpy.roll",
"matplotlib.pyplot.Rectangle"
] | [((3262, 3285), 'numpy.roll', 'np.roll', (['buf', '(3)'], {'axis': '(2)'}), '(buf, 3, axis=2)\n', (3269, 3285), True, 'import numpy as np\n'), ((3462, 3473), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (3471, 3473), True, 'import matplotlib.pyplot as plt\n'), ((915, 927), 'matplotlib.pyplot.figure', 'plt.... |
from lib.util.processing import processing
from lib.model.encoder import SimpleEncoder
from lib.model.decoder import AttentionDecoder
import torch
import random
if __name__ == "__main__":
# 1. Declare the hyperparameter
device, configure, word_index, index_word, train_loader, test_loader = processing... | [
"random.randint",
"lib.model.encoder.SimpleEncoder",
"torch.nn.CrossEntropyLoss",
"lib.model.decoder.AttentionDecoder",
"torch.max",
"torch.tensor",
"torch.sum",
"torch.no_grad",
"lib.util.processing.processing",
"torch.zeros",
"torch.ones"
] | [((310, 335), 'lib.util.processing.processing', 'processing', (['"""./configure"""'], {}), "('./configure')\n", (320, 335), False, 'from lib.util.processing import processing\n'), ((573, 600), 'torch.nn.CrossEntropyLoss', 'torch.nn.CrossEntropyLoss', ([], {}), '()\n', (598, 600), False, 'import torch\n'), ((416, 440), ... |
import julia
import numpy as np
import os.path as osp
import gym
from brl_gym.envs.mujoco import box_pusher
env = box_pusher.BoxPusher()
rlopt = "/home/gilwoo/School_Workspace/rlopt"
j = julia.Julia()
j.include(osp.join(rlopt, "_init.jl"))
j.include(osp.join(rlopt, "src/pg/Baseline.jl"))
j.include(osp.join(rlopt, "sr... | [
"brl_gym.envs.mujoco.box_pusher.BoxPusher",
"os.path.join",
"julia.Julia",
"IPython.embed",
"numpy.squeeze"
] | [((114, 136), 'brl_gym.envs.mujoco.box_pusher.BoxPusher', 'box_pusher.BoxPusher', ([], {}), '()\n', (134, 136), False, 'from brl_gym.envs.mujoco import box_pusher\n'), ((188, 201), 'julia.Julia', 'julia.Julia', ([], {}), '()\n', (199, 201), False, 'import julia\n'), ((1570, 1585), 'IPython.embed', 'IPython.embed', ([],... |
import numpy as np
from scipy.optimize import fmin
from scipy.stats import kurtosis
from scipy.special import lambertw
"""
The algorithm is based on [1]. The implementation is based on [2].
[1]: <NAME>, 2013 (https://arxiv.org/pdf/1010.2265.pdf)
[2]: <NAME>, 2015 (https://github.com/gregversteeg/gaussianize)
"""
d... | [
"numpy.mean",
"numpy.median",
"numpy.sqrt",
"scipy.special.lambertw",
"scipy.stats.kurtosis",
"numpy.log",
"numpy.exp",
"numpy.errstate",
"numpy.array",
"numpy.isfinite",
"numpy.sign",
"numpy.std"
] | [((2216, 2253), 'scipy.stats.kurtosis', 'kurtosis', (['z'], {'fisher': '(False)', 'bias': '(False)'}), '(z, fisher=False, bias=False)\n', (2224, 2253), False, 'from scipy.stats import kurtosis\n'), ((779, 789), 'numpy.sign', 'np.sign', (['z'], {}), '(z)\n', (786, 789), True, 'import numpy as np\n'), ((1214, 1223), 'num... |
import factory
from portfolios.models import Certification
from users.factories.user_factory import UserFactory
from factory.django import DjangoModelFactory
from utils.helpers import create_factory_data
class CertificationFactory(DjangoModelFactory):
class Meta:
model = Certification
user = factory.... | [
"factory.SubFactory",
"factory.Faker",
"utils.helpers.create_factory_data"
] | [((312, 343), 'factory.SubFactory', 'factory.SubFactory', (['UserFactory'], {}), '(UserFactory)\n', (330, 343), False, 'import factory\n'), ((355, 376), 'factory.Faker', 'factory.Faker', (['"""word"""'], {}), "('word')\n", (368, 376), False, 'import factory\n'), ((396, 417), 'factory.Faker', 'factory.Faker', (['"""word... |
from flask import Blueprint
from api.controllers import imagescontroller
imagesprint = Blueprint("images", __name__)
imagesprint.add_url_rule(
"/image/create/<int:project_id>",
view_func=imagescontroller.imageController["save_image"],
methods=["POST"]
)
imagesprint.add_url_rule(
"/image/get/<int:p... | [
"flask.Blueprint"
] | [((89, 118), 'flask.Blueprint', 'Blueprint', (['"""images"""', '__name__'], {}), "('images', __name__)\n", (98, 118), False, 'from flask import Blueprint\n')] |
from distutils.core import setup
import os
setup(name='pylagrit',
version='1.0.0',
description='Python interface for LaGriT',
author='<NAME>',
author_email='<EMAIL>',
url='lagrit.lanl.gov',
license='LGPL',
packages=[
'pylagrit',
'pylagrit.pexpect']
)
| [
"distutils.core.setup"
] | [((44, 262), 'distutils.core.setup', 'setup', ([], {'name': '"""pylagrit"""', 'version': '"""1.0.0"""', 'description': '"""Python interface for LaGriT"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""lagrit.lanl.gov"""', 'license': '"""LGPL"""', 'packages': "['pylagrit', 'pylagrit.pexpect']"})... |
"""
Compute intersection of two sampled datasets sentences.
"""
import sys
import glob
import json
import gzip
def get_uids(input_file_path):
"""
Convert datasets to set of uids.
"""
use_gzip = True if input_file_path[-3:] == '.gz' else False
if use_gzip:
file_i = gzip.GzipFile(input_file... | [
"gzip.GzipFile",
"json.loads"
] | [((296, 331), 'gzip.GzipFile', 'gzip.GzipFile', (['input_file_path', '"""r"""'], {}), "(input_file_path, 'r')\n", (309, 331), False, 'import gzip\n'), ((560, 575), 'json.loads', 'json.loads', (['row'], {}), '(row)\n', (570, 575), False, 'import json\n')] |
from flask import jsonify
from discord_interactions import verify_key, InteractionType, InteractionResponseType
import color
PUBLIC_KEY = ""
def handler(request):
# Verify request
signature = request.headers.get("X-Signature-Ed25519")
timestamp = request.headers.get("X-Signature-Timestamp")
if (
... | [
"discord_interactions.verify_key",
"color.main",
"flask.jsonify"
] | [((625, 672), 'flask.jsonify', 'jsonify', (["{'type': InteractionResponseType.PONG}"], {}), "({'type': InteractionResponseType.PONG})\n", (632, 672), False, 'from flask import jsonify\n'), ((388, 446), 'discord_interactions.verify_key', 'verify_key', (['request.data', 'signature', 'timestamp', 'PUBLIC_KEY'], {}), '(req... |
import unittest
import numpy as np
import pandas as pd
from sklearn import datasets
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from punk.feature_selection import PCAFeatures
from punk.feature_selection import RFFeatures
class TestPCA(unittest.TestCase):... | [
"sklearn.datasets.load_iris",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.datasets.load_boston",
"punk.feature_selection.PCAFeatures",
"sklearn.preprocessing.StandardScaler",
"numpy.array",
"numpy.array_equal",
"numpy.isfinite",
"unittest.main",
"punk.feature_selectio... | [((2232, 2247), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2245, 2247), False, 'import unittest\n'), ((409, 429), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (427, 429), False, 'from sklearn import datasets\n'), ((444, 460), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', (... |
from bs4 import BeautifulSoup
from urllib.request import urlopen, Request
import math
from atpparser.constants import HEADERS
from atpparser.util import format_player_name, get_archive_url, get_archive_filename, \
get_draw_url, get_draw_filename
# downloads archive to "archive_{year}.html"
def downloadArchive(year... | [
"atpparser.util.get_archive_url",
"atpparser.util.get_draw_url",
"urllib.request.Request",
"atpparser.util.get_draw_filename",
"atpparser.util.get_archive_filename",
"math.log",
"atpparser.util.format_player_name",
"urllib.request.urlopen"
] | [((341, 362), 'atpparser.util.get_archive_url', 'get_archive_url', (['year'], {}), '(year)\n', (356, 362), False, 'from atpparser.util import format_player_name, get_archive_url, get_archive_filename, get_draw_url, get_draw_filename\n'), ((386, 412), 'atpparser.util.get_archive_filename', 'get_archive_filename', (['yea... |
"""
Project: SSITH CyberPhysical Demonstrator
Name: simulator.py
Author: <NAME>, <NAME> <<EMAIL>>
Date: 10/01/2020
Python 3.8.3
O/S: Windows 10
This routine creates a BeamNG simulator thread and makes vehicle speed,
throttle, brakes, and position available.
"""
import logging.config
import logging
import enum
import... | [
"beamngpy.sensors.Electrics",
"beamngpy.BeamNGpy",
"cyberphyslib.demonstrator.logger.sim_logger.error",
"enum.auto",
"beamngpy.sensors.GForces",
"logging.warning",
"psutil.process_iter",
"functools.wraps",
"cyberphyslib.demonstrator.logger.sim_logger.info",
"time.sleep",
"cyberphyslib.demonstrat... | [((674, 685), 'enum.auto', 'enum.auto', ([], {}), '()\n', (683, 685), False, 'import enum\n'), ((708, 719), 'enum.auto', 'enum.auto', ([], {}), '()\n', (717, 719), False, 'import enum\n'), ((732, 743), 'enum.auto', 'enum.auto', ([], {}), '()\n', (741, 743), False, 'import enum\n'), ((763, 774), 'enum.auto', 'enum.auto'... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
__a... | [
"pulumi.getter",
"pulumi.set",
"pulumi.get"
] | [((1720, 1755), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""objectVersion"""'}), "(name='objectVersion')\n", (1733, 1755), False, 'import pulumi\n'), ((545, 575), 'pulumi.set', 'pulumi.set', (['__self__', '"""s3"""', 's3'], {}), "(__self__, 's3', s3)\n", (555, 575), False, 'import pulumi\n'), ((685, 707), 'pulu... |
"""Classes and functions for configuring BIG-IP"""
# Copyright 2014 F5 Networks 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
#
# Unle... | [
"logging.getLogger",
"icontrol.session.iControlRESTSession"
] | [((870, 897), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (887, 897), False, 'import logging\n'), ((1457, 1532), 'icontrol.session.iControlRESTSession', 'iControlRESTSession', (['username', 'password'], {'timeout': 'timeout', 'loglevel': 'loglevel'}), '(username, password, timeout=time... |
from unittest import TestCase
from tests.assertions import CustomAssertions
import scipy.sparse
import numpy as np
import tests.rabi as rabi
import floq
class TestSetBlock(TestCase):
def setUp(self):
self.dim_block = 5
self.n_block = 3
self.a, self.b, self.c, self.d, self.e, self.f, self.g... | [
"numpy.identity",
"numpy.ones",
"numpy.arange",
"floq.evolution._dense_to_sparse",
"floq.evolution._add_block",
"floq.evolution.assemble_k",
"floq.evolution.assemble_dk",
"numpy.array",
"numpy.zeros",
"floq.evolution._find_duplicates",
"numpy.array_equal",
"floq.evolution.assemble_k_sparse",
... | [((435, 527), 'numpy.bmat', 'np.bmat', (['[[self.a, self.b, self.c], [self.d, self.e, self.f], [self.g, self.h, self.i]]'], {}), '([[self.a, self.b, self.c], [self.d, self.e, self.f], [self.g, self.\n h, self.i]])\n', (442, 527), True, 'import numpy as np\n'), ((597, 613), 'numpy.array', 'np.array', (['matrix'], {})... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from datetime import datetime
items = [
'23/03/2007',
'05/12/2007',
'22/08/2008',
'02/10/2009',
]
for i in range(len(items) - 1):
date_str_1, date_str_2 = items[i], items[i + 1]
date_1 = datetime.strptime(date_str_1, '... | [
"datetime.datetime.strptime"
] | [((289, 330), 'datetime.datetime.strptime', 'datetime.strptime', (['date_str_1', '"""%d/%m/%Y"""'], {}), "(date_str_1, '%d/%m/%Y')\n", (306, 330), False, 'from datetime import datetime\n'), ((344, 385), 'datetime.datetime.strptime', 'datetime.strptime', (['date_str_2', '"""%d/%m/%Y"""'], {}), "(date_str_2, '%d/%m/%Y')\... |
from smbus import SMBus
import time
import csv
import serial
#import thread
LIS3DH = False
MPL3115A2 = False
GPS = False
deg = u'\N{DEGREE SIGN}'
apo = u"\u0027" #apostrophe
serialport = serial.Serial(
port="/dev/ttyACM0",
baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
by... | [
"lib_GPS.Get_Data",
"csv.writer",
"time.strftime",
"lib_LIS3DH.Get_Data",
"time.sleep",
"serial.Serial",
"lib_MPL3115A2.Get_Data"
] | [((190, 338), 'serial.Serial', 'serial.Serial', ([], {'port': '"""/dev/ttyACM0"""', 'baudrate': '(9600)', 'parity': 'serial.PARITY_NONE', 'stopbits': 'serial.STOPBITS_ONE', 'bytesize': 'serial.EIGHTBITS', 'timeout': '(1)'}), "(port='/dev/ttyACM0', baudrate=9600, parity=serial.PARITY_NONE,\n stopbits=serial.STOPBITS_... |
# -*- coding: utf-8 -*-
u"""MAD-X execution template.
:copyright: Copyright (c) 2020 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkio
from pykern import pkjinja
from pykern.pkcolle... | [
"sirepo.template.code_variable.PurePythonEval",
"sirepo.template.template_common.generate_parameters_file",
"sirepo.template.template_common.render_jinja",
"sirepo.template.lattice.LatticeUtil",
"sirepo.template.lattice.LatticeIterator",
"pykern.pkcollections.PKDict",
"math.exp",
"math.atan"
] | [((771, 783), 'math.atan', 'math.atan', (['(1)'], {}), '(1)\n', (780, 783), False, 'import math\n'), ((1726, 1734), 'pykern.pkcollections.PKDict', 'PKDict', ([], {}), '()\n', (1732, 1734), False, 'from pykern.pkcollections import PKDict\n'), ((1929, 1975), 'sirepo.template.template_common.generate_parameters_file', 'te... |