code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from pdlpy.distribution import Distribution
from pdlpy.math import ceil, log2
class Geometric(Distribution):
"""
Discrete probability distributions of the random number X of Bernoulli trials needed to get a single success
"""
def __init__(self, p: float):
"""
Parameters
p: the... | [
"pdlpy.math.log2"
] | [((467, 478), 'pdlpy.math.log2', 'log2', (['(1 - p)'], {}), '(1 - p)\n', (471, 478), False, 'from pdlpy.math import ceil, log2\n')] |
import unittest
from better_profanity import profanity
class ProfanityTest(unittest.TestCase):
def test_contains_profanity(self):
profane = profanity.contains_profanity('he is a m0th3rf*cker')
self.assertTrue(profane)
def test_leaves_paragraphs_untouched(self):
innocent_text = """If y... | [
"unittest.main",
"better_profanity.profanity.load_censor_words",
"better_profanity.profanity.contains_profanity",
"better_profanity.profanity.censor"
] | [((1804, 1819), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1817, 1819), False, 'import unittest\n'), ((154, 206), 'better_profanity.profanity.contains_profanity', 'profanity.contains_profanity', (['"""he is a m0th3rf*cker"""'], {}), "('he is a m0th3rf*cker')\n", (182, 206), False, 'from better_profanity impor... |
# coding: utf-8
"""
Layered Witness & Control
LI Witness provides deep insight and analytics into containerized applications. Control provides dynamic runtime security and analytics for containerized applications. You can find out more about the Layered Insight Suite at [http://layeredinsight.com](http://laye... | [
"six.iteritems"
] | [((12480, 12509), 'six.iteritems', 'iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (12489, 12509), False, 'from six import iteritems\n')] |
#!/usr/bin/env python
from __future__ import print_function
import click
import os
import time
import tqdm
from filestore import FileStore
import logging
DEFAULT_EXT = "pdf;png;jpg;txt"
def typefilter(f):
global EXTENSIONS
for ext in EXTENSIONS:
if f.lower().endswith(ext.lower()):
return ... | [
"os.listdir",
"os.stat",
"click.option",
"tqdm.tqdm",
"filestore.FileStore",
"time.sleep",
"os.getcwd",
"click.Path",
"os.system",
"click.command",
"logging.info"
] | [((600, 615), 'click.command', 'click.command', ([], {}), '()\n', (613, 615), False, 'import click\n'), ((675, 762), 'click.option', 'click.option', (['"""--ptime"""'], {'default': '(2.5)', 'help': '"""loop polling interval (default: 2.5s)"""'}), "('--ptime', default=2.5, help=\n 'loop polling interval (default: 2.5... |
import uuid
_UUID_NAMESPACE = uuid.uuid1()
def read_notes(notes_filename):
with open(notes_filename) as notes_file:
note = ''
for line in notes_file:
if len(line.rstrip()) != 0:
note += line.rstrip() + '\n'
elif len(note.rstrip()) != 0:
yield... | [
"uuid.uuid1",
"uuid.uuid5"
] | [((31, 43), 'uuid.uuid1', 'uuid.uuid1', ([], {}), '()\n', (41, 43), False, 'import uuid\n'), ((474, 507), 'uuid.uuid5', 'uuid.uuid5', (['_UUID_NAMESPACE', 'note'], {}), '(_UUID_NAMESPACE, note)\n', (484, 507), False, 'import uuid\n')] |
import pandas as pd
"""vilbert=pd.read_csv('st_surrey_vilbert_big_segments.csv',names=['index','scores'])
text=pd.read_csv('new_surrey_results_ismail.csv')
picsom=pd.read_csv('picsom_big_segments.csv',names=['index','scores'])
print(picsom['scores'])
ensemble_score=0.5*picsom['scores']+ 0.2* vilbert['scores'... | [
"pandas.read_csv"
] | [((352, 403), 'pandas.read_csv', 'pd.read_csv', (['"""Surrey_bigsegments_notsorted _SU.csv"""'], {}), "('Surrey_bigsegments_notsorted _SU.csv')\n", (363, 403), True, 'import pandas as pd\n')] |
from .libc import printf, scanf, localtime, asctime
from ctypes import c_int, create_string_buffer, byref, Structure
def input_pair():
key = c_int()
value = create_string_buffer(16)
printf(b"[Input a pair as int:string] ")
scanf(b"%i:%s", byref(key), byref(value))
return key, value.value
def print... | [
"ctypes.byref",
"ctypes.c_int",
"ctypes.create_string_buffer"
] | [((146, 153), 'ctypes.c_int', 'c_int', ([], {}), '()\n', (151, 153), False, 'from ctypes import c_int, create_string_buffer, byref, Structure\n'), ((166, 190), 'ctypes.create_string_buffer', 'create_string_buffer', (['(16)'], {}), '(16)\n', (186, 190), False, 'from ctypes import c_int, create_string_buffer, byref, Stru... |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2010,2011,2012,2013,2014,2015,2016,2017 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... | [
"utils.import_depends",
"unittest.TextTestRunner",
"unittest.TestLoader"
] | [((866, 888), 'utils.import_depends', 'utils.import_depends', ([], {}), '()\n', (886, 888), False, 'import utils\n'), ((21901, 21922), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (21920, 21922), False, 'import unittest\n'), ((21974, 22010), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], ... |
from typing import Union
import numpy as np
from gmhazard_calc import gm_data
from .SiteInfo import SiteInfo
from qcore.geo import closest_location
def get_site_from_coords(
ensemble: Union[str, gm_data.Ensemble],
lat: float,
lon: float,
user_vs30: float = None,
):
"""Returns a SiteInfo for the
... | [
"gmhazard_calc.gm_data.Ensemble",
"numpy.vstack"
] | [((809, 835), 'gmhazard_calc.gm_data.Ensemble', 'gm_data.Ensemble', (['ensemble'], {}), '(ensemble)\n', (825, 835), False, 'from gmhazard_calc import gm_data\n'), ((1616, 1642), 'gmhazard_calc.gm_data.Ensemble', 'gm_data.Ensemble', (['ensemble'], {}), '(ensemble)\n', (1632, 1642), False, 'from gmhazard_calc import gm_d... |
# coding=utf-8
# Copyright 2022 DataLab Authors and the current dataset script contributor.
#
# 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... | [
"datalabs.Value",
"datalabs.SplitGenerator",
"datalabs.Features",
"datalabs.get_task",
"json.load",
"datalabs.features.ClassLabel"
] | [((4048, 4139), 'datalabs.SplitGenerator', 'datalabs.SplitGenerator', ([], {'name': 'datalabs.Split.TRAIN', 'gen_kwargs': "{'filepath': train_path}"}), "(name=datalabs.Split.TRAIN, gen_kwargs={'filepath':\n train_path})\n", (4071, 4139), False, 'import datalabs\n'), ((4272, 4284), 'json.load', 'json.load', (['f'], {... |
#coding:utf-8
import pigpio
import time
pi1 = pigpio.pi()
rPIN1 = 13
rPIN2 = 19
lPIN1 = 18
lPIN2 = 12
rline = 16
lline = 20
pi1.set_mode(rPIN1, pigpio.OUTPUT)
pi1.set_mode(rPIN2, pigpio.OUTPUT)
pi1.set_mode(lPIN1, pigpio.OUTPUT)
pi1.set_mode(lPIN2, pigpio.OUTPUT)
pi1.set_mode(rline, pigpio.INPUT)
pi1.set_mode(lline,... | [
"pigpio.pi",
"time.sleep"
] | [((46, 57), 'pigpio.pi', 'pigpio.pi', ([], {}), '()\n', (55, 57), False, 'import pigpio\n'), ((407, 420), 'time.sleep', 'time.sleep', (['t'], {}), '(t)\n', (417, 420), False, 'import time\n'), ((493, 506), 'time.sleep', 'time.sleep', (['t'], {}), '(t)\n', (503, 506), False, 'import time\n'), ((923, 936), 'time.sleep', ... |
# -*- coding: utf-8 -*-
"""
@date: 2020/12/30 下午4:44
@file: attention_helper.py
@author: zj
@description:
"""
from zcls.model.layers.global_context_block import GlobalContextBlock2D
from zcls.model.layers.squeeze_and_excitation_block import SqueezeAndExcitationBlock2D
from zcls.model.layers.non_local_embedded_gaussi... | [
"zcls.model.layers.non_local_embedded_gaussian.NonLocal2DEmbeddedGaussian",
"zcls.model.layers.simplified_non_local_embedded_gaussian.SimplifiedNonLocal2DEmbeddedGaussian",
"zcls.model.layers.squeeze_and_excitation_block.SqueezeAndExcitationBlock2D",
"zcls.model.layers.global_context_block.GlobalContextBlock2... | [((603, 667), 'zcls.model.layers.global_context_block.GlobalContextBlock2D', 'GlobalContextBlock2D', ([], {'in_channels': 'in_planes', 'reduction': 'reduction'}), '(in_channels=in_planes, reduction=reduction)\n', (623, 667), False, 'from zcls.model.layers.global_context_block import GlobalContextBlock2D\n'), ((741, 827... |
# Generated by Django 2.2.11 on 2020-03-20 15:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('paper', '0036_auto_20200319_2159'),
]
operations = [
migrations.AddField(
model_name='paper',
name='external_source... | [
"django.db.models.CharField"
] | [((341, 410), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'default': 'None', 'max_length': '(255)', 'null': '(True)'}), '(blank=True, default=None, max_length=255, null=True)\n', (357, 410), False, 'from django.db import migrations, models\n')] |
import re
import logging
from . import dithering
from . import constants as c
LOG = logging.getLogger('parse_apt.templates')
class Template(object):
"""
Generic template object from which every class derive
"""
def __init__(self, template, metadata=None):
"""
:param template: MiriI... | [
"logging.getLogger",
"re.compile"
] | [((86, 126), 'logging.getLogger', 'logging.getLogger', (['"""parse_apt.templates"""'], {}), "('parse_apt.templates')\n", (103, 126), False, 'import logging\n'), ((1178, 1196), 're.compile', 're.compile', (['regexp'], {}), '(regexp)\n', (1188, 1196), False, 'import re\n')] |
from django.urls import path
from .apps import AZIranianBankGatewaysConfig
from .views import callback_view, go_to_bank_gateway
app_name = AZIranianBankGatewaysConfig.name
_urlpatterns = [
path('callback/', callback_view, name='callback'),
path('go-to-bank-gateway/', go_to_bank_gateway, name='go-to-bank-gatew... | [
"django.urls.path"
] | [((195, 244), 'django.urls.path', 'path', (['"""callback/"""', 'callback_view'], {'name': '"""callback"""'}), "('callback/', callback_view, name='callback')\n", (199, 244), False, 'from django.urls import path\n'), ((250, 324), 'django.urls.path', 'path', (['"""go-to-bank-gateway/"""', 'go_to_bank_gateway'], {'name': '... |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('taggit_autocomplete_jqueryui.views',
url(r'^json$', 'tag_list_view',
name='taggit_autocomplete_jqueryui_tag_list'),
)
| [
"django.conf.urls.defaults.url"
] | [((142, 218), 'django.conf.urls.defaults.url', 'url', (['"""^json$"""', '"""tag_list_view"""'], {'name': '"""taggit_autocomplete_jqueryui_tag_list"""'}), "('^json$', 'tag_list_view', name='taggit_autocomplete_jqueryui_tag_list')\n", (145, 218), False, 'from django.conf.urls.defaults import patterns, url\n')] |
"""
py2app build script for SEED2_0
"""
from setuptools import setup
APP = ['SEED2_0.py']
DATA_FILES = ["data"]
OPTIONS = {'argv_emulation': True,
'iconfile': 'icon.icns',
'packages': ['PIL','sklearn','pandas','pysindy']
}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2a... | [
"setuptools.setup"
] | [((255, 352), 'setuptools.setup', 'setup', ([], {'app': 'APP', 'data_files': 'DATA_FILES', 'options': "{'py2app': OPTIONS}", 'setup_requires': "['py2app']"}), "(app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS},\n setup_requires=['py2app'])\n", (260, 352), False, 'from setuptools import setup\n')] |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#######################################################################
##### #####
##### <NAME> #####
##### <EMAIL> #####
##### ... | [
"cv2.rectangle",
"cv2.BFMatcher",
"cv2.normalize",
"time.sleep",
"cv2.imshow",
"numpy.array",
"cv2.xfeatures2d.SIFT_create",
"cv2.ocl.setUseOpenCL",
"cv2.calcHist",
"cv2.calcBackProject",
"cv2.xfeatures2d.SURF_create",
"cv2.ORB_create",
"picamera.array.PiRGBArray",
"cv2.waitKey",
"cv2.me... | [((1590, 1613), 'numpy.array', 'np.array', (['[172, 61, 57]'], {}), '([172, 61, 57])\n', (1598, 1613), True, 'import numpy as np\n'), ((1648, 1673), 'numpy.array', 'np.array', (['[179, 255, 255]'], {}), '([179, 255, 255])\n', (1656, 1673), True, 'import numpy as np\n'), ((1858, 1882), 'numpy.array', 'np.array', (['[111... |
from .base import BasePaymentBackend
import os
class XsollaBackend(BasePaymentBackend):
def __init__(self, project_id, project_key, merchant_id, api_key, sandbox=False):
super().__init__(sandbox)
self.project_id = project_id
self.project_key = os.getenv('XSOLLA_PROJECT_KEY', project_key)
... | [
"os.getenv"
] | [((274, 318), 'os.getenv', 'os.getenv', (['"""XSOLLA_PROJECT_KEY"""', 'project_key'], {}), "('XSOLLA_PROJECT_KEY', project_key)\n", (283, 318), False, 'import os\n'), ((346, 390), 'os.getenv', 'os.getenv', (['"""XSOLLA_MERCHANT_ID"""', 'merchant_id'], {}), "('XSOLLA_MERCHANT_ID', merchant_id)\n", (355, 390), False, 'im... |
# Copyright (c) 2018 PrimeVR
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php
from lib.claimed_nuggets import ClaimedNuggets
from lib.nugget import BasicNugget, SpecialNugget, TbdNugget, DirectQueryNugget
from lib.special_coins imp... | [
"lib.nugget.BasicNugget",
"lib.nugget.TbdNugget",
"lib.nugget.SpecialNugget",
"lib.nugget.DirectQueryNugget"
] | [((2477, 2575), 'lib.nugget.DirectQueryNugget', 'DirectQueryNugget', (['addr', 'coin', 'txid', 'txindex', 'satoshis', 'self.tails', 'self.bfc_force'], {'fbtc': 'fbtc'}), '(addr, coin, txid, txindex, satoshis, self.tails, self.\n bfc_force, fbtc=fbtc)\n', (2494, 2575), False, 'from lib.nugget import BasicNugget, Spec... |
import os
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Dict, Any
from dpu_utils.utils import RichPath
from tqdm import tqdm
class DataProcessor(ABC):
def __init__(self):
self.skipped = 0
self.failed = 0
def parse_subfolders(self, input_folder: Path, output... | [
"os.listdir",
"os.makedirs"
] | [((415, 439), 'os.listdir', 'os.listdir', (['input_folder'], {}), '(input_folder)\n', (425, 439), False, 'import os\n'), ((938, 964), 'os.makedirs', 'os.makedirs', (['output_folder'], {}), '(output_folder)\n', (949, 964), False, 'import os\n'), ((1015, 1039), 'os.listdir', 'os.listdir', (['input_folder'], {}), '(input_... |
import codecs
import yaml
from yaml.composer import Composer
from ansiblereview import Result, Error
def hunt_repeated_yaml_keys(data):
"""Parses yaml and returns a list of repeated variables and
the line on which they occur
"""
loader = yaml.Loader(data)
def compose_node(parent, index):
... | [
"yaml.composer.Composer.compose_node",
"codecs.open",
"yaml.Loader",
"ansiblereview.Error"
] | [((259, 276), 'yaml.Loader', 'yaml.Loader', (['data'], {}), '(data)\n', (270, 276), False, 'import yaml\n'), ((437, 481), 'yaml.composer.Composer.compose_node', 'Composer.compose_node', (['loader', 'parent', 'index'], {}), '(loader, parent, index)\n', (458, 481), False, 'from yaml.composer import Composer\n'), ((1185, ... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 22 14:24:45 2018
@author: yume
"""
import numpy as np
import matplotlib.pyplot as plt
import hidden_markov_models
def gaussian_paras(x):
mean = x.mean()
var = x.var()
std = x.std()
return (mean, var, std)
if __name__ == '__main__':
sampler = hidde... | [
"numpy.random.normal",
"hidden_markov_models.GaussianHMM",
"numpy.unique",
"numpy.hstack",
"numpy.random.choice",
"numpy.array",
"numpy.linspace",
"numpy.meshgrid",
"numpy.arange"
] | [((315, 349), 'hidden_markov_models.GaussianHMM', 'hidden_markov_models.GaussianHMM', ([], {}), '()\n', (347, 349), False, 'import hidden_markov_models\n'), ((694, 718), 'numpy.linspace', 'np.linspace', (['(0)', '(K - 1)', 'K'], {}), '(0, K - 1, K)\n', (705, 718), True, 'import numpy as np\n'), ((725, 749), 'numpy.lins... |
from mobula.utils import get_git_hash
def test_get_git_hash():
git_hash = get_git_hash()
assert type(git_hash) == str, (git_hash, type(git_hash))
assert len(git_hash) == 7 or git_hash == 'custom', git_hash
def test_edict():
from mobula.internal.edict import edict
data = edict(a=3, b=4)
asser... | [
"mobula.internal.edict.edict",
"mobula.utils.get_git_hash"
] | [((80, 94), 'mobula.utils.get_git_hash', 'get_git_hash', ([], {}), '()\n', (92, 94), False, 'from mobula.utils import get_git_hash\n'), ((295, 310), 'mobula.internal.edict.edict', 'edict', ([], {'a': '(3)', 'b': '(4)'}), '(a=3, b=4)\n', (300, 310), False, 'from mobula.internal.edict import edict\n')] |
from discord.ext import commands
from src.handler import Handler
from utils import settings
from host import base
from responses import test
prefix = "!"
bot = commands.AutoShardedBot(command_prefix=prefix)
bot.remove_command("help")
@bot.event
async def on_ready():
print("*[CLIENT] ON READY, AWAITI... | [
"host.base.DummyNation",
"src.handler.Handler",
"discord.ext.commands.AutoShardedBot"
] | [((170, 216), 'discord.ext.commands.AutoShardedBot', 'commands.AutoShardedBot', ([], {'command_prefix': 'prefix'}), '(command_prefix=prefix)\n', (193, 216), False, 'from discord.ext import commands\n'), ((834, 852), 'host.base.DummyNation', 'base.DummyNation', ([], {}), '()\n', (850, 852), False, 'from host import base... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'd:\Users\injah\Documents\GitHub\python-demo\video_chat\ui\main.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtGui.QFont",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QStatusBar",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QGroupBox",
"PyQt5.QtCore.QSize",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWid... | [((704, 733), 'PyQt5.QtWidgets.QWidget', 'QtWidgets.QWidget', (['MainWindow'], {}), '(MainWindow)\n', (721, 733), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((821, 857), 'PyQt5.QtWidgets.QLabel', 'QtWidgets.QLabel', (['self.centralwidget'], {}), '(self.centralwidget)\n', (837, 857), False, 'from PyQt5 impo... |
# Import all the required modules
from typing import Any
from PyQt6.QtCore import QPointF, QSequentialAnimationGroup, QSize, Qt, pyqtSignal
from PyQt6.QtGui import QColor, QEnterEvent, QMouseEvent, QTransform
from PyQt6.QtWidgets import (
QGraphicsColorizeEffect,
QGraphicsScene,
QGraphicsView,
QWidget,
... | [
"PyQt6.QtCore.QPointF",
"PyQt6.QtGui.QColor",
"PyQt6.QtSvgWidgets.QGraphicsSvgItem",
"PyQt6.QtWidgets.QGraphicsScene",
"PyQt6.QtCore.QSize",
"PyQt6.QtCore.QSequentialAnimationGroup",
"PyQt6.QtWidgets.QGraphicsColorizeEffect",
"functools.partial",
"PyQt6.QtGui.QTransform",
"PyQt6.QtCore.pyqtSignal"... | [((542, 554), 'PyQt6.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (552, 554), False, 'from PyQt6.QtCore import QPointF, QSequentialAnimationGroup, QSize, Qt, pyqtSignal\n'), ((658, 671), 'PyQt6.QtCore.QSize', 'QSize', (['(45)', '(45)'], {}), '(45, 45)\n', (663, 671), False, 'from PyQt6.QtCore import QPointF, QSe... |
# LAB 01 - ex 1
import queue_system as QS
import input_controls as ic
import random
def decor(msg):
print('*** ' + msg + ' ***')
SIM_TIME = 100
BATCHES = 24
SEED = 11
# Per rendere l'esperimento ripetibile
random.seed(SEED)
# PRIMA CODA: Q1
FOUT_1 = 'res01.txt'
decor('Init the first queue (M/M/1)')
q1 = QS.Qu... | [
"input_controls.input_int",
"queue_system.QueueSystem",
"random.seed"
] | [((215, 232), 'random.seed', 'random.seed', (['SEED'], {}), '(SEED)\n', (226, 232), False, 'import random\n'), ((315, 346), 'queue_system.QueueSystem', 'QS.QueueSystem', ([], {'log_file': 'FOUT_1'}), '(log_file=FOUT_1)\n', (329, 346), True, 'import queue_system as QS\n'), ((613, 630), 'random.seed', 'random.seed', (['S... |
import os
from typing import List, Optional
def get_files(
source: str = '.',
startswith: str = '',
endswith: str = '',
isfullpath: bool = False) -> List[str]:
"""
Get all files that start with or end with some strings in the source folder
Args:
starts... | [
"os.path.dirname",
"os.path.join",
"os.path.basename",
"os.walk"
] | [((690, 705), 'os.walk', 'os.walk', (['source'], {}), '(source)\n', (697, 705), False, 'import os\n'), ((2015, 2038), 'os.path.basename', 'os.path.basename', (['fpath'], {}), '(fpath)\n', (2031, 2038), False, 'import os\n'), ((2184, 2206), 'os.path.dirname', 'os.path.dirname', (['fpath'], {}), '(fpath)\n', (2199, 2206)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
from scipy.stats import multivariate_normal, norm
import numpy as np
#### Generalized Black Scholes Formula
def GBlackScholes(CallPutFlag, S, X, T, r, b, v):
d_1 = (np.log(S/X) + (b + v**2/2) * T) / (v * T**(1/2))
d_2 = d_1 - v * T**(1/2)... | [
"scipy.stats.norm.cdf",
"numpy.log"
] | [((243, 256), 'numpy.log', 'np.log', (['(S / X)'], {}), '(S / X)\n', (249, 256), True, 'import numpy as np\n'), ((853, 864), 'scipy.stats.norm.cdf', 'norm.cdf', (['d'], {}), '(d)\n', (861, 864), False, 'from scipy.stats import multivariate_normal, norm\n'), ((385, 398), 'scipy.stats.norm.cdf', 'norm.cdf', (['d_1'], {})... |
from __future__ import absolute_import
import sublime, sublime_plugin
import re, string, os, sys, functools, mmap, pprint, imp, threading
from collections import Counter
from plistlib import readPlistFromBytes
try:
from . import vhdl_module
from .util import vhdl_util
from .util import sublime_util
fr... | [
"re.compile",
"rgba.RGBA",
"sublime.Region",
"sublime_util.expand_to_scope",
"re.search",
"sublime.active_window",
"sublime_util.move_cursor",
"sublime_util.find_closest",
"re.finditer",
"vhdl_util.get_inst_list_from_file",
"imp.reload",
"re.match",
"sublime.run_command",
"os.path.dirname"... | [((841, 862), 'imp.reload', 'imp.reload', (['vhdl_util'], {}), '(vhdl_util)\n', (851, 862), False, 'import re, string, os, sys, functools, mmap, pprint, imp, threading\n'), ((867, 891), 'imp.reload', 'imp.reload', (['sublime_util'], {}), '(sublime_util)\n', (877, 891), False, 'import re, string, os, sys, functools, mma... |
import re
import ast
from uni_parser.reserved_names import ReservedNames
class XPLANSyntaxError(Exception):
pass
class StmtError(Exception):
pass
class ExprError(Exception):
pass
class CodeBuilder:
"""
basic code tools
"""
INDENT_STEP = 4
def __init__(self, indent: int = 0):
... | [
"re.split",
"re.match",
"ast.literal_eval",
"re.sub",
"re.search"
] | [((5636, 5675), 're.split', 're.split', (['re_string', 'self.template_text'], {}), '(re_string, self.template_text)\n', (5644, 5675), False, 'import re\n'), ((7217, 7245), 're.search', 're.search', (['re_keyword', 'value'], {}), '(re_keyword, value)\n', (7226, 7245), False, 'import re\n'), ((7920, 7977), 're.search', '... |
from abc import ABC, abstractmethod
from contextlib import contextmanager
from shlex import shlex
from typing import Any, Callable, Dict, Generic, Iterable, Iterator, List, Optional, TypeVar, Union
_T = TypeVar('_T')
"""
What kind of user inputs are there?
344 - simple int
- 10_000_00 - not so simple int
22.3 - simp... | [
"shlex.shlex",
"typing.TypeVar"
] | [((204, 217), 'typing.TypeVar', 'TypeVar', (['"""_T"""'], {}), "('_T')\n", (211, 217), False, 'from typing import Any, Callable, Dict, Generic, Iterable, Iterator, List, Optional, TypeVar, Union\n'), ((2365, 2393), 'shlex.shlex', 'shlex', (['user_args'], {'posix': '(True)'}), '(user_args, posix=True)\n', (2370, 2393), ... |
import tensorflow as tf
import os
import numpy as np
import pandas as pd
from skimage import io
from skimage.transform import resize
from skimage.filters import gaussian
# from deepflash import unet, preproc, utils
from df_resources import unet, preproc, utils, pixelshift37
from skimage.measure import label, regionpr... | [
"numpy.iinfo",
"skimage.measure.approximate_polygon",
"df_resources.unet.Unet2D",
"numpy.array",
"shapely.geometry.Polygon",
"numpy.moveaxis",
"os.path.exists",
"numpy.asarray",
"numpy.empty",
"pandas.DataFrame",
"numpy.dtype",
"skimage.measure.regionprops",
"skimage.io.imread",
"df_resour... | [((1104, 1153), 'df_resources.pixelshift37.PixelShifter', 'pixelshift37.PixelShifter', ([], {'jsonfilepath': 'json_file'}), '(jsonfilepath=json_file)\n', (1129, 1153), False, 'from df_resources import unet, preproc, utils, pixelshift37\n'), ((1725, 1748), 'numpy.dstack', 'np.dstack', (['shifted_list'], {}), '(shifted_l... |
# Generated by Django 2.0.6 on 2018-08-18 23:56
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | [
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((386, 479), '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", (402, 479), False, 'from django.db import migrations, models\... |
from random import shuffle
class Card:
"""
A card in the play.
Suit is element of ['Hearts','Diamonds','Clubs','Spades'].
Value is element of ['A','2','3','4','5','6','7','8','9','10','J','Q','K'].
"""
def __init__(self, suit, value):
self.suit = suit
self.value = value
def... | [
"random.shuffle"
] | [((855, 874), 'random.shuffle', 'shuffle', (['self.cards'], {}), '(self.cards)\n', (862, 874), False, 'from random import shuffle\n')] |
import pygame, os
import game_module as gm
import random
os.environ['SDL_VIDEO_CENTERED'] = '1' # centrowanie okna
pygame.init()
## ustawienia ekranu i gry
screen = pygame.display.set_mode(gm.SIZESCREEN)
pygame.display.set_caption('Prosta gra platformowa...')
clock = pygame.time.Clock()
# klasa gracza
cl... | [
"pygame.display.set_caption",
"pygame.quit",
"pygame.init",
"pygame.event.get",
"pygame.sprite.spritecollide",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.sprite.Group",
"pygame.Surface",
"pygame.time.Clock",
"random.randint"
] | [((126, 139), 'pygame.init', 'pygame.init', ([], {}), '()\n', (137, 139), False, 'import pygame, os\n'), ((178, 216), 'pygame.display.set_mode', 'pygame.display.set_mode', (['gm.SIZESCREEN'], {}), '(gm.SIZESCREEN)\n', (201, 216), False, 'import pygame, os\n'), ((217, 272), 'pygame.display.set_caption', 'pygame.display.... |
"""
Copyright (C) Cortic Technology Corp. - All Rights Reserved
Written by <NAME> <<EMAIL>>, 2021
"""
import cv2
import numpy as np
FINGER_COLOR = [
(128, 128, 128),
(80, 190, 168),
(234, 187, 105),
(175, 119, 212),
(81, 110, 221),
]
JOINT_COLOR = [(0, 0, 0), (125, 255, 79), (255, 102, 0), (181,... | [
"cv2.rectangle",
"cv2.polylines",
"cv2.line",
"numpy.array",
"cv2.circle"
] | [((3574, 3695), 'cv2.rectangle', 'cv2.rectangle', (['frame', '(40, screen_height - 40)', '(60, screen_height - 40 - screen_height // 3)', '(255, 255, 255)', '(1)', '(1)'], {}), '(frame, (40, screen_height - 40), (60, screen_height - 40 - \n screen_height // 3), (255, 255, 255), 1, 1)\n', (3587, 3695), False, 'import... |
"""
Implementation of Total Variation Loss
(https://en.wikipedia.org/wiki/Total_variation_denoising) copied and slightly
modified from the original Apache License 2.0 traiNNer
Authors https://github.com/victorca25/traiNNer/tree/master
# Copyright 2021 traiNNer Authors
#
# Licensed under the Apache License, Version 2.... | [
"torch.nn.functional.pad",
"torch.pow"
] | [((2671, 2697), 'torch.nn.functional.pad', 'F.pad', (['image', '(0, 1, 0, 0)'], {}), '(image, (0, 1, 0, 0))\n', (2676, 2697), True, 'from torch.nn import functional as F\n'), ((2723, 2749), 'torch.nn.functional.pad', 'F.pad', (['image', '(0, 0, 0, 1)'], {}), '(image, (0, 0, 0, 1))\n', (2728, 2749), True, 'from torch.nn... |
import os
from .tools import mode
from .ds_base import DataSourceBase
from psana.psexp.run import RunParallel
class InvalidEventBuilderCores(Exception): pass
if mode == 'mpi':
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
class MPIDataSource(DataSourceBase... | [
"os.environ.get",
"psana.psexp.run.RunParallel"
] | [((584, 617), 'os.environ.get', 'os.environ.get', (['"""PS_SMD_NODES"""', '(1)'], {}), "('PS_SMD_NODES', 1)\n", (598, 617), False, 'import os\n'), ((1280, 1456), 'psana.psexp.run.RunParallel', 'RunParallel', (['self.exp', 'run_no', 'self.run_dict[run_no]'], {'max_events': 'self.max_events', 'batch_size': 'self.batch_si... |
import os
import shutil
import pandas as pd
import json
MOT_label = ["Pedestrian", "Person on vehicle", "Car", "Bicycle", "Motorbike", "Non-motorized vehicle", "static person", "distractor",
"occluder", "occluder on the ground", "occluder full", "reflection"]
def get_imgheader(folder):
imgname = os.l... | [
"os.path.splitext",
"os.listdir",
"os.path.join",
"pandas.read_csv"
] | [((668, 704), 'os.path.join', 'os.path.join', (['folder', '"""gt"""', '"""gt.txt"""'], {}), "(folder, 'gt', 'gt.txt')\n", (680, 704), False, 'import os\n'), ((714, 818), 'pandas.read_csv', 'pd.read_csv', (['gt_path'], {'names': "['frame', 'id', 'xmin', 'ymin', 'w', 'h', 'conf', 'class', 'visibility']"}), "(gt_path, nam... |
# Generated by Django 2.0.3 on 2018-03-24 22:28
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='AnimalKind',
fields=[
... | [
"django.db.models.DateTimeField",
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((339, 432), '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", (355, 432), False, 'from django.db import migrations, models\... |
from sklearn.model_selection import train_test_split
from utils import *
from cnn_classifier import *
CHANNELS = 1
def main():
args = classification_parseargs()
# read files and store the data
trainset, _, x_dim, y_dim = dataset_reader(args.d)
trainlabels = labels_reader(args.dl)
testset, t... | [
"sklearn.model_selection.train_test_split"
] | [((786, 840), 'sklearn.model_selection.train_test_split', 'train_test_split', (['trainset', 'trainlabels'], {'test_size': '(0.1)'}), '(trainset, trainlabels, test_size=0.1)\n', (802, 840), False, 'from sklearn.model_selection import train_test_split\n')] |
# -*- coding: utf-8 -*-
import turret
def build_network(network_generator):
builder = turret.InferenceEngineBuilder(
turret.loggers.ConsoleLogger(turret.Severity.INFO))
network = builder.create_network()
network_generator(network)
return network
def execute_inference(inputs, network_generator,... | [
"turret.loggers.ConsoleLogger",
"turret.ExecutionContext"
] | [((130, 180), 'turret.loggers.ConsoleLogger', 'turret.loggers.ConsoleLogger', (['turret.Severity.INFO'], {}), '(turret.Severity.INFO)\n', (158, 180), False, 'import turret\n'), ((395, 445), 'turret.loggers.ConsoleLogger', 'turret.loggers.ConsoleLogger', (['turret.Severity.INFO'], {}), '(turret.Severity.INFO)\n', (423, ... |
from django.shortcuts import render,redirect
from django.contrib.auth.models import User
from eczema_profile.utils import poem_calc_db,find_cor
from collections import Counter
import json
def find_count_trigger_items(triggers):
count = []
for trigger in triggers:
for food in trigger.food.all():
... | [
"django.shortcuts.render",
"json.dumps",
"eczema_profile.utils.find_cor",
"collections.Counter",
"django.shortcuts.redirect",
"eczema_profile.utils.poem_calc_db"
] | [((809, 823), 'collections.Counter', 'Counter', (['count'], {}), '(count)\n', (816, 823), False, 'from collections import Counter\n'), ((1895, 1957), 'eczema_profile.utils.find_cor', 'find_cor', (['temp', 'hum', 'p', 'poem_score_sum', 'temp_sum', 'humidity_sum'], {}), '(temp, hum, p, poem_score_sum, temp_sum, humidity_... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set",
"pulumi.InvokeOptions",
"pulumi.runtime.invoke"
] | [((2081, 2121), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""recoveryFabricName"""'}), "(name='recoveryFabricName')\n", (2094, 2121), False, 'import pulumi\n'), ((2241, 2280), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""recoveryVaultName"""'}), "(name='recoveryVaultName')\n", (2254, 2280), False, 'import... |
import time,calendar,os,json,sys,datetime
from requests import get
from subprocess import Popen,PIPE
from math import sqrt,log,exp
from scipy.optimize import minimize
import numpy as np
np.set_printoptions(precision=3,linewidth=120)
def datetoday(x):
t=time.strptime(x+'UTC','%Y-%m-%d%Z')
return calendar.timegm(t)/... | [
"time.strptime",
"os.makedirs",
"datetime.datetime.utcnow",
"subprocess.Popen",
"time.strftime",
"os.path.join",
"numpy.log",
"requests.get",
"math.log",
"os.path.isfile",
"numpy.exp",
"calendar.timegm",
"numpy.zeros",
"math.sqrt",
"sys.exit",
"time.gmtime",
"json.dump",
"numpy.set... | [((186, 233), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(3)', 'linewidth': '(120)'}), '(precision=3, linewidth=120)\n', (205, 233), True, 'import numpy as np\n'), ((2252, 2287), 'os.path.join', 'os.path.join', (['"""apidata"""', 'updatedate'], {}), "('apidata', updatedate)\n", (2264, 2287), F... |
#!/usr/bin/env python
import argparse
import random
import numpy as np
import numpy.linalg as nplg
if __name__ == "__main__":
# FLAGS
# --------------------------------------------------------------------------
parser = argparse.ArgumentParser(
description='Picks imagemagick modulation within ran... | [
"random.randint",
"argparse.ArgumentParser",
"numpy.linalg.norm"
] | [((235, 421), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': "('Picks imagemagick modulation within range that is reasonably ' +\n 'far from the modulations already done -- to ensure variety of materials.')"}), "(description=\n 'Picks imagemagick modulation within range that is reasona... |
from skued import nfft, nfftfreq
import unittest
import numpy as np
np.random.seed(23)
class Testnfftfreq(unittest.TestCase):
def test_shape_even(self):
""" Test that the nfftfreq function returns expected shape """
freqs = nfftfreq(16)
self.assertTupleEqual(freqs.shape, (16,))
def ... | [
"numpy.sin",
"numpy.fft.fftfreq",
"numpy.fft.fft",
"numpy.linspace",
"numpy.random.seed",
"unittest.main",
"skued.nfftfreq"
] | [((70, 88), 'numpy.random.seed', 'np.random.seed', (['(23)'], {}), '(23)\n', (84, 88), True, 'import numpy as np\n'), ((879, 894), 'unittest.main', 'unittest.main', ([], {}), '()\n', (892, 894), False, 'import unittest\n'), ((248, 260), 'skued.nfftfreq', 'nfftfreq', (['(16)'], {}), '(16)\n', (256, 260), False, 'from sk... |
"""Tests for views."""
from pyramid import testing
import unittest
import webtest
class TestViews(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
self.config.include('cornice')
self.config.scan('myapp.views')
self.app = webtest.TestApp(self.config.make_wsgi_a... | [
"pyramid.testing.setUp",
"pyramid.testing.tearDown"
] | [((166, 181), 'pyramid.testing.setUp', 'testing.setUp', ([], {}), '()\n', (179, 181), False, 'from pyramid import testing\n'), ((359, 377), 'pyramid.testing.tearDown', 'testing.tearDown', ([], {}), '()\n', (375, 377), False, 'from pyramid import testing\n')] |
import datetime
import time
#
# Simple utility for printing the last 5 arguments for ubv2h264,
# which represent the date and the time range to extract.
#
# Edit the last line of this file to change the date/time
#
def print_args(year, month, day, hour, minute, minutes):
d = datetime.datetime(year, month, day, ho... | [
"datetime.datetime",
"datetime.timedelta"
] | [((282, 331), 'datetime.datetime', 'datetime.datetime', (['year', 'month', 'day', 'hour', 'minute'], {}), '(year, month, day, hour, minute)\n', (299, 331), False, 'import datetime\n'), ((345, 380), 'datetime.timedelta', 'datetime.timedelta', ([], {'minutes': 'minutes'}), '(minutes=minutes)\n', (363, 380), False, 'impor... |
from pathlib import Path
from ament_index_python.packages import get_package_share_directory
import launch
from launch.substitutions import TextSubstitution
import launch_ros.actions
def generate_launch_description():
# Get the object spawner node which creates the sensors we want.
object_spawn_path = Path(g... | [
"launch.substitutions.LaunchConfiguration",
"launch.actions.Shutdown",
"launch.substitutions.TextSubstitution",
"ament_index_python.packages.get_package_share_directory",
"launch.actions.DeclareLaunchArgument"
] | [((319, 369), 'ament_index_python.packages.get_package_share_directory', 'get_package_share_directory', (['"""carla_spawn_objects"""'], {}), "('carla_spawn_objects')\n", (346, 369), False, 'from ament_index_python.packages import get_package_share_directory\n'), ((982, 1100), 'launch.actions.DeclareLaunchArgument', 'la... |
# pylint: disable=unused-import
import argparse
from all.bodies import TimeFeature
from all.environments import GymEnvironment, PybulletEnvironment
from all.experiments import load_and_watch
from .continuous import ENVS
def main():
parser = argparse.ArgumentParser(description="Watch a continuous agent.")
pars... | [
"all.environments.PybulletEnvironment",
"all.environments.GymEnvironment",
"argparse.ArgumentParser",
"all.experiments.load_and_watch"
] | [((247, 311), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Watch a continuous agent."""'}), "(description='Watch a continuous agent.')\n", (270, 311), False, 'import argparse\n'), ((1043, 1091), 'all.experiments.load_and_watch', 'load_and_watch', (['args.filename', 'env'], {'fps': 'arg... |
import torch
from torch.nn import Module, ModuleDict
class EncoderDict(ModuleDict):
@property
def out_features(self):
return sum((encoder.out_features for encoder in self.values()))
class DecoderDict(ModuleDict):
pass
class ECD(Module):
def __init__(self, encoders, combiner, decoders):
... | [
"torch.cat"
] | [((588, 615), 'torch.cat', 'torch.cat', (['encodings'], {'dim': '(1)'}), '(encodings, dim=1)\n', (597, 615), False, 'import torch\n')] |
# -*- coding: utf-8 -*-
"""
search component module.
"""
from pyrin.application.decorators import component
from pyrin.application.structs import Component
from charma.search import SearchPackage
from charma.search.manager import SearchManager
@component(SearchPackage.COMPONENT_NAME)
class SearchComponent(Component... | [
"pyrin.application.decorators.component"
] | [((249, 288), 'pyrin.application.decorators.component', 'component', (['SearchPackage.COMPONENT_NAME'], {}), '(SearchPackage.COMPONENT_NAME)\n', (258, 288), False, 'from pyrin.application.decorators import component\n')] |
from flask import render_template, redirect, request, url_for, session, g, jsonify
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import or_
from flask_login import LoginManager, login_required, login_user, \
logout_user, current_user, UserMixin
from requests_oauthlib import OAuth2Session
from requests.exc... | [
"flask.render_template",
"flask.request.args.get",
"app.db.session.commit",
"app.models.im_data.query.order_by",
"app.db.session.add",
"flask.jsonify",
"json.dumps",
"app.models.im_data.query.filter_by",
"app.app.route",
"sqlalchemy.or_",
"app.models.im_data.url.like",
"app.db.session.delete",... | [((479, 499), 'app.app.route', 'app.route', (['"""/status"""'], {}), "('/status')\n", (488, 499), False, 'from app import app, db, models, login_manager\n'), ((965, 984), 'app.app.route', 'app.route', (['"""/login"""'], {}), "('/login')\n", (974, 984), False, 'from app import app, db, models, login_manager\n'), ((1301,... |
# -*- coding: utf-8 -*-
from kivy.animation import Animation
from kivy.clock import Clock
from kivy.core.window import Window
from kivy.metrics import dp
from kivy.properties import OptionProperty, NumericProperty, StringProperty, \
BooleanProperty
from kivy.uix.relativelayout import RelativeLayout
class SlidingPane... | [
"kivy.animation.Animation.stop_all",
"kivy.properties.NumericProperty",
"kivy.animation.Animation",
"kivy.core.window.Window.add_widget",
"kivy.metrics.dp",
"kivy.properties.OptionProperty",
"kivy.clock.Clock.schedule_once",
"kivy.properties.BooleanProperty",
"kivy.properties.StringProperty"
] | [((347, 396), 'kivy.properties.OptionProperty', 'OptionProperty', (['"""left"""'], {'options': "['left', 'right']"}), "('left', options=['left', 'right'])\n", (361, 396), False, 'from kivy.properties import OptionProperty, NumericProperty, StringProperty, BooleanProperty\n'), ((422, 442), 'kivy.properties.NumericProper... |
from django.core.urlresolvers import reverse
from django.shortcuts import render
from django.views.generic import DetailView, ListView
from .models import *
def index(request):
try:
apps = App.objects.all().order_by('id')
types = AppType.objects.all().order_by('id')
formats = AppFormat.obj... | [
"django.shortcuts.render",
"django.core.urlresolvers.reverse"
] | [((615, 772), 'django.shortcuts.render', 'render', (['request', '"""pln/index.html"""', "{'apps': apps, 'types': types, 'functions': functions, 'formats': formats,\n 'prices': prices, 'supports': supports}"], {}), "(request, 'pln/index.html', {'apps': apps, 'types': types,\n 'functions': functions, 'formats': for... |
import sys
import logging
import argparse
from conda_docker.conda import (
build_docker_environment,
find_user_conda,
conda_info,
find_precs,
fetch_precs,
)
from conda_docker.logging import init_logging
def cli(args):
parser = argparse.ArgumentParser(description="Docker Environments")
sub... | [
"conda_docker.conda.find_precs",
"argparse.ArgumentParser",
"conda_docker.conda.find_user_conda",
"conda_docker.logging.init_logging",
"logging.shutdown",
"conda_docker.conda.conda_info",
"conda_docker.conda.fetch_precs",
"sys.exit",
"conda_docker.conda.build_docker_environment"
] | [((254, 312), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Docker Environments"""'}), "(description='Docker Environments')\n", (277, 312), False, 'import argparse\n'), ((504, 518), 'conda_docker.logging.init_logging', 'init_logging', ([], {}), '()\n', (516, 518), False, 'from conda_doc... |
from orm import Model, String, Integer, DateTime, Float
from objects.globals import db, metadata
class User(Model):
__tablename__ = "users"
__database__ = db
__metadata__ = metadata
id = Integer(primary_key=True)
user_id = Integer()
username = String(max_length=100)
created = DateTime()
... | [
"orm.Float",
"orm.String",
"orm.DateTime",
"orm.Integer"
] | [((206, 231), 'orm.Integer', 'Integer', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (213, 231), False, 'from orm import Model, String, Integer, DateTime, Float\n'), ((247, 256), 'orm.Integer', 'Integer', ([], {}), '()\n', (254, 256), False, 'from orm import Model, String, Integer, DateTime, Float\n'), ((27... |
#!/usr/bin/python
import vtk
import sys
import math
# Create the RenderWindow, Renderer and both Actors
renderer = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
renderWindow.AddRenderer(renderer)
interactor = vtk.vtkRenderWindowInteractor()
interactor.SetRenderWindow(renderWindow)
renderer.SetBackground(0... | [
"vtk.vtkOrientedGlyphContourRepresentation",
"vtk.vtkContourWidget",
"vtk.vtkRenderWindowInteractor",
"vtk.vtkRenderWindow",
"vtk.vtkPolyData",
"vtk.vtkPoints",
"vtk.vtkCellArray",
"math.cos",
"vtk.vtkRenderer",
"math.sin"
] | [((118, 135), 'vtk.vtkRenderer', 'vtk.vtkRenderer', ([], {}), '()\n', (133, 135), False, 'import vtk\n'), ((151, 172), 'vtk.vtkRenderWindow', 'vtk.vtkRenderWindow', ([], {}), '()\n', (170, 172), False, 'import vtk\n'), ((222, 253), 'vtk.vtkRenderWindowInteractor', 'vtk.vtkRenderWindowInteractor', ([], {}), '()\n', (251... |
"""
Module: LMR_verify_gridRNL.py
Purpose: Generates spatial verification statistics of various LMR gridded fields
against 20th century reanalyses.
Originator: <NAME>, U. of Washington, March 2016
Revisions:
"""
import matplotlib
# need to do this backend when running remotely or to suppress figures in... | [
"spharm.Spharmt",
"matplotlib.pyplot.ylabel",
"numpy.array",
"numpy.nanmean",
"matplotlib.ticker.MaxNLocator",
"numpy.isfinite",
"matplotlib.ticker.AutoLocator",
"sys.path.append",
"numpy.arange",
"numpy.mean",
"os.path.exists",
"numpy.reshape",
"numpy.where",
"matplotlib.pyplot.xlabel",
... | [((332, 353), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (346, 353), False, 'import matplotlib\n'), ((667, 689), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (682, 689), False, 'import glob, os, sys\n'), ((948, 981), 'warnings.filterwarnings', 'warnings.filterwarnin... |
import fileinput
import io
from html import escape
from html.entities import name2codepoint
from html.parser import HTMLParser
class MyHTMLParser(HTMLParser):
script = False
in_a_g = False
record_next_y = False
g_buffer = None
y_limit = None
g_current_y = None
g_dict = dict()
def _pri... | [
"io.StringIO",
"html.escape",
"fileinput.input"
] | [((2262, 2279), 'fileinput.input', 'fileinput.input', ([], {}), '()\n', (2277, 2279), False, 'import fileinput\n'), ((1572, 1584), 'html.escape', 'escape', (['data'], {}), '(data)\n', (1578, 1584), False, 'from html import escape\n'), ((1023, 1036), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (1034, 1036), False, '... |
import altair as alt
import pandas as pd
penguins_df = pd.read_csv('data/penguins.csv')
mass_density_plot = alt.Chart(___).transform_density(
___,
groupby=___,
___=['body_mass_g', 'density'],
___=100
).mark_area(___).encode(
alt.X(___),
___,
alt.Color(___)).properties(___)... | [
"altair.Chart",
"altair.X",
"altair.Color",
"pandas.read_csv"
] | [((57, 89), 'pandas.read_csv', 'pd.read_csv', (['"""data/penguins.csv"""'], {}), "('data/penguins.csv')\n", (68, 89), True, 'import pandas as pd\n'), ((256, 266), 'altair.X', 'alt.X', (['___'], {}), '(___)\n', (261, 266), True, 'import altair as alt\n'), ((289, 303), 'altair.Color', 'alt.Color', (['___'], {}), '(___)\n... |
import sys
sys.path.insert(0, "../")
import numpy as np
import cv2
import argparse
import torch
from torchvision.transforms import functional as F
from mmcls.apis import init_model
import os
from tqdm import tqdm
class MmClassifier(object):
def __init__(self, cls_c, cls_w, device):
self.model_w = cls_w
... | [
"sys.path.insert",
"onnx.save",
"cv2.imshow",
"numpy.array",
"onnx.load",
"os.listdir",
"argparse.ArgumentParser",
"cv2.multiply",
"numpy.max",
"cv2.waitKey",
"torch.onnx.export",
"numpy.ones",
"onnxsim.simplify",
"os.path.splitext",
"numpy.argmax",
"torch.save",
"cv2.cvtColor",
"m... | [((11, 36), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../"""'], {}), "(0, '../')\n", (26, 36), False, 'import sys\n'), ((5345, 5370), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (5368, 5370), False, 'import argparse\n'), ((5951, 5971), 'cv2.imread', 'cv2.imread', (['img_path'], {}),... |
# 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, ... | [
"time.sleep",
"requests.get",
"lib.error_logger.ErrorLogger",
"functools.partial",
"lib.concurrent.thread_map"
] | [((1160, 1173), 'lib.error_logger.ErrorLogger', 'ErrorLogger', ([], {}), '()\n', (1171, 1173), False, 'from lib.error_logger import ErrorLogger\n'), ((2343, 2356), 'lib.error_logger.ErrorLogger', 'ErrorLogger', ([], {}), '()\n', (2354, 2356), False, 'from lib.error_logger import ErrorLogger\n'), ((3056, 3126), 'functoo... |
import subprocess
from PIL import Image
signs = ['aries', 'taurus', 'gemini', 'cancer', 'leo', 'virgo', 'libra', 'scorpio', 'sagittarius', 'capricorn', 'aquarius', 'pisces']
for i, sign in enumerate(signs):
fname = str(i + 1) + sign
im = Image.open(fname + '.png')
im = im.resize((64, 64))
im = im... | [
"PIL.Image.open"
] | [((249, 275), 'PIL.Image.open', 'Image.open', (["(fname + '.png')"], {}), "(fname + '.png')\n", (259, 275), False, 'from PIL import Image\n')] |
import os
import numpy as np
import pytest
from .. import snapshot
from .. import utils
_test_dir = os.path.dirname(__file__)
_data_dir = os.path.join(_test_dir, "testing_data")
def test_load_particle_data():
pd = snapshot.ParticleData(_data_dir+"/snapshot_002.hdf5")
assert pd.n_parts == 64**3
assert pd... | [
"numpy.isclose",
"numpy.delete",
"os.path.join",
"os.path.dirname",
"numpy.array",
"pytest.raises",
"numpy.linalg.norm"
] | [((102, 127), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (117, 127), False, 'import os\n'), ((140, 179), 'os.path.join', 'os.path.join', (['_test_dir', '"""testing_data"""'], {}), "(_test_dir, 'testing_data')\n", (152, 179), False, 'import os\n'), ((1011, 1042), 'numpy.delete', 'np.delete... |
from http import cookiejar
from urllib import request, error
from urllib.parse import urlparse
class HtmlDownLoader(object):
def download(self, url, retry_count=3, headers=None, proxy=None, data=None):
if url is None:
return None
try:
req = request.Request(url, headers=head... | [
"urllib.request.HTTPCookieProcessor",
"urllib.parse.urlparse",
"http.cookiejar.CookieJar",
"urllib.request.Request",
"urllib.request.ProxyHandler",
"urllib.request.build_opener"
] | [((287, 335), 'urllib.request.Request', 'request.Request', (['url'], {'headers': 'headers', 'data': 'data'}), '(url, headers=headers, data=data)\n', (302, 335), False, 'from urllib import request, error\n'), ((357, 378), 'http.cookiejar.CookieJar', 'cookiejar.CookieJar', ([], {}), '()\n', (376, 378), False, 'from http ... |
"""Automation manager for boards manufactured by ProgettiHWSW Italy."""
from ProgettiHWSW.ProgettiHWSWAPI import ProgettiHWSWAPI
from ProgettiHWSW.input import Input
from ProgettiHWSW.relay import Relay
from openpeerpower.config_entries import ConfigEntry
from openpeerpower.core import OpenPeerPower
from .const impo... | [
"ProgettiHWSW.ProgettiHWSWAPI.ProgettiHWSWAPI"
] | [((579, 640), 'ProgettiHWSW.ProgettiHWSWAPI.ProgettiHWSWAPI', 'ProgettiHWSWAPI', (['f"""{entry.data[\'host\']}:{entry.data[\'port\']}"""'], {}), '(f"{entry.data[\'host\']}:{entry.data[\'port\']}")\n', (594, 640), False, 'from ProgettiHWSW.ProgettiHWSWAPI import ProgettiHWSWAPI\n')] |
from pyspark.sql.functions import *
from spark_helpers.spark_helpers import create_df
from pyspark.sql.types import StructType, IntegerType, StructField
def test_create_spark_dataframe():
"""
Purpose of the test: verify that we can create a spark dataframe.
Implicitly, it tests the availability of a Spark... | [
"pyspark.sql.types.IntegerType"
] | [((450, 463), 'pyspark.sql.types.IntegerType', 'IntegerType', ([], {}), '()\n', (461, 463), False, 'from pyspark.sql.types import StructType, IntegerType, StructField\n')] |
'''
Module for the Instance class.
'''
from random import randint
from os import stat, makedirs
from os.path import exists
from itertools import tee
from item import Item
from file_handling import getFilePath, generateFileName
class Knapsack:
'''
Data of a basic Knapsack problem: number of items, knapsack's ... | [
"os.path.exists",
"os.makedirs",
"file_handling.getFilePath",
"itertools.tee",
"os.stat",
"random.randint",
"file_handling.generateFileName"
] | [((1927, 1949), 'file_handling.getFilePath', 'getFilePath', (['file_name'], {}), '(file_name)\n', (1938, 1949), False, 'from file_handling import getFilePath, generateFileName\n'), ((4602, 4617), 'itertools.tee', 'tee', (['self.items'], {}), '(self.items)\n', (4605, 4617), False, 'from itertools import tee\n'), ((3653,... |
import json
import os
import time
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
import jax
import jax.numpy as jnp
import optax
from flax import jax_utils
from flax.serialization import from_bytes, to_bytes
from flax.training.common_utils import get_metrics... | [
"git_t5.core.AutoScheduler.from_config",
"jax.random.PRNGKey",
"flax.serialization.to_bytes",
"jax.device_count",
"tqdm.tqdm",
"os.path.join",
"jax.tree_map",
"flax.jax_utils.unreplicate",
"flax.jax_utils.replicate",
"json.load",
"flax.training.train_state.TrainState",
"flax.training.common_ut... | [((1687, 1732), 'jax.random.PRNGKey', 'jax.random.PRNGKey', (['self.config.training.seed'], {}), '(self.config.training.seed)\n', (1705, 1732), False, 'import jax\n'), ((1848, 1859), 'time.time', 'time.time', ([], {}), '()\n', (1857, 1859), False, 'import time\n'), ((4060, 4125), 'tqdm.tqdm', 'tqdm', (['valid_dataloade... |
#
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The iosxr static_routes fact class
It is in this file the configuration is collected from the device
for a given resource, parsed, and the facts tree is populated
based o... | [
"ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils.validate_config",
"re.compile",
"ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils.generate_dict",
"ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils.remove_empties",
... | [((977, 1005), 'copy.deepcopy', 'deepcopy', (['self.argument_spec'], {}), '(self.argument_spec)\n', (985, 1005), False, 'from copy import deepcopy\n'), ((1265, 1305), 'ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils.generate_dict', 'utils.generate_dict', (['facts_argument_spec'], {}), '(... |
try:
from typing import Optional, List, Dict, Tuple
except ImportError:
pass
import re
import os
from collections import OrderedDict
from function import Function
from glob import glob
OBJECT_PREFIX = 'o'
NAMESPACE_PREFIX = 'n'
list_pattern = r'\[(.*?)(?:,(?: ?...)?)?\]'
type_pattern = r'(?P<type>... | [
"os.path.exists",
"collections.OrderedDict",
"re.compile",
"os.path.join",
"os.path.dirname",
"re.finditer",
"os.path.basename",
"os.mkdir",
"re.sub",
"glob.glob"
] | [((358, 456), 're.compile', 're.compile', (['"""-\\\\s<b>(?P<sig>.*?)<\\\\/b><br>\\\\r?\\\\n(?P<desc>.*?)\\\\r?\\\\n\\\\r?\\\\n"""'], {'flags': 're.DOTALL'}), "('-\\\\s<b>(?P<sig>.*?)<\\\\/b><br>\\\\r?\\\\n(?P<desc>.*?)\\\\r?\\\\n\\\\r?\\\\n',\n flags=re.DOTALL)\n", (368, 456), False, 'import re\n'), ((528, 565), 'r... |
"""The NZBGet integration."""
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import (
CONF_HOST,
CONF_NAME,
CONF_PASSWORD,
CONF_PORT,
CONF_SCAN_INTERVAL,
CONF_SSL,
CONF_USERNAME,
Platform,
)
from homeassistant.core i... | [
"homeassistant.helpers.config_validation.deprecated",
"voluptuous.Optional",
"voluptuous.Required",
"voluptuous.Schema"
] | [((957, 978), 'homeassistant.helpers.config_validation.deprecated', 'cv.deprecated', (['DOMAIN'], {}), '(DOMAIN)\n', (970, 978), True, 'from homeassistant.helpers import config_validation as cv\n'), ((1712, 1765), 'voluptuous.Optional', 'vol.Optional', (['ATTR_SPEED'], {'default': 'DEFAULT_SPEED_LIMIT'}), '(ATTR_SPEED,... |
import datetime
from unittest import mock, skipIf, skipUnless
from django.core.exceptions import FieldError
from django.db import NotSupportedError, connection
from django.db.models import (
F, OuterRef, RowRange, Subquery, Value, ValueRange, Window, WindowFrame,
)
from django.db.models.aggregates import Avg, Max,... | [
"django.db.models.RowRange",
"unittest.skipIf",
"django.db.models.functions.Lag",
"django.db.models.aggregates.Sum",
"datetime.datetime",
"django.test.skipUnlessDBFeature",
"django.db.models.functions.FirstValue",
"django.db.models.F",
"django.db.models.OuterRef",
"datetime.date",
"django.db.mod... | [((606, 649), 'django.test.skipUnlessDBFeature', 'skipUnlessDBFeature', (['"""supports_over_clause"""'], {}), "('supports_over_clause')\n", (625, 649), False, 'from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature\n'), ((6537, 6638), 'unittest.skipIf', 'skipIf', (["(connection.vendor == 'oracle')", '"""... |
"""
Auth Engine
Copyright (c) 2017 by <NAME>.
MIT License, see LICENSE for details
"""
from .mongo_engine import MongoEngine
import uuid
class AuthEngine(MongoEngine):
def __init__(self):
super(AuthEngine, self).__init__(
collection='secrets',
key_manager=False
)
def... | [
"uuid.uuid4"
] | [((1539, 1551), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (1549, 1551), False, 'import uuid\n')] |
#!/usr/bin/env python
"""The setup script."""
from setuptools import setup, find_packages
with open('README.md') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
'Click>=7.0',
'nibabel',
'numpy',
'Python-Dep... | [
"setuptools.find_packages"
] | [((1417, 1464), 'setuptools.find_packages', 'find_packages', ([], {'include': "['torchio', 'torchio.*']"}), "(include=['torchio', 'torchio.*'])\n", (1430, 1464), False, 'from setuptools import setup, find_packages\n')] |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Tests that the seccomp filters don't let blacklisted syscalls through."""
import os
from subprocess import run, PIPE
def test_seccomp_ls(bin_seccomp_paths):
"""Assert that the seccomp filters deny ... | [
"os.path.exists",
"subprocess.run"
] | [((699, 726), 'os.path.exists', 'os.path.exists', (['demo_jailer'], {}), '(demo_jailer)\n', (713, 726), False, 'import os\n'), ((773, 808), 'subprocess.run', 'run', (['[demo_jailer, ls_command_path]'], {}), '([demo_jailer, ls_command_path])\n', (776, 808), False, 'from subprocess import run, PIPE\n'), ((1435, 1471), 'o... |
import sys
import pprint
import os.path as osp
from rlpyt.utils.launching.affinity import affinity_from_code
from rlpyt.samplers.serial.sampler import SerialSampler
from rlpyt.samplers.parallel.cpu.collectors import CpuResetCollector
from rlpyt.envs.atari.atari_env import AtariTrajInfo
from rlpyt.ul.envs.atari import... | [
"rlpyt.utils.launching.variant.load_variant",
"rlpyt.samplers.serial.sampler.SerialSampler",
"rlpyt.ul.agents.atari_pg_agent.AtariPgAgent",
"rlpyt.utils.launching.affinity.affinity_from_code",
"rlpyt.utils.logging.context.logger_context",
"rlpyt.utils.launching.variant.update_config",
"os.path.join",
... | [((1026, 1064), 'rlpyt.utils.launching.affinity.affinity_from_code', 'affinity_from_code', (['slot_affinity_code'], {}), '(slot_affinity_code)\n', (1044, 1064), False, 'from rlpyt.utils.launching.affinity import affinity_from_code\n'), ((1112, 1133), 'rlpyt.utils.launching.variant.load_variant', 'load_variant', (['log_... |
import re
from scripts_utils import get_soup
def read_all_lines_etym(lines):
pattern = re.compile(r"(\w*)\s*=\s*([{|\"].*[}|\"])")
pattern2 = re.compile(r"(\w*)\s*=\s*{")
m = {} # noqa
concat = ""
in_comment = False
for line in lines:
line = line.strip()
if line.startswith("-... | [
"scripts_utils.get_soup",
"re.compile"
] | [((93, 140), 're.compile', 're.compile', (['"""(\\\\w*)\\\\s*=\\\\s*([{|\\\\"].*[}|\\\\"])"""'], {}), '(\'(\\\\w*)\\\\s*=\\\\s*([{|\\\\"].*[}|\\\\"])\')\n', (103, 140), False, 'import re\n'), ((152, 182), 're.compile', 're.compile', (['"""(\\\\w*)\\\\s*=\\\\s*{"""'], {}), "('(\\\\w*)\\\\s*=\\\\s*{')\n", (162, 182), Fal... |
#!c:\users\pedro\documents\github\agenda\venv\scripts\python.exe
# When the django-admin.py deprecation ends, remove this script.
import warnings
from django.core import management
try:
from django.utils.deprecation import RemovedInDjango40Warning
except ImportError:
raise ImportError(
'django-admin.p... | [
"warnings.warn",
"django.core.management.execute_from_command_line"
] | [((534, 636), 'warnings.warn', 'warnings.warn', (['"""django-admin.py is deprecated in favor of django-admin."""', 'RemovedInDjango40Warning'], {}), "('django-admin.py is deprecated in favor of django-admin.',\n RemovedInDjango40Warning)\n", (547, 636), False, 'import warnings\n'), ((660, 698), 'django.core.manageme... |
# Copyright (C) 2010 Google Inc. 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 f... | [
"webkitpy.tool.mocktool.MockTool",
"webkitpy.common.checkout.changelog.ChangeLogEntry",
"webkitpy.tool.mocktool.MockOptions"
] | [((2101, 2125), 'webkitpy.common.checkout.changelog.ChangeLogEntry', 'ChangeLogEntry', (['contents'], {}), '(contents)\n', (2115, 2125), False, 'from webkitpy.common.checkout.changelog import ChangeLogEntry\n'), ((2266, 2276), 'webkitpy.tool.mocktool.MockTool', 'MockTool', ([], {}), '()\n', (2274, 2276), False, 'from w... |
from typing import Dict, Iterator, Protocol
from unittest import mock
import pytest
from fastapi import FastAPI
from pol.models import User, Avatar, PublicUser
from pol.api.v0.depends.auth import Guest
from pol.services.user_service import UserService
from pol.services.subject_service import SubjectService
class Mo... | [
"unittest.mock.Mock",
"unittest.mock.AsyncMock",
"pol.models.Avatar.from_db_record",
"pytest.fixture",
"pol.api.v0.depends.auth.Guest"
] | [((1535, 1551), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1549, 1551), False, 'import pytest\n'), ((1949, 1965), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1963, 1965), False, 'import pytest\n'), ((2149, 2160), 'unittest.mock.Mock', 'mock.Mock', ([], {}), '()\n', (2158, 2160), False, 'from unit... |
import threading
import time
import traceback
import os
import sys
from six import iteritems
def get_current_thread_object_dict():
"""
Get a dictionary of all 'Thread' objects created via the threading
module keyed by thread_id. Note that not all interpreter threads
have a thread objects, only the ma... | [
"threading.Thread.__init__",
"time.asctime",
"traceback.extract_stack",
"traceback.print_stack",
"threading._active_limbo_lock.acquire",
"threading.Event",
"threading._active_limbo_lock.release",
"os.getpid",
"sys._current_frames"
] | [((822, 860), 'threading._active_limbo_lock.acquire', 'threading._active_limbo_lock.acquire', ([], {}), '()\n', (858, 860), False, 'import threading\n'), ((938, 976), 'threading._active_limbo_lock.release', 'threading._active_limbo_lock.release', ([], {}), '()\n', (974, 976), False, 'import threading\n'), ((1211, 1253)... |
# Copyright (c) 2017–2018 crocoite contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, ... | [
"json.loads",
"datetime.datetime.utcnow",
"urllib.parse.urlsplit",
"json.dumps",
"os.path.join",
"asyncio.Event",
"functools.wraps",
"time.sleep",
"websockets.serve",
"asyncio.create_subprocess_exec",
"collections.defaultdict",
"tempfile.gettempdir",
"asyncio.Semaphore",
"asyncio.sleep",
... | [((2209, 2220), 'urllib.parse.urlsplit', 'urlsplit', (['s'], {}), '(s)\n', (2217, 2220), False, 'from urllib.parse import urlsplit\n'), ((13588, 13599), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (13593, 13599), False, 'from functools import wraps\n'), ((4038, 4074), 'random.randint', 'random.randint', (['... |
import tensorflow as tf
import pandas as pd
import time
import pdb #Equivalent of keyboard in MATLAB, just add "pdb.set_trace()"
class SolveFEMAdvectionDiffusion2D:
def __init__(self, options, filepaths,
obs_indices,
fem_operator_spatial,
fem_operator_implicit_ts... | [
"tensorflow.transpose",
"tensorflow.concat",
"tensorflow.gather",
"tensorflow.matmul",
"tensorflow.expand_dims",
"tensorflow.linalg.matmul"
] | [((1166, 1206), 'tensorflow.expand_dims', 'tf.expand_dims', (['parameters[0, :]'], {'axis': '(0)'}), '(parameters[0, :], axis=0)\n', (1180, 1206), True, 'import tensorflow as tf\n'), ((1225, 1275), 'tensorflow.gather', 'tf.gather', (['state_current', 'self.obs_indices'], {'axis': '(1)'}), '(state_current, self.obs_indi... |
import pandas as pd
import plotly.graph_objs as go
# TODO: Scroll down to line 157 and set up a fifth visualization for the data dashboard
def cleandata(dataset, keepcolumns = ['Country Name', '1990', '2015'], value_variables = ['1990', '2015']):
"""Clean world bank data for a visualizaiton dashboard
Keeps d... | [
"plotly.graph_objs.Scatter",
"pandas.read_csv"
] | [((600, 632), 'pandas.read_csv', 'pd.read_csv', (['dataset'], {'skiprows': '(4)'}), '(dataset, skiprows=4)\n', (611, 632), True, 'import pandas as pd\n'), ((1980, 2036), 'plotly.graph_objs.Scatter', 'go.Scatter', ([], {'x': 'x_val', 'y': 'y_val', 'mode': '"""lines"""', 'name': 'country'}), "(x=x_val, y=y_val, mode='lin... |
#script aiming at testing FileListProcessor_input_test
import cv2
import matplotlib.pyplot as plt
import tensorflow as tf
import os
import datetime
import numpy as np
import argparse
import DataProvider_input_pipeline
workingFolder='test_datapipeline'
sessionFolder=os.path.join(workingFolder, datetime.datetime.now().... | [
"tensorflow.train.Int64List",
"tensorflow.cast",
"argparse.ArgumentParser",
"tensorflow.py_function",
"matplotlib.pyplot.plot",
"numpy.max",
"DataProvider_input_pipeline.extractFilenames",
"numpy.linspace",
"tensorflow.train.FloatList",
"numpy.min",
"cv2.waitKey",
"DataProvider_input_pipeline.... | [((352, 378), 'os.makedirs', 'os.makedirs', (['sessionFolder'], {}), '(sessionFolder)\n', (363, 378), False, 'import os\n'), ((379, 402), 'os.chdir', 'os.chdir', (['sessionFolder'], {}), '(sessionFolder)\n', (387, 402), False, 'import os\n'), ((1054, 1125), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'d... |
from astropy.io import fits
from astropy.stats import sigma_clip, sigma_clipped_stats
from astropy.modeling import models, fitting
import numpy as np
from matplotlib import pyplot as plt
from utils import *
from tqdm import tqdm
def find_slit_edges(master_flat_name, edge_cut=50, threshold=20, gap=20, has_primary=Fa... | [
"numpy.polyfit",
"astropy.modeling.models.Gaussian1D",
"numpy.array",
"astropy.io.fits.open",
"numpy.poly1d",
"numpy.arange",
"matplotlib.pyplot.imshow",
"astropy.stats.sigma_clip",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.yticks",
"numpy.abs",
"matplotlib.py... | [((856, 883), 'astropy.io.fits.open', 'fits.open', (['master_flat_name'], {}), '(master_flat_name)\n', (865, 883), False, 'from astropy.io import fits\n'), ((4394, 4421), 'astropy.io.fits.open', 'fits.open', (['master_flat_name'], {}), '(master_flat_name)\n', (4403, 4421), False, 'from astropy.io import fits\n'), ((217... |
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | [
"mock.Mock",
"mock.patch"
] | [((1384, 1436), 'mock.patch', 'mock.patch', (['"""vmwarelib.inventory.get_virtualmachine"""'], {}), "('vmwarelib.inventory.get_virtualmachine')\n", (1394, 1436), False, 'import mock\n'), ((1442, 1499), 'mock.patch', 'mock.patch', (['"""vmwarelib.actions.BaseAction._wait_for_task"""'], {}), "('vmwarelib.actions.BaseActi... |
# from django.shortcuts import render
# # Create your views here.
# from myapp.models import *
# from .serializers import *
# from django.db.models import Q
# from rest_framework import viewsets
# from rest_framework.response import Response
# from rest_framework.views import APIView
# import numpy as np
# import requ... | [
"os.getcwd"
] | [((472, 480), 'os.getcwd', 'getcwd', ([], {}), '()\n', (478, 480), False, 'from os import getcwd\n')] |
# import the pandas, os, and sys libraries and load the nls and covid data
import pandas as pd
import os
import sys
import pprint
nls97 = pd.read_pickle("data/nls97f.pkl")
covidtotals = pd.read_pickle("data/covidtotals720.pkl")
# import the outliers module
sys.path.append(os.getcwd() + "/helperfunctions")
import outli... | [
"pandas.read_pickle",
"pandas.set_option",
"os.getcwd",
"outliers.getoutliers",
"outliers.getdistprops",
"outliers.makeplot",
"pprint.pprint"
] | [((138, 171), 'pandas.read_pickle', 'pd.read_pickle', (['"""data/nls97f.pkl"""'], {}), "('data/nls97f.pkl')\n", (152, 171), True, 'import pandas as pd\n'), ((186, 227), 'pandas.read_pickle', 'pd.read_pickle', (['"""data/covidtotals720.pkl"""'], {}), "('data/covidtotals720.pkl')\n", (200, 227), True, 'import pandas as p... |
import time
from datetime import timedelta
from django.db import transaction
from dpq.queue import AtLeastOnceQueue
from dpq.decorators import repeat
def foo(queue, job):
transaction.on_commit(lambda: 1/0)
print('foo {}'.format(job.args))
def timer(queue, job):
print(time.time() - job.args['time'])
d... | [
"django.db.transaction.on_commit",
"time.sleep",
"datetime.timedelta",
"dpq.queue.AtLeastOnceQueue",
"time.time"
] | [((744, 892), 'dpq.queue.AtLeastOnceQueue', 'AtLeastOnceQueue', ([], {'notify_channel': '"""channel"""', 'tasks': "{'foo': foo, 'timer': timer, 'repeater': repeater, 'n_times': n_times,\n 'long_task': long_task}"}), "(notify_channel='channel', tasks={'foo': foo, 'timer':\n timer, 'repeater': repeater, 'n_times': ... |
import csv
from pprint import pprint
def ClassFactory(class_name, dictionary):
return type(class_name, (object,), dictionary)
class CsvReader:
def __init__(self, filepath):
with open(filepath) as text_data:
self.data = []
csv_data = csv.DictReader(text_data, delimiter=',')
... | [
"csv.DictReader"
] | [((278, 318), 'csv.DictReader', 'csv.DictReader', (['text_data'], {'delimiter': '""","""'}), "(text_data, delimiter=',')\n", (292, 318), False, 'import csv\n')] |
import unittest
import numpy as np
from pysal.lib import cg, examples
import pysal.explore.spaghetti as spgh
class TestNetwork(unittest.TestCase):
def setUp(self):
self.ntw = spgh.Network(in_data=examples.get_path('streets.shp'))
def tearDown(self):
pass
def test_extract_net... | [
"pysal.explore.spaghetti.dijkstra",
"pysal.explore.spaghetti.dijkstra_mp",
"pysal.explore.spaghetti.util.snap_points_on_segments",
"pysal.explore.spaghetti.util.generatetree",
"pysal.lib.cg.shapes.Point",
"numpy.testing.assert_array_almost_equal_nulp",
"numpy.zeros",
"numpy.array",
"pysal.explore.sp... | [((10153, 10168), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10166, 10168), False, 'import unittest\n'), ((4329, 4355), 'numpy.zeros', 'np.zeros', (['matrix2.shape[0]'], {}), '(matrix2.shape[0])\n', (4337, 4355), True, 'import numpy as np\n'), ((5161, 5216), 'numpy.testing.assert_array_almost_equal_nulp', 'np... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
#
# 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
#
# ... | [
"datasets.example_dataset.create_splits.create_splits",
"matplotlib.use",
"configs.Config_unet.get_config",
"datasets.example_dataset.download_dataset.download_dataset",
"os.path.join"
] | [((704, 725), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (718, 725), False, 'import matplotlib\n'), ((1101, 1113), 'configs.Config_unet.get_config', 'get_config', ([], {}), '()\n', (1111, 1113), False, 'from configs.Config_unet import get_config\n'), ((1147, 1241), 'datasets.example_dataset.d... |
from setuptools import find_packages, setup
with open("README.md", "r") as f:
long_description = f.read()
setup(
name="riot",
description="A simple Python test runner runner.",
url="https://github.com/DataDog/riot",
author="<NAME>.",
author_email="<EMAIL>",
classifiers=[
"Programm... | [
"setuptools.find_packages"
] | [((794, 827), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests*']"}), "(exclude=['tests*'])\n", (807, 827), False, 'from setuptools import find_packages, setup\n')] |
from pycocotools.coco import COCO
import os
import shutil
import json
if __name__ == "__main__":
os.chdir("../coco/")
ann_names = [
"annotations/instances_train2017.json",
"annotations/instances_val2017.json"
]
for ann in ann_names:
coco = COCO(ann)
... | [
"os.chdir",
"json.load",
"pycocotools.coco.COCO",
"json.dump"
] | [((102, 122), 'os.chdir', 'os.chdir', (['"""../coco/"""'], {}), "('../coco/')\n", (110, 122), False, 'import os\n'), ((295, 304), 'pycocotools.coco.COCO', 'COCO', (['ann'], {}), '(ann)\n', (299, 304), False, 'from pycocotools.coco import COCO\n'), ((515, 534), 'json.load', 'json.load', (['ann_file'], {}), '(ann_file)\n... |