code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""Test cases for evaluation scripts."""
import json
import os
import unittest
import numpy as np
from PIL import Image
from ..common.utils import DEFAULT_COCO_CONFIG
from .ins_seg import evaluate_ins_seg
class TestBDD100KInsSegEval(unittest.TestCase):
"""Test cases for BDD100K detection evaluation."""
def... | [
"PIL.Image.fromarray",
"os.makedirs",
"os.path.join",
"os.path.isfile",
"numpy.array",
"numpy.zeros",
"os.path.isdir",
"unittest.main",
"os.path.abspath",
"json.dump"
] | [((3555, 3570), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3568, 3570), False, 'import unittest\n'), ((1444, 1469), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (1459, 1469), False, 'import os\n'), ((1660, 1682), 'os.path.isdir', 'os.path.isdir', (['gt_base'], {}), '(gt_base)\n', ... |
from setuptools import setup, find_packages
from pathlib import Path
import os
if __name__ == "__main__":
with Path(Path(__file__).parent, "README.md").open(encoding="utf-8") as file:
long_description = file.read()
import os
def package_files(directory):
paths = []
for (path, _, f... | [
"setuptools.find_packages",
"os.path.join",
"os.walk",
"pathlib.Path"
] | [((333, 351), 'os.walk', 'os.walk', (['directory'], {}), '(directory)\n', (340, 351), False, 'import os\n'), ((586, 601), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (599, 601), False, 'from setuptools import setup, find_packages\n'), ((421, 455), 'os.path.join', 'os.path.join', (['""".."""', 'path',... |
from office365.runtime.queries.delete_entity_query import DeleteEntityQuery
from office365.runtime.queries.service_operation_query import ServiceOperationQuery
from office365.runtime.resource_path import ResourcePath
from office365.runtime.resource_path_service_operation import ResourcePathServiceOperation
from office3... | [
"office365.runtime.queries.service_operation_query.ServiceOperationQuery",
"office365.runtime.resource_path_service_operation.ResourcePathServiceOperation",
"office365.runtime.queries.delete_entity_query.DeleteEntityQuery",
"office365.runtime.resource_path.ResourcePath"
] | [((553, 576), 'office365.runtime.queries.delete_entity_query.DeleteEntityQuery', 'DeleteEntityQuery', (['self'], {}), '(self)\n', (570, 576), False, 'from office365.runtime.queries.delete_entity_query import DeleteEntityQuery\n'), ((786, 824), 'office365.runtime.queries.service_operation_query.ServiceOperationQuery', '... |
from . import app, db
from datetime import datetime
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
class User(db.Model, UserMixin):
__tablename__ = 'user'
id = db.Column(db.Integer, primary_key = True)
fullname = db.Column(db.String(2... | [
"werkzeug.security.generate_password_hash",
"werkzeug.security.check_password_hash"
] | [((1002, 1051), 'werkzeug.security.generate_password_hash', 'generate_password_hash', (['password'], {'method': '"""sha256"""'}), "(password, method='sha256')\n", (1024, 1051), False, 'from werkzeug.security import generate_password_hash, check_password_hash\n'), ((1111, 1155), 'werkzeug.security.check_password_hash', ... |
from django.contrib import admin
from .models import Tutorial
# Register your models here.
class TutorialAdmin(admin.ModelAdmin):
list_filter=('created_date',)
admin.site.register(Tutorial,TutorialAdmin) | [
"django.contrib.admin.site.register"
] | [((164, 208), 'django.contrib.admin.site.register', 'admin.site.register', (['Tutorial', 'TutorialAdmin'], {}), '(Tutorial, TutorialAdmin)\n', (183, 208), False, 'from django.contrib import admin\n')] |
#ss AdventureWorksOltp.py
from pyspark.sql import SparkSession
from pyspark.sql.functions import col
from pyspark.sql.functions import dense_rank
from pyspark.sql.window import Window
from pyspark.sql.functions import when
from pyspark.sql.functions import concat
from pyspark.sql.functions import lit
from pyspark.sql.f... | [
"pyspark.sql.functions.lit",
"pyspark.sql.functions.dense_rank",
"pyspark.sql.functions.col",
"pyspark.sql.window.Window.partitionBy",
"pyspark.sql.functions.sum",
"pyspark.sql.SparkSession.builder.appName"
] | [((380, 426), 'pyspark.sql.SparkSession.builder.appName', 'SparkSession.builder.appName', (['"""AdventureWorks"""'], {}), "('AdventureWorks')\n", (408, 426), False, 'from pyspark.sql import SparkSession\n'), ((5441, 5478), 'pyspark.sql.window.Window.partitionBy', 'Window.partitionBy', (['"""SalesPersonName"""'], {}), "... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Functionality for finite element approximations.
This file is part of Fieldosophy, a toolkit for random fields.
Copyright (C) 2021 <NAME> <<EMAIL>>
This Source Code is subject to the terms of the BSD 3-Clause License.
If a copy of the license was not distributed with ... | [
"numpy.sqrt",
"numpy.log",
"numpy.array",
"ctypes.CDLL",
"numpy.linalg.norm",
"numpy.sin",
"numpy.uintc",
"numpy.arange",
"numpy.mean",
"numpy.repeat",
"numpy.cross",
"numpy.isscalar",
"scipy.sparse.eye",
"ctypes.c_uint",
"numpy.ix_",
"numpy.max",
"numpy.exp",
"scipy.sparse.diags",... | [((1272, 1303), 'ctypes.POINTER', 'ctypes.POINTER', (['ctypes.c_double'], {}), '(ctypes.c_double)\n', (1286, 1303), False, 'import ctypes\n'), ((1322, 1351), 'ctypes.POINTER', 'ctypes.POINTER', (['ctypes.c_uint'], {}), '(ctypes.c_uint)\n', (1336, 1351), False, 'import ctypes\n'), ((31682, 31713), 'ctypes.POINTER', 'cty... |
import json
import numpy as np
import pandas as pd
import pickle
import sklearn
def process_input(request_data: str) -> pd.DataFrame:
"""
asserts that the request data is correct.
:param request_data: data gotten from the request made to the API
:return: the values from the dataframe
"""
... | [
"pandas.DataFrame",
"json.loads"
] | [((1828, 1846), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (1840, 1846), True, 'import pandas as pd\n'), ((335, 359), 'json.loads', 'json.loads', (['request_data'], {}), '(request_data)\n', (345, 359), False, 'import json\n')] |
from datetime import date, datetime
from django.test import TestCase, RequestFactory
from django.utils import timezone
from example.views.views import ListDataModelView
from example.views.models import ListData
class TestViewSet(TestCase):
def setUp(self):
pass
def test_viewset_urls(self):
... | [
"django.utils.timezone.now",
"datetime.date.today",
"example.views.views.ListDataModelView"
] | [((328, 347), 'example.views.views.ListDataModelView', 'ListDataModelView', ([], {}), '()\n', (345, 347), False, 'from example.views.views import ListDataModelView\n'), ((461, 473), 'datetime.date.today', 'date.today', ([], {}), '()\n', (471, 473), False, 'from datetime import date, datetime\n'), ((497, 511), 'django.u... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Netheos (http://www.netheos.net)
#
# 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... | [
"logging.getLogger",
"json.dumps"
] | [((1384, 1411), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1401, 1411), False, 'import logging\n'), ((8206, 8222), 'json.dumps', 'json.dumps', (['body'], {}), '(body)\n', (8216, 8222), False, 'import json\n')] |
"""
USAGE:-
For FILE mode: python extract_timestamps.py -f <WAV_FILE_PATH> -a <AGGRESSIVENESS_LEVEL>
Ex: python extract_timestamps.py -f tts_modi_exp/resampled_16000/PM_Modi/PM_Modi_addresses_the_Nation_on_issues_relating_to_COVID19_PMO.wav
-a 1
-------------------------------------------------------------------... | [
"wave.open",
"os.listdir",
"collections.deque",
"argparse.ArgumentParser"
] | [((3194, 3238), 'collections.deque', 'collections.deque', ([], {'maxlen': 'num_padding_frames'}), '(maxlen=num_padding_frames)\n', (3211, 3238), False, 'import collections\n'), ((6216, 6232), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (6226, 6232), False, 'import os\n'), ((8057, 8082), 'argparse.ArgumentPa... |
# clusteringTest20140710.py
#1. ~ 40 as thresholad
#2. k-means clustering
from armor.initialise import *
from scipy.ndimage import morphology as mor
from armor.geometry import morphology as morph
def getTimeString():
return str(time.time())
outputFolder = 'testing/'
m = march('0312.2130')[0].load()
#########... | [
"scipy.ndimage.morphology.grey_opening",
"scipy.ndimage.morphology.grey_closing"
] | [((989, 1019), 'scipy.ndimage.morphology.grey_opening', 'mor.grey_opening', (['m1.matrix', '(5)'], {}), '(m1.matrix, 5)\n', (1005, 1019), True, 'from scipy.ndimage import morphology as mor\n'), ((1037, 1067), 'scipy.ndimage.morphology.grey_closing', 'mor.grey_closing', (['m1.matrix', '(5)'], {}), '(m1.matrix, 5)\n', (1... |
import hikari
import lightbulb
from . import music_plugin
@music_plugin.command
@lightbulb.add_checks(lightbulb.guild_only)
@lightbulb.command(
'nowplaying', "Show's the song that is being played right now"
)
@lightbulb.implements(lightbulb.PrefixCommand, lightbulb.SlashCommand)
async def nowplaying(ctx: lightbu... | [
"lightbulb.add_checks",
"lightbulb.implements",
"hikari.Embed",
"lightbulb.command"
] | [((84, 126), 'lightbulb.add_checks', 'lightbulb.add_checks', (['lightbulb.guild_only'], {}), '(lightbulb.guild_only)\n', (104, 126), False, 'import lightbulb\n'), ((128, 213), 'lightbulb.command', 'lightbulb.command', (['"""nowplaying"""', '"""Show\'s the song that is being played right now"""'], {}), '(\'nowplaying\',... |
"""Auth Views."""
# Standard Python Libraries
from datetime import datetime, timedelta
# Third-Party Libraries
import botocore
from flask import g, jsonify, request
from flask.views import MethodView
# cisagov Libraries
from api.config import logger
from api.manager import LogManager, UserManager
from utils.aws.clien... | [
"api.config.logger.exception",
"utils.notifications.Notification",
"datetime.datetime.utcnow",
"api.manager.LogManager",
"utils.aws.clients.Cognito",
"datetime.timedelta",
"utils.logs.cleanup_logs",
"api.manager.UserManager",
"flask.jsonify"
] | [((435, 448), 'api.manager.UserManager', 'UserManager', ([], {}), '()\n', (446, 448), False, 'from api.manager import LogManager, UserManager\n'), ((463, 475), 'api.manager.LogManager', 'LogManager', ([], {}), '()\n', (473, 475), False, 'from api.manager import LogManager, UserManager\n'), ((486, 495), 'utils.aws.clien... |
import ast
import json
import cowait
from cowait import Task
from .code_builder import CodeBuilder
class NotebookRunner(Task):
async def run(self, path: str, **inputs):
if not path.endswith('.ipynb'):
path += '.ipynb'
cells = file_to_json(path)['cells']
code = CodeBuilder()
... | [
"json.load"
] | [((2991, 3003), 'json.load', 'json.load', (['f'], {}), '(f)\n', (3000, 3003), False, 'import json\n')] |
"""
Copyright (c) 2018 <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribut... | [
"logging.getLogger",
"mpikat.core.utils.LoggingSensor.discrete",
"katcp.Sensor.string",
"katcp.Message.inform",
"mpikat.meerkat.apsuse.apsuse_config.get_required_workers"
] | [((1554, 1607), 'logging.getLogger', 'logging.getLogger', (['"""mpikat.apsuse_product_controller"""'], {}), "('mpikat.apsuse_product_controller')\n", (1571, 1607), False, 'import logging\n'), ((4835, 5000), 'mpikat.core.utils.LoggingSensor.discrete', 'LoggingSensor.discrete', (['"""state"""'], {'description': '"""Denot... |
from typing import (
List,
Tuple,
)
from hummingbot.strategy.market_symbol_pair import MarketSymbolPair
from hummingbot.strategy.simple_trade import (
SimpleTradeStrategy
)
from hummingbot.strategy.simple_trade.simple_trade_config_map import simple_trade_config_map
def start(self):
try:
order... | [
"hummingbot.strategy.simple_trade.simple_trade_config_map.simple_trade_config_map.get",
"hummingbot.strategy.market_symbol_pair.MarketSymbolPair"
] | [((330, 373), 'hummingbot.strategy.simple_trade.simple_trade_config_map.simple_trade_config_map.get', 'simple_trade_config_map.get', (['"""order_amount"""'], {}), "('order_amount')\n", (357, 373), False, 'from hummingbot.strategy.simple_trade.simple_trade_config_map import simple_trade_config_map\n'), ((401, 442), 'hum... |
from django.contrib import admin
from . import models
admin.site.register(models.Game)
admin.site.register(models.Player)
| [
"django.contrib.admin.site.register"
] | [((55, 87), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Game'], {}), '(models.Game)\n', (74, 87), False, 'from django.contrib import admin\n'), ((88, 122), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Player'], {}), '(models.Player)\n', (107, 122), False, 'from djang... |
from onegov.core.security import Private
from onegov.org import OrgApp
from onegov.org.models import PersonMove
@OrgApp.view(model=PersonMove, permission=Private, request_method='PUT')
def move_page(self, request):
request.assert_valid_csrf_token()
self.execute()
| [
"onegov.org.OrgApp.view"
] | [((115, 186), 'onegov.org.OrgApp.view', 'OrgApp.view', ([], {'model': 'PersonMove', 'permission': 'Private', 'request_method': '"""PUT"""'}), "(model=PersonMove, permission=Private, request_method='PUT')\n", (126, 186), False, 'from onegov.org import OrgApp\n')] |
#!/usr/bin/env python3
##### PYTHON IMPORTS ###################################################################################################
import re
##### SPLAT IMPORTS ####################################################################################################
from splat.tokenizers.Tokenizer import Toke... | [
"re.sub",
"splat.tokenizers.Tokenizer.Tokenizer.tokenize"
] | [((1382, 1412), 'splat.tokenizers.Tokenizer.Tokenizer.tokenize', 'Tokenizer.tokenize', (['self', 'text'], {}), '(self, text)\n', (1400, 1412), False, 'from splat.tokenizers.Tokenizer import Tokenizer\n'), ((1610, 1640), 're.sub', 're.sub', (['"""[\\\\.,!\\\\?]"""', '""""""', 'word'], {}), "('[\\\\.,!\\\\?]', '', word)\... |
import alarms
import services
import sims4.commands
@sims4.commands.Command('timeline.list', command_type=sims4.commands.CommandType.Automation)
def timeline_list(_connection=None):
output = sims4.commands.Output(_connection)
timeline = services.time_service().sim_timeline
for handle in sorted(timeline.hea... | [
"services.time_service"
] | [((246, 269), 'services.time_service', 'services.time_service', ([], {}), '()\n', (267, 269), False, 'import services\n'), ((1299, 1322), 'services.time_service', 'services.time_service', ([], {}), '()\n', (1320, 1322), False, 'import services\n'), ((1756, 1779), 'services.time_service', 'services.time_service', ([], {... |
# Collection of python scripts for BakkesMod from Bakkes.
import bakkesmod
from bakkesmod import cvarManager, gameWrapper, Vector, Rotator
from random import randint
def airdribble(args):
tut = gameWrapper.GetGameEventAsServer()
player = tut.GetGameCar()
ball = tut.GetBall()
ballLoc = ball.GetLocat... | [
"bakkesmod.cvarManager.registerNotifier",
"random.randint",
"bakkesmod.VectorToRotator",
"bakkesmod.Vector",
"bakkesmod.cvarManager.log",
"bakkesmod.RotatorToVector",
"bakkesmod.gameWrapper.IsInFreeplay",
"bakkesmod.gameWrapper.GetGameEventAsServer",
"bakkesmod.gameWrapper.SetTimeout",
"bakkesmod.... | [((202, 236), 'bakkesmod.gameWrapper.GetGameEventAsServer', 'gameWrapper.GetGameEventAsServer', ([], {}), '()\n', (234, 236), False, 'from bakkesmod import cvarManager, gameWrapper, Vector, Rotator\n'), ((423, 473), 'bakkesmod.Vector', 'Vector', (['(ballLoc.X - 50)', '(ballLoc.Y - distToBall)', '(40)'], {}), '(ballLoc.... |
#0807.py
import cv2
import numpy as np
#1
src = cv2.imread('./data/chessBoard.jpg')
gray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)
patternSize = (6, 3)
found, corners = cv2.findChessboardCorners(src, patternSize)
print('corners.shape = ', corners.shape)
#2
term_crit = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITE... | [
"cv2.imshow",
"cv2.cornerSubPix",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.cvtColor",
"cv2.findChessboardCorners",
"cv2.drawChessboardCorners",
"cv2.imread"
] | [((54, 89), 'cv2.imread', 'cv2.imread', (['"""./data/chessBoard.jpg"""'], {}), "('./data/chessBoard.jpg')\n", (64, 89), False, 'import cv2\n'), ((98, 135), 'cv2.cvtColor', 'cv2.cvtColor', (['src', 'cv2.COLOR_BGR2GRAY'], {}), '(src, cv2.COLOR_BGR2GRAY)\n', (110, 135), False, 'import cv2\n'), ((176, 219), 'cv2.findChessb... |
from .Beamline import StructuredBeamline
import numpy as np
from scipy.constants import c
from re import findall
# lengths: mm
# quad strength: T/m
# bend angles: deg
# Need to handle elements that can have different number of parameters depending on mode
class BeamlineParser(object):
"""
Class that will par... | [
"numpy.max",
"re.findall",
"numpy.abs",
"numpy.min"
] | [((4982, 5030), 're.findall', 'findall', (['"""[-+]?\\\\d*\\\\.\\\\d+|\\\\d+"""', 'line[val_end:]'], {}), "('[-+]?\\\\d*\\\\.\\\\d+|\\\\d+', line[val_end:])\n", (4989, 5030), False, 'from re import findall\n'), ((6325, 6338), 'numpy.min', 'np.min', (['lines'], {}), '(lines)\n', (6331, 6338), True, 'import numpy as np\n... |
from flask import current_app
from flask_mail import Message, Mail
mail = Mail()
def send_email(to, subject, template):
msg = Message(
subject,
recipients=[to],
html=template,
sender=current_app.config['MAIL_DEFAULT_SENDER']
)
mail.send(msg)
| [
"flask_mail.Mail",
"flask_mail.Message"
] | [((75, 81), 'flask_mail.Mail', 'Mail', ([], {}), '()\n', (79, 81), False, 'from flask_mail import Message, Mail\n'), ((133, 236), 'flask_mail.Message', 'Message', (['subject'], {'recipients': '[to]', 'html': 'template', 'sender': "current_app.config['MAIL_DEFAULT_SENDER']"}), "(subject, recipients=[to], html=template, ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-03-10 18:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('client', '0002_auto_20180310_1434'),
]
operations = [
migrations.AddField(
... | [
"django.db.models.CharField"
] | [((397, 451), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(20)', 'null': '(True)'}), '(blank=True, max_length=20, null=True)\n', (413, 451), False, 'from django.db import migrations, models\n'), ((575, 629), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '... |
import pytest
from django.test import Client
pytestmark = pytest.mark.django_db
client = Client()
def test_news_page_gets_created(news_page):
"""Test that we have a news page created by the fixture"""
assert news_page is not None
def test_news_200(news_page):
"""Test that we have a news page created b... | [
"django.test.Client"
] | [((91, 99), 'django.test.Client', 'Client', ([], {}), '()\n', (97, 99), False, 'from django.test import Client\n')] |
from collections import defaultdict
import pycparser
import os
import ast
from pycparser import parse_file
def build_tree(script):
"""Builds an AST from a script."""
return ast.parse(script)
def read_oj_scripts(data_dir):
result = []
label_counts = defaultdict(int)
for label in os.listdir(data_di... | [
"os.path.join",
"ast.parse",
"os.listdir",
"collections.defaultdict"
] | [((183, 200), 'ast.parse', 'ast.parse', (['script'], {}), '(script)\n', (192, 200), False, 'import ast\n'), ((268, 284), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (279, 284), False, 'from collections import defaultdict\n'), ((302, 322), 'os.listdir', 'os.listdir', (['data_dir'], {}), '(data_di... |
# Copyright (c) 2017 Huawei, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"django.utils.translation.ugettext_lazy",
"conveyordashboard.api.api.sg_list"
] | [((1080, 1100), 'django.utils.translation.ugettext_lazy', '_', (['"""Security Groups"""'], {}), "('Security Groups')\n", (1081, 1100), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((1599, 1612), 'django.utils.translation.ugettext_lazy', '_', (['"""Add Rule"""'], {}), "('Add Rule')\n", (1600, 1612... |
from django.contrib import admin
from .models import Profile
# admin.site.register(Profile)
@admin.register(Profile)
class ProfileAdmin(admin.ModelAdmin):
list_display = ('user', 'student_id', 'birth_date', 'city')
list_filter = ('user', 'birth_date', 'city')
search_fields = ('user', 'student_id', 'bi... | [
"django.contrib.admin.register"
] | [((96, 119), 'django.contrib.admin.register', 'admin.register', (['Profile'], {}), '(Profile)\n', (110, 119), False, 'from django.contrib import admin\n')] |
"""Module player."""
__author__ = '<NAME> (japinol)'
from datetime import datetime
from os import path
from random import randint
import pygame as pg
from codemaster.utils.colors import Color
from codemaster.models.actors.items import bullets
from codemaster.models.actors.items.bullets import Bullet
from codemaster... | [
"pygame.transform.flip",
"pygame.time.get_ticks",
"pygame.sprite.spritecollide",
"codemaster.models.actors.items.bullets.Bullet.shot",
"os.path.join",
"datetime.datetime.now",
"codemaster.config.settings.logger.debug",
"codemaster.models.actors.text_msgs.TextMsg.create",
"codemaster.config.settings.... | [((1719, 1793), 'os.path.join', 'path.join', (['folder', 'f"""{FILE_NAMES[name][0]}_{num:02}.{FILE_NAMES[name][1]}"""'], {}), "(folder, f'{FILE_NAMES[name][0]}_{num:02}.{FILE_NAMES[name][1]}')\n", (1728, 1793), False, 'from os import path\n'), ((1846, 1937), 'os.path.join', 'path.join', (['BITMAPS_FOLDER', 'f"""{FILE_N... |
__author__ = "dwapstra"
import io
import re
import time
import logging
from unicon.bases.routers.services import BaseService
from unicon.core.errors import SubCommandFailure
from unicon.eal.dialogs import Dialog, Statement
from unicon.logs import UniconStreamHandler, UNICON_LOG_FORMAT
from unicon.plugins.generic.ser... | [
"unicon.core.errors.SubCommandFailure",
"unicon.plugins.generic.statements.GenericStatements",
"logging.Formatter",
"re.match",
"time.sleep",
"unicon.plugins.generic.GenericUtils",
"unicon.eal.dialogs.Dialog",
"unicon.eal.dialogs.Statement",
"unicon.logs.UniconStreamHandler",
"io.StringIO"
] | [((670, 684), 'unicon.plugins.generic.GenericUtils', 'GenericUtils', ([], {}), '()\n', (682, 684), False, 'from unicon.plugins.generic import GenericUtils\n'), ((772, 791), 'unicon.plugins.generic.statements.GenericStatements', 'GenericStatements', ([], {}), '()\n', (789, 791), False, 'from unicon.plugins.generic.state... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Seaky
# @Date: 2020/3/3 17:51
import tarfile
import zipfile
from pathlib import Path
def tar(tarname, filelist, path=True, **kwargs):
tar = tarfile.open(str(tarname), 'w:gz')
for f in filelist:
tar.add(f, arcname=Path(f).name if path else Non... | [
"zipfile.ZipFile",
"pathlib.Path"
] | [((408, 437), 'zipfile.ZipFile', 'zipfile.ZipFile', (['zipname', '"""w"""'], {}), "(zipname, 'w')\n", (423, 437), False, 'import zipfile\n'), ((291, 298), 'pathlib.Path', 'Path', (['f'], {}), '(f)\n', (295, 298), False, 'from pathlib import Path\n'), ((488, 495), 'pathlib.Path', 'Path', (['f'], {}), '(f)\n', (492, 495)... |
import matplotlib.pyplot as plt
import numpy as np
import math
import time
import sys
def input_coordinates(filename, showmap=False):
with open(filename, 'r') as fin:
X = []
Y = []
while True:
line = fin.readline()
if not line:
break
x, y ... | [
"numpy.random.rand",
"matplotlib.pyplot.ylabel",
"math.sqrt",
"numpy.array",
"math.exp",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.asarray",
"matplotlib.pyplot.yticks",
"numpy.random.seed",
"matplotlib.pyplot.scatter",
"sys.stdout.flush",
"numpy.random.permutation",
"num... | [((1218, 1270), 'math.sqrt', 'math.sqrt', (['((X[0] - X[-1]) ** 2 + (Y[0] - Y[-1]) ** 2)'], {}), '((X[0] - X[-1]) ** 2 + (Y[0] - Y[-1]) ** 2)\n', (1227, 1270), False, 'import math\n'), ((1557, 1581), 'numpy.random.permutation', 'np.random.permutation', (['n'], {}), '(n)\n', (1578, 1581), True, 'import numpy as np\n'), ... |
from random import randint
class BaseDeDados():
def __init__(self):
self.bd = {'2090-2': 'Rafael', '9018-0': 'Thalles'}#para teste
def abrirConta(self, nome):
while True:
n4 = randint(1000, 10000)
tn = randint(0, 10)
junto = str(n4) + '-' + str(tn)
... | [
"random.randint"
] | [((214, 234), 'random.randint', 'randint', (['(1000)', '(10000)'], {}), '(1000, 10000)\n', (221, 234), False, 'from random import randint\n'), ((252, 266), 'random.randint', 'randint', (['(0)', '(10)'], {}), '(0, 10)\n', (259, 266), False, 'from random import randint\n')] |
from sdc.crypto.jwe_helper import JWEHelper
from sdc.crypto.jwt_helper import JWTHelper
def encrypt(json, key_store, key_purpose):
"""This encrypts the supplied json and returns a jwe token.
:param str json: The json to be encrypted.
:param key_store: The key store.
:param str key_purpose: Context fo... | [
"sdc.crypto.jwe_helper.JWEHelper.encrypt",
"sdc.crypto.jwt_helper.JWTHelper.encode"
] | [((458, 517), 'sdc.crypto.jwt_helper.JWTHelper.encode', 'JWTHelper.encode', (['json', 'jwt_key.kid', 'key_store', 'key_purpose'], {}), '(json, jwt_key.kid, key_store, key_purpose)\n', (474, 517), False, 'from sdc.crypto.jwt_helper import JWTHelper\n'), ((607, 670), 'sdc.crypto.jwe_helper.JWEHelper.encrypt', 'JWEHelper.... |
#Part 1
import csv
def count_accessible_busstops(csv1,csv2):
count = 0
street_csv = open(csv1)
bus_csv = open(csv2)
reader1 = csv.DictReader(street_csv)
reader2 = csv.DictReader(bus_csv)
street_fdmid = []
bus_fdmid = []
for row1 in reader1:
if(row1["ST_CLASS"].upper() == "ARTERIAL".upper()):
... | [
"csv.DictReader"
] | [((136, 162), 'csv.DictReader', 'csv.DictReader', (['street_csv'], {}), '(street_csv)\n', (150, 162), False, 'import csv\n'), ((175, 198), 'csv.DictReader', 'csv.DictReader', (['bus_csv'], {}), '(bus_csv)\n', (189, 198), False, 'import csv\n'), ((930, 956), 'csv.DictReader', 'csv.DictReader', (['street_csv'], {}), '(st... |
import numpy as np
from sklearn.model_selection import train_test_split
import seaborn as sns
from sklearn.neural_network import MLPRegressor
from sklearn.ensemble import (
AdaBoostRegressor, GradientBoostingRegressor, RandomForestRegressor)
from sklearn.linear_model import Lasso, OrthogonalMatchingPursuit
from roo... | [
"sklearn.neural_network.MLPRegressor",
"intervals.openclosed",
"intervals.closedopen",
"sklearn.linear_model.Lasso",
"rootcp.models.ridge",
"sklearn.ensemble.AdaBoostRegressor",
"seaborn.set_style",
"intervals.closed",
"numpy.linalg.norm",
"numpy.arange",
"seaborn.set",
"sklearn.ensemble.Rando... | [((557, 589), 'numpy.quantile', 'np.quantile', (['residual', '(1 - alpha)'], {}), '(residual, 1 - alpha)\n', (568, 589), True, 'import numpy as np\n'), ((767, 809), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X[:-1]', 'y'], {'test_size': '(0.5)'}), '(X[:-1], y, test_size=0.5)\n', (783, 809), Fals... |
"""
Copyright 2019 <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 applicablNe law or agreed to in writing,
software distribu... | [
"logging.getLogger",
"numpy.abs",
"gs_quant.api.gs.hedges.GsHedgeApi.calculate_hedge",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.asarray",
"numpy.sum",
"numpy.cumsum",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplots",
... | [((784, 811), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (801, 811), False, 'import logging\n'), ((6011, 6040), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (6023, 6040), True, 'import matplotlib.pyplot as plt\n'), ((10498, 10512),... |
import pathlib
import pyabf
if __name__ == "__main__":
abfFolder = pathlib.Path(__file__).parent.parent.joinpath("abfs")
for abfFilePath in abfFolder.glob("*.abf"):
abf = pyabf.ABF(str(abfFilePath))
#print(abf.abfID, abf.abfDateTime)
print(f'[TestCase("{abf.abfID}.abf", "{abf.abfDateTim... | [
"pathlib.Path"
] | [((72, 94), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (84, 94), False, 'import pathlib\n')] |
#!/usr/bin/env python
"""Messaging interceptor to validate IonObjects"""
from pyon.core.interceptor.interceptor import Interceptor
from pyon.core.bootstrap import IonObject, CFG
from pyon.core.exception import BadRequest
from pyon.core.object import IonObjectBase, walk
from pyon.core.registry import is_ion_object
fro... | [
"pyon.core.bootstrap.CFG.get_safe",
"pyon.core.bootstrap.IonObject",
"pyon.core.object.walk",
"pyon.util.log.log.warn",
"pyon.core.registry.is_ion_object",
"pyon.core.exception.BadRequest"
] | [((622, 682), 'pyon.core.bootstrap.CFG.get_safe', 'CFG.get_safe', (['"""container.objects.validate.interceptor"""', '(True)'], {}), "('container.objects.validate.interceptor', True)\n", (634, 682), False, 'from pyon.core.bootstrap import IonObject, CFG\n'), ((1276, 1295), 'pyon.core.registry.is_ion_object', 'is_ion_obj... |
from django import forms
from django.contrib.auth.forms import UserCreationForm
from user.models import Profile
class PercentageField(forms.fields.FloatField):
widget = forms.fields.TextInput(attrs={"class": "form-control"})
def is_number(self, val):
if val is None:
return False
tr... | [
"django.forms.CheckboxInput",
"django.forms.fields.TextInput",
"django.forms.TextInput"
] | [((174, 229), 'django.forms.fields.TextInput', 'forms.fields.TextInput', ([], {'attrs': "{'class': 'form-control'}"}), "(attrs={'class': 'form-control'})\n", (196, 229), False, 'from django import forms\n'), ((1855, 1956), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'class': 'jq-date input-small form-... |
"""
Result backend for Easy-Job which use python logging
available options to use
* log_level: level of logging could be logging.DEBUG logging.ERROR or any other log level defined in logging module
default: logging.DEBUG
* logger: name of the logger to use, be cautious , the logger must already defined
... | [
"logging.getLogger"
] | [((1049, 1074), 'logging.getLogger', 'logging.getLogger', (['logger'], {}), '(logger)\n', (1066, 1074), False, 'import logging\n')] |
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Sequential, Model
from tensorflow.keras.layers import Input, TimeDistributed, Activation, Lambda
from tensorflow.keras.layers import Conv2D, MaxPool2D, Flatten, Dense, AvgPool2D
from tensorflow.keras.layers import Concatenate, Subtract, Mult... | [
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.AvgPool2D",
"os.remove",
"tensorflow.keras.backend.set_image_data_format",
"tensorflow.keras.layers.Conv2D",
"json.dumps",
"matplotlib.pyplot.plot",
"os.path.split",
"glob.glob",
"json.loads",
"pickle.load",
"MFIRAP.d00_utils.verbosity.... | [((736, 791), 'tensorflow.keras.backend.set_image_data_format', 'tf.keras.backend.set_image_data_format', (['"""channels_last"""'], {}), "('channels_last')\n", (774, 791), True, 'import tensorflow as tf\n'), ((3063, 3094), 'json.loads', 'json.loads', (['original_model_json'], {}), '(original_model_json)\n', (3073, 3094... |
import os
import pytest
from skelevision import TraceLog, IllegalLogAction, LogSkeleton
HERE = os.path.dirname(os.path.abspath(__file__))
DATA = os.path.join(HERE, "datasets")
class TestLogSkeleton(object):
pass | [
"os.path.abspath",
"os.path.join"
] | [((148, 178), 'os.path.join', 'os.path.join', (['HERE', '"""datasets"""'], {}), "(HERE, 'datasets')\n", (160, 178), False, 'import os\n'), ((114, 139), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (129, 139), False, 'import os\n')] |
# Copyright (c) 2014-2016, Freescale Semiconductor, Inc.
# Copyright 2016 NXP
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Generated by erpcgen 1.7.3 on Mon Sep 23 13:00:45 2019.
#
# AUTOGENERATED - DO NOT EDIT
#
import erpc
from . import common, interface
# Client for MatrixMultiplyService
c... | [
"erpc.codec.MessageInfo"
] | [((856, 1023), 'erpc.codec.MessageInfo', 'erpc.codec.MessageInfo', ([], {'type': 'erpc.codec.MessageType.kInvocationMessage', 'service': 'self.SERVICE_ID', 'request': 'self.ERPCMATRIXMULTIPLY_ID', 'sequence': 'request.sequence'}), '(type=erpc.codec.MessageType.kInvocationMessage,\n service=self.SERVICE_ID, request=s... |
# coding: utf-8
"""
Control-M Services
Provides access to BMC Control-M Services # noqa: E501
OpenAPI spec version: 9.20.30
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from ctm_saas_client.configuratio... | [
"six.iteritems",
"ctm_saas_client.configuration.Configuration"
] | [((6443, 6476), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (6456, 6476), False, 'import six\n'), ((1544, 1559), 'ctm_saas_client.configuration.Configuration', 'Configuration', ([], {}), '()\n', (1557, 1559), False, 'from ctm_saas_client.configuration import Configuration\n... |
#!/usr/bin/env python
import os
import re
import sys
from codecs import open
from setuptools import setup
from setuptools.command.test import test as TestCommand
with open('django_toolset/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), ... | [
"setuptools.setup",
"setuptools.command.test.test.finalize_options",
"pytest.main",
"setuptools.command.test.test.initialize_options",
"sys.exit",
"os.system",
"codecs.open"
] | [((1296, 2142), 'setuptools.setup', 'setup', ([], {'name': '"""django-toolset"""', 'version': 'version', 'description': '"""Python user input prompt toolkit"""', 'long_description': 'readme', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/dansackett/django-toolset"""', 'package... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# http://www.python.org/dev/peps/pep-0263/
"""Call OpenCalais NER"""
from __future__ import division # 1/2 == 0.5, as in Py3
from __future__ import absolute_import # avoid hiding global modules with locals
from __future__ import print_function # force use of print("hello... | [
"sql_convenience.deserialise_response"
] | [((1887, 1957), 'sql_convenience.deserialise_response', 'sql_convenience.deserialise_response', (['tweet_id', 'self.destination_table'], {}), '(tweet_id, self.destination_table)\n', (1923, 1957), False, 'import sql_convenience\n')] |
from concurrent.futures import ProcessPoolExecutor
from functools import partial
import numpy as np
import os
import audio
import csv
from hparams import hparams
import traceback
def build_from_path(in_dir, out_dir, speakers, num_workers=1, tqdm=lambda x: x):
executor = ProcessPoolExecutor(max_workers=num_workers... | [
"traceback.format_exc",
"numpy.abs",
"os.path.join",
"audio.melspectrogram",
"audio.load_wav",
"functools.partial",
"concurrent.futures.ProcessPoolExecutor",
"audio.spectrogram",
"csv.reader"
] | [((277, 321), 'concurrent.futures.ProcessPoolExecutor', 'ProcessPoolExecutor', ([], {'max_workers': 'num_workers'}), '(max_workers=num_workers)\n', (296, 321), False, 'from concurrent.futures import ProcessPoolExecutor\n'), ((1233, 1257), 'audio.load_wav', 'audio.load_wav', (['wav_path'], {}), '(wav_path)\n', (1247, 12... |
# -*- coding: utf-8 -*-
'''
Generating sitemap.
'''
import os
from config import SITE_CFG, router_post
from torcms.model.post_model import MPost
from torcms.model.wiki_model import MWiki
def gen_post_map(file_name, ext_url=''):
'''
Generate the urls for posts.
:return: None
'''
with open(file_nam... | [
"torcms.model.post_model.MPost.query_all",
"os.path.exists",
"torcms.model.wiki_model.MWiki.query_all",
"os.path.join",
"os.remove"
] | [((872, 910), 'torcms.model.wiki_model.MWiki.query_all', 'MWiki.query_all', ([], {'limit': '(10000)', 'kind': '"""1"""'}), "(limit=10000, kind='1')\n", (887, 910), False, 'from torcms.model.wiki_model import MWiki\n'), ((1236, 1274), 'torcms.model.wiki_model.MWiki.query_all', 'MWiki.query_all', ([], {'limit': '(10000)'... |
from pychromecast import Chromecast
from wait_init import wait_init
import sys
cast=Chromecast(sys.argv[1])
wait_init(cast)
cast.media_controller.play_media(sys.argv[2],sys.argv[3]) | [
"pychromecast.Chromecast",
"wait_init.wait_init"
] | [((85, 108), 'pychromecast.Chromecast', 'Chromecast', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (95, 108), False, 'from pychromecast import Chromecast\n'), ((109, 124), 'wait_init.wait_init', 'wait_init', (['cast'], {}), '(cast)\n', (118, 124), False, 'from wait_init import wait_init\n')] |
import re
import uuid
import json
import types
import logging
import functools
import tornado.gen
import tornado.options
import tornado.httputil
import tornado.httpclient
import tornado.websocket
class SlackBot(object):
def __init__(self, slack, http_client=None):
self.slack = slack
self.http_cl... | [
"json.loads",
"traceback.print_exc",
"logging.info",
"uuid.uuid4"
] | [((1771, 1783), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (1781, 1783), False, 'import uuid\n'), ((1125, 1140), 'json.loads', 'json.loads', (['msg'], {}), '(msg)\n', (1135, 1140), False, 'import json\n'), ((1402, 1430), 'logging.info', 'logging.info', (['"""Reconnecting"""'], {}), "('Reconnecting')\n", (1414, 1430)... |
# Copyright 2017 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 required by applica... | [
"os.path.exists",
"tensorflow.image.decode_png",
"os.listdir",
"tensorflow.image.resize_images",
"os.makedirs",
"argparse.ArgumentParser",
"tensorflow.Session",
"numpy.array",
"tensorflow.read_file"
] | [((1598, 1616), 'os.listdir', 'os.listdir', (['imgdir'], {}), '(imgdir)\n', (1608, 1616), False, 'import os\n'), ((2933, 2958), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2956, 2958), False, 'import argparse\n'), ((3405, 3449), 'os.path.exists', 'os.path.exists', (["(config.bin_input_dir +... |
from os import environ as env
from typing import Dict, Optional, Tuple
import requests
from pyno.models import CreatePageRequestModel, PropertyModel
from requests.models import Response
TOKEN = env['TOKEN']
URL = 'https://api.notion.com/v1'
def add_query_param(url: str, **params) -> str:
for k, v in params.ite... | [
"pyno.models.CreatePageRequestModel",
"requests.get"
] | [((977, 1026), 'requests.get', 'requests.get', (['f"""{endpoint}/{id}"""'], {'headers': 'headers'}), "(f'{endpoint}/{id}', headers=headers)\n", (989, 1026), False, 'import requests\n'), ((1412, 1451), 'requests.get', 'requests.get', (['endpoint'], {'headers': 'headers'}), '(endpoint, headers=headers)\n', (1424, 1451), ... |
# caclculate the cost bw
import os
import pandas as pd
import numpy as np
import time
# store the matrix A
def store_bw_e2u(df_ct, store_path, n):
user_path = store_path + '/user_' + str(n)
if not os.path.exists(user_path):
os.makedirs(user_path)
df_ct.to_csv(user_path + '/cost_e.csv', index=Fals... | [
"os.path.exists",
"os.makedirs",
"numpy.asarray",
"numpy.core.defchararray.add",
"time.time"
] | [((620, 631), 'time.time', 'time.time', ([], {}), '()\n', (629, 631), False, 'import time\n'), ((1225, 1236), 'time.time', 'time.time', ([], {}), '()\n', (1234, 1236), False, 'import time\n'), ((1380, 1422), 'numpy.core.defchararray.add', 'np.core.defchararray.add', (['ct_col_name', 'cts'], {}), '(ct_col_name, cts)\n',... |
import json
import logging
from typing import Dict
from pika import BasicProperties
from pika.exceptions import AMQPError
from retry import retry
from modules.buffering.amqp import create_rmq_connection, prepare_producer_channel
from modules.models import UniconEvent
logger = logging.getLogger('unicon')
class RMQP... | [
"logging.getLogger",
"modules.buffering.amqp.create_rmq_connection",
"json.dumps",
"retry.retry",
"modules.buffering.amqp.prepare_producer_channel",
"pika.BasicProperties"
] | [((280, 307), 'logging.getLogger', 'logging.getLogger', (['"""unicon"""'], {}), "('unicon')\n", (297, 307), False, 'import logging\n'), ((702, 762), 'retry.retry', 'retry', (['AMQPError'], {'tries': '(2)', 'delay': '(2)', 'backoff': '(2)', 'logger': 'logger'}), '(AMQPError, tries=2, delay=2, backoff=2, logger=logger)\n... |
import cv2
import numpy as np
frameWidth = 640
framHeight = 480
cap = cv2.VideoCapture(0)
cap.set(3, frameWidth)
cap.set(4, framHeight)
cap.set(10, 150)
# Unfortunately depend of your camera quality,
# you need to adjust different values for different illuminations
# to be use during the night
myColors = [[0, 120, ... | [
"cv2.drawContours",
"cv2.inRange",
"cv2.imshow",
"cv2.contourArea",
"numpy.array",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.findContours",
"cv2.waitKey"
] | [((72, 91), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (88, 91), False, 'import cv2\n'), ((542, 578), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2HSV'], {}), '(img, cv2.COLOR_BGR2HSV)\n', (554, 578), False, 'import cv2\n'), ((805, 868), 'cv2.findContours', 'cv2.findContours', (['img', '... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | [
"typing.cast",
"numpy.abs",
"qiskit.opflow.list_ops.composed_op.ComposedOp",
"numpy.sum"
] | [((2419, 2433), 'numpy.abs', 'np.abs', (['coeffs'], {}), '(coeffs)\n', (2425, 2433), True, 'import numpy as np\n'), ((2450, 2465), 'numpy.sum', 'np.sum', (['weights'], {}), '(weights)\n', (2456, 2465), True, 'import numpy as np\n'), ((2178, 2218), 'typing.cast', 'cast', (['List[PrimitiveOp]', 'operator.oplist'], {}), '... |
import sys
import os
import numpy as np
#this_name=sys.argv[0]
#var=sys.argv[1]
#print('argv[0] is ' + this_name + '; argv[1] is ' + var + '\n')
if len(sys.argv) > 1:
npy_txt_path=sys.argv[1] # it should contain files ./name.npy.txt
else:
print("should provide source directory name\n")
exit()
#npy_txt_path... | [
"os.path.exists",
"os.listdir",
"os.makedirs",
"numpy.loadtxt",
"numpy.save"
] | [((691, 715), 'os.listdir', 'os.listdir', (['npy_txt_path'], {}), '(npy_txt_path)\n', (701, 715), False, 'import os\n'), ((624, 648), 'os.path.exists', 'os.path.exists', (['npy_path'], {}), '(npy_path)\n', (638, 648), False, 'import os\n'), ((654, 675), 'os.makedirs', 'os.makedirs', (['npy_path'], {}), '(npy_path)\n', ... |
# This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.stats` namespace for importing the functions
# included below.
import warnings
from . import _kde
__all__ = [ # noqa: F822
'gaussian_kde', 'linalg', 'logsumexp', 'check_random_state',
'atleast_2d', 'reshape', 'newa... | [
"warnings.warn"
] | [((697, 868), 'warnings.warn', 'warnings.warn', (['f"""Please use `{name}` from the `scipy.stats` namespace, the `scipy.stats.kde` namespace is deprecated."""'], {'category': 'DeprecationWarning', 'stacklevel': '(2)'}), "(\n f'Please use `{name}` from the `scipy.stats` namespace, the `scipy.stats.kde` namespace is d... |
# -*- coding: utf-8 -*-
from io import BytesIO
from json import dumps
from re import S
from tests.test_datasets import TASK_ID
from unittest import TestCase
from fastapi.testclient import TestClient
from minio.error import BucketAlreadyOwnedByYou
from projects.api.main import app
from projects.controllers.utils impor... | [
"fastapi.testclient.TestClient",
"json.dumps",
"io.BytesIO",
"projects.controllers.utils.uuid_alpha",
"projects.kfp.kfp_client",
"projects.database.engine.connect",
"projects.object_storage.MINIO_CLIENT.remove_object",
"projects.object_storage.MINIO_CLIENT.make_bucket"
] | [((483, 498), 'fastapi.testclient.TestClient', 'TestClient', (['app'], {}), '(app)\n', (493, 498), False, 'from fastapi.testclient import TestClient\n'), ((517, 529), 'projects.controllers.utils.uuid_alpha', 'uuid_alpha', ([], {}), '()\n', (527, 529), False, 'from projects.controllers.utils import uuid_alpha\n'), ((551... |
from collections import Mapping
import os
from six import string_types
import sys
import yaml
# set the base dir path
DIR = os.path.abspath(os.path.dirname(__file__))
def get_test_dirs():
# get the list of directories to run tests on
# if provided on the command line
if len(sys.argv) > 2:
return... | [
"os.listdir",
"os.path.join",
"os.path.isfile",
"os.path.dirname",
"yaml.safe_load"
] | [((141, 166), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (156, 166), False, 'import os\n'), ((973, 1009), 'os.path.join', 'os.path.join', (['DIR', '"""run_config.yaml"""'], {}), "(DIR, 'run_config.yaml')\n", (985, 1009), False, 'import os\n'), ((3439, 3461), 'os.path.isfile', 'os.path.isf... |
import numpy as np
def score1(q, doc):
return np.dot(q, doc)
def score2(q, doc):
return np.dot(q, doc) / (np.linalg.norm(q) * np.linalg.norm(doc))
def retrieval(collection, query, func_score):
result = []
for i in range(len(collection)):
sim = func_score(query, collection[i])
... | [
"numpy.array",
"numpy.dot",
"numpy.linalg.norm"
] | [((697, 784), 'numpy.array', 'np.array', (['[0, 1.345, 1.453, 1.987, 0, 2.133, 0, 0, 0, 0, 0, 0, 3.452, 0, 0, 4.234]'], {}), '([0, 1.345, 1.453, 1.987, 0, 2.133, 0, 0, 0, 0, 0, 0, 3.452, 0, 0, \n 4.234])\n', (705, 784), True, 'import numpy as np\n'), ((54, 68), 'numpy.dot', 'np.dot', (['q', 'doc'], {}), '(q, doc)\n'... |
from waldur_core.cost_tracking import CostTrackingRegister, CostTrackingStrategy, ConsumableItem
from . import models
class DropletStrategy(CostTrackingStrategy):
resource_class = models.Droplet
class Types(object):
FLAVOR = 'flavor'
@classmethod
def get_consumable_items(cls):
retur... | [
"waldur_core.cost_tracking.CostTrackingRegister.register_strategy",
"waldur_core.cost_tracking.ConsumableItem"
] | [((749, 804), 'waldur_core.cost_tracking.CostTrackingRegister.register_strategy', 'CostTrackingRegister.register_strategy', (['DropletStrategy'], {}), '(DropletStrategy)\n', (787, 804), False, 'from waldur_core.cost_tracking import CostTrackingRegister, CostTrackingStrategy, ConsumableItem\n'), ((323, 411), 'waldur_cor... |
from task_helper import TaskHelper
import time
import pandas as pd
def main(testing=True):
output_df = pd.DataFrame.from_dict(
{
'response': [],
'duration': [],
'IRT': [],
'cumulative_time': [],
'TO_interval': [],
'ITI': [],
... | [
"task_helper.TaskHelper",
"time.sleep",
"time.time",
"pandas.DataFrame.from_dict"
] | [((109, 275), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (["{'response': [], 'duration': [], 'IRT': [], 'cumulative_time': [],\n 'TO_interval': [], 'ITI': [], 'rewarded(0/1)': [], 'schedule': []}"], {}), "({'response': [], 'duration': [], 'IRT': [],\n 'cumulative_time': [], 'TO_interval': [], 'ITI': ... |
import pytest
from osp.corpus.models import Document_Index
from osp.citations.jobs import text_to_docs
from osp.citations.models import Citation
from osp.citations.utils import tokenize_field
from peewee import fn
pytestmark = pytest.mark.usefixtures('db', 'es')
def test_matches(add_doc, add_text):
"""
... | [
"osp.corpus.models.Document_Index.es_insert",
"pytest.mark.parametrize",
"pytest.mark.usefixtures",
"osp.citations.models.Citation.tokens.contains",
"osp.citations.models.Citation.select",
"osp.citations.jobs.text_to_docs"
] | [((232, 267), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""db"""', '"""es"""'], {}), "('db', 'es')\n", (255, 267), False, 'import pytest\n'), ((1492, 1789), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""title,surname,content"""', "[('War and Peace', 'Tolstoy', 'War and Peace, Leo Tolstoy'),... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import os
from django.conf import settings
from django.shortcuts import reverse
from django.utils.html import escape
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from seleniu... | [
"selenium.webdriver.support.ui.WebDriverWait",
"dataops.pandas_db.load_from_db",
"dataops.pandas_db.pg_restore_table",
"selenium.webdriver.support.expected_conditions.text_to_be_present_in_element",
"dataops.pandas_db.delete_all_tables",
"workflow.models.Workflow.objects.all",
"selenium.webdriver.suppor... | [((616, 635), 'django.conf.settings.BASE_DIR', 'settings.BASE_DIR', ([], {}), '()\n', (633, 635), False, 'from django.conf import settings\n'), ((787, 828), 'dataops.pandas_db.pg_restore_table', 'pandas_db.pg_restore_table', (['self.filename'], {}), '(self.filename)\n', (813, 828), False, 'from dataops import pandas_db... |
#!/usr/bin/env python3
import sys
import argparse
import numpy as np
import yaml
DESC = "Prints total number of parameters in model.npz"
S2S_SPECIAL_NODE = "special:model.yml"
def main():
args = parse_args()
print("Loading {}".format(args.model))
model = np.load(args.model)
count = 0
for key ... | [
"numpy.load",
"argparse.ArgumentParser"
] | [((273, 292), 'numpy.load', 'np.load', (['args.model'], {}), '(args.model)\n', (280, 292), True, 'import numpy as np\n'), ((567, 608), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'DESC'}), '(description=DESC)\n', (590, 608), False, 'import argparse\n')] |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"_common.get_files_without_header",
"sys.exit"
] | [((902, 913), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (910, 913), False, 'import sys\n'), ((573, 599), '_common.get_files_without_header', 'get_files_without_header', ([], {}), '()\n', (597, 599), False, 'from _common import get_files_without_header\n')] |
import numpy as np
from .utils.augmentations import letterbox
from .models.experimental import attempt_load
import cv2 as cv
from .utils.general import (check_img_size,
non_max_suppression, set_logging)
import argparse
import os
import sys
from pathlib import Path
import random
import torch... | [
"cv2.rectangle",
"cv2.imwrite",
"os.listdir",
"pathlib.Path",
"pathlib.Path.cwd",
"os.path.join",
"torch.from_numpy",
"numpy.ascontiguousarray",
"torch.cuda.is_available",
"cv2.VideoCapture",
"torch.no_grad",
"cv2.imread"
] | [((1387, 1402), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1400, 1402), False, 'import torch\n'), ((3308, 3341), 'cv2.VideoCapture', 'cv.VideoCapture', (['"""test_video.avi"""'], {}), "('test_video.avi')\n", (3323, 3341), True, 'import cv2 as cv\n'), ((3496, 3520), 'os.listdir', 'os.listdir', (['test_pic_dir'... |
#import essential libraries
import lcd
import pyb
# do 1 iteration of Conway's Game of Life
def conway_step():
for x in range(128): # loop over x coordinates
for y in range(32): # loop over y coordinates
# count number of neigbours
num_neighbours = (lcd.get(x - 1, y - 1) ... | [
"pyb.delay",
"lcd.show",
"lcd.get",
"pyb.rand",
"lcd.set",
"lcd.LCD",
"lcd.clear",
"lcd.reset"
] | [((1594, 1610), 'lcd.LCD', 'lcd.LCD', (['(128)', '(32)'], {}), '(128, 32)\n', (1601, 1610), False, 'import lcd\n'), ((1035, 1046), 'lcd.clear', 'lcd.clear', ([], {}), '()\n', (1044, 1046), False, 'import lcd\n'), ((1510, 1520), 'lcd.show', 'lcd.show', ([], {}), '()\n', (1518, 1520), False, 'import lcd\n'), ((1559, 1573... |
# 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 "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, su... | [
"multicrypto.bech32.bech32_decode",
"pytest.mark.parametrize",
"multicrypto.bech32.encode",
"multicrypto.bech32.decode",
"binascii.unhexlify",
"multicrypto.address.segwit_scriptpubkey"
] | [((2632, 2681), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""string"""', 'VALID_CHECKSUM'], {}), "('string', VALID_CHECKSUM)\n", (2655, 2681), False, 'import pytest\n'), ((3006, 3057), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""string"""', 'INVALID_CHECKSUM'], {}), "('string', INVALID_CH... |
import os
import string
import random
import sys
import logging
import json
import datetime
import gevent
import websocket
from locust import HttpLocust, TaskSet, task, events, Locust
from threading import Timer
import time
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger.info('INIT'... | [
"logging.basicConfig",
"logging.getLogger",
"json.loads",
"random.choice",
"locust.task",
"gevent.spawn",
"os.getenv",
"threading.Timer",
"json.dumps",
"locust.events.request_failure.fire",
"locust.events.request_success.fire",
"time.time",
"websocket.WebSocket",
"random.randint"
] | [((225, 264), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (244, 264), False, 'import logging\n'), ((274, 301), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (291, 301), False, 'import logging\n'), ((8150, 8157), 'locust.task', ... |
# -*- coding: utf-8 -*-
"""
Settings
~~~~~~~~
This file contains the settings required to setup the REST API that will allow us to query the chemicals database.
:copyright: (c) 2018 by <NAME>.
:license: MIT, see LICENSE for more details.
"""
import os
# Setup variable need to connect to the data... | [
"os.environ.get"
] | [((338, 375), 'os.environ.get', 'os.environ.get', (['"""MONGO_HOST"""', '"""mongo"""'], {}), "('MONGO_HOST', 'mongo')\n", (352, 375), False, 'import os\n'), ((389, 424), 'os.environ.get', 'os.environ.get', (['"""MONGO_PORT"""', '(27017)'], {}), "('MONGO_PORT', 27017)\n", (403, 424), False, 'import os\n'), ((440, 477), ... |
# Copyright 2013 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 ag... | [
"mock.patch.stopall",
"mock.patch",
"src.hadoop.datastore.InstanceInfo",
"src.hadoop.datastore.ClusterInfo",
"json.dumps",
"src.hadoop.hadoop_csv_transformer.HadoopCsvTransformer",
"src.basetest.main"
] | [((3571, 3586), 'src.basetest.main', 'basetest.main', ([], {}), '()\n', (3584, 3586), False, 'from src import basetest\n'), ((1666, 1686), 'mock.patch.stopall', 'mock.patch.stopall', ([], {}), '()\n', (1684, 1686), False, 'import mock\n'), ((2069, 2092), 'src.hadoop.datastore.ClusterInfo', 'datastore.ClusterInfo', ([],... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"unittest.main",
"azure.cli.testsdk.ResourceGroupPreparer"
] | [((493, 516), 'azure.cli.testsdk.ResourceGroupPreparer', 'ResourceGroupPreparer', ([], {}), '()\n', (514, 516), False, 'from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer\n'), ((2522, 2537), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2535, 2537), False, 'import unittest\n')] |
from tensorflow.keras.applications.resnet50 import ResNet50
model = ResNet50(weights='imagenet')
# Save the entire model as a SavedModel.
model.save('resnet50_saved_model') | [
"tensorflow.keras.applications.resnet50.ResNet50"
] | [((69, 97), 'tensorflow.keras.applications.resnet50.ResNet50', 'ResNet50', ([], {'weights': '"""imagenet"""'}), "(weights='imagenet')\n", (77, 97), False, 'from tensorflow.keras.applications.resnet50 import ResNet50\n')] |
from functools import wraps
import re
import math
from PySide2.QtGui import QValidator
from PySide2.QtWidgets import QDoubleSpinBox
#
# Derived from https://gist.github.com/jdreaver/0be2e44981159d0854f5
#
FLOAT_REGEX = re.compile(r'(([+-]?\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?)')
# "i" and "in" are both interpreted as "i... | [
"re.sub",
"math.isnan",
"functools.wraps",
"re.compile"
] | [((221, 282), 're.compile', 're.compile', (['"""(([+-]?\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][+-]?\\\\d+)?)"""'], {}), "('(([+-]?\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][+-]?\\\\d+)?)')\n", (231, 282), False, 'import re\n'), ((341, 376), 're.compile', 're.compile', (['"""^([+-]?)(i(?:n|nf)?)$"""'], {}), "('^([+-]?)(i(?:n... |
import pygame
class textBox(object):
def __init__(self, positionX, positionY, width, height, colorText, colorUnhover, colorHover, font):
self.positionX = positionX
self.positionY = positionY
self.width = width
self.height = height
self.textColor = colorText
... | [
"pygame.Surface"
] | [((336, 367), 'pygame.Surface', 'pygame.Surface', (['(width, height)'], {}), '((width, height))\n', (350, 367), False, 'import pygame\n'), ((438, 469), 'pygame.Surface', 'pygame.Surface', (['(width, height)'], {}), '((width, height))\n', (452, 469), False, 'import pygame\n')] |
import gl
from importlib import resources
from . import shaders
from .. import Common
class SfaMapProgram(gl.Program):
"""Base for Programs used by this renderer."""
separable = True
def __init__(self, ctx):
super().__init__(ctx)
#self._translate = [-1, -2, -300]
self._translate... | [
"importlib.resources.read_text"
] | [((604, 638), 'importlib.resources.read_text', 'resources.read_text', (['shaders', 'path'], {}), '(shaders, path)\n', (623, 638), False, 'from importlib import resources\n'), ((680, 713), 'importlib.resources.read_text', 'resources.read_text', (['Common', 'path'], {}), '(Common, path)\n', (699, 713), False, 'from impor... |
from datetime import date
def list_dev_ids(nodes, rels):
dev_nodes = [x for x in nodes if x['data']['type'] == 'Developer']
arr = []
for x in dev_nodes:
arr.append(x['data']['id'])
return arr
def get_dev_name(nodes, rels, dev_id):
dev_nodes = [x for x in nodes if x['data']['type'] == 'Developer']
for x ... | [
"datetime.date"
] | [((1302, 1324), 'datetime.date', 'date', (['year', 'month', 'day'], {}), '(year, month, day)\n', (1306, 1324), False, 'from datetime import date\n')] |
# coding: utf-8
import chainer
import chainer.links as L
from chainer import serializers
class A(chainer.Chain):
def __init__(self):
super(A, self).__init__()
with self.init_scope():
# TODO Add more tests
self.l1 = L.Convolution2D(None, 6, (5, 7), stride=(2, 3))
def f... | [
"numpy.random.rand",
"numpy.random.seed",
"chainer_compiler.elichika.testtools.generate_testcase",
"chainer.links.Convolution2D"
] | [((808, 827), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (822, 827), True, 'import numpy as np\n'), ((890, 929), 'chainer_compiler.elichika.testtools.generate_testcase', 'testtools.generate_testcase', (['model', '[x]'], {}), '(model, [x])\n', (917, 929), False, 'from chainer_compiler.elichika im... |
#!/usr/bin/env python
# Copyright (C) 2016 Hewlett Packard Enterprise Development LP
# 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/... | [
"opsvalidator.error.ValidationError",
"opsrest.utils.utils.get_column_data_from_row"
] | [((1735, 1789), 'opsrest.utils.utils.get_column_data_from_row', 'utils.get_column_data_from_row', (['port_row', '"""interfaces"""'], {}), "(port_row, 'interfaces')\n", (1765, 1789), False, 'from opsrest.utils import utils\n'), ((1975, 2028), 'opsrest.utils.utils.get_column_data_from_row', 'utils.get_column_data_from_ro... |
from mcpi.minecraft import Minecraft
mc = Minecraft.create()
pos = mc.player.getTilePos()
x = pos.x
y = pos.y
z = pos.z
bottomStep = 0
topStep = 256
stepWidth = x + 3
melonBlock = 103
stone = 1
mc.setBlock(x, y, z, melonBlock)
for s in range(bottomStep, topStep):
for sw in range(x, stepWidth):
mc.setBlock(sw,... | [
"mcpi.minecraft.Minecraft.create"
] | [((42, 60), 'mcpi.minecraft.Minecraft.create', 'Minecraft.create', ([], {}), '()\n', (58, 60), False, 'from mcpi.minecraft import Minecraft\n')] |
from entityfx.string_manipulation_base import StringManipulationBase
class StringManipulation(StringManipulationBase):
def benchImplementation(self) -> str:
str0_ = "the quick brown fox jumps over the lazy dog"
str1 = ""
i = 0
while i < self._iterrations:
str1 = St... | [
"entityfx.string_manipulation_base.StringManipulationBase._doStringManipilation"
] | [((318, 369), 'entityfx.string_manipulation_base.StringManipulationBase._doStringManipilation', 'StringManipulationBase._doStringManipilation', (['str0_'], {}), '(str0_)\n', (362, 369), False, 'from entityfx.string_manipulation_base import StringManipulationBase\n')] |
import cv2
import imutils
import time
from os.path import join, dirname
import os
import threading
from src.EventEmitter import EventEmitter
from src.utils.image_utils import is_movement
class MotionDetector(threading.Thread, EventEmitter):
def __init__(self, config):
threading.Thread.__init__(self)
EventEm... | [
"threading.Thread.__init__",
"src.utils.image_utils.is_movement",
"threading.Timer",
"time.sleep",
"cv2.VideoWriter",
"imutils.resize",
"os.path.dirname",
"cv2.VideoCapture",
"cv2.VideoWriter_fourcc",
"time.time",
"src.EventEmitter.EventEmitter.__init__"
] | [((277, 308), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {}), '(self)\n', (302, 308), False, 'import threading\n'), ((313, 340), 'src.EventEmitter.EventEmitter.__init__', 'EventEmitter.__init__', (['self'], {}), '(self)\n', (334, 340), False, 'from src.EventEmitter import EventEmitter\n'), ((5... |
# -*- coding: utf-8 -*-
""" XIO plugin for the export parameters as an XDS.INP format
See http://xds.mpimf-heidelberg.mpg.de/html_doc/xds_prepare.html
"""
__version__ = "0.4.1"
__author__ = "<NAME> (<EMAIL>)"
__date__ = "27-11-2013"
__copyright__ = "Copyright (c) 2007-2013 <NAME>"
__license__ = "New BSD, http://w... | [
"time.ctime",
"pycgtypes.vec3",
"pycgtypes.mat3"
] | [((446, 459), 'pycgtypes.vec3', 'vec3', (['(1)', '(0)', '(0)'], {}), '(1, 0, 0)\n', (450, 459), False, 'from pycgtypes import vec3\n'), ((461, 474), 'pycgtypes.vec3', 'vec3', (['(0)', '(1)', '(0)'], {}), '(0, 1, 0)\n', (465, 474), False, 'from pycgtypes import vec3\n'), ((476, 489), 'pycgtypes.vec3', 'vec3', (['(0)', '... |
# Generated from JavaLexer.g4 by ANTLR 4.9.3
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
from typing import TextIO
else:
from typing.io import TextIO
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\... | [
"io.StringIO"
] | [((231, 241), 'io.StringIO', 'StringIO', ([], {}), '()\n', (239, 241), False, 'from io import StringIO\n')] |
#!/usr/bin/env python3
# ################################################################################
# edited WHS, OJ , 7.1.2022 #
import cv2
print(cv2.__version__)
# lese Bild von Festplatte
image = cv2.imread('/home/oj/catkin_ws/src/rtc/scripts/open_cv/test.png')
# lese Farbwerte an Position y, x
y = 100
x = ... | [
"cv2.waitKey",
"cv2.imread",
"cv2.imshow"
] | [((207, 272), 'cv2.imread', 'cv2.imread', (['"""/home/oj/catkin_ws/src/rtc/scripts/open_cv/test.png"""'], {}), "('/home/oj/catkin_ws/src/rtc/scripts/open_cv/test.png')\n", (217, 272), False, 'import cv2\n'), ((525, 550), 'cv2.imshow', 'cv2.imshow', (['"""Bild"""', 'image'], {}), "('Bild', image)\n", (535, 550), False, ... |
import math
import torch
import torch.nn as nn
from torch.nn.init import xavier_uniform_
from transformers import PositionalEncoding, RelativeCoordinateEncoding
Tensor = torch.Tensor
class TransformerModel(nn.Module):
"""
Transformer baseclass.
"""
def __init__(
self,
d_model: int,
... | [
"torch.nn.Sigmoid",
"torch.nn.Dropout",
"torch.nn.init.xavier_uniform_",
"torch.stack",
"math.sqrt",
"torch.zeros_like",
"torch.cat",
"torch.nn.Linear",
"torch.no_grad",
"transformers.PositionalEncoding",
"transformers.RelativeCoordinateEncoding",
"torch.empty",
"torch.zeros",
"torch.arang... | [((851, 946), 'transformers.PositionalEncoding', 'PositionalEncoding', ([], {'encoding_type': '"""absolute"""', 'd_model': 'd_model', 'max_len': 'max_sequence_length'}), "(encoding_type='absolute', d_model=d_model, max_len=\n max_sequence_length)\n", (869, 946), False, 'from transformers import PositionalEncoding, R... |
from scipy.stats import normaltest
import matplotlib.pyplot as plt
from scipy.stats import beta
import statistics
def show_hist(x):
plt.hist(x, 50, density=True, facecolor="b", alpha=0.5)
plt . title("Histograma")
plt.show()
def normal_test(x, var):
sig = 0.05
stat_test, p_value = normaltest(x)... | [
"statistics.mean",
"scipy.stats.beta.rvs",
"matplotlib.pyplot.hist",
"statistics.median",
"scipy.stats.normaltest",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((432, 457), 'scipy.stats.beta.rvs', 'beta.rvs', (['(2)', '(8)'], {'size': '(1000)'}), '(2, 8, size=1000)\n', (440, 457), False, 'from scipy.stats import beta\n'), ((463, 490), 'scipy.stats.beta.rvs', 'beta.rvs', (['(2)', '(0.8)'], {'size': '(1000)'}), '(2, 0.8, size=1000)\n', (471, 490), False, 'from scipy.stats impo... |
"""Config flow tests."""
import requests
from zoneminder.zm import ZoneMinder
from homeassistant import config_entries
from homeassistant.components.zoneminder import ClientAvailabilityResult, const
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_PATH,
CONF_SOURCE,
CONF_SSL,
CO... | [
"requests.exceptions.ConnectionError",
"tests.async_mock.MagicMock",
"tests.async_mock.patch"
] | [((558, 646), 'tests.async_mock.patch', 'patch', (['"""homeassistant.components.zoneminder.common.ZoneMinder"""'], {'autospec': 'ZoneMinder'}), "('homeassistant.components.zoneminder.common.ZoneMinder', autospec=\n ZoneMinder)\n", (563, 646), False, 'from tests.async_mock import MagicMock, patch\n'), ((996, 1022), '... |
import youtube_dlc
import discord
import asyncio
import functools
from discord.ext import commands
youtube_dlc.utils.bug_reports_message = lambda: ''
class YTDLError(Exception):
pass
class YTDLSource(discord.PCMVolumeTransformer):
YTDL_OPTIONS = {
'format': 'bestaudio/best',
'extractaudio': T... | [
"asyncio.get_event_loop",
"youtube_dlc.YoutubeDL",
"functools.partial",
"discord.FFmpegPCMAudio"
] | [((929, 964), 'youtube_dlc.YoutubeDL', 'youtube_dlc.YoutubeDL', (['YTDL_OPTIONS'], {}), '(YTDL_OPTIONS)\n', (950, 964), False, 'import youtube_dlc\n'), ((2228, 2252), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (2250, 2252), False, 'import asyncio\n'), ((2344, 2414), 'functools.partial', 'func... |
# test ffi float support
import sys
try:
import ffi
except ImportError:
print("SKIP")
sys.exit()
def ffi_open(names):
err = None
for n in names:
try:
mod = ffi.open(n)
return mod
except OSError as e:
err = e
raise err
libm = ffi_open(('libm.... | [
"ffi.open",
"sys.exit"
] | [((98, 108), 'sys.exit', 'sys.exit', ([], {}), '()\n', (106, 108), False, 'import sys\n'), ((570, 580), 'sys.exit', 'sys.exit', ([], {}), '()\n', (578, 580), False, 'import sys\n'), ((198, 209), 'ffi.open', 'ffi.open', (['n'], {}), '(n)\n', (206, 209), False, 'import ffi\n')] |
'''
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, ... | [
"helpers.exceptions.InvalidConfiguration",
"pathlib.Path",
"re.search"
] | [((2290, 2357), 're.search', 're.search', (['non_applicable_rtype', 'resource_type'], {'flags': 're.IGNORECASE'}), '(non_applicable_rtype, resource_type, flags=re.IGNORECASE)\n', (2299, 2357), False, 'import re\n'), ((2863, 2898), 'helpers.exceptions.InvalidConfiguration', 'InvalidConfiguration', (['missing_types'], {}... |
import ctypes as ct
import numpy as np
import sharpy.utils.algebra as algebra
import sharpy.aero.utils.uvlmlib as uvlmlib
import sharpy.utils.cout_utils as cout
import sharpy.utils.settings as settings
from sharpy.utils.solver_interface import solver, BaseSolver
import sharpy.utils.generator_interface as gen_interface... | [
"sharpy.aero.utils.uvlmlib.vlm_solver",
"sharpy.utils.settings.SettingsTable",
"sharpy.utils.settings.to_custom_types",
"sharpy.utils.generator_interface.generator_from_string"
] | [((3769, 3793), 'sharpy.utils.settings.SettingsTable', 'settings.SettingsTable', ([], {}), '()\n', (3791, 3793), True, 'import sharpy.utils.settings as settings\n'), ((4271, 4359), 'sharpy.utils.settings.to_custom_types', 'settings.to_custom_types', (['self.settings', 'self.settings_types', 'self.settings_default'], {}... |
# Generated by Django 2.1.7 on 2019-03-26 08:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('count', '0007_wxuserstatistics_user_total'),
]
operations = [
migrations.AddField(
model_name='orderstatistics',
nam... | [
"django.db.models.DecimalField",
"django.db.models.PositiveIntegerField"
] | [((353, 416), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'default': '(0)', 'verbose_name': '"""扫码支付订单数量"""'}), "(default=0, verbose_name='扫码支付订单数量')\n", (380, 416), False, 'from django.db import migrations, models\n'), ((558, 652), 'django.db.models.DecimalField', 'models.DecimalField... |
###############################################################################
#
# file: ExamplePluginScreen.py
#
# Purpose: An attempt at the starwars asciimation
#
# Note: This file is part of Termsaver application, and should not be used
# or executed separately.
#
###############################... | [
"termsaverlib.i18n._",
"termsaverlib.i18n.set_app",
"time.sleep"
] | [((1485, 1519), 'termsaverlib.i18n.set_app', 'set_app', (['"""termsaver-exampleplugin"""'], {}), "('termsaver-exampleplugin')\n", (1492, 1519), False, 'from termsaverlib.i18n import _, set_app\n'), ((2051, 2064), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (2061, 2064), False, 'import time\n'), ((1781, 1804), '... |
import datetime
from typing import Tuple
from django.contrib.auth import get_user_model
from django.utils import timezone
from rest_framework import exceptions
import jwt
from decouple import config
User = get_user_model()
algorithm = 'HS256'
def get_token(payload: dict, secret: str) -> bytes:
access = jwt.e... | [
"jwt.decode",
"django.contrib.auth.get_user_model",
"rest_framework.exceptions.AuthenticationFailed",
"decouple.config",
"django.utils.timezone.now",
"datetime.timedelta",
"jwt.encode"
] | [((210, 226), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (224, 226), False, 'from django.contrib.auth import get_user_model\n'), ((315, 363), 'jwt.encode', 'jwt.encode', (['payload', 'secret'], {'algorithm': 'algorithm'}), '(payload, secret, algorithm=algorithm)\n', (325, 363), False, 'im... |