code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
# coding: utf-8
from bson.objectid import ObjectId
from datetime import datetime
from libra.models.user import User
from tornado.web import RequestHandler
class SessionHandler(RequestHandler):
def get(self, **kwargs):
fb_id = kwargs['fb_id']
user = User().find_one({'fb_id': fb_id})
if no... | [
"libra.models.user.User",
"datetime.datetime.now",
"bson.objectid.ObjectId"
] | [((347, 353), 'libra.models.user.User', 'User', ([], {}), '()\n', (351, 353), False, 'from libra.models.user import User\n'), ((377, 387), 'bson.objectid.ObjectId', 'ObjectId', ([], {}), '()\n', (385, 387), False, 'from bson.objectid import ObjectId\n'), ((448, 462), 'datetime.datetime.now', 'datetime.now', ([], {}), '... |
from faker import Faker
import factory
from factory import fuzzy
faker = Faker()
class Fuzzy(fuzzy.FuzzyInteger):
def __init__(self, low=None, high=None, *args, **kwargs):
super().__init__(low=self.low, high=self.high, *args, **kwargs)
def fuzz(self):
value = super().fuzz()
return st... | [
"factory.Faker",
"faker.Faker"
] | [((74, 81), 'faker.Faker', 'Faker', ([], {}), '()\n', (79, 81), False, 'from faker import Faker\n'), ((501, 521), 'factory.Faker', 'factory.Faker', (['"""job"""'], {}), "('job')\n", (514, 521), False, 'import factory\n'), ((532, 553), 'factory.Faker', 'factory.Faker', (['"""name"""'], {}), "('name')\n", (545, 553), Fal... |
from collections import namedtuple
Document = namedtuple("Document", ["url", "filename", "content", "tokfreq", "mtime"])
Result = namedtuple("Result", ["tok", "tfidf", "url"])
| [
"collections.namedtuple"
] | [((47, 121), 'collections.namedtuple', 'namedtuple', (['"""Document"""', "['url', 'filename', 'content', 'tokfreq', 'mtime']"], {}), "('Document', ['url', 'filename', 'content', 'tokfreq', 'mtime'])\n", (57, 121), False, 'from collections import namedtuple\n'), ((133, 178), 'collections.namedtuple', 'namedtuple', (['""... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"azure.cli.core.extension.extension_exists",
"azure.cli.command_modules.iot._params.load_arguments",
"azure.cli.core.commands.CliCommandType",
"azure.cli.command_modules.iot.commands.load_command_table",
"knack.log.get_logger"
] | [((1411, 1484), 'azure.cli.core.commands.CliCommandType', 'CliCommandType', ([], {'operations_tmpl': '"""azure.cli.command_modules.iot.custom#{}"""'}), "(operations_tmpl='azure.cli.command_modules.iot.custom#{}')\n", (1425, 1484), False, 'from azure.cli.core.commands import CliCommandType\n'), ((1910, 1940), 'azure.cli... |
import logging
import pytest
import easytrakt
from easytrakt import Client
easytrakt.logger.addHandler(logging.StreamHandler())
easytrakt.logger.setLevel(logging.DEBUG)
@pytest.yield_fixture
def client():
yield Client()
@pytest.yield_fixture
def user_data():
yield {
"user": {
"usernam... | [
"easytrakt.logger.setLevel",
"easytrakt.Client",
"logging.StreamHandler"
] | [((131, 171), 'easytrakt.logger.setLevel', 'easytrakt.logger.setLevel', (['logging.DEBUG'], {}), '(logging.DEBUG)\n', (156, 171), False, 'import easytrakt\n'), ((106, 129), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (127, 129), False, 'import logging\n'), ((220, 228), 'easytrakt.Client', 'Clien... |
import bokeh.layouts as bkhlayouts
import bokeh.io as bkhio
import bokeh.models as bkhmodels
import bokeh.models.widgets as bkhwidgets
import pandas as pd
def main() -> None:
df = pd.read_csv("../_data/iris.csv")
# データソースの初期設定
source = bkhmodels.ColumnDataSource(df)
# データ表示データテーブル
... | [
"bokeh.models.ColumnDataSource",
"pandas.read_csv",
"bokeh.io.curdoc",
"bokeh.layouts.column",
"bokeh.models.widgets.TableColumn"
] | [((194, 226), 'pandas.read_csv', 'pd.read_csv', (['"""../_data/iris.csv"""'], {}), "('../_data/iris.csv')\n", (205, 226), True, 'import pandas as pd\n'), ((262, 292), 'bokeh.models.ColumnDataSource', 'bkhmodels.ColumnDataSource', (['df'], {}), '(df)\n', (288, 292), True, 'import bokeh.models as bkhmodels\n'), ((562, 61... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import logging
import time
import json
import traceback
import pickle
from typing import List, Optional, Dict, Union, Any, Set
from io import BufferedIOBase
from pathlib import Path
from datetime import datetime, timedelta
from glob import glob
from urllib.parse ... | [
"pytaxonomies.Taxonomies",
"logging.getLogger",
"pathlib.Path",
"publicsuffix2.fetch",
"pickle.load",
"glob.glob",
"urllib.parse.urlparse",
"publicsuffix2.PublicSuffixList",
"redis.Redis",
"traceback.print_exc",
"json.loads",
"datetime.timedelta",
"datetime.datetime.now",
"json.dump",
"t... | [((866, 905), 'logging.getLogger', 'logging.getLogger', (['"""Lookyloo - Helpers"""'], {}), "('Lookyloo - Helpers')\n", (883, 905), False, 'import logging\n'), ((1863, 1876), 'functools.lru_cache', 'lru_cache', (['(64)'], {}), '(64)\n', (1872, 1876), False, 'from functools import lru_cache\n'), ((1926, 1939), 'functool... |
import plistlib
import pandas as pd
from utils import int_reader
df = pd.read_csv("/Volumes/WD_BLACK/ressources/files/materiel.csv", delimiter=",")
df.set_index(["label"], inplace=True)
root = {}
df["description"]=df["description"].astype(str)
print(df["description"])
for key in df.index:
label, description, url =... | [
"pandas.read_csv",
"plistlib.dump"
] | [((71, 148), 'pandas.read_csv', 'pd.read_csv', (['"""/Volumes/WD_BLACK/ressources/files/materiel.csv"""'], {'delimiter': '""","""'}), "('/Volumes/WD_BLACK/ressources/files/materiel.csv', delimiter=',')\n", (82, 148), True, 'import pandas as pd\n'), ((915, 938), 'plistlib.dump', 'plistlib.dump', (['root', 'fp'], {}), '(... |
import asyncio
import discord
from discord.ext import commands
import config
from helpers.checks import check_if_staff
class ModReact:
def __init__(self, bot):
self.bot = bot
@commands.guild_only()
@commands.check(check_if_staff)
@commands.command()
async def clearreactsbyuser(self, ctx, ... | [
"discord.ext.commands.guild_only",
"asyncio.gather",
"discord.ext.commands.check",
"discord.ext.commands.command"
] | [((195, 216), 'discord.ext.commands.guild_only', 'commands.guild_only', ([], {}), '()\n', (214, 216), False, 'from discord.ext import commands\n'), ((222, 252), 'discord.ext.commands.check', 'commands.check', (['check_if_staff'], {}), '(check_if_staff)\n', (236, 252), False, 'from discord.ext import commands\n'), ((258... |
import os
import resources
KDE_ENABLED = os.getenv("KDE_FULL_SESSION")
GNOME_ENABLED = os.getenv("GNOME_DESKTOP_SESSION_ID")
if KDE_ENABLED:
from .mainframe import KSnakefire as Snakefire
elif GNOME_ENABLED:
from .mainframe import GSnakefire as Snakefire
else:
from .mainframe import QSnakefire as Snakefire
| [
"os.getenv"
] | [((42, 71), 'os.getenv', 'os.getenv', (['"""KDE_FULL_SESSION"""'], {}), "('KDE_FULL_SESSION')\n", (51, 71), False, 'import os\n'), ((88, 125), 'os.getenv', 'os.getenv', (['"""GNOME_DESKTOP_SESSION_ID"""'], {}), "('GNOME_DESKTOP_SESSION_ID')\n", (97, 125), False, 'import os\n')] |
from imgurpython import ImgurClient
from dotenv import load_dotenv
import os
class ImgurClientWrapper:
def __init__(self, credentials=None) -> None:
load_dotenv()
self.client_id = os.getenv("IMGUR_CLIENT_ID")
self.client_secret = os.getenv("IMGUR_CLIENT_SECRET")
if not all((self.c... | [
"dotenv.load_dotenv",
"imgurpython.ImgurClient",
"os.getenv"
] | [((163, 176), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (174, 176), False, 'from dotenv import load_dotenv\n'), ((202, 230), 'os.getenv', 'os.getenv', (['"""IMGUR_CLIENT_ID"""'], {}), "('IMGUR_CLIENT_ID')\n", (211, 230), False, 'import os\n'), ((260, 292), 'os.getenv', 'os.getenv', (['"""IMGUR_CLIENT_SECRE... |
# Copyright (c) Code Written and Tested by <NAME> in 28/02/2020, 16:53
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('core.urls'), name='core')
]
| [
"django.urls.path",
"django.urls.include"
] | [((166, 197), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (170, 197), False, 'from django.urls import path, include\n'), ((212, 232), 'django.urls.include', 'include', (['"""core.urls"""'], {}), "('core.urls')\n", (219, 232), False, 'from django.urls import pa... |
"""
****************************************************************************************************
:copyright (c) 2019-2021 URBANopt, Alliance for Sustainable Energy, LLC, and other contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
... | [
"click.echo",
"click.argument",
"requests.get",
"click.command"
] | [((2239, 2254), 'click.command', 'click.command', ([], {}), '()\n', (2252, 2254), False, 'import click\n'), ((2256, 2296), 'click.argument', 'click.argument', (['"""schema"""'], {'required': '(False)'}), "('schema', required=False)\n", (2270, 2296), False, 'import click\n'), ((2365, 2403), 'click.echo', 'click.echo', (... |
"""
Uses VTK python to allow for postprocessing FEAs associated with the
contour method. Full interaction requires a 3-button mouse and keyboard.
-------------------------------------------------------------------------------
Current mapping is as follows:
LMB - rotate about point cloud centroid.
MMB - pan
RMB - ... | [
"PyQt5.QtWidgets.QSizePolicy",
"vtk.vtkPoints",
"scipy.io.loadmat",
"PyQt5.QtWidgets.QGridLayout",
"vtk.vtkExtractEdges",
"PyQt5.QtWidgets.QPushButton",
"pkg_resources.resource_filename",
"vtk.vtkTextProperty",
"numpy.shape",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QApplication",
"PyQt... | [((1285, 1318), 'PyQt5.QtWidgets.QApplication.instance', 'QtWidgets.QApplication.instance', ([], {}), '()\n', (1316, 1318), False, 'from PyQt5 import QtGui, QtWidgets, QtCore\n'), ((1389, 1436), 'pkg_resources.resource_filename', 'resource_filename', (['"""pyCM"""', '"""meta/pyCM_logo.png"""'], {}), "('pyCM', 'meta/pyC... |
from rest_framework import permissions
from guardian.shortcuts import get_user_perms
from accounts.models import User
class IsProjectManagementOffice(permissions.BasePermission):
def has_permission(self, request, view):
# Write permissions are only allowed to the PMO
return request.user.is_authent... | [
"guardian.shortcuts.get_user_perms",
"accounts.models.User.objects.get"
] | [((2248, 2285), 'guardian.shortcuts.get_user_perms', 'get_user_perms', (['request.user', 'project'], {}), '(request.user, project)\n', (2262, 2285), False, 'from guardian.shortcuts import get_user_perms\n'), ((2662, 2699), 'guardian.shortcuts.get_user_perms', 'get_user_perms', (['request.user', 'project'], {}), '(reque... |
# <NAME>, <EMAIL>
# MSNE Research Internship Hybrid BCI
# 27.03.2018
# based on: record_data_liveEMG.py and record_data_liveEEG.py to allow live processing and classification of EEG with a CNN
# record_data_liveEEG.py by: <NAME>, <EMAIL>
# function record_and_process() based on realtime.py by whoever
# function... | [
"keras.models.load_model",
"real_time_copy.print_version_info",
"ringbuffer.RingBuffer",
"os.path.join",
"pylsl.local_clock",
"win32api.SetConsoleCtrlHandler",
"pylsl.StreamInfo",
"os.path.exists",
"pylsl.resolve_stream",
"threading.Event",
"threading.Thread",
"live_processing.np_to_tn",
"ma... | [((1048, 1090), 'win32api.SetConsoleCtrlHandler', 'win32api.SetConsoleCtrlHandler', (['handler', '(1)'], {}), '(handler, 1)\n', (1078, 1090), False, 'import win32api\n'), ((2256, 2291), 'pylsl.resolve_stream', 'pylsl.resolve_stream', (['"""type"""', '"""EEG"""'], {}), "('type', 'EEG')\n", (2276, 2291), False, 'import p... |
# Copyright (C) 2012 Ion Torrent Systems, Inc. All Rights Reserved
import os
from time import strftime
def create_summary_block(SUMMARY_BLOCK,dr,MINIMUM_RSQUARED):
#in the case where the plugin is run more than once, the summary block will be cached by the browser
#and not refreshed if it is named simply "summary... | [
"time.strftime"
] | [((989, 1018), 'time.strftime', 'strftime', (['"""%Y-%m-%d_%H-%M-%S"""'], {}), "('%Y-%m-%d_%H-%M-%S')\n", (997, 1018), False, 'from time import strftime\n')] |
import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import linear_kernel
def find_similar_user(user_id, df_reviews, user_id_colname, dot_prod_user):
user_idx = np.where(df_reviews[user_id_colname] == user_id)[0][0]
similar_id = np.where(do... | [
"numpy.max",
"numpy.where",
"numpy.array",
"sklearn.metrics.pairwise.linear_kernel"
] | [((683, 724), 'sklearn.metrics.pairwise.linear_kernel', 'linear_kernel', (['tfidf_matrix', 'tfidf_matrix'], {}), '(tfidf_matrix, tfidf_matrix)\n', (696, 724), False, 'from sklearn.metrics.pairwise import linear_kernel\n'), ((404, 459), 'numpy.array', 'np.array', (['df_reviews.iloc[similar_id,][user_id_colname]'], {}), ... |
# Copyright (c) 2018, salesforce.com, inc.
# All rights reserved.
# Licensed under the BSD 3-Clause license.
# For full license text, see the LICENSE file in the repo root
# or https://opensource.org/licenses/BSD-3-Clause
import torch
from torch.nn import functional as F
from matchbox import MaskedBatch
from matchbox... | [
"matchbox.MaskedBatch",
"torch.nn.functional.dropout",
"torch.nn.functional.cross_entropy",
"torch.nn.functional.linear",
"torch.nn.functional.softmax",
"torch.nn.functional.embedding"
] | [((530, 573), 'torch.nn.functional.dropout', 'F.dropout', (['batch.data', 'p', 'training', 'inplace'], {}), '(batch.data, p, training, inplace)\n', (539, 573), True, 'from torch.nn import functional as F\n'), ((585, 626), 'matchbox.MaskedBatch', 'MaskedBatch', (['data', 'batch.mask', 'batch.dims'], {}), '(data, batch.m... |
import os
from . import constants
from . import convertor
from . import downloader
from . import validator
from .exceptions import DownloadError
AUDIO_FILE_EXTENSION = '.mp3'
def _get_audio_filename(download, file_path):
"""Gets the new filename and extension for the audio version of the video.
We want to r... | [
"os.path.splitext",
"os.path.basename"
] | [((2319, 2351), 'os.path.basename', 'os.path.basename', (['final_filepath'], {}), '(final_filepath)\n', (2335, 2351), False, 'import os\n'), ((750, 777), 'os.path.splitext', 'os.path.splitext', (['file_path'], {}), '(file_path)\n', (766, 777), False, 'import os\n'), ((2367, 2393), 'os.path.splitext', 'os.path.splitext'... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import unittest as ut
import stripeline.quaternions as q
import numpy as np
class TestOperations(ut.TestCase):
def test_addition(self):
'Check that the quaternion addition is implemented correctly'
q1 = np.array([[1.0, 2.0, 3.0, 4.0],
... | [
"stripeline.quaternions.qnorm",
"stripeline.quaternions.qfromaxisangle",
"numpy.allclose",
"stripeline.quaternions.qadd",
"stripeline.quaternions.qrotate",
"stripeline.quaternions.qinvrot",
"numpy.array",
"stripeline.quaternions.qdot",
"stripeline.quaternions.qtoaxisangle",
"stripeline.quaternions... | [((278, 357), 'numpy.array', 'np.array', (['[[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0], [9.0, 10.0, 11.0, 12.0]]'], {}), '([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0], [9.0, 10.0, 11.0, 12.0]])\n', (286, 357), True, 'import numpy as np\n'), ((423, 500), 'numpy.array', 'np.array', (['[[4.0, 3.0, 6.0, 1.0], [9.0, 5.0, 1... |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | [
"nova.db.sqlalchemy.models.AgentBuild"
] | [((1405, 1424), 'nova.db.sqlalchemy.models.AgentBuild', 'models.AgentBuild', ([], {}), '()\n', (1422, 1424), False, 'from nova.db.sqlalchemy import models\n'), ((1771, 1790), 'nova.db.sqlalchemy.models.AgentBuild', 'models.AgentBuild', ([], {}), '()\n', (1788, 1790), False, 'from nova.db.sqlalchemy import models\n')] |
import asyncio
import aiohttp
import discord
import io
import chat_exporter
from discord.ext import commands
from cogs.utils import hypixel
class Tickets(commands.Cog, name="Tickets"):
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=['reg', 'verify'])
async def register(self, ... | [
"discord.utils.get",
"cogs.utils.hypixel.get_gtag",
"discord.ext.commands.command",
"discord.Embed",
"asyncio.sleep",
"discord.TextChannel.delete",
"discord.ext.commands.has_any_role",
"aiohttp.ClientSession",
"cogs.utils.hypixel.get_guild",
"cogs.utils.hypixel.name_grabber",
"chat_exporter.expo... | [((247, 290), 'discord.ext.commands.command', 'commands.command', ([], {'aliases': "['reg', 'verify']"}), "(aliases=['reg', 'verify'])\n", (263, 290), False, 'from discord.ext import commands\n'), ((8520, 8553), 'discord.ext.commands.command', 'commands.command', ([], {'aliases': "['del']"}), "(aliases=['del'])\n", (85... |
#!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2013 Riverbank Computing Limited.
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
##
## $QT_BEGIN_LICENS... | [
"PyQt5.QtGui.QPainter",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QMessageBox.about",
"PyQt5.QtPrintSupport.QPrinter",
"PyQt5.QtGui.QPixmap.fromImage",
"PyQt5.QtWidgets.QMenu",
"PyQt5.QtPrintSupport.QPrintDialog",
"PyQt5.QtWidgets.QScrollArea",
"PyQt5.QtGui.QImage",
"PyQt5.QtWidgets.QApplication"... | [((8492, 8514), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (8504, 8514), False, 'from PyQt5.QtWidgets import QAction, QApplication, QFileDialog, QLabel, QMainWindow, QMenu, QMessageBox, QScrollArea, QSizePolicy\n'), ((2474, 2484), 'PyQt5.QtPrintSupport.QPrinter', 'QPrinter', ([]... |
# Copyright 2014 Mirantis, 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 ... | [
"nailgun.db.db"
] | [((3024, 3028), 'nailgun.db.db', 'db', ([], {}), '()\n', (3026, 3028), False, 'from nailgun.db import db\n')] |
from pyfakefs.fake_filesystem_unittest import TestCase
from src.utils import parse_args, DIRECTORY_PARAMETER_VALID_KEYS, PREFIX_PARAMETER_VALID_KEYS,\
DRY_RUN_PARAMETER_VALID_KEYS
from os import path
class TestUtils(TestCase):
@classmethod
def setUpClass(cls):
cls.prefix_name = "wheel_of_fortune"
... | [
"src.utils.parse_args",
"os.path.join",
"os.path.realpath"
] | [((526, 582), 'os.path.join', 'path.join', (['path.sep', 'cls.non_default_directory_component'], {}), '(path.sep, cls.non_default_directory_component)\n', (535, 582), False, 'from os import path\n'), ((1345, 1402), 'src.utils.parse_args', 'parse_args', (['[self.prefix_parameter_key, self.prefix_name]'], {}), '([self.pr... |
import numpy as np
def render(alpha,beta,s,X,Y,Z,n_s,lvectors,is_train=False):
n=np.concatenate((X[np.newaxis,:,:],Y[np.newaxis,:,:],Z[np.newaxis,:,:]),axis=0)
X_m=-2*X*Y
Y_m=-2*Y*Z
Z_m=-np.square(Z)+np.square(X)+np.square(Y)
v=np.concatenate((X_m[np.newaxis,:,:],Y_m[np.newaxis,:,:],Z_m[np... | [
"numpy.power",
"numpy.square",
"numpy.einsum",
"numpy.squeeze",
"numpy.concatenate"
] | [((91, 182), 'numpy.concatenate', 'np.concatenate', (['(X[np.newaxis, :, :], Y[np.newaxis, :, :], Z[np.newaxis, :, :])'], {'axis': '(0)'}), '((X[np.newaxis, :, :], Y[np.newaxis, :, :], Z[np.newaxis, :,\n :]), axis=0)\n', (105, 182), True, 'import numpy as np\n'), ((258, 356), 'numpy.concatenate', 'np.concatenate', (... |
from __future__ import print_function
import sys
from PyQt4 import QtGui, QtScript
from PyQt4 import QtCore
app = QtGui.QApplication(sys.argv)
from qtreactor import pyqt4reactor
pyqt4reactor.install()
from twisted.internet import reactor, task
class DoNothing(object):
def __init__(self):
self.count ... | [
"twisted.internet.task.LoopingCall",
"PyQt4.QtGui.QApplication",
"PyQt4.QtGui.QPushButton",
"PyQt4.QtScript.QScriptEngine",
"twisted.internet.reactor.run",
"twisted.internet.reactor.stop",
"qtreactor.pyqt4reactor.install",
"PyQt4.QtCore.SIGNAL"
] | [((117, 145), 'PyQt4.QtGui.QApplication', 'QtGui.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (135, 145), False, 'from PyQt4 import QtGui, QtScript\n'), ((183, 205), 'qtreactor.pyqt4reactor.install', 'pyqt4reactor.install', ([], {}), '()\n', (203, 205), False, 'from qtreactor import pyqt4reactor\n'), ((869, 893),... |
""" Analyze libraries in trees
Analyze library dependencies in paths and wheel files
"""
import logging
import os
import sys
import warnings
from os.path import basename, dirname
from os.path import join as pjoin
from os.path import realpath
from typing import (
Callable,
Dict,
Iterable,
Iterator,
... | [
"os.path.basename",
"os.path.realpath",
"os.walk",
"os.path.dirname",
"os.path.exists",
"os.environ.get",
"os.path.isfile",
"warnings.warn",
"os.path.join",
"logging.getLogger"
] | [((563, 590), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (580, 590), False, 'import logging\n'), ((8070, 8088), 'os.walk', 'os.walk', (['root_path'], {}), '(root_path)\n', (8077, 8088), False, 'import os\n'), ((15688, 15807), 'warnings.warn', 'warnings.warn', (['"""tree_libs doesn\'t ... |
"""Setup for aiohue."""
from setuptools import find_packages, setup
LONG_DESC = open("README.md").read()
PACKAGES = find_packages(exclude=["tests", "tests.*"])
REQUIREMENTS = list(val.strip() for val in open("requirements.txt"))
MIN_PY_VERSION = "3.8"
setup(
name="aiohue",
version="3.0.3",
license="Apache... | [
"setuptools.setup",
"setuptools.find_packages"
] | [((117, 160), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests', 'tests.*']"}), "(exclude=['tests', 'tests.*'])\n", (130, 160), False, 'from setuptools import find_packages, setup\n'), ((254, 927), 'setuptools.setup', 'setup', ([], {'name': '"""aiohue"""', 'version': '"""3.0.3"""', 'license': '"""... |
from typing import Any, Callable, Iterable, List, Optional, Tuple, Union
import eth_retry
from eth_typing import Address, ChecksumAddress, HexAddress
from eth_typing.abi import Decodable
from eth_utils import to_checksum_address
from web3 import Web3
from multicall import Signature
from multicall.constants import Net... | [
"eth_utils.to_checksum_address",
"multicall.loggers.setup_logger",
"multicall.Signature",
"multicall.utils.get_async_w3",
"multicall.utils.state_override_supported",
"multicall.utils.chain_id",
"multicall.utils.run_in_subprocess"
] | [((568, 590), 'multicall.loggers.setup_logger', 'setup_logger', (['__name__'], {}), '(__name__)\n', (580, 590), False, 'from multicall.loggers import setup_logger\n'), ((1191, 1218), 'eth_utils.to_checksum_address', 'to_checksum_address', (['target'], {}), '(target)\n', (1210, 1218), False, 'from eth_utils import to_ch... |
import unittest
import mock
from bitbucket import request_access_token, BitbucketException
from concourse import print_error
class RequestAccessTokenTestCase(unittest.TestCase):
def test_fails_ok(self):
with mock.patch('bitbucket.requests') as requests:
r = mock.MagicMock()
r.sta... | [
"mock.MagicMock",
"mock.patch",
"bitbucket.request_access_token"
] | [((224, 256), 'mock.patch', 'mock.patch', (['"""bitbucket.requests"""'], {}), "('bitbucket.requests')\n", (234, 256), False, 'import mock\n'), ((286, 302), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (300, 302), False, 'import mock\n'), ((577, 609), 'mock.patch', 'mock.patch', (['"""bitbucket.requests"""'], {... |
#!/usr/bin/env python3
from setuptools import setup
setup(
name='downloader',
version='1.0',
description="Downloads a file or space/comma separated list of files from URL/s. Supports \"http://\", \"https://\" and \"s3://\"",
url='https://github.com/code4ops/http-s3-downloader',
python_requires='>... | [
"setuptools.setup"
] | [((55, 532), 'setuptools.setup', 'setup', ([], {'name': '"""downloader"""', 'version': '"""1.0"""', 'description': '"""Downloads a file or space/comma separated list of files from URL/s. Supports "http://", "https://" and "s3://\\""""', 'url': '"""https://github.com/code4ops/http-s3-downloader"""', 'python_requires': '... |
import discord
from discord.ext import commands
from core.classes import *
import yaml
infractions_of_a_member = None
def get_guild_infractions(guild_id):
with open(f'infractions/{guild_id}_infractions.yaml', 'r') as inf:
accessor = yaml.safe_load(inf)
return accessor
class Infractions(CategoryE... | [
"discord.ext.commands.has_permissions",
"yaml.dump",
"discord.ext.commands.command",
"yaml.safe_load"
] | [((337, 355), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (353, 355), False, 'from discord.ext import commands\n'), ((361, 404), 'discord.ext.commands.has_permissions', 'commands.has_permissions', ([], {'manage_guild': '(True)'}), '(manage_guild=True)\n', (385, 404), False, 'from discord.ext i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
requirements = [
'jsonschema==2.6.0',
'requests==2.22.0',
'rfc3987==1.3.7', # For 'uri' format validation in jsonschema
'supervisor==3.3.1',
'PyYAML==5.1.1',
'wheel',
'multitail2',
]
test_requiremen... | [
"setuptools.find_packages"
] | [((751, 766), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (764, 766), False, 'from setuptools import setup, find_packages\n')] |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import json
from profile_chrome import controllers_unittest
from profile_chrome import perf_controller
from profile_chrome import ui
from pylib i... | [
"profile_chrome.perf_controller.PerfProfilerController.GetCategories",
"os.remove",
"profile_chrome.perf_controller.PerfProfilerController.IsSupported",
"os.path.exists",
"profile_chrome.ui.EnableTestMode",
"os.path.join",
"profile_chrome.perf_controller.PerfProfilerController"
] | [((549, 614), 'profile_chrome.perf_controller.PerfProfilerController.GetCategories', 'perf_controller.PerfProfilerController.GetCategories', (['self.device'], {}), '(self.device)\n', (601, 614), False, 'from profile_chrome import perf_controller\n'), ((767, 786), 'profile_chrome.ui.EnableTestMode', 'ui.EnableTestMode',... |
#
# Copyright 2020 Picovoice Inc.
#
# You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
# file accompanying this source.
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
# an "AS IS" B... | [
"sys.stdout.write",
"gpiozero.LED",
"pyaudio.PyAudio",
"struct.unpack_from"
] | [((1166, 1172), 'gpiozero.LED', 'LED', (['(5)'], {}), '(5)\n', (1169, 1172), False, 'from gpiozero import LED\n'), ((1728, 1745), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (1743, 1745), False, 'import pyaudio\n'), ((2148, 2207), 'struct.unpack_from', 'struct.unpack_from', (["('h' * self._porcupine.frame_l... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
from lab.environments import LocalEnvironment, BaselSlurmEnvironment
import common_setup
from common_setup import IssueConfig, IssueExperiment
from relativescatter import RelativeScatterPlotReport
DIR = os.path.dirname(os.path.abspath(__file__))
BENCHMARKS_DI... | [
"os.path.abspath",
"lab.environments.LocalEnvironment",
"common_setup.IssueConfig",
"lab.environments.BaselSlurmEnvironment",
"common_setup.IssueExperiment",
"common_setup.is_test_run"
] | [((1825, 1903), 'lab.environments.BaselSlurmEnvironment', 'BaselSlurmEnvironment', ([], {'email': '"""<EMAIL>"""', 'export': "['PATH', 'DOWNWARD_BENCHMARKS']"}), "(email='<EMAIL>', export=['PATH', 'DOWNWARD_BENCHMARKS'])\n", (1846, 1903), False, 'from lab.environments import LocalEnvironment, BaselSlurmEnvironment\n'),... |
import imageio
import numpy as np
import cv2
def get_landmarks_from_file(filename, start_row=0, start_col=0):
with open(filename) as f:
lines = f.readlines()
landmarks_style = np.zeros((lines.__len__()-start_row, lines[start_row].split().__len__()-start_col))
for i, line in enumerate(lines... | [
"numpy.ones_like",
"imageio.imread",
"numpy.float32",
"numpy.array",
"cv2.getAffineTransform",
"numpy.matmul",
"imageio.imwrite"
] | [((759, 801), 'numpy.float32', 'np.float32', (['small_content[[17, 26, 30], :]'], {}), '(small_content[[17, 26, 30], :])\n', (769, 801), True, 'import numpy as np\n'), ((825, 865), 'numpy.float32', 'np.float32', (['big_content[[17, 26, 30], :]'], {}), '(big_content[[17, 26, 30], :])\n', (835, 865), True, 'import numpy ... |
# coding=utf-8
from projecta11 import db
from projecta11.handlers.base import BaseHandler
from projecta11.routers import handling
from projecta11.utils import require_session, parse_json_body, keys_filter, \
role_in
@handling(r"/course/(\d+)/classes")
class ClassesListHandler(BaseHandler):
def get(self, cours... | [
"projecta11.routers.handling",
"projecta11.utils.role_in",
"projecta11.utils.keys_filter",
"projecta11.db.RelationUserClass",
"projecta11.db.Class"
] | [((223, 257), 'projecta11.routers.handling', 'handling', (['"""/course/(\\\\d+)/classes"""'], {}), "('/course/(\\\\d+)/classes')\n", (231, 257), False, 'from projecta11.routers import handling\n'), ((894, 912), 'projecta11.routers.handling', 'handling', (['"""/class"""'], {}), "('/class')\n", (902, 912), False, 'from p... |
"""Test suite for the TensorFlow `Network` implementation.
"""
# standard imports
from unittest import TestCase, skipUnless
import os
# third-party imports
import numpy as np
# FIXME[old]: The following lines allow the test to be run from within
# the test directory (and provide the MODELS_DIRECTORY):
# if __package... | [
"dltb.thirdparty.tensorflow.tensorflow_version_available",
"keras.datasets.mnist.load_data",
"numpy.allclose",
"numpy.array",
"os.path.join"
] | [((769, 803), 'dltb.thirdparty.tensorflow.tensorflow_version_available', 'tensorflow_version_available', (['"""v1"""'], {}), "('v1')\n", (797, 803), False, 'from dltb.thirdparty.tensorflow import tensorflow_version_available\n'), ((1283, 1372), 'os.path.join', 'os.path.join', (['config.model_directory', '"""example_tf_... |
import pandas as pd
import json
from time import sleep
from datetime import datetime
from selenium.common.exceptions import NoSuchElementException
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from fake_useragent import UserAgent
from webdriver_manager.chrome import ChromeDriverM... | [
"datetime.datetime.today"
] | [((542, 558), 'datetime.datetime.today', 'datetime.today', ([], {}), '()\n', (556, 558), False, 'from datetime import datetime\n')] |
#!/usr/bin/env python3
"""Generate a table of predicted probabilities for SWIRE objects.
<NAME> <<EMAIL>>
Research School of Astronomy and Astrophysics
The Australian National University
2017
"""
import collections
import itertools
import astropy.table
import numpy
import pipeline
def print_table(field='cdfs'):
... | [
"collections.defaultdict",
"pipeline.generate_data_sets",
"numpy.array",
"pipeline.generate_swire_features",
"pipeline.generate_swire_labels"
] | [((1497, 1559), 'pipeline.generate_swire_features', 'pipeline.generate_swire_features', ([], {'overwrite': '(False)', 'field': 'field'}), '(overwrite=False, field=field)\n', (1529, 1559), False, 'import pipeline\n'), ((1579, 1670), 'pipeline.generate_swire_labels', 'pipeline.generate_swire_labels', (['swire_names', 'sw... |
import numpy as np
from scipy.spatial.distance import cdist
metrics = {}
def pairdist(ann1, ann2, which):
"""
Compute the pairwise euclidean distance between
the contour boundary points, and return the
minimum, maximum, or average value.
which: str
One of 'min', 'max', or 'avg'.
"""... | [
"scipy.spatial.distance.cdist",
"numpy.linalg.norm",
"numpy.unique"
] | [((333, 382), 'scipy.spatial.distance.cdist', 'cdist', (['ann1.contours_matrix', 'ann2.contours_matrix'], {}), '(ann1.contours_matrix, ann2.contours_matrix)\n', (338, 382), False, 'from scipy.spatial.distance import cdist\n'), ((2371, 2420), 'scipy.spatial.distance.cdist', 'cdist', (['ann1.contours_matrix', 'ann2.conto... |
import pytest
import pizdyuk.pzd_errors as errors
from pizdyuk.market.core import MarketObjectBase, Action
def test_market_object_base():
object_base = MarketObjectBase()
with pytest.raises(Exception) as e:
object_base.update()
assert isinstance(e, errors.PzdNotImplementedError)
with pyte... | [
"pytest.raises",
"pizdyuk.market.core.Action",
"pizdyuk.market.core.MarketObjectBase"
] | [((157, 175), 'pizdyuk.market.core.MarketObjectBase', 'MarketObjectBase', ([], {}), '()\n', (173, 175), False, 'from pizdyuk.market.core import MarketObjectBase, Action\n'), ((509, 544), 'pizdyuk.market.core.Action', 'Action', (['mock.function', '"""mock_value"""'], {}), "(mock.function, 'mock_value')\n", (515, 544), F... |
import os
import shutil
import ai_flow as af
import numpy as np
import pandas as pd
import tensorflow as tf
from ai_flow import FunctionContext, List, ExampleMeta, register_model_version, ModelMeta
from python_ai_flow.user_define_funcs import Executor
from tensorflow.keras import Input
from tensorflow.keras.layers imp... | [
"os.path.abspath",
"tensorflow.keras.layers.Dense",
"pandas.read_csv",
"tensorflow.keras.Input",
"os.path.exists",
"tensorflow.keras.models.Model",
"ai_flow.register_model_version",
"numpy.array",
"tensorflow.keras.backend.get_session",
"ai_flow.get_example_by_name",
"tensorflow.keras.optimizers... | [((626, 696), 'pandas.read_csv', 'pd.read_csv', (['example_meta.batch_uri'], {'sep': '""";"""', 'header': 'None', 'usecols': '[3]'}), "(example_meta.batch_uri, sep=';', header=None, usecols=[3])\n", (637, 696), True, 'import pandas as pd\n'), ((961, 973), 'numpy.array', 'np.array', (['xx'], {}), '(xx)\n', (969, 973), T... |
from typing import TYPE_CHECKING, Any, Dict, Optional, cast
from cx_core.action_type.base import ActionType
from cx_core.integration import EventData
if TYPE_CHECKING:
from cx_core.type_controller import Entity, TypeController
class CallServiceActionType(ActionType):
service: str
# Priority order for en... | [
"typing.cast"
] | [((864, 911), 'typing.cast', 'cast', (['"""TypeController[Entity]"""', 'self.controller'], {}), "('TypeController[Entity]', self.controller)\n", (868, 911), False, 'from typing import TYPE_CHECKING, Any, Dict, Optional, cast\n')] |
from taskpacker import (tasks_from_spreadsheet,
resources_from_spreadsheet,
schedule_processes_series,
plot_tasks_dependency_graph,
plot_schedule, Task)
import os
import matplotlib.cm as cm
ALLOW_BREAKS = True
colors = (cm... | [
"matplotlib.cm.Paired",
"taskpacker.plot_tasks_dependency_graph",
"taskpacker.resources_from_spreadsheet",
"taskpacker.schedule_processes_series",
"taskpacker.plot_schedule",
"os.path.join",
"taskpacker.Task"
] | [((434, 483), 'os.path.join', 'os.path.join', (['"""examples_data"""', '"""dna_assembly.xls"""'], {}), "('examples_data', 'dna_assembly.xls')\n", (446, 483), False, 'import os\n'), ((497, 586), 'taskpacker.resources_from_spreadsheet', 'resources_from_spreadsheet', ([], {'spreadsheet_path': 'spreadsheet_path', 'sheetnam... |
"""An implementation of the Hyperband hyperparameter tuning algorithm.
See <NAME>., <NAME>., <NAME>., <NAME>. & Talwalkar,
A. Hyperband: A Novel Bandit-Based Approach to Hyperparameter
Optimization. J. Mach. Learn. Res. 18, 1–52 (2018).
Author: <NAME> <<EMAIL>>
Date: 2019-06-17
"""
import heapq
import math
import ty... | [
"typing.TypeVar",
"math.log",
"math.floor",
"math.ceil"
] | [((429, 446), 'typing.TypeVar', 'TypeVar', (['"""Config"""'], {}), "('Config')\n", (436, 446), False, 'from typing import Any, Callable, Sequence, Tuple, TypeVar, Optional\n'), ((2199, 2215), 'math.log', 'math.log', (['n', 'eta'], {}), '(n, eta)\n', (2207, 2215), False, 'import math\n'), ((2258, 2283), 'math.floor', 'm... |
import json
import os
from enum import Enum
WIDTH, HEIGHT = 500, 800
HELP_CONTENTS = (
'Controls:\n'
'w: move player ship up\n'
'a: move player ship left\n'
's: move player ship down\n'
'd: move player ship right\n'
'j: ... | [
"os.path.isfile",
"json.loads"
] | [((943, 964), 'os.path.isfile', 'os.path.isfile', (['fpath'], {}), '(fpath)\n', (957, 964), False, 'import os\n'), ((1082, 1104), 'json.loads', 'json.loads', (['serialised'], {}), '(serialised)\n', (1092, 1104), False, 'import json\n')] |
import sys
if "python-sc2" not in sys.path:
sys.path.insert(1, "python-sc2")
import sc2pathlib
import time
from typing import List
def read_maze(file_name: str) -> List[List[int]]:
with open(file_name, "r") as text:
m = text.read()
lines = m.split("\n")
final_maze = []
height = len(l... | [
"time.perf_counter_ns",
"sc2pathlib.PathFinder",
"sys.path.insert"
] | [((604, 631), 'sc2pathlib.PathFinder', 'sc2pathlib.PathFinder', (['maze'], {}), '(maze)\n', (625, 631), False, 'import sc2pathlib\n'), ((874, 901), 'sc2pathlib.PathFinder', 'sc2pathlib.PathFinder', (['maze'], {}), '(maze)\n', (895, 901), False, 'import sc2pathlib\n'), ((2062, 2084), 'time.perf_counter_ns', 'time.perf_c... |
"""API User Role Tests."""
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, Permission
from django.core.management import call_command
import pytest
from rest_framework import status
User = get_user_model()
@pytest.mark.django_db
@pytest.fixture(scope="function")
def creat... | [
"django.contrib.auth.models.Permission.objects.first",
"pytest.fixture",
"django.contrib.auth.get_user_model",
"django.core.management.call_command",
"django.contrib.auth.models.Group.objects.get"
] | [((235, 251), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (249, 251), False, 'from django.contrib.auth import get_user_model\n'), ((278, 310), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (292, 310), False, 'import pytest\n'), ((379, 414), ... |
import os
from shutil import copyfile
from serenity.utils.config import TOMLProcessor
def test_toml_load_plain():
cfg = TOMLProcessor.load(get_test_fixture('simple.cfg'))
assert len(cfg) == 1
assert cfg['baz']['foo'] == 'bar'
def test_toml_load_include_absolute():
fixture_path = get_test_fixture('s... | [
"shutil.copyfile",
"os.path.dirname"
] | [((336, 377), 'shutil.copyfile', 'copyfile', (['fixture_path', '"""/tmp/simple.cfg"""'], {}), "(fixture_path, '/tmp/simple.cfg')\n", (344, 377), False, 'from shutil import copyfile\n'), ((868, 893), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (883, 893), False, 'import os\n')] |
from django.core.management.base import BaseCommand
from django.conf import settings
import json
from subjects.models import Subject
class Command(BaseCommand):
help = 'Integrates scraped data into data to populate'
def handle(self, *args, **options):
scraped_subjects = self.read_json('scraped')
... | [
"subjects.models.Subject.objects.get",
"json.load"
] | [((766, 786), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (775, 786), False, 'import json\n'), ((1039, 1080), 'subjects.models.Subject.objects.get', 'Subject.objects.get', ([], {'name': "subject['name']"}), "(name=subject['name'])\n", (1058, 1080), False, 'from subjects.models import Subject\n')] |
# -*- coding: utf-8 -*-
#
# Copyright (C) tkornuta, IBM Corporation 2019
#
# 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 require... | [
"ptp.configuration.configuration_error.ConfigurationError",
"torch.load",
"ptp.application.component_factory.ComponentFactory.build",
"ptp.utils.logger.initialize_logger",
"torch.save",
"os.path.isfile",
"ptp.application.component_factory.ComponentFactory.check_inheritance",
"ptp.utils.app_state.AppSt... | [((1453, 1463), 'ptp.utils.app_state.AppState', 'AppState', ([], {}), '()\n', (1461, 1463), False, 'from ptp.utils.app_state import AppState\n'), ((1486, 1517), 'ptp.utils.logger.initialize_logger', 'logging.initialize_logger', (['name'], {}), '(name)\n', (1511, 1517), True, 'import ptp.utils.logger as logging\n'), ((1... |
# KineticAnalysis/NumericalSimulatorTools.py
# =======
# Imports
# =======
import math;
import warnings;
from KineticAnalysis.NumericalSimulator import NumericalSimulator;
# =====================
# Convenience Functions
# =====================
def SimulateDynamicRange(decParams, excParams, temperature, excTime, ... | [
"math.fabs",
"KineticAnalysis.NumericalSimulator.NumericalSimulator"
] | [((579, 764), 'KineticAnalysis.NumericalSimulator.NumericalSimulator', 'NumericalSimulator', ([], {'decN': 'decN', 'decArrheniusParams': 'decArrheniusParams', 'decArrheniusB': 'decArrheniusB', 'excN': 'excN', 'excArrheniusParams': 'excArrheniusParams', 'excArrheniusB': 'excArrheniusB'}), '(decN=decN, decArrheniusParams... |
# Copyright 2019-2020 Not Just A Toy Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"falcon_heavy.core.types.BooleanType",
"falcon_heavy.core.types.StringType"
] | [((1554, 1568), 'falcon_heavy.core.types.StringType', 't.StringType', ([], {}), '()\n', (1566, 1568), True, 'from falcon_heavy.core import types as t\n'), ((1698, 1726), 'falcon_heavy.core.types.BooleanType', 't.BooleanType', ([], {'default': '(False)'}), '(default=False)\n', (1711, 1726), True, 'from falcon_heavy.core... |
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
"tripleoclient.v1.overcloud_update.UpdatePrepare",
"mock.patch",
"tripleoclient.v1.overcloud_update.UpdateConverge",
"mock.Mock",
"tripleoclient.v1.overcloud_update.UpdateRun",
"tripleoclient.exceptions.DeploymentError"
] | [((1337, 1461), 'mock.patch', 'mock.patch', (['"""tripleoclient.v1.overcloud_deploy.DeployOvercloud._get_ctlplane_attrs"""'], {'autospec': '(True)', 'return_value': '{}'}), "(\n 'tripleoclient.v1.overcloud_deploy.DeployOvercloud._get_ctlplane_attrs',\n autospec=True, return_value={})\n", (1347, 1461), False, 'imp... |
from tkinter import *
import math
# ---------------------------- CONSTANTS ------------------------------- #
PINK = "#e2979c"
RED = "#e7305b"
GREEN = "#9bdeac"
YELLOW = "#f7f5dd"
FONT_NAME = "Courier"
WORK_MIN = 25
SHORT_BREAK_MIN = 5
LONG_BREAK_MIN = 20
CHECK_MARK = "✔"
reps = 0
timer = None
# ----------------------... | [
"math.floor"
] | [((1358, 1380), 'math.floor', 'math.floor', (['(count / 60)'], {}), '(count / 60)\n', (1368, 1380), False, 'import math\n'), ((1949, 1969), 'math.floor', 'math.floor', (['(reps / 2)'], {}), '(reps / 2)\n', (1959, 1969), False, 'import math\n')] |
# https://leetcode.com/problems/find-pivot-index/
# Given an array of integers nums, calculate the pivot index of this array.
# The pivot index is the index where the sum of all the numbers strictly to the left of the index
# is equal to the sum of all the numbers strictly to the index's right.
# If the index is on the... | [
"pytest.mark.parametrize"
] | [((901, 1025), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('nums', 'result')", '[([1, 7, 3, 6, 5, 6], 3), ([1, 2, 3], -1), ([2, 1, -1], 0), ([-1, 1], -1)]'], {}), "(('nums', 'result'), [([1, 7, 3, 6, 5, 6], 3), ([1, \n 2, 3], -1), ([2, 1, -1], 0), ([-1, 1], -1)])\n", (924, 1025), False, 'import pytest\... |
#!/usr/bin/env python3
"""tests for ransom.py"""
import os
import re
import random
from subprocess import getstatusoutput
prg = './solution6_map.py'
fox = '../inputs/fox.txt'
now = '../inputs/now.txt'
# --------------------------------------------------
def seed_flag():
return '-s' if random.randint(0, 1) else ... | [
"re.match",
"os.path.isfile",
"random.randint",
"subprocess.getstatusoutput"
] | [((432, 451), 'os.path.isfile', 'os.path.isfile', (['prg'], {}), '(prg)\n', (446, 451), False, 'import os\n'), ((294, 314), 'random.randint', 'random.randint', (['(0)', '(1)'], {}), '(0, 1)\n', (308, 314), False, 'import random\n'), ((594, 626), 'subprocess.getstatusoutput', 'getstatusoutput', (['f"""{prg} {flag}"""'],... |
from tqdm import tqdm
import os
from operations.operation import Operation
class Function(Operation):
def __init__(self, do_analysis, *args, **kwargs):
self.do_analysis = do_analysis
super(Function, self).__init__(*args, **kwargs)
def apply(self):
if self.do_analysis:
met... | [
"os.path.basename"
] | [((1154, 1176), 'os.path.basename', 'os.path.basename', (['path'], {}), '(path)\n', (1170, 1176), False, 'import os\n')] |
import glob
from os.path import basename, dirname, isfile, join
modules = glob.glob(join(dirname(__file__), '*.py'))
__all__ = [basename(f)[:-3] for f in modules if isfile(f)
and not basename(f).startswith('_')]
| [
"os.path.dirname",
"os.path.isfile",
"os.path.basename"
] | [((90, 107), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (97, 107), False, 'from os.path import basename, dirname, isfile, join\n'), ((130, 141), 'os.path.basename', 'basename', (['f'], {}), '(f)\n', (138, 141), False, 'from os.path import basename, dirname, isfile, join\n'), ((167, 176), 'os.path... |
#!/usr/bin/env python3
#
# JM, 28 Dec 2017
# some default commands for plotting ORCA data
# feel free to adapt as appropriate
#### load modules
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import netCDF4
from matplotlib_colorbar import *
# needed for adding colorbar in certain transforms
fro... | [
"netCDF4.Dataset",
"iris.coords.AuxCoord",
"iris.analysis.cartography.project",
"matplotlib.pyplot.axes",
"numpy.floor",
"iris.cube.Cube",
"cartopy.crs.PlateCarree",
"numpy.log10"
] | [((2055, 2073), 'cartopy.crs.PlateCarree', 'ccrs.PlateCarree', ([], {}), '()\n', (2071, 2073), True, 'import cartopy.crs as ccrs\n'), ((2190, 2259), 'iris.coords.AuxCoord', 'iris.coords.AuxCoord', (['latT'], {'standard_name': '"""latitude"""', 'units': '"""degrees"""'}), "(latT, standard_name='latitude', units='degrees... |
'''
Launches default instance of Jupyter notebook. Image used is (1) specified in command, (2) set in <current-project>/config/carme-config.yaml,
or (3) set in /<home>/.carme/config/carme-config.yaml
'''
import os
import logging
import click
from shutil import copyfile
from ...modules.base import *
from ...modules.not... | [
"logging.info",
"logging.error",
"click.option",
"click.command"
] | [((453, 468), 'click.command', 'click.command', ([], {}), '()\n', (466, 468), False, 'import click\n'), ((470, 566), 'click.option', 'click.option', (['"""--image"""'], {'help': '"""The Jupyter docker image (must be based on Jupyter stacks)."""'}), "('--image', help=\n 'The Jupyter docker image (must be based on Jup... |
import filter_env
from ddpg import *
import gc
gc.enable()
import gym_android_wechat_jump
ENV_NAME = 'android-wechat-jump-v0'
EPISODES = 100000
TEST = 5
def main():
env = filter_env.makeFilteredEnv(gym.make(ENV_NAME))
agent = DDPG(env)
# env.monitor.start('experiments/' + ENV_NAME,force=True)
for epi... | [
"gc.enable"
] | [((47, 58), 'gc.enable', 'gc.enable', ([], {}), '()\n', (56, 58), False, 'import gc\n')] |
#!/usr/bin/env python
"""
Seasonal Panel Plot
===================
For a given field timeseries, compute seasonal averages over all data and
plot each average on a four-panel figure.
"""
# Author: <NAME>
# Version: June 2, 2017
import matplotlib.pyplot as plt
plt.style.use(['seaborn-talk', 'seaborn-ticks'])
import xb... | [
"cartopy.crs.PlateCarree",
"matplotlib.pyplot.style.use",
"xbpch.open_bpchdataset",
"matplotlib.pyplot.show"
] | [((261, 309), 'matplotlib.pyplot.style.use', 'plt.style.use', (["['seaborn-talk', 'seaborn-ticks']"], {}), "(['seaborn-talk', 'seaborn-ticks'])\n", (274, 309), True, 'import matplotlib.pyplot as plt\n'), ((394, 652), 'xbpch.open_bpchdataset', 'xbpch.open_bpchdataset', (['"""/Users/daniel/workspace/bpch/test_data/ref_e2... |
#!/usr/bin/python
import tensorflow as tf
import lib.printutils as pu
import sys
if len(sys.argv) != 3:
print("Wrong number of arguments !")
sys.exit(1)
N = int(sys.argv[1])
matsize = int(sys.argv[2])
A = {}
inv = {}
pu.init("a.dat")
pu.init("lu.dat")
sess = tf.Session()
for i in range(N):
for j in ra... | [
"tensorflow.random_uniform",
"lib.printutils.outData",
"tensorflow.global_variables_initializer",
"tensorflow.matrix_inverse",
"tensorflow.Session",
"tensorflow.matmul",
"sys.exit",
"lib.printutils.init"
] | [((230, 246), 'lib.printutils.init', 'pu.init', (['"""a.dat"""'], {}), "('a.dat')\n", (237, 246), True, 'import lib.printutils as pu\n'), ((247, 264), 'lib.printutils.init', 'pu.init', (['"""lu.dat"""'], {}), "('lu.dat')\n", (254, 264), True, 'import lib.printutils as pu\n'), ((272, 284), 'tensorflow.Session', 'tf.Sess... |
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from lib import init_classes, ma_util
def graph_to_shapes(maze_dict, mesh_name, center_x, center_z):
init_shape_game_data_list = []
#make start shape
#TODO add positions
init = ma_util.default_ini... | [
"os.path.abspath",
"lib.ma_util.add_table_to_gamedata",
"lib.ma_util.default_init",
"lib.ma_util.default_point_shape",
"lib.ma_util.default_gamedata"
] | [((301, 323), 'lib.ma_util.default_init', 'ma_util.default_init', ([], {}), '()\n', (321, 323), False, 'from lib import init_classes, ma_util\n'), ((387, 416), 'lib.ma_util.default_point_shape', 'ma_util.default_point_shape', ([], {}), '()\n', (414, 416), False, 'from lib import init_classes, ma_util\n'), ((430, 456), ... |
from django.contrib.auth.models import User
from tinymce.models import HTMLField
from django.db import models
# Create your models here.
class Pic(models.Model):
pic = models.ImageField(upload_to = "pics/",null = True)
user = models.ForeignKey(User,null=True)
pic_name = models.CharField(max_length = 30,nul... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.ImageField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((173, 220), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""pics/"""', 'null': '(True)'}), "(upload_to='pics/', null=True)\n", (190, 220), False, 'from django.db import models\n'), ((235, 269), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'null': '(True)'}), '(User, null=... |
'''
作者:邱少一
日期:2018/03/06
1、准备:
python版本:python3 --version
选择Web异步的框架aiohttp:pip3 install aiohttp(比较底层,需要再次封装)
前端模板引擎jinja2:pip3 install jinja2
MySQL的Python异步驱动程序aiomysql:pip3 install aiomysql
监控目录文件变化:pip3 install watchdog
2、流程:
1、编写web 骨架
2、编写ORM 和 Model
3、编写 web框架(基于aiohttp)
4、编写配置文件
5、编写MVC
6、构建前端
... | [
"os.path.abspath",
"aiohttp.web.Response",
"asyncio.get_event_loop",
"handlers.cookie2user",
"logging.basicConfig",
"aiohttp.web_runner.AppRunner",
"coroweb.add_routes",
"aiohttp.web.HTTPFound",
"time.time",
"json.dumps",
"logging.info",
"jinja2.FileSystemLoader",
"coroweb.add_static",
"da... | [((2130, 2169), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (2149, 2169), False, 'import logging\n'), ((8918, 8942), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (8940, 8942), False, 'import asyncio, os, json, time\n'), ((2568, 2598),... |
# A class that takes a single image, applies affine transformations, and renders it
# (and possibly a pixel-mask to tell which pixels are coming from the image)
# The class will only load the image when the render function is called (lazy evaluation)
import cv2
import numpy as np
import math
class SingleTileAffineRend... | [
"numpy.minimum",
"numpy.asarray",
"numpy.ones",
"cv2.imread",
"numpy.min",
"numpy.max",
"numpy.array",
"cv2.warpAffine",
"numpy.around",
"numpy.dot",
"numpy.eye",
"numpy.vstack"
] | [((2268, 2314), 'cv2.imread', 'cv2.imread', (['self.img_path', 'cv2.IMREAD_ANYDEPTH'], {}), '(self.img_path, cv2.IMREAD_ANYDEPTH)\n', (2278, 2314), False, 'import cv2\n'), ((2503, 2576), 'cv2.warpAffine', 'cv2.warpAffine', (['img', 'adjusted_transform', 'self.shape'], {'flags': 'cv2.INTER_AREA'}), '(img, adjusted_trans... |
import numpy as np
class LowPassFilter:
def __init__(self):
self.prev_raw_value = None
self.prev_filtered_value = None
def process(self, value, alpha):
if self.prev_raw_value is None:
s = value
else:
s = alpha * value + (1.0 - alpha) * self.prev_filtere... | [
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.plot",
"numpy.zeros",
"matplotlib.pyplot.draw",
"numpy.linspace",
"numpy.random.rand"
] | [((1308, 1331), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(1000)'], {}), '(0, 1, 1000)\n', (1319, 1331), True, 'import numpy as np\n'), ((1391, 1402), 'matplotlib.pyplot.plot', 'plt.plot', (['x'], {}), '(x)\n', (1399, 1402), True, 'import matplotlib.pyplot as plt\n'), ((1407, 1418), 'matplotlib.pyplot.plot', 'p... |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2020 Intel Corporation
"""vertical onecontainer api, definitions"""
import json
from fastapi import FastAPI, Request, status
from fastapi.exceptions import RequestValidationError, ValidationError
from fastapi.responses import JSONResponse
from onecontainer_api.... | [
"json.loads",
"onecontainer_api.models.db.connect",
"onecontainer_api.models.Base.metadata.create_all",
"onecontainer_api.startup_svc.startup",
"onecontainer_api.models.db.disconnect",
"fastapi.FastAPI",
"fastapi.responses.JSONResponse"
] | [((434, 485), 'onecontainer_api.models.Base.metadata.create_all', 'models.Base.metadata.create_all', ([], {'bind': 'models.engine'}), '(bind=models.engine)\n', (465, 485), False, 'from onecontainer_api import models, errors, startup_svc\n'), ((493, 649), 'fastapi.FastAPI', 'FastAPI', ([], {'title': '"""One Container AP... |
"""
Tests for dit.multivariate.secret_key_agreement.two_way_skar.py
"""
import pytest
import numpy as np
from dit import Distribution
from dit.example_dists.intrinsic import intrinsic_1
from dit.multivariate.secret_key_agreement import two_way_skar
def test_two_way_skar1():
"""
Test simple example 1.
"... | [
"pytest.approx",
"dit.multivariate.secret_key_agreement.two_way_skar",
"dit.Distribution",
"numpy.isnan"
] | [((334, 376), 'dit.multivariate.secret_key_agreement.two_way_skar', 'two_way_skar', (['intrinsic_1', '[[0], [1]]', '[2]'], {}), '(intrinsic_1, [[0], [1]], [2])\n', (346, 376), False, 'from dit.multivariate.secret_key_agreement import two_way_skar\n'), ((509, 567), 'dit.Distribution', 'Distribution', (["['000', '011', '... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pandas as pd
import sys
from Bio import Entrez
from Rules_Class import Rules
import functions as fn
input_directory=""
Positive=[]
[Positive.append(line.strip().upper()) for line in open(input_directory+"Positive.... | [
"pandas.DataFrame",
"functions.make_query",
"Bio.Entrez.esearch",
"Rules_Class.Rules",
"functions.ret_abstract",
"functions.multiple_taxonomy",
"pandas.read_csv",
"functions.dep_parser",
"functions.term_maker",
"functions.lookup_annot",
"Bio.Entrez.read",
"functions.candidate_sentence",
"fun... | [((497, 539), 'pandas.read_csv', 'pd.read_csv', (['genes_ents'], {'sep': '""","""', 'header': '(0)'}), "(genes_ents, sep=',', header=0)\n", (508, 539), True, 'import pandas as pd\n'), ((583, 654), 'pandas.read_csv', 'pd.read_csv', (["(input_directory + 'ncbi_id_lookup.csv')"], {'sep': '"""\t"""', 'header': '(0)'}), "(i... |
# coding: utf-8
import sys
from setuptools import find_packages, setup
test_requirements = ['responses',
'pytest-cov',
'pytest-mock',
'pytest>=2.8.0', ]
install_requires = ['six',
'requests<3.0.0',
'future']
if sy... | [
"setuptools.find_packages"
] | [((545, 583), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "('benchmarks',)"}), "(exclude=('benchmarks',))\n", (558, 583), False, 'from setuptools import find_packages, setup\n')] |
# Generated by Django 3.0.8 on 2020-08-06 18:46
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.manager
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_depe... | [
"django.db.migrations.swappable_dependency",
"datetime.time",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((295, 352), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (326, 352), False, 'from django.db import migrations, models\n'), ((5739, 5853), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', ... |
#!/usr/bin/env python
#coding=utf-8
#导入Python标准日志模块
"""
Media Test
"""
import logging
#从Python SDK导入BOS配置管理模块以及安全认证模块
from baidubce.bce_client_configuration import BceClientConfiguration
from baidubce.auth.bce_credentials import BceCredentials
#设置BosClient的Host,Access Key ID和Secret Access Key
bos_host = b"http://mu... | [
"logging.Formatter",
"baidubce.auth.bce_credentials.BceCredentials",
"logging.FileHandler",
"logging.getLogger"
] | [((427, 483), 'logging.getLogger', 'logging.getLogger', (['"""baidubce.services.media.mediaclient"""'], {}), "('baidubce.services.media.mediaclient')\n", (444, 483), False, 'import logging\n'), ((489, 522), 'logging.FileHandler', 'logging.FileHandler', (['"""sample.log"""'], {}), "('sample.log')\n", (508, 522), False, ... |
"""General utils"""
import inspect
from functools import partial
from py2http.decorators import mk_flat
def get_class_that_defined_method(meth):
"""Get the class from a method function object"""
if isinstance(meth, partial):
return get_class_that_defined_method(meth.func)
if inspect.ismethod(met... | [
"py2http.decorators.mk_flat",
"inspect.ismethod",
"inspect.getmodule",
"inspect.getmro",
"inspect.isfunction",
"inspect.isbuiltin"
] | [((779, 803), 'inspect.isfunction', 'inspect.isfunction', (['meth'], {}), '(meth)\n', (797, 803), False, 'import inspect\n'), ((300, 322), 'inspect.ismethod', 'inspect.ismethod', (['meth'], {}), '(meth)\n', (316, 322), False, 'import inspect\n'), ((575, 614), 'inspect.getmro', 'inspect.getmro', (['meth.__self__.__class... |
# --*-- coding: utf-8 --*--
import time
from selenium import webdriver
from bs4 import BeautifulSoup
from datetime import datetime, timedelta
from PyQt5.QtCore import QThread
from PyQt5.QtCore import pyqtSignal
import sys
import os
def resource_path(relative_path):
""" Get absolute path to resource, works for dev ... | [
"bs4.BeautifulSoup",
"os.path.abspath",
"os.path.join"
] | [((532, 570), 'os.path.join', 'os.path.join', (['base_path', 'relative_path'], {}), '(base_path, relative_path)\n', (544, 570), False, 'import os\n'), ((1089, 1139), 'bs4.BeautifulSoup', 'BeautifulSoup', (['self.driver.page_source', '"""html5lib"""'], {}), "(self.driver.page_source, 'html5lib')\n", (1102, 1139), False,... |
import pandas as pd
import numpy as np
from preprocess.load_data.data_loader import load_hotel_reserve
customer_tb, hotel_tb, reserve_tb = load_hotel_reserve()
# 아래 부터 책에 게재
customer_tb['sex_and_age'] = pd.Categorical(
# 연결할 열을 추출
customer_tb[['sex', 'age']]
# lambda 함수에서 sex와 10살 단위로 구분한 age 사이에 _를 추가하여 연결
... | [
"numpy.floor",
"preprocess.load_data.data_loader.load_hotel_reserve"
] | [((139, 159), 'preprocess.load_data.data_loader.load_hotel_reserve', 'load_hotel_reserve', ([], {}), '()\n', (157, 159), False, 'from preprocess.load_data.data_loader import load_hotel_reserve\n'), ((361, 380), 'numpy.floor', 'np.floor', (['(x[1] / 10)'], {}), '(x[1] / 10)\n', (369, 380), True, 'import numpy as np\n')] |
import pytest
from unittest import mock
from share.regulate.regulator import Regulator, Steps, InfiniteRegulationError, RegulatorConfigError
from share.regulate.steps import NodeStep, GraphStep, ValidationStep
from share.util.graph import MutableGraph
@pytest.mark.parametrize('num_node_steps', [0, 1, 5])
@pytest.mar... | [
"share.regulate.regulator.Regulator",
"unittest.mock.Mock",
"share.util.graph.MutableGraph",
"pytest.raises",
"pytest.mark.parametrize"
] | [((256, 308), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""num_node_steps"""', '[0, 1, 5]'], {}), "('num_node_steps', [0, 1, 5])\n", (279, 308), False, 'import pytest\n'), ((310, 363), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""num_graph_steps"""', '[0, 1, 5]'], {}), "('num_graph_steps',... |
# coding=utf-8
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------... | [
"azext_iot.iothub.providers.pnp_runtime.PnPRuntimeProvider",
"knack.log.get_logger"
] | [((474, 494), 'knack.log.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (484, 494), False, 'from knack.log import get_logger\n'), ((753, 840), 'azext_iot.iothub.providers.pnp_runtime.PnPRuntimeProvider', 'PnPRuntimeProvider', ([], {'cmd': 'cmd', 'hub_name': 'hub_name', 'rg': 'resource_group_name', 'logi... |
"""
This module provides dictionaries for generating
`~matplotlib.colors.LinearSegmentedColormaps`, and a dictionary of these
dictionaries.
"""
import matplotlib.colors as colors
import numpy as np
__all__ = [
'aia_color_table', 'sswidl_lasco_color_table', 'eit_color_table',
'sxt_color_table', 'xrt_color_table... | [
"matplotlib.colors.LinearSegmentedColormap",
"numpy.zeros",
"numpy.ones",
"numpy.max",
"numpy.array",
"numpy.arange",
"numpy.linspace",
"numpy.sqrt"
] | [((2183, 2208), 'numpy.arange', 'np.arange', (['(256)'], {'dtype': '"""f"""'}), "(256, dtype='f')\n", (2192, 2208), True, 'import numpy as np\n'), ((3261, 4540), 'numpy.array', 'np.array', (['[0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 14, 15, 16, 17, 19, 20, 21, 22, 24, 25,\n 26, 28, 29, 30, 31, 33, 34, 35, 36, 38, 39, 40... |
# Copyright 2019 Xanadu Quantum Technologies 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 agre... | [
"numpy.diag",
"strawberryfields.gbs.vibronic.gbs_params",
"strawberryfields.gbs.vibronic.energies",
"numpy.tanh",
"numpy.allclose",
"numpy.identity",
"pytest.raises",
"numpy.array",
"numpy.exp",
"pytest.mark.parametrize",
"numpy.all",
"numpy.sqrt"
] | [((3695, 3726), 'numpy.array', 'np.array', (['[700.0, 600.0, 500.0]'], {}), '([700.0, 600.0, 500.0])\n', (3703, 3726), True, 'import numpy as np\n'), ((3841, 3926), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""sample, sample_energy"""', '[(S1, E1), (S2, E2), (S3, E3)]'], {}), "('sample, sample_energy', [... |
from datetime import datetime
import sqlalchemy as sa
from sqlalchemy_utils import Timestamp
from tests import TestCase
class TestTimestamp(TestCase):
def create_models(self):
class Article(self.Base, Timestamp):
__tablename__ = 'article'
id = sa.Column(sa.Integer, primary_key=T... | [
"datetime.datetime.utcnow",
"sqlalchemy.Unicode",
"sqlalchemy.Column"
] | [((472, 489), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (487, 489), False, 'from datetime import datetime\n'), ((812, 829), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (827, 829), False, 'from datetime import datetime\n'), ((285, 324), 'sqlalchemy.Column', 'sa.Column', (['sa.... |
"""Tests for __main__.py"""
# pylint: disable=no-self-use
from argparse import Namespace
from wordlesolve.__main__ import main, parse_args
class TestMain:
"Tests of main() function - checking correct arguments are sent to correct method"
def test_solve(self, monkeypatch, capsys):
"default values sh... | [
"argparse.Namespace",
"wordlesolve.__main__.parse_args",
"wordlesolve.__main__.main"
] | [((576, 637), 'argparse.Namespace', 'Namespace', ([], {'hard': '(False)', 'guessfreq': 'None', 'play': '(False)', 'test': '(False)'}), '(hard=False, guessfreq=None, play=False, test=False)\n', (585, 637), False, 'from argparse import Namespace\n'), ((646, 656), 'wordlesolve.__main__.main', 'main', (['args'], {}), '(arg... |
import time
import unittest
import uuid
from requests.exceptions import HTTPError
from ittests.it_test import TestHelper
from smartobjects.datalake.datasets import Dataset, DatasetField, DatasetUpdate, DatasetFieldUpdate
class TestDatalakeService(unittest.TestCase):
@classmethod
def setUpClass(cls):
... | [
"smartobjects.datalake.datasets.DatasetField",
"uuid.uuid4",
"ittests.it_test.TestHelper.getClient",
"smartobjects.datalake.datasets.DatasetUpdate",
"time.sleep",
"smartobjects.datalake.datasets.DatasetFieldUpdate"
] | [((334, 356), 'ittests.it_test.TestHelper.getClient', 'TestHelper.getClient', ([], {}), '()\n', (354, 356), False, 'from ittests.it_test import TestHelper\n'), ((453, 500), 'smartobjects.datalake.datasets.DatasetField', 'DatasetField', ([], {'key': 'cls.field_key', 'type': '"""BOOLEAN"""'}), "(key=cls.field_key, type='... |
# Copyright 2016-2018 Yubico AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | [
"yubihsm.objects.YhsmObject._create",
"random.randint",
"yubihsm.objects.YhsmObject",
"binascii.a2b_hex",
"yubihsm.objects.ObjectInfo",
"yubihsm.objects.ObjectInfo.parse",
"mock.MagicMock"
] | [((1001, 1154), 'binascii.a2b_hex', 'a2b_hex', (['"""ffffffffffffffff00010028ffff0226000244454641554c5420415554484b4559204348414e47452054484953204153415000c0ffeec0ffee01ffffffffffffffff"""'], {}), "(\n 'ffffffffffffffff00010028ffff0226000244454641554c5420415554484b4559204348414e47452054484953204153415000c0ffeec0ffee... |
from rest_framework import serializers
from netbox_routing.api.nested_serializers import NestedPrefixListSerializer, NestedRouteMapSerializer
from netbox.api.serializers import NetBoxModelSerializer
from netbox_routing.models import PrefixList, PrefixListEntry, RouteMap, RouteMapEntry
__all__ = (
'StaticRouteSer... | [
"rest_framework.serializers.HyperlinkedIdentityField",
"netbox_routing.api.nested_serializers.NestedPrefixListSerializer",
"netbox_routing.api.nested_serializers.NestedRouteMapSerializer"
] | [((394, 497), 'rest_framework.serializers.HyperlinkedIdentityField', 'serializers.HyperlinkedIdentityField', ([], {'view_name': '"""plugins-api:netbox_routing-api:prefixlist-detail"""'}), "(view_name=\n 'plugins-api:netbox_routing-api:prefixlist-detail')\n", (430, 497), False, 'from rest_framework import serializers... |
import json
import os
import shutil
import zipfile
import zlib
from typing import List, Optional
from minecraft.networking.types import PositionAndLook
from pcrc import constant
from pcrc.utils import file_util
class ReplayRecording:
def __init__(self, temp_file_dir: str):
self.temp_file_dir = temp_file_dir
sel... | [
"zipfile.ZipFile",
"os.makedirs",
"pcrc.utils.file_util.touch_file",
"os.path.dirname",
"os.path.exists",
"json.dumps",
"shutil.rmtree",
"os.path.join",
"zlib.crc32"
] | [((403, 432), 'os.path.exists', 'os.path.exists', (['temp_file_dir'], {}), '(temp_file_dir)\n', (417, 432), False, 'import os\n'), ((468, 494), 'os.makedirs', 'os.makedirs', (['temp_file_dir'], {}), '(temp_file_dir)\n', (479, 494), False, 'import os\n'), ((497, 556), 'pcrc.utils.file_util.touch_file', 'file_util.touch_... |
from mrcnn import utils
import os
import pandas as pd
import skimage.io as skio
import numpy as np
# Root directory of the project
ROOT_DIR = os.path.abspath("../../")
# Results directory
# Save submission files and test/train split csvs here
RESULTS_DIR = os.path.join(ROOT_DIR, "results/wv2/")
#####################... | [
"numpy.stack",
"os.path.abspath",
"os.path.dirname",
"os.walk",
"numpy.ones",
"os.path.join",
"skimage.io.imread"
] | [((143, 168), 'os.path.abspath', 'os.path.abspath', (['"""../../"""'], {}), "('../../')\n", (158, 168), False, 'import os\n'), ((258, 296), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""results/wv2/"""'], {}), "(ROOT_DIR, 'results/wv2/')\n", (270, 296), False, 'import os\n'), ((773, 819), 'skimage.io.imread', 'skio... |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... | [
"TestSCons.TestSCons"
] | [((1265, 1286), 'TestSCons.TestSCons', 'TestSCons.TestSCons', ([], {}), '()\n', (1284, 1286), False, 'import TestSCons\n')] |
""" Font size checker """
from slidelint.utils import help_wrapper
from slidelint.pdf_utils import document_pages_layouts, layout_characters
MESSAGES = (
dict(id='C1002',
msg_name='font-to-small',
msg='Font is to small',
help="Font is to small: Text should take up "
"a mini... | [
"slidelint.pdf_utils.document_pages_layouts",
"slidelint.pdf_utils.layout_characters",
"slidelint.utils.help_wrapper"
] | [((362, 384), 'slidelint.utils.help_wrapper', 'help_wrapper', (['MESSAGES'], {}), '(MESSAGES)\n', (374, 384), False, 'from slidelint.utils import help_wrapper\n'), ((768, 796), 'slidelint.pdf_utils.document_pages_layouts', 'document_pages_layouts', (['path'], {}), '(path)\n', (790, 796), False, 'from slidelint.pdf_util... |
import os
import torch
from torch import nn
import numpy as np
import pytorch_lightning as pl
from transformers import BartTokenizer
from transformers import AdamW, get_linear_schedule_with_warmup
from transformers import BartForConditionalGeneration, BartModel
from kobart import get_pytorch_kobart_model, get_kobar... | [
"kobart.get_pytorch_kobart_model",
"transformers.get_linear_schedule_with_warmup",
"transformers.AdamW",
"kobart.get_kobart_tokenizer",
"torch.no_grad"
] | [((608, 630), 'kobart.get_kobart_tokenizer', 'get_kobart_tokenizer', ([], {}), '()\n', (628, 630), False, 'from kobart import get_pytorch_kobart_model, get_kobart_tokenizer\n'), ((2165, 2264), 'transformers.AdamW', 'AdamW', (['optimizer_grouped_parameters'], {'lr': "self._hparams['lr']", 'eps': "self._hparams['adam_eps... |
#!/usr/bin/python3
# <NAME> - 170401001
"""
Bir ağ zaman sunucusu ve istemcisini aşağıdaki gerekliliklere uygun bir şekilde
yazmalısınız.
◦ Sunucu TCP port 142 kullanmalıdır.
◦ Sunucu kaynak IP adresi ve portu her ne olursa olsun bütün isteklere cevap olarak
zamanı milisaniye cinsinden ve zaman dilimini
(UTC+2 veya UT... | [
"datetime.datetime.fromtimestamp",
"socket.socket",
"os.system",
"time.time"
] | [((1092, 1141), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (1105, 1141), False, 'import socket\n'), ((2897, 2913), 'os.system', 'os.system', (['komut'], {}), '(komut)\n', (2906, 2913), False, 'import os\n'), ((1590, 1601), 'time.time', 'ti... |
from __future__ import print_function
import numpy as np
from .base_grid import BaseGrid
# Various regirdding techniques (e.g. SCRIP) \
# don't cope well with singularities.
SOUTHERN_EXTENT = -89.9995
NORTHERN_EXTENT = 89.9995
class RegularGrid(BaseGrid):
def __init__(self, num_lons, num_lats, mask_t=None,
... | [
"numpy.linspace"
] | [((568, 613), 'numpy.linspace', 'np.linspace', (['(0)', '(360)', 'num_lons'], {'endpoint': '(False)'}), '(0, 360, num_lons, endpoint=False)\n', (579, 613), True, 'import numpy as np\n'), ((669, 744), 'numpy.linspace', 'np.linspace', (['(SOUTHERN_EXTENT + dy_half)', '(NORTHERN_EXTENT - dy_half)', 'num_lats'], {}), '(SOU... |
import os
import torch.utils.tensorboard
import tqdm
from easydict import EasyDict
from torch.utils.data import DataLoader
from models.conf_model import compute_min_loss, compute_wasserstein_loss, get_init_pos
from utils import eval_opt as utils_eval
from utils import misc as utils_misc
from utils.parsing_args import... | [
"pickle.dump",
"rdkit.Chem.RemoveHs",
"utils.misc.CheckpointManager",
"dgl.unbatch",
"os.path.join",
"torch.utils.data.DataLoader",
"utils.misc.get_conf_dataset",
"easydict.EasyDict",
"utils.misc.get_logger",
"utils.misc.get_new_log_dir",
"models.conf_model.compute_min_loss",
"functools.partia... | [((702, 721), 'utils.parsing_args.get_conf_opt_args', 'get_conf_opt_args', ([], {}), '()\n', (719, 721), False, 'from utils.parsing_args import get_conf_opt_args\n'), ((1355, 1371), 'easydict.EasyDict', 'EasyDict', (['config'], {}), '(config)\n', (1363, 1371), False, 'from easydict import EasyDict\n'), ((1376, 1414), '... |
"""
Copyright (c) Facebook, Inc. and its affiliates.
"""
from copy import deepcopy
SPEAKERLOOK = {"reference_object": {"special_reference": "SPEAKER_LOOK"}}
SPEAKERPOS = {"reference_object": {"special_reference": "SPEAKER"}}
AGENTPOS = {"reference_object": {"special_reference": "AGENT"}}
def maybe_listify_tags(t):
... | [
"copy.deepcopy"
] | [((2788, 2799), 'copy.deepcopy', 'deepcopy', (['v'], {}), '(v)\n', (2796, 2799), False, 'from copy import deepcopy\n'), ((3207, 3218), 'copy.deepcopy', 'deepcopy', (['v'], {}), '(v)\n', (3215, 3218), False, 'from copy import deepcopy\n'), ((4182, 4193), 'copy.deepcopy', 'deepcopy', (['v'], {}), '(v)\n', (4190, 4193), F... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.