code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
#This is from https://github.com/weixsong vocoder implementation, please see LICENSE-weixsong
import librosa
import librosa.filters
import numpy as np
from scipy import signal
from params import hparams
def preemphasis(x):
return signal.lfilter([1, -hparams.preemphasis], [1], x)
def sp... | [
"numpy.abs",
"numpy.maximum",
"scipy.signal.lfilter",
"numpy.clip",
"librosa.filters.mel",
"numpy.dot",
"librosa.stft"
] | [((262, 311), 'scipy.signal.lfilter', 'signal.lfilter', (['[1, -hparams.preemphasis]', '[1]', 'x'], {}), '([1, -hparams.preemphasis], [1], x)\n', (276, 311), False, 'from scipy import signal\n'), ((699, 775), 'librosa.stft', 'librosa.stft', ([], {'y': 'y', 'n_fft': 'n_fft', 'hop_length': 'hop_length', 'win_length': 'wi... |
from flask import Flask
import os
"""
This file defines global variables and config values
"""
package_dir = os.path.dirname(
os.path.abspath(__file__)
)
templates = os.path.join(
package_dir, "templates"
)
app = Flask('this is a simple web application', template_folder=templates)
app.conf... | [
"os.path.abspath",
"flask.Flask",
"os.path.join",
"os.getenv"
] | [((186, 224), 'os.path.join', 'os.path.join', (['package_dir', '"""templates"""'], {}), "(package_dir, 'templates')\n", (198, 224), False, 'import os\n'), ((242, 310), 'flask.Flask', 'Flask', (['"""this is a simple web application"""'], {'template_folder': 'templates'}), "('this is a simple web application', template_f... |
import os
import uuid
import json
import base64
import logging
import requests
from PIL import Image
from io import BytesIO
from azure.storage.blob import BlockBlobService
from azure.cognitiveservices.vision.customvision.training import CustomVisionTrainingClient
from azure.cognitiveservices.vision.customvision.trainin... | [
"io.BytesIO",
"logging.exception",
"uuid.uuid4",
"azure.storage.blob.BlockBlobService",
"json.dumps",
"azure.cognitiveservices.vision.customvision.training.CustomVisionTrainingClient",
"logging.info",
"azure.functions.HttpResponse",
"azure.cognitiveservices.vision.customvision.training.models.ImageF... | [((1119, 1184), 'logging.info', 'logging.info', (['"""Python HTTP trigger function processed a request."""'], {}), "('Python HTTP trigger function processed a request.')\n", (1131, 1184), False, 'import logging\n'), ((1190, 1227), 'logging.info', 'logging.info', (['f"""Method: {req.method}"""'], {}), "(f'Method: {req.m... |
from ..ecdsa.secp256k1 import secp256k1_generator
from ..encoding.sec import is_sec, public_pair_to_hash160_sec, sec_to_public_pair, EncodingError
from pycoin.satoshi.checksigops import parse_signature_blob
from pycoin.satoshi.der import UnexpectedDER
class WhoSigned(object):
def __init__(self, script_tools):
... | [
"pycoin.satoshi.checksigops.parse_signature_blob"
] | [((3249, 3280), 'pycoin.satoshi.checksigops.parse_signature_blob', 'parse_signature_blob', (['signature'], {}), '(signature)\n', (3269, 3280), False, 'from pycoin.satoshi.checksigops import parse_signature_blob\n'), ((1609, 1635), 'pycoin.satoshi.checksigops.parse_signature_blob', 'parse_signature_blob', (['data'], {})... |
# A derivative calculator for real valued functions
import sys
import os
import time
import math
def menu():
print('Welcome to my Calculus Calculator!')
mm_choice=input('Press c to use the calculator \nPress q to quit \n')
if mm_choice=="c" and "C":
print(' ')
calculator()
elif mm_choice... | [
"sys.exit",
"time.sleep"
] | [((364, 377), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (374, 377), False, 'import time\n'), ((381, 391), 'sys.exit', 'sys.exit', ([], {}), '()\n', (389, 391), False, 'import sys\n')] |
from django.db import models
# Create your models here.
class Device(models.Model):
ip_address = models.CharField(max_length=255)
hostname = models.CharField(max_length=255)
username = models.CharField(max_length=255)
password = models.CharField(max_length=255)
ssh_port = models.IntegerField(defau... | [
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((103, 135), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (119, 135), False, 'from django.db import models\n'), ((151, 183), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (167, 183), False, 'from django.d... |
import copy
import itertools
from . import misc
from . import strings
class NoneAttributesMixin:
"""Accessing attributes which do not exist will return None instead of raising an AttributeError."""
def __getattr__(self, item):
return None
class DynamicSubclassingMixin:
"""Allows for dynamically... | [
"copy.deepcopy"
] | [((1032, 1050), 'copy.deepcopy', 'copy.deepcopy', (['val'], {}), '(val)\n', (1045, 1050), False, 'import copy\n'), ((2297, 2341), 'copy.deepcopy', 'copy.deepcopy', (['new_instance_properties[attr]'], {}), '(new_instance_properties[attr])\n', (2310, 2341), False, 'import copy\n')] |
__copyright__ = 'Copyright(c) <NAME> 2018'
"""
"""
import graphene
from a_tuin.api import id_with_session, OBJECT_REFERENCE_MAP, leaf_class_interfaces
from glod.db.person import Person, PersonInstanceQuery
class PersonLeaf(graphene.ObjectType):
class Meta:
interfaces = leaf_class_interfaces(Person)
... | [
"glod.db.person.PersonInstanceQuery",
"a_tuin.api.leaf_class_interfaces"
] | [((288, 317), 'a_tuin.api.leaf_class_interfaces', 'leaf_class_interfaces', (['Person'], {}), '(Person)\n', (309, 317), False, 'from a_tuin.api import id_with_session, OBJECT_REFERENCE_MAP, leaf_class_interfaces\n'), ((424, 452), 'glod.db.person.PersonInstanceQuery', 'PersonInstanceQuery', (['session'], {}), '(session)\... |
from collections import defaultdict
from dataclasses import dataclass
from functools import cache
with open('02.txt', 'r') as f:
data = f.readlines()
@dataclass(frozen=True)
class Tile:
x: int
y: int
z: int
@cache
def neighbours(self):
out = set()
for direction in directions.... | [
"collections.defaultdict",
"dataclasses.dataclass"
] | [((158, 180), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (167, 180), False, 'from dataclasses import dataclass\n'), ((663, 680), 'collections.defaultdict', 'defaultdict', (['bool'], {}), '(bool)\n', (674, 680), False, 'from collections import defaultdict\n')] |
# coding: utf-8
# 2021/7/13 @ tongshiwei
import os
from longling import path_append
from EduData import get_data
from .rnn import RNNModel
from .gensim_vec import W2V, D2V
from .meta import Vector
from EduNLP.constant import MODEL_DIR
MODELS = {
"w2v": W2V,
"d2v": D2V,
"rnn": RNNModel,
"lstm": RNNMode... | [
"EduData.get_data",
"os.path.basename"
] | [((1684, 1708), 'EduData.get_data', 'get_data', (['url', 'model_dir'], {}), '(url, model_dir)\n', (1692, 1708), False, 'from EduData import get_data\n'), ((1784, 1812), 'os.path.basename', 'os.path.basename', (['model_path'], {}), '(model_path)\n', (1800, 1812), False, 'import os\n')] |
#!/usr/bin/python2
import os
import subprocess
import sys
import tempfile
from Logger import logger
BASE_COMMAND = "/usr/bin/xinit /usr/bin/dbus-launch --exit-with-session %s -- :0 -nolisten tcp vt7"
try:
logger.debug("Starting ThinLauncher Daemon")
while True:
logger.debug("Launching ThinLauncher G... | [
"os.remove",
"Logger.logger.debug",
"tempfile.gettempdir",
"os.path.exists",
"subprocess.call",
"sys.exit"
] | [((212, 256), 'Logger.logger.debug', 'logger.debug', (['"""Starting ThinLauncher Daemon"""'], {}), "('Starting ThinLauncher Daemon')\n", (224, 256), False, 'from Logger import logger\n'), ((282, 324), 'Logger.logger.debug', 'logger.debug', (['"""Launching ThinLauncher GUI"""'], {}), "('Launching ThinLauncher GUI')\n", ... |
#!/usr/bin/python
# Copyright 2016 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.
"""Run tools/ unittests."""
import sys
import unittest
if __name__ == '__main__':
suite = unittest.TestLoader().discover('tools', patte... | [
"unittest.TextTestRunner",
"unittest.TestLoader"
] | [((275, 296), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (294, 296), False, 'import unittest\n'), ((358, 383), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (381, 383), False, 'import unittest\n')] |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** 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 ... | [
"pulumi.get",
"pulumi.getter",
"pulumi.ResourceOptions",
"pulumi.set",
"pulumi.log.warn",
"warnings.warn"
] | [((5812, 5848), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""startContainer"""'}), "(name='startContainer')\n", (5825, 5848), False, 'import pulumi\n'), ((6619, 6655), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""waitForNetwork"""'}), "(name='waitForNetwork')\n", (6632, 6655), False, 'import pulumi\n'), (... |
import pandas as pd
import numpy as np
from tqdm import tqdm, trange
data = pd.read_csv("result.csv", encoding="latin1").fillna(method="ffill")
print(data.tail(10))
class SentenceGetter(object):
def __init__(self, data):
self.n_sent = 1
self.data = data
self.empty = False
agg_func ... | [
"seqeval.metrics.accuracy_score",
"torch.utils.data.RandomSampler",
"numpy.argmax",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"joblib.dump",
"torch.cuda.device_count",
"torch.utils.data.TensorDataset",
"torch.no_grad",
"torch.utils.data.DataLoader",
"torch.utils.data.Sequent... | [((1670, 1695), 'torch.cuda.device_count', 'torch.cuda.device_count', ([], {}), '()\n', (1693, 1695), False, 'import torch\n'), ((1745, 1814), 'transformers.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['"""bert-base-cased"""'], {'do_lower_case': '(False)'}), "('bert-base-cased', do_lower_case=Fals... |
import arcade
import random
import string
from interface import Interface, SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE
from sprite import Sprite
class HerrVille(Interface):
def __init__(self):
super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, f"{SCREEN_TITLE} - HerrVille", arcade.color.GRAY)
self.npc_li... | [
"sprite.Sprite",
"arcade.run",
"arcade.start_render",
"random.choice",
"arcade.check_for_collision_with_list",
"random.randrange",
"arcade.SpriteList"
] | [((1566, 1578), 'arcade.run', 'arcade.run', ([], {}), '()\n', (1576, 1578), False, 'import arcade\n'), ((405, 424), 'arcade.SpriteList', 'arcade.SpriteList', ([], {}), '()\n', (422, 424), False, 'import arcade\n'), ((1030, 1051), 'arcade.start_render', 'arcade.start_render', ([], {}), '()\n', (1049, 1051), False, 'impo... |
import unittest
import subprocess
import sys
from jaxdax import core
from absl import logging
from absl.testing import absltest, parameterized
from jax._src import test_util as jtu
from jax._src.util import partial
import jax.numpy as jnp
import numpy as np
import jax
import builtins
def f(x, lib=core):
y = li... | [
"unittest.skipIf",
"subprocess.run",
"jax.vmap",
"absl.logging.use_absl_handler",
"jax._src.util.partial",
"jaxdax.core.vmap",
"absl.logging.info",
"numpy.arange",
"jax._src.test_util.JaxTestLoader",
"jax._src.test_util.skip_on_devices",
"absl.logging.set_verbosity"
] | [((871, 938), 'unittest.skipIf', 'unittest.skipIf', (['(not sys.executable)', '"""test requires sys.executable"""'], {}), "(not sys.executable, 'test requires sys.executable')\n", (886, 938), False, 'import unittest\n'), ((942, 975), 'jax._src.test_util.skip_on_devices', 'jtu.skip_on_devices', (['"""gpu"""', '"""tpu"""... |
# the modules to be used
import requests
import tkinter.messagebox
from tkinter import *
from bs4 import BeautifulSoup
# the main window variable
root = Tk()
# function built for exiting
def exit_sys():
root.quit()
# the about at main menu
def about():
tkinter.messagebox.showinfo('crawler' ,"a cra... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((885, 902), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (897, 902), False, 'import requests\n'), ((946, 986), 'bs4.BeautifulSoup', 'BeautifulSoup', (['plain_text', '"""html.parser"""'], {}), "(plain_text, 'html.parser')\n", (959, 986), False, 'from bs4 import BeautifulSoup\n')] |
import json
data = {
"cloudgateConfig": {
"bootstrap": {
"externalIdUrl": "https://idcs-7b8fa955e5b74490b65e1a967f9b1848.identity.c9dev1.oc9qadev.com",
"callbackPrefix": "http://den02mpu.us.oracle.com:7777/oauth/callback",
"oauthClientId": "67f6f89271294206ac10efe... | [
"json.dump",
"json.load"
] | [((794, 817), 'json.load', 'json.load', (['"""cloud.json"""'], {}), "('cloud.json')\n", (803, 817), False, 'import json\n'), ((756, 780), 'json.dump', 'json.dump', (['data', 'outfile'], {}), '(data, outfile)\n', (765, 780), False, 'import json\n')] |
import pwn
pwn.context.arch = 'amd64'
# sh = pwn.remote('chal.cybersecurityrumble.de', 1990)
sh = pwn.remote('127.0.0.1', 1990)
# sh = pwn.process('./babypwn')
def inject_shellcode():
# Target: 120 bytes
# 8 bytes: (fake input)
# 1 byte: (null to fool strlen)
# 111 bytes: (no ops)
# ---
# 8 ... | [
"pwn.remote",
"pwn.p64"
] | [((100, 129), 'pwn.remote', 'pwn.remote', (['"""127.0.0.1"""', '(1990)'], {}), "('127.0.0.1', 1990)\n", (110, 129), False, 'import pwn\n'), ((568, 578), 'pwn.p64', 'pwn.p64', (['(3)'], {}), '(3)\n', (575, 578), False, 'import pwn\n'), ((596, 627), 'pwn.p64', 'pwn.p64', (['(buffer_addr + 128 + 16)'], {}), '(buffer_addr ... |
import sys
try:
from _operator import index
except ImportError:
pass # for tests only
def factorial(x):
"""factorial(x) -> Integral
"Find x!. Raise a ValueError if x is negative or non-integral."""
if isinstance(x, float):
fl = int(x)
if fl != x:
raise ValueError("... | [
"_operator.index"
] | [((1280, 1288), '_operator.index', 'index', (['x'], {}), '(x)\n', (1285, 1288), False, 'from _operator import index\n'), ((1302, 1310), '_operator.index', 'index', (['y'], {}), '(y)\n', (1307, 1310), False, 'from _operator import index\n')] |
# Generated by Django 3.0.6 on 2020-10-05 09:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('meds', '0007_auto_20201005_0017'),
]
operations = [
migrations.AddField(
model_name='prescription',
name='dosage_reg... | [
"django.db.models.IntegerField",
"django.db.models.FloatField"
] | [((345, 375), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(1)'}), '(default=1)\n', (364, 375), False, 'from django.db import migrations, models\n'), ((535, 563), 'django.db.models.FloatField', 'models.FloatField', ([], {'default': '(1)'}), '(default=1)\n', (552, 563), False, 'from django.d... |
"""
Basic state machine for ARI channels.
The principle is very simple: On entering a state, :meth:`State.run` is
called. Exiting the state passes control back to the caller. If the channel
hangs up, a :class:`ChannelExit` exception is raised.
"""
import functools
import inspect
import logging
import math
from concur... | [
"inspect.iscoroutinefunction",
"functools.partial",
"anyio.create_lock",
"anyio.sleep",
"anyio.get_cancelled_exc_class",
"logging.getLogger",
"anyio.create_task_group",
"anyio.move_on_after",
"anyio.current_time",
"concurrent.futures.CancelledError",
"functools.wraps",
"inspect.iscoroutine",
... | [((599, 626), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (616, 626), False, 'import logging\n'), ((1852, 1873), 'functools.wraps', 'functools.wraps', (['proc'], {}), '(proc)\n', (1867, 1873), False, 'import functools\n'), ((2020, 2053), 'inspect.iscoroutinefunction', 'inspect.iscorout... |
import discord
import asyncio
import sys
import pathlib
async def connect_stdin_stdout():
loop = asyncio.get_event_loop()
reader = asyncio.StreamReader()
protocol = asyncio.StreamReaderProtocol(reader)
dummy = asyncio.Protocol()
await loop.connect_read_pipe(lambda: protocol, sys.stdin)
w_transp... | [
"asyncio.get_event_loop",
"asyncio.StreamReader",
"asyncio.StreamWriter",
"pathlib.Path",
"asyncio.Protocol",
"asyncio.StreamReaderProtocol"
] | [((102, 126), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (124, 126), False, 'import asyncio\n'), ((140, 162), 'asyncio.StreamReader', 'asyncio.StreamReader', ([], {}), '()\n', (160, 162), False, 'import asyncio\n'), ((178, 214), 'asyncio.StreamReaderProtocol', 'asyncio.StreamReaderProtocol', ... |
#! /usr/bin/env python
#################################################################
#filter_bracken_out.py allows users to filter Bracken output files
#Copyright (C) 2019 <NAME>, <EMAIL>
#
#
#Copyright 2019 <NAME>
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of
#this software an... | [
"sys.stdout.write",
"sys.stderr.write",
"argparse.ArgumentParser"
] | [((2262, 2287), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2285, 2287), False, 'import os, sys, argparse\n'), ((3796, 3867), 'sys.stdout.write', 'sys.stdout.write', (["('>> Reading Bracken output file: %s\\n' % args.in_file)"], {}), "('>> Reading Bracken output file: %s\\n' % args.in_file)... |
# -*- coding: utf-8 -*-
"""have a nice day.
@author: Khan
@contact:
@time: 2020/10/27 19:00
@file: ciyun.py
@desc:
"""
#coding:utf-8
import os
import jieba
import wordcloud
import chardet
import imageio
def ciyun(key):
w=wordcloud.WordCloud(width=1000,height=700,background_color='white',font_path='msyh.ttc'... | [
"wordcloud.WordCloud",
"jieba.lcut"
] | [((233, 338), 'wordcloud.WordCloud', 'wordcloud.WordCloud', ([], {'width': '(1000)', 'height': '(700)', 'background_color': '"""white"""', 'font_path': '"""msyh.ttc"""', 'scale': '(15)'}), "(width=1000, height=700, background_color='white',\n font_path='msyh.ttc', scale=15)\n", (252, 338), False, 'import wordcloud\n... |
#!/usr/bin/env python3
# Copyright 2020 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"re.search",
"sys.exit"
] | [((806, 818), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-1)\n', (814, 818), False, 'import sys\n'), ((3105, 3132), 're.search', 're.search', (['RECT_REGEX', 'line'], {}), '(RECT_REGEX, line)\n', (3114, 3132), False, 'import re\n')] |
import json
def extract_amount(dirpath):
with open(f'{dirpath}/ocr.json','r') as f:
data = json.load(f)
blocks = data['Blocks']
#The prices mostly occur in the same line as these words towards the end of the ocr, so we can use it to find them.
substring = ["DEBIT", "Purchass", "CREDIT", "Credit", "... | [
"json.load"
] | [((104, 116), 'json.load', 'json.load', (['f'], {}), '(f)\n', (113, 116), False, 'import json\n')] |
from urllib.parse import quote
from django import template
from django.urls import reverse
from dataworkspace.apps.datasets.utils import get_sql_snippet
register = template.Library()
@register.filter
def get_item(dictionary, key):
return dictionary.get(key)
@register.filter
def format_duration(milli_seconds,... | [
"django.urls.reverse",
"urllib.parse.quote",
"django.template.Library",
"dataworkspace.apps.datasets.utils.get_sql_snippet"
] | [((167, 185), 'django.template.Library', 'template.Library', ([], {}), '()\n', (183, 185), False, 'from django import template\n'), ((1403, 1428), 'django.urls.reverse', 'reverse', (['"""explorer:index"""'], {}), "('explorer:index')\n", (1410, 1428), False, 'from django.urls import reverse\n'), ((1552, 1577), 'django.u... |
import random
import googlesearch
import requests
from requests.api import get
from bs4 import BeautifulSoup
import pandas as pd
import ssl
from html_cleaner import cleanhtml
ssl._create_default_https_context = ssl._create_unverified_context
def search_engine_result(query):
'''
input: query = give your que... | [
"pandas.DataFrame",
"googlesearch.search",
"requests.get",
"bs4.BeautifulSoup",
"html_cleaner.cleanhtml"
] | [((677, 714), 'googlesearch.search', 'googlesearch.search', (['query'], {'lang': '"""de"""'}), "(query, lang='de')\n", (696, 714), False, 'import googlesearch\n'), ((1420, 1437), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1432, 1437), False, 'import requests\n'), ((1515, 1557), 'bs4.BeautifulSoup', 'Bea... |
import discord_self_embed
shortener = discord_self_embed.utils.Shortener("YOUR_BITLY_API_TOKEN")
embed = discord_self_embed.Embed("discord.py-self_embed", description="A way for selfbots to send embeds again.", colour="ff0000", url="https://github.com/bentettmar/discord.py-self_embed")
embed.set_author("<NAME>")
url... | [
"discord_self_embed.utils.Shortener",
"discord_self_embed.Embed"
] | [((39, 97), 'discord_self_embed.utils.Shortener', 'discord_self_embed.utils.Shortener', (['"""YOUR_BITLY_API_TOKEN"""'], {}), "('YOUR_BITLY_API_TOKEN')\n", (73, 97), False, 'import discord_self_embed\n'), ((107, 298), 'discord_self_embed.Embed', 'discord_self_embed.Embed', (['"""discord.py-self_embed"""'], {'descriptio... |
# -*- coding: utf-8 -*-
"""
#------------------------------------------------------------------------------#
# #
# Project Name : Atmosphere&Ocean #
# ... | [
"os.remove",
"wrf.pvo",
"numpy.ones",
"numpy.shape",
"pyresample.geometry.SwathDefinition",
"glob.glob",
"netCDF4.Dataset",
"numpy.meshgrid",
"wrf.getvar",
"netCDF4.MFDataset",
"datetime.datetime.now",
"numpy.size",
"netCDF4.MFTime",
"datetime.datetime.strptime",
"wrf.interplevel",
"xa... | [((3536, 3578), 'wrf.getvar', 'wrf.getvar', (['nc_ls', 'var_name'], {'method': '"""join"""'}), "(nc_ls, var_name, method='join')\n", (3546, 3578), False, 'import wrf\n'), ((3823, 3860), 'wrf.getvar', 'wrf.getvar', (['nc_ls', '"""U"""'], {'method': '"""join"""'}), "(nc_ls, 'U', method='join')\n", (3833, 3860), False, 'i... |
"""
@author: <NAME>, UvA
Aim: apply Random Forest for classifying segments into given vegetation classes
Input: path of polygon with segment related features + label
Output: accuracy report, feature importance, classified shapefile
Example usage (from command line):
ToDo:
1. automatize feature_list definition
"""... | [
"imblearn.under_sampling.RandomUnderSampler",
"sklearn.cross_validation.train_test_split",
"sklearn.ensemble.RandomForestClassifier",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"argparse.ArgumentParser",
"numpy.concatenate",
"numpy.array2string",
"sklearn.metrics.classification_report",
... | [((1710, 1735), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1733, 1735), False, 'import argparse\n'), ((2015, 2068), 'geopandas.GeoDataFrame.from_file', 'gpd.GeoDataFrame.from_file', (['(args.path + args.segments)'], {}), '(args.path + args.segments)\n', (2041, 2068), True, 'import geopanda... |
import time
import os
title = input("标题(尽量使用字母而非汉字或其它字符): ")
ftitleList = title.split()
ftitle = ""
for i in range(0,len(ftitleList)):
temp = ftitleList[i]
if i != (len(ftitleList) - 1):
ftitle = ftitle + temp + "-"
else:
ftitle = ftitle + temp
t = time.strftime("%Y-%m-%d",time.localtime()... | [
"time.localtime"
] | [((304, 320), 'time.localtime', 'time.localtime', ([], {}), '()\n', (318, 320), False, 'import time\n')] |
import numpy as onp
import scipy.sparse
import scipy.sparse.linalg as spalg
from veros import logger, veros_kernel, veros_routine, distributed, runtime_state as rst
from veros.variables import allocate
from veros.core.operators import update, at, numpy as npx
from veros.core.external.solvers.base import LinearSolver
f... | [
"veros.variables.allocate",
"veros.core.operators.numpy.where",
"veros.distributed.scatter",
"veros.core.external.poisson_matrix.assemble_poisson_matrix",
"numpy.asarray",
"veros.core.operators.numpy.empty_like",
"scipy.sparse.linalg.bicgstab",
"veros.logger.warning",
"scipy.sparse.linalg.LinearOper... | [((430, 588), 'veros.veros_routine', 'veros_routine', ([], {'local_variables': "('hu', 'hv', 'hvr', 'hur', 'dxu', 'dxt', 'dyu', 'dyt', 'cosu', 'cost',\n 'isle_boundary_mask', 'maskT')", 'dist_safe': '(False)'}), "(local_variables=('hu', 'hv', 'hvr', 'hur', 'dxu', 'dxt',\n 'dyu', 'dyt', 'cosu', 'cost', 'isle_bound... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from pointnet2_utils import furthest_point_sample as farthest_point_sample_cuda
from pointnet2_utils import gather_operation as index_points_cuda_transpose
from pointnet2_utils import grouping_operation as grouping_operation_cuda
from pointnet2_utils i... | [
"torch.nn.ReLU",
"knn_cuda.KNN",
"torch.nn.ModuleList",
"pointnet2_utils.furthest_point_sample",
"pointnet2_utils.gather_operation",
"torch.nn.Conv2d",
"torch.cat",
"torch.nn.Conv1d",
"torch.nn.BatchNorm1d",
"torch.nn.BatchNorm2d",
"torch.max",
"torch.cuda.empty_cache"
] | [((677, 717), 'pointnet2_utils.gather_operation', 'index_points_cuda_transpose', (['points', 'idx'], {}), '(points, idx)\n', (704, 717), True, 'from pointnet2_utils import gather_operation as index_points_cuda_transpose\n'), ((1218, 1247), 'knn_cuda.KNN', 'KNN', ([], {'k': 'k', 'transpose_mode': '(True)'}), '(k=k, tran... |
#!/usr/bin/env python3
# collections --
import re
import sys
import time
import requests
from bs4 import BeautifulSoup
import pandas as pd
# constants --
from .constant import SHARPCOLLECTION
from .constant import SHARPCOLLECTION_LIST
# dataframe class --
class Format_DataFrame:
""" format dataframe output -- ""... | [
"pandas.DataFrame",
"re.search",
"requests.get",
"bs4.BeautifulSoup",
"pandas.set_option",
"sys.exit"
] | [((509, 577), 'pandas.DataFrame', 'pd.DataFrame', (["{'Executable Name': self.e, 'Repository Link': self.l}"], {}), "({'Executable Name': self.e, 'Repository Link': self.l})\n", (521, 577), True, 'import pandas as pd\n'), ((621, 660), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', 'None'], {}), "('di... |
from aws_cdk import (
core,
aws_lambda as _lambda,
aws_iam as _iam
)
class SimpleLambda(core.Stack):
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
# Create role
lambda_role = _iam.Role(scope=self, id='cdk-lambda-role',
ass... | [
"aws_cdk.core.CfnOutput",
"aws_cdk.aws_iam.ManagedPolicy.from_aws_managed_policy_name",
"aws_cdk.aws_lambda.Code.asset",
"aws_cdk.core.App",
"aws_cdk.aws_iam.ServicePrincipal"
] | [((1219, 1229), 'aws_cdk.core.App', 'core.App', ([], {}), '()\n', (1227, 1229), False, 'from aws_cdk import core, aws_lambda as _lambda, aws_iam as _iam\n'), ((1136, 1211), 'aws_cdk.core.CfnOutput', 'core.CfnOutput', ([], {'scope': 'self', 'id': '"""cdk-output"""', 'value': 'cdk_lambda.function_name'}), "(scope=self, i... |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import print_function, absolute_import, unicode_literals
import json
import logging
from osbs.utils import graceful_chain_ge... | [
"osbs.utils.graceful_chain_get",
"json.loads",
"logging.getLogger"
] | [((500, 527), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (517, 527), False, 'import logging\n'), ((1719, 1768), 'osbs.utils.graceful_chain_get', 'graceful_chain_get', (['self.json', '"""metadata"""', '"""name"""'], {}), "(self.json, 'metadata', 'name')\n", (1737, 1768), False, 'from o... |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.conf import settings
from django.views import View
from django.http import HttpResponse
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from vs_listener.models i... | [
"django.utils.decorators.method_decorator",
"django.http.HttpResponse",
"json.loads",
"vs_listener.models.Envelope.objects.add_envelope",
"hmac.compare_digest",
"vs_listener.metrics.notification_status_counter",
"base64.b64encode",
"vs_listener.metrics.notification_invalid_counter",
"vs_listener.met... | [((551, 597), 'django.utils.decorators.method_decorator', 'method_decorator', (['csrf_exempt'], {'name': '"""dispatch"""'}), "(csrf_exempt, name='dispatch')\n", (567, 597), False, 'from django.utils.decorators import method_decorator\n'), ((855, 883), 'base64.b64encode', 'base64.b64encode', (['hash_bytes'], {}), '(hash... |
# Generated by Django 2.2.10 on 2020-02-26 15:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('condominium', '0004_auto_20200218_0813'),
]
operations = [
migrations.AlterField(
model_name='apartment',
name='is_... | [
"django.db.models.BooleanField"
] | [((347, 407), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'verbose_name': '"""Is active"""'}), "(default=False, verbose_name='Is active')\n", (366, 407), False, 'from django.db import migrations, models\n')] |
from django.conf.urls import url, include
from rest_framework import routers
from . import views
import vosi.views
import vosi.urls
app_name = 'prov_vo'
# add automatically created urls:
router = routers.DefaultRouter()
router.register(r'activities', views.ActivityViewSet)
router.register(r'entities', views.EntityV... | [
"django.conf.urls.url",
"rest_framework.routers.DefaultRouter",
"django.conf.urls.include"
] | [((200, 223), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (221, 223), False, 'from rest_framework import routers\n'), ((1129, 1199), 'django.conf.urls.url', 'url', (['"""^allprov/(?P<format>[a-zA-Z-]+)$"""', 'views.allprov'], {'name': '"""allprov"""'}), "('^allprov/(?P<format>[a-z... |
from param1 import *
from collector import *
from transform import addtrafo,addinv
# from sin import *
# from mult import *
# from value import *
import fmath
import math
class acosh(param1):
def __init__(s,p):
param1.__init__(s)
s.q=p
def diff(s,by)->'mult':
return s.q.diff(by)/fmath.sqrt(fmath.squa... | [
"math.acosh",
"transform.addinv",
"fmath.value",
"fmath.square"
] | [((808, 831), 'transform.addinv', 'addinv', (['"""cosh"""', '"""acosh"""'], {}), "('cosh', 'acosh')\n", (814, 831), False, 'from transform import addtrafo, addinv\n'), ((659, 673), 'math.acosh', 'math.acosh', (['mp'], {}), '(mp)\n', (669, 673), False, 'import math\n'), ((771, 785), 'math.acosh', 'math.acosh', (['mp'], ... |
import unittest
import pycqed as pq
import os
from pycqed.analysis import analysis_toolbox as a_tools
from pycqed.analysis_v2 import alignment_analysis as aa
import matplotlib.pyplot as plt
class Test_Alignment_Analysis(unittest.TestCase):
@classmethod
def tearDownClass(self):
plt.close('all')
@c... | [
"matplotlib.pyplot.close",
"os.path.join",
"pycqed.analysis_v2.alignment_analysis.AlignmentAnalysis"
] | [((296, 312), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (305, 312), True, 'import matplotlib.pyplot as plt\n'), ((380, 430), 'os.path.join', 'os.path.join', (['pq.__path__[0]', '"""tests"""', '"""test_data"""'], {}), "(pq.__path__[0], 'tests', 'test_data')\n", (392, 430), False, 'import ... |
from typing import List
from games.level import Level
from games.game import Game
from metrics.metric import Metric
from Levenshtein import distance as levenshtein_distance
class EditDistanceMetric(Metric):
"""This simply calculates the edit distance between levels by flattening the map.
"""
def __init__(... | [
"Levenshtein.distance"
] | [((742, 770), 'Levenshtein.distance', 'levenshtein_distance', (['sa', 'sb'], {}), '(sa, sb)\n', (762, 770), True, 'from Levenshtein import distance as levenshtein_distance\n')] |
import csv
import logging
from operator import itemgetter
from geoalchemy2 import Geometry
from shapely.geometry import Point
from sqlalchemy import Column, Numeric, String
from sqlalchemy.orm import relationship
from DB.db.managers.base_db import Database
from DB.config.fastlanes_config import FastlanesConfig
from DB... | [
"csv.reader",
"sqlalchemy.orm.relationship",
"sqlalchemy.Numeric",
"sqlalchemy.String",
"operator.itemgetter",
"pandas.concat",
"logging.getLogger",
"geoalchemy2.Geometry"
] | [((397, 424), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (414, 424), False, 'import logging\n'), ((712, 847), 'sqlalchemy.orm.relationship', 'relationship', (['"""Trip"""'], {'primaryjoin': '"""Pattern.shape_id==Trip.shape_id"""', 'foreign_keys': '"""(Pattern.shape_id)"""', 'uselist':... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Name: musicxml/helpers.py
# Purpose: Helper routines for musicxml export
#
# Authors: <NAME>
# <NAME>
#
# Copyright: Copyright © 2013-2020 <NAME> and the music21 Project
# Licens... | [
"copy.deepcopy",
"music21.mainTest",
"xml.etree.ElementTree.tostring"
] | [((1366, 1404), 'xml.etree.ElementTree.tostring', 'ET.tostring', (['xmlEl'], {'encoding': '"""unicode"""'}), "(xmlEl, encoding='unicode')\n", (1377, 1404), True, 'import xml.etree.ElementTree as ET\n'), ((5196, 5214), 'music21.mainTest', 'music21.mainTest', ([], {}), '()\n', (5212, 5214), False, 'import music21\n'), ((... |
import glob
import os
import numpy as np
from PIL import Image
import torch
import torch.utils.data as data
from configuration.base_config import BaseConfig, DataMode
class SmartSegmentationLoader(data.Dataset):
def __init__(self, config, img_files, mask_files, transforms):
super().__init__()
s... | [
"torch.randint",
"os.path.join",
"numpy.copy",
"PIL.Image.open"
] | [((1169, 1285), 'numpy.copy', 'np.copy', (['image[rand_row:rand_row + self._config.crop_size[0], rand_col:rand_col +\n self._config.crop_size[1], :]'], {}), '(image[rand_row:rand_row + self._config.crop_size[0], rand_col:\n rand_col + self._config.crop_size[1], :])\n', (1176, 1285), True, 'import numpy as np\n'),... |
from book import Book
b1 = Book('Brave New World', '<NAME>', 1225, 39.95)
b2 = Book('War and Peace', '<NAME>', 1245, 29.95)
print(b1)
print(b1.title) # title is public
print(b1.get_price())
print(b2.get_price())
b2.set_discount(0.25)
# print(b2._discount) => not an error, but you shouldn't access internal variables
... | [
"book.Book.get_book_list",
"book.Book",
"book.Book.get_book_types"
] | [((28, 74), 'book.Book', 'Book', (['"""Brave New World"""', '"""<NAME>"""', '(1225)', '(39.95)'], {}), "('Brave New World', '<NAME>', 1225, 39.95)\n", (32, 74), False, 'from book import Book\n'), ((80, 124), 'book.Book', 'Book', (['"""War and Peace"""', '"""<NAME>"""', '(1245)', '(29.95)'], {}), "('War and Peace', '<NA... |
def encode(string,level):
import base64
message = string
message_bytes = message.encode('ascii')
base64_bytes = base64.b64encode(message_bytes)
base64_message = base64_bytes.decode('ascii')
if level == 1 or 0:
return(base64_message)
else:
for i in range(level - 1... | [
"base64.b64encode",
"base64.b64decode"
] | [((134, 165), 'base64.b64encode', 'base64.b64encode', (['message_bytes'], {}), '(message_bytes)\n', (150, 165), False, 'import base64\n'), ((671, 702), 'base64.b64decode', 'base64.b64decode', (['message_bytes'], {}), '(message_bytes)\n', (687, 702), False, 'import base64\n'), ((411, 442), 'base64.b64encode', 'base64.b6... |
import numpy as np
import matplotlib.pyplot as plt
import sys, os
from scipy.special import erf
from scipy.optimize import minimize_scalar
from math import isnan
from math import isinf
from dispsol import Jpole8, Jpole12
from dispsol import ES1d
plt.rc('font', family='serif')
plt.rc('xtick', labelsize=7)
plt.rc('... | [
"matplotlib.pyplot.subplot",
"numpy.sum",
"matplotlib.pyplot.subplots_adjust",
"dispsol.ES1d",
"matplotlib.pyplot.figure",
"numpy.imag",
"numpy.array",
"matplotlib.pyplot.rc",
"matplotlib.pyplot.GridSpec",
"dispsol.Jpole12",
"numpy.linspace",
"numpy.real",
"matplotlib.pyplot.savefig",
"num... | [((252, 282), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': '"""serif"""'}), "('font', family='serif')\n", (258, 282), True, 'import matplotlib.pyplot as plt\n'), ((283, 311), 'matplotlib.pyplot.rc', 'plt.rc', (['"""xtick"""'], {'labelsize': '(7)'}), "('xtick', labelsize=7)\n", (289, 311), True, 'import... |
# 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 u... | [
"aliyunsdkcore.request.RpcRequest.__init__"
] | [((909, 979), 'aliyunsdkcore.request.RpcRequest.__init__', 'RpcRequest.__init__', (['self', '"""Ft"""', '"""2015-01-01"""', '"""RpcFlowControlPassApi"""'], {}), "(self, 'Ft', '2015-01-01', 'RpcFlowControlPassApi')\n", (928, 979), False, 'from aliyunsdkcore.request import RpcRequest\n')] |
#!/usr/bin/env python
import os
import sys
import numpy as np
import matplotlib
matplotlib.use('PDF')
from mgplottools.mpl import get_color, set_axis, new_figure, ls, \
set_color_cycle
def create_figure(outfile, sig_time, rob_jz_time, rob_stirap_time,
rob_mixed_time, sig_ampl, rob_jz_am... | [
"mgplottools.mpl.set_axis",
"mgplottools.mpl.new_figure",
"matplotlib.use",
"os.path.splitext",
"os.path.join",
"mgplottools.mpl.set_color_cycle"
] | [((80, 101), 'matplotlib.use', 'matplotlib.use', (['"""PDF"""'], {}), "('PDF')\n", (94, 101), False, 'import matplotlib\n'), ((1075, 1108), 'mgplottools.mpl.new_figure', 'new_figure', (['fig_width', 'fig_height'], {}), '(fig_width, fig_height)\n', (1085, 1108), False, 'from mgplottools.mpl import get_color, set_axis, n... |
import pygame
import sys
def ball_animation():
global ball_speed_x, ball_speed_y
# moveing the ball
ball.x += ball_speed_x
ball.y += ball_speed_y
# limiting ball to go out of boundaries of screen
if ball.top <=0 or ball.bottom >=screen_height:
ball_speed_y *= -1
if ball.left<=0 ... | [
"pygame.draw.ellipse",
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.draw.rect",
"pygame.Rect",
"pygame.Color",
"pygame.draw.aaline",
"pygame.init",
"pygame.display.flip",
"pygame.display.set_caption",
"pygame.time.Clock",
"sys.exit"
] | [((652, 665), 'pygame.init', 'pygame.init', ([], {}), '()\n', (663, 665), False, 'import pygame\n'), ((675, 694), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (692, 694), False, 'import pygame\n'), ((744, 798), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(screen_width, screen_height)'], {}),... |
#coding=utf-8
import argparse
import os
import os.path as osp
from os.path import basename
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
from tensorboardX import SummaryWriter
from tqdm import tqdm
from datasets import (
get_dataset_class,
CPDataLoader,
DATASETS)
from netw... | [
"datasets.CPDataLoader",
"argparse.ArgumentParser",
"visualization.board_add_images",
"networks.GMM",
"networks.load_checkpoint",
"torch.cat",
"torch.nn.functional.sigmoid",
"torch.nn.functional.tanh",
"torch.no_grad",
"os.path.join",
"torch.nn.functional.grid_sample",
"os.path.exists",
"net... | [((470, 549), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (493, 549), False, 'import argparse\n'), ((2080, 2112), 'os.path.basename', 'os.path.basename', (['opt.checkpoint'], {}),... |
from _Framework.ButtonElement import Color
class Blink(Color):
def __init__(self, midi_value = 0, *a, **k):
super(Blink, self).__init__(midi_value, *a, **k)
def draw(self, interface):
interface.send_value(0)
interface.send_value(self.midi_value, channel=1)
class Pulse(Color):
def __init__(self, midi_valu... | [
"_Framework.ButtonElement.Color"
] | [((519, 527), '_Framework.ButtonElement.Color', 'Color', (['(0)'], {}), '(0)\n', (524, 527), False, 'from _Framework.ButtonElement import Color\n'), ((541, 549), '_Framework.ButtonElement.Color', 'Color', (['(1)'], {}), '(1)\n', (546, 549), False, 'from _Framework.ButtonElement import Color\n'), ((558, 566), '_Framewor... |
from validator.rules import Same
from validator.rules_wrapper import RulesWrapper as RW
from validator import validate
def test_same_01():
req = {"old_pass": "password", "new_pass": "password"}
rule = {"new_pass": [Same("old_pass")]}
rw = RW(req, rule)
rw.run()
assert rw.get_result()
req = {"... | [
"validator.rules.Same",
"validator.validate",
"validator.rules_wrapper.RulesWrapper"
] | [((253, 266), 'validator.rules_wrapper.RulesWrapper', 'RW', (['req', 'rule'], {}), '(req, rule)\n', (255, 266), True, 'from validator.rules_wrapper import RulesWrapper as RW\n'), ((398, 411), 'validator.rules_wrapper.RulesWrapper', 'RW', (['req', 'rule'], {}), '(req, rule)\n', (400, 411), True, 'from validator.rules_wr... |
"""Redis storage end to end tests."""
#pylint: disable=no-self-use,protected-access,line-too-long,too-few-public-methods
import json
import os
from splitio.client.util import get_metadata
from splitio.models import splits, impressions, events
from splitio.storage.redis import RedisSplitStorage, RedisSegmentStorage, R... | [
"splitio.client.config.DEFAULT_CONFIG.copy",
"splitio.storage.redis.RedisSegmentStorage",
"json.load",
"splitio.storage.redis.RedisImpressionsStorage",
"json.loads",
"splitio.models.events.Event",
"splitio.storage.redis.RedisSplitStorage._SPLIT_KEY.format",
"splitio.storage.adapters.redis._build_defau... | [((690, 715), 'splitio.storage.adapters.redis._build_default_client', '_build_default_client', (['{}'], {}), '({})\n', (711, 715), False, 'from splitio.storage.adapters.redis import _build_default_client\n'), ((4065, 4090), 'splitio.storage.adapters.redis._build_default_client', '_build_default_client', (['{}'], {}), '... |
from osgeo import gdal
import logging
import argparse
def get_parser():
""" Return argument parser. """
parser = argparse.ArgumentParser(
description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument("raster", help="path to raster file")
return parser
... | [
"osgeo.gdal.Open",
"argparse.ArgumentParser",
"logging.basicConfig"
] | [((124, 229), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(description=__doc__, formatter_class=argparse.\n ArgumentDefaultsHelpFormatter)\n', (147, 229), False, 'import argparse\n'), ((444, 466), 'osgeo.gdal.Op... |
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2013-2014, NYU-Poly.
## All rights reserved.
## Contact: <EMAIL>
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary forms, with or wi... | [
"file_archive.hash_file",
"vistrails.core.modules.config.IPort",
"vistrails.core.debug.warning",
"vistrails.core.modules.basic_modules.PathObject",
"os.path.isdir",
"os.path.exists",
"vistrails.core.modules.config.ModuleSettings",
"datetime.datetime.utcnow",
"file_archive.hash_directory",
"os.path... | [((2399, 2418), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (2412, 2418), False, 'import os\n'), ((6281, 6384), 'vistrails.core.modules.config.ModuleSettings', 'ModuleSettings', ([], {'configure_widget': '"""vistrails.packages.persistent_archive.widgets:SetMetadataWidget"""'}), "(configure_widget=\n ... |
import glob
PAGE_TOP = r"""<html>
<head>
<title>FLINT: Fast Library for Number TheoryTITLE</title>
<style type="text/css" media="screen">
body, table { font-family: arial, sans-serif; font-size: 16px; line-height:1.4em; }
h1, h2, h3 { font-weight: normal; }
h1 { font-weight: bold; }
h2 { background-color: #eee; color:... | [
"time.gmtime"
] | [((2266, 2274), 'time.gmtime', 'gmtime', ([], {}), '()\n', (2272, 2274), False, 'from time import gmtime, strftime\n')] |
"""
Copyright BOOSTRY Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distr... | [
"sqlalchemy.String",
"sqlalchemy.Column"
] | [((923, 935), 'sqlalchemy.Column', 'Column', (['JSON'], {}), '(JSON)\n', (929, 935), False, 'from sqlalchemy import Column, JSON, String, Integer, Boolean\n'), ((1255, 1270), 'sqlalchemy.Column', 'Column', (['Integer'], {}), '(Integer)\n', (1261, 1270), False, 'from sqlalchemy import Column, JSON, String, Integer, Bool... |
from random import randint
valores = (randint(1, 10), randint(1, 10), randint(1, 10),
randint(1, 10), randint(1, 10), )
print('\nOs valores sorteados foram: ', end='')
for v in valores:
print(f'{v} ', end='')
print(f'\n\nO maior valor sorteado foi {max(valores)}')
print(f'O menor valor sorteado foi {min... | [
"random.randint"
] | [((39, 53), 'random.randint', 'randint', (['(1)', '(10)'], {}), '(1, 10)\n', (46, 53), False, 'from random import randint\n'), ((55, 69), 'random.randint', 'randint', (['(1)', '(10)'], {}), '(1, 10)\n', (62, 69), False, 'from random import randint\n'), ((71, 85), 'random.randint', 'randint', (['(1)', '(10)'], {}), '(1,... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... | [
"ansible_collections.oracle.oci.plugins.module_utils.oci_common_utils.get_common_arg_spec",
"ansible.module_utils.basic.AnsibleModule",
"ansible_collections.oracle.oci.plugins.module_utils.oci_resource_utils.get_custom_class"
] | [((3924, 3972), 'ansible_collections.oracle.oci.plugins.module_utils.oci_resource_utils.get_custom_class', 'get_custom_class', (['"""EventReportFactsHelperCustom"""'], {}), "('EventReportFactsHelperCustom')\n", (3940, 3972), False, 'from ansible_collections.oracle.oci.plugins.module_utils.oci_resource_utils import OCIR... |
#/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
blog.urls
~~~~~~~~~~~~~~
url patterns for editor
:copyright: (c) 2016 by zifeiyu.
:license: MIT, see LICENSE for more details.
"""
from django.conf.urls import url, include
from .import views
app_name = 'editor'
urlpatterns = [
url(r'^preview... | [
"django.conf.urls.url"
] | [((306, 353), 'django.conf.urls.url', 'url', (['"""^preview$"""', 'views.preview'], {'name': '"""preview"""'}), "('^preview$', views.preview, name='preview')\n", (309, 353), False, 'from django.conf.urls import url, include\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Code for reading and working with calibration data.
Author <NAME>, 2019
Author <NAME>, 2019
"""
import cv2
import numpy as np
import os
from typing import Tuple, List
from enum import Enum
import yaml
import functools
from libartipy.dataset import Constants, ... | [
"yaml.load",
"numpy.abs",
"numpy.floor",
"cv2.remap",
"os.path.join",
"numpy.zeros_like",
"os.path.exists",
"numpy.transpose",
"numpy.loadtxt",
"libartipy.dataset.Constants",
"functools.wraps",
"cv2.fisheye.stereoRectify",
"cv2.fisheye.initUndistortRectifyMap",
"libartipy.dataset.get_logge... | [((381, 393), 'libartipy.dataset.get_logger', 'get_logger', ([], {}), '()\n', (391, 393), False, 'from libartipy.dataset import Constants, get_logger\n'), ((581, 602), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (596, 602), False, 'import functools\n'), ((2896, 2905), 'numpy.eye', 'np.eye', (['(3)... |
import glob
import hashlib
import multiprocessing
import os
import shutil
import tempfile
import zipfile
import random
import click
import sc2reader
from sc2creativity import utils
CPUS = max(1, multiprocessing.cpu_count() - 2)
MAX_REPLAYS = 100000
@click.command()
@click.option("--replay-id")
@click.option("--out... | [
"zipfile.ZipFile",
"os.unlink",
"os.path.basename",
"random.shuffle",
"click.option",
"click.command",
"sc2reader.load_replay",
"hashlib.sha256",
"sc2creativity.utils.data_dir",
"multiprocessing.Pool",
"shutil.copyfileobj",
"shutil.copy",
"multiprocessing.cpu_count"
] | [((255, 270), 'click.command', 'click.command', ([], {}), '()\n', (268, 270), False, 'import click\n'), ((272, 299), 'click.option', 'click.option', (['"""--replay-id"""'], {}), "('--replay-id')\n", (284, 299), False, 'import click\n'), ((301, 335), 'click.option', 'click.option', (['"""--output-directory"""'], {}), "(... |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name="PutioMount",
version="2",
description="Mount put.io as a local drive",
author="<NAME>",
keywords="put.io mount fuse",
packages=find_packages(),
license="MIT",
url="https://github.com/gpenverne/putio-mount",
... | [
"setuptools.find_packages"
] | [((232, 247), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (245, 247), False, 'from setuptools import setup, find_packages\n')] |
"""
=========================
Fit exotic Hawkes kernels
=========================
This learner assumes Hawkes kernels are linear combinations of a given number
of kernel basis.
Here it is run on a an exotic data set generated with mixtures of two cosinus
functions. We observe that we can correctly retrieve the kernel... | [
"tick.hawkes.HawkesBasisKernels",
"tick.hawkes.SimuHawkes",
"matplotlib.pyplot.show",
"numpy.linspace",
"numpy.cos",
"tick.hawkes.HawkesKernelTimeFunc",
"tick.plot.plot_hawkes_kernels",
"tick.plot.plot_basis_kernels"
] | [((1044, 1068), 'numpy.linspace', 'np.linspace', (['(0)', '(20)', '(1000)'], {}), '(0, 20, 1000)\n', (1055, 1068), True, 'import numpy as np\n'), ((1215, 1276), 'tick.hawkes.SimuHawkes', 'SimuHawkes', ([], {'baseline': '[1e-05, 1e-05]', 'seed': '(1093)', 'verbose': '(False)'}), '(baseline=[1e-05, 1e-05], seed=1093, ver... |
# Copyright (c) Meta Platforms, Inc
import math
from typing import Optional
import torch
import torch.distributions.constraints as constraints
import torch.nn.functional as F
from flowtorch.bijectors.fixed import Fixed
class Tanh(Fixed):
r"""
Transform via the mapping :math:`y = \tanh(x)`.
"""
codom... | [
"torch.distributions.constraints.interval",
"torch.nn.functional.softplus",
"math.log",
"torch.atanh",
"torch.tanh"
] | [((326, 357), 'torch.distributions.constraints.interval', 'constraints.interval', (['(-1.0)', '(1.0)'], {}), '(-1.0, 1.0)\n', (346, 357), True, 'import torch.distributions.constraints as constraints\n'), ((502, 515), 'torch.tanh', 'torch.tanh', (['x'], {}), '(x)\n', (512, 515), False, 'import torch\n'), ((702, 716), 't... |
import numpy as np
import scipy
from scipy import interpolate
from scipy.interpolate import interp1d
#configure paremeter
K = 64 # number of OFDM subcarriers
CP = K//4 # length of the cyclic prefix: 25% of the block
P = 8 # number of pilot carriers per OFDM block
pilotValue = 3+3j # The known value each pilot transmi... | [
"numpy.fft.ifft",
"numpy.random.binomial",
"numpy.random.randn",
"numpy.fft.fft",
"numpy.angle",
"numpy.zeros",
"numpy.hstack",
"numpy.append",
"scipy.interpolate.interp1d",
"numpy.array",
"numpy.arange",
"numpy.exp",
"numpy.convolve",
"numpy.conjugate",
"numpy.delete",
"numpy.vstack",... | [((338, 350), 'numpy.arange', 'np.arange', (['K'], {}), '(K)\n', (347, 350), True, 'import numpy as np\n'), ((764, 801), 'numpy.delete', 'np.delete', (['allCarriers', 'pilotCarriers'], {}), '(allCarriers, pilotCarriers)\n', (773, 801), True, 'import numpy as np\n'), ((1394, 1422), 'numpy.array', 'np.array', (['[1, 0, 0... |
# coding=utf-8
import os
import time
import json
from pocounit.result.logger import StreamLogger
class PocoResultCollector(object):
def __init__(self, project_root, testcases_filenames, testcase_name, testcase_dir='.',
logfilename='poco-result.log',
metainfofilename='metainfo.t... | [
"os.path.isabs",
"os.makedirs",
"os.path.basename",
"os.path.exists",
"json.dumps",
"time.time",
"os.path.isfile",
"os.path.relpath",
"os.path.join"
] | [((803, 828), 'os.path.join', 'os.path.join', (['*root_paths'], {}), '(*root_paths)\n', (815, 828), False, 'import os\n'), ((840, 865), 'os.path.isfile', 'os.path.isfile', (['self.root'], {}), '(self.root)\n', (854, 865), False, 'import os\n'), ((1638, 1673), 'os.path.relpath', 'os.path.relpath', (['respath', 'self.roo... |
from django.db import models
from .managers import PostManager, ImageManager
from unixtimestampfield.fields import UnixTimeStampField
# Create your models here.
class Post(models.Model):
created_at = UnixTimeStampField(auto_now_add=True, use_numeric=True)
title = models.CharField(max_length=100)
content =... | [
"django.db.models.TextField",
"django.db.models.OneToOneField",
"django.db.models.URLField",
"django.db.models.CharField",
"unixtimestampfield.fields.UnixTimeStampField"
] | [((206, 261), 'unixtimestampfield.fields.UnixTimeStampField', 'UnixTimeStampField', ([], {'auto_now_add': '(True)', 'use_numeric': '(True)'}), '(auto_now_add=True, use_numeric=True)\n', (224, 261), False, 'from unixtimestampfield.fields import UnixTimeStampField\n'), ((274, 306), 'django.db.models.CharField', 'models.C... |
from pydub import AudioSegment
import numpy as np
from scipy.io import wavfile
import os
import pandas as pd
from utils import load_config,get_now
import glob
from concurrent.futures import ProcessPoolExecutor
class RandomSampleDataset:
"""
This class produce a base procedure of making the dataset.
""... | [
"pandas.DataFrame",
"os.makedirs",
"os.path.exists",
"scipy.io.wavfile.write",
"utils.get_now",
"os.cpu_count",
"utils.load_config",
"parsers.get_preprocess_parser",
"pydub.AudioSegment.from_file",
"os.path.split",
"os.path.join"
] | [((2660, 2683), 'parsers.get_preprocess_parser', 'get_preprocess_parser', ([], {}), '()\n', (2681, 2683), False, 'from parsers import get_preprocess_parser\n'), ((2744, 2773), 'utils.load_config', 'load_config', (['args.config_file'], {}), '(args.config_file)\n', (2755, 2773), False, 'from utils import load_config, get... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Database 接続用
#
from eyed.model import TaskGroup
from eyed.db import SessionFactory
#
# BACnet Daemon Instance
#
from eyed.single import SingleScheduler
#
# TaskGroup の 追加
#
def addTaskGroup(name, interval):
#
# タスクグループの追加
#
sched = SingleScheduler.getInstance()
... | [
"eyed.single.SingleScheduler.getInstance",
"eyed.db.SessionFactory"
] | [((289, 318), 'eyed.single.SingleScheduler.getInstance', 'SingleScheduler.getInstance', ([], {}), '()\n', (316, 318), False, 'from eyed.single import SingleScheduler\n'), ((419, 435), 'eyed.db.SessionFactory', 'SessionFactory', ([], {}), '()\n', (433, 435), False, 'from eyed.db import SessionFactory\n')] |
# coding: utf-8
import os
import sys
import tempfile
import shutil
import subprocess as sp
import multiprocessing
# Import the console machinery from ipython
from qtconsole.rich_ipython_widget import RichJupyterWidget
from qtconsole.inprocess import QtInProcessKernelManager
from IPython.lib import guisupport
import c... | [
"qtconsole.inprocess.QtInProcessKernelManager",
"IPython.lib.guisupport.get_app_qt4"
] | [((844, 870), 'qtconsole.inprocess.QtInProcessKernelManager', 'QtInProcessKernelManager', ([], {}), '()\n', (868, 870), False, 'from qtconsole.inprocess import QtInProcessKernelManager\n'), ((1185, 1209), 'IPython.lib.guisupport.get_app_qt4', 'guisupport.get_app_qt4', ([], {}), '()\n', (1207, 1209), False, 'from IPytho... |
import objectpath
import json
import glob
class DataQuery:
tree = None
def __init__(self, json_data):
self.tree = objectpath.Tree(json_data)
def queryObjectTree(self, json_query):
results = list(self.tree.execute(json_query))
print("Results ", results,flush=True)
return... | [
"json.load",
"objectpath.Tree"
] | [((133, 159), 'objectpath.Tree', 'objectpath.Tree', (['json_data'], {}), '(json_data)\n', (148, 159), False, 'import objectpath\n'), ((1401, 1413), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1410, 1413), False, 'import json\n')] |
import pygame
from pacstructs import *
from pacfuncs import *
import time
# Define some colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
score = 0
pygame.init()
# Set the width and height of the screen [width, height]
size = (608, 608)
screen = pygame.display.... | [
"pygame.quit",
"pygame.font.SysFont",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.init",
"time.time",
"pygame.display.flip",
"pygame.image.load",
"pygame.display.set_caption",
"pygame.time.Clock"
] | [((201, 214), 'pygame.init', 'pygame.init', ([], {}), '()\n', (212, 214), False, 'import pygame\n'), ((305, 334), 'pygame.display.set_mode', 'pygame.display.set_mode', (['size'], {}), '(size)\n', (328, 334), False, 'import pygame\n'), ((339, 376), 'pygame.display.set_caption', 'pygame.display.set_caption', (['"""Pac-Ma... |
import re
import emoji
from bson.objectid import ObjectId
from loguru import logger
from src import constants
from src.bot import bot
from src.constants import (inline_keys, keyboards, post_status, post_types,
states)
from src.data import DATA_DIR
from src.data_models.base import BasePost
fr... | [
"bson.objectid.ObjectId",
"src.user.User",
"loguru.logger.warning",
"emoji.emojize",
"re.match",
"src.constants.GALLERY_NO_POSTS_MESSAGE.format",
"src.utils.keyboard.create_keyboard",
"src.data_models.base.BasePost",
"src.bot.bot.callback_query_handler",
"src.constants.POST_START_MESSAGE.format",
... | [((2195, 2273), 'src.bot.bot.callback_query_handler', 'bot.callback_query_handler', ([], {'func': '(lambda call: call.data == inline_keys.actions)'}), '(func=lambda call: call.data == inline_keys.actions)\n', (2221, 2273), False, 'from src.bot import bot\n'), ((2877, 2982), 'src.bot.bot.callback_query_handler', 'bot.ca... |
from dataclasses import dataclass, field
from typing import List, Optional
__NAMESPACE__ = "http://www.opengis.net/gml"
@dataclass
class MeasureListType:
"""List of numbers with a uniform scale.
The value of uom (Units Of Measure) attribute is a reference to a
Reference System for the amount, either a r... | [
"dataclasses.field"
] | [((378, 432), 'dataclasses.field', 'field', ([], {'default_factory': 'list', 'metadata': "{'tokens': True}"}), "(default_factory=list, metadata={'tokens': True})\n", (383, 432), False, 'from dataclasses import dataclass, field\n'), ((504, 573), 'dataclasses.field', 'field', ([], {'default': 'None', 'metadata': "{'type'... |
# Copyright 2021 University College London. 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 appl... | [
"tensorflow.keras.utils.register_keras_serializable"
] | [((891, 948), 'tensorflow.keras.utils.register_keras_serializable', 'tf.keras.utils.register_keras_serializable', ([], {'package': '"""MRI"""'}), "(package='MRI')\n", (933, 948), True, 'import tensorflow as tf\n'), ((2545, 2602), 'tensorflow.keras.utils.register_keras_serializable', 'tf.keras.utils.register_keras_seria... |
import functools
import pickle
import torch
import numpy as np
def get_labels_stats(labels):
labels_set = torch.unique(labels).numpy().tolist()
num_labels = len(labels_set)
n_sample_per_label = labels.shape[0] // num_labels
return num_labels, n_sample_per_label
def data_subset(data, labels, n_way, wa... | [
"numpy.stack",
"torch.unique",
"torch.LongTensor",
"torch.load",
"torch.cat",
"pickle.load",
"numpy.array",
"functools.lru_cache",
"numpy.concatenate"
] | [((2656, 2677), 'functools.lru_cache', 'functools.lru_cache', ([], {}), '()\n', (2675, 2677), False, 'import functools\n'), ((858, 887), 'torch.cat', 'torch.cat', (['subset_data'], {'dim': '(0)'}), '(subset_data, dim=0)\n', (867, 887), False, 'import torch\n'), ((908, 939), 'torch.cat', 'torch.cat', (['subset_labels'],... |
# -*- coding: utf-8 -*-
"""TcEx Playbook Test Case module"""
import traceback
from six import string_types
from .test_case_playbook_common import TestCasePlaybookCommon
class TestCasePlaybook(TestCasePlaybookCommon):
"""Playbook TestCase Class"""
def run(self, args): # pylint: disable=too-many-return-statem... | [
"traceback.format_exc"
] | [((1847, 1869), 'traceback.format_exc', 'traceback.format_exc', ([], {}), '()\n', (1867, 1869), False, 'import traceback\n')] |
# Generated by Django 3.2.9 on 2021-11-16 06:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0018_alter_order_status'),
]
operations = [
migrations.AlterField(
model_name='order',
name='note',
... | [
"django.db.models.CharField"
] | [((334, 390), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(1000)', 'null': '(True)'}), '(blank=True, max_length=1000, null=True)\n', (350, 390), False, 'from django.db import migrations, models\n')] |
_Z='keys'
_Y='box_settings'
_X='default_box_attr'
_W='Box is frozen'
_V='modify_tuples_box'
_U='box_safe_prefix'
_T='default_box_none_transform'
_S='__created'
_R='box_dots'
_Q='box_duplicates'
_P='ignore'
_O='.'
_N='strict'
_M='box_recast'
_L='box_intact_types'
_K='default_box'
_J='_'
_I='utf-8'
_H='_box_config'
_G=Tr... | [
"dynaconf.vendor.box.BoxList",
"copy.deepcopy",
"warnings.warn",
"re.compile"
] | [((841, 871), 're.compile', 're.compile', (['"""(.)([A-Z][a-z]+)"""'], {}), "('(.)([A-Z][a-z]+)')\n", (851, 871), False, 'import copy, re, string, warnings\n'), ((884, 915), 're.compile', 're.compile', (['"""([a-z0-9])([A-Z])"""'], {}), "('([a-z0-9])([A-Z])')\n", (894, 915), False, 'import copy, re, string, warnings\n'... |
import pytest
from detect_secrets.plugins.azure import AzureDetector
class TestAzureDetector:
@pytest.mark.parametrize(
'payload, should_flag',
[
('DefaultEndpointsProtocol=http;AccountName=account1;AccountKey=Abc1deF23gHIjkLmnOpQRStuVwxYZAB4CDeFG56hIJK7LMnoPq8RSTuVw9x0yz/A1BCDEFGhi/J... | [
"detect_secrets.plugins.azure.AzureDetector",
"pytest.mark.parametrize"
] | [((102, 1540), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""payload, should_flag"""', '[(\n \'DefaultEndpointsProtocol=http;AccountName=account1;AccountKey=Abc1deF23gHIjkLmnOpQRStuVwxYZAB4CDeFG56hIJK7LMnoPq8RSTuVw9x0yz/A1BCDEFGhi/JKLMnopqRSTu==;\'\n , 1), (\n \'DefaultEndpointsProtocol=http;Acco... |
"""Image 3D to vector / scalar conv net"""
import numpy as np
from micro_dl.networks.base_image_to_vector_net import BaseImageToVectorNet
class Image3DToVectorNet(BaseImageToVectorNet):
"""Uses 3D images as input"""
def __init__(self, network_config, predict=False):
"""Init
:param dict netw... | [
"numpy.log2"
] | [((622, 654), 'numpy.log2', 'np.log2', (["network_config['depth']"], {}), "(network_config['depth'])\n", (629, 654), True, 'import numpy as np\n')] |
from functools import reduce
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
from rpgs.models import Rpg
from .models import Member, Membership, VerificationRequest, Achievement, AchievementAward
def field_property(field_n... | [
"django.contrib.admin.site.register",
"django.contrib.admin.site.unregister"
] | [((1695, 1722), 'django.contrib.admin.site.unregister', 'admin.site.unregister', (['User'], {}), '(User)\n', (1716, 1722), False, 'from django.contrib import admin\n'), ((1723, 1759), 'django.contrib.admin.site.register', 'admin.site.register', (['User', 'UserAdmin'], {}), '(User, UserAdmin)\n', (1742, 1759), False, 'f... |
# Generated by Django 3.2 on 2021-07-05 09:18
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('User', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='HealtData',
new_name='HealthData',
),
]... | [
"django.db.migrations.RenameModel"
] | [((211, 278), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""HealtData"""', 'new_name': '"""HealthData"""'}), "(old_name='HealtData', new_name='HealthData')\n", (233, 278), False, 'from django.db import migrations\n')] |
"""Defines the class for OVR (one-versus-rest) classification."""
import functools
import numpy as np
from .predictors import Classifier
class OVRClassifier(Classifier):
"""Multiclass classification by solving a binary problem for each class.
"OVR" stands for "one-versus-rest", meaning that for each class... | [
"functools.partial",
"numpy.where",
"numpy.argmax"
] | [((1477, 1517), 'functools.partial', 'functools.partial', (['base', '*args'], {}), '(base, *args, **kwargs)\n', (1494, 1517), False, 'import functools\n'), ((3890, 3910), 'numpy.argmax', 'np.argmax', (['p'], {'axis': '(0)'}), '(p, axis=0)\n', (3899, 3910), True, 'import numpy as np\n'), ((3126, 3156), 'numpy.where', 'n... |
"""Tools helping with the TIMIT dataset.
Based on the version from:
https://www.kaggle.com/mfekadu/darpa-timit-acousticphonetic-continuous-speech
"""
import re
from os.path import join, splitext, dirname
from pathlib import Path
import numpy as np
import pandas as pd
import soundfile as sf
from audio_loader.ground_... | [
"numpy.sum",
"numpy.logical_and",
"pandas.read_csv",
"os.path.dirname",
"pandas.unique",
"pandas.notnull",
"pathlib.Path",
"numpy.where",
"os.path.join"
] | [((1131, 1148), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (1138, 1148), False, 'from os.path import join, splitext, dirname\n'), ((3867, 3903), 'pandas.unique', 'pd.unique', (["self.df_all['speaker_id']"], {}), "(self.df_all['speaker_id'])\n", (3876, 3903), True, 'import pandas as pd\n'), ((1202... |
import os
from collections import defaultdict
import sqlite3
import numpy as np
import pandas as pd
import lsst.afw.table as afw_table
import lsst.daf.persistence as dp
import lsst.geom
import desc.sims_ci_pipe as scp
def make_SourceCatalog(df):
bands = 'ugrizy'
schema = afw_table.SourceTable.makeMinimalSchem... | [
"lsst.afw.table.matchRaDec",
"lsst.daf.persistence.Butler",
"numpy.degrees",
"desc.sims_truthcatalog.StellarLightCurveFactory",
"lsst.afw.table.SourceTable.makeMinimalSchema",
"numpy.zeros",
"collections.defaultdict",
"os.path.isfile",
"sqlite3.connect",
"pandas.read_sql",
"pandas.read_pickle",
... | [((282, 323), 'lsst.afw.table.SourceTable.makeMinimalSchema', 'afw_table.SourceTable.makeMinimalSchema', ([], {}), '()\n', (321, 323), True, 'import lsst.afw.table as afw_table\n'), ((440, 471), 'lsst.afw.table.SourceCatalog', 'afw_table.SourceCatalog', (['schema'], {}), '(schema)\n', (463, 471), True, 'import lsst.afw... |
# Programa de teste opneCV
import cv2
import numpy as np
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCh... | [
"cv2.VideoCapture",
"cv2.imshow",
"cv2.waitKey"
] | [((486, 505), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (502, 505), False, 'import cv2\n'), ((622, 646), 'cv2.imshow', 'cv2.imshow', (['"""Video"""', 'img'], {}), "('Video', img)\n", (632, 646), False, 'import cv2\n'), ((657, 671), 'cv2.waitKey', 'cv2.waitKey', (['(1)'], {}), '(1)\n', (668, 671), ... |
from time import sleep
import click
import threading
class waiting_echo(threading.Thread):
def __init__(self, msg):
threading.Thread.__init__(self)
self.msg = msg
self.exiting=False
self.flag = True
def run(self):
while not self.exiting:
click.echo("\r-%s" %s... | [
"threading.Thread.__init__",
"click.echo",
"time.sleep"
] | [((2133, 2161), 'click.echo', 'click.echo', (['"""|-- """'], {'nl': '(False)'}), "('|-- ', nl=False)\n", (2143, 2161), False, 'import click\n'), ((2385, 2417), 'click.echo', 'click.echo', (['""" |-- """'], {'nl': '(False)'}), "(' |-- ', nl=False)\n", (2395, 2417), False, 'import click\n'), ((2422, 2455), 'click.e... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 11 13:37:23 2018
@author: admin
"""
import numpy as np
import cv2
cap = cv2.VideoCapture("2.avi")
subtractor = cv2.createBackgroundSubtractorMOG2(history=20, varThreshold=25, detectShadows=True)
while True:
_, frame = cap.read()
mask = su... | [
"cv2.createBackgroundSubtractorMOG2",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.destroyAllWindows"
] | [((133, 158), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""2.avi"""'], {}), "('2.avi')\n", (149, 158), False, 'import cv2\n'), ((176, 263), 'cv2.createBackgroundSubtractorMOG2', 'cv2.createBackgroundSubtractorMOG2', ([], {'history': '(20)', 'varThreshold': '(25)', 'detectShadows': '(True)'}), '(history=20, varThreshol... |
import ast
import copy
from flask import request
from flask_restful import Resource, reqparse
from application.common.api_permission import TEST_CASE_JOB_POST, \
EDIT_TEST_CASE_GET, EDIT_TEST_CASE_PUT, EDIT_TEST_CASE_DELETE, \
TEST_CASE_JOB_EXTERNAL_POST, EDIT_TEST_CASE_POST
from application.common.common_exc... | [
"application.common.response.api_response",
"application.helper.permission_check.check_permission",
"application.common.utils.db_details_without_password",
"application.model.models.User.query.filter_by",
"application.helper.runnerclasshelpers.save_case_log",
"application.common.constants.SupportedTestCla... | [((2243, 2267), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ([], {}), '()\n', (2265, 2267), False, 'from flask_restful import Resource, reqparse\n'), ((6086, 6124), 'flask.request.data.decode', 'request.data.decode', (['"""utf-8"""', '"""ignore"""'], {}), "('utf-8', 'ignore')\n", (6105, 6124), Fal... |
# Generated by Django 2.0 on 2020-11-24 15:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('article', '0012_auto_20201124_2310'),
]
operations = [
migrations.AlterField(
model_name='author',
name='tel',
... | [
"django.db.models.CharField"
] | [((331, 386), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(11)', 'null': '(True)', 'unique': '(True)'}), '(max_length=11, null=True, unique=True)\n', (347, 386), False, 'from django.db import migrations, models\n')] |
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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.... | [
"dmp.dmp"
] | [((915, 929), 'dmp.dmp', 'dmp', ([], {'test': '(True)'}), '(test=True)\n', (918, 929), False, 'from dmp import dmp\n'), ((1282, 1296), 'dmp.dmp', 'dmp', ([], {'test': '(True)'}), '(test=True)\n', (1285, 1296), False, 'from dmp import dmp\n')] |
import math
import copy
import cv2
import numpy as np
from .connected_component import ConnectedComponentData
from typing import List
__sw_median_max_ratio = 2
__height_max_ratio = 1.5
__max_chain_height = 150
__max_distance_multiplier = 3
__min_chain_size = 3
__max_average_gray_diff = 3
__gray_variance_coefficient ... | [
"copy.deepcopy",
"numpy.average",
"math.sqrt",
"cv2.rectangle"
] | [((2325, 2412), 'math.sqrt', 'math.sqrt', (['((cc_2.row_max - cc_1.row_max) ** 2 + (cc_2.col_min - cc_1.col_max) ** 2)'], {}), '((cc_2.row_max - cc_1.row_max) ** 2 + (cc_2.col_min - cc_1.col_max\n ) ** 2)\n', (2334, 2412), False, 'import math\n'), ((9658, 9676), 'copy.deepcopy', 'copy.deepcopy', (['img'], {}), '(img... |
from typing import Tuple
import numpy as np
import torch
from torch.distributions import Categorical
from node import Node
from network import Network
from mcts import MCTS
class Agent:
def __init__(self, network: Network, mcts: MCTS):
self.network = network
self.mcts = mcts
def get_action(... | [
"torch.save",
"torch.load",
"torch.Tensor"
] | [((627, 668), 'torch.load', 'torch.load', (['filename'], {'map_location': 'device'}), '(filename, map_location=device)\n', (637, 668), False, 'import torch\n'), ((884, 915), 'torch.save', 'torch.save', (['save_data', 'filename'], {}), '(save_data, filename)\n', (894, 915), False, 'import torch\n'), ((1000, 1060), 'torc... |
"""Cannon, hitting targets with projectiles.
Exercises
1. Keep score by counting target hits.
2. Vary the effect of gravity. [DONE]
3. Apply gravity to the targets.
4. Change the speed of the ball. [DONE]
5. Dont let the game end when target reaches left. [DONE]
"""
from random import randrange
from turtle import *... | [
"freegames.vector",
"random.randrange"
] | [((358, 376), 'freegames.vector', 'vector', (['(-200)', '(-200)'], {}), '(-200, -200)\n', (364, 376), False, 'from freegames import vector\n'), ((385, 397), 'freegames.vector', 'vector', (['(0)', '(0)'], {}), '(0, 0)\n', (391, 397), False, 'from freegames import vector\n'), ((1504, 1517), 'random.randrange', 'randrange... |