code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import numpy as np
train_ratings_path = "./../Data/netflix/TrainingRatings.txt"
test_ratings_path = "./../Data/netflix/TestingRatings.txt"
map_users={}
map_titles={}
data_matrix = np.empty((28978,1821),dtype=np.float32)
data_matrix[:] = np.nan
with open(train_ratings_path,'r') as reader:
counter_titles=0
c... | [
"numpy.nanmean",
"numpy.sqrt",
"numpy.empty",
"numpy.isnan"
] | [((184, 225), 'numpy.empty', 'np.empty', (['(28978, 1821)'], {'dtype': 'np.float32'}), '((28978, 1821), dtype=np.float32)\n', (192, 225), True, 'import numpy as np\n'), ((730, 761), 'numpy.nanmean', 'np.nanmean', (['data_matrix'], {'axis': '(1)'}), '(data_matrix, axis=1)\n', (740, 761), True, 'import numpy as np\n'), (... |
import os.path
import pytest
INPUT_TXT = os.path.join(os.path.dirname(__file__), 'input.txt')
def compute(s: str) -> int:
packet = s.strip()
packet = "".join([hexadecimal_to_binary(c) for c in packet])
versions = []
parse_packet(versions, packet, 0)
return sum(versions)
def parse_packet(vers... | [
"pytest.mark.parametrize"
] | [((1481, 1553), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('input_s', 'expected')", '((INPUT_S, EXPECTED),)'], {}), "(('input_s', 'expected'), ((INPUT_S, EXPECTED),))\n", (1504, 1553), False, 'import pytest\n')] |
import random
from precise.skaters.managerutil.managertesting import manager_test_run
from precise.skaters.managers.equalmanagers import equal_daily_long_manager, equal_long_manager
from precise.skaters.managers.equalmanagers import equal_weekly_long_manager, equal_weekly_buy_and_hold_long_manager
from precise.skaterto... | [
"random.choice",
"precise.skatertools.data.equityhistorical.random_cached_equity_dense",
"numpy.testing.assert_array_almost_equal",
"precise.skaters.managerutil.managertesting.manager_test_run"
] | [((540, 568), 'random.choice', 'random.choice', (['LONG_MANAGERS'], {}), '(LONG_MANAGERS)\n', (553, 568), False, 'import random\n'), ((573, 598), 'precise.skaters.managerutil.managertesting.manager_test_run', 'manager_test_run', ([], {'mgr': 'mgr'}), '(mgr=mgr)\n', (589, 598), False, 'from precise.skaters.managerutil.m... |
# --------------------------------------------------------
# Visual Detection: State-of-the-Art
# Copyright: <NAME>
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
import torch
import torch.nn as nn
import torch.nn.functional as ... | [
"torch.abs",
"torch.exp",
"torch.nonzero",
"torch.sum",
"pdb.set_trace",
"torch.zeros",
"torch.zeros_like",
"torch.FloatTensor"
] | [((777, 825), 'torch.FloatTensor', 'torch.FloatTensor', (['cfg.FCGN.BBOX_NORMALIZE_MEANS'], {}), '(cfg.FCGN.BBOX_NORMALIZE_MEANS)\n', (794, 825), False, 'import torch\n'), ((861, 908), 'torch.FloatTensor', 'torch.FloatTensor', (['cfg.FCGN.BBOX_NORMALIZE_STDS'], {}), '(cfg.FCGN.BBOX_NORMALIZE_STDS)\n', (878, 908), False... |
# author: <NAME>
# code: https://github.com/mahmudahsan/thinkdiff
# blog: http://thinkdiff.net
# http://pythonbangla.com
# MIT License
# --------------------------
# Reporting Logs in text file
# --------------------------
import logging
def set_custom_log_info(filename):
logging.basicConfig(filename=filena... | [
"logging.basicConfig"
] | [((285, 343), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': 'filename', 'level': 'logging.INFO'}), '(filename=filename, level=logging.INFO)\n', (304, 343), False, 'import logging\n')] |
#!/usr/bin/env python
# coding: utf-8
# In[28]:
import matplotlib.pyplot as plt
import numpy as np
import csv
# In[32]:
listaHigh = []
listaLow = []
listaClose = []
contador = 0
lineas = len(open('GOOGLPrediccion.csv').readlines())
c = input()
if(int(c)!=0):
c = int(c)
else:
c = lineas
cantidad = linea... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ioff",
"matplotlib.pyplot.ion",
"csv.reader",
"matplotlib.pyplot.legend"
] | [((640, 659), 'matplotlib.pyplot.plot', 'plt.plot', (['listaHigh'], {}), '(listaHigh)\n', (648, 659), True, 'import matplotlib.pyplot as plt\n'), ((682, 700), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Fila"""'], {}), "('Fila')\n", (692, 700), True, 'import matplotlib.pyplot as plt\n'), ((734, 754), 'matplotlib.py... |
from __future__ import absolute_import, unicode_literals
import os
from .base import *
DEBUG = False
SECRET_KEY = os.environ.get("SECRET_KEY")
try:
from .local import *
except ImportError:
pass
| [
"os.environ.get"
] | [((118, 146), 'os.environ.get', 'os.environ.get', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (132, 146), False, 'import os\n')] |
import re, os, shutil
import lookml.config as conf
import lkml
import time, copy
from string import Template
from lookml.modules.project import *
import lkml, github
def snakeCase(string):
str1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', string)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', str1).lower()
def splice... | [
"copy.deepcopy",
"os.path.isfile",
"os.path.basename",
"lkml.load",
"re.sub",
"re.findall",
"os.path.relpath"
] | [((201, 246), 're.sub', 're.sub', (['"""(.)([A-Z][a-z]+)"""', '"""\\\\1_\\\\2"""', 'string'], {}), "('(.)([A-Z][a-z]+)', '\\\\1_\\\\2', string)\n", (207, 246), False, 'import re, os, shutil\n'), ((463, 587), 're.sub', 're.sub', (['"""(\\\\s|/|\\\\[|\\\\]|\\\\||\\\\,|<|>|\\\\.|\\\\?|\\\\{|\\\\}|#|=|~|!|\\\\+|\\\\$|\\\\%... |
import functools
import numpy as np
import pandas as pd
from NN_base import load_network, save_network, create_network
from tic_tac_toe import TicTacToeGameSpec, play_game
from TD_lambda import TD_train
NETWORK_FILE_PATH = None
NUMBER_OF_GAMES_TO_RUN = 500
NUMBER_OF_TEST = 200
NUMBER_OF_ROUNDS = 100
EPSILON = 0.1
TA... | [
"tic_tac_toe.TicTacToeGameSpec",
"functools.partial",
"TD_lambda.TD_train"
] | [((429, 448), 'tic_tac_toe.TicTacToeGameSpec', 'TicTacToeGameSpec', ([], {}), '()\n', (446, 448), False, 'from tic_tac_toe import TicTacToeGameSpec, play_game\n'), ((471, 584), 'functools.partial', 'functools.partial', (['create_network'], {'input_nodes': '(9)', 'hidden_nodes': '(20, 30)', 'output_nodes': '(1)', 'outpu... |
import torch.nn as nn
import torch
from function import normal
from function import calc_mean_std
decoder = nn.Sequential(
nn.ReflectionPad2d((1, 1, 1, 1)),
nn.Conv2d(512, 256, (3, 3)),
nn.ReLU(),
nn.Upsample(scale_factor=2, mode='nearest'),
nn.ReflectionPad2d((1, 1, 1, 1)),
nn.Conv2d(256, 256,... | [
"torch.nn.ReLU",
"torch.nn.Softmax",
"function.normal",
"torch.nn.Sequential",
"torch.nn.ReflectionPad2d",
"torch.nn.Conv2d",
"torch.nn.MSELoss",
"torch.nn.MaxPool2d",
"torch.nn.Upsample",
"torch.bmm",
"function.calc_mean_std"
] | [((128, 160), 'torch.nn.ReflectionPad2d', 'nn.ReflectionPad2d', (['(1, 1, 1, 1)'], {}), '((1, 1, 1, 1))\n', (146, 160), True, 'import torch.nn as nn\n'), ((166, 193), 'torch.nn.Conv2d', 'nn.Conv2d', (['(512)', '(256)', '(3, 3)'], {}), '(512, 256, (3, 3))\n', (175, 193), True, 'import torch.nn as nn\n'), ((199, 208), 't... |
from __future__ import absolute_import, division, print_function
from ..core import Expr
from datashape import dshape
from .boolean import BooleanInterface
from .numbers import NumberInterface
class ScalarSymbol(NumberInterface, BooleanInterface):
__slots__ = '_name', 'dtype'
def __init__(self, name, dtype=... | [
"datashape.dshape"
] | [((376, 389), 'datashape.dshape', 'dshape', (['dtype'], {}), '(dtype)\n', (382, 389), False, 'from datashape import dshape\n'), ((503, 521), 'datashape.dshape', 'dshape', (['self.dtype'], {}), '(self.dtype)\n', (509, 521), False, 'from datashape import dshape\n')] |
from dotenv import load_dotenv
import tweepy
from os import getenv
from typing import BinaryIO
BASE_BIO = "Inspired by @screenshakes. Powered by PyBoy: http://github.com/Baekalfen/PyBoy\n"
load_dotenv()
auth = tweepy.OAuthHandler(getenv('TWITTER_KEY'), getenv('TWITTER_SECRET'))
auth.set_access_token(getenv('TWITTER_... | [
"tweepy.Cursor",
"tweepy.API",
"os.getenv",
"dotenv.load_dotenv"
] | [((191, 204), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (202, 204), False, 'from dotenv import load_dotenv\n'), ((369, 385), 'tweepy.API', 'tweepy.API', (['auth'], {}), '(auth)\n', (379, 385), False, 'import tweepy\n'), ((233, 254), 'os.getenv', 'getenv', (['"""TWITTER_KEY"""'], {}), "('TWITTER_KEY')\n", (... |
from django.shortcuts import render
from getpage import *
from fbapp.models import Search, Clap
from django.http import Http404, HttpResponse
import json
# Create your views here.
def clap(request):
if request.is_ajax():
keyword = request.GET['keyword']
clap = Clap.objects.all()
if(len(clap) == 0):
clap = C... | [
"django.shortcuts.render",
"django.http.HttpResponse",
"json.dumps",
"fbapp.models.Search",
"fbapp.models.Search.objects.all",
"fbapp.models.Search.objects.filter",
"fbapp.models.Clap.objects.all"
] | [((825, 857), 'django.shortcuts.render', 'render', (['request', '"""home.html"""', '{}'], {}), "(request, 'home.html', {})\n", (831, 857), False, 'from django.shortcuts import render\n'), ((268, 286), 'fbapp.models.Clap.objects.all', 'Clap.objects.all', ([], {}), '()\n', (284, 286), False, 'from fbapp.models import Sea... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import cv2
from Text_B_ocr_crnn_model_file.crnn.util import resizeNormalize, strLabelConverter
class CRNN:
def __init__(self, alphabet=None):
self.alphabet = alphabet
def load_weights(self, path):
ocrPath = path
ocrPat... | [
"cv2.dnn.readNetFromTensorflow",
"numpy.argmax",
"numpy.array",
"Text_B_ocr_crnn_model_file.crnn.util.strLabelConverter",
"Text_B_ocr_crnn_model_file.crnn.util.resizeNormalize"
] | [((378, 428), 'cv2.dnn.readNetFromTensorflow', 'cv2.dnn.readNetFromTensorflow', (['ocrPath', 'ocrPathtxt'], {}), '(ocrPath, ocrPathtxt)\n', (407, 428), False, 'import cv2\n'), ((476, 502), 'Text_B_ocr_crnn_model_file.crnn.util.resizeNormalize', 'resizeNormalize', (['image', '(32)'], {}), '(image, 32)\n', (491, 502), Fa... |
# -*- coding: utf-8 -*-
import textwrap
import pytest
from dkbuild_apacheconf.dotdict import dotdict
def test_add_depth1():
dd = dotdict()
dd['hello'] = 42
print(dd)
assert dd.ctx == { 'hello': 42 }
def test_add_depth2():
dd = dotdict()
dd['hello.world'] = 42
print(dd)
assert dd.ct... | [
"textwrap.dedent",
"dkbuild_apacheconf.dotdict.dotdict",
"pytest.raises"
] | [((137, 146), 'dkbuild_apacheconf.dotdict.dotdict', 'dotdict', ([], {}), '()\n', (144, 146), False, 'from dkbuild_apacheconf.dotdict import dotdict\n'), ((253, 262), 'dkbuild_apacheconf.dotdict.dotdict', 'dotdict', ([], {}), '()\n', (260, 262), False, 'from dkbuild_apacheconf.dotdict import dotdict\n'), ((420, 429), 'd... |
"""
Simulated device classes
"""
from ophyd.device import Device, Component
from .signal import FakeSignal
class SimDevice(Device):
"""
Class to house components and methods common to all simulated devices.
"""
sim_x = Component(FakeSignal, value=0)
sim_y = Component(FakeSignal, value=0)
sim_... | [
"ophyd.device.Component"
] | [((238, 268), 'ophyd.device.Component', 'Component', (['FakeSignal'], {'value': '(0)'}), '(FakeSignal, value=0)\n', (247, 268), False, 'from ophyd.device import Device, Component\n'), ((281, 311), 'ophyd.device.Component', 'Component', (['FakeSignal'], {'value': '(0)'}), '(FakeSignal, value=0)\n', (290, 311), False, 'f... |
from suds.client import Client
import suds
import time
import helplib as hl
#be aware that you need a chemspider_token.txt in the directory for the app to work
#the chemspider_token.txt should only contain the token (available online for free)
class ChemicalObject():
def __init__(self, name = '', cas = '', inchi... | [
"suds.client.Client",
"helplib.openfile",
"time.sleep"
] | [((519, 536), 'suds.client.Client', 'Client', (['searchurl'], {}), '(searchurl)\n', (525, 536), False, 'from suds.client import Client\n'), ((752, 768), 'suds.client.Client', 'Client', (['inchiurl'], {}), '(inchiurl)\n', (758, 768), False, 'from suds.client import Client\n'), ((1303, 1338), 'helplib.openfile', 'hl.open... |
# Copyright (c) 2018 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute,... | [
"collections.namedtuple"
] | [((1297, 1374), 'collections.namedtuple', 'namedtuple', (['"""Command"""', '"""desc cb args cmds"""'], {'defaults': '(None, None, None, None)'}), "('Command', 'desc cb args cmds', defaults=(None, None, None, None))\n", (1307, 1374), False, 'from collections import namedtuple\n'), ((1379, 1489), 'collections.namedtuple'... |
## @package teetool
# This module contains the Visual_2d class
#
# See Visual_2d class for more details
import numpy as np
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
import teetool as tt
## Visual_2d class generates the 2d output using Matplotlib
#
# Even 3-dimensional trajectories can... | [
"matplotlib.pyplot.contourf",
"numpy.ones_like",
"numpy.greater",
"numpy.max",
"matplotlib.pyplot.close",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.contour",
"numpy.min",
"matplotlib.pyplot.title",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((710, 749), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'facecolor': '"""white"""'}), "(facecolor='white', **kwargs)\n", (720, 749), True, 'import matplotlib.pyplot as plt\n'), ((6461, 6546), 'numpy.array', 'np.array', (['[[x_lo, y_lo], [x_hi, y_lo], [x_hi, y_hi], [x_lo, y_hi], [x_lo, y_lo]]'], {}), '([[x_lo, y_l... |
import kmeans
import json
import numpy as np
NUM_GAUSSIANS = 32
DO_KMEANS = False
DEBUG = True
mixture_weights = [1.0/NUM_GAUSSIANS] * NUM_GAUSSIANS
if DEBUG:
print ("mixture_weights: ", mixture_weights)
print("Loading parsed data...")
traindata_processed_file = open("parsed_data/data1.universalenrollparsed", "... | [
"numpy.array",
"json.dumps",
"kmeans.do_kmeans",
"numpy.var"
] | [((811, 825), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (819, 825), True, 'import numpy as np\n'), ((842, 865), 'numpy.var', 'np.var', (['data_np'], {'axis': '(0)'}), '(data_np, axis=0)\n', (848, 865), True, 'import numpy as np\n'), ((481, 507), 'kmeans.do_kmeans', 'kmeans.do_kmeans', (['data', '(32)'], {}... |
#! /usr/bin/env python
import sys
import optparse
import netgpib
# Usage text
usage = """usage: %prog [options] CMD
Issue a command or query from a network-connected GPIB device.
example:
%prog -i 192.168.113.105 -d AG4395A -a 10 'POIN?'"""
# Parse options
parser = optparse.OptionParser(usage=usage)
parser.add_opt... | [
"netgpib.netGPIB",
"optparse.OptionParser",
"sys.exit"
] | [((271, 305), 'optparse.OptionParser', 'optparse.OptionParser', ([], {'usage': 'usage'}), '(usage=usage)\n', (292, 305), False, 'import optparse\n'), ((1037, 1125), 'netgpib.netGPIB', 'netgpib.netGPIB', (['options.ipAddress', 'options.gpibAddress', '"""\x04"""', '(0)'], {'log': 'options.log'}), "(options.ipAddress, opt... |
"""
PIC NVM implementation
"""
import os
import sys
from pyedbglib.util import binary
from pymcuprog import utils
from pymcuprog.nvm import NvmAccessProviderCmsisDapTool
from pymcuprog.pymcuprog_errors import PymcuprogNotSupportedError
from pymcuprog.deviceinfo.memorynames import MemoryNames
from pymcuprog.deviceinfo... | [
"pymcuprog.nvm.NvmAccessProviderCmsisDapTool.__init__",
"pymcuprog.utils.pagealign",
"os.path.normpath",
"common.debugprovider.provide_debugger_model",
"pyedbglib.util.binary.pack_le16"
] | [((668, 725), 'pymcuprog.nvm.NvmAccessProviderCmsisDapTool.__init__', 'NvmAccessProviderCmsisDapTool.__init__', (['self', 'device_info'], {}), '(self, device_info)\n', (706, 725), False, 'from pymcuprog.nvm import NvmAccessProviderCmsisDapTool\n'), ((1725, 1759), 'common.debugprovider.provide_debugger_model', 'provide_... |
import tensorflow as tf
import numpy as np
from gpflow.params import DataHolder, Minibatch
from gpflow import autoflow, params_as_tensors, ParamList
from gpflow.models.model import Model
from gpflow.mean_functions import Identity, Linear
from gpflow.mean_functions import Zero
from gpflow.quadrature import mvhermgauss... | [
"numpy.eye",
"gpflow.mean_functions.Zero",
"gpflow.mean_functions.Linear",
"numpy.zeros",
"numpy.concatenate",
"numpy.linalg.svd",
"numpy.random.randn",
"gpflow.mean_functions.Identity"
] | [((555, 561), 'gpflow.mean_functions.Zero', 'Zero', ([], {}), '()\n', (559, 561), False, 'from gpflow.mean_functions import Zero\n'), ((1833, 1839), 'gpflow.mean_functions.Zero', 'Zero', ([], {}), '()\n', (1837, 1839), False, 'from gpflow.mean_functions import Zero\n'), ((2598, 2625), 'numpy.concatenate', 'np.concatena... |
#2020-04-20 <NAME> created.
#serializer는 모두 ModelSerializer로 간단히 처리함
from rest_framework import serializers
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from .models import Profile
#Sign Up 회원가입
class UserSerializer(serializers.ModelSerializer):
class meta:
m... | [
"django.contrib.auth.authenticate",
"rest_framework.serializers.CharField",
"django.contrib.auth.models.User.objects.create_user",
"rest_framework.serializers.ValidationError"
] | [((1639, 1662), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (1660, 1662), False, 'from rest_framework import serializers\n'), ((1678, 1701), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (1699, 1701), False, 'from rest_framework import serializ... |
# ----------------------------------------------------------------------
# |
# | All.py
# |
# | <NAME> <<EMAIL>>
# | 2018-04-23 10:05:42
# |
# ----------------------------------------------------------------------
# |
# | Copyright <NAME> 2018-22.
# | Distributed under the Boost Software Lice... | [
"CommonEnvironment.ThisFullpath",
"CommonEnvironment.TypeInfo.FundamentalTypes.StringTypeInfo.StringTypeInfo",
"os.path.split"
] | [((1817, 1849), 'CommonEnvironment.ThisFullpath', 'CommonEnvironment.ThisFullpath', ([], {}), '()\n', (1847, 1849), False, 'import CommonEnvironment\n'), ((1879, 1910), 'os.path.split', 'os.path.split', (['_script_fullpath'], {}), '(_script_fullpath)\n', (1892, 1910), False, 'import os\n'), ((3608, 3632), 'CommonEnviro... |
import os
import matplotlib.pyplot as plt
from keras import applications
from keras.preprocessing.image import ImageDataGenerator, load_img
from keras import optimizers
from keras.models import Sequential, Model, load_model
from keras.layers import Dropout, Flatten, Dense, MaxPooling2D
from keras.regularizers import ... | [
"keras.optimizers.Adam",
"os.listdir",
"keras.callbacks.ModelCheckpoint",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"efficientnet.EfficientNetB5",
"keras.applications.xception.Xception",
"keras.preprocessing.image.ImageDataGenerator",
"keras.models.Sequential",
"os.path.join",
"matplo... | [((498, 572), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""person classification training code"""'}), "(description='person classification training code')\n", (521, 572), False, 'import argparse\n'), ((2902, 2914), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (2912, 2914)... |
import sys
sys.path.append('../')
import config
import pymysql.cursors
import pandas as pd
import numpy as np
from scipy import io as scipyio
from tempfile import SpooledTemporaryFile
from scipy.sparse import vstack as vstack_sparse_matrices
# Function to reassemble the p matrix from the vectors
def reconstitute_vect... | [
"scipy.io.mmread",
"tempfile.SpooledTemporaryFile",
"numpy.array",
"pandas.DataFrame",
"scipy.sparse.vstack",
"pandas.read_sql",
"sys.path.append"
] | [((11, 33), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (26, 33), False, 'import sys\n'), ((2329, 2372), 'scipy.sparse.vstack', 'vstack_sparse_matrices', (['listOfSparseVectors'], {}), '(listOfSparseVectors)\n', (2351, 2372), True, 'from scipy.sparse import vstack as vstack_sparse_matrices\n... |
from django.shortcuts import render, redirect , HttpResponseRedirect, get_object_or_404
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib.auth.forms import UserCreationForm, PasswordChangeForm
from django.views.generic import View, TemplateView, CreateView, UpdateView
from ... | [
"django.shortcuts.render",
"core.forms.EditaContaClienteForm",
"django.contrib.auth.forms.PasswordChangeForm",
"core.forms.ClienteForm",
"core.models.Produto.objects.filter",
"core.models.Produto.objects.all",
"django.contrib.auth.decorators.login_required",
"core.models.Categoria.objects.get"
] | [((1530, 1564), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""entrar"""'}), "(login_url='entrar')\n", (1544, 1564), False, 'from django.contrib.auth.decorators import login_required, user_passes_test\n'), ((653, 692), 'django.shortcuts.render', 'render', (['request', '"""inde... |
from django.contrib.auth.models import User
from django.test import TestCase
from adminlte_log.models import AdminlteLogType, AdminlteLog
class AdminlteLogTest(TestCase):
def setUp(self):
AdminlteLogType.objects.create(name='test', code='test')
self.user = User.objects.create_user(username='boha... | [
"adminlte_log.models.AdminlteLogType.objects.create",
"django.contrib.auth.models.User.objects.create_user",
"adminlte_log.models.AdminlteLog.info"
] | [((204, 260), 'adminlte_log.models.AdminlteLogType.objects.create', 'AdminlteLogType.objects.create', ([], {'name': '"""test"""', 'code': '"""test"""'}), "(name='test', code='test')\n", (234, 260), False, 'from adminlte_log.models import AdminlteLogType, AdminlteLog\n'), ((281, 323), 'django.contrib.auth.models.User.ob... |
from __future__ import print_function
import math
import tensorflow as tf
from sklearn.manifold import TSNE
from word2vec_input import *
from word2vec_plot import *
dataset_path = 'dataset/'
dataset = 'text8.zip'
vocabulary_size = 50000
batch_size = 128
embedding_size = 128
skip_window = 1
num_skips = 2
num_sampled =... | [
"tensorflow.Graph",
"tensorflow.nn.embedding_lookup",
"tensorflow.initialize_all_variables",
"tensorflow.placeholder",
"tensorflow.train.Saver",
"tensorflow.Session",
"math.sqrt",
"sklearn.manifold.TSNE",
"tensorflow.random_uniform",
"tensorflow.train.AdagradOptimizer",
"tensorflow.square",
"t... | [((407, 417), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (415, 417), True, 'import tensorflow as tf\n'), ((478, 522), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {'shape': '[batch_size]'}), '(tf.int32, shape=[batch_size])\n', (492, 522), True, 'import tensorflow as tf\n'), ((540, 587), 'tensorflow... |
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
print("Python Version:", torch.__version__)
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1,... | [
"numpy.mean",
"torch.nn.functional.nll_loss",
"torch.nn.Conv2d",
"torch.cuda.is_available",
"torch.nn.Linear",
"numpy.std",
"torch.nn.functional.log_softmax",
"torch.no_grad",
"torch.nn.functional.max_pool2d",
"torchvision.transforms.Normalize",
"torchvision.transforms.ToTensor"
] | [((2190, 2203), 'numpy.mean', 'np.mean', (['data'], {}), '(data)\n', (2197, 2203), True, 'import numpy as np\n'), ((2204, 2216), 'numpy.std', 'np.std', (['data'], {}), '(data)\n', (2210, 2216), True, 'import numpy as np\n'), ((308, 330), 'torch.nn.Conv2d', 'nn.Conv2d', (['(1)', '(20)', '(5)', '(1)'], {}), '(1, 20, 5, 1... |
'''
AAA lllllll lllllll iiii
A:::A l:::::l l:::::l i::::i
A:::::A l:::::l l:::::l iiii
A:::::::A l:::::l l:::::l
... | [
"pandas.read_csv",
"sklearn.metrics.auc",
"sys.exit",
"train_cvopt.train_cvopt",
"ludwig.api.LudwigModel.load",
"train_mlblocks.train_mlblocks",
"pyfiglet.Figlet",
"matplotlib.pyplot.xlabel",
"platform.system",
"os.mkdir",
"train_neuraxle.train_neuraxle",
"sklearn.metrics.mean_absolute_error",... | [((2550, 2568), 'pyfiglet.Figlet', 'Figlet', ([], {'font': '"""doh"""'}), "(font='doh')\n", (2556, 2568), False, 'from pyfiglet import Figlet\n'), ((2600, 2619), 'pyfiglet.Figlet', 'Figlet', ([], {'font': '"""doom"""'}), "(font='doom')\n", (2606, 2619), False, 'from pyfiglet import Figlet\n'), ((16731, 16742), 'os.getc... |
"""empty message
Revision ID: <PASSWORD>
Revises: None
Create Date: 2016-04-27 16:54:34.185442
"""
# revision identifiers, used by Alembic.
revision = '<PASSWORD>'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
... | [
"sqlalchemy.DateTime",
"alembic.op.drop_table",
"sqlalchemy.Boolean",
"sqlalchemy.Text",
"alembic.op.f",
"sqlalchemy.Integer",
"sqlalchemy.String"
] | [((2719, 2748), 'alembic.op.drop_table', 'op.drop_table', (['"""note_history"""'], {}), "('note_history')\n", (2732, 2748), False, 'from alembic import op\n'), ((2753, 2780), 'alembic.op.drop_table', 'op.drop_table', (['"""user_roles"""'], {}), "('user_roles')\n", (2766, 2780), False, 'from alembic import op\n'), ((278... |
from libraries import *
from text import *
from game import *
from reception import recep
# DISPLAY HELP TEXT
def help_text():
clear_screen()
print_tab("Help text will go here!")
# DISPLAY ABOUT TEXT
def cred_text():
clear_screen()
print_tab(pr_colour("l_green","-- CREDITS --"))
print_tab("Intro ... | [
"reception.recep"
] | [((1074, 1085), 'reception.recep', 'recep', (['game'], {}), '(game)\n', (1079, 1085), False, 'from reception import recep\n')] |
from crossed_wires import FuelManagementSystem
import pytest
class Test1:
@pytest.fixture
def fms(self):
return FuelManagementSystem("R8,U5,L5,D3", "U7,R6,D4,L4")
def test_steps_combined_min(self, fms):
assert fms.steps_combined_min() == 30
class Test2:
@pytest.fixture
def fms(s... | [
"crossed_wires.FuelManagementSystem"
] | [((130, 180), 'crossed_wires.FuelManagementSystem', 'FuelManagementSystem', (['"""R8,U5,L5,D3"""', '"""U7,R6,D4,L4"""'], {}), "('R8,U5,L5,D3', 'U7,R6,D4,L4')\n", (150, 180), False, 'from crossed_wires import FuelManagementSystem\n'), ((341, 438), 'crossed_wires.FuelManagementSystem', 'FuelManagementSystem', (['"""R75,D... |
import numpy as np
import cvxpy as cvx
import util
def set_contains_array(S, a):
"""
:param S: list of np.ndarray
:param a: np.ndarray
:return: contains, 0 or 1
"""
contains = 0
for b in S:
if not (a - b).any(): # if a contained in S
contains = 1
return contains
... | [
"cvxpy.Variable",
"cvxpy.Problem",
"numpy.ones",
"numpy.random.random",
"numpy.random.choice",
"numpy.argmax",
"numpy.sum",
"numpy.dot",
"numpy.zeros",
"numpy.random.seed",
"numpy.ravel",
"numpy.all",
"time.time",
"cvxpy.Maximize"
] | [((1555, 1569), 'cvxpy.Variable', 'cvx.Variable', ([], {}), '()\n', (1567, 1569), True, 'import cvxpy as cvx\n'), ((1578, 1593), 'cvxpy.Variable', 'cvx.Variable', (['S'], {}), '(S)\n', (1590, 1593), True, 'import cvxpy as cvx\n'), ((1610, 1625), 'cvxpy.Maximize', 'cvx.Maximize', (['d'], {}), '(d)\n', (1622, 1625), True... |
#!/usr/bin/env python
# coding=utf-8
import os as os
import sys as sys
import traceback as trb
import argparse as argp
import csv as csv
import functools as fnt
import collections as col
import multiprocessing as mp
import numpy as np
import pandas as pd
import intervaltree as ivt
def parse_command_line():
"""
... | [
"intervaltree.IntervalTree",
"csv.DictWriter",
"csv.DictReader",
"argparse.ArgumentParser",
"traceback.print_exc",
"collections.defaultdict",
"functools.partial",
"multiprocessing.Pool",
"sys.exit",
"pandas.HDFStore"
] | [((354, 375), 'argparse.ArgumentParser', 'argp.ArgumentParser', ([], {}), '()\n', (373, 375), True, 'import argparse as argp\n'), ((1669, 1710), 'functools.partial', 'fnt.partial', (['compute_weights', 'cons_scores'], {}), '(compute_weights, cons_scores)\n', (1680, 1710), True, 'import functools as fnt\n'), ((2338, 235... |
#!/usr/bin/env python3
# BSD 3-Clause "New" or "Revised" License
# Copyright (c) 2021, Masanori-Suzu1024 RyuichiUeda
# All rights reserved.
# Genshin is a copyrighted work of miHoYo co., Ltd
import rospy
from std_msgs.msg import Int32
n = 0
def cb(message):
global n
n = message.data
if __name__== '__mai... | [
"rospy.Subscriber",
"rospy.is_shutdown",
"rospy.init_node",
"rospy.Rate",
"rospy.Publisher"
] | [((330, 354), 'rospy.init_node', 'rospy.init_node', (['"""twice"""'], {}), "('twice')\n", (345, 354), False, 'import rospy\n'), ((365, 404), 'rospy.Subscriber', 'rospy.Subscriber', (['"""count_up"""', 'Int32', 'cb'], {}), "('count_up', Int32, cb)\n", (381, 404), False, 'import rospy\n'), ((415, 461), 'rospy.Publisher',... |
from campy.graphics.gwindow import GWindow
from campy.graphics.gobjects import GOval, GRect
from campy.gui.events.mouse import onmouseclicked
import random
WINDOW_WIDTH = 600
WINDOW_HEIGHT = 400
ZONE_WIDTH = 100
ZONE_HEIGHT = 100
BALL_RADIUS = 15
MAX_SPEED = 6
MIN_Y_SPEED = 2
class ZoneGraphics:
def __init__(se... | [
"campy.graphics.gobjects.GRect",
"campy.graphics.gwindow.GWindow",
"campy.graphics.gobjects.GOval",
"random.random",
"random.randint",
"campy.gui.events.mouse.onmouseclicked"
] | [((517, 572), 'campy.graphics.gwindow.GWindow', 'GWindow', (['window_width', 'window_height'], {'title': '"""Zone Game"""'}), "(window_width, window_height, title='Zone Game')\n", (524, 572), False, 'from campy.graphics.gwindow import GWindow\n'), ((616, 723), 'campy.graphics.gobjects.GRect', 'GRect', (['zone_width', '... |
# -*- coding: utf-8 -*-
# @author : wanglei
# @date : 2021/2/19 1:47 PM
# @description :
import numpy as np
"""
感应器对象
"""
class Perceptron(object):
"""
该方法为感应器的初始化方法
eta:学习速率
n_iter:学习次数(迭代次数)
"""
def __init__(self, eta=0.01, n_iter=10):
self.eta = eta
self.n_iter = n_iter
... | [
"numpy.where",
"numpy.dot",
"numpy.zeros",
"pandas.read_csv"
] | [((1812, 1869), 'pandas.read_csv', 'pd.read_csv', (['"""/Users/a1/Downloads/iris.data"""'], {'header': 'None'}), "('/Users/a1/Downloads/iris.data', header=None)\n", (1823, 1869), True, 'import pandas as pd\n'), ((1969, 2004), 'numpy.where', 'np.where', (["(y == 'Iris-setosa')", '(-1)', '(1)'], {}), "(y == 'Iris-setosa'... |
# SPDX-License-Identifier: BSD-3-Clause
# Depthcharge: <https://github.com/nccgroup/depthcharge>
"""
ARM 32-bit support
"""
import os
import re
from .arch import Architecture
class ARM(Architecture):
"""
ARMv7 (or earlier) target information - 32-bit little-endian
"""
_desc = 'ARM 32-bit, little-end... | [
"re.compile"
] | [((1173, 1341), 're.compile', 're.compile', (['"""\n (?P<name>[a-zA-Z][a-zA-Z0-9]+)\n \\\\s?:\\\\s?\n (\\\\[<)?\n (?P<value>[0-9a-fA-F]{8})\n (>\\\\])?\n """', 're.VERBOSE'], {}), '(\n """\n (?P<name>[a-zA-Z][a-zA-Z0-9]+)\n \\\\s?:\\\\s?\n (\\\\[<)?\n ... |
from collections import defaultdict
import copy
def get_next(current, d, finish):
flag=False
if len(d[current])==1:
if d[current][0]==finish and len(d.keys())==1:
flag= True
else:
new_d = copy.deepcopy(d)
new_current = d[current][0]
new_d.pop(cur... | [
"collections.defaultdict",
"copy.deepcopy"
] | [((743, 760), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (754, 760), False, 'from collections import defaultdict\n'), ((238, 254), 'copy.deepcopy', 'copy.deepcopy', (['d'], {}), '(d)\n', (251, 254), False, 'import copy\n'), ((483, 499), 'copy.deepcopy', 'copy.deepcopy', (['d'], {}), '(d)\n', ... |
import model
def izpis_igre(igra):
return (
f"Igraš igro vislic:\n" +
f"Narobe ugibane črke so: {igra.nepravilni_ugibi()}\n" +
f"Trenutno stanje besede: {igra.pravilni_del_gesla()}\n"
)
def izpis_poraza(igra):
return (
f"Izgubil si. Več sreče prihodnjič.\n" +
f"Naro... | [
"model.nova_igra"
] | [((1035, 1069), 'model.nova_igra', 'model.nova_igra', (['model.bazen_besed'], {}), '(model.bazen_besed)\n', (1050, 1069), False, 'import model\n')] |
from django.db import models
from django.contrib.auth.models import User
from cloudinary.models import CloudinaryField
# Create your models here.
class Neighborhood(models.Model):
name = models.CharField(max_length = 50)
location = models.ForeignKey('Location',on_delete = models.CASCADE,null = True)
admin ... | [
"django.db.models.EmailField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"cloudinary.models.CloudinaryField",
"django.db.models.CharField"
] | [((192, 223), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (208, 223), False, 'from django.db import models\n'), ((241, 307), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""Location"""'], {'on_delete': 'models.CASCADE', 'null': '(True)'}), "('Location',... |
from abc import ABC, abstractmethod
from typing import Protocol, Callable
from aws_lambda_powertools import Tracer
tracer = Tracer()
class UpdateTable(Protocol):
update_item: Callable
class UpdateAdapter(ABC):
@abstractmethod
def update(self, path: str) -> int:
"""return hitCount for the given ... | [
"aws_lambda_powertools.Tracer"
] | [((125, 133), 'aws_lambda_powertools.Tracer', 'Tracer', ([], {}), '()\n', (131, 133), False, 'from aws_lambda_powertools import Tracer\n')] |
########################################################################
# Copyright 2021, UChicago Argonne, LLC
#
# Licensed under the BSD-3 License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a
# copy of the License at
#
# https://opensource.org/licenses/BSD-... | [
"numpy.array",
"numpy.zeros"
] | [((8731, 8944), 'numpy.array', 'np.array', (["[Cf_sc['laminar'] * asm_obj.bundle_params['de'] / asm_obj.params['de'] ** 2,\n Cf_sc['turbulent'] * asm_obj.bundle_params['de'] ** _M['turbulent'] / \n asm_obj.params['de'] ** (_M['turbulent'] + 1)]"], {}), "([Cf_sc['laminar'] * asm_obj.bundle_params['de'] / asm_obj.p... |
#!/usr/bin/env python
import os
import sys
import re
import fnmatch
import subprocess
import tempfile
import Utils
def GetFiles(dir, filePattern):
paths = []
for root, dirs, files in os.walk(dir):
for file in files:
if fnmatch.fnmatch(os.path.join(root, file), filePattern):
... | [
"re.search",
"os.close",
"subprocess.Popen",
"os.path.join",
"os.getcwd",
"sys.exit",
"tempfile.mkstemp",
"Utils.IsSwitch",
"os.walk",
"os.remove"
] | [((205, 217), 'os.walk', 'os.walk', (['dir'], {}), '(dir)\n', (212, 217), False, 'import os\n'), ((1406, 1424), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {}), '()\n', (1422, 1424), False, 'import tempfile\n'), ((1430, 1450), 'os.close', 'os.close', (['filehandle'], {}), '(filehandle)\n', (1438, 1450), False, 'import... |
"""
Expands a bash-style brace expression, and outputs each expansion.
Licensed under MIT
Copyright (c) 2018 - 2020 <NAME> <<EMAIL>>
Copyright (c) 2021 <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to... | [
"bracex.iexpand",
"argparse.ArgumentParser"
] | [((1342, 1501), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""python -m bracex"""', 'description': '"""Expands a bash-style brace expression, and outputs each expansion."""', 'allow_abbrev': '(False)'}), "(prog='python -m bracex', description=\n 'Expands a bash-style brace expression, and o... |
#!/usr/bin/env python3
import csv
import os
import requests
from bs4 import BeautifulSoup
from dateutil.parser import parse
def print_details(url, csv_filename, years):
"""
Parsing the scientific publications from the web site and
export the list in a CSV file
"""
item_year = item_journal = ite... | [
"csv.DictWriter",
"dateutil.parser.parse",
"requests.get",
"bs4.BeautifulSoup",
"os.stat"
] | [((522, 568), 'csv.DictWriter', 'csv.DictWriter', (['csvfile'], {'fieldnames': 'fieldnames'}), '(csvfile, fieldnames=fieldnames)\n', (536, 568), False, 'import csv\n'), ((630, 647), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (642, 647), False, 'import requests\n'), ((663, 693), 'bs4.BeautifulSoup', 'Beau... |
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from rl.dataset import ReplayBuffer, RandomSampler
from rl.base_agent import BaseAgent
from rl.policies.mlp_actor_critic import MlpActor, MlpCritic
from util.logger import logger
from util.mpi import mpi_average
from util.pytorch import ... | [
"util.pytorch.compute_gradient_norm",
"rl.dataset.ReplayBuffer",
"util.pytorch.obs2tensor",
"env.action_spec.ActionSpec",
"torch.min",
"rl.policies.mlp_actor_critic.MlpActor",
"numpy.isfinite",
"util.pytorch.sync_networks",
"rl.policies.mlp_actor_critic.MlpCritic",
"util.pytorch.count_parameters",... | [((2111, 2166), 'rl.policies.mlp_actor_critic.MlpActor', 'MlpActor', (['config', 'ob_space', 'ac_space'], {'tanh_policy': '(False)'}), '(config, ob_space, ac_space, tanh_policy=False)\n', (2119, 2166), False, 'from rl.policies.mlp_actor_critic import MlpActor, MlpCritic\n'), ((2193, 2248), 'rl.policies.mlp_actor_critic... |
# Create your tests here.
from article.db_manager.article_manager import create_article_db
from utils.api.tests import APIClient, APITestCase
from utils.constants import ArticleTypeChoice
from utils.shortcuts import rand_str
def mock_create_article(title=None, content=None, art_type=None, owner_id=None):
title =... | [
"utils.api.tests.APIClient",
"article.db_manager.article_manager.create_article_db",
"utils.shortcuts.rand_str"
] | [((488, 541), 'article.db_manager.article_manager.create_article_db', 'create_article_db', (['title', 'content', 'art_type', 'owner_id'], {}), '(title, content, art_type, owner_id)\n', (505, 541), False, 'from article.db_manager.article_manager import create_article_db\n'), ((330, 350), 'utils.shortcuts.rand_str', 'ran... |
from django.db import models
from django.contrib.auth.models import BaseUserManager, AbstractBaseUser
from event.models import Event
class UserManager(BaseUserManager):
def create_user(self, email, password=None):
if not email:
raise ValueError('Users must have an email address')
user... | [
"django.db.models.EmailField",
"django.db.models.DateField",
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((753, 829), 'django.db.models.EmailField', 'models.EmailField', ([], {'verbose_name': '"""email address"""', 'max_length': '(255)', 'unique': '(True)'}), "(verbose_name='email address', max_length=255, unique=True)\n", (770, 829), False, 'from django.db import models\n'), ((878, 933), 'django.db.models.CharField', 'm... |
"""MINUIT from Python - Fitting like a boss
Basic usage example::
from iminuit import Minuit
def f(x, y, z):
return (x - 2) ** 2 + (y - 3) ** 2 + (z - 4) ** 2
m = Minuit(f)
m.migrad()
print(m.values) # {'x': 2,'y': 3,'z': 4}
print(m.errors) # {'x': 1,'y': 1,'z': 1}
Further informati... | [
"pytest.main"
] | [((950, 967), 'pytest.main', 'pytest.main', (['args'], {}), '(args)\n', (961, 967), False, 'import pytest\n')] |
import pandas as pd
from backtrader import TimeFrame, date2num
from sqlalchemy import create_engine, inspect
from tqdm import tqdm
from koapy.backtrader.SQLiteData import SQLiteData
from koapy.utils.data.KrxHistoricalDailyPriceDataForBacktestLoader import (
KrxHistoricalDailyPriceDataForBacktestLoader,
)
class ... | [
"backtrader.date2num",
"sqlalchemy.create_engine",
"tqdm.tqdm",
"koapy.utils.data.KrxHistoricalDailyPriceDataForBacktestLoader.KrxHistoricalDailyPriceDataForBacktestLoader",
"sqlalchemy.inspect",
"pandas.Timestamp"
] | [((2109, 2170), 'koapy.utils.data.KrxHistoricalDailyPriceDataForBacktestLoader.KrxHistoricalDailyPriceDataForBacktestLoader', 'KrxHistoricalDailyPriceDataForBacktestLoader', (['source_filename'], {}), '(source_filename)\n', (2153, 2170), False, 'from koapy.utils.data.KrxHistoricalDailyPriceDataForBacktestLoader import ... |
from textx.exceptions import TextXSemanticError
from cid.parser.model import ParameterCliValue, BoolWithPositivePattern
from cid.common.utils import get_cli_pattern_count, is_iterable, element_type
# ------------------------------- HELPER FUNCTIONS -------------------------------
def contains_duplicate_names(lst):... | [
"cid.common.utils.get_cli_pattern_count",
"cid.common.utils.element_type",
"cid.common.utils.is_iterable",
"textx.exceptions.TextXSemanticError"
] | [((1234, 1293), 'textx.exceptions.TextXSemanticError', 'TextXSemanticError', (['"""Found duplicate free parameter names."""'], {}), "('Found duplicate free parameter names.')\n", (1252, 1293), False, 'from textx.exceptions import TextXSemanticError\n'), ((1515, 1572), 'textx.exceptions.TextXSemanticError', 'TextXSemant... |
from django.db.models import fields
from rest_framework import serializers
from facegram.profiles.models import Profile
from facegram.users.api.serializers import UserSerializer
class RetrieveUserProfileSerializerV1(serializers.ModelSerializer):
user = UserSerializer(read_only=True)
class Meta:
model ... | [
"facegram.users.api.serializers.UserSerializer"
] | [((259, 289), 'facegram.users.api.serializers.UserSerializer', 'UserSerializer', ([], {'read_only': '(True)'}), '(read_only=True)\n', (273, 289), False, 'from facegram.users.api.serializers import UserSerializer\n')] |
from rest_framework import generics, permissions
from rest_framework import filters as filters_rf
from django_filters import rest_framework as filters
from allauth.socialaccount.models import SocialAccount, SocialApp, SocialToken
from .serializers import SocialAppSerializer, SocialAppExtendedSerializer, SocialAccountS... | [
"allauth.socialaccount.models.SocialAccount.objects.all",
"allauth.socialaccount.models.SocialAccount.objects.none",
"allauth.socialaccount.models.SocialToken.objects.none",
"allauth.socialaccount.models.SocialApp.objects.none",
"allauth.socialaccount.models.SocialApp.objects.all",
"allauth.socialaccount.... | [((580, 603), 'allauth.socialaccount.models.SocialApp.objects.all', 'SocialApp.objects.all', ([], {}), '()\n', (601, 603), False, 'from allauth.socialaccount.models import SocialAccount, SocialApp, SocialToken\n'), ((1143, 1166), 'allauth.socialaccount.models.SocialApp.objects.all', 'SocialApp.objects.all', ([], {}), '... |
import numpy as np
import xarray as xr
import exceptions
from dakota_file import DakotaFile
my_netcdf = DakotaFile()
filename = 'DAKOTA.nc'
my_netcdf.read(filename)
variable_dict1 = my_netcdf.get_variable_as_dict('test_scan1')
variable_dict2 = my_netcdf.get_variable_as_dict('test_scan2')
variable_dict3 = my_netcdf.g... | [
"dakota_file.DakotaFile"
] | [((105, 117), 'dakota_file.DakotaFile', 'DakotaFile', ([], {}), '()\n', (115, 117), False, 'from dakota_file import DakotaFile\n')] |
from collections import defaultdict
from jvd.normalizer.syntax import get_definition
import sys
from jvd.utils import AttrDict
class DataUnit:
def __init__(self, json_obj, file_path):
super().__init__()
with open(file_path, "rb") as f:
self.fbytes = f.read()
self.obj = AttrDic... | [
"jvd.normalizer.syntax.get_definition",
"jvd.utils.AttrDict.from_nested_dict",
"collections.defaultdict"
] | [((313, 348), 'jvd.utils.AttrDict.from_nested_dict', 'AttrDict.from_nested_dict', (['json_obj'], {}), '(json_obj)\n', (338, 348), False, 'from jvd.utils import AttrDict\n'), ((524, 541), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (535, 541), False, 'from collections import defaultdict\n'), ((... |
#!/usr/bin/env python
"""
configuration for faps
Provides the Options class that will transparently handle the different option
sources through the .get() method. Pulls in defaults, site and job options plus
command line customisation. Instantiating Options will set up the logging for
the particular job.
"""
__all_... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.debug",
"logging.StreamHandler.emit",
"copy.copy",
"logging.info",
"logging.error",
"re.split",
"logging.addLevelName",
"io.StringIO",
"os.path.expanduser",
"ConfigParser.SafeConfigParser",
"os.path.dirname",
"logging.basicConfig",
"... | [((1580, 1611), 'ConfigParser.SafeConfigParser', 'configparser.SafeConfigParser', ([], {}), '()\n', (1609, 1611), True, 'import ConfigParser as configparser\n'), ((1636, 1667), 'ConfigParser.SafeConfigParser', 'configparser.SafeConfigParser', ([], {}), '()\n', (1665, 1667), True, 'import ConfigParser as configparser\n'... |
#!/usr/bin/env python3
# coding: utf-8
# Copyright 2016 <NAME>, https://github.com/tywtyw2002, and https://github.com/treedust
#
# 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:/... | [
"socket.socket",
"sys.exit"
] | [((1286, 1335), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (1299, 1335), False, 'import socket\n'), ((6115, 6126), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (6123, 6126), False, 'import sys\n')] |
import ROOT,sys
from larlite import larlite as fmwk1
from larcv import larcv as fmwk2
from ROOT import handshake
io1=fmwk1.storage_manager(fmwk1.storage_manager.kBOTH)
io1.add_in_filename(sys.argv[1])
io1.set_out_filename('boke.root')
io1.open()
io2=fmwk2.IOManager(fmwk2.IOManager.kREAD)
io2.add_in_file(sys.argv[2])
... | [
"ROOT.handshake.HandShaker",
"larcv.larcv.IOManager",
"larlite.larlite.storage_manager"
] | [((118, 168), 'larlite.larlite.storage_manager', 'fmwk1.storage_manager', (['fmwk1.storage_manager.kBOTH'], {}), '(fmwk1.storage_manager.kBOTH)\n', (139, 168), True, 'from larlite import larlite as fmwk1\n'), ((252, 290), 'larcv.larcv.IOManager', 'fmwk2.IOManager', (['fmwk2.IOManager.kREAD'], {}), '(fmwk2.IOManager.kRE... |
import RPi.GPIO as gpio
from enum import Enum
import time
from GpioMode import GpioMode
from UltrasonicSensor import UltrasonicSensor
class UltrasonicSensorSet:
def __init__(self, *args:UltrasonicSensor):
"""
:param args: UltrasonicSensor objects
"""
self.ussSet = args
def getD... | [
"RPi.GPIO.cleanup"
] | [((619, 633), 'RPi.GPIO.cleanup', 'gpio.cleanup', ([], {}), '()\n', (631, 633), True, 'import RPi.GPIO as gpio\n')] |
# Copyright 2014 OpenCore LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | [
"sys.stderr.write",
"string.Template",
"sh.mkdir"
] | [((5170, 5194), 'sh.mkdir', 'sh.mkdir', (['"""-p"""', 'host_dir'], {}), "('-p', host_dir)\n", (5178, 5194), False, 'import sh\n'), ((3390, 3404), 'string.Template', 'Template', (['line'], {}), '(line)\n', (3398, 3404), False, 'from string import Template\n'), ((3909, 3923), 'string.Template', 'Template', (['line'], {})... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) Copyright IBM Corp. 2010, 2018. All Rights Reserved.
from setuptools import setup, find_packages
setup(
name='fn_mcafee_esm',
version='1.0.2',
license='MIT',
author='<NAME>',
author_email='<EMAIL>',
description="Resilient Circuits Components ... | [
"setuptools.find_packages"
] | [((908, 923), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (921, 923), False, 'from setuptools import setup, find_packages\n')] |
from collections import deque
from enum import Enum
import logging
from .constants.codes import CatCode
from .constants.parameters import param_to_instr
from .constants.specials import special_to_instr
from .constants.instructions import (Instructions, if_instructions,
unexpanded_c... | [
"logging.getLogger",
"collections.deque"
] | [((638, 665), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (655, 665), False, 'import logging\n'), ((18927, 18934), 'collections.deque', 'deque', ([], {}), '()\n', (18932, 18934), False, 'from collections import deque\n')] |
import pathlib
from kronos_executor.execution_context import ExecutionContext
run_script = pathlib.Path(__file__).parent / "trivial_run.sh"
class TrivialExecutionContext(ExecutionContext):
scheduler_directive_start = ""
scheduler_directive_params = {}
scheduler_use_params = []
scheduler_cancel_head... | [
"pathlib.Path"
] | [((94, 116), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (106, 116), False, 'import pathlib\n')] |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
app = Flask(__name__)
app.config[
'SQLALCHEMY_DATABASE_URI'] = 'postgres://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
db = SQLAlchemy(app)
migrate = Migrate(app, db)
manage... | [
"flask_sqlalchemy.SQLAlchemy",
"flask_script.Manager",
"flask_migrate.Migrate",
"flask.Flask"
] | [((154, 169), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (159, 169), False, 'from flask import Flask\n'), ((270, 285), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (280, 285), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((296, 312), 'flask_migrate.Migrate', 'Migrate',... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
from absl import app
from absl import flags
import pandas as pd
FLAGS = flags.FLAGS
flags.DEFINE_string('dataset', None, 'A path to the dataset.')
flags.DEFINE_float('test_fraction', 0.2, 'A sp... | [
"absl.app.run",
"absl.flags.DEFINE_string",
"absl.flags.DEFINE_float",
"pandas.read_csv"
] | [((211, 273), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""dataset"""', 'None', '"""A path to the dataset."""'], {}), "('dataset', None, 'A path to the dataset.')\n", (230, 273), False, 'from absl import flags\n'), ((274, 353), 'absl.flags.DEFINE_float', 'flags.DEFINE_float', (['"""test_fraction"""', '(0.2)... |
#
# Copyright 2022 DMetaSoul
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | [
"collections.OrderedDict",
"sentence_transformers.SentenceTransformer",
"transformers.AutoConfig.from_pretrained",
"torch.nn.functional.normalize",
"torch.cuda.is_available"
] | [((4858, 4905), 'torch.nn.functional.normalize', 'torch.nn.functional.normalize', (['embs'], {'p': '(2)', 'dim': '(1)'}), '(embs, p=2, dim=1)\n', (4887, 4905), False, 'import torch\n'), ((1054, 1108), 'sentence_transformers.SentenceTransformer', 'SentenceTransformer', (['model_name_or_path'], {'device': 'device'}), '(m... |
import requests
from urllib.parse import urlparse
from os.path import join
#TODO: Break into separate standard settings module
ROOT_URL = 'http://progdisc.club/~lethargilistic/proxy'
HEADERS = {'User-Agent': 'dcapi-wrap (https://github.com/lethargilistic/dcapi-wrap)'}
def set_url(url):
if urlparse(url):
R... | [
"urllib.parse.urlparse",
"requests.get"
] | [((296, 309), 'urllib.parse.urlparse', 'urlparse', (['url'], {}), '(url)\n', (304, 309), False, 'from urllib.parse import urlparse\n'), ((491, 532), 'requests.get', 'requests.get', (['search_url'], {'headers': 'HEADERS'}), '(search_url, headers=HEADERS)\n', (503, 532), False, 'import requests\n')] |
from django.conf import settings
from django.conf.urls import url
from django.urls import LocalePrefixPattern, URLResolver, get_resolver, path
from TWLight.i18n.views import set_language
# Direct rip from django.conf.urls.i18n, but imports our local set_language
# from GitHub
def i18n_patterns(*urls, prefix_default_... | [
"django.urls.path",
"django.urls.LocalePrefixPattern"
] | [((732, 783), 'django.urls.path', 'path', (['"""setlang/"""', 'set_language'], {'name': '"""set_language"""'}), "('setlang/', set_language, name='set_language')\n", (736, 783), False, 'from django.urls import LocalePrefixPattern, URLResolver, get_resolver, path\n'), ((605, 673), 'django.urls.LocalePrefixPattern', 'Loca... |
import random
from fq.agent.base import Agent
from fq.four_board import Move
from fq.four_types import Point
class RandomBot(Agent):
def select_move(self, game_state):
'''
Choose a random valid move
'''
candidates = []
for c in range(1, game_state.board.num_cols +1):
... | [
"random.choice",
"fq.four_board.Move.play"
] | [((659, 684), 'random.choice', 'random.choice', (['candidates'], {}), '(candidates)\n', (672, 684), False, 'import random\n'), ((431, 451), 'fq.four_board.Move.play', 'Move.play', (['candidate'], {}), '(candidate)\n', (440, 451), False, 'from fq.four_board import Move\n')] |
import math
import numpy as np
import cv2
import json
import argparse
def augment_homogeneous(V, augment):
""" Augment a 3xN array of vectors into a 4xN array of homogeneous coordinates
Args:
v (np.array 3xN): Array of vectors
augment (float): The value to fill in for the W coordinate
Retu... | [
"numpy.sqrt",
"cv2.remap",
"math.sqrt",
"math.cos",
"numpy.array",
"numpy.linalg.norm",
"numpy.sin",
"scipy.interpolate.interp2d",
"numpy.flip",
"math.tan",
"argparse.ArgumentParser",
"numpy.linspace",
"numpy.meshgrid",
"numpy.maximum",
"numpy.ones",
"numpy.cos",
"cv2.imread",
"num... | [((397, 422), 'numpy.zeros', 'np.zeros', (['(4, V.shape[1])'], {}), '((4, V.shape[1]))\n', (405, 422), True, 'import numpy as np\n'), ((823, 856), 'numpy.linalg.norm', 'np.linalg.norm', (['V[0:3, :]'], {'axis': '(0)'}), '(V[0:3, :], axis=0)\n', (837, 856), True, 'import numpy as np\n'), ((912, 922), 'numpy.copy', 'np.c... |
from __future__ import absolute_import
import chainer
import chainer.functions as F
from .convolution import ConvolutionND
def _pair(x, ndim=2):
if hasattr(x, '__getitem__'):
return x
return [x]*ndim
class PixelShuffleUpsamplerND(chainer.Chain):
"""Pixel Shuffler for the super resolution.
Th... | [
"chainer.functions.reshape"
] | [((1770, 1832), 'chainer.functions.reshape', 'F.reshape', (['out', '((batchsize, out_channels) + r_tuple + in_shape)'], {}), '(out, (batchsize, out_channels) + r_tuple + in_shape)\n', (1779, 1832), True, 'import chainer.functions as F\n'), ((1910, 1963), 'chainer.functions.reshape', 'F.reshape', (['out', '((batchsize, ... |
"""A compact GUI application for optical distortion calibration of endoscopes.
See:
https://github.com/gift-surg/endocal
"""
from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
doc_dir = path.abspath(path.join(path.dirname(__file__), 'doc'))
# Get the summary
summ... | [
"os.path.join",
"os.path.dirname",
"setuptools.setup"
] | [((589, 2032), 'setuptools.setup', 'setup', ([], {'name': '"""endocal"""', 'version': '"""18.02.13"""', 'description': 'summary', 'long_description': 'long_description', 'url': '"""https://github.com/gift-surg/endocal"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""BSD-3-Clause"""', 'clas... |
import sys
from unittest.mock import MagicMock, patch # noqa F401
import mock
import pytest # noqa F401
# TODO: Simplify the mocking of private (unavailable) dataiku lib.
# Current mocking is ugly and complex.
if 'dataiku.Dataset' in sys.modules:
del sys.modules['dataiku.Dataset']
if 'dataiku' in sys.modules:
... | [
"mock.patch",
"birgitta.schema.schema.Schema",
"birgitta.fields.Catalog",
"unittest.mock.MagicMock",
"birgitta.dataframe.dataframe.write",
"mock.MagicMock",
"birgitta.dataframesource.sources.dataikusource.DataikuSource",
"birgitta.dataiku.schema.to_dataiku"
] | [((620, 636), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (634, 636), False, 'import mock\n'), ((688, 704), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (702, 704), False, 'import mock\n'), ((757, 773), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (771, 773), False, 'import mock\n'), ((833, ... |
#! /usr/bin/env python
"""
.. module:: bug0
:platform: Unix
:synopsis: Python module for implementing the bug0 path planning algorithm
.. moduleauthor:: <NAME> <EMAIL>
This node implements the bug0 path planning algorithm for moving a robot from its current
position to some target position.
Subscribe... | [
"tf.transformations.euler_from_quaternion",
"rospy.Publisher",
"rospy.is_shutdown",
"geometry_msgs.msg.Twist",
"rospy.init_node",
"rospy.get_param",
"rospy.ServiceProxy",
"rospy.Service",
"time.sleep",
"geometry_msgs.msg.Point",
"rospy.Rate",
"final_assignment.srv.MoveBaseResultResponse",
"m... | [((1295, 1302), 'geometry_msgs.msg.Point', 'Point', ([], {}), '()\n', (1300, 1302), False, 'from geometry_msgs.msg import Point, Pose\n'), ((1323, 1330), 'geometry_msgs.msg.Point', 'Point', ([], {}), '()\n', (1328, 1330), False, 'from geometry_msgs.msg import Point, Pose\n'), ((2147, 2196), 'tf.transformations.euler_fr... |
# Copyright 2014-present PUNCH Cyber Analytics Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | [
"os.path.exists",
"stoq.exceptions.StoqPluginException",
"watchgod.awatch",
"os.path.dirname",
"os.path.basename",
"os.path.abspath"
] | [((1441, 1473), 'os.path.abspath', 'os.path.abspath', (['self.source_dir'], {}), '(self.source_dir)\n', (1456, 1473), False, 'import os\n'), ((1725, 1748), 'watchgod.awatch', 'awatch', (['self.source_dir'], {}), '(self.source_dir)\n', (1731, 1748), False, 'from watchgod import awatch\n'), ((1294, 1389), 'stoq.exception... |
import tensorflow as tf
from tensorflow.keras.layers import *
assert tf.__version__>="2.0.0", f"Expect TF>=2.0.0 but get {tf.__version__}"
class PositionalSinEmbedding(tf.keras.layers.Layer):
"""
Positional Sinusoidal Embedding layer as described in "Attention is All You Need".
|
| Parameters:
| | input_dim: pa... | [
"tensorflow.math.pow",
"tensorflow.shape",
"tensorflow.transpose",
"tensorflow.math.cos",
"tensorflow.math.sqrt",
"tensorflow.math.sin",
"tensorflow.range",
"tensorflow.matmul",
"tensorflow.nn.softmax",
"tensorflow.reshape",
"tensorflow.cast"
] | [((1359, 1386), 'tensorflow.cast', 'tf.cast', (['n_step', 'tf.float32'], {}), '(n_step, tf.float32)\n', (1366, 1386), True, 'import tensorflow as tf\n'), ((1399, 1427), 'tensorflow.cast', 'tf.cast', (['n_embed', 'tf.float32'], {}), '(n_embed, tf.float32)\n', (1406, 1427), True, 'import tensorflow as tf\n'), ((4243, 429... |
import sys
sys.path.insert(1, '../')
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
import random
from random import randint
from functions import config, wait
class Bot:
def __init__(self):
self.cred... | [
"sys.path.insert",
"random.choice",
"random.randint",
"selenium.webdriver.Chrome",
"selenium.webdriver.common.action_chains.ActionChains",
"functions.wait",
"functions.config"
] | [((11, 36), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""../"""'], {}), "(1, '../')\n", (26, 36), False, 'import sys\n'), ((350, 358), 'functions.config', 'config', ([], {}), '()\n', (356, 358), False, 'from functions import config, wait\n'), ((388, 451), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'ex... |
# Generated by Django 3.1.2 on 2021-01-27 18:43
from django.db import migrations
class Migration(migrations.Migration):
def add_file_data_providers(apps, schema_editor):
DataProviderType = apps.get_model("jobs", "DataProviderType")
ExportFormat = apps.get_model("jobs", "ExportFormat")
# ... | [
"django.db.migrations.RunPython"
] | [((1485, 1530), 'django.db.migrations.RunPython', 'migrations.RunPython', (['add_file_data_providers'], {}), '(add_file_data_providers)\n', (1505, 1530), False, 'from django.db import migrations\n')] |
# -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License"... | [
"os.path.dirname",
"setuptools.find_packages"
] | [((1862, 1877), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1875, 1877), False, 'from setuptools import setup, find_packages\n'), ((1344, 1369), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1359, 1369), False, 'import os\n')] |
#!/usr/bin/python
import sys
import csv
def mapper():
reader = csv.reader(sys.stdin, delimiter='\t')
writer = csv.writer(sys.stdout, delimiter='\t')
tagFrequency = {}
for line in reader:
nodeType = line[5]
if not nodeType == "question":
continue
tags... | [
"csv.writer",
"csv.reader"
] | [((68, 105), 'csv.reader', 'csv.reader', (['sys.stdin'], {'delimiter': '"""\t"""'}), "(sys.stdin, delimiter='\\t')\n", (78, 105), False, 'import csv\n'), ((119, 157), 'csv.writer', 'csv.writer', (['sys.stdout'], {'delimiter': '"""\t"""'}), "(sys.stdout, delimiter='\\t')\n", (129, 157), False, 'import csv\n')] |
# Copyright 2019, FBPIC contributors
# Authors: <NAME>, <NAME>
# License: 3-Clause-BSD-LBNL
"""
This file is part of the Fourier-Bessel Particle-In-Cell code (FB-PIC)
It defines the picmi Simulation interface
"""
import numpy as np
from scipy.constants import c, e, m_e
from .particle_charge_and_mass import particle_ch... | [
"picmistandard.PICMI_Simulation.add_laser",
"picmistandard.PICMI_Simulation.add_diagnostic",
"fbpic.openpmd_diag.FieldDiagnostic",
"fbpic.lpa_utils.bunch.add_particle_bunch_gaussian",
"fbpic.lpa_utils.laser.GaussianLaser",
"fbpic.lpa_utils.laser.add_laser_pulse",
"fbpic.openpmd_diag.ParticleDiagnostic",... | [((3469, 3526), 'picmistandard.PICMI_Simulation.add_laser', 'PICMI_Simulation.add_laser', (['self', 'laser', 'injection_method'], {}), '(self, laser, injection_method)\n', (3495, 3526), False, 'from picmistandard import PICMI_Simulation, PICMI_CylindricalGrid\n'), ((4589, 4700), 'fbpic.lpa_utils.laser.add_laser_pulse',... |
from .base import Algorithm
import random
from copy import deepcopy
from models import Tour
from typing import List, Tuple
n_population = 100
CXPB = 0.95
MUTPB = 0.1
class GeneticAlgorithm(Algorithm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.population: Lis... | [
"random.random",
"random.choices",
"random.shuffle",
"copy.deepcopy"
] | [((742, 770), 'copy.deepcopy', 'deepcopy', (['self.population[0]'], {}), '(self.population[0])\n', (750, 770), False, 'from copy import deepcopy\n'), ((803, 834), 'random.shuffle', 'random.shuffle', (['self.population'], {}), '(self.population)\n', (817, 834), False, 'import random\n'), ((1577, 1668), 'random.choices',... |
import random, pygame
import tkinter as tk
from tkinter import messagebox
pygame.init()
def text_format(message, textFont, textSize, textColor):
newFont=pygame.font.Font(textFont, textSize)
newText=newFont.render(message, 0, textColor)
return newText
font = "Retro.ttf"
class cube(object):
rows = 5... | [
"tkinter.messagebox.showinfo",
"pygame.init",
"pygame.quit",
"pygame.event.get",
"random.randrange",
"pygame.display.set_mode",
"pygame.time.delay",
"pygame.time.Clock",
"pygame.key.get_pressed",
"tkinter.Tk",
"pygame.draw.rect",
"pygame.display.set_caption",
"pygame.font.Font",
"pygame.di... | [((75, 88), 'pygame.init', 'pygame.init', ([], {}), '()\n', (86, 88), False, 'import random, pygame\n'), ((8384, 8397), 'pygame.quit', 'pygame.quit', ([], {}), '()\n', (8395, 8397), False, 'import random, pygame\n'), ((159, 195), 'pygame.font.Font', 'pygame.font.Font', (['textFont', 'textSize'], {}), '(textFont, textSi... |
###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: <EMAIL>
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary forms, with or wi... | [
"vistrails.gui.vistrails_palette.QVistrailsPaletteInterface.visibility_changed",
"vistrails.core.bundles.py_import",
"vistrails.core.interpreter.default.get_default_interpreter"
] | [((2766, 2823), 'vistrails.core.bundles.py_import', 'py_import', (['"""IPython.qt.console.rich_ipython_widget"""', 'deps'], {}), "('IPython.qt.console.rich_ipython_widget', deps)\n", (2775, 2823), False, 'from vistrails.core.bundles import py_import\n'), ((2935, 2974), 'vistrails.core.bundles.py_import', 'py_import', (... |
"""empty message
Revision ID: 4a7d74b38564
Revises: <PASSWORD>
Create Date: 2017-02-16 16:09:46.859183
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4a<PASSWORD>b<PASSWORD>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():... | [
"sqlalchemy.String",
"alembic.op.drop_column"
] | [((595, 627), 'alembic.op.drop_column', 'op.drop_column', (['"""token"""', '"""token"""'], {}), "('token', 'token')\n", (609, 627), False, 'from alembic import op\n'), ((433, 453), 'sqlalchemy.String', 'sa.String', ([], {'length': '(64)'}), '(length=64)\n', (442, 453), True, 'import sqlalchemy as sa\n')] |
#importing dependencies
import sqlite3
#creating a connection and also the database or connecting to the database if it exists already
conn = sqlite3.connect('student.db')
#Creating the cursor
c = conn.cursor()
#creating a table called students
c.execute("""CREATE TABLE students(
first_name text,
... | [
"sqlite3.connect"
] | [((147, 176), 'sqlite3.connect', 'sqlite3.connect', (['"""student.db"""'], {}), "('student.db')\n", (162, 176), False, 'import sqlite3\n')] |
from django.contrib import admin
from .models import Alumni
# Register your models here.
admin.site.register(Alumni)
| [
"django.contrib.admin.site.register"
] | [((89, 116), 'django.contrib.admin.site.register', 'admin.site.register', (['Alumni'], {}), '(Alumni)\n', (108, 116), False, 'from django.contrib import admin\n')] |
import random
from mesa.visualization.modules import CanvasGrid
from mesa.visualization.ModularVisualization import ModularServer
from .model import Walker, ShapeExample
def agent_draw(agent):
portrayal = None
if agent is None:
# Actually this if part is unnecessary, but still keeping it for
... | [
"random.seed",
"mesa.visualization.modules.CanvasGrid",
"mesa.visualization.ModularVisualization.ModularServer"
] | [((1101, 1186), 'mesa.visualization.modules.CanvasGrid', 'CanvasGrid', (['agent_draw', 'width', 'height', '(width * pixel_ratio)', '(height * pixel_ratio)'], {}), '(agent_draw, width, height, width * pixel_ratio, height * pixel_ratio\n )\n', (1111, 1186), False, 'from mesa.visualization.modules import CanvasGrid\n')... |
#!/usr/bin/env python
from redbot.message import headers
from redbot.syntax import rfc7231
from redbot.type import AddNoteMethodType
class date(headers.HttpHeader):
canonical_name = "Date"
description = """\
The `Date` header represents the time when the message was generated, regardless of caching that
happ... | [
"redbot.message.headers.parse_date"
] | [((727, 768), 'redbot.message.headers.parse_date', 'headers.parse_date', (['field_value', 'add_note'], {}), '(field_value, add_note)\n', (745, 768), False, 'from redbot.message import headers\n')] |
import abc
import itertools
from oslo_utils import reflection
import six
from padre import exceptions as excp
from padre import utils
@six.add_metaclass(abc.ABCMeta)
class auth_base(object):
"""Base of all authorizers."""
def __and__(self, other):
return all_must_pass(self, other)
def __or__(s... | [
"itertools.chain",
"padre.exceptions.NotFound",
"six.add_metaclass",
"padre.utils.dict_or_munch_extract",
"padre.exceptions.NotAuthorized",
"padre.utils.quote_join",
"oslo_utils.reflection.get_callable_name"
] | [((139, 169), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (156, 169), False, 'import six\n'), ((1867, 1924), 'oslo_utils.reflection.get_callable_name', 'reflection.get_callable_name', (['self.allowed_extractor_func'], {}), '(self.allowed_extractor_func)\n', (1895, 1924), False, '... |
from django.views.generic import CreateView
from django.contrib.auth import authenticate, login
from django.contrib.auth.views import LoginView
from django.contrib.auth.forms import UserCreationForm
from django.urls import reverse_lazy
class SignUpView(CreateView):
template_name = 'users/signup.html'
... | [
"django.contrib.auth.authenticate",
"django.contrib.auth.login",
"django.urls.reverse_lazy"
] | [((370, 396), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""photo:list"""'], {}), "('photo:list')\n", (382, 396), False, 'from django.urls import reverse_lazy\n'), ((491, 590), 'django.contrib.auth.authenticate', 'authenticate', ([], {'username': "form.cleaned_data['username']", 'password': "form.cleaned_data['<PAS... |
import re
from _cleaning_options.cleaning_options import _is_title_or_etc, _is_books_copy, \
_is_email_init, _is_footnote, _is_image, _is_table
from _cleaning_options.strip_headers import _strip_headers
def simple_cleaner(book: str) -> str:
"""
Just removes lines that are part of the Project Gutenberg hea... | [
"_cleaning_options.strip_headers._strip_headers",
"_cleaning_options.cleaning_options._is_table",
"_cleaning_options.cleaning_options._is_image",
"_cleaning_options.cleaning_options._is_title_or_etc",
"_cleaning_options.cleaning_options._is_email_init",
"_cleaning_options.cleaning_options._is_books_copy",... | [((607, 627), '_cleaning_options.strip_headers._strip_headers', '_strip_headers', (['book'], {}), '(book)\n', (621, 627), False, 'from _cleaning_options.strip_headers import _strip_headers\n'), ((1506, 1526), '_cleaning_options.strip_headers._strip_headers', '_strip_headers', (['book'], {}), '(book)\n', (1520, 1526), F... |
"""REST API for accessing log files."""
from django.core.exceptions import ObjectDoesNotExist
from django.utils.decorators import method_decorator
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from rest_framework import generics, status
from rest_framework.decorators import (
api_view... | [
"rest_framework.decorators.permission_classes",
"drf_yasg.openapi.Response",
"crashreports.models.Crashreport.objects.get",
"crashreports.permissions.user_is_hiccup_staff",
"crashreports.response_descriptions.default_desc",
"drf_yasg.utils.swagger_auto_schema",
"crashreports.models.LogFile",
"rest_fra... | [((3122, 3158), 'rest_framework.decorators.api_view', 'api_view', ([], {'http_method_names': "['POST']"}), "(http_method_names=['POST'])\n", (3130, 3158), False, 'from rest_framework.decorators import api_view, parser_classes, permission_classes\n'), ((3160, 3194), 'rest_framework.decorators.parser_classes', 'parser_cl... |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 <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:
#
# * Redistributions of source code must retain the above copyright notice, this
# list ... | [
"primaires.interpreteur.commande.commande.Commande.__init__",
"secondaires.systeme.contextes.systeme.Systeme"
] | [((1881, 1925), 'primaires.interpreteur.commande.commande.Commande.__init__', 'Commande.__init__', (['self', '"""systeme"""', '"""system"""'], {}), "(self, 'systeme', 'system')\n", (1898, 1925), False, 'from primaires.interpreteur.commande.commande import Commande\n'), ((3218, 3256), 'secondaires.systeme.contextes.syst... |
import math
import numpy as np
import os
import pickle
from pymatgen.core.surface import SlabGenerator, get_symmetrically_distinct_miller_indices
from pymatgen.io.ase import AseAtomsAdaptor
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from .constants import MAX_MILLER, COVALENT_MATERIALS_MPIDS
class Bu... | [
"pymatgen.io.ase.AseAtomsAdaptor.get_atoms",
"numpy.cross",
"numpy.random.choice",
"pickle.load",
"pymatgen.core.surface.SlabGenerator",
"pymatgen.core.surface.get_symmetrically_distinct_miller_indices",
"pymatgen.symmetry.analyzer.SpacegroupAnalyzer",
"pymatgen.io.ase.AseAtomsAdaptor.get_structure"
] | [((5132, 5177), 'numpy.random.choice', 'np.random.choice', (['possible_n_elems'], {'p': 'weights'}), '(possible_n_elems, p=weights)\n', (5148, 5177), True, 'import numpy as np\n'), ((7442, 7508), 'pymatgen.core.surface.get_symmetrically_distinct_miller_indices', 'get_symmetrically_distinct_miller_indices', (['bulk_stru... |
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from core.models import Person, OfficeLocation, OrgGroup
import random
class Command(BaseCommand):
args = '<number_of_users>'
help = 'Creates random users for local testing'
def handle(self, *args, **option... | [
"django.contrib.auth.get_user_model",
"core.models.OfficeLocation.objects.get",
"core.models.Person",
"random.random",
"core.models.OrgGroup.objects.order_by"
] | [((3422, 3460), 'core.models.OfficeLocation.objects.get', 'OfficeLocation.objects.get', ([], {'pk': '"""DC123"""'}), "(pk='DC123')\n", (3448, 3460), False, 'from core.models import Person, OfficeLocation, OrgGroup\n'), ((4356, 4383), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '(**user_attr)\n', (... |