code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import logging
"""
Formatter
"""
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d:%H:%M:%S')
"""
Set Flask logger
"""
logger = logging.getLogger('FLASK_LOG')
logger.setLevel(logging.DEBUG)
stream_log = logging.StreamHandler()
stream_log.setFormatter(form... | [
"logging.getLogger",
"logging.Formatter",
"logging.StreamHandler"
] | [((50, 156), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'], {'datefmt': '"""%Y-%m-%d:%H:%M:%S"""'}), "('%(asctime)s - %(name)s - %(levelname)s - %(message)s',\n datefmt='%Y-%m-%d:%H:%M:%S')\n", (67, 156), False, 'import logging\n'), ((193, 223), 'logging.ge... |
#!/usr/bin/python3
import os
import sys
import socket
CURRENT_DIR = os.path.dirname(__file__)
NEWSBLUR_DIR = ''.join([CURRENT_DIR, '/../../'])
sys.path.insert(0, NEWSBLUR_DIR)
os.environ['DJANGO_SETTINGS_MODULE'] = 'newsblur_web.settings'
import threading
class ProgressPercentage(object):
def __init__(self, fil... | [
"os.path.getsize",
"sys.path.insert",
"boto3.client",
"os.listdir",
"threading.Lock",
"time.strftime",
"os.path.join",
"sys.stdout.write",
"os.path.dirname",
"sys.stdout.flush",
"socket.gethostname",
"os.remove"
] | [((69, 94), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (84, 94), False, 'import os\n'), ((144, 176), 'sys.path.insert', 'sys.path.insert', (['(0)', 'NEWSBLUR_DIR'], {}), '(0, NEWSBLUR_DIR)\n', (159, 176), False, 'import sys\n'), ((1037, 1143), 'boto3.client', 'boto3.client', (['"""s3"""']... |
from typing import Tuple
import numpy as np
import rasterio.warp
from opensfm import features
from .orthophoto_manager import OrthoPhotoManager
from .view import View
class OrthoPhotoView(View):
def __init__(
self,
main_ui,
path: str,
init_lat: float,
init_lon: float,
... | [
"numpy.mean",
"numpy.array"
] | [((3748, 3761), 'numpy.mean', 'np.mean', (['xlim'], {}), '(xlim)\n', (3755, 3761), True, 'import numpy as np\n'), ((3763, 3776), 'numpy.mean', 'np.mean', (['ylim'], {}), '(ylim)\n', (3770, 3776), True, 'import numpy as np\n'), ((2286, 2304), 'numpy.array', 'np.array', (['[[x, y]]'], {}), '([[x, y]])\n', (2294, 2304), T... |
"""
The model file for a Memo
"""
import re
import os
import shutil
import json
from datetime import datetime
from flask import current_app
from memos import db
from memos.models.User import User
from memos.models.MemoState import MemoState
from memos.models.MemoFile import MemoFile
from memos.models.MemoSignature i... | [
"flask.current_app.logger.debug",
"memos.models.MemoSignature.MemoSignature.unsign_all",
"memos.models.MemoHistory.MemoHistory.activity",
"memos.db.String",
"memos.models.MemoSignature.MemoSignature.sign",
"memos.models.MemoSignature.MemoSignature.is_signer",
"re.split",
"memos.models.MemoReference.Me... | [((661, 700), 'memos.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (670, 700), False, 'from memos import db\n'), ((714, 735), 'memos.db.Column', 'db.Column', (['db.Integer'], {}), '(db.Integer)\n', (723, 735), False, 'from memos import db\n'), ((801, 821), 'me... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import random
class JuliaSet:
def __init__(self):
"""
Constructor of the JuliaSet class
:param size: size in pixels (for both width and height)
:param dpi: dots per inch (default 300)
"""
... | [
"matplotlib.pyplot.imshow",
"numpy.flip",
"random.uniform",
"random.choice",
"numpy.abs",
"numpy.ones",
"numpy.sqrt",
"random.randrange",
"matplotlib.pyplot.gcf",
"numpy.concatenate",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.show"
] | [((3661, 3683), 'random.choice', 'random.choice', (['cpxList'], {}), '(cpxList)\n', (3674, 3683), False, 'import random\n'), ((4146, 4172), 'random.randrange', 'random.randrange', (['(-1)', '(1)', '(2)'], {}), '(-1, 1, 2)\n', (4162, 4172), False, 'import random\n'), ((4374, 4400), 'random.uniform', 'random.uniform', ([... |
import numpy as np
from keras import backend as K
import os
import sys
K.set_image_dim_ordering('tf')
def patch_path(path):
return os.path.join(os.path.dirname(__file__), path)
def main():
sys.path.append(patch_path('..'))
data_dir_path = patch_path('very_large_data')
model_dir_path = patch_path('... | [
"keras_video_classifier.library.utility.ucf.UCF101_loader.load_ucf",
"numpy.random.shuffle",
"os.path.dirname",
"keras_video_classifier.library.convolutional.CnnVideoClassifier.get_weight_file_path",
"numpy.random.seed",
"keras_video_classifier.library.convolutional.CnnVideoClassifier.get_config_file_path... | [((72, 102), 'keras.backend.set_image_dim_ordering', 'K.set_image_dim_ordering', (['"""tf"""'], {}), "('tf')\n", (96, 102), True, 'from keras import backend as K\n'), ((545, 600), 'keras_video_classifier.library.convolutional.CnnVideoClassifier.get_config_file_path', 'CnnVideoClassifier.get_config_file_path', (['model_... |
'''
-------------------------------------
Assignment 2 - EE2703 (Jan-May 2020)
Done by <NAME> (EE18B122)
Created on 18/01/20
Last Modified on 04/02/20
-------------------------------------
'''
# importing necessary libraries
import sys
import cmath
import numpy as np
import pandas as pd
# To improve readability
C... | [
"numpy.linalg.solve",
"cmath.rect",
"numpy.zeros",
"sys.exit",
"pandas.DataFrame"
] | [((3524, 3564), 'sys.exit', 'sys.exit', (['"""Invalid number of arguments!"""'], {}), "('Invalid number of arguments!')\n", (3532, 3564), False, 'import sys\n'), ((17150, 17188), 'sys.exit', 'sys.exit', (['"""Given file does not exist!"""'], {}), "('Given file does not exist!')\n", (17158, 17188), False, 'import sys\n'... |
import logging
logger = logging.getLogger(__name__)
print(f"!!!!!!!!!! getEffectiveLevel: {logger.getEffectiveLevel()} !!!!!!!!!!!!!")
from dltb.base.observer import Observable, change
from network import Network, loader
from network.lucid import Network as LucidNetwork
# lucid.modelzoo.vision_models:
# A module ... | [
"logging.getLogger",
"lucid.optvis.objectives.channel",
"network.loader.load_lucid",
"lucid.optvis.render.render_vis"
] | [((24, 51), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (41, 51), False, 'import logging\n'), ((5696, 5740), 'lucid.optvis.objectives.channel', 'objectives.channel', (['self.layer_id', 'self.unit'], {}), '(self.layer_id, self.unit)\n', (5714, 5740), True, 'import lucid.optvis.objective... |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2018-2019 New Vector Ltd
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
# 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 Licens... | [
"logging.getLogger",
"itertools.chain",
"synapse.util.logcontext.PreserveLoggingContext",
"synapse.api.errors.SynapseError",
"synapse.util.frozenutils.frozendict_json_encoder.encode",
"synapse.util.metrics.Measure",
"canonicaljson.json.loads",
"collections.deque",
"prometheus_client.Histogram",
"t... | [((2138, 2165), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2155, 2165), False, 'import logging\n'), ((2191, 2245), 'prometheus_client.Counter', 'Counter', (['"""synapse_storage_events_persisted_events"""', '""""""'], {}), "('synapse_storage_events_persisted_events', '')\n", (2198, 22... |
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"fat.fat_bert_nq.ppr.kb_csr_io.CsrData",
"numpy.where",
"tensorflow.logging.info",
"numpy.argsort",
"numpy.zeros",
"fat.fat_bert_nq.ppr.apr_algo.csr_personalized_pagerank",
"fat.fat_bert_nq.ppr.apr_algo.csr_topk_fact_extractor"
] | [((1590, 1599), 'fat.fat_bert_nq.ppr.kb_csr_io.CsrData', 'CsrData', ([], {}), '()\n', (1597, 1599), False, 'from fat.fat_bert_nq.ppr.kb_csr_io import CsrData\n'), ((2084, 2148), 'fat.fat_bert_nq.ppr.apr_algo.csr_personalized_pagerank', 'csr_personalized_pagerank', (['seeds', 'self.data.adj_mat_t_csr', 'alpha'], {}), '(... |
import warnings
from collections import OrderedDict
from distutils.version import LooseVersion
from functools import partial
from inspect import isclass
from typing import Callable, Optional, Dict, Union
import numpy as np
import torch
import tqdm
from torch import Tensor, nn
from torch.nn import functional as F
from... | [
"torch.cuda.Event",
"collections.OrderedDict",
"numpy.median",
"inspect.isclass",
"torch.cuda.synchronize",
"torch.tensor",
"torch.zeros_like",
"adv_lib.utils.ForwardCounter",
"torch.nn.functional.cross_entropy",
"adv_lib.utils.BackwardCounter",
"distutils.version.LooseVersion",
"warnings.warn... | [((5060, 5169), 'collections.OrderedDict', 'OrderedDict', (["[('linf', linf_distances), ('l0', l0_distances), ('l1', l1_distances), (\n 'l2', l2_distances)]"], {}), "([('linf', linf_distances), ('l0', l0_distances), ('l1',\n l1_distances), ('l2', l2_distances)])\n", (5071, 5169), False, 'from collections import O... |
#!/usr/bin/env python
# Filename: polygons_cd
"""
introduction: compare two polygons in to shape file
authors: <NAME>
email:<EMAIL>
add time: 26 February, 2020
"""
import sys,os
from optparse import OptionParser
# added path of DeeplabforRS
sys.path.insert(0, os.path.expanduser('~/codes/PycharmProjects/DeeplabforRS... | [
"sys.exit",
"basic_src.io_function.is_file_exist",
"polygons_cd_multi.get_main_shp_name",
"optparse.OptionParser",
"basic_src.basic.setlogfile",
"polygons_cd.polygons_change_detection",
"basic_src.map_projection.get_raster_or_vector_srs_info_proj4",
"os.path.expanduser"
] | [((264, 322), 'os.path.expanduser', 'os.path.expanduser', (['"""~/codes/PycharmProjects/DeeplabforRS"""'], {}), "('~/codes/PycharmProjects/DeeplabforRS')\n", (282, 322), False, 'import sys, os\n'), ((633, 672), 'basic_src.io_function.is_file_exist', 'io_function.is_file_exist', (['new_shp_path'], {}), '(new_shp_path)\n... |
from django_cron import CronJobBase, Schedule
from .models import Link
from django.utils import timezone
class MyCronJob(CronJobBase):
RUN_EVERY_MINS = 1 # every 2 hours
schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
code = 'basicapp.cron' # a unique code
def do(self):
current_time = t... | [
"django.utils.timezone.now",
"django_cron.Schedule"
] | [((191, 230), 'django_cron.Schedule', 'Schedule', ([], {'run_every_mins': 'RUN_EVERY_MINS'}), '(run_every_mins=RUN_EVERY_MINS)\n', (199, 230), False, 'from django_cron import CronJobBase, Schedule\n'), ((319, 333), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (331, 333), False, 'from django.utils impo... |
from django.shortcuts import render
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from sesame import utils
from django.core.mail import send_mail
def login_page(request):
if request.method == "POST":
email = request.POST.get("emailId")
user =... | [
"django.shortcuts.render",
"django.contrib.auth.models.User.objects.get",
"sesame.utils.get_query_string",
"django.core.mail.send_mail"
] | [((998, 1027), 'django.shortcuts.render', 'render', (['request', '"""login.html"""'], {}), "(request, 'login.html')\n", (1004, 1027), False, 'from django.shortcuts import render\n'), ((1090, 1129), 'django.shortcuts.render', 'render', (['request', '"""customers/index.html"""'], {}), "(request, 'customers/index.html')\n... |
from .custom_check import CustomCheck, CustomCheckError
from typing import Any, List
import logging
logger = logging.getLogger(__name__)
class DSSParameterError(Exception):
"""Exception raised when at least one CustomCheck fails."""
pass
class DSSParameter:
"""Object related to one parameter. It is m... | [
"logging.getLogger"
] | [((111, 138), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (128, 138), False, 'import logging\n')] |
#!/usr/bin/env python3
import os
import os.path
import shutil
import subprocess
import sys
import tempfile
import uuid
import mgm_utils
def main():
(root_dir, input_file, json_file) = sys.argv[1:4]
tmpName = str(uuid.uuid4())
tmpdir = "/tmp"
temp_input_file = f"{tmpdir}/{tmpName}.dat"
temp_output_file = f"{tmpd... | [
"os.path.exists",
"subprocess.run",
"uuid.uuid4",
"os.remove",
"shutil.copy",
"mgm_utils.get_sif_dir"
] | [((341, 381), 'shutil.copy', 'shutil.copy', (['input_file', 'temp_input_file'], {}), '(input_file, temp_input_file)\n', (352, 381), False, 'import shutil\n'), ((453, 531), 'subprocess.run', 'subprocess.run', (["['singularity', 'run', sif, temp_input_file, temp_output_file]"], {}), "(['singularity', 'run', sif, temp_inp... |
from concurrent.futures import TimeoutError
from google.cloud import pubsub_v1
project_id = "pubsub-testing-331300"
subscription_id = "test-sub"
# Number of seconds the subscriber should listen for messages
timeout = 5.0
subscriber = pubsub_v1.SubscriberClient()
# The `subscription_path` method creates a fully qualif... | [
"google.cloud.pubsub_v1.SubscriberClient"
] | [((236, 264), 'google.cloud.pubsub_v1.SubscriberClient', 'pubsub_v1.SubscriberClient', ([], {}), '()\n', (262, 264), False, 'from google.cloud import pubsub_v1\n')] |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
google_drive_authorization_code = fields.Char(string='Authorization Code', config_parame... | [
"odoo.api.depends",
"odoo._",
"odoo.fields.Char",
"odoo.fields.Boolean"
] | [((266, 363), 'odoo.fields.Char', 'fields.Char', ([], {'string': '"""Authorization Code"""', 'config_parameter': '"""google_drive_authorization_code"""'}), "(string='Authorization Code', config_parameter=\n 'google_drive_authorization_code')\n", (277, 363), False, 'from odoo import api, fields, models, _\n'), ((382,... |
from dataclasses import dataclass
from typing import List
from greendoge.types.condition_opcodes import ConditionOpcode
from greendoge.util.streamable import Streamable, streamable
@dataclass(frozen=True)
@streamable
class ConditionWithArgs(Streamable):
"""
This structure is used to store parsed CLVM conditi... | [
"dataclasses.dataclass"
] | [((185, 207), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (194, 207), False, 'from dataclasses import dataclass\n')] |
"""The nexia integration base entity."""
from aiopvapi.resources.shade import ATTR_TYPE
from homeassistant.const import ATTR_MODEL, ATTR_SW_VERSION
import homeassistant.helpers.device_registry as dr
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEnt... | [
"homeassistant.helpers.entity.DeviceInfo"
] | [((1314, 1646), 'homeassistant.helpers.entity.DeviceInfo', 'DeviceInfo', ([], {'identifiers': '{(DOMAIN, self._device_info[DEVICE_SERIAL_NUMBER])}', 'connections': '{(dr.CONNECTION_NETWORK_MAC, self._device_info[DEVICE_MAC_ADDRESS])}', 'name': 'self._device_info[DEVICE_NAME]', 'suggested_area': 'self._room_name', 'mode... |
# Process the unix command line of the pipeline.
import argparse
from version import rubra_version
def get_cmdline_args():
return parser.parse_args()
parser = argparse.ArgumentParser(
description='A bioinformatics pipeline system.')
parser.add_argument(
'pipeline',
metavar='PIPELINE_FILE',
type=... | [
"argparse.ArgumentParser"
] | [((166, 238), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""A bioinformatics pipeline system."""'}), "(description='A bioinformatics pipeline system.')\n", (189, 238), False, 'import argparse\n')] |
import webbrowser
import config
from Generator import Generator
def main():
generator = Generator()
latitude, longitude = generator.getCoordinates()
webbrowser.open(config.api_request.format(latitude, longitude))
if __name__ == '__main__':
main()
| [
"Generator.Generator",
"config.api_request.format"
] | [((94, 105), 'Generator.Generator', 'Generator', ([], {}), '()\n', (103, 105), False, 'from Generator import Generator\n'), ((180, 226), 'config.api_request.format', 'config.api_request.format', (['latitude', 'longitude'], {}), '(latitude, longitude)\n', (205, 226), False, 'import config\n')] |
hiddenimports = ['sip', 'PyQt4.QtGui', 'PyQt4._qt']
from PyInstaller.hooks.hookutils import qt4_plugins_binaries
def hook(mod):
mod.binaries.extend(qt4_plugins_binaries('phonon_backend'))
return mod
| [
"PyInstaller.hooks.hookutils.qt4_plugins_binaries"
] | [((155, 193), 'PyInstaller.hooks.hookutils.qt4_plugins_binaries', 'qt4_plugins_binaries', (['"""phonon_backend"""'], {}), "('phonon_backend')\n", (175, 193), False, 'from PyInstaller.hooks.hookutils import qt4_plugins_binaries\n')] |
from PyTradier.base import BasePyTradier
from typing import Union
from datetime import datetime
class MarketData(BasePyTradier):
"""All Methods currently only support string API calls, no datetime, bools, etc
"""
def quotes(self, symbols: Union[str, list], greeks: bool = False) -> dict:
"""Get a ... | [
"utils.printer"
] | [((6561, 6578), 'utils.printer', 'printer', (['response'], {}), '(response)\n', (6568, 6578), False, 'from utils import printer\n')] |
"""
Services are the heart of RPyC: each side of the connection exposes a *service*,
which define the capabilities available to the other side.
Note that the services by both parties need not be symmetric, e.g., one side may
exposed *service A*, while the other may expose *service B*. As long as the two
can interopera... | [
"functools.partial",
"rpyc.lib.compat.execute"
] | [((4665, 4694), 'rpyc.lib.compat.execute', 'execute', (['text', 'self.namespace'], {}), '(text, self.namespace)\n', (4672, 4694), False, 'from rpyc.lib.compat import execute, is_py3k\n'), ((7188, 7220), 'functools.partial', 'partial', (['teleport_function', 'conn'], {}), '(teleport_function, conn)\n', (7195, 7220), Fal... |
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import SafeString
import markdown
import urllib
register = template.Library()
@register.filter
def strip_space(value):
return value.replace(' ', '')
@register.filter
@stringfilter
def commonmark(value... | [
"markdown.Markdown",
"urllib.parse.quote",
"django.template.Library"
] | [((173, 191), 'django.template.Library', 'template.Library', ([], {}), '()\n', (189, 191), False, 'from django import template\n'), ((660, 685), 'urllib.parse.quote', 'urllib.parse.quote', (['value'], {}), '(value)\n', (678, 685), False, 'import urllib\n'), ((334, 353), 'markdown.Markdown', 'markdown.Markdown', ([], {}... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.CloudbusUserInfo import CloudbusUserInfo
class MetroOdItem(object):
def __init__(self):
self._dest_geo = None
self._od = None
self._time = None
... | [
"alipay.aop.api.domain.CloudbusUserInfo.CloudbusUserInfo.from_alipay_dict"
] | [((1063, 1103), 'alipay.aop.api.domain.CloudbusUserInfo.CloudbusUserInfo.from_alipay_dict', 'CloudbusUserInfo.from_alipay_dict', (['value'], {}), '(value)\n', (1096, 1103), False, 'from alipay.aop.api.domain.CloudbusUserInfo import CloudbusUserInfo\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
""" fogbench -- a Python script used to test FogLAMP.
The objective is to simulate payloads for input, REST and other requests against one or
more FogLAMP instances. This version of fogbench is meant ... | [
"aiohttp.ClientSession",
"json.loads",
"random.uniform",
"random.choice",
"aiocoap.Context.create_client_context",
"argparse.ArgumentParser",
"cbor2.dumps",
"sys.getsizeof",
"datetime.datetime.strftime",
"json.dumps",
"time.sleep",
"os.path.dirname",
"datetime.datetime.now",
"os.getpid",
... | [((10450, 10490), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""fogbench"""'}), "(prog='fogbench')\n", (10473, 10490), False, 'import argparse\n'), ((5345, 5369), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (5367, 5369), False, 'import asyncio\n'), ((2690, 2710), 'jso... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Module for graph representations of crystals.
"""
import copy
import logging
import os.path
import subprocess
import warnings
from collections import defaultdict, namedtuple
from itertools import combinati... | [
"logging.getLogger",
"networkx.readwrite.json_graph.adjacency_graph",
"pymatgen.util.coord.lattice_points_in_supercell",
"scipy.spatial.KDTree",
"pymatgen.core.PeriodicSite",
"numpy.array",
"networkx.weakly_connected_components",
"copy.deepcopy",
"operator.itemgetter",
"igraph.Graph",
"networkx.... | [((1010, 1037), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1027, 1037), False, 'import logging\n'), ((1243, 1307), 'collections.namedtuple', 'namedtuple', (['"""ConnectedSite"""', '"""site, jimage, index, weight, dist"""'], {}), "('ConnectedSite', 'site, jimage, index, weight, dist')... |
from django.shortcuts import render, redirect
from django.http import HttpResponse
from .models import Article
from django.contrib.auth.decorators import login_required
from . import forms
def Articles(request):
articles = Article.objects.all().order_by('date')
return render(request, 'articles/article_list.htm... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"django.contrib.auth.decorators.login_required"
] | [((548, 591), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/accounts/login"""'}), "(login_url='/accounts/login')\n", (562, 591), False, 'from django.contrib.auth.decorators import login_required\n'), ((278, 347), 'django.shortcuts.render', 'render', (['request', '"""articles... |
# (C) Copyright 2017 Inova Development 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 appl... | [
"collections.OrderedDict",
"csv.DictReader",
"os.path.isabs",
"os.rename",
"re.match",
"os.path.join",
"os.path.isfile",
"textwrap.wrap",
"os.remove"
] | [((3808, 4429), 'collections.OrderedDict', 'OrderedDict', (["[('TargetID', ('ID', 2, int)), ('CompanyName', ('CompanyName', 12, str)), (\n 'Namespace', ('Namespace', 12, str)), ('SMIVersion', ('SMIVersion', 12,\n str)), ('Product', ('Product', 15, str)), ('Principal', ('Principal', \n 12, str)), ('Credential',... |
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or th... | [
"AzReflectionCpp.format_cpp_annotations",
"os.path.splitext"
] | [((719, 754), 'AzReflectionCpp.format_cpp_annotations', 'format_cpp_annotations', (['json_object'], {}), '(json_object)\n', (741, 754), False, 'from AzReflectionCpp import format_cpp_annotations\n'), ((861, 889), 'os.path.splitext', 'os.path.splitext', (['input_file'], {}), '(input_file)\n', (877, 889), False, 'import ... |
import os
from QUANTAXIS.QASetting import QALocalize
#from QUANTAXIS_CRAWLY.run_selenium_alone import (read_east_money_page_zjlx_to_sqllite, open_chrome_driver, close_chrome_dirver)
from QUANTAXIS_CRAWLY.run_selenium_alone import *
import urllib
import pandas as pd
import time
from QUANTAXIS.QAUtil import (DATABASE)
... | [
"os.path.exists",
"time.sleep",
"os.getcwd",
"pandas.DataFrame",
"urllib.request.urlopen"
] | [((488, 505), 'time.sleep', 'time.sleep', (['(1.223)'], {}), '(1.223)\n', (498, 505), False, 'import time\n'), ((522, 552), 'urllib.request.urlopen', 'urllib.request.urlopen', (['strUrl'], {}), '(strUrl)\n', (544, 552), False, 'import urllib\n'), ((3133, 3150), 'time.sleep', 'time.sleep', (['(1.456)'], {}), '(1.456)\n'... |
#!/usr/bin/env python
import logging
import sys
from app import app as application
def setup_flask_logging():
# Log to stdout
handler = logging.StreamHandler(sys.stdout)
# Log to a file
#handler = logging.FileHandler('./application.log')
handler.setLevel(logging.INFO)
handler.setFormatter(logg... | [
"app.app.run",
"logging.StreamHandler",
"logging.Formatter",
"app.app.logger.setLevel",
"app.app.logger.addHandler"
] | [((552, 593), 'app.app.logger.setLevel', 'application.logger.setLevel', (['logging.INFO'], {}), '(logging.INFO)\n', (579, 593), True, 'from app import app as application\n'), ((146, 179), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (167, 179), False, 'import logging\n'), ((... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-25 15:10
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rates', '0001_initial'),
]
operations = [
migrations.RenameField(
model... | [
"django.db.migrations.RenameField"
] | [((279, 368), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""rate"""', 'old_name': '"""euro_rate"""', 'new_name': '"""eur_rate"""'}), "(model_name='rate', old_name='euro_rate', new_name=\n 'eur_rate')\n", (301, 368), False, 'from django.db import migrations\n'), ((420, 511), 'd... |
# coding: utf-8
"""
Quetzal API
Quetzal: an API to manage data files and their associated metadata.
OpenAPI spec version: 0.5.0
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
from setuptools import setup, find_packages # noqa: H301
NAME = "quetzal-openapi-client"
VERSION = ... | [
"setuptools.find_packages"
] | [((1145, 1184), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['test', 'docs']"}), "(exclude=['test', 'docs'])\n", (1158, 1184), False, 'from setuptools import setup, find_packages\n')] |
# coding: utf-8
from __future__ import unicode_literals
import re
from .adobepass import AdobePassIE
from ..compat import compat_str
from ..utils import (
fix_xml_ampersands,
xpath_text,
int_or_none,
determine_ext,
float_or_none,
parse_duration,
xpath_attr,
update_url_query,
Extrac... | [
"re.match",
"re.compile"
] | [((2585, 2660), 're.compile', 're.compile', (['"""(?P<width>[0-9]+)x(?P<height>[0-9]+)(?:_(?P<bitrate>[0-9]+))?"""'], {}), "('(?P<width>[0-9]+)x(?P<height>[0-9]+)(?:_(?P<bitrate>[0-9]+))?')\n", (2595, 2660), False, 'import re\n'), ((4294, 4326), 're.match', 're.match', (['"""https?://"""', 'video_url'], {}), "('https?:... |
from alpha_vantage.timeseries import TimeSeries
from pprint import pprint
import json
import argparse
def save_dataset(symbol='MSFT', time_window='daily_adj'):
credentials = json.load(open('creds.json', 'r'))
api_key = credentials['av_api_key']
print(symbol, time_window)
ts = TimeSeries(key=api_key, o... | [
"alpha_vantage.timeseries.TimeSeries",
"argparse.ArgumentParser"
] | [((295, 342), 'alpha_vantage.timeseries.TimeSeries', 'TimeSeries', ([], {'key': 'api_key', 'output_format': '"""pandas"""'}), "(key=api_key, output_format='pandas')\n", (305, 342), False, 'from alpha_vantage.timeseries import TimeSeries\n'), ((813, 838), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module define a WulffShape class to generate the Wulff shape from
a lattice, a list of indices and their corresponding surface energies,
and the total area and volume of the wulff shape,the weighted su... | [
"logging.getLogger",
"numpy.sqrt",
"pymatgen.core.structure.Structure",
"matplotlib.colorbar.ColorbarBase",
"numpy.array",
"numpy.linalg.norm",
"scipy.cross",
"mpl_toolkits.mplot3d.art3d.Poly3DCollection",
"numpy.dot",
"matplotlib.cm.ScalarMappable",
"matplotlib.pyplot.Rectangle",
"warnings.wa... | [((1126, 1153), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1143, 1153), False, 'import logging\n'), ((1738, 1749), 'numpy.array', 'np.array', (['b'], {}), '(b)\n', (1746, 1749), True, 'import numpy as np\n'), ((1752, 1763), 'numpy.array', 'np.array', (['a'], {}), '(a)\n', (1760, 1763... |
from python_on_rails.either import as_either, Failure, Success
@as_either(TypeError)
def add_one(x):
return x + 1
@as_either()
def times_five(x):
return x * 5
def test_success_executes_bindings():
result = Success(1).bind(add_one).bind(times_five)
assert isinstance(result, Success)
assert resu... | [
"python_on_rails.either.Success",
"python_on_rails.either.as_either"
] | [((66, 86), 'python_on_rails.either.as_either', 'as_either', (['TypeError'], {}), '(TypeError)\n', (75, 86), False, 'from python_on_rails.either import as_either, Failure, Success\n'), ((123, 134), 'python_on_rails.either.as_either', 'as_either', ([], {}), '()\n', (132, 134), False, 'from python_on_rails.either import ... |
from django.db import models
# Create your models here.
# Station
class Stations(models.Model):
stationName = models.CharField(max_length=100)
stationLocation = models.CharField(max_length=100)
stationStaffId = models.CharField(max_length=100)
date = models.DateTimeField(auto_now_add=True)
d... | [
"django.db.models.DateTimeField",
"django.db.models.EmailField",
"django.db.models.CharField"
] | [((119, 151), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (135, 151), False, 'from django.db import models\n'), ((174, 206), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (190, 206), False, 'from django.d... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, <NAME>. 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 Lic... | [
"logging.getLogger",
"tensorflow.python.keras.backend.batch_set_value",
"torch.load",
"torch.from_numpy",
"numpy.squeeze",
"numpy.expand_dims",
"os.path.abspath",
"re.sub",
"numpy.transpose"
] | [((802, 829), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (819, 829), False, 'import logging\n'), ((1569, 1614), 're.sub', 're.sub', (['"""/[^/]*___([^/]*)/"""', '"""/\\\\1/"""', 'tf_name'], {}), "('/[^/]*___([^/]*)/', '/\\\\1/', tf_name)\n", (1575, 1614), False, 'import re\n'), ((1901... |
import logging
import uuid
from django.db import models
from django.urls import reverse
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from model_utils.managers import InheritanceManager
from mayan.apps.django_gpg.exceptions import VerificationError
from mayan.ap... | [
"logging.getLogger",
"model_utils.managers.InheritanceManager",
"django.utils.translation.ugettext_lazy",
"mayan.apps.django_gpg.models.Key.objects.verify_file",
"uuid.uuid4",
"django.urls.reverse",
"mayan.apps.storage.classes.DefinedStorageLazy"
] | [((624, 656), 'logging.getLogger', 'logging.getLogger', ([], {'name': '__name__'}), '(name=__name__)\n', (641, 656), False, 'import logging\n'), ((2025, 2045), 'model_utils.managers.InheritanceManager', 'InheritanceManager', ([], {}), '()\n', (2043, 2045), False, 'from model_utils.managers import InheritanceManager\n')... |
from ConfigParser import ConfigParser
from sys import argv
REPLACE_PROPERTIES = ["file_path", "database_connection", "new_file_path"]
MAIN_SECTION = "app:main"
def sync():
# Add or replace the relevant properites from galaxy.ini
# into reports.ini
reports_config_file = "config/reports.ini"
if len(arg... | [
"ConfigParser.ConfigParser"
] | [((489, 503), 'ConfigParser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (501, 503), False, 'from ConfigParser import ConfigParser\n')] |
# 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 IS PROVIDED ON AN "AS IS... | [
"ssh.ExecutorFactory"
] | [((1307, 1324), 'ssh.ExecutorFactory', 'ExecutorFactory', ([], {}), '()\n', (1322, 1324), False, 'from ssh import ExecutorFactory\n'), ((835, 852), 'ssh.ExecutorFactory', 'ExecutorFactory', ([], {}), '()\n', (850, 852), False, 'from ssh import ExecutorFactory\n')] |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"random.uniform",
"math.sqrt",
"random.randint",
"mxnet.image.random_crop"
] | [((4465, 4507), 'random.uniform', 'random.uniform', (['self.ratio', '(1 / self.ratio)'], {}), '(self.ratio, 1 / self.ratio)\n', (4479, 4507), False, 'import random\n'), ((4246, 4266), 'random.uniform', 'random.uniform', (['(0)', '(1)'], {}), '(0, 1)\n', (4260, 4266), False, 'import random\n'), ((4396, 4434), 'random.un... |
import plotly.graph_objects as go
import streamlit as st
import pandas as pd
from utils import *
import glob
import wfdb
import os
ANNOTATIONS_COL_NAME = 'annotations'
'''
# MIT-BIH Arrhythmia DB Exploration
'''
record_ids = [os.path.basename(file)[:-4] for file in glob.glob('data/*.dat')]
if len(record_ids) == 0:
... | [
"pandas.Series",
"plotly.graph_objects.Bar",
"streamlit.write",
"wfdb.rdann",
"plotly.graph_objects.Scatter",
"wfdb.rdrecord",
"os.path.basename",
"streamlit.selectbox",
"pandas.DataFrame",
"streamlit.plotly_chart",
"pandas.concat",
"glob.glob"
] | [((324, 516), 'streamlit.write', 'st.write', (['"""Warning ! No data could be found under the ./data/ directory."""', '"""*\\\\*.dat*, *\\\\*.hea*, *\\\\*.atr* files and such should be placed """', '"""immediately under the ./data/ directory"""'], {}), "('Warning ! No data could be found under the ./data/ directory.',\... |
import pandas as pd
import ete2
from ete2 import faces, Tree, AttrFace, TreeStyle
import pylab
from matplotlib.colors import hex2color, rgb2hex, hsv_to_rgb, rgb_to_hsv
kelly_colors_hex = [
0xFFB300, # Vivid Yellow
0x803E75, # Strong Purple
0xFF6800, # Vivid Orange
0xA6BDD7, # Very Light Blue
0xC100... | [
"ete2.Tree",
"pandas.isnull",
"ete2.faces.CircleFace",
"ete2.CircleFace",
"pandas.read_csv",
"argparse.ArgumentParser",
"ete2.TreeStyle",
"ete2.faces.TextFace",
"pylab.figure",
"ete2.faces.add_face_to_node",
"pandas.np.array",
"ete2.AttrFace",
"ete2.NodeStyle"
] | [((1247, 1321), 'ete2.faces.add_face_to_node', 'faces.add_face_to_node', (['name_face', 'node'], {'column': '(0)', 'position': '"""branch-right"""'}), "(name_face, node, column=0, position='branch-right')\n", (1269, 1321), False, 'from ete2 import faces, Tree, AttrFace, TreeStyle\n'), ((1732, 1743), 'ete2.TreeStyle', '... |
import attr
from firedrake import *
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from scipy.linalg import svd
from scipy.sparse.linalg import svds
from scipy.sparse import csr_matrix
from slepc4py import SLEPc
import pandas as pd
from tqdm import tqdm
import os
matplotlib.use('Agg')
@attr.s
c... | [
"numpy.ma.masked_values",
"slepc4py.SLEPc.SVD",
"os.makedirs",
"matplotlib.use",
"numpy.delete",
"numpy.array",
"scipy.sparse.linalg.svds",
"scipy.linalg.svd",
"pandas.DataFrame",
"numpy.all",
"matplotlib.pyplot.subplots",
"attr.ib"
] | [((287, 308), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (301, 308), False, 'import matplotlib\n'), ((367, 376), 'attr.ib', 'attr.ib', ([], {}), '()\n', (374, 376), False, 'import attr\n'), ((398, 407), 'attr.ib', 'attr.ib', ([], {}), '()\n', (405, 407), False, 'import attr\n'), ((431, 440), ... |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
from wtforms.validators import InputRequired, Email, ValidationError
from models import User
class RegistrationForm(FlaskForm):
email = StringField('Your Email Address', validators=[InputRequired(), Email()])
username ... | [
"wtforms.validators.Email",
"models.User.query.filter_by",
"wtforms.validators.ValidationError",
"wtforms.SubmitField",
"wtforms.validators.InputRequired"
] | [((471, 493), 'wtforms.SubmitField', 'SubmitField', (['"""Sign Up"""'], {}), "('Sign Up')\n", (482, 493), False, 'from wtforms import StringField, PasswordField, SubmitField\n'), ((910, 932), 'wtforms.SubmitField', 'SubmitField', (['"""Sign In"""'], {}), "('Sign In')\n", (921, 932), False, 'from wtforms import StringFi... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Creates a security policy with the default values"
class Input:
NAME = "name"
class Output:
ID = "id"
class CreateSecurityPolicyInput(komand.Input):
schema = json.loads("""
{
"type": "o... | [
"json.loads"
] | [((288, 591), 'json.loads', 'json.loads', (['"""\n {\n "type": "object",\n "title": "Variables",\n "properties": {\n "name": {\n "type": "string",\n "title": "Name",\n "description": "The name of the security policy that needs to be created",\n "order": 1\n }\n },\n "required": [\n "... |
import collections
import logging
import urllib.parse
from structlog import wrap_logger
from secure_message.constants import MESSAGE_BY_ID_ENDPOINT, MESSAGE_LIST_ENDPOINT, MESSAGE_QUERY_LIMIT
from secure_message.services.service_toggles import party, internal_user_service
logger = wrap_logger(logging.getLogger(__nam... | [
"logging.getLogger",
"secure_message.services.service_toggles.internal_user_service.get_user_details",
"secure_message.services.service_toggles.party.get_business_details",
"collections.namedtuple"
] | [((340, 537), 'collections.namedtuple', 'collections.namedtuple', (['"""MessageArgs"""', '"""page limit business_id surveys cc label desc ce is_closed my_conversations new_respondent_conversations all_conversation_types unread_conversations"""'], {}), "('MessageArgs',\n 'page limit business_id surveys cc label desc ... |
import hashlib
import mimetypes
from urllib.parse import unquote
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.http import HttpResponseRedirect
from django.template.loader import render_to_string
from django.urls import reverse
from django.... | [
"core.case_study_index.update_cs_index",
"django.db.models.TextField",
"wagtail.admin.edit_handlers.PageChooserPanel",
"exportplan.core.data.SECTIONS.items",
"django.core.exceptions.ValidationError",
"core.blocks.VideoBlock",
"django.urls.reverse",
"wagtail.admin.edit_handlers.FieldPanel",
"wagtail.... | [((2206, 2232), 'wagtail.snippets.models.register_snippet', 'register_snippet', (['Redirect'], {}), '(Redirect)\n', (2222, 2232), False, 'from wagtail.snippets.models import register_snippet\n'), ((3527, 3560), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1000)'}), '(max_length=1000)\n', (354... |
# -*-coding utf-8 -*-
##########################################################################
#
# Copyright (c) 2022 Baidu.com, 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 th... | [
"random.uniform",
"collections.namedtuple",
"math.sqrt",
"random.random",
"random.randint"
] | [((4959, 5017), 'collections.namedtuple', 'collections.namedtuple', (['"""params_ret"""', "['i', 'j', 'h', 'w']"], {}), "('params_ret', ['i', 'j', 'h', 'w'])\n", (4981, 5017), False, 'import collections\n'), ((8071, 8109), 'random.uniform', 'random.uniform', (['degrees[0]', 'degrees[1]'], {}), '(degrees[0], degrees[1])... |
# -*- coding: utf-8 -*-
#
# This file is part of menRva.
# Copyright (C) 2018-present NU,FSM,GHSL.
#
# menRva is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test terms views.py"""
from cd2h_repo_project.modules.terms.views import ... | [
"cd2h_repo_project.modules.terms.views.serialize_terms_for_edit_ui"
] | [((679, 715), 'cd2h_repo_project.modules.terms.views.serialize_terms_for_edit_ui', 'serialize_terms_for_edit_ui', (['deposit'], {}), '(deposit)\n', (706, 715), False, 'from cd2h_repo_project.modules.terms.views import serialize_terms_for_edit_ui\n'), ((1187, 1223), 'cd2h_repo_project.modules.terms.views.serialize_terms... |
# -*- coding: utf-8 -*-
"""Classes (Python) to compute the Bandit UCB (Upper Confidence Bound) arm allocation and choosing the arm to pull next.
See :mod:`moe.bandit.bandit_interface` for further details on bandit.
"""
import copy
from abc import abstractmethod
from moe.bandit.bandit_interface import BanditInterfac... | [
"moe.bandit.utils.get_winning_arm_names_from_payoff_arm_name_list",
"copy.deepcopy"
] | [((1529, 1559), 'copy.deepcopy', 'copy.deepcopy', (['historical_info'], {}), '(historical_info)\n', (1542, 1559), False, 'import copy\n'), ((5703, 5776), 'moe.bandit.utils.get_winning_arm_names_from_payoff_arm_name_list', 'get_winning_arm_names_from_payoff_arm_name_list', (['ucb_payoff_arm_name_list'], {}), '(ucb_payof... |
import numpy as np
from yt.geometry.selection_routines import GridSelector
from yt.utilities.io_handler import BaseIOHandler
from yt.utilities.logger import ytLogger as mylog
from yt.utilities.on_demand_imports import _h5py as h5py
_convert_mass = ("particle_mass", "mass")
_particle_position_names = {}
class IOHan... | [
"yt.utilities.on_demand_imports._h5py.File",
"yt.utilities.io_handler.BaseIOHandler.__init__",
"numpy.empty",
"yt.utilities.logger.ytLogger.debug"
] | [((550, 584), 'yt.utilities.on_demand_imports._h5py.File', 'h5py.File', (['grid.filename'], {'mode': '"""r"""'}), "(grid.filename, mode='r')\n", (559, 584), True, 'from yt.utilities.on_demand_imports import _h5py as h5py\n'), ((7940, 7972), 'yt.utilities.io_handler.BaseIOHandler.__init__', 'BaseIOHandler.__init__', (['... |
#!/usr/bin/env python3
# Crypto trading bot using binance api
# Author: LeonardoM011<<EMAIL>>
# Created on 2021-02-05 21:56
# Set constants here:
DELTA_TIME = 300 # How long can we check for setting up new trade (in seconds)
# ----------------------
# Imports:
import os
import sys
import time as t
... | [
"binance.client.Client",
"sys.path.insert",
"time.sleep",
"datetime.datetime.now",
"candles.flip_side",
"candles.get_candle_info",
"candles.get_side"
] | [((402, 439), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""../deps/binance"""'], {}), "(1, '../deps/binance')\n", (417, 439), False, 'import sys\n'), ((2173, 2200), 'binance.client.Client', 'Client', (['api_key', 'api_secret'], {}), '(api_key, api_secret)\n', (2179, 2200), False, 'from binance.client import Clien... |
import matplotlib.pyplot as plt
import random
import pickle
from skimage.transform import rotate
from scipy import ndimage
from skimage.util import img_as_ubyte
from joblib import Parallel, delayed
from sklearn.ensemble.forest import _generate_unsampled_indices
from sklearn.ensemble.forest import _generate_sample_indic... | [
"keras.layers.Conv2D",
"keras.layers.Dense",
"sys.path.append",
"scipy.ndimage.zoom",
"numpy.arange",
"keras.Sequential",
"numpy.mean",
"skimage.transform.rotate",
"numpy.where",
"keras.datasets.cifar100.load_data",
"skimage.util.img_as_ubyte",
"numpy.random.seed",
"numpy.concatenate",
"ke... | [((638, 673), 'sys.path.append', 'sys.path.append', (['"""../../proglearn/"""'], {}), "('../../proglearn/')\n", (653, 673), False, 'import sys\n'), ((7056, 7091), 'keras.datasets.cifar100.load_data', 'keras.datasets.cifar100.load_data', ([], {}), '()\n', (7089, 7091), False, 'import keras\n'), ((7101, 7134), 'numpy.con... |
import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin, clone
from sklearn_pandas.util import validate_dataframe
class MonitorMixin(object):
def print_message(self, message):
if self.logfile:
with open(self.logfile, "a") as fout:
fout.w... | [
"sklearn_pandas.util.validate_dataframe"
] | [((622, 643), 'sklearn_pandas.util.validate_dataframe', 'validate_dataframe', (['X'], {}), '(X)\n', (640, 643), False, 'from sklearn_pandas.util import validate_dataframe\n'), ((826, 847), 'sklearn_pandas.util.validate_dataframe', 'validate_dataframe', (['X'], {}), '(X)\n', (844, 847), False, 'from sklearn_pandas.util ... |
import pytest
from CommonServerPython import *
from ProofpointThreatResponse import create_incident_field_context, get_emails_context, pass_sources_list_filter, \
pass_abuse_disposition_filter, filter_incidents, prepare_ingest_alert_request_body, \
get_incidents_batch_by_time_request, get_new_incidents, get_tim... | [
"ProofpointThreatResponse.filter_incidents",
"ProofpointThreatResponse.get_time_delta",
"ProofpointThreatResponse.prepare_ingest_alert_request_body",
"pytest.mark.parametrize",
"ProofpointThreatResponse.get_new_incidents",
"ProofpointThreatResponse.get_incidents_batch_by_time_request",
"ProofpointThreat... | [((2985, 3050), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""incident, answer"""', 'INCIDENT_FIELD_INPUT'], {}), "('incident, answer', INCIDENT_FIELD_INPUT)\n", (3008, 3050), False, 'import pytest\n'), ((3591, 3653), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""event, answer"""', 'EMAILS_C... |
import sys
import os
import json
from enum import Enum
from .mach_o import LC_SYMTAB
from macholib import MachO
from macholib import mach_o
from shutil import copy2
from shutil import SameFileError
class ReplaceType(Enum):
objc_methname = 1
symbol_table = 2
def replace_in_bytes(method_bytes, name_dict, type... | [
"shutil.copy2",
"os.path.join",
"os.chmod",
"os.path.isfile",
"os.path.split",
"os.path.isdir",
"json.load",
"macholib.MachO.MachO"
] | [((2829, 2852), 'macholib.MachO.MachO', 'MachO.MachO', (['macho_file'], {}), '(macho_file)\n', (2840, 2852), False, 'from macholib import MachO\n'), ((3099, 3124), 'os.path.split', 'os.path.split', (['macho_file'], {}), '(macho_file)\n', (3112, 3124), False, 'import os\n'), ((3194, 3228), 'os.path.join', 'os.path.join'... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"httplib2.Http",
"oauth2client.tools.run_flow",
"oauth2client.client.flow_from_clientsecrets",
"oauth2client.file.Storage"
] | [((952, 984), 'oauth2client.file.Storage', 'file.Storage', (['"""credentials.json"""'], {}), "('credentials.json')\n", (964, 984), False, 'from oauth2client import client, file, tools\n'), ((1040, 1100), 'oauth2client.client.flow_from_clientsecrets', 'client.flow_from_clientsecrets', (['"""client_secret.json"""', 'SCOP... |
# <NAME>
# S = 1/2, I = 1/2
# Spin 1/2 electron coupled to spin 1/2 nuclei
import numpy as np
from scipy.linalg import expm
from matplotlib.pylab import *
from matplotlib import cm
sigma_x = 0.5*np.r_[[[0, 1],[1, 0]]]
sigma_y = 0.5*np.r_[[[0,-1j],[1j, 0]]]
sigma_z = 0.5*np.r_[[[1, 0],[0, -1]]]
Identity = np.eye(2)
... | [
"numpy.eye",
"numpy.allclose",
"numpy.linalg.eig",
"numpy.kron",
"numpy.dot"
] | [((308, 317), 'numpy.eye', 'np.eye', (['(2)'], {}), '(2)\n', (314, 317), True, 'import numpy as np\n'), ((325, 351), 'numpy.kron', 'np.kron', (['sigma_x', 'Identity'], {}), '(sigma_x, Identity)\n', (332, 351), True, 'import numpy as np\n'), ((357, 383), 'numpy.kron', 'np.kron', (['sigma_y', 'Identity'], {}), '(sigma_y,... |
from spiderNest.preIntro import *
path_ = os.path.dirname(os.path.dirname(__file__)) + '/dataBase/log_information.csv'
def save_login_info(VMess, class_):
"""
VMessๅ
ฅๅบ
class_: ssr or v2ray
"""
now = str(datetime.now()).split('.')[0]
with open(path_, 'a', encoding='utf-8', newline='') as f:
... | [
"datetime.datetime.now",
"datetime.timedelta",
"datetime.datetime.fromisoformat"
] | [((225, 239), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (237, 239), False, 'from datetime import datetime, timedelta\n'), ((1602, 1631), 'datetime.datetime.fromisoformat', 'datetime.fromisoformat', (['vm[0]'], {}), '(vm[0])\n', (1624, 1631), False, 'from datetime import datetime, timedelta\n'), ((1634,... |
import os.path
import re
import sys
import traceback
from pprint import pformat
import tornado
from tornado import template
SENSITIVE_SETTINGS_RE = re.compile(
'api|key|pass|salt|secret|signature|token',
flags=re.IGNORECASE
)
class ExceptionReporter:
def __init__(self, exc_info, handler):
self.... | [
"pprint.pformat",
"re.compile"
] | [((151, 226), 're.compile', 're.compile', (['"""api|key|pass|salt|secret|signature|token"""'], {'flags': 're.IGNORECASE'}), "('api|key|pass|salt|secret|signature|token', flags=re.IGNORECASE)\n", (161, 226), False, 'import re\n'), ((3995, 4018), 'pprint.pformat', 'pformat', (['value'], {'width': '(1)'}), '(value, width=... |
'''
Created on Mar 6, 2018
@author: cef
hp functions for workign with dictionaries
'''
import logging, os, sys, math, copy, inspect
from collections import OrderedDict
from weakref import WeakValueDictionary as wdict
import numpy as np
import hp.basic
mod_logger = logging.getLogger(__name__) #... | [
"logging.getLogger",
"numpy.all",
"copy.copy",
"copy.deepcopy"
] | [((291, 318), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (308, 318), False, 'import logging, os, sys, math, copy, inspect\n'), ((4046, 4062), 'copy.copy', 'copy.copy', (['d_big'], {}), '(d_big)\n', (4055, 4062), False, 'import logging, os, sys, math, copy, inspect\n'), ((11902, 11920)... |
#Grapheme
Rime_tone=[ "a","ฤ","รข","e","รช","i","o","รด","ฦก","u","ฦฐ","y","iรช","oa","oฤ","oe","oo","uรข","uรช","uรด","uฦก","uy","ฦฐฦก","uyรช","yรช", #blank
"รก","แบฏ","แบฅ","รฉ","แบฟ","รญ","รณ","แป","แป","รบ","แปฉ","รฝ","iแบฟ","รณa","oแบฏ","รณe","oรณ","uแบฅ","uแบฟ","uแป","ฦฐแป","รบy","ฦฐแป","uyแบฟ","yแบฟ", #grave
... | [
"re.split",
"eng_to_ipa.convert",
"re.sub",
"underthesea.word_tokenize",
"sys.path.append"
] | [((53180, 53206), 'sys.path.append', 'sys.path.append', (['"""./Rules"""'], {}), "('./Rules')\n", (53195, 53206), False, 'import sys, codecs, re\n'), ((54939, 54965), 'sys.path.append', 'sys.path.append', (['"""./Rules"""'], {}), "('./Rules')\n", (54954, 54965), False, 'import sys, codecs, re\n'), ((60447, 60464), 'und... |
import unittest
#write the import for function for assignment7 sum_list_values
from src.assignments.assignment7 import sum_list_values
class Test_Assign7(unittest.TestCase):
def sample_test(self):
self.assertEqual(1,1)
#create a test for the sum_list_values function with list elements:
# bill 23 ... | [
"src.assignments.assignment7.sum_list_values"
] | [((441, 467), 'src.assignments.assignment7.sum_list_values', 'sum_list_values', (['test_list'], {}), '(test_list)\n', (456, 467), False, 'from src.assignments.assignment7 import sum_list_values\n')] |
import pytest
import numpy as np
from numpy.testing import assert_allclose
from keras import backend as K
from keras import activations
def get_standard_values():
'''
These are just a set of floats used for testing the activation
functions, and are useful in multiple tests.
'''
return np.array([[... | [
"keras.activations.linear",
"keras.backend.floatx",
"keras.activations.hard_sigmoid",
"numpy.testing.assert_allclose",
"keras.backend.placeholder",
"numpy.tanh",
"pytest.main",
"numpy.max",
"numpy.exp",
"keras.activations.softmax",
"keras.activations.sigmoid",
"numpy.size",
"keras.activation... | [((575, 596), 'keras.backend.placeholder', 'K.placeholder', ([], {'ndim': '(2)'}), '(ndim=2)\n', (588, 596), True, 'from keras import backend as K\n'), ((761, 806), 'numpy.testing.assert_allclose', 'assert_allclose', (['result', 'expected'], {'rtol': '(1e-05)'}), '(result, expected, rtol=1e-05)\n', (776, 806), False, '... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... | [
"unittest.mock.mock_open",
"tests.test_cli.tools_for_testing.ContextMock",
"unittest.mock.patch",
"aea.cli.generate._generate_item"
] | [((1142, 1185), 'unittest.mock.patch', 'mock.patch', (['"""aea.cli.generate.ConfigLoader"""'], {}), "('aea.cli.generate.ConfigLoader')\n", (1152, 1185), False, 'from unittest import TestCase, mock\n'), ((1187, 1258), 'unittest.mock.patch', 'mock.patch', (['"""aea.cli.generate.os.path.join"""'], {'return_value': '"""joi... |
"""
sphinx.ext.napoleon
~~~~~~~~~~~~~~~~~~~
Support for NumPy and Google style docstrings.
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from sphinx import __display_version__ as __version__
from sphinx.application import Sphinx
from ... | [
"importlib.import_module",
"functools.reduce",
"sphinx.locale._",
"sphinx.ext.napoleon.docstring.GoogleDocstring",
"sphinx.ext.napoleon.docstring.NumpyDocstring"
] | [((13152, 13223), 'sphinx.ext.napoleon.docstring.NumpyDocstring', 'NumpyDocstring', (['result_lines', 'app.config', 'app', 'what', 'name', 'obj', 'options'], {}), '(result_lines, app.config, app, what, name, obj, options)\n', (13166, 13223), False, 'from sphinx.ext.napoleon.docstring import GoogleDocstring, NumpyDocstr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from rdkit import DataStructs
import plugin_api
__license__ = "X11"
class LbvsEntry(plugin_api.PluginInterface):
"""
Compute Tanimoto similarity.
"""
def __init__(self):
self.stream = None
self.counter = 0
self.first_... | [
"json.load",
"rdkit.DataStructs.TanimotoSimilarity",
"rdkit.DataStructs.cDataStructs.IntSparseIntVect",
"json.dump"
] | [((1496, 1585), 'json.dump', 'json.dump', (["{'query': query['id'], 'id': item['id'], 'value': similarity}", 'self.stream'], {}), "({'query': query['id'], 'id': item['id'], 'value': similarity},\n self.stream)\n", (1505, 1585), False, 'import json\n'), ((2021, 2071), 'rdkit.DataStructs.cDataStructs.IntSparseIntVect'... |
import os
import weather
import datetime
import unittest
import tempfile
class WeatherTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, weather.app.config['DATABASE'] = tempfile.mkstemp()
weather.app.config['TESTING'] = True
self.app = weather.app.test_client()
weather.init... | [
"weather.init_db",
"os.close",
"weather.app.test_client",
"os.unlink",
"unittest.main",
"tempfile.mkstemp"
] | [((949, 964), 'unittest.main', 'unittest.main', ([], {}), '()\n', (962, 964), False, 'import unittest\n'), ((191, 209), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {}), '()\n', (207, 209), False, 'import tempfile\n'), ((274, 299), 'weather.app.test_client', 'weather.app.test_client', ([], {}), '()\n', (297, 299), Fals... |
import yagmail
receiver = "<EMAIL>" #Receiver's gmail address
body = "Hello there from Yagmail"
filename = "document.pdf"
yag = yagmail.SMTP("<EMAIL>")#Your gmail address
yag.send(
to=receiver,
subject="Yagmail test (attachment included",
contents=body,
attachments=filename,
)
| [
"yagmail.SMTP"
] | [((136, 159), 'yagmail.SMTP', 'yagmail.SMTP', (['"""<EMAIL>"""'], {}), "('<EMAIL>')\n", (148, 159), False, 'import yagmail\n')] |
##############################################################################
#
# Copyright (c) 2003-2020 by The University of Queensland
# http://www.uq.edu.au
#
# Primary Business: Queensland, Australia
# Licensed under the Apache License, version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Development unt... | [
"numpy.ones",
"math.sqrt",
"math.cos",
"numpy.array",
"numpy.dot",
"numpy.zeros",
"math.sin"
] | [((3470, 3576), 'numpy.array', 'numpy.array', (['[x[1] * y[2] - x[2] * y[1], x[2] * y[0] - x[0] * y[2], x[0] * y[1] - x[1] *\n y[0]]', '_TYPE'], {}), '([x[1] * y[2] - x[2] * y[1], x[2] * y[0] - x[0] * y[2], x[0] * y\n [1] - x[1] * y[0]], _TYPE)\n', (3481, 3576), False, 'import numpy\n'), ((1609, 1626), 'numpy.zer... |
#!/usr/bin/env python
# coding=utf-8
from setuptools import setup, find_packages
with open('README.md', encoding='utf-8') as f:
readme = f.read()
with open('LICENSE', encoding='utf-8') as f:
license = f.read()
with open('requirements.txt', encoding='utf-8') as f:
reqs = f.read()
pkgs = [p for p in find_... | [
"setuptools.find_packages"
] | [((315, 330), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (328, 330), False, 'from setuptools import setup, find_packages\n')] |
#enhanced keyboard driver
import copy
import os
import configparser
from pp_displaymanager import DisplayManager
class pp_kbddriver_plus(object):
# control list items
NAME=0 # symbolic name for input and output
DIRECTION = 1 # in/out
MATCH = 2 # for input the charac... | [
"pp_displaymanager.DisplayManager",
"os.path.exists",
"configparser.ConfigParser",
"copy.deepcopy"
] | [((884, 900), 'pp_displaymanager.DisplayManager', 'DisplayManager', ([], {}), '()\n', (898, 900), False, 'from pp_displaymanager import DisplayManager\n'), ((9565, 9589), 'os.path.exists', 'os.path.exists', (['filepath'], {}), '(filepath)\n', (9579, 9589), False, 'import os\n'), ((2132, 2173), 'copy.deepcopy', 'copy.de... |
#!/usr/bin/env python
# Copyright 1996-2019 Cyberbotics Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"os.path.realpath",
"PIL.Image.new",
"PIL.Image.open",
"glob.glob"
] | [((975, 1010), 'glob.glob', 'glob.glob', (['"""*_diffuse_template.jpg"""'], {}), "('*_diffuse_template.jpg')\n", (984, 1010), False, 'import glob\n'), ((1915, 1938), 'PIL.Image.open', 'Image.open', (['template[0]'], {}), '(template[0])\n', (1925, 1938), False, 'from PIL import Image\n'), ((1950, 1973), 'PIL.Image.open'... |
# Copyright The PyTorch Lightning team.
#
# 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 i... | [
"torchmetrics.utilities.data.get_group_indexes",
"pangu.core.backend.cat",
"torchmetrics.functional.retrieval.fall_out.retrieval_fall_out",
"pangu.core.backend.tensor"
] | [((4312, 4338), 'pangu.core.backend.cat', 'B.cat', (['self.indexes'], {'dim': '(0)'}), '(self.indexes, dim=0)\n', (4317, 4338), True, 'import pangu.core.backend as B\n'), ((4355, 4379), 'pangu.core.backend.cat', 'B.cat', (['self.preds'], {'dim': '(0)'}), '(self.preds, dim=0)\n', (4360, 4379), True, 'import pangu.core.b... |
from arcapix.fs.gpfs.policy import PlacementPolicy
from arcapix.fs.gpfs.rule import MigrateRule
# load placement policy for mmfs1
policy = PlacementPolicy('mmfs1')
# create a new migrate rule for 'sata1'
r = MigrateRule(source='sata1', threshold=(90, 50))
# add rule to start of the policy
policy.rules.insert(r, 0)
... | [
"arcapix.fs.gpfs.policy.PlacementPolicy",
"arcapix.fs.gpfs.rule.MigrateRule"
] | [((140, 164), 'arcapix.fs.gpfs.policy.PlacementPolicy', 'PlacementPolicy', (['"""mmfs1"""'], {}), "('mmfs1')\n", (155, 164), False, 'from arcapix.fs.gpfs.policy import PlacementPolicy\n'), ((210, 257), 'arcapix.fs.gpfs.rule.MigrateRule', 'MigrateRule', ([], {'source': '"""sata1"""', 'threshold': '(90, 50)'}), "(source=... |
from flask import Blueprint, request, render_template, \
flash, g, session, redirect, url_for, jsonify
from app import db, requires_auth
from flask_cors import CORS
from .models import Paste
import uuid
from datetime import datetime
from app.user.models import User
from pygments import highlight
from pygments.lexers i... | [
"flask.render_template",
"dateutil.parser.parse",
"app.db.session.commit",
"app.db.session.delete",
"flask_cors.CORS",
"functools.wraps",
"uuid.uuid4",
"datetime.datetime.now",
"app.db.session.all",
"app.db.session.add",
"flask.Blueprint",
"app.user.models.User.query.filter",
"flask.jsonify"... | [((885, 913), 'flask.Blueprint', 'Blueprint', (['"""paste"""', '__name__'], {}), "('paste', __name__)\n", (894, 913), False, 'from flask import Blueprint, request, render_template, flash, g, session, redirect, url_for, jsonify\n'), ((914, 929), 'flask_cors.CORS', 'CORS', (['mod_paste'], {}), '(mod_paste)\n', (918, 929)... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script run neural network model on a camera live stream
"""
import argparse
import cv2
import numpy as np
import os
import time
import sys
COMMANDS = {0: "move_forward", 1: "go_down", 2: "rot_10_deg",
3: "go_up", 4: "take_off", 5: "land", 6: "idle"}... | [
"numpy.prod",
"time.sleep",
"cv2.imshow",
"homemade_framework.framework.LossMSE",
"homemade_framework.framework.Softmax",
"cv2.destroyAllWindows",
"tensorflow.keras.models.load_model",
"sys.path.append",
"homemade_framework.framework.LeakyReLU",
"argparse.ArgumentParser",
"cv2.threshold",
"num... | [((1221, 1246), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1244, 1246), False, 'import argparse\n'), ((3712, 3747), 'sys.path.append', 'sys.path.append', (['args.pyparrot_path'], {}), '(args.pyparrot_path)\n', (3727, 3747), False, 'import sys\n'), ((3833, 3885), 'pyparrot.Anafi.Anafi', 'An... |
from allennlp.common import JsonDict
from allennlp.data import DatasetReader, Instance
from allennlp.models import Model
from allennlp.predictors import Predictor
from overrides import overrides
@Predictor.register("sentence_classifier")
class SentenceClassifierPredictor(Predictor):
def predict(self, sentence: st... | [
"allennlp.predictors.Predictor.register"
] | [((198, 239), 'allennlp.predictors.Predictor.register', 'Predictor.register', (['"""sentence_classifier"""'], {}), "('sentence_classifier')\n", (216, 239), False, 'from allennlp.predictors import Predictor\n')] |
# Created on Sep 7, 2020
# author: <NAME>
# contact: <EMAIL>
import os
output_dir = os.path.curdir
def skinnytk2(R=1):
"""
This function generates the relations of Skinny-n-n for R rounds.
tk ================================================> TWEAKEY_P(tk) ===> ---
SB ... | [
"os.path.join"
] | [((3054, 3170), 'os.path.join', 'os.path.join', (['output_dir', "('relationfile_%s_%dr_mg%d_ms%d.txt' % (cipher_name, R, recommended_mg,\n recommended_ms))"], {}), "(output_dir, 'relationfile_%s_%dr_mg%d_ms%d.txt' % (cipher_name,\n R, recommended_mg, recommended_ms))\n", (3066, 3170), False, 'import os\n')] |
import urllib.request
import json
from .models import News
# Getting api key
api_key = None
# Getting the movie base url
base_url = None
def configure_request(app):
global api_key,base_url
api_key = app.config['NEWS_API_KEY']
base_url = app.config['NEWS_API_BASE_URL']
def get_news_source(country,category)... | [
"json.loads"
] | [((604, 636), 'json.loads', 'json.loads', (['get_news_source_data'], {}), '(get_news_source_data)\n', (614, 636), False, 'import json\n'), ((1880, 1909), 'json.loads', 'json.loads', (['news_details_data'], {}), '(news_details_data)\n', (1890, 1909), False, 'import json\n')] |
import numpy as np
from hypernet.src.general import const
from hypernet.src.general import utils
from hypernet.src.thermophysicalModels.reactionThermo.mixture import Basic
class MultiComponent(Basic):
# Initialization
###########################################################################
def __init... | [
"hypernet.src.general.utils.convert_to_array",
"numpy.sum",
"numpy.concatenate"
] | [((2710, 2723), 'numpy.sum', 'np.sum', (['dhedY'], {}), '(dhedY)\n', (2716, 2723), True, 'import numpy as np\n'), ((1649, 1666), 'numpy.concatenate', 'np.concatenate', (['R'], {}), '(R)\n', (1663, 1666), True, 'import numpy as np\n'), ((1968, 1985), 'numpy.concatenate', 'np.concatenate', (['n'], {}), '(n)\n', (1982, 19... |
from __future__ import print_function
from scipy.linalg import block_diag
from scipy.stats import norm as ndist
from scipy.interpolate import interp1d
import collections
import numpy as np
from numpy import log
from numpy.linalg import norm, qr, inv, eig
import pandas as pd
import regreg.api as rr
from .randomization... | [
"regreg.api.simple_problem",
"numpy.sqrt",
"numpy.hstack",
"scipy.interpolate.interp1d",
"numpy.array",
"numpy.linalg.norm",
"scipy.stats.norm.cdf",
"numpy.multiply",
"numpy.linalg.qr",
"numpy.reshape",
"regreg.api.identity_quadratic",
"regreg.api.group_lasso",
"numpy.flatnonzero",
"numpy.... | [((31360, 31406), 'scipy.linalg.block_diag', 'block_diag', (['*[i for gp in to_diag for i in gp]'], {}), '(*[i for gp in to_diag for i in gp])\n', (31370, 31406), False, 'from scipy.linalg import block_diag\n'), ((33085, 33101), 'numpy.array', 'np.array', (['groups'], {}), '(groups)\n', (33093, 33101), True, 'import nu... |
import six
import json
import gzip
from exporters.default_retries import retry_long
from exporters.writers.base_writer import BaseWriter
class ODOWriter(BaseWriter):
"""
Writes items to a odo destination. https://odo.readthedocs.org/en/latest/
Needed parameters:
- schema (object)
sc... | [
"odo.discover",
"gzip.open",
"flatson.Flatson",
"pandas.DataFrame",
"odo.resource"
] | [((800, 815), 'flatson.Flatson', 'Flatson', (['schema'], {}), '(schema)\n', (807, 815), False, 'from flatson import Flatson\n'), ((1258, 1320), 'pandas.DataFrame', 'pd.DataFrame', (['flattened_lines'], {'columns': 'self.flatson.fieldnames'}), '(flattened_lines, columns=self.flatson.fieldnames)\n', (1270, 1320), True, '... |
'''
Written by: <NAME> <EMAIL> <EMAIL>
Last updated: 29.01.2021
'''
# the concept is to generate a side channel resistant initialisation of the hashing function based on
# one secret key and several openly known initialisation vectors (IV) in a manner that the same input
# is not hashed too more than two times,... | [
"hashlib.sha3_512"
] | [((2526, 2544), 'hashlib.sha3_512', 'hashlib.sha3_512', ([], {}), '()\n', (2542, 2544), False, 'import hashlib\n'), ((1973, 1991), 'hashlib.sha3_512', 'hashlib.sha3_512', ([], {}), '()\n', (1989, 1991), False, 'import hashlib\n')] |
import os
def check_env(env_var_name):
"""
Check and return the type of an environment variable.
supported types:
None
Integer
String
@param env_var_name: environment variable name
@return: string of the type name.
"""
try:
val = os.getenv(env_var_name)
... | [
"os.getenv"
] | [((294, 317), 'os.getenv', 'os.getenv', (['env_var_name'], {}), '(env_var_name)\n', (303, 317), False, 'import os\n')] |
from .models import Sound , Album
from rest_framework import serializers
class SoundSerializer(serializers.ModelSerializer):
class Meta:
model = Sound
fields = ["name" , "song_image" , "pk" , "like" , "played" , "tag" , "singer" , "upload_date"]
class SoundDetailSerializer(seriali... | [
"rest_framework.serializers.SerializerMethodField"
] | [((474, 509), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {}), '()\n', (507, 509), False, 'from rest_framework import serializers\n')] |
from datetime import datetime
from django.conf import settings
import pytz
def check_tracker(obj, simple=True):
if simple:
if obj.status > 0:
return True
return False
# we have a gatekeeper
now = datetime.now(pytz.utc)
if obj.tracker_publish_status < 0:
... | [
"datetime.datetime.now"
] | [((246, 268), 'datetime.datetime.now', 'datetime.now', (['pytz.utc'], {}), '(pytz.utc)\n', (258, 268), False, 'from datetime import datetime\n')] |
import datetime
from fastapi import APIRouter
router = APIRouter()
@router.get("", tags=["health"])
async def get_health():
return {
"results": [],
"status": "success",
"timestamp": datetime.datetime.now().timestamp()
}
| [
"datetime.datetime.now",
"fastapi.APIRouter"
] | [((57, 68), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (66, 68), False, 'from fastapi import APIRouter\n'), ((214, 237), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (235, 237), False, 'import datetime\n')] |
import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
from distutils.version import StrictVersion
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
import json
import time
im... | [
"tensorflow.Graph",
"tensorflow.Session",
"tensorflow.GraphDef",
"cv2.cvtColor",
"tensorflow.import_graph_def",
"tensorflow.gfile.GFile",
"cv2.resize",
"time.time",
"cv2.imread"
] | [((471, 482), 'time.time', 'time.time', ([], {}), '()\n', (480, 482), False, 'import time\n'), ((502, 512), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (510, 512), True, 'import tensorflow as tf\n'), ((779, 790), 'time.time', 'time.time', ([], {}), '()\n', (788, 790), False, 'import time\n'), ((1643, 1676), 'tens... |
from __future__ import unicode_literals
import frappe, json
from frappe.model.utils.user_settings import update_user_settings, sync_user_settings
def execute():
users = frappe.db.sql("select distinct(user) from `__UserSettings`", as_dict=True)
for user in users:
user_settings = frappe.db.sql('''
select
* f... | [
"json.dumps",
"frappe.db.sql",
"frappe.model.utils.user_settings.sync_user_settings"
] | [((171, 245), 'frappe.db.sql', 'frappe.db.sql', (['"""select distinct(user) from `__UserSettings`"""'], {'as_dict': '(True)'}), "('select distinct(user) from `__UserSettings`', as_dict=True)\n", (184, 245), False, 'import frappe, json\n'), ((584, 604), 'frappe.model.utils.user_settings.sync_user_settings', 'sync_user_s... |
import BoltzmannMachine as bm
import QHO as qho
import numpy as np
import datetime
# Visualization imports
from IPython.display import clear_output
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['figure.dpi']=300
def sigmoid(x):
return .5 * (1 + np.tanh(x / 2.))
# Set t... | [
"numpy.fabs",
"QHO.QHOGas",
"PIL.Image.fromarray",
"matplotlib.pyplot.ylabel",
"numpy.average",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"numpy.tanh",
"IPython.display.clear_output",
"matplotlib.pyplot.rcParams.update",
"matplotlib.pyplot.figure",
"numpy.dot",
"BoltzmannMachin... | [((447, 462), 'QHO.QHOGas', 'qho.QHOGas', ([], {'N': 'N'}), '(N=N)\n', (457, 462), True, 'import QHO as qho\n'), ((3637, 3681), 'BoltzmannMachine.BoltzmannMachine', 'bm.BoltzmannMachine', ([], {'num_hidden': 'hidden_units'}), '(num_hidden=hidden_units)\n', (3656, 3681), True, 'import BoltzmannMachine as bm\n'), ((3849,... |
import time
import os
import sys
import shutil
import json
import argparse
from zipfile import ZipFile
from contextlib import contextmanager
from datetime import datetime
from Tests.private_build.upload_packs_private import download_and_extract_index, update_index_with_priced_packs, \
extract_packs_artifacts
from T... | [
"Tests.Marketplace.marketplace_services.init_storage_client",
"zipfile.ZipFile",
"Tests.scripts.utils.logging_wrapper.info",
"time.sleep",
"Tests.private_build.upload_packs_private.extract_packs_artifacts",
"sys.exit",
"Tests.private_build.upload_packs_private.download_and_extract_index",
"os.remove",... | [((3268, 3310), 'os.path.basename', 'os.path.basename', (['public_index_folder_path'], {}), '(public_index_folder_path)\n', (3284, 3310), False, 'import os\n'), ((3332, 3465), 'shutil.make_archive', 'shutil.make_archive', ([], {'base_name': 'public_index_folder_path', 'format': '"""zip"""', 'root_dir': 'extract_destina... |
import os
import shutil
from dataclasses import dataclass
from datetime import datetime
from typing import Dict, List, Optional
from huggingface_hub import Repository
from loguru import logger
from prettytable import PrettyTable
from .splits import TEST_SPLIT, TRAIN_SPLIT, VALID_SPLIT
from .tasks import TASKS
from .u... | [
"prettytable.PrettyTable",
"os.path.exists",
"loguru.logger.info",
"os.path.join",
"huggingface_hub.Repository",
"os.path.isfile",
"os.path.dirname",
"shutil.copyfile",
"loguru.logger.error",
"os.path.basename",
"datetime.datetime.fromisoformat",
"shutil.rmtree",
"os.path.expanduser"
] | [((4759, 4816), 'loguru.logger.info', 'logger.info', (['"""๐ Refreshing uploaded files information..."""'], {}), "('๐ Refreshing uploaded files information...')\n", (4770, 4816), False, 'from loguru import logger\n'), ((5021, 5070), 'loguru.logger.info', 'logger.info', (['"""๐ Refreshing models information..."""'], ... |
r"""Training and evaluating quantum kernels
===========================================
.. meta::
:property="og:description": Kernels and alignment training with Pennylane.
:property="og:image": https://pennylane.ai/qml/_images/QEK_thumbnail.png
.. related::
tutorial_kernel_based_training Kernel-based tr... | [
"pennylane.broadcast",
"pennylane.numpy.ndindex",
"pennylane.device",
"pennylane.numpy.zeros_like",
"pennylane.GradientDescentOptimizer",
"pennylane.numpy.array",
"pennylane.numpy.printoptions",
"pennylane.numpy.sin",
"pennylane.numpy.sum",
"pennylane.numpy.vstack",
"pennylane.qnode",
"matplot... | [((5625, 5645), 'pennylane.numpy.random.seed', 'np.random.seed', (['(1359)'], {}), '(1359)\n', (5639, 5645), True, 'from pennylane import numpy as np\n'), ((10210, 10229), 'pennylane.adjoint', 'qml.adjoint', (['ansatz'], {}), '(ansatz)\n', (10221, 10229), True, 'import pennylane as qml\n'), ((10728, 10776), 'pennylane.... |