code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.db import models
# Create your models here.
class Categories(models.Model):
catagorie=models.CharField(max_length=100)
class SubCatagories(models.Model):
#question = models.ForeignKey(Question, on_delete=models.CASCADE)
subCatagories=models.CharField(max_length=100)
class Products(models.Model)... | [
"django.db.models.CharField"
] | [((103, 135), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (119, 135), False, 'from django.db import models\n'), ((259, 291), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (275, 291), False, 'from django.d... |
from sys import stdin
n, x = map(int, stdin.readline().split())
li = [int(c) for c in stdin.readline().split()]
li.sort()
res = 0
i = 0
j = n - 1
while i <= j:
if li[i] + li[j] > x:
j -= 1
else:
i += 1
j -= 1
res += 1
print(res)
| [
"sys.stdin.readline"
] | [((41, 57), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (55, 57), False, 'from sys import stdin\n'), ((90, 106), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (104, 106), False, 'from sys import stdin\n')] |
#!/usr/bin/env python
"""
A/B timeit test: dict of dicts init.
Output:
exists = False:
speedup seconds option
15% 0.780859 in else
11% 0.821429 defaultdict
10% 0.825422 not in
3% 0.890609 get
0% 0.918161 setdefault
-83% 1.683932 try
exists = True:
speedup seconds option
... | [
"gc.disable",
"time.time"
] | [((3070, 3082), 'gc.disable', 'gc.disable', ([], {}), '()\n', (3080, 3082), False, 'import gc\n'), ((3712, 3723), 'time.time', 'time.time', ([], {}), '()\n', (3721, 3723), False, 'import time\n'), ((3781, 3792), 'time.time', 'time.time', ([], {}), '()\n', (3790, 3792), False, 'import time\n')] |
import fastai
from fastai.vision import *
from fastai.callbacks import *
from fastai.utils.mem import *
from torchvision.models import vgg16_bn
from skimage.measure import compare_ssim
def gram_matrix(x):
n,c,h,w = x.size()
x = x.view(n, c, -1)
return (x @ x.transpose(1,2))/(c*h*w)
class VGG16FeatureLos... | [
"torchvision.models.vgg16_bn"
] | [((520, 534), 'torchvision.models.vgg16_bn', 'vgg16_bn', (['(True)'], {}), '(True)\n', (528, 534), False, 'from torchvision.models import vgg16_bn\n')] |
#!/usr/bin/env python
#
# Um simples jogo de adivinhação com dicas.
#
# <NAME>
# @VinihJunior
# <EMAIL>
from random import randint
while True:
print("************************************************")
print("* *")
print("* Adivinhe qual é o ANIMAL \o/ ... | [
"random.randint"
] | [((790, 809), 'random.randint', 'randint', (['(0)', '(end - 1)'], {}), '(0, end - 1)\n', (797, 809), False, 'from random import randint\n')] |
# importing necessary packages
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, confusion_matrix
from sklearn.externals import joblib
from sklearn.preprocessing import StandardScaler
import os
imp... | [
"os.makedirs",
"argparse.ArgumentParser",
"os.path.exists",
"sklearn.externals.joblib.load",
"numpy.delete",
"numpy.unique"
] | [((368, 393), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (391, 393), False, 'import argparse\n'), ((1522, 1546), 'sklearn.externals.joblib.load', 'joblib.load', (['file_scalar'], {}), '(file_scalar)\n', (1533, 1546), False, 'from sklearn.externals import joblib\n'), ((1552, 1577), 'sklearn.... |
# -*- coding: utf-8 -*-
import pytest
import ckan.model as model
import ckan.lib.search as search
import ckan.tests.factories as factories
from ckan.lib.create_test_data import CreateTestData
@pytest.mark.usefixtures("clean_db", "clean_index")
class TestTagQuery(object):
def create_test_data(self):
facto... | [
"ckan.model.Session.query",
"ckan.lib.search.query_for",
"ckan.lib.search.QueryOptions",
"ckan.lib.create_test_data.CreateTestData.create",
"ckan.model.Package.by_name",
"ckan.model.Resource.get_columns",
"pytest.raises",
"ckan.tests.factories.Dataset",
"pytest.mark.usefixtures",
"ckan.tests.facto... | [((196, 246), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""clean_db"""', '"""clean_index"""'], {}), "('clean_db', 'clean_index')\n", (219, 246), False, 'import pytest\n'), ((4169, 4243), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""clean_db"""', '"""clean_index"""', '"""resources_for_searc... |
# -*- coding: utf-8 -*-
from fire.api.model.punkttyper import GeometriObjekt, PunktInformation
__author__ = "Septima"
__date__ = "2019-12-02"
__copyright__ = "(C) 2019 by Septima"
import os
from datetime import datetime
from typing import List, Dict
from PyQt5.QtCore import QCoreApplication
from PyQt5.QtGui import ... | [
"qgis.core.QgsPoint",
"fire.api.model.punkttyper.GeometriObjekt.punktid.in_",
"PyQt5.QtGui.QIcon",
"qgis.core.QgsGeometry.fromPolyline",
"datetime.datetime.fromisoformat",
"fire.api.model.punkttyper.PunktInformation.punktid.in_",
"processing.run",
"os.path.dirname",
"qgis.core.QgsProcessingAlgorithm... | [((1342, 1379), 'qgis.core.QgsProcessingAlgorithm.__init__', 'QgsProcessingAlgorithm.__init__', (['self'], {}), '(self)\n', (1373, 1379), False, 'from qgis.core import QgsProcessing, QgsFeatureSink, QgsProcessingAlgorithm, QgsProcessingParameterFeatureSource, QgsProcessingParameterFeatureSink, QgsProcessingParameterStr... |
import scipy as sp
import scipy.optimize
from . import legops
import tensorflow as tf
import numpy as np
import numpy.random as npr
from . import constructions
def fit_model_family(ts,xs,model_family,p_init,maxiter=100,use_tqdm_notebook=False):
'''
Fits a custom LEG model
Input:
- ts: list of timesta... | [
"numpy.sum",
"numpy.random.randn",
"tensorflow.gather_nd",
"tensorflow.convert_to_tensor",
"tensorflow.reshape",
"tensorflow.concat",
"numpy.ones",
"tensorflow.transpose",
"numpy.where",
"tensorflow.GradientTape",
"numpy.tile",
"tensorflow.function",
"numpy.eye",
"tensorflow.scatter_nd",
... | [((5309, 5337), 'tensorflow.function', 'tf.function', ([], {'autograph': '(False)'}), '(autograph=False)\n', (5320, 5337), True, 'import tensorflow as tf\n'), ((5665, 5693), 'tensorflow.function', 'tf.function', ([], {'autograph': '(False)'}), '(autograph=False)\n', (5676, 5693), True, 'import tensorflow as tf\n'), ((1... |
from django.urls import path
from . import views
app_name = 'zeus'
urlpatterns = [
path('token', views.token, name='token'),
]
| [
"django.urls.path"
] | [((88, 128), 'django.urls.path', 'path', (['"""token"""', 'views.token'], {'name': '"""token"""'}), "('token', views.token, name='token')\n", (92, 128), False, 'from django.urls import path\n')] |
"""Module defines NorimDb class"""
from os import path, SEEK_END
from .exceptions import *
import pybinn
from .docid import DocId
class NorimDb:
"""NorimDb class"""
def __init__(self, dir_path):
if not path.isdir(dir_path):
raise DbError(ERR_PATH, path=dir_path)
self._sys = {
... | [
"pybinn.dump",
"os.path.isdir",
"os.path.isfile",
"pybinn.dumps",
"pybinn.load",
"os.path.join"
] | [((1123, 1161), 'pybinn.dump', 'pybinn.dump', (['self._sys', 'self._sys_file'], {}), '(self._sys, self._sys_file)\n', (1134, 1161), False, 'import pybinn\n'), ((1282, 1304), 'os.path.isfile', 'path.isfile', (['file_path'], {}), '(file_path)\n', (1293, 1304), False, 'from os import path, SEEK_END\n'), ((2385, 2429), 'py... |
import io
import pulsar
import fastavro
class DictAVRO(dict):
"""``DictAVRO`` provides dictionary class compatible with the Pulsar AVRO "record" interface.
The class is based on regular Python dictionary (``dict``).
The actual "record" classes should be based on the ``DictAVRO`` and either:
- set `... | [
"io.BytesIO",
"pulsar.Client",
"json.loads",
"pprint.pp",
"time.sleep",
"datetime.datetime.utcnow",
"fastavro.schemaless_writer",
"fastavro.schema.load_schema"
] | [((4829, 4853), 'time.sleep', 'time.sleep', (['WAIT_SECONDS'], {}), '(WAIT_SECONDS)\n', (4839, 4853), False, 'import time\n'), ((2375, 2387), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (2385, 2387), False, 'import io\n'), ((2396, 2449), 'fastavro.schemaless_writer', 'fastavro.schemaless_writer', (['buffer', 'self._s... |
# -*- coding: utf-8 -*-
"""Map views"""
import json
from django.conf import settings
from django.views.generic import DetailView
from mspray.apps.main.mixins import SiteNameMixin
from mspray.apps.main.models import Location
from mspray.apps.main.query import get_location_qs
from mspray.apps.main.serializers.target_ar... | [
"mspray.apps.main.utils.get_location_dict",
"mspray.apps.main.serializers.target_area.get_duplicates",
"json.dumps",
"mspray.apps.main.models.Location.objects.filter",
"mspray.apps.main.views.target_area.TargetAreaHouseholdsViewSet.as_view",
"mspray.apps.main.views.target_area.TargetAreaViewSet.as_view",
... | [((1520, 1550), 'mspray.apps.main.utils.parse_spray_date', 'parse_spray_date', (['self.request'], {}), '(self.request)\n', (1536, 1550), False, 'from mspray.apps.main.utils import get_location_dict, parse_spray_date\n'), ((4108, 4158), 'json.dumps', 'json.dumps', (['settings.MSPRAY_UNSPRAYED_REASON_OTHER'], {}), '(sett... |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... | [
"vega.core.common.class_factory.ClassFactory.register",
"copy.deepcopy",
"numpy.asarray"
] | [((646, 684), 'vega.core.common.class_factory.ClassFactory.register', 'ClassFactory.register', (['ClassType.CODEC'], {}), '(ClassType.CODEC)\n', (667, 684), False, 'from vega.core.common.class_factory import ClassType, ClassFactory\n'), ((3053, 3080), 'copy.deepcopy', 'deepcopy', (['self.search_space'], {}), '(self.sea... |
# Testing CSSCrypt
import CSSCrypt
shiftKey = '3453465'
CSSCrypt = CSSCrypt.encryption()
encMsg = CSSCrypt.encrypt('My Secret Message', shiftKey)
print (encMsg)
print(CSSCrypt.decrypt(encMsg, shiftKey))
| [
"CSSCrypt.encryption",
"CSSCrypt.decrypt",
"CSSCrypt.encrypt"
] | [((68, 89), 'CSSCrypt.encryption', 'CSSCrypt.encryption', ([], {}), '()\n', (87, 89), False, 'import CSSCrypt\n'), ((99, 146), 'CSSCrypt.encrypt', 'CSSCrypt.encrypt', (['"""My Secret Message"""', 'shiftKey'], {}), "('My Secret Message', shiftKey)\n", (115, 146), False, 'import CSSCrypt\n'), ((168, 202), 'CSSCrypt.decry... |
from __future__ import annotations
import enum
from typing import Union, TYPE_CHECKING
from ravendb.http.request_executor import ClusterRequestExecutor
from ravendb.http.topology import Topology
from ravendb.serverwide.operations.common import (
GetBuildNumberOperation,
ServerOperation,
VoidServerOperatio... | [
"ravendb.http.request_executor.ClusterRequestExecutor.create_without_database_name",
"ravendb.tools.utils.CaseInsensitiveDict",
"ravendb.http.request_executor.ClusterRequestExecutor.create_for_single_node",
"ravendb.serverwide.operations.common.GetBuildNumberOperation",
"ravendb.serverwide.operations.common... | [((1160, 1181), 'ravendb.tools.utils.CaseInsensitiveDict', 'CaseInsensitiveDict', ([], {}), '()\n', (1179, 1181), False, 'from ravendb.tools.utils import CaseInsensitiveDict\n'), ((2042, 2256), 'ravendb.serverwide.operations.common.ServerWideOperation', 'ServerWideOperation', (['self.__request_executor', 'self.__reques... |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Wed Sep 4 08:34:31 2013
# by: The Resource Compiler for PyQt (Qt v5.1.1)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x00\xf9\
\x69\
\x6d\x70\x6f\x72\x74\x20\x51\x74\x51\x75\x69\x63\x... | [
"PyQt5.QtCore.qUnregisterResourceData",
"PyQt5.QtCore.qRegisterResourceData"
] | [((1597, 1688), 'PyQt5.QtCore.qRegisterResourceData', 'QtCore.qRegisterResourceData', (['(1)', 'qt_resource_struct', 'qt_resource_name', 'qt_resource_data'], {}), '(1, qt_resource_struct, qt_resource_name,\n qt_resource_data)\n', (1625, 1688), False, 'from PyQt5 import QtCore\n'), ((1718, 1811), 'PyQt5.QtCore.qUnreg... |
from collections import defaultdict
import networkx as nx
class Node:
"""Class representing a node in the KB.
"""
def __init__(self, kb, name, data, watches=[]):
super().__setattr__('_kb', kb)
super().__setattr__('_name', name)
nx.set_node_attributes(self._kb.G, {self._name: data})... | [
"collections.defaultdict",
"networkx.set_node_attributes"
] | [((266, 320), 'networkx.set_node_attributes', 'nx.set_node_attributes', (['self._kb.G', '{self._name: data}'], {}), '(self._kb.G, {self._name: data})\n', (288, 320), True, 'import networkx as nx\n'), ((345, 362), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (356, 362), False, 'from collections ... |
import ctypes, ctypes.util
import sys, os, threading, time
sys.path.append(os.pardir)
import sdl2
#from sdl2 import *
def timer_callback_fn(interval, param):
print("HI")
return interval
def timer_test():
resolution = 60
cb = sdl2.SDL_TimerCallback(timer_callback_fn)
print(type(cb))
t1 = sdl2.... | [
"sys.path.append",
"threading.Thread",
"sdl2.SDL_Init",
"time.sleep",
"sdl2.SDL_RemoveTimer",
"sdl2.SDL_AddTimer",
"sdl2.SDL_TimerCallback",
"sdl2.SDL_Quit",
"ctypes.util.find_library"
] | [((59, 85), 'sys.path.append', 'sys.path.append', (['os.pardir'], {}), '(os.pardir)\n', (74, 85), False, 'import sys, os, threading, time\n'), ((244, 285), 'sdl2.SDL_TimerCallback', 'sdl2.SDL_TimerCallback', (['timer_callback_fn'], {}), '(timer_callback_fn)\n', (266, 285), False, 'import sdl2\n'), ((315, 354), 'sdl2.SD... |
#Create a script that uses countries_by_area.txt file as data sourcea and prints out the top 5 most densely populated countries
import pandas
data = pandas.read_csv("countries_by_area.txt")
data["density"] = data["population_2013"] / data["area_sqkm"]
data = data.sort_values(by="density", ascending=False)
fo... | [
"pandas.read_csv"
] | [((155, 195), 'pandas.read_csv', 'pandas.read_csv', (['"""countries_by_area.txt"""'], {}), "('countries_by_area.txt')\n", (170, 195), False, 'import pandas\n')] |
import eisoil.core.pluginmanager as pm
from crpc.configrpc import ConfigRPC
def setup():
# setup config keys
xmlrpc = pm.getService('xmlrpc')
xmlrpc.registerXMLRPC('configrpc', ConfigRPC(), '/amconfig') # handlerObj, endpoint | [
"crpc.configrpc.ConfigRPC",
"eisoil.core.pluginmanager.getService"
] | [((128, 151), 'eisoil.core.pluginmanager.getService', 'pm.getService', (['"""xmlrpc"""'], {}), "('xmlrpc')\n", (141, 151), True, 'import eisoil.core.pluginmanager as pm\n'), ((191, 202), 'crpc.configrpc.ConfigRPC', 'ConfigRPC', ([], {}), '()\n', (200, 202), False, 'from crpc.configrpc import ConfigRPC\n')] |
#!/usr/bin/env python3
import re
import time
import sys
import requests
from bs4 import BeautifulSoup
def name_and_class(tag_name, class_name):
return lambda e: e.name == tag_name and e.has_attr('class') and class_name in e['class']
def find_search_result_pages(url):
'Return a list of URLs of the pages of s... | [
"bs4.BeautifulSoup",
"re.match",
"requests.get",
"time.sleep"
] | [((343, 360), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (355, 360), False, 'import requests\n'), ((489, 525), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.text', '"""html.parser"""'], {}), "(r.text, 'html.parser')\n", (502, 525), False, 'from bs4 import BeautifulSoup\n'), ((3301, 3337), 'bs4.BeautifulSoup... |
# Create your views here.
from rest_framework import viewsets
from biolabs.core import models as core_models
from biolabs.core.serializers import LaboratorySerializer
class LaboratoryViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows labs to be viewed or edited.
"""
queryset = core_models.... | [
"biolabs.core.models.Laboratory.objects.filter"
] | [((308, 364), 'biolabs.core.models.Laboratory.objects.filter', 'core_models.Laboratory.objects.filter', ([], {'is_moderated': '(True)'}), '(is_moderated=True)\n', (345, 364), True, 'from biolabs.core import models as core_models\n')] |
from pvector import PVector
WIDTH = 400
HEIGHT = 400
class Ball():
def __init__(self, x, y, v_x, v_y, radius, color):
self.position = PVector(x, y)
self.radius = radius
self.color = color
self. velocity = PVector(v_x, v_y)
def show(self, screen):
screen.draw.f... | [
"pvector.PVector"
] | [((153, 166), 'pvector.PVector', 'PVector', (['x', 'y'], {}), '(x, y)\n', (160, 166), False, 'from pvector import PVector\n'), ((248, 265), 'pvector.PVector', 'PVector', (['v_x', 'v_y'], {}), '(v_x, v_y)\n', (255, 265), False, 'from pvector import PVector\n')] |
from django.template import Library
from django.utils.encoding import force_text
register = Library()
def force_text_filter(obj):
return force_text(obj)
register.filter('force_text', force_text_filter)
| [
"django.template.Library",
"django.utils.encoding.force_text"
] | [((93, 102), 'django.template.Library', 'Library', ([], {}), '()\n', (100, 102), False, 'from django.template import Library\n'), ((144, 159), 'django.utils.encoding.force_text', 'force_text', (['obj'], {}), '(obj)\n', (154, 159), False, 'from django.utils.encoding import force_text\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-08-23 20:08
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('issue_order', '0014_auto_20180819_2108'),
]
operat... | [
"django.db.migrations.RemoveField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField"
] | [((882, 946), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""courierorder"""', 'name': '"""system"""'}), "(model_name='courierorder', name='system')\n", (904, 946), False, 'from django.db import migrations, models\n'), ((1095, 1196), 'django.db.models.ForeignKey', 'models.ForeignK... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.db import models, migrations
logging.basicConfig(format="%(asctime)-15s %(message)s")
logger = logging.getLogger(__file__)
logger.setLevel(logging.INFO)
BULK_SIZE = 2500
def move_metadata(apps, schema_editor):
IEDocumen... | [
"django.db.migrations.RunPython",
"logging.getLogger",
"logging.basicConfig"
] | [((123, 180), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)-15s %(message)s"""'}), "(format='%(asctime)-15s %(message)s')\n", (142, 180), False, 'import logging\n'), ((190, 217), 'logging.getLogger', 'logging.getLogger', (['__file__'], {}), '(__file__)\n', (207, 217), False, 'import log... |
import pytest
from rest_framework.test import APIClient
from tests.factories import accounts
@pytest.fixture
def api_client():
api = APIClient()
return api
@pytest.fixture
def superuser():
return accounts.superuser()
| [
"rest_framework.test.APIClient",
"tests.factories.accounts.superuser"
] | [((140, 151), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (149, 151), False, 'from rest_framework.test import APIClient\n'), ((213, 233), 'tests.factories.accounts.superuser', 'accounts.superuser', ([], {}), '()\n', (231, 233), False, 'from tests.factories import accounts\n')] |
"""
Errors in cosmic shear measurement can lead to a multiplicative factor
scaling the observed shear spectra.
This module scales the measured C_ell to account for that difference,
assuming model values of the multplicative factor m, either per bin or for all bins.
"""
from __future__ import print_function
from buil... | [
"sys.stderr.write",
"builtins.range"
] | [((1690, 1700), 'builtins.range', 'range', (['n_a'], {}), '(n_a)\n', (1695, 1700), False, 'from builtins import range\n'), ((1719, 1729), 'builtins.range', 'range', (['n_b'], {}), '(n_b)\n', (1724, 1729), False, 'from builtins import range\n'), ((3673, 3887), 'sys.stderr.write', 'sys.stderr.write', (['"""The module the... |
import torch
import torch.nn as nn
import torchvision.datasets as dsets
import torchvision.transforms as transforms
from torch.autograd import Variable
from SNN import SNN
import time
import os
from tensorboardX import SummaryWriter
from nettalk import Nettalk
from gesture import Gesture
import argparse
parser = argpa... | [
"torch.nn.MSELoss",
"tensorboardX.SummaryWriter",
"torch.optim.lr_scheduler.StepLR",
"argparse.ArgumentParser",
"SNN.SNN",
"torch.utils.data.DataLoader",
"torch.manual_seed",
"torch.zeros",
"time.time",
"torchvision.transforms.ToTensor",
"torch.cuda.manual_seed_all",
"torch.nn.CosineSimilarity... | [((315, 362), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""train.py"""'}), "(description='train.py')\n", (338, 362), False, 'import argparse\n'), ((1119, 1149), 'torch.cuda.set_device', 'torch.cuda.set_device', (['opt.gpu'], {}), '(opt.gpu)\n', (1140, 1149), False, 'import torch\n'), (... |
import csv
import subprocess
from itertools import product
import textacy
from sklearn.metrics import accuracy_score
from sklearn.metrics import f1_score
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from textacy.text_utils import detect_language
from src.utils im... | [
"csv.reader",
"csv.writer",
"sklearn.model_selection.train_test_split",
"subprocess.check_output",
"sklearn.metrics.accuracy_score",
"src.utils.preprocess",
"textacy.Doc",
"sklearn.preprocessing.LabelEncoder",
"sklearn.metrics.f1_score",
"itertools.product",
"textacy.text_utils.detect_language"
... | [((911, 925), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (923, 925), False, 'from sklearn.preprocessing import LabelEncoder\n'), ((1032, 1147), 'sklearn.model_selection.train_test_split', 'train_test_split', (['texts', 'encoded_labels'], {'shuffle': '(True)', 'stratify': 'encoded_labels', '... |
from __future__ import absolute_import, division, print_function
import torch
import warnings
from tqdm import tqdm
import pathlib
from scipy import linalg
import tensorflow as tf
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
def check_or_download_inception(inception_path):
''' Checks if t... | [
"numpy.trace",
"numpy.load",
"numpy.abs",
"argparse.ArgumentParser",
"numpy.empty",
"pathlib.Path",
"numpy.mean",
"torchvision.transforms.Normalize",
"os.path.join",
"numpy.atleast_2d",
"numpy.eye",
"os.path.exists",
"tensorflow.TensorShape",
"numpy.isfinite",
"torchvision.transforms.ToT... | [((600, 628), 'pathlib.Path', 'pathlib.Path', (['inception_path'], {}), '(inception_path)\n', (612, 628), False, 'import pathlib\n'), ((2414, 2434), 'numpy.mean', 'np.mean', (['act'], {'axis': '(0)'}), '(act, axis=0)\n', (2421, 2434), True, 'import numpy as np\n'), ((2447, 2472), 'numpy.cov', 'np.cov', (['act'], {'rowv... |
import ast
import json
import pickle
import ujson
import collections
import numpy as np
from chord_labels import parse_chord
from progressbar import ProgressBar, Bar, Percentage, AdaptiveETA, Counter
print("Opening files")
with open('dataset_chords.json', 'r') as values:
formatted_chords = ujson.load(values)
wit... | [
"ast.literal_eval",
"progressbar.Counter",
"ujson.dump",
"ujson.load",
"progressbar.Bar",
"progressbar.Percentage",
"progressbar.AdaptiveETA",
"pickle.load",
"numpy.array",
"collections.OrderedDict"
] | [((576, 601), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (599, 601), False, 'import collections\n'), ((4438, 4454), 'numpy.array', 'np.array', (['hold_x'], {}), '(hold_x)\n', (4446, 4454), True, 'import numpy as np\n'), ((4467, 4483), 'numpy.array', 'np.array', (['hold_y'], {}), '(hold_y)\n... |
#!/usr/bin/env python3
import math
def calc_sqr_distance(a, b):
vx = a[0] - b[0]
vy = a[1] - b[1]
return vx * vx + vy * vy
def find_nearest_distance(uv, max_size, random_points):
xf, xi = math.modf(uv[0])
yf, yi = math.modf(uv[1])
min_sqr_distance = float("inf")
for y_offset in [-1... | [
"argparse.ArgumentParser",
"math.sqrt",
"math.modf",
"random.seed",
"uv.gen_uv"
] | [((208, 224), 'math.modf', 'math.modf', (['uv[0]'], {}), '(uv[0])\n', (217, 224), False, 'import math\n'), ((238, 254), 'math.modf', 'math.modf', (['uv[1]'], {}), '(uv[1])\n', (247, 254), False, 'import math\n'), ((838, 865), 'math.sqrt', 'math.sqrt', (['min_sqr_distance'], {}), '(min_sqr_distance)\n', (847, 865), Fals... |
"""
automatic_questioner
--------------------
Module which serves as a interactor between the possible database with the
described structure and which contains information about functions and
variables of other packages.
Scheme of the db
----------------
# {'function_name':
# {'variables':
# {'variabl... | [
"tui_questioner.general_questioner"
] | [((7770, 7800), 'tui_questioner.general_questioner', 'general_questioner', ([], {}), '(**question)\n', (7788, 7800), False, 'from tui_questioner import general_questioner\n'), ((17678, 17708), 'tui_questioner.general_questioner', 'general_questioner', ([], {}), '(**question)\n', (17696, 17708), False, 'from tui_questio... |
from __future__ import unicode_literals
import logging
import os
from mopidy import config, ext
from .pinconfig import PinConfig
__version__ = "0.0.2"
logger = logging.getLogger(__name__)
class Extension(ext.Extension):
dist_name = "Mopidy-Raspberry-GPIO"
ext_name = "raspberry-gpio"
version = __ver... | [
"os.path.dirname",
"mopidy.config.read",
"logging.getLogger"
] | [((166, 193), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (183, 193), False, 'import logging\n'), ((449, 471), 'mopidy.config.read', 'config.read', (['conf_file'], {}), '(conf_file)\n', (460, 471), False, 'from mopidy import config, ext\n'), ((395, 420), 'os.path.dirname', 'os.path.dir... |
from django.db import models
from schedule.models import Event, EventRelation, Calendar
from vms.locations.models import Location
# Create your models here.
class CSPCEvent(Event):
event_location = models.ForeignKey(Location, default=1)
| [
"django.db.models.ForeignKey"
] | [((203, 241), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Location'], {'default': '(1)'}), '(Location, default=1)\n', (220, 241), False, 'from django.db import models\n')] |
# -*- coding: utf-8 -*-
"""WSGI app setup."""
import os
import sys
# Add lib as primary libraries directory, with fallback to lib/dist
# and optionally to lib/dist.zip, loaded using zipimport.
lib_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'lib')
if lib_path not in sys.path:
sys.path[0:0] = [
... | [
"tipfy.app.App",
"os.path.dirname",
"os.environ.get",
"google.appengine.ext.appstats.recording.appstats_wsgi_middleware",
"os.path.join"
] | [((1133, 1177), 'tipfy.app.App', 'App', ([], {'rules': 'rules', 'config': 'config', 'debug': 'debug'}), '(rules=rules, config=config, debug=debug)\n', (1136, 1177), False, 'from tipfy.app import App\n'), ((681, 719), 'google.appengine.ext.appstats.recording.appstats_wsgi_middleware', 'appstats_wsgi_middleware', (['app.... |
# -*- coding: utf-8 -*-
from layers.dynamic_rnn import DynamicLSTM
from layers.shap import Distribution_SHAP, Map_SHAP
import torch
import torch.nn as nn
import numpy as np
class SHAP_LSTM(nn.Module):
def __init__(self, embedding_matrix, opt):
super(SHAP_LSTM, self).__init__()
self.opt = opt
... | [
"layers.shap.Distribution_SHAP",
"torch.sum",
"layers.dynamic_rnn.DynamicLSTM",
"numpy.where",
"torch.nn.Linear",
"layers.shap.Map_SHAP",
"torch.tensor"
] | [((489, 563), 'layers.dynamic_rnn.DynamicLSTM', 'DynamicLSTM', (['opt.embed_dim', 'opt.hidden_dim'], {'num_layers': '(1)', 'batch_first': '(True)'}), '(opt.embed_dim, opt.hidden_dim, num_layers=1, batch_first=True)\n', (500, 563), False, 'from layers.dynamic_rnn import DynamicLSTM\n'), ((584, 653), 'layers.shap.Distrib... |
import cv2
import numpy as np
from scipy.ndimage.morphology import distance_transform_cdt
import torch
from skimage.io import imsave
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
def get_edge_mask(poly, mask):
"""
Generate edge mask
"""
h = mask.shape[0]
w = mask.shape[1]
... | [
"scipy.ndimage.morphology.distance_transform_cdt",
"numpy.sum",
"numpy.asarray",
"numpy.floor",
"numpy.zeros",
"numpy.clip",
"numpy.append",
"numpy.array",
"torch.cuda.is_available",
"numpy.int32",
"numpy.reshape",
"torch.zeros",
"numpy.concatenate"
] | [((333, 383), 'numpy.zeros', 'np.zeros', (['(poly.shape[0], poly.shape[1])', 'np.int32'], {}), '((poly.shape[0], poly.shape[1]), np.int32)\n', (341, 383), True, 'import numpy as np\n'), ((401, 425), 'numpy.floor', 'np.floor', (['(poly[:, 0] * w)'], {}), '(poly[:, 0] * w)\n', (409, 425), True, 'import numpy as np\n'), (... |
#!/usr/bin/env python3
# date: 2016.11.24 (update: 2020.06.13)
# https://stackoverflow.com/questions/40777864/retrieving-all-information-from-page-beautifulsoup/
from selenium import webdriver
from bs4 import BeautifulSoup
import time
# --- get page ---
link = 'http://oldnavy.gap.com/browse/category.do?cid=1035712&... | [
"bs4.BeautifulSoup",
"time.sleep",
"selenium.webdriver.Firefox"
] | [((385, 404), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], {}), '()\n', (402, 404), False, 'from selenium import webdriver\n'), ((422, 435), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (432, 435), False, 'import time\n'), ((1794, 1825), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html5lib"""'... |
from schema_reg_viz.config.settings import get_settings
def test_health():
result = get_settings()
assert result.schema_registry.port == 8081
assert result.schema_registry.protocol == 'http'
assert result.schema_registry.url == 'localhost'
| [
"schema_reg_viz.config.settings.get_settings"
] | [((90, 104), 'schema_reg_viz.config.settings.get_settings', 'get_settings', ([], {}), '()\n', (102, 104), False, 'from schema_reg_viz.config.settings import get_settings\n')] |
"""
Module defining API.
"""
from api import app
from flask import jsonify
import recipes
@app.route('/list')
def list():
"""
List all available recipes
:return:
list
a list containing the names of the recipes. ex: ['recipe1',recipe2']
"""
recipes.refresh()
return jsonify(recipes.... | [
"recipes.refresh",
"flask.jsonify",
"recipes.status",
"recipes.stop",
"api.app.route",
"recipes.start",
"recipes.selectOption"
] | [((93, 111), 'api.app.route', 'app.route', (['"""/list"""'], {}), "('/list')\n", (102, 111), False, 'from api import app\n'), ((329, 349), 'api.app.route', 'app.route', (['"""/status"""'], {}), "('/status')\n", (338, 349), False, 'from api import app\n'), ((1313, 1339), 'api.app.route', 'app.route', (['"""/start/<name>... |
import numpy as np
import torch
from utils import plotsAnalysis
import os
from utils.helper_functions import load_flags
def auto_swipe(mother_dir=None):
"""
This function swipes the parameter space of a folder and extract the varying hyper-parameters and make 2d heatmap w.r.t. all combinations of them
"""... | [
"utils.helper_functions.load_flags",
"os.path.isdir",
"utils.plotsAnalysis.HeatMapBVL",
"os.path.join",
"os.listdir",
"numpy.unique"
] | [((1134, 1156), 'os.listdir', 'os.listdir', (['mother_dir'], {}), '(mother_dir)\n', (1144, 1156), False, 'import os\n'), ((1216, 1248), 'os.path.join', 'os.path.join', (['mother_dir', 'folder'], {}), '(mother_dir, folder)\n', (1228, 1248), False, 'import os\n'), ((1538, 1560), 'utils.helper_functions.load_flags', 'load... |
from django.contrib import messages as notifications
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.messages.views import SuccessMessageMixin
from django.db.models import F, Q
from django.db.models.functions import Coalesce
from django.http import Http404
from django.shortcuts import get_... | [
"dictionary.utils.time_threshold",
"django.utils.translation.gettext",
"django.utils.translation.gettext_lazy",
"django.utils.timezone.now",
"django.urls.reverse_lazy",
"django.contrib.messages.error",
"dictionary.models.Entry.objects_all.filter",
"django.urls.reverse",
"django.db.models.F",
"dict... | [((933, 962), 'django.utils.translation.gettext_lazy', '_', (['"""settings are saved, dear"""'], {}), "('settings are saved, dear')\n", (934, 962), True, 'from django.utils.translation import gettext, gettext_lazy as _\n'), ((981, 1013), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""user_preferences"""'], {}), "('u... |
#!/usr/bin/env python
# Copyright 2019 <NAME>
#
# This file is part of RfPy.
#
# 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
# ... | [
"numpy.abs",
"rfpy.arguments.get_ccp_arguments",
"numpy.median",
"rfpy.CCPimage",
"pathlib.Path",
"pickle.load",
"obspy.core.Stream",
"numpy.array",
"numpy.var",
"stdb.io.load_db"
] | [((1987, 2016), 'rfpy.arguments.get_ccp_arguments', 'arguments.get_ccp_arguments', ([], {}), '()\n', (2014, 2016), False, 'from rfpy import arguments, binning, plotting\n'), ((2047, 2079), 'stdb.io.load_db', 'stdb.io.load_db', ([], {'fname': 'args.indb'}), '(fname=args.indb)\n', (2062, 2079), False, 'import stdb\n'), (... |
from . import models
from . import schema
import re
import magic
import mimetypes
import boto3
from botocore.client import Config
from mongoengine import connect
from pydub import AudioSegment
import io
import hashlib
from base64 import urlsafe_b64encode
#MONGO_URI = f'mongodb://{MONGO_USERNAME}:{MONGO_PASSWORD}@{MON... | [
"io.BytesIO",
"mongoengine.connect",
"hashlib.sha256",
"magic.from_buffer",
"boto3.session.Session",
"mimetypes.guess_extension",
"re.sub"
] | [((523, 546), 'boto3.session.Session', 'boto3.session.Session', ([], {}), '()\n', (544, 546), False, 'import boto3\n'), ((1745, 1768), 'mongoengine.connect', 'connect', ([], {'host': 'mongo_uri'}), '(host=mongo_uri)\n', (1752, 1768), False, 'from mongoengine import connect\n'), ((1893, 1956), 're.sub', 're.sub', (['"""... |
import copy
from django.conf import settings
from django.db.models import Sum, Count, F
from rest_framework.response import Response
from rest_framework.views import APIView
from usaspending_api.awards.models_matviews import UniversalAwardView
from usaspending_api.awards.v2.filters.matview_filters import matview_sear... | [
"usaspending_api.awards.v2.lookups.lookups.grant_subaward_mapping.keys",
"rest_framework.response.Response",
"usaspending_api.common.api_versioning.api_transformations",
"usaspending_api.awards.v2.lookups.matview_lookups.award_idv_mapping.keys",
"usaspending_api.awards.v2.lookups.lookups.contract_type_mappi... | [((1561, 1658), 'usaspending_api.common.api_versioning.api_transformations', 'api_transformations', ([], {'api_version': 'settings.API_VERSION', 'function_list': 'API_TRANSFORM_FUNCTIONS'}), '(api_version=settings.API_VERSION, function_list=\n API_TRANSFORM_FUNCTIONS)\n', (1580, 1658), False, 'from usaspending_api.c... |
import requests
from kata.domain.exceptions import ApiLimitReached, InvalidAuthToken
class GithubApi:
"""
Basic wrapper around the Github Api
"""
def __init__(self, auth_token: str):
self._requests = requests
self._auth_token = auth_token
def contents(self, user, repo, path=''):... | [
"kata.domain.exceptions.ApiLimitReached",
"kata.domain.exceptions.InvalidAuthToken"
] | [((1443, 1460), 'kata.domain.exceptions.ApiLimitReached', 'ApiLimitReached', ([], {}), '()\n', (1458, 1460), False, 'from kata.domain.exceptions import ApiLimitReached, InvalidAuthToken\n'), ((1506, 1540), 'kata.domain.exceptions.InvalidAuthToken', 'InvalidAuthToken', (['self._auth_token'], {}), '(self._auth_token)\n',... |
import boto3
import json
MTURK_SANDBOX = 'https://mturk-requester-sandbox.us-east-1.amazonaws.com'
def get_mturk_client():
with open('config.json', 'r') as f:
config = json.load(f)
mturk = boto3.client('mturk',
aws_access_key_id = config['SANDBOX']['aws_access_key_id'],
aws_s... | [
"json.load",
"boto3.client"
] | [((217, 430), 'boto3.client', 'boto3.client', (['"""mturk"""'], {'aws_access_key_id': "config['SANDBOX']['aws_access_key_id']", 'aws_secret_access_key': "config['SANDBOX']['aws_secret_access_key']", 'region_name': '"""us-east-1"""', 'endpoint_url': 'MTURK_SANDBOX'}), "('mturk', aws_access_key_id=config['SANDBOX'][\n ... |
from stevedore import driver, ExtensionManager
def get_operator(name):
"""Get an operator class from a plugin.
Attrs:
name: The name of the plugin containing the operator class.
Returns: The operator *class object* (i.e. not an instance) provided by the
plugin named `name`.
"""
r... | [
"stevedore.driver.DriverManager",
"stevedore.ExtensionManager"
] | [((632, 751), 'stevedore.driver.DriverManager', 'driver.DriverManager', ([], {'namespace': '"""cosmic_ray.test_runners"""', 'name': 'name', 'invoke_on_load': '(True)', 'invoke_args': '(test_args,)'}), "(namespace='cosmic_ray.test_runners', name=name,\n invoke_on_load=True, invoke_args=(test_args,))\n", (652, 751), F... |
from django.contrib import admin
from .models import List
class ListAdmin(admin.ModelAdmin):
list_filter = ('board', 'name')
admin.site.register(List, ListAdmin)
| [
"django.contrib.admin.site.register"
] | [((134, 170), 'django.contrib.admin.site.register', 'admin.site.register', (['List', 'ListAdmin'], {}), '(List, ListAdmin)\n', (153, 170), False, 'from django.contrib import admin\n')] |
import pandas as pd
import numpy as np
from sklearn.metrics.pairwise import euclidean_distances, cosine_similarity, manhattan_distances
def top_5(book, items, similarity_measure):
"""
This function extracts the top-five similar books for a given book and
similarity measure. This function takes t... | [
"numpy.isin",
"sklearn.metrics.pairwise.cosine_similarity",
"sklearn.metrics.pairwise.manhattan_distances",
"sklearn.metrics.pairwise.euclidean_distances",
"numpy.argsort",
"pandas.concat"
] | [((2284, 2315), 'sklearn.metrics.pairwise.euclidean_distances', 'euclidean_distances', (['items_temp'], {}), '(items_temp)\n', (2303, 2315), False, 'from sklearn.metrics.pairwise import euclidean_distances, cosine_similarity, manhattan_distances\n'), ((3588, 3631), 'numpy.isin', 'np.isin', (["items['itemID']", 'book_to... |
# util.py/Open GoPro, Version 1.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Tue May 18 22:08:50 UTC 2021
"""Miscellaneous utilities for the GoPro package."""
import sys
import queue
import logging
import subprocess
from pathlib import Path
from typing import D... | [
"subprocess.Popen",
"logging.getLogger",
"sys.platform.lower"
] | [((368, 395), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (385, 395), False, 'import logging\n'), ((763, 783), 'sys.platform.lower', 'sys.platform.lower', ([], {}), '()\n', (781, 783), False, 'import sys\n'), ((939, 959), 'sys.platform.lower', 'sys.platform.lower', ([], {}), '()\n', (9... |
_IS_SIMPLE_CORE = False
if _IS_SIMPLE_CORE:
from dezero.core_simple import Variable
from dezero.core_simple import Function
from dezero.core_simple import using_config
from dezero.core_simple import no_grad
from dezero.core_simple import as_array
from dezero.core_simple import as_variable
f... | [
"dezero.core.setup_variable"
] | [((754, 770), 'dezero.core.setup_variable', 'setup_variable', ([], {}), '()\n', (768, 770), False, 'from dezero.core import setup_variable\n')] |
import time
import urllib
from typing import List, Tuple
from SPARQLWrapper import JSON, SPARQLWrapper
from named_entity_recognition.utils import (join_with_newlines, load_list,
save_text)
LIMIT = 0
def main():
names = load_list('output/nltk.txt')
sparql = SPARQL... | [
"named_entity_recognition.utils.save_text",
"named_entity_recognition.utils.load_list",
"time.sleep",
"SPARQLWrapper.SPARQLWrapper",
"named_entity_recognition.utils.join_with_newlines"
] | [((272, 300), 'named_entity_recognition.utils.load_list', 'load_list', (['"""output/nltk.txt"""'], {}), "('output/nltk.txt')\n", (281, 300), False, 'from named_entity_recognition.utils import join_with_newlines, load_list, save_text\n'), ((314, 364), 'SPARQLWrapper.SPARQLWrapper', 'SPARQLWrapper', (['"""https://query.w... |
from datetime import datetime
from pathlib import Path
import pytest
from maggma.stores import MemoryStore
from .simple_bib_drone import SimpleBibDrone
@pytest.fixture
def init_drone(test_dir):
"""
Initialize the drone, do not initialize the connection with the database
:return:
initialized dr... | [
"datetime.datetime.now",
"maggma.stores.MemoryStore"
] | [((350, 409), 'maggma.stores.MemoryStore', 'MemoryStore', ([], {'collection_name': '"""drone_test"""', 'key': '"""record_key"""'}), "(collection_name='drone_test', key='record_key')\n", (361, 409), False, 'from maggma.stores import MemoryStore\n'), ((1577, 1591), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n... |
# Generated by Django 2.0.13 on 2020-02-16 13:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('websubsub', '0010_subscription_time_last_event_received'),
]
operations = [
migrations.AddField(
model_name='subscription',
... | [
"django.db.models.BooleanField"
] | [((362, 412), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'editable': '(False)'}), '(default=False, editable=False)\n', (381, 412), False, 'from django.db import migrations, models\n')] |
# coding: utf8
# Copyright (c) <NAME>, University of Antwerp
# Distributed under the terms of the MIT License
import os
import numpy as np
from fireworks import Firework, LaunchPad, PyTask, Workflow
from pymongo.errors import ServerSelectionTimeoutError
from ruamel.yaml import YAML
from pybat.cli.commands.define imp... | [
"numpy.sum",
"fireworks.Workflow",
"os.walk",
"numpy.linalg.norm",
"os.path.join",
"os.path.abspath",
"pybat.core.LiRichCathode.from_file",
"os.path.exists",
"ruamel.yaml.YAML",
"pybat.cli.commands.setup.transition",
"pybat.workflow.fireworks.RelaxFirework",
"pybat.workflow.fireworks.NebFirewo... | [((1002, 1029), 'os.path.exists', 'os.path.exists', (['CONFIG_FILE'], {}), '(CONFIG_FILE)\n', (1016, 1029), False, 'import os\n'), ((948, 971), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (966, 971), False, 'import os\n'), ((4347, 4523), 'pybat.workflow.fireworks.ScfFirework', 'ScfFirework... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilitie... | [
"pulumi.get",
"pulumi.getter",
"pulumi.ResourceOptions",
"warnings.warn"
] | [((13153, 13186), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""chapEnabled"""'}), "(name='chapEnabled')\n", (13166, 13186), False, 'import pulumi\n'), ((13391, 13419), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""diskId"""'}), "(name='diskId')\n", (13404, 13419), False, 'import pulumi\n'), ((13648, 13680)... |
import sys
sys.stdout = open('output.txt', 'w')
sys.stdin = open('input.txt')
# Part Two
from collections import deque
ans = 0
last = None
t = 2000
q = deque()
sm = 0
for _ in range(t):
if len(q) == 3:
sm -= q.popleft()
num = int(input())
sm += num
q.append(num)
if last is None and len(q) =... | [
"collections.deque"
] | [((153, 160), 'collections.deque', 'deque', ([], {}), '()\n', (158, 160), False, 'from collections import deque\n')] |
__author__ = '<NAME> <<EMAIL>>'
from unittest import TestSuite
from .testcase_api_key_authorized import ApiKeyAuthorizedTestCase
from .testcase_api_key_unauthorized import ApiKeyUnauthorizedTestCase
from .testcase_create_headers import CreateHttpHeadersTestCase
from .testcase_convert import ConvertTestCase
from .test... | [
"unittest.TestSuite"
] | [((593, 604), 'unittest.TestSuite', 'TestSuite', ([], {}), '()\n', (602, 604), False, 'from unittest import TestSuite\n')] |
# -*- coding: utf-8 -*-
from sqlalchemy import Column, Integer
from sqlalchemy.types import Numeric, Unicode
from sqlalchemy.dialects import postgresql
from chsdi.models import register, bases
from chsdi.models.vector import Vector, Geometry2D
Base = bases['zeitreihen']
class Zeitreihen15(Base, Vector):
__tab... | [
"sqlalchemy.dialects.postgresql.ARRAY",
"sqlalchemy.Column",
"chsdi.models.register"
] | [((4881, 4935), 'chsdi.models.register', 'register', (['"""ch.swisstopo.hiks-siegfried"""', 'SiegfriedErst'], {}), "('ch.swisstopo.hiks-siegfried', SiegfriedErst)\n", (4889, 4935), False, 'from chsdi.models import register, bases\n'), ((4936, 4984), 'chsdi.models.register', 'register', (['"""ch.swisstopo.hiks-dufour"""... |
import json
import numpy as np
def get_timestamps(evts):
return [c['timestamp'] for c in evts['content']]
def get_bucket(dt):
return dt.weekday() * 24 + dt.hour
from collections import namedtuple
AllData = namedtuple('AllData', ['spots', 'trends', 'total'])
def load_data():
pass
| [
"collections.namedtuple"
] | [((213, 264), 'collections.namedtuple', 'namedtuple', (['"""AllData"""', "['spots', 'trends', 'total']"], {}), "('AllData', ['spots', 'trends', 'total'])\n", (223, 264), False, 'from collections import namedtuple\n')] |
# Copyright 2021 Zilliz. 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 law or agree... | [
"yaml.safe_dump",
"towhee.pipeline",
"towhee.hparam.hyperparameter.param_scope",
"pathlib.Path",
"yaml.safe_load",
"towhee.Inject",
"pathlib.Path.cwd"
] | [((2716, 2726), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (2724, 2726), False, 'from pathlib import Path\n'), ((2744, 2754), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (2748, 2754), False, 'from pathlib import Path\n'), ((5312, 5339), 'towhee.pipeline', 'pipeline', (['name'], {'tag': 'version'}), '(nam... |
from rich import print
#print("Hello, [bold magenta]World[/bold magenta]!", ":vampire:", locals())
from rich.console import Console
console = Console()
console.print("Hello", "World!", style="bold red")
console.print("Hello", style="5")
console.print("Hello", style="#af00ff")
console.print("Hello", style="rgb(175,0,2... | [
"rich.panel.Panel",
"rich.text.Text",
"rich.markdown.Markdown",
"rich.console.Console",
"rich.theme.Theme",
"rich.table.Table"
] | [((144, 153), 'rich.console.Console', 'Console', ([], {}), '()\n', (151, 153), False, 'from rich.console import Console\n'), ((870, 941), 'rich.theme.Theme', 'Theme', (["{'info': 'dim cyan', 'warning': 'magenta', 'danger': 'bold red'}"], {}), "({'info': 'dim cyan', 'warning': 'magenta', 'danger': 'bold red'})\n", (875,... |
#! /usr/bin/python
'''
Data Normalization
'''
from sklearn import preprocessing
def normalize(file_dataframe, cols):
'''
Data Normalization.
'''
for col in cols:
preprocessing.normalize(file_dataframe[col], \
axis=1, norm='l2', copy=False)
return file_dataframe | [
"sklearn.preprocessing.normalize"
] | [((197, 272), 'sklearn.preprocessing.normalize', 'preprocessing.normalize', (['file_dataframe[col]'], {'axis': '(1)', 'norm': '"""l2"""', 'copy': '(False)'}), "(file_dataframe[col], axis=1, norm='l2', copy=False)\n", (220, 272), False, 'from sklearn import preprocessing\n')] |
from datetime import timedelta
AUTOFOCUS_IP_RESPONSE_MOCK = {
"indicator": {
"indicatorValue": "172.16.31.10",
"indicatorType": "IPV4_ADDRESS",
"summaryGenerationTs": 1607951568568,
"firstSeenTsGlobal": None,
"lastSeenTsGlobal": None,
"latestPanVerdicts": {
... | [
"datetime.timedelta"
] | [((19231, 19248), 'datetime.timedelta', 'timedelta', ([], {'days': '(7)'}), '(days=7)\n', (19240, 19248), False, 'from datetime import timedelta\n')] |
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Date: 2018-05-10 17:57:07
# @Last Modified by: <NAME>
# @Last Modified time: 2018-05-28 21:50:38
from distutils.core import setup
setup(
name = 'IPX800',
packages = ['IPX800'],
version = '0.1.5',
description = 'Library for controlling GCE-Electronics IPX800',
... | [
"distutils.core.setup"
] | [((180, 542), 'distutils.core.setup', 'setup', ([], {'name': '"""IPX800"""', 'packages': "['IPX800']", 'version': '"""0.1.5"""', 'description': '"""Library for controlling GCE-Electronics IPX800"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/d4mi1/python-ipx800"""', 'downl... |
# Copyright 2018 Google Inc.
#
# 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,... | [
"gcp_connector.GCPConnector",
"json.dumps"
] | [((1115, 1139), 'gcp_connector.GCPConnector', 'GCPConnector', (['PROJECT_ID'], {}), '(PROJECT_ID)\n', (1127, 1139), False, 'from gcp_connector import GCPConnector\n'), ((1806, 1829), 'json.dumps', 'json.dumps', (['task_params'], {}), '(task_params)\n', (1816, 1829), False, 'import json\n')] |
# -*- coding: utf-8 -*-
"""
.. invisible:
_ _ _____ _ _____ _____
| | | | ___| | | ___/ ___|
| | | | |__ | | | |__ \ `--.
| | | | __|| | | __| `--. \
\ \_/ / |___| |___| |___/\__/ /
\___/\____/\_____|____/\____/
Created on Jan 25, 2015
Loaders which get data from pickles
██... | [
"zope.interface.implementer",
"veles.compat.from_none",
"veles.error.BadFormatError",
"numpy.array",
"veles.loader.fullbatch_image.FullBatchImageLoader.load_data",
"pickle.load",
"veles.memory.interleave"
] | [((1713, 1742), 'zope.interface.implementer', 'implementer', (['IFullBatchLoader'], {}), '(IFullBatchLoader)\n', (1724, 1742), False, 'from zope.interface import implementer\n'), ((5966, 5991), 'zope.interface.implementer', 'implementer', (['IImageLoader'], {}), '(IImageLoader)\n', (5977, 5991), False, 'from zope.inter... |
import Piper
import html
import os
import DB
class Telegram2VK(Piper.Piper):
def __init__(self, source, dest):
""" Gets 2 handlers """
super(Telegram2VK, self).__init__(source, dest)
def converter(self, in_q, out_q):
while True:
telegram_msg = in_q.get(block=True)
... | [
"DB.convert_ids"
] | [((482, 553), 'DB.convert_ids', 'DB.convert_ids', (['"""Telegram"""', '"""VK"""', "telegram_msg['message']['chat']['id']"], {}), "('Telegram', 'VK', telegram_msg['message']['chat']['id'])\n", (496, 553), False, 'import DB\n')] |
import sqlite3
if __name__ == '__main__':
SQL_FILE_NAME = "main_solo_vals_flame_advantaged.sql"
DB_FILE_NAME = "solo_values_FA.db"
connection = sqlite3.connect(DB_FILE_NAME)
cursor = connection.cursor()
file = open(SQL_FILE_NAME)
read_file = file.read()
cursor.executescript(read_fi... | [
"sqlite3.connect"
] | [((162, 191), 'sqlite3.connect', 'sqlite3.connect', (['DB_FILE_NAME'], {}), '(DB_FILE_NAME)\n', (177, 191), False, 'import sqlite3\n')] |
from django.urls import path, include
from . import views
urlpatterns = [
path(
'game-filter-choices',
views.GameFilterChoicesView.as_view(),
name='game-filter-choices'
),
path(
'games',
views.ListGames.as_view(),
name='list-games'
),
path(
... | [
"django.urls.include"
] | [((1310, 1368), 'django.urls.include', 'include', (['"""rest_framework.urls"""'], {'namespace': '"""rest_framework"""'}), "('rest_framework.urls', namespace='rest_framework')\n", (1317, 1368), False, 'from django.urls import path, include\n')] |
"""Add newsletter history
Revision ID: <KEY>
Revises: 2<PASSWORD>a6ada0d
Create Date: 2020-11-03 12:01:49.481652
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '28165a6ada0d'
branch_labels = Non... | [
"alembic.op.drop_table",
"sqlalchemy.Integer",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.ForeignKeyConstraint"
] | [((804, 831), 'alembic.op.drop_table', 'op.drop_table', (['"""newsletter"""'], {}), "('newsletter')\n", (817, 831), False, 'from alembic import op\n'), ((589, 652), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['inscription_id']", "['inscription.id']"], {}), "(['inscription_id'], ['inscription.id'])... |
from django.shortcuts import render
from django.http import HttpResponse, HttpRequest
# Create your views here.
def index(request: HttpRequest):
return HttpResponse("Hello, world.")
| [
"django.http.HttpResponse"
] | [((156, 185), 'django.http.HttpResponse', 'HttpResponse', (['"""Hello, world."""'], {}), "('Hello, world.')\n", (168, 185), False, 'from django.http import HttpResponse, HttpRequest\n')] |
'''
Unittests for pysal.model.spreg.error_sp_hom module
'''
import unittest
import pysal.lib
from pysal.model.spreg import error_sp_hom as HOM
import numpy as np
from pysal.lib.common import RTOL
import pysal.model.spreg
class BaseGM_Error_Hom_Tester(unittest.TestCase):
def setUp(self):
db=pysal.lib.io.op... | [
"unittest.TextTestRunner",
"unittest.TestSuite",
"pysal.model.spreg.error_sp_hom.GM_Combo_Hom",
"pysal.model.spreg.error_sp_hom.BaseGM_Error_Hom",
"pysal.model.spreg.error_sp_hom.GM_Endog_Error_Hom",
"pysal.model.spreg.error_sp_hom.BaseGM_Combo_Hom",
"numpy.ones",
"numpy.array",
"numpy.reshape",
"... | [((17068, 17088), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (17086, 17088), False, 'import unittest\n'), ((17414, 17439), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (17437, 17439), False, 'import unittest\n'), ((430, 452), 'numpy.reshape', 'np.reshape', (['y', '(49, 1)']... |
'''
The code is partially borrowed from:
https://github.com/v-iashin/video_features/blob/861efaa4ed67/utils/utils.py
and
https://github.com/PeihaoChen/regnet/blob/199609/extract_audio_and_video.py
'''
import os
import shutil
import subprocess
from glob import glob
from pathlib import Path
from typing import Dict
impor... | [
"os.remove",
"train.instantiate_from_config",
"omegaconf.omegaconf.OmegaConf.load",
"torch.cat",
"pathlib.Path",
"numpy.tile",
"feature_extraction.extract_mel_spectrogram.get_spectrogram",
"torchvision.transforms.Normalize",
"torch.no_grad",
"os.path.join",
"sample_visualization.load_vocoder",
... | [((1139, 1229), 'subprocess.run', 'subprocess.run', (["['which', 'ffmpeg']"], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.STDOUT'}), "(['which', 'ffmpeg'], stdout=subprocess.PIPE, stderr=\n subprocess.STDOUT)\n", (1153, 1229), False, 'import subprocess\n'), ((1459, 1550), 'subprocess.run', 'subprocess.run', ... |
#!/usr/bin/env python3
import sys
import os.path
import gzip
from os import path
def process_file(file, output_file):
if path.exists(file) == False:
print("Cannot continue because {} does not exist".format(file), file=sys.stderr)
sys.exit(1)
if path.exists(output_file) == True:
os.rem... | [
"os.path.exists",
"sys.exit",
"gzip.open"
] | [((128, 145), 'os.path.exists', 'path.exists', (['file'], {}), '(file)\n', (139, 145), False, 'from os import path\n'), ((253, 264), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (261, 264), False, 'import sys\n'), ((272, 296), 'os.path.exists', 'path.exists', (['output_file'], {}), '(output_file)\n', (283, 296), Fal... |
# -*- coding: utf-8 -*-
import json
import pytest
from requests import Response
import py42.settings
from py42.clients.users import UserClient
from py42.response import Py42Response
USER_URI = "/api/User"
DEFAULT_GET_ALL_PARAMS = {
"active": None,
"email": None,
"orgUid": None,
"roleId": None,
"... | [
"py42.response.Py42Response",
"json.dumps",
"py42.clients.users.UserClient"
] | [((866, 888), 'py42.response.Py42Response', 'Py42Response', (['response'], {}), '(response)\n', (878, 888), False, 'from py42.response import Py42Response\n'), ((1151, 1173), 'py42.response.Py42Response', 'Py42Response', (['response'], {}), '(response)\n', (1163, 1173), False, 'from py42.response import Py42Response\n'... |
#!/usr/bin/python3
# #####################################
# info: This class can connect to VFD MDM166
#
# date: 2017-06-13
# version: 0.1.1
#
# Dependencies:
# $ sudo apt-get install python3-dev libusb-1.0-0-dev libudev-dev python3-pip
# $ sudo pip3 install --upgrade setuptools
# $ sudo pip3 install hidapi
# place a... | [
"hid.device",
"dot_matrix_font.dot_matrix_font"
] | [((722, 734), 'hid.device', 'hid.device', ([], {}), '()\n', (732, 734), False, 'import hid\n'), ((809, 842), 'dot_matrix_font.dot_matrix_font', 'dot_matrix_font.dot_matrix_font', ([], {}), '()\n', (840, 842), False, 'import dot_matrix_font\n')] |
# ==============================================================================
# 2017_04_15 LSW@NCHC.
#
# Change 3 code to use new in, out dir name for fit the needs.
# cp new.image to /out/ do not need to chnage code of classify.py.
#
# USAGE: time py Check.py /home/TF_io/
# =========================================... | [
"shutil.copyfile",
"subprocess.Popen",
"os.listdir",
"time.sleep"
] | [((799, 812), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (809, 812), False, 'import os, time\n'), ((738, 763), 'os.listdir', 'os.listdir', (['path_to_watch'], {}), '(path_to_watch)\n', (748, 763), False, 'import os, time\n'), ((850, 875), 'os.listdir', 'os.listdir', (['path_to_watch'], {}), '(path_to_watch)\n'... |
from timm.models.layers.weight_init import trunc_normal_
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
from einops import rearrange
from mmcv.cnn import build_conv_layer, kaiming_init
class FeatEmbed(nn.Module):
"""Image to Patch Embedding.
Args:... | [
"mmcv.cnn.kaiming_init",
"einops.rearrange",
"torch.nn.modules.utils._pair",
"mmcv.cnn.build_conv_layer"
] | [((928, 943), 'torch.nn.modules.utils._pair', '_pair', (['img_size'], {}), '(img_size)\n', (933, 943), False, 'from torch.nn.modules.utils import _pair\n'), ((970, 987), 'torch.nn.modules.utils._pair', '_pair', (['patch_size'], {}), '(patch_size)\n', (975, 987), False, 'from torch.nn.modules.utils import _pair\n'), ((1... |
from datetime import datetime, timedelta
from os import environ
from peewee import (
BigIntegerField,
DateField,
DateTimeField,
CharField,
FloatField,
Model,
BooleanField,
InternalError,
)
from playhouse.db_url import connect
# Use default sqlite db in tests
db = connect(environ.get("D... | [
"peewee.FloatField",
"peewee.DateField",
"peewee.DateTimeField",
"os.environ.get",
"peewee.CharField",
"datetime.timedelta",
"peewee.BooleanField",
"peewee.BigIntegerField",
"datetime.datetime.now"
] | [((470, 481), 'peewee.CharField', 'CharField', ([], {}), '()\n', (479, 481), False, 'from peewee import BigIntegerField, DateField, DateTimeField, CharField, FloatField, Model, BooleanField, InternalError\n'), ((497, 514), 'peewee.BigIntegerField', 'BigIntegerField', ([], {}), '()\n', (512, 514), False, 'from peewee im... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author: <NAME>
Description:
This PySPark scripts maps geolocated mobility data for valid users
to specific land use type where the activity occured and counts
number of unique users within each land use type aggregated to 250m x 250m
neighborhoods in New York City.
"... | [
"math.sqrt",
"math.radians",
"pyspark.sql.functions.lit",
"math.sin",
"numpy.mean",
"pyspark.sql.functions.col",
"math.cos",
"pyspark.sql.session.SparkSession.builder.getOrCreate",
"pyspark.sql.functions.countDistinct"
] | [((610, 644), 'pyspark.sql.session.SparkSession.builder.getOrCreate', 'SparkSession.builder.getOrCreate', ([], {}), '()\n', (642, 644), False, 'from pyspark.sql.session import SparkSession\n'), ((736, 747), 'math.radians', 'radians', (['y1'], {}), '(y1)\n', (743, 747), False, 'from math import sin, cos, sqrt, atan2, ra... |
import os
import random
import argparse
import numpy as np
from PIL import Image, ImageDraw, ImageFont
def make_blank_placeholder(image_file, out_file):
#print(out_file)
image = np.asarray(Image.open(image_file))
blank = np.ones(image.shape)*255
blank = blank.astype(np.uint8)
#print(blank.shape)
im = Ima... | [
"argparse.ArgumentParser",
"random.randint",
"os.walk",
"numpy.ones",
"PIL.Image.open",
"PIL.ImageFont.truetype",
"PIL.Image.fromarray",
"PIL.ImageDraw.Draw",
"os.path.join"
] | [((317, 339), 'PIL.Image.fromarray', 'Image.fromarray', (['blank'], {}), '(blank)\n', (332, 339), False, 'from PIL import Image, ImageDraw, ImageFont\n'), ((349, 367), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['im'], {}), '(im)\n', (363, 367), False, 'from PIL import Image, ImageDraw, ImageFont\n'), ((483, 538), 'PIL.I... |
import pickle
import logging
import hashlib
import numpy as np
import os
from pathlib import Path
import spacy
import shutil
import sys
import tarfile
import tempfile
import torch
from typing import Dict, List
sys.path.append("nbsvm")
from nltk import word_tokenize
from nltk.stem import WordNetLemmatizer
from nltk.ste... | [
"flask.jsonify",
"pathlib.Path",
"pickle.load",
"shutil.rmtree",
"torch.no_grad",
"allennlp.data.Vocabulary.from_files",
"flask.request.get_json",
"nltk.word_tokenize",
"sys.path.append",
"nltk.stem.WordNetLemmatizer",
"spacy.load",
"tempfile.mkdtemp",
"flask.render_template",
"tarfile.ope... | [((210, 234), 'sys.path.append', 'sys.path.append', (['"""nbsvm"""'], {}), "('nbsvm')\n", (225, 234), False, 'import sys\n'), ((670, 709), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (689, 709), False, 'import logging\n'), ((721, 747), 'nltk.stem.snowball.Sno... |
from django.db import models
from operation.models import Operation
from processor.utils import push_record_to_sqs_queue
import logging
SAFETY_LEVELS = (
(0, 'SAFE'),
(1, 'NOT CONFIRMED'),
(2, 'UNREACHABLE'),
(3, 'NEED_HELP'),
(4, 'NOT IN ZONE')
)
class Victim(models.Model):
"""
Used to s... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"processor.utils.push_record_to_sqs_queue",
"django.db.models.IntegerField",
"logging.info"
] | [((365, 396), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(64)'}), '(max_length=64)\n', (381, 396), False, 'from django.db import models\n'), ((416, 460), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)', 'unique': '(True)'}), '(max_length=20, unique=True)\n', (432... |
from fastapi import APIRouter, Depends
from app.dtos.responses.actor import ActorsDto, ActorDto
from app.services.actor_service import ActorService
from app.services.implementations.actor_service_implementation import (
ActorServiceImplementation,
)
router = APIRouter(tags=["Actor Resource"])
@router.get(path="... | [
"fastapi.Depends",
"fastapi.APIRouter"
] | [((265, 299), 'fastapi.APIRouter', 'APIRouter', ([], {'tags': "['Actor Resource']"}), "(tags=['Actor Resource'])\n", (274, 299), False, 'from fastapi import APIRouter, Depends\n'), ((412, 447), 'fastapi.Depends', 'Depends', (['ActorServiceImplementation'], {}), '(ActorServiceImplementation)\n', (419, 447), False, 'from... |
import numpy as np
import matplotlib.pyplot as plt
# 计算delta
def calculate_delta(t, chosen_count, item):
if chosen_count[item] == 0:
return 1
else:
return np.sqrt(2 * np.log(t) / chosen_count[item])
def choose_arm(upper_bound_probs):
max = np.max(upper_bound_probs)
idx = np.where(upp... | [
"numpy.random.uniform",
"numpy.size",
"numpy.random.seed",
"numpy.random.binomial",
"matplotlib.pyplot.plot",
"numpy.argmax",
"numpy.log",
"numpy.zeros",
"numpy.max",
"numpy.where",
"numpy.array",
"numpy.random.choice",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.... | [((272, 297), 'numpy.max', 'np.max', (['upper_bound_probs'], {}), '(upper_bound_probs)\n', (278, 297), True, 'import numpy as np\n'), ((308, 342), 'numpy.where', 'np.where', (['(upper_bound_probs == max)'], {}), '(upper_bound_probs == max)\n', (316, 342), True, 'import numpy as np\n'), ((375, 391), 'numpy.array', 'np.a... |
# encoding: utf-8
from os import path, getenv
from datetime import timedelta
import ast
basedir = path.abspath(path.dirname(__file__))
class Config (object):
APP_NAME = getenv('APP_NAME', 'Python Flask Boilerplate')
DEV = ast.literal_eval(getenv('DEV', 'True'))
DEBUG = ast.literal_eval(getenv('... | [
"os.path.dirname",
"os.path.join",
"os.getenv",
"datetime.timedelta"
] | [((119, 141), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (131, 141), False, 'from os import path, getenv\n'), ((187, 233), 'os.getenv', 'getenv', (['"""APP_NAME"""', '"""Python Flask Boilerplate"""'], {}), "('APP_NAME', 'Python Flask Boilerplate')\n", (193, 233), False, 'from os import path,... |
from django import forms
from django.contrib.auth import get_user_model
from qa.models import Question
from qa.models import Answer
class QuestionForm(forms.ModelForm):
user = forms.ModelChoiceField(
widget = forms.HiddenInput,
queryset = get_user_model().objects.all(),
... | [
"django.forms.BooleanField",
"qa.models.Question.objects.all",
"django.contrib.auth.get_user_model"
] | [((995, 1055), 'django.forms.BooleanField', 'forms.BooleanField', ([], {'widget': 'forms.HiddenInput', 'required': '(False)'}), '(widget=forms.HiddenInput, required=False)\n', (1013, 1055), False, 'from django import forms\n'), ((784, 806), 'qa.models.Question.objects.all', 'Question.objects.all', ([], {}), '()\n', (80... |
from flamingo.url.conf import path
routers = [
path(url="/test", view_func_or_module="tapp.urls", name="test")
]
| [
"flamingo.url.conf.path"
] | [((53, 116), 'flamingo.url.conf.path', 'path', ([], {'url': '"""/test"""', 'view_func_or_module': '"""tapp.urls"""', 'name': '"""test"""'}), "(url='/test', view_func_or_module='tapp.urls', name='test')\n", (57, 116), False, 'from flamingo.url.conf import path\n')] |
"""
===============================================
Repair EEG artefacts caused by ocular movements
===============================================
Identify "bad" components in ICA solution (e.g., components which are highly
correlated the time course of the electrooculogram).
Authors: <NAME> <<EMAIL>>
License: BSD ... | [
"mne.io.read_raw_fif",
"mne.events_from_annotations",
"config.parser.parse_args",
"mne.preprocessing.read_ica",
"matplotlib.pyplot.close",
"mne.preprocessing.corrmap",
"mne.Epochs",
"config.fname.report",
"config.fname.output",
"numpy.unique"
] | [((659, 678), 'config.parser.parse_args', 'parser.parse_args', ([], {}), '()\n', (676, 678), False, 'from config import fname, parser, LoggingFormat\n'), ((1002, 1088), 'config.fname.output', 'fname.output', ([], {'subject': 'subject', 'processing_step': '"""repair_bads"""', 'file_type': '"""raw.fif"""'}), "(subject=su... |
from tkinter import *
from classes.AttackBarbarians import AttackBarbarians
from classes.ExploreFog import ExploreFog
from classes.Screenshot import Screenshot
from classes.tester import Tester
starter = Tk()
starter.winfo_toplevel().title('Rise of Kingdom - Automator')
starter.geometry('250x500')
class MainInterfac... | [
"classes.ExploreFog.ExploreFog.start",
"classes.tester.Tester.start",
"classes.Screenshot.Screenshot.shot",
"classes.AttackBarbarians.AttackBarbarians"
] | [((1166, 1180), 'classes.tester.Tester.start', 'Tester.start', ([], {}), '()\n', (1178, 1180), False, 'from classes.tester import Tester\n'), ((1219, 1237), 'classes.ExploreFog.ExploreFog.start', 'ExploreFog.start', ([], {}), '()\n', (1235, 1237), False, 'from classes.ExploreFog import ExploreFog\n'), ((1278, 1308), 'c... |
# Copyright 2021 the Ithaca Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | [
"absl.logging.info",
"jaxline.utils.double_buffer_on_gpu",
"glob.glob",
"os.path.join",
"ithaca.util.loss.cross_entropy_loss",
"jax.process_index",
"jax.random.uniform",
"jax.jit",
"jax.numpy.mean",
"jax.local_device_count",
"ithaca.models.model.Model",
"optax.apply_updates",
"absl.flags.mar... | [((24646, 24683), 'absl.flags.mark_flag_as_required', 'flags.mark_flag_as_required', (['"""config"""'], {}), "('config')\n", (24673, 24683), False, 'from absl import flags\n'), ((2222, 2265), 'jaxline.utils.bcast_local_devices', 'jl_utils.bcast_local_devices', (['self.init_rng'], {}), '(self.init_rng)\n', (2250, 2265),... |
#!/usr/bin/env python3
import sys
import tkinter as tk
import time
import copy
import numpy as np
import matplotlib as mpl
import matplotlib.backends.tkagg as tkagg
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg,
... | [
"tkinter.PhotoImage",
"wp_gust.State",
"tkinter.Label",
"tkinter.Canvas",
"tkinter.mainloop",
"matplotlib.backends.backend_agg.FigureCanvasAgg",
"wp_gust.next_state",
"wp_gust.Inputs",
"time.time",
"matplotlib.figure.Figure",
"wp_ipc.Session",
"tkinter.Scale",
"wp_gust.update_inputs_ipc",
... | [((518, 551), 'matplotlib.figure.Figure', 'mpl.figure.Figure', ([], {'figsize': '(3, 2)'}), '(figsize=(3, 2))\n', (535, 551), True, 'import matplotlib as mpl\n'), ((608, 628), 'matplotlib.backends.backend_agg.FigureCanvasAgg', 'FigureCanvasAgg', (['fig'], {}), '(fig)\n', (623, 628), False, 'from matplotlib.backends.bac... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# 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 ap... | [
"paddle.fluid.layers.accuracy",
"paddle.fluid.layers.reduce_mean",
"paddle.concat",
"paddle.reshape",
"paddle.nn.functional.softmax",
"paddle.argmax",
"paddle.arange",
"paddle.no_grad",
"paddle.nn.functional.kl_div",
"paddle.matmul",
"paddle.shape",
"paddle.nn.functional.log_softmax",
"paddl... | [((1199, 1220), 'paddle.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (1218, 1220), True, 'import paddle.nn as nn\n'), ((4174, 4218), 'paddle.concat', 'paddle.concat', (['[logits_aa, logits_ab_co2]', '(1)'], {}), '([logits_aa, logits_ab_co2], 1)\n', (4187, 4218), False, 'import paddle\n'), ((4237, 4281... |
#!/usr/bin/env python
"""
example of putting git short revision in matplotlib plot, up in the corner
(rather than in title where git revision text is too large)
This is helpful for when a colleague wants a plot exactly recreated from a year ago,
to help find the exact code used to create that plot.
http://matplotlib... | [
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show",
"subprocess.check_output"
] | [((624, 632), 'matplotlib.pyplot.figure', 'figure', ([], {}), '()\n', (630, 632), False, 'from matplotlib.pyplot import figure, show\n'), ((772, 778), 'matplotlib.pyplot.show', 'show', ([], {}), '()\n', (776, 778), False, 'from matplotlib.pyplot import figure, show\n'), ((429, 522), 'subprocess.check_output', 'subproce... |
from __future__ import print_function
from particletools.tables import (PYTHIAParticleData, c_speed_of_light,
print_stable, make_stable_list)
import math
pdata = PYTHIAParticleData()
print_stable(pdata.ctau('D0') / c_speed_of_light,
title=('Particles with known finite li... | [
"particletools.tables.PYTHIAParticleData",
"particletools.tables.make_stable_list"
] | [((197, 217), 'particletools.tables.PYTHIAParticleData', 'PYTHIAParticleData', ([], {}), '()\n', (215, 217), False, 'from particletools.tables import PYTHIAParticleData, c_speed_of_light, print_stable, make_stable_list\n'), ((461, 484), 'particletools.tables.make_stable_list', 'make_stable_list', (['(1e-08)'], {}), '(1... |