code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# tensorflow, numpy를 사용하기위해 import
import tensorflow as tf
import numpy as np
# Deep learning을 위해 데이터를 읽습니다.
data = np.loadtxt('./data.csv',delimiter=',',unpack=True,dtype='float32')
# csv자료의 0부터 2번째 까지의 feature를 x_data에 넣습니다.
# 나머지는 분류가 되는 데이터로 y_data에 넣습니다.
x_data = np.transpose(data[0:3])
y_data = np.transpose(da... | [
"tensorflow.train.AdamOptimizer",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"tensorflow.random_uniform",
"tensorflow.argmax",
"tensorflow.matmul",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"numpy.loadtxt",
"numpy.transpose"
] | [((118, 187), 'numpy.loadtxt', 'np.loadtxt', (['"""./data.csv"""'], {'delimiter': '""","""', 'unpack': '(True)', 'dtype': '"""float32"""'}), "('./data.csv', delimiter=',', unpack=True, dtype='float32')\n", (128, 187), True, 'import numpy as np\n'), ((272, 295), 'numpy.transpose', 'np.transpose', (['data[0:3]'], {}), '(... |
# micropoliszone.py
#
# Micropolis, Unix Version. This game was released for the Unix platform
# in or about 1990 and has been modified for inclusion in the One Laptop
# Per Child program. Copyright (C) 1989 - 2007 Electronic Arts Inc. If
# you need assistance with this program, you may contact:
# http://wiki.lapt... | [
"random.random",
"random.randint"
] | [((7582, 7597), 'random.random', 'random.random', ([], {}), '()\n', (7595, 7597), False, 'import random\n'), ((7717, 7732), 'random.random', 'random.random', ([], {}), '()\n', (7730, 7732), False, 'import random\n'), ((7850, 7865), 'random.random', 'random.random', ([], {}), '()\n', (7863, 7865), False, 'import random\... |
from setuptools import setup
setup(name='yolov3_tf2',
version='0.1',
url='https://github.com/zzh8829/yolov3-tf2',
author='<NAME>',
author_email='<EMAIL>',
packages=['yolov3_tf2']) | [
"setuptools.setup"
] | [((32, 192), 'setuptools.setup', 'setup', ([], {'name': '"""yolov3_tf2"""', 'version': '"""0.1"""', 'url': '"""https://github.com/zzh8829/yolov3-tf2"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'packages': "['yolov3_tf2']"}), "(name='yolov3_tf2', version='0.1', url=\n 'https://github.com/zzh8829/y... |
# Copyright 2012 Google Inc. 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 applicable law or a... | [
"logging.getLogger",
"threading.Thread.__init__",
"traceback.format_exc",
"time.sleep",
"sys.exc_info",
"Queue.Queue"
] | [((774, 806), 'logging.getLogger', 'logging.getLogger', (['"""gcutil-logs"""'], {}), "('gcutil-logs')\n", (791, 806), False, 'import logging\n'), ((2484, 2515), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {}), '(self)\n', (2509, 2515), False, 'import threading\n'), ((3438, 3451), 'Queue.Queue',... |
from fastapi import HTTPException, Depends
from fastapi_jwt_auth import AuthJWT
from redis import Redis
from ..common.db_session import create_session
from ..common.redis_session import redis_conn
from ..subscription.queries import SubscriptionQuery
from ..subscription.helpers import make_key, BALANCE_KEYS
HTTP_403_... | [
"fastapi.HTTPException",
"fastapi.Depends"
] | [((423, 432), 'fastapi.Depends', 'Depends', ([], {}), '()\n', (430, 432), False, 'from fastapi import HTTPException, Depends\n'), ((864, 893), 'fastapi.Depends', 'Depends', (['require_subscription'], {}), '(require_subscription)\n', (871, 893), False, 'from fastapi import HTTPException, Depends\n'), ((914, 933), 'fasta... |
from mmseg.models import build_segmentor
from mmcv.utils import Config, DictAction, get_git_hash
from mmcv.runner import get_dist_info, init_dist, load_checkpoint
cfg = Config.fromfile('configs/swin/upernet_swin_base_patch4_window7_512x512_hubmap.py')
model = build_segmentor(
cfg.model,
train_cfg=cfg.... | [
"mmcv.runner.load_checkpoint",
"mmcv.utils.Config.fromfile",
"torch.zeros"
] | [((170, 257), 'mmcv.utils.Config.fromfile', 'Config.fromfile', (['"""configs/swin/upernet_swin_base_patch4_window7_512x512_hubmap.py"""'], {}), "(\n 'configs/swin/upernet_swin_base_patch4_window7_512x512_hubmap.py')\n", (185, 257), False, 'from mmcv.utils import Config, DictAction, get_git_hash\n'), ((514, 565), 'mm... |
"""Houses Project parsing class from sheetwork_project.yml."""
import time
from pathlib import Path
from typing import Dict, Union
from sheetwork.core.exceptions import ProjectFileParserError
from sheetwork.core.flags import FlagParser
from sheetwork.core.logger import GLOBAL_LOGGER as logger
from sheetwork.core.ui.pr... | [
"sheetwork.core.logger.GLOBAL_LOGGER.debug",
"pathlib.Path",
"pathlib.Path.cwd",
"sheetwork.core.ui.printer.yellow",
"sheetwork.core.utils.PathFinder",
"sheetwork.core.yaml.yaml_helpers.open_yaml",
"sheetwork.core.utils.deprecate",
"time.sleep",
"sheetwork.core.exceptions.ProjectFileParserError",
... | [((1533, 1551), 'pathlib.Path', 'Path', (['"""dumpy_path"""'], {}), "('dumpy_path')\n", (1537, 1551), False, 'from pathlib import Path\n'), ((1658, 1668), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (1666, 1668), False, 'from pathlib import Path\n'), ((1874, 1924), 'sheetwork.core.logger.GLOBAL_LOGGER.debug', 'lo... |
"""
OpenVINO DL Workbench
Class for ORM model describing a dataset converter job
Copyright (c) 2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.o... | [
"sqlalchemy.ForeignKey",
"sqlalchemy.Column",
"sqlalchemy.orm.backref"
] | [((1357, 1405), 'sqlalchemy.Column', 'Column', (['DATASET_TYPES_ENUM_SCHEMA'], {'nullable': '(True)'}), '(DATASET_TYPES_ENUM_SCHEMA, nullable=True)\n', (1363, 1405), False, 'from sqlalchemy import Integer, Column, ForeignKey\n'), ((1208, 1236), 'sqlalchemy.ForeignKey', 'ForeignKey', (['JobsModel.job_id'], {}), '(JobsMo... |
import numpy as np
import cv2
import os
cap = cv2.VideoCapture(1)
faceDetector = cv2.CascadeClassifier(os.path.join("haar-cascade-files","haarcascade_frontalface_default.xml"))
smileDetector = cv2.CascadeClassifier(os.path.join("haar-cascade-files","haarcascade_smile.xml"))
eyeDetector = cv2.CascadeClassifier(os.path.... | [
"cv2.rectangle",
"os.path.join",
"cv2.imshow",
"cv2.putText",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.waitKey"
] | [((47, 66), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(1)'], {}), '(1)\n', (63, 66), False, 'import cv2\n'), ((2047, 2070), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (2068, 2070), False, 'import cv2\n'), ((104, 177), 'os.path.join', 'os.path.join', (['"""haar-cascade-files"""', '"""haarcascad... |
'''scripts/preview.py'''
"""
This script is only meant to output info about how the video will be cut if the
selected options are used.
"""
# External libraries
import cv2
# Included functions
from scripts.usefulFunctions import getAudioChunks, vidTracks, getNewLength
from scripts.wavfile import read, write
# Inter... | [
"scripts.wavfile.read",
"scripts.usefulFunctions.vidTracks",
"tempfile.mkdtemp",
"cv2.VideoCapture",
"scripts.usefulFunctions.getAudioChunks",
"shutil.rmtree",
"subprocess.call",
"scripts.usefulFunctions.getNewLength"
] | [((577, 595), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (593, 595), False, 'import tempfile\n'), ((607, 632), 'cv2.VideoCapture', 'cv2.VideoCapture', (['myInput'], {}), '(myInput)\n', (623, 632), False, 'import cv2\n'), ((683, 709), 'scripts.usefulFunctions.vidTracks', 'vidTracks', (['myInput', 'ffmpeg'... |
import torch
import numpy as np
from tqdm import tqdm
from typing import Union, List, Tuple, Any, Dict
from easydict import EasyDict
from .dataset import preprocess, InferenceDataset, InferenceDatasetWithKeypoints
from .network import build_spin
from .. import BasePose3dRunner, BasePose3dRefiner, ACTIONS
from iPERCor... | [
"iPERCore.tools.utils.dataloaders.build_inference_loader",
"numpy.copy",
"torch.as_tensor",
"iPERCore.tools.utils.geometry.boxes.cal_head_bbox",
"iPERCore.tools.utils.filesio.persistence.load_toml_file",
"torch.load",
"tqdm.tqdm",
"iPERCore.tools.human_digitalizer.bodynets.SMPL",
"torch.tensor",
"... | [((811, 830), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (823, 830), False, 'import torch\n'), ((2079, 2107), 'torch.load', 'torch.load', (["cfg['ckpt_path']"], {}), "(cfg['ckpt_path'])\n", (2089, 2107), False, 'import torch\n'), ((2970, 2984), 'numpy.copy', 'np.copy', (['image'], {}), '(image)\n... |
# -*- coding: utf-8 -*-
from unittest import TestCase
from mock import MagicMock
from pika.adapters import SelectConnection
from pika.channel import Channel
from pika.exceptions import AMQPChannelError, AMQPConnectionError
from pika.spec import Basic, BasicProperties
from rabbitleap.consumer import Consumer
from rabb... | [
"pika.spec.Basic.Deliver",
"pika.spec.BasicProperties",
"re.compile",
"rabbitleap.consumer.Consumer",
"rabbitleap.handling.Handler",
"rabbitleap.envelope.Envelope",
"pika.channel.Channel",
"rabbitleap.retry_policies.LimitedRetriesPolicy",
"rabbitleap.retry_policies.FixedDelayLimitedRetriesPolicy",
... | [((968, 1339), 'pika.spec.BasicProperties', 'BasicProperties', ([], {'content_type': '"""application/json"""', 'content_encoding': '"""utf-8"""', 'headers': 'None', 'delivery_mode': '(2)', 'priority': '(7)', 'correlation_id': '"""some-correlation-id"""', 'reply_to': '"""reply_to_name"""', 'expiration': '"""some-expirat... |
"""
Django settings for system project on Heroku. For more info, see:
https://github.com/heroku/heroku-django-template
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/... | [
"os.path.abspath",
"dj_database_url.config",
"os.path.join"
] | [((4179, 4219), 'dj_database_url.config', 'dj_database_url.config', ([], {'conn_max_age': '(500)'}), '(conn_max_age=500)\n', (4201, 4219), False, 'import dj_database_url\n'), ((4459, 4500), 'os.path.join', 'os.path.join', (['PROJECT_ROOT', '"""staticfiles"""'], {}), "(PROJECT_ROOT, 'staticfiles')\n", (4471, 4500), Fals... |
import os
import pytest
from sqlalchemy import create_engine, event
from sqlalchemy.orm import Session, scoped_session
from sqlalchemy.orm.session import Session as SessionBase, sessionmaker
from app.orm import Server, Base
from app.service import power_off
HABR_TEST_DB_URL="HABR_TEST_DB_URL"
class TestSession(Ses... | [
"sqlalchemy.orm.Session.remove",
"app.orm.Base.metadata.drop_all",
"app.orm.Base.metadata.create_all",
"pytest.skip",
"sqlalchemy.event.listens_for",
"app.service.power_off",
"sqlalchemy.create_engine",
"sqlalchemy.orm.Session",
"sqlalchemy.orm.Session.configure",
"pytest.fixture",
"sqlalchemy.o... | [((781, 812), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (795, 812), False, 'import pytest\n'), ((727, 776), 'sqlalchemy.orm.session.sessionmaker', 'sessionmaker', ([], {'autoflush': '(False)', 'class_': 'TestSession'}), '(autoflush=False, class_=TestSession)\n', (739, ... |
import pygame, sys
from constants import *
from casting.cast import *
from casting.ball import Ball
from casting.paddle import Paddle
from casting.score import Score
from scripting.collision import CollisionManager
pygame.init()
# create the screen/display for the game
screen = pygame.display.set_mode((WIDTH, HEIG... | [
"sys.exit",
"pygame.init",
"pygame.draw.line",
"pygame.event.get",
"pygame.display.set_mode",
"casting.paddle.Paddle",
"scripting.collision.CollisionManager",
"casting.score.Score",
"pygame.time.Clock",
"casting.ball.Ball",
"pygame.display.set_caption",
"pygame.display.update"
] | [((220, 233), 'pygame.init', 'pygame.init', ([], {}), '()\n', (231, 233), False, 'import pygame, sys\n'), ((284, 324), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(WIDTH, HEIGHT)'], {}), '((WIDTH, HEIGHT))\n', (307, 324), False, 'import pygame, sys\n'), ((325, 360), 'pygame.display.set_caption', 'pygame.di... |
from astropy.utils.decorators import format_doc
from astropy.coordinates.representation import CartesianRepresentation, CartesianDifferential
from astropy.coordinates.baseframe import BaseCoordinateFrame, base_doc, frame_transform_graph
from astropy.coordinates.attributes import TimeAttribute
from astropy.time import ... | [
"astropy.coordinates.baseframe.frame_transform_graph.transform",
"astropy.utils.decorators.format_doc",
"astropy.coordinates.attributes.TimeAttribute",
"astropy.time.Time",
"astropy.coordinates.matrix_utilities.matrix_transpose",
"spiceypy.pxform"
] | [((600, 625), 'astropy.time.Time', 'Time', (['"""J2000"""'], {'scale': '"""tt"""'}), "('J2000', scale='tt')\n", (604, 625), False, 'from astropy.time import Time\n'), ((629, 675), 'astropy.utils.decorators.format_doc', 'format_doc', (['base_doc'], {'components': '""""""', 'footer': '""""""'}), "(base_doc, components=''... |
import RPi.GPIO as GPIO
import time
from pyminder.beeminder import Beeminder
import os
import yaml
import time
import datetime
base_dir = os.path.dirname(os.path.realpath(__file__))
config = yaml.load(open(f"{base_dir}/config.yaml", "r"), Loader=yaml.FullLoader)
bm = Beeminder()
bm.set_username(config['beeminder']['... | [
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"time.sleep",
"pyminder.beeminder.Beeminder",
"os.path.realpath",
"datetime.datetime.today",
"datetime.timedelta",
"time.time",
"RPi.GPIO.setmode"
] | [((270, 281), 'pyminder.beeminder.Beeminder', 'Beeminder', ([], {}), '()\n', (279, 281), False, 'from pyminder.beeminder import Beeminder\n'), ((1544, 1566), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (1556, 1566), True, 'import RPi.GPIO as GPIO\n'), ((1680, 1703), 'RPi.GPIO.setup', 'GPIO.s... |
"""
Validates an EBU-TT or EBU-TT-D file.
The ``validator`` script validates the specified input file as either an
EBU-TT Part 1, Part 3 or EBU-TT-D file, reporting the first error that is
found, or that everything is fine, if no errors are found. If the format
is not specified, the default is EBU-TT-D.
Basic usage:
... | [
"os.path.expanduser",
"argparse.ArgumentParser",
"os.getcwd"
] | [((686, 746), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Validate a local file"""'}), "(description='Validate a local file')\n", (709, 746), False, 'import argparse\n'), ((1306, 1317), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1315, 1317), False, 'import os\n'), ((1319, 1346), 'os... |
#!/usr/bin/env python
#
# Copyright 2019 The Nakama Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.normpath",
"os.chdir",
"platform.architecture",
"platform.system",
"subprocess.call",
"sys.exit",
"os.path.abspath"
] | [((822, 885), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Nakama C++ API generator"""'}), "(description='Nakama C++ API generator')\n", (845, 885), False, 'import argparse\n'), ((1806, 1829), 'os.path.abspath', 'os.path.abspath', (['"""./.."""'], {}), "('./..')\n", (1821, 1829), False... |
import os
import gzip
import time
import copy
import random
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
fro... | [
"torch.nn.Dropout",
"torch.nn.CrossEntropyLoss",
"gzip.open",
"torch.max",
"numpy.array",
"torch.cuda.is_available",
"torch.sum",
"numpy.frombuffer",
"torchvision.transforms.ToTensor",
"sklearn.model_selection.train_test_split",
"torch.save",
"torch.no_grad",
"torch.nn.functional.max_pool2d"... | [((1911, 1941), 'os.path.join', 'os.path.join', (['data_dir', 'x_name'], {}), '(data_dir, x_name)\n', (1923, 1941), False, 'import os\n'), ((1955, 1985), 'os.path.join', 'os.path.join', (['data_dir', 'y_name'], {}), '(data_dir, y_name)\n', (1967, 1985), False, 'import os\n'), ((2528, 2539), 'numpy.array', 'np.array', (... |
import json
from main import download_comments
info = json.load(open('info.json'))
comments = []
for video_id in info['video_list']:
print('video %s' % video_id)
count = 0
for comment in download_comments(video_id):
# this part prints the specified user, have fun
if comment['username'] ==... | [
"main.download_comments",
"json.dumps"
] | [((201, 228), 'main.download_comments', 'download_comments', (['video_id'], {}), '(video_id)\n', (218, 228), False, 'from main import download_comments\n'), ((529, 549), 'json.dumps', 'json.dumps', (['comments'], {}), '(comments)\n', (539, 549), False, 'import json\n')] |
# -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import pyxb.binding.generate
import pyxb.binding.datatypes as xs
import pyxb.binding.basis
import pyxb.utils.domutils
import os.path
xsd='''<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xm... | [
"logging.getLogger",
"unittest.main",
"logging.basicConfig"
] | [((99, 126), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (116, 126), False, 'import logging\n'), ((70, 91), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (89, 91), False, 'import logging\n'), ((2049, 2064), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2062, 20... |
'''
实验:
用ngram来分类
其中ngram为单一数据训练模型
ngram-batch为带batch的ngram训练模型
训练取了10epoch
训练好后将原始数据通过ngram得到的特征向量保存到了./data/ngram_featrue_x.npy
0.5219466871716006
'''
import numpy as np
from sklearn.linear_model import LogisticRegression
import pandas as pd
x_train = np.array(np.load('./data/ngram_featrue_x.npy'))
y_t... | [
"numpy.mean",
"numpy.load",
"sklearn.linear_model.LogisticRegression"
] | [((327, 356), 'numpy.load', 'np.load', (['"""./data/y_train.npy"""'], {}), "('./data/y_train.npy')\n", (334, 356), True, 'import numpy as np\n'), ((413, 433), 'sklearn.linear_model.LogisticRegression', 'LogisticRegression', ([], {}), '()\n', (431, 433), False, 'from sklearn.linear_model import LogisticRegression\n'), (... |
import numpy as np
import os
from .. import Globals
import PyFileIO as pf
def _ReadTestPos():
fname = Globals.ModulePath+"__data/testpos.dat"
return pf.ReadASCIIData(fname)
| [
"PyFileIO.ReadASCIIData"
] | [((154, 177), 'PyFileIO.ReadASCIIData', 'pf.ReadASCIIData', (['fname'], {}), '(fname)\n', (170, 177), True, 'import PyFileIO as pf\n')] |
import pytest
import sqlite3
from unittest.mock import call, Mock
from allennlp.common.testing import AllenNlpTestCase
from scripts.ai2_internal.resume_daemon import (
BeakerStatus,
create_table,
handler,
logger,
resume,
start_autoresume,
)
# Don't spam the log in tests.
logger.removeHandler(... | [
"unittest.mock.call.resume",
"scripts.ai2_internal.resume_daemon.logger.removeHandler",
"unittest.mock.Mock",
"sqlite3.connect",
"scripts.ai2_internal.resume_daemon.start_autoresume",
"scripts.ai2_internal.resume_daemon.resume",
"unittest.mock.call.get_status",
"scripts.ai2_internal.resume_daemon.Beak... | [((299, 328), 'scripts.ai2_internal.resume_daemon.logger.removeHandler', 'logger.removeHandler', (['handler'], {}), '(handler)\n', (319, 328), False, 'from scripts.ai2_internal.resume_daemon import BeakerStatus, create_table, handler, logger, resume, start_autoresume\n'), ((458, 485), 'sqlite3.connect', 'sqlite3.connec... |
"""
Useful geometric operations, e.g. Orthographic projection and a differentiable Rodrigues formula
Parts of the code are taken from https://github.com/MandyMo/pytorch_HMR
"""
import torch
def rodrigues(theta):
"""Convert axis-angle representation to rotation matrix.
Args:
theta: size = [B, 3]
Ret... | [
"torch.unsqueeze",
"torch.stack",
"torch.sin",
"torch.norm",
"torch.cos",
"torch.div",
"torch.cat"
] | [((423, 460), 'torch.norm', 'torch.norm', (['(theta + 1e-08)'], {'p': '(2)', 'dim': '(1)'}), '(theta + 1e-08, p=2, dim=1)\n', (433, 460), False, 'import torch\n'), ((476, 503), 'torch.unsqueeze', 'torch.unsqueeze', (['l1norm', '(-1)'], {}), '(l1norm, -1)\n', (491, 503), False, 'import torch\n'), ((521, 544), 'torch.div... |
import os
from click.testing import CliRunner
from ruv_dl import mv
runner = CliRunner()
def test_mv(fs, mocker):
os.makedirs('/a/b/c')
os.chdir('/a/b')
mover_patch = mocker.patch('ruv_dl.Mover')
runner.invoke(mv, ['c', 'd'])
mover_patch.assert_called_once_with('/a/b/c', '/a/b/d')
mover_patc... | [
"os.makedirs",
"os.chdir",
"click.testing.CliRunner"
] | [((79, 90), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (88, 90), False, 'from click.testing import CliRunner\n'), ((122, 143), 'os.makedirs', 'os.makedirs', (['"""/a/b/c"""'], {}), "('/a/b/c')\n", (133, 143), False, 'import os\n'), ((148, 164), 'os.chdir', 'os.chdir', (['"""/a/b"""'], {}), "('/a/b')\n", ... |
import json
import logging
from io import BytesIO
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.db import transaction
from django.test import Client as DjangoClient
from rest_framework.parsers import JSONParser
from ambulance.models import Ambulance
from emstrack.tes... | [
"logging.getLogger",
"login.serializers.ClientSerializer",
"login.models.ClientLog.objects.filter",
"ambulance.models.Ambulance.objects.get",
"django.db.transaction.atomic",
"json.dumps",
"io.BytesIO",
"hospital.models.Hospital.objects.get",
"login.models.Client.objects.get",
"rest_framework.parse... | [((556, 583), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (573, 583), False, 'import logging\n'), ((688, 781), 'login.models.Client.objects.create', 'Client.objects.create', ([], {'client_id': '"""client_id_1"""', 'user': 'self.u1', 'status': 'ClientStatus.O.name'}), "(client_id='clien... |
import tensorflow as tf
from grpc.beta import implementations
from tensorflow_serving.apis import predict_pb2, prediction_service_pb2
import os
channel = implementations.insecure_channel("10.100.51.111", 8877)
stub = prediction_service_pb2.beta_create_PredictionService_stub(channel)
model_name = "deepseg_test"
def s... | [
"tensorflow_serving.apis.prediction_service_pb2.beta_create_PredictionService_stub",
"tensorflow_serving.apis.predict_pb2.PredictRequest",
"tensorflow.make_tensor_proto",
"os.path.join",
"grpc.beta.implementations.insecure_channel",
"os.path.dirname",
"tensorflow.make_ndarray"
] | [((155, 210), 'grpc.beta.implementations.insecure_channel', 'implementations.insecure_channel', (['"""10.100.51.111"""', '(8877)'], {}), "('10.100.51.111', 8877)\n", (187, 210), False, 'from grpc.beta import implementations\n'), ((218, 284), 'tensorflow_serving.apis.prediction_service_pb2.beta_create_PredictionService_... |
"""
Figure 3. Heterovalent bispecific
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from .figureCommon import getSetup, subplotLabel, setFontSize, heatmap, cellPopulations, overlapCellPopulation
from valentbind import polyc, polyfc
pairs = [(r"$R_1^{hi}R_2^{lo}$", r"$R_1^{med}R_2^... | [
"numpy.power",
"matplotlib.pyplot.Normalize",
"numpy.zeros",
"matplotlib.cm.ScalarMappable",
"matplotlib.pyplot.clabel",
"numpy.meshgrid",
"numpy.logspace",
"valentbind.polyfc",
"valentbind.polyc",
"numpy.arange"
] | [((3081, 3131), 'numpy.logspace', 'np.logspace', (['abundRange[0]', 'abundRange[1]', 'nAbdPts'], {}), '(abundRange[0], abundRange[1], nAbdPts)\n', (3092, 3131), True, 'import numpy as np\n'), ((3247, 3280), 'numpy.meshgrid', 'np.meshgrid', (['abundScan', 'abundScan'], {}), '(abundScan, abundScan)\n', (3258, 3280), True... |
""" bgasync.api - BGAPI classes, constants, and utility functions. """
# This file is auto-generated. Edit at your own risk!
from struct import Struct
from collections import namedtuple
from enum import Enum
from .apibase import *
class event_system_boot(Decodable):
decoded_type = namedtuple('event_system_boot_typ... | [
"struct.Struct",
"collections.namedtuple"
] | [((287, 405), 'collections.namedtuple', 'namedtuple', (['"""event_system_boot_type"""', "('major', 'minor', 'patch', 'build', 'll_version', 'protocol_version', 'hw')"], {}), "('event_system_boot_type', ('major', 'minor', 'patch', 'build',\n 'll_version', 'protocol_version', 'hw'))\n", (297, 405), False, 'from collec... |
import time
import fileinput
INPUT_FILE = "aoc_2018_15.dat"
class Unit:
def __init__(self, type_: str, pos: tuple):
self.type = type_
self.pos = pos
self.hp = 300
self.spaces = []
def find_adj(self, spaces):
neighbors = calc_neighbors(self.pos)
... | [
"time.time",
"fileinput.input"
] | [((1983, 1994), 'time.time', 'time.time', ([], {}), '()\n', (1992, 1994), False, 'import time\n'), ((1141, 1168), 'fileinput.input', 'fileinput.input', (['input_file'], {}), '(input_file)\n', (1156, 1168), False, 'import fileinput\n'), ((2424, 2435), 'time.time', 'time.time', ([], {}), '()\n', (2433, 2435), False, 'imp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ============================================================================ #
from matplotlib.ticker import ScalarFormatter
import numpy as np
import matplotlib.pyplot as plt
# ============================================================================ #
# prepare figu... | [
"matplotlib.ticker.ScalarFormatter",
"numpy.empty",
"numpy.loadtxt",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((337, 371), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(4)', '(1)'], {'figsize': '(6, 8)'}), '(4, 1, figsize=(6, 8))\n', (349, 371), True, 'import matplotlib.pyplot as plt\n'), ((1664, 1674), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1672, 1674), True, 'import matplotlib.pyplot as plt\n'), ((525,... |
import json
import os
import threading
import time
import socket
import getpass
from datetime import datetime
from wandb import util
import wandb
METADATA_FNAME = 'wandb-metadata.json'
class Meta(object):
"""Used to store metadata during and after a run."""
HEARTBEAT_INTERVAL_SECONDS = 15
def __init__... | [
"datetime.datetime.utcfromtimestamp",
"datetime.datetime.utcnow",
"threading.Lock",
"os.path.join",
"time.sleep",
"os.getcwd",
"wandb.util.json_dumps_safer",
"getpass.getuser",
"threading.Thread",
"socket.gethostname"
] | [((367, 404), 'os.path.join', 'os.path.join', (['out_dir', 'METADATA_FNAME'], {}), '(out_dir, METADATA_FNAME)\n', (379, 404), False, 'import os\n'), ((610, 626), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (624, 626), False, 'import threading\n'), ((671, 713), 'threading.Thread', 'threading.Thread', ([], {'ta... |
#!/usr/bin/env python
# coding: utf-8
# In[9]:
import pandas as pd
import os
import numpy
import MySQLdb
#conn= MySQLdb.connect("localhost","root","admin","omdb")
#df_mysql = pd.read_sql("select * from sitedb",conn)
omdb = os.getcwd() + "\\" + "OMDB.csv"
single = os.getcwd() + "\\" + "single.csv"
pntxt = os.getcwd(... | [
"pandas.DataFrame",
"pandas.read_csv",
"os.getcwd"
] | [((4064, 4083), 'pandas.read_csv', 'pd.read_csv', (['single'], {}), '(single)\n', (4075, 4083), True, 'import pandas as pd\n'), ((1578, 1595), 'pandas.DataFrame', 'pd.DataFrame', (['dic'], {}), '(dic)\n', (1590, 1595), True, 'import pandas as pd\n'), ((2443, 2460), 'pandas.DataFrame', 'pd.DataFrame', (['dic'], {}), '(d... |
#!/usr/bin/env python3
import argparse
import hashlib
def main() -> None:
# Parse arguments
parser = argparse.ArgumentParser(
description="Compute the BLAKE2s hash of an input secret."
)
parser.add_argument("secret", help="input string to hash")
args = parser.parse_args()
# Compute ha... | [
"argparse.ArgumentParser",
"hashlib.new"
] | [((111, 199), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Compute the BLAKE2s hash of an input secret."""'}), "(description=\n 'Compute the BLAKE2s hash of an input secret.')\n", (134, 199), False, 'import argparse\n'), ((331, 353), 'hashlib.new', 'hashlib.new', (['"""blake2s"""'],... |
# * Local Imports -->
# * Local Imports --------------------------------------------------------------------------------------->
from antipetros_discordbot.utility.gidtools_functions import loadjson
from antipetros_discordbot.init_userdata.user_data_setup import ParaStorageKeeper
import os
APPDATA = ParaStorageKeeper.... | [
"os.readlink",
"antipetros_discordbot.utility.gidtools_functions.loadjson",
"os.path.join",
"antipetros_discordbot.init_userdata.user_data_setup.ParaStorageKeeper.get_appdata",
"os.path.dirname",
"os.path.islink"
] | [((302, 333), 'antipetros_discordbot.init_userdata.user_data_setup.ParaStorageKeeper.get_appdata', 'ParaStorageKeeper.get_appdata', ([], {}), '()\n', (331, 333), False, 'from antipetros_discordbot.init_userdata.user_data_setup import ParaStorageKeeper\n'), ((378, 419), 'antipetros_discordbot.utility.gidtools_functions.... |
from WS2801 import WS2801Wrapper
from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket
import sys
pixels = WS2801Wrapper()
PIXEL_COUNT = pixels.count()
clients = []
class SimpleSliderColor(WebSocket):
def handleMessage(self):
#print('handling message ' + self.data)
col = self.data[0]... | [
"WS2801.WS2801Wrapper",
"SimpleWebSocketServer.SimpleWebSocketServer"
] | [((122, 137), 'WS2801.WS2801Wrapper', 'WS2801Wrapper', ([], {}), '()\n', (135, 137), False, 'from WS2801 import WS2801Wrapper\n'), ((1477, 1527), 'SimpleWebSocketServer.SimpleWebSocketServer', 'SimpleWebSocketServer', (['""""""', '(5000)', 'SimpleSliderColor'], {}), "('', 5000, SimpleSliderColor)\n", (1498, 1527), Fals... |
import pygame
import pystage
from pystage.core.constants import KEY_MAPPINGS
from pystage.core._base_sprite import BaseSprite
class _Sensing(BaseSprite):
def __init__(self):
super().__init__()
def sensing_askandwait(self, question):
# an input field, answer needs to be available somehow
... | [
"pygame.key.get_pressed",
"pygame.mouse.get_pressed",
"pygame.mouse.get_pos"
] | [((468, 492), 'pygame.key.get_pressed', 'pygame.key.get_pressed', ([], {}), '()\n', (490, 492), False, 'import pygame\n'), ((568, 594), 'pygame.mouse.get_pressed', 'pygame.mouse.get_pressed', ([], {}), '()\n', (592, 594), False, 'import pygame\n'), ((639, 661), 'pygame.mouse.get_pos', 'pygame.mouse.get_pos', ([], {}), ... |
# coding=utf-8
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import SGDClassifier
from sklearn.metrics import roc_curve, auc
from sklearn.svm import SVC
import data_processing
import globe
import word2vec_gensim_train as train
# 分类流程 liyu
def run_li():
# 读入数据
# pos_file_path = ... | [
"data_processing.data_split",
"sklearn.linear_model.SGDClassifier",
"word2vec_gensim_train.text_vecs_zx",
"sklearn.svm.SVC",
"sklearn.metrics.auc",
"matplotlib.pyplot.plot",
"word2vec_gensim_train.train_test",
"numpy.array",
"sklearn.metrics.roc_curve",
"data_processing.read_data",
"matplotlib.p... | [((594, 649), 'data_processing.read_data', 'data_processing.read_data', (['pos_file_path', 'neg_file_path'], {}), '(pos_file_path, neg_file_path)\n', (619, 649), False, 'import data_processing\n'), ((660, 702), 'data_processing.data_split', 'data_processing.data_split', (['tmp[0]', 'tmp[1]'], {}), '(tmp[0], tmp[1])\n',... |
# Copyright 2010-2019 <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 applicable law or ag... | [
"logging.debug",
"logging.info",
"logging.error",
"StringIO.StringIO",
"hubPackets.HubWindCmd",
"hubPackets.HubRplyEmptyError",
"json.loads",
"hubPackets.HubTachCmd",
"logging.warning",
"hubPackets.MultiTSuperCmd",
"hubPackets.HubTimeoutError",
"hubPackets.HubTCCmd",
"traceback.format_exc",
... | [((4754, 4806), 'logging.debug', 'logging.debug', (['"""start of command creation from JSON"""'], {}), "('start of command creation from JSON')\n", (4767, 4806), False, 'import logging\n'), ((4860, 4898), 'logging.debug', 'logging.debug', (['"""created all T/RH cmds"""'], {}), "('created all T/RH cmds')\n", (4873, 4898... |
#!/usr/bin/env python
#
# Tests the basic methods of the DREAM MCMC method.
#
# This file is part of PINTS.
# Copyright (c) 2017-2019, University of Oxford.
# For licensing information, see the LICENSE file distributed with the PINTS
# software package.
#
import unittest
import numpy as np
import pints
import pints... | [
"numpy.random.normal",
"pints.GaussianLogLikelihood",
"pints.UniformLogPrior",
"pints.DreamMCMC",
"pints.toy.LogisticModel",
"shared.StreamCapture",
"pints.LogPosterior",
"numpy.array",
"numpy.linspace",
"pints.MCMCController",
"numpy.random.seed",
"unittest.main",
"numpy.all",
"pints.Sing... | [((7693, 7708), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7706, 7708), False, 'import unittest\n'), ((806, 823), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (820, 823), True, 'import numpy as np\n'), ((872, 891), 'pints.toy.LogisticModel', 'toy.LogisticModel', ([], {}), '()\n', (889, 891),... |
#!/usr/bin/env python3
import click
import ssl
import socket
import colorama
from colorama import Fore, Style
import datetime
# import logging
# logging.basicConfig(format='%(asctime)s %(levelname)s:%(message)s', level=logging.DEBUG)
# logger = logging.getLogger(__file__)
def retrieve_certinfo(hostname, port):
... | [
"socket.create_connection",
"click.Choice",
"socket.socket",
"click.option",
"ssl.create_default_context",
"datetime.datetime.strptime",
"click.File",
"datetime.datetime.now",
"datetime.timedelta",
"click.command"
] | [((1850, 1865), 'click.command', 'click.command', ([], {}), '()\n', (1863, 1865), False, 'import click\n'), ((2053, 2181), 'click.option', 'click.option', (['"""--connect"""'], {'help': '"""The service url to connect to in the form <address>:<port>, e.g. www.example.com:443"""'}), "('--connect', help=\n 'The service... |
from models import *
from pokeapi import PokeAPI
import logging
# logger = logging.getLogger('peewee')
# logger.setLevel(logging.DEBUG)
# logger.addHandler(logging.StreamHandler())
def main():
api = PokeAPI()
for i in range(1, api.get_count(), 1):
try:
raw_pokemon = api.get_pokemon(i)... | [
"pokeapi.PokeAPI"
] | [((205, 214), 'pokeapi.PokeAPI', 'PokeAPI', ([], {}), '()\n', (212, 214), False, 'from pokeapi import PokeAPI\n')] |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 12 09:57:11 2016
@author: smrak
"""
import numpy as np
from pandas import read_hdf
import matplotlib.pyplot as plt
from scipy import interpolate
from scipy import signal
#fs = 10
#order = 5
#highcut = 0.025
#nyq = 0.5 * fs
#high = highcut / nyq
#b, a = signal.butter(ord... | [
"numpy.arange",
"matplotlib.pyplot.plot",
"scipy.signal.butter",
"scipy.interpolate.interp1d",
"numpy.array",
"scipy.signal.lfilter",
"numpy.isfinite",
"numpy.std",
"pandas.read_hdf"
] | [((984, 996), 'pandas.read_hdf', 'read_hdf', (['fn'], {}), '(fn)\n', (992, 996), False, 'from pandas import read_hdf\n'), ((1080, 1119), 'numpy.array', 'np.array', (["data['C1', sv, skip:, 'data']"], {}), "(data['C1', sv, skip:, 'data'])\n", (1088, 1119), True, 'import numpy as np\n'), ((1195, 1219), 'numpy.arange', 'n... |
import time
import multiprocessing as mp
from multiprocessing import Pool as ProcessPool
import numpy as np
import pandas as pd
from floris.utils.tools import valid_ops as vops
from floris.utils.tools import farm_config as fconfig
from floris.utils.visualization import wflo_eval as vweval
from floris.utils.visualizat... | [
"multiprocessing.cpu_count",
"numpy.argsort",
"floris.utils.tools.valid_ops.winds_discretization",
"numpy.array",
"floris.utils.tools.valid_ops.grids2layout",
"floris.utils.tools.valid_ops.wind_turbines_sort",
"floris.utils.tools.valid_ops.wt_power_reorder",
"floris.utils.visualization.wflo_opt.wt_pow... | [((11682, 11722), 'floris.utils.tools.valid_ops.coordinate_transform', 'vops.coordinate_transform', (['layout', 'theta'], {}), '(layout, theta)\n', (11707, 11722), True, 'from floris.utils.tools import valid_ops as vops\n'), ((11738, 11769), 'floris.utils.tools.valid_ops.wind_turbines_sort', 'vops.wind_turbines_sort', ... |
import sys, itertools
def check_adj_matching_digits(num: int):
digits = [ d for d in str(num) ]
cur_len = 1
for i in range (len(digits) - 1):
if digits[i] == digits[i+1]:
cur_len += 1
else:
if cur_len == 2:
return True
cur_len = 1
ret... | [
"itertools.chain.from_iterable"
] | [((3028, 3070), 'itertools.chain.from_iterable', 'itertools.chain.from_iterable', (['non_dec[-1]'], {}), '(non_dec[-1])\n', (3057, 3070), False, 'import sys, itertools\n'), ((3123, 3161), 'itertools.chain.from_iterable', 'itertools.chain.from_iterable', (['inc[-1]'], {}), '(inc[-1])\n', (3152, 3161), False, 'import sys... |
# Copyright (c) 2009-2021 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause
# License.
"""Test that `LocalSnapshot` and `LocalSnapshotGPU` work."""
from copy import deepcopy
import hoomd
from hoomd.data.array import HOOMDGPUArray
import numpy as n... | [
"numpy.allclose",
"numpy.issubdtype",
"pytest.mark.skipif",
"numpy.array",
"cupy.allclose",
"pytest.raises",
"cupy.array",
"copy.deepcopy",
"pytest.fixture",
"numpy.linspace",
"pytest.skip",
"hoomd.Snapshot"
] | [((637, 708), 'pytest.mark.skipif', 'pytest.mark.skipif', (['skip_mpi4py'], {'reason': '"""mpi4py could not be imported."""'}), "(skip_mpi4py, reason='mpi4py could not be imported.')\n", (655, 708), False, 'import pytest\n'), ((7926, 7957), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='... |
"""
Useful tools when working with Figura configs.
"""
import os
from .settings import get_setting
from .errors import ConfigError, ConfigParsingError, ConfigValueError
from .path import to_figura_path
from .container import ConfigContainer
from .parser import ConfigParser
from .importutils import is_impor... | [
"os.path.dirname",
"os.listdir",
"os.path.join",
"os.path.isdir"
] | [((3589, 3625), 'os.path.dirname', 'os.path.dirname', (['pkg_module.__file__'], {}), '(pkg_module.__file__)\n', (3604, 3625), False, 'import os\n'), ((3681, 3701), 'os.listdir', 'os.listdir', (['base_dir'], {}), '(base_dir)\n', (3691, 3701), False, 'import os\n'), ((3908, 3944), 'os.path.join', 'os.path.join', (['base_... |
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from sklearn.impute import SimpleImputer
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import Binarizer
from tpot.export_utils import set_param_recursive... | [
"sklearn.ensemble.RandomForestRegressor",
"tpot.export_utils.set_param_recursive",
"sklearn.preprocessing.Binarizer",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.impute.SimpleImputer"
] | [((413, 487), 'pandas.read_csv', 'pd.read_csv', (['"""PATH/TO/DATA/FILE"""'], {'sep': '"""COLUMN_SEPARATOR"""', 'dtype': 'np.float64'}), "('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64)\n", (424, 487), True, 'import pandas as pd\n'), ((627, 691), 'sklearn.model_selection.train_test_split', 'train_test_s... |
"""
Examples
--------
Convert existing jupyter notebook to an airbnb knowledge repo format
- python convert_to_knowledge_repo.py --ml_repo . --knowledge_repo knowledge-repo
Deploying the webapp
- knowledge_repo --repo knowledge-repo deploy
"""
import os
import re
import json
import subprocess
from dateutil import par... | [
"subprocess.check_output",
"dateutil.parser.parse",
"os.listdir",
"argparse.ArgumentParser",
"re.compile",
"subprocess.Popen",
"os.path.splitext",
"os.path.join",
"os.path.split",
"json.load",
"os.path.isdir",
"subprocess.call",
"os.path.abspath",
"json.dump",
"os.remove"
] | [((404, 428), 'os.path.abspath', 'os.path.abspath', (['ml_repo'], {}), '(ml_repo)\n', (419, 428), False, 'import os\n'), ((455, 486), 'os.path.abspath', 'os.path.abspath', (['knowledge_repo'], {}), '(knowledge_repo)\n', (470, 486), False, 'import os\n'), ((742, 774), 'subprocess.call', 'subprocess.call', (['cmd'], {'sh... |
# Generated by Django 3.1 on 2020-09-11 05:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('proxy_service', '0004_botserverendpoint'),
]
operations = [
migrations.CreateModel(
name='CommandRequest',
fields=[
... | [
"django.db.migrations.DeleteModel",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.BigIntegerField",
"django.db.models.CharField"
] | [((1673, 1721), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""BotServerEndpoint"""'}), "(name='BotServerEndpoint')\n", (1695, 1721), False, 'from django.db import migrations, models\n'), ((1754, 1794), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""Slac... |
import re
from django.template.loader import render_to_string
from django.forms.widgets import TextInput, MultiWidget
class CreditCardNumberWidget(TextInput):
def render(self, name, value, attrs=None):
if value:
value = re.sub('[\s-]', '', value)
if len(value) == 16:
... | [
"re.sub",
"django.template.loader.render_to_string"
] | [((1192, 1256), 'django.template.loader.render_to_string', 'render_to_string', (['"""payments/credit_card_expiry_widget.html"""', 'ctx'], {}), "('payments/credit_card_expiry_widget.html', ctx)\n", (1208, 1256), False, 'from django.template.loader import render_to_string\n'), ((248, 275), 're.sub', 're.sub', (['"""[\\\\... |
# Due to costs, In order to actually send an email, the recipient MUST be an approved email on mailgun.
from requests import Response, post
import os
from typing import List
class MailgunException(Exception):
def __init__(self, message: str):
self.message = message
class Mailgun:
FROM_TITLE = "Pric... | [
"requests.post",
"os.environ.get"
] | [((502, 541), 'os.environ.get', 'os.environ.get', (['"""MAILGUN_API_KEY"""', 'None'], {}), "('MAILGUN_API_KEY', None)\n", (516, 541), False, 'import os\n'), ((567, 605), 'os.environ.get', 'os.environ.get', (['"""MAILGUN_DOMAIN"""', 'None'], {}), "('MAILGUN_DOMAIN', None)\n", (581, 605), False, 'import os\n'), ((829, 10... |
"""penaltymodel provides functionality for accessing PenaltyModel factories.
Accessing Factories
-------------------
Any factories that have been identified through the :const:`FACTORY_ENTRYPOINT` entrypoint
and installed on the python path can be accessed through the :func:`get_penalty_model`
function.
Examples:
... | [
"pkg_resources.iter_entry_points"
] | [((3331, 3368), 'pkg_resources.iter_entry_points', 'iter_entry_points', (['FACTORY_ENTRYPOINT'], {}), '(FACTORY_ENTRYPOINT)\n', (3348, 3368), False, 'from pkg_resources import iter_entry_points\n'), ((3878, 3913), 'pkg_resources.iter_entry_points', 'iter_entry_points', (['CACHE_ENTRYPOINT'], {}), '(CACHE_ENTRYPOINT)\n'... |
# external
import pytest
# project
import deal
# app
from .helpers import run_sync
def test_safe():
func = deal.safe(lambda x: 1 / x)
func(2)
with pytest.raises(deal.RaisesContractError):
func(0)
def test_decorating_async_function():
@deal.safe
async def func(x):
return 10 / x
... | [
"deal.safe",
"pytest.raises"
] | [((115, 141), 'deal.safe', 'deal.safe', (['(lambda x: 1 / x)'], {}), '(lambda x: 1 / x)\n', (124, 141), False, 'import deal\n'), ((163, 202), 'pytest.raises', 'pytest.raises', (['deal.RaisesContractError'], {}), '(deal.RaisesContractError)\n', (176, 202), False, 'import pytest\n'), ((364, 403), 'pytest.raises', 'pytest... |
# -*- coding: utf-8 -*-
from odoo import _, api, fields, models
class WeComAppType(models.Model):
_name = "wecom.app.subtype"
_description = "Wecom Application Subtype"
_order = "parent_id,sequence"
name = fields.Char(string="Name", translate=True, copy=False, required=True,)
parent_id = fields... | [
"odoo.fields.Many2one",
"odoo._",
"odoo.fields.Integer",
"odoo.fields.Char"
] | [((226, 295), 'odoo.fields.Char', 'fields.Char', ([], {'string': '"""Name"""', 'translate': '(True)', 'copy': '(False)', 'required': '(True)'}), "(string='Name', translate=True, copy=False, required=True)\n", (237, 295), False, 'from odoo import _, api, fields, models\n'), ((314, 427), 'odoo.fields.Many2one', 'fields.M... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
import time
import pandas as pd
from bs4 import BeautifulSoup
#Wir starten den Browser auf
driver = webdriver.Chrome(executable_path='/usr/local/b... | [
"selenium.webdriver.Chrome",
"time.sleep"
] | [((274, 337), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'executable_path': '"""/usr/local/bin/chromedriver"""'}), "(executable_path='/usr/local/bin/chromedriver')\n", (290, 337), False, 'from selenium import webdriver\n'), ((464, 478), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (474, 478), False... |
import random
import re
from django.conf import settings
from django.db import models
from django.db.models import Sum
from django.utils import timezone
class Link(models.Model):
'''
Basic Link.
'''
created_on = models.DateTimeField(auto_now_add=True)
modified_on = models.DateTimeField(default=t... | [
"django.db.models.Sum",
"random.choice",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"re.match",
"django.db.models.DateTimeField",
"re.sub",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((232, 271), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (252, 271), False, 'from django.db import models\n'), ((290, 332), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'default': 'timezone.now'}), '(default=timezone.now)\n', (... |
from __future__ import print_function
from tdda.rexpy import extract
from tdda.rexpy.seq import common_string_sequence
from tdda.rexpy.relib import re
x = extract(['Roger', 'Coger', 'Doger'], tag=True, as_object=True)
print(x)
patternToExamples = x.pattern_matches()
sequences = []
for j, (pattern, examples) in enum... | [
"tdda.rexpy.extract",
"tdda.rexpy.seq.common_string_sequence",
"tdda.rexpy.relib.re.match"
] | [((157, 219), 'tdda.rexpy.extract', 'extract', (["['Roger', 'Coger', 'Doger']"], {'tag': '(True)', 'as_object': '(True)'}), "(['Roger', 'Coger', 'Doger'], tag=True, as_object=True)\n", (164, 219), False, 'from tdda.rexpy import extract\n'), ((669, 697), 'tdda.rexpy.seq.common_string_sequence', 'common_string_sequence',... |
from abc import ABC
import numpy as np
import gym
import mujoco_py
from gym.envs.registration import register
def change_fetch_model(change_model):
import os
import shutil
gym_folder = os.path.dirname(gym.__file__)
xml_folder = 'envs/robotics/assets/fetch'
full_folder_path = os.path.join(gym_folde... | [
"os.path.exists",
"shutil.copy2",
"os.path.join",
"gym.spaces.Box",
"os.path.dirname",
"numpy.zeros",
"numpy.array",
"mujoco_py.GlfwContext",
"mujoco_py.MjRenderContextOffscreen",
"numpy.concatenate",
"numpy.linalg.norm",
"gym.envs.robotics.utils.robot_get_obs",
"gym.make",
"numpy.round"
] | [((199, 228), 'os.path.dirname', 'os.path.dirname', (['gym.__file__'], {}), '(gym.__file__)\n', (214, 228), False, 'import os\n'), ((298, 334), 'os.path.join', 'os.path.join', (['gym_folder', 'xml_folder'], {}), '(gym_folder, xml_folder)\n', (310, 334), False, 'import os\n'), ((355, 399), 'os.path.join', 'os.path.join'... |
from django.db import models
from django.db.models import Case, F, Q, Value, When
from psqlextra.expressions import HStoreRef
from psqlextra.fields import HStoreField
from .fake_model import get_fake_model
def test_query_annotate_hstore_key_ref():
"""Tests whether annotating using a :see:HStoreRef expression wo... | [
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"psqlextra.expressions.HStoreRef",
"django.db.models.F",
"psqlextra.fields.HStoreField",
"django.db.models.Value",
"django.db.models.Q",
"django.db.models.CharField"
] | [((445, 458), 'psqlextra.fields.HStoreField', 'HStoreField', ([], {}), '()\n', (456, 458), False, 'from psqlextra.fields import HStoreField\n'), ((505, 558), 'django.db.models.ForeignKey', 'models.ForeignKey', (['model_fk'], {'on_delete': 'models.CASCADE'}), '(model_fk, on_delete=models.CASCADE)\n', (522, 558), False, ... |
#
# Copyright (c) 2008-2015 <NAME> <<EMAIL> AT ulthar.net>
# 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 SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE... | [
"pyams_utils.adapter.adapter_config",
"zope.interface.implementer"
] | [((890, 910), 'zope.interface.implementer', 'implementer', (['IValues'], {}), '(IValues)\n', (901, 910), False, 'from zope.interface import Interface, implementer\n'), ((1005, 1078), 'pyams_utils.adapter.adapter_config', 'adapter_config', ([], {'required': '(IContainer, IRequest, ITable)', 'provides': 'IValues'}), '(re... |
# Lint as: python2, python3
# Copyright 2019 Google LLC. 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 req... | [
"tfx.components.example_gen.utils.calculate_splits_fingerprint_span_and_version",
"tfx.dsl.components.base.base_driver.BaseDriver.__init__",
"tfx.orchestration.portable.base_driver.BaseDriver.__init__",
"tfx.dsl.components.base.base_driver._generate_output_uri",
"tfx.orchestration.data_types.ComponentInfo",... | [((2676, 2731), 'tfx.dsl.components.base.base_driver.BaseDriver.__init__', 'base_driver.BaseDriver.__init__', (['self', 'metadata_handler'], {}), '(self, metadata_handler)\n', (2707, 2731), False, 'from tfx.dsl.components.base import base_driver\n'), ((2736, 2828), 'tfx.orchestration.portable.base_driver.BaseDriver.__i... |
# -*- coding: utf-8 -*-
from openprocurement.tender.core.views.cancellation_complaint import TenderCancellationComplaintResource
from openprocurement.tender.core.utils import optendersresource
from openprocurement.tender.competitivedialogue.constants import STAGE_2_EU_TYPE, STAGE_2_UA_TYPE
@optendersresource(
na... | [
"openprocurement.tender.core.utils.optendersresource"
] | [((295, 681), 'openprocurement.tender.core.utils.optendersresource', 'optendersresource', ([], {'name': "('%s:Tender Cancellation Complaints' % STAGE_2_EU_TYPE)", 'collection_path': '"""/tenders/{tender_id}/cancellations/{cancellation_id}/complaints"""', 'path': '"""/tenders/{tender_id}/cancellations/{cancellation_id}/... |
import pandas as pd
from microsim.gender import NHANESGender
from microsim.race_ethnicity import NHANESRaceEthnicity
# will use the CKD-EPI equation: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2763564/
# because it prediicts better in blacks, https://bmcnephrol.biomedcentral.com/articles/10.1186/s12882-017-0... | [
"pandas.DataFrame"
] | [((482, 630), 'pandas.DataFrame', 'pd.DataFrame', (["{'female': [True, True, False, False], 'underThreshold': [True, False, True,\n False], 'exponent': [-0.329, -1.209, -0.411, -1.209]}"], {}), "({'female': [True, True, False, False], 'underThreshold': [True,\n False, True, False], 'exponent': [-0.329, -1.209, -0... |
# Copyright 2020; <NAME>
# See license for more details
import logging
import threading
import weakref
from requests import ConnectionError
from six import PY3
from six import string_types
from six.moves.urllib.parse import urlparse
from .elements import VoidResource
from .elements import CSSResource
from .elements i... | [
"logging.getLogger",
"threading.current_thread",
"threading.Lock",
"six.moves.urllib.parse.urlparse",
"weakref.WeakSet",
"gevent.pool.Pool",
"threading.Thread"
] | [((534, 561), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (551, 561), False, 'import logging\n'), ((781, 797), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (795, 797), False, 'import threading\n'), ((3365, 3378), 'six.moves.urllib.parse.urlparse', 'urlparse', (['url'], {}), '(... |
import sys
import logging
import json_logging # type: ignore
def getLogger(name):
json_logging.init_non_web(enable_json=True)
log = logging.getLogger(name)
log.setLevel(logging.INFO)
log.addHandler(logging.StreamHandler(sys.stdout))
return log
| [
"logging.getLogger",
"logging.StreamHandler",
"json_logging.init_non_web"
] | [((89, 132), 'json_logging.init_non_web', 'json_logging.init_non_web', ([], {'enable_json': '(True)'}), '(enable_json=True)\n', (114, 132), False, 'import json_logging\n'), ((143, 166), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (160, 166), False, 'import logging\n'), ((217, 250), 'logging.St... |
import time
from machine import Pin
from machine import PWM
from machine import TouchPad
musica_1 = None
Touch = None
a = None
musica_1 = PWM(Pin(25))
Touch= TouchPad(Pin(33))
Touch.config(1000)
while True:
a = Touch.read()
print('Touch: {0}'.format(a))
time.sleep(1)
| [
"time.sleep",
"machine.Pin"
] | [((144, 151), 'machine.Pin', 'Pin', (['(25)'], {}), '(25)\n', (147, 151), False, 'from machine import Pin\n'), ((169, 176), 'machine.Pin', 'Pin', (['(33)'], {}), '(33)\n', (172, 176), False, 'from machine import Pin\n'), ((264, 277), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (274, 277), False, 'import time\n'... |
"""
An exercise that summarizes what you have learned in this Session.
Authors: <NAME>, <NAME>, <NAME>, <NAME>,
their colleagues and James (BO) Geyer.
"""
########################################################################
# Done
# On Line 5 above, replace PUT_YOUR_NAME_HERE with your own name.
#####... | [
"rosegraphics.Pen",
"rosegraphics.SimpleTurtle",
"rosegraphics.TurtleWindow"
] | [((1197, 1214), 'rosegraphics.TurtleWindow', 'rg.TurtleWindow', ([], {}), '()\n', (1212, 1214), True, 'import rosegraphics as rg\n'), ((1238, 1255), 'rosegraphics.SimpleTurtle', 'rg.SimpleTurtle', ([], {}), '()\n', (1253, 1255), True, 'import rosegraphics as rg\n'), ((1265, 1282), 'rosegraphics.Pen', 'rg.Pen', (['"""re... |
#
# Explore
# - The Adventure Interpreter
#
# Copyright (C) 2006 <NAME>
#
import string
import World
import ExpUtil
from ItemContainer import *
class Room(ItemContainer):
def __init__(self):
ItemContainer.__init__(self)
self.name = None
self.desc = None
self.desc_alt ... | [
"ExpUtil.a_or_an",
"string.join",
"World.DIRECTIONS.index"
] | [((2705, 2732), 'string.join', 'string.join', (['out_desc', '"""\n"""'], {}), "(out_desc, '\\n')\n", (2716, 2732), False, 'import string\n'), ((747, 780), 'World.DIRECTIONS.index', 'World.DIRECTIONS.index', (['direction'], {}), '(direction)\n', (769, 780), False, 'import World\n'), ((994, 1027), 'World.DIRECTIONS.index... |
import numpy as np
import xarray as ncdata
import matplotlib.pyplot as plt
from mayavi import mlab # to overrid plt.mlab
from surface import *
import os
cwd = os.getcwd()
name = cwd + "/wout_vmec.nc"
#x, y , z = plot_vmec_surface(name,plottype='surface3d')
plot_vmec_surface(name,plottype='cross-section',zeta=360)
| [
"os.getcwd"
] | [((159, 170), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (168, 170), False, 'import os\n')] |
import random
from cmath import exp
import math
def rotation_scale(origin, theta, scale, points):
return [origin + (point-origin)*scale*e(theta) for point in points]
def translate(origin, points):
# offset = points[0]-origin
return [point-origin for point in points]
def flip(z1, z2, points):
z1z2 = ... | [
"cmath.exp",
"time.time"
] | [((3585, 3596), 'time.time', 'time.time', ([], {}), '()\n', (3594, 3596), False, 'import time\n'), ((630, 647), 'cmath.exp', 'exp', (['(1.0j * theta)'], {}), '(1.0j * theta)\n', (633, 647), False, 'from cmath import exp\n'), ((3642, 3653), 'time.time', 'time.time', ([], {}), '()\n', (3651, 3653), False, 'import time\n'... |
import json
import texas as tx
import stanza
# create a document
TXLang = "en"
TXText = "<NAME> was an Austrian neurologist and the founder of psychoanalysis, a clinical method for treating psychopathology through dialogue between a patient and a psychoanalyst. Freud was born to Galician Jewish parents in the ... | [
"texas.Document",
"stanza.Pipeline",
"texas.UITabularView"
] | [((406, 472), 'stanza.Pipeline', 'stanza.Pipeline', (['TXSpacyModel'], {'processors': '"""tokenize,pos,lemma,ner"""'}), "(TXSpacyModel, processors='tokenize,pos,lemma,ner')\n", (421, 472), False, 'import stanza\n'), ((1054, 1081), 'texas.Document', 'tx.Document', (['TXText', 'TXLang'], {}), '(TXText, TXLang)\n', (1065,... |
#!/usr/bin/env python
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
"requests.get",
"google.ads.googleads.client.GoogleAdsClient.load_from_storage",
"argparse.ArgumentParser",
"sys.exit"
] | [((2379, 2427), 'google.ads.googleads.client.GoogleAdsClient.load_from_storage', 'GoogleAdsClient.load_from_storage', ([], {'version': '"""v10"""'}), "(version='v10')\n", (2412, 2427), False, 'from google.ads.googleads.client import GoogleAdsClient\n'), ((2442, 2514), 'argparse.ArgumentParser', 'argparse.ArgumentParser... |
from World import World
import threading
import time
def init_vars(game):
discount = 0.3
actions = game.ACTIONS
states = []
Q = {}
# Create base for Q-matrix
for i in range(game.AXIS_X):
for j in range(game.AXIS_Y):
states.append((i, j))
for state in states:
te... | [
"World.World",
"threading.Thread",
"time.sleep"
] | [((1496, 1509), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1506, 1509), False, 'import time\n'), ((2271, 2287), 'World.World', 'World', (['(100)', '(5)', '(5)'], {}), '(100, 5, 5)\n', (2276, 2287), False, 'from World import World\n'), ((2382, 2445), 'threading.Thread', 'threading.Thread', ([], {'target': 'run... |
import sys
sys.path.append("../../")
from appJar import gui
def showPositions():
for widg in app.getContainer().grid_slaves():
row, column = widg.grid_info()["row"], widg.grid_info()["column"]
print(widg, row, column)
with gui("Grid Demo", "300x300", sticky="news", expand="both") as app:
for ... | [
"appJar.gui",
"sys.path.append"
] | [((11, 36), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (26, 36), False, 'import sys\n'), ((246, 303), 'appJar.gui', 'gui', (['"""Grid Demo"""', '"""300x300"""'], {'sticky': '"""news"""', 'expand': '"""both"""'}), "('Grid Demo', '300x300', sticky='news', expand='both')\n", (249, 303), ... |
from django.test import TestCase
from model_bakery import baker
from django_cradmin.cradmin_testhelpers import TestCaseMixin
from django_cradmin.viewhelpers import listbuilderview
from django_cradmin.django_cradmin_testapp import models as testmodels
class ListBuilderViewWithoutPaging(listbuilderview.View):
mode... | [
"model_bakery.baker.make",
"django_cradmin.django_cradmin_testapp.models.SomeItem.objects.all"
] | [((992, 1055), 'model_bakery.baker.make', 'baker.make', (['"""django_cradmin_testapp.SomeItem"""'], {'name': '"""Test name"""'}), "('django_cradmin_testapp.SomeItem', name='Test name')\n", (1002, 1055), False, 'from model_bakery import baker\n'), ((1356, 1419), 'model_bakery.baker.make', 'baker.make', (['"""django_crad... |
import pytest
from libpythonpro.spam.enviador_de_email import Enviador, EmailInvalido
def test_criar_enviador_de_email():
enviador = Enviador()
assert enviador is not None
@pytest.mark.parametrize(
'destinatario',
['<EMAIL>', '<EMAIL>']
)
def test_remetente(destinatario):
enviador = Enviador()
... | [
"pytest.mark.parametrize",
"libpythonpro.spam.enviador_de_email.Enviador",
"pytest.raises"
] | [((186, 249), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""destinatario"""', "['<EMAIL>', '<EMAIL>']"], {}), "('destinatario', ['<EMAIL>', '<EMAIL>'])\n", (209, 249), False, 'import pytest\n'), ((500, 549), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""remetente"""', "['', 'foo']"], {}), "(... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2018 Alibaba Group Holding Ltd.
#
# 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-... | [
"mars.lib.filesystem.core.register_filesystem"
] | [((1874, 1919), 'mars.lib.filesystem.core.register_filesystem', 'register_filesystem', (['"""odps"""', 'VolumeFileSystem'], {}), "('odps', VolumeFileSystem)\n", (1893, 1919), False, 'from mars.lib.filesystem.core import register_filesystem\n')] |
import numpy as np
import scipy.sparse
from typing import Text, Union, Optional, Dict, Any
from rasa.nlu.constants import FEATURIZER_CLASS_ALIAS
from rasa.nlu.components import Component
from rasa.utils.tensorflow.constants import MEAN_POOLING, MAX_POOLING
class Features:
"""Stores the features produces by any f... | [
"numpy.mean",
"numpy.max",
"numpy.zeros",
"scipy.sparse.hstack",
"numpy.concatenate"
] | [((2344, 2400), 'numpy.concatenate', 'np.concatenate', (['(features, additional_features)'], {'axis': '(-1)'}), '((features, additional_features), axis=-1)\n', (2358, 2400), True, 'import numpy as np\n'), ((2895, 2934), 'scipy.sparse.hstack', 'hstack', (['[features, additional_features]'], {}), '([features, additional_... |
from cowait.tasks import Task
import tensorflow as tf
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Embedding, GlobalAveragePooling1D, Dense
class ImdbTask(Task):
async def run(self):
# get the pre-proc... | [
"tensorflow.keras.preprocessing.sequence.pad_sequences",
"tensorflow.keras.layers.Embedding",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.datasets.imdb.load_data",
"tensorflow.keras.layers.GlobalAveragePooling1D",
"tensorflow.keras.datasets.imdb.get_word_index"
] | [((1063, 1097), 'tensorflow.keras.datasets.imdb.load_data', 'tf.keras.datasets.imdb.load_data', ([], {}), '()\n', (1095, 1097), True, 'import tensorflow as tf\n'), ((1190, 1224), 'tensorflow.keras.preprocessing.sequence.pad_sequences', 'pad_sequences', (['x_train', 'pad_length'], {}), '(x_train, pad_length)\n', (1203, ... |
#!/usr/bin/env python
#--------Include modules---------------
from copy import copy
import rospy
from visualization_msgs.msg import Marker
from geometry_msgs.msg import Point
from nav_msgs.msg import OccupancyGrid
import tf
from rrt_slam.msg import PointArray
from time import time
from numpy import array
from numpy im... | [
"functions.robot",
"nav_msgs.msg.OccupancyGrid",
"rospy.is_shutdown",
"functions.informationGain",
"rospy.init_node",
"rospy.get_param",
"functions.discount",
"numpy.array",
"rospy.Rate",
"numpy.linalg.norm",
"rospy.sleep",
"copy.copy",
"rospy.Subscriber"
] | [((540, 555), 'nav_msgs.msg.OccupancyGrid', 'OccupancyGrid', ([], {}), '()\n', (553, 555), False, 'from nav_msgs.msg import OccupancyGrid\n'), ((581, 596), 'nav_msgs.msg.OccupancyGrid', 'OccupancyGrid', ([], {}), '()\n', (594, 596), False, 'from nav_msgs.msg import OccupancyGrid\n'), ((607, 622), 'nav_msgs.msg.Occupanc... |
# coding=utf-8
"""Performs face detection in realtime.
Based on code from https://github.com/shanren7/real_time_face_recognition
"""
# MIT License
#
# Copyright (c) 2017 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "S... | [
"face.Recognition",
"json.dumps",
"cv2.imread",
"memcache.Client"
] | [((1345, 1363), 'face.Recognition', 'face.Recognition', ([], {}), '()\n', (1361, 1363), False, 'import face\n'), ((1410, 1455), 'memcache.Client', 'memcache.Client', (["['127.0.0.1:11211']"], {'debug': '(0)'}), "(['127.0.0.1:11211'], debug=0)\n", (1425, 1455), False, 'import memcache\n'), ((3886, 3928), 'json.dumps', '... |
""" Versioned Resource
This class extends the Flask-Restful Resource class with the ability to look
up the API version number in a request header.
"""
from flask_restful import Resource
from data_resource_api.config import Config
class VersionedResource(Resource):
def __init__(self):
Resource.__init__(... | [
"data_resource_api.config.Config.get_api_version",
"flask_restful.Resource.__init__"
] | [((302, 325), 'flask_restful.Resource.__init__', 'Resource.__init__', (['self'], {}), '(self)\n', (319, 325), False, 'from flask_restful import Resource\n'), ((483, 507), 'data_resource_api.config.Config.get_api_version', 'Config.get_api_version', ([], {}), '()\n', (505, 507), False, 'from data_resource_api.config impo... |
import logging
import os
import time
# config
try:
# inside try to be able to easily run stuff on ipython
BASE_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")
except NameError:
BASE_DIR = "."
DATASET_DIR = os.path.join(BASE_DIR, "dataset")
RESULTS_DIR = os.path.join(BASE_DIR, "results... | [
"logging.getLogger",
"os.path.exists",
"logging.StreamHandler",
"os.makedirs",
"logging.Formatter",
"time.strftime",
"os.path.join",
"os.path.dirname",
"logging.FileHandler"
] | [((241, 274), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""dataset"""'], {}), "(BASE_DIR, 'dataset')\n", (253, 274), False, 'import os\n'), ((289, 322), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""results"""'], {}), "(BASE_DIR, 'results')\n", (301, 322), False, 'import os\n'), ((334, 364), 'os.path.join', 'o... |
from datetime import datetime
from typing import TypedDict
from os import PathLike
from app.filesystem import file, path
from .ffmpeg import ffprobe
class VideoData(TypedDict):
"""Объект с данными видео-файла"""
name: str
time: datetime
extension: str
duration: float
bitrate: int
codec: s... | [
"app.filesystem.path.convert_to_pathlib",
"app.filesystem.file.modification_date"
] | [((602, 655), 'app.filesystem.path.convert_to_pathlib', 'path.convert_to_pathlib', (['video_path'], {'check_exist': '(True)'}), '(video_path, check_exist=True)\n', (625, 655), False, 'from app.filesystem import file, path\n'), ((921, 955), 'app.filesystem.file.modification_date', 'file.modification_date', (['video_path... |
import argparse
import inspect
import itertools
import json
import logging
import os
import os.path
import pickle
import re
import sys
import tempfile
import traceback
import typing
import uuid
import jsonschema
import frozendict
import pandas
from d3m import container, deprecate, exceptions, types, utils
from d3m.co... | [
"logging.getLogger",
"d3m.metadata.base.DataMetadata",
"pandas.read_csv",
"re.compile",
"d3m.utils.get_datasets_and_problems",
"d3m.utils.CallbackHandler",
"d3m.metadata.pipeline_run.RuntimeEnvironment",
"d3m.utils.global_randomness_warning",
"d3m.metadata.pipeline_run.validate_pipeline_run",
"d3m... | [((676, 703), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (693, 703), False, 'import logging\n'), ((865, 914), 're.compile', 're.compile', (['"""(_FOLD_\\\\d+)?(_TRAIN|_TEST|_SCORE)$"""'], {}), "('(_FOLD_\\\\d+)?(_TRAIN|_TEST|_SCORE)$')\n", (875, 914), False, 'import re\n'), ((92258, 9... |
"""urls definition for bonus_points widget."""
'''
Created on Aug 5, 2012
@author: <NAME>
'''
from django.conf.urls.defaults import url, patterns
urlpatterns = patterns('',
url(r'^bonus_code/$',
'apps.widgets.bonus_points.views.bonus_code',
name="bonus_points_code"),
url(r'^view_codes/$',
... | [
"django.conf.urls.defaults.url"
] | [((180, 277), 'django.conf.urls.defaults.url', 'url', (['"""^bonus_code/$"""', '"""apps.widgets.bonus_points.views.bonus_code"""'], {'name': '"""bonus_points_code"""'}), "('^bonus_code/$', 'apps.widgets.bonus_points.views.bonus_code', name=\n 'bonus_points_code')\n", (183, 277), False, 'from django.conf.urls.default... |
# -*- coding: utf-8 -*-
"""
Simple mutations example: incrementing and decrementing a global counter.
"""
from py_gql import build_schema, graphql_blocking
ROOT = {"counter": 0}
schema = build_schema(
"""
type Query {
counter: Int
}
type Mutation {
increment(amount: Int = 1): Int
... | [
"py_gql.build_schema",
"py_gql.graphql_blocking"
] | [((192, 378), 'py_gql.build_schema', 'build_schema', (['"""\n type Query {\n counter: Int\n }\n\n type Mutation {\n increment(amount: Int = 1): Int\n decrement(amount: Int = 1): Int\n }\n """'], {}), '(\n """\n type Query {\n counter: Int\n }\n\n type Mutation {\n ... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from parler.models import TranslatedFields
from fluent_pages.models import Page
from fluent_utils.softdeps.any_urlfield import AnyUrlField
from fluentcms_publishing.models import PublishingModel
class RedirectNode(Page, Publishing... | [
"django.utils.translation.ugettext_lazy"
] | [((964, 977), 'django.utils.translation.ugettext_lazy', '_', (['"""Redirect"""'], {}), "('Redirect')\n", (965, 977), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((1008, 1022), 'django.utils.translation.ugettext_lazy', '_', (['"""Redirects"""'], {}), "('Redirects')\n", (1009, 1022), True, 'from d... |
from modules.DoubleSymLayer import DoubleSymLayer
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils import *
import torch.optim as optim
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
vFeat = [3, 4]
nChan = vFeat[0]
nClasses = 5
# random batch
x = normalInit([10... | [
"torch.nn.BatchNorm2d",
"torch.optim.SGD",
"torch.LongTensor",
"torch.nn.functional.avg_pool2d",
"modules.DoubleSymLayer.DoubleSymLayer",
"torch.nn.Conv2d",
"torch.norm",
"torch.cuda.is_available",
"torch.nn.functional.relu"
] | [((854, 896), 'modules.DoubleSymLayer.DoubleSymLayer', 'DoubleSymLayer', (['vFeat'], {'params': 'paramsStruct'}), '(vFeat, params=paramsStruct)\n', (868, 896), False, 'from modules.DoubleSymLayer import DoubleSymLayer\n'), ((1137, 1167), 'torch.nn.functional.avg_pool2d', 'F.avg_pool2d', (['y1', 'x.shape[2:4]'], {}), '(... |
# Lint as: python3
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | [
"numpy.ones",
"lingvo.compat.zeros_like",
"lingvo.compat.test.main",
"numpy.random.randint",
"numpy.linspace",
"numpy.zeros",
"numpy.concatenate",
"numpy.random.uniform",
"lingvo.compat.Graph"
] | [((5136, 5150), 'lingvo.compat.test.main', 'tf.test.main', ([], {}), '()\n', (5148, 5150), True, 'from lingvo import compat as tf\n'), ((1002, 1061), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(-1.0)', 'high': '(1.0)', 'size': '(num_bboxes, 3)'}), '(low=-1.0, high=1.0, size=(num_bboxes, 3))\n', (1019, 1... |
import logging
from pprint import pprint
from unittest import TestCase
from foxylib.tools.googleapi.foxylib_googleapi import FoxylibGoogleapi
from foxylib.tools.googleapi.sheets.googlesheets_tool import GooglesheetsTool
from foxylib.tools.log.foxylib_logger import FoxylibLogger
class TestGooglesheetsTool(TestCase):
... | [
"foxylib.tools.log.foxylib_logger.FoxylibLogger.attach_stderr2loggers",
"foxylib.tools.googleapi.foxylib_googleapi.FoxylibGoogleapi.ServiceAccount.credentials",
"foxylib.tools.googleapi.sheets.googlesheets_tool.GooglesheetsTool.sheet_ranges2dict_range2data_ll",
"foxylib.tools.log.foxylib_logger.FoxylibLogger.... | [((370, 420), 'foxylib.tools.log.foxylib_logger.FoxylibLogger.attach_stderr2loggers', 'FoxylibLogger.attach_stderr2loggers', (['logging.DEBUG'], {}), '(logging.DEBUG)\n', (405, 420), False, 'from foxylib.tools.log.foxylib_logger import FoxylibLogger\n'), ((462, 522), 'foxylib.tools.log.foxylib_logger.FoxylibLogger.func... |
# -*- coding: utf-8 -*-
import unittest
from ctap_keyring_device.ctap_strucs import CtapGetAssertionRequest, CtapOptions
class TestCtapGetAssertionRequest(unittest.TestCase):
def test_allow_list_is_empty_list_when_none(self):
req = CtapGetAssertionRequest.create(
{CtapGetAssertionRequest.ALLO... | [
"ctap_keyring_device.ctap_strucs.CtapGetAssertionRequest.create"
] | [((247, 325), 'ctap_keyring_device.ctap_strucs.CtapGetAssertionRequest.create', 'CtapGetAssertionRequest.create', (['{CtapGetAssertionRequest.ALLOW_LIST_KEY: None}'], {}), '({CtapGetAssertionRequest.ALLOW_LIST_KEY: None})\n', (277, 325), False, 'from ctap_keyring_device.ctap_strucs import CtapGetAssertionRequest, CtapO... |
from flask import Flask
from flask import make_response, request
import core.request_handler as request_handler
app = Flask(__name__)
app.config.from_envvar('CONFIG_FILE')
@app.route('/')
def index():
return make_response(open('static/index.html').read())
@app.route('/check_availability', methods=['POST'])
def ... | [
"core.request_handler.check_availability",
"flask.Flask"
] | [((119, 134), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (124, 134), False, 'from flask import Flask\n'), ((353, 389), 'core.request_handler.check_availability', 'request_handler.check_availability', ([], {}), '()\n', (387, 389), True, 'import core.request_handler as request_handler\n')] |
# -*- coding: utf-8 -*-
"""Tests for data ingestion."""
# standard library imports
import shutil
import sys
from pathlib import Path
import pytest
import sh
from . import COMBINE_OUTPUTS
from . import help_check
from . import print_docstring
from . import STATS_FILE
from . import TOML_FILE
# global constants
svante ... | [
"pytest.fail",
"shutil.copy2",
"sh.Command",
"pathlib.Path"
] | [((322, 342), 'sh.Command', 'sh.Command', (['"""svante"""'], {}), "('svante')\n", (332, 342), False, 'import sh\n'), ((895, 911), 'pathlib.Path', 'Path', (['STATS_FILE'], {}), '(STATS_FILE)\n', (899, 911), False, 'from pathlib import Path\n'), ((977, 1019), 'shutil.copy2', 'shutil.copy2', (['input_stats_path', 'stats_p... |
import random
import matplotlib.pyplot as plt
import numpy as np
def cmap(label: str) -> str:
"""Return RGB string of color for given standard psp label"""
_, pp_family, pp_z, pp_type, pp_version = label.split("/")
if pp_family == "sg15" and pp_version == "v1.0":
return "#000000"
if pp_fami... | [
"random.seed",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.tight_layout",
"random.randint",
"numpy.arange"
] | [((875, 892), 'random.seed', 'random.seed', (['ascn'], {}), '(ascn)\n', (886, 892), False, 'import random\n'), ((1071, 1120), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': '(1024 * px, 360 * px)'}), '(1, 1, figsize=(1024 * px, 360 * px))\n', (1083, 1120), True, 'import matplotlib.pyplot as ... |
from typing import Dict, Any
from pyNastran.op2.op2_interface.random_results import (
RADCONS, RAECONS, RASCONS, RAPCONS, RAFCONS, RAGCONS, RANCONS,
RADEATC, RAEEATC, RASEATC, RAPEATC, RAFEATC, RAGEATC, RANEATC,
ROUGV1, RADEFFM, SRSS, ABS, NRL,
AutoCorrelationObjects, PowerSpectralDensityObjects, RootM... | [
"pyNastran.op2.op2_interface.random_results.RADEFFM",
"pyNastran.op2.op2_interface.random_results.ROUGV1",
"pyNastran.op2.op2_interface.random_results.RADEATC",
"pyNastran.op2.op2_interface.random_results.RAPCONS",
"pyNastran.op2.op2_interface.random_results.RADCONS",
"pyNastran.op2.op2_interface.random_r... | [((788, 799), 'pyNastran.op2.result_objects.design_response.Responses', 'Responses', ([], {}), '()\n', (797, 799), False, 'from pyNastran.op2.result_objects.design_response import Responses\n'), ((894, 906), 'pyNastran.op2.op2_interface.random_results.PSDObjects', 'PSDObjects', ([], {}), '()\n', (904, 906), False, 'fro... |
#coding=utf-8
import tensorflow as tf
import keras
from keras.layers import Flatten
from keras.losses import categorical_crossentropy
def Dice_coeff(y_true, y_pred):
smooth = 1.
y_true_f = Flatten()(y_true)
y_pred_f = Flatten()(y_pred)
intersection = tf.reduce_sum(y_true_f * y_pred_f)
sc... | [
"tensorflow.reduce_sum",
"keras.layers.Flatten",
"keras.losses.categorical_crossentropy"
] | [((278, 312), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['(y_true_f * y_pred_f)'], {}), '(y_true_f * y_pred_f)\n', (291, 312), True, 'import tensorflow as tf\n'), ((206, 215), 'keras.layers.Flatten', 'Flatten', ([], {}), '()\n', (213, 215), False, 'from keras.layers import Flatten\n'), ((240, 249), 'keras.layers.Flatt... |