code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.contrib import admin
from .models import ClientProfile, Profile
admin.site.register(Profile)
admin.site.register(ClientProfile)
| [
"django.contrib.admin.site.register"
] | [((78, 106), 'django.contrib.admin.site.register', 'admin.site.register', (['Profile'], {}), '(Profile)\n', (97, 106), False, 'from django.contrib import admin\n'), ((107, 141), 'django.contrib.admin.site.register', 'admin.site.register', (['ClientProfile'], {}), '(ClientProfile)\n', (126, 141), False, 'from django.con... |
"""Commands related to rolling the dice"""
# Third-party
from discord.ext import commands
# Application
from utils.cog import ImprovedCog
from utils.dice_roll import DiceRoll
from utils.embed import create_warning_embed
from utils.settings import get_user_settings, get_user_shortcuts
# -----------------------------... | [
"utils.embed.create_warning_embed",
"utils.dice_roll.DiceRoll",
"utils.settings.get_user_settings",
"utils.settings.get_user_shortcuts",
"discord.ext.commands.command"
] | [((916, 934), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (932, 934), False, 'from discord.ext import commands\n'), ((1687, 1705), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (1703, 1705), False, 'from discord.ext import commands\n'), ((2595, 2613), 'discord.ext.comma... |
"""This would provide postprocessing of results.
Libraries/Modules:
Would use: numpy\n
Would use: pandas\n
"""
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits import mplot3d
from bin.NavierStokes import NavierStokes
class flo103_PostProcessor:
"""Not impleme... | [
"matplotlib.pyplot.contourf",
"numpy.abs",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axes",
"numpy.min",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((1622, 1660), 'matplotlib.pyplot.plot', 'plt.plot', (['x[1:-1, 1:-1]', 'y[1:-1, 1:-1]'], {}), '(x[1:-1, 1:-1], y[1:-1, 1:-1])\n', (1630, 1660), True, 'from matplotlib import pyplot as plt\n'), ((1667, 1682), 'matplotlib.pyplot.title', 'plt.title', (['"""xc"""'], {}), "('xc')\n", (1676, 1682), True, 'from matplotlib i... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import PostgresDB
class ColecaoDAO:
def __init__(self):
self.pg = PostgresDB.PostgresDB()
self.pg.connect()
self.colecaoDict = dict()
def retrieveAll(self):
query = "SELECT * FROM colecao"
rows = self.pg.executeQuery(query)
for row in rows:
self.colecao... | [
"PostgresDB.PostgresDB"
] | [((118, 141), 'PostgresDB.PostgresDB', 'PostgresDB.PostgresDB', ([], {}), '()\n', (139, 141), False, 'import PostgresDB\n')] |
def resolve():
'''
code here
'''
import collections
N = int(input())
A_list = [[int(item) for item in input().split()] for _ in range(N)]
A_list.sort(key=lambda x:x[0])
# print(A_list)
T = [[0 for _ in range(7)] for _ in range(N)]
# bfs
def bfs(root):
que = collecti... | [
"collections.deque"
] | [((312, 346), 'collections.deque', 'collections.deque', (['[[root, 0, -1]]'], {}), '([[root, 0, -1]])\n', (329, 346), False, 'import collections\n'), ((1233, 1263), 'collections.deque', 'collections.deque', (['[[node, 0]]'], {}), '([[node, 0]])\n', (1250, 1263), False, 'import collections\n'), ((1734, 1759), 'collectio... |
#!/usr/bin/env python3
from socket import AF_INET, socket, SOCK_STREAM
from threading import Thread
clients = {}
addresses = {}
def incoming_connections():
"""Configuration des clients entrant - connection"""
while True:
client, client_address = SERVER.accept()
print("%s:%s connected." % clie... | [
"threading.Thread",
"socket.socket"
] | [((1433, 1461), 'socket.socket', 'socket', (['AF_INET', 'SOCK_STREAM'], {}), '(AF_INET, SOCK_STREAM)\n', (1439, 1461), False, 'from socket import AF_INET, socket, SOCK_STREAM\n'), ((1630, 1665), 'threading.Thread', 'Thread', ([], {'target': 'incoming_connections'}), '(target=incoming_connections)\n', (1636, 1665), Fals... |
import os
# os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
"""
error: /proc/driver/nvidia/version does not exist
Setting the CUDA_VISIBLE_DEVICES variable to 0,1
in python: os.environ["CUDA_VISIBLE_DEVICES"] = "0"
"""
##
import tensorflow as tf
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))... | [
"tensorflow.device",
"tensorflow.Session",
"tensorflow.constant",
"tensorflow.matmul",
"tensorflow.ConfigProto"
] | [((352, 371), 'tensorflow.device', 'tf.device', (['"""/gpu:0"""'], {}), "('/gpu:0')\n", (361, 371), True, 'import tensorflow as tf\n'), ((381, 448), 'tensorflow.constant', 'tf.constant', (['[1.0, 2.0, 3.0, 4.0, 5.0, 6.0]'], {'shape': '[2, 3]', 'name': '"""a"""'}), "([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a... |
# Generated by Django 2.1 on 2018-08-13 05:56
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('location', '0001_initial'),
migrations.swappable_dependency(setti... | [
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey"
] | [((283, 340), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (314, 340), False, 'from django.db import migrations, models\n'), ((478, 574), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.... |
import sys
sys.path.append('../configs')
sys.path.append('../utils')
sys.path.append('../tfops')
# ../utils
from reader import read_npy
# ../config
from path import CIFARPROCESSED
from info import CIFARNCLASS
def test1():
val_embed = read_npy(CIFARPROCESSED+'val_image.npy')
val_label = read_npy(CIFARPROCE... | [
"reader.read_npy",
"sys.path.append"
] | [((11, 40), 'sys.path.append', 'sys.path.append', (['"""../configs"""'], {}), "('../configs')\n", (26, 40), False, 'import sys\n'), ((41, 68), 'sys.path.append', 'sys.path.append', (['"""../utils"""'], {}), "('../utils')\n", (56, 68), False, 'import sys\n'), ((69, 96), 'sys.path.append', 'sys.path.append', (['"""../tfo... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('welcome', '0009_auto_20170412_2052'),
]
operations = [
migrations.AddField(
model_name='article',
na... | [
"django.db.models.ImageField",
"django.db.models.PositiveIntegerField"
] | [((354, 451), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'default': '(0)', 'verbose_name': "b'\\xe5\\x9b\\x9e\\xe5\\xa4\\x8d\\xe9\\x87\\x8f'"}), "(default=0, verbose_name=\n b'\\xe5\\x9b\\x9e\\xe5\\xa4\\x8d\\xe9\\x87\\x8f')\n", (381, 451), False, 'from django.db import migrations, ... |
import pandas as pd
import mysql.connector
from mysql.connector import errorcode
# the parameters to connect mysql
USER = 'root'
PASSWORD = '<PASSWORD>'
HOST = '127.0.0.1'
DATABASE = 'yelp'
# delete tables if exit
delete_queries = ["drop table if exists reviews"]
# table structures
TABLES = {}
TABLES['reviews'] = (
... | [
"pandas.to_datetime",
"pandas.read_csv",
"pandas.set_option"
] | [((1041, 1090), 'pandas.read_csv', 'pd.read_csv', (['"""./crawl data/reviews.csv"""'], {'header': '(0)'}), "('./crawl data/reviews.csv', header=0)\n", (1052, 1090), True, 'import pandas as pd\n'), ((1118, 1160), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', ... |
# -*- coding: utf-8 -*-
import os
import click
import logging
import requests
from tqdm import tqdm
from requests.adapters import HTTPAdapter
from multiprocessing import Queue
from multiprocessing import Manager
from multiprocessing import Pool as ProcessPool
from multiprocessing.pool import ThreadPool
from six.moves... | [
"logging.basicConfig",
"logging.getLogger",
"click.argument",
"requests.session",
"os.path.exists",
"os.path.getsize",
"click.option",
"click.help_option",
"requests.adapters.HTTPAdapter",
"six.moves.urllib.parse.urlparse",
"multiprocessing.pool.ThreadPool",
"multiprocessing.Pool",
"multipro... | [((370, 388), 'requests.session', 'requests.session', ([], {}), '()\n', (386, 388), False, 'import requests\n'), ((516, 673), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(name)-25s %(asctime)s %(levelname)-8s %(lineno)-4d %(message)s"""', 'datefmt': '"""[%Y %b %d %a %H:%M... |
from django.contrib import admin
from apps.audit.models import AuditLog
admin.site.register(AuditLog)
| [
"django.contrib.admin.site.register"
] | [((74, 103), 'django.contrib.admin.site.register', 'admin.site.register', (['AuditLog'], {}), '(AuditLog)\n', (93, 103), False, 'from django.contrib import admin\n')] |
#
# Python GUI - Containers - PyObjC version
#
from AppKit import NSView
from GUI.Utils import PyGUI_Flipped_NSView
from GUI import export
from GUI.GContainers import Container as GContainer
class Container(GContainer):
# _ns_inner_view NSView Containing NSView for subcomponents
# def __init__(self, _ns_vie... | [
"GUI.GContainers.Container._remove",
"GUI.export",
"GUI.GContainers.Container._add"
] | [((844, 861), 'GUI.export', 'export', (['Container'], {}), '(Container)\n', (850, 861), False, 'from GUI import export\n'), ((587, 614), 'GUI.GContainers.Container._add', 'GContainer._add', (['self', 'comp'], {}), '(self, comp)\n', (602, 614), True, 'from GUI.GContainers import Container as GContainer\n'), ((693, 723),... |
# This script demonstrates changing the state of hardware
# handshake lines. While the script is running, you can see
# the DTR LED in the CoolTerm window blinking.
#
# Author: <NAME>, 04-30-2020
# CoolTerm version: 1.7.0
import sys
import time
import CoolTerm
s = CoolTerm.CoolTermSocket()
# Get the ID of the first o... | [
"CoolTerm.CoolTermSocket",
"time.sleep",
"sys.exit"
] | [((266, 291), 'CoolTerm.CoolTermSocket', 'CoolTerm.CoolTermSocket', ([], {}), '()\n', (289, 291), False, 'import CoolTerm\n'), ((397, 407), 'sys.exit', 'sys.exit', ([], {}), '()\n', (405, 407), False, 'import sys\n'), ((601, 616), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (611, 616), False, 'import time\n... |
'''
Library for 2-component Flory-Huggings theory.
Author: <NAME>
Date created: 23 March 2022
'''
import numpy as np
def help():
print('Here are the list of functions included in FH.py:\n')
print(' critical(n = 1): returns the critical concentration and critical interaction [phi_c, chi_c]\n')
print(' spinodal(c... | [
"numpy.copy",
"numpy.sqrt",
"numpy.power",
"numpy.exp",
"numpy.array"
] | [((907, 929), 'numpy.array', 'np.array', (['[phi_c, x_c]'], {}), '([phi_c, x_c])\n', (915, 929), True, 'import numpy as np\n'), ((2589, 2615), 'numpy.array', 'np.array', (['[pp, 1 - pp, xx]'], {}), '([pp, 1 - pp, xx])\n', (2597, 2615), True, 'import numpy as np\n'), ((4035, 4057), 'numpy.array', 'np.array', (['[p1, p2,... |
import torch
import gpytorch
from gpytorch.mlls import ExactMarginalLogLikelihood
from botorch.models.gp_regression import SingleTaskGP
from gpytorch.kernels import RBFKernel, ScaleKernel
from online_gp.utils import regression
class OnlineExactRegression(torch.nn.Module):
def __init__(self, stem, init_x, init_y,... | [
"torch.optim.lr_scheduler.CosineAnnealingLR",
"gpytorch.settings.skip_logdet_forward",
"gpytorch.mlls.ExactMarginalLogLikelihood",
"gpytorch.kernels.RBFKernel",
"online_gp.utils.regression.evaluate",
"torch.no_grad",
"torch.Size",
"torch.cat"
] | [((853, 908), 'gpytorch.mlls.ExactMarginalLogLikelihood', 'ExactMarginalLogLikelihood', (['self.gp.likelihood', 'self.gp'], {}), '(self.gp.likelihood, self.gp)\n', (879, 908), False, 'from gpytorch.mlls import ExactMarginalLogLikelihood\n'), ((1773, 1828), 'gpytorch.mlls.ExactMarginalLogLikelihood', 'ExactMarginalLogLi... |
import csv
def count_covid_approval(pattern):
"""
Cuenta el número de filas que contiene el patrón introducido.
:param pattern: string
:return: int
"""
with open("data/covid_approval_polls.csv", "r") as csvfile:
reader = csv.reader(csvfile)
next(reader, None)
rowcount =... | [
"csv.reader"
] | [((255, 274), 'csv.reader', 'csv.reader', (['csvfile'], {}), '(csvfile)\n', (265, 274), False, 'import csv\n')] |
# -*- coding: UTF-8 -*-
"""
@author: auhjin
@file:views.py
@time:2021/06/16
"""
from flask import session, current_app, render_template, jsonify, request, g
from info.models import User, News, Category
from info.modules.index import index_blue
from info.utils.commons import user_login_data
from info.utils.response_cod... | [
"flask.render_template",
"flask.request.args.get",
"flask.g.user.to_dict",
"flask.current_app.logger.error",
"info.models.News.query.order_by",
"info.modules.index.index_blue.route",
"info.models.News.query.paginate",
"info.models.Category.query.all",
"flask.current_app.send_static_file",
"flask.j... | [((406, 435), 'info.modules.index.index_blue.route', 'index_blue.route', (['"""/newslist"""'], {}), "('/newslist')\n", (422, 435), False, 'from info.modules.index import index_blue\n'), ((2068, 2114), 'info.modules.index.index_blue.route', 'index_blue.route', (['"""/"""'], {'methods': "['GET', 'POST']"}), "('/', method... |
import csv
import json
from json import JSONDecodeError
from time import time
import config
from dependencies.mariadb import db
from utils.files import data_filename
class Base:
db = db
primary_key = 'id'
table_name = ''
column_names = list()
column_types = list()
column_titles = list()
s... | [
"json.loads",
"json.dumps",
"csv.writer",
"time.time",
"utils.files.data_filename",
"csv.reader"
] | [((10431, 10454), 'utils.files.data_filename', 'data_filename', (['basename'], {}), '(basename)\n', (10444, 10454), False, 'from utils.files import data_filename\n'), ((10703, 10812), 'csv.writer', 'csv.writer', (['f'], {'delimiter': 'config.CSV_DELIMITER', 'quotechar': 'config.CSV_QUOTECHAR', 'quoting': 'csv.QUOTE_MIN... |
# @Author : <NAME>
# @Email : <EMAIL>
#this program laucnhes all the simulation
import os, sys, stat, platform
import pickle
import shutil
import CoreFiles.Set_Outputs as Set_Outputs
from subprocess import check_call
def initiateprocess(MainPath):
#return a list of file name to launch with energyplus. If som... | [
"os.path.exists",
"os.listdir",
"pickle.dump",
"os.path.join",
"pickle.load",
"os.chdir",
"os.rmdir",
"platform.system",
"os.mkdir",
"os.path.normcase"
] | [((413, 433), 'os.listdir', 'os.listdir', (['MainPath'], {}), '(MainPath)\n', (423, 433), False, 'import os, sys, stat, platform\n'), ((650, 687), 'os.path.join', 'os.path.join', (['filepath', '"""Sim_Results"""'], {}), "(filepath, 'Sim_Results')\n", (662, 687), False, 'import os, sys, stat, platform\n'), ((1006, 1034)... |
import enpix
import numpy as np
matrix = np.random.rand(341,765,3)
# print(matrix)
key="firstname.lastname@<EMAIL>.com-nameofuser-mobilenumber"
time=1000000
pic = enpix.encrypt(matrix,key,time)
# print(pic)
pic2 = enpix.decrypt(pic,key,time)
# print(pic2)
print((matrix==pic2).all()) | [
"enpix.decrypt",
"numpy.random.rand",
"enpix.encrypt"
] | [((42, 69), 'numpy.random.rand', 'np.random.rand', (['(341)', '(765)', '(3)'], {}), '(341, 765, 3)\n', (56, 69), True, 'import numpy as np\n'), ((166, 198), 'enpix.encrypt', 'enpix.encrypt', (['matrix', 'key', 'time'], {}), '(matrix, key, time)\n', (179, 198), False, 'import enpix\n'), ((218, 247), 'enpix.decrypt', 'en... |
# sphinx_gallery_thumbnail_number = 4
from __future__ import absolute_import
from . import _graph as __graph
from ._graph import *
from .. import Configuration
from . import opt
from . opt import multicut
from . opt import lifted_multicut
from . opt import mincut
from . opt import minstcut
import numpy
from functool... | [
"numpy.ones_like",
"numpy.ones",
"numpy.arange",
"numpy.where",
"numpy.require",
"numpy.random.random",
"networkx.draw_spring",
"networkx.Graph",
"numpy.stack",
"numpy.random.randint",
"numpy.dtype",
"networkx.draw"
] | [((1793, 1868), 'numpy.random.randint', 'numpy.random.randint', ([], {'low': '(0)', 'high': '(numberOfNodes - 1)', 'size': '(numberOfEdges * 2)'}), '(low=0, high=numberOfNodes - 1, size=numberOfEdges * 2)\n', (1813, 1868), False, 'import numpy\n'), ((3908, 3945), 'numpy.require', 'numpy.require', (['offsets'], {'dtype'... |
import argparse
from textwrap import dedent
from mygit.state import State
from mygit.constants import Constants
from mygit.command import Command
from mygit.backend import create_new_branch_from_current_and_checkout, checkout_to_branch
class Checkout(Command):
def __init__(self, subparsers: argparse._SubParsersAc... | [
"mygit.backend.checkout_to_branch",
"textwrap.dedent",
"mygit.backend.create_new_branch_from_current_and_checkout"
] | [((378, 981), 'textwrap.dedent', 'dedent', (['"""\n Restore workspace state so it becomes identical to another branch\'s recorded state\n\n Usage examples:\n mygit checkout expl restore expl branch workspace\n Note: you can\'t checkout with ind... |
"""
The filehelp-system allows for defining help files outside of the game. These
will be treated as non-command help entries and displayed in the same way as
help entries created using the `sethelp` default command. After changing an
entry on-disk you need to reload the server to have the change show in-game.
An file... | [
"evennia.locks.lockhandler.LockHandler",
"django.utils.text.slugify",
"evennia.utils.logger.error",
"evennia.utils.logger.log_err",
"evennia.utils.utils.all_from_module",
"evennia.utils.utils.make_iter",
"evennia.utils.utils.variable_from_module"
] | [((3197, 3214), 'evennia.locks.lockhandler.LockHandler', 'LockHandler', (['self'], {}), '(self)\n', (3208, 3214), False, 'from evennia.locks.lockhandler import LockHandler\n'), ((6067, 6132), 'evennia.utils.utils.variable_from_module', 'variable_from_module', (['module_or_path'], {'variable': '"""HELP_ENTRY_DICTS"""'})... |
from keras.metrics import top_k_categorical_accuracy
import pytest
import os
import sys
parentdir=os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parentdir)
from models import resnet_34, resnet_50
def _test_model_compile(model):
model.compile(optimizer='adam', loss='categorical_cros... | [
"os.path.abspath",
"sys.path.insert",
"models.resnet_50",
"pytest.main"
] | [((159, 188), 'sys.path.insert', 'sys.path.insert', (['(0)', 'parentdir'], {}), '(0, parentdir)\n', (174, 188), False, 'import sys\n'), ((453, 502), 'models.resnet_50', 'resnet_50', ([], {'input_shape': '(224, 224, 3)', 'classes': '(102)'}), '(input_shape=(224, 224, 3), classes=102)\n', (462, 502), False, 'from models ... |
import os
import pdb
import pandas as pd
import pickle as pkl
import torch
from torch.utils.data import Dataset, DataLoader
class DetectionDataset(Dataset):
def __init__(self, dslice):
"""Load the datasets
Args:
dslice: data slice (train, test, or val)
"""
dir... | [
"os.path.join"
] | [((327, 400), 'os.path.join', 'os.path.join', (['"""/scratch/users/georgech/data/preprocessed_binary/"""', 'dslice'], {}), "('/scratch/users/georgech/data/preprocessed_binary/', dslice)\n", (339, 400), False, 'import os\n'), ((431, 464), 'os.path.join', 'os.path.join', (['dirname', '"""true.pth"""'], {}), "(dirname, 't... |
# Generated by Django 3.1.1 on 2020-09-12 13:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('expense', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='expenseitem',
name='date_purchased',
... | [
"django.db.models.DecimalField",
"django.db.models.DateField"
] | [((338, 356), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (354, 356), False, 'from django.db import migrations, models\n'), ((493, 568), 'django.db.models.DecimalField', 'models.DecimalField', ([], {'blank': '(True)', 'decimal_places': '(2)', 'max_digits': '(50)', 'null': '(True)'}), '(blank=Tru... |
'''
Authors: <NAME>, <NAME>
'''
# FIXME Behebe möglichen fehler mit Flask:
# https://github.com/flask-restful/flask-restful/pull/913
# import flask.scaffold
# flask.helpers._endpoint_from_view_func = flask.scaffold._endpoint_from_view_func
from hashlib import sha1
from flask import Flask, request as req
from flask_res... | [
"flask_cors.CORS",
"flask_restful.Api",
"flask.Flask",
"flask.request.get_data",
"os.environ.get",
"dotenv.load_dotenv",
"flask.request.get_json",
"flask.request.headers.get"
] | [((494, 509), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (499, 509), False, 'from flask import Flask, request as req\n'), ((510, 546), 'flask_cors.CORS', 'CORS', (['app'], {'supports_credentials': '(True)'}), '(app, supports_credentials=True)\n', (514, 546), False, 'from flask_cors import CORS\n'), ((5... |
from concurrent.futures import ThreadPoolExecutor
class RulesEngine:
def __init__(self, *rules):
self.rules = rules
def reject(self, *tags):
"""Returns a new instance without the rules matching any of the given tags."""
return self.__class__(*filter(lambda rule: not rule.matches(*tags... | [
"concurrent.futures.ThreadPoolExecutor"
] | [((1183, 1203), 'concurrent.futures.ThreadPoolExecutor', 'ThreadPoolExecutor', ([], {}), '()\n', (1201, 1203), False, 'from concurrent.futures import ThreadPoolExecutor\n')] |
# -*- coding: utf-8 -*-
"""
(c) 2015-2016 - Copyright Red Hat Inc
Authors:
<NAME> <<EMAIL>>
"""
from __future__ import unicode_literals, absolute_import
import unittest
import sys
import os
import wtforms
sys.path.insert(
0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
)
import pagure.... | [
"tests.create_projects",
"os.path.join",
"os.path.abspath",
"wtforms.validators.Optional",
"unittest.main",
"tests.FakeUser",
"tests.user_set"
] | [((4414, 4440), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (4427, 4440), False, 'import unittest\n'), ((1794, 1810), 'tests.FakeUser', 'tests.FakeUser', ([], {}), '()\n', (1808, 1810), False, 'import tests\n'), ((269, 294), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), ... |
""" builds nested routes for auth """
from fastapi import APIRouter
from . import user, login, logout
def get_router():
""" returns all routes as nested router in the auth package """
router = APIRouter()
router.include_router(user.router, prefix='/users', tags=['User Actions'])
router.include_route... | [
"fastapi.APIRouter"
] | [((205, 216), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (214, 216), False, 'from fastapi import APIRouter\n')] |
from collections import OrderedDict
from logging import getLogger
from pathlib import Path
from typing import List
import pandas as pd
from accent_analyser.core.cluster_rules import (cluster_fingerprints,
get_fingerprint)
from accent_analyser.core.rule_detection import (... | [
"logging.getLogger",
"collections.OrderedDict",
"accent_analyser.core.rule_detection.df_to_data",
"accent_analyser.core.rule_detection.get_phone_occurrences",
"pandas.read_csv",
"accent_analyser.core.rule_detection.get_rules_from_words",
"pathlib.Path",
"accent_analyser.core.cluster_rules.get_fingerpr... | [((653, 672), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (662, 672), False, 'from logging import getLogger\n'), ((691, 781), 'text_utils.ipa2symb.IPAExtractionSettings', 'IPAExtractionSettings', ([], {'ignore_arcs': '(True)', 'ignore_tones': '(True)', 'replace_unknown_ipa_by': '"""_"""'}), "(... |
class Tileset:
_loaded_sets = dict()
@classmethod
def from_image(cls, tile_width, tile_height, filename) -> "Tileset":
key = (tile_width, tile_height, filename)
if key not in cls._loaded_sets:
ts = Tileset(tile_width, tile_height)
ts.load(filename)
cls... | [
"PIL.Image.open"
] | [((956, 972), 'PIL.Image.open', 'Image.open', (['file'], {}), '(file)\n', (966, 972), False, 'from PIL import Image\n')] |
from micropython import const
SINGLE_WRITE = const(0x00)
BURST_WRITE = const(0x40)
SINGLE_READ = const(0x80)
BURST_READ = const(0xc0)
LOW = const(0x00)
HIGH = const(0x01)
# TODO: find a better name for this class
class EspSPI(object):
def __init__(self, spi, cs, gdo0=None, gdo2=None):
self.spi = spi
... | [
"micropython.const"
] | [((46, 54), 'micropython.const', 'const', (['(0)'], {}), '(0)\n', (51, 54), False, 'from micropython import const\n'), ((72, 81), 'micropython.const', 'const', (['(64)'], {}), '(64)\n', (77, 81), False, 'from micropython import const\n'), ((98, 108), 'micropython.const', 'const', (['(128)'], {}), '(128)\n', (103, 108),... |
import re
import requests
from bs4 import BeautifulSoup
from django.http import HttpResponseRedirect
from django.shortcuts import render
best_websites_data = ['https://analytics.moz.com', 'https://youcandothecube.com', 'https://www.wikihow.com',
'https://www.wired.com', 'https://www.samsung.com'... | [
"django.shortcuts.render",
"django.http.HttpResponseRedirect",
"re.compile",
"requests.get",
"bs4.BeautifulSoup",
"re.sub"
] | [((17878, 17906), 'django.shortcuts.render', 'render', (['request', '"""home.html"""'], {}), "(request, 'home.html')\n", (17884, 17906), False, 'from django.shortcuts import render\n'), ((17942, 17973), 'django.shortcuts.render', 'render', (['request', '"""results.html"""'], {}), "(request, 'results.html')\n", (17948, ... |
"""\
PEP INFO
PEP 754 -- IEEE 754 Floating Point Special Values
Status: Rejected
Created: 2003-03-28
MODULE INFO
This module implements NaN, PosInf, NegInf and the functions
in PEP 754.
REFERENCES
PEP 754: <https://www.python.org/dev/peps/pep-0754/>
"""
PEP = 754
import math as _math
NaN = float('nan')
PosInf = ... | [
"math.isinf",
"math.isfinite",
"math.isnan"
] | [((387, 405), 'math.isnan', '_math.isnan', (['value'], {}), '(value)\n', (398, 405), True, 'import math as _math\n'), ((592, 613), 'math.isfinite', '_math.isfinite', (['value'], {}), '(value)\n', (606, 613), True, 'import math as _math\n'), ((651, 669), 'math.isinf', '_math.isinf', (['value'], {}), '(value)\n', (662, 6... |
from rest_framework.views import APIView
from rest_framework.generics import GenericAPIView
from rest_framework.request import Request
from rest_framework.response import Response
from rest_framework.filters import SearchFilter
from rest_framework import status
from management.utils import admin
from django.http import... | [
"management.utils.admin.api_permission",
"rest_framework.response.Response"
] | [((2278, 2306), 'management.utils.admin.api_permission', 'admin.api_permission', (['"""view"""'], {}), "('view')\n", (2298, 2306), False, 'from management.utils import admin\n'), ((2423, 2450), 'management.utils.admin.api_permission', 'admin.api_permission', (['"""add"""'], {}), "('add')\n", (2443, 2450), False, 'from ... |
import urllib2
import json
#Get json data from Weather Underground by using IP address
f = urllib2.urlopen('http://api.wunderground.com/api/***KEY***/conditions/forecast/hourly/q/autoip.json')
json_string = f.read()
parsed_json = json.loads(json_string)
#Current Location and Observation Time
location = parse... | [
"json.loads",
"urllib2.urlopen"
] | [((96, 207), 'urllib2.urlopen', 'urllib2.urlopen', (['"""http://api.wunderground.com/api/***KEY***/conditions/forecast/hourly/q/autoip.json"""'], {}), "(\n 'http://api.wunderground.com/api/***KEY***/conditions/forecast/hourly/q/autoip.json'\n )\n", (111, 207), False, 'import urllib2\n'), ((237, 260), 'json.loads'... |
import os
import re
import sys
header_regex = '^([^\s]*) [0-9]+ ([0-9]+) ?[0-9]*\n$'
def extract_info(chunk):
return {
'rev': re.search(header_regex, chunk[0]).group(1),
'author': re.search('author (.*)', chunk[1]).group(1),
'email': re.search('author-mail <(.*)>', chunk[2]).group(1),
... | [
"os.popen",
"re.match",
"re.search"
] | [((526, 539), 'os.popen', 'os.popen', (['cmd'], {}), '(cmd)\n', (534, 539), False, 'import os\n'), ((141, 174), 're.search', 're.search', (['header_regex', 'chunk[0]'], {}), '(header_regex, chunk[0])\n', (150, 174), False, 'import re\n'), ((203, 237), 're.search', 're.search', (['"""author (.*)"""', 'chunk[1]'], {}), "... |
import numpy as np
from experiments.target_lnpdfs.Lnpdf import LNPDF
import tensorflow as tf
import tensorflow_probability as tfp
tfd = tfp.distributions
tfb = tfp.bijectors
class PlanarRobot(LNPDF):
def __init__(self, num_links, num_goals, prior_std=2e-1, likelihood_std=1e-2):
self._num_dimensions = num_... | [
"tensorflow.stack",
"tensorflow.reduce_sum",
"numpy.ones",
"tensorflow.zeros"
] | [((549, 578), 'numpy.ones', 'np.ones', (['self._num_dimensions'], {}), '(self._num_dimensions)\n', (556, 578), True, 'import numpy as np\n'), ((359, 377), 'numpy.ones', 'np.ones', (['num_links'], {}), '(num_links)\n', (366, 377), True, 'import numpy as np\n'), ((457, 476), 'tensorflow.zeros', 'tf.zeros', (['num_links']... |
""" A simple logging module for Pythonista.
Logs are saved in to './logs' where '.' is the 'slog.py' parent's parent (i.e. slog.py/../../logs/) directory
Requires Python3.6+
Copyright (c) 2021 <NAME>
"""
from datetime import datetime as dt
import os
from pathlib import Path
import sys
import traceback as tb
_pyfile_... | [
"traceback.something",
"datetime.datetime.now",
"os.environ.get",
"pathlib.Path"
] | [((741, 749), 'datetime.datetime.now', 'dt.now', ([], {}), '()\n', (747, 749), True, 'from datetime import datetime as dt\n'), ((1387, 1413), 'os.environ.get', 'os.environ.get', (['"""STASHLOG"""'], {}), "('STASHLOG')\n", (1401, 1413), False, 'import os\n'), ((366, 380), 'pathlib.Path', 'Path', (['__file__'], {}), '(__... |
# coding: utf8
import time
class Funnel(object):
def __init__(self, capacity, leaking_rate):
self.capacity = capacity # 漏斗容量
self.leaking_rate = leaking_rate # 漏嘴流水速率
self.left_quota = capacity # 漏斗剩余空间
self.leaking_ts = time.time() # 上一次漏水时间
def make_space(self):
... | [
"time.time",
"time.sleep"
] | [((1339, 1352), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1349, 1352), False, 'import time\n'), ((263, 274), 'time.time', 'time.time', ([], {}), '()\n', (272, 274), False, 'import time\n'), ((330, 341), 'time.time', 'time.time', ([], {}), '()\n', (339, 341), False, 'import time\n')] |
"""Backend Server for Demo.
Loads pretrained model for inference."""
import os
import sys
from absl import app as application
from flask import Flask, json, jsonify, make_response, request
from flask_classful import FlaskView, route
import torch
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file... | [
"flask_classful.route",
"demo.predict.Inference",
"demo.visualize.visualize_question_attention",
"flask.Flask",
"absl.app.run",
"os.path.abspath",
"torch.flatten",
"flask.jsonify"
] | [((496, 511), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (501, 511), False, 'from flask import Flask, json, jsonify, make_response, request\n'), ((664, 714), 'flask_classful.route', 'route', (['"""/GetAnswerVizwiz"""'], {'methods': "['GET', 'POST']"}), "('/GetAnswerVizwiz', methods=['GET', 'POST'])\n",... |
from django.conf import settings
from django.conf.urls import url
from django.conf.urls.static import static
from .views import (
MapSettingsView,
OverlayMetaView,
OverlayList,
)
urlpatterns = [
url(r'^$', OverlayList.as_view(), name='overlay-list'),
url(r'^metadata/$', OverlayMetaView.as_view(), name='o... | [
"django.conf.urls.static.static",
"django.conf.urls.url"
] | [((459, 522), 'django.conf.urls.static.static', 'static', (['settings.STATIC_URL'], {'document_root': 'settings.STATIC_ROOT'}), '(settings.STATIC_URL, document_root=settings.STATIC_ROOT)\n', (465, 522), False, 'from django.conf.urls.static import static\n'), ((542, 603), 'django.conf.urls.static.static', 'static', (['s... |
import random
import sys
import re
import time
from PyRTF import *
def build_chain(text, chain = {}):
words = text.split(' ')
index = 1
for word in words[index:]:
key = words[index - 1]
if key in chain:
chain[key].append(word)
else:
chain[key] =... | [
"time.strftime",
"random.choice"
] | [((1017, 1039), 'time.strftime', 'time.strftime', (['"""%x %X"""'], {}), "('%x %X')\n", (1030, 1039), False, 'import time\n'), ((598, 625), 'random.choice', 'random.choice', (['chain[word1]'], {}), '(chain[word1])\n', (611, 625), False, 'import random\n')] |
from hashlib import sha256
from hmac import HMAC
import os
class Encrypt(object):
def encrypt(self, password, salt=None):
if salt is None:
salt = os.urandom(8)
result = password.encode('utf-8')
for i in range(10):
result = HMAC(result, salt, sha256).digest()
... | [
"os.urandom",
"hmac.HMAC"
] | [((173, 186), 'os.urandom', 'os.urandom', (['(8)'], {}), '(8)\n', (183, 186), False, 'import os\n'), ((278, 304), 'hmac.HMAC', 'HMAC', (['result', 'salt', 'sha256'], {}), '(result, salt, sha256)\n', (282, 304), False, 'from hmac import HMAC\n')] |
from PIL import Image
from DealData.FileOperation import FileOperation
import os
class DealImg:
def __init__(self, save_dir, img_dir):
self.__fileOp = FileOperation()
self.__save_dir = save_dir
self.__img_dir = img_dir
def run(self):
person_set = self.__fileOp.get_sub_dirs(sel... | [
"PIL.Image.open",
"os.path.join",
"DealData.FileOperation.FileOperation"
] | [((165, 180), 'DealData.FileOperation.FileOperation', 'FileOperation', ([], {}), '()\n', (178, 180), False, 'from DealData.FileOperation import FileOperation\n'), ((1115, 1135), 'PIL.Image.open', 'Image.open', (['img_path'], {}), '(img_path)\n', (1125, 1135), False, 'from PIL import Image\n'), ((389, 425), 'os.path.joi... |
# pylint: disable=no-self-use,invalid-name
from __future__ import absolute_import
from collections import defaultdict
from allennlp.common.testing import AllenNlpTestCase
from allennlp.data import Token, Vocabulary
from allennlp.data.token_indexers import TokenCharactersIndexer
from allennlp.data.tokenizers.character... | [
"allennlp.data.Vocabulary",
"allennlp.data.token_indexers.TokenCharactersIndexer",
"collections.defaultdict",
"allennlp.data.tokenizers.character_tokenizer.CharacterTokenizer",
"allennlp.data.Token"
] | [((482, 519), 'allennlp.data.token_indexers.TokenCharactersIndexer', 'TokenCharactersIndexer', (['u"""characters"""'], {}), "(u'characters')\n", (504, 519), False, 'from allennlp.data.token_indexers import TokenCharactersIndexer\n'), ((1213, 1250), 'allennlp.data.token_indexers.TokenCharactersIndexer', 'TokenCharacters... |
"""
PlexGDM.py - Version 0.3
This class implements the Plex GDM (G'Day Mate) protocol to discover
local Plex Media Servers. Also allow client registration into all local
media servers.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as publis... | [
"threading.Thread",
"time.sleep",
"socket.inet_aton",
"socket.socket"
] | [((3327, 3395), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM', 'socket.IPPROTO_UDP'], {}), '(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)\n', (3340, 3395), False, 'import socket\n'), ((5658, 5673), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (5668, 5673), False, 'import... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.util.deprecation.deprecated_args"
] | [((1143, 1287), 'tensorflow.python.util.deprecation.deprecated_args', 'deprecation.deprecated_args', (['"""2018-10-01"""', '"""`use_locking = True` is no longer supported and will be ignored."""', "('use_locking', [False])"], {}), "('2018-10-01',\n '`use_locking = True` is no longer supported and will be ignored.', ... |
from distutils.core import setup
from os import path
from utilsx import __version__
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='utilsx',
packages=['utilsx', 'utilsx.discord', 'uti... | [
"os.path.dirname",
"os.path.join",
"distutils.core.setup"
] | [((248, 1184), 'distutils.core.setup', 'setup', ([], {'name': '"""utilsx"""', 'packages': "['utilsx', 'utilsx.discord', 'utilsx.console']", 'version': '__version__', 'license': '"""MIT"""', 'description': '"""The public Xiler python utility library."""', 'project_urls': "{'Documentation': 'https://docs.xiler.net/utilsx... |
#!/usr/bin/env python3
#
# Usage:
#
# $ ./scripts/runtests.py -g onnx_real --show_log |& tee log
# $ ./scripts/parse_elapsed.py log
import re
import sys
tests = {}
cur_test = None
with open(sys.argv[1]) as f:
for line in f:
m = re.match(r'^Running for out/onnx_real_(.*?)/', line)
if m:
... | [
"re.match"
] | [((243, 294), 're.match', 're.match', (['"""^Running for out/onnx_real_(.*?)/"""', 'line'], {}), "('^Running for out/onnx_real_(.*?)/', line)\n", (251, 294), False, 'import re\n'), ((377, 418), 're.match', 're.match', (['"""^Elapsed: (\\\\d+\\\\.\\\\d+)"""', 'line'], {}), "('^Elapsed: (\\\\d+\\\\.\\\\d+)', line)\n", (3... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sn
df = pd.read_csv('height_weight.csv')
print(df.info())
print(df.describe())
#kernel density estimation
#kernel is specifying how data is smoothened. Here Gaussian is used
#violin plot also uses gaussian
sb.kdeplot(df["height"... | [
"matplotlib.pyplot.hist2d",
"seaborn.kdeplot",
"pandas.read_csv",
"matplotlib.pyplot.show"
] | [((98, 130), 'pandas.read_csv', 'pd.read_csv', (['"""height_weight.csv"""'], {}), "('height_weight.csv')\n", (109, 130), True, 'import pandas as pd\n'), ((448, 520), 'matplotlib.pyplot.hist2d', 'plt.hist2d', (["df['height']", "df['weight']"], {'bins': '(20)', 'cmap': '"""magma"""', 'alpha': '(0.3)'}), "(df['height'], d... |
from setuptools import setup
setup(
name='iqualitypy',
version='0.0.2',
description='Python iQuality API library',
license='MIT',
packages=['iqualitpy'],
author='<NAME>',
author_email='<EMAIL>',
keywords=['iquality', 'api', 'library', 'timetracking'],
url='https://github.com/acarmis... | [
"setuptools.setup"
] | [((30, 344), 'setuptools.setup', 'setup', ([], {'name': '"""iqualitypy"""', 'version': '"""0.0.2"""', 'description': '"""Python iQuality API library"""', 'license': '"""MIT"""', 'packages': "['iqualitpy']", 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'keywords': "['iquality', 'api', 'library', 'timetrack... |
import sys
import random
from flask import Flask, render_template, jsonify, request
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
from dateutil import parser as dp
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///article_place.db'
app.config["SQLALCHEMY_TRACK_MODIFICATIO... | [
"flask.render_template",
"datetime.datetime",
"flask.request.args.get",
"dateutil.parser.parse",
"flask.Flask",
"dbconfig.Place.query.join",
"dbconfig.Article.query.filter",
"datetime.datetime.now",
"flask_sqlalchemy.SQLAlchemy",
"flask.jsonify"
] | [((195, 210), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (200, 210), False, 'from flask import Flask, render_template, jsonify, request\n'), ((339, 354), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (349, 354), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((433, 462), ... |
import discord
from discord.ext import commands,tasks
import datetime
import math
import random
from discord.ext.commands.errors import CommandNotFound
import youtube_dl
from discord_minesweeper import *
recomendacoes = []
with open('lista_de_filmes.txt','r') as recomendacao:
for linha in recomendacao:
re... | [
"random.choice",
"discord.ext.commands.Bot",
"datetime.datetime.now",
"discord.ext.tasks.loop",
"discord.Embed"
] | [((353, 383), 'discord.ext.commands.Bot', 'commands.Bot', (['"""!"""'], {'online': '(True)'}), "('!', online=True)\n", (365, 383), False, 'from discord.ext import commands, tasks\n'), ((6053, 6074), 'discord.ext.tasks.loop', 'tasks.loop', ([], {'seconds': '(1)'}), '(seconds=1)\n', (6063, 6074), False, 'from discord.ext... |
"""PreProcess Data
Process data for training.
.. helpdoc::
This widget pre-processes data so that it can be more efficiently used in prediction. This involves removing predictors with near zero variance (using nearZeroVar()), predictors with high correlation (using findCorrelation()), and reducing predictors ... | [
"redRGUI.base.textEdit",
"libraries.RedRCaret.signalClasses.CaretData.CaretData",
"redRGUI.base.lineEdit",
"libraries.RedRCaret.signalClasses.CaretModelFit.CaretModelFit",
"redRGUI.base.gridBox",
"redRGUI.base.commitButton"
] | [((2323, 2361), 'redRGUI.base.gridBox', 'redRGUI.base.gridBox', (['self.controlArea'], {}), '(self.controlArea)\n', (2343, 2361), False, 'import redRGUI, signals\n'), ((2720, 2791), 'redRGUI.base.lineEdit', 'redRGUI.base.lineEdit', (['self.nzvBox'], {'label': '"""Frequency Cut:"""', 'text': '"""95/5"""'}), "(self.nzvBo... |
"""create
Revision ID: 61632731b77a
Revises:
Create Date: 2021-06-23 19:03:03.028445
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '61632731b77a'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated b... | [
"sqlalchemy.ForeignKeyConstraint",
"alembic.op.drop_table",
"alembic.op.f",
"sqlalchemy.Boolean",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Text",
"sqlalchemy.Integer",
"sqlalchemy.SmallInteger",
"sqlalchemy.String"
] | [((2051, 2074), 'alembic.op.drop_table', 'op.drop_table', (['"""stages"""'], {}), "('stages')\n", (2064, 2074), False, 'from alembic import op\n'), ((2277, 2301), 'alembic.op.drop_table', 'op.drop_table', (['"""authors"""'], {}), "('authors')\n", (2290, 2301), False, 'from alembic import op\n'), ((818, 847), 'sqlalchem... |
import typing as typ
from io import StringIO
import pathlib
import attr
from ..utils.smart_yaml import smart_yaml_loader
from .attrs_serializable import AttrsSerializable as Serializable
from .data_item import UID
PathLike = typ.Union[str, pathlib.Path]
@attr.s(auto_attribs=True)
class ServiceManager(object):
... | [
"attr.s",
"attr.ib"
] | [((259, 284), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (265, 284), False, 'import attr\n'), ((368, 389), 'attr.ib', 'attr.ib', ([], {'factory': 'dict'}), '(factory=dict)\n', (375, 389), False, 'import attr\n')] |
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QPushButton, QComboBox
from PyQt5.QtGui import QIcon, QPalette, QColor
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtCore import Qt
class Application:
app = QApplication(sys.argv)
widget = QWidget()
def __init__(self):
style... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QComboBox",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QPushButton"
] | [((235, 257), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (247, 257), False, 'from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QPushButton, QComboBox\n'), ((271, 280), 'PyQt5.QtWidgets.QWidget', 'QWidget', ([], {}), '()\n', (278, 280), False, 'from PyQt5.QtWidgets impor... |
from django.urls import include, path
from django.conf.urls import url
from rest_framework import routers
from . import views
# router = routers.DefaultRouter()
# router.register('jobpostings', views.JobPostingList)
# router.register('jobpostings/<int:id>', views.JobPostingDetail)
urlpatterns = [
# url(r'^jobpost... | [
"django.urls.path"
] | [((443, 485), 'django.urls.path', 'path', (['"""jobpostings/"""', 'views.JobPostingList'], {}), "('jobpostings/', views.JobPostingList)\n", (447, 485), False, 'from django.urls import include, path\n'), ((491, 545), 'django.urls.path', 'path', (['"""jobpostings/<int:pk>/"""', 'views.JobPostingDetails'], {}), "('jobpost... |
import os
import glob
import json
import datetime as dt
import pandas as pd
from flask import (
Blueprint,
jsonify,
request,
url_for,
redirect,
render_template,
send_from_directory,
flash,
)
from werkzeug import secure_filename
from .table_builder import create_data, search_page_table... | [
"flask.render_template",
"pandas.Series",
"json.loads",
"flask.send_from_directory",
"flask.flash",
"os.path.join",
"os.path.splitext",
"flask.url_for",
"flask.redirect",
"datetime.datetime.now",
"werkzeug.secure_filename",
"os.getcwd",
"os.path.basename",
"flask.Blueprint",
"flask.jsoni... | [((662, 690), 'flask.Blueprint', 'Blueprint', (['"""views"""', '__name__'], {}), "('views', __name__)\n", (671, 690), False, 'from flask import Blueprint, jsonify, request, url_for, redirect, render_template, send_from_directory, flash\n'), ((3181, 3205), 'flask.jsonify', 'jsonify', ([], {'file_id': 'file_id'}), '(file... |
import os
import subprocess
import itertools
import pytest
from click.testing import CliRunner
from hobbit import main as hobbit
from hobbit.bootstrap import templates
from . import BaseTest, rmdir, chdir
class TestHobbit(BaseTest):
wkdir = os.path.abspath('hobbit-tox-test')
def setup_method(self, method)... | [
"itertools.product",
"click.testing.CliRunner",
"os.getcwd",
"os.chdir",
"subprocess.call",
"os.path.abspath"
] | [((250, 284), 'os.path.abspath', 'os.path.abspath', (['"""hobbit-tox-test"""'], {}), "('hobbit-tox-test')\n", (265, 284), False, 'import os\n'), ((396, 420), 'os.chdir', 'os.chdir', (['self.root_path'], {}), '(self.root_path)\n', (404, 420), False, 'import os\n'), ((853, 944), 'itertools.product', 'itertools.product', ... |
import grpc
from loguru import logger
import bbgo_pb2
import bbgo_pb2_grpc
from bbgo.data import UserDataEvent
def main():
host = '127.0.0.1'
port = 50051
address = f'{host}:{port}'
channel = grpc.insecure_channel(address)
stub = bbgo_pb2_grpc.UserDataServiceStub(channel)
request = bbgo_pb2.... | [
"bbgo.data.UserDataEvent.from_pb",
"loguru.logger.info",
"grpc.insecure_channel",
"bbgo_pb2_grpc.UserDataServiceStub",
"bbgo_pb2.UserDataRequest"
] | [((211, 241), 'grpc.insecure_channel', 'grpc.insecure_channel', (['address'], {}), '(address)\n', (232, 241), False, 'import grpc\n'), ((253, 295), 'bbgo_pb2_grpc.UserDataServiceStub', 'bbgo_pb2_grpc.UserDataServiceStub', (['channel'], {}), '(channel)\n', (286, 295), False, 'import bbgo_pb2_grpc\n'), ((311, 350), 'bbgo... |
import numpy as np
from typing import List, Literal
from .constraint import Constraint
from .parameter import Parameter
class LinearConstraint(Constraint):
"""
Represents a linear constraint. Either an equality constraint :math:`Ax = b`, or an inequality constraint
:math:`Ax \\geq b`, where :math:`A \\i... | [
"numpy.concatenate"
] | [((1375, 1395), 'numpy.concatenate', 'np.concatenate', (['args'], {}), '(args)\n', (1389, 1395), True, 'import numpy as np\n')] |
import HTMLParser
import json
import random
import re
import urllib2
import urlparse
def clean_title(title):
if title == None: return
title = re.sub('&#(\d+);', '', title)
title = re.sub('(&#[0-9]+)([^;^0-9]+)', '\\1;\\2', title)
title = title.replace('"', '\"').replace('&', '&')
title = ... | [
"re.sub",
"random.choice",
"HTMLParser.HTMLParser"
] | [((152, 182), 're.sub', 're.sub', (['"""&#(\\\\d+);"""', '""""""', 'title'], {}), "('&#(\\\\d+);', '', title)\n", (158, 182), False, 'import re\n'), ((194, 243), 're.sub', 're.sub', (['"""(&#[0-9]+)([^;^0-9]+)"""', '"""\\\\1;\\\\2"""', 'title'], {}), "('(&#[0-9]+)([^;^0-9]+)', '\\\\1;\\\\2', title)\n", (200, 243), Fals... |
"""
Problem Statement
----------------
Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array.
Input
-----
list of numbers
Output
-------
the missing number
"""
def missing_number(nums):
if 0 not in nums:
return 0
n ... | [
"doctest.testmod"
] | [((529, 546), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (544, 546), False, 'import doctest\n')] |
from datetime import timedelta
from django.utils import timezone
from rest_framework.response import Response
from game.models import AppUser, Game
url = "/api/monthly_scoreboard"
def get_response(api_client) -> Response:
return api_client.get(url)
def test_when_no_users(api_client):
AppUser.objects.all(... | [
"game.models.AppUser",
"game.models.Game.objects.bulk_create",
"django.utils.timezone.now",
"datetime.timedelta",
"game.models.AppUser.objects.bulk_create",
"game.models.AppUser.objects.all",
"game.models.AppUser.objects.get"
] | [((1085, 1119), 'game.models.AppUser.objects.bulk_create', 'AppUser.objects.bulk_create', (['users'], {}), '(users)\n', (1112, 1119), False, 'from game.models import AppUser, Game\n'), ((2034, 2068), 'game.models.AppUser.objects.bulk_create', 'AppUser.objects.bulk_create', (['users'], {}), '(users)\n', (2061, 2068), Fa... |
# GUI Application automation and testing library
# Copyright (C) 2006 <NAME>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your optio... | [
"sys.path.append"
] | [((953, 974), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (968, 974), False, 'import sys\n')] |
import torch
from torch import nn
from torch.distributions import Categorical
from torch.optim import Adam, SGD, ASGD
import torch.multiprocessing as mp
import os
from multiprocessing import Process, Queue
import queue
import numpy
import argparse
import glob
#from matplotlib import pyplot as plot
import copy... | [
"numpy.random.rand",
"utils.copy_params",
"numpy.iinfo",
"torch.from_numpy",
"torch.exp",
"numpy.mod",
"gym.make",
"argparse.ArgumentParser",
"conv.Player",
"torch.set_num_threads",
"numpy.max",
"numpy.stack",
"ff.Value",
"torch.multiprocessing.set_start_method",
"conv.Value",
"torch.m... | [((638, 661), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (655, 661), False, 'import torch\n'), ((775, 794), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (787, 794), False, 'import torch\n'), ((799, 834), 'torch.set_num_threads', 'torch.set_num_threads', (['args.n_cores'],... |
# Generated by Django 3.1.4 on 2021-01-01 16:52
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | [
"django.db.migrations.swappable_dependency",
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((257, 314), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (288, 314), False, 'from django.db import migrations, models\n'), ((493, 586), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
import pygame
from pygame import sprite
from settings import PROJECT_PATH, ENEMY_DEFAULT_SIZE, BRUTALISK_POINTS
class Brutalisk(sprite.Sprite):
def __init__(self, x_pos, y_pos):
sprite.Sprite.__init__(self)
self.image = pygame.transform.scale(pygame.image.load(PROJECT_PATH +
... | [
"pygame.image.load",
"pygame.sprite.Sprite.__init__"
] | [((192, 220), 'pygame.sprite.Sprite.__init__', 'sprite.Sprite.__init__', (['self'], {}), '(self)\n', (214, 220), False, 'from pygame import sprite\n'), ((265, 331), 'pygame.image.load', 'pygame.image.load', (["(PROJECT_PATH + '/brutalisk/images/enemy1_1.png')"], {}), "(PROJECT_PATH + '/brutalisk/images/enemy1_1.png')\n... |
from __future__ import annotations
from asyncio import Queue
from typing import Tuple
import pytest
from brood.command import Command, Event
from brood.config import CommandConfig, OnceConfig
from brood.constants import ON_WINDOWS
from brood.fanout import Fanout
from brood.message import CommandMessage, Message
from... | [
"brood.fanout.Fanout",
"brood.command.Command.start",
"brood.config.OnceConfig",
"pytest.mark.parametrize",
"brood.utils.drain_queue"
] | [((1453, 1516), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""command"""', "['echo hi', 'echo hi 1>&2']"], {}), "('command', ['echo hi', 'echo hi 1>&2'])\n", (1476, 1516), False, 'import pytest\n'), ((2036, 2113), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""command, exit_code"""', "[('exit... |
# Copyright (c) FIRST and other WPILib contributors.
# Open Source Software; you can modify and/or share it under the terms of
# the WPILib BSD license file in the root directory of this project.
import math
import commands2
import wpilib
import wpilib.drive
from sensors.romigyro import RomiGyro
class Drivetrain(c... | [
"wpilib.BuiltInAccelerometer",
"wpilib.drive.KilloughDrive",
"wpilib.Encoder",
"sensors.romigyro.RomiGyro",
"wpilib.Spark"
] | [((599, 614), 'wpilib.Spark', 'wpilib.Spark', (['(0)'], {}), '(0)\n', (611, 614), False, 'import wpilib\n'), ((641, 656), 'wpilib.Spark', 'wpilib.Spark', (['(1)'], {}), '(1)\n', (653, 656), False, 'import wpilib\n'), ((739, 754), 'wpilib.Spark', 'wpilib.Spark', (['(2)'], {}), '(2)\n', (751, 754), False, 'import wpilib\... |
"""
Generator of Sample Pages for the Example Embedded Site
"""
from flask import Blueprint, render_template, request # The "request" package makes available a GLOBAL request object
from navigation.navigation import get_site_pages # Navigation configuration for this site
class SamplePagesRouting:
"""
... | [
"flask.Blueprint",
"navigation.navigation.get_site_pages"
] | [((1503, 1616), 'flask.Blueprint', 'Blueprint', (['cls.blueprint_name', '__name__'], {'template_folder': 'cls.template_folder', 'static_folder': 'cls.static_folder'}), '(cls.blueprint_name, __name__, template_folder=cls.template_folder,\n static_folder=cls.static_folder)\n', (1512, 1616), False, 'from flask import B... |
import os
import re
import csv
import sys
import json
import time
import errno
import random
import urllib
import logging
import datetime
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
#driver = webdriver.Chrome('./cdriver/chromedriver.exe')
#
#driver.get("https://www.wg-gesucht.de/en/")... | [
"json.dumps",
"requests.Session"
] | [((359, 377), 'requests.Session', 'requests.Session', ([], {}), '()\n', (375, 377), False, 'import requests\n'), ((1539, 1558), 'json.dumps', 'json.dumps', (['payload'], {}), '(payload)\n', (1549, 1558), False, 'import json\n')] |
import SimpleITK as sitk
data_mha = open('data_mha.txt', 'r')
mha_dir = data_mha.readlines()
data_nii = open('data_nii.txt', 'r')
nii_dir = data_nii.readlines()
for i in range(len(mha_dir)):
print(i)
path, _ = mha_dir[i].split("\n")
savepath, _ = nii_dir[i].split("\n")
img = sitk.ReadImage(path)
si... | [
"SimpleITK.ReadImage",
"SimpleITK.WriteImage"
] | [((293, 313), 'SimpleITK.ReadImage', 'sitk.ReadImage', (['path'], {}), '(path)\n', (307, 313), True, 'import SimpleITK as sitk\n'), ((318, 348), 'SimpleITK.WriteImage', 'sitk.WriteImage', (['img', 'savepath'], {}), '(img, savepath)\n', (333, 348), True, 'import SimpleITK as sitk\n')] |
# from pudb.remote import set_trace as st
# from remote_pdb import RemotePdb
# from ipdb import set_trace as st
# from pdb import set_trace as st
# from web_pdb import set_trace as st
import io
import os
import requests
import json
from pdf2image import convert_from_path
from typing import List
import boto3
from googl... | [
"google.oauth2.service_account.Credentials.from_service_account_info",
"json.loads",
"os.listdir",
"boto3.client",
"os.getenv",
"google.cloud.vision.ImageAnnotatorClient",
"requests.get",
"io.open",
"google.cloud.vision.types.Image",
"boto3.resource",
"pdf2image.convert_from_path",
"os.remove"... | [((910, 946), 'os.getenv', 'os.getenv', (['"""GOOGLE_CREDENTIALS_DICT"""'], {}), "('GOOGLE_CREDENTIALS_DICT')\n", (919, 946), False, 'import os\n'), ((1059, 1094), 'json.loads', 'json.loads', (['google_credentiaol_dict'], {}), '(google_credentiaol_dict)\n', (1069, 1094), False, 'import json\n'), ((1113, 1182), 'google.... |
from mtanchor.data import wiki_data, prepare_dictionary
from mtanchor.utils import convert_2dlist, get_top_topic_words
import anchor.topics
DEBUG = True
language1 = 'en'
language2 = 'zh'
K=20
SEED=34
TOP = 15
data1, data2 = wiki_data(language1, language2, DEBUG)
dct = prepare_dictionary(data1['index'], data2['index'... | [
"mtanchor.utils.convert_2dlist",
"mtanchor.data.prepare_dictionary",
"mtanchor.data.wiki_data",
"mtanchor.utils.get_top_topic_words"
] | [((227, 265), 'mtanchor.data.wiki_data', 'wiki_data', (['language1', 'language2', 'DEBUG'], {}), '(language1, language2, DEBUG)\n', (236, 265), False, 'from mtanchor.data import wiki_data, prepare_dictionary\n'), ((272, 322), 'mtanchor.data.prepare_dictionary', 'prepare_dictionary', (["data1['index']", "data2['index']"... |
# coding=utf-8
from typing import List
import Stmt
import Environment
from Return import Return
class LoxCallable:
def __init__(self):
pass
def __call__(self, interpreter, arguments: List[object]):
return None
@property
def arity(self):
return 0
class L... | [
"Environment.Environment"
] | [((696, 733), 'Environment.Environment', 'Environment.Environment', (['self.closure'], {}), '(self.closure)\n', (719, 733), False, 'import Environment\n'), ((1461, 1498), 'Environment.Environment', 'Environment.Environment', (['self.closure'], {}), '(self.closure)\n', (1484, 1498), False, 'import Environment\n')] |
"""This is a collection of helper functions"""
import pandas as pd
def null_count(df):
"""Checks a DataFrame for nulls and returns the number of missing values"""
return df.isnull().sum()
def list_2_series(list_2_series, df):
new_series = pd.Series(list_2_series)
df['New_Column'] = new_series
cla... | [
"pandas.Series"
] | [((256, 280), 'pandas.Series', 'pd.Series', (['list_2_series'], {}), '(list_2_series)\n', (265, 280), True, 'import pandas as pd\n'), ((657, 672), 'pandas.Series', 'pd.Series', (['list'], {}), '(list)\n', (666, 672), True, 'import pandas as pd\n')] |
from django.contrib import admin
from .models import RLeave, RProgress
# Register your models here.
admin.site.register(RProgress)
@admin.register(RLeave)
class RleaveAdmin(admin.ModelAdmin):
list_display = ('subject', 'leavedate', 'approve', 'user')
| [
"django.contrib.admin.site.register",
"django.contrib.admin.register"
] | [((101, 131), 'django.contrib.admin.site.register', 'admin.site.register', (['RProgress'], {}), '(RProgress)\n', (120, 131), False, 'from django.contrib import admin\n'), ((135, 157), 'django.contrib.admin.register', 'admin.register', (['RLeave'], {}), '(RLeave)\n', (149, 157), False, 'from django.contrib import admin\... |
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
from scipy.stats import norm
import time
import os
from demoire.epll.epll import EPLLhalfQuadraticSplit
from demoire.epll.utils import get_gs_matrix
def process(noiseI, GS, matpath, DC):
patchSize = 8
noiseSD = 25/255
# same to... | [
"PIL.Image.open",
"matplotlib.pyplot.imsave",
"os.path.join",
"os.path.realpath",
"os.path.dirname",
"numpy.array",
"numpy.empty",
"os.path.basename",
"demoire.epll.utils.get_gs_matrix"
] | [((1508, 1542), 'demoire.epll.utils.get_gs_matrix', 'get_gs_matrix', ([], {'path': 'matpath', 'DC': 'DC'}), '(path=matpath, DC=DC)\n', (1521, 1542), False, 'from demoire.epll.utils import get_gs_matrix\n'), ((2604, 2645), 'matplotlib.pyplot.imsave', 'plt.imsave', (['resultpath', 'cleanI'], {'cmap': 'cmap'}), '(resultpa... |
# board/models.py
from django.contrib.auth.models import User
from django.db import models
class Article(models.Model):
title = models.CharField(max_length=120, null=False)
author = models.ForeignKey(User, on_delete=models.CASCADE)
content = models.TextField(null=False)
created_at = models.DateTimeFie... | [
"django.db.models.DateTimeField",
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((134, 178), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(120)', 'null': '(False)'}), '(max_length=120, null=False)\n', (150, 178), False, 'from django.db import models\n'), ((192, 241), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'on_delete': 'models.CASCADE'}), '(User, ... |
from flask import render_template,request,redirect,url_for,abort
from . import main
from .forms import PostForm, CommentForm, UpdateProfile, SubscribeForm
from ..models import User, Post, Comment, Subscriber
from flask_login import login_required, current_user
from .. import db, photos
from .. request import get_quote
... | [
"flask.render_template",
"flask.abort",
"flask.url_for"
] | [((489, 557), 'flask.render_template', 'render_template', (['"""index.html"""'], {'title': 'title', 'posts': 'posts', 'quote': 'quote'}), "('index.html', title=title, posts=posts, quote=quote)\n", (504, 557), False, 'from flask import render_template, request, redirect, url_for, abort\n'), ((1102, 1158), 'flask.render_... |
import requests
import bs4
headers = {'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36'}
def img_adress(url):
#url = 'https://bcy.net/coser/toppost100?type=week&date=20190725'
res = requests.get(url,headers)
soup = bs4.Beautifu... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((739, 765), 'requests.get', 'requests.get', (['url', 'headers'], {}), '(url, headers)\n', (751, 765), False, 'import requests\n'), ((772, 807), 'bs4.BeautifulSoup', 'bs4.BeautifulSoup', (['res.text', '"""lxml"""'], {}), "(res.text, 'lxml')\n", (789, 807), False, 'import bs4\n'), ((271, 297), 'requests.get', 'requests... |
import glob
import logging
import os
from math import ceil
from typing import Dict, List, Tuple
import luigi
import numpy as np
from luigi.util import common_params, inherits, requires
from netCDF4 import Dataset, Group, Variable
from scipy import linalg
from iasi.composition import Composition, CompositionException
... | [
"logging.getLogger",
"luigi.FloatParameter",
"luigi.DateIntervalParameter",
"luigi.BoolParameter",
"iasi.file.ReadFile",
"iasi.util.child_variables_of",
"netCDF4.Dataset",
"os.path.join",
"iasi.composition.Composition.factory",
"iasi.decomposition.Decomposition.factory",
"iasi.file.MoveVariables... | [((554, 581), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (571, 581), False, 'import logging\n'), ((639, 673), 'luigi.FloatParameter', 'luigi.FloatParameter', ([], {'default': 'None'}), '(default=None)\n', (659, 673), False, 'import luigi\n'), ((2812, 2846), 'luigi.BoolParameter', 'lui... |
from collections import OrderedDict
from urllib import urlencode
from admino.serializers import ModelAdminSerializer
from django.core.urlresolvers import reverse_lazy
from django.http import JsonResponse
from django.views.generic import View
class APIView(View):
def json_response(self, data, *args, **kwargs):
... | [
"collections.OrderedDict",
"django.http.JsonResponse",
"urllib.urlencode",
"admino.serializers.ModelAdminSerializer",
"django.core.urlresolvers.reverse_lazy"
] | [((334, 381), 'django.http.JsonResponse', 'JsonResponse', (['data', '*args'], {'safe': '(False)'}), '(data, *args, safe=False, **kwargs)\n', (346, 381), False, 'from django.http import JsonResponse\n'), ((678, 721), 'django.core.urlresolvers.reverse_lazy', 'reverse_lazy', (["('admin:%s_%s_api_list' % info)"], {}), "('a... |
from .base_capsule_options import BaseCapsuleOptionsWidget
from brainframe_qt.api_utils import api
class StreamCapsuleOptionsWidget(BaseCapsuleOptionsWidget):
def __init__(self, stream_id, parent=None):
super().__init__(parent=parent)
assert stream_id is not None
self.window().setWindowTi... | [
"brainframe_qt.api_utils.api.is_capsule_active",
"brainframe_qt.api_utils.api.get_capsule_option_vals"
] | [((593, 650), 'brainframe_qt.api_utils.api.get_capsule_option_vals', 'api.get_capsule_option_vals', (['capsule_name', 'self.stream_id'], {}), '(capsule_name, self.stream_id)\n', (620, 650), False, 'from brainframe_qt.api_utils import api\n'), ((729, 780), 'brainframe_qt.api_utils.api.is_capsule_active', 'api.is_capsule... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 11 20:21:34 2020
@author: nickcostanzino
"""
def NN_structure(layers, perceptrons):
A = list()
for n in range(layers):
A.append(perceptrons)
return tuple(A)
def NN_structures(layers, perceptrons):
A = list()
for i ... | [
"numpy.random.normal",
"sklearn.model_selection.GridSearchCV",
"sklearn.neural_network.MLPRegressor",
"sklearn.model_selection.TimeSeriesSplit",
"sklearn.metrics.mean_squared_error",
"numpy.append",
"pandas.DataFrame",
"sklearn.linear_model.LinearRegression"
] | [((560, 596), 'sklearn.metrics.mean_squared_error', 'mean_squared_error', (['prediction', 'true'], {}), '(prediction, true)\n', (578, 596), False, 'from sklearn.metrics import r2_score, mean_squared_error\n'), ((889, 920), 'numpy.random.normal', 'np.random.normal', (['(0)', 'sigma_e', 'N'], {}), '(0, sigma_e, N)\n', (9... |
import logging
from string import whitespace
from typing import List, Dict, Any, Tuple, Optional
from dateutil.parser import parse
from defusedxml import ElementTree
from asphalt.feedreader.readers.base import BaseFeedReader, FeedEntry
logger = logging.getLogger(__name__)
class Person:
"""
Represents an au... | [
"logging.getLogger",
"defusedxml.ElementTree.fromstring",
"dateutil.parser.parse"
] | [((248, 275), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (265, 275), False, 'import logging\n'), ((3036, 3068), 'defusedxml.ElementTree.fromstring', 'ElementTree.fromstring', (['document'], {}), '(document)\n', (3058, 3068), False, 'from defusedxml import ElementTree\n'), ((2558, 2590... |
# Copyright (c) 2016-2020, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the... | [
"bpy.utils.unregister_class",
"bpy.utils.register_class",
"bpy.data.collections.new"
] | [((6593, 6624), 'bpy.data.collections.new', 'bpy.data.collections.new', (['cname'], {}), '(cname)\n', (6617, 6624), False, 'import bpy\n'), ((13453, 13482), 'bpy.utils.register_class', 'bpy.utils.register_class', (['cls'], {}), '(cls)\n', (13477, 13482), False, 'import bpy\n'), ((13537, 13568), 'bpy.utils.unregister_cl... |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.http import JsonResponse
import datetime
import calendar
from expenses.models import Expense
# This function can only be accessed after logging in.
@login_required
def stats_view(request):
"""This function r... | [
"django.shortcuts.render",
"django.http.JsonResponse",
"expenses.models.Expense.objects.filter",
"datetime.date",
"datetime.date.today"
] | [((364, 400), 'django.shortcuts.render', 'render', (['request', '"""report/index.html"""'], {}), "(request, 'report/index.html')\n", (370, 400), False, 'from django.shortcuts import render\n'), ((581, 602), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (600, 602), False, 'import datetime\n'), ((3083, ... |
from django.urls import path
from . import views
app_name = "chats"
urlpatterns = [
path("", views.index, name="index"),
path("chat/", views.chat, name="chat"),
]
| [
"django.urls.path"
] | [((91, 126), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (95, 126), False, 'from django.urls import path\n'), ((132, 170), 'django.urls.path', 'path', (['"""chat/"""', 'views.chat'], {'name': '"""chat"""'}), "('chat/', views.chat, name='chat')\n... |
from cnn_model import *
from label_cnn import LabelCNN
from keras.layers import Activation, Concatenate
class VEGGG(CnnModel):
def __init__(self, model_name):
super().__init__()
self.MODEL_NAME = model_name
def build_model(self):
layers = BasicLayers(relu_version='parametric')
... | [
"keras.layers.Activation"
] | [((1758, 1779), 'keras.layers.Activation', 'Activation', (['"""softmax"""'], {}), "('softmax')\n", (1768, 1779), False, 'from keras.layers import Activation, Concatenate\n'), ((3263, 3284), 'keras.layers.Activation', 'Activation', (['"""softmax"""'], {}), "('softmax')\n", (3273, 3284), False, 'from keras.layers import ... |
#!/usr/bin/env python3
# !coding=utf-8
# Created by Cmoon
import rospy
from std_srvs.srv import Empty
import actionlib
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
from soundplayer import Soundplayer
class Navigator:
def __init__(self, location):
self.location = location
self.goal ... | [
"rospy.is_shutdown",
"rospy.init_node",
"rospy.ServiceProxy",
"rospy.loginfo",
"rospy.spin",
"rospy.sleep",
"soundplayer.Soundplayer",
"move_base_msgs.msg.MoveBaseGoal",
"actionlib.SimpleActionClient"
] | [((2123, 2152), 'rospy.init_node', 'rospy.init_node', (['"""navigation"""'], {}), "('navigation')\n", (2138, 2152), False, 'import rospy\n'), ((2183, 2195), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (2193, 2195), False, 'import rospy\n'), ((322, 336), 'move_base_msgs.msg.MoveBaseGoal', 'MoveBaseGoal', ([], {}), '()... |
import sys
import os
import stl
DUMP = 1
HISTOGRAM = 2
def main(argv):
# TODO args, like show-histogram
mode = DUMP
if argv[0] == '--show-histogram':
argv.pop(0)
mode = HISTOGRAM
filename = argv[0]
mesh = stl.Mesh(filename)
def extract_planes(mesh):
# TODO handle multiple 2d ... | [
"stl.Mesh"
] | [((244, 262), 'stl.Mesh', 'stl.Mesh', (['filename'], {}), '(filename)\n', (252, 262), False, 'import stl\n')] |
import sys
import os
import shutil
import time
import json
from typing import List, Union
import torch
from torch import nn
from torch.autograd import Variable
from torch.optim import SGD
import numpy as np
from torchmetrics import Accuracy, Precision, Recall
from Metrics import AreaUnderPrecisionCurve, T... | [
"numpy.clip",
"DataAugement.RandAugment",
"torchvision.transforms.transforms.ToPILImage",
"torch.nn.CrossEntropyLoss",
"torch.cuda.is_available",
"Metrics.ModifiedF1",
"Metrics.TprFpr",
"torchmetrics.Recall",
"Metrics.Time1000Samples",
"numpy.mean",
"os.listdir",
"numpy.exp",
"Metrics.SkAucR... | [((663, 696), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (686, 696), False, 'import warnings\n'), ((1254, 1316), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {'size_average': '(False)', 'ignore_index': 'NO_LABEL'}), '(size_average=False, ignore_index=NO_LAB... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
File : certify.py
Author : <NAME>
CreateDate : 2018-12-16 10:00:00
LastModifiedDate : 2018-12-16 10:00:00
Note : Agent认证接口,GET
"""
from flask_restful import Resource
from flask_restful import fields
from flask_restful import marshal_with
from flask_restful import reqparse... | [
"src.restfuls.utils.certify.Certify.generate_token",
"flask_restful.reqparse.RequestParser",
"flask_restful.fields.Nested",
"flask_restful.marshal_with",
"src.restfuls.apps.db_model.db.session.commit",
"src.restfuls.apps.db_model.db.session.query",
"src.restfuls.utils.abort.abort_with_msg"
] | [((968, 999), 'flask_restful.marshal_with', 'marshal_with', (['get_resp_template'], {}), '(get_resp_template)\n', (980, 999), False, 'from flask_restful import marshal_with\n'), ((675, 721), 'flask_restful.fields.Nested', 'fields.Nested', (["{'access_token': fields.String}"], {}), "({'access_token': fields.String})\n",... |