code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright (c) 2015, <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions ... | [
"copy.copy",
"random.randint",
"utils.math.signum"
] | [((1641, 1661), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (1655, 1661), False, 'import random\n'), ((1818, 1831), 'utils.math.signum', 'signum', (['count'], {}), '(count)\n', (1824, 1831), False, 'from utils.math import signum\n'), ((3004, 3027), 'utils.math.signum', 'signum', (['board[posit... |
'''
'''
from dagster_dbt import create_dbt_solid, create_dbt_test_solid
from dagster import file_relative_path, pipeline
PROJECT_DIR = file_relative_path(__file__, 'jaffle_shop')
PROFILES_DIR = file_relative_path(__file__, 'profiles')
jaffle_solid = create_dbt_solid(PROJECT_DIR, profiles_dir=PROFILES_DIR)
jaffle_tes... | [
"dagster_dbt.create_dbt_solid",
"dagster_dbt.create_dbt_test_solid",
"dagster.file_relative_path"
] | [((137, 180), 'dagster.file_relative_path', 'file_relative_path', (['__file__', '"""jaffle_shop"""'], {}), "(__file__, 'jaffle_shop')\n", (155, 180), False, 'from dagster import file_relative_path, pipeline\n'), ((196, 236), 'dagster.file_relative_path', 'file_relative_path', (['__file__', '"""profiles"""'], {}), "(__f... |
#! /Users/mikeyb/Applications/python3
# -*- coding: utf-8 -*-
'''
BSD 3-Clause License
Copyright (c) 2020, <NAME>
All rights reserved.
'''
# First party classes
import os, sys
import logging
import logging.config
import requests
import configparser
# Custom classes
from ExerciseInfo_Class import ExerciseInfo
def c... | [
"requests.post"
] | [((489, 557), 'requests.post', 'requests.post', (["(server + ':' + port + '/api/v1/wrkt_sheet')"], {'json': 'wrkt'}), "(server + ':' + port + '/api/v1/wrkt_sheet', json=wrkt)\n", (502, 557), False, 'import requests\n')] |
from utilidadescev import moeda
from utilidadescev import dados
valor = dados.leia_dinheiro('Digite o valor: R$ ')
moeda.resumo(valor, 30, 30)
| [
"utilidadescev.moeda.resumo",
"utilidadescev.dados.leia_dinheiro"
] | [((73, 115), 'utilidadescev.dados.leia_dinheiro', 'dados.leia_dinheiro', (['"""Digite o valor: R$ """'], {}), "('Digite o valor: R$ ')\n", (92, 115), False, 'from utilidadescev import dados\n'), ((116, 143), 'utilidadescev.moeda.resumo', 'moeda.resumo', (['valor', '(30)', '(30)'], {}), '(valor, 30, 30)\n', (128, 143), ... |
from django.db.models.functions import TruncHour
from rest_framework import permissions, viewsets
from rest_framework.response import Response
from rest_framework.views import APIView
from ..serializers import *
class DataEntrySet(viewsets.ModelViewSet):
"""
API endpoint that allows data entries to be viewed... | [
"rest_framework.response.Response",
"django.db.models.functions.TruncHour"
] | [((1704, 1718), 'rest_framework.response.Response', 'Response', (['data'], {}), '(data)\n', (1712, 1718), False, 'from rest_framework.response import Response\n'), ((742, 809), 'rest_framework.response.Response', 'Response', (["{'err': '0', 'msg': 'Incorrect type for graph parameter'}"], {}), "({'err': '0', 'msg': 'Inc... |
#!/usr/bin/python
#-*- coding:utf-8 -*-
import json
import argparse
from kafka import KafkaConsumer
def main():
parser = argparse.ArgumentParser()
parser.add_argument("topic", type=str,
help="Topic for producer")
parser.add_argument("--bootstrap_servers", type=str, default="kafka:... | [
"argparse.ArgumentParser"
] | [((128, 153), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (151, 153), False, 'import argparse\n')] |
import json
from django.urls import reverse
from rest_framework.test import APITestCase
from rest_framework import status
from authors.apps.authentication.models import User
from authors.apps.authentication.tests.utils import TEST_USER
from django.core import mail
from authors.apps.authentication.views import VerifyAcc... | [
"json.loads",
"django.urls.reverse",
"authors.apps.authentication.views.VerifyAccount.as_view",
"authors.apps.articles.models.Article.objects.create",
"django.utils.encoding.force_bytes",
"authors.apps.authentication.models.User.objects.get",
"authors.apps.authentication.utils.generate_token.make_token"... | [((2227, 2255), 'json.loads', 'json.loads', (['response.content'], {}), '(response.content)\n', (2237, 2255), False, 'import json\n'), ((2452, 2503), 'authors.apps.authentication.models.User.objects.create_user', 'User.objects.create_user', (['username', 'email', 'password'], {}), '(username, email, password)\n', (2476... |
# -*- coding: utf-8 -*-
# Copyright 2015 moco_beta
#
# 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 agr... | [
"logging.getLogger",
"logging.StreamHandler",
"gzip.open",
"pickle.dumps",
"base64.b64encode",
"io.open",
"sys.exit",
"os.path.exists",
"functools.wraps",
"os.path.isdir",
"zlib.decompress",
"struct.pack",
"re.sub",
"traceback.format_exc",
"logging.Formatter",
"os.path.join",
"os.pat... | [((901, 928), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (918, 928), False, 'import logging\n'), ((969, 992), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (990, 992), False, 'import logging\n'), ((1036, 1107), 'logging.Formatter', 'logging.Formatter', (['"""%(as... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import unicode_literals, division, print_function
"""
This module implements various equation of states.
Note: Most of the code were initially adapted from ASE and deltafactor by
@gmatteo but ... | [
"logging.getLogger",
"numpy.polyfit",
"pymatgen.util.plotting.pretty_plot",
"scipy.optimize.minimize",
"numpy.log",
"numpy.roots",
"numpy.exp",
"numpy.array",
"scipy.optimize.leastsq",
"numpy.linspace",
"numpy.polyder",
"warnings.simplefilter",
"six.with_metaclass",
"copy.deepcopy",
"num... | [((701, 728), 'logging.getLogger', 'logging.getLogger', (['__file__'], {}), '(__file__)\n', (718, 728), False, 'import logging\n'), ((745, 772), 'six.with_metaclass', 'six.with_metaclass', (['ABCMeta'], {}), '(ABCMeta)\n', (763, 772), False, 'import six\n'), ((1099, 1116), 'numpy.array', 'np.array', (['volumes'], {}), ... |
import flatbuffers
import fbs.SeldonMessage
import fbs.Data
import fbs.DefaultData
import fbs.Tensor
import fbs.SeldonRPC
import fbs.SeldonPayload
import fbs.Status
import fbs.StatusValue
import fbs.SeldonProtocolVersion
import fbs.SeldonMethod
def NumpyArrayToSeldonRPC(arr,names):
builder = flatbuffers.Builder(32... | [
"flatbuffers.Builder"
] | [((298, 324), 'flatbuffers.Builder', 'flatbuffers.Builder', (['(32768)'], {}), '(32768)\n', (317, 324), False, 'import flatbuffers\n')] |
# Generated by Django 3.0.4 on 2020-07-12 15:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0016_auto_20200712_1557'),
]
operations = [
migrations.AlterField(
model_name='user',
name='email',
... | [
"django.db.models.EmailField",
"django.db.migrations.RunSQL"
] | [((398, 888), 'django.db.migrations.RunSQL', 'migrations.RunSQL', (['"""\n CREATE OR REPLACE FUNCTION generate_random_hash(int)\n RETURNS text\n AS $$\n SELECT array_to_string(\n ARRAY (\n SELECT substring(\n \'abcdefghijkl... |
import unittest
# from bacdive.DSMZClient import retrieve, DSMZ_login, Dive
class TestDSMZClient(unittest.TestCase):
def setUp(self):
pass
def test_retrieve(self):
# TODO
pass
def test_DSMZ_login(self):
# TODO
pass
def test_Dive(self):
# TODO
... | [
"unittest.main"
] | [((359, 374), 'unittest.main', 'unittest.main', ([], {}), '()\n', (372, 374), False, 'import unittest\n')] |
# -*- coding: utf-8 -*-
import numpy as np
import cv2
import tensorflow as tf
import sys
from demographics_architecture import image_size, cnn_architecture
tf.logging.set_verbosity(tf.logging.INFO)
# Set default flags for the output directories
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string(
flag_name='c... | [
"demographics_architecture.cnn_architecture",
"tensorflow.placeholder",
"tensorflow.train.Saver",
"tensorflow.logging.set_verbosity",
"tensorflow.Session",
"tensorflow.app.flags.DEFINE_string",
"numpy.argmax",
"tensorflow.global_variables_initializer",
"cv2.resize",
"cv2.imread"
] | [((159, 200), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.INFO'], {}), '(tf.logging.INFO)\n', (183, 200), True, 'import tensorflow as tf\n'), ((276, 382), 'tensorflow.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', ([], {'flag_name': '"""checkpoint_path"""', 'default_value': '"... |
import mock
from zeep import exceptions
def get_side_effect(
returned_token="RETURNED_TOKEN",
verify_result=1,
raise_zeep_fault=False,
raise_zeep_error=False,
):
# noinspection PyPep8Naming
# noinspection PyMethodMayBeStatic
# noinspection PyUnusedLocal
class ClientService:
c... | [
"zeep.exceptions.Error",
"zeep.exceptions.Fault",
"mock.MagicMock"
] | [((881, 897), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (895, 897), False, 'import mock\n'), ((738, 773), 'zeep.exceptions.Error', 'exceptions.Error', (['"""FAKE ZEEP ERROR"""'], {}), "('FAKE ZEEP ERROR')\n", (754, 773), False, 'from zeep import exceptions\n'), ((484, 519), 'zeep.exceptions.Fault', 'excepti... |
# coding: utf-8
"""
Adobe Experience Manager (AEM) API
Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API
OpenAPI spec version: 2.2.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import ... | [
"unittest.main",
"swaggeraem.apis.sling_api.SlingApi"
] | [((4236, 4251), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4249, 4251), False, 'import unittest\n'), ((576, 612), 'swaggeraem.apis.sling_api.SlingApi', 'swaggeraem.apis.sling_api.SlingApi', ([], {}), '()\n', (610, 612), False, 'import swaggeraem\n')] |
from rts.core.task import Task
from rts.core.ts import TaskSet
import unittest
class TaskSetTestCase(unittest.TestCase):
""" Tests for `taskset.py`."""
def test_id_does_not_overlap(self):
ts1 = TaskSet()
ts2 = TaskSet()
self.assertNotEqual(ts1.id, ts2.id)
def test_task_is_counte... | [
"unittest.main",
"rts.core.task.Task",
"rts.core.ts.TaskSet"
] | [((1440, 1455), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1453, 1455), False, 'import unittest\n'), ((214, 223), 'rts.core.ts.TaskSet', 'TaskSet', ([], {}), '()\n', (221, 223), False, 'from rts.core.ts import TaskSet\n'), ((238, 247), 'rts.core.ts.TaskSet', 'TaskSet', ([], {}), '()\n', (245, 247), False, 'fr... |
import redis
import time
HOST = 'localhost'
PORT = '6379'
CHANNEL = 'motion-alert'
if __name__ == '__main__':
r = redis.Redis(host=HOST, port=PORT)
pub = r.pubsub()
pub.subscribe(CHANNEL)
while True:
data = pub.get_message()
if data:
message = data['data']
if m... | [
"time.time",
"time.sleep",
"redis.Redis"
] | [((120, 153), 'redis.Redis', 'redis.Redis', ([], {'host': 'HOST', 'port': 'PORT'}), '(host=HOST, port=PORT)\n', (131, 153), False, 'import redis\n'), ((427, 440), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (437, 440), False, 'import time\n'), ((396, 407), 'time.time', 'time.time', ([], {}), '()\n', (405, 407),... |
# -*- coding: utf-8 -*-
import numpy as np, pandas as pd, arviz as az, seaborn as sns, matplotlib.pyplot as plt
from cmdstanpy import CmdStanModel
raw_data = pd.read_csv("data/challenger_data.csv")
raw_data["Date"] = pd.to_datetime(raw_data["Date"], infer_datetime_format=True)
# pop last row -> drop missing ... | [
"arviz.summary",
"pandas.read_csv",
"arviz.from_cmdstanpy",
"arviz.plot_trace",
"pandas.to_datetime",
"cmdstanpy.CmdStanModel"
] | [((165, 204), 'pandas.read_csv', 'pd.read_csv', (['"""data/challenger_data.csv"""'], {}), "('data/challenger_data.csv')\n", (176, 204), True, 'import numpy as np, pandas as pd, arviz as az, seaborn as sns, matplotlib.pyplot as plt\n'), ((225, 285), 'pandas.to_datetime', 'pd.to_datetime', (["raw_data['Date']"], {'infer_... |
import os
import re
import logging
import subprocess
from pathlib import Path
import click
import graphviz
import snakemake
from BALSAMIC.utils.constants import BIOINFO_TOOL_ENV, BALSAMIC_DOCKER_PATH, VALID_CONTAINER_CONDA_NAME
from BALSAMIC.utils.cli import write_json, merge_json, CaptureStdout, get_snakefile, Snake... | [
"logging.getLogger",
"click.Choice",
"BALSAMIC.utils.cli.CaptureStdout",
"BALSAMIC.utils.cli.get_snakefile",
"re.compile",
"click.option",
"pathlib.Path",
"snakemake.snakemake",
"click.Abort",
"BALSAMIC.utils.cli.SnakeMake",
"click.Path",
"click.command",
"graphviz.Source",
"BALSAMIC.utils... | [((385, 412), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (402, 412), False, 'import logging\n'), ((416, 516), 'click.command', 'click.command', (['"""init"""'], {'short_help': '"""Download matching version for container and build reference"""'}), "('init', short_help=\n 'Download m... |
import io
import gnupg
import mock
from django.utils.encoding import force_bytes
from mayan.apps.storage.utils import TemporaryFile
from mayan.apps.testing.tests.base import BaseTestCase
from ..exceptions import (
DecryptionError, KeyDoesNotExist, NeedPassphrase, PassphraseError,
VerificationError
)
from ..... | [
"mock.patch.object",
"django.utils.encoding.force_bytes",
"mayan.apps.storage.utils.TemporaryFile",
"io.BytesIO"
] | [((932, 990), 'mock.patch.object', 'mock.patch.object', (['gnupg.GPG', '"""search_keys"""'], {'autospec': '(True)'}), "(gnupg.GPG, 'search_keys', autospec=True)\n", (949, 990), False, 'import mock\n'), ((1329, 1385), 'mock.patch.object', 'mock.patch.object', (['gnupg.GPG', '"""recv_keys"""'], {'autospec': '(True)'}), "... |
"""
ARCHES - a program developed to inventory and manage immovable cultural heritage.
Copyright (C) 2013 <NAME> and World Monuments Fund
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either ... | [
"json.loads",
"arches.app.models.models.Node.objects.filter",
"arches.app.utils.betterJSONSerializer.JSONDeserializer",
"arches.app.models.models.Edge.objects.filter",
"arches.app.models.models.NodeGroup.objects.create",
"arches.app.models.graph.Graph.objects.get",
"arches.app.models.models.CardModel.ob... | [((6701, 6712), 'arches.app.models.graph.Graph.new', 'Graph.new', ([], {}), '()\n', (6710, 6712), False, 'from arches.app.models.graph import Graph\n'), ((7355, 7390), 'arches.app.models.graph.Graph.objects.get', 'Graph.objects.get', ([], {'graphid': 'graph.pk'}), '(graphid=graph.pk)\n', (7372, 7390), False, 'from arch... |
import sys
def print_list(ar):
print(' '.join(map(str, ar)))
def insertion_sort(ar):
if len(ar) == 1:
print_list(ar)
return (ar)
else:
for j in range(1, len(ar)):
for i in reversed(range(j)):
if ar[i + 1] < ar[i]:
ar[i], ar[i + 1] =... | [
"sys.stdin.readline"
] | [((476, 496), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (494, 496), False, 'import sys\n'), ((521, 541), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (539, 541), False, 'import sys\n')] |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/20a_distributed.ipynb (unless otherwise specified).
__all__ = ['ParallelTrainer', 'setup_distrib', 'teardown_distrib', 'DistributedDL', 'DistributedTrainer', 'rank0_first']
# Cell
from .basics import *
from .callback.progress import ProgressCallback
from torch.nn.parall... | [
"torch.nn.parallel.DataParallel"
] | [((747, 805), 'torch.nn.parallel.DataParallel', 'DataParallel', (['self.learn.model'], {'device_ids': 'self.device_ids'}), '(self.learn.model, device_ids=self.device_ids)\n', (759, 805), False, 'from torch.nn.parallel import DistributedDataParallel, DataParallel\n')] |
# -*- coding: utf-8 -*-
""" Edit history
Author : yda
Date : 2020-11-12
Package name changed - asammdf to mdfstudio
Functions
---------
* Cursor.__init__ - Change cursor label color based on plot background color
"""
import pyqtgraph as pg
from PyQt5 import QtGui, QtCore
class Cursor(p... | [
"PyQt5.QtGui.QColor",
"PyQt5.QtCore.QSettings"
] | [((584, 602), 'PyQt5.QtCore.QSettings', 'QtCore.QSettings', ([], {}), '()\n', (600, 602), False, 'from PyQt5 import QtGui, QtCore\n'), ((698, 722), 'PyQt5.QtGui.QColor', 'QtGui.QColor', (['(0)', '(59)', '(126)'], {}), '(0, 59, 126)\n', (710, 722), False, 'from PyQt5 import QtGui, QtCore\n'), ((770, 793), 'PyQt5.QtGui.Q... |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... | [
"tensorflow.VarLenFeature",
"tensor2tensor.data_generators.timeseries_data_generator.generate_data",
"tensor2tensor.data_generators.text_encoder.RealEncoder",
"numpy.array",
"tensor2tensor.data_generators.generator_utils.shuffle_dataset",
"tensorflow.reshape"
] | [((5791, 5833), 'tensor2tensor.data_generators.generator_utils.shuffle_dataset', 'generator_utils.shuffle_dataset', (['all_paths'], {}), '(all_paths)\n', (5822, 5833), False, 'from tensor2tensor.data_generators import generator_utils\n'), ((6909, 6925), 'numpy.array', 'np.array', (['series'], {}), '(series)\n', (6917, ... |
# GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either versio... | [
"mediagoblin.tools.theme.register_themes",
"os.makedirs",
"mediagoblin.tools.translate.pass_to_ugettext",
"os.path.lexists",
"os.path.dirname",
"os.unlink",
"os.path.islink",
"mediagoblin.init.setup_global_and_app_config"
] | [((1871, 1896), 'os.path.dirname', 'os.path.dirname', (['link_dir'], {}), '(link_dir)\n', (1886, 1896), False, 'import os\n'), ((3137, 3180), 'mediagoblin.init.setup_global_and_app_config', 'setup_global_and_app_config', (['args.conf_file'], {}), '(args.conf_file)\n', (3164, 3180), False, 'from mediagoblin.init import ... |
from cs50 import get_string
s = get_string("Do you agree? ")
if s.lower() in {"y", "yes"}:
print("Agreed.")
elif s == "N" or s == "n":
print("Not agreed") | [
"cs50.get_string"
] | [((33, 61), 'cs50.get_string', 'get_string', (['"""Do you agree? """'], {}), "('Do you agree? ')\n", (43, 61), False, 'from cs50 import get_string\n')] |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import pickle
import os
import argparse
import torch
from torch import distributions as td
#%%
def example1(e=1, N=10000):
#independent causes
beta = np.array([3.0, 2, 0])
x2_m... | [
"torch.sin",
"torch.sqrt",
"torch.square",
"numpy.array",
"torch.nn.MSELoss",
"torch.normal",
"torch.sum",
"torch.squeeze",
"numpy.mean",
"os.path.exists",
"argparse.ArgumentParser",
"numpy.random.seed",
"torch.randn",
"torch.distributions.Uniform",
"numpy.abs",
"torch.optim.SGD",
"t... | [((290, 311), 'numpy.array', 'np.array', (['[3.0, 2, 0]'], {}), '([3.0, 2, 0])\n', (298, 311), True, 'import numpy as np\n'), ((326, 349), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)'], {}), '(0, 1)\n', (343, 349), True, 'import numpy as np\n'), ((360, 392), 'torch.normal', 'torch.normal', (['x2_mean', '... |
import numpy as np
import pickle
"""
The first part of this file is to test if the data.py prepare the data correctly
The second part of this file is to test if the data_FlIC_plus.py prepare the data correctly
"""
### The first part
n_joint = 9 # the number of joint that you want to display
y_test = np.load('y_test_fl... | [
"matplotlib.pyplot.imshow",
"numpy.reshape",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.clf",
"pickle.load",
"numpy.max",
"numpy.random.randint",
"matplotlib.pyplot.figure",
"numpy.zeros",
"numpy.load",
"matplotlib.pyplot.show"
] | [((302, 328), 'numpy.load', 'np.load', (['"""y_test_flic.npy"""'], {}), "('y_test_flic.npy')\n", (309, 328), True, 'import numpy as np\n'), ((338, 364), 'numpy.load', 'np.load', (['"""x_test_flic.npy"""'], {}), "('x_test_flic.npy')\n", (345, 364), True, 'import numpy as np\n'), ((408, 450), 'numpy.random.randint', 'np.... |
# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import re
from testrunner.local import testsuite
from testrunner.objects import testcase
FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
FLAGS_P... | [
"testrunner.objects.testcase.TestCase",
"re.compile",
"os.path.join",
"re.findall",
"os.walk"
] | [((282, 312), 're.compile', 're.compile', (['"""//\\\\s+Files:(.*)"""'], {}), "('//\\\\s+Files:(.*)')\n", (292, 312), False, 'import re\n'), ((329, 359), 're.compile', 're.compile', (['"""//\\\\s+Flags:(.*)"""'], {}), "('//\\\\s+Flags:(.*)')\n", (339, 359), False, 'import re\n'), ((377, 422), 're.compile', 're.compile'... |
# =============================================================================== #
# #
# This file has been generated automatically!! Do not change this manually! #
# ... | [
"pydantic.Field"
] | [((829, 873), 'pydantic.Field', 'Field', (['"""chatInviteLinkCounts"""'], {'alias': '"""@type"""'}), "('chatInviteLinkCounts', alias='@type')\n", (834, 873), False, 'from pydantic import Field\n')] |
from collections import namedtuple
Point2D = namedtuple('Point2D', 'x y')
Point2D.__doc__ = 'Represents a 2D Cartesian coordinate'
Point2D.x.__doc__ = 'x-coordinate'
Point2D.y.__doc__ = 'y-coordinate'
print(help(help(Point2D))) | [
"collections.namedtuple"
] | [((46, 74), 'collections.namedtuple', 'namedtuple', (['"""Point2D"""', '"""x y"""'], {}), "('Point2D', 'x y')\n", (56, 74), False, 'from collections import namedtuple\n')] |
import torch
import torchvision
from torchvision import datasets, transforms
import matplotlib.pyplot as plt
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import argparse
import utils
import dataloader
from lpgnn_wrapper import GNNWrapper, SemiSupGNNWrapper
#
# # fix random seeds for repro... | [
"dataloader.get_karate",
"utils.prepare_device",
"lpgnn_wrapper.GNNWrapper.Config",
"torch.nn.Tanh",
"argparse.ArgumentParser",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"torch.cuda.is_available",
"networkx.karate_club_graph",
"numpy.full",
"lpgnn_wrapper.SemiSupGNNWrapper"
] | [((529, 575), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch"""'}), "(description='PyTorch')\n", (552, 575), False, 'import argparse\n'), ((2405, 2473), 'utils.prepare_device', 'utils.prepare_device', ([], {'n_gpu_use': 'args.n_gpu_use', 'gpu_id': 'args.cuda_dev'}), '(n_gpu_use=a... |
from cafebabel import create_app, register_cli
app = create_app('config.DevelopmentConfig')
register_cli(app)
| [
"cafebabel.register_cli",
"cafebabel.create_app"
] | [((54, 92), 'cafebabel.create_app', 'create_app', (['"""config.DevelopmentConfig"""'], {}), "('config.DevelopmentConfig')\n", (64, 92), False, 'from cafebabel import create_app, register_cli\n'), ((93, 110), 'cafebabel.register_cli', 'register_cli', (['app'], {}), '(app)\n', (105, 110), False, 'from cafebabel import cr... |
import RPi.GPIO as gpio
class Output():
def __init__(self, pin, on_state = 0, name = ""):
self.pin = pin
self.on_state = on_state
self.name = name
self.off_state = 1 - on_state
gpio.setup(pin, gpio.OUT)
self.off()
print("[debug] set up pin", pin, "to be an ou... | [
"RPi.GPIO.setup",
"RPi.GPIO.input",
"RPi.GPIO.output"
] | [((222, 247), 'RPi.GPIO.setup', 'gpio.setup', (['pin', 'gpio.OUT'], {}), '(pin, gpio.OUT)\n', (232, 247), True, 'import RPi.GPIO as gpio\n'), ((355, 392), 'RPi.GPIO.output', 'gpio.output', (['self.pin', 'self.off_state'], {}), '(self.pin, self.off_state)\n', (366, 392), True, 'import RPi.GPIO as gpio\n'), ((458, 494), ... |
# -*- coding: utf-8 -*-
import argparse
import logging
import os
import shutil
from datetime import datetime
import time
import win32com.client
from pywintypes import com_error
from sqlalchemy import Column, Integer, String, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalch... | [
"logging.getLogger",
"logging.StreamHandler",
"time.sleep",
"sqlalchemy.String",
"sqlalchemy.Column",
"os.path.exists",
"sqlalchemy.orm.sessionmaker",
"argparse.ArgumentParser",
"sqlalchemy.create_engine",
"os.mkdir",
"os.path.dirname",
"sqlalchemy.ext.declarative.declarative_base",
"shutil.... | [((376, 559), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""[%(asctime)s][%(name)s][%(levelname)s] - %(message)s"""', 'datefmt': '"""%Y-%d-%m %H:%M:%S"""', 'level': 'logging.DEBUG', 'filename': '"""backup.log"""', 'filemode': '"""w"""'}), "(format=\n '[%(asctime)s][%(name)s][%(levelname)s] - %(me... |
#-*- coding:UTF-8 -*-
from setuptools import setup, find_packages
from autoremovetorrents.version import __version__
from autoremovetorrents.compatibility.disk_usage_ import SUPPORT_SHUTIL
from autoremovetorrents.compatibility.open_ import open_
setup(name = 'autoremove-torrents',
version = __version__,
descr... | [
"autoremovetorrents.compatibility.open_.open_",
"setuptools.find_packages"
] | [((930, 945), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (943, 945), False, 'from setuptools import setup, find_packages\n'), ((415, 457), 'autoremovetorrents.compatibility.open_.open_', 'open_', (['"""README.rst"""', '"""r"""'], {'encoding': '"""utf-8"""'}), "('README.rst', 'r', encoding='utf-8')\n... |
import pprint
stuff = {1:'abc', 2:'def', 3:['ghi', 'xyz'], 4:'jlm', 5:'nop', 6:["a","b","c","d", {"asd":"123", "cvb":345, "ert":[1,2,3,4,5], "rty":"abcdef"}], 7: "rst", 8:{1:1, 2:2, 3:3, 4:4}}
pp = pprint.PrettyPrinter(indent = 2, compact = False, depth = None)
pp.pprint(stuff) | [
"pprint.PrettyPrinter"
] | [((204, 261), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(2)', 'compact': '(False)', 'depth': 'None'}), '(indent=2, compact=False, depth=None)\n', (224, 261), False, 'import pprint\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-07-14 15:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('PeopleApp', '0017_faculty_list_position'),
]
operations = [
migrations.AddF... | [
"django.db.models.TextField",
"django.db.models.CharField"
] | [((412, 451), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (428, 451), False, 'from django.db import migrations, models\n'), ((585, 624), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=... |
"""Testing out and experimenting with the prediction algorithm"""
from elo import FRCElo
import pickle
import statistics
import math
default_stdev = 50
elo = FRCElo(qm_K=20, fm_K=5, new_team_rating=1350, init_stdev=default_stdev)
briers = []
year_briers = []
predictions_outcomes = []
i = 0
for year in range(2008... | [
"statistics.mean",
"elo.FRCElo.get_match_data",
"math.floor",
"pickle.load",
"elo.FRCElo"
] | [((161, 232), 'elo.FRCElo', 'FRCElo', ([], {'qm_K': '(20)', 'fm_K': '(5)', 'new_team_rating': '(1350)', 'init_stdev': 'default_stdev'}), '(qm_K=20, fm_K=5, new_team_rating=1350, init_stdev=default_stdev)\n', (167, 232), False, 'from elo import FRCElo\n'), ((1249, 1277), 'statistics.mean', 'statistics.mean', (['year_bri... |
from abc import ABCMeta, abstractmethod
from typing import Callable, Iterable, List, TypeVar, Tuple
from ..universe import Universe
T = TypeVar('T')
BaseUniverseType = TypeVar('BaseUniverseType', bound='BaseUniverse[T]')
class BaseUniverse(Universe[T]):
"""
Represents a base class for universes of 'The Game... | [
"typing.TypeVar"
] | [((138, 150), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (145, 150), False, 'from typing import Callable, Iterable, List, TypeVar, Tuple\n'), ((170, 222), 'typing.TypeVar', 'TypeVar', (['"""BaseUniverseType"""'], {'bound': '"""BaseUniverse[T]"""'}), "('BaseUniverseType', bound='BaseUniverse[T]')\n", (17... |
# first-order finite-difference implicit method for linear advection
#
# We are solving a_t + u a_x = 0
#
# The upwinded implicit update appears as:
#
# n+1 n+1 n
# -C a + (1 - C) a = a
# i-1 i i
#
# where C is the CFL number
#
# We use a periodic grid with N points, ... | [
"numpy.linalg.solve",
"matplotlib.pyplot.savefig",
"numpy.logical_and",
"matplotlib.pyplot.ylabel",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.zeros",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.legend"
] | [((3002, 3032), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""$x$"""'], {'fontsize': '(16)'}), "('$x$', fontsize=16)\n", (3012, 3032), True, 'import matplotlib.pyplot as plt\n'), ((3033, 3063), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""$a$"""'], {'fontsize': '(16)'}), "('$a$', fontsize=16)\n", (3043, 3063), Tru... |
import pyglet
import math
from pyglet import gl
def create_window(width, height, resize=False):
try:
config = pyglet.gl.Config(sample_buffers=1,
samples=4,
depth_size=24,
double_buffer=True)
windo... | [
"pyglet.gl.glVertex3f",
"pyglet.gl.gluNewQuadric",
"pyglet.gl.glTranslatef",
"pyglet.gl.glRotatef",
"pyglet.gl.glEnd",
"pyglet.gl.glPushMatrix",
"pyglet.gl.glColor4f",
"pyglet.gl.Config",
"math.radians",
"pyglet.gl.glBegin",
"math.cos",
"pyglet.window.Window",
"pyglet.gl.glEnable",
"math.s... | [((124, 209), 'pyglet.gl.Config', 'pyglet.gl.Config', ([], {'sample_buffers': '(1)', 'samples': '(4)', 'depth_size': '(24)', 'double_buffer': '(True)'}), '(sample_buffers=1, samples=4, depth_size=24, double_buffer=True\n )\n', (140, 209), False, 'import pyglet\n'), ((324, 410), 'pyglet.window.Window', 'pyglet.window... |
#!/usr/bin/python
#
#
#
#
# <NAME> (06 Jun 2017), contact: <EMAIL>
import sys
import pprint
pp = pprint.PrettyPrinter(indent=4)
#import ccbg_pipeline.task
from ccbg_pipeline import *
#print task_status.SUBMITTED
#pp.pprint( P )
#print ("Max retry: {}".format( P.max_retry ) )
#P.max_retry = 5
#print ("Max ret... | [
"pprint.PrettyPrinter"
] | [((102, 132), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(4)'}), '(indent=4)\n', (122, 132), False, 'import pprint\n')] |
from setuptools import setup
import os
def readme():
with open('README.md') as f:
return f.read()
setup(
name='accelergy-aladdin-plug-in',
version='0.1',
description='An energy estimation plug-in for Accelergy framework',
classifiers=[
'Development Status :: 3 - Alpha... | [
"setuptools.setup"
] | [((118, 1218), 'setuptools.setup', 'setup', ([], {'name': '"""accelergy-aladdin-plug-in"""', 'version': '"""0.1"""', 'description': '"""An energy estimation plug-in for Accelergy framework"""', 'classifiers': "['Development Status :: 3 - Alpha',\n 'License :: OSI Approved :: MIT License',\n 'Programming Language ... |
## -----------------------------------------------------------------------------
## Python Scripts scriptarium/[fname1.py]
## (c) <EMAIL>
## -----------------------------------------------------------------------------
import os, binascii
os.chdir('T:\\eBooks') # <- only ... | [
"os.chdir",
"os.urandom"
] | [((287, 309), 'os.chdir', 'os.chdir', (['"""T:\\\\eBooks"""'], {}), "('T:\\\\eBooks')\n", (295, 309), False, 'import os, binascii\n'), ((647, 661), 'os.urandom', 'os.urandom', (['(16)'], {}), '(16)\n', (657, 661), False, 'import os, binascii\n')] |
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
import os
image_size = (224, 224, 3)
def create_white_noise_dataset(n=1):
# creates uniform white noise
seeds = [i for i in range(n)]
for s in seeds:
rs = np.random.RandomState(seed=... | [
"PIL.Image.fromarray",
"os.listdir",
"PIL.Image.open",
"matplotlib.use",
"os.path.join",
"numpy.random.RandomState"
] | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (32, 39), False, 'import matplotlib\n'), ((293, 322), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': 's'}), '(seed=s)\n', (314, 322), True, 'import numpy as np\n'), ((417, 451), 'PIL.Image.fromarray', 'Image.fromarray'... |
import keras
from keras import layers
from keras import datasets
from keras.preprocessing.text import one_hot
from keras.preprocessing.sequence import pad_sequences
import numpy as np
from dnpy.layers import *
from dnpy.net import *
from dnpy.optimizers import *
from dnpy.regularizers import *
from dnpy import metrics... | [
"keras.datasets.imdb.load_data",
"dnpy.losses.BinaryCrossEntropy",
"numpy.random.seed",
"numpy.expand_dims",
"dnpy.metrics.BinaryAccuracy",
"keras.preprocessing.sequence.pad_sequences"
] | [((369, 387), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (383, 387), True, 'import numpy as np\n'), ((727, 790), 'keras.datasets.imdb.load_data', 'datasets.imdb.load_data', ([], {'maxlen': 'max_length', 'num_words': 'max_words'}), '(maxlen=max_length, num_words=max_words)\n', (750, 790), False, 'f... |
from __future__ import print_function
from __future__ import division
import random
import time
import itertools as it
import numpy as np
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)
from utils import load_data
from train_lstm import LSTM
from train_tdlstm import TDLSTM
from train_tclstm import TC... | [
"hyperopt.fmin",
"random.sample",
"tensorflow.reset_default_graph",
"utils.load_data",
"train_tclstm.TCLSTM",
"train_lstm.LSTM",
"itertools.product",
"tensorflow.logging.set_verbosity",
"hyperopt.hp.quniform",
"train_tdlstm.TDLSTM",
"numpy.random.randint",
"time.time",
"numpy.arange",
"hyp... | [((162, 204), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.ERROR'], {}), '(tf.logging.ERROR)\n', (186, 204), True, 'import tensorflow as tf\n'), ((680, 724), 'random.sample', 'random.sample', (['expanded_param_grid', 'sampsize'], {}), '(expanded_param_grid, sampsize)\n', (693, 724), Fal... |
import torch
from torch import nn
from torch.nn import functional as F
from .activations import sigmoid, HardSwish, Swish
from .utils_i2rnet import (
relu_fn,
round_filters,
round_repeats,
drop_connect,
get_same_padding_conv2d,
Conv2dDynamicSamePadding,
get_model_params,
efficientnet_par... | [
"torch.nn.BatchNorm2d",
"torch.nn.functional.adaptive_avg_pool2d",
"torch.nn.ModuleList",
"torch.sigmoid",
"torch.nn.functional.dropout",
"torch.nn.Linear",
"torch.cat"
] | [((2783, 2856), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', ([], {'num_features': 'oup', 'momentum': 'self._bn_mom', 'eps': 'self._bn_eps'}), '(num_features=oup, momentum=self._bn_mom, eps=self._bn_eps)\n', (2797, 2856), False, 'from torch import nn\n'), ((3451, 3530), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', ([], {'num... |
from minos.cqrs import (
CommandService,
)
from minos.networks import (
Request,
Response,
ResponseException,
enroute,
)
from ..aggregates import (
PaymentAggregate,
)
class PaymentCommandService(CommandService):
"""PaymentCommandService class."""
def validate_card(self, card_number:... | [
"minos.networks.ResponseException",
"minos.networks.Response",
"minos.networks.enroute.broker.command"
] | [((770, 809), 'minos.networks.enroute.broker.command', 'enroute.broker.command', (['"""CreatePayment"""'], {}), "('CreatePayment')\n", (792, 809), False, 'from minos.networks import Request, Response, ResponseException, enroute\n'), ((1448, 1488), 'minos.networks.Response', 'Response', (["{'status': 'payment accepted'}... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('newIndex/', views.newIndex, name='newIndex'),
path('newUser/', views.newUser, name='newUser'),
path('welcomeNewUser/', views.welcomeNewUser, name='welcomeNewUser'),
path('newBankUser/', view... | [
"django.urls.path"
] | [((71, 106), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (75, 106), False, 'from django.urls import path\n'), ((112, 162), 'django.urls.path', 'path', (['"""newIndex/"""', 'views.newIndex'], {'name': '"""newIndex"""'}), "('newIndex/', views.newI... |
# debug_signals
#
# Catbox module for emitting events while debugging and testing
#
# Authors:
# <NAME> / @jroscoe5
#
from time import sleep
from modules.base_module import BaseModule
class DebugSignalsModule(BaseModule):
"""
Emits events for debugging and testing
"""
def __init__(self) -> None:... | [
"time.sleep"
] | [((554, 563), 'time.sleep', 'sleep', (['(10)'], {}), '(10)\n', (559, 563), False, 'from time import sleep\n'), ((637, 646), 'time.sleep', 'sleep', (['(60)'], {}), '(60)\n', (642, 646), False, 'from time import sleep\n')] |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | [
"pyangbind.lib.yangtypes.YANGDynClass",
"__builtin__.property"
] | [((13528, 13600), '__builtin__.property', '__builtin__.property', (['_get_implicit_commit_all', '_set_implicit_commit_all'], {}), '(_get_implicit_commit_all, _set_implicit_commit_all)\n', (13548, 13600), False, 'import __builtin__\n'), ((13639, 13743), '__builtin__.property', '__builtin__.property', (['_get_implicit_co... |
from django.db import models
from django.urls import reverse
from django.conf import settings
from django.utils import timezone
from django.core.validators import RegexValidator
from django.contrib.auth.models import (
AbstractBaseUser,
BaseUserManager,
PermissionsMixin,
)
from simple_history.models import ... | [
"django.db.models.EmailField",
"django.db.models.ForeignKey",
"django.core.validators.RegexValidator",
"simple_history.models.HistoricalRecords",
"django.db.models.BooleanField",
"django.utils.timezone.now",
"django.urls.reverse",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((968, 1144), 'django.core.validators.RegexValidator', 'RegexValidator', (['"""^arn:aws:iam::[0-9]{12}:user/[a-zA-Z0-9-_]{1,64}$"""', '"""AWS IAM format invalid. Please use the following format: arn:aws:iam::123456789012:user/username"""'], {}), "('^arn:aws:iam::[0-9]{12}:user/[a-zA-Z0-9-_]{1,64}$',\n 'AWS IAM form... |
import logging
from .contants import MODES_CONVERTER
_LOGGER = logging.getLogger(__name__)
class Zone:
"""Manage a Airzonecloud zone"""
_api = None
_system = None
_data = {}
def __init__(self, api, system, data):
self._api = api
self._system = system
self._data = data
... | [
"logging.getLogger"
] | [((64, 91), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (81, 91), False, 'import logging\n')] |
from django.contrib.gis.db import models
from madrona.features import register
from madrona.features.models import PointFeature, LineFeature, PolygonFeature, FeatureCollection
from madrona.layers.models import PrivateLayerList
from madrona.features.forms import FeatureForm, SpatialFeatureForm
DESIGNATION_CHOICES = (
... | [
"django.contrib.gis.db.models.CharField",
"django.contrib.gis.db.models.FloatField"
] | [((478, 537), 'django.contrib.gis.db.models.CharField', 'models.CharField', ([], {'max_length': '(1)', 'choices': 'DESIGNATION_CHOICES'}), '(max_length=1, choices=DESIGNATION_CHOICES)\n', (494, 537), False, 'from django.contrib.gis.db import models\n'), ((1124, 1168), 'django.contrib.gis.db.models.CharField', 'models.C... |
from sys import argv
from time import sleep
def main():
print("Start SECOND script.")
if len(argv) > 2:
raise ValueError("Script takes only one argument.")
elif len(argv) < 2:
raise ValueError("Script argument is not specified.")
time = int(argv[1])
print(f"Sleep {time} seconds.... | [
"time.sleep"
] | [((330, 341), 'time.sleep', 'sleep', (['time'], {}), '(time)\n', (335, 341), False, 'from time import sleep\n')] |
# -*- coding: utf-8 -*-
#==========================================
# Title: CoCaBO_Base.py
# Author: <NAME> and <NAME>
# Date: 20 August 2019
# Link: https://arxiv.org/abs/1906.08878
#==========================================
import collections
import pickle
import random
import numpy as np
from scipy.optimize... | [
"numpy.sqrt",
"numpy.array",
"numpy.mean",
"numpy.where",
"numpy.max",
"numpy.exp",
"numpy.random.seed",
"numpy.vstack",
"numpy.argmin",
"numpy.abs",
"utils.probability.distr",
"utils.probability.draw",
"scipy.optimize.minimize",
"numpy.argmax",
"numpy.std",
"pickle.dump",
"utils.Dep... | [((2286, 2304), 'numpy.argmin', 'np.argmin', (['y_tries'], {}), '(y_tries)\n', (2295, 2304), True, 'import numpy as np\n'), ((2358, 2457), 'scipy.optimize.minimize', 'minimize', (['single_evaluation', 'x_init_min'], {'method': '"""BFGS"""', 'options': "{'gtol': 1e-06, 'disp': False}"}), "(single_evaluation, x_init_min,... |
from unittest import TestCase, mock
from ops.testing import Harness
import charm
class TestCharm(TestCase):
"""Ubuntu charm unit tests."""
@classmethod
def setUpClass(cls):
cls.pPath = mock.patch("charm.Path")
cls.mPath = cls.pPath.start()
cls.pcheck_call = mock.patch("charm.ch... | [
"ops.testing.Harness",
"unittest.mock.patch"
] | [((210, 234), 'unittest.mock.patch', 'mock.patch', (['"""charm.Path"""'], {}), "('charm.Path')\n", (220, 234), False, 'from unittest import TestCase, mock\n'), ((300, 330), 'unittest.mock.patch', 'mock.patch', (['"""charm.check_call"""'], {}), "('charm.check_call')\n", (310, 330), False, 'from unittest import TestCase,... |
import argparse
import os
import random
# import sys
# sys.path.insert(0, "")
import numpy as np
import habitat
from habitat.core.challenge import Challenge
class RandomWalker(habitat.Agent):
def __init__(self):
self._POSSIBLE_ACTIONS = np.array([0,1,2,3])
def reset(self):
pass
def act(se... | [
"numpy.random.choice",
"numpy.array",
"habitat.core.challenge.Challenge",
"argparse.ArgumentParser"
] | [((434, 459), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (457, 459), False, 'import argparse\n'), ((674, 696), 'habitat.core.challenge.Challenge', 'Challenge', ([], {'phase': 'phase'}), '(phase=phase)\n', (683, 696), False, 'from habitat.core.challenge import Challenge\n'), ((250, 272), 'nu... |
import argparse
import pickle
import socket
import sys
import gzip
from io import BytesIO
from hashlib import md5
import json
from flask import Flask, request, jsonify
from flask_cors import CORS
from gevent import pywsgi
from monte_carlo_lib import MonteCarloLib
app = Flask(__name__)
CORS(app, resources={r"/*": {"... | [
"argparse.ArgumentParser",
"flask_cors.CORS",
"flask.Flask",
"socket.socket",
"io.BytesIO",
"gzip.GzipFile",
"gevent.pywsgi.WSGIServer",
"sys.exit",
"flask.jsonify"
] | [((273, 288), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (278, 288), False, 'from flask import Flask, request, jsonify\n'), ((290, 335), 'flask_cors.CORS', 'CORS', (['app'], {'resources': "{'/*': {'origins': '*'}}"}), "(app, resources={'/*': {'origins': '*'}})\n", (294, 335), False, 'from flask_cors im... |
from __future__ import absolute_import
import six
import uuid
import bisect
from datetime import datetime
from pytz import utc
class WellKnownProjectOption(object):
def __init__(self, key, default=None, epoch_defaults=None):
self.key = key
self.default = default
self.epoch_defaults = epo... | [
"sentry.models.ProjectOption.objects.set_value",
"datetime.datetime.utcnow",
"six.itervalues",
"uuid.uuid4",
"sentry.models.ProjectOption.objects.get_value",
"bisect.bisect",
"sentry.models.ProjectOption.objects.unset_value"
] | [((1960, 2012), 'sentry.models.ProjectOption.objects.set_value', 'ProjectOption.objects.set_value', (['project', 'key', 'value'], {}), '(project, key, value)\n', (1991, 2012), False, 'from sentry.models import ProjectOption\n'), ((2250, 2323), 'sentry.models.ProjectOption.objects.get_value', 'ProjectOption.objects.get_... |
from keras import backend as K
import numpy as np
def Active_Contour_Loss(y_true, y_pred):
#y_pred = K.cast(y_pred, dtype = 'float64')
"""
lenth term
"""
x = y_pred[:,:,1:,:] - y_pred[:,:,:-1,:] # horizontal and vertical directions
y = y_pred[:,:,:,1:] - y_pred[:,:,:,:-1]
delta_x = x[:,:,1:,:-2]**2
del... | [
"numpy.ones",
"keras.backend.sum",
"keras.backend.sqrt",
"numpy.zeros",
"keras.backend.abs"
] | [((355, 379), 'keras.backend.abs', 'K.abs', (['(delta_x + delta_y)'], {}), '(delta_x + delta_y)\n', (360, 379), True, 'from keras import backend as K\n'), ((578, 597), 'numpy.ones', 'np.ones', (['(256, 256)'], {}), '((256, 256))\n', (585, 597), True, 'import numpy as np\n'), ((605, 625), 'numpy.zeros', 'np.zeros', (['(... |
"""Test the CLI."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
from bs4 import BeautifulSoup
from lander.cli import app
if TYPE_CHECKING:
from typer.testing import CliRunner
def test_build(runner: CliRunner, temp_cwd: Path) -> None:
source_path = Path(__f... | [
"pathlib.Path"
] | [((934, 959), 'pathlib.Path', 'Path', (['"""_build/index.html"""'], {}), "('_build/index.html')\n", (938, 959), False, 'from pathlib import Path\n'), ((1013, 1039), 'pathlib.Path', 'Path', (['"""_build/article.pdf"""'], {}), "('_build/article.pdf')\n", (1017, 1039), False, 'from pathlib import Path\n'), ((312, 326), 'p... |
import threading,time
class CountingThread(threading.Thread):
def __init__(self,name,high):
super(CountingThread,self).__init__()
self.name = name
self.high = high
self.count = 0
def run(self):
for i in range(0,self.high):
print("{}: {}".format(self.name,i))... | [
"time.sleep"
] | [((333, 348), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (343, 348), False, 'import threading, time\n')] |
import torch
from torch.utils.data import Dataset
from random import choice
from pytorch_pretrained_bert import BertTokenizer, BertModel
max_len = 400
device = "cuda:0"
# bert_path = './pretrain/bert-base-chinese/'
# tokenizer = BertTokenizer.from_pretrained(bert_path + 'vocab.txt')
# BERT = BertModel.from_pretrained(... | [
"random.choice",
"torch.LongTensor",
"torch.Tensor",
"torch.eq",
"torch.no_grad",
"torch.zeros_like"
] | [((5149, 5175), 'torch.LongTensor', 'torch.LongTensor', (['text_seq'], {}), '(text_seq)\n', (5165, 5175), False, 'import torch\n'), ((1388, 1410), 'torch.eq', 'torch.eq', (['text_seqs', '(0)'], {}), '(text_seqs, 0)\n', (1396, 1410), False, 'import torch\n'), ((1420, 1435), 'torch.no_grad', 'torch.no_grad', ([], {}), '(... |
from sys import stdin
from serial import Serial
import time
from sys import stdout
import datetime;
x0 = 506
y0 = 526
try:
ser = Serial("/dev/ttyUSB0", 9600)
except:
ser = Serial("/dev/ttyUSB1", 9600)
while True:
try:
readOut = stdin.readline()
if not ',' in readOut:
continue
... | [
"sys.stdin.readline",
"serial.Serial"
] | [((133, 161), 'serial.Serial', 'Serial', (['"""/dev/ttyUSB0"""', '(9600)'], {}), "('/dev/ttyUSB0', 9600)\n", (139, 161), False, 'from serial import Serial\n'), ((180, 208), 'serial.Serial', 'Serial', (['"""/dev/ttyUSB1"""', '(9600)'], {}), "('/dev/ttyUSB1', 9600)\n", (186, 208), False, 'from serial import Serial\n'), (... |
import unittest
from hidden_word import checkio
class Tests(unittest.TestCase):
TESTS = {
"Basics": [
{
"input": [
"""DREAMING of apples on a wall,
And dreaming often, dear,
I dreamed that, if I counted all,
-How many would appear?""",
"... | [
"unittest.main",
"hidden_word.checkio"
] | [((3221, 3236), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3234, 3236), False, 'import unittest\n'), ((3012, 3032), 'hidden_word.checkio', 'checkio', (["*i['input']"], {}), "(*i['input'])\n", (3019, 3032), False, 'from hidden_word import checkio\n'), ((3132, 3152), 'hidden_word.checkio', 'checkio', (["*i['inp... |
""" Web Routes """
from masonite.routes import Get, Post
from src.api.routes import JWTRoutes, TokenRoutes
from app.resources.UserResource import UserResource
ROUTES = [
Get().route('/', 'WelcomeController@show').name('welcome'),
UserResource('/api/user').routes(),
TokenRoutes('/token'),
JWTRoutes('/... | [
"masonite.routes.Get",
"src.api.routes.TokenRoutes",
"src.api.routes.JWTRoutes",
"app.resources.UserResource.UserResource"
] | [((281, 302), 'src.api.routes.TokenRoutes', 'TokenRoutes', (['"""/token"""'], {}), "('/token')\n", (292, 302), False, 'from src.api.routes import JWTRoutes, TokenRoutes\n'), ((308, 331), 'src.api.routes.JWTRoutes', 'JWTRoutes', (['"""/authorize"""'], {}), "('/authorize')\n", (317, 331), False, 'from src.api.routes impo... |
# Copyright (C) 2012 Red Hat, 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 ... | [
"nova.virt.image.model.LocalFileImage",
"nova.virt.image.model.LocalBlockImage",
"fixtures.MonkeyPatch",
"mock.patch",
"mock.patch.object",
"nova.virt.disk.vfs.guestfs.force_tcg",
"nova.virt.image.model.RBDImage",
"nova.virt.disk.vfs.guestfs.VFSGuestFS",
"mock.MagicMock"
] | [((11203, 11252), 'mock.patch.object', 'mock.patch.object', (['vfsimpl.VFSGuestFS', '"""setup_os"""'], {}), "(vfsimpl.VFSGuestFS, 'setup_os')\n", (11220, 11252), False, 'import mock\n'), ((11410, 11459), 'mock.patch.object', 'mock.patch.object', (['vfsimpl.VFSGuestFS', '"""setup_os"""'], {}), "(vfsimpl.VFSGuestFS, 'set... |
'''
超参数:
learning rate
weight decay
Dense: 全相联
BatchNormailization: (x-均值)/sqrt{标准差^2 + epsilon} * a + b
'''
import tensorflow as tf
import constants as c
from tensorflow import keras
from tensorflow.keras.layers import Activation, BatchNormalization, Conv2D, MaxPool2D, Flatten, Dense, Dropout
class AlexNet_BN... | [
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.Flatten",
"tensorflow.keras.layers.MaxPool2D"
] | [((510, 605), 'tensorflow.keras.layers.Conv2D', 'Conv2D', ([], {'filters': '(96)', 'kernel_size': '(11, 11)', 'strides': '(4, 4)', 'activation': '"""relu"""', 'padding': '"""same"""'}), "(filters=96, kernel_size=(11, 11), strides=(4, 4), activation='relu',\n padding='same')\n", (516, 605), False, 'from tensorflow.ke... |
import pytest
import stix2
from .constants import (
CAMPAIGN_ID, CAMPAIGN_KWARGS, FAKE_TIME, IDENTITY_ID, IDENTITY_KWARGS,
INDICATOR_ID, INDICATOR_KWARGS, MALWARE_ID, MALWARE_KWARGS,
RELATIONSHIP_IDS,
)
@pytest.fixture
def ds():
cam = stix2.v21.Campaign(id=CAMPAIGN_ID, **CAMPAIGN_KWARGS)
idy = s... | [
"stix2.v21.Identity",
"stix2.ObjectFactory",
"stix2.v21.StatementMarking",
"stix2.v21.MarkingDefinition",
"stix2.v21.ExternalReference",
"stix2.v21.Campaign",
"stix2.v21.Malware",
"stix2.MemoryStore",
"stix2.Filter",
"pytest.raises",
"stix2.MemorySink",
"stix2.v21.Relationship",
"stix2.Envir... | [((255, 308), 'stix2.v21.Campaign', 'stix2.v21.Campaign', ([], {'id': 'CAMPAIGN_ID'}), '(id=CAMPAIGN_ID, **CAMPAIGN_KWARGS)\n', (273, 308), False, 'import stix2\n'), ((319, 372), 'stix2.v21.Identity', 'stix2.v21.Identity', ([], {'id': 'IDENTITY_ID'}), '(id=IDENTITY_ID, **IDENTITY_KWARGS)\n', (337, 372), False, 'import ... |
__author__ = "<NAME> and <NAME>"
__version__ = "0.50"
try:
import faulthandler
faulthandler.enable()
except ImportError:
pass
import logging
logging.basicConfig(level=logging.INFO, format="[%(process)s] %(message)s")
import os
dirname = os.path.abspath(os.path.dirname(__file__))
libpath = os.path.join(dir... | [
"logging.basicConfig",
"os.path.join",
"os.path.dirname",
"neuron.load_mechanisms",
"faulthandler.enable"
] | [((155, 230), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""[%(process)s] %(message)s"""'}), "(level=logging.INFO, format='[%(process)s] %(message)s')\n", (174, 230), False, 'import logging\n'), ((304, 331), 'os.path.join', 'os.path.join', (['dirname', '""".."""'], {}), "(di... |
import gspread
from datetime import date
import docx
import sys
from oauth2client.service_account import ServiceAccountCredentials
from exercise import *
scope = ['https://www.googleapis.com/auth/spreadsheets', "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive"]
#validating credenti... | [
"oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name",
"datetime.date.today",
"gspread.authorize"
] | [((374, 443), 'oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name', 'ServiceAccountCredentials.from_json_keyfile_name', (['"""creds.json"""', 'scope'], {}), "('creds.json', scope)\n", (422, 443), False, 'from oauth2client.service_account import ServiceAccountCredentials\n'), ((449, 473), 'gsp... |
from dffml.util.asynctestcase import AsyncTestCase
from dffml_config_yaml.config import YamlConfigLoader
class TestConfig(AsyncTestCase):
async def test_dumpb_loadb(self):
async with YamlConfigLoader.withconfig({}) as configloader:
async with configloader() as ctx:
original = ... | [
"dffml_config_yaml.config.YamlConfigLoader.withconfig"
] | [((198, 229), 'dffml_config_yaml.config.YamlConfigLoader.withconfig', 'YamlConfigLoader.withconfig', (['{}'], {}), '({})\n', (225, 229), False, 'from dffml_config_yaml.config import YamlConfigLoader\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 t... | [
"os.listdir",
"oslo_utils.importutils.import_class",
"os.path.isdir",
"os.path.join"
] | [((837, 860), 'os.path.isdir', 'os.path.isdir', (['file_dir'], {}), '(file_dir)\n', (850, 860), False, 'import os\n'), ((1014, 1034), 'os.listdir', 'os.listdir', (['file_dir'], {}), '(file_dir)\n', (1024, 1034), False, 'import os\n'), ((1360, 1389), 'oslo_utils.importutils.import_class', 'importutils.import_class', (['... |
from collections import namedtuple
import tensorflow as tf
import tensorflow_addons as tfa
AugmentationConfig = namedtuple('AugmentationConfig', [
'angle_range',
'offset_range',
'scale_range',
'brightness_max_delta',
'contrast_min',
'contrast_max',
'hue_max_delta',
'saturation_min',
... | [
"tensorflow.random.uniform",
"tensorflow_addons.image.rotate",
"collections.namedtuple",
"tensorflow.shape",
"tensorflow.pad",
"tensorflow.transpose",
"tensorflow.image.resize",
"tensorflow.image.random_saturation",
"tensorflow.linalg.inv",
"tensorflow.concat",
"tensorflow.image.random_hue",
"... | [((114, 380), 'collections.namedtuple', 'namedtuple', (['"""AugmentationConfig"""', "['angle_range', 'offset_range', 'scale_range', 'brightness_max_delta',\n 'contrast_min', 'contrast_max', 'hue_max_delta', 'saturation_min',\n 'saturation_max']"], {'defaults': '[None, None, None, None, None, None, None, None, Non... |
"""Can message."""
from __future__ import annotations
from dataclasses import dataclass
from .arbitration_id import ArbitrationId
@dataclass(frozen=True)
class CanMessage:
"""A can message."""
arbitration_id: ArbitrationId
data: bytes
| [
"dataclasses.dataclass"
] | [((134, 156), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (143, 156), False, 'from dataclasses import dataclass\n')] |
import pytest
from click.testing import CliRunner
import dodola.cli
import dodola.services
@pytest.mark.parametrize(
"subcmd",
[
None,
"biascorrect",
"buildweights",
"rechunk",
"regrid",
"train-qdm",
"apply-qdm",
"correct-wetday-frequency",
... | [
"pytest.mark.parametrize",
"click.testing.CliRunner"
] | [((94, 511), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""subcmd"""', "[None, 'biascorrect', 'buildweights', 'rechunk', 'regrid', 'train-qdm',\n 'apply-qdm', 'correct-wetday-frequency', 'train-aiqpd', 'apply-aiqpd']"], {'ids': "('--help', 'biascorrect --help', 'buildweights --help', 'rechunk --help',\... |
from unittest.mock import MagicMock
import pytest
import os
from paramiko import Transport, SFTPClient
from prefect.tasks.sftp.sftp import SftpDownload, SftpUpload
@pytest.fixture
def mock_conn(monkeypatch):
sftp_conn = MagicMock()
transport = MagicMock(spec=Transport)
transport.connect = MagicMock(userna... | [
"unittest.mock.MagicMock",
"pytest.raises",
"prefect.Flow",
"prefect.tasks.sftp.sftp.SftpUpload",
"prefect.tasks.sftp.sftp.SftpDownload"
] | [((226, 237), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (235, 237), False, 'from unittest.mock import MagicMock\n'), ((254, 279), 'unittest.mock.MagicMock', 'MagicMock', ([], {'spec': 'Transport'}), '(spec=Transport)\n', (263, 279), False, 'from unittest.mock import MagicMock\n'), ((304, 353), 'unittest... |
import pandas as pd
import traceback
import logging
def onData(instance, args):
try:
payload = args[0]
df = payload.data
index = payload.toIdx
if 'dataframes' not in instance.custom:
instance.custom['dataframes'] = {}
if index not in instance.custom['dataframes']:
instance.custom['... | [
"traceback.format_exc",
"pandas.merge"
] | [((1116, 1208), 'pandas.merge', 'pd.merge', (["instance.custom['dataframes'][0]", "instance.custom['dataframes'][1]"], {'how': 'method'}), "(instance.custom['dataframes'][0], instance.custom['dataframes'][1],\n how=method)\n", (1124, 1208), True, 'import pandas as pd\n'), ((1370, 1392), 'traceback.format_exc', 'trac... |
import unittest
from transition_sampling.engines import ShootingResult
from transition_sampling.algo.aimless_shooting import AsyncAimlessShooting, \
generate_velocities
import numpy as np
import tempfile
class NextPositionTest(unittest.TestCase):
"""Test that picking the next position works"""
def test_... | [
"tempfile.TemporaryDirectory",
"numpy.histogram",
"transition_sampling.algo.aimless_shooting.generate_velocities",
"numpy.argmax",
"numpy.max",
"numpy.zeros",
"numpy.random.seed",
"numpy.linalg.norm",
"unittest.main",
"transition_sampling.algo.aimless_shooting.AsyncAimlessShooting",
"transition_... | [((3102, 3117), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3115, 3117), False, 'import unittest\n'), ((461, 478), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (475, 478), True, 'import numpy as np\n'), ((1422, 1439), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (1436, 1439)... |
#!/usr/bin/env python3
from http.server import HTTPServer, BaseHTTPRequestHandler
class MyRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
# Extract values from the query string
path, _, query_string = self.path.partition('?')
query = parse_qs(query_string)
self.send_re... | [
"http.server.HTTPServer"
] | [((1084, 1133), 'http.server.HTTPServer', 'HTTPServer', (["('localhost', 1080)", 'MyRequestHandler'], {}), "(('localhost', 1080), MyRequestHandler)\n", (1094, 1133), False, 'from http.server import HTTPServer, BaseHTTPRequestHandler\n')] |
# Copyright (c) 2019, NVIDIA CORPORATION. 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 appli... | [
"hpccm.building_blocks.arm_allinea_studio.arm_allinea_studio",
"logging.disable"
] | [((1161, 1191), 'logging.disable', 'logging.disable', (['logging.ERROR'], {}), '(logging.ERROR)\n', (1176, 1191), False, 'import logging\n'), ((1336, 1365), 'hpccm.building_blocks.arm_allinea_studio.arm_allinea_studio', 'arm_allinea_studio', ([], {'eula': '(True)'}), '(eula=True)\n', (1354, 1365), False, 'from hpccm.bu... |
import sys, os
sys.path.insert(1, "../")
sys.path.append("../../../")
sys.path.append("../../../competitors/AIF360/")
import numpy as np
np.random.seed(0)
from aif360.datasets import SalaryDataset, BinaryLabelDataset, StructuredDataset
from aif360.metrics import BinaryLabelDatasetMetric
from aif360.metrics import C... | [
"aif360.algorithms.inprocessing.adversarial_debiasing.AdversarialDebiasing",
"sys.path.insert",
"numpy.all",
"numpy.in1d",
"tensorflow.Session",
"find_discm_points.entire_test_suite",
"aif360.datasets.SalaryDataset",
"numpy.array",
"os.path.realpath",
"numpy.random.seed",
"load_salary.permutatio... | [((15, 40), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""../"""'], {}), "(1, '../')\n", (30, 40), False, 'import sys, os\n'), ((43, 71), 'sys.path.append', 'sys.path.append', (['"""../../../"""'], {}), "('../../../')\n", (58, 71), False, 'import sys, os\n'), ((72, 119), 'sys.path.append', 'sys.path.append', (['""... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .dataframe import DataFrame
from .dataframe import from_pandas
from .dataframe import to_pandas
import ray
import pandas as pd
__all__ = ["DataFrame", "from_pandas", "to_pandas"]
ray.register_custom_seri... | [
"ray.register_custom_serializer"
] | [((296, 357), 'ray.register_custom_serializer', 'ray.register_custom_serializer', (['pd.DataFrame'], {'use_pickle': '(True)'}), '(pd.DataFrame, use_pickle=True)\n', (326, 357), False, 'import ray\n'), ((358, 433), 'ray.register_custom_serializer', 'ray.register_custom_serializer', (['pd.core.indexes.base.Index'], {'use... |
import pandas as pd
import numpy as np
import re
import nltk
from utils.utils import *
import time
from ql_score import ql_score
import pickle
class QL:
alpha = 0.5
mu=1500.
_inverted_index = {}
# data_root = './'
# _term_stats_path = data_root + 'clueweb_stats/term_stats.pkl'
# _term_st... | [
"ql_score.ql_score.ql_score_f",
"pandas.read_pickle",
"nltk.corpus.stopwords.words",
"pandas.read_csv",
"pickle.load"
] | [((945, 983), 'nltk.corpus.stopwords.words', 'nltk.corpus.stopwords.words', (['"""english"""'], {}), "('english')\n", (972, 983), False, 'import nltk\n'), ((2110, 2166), 'pandas.read_csv', 'pd.read_csv', (['self._doc_stats_path'], {'sep': '"""\t"""', 'header': 'None'}), "(self._doc_stats_path, sep='\\t', header=None)\n... |
from buidl.bech32 import (
cbor_encode,
cbor_decode,
bc32encode,
bc32decode,
uses_only_bech32_chars,
)
from buidl.helper import is_intable
from binascii import a2b_base64, b2a_base64
from math import ceil
import hashlib
class BCURStringFormatError(RuntimeError):
pass
def bcur_encode(data):... | [
"hashlib.sha256",
"buidl.bech32.cbor_decode",
"binascii.b2a_base64",
"buidl.bech32.bc32encode",
"buidl.bech32.bc32decode",
"buidl.helper.is_intable",
"binascii.a2b_base64",
"buidl.bech32.uses_only_bech32_chars",
"buidl.bech32.cbor_encode"
] | [((383, 400), 'buidl.bech32.cbor_encode', 'cbor_encode', (['data'], {}), '(data)\n', (394, 400), False, 'from buidl.bech32 import cbor_encode, cbor_decode, bc32encode, bc32decode, uses_only_bech32_chars\n'), ((411, 427), 'buidl.bech32.bc32encode', 'bc32encode', (['cbor'], {}), '(cbor)\n', (421, 427), False, 'from buidl... |
# coding: utf8
# Copyright (c) 2019 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 requ... | [
"os.path.exists",
"models.model_builder.build_model",
"paddle.fluid.Program",
"argparse.ArgumentParser",
"utils.config.cfg.update_from_file",
"os.path.join",
"paddle.fluid.CPUPlace",
"pprint.pformat",
"paddle.fluid.io.save_inference_model",
"paddle.fluid.io.load_params",
"paddle.fluid.Executor",... | [((1007, 1080), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PaddleSeg Inference Model Exporter"""'}), "(description='PaddleSeg Inference Model Exporter')\n", (1030, 1080), False, 'import argparse\n'), ((2255, 2303), 'os.path.join', 'os.path.join', (['cfg.FREEZE.SAVE_DIR', '"""deploy.y... |
# Copyright 2015 Google Inc. 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 a... | [
"tensorflow.batch_matmul",
"numpy.reshape",
"numpy.random.rand",
"tensorflow.batch_cholesky",
"tensorflow.test.main",
"numpy.diag",
"numpy.array",
"numpy.dot",
"tensorflow.constant",
"six.moves.xrange",
"numpy.vstack",
"numpy.empty",
"tensorflow.matmul",
"numpy.tril",
"tensorflow.cholesk... | [((3532, 3546), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (3544, 3546), True, 'import tensorflow as tf\n'), ((2147, 2183), 'numpy.array', 'np.array', (['[[[1.0, 0.0], [0.0, 5.0]]]'], {}), '([[[1.0, 0.0], [0.0, 5.0]]])\n', (2155, 2183), True, 'import numpy as np\n'), ((2326, 2389), 'numpy.array', 'np.arr... |
"""Test CLI behavior."""
import os
import pytest
from _pytest.config import ExitCode
@pytest.mark.usefixtures("configure")
class TestCliUnit:
"""Test CLI behavior on unit test level."""
def test_adaptavist_disabled(self, pytester: pytest.Pytester):
"""Test absence of adaptavist config if disabled."... | [
"pytest.mark.usefixtures"
] | [((90, 126), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""configure"""'], {}), "('configure')\n", (113, 126), False, 'import pytest\n'), ((868, 910), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""adaptavist_mock"""'], {}), "('adaptavist_mock')\n", (891, 910), False, 'import pytest\n')] |
# License: BSD 3 clause
from copy import copy
from datetime import datetime
from typing import List, Tuple
import numpy as np
import pyspark.sql.functions as sf
import pytz
from pyspark.ml.feature import Bucketizer
from pyspark.sql import DataFrame
from scalpel.core.cohort import Cohort
from scalpel.core.util import... | [
"pyspark.sql.functions.lit",
"numpy.ceil",
"pyspark.ml.feature.Bucketizer",
"scalpel.core.cohort.Cohort",
"pyspark.sql.functions.col",
"scalpel.core.util.rename_df_columns",
"copy.copy"
] | [((6959, 7035), 'pyspark.ml.feature.Bucketizer', 'Bucketizer', ([], {'splits': 'self.age_groups', 'inputCol': 'input_col', 'outputCol': 'output_col'}), '(splits=self.age_groups, inputCol=input_col, outputCol=output_col)\n', (6969, 7035), False, 'from pyspark.ml.feature import Bucketizer\n'), ((7477, 7497), 'copy.copy',... |
# Copyright 2019 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn
#
# 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... | [
"lapy.FuncIO.export_ev",
"numpy.amin",
"numpy.cross",
"lapy.TriaMesh.TriaMesh",
"lapy.Solver.Solver",
"numpy.where",
"optparse.OptionParser",
"numpy.min",
"numpy.max",
"numpy.sum",
"lapy.read_geometry.read_geometry",
"numpy.empty",
"sys.exit",
"numpy.amax",
"nibabel.freesurfer.io.write_g... | [((2205, 2328), 'optparse.OptionParser', 'optparse.OptionParser', ([], {'version': '"""$Id: spherically_project,v 1.1 2017/01/30 20:42:08 ltirrell Exp $"""', 'usage': 'HELPTEXT'}), "(version=\n '$Id: spherically_project,v 1.1 2017/01/30 20:42:08 ltirrell Exp $',\n usage=HELPTEXT)\n", (2226, 2328), False, 'import ... |
# Copyright 2020 The TensorFlow Quantum Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | [
"cirq.GridQubit.rect",
"tensorflow_quantum.core.ops.noise.noisy_sampled_expectation_op.sampled_expectation",
"tensorflow_quantum.python.util.convert_to_tensor",
"cirq.GridQubit",
"cirq.DensityMatrixSimulator",
"tensorflow_quantum.python.util.get_supported_channels",
"absl.testing.parameterized.parameter... | [((10987, 11226), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (["[{'n_qubits': 13, 'batch_size': 1, 'noisy': False}, {'n_qubits': 6,\n 'batch_size': 25, 'noisy': False}, {'n_qubits': 6, 'batch_size': 10,\n 'noisy': True}, {'n_qubits': 8, 'batch_size': 1, 'noisy': True}]"], {}), "([{'n_qub... |
import datetime
from Comunidad.base import Session, engine, Base
from sqlalchemy import Column, Integer, String
class Persona(Base):
__tablename__ = 'persona'
id = Column(Integer, primary_key=True)
nombre = Column(String)
edad = Column(Integer)
def __init__(self, nombre, edad):
self.nombre = no... | [
"datetime.datetime.now",
"Comunidad.base.Session",
"sqlalchemy.Column",
"Comunidad.base.Base.metadata.create_all"
] | [((172, 205), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (178, 205), False, 'from sqlalchemy import Column, Integer, String\n'), ((218, 232), 'sqlalchemy.Column', 'Column', (['String'], {}), '(String)\n', (224, 232), False, 'from sqlalchemy import Column, I... |
from django.urls import path
from dev_tools.views import change_user, create_test_resourcing_request, index
app_name = "dev_tools"
urlpatterns = [
path("", index, name="index"),
path("change-user", change_user, name="change-user"),
path(
"create-test-resourcing-request",
create_test_reso... | [
"django.urls.path"
] | [((155, 184), 'django.urls.path', 'path', (['""""""', 'index'], {'name': '"""index"""'}), "('', index, name='index')\n", (159, 184), False, 'from django.urls import path\n'), ((190, 242), 'django.urls.path', 'path', (['"""change-user"""', 'change_user'], {'name': '"""change-user"""'}), "('change-user', change_user, nam... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"numpy.clip",
"os.getenv",
"jax.util.safe_zip",
"numpy.array",
"time.time"
] | [((2173, 2189), 'numpy.array', 'onp.array', (['times'], {}), '(times)\n', (2182, 2189), True, 'import numpy as onp\n'), ((2075, 2086), 'time.time', 'time.time', ([], {}), '()\n', (2084, 2086), False, 'import time\n'), ((2105, 2116), 'time.time', 'time.time', ([], {}), '()\n', (2114, 2116), False, 'import time\n'), ((17... |
from .exceptions import LoginError
import base64
import binascii
import json
import math
import random
import re
import requests
import rsa
import time
SPY_HEADERS = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
"Connec... | [
"json.loads",
"requests.Session",
"rsa.encrypt",
"rsa.PublicKey",
"random.random",
"time.time"
] | [((1531, 1549), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1547, 1549), False, 'import requests\n'), ((2081, 2101), 'json.loads', 'json.loads', (['resp_str'], {}), '(resp_str)\n', (2091, 2101), False, 'import json\n'), ((2413, 2448), 'rsa.PublicKey', 'rsa.PublicKey', (['rsa_publickey', '(65537)'], {}), ... |
import unittest
from unittest import mock
from printy.exceptions import InvalidFlag, InvalidInputType
from printy.core import Printy, WINDOWS
from printy.flags import Flags
class TestGlobalFlagsPrinty(unittest.TestCase):
""" Test case for formatting with a global set of flags specified """
def setUp(self):
... | [
"printy.flags.Flags.get_flag_values",
"printy.core.Printy",
"printy.core.Printy._to_int",
"unittest.mock.mock_open",
"printy.flags.Flags.get_end_of_line",
"printy.core.Printy._repr_value",
"printy.core.Printy._escape_special_chars",
"unittest.mock.patch"
] | [((4272, 4348), 'unittest.mock.patch', 'mock.patch', (['"""printy.core.Printy.set_windows_console_mode"""'], {'return_value': '(True)'}), "('printy.core.Printy.set_windows_console_mode', return_value=True)\n", (4282, 4348), False, 'from unittest import mock\n'), ((24803, 24860), 'unittest.mock.patch', 'mock.patch', (['... |