code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.conf import settings
from rest_framework.routers import DefaultRouter, SimpleRouter
from emenu.cards import views
if settings.DEBUG:
router = DefaultRouter()
else:
router = SimpleRouter()
router.register("dishes", views.DishViewSet)
router.register("cards", views.CardViewSet)
app_name = "api"
u... | [
"rest_framework.routers.SimpleRouter",
"rest_framework.routers.DefaultRouter"
] | [((160, 175), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (173, 175), False, 'from rest_framework.routers import DefaultRouter, SimpleRouter\n'), ((195, 209), 'rest_framework.routers.SimpleRouter', 'SimpleRouter', ([], {}), '()\n', (207, 209), False, 'from rest_framework.routers import De... |
import numpy as np
import torch
import torch.nn as nn
from torch import Tensor
from ..utils import ReverseLayerF
def reparameterization(mean, log_var):
std = torch.exp(0.5 * log_var)
eps = torch.randn_like(std)
return eps.mul(std).add_(mean)
class ConvEncoder(nn.Module):
def __init__(self, data_size... | [
"torch.nn.BatchNorm2d",
"torch.nn.LeakyReLU",
"torch.nn.Sequential",
"torch.exp",
"torch.nn.Conv2d",
"torch.nn.BatchNorm1d",
"torch.randn_like",
"torch.nn.MaxPool2d",
"torch.nn.Linear",
"torch.nn.ConvTranspose2d",
"torch.flatten"
] | [((164, 188), 'torch.exp', 'torch.exp', (['(0.5 * log_var)'], {}), '(0.5 * log_var)\n', (173, 188), False, 'import torch\n'), ((199, 220), 'torch.randn_like', 'torch.randn_like', (['std'], {}), '(std)\n', (215, 220), False, 'import torch\n'), ((1832, 1863), 'torch.nn.Linear', 'nn.Linear', (['(512)', 'self.latent_dim'],... |
import logging
import random
import torch
from src.models.conversational.checkpoint import Checkpoint
from src.models.conversational.emotion_model import EmotionSeq2seq, EmotionTopKDecoder
from src.models.conversational.predictor import Predictor
from src.models.conversational.utils import APP_NAME
from src.models.co... | [
"logging.getLogger",
"src.models.conversational.checkpoint.Checkpoint.load",
"src.models.conversational.emotion_model.EmotionTopKDecoder",
"src.models.conversational.predictor.Predictor",
"random.choice",
"torch.load",
"src.utils.preprocess",
"src.models.courses.recommender.Recommender"
] | [((606, 651), 'logging.getLogger', 'logging.getLogger', (["(APP_NAME + '.EmoryChatBot')"], {}), "(APP_NAME + '.EmoryChatBot')\n", (623, 651), False, 'import logging\n'), ((679, 705), 'src.models.courses.recommender.Recommender', 'Recommender', (['word2vec_path'], {}), '(word2vec_path)\n', (690, 705), False, 'from src.m... |
from setuptools import setup
from setuptools import find_packages
with open("README.rst") as readme_file:
readme = readme_file.read()
packages = find_packages()
setup(
name="project_archer",
version="0.3.0",
description="Switch projects with ease.",
long_description=readme,
author="<NAME>",
... | [
"setuptools.find_packages",
"setuptools.setup"
] | [((151, 166), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (164, 166), False, 'from setuptools import find_packages\n'), ((168, 560), 'setuptools.setup', 'setup', ([], {'name': '"""project_archer"""', 'version': '"""0.3.0"""', 'description': '"""Switch projects with ease."""', 'long_description': 'rea... |
import os
import numpy as np
from sklearn.svm import SVC, LinearSVC
from sklearn.metrics import classification_report
from sklearn.ensemble import RandomForestClassifier
from sklearn import preprocessing
from sklearn import metrics
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTre... | [
"sklearn.metrics.precision_score",
"sklearn.model_selection.StratifiedKFold",
"sklearn.metrics.recall_score",
"numpy.array",
"numpy.random.RandomState",
"os.path.exists",
"argparse.ArgumentParser",
"sklearn.tree.DecisionTreeClassifier",
"numpy.concatenate",
"sklearn.preprocessing.MinMaxScaler",
... | [((485, 546), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""ml_features_classifier"""'}), "(description='ml_features_classifier')\n", (508, 546), False, 'import argparse\n'), ((2414, 2462), 'sklearn.preprocessing.MinMaxScaler', 'preprocessing.MinMaxScaler', ([], {'feature_range': '(0, 1... |
#!/usr/bin/python3.6
import telebot
from telebot import types
import datetime
import pytz
#Waktu
d = datetime.datetime.now()
tz = pytz.timezone("Asia/Jakarta")
d = tz.localize(d)
date = d.strftime("%a, %d-%m-%Y")
timestamp = date
#Api Telegram
api = 'api_bot_telegram_anda'
bot = telebot.TeleBot(api)
... | [
"pytz.timezone",
"telebot.types.KeyboardButton",
"datetime.datetime.now",
"telebot.types.ReplyKeyboardMarkup",
"telebot.types.InlineKeyboardMarkup",
"telebot.TeleBot"
] | [((109, 132), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (130, 132), False, 'import datetime\n'), ((139, 168), 'pytz.timezone', 'pytz.timezone', (['"""Asia/Jakarta"""'], {}), "('Asia/Jakarta')\n", (152, 168), False, 'import pytz\n'), ((297, 317), 'telebot.TeleBot', 'telebot.TeleBot', (['api'], ... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the 'license' file acc... | [
"pandas.DataFrame",
"pandas.testing.assert_frame_equal",
"json.dumps",
"mldock.platform_helpers.mldock.inference.content_decoders.pandas.csv_to_pandas"
] | [((1747, 1794), 'pandas.testing.assert_frame_equal', 'pd.testing.assert_frame_equal', (['actual', 'expected'], {}), '(actual, expected)\n', (1776, 1794), True, 'import pandas as pd\n'), ((2662, 2699), 'mldock.platform_helpers.mldock.inference.content_decoders.pandas.csv_to_pandas', 'pandas_decoders.csv_to_pandas', (['t... |
# encoding: utf-8
from __future__ import division, print_function, unicode_literals
###########################################################################################################
#
#
# Reporter Plugin
#
# Read the docs:
# https://github.com/schriftgestalt/GlyphsSDK/tree/master/Python%20Templates/Reporter
... | [
"math.tan"
] | [((4544, 4573), 'math.tan', 'tan', (['(italicAngle * pi / 180.0)'], {}), '(italicAngle * pi / 180.0)\n', (4547, 4573), False, 'from math import tan, pi\n')] |
import nox
python_versions = ["3.7", "3.8"]
default_python = "3.8"
@nox.session(python=default_python, reuse_venv=True)
def lint_black(session):
session.install("black")
session.run("black", "--check", "plangid", "noxfile.py")
@nox.session(python=default_python, reuse_venv=True)
def lint_flake8(session):
... | [
"nox.session"
] | [((72, 123), 'nox.session', 'nox.session', ([], {'python': 'default_python', 'reuse_venv': '(True)'}), '(python=default_python, reuse_venv=True)\n', (83, 123), False, 'import nox\n'), ((242, 293), 'nox.session', 'nox.session', ([], {'python': 'default_python', 'reuse_venv': '(True)'}), '(python=default_python, reuse_ve... |
import logging
from configparser import ConfigParser
from os import path, listdir
LOGGER = logging.getLogger('gullveig')
def priority_sort_files(k: str):
first = 0
second = k
if '-' not in k:
return first, second
parts = k.split('-', 2)
# noinspection PyBroadException
try:
... | [
"logging.getLogger",
"os.path.exists",
"os.listdir",
"os.path.isabs",
"os.path.join",
"os.path.realpath",
"os.path.dirname",
"os.path.isfile",
"os.path.isdir"
] | [((92, 121), 'logging.getLogger', 'logging.getLogger', (['"""gullveig"""'], {}), "('gullveig')\n", (109, 121), False, 'import logging\n'), ((703, 727), 'os.path.realpath', 'path.realpath', (['file_path'], {}), '(file_path)\n', (716, 727), False, 'from os import path, listdir\n'), ((753, 783), 'os.path.dirname', 'path.d... |
import numpy as np
import sympy as sp
from scipy.misc import derivative
from prettytable import PrettyTable
import math
from math import *
def nuevosValoresa(ecua, derivadas, Ecuaciones, variables,var):
valor_ini = []
func_numerica = []
derv_numerica = []
funcs = vars(math)
for i in range(0, Ecuac... | [
"prettytable.PrettyTable",
"numpy.array",
"sympy.Symbol",
"sympy.Derivative"
] | [((1972, 1996), 'prettytable.PrettyTable', 'PrettyTable', (['encabezados'], {}), '(encabezados)\n', (1983, 1996), False, 'from prettytable import PrettyTable\n'), ((3236, 3249), 'prettytable.PrettyTable', 'PrettyTable', ([], {}), '()\n', (3247, 3249), False, 'from prettytable import PrettyTable\n'), ((1211, 1234), 'sym... |
from EmuPBk.MCMC.core import Core
from EmuPBk.MCMC.like import LikeModule, ComplexLikeModule
import os
import time
from cosmoHammer.util import Params
from cosmoHammer import MpiCosmoHammerSampler
from cosmoHammer import CosmoHammerSampler
from cosmoHammer import LikelihoodComputationChain
# from cosmoHammer.pso.MpiP... | [
"EmuPBk.MCMC.like.ComplexLikeModule",
"cosmoHammer.LikelihoodComputationChain",
"cosmoHammer.util.Params",
"EmuPBk.MCMC.core.Core",
"cosmoHammer.MpiCosmoHammerSampler",
"os.path.join",
"cosmoHammer.CosmoHammerSampler",
"EmuPBk.MCMC.like.LikeModule",
"time.time"
] | [((584, 693), 'cosmoHammer.util.Params', 'Params', (["('NoH', [275, 10, 550, 3])", "('n_ion', [90.0, 10.0, 180.0, 1])", "('R_mfp', [30.0, 5.0, 60.0, 0.5])"], {}), "(('NoH', [275, 10, 550, 3]), ('n_ion', [90.0, 10.0, 180.0, 1]), (\n 'R_mfp', [30.0, 5.0, 60.0, 0.5]))\n", (590, 693), False, 'from cosmoHammer.util impor... |
from discord.ext import commands
from essentials.errors import MustBeSameChannel, NotConnectedToVoice, PlayerNotConnected
class Errorhandler(commands.Cog):
def __init__(self, bot) -> None:
self.bot = bot
@commands.Cog.listener()
async def on_command_error(self, ctx, error):
if isinstance(... | [
"discord.ext.commands.Cog.listener"
] | [((224, 247), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (245, 247), False, 'from discord.ext import commands\n')] |
#!/usr/bin/python
#
# Copyright (C) 2005 British Broadcasting Corporation and Kamaelia Contributors(1)
# All Rights Reserved.
#
# You may only modify and redistribute this under the terms of any of the
# following licenses(2): Mozilla Public License, V1.1, GNU General
# Public License, V2.0, GNU Lesser Gener... | [
"unittest.main",
"sys.path.append",
"Rationals.rational"
] | [((969, 991), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (984, 991), False, 'import sys\n'), ((1970, 1985), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1983, 1985), False, 'import unittest\n'), ((1142, 1155), 'Rationals.rational', 'rational', (['(1.0)'], {}), '(1.0)\n', (1150, 1155... |
from setuptools import setup, find_packages
import subprocess
def get_version():
p = subprocess.run("git describe | grep -o -E \"v[0-9]+(\\.[0-9]+)+(-[0-9]+)?\" -", shell=True, check=True,
universal_newlines=True, stdout=subprocess.PIPE)
v = p.stdout.rstrip()
return v.replace("-", ".... | [
"subprocess.run",
"setuptools.find_packages"
] | [((90, 244), 'subprocess.run', 'subprocess.run', (['"""git describe | grep -o -E "v[0-9]+(\\\\.[0-9]+)+(-[0-9]+)?" -"""'], {'shell': '(True)', 'check': '(True)', 'universal_newlines': '(True)', 'stdout': 'subprocess.PIPE'}), '(\'git describe | grep -o -E "v[0-9]+(\\\\.[0-9]+)+(-[0-9]+)?" -\',\n shell=True, check=Tru... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('reviews', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='notificationtemplate',
... | [
"django.db.models.EmailField"
] | [((361, 394), 'django.db.models.EmailField', 'models.EmailField', ([], {'max_length': '(254)'}), '(max_length=254)\n', (378, 394), False, 'from django.db import models, migrations\n'), ((534, 567), 'django.db.models.EmailField', 'models.EmailField', ([], {'max_length': '(254)'}), '(max_length=254)\n', (551, 567), False... |
import pyglet
class UserInterface:
def __init__(self, window):
self.sprites = {}
self.window = window
def update_sprites(self, conv_text, emot_text, ident_text, history_text):
self.sprites['label1'] = pyglet.text.Label(text=conv_text,
font_name='Time... | [
"pyglet.image.load",
"pyglet.text.Label",
"pyglet.sprite.Sprite"
] | [((237, 416), 'pyglet.text.Label', 'pyglet.text.Label', ([], {'text': 'conv_text', 'font_name': '"""Times New Roman"""', 'font_size': '(36)', 'x': '(self.window.width / 2)', 'y': '(self.window.height / 2 + 65)', 'anchor_x': '"""center"""', 'anchor_y': '"""center"""'}), "(text=conv_text, font_name='Times New Roman', fon... |
#! /usr/bin/python
import logging
import os.path
import argparse
from twisted.internet import reactor
from twisted.internet.protocol import Protocol
from flock.roster import Roster
from flock.controller_factory import ControllerFactory
from flock.controller.rfxcom.protocol import RfxcomProtocol
from flock.controlle... | [
"logging.getLogger",
"flock.roster.Roster.instantiate",
"flock.frontend.amp.Frontend",
"argparse.ArgumentParser",
"flock.controller_factory.ControllerFactory",
"twisted.internet.reactor.run",
"flock.frontend.msgpack.server.FlockMsgServer"
] | [((628, 653), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (651, 653), False, 'import argparse\n'), ((1160, 1191), 'flock.roster.Roster.instantiate', 'Roster.instantiate', (['args.config'], {}), '(args.config)\n', (1178, 1191), False, 'from flock.roster import Roster\n'), ((1206, 1232), 'floc... |
from configparser import ConfigParser
import os
import json
from cryptography.hazmat.primitives import serialization
from flask import Flask
from flask import request
from cert_processor import CertProcessor
from cert_processor import CertProcessorKeyNotFoundError
from cert_processor import CertProcessorInvalidSignat... | [
"os.getenv",
"flask.Flask",
"json.dumps",
"flask.request.get_json",
"handler.Handler",
"utils.get_config_from_file"
] | [((587, 602), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (592, 602), False, 'from flask import Flask\n'), ((617, 632), 'handler.Handler', 'Handler', (['config'], {}), '(config)\n', (624, 632), False, 'from handler import Handler\n'), ((2528, 2558), 'os.getenv', 'os.getenv', (['"""CONFIG_PATH"""', 'None... |
import os
import subprocess
import sys
import timeit
import traceback
def log(args, tool, message):
with open(os.path.join(args.output_directory, f"{tool}-stdout.log"), 'a') as f:
f.write(message)
f.flush()
def classpath(javac_command):
if 'javac_switches' in javac_command:
switches = javac_command['... | [
"traceback.format_exc",
"os.pathsep.join",
"timeit.default_timer",
"subprocess.run",
"os.path.join",
"os.walk"
] | [((801, 818), 'os.walk', 'os.walk', (['classdir'], {}), '(classdir)\n', (808, 818), False, 'import os\n'), ((2103, 2125), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (2123, 2125), False, 'import timeit\n'), ((2177, 2268), 'subprocess.run', 'subprocess.run', (['cmd'], {'timeout': 'timeout', 'stdout... |
import torch
import torch.nn as nn
import math
from torch.autograd import Variable
from torch.autograd import Function
import torch.nn.functional as F
from datetime import datetime
import numpy as np
import utils_own
'''
def quantize(number,bitwidth):
temp=1/bitwidth
if number>0:
for i in... | [
"torch.nn.functional.linear",
"torch.nn.functional.conv2d",
"torch.ones_like",
"torch.split",
"torch.sort",
"torch.LongTensor",
"torch.stack",
"utils_own.permute_from_list",
"torch.ceil",
"torch.sum",
"torch.flip",
"torch.zeros_like",
"torch.FloatTensor"
] | [((1534, 1557), 'torch.ones_like', 'torch.ones_like', (['tensor'], {}), '(tensor)\n', (1549, 1557), False, 'import torch\n'), ((1661, 1710), 'utils_own.permute_from_list', 'utils_own.permute_from_list', (['tensor', 'permute_list'], {}), '(tensor, permute_list)\n', (1688, 1710), False, 'import utils_own\n'), ((3595, 366... |
import unittest
from walky.constants import *
from walky.acl import *
from walky.user import *
class Test(unittest.TestCase):
def test_single(self):
groups = ['testgroup','group2']
attrs = {
'name': 'Potato',
'url': 'http://www.potatos.com',
}
user = User(... | [
"unittest.main"
] | [((2000, 2015), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2013, 2015), False, 'import unittest\n')] |
from __future__ import print_function, absolute_import
import argparse
import os.path as osp
import random
import numpy as np
import sys
import torch.nn.functional as F
from hdbscan import HDBSCAN
from sklearn.cluster import KMeans, DBSCAN
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.preprocessin... | [
"abmt.datasets.names",
"abmt.utils.data.sampler.RandomMultipleGallerySampler",
"abmt.utils.serialization.copy_state_dict",
"abmt.trainers.ABMTTrainer",
"sklearn.cluster.DBSCAN",
"numpy.mean",
"abmt.models.create",
"argparse.ArgumentParser",
"abmt.utils.data.transforms.RandomHorizontalFlip",
"numpy... | [((1086, 1110), 'os.path.join', 'osp.join', (['data_dir', 'name'], {}), '(data_dir, name)\n', (1094, 1110), True, 'import os.path as osp\n'), ((1125, 1152), 'abmt.datasets.create', 'datasets.create', (['name', 'root'], {}), '(name, root)\n', (1140, 1152), False, 'from abmt import datasets\n'), ((1314, 1380), 'abmt.util... |
from django.test import TestCase
from django.utils import timezone
from blog.models import Post
class PostModelTest(TestCase):
def test_creating_a_new_post_and_saving_it_to_the_database(self):
# start by creating a new Post object
post = Post()
post.title = "Test Post Title"
post.pu... | [
"django.utils.timezone.now",
"blog.models.Post.objects.all",
"blog.models.Post"
] | [((259, 265), 'blog.models.Post', 'Post', ([], {}), '()\n', (263, 265), False, 'from blog.models import Post\n'), ((329, 343), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (341, 343), False, 'from django.utils import timezone\n'), ((502, 520), 'blog.models.Post.objects.all', 'Post.objects.all', ([], {... |
# ------------------------------------------------------------------------------
# Python API to access CodeHawk Java Analyzer analysis results
# Author: <NAME>
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2016-2018 Kestrel Technology LLC
#
#... | [
"sklearn.feature_extraction.text.TfidfTransformer",
"scipy.mat",
"scs.jbc.retrieval.ReverseIndex.ReverseIndex",
"scs.jbc.retrieval.IndexedPostings.IndexedPostings",
"scs.jbc.retrieval.IndexedVocabulary.IndexedVocabulary",
"scipy.sparse.dok_matrix"
] | [((2288, 2315), 'scs.jbc.retrieval.ReverseIndex.ReverseIndex', 'ReverseIndex', (['self.indexjar'], {}), '(self.indexjar)\n', (2300, 2315), False, 'from scs.jbc.retrieval.ReverseIndex import ReverseIndex\n'), ((3896, 3940), 'scipy.sparse.dok_matrix', 'dok_matrix', (['(doccount, termcount)'], {'dtype': 'int'}), '((doccou... |
from PySide2.QtWidgets import QWidget, QApplication, QTextEdit, QVBoxLayout
import sys
# Test bed for StackOverFlow Qt-related questions
class MainWindow(QWidget):
def __init__(self):
super(MainWindow, self).__init__()
self.layout = QVBoxLayout()
self.text = QTextEdit()
self.aux ... | [
"PySide2.QtWidgets.QApplication",
"PySide2.QtWidgets.QVBoxLayout",
"PySide2.QtWidgets.QTextEdit"
] | [((619, 641), 'PySide2.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (631, 641), False, 'from PySide2.QtWidgets import QWidget, QApplication, QTextEdit, QVBoxLayout\n'), ((257, 270), 'PySide2.QtWidgets.QVBoxLayout', 'QVBoxLayout', ([], {}), '()\n', (268, 270), False, 'from PySide2.QtWidge... |
# main.py -- put your code here!
###############################################################################
# main.py
#
# Script demonstrating logging GPS data to an SD card
# This will send a command to set an Adafruit Ultimate GPS to update at 5Hz
# pg. 8-9 of http://www.adafruit.com/datasheets/PMTK_A1... | [
"micropyGPS.MicropyGPS"
] | [((1897, 1909), 'micropyGPS.MicropyGPS', 'MicropyGPS', ([], {}), '()\n', (1907, 1909), False, 'from micropyGPS import MicropyGPS\n')] |
# Copyright 2020 The 9nFL 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 applicable la... | [
"DataJoin.utils.process_manager.block_id_wrap",
"DataJoin.common.data_join_service_pb2.DataBlockMeta",
"os.environ.get",
"tensorflow.compat.v1.gfile.Remove",
"DataJoin.utils.process_manager.partition_id_wrap",
"uuid.uuid1",
"DataJoin.utils.process_manager.data_block_file_name_wrap",
"tensorflow.compat... | [((1162, 1175), 'DataJoin.utils.base.get_host_ip', 'get_host_ip', ([], {}), '()\n', (1173, 1175), False, 'from DataJoin.utils.base import get_host_ip\n'), ((1183, 1211), 'os.environ.get', 'os.environ.get', (['"""MODE"""', 'None'], {}), "('MODE', None)\n", (1197, 1211), False, 'import os\n'), ((1573, 1616), 'logging.inf... |
from django.shortcuts import render, get_object_or_404, redirect
from django.urls import reverse_lazy
from django.views.generic import (
ListView,
CreateView,
DetailView,
DeleteView,
UpdateView)
from .models import Team
from .forms import TeamForm
from django.contrib.auth.models import User
from not... | [
"django.shortcuts.render",
"django.contrib.auth.models.User.objects.exclude",
"notifications.signals.notify.send",
"django.shortcuts.get_object_or_404",
"django.contrib.auth.models.User.objects.filter",
"django.shortcuts.redirect",
"django.urls.reverse_lazy",
"django.contrib.auth.models.User.objects.g... | [((718, 750), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""teams:teams_list"""'], {}), "('teams:teams_list')\n", (730, 750), False, 'from django.urls import reverse_lazy\n'), ((2058, 2090), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""teams:teams_list"""'], {}), "('teams:teams_list')\n", (2070, 2090), False, ... |
# Defs for extracting features.
# <NAME>, 20 AUG 2021
#
from MDAnalysis.analysis.hydrogenbonds.hbond_analysis import HydrogenBondAnalysis as HBA
def interatomic_dist(atom_i, atom_j, ):
'''Compute the interatomic distance between 2 atoms.
'''
return round(
((atom_i.position[0] - atom_j.p... | [
"MDAnalysis.analysis.hydrogenbonds.hbond_analysis.HydrogenBondAnalysis"
] | [((20249, 20352), 'MDAnalysis.analysis.hydrogenbonds.hbond_analysis.HydrogenBondAnalysis', 'HBA', ([], {'universe': 'mda_universe', 'donors_sel': 'allhvy_sel', 'hydrogens_sel': 'allh_sel', 'acceptors_sel': 'allhvy_sel'}), '(universe=mda_universe, donors_sel=allhvy_sel, hydrogens_sel=allh_sel,\n acceptors_sel=allhvy_... |
import os
import shutil
import unittest
from dokidokimd.models import Chapter, Manga, MangaSite
RESULTS_DIRECTORY = 'unittest_results_temp_dir'
class TestMakePdfMethods(unittest.TestCase):
def test_make_pdf1(self):
"""
Make pdf from previously downloaded images - simulated on copied files
... | [
"os.path.getsize",
"os.listdir",
"os.makedirs",
"os.path.join",
"dokidokimd.models.Manga",
"os.path.dirname",
"dokidokimd.models.MangaSite",
"os.path.isfile",
"os.unlink",
"shutil.copy",
"shutil.rmtree",
"unittest.main",
"dokidokimd.models.Chapter"
] | [((2680, 2695), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2693, 2695), False, 'import unittest\n'), ((350, 375), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (365, 375), False, 'import os\n'), ((403, 425), 'dokidokimd.models.MangaSite', 'MangaSite', (['"""test_site"""'], {}), "('... |
import uuid
from typing import Dict, List, Optional
from hestia.datetime_typing import AwareDT
from django.conf import settings
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.utils import timezone
from django.utils.functional import cached_property
import auditor
impor... | [
"django.db.models.Index",
"django.db.models.UUIDField",
"django.db.models.OneToOneField",
"db.models.unique_names.EXPERIMENT_UNIQUE_NAME_FORMAT.format",
"django.contrib.postgres.fields.JSONField",
"django.db.models.TextField",
"lifecycles.jobs.JobLifeCycle.is_done",
"django.db.models.ForeignKey",
"d... | [((2373, 2450), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'default': 'uuid.uuid4', 'editable': '(False)', 'unique': '(True)', 'null': '(False)'}), '(default=uuid.uuid4, editable=False, unique=True, null=False)\n', (2389, 2450), False, 'from django.db import models\n'), ((2498, 2588), 'django.db.models.For... |
import os
import csv
import sys
import glob
import json
import time
import pprint
import logging
import optparse
STATS_DIR = "/tmp"
stats_dir = STATS_DIR
STAT_FRESHNESS_THRESHOLD_SEC = 3600
SORT_FUNCS = {
'evaluations': lambda x: x['evaluations'],
'matches': lambda x: x['matches'],
'total_time': lambda ... | [
"csv.DictWriter",
"logging.warn",
"json.dumps",
"os.path.join",
"optparse.OptionParser",
"os.path.isfile",
"sys.exit",
"os.path.getmtime",
"time.time",
"pprint.pprint"
] | [((1875, 1921), 'csv.DictWriter', 'csv.DictWriter', (['sys.stdout', 'OUTPUT_FIELD_ORDER'], {}), '(sys.stdout, OUTPUT_FIELD_ORDER)\n', (1889, 1921), False, 'import csv\n'), ((2091, 2111), 'pprint.pprint', 'pprint.pprint', (['statl'], {}), '(statl)\n', (2104, 2111), False, 'import pprint\n'), ((2259, 2282), 'optparse.Opt... |
'''
Created on 15 Jan 2013
@author: euan
'''
import uuid
from django.conf import settings
from django.db import models
from unobase.api import exceptions, constants
class Destination(models.Model):
"""
Where to send stuff.
"""
title = models.CharField(max_length=32)
url = models.URLField()
u... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.signals.post_save.connect",
"django.db.models.DateTimeField",
"uuid.uuid4",
"django.db.models.URLField",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.CharField"
] | [((2400, 2467), 'django.db.models.signals.post_save.connect', 'models.signals.post_save.connect', (['post_save_request'], {'sender': 'Request'}), '(post_save_request, sender=Request)\n', (2432, 2467), False, 'from django.db import models\n'), ((255, 286), 'django.db.models.CharField', 'models.CharField', ([], {'max_len... |
import requests
import logging
import time
import ratelim
# Local imports
from utils.common.db_utils import read_all_results
from utils.common.datapipeline import DataPipeline
# from retrying import retry
RATELIM_DUR = 50 * 60
RATELIM_QUERIES = 8500
# @retry(wait_random_min=2000, wait_random_max=60000, stop_max_att... | [
"utils.common.db_utils.read_all_results",
"utils.common.datapipeline.DataPipeline",
"ratelim.patient",
"time.sleep"
] | [((337, 382), 'ratelim.patient', 'ratelim.patient', (['RATELIM_QUERIES', 'RATELIM_DUR'], {}), '(RATELIM_QUERIES, RATELIM_DUR)\n', (352, 382), False, 'import ratelim\n'), ((1271, 1322), 'utils.common.db_utils.read_all_results', 'read_all_results', (['config', '"""output_db"""', '"""table_name"""'], {}), "(config, 'outpu... |
# Test results on all possible clustering methods using clustering results
import seaborn as sns
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import torch
from sklearn.metrics import silhouette_samples, silhouette_score, adjusted_rand_score
from sklearn.cluster import KMeans, SpectralClusteri... | [
"pandas.Series",
"sklearn.cluster.KMeans",
"sklearn.cluster.SpectralClustering",
"sklearn.cluster.AgglomerativeClustering",
"numpy.unique",
"argparse.ArgumentParser",
"pandas.read_csv",
"sklearn.cluster.OPTICS",
"sklearn.cluster.AffinityPropagation",
"torch.from_numpy",
"matplotlib.pyplot.close"... | [((574, 635), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Main entrance of scGNN"""'}), "(description='Main entrance of scGNN')\n", (597, 635), False, 'import argparse\n'), ((1427, 1458), 'torch.from_numpy', 'torch.from_numpy', (['spatialMatrix'], {}), '(spatialMatrix)\n', (1443, 1458... |
import mediapipe as mp
import pandas as pd
import numpy as np
import cv2
mp_pose = mp.solutions.pose
# returns an angle value as a result of the given points
def calculate_angle(a, b, c):
a = np.array(a) # First
b = np.array(b) # Mid
c = np.array(c) # End
radians = np.arctan2(c[1] - b[1], c[0] - ... | [
"numpy.abs",
"cv2.imshow",
"numpy.array",
"numpy.arctan2",
"pandas.DataFrame",
"cv2.imread"
] | [((199, 210), 'numpy.array', 'np.array', (['a'], {}), '(a)\n', (207, 210), True, 'import numpy as np\n'), ((228, 239), 'numpy.array', 'np.array', (['b'], {}), '(b)\n', (236, 239), True, 'import numpy as np\n'), ((255, 266), 'numpy.array', 'np.array', (['c'], {}), '(c)\n', (263, 266), True, 'import numpy as np\n'), ((39... |
import os
import importlib.util
from setuptools import setup
# Boilerplate to load commonalities
spec = importlib.util.spec_from_file_location(
"setup_common", os.path.join(os.path.dirname(__file__), "setup_common.py")
)
common = importlib.util.module_from_spec(spec)
spec.loader.exec_module(common)
common.KWARGS[... | [
"os.path.dirname",
"setuptools.setup"
] | [((731, 753), 'setuptools.setup', 'setup', ([], {}), '(**common.KWARGS)\n', (736, 753), False, 'from setuptools import setup\n'), ((178, 203), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (193, 203), False, 'import os\n')] |
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
def get_transformed_spatial_coordinates(filename: str):
df = pd.read_csv(filename, sep="\t")
spatial_data = df.iloc[:, 0]
spatial_xy = []
for spot in spatial_data:
... | [
"pandas.read_csv",
"sklearn.decomposition.PCA",
"numpy.log",
"sklearn.preprocessing.StandardScaler",
"pandas.DataFrame",
"numpy.transpose"
] | [((200, 231), 'pandas.read_csv', 'pd.read_csv', (['filename'], {'sep': '"""\t"""'}), "(filename, sep='\\t')\n", (211, 231), True, 'import pandas as pd\n'), ((474, 518), 'pandas.DataFrame', 'pd.DataFrame', (['spatial_xy'], {'columns': "['x', 'y']"}), "(spatial_xy, columns=['x', 'y'])\n", (486, 518), True, 'import pandas... |
import copy
from typing import Callable, Tuple
import numpy as np
from odyssey.distribution import Distribution
from iliad.integrators.fields import softabs
from iliad.integrators.info import CoupledInfo
from iliad.integrators.terminal import cond
from iliad.integrators.states.coupled_state import CoupledState
from ... | [
"numpy.abs",
"numpy.eye",
"iliad.integrators.info.CoupledInfo",
"numpy.hstack",
"iliad.integrators.terminal.cond",
"numpy.split",
"numpy.outer",
"numpy.vstack",
"numpy.cos",
"numpy.sin",
"copy.copy",
"numpy.zeros_like"
] | [((1035, 1064), 'numpy.cos', 'np.cos', (['(2 * omega * step_size)'], {}), '(2 * omega * step_size)\n', (1041, 1064), True, 'import numpy as np\n'), ((1071, 1100), 'numpy.sin', 'np.sin', (['(2 * omega * step_size)'], {}), '(2 * omega * step_size)\n', (1077, 1100), True, 'import numpy as np\n'), ((1107, 1136), 'numpy.vst... |
from . import controllers
from bapa.decorators.auth import require_auth, require_officer
from flask import render_template, redirect, url_for, flash, g
from flask import session, request
from flask import Blueprint
from oauth2client import client
import json
import os
import httplib2
bp = Blueprint('officers', __n... | [
"flask.render_template",
"flask.request.args.get",
"flask.flash",
"flask.session.get",
"oauth2client.client.OAuth2Credentials.from_json",
"flask.request.form.get",
"flask.url_for",
"flask.redirect",
"httplib2.Http",
"flask.Blueprint"
] | [((295, 355), 'flask.Blueprint', 'Blueprint', (['"""officers"""', '__name__'], {'template_folder': '"""templates"""'}), "('officers', __name__, template_folder='templates')\n", (304, 355), False, 'from flask import Blueprint\n'), ((547, 612), 'flask.render_template', 'render_template', (['"""dashboard.html"""'], {'user... |
from rest_framework.generics import get_object_or_404
from rest_framework.permissions import BasePermission
from chat.consts import MESSAGE_TYPE_TO_CHAT_TYPE
class UserBelongToChatDetail(BasePermission):
def has_object_permission(self, request, view, obj):
return request.user in obj.chat.get_users()
cl... | [
"rest_framework.generics.get_object_or_404"
] | [((515, 552), 'rest_framework.generics.get_object_or_404', 'get_object_or_404', (['model'], {'pk': 'model_id'}), '(model, pk=model_id)\n', (532, 552), False, 'from rest_framework.generics import get_object_or_404\n')] |
from __future__ import absolute_import, unicode_literals
import base64
import hashlib
import json
import logging
import os
import pickle
import re
from builtins import str
import numpy as np
from boto.s3.connection import Key, S3Connection
from .constants import *
from btb import ParamTypes
from future import stan... | [
"logging.getLogger",
"pickle.dumps",
"base64.b64encode",
"boto.s3.connection.S3Connection",
"builtins.str",
"pickle.loads",
"re.search",
"os.path.exists",
"urllib.request.urlopen",
"re.match",
"pickle.load",
"os.path.isfile",
"boto.s3.connection.Key",
"pickle.dump",
"os.makedirs",
"os.... | [((347, 381), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (379, 381), False, 'from future import standard_library\n'), ((631, 655), 'logging.getLogger', 'logging.getLogger', (['"""atm"""'], {}), "('atm')\n", (648, 655), False, 'import logging\n'), ((2255, 2272), 'pic... |
import os
from git import Repo, Actor
from conda_build.conda_interface import (VersionOrder, MatchSpec, get_installed_version, root_dir, get_index, Resolve)
from .utils import tmp_directory
def update_me():
"""
Update the webservice on Heroku by pushing a commit to this repo.
"""
pkgs = ["conda-buil... | [
"git.Repo.clone_from",
"conda_build.conda_interface.MatchSpec",
"os.path.join",
"git.Actor",
"conda_build.conda_interface.Resolve",
"conda_build.conda_interface.VersionOrder",
"conda_build.conda_interface.get_index",
"conda_build.conda_interface.get_installed_version"
] | [((393, 430), 'conda_build.conda_interface.get_installed_version', 'get_installed_version', (['root_dir', 'pkgs'], {}), '(root_dir, pkgs)\n', (414, 430), False, 'from conda_build.conda_interface import VersionOrder, MatchSpec, get_installed_version, root_dir, get_index, Resolve\n'), ((443, 482), 'conda_build.conda_inte... |
# -*- coding: utf-8 -*-
"""Untitled0.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1qLEN-Qo-E4aI0mXVJMXCM9bTirYQ9UTS
"""
# Commented out IPython magic to ensure Python compatibility.
import torch
import torchvision
import numpy as np
EPOCHS = 1... | [
"torch.utils.tensorboard.SummaryWriter",
"torch.nn.Sigmoid",
"torch.nn.NLLLoss",
"torch.nn.Linear",
"torch.utils.data.DataLoader",
"torch.nn.LogSoftmax",
"torchvision.transforms.ToTensor"
] | [((517, 579), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['xy_trainPT'], {'batch_size': 'BATCH_SIZE'}), '(xy_trainPT, batch_size=BATCH_SIZE)\n', (544, 579), False, 'import torch\n'), ((841, 859), 'torch.nn.NLLLoss', 'torch.nn.NLLLoss', ([], {}), '()\n', (857, 859), False, 'import torch\n'), ((1004, ... |
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Column, Layout, Row, Submit
from django import forms
from vacancies.models import Application
class ApplicationForm(forms.ModelForm):
class Meta:
model = Application
fields = (
"written_username",
"w... | [
"crispy_forms.layout.Submit",
"crispy_forms.layout.Column",
"crispy_forms.helper.FormHelper"
] | [((658, 670), 'crispy_forms.helper.FormHelper', 'FormHelper', ([], {}), '()\n', (668, 670), False, 'from crispy_forms.helper import FormHelper\n'), ((783, 858), 'crispy_forms.layout.Submit', 'Submit', (['"""submit"""', '"""Отправить заявку"""'], {'css_class': '"""btn btn-primary btn-block"""'}), "('submit', 'Отправить ... |
"""
Author: Anonymous
Description:
Contains several features for analyzing and comparing the
performance across multiple experiments:
- perfloss : Performance w.r.t. test/train loss ratio and the
used AE architecture
... | [
"logging.getLogger",
"numpy.prod",
"numpy.clip",
"numpy.convolve",
"pandas.read_csv",
"multiprocessing.cpu_count",
"numpy.array",
"numpy.linalg.norm",
"matplotlib.colors.LogNorm",
"behaviour_representations.analysis.load_metadata",
"numpy.mean",
"os.path.exists",
"numpy.repeat",
"argparse.... | [((794, 808), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (801, 808), True, 'import matplotlib as mpl\n'), ((1122, 1149), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1139, 1149), False, 'import logging\n'), ((1161, 1186), 'argparse.ArgumentParser', 'argparse.Argumen... |
from collections import OrderedDict
from xnmt.settings import active as settings
import numpy as np
import dynet as dy
from xnmt.param_collection import ParamManager
from xnmt.persistence import serializable_init, Serializable, bare, Ref
import xnmt.optimizer
from xnmt.training_task import SimpleTrainingTask
class T... | [
"collections.OrderedDict",
"xnmt.persistence.bare",
"dynet.renew_cg",
"xnmt.persistence.Ref",
"dynet.print_text_graphviz"
] | [((2911, 2923), 'xnmt.persistence.Ref', 'Ref', (['"""model"""'], {}), "('model')\n", (2914, 2923), False, 'from xnmt.persistence import serializable_init, Serializable, bare, Ref\n'), ((3007, 3051), 'xnmt.persistence.bare', 'bare', (['xnmt.batcher.SrcBatcher'], {'batch_size': '(32)'}), '(xnmt.batcher.SrcBatcher, batch_... |
# DO NOT MODIFY CLASS NAME
import copy
import itertools
from numpy import take
import utils
class Indexer:
# DO NOT MODIFY THIS SIGNATURE
# You can change the internal implementation as you see fit.
def __init__(self, config):
self.inverted_idx = {}
self.postingDict = {}
... | [
"utils.save_obj",
"utils.load_obj",
"copy.deepcopy"
] | [((4588, 4606), 'utils.load_obj', 'utils.load_obj', (['fn'], {}), '(fn)\n', (4602, 4606), False, 'import utils\n'), ((5031, 5117), 'utils.save_obj', 'utils.save_obj', (['(self.inverted_idx, self.postingDict, self.docs_to_info_dict)', 'fn'], {}), '((self.inverted_idx, self.postingDict, self.docs_to_info_dict\n ), fn)... |
from unittest import TestCase, mock
from unittest.mock import MagicMock
import numpy as np
from source.constants import Constants
from source.preprocessing.epoch import Epoch
from source.preprocessing.heart_rate.heart_rate_collection import HeartRateCollection
from source.preprocessing.heart_rate.heart_rate_feature_ser... | [
"source.constants.Constants.FEATURE_FILE_PATH.joinpath",
"source.preprocessing.heart_rate.heart_rate_feature_service.HeartRateFeatureService.write",
"source.preprocessing.epoch.Epoch",
"unittest.mock.MagicMock",
"source.preprocessing.heart_rate.heart_rate_feature_service.HeartRateFeatureService.load",
"nu... | [((409, 484), 'unittest.mock.patch', 'mock.patch', (['"""source.preprocessing.heart_rate.heart_rate_feature_service.pd"""'], {}), "('source.preprocessing.heart_rate.heart_rate_feature_service.pd')\n", (419, 484), False, 'from unittest import TestCase, mock\n'), ((1150, 1225), 'unittest.mock.patch', 'mock.patch', (['"""... |
'''
This file is for Glove Embedding.
If you have trouble to install glove_python library,
please execute this file on google CoLab.
'''
from google.colab import drive
drive.mount('/content/gdrive')
from glove import Corpus, Glove
from gensim.scripts.glove2word2vec import glove2word2vec
from gensim.models import Key... | [
"google.colab.drive.mount",
"glove.Corpus",
"glove.Glove",
"gensim.models.KeyedVectors.load_word2vec_format",
"os.path.isfile",
"gensim.scripts.glove2word2vec.glove2word2vec"
] | [((170, 200), 'google.colab.drive.mount', 'drive.mount', (['"""/content/gdrive"""'], {}), "('/content/gdrive')\n", (181, 200), False, 'from google.colab import drive\n'), ((964, 972), 'glove.Corpus', 'Corpus', ([], {}), '()\n', (970, 972), False, 'from glove import Corpus, Glove\n'), ((1056, 1090), 'glove.Glove', 'Glov... |
from lightgbm import LGBMClassifier
from Predictor import Predictor
from FeatureEngineering import *
class LGBMPredictor(Predictor):
def __init__(self, train, test, params={}, name='LightGBM'):
self.model = LGBMClassifier(**params)
super().__init__(train, test, params, name=name)
def set_pa... | [
"lightgbm.LGBMClassifier"
] | [((223, 247), 'lightgbm.LGBMClassifier', 'LGBMClassifier', ([], {}), '(**params)\n', (237, 247), False, 'from lightgbm import LGBMClassifier\n'), ((361, 385), 'lightgbm.LGBMClassifier', 'LGBMClassifier', ([], {}), '(**params)\n', (375, 385), False, 'from lightgbm import LGBMClassifier\n')] |
"""Models for VGG11/13/16/19 architectures for the usage as backbone for FCN models"""
import os
from torchvision import models
from misc import cached_download
from pytorchutils.globals import torch, nn
class VGGModel(models.vgg.VGG):
"""
VGG backbone cropped before fully connected layers.
References:... | [
"pytorchutils.globals.nn.BatchNorm2d",
"pytorchutils.globals.nn.Sequential",
"pytorchutils.globals.nn.ReLU",
"pytorchutils.globals.nn.Conv2d",
"pytorchutils.globals.nn.MaxPool2d"
] | [((3470, 3492), 'pytorchutils.globals.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (3483, 3492), False, 'from pytorchutils.globals import torch, nn\n'), ((3184, 3240), 'pytorchutils.globals.nn.Conv2d', 'nn.Conv2d', (['in_channels', 'config'], {'kernel_size': '(3)', 'padding': '(1)'}), '(in_channel... |
# -*- coding:utf-8 -*-
from django.db import models
# Create your models here.
from article.models import Post
class Comment(models.Model):
STATUS_NORMAL = 1
STATUS_DELETE = 0
STATUS_ITEMS = [
(STATUS_NORMAL, '正常'),
(STATUS_DELETE, '删除')
]
target = models.CharField(max_length=5... | [
"django.db.models.EmailField",
"django.db.models.DateTimeField",
"django.db.models.PositiveIntegerField",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((291, 344), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(500)', 'verbose_name': '"""评论目标"""'}), "(max_length=500, verbose_name='评论目标')\n", (307, 344), False, 'from django.db import models\n'), ((478, 530), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1000)', 'verb... |
"""
Utility function for ultisnips
"""
from typing import Any, Iterable, List
from pprint import pformat
from nayvy.function.func import get_current_func
from nayvy.importing.import_statement import ImportStatement
from nayvy.importing.utils import get_first_line_num, get_import_block_indices
from nayvy_vim_if.utils... | [
"nayvy.importing.import_statement.ImportStatement.of",
"nayvy.importing.utils.get_first_line_num",
"nayvy.importing.utils.get_import_block_indices",
"pprint.pformat",
"nayvy.importing.import_statement.ImportStatement.merge_list",
"nayvy_vim_if.utils.warning",
"nayvy.importing.import_statement.ImportStat... | [((847, 878), 'nayvy.importing.utils.get_import_block_indices', 'get_import_block_indices', (['lines'], {}), '(lines)\n', (871, 878), False, 'from nayvy.importing.utils import get_first_line_num, get_import_block_indices\n'), ((1318, 1347), 'nayvy.importing.import_statement.ImportStatement.of', 'ImportStatement.of', ([... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import compas
from compas_blender import draw_mesh
from compas_fab.artists import BaseRobotArtist
try:
import mathutils
except ImportError:
pass
__all__ = [
'RobotArtist',
]
class ... | [
"mathutils.Matrix",
"compas_blender.draw_mesh"
] | [((584, 623), 'mathutils.Matrix', 'mathutils.Matrix', (['transformation.matrix'], {}), '(transformation.matrix)\n', (600, 623), False, 'import mathutils\n'), ((741, 769), 'compas_blender.draw_mesh', 'draw_mesh', (['v', 'f'], {'color': 'color'}), '(v, f, color=color)\n', (750, 769), False, 'from compas_blender import dr... |
from django.shortcuts import render
from django.http import HttpResponse
def welcome(request):
# return HttpResponse("hello bosku!!!")
return render(request, 'welcome.html')
| [
"django.shortcuts.render"
] | [((152, 183), 'django.shortcuts.render', 'render', (['request', '"""welcome.html"""'], {}), "(request, 'welcome.html')\n", (158, 183), False, 'from django.shortcuts import render\n')] |
import os
port = os.environ.get('PORT', 5000)
bind = f"0.0.0.0:{port}"
# Copied from gunicorn.glogging.CONFIG_DEFAULTS
logconfig_dict = {
"root": {"level": "INFO", "handlers": ["console"]},
"loggers": {
"gunicorn.error": {
"propagate": True,
},
"gunicorn.access": {
... | [
"os.environ.get"
] | [((17, 45), 'os.environ.get', 'os.environ.get', (['"""PORT"""', '(5000)'], {}), "('PORT', 5000)\n", (31, 45), False, 'import os\n')] |
from itertools import zip_longest
from typing import List, Tuple, Optional, Dict, Set
import requests
import hashlib
from .logger import logger
from .constants import REPO_PATH
import subprocess
import shlex
import tempfile
import textwrap
from pathlib import Path
from distutils.version import Version
def vercmp(v1: ... | [
"tempfile.TemporaryDirectory",
"textwrap.dedent",
"hashlib.new",
"shlex.split",
"subprocess.Popen",
"pathlib.Path",
"requests.get"
] | [((4489, 4510), 'hashlib.new', 'hashlib.new', (['hashtype'], {}), '(hashtype)\n', (4500, 4510), False, 'import hashlib\n'), ((4821, 4838), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (4833, 4838), False, 'import requests\n'), ((4882, 4903), 'hashlib.new', 'hashlib.new', (['hashtype'], {}), '(hashtype)\n',... |
from sanic import Sanic
from aoiklivereload import LiveReloader
import asyncio
import uvloop
import logging
import config
from blueprints import Blueprints
from database import init_db
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
loop = asyncio.get_event_loop()
app = Sanic(__name__)
app.blueprint(Blue... | [
"database.init_db",
"sanic.Sanic",
"aoiklivereload.LiveReloader",
"uvloop.EventLoopPolicy",
"asyncio.get_event_loop",
"logging.info"
] | [((253, 277), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (275, 277), False, 'import asyncio\n'), ((285, 300), 'sanic.Sanic', 'Sanic', (['__name__'], {}), '(__name__)\n', (290, 300), False, 'from sanic import Sanic\n'), ((219, 243), 'uvloop.EventLoopPolicy', 'uvloop.EventLoopPolicy', ([], {}),... |
# Demonstrates the IPTC Media Topics document classification capability of the (Cloud based) expert.ai Natural Language API
from expertai.nlapi.cloud.client import ExpertAiClient
client = ExpertAiClient()
text = "I experience a mix of conflicting emotions: the approach of the fateful date scares me, but at the same t... | [
"expertai.nlapi.cloud.client.ExpertAiClient"
] | [((189, 205), 'expertai.nlapi.cloud.client.ExpertAiClient', 'ExpertAiClient', ([], {}), '()\n', (203, 205), False, 'from expertai.nlapi.cloud.client import ExpertAiClient\n')] |
from MFC import MFC
import serial
CR =b'\r'
flow = MFC()
s = serial.Serial('/dev/ttyUSB0')
a = s.read_until(CR)
print(a)
s.write(flow.Sync_Read())
for i in range(26):
j =s.read_until(CR)
print(j)
s.write(flow.SetPoint_Read())
b = s.read_until(CR)
print(b)
s.close()
| [
"MFC.MFC",
"serial.Serial"
] | [((51, 56), 'MFC.MFC', 'MFC', ([], {}), '()\n', (54, 56), False, 'from MFC import MFC\n'), ((61, 90), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyUSB0"""'], {}), "('/dev/ttyUSB0')\n", (74, 90), False, 'import serial\n')] |
from flask import Flask
from app.blueprints.auth import auth
from app.blueprints.ticket import ticket
app = Flask(__name__)
app.register_blueprint(auth, url_prefix='/auth')
app.register_blueprint(ticket, url_prefix='/ticket')
if __name__ == '__main__':
app.run()
| [
"flask.Flask"
] | [((109, 124), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (114, 124), False, 'from flask import Flask\n')] |
import unittest
from app.producer import get_website_metrics
from tests import app_factory
from config import integration_mode, target_website_simulator_url
class MyProducerTest(unittest.TestCase):
app = None
def setUp(self):
if integration_mode is False:
self.assertTrue(True)
... | [
"unittest.main",
"app.producer.get_website_metrics",
"tests.app_factory.build_production_app"
] | [((1499, 1514), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1512, 1514), False, 'import unittest\n'), ((390, 424), 'tests.app_factory.build_production_app', 'app_factory.build_production_app', ([], {}), '()\n', (422, 424), False, 'from tests import app_factory\n'), ((1156, 1201), 'app.producer.get_website_metr... |
from flask import render_template,redirect,url_for,abort,request
from . import main
from flask_login import login_required
from ..models import User,Pickuplines,Promotion,Product,Interview,Pitch
from .forms import UpdateProfile,PitchForm
from .. import db,photos
# Views
@main.route('/')
def home():
'''
View r... | [
"flask.render_template",
"flask.abort",
"flask.url_for"
] | [((397, 425), 'flask.render_template', 'render_template', (['"""home.html"""'], {}), "('home.html')\n", (412, 425), False, 'from flask import render_template, redirect, url_for, abort, request\n'), ((587, 637), 'flask.render_template', 'render_template', (['"""Profile/profile.html"""'], {'user': 'user'}), "('Profile/pr... |
#!/usr/bin/env python2
# Imports
import argparse
import datetime
import logging
from operator import itemgetter as ig
import os
import subprocess
import sys
import time
from bs4 import BeautifulSoup as BS
import psutil
import requests
# Constants
HISTORICAL_BTC_URL = 'http://api.bitcoincharts.com/v1/csv/'
# Functi... | [
"logging.basicConfig",
"argparse.ArgumentParser",
"os.waitpid",
"requests.get",
"os.getcwd",
"bs4.BeautifulSoup",
"os.chdir",
"os.path.isdir",
"os.execv",
"os.mkdir",
"os.fork",
"operator.itemgetter",
"sys.stdout.flush",
"time.time",
"sys.stdout.write"
] | [((353, 385), 'requests.get', 'requests.get', (['HISTORICAL_BTC_URL'], {}), '(HISTORICAL_BTC_URL)\n', (365, 385), False, 'import requests\n'), ((397, 407), 'bs4.BeautifulSoup', 'BS', (['r.text'], {}), '(r.text)\n', (399, 407), True, 'from bs4 import BeautifulSoup as BS\n'), ((1248, 1273), 'sys.stdout.write', 'sys.stdou... |
"""
## pyart radar object
pyart.core.radar
================
A general central radial scanning (or dwelling) instrument class.
.. autosummary::
:toctree: generated/
_rays_per_sweep_data_factory
_gate_data_factory
_gate_lon_lat_data_factory
_gate_altitude_data_factory
.. autosummary::
:toctree... | [
"numpy.mean",
"numpy.any",
"numpy.append",
"numpy.array",
"numpy.cumsum"
] | [((32840, 32871), 'numpy.array', 'np.array', (['sweeps'], {'dtype': '"""int32"""'}), "(sweeps, dtype='int32')\n", (32848, 32871), True, 'import numpy as np\n'), ((32883, 32916), 'numpy.any', 'np.any', (['(sweeps > self.nsweeps - 1)'], {}), '(sweeps > self.nsweeps - 1)\n', (32889, 32916), True, 'import numpy as np\n'), ... |
import logging
import os
from urlpath import URL
from datetime import datetime, timedelta
from azure.storage.blob import BlockBlobService, BlobPermissions
def get_signed_url_for_permstore_blob(permstore_url):
blob_url = URL(permstore_url)
# create sas signature
blob_service = __get_perm_store_... | [
"datetime.timedelta",
"datetime.datetime.utcnow",
"os.getenv",
"urlpath.URL"
] | [((225, 243), 'urlpath.URL', 'URL', (['permstore_url'], {}), '(permstore_url)\n', (228, 243), False, 'from urlpath import URL\n'), ((410, 449), 'os.getenv', 'os.getenv', (['"""DESTINATION_CONTAINER_NAME"""'], {}), "('DESTINATION_CONTAINER_NAME')\n", (419, 449), False, 'import os\n'), ((512, 529), 'datetime.datetime.utc... |
import pandas as pd
from ._compat import PANDAS_GT_100
from .extensions import make_array_nonempty, make_scalar
@make_array_nonempty.register(pd.DatetimeTZDtype)
def _dtype(dtype):
return pd.array([pd.Timestamp(1), pd.NaT], dtype=dtype)
@make_scalar.register(pd.DatetimeTZDtype)
def _(x):
return pd.Timestam... | [
"pandas.Timestamp",
"pandas.array"
] | [((309, 346), 'pandas.Timestamp', 'pd.Timestamp', (['(1)'], {'tz': 'x.tz', 'unit': 'x.unit'}), '(1, tz=x.tz, unit=x.unit)\n', (321, 346), True, 'import pandas as pd\n'), ((451, 486), 'pandas.array', 'pd.array', (["['a', pd.NA]"], {'dtype': 'dtype'}), "(['a', pd.NA], dtype=dtype)\n", (459, 486), True, 'import pandas as ... |
from datetime import datetime
from arclet.letoderea.entities.auxiliary import BaseAuxiliary
import asyncio
from arclet.letoderea import EventSystem
from arclet.letoderea.entities.event import TemplateEvent
loop = asyncio.get_event_loop()
test_stack = [0]
es = EventSystem(loop=loop)
class TestTimeLimit(BaseAuxiliary... | [
"datetime.datetime",
"arclet.letoderea.EventSystem",
"datetime.datetime.now",
"asyncio.sleep",
"asyncio.get_event_loop"
] | [((215, 239), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (237, 239), False, 'import asyncio\n'), ((262, 284), 'arclet.letoderea.EventSystem', 'EventSystem', ([], {'loop': 'loop'}), '(loop=loop)\n', (273, 284), False, 'from arclet.letoderea import EventSystem\n'), ((792, 806), 'datetime.dateti... |
import requests
import ast
import adal
from utilities.models import ConnectionInfo
from common.methods import set_progress
from infrastructure.models import CustomField
RESOURCE_IDENTIFIER = "userPrincipalName"
def create_custom_fields():
CustomField.objects.get_or_create(
name='first_name', type='STR',
... | [
"adal.AuthenticationContext",
"infrastructure.models.CustomField.objects.get_or_create",
"common.methods.set_progress",
"requests.get",
"ast.literal_eval",
"utilities.models.ConnectionInfo.objects.get"
] | [((246, 432), 'infrastructure.models.CustomField.objects.get_or_create', 'CustomField.objects.get_or_create', ([], {'name': '"""first_name"""', 'type': '"""STR"""', 'defaults': "{'label': 'first name', 'description': 'Used by the Office 365 blueprints',\n 'show_as_attribute': True}"}), "(name='first_name', type='STR... |
"""Add a feed to Feeds table.
Commands:
$ PYTHONPATH=./ python3 tools/rss_crawler/add_a_feed.py \
--mode=test --feed_type=rss --url=https://example.com/rss
"""
from datetime import datetime
import getopt
import logging
import sys
import requests
from util.feed import Feed
from util.feed_db import FeedDB
from ... | [
"logging.getLogger",
"util.url.url_to_hashkey",
"getopt.getopt",
"datetime.datetime.utcnow",
"requests.get",
"util.feed_reader_factory.infer_feed_type",
"util.feed_reader_factory.FeedReaderFactory",
"util.feed_db.FeedDB",
"sys.exit"
] | [((433, 452), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (450, 452), False, 'import logging\n'), ((1557, 1574), 'util.feed_db.FeedDB', 'FeedDB', ([], {'mode': 'mode'}), '(mode=mode)\n', (1563, 1574), False, 'from util.feed_db import FeedDB\n'), ((1590, 1609), 'util.url.url_to_hashkey', 'url_to_hashkey'... |
""" Tests for pyramid_webpack """
import os
import inspect
import re
import json
import shutil
import tempfile
import webtest
from mock import MagicMock
from pyramid.config import Configurator
from pyramid.renderers import render_to_response
from six.moves.queue import Queue, Empty # pylint: disable=E0401
from thread... | [
"six.moves.queue.Queue",
"re.compile",
"os.path.join",
"webtest.TestApp",
"pyramid_webpack.WebpackState",
"pyramid_webpack.StaticResource",
"pyramid_webpack.Webpack",
"pyramid.config.Configurator",
"tempfile.mkdtemp",
"inspect.getsource",
"shutil.rmtree",
"threading.Thread",
"mock.MagicMock"... | [((853, 860), 'six.moves.queue.Queue', 'Queue', ([], {}), '()\n', (858, 860), False, 'from six.moves.queue import Queue, Empty\n'), ((936, 994), 'threading.Thread', 'Thread', ([], {'target': 'load_stats', 'args': 'thread_args', 'kwargs': 'kwargs'}), '(target=load_stats, args=thread_args, kwargs=kwargs)\n', (942, 994), ... |
import os.path as osp
import mmcv
import math
from copy import deepcopy
from mmcv.runner import Hook
from mmcv.runner.dist_utils import master_only, get_dist_info
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from mmcv.runner.checkpoint import save_checkpoint, load_checkpoint
class EvalHo... | [
"os.path.join",
"mmcv.runner.checkpoint.load_checkpoint",
"mmdet.apis.single_gpu_test",
"copy.deepcopy",
"torch.no_grad",
"math.exp",
"mmcv.runner.checkpoint.save_checkpoint"
] | [((1058, 1116), 'mmdet.apis.single_gpu_test', 'single_gpu_test', (['runner.model', 'self.dataloader'], {'show': '(False)'}), '(runner.model, self.dataloader, show=False)\n', (1073, 1116), False, 'from mmdet.apis import single_gpu_test\n'), ((5178, 5200), 'copy.deepcopy', 'deepcopy', (['runner.model'], {}), '(runner.mod... |
from time import strptime, struct_time
from unittest.mock import MagicMock
import yaml
from riley.models import Podcast, Episode
from riley.storage import FileStorage, FileEpisodeStorage
config = """podcasts:
kalle:
feed: http://anka.se
priority: 5"""
history = """guid,title,link,media_href,publ... | [
"time.strptime",
"riley.storage.FileEpisodeStorage",
"unittest.mock.MagicMock",
"riley.storage.FileStorage",
"time.struct_time"
] | [((605, 618), 'riley.storage.FileStorage', 'FileStorage', ([], {}), '()\n', (616, 618), False, 'from riley.storage import FileStorage, FileEpisodeStorage\n'), ((1336, 1349), 'riley.storage.FileStorage', 'FileStorage', ([], {}), '()\n', (1347, 1349), False, 'from riley.storage import FileStorage, FileEpisodeStorage\n'),... |
from os import mkdir, rename
from os.path import join
import fire
from data_provider import DATA_DIR
def label():
val_dir = join(DATA_DIR, 'val_299_final')
mkdir(join(val_dir, 'Type_1'))
mkdir(join(val_dir, 'Type_2'))
mkdir(join(val_dir, 'Type_3'))
labels_file = join(DATA_DIR, 'solution_stg1_re... | [
"os.rename",
"os.path.join",
"fire.Fire"
] | [((132, 163), 'os.path.join', 'join', (['DATA_DIR', '"""val_299_final"""'], {}), "(DATA_DIR, 'val_299_final')\n", (136, 163), False, 'from os.path import join\n'), ((288, 331), 'os.path.join', 'join', (['DATA_DIR', '"""solution_stg1_release.csv"""'], {}), "(DATA_DIR, 'solution_stg1_release.csv')\n", (292, 331), False, ... |
"""
Module: Hashcode Plugin
Project: Adlibre DMS
Copyright: Adlibre Pty Ltd 2013
License: See LICENSE for license information
"""
import hashlib
from django import forms
from django.conf import settings
from dms_plugins.pluginpoints import BeforeRetrievalPluginPoint
from dms_plugins.pluginpoints import BeforeStorage... | [
"django.forms.ChoiceField",
"dms_plugins.workers.PluginError",
"hashlib.new"
] | [((782, 815), 'django.forms.ChoiceField', 'forms.ChoiceField', ([], {'choices': 'OPTION'}), '(choices=OPTION)\n', (799, 815), False, 'from django import forms\n'), ((3587, 3606), 'hashlib.new', 'hashlib.new', (['method'], {}), '(method)\n', (3598, 3606), False, 'import hashlib\n'), ((4582, 4628), 'dms_plugins.workers.P... |
# -*- coding: utf-8 -*-
import scrapy
IMGS_HOST = "http://www.alerj.rj.gov.br"
class AlerjSpider(scrapy.Spider):
name = "alerj"
start_urls = [
"http://www.alerj.rj.gov.br/Deputados/QuemSao"
]
def parse_detail(self, response):
obj = response.request.meta
size = len(respons... | [
"scrapy.Request"
] | [((1153, 1218), 'scrapy.Request', 'scrapy.Request', (['detail_page'], {'callback': 'self.parse_detail', 'meta': 'obj'}), '(detail_page, callback=self.parse_detail, meta=obj)\n', (1167, 1218), False, 'import scrapy\n')] |
import os
import argparse
import pandas as pd
from azureml.core import Run
import aml_utils
def main(dataset_name, output_train_data, output_test_data):
run = Run.get_context()
ws = aml_utils.retrieve_workspace()
data_raw = aml_utils.get_dataset(ws, dataset_name)
print(f"Loaded dataset with {len(d... | [
"aml_utils.get_dataset",
"os.makedirs",
"argparse.ArgumentParser",
"os.path.join",
"azureml.core.Run.get_context",
"aml_utils.retrieve_workspace"
] | [((167, 184), 'azureml.core.Run.get_context', 'Run.get_context', ([], {}), '()\n', (182, 184), False, 'from azureml.core import Run\n'), ((194, 224), 'aml_utils.retrieve_workspace', 'aml_utils.retrieve_workspace', ([], {}), '()\n', (222, 224), False, 'import aml_utils\n'), ((241, 280), 'aml_utils.get_dataset', 'aml_uti... |
import unittest
'''
the file in /tests/homework/b_in_proc_out/tests_in_proc_out
has the test functions
'''
from tests.homework.c_decisions import tests_decisions
suite = unittest.TestLoader().loadTestsFromModule(tests_decisions)
unittest.TextTestRunner(verbosity=2).run(suite)
| [
"unittest.TextTestRunner",
"unittest.TestLoader"
] | [((171, 192), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (190, 192), False, 'import unittest\n'), ((230, 266), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (253, 266), False, 'import unittest\n')] |
import asyncio
from aiohttp import ClientSession
from ..message.builder import ChatBubble
def _msg_package(session, target, chain):
return {
"sessionKey": session,
"target": target,
"messageChain": chain,
}
class HTTPRoBot:
def __init__(self, server_url, robot_qq, verify_key, se... | [
"aiohttp.ClientSession",
"asyncio.gather"
] | [((1163, 1193), 'aiohttp.ClientSession', 'ClientSession', (['self.server_url'], {}), '(self.server_url)\n', (1176, 1193), False, 'from aiohttp import ClientSession\n'), ((1554, 1584), 'aiohttp.ClientSession', 'ClientSession', (['self.server_url'], {}), '(self.server_url)\n', (1567, 1584), False, 'from aiohttp import Cl... |
from questionnaire import Questionnaire
import requests
q = Questionnaire(show_answers=False, can_go_back=False)
q.raw('user', prompt='Username:')
q.raw('pass', prompt='Password:', secret=True)
q.run()
r = requests.get('https://api.github.com/user/repos', auth=(q.answers.get('user'), q.answers.get('pass')))
if not(r.... | [
"questionnaire.Questionnaire",
"sys.exit"
] | [((61, 113), 'questionnaire.Questionnaire', 'Questionnaire', ([], {'show_answers': '(False)', 'can_go_back': '(False)'}), '(show_answers=False, can_go_back=False)\n', (74, 113), False, 'from questionnaire import Questionnaire\n'), ((385, 395), 'sys.exit', 'sys.exit', ([], {}), '()\n', (393, 395), False, 'import sys\n')... |
from setuptools import setup
setup(
name='beets-mpdadd',
version='0.2',
description='beets plugin that adds query results to the current MPD playlist',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
platforms='ALL',
packages=['beetsplug'],
install_requires=['beets', 'python... | [
"setuptools.setup"
] | [((30, 304), 'setuptools.setup', 'setup', ([], {'name': '"""beets-mpdadd"""', 'version': '"""0.2"""', 'description': '"""beets plugin that adds query results to the current MPD playlist"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT"""', 'platforms': '"""ALL"""', 'packages': "['beets... |
#!/usr/bin/env python3
"""
This script preprocesses an Asciidoc document, gathering all grammar
productions and dumping it into a `AUTO_REPLACE_WITH_GRAMMAR` section.
"""
import sys
class GrammarPreprocessor:
def __init__(self, reader, writer):
self.reader = reader
self.writer = writer
... | [
"sys.exit"
] | [((481, 492), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (489, 492), False, 'import sys\n')] |
# -- encoding: utf-8 --
"""
Turns audio files (whatever you can throw at ffmpeg)
into video files with a cover image.
"""
from __future__ import with_statement, print_function
import argparse
import json
import os
import subprocess
import sys
NEED_SHELL = (sys.platform == "win32")
FFMPEG_PATH = os.environ.get("FFMPEG_... | [
"json.loads",
"argparse.ArgumentParser",
"subprocess.check_call",
"subprocess.Popen",
"os.environ.get",
"os.path.basename"
] | [((297, 326), 'os.environ.get', 'os.environ.get', (['"""FFMPEG_PATH"""'], {}), "('FFMPEG_PATH')\n", (311, 326), False, 'import os\n'), ((911, 933), 'json.loads', 'json.loads', (['probe_text'], {}), '(probe_text)\n', (921, 933), False, 'import json\n'), ((4231, 4283), 'subprocess.check_call', 'subprocess.check_call', ([... |
import sqlite3
from collections import deque
conn = sqlite3.connect('clean.sqlite') # cleaned db for connection and true country analysis
cur = conn.cursor()
person_cur = conn.cursor()
def person_is_resident(pers_id, country_id):
person_cur.execute('''SELECT tc FROM True_countries WHERE id = ?''', (pers_id,))
... | [
"collections.deque",
"sqlite3.connect"
] | [((53, 84), 'sqlite3.connect', 'sqlite3.connect', (['"""clean.sqlite"""'], {}), "('clean.sqlite')\n", (68, 84), False, 'import sqlite3\n'), ((787, 794), 'collections.deque', 'deque', ([], {}), '()\n', (792, 794), False, 'from collections import deque\n')] |
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
class UserProfile (models.Model):
user = models.OneToOneField(User)
class Meta:
app_label = 'sculpture'
ordering = ['user__first_name', 'user__last_name', 'user__username']... | [
"django.db.models.signals.post_save.connect",
"django.db.models.OneToOneField"
] | [((848, 950), 'django.db.models.signals.post_save.connect', 'post_save.connect', (['create_user_profile'], {'sender': 'User', 'dispatch_uid': '"""sculpture.models.user_profile"""'}), "(create_user_profile, sender=User, dispatch_uid=\n 'sculpture.models.user_profile')\n", (865, 950), False, 'from django.db.models.sig... |
from __future__ import annotations
from typing import Optional, cast
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
from django.db import models
from model_utils.models import TimeStampedModel, UUIDModel
class UserManager(BaseUserManager):
def create_user(
self,
... | [
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((1104, 1170), 'django.db.models.CharField', 'models.CharField', ([], {'verbose_name': '"""ユーザ名"""', 'max_length': '(255)', 'unique': '(True)'}), "(verbose_name='ユーザ名', max_length=255, unique=True)\n", (1120, 1170), False, 'from django.db import models\n'), ((1218, 1251), 'django.db.models.BooleanField', 'models.Boole... |
import abc
from django.db.models import Q
class Filter(abc.ABC):
"""Use for creating filter classes
Args:
`key` (str): the unique filter identification
Methods:
`apply`: apply filter for objects
`apply_from_dict_params`: the same as `apply` but get filter param from params dict
... | [
"django.db.models.Q"
] | [((1987, 1990), 'django.db.models.Q', 'Q', ([], {}), '()\n', (1988, 1990), False, 'from django.db.models import Q\n'), ((2073, 2085), 'django.db.models.Q', 'Q', ([], {}), '(**{lp: p})\n', (2074, 2085), False, 'from django.db.models import Q\n')] |
from functools import reduce
class Solution:
def superPow(self, a: 'int', b: 'List[int]') -> 'int':
p = reduce(lambda x, y: (10*x + y)%1140, b)
return pow(a, p, 1337)
| [
"functools.reduce"
] | [((116, 159), 'functools.reduce', 'reduce', (['(lambda x, y: (10 * x + y) % 1140)', 'b'], {}), '(lambda x, y: (10 * x + y) % 1140, b)\n', (122, 159), False, 'from functools import reduce\n')] |
import torch.nn as nn
import torch.nn.functional as F
def conv(in_channels, out_channels, kernal_size=3, stride =2, padding=0, batch_norm = False):
layers =[]
layers.append(nn.Conv2d(in_channels, out_channels, kernel_size =kernal_size, stride =stride, padding=padding, bias =False))
if batch... | [
"torch.nn.BatchNorm2d",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.nn.Linear",
"torch.nn.ConvTranspose2d"
] | [((399, 421), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (412, 421), True, 'import torch.nn as nn\n'), ((768, 790), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (781, 790), True, 'import torch.nn as nn\n'), ((193, 302), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_ch... |
"""
shortcountrynames
-----------------
Install using ::
pip install shortcountrynames
See README.md and repository for details:
https://github.com/rgieseke/shortcountrynames
"""
import os
from setuptools import setup
import versioneer
path = os.path.abspath(os.path.dirname(__file__))
cmdclass = versione... | [
"os.path.dirname",
"versioneer.get_cmdclass",
"os.path.join",
"versioneer.get_version"
] | [((312, 337), 'versioneer.get_cmdclass', 'versioneer.get_cmdclass', ([], {}), '()\n', (335, 337), False, 'import versioneer\n'), ((273, 298), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (288, 298), False, 'import os\n'), ((349, 380), 'os.path.join', 'os.path.join', (['path', '"""README.md"... |
from ithz.fetchrss import refreshRSS
def do(id):
if id=="rss":
refreshRSS()
| [
"ithz.fetchrss.refreshRSS"
] | [((76, 88), 'ithz.fetchrss.refreshRSS', 'refreshRSS', ([], {}), '()\n', (86, 88), False, 'from ithz.fetchrss import refreshRSS\n')] |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import subprocess
import shlex
import pipes
import pexpect
import random
import select
import fcntl
import pwd
import time
from ansible import constants as C
from ansible.errors import AnsibleError, AnsibleConnectionFail... | [
"shlex.split",
"ansible.errors.AnsibleError"
] | [((1210, 1239), 'shlex.split', 'shlex.split', (['ansible_ssh_args'], {}), '(ansible_ssh_args)\n', (1221, 1239), False, 'import shlex\n'), ((3735, 3793), 'ansible.errors.AnsibleError', 'AnsibleError', (["('Failed to install sonic image. %s' % stdout)"], {}), "('Failed to install sonic image. %s' % stdout)\n", (3747, 379... |
#!/usr/bin/env python3
from setuptools import setup, find_packages
DESCRIPTION = open("README.rst", encoding="utf-8").read()
CLASSIFIERS = '''\
Intended Audience :: Developers
Intended Audience :: Science/Research
License :: OSI Approved
Operating System :: POSIX
Operating System :: Unix
Programming Language :: Pyth... | [
"setuptools.find_packages"
] | [((534, 549), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (547, 549), False, 'from setuptools import setup, find_packages\n')] |
import random
import sc2
from sc2.ids.ability_id import AbilityId
from sc2.constants import *
from sc2.position import Point2, Point3
from sc2 import Race
'''
Observer Info
-----------------
Attributes: Light, Mechanical, Detector
Defence:
Health: 40
Sheild: 20
Armor: 0 (+1)
Sight: 11 (+2.75)
Speed:... | [
"sc2.position.Point3"
] | [((1528, 1617), 'sc2.position.Point3', 'Point3', (['(self.unit.position3d.x, self.unit.position3d.y, self.unit.position3d.z + 1)'], {}), '((self.unit.position3d.x, self.unit.position3d.y, self.unit.\n position3d.z + 1))\n', (1534, 1617), False, 'from sc2.position import Point2, Point3\n')] |
import collections
import os
import random
from pathlib import Path
import logging
import shutil
from packaging import version
from tqdm import tqdm
import numpy as np
import torch
import torch.nn as nn
from torch.nn.parallel import DistributedDataParallel as DDP
import torch.distributed as dist
import torch.multipro... | [
"apex.amp.scale_loss",
"wandb.log",
"torch.cuda.device_count",
"wandb.init",
"apex.amp.initialize",
"utils.LossMeter",
"torch.distributed.barrier",
"torch.cuda.amp.GradScaler",
"pathlib.Path",
"wandb.config.update",
"torch.cuda.amp.autocast",
"apex.amp.master_params",
"packaging.version.pars... | [((651, 708), 'utils.set_global_logging_level', 'set_global_logging_level', (['logging.ERROR', "['transformers']"], {}), "(logging.ERROR, ['transformers'])\n", (675, 708), False, 'from utils import load_state_dict, LossMeter, count_parameters, set_global_logging_level\n'), ((842, 874), 'packaging.version.parse', 'versi... |
import unittest
from numpy.random import RandomState
class TestRandomState(unittest.TestCase):
def test_random_state(self):
my_random = RandomState(42)
random_list = [-4, 9, 4, 0, -3, -4, 8, 0, 0, -7]
gen_random_list = []
for i in range(10):
gen_random_list.append(my... | [
"numpy.random.RandomState"
] | [((152, 167), 'numpy.random.RandomState', 'RandomState', (['(42)'], {}), '(42)\n', (163, 167), False, 'from numpy.random import RandomState\n')] |
from builtins import str
__author__ = 'janomar'
import logging
import jaydebeapi
from airflow.hooks.dbapi_hook import DbApiHook
class JdbcHook(DbApiHook):
"""
General hook for jdbc db access.
If a connection id is specified, host, port, schema, username and password will be taken from the predefined con... | [
"builtins.str"
] | [((1471, 1480), 'builtins.str', 'str', (['host'], {}), '(host)\n', (1474, 1480), False, 'from builtins import str\n'), ((1482, 1492), 'builtins.str', 'str', (['login'], {}), '(login)\n', (1485, 1492), False, 'from builtins import str\n'), ((1494, 1502), 'builtins.str', 'str', (['psw'], {}), '(psw)\n', (1497, 1502), Fal... |
"""Create a Client connection to a Visonic PowerMax or PowerMaster Alarm System."""
#! /usr/bin/python3
# set the parent directory on the import path
import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,pa... | [
"sys.path.insert",
"asyncio.gather",
"argparse.ArgumentParser",
"asyncio.sleep",
"asyncio.current_task",
"inspect.currentframe",
"pyvisonic.setupLocalLogger",
"time.sleep",
"os.path.dirname",
"sys.exc_info",
"sys.exit",
"asyncio.all_tasks",
"asyncio.get_event_loop"
] | [((272, 299), 'os.path.dirname', 'os.path.dirname', (['currentdir'], {}), '(currentdir)\n', (287, 299), False, 'import os, sys, inspect\n'), ((300, 329), 'sys.path.insert', 'sys.path.insert', (['(0)', 'parentdir'], {}), '(0, parentdir)\n', (315, 329), False, 'import os, sys, inspect\n'), ((1626, 1695), 'argparse.Argume... |