code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from telegram import CallbackQuery
from telegram.error import BadRequest
import utils.utils as utl
import commands.keyboards as kb
def foo_command(query: CallbackQuery):
try:
query.edit_message_text(
utl.prep_for_md("This is *foo*", ignore=['*']),
reply_markup=kb.main_menu,
... | [
"utils.utils.prep_for_md"
] | [((227, 273), 'utils.utils.prep_for_md', 'utl.prep_for_md', (['"""This is *foo*"""'], {'ignore': "['*']"}), "('This is *foo*', ignore=['*'])\n", (242, 273), True, 'import utils.utils as utl\n')] |
import sys
sys.path.append("..")
import os
here = os.path.dirname(os.path.realpath(__file__))
import pickle
import tempfile
import numpy as np
import pyrfr.regression
data_set_prefix = '%(here)s/../test_data_sets/diabetes_' % {"here":here}
features = np.loadtxt(data_set_prefix+'features.csv', delimiter=",")
resp... | [
"sys.path.append",
"tempfile.NamedTemporaryFile",
"os.remove",
"pickle.dump",
"os.path.realpath",
"numpy.allclose",
"pickle.load",
"numpy.loadtxt"
] | [((11, 32), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (26, 32), False, 'import sys\n'), ((258, 317), 'numpy.loadtxt', 'np.loadtxt', (["(data_set_prefix + 'features.csv')"], {'delimiter': '""","""'}), "(data_set_prefix + 'features.csv', delimiter=',')\n", (268, 317), True, 'import numpy as np... |
import yappsrt
import spitfire.compiler.parser
# SpitfireScanner uses the order of the match, not the length of the match to
# determine what token to return. I'm not sure how fragille this is long-term,
# but it seems to have been the right solution for a number of small problems
# allong the way.
_restrict_cache = ... | [
"yappsrt.SyntaxError"
] | [((2096, 2130), 'yappsrt.SyntaxError', 'yappsrt.SyntaxError', (['self.pos', 'msg'], {}), '(self.pos, msg)\n', (2115, 2130), False, 'import yappsrt\n')] |
# Specialization: Google IT Automation with Python
# Course 02: Using Python to Interact with the Operating System
# Week 2 Module Part 3 - Practice Quiz
# Student: <NAME>
# Learning Platform: Coursera.org
# Scripting examples encountered during the Module Part 3 Practice Quiz:
# 01. We're working with a list... | [
"csv.DictReader",
"csv.reader"
] | [((2299, 2323), 'csv.DictReader', 'csv.DictReader', (['csv_file'], {}), '(csv_file)\n', (2313, 2323), False, 'import csv\n'), ((4483, 4503), 'csv.reader', 'csv.reader', (['csv_file'], {}), '(csv_file)\n', (4493, 4503), False, 'import csv\n')] |
from django.db import models
class Genre(models.Model):
name = models.CharField(max_length=16, null=True)
def __str__(self):
return self.name
class Director(models.Model):
name = models.CharField(max_length=64, null=True)
def __str__(self):
return self.name
class Country(models.M... | [
"django.db.models.URLField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.DecimalField",
"django.db.models.DateField"
] | [((69, 111), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(16)', 'null': '(True)'}), '(max_length=16, null=True)\n', (85, 111), False, 'from django.db import models\n'), ((204, 246), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(64)', 'null': '(True)'}), '(max_length=... |
"""Real-time forecasting `*Model`s to predict demand for tactical purposes.
Real-time `*Model`s take order counts of all time steps in the training data
and make a prediction for only one time step on the day to be predicted (i.e.,
the one starting at `predict_at`). Thus, the training time series have a
`frequency` of... | [
"pandas.DataFrame",
"urban_meal_delivery.forecasts.methods.decomposition.stl",
"pandas.DatetimeIndex"
] | [((2118, 2197), 'urban_meal_delivery.forecasts.methods.decomposition.stl', 'methods.decomposition.stl', ([], {'time_series': 'training_ts', 'frequency': 'frequency', 'ns': '(999)'}), '(time_series=training_ts, frequency=frequency, ns=999)\n', (2143, 2197), False, 'from urban_meal_delivery.forecasts import methods\n'), ... |
#!/usr/bin/env python
import django
from django.core import management
from prometheus_client import start_http_server, Gauge
from croniter import croniter
from datetime import datetime
import time
import sys
import signal
import os
import re
import gc
#
# Run django management command on a continuous loop
# delayin... | [
"prometheus_client.start_http_server",
"os.environ.setdefault",
"django.setup",
"re.match",
"time.time",
"time.sleep",
"gc.collect",
"django.core.management.call_command",
"datetime.datetime.utcfromtimestamp",
"signal.signal",
"prometheus_client.Gauge",
"os.getenv",
"sys.exit",
"croniter.c... | [((1803, 1902), 'prometheus_client.Gauge', 'Gauge', (['"""management_daemon_command_start"""', '"""Management Command start time"""', "['job', 'instance']"], {}), "('management_daemon_command_start', 'Management Command start time', [\n 'job', 'instance'])\n", (1808, 1902), False, 'from prometheus_client import star... |
#!/usr/bin/python3
def validate_user(name, minlen):
assert type(name) == str, "username must be a string"
if minlen < 1:
raise ValueError("minlen must be at least 1")
if len(name) < minlen:
return False
if not name .isalnum():
return False
return True
#LAB
#1
my_list = [27,... | [
"random.randint"
] | [((1167, 1187), 'random.randint', 'random.randint', (['(1)', '(9)'], {}), '(1, 9)\n', (1181, 1187), False, 'import random\n')] |
import random
from .adjectives import ADJECTIVES
from .nouns import NOUNS, ANIMALS, FLOWERS
from .verbs import VERBS
from .adverbs import ADVERBS
DICTIONARY = {
'adjective': ADJECTIVES,
'noun': NOUNS,
'verb': VERBS,
'adverb': ADVERBS,
'number': list(map(str, range(10,99)))
}
class HRID:
def ... | [
"random.choice"
] | [((815, 837), 'random.choice', 'random.choice', (['element'], {}), '(element)\n', (828, 837), False, 'import random\n')] |
import numpy as np
import os
import torch
import copy
from math import cos, sqrt, pi
def dct(x, y, v, u, n):
# Normalisation
def alpha(a):
if a == 0:
return sqrt(1.0 / n)
else:
return sqrt(2.0 / n)
return alpha(u) * alpha(v) * cos(((2 * x + 1) * (u * pi)) / (2 * n)... | [
"numpy.absolute",
"numpy.load",
"numpy.maximum",
"numpy.full_like",
"numpy.zeros_like",
"numpy.multiply",
"os.path.dirname",
"os.path.exists",
"numpy.swapaxes",
"math.cos",
"numpy.reshape",
"numpy.add",
"numpy.save",
"numpy.minimum",
"math.sqrt",
"numpy.asarray",
"torch.clamp",
"to... | [((606, 626), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (620, 626), False, 'import os\n'), ((1305, 1329), 'numpy.save', 'np.save', (['path', 'dct_basis'], {}), '(path, dct_basis)\n', (1312, 1329), True, 'import numpy as np\n'), ((1685, 1702), 'numpy.zeros_like', 'np.zeros_like', (['im'], {}), '(im... |
import math
from typing import Any, Dict, Tuple
import attr
from attr import attrib, attrs
import numpy as np
from nlisim.cell import CellData, CellFields, CellList
from nlisim.coordinates import Point, Voxel
from nlisim.grid import RectangularGrid
from nlisim.modules.phagocyte import (
PhagocyteCellData,
Pha... | [
"math.expm1",
"attr.attrs",
"attr.Factory",
"numpy.dtype",
"numpy.where",
"numpy.fromiter",
"nlisim.modules.phagocyte.PhagocyteCellData.create_cell_tuple",
"nlisim.random.rg.shuffle",
"nlisim.random.rg.uniform"
] | [((1350, 1394), 'attr.attrs', 'attrs', ([], {'kw_only': '(True)', 'frozen': '(True)', 'repr': '(False)'}), '(kw_only=True, frozen=True, repr=False)\n', (1355, 1394), False, 'from attr import attrib, attrs\n'), ((1604, 1623), 'attr.attrs', 'attrs', ([], {'kw_only': '(True)'}), '(kw_only=True)\n', (1609, 1623), False, 'f... |
from numpy import array, arange, zeros, unique, searchsorted, full, nan
from numpy.linalg import norm # type: ignore
from pyNastran.utils.numpy_utils import integer_types
from pyNastran.bdf.field_writer_8 import print_card_8, set_blank_if_default
from pyNastran.bdf.field_writer_16 import print_card_16
from pyNastran.... | [
"numpy.full",
"pyNastran.bdf.field_writer_8.set_blank_if_default",
"pyNastran.bdf.bdf_interface.assign_type.string_or_blank",
"pyNastran.bdf.bdf_interface.assign_type.integer",
"pyNastran.bdf.field_writer_8.print_card_8",
"numpy.unique",
"numpy.zeros",
"numpy.searchsorted",
"pyNastran.bdf.bdf_interf... | [((1911, 1940), 'pyNastran.dev.bdf_vectorized.cards.elements.element.Element.__init__', 'Element.__init__', (['self', 'model'], {}), '(self, model)\n', (1927, 1940), False, 'from pyNastran.dev.bdf_vectorized.cards.elements.element import Element\n'), ((3391, 3421), 'pyNastran.bdf.bdf_interface.assign_type.integer', 'in... |
from zen.isIterable import isIterable
def sortBy(*args,**keywords):
sorted=[]
sel=[]
if len(args)==1:
if isIterable(args[0]) and len(args[0])>1:
sorted=list(args[0][-1])
sel=list(args[0][0])
inputType=type(args[0][0]).__name__
else:
return
elif len(args)>1:
sorted=list(args[-1])
sel=list(ar... | [
"zen.isIterable.isIterable"
] | [((115, 134), 'zen.isIterable.isIterable', 'isIterable', (['args[0]'], {}), '(args[0])\n', (125, 134), False, 'from zen.isIterable import isIterable\n')] |
from django.contrib.auth import get_user_model
from django.db import models
User = get_user_model()
ACCOUNT_TYPES = (
(1, 'Admin'),
(2, 'Teacher'),
(3, 'Student')
)
class Account(models.Model):
class Meta:
verbose_name = 'Account'
verbose_name_plural = 'Accounts'
user = models.O... | [
"django.db.models.OneToOneField",
"django.db.models.CharField",
"django.contrib.auth.get_user_model",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.DateField"
] | [((84, 100), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (98, 100), False, 'from django.contrib.auth import get_user_model\n'), ((312, 367), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'to': 'User', 'on_delete': 'models.CASCADE'}), '(to=User, on_delete=models.CASCADE)\n... |
#!/usr/bin/env python3
#coding: utf-8
### 1st line allows to execute this script by typing only its name in terminal, with no need to precede it with the python command
### 2nd line declaring source code charset should be not necessary but for exemple pydoc request it
__doc__ = "This is the program centerpiece,but n... | [
"commonz.convert.text.decode_url",
"commonz.convert.text.to_ascii"
] | [((4380, 4401), 'commonz.convert.text.decode_url', 'text.decode_url', (['name'], {}), '(name)\n', (4395, 4401), False, 'from commonz.convert import text\n'), ((4516, 4535), 'commonz.convert.text.to_ascii', 'text.to_ascii', (['name'], {}), '(name)\n', (4529, 4535), False, 'from commonz.convert import text\n')] |
import re
import math
class Exemple:
def __init__(self):
self.inputs = []
self.outputs = []
class Dataset:
def __init__(self, filename):
try:
file = open(filename, "r")
except:
raise ValueError("Cannot open dataset")
else:
line = file... | [
"math.pow"
] | [((1546, 1596), 'math.pow', 'math.pow', (['(self.exemples[i].inputs[index] - mean)', '(2)'], {}), '(self.exemples[i].inputs[index] - mean, 2)\n', (1554, 1596), False, 'import math\n')] |
"""
Environments and wrappers for Sonic training.
"""
import gym
import numpy as np
import gzip
import retro
import os
from baselines.common.atari_wrappers import WarpFrame, FrameStack
# from retro_contest.local import make
import logging
import retro_contest
import pandas as pd
train_states = pd.read_csv('../data/so... | [
"pandas.read_csv",
"baselines.common.atari_wrappers.WarpFrame",
"retro.make",
"retro.get_game_path",
"numpy.array",
"retro_contest.StochasticFrameSkip",
"gym.wrappers.TimeLimit",
"os.path.join",
"logging.getLogger"
] | [((297, 345), 'pandas.read_csv', 'pd.read_csv', (['"""../data/sonic_env/sonic-train.csv"""'], {}), "('../data/sonic_env/sonic-train.csv')\n", (308, 345), True, 'import pandas as pd\n'), ((366, 419), 'pandas.read_csv', 'pd.read_csv', (['"""../data/sonic_env/sonic-validation.csv"""'], {}), "('../data/sonic_env/sonic-vali... |
# This file mainly exists to allow python setup.py test to work.
import os, sys
from django.test.utils import get_runner
from django.conf import settings
os.environ["DJANGO_SETTINGS_MODULE"] = "test_project.settings"
test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.insert(0, test_dir)... | [
"django.setup",
"os.path.realpath",
"sys.path.insert",
"django.test.utils.get_runner",
"sys.exit"
] | [((292, 320), 'sys.path.insert', 'sys.path.insert', (['(0)', 'test_dir'], {}), '(0, test_dir)\n', (307, 320), False, 'import os, sys\n'), ((454, 474), 'django.test.utils.get_runner', 'get_runner', (['settings'], {}), '(settings)\n', (464, 474), False, 'from django.test.utils import get_runner\n'), ((522, 540), 'sys.exi... |
from mstrio.utils.helper import response_handler
def get_object_info(connection, id, type, error_msg=None):
"""Get information for a specific object in a specific project; if you do
not specify a project ID, you get information for the object in all
projects.
You identify the object with the object I... | [
"mstrio.utils.helper.response_handler"
] | [((1403, 1469), 'mstrio.utils.helper.response_handler', 'response_handler', (['response', 'error_msg'], {'whitelist': "[('ERR001', 500)]"}), "(response, error_msg, whitelist=[('ERR001', 500)])\n", (1419, 1469), False, 'from mstrio.utils.helper import response_handler\n'), ((2829, 2866), 'mstrio.utils.helper.response_ha... |
# tf2.0目标检测之csv 2 Tfrecord
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import tensorflow as tf
import numpy as np
import random
import cv2
from tqdm import tqdm
import datetime
import os
import time
from detection.models.detectors import faster_rcnn
from... | [
"numpy.sum",
"numpy.maximum",
"numpy.argmax",
"tensorflow.keras.optimizers.SGD",
"bjod_data.ZiptrainDataset",
"numpy.argsort",
"bjod_data.Zipvaluedata",
"numpy.arange",
"cv2.rectangle",
"os.path.join",
"random.randint",
"cv2.cvtColor",
"numpy.cumsum",
"tensorflow.cast",
"numpy.max",
"r... | [((413, 429), 'random.seed', 'random.seed', (['(234)'], {}), '(234)\n', (424, 429), False, 'import random\n'), ((624, 669), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_RGB2BGR', 'image'], {}), '(image, cv2.COLOR_RGB2BGR, image)\n', (636, 669), False, 'import cv2\n'), ((594, 619), 'numpy.squeeze', 'np.squeeze'... |
import os
import argparse
import json
import sys
import re
import requests
from json import JSONEncoder
from bs4 import BeautifulSoup
class Song:
def __init__(self, title: str, artist: str, album: str, release: str, lyrics: str, url: str):
self.title = title
self.artist = artist
self.album... | [
"json.dump",
"os.mkdir",
"argparse.ArgumentParser",
"json.loads",
"os.path.isdir",
"requests.get",
"re.sub",
"sys.exit"
] | [((1200, 1222), 're.sub', 're.sub', (['""" """', '"""+"""', 'term'], {}), "(' ', '+', term)\n", (1206, 1222), False, 'import re\n'), ((1241, 1308), 'requests.get', 'requests.get', (['f"""https://genius.com/api/search/song?page=1&q={term}"""'], {}), "(f'https://genius.com/api/search/song?page=1&q={term}')\n", (1253, 130... |
################################################################################
#
# Copyright (c) 2019, the Perspective Authors.
#
# This file is part of the Perspective library, distributed under the terms of
# the Apache License 2.0. The full license can be found in the LICENSE file.
#
from pytest import raises
fr... | [
"pytest.raises",
"perspective.PerspectiveViewer",
"perspective.PerspectiveWidget"
] | [((566, 609), 'perspective.PerspectiveWidget', 'PerspectiveWidget', (['data'], {'plugin': 'Plugin.GRID'}), '(data, plugin=Plugin.GRID)\n', (583, 609), False, 'from perspective import PerspectiveError, PerspectiveViewer, PerspectiveWidget, Plugin\n'), ((764, 807), 'perspective.PerspectiveWidget', 'PerspectiveWidget', ([... |
import numpy as np
from liegroups.numpy import _base
from liegroups.numpy.so2 import SO2
class SE2(_base.SpecialEuclideanBase):
"""Homogeneous transformation matrix in :math:`SE(2)` using active (alibi) transformations.
.. math::
SE(2) &= \\left\\{ \\mathbf{T}=
\\begin{bmatrix}
... | [
"numpy.empty",
"numpy.zeros",
"numpy.expand_dims",
"numpy.hstack",
"numpy.array",
"numpy.squeeze",
"numpy.eye",
"numpy.atleast_2d"
] | [((3705, 3726), 'numpy.hstack', 'np.hstack', (['[rho, phi]'], {}), '([rho, phi])\n', (3714, 3726), True, 'import numpy as np\n'), ((4973, 4989), 'numpy.atleast_2d', 'np.atleast_2d', (['p'], {}), '(p)\n', (4986, 4989), True, 'import numpy as np\n'), ((5007, 5050), 'numpy.zeros', 'np.zeros', (['[p.shape[0], p.shape[1], c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Blueprint,redirect,url_for, session, jsonify, request
from result_linker.models import db
from result_linker.logger import logger
from result_linker.models.share import Share
home_blueprint = Blueprint("home", __name__)
@home_blueprint.route("/")
def i... | [
"flask.Blueprint",
"flask.request.headers.get",
"result_linker.logger.logger.info",
"flask.jsonify",
"flask.url_for",
"flask.render_template",
"result_linker.models.share.Share.query.filter_by",
"result_linker.logger.logger.debug"
] | [((258, 285), 'flask.Blueprint', 'Blueprint', (['"""home"""', '__name__'], {}), "('home', __name__)\n", (267, 285), False, 'from flask import Blueprint, redirect, url_for, session, jsonify, request\n'), ((713, 734), 'result_linker.logger.logger.debug', 'logger.debug', (['session'], {}), '(session)\n', (725, 734), False... |
#!/usr/bin/python
"""
Tool to analyze some datalogger raw data
"""
from __future__ import print_function
import os
import sys
import argparse
import json
parser = argparse.ArgumentParser(description="Tool to analyze some datalogger raw data")
parser.add_argument("-i", "--input-file", help="file to read from", required... | [
"os.path.isfile",
"argparse.ArgumentParser",
"sys.exit",
"json.dumps"
] | [((164, 243), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Tool to analyze some datalogger raw data"""'}), "(description='Tool to analyze some datalogger raw data')\n", (187, 243), False, 'import argparse\n'), ((417, 451), 'os.path.isfile', 'os.path.isfile', (['options.input_file'], {}... |
# -*- encoding: utf-8 -*-
'''
@Author : lance
@Email : <EMAIL>
'''
import tensorflow as tf
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.Session(config=config)
import keras
from keras.callbacks import ModelCheckpoint, ReduceLROnPlateau, EarlyStopping
from keras.lay... | [
"keras.Model",
"keras.callbacks.CSVLogger",
"os.makedirs",
"model_cx.load_data.load_data",
"keras.callbacks.ModelCheckpoint",
"keras.layers.Dropout",
"tensorflow.Session",
"os.path.exists",
"keras.optimizers.Adam",
"keras.layers.GlobalAveragePooling2D",
"tensorflow.ConfigProto",
"keras.applica... | [((116, 132), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (130, 132), True, 'import tensorflow as tf\n'), ((184, 209), 'tensorflow.Session', 'tf.Session', ([], {'config': 'config'}), '(config=config)\n', (194, 209), True, 'import tensorflow as tf\n'), ((658, 680), 'model_cx.load_data.load_data', 'load... |
# Generated by Django 2.2.3 on 2019-07-22 14:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djedi', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='node',
name='is_published',
... | [
"django.db.models.BooleanField"
] | [((327, 373), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'blank': '(True)', 'default': '(False)'}), '(blank=True, default=False)\n', (346, 373), False, 'from django.db import migrations, models\n')] |
# -*- coding: utf-8 -*-
from copy import deepcopy
import pytest
from schematics.models import Model
from schematics.types import *
from schematics.types.compound import *
from schematics.exceptions import *
from schematics.undefined import Undefined
@pytest.mark.parametrize('init', (True, False))
def test_import_d... | [
"pytest.raises",
"pytest.mark.parametrize",
"copy.deepcopy"
] | [((256, 302), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""init"""', '(True, False)'], {}), "('init', (True, False))\n", (279, 302), False, 'import pytest\n'), ((705, 751), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""init"""', '(True, False)'], {}), "('init', (True, False))\n", (728, 751)... |
import torch.nn as nn
import torch.functional as F
class ShiftedReLU(nn.Module):
def __init__(self, offset=1):
super().__init__()
self.offset = offset
def forward(self, x):
return F.relu(x + self.offset)
class ShiftedSoftplus(nn.Module):
def __init__(self, offset=1):
s... | [
"torch.functional.softplus",
"torch.functional.relu"
] | [((216, 239), 'torch.functional.relu', 'F.relu', (['(x + self.offset)'], {}), '(x + self.offset)\n', (222, 239), True, 'import torch.functional as F\n'), ((409, 436), 'torch.functional.softplus', 'F.softplus', (['(x - self.offset)'], {}), '(x - self.offset)\n', (419, 436), True, 'import torch.functional as F\n')] |
import pickle
import numpy as np
from neupy import algorithms
from neupy.exceptions import NotTrained
from algorithms.memory.data import zero, one, half_one, half_zero
from base import BaseTestCase
from helpers import vectors_for_testing
zero_hint = np.array([[0, 1, 0, 0]])
one_hint = np.array([[1, 0, 0, 0]])
cl... | [
"pickle.loads",
"algorithms.memory.data.half_one.ravel",
"numpy.testing.assert_array_equal",
"numpy.array",
"neupy.algorithms.DiscreteBAM",
"numpy.vstack",
"numpy.testing.assert_array_almost_equal",
"numpy.concatenate",
"pickle.dumps"
] | [((255, 279), 'numpy.array', 'np.array', (['[[0, 1, 0, 0]]'], {}), '([[0, 1, 0, 0]])\n', (263, 279), True, 'import numpy as np\n'), ((291, 315), 'numpy.array', 'np.array', (['[[1, 0, 0, 0]]'], {}), '([[1, 0, 0, 0]])\n', (299, 315), True, 'import numpy as np\n'), ((433, 468), 'numpy.concatenate', 'np.concatenate', (['[z... |
from django import template
from page.models import ExternalAccount
register = template.Library()
...
# ExternalAccount snippets
@register.inclusion_tag('tags/external_account.html', takes_context=True)
def external_accounts(context):
return {
'external_accounts': ExternalAccount.objects.all(),
'... | [
"django.template.Library",
"page.models.ExternalAccount.objects.all"
] | [((80, 98), 'django.template.Library', 'template.Library', ([], {}), '()\n', (96, 98), False, 'from django import template\n'), ((280, 309), 'page.models.ExternalAccount.objects.all', 'ExternalAccount.objects.all', ([], {}), '()\n', (307, 309), False, 'from page.models import ExternalAccount\n')] |
from json import JSONDecodeError
import unittest
from StatusChangedQueueTrigger import extract_properties, get_source_dest_env_vars, is_require_data_copy
class TestPropertiesExtraction(unittest.TestCase):
def test_extract_prop_valid_body_return_all_values(self):
msg = "{ \"data\": { \"request_id\":\"123\... | [
"StatusChangedQueueTrigger.is_require_data_copy",
"StatusChangedQueueTrigger.extract_properties"
] | [((410, 433), 'StatusChangedQueueTrigger.extract_properties', 'extract_properties', (['msg'], {}), '(msg)\n', (428, 433), False, 'from StatusChangedQueueTrigger import extract_properties, get_source_dest_env_vars, is_require_data_copy\n'), ((1618, 1647), 'StatusChangedQueueTrigger.is_require_data_copy', 'is_require_dat... |
#!/usr/bin/env python3
import urllib.request
import pandas as pd
import rcf
if __name__ == "__main__":
data_filename = 'nyc_taxi.csv'
data_source = 'https://raw.githubusercontent.com/numenta/NAB/master/data/realKnownCause/nyc_taxi.csv'
urllib.request.urlretrieve(data_source, data_filename)
taxi_data ... | [
"pandas.read_csv",
"rcf.rcf"
] | [((322, 363), 'pandas.read_csv', 'pd.read_csv', (['data_filename'], {'delimiter': '""","""'}), "(data_filename, delimiter=',')\n", (333, 363), True, 'import pandas as pd\n'), ((443, 462), 'rcf.rcf', 'rcf.rcf', (['taxi_input'], {}), '(taxi_input)\n', (450, 462), False, 'import rcf\n')] |
import importlib
import inspect
import logging
import os
from collections import OrderedDict
from types import FunctionType
from typing import Any, Callable, Dict, List, Optional, Type, Union
from rap.common.channel import UserChannel
from rap.common.exceptions import FuncNotFoundError, RegisteredError
from rap.common... | [
"inspect.ismethod",
"rap.common.exceptions.RegisteredError",
"importlib.import_module",
"os.getcwd",
"inspect.isasyncgenfunction",
"rap.common.exceptions.FuncNotFoundError",
"inspect.getmodule",
"inspect.signature",
"inspect.isgenerator",
"inspect.isfunction",
"collections.OrderedDict",
"loggi... | [((448, 475), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (465, 475), False, 'import logging\n'), ((744, 767), 'inspect.signature', 'inspect.signature', (['func'], {}), '(func)\n', (761, 767), False, 'import inspect\n'), ((1262, 1275), 'collections.OrderedDict', 'OrderedDict', ([], {})... |
"""Implementation of magic functions that control various automatic behaviors.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012 The IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING... | [
"logging.error",
"IPython.core.magic.Bunch"
] | [((1220, 1227), 'IPython.core.magic.Bunch', 'Bunch', ([], {}), '()\n', (1225, 1227), False, 'from IPython.core.magic import Bunch, Magics, magics_class, line_magic\n'), ((3696, 3744), 'logging.error', 'error', (['"""Valid modes: (0->Off, 1->Smart, 2->Full"""'], {}), "('Valid modes: (0->Off, 1->Smart, 2->Full')\n", (370... |
import pandas as pd
import numpy as np
class DataFixer:
def __init__(self):
pass
def get_fix(self, data):
self.data = data
self.data = pd.get_dummies(self.data)
return self.data
| [
"pandas.get_dummies"
] | [((192, 217), 'pandas.get_dummies', 'pd.get_dummies', (['self.data'], {}), '(self.data)\n', (206, 217), True, 'import pandas as pd\n')] |
# Python Standard Library Imports
import base64
import hashlib
import hmac
import json
# HTK Imports
from htk.utils import htk_setting
from htk.utils.general import resolve_method_dynamically
def validate_webhook_request(request):
"""Validates a 321Forms webhook request
Returns a JSON request body if it is ... | [
"json.loads",
"htk.utils.htk_setting",
"htk.utils.general.resolve_method_dynamically"
] | [((381, 405), 'json.loads', 'json.loads', (['request.body'], {}), '(request.body)\n', (391, 405), False, 'import json\n'), ((1162, 1212), 'htk.utils.htk_setting', 'htk_setting', (['"""HTK_321FORMS_WEBHOOK_EVENT_HANDLERS"""'], {}), "('HTK_321FORMS_WEBHOOK_EVENT_HANDLERS')\n", (1173, 1212), False, 'from htk.utils import ... |
import socket
import os
from playsound import playsound
from pydub import AudioSegment
def sendToClient(msg):
msg = msg.decode('utf-8')
lang = msg[:3] # ITA or ENG
msg = msg[3:] # actual message
words = msg.split(" ")
if len(words) > 18:
sentences = []
sentence = ""
for i i... | [
"socket.socket",
"os.system",
"pydub.AudioSegment.from_wav"
] | [((1119, 1160), 'os.system', 'os.system', (["('python synthesize.py ' + lang)"], {}), "('python synthesize.py ' + lang)\n", (1128, 1160), False, 'import os\n'), ((1570, 1619), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (1583, 1619), False,... |
import data.tools.maths as m
import pygame, numpy
class MousePicker:
current_ray = None
RAY_RANGE = 600.0
RECURSION_COUNT = 200
def __init__(self, camera, projection_matrix, display, terrain):
self.camera = camera
self.projection_matrix = projection_matrix
self.dis... | [
"numpy.dot",
"data.tools.maths.Maths",
"numpy.linalg.inv",
"pygame.mouse.get_pos"
] | [((1302, 1336), 'numpy.linalg.inv', 'numpy.linalg.inv', (['self.view_matrix'], {}), '(self.view_matrix)\n', (1318, 1336), False, 'import pygame, numpy\n'), ((1370, 1418), 'numpy.dot', 'numpy.dot', (['inverted_view_matrix', 'eye_coordinates'], {}), '(inverted_view_matrix, eye_coordinates)\n', (1379, 1418), False, 'impor... |
# Author: <NAME> <<EMAIL>>
from math import log
from pathlib import Path
from ._utils import download
MINIMAL_ENTRY = {
'FREQcount': 1,
'CDcount': 1,
'Lg10WF': log(2, 10), # log10(FREQcount + 1)
'Lg10CD': log(2, 10),
}
TOTAL_COUNT = 51e6
def read_subtlex(lower=False):
"""Read the SUBTLEXus dat... | [
"math.log"
] | [((175, 185), 'math.log', 'log', (['(2)', '(10)'], {}), '(2, 10)\n', (178, 185), False, 'from math import log\n'), ((225, 235), 'math.log', 'log', (['(2)', '(10)'], {}), '(2, 10)\n', (228, 235), False, 'from math import log\n')] |
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 1 12:21:00 2020
@author: cbri3325
"""
#%% Import functions
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import pandas as pd
import datetime
import os
import glob
import shutil
import xlsxwriter
import time
from scipy.st... | [
"pandas.DataFrame",
"pandas.ExcelWriter",
"os.scandir",
"pandas.read_excel"
] | [((3920, 3994), 'pandas.ExcelWriter', 'pd.ExcelWriter', (["(data_supradir + 'OverallResults.xlsx')"], {'engine': '"""xlsxwriter"""'}), "(data_supradir + 'OverallResults.xlsx', engine='xlsxwriter')\n", (3934, 3994), True, 'import pandas as pd\n'), ((965, 1073), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['Use... |
import sys, os
import time
import tensorflow as tf
import functools
from absl import app
from plan import *
from snappy_io import unsnappy
NUM_CLASSES = 4672
BOARD_SHAPE = (20, 8, 8)
BOARD_FLOATS = 1280
AUTOTUNE = tf.data.AUTOTUNE
FEATURES = {
'board': tf.io.FixedLenFeature(BOARD_SHAPE, tf.float32),
'label': t... | [
"tensorflow.one_hot",
"tensorflow.io.VarLenFeature",
"tensorflow.sparse.to_dense",
"os.path.isfile",
"absl.app.run",
"tensorflow.io.parse_example",
"tensorflow.io.FixedLenFeature",
"tensorflow.math.reduce_sum"
] | [((260, 306), 'tensorflow.io.FixedLenFeature', 'tf.io.FixedLenFeature', (['BOARD_SHAPE', 'tf.float32'], {}), '(BOARD_SHAPE, tf.float32)\n', (281, 306), True, 'import tensorflow as tf\n'), ((319, 354), 'tensorflow.io.FixedLenFeature', 'tf.io.FixedLenFeature', (['[]', 'tf.int64'], {}), '([], tf.int64)\n', (340, 354), Tru... |
from dataclasses import dataclass, field
from typing import List
from xsdata.models.datatype import XmlDateTime
__NAMESPACE__ = "http://xstest-tns/schema11_F4_3_16_v01"
@dataclass
class Root:
class Meta:
name = "root"
namespace = "http://xstest-tns/schema11_F4_3_16_v01"
el_dtime_type: List[X... | [
"dataclasses.field"
] | [((334, 435), 'dataclasses.field', 'field', ([], {'default_factory': 'list', 'metadata': "{'name': 'elDTimeType', 'type': 'Element', 'namespace': ''}"}), "(default_factory=list, metadata={'name': 'elDTimeType', 'type':\n 'Element', 'namespace': ''})\n", (339, 435), False, 'from dataclasses import dataclass, field\n'... |
from django.conf import settings
from django.shortcuts import render
from djpagan.czech.forms import ReimbursementForm
def reimbursement(request):
form = ReimbursementForm()
return render(
request, 'czech/reimbursement/form.html', {'form': form,}
)
| [
"djpagan.czech.forms.ReimbursementForm",
"django.shortcuts.render"
] | [((162, 181), 'djpagan.czech.forms.ReimbursementForm', 'ReimbursementForm', ([], {}), '()\n', (179, 181), False, 'from djpagan.czech.forms import ReimbursementForm\n'), ((194, 258), 'django.shortcuts.render', 'render', (['request', '"""czech/reimbursement/form.html"""', "{'form': form}"], {}), "(request, 'czech/reimbur... |
import os
import subprocess
from subprocess import check_output
import cv2
import numpy as np
class VideoCaptureYUV:
def __init__(self, filename, size):
self.height, self.width = size
self.frame_len = int(self.width * self.height * 3 / 2)
self.f = open(filename, 'rb')
self.shape = (int(self.height*1.5), self.... | [
"os.remove",
"cv2.VideoWriter_fourcc",
"cv2.cvtColor",
"numpy.frombuffer",
"subprocess.check_output",
"numpy.clip",
"os.listdir",
"numpy.concatenate"
] | [((1505, 1530), 'os.listdir', 'os.listdir', (['inputfilepath'], {}), '(inputfilepath)\n', (1515, 1530), False, 'import os\n'), ((1916, 1932), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (1926, 1932), False, 'import os\n'), ((2454, 2470), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (2464, 2470), ... |
"""Example of using the 'shred' transformation.
You will need a copy of 'zfs.owl' and specify its location at 'CHISEL_EXAMPLES_ZFS_OWL'.
"""
import os
from deriva.core import DerivaServer
from deriva.chisel import Model
from deriva.chisel import shred
__dry_run__ = os.getenv('CHISEL_EXAMPLE_DRY_RUN', True)
__host__ =... | [
"deriva.chisel.shred",
"deriva.chisel.Model.from_catalog",
"deriva.core.DerivaServer",
"os.getenv"
] | [((268, 309), 'os.getenv', 'os.getenv', (['"""CHISEL_EXAMPLE_DRY_RUN"""', '(True)'], {}), "('CHISEL_EXAMPLE_DRY_RUN', True)\n", (277, 309), False, 'import os\n'), ((321, 371), 'os.getenv', 'os.getenv', (['"""CHISEL_EXAMPLES_HOSTNAME"""', '"""localhost"""'], {}), "('CHISEL_EXAMPLES_HOSTNAME', 'localhost')\n", (330, 371)... |
import pandas as pd
with open('input.txt') as fh:
lines = fh.readlines()
class Board:
def __init__(self, lines):
self.values = [
(int(val), r, c)
for r, row in enumerate(lines)
for c, val in enumerate(row.split())
]
self.board = pd.DataFrame([[0] *... | [
"pandas.DataFrame"
] | [((301, 328), 'pandas.DataFrame', 'pd.DataFrame', (['([[0] * 5] * 5)'], {}), '([[0] * 5] * 5)\n', (313, 328), True, 'import pandas as pd\n')] |
# -*- coding: utf-8 -*-
"""
wakatime.main
~~~~~~~~~~~~~
Module entry point.
:copyright: (c) 2013 <NAME>.
:license: BSD, see LICENSE for more details.
"""
from __future__ import print_function
import logging
import os
import sys
import time
import traceback
pwd = os.path.dirname(os.path.abspath(... | [
"os.path.abspath",
"os.path.dirname",
"time.sleep",
"traceback.format_exc",
"os.path.join",
"sys.stdin.readline",
"logging.getLogger"
] | [((669, 698), 'logging.getLogger', 'logging.getLogger', (['"""WakaTime"""'], {}), "('WakaTime')\n", (686, 698), False, 'import logging\n'), ((304, 329), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (319, 329), False, 'import os\n'), ((350, 370), 'os.path.dirname', 'os.path.dirname', (['pwd'... |
import subprocess
def displayConnection():
lisData = []
lisData2 = []
command = 'nmcli connection show > /tmp/listConnection '
try:
subprocess.run(command, check=True, shell=True)
except subprocess.CalledProcessError:
print("Error While fetching Connnections ")
with open('/... | [
"subprocess.run"
] | [((160, 207), 'subprocess.run', 'subprocess.run', (['command'], {'check': '(True)', 'shell': '(True)'}), '(command, check=True, shell=True)\n', (174, 207), False, 'import subprocess\n')] |
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
# [!!!] be sure to use different file names for cpp and cu files
# because `setuptools` does not see the filename extension
setup(
name='PMTS_cuda',
ext_modules=[
CUDAExtension('PMTS_cuda', [
'... | [
"torch.utils.cpp_extension.CUDAExtension"
] | [((278, 347), 'torch.utils.cpp_extension.CUDAExtension', 'CUDAExtension', (['"""PMTS_cuda"""', "['PMTS_cuda.cpp', 'PMTS_cuda_kernels.cu']"], {}), "('PMTS_cuda', ['PMTS_cuda.cpp', 'PMTS_cuda_kernels.cu'])\n", (291, 347), False, 'from torch.utils.cpp_extension import BuildExtension, CUDAExtension\n')] |
# VXT
# Developed by <NAME>
#
# MIT License
# Copyright (c) 2021 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, ... | [
"vxt.speech2text.houndify.HoundifySpeech2TextEngine",
"locale.getdefaultlocale",
"vxt.speech2text.bing.BingSpeech2TextEngine",
"vxt.speech2text.sphinx.SphinxSpeech2TextEngine",
"vxt.speech2text.google.GoogleSpeech2TextEngine",
"vxt.speech2text.google_cloud.GoogleCloudSpeech2TextEngine",
"vxt.misc.track_... | [((1797, 1826), 'vxt.speech2text.google.GoogleSpeech2TextEngine', 'GoogleSpeech2TextEngine', (['None'], {}), '(None)\n', (1820, 1826), False, 'from vxt.speech2text.google import GoogleSpeech2TextEngine\n'), ((2147, 2167), 'vxt.misc.track_fmt.TrackFmt', 'TrackFmt', (['"""%t-%s.64"""'], {}), "('%t-%s.64')\n", (2155, 2167... |
from unittest import TestCase
import json
import responses
import re
from seed_services_client.message_sender \
import MessageSenderApiClient
class TestMessageSenderClient(TestCase):
def setUp(self):
self.api = MessageSenderApiClient(
"NO", "http://ms.example.org/api/v1")
@responses... | [
"seed_services_client.message_sender.MessageSenderApiClient",
"responses.add",
"json.loads",
"re.compile"
] | [((231, 291), 'seed_services_client.message_sender.MessageSenderApiClient', 'MessageSenderApiClient', (['"""NO"""', '"""http://ms.example.org/api/v1"""'], {}), "('NO', 'http://ms.example.org/api/v1')\n", (253, 291), False, 'from seed_services_client.message_sender import MessageSenderApiClient\n'), ((1865, 2000), 'resp... |
from cogdl import experiment
from cogdl.utils import build_args_from_dict
DATASET_REGISTRY = {}
def default_parameter():
args = {
"hidden_size": 128,
"seed": [0, 1, 2],
"lr": 0.025,
"walk_length": 80,
"walk_num": 40,
"batch_size": 1000,
"hop": 2,
"n... | [
"cogdl.utils.build_args_from_dict",
"cogdl.experiment"
] | [((371, 397), 'cogdl.utils.build_args_from_dict', 'build_args_from_dict', (['args'], {}), '(args)\n', (391, 397), False, 'from cogdl.utils import build_args_from_dict\n'), ((877, 976), 'cogdl.experiment', 'experiment', ([], {'task': '"""multiplex_node_classification"""', 'dataset': 'dataset_name', 'model': '"""hin2vec"... |
import json
import re
from typing import Any
__all__ = [
'dict_get_value',
'dict_has_keys',
'try_parse_json',
]
def dict_has_keys(data: dict, *keys) -> bool:
for key in keys:
if not isinstance(data, dict):
return False
if key not in data:
return False
... | [
"re.split",
"json.loads"
] | [((462, 487), 're.split', 're.split', (['"""[./]"""', 'keys[0]'], {}), "('[./]', keys[0])\n", (470, 487), False, 'import re\n'), ((775, 791), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (785, 791), False, 'import json\n')] |
# coding: utf-8
# In[1]:
import pandas as pd
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
get_ipython().magic('matplotlib inline')
# In[2]:
data = pd.read_csv("../build/nis_array_.log",delimiter="\n")
t = [7.8 for i in range(498)]
ts = np.arange(0,498,1)
# In[3]:
plt.plot(ts, t, labe... | [
"pandas.read_csv",
"numpy.arange",
"matplotlib.pyplot.plot"
] | [((179, 233), 'pandas.read_csv', 'pd.read_csv', (['"""../build/nis_array_.log"""'], {'delimiter': '"""\n"""'}), "('../build/nis_array_.log', delimiter='\\n')\n", (190, 233), True, 'import pandas as pd\n'), ((268, 288), 'numpy.arange', 'np.arange', (['(0)', '(498)', '(1)'], {}), '(0, 498, 1)\n', (277, 288), True, 'impor... |
# -*- coding: utf-8 -*-
import unittest
from dynamic_url import Url
class TestParams(unittest.TestCase):
array_test = ["Origin"]
dict_test = {"Origin": "test"}
dict_test2 = {"Not_Origin": "test"}
dict_test3 = {"Origin": "https://www.google.com/"}
dict_test4 = {"Origin": ""}
def test_get_url_t... | [
"unittest.main",
"dynamic_url.Url"
] | [((1409, 1424), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1422, 1424), False, 'import unittest\n'), ((375, 380), 'dynamic_url.Url', 'Url', ([], {}), '()\n', (378, 380), False, 'from dynamic_url import Url\n'), ((489, 494), 'dynamic_url.Url', 'Url', ([], {}), '()\n', (492, 494), False, 'from dynamic_url impor... |
"""Utilities for Inverted Pendulum."""
import torch
from torch.distributions import MultivariateNormal
from rllib.model import AbstractModel
from rllib.reward.utilities import tolerance
from rllib.util.neural_networks.utilities import to_torch
class PendulumSparseReward(AbstractModel):
"""Reward for Inverted Pen... | [
"torch.split",
"torch.cat",
"torch.sin",
"rllib.util.neural_networks.utilities.to_torch",
"torch.cos",
"torch.zeros",
"rllib.reward.utilities.tolerance",
"torch.tensor"
] | [((695, 719), 'torch.cos', 'torch.cos', (['state[..., 0]'], {}), '(state[..., 0])\n', (704, 719), False, 'import torch\n'), ((780, 835), 'rllib.reward.utilities.tolerance', 'tolerance', (['cos_angle'], {'lower': '(0.95)', 'upper': '(1.0)', 'margin': '(0.1)'}), '(cos_angle, lower=0.95, upper=1.0, margin=0.1)\n', (789, 8... |
import logging
from qfieldcloud.authentication.models import AuthToken
from qfieldcloud.core import querysets_utils
from qfieldcloud.core.models import (
Organization,
OrganizationMember,
Project,
ProjectCollaborator,
ProjectQueryset,
Team,
TeamMember,
User,
)
from rest_framework.test i... | [
"qfieldcloud.core.models.Project.objects.for_user",
"qfieldcloud.core.models.Team.objects.create",
"qfieldcloud.core.models.Organization.objects.create",
"qfieldcloud.core.models.OrganizationMember.objects.create",
"qfieldcloud.core.querysets_utils.get_users",
"qfieldcloud.authentication.models.AuthToken.... | [((339, 372), 'logging.disable', 'logging.disable', (['logging.CRITICAL'], {}), '(logging.CRITICAL)\n', (354, 372), False, 'import logging\n'), ((539, 604), 'qfieldcloud.core.models.User.objects.create_user', 'User.objects.create_user', ([], {'username': '"""user1"""', 'password': '"""<PASSWORD>"""'}), "(username='user... |
"""
Evaluate the model using Eigen split of KITTI dataset
- prepare gt depth running the script https://github.com/nianticlabs/monodepth2/blob/master/export_gt_depth.py
"""
import argparse
import os
import cv2
import numpy as np
import tensorflow as tf
from tqdm import tqdm
from eval_utils import compute_errors, comp... | [
"numpy.load",
"argparse.ArgumentParser",
"os.path.join",
"eval_utils.compute_scale_and_shift",
"eval_utils.compute_errors",
"tensorflow.compat.v1.global_variables_initializer",
"tensorflow.nn.relu",
"numpy.zeros_like",
"os.path.exists",
"tensorflow.cast",
"numpy.loadtxt",
"tensorflow.io.read_f... | [((2040, 2065), 'os.path.exists', 'os.path.exists', (['test_file'], {}), '(test_file)\n', (2054, 2065), False, 'import os\n'), ((2614, 2636), 'network.Pydnet', 'Pydnet', (['network_params'], {}), '(network_params)\n', (2620, 2636), False, 'from network import Pydnet\n'), ((2710, 2738), 'tensorflow.nn.relu', 'tf.nn.relu... |
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018-2020 Intel 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... | [
"os.getcwd",
"argparse.ArgumentParser",
"os.chdir"
] | [((1108, 1168), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Parse additional args"""'}), "(description='Parse additional args')\n", (1131, 1168), False, 'import argparse\n'), ((2971, 2982), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2980, 2982), False, 'import os\n'), ((2992, 3028),... |
"""
==============
Edge operators
==============
Edge operators are used in image processing within edge detection algorithms.
They are discrete differentiation operators, computing an approximation of the
gradient of the image intensity function.
"""
import numpy as np
import matplotlib.pyplot as plt
from skimage.d... | [
"numpy.maximum",
"numpy.arctan2",
"numpy.abs",
"skimage.filters.farid_v",
"skimage.filters.scharr_h",
"skimage.filters.sobel_v",
"skimage.filters.sobel",
"numpy.sin",
"matplotlib.pyplot.tight_layout",
"skimage.filters.farid_h",
"skimage.filters.scharr",
"skimage.filters.prewitt_h",
"skimage.... | [((491, 499), 'skimage.data.camera', 'camera', ([], {}), '()\n', (497, 499), False, 'from skimage.data import camera\n'), ((515, 529), 'skimage.filters.roberts', 'roberts', (['image'], {}), '(image)\n', (522, 529), False, 'from skimage.filters import roberts, sobel, sobel_h, sobel_v, scharr, scharr_h, scharr_v, prewitt... |
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
import time
from flask.globals import request
from app.home import blueprint
from flask import render_template, redirect, url_for
from flask_login import login_required, current_user
from app import login_manager
from jinja2 import TemplateNotFo... | [
"matplotlib.pyplot.title",
"time.ctime",
"flask.jsonify",
"nltk.download",
"os.path.join",
"pandas.DataFrame",
"squarify.plot",
"app.base.models.Picks.query.all",
"app.base.models.Picks",
"app.home.blueprint.route",
"app.db.session.commit",
"flask.render_template",
"app.base.models.Picks.que... | [((771, 797), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (784, 797), False, 'import nltk\n'), ((833, 858), 'app.home.blueprint.route', 'blueprint.route', (['"""/index"""'], {}), "('/index')\n", (848, 858), False, 'from app.home import blueprint\n'), ((945, 971), 'app.home.blueprint.... |
import asyncio
from kubernetes_asyncio import client, config
from kubernetes_asyncio.stream import WsApiClient
async def main():
# Configs can be set in Configuration class directly or using helper
# utility. If no argument provided, the config will be loaded from
# default location.
config.load_kube... | [
"kubernetes_asyncio.config.load_kube_config",
"kubernetes_asyncio.stream.WsApiClient",
"asyncio.get_event_loop",
"kubernetes_asyncio.client.CoreV1Api"
] | [((304, 329), 'kubernetes_asyncio.config.load_kube_config', 'config.load_kube_config', ([], {}), '()\n', (327, 329), False, 'from kubernetes_asyncio import client, config\n'), ((340, 358), 'kubernetes_asyncio.client.CoreV1Api', 'client.CoreV1Api', ([], {}), '()\n', (356, 358), False, 'from kubernetes_asyncio import cli... |
# self play
print("loading...")
import numpy as np
import tensorflow as tf
tf.config.threading.set_inter_op_parallelism_threads(1)
tf.config.threading.set_intra_op_parallelism_threads(1)
import MCTS
import sys
if(len(sys.argv)<=1):
print("Error! No argument given! Quiting.")
quit()
alwaysNew=False
fpu,fpu1=1.... | [
"MCTS.selfPlay",
"tensorflow.config.threading.set_intra_op_parallelism_threads",
"tensorflow.config.threading.set_inter_op_parallelism_threads",
"MCTS.setFPU",
"MCTS.loadEngine",
"MCTS.timeReset"
] | [((75, 130), 'tensorflow.config.threading.set_inter_op_parallelism_threads', 'tf.config.threading.set_inter_op_parallelism_threads', (['(1)'], {}), '(1)\n', (127, 130), True, 'import tensorflow as tf\n'), ((131, 186), 'tensorflow.config.threading.set_intra_op_parallelism_threads', 'tf.config.threading.set_intra_op_para... |
import tensorflow as tf
from keras.models import Model
from deephar.layers import *
from deephar.utils import *
def conv_block(inp, kernel_size, filters, last_act=True):
filters1, filters2, filters3 = filters
x = conv_bn_act(inp, filters1, (1, 1))
x = conv_bn_act(x, filters2, kernel_size)
x = conv... | [
"tensorflow.divide",
"keras.models.Model"
] | [((6223, 6266), 'keras.models.Model', 'Model', (['(inputs + inputs3d)', '[p, v]'], {'name': 'name'}), '(inputs + inputs3d, [p, v], name=name)\n', (6228, 6266), False, 'from keras.models import Model\n'), ((6865, 6893), 'keras.models.Model', 'Model', ([], {'inputs': 'inp', 'outputs': 'x'}), '(inputs=inp, outputs=x)\n', ... |
"""
MIT License
Copyright (c) 2021 <NAME> <<EMAIL>>
This module belongs to https://github.com/arthur-bryan/puppeteer:
A implementation of a botnet using Python on server (C&C) side
and C on the puppets side.
This module contains the class that represents the Database, with the
responsible ... | [
"sqlite3.connect",
"config.to_red"
] | [((763, 813), 'sqlite3.connect', 'sqlite3.connect', (['filename'], {'check_same_thread': '(False)'}), '(filename, check_same_thread=False)\n', (778, 813), False, 'import sqlite3\n'), ((934, 988), 'config.to_red', 'to_red', (['f"""\n[ DATABASE ERROR ] {error} {filename}\n"""'], {}), '(f"""\n[ DATABASE ERROR ] {error} {f... |
# -*- coding: utf-8 -*-
from flask import url_for
from flask_testing import TestCase
import thermos
from thermos.models import User, Bookmark
class ThermosTestCase(TestCase):
def create_app(self):
return thermos.create_app('test')
def setUp(self):
self.db = thermos.db
se... | [
"thermos.db.session.remove",
"thermos.models.User",
"thermos.create_app",
"thermos.db.drop_all",
"flask.url_for",
"thermos.models.Bookmark",
"thermos.models.Bookmark.query.first"
] | [((224, 250), 'thermos.create_app', 'thermos.create_app', (['"""test"""'], {}), "('test')\n", (242, 250), False, 'import thermos\n'), ((405, 466), 'thermos.models.User', 'User', ([], {'username': '"""test"""', 'email': '"""<EMAIL>"""', 'password': '"""<PASSWORD>"""'}), "(username='test', email='<EMAIL>', password='<PAS... |
# Copyright 2012 OpenStack Foundation
# Copyright 2013 Nebula 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 ... | [
"six.iteritems",
"openstackclient.common.utils.get_item_properties",
"openstackclient.common.utils.find_resource",
"logging.getLogger"
] | [((1378, 1430), 'logging.getLogger', 'logging.getLogger', (["(__name__ + '.CreateSecurityGroup')"], {}), "(__name__ + '.CreateSecurityGroup')\n", (1395, 1430), False, 'import logging\n'), ((2326, 2378), 'logging.getLogger', 'logging.getLogger', (["(__name__ + '.DeleteSecurityGroup')"], {}), "(__name__ + '.DeleteSecurit... |
from tensorflow.keras import backend as K
def _get_accuracy(y_true, y_pred, mask, sparse_target=False):
y_pred = K.argmax(y_pred, -1)
if sparse_target:
y_true = K.cast(y_true[:, :, 0], K.dtype(y_pred))
else:
y_true = K.argmax(y_true, -1)
judge = K.cast(K.equal(y_pred, y_true), K.floatx... | [
"tensorflow.keras.backend.sum",
"tensorflow.keras.backend.dtype",
"tensorflow.keras.backend.argmax",
"tensorflow.keras.backend.floatx",
"tensorflow.keras.backend.mean",
"tensorflow.keras.backend.equal"
] | [((119, 139), 'tensorflow.keras.backend.argmax', 'K.argmax', (['y_pred', '(-1)'], {}), '(y_pred, -1)\n', (127, 139), True, 'from tensorflow.keras import backend as K\n'), ((247, 267), 'tensorflow.keras.backend.argmax', 'K.argmax', (['y_true', '(-1)'], {}), '(y_true, -1)\n', (255, 267), True, 'from tensorflow.keras impo... |
import pandas as pd
import os
import time
import numpy as np
from deriveSummaryDUC import read_simMats, cluster_mat, oracle_per_cluster
import pickle
from collections import defaultdict
from utils import offset_str2list, offset_decreaseSentOffset, insert_string
def find_abstractive_target(predictions_topi... | [
"pandas.DataFrame",
"utils.offset_decreaseSentOffset",
"os.makedirs",
"numpy.argmax",
"deriveSummaryDUC.cluster_mat",
"deriveSummaryDUC.oracle_per_cluster",
"os.path.exists",
"time.strftime",
"utils.insert_string",
"deriveSummaryDUC.read_simMats",
"utils.offset_str2list",
"os.listdir"
] | [((1114, 1145), 'utils.offset_str2list', 'offset_str2list', (['docSpanOffsets'], {}), '(docSpanOffsets)\n', (1129, 1145), False, 'from utils import offset_str2list, offset_decreaseSentOffset, insert_string\n'), ((1161, 1216), 'utils.offset_decreaseSentOffset', 'offset_decreaseSentOffset', (['docSentCharIdx', 'span_offs... |
import json
from collections import Counter
class Encoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, set):
return list(obj)
if isinstance(obj, type({}.items())):
return {str(k): v for k, v in obj}
return json.JSONEncoder.default(self, obj)
def i... | [
"collections.Counter",
"json.JSONEncoder.default",
"json.dumps"
] | [((277, 312), 'json.JSONEncoder.default', 'json.JSONEncoder.default', (['self', 'obj'], {}), '(self, obj)\n', (301, 312), False, 'import json\n'), ((550, 563), 'collections.Counter', 'Counter', (['arg1'], {}), '(arg1)\n', (557, 563), False, 'from collections import Counter\n'), ((658, 671), 'collections.Counter', 'Coun... |
# Generated by Django 3.0.3 on 2020-02-27 08:03
from django.db import migrations, models
import sortedm2m.fields
class Migration(migrations.Migration):
dependencies = [
('orchestrator', '0003_v022_1'),
]
operations = [
migrations.AlterField(
model_name='filetrigger',
... | [
"django.db.models.ForeignKey"
] | [((355, 491), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'help_text': '"""Select the bot for this trigger."""', 'null': '(True)', 'on_delete': 'models.deletion.PROTECT', 'to': '"""orchestrator.Bot"""'}), "(help_text='Select the bot for this trigger.', null=True,\n on_delete=models.deletion.PROTECT, to... |
import pandas as pd
import re
from nltk import word_tokenize
def get_list_small_words(list_of_titles, word_size):
# Create a list of acronyms by selecting all words that are `word_size` or less letters
word_list = []
for row in list_of_titles:
[word_list.append(x) for x in row if len(x) < word_siz... | [
"re.match",
"pandas.read_csv",
"nltk.word_tokenize"
] | [((5398, 5416), 'nltk.word_tokenize', 'word_tokenize', (['row'], {}), '(row)\n', (5411, 5416), False, 'from nltk import word_tokenize\n'), ((3391, 3412), 're.match', 're.match', (['phrase', 'row'], {}), '(phrase, row)\n', (3399, 3412), False, 'import re\n'), ((424, 465), 'pandas.read_csv', 'pd.read_csv', (['filename'],... |
import os
import tarfile
import zipfile
from contextlib import contextmanager
from poetry.masonry import api
from poetry.utils.helpers import temporary_directory
@contextmanager
def cwd(directory):
prev = os.getcwd()
os.chdir(str(directory))
try:
yield
finally:
os.chdir(prev)
fixtu... | [
"poetry.masonry.api.get_requires_for_build_sdist",
"poetry.utils.helpers.temporary_directory",
"os.getcwd",
"poetry.masonry.api.build_sdist",
"os.path.dirname",
"poetry.masonry.api.build_wheel",
"poetry.masonry.api.get_requires_for_build_wheel",
"os.path.join",
"os.chdir"
] | [((213, 224), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (222, 224), False, 'import os\n'), ((339, 364), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (354, 364), False, 'import os\n'), ((298, 312), 'os.chdir', 'os.chdir', (['prev'], {}), '(prev)\n', (306, 312), False, 'import os\n'), ((861... |
# Copyright (C) 2011 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the follow... | [
"traceback.extract_stack"
] | [((1627, 1652), 'traceback.extract_stack', 'traceback.extract_stack', ([], {}), '()\n', (1650, 1652), False, 'import traceback\n')] |
import heterocl as hcl
import numpy as np
def top_syr2k(M=20, N=30, alpha=1.5, beta=1.2, dtype=hcl.Int(), target=None):
hcl.init(dtype)
A = hcl.placeholder((N, M), "A")
B = hcl.placeholder((N, M), "B")
C = hcl.placeholder((N, N), "C")
def kernel_syr2k(A, B, C):
# Irregulax axis access
... | [
"heterocl.Stage",
"heterocl.for_",
"heterocl.placeholder",
"heterocl.build",
"heterocl.create_schedule",
"heterocl.init",
"heterocl.Int"
] | [((97, 106), 'heterocl.Int', 'hcl.Int', ([], {}), '()\n', (104, 106), True, 'import heterocl as hcl\n'), ((127, 142), 'heterocl.init', 'hcl.init', (['dtype'], {}), '(dtype)\n', (135, 142), True, 'import heterocl as hcl\n'), ((151, 179), 'heterocl.placeholder', 'hcl.placeholder', (['(N, M)', '"""A"""'], {}), "((N, M), '... |
import os
'''
def list_files(startpath):
my_file = open("file.txt","w+")
for root, dirs, files in os.walk(startpath):
level = root.replace(startpath, '').count(os.sep)
indent = '-' * 4 * (level)
print('{}{}/'.format(indent, os.path.basename(root)))
subindent = ' ' * 4 * (level + ... | [
"pathlib.Path"
] | [((3011, 3031), 'pathlib.Path', 'Path', (['"""Unity Source"""'], {}), "('Unity Source')\n", (3015, 3031), False, 'from pathlib import Path\n')] |
import logging
import timeit
import numpy as np
import pandas as pd
from tqdm import tqdm
from unified_model import UnifiedModel
from unified_model.utils import truncate_middle, ITEM_COLUMN, SCORE_COLUMN
log = logging.getLogger(__name__)
UNKNOWN_ITEM = '<UNK>'
# https://en.wikipedia.org/wiki/Evaluation_measures_(i... | [
"pandas.DataFrame",
"tqdm.tqdm",
"numpy.sum",
"timeit.default_timer",
"subprocess.check_output",
"numpy.amax",
"tempfile.mkdtemp",
"numpy.array",
"subprocess.call",
"shutil.rmtree",
"os.path.join",
"logging.getLogger"
] | [((213, 240), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (230, 240), False, 'import logging\n'), ((2368, 2396), 'numpy.array', 'np.array', (['target_predictions'], {}), '(target_predictions)\n', (2376, 2396), True, 'import numpy as np\n'), ((2740, 2793), 'pandas.DataFrame', 'pd.DataFr... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2017-01-05 09:51
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0013_auto_20170105_1113'),
]
operations = [
migra... | [
"django.db.models.BooleanField",
"datetime.datetime"
] | [((656, 689), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(True)'}), '(default=True)\n', (675, 689), False, 'from django.db import migrations, models\n'), ((471, 520), 'datetime.datetime', 'datetime.datetime', (['(2017)', '(1)', '(5)', '(11)', '(51)', '(51)', '(548614)'], {}), '(2017, 1, 5... |
# coding: utf-8
"""
Cisco Intersight OpenAPI specification.
The Cisco Intersight OpenAPI specification.
OpenAPI spec version: 1.0.9-1461
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class StorageVirtualDri... | [
"six.iteritems"
] | [((45213, 45242), 'six.iteritems', 'iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (45222, 45242), False, 'from six import iteritems\n')] |
from typing import Optional, List
from data.downloads import Download
from data.packages import Package
from data.release_history import ReleaseHistory
from data.users import User
class PackageService:
@classmethod
def package_count(cls):
return Package.objects().count()
@classmethod
def rel... | [
"data.packages.Package.objects",
"data.users.User.objects",
"data.downloads.Download.objects",
"data.release_history.ReleaseHistory.objects"
] | [((1042, 1082), 'data.users.User.objects', 'User.objects', ([], {'id__in': 'package.maintainers'}), '(id__in=package.maintainers)\n', (1054, 1082), False, 'from data.users import User\n'), ((265, 282), 'data.packages.Package.objects', 'Package.objects', ([], {}), '()\n', (280, 282), False, 'from data.packages import Pa... |
#!/usr/bin/python3
"""Various utils to check the integrity of the movesGraph"""
import argparse
import datetime
import os.path
import logging
LOG_FILENAME = '/tmp/yoga.log'
logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
import moves
import strengthaerobics
import stretches
def sloppyRun(func, *args,... | [
"moves.generateMoves",
"datetime.datetime.now",
"argparse.ArgumentParser",
"logging.basicConfig"
] | [((175, 238), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': 'LOG_FILENAME', 'level': 'logging.DEBUG'}), '(filename=LOG_FILENAME, level=logging.DEBUG)\n', (194, 238), False, 'import logging\n'), ((852, 874), 'moves.generateMoves', 'moves.generateMoves', (['d'], {}), '(d)\n', (871, 874), False, 'import ... |
#!/usr/bin/env
import datetime
import starter
import pytest
import pathlib
import sys
@pytest.mark.skipif(pathlib.Path(sys.prefix) != pathlib.Path(r"C:\ProgramData\Anaconda3\envs\starter"), reason="Test only in native enironment")
def test_date():
starter_date = datetime.datetime.strptime(starter.__date__, "%Y-... | [
"datetime.datetime.strptime",
"datetime.datetime.today",
"pathlib.Path"
] | [((271, 327), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['starter.__date__', '"""%Y-%m-%d"""'], {}), "(starter.__date__, '%Y-%m-%d')\n", (297, 327), False, 'import datetime\n'), ((340, 365), 'datetime.datetime.today', 'datetime.datetime.today', ([], {}), '()\n', (363, 365), False, 'import datetime\n'... |
import pytvmaze
from pynab import log
import pynab.ids
TVMAZE_SEARCH_URL = ' http://api.tvmaze.com/search/shows'
NAME = 'TVMAZE'
def search(data):
"""
Search TVMaze for Show Info.
:param data: show data
:return: show details
"""
year = data.get('year')
country = data.get('country')
... | [
"pynab.log.debug",
"pytvmaze.TVMaze"
] | [((747, 764), 'pytvmaze.TVMaze', 'pytvmaze.TVMaze', ([], {}), '()\n', (762, 764), False, 'import pytvmaze\n'), ((1110, 1144), 'pynab.log.debug', 'log.debug', (['"""tvmaze: No show found"""'], {}), "('tvmaze: No show found')\n", (1119, 1144), False, 'from pynab import log\n')] |
# -*- coding:utf-8 -*-
__author__ = 'yangjian'
"""
"""
import pandas as pd
from deeptables.models import DeepTable
from deeptables.models.hyper_dt import HyperDT, tiny_dt_space
from hypernets.core.callbacks import SummaryCallback, FileStorageLoggingCallback
from hypernets.core.searcher import OptimizeDirection
from hy... | [
"pandas.DataFrame",
"hypernets.searchers.RandomSearcher",
"hypernets.core.callbacks.SummaryCallback",
"sklearn.model_selection.train_test_split",
"hypernets.core.callbacks.FileStorageLoggingCallback",
"sklearn.datasets.load_boston",
"pandas.Series"
] | [((603, 616), 'sklearn.datasets.load_boston', 'load_boston', ([], {}), '()\n', (614, 616), False, 'from sklearn.datasets import load_boston\n'), ((637, 670), 'pandas.DataFrame', 'pd.DataFrame', (['boston_dataset.data'], {}), '(boston_dataset.data)\n', (649, 670), True, 'import pandas as pd\n'), ((744, 776), 'pandas.Ser... |
import torch
import torch.nn as nn
from utils import v_wrap, set_init, push_and_pull, record
import torch.nn.functional as F
import torch.multiprocessing as mp
from shared_adam import SharedAdam
import gym
import os
import argparse
import matplotlib.pyplot as plt
from simulations.cartpole_sim import Simulation
os.envi... | [
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"utils.push_and_pull",
"torch.load",
"utils.set_init",
"torch.multiprocessing.cpu_count",
"utils.v_wrap",
"torch.nn.functional.softmax",
"utils.record",
"simulations.cartpole_sim.Simulation",
"torch.multiprocessing.... | [((410, 435), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (433, 435), False, 'import argparse\n'), ((3501, 3513), 'simulations.cartpole_sim.Simulation', 'Simulation', ([], {}), '()\n', (3511, 3513), False, 'from simulations.cartpole_sim import Simulation\n'), ((4694, 4706), 'simulations.cart... |
import os
from pathlib import Path
from argparse import ArgumentParser
import duplicates as du
_parser = ArgumentParser(
'Utility for parsing a directory, and finding duplicates.'
)
_parser.add_argument(
'-d', '--directory',
help='Directory to scan recursively. '
'Default is current directory',... | [
"duplicates.DuplicateParser",
"argparse.ArgumentParser",
"duplicates.Dashboard",
"os.getcwd",
"duplicates.Extractor",
"pathlib.Path"
] | [((108, 182), 'argparse.ArgumentParser', 'ArgumentParser', (['"""Utility for parsing a directory, and finding duplicates."""'], {}), "('Utility for parsing a directory, and finding duplicates.')\n", (122, 182), False, 'from argparse import ArgumentParser\n'), ((1082, 1120), 'duplicates.DuplicateParser', 'du.DuplicatePa... |
from sys import stderr
import pandas as pd
import pytest
import spacy
from atap_widgets.conversation import Conversation
# Workaround for spacy models being difficult to install
# via pip
try:
nlp = spacy.load("en_core_web_sm")
except OSError:
print(
"Downloading language model for spaCy\n"
... | [
"pandas.DataFrame",
"spacy.cli.download",
"atap_widgets.conversation.Conversation",
"pytest.fixture",
"spacy.load"
] | [((463, 494), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (477, 494), False, 'import pytest\n'), ((890, 921), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (904, 921), False, 'import pytest\n'), ((208, 236), 'spacy.load', 's... |
"""
This module contains the python script that defines the configuration
of the mouse for my Qtile configuration.
For more information check: github.com/pablocorbalann/dotfiles/tree/main/qtile
"""
# Imports (just qtile)
from libqtile.config import Drag, Click
from libqtile.command import lazy
from settings.keys imp... | [
"libqtile.command.lazy.window.set_size_floating",
"libqtile.command.lazy.window.get_size",
"libqtile.command.lazy.window.get_position",
"libqtile.command.lazy.window.bring_to_front",
"libqtile.command.lazy.window.set_position_floating"
] | [((542, 577), 'libqtile.command.lazy.window.set_position_floating', 'lazy.window.set_position_floating', ([], {}), '()\n', (575, 577), False, 'from libqtile.command import lazy\n'), ((679, 710), 'libqtile.command.lazy.window.set_size_floating', 'lazy.window.set_size_floating', ([], {}), '()\n', (708, 710), False, 'from... |
#-----------------------------------------------------------------------------
# Copyright (c) 2021, PyInstaller Development Team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# The full license is in the file COPYING.txt, distr... | [
"inspect.getfile",
"os.path.isabs",
"os.path.join",
"os.path.basename"
] | [((798, 821), 'inspect.getfile', 'inspect.getfile', (['object'], {}), '(object)\n', (813, 821), False, 'import inspect\n'), ((833, 856), 'os.path.isabs', 'os.path.isabs', (['filename'], {}), '(filename)\n', (846, 856), False, 'import os\n'), ((1022, 1049), 'os.path.basename', 'os.path.basename', (['main_file'], {}), '(... |
#!/usr/bin/env python
from collections import defaultdict
import pandas as pd
import numpy as np
import sys
import pprint
from Bio import SearchIO
import argparse
def hmmer_to_df(hmmTbl, only_top_hit=False):
"""
Takes a table from HMMER 3 and converts it to a Pandas Dataframe
Adapted from https://stackoverflow.c... | [
"pandas.DataFrame.from_dict",
"argparse.ArgumentParser",
"pandas.read_csv",
"collections.defaultdict",
"Bio.SearchIO.parse",
"pandas.concat",
"argparse.FileType"
] | [((403, 420), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (414, 420), False, 'from collections import defaultdict\n'), ((837, 865), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['hits'], {}), '(hits)\n', (859, 865), True, 'import pandas as pd\n'), ((890, 915), 'argparse.ArgumentPar... |
from luminaire.model.base_model import BaseModel, BaseModelHyperParams
from luminaire.exploration.data_exploration import DataExploration
class WindowDensityHyperParams(BaseModelHyperParams):
"""
Hyperparameter class for Luminaire Window density model.
:param str freq: The frequency of the time-series. L... | [
"sklearn.preprocessing.StandardScaler",
"numpy.clip",
"scipy.stats.levene",
"numpy.mean",
"numpy.exp",
"numpy.std",
"luminaire.exploration.data_exploration.DataExploration",
"numpy.max",
"numpy.linspace",
"pandas.Timedelta",
"collections.Counter",
"scipy.stats.kde.gaussian_kde",
"scipy.stats... | [((15154, 15171), 'luminaire.exploration.data_exploration.DataExploration', 'DataExploration', ([], {}), '()\n', (15169, 15171), False, 'from luminaire.exploration.data_exploration import DataExploration\n'), ((37362, 37381), 'pandas.Timedelta', 'pd.Timedelta', (['"""10D"""'], {}), "('10D')\n", (37374, 37381), True, 'i... |
import sys
import time
import scipy as sp
from scipy import stats
import h5py
from ldpred import LDpred_inf
from ldpred import util
from ldpred import ld
from ldpred import reporting
from ldpred import coord_genotypes
def get_LDpred_sample_size(n,ns,verbose):
if n is None:
#If coefficient of variation i... | [
"sys.stdout.write",
"scipy.isreal",
"ldpred.coord_genotypes.get_mean_sample_size",
"scipy.sum",
"scipy.stats.norm.rvs",
"ldpred.reporting.print_summary",
"ldpred.util.load_lrld_dict",
"sys.stdout.flush",
"ldpred.LDpred_inf.ldpred_inf",
"scipy.exp",
"scipy.zeros",
"ldpred.util.get_snp_lrld_stat... | [((1271, 1282), 'scipy.zeros', 'sp.zeros', (['m'], {}), '(m)\n', (1279, 1282), True, 'import scipy as sp\n'), ((3053, 3071), 'scipy.random.seed', 'sp.random.seed', (['(42)'], {}), '(42)\n', (3067, 3071), True, 'import scipy as sp\n'), ((3083, 3094), 'time.time', 'time.time', ([], {}), '()\n', (3092, 3094), False, 'impo... |
from textwrap import dedent
from sml_test.cli import cli
def assert_result(result, ok=0, fail=0, err=0, exit_code=0, contains=""):
assert f"OK={ok}, FAIL={fail}, ERR={err}" in result.output
assert result.exit_code == exit_code
assert contains in result.output
def test_ok_and_err(sml_test_file, cli_runn... | [
"textwrap.dedent"
] | [((363, 470), 'textwrap.dedent', 'dedent', (['"""\n val test_1 = 1 = 1\n val test_2 = 1 = 2\n """'], {}), '(\n """\n val test_1 = 1 = 1\n val test_2 = 1 = 2\n """\n )\n', (369, 470), False, 'from textwrap import dedent\n'), ((659, 7... |
from unittest import TestCase
from unittest.mock import patch
import numpy as np
from exceptions import NoUriProviden
from main import calculate_average_face_encoding
from main import obtain_image_face_encodings
from main import parallelize_face_encodings
class TryTesting(TestCase):
def test_obtain_image_face_en... | [
"main.obtain_image_face_encodings",
"main.parallelize_face_encodings",
"unittest.mock.patch",
"main.calculate_average_face_encoding",
"numpy.ndarray"
] | [((622, 678), 'unittest.mock.patch', 'patch', (['"""main.IMAGE_DIRECTORY"""', '"""/path/that/doesnt/exist"""'], {}), "('main.IMAGE_DIRECTORY', '/path/that/doesnt/exist')\n", (627, 678), False, 'from unittest.mock import patch\n'), ((968, 1026), 'unittest.mock.patch', 'patch', (['"""main.obtain_image_face_encodings"""']... |
# GPLv3 License
#
# Copyright (C) 2020 Ubisoft
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is dis... | [
"mixer.codec.register_message_types",
"mixer.codec.unregister_message_types"
] | [((1005, 1048), 'mixer.codec.register_message_types', 'codec.register_message_types', (['message_types'], {}), '(message_types)\n', (1033, 1048), False, 'from mixer import codec\n'), ((1073, 1118), 'mixer.codec.unregister_message_types', 'codec.unregister_message_types', (['message_types'], {}), '(message_types)\n', (1... |
import numpy as np
import cv2
import matplotlib.pyplot as plt
from davg.lanefinding.Prediction import Prediction
def plot_line(img, x, y, color=(255,255,0), thickness=2):
''' Takes an image and two arrays of x and y points similar to matplotlib
and writes the lines onto the image. If the points are floats... | [
"matplotlib.pyplot.show",
"cv2.polylines",
"numpy.average",
"davg.lanefinding.Prediction.Prediction.predict_next_values",
"matplotlib.pyplot.imshow",
"numpy.zeros",
"davg.lanefinding.Prediction.Prediction.find_weighted_averages",
"numpy.diff",
"numpy.array",
"numpy.vstack"
] | [((472, 525), 'cv2.polylines', 'cv2.polylines', (['img', '[points]', '(False)', 'color', 'thickness'], {}), '(img, [points], False, color, thickness)\n', (485, 525), False, 'import cv2\n'), ((644, 682), 'numpy.zeros', 'np.zeros', (['(128, 128, 3)'], {'dtype': '"""uint8"""'}), "((128, 128, 3), dtype='uint8')\n", (652, 6... |
import os
import json
import sys
import argparse
from pathlib import Path
import pandas as pd
from tqdm import tqdm
DESCRIPTION = """
Build a csv file containing necessary information of a COCO dataset that is
compatible with this package.
"""
def get_bbox(bbox):
"""Get bbox of type (xmin, ymin, xmax, ymax) fr... | [
"tqdm.tqdm",
"json.load",
"argparse.ArgumentParser",
"pandas.merge",
"pathlib.Path",
"os.path.splitext",
"pandas.DataFrame.from_records",
"pandas.Series",
"os.path.split"
] | [((2150, 2190), 'pandas.DataFrame.from_records', 'pd.DataFrame.from_records', (["ann['images']"], {}), "(ann['images'])\n", (2175, 2190), True, 'import pandas as pd\n'), ((2676, 2687), 'tqdm.tqdm', 'tqdm', (['paths'], {}), '(paths)\n', (2680, 2687), False, 'from tqdm import tqdm\n'), ((3528, 3637), 'argparse.ArgumentPa... |
import pandas as pd
from utils.date import to_datetime
from functools import wraps
nb_author = 16
class DataFrameGenertion:
def __init__(self):
self.columns = self._generate_columns()
self.df = pd.DataFrame(columns=self.columns)
self.d = None
self.article = None
def _generate_c... | [
"pandas.DataFrame",
"utils.date.to_datetime"
] | [((215, 249), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'self.columns'}), '(columns=self.columns)\n', (227, 249), True, 'import pandas as pd\n'), ((2144, 2200), 'utils.date.to_datetime', 'to_datetime', (["article['MedlineCitation']['DateCompleted']"], {}), "(article['MedlineCitation']['DateCompleted'])\n", (... |
import unittest
from index import update_inverted_index
__author__ = 'guoyong'
class IndexTest(unittest.TestCase):
def setUp(self):
self.index = {
'python': []
}
def test_update_inverted_index_empty(self):
update_inverted_index(self.index, 'python', 1, 2, 3)
sel... | [
"index.update_inverted_index"
] | [((256, 308), 'index.update_inverted_index', 'update_inverted_index', (['self.index', '"""python"""', '(1)', '(2)', '(3)'], {}), "(self.index, 'python', 1, 2, 3)\n", (277, 308), False, 'from index import update_inverted_index\n'), ((437, 489), 'index.update_inverted_index', 'update_inverted_index', (['self.index', '"""... |