code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
from django.test import TestCase, Client
from django.contrib.auth.models import User
# Create your tests here.
from .views import (States,
redeem_voucher, get_num_tickets_exchanged,
get_num_tickets_exchanged_more_than_once, convert_to_date, convert_to_db_date, get_tickets_by_dates, get_tickets_by_states)
from... | [
"ticketer.recordlocator.models.AdditionalRedemption.objects.filter",
"nationalparks.models.FederalSite.objects.get",
"django.contrib.auth.models.User.objects.create_user",
"django.test.Client"
] | [((1161, 1222), 'nationalparks.models.FederalSite.objects.get', 'FederalSite.objects.get', ([], {'slug': '"""nf-talladega-talladega-ranger"""'}), "(slug='nf-talladega-talladega-ranger')\n", (1184, 1222), False, 'from nationalparks.models import FederalSite\n'), ((1479, 1540), 'nationalparks.models.FederalSite.objects.g... |
import numpy as np
from scipy import ndimage
Input = np.array([
[1, 2, 3, 4, 5],
[6, 7, 8, 9, 10],
[11, 12, 13, 14, 15],
[16, 17, 18, 19, 20],
[21, 22, 23, 24, 25]
])
kernel = np.array([
[0, 1, 1],
[1, 0, 0],
[0, 1, 0]
])
bias = -1
stride = 1
padding = 1
# In deep learning, the term... | [
"scipy.ndimage.correlate",
"numpy.array"
] | [((54, 169), 'numpy.array', 'np.array', (['[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, \n 20], [21, 22, 23, 24, 25]]'], {}), '([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17,\n 18, 19, 20], [21, 22, 23, 24, 25]])\n', (62, 169), True, 'import numpy as np\n'), ((198... |
import math
import numpy as np
from gym.envs.classic_control.mountain_car import MountainCarEnv
class RandMountainCarEnv(MountainCarEnv):
def __init__(self, goal_velocity=0, variance=0):
super().__init__(goal_velocity)
self.name = "MountainCar" + str(variance)
self.variance = variance
... | [
"numpy.random.normal",
"numpy.array",
"math.cos",
"numpy.clip"
] | [((717, 767), 'numpy.clip', 'np.clip', (['velocity', '(-self.max_speed)', 'self.max_speed'], {}), '(velocity, -self.max_speed, self.max_speed)\n', (724, 767), True, 'import numpy as np\n'), ((816, 871), 'numpy.clip', 'np.clip', (['position', 'self.min_position', 'self.max_position'], {}), '(position, self.min_position,... |
# -----------------------------------------------------------------------------
#
# P A G E B O T E X A M P L E S
#
# Copyright (c) 2016+ <NAME> + <NAME>
# www.pagebot.io
# Licensed under MIT conditions
#
# -----------------------------------------------------------------------------
#
# 09_Rotat... | [
"pagebot.fonttoolbox.objects.font.findFont",
"pagebot.toolbox.units.em",
"pagebot.getContext",
"pagebot.toolbox.units.pt",
"pagebot.document.Document",
"pagebot.toolbox.units.p"
] | [((981, 993), 'pagebot.getContext', 'getContext', ([], {}), '()\n', (991, 993), False, 'from pagebot import getContext\n'), ((1055, 1063), 'pagebot.toolbox.units.pt', 'pt', (['(1000)'], {}), '(1000)\n', (1057, 1063), False, 'from pagebot.toolbox.units import em, p, pt\n'), ((1108, 1115), 'pagebot.toolbox.units.pt', 'pt... |
from pytest import mark
@mark.principal
def check_passing():
assert True
@mark.bulk
@mark.xfail(reason="Will fail")
def check_fail():
assert False
@mark.principal
class FunctionsTests:
@mark.optional
def check_optional(self):
assert True
@mark.bulk
@mark.skip(reason="Some situation")
def... | [
"pytest.mark.skip",
"pytest.mark.xfail"
] | [((93, 123), 'pytest.mark.xfail', 'mark.xfail', ([], {'reason': '"""Will fail"""'}), "(reason='Will fail')\n", (103, 123), False, 'from pytest import mark\n'), ((282, 316), 'pytest.mark.skip', 'mark.skip', ([], {'reason': '"""Some situation"""'}), "(reason='Some situation')\n", (291, 316), False, 'from pytest import ma... |
# Generated by Django 2.1.2 on 2018-11-07 07:37
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wxapp', '0003_wxuser_testers'),
('goods', '0021_auto_20181105_1623'),
('trade', '0017_orderinfo_trade_no'),
... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.PositiveIntegerField",
"django.db.models.AutoField",
"django.db.models.DecimalField",
"django.db.models.DateTimeField"
] | [((5955, 6112), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'related_name': '"""items"""', 'to': '"""trade.Order"""', 'verbose_name': '"""所属订单"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.S... |
import os
from flask import Blueprint, request, redirect, current_app
from typing import *
from annie.blueprints.user.model import Assignment, Submission
from annie.blueprints.evaluation.model import Grade
from grader.lama_grading_helper.frontend.grading import (
GradingView,
Notebook,
NotebookFile,
)
fr... | [
"flask.Blueprint",
"annie.blueprints.user.model.Submission.get_by_filepath",
"grader.lama_grading_helper.frontend.grading.GradingView",
"grader.lama_grading_helper.frontend.grading.Notebook.from_file",
"annie.blueprints.user.model.Assignment.get_by_name",
"os.path.join"
] | [((561, 829), 'flask.Blueprint', 'Blueprint', (['"""grader"""', '__name__'], {'template_folder': '"""/Users/simon/Desktop/Masterarbeit/code/annie/grader/lama_grading_helper/templates"""', 'url_prefix': '"""/grader"""', 'static_folder': '"""/Users/simon/Desktop/Masterarbeit/code/annie/grader/lama_grading_helper/static""... |
# Computes expected results for `testRNN()` in `Tests/TensorFlowTests/LayerTests.swift`.
# Requires 'tensorflow>=2.0.0a0' (e.g. "pip install tensorflow==2.2.0").
import numpy
import tensorflow as tf
# Set random seed for repetable results
tf.random.set_seed(0)
def indented(s):
return '\n'.join([' ' + l for l ... | [
"tensorflow.random.set_seed",
"tensorflow.reduce_sum",
"numpy.format_float_positional",
"tensorflow.keras.Input",
"numpy.array2string",
"tensorflow.keras.Model",
"tensorflow.keras.initializers.GlorotUniform",
"tensorflow.keras.layers.SimpleRNN",
"tensorflow.GradientTape"
] | [((241, 262), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(0)'], {}), '(0)\n', (259, 262), True, 'import tensorflow as tf\n'), ((884, 983), 'tensorflow.keras.layers.SimpleRNN', 'tf.keras.layers.SimpleRNN', ([], {'units': '(4)', 'activation': '"""tanh"""', 'return_sequences': '(True)', 'return_state': '(True)... |
from argparse import ArgumentParser
import os
import random
import string
from pymongo import MongoClient
import yaml
from MPenv.mpenv import CONFIG_TAG
__author__ = '<NAME>'
__copyright__ = 'Copyright 2013, The Materials Project'
__version__ = '0.1'
__maintainer__ = '<NAME>'
__email__ = '<EMAIL>'
__date__ = 'Aug 21, ... | [
"pymongo.MongoClient",
"os.path.abspath",
"os.makedirs",
"argparse.ArgumentParser",
"os.getcwd",
"random.choice",
"os.path.join",
"os.urandom"
] | [((432, 473), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': 'm_description'}), '(description=m_description)\n', (446, 473), False, 'from argparse import ArgumentParser\n'), ((877, 918), 'os.path.join', 'os.path.join', (['module_dir', '"""makedb_static"""'], {}), "(module_dir, 'makedb_static')\n", (8... |
from humanize import intcomma
from datetime import datetime
import mwclient
from itertools import islice
site = mwclient.Site('en.wikipedia.org')
CATEGORY = 'Living people'
t0 = datetime.now()
pages = 0
found = 0
for page in site.categories[CATEGORY]:
if not isinstance(page, mwclient.listing.Category):
... | [
"mwclient.Site",
"datetime.datetime.now",
"humanize.intcomma"
] | [((113, 146), 'mwclient.Site', 'mwclient.Site', (['"""en.wikipedia.org"""'], {}), "('en.wikipedia.org')\n", (126, 146), False, 'import mwclient\n'), ((181, 195), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (193, 195), False, 'from datetime import datetime\n'), ((613, 628), 'humanize.intcomma', 'intcomma'... |
""" Subsystem to communicate with catalog service
"""
import logging
from asyncio import CancelledError
from typing import Dict, List, Optional
from aiohttp import ContentTypeError, web
from yarl import URL
from servicelib.application_keys import APP_OPENAPI_SPECS_KEY
from servicelib.application_setup import ModuleC... | [
"servicelib.rest_routing.iter_path_operations",
"servicelib.rest_responses.wrap_as_envelope",
"aiohttp.web.HTTPServiceUnavailable",
"aiohttp.web.json_response",
"yarl.URL",
"yarl.URL.build",
"logging.getLogger",
"servicelib.application_setup.app_module_setup"
] | [((750, 777), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (767, 777), False, 'import logging\n'), ((4685, 4797), 'servicelib.application_setup.app_module_setup', 'app_module_setup', (['__name__', 'ModuleCategory.ADDON'], {'depends': "['simcore_service_webserver.rest']", 'logger': 'logg... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, <EMAIL> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
def after_migrate(**args):
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
custom_fields = {
... | [
"frappe.custom.doctype.custom_field.custom_field.create_custom_fields"
] | [((1082, 1117), 'frappe.custom.doctype.custom_field.custom_field.create_custom_fields', 'create_custom_fields', (['custom_fields'], {}), '(custom_fields)\n', (1102, 1117), False, 'from frappe.custom.doctype.custom_field.custom_field import create_custom_fields\n')] |
from inspect import isawaitable, signature
from typing import Optional, Callable, List
from .track import Track
try:
from discord import VoiceChannel, Guild
except ImportError:
try:
from discordjspy import VoiceChannel, Guild
except ImportError:
raise ImportError("You don't have discord.py ... | [
"inspect.signature",
"inspect.isawaitable"
] | [((6252, 6282), 'inspect.signature', 'signature', (['self.track_callback'], {}), '(self.track_callback)\n', (6261, 6282), False, 'from inspect import isawaitable, signature\n'), ((6535, 6551), 'inspect.isawaitable', 'isawaitable', (['out'], {}), '(out)\n', (6546, 6551), False, 'from inspect import isawaitable, signatur... |
# -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. 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/LICENS... | [
"numpy.zeros",
"vega.common.ClassFactory.register",
"numpy.clip"
] | [((1183, 1225), 'vega.common.ClassFactory.register', 'ClassFactory.register', (['ClassType.TRANSFORM'], {}), '(ClassType.TRANSFORM)\n', (1204, 1225), False, 'from vega.common import ClassFactory, ClassType\n'), ((2346, 2394), 'numpy.clip', 'np.clip', (['gt_bboxes[:, 0::2]', '(0)', '(img_shape[1] - 1)'], {}), '(gt_bboxe... |
from dataclasses import dataclass
from nafparserpy.layers.utils import create_node
@dataclass
class Raw:
"""Raw layer class"""
text: str
"""raw text"""
def node(self):
"""Create etree node from object"""
return create_node('raw', self.text, [], {})
@staticmethod
def object(n... | [
"nafparserpy.layers.utils.create_node"
] | [((247, 284), 'nafparserpy.layers.utils.create_node', 'create_node', (['"""raw"""', 'self.text', '[]', '{}'], {}), "('raw', self.text, [], {})\n", (258, 284), False, 'from nafparserpy.layers.utils import create_node\n')] |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... | [
"nicos_mlz.devices.experiment.Experiment.newSample",
"nicos.utils.safeName",
"os.path.join"
] | [((1614, 1642), 'nicos.utils.safeName', 'safeName', (["parameters['name']"], {}), "(parameters['name'])\n", (1622, 1642), False, 'from nicos.utils import safeName\n'), ((1651, 1690), 'nicos_mlz.devices.experiment.Experiment.newSample', '_Experiment.newSample', (['self', 'parameters'], {}), '(self, parameters)\n', (1672... |
# Copyright (c) 2017 The Regents of the University of Michigan
# All rights reserved.
# This software is licensed under the BSD 3-Clause License.
import os
import json
import unittest
import subprocess
import signac
from signac.common import six
if six.PY2:
from tempdir import TemporaryDirectory
else:
from te... | [
"unittest.main",
"os.mkdir",
"subprocess.Popen",
"tempfile.TemporaryDirectory",
"json.loads",
"os.getcwd",
"os.path.isdir",
"os.path.realpath",
"signac.Project",
"os.environ.get",
"signac.index",
"signac.get_project",
"os.path.join",
"os.chdir"
] | [((9707, 9722), 'unittest.main', 'unittest.main', ([], {}), '()\n', (9720, 9722), False, 'import unittest\n'), ((776, 804), 'os.environ.get', 'os.environ.get', (['"""PYTHONPATH"""'], {}), "('PYTHONPATH')\n", (790, 804), False, 'import os\n'), ((1030, 1066), 'tempfile.TemporaryDirectory', 'TemporaryDirectory', ([], {'pr... |
# ПРИМЕР ПОЛУЧЕНИЯ ДАННЫХ ПО ШИНЕ I2C:
#
from time import sleep
from pyiArduinoI2Ctds import * # Подключаем библиотеку для работы с TDS/EC-метром I2C-flash.
tds = pyiArduinoI2Ctds(0x09) # Объявляем объект tds для работы с фун... | [
"time.sleep"
] | [((1423, 1431), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (1428, 1431), False, 'from time import sleep\n')] |
from eth.constants import ZERO_HASH32
from eth_typing import BLSPubkey, BLSSignature, Hash32
from eth_utils import encode_hex
import ssz
from ssz.sedes import bytes32, bytes48, bytes96, uint64
from eth2.beacon.constants import EMPTY_SIGNATURE
from eth2.beacon.typing import Gwei
from .defaults import default_bls_pubke... | [
"eth_utils.encode_hex"
] | [((1302, 1333), 'eth_utils.encode_hex', 'encode_hex', (['self.hash_tree_root'], {}), '(self.hash_tree_root)\n', (1312, 1333), False, 'from eth_utils import encode_hex\n')] |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets 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 appl... | [
"tensorflow.compat.v2.io.gfile.GFile",
"tensorflow_datasets.public_api.features.ClassLabel",
"tensorflow_datasets.public_api.features.Tensor",
"tensorflow_datasets.public_api.core.Version",
"tensorflow_datasets.public_api.core.SplitGenerator"
] | [((2944, 3016), 'tensorflow_datasets.public_api.core.Version', 'tfds.core.Version', (['"""1.0.0"""'], {'experiments': '{tfds.core.Experiment.S3: False}'}), "('1.0.0', experiments={tfds.core.Experiment.S3: False})\n", (2961, 3016), True, 'import tensorflow_datasets.public_api as tfds\n'), ((3079, 3167), 'tensorflow_data... |
import io
import pytest
from ibidem.advent_of_code.y2021.dec09 import load, part1, part2, find_basin
LOW_POINTS = [(1, 0), (2, 2), (6, 4), (9, 0)]
TEST_INPUT = io.StringIO("""\
2199943210
3987894921
9856789892
8767896789
9899965678
""")
PART1_RESULT = 15
PART2_RESULT = 1134
class TestDec09():
@pytest.fixture
... | [
"io.StringIO",
"ibidem.advent_of_code.y2021.dec09.part2",
"ibidem.advent_of_code.y2021.dec09.load",
"ibidem.advent_of_code.y2021.dec09.find_basin",
"ibidem.advent_of_code.y2021.dec09.part1"
] | [((163, 237), 'io.StringIO', 'io.StringIO', (['"""2199943210\n3987894921\n9856789892\n8767896789\n9899965678\n"""'], {}), '("""2199943210\n3987894921\n9856789892\n8767896789\n9899965678\n""")\n', (174, 237), False, 'import io\n'), ((459, 470), 'ibidem.advent_of_code.y2021.dec09.load', 'load', (['input'], {}), '(input)\... |
"""Helper class for custom sql functions for use with pypika queries."""
from pypika import CustomFunction
# Presto SQL functions
SplitPart = CustomFunction("SPLIT_PART", ["string", "delimiter", "part"])
Position = CustomFunction("POSITION", ["input"])
MinBy = CustomFunction("MIN_BY", ["value1", "value2"])
# Post... | [
"pypika.CustomFunction"
] | [((144, 205), 'pypika.CustomFunction', 'CustomFunction', (['"""SPLIT_PART"""', "['string', 'delimiter', 'part']"], {}), "('SPLIT_PART', ['string', 'delimiter', 'part'])\n", (158, 205), False, 'from pypika import CustomFunction\n'), ((218, 255), 'pypika.CustomFunction', 'CustomFunction', (['"""POSITION"""', "['input']"]... |
import yaml
import os
from collections import namedtuple
class Configuration(object):
def __init__(self, config_file):
self.app_home = os.environ['APP_HOME']
with open(self.app_home + '/config/vegamite/' + config_file) as config_file:
settings = yaml.load(config_file)
for... | [
"yaml.load"
] | [((813, 829), 'yaml.load', 'yaml.load', (['_file'], {}), '(_file)\n', (822, 829), False, 'import yaml\n'), ((282, 304), 'yaml.load', 'yaml.load', (['config_file'], {}), '(config_file)\n', (291, 304), False, 'import yaml\n')] |
import multiprocessing
import os
if os.environ.get('TRAVIS') == 'true':
workers = 2
else:
workers = multiprocessing.cpu_count()
bind = '0.0.0.0:8080'
keepalive = 120
errorlog = '-'
pidfile = 'gunicorn.pid'
worker_class = 'aiohttp.worker.GunicornUVLoopWebWorker'
| [
"os.environ.get",
"multiprocessing.cpu_count"
] | [((37, 61), 'os.environ.get', 'os.environ.get', (['"""TRAVIS"""'], {}), "('TRAVIS')\n", (51, 61), False, 'import os\n'), ((109, 136), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (134, 136), False, 'import multiprocessing\n')] |
#!/usr/bin/env python3
"""convert yaml on stdin to json on stdout"""
import copy
import json
import yaml
import re
from collections import defaultdict
SCHEMA_DEF_KEYWORD_BY_VERSION = {
"http://json-schema.org/draft-07/schema": "definitions",
"http://json-schema.org/draft/2020-12/schema": "$defs"
}
ref_re = r... | [
"json.dump",
"copy.deepcopy",
"yaml.dump",
"collections.defaultdict",
"re.compile"
] | [((319, 352), 're.compile', 're.compile', (['""":ref:`(.*?)(<.*>)?`"""'], {}), "(':ref:`(.*?)(<.*>)?`')\n", (329, 352), False, 'import re\n'), ((364, 395), 're.compile', 're.compile', (['"""`(.*)\\\\<(.*)\\\\>`_"""'], {}), "('`(.*)\\\\<(.*)\\\\>`_')\n", (374, 395), False, 'import re\n'), ((530, 555), 'copy.deepcopy', '... |
# Copyright The IETF Trust 2021, 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 o... | [
"os.path.dirname",
"os.chdir"
] | [((1482, 1513), 'os.path.dirname', 'os.path.dirname', (['yang_file_path'], {}), '(yang_file_path)\n', (1497, 1513), False, 'import os\n'), ((1522, 1539), 'os.chdir', 'os.chdir', (['workdir'], {}), '(workdir)\n', (1530, 1539), False, 'import os\n')] |
"""
build_lib_power.py
Copyright 2015 <NAME>
Licensed under the MIT licence, see LICENSE file for details.
Generate generic power symbols for supply and ground nets.
"""
from __future__ import print_function, division
import sys
import os.path
PWR_NAMES = [
"VCC", "VDD", "AVCC", "AVDD",
"1v2", "1v8", "2v5", "... | [
"sys.exit"
] | [((2844, 2855), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (2852, 2855), False, 'import sys\n'), ((2642, 2653), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (2650, 2653), False, 'import sys\n'), ((2745, 2756), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (2753, 2756), False, 'import sys\n')] |
import requests
import ast
import time
from datetime import datetime
from notify_run import Notify
date_range = ['01-05-2021','08-05-2021','15-05-2021','22-05-2021','29-05-2021'] #Range of dates you want to search
notify=Notify()
notify.register()
district_id = 188 # District id. Refer to DISTRICTS file.
polling_rate ... | [
"requests.packages.urllib3.disable_warnings",
"time.sleep",
"notify_run.Notify",
"requests.get",
"ast.literal_eval",
"datetime.datetime.now"
] | [((222, 230), 'notify_run.Notify', 'Notify', ([], {}), '()\n', (228, 230), False, 'from notify_run import Notify\n'), ((1911, 1955), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', ([], {}), '()\n', (1953, 1955), False, 'import requests\n'), ((380, 594), 'requests.get', 'requ... |
import numpy as np
import pandas as pd
import warnings
from scipy import sparse
from sklearn.base import BaseEstimator
from libpysal import weights
from esda.crand import (
crand as _crand_plus,
njit as _njit,
_prepare_univariate,
_prepare_bivariate,
)
PERMUTATIONS = 999
class Join_Counts_Local_BV(B... | [
"esda.crand.njit",
"libpysal.weights.util.fill_diagonal",
"esda.crand._prepare_univariate",
"esda.crand._prepare_bivariate",
"numpy.array",
"pandas.Series",
"numpy.column_stack"
] | [((8528, 8548), 'esda.crand.njit', '_njit', ([], {'fastmath': '(True)'}), '(fastmath=True)\n', (8533, 8548), True, 'from esda.crand import crand as _crand_plus, njit as _njit, _prepare_univariate, _prepare_bivariate\n'), ((8828, 8848), 'esda.crand.njit', '_njit', ([], {'fastmath': '(True)'}), '(fastmath=True)\n', (8833... |
import textwrap
import math
import ipyleaflet
import IPython
import ipywidgets as widgets
import traitlets
from .clearable import ClearableOutput
from .inspector import PixelInspector
from .layer import WorkflowsLayer
from .lonlat import LonLatInput
from .utils import tuple_move
EARTH_EQUATORIAL_RADIUS_WGS84_M = 637... | [
"textwrap.dedent",
"traitlets.Int",
"traitlets.Bool",
"traitlets.List",
"ipyleaflet.ScaleControl",
"math.sqrt",
"ipywidgets.link",
"math.radians",
"math.tan",
"descarteslabs.scenes.AOI",
"ipyleaflet.FullScreenControl",
"math.floor",
"math.sin",
"IPython.display.display",
"traitlets.obser... | [((341, 391), 'ipywidgets.Layout', 'widgets.Layout', ([], {'height': '"""100%"""', 'padding': '"""0 0 8px 0"""'}), "(height='100%', padding='0 0 8px 0')\n", (355, 391), True, 'import ipywidgets as widgets\n'), ((4591, 4680), 'traitlets.Bool', 'traitlets.Bool', ([], {'default_value': '(True)', 'help': '"""Show controls ... |
"""\
I *hate* writing modules like this... but, I always seem to end up with one
after some amount of time.
They're never what I want, maybe because what I want is to not have to write
this kind of code. Doesn't everyone have to print shit out? Like, exceptions?
I also constantly debate if these modules are even wort... | [
"inspect.isclass",
"shlex.quote"
] | [((1522, 1540), 'inspect.isclass', 'inspect.isclass', (['x'], {}), '(x)\n', (1537, 1540), False, 'import inspect\n'), ((1223, 1241), 'shlex.quote', 'shlex.quote', (['token'], {}), '(token)\n', (1234, 1241), False, 'import shlex\n')] |
if __name__ == '__main__':
def _xpython_get_connection_filename():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-f', help='Jupyter kernel connection filename')
args = parser.parse_args()
return args.f
from xpython import launch as _xpython_laun... | [
"argparse.ArgumentParser"
] | [((112, 137), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (135, 137), False, 'import argparse\n')] |
from django.contrib import admin
from weather.models import City
# Register your models here.
admin.site.register(City) | [
"django.contrib.admin.site.register"
] | [((95, 120), 'django.contrib.admin.site.register', 'admin.site.register', (['City'], {}), '(City)\n', (114, 120), False, 'from django.contrib import admin\n')] |
import numpy as np
import pandas as pd
import ipywidgets as widgets
from ipywidgets import GridspecLayout, Layout
from IPython.display import display
from techminer.core import explode
from techminer.core.filter_records import filter_records
class App:
def __init__(self) -> None:
self.app_layout = Gri... | [
"pandas.read_csv",
"techminer.core.explode",
"IPython.display.display",
"ipywidgets.Output",
"ipywidgets.GridspecLayout",
"ipywidgets.Layout"
] | [((317, 353), 'ipywidgets.GridspecLayout', 'GridspecLayout', (['(9)', '(4)'], {'height': '"""870px"""'}), "(9, 4, height='870px')\n", (331, 353), False, 'from ipywidgets import GridspecLayout, Layout\n'), ((733, 800), 'techminer.core.explode', 'explode', (["x[['Source_title', 'Num_Documents', 'ID']]", '"""Source_title"... |
#!/usr/bin/env python3
from profilehooks import timecall
from aoclib import read_resource
@timecall()
def solve(input: list[str]) -> int:
result = 0
for c in input:
l, w, h = map(int, c.split('x'))
m = min(l + w, w + h, h + l)
result += 2 * m + l * w * h
return result
def main(... | [
"profilehooks.timecall",
"aoclib.read_resource"
] | [((95, 105), 'profilehooks.timecall', 'timecall', ([], {}), '()\n', (103, 105), False, 'from profilehooks import timecall\n'), ((342, 364), 'aoclib.read_resource', 'read_resource', (['(2015)', '(2)'], {}), '(2015, 2)\n', (355, 364), False, 'from aoclib import read_resource\n')] |
import random
from resources import dict_char_to_phonetic
from .base_operation import BaseOperation
from .utils import is_chinese_character
class ToPhonetic(BaseOperation):
"""Replace characters to its phonetically similar ones"""
def __init__(self):
super(ToPhonetic, self).__init__()
self.... | [
"resources.dict_char_to_phonetic"
] | [((327, 350), 'resources.dict_char_to_phonetic', 'dict_char_to_phonetic', ([], {}), '()\n', (348, 350), False, 'from resources import dict_char_to_phonetic\n')] |
import iam
import vpc
import utils
import pulumi
from pulumi_aws import eks
## EKS Cluster
eks_cluster = eks.Cluster(
'eks-cluster',
role_arn=iam.eks_role.arn,
tags={
'Name': 'pulumi-eks-cluster',
},
vpc_config=eks.ClusterVpcConfigArgs(
public_access_cidrs=['0.0.0.0/0'],
se... | [
"utils.generate_kube_config",
"pulumi.export",
"pulumi_aws.eks.NodeGroupScalingConfigArgs",
"pulumi_aws.eks.ClusterVpcConfigArgs"
] | [((798, 845), 'pulumi.export', 'pulumi.export', (['"""cluster-name"""', 'eks_cluster.name'], {}), "('cluster-name', eks_cluster.name)\n", (811, 845), False, 'import pulumi\n'), ((874, 913), 'utils.generate_kube_config', 'utils.generate_kube_config', (['eks_cluster'], {}), '(eks_cluster)\n', (900, 913), False, 'import u... |
from os import walk
import pandas as pd
import statsmodels.api as sm
import sys
# OLS Regression Model calculator
# Estimates the complexity values based on the N value and
# the weights given to each similarity measure
files = [
# "45_11275.42_bw-simulation.csv",
# "49_81574.52_bw-maven.csv",
"58_3968.0_LdoD-test.... | [
"pandas.DataFrame",
"statsmodels.api.add_constant",
"pandas.read_csv",
"statsmodels.api.OLS"
] | [((1163, 1179), 'pandas.DataFrame', 'pd.DataFrame', (['df'], {}), '(df)\n', (1175, 1179), True, 'import pandas as pd\n'), ((1254, 1272), 'statsmodels.api.add_constant', 'sm.add_constant', (['X'], {}), '(X)\n', (1269, 1272), True, 'import statsmodels.api as sm\n'), ((1281, 1293), 'statsmodels.api.OLS', 'sm.OLS', (['y', ... |
from keras import Model
from keras.layers import Input
from keras.optimizers import RMSprop
from ..utils.config import IMAGE_SIZE
from .sequence_decoder import SequenceDecoder
from .sketch_encoder import SketchEncoder
__all__ = [
'NeuralSketchCoding',
]
class NeuralSketchCoding:
"""Neural Sketch Coding
... | [
"keras.layers.Input",
"keras.optimizers.RMSprop",
"keras.Model"
] | [((1123, 1160), 'keras.layers.Input', 'Input', (['IMAGE_SIZE'], {'name': '"""image_input"""'}), "(IMAGE_SIZE, name='image_input')\n", (1128, 1160), False, 'from keras.layers import Input\n'), ((1191, 1230), 'keras.layers.Input', 'Input', (['(maxlen,)'], {'name': '"""sequence_input"""'}), "((maxlen,), name='sequence_inp... |
import kinomodel
kinomodel.main(pdb='3pp0', chain='A', feature='conf', coord='pdb')
| [
"kinomodel.main"
] | [((18, 84), 'kinomodel.main', 'kinomodel.main', ([], {'pdb': '"""3pp0"""', 'chain': '"""A"""', 'feature': '"""conf"""', 'coord': '"""pdb"""'}), "(pdb='3pp0', chain='A', feature='conf', coord='pdb')\n", (32, 84), False, 'import kinomodel\n')] |
from __future__ import division
from __future__ import print_function
import time
import os
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
# Train on CPU (hide GPU) due to memory constraints
os.environ['CUDA_VISIBLE_DEVICES'] = ""
#import tensorflow as tf
import tensorflow.compat.v1 as tf
tf... | [
"matplotlib.pyplot.title",
"tensorflow.compat.v1.placeholder_with_default",
"gae.model.GCNModelAE",
"numpy.exp",
"scipy.sparse.eye",
"tensorflow.compat.v1.global_variables_initializer",
"tensorflow.compat.v1.name_scope",
"matplotlib.pyplot.close",
"os.path.exists",
"tensorflow.compat.v1.Session",
... | [((111, 132), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (125, 132), False, 'import matplotlib\n'), ((318, 342), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (340, 342), True, 'import tensorflow.compat.v1 as tf\n'), ((1820, 1842), 'gae.input_data.loa... |
import pytest
from proposals.models import TalkProposal, TutorialProposal
@pytest.fixture
def proposals(user):
for t in ['Fluidity Shoes', 'Post-rifle cardboard', 'Face forwards pen']:
TalkProposal.objects.create(submitter=user, title=t)
for t in ['Crypto-bicycle', 'receding tattoo', 'A.I. monofilam... | [
"proposals.models.TalkProposal.objects.create",
"proposals.models.TalkProposal.objects.all",
"proposals.models.TutorialProposal.objects.create",
"proposals.models.TutorialProposal.objects.all",
"pytest.mark.xfail"
] | [((1754, 1819), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'strict': '(True)', 'reason': '"""TODO: why is this xfail?"""'}), "(strict=True, reason='TODO: why is this xfail?')\n", (1771, 1819), False, 'import pytest\n'), ((2370, 2435), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'strict': '(True)', 'reason': '"... |
# -*- coding: utf-8 -*-
from pyenvdiff.arg_parsing import backwards_compatible_parser
from pyenvdiff.client import Client
from pyenvdiff.environment import Environment
from pyenvdiff.collectors import Collector
class MyCollector(Collector):
@staticmethod
def from_env():
from this import s, d
... | [
"pyenvdiff.environment.Environment",
"pyenvdiff.client.Client",
"this.d.get",
"pyenvdiff.arg_parsing.backwards_compatible_parser"
] | [((453, 482), 'pyenvdiff.arg_parsing.backwards_compatible_parser', 'backwards_compatible_parser', ([], {}), '()\n', (480, 482), False, 'from pyenvdiff.arg_parsing import backwards_compatible_parser\n'), ((497, 553), 'pyenvdiff.client.Client', 'Client', ([], {'server': '"""https://osa.pyenvdiff.com"""', 'api_key': 'None... |
import warnings
from collections import Counter
from typing import Dict, List, Tuple
import numpy as np
from scribblenet.ml.utils import load_classes, load_model
from scribblenet.preprocessing.preprocessor import PreProcessor
def _get_best_indices_and_accuracies(
prediction: np.ndarray, num_best_classes: int
) -... | [
"scribblenet.preprocessing.preprocessor.PreProcessor",
"collections.Counter",
"warnings.warn",
"scribblenet.ml.utils.load_model",
"scribblenet.ml.utils.load_classes"
] | [((792, 914), 'warnings.warn', 'warnings.warn', (['"""This method is outdated due to a conceptual change in the prediction logic."""', 'DeprecationWarning'], {}), "(\n 'This method is outdated due to a conceptual change in the prediction logic.'\n , DeprecationWarning)\n", (805, 914), False, 'import warnings\n'),... |
from binarytree import BinaryTree
from pprint import pprint
def sumWithinRange(tree, rng):
total = 0
return total
def main():
leftTree = BinaryTree(3)
leftTree.addLeftChild(2)
leftTree.addRightChild(4)
rightTree = BinaryTree(8)
rightTree.addLeftChild(6)
rightTree.addRightChild(10)
... | [
"binarytree.BinaryTree"
] | [((154, 167), 'binarytree.BinaryTree', 'BinaryTree', (['(3)'], {}), '(3)\n', (164, 167), False, 'from binarytree import BinaryTree\n'), ((244, 257), 'binarytree.BinaryTree', 'BinaryTree', (['(8)'], {}), '(8)\n', (254, 257), False, 'from binarytree import BinaryTree\n'), ((332, 345), 'binarytree.BinaryTree', 'BinaryTree... |
from helper import cmdline
def extract():
return cmdline("uncompyle6 test.pyc") | [
"helper.cmdline"
] | [((54, 84), 'helper.cmdline', 'cmdline', (['"""uncompyle6 test.pyc"""'], {}), "('uncompyle6 test.pyc')\n", (61, 84), False, 'from helper import cmdline\n')] |
"""Execute a notebook from the cache."""
from __future__ import annotations
from contextlib import nullcontext, suppress
from datetime import datetime
import os
from tempfile import TemporaryDirectory
from typing import ContextManager
from jupyter_cache import get_cache
from jupyter_cache.base import CacheBundleIn
fr... | [
"jupyter_cache.base.CacheBundleIn",
"jupyter_cache.cache.db.NbProjectRecord.remove_tracebacks",
"os.path.abspath",
"tempfile.TemporaryDirectory",
"jupyter_cache.get_cache",
"contextlib.suppress",
"jupyter_cache.executors.utils.single_nb_execution",
"jupyter_cache.cache.db.NbProjectRecord.set_traceback... | [((771, 837), 'jupyter_cache.get_cache', 'get_cache', (["(self.nb_config.execution_cache_path or '.jupyter_cache')"], {}), "(self.nb_config.execution_cache_path or '.jupyter_cache')\n", (780, 837), False, 'from jupyter_cache import get_cache\n'), ((2220, 2282), 'jupyter_cache.cache.db.NbProjectRecord.remove_tracebacks'... |
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize as so
def normPoly(x,y,N,nparam):
global noise
noise = np.zeros((len(N),len(N)))
for i in range(len(N)):
noise[i,i] = N[i]**2
A = np.zeros((len(x),nparam))
for i in range(len(x)):
... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.errorbar",
"numpy.transpose",
"scipy.optimize.curve_fit",
"matplotlib.pyplot.figure",
"numpy.linalg.inv",
"numpy.linspace",
"numpy.random.normal",
"numpy.dot",
"ma... | [((1198, 1227), 'numpy.random.normal', 'np.random.normal', (['(0)', 'stdev', 'n'], {}), '(0, stdev, n)\n', (1214, 1227), True, 'import numpy as np\n'), ((1388, 1412), 'numpy.linspace', 'np.linspace', (['(1)', '(100)', '(100)'], {}), '(1, 100, 100)\n', (1399, 1412), True, 'import numpy as np\n'), ((1817, 1880), 'scipy.o... |
# -*- coding: utf-8 -*-
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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
... | [
"sqlalchemy.dialects.mysql.INTEGER",
"sqlalchemy.orm.synonym",
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.orm.relationship",
"sqlalchemy.dialects.mysql.BOOLEAN",
"sqlalchemy.dialects.mysql.TINYINT",
"logging.getLogger"
] | [((1073, 1100), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1090, 1100), False, 'import logging\n'), ((2902, 2920), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (2918, 2920), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), (... |
import functools
import heapq
import sys
from collections import defaultdict
from typing import List, Tuple, Dict, Set
import pytest
from src.aoc_helpers import parse_digit_matrix, Point, list_matrix_to_tuple_matrix
@pytest.fixture
def aoc_example_text() -> str:
return """1163751742
1381373672
2136511328
369493... | [
"heapq.heappush",
"src.aoc_helpers.Point",
"heapq.heappop",
"collections.defaultdict",
"src.aoc_helpers.list_matrix_to_tuple_matrix",
"src.aoc_helpers.parse_digit_matrix",
"pytest.mark.parametrize"
] | [((3625, 3881), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""matrix, multiplier, expected"""', '[(((1,),), 1, ((1,),)), (((1,),), 2, ((1, 2), (2, 3))), (((1, 2), (3, 4)), \n 2, ((1, 2, 2, 3), (3, 4, 4, 5), (2, 3, 3, 4), (4, 5, 5, 6))), (((8,),),\n 3, ((8, 9, 1), (9, 1, 2), (1, 2, 3)))]'], {}), "('m... |
"""Test check."""
# pylint: disable=import-error
from unittest.mock import patch
from supervisor.const import CoreState
from supervisor.coresys import CoreSys
from supervisor.resolution.const import IssueType
async def test_check_setup(coresys: CoreSys):
"""Test check for setup."""
coresys.core.state = CoreS... | [
"unittest.mock.patch"
] | [((340, 437), 'unittest.mock.patch', 'patch', (['"""supervisor.resolution.checks.free_space.CheckFreeSpace.run_check"""'], {'return_value': '(False)'}), "('supervisor.resolution.checks.free_space.CheckFreeSpace.run_check',\n return_value=False)\n", (345, 437), False, 'from unittest.mock import patch\n'), ((699, 796)... |
from ray import tune
from ray.rllib.algorithms.ppo import PPO
tune.run(
PPO,
stop={"episode_len_mean": 20},
config={"env": "CartPole-v0", "framework": "torch", "log_level": "INFO"},
)
| [
"ray.tune.run"
] | [((63, 185), 'ray.tune.run', 'tune.run', (['PPO'], {'stop': "{'episode_len_mean': 20}", 'config': "{'env': 'CartPole-v0', 'framework': 'torch', 'log_level': 'INFO'}"}), "(PPO, stop={'episode_len_mean': 20}, config={'env': 'CartPole-v0',\n 'framework': 'torch', 'log_level': 'INFO'})\n", (71, 185), False, 'from ray im... |
# -*- coding:utf-8 -*-
import cv2
import numpy as np
def rad(x):
return x * np.pi / 180
img = cv2.imread("d:/2.png")
img = cv2.resize(img, (int(img.shape[1] / 2), int(img.shape[0] / 2)))
# cv2.imshow("original", img)
# 扩展图像,保证内容不超出可视范围
img = cv2.copyMakeBorder(img, 200, 200, 200, 200, cv2.BORDER_CONSTANT, 0)
w... | [
"cv2.warpPerspective",
"cv2.getPerspectiveTransform",
"cv2.waitKey",
"numpy.zeros",
"cv2.copyMakeBorder",
"cv2.imshow",
"cv2.imread",
"numpy.array",
"cv2.destroyAllWindows",
"numpy.sqrt"
] | [((102, 124), 'cv2.imread', 'cv2.imread', (['"""d:/2.png"""'], {}), "('d:/2.png')\n", (112, 124), False, 'import cv2\n'), ((251, 318), 'cv2.copyMakeBorder', 'cv2.copyMakeBorder', (['img', '(200)', '(200)', '(200)', '(200)', 'cv2.BORDER_CONSTANT', '(0)'], {}), '(img, 200, 200, 200, 200, cv2.BORDER_CONSTANT, 0)\n', (269,... |
'''
Created on Dec 6, 2018
'''
# System imports
import os
# Standard imports
import numpy as np
import tensorflow as tf
import keras.backend as K
import math
import itertools
# Plotting libraries
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# Project library imports
from modules.deltavae.d... | [
"keras.backend.dot",
"numpy.sum",
"tensorflow.nn.l2_normalize",
"matplotlib.pyplot.figure",
"numpy.sin",
"tensorflow.Variable",
"keras.backend.shape",
"keras.backend.constant",
"numpy.meshgrid",
"tensorflow.abs",
"numpy.linspace",
"itertools.product",
"mpl_toolkits.mplot3d.Axes3D",
"keras.... | [((1026, 1049), 'numpy.log', 'np.log', (['(1 / self.volume)'], {}), '(1 / self.volume)\n', (1032, 1049), True, 'import numpy as np\n'), ((1380, 1425), 'keras.backend.constant', 'K.constant', (['[[1, 0, 0], [0, 1, 0], [0, 0, 0]]'], {}), '([[1, 0, 0], [0, 1, 0], [0, 0, 0]])\n', (1390, 1425), True, 'import keras.backend a... |
from mpl_toolkits import basemap
import matplotlib.pyplot as plt
import numpy as np
from hydroDL import utils
def mapPoint(ax, lat, lon, data, vRange=None, cmap='jet', s=30, marker='o',
cb=True, centerZero=False):
if np.isnan(data).all():
print('all nan in data')
return
if vRange ... | [
"numpy.meshgrid",
"numpy.unique",
"matplotlib.pyplot.setp",
"numpy.isnan",
"numpy.sort",
"numpy.min",
"numpy.max",
"numpy.arange",
"numpy.where",
"hydroDL.utils.vRange",
"mpl_toolkits.basemap.Basemap",
"hydroDL.utils.rmNan"
] | [((439, 558), 'mpl_toolkits.basemap.Basemap', 'basemap.Basemap', ([], {'llcrnrlat': '(25)', 'urcrnrlat': '(50)', 'llcrnrlon': '(-125)', 'urcrnrlon': '(-65)', 'projection': '"""cyl"""', 'resolution': '"""c"""', 'ax': 'ax'}), "(llcrnrlat=25, urcrnrlat=50, llcrnrlon=-125, urcrnrlon=-65,\n projection='cyl', resolution='... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Plivo Team. See LICENSE.txt for details.
import os
import argparse
import multiprocessing
import configparser
import gunicorn.app.base
from gunicorn.six import iteritems
from sharq_server import setup_server, __version__
def number_of_workers():
return (multiprocessin... | [
"os.path.abspath",
"argparse.ArgumentParser",
"gunicorn.six.iteritems",
"sharq_server.setup_server",
"configparser.SafeConfigParser",
"multiprocessing.cpu_count"
] | [((1164, 1216), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""SharQ Server."""'}), "(description='SharQ Server.')\n", (1187, 1216), False, 'import argparse\n'), ((1815, 1846), 'configparser.SafeConfigParser', 'configparser.SafeConfigParser', ([], {}), '()\n', (1844, 1846), False, 'impor... |
"""Provide a strategy class to build an yWriter 7 xml tree.
Copyright (c) 2021 <NAME>
For further information see https://github.com/peter88213/PyWriter
Published under the MIT License (https://opensource.org/licenses/mit-license.php)
"""
import xml.etree.ElementTree as ET
from pywriter.yw.xml_indent import i... | [
"xml.etree.ElementTree.Element",
"xml.etree.ElementTree.SubElement",
"pywriter.yw.xml_indent.indent",
"xml.etree.ElementTree.ElementTree"
] | [((22853, 22865), 'pywriter.yw.xml_indent.indent', 'indent', (['root'], {}), '(root)\n', (22859, 22865), False, 'from pywriter.yw.xml_indent import indent\n'), ((22892, 22912), 'xml.etree.ElementTree.ElementTree', 'ET.ElementTree', (['root'], {}), '(root)\n', (22906, 22912), True, 'import xml.etree.ElementTree as ET\n'... |
# generate random string of 5 characters
import string
import random
import text_to_image
def id_generator(size=6, chars=string.ascii_lowercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
# for x in range(100):
# S = id_generator(5)
# print(str(x) + '. ' + S)
S = id_generator(5)
p... | [
"text_to_image.encode",
"random.choice"
] | [((350, 386), 'text_to_image.encode', 'text_to_image.encode', (['S', '"""image.png"""'], {}), "(S, 'image.png')\n", (370, 386), False, 'import text_to_image\n'), ((179, 199), 'random.choice', 'random.choice', (['chars'], {}), '(chars)\n', (192, 199), False, 'import random\n')] |
import os
import py
import pytest
import numpy as np
import scipy as sp
import openpnm as op
import networkx as nx
from pathlib import Path
class StatoilTest:
def setup_class(self):
ws = op.Workspace()
ws.settings['local_data'] = True
def teardown_class(self):
ws = op.Workspace()
... | [
"os.path.realpath",
"numpy.shape",
"openpnm.Workspace",
"py.path.local",
"openpnm.io.from_statoil"
] | [((202, 216), 'openpnm.Workspace', 'op.Workspace', ([], {}), '()\n', (214, 216), True, 'import openpnm as op\n'), ((302, 316), 'openpnm.Workspace', 'op.Workspace', ([], {}), '()\n', (314, 316), True, 'import openpnm as op\n'), ((1005, 1050), 'openpnm.io.from_statoil', 'op.io.from_statoil', ([], {'path': 'path', 'prefix... |
import asyncio
import socket
from aiodnsresolver import (
TYPES,
DnsError,
DnsRecordDoesNotExist,
Resolver,
mix_case,
)
import aiohttp
from .metrics import (
metric_timer,
)
class AioHttpDnsResolver(aiohttp.abc.AbstractResolver):
def __init__(self, metrics):
super().__init__()
... | [
"aiodnsresolver.mix_case",
"asyncio.get_event_loop",
"aiodnsresolver.Resolver"
] | [((549, 588), 'aiodnsresolver.Resolver', 'Resolver', ([], {'transform_fqdn': 'transform_fqdn'}), '(transform_fqdn=transform_fqdn)\n', (557, 588), False, 'from aiodnsresolver import TYPES, DnsError, DnsRecordDoesNotExist, Resolver, mix_case\n'), ((466, 480), 'aiodnsresolver.mix_case', 'mix_case', (['fqdn'], {}), '(fqdn)... |
# Lint as: python3
# Copyright 2018 The TensorFlow 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 ... | [
"lingvo.compat.train.ClusterSpec",
"lingvo.compat.summarize_tf2_status",
"lingvo.executor.GetExecutorParams",
"lingvo.core.cluster_factory.Current",
"lingvo.compat.io.gfile.isdir",
"lingvo.model_imports.ImportParams",
"lingvo.compat.logging.error",
"google.protobuf.text_format.MessageToString",
"lin... | [((1655, 1763), 'lingvo.compat.flags.DEFINE_bool', 'tf.flags.DEFINE_bool', (['"""interactive"""', '(False)', '"""If True, enter interactive IPython for the controller job."""'], {}), "('interactive', False,\n 'If True, enter interactive IPython for the controller job.')\n", (1675, 1763), True, 'import lingvo.compat ... |
"""
@Author: <NAME>
@Code: <NAME>
"""
import cv2
import numpy as np
def getHoles(image_shape ,num):
imageHeight ,imageWidth = image_shape[0] ,image_shape[1]
maxVertex = 20
maxAngle = 30
maxLength = 100
maxBrushWidth = 20
result = []
for _ in range(num):... | [
"cv2.line",
"numpy.ones",
"numpy.random.randint",
"numpy.array",
"numpy.sin",
"numpy.cos"
] | [((339, 391), 'numpy.ones', 'np.ones', (['(imageHeight, imageWidth)'], {'dtype': 'np.float32'}), '((imageHeight, imageWidth), dtype=np.float32)\n', (346, 391), True, 'import numpy as np\n'), ((1296, 1312), 'numpy.array', 'np.array', (['result'], {}), '(result)\n', (1304, 1312), True, 'import numpy as np\n'), ((418, 446... |
'''
Script for the peer to peer brownie network.
'''
# ==================== Imports ==================== #
from pyp2p.net import *
import json
import logging
import threading
import time
import signal
import atexit
import argparse
import blockchain
from block import *
import transactionPool
import transaction
# ===... | [
"atexit.register",
"threading.Thread",
"argparse.ArgumentParser",
"json.loads",
"blockchain.replaceChain",
"json.dumps",
"blockchain.getLatestBlock",
"transaction.Transaction.deserialize",
"blockchain.addBlockToChain",
"blockchain.getBlockchain",
"blockchain.isValidChain",
"signal.signal",
"... | [((6417, 6489), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""The peer-to-peer brownie network."""'}), "(description='The peer-to-peer brownie network.')\n", (6440, 6489), False, 'import argparse\n'), ((919, 955), 'logging.getLogger', 'logging.getLogger', (['"""Brownie-Network"""'], {})... |
from django.db import models
from crm.models import UpdatedByModel
from django.db.models.signals import post_save
from django.dispatch import receiver
from channels.models import Channel
from api.models import APIRequest
from robocrm.models import Machine
import logging
import json
import requests
logger = logging.ge... | [
"api.serializers.MachineSerializer",
"api.serializers.APIRequestSerializer",
"django.dispatch.receiver",
"json.dumps",
"api.serializers.ChannelSerializer",
"logging.getLogger"
] | [((310, 337), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (327, 337), False, 'import logging\n'), ((340, 375), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'Channel'}), '(post_save, sender=Channel)\n', (348, 375), False, 'from django.dispatch import receiver\n'), ... |
import numpy as np
from pyiid.experiments.elasticscatter.kernels.master_kernel import get_rw, \
get_chi_sq, get_grad_rw, \
get_grad_chi_sq
__author__ = 'christopher'
def wrap_rw(gcalc, gobs):
"""
Generate the Rw value
Parameters
-----------
gcalc: 1darray
The calculated 1D data
... | [
"pyiid.experiments.elasticscatter.kernels.master_kernel.get_grad_chi_sq",
"pyiid.experiments.elasticscatter.kernels.master_kernel.get_rw",
"pyiid.experiments.elasticscatter.kernels.master_kernel.get_grad_rw",
"pyiid.experiments.elasticscatter.kernels.master_kernel.get_chi_sq"
] | [((545, 577), 'pyiid.experiments.elasticscatter.kernels.master_kernel.get_rw', 'get_rw', (['gobs', 'gcalc'], {'weight': 'None'}), '(gobs, gcalc, weight=None)\n', (551, 577), False, 'from pyiid.experiments.elasticscatter.kernels.master_kernel import get_rw, get_chi_sq, get_grad_rw, get_grad_chi_sq\n'), ((972, 995), 'pyi... |
"""
cluster.py
--------
Utilities for creating a seriated/ordered adjacency matrix with hierarchical clustering.
author: <NAME>
email: <EMAIL>
Submitted as part of the 2019 NetSI Collabathon
"""
import numpy as np
import networkx as nx
from scipy.cluster.hierarchy import dendrogram, linkage
def clusterGraph(G, met... | [
"scipy.cluster.hierarchy.linkage",
"scipy.cluster.hierarchy.dendrogram",
"networkx.to_numpy_matrix"
] | [((1089, 1110), 'networkx.to_numpy_matrix', 'nx.to_numpy_matrix', (['G'], {}), '(G)\n', (1107, 1110), True, 'import networkx as nx\n'), ((1122, 1168), 'scipy.cluster.hierarchy.linkage', 'linkage', (['adj', 'method', 'metric', 'optimal_ordering'], {}), '(adj, method, metric, optimal_ordering)\n', (1129, 1168), False, 'f... |
from pathlib import Path
import site
import typing
from urllib.parse import urlparse
from pynvim import Nvim
from paramiko import Transport, SFTPClient, RSAKey, SSHConfig
from defx.context import Context
from defx.base.source import Base
site.addsitedir(str(Path(__file__).parent.parent))
from sftp import SFTPPath #... | [
"paramiko.RSAKey.from_private_key_file",
"sftp.SFTPPath",
"kind.sftp.Kind",
"pathlib.Path",
"paramiko.SSHConfig.from_path",
"paramiko.SFTPClient.from_transport",
"urllib.parse.urlparse"
] | [((594, 614), 'kind.sftp.Kind', 'Kind', (['self.vim', 'self'], {}), '(self.vim, self)\n', (598, 614), False, 'from kind.sftp import Kind\n'), ((1502, 1540), 'paramiko.RSAKey.from_private_key_file', 'RSAKey.from_private_key_file', (['key_path'], {}), '(key_path)\n', (1530, 1540), False, 'from paramiko import Transport, ... |
from copy import copy
import json
from operator import itemgetter
def _clean_url(url: str) -> str :
return url.removeprefix('/')
def get_keys(dict: dict):
return list(map(itemgetter(0), dict.items()))
class RestAPI:
def __init__(self, database: dict =None):
database_copy = copy(database)
... | [
"operator.itemgetter",
"copy.copy",
"json.loads",
"json.dumps"
] | [((299, 313), 'copy.copy', 'copy', (['database'], {}), '(database)\n', (303, 313), False, 'from copy import copy\n'), ((1651, 1670), 'json.loads', 'json.loads', (['payload'], {}), '(payload)\n', (1661, 1670), False, 'import json\n'), ((2285, 2305), 'copy.copy', 'copy', (['new_user_entry'], {}), '(new_user_entry)\n', (2... |
# coding: utf-8
"""
erep-friends
To build an efriends distribution package:
- `cd` to /dir/where/setup.py/resides
- `python3 ./setup.py sdist bdist_wheel`
To install this as a package:
`sudo -H python3 -m pip install -e /dir/where/setup.py/resides`
like...
`sudo -H python3 -m pip install -e /home/dave/Dropbox/project... | [
"setuptools.find_packages"
] | [((1681, 1696), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1694, 1696), False, 'from setuptools import setup, find_packages\n')] |
#!/usr/bin/python3
# coding=utf8
import http.cookiejar
import urllib
import urllib.parse
import urllib.request
import time
import random
import re
import os
from bs4 import BeautifulSoup
from creds_dont_commit import *
SIMULATION = True
# utils {
cookies = http.cookiejar.MozillaCookieJar()
opener = urllib.request.... | [
"time.sleep",
"random.randint",
"urllib.parse.urlencode",
"urllib.request.HTTPCookieProcessor"
] | [((338, 381), 'urllib.request.HTTPCookieProcessor', 'urllib.request.HTTPCookieProcessor', (['cookies'], {}), '(cookies)\n', (372, 381), False, 'import urllib\n'), ((752, 765), 'time.sleep', 'time.sleep', (['t'], {}), '(t)\n', (762, 765), False, 'import time\n'), ((691, 711), 'random.randint', 'random.randint', (['(0)',... |
import os
import pytest
from fastapi.testclient import TestClient
from .conftest import AbstractTest
from g2w.__main__ import app
# Fake worksection api for unit testing purposes
# @todo #/DEV Fake worksection api implementation required
# - https://requests-mock.readthedocs.io/en/latest/pytest.html
# - https://s... | [
"fastapi.testclient.TestClient",
"os.getenv"
] | [((464, 491), 'os.getenv', 'os.getenv', (['"""WS_ADMIN_EMAIL"""'], {}), "('WS_ADMIN_EMAIL')\n", (473, 491), False, 'import os\n'), ((583, 612), 'os.getenv', 'os.getenv', (['"""WS_URL_ALL_USERS"""'], {}), "('WS_URL_ALL_USERS')\n", (592, 612), False, 'import os\n'), ((706, 738), 'os.getenv', 'os.getenv', (['"""WS_URL_POS... |
import os
from glob import glob
from pathlib import Path
from random import sample
from itertools import chain
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
DIRECTORY_ROOT = os.path.abspath(Path(os.getcwd()))
def get_all_images():
"""Helper function to get the paths... | [
"os.path.basename",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"os.getcwd",
"os.path.join"
] | [((863, 920), 'pandas.read_csv', 'pd.read_csv', (["(DIRECTORY_ROOT + '/data/Data_Entry_2017.csv')"], {}), "(DIRECTORY_ROOT + '/data/Data_Entry_2017.csv')\n", (874, 920), True, 'import pandas as pd\n'), ((2251, 2321), 'sklearn.model_selection.train_test_split', 'train_test_split', (['df'], {'test_size': 'test_size', 'st... |
import matplotlib.pyplot as plt
import os
import pandas as pd
from image_data_as_class import images
data_folder = "/Users/clhastings/Documents/Drive/UCL/Stern/calcium/image_analysis/ImageJ/"
results_folder = "/Users/clhastings/Documents/Drive/UCL/Stern/calcium/image_analysis/grid_spikes_results/"
# testing
comparis... | [
"pandas.read_csv",
"os.mkdir",
"matplotlib.pyplot.imread"
] | [((573, 592), 'os.mkdir', 'os.mkdir', (['im_folder'], {}), '(im_folder)\n', (581, 592), False, 'import os\n'), ((739, 788), 'pandas.read_csv', 'pd.read_csv', (["(im_folder + 'cell_grid_timeline.csv')"], {}), "(im_folder + 'cell_grid_timeline.csv')\n", (750, 788), True, 'import pandas as pd\n'), ((936, 1006), 'matplotli... |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 30 01:43:32 2020
@author: qzane
"""
import os,sys
import shutil
import textured_smplx
USAGE = """python %s data_path, front_img, back_img, [model]
data_path: the path to the data, should be like:
data_path/images/XXX.jpg # image path
... | [
"textured_smplx.complete_texture",
"textured_smplx.combine_texture_SMPL",
"os.path.isfile",
"os.path.split",
"os.path.join",
"textured_smplx.get_texture_SMPL"
] | [((2058, 2102), 'os.path.join', 'os.path.join', (['data_path', '"""images"""', 'front_img'], {}), "(data_path, 'images', front_img)\n", (2070, 2102), False, 'import os, sys\n'), ((2115, 2176), 'os.path.join', 'os.path.join', (['data_path', 'model', '"""meshes"""', 'front_id', '"""000.obj"""'], {}), "(data_path, model, ... |
"""Playbook Common Model"""
# third-party
from pydantic import BaseModel, Field
class PlaybookCommonModel(BaseModel):
"""Playbook Common Model
Supported for the following runtimeLevel:
* ApiService
* Playbook
* TriggerService
* WebhookTriggerService
"""
tc_cache_kvstore_id: int = Fie... | [
"pydantic.Field"
] | [((317, 405), 'pydantic.Field', 'Field', (['(10)'], {'description': '"""The KV Store cache DB Id."""', 'inclusion_reason': '"""runtimeLevel"""'}), "(10, description='The KV Store cache DB Id.', inclusion_reason=\n 'runtimeLevel')\n", (322, 405), False, 'from pydantic import BaseModel, Field\n'), ((459, 582), 'pydant... |
# Copyright (c) 2015 HyperHQ Inc.
# Copyright (C) 2013 VMware, Inc
# Copyright 2011 OpenStack Foundation
# 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
#
# ... | [
"nova.network.linux_net.device_exists",
"oslo_log.log.getLogger",
"nova.utils.execute",
"random.randint",
"nova.utils.UndoManager",
"nova.network.linux_net.LinuxBridgeInterfaceDriver.ensure_bridge",
"novahyper.virt.hyper.network.find_fixed_ip",
"novahyper.virt.hyper.network.find_gateway",
"novahyper... | [((1378, 1405), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1395, 1405), True, 'from oslo_log import log as logging\n'), ((3277, 3323), 'novahyper.virt.hyper.network.find_gateway', 'network.find_gateway', (['instance', "vif['network']"], {}), "(instance, vif['network'])\n", (3297... |
import discord
from discord.ext import commands
class Reactions(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def no(self, ctx):
embed = discord.Embed(
title = f'{ctx.author.name} dislikes the idea',
color = discord.Color.red()
)
embed.set... | [
"discord.Color",
"discord.Color.red",
"discord.ext.commands.command"
] | [((147, 165), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (163, 165), False, 'from discord.ext import commands\n'), ((460, 478), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (476, 478), False, 'from discord.ext import commands\n'), ((784, 825), 'discord.ext.commands.co... |
import numpy as np
import hazel
import h5py
def test_nonmpi_syn1d():
# Test iterator with a single observation in synthesis
iterator = hazel.Iterator(use_mpi=False)
rank = iterator.get_rank()
mod = hazel.Model('test/configurations/conf_nonmpi_syn1d.ini', working_mode='synthesis', verbose=2)
iterator.us... | [
"hazel.Model",
"h5py.File",
"hazel.Iterator"
] | [((140, 169), 'hazel.Iterator', 'hazel.Iterator', ([], {'use_mpi': '(False)'}), '(use_mpi=False)\n', (154, 169), False, 'import hazel\n'), ((211, 309), 'hazel.Model', 'hazel.Model', (['"""test/configurations/conf_nonmpi_syn1d.ini"""'], {'working_mode': '"""synthesis"""', 'verbose': '(2)'}), "('test/configurations/conf_... |
import unittest
from pyquery import PyQuery
from gsch.agent import Agent
from gsch.option import Option
class TestAgent(unittest.TestCase):
def test__set_url_for(self):
agent = Agent()
keywords = ['aaa', 'bbb']
option = Option()
url = agent._set_url_for(keywords, option)
... | [
"unittest.main",
"pyquery.PyQuery",
"gsch.agent.Agent",
"gsch.option.Option"
] | [((1745, 1760), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1758, 1760), False, 'import unittest\n'), ((192, 199), 'gsch.agent.Agent', 'Agent', ([], {}), '()\n', (197, 199), False, 'from gsch.agent import Agent\n'), ((252, 260), 'gsch.option.Option', 'Option', ([], {}), '()\n', (258, 260), False, 'from gsch.op... |
import numpy as np
import torch
class TerrainType():
def __init__(self, min_ht = 0.0, max_ht = 0.0):
self.min_ht = min_ht
self.max_ht = max_ht
class FlatTerrain(TerrainType):
def __init__(self, const_ht = 0.0):
self.const_ht = const_ht
super().__init__(min_ht = self.const_ht, m... | [
"torch.full_like",
"numpy.floor",
"numpy.ndim",
"numpy.sin",
"numpy.cos"
] | [((1636, 1663), 'numpy.floor', 'np.floor', (['(2 * x / p + 1 / 2)'], {}), '(2 * x / p + 1 / 2)\n', (1644, 1663), True, 'import numpy as np\n'), ((408, 418), 'numpy.ndim', 'np.ndim', (['x'], {}), '(x)\n', (415, 418), True, 'import numpy as np\n'), ((501, 522), 'torch.full_like', 'torch.full_like', (['x', 'z'], {}), '(x,... |
from Pubsub import PubSub
from reader import FactorGraphReader
from redis import Redis
import time
import os
import subprocess
class FactorGraph:
def __init__(self, path_to_input_file=None, config={}, function_list=[]):
r = Redis()
subprocess.Popen("redis-server")
time.sleep(1)
sel... | [
"redis.Redis",
"subprocess.Popen",
"os.system",
"time.sleep",
"reader.FactorGraphReader.register_pubsub_from_factor_graph_file",
"Pubsub.PubSub"
] | [((238, 245), 'redis.Redis', 'Redis', ([], {}), '()\n', (243, 245), False, 'from redis import Redis\n'), ((254, 286), 'subprocess.Popen', 'subprocess.Popen', (['"""redis-server"""'], {}), "('redis-server')\n", (270, 286), False, 'import subprocess\n'), ((295, 308), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (3... |
# -*- coding:utf8 -*-
import sys
from bs4 import BeautifulSoup
from parse.page import get_soup
from decorator import parse_decorator
reload(sys)
sys.setdefaultencoding('utf-8')
@parse_decorator([])
def get_user_info(ulink):
soup=get_soup(ulink)
introduce=soup.find('div',{'class':'inf s-fc3 f-brk'}).string
div=so... | [
"decorator.parse_decorator",
"parse.page.get_soup",
"sys.setdefaultencoding"
] | [((147, 178), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf-8"""'], {}), "('utf-8')\n", (169, 178), False, 'import sys\n'), ((182, 201), 'decorator.parse_decorator', 'parse_decorator', (['[]'], {}), '([])\n', (197, 201), False, 'from decorator import parse_decorator\n'), ((234, 249), 'parse.page.get_sou... |
import logging
import os
import time
import numpy as np
import numpy.ma as ma
from tqdm import tqdm
import torch
import torch.nn as nn
from torch.nn import functional as F
from utils.utils import AverageMeter
from utils.utils import get_confusion_matrix
from utils.utils import adjust_learning_rate
def train(config,... | [
"utils.utils.AverageMeter",
"utils.utils.get_confusion_matrix",
"numpy.maximum",
"numpy.zeros",
"time.time",
"logging.info",
"utils.utils.adjust_learning_rate",
"torch.nn.functional.interpolate",
"torch.no_grad",
"numpy.diag"
] | [((532, 546), 'utils.utils.AverageMeter', 'AverageMeter', ([], {}), '()\n', (544, 546), False, 'from utils.utils import AverageMeter\n'), ((562, 576), 'utils.utils.AverageMeter', 'AverageMeter', ([], {}), '()\n', (574, 576), False, 'from utils.utils import AverageMeter\n'), ((587, 598), 'time.time', 'time.time', ([], {... |
from django.views.generic import View
from django.http import JsonResponse
from django.shortcuts import render
from apps.operations.forms import UserFavForm, CommentsForm
from apps.operations.models import UserFavorite, CourseComments
from apps.courses.models import Course
from apps.organizations.models import CourseO... | [
"apps.operations.models.UserFavorite.objects.filter",
"apps.operations.models.Banner.objects.all",
"apps.operations.models.CourseComments",
"apps.courses.models.Course.objects.filter",
"django.http.JsonResponse",
"apps.organizations.models.Teacher.objects.get",
"apps.organizations.models.CourseOrg.objec... | [((587, 624), 'apps.courses.models.Course.objects.filter', 'Course.objects.filter', ([], {'is_banner': '(True)'}), '(is_banner=True)\n', (608, 624), False, 'from apps.courses.models import Course\n'), ((691, 828), 'django.shortcuts.render', 'render', (['request', '"""index.html"""', "{'banners': banners, 'courses': cou... |
# Copyright 2015 - Alcatel-Lucent
#
# 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,... | [
"random.shuffle",
"vitrage.tests.mocks.trace_generator.get_trace_generators",
"vitrage.tests.mocks.trace_generator.generate_round_robin_data_stream",
"vitrage.tests.mocks.trace_generator.generate_data_stream",
"vitrage.utils.datetime.utcnow"
] | [((2078, 2098), 'random.shuffle', 'random.shuffle', (['data'], {}), '(data)\n', (2092, 2098), False, 'import random\n'), ((4761, 4807), 'vitrage.tests.mocks.trace_generator.get_trace_generators', 'tg.get_trace_generators', (['test_entity_spec_list'], {}), '(test_entity_spec_list)\n', (4784, 4807), True, 'import vitrage... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2014, <NAME>
#
# 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 re... | [
"py2neo.GraphError",
"py2neo.ResourceTemplate"
] | [((1321, 1361), 'py2neo.ResourceTemplate', 'ResourceTemplate', (["(uri + '/index/{label}')"], {}), "(uri + '/index/{label}')\n", (1337, 1361), False, 'from py2neo import Service, ResourceTemplate, GraphError\n'), ((1401, 1456), 'py2neo.ResourceTemplate', 'ResourceTemplate', (["(uri + '/index/{label}/{property_key}')"],... |
from leapp import reporting
from leapp.libraries.actor import checkinstalledkernels
from leapp.libraries.common.config import architecture
from leapp.libraries.common.testutils import create_report_mocked, CurrentActorMocked, logger_mocked
from leapp.libraries.stdlib import api
from leapp.models import RPM, InstalledRe... | [
"leapp.libraries.actor.checkinstalledkernels.process",
"leapp.libraries.common.testutils.create_report_mocked",
"leapp.models.InstalledRedHatSignedRPM",
"leapp.libraries.common.testutils.CurrentActorMocked",
"leapp.libraries.common.testutils.logger_mocked"
] | [((1460, 1491), 'leapp.libraries.actor.checkinstalledkernels.process', 'checkinstalledkernels.process', ([], {}), '()\n', (1489, 1491), False, 'from leapp.libraries.actor import checkinstalledkernels\n'), ((1714, 1745), 'leapp.libraries.actor.checkinstalledkernels.process', 'checkinstalledkernels.process', ([], {}), '(... |
import numpy as np
import random
import pickle
import policyValueNet as net
import dataTools
import sheepEscapingEnv as env
import visualize as VI
import trainTools
def main(seed=128, tfseed=128):
random.seed(seed)
np.random.seed(4027)
dataSetPath = "72640steps_1000trajs_sheepEscapingEnv_data_actionDist.pkl"
dat... | [
"dataTools.loadData",
"numpy.random.seed",
"policyValueNet.GenerateModelSeparateLastLayer",
"trainTools.coefficientCotroller",
"random.shuffle",
"policyValueNet.Train",
"policyValueNet.evaluate",
"random.seed",
"trainTools.TrainTerminalController",
"policyValueNet.restoreVariables",
"trainTools.... | [((200, 217), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (211, 217), False, 'import random\n'), ((219, 239), 'numpy.random.seed', 'np.random.seed', (['(4027)'], {}), '(4027)\n', (233, 239), True, 'import numpy as np\n'), ((327, 358), 'dataTools.loadData', 'dataTools.loadData', (['dataSetPath'], {}), '(da... |
'''Train CIFAR10 with PyTorch.'''
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import torchvision
import torchvision.transforms as transforms
import os
import argparse
from models import *
from utils import progress_bar
import nu... | [
"os.mkdir",
"numpy.random.seed",
"argparse.ArgumentParser",
"torchvision.datasets.CIFAR10",
"torchvision.transforms.Normalize",
"torch.no_grad",
"torch.utils.data.DataLoader",
"torch.load",
"torch.optim.lr_scheduler.CosineAnnealingLR",
"qtorch.quant.Quantizer",
"qtorch.quant.quantizer",
"torch... | [((341, 404), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch CIFAR10 Training"""'}), "(description='PyTorch CIFAR10 Training')\n", (364, 404), False, 'import argparse\n'), ((849, 869), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (866, 869), False, 'import to... |
from django.db import migrations, models
def populate_dates(apps, schema_editor):
series = apps.get_model('reader', 'Series')
chapter = apps.get_model('reader', 'Chapter')
series._meta.get_field('modified').auto_now = False
series.objects.update(created=models.Subquery(
chapter.objects.filter(... | [
"django.db.migrations.RunPython",
"django.db.models.DateTimeField",
"django.db.models.OuterRef",
"django.db.models.CharField"
] | [((819, 882), 'django.db.migrations.RunPython', 'migrations.RunPython', (['populate_dates', 'migrations.RunPython.noop'], {}), '(populate_dates, migrations.RunPython.noop)\n', (839, 882), False, 'from django.db import migrations, models\n'), ((703, 769), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'... |
from markdown_adapter import run_markdown
ret = run_markdown('*this should be wrapped in em tags*')
print (type(ret), ret) | [
"markdown_adapter.run_markdown"
] | [((48, 99), 'markdown_adapter.run_markdown', 'run_markdown', (['"""*this should be wrapped in em tags*"""'], {}), "('*this should be wrapped in em tags*')\n", (60, 99), False, 'from markdown_adapter import run_markdown\n')] |
import socket
import os
import math
from queue import Queue
from ctypes import c_ushort
# 发送的数据帧
class PDU:
def __init__(self, is_ack, num_to_send=-1, pdu_to_send=-1, status='OK', acked_num=-1, data=-1, checksum=-1):
self.is_ack = is_ack # 区分该帧是数据帧还是ack帧, -1表示数据,-2表示ack
self.num_to_send... | [
"os.path.getsize",
"queue.Queue",
"ctypes.c_ushort"
] | [((2170, 2197), 'queue.Queue', 'Queue', ([], {'maxsize': 'self.sw_size'}), '(maxsize=self.sw_size)\n', (2175, 2197), False, 'from queue import Queue\n'), ((2496, 2527), 'os.path.getsize', 'os.path.getsize', (['self.send_file'], {}), '(self.send_file)\n', (2511, 2527), False, 'import os\n'), ((4941, 4957), 'ctypes.c_ush... |
"""
count_polyads_repeat.py
Fraction of polyadic synapses that are conserved between homologous cells.
created: <NAME>
date: 01 November 2018
"""
import sys
sys.path.append(r'./volumetric_analysis')
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from itertools import combinations
import... | [
"sys.path.append",
"matplotlib.pyplot.show",
"matplotlib.pyplot.subplots",
"aux.read.into_lr_dict",
"itertools.combinations",
"db.mine.get_synapse_data",
"numpy.array",
"db.mine.get_neurons",
"aux.read.into_map",
"db.connect.default",
"aux.read.into_dict",
"matplotlib.pyplot.savefig"
] | [((160, 200), 'sys.path.append', 'sys.path.append', (['"""./volumetric_analysis"""'], {}), "('./volumetric_analysis')\n", (175, 200), False, 'import sys\n'), ((955, 980), 'aux.read.into_map', 'aux.read.into_map', (['_group'], {}), '(_group)\n', (972, 980), False, 'import aux\n'), ((991, 1018), 'aux.read.into_dict', 'au... |
#!/usr/bin/python
"""
Sampled from <NAME> scrolling curses
"""
from __future__ import print_function
import curses
import sys
import random
import time
import locale
class InteractiveSearch:
DOWN = 1
UP = -1
SPACE_KEY = 32
ESC_KEY = 27
ENTER_KEY = 10
PREFIX_SELECTED = '_X_'
PREFIX_DESELEC... | [
"curses.wrapper",
"curses.start_color",
"curses.endwin",
"curses.cbreak",
"curses.nocbreak",
"curses.echo",
"locale.setlocale",
"curses.use_default_colors",
"sys.exit"
] | [((772, 807), 'locale.setlocale', 'locale.setlocale', (['locale.LC_ALL', '""""""'], {}), "(locale.LC_ALL, '')\n", (788, 807), False, 'import locale\n'), ((823, 848), 'curses.wrapper', 'curses.wrapper', (['self._run'], {}), '(self._run)\n', (837, 848), False, 'import curses\n'), ((915, 930), 'curses.cbreak', 'curses.cbr... |
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='An analysis of all things NCAA Football (FBS) related.',
author='<NAME>',
license='MIT',
)
| [
"setuptools.find_packages"
] | [((81, 96), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (94, 96), False, 'from setuptools import find_packages, setup\n')] |
import unittest
import numpy as np
import generate_data
from sepia.SepiaData import SepiaData
from sepia.SepiaModel import SepiaModel
from sepia.SepiaSensitivity import sensitivity
np.random.seed(42)
class SepiaSensitivityTestCase(unittest.TestCase):
def setUp(self, m=20, n=1, nt_sim=30, nt_obs=20, n_theta=3, n... | [
"sepia.SepiaData.SepiaData",
"numpy.random.seed",
"generate_data.generate_univ_sim_and_obs",
"sepia.SepiaSensitivity.sensitivity",
"generate_data.generate_multi_sim_and_obs",
"sepia.SepiaModel.SepiaModel"
] | [((183, 201), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (197, 201), True, 'import numpy as np\n'), ((377, 520), 'generate_data.generate_multi_sim_and_obs', 'generate_data.generate_multi_sim_and_obs', ([], {'m': 'm', 'n': 'n', 'nt_sim': 'nt_sim', 'nt_obs': 'nt_obs', 'n_theta': 'n_theta', 'n_basis'... |
import cv2
threshold = 150
def gray_blur(image):
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
gray_blur = cv2.GaussianBlur(gray, (21, 21), 0)
return gray_blur
def diff(prev_image, current_frame):
prev_image = cv2.imread(prev_image)
prev_image = gray_blur(prev_image)
current_frame = gray_bl... | [
"cv2.GaussianBlur",
"cv2.contourArea",
"cv2.dilate",
"cv2.cvtColor",
"cv2.threshold",
"cv2.imread",
"cv2.absdiff"
] | [((62, 101), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2GRAY'], {}), '(image, cv2.COLOR_BGR2GRAY)\n', (74, 101), False, 'import cv2\n'), ((118, 153), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['gray', '(21, 21)', '(0)'], {}), '(gray, (21, 21), 0)\n', (134, 153), False, 'import cv2\n'), ((230, 252), 'cv2.i... |
#! /usr/bin/env python3
from Models.result_model import ResultModel
from typing import List
from bs4 import BeautifulSoup
class HtmlChecker:
def __init__(self, html_string: str):
self.__soupObj = BeautifulSoup(html_string, "html.parser")
self.__rmObjects = []
@property
def rmObjects(self... | [
"bs4.BeautifulSoup",
"Models.result_model.ResultModel"
] | [((211, 252), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html_string', '"""html.parser"""'], {}), "(html_string, 'html.parser')\n", (224, 252), False, 'from bs4 import BeautifulSoup\n'), ((1425, 1448), 'Models.result_model.ResultModel', 'ResultModel', (['resultDict'], {}), '(resultDict)\n', (1436, 1448), False, 'from Mod... |
# Generated by Django 2.2.12 on 2020-04-13 16:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0008_alter_policytype_20191225_1823'),
]
operations = [
migrations.AddField(
model_name='policy',
name='pos... | [
"django.db.models.CharField"
] | [((346, 402), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'default': '""""""', 'max_length': '(128)'}), "(blank=True, default='', max_length=128)\n", (362, 402), False, 'from django.db import migrations, models\n'), ((523, 579), 'django.db.models.CharField', 'models.CharField', ([], {'bla... |
from costar_task_plan.abstract import *
import numpy as np
class TomOrangesState(AbstractState):
'''
This state represents which orange we grasped and how we grasped it, plus whatever its state was (good or bad).
'''
def __init__(self, world):
self.predicates = []
self.world = world
... | [
"numpy.random.random"
] | [((1169, 1187), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (1185, 1187), True, 'import numpy as np\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.