code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Least Square Sample
# ========================================
# [] File Name : ls_sample.py
#
# [] Creation Date : December 2017
#
# [] Created By : <NAME> (<EMAIL>)
# ========================================
#
import matplotlib.pyplot as plt
import numpy as numpy
dataset = numpy.array([[3,5],[5,3],[8,4],[3,1],[6,4... | [
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.show"
] | [((279, 356), 'numpy.array', 'numpy.array', (['[[3, 5], [5, 3], [8, 4], [3, 1], [6, 4], [5, 4], [7, 5], [8, 3]]'], {}), '([[3, 5], [5, 3], [8, 4], [3, 1], [6, 4], [5, 4], [7, 5], [8, 3]])\n', (290, 356), True, 'import numpy as numpy\n'), ((1466, 1478), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1476, ... |
# -----------------------------------------------------------------------------
# Copyright (c) 2009-2016 <NAME>. All rights reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
"""
A framebuffer is a collection of buffers that can be used ... | [
"glumpy.gl.glCheckFramebufferStatus",
"glumpy.gl.glDeleteRenderbuffer",
"glumpy.gl.glFramebufferTexture2D",
"numpy.array",
"glumpy.gl.glGenFramebuffers",
"numpy.resize",
"glumpy.gl.glRenderbufferStorage",
"glumpy.gl.glFramebufferRenderbuffer",
"glumpy.gl.glGenRenderbuffers",
"glumpy.gloo.globject.... | [((1624, 1647), 'glumpy.gloo.globject.GLObject.__init__', 'GLObject.__init__', (['self'], {}), '(self)\n', (1641, 1647), False, 'from glumpy.gloo.globject import GLObject\n'), ((2471, 2509), 'glumpy.log.log.debug', 'log.debug', (['"""GPU: Create render buffer"""'], {}), "('GPU: Create render buffer')\n", (2480, 2509), ... |
import os
import requests
from flask import Flask, render_template
app = Flask(__name__)
app.config['DEBUG'] = True
@app.route('/')
def index():
return render_template('index.html')
#API
@app.route('/api/ping', methods=['GET'])
def api_ping():
return "pong"
@app.route('/api/weather/<int:city_id>', methods=... | [
"flask.render_template",
"os.environ.get",
"requests.get",
"flask.Flask"
] | [((75, 90), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (80, 90), False, 'from flask import Flask, render_template\n'), ((159, 188), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (174, 188), False, 'from flask import Flask, render_template\n'), ((366, 468), ... |
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
import albumentations
import albumentations.pytorch
import numpy as np
import math
import pandas as pd
import random
import os
import matplotlib
import argparse
import wandb
from EnD import *
from configs import *
from collections im... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"wandb.log",
"torch.enable_grad",
"torch.max",
"tqdm.tqdm",
"torch.optim.lr_scheduler.StepLR",
"random.seed",
"os.path.join",
"collections.defaultdict",
"numpy.random.seed",
"torch.nn.functional.cross_entropy",
"models.simple_convnet",
"to... | [((403, 422), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (415, 422), False, 'import torch\n'), ((472, 497), 'torch.max', 'torch.max', (['outputs'], {'dim': '(1)'}), '(outputs, dim=1)\n', (481, 497), False, 'import torch\n'), ((775, 804), 'tqdm.tqdm', 'tqdm', (['dataloader'], {'leave': '(False)'})... |
import json
import urllib.request
from newsapi import NewsApiClient
from .models import Sources, Articles, Headlines
key = None
source_url = None
newsapi = None
everything_url = None
def configure_request(app):
global key, source_url, newsapi, everything_url
key = app.config['NEWS_API_KEY']
source_url ... | [
"json.loads",
"newsapi.NewsApiClient"
] | [((411, 437), 'newsapi.NewsApiClient', 'NewsApiClient', ([], {'api_key': 'key'}), '(api_key=key)\n', (424, 437), False, 'from newsapi import NewsApiClient\n'), ((1446, 1464), 'json.loads', 'json.loads', (['result'], {}), '(result)\n', (1456, 1464), False, 'import json\n')] |
import requests
from os.path import exists
from os import remove
import tarfile
def data_downloader():
"""
download the cacm.tar.gz from the given url, and uncompress it.
"""
url = "http://dg3rtljvitrle.cloudfront.net/cacm.tar.gz"
if not exists("cacm.tar.gz") and not exists('cacm'):
... | [
"os.path.exists",
"tarfile.open",
"requests.get",
"os.remove"
] | [((332, 349), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (344, 349), False, 'import requests\n'), ((448, 462), 'os.path.exists', 'exists', (['"""cacm"""'], {}), "('cacm')\n", (454, 462), False, 'from os.path import exists\n'), ((477, 504), 'tarfile.open', 'tarfile.open', (['"""cacm.tar.gz"""'], {}), "('c... |
import random
# Tipos de Dados em Python
# Tipos de texto: str
# Tipos de numéricos: int, float, complex
# Tipos de seguencia: list, tuple, range
# Tipo de mapeamento: dict
# Tipos de conjuntos: set, frozenset
# Tipo booleano: bool
# Tipos binários: bytes, bytearray, memoriyview
# Definir tipos de dados... | [
"random.randrange"
] | [((1125, 1148), 'random.randrange', 'random.randrange', (['(1)', '(10)'], {}), '(1, 10)\n', (1141, 1148), False, 'import random\n'), ((1166, 1189), 'random.randrange', 'random.randrange', (['(1)', '(10)'], {}), '(1, 10)\n', (1182, 1189), False, 'import random\n')] |
"""
在一个任务包sms里面定义一个固定名称的模块tasks.py,在tasks.py模块中定义任务函数
"""
from celery_tasks.main import celery_app
from celery_tasks.yuntongxun.ccp_sms import CCP
# 定义一个发送短信的异步任务函数
@celery_app.task(name='ccp_send_sms_code')
def ccp_send_sms_code(mobile, sms_code):
"""
功能:使用yuntongxun发送短信
参数:mobile手机号,sms_code验证码
:retu... | [
"celery_tasks.main.celery_app.task",
"celery_tasks.yuntongxun.ccp_sms.CCP"
] | [((167, 208), 'celery_tasks.main.celery_app.task', 'celery_app.task', ([], {'name': '"""ccp_send_sms_code"""'}), "(name='ccp_send_sms_code')\n", (182, 208), False, 'from celery_tasks.main import celery_app\n'), ((358, 363), 'celery_tasks.yuntongxun.ccp_sms.CCP', 'CCP', ([], {}), '()\n', (361, 363), False, 'from celery_... |
#!/usr/bin/env python
# Copyright 2018 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.
# This script parses result of build/android/adb_profile_chrome_startup and
# prints various information.
from __future__ import print... | [
"re.split",
"json.loads",
"collections.namedtuple",
"argparse.ArgumentParser",
"re.compile",
"os.path.isfile",
"collections.defaultdict",
"os.path.basename",
"glob.glob"
] | [((8272, 8398), 'collections.namedtuple', 'collections.namedtuple', (['"""EventSummary"""', "['trace', 'event', 'startup_to_event_ms', 'navigation_to_event_ms',\n 'duration_ms']"], {}), "('EventSummary', ['trace', 'event',\n 'startup_to_event_ms', 'navigation_to_event_ms', 'duration_ms'])\n", (8294, 8398), False,... |
from __future__ import absolute_import, division, print_function
from mmtbx.geometry import topology
import unittest
class TestAtom(unittest.TestCase):
def test_1(self):
foo = object()
bar = object()
a = topology.Atom( foo = foo, bar = bar )
self.assertEqual( a.foo, foo )
self.assertEqual( a... | [
"unittest.TestSuite",
"mmtbx.geometry.topology.Molecule",
"mmtbx.geometry.topology.Atom",
"mmtbx.geometry.topology.Compound.create",
"mmtbx.geometry.topology.Compound.from_structure",
"unittest.TextTestRunner",
"unittest.TestLoader"
] | [((11992, 12122), 'unittest.TestSuite', 'unittest.TestSuite', (['[suite_atom, suite_molecule, suite_compound, suite_mcgregor_match,\n suite_rascal_match, suite_greedy_match]'], {}), '([suite_atom, suite_molecule, suite_compound,\n suite_mcgregor_match, suite_rascal_match, suite_greedy_match])\n', (12010, 12122), ... |
import array as arr
# Creando lista
l = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
a = arr.array('i', l)
print("Inicializar arreglo: ")
for i in (a):
print(i, end =" ")
# Imprime el elemento del rango
# Usando la operacion de rebanada
Sliced_array = a[3:8]
print("\nRebana de elemento en rango 3-8: ")
print(Sli... | [
"array.array"
] | [((90, 107), 'array.array', 'arr.array', (['"""i"""', 'l'], {}), "('i', l)\n", (99, 107), True, 'import array as arr\n')] |
# Copyright 2021 SAP SE
#
# 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, soft... | [
"osc_lib.utils.get_dict_properties",
"openstackclient.compute.v2.server_group._get_columns",
"novaclient.v2.server_groups.ServerGroup"
] | [((2859, 2909), 'novaclient.v2.server_groups.ServerGroup', 'ServerGroup', (['self', 'content'], {'loaded': '(True)', 'resp': 'resp'}), '(self, content, loaded=True, resp=resp)\n', (2870, 2909), False, 'from novaclient.v2.server_groups import ServerGroup\n'), ((2980, 2998), 'openstackclient.compute.v2.server_group._get_... |
"""TDD support for a function cleaning cluttered HTML code.
"""
import re
import unittest
CLUTTERED = ''' <P CLASS="western"><A NAME="ScID:17"></A><A NAME="ScID:120"></A><!-- Climb up rope to safety. Back in ship for hyperspace. --><FONT COLOR="#000000"><SPAN STYLE="text-decoration: none"><FONT FACE="m... | [
"unittest.main",
"re.sub"
] | [((1635, 1666), 're.sub', 're.sub', (['"""</*font.*?>"""', '""""""', 'text'], {}), "('</*font.*?>', '', text)\n", (1641, 1666), False, 'import re\n'), ((1679, 1710), 're.sub', 're.sub', (['"""</*span.*?>"""', '""""""', 'text'], {}), "('</*span.*?>', '', text)\n", (1685, 1710), False, 'import re\n'), ((1723, 1754), 're.... |
#
# Created by DraX on 2005.08.08 modified by Ariakas on 2005.09.19
#
import sys
from com.l2jserver.gameserver.model.quest import State
from com.l2jserver.gameserver.model.quest import QuestState
from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest
qn = "30520_reed_occupation_ch... | [
"com.l2jserver.gameserver.model.quest.jython.QuestJython.__init__"
] | [((415, 453), 'com.l2jserver.gameserver.model.quest.jython.QuestJython.__init__', 'JQuest.__init__', (['self', 'id', 'name', 'descr'], {}), '(self, id, name, descr)\n', (430, 453), True, 'from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest\n')] |
import os
import re
import rethinkdb as r
from jose import jwt
from jose.exceptions import JWTError
from datetime import datetime
from passlib.hash import pbkdf2_sha256
from flask import current_app
from api.models.RethinkDBModel import RethinkDBModel
from api.models.file import File
conn = r.connect(db='papers')
... | [
"rethinkdb.connect",
"rethinkdb.make_timezone",
"re.match",
"rethinkdb.table"
] | [((296, 318), 'rethinkdb.connect', 'r.connect', ([], {'db': '"""papers"""'}), "(db='papers')\n", (305, 318), True, 'import rethinkdb as r\n'), ((857, 882), 'rethinkdb.make_timezone', 'r.make_timezone', (['"""+01:00"""'], {}), "('+01:00')\n", (872, 882), True, 'import rethinkdb as r\n'), ((927, 952), 'rethinkdb.make_tim... |
# coding: utf-8
# Gather breast cancer data
from sklearn.datasets import load_breast_cancer
breast_cancer = load_breast_cancer()
breast_cancer_data = breast_cancer.data
breast_cancer_labels = breast_cancer.target
# Prepare data as pandas dataframe
import numpy as np
labels = np.reshape(breast_cancer_labels,(569,1... | [
"numpy.reshape",
"sklearn.model_selection.train_test_split",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.datasets.load_breast_cancer",
"numpy.append",
"sklearn.preprocessing.StandardScaler",
"numpy.concatenate",
"sklearn.feature_selection.SelectPercentile",
"pandas.DataFrame"
] | [((110, 130), 'sklearn.datasets.load_breast_cancer', 'load_breast_cancer', ([], {}), '()\n', (128, 130), False, 'from sklearn.datasets import load_breast_cancer\n'), ((282, 324), 'numpy.reshape', 'np.reshape', (['breast_cancer_labels', '(569, 1)'], {}), '(breast_cancer_labels, (569, 1))\n', (292, 324), True, 'import nu... |
import matplotlib.pyplot as plt
import numpy as np
import os
import pickle
from torch import save as tsave
from .general_functions import create_dir
class Logger:
def __init__(
self,
save_path="",
save_every=100,
save_best=False,
log_every=50,
log_style="block",
... | [
"numpy.mean",
"numpy.convolve",
"pickle.dump",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"os.path.join",
"numpy.std",
"numpy.cumsum",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((2202, 2217), 'numpy.mean', 'np.mean', (['losses'], {}), '(losses)\n', (2209, 2217), True, 'import numpy as np\n'), ((2297, 2313), 'numpy.mean', 'np.mean', (['rewards'], {}), '(rewards)\n', (2304, 2313), True, 'import numpy as np\n'), ((3417, 3438), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Episode"""'], {}), "... |
#!/usr/bin/python3
import sqlite3
import json
import threading
import requests
import urllib3
import datetime
import time
import asyncio
import tornado.autoreload
from tornado.concurrent import run_on_executor
from concurrent.futures import ThreadPoolExecutor
import sys
sys.path.append('./web/control/')
sys.path.append... | [
"urllib3.disable_warnings",
"json.dumps",
"sys.path.append",
"sqlite3.connect"
] | [((271, 304), 'sys.path.append', 'sys.path.append', (['"""./web/control/"""'], {}), "('./web/control/')\n", (286, 304), False, 'import sys\n'), ((305, 339), 'sys.path.append', 'sys.path.append', (['"""./web/database/"""'], {}), "('./web/database/')\n", (320, 339), False, 'import sys\n'), ((340, 372), 'sys.path.append',... |
import sys
import os
import subprocess
import json
from utils import get_training_world, unarchive_data
from datetime import datetime
if __name__ == "__main__":
start_time = datetime.now()
print('Starting training...')
# print("Training started at {}".format(start_time))
world = get_training_world()
... | [
"json.loads",
"utils.get_training_world",
"subprocess.Popen",
"subprocess.CalledProcessError",
"datetime.datetime.now",
"sys.exit"
] | [((179, 193), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (191, 193), False, 'from datetime import datetime\n'), ((297, 317), 'utils.get_training_world', 'get_training_world', ([], {}), '()\n', (315, 317), False, 'from utils import get_training_world, unarchive_data\n'), ((332, 364), 'json.loads', 'json.... |
import enum
CrashLevel = enum.Enum(
value="CrashLevel",
names=[
("None", 0),
("Inadequate Warning of Exits, Lanes Narrowing, Traffic Controls etc.", 1),
("Shoulder Related", 2),
("Other Maintenance or Construction-Created Condition", 3),
("No or Obscured Pavement Marking... | [
"enum.Enum"
] | [((26, 1615), 'enum.Enum', 'enum.Enum', ([], {'value': '"""CrashLevel"""', 'names': '[(\'None\', 0), (\n \'Inadequate Warning of Exits, Lanes Narrowing, Traffic Controls etc.\', \n 1), (\'Shoulder Related\', 2), (\n \'Other Maintenance or Construction-Created Condition\', 3), (\n \'No or Obscured Pavement M... |
from easy_music_generator import easy_music_generator as emg
import sys
sys.path.append('../')
emg_obj = emg.EasyMusicGenerator()
emg_obj.analyze('music/')
emg_obj.generate(10, 'output/')
| [
"easy_music_generator.easy_music_generator.EasyMusicGenerator",
"sys.path.append"
] | [((72, 94), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (87, 94), False, 'import sys\n'), ((106, 130), 'easy_music_generator.easy_music_generator.EasyMusicGenerator', 'emg.EasyMusicGenerator', ([], {}), '()\n', (128, 130), True, 'from easy_music_generator import easy_music_generator as emg\n... |
import sys, copy, heapq
import math, random, time
import numpy as np
# Class
from Challenge import Pacman
def init_pacman_from_list(kanban_node, PACMAN_LIST):
for d1 in PACMAN_LIST:
pacman_new = Pacman(None)
pacman_new.mine, pacman_new.x, pacman_new.y = d1[1], d1[2], d1[3]
pacman_new.type... | [
"Challenge.Pacman"
] | [((210, 222), 'Challenge.Pacman', 'Pacman', (['None'], {}), '(None)\n', (216, 222), False, 'from Challenge import Pacman\n')] |
import graphene
import graphql_jwt
from graphene_django import DjangoObjectType
from graphql_extensions.auth.decorators import (login_required,
staff_member_required)
import graphql_social_auth
from ..models import User
class UserType(DjangoObjectType):
token = gr... | [
"graphene.String",
"graphene.List",
"graphene.Field",
"graphql_social_auth.SocialAuthJWT.Field",
"graphql_jwt.ObtainJSONWebToken.Field",
"graphql_jwt.Verify.Field",
"graphql_jwt.Refresh.Field"
] | [((318, 353), 'graphene.String', 'graphene.String', ([], {'source': '"""get_token"""'}), "(source='get_token')\n", (333, 353), False, 'import graphene\n'), ((448, 471), 'graphene.List', 'graphene.List', (['UserType'], {}), '(UserType)\n', (461, 471), False, 'import graphene\n'), ((491, 515), 'graphene.Field', 'graphene... |
import curses
from resources.digits import bigDigits,bigDigitsIndexes
NumericWidth = 142
class windowManager:
def __init__(self,stdscr):
curses.curs_set(0)
self.initializeColors()
self.initializeWindows(stdscr)
self.resizeWindows()
self.blinking = False;
def initializeCol... | [
"curses.color_pair",
"curses.can_change_color",
"curses.init_color",
"curses.init_pair",
"curses.curs_set",
"curses.noecho",
"curses.doupdate",
"curses.newwin",
"curses.echo"
] | [((149, 167), 'curses.curs_set', 'curses.curs_set', (['(0)'], {}), '(0)\n', (164, 167), False, 'import curses\n'), ((342, 367), 'curses.can_change_color', 'curses.can_change_color', ([], {}), '()\n', (365, 367), False, 'import curses\n'), ((871, 896), 'curses.newwin', 'curses.newwin', (['(1)', '(1)', '(0)', '(0)'], {})... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'untitled.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainW... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtGui.QPalette",
"PyQt5.QtWidgets.QMainWindow",
"PyQt5.QtGui.QFont",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtGui.QColor",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidg... | [((11574, 11606), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (11596, 11606), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((11624, 11647), 'PyQt5.QtWidgets.QMainWindow', 'QtWidgets.QMainWindow', ([], {}), '()\n', (11645, 11647), False, 'from PyQt5 import QtC... |
""" Easy Translator """
import os
from flask import current_app, request
from werkzeug.utils import secure_filename
from .json import Json
class Translator:
""" Uses dot-key syntax to translate phrases to words """
app_language = None
module_name = None
def __init__(self, module_name=No... | [
"os.path.exists",
"os.path.join",
"flask.request.headers.get",
"werkzeug.utils.secure_filename"
] | [((2887, 2916), 'os.path.join', 'os.path.join', (['self.path', 'file'], {}), '(self.path, file)\n', (2899, 2916), False, 'import os\n'), ((2929, 2954), 'os.path.exists', 'os.path.exists', (['file_path'], {}), '(file_path)\n', (2943, 2954), False, 'import os\n'), ((386, 425), 'flask.request.headers.get', 'request.header... |
import search
import gamestate as game
# Test the depth limit by checking the number of nodes visited
# -- recall that minimax visits every node in the search tree,
# so if we search depth one on an empty board then minimax should
# visit the sum of each sub-tree
depth_limit = 2
expected_node_count = 30
r... | [
"search.get_action",
"gamestate.GameState"
] | [((330, 346), 'gamestate.GameState', 'game.GameState', ([], {}), '()\n', (344, 346), True, 'import gamestate as game\n'), ((348, 388), 'search.get_action', 'search.get_action', (['rootNode', 'depth_limit'], {}), '(rootNode, depth_limit)\n', (365, 388), False, 'import search\n')] |
# ========================================================================================
# Install pyion together with its C Extensions
#
# ..Warning:: pyion has only been tested for Python 3.5+
#
# To compile pyion
# ----------------
# root@mnet:/pyion# python3 setup.py install
# root@mnet:/pyion# python3 setup.py c... | [
"pathlib.Path",
"math.log2",
"os.environ.get",
"setuptools.setup",
"warnings.warn"
] | [((3633, 3666), 'os.environ.get', 'os.environ.get', (['"""LD_LIBRARY_PATH"""'], {}), "('LD_LIBRARY_PATH')\n", (3647, 3666), False, 'import os\n'), ((3678, 3704), 'os.environ.get', 'os.environ.get', (['"""ION_HOME"""'], {}), "('ION_HOME')\n", (3692, 3704), False, 'import os\n'), ((7648, 8199), 'setuptools.setup', 'setup... |
import time, random, requests
from concurrent.futures import ThreadPoolExecutor
class Downloader(object):
def __init__(
self,
workers = 8,
tries = 3,
sleep = 2,
multiplier = 1.5,
):
"""
Launch a thread pool of workers to ... | [
"concurrent.futures.ThreadPoolExecutor",
"random.random",
"requests.get"
] | [((1178, 1210), 'concurrent.futures.ThreadPoolExecutor', 'ThreadPoolExecutor', (['self.workers'], {}), '(self.workers)\n', (1196, 1210), False, 'from concurrent.futures import ThreadPoolExecutor\n'), ((1470, 1487), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1482, 1487), False, 'import time, random, requ... |
# Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"corpuscrawler.util.extract",
"corpuscrawler.util.clean_paragraphs",
"corpuscrawler.util.crawl_udhr",
"re.findall",
"re.search"
] | [((814, 872), 'corpuscrawler.util.crawl_udhr', 'crawl_udhr', (['crawler', 'out'], {'filename': '"""udhr_nya_chechewa.txt"""'}), "(crawler, out, filename='udhr_nya_chechewa.txt')\n", (824, 872), False, 'from corpuscrawler.util import crawl_udhr, clean_paragraphs, extract\n'), ((1056, 1107), 're.findall', 're.findall', (... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
from collections import MutableSet
from datetime import datetime
from sqlalchemy import Column, Unicode, Integer, ForeignKey, func, DateTime
from sqlalchemy.orm ... | [
"logging.getLogger",
"sqlalchemy.orm.relationship",
"flexget.plugins.parsers.parser_common.remove_dirt",
"flexget.entry.Entry",
"flexget.event.event",
"flexget.plugin.register",
"sqlalchemy.sql.elements.and_",
"sqlalchemy.ForeignKey",
"flexget.db_schema.versioned_base",
"flexget.plugin.get_plugins... | [((748, 779), 'logging.getLogger', 'logging.getLogger', (['"""movie_list"""'], {}), "('movie_list')\n", (765, 779), False, 'import logging\n'), ((787, 818), 'flexget.db_schema.versioned_base', 'versioned_base', (['"""movie_list"""', '(0)'], {}), "('movie_list', 0)\n", (801, 818), False, 'from flexget.db_schema import v... |
import logging
import sys
from deeplens.struct import VideoStream
from deeplens.dataflow.map import Sample
from deeplens.ocr.pytesseract import PyTesseractOCR
from timeit import default_timer as timer
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
start = timer()
if len(sys.argv) < ... | [
"logging.basicConfig",
"timeit.default_timer",
"deeplens.struct.VideoStream",
"deeplens.ocr.pytesseract.PyTesseractOCR",
"deeplens.dataflow.map.Sample"
] | [((235, 275), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (254, 275), False, 'import logging\n'), ((288, 295), 'timeit.default_timer', 'timer', ([], {}), '()\n', (293, 295), True, 'from timeit import default_timer as timer\n'), ((417, 449), 'deeplens.struct... |
import asyncio
import math
from concurrent.futures.process import ProcessPoolExecutor
from datetime import date
from datetime import datetime
import pytest
from yui.apps.compute.calc import BadSyntax
from yui.apps.compute.calc import Decimal as D
from yui.apps.compute.calc import Evaluator
from yui.apps.compute.calc ... | [
"yui.apps.compute.calc.Decimal",
"asyncio.new_event_loop",
"math.sqrt",
"concurrent.futures.process.ProcessPoolExecutor",
"datetime.datetime.now",
"pytest.raises",
"datetime.date",
"pytest.fixture",
"yui.apps.compute.calc.Evaluator"
] | [((17716, 17746), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (17730, 17746), False, 'import pytest\n'), ((17836, 17866), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (17850, 17866), False, 'import pytest\n'), ((1205, 1216), 'y... |
# Copyright (c) 2015
#
# All rights reserved.
#
# This file is distributed under the Clear BSD license.
# The full text can be found in LICENSE in the root directory.
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import random
import re
import string
import time
from devices import prompt
wlan_iface = None
d... | [
"random.sample",
"re.findall",
"time.sleep"
] | [((1593, 1607), 'time.sleep', 'time.sleep', (['(20)'], {}), '(20)\n', (1603, 1607), False, 'import time\n'), ((1963, 2006), 're.findall', 're.findall', (['"""([\\\\w\\\\.]+)=\\\\d"""', 'board.before'], {}), "('([\\\\w\\\\.]+)=\\\\d', board.before)\n", (1973, 2006), False, 'import re\n'), ((4201, 4218), 'time.sleep', 't... |
"""
h2o2_mk2012_ad.py
Hydrogen peroxide, H2O2, ground state surface from
Ref [1]_. The coefficients are available from the references
supplementary information as the 'adiabatic PES', which
corresponds to the "V+C+R+H+D" results.
The surface is implemented in internal coordinates.
X1 ... O1 -- H1 bond length (Angst... | [
"nitrogen.autodiff.forward.cos",
"nitrogen.dfun.DFun",
"numpy.array",
"nitrogen.dfun.X2adf",
"nitrogen.dfun.adf2array",
"nitrogen.autodiff.forward.const_like"
] | [((1555, 1585), 'nitrogen.dfun.DFun', 'n2.dfun.DFun', (['Vfun'], {'nf': '(1)', 'nx': '(6)'}), '(Vfun, nf=1, nx=6)\n', (1567, 1585), True, 'import nitrogen as n2\n'), ((2432, 8340), 'numpy.array', 'np.array', (['[[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 2], [0, 0, 0, 0, 0,\n 3], [0, 0, 0, 0, 0, 4], [0,... |
import json
import os
import random
import bpy
from src.loader.LoaderInterface import LoaderInterface
from src.utility.Utility import Utility
from src.utility.LabelIdMapping import LabelIdMapping
class Pix3DLoader(LoaderInterface):
"""
This loads an object from Pix3D based on the given category of objects t... | [
"src.loader.LoaderInterface.LoaderInterface.remove_x_axis_rotation",
"os.path.exists",
"random.choice",
"bpy.ops.object.select_all",
"src.utility.Utility.Utility.import_objects",
"os.path.join",
"src.utility.Utility.Utility.get_nodes_with_type",
"src.utility.Utility.Utility.get_the_one_node_with_type"... | [((1391, 1429), 'src.loader.LoaderInterface.LoaderInterface.__init__', 'LoaderInterface.__init__', (['self', 'config'], {}), '(self, config)\n', (1415, 1429), False, 'from src.loader.LoaderInterface import LoaderInterface\n'), ((2315, 2352), 'os.path.join', 'os.path.join', (['data_path', '"""pix3d.json"""'], {}), "(dat... |
from tests.utils import W3CTestCase
class TestFlexbox_AlignItemsFlexend(W3CTestCase):
vars().update(W3CTestCase.find_tests(__file__, 'flexbox_align-items-flexend'))
| [
"tests.utils.W3CTestCase.find_tests"
] | [((105, 168), 'tests.utils.W3CTestCase.find_tests', 'W3CTestCase.find_tests', (['__file__', '"""flexbox_align-items-flexend"""'], {}), "(__file__, 'flexbox_align-items-flexend')\n", (127, 168), False, 'from tests.utils import W3CTestCase\n')] |
#!/usr/bin/env python
# _*_ coding:utf-8 _*_
__author__ = 'junxi'
import aioredis
from sanic.log import logger
class Cache:
"""redis操作方法封装"""
def __init__(self, loop, cache):
self._loop = loop
self._cache = cache
async def set(self, *args, **kwargs):
"""redis set 命令封装"""
... | [
"aioredis.create_pool",
"aioredis.commands.Redis",
"sanic.log.logger.info"
] | [((2939, 2985), 'sanic.log.logger.info', 'logger.info', (['"""create redis connection pool..."""'], {}), "('create redis connection pool...')\n", (2950, 2985), False, 'from sanic.log import logger\n'), ((3018, 3215), 'aioredis.create_pool', 'aioredis.create_pool', ([], {'address': "self._cache['address']", 'db': "self.... |
import os
import pandas as pd
# -----------------------------------------------------
# Singleton class for configuration manager instance creations
# -----------------------------------------------------
class Utils(object):
__instance = None
def ensure_dir(file_path):
directory = os.path.dirname(fi... | [
"os.path.dirname",
"os.path.exists",
"os.makedirs",
"pandas.read_excel"
] | [((302, 328), 'os.path.dirname', 'os.path.dirname', (['file_path'], {}), '(file_path)\n', (317, 328), False, 'import os\n'), ((451, 507), 'pandas.read_excel', 'pd.read_excel', (['file_path'], {'index_col': '(0)', 'engine': '"""openpyxl"""'}), "(file_path, index_col=0, engine='openpyxl')\n", (464, 507), True, 'import pa... |
# Testing datetime module
import sys
import UnitTest
import datetime
class DatetimeModuleTest(UnitTest.UnitTest):
def testDate(self):
d = datetime.date(2010, 4, 9)
self.assertEqual(d.year, 2010)
self.assertEqual(d.month, 4)
self.assertEqual(d.day, 9)
self.assertEqual(d.we... | [
"datetime.datetime",
"datetime.datetime.fromtimestamp",
"datetime.time",
"datetime.datetime.strptime",
"RunTests.RunTests",
"datetime.date.fromtimestamp",
"datetime.date.fromordinal",
"datetime.date"
] | [((3814, 3824), 'RunTests.RunTests', 'RunTests', ([], {}), '()\n', (3822, 3824), False, 'from RunTests import RunTests\n'), ((154, 179), 'datetime.date', 'datetime.date', (['(2010)', '(4)', '(9)'], {}), '(2010, 4, 9)\n', (167, 179), False, 'import datetime\n'), ((369, 400), 'datetime.time', 'datetime.time', (['(9)', '(... |
try:
# Python 3
from http.client import HTTPResponse, IncompleteRead
except (ImportError):
# Python 2
from httplib import HTTPResponse, IncompleteRead
from ..console_write import console_write
class DebuggableHTTPResponse(HTTPResponse):
"""
A custom HTTPResponse that formats debugging info fo... | [
"httplib.HTTPResponse.read",
"httplib.HTTPResponse.begin",
"httplib.HTTPResponse.__init__"
] | [((734, 805), 'httplib.HTTPResponse.__init__', 'HTTPResponse.__init__', (['self', 'sock'], {'debuglevel': 'debuglevel', 'method': 'method'}), '(self, sock, debuglevel=debuglevel, method=method)\n', (755, 805), False, 'from httplib import HTTPResponse, IncompleteRead\n'), ((851, 875), 'httplib.HTTPResponse.begin', 'HTTP... |
from abc import abstractmethod, ABCMeta
from datetime import datetime
from flask_security.utils import encrypt_password
from ..datastore import SQLAlchemyDatastore
from ..utils import fix_docs
class GenreDatastore(object):
"""Abstract GenreDatastore class.
.. versionadded:: 0.1.0
"""
__metaclass__... | [
"flask_security.utils.encrypt_password",
"datetime.datetime.utcnow"
] | [((3051, 3087), 'flask_security.utils.encrypt_password', 'encrypt_password', (["kwargs['password']"], {}), "(kwargs['password'])\n", (3067, 3087), False, 'from flask_security.utils import encrypt_password\n'), ((3211, 3228), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (3226, 3228), False, 'from dat... |
from setuptools import setup, find_packages
setup(name='stftoolkit',
version='1.0',
description='Spatiotemporal Fourier Tools',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/vdutell/STFToolkit',
install_requires=['numpy'],
packages=find_packages()
)
| [
"setuptools.find_packages"
] | [((294, 309), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (307, 309), False, 'from setuptools import setup, find_packages\n')] |
import os
import re
import json
import time
import numpy as np
import pandas as pd
from plotnine import *
# Config
PATH = os.getcwd()
path_n = re.split(pattern=r"/|\\", string=PATH)[1:]
if os.name == "posix":
path_n = "/" + os.path.join(*path_n)
else:
drive = PATH[0:3]
path_n = drive + os.path.join(*path_n... | [
"re.split",
"numpy.mean",
"numpy.median",
"os.path.join",
"re.match",
"os.getcwd",
"numpy.max",
"numpy.min",
"pandas.DataFrame",
"time.time",
"re.search"
] | [((123, 134), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (132, 134), False, 'import os\n'), ((2648, 2669), 'pandas.DataFrame', 'pd.DataFrame', (['results'], {}), '(results)\n', (2660, 2669), True, 'import pandas as pd\n'), ((144, 183), 're.split', 're.split', ([], {'pattern': '"""/|\\\\\\\\"""', 'string': 'PATH'}), "(... |
import pytest
from numerous.engine.model import Model
from numerous.engine.simulation import Simulation
from numerous.utils.logger_levels import LoggerLevel
from numerous.multiphysics.equation_base import EquationBase
from numerous.multiphysics.equation_decorators import Equation
from numerous.engine.system.item import... | [
"pytest.approx",
"numerous.multiphysics.equation_decorators.Equation",
"numpy.ones",
"numerous.engine.simulation.Simulation",
"pytest.mark.parametrize",
"numpy.linspace",
"numpy.exp",
"numerous.engine.model.Model",
"shutil.rmtree",
"pytest.fixture"
] | [((548, 576), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (562, 576), False, 'import pytest\n'), ((1459, 1506), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""solver"""', 'solver_types'], {}), "('solver', solver_types)\n", (1482, 1506), False, 'import pytest\n'), ((... |
# -*- coding: utf-8 -*-
import re
from urllib.parse import urlparse
from flask import get_flashed_messages, url_for
from flask_login import login_user
import pytest
from app.extensions import mail
from app.user.models import User
from tests.factories import UserFactory
class TestLoggingIn:
@pytest.mark.paramet... | [
"urllib.parse.urlparse",
"app.user.models.User.get_by_id",
"flask_login.login_user",
"tests.factories.UserFactory",
"flask.get_flashed_messages",
"app.user.models.User.query.all",
"flask.url_for",
"pytest.mark.parametrize",
"app.extensions.mail.record_messages",
"re.search"
] | [((301, 367), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""endpoint"""', "('public.home', 'auth.login')"], {}), "('endpoint', ('public.home', 'auth.login'))\n", (324, 367), False, 'import pytest\n'), ((1120, 1186), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""endpoint"""', "('public.home',... |
# Platform-specific functions for the Commodore 64.
import os
import subprocess
IMGTOOL_PATH = '/usr/local/bin/imgtool'
def Prepare(game, dest):
"""Prepares this Commodore 64 game for upload."""
for name in game._files:
if name.endswith('.b64') or name.endswith('.prg') or name == 'README.txt':
... | [
"os.path.join"
] | [((730, 769), 'os.path.join', 'os.path.join', (['""".."""', '"""boilerplate"""', 'name'], {}), "('..', 'boilerplate', name)\n", (742, 769), False, 'import os\n'), ((795, 821), 'os.path.join', 'os.path.join', (['dest', 'target'], {}), '(dest, target)\n', (807, 821), False, 'import os\n'), ((919, 958), 'os.path.join', 'o... |
import logging
from typing import List, Tuple
import backoff
import sqlalchemy.exc
from climsoft_api.api.flag import schema as flag_schema
from climsoft_api.utils.query import get_count
from fastapi.exceptions import HTTPException
from opencdms.models.climsoft import v4_1_1_core as models
from sqlalchemy.orm.session im... | [
"logging.getLogger",
"logging.basicConfig",
"opencdms.models.climsoft.v4_1_1_core.Flag.description.ilike",
"climsoft_api.api.flag.schema.Flag.from_orm",
"climsoft_api.utils.query.get_count"
] | [((343, 383), 'logging.getLogger', 'logging.getLogger', (['"""ClimsoftFlagService"""'], {}), "('ClimsoftFlagService')\n", (360, 383), False, 'import logging\n'), ((384, 423), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (403, 423), False, 'import logging\n'), ... |
"""The interface that implements ProtocolContext."""
from __future__ import annotations
from abc import abstractmethod, ABC
from dataclasses import dataclass
from typing import (Dict, Optional)
from opentrons import types
from opentrons.hardware_control import API, SynchronousAdapter
from opentrons.protocols.geometr... | [
"dataclasses.dataclass"
] | [((863, 885), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (872, 885), False, 'from dataclasses import dataclass\n')] |
from setuptools import setup
setup(
name="medicus",
version="0.1",
packages=["medicus"]
) | [
"setuptools.setup"
] | [((30, 88), 'setuptools.setup', 'setup', ([], {'name': '"""medicus"""', 'version': '"""0.1"""', 'packages': "['medicus']"}), "(name='medicus', version='0.1', packages=['medicus'])\n", (35, 88), False, 'from setuptools import setup\n')] |
from braintree.successful_result import SuccessfulResult
from braintree.error_result import ErrorResult
from braintree.resource import Resource
from braintree.configuration import Configuration
class Address(Resource):
"""
A class representing Braintree Address objects.
An example of creating an address w... | [
"braintree.configuration.Configuration.gateway"
] | [((1861, 1884), 'braintree.configuration.Configuration.gateway', 'Configuration.gateway', ([], {}), '()\n', (1882, 1884), False, 'from braintree.configuration import Configuration\n'), ((2163, 2186), 'braintree.configuration.Configuration.gateway', 'Configuration.gateway', ([], {}), '()\n', (2184, 2186), False, 'from b... |
#!/usr/bin/env python
"""
Scheduling tactician.
"""
import os
import logging
import numpy as np
import ephem
from collections import OrderedDict as odict
from obztak import get_survey
from obztak.utils.projector import angsep
from obztak.utils import projector as proj
from obztak.ctio import CTIO
from obztak.utils i... | [
"numpy.sqrt",
"ephem.Sun",
"obztak.ctio.CTIO",
"numpy.isfinite",
"ephem.Date",
"argparse.ArgumentParser",
"obztak.utils.projector.angsep",
"numpy.argmin",
"numpy.degrees",
"ephem.Moon",
"collections.OrderedDict",
"numpy.in1d",
"numpy.any",
"numpy.nonzero",
"numpy.char.count",
"obztak.u... | [((391, 609), 'collections.OrderedDict', 'odict', (["[(None, [0.0, 2.0]), ('great', [1.6, 2.0]), ('good', [0.0, 2.0]), (\n 'complete', [0.0, 2.0]), ('maglites', [0.0, 2.0]), ('fine', [0.0, 1.9]),\n ('ok', [0.0, 1.6]), ('poor', [0.0, 1.5]), ('bad', [0.0, 1.4])]"], {}), "([(None, [0.0, 2.0]), ('great', [1.6, 2.0]),... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gym
from ray.rllib.models.action_dist import (
Categorical, Deterministic, DiagGaussian)
from ray.rllib.models.preprocessors import (
NoPreprocessor, AtariRamPreprocessor, AtariPixelPreprocessor... | [
"ray.rllib.models.visionnet.VisionNetwork",
"gym.spaces.box.Box",
"ray.rllib.models.pytorch.visionnet.VisionNetwork",
"ray.rllib.models.fcnet.FullyConnectedNetwork",
"ray.rllib.models.pytorch.fcnet.FullyConnectedNetwork"
] | [((2831, 2882), 'ray.rllib.models.fcnet.FullyConnectedNetwork', 'FullyConnectedNetwork', (['inputs', 'num_outputs', 'options'], {}), '(inputs, num_outputs, options)\n', (2852, 2882), False, 'from ray.rllib.models.fcnet import FullyConnectedNetwork\n'), ((3733, 3783), 'ray.rllib.models.pytorch.fcnet.FullyConnectedNetwor... |
# coding: utf-8
import os
import sys
__author__ = "<NAME> <<EMAIL>>"
def get_clipps_filepath():
"""Automatically return the \"My Clippings.txt\" file path.
As a fallback, call the enter_clipps_filepath() function to prompt the user to provide the \"My Clippings.txt\" file path."""
if os.name == "nt":
... | [
"os.path.isfile",
"sys.exit"
] | [((1902, 1929), 'os.path.isfile', 'os.path.isfile', (['clipps_path'], {}), '(clipps_path)\n', (1916, 1929), False, 'import os\n'), ((968, 995), 'os.path.isfile', 'os.path.isfile', (['clipps_path'], {}), '(clipps_path)\n', (982, 995), False, 'import os\n'), ((1970, 1981), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''Color formatting
'''
# Copyright © 2014 <NAME>
# (kevin 'period' thibedeau 'at' gmail 'punto' com)
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Soft... | [
"os.fstat",
"colorama.init",
"os.getenv"
] | [((1282, 1297), 'colorama.init', 'colorama.init', ([], {}), '()\n', (1295, 1297), False, 'import colorama\n'), ((1509, 1539), 'os.getenv', 'os.getenv', (['"""NO_COLOR"""', '"""false"""'], {}), "('NO_COLOR', 'false')\n", (1518, 1539), False, 'import os\n'), ((1672, 1683), 'os.fstat', 'os.fstat', (['(0)'], {}), '(0)\n', ... |
""" A PointSampleCam emulates a camera which has been calibrated to associate real-world coordinates (xr, yr) with each pixel position (xp, yp). A calibration data file is consulted which provides these associations. """
import pymunk
import numpy as np
from math import atan2, sqrt, fabs
from common import *
from pym... | [
"numpy.delete",
"math.sqrt",
"pyglet.gl.glPointSize",
"numpy.zeros",
"pyglet.graphics.draw",
"math.fabs",
"math.atan2",
"pymunk.ShapeFilter",
"numpy.loadtxt",
"configsingleton.ConfigSingleton.get_instance"
] | [((1019, 1049), 'configsingleton.ConfigSingleton.get_instance', 'ConfigSingleton.get_instance', ([], {}), '()\n', (1047, 1049), False, 'from configsingleton import ConfigSingleton\n'), ((1652, 1693), 'numpy.loadtxt', 'np.loadtxt', (['calib_filename'], {'delimiter': '""","""'}), "(calib_filename, delimiter=',')\n", (166... |
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
pgf_with_custom_preamble = {
"font.family": "serif", # use serif/main font for text elements
"text.usetex": True, # use inline math for ticks
# "pgf.rcfonts": False, # don't setup fonts from rc parameters
"pgf.preamble": [
"\\usep... | [
"argparse.ArgumentParser",
"matplotlib.rcParams.update",
"matplotlib.use",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.min",
"numpy.cumsum",
"numpy.loadtxt",
"numpy.arange"
] | [((44, 58), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (51, 58), True, 'import matplotlib as mpl\n'), ((401, 446), 'matplotlib.rcParams.update', 'mpl.rcParams.update', (['pgf_with_custom_preamble'], {}), '(pgf_with_custom_preamble)\n', (420, 446), True, 'import matplotlib as mpl\n'), ((1377, 1432), ... |
import asyncio
import logging
import traceback
import os
from discord.ext import commands
from discord.ext.commands import UserInputError, MissingPermissions, BotMissingPermissions
from storage import StorageHandler
from util import get_prefix
logger = logging.getLogger('durkabot')
handler = logging.StreamHandler(... | [
"logging.getLogger",
"traceback.format_exc",
"os.listdir",
"logging.StreamHandler",
"asyncio.new_event_loop",
"os.path.join",
"os.environ.get",
"os.path.isdir"
] | [((257, 286), 'logging.getLogger', 'logging.getLogger', (['"""durkabot"""'], {}), "('durkabot')\n", (274, 286), False, 'import logging\n'), ((298, 321), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (319, 321), False, 'import logging\n'), ((1107, 1133), 'os.listdir', 'os.listdir', (['EXTENSIONS_DI... |
from typing import List, Optional
import pickle
import pandas as pd
import numpy as np
from pathlib import Path
from sklearn.pipeline import Pipeline
def fit(
X: pd.DataFrame,
y: pd.Series,
output_dir: str,
class_order: Optional[List[str]] = None,
row_weights: Optional[np.ndarray] = None,
**kw... | [
"pickle.dump",
"pathlib.Path"
] | [((413, 429), 'pathlib.Path', 'Path', (['output_dir'], {}), '(output_dir)\n', (417, 429), False, 'from pathlib import Path\n'), ((573, 599), 'pickle.dump', 'pickle.dump', (['estimator', 'fp'], {}), '(estimator, fp)\n', (584, 599), False, 'import pickle\n')] |
# -*- coding: utf-8 -*-
"""
package.module
~~~~~~~~~~~~~~
A brief description goes here.
:copyright: (c) 2016 by chenxiaofeng.
:license: LICENSE_NAME, see LICENSE_FILE for more details.
"""
from datetime import datetime
from .base import db
class Love(db.Model):
__tablename__ = 'love'
i... | [
"datetime.datetime.now"
] | [((632, 646), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (644, 646), False, 'from datetime import datetime\n')] |
# Generated by Django 3.1.6 on 2021-02-08 11:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('travelapp', '0004_auto_20210208_1400'),
]
operations = [
migrations.AlterField(
model_name='traveler',
name='subscri... | [
"django.db.models.ManyToManyField"
] | [((347, 438), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(True)', 'to': '"""travelapp.Instructor"""', 'verbose_name': '"""Подписки"""'}), "(blank=True, to='travelapp.Instructor', verbose_name=\n 'Подписки')\n", (369, 438), False, 'from django.db import migrations, models\n')] |
'''
Copyright 2017 <NAME>, <NAME>, <NAME> and the Max Planck Gesellschaft. All rights reserved.
This software is provided for research purposes only.
By using this software you agree to the terms of the MANO/SMPL+H Model license here http://mano.is.tue.mpg.de/license
More information about MANO/SMPL+H is available at... | [
"cv2.imwrite",
"numpy.ones_like",
"numpy.eye",
"numpy.random.rand",
"cv2.imshow",
"opendr.renderer.ColoredRenderer",
"numpy.zeros",
"numpy.array",
"cv2.destroyAllWindows",
"psbody.mesh.Mesh",
"psbody.mesh.MeshViewers",
"cv2.waitKey",
"webuser.smpl_handpca_wrapper.load_model"
] | [((2118, 2194), 'webuser.smpl_handpca_wrapper.load_model', 'load_model', (['"""../../models/SMPLH_female.pkl"""'], {'ncomps': '(12)', 'flat_hand_mean': '(False)'}), "('../../models/SMPLH_female.pkl', ncomps=12, flat_hand_mean=False)\n", (2128, 2194), False, 'from webuser.smpl_handpca_wrapper import load_model\n'), ((35... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Generates one ISO14443-A anti-collision process "by-hand" """
from __future__ import print_function
import nfc
MAX_FRAME_LEN = 264
abtRawUid = bytes(12)
abtAtqa = bytes(2)
abtAts = bytes(MAX_FRAME_LEN)
szAts = 0
szCL = 1
quiet_output = False
force_rats = False
timed... | [
"nfc.close",
"nfc.initiator_transceive_bits",
"nfc.device_set_property_bool",
"nfc.initiator_transceive_bits_timed",
"nfc.open",
"nfc.device_get_name",
"nfc.exit",
"nfc.iso14443a_crc_append",
"nfc.perror",
"nfc.print_hex_bits",
"nfc.print_hex",
"nfc.initiator_init",
"nfc.init"
] | [((2458, 2468), 'nfc.init', 'nfc.init', ([], {}), '()\n', (2466, 2468), False, 'import nfc\n'), ((2475, 2492), 'nfc.open', 'nfc.open', (['context'], {}), '(context)\n', (2483, 2492), False, 'import nfc\n'), ((3815, 3856), 'nfc.iso14443a_crc_append', 'nfc.iso14443a_crc_append', (['abtSelectTag', '(7)'], {}), '(abtSelect... |
from datetime import datetime, timedelta
import pytz
import json
import urllib
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.views.decorators.csrf... | [
"zoom.zoom_api.load_json",
"zoom.zoom_api.get_participants",
"django.contrib.auth.models.User.objects.filter",
"zoom.zoom_api.update_meeting",
"django.shortcuts.render",
"django.http.HttpResponseRedirect",
"zoom.zoom_api.list_meetings",
"django.http.HttpResponse",
"json.dumps",
"django.shortcuts.r... | [((2234, 2308), 'zoom.models.Event.objects.create', 'Event.objects.create', ([], {'user': 'request.user', 'event': '"""ST"""', 'meeting_id': 'meeting_id'}), "(user=request.user, event='ST', meeting_id=meeting_id)\n", (2254, 2308), False, 'from zoom.models import Event, Webhook\n'), ((2561, 2577), 'zoom.zoom_api.gen_tok... |
"""
:date_created: 2021-11-03
"""
from do_py.abc import ABCRestrictions
from db_able.base_model.kwargs_validator import KwargsValidator
from db_able.base_model.params import Params
@ABCRestrictions.require('db')
class Database(KwargsValidator):
"""
Abstracted common required attributes and functionality for... | [
"do_py.abc.ABCRestrictions.require",
"db_able.base_model.params.Params"
] | [((186, 215), 'do_py.abc.ABCRestrictions.require', 'ABCRestrictions.require', (['"""db"""'], {}), "('db')\n", (209, 215), False, 'from do_py.abc import ABCRestrictions\n'), ((1038, 1053), 'db_able.base_model.params.Params', 'Params', (['*params'], {}), '(*params)\n', (1044, 1053), False, 'from db_able.base_model.params... |
# Copyright 2019 ZTE corporation. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import tensorflow as tf
from . import repository
from ..models.sources.keras_model_file import KerasModelFile
from ..models.targets.tflite_model import TfLiteModel
from .. import tflite_util
from .. import keras_util
@repo... | [
"tensorflow.keras.models.load_model",
"tensorflow.lite.TFLiteConverter.from_keras_model"
] | [((674, 779), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', ([], {'filepath': 'source.model_path', 'custom_objects': 'custom_objects', 'compile': '(False)'}), '(filepath=source.model_path, custom_objects=\n custom_objects, compile=False)\n', (700, 779), True, 'import tensorflow as tf\n'), ((791... |
from typing import List, Optional, Iterable
import numpy as np
import pandas as pd
from fire import Fire
from icecream import ic
from sacrebleu import sentence_bleu, corpus_bleu
from torchmetrics import ROUGEScore
class OracleReranker:
def __init__(self,
target_path: Optional[str] = None,
... | [
"icecream.ic",
"numpy.repeat",
"fire.Fire",
"sacrebleu.sentence_bleu",
"torchmetrics.ROUGEScore",
"pandas.DataFrame",
"sacrebleu.corpus_bleu"
] | [((6121, 6141), 'fire.Fire', 'Fire', (['OracleReranker'], {}), '(OracleReranker)\n', (6125, 6141), False, 'from fire import Fire\n'), ((2176, 2249), 'pandas.DataFrame', 'pd.DataFrame', (['rows'], {'columns': "['example_index', 'confidence', 'prediction']"}), "(rows, columns=['example_index', 'confidence', 'prediction']... |
#!/usr/bin/python
import json
import random as r
import requests
from credentials import *
# URL Helper
def _url(path):
return 'https://api.ciscospark.com/v1' + path
def get_rooms(at):
headers = {'Authorization': at, 'content-type': 'application/json; charset=utf-8'}
resp = requests.get(url=... | [
"json.loads"
] | [((372, 393), 'json.loads', 'json.loads', (['resp.text'], {}), '(resp.text)\n', (382, 393), False, 'import json\n'), ((817, 838), 'json.loads', 'json.loads', (['resp.text'], {}), '(resp.text)\n', (827, 838), False, 'import json\n')] |
from torch import Tensor
from torch_geometric.data import Data
import torch
import torch_geometric.utils as tu
from torch_scatter import scatter_add
def degree(edge_index: Tensor, direction='out', num_nodes=None, edge_weight=None):
"""calulcates the degree of each node in the graph
Args:
edge_index ... | [
"torch_scatter.scatter_add",
"torch.zeros_like",
"torch_geometric.utils.k_hop_subgraph"
] | [((1787, 1811), 'torch.zeros_like', 'torch.zeros_like', (['data.y'], {}), '(data.y)\n', (1803, 1811), False, 'import torch\n'), ((1044, 1100), 'torch_scatter.scatter_add', 'scatter_add', (['edge_weight', 'row'], {'dim': '(0)', 'dim_size': 'num_nodes'}), '(edge_weight, row, dim=0, dim_size=num_nodes)\n', (1055, 1100), F... |
from datetime import date, timedelta
from django.test import TestCase
from django.urls import reverse
from .models import CorporateMember, IndividualMember, Team
from .utils import get_temporary_image
class IndividualMemberListViewTests(TestCase):
url = reverse('members:individual-members')
@classmethod
... | [
"datetime.timedelta",
"datetime.date.today",
"datetime.date",
"django.urls.reverse"
] | [((262, 299), 'django.urls.reverse', 'reverse', (['"""members:individual-members"""'], {}), "('members:individual-members')\n", (269, 299), False, 'from django.urls import reverse\n'), ((1301, 1337), 'django.urls.reverse', 'reverse', (['"""members:corporate-members"""'], {}), "('members:corporate-members')\n", (1308, 1... |
import re
from wagtail import __version__ as WAGTAIL_VERSION
def is_wagtail_version_more_than_equal_to_2_5():
expression = '^((2.([5-9]{1,}|([1-9]{1,}[0-9]{1,}))(.\d+)*)|(([3-9]{1,})(.\d+)*))$'
return re.search(expression, WAGTAIL_VERSION)
def is_wagtail_version_more_than_equal_to_2_0():
expression = '^((2.([0-... | [
"re.search"
] | [((206, 244), 're.search', 're.search', (['expression', 'WAGTAIL_VERSION'], {}), '(expression, WAGTAIL_VERSION)\n', (215, 244), False, 'import re\n'), ((390, 428), 're.search', 're.search', (['expression', 'WAGTAIL_VERSION'], {}), '(expression, WAGTAIL_VERSION)\n', (399, 428), False, 'import re\n')] |
import re
import string
from collections import Counter
from pathlib import Path
from gutenberg_cleaner import simple_cleaner
from more_itertools import windowed
import nltk
from gender_analysis.text import common
class Document:
"""
The Document class loads and holds the full text and
metadata (author,... | [
"gender_analysis.text.common.download_nltk_package_if_not_present",
"nltk.pos_tag",
"nltk.corpus.stopwords.words",
"nltk.word_tokenize",
"pathlib.Path",
"gutenberg_cleaner.simple_cleaner",
"re.match",
"gender_analysis.text.common.load_txt_to_string",
"collections.Counter"
] | [((10778, 10797), 'pathlib.Path', 'Path', (['self.filepath'], {}), '(self.filepath)\n', (10782, 10797), False, 'from pathlib import Path\n'), ((19038, 19047), 'collections.Counter', 'Counter', ([], {}), '()\n', (19045, 19047), False, 'from collections import Counter\n'), ((21028, 21037), 'collections.Counter', 'Counter... |
import push
from datetime import datetime
from pytz import timezone
import logging
def finaltext(header,posted,attention,url):
logging.info("Inside final text")
ist = timezone('Asia/Kolkata')
try:
logging.info("Making the text")
text= str(datetime.now(ist).strftime("%d-%m-%Y ... | [
"logging.basicConfig",
"pytz.timezone",
"push.push",
"datetime.datetime.now",
"logging.info",
"logging.error"
] | [((142, 175), 'logging.info', 'logging.info', (['"""Inside final text"""'], {}), "('Inside final text')\n", (154, 175), False, 'import logging\n'), ((188, 212), 'pytz.timezone', 'timezone', (['"""Asia/Kolkata"""'], {}), "('Asia/Kolkata')\n", (196, 212), False, 'from pytz import timezone\n'), ((855, 910), 'logging.basic... |
from typing import Dict
import pytest
from pytest_mock import MockerFixture
from easy_notifyer import requests
from easy_notifyer.requests import Requests as Requests
pytestmark = [
pytest.mark.asyncio,
pytest.mark.unit,
]
@pytest.mark.parametrize(
"url, params, result",
[
(
"h... | [
"pytest.mark.parametrize"
] | [((238, 396), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""url, params, result"""', "[('http://example.com', {'foo': 'bar', 'hello': 'world'},\n 'http://example.com?foo=bar&hello=world')]"], {}), "('url, params, result', [('http://example.com', {\n 'foo': 'bar', 'hello': 'world'}, 'http://example.c... |
import arcpy
import pandas as pd
import os
fc = r"C:\\temp\\GasPipelineEnterpriseDataManagement\\Databases\\UPDM_UtilityNetwork.gdb\\UtilityNetwork\\PipelineLine"
field_group_name = 'Limit Material By Asset Type'
def view_cav(table, subtype_field):
index = ['fieldGroupName', 'subtype', 'isRetired', 'id']
dat... | [
"pandas.DataFrame",
"arcpy.Describe",
"arcpy.da.ListContingentValues",
"os.path.basename"
] | [((993, 1011), 'arcpy.Describe', 'arcpy.Describe', (['fc'], {}), '(fc)\n', (1007, 1011), False, 'import arcpy\n'), ((342, 378), 'arcpy.da.ListContingentValues', 'arcpy.da.ListContingentValues', (['table'], {}), '(table)\n', (371, 378), False, 'import arcpy\n'), ((1606, 1626), 'os.path.basename', 'os.path.basename', (['... |
import logging
from traits.api import Int, on_trait_change, List
from force_wfmanager.ui.review.curve_scatter_plot import CurveScatterPlot
log = logging.getLogger(__name__)
_ERROR = 'Unable to interpolate curve through data points'
class SubsetPlot(CurveScatterPlot):
"""A subclass of CurvePlot that only shows... | [
"logging.getLogger",
"traits.api.on_trait_change",
"traits.api.List"
] | [((148, 175), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (165, 175), False, 'import logging\n'), ((509, 518), 'traits.api.List', 'List', (['Int'], {}), '(Int)\n', (513, 518), False, 'from traits.api import Int, on_trait_change, List\n'), ((525, 588), 'traits.api.on_trait_change', 'on_... |
from __future__ import absolute_import, division, print_function
import os
import random
from builtins import range
from scitbx import matrix
import dxtbx
from dxtbx.model import parallax_correction, parallax_correction_inv
def correct_gold(detector, attlen, xy):
s1 = matrix.col(detector.get_lab_coord(xy))
... | [
"random.uniform",
"dxtbx.model.parallax_correction",
"os.path.join",
"dxtbx.load",
"builtins.range",
"scitbx.matrix.col",
"dxtbx.model.parallax_correction_inv"
] | [((394, 424), 'scitbx.matrix.col', 'matrix.col', (['(d[0], d[3], d[6])'], {}), '((d[0], d[3], d[6]))\n', (404, 424), False, 'from scitbx import matrix\n'), ((434, 464), 'scitbx.matrix.col', 'matrix.col', (['(d[1], d[4], d[7])'], {}), '((d[1], d[4], d[7]))\n', (444, 464), False, 'from scitbx import matrix\n'), ((549, 58... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 <NAME> <<EMAIL>>
# Copyright (C) 2007, 2008, 2009 <NAME> <<EMAIL>>
#
# This software's license gives you freedom; you can copy, convey,
# propagate, redistribute and/or modify this program under the terms of
# the GNU Affero General Public License (AG... | [
"pokernetwork.pokerbot.makeService",
"os.path.join",
"os.path.realpath",
"twisted.trial.runner.TestLoader",
"tempfile.mkdtemp",
"twisted.trial.runner.TrialRunner",
"sys.exit",
"twisted.internet.defer.Deferred"
] | [((1003, 1026), 'os.path.realpath', 'path.realpath', (['__file__'], {}), '(__file__)\n', (1016, 1026), False, 'from os import path\n'), ((1047, 1074), 'os.path.join', 'path.join', (['TESTS_PATH', '""".."""'], {}), "(TESTS_PATH, '..')\n", (1056, 1074), False, 'from os import path\n'), ((4590, 4609), 'twisted.trial.runne... |
'''This is a module that tries to use emcee to solve SNooPy models.
The SN object should have all the necessary ingredients. All that is
left is to define prior probabilities.'''
import emcee
import numpy as np
from scipy.optimize import minimize
import types,os
gconst = -0.5*np.log(2*np.pi)
def builtin_priors(x, st... | [
"numpy.shape",
"numpy.sometrue",
"numpy.power",
"numpy.log",
"emcee.EnsembleSampler",
"os.path.isfile",
"numpy.zeros",
"numpy.isfinite",
"numpy.loadtxt",
"numpy.random.randn"
] | [((279, 296), 'numpy.log', 'np.log', (['(2 * np.pi)'], {}), '(2 * np.pi)\n', (285, 296), True, 'import numpy as np\n'), ((1293, 1321), 'numpy.zeros', 'np.zeros', (["(varinfo['Nvar'],)"], {}), "((varinfo['Nvar'],))\n", (1301, 1321), True, 'import numpy as np\n'), ((1330, 1358), 'numpy.zeros', 'np.zeros', (["(varinfo['Nv... |
"""
ETL step wrapper for shell command activity can be executed on Ec2 / EMR
"""
from ..pipeline import S3Node
from ..pipeline import ShellCommandActivity
from ..pipeline import SNSAlarm
from ..s3 import S3Directory
from ..s3 import S3File
from ..s3 import S3Path
from ..config import Config
from ..utils import constant... | [
"logging.getLogger"
] | [((520, 547), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (537, 547), False, 'import logging\n')] |
from celery import chain, group
from celery.utils import uuid
from director.exceptions import WorkflowSyntaxError
from director.extensions import cel, cel_workflows
from director.models import StatusType
from director.models.tasks import Task
from director.models.workflows import Workflow
from director.tasks.workflows... | [
"director.models.tasks.Task",
"director.exceptions.WorkflowSyntaxError",
"director.models.workflows.Workflow.query.filter_by",
"director.tasks.workflows.end.si",
"celery.utils.uuid",
"director.extensions.cel.tasks.get",
"director.tasks.workflows.start.si"
] | [((889, 895), 'celery.utils.uuid', 'uuid', ([], {}), '()\n', (893, 895), False, 'from celery.utils import uuid\n'), ((1190, 1307), 'director.models.tasks.Task', 'Task', ([], {'id': 'task_id', 'key': 'task_name', 'previous': 'self.previous', 'workflow_id': 'self.workflow.id', 'status': 'StatusType.pending'}), '(id=task_... |
#!/usr/bin/env python
# Output formatters (for printing info and data files)
#
# Copyright (C) 2014 <NAME> <<EMAIL>>
import math
from defs import info, data
# Python 2.7 compatibility
if b'' == '':
import functools, itertools
iterbytes = functools.partial(itertools.imap, ord)
else:
iterbytes = iter
class... | [
"math.ceil",
"functools.partial",
"defs.info.unitify"
] | [((248, 286), 'functools.partial', 'functools.partial', (['itertools.imap', 'ord'], {}), '(itertools.imap, ord)\n', (265, 286), False, 'import functools, itertools\n'), ((3605, 3634), 'math.ceil', 'math.ceil', (['(1.0 * n / multiple)'], {}), '(1.0 * n / multiple)\n', (3614, 3634), False, 'import math\n'), ((2892, 2910)... |
from unittest import TestCase
import shapes
class TestShape(TestCase):
def test_initialization1(self):
newpoints = shapes.Shape(shape_name="Tyrannosaurus")
newpoints.add_landmark([1,2])
newpoints.add_landmark([3,2])
newpoints.add_landmark([2,2])
assert(newpoints.name=='Tyr... | [
"shapes.Shape"
] | [((130, 170), 'shapes.Shape', 'shapes.Shape', ([], {'shape_name': '"""Tyrannosaurus"""'}), "(shape_name='Tyrannosaurus')\n", (142, 170), False, 'import shapes\n')] |
"""
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
import ipaddress
import time... | [
"integ_tests.s1aptests.s1ap_utils.SpgwUtil",
"time.sleep",
"unittest.main",
"s1ap_wrapper.TestWrapper",
"ipaddress.ip_address"
] | [((7910, 7925), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7923, 7925), False, 'import unittest\n'), ((652, 678), 's1ap_wrapper.TestWrapper', 's1ap_wrapper.TestWrapper', ([], {}), '()\n', (676, 678), False, 'import s1ap_wrapper\n'), ((705, 715), 'integ_tests.s1aptests.s1ap_utils.SpgwUtil', 'SpgwUtil', ([], {}... |
from reprojection import runSuperGlueSinglePair,image_pair_candidates, runSIFTSinglePair
from ray_dist_loss import preprocess_match, proj_ray_dist_loss_single
import torch
import numpy as np
import os
from random import random
import numpy as np
import torch
import torchvision.transforms as TF
import matplotlib.pypl... | [
"torchvision.transforms.ToPILImage",
"matplotlib.pyplot.imshow",
"reprojection.image_pair_candidates",
"numpy.where",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"ray_dist_loss.proj_ray_dist_loss_single",
"ray_dist_loss.preprocess_match",
"matplotlib.pyplot.savefig",
"torch.einsum",
"to... | [((1325, 1358), 'os.path.join', 'os.path.join', (['dirname', 'scene_name'], {}), '(dirname, scene_name)\n', (1337, 1358), False, 'import os\n'), ((1363, 1401), 'os.makedirs', 'os.makedirs', (['scene_path'], {'exist_ok': '(True)'}), '(scene_path, exist_ok=True)\n', (1374, 1401), False, 'import os\n'), ((1473, 1507), 'os... |
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from sklearn import decomposition
import scipy.signal
import os
import pandas as pd
from skimage.transform import resize
def get_mean(signal: np.ndarray, axis=0):
return signal.mean(axis=axis)
def get_std_dev(signal: np.nd... | [
"numpy.abs",
"sklearn.decomposition.PCA",
"numpy.fft.fft",
"matplotlib.pyplot.clf",
"os.walk",
"os.path.join",
"matplotlib.pyplot.plot",
"numpy.sum",
"matplotlib.pyplot.figure",
"pandas.concat",
"os.path.basename",
"pandas.DataFrame",
"skimage.transform.resize",
"matplotlib.pyplot.cla",
... | [((659, 677), 'numpy.fft.fft', 'np.fft.fft', (['signal'], {}), '(signal)\n', (669, 677), True, 'import numpy as np\n'), ((846, 875), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {'figsize': '(4, 3)'}), '(1, figsize=(4, 3))\n', (856, 875), True, 'import matplotlib.pyplot as plt\n'), ((880, 889), 'matplotlib.pyplo... |
from collections import defaultdict
input = open('d17.in').read()
dimensions = [int(x) for x in filter(None, input.split('\n'))]
dist = defaultdict(int)
for mask in range(1, 1<<len(dimensions)):
p = [d for i,d in enumerate(dimensions) if (mask & (1 << i)) > 0]
if sum(p) == 150:
dist[len(p)] += 1
prin... | [
"collections.defaultdict"
] | [((138, 154), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (149, 154), False, 'from collections import defaultdict\n')] |
import librosa
import numpy as np
import matplotlib.pyplot as plt
from sys import argv
script, content_audio_name, style_audio_name, output_audio_name = argv
N_FFT=2048
def read_audio_spectum(filename):
x, fs = librosa.load(filename, duration=58.04) # Duration=58.05 so as to make sizes convenient
S = librosa.stft(x... | [
"matplotlib.pyplot.imshow",
"numpy.abs",
"librosa.load",
"numpy.angle",
"matplotlib.pyplot.figure",
"librosa.stft",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
] | [((660, 688), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 25)'}), '(figsize=(15, 25))\n', (670, 688), True, 'import matplotlib.pyplot as plt\n'), ((688, 708), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(1)', '(3)', '(1)'], {}), '(1, 3, 1)\n', (699, 708), True, 'import matplotlib.pyplot as plt\n... |
import numpy as np
class Ingredients:
'''
Class for calculations of ingredients inside an area.
'''
def __init__(self, pizza_lines):
self._lines = [list(l) for l in pizza_lines]
self._unique, self._map = np.unique(self._lines, return_inverse=True)
self._map = self._map.reshape(... | [
"numpy.copy",
"numpy.zeros",
"numpy.unique",
"numpy.max"
] | [((238, 281), 'numpy.unique', 'np.unique', (['self._lines'], {'return_inverse': '(True)'}), '(self._lines, return_inverse=True)\n', (247, 281), True, 'import numpy as np\n'), ((674, 716), 'numpy.zeros', 'np.zeros', (['(*self.shape, self.total_unique)'], {}), '((*self.shape, self.total_unique))\n', (682, 716), True, 'im... |
#!/usr/bin/env python
import numpy as np
import argparse
from PIL import Image
import imutils
import cv2
import os
import pprint
import tensorflow as tf
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
ap = argparse.ArgumentParser()
ap.add_argument("-m", "--model", required=True,
help="base path for TFlite dete... | [
"cv2.rectangle",
"PIL.Image.open",
"tensorflow.contrib.lite.Interpreter",
"argparse.ArgumentParser",
"numpy.asarray",
"numpy.squeeze",
"cv2.imshow",
"cv2.putText",
"cv2.waitKey",
"numpy.expand_dims",
"cv2.imread",
"pprint.pprint"
] | [((199, 224), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (222, 224), False, 'import argparse\n'), ((985, 1038), 'tensorflow.contrib.lite.Interpreter', 'tf.contrib.lite.Interpreter', ([], {'model_path': "args['model']"}), "(model_path=args['model'])\n", (1012, 1038), True, 'import tensorflow... |
"""
Display a plot and an image with minimal setup.
pg.plot() and pg.image() are indended to be used from an interactive prompt
to allow easy data inspection (but note that PySide unfortunately does not
call the Qt event loop while the interactive prompt is running, in this case
it is necessary to call QApplica... | [
"numpy.random.normal",
"pyqtgraph.image",
"pyqtgraph.plot",
"pyqtgraph.QtGui.QApplication.exec_"
] | [((510, 537), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(1000)'}), '(size=1000)\n', (526, 537), True, 'import numpy as np\n'), ((539, 596), 'pyqtgraph.plot', 'pg.plot', (['data'], {'title': '"""Simplest possible plotting example"""'}), "(data, title='Simplest possible plotting example')\n", (546, 596), ... |
import six
class InvalidPaddingError(Exception):
pass
class Padding(object):
"""Base class for padding and unpadding."""
def __init__(self, block_size):
self.block_size = block_size
def pad(self, value):
raise NotImplementedError('Subclasses must implement this!')
def unpad(se... | [
"six.b"
] | [((4124, 4134), 'six.b', 'six.b', (['"""*"""'], {}), "('*')\n", (4129, 4134), False, 'import six\n')] |
# pylint: disable=missing-function-docstring
import os
import tempfile
from codemate import File
from tests import examples
def test_save_file():
# If an exception hasn't beaning raised, the test has passed
with tempfile.TemporaryDirectory() as tmp_dirname:
file = File()
path = os.path.join(t... | [
"tests.examples.file.get_syntax",
"tempfile.TemporaryDirectory",
"codemate.File",
"os.path.join",
"tests.examples.file.get_example"
] | [((496, 523), 'tests.examples.file.get_example', 'examples.file.get_example', ([], {}), '()\n', (521, 523), False, 'from tests import examples\n'), ((223, 252), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (250, 252), False, 'import tempfile\n'), ((284, 290), 'codemate.File', 'File', ... |
#**************************************************************************
#* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
#* *
#* Author: The ALICE Off-line Project. *
#* Contributors ... | [
"scipy.optimize.fsolve",
"PWGJE.EMCALJetTasks.Tracks.analysis.base.SpectrumFitter.TriggeredSpectrumFitter",
"PWGJE.EMCALJetTasks.Tracks.analysis.base.SpectrumFitter.MinBiasFitter"
] | [((1853, 1880), 'scipy.optimize.fsolve', 'fsolve', (['model', 'initialGuess'], {}), '(model, initialGuess)\n', (1859, 1880), False, 'from scipy.optimize import fsolve\n'), ((2216, 2243), 'scipy.optimize.fsolve', 'fsolve', (['model', 'initialGuess'], {}), '(model, initialGuess)\n', (2222, 2243), False, 'from scipy.optim... |
# https://www.hackerrank.com/challenges/find-angle/problem
import math
AB = int(input())
BC = int(input())
h = math.sqrt(pow(AB, 2) + pow(BC, 2))
print(str(round(math.degrees(math.acos(BC / h)))) + '°')
| [
"math.acos"
] | [((177, 194), 'math.acos', 'math.acos', (['(BC / h)'], {}), '(BC / h)\n', (186, 194), False, 'import math\n')] |
import json
import requests
import streamlit as st
st.set_page_config(layout="wide", page_title="Hebrew Safe Harbor", initial_sidebar_state="collapsed")
from visualizer import visualize_response
DEFAULT_TEXT = "גדעון לבנה הגיע היום לבית החולים שערי צדק עם תלונות על כאבים בחזה"
PATH = r"../resources_old"
URL = "http... | [
"streamlit.form",
"json.loads",
"requests.post",
"streamlit.expander",
"json.dumps",
"streamlit.code",
"visualizer.visualize_response",
"streamlit.error",
"streamlit.text_area",
"streamlit.set_page_config",
"streamlit.form_submit_button",
"streamlit.title"
] | [((53, 158), 'streamlit.set_page_config', 'st.set_page_config', ([], {'layout': '"""wide"""', 'page_title': '"""Hebrew Safe Harbor"""', 'initial_sidebar_state': '"""collapsed"""'}), "(layout='wide', page_title='Hebrew Safe Harbor',\n initial_sidebar_state='collapsed')\n", (71, 158), True, 'import streamlit as st\n')... |
import unittest
from src.main_program import *
class TestMainProgram(unittest.TestCase):
def test_calculate_chek_1(self):
a = dict(gas=0, water=0, electricity=0)
self.assertEqual('Verification was successful', calculate_chek('gas', 3, a))
self.assertEqual('Verification was successful', ca... | [
"unittest.main"
] | [((1599, 1614), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1612, 1614), False, 'import unittest\n')] |
from flask import escape
def handle_chat(request):
"""HTTP Cloud Function that handles all chatbot requests."""
request_json = request.get_json(silent=True)
request_args = request.args
if request_json and 'name' in request_json:
name = request_json['name']
elif request_args and 'name' in r... | [
"flask.escape"
] | [((432, 444), 'flask.escape', 'escape', (['name'], {}), '(name)\n', (438, 444), False, 'from flask import escape\n')] |
from collections import OrderedDict
import torch.nn as nn
class ModelBook:
"""Maintain the mapping between modules and their paths.
Example:
book = ModelBook(model_ft)
for p, m in book.conv2d_modules():
print('path:', p, 'num of filters:', m.out_channels)
as... | [
"collections.OrderedDict"
] | [((446, 459), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (457, 459), False, 'from collections import OrderedDict\n'), ((483, 496), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (494, 496), False, 'from collections import OrderedDict\n')] |
# Copyright (c) 2019 UAVCAN Consortium
# This software is distributed under the terms of the MIT License.
# Author: <NAME> <<EMAIL>>
import asyncio
import socket as socket_
import typing
import pytest
from pytest import raises
import pyuavcan
from pyuavcan.transport import OutputSessionSpecifier, MessageDataSpecifier,... | [
"pyuavcan.transport.Timestamp.now",
"pyuavcan.transport.SessionStatistics",
"socket.socket",
"pyuavcan.transport.PayloadMetadata",
"pyuavcan.transport.Transfer",
"pyuavcan.transport.commons.crc.CRC32C.new",
"pytest.raises",
"pyuavcan.transport.MessageDataSpecifier",
"socket.inet_aton",
"pyuavcan.t... | [((653, 668), 'pyuavcan.transport.Timestamp.now', 'Timestamp.now', ([], {}), '()\n', (666, 668), False, 'from pyuavcan.transport import Timestamp, ServiceDataSpecifier\n'), ((680, 704), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (702, 704), False, 'import asyncio\n'), ((1189, 1240), 'socket.s... |