code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from helpers.kafkahelpers import (
create_producer,
publish_run_start_message,
publish_f142_message,
)
from helpers.nexushelpers import OpenNexusFileWhenAvailable
from helpers.timehelpers import unix_time_milliseconds
from time import sleep
from datetime import datetime
import pytest
def check(condition, ... | [
"pytest.fail",
"time.sleep",
"helpers.kafkahelpers.create_producer",
"datetime.datetime.utcnow",
"helpers.nexushelpers.OpenNexusFileWhenAvailable"
] | [((485, 502), 'helpers.kafkahelpers.create_producer', 'create_producer', ([], {}), '()\n', (500, 502), False, 'from helpers.kafkahelpers import create_producer, publish_run_start_message, publish_f142_message\n'), ((1320, 1329), 'time.sleep', 'sleep', (['(10)'], {}), '(10)\n', (1325, 1329), False, 'from time import sle... |
"""
DEPRECATED
USE kwcoco.metrics instead!
Faster pure-python versions of sklearn functions that avoid expensive checks
and label rectifications. It is assumed that all labels are consecutive
non-negative integers.
"""
from scipy.sparse import coo_matrix
import numpy as np
def confusion_matrix(y_true, y_pred, n_lab... | [
"numpy.diag",
"scipy.sparse.coo_matrix",
"numpy.nan_to_num"
] | [((1890, 1903), 'numpy.diag', 'np.diag', (['cfsn'], {}), '(cfsn)\n', (1897, 1903), True, 'import numpy as np\n'), ((2121, 2134), 'numpy.diag', 'np.diag', (['cfsn'], {}), '(cfsn)\n', (2128, 2134), True, 'import numpy as np\n'), ((1645, 1738), 'scipy.sparse.coo_matrix', 'coo_matrix', (['(sample_weight, (y_true, y_pred))'... |
import nextcord, asyncio, os, io, contextlib
from nextcord.ext import commands
from nextcord.ui import Modal, TextInput
from util.messages import DeleteMessageSlash
from util.constants import Client
class SnekBox_Eval(nextcord.ui.Modal):
def __init__(self) -> None:
super().__init__(title="Evaluate Your Code",... | [
"io.StringIO",
"nextcord.slash_command",
"util.messages.DeleteMessageSlash",
"nextcord.Embed",
"contextlib.redirect_stdout",
"nextcord.ui.TextInput"
] | [((1943, 2030), 'nextcord.slash_command', 'nextcord.slash_command', ([], {'name': '"""eval"""', 'description': '"""Evaluates the given python code"""'}), "(name='eval', description=\n 'Evaluates the given python code')\n", (1965, 2030), False, 'import nextcord, asyncio, os, io, contextlib\n'), ((725, 750), 'util.mes... |
from rgbd_seg.utils import build_from_cfg
from .registry import HEADS
def build_head(cfg, default_args=None):
head = build_from_cfg(cfg, HEADS, default_args)
return head
| [
"rgbd_seg.utils.build_from_cfg"
] | [((124, 164), 'rgbd_seg.utils.build_from_cfg', 'build_from_cfg', (['cfg', 'HEADS', 'default_args'], {}), '(cfg, HEADS, default_args)\n', (138, 164), False, 'from rgbd_seg.utils import build_from_cfg\n')] |
import taichi as ti
import taichi_glsl as ts
import math
from utils import Vector, Matrix, tiNormalize, Float
from config.base_cfg import error
## unity gameobject.transform
# ref: https://github.com/JYLeeLYJ/Fluid-Engine-Dev-on-Taichi/blob/master/src/python/geometry.py
@ti.data_oriented
class Transform2:
def __i... | [
"utils.tiNormalize",
"taichi.field",
"taichi.Vector.field",
"taichi.sin",
"taichi.cos",
"taichi.init",
"taichi_glsl.vec2",
"taichi.Vector"
] | [((3078, 3089), 'taichi.cos', 'ti.cos', (['rot'], {}), '(rot)\n', (3084, 3089), True, 'import taichi as ti\n'), ((3100, 3111), 'taichi.sin', 'ti.sin', (['rot'], {}), '(rot)\n', (3106, 3111), True, 'import taichi as ti\n'), ((3123, 3184), 'taichi.Vector', 'ti.Vector', (['[cos * p[0] - sin * p[1], sin * p[0] + cos * p[1]... |
from math import ceil
a = 1
b = 2
print(a/b)
print(ceil(1.6)) | [
"math.ceil"
] | [((52, 61), 'math.ceil', 'ceil', (['(1.6)'], {}), '(1.6)\n', (56, 61), False, 'from math import ceil\n')] |
import random
def generate(width, height, percentage):
map = [[1 for i in range(height)] for j in range(width)]
min_x = 1
max_x = width - 2
min_y = 1
max_y = height - 2
x = random.randint(min_x, max_x)
y = random.randint(min_y, max_y)
map_cells = width * height
filled_cells = 0
... | [
"random.choice",
"random.randint"
] | [((201, 229), 'random.randint', 'random.randint', (['min_x', 'max_x'], {}), '(min_x, max_x)\n', (215, 229), False, 'import random\n'), ((238, 266), 'random.randint', 'random.randint', (['min_y', 'max_y'], {}), '(min_y, max_y)\n', (252, 266), False, 'import random\n'), ((599, 627), 'random.choice', 'random.choice', (['[... |
import unittest
from api.controllers.simulation import SimulationController
from api.server import rest
class SimulationControllerTest(unittest.TestCase):
def setUp(self):
self.controller = SimulationController()
def test_get_active_load_fails(self):
with self.assertRaises(Exception):
... | [
"api.controllers.simulation.SimulationController",
"api.server.rest.test_client"
] | [((206, 228), 'api.controllers.simulation.SimulationController', 'SimulationController', ([], {}), '()\n', (226, 228), False, 'from api.controllers.simulation import SimulationController\n'), ((1080, 1098), 'api.server.rest.test_client', 'rest.test_client', ([], {}), '()\n', (1096, 1098), False, 'from api.server import... |
import cv2 as cv
import numpy as np
cameraman = cv.imread('./Photos/cameraman.tif')
saturn = cv.imread('./Photos/saturn.png')
saturn = cv.resize(saturn, (cameraman.shape[0], cameraman.shape[1]), interpolation=cv.INTER_AREA)
# we can split channels by using this
cameraman = cv.cvtColor(cameraman,cv.COLOR_BGR2GRAY)
b, g,... | [
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imread",
"cv2.split",
"cv2.bitwise_or",
"cv2.merge",
"cv2.imshow",
"cv2.resize"
] | [((48, 83), 'cv2.imread', 'cv.imread', (['"""./Photos/cameraman.tif"""'], {}), "('./Photos/cameraman.tif')\n", (57, 83), True, 'import cv2 as cv\n'), ((93, 125), 'cv2.imread', 'cv.imread', (['"""./Photos/saturn.png"""'], {}), "('./Photos/saturn.png')\n", (102, 125), True, 'import cv2 as cv\n'), ((135, 228), 'cv2.resize... |
"""
YANK Health Report Notebook formatter
This module handles all the figure formatting and processing to minimize the code shown in the Health Report Jupyter
Notebook. All data processing and analysis is handled by the main multistate.analyzers package,
mainly image formatting is passed here.
"""
import os
import y... | [
"matplotlib.colors.LinearSegmentedColormap",
"numpy.floor",
"yaml.dump",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"pymbar.MBAR",
"numpy.unique",
"numpy.linspace",
"scipy.interpolate.splrep",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.get_cmap",
"numpy.ceil",
"numpy.z... | [((3800, 3834), 'matplotlib.gridspec.GridSpec', 'gridspec.GridSpec', (['self.nphases', '(1)'], {}), '(self.nphases, 1)\n', (3817, 3834), False, 'from matplotlib import gridspec\n'), ((3891, 3903), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (3901, 3903), True, 'from matplotlib import pyplot as plt\n'), ... |
from django.test import TestCase
from zerver.lib.initial_password import initial_password
from zerver.lib.db import TimeTrackingCursor
from zerver.lib import cache
from zerver.lib import event_queue
from zerver.worker import queue_processors
from zerver.lib.actions import (
check_send_message, create_stream_if_ne... | [
"zerver.lib.actions.check_send_message",
"zerver.models.get_user_profile_by_email",
"zerver.lib.actions.get_display_recipient",
"os.path.dirname",
"zerver.models.Message.objects.filter",
"zerver.models.Recipient.objects.get",
"zerver.lib.initial_password.initial_password",
"ujson.dumps",
"zerver.mod... | [((3145, 3194), 're.compile', 're.compile', (['"""accounts/do_confirm/([a-f0-9]{40})>"""'], {}), "('accounts/do_confirm/([a-f0-9]{40})>')\n", (3155, 3194), False, 'import re\n'), ((2149, 2160), 'time.time', 'time.time', ([], {}), '()\n', (2158, 2160), False, 'import time\n'), ((5558, 5580), 'urllib.urlencode', 'urllib.... |
from django.conf import settings
from django.contrib import messages
from django.shortcuts import render, redirect, reverse, get_object_or_404
from django.contrib.auth.decorators import login_required, permission_required
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.views.generic... | [
"django.contrib.auth.decorators.login_required",
"django.contrib.auth.decorators.permission_required",
"django.shortcuts.redirect",
"scrumate.core.project.models.Project.objects.get",
"django.shortcuts.get_object_or_404",
"scrumate.core.issue.forms.IssueForm",
"django.core.paginator.Paginator",
"scrum... | [((584, 619), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/login/"""'}), "(login_url='/login/')\n", (598, 619), False, 'from django.contrib.auth.decorators import login_required, permission_required\n'), ((1265, 1300), 'django.contrib.auth.decorators.login_required', 'login... |
import data
import our_colours
def our_palettes(palette = None, n = None, reverse = False):
'''
Access our colour palettes as hexcodes
- palette: string, which palette should be accessed, should match a name from our_palettes_raw
- n: integer, number of colours to generate from palette
- reverse:... | [
"our_colours.our_colours"
] | [((848, 903), 'our_colours.our_colours', 'our_colours.our_colours', (['data.our_palettes_raw[palette]'], {}), '(data.our_palettes_raw[palette])\n', (871, 903), False, 'import our_colours\n')] |
import math
import numpy as np
from typing import Dict
from typing import List
from typing import Union
from typing import Iterator
from typing import Optional
from .types import *
from .data_types import *
from .normalizers import *
from .distributions import *
from ...misc import *
params_type = Dict[str, Union[Da... | [
"math.isinf",
"numpy.array"
] | [((2877, 2899), 'math.isinf', 'math.isinf', (['num_params'], {}), '(num_params)\n', (2887, 2899), False, 'import math\n'), ((4226, 4259), 'numpy.array', 'np.array', (['bounds_list', 'np.float32'], {}), '(bounds_list, np.float32)\n', (4234, 4259), True, 'import numpy as np\n')] |
from bs4 import BeautifulSoup as soup
import requests
import re
from word2number import w2n
import pandas as pd
response = requests.get('https://www.zameen.com/Houses_Property/Lahore-1-1.html')
Price=[]
Location=[]
Beds=[]
Size = []
#file1 = open("myfile.txt","w")
#file1.writelines(response.text)
#fil... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((131, 201), 'requests.get', 'requests.get', (['"""https://www.zameen.com/Houses_Property/Lahore-1-1.html"""'], {}), "('https://www.zameen.com/Houses_Property/Lahore-1-1.html')\n", (143, 201), False, 'import requests\n'), ((360, 379), 'bs4.BeautifulSoup', 'soup', (['response.text'], {}), '(response.text)\n', (364, 379... |
"""EM 算法的实现
"""
import copy
import math
import matplotlib.pyplot as plt
import numpy as np
isdebug = True
# 指定k个高斯分布参数,这里指定k=2。注意2个高斯分布具有相同均方差Sigma,均值分别为Mu1,Mu2。
def init_data(Sigma, Mu1, Mu2, k, N):
global X
global Mu
global Expectations
X = np.zeros((1, N))
Mu = np.random.random(k)
Expect... | [
"copy.deepcopy",
"matplotlib.pyplot.show",
"matplotlib.pyplot.hist",
"numpy.zeros",
"numpy.random.random",
"numpy.random.normal"
] | [((264, 280), 'numpy.zeros', 'np.zeros', (['(1, N)'], {}), '((1, N))\n', (272, 280), True, 'import numpy as np\n'), ((290, 309), 'numpy.random.random', 'np.random.random', (['k'], {}), '(k)\n', (306, 309), True, 'import numpy as np\n'), ((329, 345), 'numpy.zeros', 'np.zeros', (['(N, k)'], {}), '((N, k))\n', (337, 345),... |
from qaz import settings
from qaz.managers import git, shell
def update_qaz() -> None:
"""
Update QAZ.
This pulls the latest version of QAZ and installs the necessary Python dependencies
for this tool.
"""
root_dir = settings.get_root_dir()
git.pull(root_dir)
shell.run(
"poetr... | [
"qaz.settings.get_root_dir",
"qaz.managers.git.pull"
] | [((244, 267), 'qaz.settings.get_root_dir', 'settings.get_root_dir', ([], {}), '()\n', (265, 267), False, 'from qaz import settings\n'), ((272, 290), 'qaz.managers.git.pull', 'git.pull', (['root_dir'], {}), '(root_dir)\n', (280, 290), False, 'from qaz.managers import git, shell\n')] |
import os
import h5py
import pytest
import numpy as np
import pandas as pd
import automatic_speech_recognition as asr
@pytest.fixture
def dataset() -> asr.dataset.Features:
file_path = 'test.h5'
reference = pd.DataFrame({
'path': [f'dataset/{i}' for i in range(10)],
'transcript': [f'transcript... | [
"automatic_speech_recognition.dataset.Features.from_hdf",
"os.remove",
"h5py.File",
"pandas.HDFStore",
"numpy.random.random"
] | [((595, 649), 'automatic_speech_recognition.dataset.Features.from_hdf', 'asr.dataset.Features.from_hdf', (['file_path'], {'batch_size': '(3)'}), '(file_path, batch_size=3)\n', (624, 649), True, 'import automatic_speech_recognition as asr\n'), ((896, 916), 'os.remove', 'os.remove', (['"""test.h5"""'], {}), "('test.h5')\... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"unittest.main",
"paddle.distributed.fleet.elastic.collective.CollectiveLauncher",
"tempfile.TemporaryDirectory",
"paddle.distributed.fleet.launch.launch_collective",
"tempfile.mkdtemp",
"os.path.join"
] | [((3229, 3244), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3242, 3244), False, 'import unittest\n'), ((1064, 1093), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (1091, 1093), False, 'import tempfile\n'), ((1119, 1181), 'os.path.join', 'os.path.join', (['self.temp_dir.name', ... |
"""
This is an implementation of paper
"Attention-based LSTM for Aspect-level Sentiment Classification" with Keras.
Based on dataset from "SemEval 2014 Task 4".
"""
import os
from time import time
# TODO, Here we need logger!
import numpy as np
from lxml import etree
from keras.preprocessing.text import Tokenizer
fr... | [
"keras.models.load_model",
"keras.regularizers.l2",
"numpy.load",
"numpy.random.seed",
"numpy.argmax",
"keras.preprocessing.sequence.pad_sequences",
"keras.optimizers.Adagrad",
"keras.models.Model",
"numpy.arange",
"keras.layers.Input",
"keras.activations.softmax",
"keras.layers.Reshape",
"o... | [((1528, 1550), 'lxml.etree.parse', 'etree.parse', (['data_file'], {}), '(data_file)\n', (1539, 1550), False, 'from lxml import etree\n'), ((11765, 11771), 'time.time', 'time', ([], {}), '()\n', (11769, 11771), False, 'from time import time\n'), ((15107, 15129), 'numpy.load', 'np.load', (['emb_mtrx_file'], {}), '(emb_m... |
# Generated by Django 2.1 on 2018-12-23 13:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('preferences', '0002_auto_20181221_2151'),
]
operations = [
migrations.AddField(
model_name='generalpreferences',
name=... | [
"django.db.models.PositiveIntegerField"
] | [((361, 399), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'default': '(0)'}), '(default=0)\n', (388, 399), False, 'from django.db import migrations, models\n'), ((554, 592), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'default': '(0)'}), '(default=0)\n... |
import os
import sys
import io
import warnings
from pygen_structures.convenience_functions import (
load_charmm_dir,
pdb_to_mol
)
from pygen_structures import __main__ as cmd_interface
FILE_DIR, _ = os.path.split(__file__)
TEST_TOPPAR = os.path.join(FILE_DIR, 'test_toppar')
def test_arg_parsing():
argv = ... | [
"os.remove",
"io.StringIO",
"os.path.join",
"warnings.simplefilter",
"sys.stdout.seek",
"sys.stdout.close",
"pygen_structures.convenience_functions.pdb_to_mol",
"os.path.exists",
"sys.stdout.read",
"warnings.catch_warnings",
"pygen_structures.__main__.parse_args",
"pygen_structures.convenience... | [((208, 231), 'os.path.split', 'os.path.split', (['__file__'], {}), '(__file__)\n', (221, 231), False, 'import os\n'), ((246, 283), 'os.path.join', 'os.path.join', (['FILE_DIR', '"""test_toppar"""'], {}), "(FILE_DIR, 'test_toppar')\n", (258, 283), False, 'import os\n'), ((378, 408), 'pygen_structures.__main__.parse_arg... |
#coding:utf-8
import cv2
import os
import sys
#测试相机能否使用
cap = cv2.VideoCapture(0)
while True:
ret,frame=cap.read()
cv2.imshow('MyVideo',frame)
cv2.waitKey(25)
| [
"cv2.VideoCapture",
"cv2.imshow",
"cv2.waitKey"
] | [((62, 81), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (78, 81), False, 'import cv2\n'), ((123, 151), 'cv2.imshow', 'cv2.imshow', (['"""MyVideo"""', 'frame'], {}), "('MyVideo', frame)\n", (133, 151), False, 'import cv2\n'), ((155, 170), 'cv2.waitKey', 'cv2.waitKey', (['(25)'], {}), '(25)\n', (166, ... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from CTFd import create_app
from CTFd.utils import get_config as get_config_util, set_config as set_config_util
from CTFd.models import *
app = create_app()
mana... | [
"os.path.join",
"flask_script.Manager",
"CTFd.constants.JS_ENUMS.items",
"json.dumps",
"CTFd.utils.set_config",
"CTFd.utils.get_config",
"CTFd.create_app"
] | [((300, 312), 'CTFd.create_app', 'create_app', ([], {}), '()\n', (310, 312), False, 'from CTFd import create_app\n'), ((326, 338), 'flask_script.Manager', 'Manager', (['app'], {}), '(app)\n', (333, 338), False, 'from flask_script import Manager\n'), ((489, 554), 'os.path.join', 'os.path.join', (['app.root_path', '"""th... |
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import axes3d
from matplotlib.patches import Rectangle, PathPatch
from matplotlib.text import TextPath
from matplotlib.tra... | [
"matplotlib.pyplot.title",
"matplotlib.text.TextPath",
"matplotlib.pyplot.plot",
"matplotlib.patches.Rectangle",
"pandas.read_csv",
"matplotlib.pyplot.close",
"matplotlib.backends.backend_agg.FigureCanvasAgg",
"matplotlib.pyplot.Figure",
"matplotlib.pyplot.figure",
"mpl_toolkits.mplot3d.art3d.path... | [((18171, 18238), 'pandas.read_csv', 'pd.read_csv', (["('csv/' + conf.data['env']['path'] + '/continuidad.csv')"], {}), "('csv/' + conf.data['env']['path'] + '/continuidad.csv')\n", (18182, 18238), True, 'import pandas as pd\n'), ((21122, 21134), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (21132, 21134... |
import csv
def raw_data_gen(n):
'''
generator for mock data
yields str generators
'''
for i in range(n):
yield (f'{i}_{j}' for j in range(4))
#create/overwirte a file with rawdata
with open('data_file.csv', 'w', newline='') as data_buffer:
file_writer = csv.writer(data_buffer)
f... | [
"csv.reader",
"csv.writer"
] | [((291, 314), 'csv.writer', 'csv.writer', (['data_buffer'], {}), '(data_buffer)\n', (301, 314), False, 'import csv\n'), ((479, 502), 'csv.reader', 'csv.reader', (['data_buffer'], {}), '(data_buffer)\n', (489, 502), False, 'import csv\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2020-2022 Barcelona Supercomputing Center (BSC), Spain
#
# 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... | [
"tempfile.NamedTemporaryFile",
"lzma.open",
"subprocess.Popen",
"os.path.lexists",
"json.loads",
"json.load",
"uuid.uuid4",
"typing.cast",
"json.dump",
"os.path.realpath",
"os.unlink",
"os.path.exists",
"os.path.isfile",
"os.path.relpath",
"shutil.move",
"shutil.copyfileobj",
"os.pat... | [((1894, 1923), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {}), '()\n', (1921, 1923), False, 'import tempfile\n'), ((1934, 1963), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {}), '()\n', (1961, 1963), False, 'import tempfile\n'), ((2960, 2989), 'tempfile.NamedTemporaryFile... |
import importlib
import pytest
import tornado.web
from shelter.core.cmdlineparser import ArgumentParser
from shelter.core.config import Config
from shelter.core.context import Context
import tests.test_core_app
class ContextTest(Context):
pass
def test_config_cls():
config = Config(1, 2)
assert "<sh... | [
"shelter.core.config.Config",
"pytest.raises",
"shelter.core.cmdlineparser.ArgumentParser",
"importlib.import_module"
] | [((292, 304), 'shelter.core.config.Config', 'Config', (['(1)', '(2)'], {}), '(1, 2)\n', (298, 304), False, 'from shelter.core.config import Config\n'), ((505, 547), 'importlib.import_module', 'importlib.import_module', (['"""tests.settings1"""'], {}), "('tests.settings1')\n", (528, 547), False, 'import importlib\n'), (... |
"""
Fixed policies to test our sim integration with. These are intended to take
Brain states and return Brain actions.
"""
import random
def random_policy(state):
"""
Ignore the state, select randomly.
"""
action = {
'command': random.randint(1, 2)
}
return action
def coast(state):
... | [
"random.randint"
] | [((254, 274), 'random.randint', 'random.randint', (['(1)', '(2)'], {}), '(1, 2)\n', (268, 274), False, 'import random\n')] |
import os
import shelve
from typing import Dict, List, Optional, Set, Tuple
from flask import current_app
from google.cloud import datastore
class DatastoreAdapter:
@property
def ds_client(self):
if not hasattr(current_app, "_datastore_client"):
config = current_app.config
curr... | [
"flask.current_app.config.get"
] | [((658, 699), 'flask.current_app.config.get', 'current_app.config.get', (['"""GCP_CREDENTIALS"""'], {}), "('GCP_CREDENTIALS')\n", (680, 699), False, 'from flask import current_app\n')] |
import math
import itertools as itt
import numpy as np
from collections import namedtuple
from datetime import datetime
from scipy.special import gamma
from sklearn.neighbors import BallTree
import random
from pywde.pywt_ext import WaveletTensorProduct
from pywde.common import all_zs_tensor
class dictwithfactory(dic... | [
"numpy.amin",
"math.fabs",
"math.sqrt",
"numpy.power",
"scipy.special.gamma",
"numpy.zeros",
"numpy.amax",
"sklearn.neighbors.BallTree",
"numpy.array",
"collections.namedtuple",
"random.seed",
"pywde.pywt_ext.WaveletTensorProduct",
"pywde.common.all_zs_tensor",
"datetime.datetime.now",
"... | [((35069, 35143), 'collections.namedtuple', 'namedtuple', (['"""BallsInfo"""', "['sqrt_vol_k', 'sqrt_vol_k_plus_1', 'nn_indexes']"], {}), "('BallsInfo', ['sqrt_vol_k', 'sqrt_vol_k_plus_1', 'nn_indexes'])\n", (35079, 35143), False, 'from collections import namedtuple\n'), ((34883, 34897), 'numpy.array', 'np.array', (['r... |
#!/usr/bin/env python
# <examples/doc_mode_savemodel.py>
import numpy as np
from lmfit.model import Model, save_model
def mysine(x, amp, freq, shift):
return amp * np.sin(x*freq + shift)
sinemodel = Model(mysine)
pars = sinemodel.make_params(amp=1, freq=0.25, shift=0)
save_model(sinemodel, 'sinemodel.sav')
#... | [
"lmfit.model.save_model",
"numpy.sin",
"lmfit.model.Model"
] | [((209, 222), 'lmfit.model.Model', 'Model', (['mysine'], {}), '(mysine)\n', (214, 222), False, 'from lmfit.model import Model, save_model\n'), ((280, 318), 'lmfit.model.save_model', 'save_model', (['sinemodel', '"""sinemodel.sav"""'], {}), "(sinemodel, 'sinemodel.sav')\n", (290, 318), False, 'from lmfit.model import Mo... |
#!/usr/bin/env python3
import pyxel
class App:
def __init__(self):
pyxel.init(160, 120, caption="test lol")
pyxel.load("assets/data.pyxres")
pyxel.run(self.update, self.draw)
def update(self):
if pyxel.btnp(pyxel.KEY_Q):
pyxel.quit()
def draw(self):
p... | [
"pyxel.load",
"pyxel.text",
"pyxel.init",
"pyxel.blt",
"pyxel.cls",
"pyxel.btnp",
"pyxel.quit",
"pyxel.run"
] | [((82, 122), 'pyxel.init', 'pyxel.init', (['(160)', '(120)'], {'caption': '"""test lol"""'}), "(160, 120, caption='test lol')\n", (92, 122), False, 'import pyxel\n'), ((131, 163), 'pyxel.load', 'pyxel.load', (['"""assets/data.pyxres"""'], {}), "('assets/data.pyxres')\n", (141, 163), False, 'import pyxel\n'), ((172, 205... |
from flask_wtf.recaptcha.validators import Recaptcha, RECAPTCHA_ERROR_CODES
from flask import current_app, request
from wtforms import ValidationError
import urllib.parse
import urllib.request
import json
class Hcaptcha(Recaptcha):
def __call__(self, form, field):
if current_app.testing:
retur... | [
"flask.request.json.get",
"flask.current_app.config.get",
"wtforms.ValidationError",
"flask.request.form.get"
] | [((1132, 1181), 'flask.current_app.config.get', 'current_app.config.get', (['"""RECAPTCHA_VERIFY_SERVER"""'], {}), "('RECAPTCHA_VERIFY_SERVER')\n", (1154, 1181), False, 'from flask import current_app, request\n'), ((376, 418), 'flask.request.json.get', 'request.json.get', (['"""h-captcha-response"""', '""""""'], {}), "... |
import typing
from app.util import log as logging
from .executor import Executor
from .settings import Settings
from .request import Request
from .response import Response
from ..info import Info
class Plugin:
"""Base Plugin Class.
This class defines, which Executor, Settings, Request and Response class is ... | [
"app.util.log.PluginLogger",
"app.util.log.LogCall"
] | [((545, 598), 'app.util.log.LogCall', 'logging.LogCall', (['__file__', '"""__init__"""', 'self.__class__'], {}), "(__file__, '__init__', self.__class__)\n", (560, 598), True, 'from app.util import log as logging\n'), ((684, 719), 'app.util.log.PluginLogger', 'logging.PluginLogger', (['self.info.uid'], {}), '(self.info.... |
from django.db import models
from django.core import validators
from django.contrib.auth.models import AbstractUser
from django.utils.translation import gettext_lazy as _
from django.utils import timezone
class User(AbstractUser):
"""
Top most - for authentication purpose only
"""
is_admin = models.BooleanField(d... | [
"django.db.models.TextField",
"django.db.models.OneToOneField",
"django.db.models.URLField",
"django.core.validators.MinLengthValidator",
"django.utils.translation.gettext_lazy",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.core.validators.MinValueValidator",
"django.db.model... | [((299, 333), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (318, 333), False, 'from django.db import models\n'), ((371, 423), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'on_delete': 'models.CASCADE'}), '(User, on_delete=models.CASC... |
#!/usr/bin/env python3
# Author: <NAME> <zhb _at_ iredmail.org>
# Purpose: Add missing attribute/value pairs required by Dovecot-2.3.
# Date: Apr 12, 2018.
import ldap
# Note:
# * bind_dn must have write privilege on LDAP server.
uri = 'ldap://127.0.0.1:389'
basedn = 'o=domains,dc=example,dc=com'
bind_dn = '... | [
"ldap.initialize"
] | [((462, 501), 'ldap.initialize', 'ldap.initialize', ([], {'uri': 'uri', 'trace_level': '(0)'}), '(uri=uri, trace_level=0)\n', (477, 501), False, 'import ldap\n')] |
"""
Demo/test program for the MQTT utilities.
See https://github.com/sensemakersamsterdam/astroplant_explorer
"""
# (c) Sensemakersams.org and others. See https://github.com/sensemakersamsterdam/astroplant_explorer
# Author: <NAME>
#
##
# H O W T O U S E
#
# Edit configuration.json and pick a nice 'ae_id' for you... | [
"time.sleep",
"ae_util.mqtt.AE_Local_MQTT"
] | [((1577, 1592), 'ae_util.mqtt.AE_Local_MQTT', 'AE_Local_MQTT', ([], {}), '()\n', (1590, 1592), False, 'from ae_util.mqtt import AE_Local_MQTT\n'), ((5080, 5090), 'time.sleep', 'sleep', (['(0.1)'], {}), '(0.1)\n', (5085, 5090), False, 'from time import sleep\n')] |
from rb.processings.pipeline.estimator import Regressor
from rb.processings.pipeline.dataset import Dataset, Task
from typing import List, Dict
from sklearn import svm
class SVR(Regressor):
def __init__(self, dataset: Dataset, tasks: List[Task], params: Dict[str, str]):
super().__init__(dataset, tasks, par... | [
"sklearn.svm.SVR"
] | [((346, 418), 'sklearn.svm.SVR', 'svm.SVR', ([], {'gamma': '"""scale"""', 'kernel': "params['kernel']", 'degree': "params['degree']"}), "(gamma='scale', kernel=params['kernel'], degree=params['degree'])\n", (353, 418), False, 'from sklearn import svm\n')] |
import pytest
import ast
from .ReflectivityExample import *
import reflectivipy
from reflectivipy import MetaLink
@pytest.fixture(autouse=True)
def setup():
reflectivipy.uninstall_all()
def test_wrap_expr():
node = expr_sample_node()
assert type(node) is ast.Expr
transformation = node.wrapper.flat... | [
"pytest.fixture",
"reflectivipy.uninstall_all"
] | [((117, 145), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (131, 145), False, 'import pytest\n'), ((163, 191), 'reflectivipy.uninstall_all', 'reflectivipy.uninstall_all', ([], {}), '()\n', (189, 191), False, 'import reflectivipy\n')] |
from PyPDF4 import PdfFileReader, PdfFileWriter
from PyPDF4.pdf import ContentStream
from PyPDF4.generic import TextStringObject, NameObject
from PyPDF4.utils import b_
import os
import argparse
from io import BytesIO
from typing import Tuple
# Import the reportlab library
from reportlab.pdfgen import canvas
# The size... | [
"io.BytesIO",
"PyPDF4.PdfFileReader",
"PyPDF4.generic.NameObject",
"argparse.ArgumentParser",
"PyPDF4.PdfFileWriter",
"os.path.basename",
"os.path.isdir",
"os.path.dirname",
"os.walk",
"PyPDF4.pdf.ContentStream",
"PyPDF4.generic.TextStringObject",
"reportlab.pdfgen.canvas.Canvas",
"os.path.i... | [((1992, 2019), 'os.path.dirname', 'os.path.dirname', (['input_file'], {}), '(input_file)\n', (2007, 2019), False, 'import os\n'), ((2041, 2069), 'os.path.basename', 'os.path.basename', (['input_file'], {}), '(input_file)\n', (2057, 2069), False, 'import os\n'), ((4645, 4660), 'PyPDF4.PdfFileWriter', 'PdfFileWriter', (... |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | [
"torch.no_grad",
"modnas.backend.get_lr_scheduler",
"modnas.backend.get_data_provider",
"modnas.backend.get_device"
] | [((2498, 2575), 'modnas.backend.get_lr_scheduler', 'backend.get_lr_scheduler', (['self.optimizer', "self.config['lr_scheduler']", 'config'], {}), "(self.optimizer, self.config['lr_scheduler'], config)\n", (2522, 2575), False, 'from modnas import backend\n'), ((2650, 2705), 'modnas.backend.get_data_provider', 'backend.g... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Name: coverageM21.py
# Purpose: Starts Coverage w/ default arguments
#
# Authors: <NAME>
# <NAME>
#
# Copyright: Copyright © 2014-22 <NAME>
# License: LGPL or BSD, see licen... | [
"coverage.coverage"
] | [((667, 703), 'coverage.coverage', 'coverage.coverage', ([], {'omit': 'omit_modules'}), '(omit=omit_modules)\n', (684, 703), False, 'import coverage\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020-2021 by <NAME>. All rights reserved. This file is part
# of the Robot Operating System project, released under the MIT License. Please
# see the LICENSE file included as part of this package.
#
# author: <NAME>
# created: 2020-03-27
# modified: 2020-0... | [
"colorama.init",
"busio.I2C",
"time.sleep",
"lib.convert.Convert.convert_to_degrees",
"pyquaternion.Quaternion",
"time.monotonic",
"lib.convert.Convert.offset_in_degrees",
"lib.logger.Logger",
"traceback.format_exc",
"sys.exit",
"adafruit_bno08x.i2c.BNO08X_I2C"
] | [((1019, 1025), 'colorama.init', 'init', ([], {}), '()\n', (1023, 1025), False, 'from colorama import init, Fore, Style\n'), ((1848, 1982), 'sys.exit', 'sys.exit', (["('This script requires the adafruit_bno08x module.\\n' +\n 'Install with: pip3 install --user adafruit-circuitpython-bno08x')"], {}), "('This script r... |
from setuptools import setup, find_packages
setup(
name='edtw',
version='0.0.1',
license='MIT',
author="<NAME>",
author_email='<EMAIL>',
packages=find_packages('src'),
package_dir={'': 'src'},
url='https://github.com/qkudev/edtw',
keywords='python, dwt, entropy, mutual information... | [
"setuptools.find_packages"
] | [((173, 193), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (186, 193), False, 'from setuptools import setup, find_packages\n')] |
import torch.nn as nn
import pytorch_lightning as pl
import torchvision.models as models
class ResNet101Encoder(pl.LightningModule):
def __init__(
self,
pretrained,
show_progress,
depth_adapted
):
super().__init__()
self.depth_adapted = depth_adapted
... | [
"torchvision.models.resnet101",
"torch.nn.Conv2d",
"torch.nn.Sequential"
] | [((519, 553), 'torch.nn.Sequential', 'nn.Sequential', (['*self.image_modules'], {}), '(*self.image_modules)\n', (532, 553), True, 'import torch.nn as nn\n'), ((1073, 1152), 'torch.nn.Conv2d', 'nn.Conv2d', (['(4)', '(64)'], {'kernel_size': '(7, 7)', 'stride': '(2, 2)', 'padding': '(3, 3)', 'bias': '(False)'}), '(4, 64, ... |
import argparse
import logging
import os
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import datasets, transforms
from torch.utils.data import DataLoader, Dataset, TensorDataset
import torchattacks
from advertorch.defenses import MedianSmoothing2D, BitSqueezing, JPEGFilter
from mni... | [
"os.mkdir",
"torchattacks.DeepFool",
"argparse.ArgumentParser",
"mnist_net.classifier_A",
"mnist_net.classifier_B",
"mnist_net.Le_Net",
"torch.utils.data.DataLoader",
"torch.load",
"os.path.exists",
"advertorch.defenses.MedianSmoothing2D",
"mnist_net.classifier_C",
"advertorch.defenses.BitSque... | [((448, 473), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (471, 473), False, 'import argparse\n'), ((1514, 1541), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1531, 1541), False, 'import logging\n'), ((1546, 1674), 'logging.basicConfig', 'logging.basicConfig... |
import csv
import datetime
from django.conf.urls import url
from django.contrib import admin
from django.http import HttpResponse, HttpResponseForbidden
from .models import Feedback
class FeedbackAdmin(admin.ModelAdmin):
list_filter = ("found_useful",)
list_display = ("id", "found_useful", "comments", "create... | [
"csv.writer",
"django.http.HttpResponse",
"django.contrib.admin.site.register",
"django.http.HttpResponseForbidden",
"django.conf.urls.url",
"datetime.datetime.now"
] | [((1874, 1918), 'django.contrib.admin.site.register', 'admin.site.register', (['Feedback', 'FeedbackAdmin'], {}), '(Feedback, FeedbackAdmin)\n', (1893, 1918), False, 'from django.contrib import admin\n'), ((1406, 1443), 'django.http.HttpResponse', 'HttpResponse', ([], {'content_type': '"""text/csv"""'}), "(content_type... |
import numpy as np
import scipy.special as sp
import matplotlib.pyplot as plt
# radius of the oberservation circle
def NMLA_radius(omega,Rest=1):
# Input: omega--frequency; Rest--estimate of the distance from source to observation point
#
# Output: the radius of the oberservation circle
poly = [1,... | [
"numpy.roots",
"numpy.fft.ifft",
"matplotlib.pyplot.show",
"numpy.abs",
"numpy.sum",
"numpy.fft.fft",
"numpy.sin",
"numpy.array",
"numpy.exp",
"numpy.linspace",
"scipy.special.jv",
"numpy.real",
"numpy.cos",
"matplotlib.pyplot.xlabel"
] | [((363, 377), 'numpy.roots', 'np.roots', (['poly'], {}), '(poly)\n', (371, 377), True, 'import numpy as np\n'), ((918, 932), 'scipy.special.jv', 'sp.jv', (['idx', 'kr'], {}), '(idx, kr)\n', (923, 932), True, 'import scipy.special as sp\n'), ((961, 987), 'numpy.array', 'np.array', (['([0.0] * (LP - 1))'], {}), '([0.0] *... |
'''
Created on Oct 26, 2015
@author: wirkert
'''
import numpy as np
import pandas as pd
from sklearn.preprocessing import Normalizer
def preprocess2(df, nr_samples=None, snr=None, movement_noise_sigma=None,
magnification=None, bands_to_sortout=None):
# first set 0 reflectances to nan
df["re... | [
"numpy.log",
"numpy.zeros",
"numpy.ones",
"numpy.clip",
"numpy.random.normal",
"numpy.diag",
"sklearn.preprocessing.Normalizer",
"pandas.concat",
"numpy.delete",
"numpy.vstack"
] | [((2277, 2299), 'numpy.clip', 'np.clip', (['X', '(1e-05)', '(1.0)'], {}), '(X, 1e-05, 1.0)\n', (2284, 2299), True, 'import numpy as np\n'), ((2715, 2736), 'sklearn.preprocessing.Normalizer', 'Normalizer', ([], {'norm': '"""l1"""'}), "(norm='l1')\n", (2725, 2736), False, 'from sklearn.preprocessing import Normalizer\n')... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-05-30 08:43
from __future__ import unicode_literals
import data.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data', '0047_officerallegation_outcome'),
]
operations = [
... | [
"django.db.models.CharField"
] | [((432, 474), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(1)'}), '(blank=True, max_length=1)\n', (448, 474), False, 'from django.db import migrations, models\n'), ((598, 698), 'django.db.models.CharField', 'models.CharField', ([], {'default': "b'Unknown'", 'max_length': '(... |
from setuptools import setup
setup(
name='DE_LibUtil',
version='0.0.19',
packages=[''],
url='https://github.com/almirjgomes/DE_LibUtil.git',
license='MIT',
author='<NAME>',
author_email='<EMAIL>',
description='LibUtil - Biblioteca de Utilidades'
)
| [
"setuptools.setup"
] | [((30, 261), 'setuptools.setup', 'setup', ([], {'name': '"""DE_LibUtil"""', 'version': '"""0.0.19"""', 'packages': "['']", 'url': '"""https://github.com/almirjgomes/DE_LibUtil.git"""', 'license': '"""MIT"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""LibUtil - Biblioteca de Utilidade... |
from models.ModelManager import ModelManager
from models.relation_classifier import DATA_DIR, split_line, MODEL_PATH, read_file, DATA_DEV, DATA_TRAIN
from models.relation_classifier.RelationClassifierRNNBased import RelationClassifierRNNBased
def main():
X_train, Y_train = read_file(DATA_TRAIN)
X_dev, Y_dev =... | [
"models.relation_classifier.read_file",
"models.relation_classifier.RelationClassifierRNNBased.RelationClassifierRNNBased"
] | [((280, 301), 'models.relation_classifier.read_file', 'read_file', (['DATA_TRAIN'], {}), '(DATA_TRAIN)\n', (289, 301), False, 'from models.relation_classifier import DATA_DIR, split_line, MODEL_PATH, read_file, DATA_DEV, DATA_TRAIN\n'), ((321, 340), 'models.relation_classifier.read_file', 'read_file', (['DATA_DEV'], {}... |
'''
Functions to go in here (I think!?):
KC: 01/12/2018, ideas-
KC: 19/12/2018, added-
~NuSTAR class
'''
from . import data_handling
import sys
#from os.path import *
import os
from os.path import isfile
import astropy
from astropy.io import fits
import astropy.units as u
import matplotlib
import matplot... | [
"matplotlib.pyplot.title",
"os.mkdir",
"pickle.dump",
"numpy.sum",
"numpy.argmax",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.subplot2grid",
"os.walk",
"numpy.isnan",
"numpy.argmin",
"numpy.shape",
"matplotlib.pyplot.figure",
"pickle.load",
"numpy.arange",
"matplotlib.colors.LogNorm",
... | [((1121, 1153), 'pandas.plotting.register_matplotlib_converters', 'register_matplotlib_converters', ([], {}), '()\n', (1151, 1153), False, 'from pandas.plotting import register_matplotlib_converters\n'), ((1288, 1332), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'}), "(divide='i... |
# coding: utf-8
import os, sys
from setuptools import setup, find_packages
NAME = "edam2json"
VERSION = "1.0dev1"
SETUP_DIR = os.path.dirname(__file__)
README = os.path.join(SETUP_DIR, 'README.md')
readme = open(README).read()
REQUIRES = ["rdflib", "rdflib-jsonld"]
setup(
name=NAME,
version=VERSION,
de... | [
"os.path.dirname",
"os.path.join",
"setuptools.find_packages"
] | [((129, 154), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (144, 154), False, 'import os, sys\n'), ((164, 200), 'os.path.join', 'os.path.join', (['SETUP_DIR', '"""README.md"""'], {}), "(SETUP_DIR, 'README.md')\n", (176, 200), False, 'import os, sys\n'), ((530, 545), 'setuptools.find_package... |
from models import *
from django.contrib import admin
admin.site.register(Profile)
admin.site.register(EmailVerify)
| [
"django.contrib.admin.site.register"
] | [((55, 83), 'django.contrib.admin.site.register', 'admin.site.register', (['Profile'], {}), '(Profile)\n', (74, 83), False, 'from django.contrib import admin\n'), ((84, 116), 'django.contrib.admin.site.register', 'admin.site.register', (['EmailVerify'], {}), '(EmailVerify)\n', (103, 116), False, 'from django.contrib im... |
# Copyright 2021 <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicab... | [
"configargparse.ArgumentParser"
] | [((665, 802), 'configargparse.ArgumentParser', 'configargparse.ArgumentParser', ([], {'prog': '"""NTK GANs"""', 'description': '"""NTK GANs."""', 'formatter_class': 'configargparse.ArgumentDefaultsHelpFormatter'}), "(prog='NTK GANs', description='NTK GANs.',\n formatter_class=configargparse.ArgumentDefaultsHelpForma... |
import graphene
from django.db.models import Q
from graphene import relay
from graphene_django import DjangoObjectType
from graphene_django.registry import Registry
from itdagene.app.career.models import Joblisting as ItdageneJoblisting
from itdagene.app.career.models import Town as ItdageneTown
from itdagene.app.compa... | [
"itdagene.core.models.Preference.current_preference",
"itdagene.core.models.User.objects.filter",
"graphene.NonNull",
"itdagene.app.company.models.Company.get_collaborators",
"graphene_django.registry.Registry",
"itdagene.app.career.models.Joblisting.objects.get",
"graphene.Int",
"itdagene.app.pages.m... | [((3194, 3211), 'graphene.String', 'graphene.String', ([], {}), '()\n', (3209, 3211), False, 'import graphene\n'), ((3223, 3240), 'graphene.String', 'graphene.String', ([], {}), '()\n', (3238, 3240), False, 'import graphene\n'), ((7371, 7388), 'graphene.String', 'graphene.String', ([], {}), '()\n', (7386, 7388), False,... |
from pathlib import Path
import os
text_file = Path(os.getcwd()) / 'pdf_api' /'api_uploaded_files' / 'test.txt'
with open(text_file, 'rb') as f:
output = f.read() | [
"os.getcwd"
] | [((53, 64), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (62, 64), False, 'import os\n')] |
import urllib.request, urllib.parse, urllib.error
from datetime import datetime
import sys
import os
import importlib
importlib.reload(sys) # Reload does the trick!
from src.models import Source, Edam, EdamUrl, EdamAlia, EdamRelation, Ro
from scripts.loading.database_session import get_session
from scripts.loading.ont... | [
"scripts.loading.ontology.read_owl",
"src.models.Edam",
"src.models.EdamRelation",
"importlib.reload",
"scripts.loading.database_session.get_session",
"src.models.EdamAlia",
"src.models.EdamUrl"
] | [((118, 139), 'importlib.reload', 'importlib.reload', (['sys'], {}), '(sys)\n', (134, 139), False, 'import importlib\n'), ((643, 656), 'scripts.loading.database_session.get_session', 'get_session', ([], {}), '()\n', (654, 656), False, 'from scripts.loading.database_session import get_session\n'), ((1613, 1646), 'script... |
import re
pattern = re.compile(r"(\d+([.,]\d*)?|([.,]\d*))([a-zA-Z]+)")
def parse(x = '0.0Da'):
"""Parse a resolution string.
Args:
x (str or float): A string with resolution, like '5ppm', '4mmu', '.02Da'.
Defaults to 'ppm' (i.e. when given a float, treat is a parts per million value).
"... | [
"re.match",
"re.compile"
] | [((21, 74), 're.compile', 're.compile', (['"""(\\\\d+([.,]\\\\d*)?|([.,]\\\\d*))([a-zA-Z]+)"""'], {}), "('(\\\\d+([.,]\\\\d*)?|([.,]\\\\d*))([a-zA-Z]+)')\n", (31, 74), False, 'import re\n'), ((439, 459), 're.match', 're.match', (['pattern', 'x'], {}), '(pattern, x)\n', (447, 459), False, 'import re\n')] |
# Generator functions to generate batches of data.
import numpy as np
import os
import time
import h5py
import matplotlib.pyplot as plt
import collections
from synth.config import config
from synth.utils import utils
def data_gen_SDN(mode = 'Train', sec_mode = 0):
with h5py.File(config.stat_file, mode='r') ... | [
"numpy.random.uniform",
"h5py.File",
"numpy.median",
"numpy.clip",
"numpy.array",
"synth.config.config.singers.index",
"numpy.random.rand",
"os.path.join",
"os.listdir"
] | [((282, 319), 'h5py.File', 'h5py.File', (['config.stat_file'], {'mode': '"""r"""'}), "(config.stat_file, mode='r')\n", (291, 319), False, 'import h5py\n'), ((4725, 4746), 'numpy.array', 'np.array', (['feats_targs'], {}), '(feats_targs)\n', (4733, 4746), True, 'import numpy as np\n'), ((4769, 4790), 'numpy.array', 'np.a... |
import numpy as np
import pandas as pd
import plotly.express as px
georgia_pop = pd.read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-16/georgia_pop.csv')
census = pd.read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-16/cens... | [
"pandas.wide_to_long",
"plotly.graph_objects.Scatter",
"pandas.read_csv",
"plotly.graph_objects.Figure",
"plotly.graph_objects.Bar"
] | [((83, 213), 'pandas.read_csv', 'pd.read_csv', (['"""https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-16/georgia_pop.csv"""'], {}), "(\n 'https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-02-16/georgia_pop.csv'\n )\n", (94, 213), True, 'impor... |
"""Test custom types."""
import pytest
from j5.types import ImmutableDict, ImmutableList
def test_immutable_dict_get_member() -> None:
"""Test that we can get an item from an ImmutableDict."""
d = ImmutableDict[str, str]({'foo': 'bar'})
assert d['foo'] == 'bar'
def test_immutable_dict_iterator() -> No... | [
"pytest.raises",
"j5.types.ImmutableDict",
"j5.types.ImmutableList"
] | [((426, 445), 'j5.types.ImmutableDict', 'ImmutableDict', (['data'], {}), '(data)\n', (439, 445), False, 'from j5.types import ImmutableDict, ImmutableList\n'), ((643, 662), 'j5.types.ImmutableDict', 'ImmutableDict', (['data'], {}), '(data)\n', (656, 662), False, 'from j5.types import ImmutableDict, ImmutableList\n'), (... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from typing import Optional
import requests
try:
import validators # type: ignore
has_validators = True
except ImportError:
has_validators = False
from .abstractgenerator import AbstractMISPObjectGenerator
from .. import InvalidMISPObject
class... | [
"re.match",
"validators.url",
"requests.get"
] | [((2057, 2076), 'validators.url', 'validators.url', (['ioc'], {}), '(ioc)\n', (2071, 2076), False, 'import validators\n'), ((2116, 2188), 're.match', 're.match', (['"""\\\\b([a-fA-F0-9]{32}|[a-fA-F0-9]{40}|[a-fA-F0-9]{64})\\\\b"""', 'ioc'], {}), "('\\\\b([a-fA-F0-9]{32}|[a-fA-F0-9]{40}|[a-fA-F0-9]{64})\\\\b', ioc)\n", ... |
import socket
from .utils.config_file import ConfigFile
class Yaml:
def __init__(self):
self.data = {
'py2030': {
'profiles': {
socket.gethostname().replace('.', '_'): {
'start_event': 'start'
}
}
... | [
"socket.gethostname"
] | [((189, 209), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (207, 209), False, 'import socket\n')] |
# -*- coding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
STOP_RENDERING = runtime.STOP_RENDERING
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 10
_modified_time = 1467226952.515133
_enable_loop = True
_template_filename = '/home/sumukh/Documents/thesis/Cyberweb... | [
"webhelpers.html.escape",
"mako.runtime._inherit_from"
] | [((893, 989), 'mako.runtime._inherit_from', 'runtime._inherit_from', (['context', 'u"""/authentication/authentication.layout.mako"""', '_template_uri'], {}), "(context,\n u'/authentication/authentication.layout.mako', _template_uri)\n", (914, 989), False, 'from mako import runtime, filters, cache\n'), ((1843, 1857),... |
import pyautogui as pag
import time
import sys
args = sys.argv
if len(args) != 2:
print("Please specify the file path of the script you would like to run.")
quit()
script = open(sys.argv[1])
lines = script.readlines()
for line in lines:
print(line)
command = line.split(None, 1)[0].lowe... | [
"pyautogui.typewrite",
"pyautogui.hotkey"
] | [((598, 636), 'pyautogui.typewrite', 'pag.typewrite', (['parameter'], {'interval': '(0.1)'}), '(parameter, interval=0.1)\n', (611, 636), True, 'import pyautogui as pag\n'), ((751, 789), 'pyautogui.typewrite', 'pag.typewrite', (["['enter']"], {'interval': '(0.1)'}), "(['enter'], interval=0.1)\n", (764, 789), True, 'impo... |
"""
Copyright 2020 The Secure, Reliable, and Intelligent Systems Lab, ETH Zurich
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by appl... | [
"torch.cat",
"torch.nn.Linear"
] | [((972, 1001), 'torch.nn.Linear', 'nn.Linear', (['self.hidden_dim', '(1)'], {}), '(self.hidden_dim, 1)\n', (981, 1001), True, 'import torch.nn as nn\n'), ((2070, 2109), 'torch.cat', 'torch.cat', (['[output, next_return]'], {'dim': '(1)'}), '([output, next_return], dim=1)\n', (2079, 2109), False, 'import torch\n'), ((23... |
from django.shortcuts import render
from django.http import HttpResponse
import json
from chvi import nmt
import time
# Create your views here.
def index(request):
return render(request, 'index.html')
def trans(request):
if request.method == 'POST':
ch = request.POST['ch']
if ch == '':
... | [
"django.shortcuts.render",
"chvi.nmt.sent",
"json.dumps",
"time.sleep"
] | [((178, 207), 'django.shortcuts.render', 'render', (['request', '"""index.html"""'], {}), "(request, 'index.html')\n", (184, 207), False, 'from django.shortcuts import render\n'), ((1388, 1429), 'json.dumps', 'json.dumps', (["{'success': 'true', 'vi': vi}"], {}), "({'success': 'true', 'vi': vi})\n", (1398, 1429), False... |
from django.http import JsonResponse, HttpResponse
from django.views import View
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic.edit import BaseDeleteView
from postoffice_django.models import PublishingError
from postoffice_django.ser... | [
"django.utils.decorators.method_decorator",
"django.http.HttpResponse",
"postoffice_django.models.PublishingError.objects.all",
"django.http.JsonResponse",
"postoffice_django.serializers.MessagesSerializer",
"postoffice_django.models.PublishingError.objects.order_by"
] | [((814, 860), 'django.utils.decorators.method_decorator', 'method_decorator', (['csrf_exempt'], {'name': '"""dispatch"""'}), "(csrf_exempt, name='dispatch')\n", (830, 860), False, 'from django.utils.decorators import method_decorator\n'), ((917, 946), 'postoffice_django.models.PublishingError.objects.all', 'PublishingE... |
# %%
from oas_dev.util.imports.get_fld_fixed import get_field_fixed
from oas_dev.util.plot.plot_maps import plot_map_diff, fix_axis4map_plot, plot_map_abs_abs_diff, plot_map, subplots_map, plot_map_diff_2case
from useful_scit.imps import (np, xr, plt, pd)
from oas_dev.util.imports import get_averaged_fields
from IPytho... | [
"IPython.get_ipython",
"oas_dev.util.imports.get_fld_fixed.get_field_fixed",
"oas_dev.util.imports.get_averaged_fields.get_maps_cases"
] | [((2865, 3028), 'oas_dev.util.imports.get_averaged_fields.get_maps_cases', 'get_averaged_fields.get_maps_cases', (['cases', 'varl', 'startyear', 'endyear'], {'avg_over_lev': 'avg_over_lev', 'pmin': 'pmin', 'pressure_adjust': 'pressure_adjust', 'p_level': 'p_level'}), '(cases, varl, startyear, endyear,\n avg_over_lev... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###########################################################
# WARNING: Generated code! #
# ************************** #
# Manual changes may get lost if file is generated again. #
# Only code inside the [MANUAL] ta... | [
"ariac_support_flexbe_states.equal_state.EqualState",
"ariac_logistics_flexbe_states.get_part_from_products_state.GetPartFromProductsState",
"ariac_support_flexbe_states.add_numeric_state.AddNumericState",
"ariac_flexbe_states.message_state.MessageState",
"flexbe_core.OperatableStateMachine",
"ariac_suppo... | [((1928, 2031), 'flexbe_core.OperatableStateMachine', 'OperatableStateMachine', ([], {'outcomes': "['finished', 'fail']", 'input_keys': "['Products', 'NumberOfProducts']"}), "(outcomes=['finished', 'fail'], input_keys=[\n 'Products', 'NumberOfProducts'])\n", (1950, 2031), False, 'from flexbe_core import Behavior, Au... |
from conans.model import Generator
import platform
import os
import copy
from conans.errors import ConanException
def get_setenv_variables_commands(deps_env_info, command_set=None):
if command_set is None:
command_set = "SET" if platform.system() == "Windows" else "export"
multiple_to_set, simple_to_... | [
"os.pathsep.join",
"os.path.basename",
"os.linesep.join",
"copy.copy",
"os.environ.get",
"platform.system"
] | [((1882, 1908), 'copy.copy', 'copy.copy', (['multiple_to_set'], {}), '(multiple_to_set)\n', (1891, 1908), False, 'import copy\n'), ((1968, 2020), 'os.path.basename', 'os.path.basename', (['self.conanfile.conanfile_directory'], {}), '(self.conanfile.conanfile_directory)\n', (1984, 2020), False, 'import os\n'), ((429, 44... |
from Utils import ResponseManager, LogManager
from Setting import DefineManager
def CheckVersion():
version = DefineManager.VERSION
LogManager.PrintLogMessage("SystemManager", "CheckVersion", "this version is " + version, DefineManager.LOG_LEVEL_INFO)
return ResponseManager.TemplateOfResponse(DefineManager... | [
"Utils.LogManager.PrintLogMessage",
"Utils.ResponseManager.TemplateOfResponse"
] | [((141, 265), 'Utils.LogManager.PrintLogMessage', 'LogManager.PrintLogMessage', (['"""SystemManager"""', '"""CheckVersion"""', "('this version is ' + version)", 'DefineManager.LOG_LEVEL_INFO'], {}), "('SystemManager', 'CheckVersion', \n 'this version is ' + version, DefineManager.LOG_LEVEL_INFO)\n", (167, 265), Fals... |
from pathlib import Path
import numpy as np
import pytest
from divorce_predictor.data import DataLoader
def test_load_data_successfully():
dataset_path = (
Path(__file__).parent.parent.parent / "ml" / "input" / "data" / "divorce.csv"
)
data_loader = DataLoader(dataset_path=dataset_path, target_c... | [
"pytest.raises",
"divorce_predictor.data.DataLoader",
"pathlib.Path"
] | [((274, 334), 'divorce_predictor.data.DataLoader', 'DataLoader', ([], {'dataset_path': 'dataset_path', 'target_column': '"""Class"""'}), "(dataset_path=dataset_path, target_column='Class')\n", (284, 334), False, 'from divorce_predictor.data import DataLoader\n'), ((528, 544), 'pathlib.Path', 'Path', (['"""bulhufas"""']... |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/110_models.mWDN.ipynb (unless otherwise specified).
__all__ = ['WaveBlock', 'mWDN']
# Cell
from ..imports import *
from .layers import *
from .InceptionTime import *
from .utils import create_model
# Cell
import pywt
# Cell
# This is an unofficial PyTorch implementati... | [
"pywt.Wavelet"
] | [((961, 982), 'pywt.Wavelet', 'pywt.Wavelet', (['wavelet'], {}), '(wavelet)\n', (973, 982), False, 'import pywt\n')] |
#!/usr/bin/python
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | [
"embed_utils.CodeWriter",
"json.load",
"argparse.ArgumentParser"
] | [((1340, 1370), 'embed_utils.CodeWriter', 'embed_utils.CodeWriter', (['output'], {}), '(output)\n', (1362, 1370), False, 'import embed_utils\n'), ((2509, 2553), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (2532, 2553), False, 'import argparse\n'), (... |
import numpy as np
import pandas as pd
import scipy.sparse as sp
from sklearn.metrics.pairwise import cosine_similarity
class Evaluator():
def __init__(self, k=10, training_set=None, testing_set=None, book_sim=None, novelty_scores=None):
self.k = k
self.book_sim = book_sim
self.novelty_scor... | [
"pandas.DataFrame",
"sklearn.metrics.pairwise.cosine_similarity",
"numpy.triu_indices",
"numpy.mean",
"scipy.sparse.csr_matrix",
"numpy.in1d"
] | [((925, 945), 'numpy.in1d', 'np.in1d', (['pred', 'truth'], {}), '(pred, truth)\n', (932, 945), True, 'import numpy as np\n'), ((1977, 2001), 'scipy.sparse.csr_matrix', 'sp.csr_matrix', (['df.values'], {}), '(df.values)\n', (1990, 2001), True, 'import scipy.sparse as sp\n'), ((2091, 2138), 'sklearn.metrics.pairwise.cosi... |
#
# Copyright 2015 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | [
"ctypes.sizeof",
"pandas.Series"
] | [((999, 1023), 'pandas.Series', 'pd.Series', (['_inttypes_map'], {}), '(_inttypes_map)\n', (1008, 1023), True, 'import pandas as pd\n'), ((850, 859), 'ctypes.sizeof', 'sizeof', (['t'], {}), '(t)\n', (856, 859), False, 'from ctypes import Structure, c_ubyte, c_uint, c_ulong, c_ulonglong, c_ushort, sizeof\n')] |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestCashFlowMapping(unittest.TestCase):
def setUp(self):
if frappe.db.exists("Cash Flow Mapping", "Test Mapping"):
frappe.de... | [
"frappe.delete_doc",
"frappe.db.exists",
"frappe.new_doc"
] | [((253, 306), 'frappe.db.exists', 'frappe.db.exists', (['"""Cash Flow Mapping"""', '"""Test Mapping"""'], {}), "('Cash Flow Mapping', 'Test Mapping')\n", (269, 306), False, 'import frappe\n'), ((391, 445), 'frappe.delete_doc', 'frappe.delete_doc', (['"""Cash Flow Mapping"""', '"""Test Mapping"""'], {}), "('Cash Flow Ma... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
#
# invenio-app-ils is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Invenio App ILS Records views."""
from __future__ import absolute_import, print_function
from flask import Bl... | [
"flask.Blueprint",
"invenio_records_rest.utils.obj_or_import_string",
"invenio_app_ils.relations.api.Relation.get_relation_by_name",
"invenio_app_ils.records_relations.api.RecordRelationsSiblings",
"invenio_app_ils.records_relations.api.RecordRelationsParentChild",
"invenio_app_ils.permissions.need_permis... | [((2051, 2114), 'flask.Blueprint', 'Blueprint', (['"""invenio_app_ils_relations"""', '__name__'], {'url_prefix': '""""""'}), "('invenio_app_ils_relations', __name__, url_prefix='')\n", (2060, 2114), False, 'from flask import Blueprint, abort, current_app, request\n'), ((7669, 7705), 'invenio_app_ils.permissions.need_pe... |
from tkinter import *
from tkinter import ttk
def DECABIT_FRAME(master=None):
s = ttk.Style(master)
s.theme_use('awdark') | [
"tkinter.ttk.Style"
] | [((90, 107), 'tkinter.ttk.Style', 'ttk.Style', (['master'], {}), '(master)\n', (99, 107), False, 'from tkinter import ttk\n')] |
import bpy
from bpy.props import (StringProperty,
BoolProperty,
CollectionProperty,
IntProperty,
FloatProperty,
PointerProperty
)
from .shared_operators import UITools
from ...libra... | [
"bpy.props.BoolProperty",
"bpy.props.FloatProperty",
"bpy.props.StringProperty",
"bpy.props.IntProperty"
] | [((1139, 1155), 'bpy.props.StringProperty', 'StringProperty', ([], {}), '()\n', (1153, 1155), False, 'from bpy.props import StringProperty, BoolProperty, CollectionProperty, IntProperty, FloatProperty, PointerProperty\n'), ((1168, 1195), 'bpy.props.BoolProperty', 'BoolProperty', ([], {'name': '"""stereo"""'}), "(name='... |
import time
import lib.getconfig
import logging.handlers
log_file = lib.getconfig.getparam('daemon', 'log_file')
backupcount = int(lib.getconfig.getparam('daemon', 'log_rotate_seconds'))
seconds = int(lib.getconfig.getparam('daemon', 'log_rotate_backups'))
log = logging.handlers.TimedRotatingFileHandler(log_file, 's... | [
"time.strftime"
] | [((542, 573), 'time.strftime', 'time.strftime', (['"""[%F %H %M:%S] """'], {}), "('[%F %H %M:%S] ')\n", (555, 573), False, 'import time\n')] |
import numpy as np
import tensorflow as tf
from ops import instance_norm, conv2d, deconv2d, lrelu
######################################################################
def generator_multiunet(image, gf_dim, reuse=False, name="generator", output_c_dim=-1, istraining=True):
if istraining:
dropout_rate =... | [
"tensorflow.nn.relu",
"tensorflow.nn.tanh",
"ops.lrelu",
"tensorflow.get_variable_scope",
"tensorflow.variable_scope",
"ops.conv2d",
"ops.instance_norm",
"tensorflow.nn.dropout"
] | [((376, 399), 'tensorflow.variable_scope', 'tf.variable_scope', (['name'], {}), '(name)\n', (393, 399), True, 'import tensorflow as tf\n'), ((1830, 1861), 'tensorflow.nn.dropout', 'tf.nn.dropout', (['d1', 'dropout_rate'], {}), '(d1, dropout_rate)\n', (1843, 1861), True, 'import tensorflow as tf\n'), ((2071, 2102), 'ten... |
# Program 19d: Generalized synchronization.
# See Figure 19.8(a).
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
# Constants
mu = 5.7
sigma = 16
b = 4
r = 45.92
g = 8 # When g=4, there is no synchronization.
tmax = 100
t = np.arange(0.0, tmax, 0.1)
def rossler_lorenz_odes(X,t... | [
"matplotlib.pyplot.show",
"scipy.integrate.odeint",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((266, 291), 'numpy.arange', 'np.arange', (['(0.0)', 'tmax', '(0.1)'], {}), '(0.0, tmax, 0.1)\n', (275, 291), True, 'import numpy as np\n'), ((740, 786), 'scipy.integrate.odeint', 'odeint', (['rossler_lorenz_odes', 'y0', 't'], {'rtol': '(1e-06)'}), '(rossler_lorenz_odes, y0, t, rtol=1e-06)\n', (746, 786), False, 'from... |
from unittest.mock import patch
import boto3
from moto import mock_s3
from urlpath import URL
from deafrica.monitoring import s2_gap_report
from deafrica.monitoring.s2_gap_report import (
get_and_filter_cogs_keys,
generate_buckets_diff,
)
from deafrica.tests.conftest import (
COGS_REGION,
INVENTORY_BU... | [
"boto3.client",
"urlpath.URL",
"deafrica.monitoring.s2_gap_report.generate_buckets_diff",
"deafrica.monitoring.s2_gap_report.get_and_filter_cogs_keys",
"boto3.resource"
] | [((808, 851), 'boto3.client', 'boto3.client', (['"""s3"""'], {'region_name': 'COGS_REGION'}), "('s3', region_name=COGS_REGION)\n", (820, 851), False, 'import boto3\n'), ((1469, 1554), 'urlpath.URL', 'URL', (['f"""s3://{INVENTORY_BUCKET_NAME}/{INVENTORY_FOLDER}/{INVENTORY_BUCKET_NAME}/"""'], {}), "(f's3://{INVENTORY_BUC... |
from django.contrib import admin
from .models import Post, Thahood, UserProfile, Business
# Register your models here.
admin.site.register(Post)
admin.site.register(UserProfile)
admin.site.register(Thahood)
admin.site.register(Business) | [
"django.contrib.admin.site.register"
] | [((120, 145), 'django.contrib.admin.site.register', 'admin.site.register', (['Post'], {}), '(Post)\n', (139, 145), False, 'from django.contrib import admin\n'), ((146, 178), 'django.contrib.admin.site.register', 'admin.site.register', (['UserProfile'], {}), '(UserProfile)\n', (165, 178), False, 'from django.contrib imp... |
"""Implementation of a possibly bounded uniform experience replay manager."""
import random
from typing import List, Optional
from decuen.memories._memory import Memory
from decuen.structs import Trajectory, Transition
class UniformMemory(Memory):
"""Sized uniform memory mechanism, stores memories up to a maxim... | [
"random.choices"
] | [((1332, 1378), 'random.choices', 'random.choices', (['self._transition_buffer'], {'k': 'num'}), '(self._transition_buffer, k=num)\n', (1346, 1378), False, 'import random\n'), ((1871, 1917), 'random.choices', 'random.choices', (['self._trajectory_buffer'], {'k': 'num'}), '(self._trajectory_buffer, k=num)\n', (1885, 191... |
import numpy as np
from tspdb.src.pindex.predict import get_prediction_range, get_prediction
from tspdb.src.pindex.pindex_managment import TSPI
from tspdb.src.pindex.pindex_utils import index_ts_mapper
import time
import timeit
import pandas as pd
from tspdb.src.hdf_util import read_data
from tspdb.src.tsUti... | [
"pandas.DataFrame",
"pandas.date_range",
"pandas.read_csv",
"numpy.zeros",
"numpy.ones",
"numpy.mean",
"tspdb.src.hdf_util.read_data",
"numpy.arange",
"numpy.array",
"tspdb.src.pindex.pindex_managment.TSPI"
] | [((645, 664), 'numpy.zeros', 'np.zeros', (['obs.shape'], {}), '(obs.shape)\n', (653, 664), True, 'import numpy as np\n'), ((791, 883), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': "{'ts': obs, 'means': means, 'ts_9': obs_9, 'ts_7': obs_7, 'var': var}"}), "(data={'ts': obs, 'means': means, 'ts_9': obs_9, 'ts_7': ob... |
from sys import version_info
if version_info[0] == 2:
from sys import maxint
else:
from sys import maxsize as maxint
from itertools import chain
from .iters import map, range
class Stream(object):
__slots__ = ("_last", "_collection", "_origin")
class _StreamIterator(object):
__slot... | [
"itertools.chain"
] | [((1216, 1245), 'itertools.chain', 'chain', (['self._origin', 'iterator'], {}), '(self._origin, iterator)\n', (1221, 1245), False, 'from itertools import chain\n')] |
# 10/4/18
# chenyong
# predict leaf counts using trained model
"""
Make predictions of Leaf counts using trained models
"""
import os.path as op
import sys
import numpy as np
import pandas as pd
import pickle
import matplotlib.pyplot as plt
import matplotlib as mpl
from PIL import Image
from schnablelab.apps.base imp... | [
"keras.models.load_model",
"pandas.DataFrame",
"numpy.asarray",
"pathlib.Path",
"schnablelab.apps.base.ActionDispatcher",
"schnablelab.apps.base.OptionParser",
"cv2.resize"
] | [((750, 775), 'schnablelab.apps.base.ActionDispatcher', 'ActionDispatcher', (['actions'], {}), '(actions)\n', (766, 775), False, 'from schnablelab.apps.base import ActionDispatcher, OptionParser, glob\n'), ((938, 963), 'schnablelab.apps.base.OptionParser', 'OptionParser', (['dpp.__doc__'], {}), '(dpp.__doc__)\n', (950,... |
import traceback
from twisted.application import service
from twisted.internet import reactor, task
from spyd.server.binding.binding import Binding
from spyd.server.metrics.rate_aggregator import RateAggregator
class BindingService(service.Service):
def __init__(self, client_protocol_factory, metrics_service):
... | [
"traceback.print_exc",
"twisted.internet.reactor.addSystemEventTrigger",
"spyd.server.binding.binding.Binding",
"twisted.application.service.Service.startService",
"twisted.application.service.Service.stopService",
"spyd.server.metrics.rate_aggregator.RateAggregator",
"twisted.internet.task.LoopingCall"... | [((500, 554), 'spyd.server.metrics.rate_aggregator.RateAggregator', 'RateAggregator', (['metrics_service', '"""flush_all_rate"""', '(1.0)'], {}), "(metrics_service, 'flush_all_rate', 1.0)\n", (514, 554), False, 'from spyd.server.metrics.rate_aggregator import RateAggregator\n'), ((564, 637), 'twisted.internet.reactor.a... |
import responses
from tests.ad.conftest import RE_BASE
@responses.activate
def test_profiles_list(api):
responses.add(responses.GET,
f'{RE_BASE}/profiles',
json=[{
'id': 1,
'name': 'profile name',
'deleted': Fal... | [
"responses.add"
] | [((111, 298), 'responses.add', 'responses.add', (['responses.GET', 'f"""{RE_BASE}/profiles"""'], {'json': "[{'id': 1, 'name': 'profile name', 'deleted': False, 'directories': [1, 2],\n 'dirty': True, 'hasEverBeenCommitted': True}]"}), "(responses.GET, f'{RE_BASE}/profiles', json=[{'id': 1, 'name':\n 'profile name... |
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
siteTitle = 'siteIndex'
name = 'Tuomo'
listOfThings = ['A thing', 'The Thing', 'Thing', 'A Big Thing']
return render_template('base.html',
name=name,
siteTitle=siteTitle,
listOfThings=listOfThings)... | [
"flask.Flask",
"flask.render_template"
] | [((47, 62), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (52, 62), False, 'from flask import Flask, render_template\n'), ((219, 311), 'flask.render_template', 'render_template', (['"""base.html"""'], {'name': 'name', 'siteTitle': 'siteTitle', 'listOfThings': 'listOfThings'}), "('base.html', name=name, si... |
##file needed to manage and run code without the debug/ how you run a flask script
from flask_script import Manager
from songbase import app
from songbase import app, db, Artist, Song
manager = Manager(app)
# reset the database and create two artists
@manager.command
def deploy():
db.drop_all()
db.create_al... | [
"flask_script.Manager",
"songbase.db.session.add",
"songbase.db.session.commit",
"songbase.db.drop_all",
"songbase.Artist",
"songbase.db.create_all",
"songbase.Song"
] | [((196, 208), 'flask_script.Manager', 'Manager', (['app'], {}), '(app)\n', (203, 208), False, 'from flask_script import Manager\n'), ((290, 303), 'songbase.db.drop_all', 'db.drop_all', ([], {}), '()\n', (301, 303), False, 'from songbase import app, db, Artist, Song\n'), ((308, 323), 'songbase.db.create_all', 'db.create... |
import random
from pathlib import Path
from pkg_resources import resource_filename as _resource_filename
from ..toolz import (
pipe, curry, compose, memoize, concatv, groupby, take,
filter, map, strip_comments, sort_by, vmap, get, noop,
)
resource_filename = curry(_resource_filename)(__name__)
path = compose... | [
"pathlib.Path"
] | [((378, 385), 'pathlib.Path', 'Path', (['p'], {}), '(p)\n', (382, 385), False, 'from pathlib import Path\n'), ((650, 660), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (654, 660), False, 'from pathlib import Path\n')] |
import pytest
import allure
from Ar_Script.Meetu_Ui_Test.Pages.base_page import *
import json
from appium import webdriver
import time
import os
import openpyxl
from Ar_Script.Meetu_Ui_Test.common.get_info import get_meminfo_data,saveData,get_cpu_data,get_activity_name
from Ar_Script.Meetu_Ui_Test.common.app_command im... | [
"json.load",
"logging.debug",
"allure.story",
"pytest.main",
"appium.webdriver.Remote",
"pytest.mark.parametrize",
"os.chdir",
"Ar_Script.Meetu_Ui_Test.common.get_info.get_meminfo_data"
] | [((1912, 1939), 'allure.story', 'allure.story', (['"""重复启动app内存测试"""'], {}), "('重复启动app内存测试')\n", (1924, 1939), False, 'import allure\n'), ((1945, 2055), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""package,activity"""', "[('com.social.nene', 'com.funny.lovu.splash.LaunchActivity')]"], {}), "('package,ac... |
import unittest
import asyncio
import motor.motor_asyncio
import city_generator
client = motor.motor_asyncio.AsyncIOMotorClient('localhost', 27017)
db = client.local
loop = asyncio.get_event_loop()
async def get_all_cities(cap=500) -> list:
return await db.Cities.find({}).to_list(cap)
async def get_city_by_inde... | [
"unittest.main",
"asyncio.get_event_loop",
"city_generator.generate_state",
"city_generator.remove_cities",
"city_generator.replace_city",
"city_generator.get_city",
"city_generator.insert_city"
] | [((175, 199), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (197, 199), False, 'import asyncio\n'), ((2053, 2068), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2066, 2068), False, 'import unittest\n'), ((510, 540), 'city_generator.remove_cities', 'city_generator.remove_cities', ([], {}),... |