code stringlengths 21 1.03M | apis list | extract_api stringlengths 74 8.23M |
|---|---|---|
#!/usr/bin/python
from PySide import QtCore, QtGui
from UI import Ui_passworderror
class CommonError (QtGui.QDialog):
def __init__ (self, info, parent = None):
QtGui.QDialog.__init__ (self, parent)
self.ui = Ui_passworderror()
self.ui.setupUi (self)
self.setWindowFlags (QtCore.Qt.FramelessWindowHint)
... | [
"PySide.QtGui.QPainter",
"PySide.QtGui.qApp.quit",
"UI.Ui_passworderror",
"PySide.QtGui.QDialog.__init__",
"PySide.QtCore.Slot",
"PySide.QtGui.QIcon"
] | [((442, 455), 'PySide.QtCore.Slot', 'QtCore.Slot', ([], {}), '()\n', (453, 455), False, 'from PySide import QtCore, QtGui\n'), ((513, 526), 'PySide.QtCore.Slot', 'QtCore.Slot', ([], {}), '()\n', (524, 526), False, 'from PySide import QtCore, QtGui\n'), ((168, 204), 'PySide.QtGui.QDialog.__init__', 'QtGui.QDialog.__init... |
# -*- coding: utf-8 -*-
import re
import django
from django.conf import settings
from django.db import connections, reset_queries
from django.test import TransactionTestCase
from django.test.utils import override_settings
from django.utils import translation
from django.utils.functional import lazy
import jinja2
imp... | [
"django.utils.translation.activate",
"olympia.translations.models.Translation.new",
"olympia.translations.tests.testapp.models.FancyModel.objects.get",
"re.findall",
"olympia.translations.models.LinkifiedTranslation",
"jinja2.Environment",
"django.utils.translation.deactivate",
"olympia.translations.t... | [((15814, 15872), 'mock.patch.object', 'patch.object', (['TranslatedModel', '"""get_fallback"""'], {'create': '(True)'}), "(TranslatedModel, 'get_fallback', create=True)\n", (15826, 15872), False, 'from mock import patch\n'), ((17929, 17958), 'django.test.utils.override_settings', 'override_settings', ([], {'DEBUG': '(... |
import math
from core.confidence_interval.ConfidenceInterval import ConfidenceInterval
class OneSociety(ConfidenceInterval):
def interval_estimation_for_ratio(self, x, n, alpha):
alpha = alpha / 2
p_hat = x / n
q_hat = 1 - p_hat
return str(p_hat - (self._z(alpha) * math.sqrt((p_hat... | [
"math.sqrt"
] | [((396, 424), 'math.sqrt', 'math.sqrt', (['(p_hat * q_hat / n)'], {}), '(p_hat * q_hat / n)\n', (405, 424), False, 'import math\n'), ((586, 614), 'math.sqrt', 'math.sqrt', (['(p_hat * q_hat / n)'], {}), '(p_hat * q_hat / n)\n', (595, 614), False, 'import math\n'), ((797, 825), 'math.sqrt', 'math.sqrt', (['(p_hat * q_ha... |
# -*- coding: utf-8 -*-
'''
Kmeans model under POM4
'''
__author__ = "<NAME>"
__date__ = "May 2020"
import numpy as np
from MMLL.models.Common_to_all_POMs import Common_to_all_POMs
from transitions import State
from transitions.extensions import GraphMachine
import pickle
from pympler import asizeof #a... | [
"dill.dumps",
"sklearn2pmml.sklearn2pmml",
"numpy.sum",
"numpy.where",
"numpy.zeros",
"skl2onnx.common.data_types.FloatTensorType",
"numpy.random.normal",
"numpy.linalg.norm",
"sklearn.cluster.KMeans",
"numpy.random.seed",
"numpy.dot",
"sklearn2pmml.pipeline.PMMLPipeline",
"skl2onnx.convert_... | [((579, 590), 'time.time', 'time.time', ([], {}), '()\n', (588, 590), False, 'import time\n'), ((642, 667), 'numpy.random.seed', 'np.random.seed', ([], {'seed': 'seed'}), '(seed=seed)\n', (656, 667), True, 'import numpy as np\n'), ((961, 980), 'numpy.dot', 'np.dot', (['X', 'self.c.T'], {}), '(X, self.c.T)\n', (967, 980... |
from __future__ import annotations
from typing import Callable
from typing import NoReturn
import numpy as np
from metrics import misclassification_error, loss_functions
from ...base import BaseEstimator
def default_callback(fit: Perceptron, x: np.ndarray, y: int):
pass
class Perceptron(BaseEstimator):
"""... | [
"numpy.zeros",
"numpy.ones",
"numpy.sign"
] | [((3382, 3402), 'numpy.zeros', 'np.zeros', (['X.shape[1]'], {}), '(X.shape[1])\n', (3390, 3402), True, 'import numpy as np\n'), ((4340, 4364), 'numpy.sign', 'np.sign', (['(X @ self.coefs_)'], {}), '(X @ self.coefs_)\n', (4347, 4364), True, 'import numpy as np\n'), ((3336, 3355), 'numpy.ones', 'np.ones', (['X.shape[0]']... |
from typing import Optional, Tuple, Union
from goji.consensus.pot_iterations import calculate_ip_iters, calculate_iterations_quality, calculate_sp_iters
from goji.types.blockchain_format.reward_chain_block import RewardChainBlock, RewardChainBlockUnfinished
from goji.types.blockchain_format.sized_bytes import bytes32
... | [
"goji.consensus.pot_iterations.calculate_iterations_quality",
"goji.consensus.pot_iterations.calculate_sp_iters",
"goji.consensus.pot_iterations.calculate_ip_iters"
] | [((1089, 1234), 'goji.consensus.pot_iterations.calculate_iterations_quality', 'calculate_iterations_quality', (['constants.DIFFICULTY_CONSTANT_FACTOR', 'quality_string', 'reward_chain_block.proof_of_space.size', 'difficulty', 'cc_sp'], {}), '(constants.DIFFICULTY_CONSTANT_FACTOR,\n quality_string, reward_chain_block... |
from os.path import join
import xarray as xr
# Load the data
def read_data(data_location: str, uv_filename: str, grid_filename: str):
grid_data = xr.open_zarr(join(data_location, grid_filename))
uv_data = xr.open_zarr(join(data_location, uv_filename))
return grid_data, uv_data | [
"os.path.join"
] | [((165, 199), 'os.path.join', 'join', (['data_location', 'grid_filename'], {}), '(data_location, grid_filename)\n', (169, 199), False, 'from os.path import join\n'), ((228, 260), 'os.path.join', 'join', (['data_location', 'uv_filename'], {}), '(data_location, uv_filename)\n', (232, 260), False, 'from os.path import joi... |
from src.cavoke import *
from enum import Enum, auto
from random import shuffle
class TileStatus(Enum):
BLANK = auto()
PLAYERMARKED = auto()
ENEMYMARKED = auto()
class Tile(Image):
def click(self) -> None:
pass
@property
def draggable(self) -> bool:
return False
def dr... | [
"enum.auto",
"random.shuffle"
] | [((119, 125), 'enum.auto', 'auto', ([], {}), '()\n', (123, 125), False, 'from enum import Enum, auto\n'), ((145, 151), 'enum.auto', 'auto', ([], {}), '()\n', (149, 151), False, 'from enum import Enum, auto\n'), ((170, 176), 'enum.auto', 'auto', ([], {}), '()\n', (174, 176), False, 'from enum import Enum, auto\n'), ((89... |
import numpy as np
import cv2
import matplotlib.pyplot as plt
import os
def get_calibrated_image(image, mtx, dist):
undistorted = cv2.undistort(image, mtx, dist, None, mtx)
#im_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
#cv2.imwrite('output_images/with_distortion.jpg', im_rgb)
#im_rgb = cv2.cvtColor... | [
"os.listdir",
"cv2.calibrateCamera",
"cv2.imread",
"cv2.cvtColor",
"numpy.zeros",
"cv2.undistort",
"cv2.findChessboardCorners"
] | [((135, 177), 'cv2.undistort', 'cv2.undistort', (['image', 'mtx', 'dist', 'None', 'mtx'], {}), '(image, mtx, dist, None, mtx)\n', (148, 177), False, 'import cv2\n'), ((524, 542), 'os.listdir', 'os.listdir', (['folder'], {}), '(folder)\n', (534, 542), False, 'import os\n'), ((694, 728), 'numpy.zeros', 'np.zeros', (['(nx... |
#!/usr/bin/env python
import os
import sys
from setuptools import setup
TEST_HELP = """
Note: running tests is no longer done using 'python setup.py test'. Instead
you will need to run:
tox -e test
If you don't already have tox installed, you can install it with:
pip install tox
If you only want to run pa... | [
"os.path.join",
"sys.exit"
] | [((574, 585), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (582, 585), False, 'import sys\n'), ((1008, 1019), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1016, 1019), False, 'import sys\n'), ((1056, 1099), 'os.path.join', 'os.path.join', (['"""spectral_cube"""', '"""version.py"""'], {}), "('spectral_cube', 'ver... |
import numpy as np
from random import choice
from .kullback import kl_bern
from .IndexAlgorithm import IndexAlgorithm
class IMED(IndexAlgorithm):
"""
Ref: <NAME>., & <NAME>. (2015). Non-asymptotic analysis of a new bandit algorithm for semi-bounded rewards.
"""
def __init__(self, nb_arms, kl=kl_b... | [
"numpy.zeros",
"numpy.max",
"numpy.log"
] | [((535, 548), 'numpy.max', 'np.max', (['means'], {}), '(means)\n', (541, 548), True, 'import numpy as np\n'), ((566, 588), 'numpy.zeros', 'np.zeros', (['self.nb_arms'], {}), '(self.nb_arms)\n', (574, 588), True, 'import numpy as np\n'), ((708, 734), 'numpy.log', 'np.log', (['self.nb_draws[arm]'], {}), '(self.nb_draws[a... |
"""The edx_lint write command."""
import os
import pkg_resources
from six.moves import cStringIO
from six.moves import configparser
from edx_lint import VERSION
from edx_lint.configfile import merge_configs
from edx_lint.tamper_evident import TamperEvidentFile
WARNING_HEADER = """\
# ***************************
# *... | [
"pkg_resources.resource_exists",
"six.moves.configparser.RawConfigParser",
"os.path.splitext",
"edx_lint.configfile.merge_configs",
"os.remove",
"os.path.exists",
"os.rename",
"pkg_resources.resource_string",
"edx_lint.tamper_evident.TamperEvidentFile",
"six.moves.cStringIO"
] | [((2775, 2799), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (2789, 2799), False, 'import os\n'), ((3345, 3375), 'six.moves.configparser.RawConfigParser', 'configparser.RawConfigParser', ([], {}), '()\n', (3373, 3375), False, 'from six.moves import configparser\n'), ((3531, 3558), 'os.path.ex... |
import pygame
from pygame.locals import *
from OpenGL.GL import *
pygame.init()
screen_width = 500
screen_heigth = 500
screen = pygame.display.set_mode((screen_width, screen_heigth), DOUBLEBUF | OPENGL)
pygame.display.set_caption("OpenGL in Python")
done = False
white = pygame.Color(255, 255, 255)
whi... | [
"pygame.display.set_caption",
"pygame.quit",
"pygame.display.flip",
"pygame.display.set_mode",
"pygame.event.get",
"pygame.Color",
"pygame.init"
] | [((71, 84), 'pygame.init', 'pygame.init', ([], {}), '()\n', (82, 84), False, 'import pygame\n'), ((140, 214), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(screen_width, screen_heigth)', '(DOUBLEBUF | OPENGL)'], {}), '((screen_width, screen_heigth), DOUBLEBUF | OPENGL)\n', (163, 214), False, 'import pygame\... |
# Copyright 2015 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 required by applica... | [
"tensorflow.test.StubOutForTesting",
"tensorflow.ones",
"tensorflow.SessionLog",
"tensorflow.Summary.Value",
"tensorflow.summary.merge_all",
"tensorflow.Graph",
"tensorflow.gfile.MkDir",
"six.moves.xrange",
"tensorboard.backend.event_processing.plugin_event_accumulator.EventAccumulator",
"numpy.ar... | [((27875, 27889), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (27887, 27889), True, 'import tensorflow as tf\n'), ((3902, 3929), 'tensorflow.test.StubOutForTesting', 'tf.test.StubOutForTesting', ([], {}), '()\n', (3927, 3929), True, 'import tensorflow as tf\n'), ((4484, 4508), 'tensorboard.backend.event_p... |
# -*- coding: utf-8 -*-
from django.db import connection
from django.test import TestCase
from django.utils import unittest
from .models import TestModel
from django.core.cache import cache
class OrmCacheTest(TestCase):
def setUp(self):
self.ob1 = TestModel.objects.create(name='A')
self.ob2 = Tes... | [
"django.core.cache.cache.clear"
] | [((570, 583), 'django.core.cache.cache.clear', 'cache.clear', ([], {}), '()\n', (581, 583), False, 'from django.core.cache import cache\n')] |
from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
"""serializers for the user object"""
class Meta:
model = get_user_model()
fields = ('... | [
"rest_framework.serializers.CharField",
"django.utils.translation.ugettext_lazy",
"rest_framework.serializers.ValidationError",
"django.contrib.auth.get_user_model"
] | [((1065, 1088), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (1086, 1088), False, 'from rest_framework import serializers\n'), ((1104, 1182), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'style': "{'input_type': 'password'}", 'trim_whitespace': '(False)'})... |
import random, string, requests, json, pprint
from behave import *
from starlette import status
@given("we have authenticated at the innkeeper")
def get_innkeeper_token(context):
headers = {
"accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
}
data = {
... | [
"json.loads",
"requests.post",
"random.choice",
"pprint.pp"
] | [((617, 673), 'requests.post', 'requests.post', ([], {'url': 'token_url', 'data': 'data', 'headers': 'headers'}), '(url=token_url, data=data, headers=headers)\n', (630, 673), False, 'import random, string, requests, json, pprint\n'), ((761, 789), 'pprint.pp', 'pprint.pp', (['response.__dict__'], {}), '(response.__dict_... |
# -*- coding: utf-8 -*-
# Author: <NAME>
from __future__ import absolute_import, print_function, unicode_literals
import argparse
import input_data_crf
import json
import numpy as np
import os
import sys
import tensorflow as tf
from tqdm import tqdm, trange
def main(data_path, results_file, config):
##########... | [
"tensorflow.train.AdamOptimizer",
"tensorflow.concat",
"numpy.load",
"tqdm.trange",
"tensorflow.contrib.crf.crf_log_likelihood",
"tensorflow.split",
"tensorflow.square",
"tensorflow.control_dependencies",
"tensorflow.ConfigProto",
"argparse.ArgumentParser",
"tensorflow.ones",
"numpy.sum",
"t... | [((639, 663), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (661, 663), True, 'import tensorflow as tf\n'), ((1197, 1284), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {'shape': '(None, max_sentence_len, max_word_len)', 'name': '"""FFI"""'}), "(tf.int32, shape=(None, max_se... |
import random
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
'''
scissors = '''
_______
---' ____)____
______)
__________)
(____)
-... | [
"random.randint"
] | [((382, 402), 'random.randint', 'random.randint', (['(1)', '(3)'], {}), '(1, 3)\n', (396, 402), False, 'import random\n')] |
import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.2):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_drop... | [
"torch.nn.Dropout",
"torch.nn.functional.softmax",
"torch.matmul"
] | [((300, 324), 'torch.nn.Dropout', 'nn.Dropout', (['attn_dropout'], {}), '(attn_dropout)\n', (310, 324), True, 'import torch.nn as nn\n'), ((587, 608), 'torch.matmul', 'torch.matmul', (['attn', 'v'], {}), '(attn, v)\n', (599, 608), False, 'import torch\n'), ((545, 568), 'torch.nn.functional.softmax', 'F.softmax', (['att... |
import os
from flask import Flask, session, redirect, url_for
from authlib.flask.client import OAuth
from six.moves.urllib.parse import urlencode
app = Flask(__name__)
app.config["SECRET_KEY"] = os.environ["AUTH_FLASK_SECRET_KEY"]
AUTH0_CALLBACK_URL = "http://brymck.io/callback"
AUTH0_CLIENT_ID = os.environ["AUTH0_CL... | [
"authlib.flask.client.OAuth",
"flask.url_for",
"six.moves.urllib.parse.urlencode",
"flask.session.clear",
"flask.redirect",
"flask.Flask"
] | [((153, 168), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (158, 168), False, 'from flask import Flask, session, redirect, url_for\n'), ((509, 519), 'authlib.flask.client.OAuth', 'OAuth', (['app'], {}), '(app)\n', (514, 519), False, 'from authlib.flask.client import OAuth\n'), ((1340, 1353), 'flask.redir... |
#!/usr/local/bin/python3
# Copyright The Linux Foundation
#
# SPDX-License-Identifier: MIT
#
# Latest version and configuration instructions at:
# https://github.com/brianwarner/manage-groupsio-lists-from-github-action
import os
import sys
import getopt
import requests
import json
import yaml
import re
from strin... | [
"os.path.join",
"os.walk",
"yaml.full_load",
"re.compile",
"requests.Session",
"datetime.datetime.now",
"getopt.getopt",
"sys.exit"
] | [((620, 653), 'getopt.getopt', 'getopt.getopt', (['sys.argv[1:]', '"""dg"""'], {}), "(sys.argv[1:], 'dg')\n", (633, 653), False, 'import getopt\n'), ((2124, 2185), 're.compile', 're.compile', (['"""[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\\\.[a-zA-Z0-9-.]+"""'], {}), "('[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\\\.[a-zA-Z0-9-.]+')\n", (2... |
import os
import sys
import logging
from google.appengine.ext import vendor
vendor.add('lib')
sys.path.append(os.path.join(os.path.dirname(__file__), 'lib'))
logging.basicConfig(level=logging.INFO) | [
"os.path.dirname",
"google.appengine.ext.vendor.add",
"logging.basicConfig"
] | [((77, 94), 'google.appengine.ext.vendor.add', 'vendor.add', (['"""lib"""'], {}), "('lib')\n", (87, 94), False, 'from google.appengine.ext import vendor\n'), ((160, 199), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (179, 199), False, 'import logging\n'), ((12... |
# ***************************************************************
# Copyright (c) 2021 Jittor. All Rights Reserved.
# Maintainers:
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>.
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
# *******... | [
"jittor.dirty_fix_pytorch_runtime_error",
"jittor.nn.Resize",
"random.random",
"unittest.main",
"torch.nn.functional.interpolate",
"jittor.random",
"jittor.index",
"jittor.nn.PixelShuffle",
"numpy.random.randn",
"os.uname",
"unittest.skipIf",
"torch.nn.Upsample",
"torch.Tensor",
"torch.nn.... | [((490, 526), 'jittor.dirty_fix_pytorch_runtime_error', 'jt.dirty_fix_pytorch_runtime_error', ([], {}), '()\n', (524, 526), True, 'import jittor as jt\n'), ((1129, 1151), 'jittor.index', 'jt.index', (['shape'], {'dim': '(1)'}), '(shape, dim=1)\n', (1137, 1151), True, 'import jittor as jt\n'), ((1162, 1184), 'jittor.ind... |
from contrast.scans.Mesh import Mesh
from contrast.motors import all_are_motors
from contrast.environment import macro, MacroSyntaxError, runCommand
from contrast.detectors import Detector, TriggeredDetector
from contrast.motors.LC400 import LC400Waveform
import time
@macro
class NpointFlyscan(Mesh):
"""
Flys... | [
"contrast.motors.LC400.LC400Waveform",
"contrast.detectors.Detector.get_active",
"contrast.motors.all_are_motors",
"time.sleep"
] | [((853, 880), 'contrast.motors.all_are_motors', 'all_are_motors', (['args[:-2:4]'], {}), '(args[:-2:4])\n', (867, 880), False, 'from contrast.motors import all_are_motors\n'), ((1830, 1851), 'contrast.detectors.Detector.get_active', 'Detector.get_active', ([], {}), '()\n', (1849, 1851), False, 'from contrast.detectors ... |
from test.parser.pattern.nodes.base import PatternTestBaseClass
from programy.parser.pattern.nodes.iset import PatternISetNode
class PatternSetNodeTests(PatternTestBaseClass):
def test_init(self):
node = PatternISetNode("test1, test2, test3")
self.assertIsNotNone(node)
self.assertFalse(n... | [
"programy.parser.pattern.nodes.iset.PatternISetNode"
] | [((219, 257), 'programy.parser.pattern.nodes.iset.PatternISetNode', 'PatternISetNode', (['"""test1, test2, test3"""'], {}), "('test1, test2, test3')\n", (234, 257), False, 'from programy.parser.pattern.nodes.iset import PatternISetNode\n'), ((1602, 1626), 'programy.parser.pattern.nodes.iset.PatternISetNode', 'PatternIS... |
import numpy as np
from sklearn.metrics import accuracy_score
from numba.experimental import jitclass
from stackboost.utils.activation_functions import Sigmoid
class Loss(object):
def loss(self, y_true, y_pred):
return NotImplementedError()
def gradient(self, y, y_pred):
raise NotImplementedE... | [
"numba.experimental.jitclass",
"numpy.power",
"numpy.clip",
"stackboost.utils.activation_functions.Sigmoid",
"numpy.log",
"numpy.mean",
"numpy.argmax"
] | [((378, 388), 'numba.experimental.jitclass', 'jitclass', ([], {}), '()\n', (386, 388), False, 'from numba.experimental import jitclass\n'), ((1098, 1108), 'numba.experimental.jitclass', 'jitclass', ([], {}), '()\n', (1106, 1108), False, 'from numba.experimental import jitclass\n'), ((783, 811), 'numpy.clip', 'np.clip',... |
# Copyright (C) 2014 Nippon Telegraph and Telephone Corporation.
#
# 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... | [
"os_ken.services.protocols.bgp.utils.validation.is_valid_ext_comm_attr",
"logging.getLogger",
"os_ken.services.protocols.bgp.utils.validation.is_valid_asn",
"os_ken.services.protocols.bgp.base.validate",
"os_ken.services.protocols.bgp.base.add_bgp_error_metadata",
"os_ken.services.protocols.bgp.base.get_v... | [((1253, 1296), 'logging.getLogger', 'logging.getLogger', (['"""bgpspeaker.rtconf.base"""'], {}), "('bgpspeaker.rtconf.base')\n", (1270, 1296), False, 'import logging\n'), ((2809, 2924), 'os_ken.services.protocols.bgp.base.add_bgp_error_metadata', 'add_bgp_error_metadata', ([], {'code': 'RUNTIME_CONF_ERROR_CODE', 'sub_... |
import json
import urllib.parse
import boto3
print('Loading function')
s3 = boto3.client('s3')
def lambda_handler(event, context):
print("Received event: " + json.dumps(event, indent=2))
# import ptvsd
# ptvsd.enable_attach(address=('0.0.0.0', 5678), redirect_output=True)
# ptvsd.wait_for_attach()
... | [
"json.dumps",
"boto3.client"
] | [((79, 97), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (91, 97), False, 'import boto3\n'), ((167, 194), 'json.dumps', 'json.dumps', (['event'], {'indent': '(2)'}), '(event, indent=2)\n', (177, 194), False, 'import json\n')] |
import time
from machine import I2C, Pin
CCS811_ADDR = 0x5B
class CCS811:
def __init__(self, i2c: I2C):
self._i2c = i2c
def setup(self):
print("setup CCS811")
self.multi_write_register(0xFF, b"\x11\xE5\x72\x8A") # RESET
time.sleep_ms(100)
self.check_for_status_error... | [
"machine.Pin",
"time.sleep_ms",
"time.sleep"
] | [((265, 283), 'time.sleep_ms', 'time.sleep_ms', (['(100)'], {}), '(100)\n', (278, 283), False, 'import time\n'), ((424, 442), 'time.sleep_ms', 'time.sleep_ms', (['(100)'], {}), '(100)\n', (437, 442), False, 'import time\n'), ((483, 501), 'time.sleep_ms', 'time.sleep_ms', (['(100)'], {}), '(100)\n', (496, 501), False, '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import find_packages
from setuptools import setup
CURRENT_DIR = os.path.dirname(__file__)
def get_lib_path():
"""Get library path, name and version"""
# We can not import `libinfo.py` in setup.py directly since __init__.py
# Will be... | [
"os.path.join",
"os.path.dirname",
"setuptools.find_packages"
] | [((138, 163), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (153, 163), False, 'import os\n'), ((375, 424), 'os.path.join', 'os.path.join', (['CURRENT_DIR', '"""./dgllife/libinfo.py"""'], {}), "(CURRENT_DIR, './dgllife/libinfo.py')\n", (387, 424), False, 'import os\n'), ((939, 954), 'setupto... |
# From: https://github.com/CompVis/latent-diffusion/blob/main/ldm/models/diffusion/plms.py
import torch
import numpy as np
from lama_cleaner.model.utils import make_ddim_timesteps, make_ddim_sampling_parameters, noise_like
from tqdm import tqdm
class PLMSSampler(object):
def __init__(self, model, schedule="linear... | [
"torch.cat",
"lama_cleaner.model.utils.make_ddim_timesteps",
"lama_cleaner.model.utils.noise_like",
"torch.nn.functional.dropout",
"torch.no_grad",
"torch.sqrt",
"numpy.sqrt",
"torch.full",
"numpy.flip",
"torch.randn",
"tqdm.tqdm"
] | [((3019, 3034), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3032, 3034), False, 'import torch\n'), ((5535, 5550), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (5548, 5550), False, 'import torch\n'), ((8299, 8314), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (8312, 8314), False, 'import torch\n')... |
"""
============
Multiprocess
============
Demo of using multiprocessing for generating data in one process and
plotting in another.
Written by <NAME>
"""
import multiprocessing as mp
import time
import matplotlib.pyplot as plt
import numpy as np
# Fixing random state for reproducibility
np.random.seed(19680801)
... | [
"numpy.random.random",
"multiprocessing.Process",
"matplotlib.pyplot.show",
"multiprocessing.set_start_method",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.close",
"numpy.random.seed",
"matplotlib.pyplot.get_backend",
"multiprocessing.Pipe",
"time.sleep"
] | [((294, 318), 'numpy.random.seed', 'np.random.seed', (['(19680801)'], {}), '(19680801)\n', (308, 318), True, 'import numpy as np\n'), ((615, 631), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (624, 631), True, 'import matplotlib.pyplot as plt\n'), ((1149, 1163), 'matplotlib.pyplot.subplots'... |
# Code inspired from: https://github.com/zsdonghao/seq2seq-chatbot/blob/master/main_simple_seq2seq.py
import os
import pdb
import sys
import time
from optparse import OptionParser
import numpy as np
import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import *
from data.twitter import data
from sk... | [
"tensorflow.train.AdamOptimizer",
"tensorlayer.prepro.sequences_get_mask",
"tensorflow.ConfigProto",
"tensorlayer.prepro.sequences_add_end_id",
"tensorlayer.nlp.sample_top",
"tensorlayer.layers.set_name_reuse",
"tensorlayer.prepro.remove_pad_sequences",
"sklearn.utils.shuffle",
"data.twitter.data.lo... | [((357, 371), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (369, 371), False, 'from optparse import OptionParser\n'), ((1016, 1036), 'data.twitter.data.load_data', 'data.load_data', (['path'], {}), '(path)\n', (1030, 1036), False, 'from data.twitter import data\n'), ((1094, 1126), 'data.twitter.data.split... |
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from datetime import datetime, timedelta
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import dash_actions... | [
"dash_html_components.Button",
"pandas.to_datetime",
"dash_html_components.Div",
"dash.dependencies.Input",
"pandas.read_csv",
"dash.Dash",
"pandas.DataFrame",
"plotly.subplots.make_subplots",
"plotly.graph_objects.Figure",
"dash_html_components.A",
"dash_core_components.Input",
"dash.dependen... | [((628, 718), 'dash.Dash', 'dash.Dash', (['__name__'], {'meta_tags': "[{'name': 'viewport', 'content': 'width=device-width'}]"}), "(__name__, meta_tags=[{'name': 'viewport', 'content':\n 'width=device-width'}])\n", (637, 718), False, 'import dash\n'), ((892, 929), 'pandas.read_csv', 'pd.read_csv', (['"""assets/msft_... |
# coding: utf-8
from devito import TimeFunction, memoized_meth
from examples.seismic.tti.operators import ForwardOperator
from examples.seismic import Receiver
class AnisotropicWaveSolver(object):
"""
Solver object that provides operators for seismic inversion problems
and encapsulates the time and space ... | [
"examples.seismic.tti.operators.ForwardOperator",
"devito.TimeFunction",
"examples.seismic.Receiver"
] | [((1251, 1399), 'examples.seismic.tti.operators.ForwardOperator', 'ForwardOperator', (['self.model'], {'save': 'save', 'source': 'self.source', 'receiver': 'self.receiver', 'space_order': 'self.space_order', 'kernel': 'kernel'}), '(self.model, save=save, source=self.source, receiver=self.\n receiver, space_order=sel... |
from libxmp.utils import file_to_dict
MAPPING = {
'http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/': {'Iptc4xmpCore:Location': 'ID.INV',
'Iptc4xmpCore:CreatorContactInfo/Iptc4xmpCore:CiAdrCity': 'LOCATION.ORIG',
'I... | [
"libxmp.utils.file_to_dict"
] | [((768, 790), 'libxmp.utils.file_to_dict', 'file_to_dict', (['filepath'], {}), '(filepath)\n', (780, 790), False, 'from libxmp.utils import file_to_dict\n')] |
"""Road network model
This file contains the main road network model class
Classes:
RoadNetworkModel
"""
import xml.etree.ElementTree as ET
import networkx as nx
import re, os
from environments.sumo.model.base_components import *
from environments.sumo.model.system_components import *
import pdb
import traci... | [
"os.path.join",
"networkx.all_simple_paths",
"networkx.all_pairs_dijkstra_path_length",
"traci.edge.getTraveltime",
"traci.lane.getMaxSpeed",
"networkx.utils.pairwise",
"xml.etree.ElementTree.parse",
"networkx.DiGraph",
"networkx.shortest_path",
"networkx.has_path"
] | [((3757, 3878), 'networkx.DiGraph', 'nx.DiGraph', (["[(connection.fromEdge, connection.toEdge, {'connection': connection}) for\n connection in self.connections]"], {}), "([(connection.fromEdge, connection.toEdge, {'connection':\n connection}) for connection in self.connections])\n", (3767, 3878), True, 'import ne... |
from flask import url_for, json
from lib.tests import ViewTestMixin, assert_status_with_message
class TestBilling(ViewTestMixin):
def test_pricing_page(self):
""" Pricing page renders successfully. """
response = self.client.get(url_for('billing.pricing'))
assert_status_with_message(200, ... | [
"flask.url_for",
"flask.json.loads",
"lib.tests.assert_status_with_message"
] | [((288, 340), 'lib.tests.assert_status_with_message', 'assert_status_with_message', (['(200)', 'response', '"""Sign up"""'], {}), "(200, response, 'Sign up')\n", (314, 340), False, 'from lib.tests import ViewTestMixin, assert_status_with_message\n'), ((529, 582), 'lib.tests.assert_status_with_message', 'assert_status_w... |
## @file
# This file is used to parse DEC file. It will consumed by DecParser
#
# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distributi... | [
"Object.Parser.DecObject.DecLibraryclassObject",
"Object.Parser.DecObject.DecGuidItemObject",
"Object.Parser.DecObject.DecDefineObject",
"Object.Parser.DecObject.DecUserExtensionObject",
"Library.DataType.TAB_PCD_ERROR.upper",
"Parser.DecParserMisc.ParserHelper",
"Parser.DecParserMisc.StripRoot",
"Lib... | [((5742, 5927), 'Logger.Log.Error', 'Logger.Error', (['TOOL_NAME', 'FILE_PARSE_FAILURE'], {'File': 'self._RawData.Filename', 'Line': 'self._RawData.LineIndex', 'ExtraData': '(ErrorString + ST.ERR_DECPARSE_LINE % self._RawData.CurrentLine)'}), '(TOOL_NAME, FILE_PARSE_FAILURE, File=self._RawData.Filename,\n Line=self.... |
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from django.contrib.auth.models import User
from django.db import IntegrityError
from django.contrib.auth import login, logout, authenticate
from django.utils import timezone
from ... | [
"django.contrib.auth.forms.AuthenticationForm",
"django.contrib.auth.logout",
"django.shortcuts.render",
"django.shortcuts.redirect",
"django.contrib.auth.decorators.login_required",
"django.shortcuts.get_object_or_404",
"django.utils.timezone.now",
"django.contrib.auth.authenticate",
"django.contri... | [((2144, 2181), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""loginuser"""'}), "(login_url='loginuser')\n", (2158, 2181), False, 'from django.contrib.auth.decorators import login_required\n'), ((2711, 2748), 'django.contrib.auth.decorators.login_required', 'login_required', (... |
#
# sublimelinter.py
# Part of SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by <NAME> and <NAME>
#
# Project: https://github.com/SublimeLinter/SublimeLinter3
# License: MIT
#
"""This module provides the SublimeLinter plugin class and supporting methods."""
import os
import re
import subli... | [
"re.compile",
"sublime.packages_path",
"sublime.windows",
"os.path.split",
"sublime.active_window",
"os.path.basename"
] | [((1119, 1142), 'sublime.active_window', 'sublime.active_window', ([], {}), '()\n', (1140, 1142), False, 'import sublime\n'), ((1380, 1434), 're.compile', 're.compile', (['"""^SublimeLinter(-.+?)?\\\\.sublime-settings"""'], {}), "('^SublimeLinter(-.+?)?\\\\.sublime-settings')\n", (1390, 1434), False, 'import re\n'), ((... |
"""
:copyright: © 2020 by the Lin team.
:license: MIT, see LICENSE for more details.
"""
import re
import time
from lin import manager
from lin.exception import ParameterError
from lin.form import Form
from wtforms import DateTimeField, FieldList, IntegerField, PasswordField, StringField
from wtforms.validator... | [
"wtforms.StringField",
"re.match",
"time.strptime",
"wtforms.validators.NumberRange",
"wtforms.DateTimeField",
"wtforms.validators.length",
"wtforms.validators.Regexp",
"lin.exception.ParameterError",
"lin.manager.group_model.count_by_id",
"wtforms.validators.DataRequired",
"lin.manager.permissi... | [((425, 444), 'wtforms.StringField', 'StringField', (['"""电子邮件"""'], {}), "('电子邮件')\n", (436, 444), False, 'from wtforms import DateTimeField, FieldList, IntegerField, PasswordField, StringField\n'), ((2653, 2666), 'wtforms.StringField', 'StringField', ([], {}), '()\n', (2664, 2666), False, 'from wtforms import DateTim... |
import socket
address = ("localhost", 12345)
server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server.bind(address)
data, client = server.recvfrom(4096)
print(server, data)
server.sendto(b"Hi!", client)
server.close()
| [
"socket.socket"
] | [((55, 103), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (68, 103), False, 'import socket\n')] |
# Copyright 2017, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | [
"google.cloud.firestore.Client",
"datetime.datetime.now",
"google.cloud.firestore.ArrayUnion",
"threading.Event",
"google.cloud.firestore.Increment",
"time.sleep",
"google.cloud.firestore.ArrayRemove"
] | [((861, 879), 'google.cloud.firestore.Client', 'firestore.Client', ([], {}), '()\n', (877, 879), False, 'from google.cloud import firestore\n'), ((973, 991), 'google.cloud.firestore.Client', 'firestore.Client', ([], {}), '()\n', (989, 991), False, 'from google.cloud import firestore\n'), ((1272, 1290), 'google.cloud.fi... |
from django.contrib import admin
from .models import Article, Comment
# Register your models here.
class CommentInline(admin.TabularInline):
model = Comment
class ArticleAdmin(admin.ModelAdmin):
inlines = [
CommentInline
]
admin.site.register(Article, ArticleAdmin)
admin.site.register(Comment)
| [
"django.contrib.admin.site.register"
] | [((243, 285), 'django.contrib.admin.site.register', 'admin.site.register', (['Article', 'ArticleAdmin'], {}), '(Article, ArticleAdmin)\n', (262, 285), False, 'from django.contrib import admin\n'), ((286, 314), 'django.contrib.admin.site.register', 'admin.site.register', (['Comment'], {}), '(Comment)\n', (305, 314), Fal... |
from django.conf.urls import include, url
from .views import TicketViewSet, TicketPriorityViewSet, TicketProblemViewSet,\
ticket_list, ticket_create, get_ticket, answer_ticket, reply_ticket,\
close_ticket, closed_ticket_list, pending_ticket_list, load_user, save_user
from rest_framework.routers import SimpleRou... | [
"rest_framework.routers.SimpleRouter",
"django.conf.urls.include",
"django.conf.urls.url"
] | [((334, 348), 'rest_framework.routers.SimpleRouter', 'SimpleRouter', ([], {}), '()\n', (346, 348), False, 'from rest_framework.routers import SimpleRouter\n'), ((532, 586), 'django.conf.urls.url', 'url', (['"""^ticket_list/$"""', 'ticket_list'], {'name': '"""ticket_list"""'}), "('^ticket_list/$', ticket_list, name='tic... |
import tensorflow as tf
a = tf.placeholder(tf.int32, [None])
b = tf.constant(10)
multiply_operation = a * b
sess = tf.Session()
result = sess.run(multiply_operation, feed_dict={a: [1, 2, 3, 4, 5]})
print(result)
result = sess.run(multiply_operation, feed_dict={a: [10, 20]})
print(result)
| [
"tensorflow.constant",
"tensorflow.Session",
"tensorflow.placeholder"
] | [((29, 61), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[None]'], {}), '(tf.int32, [None])\n', (43, 61), True, 'import tensorflow as tf\n'), ((66, 81), 'tensorflow.constant', 'tf.constant', (['(10)'], {}), '(10)\n', (77, 81), True, 'import tensorflow as tf\n'), ((118, 130), 'tensorflow.Session', 'tf.Sess... |
# Credits: @mrismanaziz
# Thanks To @tofik_dn || https://github.com/tofikdn
# FROM Man-Userbot <https://github.com/mrismanaziz/Man-Userbot>
# t.me/SharingUserbot & t.me/Lunatic0de
from pytgcalls import StreamType
from pytgcalls.types import Update
from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped
fr... | [
"userbot.utils.thumbnail.gen_thumb",
"userbot.call_py.leave_group_call",
"pytgcalls.types.input_stream.quality.HighQualityAudio",
"youtubesearchpython.VideosSearch",
"pytgcalls.types.input_stream.quality.LowQualityVideo",
"userbot.utils.ayiin_cmd",
"userbot.utils.edit_or_reply",
"userbot.utils.queues.... | [((3083, 3128), 'userbot.utils.ayiin_cmd', 'ayiin_cmd', ([], {'pattern': '"""play(?:\\\\s|$)([\\\\s\\\\S]*)"""'}), "(pattern='play(?:\\\\s|$)([\\\\s\\\\S]*)')\n", (3092, 3128), False, 'from userbot.utils import bash, edit_delete, edit_or_reply, ayiin_cmd\n'), ((7557, 7603), 'userbot.utils.ayiin_cmd', 'ayiin_cmd', ([], ... |
import agx
import agxIO
import agxSDK
import agxOSG
import agxPython
import agxCollide
import osg
from agxRender import Color
from agxUtil import createTrimesh
def sim() -> agxSDK.Simulation:
return agxPython.getContext().environment.getSimulation()
def app() -> agxOSG.ExampleApplication:
return agxPython.... | [
"agxOSG.ExampleApplication",
"agxRender.Color.DodgerBlue",
"agx.AutoInit",
"agx.Frame",
"agxCollide.GeometryContactPtrVector",
"agx.Matrix3x3",
"agxIO.Environment_instance",
"agxOSG.setAmbientColor",
"agxPython.getContext",
"agxOSG.setAlpha",
"agxRender.Color.SkyBlue",
"agx.Constraint.calculat... | [((2115, 2130), 'agxRender.Color.SkyBlue', 'Color.SkyBlue', ([], {}), '()\n', (2128, 2130), False, 'from agxRender import Color\n'), ((2140, 2158), 'agxRender.Color.DodgerBlue', 'Color.DodgerBlue', ([], {}), '()\n', (2156, 2158), False, 'from agxRender import Color\n'), ((2330, 2352), 'agx.Vec3', 'agx.Vec3', (['(-25)',... |
"""Simple-Salesforce Package Setup"""
from setuptools import setup
import textwrap
import sys
import os
pyver_install_requires = []
pyver_tests_require = []
if sys.version_info < (2, 7):
pyver_install_requires.append('ordereddict>=1.1')
pyver_tests_require.append('unittest2>=0.5.1')
if sys.version_info < (3... | [
"os.path.join",
"os.path.dirname"
] | [((397, 422), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (412, 422), False, 'import os\n'), ((446, 503), 'os.path.join', 'os.path.join', (['here', '"""simple_salesforce"""', '"""__version__.py"""'], {}), "(here, 'simple_salesforce', '__version__.py')\n", (458, 503), False, 'import os\n')] |
from vmcjp.utils import dbutils
from vmcjp.utils import msg_const, cmd_const
from vmcjp.slack.messages import message_handler
from vmcjp.slack.command import command_handler
def event_cred_update(event, cred):
event.update(
{
"token": cred.get("token"),
"org_id": cred.get("org_id")
... | [
"vmcjp.slack.messages.message_handler",
"vmcjp.slack.command.command_handler"
] | [((652, 699), 'vmcjp.slack.messages.message_handler', 'message_handler', (['msg_const.ASK_WAIT_TASK', 'event'], {}), '(msg_const.ASK_WAIT_TASK, event)\n', (667, 699), False, 'from vmcjp.slack.messages import message_handler\n'), ((994, 1047), 'vmcjp.slack.command.command_handler', 'command_handler', (['cmd_const.CANCEL... |
import asyncio
from abc import ABC, abstractmethod
from contextlib import suppress
from datetime import timedelta
from typing import Any, AsyncGenerator, Callable, Dict, List, Optional
from graphql import (
ExecutionResult as GraphQLExecutionResult,
GraphQLError,
GraphQLSyntaxError,
parse,
)
from graph... | [
"strawberry.subscriptions.protocols.graphql_transport_ws.types.CompleteMessage",
"strawberry.utils.operation.get_operation_type",
"strawberry.subscriptions.protocols.graphql_transport_ws.types.ConnectionAckMessage",
"strawberry.utils.debug.pretty_print_graphql_operation",
"graphql.parse",
"strawberry.subs... | [((2308, 2344), 'asyncio.create_task', 'asyncio.create_task', (['timeout_handler'], {}), '(timeout_handler)\n', (2327, 2344), False, 'import asyncio\n'), ((2521, 2547), 'asyncio.sleep', 'asyncio.sleep', ([], {'delay': 'delay'}), '(delay=delay)\n', (2534, 2547), False, 'import asyncio\n'), ((4966, 4994), 'graphql.parse'... |
import pickle
from bonobo.config import Option
from bonobo.config.processors import ContextProcessor
from bonobo.constants import NOT_MODIFIED
from bonobo.nodes.io.base import FileHandler, IOFormatEnabled
from bonobo.nodes.io.file import FileReader, FileWriter
from bonobo.util.objects import ValueHolder
class Pickle... | [
"bonobo.config.Option",
"pickle.load",
"pickle.dumps",
"bonobo.util.objects.ValueHolder"
] | [((509, 538), 'bonobo.config.Option', 'Option', (['tuple'], {'required': '(False)'}), '(tuple, required=False)\n', (515, 538), False, 'from bonobo.config import Option\n'), ((697, 722), 'bonobo.config.Option', 'Option', (['str'], {'default': '"""rb"""'}), "(str, default='rb')\n", (703, 722), False, 'from bonobo.config ... |
#!/usr/bin/python3
import time
import blinkt
blinkt.set_clear_on_exit()
step = 0
while True:
if step == 0:
blinkt.set_all(128, 0, 0)
if step == 1:
blinkt.set_all(0, 128, 0)
if step == 2:
blinkt.set_all(0, 0, 128)
step += 1
step %= 3
blinkt.show()
time.sleep(0... | [
"blinkt.show",
"blinkt.set_all",
"time.sleep",
"blinkt.set_clear_on_exit"
] | [((49, 75), 'blinkt.set_clear_on_exit', 'blinkt.set_clear_on_exit', ([], {}), '()\n', (73, 75), False, 'import blinkt\n'), ((290, 303), 'blinkt.show', 'blinkt.show', ([], {}), '()\n', (301, 303), False, 'import blinkt\n'), ((308, 323), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (318, 323), False, 'import t... |
from __future__ import absolute_import, division, print_function
from builtins import (bytes, str, open, super, range,
zip, round, input, int, pow, object, map, zip)
__author__ = "<NAME>"
# Standard library
# eg copy
# absolute import rg:from copy import deepcopy
import os
# Dependencies
# e... | [
"io.StringIO",
"json.dumps",
"builtins.super",
"cdci_data_analysis.analysis.products.QueryOutput",
"astropy.io.ascii.read",
"pickle.dumps",
"astropy.table.Table.read"
] | [((2255, 2281), 'json.dumps', 'json.dumps', (['self.meta_data'], {}), '(self.meta_data)\n', (2265, 2281), False, 'import json\n'), ((8214, 8227), 'cdci_data_analysis.analysis.products.QueryOutput', 'QueryOutput', ([], {}), '()\n', (8225, 8227), False, 'from cdci_data_analysis.analysis.products import BaseQueryProduct, ... |
from future.utils import python_2_unicode_compatible
from django.utils.html import strip_tags
from django.utils.text import Truncator
from django.utils.translation import ugettext_lazy as _
from fluent_contents.extensions import PluginHtmlField
from fluent_contents.models import ContentItem
from fluent_contents.plugins... | [
"chakert.Typograph.typograph_html",
"django.utils.html.strip_tags",
"django.utils.translation.ugettext_lazy",
"django_wysiwyg.utils.clean_html",
"django_wysiwyg.utils.sanitize_html"
] | [((634, 643), 'django.utils.translation.ugettext_lazy', '_', (['"""text"""'], {}), "('text')\n", (635, 643), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((697, 706), 'django.utils.translation.ugettext_lazy', '_', (['"""Text"""'], {}), "('Text')\n", (698, 706), True, 'from django.utils.translatio... |
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
if needle=="":
return 0
import re
result=re.search(needle,haystack)
try:
result=result.span()[0]
return result
except:
return -1
| [
"re.search"
] | [((150, 177), 're.search', 're.search', (['needle', 'haystack'], {}), '(needle, haystack)\n', (159, 177), False, 'import re\n')] |
import numpy as np
import scipy.special as spec
import properties
###################################################
# STEP OFF WAVEFORM
###################################################
class StepOff(properties.HasProperties):
"""
"""
t0 = properties.Float('Start of off-time', default=0.... | [
"properties.observer",
"numpy.reshape",
"numpy.exp",
"numpy.max",
"numpy.interp",
"numpy.where",
"properties.Float",
"numpy.abs",
"properties.Array",
"properties.validator",
"numpy.min",
"numpy.ones",
"numpy.log",
"scipy.special.expi",
"numpy.float64",
"numpy.sign"
] | [((272, 322), 'properties.Float', 'properties.Float', (['"""Start of off-time"""'], {'default': '(0.0)'}), "('Start of off-time', default=0.0)\n", (288, 322), False, 'import properties\n'), ((4374, 4424), 'properties.Float', 'properties.Float', (['"""Start of off-time"""'], {'default': '(0.0)'}), "('Start of off-time',... |
import argparse
import json
from pathlib import Path
from urllib.parse import urljoin
import requests
PORTAL_URL = "https://www.encodeproject.org"
REFERENCE_FILES = {
"GRCh38": {
"restriction_sites": {
"HindIII": urljoin(
PORTAL_URL, "/files/ENCFF984SUZ/@@download/ENCFF984SUZ.... | [
"urllib.parse.urljoin",
"argparse.ArgumentParser",
"json.dumps",
"pathlib.Path"
] | [((5040, 5065), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (5063, 5065), False, 'import argparse\n'), ((622, 693), 'urllib.parse.urljoin', 'urljoin', (['PORTAL_URL', '"""/files/ENCFF643CGH/@@download/ENCFF643CGH.tar.gz"""'], {}), "(PORTAL_URL, '/files/ENCFF643CGH/@@download/ENCFF643CGH.tar.... |
from aiogram import types
from app.middlewares.i18n import i18n
from app.misc import dp
from app.utils.superuser import create_super_user
_ = i18n.gettext
@dp.message_handler(commands=["set_superuser"], is_superuser=True)
async def cmd_superuser(message: types.Message):
args = message.get_args()
if not args... | [
"app.misc.dp.message_handler",
"app.utils.superuser.create_super_user"
] | [((160, 225), 'app.misc.dp.message_handler', 'dp.message_handler', ([], {'commands': "['set_superuser']", 'is_superuser': '(True)'}), "(commands=['set_superuser'], is_superuser=True)\n", (178, 225), False, 'from app.misc import dp\n'), ((501, 550), 'app.utils.superuser.create_super_user', 'create_super_user', ([], {'us... |
"""
Internal package providing a Python CRUD interface to MLflow models and versions.
This is a lower level API than the :py:mod:`mlflow.tracking.fluent` module, and is
exposed in the :py:mod:`mlflow.tracking` module.
"""
import logging
from kiwi.exceptions import MlflowException
from kiwi.store.model_registry import... | [
"logging.getLogger",
"kiwi.tracking._model_registry.utils._get_store",
"kiwi.exceptions.MlflowException"
] | [((501, 528), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (518, 528), False, 'import logging\n'), ((899, 934), 'kiwi.tracking._model_registry.utils._get_store', 'utils._get_store', (['self.registry_uri'], {}), '(self.registry_uri)\n', (915, 934), False, 'from kiwi.tracking._model_regis... |
from __future__ import annotations
import contextlib
import typing
from abc import ABC
from typing import cast
from sqlalchemy import lambda_stmt, select, update, exists, delete, func
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy.ext.asyncio import AsyncSessionTransaction, AsyncSession
from sqlalc... | [
"sqlalchemy.delete",
"typing.TypeVar",
"sqlalchemy.func.count",
"sqlalchemy.dialects.postgresql.insert",
"sqlalchemy.update",
"typing.cast",
"sqlalchemy.select"
] | [((461, 484), 'typing.TypeVar', 'typing.TypeVar', (['"""Model"""'], {}), "('Model')\n", (475, 484), False, 'import typing\n'), ((3596, 3622), 'typing.cast', 'typing.cast', (['Model', 'result'], {}), '(Model, result)\n', (3607, 3622), False, 'import typing\n'), ((4398, 4440), 'typing.cast', 'typing.cast', (['typing.Opti... |
# -*- coding: utf-8 -*-
# @Time : 2020/12/14
# @Author : <NAME>
# @FileName: LSTM.py
# @Software: PyCharm
# @Description: Here
import torch
import torch.nn as nn
class LSTM(nn.Module):
def __init__(self, in_dim=10319, dropout=0.0):
super(LSTM, self).__init__()
self.dropout = dropout
... | [
"torch.unsqueeze",
"torch.nn.Linear",
"torch.nn.Dropout",
"torch.squeeze",
"torch.nn.LeakyReLU",
"torch.nn.LSTM"
] | [((332, 370), 'torch.nn.LSTM', 'nn.LSTM', (['in_dim', '(512)'], {'batch_first': '(True)'}), '(in_dim, 512, batch_first=True)\n', (339, 370), True, 'import torch.nn as nn\n'), ((645, 666), 'torch.unsqueeze', 'torch.unsqueeze', (['x', '(1)'], {}), '(x, 1)\n', (660, 666), False, 'import torch\n'), ((708, 728), 'torch.sque... |
"""
Mongodb database functions.
"""
import mongomock
from pymongo import MongoClient
from flask import g, current_app
def get_connection():
"""
Return a mongodb connection. It stores the connection inside the `g` object.
"""
if "connection" not in g:
if current_app.config["TESTING"]:
... | [
"pymongo.MongoClient",
"mongomock.MongoClient"
] | [((338, 361), 'mongomock.MongoClient', 'mongomock.MongoClient', ([], {}), '()\n', (359, 361), False, 'import mongomock\n'), ((403, 447), 'pymongo.MongoClient', 'MongoClient', (["current_app.config['db']['uri']"], {}), "(current_app.config['db']['uri'])\n", (414, 447), False, 'from pymongo import MongoClient\n')] |
# -*- coding:utf-8 -*-
import better_exceptions
better_exceptions.hook()
def _deep(val):
return 1 / val
def div():
return _deep("天")
div()
| [
"better_exceptions.hook"
] | [((49, 73), 'better_exceptions.hook', 'better_exceptions.hook', ([], {}), '()\n', (71, 73), False, 'import better_exceptions\n')] |
import csv
import glob
import os
import random
import shutil
#from PIL import Image
#from skimage import io
import cv2
def get_data():
filenames = [os.path.splitext(f)[0] for f in glob.glob("original/*.jpg")]
jpg_files = [s + ".jpg" for s in filenames]
txt_files = [s + ".txt" for s in filenames]
for f... | [
"shutil.copy",
"os.path.splitext",
"csv.writer",
"csv.reader",
"glob.glob"
] | [((715, 745), 'shutil.copy', 'shutil.copy', (['jpg', '"""mlt/image/"""'], {}), "(jpg, 'mlt/image/')\n", (726, 745), False, 'import shutil\n'), ((153, 172), 'os.path.splitext', 'os.path.splitext', (['f'], {}), '(f)\n', (169, 172), False, 'import os\n'), ((185, 212), 'glob.glob', 'glob.glob', (['"""original/*.jpg"""'], {... |
import tkinter
def init():
root = tkinter.Tk()
path = '/home/giacomov/develop/pyBurstAnalysisGUI/python/GtBurst/tcl_extensions/msgcat'
root.tk.eval("set auto_path [linsert $auto_path 0 %s]" %(path))
path = '/home/giacomov/develop/pyBurstAnalysisGUI/python/GtBurst/tcl_extensions/fsdialog'
root.tk.eval(... | [
"tkinter.Tk",
"tkinter._flatten"
] | [((40, 52), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (50, 52), False, 'import tkinter\n'), ((1776, 1798), 'tkinter._flatten', 'tkinter._flatten', (['opts'], {}), '(opts)\n', (1792, 1798), False, 'import tkinter\n'), ((1933, 1945), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (1943, 1945), False, 'import tkinter\n... |
from ast import literal_eval
from typing import Any, Dict, List, Optional, Type, Union
import numpy as np
from tempo.serve.metadata import ModelDataArgs, ModelDetails
from tempo.serve.protocol import Protocol
_REQUEST_NUMPY_CONTENT_TYPE = {"content_type": "np"}
_v2tymap: Dict[str, np.dtype] = {
"BOOL": np.dtype... | [
"numpy.array",
"ast.literal_eval",
"numpy.dtype"
] | [((312, 328), 'numpy.dtype', 'np.dtype', (['"""bool"""'], {}), "('bool')\n", (320, 328), True, 'import numpy as np\n'), ((343, 360), 'numpy.dtype', 'np.dtype', (['"""uint8"""'], {}), "('uint8')\n", (351, 360), True, 'import numpy as np\n'), ((376, 394), 'numpy.dtype', 'np.dtype', (['"""uint16"""'], {}), "('uint16')\n",... |
# -*- coding: utf-8 -*-
import six
from flask import g
from flask import request
from nplusone.core import signals
from nplusone.core import listeners
from nplusone.core import notifiers
import nplusone.ext.sqlalchemy # noqa
def get_worker():
try:
return request._get_current_object()
except Runtim... | [
"nplusone.core.listeners.Rule",
"nplusone.core.notifiers.init",
"flask.g.listeners.pop",
"six.iteritems",
"flask.request._get_current_object",
"six.iterkeys"
] | [((273, 302), 'flask.request._get_current_object', 'request._get_current_object', ([], {}), '()\n', (300, 302), False, 'from flask import request\n'), ((619, 645), 'nplusone.core.notifiers.init', 'notifiers.init', (['app.config'], {}), '(app.config)\n', (633, 645), False, 'from nplusone.core import notifiers\n'), ((685... |
"""Vlan order options."""
# :license: MIT, see LICENSE for more details.
# pylint: disable=too-many-statements
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
@click.command(cls=SoftLayer.CLI.command.SLCommand, short_help="Get options to use for creating Vlan ... | [
"SoftLayer.CLI.formatting.Table",
"SoftLayer.NetworkManager",
"click.command"
] | [((220, 335), 'click.command', 'click.command', ([], {'cls': 'SoftLayer.CLI.command.SLCommand', 'short_help': '"""Get options to use for creating Vlan servers."""'}), "(cls=SoftLayer.CLI.command.SLCommand, short_help=\n 'Get options to use for creating Vlan servers.')\n", (233, 335), False, 'import click\n'), ((427,... |
# Copyright (c) 2019 PaddlePaddle 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 app... | [
"numpy.squeeze",
"os.path.join",
"paddle.fluid.io.load_vars",
"paddle.fluid.io.is_persistable",
"paddle.fluid.Tensor",
"os.path.exists",
"yaml.load",
"numpy.concatenate",
"numpy.array",
"io.open"
] | [((3165, 3179), 'paddle.fluid.Tensor', 'fluid.Tensor', ([], {}), '()\n', (3177, 3179), True, 'import paddle.fluid as fluid\n'), ((3378, 3393), 'numpy.array', 'np.array', (['words'], {}), '(words)\n', (3386, 3393), True, 'import numpy as np\n'), ((3411, 3431), 'numpy.array', 'np.array', (['crf_decode'], {}), '(crf_decod... |
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
from rest_framework import serializers
from django.conf import settings
from cvat.apps.authentication.serializers import RegisterSerializerEx
class UserAgreementSerializer(serializers.Serializer):
name = serializers.CharField(max_length=256... | [
"rest_framework.serializers.CharField",
"rest_framework.serializers.BooleanField"
] | [((284, 321), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(256)'}), '(max_length=256)\n', (305, 321), False, 'from rest_framework import serializers\n'), ((341, 391), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(2048)', 'default': '""""... |
# ===============================================================================
# Copyright 2013 <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/... | [
"pychron.canvas.canvas2D.scene.primitives.primitives.LoadIndicator"
] | [((1642, 1737), 'pychron.canvas.canvas2D.scene.primitives.primitives.LoadIndicator', 'LoadIndicator', ([], {'x': 'x', 'y': 'y', 'radius': 'r', 'name_visible': 'show_hole_numbers', 'name': 'n', 'font': '"""modern 10"""'}), "(x=x, y=y, radius=r, name_visible=show_hole_numbers, name=n,\n font='modern 10')\n", (1655, 17... |
""":mod:`getpost` --- Getpost project module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from os.path import join, dirname, abspath
from flask import Flask, render_template, send_from_directory
from flask.ext.login import LoginManager, AnonymousUserMixin
from flask.ext.mail import... | [
"os.path.join",
"flask.ext.bootstrap.Bootstrap",
"os.path.dirname",
"flask.render_template",
"flask.ext.login.LoginManager",
"flask.ext.mail.Mail",
"flask.Flask"
] | [((412, 418), 'flask.ext.mail.Mail', 'Mail', ([], {}), '()\n', (416, 418), False, 'from flask.ext.mail import Mail\n'), ((431, 442), 'flask.ext.bootstrap.Bootstrap', 'Bootstrap', ([], {}), '()\n', (440, 442), False, 'from flask.ext.bootstrap import Bootstrap\n'), ((459, 473), 'flask.ext.login.LoginManager', 'LoginManag... |
from unittest import TestCase
from unittest.mock import MagicMock, Mock, patch
from pysnmp.smi.error import SmiError
@patch("pymongo.MongoClient")
@patch("mongolock.MongoLock.__init__")
@patch("mongolock.MongoLock.lock")
@patch("mongolock.MongoLock.release")
class TestTasks(TestCase):
@patch("splunk_connect_for_... | [
"splunk_connect_for_snmp.snmp.tasks.walk",
"unittest.mock.MagicMock",
"unittest.mock.patch"
] | [((121, 149), 'unittest.mock.patch', 'patch', (['"""pymongo.MongoClient"""'], {}), "('pymongo.MongoClient')\n", (126, 149), False, 'from unittest.mock import MagicMock, Mock, patch\n'), ((151, 188), 'unittest.mock.patch', 'patch', (['"""mongolock.MongoLock.__init__"""'], {}), "('mongolock.MongoLock.__init__')\n", (156,... |
from os.path import dirname, join
from sila2.framework import Feature
SystemStatusProviderFeature = Feature(open(join(dirname(__file__), "SystemStatusProvider.sila.xml")).read())
| [
"os.path.dirname"
] | [((120, 137), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (127, 137), False, 'from os.path import dirname, join\n')] |
from raiden.utils import CanonicalIdentifier
from raiden.utils.signing import pack_data
from raiden.utils.typing import AdditionalHash, BalanceHash, Nonce, Signature, TokenAmount
from raiden_contracts.constants import MessageTypeId
def pack_balance_proof(
nonce: Nonce,
balance_hash: BalanceHash,
... | [
"raiden.utils.signing.pack_data"
] | [((669, 944), 'raiden.utils.signing.pack_data', 'pack_data', (["['address', 'uint256', 'uint256', 'uint256', 'bytes32', 'uint256', 'bytes32']", '[canonical_identifier.token_network_address, canonical_identifier.\n chain_identifier, msg_type, canonical_identifier.channel_identifier,\n balance_hash, nonce, addition... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.bitfinex import bitfinex
import hashlib
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.error... | [
"ccxt.base.precise.Precise.string_mul",
"ccxt.base.precise.Precise.string_abs",
"ccxt.base.errors.InvalidOrder",
"ccxt.base.precise.Precise.string_neg",
"ccxt.base.errors.NotSupported",
"ccxt.base.errors.ExchangeError",
"ccxt.base.errors.OrderNotFound",
"math.pow",
"ccxt.base.precise.Precise.string_... | [((19154, 19222), 'ccxt.base.errors.NotSupported', 'NotSupported', (["(self.id + ' ' + code + ' not supported for withdrawal')"], {}), "(self.id + ' ' + code + ' not supported for withdrawal')\n", (19166, 19222), False, 'from ccxt.base.errors import NotSupported\n'), ((33861, 33921), 'ccxt.base.errors.NotSupported', 'N... |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
This file registers pre-defined datasets at hard-coded paths, and their metadata.
We hard-code metadata for common datasets. This will enable:
1. Consistency check when loading the datasets
2. Use models on these stand... | [
"os.path.join",
"os.getenv"
] | [((2783, 2820), 'os.getenv', 'os.getenv', (['"""wsl_DATASETS"""', '"""datasets"""'], {}), "('wsl_DATASETS', 'datasets')\n", (2792, 2820), False, 'import os\n'), ((1781, 1811), 'os.path.join', 'os.path.join', (['root', 'image_root'], {}), '(root, image_root)\n', (1793, 1811), False, 'import os\n'), ((2688, 2718), 'os.pa... |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"pytest.fixture",
"subprocess.run",
"google.cloud.logging_v2.LoggingServiceV2Client",
"google.cloud.pubsub_v1.PublisherClient",
"google.cloud.pubsub_v1.types.PushConfig.OidcToken",
"datetime.datetime.now",
"google.cloud.pubsub_v1.SubscriberClient",
"uuid.uuid4",
"datetime.timedelta",
"time.sleep"
... | [((3035, 3051), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (3049, 3051), False, 'import pytest\n'), ((3424, 3452), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (3438, 3452), False, 'import pytest\n'), ((1137, 1253), 'subprocess.run', 'subprocess.run', (["['gcloud', 'bu... |
from __future__ import unicode_literals
import sys
if sys.version_info < (3, 6):
sys.exit('Sorry, Python < 3.6 is not supported.')
from setuptools import setup, find_packages
with open('./requirements.txt') as f:
INSTALL_REQUIRES = f.read().splitlines()
def _get_version():
from os.path import abspath, ... | [
"os.path.abspath",
"sys.exit",
"setuptools.find_packages"
] | [((86, 135), 'sys.exit', 'sys.exit', (['"""Sorry, Python < 3.6 is not supported."""'], {}), "('Sorry, Python < 3.6 is not supported.')\n", (94, 135), False, 'import sys\n'), ((841, 930), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests', 'tests.*', 'functional_tests', 'functional_tests.*']"}), "(e... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import colorfield.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Theme',
fields=[
('i... | [
"django.db.models.FileField",
"django.db.models.TextField",
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((344, 437), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""ID"""', 'serialize': '(False)', 'auto_created': '(True)', 'primary_key': '(True)'}), "(verbose_name='ID', serialize=False, auto_created=True,\n primary_key=True)\n", (360, 437), False, 'from django.db import models, migrations\... |
# Copyright 2017 the authors.
# This file is part of Hy, which is free software licensed under the Expat
# license. See the LICENSE.
from hy.macros import macroexpand
from hy.compiler import HyTypeError, HyASTCompiler
from hy.lex import tokenize
def test_tag_macro_error():
"""Check if we get correct error with w... | [
"hy.compiler.HyASTCompiler",
"hy.lex.tokenize"
] | [((440, 463), 'hy.compiler.HyASTCompiler', 'HyASTCompiler', (['__name__'], {}), '(__name__)\n', (453, 463), False, 'from hy.compiler import HyTypeError, HyASTCompiler\n'), ((376, 415), 'hy.lex.tokenize', 'tokenize', (['"""(dispatch_tag_macro \'- \'())"""'], {}), '("(dispatch_tag_macro \'- \'())")\n', (384, 415), False,... |
# Copyright (c) 2019 PaddlePaddle 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 applic... | [
"os.path.join",
"numpy.swapaxes",
"sys.stdout.write",
"argparse.ArgumentParser",
"tarfile.open",
"sys.stderr.write",
"os.path.getsize",
"os.path.exists",
"StringIO.StringIO",
"sys.stdout.flush",
"os.remove",
"paddle.dataset.common.download",
"numpy.array",
"os.path.expanduser",
"PIL.Imag... | [((917, 973), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.cache/paddle/dataset/pascalvoc/"""'], {}), "('~/.cache/paddle/dataset/pascalvoc/')\n", (935, 973), False, 'import os\n'), ((1022, 1054), 'os.path.join', 'os.path.join', (['DATA_DIR', 'TAR_FILE'], {}), '(DATA_DIR, TAR_FILE)\n', (1034, 1054), False, 'impo... |
#------------------------------------------#
# Reorganizing Numpy arrays #
# Miscellaneous, load data from file #
# Indexing and boolean masking #
#------------------------------------------#
import numpy as np
before = np.array([[1,2,3],[4,5,6]])
print(before.shape)
after = before.r... | [
"numpy.genfromtxt",
"numpy.zeros",
"numpy.ones",
"numpy.any",
"numpy.array",
"numpy.stack",
"numpy.hstack"
] | [((255, 287), 'numpy.array', 'np.array', (['[[1, 2, 3], [4, 5, 6]]'], {}), '([[1, 2, 3], [4, 5, 6]])\n', (263, 287), True, 'import numpy as np\n'), ((382, 404), 'numpy.array', 'np.array', (['[1, 2, 3, 4]'], {}), '([1, 2, 3, 4])\n', (390, 404), True, 'import numpy as np\n'), ((406, 428), 'numpy.array', 'np.array', (['[5... |
__version__ = '0.1.0'
import os
import random
import requests
from flask import Flask
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import \
OTLPSpanExporter
from opentelemetry.instrumentation.flask import FlaskInstrumentor
from opentelemetry.instrumentation.requests i... | [
"opentelemetry.instrumentation.requests.RequestsInstrumentor",
"random.choice",
"requests.get",
"opentelemetry.sdk.resources.Resource.create",
"opentelemetry.instrumentation.flask.FlaskInstrumentor",
"opentelemetry.trace.get_tracer_provider",
"os.environ.get",
"flask.Flask"
] | [((2022, 2037), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (2027, 2037), False, 'from flask import Flask\n'), ((1238, 1294), 'os.environ.get', 'os.environ.get', (['"""YEAR_ENDPOINT"""', '"""http://localhost:6001"""'], {}), "('YEAR_ENDPOINT', 'http://localhost:6001')\n", (1252, 1294), False, 'import os\... |
from __future__ import division
import itertools
import numpy as np
import sys
from collections import namedtuple
from numba import unittest_support as unittest
from numba import njit, typeof, types, typing, typeof, ir, utils, bytecode
from .support import TestCase, tag
from numba.array_analysis import EquivSet, Arr... | [
"numba.compiler.Flags",
"numpy.ones_like",
"numpy.random.beta",
"numpy.random.exponential",
"numpy.vstack",
"numpy.random.lognormal",
"numba.unittest_support.skipIf",
"numpy.sum",
"numpy.zeros",
"numpy.random.poisson",
"numba.utils.StringIO",
"numpy.ones",
"numpy.concatenate",
"numpy.rando... | [((793, 842), 'numba.unittest_support.skipIf', 'unittest.skipIf', (['(_32bit or _windows_py27)', '_reason'], {}), '(_32bit or _windows_py27, _reason)\n', (808, 842), True, 'from numba import unittest_support as unittest\n'), ((622, 654), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win32"""'], {}), "('wi... |
# -*- coding: utf-8 -*-
import os
from project.settings import *
#- Infrastructure specific settings come from ENV vars set in Heroku Admin Panel
SECRET_KEY = os.environ['DJANGO_SECRET_KEY']
DEBUG = os.environ.get('DJANGO_DEBUG', False)
TEMPLATE_DEBUG = False
MIDDLEWARE_CLASSES = (
'whitenoise.middleware.WhiteN... | [
"os.environ.get"
] | [((204, 241), 'os.environ.get', 'os.environ.get', (['"""DJANGO_DEBUG"""', '(False)'], {}), "('DJANGO_DEBUG', False)\n", (218, 241), False, 'import os\n'), ((526, 565), 'os.environ.get', 'os.environ.get', (['"""DJANGO_SENTRY_DSN"""', '""""""'], {}), "('DJANGO_SENTRY_DSN', '')\n", (540, 565), False, 'import os\n'), ((580... |
# Generated by Django 3.0.8 on 2020-11-13 22:11
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField... | [
"django.db.models.IntegerField",
"django.db.models.ManyToManyField",
"django.db.models.TextField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((304, 397), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (320, 397), False, 'from django.db import migrations, models\... |
import base64
from django.test import TestCase, Client
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from hyperion.models.user import UserProfile, Friend, FriendRequest
# python manage.py test -v=2 hyperion.tests.tests_user
class UserTestCase(TestCase):
username ... | [
"hyperion.models.user.Friend.objects.get",
"hyperion.models.user.UserProfile.objects.all",
"hyperion.models.user.Friend.objects.create",
"hyperion.models.user.UserProfile.objects.get",
"django.contrib.auth.models.User.objects.get",
"hyperion.models.user.FriendRequest.objects.get",
"django.contrib.auth.m... | [((677, 787), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', ([], {'username': '"""testUser"""', 'first_name': '"""test"""', 'last_name': '"""user"""', 'password': '"""<PASSWORD>"""'}), "(username='testUser', first_name='test', last_name=\n 'user', password='<PASSWORD>')\n", (701,... |
import chainer
import chainer.links as L
import chainer.functions as F
import argparse
import cv2
import numpy as np
from glob import glob
num_classes = 2
img_height, img_width = 224, 224
channel = 3
GPU = -1
class InceptionModule(chainer.Chain):
def __init__(self, f_1, f_2_1, f_2_2, f_3_1, f_3_2, f_4_2):
... | [
"argparse.ArgumentParser",
"chainer.optimizers.MomentumSGD",
"chainer.functions.max_pooling_2d",
"chainer.optimizer.WeightDecay",
"chainer.cuda.to_gpu",
"numpy.zeros",
"chainer.functions.concat",
"chainer.serializers.save_npz",
"chainer.functions.accuracy",
"glob.glob",
"chainer.cuda.get_device_... | [((4299, 4316), 'glob.glob', 'glob', (["(path + '/*')"], {}), "(path + '/*')\n", (4303, 4316), False, 'from glob import glob\n'), ((6489, 6519), 'numpy.array', 'np.array', (['xs'], {'dtype': 'np.float32'}), '(xs, dtype=np.float32)\n', (6497, 6519), True, 'import numpy as np\n'), ((6529, 6555), 'numpy.array', 'np.array'... |
"""
Prepare Data: populating input images from raw profile data
Takes raw data from "data/raw/*" files for both, profile shape (shape.dat) as well as midcurve shape (shape.mid)
Generates raster image files from svg (simple vector graphics)
Multiple variations are populated using image transformations.
... | [
"drawSvg.Drawing",
"drawSvg.Lines",
"matplotlib.pyplot.grid",
"os.path.exists",
"matplotlib.pyplot.figure",
"numpy.zeros",
"numpy.arange",
"os.makedirs",
"tensorflow.keras.preprocessing.image.load_img",
"matplotlib.pyplot.scatter",
"random.shuffle",
"matplotlib.pyplot.show",
"matplotlib.pypl... | [((633, 675), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'sys.maxsize'}), '(threshold=sys.maxsize)\n', (652, 675), True, 'import numpy as np\n'), ((953, 969), 'numpy.max', 'np.max', (['[ha, hb]'], {}), '([ha, hb])\n', (959, 969), True, 'import numpy as np\n'), ((1010, 1051), 'numpy.zeros', 'np.... |
import torch.nn as nn
import math
import torch
import numpy as np
import torch.nn.functional as F
# vgg16
def vgg(cfg, i, batch_norm=False):
layers = []
in_channels = i
stage = 1
for v in cfg:
if v == 'M':
stage += 1
if stage == 6:
layers += [nn.MaxPool2d... | [
"torch.nn.ModuleList",
"torch.nn.ReLU",
"torch.nn.BatchNorm2d",
"torch.nn.MaxPool2d",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.Conv2d",
"torch.cat"
] | [((2295, 2314), 'torch.nn.ModuleList', 'nn.ModuleList', (['ppms'], {}), '(ppms)\n', (2308, 2314), True, 'import torch.nn as nn\n'), ((2617, 2637), 'torch.nn.ModuleList', 'nn.ModuleList', (['infos'], {}), '(infos)\n', (2630, 2637), True, 'import torch.nn as nn\n'), ((2353, 2419), 'torch.nn.Conv2d', 'nn.Conv2d', (['(self... |
# 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... | [
"os.path.join",
"tensor2tensor.data_generators.text_encoder.SubwordTextEncoder",
"tensor2tensor.data_generators.generator_utils.get_or_generate_vocab",
"tensor2tensor.data_generators.text_problems.text2text_txt_iterator",
"tensor2tensor.data_generators.translate.compile_data"
] | [((2713, 2873), 'tensor2tensor.data_generators.generator_utils.get_or_generate_vocab', 'generator_utils.get_or_generate_vocab', (['data_dir', 'tmp_dir', 'self.source_vocab_name', 'self.approx_vocab_size', 'source_datasets'], {'file_byte_budget': '(100000000.0)'}), '(data_dir, tmp_dir, self.\n source_vocab_name, self... |
import dash
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output, State
import dash_bootstrap_components as dbc
import numpy as np
from jsonschema import validate
import json
import yaml
import base64
from json_schema_to_dash_forms.forms import SchemaFormCon... | [
"jsonschema.validate",
"dash_html_components.Div",
"dash.dependencies.Input",
"pathlib.Path",
"dash_bootstrap_components.Col",
"dash_bootstrap_components.Button",
"flask.send_from_directory",
"dash_bootstrap_components.Label",
"dash_html_components.Br",
"dash.dependencies.State",
"json.loads",
... | [((7786, 7818), 'base64.b64decode', 'base64.b64decode', (['content_string'], {}), '(content_string)\n', (7802, 7818), False, 'import base64\n'), ((7845, 7864), 'json.loads', 'json.loads', (['decoded'], {}), '(decoded)\n', (7855, 7864), False, 'import json\n'), ((10084, 10152), 'dash.dependencies.Output', 'Output', (['"... |
"""
These are the most commonly used components of PyPAC.
"""
import os
from contextlib import contextmanager
import requests
from requests.exceptions import ProxyError, ConnectTimeout
from pypac.parser import PACFile
from pypac.resolver import ProxyResolver, ProxyConfigExhaustedError
from pypac.os_setting... | [
"pypac.parser.PACFile",
"pypac.resolver.ProxyResolver",
"requests.Session",
"pypac.os_settings.file_url_to_local_path",
"pypac.os_settings.autoconfig_url_from_preferences",
"os.path.isfile",
"warnings.warn",
"pypac.wpad.proxy_urls_from_dns",
"pypac.os_settings.autoconfig_url_from_registry",
"os.en... | [((3273, 3306), 'pypac.parser.PACFile', 'PACFile', (['downloaded_pac'], {}), '(downloaded_pac, **kwargs)\n', (3280, 3306), False, 'from pypac.parser import PACFile\n'), ((2185, 2218), 'pypac.parser.PACFile', 'PACFile', (['downloaded_pac'], {}), '(downloaded_pac, **kwargs)\n', (2192, 2218), False, 'from pypac.parser imp... |
from enum import Enum
from pathlib import Path
import sys
import typer
from karez.role import RoleBase
from .common import search_plugins
class PluginType(str, Enum):
dispatcher = "dispatcher"
connector = "connector"
converter = "converter"
def search_role_for_help(role: str, role_name, plugin_path) -... | [
"typer.echo",
"sys.exit",
"typer.Option",
"typer.secho"
] | [((526, 577), 'typer.Option', 'typer.Option', (['"""plugins"""', '"""--plugin-directory"""', '"""-p"""'], {}), "('plugins', '--plugin-directory', '-p')\n", (538, 577), False, 'import typer\n'), ((972, 1023), 'typer.secho', 'typer.secho', (['f"""Configuration Options:\n"""'], {'bold': '(True)'}), "(f'Configuration Optio... |
import pytest
import annotator
import synapseclient
import pandas
import os
import uuid
import tempfile
from . import conftest
class TestSynread(object):
def test_synread_csv(self, syn, sampleFile, entities):
df = annotator.utils.synread(syn, entities['files'][0].id,
s... | [
"annotator.utils._keyValCols",
"pytest.fixture",
"annotator.utils.synread",
"annotator.utils.addToScope",
"annotator.utils.colFromRegex",
"tempfile.mkstemp",
"pandas.testing.assert_frame_equal",
"pytest.raises",
"annotator.utils._colsFromList",
"annotator.utils.clipboardToDict",
"annotator.utils... | [((4180, 4209), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (4194, 4209), False, 'import pytest\n'), ((7233, 7262), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (7247, 7262), False, 'import pytest\n'), ((8160, 8189), 'pytest.fixtur... |
from cowrie.core.plugins import BasePlugin
from cowrie.plugins.ssh.utils import get_command_name_from_path
class NetworkDetectionCommandDetectorPlugin(BasePlugin):
command_list = [
{
"command": "nmap"
},
{
"command": "ip"
},
{
"command": ... | [
"cowrie.plugins.ssh.utils.get_command_name_from_path"
] | [((745, 779), 'cowrie.plugins.ssh.utils.get_command_name_from_path', 'get_command_name_from_path', (['_input'], {}), '(_input)\n', (771, 779), False, 'from cowrie.plugins.ssh.utils import get_command_name_from_path\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.