code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""Transforms the XML module definitions parsed from the PDF into a verilog representation"""
from lxml import etree
from datetime import datetime
def format_port(name, width, type, **kwargs):
wstr = '' if int(width) == 1 else '[%s:0]\t' % width
return '\t%s\t%s%s;\n' % (type, wstr, name)
def format_attrib(... | [
"lxml.etree.parse",
"datetime.datetime.now",
"argparse.ArgumentParser"
] | [((546, 565), 'lxml.etree.parse', 'etree.parse', (['infile'], {}), '(infile)\n', (557, 565), False, 'from lxml import etree\n'), ((1470, 1495), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1493, 1495), False, 'import argparse\n'), ((735, 749), 'datetime.datetime.now', 'datetime.now', ([], {}... |
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 14 10:40:39 2016
Converting reflectance spectrum to a CIE coordinate
@author: Bonan
"""
import numpy as np
from scipy import interpolate
import os
# Adobe RGB (1998) D65 as reference white
# http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_RGB.html
_RGB_to_XYZ = np.arra... | [
"matplotlib.pyplot.title",
"numpy.sum",
"os.path.join",
"os.path.dirname",
"matplotlib.pyplot.legend",
"numpy.sin",
"numpy.array",
"numpy.loadtxt",
"numpy.linspace",
"scipy.interpolate.splev",
"numpy.dot",
"scipy.interpolate.splrep"
] | [((313, 432), 'numpy.array', 'np.array', (['[[0.5767309, 0.185554, 0.1881852], [0.2973769, 0.6273491, 0.0752741], [\n 0.0270343, 0.0706872, 0.9911085]]'], {}), '([[0.5767309, 0.185554, 0.1881852], [0.2973769, 0.6273491, \n 0.0752741], [0.0270343, 0.0706872, 0.9911085]])\n', (321, 432), True, 'import numpy as np\n... |
from pathlib import Path
from typing import Dict
from environs import Env
from furl import furl
from .utils import FilterSettings
env = Env()
DEBUG = False
BASE_DIR = Path(__file__).parent.parent
LOCALES_DIR = BASE_DIR / "locales"
I18N_DOMAIN = "messages"
BOT_TOKEN = env("BOT_TOKEN")
ADMINS = env.list("ADMINS"... | [
"pathlib.Path",
"furl.furl",
"environs.Env"
] | [((139, 144), 'environs.Env', 'Env', ([], {}), '()\n', (142, 144), False, 'from environs import Env\n'), ((172, 186), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (176, 186), False, 'from pathlib import Path\n'), ((379, 393), 'furl.furl', 'furl', (['BASE_URL'], {}), '(BASE_URL)\n', (383, 393), False, 'fr... |
'''
Nesse exer você deve casar linha que tenham 'b' ou 'c' seguido de uma vogal,
duas vezes seguidas.
exemplo: "baba", "caca", ou "cabo"
Para fixação, usar o '[]' (lista).
'''
import re
import sys
REGEX = r''
lines = sys.stdin.readlines()
for line in lines:
if re.search(REGEX, line):
print(line.replace... | [
"re.search",
"sys.stdin.readlines"
] | [((221, 242), 'sys.stdin.readlines', 'sys.stdin.readlines', ([], {}), '()\n', (240, 242), False, 'import sys\n'), ((270, 292), 're.search', 're.search', (['REGEX', 'line'], {}), '(REGEX, line)\n', (279, 292), False, 'import re\n')] |
import h5py
import tables
import numpy as np
import sys
args=int(sys.argv[1])
# Read hdf5 file
h5file = tables.open_file(f"./data/atraining-{args}.h5", "r")
WaveformTable = h5file.root.Waveform
GroundTruthTable = h5file.root.GroundTruth
sinevet,sinchan,sintime=[],[],[]
#根据groundtruth找出只有单光子的事例
i=1
while i <100000:
... | [
"h5py.File",
"numpy.average",
"numpy.zeros",
"numpy.append",
"numpy.array",
"tables.open_file"
] | [((105, 157), 'tables.open_file', 'tables.open_file', (['f"""./data/atraining-{args}.h5"""', '"""r"""'], {}), "(f'./data/atraining-{args}.h5', 'r')\n", (121, 157), False, 'import tables\n'), ((665, 695), 'numpy.zeros', 'np.zeros', (['(1029)'], {'dtype': 'np.int32'}), '(1029, dtype=np.int32)\n', (673, 695), True, 'impor... |
from brownie import LinearVesting, Contract
from scripts.helper_functions import get_account
custom_token_address = "0x61c2984d0D60e8C498bdEE6dbE4A4E83E53ecfE8"
amount = 1000000 * 10 ** 18
def deploy():
account = get_account()
publish_source = True
vesting = LinearVesting.deploy(
custom_token_add... | [
"brownie.Contract",
"brownie.LinearVesting.deploy",
"scripts.helper_functions.get_account"
] | [((220, 233), 'scripts.helper_functions.get_account', 'get_account', ([], {}), '()\n', (231, 233), False, 'from scripts.helper_functions import get_account\n'), ((274, 370), 'brownie.LinearVesting.deploy', 'LinearVesting.deploy', (['custom_token_address', "{'from': account}"], {'publish_source': 'publish_source'}), "(c... |
from classifier.dataset_readers.dataset_reader import ClassificationTsvReader
from classifier.dataset_readers.dataset_reader_pt import ClassificationPtTsvReader
from allennlp.common.util import ensure_list
def test_rey_reader_1(project_root_dir_path, test_fixtures_dir_path, test_log):
data_file_path = test_fixtur... | [
"classifier.dataset_readers.dataset_reader_pt.ClassificationPtTsvReader",
"classifier.dataset_readers.dataset_reader.ClassificationTsvReader"
] | [((372, 397), 'classifier.dataset_readers.dataset_reader.ClassificationTsvReader', 'ClassificationTsvReader', ([], {}), '()\n', (395, 397), False, 'from classifier.dataset_readers.dataset_reader import ClassificationTsvReader\n'), ((776, 803), 'classifier.dataset_readers.dataset_reader_pt.ClassificationPtTsvReader', 'C... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A custom script example that utilizes the .JSON contents of the tryjob."""
from __future__ import print... | [
"json.load",
"sys.exit"
] | [((1084, 1096), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1093, 1096), False, 'import json\n'), ((1479, 1492), 'sys.exit', 'sys.exit', (['(124)'], {}), '(124)\n', (1487, 1492), False, 'import sys\n'), ((1843, 1854), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1851, 1854), False, 'import sys\n'), ((1399, 141... |
from flask import render_template, url_for
# importation de render_template (pour relier les templates aux routes) et d'url_for (pour construire des URL vers les
# fonctions et les pages html)
from ..app import app
# importation de la variable app qui instancie l'application
# | ROUTES POUR LES ERREURS COURANTES |
@... | [
"flask.render_template"
] | [((545, 578), 'flask.render_template', 'render_template', (['"""error/401.html"""'], {}), "('error/401.html')\n", (560, 578), False, 'from flask import render_template, url_for\n'), ((810, 843), 'flask.render_template', 'render_template', (['"""error/404.html"""'], {}), "('error/404.html')\n", (825, 843), False, 'from ... |
from pathlib import Path
from typing import Union
__all__ = ("ScreenshotPath",)
class ScreenshotPath:
def __init__(self, dir_: Path) -> None:
self.dir = dir_
self.rerun: Union[int, None] = None
self.timestamp: Union[int, None] = None
self.scenario_path: Union[Path, None] = None
... | [
"pathlib.Path"
] | [((590, 596), 'pathlib.Path', 'Path', ([], {}), '()\n', (594, 596), False, 'from pathlib import Path\n')] |
import tensorflow as tf
import dataIO
import numpy as np
from datetime import datetime
from model import model
from parameters import *
# preprocess input data
def prepareDataTraining(seg_data, somae_data_raw):
somae_data = seg_data.copy()
somae_data[somae_data_raw==0]=0
seg_data = seg_data[:,:network_si... | [
"tensorflow.keras.metrics.FalseNegatives",
"numpy.arange",
"numpy.unique",
"tensorflow.math.log",
"tensorflow.keras.metrics.TrueNegatives",
"tensorflow.keras.metrics.FalsePositives",
"model.model",
"numpy.max",
"numpy.random.choice",
"datetime.datetime.now",
"tensorflow.initializers.RandomNormal... | [((486, 589), 'numpy.zeros', 'np.zeros', (['(seg_data.shape[0], seg_data.shape[1], seg_data.shape[2], depth * 2 + 1)'], {'dtype': 'np.uint8'}), '((seg_data.shape[0], seg_data.shape[1], seg_data.shape[2], depth * \n 2 + 1), dtype=np.uint8)\n', (494, 589), True, 'import numpy as np\n'), ((1085, 1126), 'numpy.random.pe... |
import os
import platform
import pytest
from mist.action_run import execute_from_text
CHECK_FILE = "scopes.mist"
@pytest.mark.asyncio
async def test_check_if_bool_functions(examples_path):
with open(os.path.join(examples_path, CHECK_FILE), "r") as f:
content = f.read()
output = await execute_from_te... | [
"mist.action_run.execute_from_text",
"os.path.join"
] | [((305, 331), 'mist.action_run.execute_from_text', 'execute_from_text', (['content'], {}), '(content)\n', (322, 331), False, 'from mist.action_run import execute_from_text\n'), ((206, 245), 'os.path.join', 'os.path.join', (['examples_path', 'CHECK_FILE'], {}), '(examples_path, CHECK_FILE)\n', (218, 245), False, 'import... |
import pytest
from unittest.mock import patch
import headlock.c_data_model as cdm
from headlock.address_space.virtual import VirtualAddressSpace
@pytest.fixture
def carray_type(cint_type, addrspace):
return cdm.CArrayType(cint_type, 10, addrspace)
class TestCArrayType:
def test_init_returnsArrayCProxy(se... | [
"unittest.mock.patch.object",
"headlock.c_data_model.CIntType",
"headlock.c_data_model.CPointerType",
"headlock.c_data_model.CArray",
"headlock.c_data_model.CArrayType",
"pytest.raises",
"headlock.c_data_model.CProxyType",
"pytest.mark.parametrize",
"headlock.address_space.virtual.VirtualAddressSpac... | [((215, 255), 'headlock.c_data_model.CArrayType', 'cdm.CArrayType', (['cint_type', '(10)', 'addrspace'], {}), '(cint_type, 10, addrspace)\n', (229, 255), True, 'import headlock.c_data_model as cdm\n'), ((2267, 2305), 'unittest.mock.patch.object', 'patch.object', (['cdm.CIntType', '"""null_val"""'], {}), "(cdm.CIntType,... |
'''
Handle transactional file via github's labgaif/td2dot.py
Similar to integration tests inside maindecomposition but
trying them "from outside file".
Yesterday I got some strange error in the union/find str
but I cannot reproduce it anymore :(
It read:
if x.parent == x:
AttributeError: 'str' object has no attribu... | [
"maindecomposition.stdGgraph",
"td2dot.read_graph_in",
"maindecomposition.hack_graph_in",
"maindecomposition.decompose",
"maindecomposition.hack_items_in"
] | [((588, 622), 'td2dot.read_graph_in', 'read_graph_in', (["(datasetfile + '.td')"], {}), "(datasetfile + '.td')\n", (601, 622), False, 'from td2dot import read_graph_in\n'), ((873, 893), 'maindecomposition.hack_items_in', 'hack_items_in', (['items'], {}), '(items)\n', (886, 893), False, 'from maindecomposition import de... |
import numpy as np
# Select dataset
dataset = ['A', 'B', 'C']
dataset_id = 0
print(dataset[dataset_id])
# Select model
models = ['fNIRS-T', 'fNIRS-PreT']
models_id = 0
print(models[models_id])
test_acc = []
for tr in range(1, 26):
path = 'save/' + dataset[dataset_id] + '/KFold/' + models[models_id] + '/' + str(... | [
"numpy.std",
"numpy.mean",
"numpy.array"
] | [((511, 529), 'numpy.array', 'np.array', (['test_acc'], {}), '(test_acc)\n', (519, 529), True, 'import numpy as np\n'), ((552, 569), 'numpy.mean', 'np.mean', (['test_acc'], {}), '(test_acc)\n', (559, 569), True, 'import numpy as np\n'), ((592, 608), 'numpy.std', 'np.std', (['test_acc'], {}), '(test_acc)\n', (598, 608),... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from asyncio.log import logger
from typing import List
from torch.nn import Module
from torch.nn.modules.loss import _Loss
from torch.optim import Optimizer
from colossalai.logging import get_dist_logger
from torch import Tensor
from colossalai.engine.ophooks import reg... | [
"asyncio.log.logger.warning",
"colossalai.logging.get_dist_logger",
"colossalai.engine.ophooks.register_ophooks_recursively"
] | [((2942, 2959), 'colossalai.logging.get_dist_logger', 'get_dist_logger', ([], {}), '()\n', (2957, 2959), False, 'from colossalai.logging import get_dist_logger\n'), ((3328, 3388), 'colossalai.engine.ophooks.register_ophooks_recursively', 'register_ophooks_recursively', (['self._model', 'self._ophook_list'], {}), '(self... |
import torch
import os
def download_process_data(path="colab_demo"):
os.makedirs(path, exist_ok=True)
print("Downloading data")
torch.hub.download_url_to_file('https://image-editing-test-12345.s3-us-west-2.amazonaws.com/colab_examples/lsun_bedroom1.pth', os.path.join(path, 'lsun_bedroom1.pth'))
torch.... | [
"os.path.join",
"os.makedirs"
] | [((75, 107), 'os.makedirs', 'os.makedirs', (['path'], {'exist_ok': '(True)'}), '(path, exist_ok=True)\n', (86, 107), False, 'import os\n'), ((269, 308), 'os.path.join', 'os.path.join', (['path', '"""lsun_bedroom1.pth"""'], {}), "(path, 'lsun_bedroom1.pth')\n", (281, 308), False, 'import os\n'), ((441, 480), 'os.path.jo... |
import nltk
import random
import re
from flask import Flask, request
from flask_restful import Resource, Api
from gensim.models import KeyedVectors
from flask_cors import CORS
from functools import lru_cache
app = Flask(__name__)
api = Api(app)
CORS(app)
class RandomWordPair(Resource):
def get(self, degrees):
... | [
"flask_restful.Api",
"flask_cors.CORS",
"flask.Flask",
"gensim.models.KeyedVectors.load",
"nltk.pos_tag",
"functools.lru_cache",
"re.compile"
] | [((215, 230), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (220, 230), False, 'from flask import Flask, request\n'), ((237, 245), 'flask_restful.Api', 'Api', (['app'], {}), '(app)\n', (240, 245), False, 'from flask_restful import Resource, Api\n'), ((246, 255), 'flask_cors.CORS', 'CORS', (['app'], {}), '... |
from datetime import datetime
from collections import namedtuple
import re
from aiogopro.types import CommandType, StatusType
RESERVED_WORDS = ['type', 'class']
T1 = ' ' * 4
T2 = T1 * 2
T3 = T1 * 3
T4 = T1 * 4
SUBMODE_PREFIX = {
'resolution': 'res_',
'aspect_ratio': 'aspect_',
'fps': '... | [
"aiogopro.types.CommandType",
"datetime.datetime.now",
"aiogopro.types.StatusType",
"re.compile"
] | [((1177, 1198), 're.compile', 're.compile', (['"""([\\\\.])"""'], {}), "('([\\\\.])')\n", (1187, 1198), False, 'import re\n'), ((1214, 1237), 're.compile', 're.compile', (['"""([_]{2,})"""'], {}), "('([_]{2,})')\n", (1224, 1237), False, 'import re\n'), ((1252, 1271), 're.compile', 're.compile', (['"""([%])"""'], {}), "... |
from flask import flash
from getDomainAge.models.enums import NotificationCategory
class NotificationService:
"""
Service class for showing all kinds of notificatin in the webpage
"""
def notify_success(self, message: str) -> None:
"""
method to show success message
:param mes... | [
"flask.flash"
] | [((396, 446), 'flask.flash', 'flash', (['message', 'NotificationCategory.SUCCESS.value'], {}), '(message, NotificationCategory.SUCCESS.value)\n', (401, 446), False, 'from flask import flash\n'), ((645, 695), 'flask.flash', 'flash', (['message', 'NotificationCategory.WARNING.value'], {}), '(message, NotificationCategory... |
train_imgs_path="path_to_train_images"
test_imgs_path="path_to_val/test images"
dnt_names=[]
import os
with open("dont_include_to_train.txt","r") as dnt:
for name in dnt:
dnt_names.append(name.strip("\n").strip(".json"))
dnt.close()
print(dnt_names)
with open("baseline_train.txt","w") as btr:
for fi... | [
"os.listdir"
] | [((326, 353), 'os.listdir', 'os.listdir', (['train_imgs_path'], {}), '(train_imgs_path)\n', (336, 353), False, 'import os\n'), ((506, 532), 'os.listdir', 'os.listdir', (['test_imgs_path'], {}), '(test_imgs_path)\n', (516, 532), False, 'import os\n')] |
"""
General-purpose and HTML lexical preprocessors.
The `preprocessors <preprocessor>`:term: accept lines of text
(`Preprocessor.insert_lines`) and files (`Preprocessor.insert_file`). A
preprocessor remembers all the input files that it opens
(`Preprocessor.input_paths`).
Preprocessor `directives <preprocessor direct... | [
"doxhooks.console.warning",
"inspect.stack",
"shlex.split",
"re.compile"
] | [((1989, 2024), 're.compile', 're.compile', (["(directive_pattern + '$')"], {}), "(directive_pattern + '$')\n", (1999, 2024), False, 'import re\n'), ((2378, 2402), 're.compile', 're.compile', (['node_pattern'], {}), '(node_pattern)\n', (2388, 2402), False, 'import re\n'), ((9544, 9581), 're.compile', 're.compile', (['"... |
import torch
import torchvision
from torch import nn
from torch import optim
from torch.nn import init
import torch.nn.functional as F
from torch.autograd import Variable
from torch import autograd
from torchvision import transforms, utils
import os
def init_weights(m):
classname = m.__class__.__nam... | [
"torch.nn.MSELoss",
"torch.nn.ReLU",
"torch.nn.ConvTranspose2d",
"torch.nn.ReflectionPad2d",
"torch.autograd.Variable",
"torch.nn.Tanh",
"torch.nn.Conv2d",
"torch.nn.init.xavier_normal_",
"torch.FloatTensor",
"torch.nn.BatchNorm2d",
"torch.nn.LeakyReLU",
"torch.tensor"
] | [((5233, 5275), 'torch.autograd.Variable', 'Variable', (['interpolated'], {'requires_grad': '(True)'}), '(interpolated, requires_grad=True)\n', (5241, 5275), False, 'from torch.autograd import Variable\n'), ((432, 477), 'torch.nn.init.xavier_normal_', 'init.xavier_normal_', (['m.weight.data'], {'gain': '(0.02)'}), '(m.... |
from os.path import join
import cv2
import numpy as np
from numpy.random import uniform
from sys import exit
import tensorflow as tf
model_path = join('models', 'symbol_classifier', 'model.h5')
model = tf.keras.models.load_model(model_path)
path = join('data', 'raw', 'n', '1.jpeg')
image_name = "data"
drawing = Fal... | [
"cv2.line",
"numpy.random.uniform",
"tensorflow.keras.models.load_model",
"cv2.waitKey",
"tensorflow.io.encode_jpeg",
"numpy.asarray",
"tensorflow.reshape",
"cv2.imshow",
"numpy.ones",
"tensorflow.io.decode_jpeg",
"cv2.setMouseCallback",
"tensorflow.image.resize",
"cv2.destroyAllWindows",
... | [((148, 195), 'os.path.join', 'join', (['"""models"""', '"""symbol_classifier"""', '"""model.h5"""'], {}), "('models', 'symbol_classifier', 'model.h5')\n", (152, 195), False, 'from os.path import join\n'), ((204, 242), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['model_path'], {}), '(model_pat... |
import numpy as np
import os
import os.path
from rechtschreib import correct
folder="../../write/data/"
def fixstring(qq,bef=None):
# print("fixing",qq)
intags=False
inhash=False
ac=""
ret=""
stopat=[".","(",")",">","\n"]
lq=len(qq)
for ii,zw in enumerate(qq):
basei=[intags,inhash]
... | [
"rechtschreib.correct",
"os.walk"
] | [((2225, 2240), 'os.walk', 'os.walk', (['folder'], {}), '(folder)\n', (2232, 2240), False, 'import os\n'), ((828, 844), 'rechtschreib.correct', 'correct', (['ac', 'bef'], {}), '(ac, bef)\n', (835, 844), False, 'from rechtschreib import correct\n')] |
import numpy as np
import g2o
class MotionModel(object):
def __init__(self,
timestamp=None,
initial_position=np.zeros(3),
initial_orientation=g2o.Quaternion(),
initial_covariance=None):
self.timestamp = timestamp
self.position = initial_positi... | [
"g2o.Quaternion",
"g2o.AngleAxis",
"g2o.Isometry3d",
"numpy.zeros",
"numpy.array"
] | [((143, 154), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (151, 154), True, 'import numpy as np\n'), ((189, 205), 'g2o.Quaternion', 'g2o.Quaternion', ([], {}), '()\n', (203, 205), False, 'import g2o\n'), ((461, 472), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (469, 472), True, 'import numpy as np\n'), ((... |
"""Added organization table
Revision ID: ea281d3f1673
Revises: <KEY>
Create Date: 2021-11-04 15:04:47.282526
"""
from uuid import uuid4
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = 'ea281d3f1673'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
de... | [
"alembic.op.drop_table",
"uuid.uuid4",
"sqlalchemy.String"
] | [((602, 631), 'alembic.op.drop_table', 'op.drop_table', (['"""organization"""'], {}), "('organization')\n", (615, 631), False, 'from alembic import op\n'), ((352, 359), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (357, 359), False, 'from uuid import uuid4\n'), ((449, 462), 'sqlalchemy.String', 'sa.String', (['(32)'], {}),... |
# Generated by Django 3.0.8 on 2020-07-07 10:37
from django.db import migrations, models
import measurements.validators
class Migration(migrations.Migration):
dependencies = [
('measurements', '0002_auto_20200706_1258'),
]
operations = [
migrations.AlterField(
model_name='me... | [
"django.db.models.SmallIntegerField"
] | [((389, 581), 'django.db.models.SmallIntegerField', 'models.SmallIntegerField', ([], {'default': '(80)', 'validators': '[measurements.validators.max_diastolic_pressure, measurements.validators.\n min_diastolic_pressure]', 'verbose_name': '"""Ciśnienie rozkurczowe"""'}), "(default=80, validators=[measurements.validat... |
import csv
import matplotlib.pyplot as plt
rawmeanbeforeNormFile = '/Users/yanzhexu/Desktop/Research/Sliding box GBM/MyAlgorithm_V2/GBM_SlidingWindow_TextureMap/CE_slice22_T2_ROI_Texture_Map.csv'
rawmeanafterNormFile ='/Users/yanzhexu/Desktop/Research/Sliding box GBM/MyAlgorithm_V2/addYlabel/GBM_SlidingWindow_Textur... | [
"csv.reader",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.close",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.cla",
"matplotlib.pyplot.cm.get_cmap",
"matplotlib.pyplot.savefig"
] | [((831, 853), 'matplotlib.pyplot.cm.get_cmap', 'plt.cm.get_cmap', (['"""jet"""'], {}), "('jet')\n", (846, 853), True, 'import matplotlib.pyplot as plt\n'), ((854, 903), 'matplotlib.pyplot.scatter', 'plt.scatter', (['xlist', 'ylist'], {'c': 'rawmeanlist', 'cmap': 'cm'}), '(xlist, ylist, c=rawmeanlist, cmap=cm)\n', (865,... |
import numpy as np
import string
import pandas as pd
from keras.preprocessing.sequence import pad_sequences
char_limit = 1014
def get_data(path):
labels = []
inputs = []
df = pd.read_csv(path, names=['one','second','third'])
df = df.drop('second', axis=1)
data = df.values
for label,text in da... | [
"pandas.read_csv",
"keras.preprocessing.sequence.pad_sequences",
"numpy.array"
] | [((190, 241), 'pandas.read_csv', 'pd.read_csv', (['path'], {'names': "['one', 'second', 'third']"}), "(path, names=['one', 'second', 'third'])\n", (201, 241), True, 'import pandas as pd\n'), ((1047, 1060), 'numpy.array', 'np.array', (['vec'], {}), '(vec)\n', (1055, 1060), True, 'import numpy as np\n'), ((1248, 1305), '... |
#%%
import matplotlib.pyplot as plt
import numpy as np
Rload = 3300
R_25 = 10000
T_25 = 25 + 273.15 #Kelvin
Beta = 3434
Tmin = 0
Tmax = 140
temps = np.linspace(Tmin, Tmax, 1000)
tempsK = temps + 273.15
# https://en.wikipedia.org/wiki/Thermistor#B_or_%CE%B2_parameter_equation
r_inf = R_25 * np.exp(-Beta/T_25)
R_temps... | [
"numpy.poly1d",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.polyfit",
"matplotlib.pyplot.legend",
"numpy.exp",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((150, 179), 'numpy.linspace', 'np.linspace', (['Tmin', 'Tmax', '(1000)'], {}), '(Tmin, Tmax, 1000)\n', (161, 179), True, 'import numpy as np\n'), ((388, 411), 'numpy.polyfit', 'np.polyfit', (['V', 'temps', '(3)'], {}), '(V, temps, 3)\n', (398, 411), True, 'import numpy as np\n'), ((417, 431), 'numpy.poly1d', 'np.poly... |
# -*- coding: utf-8 -*-
# @Date : 2020/5/24
# @Author: Luokun
# @Email : <EMAIL>
import sys
from os.path import dirname, abspath
import matplotlib.pyplot as plt
import numpy as np
sys.path.append(dirname(dirname(abspath(__file__))))
def test_knn():
from models.knn import KNN
x, y = np.random.randn(3, 200... | [
"matplotlib.pyplot.title",
"os.path.abspath",
"matplotlib.pyplot.show",
"numpy.sum",
"numpy.random.randn",
"matplotlib.pyplot.scatter",
"numpy.zeros",
"models.knn.KNN",
"matplotlib.pyplot.figure",
"numpy.array"
] | [((357, 373), 'numpy.array', 'np.array', (['[2, 2]'], {}), '([2, 2])\n', (365, 373), True, 'import numpy as np\n'), ((399, 416), 'numpy.array', 'np.array', (['[2, -2]'], {}), '([2, -2])\n', (407, 416), True, 'import numpy as np\n'), ((553, 559), 'models.knn.KNN', 'KNN', (['(3)'], {}), '(3)\n', (556, 559), False, 'from ... |
import os
import concurrent.futures
from tqdm import tqdm
from phi_angles import PhiDihedralAngleStatistics
import argparse
parser = argparse.ArgumentParser(description='To set to the path to the data')
parser.add_argument('-i', '--input_directory', help='An input directory for the psi angles must be named', required... | [
"tqdm.tqdm",
"os.walk",
"argparse.ArgumentParser"
] | [((135, 204), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""To set to the path to the data"""'}), "(description='To set to the path to the data')\n", (158, 204), False, 'import argparse\n'), ((763, 800), 'os.walk', 'os.walk', (['phi_data_path'], {'topdown': '(False)'}), '(phi_data_path,... |
from dataclasses import dataclass
import numpy as np
@dataclass
class ObjectTrackingResult:
frame_index: int
tracking_id: int
class_id: int
class_name: str
xmin: int
ymin: int
xmax: int
ymax: int
confidence: float
is_active: bool
def to_txt(self):
return "{} {} {} ... | [
"numpy.array"
] | [((718, 789), 'numpy.array', 'np.array', (['[self.xmin, self.ymin, self.xmax, self.ymax, self.confidence]'], {}), '([self.xmin, self.ymin, self.xmax, self.ymax, self.confidence])\n', (726, 789), True, 'import numpy as np\n')] |
import tensorflow as tf
import os
from tf2_models.keras_callbacks import CheckpointCallback, SummaryCallback
from tf2_models.train_utils import RectifiedAdam, ExponentialDecayWithWarmpUp
OPTIMIZER_DIC = {'adam': tf.keras.optimizers.Adam,
'radam': RectifiedAdam,
}
class Trainer(object)... | [
"os.path.join",
"tf2_models.keras_callbacks.SummaryCallback",
"tensorflow.keras.experimental.CosineDecayRestarts",
"tensorflow.io.gfile.makedirs",
"tensorflow.compat.v2.summary.experimental.set_step",
"tensorflow.Variable",
"tf2_models.train_utils.ExponentialDecayWithWarmpUp",
"tf2_models.keras_callba... | [((853, 998), 'tensorflow.train.CheckpointManager', 'tf.train.CheckpointManager', (['self.ckpt', 'ckpt_dir'], {'keep_checkpoint_every_n_hours': 'self.hparams.keep_checkpoint_every_n_hours', 'max_to_keep': '(2)'}), '(self.ckpt, ckpt_dir,\n keep_checkpoint_every_n_hours=self.hparams.\n keep_checkpoint_every_n_hours... |
#!/usr/bin/env python3
# import modules.
import sys; sys.path.append("..")
import logging
import math
import plac
import unittest
from tomes_tagger.lib.text_to_nlp import *
# enable logging.
logging.basicConfig(level=logging.DEBUG)
class Test_TextToNLP(unittest.TestCase):
def setUp(self):
# ... | [
"sys.path.append",
"plac.call",
"logging.basicConfig"
] | [((54, 75), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (69, 75), False, 'import sys\n'), ((193, 233), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (212, 233), False, 'import logging\n'), ((1363, 1378), 'plac.call', 'plac.call', (['... |
from threading import Thread
import time
from plugins.trivia.questions import QuestionGenerator
# This class will put itself in a pseudo-while loop that is non-blocking
# to the rest of the program.
class Question:
def __init__(self, q, a):
self.text = q
self.ans = a
class Trivia:
def __init__(... | [
"threading.Thread",
"plugins.trivia.questions.QuestionGenerator",
"time.sleep"
] | [((439, 458), 'plugins.trivia.questions.QuestionGenerator', 'QuestionGenerator', ([], {}), '()\n', (456, 458), False, 'from plugins.trivia.questions import QuestionGenerator\n'), ((680, 753), 'threading.Thread', 'Thread', ([], {'target': 'self.customWait', 'name': '"""customWait"""', 'args': '(5,)', 'daemon': '(True)'}... |
"""Users Models."""
# Django
from django.db import models
from django.contrib.auth.models import User
class Profile(models.Model):
"""Profile extended:
Proxy model that extends the base data with other information.
"""
# this links Profile with the User profile, one to one relationship
profile_use... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.URLField",
"django.db.models.CharField",
"django.db.models.ImageField",
"django.db.models.DateTimeField"
] | [((324, 376), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'on_delete': 'models.CASCADE'}), '(User, on_delete=models.CASCADE)\n', (344, 376), False, 'from django.db import models\n'), ((419, 462), 'django.db.models.URLField', 'models.URLField', ([], {'max_length': '(200)', 'blank': '(True)'}), ... |
from flask import render_template, url_for
from app import app
script_list = ['demo',
'format_DNA',
'translate',
'extra_sites']
default_choice = 'format_DNA'
def render_index_template():
return render_template(
"index.html",
script_list... | [
"app.app.route",
"flask.render_template"
] | [((419, 450), 'app.app.route', 'app.route', (['"""/"""'], {'methods': "['GET']"}), "('/', methods=['GET'])\n", (428, 450), False, 'from app import app\n'), ((454, 490), 'app.app.route', 'app.route', (['"""/index"""'], {'methods': "['GET']"}), "('/index', methods=['GET'])\n", (463, 490), False, 'from app import app\n'),... |
# -*- coding: utf-8 -*-
import numpy as np
#%%
def tol2side_x_eq_y(x, y, tol_below=0.0, tol_above=0.0):
'''在上界误差tol_above和下界误差tol_below范围内判断x是否等于y'''
return y - tol_below <= x <= y + tol_above
def tol_eq(x, y, tol=0.0):
'''在绝对误差tol范围内判断x和y相等'''
return abs(x - y) <= tol
def tol_x_big_y(x, y, tol=0.... | [
"numpy.cumsum"
] | [((1570, 1585), 'numpy.cumsum', 'np.cumsum', (['alts'], {}), '(alts)\n', (1579, 1585), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-01-03 13:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('invoice', '0015_auto_20180102_0048'),
]
operations... | [
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField"
] | [((434, 527), '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", (450, 527), False, 'from django.db import migrations, models\... |
# python3 yammler.py ~/Games/openxcom_71_40k/user/mods/ROSIGMA/Ruleset ~/Games/openxcom_71_40k/user/mods/40k/Ruleset/
import sys, os
import yaml
print(sys.argv)
# os.chdir(sys.argv[1])
paths = sys.argv[1:]
fileList = []
DEBUG = False
def debugPrint(debugText):
if DEBUG:
print(debugText)
def addTrailing... | [
"yaml.safe_load",
"os.listdir",
"os.stat"
] | [((830, 846), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (840, 846), False, 'import sys, os\n'), ((459, 483), 'os.stat', 'os.stat', (['(path + fileName)'], {}), '(path + fileName)\n', (466, 483), False, 'import sys, os\n'), ((628, 652), 'os.stat', 'os.stat', (['(path + fileName)'], {}), '(path + fileName)\... |
from distutils.core import setup
classifiers = [
'Development Status :: 3 - Alpha'
, 'Intended Audience :: Developers'
, 'License :: OSI Approved :: BSD License'
, 'Natural Language :: English'
, 'Operating System :: MacOS :: MacOS X'
, 'Operating System :: Microsoft :: Windows'
, 'Operating System ::... | [
"distutils.core.setup"
] | [((608, 897), 'distutils.core.setup', 'setup', ([], {'name': '"""httpy"""', 'version': '"""~~VERSION~~"""', 'package_dir': "{'': 'src'}", 'py_modules': "['httpy']", 'description': '"""httpy smooths out a few of WSGI\'s most glaring warts."""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""http:/... |
import os
"""Plotly Dash HTML layout override."""
dir_path = os.getcwd()
with open(os.path.join(dir_path, 'main', 'templates', 'base.html'), 'r') as f:
rows = f.readlines()
rows = [row.strip() for row in rows]
nav_index = rows.index('</nav>')
dash_str = rows[:nav_index+1] + ['{%app_entry%}',
... | [
"os.getcwd",
"os.path.join"
] | [((61, 72), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (70, 72), False, 'import os\n'), ((83, 139), 'os.path.join', 'os.path.join', (['dir_path', '"""main"""', '"""templates"""', '"""base.html"""'], {}), "(dir_path, 'main', 'templates', 'base.html')\n", (95, 139), False, 'import os\n')] |
#!/usr/bin/python
# Copyright 2019 Fetch Robotics Inc.
# Author(s): <NAME>
# Python
from __future__ import print_function
from datetime import datetime
from datetime import timedelta
# ROS
import rospy
import actionlib
from fetchit_challenge.msg import SchunkMachineAction, SchunkMachineResult, SchunkMachineGoal
# #... | [
"fetchit_challenge.msg.SchunkMachineResult",
"rospy.loginfo",
"datetime.timedelta",
"rospy.init_node",
"actionlib.SimpleActionServer",
"rospy.spin",
"datetime.datetime.now"
] | [((585, 606), 'fetchit_challenge.msg.SchunkMachineResult', 'SchunkMachineResult', ([], {}), '()\n', (604, 606), False, 'from fetchit_challenge.msg import SchunkMachineAction, SchunkMachineResult, SchunkMachineGoal\n'), ((3395, 3435), 'rospy.init_node', 'rospy.init_node', (['"""schunk_machine_server"""'], {}), "('schunk... |
#! /usr/bin/env python
# title : Trellis.py
# description : This class generates a trellis based on a trellis definition class.
# Parameters such as reduction (radix) can be used to construct the trellis.
# author : <NAME>
# python_version : 3.5.2
import utils
class Trellis(... | [
"utils.bin2dec"
] | [((2562, 2578), 'utils.bin2dec', 'utils.bin2dec', (['x'], {}), '(x)\n', (2575, 2578), False, 'import utils\n'), ((4209, 4225), 'utils.bin2dec', 'utils.bin2dec', (['u'], {}), '(u)\n', (4222, 4225), False, 'import utils\n')] |
import os
import librosa
from torch.utils import data
from util.utils import sample_fixed_length_data_aligned
class Dataset(data.Dataset):
def __init__(self,
dataset,
limit=None,
offset=0,
sample_length=16384,
mod... | [
"os.path.expanduser",
"util.utils.sample_fixed_length_data_aligned",
"os.path.basename"
] | [((2512, 2580), 'util.utils.sample_fixed_length_data_aligned', 'sample_fixed_length_data_aligned', (['mixture', 'clean', 'self.sample_length'], {}), '(mixture, clean, self.sample_length)\n', (2544, 2580), False, 'from util.utils import sample_fixed_length_data_aligned\n'), ((2151, 2181), 'os.path.basename', 'os.path.ba... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import multiprocessing
from typing import Any, List, Tuple
def recv_from_connections_and... | [
"multiprocessing.connection.wait"
] | [((1184, 1226), 'multiprocessing.connection.wait', 'multiprocessing.connection.wait', (['not_ready'], {}), '(not_ready)\n', (1215, 1226), False, 'import multiprocessing\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-08 22:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0022_auto_20161208_1740'),
]
operations = [
migrations.AddField(... | [
"django.db.models.PositiveIntegerField"
] | [((412, 451), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'default': '(10)'}), '(default=10)\n', (439, 451), False, 'from django.db import migrations, models\n')] |
# -------------------------------------------------------------------------
# Copyright (c) 2017-2018 AT&T Intellectual Property
# Copyright (C) 2020 Wipro Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ... | [
"unittest.main",
"osdf.adapters.local_data.local_policies.get_policy_names_from_file",
"osdf.adapters.conductor.translation.gen_demands",
"osdf.utils.interfaces.json_from_file",
"osdf.adapters.conductor.translation.gen_optimization_policy"
] | [((3646, 3661), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3659, 3661), False, 'import unittest\n'), ((1447, 1514), 'osdf.adapters.local_data.local_policies.get_policy_names_from_file', 'local_policies.get_policy_names_from_file', (['valid_policies_list_file'], {}), '(valid_policies_list_file)\n', (1488, 1514... |
from datetime import datetime, timedelta
import pytz
from django.conf import settings
from django.contrib.auth.hashers import check_password
from django.db import models
from django.urls import reverse
from rest_framework.request import Request
from garden.formatters import WateringStationFormatter
from .managers im... | [
"django.db.models.OneToOneField",
"garden.formatters.WateringStationFormatter",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.DurationField",
"django.db.models.FloatField",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.GenericIPAdd... | [((436, 456), 'datetime.timedelta', 'timedelta', ([], {'minutes': '(1)'}), '(minutes=1)\n', (445, 456), False, 'from datetime import datetime, timedelta\n'), ((551, 571), 'datetime.timedelta', 'timedelta', ([], {'minutes': '(5)'}), '(minutes=5)\n', (560, 571), False, 'from datetime import datetime, timedelta\n'), ((824... |
import numpy as np
import cv2
from poisson_disk import PoissonDiskSampler
import skimage.morphology
import skimage.measure
import scipy.stats
class Box(object):
"""
This class represents a box in an image. This could be a bounding box of an object or part.
Internally each box is represented by a tuple of ... | [
"numpy.zeros",
"poisson_disk.PoissonDiskSampler",
"numpy.where",
"numpy.array",
"cv2.rectangle"
] | [((2542, 2630), 'cv2.rectangle', 'cv2.rectangle', (['new_img', '(self.ymin, self.xmin)', '(self.ymax, self.xmax)', 'color', 'width'], {}), '(new_img, (self.ymin, self.xmin), (self.ymax, self.xmax),\n color, width)\n', (2555, 2630), False, 'import cv2\n'), ((3701, 3736), 'numpy.zeros', 'np.zeros', (['(height, width)'... |
from setuptools import setup
import os
with open(os.devnull, 'w') as a:
print("If this raises an error, you're using python 2 - not supported.", file=a) #get rid of python 2 users
with open("README.md", "r") as file:
long_desc = file.read()
import sys
if sys.version_info < (3,7):
sys.exit('Sorry, Python < 3... | [
"setuptools.setup",
"sys.exit"
] | [((342, 1068), 'setuptools.setup', 'setup', ([], {'name': '"""snakeGit"""', 'version': '"""0.4.5"""', 'description': '"""the missing Python git module"""', 'long_description': 'long_desc', 'python_requires': '""">3.7.0"""', 'license': '"""Apache-2.0"""', 'packages': "['snakeGit']", 'author': '"""TheTechRobo"""', 'autho... |
import json
import sys
from dsm import dsm_looper
def get_color(item):
n = len(item)
return COLORS[n % len(COLORS)]
class Node():
DN = {}
head = None
def __init__(self, val, dn):
self.val = val
self.nodes = []
self.dn = dn
Node.DN[dn] = self
def connect(sel... | [
"sys.argv.index",
"sys.stdin.read",
"json.loads",
"dsm.dsm_looper"
] | [((1284, 1315), 'dsm.dsm_looper', 'dsm_looper', (['load_dns', 'dsm_model'], {}), '(load_dns, dsm_model)\n', (1294, 1315), False, 'from dsm import dsm_looper\n'), ((1192, 1208), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (1206, 1208), False, 'import sys\n'), ((1253, 1269), 'json.loads', 'json.loads', (['data'... |
import streamlit as st
import streamlit_book as stb
st.title("Multipage")
st.markdown("There are several user cases for having multipages on streamlit. We'll explore each one of those")
st.header("Basic or interactive single page")
st.markdown("""
You use only streamlit (no need can use streamlit_book).
Optionall... | [
"streamlit.header",
"streamlit.markdown",
"streamlit.title"
] | [((53, 74), 'streamlit.title', 'st.title', (['"""Multipage"""'], {}), "('Multipage')\n", (61, 74), True, 'import streamlit as st\n'), ((76, 197), 'streamlit.markdown', 'st.markdown', (['"""There are several user cases for having multipages on streamlit. We\'ll explore each one of those"""'], {}), '(\n "There are sev... |
# template global functions
# make sure not to conflict with built-ins:
# http://jinja.pocoo.org/docs/2.9/templates/#list-of-global-functions
from flask.helpers import url_for as _url_for
from flask_paginate import Pagination
def paginate(page, total, per_page, config):
record_name = config['MOMO_PAGINATION_RECO... | [
"flask_paginate.Pagination",
"flask.helpers.url_for"
] | [((658, 803), 'flask_paginate.Pagination', 'Pagination', ([], {'page': 'page', 'total': 'total', 'per_page': 'per_page', 'bs_version': '(3)', 'show_single_page': '(False)', 'record_name': 'record_name', 'display_msg': 'display_msg'}), '(page=page, total=total, per_page=per_page, bs_version=3,\n show_single_page=Fals... |
__author__ = 'orhan'
from math import asin, sqrt, degrees
class Point:
def __init__(self, x, y=0.0, z=0.0):
self.x = x
self.y = y
self.z = z
def angle_x(self, p2):
dy = self.y - p2.y
dx = self.x - p2.x
h = sqrt(dy ** 2 + dx ** 2)
if h == 0:
... | [
"math.asin",
"math.sqrt"
] | [((266, 289), 'math.sqrt', 'sqrt', (['(dy ** 2 + dx ** 2)'], {}), '(dy ** 2 + dx ** 2)\n', (270, 289), False, 'from math import asin, sqrt, degrees\n'), ((354, 366), 'math.asin', 'asin', (['(dx / h)'], {}), '(dx / h)\n', (358, 366), False, 'from math import asin, sqrt, degrees\n')] |
# 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, ... | [
"clusterfuzz._internal.tests.core.bot.fuzzers.afl.afl_launcher_integration_test.setup_testcase_and_corpus",
"os.mkdir",
"os.listdir",
"clusterfuzz._internal.tests.core.bot.fuzzers.afl.afl_launcher_integration_test.dont_use_strategies",
"os.path.getsize",
"os.path.dirname",
"os.path.exists",
"shutil.rm... | [((1209, 1240), 'os.path.join', 'os.path.join', (['TEST_PATH', '"""temp"""'], {}), "(TEST_PATH, 'temp')\n", (1221, 1240), False, 'import os\n'), ((1258, 1289), 'os.path.join', 'os.path.join', (['TEST_PATH', '"""data"""'], {}), "(TEST_PATH, 'data')\n", (1270, 1289), False, 'import os\n'), ((1309, 1347), 'os.path.join', ... |
import numpy as np
# direct cluster
class FCM(object):
def __init__(self, data):
self.lambd = 0
self.data = data
self.cluster = []
self.F_S = []
def standard(self):
data_min, data_max = np.min(self.data, axis=0), np.max(self.data, axis=0)
num_sampl... | [
"numpy.square",
"numpy.zeros",
"numpy.shape",
"numpy.min",
"numpy.mean",
"numpy.array",
"numpy.max",
"numpy.unique"
] | [((4941, 5072), 'numpy.array', 'np.array', (['[[80.0, 10.0, 6.0, 2.0], [50.0, 1.0, 6.0, 4.0], [90.0, 6.0, 4.0, 6.0], [\n 40.0, 5.0, 7.0, 3.0], [10.0, 1.0, 2.0, 4.0]]'], {}), '([[80.0, 10.0, 6.0, 2.0], [50.0, 1.0, 6.0, 4.0], [90.0, 6.0, 4.0, \n 6.0], [40.0, 5.0, 7.0, 3.0], [10.0, 1.0, 2.0, 4.0]])\n', (4949, 5072),... |
"""
Some useful functions for file management.
Functions:
copytree(scr, dst, symlinks=False, ignore=None):
Copy all the contents of directory scr to directory dst.
empty_folder(folder):
Empty the directory folder from all subfolders and files.
"""
import os
import shutil
def copytree(src, ... | [
"os.unlink",
"shutil.rmtree",
"os.path.isdir",
"shutil.copy2",
"os.path.isfile",
"os.path.islink",
"shutil.copytree",
"os.path.join",
"os.listdir"
] | [((638, 653), 'os.listdir', 'os.listdir', (['src'], {}), '(src)\n', (648, 653), False, 'import os\n'), ((1133, 1151), 'os.listdir', 'os.listdir', (['folder'], {}), '(folder)\n', (1143, 1151), False, 'import os\n'), ((667, 690), 'os.path.join', 'os.path.join', (['src', 'item'], {}), '(src, item)\n', (679, 690), False, '... |
"""Version's attribute test.
"""
import pytest
import fairytool
def test_version():
assert hasattr(fairytool, "__version__")
if __name__ == "__main__":
pytest.main(["--capture=no"])
| [
"pytest.main"
] | [((165, 194), 'pytest.main', 'pytest.main', (["['--capture=no']"], {}), "(['--capture=no'])\n", (176, 194), False, 'import pytest\n')] |
__all__ = ["CeParser"]
from copy import deepcopy
from decimal import Decimal
from typing import Callable, Dict, Set, Union
import simplejson as json
from boto3.dynamodb.types import (
BINARY,
BINARY_SET,
BOOLEAN,
LIST,
MAP,
NULL,
NUMBER,
NUMBER_SET,
STRING,
STRING_SET,
Bina... | [
"simplejson.dumps",
"copy.deepcopy",
"boto3.dynamodb.types.TypeSerializer"
] | [((1122, 1138), 'boto3.dynamodb.types.TypeSerializer', 'TypeSerializer', ([], {}), '()\n', (1136, 1138), False, 'from boto3.dynamodb.types import BINARY, BINARY_SET, BOOLEAN, LIST, MAP, NULL, NUMBER, NUMBER_SET, STRING, STRING_SET, Binary, TypeDeserializer, TypeSerializer\n'), ((2464, 2506), 'copy.deepcopy', 'deepcopy'... |
# SPDX-FileCopyrightText: 2021 easyDiffraction contributors <<EMAIL>>
# SPDX-License-Identifier: BSD-3-Clause
# © 2021 Contributors to the easyDiffraction project <https://github.com/easyScience/easyDiffractionApp>
__author__ = "github.com/AndrewSazonov"
__version__ = '0.0.1'
import os, sys
import ftplib
import pathl... | [
"Functions.printFailMessage",
"os.path.basename",
"os.path.isdir",
"os.path.dirname",
"os.walk",
"Functions.printSuccessMessage",
"os.path.isfile",
"os.path.relpath",
"Config.Config",
"ftplib.FTP",
"sys.exit",
"os.path.join",
"Functions.printNeutralMessage"
] | [((359, 374), 'Config.Config', 'Config.Config', ([], {}), '()\n', (372, 374), False, 'import Functions, Config\n'), ((4986, 5059), 'os.path.join', 'os.path.join', (['CONFIG.dist_dir', 'local_repository_dir_name', 'CONFIG.setup_os'], {}), '(CONFIG.dist_dir, local_repository_dir_name, CONFIG.setup_os)\n', (4998, 5059), F... |
"""
Module with useful functions.
"""
from typing import Union, List
import ast
def parse_code(input: Union[str, List[str]]) -> str:
"""Tries to parse code represented as string or list of strings
Parameters
----------
input : Union[str, List[str]]
either a str or a list of str
Returns
... | [
"ast.parse"
] | [((547, 564), 'ast.parse', 'ast.parse', (['simple'], {}), '(simple)\n', (556, 564), False, 'import ast\n')] |
##############################################################################
#
# Copyright (c) 2016 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [
"importlib.import_module",
"zope.interface.implementer",
"gevent.monkey.is_module_patched",
"os.environ.get",
"select.select",
"zope.interface.directlyProvides",
"gevent.socket.wait"
] | [((11918, 11947), 'zope.interface.implementer', 'implementer', (['IDBDriverFactory'], {}), '(IDBDriverFactory)\n', (11929, 11947), False, 'from zope.interface import implementer\n'), ((13823, 13865), 'zope.interface.directlyProvides', 'directlyProvides', (['module', 'IDBDriverOptions'], {}), '(module, IDBDriverOptions)... |
# 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, ... | [
"numpy.einsum",
"numpy.einsum_path"
] | [((1342, 1368), 'numpy.einsum', 'np.einsum', (['*args'], {}), '(*args, **kwargs)\n', (1351, 1368), True, 'import numpy as np\n'), ((1140, 1191), 'numpy.einsum_path', 'np.einsum_path', (['*args'], {'optimize': '"""optimal"""'}), "(*args, **kwargs, optimize='optimal')\n", (1154, 1191), True, 'import numpy as np\n')] |
# Copy this to urls.py. Most sites can leave this as-is. If you have custom
# apps which need routing, modify this file to include those urlconfs.
from django.conf.urls import url, include
urlpatterns = [
url('', include("core.urls")),
# If you were to add a plugin app that handles its own URLs, you might do
... | [
"django.conf.urls.include"
] | [((219, 239), 'django.conf.urls.include', 'include', (['"""core.urls"""'], {}), "('core.urls')\n", (226, 239), False, 'from django.conf.urls import url, include\n')] |
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge, FallingEdge, ClockCycles
import random
async def reset(dut):
dut.reset <= 1
await ClockCycles(dut.clk, 5)
dut.reset <= 0;
@cocotb.test()
async def test_pwm(dut):
clock = Clock(dut.clk, 10, units="us")
cocotb.fork... | [
"cocotb.clock.Clock",
"cocotb.test",
"cocotb.triggers.RisingEdge",
"cocotb.triggers.ClockCycles"
] | [((223, 236), 'cocotb.test', 'cocotb.test', ([], {}), '()\n', (234, 236), False, 'import cocotb\n'), ((274, 304), 'cocotb.clock.Clock', 'Clock', (['dut.clk', '(10)'], {'units': '"""us"""'}), "(dut.clk, 10, units='us')\n", (279, 304), False, 'from cocotb.clock import Clock\n'), ((177, 200), 'cocotb.triggers.ClockCycles'... |
import random
from typing import List
def selection_sort(numbers: List[int]) -> List[int]:
len_numbers = len(numbers)
for i in range(len_numbers):
min_idx = i
for j in range(i + 1, len_numbers):
if numbers[min_idx] > numbers[j]:
min_idx = j
numbers[i], numb... | [
"random.randint"
] | [((394, 416), 'random.randint', 'random.randint', (['(0)', '(100)'], {}), '(0, 100)\n', (408, 416), False, 'import random\n')] |
import codecademylib
import pandas as pd
inventory = pd.read_csv('inventory.csv')
print(inventory.head(10))
staten_island = inventory.head(10)
product_request = staten_island.product_description
seed_request = inventory[(inventory.location == 'Brooklyn') & (inventory.product_type == 'seeds')]
inventory['in_stock'] =... | [
"pandas.read_csv"
] | [((54, 82), 'pandas.read_csv', 'pd.read_csv', (['"""inventory.csv"""'], {}), "('inventory.csv')\n", (65, 82), True, 'import pandas as pd\n')] |
from random import randint
from src.randomExpression.RandomOperand import RandomOperand
from src.randomExpression.RandomOperator import RandomOperator
class ExpressionBranch:
def __init__(self, size):
"""
This class create a random expression of a given length. The operands
will only be... | [
"src.randomExpression.RandomOperand.RandomOperand",
"src.randomExpression.RandomOperator.RandomOperator",
"random.randint"
] | [((576, 592), 'src.randomExpression.RandomOperator.RandomOperator', 'RandomOperator', ([], {}), '()\n', (590, 592), False, 'from src.randomExpression.RandomOperator import RandomOperator\n'), ((616, 632), 'src.randomExpression.RandomOperand.RandomOperand', 'RandomOperand', (['(9)'], {}), '(9)\n', (629, 632), False, 'fr... |
# import os
import sys
from multiprocessing import Pool
# import time
# from concurrent import futures
import test4
print("test2 run")
class MyLocker:
def __init__(self):
print("mylocker.__init__() called.")
@staticmethod
def acquire():
print("mylocker.acquire() called.")
@staticmetho... | [
"logging.info"
] | [((1115, 1133), 'logging.info', 'logging.info', (['info'], {}), '(info)\n', (1127, 1133), False, 'import logging\n')] |
import random as rnd
EMPTY = ' '
DEAD = 'X'
HIT = '+'
MISSED = '-'
SHIP = 'O'
LETTERKEYS = [
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',
'J'
]
def digit(key):
if key in LETTERKEYS:
return LETTERKEYS.index(key) + 1
elif 1 <= key <= 10:
return key
e... | [
"random.randint"
] | [((1514, 1531), 'random.randint', 'rnd.randint', (['(0)', '(3)'], {}), '(0, 3)\n', (1525, 1531), True, 'import random as rnd\n'), ((1579, 1623), 'random.randint', 'rnd.randint', (['self.length', 'self.field.xlength'], {}), '(self.length, self.field.xlength)\n', (1590, 1623), True, 'import random as rnd\n'), ((1643, 167... |
groups = [
{
"img": "groups/images/vegan.png",
"name": "Vegan Group",
},
{
"img": "groups/images/ketogenic-diet.png",
"name": "Keto Group",
},
{
"img": "groups/images/vegetables.png",
"name": "Vegetarian Group",
},
{
"img... | [
"groups.models.Group"
] | [((898, 946), 'groups.models.Group', 'Group', ([], {'img_path': "group['img']", 'name': "group['name']"}), "(img_path=group['img'], name=group['name'])\n", (903, 946), False, 'from groups.models import Group\n')] |
# Datos
# 'SERIALIZACION' DE OBJETOS (para manejar el salvado de datos)
try:
import cPickle as pickle
except ImportError:
import pickle
# mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
# FUNCIONES CONTROL Y GESTION DE FICHEROS DE DATOS
# mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
def... | [
"pickle.dump",
"pickle.load"
] | [((566, 629), 'pickle.dump', 'pickle.dump', (['informacion_para_salvar', 'ficheroDatos'], {'protocol': '(-1)'}), '(informacion_para_salvar, ficheroDatos, protocol=-1)\n', (577, 629), False, 'import pickle\n'), ((1073, 1143), 'pickle.dump', 'pickle.dump', (['informacion_para_salvar', 'ficheroDatos_backup'], {'protocol':... |
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import unittest
from amaascore.market_data.fx_rate import FXRate
from amaascore.tools.generate_market_data import generate_fx_rate
class FXRateTest(unittest.TestCase):
def setUp(self):
self.longMessage = True... | [
"unittest.main",
"amaascore.tools.generate_market_data.generate_fx_rate",
"json.dumps"
] | [((1187, 1202), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1200, 1202), False, 'import unittest\n'), ((387, 405), 'amaascore.tools.generate_market_data.generate_fx_rate', 'generate_fx_rate', ([], {}), '()\n', (403, 405), False, 'from amaascore.tools.generate_market_data import generate_fx_rate\n'), ((1038, 10... |
# https://spotipy.readthedocs.io/en/2.13.0/
# pip install spotipy --upgrade
# pipenv install python-dotenv
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
import sys
import time
from flask import Flask, jsonify, Response, render_template, request
from flask_sqlalchemy import SQLAlchemy
import pandas ... | [
"flask.Flask",
"dotenv.load_dotenv",
"flask.render_template",
"spotipy.Spotify",
"spotipy.oauth2.SpotifyClientCredentials",
"os.getenv"
] | [((399, 412), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (410, 412), False, 'from dotenv import load_dotenv\n'), ((420, 435), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (425, 435), False, 'from flask import Flask, jsonify, Response, render_template, request\n'), ((466, 493), 'os.getenv', 'g... |
# # -*- coding: utf-8 -*-
# from chatterbot import ChatBot
# bot = ChatBot(
# "Math & Time Bot",
# logic_adapters=[
# "chatterbot.logic.MathematicalEvaluation",
# "chatterbot.logic.TimeLogicAdapter"
# ],
# input_adapter="chatterbot.input.VariableInputTypeAdapter",
# output_adapter=... | [
"numpy.fft.rfft",
"numpy.abs",
"matplotlib.pyplot.plot",
"numpy.median",
"numpy.floor",
"numpy.zeros",
"scipy.io.wavfile.read",
"numpy.shape",
"numpy.fft.fftfreq",
"pickle.load",
"numpy.array",
"numpy.linspace",
"numpy.round",
"os.listdir"
] | [((4136, 4157), 'os.listdir', 'os.listdir', (['"""./songs"""'], {}), "('./songs')\n", (4146, 4157), False, 'import os\n'), ((4281, 4308), 'numpy.array', 'np.array', (['fingerprint1[20:]'], {}), '(fingerprint1[20:])\n', (4289, 4308), True, 'import numpy as np\n'), ((1324, 1343), 'numpy.fft.rfft', 'np.fft.rfft', (['frame... |
from nxt.tokens import register_token
PREFIX = 'ex::'
def detect_token_type(value):
return value.startswith(PREFIX)
def resolve_token(stage, node, value, layer, **kwargs):
value = stage.resolve(node, value, layer, **kwargs)
# Reverses given value
return value[::-1]
register_token(PREFIX, detect_t... | [
"nxt.tokens.register_token"
] | [((289, 345), 'nxt.tokens.register_token', 'register_token', (['PREFIX', 'detect_token_type', 'resolve_token'], {}), '(PREFIX, detect_token_type, resolve_token)\n', (303, 345), False, 'from nxt.tokens import register_token\n')] |
import loaders
import xarray as xr
import numpy as np
from loaders._utils import SAMPLE_DIM_NAME
import pytest
def test_multiple_unstacked_dims():
na, nb, nc, nd = 2, 3, 4, 5
ds = xr.Dataset(
data_vars={
"var1": xr.DataArray(
np.zeros([na, nb, nc, nd]), dims=["a", "b", "c",... | [
"loaders.stack",
"pytest.mark.parametrize",
"numpy.zeros",
"xarray.Dataset"
] | [((1424, 1521), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""gridded_dataset"""', '[(0, 1, 10, 10), (0, 10, 10, 10)]'], {'indirect': '(True)'}), "('gridded_dataset', [(0, 1, 10, 10), (0, 10, 10, 10)\n ], indirect=True)\n", (1447, 1521), False, 'import pytest\n'), ((764, 815), 'loaders.stack', 'loaders... |
from paretoarchive.pandas import pareto
import pandas as pd
def test_df():
df = pd.DataFrame(
[[1, 3, 3], [1, 2, 3], [1, 1, 2]], columns=["a", "b", "c"]
)
assert (pareto(df, ["a", "b"]).index == [2]).all()
assert (pareto(df, ["a", "b", "c"]).index == [2]).all()
assert (pareto(df, ["a", "... | [
"pandas.DataFrame",
"paretoarchive.pandas.pareto"
] | [((85, 157), 'pandas.DataFrame', 'pd.DataFrame', (['[[1, 3, 3], [1, 2, 3], [1, 1, 2]]'], {'columns': "['a', 'b', 'c']"}), "([[1, 3, 3], [1, 2, 3], [1, 1, 2]], columns=['a', 'b', 'c'])\n", (97, 157), True, 'import pandas as pd\n'), ((186, 208), 'paretoarchive.pandas.pareto', 'pareto', (['df', "['a', 'b']"], {}), "(df, [... |
from torch.utils.data import Dataset
from utils import load_data, get_labels
class SGEDDataset(Dataset):
def __init__(self, file_path, mode):
src_lst, trg_lst = load_data(file_path, mode)
self.src_lst = src_lst
self.trg_lst = trg_lst
self.labels = get_labels(src_lst, trg_lst)
d... | [
"utils.get_labels",
"utils.load_data"
] | [((174, 200), 'utils.load_data', 'load_data', (['file_path', 'mode'], {}), '(file_path, mode)\n', (183, 200), False, 'from utils import load_data, get_labels\n'), ((285, 313), 'utils.get_labels', 'get_labels', (['src_lst', 'trg_lst'], {}), '(src_lst, trg_lst)\n', (295, 313), False, 'from utils import load_data, get_lab... |
# type: ignore
"""
A Tensor module on top of Numpy arrays.
TODO: Implement the reverse mode autodiff to compute gradients. It will have
to go backward through the computation graph.
"""
from __future__ import annotations
from typing import Union
import os
import pkgutil
import numpy as np
import pyopencl as ... | [
"pyopencl.array.sum",
"numpy.sum",
"numpy.maximum",
"pyopencl.clmath.exp",
"pyopencl.enqueue_copy",
"pyopencl.array.transpose",
"numpy.empty",
"pyopencl.array.empty",
"pyopencl.array.minimum",
"pyopencl.Buffer",
"numpy.mean",
"numpy.exp",
"numpy.random.normal",
"pyopencl.array.reshape",
... | [((521, 559), 'pyopencl.create_some_context', 'cl.create_some_context', ([], {'answers': '[0, 1]'}), '(answers=[0, 1])\n', (543, 559), True, 'import pyopencl as cl\n'), ((608, 632), 'pyopencl.CommandQueue', 'cl.CommandQueue', (['CONTEXT'], {}), '(CONTEXT)\n', (623, 632), True, 'import pyopencl as cl\n'), ((20996, 21011... |
import json
import logging
from datetime import datetime
import requests
from fftbg.config import FFTBG_API_URL, TOURNAMENTS_ROOT
LOG = logging.getLogger(__name__)
def get_tournament_list():
j = requests.get(f'{FFTBG_API_URL}/api/tournaments?limit=6000').json()
return [(t['ID'], datetime.fromisoformat(t['L... | [
"datetime.datetime.fromisoformat",
"json.loads",
"fftbg.config.TOURNAMENTS_ROOT.mkdir",
"requests.get",
"logging.getLogger"
] | [((139, 166), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (156, 166), False, 'import logging\n'), ((665, 702), 'fftbg.config.TOURNAMENTS_ROOT.mkdir', 'TOURNAMENTS_ROOT.mkdir', ([], {'exist_ok': '(True)'}), '(exist_ok=True)\n', (687, 702), False, 'from fftbg.config import FFTBG_API_URL,... |
__author__ = '<NAME>'
from craps import CrapsGame
aCrapsGame = CrapsGame()
print(aCrapsGame.getCurrentBank())
aCrapsGame.placeBet(50)
aCrapsGame.throwDice()
aCrapsGame.throwDice()
print(aCrapsGame.getCurrentBank()) | [
"craps.CrapsGame"
] | [((69, 80), 'craps.CrapsGame', 'CrapsGame', ([], {}), '()\n', (78, 80), False, 'from craps import CrapsGame\n')] |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"torch.utils.data.TensorDataset",
"torch.randint",
"opacus.data_loader.DPDataLoader",
"torch.randn"
] | [((917, 960), 'torch.randn', 'torch.randn', (['self.data_size', 'self.dimension'], {}), '(self.data_size, self.dimension)\n', (928, 960), False, 'import torch\n'), ((973, 1040), 'torch.randint', 'torch.randint', ([], {'low': '(0)', 'high': 'self.num_classes', 'size': '(self.data_size,)'}), '(low=0, high=self.num_classe... |
import json
import logging
import requests
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as vtransforms
from torchvision.models import squeezenet1_0, squeezenet1_1
RESCALE_SIZE = 256
CROP_SIZE = 224
IMAGENET_CLASS_MAP = 'imagenet_class_index.json'
logger = logging.... | [
"json.load",
"torchvision.transforms.ToTensor",
"torchvision.models.squeezenet1_0",
"torchvision.models.squeezenet1_1",
"torch.nn.functional.log_softmax",
"torch.rand",
"torchvision.transforms.CenterCrop",
"torchvision.transforms.Normalize",
"torch.no_grad",
"logging.getLogger",
"torchvision.tra... | [((312, 336), 'logging.getLogger', 'logging.getLogger', (['"""app"""'], {}), "('app')\n", (329, 336), False, 'import logging\n'), ((2239, 2272), 'torch.nn.functional.log_softmax', 'F.log_softmax', (['pred_tensor'], {'dim': '(1)'}), '(pred_tensor, dim=1)\n', (2252, 2272), True, 'import torch.nn.functional as F\n'), ((26... |
# -*- coding: utf-8 -*-
"""SPARC4 spectral response tests.
This script tests the operation of the SPARC4 spectral response classes.
"""
import os
import numpy as np
import pandas as pd
import pytest
from AIS.SPARC4_Spectral_Response import (
Abstract_SPARC4_Spectral_Response,
Concrete_SPARC4_Spectral_Respons... | [
"AIS.SPARC4_Spectral_Response.Concrete_SPARC4_Spectral_Response_3",
"AIS.SPARC4_Spectral_Response.Concrete_SPARC4_Spectral_Response_4",
"numpy.allclose",
"numpy.asanyarray",
"numpy.ones",
"AIS.SPARC4_Spectral_Response.Concrete_SPARC4_Spectral_Response_1",
"AIS.SPARC4_Spectral_Response.Concrete_SPARC4_Sp... | [((539, 554), 'numpy.ones', 'np.ones', (['(4, n)'], {}), '((4, n))\n', (546, 554), True, 'import numpy as np\n'), ((1556, 1591), 'AIS.SPARC4_Spectral_Response.Abstract_SPARC4_Spectral_Response', 'Abstract_SPARC4_Spectral_Response', ([], {}), '()\n', (1589, 1591), False, 'from AIS.SPARC4_Spectral_Response import Abstrac... |
from functools import partial,reduce
from math import sqrt
import inspect
def nargs(function):
print(inspect.getfullargspec(function))
def inc(x):
return x + 1
def compose(f, g):
return lambda x: f(g(x))
x = compose(inc, inc)
print(x(0))
def partial(f, arg0):
return lambda *args: f(arg0, *args)
de... | [
"functools.partial",
"inspect.getfullargspec"
] | [((354, 369), 'functools.partial', 'partial', (['add', '(1)'], {}), '(add, 1)\n', (361, 369), False, 'from functools import partial, reduce\n'), ((106, 138), 'inspect.getfullargspec', 'inspect.getfullargspec', (['function'], {}), '(function)\n', (128, 138), False, 'import inspect\n'), ((624, 640), 'functools.partial', ... |
#!/usr/bin/env python3
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import boot_data
import os
import unittest
from boot_data import _SSH_CONFIG_DIR, _SSH_DIR
class TestBootData(unittest.TestCase):
... | [
"unittest.main",
"os.remove",
"boot_data.ProvisionSSH",
"os.path.exists",
"os.rmdir",
"os.path.join"
] | [((1848, 1863), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1861, 1863), False, 'import unittest\n'), ((397, 446), 'os.path.join', 'os.path.join', (['_SSH_DIR', '"""fuchsia_authorized_keys"""'], {}), "(_SSH_DIR, 'fuchsia_authorized_keys')\n", (409, 446), False, 'import os\n'), ((521, 562), 'os.path.join', 'os.... |
import numpy
import pandas
import requests
from bs4 import BeautifulSoup as bsoup
from time import sleep
from random import randint
# start and end of urls for imbd top 1000 movies site
URL_START = "https://www.imdb.com/search/title/?groups=top_1000&start="
URL_END = "&ref_=adv_nxt"
# data for each movie
titles = []
... | [
"pandas.DataFrame",
"random.randint",
"numpy.arange",
"bs4.BeautifulSoup",
"pandas.to_numeric"
] | [((456, 481), 'numpy.arange', 'numpy.arange', (['(1)', '(1001)', '(50)'], {}), '(1, 1001, 50)\n', (468, 481), False, 'import numpy\n'), ((1634, 1797), 'pandas.DataFrame', 'pandas.DataFrame', (["{'movie': titles, 'year': years, 'runtime': runtimes, 'imdb': ratings,\n 'metascore': metascores, 'votes': votes, 'grossMil... |
import socket
import select
import logging
import binascii
from os import system, path
import sys
import signal
from iolibrary import kill_signal_handler, get_arguments_dict, setup_logger
import constants
signal.signal(signal.SIGINT, kill_signal_handler)
class Connector():
'''
Class that handles the network c... | [
"iolibrary.get_arguments_dict",
"binascii.hexlify",
"socket.socket",
"iolibrary.setup_logger",
"select.select",
"sys.exit",
"signal.signal",
"logging.getLogger"
] | [((206, 255), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'kill_signal_handler'], {}), '(signal.SIGINT, kill_signal_handler)\n', (219, 255), False, 'import signal\n'), ((19732, 19760), 'iolibrary.get_arguments_dict', 'get_arguments_dict', (['sys.argv'], {}), '(sys.argv)\n', (19750, 19760), False, 'from iolibra... |
#1/usr/bin/python3
import netmiko,time
#multi vendor library
device1={
'username' : 'lalit',
'password' : '<PASSWORD>',
'device_type' : 'cisco_ios',
'host' : '192.168.234.131'
}
#to connect to target device
#by checking couple of things connect handler will allow you to connect
device_connect=netmiko.ConnectHa... | [
"netmiko.ConnectHandler"
] | [((303, 336), 'netmiko.ConnectHandler', 'netmiko.ConnectHandler', ([], {}), '(**device1)\n', (325, 336), False, 'import netmiko, time\n')] |
#########################################################################
### Program clean tweets ###
### 1. spaCy POS tagging for relevant tweets (apple fruit vs iphone) ###
### 2. Sentiment analysis of tweets ###
### 3. Group tweets by d... | [
"pandas.DataFrame",
"nltk.stem.WordNetLemmatizer",
"nltk.sentiment.vader.SentimentIntensityAnalyzer",
"pandas.read_csv",
"numpy.where",
"pandas.to_datetime",
"pandas.to_timedelta",
"nltk.corpus.stopwords.words",
"en_core_web_sm.load",
"pandas.concat",
"nltk.word_tokenize"
] | [((1269, 1295), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (1284, 1295), False, 'from nltk.corpus import stopwords\n'), ((1460, 1479), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (1477, 1479), False, 'from nltk.stem import WordNetLemmatizer\n'),... |
# <Copyright 2022, Argo AI, LLC. Released under the MIT license.>
"""Generate MP4 videos with map entities rendered on top of sensor imagery, for all cameras, for a single log.
We use a inferred depth map from LiDAR to render only visible map entities (lanes and pedestrian crossings).
"""
import logging
import os
im... | [
"av2.map.map_api.ArgoverseStaticMap.from_map_dir",
"av2.utils.io.read_img",
"av2.utils.io.write_img",
"av2.geometry.interpolate.interp_arc",
"click.option",
"av2.rendering.video.write_video",
"pathlib.Path",
"click.Path",
"numpy.full",
"click.command",
"av2.rendering.map.EgoViewMapRenderer",
"... | [((950, 977), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (967, 977), False, 'import logging\n'), ((9898, 10022), 'click.command', 'click.command', ([], {'help': '"""Generate map visualizations on ego-view imagery from the Argoverse 2 Sensor or TbV Datasets."""'}), "(help=\n 'Genera... |
from gpiozero import LEDBoard
from signal import pause
leds = LEDBoard(5, 6, 13, 19, 26, pwm=True)
leds.value = (0.2, 0.4, 0.6, 0.8, 1.0)
pause()
| [
"signal.pause",
"gpiozero.LEDBoard"
] | [((63, 99), 'gpiozero.LEDBoard', 'LEDBoard', (['(5)', '(6)', '(13)', '(19)', '(26)'], {'pwm': '(True)'}), '(5, 6, 13, 19, 26, pwm=True)\n', (71, 99), False, 'from gpiozero import LEDBoard\n'), ((141, 148), 'signal.pause', 'pause', ([], {}), '()\n', (146, 148), False, 'from signal import pause\n')] |
#!/usr/bin/env python3
from numba import njit, typeof, typed, types
import rasterio
import numpy as np
import argparse
import os
from osgeo import ogr, gdal
def rel_dem(dem_fileName, pixel_watersheds_fileName, rem_fileName, thalweg_raster):
"""
Calculates REM/HAND/Detrended DEM
Parameter... | [
"numba.typed.Dict.empty",
"rasterio.open",
"argparse.ArgumentParser"
] | [((1807, 1847), 'rasterio.open', 'rasterio.open', (['pixel_watersheds_fileName'], {}), '(pixel_watersheds_fileName)\n', (1820, 1847), False, 'import rasterio\n'), ((1884, 1911), 'rasterio.open', 'rasterio.open', (['dem_fileName'], {}), '(dem_fileName)\n', (1897, 1911), False, 'import rasterio\n'), ((1940, 1969), 'raste... |
from sqlalchemy import create_engine
import os
FLASK_DB_URI = os.environ.get("FLASK_DB_URI")
# Create database connection
engine = create_engine(FLASK_DB_URI) | [
"os.environ.get",
"sqlalchemy.create_engine"
] | [((66, 96), 'os.environ.get', 'os.environ.get', (['"""FLASK_DB_URI"""'], {}), "('FLASK_DB_URI')\n", (80, 96), False, 'import os\n'), ((139, 166), 'sqlalchemy.create_engine', 'create_engine', (['FLASK_DB_URI'], {}), '(FLASK_DB_URI)\n', (152, 166), False, 'from sqlalchemy import create_engine\n')] |
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic import RedirectView
from profiles.views import SignupView
from . import views
urlpatterns = [
url(r'^$', views.HomePage.as_view(), name=... | [
"django.views.generic.RedirectView.as_view",
"profiles.views.SignupView.as_view",
"django.conf.urls.static.static",
"django.conf.urls.include"
] | [((878, 939), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (884, 939), False, 'from django.conf.urls.static import static\n'), ((412, 458), 'django.conf.urls.include', 'include', (['"""profile... |
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import Group
from django.shortcuts import render,redirect,get_object_or_404
from django.http import HttpResponse, Http404,HttpResponseRedirect
from django.contrib.auth.forms import UserCreationForm
from .models import Profile,Orde... | [
"django.contrib.auth.decorators.login_required",
"django.shortcuts.redirect",
"django.urls.reverse",
"django.shortcuts.get_object_or_404",
"django.contrib.messages.info",
"django.shortcuts.render",
"django.http.HttpResponseRedirect",
"django.contrib.auth.models.Group.objects.get"
] | [((5471, 5504), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""login"""'}), "(login_url='login')\n", (5485, 5504), False, 'from django.contrib.auth.decorators import login_required\n'), ((7111, 7127), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {}),... |