code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
import sys
import argparse
import numpy as np
import theano.tensor as T
homepath = os.path.join('..', '..')
if not homepath in sys.path:
sys.path.insert(0, homepath)
from dlearn.models.layer import FullConnLayer, ConvPoolLayer
from dlearn.models.nnet import NeuralNet
from dlearn.utils import actfuncs, ... | [
"argparse.ArgumentParser",
"theano.tensor.tensor4",
"dlearn.utils.serialize.load_data",
"dlearn.optimization.sgd.train",
"dlearn.utils.costfuncs.binxent",
"sys.path.insert",
"dlearn.utils.costfuncs.binerr",
"dlearn.models.layer.ConvPoolLayer",
"numpy.prod",
"dlearn.utils.actfuncs.tanh",
"dlearn.... | [((94, 118), 'os.path.join', 'os.path.join', (['""".."""', '""".."""'], {}), "('..', '..')\n", (106, 118), False, 'import os\n'), ((868, 912), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'desctxt'}), '(description=desctxt)\n', (891, 912), False, 'import argparse\n'), ((153, 181), 'sys.pat... |
import pytest
from zentropi import Agent
from zentropi import Frame
from zentropi import WebsocketTransport
from zentropi.transport import websocket
class MockWebsockets(object):
def __init__(self, login_ok=True, send_ok=True, recv_ok=True):
self._login_ok = login_ok
self._send_ok = send_ok
... | [
"zentropi.WebsocketTransport",
"zentropi.Frame.from_json",
"zentropi.Frame",
"pytest.mark.xfail"
] | [((1511, 1552), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'raises': 'PermissionError'}), '(raises=PermissionError)\n', (1528, 1552), False, 'import pytest\n'), ((1839, 1880), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'raises': 'ConnectionError'}), '(raises=ConnectionError)\n', (1856, 1880), False, 'import p... |
from typing import Generator, Mapping, Union
from flask_babel import lazy_gettext
from app.questionnaire.location import Location
from .context import Context
from .section_summary_context import SectionSummaryContext
class SubmitQuestionnaireContext(Context):
def __call__(
self, answers_are_editable: ... | [
"app.questionnaire.location.Location",
"flask_babel.lazy_gettext"
] | [((619, 664), 'flask_babel.lazy_gettext', 'lazy_gettext', (['"""Check your answers and submit"""'], {}), "('Check your answers and submit')\n", (631, 664), False, 'from flask_babel import lazy_gettext\n'), ((746, 776), 'flask_babel.lazy_gettext', 'lazy_gettext', (['"""Submit answers"""'], {}), "('Submit answers')\n", (... |
import os
import sys
if len(sys.argv) > 1:
branch = sys.argv[1]
else:
branch = ' '
os.chdir('../')
os.system("git config --global log.date local")
os.chdir('../../')
os.system("git log -1 --format=\"%ci\" > gitTime.txt")
| [
"os.system",
"os.chdir"
] | [((98, 113), 'os.chdir', 'os.chdir', (['"""../"""'], {}), "('../')\n", (106, 113), False, 'import os\n'), ((115, 162), 'os.system', 'os.system', (['"""git config --global log.date local"""'], {}), "('git config --global log.date local')\n", (124, 162), False, 'import os\n'), ((166, 184), 'os.chdir', 'os.chdir', (['""".... |
from mock import patch
from ghtools.command.status import status, parser
class TestRepo(object):
def setup(self):
self.patcher = patch('ghtools.command.status.Repo')
self.mock_repo = self.patcher.start()
self.mock_repo.return_value.set_build_status.return_value.json.return_value = {}
... | [
"ghtools.command.status.parser.parse_args",
"mock.patch",
"ghtools.command.status.status"
] | [((144, 180), 'mock.patch', 'patch', (['"""ghtools.command.status.Repo"""'], {}), "('ghtools.command.status.Repo')\n", (149, 180), False, 'from mock import patch\n'), ((412, 580), 'ghtools.command.status.parser.parse_args', 'parser.parse_args', (["['alphagov/foobar', 'mybranch', 'pending', '--description',\n 'Runnin... |
import json, time
from datetime import datetime
class MemberList:
def __init__(self):
self.Name = ""
self.Update = ""
self.Members = ""
def MessageFormVerify(self, content):
content = content
if '#' in content and '\n' in content:
return True
return ... | [
"datetime.datetime.fromtimestamp",
"json.load",
"json.dumps",
"time.time"
] | [((620, 631), 'time.time', 'time.time', ([], {}), '()\n', (629, 631), False, 'import json, time\n'), ((764, 787), 'json.load', 'json.load', (['clanListFile'], {}), '(clanListFile)\n', (773, 787), False, 'import json, time\n'), ((1007, 1058), 'json.dumps', 'json.dumps', (['clanLists'], {'ensure_ascii': '(False)', 'inden... |
import numpy as np
from common import numerical_gradient, softmax, cross_entropy_error
from collections import OrderedDict
class Relu:
def __init__(self):
self.mask = None
def forward(self, x):
self.mask = (x <= 0)
out = x.copy()
out[self.mask] = 0
return out
def... | [
"numpy.sum",
"numpy.abs",
"numpy.argmax",
"common.numerical_gradient",
"numpy.random.randn",
"common.softmax",
"numpy.zeros",
"dataset.mnist.load_mnist",
"numpy.random.choice",
"collections.OrderedDict",
"numpy.dot",
"common.cross_entropy_error"
] | [((3510, 3556), 'dataset.mnist.load_mnist', 'load_mnist', ([], {'normalize': '(True)', 'one_hot_label': '(True)'}), '(normalize=True, one_hot_label=True)\n', (3520, 3556), False, 'from dataset.mnist import load_mnist\n'), ((4487, 4527), 'numpy.random.choice', 'np.random.choice', (['train_size', 'batch_size'], {}), '(tr... |
#!/usr/bin/env python
import numpy as np
from scipy.stats import norm
def bachelier(So, K, sigma, T, option_type):
'''
Calculate European option price using Bachelier model:
dSt = sigma * S0 * dWt
St = S0*(1 + sigma*Wt)
Parameter
---------
So: float
price of underlying... | [
"scipy.stats.norm.cdf",
"scipy.stats.norm.pdf",
"numpy.log",
"numpy.sqrt"
] | [((748, 758), 'numpy.sqrt', 'np.sqrt', (['T'], {}), '(T)\n', (755, 758), True, 'import numpy as np\n'), ((820, 844), 'numpy.sqrt', 'np.sqrt', (['(T / (2 * np.pi))'], {}), '(T / (2 * np.pi))\n', (827, 844), True, 'import numpy as np\n'), ((2341, 2355), 'numpy.log', 'np.log', (['(So / K)'], {}), '(So / K)\n', (2347, 2355... |
# -*- coding: utf-8 -*-
from unittest import TestCase
from flask import url_for
from flask_login import current_user
from flask_login import login_user
from werkzeug.exceptions import Forbidden
from werkzeug.wrappers import Response
from app import create_app
from app import db
from app.configuration import TestConf... | [
"app.userprofile.permission_required_one_of",
"app.db.drop_all",
"app.userprofile.logout_required",
"flask_login.login_user",
"app.userprofile.permission_required_all",
"app.userprofile.Permission",
"app.create_app",
"app.userprofile.User",
"flask.url_for",
"app.db.session.commit",
"app.userprof... | [((773, 802), 'app.create_app', 'create_app', (['TestConfiguration'], {}), '(TestConfiguration)\n', (783, 802), False, 'from app import create_app\n'), ((992, 1007), 'app.db.create_all', 'db.create_all', ([], {}), '()\n', (1005, 1007), False, 'from app import db\n'), ((1100, 1119), 'app.db.session.remove', 'db.session.... |
from pydlm import dlm, trend, seasonality
from scipy.stats import norm
import numpy as np
import matplotlib.pyplot as plt
# A linear trend
linear_trend = trend(degree=1, discount=1, name='linear_trend', w=10)
# A seasonality
time_series = []
for i in range(10):
if i == 0:
x_sim = np.random.normal(0,1,1)
... | [
"matplotlib.pyplot.show",
"pydlm.trend",
"numpy.random.RandomState",
"pykalman.KalmanFilter",
"numpy.percentile",
"numpy.array",
"numpy.random.normal",
"pydlm.dlm"
] | [((155, 209), 'pydlm.trend', 'trend', ([], {'degree': '(1)', 'discount': '(1)', 'name': '"""linear_trend"""', 'w': '(10)'}), "(degree=1, discount=1, name='linear_trend', w=10)\n", (160, 209), False, 'from pydlm import dlm, trend, seasonality\n'), ((441, 462), 'numpy.array', 'np.array', (['time_series'], {}), '(time_ser... |
""" Implementation of :py:class:`Dataset` object. A folder containing a set of subjects with CT and RS in dicom format
is converted into nii format. A new folder is created keeping the same organization.
"""
import os
import numpy as np
from dcmrtstruct2nii import dcmrtstruct2nii, list_rt_structs
class Dataset:
... | [
"dcmrtstruct2nii.list_rt_structs",
"dcmrtstruct2nii.dcmrtstruct2nii",
"os.path.basename",
"os.path.dirname",
"numpy.array",
"os.path.splitext",
"os.path.join",
"os.listdir",
"numpy.in1d"
] | [((1215, 1244), 'os.path.basename', 'os.path.basename', (['export_path'], {}), '(export_path)\n', (1231, 1244), False, 'import os\n'), ((1298, 1324), 'os.path.dirname', 'os.path.dirname', (['self.path'], {}), '(self.path)\n', (1313, 1324), False, 'import os\n'), ((2406, 2443), 'dcmrtstruct2nii.list_rt_structs', 'list_r... |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Print prettier and more detailed exceptions."""
import math
import os
import sys
import traceback
from telemetry.core import util
def PrintFormattedEx... | [
"os.path.abspath",
"traceback.format_exception_only",
"traceback.format_exception",
"math.ceil",
"math.floor",
"telemetry.core.util.GetChromiumSrcDir",
"traceback.extract_tb"
] | [((1288, 1346), 'traceback.format_exception', 'traceback.format_exception', (['exception_class', 'exception', 'tb'], {}), '(exception_class, exception, tb)\n', (1314, 1346), False, 'import traceback\n'), ((1371, 1395), 'traceback.extract_tb', 'traceback.extract_tb', (['tb'], {}), '(tb)\n', (1391, 1395), False, 'import ... |
# Copyright (c) 2011-2015 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
import json
from django.urls import reverse
from django.test import TestCase
from django.test.client import Client
from rest_framework import exceptions
from huxley.acc... | [
"huxley.accounts.models.User.objects.filter",
"huxley.utils.test.models.new_committee",
"huxley.utils.test.models.new_user",
"huxley.core.models.Conference.get_current",
"json.loads",
"huxley.accounts.models.User.objects.get",
"huxley.utils.test.models.new_assignment",
"huxley.utils.test.models.new_su... | [((692, 709), 'huxley.utils.test.models.new_user', 'models.new_user', ([], {}), '()\n', (707, 709), False, 'from huxley.utils.test import models\n'), ((909, 942), 'huxley.utils.test.models.new_user', 'models.new_user', ([], {'username': '"""user1"""'}), "(username='user1')\n", (924, 942), False, 'from huxley.utils.test... |
# подключаем модуль случайных чисел
import random
# подключаем модуль для графиков
import plotly.graph_objs as go
# сколько денег будет на старте для каждой стратегии
startmoney = 1000000
# коэффициент ставки
c1 = 0.001
# количество побед и проигрышей
win = 0
loose = 0
# количество игр, сыгранный по первой стратег... | [
"plotly.graph_objs.Scatter",
"plotly.graph_objs.Figure",
"random.randint"
] | [((5110, 5121), 'plotly.graph_objs.Figure', 'go.Figure', ([], {}), '()\n', (5119, 5121), True, 'import plotly.graph_objs as go\n'), ((1214, 1235), 'random.randint', 'random.randint', (['(1)', '(37)'], {}), '(1, 37)\n', (1228, 1235), False, 'import random\n'), ((2822, 2843), 'random.randint', 'random.randint', (['(1)', ... |
"""Unit tests for posts app urls
"""
import pytest
from django.contrib.auth import get_user_model
from django.urls import resolve, reverse
from model_bakery import baker
from mutadi.private_messages.models import PrivateMessage
pytestmark = pytest.mark.django_db
User = get_user_model()
class TestPrivateMessageUrls:... | [
"django.contrib.auth.get_user_model",
"model_bakery.baker.make",
"django.urls.reverse",
"django.urls.resolve",
"model_bakery.baker.seq"
] | [((272, 288), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (286, 288), False, 'from django.contrib.auth import get_user_model\n'), ((728, 902), 'model_bakery.baker.make', 'baker.make', (['PrivateMessage'], {'sender': 'proto_user[0]', 'recipient': 'proto_user[1]', 'content': '"""Proident nis... |
"""
Time to make the super-fertilizer from our ingredients.
"""
from random import random
from evennia.utils import interactive
from ..state import BaseState
from .. import objects
GREETING = """
This is the situation, {name}:
The |rJester|n wants to win your village's yearly |wpie-eating contest|n.
As... | [
"random.random"
] | [((4165, 4173), 'random.random', 'random', ([], {}), '()\n', (4171, 4173), False, 'from random import random\n')] |
#!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
from geocoder.location import Location
from geocoder.here import HereResult, HereQuery
class HereReverseResult(HereResult):
@property
def ok(self):
return bool(self.address)
class HereReverse(HereQuery):
"""
HERE Geoc... | [
"geocoder.location.Location"
] | [((1016, 1034), 'geocoder.location.Location', 'Location', (['location'], {}), '(location)\n', (1024, 1034), False, 'from geocoder.location import Location\n')] |
import json
import logging
import os
import shutil
import subprocess
from urllib.parse import parse_qsl, urlsplit
import requests
def es_search(index, clip_id):
"""Queries the elasticsearch for video metadata"""
search_url = 'http://search.granicus.com/api/%s/_search' % index
query = {'query': {'match': ... | [
"subprocess.Popen",
"json.loads",
"os.path.exists",
"shutil.which",
"json.dumps",
"urllib.parse.urlsplit",
"requests.post"
] | [((378, 395), 'json.dumps', 'json.dumps', (['query'], {}), '(query)\n', (388, 395), False, 'import json\n'), ((409, 446), 'requests.post', 'requests.post', (['search_url'], {'data': 'query'}), '(search_url, data=query)\n', (422, 446), False, 'import requests\n'), ((460, 486), 'json.loads', 'json.loads', (['result.conte... |
#!/usr/bin/env python
# Python Network Programming Cookbook -- Chapter - 4
# This program requires Python 3.5.2 or any later version
# It may run on any other version with/without modifications.
#
# Follow the comments inline to make it run on Python 2.7.x.
import argparse
import urllib.request
# Comment out the abov... | [
"argparse.ArgumentParser"
] | [((833, 891), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""HTTP Client Example"""'}), "(description='HTTP Client Example')\n", (856, 891), False, 'import argparse\n')] |
import json
import requests
import dash
import dash_table
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import dash_leaflet as dl
import pandas as pd
from pyproj import Transformer
import plotly.graph_objects as go
from dash.dependencies import Output, In... | [
"dash.Dash",
"dash_html_components.Br",
"index.create_layout",
"dash.dependencies.Input",
"pyproj.Transformer.from_crs",
"dash.dependencies.Output"
] | [((2594, 2857), 'dash.Dash', 'dash.Dash', (['__name__'], {'url_base_pathname': '"""/grid2latlon/"""', 'meta_tags': "[{'name': 'viewport', 'content': 'width=device-width, initial-scale=1'}]", 'external_stylesheets': '[dbc.themes.BOOTSTRAP]', 'prevent_initial_callbacks': '(True)', 'suppress_callback_exceptions': '(True)'... |
import numpy as numpy
a = numpy.array([5,2,6,2,7,5,6,8,2,9])
print ('First array:')
print(a)
print('\n')
print('Unique values of first array:')
u = numpy.unique(a)
print(u)
print('\n')
print('Unique array and indices array:')
u, indices = numpy.unique(a, return_index = True)
print (indices)
print('\n')
print('We ca... | [
"numpy.array",
"numpy.unique"
] | [((26, 69), 'numpy.array', 'numpy.array', (['[5, 2, 6, 2, 7, 5, 6, 8, 2, 9]'], {}), '([5, 2, 6, 2, 7, 5, 6, 8, 2, 9])\n', (37, 69), True, 'import numpy as numpy\n'), ((150, 165), 'numpy.unique', 'numpy.unique', (['a'], {}), '(a)\n', (162, 165), True, 'import numpy as numpy\n'), ((242, 276), 'numpy.unique', 'numpy.uniqu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import traceback
import logging
class MyErr(Exception):
pass
def division(s):
n = int(s)
if n == 0:
raise MyErr('Divisor cannot be %s' % s)
return 10 / n
def func(x):
try:
division(x)
except MyErr as me:
print(me)
... | [
"logging.exception",
"traceback.print_exc"
] | [((323, 344), 'traceback.print_exc', 'traceback.print_exc', ([], {}), '()\n', (342, 344), False, 'import traceback\n'), ((537, 558), 'logging.exception', 'logging.exception', (['me'], {}), '(me)\n', (554, 558), False, 'import logging\n')] |
import keras
from kfp import components
chicago_taxi_dataset_op = components.load_component_from_url('https://raw.githubusercontent.com/kubeflow/pipelines/e3337b8bdcd63636934954e592d4b32c95b49129/components/datasets/Chicago%20Taxi/component.yaml')
pandas_transform_csv_op = components.load_component_from_url('https://... | [
"keras.layers.Dense",
"kfp.components.load_component_from_url"
] | [((68, 259), 'kfp.components.load_component_from_url', 'components.load_component_from_url', (['"""https://raw.githubusercontent.com/kubeflow/pipelines/e3337b8bdcd63636934954e592d4b32c95b49129/components/datasets/Chicago%20Taxi/component.yaml"""'], {}), "(\n 'https://raw.githubusercontent.com/kubeflow/pipelines/e333... |
# -*- coding: utf-8 -*-
"""Add PED file content to VCF file header.
Usage::
$ snappy-ped_to_vcf_header --ped-file PED --output TXT
"""
from __future__ import print_function
import argparse
from collections import OrderedDict, defaultdict, namedtuple
import os
import re
import sys
__author__ = "<NAME> <<EMAIL>>... | [
"argparse.ArgumentParser",
"os.path.dirname",
"collections.defaultdict",
"collections.namedtuple",
"collections.OrderedDict",
"argparse.FileType"
] | [((1022, 1097), 'collections.namedtuple', 'namedtuple', (['"""Donor"""', "['family', 'id', 'father', 'mother', 'sex', 'disease']"], {}), "('Donor', ['family', 'id', 'father', 'mother', 'sex', 'disease'])\n", (1032, 1097), False, 'from collections import OrderedDict, defaultdict, namedtuple\n'), ((1561, 1578), 'collecti... |
from pkgutil import iter_modules
EXTENSIONS = frozenset(
extension.name for extension in iter_modules(("xythrion/extensions",), "xythrion.extensions.")
)
| [
"pkgutil.iter_modules"
] | [((94, 156), 'pkgutil.iter_modules', 'iter_modules', (["('xythrion/extensions',)", '"""xythrion.extensions."""'], {}), "(('xythrion/extensions',), 'xythrion.extensions.')\n", (106, 156), False, 'from pkgutil import iter_modules\n')] |
#!/usr/bin/env python3
'''
Query the VDB
'''
import argparse
import logging
import sys
import pprint
import pandas as pd
import orjson as json
from biograph.internal import vdb
def parse_args(clargs):
''' biograph vdb query args '''
parser = argparse.ArgumentParser(
description='Query the Spiral Varia... | [
"logging.debug",
"argparse.ArgumentParser",
"logging.basicConfig",
"pandas.isna",
"logging.warning",
"orjson.loads",
"pprint.PrettyPrinter",
"biograph.internal.vdb.connect"
] | [((252, 330), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Query the Spiral Variant DataBase (VDB)"""'}), "(description='Query the Spiral Variant DataBase (VDB)')\n", (275, 330), False, 'import argparse\n'), ((4506, 4536), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent':... |
import logging
import environ
from .base import * # noqa
_env = environ.Env()
logging.disable(logging.DEBUG)
#
# invariants
#
DEBUG = False
CSRF_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True
#
# pulled from environment
#
SECRET_KEY = _env('SECRET_KEY')
ALLOWED_HOSTS = ('.herokuapp.com')
_additional_hos... | [
"logging.disable",
"environ.Env"
] | [((69, 82), 'environ.Env', 'environ.Env', ([], {}), '()\n', (80, 82), False, 'import environ\n'), ((84, 114), 'logging.disable', 'logging.disable', (['logging.DEBUG'], {}), '(logging.DEBUG)\n', (99, 114), False, 'import logging\n')] |
import logging
from plumbum import CommandNotFound, local
from changes import shell
log = logging.getLogger(__name__)
def get_test_runner():
test_runners = ['tox', 'nosetests', 'py.test']
test_runner = None
for runner in test_runners:
try:
test_runner = local[runner]
except ... | [
"changes.shell.dry_run",
"logging.getLogger"
] | [((93, 120), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (110, 120), False, 'import logging\n'), ((745, 797), 'changes.shell.dry_run', 'shell.dry_run', (['context.test_command', 'context.dry_run'], {}), '(context.test_command, context.dry_run)\n', (758, 797), False, 'from changes impor... |
import sqlite3
from sqlite3 import Error
def create_connection():
""" create a database connection to the SQLite database
specified by the db_file
:return: Connection object or None
"""
try:
conn = sqlite3.connect(":memory:")
return conn
except Error as e:
print(e)
... | [
"sqlite3.connect"
] | [((232, 259), 'sqlite3.connect', 'sqlite3.connect', (['""":memory:"""'], {}), "(':memory:')\n", (247, 259), False, 'import sqlite3\n')] |
#!/usr/bin/env python
#coding:utf-8
"""
Author: --<v1ll4n>
Purpose: Provide some useful thread utils
Created: 2016/10/29
"""
import uuid
import time
import unittest
try:
from queue import Queue, Empty
except:
from Queue import Queue, Empty
import threading
from threading import Thread
im... | [
"unittest.main",
"threading.Thread",
"Queue.Queue",
"time.sleep",
"threading.Lock",
"traceback.extract_stack",
"uuid.uuid1",
"inspect.getmembers"
] | [((493, 538), 'threading.Thread', 'Thread', ([], {'target': 'func', 'args': 'args', 'kwargs': 'kwargs'}), '(target=func, args=args, kwargs=kwargs)\n', (499, 538), False, 'from threading import Thread\n'), ((6315, 6330), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6328, 6330), False, 'import unittest\n'), ((966... |
# Generated by Django 2.2.2 on 2019-07-25 08:57
from django.db import migrations, models
import gnosis.eth.django.models
class Migration(migrations.Migration):
dependencies = [
('history', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='multisigconfirmati... | [
"django.db.models.DateTimeField"
] | [((578, 609), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'null': '(True)'}), '(null=True)\n', (598, 609), False, 'from django.db import migrations, models\n')] |
import logging
__author__ = 'e.kolpakov'
class Curriculum:
def __init__(self):
self._competency_index = {}
self._fact_index = {}
self._lesson_index = {}
def register_competency(self, competency):
"""
Registers competency with curriculum.
:param competency: Com... | [
"logging.getLogger"
] | [((2374, 2401), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2391, 2401), False, 'import logging\n')] |
"""
<NAME>
7-19-2019
Version 1.0
https://github.com/tasanuma714/Raspberry-Pi-Security-Camera-using-Google-Coral-USB-Accelerator
***Big Credit to Adrian at PyImageSearch for the base code of this file.
https://www.pyimagesearch.com/2019/04/22/getting-started-with-google-corals-tpu-usb-accelerator/
https://w... | [
"imutils.video.VideoStream",
"cv2.putText",
"argparse.ArgumentParser",
"cv2.cvtColor",
"edgetpu.detection.engine.DetectionEngine",
"pushetta.Pushetta",
"cv2.waitKey",
"cv2.imshow",
"time.strftime",
"time.ctime",
"time.sleep",
"time.time",
"PIL.Image.fromarray",
"subprocess.call",
"cv2.re... | [((1340, 1351), 'time.time', 'time.time', ([], {}), '()\n', (1349, 1351), False, 'import time\n'), ((1417, 1442), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1440, 1442), False, 'import argparse\n'), ((2183, 2213), 'edgetpu.detection.engine.DetectionEngine', 'DetectionEngine', (["args['mode... |
import os
import numpy
import pandas
from skimage import io
def read_ids_from_csv(csv_file):
""" Reads a column named 'ID' from csv_file. This function was
created to make sure basic I/O works in unit testing.
"""
csv = pandas.read_csv(csv_file)
return csv.ID
def read_hpa_image(image_id, roo... | [
"pandas.read_csv",
"os.path.join",
"skimage.io.imread",
"numpy.dstack"
] | [((242, 267), 'pandas.read_csv', 'pandas.read_csv', (['csv_file'], {}), '(csv_file)\n', (257, 267), False, 'import pandas\n'), ((480, 512), 'os.path.join', 'os.path.join', (['root_dir', 'image_id'], {}), '(root_dir, image_id)\n', (492, 512), False, 'import os\n'), ((681, 700), 'numpy.dstack', 'numpy.dstack', (['image']... |
import pandas as pd
cities_df = pd.read_csv("Resources/cities.csv")
cities_df.to_html('Resources/cities.html', index=False) | [
"pandas.read_csv"
] | [((32, 67), 'pandas.read_csv', 'pd.read_csv', (['"""Resources/cities.csv"""'], {}), "('Resources/cities.csv')\n", (43, 67), True, 'import pandas as pd\n')] |
# python3
# pylint: disable=g-bad-file-header
# Copyright 2021 DeepMind Technologies Limited. 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... | [
"jax.vmap",
"jax.numpy.log",
"jax.numpy.exp",
"jax.numpy.mean",
"jax.numpy.square",
"jax.random.split",
"jax.random.normal",
"absl.logging.warning",
"haiku.PRNGSequence",
"jax.numpy.ones",
"jax.nn.softmax",
"enn.utils.make_batch_indexer",
"enn.utils.parse_net_output"
] | [((2349, 2361), 'jax.numpy.log', 'jnp.log', (['var'], {}), '(var)\n', (2356, 2361), True, 'import jax.numpy as jnp\n'), ((2375, 2396), 'jax.numpy.exp', 'jnp.exp', (['pred_log_var'], {}), '(pred_log_var)\n', (2382, 2396), True, 'import jax.numpy as jnp\n'), ((2737, 2792), 'enn.utils.make_batch_indexer', 'utils.make_batc... |
import os
from base64 import b64decode
from flask import render_template, request
from io import BytesIO
from json import dumps as to_json_string
from traceback import format_exc
from flask_wtf.csrf import CSRFError
from sqlalchemy.exc import SQLAlchemyError
from werkzeug.exceptions import HTTPException
from applicat... | [
"csv.reader",
"flask.request.args.get",
"os.walk",
"base64.b64decode",
"json.dumps",
"flask.request.environ.get",
"traceback.format_exc",
"flask.render_template"
] | [((3995, 4128), 'flask.render_template', 'render_template', (['"""play_template.html"""'], {'puzzle': 'puzzle.puzzle_json', 'display_hash': 'display_hash', 'title': 'puzzle.title', 'image': 'puzzle.url'}), "('play_template.html', puzzle=puzzle.puzzle_json,\n display_hash=display_hash, title=puzzle.title, image=puzzl... |
# test sfr renumbering schemes and other random utilities
import gsflow
import os
from gsflow.utils import SfrRenumber
ws = os.path.abspath(os.path.dirname(__file__))
def test_sfr_renumber():
# simple test to ensure no crashes in the renumbering schemes
# expand this later to test LAK, AG, and GA... | [
"os.path.dirname",
"os.path.join",
"gsflow.utils.SfrRenumber"
] | [((148, 173), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (163, 173), False, 'import os\n'), ((339, 402), 'os.path.join', 'os.path.join', (['ws', '""".."""', '"""examples"""', '"""data"""', '"""sagehen"""', '"""gsflow"""'], {}), "(ws, '..', 'examples', 'data', 'sagehen', 'gsflow')\n", (351... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('salts', '0029_shooting_ticket_id'),
]
operations = [
migrations.RenameField('TestResult', 'test_id', 'session_id'),
... | [
"django.db.migrations.RenameField"
] | [((249, 310), 'django.db.migrations.RenameField', 'migrations.RenameField', (['"""TestResult"""', '"""test_id"""', '"""session_id"""'], {}), "('TestResult', 'test_id', 'session_id')\n", (271, 310), False, 'from django.db import migrations, models\n'), ((320, 379), 'django.db.migrations.RenameField', 'migrations.RenameF... |
import pika
connection = pika.BlockingConnection(
pika.ConnectionParameters(host='localhost'))
ch = connection.channel()
ch.exchange_declare(exchange='logs', exchange_type='fanout')
ch.basic_publish(exchange='logs', routing_key='', body='this is testing fanout')
print('message sent')
connection.close()
| [
"pika.ConnectionParameters"
] | [((55, 98), 'pika.ConnectionParameters', 'pika.ConnectionParameters', ([], {'host': '"""localhost"""'}), "(host='localhost')\n", (80, 98), False, 'import pika\n')] |
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase, RequestFactory, Client
from django.contrib.auth import get_user_model
from django.urls.base import reverse
from django.conf import settings
from .models import Token
from .views import user_auth
UserModel = get_user_model()
class... | [
"django.contrib.auth.models.AnonymousUser",
"django.test.RequestFactory",
"django.test.Client",
"django.contrib.auth.get_user_model",
"django.urls.base.reverse"
] | [((296, 312), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (310, 312), False, 'from django.contrib.auth import get_user_model\n'), ((395, 403), 'django.test.Client', 'Client', ([], {}), '()\n', (401, 403), False, 'from django.test import TestCase, RequestFactory, Client\n'), ((427, 443), 'd... |
from matplotlib import pyplot as plt
import pickle
import numpy as np
import os,sys
'''
results = []
for i in range(10):
with open(f'/home/yiran/pc_mapping/arena-v2/examples/bc_saved_models/refactor_success_max_mine/run{i}/test_result.npy', 'rb') as f:
result_i = pickle.load(f)
result_number = [v for (k... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.legend",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((556, 575), 'numpy.arange', 'np.arange', (['(1)', '(21)', '(2)'], {}), '(1, 21, 2)\n', (565, 575), True, 'import numpy as np\n'), ((1806, 1835), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""number of coins"""'], {}), "('number of coins')\n", (1816, 1835), True, 'from matplotlib import pyplot as plt\n'), ((1836, 18... |
#!/usr/bin/python
"""
This is the main python file to run.
"""
import sys
from application import Application
# -- Functions ---------------------------------------------------------------
def main():
"""
The main function.
"""
app = Application(sys.argv)
app.run()
# -- Main ent... | [
"application.Application"
] | [((267, 288), 'application.Application', 'Application', (['sys.argv'], {}), '(sys.argv)\n', (278, 288), False, 'from application import Application\n')] |
import subprocess
import ftplib
import os
import time
from hide_data import *
from datetime import datetime
# Creazione delle cartelle nominate per giorno, mese, anno, ora, minuti, secondi
def create_path_folder(init_path):
day = time.strftime("%d", time.localtime())
month = time.strftime("%m", time.... | [
"subprocess.Popen",
"time.sleep",
"datetime.datetime.strptime",
"ftplib.FTP",
"os.rmdir",
"os.path.join",
"os.chdir",
"time.localtime"
] | [((1913, 1927), 'ftplib.FTP', 'ftplib.FTP', (['ip'], {}), '(ip)\n', (1923, 1927), False, 'import ftplib\n'), ((264, 280), 'time.localtime', 'time.localtime', ([], {}), '()\n', (278, 280), False, 'import time\n'), ((315, 331), 'time.localtime', 'time.localtime', ([], {}), '()\n', (329, 331), False, 'import time\n'), ((3... |
import numpy as np
import pandas as pd
def complexity_hjorth(signal):
"""Hjorth's Complexity and Parameters
Hjorth Parameters are indicators of statistical properties used in signal processing in the
time domain introduced by Hjorth (1970). The parameters are activity, mobility, and complexity.
Neuro... | [
"numpy.diff",
"numpy.var",
"numpy.sqrt"
] | [((2112, 2127), 'numpy.diff', 'np.diff', (['signal'], {}), '(signal)\n', (2119, 2127), True, 'import numpy as np\n'), ((2138, 2149), 'numpy.diff', 'np.diff', (['dx'], {}), '(dx)\n', (2145, 2149), True, 'import numpy as np\n'), ((2208, 2222), 'numpy.var', 'np.var', (['signal'], {}), '(signal)\n', (2214, 2222), True, 'im... |
# ERFNet full model definition for Pytorch
# Sept 2017
# <NAME>
#######################
import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
class DownsamplerBlock(nn.Module):
def __init__(self, ninput, noutput):
super().__init__()
self.c... | [
"torch.nn.Dropout2d",
"torch.nn.Conv2d",
"torch.cat",
"torch.nn.BatchNorm2d",
"torch.nn.functional.relu",
"torch.nn.MaxPool2d",
"torch.nn.functional.interpolate",
"torch.nn.MaxUnpool2d"
] | [((326, 401), 'torch.nn.Conv2d', 'nn.Conv2d', (['ninput', '(noutput - ninput)', '(3, 3)'], {'stride': '(2)', 'padding': '(1)', 'bias': '(True)'}), '(ninput, noutput - ninput, (3, 3), stride=2, padding=1, bias=True)\n', (335, 401), True, 'import torch.nn as nn\n'), ((424, 481), 'torch.nn.Conv2d', 'nn.Conv2d', (['(16)', ... |
import numpy as np
import warnings
def remove_base(seq, base, tolerance=1e-4):
"""
Functionality: Remove x from (x \sqcup z)
Since there might be some float errors, I allow for a mismatch of the time_stamps between
two seqs no larger than a threshold.
The threshold value: tolerance * max_time_stam... | [
"numpy.abs",
"numpy.empty",
"numpy.where",
"pprint.pprint",
"warnings.warn"
] | [((611, 650), 'numpy.empty', 'np.empty', ([], {'shape': '[n_seq]', 'dtype': 'np.int64'}), '(shape=[n_seq], dtype=np.int64)\n', (619, 650), True, 'import numpy as np\n'), ((673, 714), 'numpy.empty', 'np.empty', ([], {'shape': '[n_seq]', 'dtype': 'np.float32'}), '(shape=[n_seq], dtype=np.float32)\n', (681, 714), True, 'i... |
"""
ASGI config for stockze project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/asgi/
"""
import os
import sys
from pathlib import Path
from django.core.asgi import get_asgi_application
... | [
"os.environ.setdefault",
"django.core.asgi.get_asgi_application",
"socketio.AsyncRedisManager",
"engineio.ASGIApp",
"config.websocket.websocket_application",
"pathlib.Path"
] | [((574, 646), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""config.settings.local"""'], {}), "('DJANGO_SETTINGS_MODULE', 'config.settings.local')\n", (595, 646), False, 'import os\n'), ((751, 773), 'django.core.asgi.get_asgi_application', 'get_asgi_application', ([], {}), '()\n... |
import pyarrow as pa
import rstr
import random
# Each tuple specifies a type of string to generate. The first entry specifies
# how many unique strings to generate (rstr is pretty slow). The second
# specifies how often to insert a string from that pool of unique strings into
# the actual dataset compared to inserting... | [
"rstr.xeger",
"pyarrow.schema",
"pyarrow.RecordBatch.from_arrays",
"random.choice",
"pyarrow.utf8",
"random.random",
"pyarrow.RecordBatchFileWriter"
] | [((2097, 2115), 'pyarrow.schema', 'pa.schema', (['[field]'], {}), '([field])\n', (2106, 2115), True, 'import pyarrow as pa\n'), ((1545, 1560), 'random.random', 'random.random', ([], {}), '()\n', (1558, 1560), False, 'import random\n'), ((2061, 2070), 'pyarrow.utf8', 'pa.utf8', ([], {}), '()\n', (2068, 2070), True, 'imp... |
from setuptools import setup, find_packages
setup(
name = "disney",
version = "1.0",
description = "A history of Shanghai Disney waiting time",
long_description = "A history of Shanghai Disney waiting time",
license = "Apache License",
url = "http://s.gaott.info",
author = "gtt116",
au... | [
"setuptools.find_packages"
] | [((359, 374), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (372, 374), False, 'from setuptools import setup, find_packages\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 31 16:55:35 2019
From CS230 Code Examples
@author: qwang
"""
import os
import logging
import shutil
import torch
import json
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#%%
def save_dict_to_json(d... | [
"torch.ones_like",
"pandas.DataFrame",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.title",
"json.dump",
"os.mkdir",
"torch.zeros_like",
"matplotlib.pyplot.plot",
"json.load",
"torch.eq",
"torch.load",
"matplotlib.pyplot.legend",
"os.path.dirname",
"os.path.exists",
"torch.cuda.device... | [((1118, 1156), 'os.path.join', 'os.path.join', (['checkdir', '"""last.pth.tar"""'], {}), "(checkdir, 'last.pth.tar')\n", (1130, 1156), False, 'import os\n'), ((1230, 1257), 'torch.save', 'torch.save', (['state', 'filepath'], {}), '(state, filepath)\n', (1240, 1257), False, 'import torch\n'), ((1958, 1979), 'torch.load... |
#!/usr/bin/python3
# -*- coding:utf-8 -*-
import os
import sys
import signal
import time
from datetime import datetime
from datetime import timedelta
# import cv2 as cv
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt # 导入模块 matplotlib.pyplot,并简写成 plt
import numpy as np # 导入... | [
"pandas.read_csv",
"os.path.exists"
] | [((1086, 1120), 'os.path.exists', 'os.path.exists', (['"""./statistics.csv"""'], {}), "('./statistics.csv')\n", (1100, 1120), False, 'import os\n'), ((1137, 1181), 'pandas.read_csv', 'pd.read_csv', (['"""./statistics.csv"""'], {'header': 'None'}), "('./statistics.csv', header=None)\n", (1148, 1181), True, 'import panda... |
"""Utility functions."""
import os
def exec_os_cmd(command):
return os.popen(command).read()
| [
"os.popen"
] | [((74, 91), 'os.popen', 'os.popen', (['command'], {}), '(command)\n', (82, 91), False, 'import os\n')] |
# ======================================================================
# Science for Hungry People
# Advent of Code 2015 Day 15 -- <NAME> -- https://adventofcode.com
#
# Python implementation by Dr. <NAME> III
# ======================================================================
# ==============================... | [
"re.compile"
] | [((1083, 1221), 're.compile', 're.compile', (["('([A-Za-z]+): capacity (-?[0-9]+), durability (-?[0-9]+),' +\n ' flavor (-?[0-9]+), texture (-?[0-9]+), calories (-?[0-9]+)')"], {}), "('([A-Za-z]+): capacity (-?[0-9]+), durability (-?[0-9]+),' +\n ' flavor (-?[0-9]+), texture (-?[0-9]+), calories (-?[0-9]+)')\n", ... |
from torch import Tensor, Generator
from typing import TypeVar, List, Optional, Tuple, Sequence
from torch import default_generator
from torch.utils.data import Dataset, Subset
T_co = TypeVar('T_co', covariant=True)
T = TypeVar('T')
from torch._utils import _accumulate
from torch import randperm
import torch
class Subs... | [
"torch.utils.data.Subset",
"typing.TypeVar",
"torch._utils._accumulate"
] | [((184, 215), 'typing.TypeVar', 'TypeVar', (['"""T_co"""'], {'covariant': '(True)'}), "('T_co', covariant=True)\n", (191, 215), False, 'from typing import TypeVar, List, Optional, Tuple, Sequence\n'), ((220, 232), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (227, 232), False, 'from typing import TypeVar,... |
from graphviz import Digraph
from octopus.api.edge import (EDGE_UNCONDITIONAL,
EDGE_CONDITIONAL_TRUE, EDGE_CONDITIONAL_FALSE,
EDGE_FALLTHROUGH, EDGE_CALL)
import logging
log = logging.getLogger(__name__)
log.setLevel(level=logging.DEBUG)
def insert_edges_t... | [
"graphviz.Digraph",
"logging.getLogger"
] | [((238, 265), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (255, 265), False, 'import logging\n'), ((1761, 1807), 'graphviz.Digraph', 'Digraph', (['self.filename'], {'filename': 'self.filename'}), '(self.filename, filename=self.filename)\n', (1768, 1807), False, 'from graphviz import Di... |
""" Module for Brokers
Brokers hold data, and provide it or subsets of it on request
when requesting price for buying and selling, prices will likely differ
"""
import copy
import pandas as pd
from pandas.tseries.offsets import DateOffset
class PaperBroker:
def __init__(self,
data_df,
... | [
"copy.deepcopy",
"pandas.tseries.offsets.DateOffset"
] | [((343, 364), 'pandas.tseries.offsets.DateOffset', 'DateOffset', ([], {'seconds': '(0)'}), '(seconds=0)\n', (353, 364), False, 'from pandas.tseries.offsets import DateOffset\n'), ((2111, 2130), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (2124, 2130), False, 'import copy\n'), ((3056, 3109), 'copy.deep... |
import cv2
# cap = cv2.VideoCapture(0)
cap = cv2.VideoCapture('../datasets/opencv/fish.mp4')
while True:
_ret, frame = cap.read()
frame = cv2.resize(frame, (500,400))
cv2.imshow('opencv camera', frame)
k = cv2.waitKey(1) #1msec 대기
if k==27 or k==13 : break
cap.release()
cv2.destroyAllWindows()
imp... | [
"cv2.waitKey",
"cv2.cvtColor",
"cv2.imshow",
"numpy.zeros",
"cv2.VideoCapture",
"cv2.destroyAllWindows",
"cv2.resize"
] | [((45, 92), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""../datasets/opencv/fish.mp4"""'], {}), "('../datasets/opencv/fish.mp4')\n", (61, 92), False, 'import cv2\n'), ((292, 315), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (313, 315), False, 'import cv2\n'), ((775, 798), 'cv2.destroyAllWindows... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import logging
import sys
def setup_logging():
logger = get_main_logger()
add_console_handler(logger, level=logging.DEBUG)
mute_matplotlib_handler()
return logger
def get_main_logger(level=logging.DEBUG):
# get a top-level "mypackage" logge... | [
"os.path.abspath",
"logging.FileHandler",
"logging.StreamHandler",
"logging.Formatter",
"logging.getLogger"
] | [((436, 461), 'logging.getLogger', 'logging.getLogger', (['"""main"""'], {}), "('main')\n", (453, 461), False, 'import logging\n'), ((778, 807), 'logging.Formatter', 'logging.Formatter', (['simple_fmt'], {}), '(simple_fmt)\n', (795, 807), False, 'import logging\n'), ((917, 950), 'logging.StreamHandler', 'logging.Stream... |
# -*- coding: utf-8 -*-
import requests
from config import config
class LineNotify(object):
"""NotifyClass for LINE"""
NOTIFY_API_URL = "https://notify-api.line.me/api/notify"
def __init__(self, api_url = NOTIFY_API_URL, authority = config.AUTHORITY_TOKEN):
self.apiUrl = api_url
self... | [
"requests.post"
] | [((643, 715), 'requests.post', 'requests.post', (['self.apiUrl'], {'headers': 'self.headers', 'data': 'payload', 'files': '""""""'}), "(self.apiUrl, headers=self.headers, data=payload, files='')\n", (656, 715), False, 'import requests\n')] |
import requests, json
"""登录测试 POST /v1_0/authorizations"""
url = 'http://127.0.0.1:5000/v1_0/authorizations'
REDIS_SENTINELS = [('127.0.0.1', '26380'),
('127.0.0.1', '26381'),
('127.0.0.1', '26382'),]
REDIS_SENTINEL_SERVICE_NAME = 'mymaster'
from redis.sentinel import Sentinel
_se... | [
"requests.get",
"requests.post",
"redis.sentinel.Sentinel",
"json.dumps"
] | [((329, 354), 'redis.sentinel.Sentinel', 'Sentinel', (['REDIS_SENTINELS'], {}), '(REDIS_SENTINELS)\n', (337, 354), False, 'from redis.sentinel import Sentinel\n'), ((510, 565), 'json.dumps', 'json.dumps', (["{'mobile': '13161933309', 'code': '123456'}"], {}), "({'mobile': '13161933309', 'code': '123456'})\n", (520, 565... |
""" Cisco_IOS_XE_poe_oper
This module contains a collection of YANG definitions for
monitoring power over ethernet feature in a Network Element.
Copyright (c) 2016\-2018 by Cisco Systems, Inc.
All rights reserved.
"""
from collections import OrderedDict
from ydk.types import Entity, EntityPath, Identity, Enum, YTyp... | [
"collections.OrderedDict",
"ydk.types.Enum.YLeaf",
"ydk.types.YLeaf",
"ydk.types.YList"
] | [((1251, 1276), 'ydk.types.Enum.YLeaf', 'Enum.YLeaf', (['(0)', '"""poe-null"""'], {}), "(0, 'poe-null')\n", (1261, 1276), False, 'from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64\n'), ((1296, 1324), 'ydk.types.Enum.YLeaf', 'Enum.YLeaf', (['(1... |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 13 19:00:40 2016
@author: sebalander
"""
from numpy import zeros, sqrt, array, tan, arctan, prod, cos
from cv2 import Rodrigues
from lmfit import minimize, Parameters
#from calibration import calibrator
#xypToZplane = calibrator.xypToZplane
#
## %% ========== ========== ... | [
"numpy.arctan",
"numpy.tan",
"numpy.cos"
] | [((1758, 1768), 'numpy.arctan', 'arctan', (['rh'], {}), '(rh)\n', (1764, 1768), False, 'from numpy import zeros, sqrt, array, tan, arctan, prod, cos\n'), ((1781, 1792), 'numpy.tan', 'tan', (['(th / 2)'], {}), '(th / 2)\n', (1784, 1792), False, 'from numpy import zeros, sqrt, array, tan, arctan, prod, cos\n'), ((4240, 4... |
from sspipe import p, px, unpipe
def test_unpipe_active():
a_pipe = px + 1 | px * 5
func = unpipe(a_pipe)
assert func(0) == 5
def test_unpipe_passive():
func = lambda x: (x + 1) * 5
func = unpipe(func)
assert func(0) == 5
| [
"sspipe.unpipe"
] | [((100, 114), 'sspipe.unpipe', 'unpipe', (['a_pipe'], {}), '(a_pipe)\n', (106, 114), False, 'from sspipe import p, px, unpipe\n'), ((211, 223), 'sspipe.unpipe', 'unpipe', (['func'], {}), '(func)\n', (217, 223), False, 'from sspipe import p, px, unpipe\n')] |
# -*- coding: utf-8 -*-
# Copyright 2012 codestation
#
# 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 app... | [
"os.path.abspath",
"os.path.join",
"os.path.exists",
"re.sub"
] | [((2600, 2620), 'os.path.join', 'join', (['path', 'filename'], {}), '(path, filename)\n', (2604, 2620), False, 'from os.path import exists, join, dirname, abspath\n'), ((2633, 2650), 'os.path.exists', 'exists', (['full_path'], {}), '(full_path)\n', (2639, 2650), False, 'from os.path import exists, join, dirname, abspat... |
# -*-coding:utf-8 -*-
"""
Created on 2015-05-21
@author: Danny<<EMAIL>>
DannyWork Project
"""
from __future__ import unicode_literals
from django.contrib.sitemaps import Sitemap
from django.core.urlresolvers import reverse
from .models import Blog
class BlogSitemap(Sitemap):
"""
博客 Sitemap
"""
ch... | [
"django.core.urlresolvers.reverse"
] | [((571, 608), 'django.core.urlresolvers.reverse', 'reverse', (['"""blog_detail"""'], {'args': '[obj.id]'}), "('blog_detail', args=[obj.id])\n", (578, 608), False, 'from django.core.urlresolvers import reverse\n')] |
"""
plot.py defines functions for plotting phase diagrams of complex
coacervate liquid separation.
"""
# standard libraries
import matplotlib.pyplot as plt
from matplotlib import cm # colormap
import numpy as np
import pandas as pd
# custom libraries
import pe
import salt as nacl
# plotting libraries
import plotly.... | [
"bokeh.models.ColumnDataSource",
"pe.get_beads_2_M",
"numpy.abs",
"numpy.argmax",
"salt.extract_df_mu_data",
"numpy.argmin",
"matplotlib.pyplot.figure",
"salt.fixed_conc",
"numpy.unique",
"pandas.DataFrame",
"numpy.copy",
"salt.binodal_vary_f_data",
"pe.lB_2_T",
"numpy.max",
"bokeh.plott... | [((5262, 5274), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (5272, 5274), True, 'import matplotlib.pyplot as plt\n'), ((9297, 9315), 'numpy.copy', 'np.copy', (['left_list'], {}), '(left_list)\n', (9304, 9315), True, 'import numpy as np\n'), ((9332, 9351), 'numpy.copy', 'np.copy', (['right_list'], {}), '... |
from django.db import models
class ConceptClass(models.Model):
concept_class_id = models.CharField(
primary_key=True, max_length=20
)
concept_class_name = models.CharField(
max_length=255
)
concept_class_concept_id = models.IntegerField(
)
class Me... | [
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((90, 139), 'django.db.models.CharField', 'models.CharField', ([], {'primary_key': '(True)', 'max_length': '(20)'}), '(primary_key=True, max_length=20)\n', (106, 139), False, 'from django.db import models\n'), ((188, 220), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=25... |
import typing
import sys
import numpy as np
import numba as nb
@nb.njit
def csgraph_to_directed(g: np.ndarray) -> np.ndarray:
m = len(g)
g = np.vstack((g, g))
g[m:, :2] = g[m:, 1::-1]
return g
@nb.njit
def sort_csgraph(
n: int,
g: np.ndarray,
) -> typing.Tuple[np.ndarray, np.ndarray, np.ndarra... | [
"numpy.full",
"sys.stdin.read",
"numpy.empty",
"numba.njit",
"numpy.zeros",
"numpy.argsort",
"numpy.arange",
"numpy.vstack"
] | [((2746, 2793), 'numba.njit', 'nb.njit', (['(nb.i8[:, :], nb.i8[:, :])'], {'cache': '(True)'}), '((nb.i8[:, :], nb.i8[:, :]), cache=True)\n', (2753, 2793), True, 'import numba as nb\n'), ((154, 171), 'numpy.vstack', 'np.vstack', (['(g, g)'], {}), '((g, g))\n', (163, 171), True, 'import numpy as np\n'), ((337, 374), 'nu... |
from os import path
import json
import re
from stix_shifter_utils.stix_translation.src.utils.exceptions import DataMappingException
from stix_shifter_utils.modules.base.stix_translation.base_data_mapper import BaseDataMapper
def _fetch_mapping(dialect=''):
try:
if dialect != '':
dialect = dial... | [
"os.path.dirname",
"os.path.join",
"json.loads"
] | [((349, 371), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (361, 371), False, 'from os import path\n'), ((539, 559), 'json.loads', 'json.loads', (['map_file'], {}), '(map_file)\n', (549, 559), False, 'import json\n'), ((417, 476), 'os.path.join', 'path.join', (['basepath', '"""json"""', "(dial... |
from django.conf.urls import patterns, url
from categories import views
urlpatterns = patterns('',
# /categories/
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<slug>[-_\w]+)/$', views.CategoryPageView.as_view(), name='categoryPage'),
)
| [
"categories.views.IndexView.as_view",
"categories.views.CategoryPageView.as_view"
] | [((142, 167), 'categories.views.IndexView.as_view', 'views.IndexView.as_view', ([], {}), '()\n', (165, 167), False, 'from categories import views\n'), ((221, 253), 'categories.views.CategoryPageView.as_view', 'views.CategoryPageView.as_view', ([], {}), '()\n', (251, 253), False, 'from categories import views\n')] |
"""
Copyright (c) Facebook, Inc. and its affiliates.
"""
from .voc import VOCDetection
from typing import Iterable
import to_coco_api
VOC_PATH = "/datasets01/VOC/060817/"
class VOCDetection2012(VOCDetection):
def __init__(self, image_set: str = "train", transforms: Iterable = None):
super(VOCDetection, ... | [
"to_coco_api.PrepareInstance"
] | [((440, 469), 'to_coco_api.PrepareInstance', 'to_coco_api.PrepareInstance', ([], {}), '()\n', (467, 469), False, 'import to_coco_api\n')] |
from __future__ import absolute_import
from collections import namedtuple
from time import time
from flask import g
from jsonschema import ValidationError
from reles.references import resolve_field_reference
ProcessingContext = namedtuple(
'ProcessingContext',
('datastore', 'doc_id', 'full_entity', 'full_sc... | [
"reles.references.resolve_field_reference",
"jsonschema.ValidationError",
"collections.namedtuple",
"time.time"
] | [((232, 322), 'collections.namedtuple', 'namedtuple', (['"""ProcessingContext"""', "('datastore', 'doc_id', 'full_entity', 'full_schema')"], {}), "('ProcessingContext', ('datastore', 'doc_id', 'full_entity',\n 'full_schema'))\n", (242, 322), False, 'from collections import namedtuple\n'), ((1949, 2014), 'reles.refer... |
"""
=============================================
Multiclass Classification with NumPy and TMVA
=============================================
"""
from array import array
import numpy as np
from numpy.random import RandomState
from root_numpy.tmva import add_classification_events, evaluate_reader
from root_numpy import ... | [
"matplotlib.pyplot.title",
"numpy.argmax",
"numpy.ones",
"ROOT.TFile",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.contourf",
"numpy.arange",
"ROOT.TMVA.DataLoader",
"numpy.diag",
"matplotlib.pyplot.tight_layout",
"root_numpy.tmva.add_classification_events",
... | [((401, 424), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (414, 424), True, 'import matplotlib.pyplot as plt\n'), ((431, 446), 'numpy.random.RandomState', 'RandomState', (['(42)'], {}), '(42)\n', (442, 446), False, 'from numpy.random import RandomState\n'), ((735, 778), 'nump... |
from drl_negotiation.scenario import BaseScenario
from drl_negotiation.core import TrainWorld, MySCML2020Agent
from drl_negotiation.myagent import MyComponentsBasedAgent
from drl_negotiation.hyperparameters import *
from negmas.helpers import get_class
from scml.scml2020 import (
DecentralizingAgent,
... | [
"scml.scml2020.SCML2020World.generate",
"scml.scml2020.is_system_agent",
"drl_negotiation.core.TrainWorld",
"numpy.array",
"negmas.helpers.get_class"
] | [((1138, 1183), 'drl_negotiation.core.TrainWorld', 'TrainWorld', ([], {'configuration': 'world_configuration'}), '(configuration=world_configuration)\n', (1148, 1183), False, 'from drl_negotiation.core import TrainWorld, MySCML2020Agent\n'), ((1599, 1694), 'scml.scml2020.SCML2020World.generate', 'SCML2020World.generate... |
# MIT License
#
# Copyright (c) 2021 <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, publi... | [
"os.path.dirname",
"setuptools.find_packages"
] | [((1157, 1182), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1172, 1182), False, 'import os\n'), ((1578, 1604), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (1602, 1604), False, 'import setuptools\n')] |
from .featurizer import Featurizer
from dataset import AuxTables
from dataset.dataset import dictify
import pandas as pd
import itertools
import torch
from tqdm import tqdm
#GM
class OccurFeaturizerfusion(Featurizer):
def specific_setup(self):
self.name = "OccurFeaturizerfusion"
if not self.setup_do... | [
"torch.zeros",
"torch.cat"
] | [((1426, 1444), 'torch.cat', 'torch.cat', (['tensors'], {}), '(tensors)\n', (1435, 1444), False, 'import torch\n'), ((1526, 1573), 'torch.zeros', 'torch.zeros', (['(1)', 'self.classes', 'self.attrs_number'], {}), '(1, self.classes, self.attrs_number)\n', (1537, 1573), False, 'import torch\n')] |
"""
dp[i][j][k] = i頂点n辺グラフ長さ最大値kの組み合わせ数
dp[i][j][k] = dp[i - k][n - usededge][_] for _ in range(k + 1)
よくわからん
"""
import math
from operator import mul
from functools import reduce
def comb(n, r):
r = min(r, n - r)
numer = reduce(mul, range(n, n - r, -1), 1)
denom = reduce(mul, range(1, r + 1), 1)
... | [
"math.factorial"
] | [((669, 690), 'math.factorial', 'math.factorial', (['(k - 1)'], {}), '(k - 1)\n', (683, 690), False, 'import math\n')] |
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
if dir_path.split('\\')[0] == 'D:':
datasources_path = dir_path+"\datasources\\"
enrichment_path = dir_path+"\enrichment\\"
pickles_path = dir_path+"\pickles\\"
learning_models_path = dir_path+"\learning_models\\"
temp_files_path = dir... | [
"os.path.realpath"
] | [((37, 63), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (53, 63), False, 'import os\n')] |
import pytest
from bitcoinx import (
hex_str_to_hash, bits_to_work, bits_to_target, hash_to_value, hash_to_hex_str,
)
from bitcoinx.coin import *
header_400k = (
b'\x04\x00\x00\x009\xfa\x82\x18Hx\x1f\x02z.m\xfa\xbb\xf6\xbd\xa9 \xd9'
b'\xaea\xb64\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\xec\xaeSj0@B\xe3'
... | [
"bitcoinx.hash_to_hex_str",
"bitcoinx.hash_to_value",
"bitcoinx.hex_str_to_hash",
"pytest.raises",
"bitcoinx.bits_to_target",
"pytest.mark.parametrize",
"bitcoinx.bits_to_work"
] | [((447, 1117), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""raw_header,header_hash,version,prev_hash,merkle_root,timestamp,bits,nonce"""', "((Bitcoin.genesis_header,\n '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f', 1,\n '000000000000000000000000000000000000000000000000000000000... |
# Copyright 2017 The TensorFlow Lattice 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"tensorflow.python.platform.test.main",
"tensorflow_lattice.python.estimators.hparams.CalibratedEtlHParams",
"tensorflow.python.feature_column.feature_column_lib.numeric_column",
"tensorflow_lattice.python.lib.test_data.TestData",
"tensorflow_lattice.python.estimators.calibrated_etl.calibrated_etl_classifie... | [((14983, 14994), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (14992, 14994), False, 'from tensorflow.python.platform import test\n'), ((1306, 1359), 'tensorflow_lattice.python.estimators.hparams.CalibratedEtlHParams', 'tfl_hparams.CalibratedEtlHParams', ([], {'feature_names': "['x']"}), "(fe... |
"""
Example script demonstrating the training portion of the MLR pipeline.
This is mostly to demonstrate how everything ties together
To run:
PYSPARK_PYTHON=venv/bin/python spark-submit \
--jars /path/to/mjolnir-with-dependencies.jar \
--artifacts 'mjolnir_venv.zip#venv' \
path/to/training_... | [
"os.mkdir",
"logging.error",
"argparse.ArgumentParser",
"logging.basicConfig",
"pyspark.SparkContext",
"os.path.exists",
"datetime.datetime.now",
"pyspark.sql.HiveContext",
"os.rmdir",
"os.path.join",
"sys.exit",
"pickle.dumps"
] | [((5126, 5193), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train XGBoost ranking models"""'}), "(description='Train XGBoost ranking models')\n", (5149, 5193), False, 'import argparse\n'), ((7007, 7037), 'pyspark.SparkContext', 'SparkContext', ([], {'appName': 'app_name'}), '(appName=... |
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import UserCreationForm
from . import models
class UserCreateForm(UserCreationForm):
class Meta:
fields = ('username', 'email', '<PASSWORD>', '<PASSWORD>')
model = get_user_model()
class UserProfileForm(forms.M... | [
"django.contrib.auth.get_user_model"
] | [((273, 289), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (287, 289), False, 'from django.contrib.auth import get_user_model\n')] |
# -*- coding: utf-8 -*-
"""
All code for scraping images and videos from posted
links go in this file.
"""
#import BeautifulSoup
import requests
from urllib.parse import urlparse, urlunparse, urljoin
img_extensions = ['jpg', 'jpeg', 'gif', 'png', 'bmp']
def make_abs(url, img_src):
domain = urlparse(url).netloc
... | [
"urllib.parse.urlunparse",
"urllib.parse.urljoin",
"urllib.parse.urlparse"
] | [((401, 426), 'urllib.parse.urljoin', 'urljoin', (['baseurl', 'img_src'], {}), '(baseurl, img_src)\n', (408, 426), False, 'from urllib.parse import urlparse, urlunparse, urljoin\n'), ((459, 472), 'urllib.parse.urlparse', 'urlparse', (['url'], {}), '(url)\n', (467, 472), False, 'from urllib.parse import urlparse, urlunp... |
from invoke import task, run
@task
def check(c):
'''
Comprobador de la sintaxis del proyecto
'''
print("Comprobando sintaxis...")
run("pyflakes code") # El directorio con todo el código de la aplicación
@task
def test(c):
'''
Realiza los tests del proyecto
'''
print("Realizando los... | [
"invoke.run"
] | [((151, 171), 'invoke.run', 'run', (['"""pyflakes code"""'], {}), "('pyflakes code')\n", (154, 171), False, 'from invoke import task, run\n'), ((336, 349), 'invoke.run', 'run', (['"""pytest"""'], {}), "('pytest')\n", (339, 349), False, 'from invoke import task, run\n')] |
# From hacksoft.io/improve-your-tests-django-fakes-and-factories/
import factory
from faker import Faker
from factory import lazy_attribute
fake = Faker()
class CategoryFactory(factory.django.DjangoModelFactory):
class Meta:
model = 'products.Category'
id = factory.Sequence(lambda n: n)
name = f... | [
"factory.SubFactory",
"factory.Faker",
"factory.Sequence",
"faker.Faker"
] | [((148, 155), 'faker.Faker', 'Faker', ([], {}), '()\n', (153, 155), False, 'from faker import Faker\n'), ((278, 307), 'factory.Sequence', 'factory.Sequence', (['(lambda n: n)'], {}), '(lambda n: n)\n', (294, 307), False, 'import factory\n'), ((387, 408), 'factory.Faker', 'factory.Faker', (['"""word"""'], {}), "('word')... |
from fastapi_utils.api_model import APIModel
from tifa.apps.admin.local import g
from tifa.apps.admin.router import bp
from tifa.models.app import App
class TApp(APIModel):
id: str
name: str
@bp.list("/apps", out=TApp, summary="App", tags=["App"])
def apps_list():
ins = g.adal.first_or_404(App)
ret... | [
"tifa.apps.admin.router.bp.op",
"tifa.apps.admin.local.g.adal.first_or_404",
"tifa.apps.admin.router.bp.item",
"tifa.apps.admin.router.bp.list"
] | [((205, 260), 'tifa.apps.admin.router.bp.list', 'bp.list', (['"""/apps"""'], {'out': 'TApp', 'summary': '"""App"""', 'tags': "['App']"}), "('/apps', out=TApp, summary='App', tags=['App'])\n", (212, 260), False, 'from tifa.apps.admin.router import bp\n'), ((342, 396), 'tifa.apps.admin.router.bp.item', 'bp.item', (['"""/... |
# -*- coding: utf-8 -*-
from cadnano.util import to_dot_path
pp = to_dot_path(__file__)
PathNucleicAcidPartItemT = pp + '.nucleicacidpartitem.PathNucleicAcidPartItem'
PathVirtualHelixItemT = pp + 'virtualhelixitem.PathVirtualHelixItem'
PathStrandItemT = pp + 'strand.stranditem.StrandItem'
PathEndpointItemT = pp + 'stra... | [
"cadnano.util.to_dot_path"
] | [((66, 87), 'cadnano.util.to_dot_path', 'to_dot_path', (['__file__'], {}), '(__file__)\n', (77, 87), False, 'from cadnano.util import to_dot_path\n')] |
#
# 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, software
# distributed under the ... | [
"os.path.abspath",
"os.path.join",
"translator.conf.config.ConfigProvider._load_config"
] | [((1087, 1125), 'os.path.join', 'os.path.join', (['conf_path', 'CONF_FILENAME'], {}), '(conf_path, CONF_FILENAME)\n', (1099, 1125), False, 'import os\n'), ((1130, 1168), 'translator.conf.config.ConfigProvider._load_config', 'ConfigProvider._load_config', (['conf_file'], {}), '(conf_file)\n', (1157, 1168), False, 'from ... |
import json
import os
from contextlib import contextmanager
import pytest
from text_normalizer.convert import text2int, ord_unfold, is_ordfold, MONTHS, month2num
from text_normalizer.convert._convert import _numerics
from ..settings import TESTS_PATH
with open(os.path.join(TESTS_PATH, 'convert/data/numerics_ds.json'... | [
"json.load",
"text_normalizer.convert.month2num",
"text_normalizer.convert.ord_unfold",
"text_normalizer.convert._convert._numerics.items",
"pytest.raises",
"text_normalizer.convert.is_ordfold",
"pytest.mark.parametrize",
"text_normalizer.convert.text2int",
"os.path.join"
] | [((773, 920), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""text, num"""', "[('десяток', 10), ('два десяток', 20), ('пять десяток', 50), ('сотня', 100),\n ('две сотня', 200), ('', 0)]"], {}), "('text, num', [('десяток', 10), ('два десяток', 20),\n ('пять десяток', 50), ('сотня', 100), ('две сотня', ... |
##############################################################################
# Copyright (c) 2017 ZTE Corporation and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is avail... | [
"oslo_config.cfg.StrOpt",
"oslo_utils.importutils.import_object",
"oslo_config.cfg.IntOpt"
] | [((530, 647), 'oslo_config.cfg.StrOpt', 'cfg.StrOpt', (['"""type"""'], {'default': '"""sample"""', 'choices': "['sample']", 'help': '"""the component of doctor consumer"""', 'required': '(True)'}), "('type', default='sample', choices=['sample'], help=\n 'the component of doctor consumer', required=True)\n", (540, 64... |
from metaflow import FlowSpec, step, Flow, Parameter, JSONType
class ClassifierPredictFlow(FlowSpec):
vector = Parameter('vector', type=JSONType, required=True)
@step
def start(self):
run = Flow('ClassifierTrainFlow').latest_run
self.train_run_id = run.pathspec
self.model = run['e... | [
"metaflow.Flow",
"metaflow.Parameter"
] | [((117, 166), 'metaflow.Parameter', 'Parameter', (['"""vector"""'], {'type': 'JSONType', 'required': '(True)'}), "('vector', type=JSONType, required=True)\n", (126, 166), False, 'from metaflow import FlowSpec, step, Flow, Parameter, JSONType\n'), ((213, 240), 'metaflow.Flow', 'Flow', (['"""ClassifierTrainFlow"""'], {})... |
from models import PatchCore
from save_utils import saveModelPath
import numpy
import torch
import warnings
from torch import tensor
from torchvision import transforms
import json
import numpy
from PIL import Image, ImageFilter
import os
from torch.utils.data import DataLoader,TensorDataset
warnings.filterwarnings("... | [
"json.dumps",
"torch.utils.data.TensorDataset",
"torchvision.transforms.Normalize",
"os.path.join",
"torch.utils.data.DataLoader",
"torchvision.transforms.Compose",
"torchvision.transforms.CenterCrop",
"PIL.ImageFilter.MedianFilter",
"torch.from_numpy",
"torchvision.transforms.Resize",
"save_uti... | [((295, 328), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (318, 328), False, 'import warnings\n'), ((923, 982), 'models.PatchCore', 'PatchCore', ([], {'f_coreset': 'f_coreset', 'backbone_name': 'backbone_name'}), '(f_coreset=f_coreset, backbone_name=backbone_name)\n', (... |
# Generated by Django 4.0.1 on 2022-01-13 19:25
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.manager
import user.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.A... | [
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"django.db.models.SET",
"django.db.models.DateTimeField"
] | [((278, 335), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (309, 335), False, 'from django.db import migrations, models\n'), ((516, 566), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add':... |
"""Serializer classes for DNSaaS API"""
import ipaddress
from django.conf import settings
from django.contrib.auth import get_user_model
from powerdns.utils import find_domain_for_record
from powerdns.models import (
RECORD_A_TYPES,
CryptoKey,
Domain,
DomainMetadata,
DomainTemplate,
Record,
... | [
"powerdns.utils.find_domain_for_record",
"rest_framework.serializers.SerializerMethodField",
"powerdns.models.Service.objects.all",
"powerdns.models.Domain.objects.all",
"django.contrib.auth.get_user_model",
"rest_framework.serializers.ReadOnlyField",
"ipaddress.ip_address",
"rest_framework.serializer... | [((853, 868), 'rest_framework.serializers.ReadOnlyField', 'ReadOnlyField', ([], {}), '()\n', (866, 868), False, 'from rest_framework.serializers import PrimaryKeyRelatedField, ReadOnlyField, ModelSerializer, SlugRelatedField\n'), ((888, 923), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMe... |
import graphene
from graphene_django.types import DjangoObjectType
from cask.accounts.models import Follower
from cask.utils import optimize_queryset
from .models import CheckIn
class CheckInScope(graphene.Enum):
class Meta:
name = "CheckInScope"
public = "public"
friends = "friends"
class Ch... | [
"cask.utils.optimize_queryset",
"graphene.Argument",
"graphene.UUID",
"cask.accounts.models.Follower.objects.filter"
] | [((1305, 1344), 'cask.utils.optimize_queryset', 'optimize_queryset', (['qs', 'info', '"""checkins"""'], {}), "(qs, info, 'checkins')\n", (1322, 1344), False, 'from cask.utils import optimize_queryset\n'), ((499, 514), 'graphene.UUID', 'graphene.UUID', ([], {}), '()\n', (512, 514), False, 'import graphene\n'), ((530, 56... |
import os
from download_and_view import download_and_unzip, check_directory_contents, read_random_review, \
remove_unneeded_directories
from load_raw_datasets import build_raw_datasets, view_dataset
from preprocess_data import apply_vectorisation, view_sample_vectorisation, preprocess_dataset
from train_model impo... | [
"load_raw_datasets.build_raw_datasets",
"download_and_view.read_random_review",
"download_and_view.check_directory_contents",
"download_and_view.download_and_unzip",
"download_and_view.remove_unneeded_directories",
"evaluate_model.visualise_training",
"preprocess_data.apply_vectorisation",
"load_raw_d... | [((800, 853), 'download_and_view.download_and_unzip', 'download_and_unzip', (['"""aclImdb_v1"""', 'imdb_url', '"""aclImdb"""'], {}), "('aclImdb_v1', imdb_url, 'aclImdb')\n", (818, 853), False, 'from download_and_view import download_and_unzip, check_directory_contents, read_random_review, remove_unneeded_directories\n'... |
from django.test import TestCase
from django.test import Client
from django.urls import reverse
from tests.factories.gbe_factories import (
ConferenceFactory,
GenericEventFactory,
PersonaFactory,
ProfileFactory,
)
from tests.contexts import (
StaffAreaContext,
VolunteerContext,
)
from scheduler.... | [
"tests.contexts.VolunteerContext",
"django.test.Client",
"tests.factories.gbe_factories.ConferenceFactory",
"django.urls.reverse",
"tests.functions.gbe_functions.login_as",
"tests.functions.gbe_functions.grant_privilege",
"tests.factories.gbe_factories.ProfileFactory"
] | [((742, 760), 'tests.contexts.VolunteerContext', 'VolunteerContext', ([], {}), '()\n', (758, 760), False, 'from tests.contexts import StaffAreaContext, VolunteerContext\n'), ((845, 951), 'django.urls.reverse', 'reverse', (['self.view_name'], {'args': '[self.current_conference.conference_slug]', 'urlconf': '"""gbe.sched... |
import itertools
from budget_nanny.api_requests import APIRequester, BUDGETS_ENDPOINT, BUDGET_ENDPOINTS
DEFAULT_BUDGET = 'Personal'
class BudgetRequester:
def __init__(self, budget):
self.budget = budget
self.api_requester = APIRequester()
def create_transaction(self, transaction_data):
... | [
"budget_nanny.api_requests.APIRequester"
] | [((249, 263), 'budget_nanny.api_requests.APIRequester', 'APIRequester', ([], {}), '()\n', (261, 263), False, 'from budget_nanny.api_requests import APIRequester, BUDGETS_ENDPOINT, BUDGET_ENDPOINTS\n'), ((1533, 1547), 'budget_nanny.api_requests.APIRequester', 'APIRequester', ([], {}), '()\n', (1545, 1547), False, 'from ... |
import cv2
import numpy as np
from .fs_access import FSAccess
def read_image_file(fname_url):
with FSAccess(fname_url, True) as image_f:
img_buf = image_f.read()
np_arr = np.frombuffer(img_buf, np.uint8)
img = cv2.imdecode(np_arr, 0)
return img
def write_image_file(fname_url, img):
... | [
"numpy.frombuffer",
"cv2.imdecode",
"numpy.getbuffer"
] | [((330, 347), 'numpy.getbuffer', 'np.getbuffer', (['img'], {}), '(img)\n', (342, 347), True, 'import numpy as np\n'), ((192, 224), 'numpy.frombuffer', 'np.frombuffer', (['img_buf', 'np.uint8'], {}), '(img_buf, np.uint8)\n', (205, 224), True, 'import numpy as np\n'), ((239, 262), 'cv2.imdecode', 'cv2.imdecode', (['np_ar... |