code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import discord
from discord.ext import commands
from mysqldb import the_database
class ModerationFirewallTable(commands.Cog):
""" Category for the Firewall system and its commands and methods. """
def __init__(self, client) -> None:
self.client = client
@commands.command(hidden=True)
@comman... | [
"discord.ext.commands.has_permissions",
"mysqldb.the_database",
"discord.ext.commands.command"
] | [((279, 308), 'discord.ext.commands.command', 'commands.command', ([], {'hidden': '(True)'}), '(hidden=True)\n', (295, 308), False, 'from discord.ext import commands\n'), ((314, 358), 'discord.ext.commands.has_permissions', 'commands.has_permissions', ([], {'administrator': '(True)'}), '(administrator=True)\n', (338, 3... |
#!/usr/bin/env python
#
# Copyright 2014 <NAME>
# See the file LICENSE.txt for your rights.
"""Driver for CC3000 data logger
http://www.rainwise.com/products/attachments/6832/20110518125531.pdf
There are a few variants:
CC-3000_ - __
| |
| 41 = 418 MHz
| 42 = 433 MHz
| __ = 2.4 G... | [
"logging.getLogger",
"weewx.wxformulas.calculate_rain",
"time.strptime",
"weewx.RetriesExceeded",
"math.ceil",
"weewx.crc16.crc16",
"optparse.OptionParser",
"time.sleep",
"datetime.timedelta",
"datetime.datetime.now",
"weewx.WeeWxIOError.__init__",
"serial.Serial",
"time.localtime",
"six.b... | [((7356, 7383), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (7373, 7383), False, 'import logging\n'), ((57297, 57331), 'optparse.OptionParser', 'optparse.OptionParser', ([], {'usage': 'usage'}), '(usage=usage)\n', (57318, 57331), False, 'import optparse\n'), ((7782, 7820), 'weewx.WeeWx... |
import subprocess
import os
import time
# ================language variable begin========================
Tips_at_the_beginning = 'Type "help" or command for more information.'
# ================language variable finish========================
print(Tips_at_the_beginning)
while True:
command = input('>> ')
if c... | [
"subprocess.Popen",
"os._exit",
"time.sleep"
] | [((572, 587), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (582, 587), False, 'import time\n'), ((664, 710), 'subprocess.Popen', 'subprocess.Popen', (['"""Reload-drivers"""'], {'shell': '(True)'}), "('Reload-drivers', shell=True)\n", (680, 710), False, 'import subprocess\n'), ((768, 812), 'subprocess.Popen',... |
"""
This module is used to return latest OCS internal build for specified OCS
version.
"""
import argparse
import os
from ocs_ci.framework import config
from ocs_ci.framework.main import load_config
from ocs_ci.ocs.constants import OCS_VERSION_CONF_DIR
from ocs_ci.utility.utils import get_latest_ds_olm_tag
def init... | [
"ocs_ci.framework.main.load_config",
"os.path.join",
"ocs_ci.utility.utils.get_latest_ds_olm_tag",
"argparse.ArgumentParser"
] | [((439, 504), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""OCS Internal build version"""'}), "(description='OCS Internal build version')\n", (462, 504), False, 'import argparse\n'), ((1285, 1346), 'os.path.join', 'os.path.join', (['OCS_VERSION_CONF_DIR', 'f"""ocs-{ocs_version}.yaml"""'... |
# -*- coding:utf-8 -*-
# Copyright (c) 2020 Huawei Technologies Co.,Ltd.
#
# openGauss is licensed under Mulan PSL v2.
# You can use this software according to the terms
# and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE... | [
"os.path.exists",
"gspylib.inspection.common.SharedFuncs.runSqlCmd",
"gspylib.inspection.common.SharedFuncs.getMasterDnNum",
"gspylib.common.Common.DefaultValue.getCpuSet",
"gspylib.os.gsfile.g_file.readFile",
"gspylib.os.gsfile.g_file.createFile",
"gspylib.inspection.common.SharedFuncs.runShellCmd",
... | [((4075, 4128), 'gspylib.inspection.common.SharedFuncs.getMasterDnNum', 'SharedFuncs.getMasterDnNum', (['self.user', 'self.mpprcFile'], {}), '(self.user, self.mpprcFile)\n', (4101, 4128), False, 'from gspylib.inspection.common import SharedFuncs\n'), ((1849, 1875), 'os.path.realpath', 'os.path.realpath', (['__file__'],... |
import torch
from torch.utils.data import Dataset, DataLoader
from tqdm import tqdm # Displays a progress bar
import sys,os
import numpy as np
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
import pickle
from sklearn.metrics import accuracy_score
from sklearn.model_selection import KFold, Stratifi... | [
"torch.utils.data.ConcatDataset",
"numpy.array",
"sys.path.append",
"os.path.exists",
"numpy.mean",
"argparse.ArgumentParser",
"sklearn.decomposition.PCA",
"numpy.where",
"dataset.EnableDataset",
"pickle.load",
"numpy.std",
"sklearn.pipeline.Pipeline",
"sklearn.metrics.accuracy_score",
"sk... | [((577, 597), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (592, 597), False, 'import sys, os\n'), ((6110, 6135), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (6133, 6135), False, 'import argparse\n'), ((2167, 2197), 'sklearn.preprocessing.StandardScaler', 'preprocessin... |
# Lembrança do tempo de adolescente
import pygame
from pygame.sprite import Group
from settings import Settings
from game_stats import GameStats
from scoreboard import Scoreboard
from button import Button
from ship import Ship
import game_functions as gf
def run_game():
# Inicializa o jogo e cria um objeto para ... | [
"ship.Ship",
"game_functions.update_aliens",
"pygame.init",
"game_stats.GameStats",
"pygame.display.set_mode",
"pygame.sprite.Group",
"game_functions.check_events",
"button.Button",
"scoreboard.Scoreboard",
"pygame.display.set_caption",
"settings.Settings",
"game_functions.update_screen",
"g... | [((331, 344), 'pygame.init', 'pygame.init', ([], {}), '()\n', (342, 344), False, 'import pygame\n'), ((363, 373), 'settings.Settings', 'Settings', ([], {}), '()\n', (371, 373), False, 'from settings import Settings\n'), ((387, 465), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(ai_settings.screen_width, ai_... |
#
# Copyright (c) 2015-2021 University of Antwerp, Aloxy NV.
#
# This file is part of pyd7a.
# See https://github.com/Sub-IoT/pyd7a for further info.
#
# 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 Lice... | [
"d7a.alp.operations.nop.NoOperation",
"d7a.support.schema.Types.BITS",
"d7a.support.schema.Types.OBJECT"
] | [((1358, 1371), 'd7a.alp.operations.nop.NoOperation', 'NoOperation', ([], {}), '()\n', (1369, 1371), False, 'from d7a.alp.operations.nop import NoOperation\n'), ((1185, 1198), 'd7a.support.schema.Types.BITS', 'Types.BITS', (['(6)'], {}), '(6)\n', (1195, 1198), False, 'from d7a.support.schema import Validatable, Types\n... |
import json
import os
from data import POSI
import data
def test_create_posi():
# given
log = "POSI;61.472;1;43.7182527866061;10.4215241271896;1;60"
# when
posi = POSI.from_log(log)
# then
assert posi.timestamp == 61.472
assert posi.landmark == 1
assert posi.latitude == 43.71825278... | [
"data.POSI.from_json_file",
"data.load_from_json_file",
"os.path.isfile",
"data.save_json",
"data.POSI.from_log",
"data.POSI.from_dict",
"os.remove"
] | [((184, 202), 'data.POSI.from_log', 'POSI.from_log', (['log'], {}), '(log)\n', (197, 202), False, 'from data import POSI\n'), ((569, 587), 'data.POSI.from_log', 'POSI.from_log', (['log'], {}), '(log)\n', (582, 587), False, 'from data import POSI\n'), ((889, 907), 'data.POSI.from_log', 'POSI.from_log', (['log'], {}), '(... |
from vehiculo import vehiculo
class autobus(vehiculo):
def tarifaAutobus(self):
return float(vehiculo.tarifa(self)) + ((vehiculo.random * 100) * 0.10)
| [
"vehiculo.vehiculo.tarifa"
] | [((108, 129), 'vehiculo.vehiculo.tarifa', 'vehiculo.tarifa', (['self'], {}), '(self)\n', (123, 129), False, 'from vehiculo import vehiculo\n')] |
# #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Запуск:
python ./demo_logic.py
"""
# pylint: disable=line-too-long,missing-docstring,bad-whitespace
import sys
import os
import random
import math
import os
from pyss.logic_object import LogicObject
DIRNAME_MODULE = os.path.dirname(os.path.dirname(os.path.dirnam... | [
"pyss.terminate.Terminate",
"pyss.pyss_model.PyssModel",
"pyss.logic.Logic",
"pyss.segment.Segment",
"pyss.logger.info",
"os.path.realpath",
"pyss.logic_object.LogicObject",
"pyss.generate.Generate",
"sys.path.append"
] | [((381, 412), 'sys.path.append', 'sys.path.append', (['DIRNAME_MODULE'], {}), '(DIRNAME_MODULE)\n', (396, 412), False, 'import sys\n'), ((413, 462), 'sys.path.append', 'sys.path.append', (["(DIRNAME_MODULE + 'pyss' + os.sep)"], {}), "(DIRNAME_MODULE + 'pyss' + os.sep)\n", (428, 462), False, 'import sys\n'), ((1716, 176... |
import os
import tempfile
import shutil
import multiprocessing
import pickle
from copy import deepcopy
from enum import Enum
from typing import Optional, List, Tuple, Dict, Any
from typing_extensions import Literal
import rdkit.Chem as Chem
from ccdc.docking import Docker as DockerGold
from ccdc.io import MoleculeRea... | [
"dockstream.utils.dockstream_exceptions.DockingRunFailed",
"ccdc.docking.Docker",
"multiprocessing.Process",
"dockstream.utils.enums.Gold_enums.GoldOutputEnum",
"rdkit.Chem.SDMolSupplier",
"rdkit.Chem.SDWriter",
"dockstream.utils.enums.Gold_enums.GoldExecutablesEnum",
"dockstream.utils.general_utils.g... | [((2161, 2188), 'dockstream.utils.enums.Gold_enums.GoldLigandPreparationEnum', 'GoldLigandPreparationEnum', ([], {}), '()\n', (2186, 2188), False, 'from dockstream.utils.enums.Gold_enums import GoldLigandPreparationEnum\n'), ((2195, 2218), 'dockstream.utils.enums.Gold_enums.GoldTargetKeywordEnum', 'GoldTargetKeywordEnu... |
from mycroft import MycroftSkill, intent_file_handler
class Quandolavar(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('quandolavar.intent')
def handle_quandolavar(self, message):
self.speak_dialog('quandolavar')
def create_skill():
return Quando... | [
"mycroft.intent_file_handler",
"mycroft.MycroftSkill.__init__"
] | [((155, 196), 'mycroft.intent_file_handler', 'intent_file_handler', (['"""quandolavar.intent"""'], {}), "('quandolavar.intent')\n", (174, 196), False, 'from mycroft import MycroftSkill, intent_file_handler\n'), ((121, 148), 'mycroft.MycroftSkill.__init__', 'MycroftSkill.__init__', (['self'], {}), '(self)\n', (142, 148)... |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import json
from typing import Any, Callable, Type, Dict
from ax.core.experiment import Experiment
from ax.storage.j... | [
"json.dumps",
"ax.storage.json_store.encoder.object_to_json"
] | [((937, 1049), 'ax.storage.json_store.encoder.object_to_json', 'object_to_json', (['experiment'], {'encoder_registry': 'encoder_registry', 'class_encoder_registry': 'class_encoder_registry'}), '(experiment, encoder_registry=encoder_registry,\n class_encoder_registry=class_encoder_registry)\n', (951, 1049), False, 'f... |
from numpy import arcsin, cos, exp, pi, sin
def _comp_point_coordinate(self):
"""Compute the point coordinates needed to plot the Slot.
Parameters
----------
self : SlotW14
A SlotW14 object
Returns
-------
point_dict: dict
A dict of the slot point coordinates
"""
... | [
"numpy.exp",
"numpy.sin",
"numpy.arcsin",
"numpy.cos"
] | [((434, 461), 'numpy.arcsin', 'arcsin', (['(self.W0 / (2 * Rbo))'], {}), '(self.W0 / (2 * Rbo))\n', (440, 461), False, 'from numpy import arcsin, cos, exp, pi, sin\n'), ((519, 537), 'numpy.exp', 'exp', (['(-1.0j * alpha)'], {}), '(-1.0j * alpha)\n', (522, 537), False, 'from numpy import arcsin, cos, exp, pi, sin\n'), (... |
import atexit
import base64
import configparser
import contextlib
import datetime
import hashlib
import io
import logging
import os
import pathlib
import re
import shutil
import sys
import tempfile
from typing import (
IO,
Any,
Dict,
Generator,
List,
NoReturn,
Optional,
Sequence,
Tup... | [
"logging.getLogger",
"re.compile",
"keystoneauth1.session.Session",
"os.fspath",
"keystoneauth1.identity.v3.Password",
"os.path.exists",
"shutil.move",
"pathlib.Path",
"os.chmod",
"contextlib.ExitStack",
"tempfile.NamedTemporaryFile",
"atexit.register",
"hashlib.sha256",
"sys.getfilesystem... | [((581, 614), 'logging.getLogger', 'logging.getLogger', (['"""bandersnatch"""'], {}), "('bandersnatch')\n", (598, 614), False, 'import logging\n'), ((687, 762), 're.compile', 're.compile', (["b'^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$'"], {}), "(b'^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]... |
import numpy as np
import matplotlib.pyplot as plt
from kf_v4 import f
from simulated_observation import ls_of_observations_v4, real_state_v4
plt.ion()
plt.figure()
# assume the pic is 300 in x-length, and 200 in y-height
real_state = real_state_v4
f.x = ls_of_observations_v4[0]
NUMSTEPS = 10 # number of loops to... | [
"kf_v4.f.update",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ginput",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ion",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
] | [((145, 154), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (152, 154), True, 'import matplotlib.pyplot as plt\n'), ((155, 167), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (165, 167), True, 'import matplotlib.pyplot as plt\n'), ((1182, 1202), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(5)',... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" Copyright 2012-2021 Smartling, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this work except in compliance with the License.
* You may obtain a copy of the License in the LICENSE file, or at:
*
* http://www.apache.org/li... | [
"importlib.import_module",
"builder.Parameters.MultipartProperty",
"json.dumps",
"builder.Parameters.Parameter",
"builder.Parameters.ApiCore.__init__"
] | [((960, 995), 'builder.Parameters.ApiCore.__init__', 'ApiCore.__init__', (['self', 'swaggerDict'], {}), '(self, swaggerDict)\n', (976, 995), False, 'from builder.Parameters import ApiCore, Parameter, MultipartProperty\n'), ((5106, 5138), 'json.dumps', 'json.dumps', (['prop_dict'], {'indent': '(16)'}), '(prop_dict, inde... |
'''
This is a boilerplate animated plot with sliders
Modified from: https://plot.ly/python/animations/#using-a-slider-and-buttons
'''
from plotly.offline import init_notebook_mode
import plotly
import pandas as pd
init_notebook_mode(connected=True)
url = 'https://raw.githubusercontent.com/plotly/datasets/master/gapm... | [
"plotly.offline.plot",
"plotly.offline.init_notebook_mode",
"pandas.read_csv"
] | [((216, 250), 'plotly.offline.init_notebook_mode', 'init_notebook_mode', ([], {'connected': '(True)'}), '(connected=True)\n', (234, 250), False, 'from plotly.offline import init_notebook_mode\n'), ((348, 364), 'pandas.read_csv', 'pd.read_csv', (['url'], {}), '(url)\n', (359, 364), True, 'import pandas as pd\n'), ((4099... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, <NAME> (<EMAIL>)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | [
"ansible.module_utils.pure.purefa_argument_spec",
"ansible.module_utils.basic.AnsibleModule",
"ansible.module_utils.pure.get_system"
] | [((5079, 5101), 'ansible.module_utils.pure.purefa_argument_spec', 'purefa_argument_spec', ([], {}), '()\n', (5099, 5101), False, 'from ansible.module_utils.pure import get_system, purefa_argument_spec\n'), ((5663, 5718), 'ansible.module_utils.basic.AnsibleModule', 'AnsibleModule', (['argument_spec'], {'supports_check_m... |
from utils.visualization import plot_images
from keras.datasets import cifar10
print('Loading cifar10..')
(X_train, Y_train), (X_test, Y_test) = cifar10.load_data()
print('Plotting..')
plot_images(X_train, Y_train, 10)
| [
"utils.visualization.plot_images",
"keras.datasets.cifar10.load_data"
] | [((147, 166), 'keras.datasets.cifar10.load_data', 'cifar10.load_data', ([], {}), '()\n', (164, 166), False, 'from keras.datasets import cifar10\n'), ((188, 221), 'utils.visualization.plot_images', 'plot_images', (['X_train', 'Y_train', '(10)'], {}), '(X_train, Y_train, 10)\n', (199, 221), False, 'from utils.visualizati... |
# coding: utf-8
import os
import unittest
from datetime import datetime, timedelta
from sanic import Sanic
from sanic.response import json, HTTPResponse
from sanic_jinja2_spf import sanic_jinja2
from spf import SanicPluginsFramework
from sanic_oauthlib.contrib.oauth2 import bind_sqlalchemy, bind_cache_grant
from sanic... | [
"sqlalchemy.orm.relationship",
"sanic_oauthlib.contrib.oauth2.bind_sqlalchemy",
"sqlalchemy.orm.sessionmaker",
"sanic.response.json",
"datetime.datetime.utcnow",
"sanic.response.HTTPResponse",
"spf.SanicPluginsFramework",
"sqlalchemy.create_engine",
"sqlalchemy.ForeignKey",
"sanic_oauthlib.contrib... | [((1311, 1350), 'sqlalchemy.Column', 'sa.Column', (['sa.Integer'], {'primary_key': '(True)'}), '(sa.Integer, primary_key=True)\n', (1320, 1350), True, 'import sqlalchemy as sa\n'), ((1902, 1920), 'sqlalchemy.Column', 'sa.Column', (['sa.Text'], {}), '(sa.Text)\n', (1911, 1920), True, 'import sqlalchemy as sa\n'), ((1941... |
# -*- coding:utf-8 -*-
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except... | [
"django.utils.translation.ugettext_lazy",
"hashlib.md5",
"django.core.context_processors.request.get_host",
"django.core.urlresolvers.reverse",
"django.template.Library",
"urllib.parse.urlencode"
] | [((1175, 1193), 'django.template.Library', 'template.Library', ([], {}), '()\n', (1191, 1193), False, 'from django import template\n'), ((2607, 2620), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (2618, 2620), False, 'import hashlib\n'), ((3094, 3112), 'django.core.context_processors.request.get_host', 'request.get_... |
from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(name='booksread',
version='0.0.1',
description='get all the stats related words from book',
keywords='book word autocomplete suggest data \
Google author chain machine learning \
Umesh Joshi',
aut... | [
"setuptools.setup"
] | [((94, 661), 'setuptools.setup', 'setup', ([], {'name': '"""booksread"""', 'version': '"""0.0.1"""', 'description': '"""get all the stats related words from book"""', 'keywords': '"""book word autocomplete suggest data \t \t\t\tGoogle author chain machine learning \t \t\t\tUmesh Joshi"""', 'author': '"""<NAME>"""', '... |
import os
import zstandard
import json
import jsonlines
import io
import datetime
def json_serial(obj):
"""JSON serializer for objects not serializable by default json code"""
if isinstance(obj, (datetime.datetime,)):
return obj.isoformat()
raise TypeError ("Type %s not serializable" % type(obj))
... | [
"os.makedirs",
"jsonlines.Reader",
"zstandard.ZstdCompressor",
"json.dumps",
"os.path.dirname",
"zstandard.ZstdDecompressor"
] | [((507, 533), 'os.path.dirname', 'os.path.dirname', (['file_path'], {}), '(file_path)\n', (522, 533), False, 'import os\n'), ((673, 722), 'zstandard.ZstdCompressor', 'zstandard.ZstdCompressor', ([], {'level': 'compression_level'}), '(level=compression_level)\n', (697, 722), False, 'import zstandard\n'), ((567, 603), 'o... |
import os
from PIL import Image
from math import ceil, sqrt
from .exceptions import CollageOfZeroFramesError
from .utils import does_path_exists
from typing import List
# Module to create collage from list of images, the
# images are the extracted frames of the input video.
class MakeCollage:
"""
Class t... | [
"PIL.Image.open",
"math.ceil",
"PIL.Image.new",
"math.sqrt",
"os.path.dirname"
] | [((5150, 5181), 'math.ceil', 'ceil', (['(frame_image_width * scale)'], {}), '(frame_image_width * scale)\n', (5154, 5181), False, 'from math import ceil, sqrt\n'), ((5218, 5250), 'math.ceil', 'ceil', (['(frame_image_height * scale)'], {}), '(frame_image_height * scale)\n', (5222, 5250), False, 'from math import ceil, s... |
#! /usr/bin/python
# -*- coding: UTF-8 -*-
"""
作者: 小肥巴巴
简书: https://www.jianshu.com/u/db796a501972
邮箱: <EMAIL>
github: https://github.com/xiaofeipapa/python_example
您可以任意转载, 恳请保留我作为原作者, 谢谢.
"""
import pymysql
from timeit import default_timer
host = 'localhost'
port = 3306
db = 'mysql_test'
use... | [
"timeit.default_timer",
"pymysql.connect"
] | [((418, 492), 'pymysql.connect', 'pymysql.connect', ([], {'host': 'host', 'port': 'port', 'db': 'db', 'user': 'user', 'password': 'password'}), '(host=host, port=port, db=db, user=user, password=password)\n', (433, 492), False, 'import pymysql\n'), ((990, 1005), 'timeit.default_timer', 'default_timer', ([], {}), '()\n'... |
from helper_sql import *
import shared
def insert(t):
sqlExecute('''INSERT INTO inbox VALUES (?,?,?,?,?,?,?,?,?,?)''', *t)
#shouldn't emit changedInboxUnread and displayNewInboxMessage at the same time
#shared.UISignalQueue.put(('changedInboxUnread', None))
def trash(msgid):
sqlExecute('''UPDATE i... | [
"shared.UISignalQueue.put"
] | [((373, 431), 'shared.UISignalQueue.put', 'shared.UISignalQueue.put', (["('removeInboxRowByMsgid', msgid)"], {}), "(('removeInboxRowByMsgid', msgid))\n", (397, 431), False, 'import shared\n')] |
#!/usr/bin/env python
#coding: utf-8
"""
Module representing a pupil.
"""
from sqlalchemy import Column, Integer, String, Boolean, desc
from sqlalchemy.orm import relationship
from pybib.db import Base
from pybib.loan import Loan
MALE = 'male'
FEMALE = 'female'
class Pupil(Base):
__tablename__ = 'pupils'
... | [
"sqlalchemy.Column",
"sqlalchemy.desc"
] | [((327, 360), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (333, 360), False, 'from sqlalchemy import Column, Integer, String, Boolean, desc\n'), ((372, 386), 'sqlalchemy.Column', 'Column', (['String'], {}), '(String)\n', (378, 386), False, 'from sqlalchemy i... |
# Generated by Django 3.0.5 on 2020-04-20 14:41
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auth', '0011_update_proxy_permissions'),
('Cards', '0014_registrationkey'),
]
... | [
"django.db.models.OneToOneField",
"django.db.models.ForeignKey"
] | [((446, 579), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'primary_key': '(True)', 'serialize': '(False)', 'to': 'settings.AUTH_USER_MODEL'}), '(on_delete=django.db.models.deletion.CASCADE,\n primary_key=True, serialize=False, to=settings.AUTH_USE... |
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
from kern import CombinationKernel
from ...util.caching import Cache_this
import itertools
def numpy_invalid_op_as_exception(func):
"""
A decorator that allows catching numpy in... | [
"numpy.zeros",
"numpy.seterr"
] | [((455, 481), 'numpy.seterr', 'np.seterr', ([], {'invalid': '"""raise"""'}), "(invalid='raise')\n", (464, 481), True, 'import numpy as np\n'), ((529, 554), 'numpy.seterr', 'np.seterr', ([], {'invalid': '"""warn"""'}), "(invalid='warn')\n", (538, 554), True, 'import numpy as np\n'), ((2766, 2783), 'numpy.zeros', 'np.zer... |
import json
from typing import Dict, Iterable, List, Optional, Union, cast
import click
from data_pipelines_cli.errors import DockerErrorResponseError
class DockerReadResponse:
"""POD representing Docker response processed by :class:`DockerResponseReader`."""
msg: str
"""Read and processed message"""
... | [
"data_pipelines_cli.errors.DockerErrorResponseError",
"click.echo",
"json.loads",
"typing.cast"
] | [((2715, 2739), 'typing.cast', 'cast', (['str', "log['status']"], {}), "(str, log['status'])\n", (2719, 2739), False, 'from typing import Dict, Iterable, List, Optional, Union, cast\n'), ((3218, 3242), 'typing.cast', 'cast', (['str', "log['stream']"], {}), "(str, log['stream'])\n", (3222, 3242), False, 'from typing imp... |
"""empty message
Revision ID: 500978cd99d3
Revises: <KEY>
Create Date: 2017-06-16 10:12:25.765499
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<KEY>0'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
### commands auto genera... | [
"sqlalchemy.Text",
"alembic.op.drop_column",
"sqlalchemy.dialects.mysql.TEXT"
] | [((444, 480), 'alembic.op.drop_column', 'op.drop_column', (['"""surveys"""', '"""content"""'], {}), "('surveys', 'content')\n", (458, 480), False, 'from alembic import op\n'), ((681, 724), 'alembic.op.drop_column', 'op.drop_column', (['"""surveys"""', '"""content_origin"""'], {}), "('surveys', 'content_origin')\n", (69... |
#!/usr/bin/env python3
import argparse
import json
import os
import sys
from typing import List, Optional
def camel_to_snake(name: str) -> str:
"""Convert CamelCase to snake_case, handling acronyms properly."""
out = name[0].lower()
for c0, c1, c2 in zip(name[:-2], name[1:-1], name[2:]):
# Catch ... | [
"json.loads",
"argparse.ArgumentParser",
"os.path.join",
"os.path.dirname",
"sys.exit"
] | [((7395, 7469), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""generate code with embedded schemas"""'}), "(description='generate code with embedded schemas')\n", (7418, 7469), False, 'import argparse\n'), ((1315, 1344), 'os.path.join', 'os.path.join', (['urlbase', 'urlend'], {}), '(urlb... |
import os
from glob import glob
import time
import json
from PIL import Image
import pandas as pd
import numpy as np
import torchvision as tv
from rsp.data import bilinear_upsample, BANDS
from tifffile import imread as tiffread
from d3m.container import DataFrame as d3m_DataFrame
from d3m.metadata import base as metad... | [
"kf_d3m_primitives.remote_sensing.image_retrieval.image_retrieval_pipeline.ImageRetrievalPipeline",
"PIL.Image.open",
"tifffile.imread",
"d3m.container.DataFrame",
"pandas.DataFrame",
"kf_d3m_primitives.remote_sensing.image_retrieval.image_retrieval.Hyperparams.defaults",
"numpy.arange",
"os.path.join... | [((1542, 1558), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (1550, 1558), True, 'import numpy as np\n'), ((2138, 2160), 'd3m.container.DataFrame', 'd3m_DataFrame', (['imgs_df'], {}), '(imgs_df)\n', (2151, 2160), True, 'from d3m.container import DataFrame as d3m_DataFrame\n'), ((5576, 5632), 'kf_d3m_primi... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 17 10:44:31 2019
@author: hasee
"""
from pystruct.models import EdgeFeatureGraphCRF
from pystruct.learners import FrankWolfeSSVM, OneSlackSSVM
from sklearn.metrics import precision_score, recall_score, f1_score
#from sklearn.externals import joblib
from thre... | [
"numpy.hstack",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"numpy.array",
"os.path.exists",
"numpy.mean",
"pystruct.learners.FrankWolfeSSVM",
"pandas.DataFrame",
"pystruct.models.EdgeFeatureGraphCRF",
"random.shuffle",
"pickle.load",
"gc.collect",
"numpy.std",
"time... | [((4091, 4141), 'pandas.DataFrame', 'pd.DataFrame', (['[]'], {'columns': "['oid', 'pred', 'label']"}), "([], columns=['oid', 'pred', 'label'])\n", (4103, 4141), True, 'import pandas as pd\n'), ((4160, 4179), 'numpy.hstack', 'np.hstack', (['camptest'], {}), '(camptest)\n', (4169, 4179), True, 'import numpy as np\n'), ((... |
import logging
from time import sleep
import pytest
from ocs_ci.framework.pytest_customization.marks import bugzilla, skipif_ocs_version
from ocs_ci.framework.testlib import E2ETest, workloads
from ocs_ci.ocs import defaults, constants
from ocs_ci.ocs.ocp import OCP
from ocs_ci.ocs.quay_operator import (
QuayOper... | [
"logging.getLogger",
"ocs_ci.utility.utils.exec_cmd",
"ocs_ci.framework.pytest_customization.marks.skipif_ocs_version",
"ocs_ci.ocs.quay_operator.get_super_user_token",
"ocs_ci.ocs.quay_operator.create_quay_org",
"ocs_ci.ocs.quay_operator.QuayOperator",
"ocs_ci.framework.pytest_customization.marks.bugzi... | [((566, 593), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (583, 593), False, 'import logging\n'), ((597, 629), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (611, 629), False, 'import pytest\n'), ((679, 693), 'ocs_ci.ocs.quay_operator.Qu... |
''' You can find this exercise at the following website: https://www.practicepython.org/
1. Character Input
Create a program that asks the user to enter their name and their age. Print out a message addressed to them that tells them the year that they will turn 100 years old.
Extras:
Add on to the previous program ... | [
"datetime.date.today"
] | [((778, 790), 'datetime.date.today', 'date.today', ([], {}), '()\n', (788, 790), False, 'from datetime import date\n')] |
import copy
from proxy import Proxy
class ProxyList(list):
"""
A proxy wrapper for a normal Python list.
A lot of functionality is being reproduced from Proxy. Inheriting Proxy would
simplify things a lot but I get type errors when I try to do so. It is not exactly
clear what a partial copy entail... | [
"copy.deepcopy"
] | [((1260, 1284), 'copy.deepcopy', 'copy.deepcopy', (['self._obj'], {}), '(self._obj)\n', (1273, 1284), False, 'import copy\n'), ((1502, 1526), 'copy.deepcopy', 'copy.deepcopy', (['self._obj'], {}), '(self._obj)\n', (1515, 1526), False, 'import copy\n'), ((1749, 1773), 'copy.deepcopy', 'copy.deepcopy', (['self._obj'], {}... |
import numpy as np
from sklearn.linear_model import LinearRegression
x = np.array([29,59,119,238,464,659]).reshape(-1,1)
y = np.array([0.004,0.009,0.027,0.027,0.051,0.165])
model = LinearRegression().fit(x, y)
r_sq = model.score(x, y)
print('coefficient of determination:', r_sq)
| [
"numpy.array",
"sklearn.linear_model.LinearRegression"
] | [((125, 177), 'numpy.array', 'np.array', (['[0.004, 0.009, 0.027, 0.027, 0.051, 0.165]'], {}), '([0.004, 0.009, 0.027, 0.027, 0.051, 0.165])\n', (133, 177), True, 'import numpy as np\n'), ((73, 111), 'numpy.array', 'np.array', (['[29, 59, 119, 238, 464, 659]'], {}), '([29, 59, 119, 238, 464, 659])\n', (81, 111), True, ... |
from cryptography.fernet import Fernet
from django.conf import settings
FERNET = Fernet(settings.DB_ENCRYPTION_KEY)
def fernet_encrypt(s):
"""Encrypt a string using cryptography.fernet"""
return FERNET.encrypt(s.encode("utf-8")).decode("utf-8")
def fernet_decrypt(s):
"""Decrypt a string using cryptogra... | [
"cryptography.fernet.Fernet"
] | [((82, 116), 'cryptography.fernet.Fernet', 'Fernet', (['settings.DB_ENCRYPTION_KEY'], {}), '(settings.DB_ENCRYPTION_KEY)\n', (88, 116), False, 'from cryptography.fernet import Fernet\n')] |
"""
Text the emotion classifier's performance with variable input lenghts / batching
"""
import logging
import dill
import time
import torch
import tqdm
import tests.test_config as config
from objective.emotion import EmotionClassifier
logging.basicConfig(filename='performance.log', level=logging.INFO)
model = t... | [
"logging.basicConfig",
"torch.load",
"objective.emotion.EmotionClassifier",
"time.time",
"dill.load"
] | [((242, 309), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""performance.log"""', 'level': 'logging.INFO'}), "(filename='performance.log', level=logging.INFO)\n", (261, 309), False, 'import logging\n'), ((319, 354), 'torch.load', 'torch.load', (['config.emocl_model_path'], {}), '(config.emocl_model... |
# Copyright 2020 The TensorFlow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
"tensorflow.shape",
"tensorflow.transpose",
"tensorflow.sin",
"tensorflow_graphics.util.shape.get_broadcasted_shape",
"tensorflow_graphics.geometry.transformation.rotation_matrix_common.is_valid",
"tensorflow_graphics.util.shape.check_static",
"tensorflow_graphics.util.export_api.get_functions_and_class... | [((8846, 8884), 'tensorflow_graphics.util.export_api.get_functions_and_classes', 'export_api.get_functions_and_classes', ([], {}), '()\n', (8882, 8884), False, 'from tensorflow_graphics.util import export_api\n'), ((2387, 2406), 'tensorflow.name_scope', 'tf.name_scope', (['name'], {}), '(name)\n', (2400, 2406), True, '... |
import csv
import os
import random
import uuid
import pickle
from multiprocessing import Pool
from collections import Counter
import numpy as np
import imgaug.augmenters as iaa
from PIL import Image
def rotate_save(img, flip, angle, label, new_label_dict, out_dir):
filename = str(uuid.uuid4()) + ".png"
new_l... | [
"os.listdir",
"pickle.dump",
"random.shuffle",
"imgaug.augmenters.Affine",
"os.path.join",
"uuid.uuid4",
"numpy.array",
"multiprocessing.Pool",
"csv.reader"
] | [((1648, 1666), 'os.listdir', 'os.listdir', (['in_dir'], {}), '(in_dir)\n', (1658, 1666), False, 'import os\n'), ((1671, 1692), 'random.shuffle', 'random.shuffle', (['files'], {}), '(files)\n', (1685, 1692), False, 'import random\n'), ((1972, 1980), 'multiprocessing.Pool', 'Pool', (['(16)'], {}), '(16)\n', (1976, 1980)... |
#!/usr/bin/python
import json
import sys
import os
from datetime import datetime
# import pandas as pd
import numpy as np
from sklearn.pipeline import Pipeline
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import LeaveOneGroupOut
from sklearn.svm import LinearSVC
from sklea... | [
"getopt.getopt",
"os.path.join",
"fmri.analogy_rsa.get_model_rdms",
"fmri.analogy_utils.pu.index_img",
"fmri.analogy_utils.pu.data_to_img",
"platform.linux_distribution",
"datetime.datetime.now",
"fmri.analogy_utils.load_betas",
"sys.exit",
"json.load",
"sys.path.append"
] | [((1363, 1395), 'sys.path.append', 'sys.path.append', (["paths['github']"], {}), "(paths['github'])\n", (1378, 1395), False, 'import sys\n'), ((1397, 1427), 'sys.path.append', 'sys.path.append', (["paths['code']"], {}), "(paths['code'])\n", (1412, 1427), False, 'import sys\n'), ((2143, 2184), 'fmri.analogy_rsa.get_mode... |
# -*- coding: utf-8 -*-
from watson.framework import views
from watson.framework.views.decorators import view
class MyController(object):
@view(format='xml')
def xml_action(self, *args, **kwargs):
return {}
@view(format='xml/text')
def xml_full_mime_action(self):
return {}
@view(... | [
"watson.framework.views.decorators.view"
] | [((145, 163), 'watson.framework.views.decorators.view', 'view', ([], {'format': '"""xml"""'}), "(format='xml')\n", (149, 163), False, 'from watson.framework.views.decorators import view\n'), ((231, 254), 'watson.framework.views.decorators.view', 'view', ([], {'format': '"""xml/text"""'}), "(format='xml/text')\n", (235,... |
# Copyright (c) 2016 Baidu, 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 o... | [
"logging.basicConfig",
"logging.getLogger",
"cStringIO.StringIO",
"paddle.proto.DataFormat_pb2.DataHeader",
"paddle.proto.DataFormat_pb2.DataSample",
"google.protobuf.internal.encoder._EncodeVarint"
] | [((771, 869), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""[%(levelname)s %(asctime)s %(filename)s:%(lineno)s] %(message)s"""'}), "(format=\n '[%(levelname)s %(asctime)s %(filename)s:%(lineno)s] %(message)s')\n", (790, 869), False, 'import logging\n'), ((881, 908), 'logging.getLogger', 'logging.... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | [
"logging.getLogger"
] | [((660, 687), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (677, 687), False, 'import logging\n')] |
from django.db import models
from django.forms.models import model_to_dict
class Weighted_Value(models.Model):
class Meta:
abstract = True
def get_weights_as_str(self):
weights = []
has_conditional_weights = False
for weight in self.weights.all():
if not ... | [
"django.db.models.ManyToManyField",
"django.forms.models.model_to_dict",
"django.db.models.ForeignKey"
] | [((924, 972), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['"""Roll"""'], {'related_name': '"""+"""'}), "('Roll', related_name='+')\n", (946, 972), False, 'from django.db import models\n'), ((986, 1034), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['"""Roll"""'], {'related_name': '... |
from typing import List, Optional, Tuple
from django.http import HttpRequest
from django_scim.filters import UserFilterQuery
from zerver.lib.request import RequestNotes
# This is in a separate file due to circular import issues django-scim2 runs into
# when this is placed in zerver.lib.scim.
class ZulipUserFilterQu... | [
"zerver.lib.request.RequestNotes.get_notes"
] | [((2709, 2740), 'zerver.lib.request.RequestNotes.get_notes', 'RequestNotes.get_notes', (['request'], {}), '(request)\n', (2731, 2740), False, 'from zerver.lib.request import RequestNotes\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 8 18:55:26 2020
@author: <NAME> [ahamilos at g.harvard.edu]
This version intended for construction, testing and debugging.
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 8 17:00:42 2020
@author: lilis
"""
import pygam... | [
"pygame.init",
"pygame.quit",
"math.cos",
"math.hypot",
"pygame.time.set_timer",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.mixer.Sound",
"pygame.draw.rect",
"pygame.image.load",
"pygame.display.update",
"pygame.mixer.music.load",
"random.choice",
"pygame.Surface",
"math.r... | [((11371, 11384), 'pygame.init', 'pygame.init', ([], {}), '()\n', (11382, 11384), False, 'import pygame\n'), ((11787, 11882), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(_tableSize[0] + 2 * _tableEdges, _tableSize[1] + 2 * _tableEdges)'], {}), '((_tableSize[0] + 2 * _tableEdges, _tableSize[1] + 2 *\n _... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 26 13:12:28 2021
@author: <NAME> -workshop-LA-UP_IIT
"""
import geopandas as gpd
import fiona,io
from tqdm import tqdm
import pyproj
# pd.set_option('display.max_columns', None)
nanjing_epsg=32650 #Nanjing
data_dic={
'road_network':r'.\data\GIS\road Network Data OF ... | [
"osgeo.gdal.Open",
"numpy.ma.masked_equal",
"pandas.read_csv",
"io.BytesIO",
"earthpy.spatial.stack",
"pyproj.Transformer.from_crs",
"shapely.geometry.Polygon",
"earthpy.plot.plot_bands",
"earthpy.spatial.crop_image",
"copy.deepcopy",
"pandas.read_excel",
"geopandas.points_from_xy",
"xml.etr... | [((2833, 2872), 'geopandas.read_file', 'gpd.read_file', (['kml_extent'], {'driver': '"""KML"""'}), "(kml_extent, driver='KML')\n", (2846, 2872), True, 'import geopandas as gpd\n'), ((2913, 2936), 'pyproj.CRS', 'pyproj.CRS', (['"""EPSG:4326"""'], {}), "('EPSG:4326')\n", (2923, 2936), False, 'import pyproj\n'), ((3082, 3... |
"""
Plot figures for the TreeTime validation, comparison with other methods on the
simulated dataset.
To plot the validation results, CSV files generated by the
'generate_simulated_data.py' script are required.
The script plots the reconstruction of the mutation rate and the tiome of the
most recent common ancestor ... | [
"numpy.mean",
"numpy.median",
"numpy.ones",
"numpy.unique",
"pandas.read_csv",
"matplotlib.pyplot.hlines",
"matplotlib.pyplot.figure",
"plot_defaults.shift_point_by_markersize",
"numpy.std",
"pandas.DataFrame",
"numpy.percentile"
] | [((954, 1001), 'pandas.read_csv', 'pandas.read_csv', (['fname'], {'names': 'columns', 'header': '(0)'}), '(fname, names=columns, header=0)\n', (969, 1001), False, 'import pandas\n'), ((1881, 1928), 'pandas.read_csv', 'pandas.read_csv', (['fname'], {'names': 'columns', 'header': '(0)'}), '(fname, names=columns, header=0... |
import matplotlib.pyplot as plt
def plot_drift_indicating_dimensions_for_point(point, error_per_dimension, plot_title=False, plot_file_name=False,
latex_font=False):
"""
Parameters
----------
point: Index for examined instance in test set
error_per_d... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.title",
"matplotlib.pyplot.rc",
"matplotlib.pyplot.show"
] | [((847, 874), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 7)'}), '(figsize=(12, 7))\n', (857, 874), True, 'import matplotlib.pyplot as plt\n'), ((879, 902), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (892, 902), True, 'import matplotlib.pyplot as plt\n')... |
from geospacelab import preferences
import geospacelab.datahub.sources.madrigal.utilities as utilities
from geospacelab.datahub import DatabaseModel
class WDCDatabase(DatabaseModel):
def __new__(cls, str_in, **kwargs):
obj = super().__new__(cls, str_in, **kwargs)
return obj
wdc_database = WDCDa... | [
"geospacelab.preferences.set_user_config"
] | [((1546, 1610), 'geospacelab.preferences.set_user_config', 'preferences.set_user_config', ([], {'user_config': 'uc', 'set_as_default': '(True)'}), '(user_config=uc, set_as_default=True)\n', (1573, 1610), False, 'from geospacelab import preferences\n')] |
import cv2
import numpy as np
import sys
sys.path.append('build')
import kosutils
from tracker import *
# Setting the dimensions for output window
H = 700
W = 700
dispWindow = np.zeros((H,W,3),dtype=np.uint8)
PREDICTOR_PATH = "../shape_predictor_5_face_landmarks.dat"
# Creating the object for obj3D class
obj1 = kos... | [
"numpy.copy",
"cv2.flip",
"kosutils.kos_Obj3D",
"numpy.zeros",
"cv2.VideoCapture",
"sys.path.append",
"kosutils.kos_vcam"
] | [((42, 66), 'sys.path.append', 'sys.path.append', (['"""build"""'], {}), "('build')\n", (57, 66), False, 'import sys\n'), ((179, 214), 'numpy.zeros', 'np.zeros', (['(H, W, 3)'], {'dtype': 'np.uint8'}), '((H, W, 3), dtype=np.uint8)\n', (187, 214), True, 'import numpy as np\n'), ((317, 357), 'kosutils.kos_Obj3D', 'kosuti... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Generate T2* map from multi-echo BOLD images
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autofunction:: init_bold_t2s_wf
"""
from nipype import logging
from nipype.pipeline... | [
"niworkflows.engine.workflows.LiterateWorkflow",
"nipype.interfaces.utility.IdentityInterface",
"nipype.logging.getLogger"
] | [((572, 608), 'nipype.logging.getLogger', 'logging.getLogger', (['"""nipype.workflow"""'], {}), "('nipype.workflow')\n", (589, 608), False, 'from nipype import logging\n'), ((2065, 2084), 'niworkflows.engine.workflows.LiterateWorkflow', 'Workflow', ([], {'name': 'name'}), '(name=name)\n', (2073, 2084), True, 'from niwo... |
######################################################################################################################
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | [
"boto_retry.add_retry_methods_to_resource",
"services.get_session",
"os.getenv",
"datetime.datetime.utcnow",
"main.lambda_handler",
"helpers.dynamodb.unpack_record",
"helpers.full_stack",
"handlers.run_as_ecs_job",
"handlers.get_item_resource_data",
"datetime.datetime.now",
"handlers.running_loc... | [((4543, 4560), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (4558, 4560), False, 'from datetime import datetime\n'), ((5097, 5128), 'handlers.running_local', 'handlers.running_local', (['context'], {}), '(context)\n', (5119, 5128), False, 'import handlers\n'), ((6794, 6826), 'actions.get_action_cla... |
import copy
from typing import Tuple
from hypothesis import given
from tests.bind_tests.hints import BoundOperation
from tests.integration_tests.utils import are_bound_ported_operations_equal
from tests.port_tests.hints import PortedOperation
from . import strategies
@given(strategies.operations_pairs)
def test_sha... | [
"hypothesis.given",
"copy.copy",
"copy.deepcopy"
] | [((273, 307), 'hypothesis.given', 'given', (['strategies.operations_pairs'], {}), '(strategies.operations_pairs)\n', (278, 307), False, 'from hypothesis import given\n'), ((576, 610), 'hypothesis.given', 'given', (['strategies.operations_pairs'], {}), '(strategies.operations_pairs)\n', (581, 610), False, 'from hypothes... |
from torch.utils.data import Dataset
import torch
from torchvision import transforms
import cv2 as cv
from PIL import Image
import librosa
import os
import numpy as np
def one_hot_encode(x, size):
temp = [0] * size
temp[x] = 1
return temp
from videotransforms.video_transforms import Compose, Resize, Rando... | [
"PIL.Image.fromarray",
"os.listdir",
"videotransforms.video_transforms.Resize",
"videotransforms.volume_transforms.ClipToTensor",
"numpy.array",
"videotransforms.video_transforms.ColorJitter",
"cv2.VideoCapture",
"videotransforms.video_transforms.Compose",
"videotransforms.video_transforms.RandomRot... | [((718, 743), 'os.listdir', 'os.listdir', (['self.root_dir'], {}), '(self.root_dir)\n', (728, 743), False, 'import os\n'), ((1120, 1149), 'videotransforms.video_transforms.Compose', 'Compose', (['video_transform_list'], {}), '(video_transform_list)\n', (1127, 1149), False, 'from videotransforms.video_transforms import ... |
# Mathy utility code
import re
import time
import math
def sin_variate(min_val, max_val, period_ms):
t = time.time() * 1000
t %= period_ms # t in [0, period_ms]
t -= period_ms / 2 # t in [-period_ms/2, period_ms/2]
t /= period_ms # t in [-1/2, 1/2]
t *= math.pi * ... | [
"re.sub",
"math.sin",
"time.time",
"math.sqrt"
] | [((359, 370), 'math.sin', 'math.sin', (['t'], {}), '(t)\n', (367, 370), False, 'import math\n'), ((2758, 2798), 're.sub', 're.sub', (['"""(.)([A-Z][a-z]+)"""', '"""\\\\1_\\\\2"""', 's'], {}), "('(.)([A-Z][a-z]+)', '\\\\1_\\\\2', s)\n", (2764, 2798), False, 'import re\n'), ((110, 121), 'time.time', 'time.time', ([], {})... |
from django.contrib import admin
from .models import RBAResponse, BankInfo
class RBAResponseAdmin(admin.ModelAdmin):
list_display = [
'receipt_id',
'sender',
'recipient',
'amount',
'date',
'description',
'currencyCode',
'commissionRate'
]
clas... | [
"django.contrib.admin.site.register"
] | [((621, 671), 'django.contrib.admin.site.register', 'admin.site.register', (['RBAResponse', 'RBAResponseAdmin'], {}), '(RBAResponse, RBAResponseAdmin)\n', (640, 671), False, 'from django.contrib import admin\n'), ((672, 716), 'django.contrib.admin.site.register', 'admin.site.register', (['BankInfo', 'BankInfoAdmin'], {... |
# -*- coding: utf-8 -*-
# @Time : 2020/3/23 下午3:30
# @Author : RegiusQuant <<EMAIL>>
# @Project : nlp-practice
# @File : learner.py
# @Desc : 说明
from core import *
from callbacks import CallbackContainer, HistoryCallback
from metrics import BinaryAccuracy
class TextClassificationLearner:
def __init__(s... | [
"callbacks.CallbackContainer",
"metrics.BinaryAccuracy",
"callbacks.HistoryCallback"
] | [((686, 702), 'metrics.BinaryAccuracy', 'BinaryAccuracy', ([], {}), '()\n', (700, 702), False, 'from metrics import BinaryAccuracy\n'), ((742, 759), 'callbacks.HistoryCallback', 'HistoryCallback', ([], {}), '()\n', (757, 759), False, 'from callbacks import CallbackContainer, HistoryCallback\n'), ((794, 827), 'callbacks... |
from selenium.webdriver.support.ui import WebDriverWait
class BasePage:
def __init__(self, selenium_driver, url):
self.driver = selenium_driver
self.url = url
self.implicit_wait_time_seconds = 5
self.driver.implicitly_wait(self.implicit_wait_time_seconds)
self.explicit_wai... | [
"selenium.webdriver.support.ui.WebDriverWait"
] | [((404, 499), 'selenium.webdriver.support.ui.WebDriverWait', 'WebDriverWait', (['self.driver', 'self.explicit_wait_time_seconds', 'self.polling_interval_seconds'], {}), '(self.driver, self.explicit_wait_time_seconds, self.\n polling_interval_seconds)\n', (417, 499), False, 'from selenium.webdriver.support.ui import ... |
from pyspark import SparkConf, SparkContext
import subprocess
n_cpu = 38
conf = SparkConf().setAppName('abc').setMaster(f'local[{n_cpu}]')
sc = SparkContext.getOrCreate(conf=conf)
num_tr = 69
num_te = 5
dir_path = '/data/hla_data/train_test'
trlst = [f'train_sample_{i}' for i in range(num_tr)]
telst = [f'test_sampl... | [
"pyspark.SparkConf",
"subprocess.call",
"pyspark.SparkContext.getOrCreate"
] | [((145, 180), 'pyspark.SparkContext.getOrCreate', 'SparkContext.getOrCreate', ([], {'conf': 'conf'}), '(conf=conf)\n', (169, 180), False, 'from pyspark import SparkConf, SparkContext\n'), ((969, 1029), 'subprocess.call', 'subprocess.call', (['pos_cmd'], {'executable': '"""/bin/bash"""', 'shell': '(True)'}), "(pos_cmd, ... |
from django.contrib import (
admin,
messages
)
from django.core.exceptions import ValidationError
from .models import (
Event,
Speaker,
EventType,
EventInstance,
EventLocation,
EventTrack,
SpeakerProposal,
EventProposal,
Favorite,
UrlType,
Url
)
@admin.register(Sp... | [
"django.contrib.messages.error",
"django.contrib.admin.register"
] | [((303, 334), 'django.contrib.admin.register', 'admin.register', (['SpeakerProposal'], {}), '(SpeakerProposal)\n', (317, 334), False, 'from django.contrib import admin, messages\n'), ((894, 923), 'django.contrib.admin.register', 'admin.register', (['EventProposal'], {}), '(EventProposal)\n', (908, 923), False, 'from dj... |
from django.shortcuts import render
from faker import Factory
from django.http import JsonResponse
from django.conf import settings
from twilio.rest import Client
from twilio.jwt.access_token import AccessToken
from twilio.jwt.access_token.grants import (
SyncGrant,
ChatGrant
)
from users.models import Profile... | [
"django.shortcuts.render",
"twilio.jwt.access_token.grants.SyncGrant",
"twilio.jwt.access_token.grants.ChatGrant",
"twilio.jwt.access_token.AccessToken"
] | [((377, 413), 'django.shortcuts.render', 'render', (['request', '"""twilio/index.html"""'], {}), "(request, 'twilio/index.html')\n", (383, 413), False, 'from django.shortcuts import render\n'), ((1164, 1228), 'twilio.jwt.access_token.AccessToken', 'AccessToken', (['account_sid', 'api_sid', 'api_secret'], {'identity': '... |
import mysql.connector
from mysql.connector import errorcode
from db import db
class mutual_diary(db.Model):
__tablename__ = 'mutual_diary'
id = db.Column(db.Integer, PRIMARY_KEY = True,autoincrement=True)
diaryname = db.Column(db.VARCHAR(50))
shortdescription = db.Column(db.VARCHAR(240))
... | [
"db.db.VARCHAR",
"db.db.Column"
] | [((162, 221), 'db.db.Column', 'db.Column', (['db.Integer'], {'PRIMARY_KEY': '(True)', 'autoincrement': '(True)'}), '(db.Integer, PRIMARY_KEY=True, autoincrement=True)\n', (171, 221), False, 'from db import db\n'), ((336, 359), 'db.db.Column', 'db.Column', (['db.TIMESTAMP'], {}), '(db.TIMESTAMP)\n', (345, 359), False, '... |
import os
import math
import mantle as mantle
import magma as m
def run_cmd(cmd):
res = os.system(cmd)
assert(res == 0)
def power_log(x):
return 2**(math.ceil(math.log(x, 2)))
def equals_cmp(a, b, width):
eqC = mantle.EQ(width)
m.wire(eqC.I0, a)
m.wire(eqC.I1, b)
... | [
"magma.In",
"mantle.Register",
"math.ceil",
"mantle.And",
"magma.uint",
"math.log",
"mantle.EQ",
"mantle.Mux",
"magma.Bits",
"magma.bitutils.int2seq",
"magma.bitutils.seq2int",
"os.system",
"magma.wire"
] | [((99, 113), 'os.system', 'os.system', (['cmd'], {}), '(cmd)\n', (108, 113), False, 'import os\n'), ((250, 266), 'mantle.EQ', 'mantle.EQ', (['width'], {}), '(width)\n', (259, 266), True, 'import mantle as mantle\n'), ((275, 292), 'magma.wire', 'm.wire', (['eqC.I0', 'a'], {}), '(eqC.I0, a)\n', (281, 292), True, 'import ... |
import argparse
from typing import Callable
# noinspection PyUnresolvedReferences
import torch
from optimize import optimize
from plot import plot_path, plot_function, show_plot
def make_func(s: str) -> Callable:
"""Parse the function that was given as a string via command line."""
def func(v):
ret... | [
"argparse.ArgumentParser",
"plot.plot_path",
"optimize.optimize",
"plot.show_plot",
"plot.plot_function"
] | [((440, 465), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (463, 465), False, 'import argparse\n'), ((1567, 1697), 'optimize.optimize', 'optimize', (['func', 'parsed.start', 'parsed.num_iter', 'parsed.lr', 'parsed.beta_g', 'parsed.beta_h', 'parsed.hessian_pow', 'parsed.num_samples'], {}), '(f... |
import sys
import matplotlib
#matplotlib.use('Agg')
matplotlib.use('TkAgg') # revert above
import matplotlib.pyplot as plt
import os
import numpy as np
import glob
def ballistic_flight(v0, g, t):
# assumes perfectly verticle launch and are matching units
# v0-initial velocity
# g-gravitational acceleration... | [
"matplotlib.use",
"numpy.linspace",
"matplotlib.pyplot.plot",
"numpy.where"
] | [((52, 75), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (66, 75), False, 'import matplotlib\n'), ((643, 668), 'numpy.linspace', 'np.linspace', (['(0)', '(500)', '(1000)'], {}), '(0, 500, 1000)\n', (654, 668), True, 'import numpy as np\n'), ((707, 727), 'matplotlib.pyplot.plot', 'plt.plot',... |
import itertools
from contextlib import suppress
from copy import deepcopy
from pymongo import MongoClient
from tinydb_serialization import SerializationMiddleware
from tinymongo import TinyMongoClient
from tinymongo.serializers import DateTimeSerializer
from tinymongo.tinymongo import generate_id
from quokka.utils.t... | [
"tinydb_serialization.SerializationMiddleware",
"itertools.chain",
"tinymongo.serializers.DateTimeSerializer",
"quokka.utils.text.split_all_category_roots",
"tinymongo.tinymongo.generate_id",
"contextlib.suppress",
"copy.deepcopy",
"pymongo.MongoClient"
] | [((466, 491), 'tinydb_serialization.SerializationMiddleware', 'SerializationMiddleware', ([], {}), '()\n', (489, 491), False, 'from tinydb_serialization import SerializationMiddleware\n'), ((3772, 3785), 'tinymongo.tinymongo.generate_id', 'generate_id', ([], {}), '()\n', (3783, 3785), False, 'from tinymongo.tinymongo i... |
from torchtext.data import BucketIterator, Field
from textformer.datasets.translation import TranslationDataset
# Defines the device which should be used, e.g., `cpu` or `cuda`
device = 'cpu'
# Defines the input file
file_path = 'data/translation/europarl'
# Defines datatypes for further tensor conversion
source = ... | [
"torchtext.data.BucketIterator.splits",
"torchtext.data.Field",
"textformer.datasets.translation.TranslationDataset.splits"
] | [((320, 376), 'torchtext.data.Field', 'Field', ([], {'init_token': '"""<sos>"""', 'eos_token': '"""<eos>"""', 'lower': '(True)'}), "(init_token='<sos>', eos_token='<eos>', lower=True)\n", (325, 376), False, 'from torchtext.data import BucketIterator, Field\n'), ((386, 442), 'torchtext.data.Field', 'Field', ([], {'init_... |
import pytesseract
import cv2
import numpy as np
pytesseract.pytesseract.tesseract_cmd = "C:/Program Files/Tesseract-OCR/tesseract.exe"
# Error prevention code
def ocr_from_img(path):
img_array = np.fromfile(path, np.uint8)
#한글경로 오류 방지 코드
img = cv2.imdecode(img_array, cv2.IMREAD_UNCHANGED) # img = cv2... | [
"numpy.fromfile",
"cv2.adaptiveThreshold",
"cv2.imdecode",
"pytesseract.image_to_string",
"cv2.cvtColor"
] | [((203, 230), 'numpy.fromfile', 'np.fromfile', (['path', 'np.uint8'], {}), '(path, np.uint8)\n', (214, 230), True, 'import numpy as np\n'), ((260, 305), 'cv2.imdecode', 'cv2.imdecode', (['img_array', 'cv2.IMREAD_UNCHANGED'], {}), '(img_array, cv2.IMREAD_UNCHANGED)\n', (272, 305), False, 'import cv2\n'), ((346, 383), 'c... |
"ICECREAM"
import bottle
from distutils.util import strtobool
from sqlalchemy.orm import Session
from ICECREAM.file_handler import upload
from ICECREAM.paginator import Paginate
from ICECREAM.validators import validate_data
from app_user.messages import ACTIVATED_MSG, DEACTIVATED_MSG, DELETE_IMG, PASSWORD_CHANGED, OLD_... | [
"ICECREAM.rbac.get_rules_json",
"ICECREAM.rbac.get_roles_json",
"distutils.util.strtobool",
"ICECREAM.models.query.get_or_create",
"ICECREAM.paginator.Paginate",
"ICECREAM.models.query.is_object_exist_409",
"app_user.schemas.person_image_serializer.dump",
"ICECREAM.models.query.set_objects_limit",
"... | [((858, 883), 'bottle.request.get_user', 'bottle.request.get_user', ([], {}), '()\n', (881, 883), False, 'import bottle\n'), ((964, 998), 'app_user.schemas.user_serializer.dump', 'user_serializer.dump', (['current_user'], {}), '(current_user)\n', (984, 998), False, 'from app_user.schemas import users_serializer, user_s... |
#! /usr/bin/env python
import os
import subprocess
from .contexts import cd
from .unix import is_linux, is_osx
from .url import download_url
def miniconda_url(version="latest", python="", url=None):
if python not in ["", "2", "3"]:
raise ValueError("Python version not understood")
url = url or "http:... | [
"os.path.abspath",
"os.path.exists",
"os.path.join",
"subprocess.check_call"
] | [((782, 805), 'os.path.abspath', 'os.path.abspath', (['prefix'], {}), '(prefix)\n', (797, 805), False, 'import os\n'), ((827, 863), 'os.path.join', 'os.path.join', (['prefix', '"""var"""', '"""cache"""'], {}), "(prefix, 'var', 'cache')\n", (839, 863), False, 'import os\n'), ((1016, 1050), 'os.path.join', 'os.path.join'... |
import time
import warnings
from sc3nb.sc_objects.node import AddAction, Group, GroupInfo, Synth
from tests.conftest import SCBaseTest
class GroupTest(SCBaseTest):
__test__ = True
def setUp(self) -> None:
with self.assertRaises(RuntimeError):
GroupTest.sc.lang
warnings.simplefil... | [
"sc3nb.sc_objects.node.Group",
"time.sleep",
"warnings.simplefilter",
"time.time",
"sc3nb.sc_objects.node.Synth"
] | [((302, 346), 'warnings.simplefilter', 'warnings.simplefilter', (['"""always"""', 'UserWarning'], {}), "('always', UserWarning)\n", (323, 346), False, 'import warnings\n'), ((402, 434), 'sc3nb.sc_objects.node.Group', 'Group', ([], {'nodeid': 'self.custom_nodeid'}), '(nodeid=self.custom_nodeid)\n', (407, 434), False, 'f... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import copy
import traceback
from pathlib import Path
from typing import Any, Dict, List
from classy_vision.generic.re... | [
"traceback.format_stack",
"copy.deepcopy",
"classy_vision.generic.registry_utils.import_all_modules",
"pathlib.Path"
] | [((3030, 3082), 'classy_vision.generic.registry_utils.import_all_modules', 'import_all_modules', (['FILE_ROOT', '"""classy_vision.hooks"""'], {}), "(FILE_ROOT, 'classy_vision.hooks')\n", (3048, 3082), False, 'from classy_vision.generic.registry_utils import import_all_modules\n'), ((482, 496), 'pathlib.Path', 'Path', (... |
#!/usr/bin/env python3
import os
import singer
from singer import utils
from singer.catalog import Catalog, CatalogEntry, Schema
from . import streams as streams_
from .context import Context
REQUIRED_CONFIG_KEYS = ["start_date", "api_key", "api_secret"]
LOGGER = singer.get_logger()
def get_abs_path(path):
retur... | [
"singer.catalog.Catalog.from_dict",
"singer.get_logger",
"singer.utils.parse_args",
"os.path.realpath",
"singer.resolve_schema_references",
"singer.catalog.CatalogEntry",
"singer.catalog.Catalog"
] | [((265, 284), 'singer.get_logger', 'singer.get_logger', ([], {}), '()\n', (282, 284), False, 'import singer\n'), ((999, 1010), 'singer.catalog.Catalog', 'Catalog', (['[]'], {}), '([])\n', (1006, 1010), False, 'from singer.catalog import Catalog, CatalogEntry, Schema\n'), ((2040, 2078), 'singer.utils.parse_args', 'utils... |
import unittest
from biothings_explorer.registry import Registry
from biothings_explorer.user_query_dispatcher import SingleEdgeQueryDispatcher
from .utils import get_apis
reg = Registry()
class TestSingleHopQuery(unittest.TestCase):
def test_cell2protein(self):
"""Test gene-protein"""
seqd = Sin... | [
"biothings_explorer.user_query_dispatcher.SingleEdgeQueryDispatcher",
"biothings_explorer.registry.Registry"
] | [((179, 189), 'biothings_explorer.registry.Registry', 'Registry', ([], {}), '()\n', (187, 189), False, 'from biothings_explorer.registry import Registry\n'), ((317, 442), 'biothings_explorer.user_query_dispatcher.SingleEdgeQueryDispatcher', 'SingleEdgeQueryDispatcher', ([], {'output_cls': '"""Protein"""', 'input_cls': ... |
import numpy as np
import math
def _t(x):
return [[x[i][j] for i in range(len(x))] for j in range(len(x[0]))]
class Geometry:
@classmethod
def fromobjstr(cls, code, flip=False):
from .loader import readobj
from io import BytesIO
obj = readobj(BytesIO(code))
if flip:
... | [
"taichi_three.reset",
"taichi_three.GUI",
"taichi_three.Light",
"io.BytesIO",
"math.cos",
"numpy.array",
"taichi_three.readobj",
"numpy.linalg.norm",
"taichi_three.Scene",
"numpy.arange",
"numpy.cross",
"numpy.linspace",
"taichi_three.Vector",
"numpy.concatenate",
"numpy.meshgrid",
"nu... | [((4620, 4668), 'numpy.concatenate', 'np.concatenate', (["[obj['vp'], other['vp']]"], {'axis': '(0)'}), "([obj['vp'], other['vp']], axis=0)\n", (4634, 4668), True, 'import numpy as np\n'), ((4685, 4733), 'numpy.concatenate', 'np.concatenate', (["[obj['vn'], other['vn']]"], {'axis': '(0)'}), "([obj['vn'], other['vn']], ... |
#!/bin/python3
from contextlib import contextmanager
# pip3 install datetime
import datetime
import errno
import time
import shutil
import sys
import tempfile
from os import listdir, sep as os_sep
from os.path import isdir, isfile, join
# local imports
import consts
from args import Arguments, UpdateType
from github ... | [
"utils.write_msg",
"utils.push",
"sys.exit",
"utils.check_if_up_to_date",
"utils.checkout_target_branch",
"utils.create_pull_request",
"utils.exec_command_and_print_error",
"utils.revert_changes",
"os.listdir",
"utils.write_error",
"globals.SEARCH_INDEX.append",
"my_toml.TomlHandler",
"args.... | [((976, 994), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (992, 994), False, 'import tempfile\n'), ((3960, 3987), 'utils.get_file_content', 'get_file_content', (['file_path'], {}), '(file_path)\n', (3976, 3987), False, 'from utils import checkout_target_branch, get_file_content, write_error, write_into_fi... |
import json
import os
import sys
from datetime import date, datetime
import numpy as np
import pandas as pd
from dateutil import rrule
from config import *
class Krypfolio:
def __init__(self, debug=True) -> None:
super().__init__()
self.debug = debug
def _print(self, msg):
if self.d... | [
"os.path.exists",
"numpy.abs",
"dateutil.rrule.rrule",
"datetime.datetime.strptime",
"os.mkdir",
"pandas.DataFrame",
"datetime.date.today"
] | [((3771, 3807), 'datetime.datetime.strptime', 'datetime.strptime', (['start', '"""%Y-%m-%d"""'], {}), "(start, '%Y-%m-%d')\n", (3788, 3807), False, 'from datetime import date, datetime\n'), ((3824, 3836), 'datetime.date.today', 'date.today', ([], {}), '()\n', (3834, 3836), False, 'from datetime import date, datetime\n'... |
from pyramid.config import Configurator
from views import home_views
from views import package_views
from common.logger import getLogger
logger = getLogger(__name__)
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
logger.info('= main :: settings = %s', sett... | [
"pyramid.config.Configurator",
"common.logger.getLogger"
] | [((148, 167), 'common.logger.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (157, 167), False, 'from common.logger import getLogger\n'), ((340, 371), 'pyramid.config.Configurator', 'Configurator', ([], {'settings': 'settings'}), '(settings=settings)\n', (352, 371), False, 'from pyramid.config import Confi... |
import numpy as np
from numpy.testing import assert_equal
import pandas as pd
from pandas.testing import assert_frame_equal, assert_series_equal
import pytest
from linearmodels.iv.data import IVData
try:
import xarray as xr
MISSING_XARRAY = False
except ImportError:
MISSING_XARRAY = True
def test_numpy... | [
"pandas.Series",
"numpy.testing.assert_equal",
"numpy.ones",
"numpy.arange",
"pandas.Categorical",
"numpy.random.randn",
"numpy.empty",
"pytest.raises",
"xarray.DataArray",
"pytest.mark.skipif",
"pandas.DataFrame",
"pandas.testing.assert_frame_equal",
"linearmodels.iv.data.IVData",
"pandas... | [((2017, 2082), 'pytest.mark.skipif', 'pytest.mark.skipif', (['MISSING_XARRAY'], {'reason': '"""xarray not installed"""'}), "(MISSING_XARRAY, reason='xarray not installed')\n", (2035, 2082), False, 'import pytest\n'), ((2856, 2921), 'pytest.mark.skipif', 'pytest.mark.skipif', (['MISSING_XARRAY'], {'reason': '"""xarray ... |
import sys, os, json
import tensorflow as tf
from worker import *
from getpass import getpass
def print_msg(msg, typ=None, onLine=False):
"""Print msg in specific format by it type"""
end_ = '\n'
TXTEND = '\033[0m'
TXTBOLD = '\033[1m'
TXTCLEAR = '\033[0K'
if typ == 'step':
msg = T... | [
"tensorflow.distribute.OneDeviceStrategy",
"tensorflow.distribute.HierarchicalCopyAllReduce",
"tensorflow.distribute.experimental.MultiWorkerMirroredStrategy",
"getpass.getpass",
"sys.exit"
] | [((1148, 1191), 'tensorflow.distribute.OneDeviceStrategy', 'tf.distribute.OneDeviceStrategy', (['devices[0]'], {}), '(devices[0])\n', (1179, 1191), True, 'import tensorflow as tf\n'), ((2545, 2596), 'getpass.getpass', 'getpass', (['f"""Please enter Password for host {host}: """'], {}), "(f'Please enter Password for hos... |
import scipy as sp
import scipy.linalg as la
'''
The Newton's lab in applications needed an overloaded newtons method function
When I found that python didn't have function overloading, this is what I came
up with. I don't really like it though
'''
def newtonsMethod( *args):
f = None
df = None
x0 = None
tol = Non... | [
"timer.timer",
"scipy.derivative",
"scipy.array",
"scipy.sin",
"scipy.cos",
"scipy.absolute"
] | [((649, 664), 'timer.timer', 'timer', ([], {'loops': '(10)'}), '(loops=10)\n', (654, 664), False, 'from timer import timer\n'), ((3243, 3258), 'timer.timer', 'timer', ([], {'loops': '(10)'}), '(loops=10)\n', (3248, 3258), False, 'from timer import timer\n'), ((3509, 3534), 'scipy.array', 'sp.array', (['[[0.75], [0.5]]'... |
from typing import Type, TypeVar
from django_client_framework.models.abstract.serializable import (
ISerializable,
Serializable,
)
from .base_model_api import BaseModelAPI
from .model_collection_api import ModelCollectionAPI
from .model_object_api import ModelObjectAPI
from .related_model_api import RelatedMo... | [
"typing.TypeVar"
] | [((332, 373), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': '"""Type[ISerializable]"""'}), "('T', bound='Type[ISerializable]')\n", (339, 373), False, 'from typing import Type, TypeVar\n')] |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from mixbox import entities, fields, idgen
from cybox import Unicode
import cybox.bindings.cybox_core as core_binding
from cybox.common import MeasureSource, ObjectProperties, StructuredText
from cybox.core import ... | [
"mixbox.fields.IdrefField",
"mixbox.fields.TypedField",
"mixbox.fields.IdField",
"mixbox.idgen.create_id",
"cybox.core.Object"
] | [((1882, 1934), 'mixbox.fields.TypedField', 'fields.TypedField', (['"""Keyword"""', 'Unicode'], {'multiple': '(True)'}), "('Keyword', Unicode, multiple=True)\n", (1899, 1934), False, 'from mixbox import entities, fields, idgen\n'), ((2142, 2162), 'mixbox.fields.IdField', 'fields.IdField', (['"""id"""'], {}), "('id')\n"... |
# utility functions such as statistics
import skimage.io as io
import json
import argparse
import numpy as np
import os
def get_subset_stats(json_path):
"""
Calculate the statistics of subset dataset
Args:
json_path: A path to subset json file
"""
with open(json_path) as json_f... | [
"os.listdir",
"argparse.ArgumentParser",
"os.path.join",
"numpy.max",
"numpy.empty",
"skimage.io.imsave",
"numpy.nonzero",
"numpy.min",
"json.load",
"numpy.round"
] | [((1507, 1530), 'os.listdir', 'os.listdir', (['metric_path'], {}), '(metric_path)\n', (1517, 1530), False, 'import os\n'), ((4299, 4313), 'numpy.round', 'np.round', (['mask'], {}), '(mask)\n', (4307, 4313), True, 'import numpy as np\n'), ((4327, 4343), 'numpy.nonzero', 'np.nonzero', (['mask'], {}), '(mask)\n', (4337, 4... |
import asyncio
import functools
import json
import time
from collections import Counter, defaultdict, deque
from fractions import Fraction
from typing import Dict, List, Optional, Tuple, Union
from quarkchain.cluster.filter import Filter
from quarkchain.cluster.miner import validate_seal
from quarkchain.cluster.neighb... | [
"quarkchain.utils.Logger.debug",
"quarkchain.genesis.GenesisManager",
"quarkchain.core.MinorBlockHeader",
"quarkchain.core.MinorBlockMeta",
"quarkchain.utils.time_ms",
"collections.deque",
"quarkchain.core.Address",
"quarkchain.cluster.shard_db_operator.ShardDbOperator",
"quarkchain.evm.utils.add_di... | [((69320, 69351), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': '(16)'}), '(maxsize=16)\n', (69339, 69351), False, 'import functools\n'), ((7566, 7711), 'quarkchain.core.XshardTxCursorInfo', 'XshardTxCursorInfo', ([], {'root_block_height': 'root_block_height', 'minor_block_index': 'self.mblock_index', ... |
import numpy as np
from tsfuse.transformers.uniqueness import *
from tsfuse.data import Collection
def test_has_duplicate_true():
x = Collection.from_array([1, 2, 3, 3])
actual = HasDuplicate().transform(x).values
np.testing.assert_equal(actual, True)
def test_has_duplicate_false():
x = Collection.... | [
"numpy.testing.assert_equal",
"tsfuse.data.Collection.from_array"
] | [((141, 176), 'tsfuse.data.Collection.from_array', 'Collection.from_array', (['[1, 2, 3, 3]'], {}), '([1, 2, 3, 3])\n', (162, 176), False, 'from tsfuse.data import Collection\n'), ((229, 266), 'numpy.testing.assert_equal', 'np.testing.assert_equal', (['actual', '(True)'], {}), '(actual, True)\n', (252, 266), True, 'imp... |
import asyncio
import json
import time
from collections.abc import Mapping
from datetime import datetime, timedelta
from enum import IntEnum, unique
from functools import singledispatch
from logging import getLogger
from pprint import pformat
from typing import Union, Optional, Any, Callable, Dict, Iterable
from warnin... | [
"logging.getLogger",
"datetime.datetime",
"datetime.datetime.utcfromtimestamp",
"datetime.datetime.utcnow",
"json.dumps",
"datetime.datetime.now",
"warnings.warn"
] | [((484, 503), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (493, 503), False, 'from logging import getLogger\n'), ((1346, 1374), 'datetime.datetime.utcfromtimestamp', 'datetime.utcfromtimestamp', (['(0)'], {}), '(0)\n', (1371, 1374), False, 'from datetime import datetime, timedelta\n'), ((958, ... |
from paiargparse import PAIArgumentParser
from tfaip.util.logging import logger
from calamari_ocr.ocr.training.cross_fold_trainer import (
CrossFoldTrainer,
CrossFoldTrainerParams,
)
logger = logger(__name__)
def run():
return main(parse_args())
def parse_args(args=None):
parser = PAIArgumentParse... | [
"calamari_ocr.ocr.training.cross_fold_trainer.CrossFoldTrainer",
"paiargparse.PAIArgumentParser",
"calamari_ocr.ocr.training.cross_fold_trainer.CrossFoldTrainerParams",
"tfaip.util.logging.logger",
"tfaip.util.logging.logger.info"
] | [((202, 218), 'tfaip.util.logging.logger', 'logger', (['__name__'], {}), '(__name__)\n', (208, 218), False, 'from tfaip.util.logging import logger\n'), ((304, 323), 'paiargparse.PAIArgumentParser', 'PAIArgumentParser', ([], {}), '()\n', (321, 323), False, 'from paiargparse import PAIArgumentParser\n'), ((856, 880), 'ca... |
import sys
import unittest
import pendulum
from src import (
Stocks,
StocksCommandService,
)
from minos.networks import (
InMemoryRequest,
Response,
)
from tests.utils import (
build_dependency_injector,
)
class TestStocksCommandService(unittest.IsolatedAsyncioTestCase):
def setUp(self) -> N... | [
"unittest.main",
"tests.utils.build_dependency_injector",
"src.StocksCommandService",
"pendulum.now"
] | [((1054, 1069), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1067, 1069), False, 'import unittest\n'), ((349, 376), 'tests.utils.build_dependency_injector', 'build_dependency_injector', ([], {}), '()\n', (374, 376), False, 'from tests.utils import build_dependency_injector\n'), ((616, 638), 'src.StocksCommandSe... |
from unittest import TestCase
from doctest import DocTestSuite
from cr8.engine import eval_fail_if, Result, FailIf, TimedStats
from cr8.metrics import Stats
from cr8 import engine
class FailIfTest(TestCase):
def test_fail_if_fails(self):
timed_stats = TimedStats(1, 2, Stats())
result = Result({}... | [
"cr8.metrics.Stats",
"doctest.DocTestSuite",
"cr8.engine.Result",
"cr8.engine.TimedStats",
"cr8.engine.eval_fail_if"
] | [((311, 352), 'cr8.engine.Result', 'Result', (['{}', '"""select name"""', 'timed_stats', '(1)'], {}), "({}, 'select name', timed_stats, 1)\n", (317, 352), False, 'from cr8.engine import eval_fail_if, Result, FailIf, TimedStats\n'), ((528, 535), 'cr8.metrics.Stats', 'Stats', ([], {}), '()\n', (533, 535), False, 'from cr... |
from random import random
from math import exp, tanh
def dot(arr1, arr2):
if (len(arr1) != len(arr2)): raise Exception(f"Arrays are not of same length! Arr1 Length: {len(arr1)} | Arr2 Length: {len(arr2)}")
return sum([one*two for one, two in zip(arr1, arr2)])
def error(arr1, arr2):
if (len(arr1) != len(ar... | [
"random.random",
"math.tanh",
"math.exp"
] | [((1276, 1284), 'random.random', 'random', ([], {}), '()\n', (1282, 1284), False, 'from random import random\n'), ((1715, 1723), 'random.random', 'random', ([], {}), '()\n', (1721, 1723), False, 'from random import random\n'), ((1733, 1741), 'random.random', 'random', ([], {}), '()\n', (1739, 1741), False, 'from random... |
#------------------Bombermans Team---------------------------------#
#Author : B3mB4m
#Concat : <EMAIL>
#Project : https://github.com/b3mb4m/Shellsploit
#LICENSE : https://github.com/b3mb4m/Shellsploit/blob/master/LICENSE
#------------------------------------------------------------------#
from re import findall
... | [
"re.findall"
] | [((450, 472), 're.findall', 'findall', (['"""..?"""', 'string'], {}), "('..?', string)\n", (457, 472), False, 'from re import findall\n'), ((625, 647), 're.findall', 'findall', (['"""..?"""', 'string'], {}), "('..?', string)\n", (632, 647), False, 'from re import findall\n'), ((1712, 1737), 're.findall', 'findall', (['... |
'''
.. note::
* These are the default auth managers. They won't perform any file io.
* If you want auth managers with file io capabilities, then you'll have to implement AbstractAuthManager's interface or inherent from any of this module's managers.
* In most cases you won't need to implement new man... | [
"datetime.datetime.utcnow",
"json.dumps",
"datetime.datetime.fromisoformat",
"urllib.parse.urlencode",
"datetime.timedelta",
"google.auth.jwt.decode"
] | [((9610, 9641), 'datetime.timedelta', 'datetime.timedelta', ([], {'seconds': '(120)'}), '(seconds=120)\n', (9628, 9641), False, 'import datetime\n'), ((9487, 9513), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (9511, 9513), False, 'import datetime\n'), ((9516, 9554), 'datetime.timedelta', '... |
from distutils.core import setup
from setuptools import setup
setup(
name='event-bus',
version='1.0.4',
packages=['event_bus'],
url='https://github.com/summer-wu/event-bus',
license='MIT',
author='<NAME>',
author_email='<EMAIL>',
description='A simple python event bus.',
download_url='https://github.com/seanp... | [
"setuptools.setup"
] | [((63, 368), 'setuptools.setup', 'setup', ([], {'name': '"""event-bus"""', 'version': '"""1.0.4"""', 'packages': "['event_bus']", 'url': '"""https://github.com/summer-wu/event-bus"""', 'license': '"""MIT"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""A simple python event bus."""', '... |