code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
The MIT License (MIT)
Copyright (c) 2021-present Village
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, mer... | [
"asyncio.sleep",
"aiohttp.FormData",
"asyncio.Event",
"asyncio.Lock",
"typing.TypeVar",
"datetime.datetime.now"
] | [((1898, 1910), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (1905, 1910), False, 'from typing import Any, ClassVar, Coroutine, Dict, Mapping, Optional, Sequence, Type, TypeVar, Union\n'), ((2471, 2485), 'asyncio.Lock', 'asyncio.Lock', ([], {}), '()\n', (2483, 2485), False, 'import asyncio\n'), ((3291, 33... |
from collections import defaultdict
from dss_vae.structs import GlobalNames
from dss_vae.structs import FScore
from dss_vae.structs import PhraseTree
from dss_vae.utils.utility import write_docs
from dss_vae.preprocess import s2b_to_s2t
from dss_vae.preprocess import s2t_check
from dss_vae.preprocess import s2t_fix
fr... | [
"dss_vae.structs.FScore.eval_seq_list",
"dss_vae.structs.GlobalNames.get_fm",
"dss_vae.preprocess.s2t_to_tree",
"dss_vae.utils.utility.write_docs",
"dss_vae.structs.PhraseTree.load_treefile",
"collections.defaultdict",
"dss_vae.preprocess.s2t_check"
] | [((2990, 3006), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (3001, 3006), False, 'from collections import defaultdict\n'), ((3019, 3054), 'dss_vae.structs.PhraseTree.load_treefile', 'PhraseTree.load_treefile', (['tree_file'], {}), '(tree_file)\n', (3043, 3054), False, 'from dss_vae.structs impor... |
from .resnet import resnet50
import torch.nn as nn
import torch.nn.functional as F
import torch
import numpy as np
class fpn_module_global(nn.Module):
def __init__(self, numClass):
super(fpn_module_global, self).__init__()
self._up_kwargs = {'mode': 'bilinear'}
# Top layer
self.top... | [
"torch.nn.MSELoss",
"torch.stack",
"torch.nn.functional.grid_sample",
"torch.nn.Conv2d",
"numpy.zeros",
"torch.cat",
"torch.nn.init.normal_",
"torch.nn.init.constant_",
"torch.zeros",
"torch.nn.functional.interpolate",
"torch.no_grad",
"numpy.round",
"torch.from_numpy"
] | [((328, 384), 'torch.nn.Conv2d', 'nn.Conv2d', (['(2048)', '(256)'], {'kernel_size': '(1)', 'stride': '(1)', 'padding': '(0)'}), '(2048, 256, kernel_size=1, stride=1, padding=0)\n', (337, 384), True, 'import torch.nn as nn\n'), ((453, 509), 'torch.nn.Conv2d', 'nn.Conv2d', (['(1024)', '(256)'], {'kernel_size': '(1)', 'st... |
import os.path
import sys
from functools import reduce
from os.path import exists
from werkzeug.utils import ImportStringError
def import_from_string(import_name: str, silent: bool = False):
import_name = import_name.replace(":", ".")
try:
try:
__import__(import_name)
except Import... | [
"functools.reduce",
"os.path.exists",
"werkzeug.utils.ImportStringError",
"sys.exc_info"
] | [((1258, 1270), 'os.path.exists', 'exists', (['path'], {}), '(path)\n', (1264, 1270), False, 'from os.path import exists\n'), ((1170, 1201), 'functools.reduce', 'reduce', (['os.path.join', 'more_path'], {}), '(os.path.join, more_path)\n', (1176, 1201), False, 'from functools import reduce\n'), ((778, 811), 'werkzeug.ut... |
import os
import shutil
from sys import platform
from .base import Mingw64BaseRecipe
from hardhat.urls import Urls
from hardhat.util import patch
class Mingw64OpenBlasRecipe(Mingw64BaseRecipe):
def __init__(self, *args, **kwargs):
super(Mingw64OpenBlasRecipe, self).__init__(*args, **kwargs)
self.s... | [
"hardhat.urls.Urls.github_commit",
"hardhat.util.patch",
"os.path.join"
] | [((614, 668), 'hardhat.urls.Urls.github_commit', 'Urls.github_commit', (['"""xianyi"""', '"""OpenBLAS"""', 'self.version'], {}), "('xianyi', 'OpenBLAS', self.version)\n", (632, 668), False, 'from hardhat.urls import Urls\n'), ((3090, 3139), 'os.path.join', 'os.path.join', (['self.directory', '"""Makefile.prebuild"""'],... |
#!/usr/bin/env python
"""
Pandoc filter to convert divs with class="theorem" to LaTeX
theorem environments in LaTeX output, and to numbered theorems
in HTML output.
"""
from pandocfilters import toJSONFilter, RawBlock, Div
theoremcount = 0
def latex(x):
return RawBlock('latex',x)
def html(x):
return RawBlock('... | [
"pandocfilters.Div",
"pandocfilters.RawBlock",
"pandocfilters.toJSONFilter"
] | [((267, 287), 'pandocfilters.RawBlock', 'RawBlock', (['"""latex"""', 'x'], {}), "('latex', x)\n", (275, 287), False, 'from pandocfilters import toJSONFilter, RawBlock, Div\n'), ((310, 329), 'pandocfilters.RawBlock', 'RawBlock', (['"""html"""', 'x'], {}), "('html', x)\n", (318, 329), False, 'from pandocfilters import to... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 30 21:24:36 2019
@author: wmy
"""
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from PIL import Image
from keras import backend as K
from keras.losses import mean_absolute_error, mean_squared_error
from keras.models import load_m... | [
"random.uniform",
"utils.DataLoader",
"numpy.asarray",
"random.choice",
"numpy.clip",
"PIL.Image.fromarray",
"numpy.array",
"model.wdsr_b"
] | [((461, 495), 'model.wdsr_b', 'wdsr_b', ([], {'scale': '(4)', 'num_res_blocks': '(32)'}), '(scale=4, num_res_blocks=32)\n', (467, 495), False, 'from model import wdsr_a, wdsr_b\n'), ((562, 581), 'utils.DataLoader', 'DataLoader', ([], {'scale': '(4)'}), '(scale=4)\n', (572, 581), False, 'from utils import DataLoader\n')... |
import json
import logging
import os
import traceback
from string import Formatter, Template
from datetime import datetime
from dateutil.parser import parse as dateparse
from satstac import __version__, STACError, Thing, utils
logger = logging.getLogger(__name__)
class Item(Thing):
def __init__(self, *args, ... | [
"dateutil.parser.parse",
"os.path.join",
"string.Formatter",
"logging.warning",
"os.path.exists",
"string.Template",
"os.path.splitext",
"satstac.utils.download_file",
"traceback.format_exc",
"satstac.utils.mkdirp",
"logging.getLogger"
] | [((240, 267), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (257, 267), False, 'import logging\n'), ((1984, 2011), 'dateutil.parser.parse', 'dateparse', (["self['datetime']"], {}), "(self['datetime'])\n", (1993, 2011), True, 'from dateutil.parser import parse as dateparse\n'), ((3193, 32... |
# Generated by Django 3.1.5 on 2021-05-30 18:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('financeiro', '0021_auto_20210530_1434'),
('vendas', '0002_auto_20210528_1954'),
]
operations = [
mi... | [
"django.db.models.OneToOneField"
] | [((419, 562), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'to': '"""financeiro.receita"""', 'verbose_name': '"""Receita"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.SET_NULL, to='fina... |
import os
import sys
from time import sleep
from colors import WOOD, BLACK, WHITE
import pygame
from renderer import Renderer
from renderer.Renderer import eventManager
from events import EventEnums
Renderer.initializeRenderer()
from gui.button import Button
import json
import glob
replays = glob.glob('replays/*')
f ... | [
"renderer.Renderer.getScreenResolution",
"pygame.quit",
"json.load",
"renderer.Renderer.initializeRenderer",
"renderer.Renderer.eventManager.subscribe",
"renderer.Renderer.processEventsAndCallables",
"pygame.font.SysFont",
"renderer.Renderer.addCallableToBackgroundLoop",
"renderer.Renderer.screen.fi... | [((199, 228), 'renderer.Renderer.initializeRenderer', 'Renderer.initializeRenderer', ([], {}), '()\n', (226, 228), False, 'from renderer import Renderer\n'), ((295, 317), 'glob.glob', 'glob.glob', (['"""replays/*"""'], {}), "('replays/*')\n", (304, 317), False, 'import glob\n'), ((349, 361), 'json.load', 'json.load', (... |
import os
from ..DCGAN import DCGAN
from .gan_trainer import GANTrainer
from .standard_configurations.dcgan_config import _C
class DCGANTrainer(GANTrainer):
r"""
A trainer structure for the DCGAN and DCGAN product models
"""
_defaultConfig = _C
def getDefaultConfig(self):
return DCGANTr... | [
"os.path.join"
] | [((1008, 1080), 'os.path.join', 'os.path.join', (['self.checkPointDir', "(self.modelLabel + '_train_config.json')"], {}), "(self.checkPointDir, self.modelLabel + '_train_config.json')\n", (1020, 1080), False, 'import os\n')] |
from graphene_django.views import GraphQLView
from server.token_auth import TokenAuthMiddleware
from server.channels import GraphQLSubscriptionConsumer
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.http import AsgiHandler
from channels.auth import AuthMiddlewareStack
from django.conf impor... | [
"graphene_django.views.GraphQLView.as_view",
"django.conf.urls.static.static",
"django.urls.path"
] | [((697, 758), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (703, 758), False, 'from django.conf.urls.static import static\n'), ((774, 837), 'django.conf.urls.static.static', 'static', (['setti... |
import os
import time
import numpy as np
import paddle.fluid as fluid
import config as cfg
from nets.attention_model import attention_train_net
from nets.crnn_ctc_model import ctc_train_net
from utils import data_reader
from utils.utility import get_ctc_feeder_data, get_attention_feeder_data
def main():
"""OCR tr... | [
"paddle.fluid.Executor",
"paddle.fluid.CUDAPlace",
"paddle.fluid.default_main_program",
"utils.data_reader.test",
"paddle.fluid.default_startup_program",
"os.makedirs",
"os.path.exists",
"time.time",
"utils.data_reader.train",
"numpy.array",
"paddle.fluid.CPUPlace",
"paddle.fluid.ParallelExecu... | [((722, 847), 'utils.data_reader.train', 'data_reader.train', ([], {'batch_size': 'cfg.batch_size', 'prefix_path': 'cfg.train_prefix', 'cycle': '(cfg.total_step > 0)', 'model': 'cfg.use_model'}), '(batch_size=cfg.batch_size, prefix_path=cfg.train_prefix,\n cycle=cfg.total_step > 0, model=cfg.use_model)\n', (739, 847... |
from dataclasses import dataclass
from typing import Generic, TypeVar
from eth_typing import NodeID
from eth_utils import int_to_big_endian
import rlp
from ddht.endpoint import Endpoint
class BaseMessage(rlp.Serializable): # type: ignore
message_type: int
def to_bytes(self) -> bytes:
return b"".jo... | [
"rlp.encode",
"typing.TypeVar",
"eth_utils.int_to_big_endian",
"dataclasses.dataclass"
] | [((394, 432), 'typing.TypeVar', 'TypeVar', (['"""TMessage"""'], {'bound': 'BaseMessage'}), "('TMessage', bound=BaseMessage)\n", (401, 432), False, 'from typing import Generic, TypeVar\n'), ((452, 498), 'typing.TypeVar', 'TypeVar', (['"""TResponseMessage"""'], {'bound': 'BaseMessage'}), "('TResponseMessage', bound=BaseM... |
"""
cloudalbum/api/users.py
~~~~~~~~~~~~~~~~~~~~~~~
REST API for users
:description: CloudAlbum is a fully featured sample application for 'Moving to AWS serverless' training course
:copyright: © 2019 written by <NAME>, <NAME>.
:license: MIT, see LICENSE for more details.
"""
import hashlib
imp... | [
"werkzeug.exceptions.InternalServerError",
"flask.Blueprint",
"boto3.client",
"flask_restplus.Api",
"werkzeug.exceptions.BadRequest",
"flask.current_app.logger.error",
"flask.current_app.logger.debug",
"flask.jsonify",
"werkzeug.exceptions.Conflict",
"cloudalbum.schemas.validate_user",
"base64.b... | [((866, 894), 'flask.Blueprint', 'Blueprint', (['"""users"""', '__name__'], {}), "('users', __name__)\n", (875, 894), False, 'from flask import Blueprint, request\n'), ((901, 1054), 'flask_restplus.Api', 'Api', (['users_blueprint'], {'doc': '"""/swagger/"""', 'title': '"""Users"""', 'description': '"""CloudAlbum-users:... |
__author__ = 'JOHNMCL'
import json
import time
import requests
baseUrl = "https://winkapi.quirky.com"
headers = {}
class wink_sensor_pod(object):
""" represents a wink.py sensor
json_obj holds the json stat at init (and if there is a refresh it's updated
it's the native format for this objects methods... | [
"time.sleep",
"json.dumps",
"requests.get",
"time.time"
] | [((3495, 3535), 'requests.get', 'requests.get', (['urlString'], {'headers': 'headers'}), '(urlString, headers=headers)\n', (3507, 3535), False, 'import requests\n'), ((3722, 3762), 'requests.get', 'requests.get', (['urlString'], {'headers': 'headers'}), '(urlString, headers=headers)\n', (3734, 3762), False, 'import req... |
# -*- coding: utf-8 -*-
import contextlib
import operator
import socket
import struct
import threading
from resources.lib.kodi import kodilogging
from resources.lib.kodi.utils import get_setting_as_bool
from resources.lib.tubecast.kodicast import Kodicast
from resources.lib.tubecast.utils import build_template, str_to... | [
"resources.lib.kodi.utils.get_setting_as_bool",
"SocketServer.ThreadingUDPServer.__init__",
"socket.socket",
"resources.lib.tubecast.utils.build_template",
"struct.pack",
"operator.truth",
"socket.inet_aton",
"SocketServer.ThreadingUDPServer.server_bind",
"resources.lib.kodi.kodilogging.get_logger",... | [((502, 532), 'resources.lib.kodi.kodilogging.get_logger', 'kodilogging.get_logger', (['"""ssdp"""'], {}), "('ssdp')\n", (524, 532), False, 'from resources.lib.kodi import kodilogging\n'), ((1632, 1708), 'SocketServer.ThreadingUDPServer.__init__', 'ThreadingUDPServer.__init__', (['self', "('', addr[1])", 'handler', 'bi... |
import logging as lg
from threading import Thread
from thrift.protocol import TBinaryProtocol
from thrift.server import TServer
from thrift.transport import TSocket
from thrift.transport import TTransport
from ...thrift.worker.service import WorkerService
from .handler import WorkerServiceHandler
from .worker import ... | [
"threading.Thread",
"thrift.protocol.TBinaryProtocol.TBinaryProtocolFactory",
"thrift.transport.TSocket.TServerSocket",
"thrift.transport.TTransport.TBufferedTransportFactory",
"logging.getLogger"
] | [((454, 476), 'logging.getLogger', 'lg.getLogger', (['__name__'], {}), '(__name__)\n', (466, 476), True, 'import logging as lg\n'), ((1422, 1455), 'threading.Thread', 'Thread', ([], {'target': 'self._run', 'args': '()'}), '(target=self._run, args=())\n', (1428, 1455), False, 'from threading import Thread\n'), ((1042, 1... |
'''
Build script for package's wheel and zip files.
Look in the `dist` folder for the output.
Usage:
Run as follows:
>python setup.py sdist --formats=zip bdist_wheel
'''
from pathlib import Path
import json
import os
import setuptools
import shutil
import sys
from platform import python_revision
def cle... | [
"shutil.rmtree",
"pathlib.Path",
"setuptools.setup",
"setuptools.find_packages"
] | [((1182, 1213), 'setuptools.find_packages', 'setuptools.find_packages', (['"""src"""'], {}), "('src')\n", (1206, 1213), False, 'import setuptools\n'), ((1406, 2056), 'setuptools.setup', 'setuptools.setup', ([], {'name': "package_dict['name']", 'version': "package_dict['__version__']", 'author': "package_dict['__author_... |
# coding=utf-8
import configparser
import datetime as dt
import json
import sqlite3
import os
from telethon.sync import TelegramClient
from telethon import connection
# для корректного переноса времени сообщений в json
from datetime import date, datetime
# классы для работы с каналами
from telethon.tl.functions.chan... | [
"telethon.sync.TelegramClient",
"telethon.tl.functions.messages.GetHistoryRequest",
"sqlite3.connect",
"configparser.ConfigParser",
"json.JSONEncoder.default"
] | [((543, 570), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (568, 570), False, 'import configparser\n'), ((775, 817), 'telethon.sync.TelegramClient', 'TelegramClient', (['username', 'api_id', 'api_hash'], {}), '(username, api_id, api_hash)\n', (789, 817), False, 'from telethon.sync import ... |
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Copyright 2021- QuOCS 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://ww... | [
"qtpy.QtCore.Slot",
"logging.getLogger"
] | [((1005, 1035), 'logging.getLogger', 'logging.getLogger', (['"""oc_logger"""'], {}), "('oc_logger')\n", (1022, 1035), False, 'import logging\n'), ((1069, 1086), 'qtpy.QtCore.Slot', 'QtCore.Slot', (['bool'], {}), '(bool)\n', (1080, 1086), False, 'from qtpy import QtCore\n')] |
import re
import spacy
import torch
class Tree:
def __init__(self, val=None, formula=None):
if val:
self.val = val
self.children = []
if formula:
root = self.parse(formula)
self.val = root.val
self.children = root.children
def parse(s... | [
"spacy.load",
"re.search",
"torch.tensor"
] | [((2270, 2286), 'spacy.load', 'spacy.load', (['"""en"""'], {}), "('en')\n", (2280, 2286), False, 'import spacy\n'), ((347, 384), 're.search', 're.search', (['"""(.*?)\\\\((.*)\\\\)"""', 'formula'], {}), "('(.*?)\\\\((.*)\\\\)', formula)\n", (356, 384), False, 'import re\n'), ((2765, 2825), 'torch.tensor', 'torch.tensor... |
"""
Copyright (2017) <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distr... | [
"alarm_central_station_receiver.config.AlarmConfig.config.getboolean",
"smtplib.SMTP",
"email.mime.text.MIMEText",
"email.mime.multipart.MIMEMultipart",
"alarm_central_station_receiver.config.AlarmConfig.config.get",
"logging.info"
] | [((1527, 1559), 'logging.info', 'logging.info', (['"""Sending email..."""'], {}), "('Sending email...')\n", (1539, 1559), False, 'import logging\n'), ((1575, 1630), 'alarm_central_station_receiver.config.AlarmConfig.config.get', 'AlarmConfig.config.get', (['"""EmailNotification"""', '"""username"""'], {}), "('EmailNoti... |
# -*- coding: utf-8 -*-
"""bioimageit_core Allgo process service.
This module implements a service to run a process
using the AllGo client API (allgo18.inria.fr).
Classes
-------
ProcessServiceProvider
"""
import os
import ntpath
import allgo as ag
from bioimageit_core.config import ConfigAccess
from bioimageit... | [
"bioimageit_core.config.ConfigAccess.instance",
"os.path.abspath",
"ntpath.basename",
"allgo.Client"
] | [((1545, 1561), 'allgo.Client', 'ag.Client', (['token'], {}), '(token)\n', (1554, 1561), True, 'import allgo as ag\n'), ((2522, 2551), 'ntpath.basename', 'ntpath.basename', (['output.value'], {}), '(output.value)\n', (2537, 2551), False, 'import ntpath\n'), ((1421, 1444), 'bioimageit_core.config.ConfigAccess.instance',... |
from setuptools import setup, find_packages
setup(
name='newpackage',
version='0.10',
packages=find_packages(exclude=['tests*']),
license='MIT',
description='Another EDSA example python packages',
long_description=open('README.md').read(),
install_requirements=['numpy'],
url='https://gi... | [
"setuptools.find_packages"
] | [((108, 141), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests*']"}), "(exclude=['tests*'])\n", (121, 141), False, 'from setuptools import setup, find_packages\n')] |
#!/usr/bin/env python
import json
import sys
def validate(input):
normalized = normalize_internal(input)
if normalized != input:
sys.stderr.write("Input is not normalized.\n")
sys.exit(1)
def normalize_internal(input):
db = json.loads(input)
string = json.dumps(normalize_db(db), ensur... | [
"sys.stderr.write",
"json.loads",
"sys.exit"
] | [((255, 272), 'json.loads', 'json.loads', (['input'], {}), '(input)\n', (265, 272), False, 'import json\n'), ((2408, 2574), 'sys.stderr.write', 'sys.stderr.write', (['("""Usage: %s [command]\n\nCommands:\n\n* validate -- Checks that db.json is normalized.\n* normalize -- Normalizes db.json.\n\n"""\n % sys.argv[0])... |
#!/usr/bin/env python
# Copyright 2016 <NAME>
# Apache 2.0.
from __future__ import print_function
import argparse
import sys
def GetArgs():
parser = argparse.ArgumentParser(description = "Apply an lexicon edits file (output from subtools/kaldi/steps/dict/select_prons_bayesian.py)to an input lexicon"
... | [
"argparse.ArgumentParser"
] | [((157, 427), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Apply an lexicon edits file (output from subtools/kaldi/steps/dict/select_prons_bayesian.py)to an input lexiconto produce a learned lexicon."""', 'epilog': '"""See subtools/kaldi/steps/dict/learn_lexicon_greedy.sh for example""... |
import numpy
import qm3
import qm3.engines.gaussian
import io
import os
import sys
cwd = os.path.abspath( os.path.dirname( sys.argv[0] ) ) + os.sep
mol = qm3.molecule()
mol.pdb_read( open( cwd + "charmm.pdb" ) )
mol.psf_read( open( cwd + "charmm.psf" ) )
mol.guess_atomic_numbers()
print( mol.anum )
print( mol.... | [
"io.StringIO",
"qm3.engines.gaussian.run",
"os.path.dirname",
"numpy.logical_not",
"qm3.molecule",
"numpy.fabs",
"numpy.linalg.norm"
] | [((163, 177), 'qm3.molecule', 'qm3.molecule', ([], {}), '()\n', (175, 177), False, 'import qm3\n'), ((454, 476), 'numpy.logical_not', 'numpy.logical_not', (['sqm'], {}), '(sqm)\n', (471, 476), False, 'import numpy\n'), ((575, 765), 'io.StringIO', 'io.StringIO', (['"""%chk=gauss.chk\n%mem=2048mb\n%nproc=2\n#p b3lyp/def2... |
"""Unittests for module 'immaculater' that cannot live peaceably with immaculater_test.
This unittest is separate because once you call SetAllowOversizeProtos(True)
you cannot change it.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
import pi... | [
"pipes.quote",
"pyatdllib.ui.test_helper.main"
] | [((968, 986), 'pyatdllib.ui.test_helper.main', 'test_helper.main', ([], {}), '()\n', (984, 986), False, 'from pyatdllib.ui import test_helper\n'), ((839, 861), 'pipes.quote', 'pipes.quote', (['save_path'], {}), '(save_path)\n', (850, 861), False, 'import pipes\n')] |
""" The Envisage core plugin. """
# Enthought library imports.
from envisage.api import ExtensionPoint, Plugin, ServiceOffer
from traits.api import List, Instance, on_trait_change, Str
class CorePlugin(Plugin):
""" The Envisage core plugin.
The core plugin offers facilities that are generally useful when b... | [
"traits.api.List",
"traits.api.Instance",
"envisage.resource.api.ResourceManager",
"traits.api.on_trait_change"
] | [((2124, 2159), 'traits.api.on_trait_change', 'on_trait_change', (['"""categories_items"""'], {}), "('categories_items')\n", (2139, 2159), False, 'from traits.api import List, Instance, on_trait_change, Str\n'), ((2786, 2827), 'traits.api.on_trait_change', 'on_trait_change', (['"""class_load_hooks_items"""'], {}), "('c... |
from celery import chain
from django.db.models import Model, CASCADE, ForeignKey, CharField, TextField, DateTimeField, BooleanField, IntegerField, JSONField
from django.db.models.signals import post_save
from django.dispatch import receiver
from .tasks.run_spider import run_spider
from .tasks.load_data_to_db import lo... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.dispatch.receiver",
"django.db.models.JSONField",
"django.db.models.DateTimeField"
] | [((985, 1020), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'Session'}), '(post_save, sender=Session)\n', (993, 1020), False, 'from django.dispatch import receiver\n'), ((376, 479), 'django.db.models.CharField', 'CharField', ([], {'max_length': '(128)', 'unique': '(True)', 'help_text': '"""use spi... |
#!/usr/bin/env python
"""
pytest plugin script.
This script is an extension to py.test which
installs SQLAlchemy's testing plugin into the local environment.
"""
import sys
from os import path
for pth in ['../lib']:
sys.path.insert(0, path.join(path.dirname(path.abspath(__file__)), pth))
from sqlalchemy.testing... | [
"os.path.abspath"
] | [((265, 287), 'os.path.abspath', 'path.abspath', (['__file__'], {}), '(__file__)\n', (277, 287), False, 'from os import path\n')] |
import torch
import torch.nn as nn
from models.neural import aeq
from models.neural import gumbel_softmax
class Generator(nn.Module):
def __init__(self, vocab_size, dec_hidden_size, pad_idx):
super(Generator, self).__init__()
self.linear = nn.Linear(dec_hidden_size, vocab_size)
self.softma... | [
"torch.nn.LogSoftmax",
"models.neural.gumbel_softmax",
"torch.cat",
"torch.mul",
"torch.softmax",
"torch.nn.Linear",
"torch.tensor",
"models.neural.aeq"
] | [((262, 300), 'torch.nn.Linear', 'nn.Linear', (['dec_hidden_size', 'vocab_size'], {}), '(dec_hidden_size, vocab_size)\n', (271, 300), True, 'import torch.nn as nn\n'), ((324, 345), 'torch.nn.LogSoftmax', 'nn.LogSoftmax', ([], {'dim': '(-1)'}), '(dim=-1)\n', (337, 345), True, 'import torch.nn as nn\n'), ((1977, 2011), '... |
import torch
import torch.nn as nn
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchvision.utils as utils
import matplotlib.pyplot as plt
import numpy as np
from torch.utils.tensorboard import SummaryWriter
from celeba_datase... | [
"matplotlib.pyplot.title",
"torch.randn",
"matplotlib.pyplot.figure",
"torch.device",
"torchvision.transforms.Normalize",
"torch.ones",
"torch.nn.BCELoss",
"matplotlib.pyplot.imshow",
"torch.load",
"discriminator.cDCDiscriminator",
"torch.utils.tensorboard.SummaryWriter",
"torch.zeros",
"tor... | [((5837, 5878), 'torch.randint', 'torch.randint', (['(0)', '(10)', '(n,)'], {'device': 'device'}), '(0, 10, (n,), device=device)\n', (5850, 5878), False, 'import torch\n'), ((6212, 6237), 'torch.randn', 'torch.randn', (['(1)', '(100)', '(1)', '(1)'], {}), '(1, 100, 1, 1)\n', (6223, 6237), False, 'import torch\n'), ((62... |
import asyncio
import xplane.autopilot
import xplane.io
class MyProtocol(xplane.io.Protocol, xplane.autopilot.TakeoffMixin):
def __init__(self, remote_addr):
super().__init__(remote_addr)
def got_data_packet(self, packet, address):
self.take_off_got_data_packet(packet, address)
def mainloo... | [
"asyncio.get_event_loop",
"argparse.ArgumentParser"
] | [((367, 391), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (389, 391), False, 'import asyncio\n'), ((783, 799), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (797, 799), False, 'from argparse import ArgumentParser\n')] |
import asyncio
import datetime
import json
import logging
import os
from collections import Counter
from copy import deepcopy as dc
from io import BytesIO
from random import choice as randchoice
from random import randrange as rrange
from re import match, sub
from statistics import mean as avg
from time import time as ... | [
"PIL.Image.new",
"aiohttp.ClientSession",
"lzl.lzfloat",
"discord.File",
"logging.warning",
"requests.get",
"PIL.ImageDraw.Draw",
"collections.Counter",
"re.sub",
"lzl.lzlist",
"datetime.datetime.now",
"copy.deepcopy",
"asyncio.sleep",
"re.match",
"lzl.lzint",
"json.load",
"random.ch... | [((735, 774), 'PIL.ImageFont.truetype', 'imgfont.truetype', (['"""fonts/death.ttf"""', '(70)'], {}), "('fonts/death.ttf', 70)\n", (751, 774), True, 'from PIL import ImageFont as imgfont\n'), ((787, 823), 'PIL.ImageFont.truetype', 'imgfont.truetype', (['"""fonts/lk.ttf"""', '(70)'], {}), "('fonts/lk.ttf', 70)\n", (803, ... |
"""
Variant of the base class with parallelized, pipelined, and vectorized operations.
The technique pertaining to convolution was reused from https://stackoverflow.com/a/36968434.
Try executing this program with (the other variants will crawl):
python3 conway_v3.py --board-size 160 --interval 20 --configuration patt... | [
"dask.array.from_array",
"numpy.logical_or",
"numpy.ones"
] | [((557, 607), 'dask.array.from_array', 'da.from_array', (['self.board'], {'chunks': "('auto', 'auto')"}), "(self.board, chunks=('auto', 'auto'))\n", (570, 607), True, 'import dask.array as da\n'), ((629, 644), 'numpy.ones', 'np.ones', (['(3, 3)'], {}), '((3, 3))\n', (636, 644), True, 'import numpy as np\n'), ((1055, 10... |
import unittest
from unittest.mock import MagicMock, patch
from oil.barrels.aws import AutoScalingBarrel
class AutoScalingBarrelTestCase(unittest.TestCase):
def client_mock(self, fixture):
client = MagicMock()
paginator = MagicMock()
response_iterator = fixture
paginator.paginate.... | [
"unittest.mock.patch",
"oil.barrels.aws.AutoScalingBarrel",
"unittest.mock.MagicMock"
] | [((1113, 1134), 'unittest.mock.patch', 'patch', (['"""boto3.client"""'], {}), "('boto3.client')\n", (1118, 1134), False, 'from unittest.mock import MagicMock, patch\n'), ((212, 223), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (221, 223), False, 'from unittest.mock import MagicMock, patch\n'), ((244, 255)... |
import manifests
m = manifests.read("deploy.yml")
print(m.name) | [
"manifests.read"
] | [((22, 50), 'manifests.read', 'manifests.read', (['"""deploy.yml"""'], {}), "('deploy.yml')\n", (36, 50), False, 'import manifests\n')] |
from math import log2, ceil
def find(gen, arr):
if gen == 1:
return arr
rev = arr[::-1]
for i in range(len(arr)):
arr[i] = "0" + arr[i]
rev[i] = "1" + rev[i]
return find(gen-1, arr+rev)
R, C = map(int, input().split())
rows = find(ceil(log2(R+1)), ["0", "1"])
cols = find(... | [
"math.log2"
] | [((284, 295), 'math.log2', 'log2', (['(R + 1)'], {}), '(R + 1)\n', (288, 295), False, 'from math import log2, ceil\n'), ((325, 336), 'math.log2', 'log2', (['(C + 1)'], {}), '(C + 1)\n', (329, 336), False, 'from math import log2, ceil\n')] |
"""
created by chen
该模块用于密码加密
基本思路为 : 调用 hashlib 库中的 md5 加密方法,
将用户密码 与 专门的 key 进行 update 运算
返回一个 32 位 长的密码
"""
import hashlib
import sys
sys.path.append("..")
from config import SECRET_KEY
def encryption(pwd):
"""
用于加密的函数
:param pwd: 用户密码 (str)
:return: 32位长度字符串
"""
... | [
"sys.path.append"
] | [((165, 186), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (180, 186), False, 'import sys\n')] |
from app import db
from app.dao.dao_utils import autocommit
from app.models import EmailBranding
def dao_get_email_branding_options():
return EmailBranding.query.all()
def dao_get_email_branding_by_id(email_branding_id):
return EmailBranding.query.filter_by(id=email_branding_id).one()
def dao_get_email_br... | [
"app.models.EmailBranding.query.filter_by",
"app.models.EmailBranding.query.all",
"app.db.session.add"
] | [((148, 173), 'app.models.EmailBranding.query.all', 'EmailBranding.query.all', ([], {}), '()\n', (171, 173), False, 'from app.models import EmailBranding\n'), ((497, 527), 'app.db.session.add', 'db.session.add', (['email_branding'], {}), '(email_branding)\n', (511, 527), False, 'from app import db\n'), ((693, 723), 'ap... |
from django.shortcuts import render
from django.utils.safestring import mark_safe
from django.http import HttpResponse
import json
alias_set = set()
def home(request):
return render(request,'home.html',{})
def room(request, room_name, user):
return render(request, 'room.html', {
'alias': mark_safe(js... | [
"django.shortcuts.render",
"django.http.HttpResponse",
"json.dumps"
] | [((180, 212), 'django.shortcuts.render', 'render', (['request', '"""home.html"""', '{}'], {}), "(request, 'home.html', {})\n", (186, 212), False, 'from django.shortcuts import render\n'), ((440, 464), 'django.http.HttpResponse', 'HttpResponse', ([], {'status': '(400)'}), '(status=400)\n', (452, 464), False, 'from djang... |
"""
Parses the Jetbrains based IDEs recent projects list
"""
import glob
import os
import re
import xml.etree.ElementTree as ET
class RecentProjectsParser():
""" Processes the "Recent projects" file from Jetbrains IDEs """
@staticmethod
def parse(file_path, query):
"""
Parses the recent p... | [
"xml.etree.ElementTree.parse",
"re.split",
"os.path.join",
"os.path.basename",
"os.path.exists",
"os.path.isfile",
"os.path.expanduser"
] | [((1493, 1516), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (1511, 1516), False, 'import os\n'), ((577, 602), 'os.path.isfile', 'os.path.isfile', (['file_path'], {}), '(file_path)\n', (591, 602), False, 'import os\n'), ((2073, 2099), 'os.path.exists', 'os.path.exists', (['title_file'], {})... |
from aiolegomac.app import run
run()
| [
"aiolegomac.app.run"
] | [((33, 38), 'aiolegomac.app.run', 'run', ([], {}), '()\n', (36, 38), False, 'from aiolegomac.app import run\n')] |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import unittest
import azure.functions as func
from azure.functions._http_asgi import (
AsgiMiddleware
)
class MockAsgiApplication:
response_code = 200
response_body = b''
response_headers = [
[b"co... | [
"azure.functions.HttpRequest",
"azure.functions._http_asgi.AsgiMiddleware"
] | [((3184, 3298), 'azure.functions.HttpRequest', 'func.HttpRequest', ([], {'method': 'method', 'url': 'url', 'headers': 'headers', 'params': 'params', 'route_params': 'route_params', 'body': 'body'}), '(method=method, url=url, headers=headers, params=params,\n route_params=route_params, body=body)\n', (3200, 3298), Tr... |
#
# 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... | [
"asyncio.gather",
"s3_utils_asyncio.create_bucket",
"asyncio.get_event_loop",
"uuid.uuid4",
"aioboto3lite.config.AioConfig",
"utils.logger.init_logging",
"s3_utils_asyncio.get_object",
"s3_utils_asyncio.create_configured_session",
"time.time",
"uvloop.install",
"s3_utils_asyncio.put_object",
"... | [((3273, 3308), 's3_utils_asyncio.create_configured_session', 'create_configured_session', (['aioboto3'], {}), '(aioboto3)\n', (3298, 3308), False, 'from s3_utils_asyncio import create_configured_session, create_bucket, purge_and_delete_bucket, put_object, get_object\n'), ((3321, 3387), 'aioboto3lite.config.AioConfig',... |
import os
import shutil
import tempfile
from nose.tools import assert_equals, assert_not_equals, assert_is, assert_true, raises
from crds.submit import Submission, NoFilesSelected
from crds.tests import test_config
import mock
# To run:
# nosetests -v unit_tests.py
TEMPFILES = ['ipppssoot_ccd.fits', 'opppssoot_bia.... | [
"nose.tools.assert_equals",
"crds.tests.test_config.cleanup",
"os.path.join",
"shutil.rmtree",
"nose.tools.assert_true",
"mock.patch",
"crds.submit.Submission",
"tempfile.mkdtemp",
"nose.tools.assert_not_equals",
"nose.tools.assert_is",
"nose.tools.raises",
"crds.tests.test_config.setup",
"o... | [((4581, 4654), 'mock.patch', 'mock.patch', (['"""crds.submit.rc_submit.urllib.request.urlopen"""'], {'autospec': '(True)'}), "('crds.submit.rc_submit.urllib.request.urlopen', autospec=True)\n", (4591, 4654), False, 'import mock\n'), ((5836, 5852), 'nose.tools.raises', 'raises', (['KeyError'], {}), '(KeyError)\n', (584... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Software License Agreement (Apache 2.0)
Copyright (c) 2020, The MITRE Corporation.
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 Licen... | [
"os.path.dirname",
"os.path.join",
"setuptools.find_packages"
] | [((1443, 1468), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1458, 1468), False, 'import os\n'), ((1533, 1571), 'os.path.join', 'os.path.join', (['here', '"""requirements.txt"""'], {}), "(here, 'requirements.txt')\n", (1545, 1571), False, 'import os\n'), ((2680, 2695), 'setuptools.find_pac... |
"""
This script utilises the ground truth label's 2D bounding box to
crop out the the points of interest and feed it into the model so that
it can predict a 3D bounding box for each of the 2D detections
The script will plot the results of the 3D bounding box onto the image
and display them alongside the groundtruth... | [
"torchvision.models.vgg19_bn",
"argparse.ArgumentParser",
"numpy.copy",
"numpy.concatenate",
"numpy.argmax",
"cv2.imwrite",
"torch.load",
"numpy.arctan2",
"lib.ClassAverages.ClassAverages",
"os.path.dirname",
"torch.cuda.is_available",
"torch.device",
"torch.zeros",
"os.listdir",
"lib.Mo... | [((1096, 1121), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1119, 1121), False, 'import torch\n'), ((1135, 1178), 'torch.device', 'torch.device', (["('cuda' if use_cuda else 'cpu')"], {}), "('cuda' if use_cuda else 'cpu')\n", (1147, 1178), False, 'import torch\n'), ((5836, 5861), 'argparse.... |
from gdsctools.readers import GenomicFeatures, IC50, DrugDecode
from gdsctools.readers import Reader, drug_name_to_int
from easydev import TempFile
from gdsctools import ic50_test, gdsctools_data
import pandas as pd
from gdsctools.datasets import testing
def test_readers():
a = Reader()
try:
a = Re... | [
"gdsctools.readers.Reader",
"gdsctools.readers.drug_name_to_int",
"gdsctools.datasets.testing.keys",
"gdsctools.readers.DrugDecode",
"gdsctools.gdsctools_data",
"easydev.TempFile",
"gdsctools.readers.GenomicFeatures",
"gdsctools.readers.IC50",
"pandas.concat"
] | [((287, 295), 'gdsctools.readers.Reader', 'Reader', ([], {}), '()\n', (293, 295), False, 'from gdsctools.readers import Reader, drug_name_to_int\n'), ((560, 575), 'gdsctools.readers.IC50', 'IC50', (['ic50_test'], {}), '(ic50_test)\n', (564, 575), False, 'from gdsctools.readers import GenomicFeatures, IC50, DrugDecode\n... |
# -*- coding: utf-8 -*-
from datetime import timedelta
from django.contrib.auth.models import Group
from django.contrib.auth.decorators import login_required
from django.contrib.messages.views import SuccessMessageMixin
from django.core.urlresolvers import reverse_lazy
from django.db.models import Q
from djang... | [
"django.db.models.Q",
"django.utils.translation.ugettext_lazy",
"django.core.urlresolvers.reverse_lazy",
"django.contrib.auth.models.Group.objects.get_or_create"
] | [((4069, 4085), 'django.utils.translation.ugettext_lazy', '_', (['"""Edit ticket"""'], {}), "('Edit ticket')\n", (4070, 4085), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((4202, 4238), 'django.utils.translation.ugettext_lazy', '_', (['"""Ticket was successfully created"""'], {}), "('Ticket was ... |
from django.contrib import admin
from .models import Author, Recode, Tag, Division, Language
# Register your models here.
admin.site.register(Author)
admin.site.register(Recode)
admin.site.register(Tag)
admin.site.register(Division)
admin.site.register(Language) | [
"django.contrib.admin.site.register"
] | [((123, 150), 'django.contrib.admin.site.register', 'admin.site.register', (['Author'], {}), '(Author)\n', (142, 150), False, 'from django.contrib import admin\n'), ((151, 178), 'django.contrib.admin.site.register', 'admin.site.register', (['Recode'], {}), '(Recode)\n', (170, 178), False, 'from django.contrib import ad... |
# Generated by Django 3.2.3 on 2021-06-20 16:54
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('publishers', '0002_auto_20210608_2151'),
('writers', '0004_auto_20210621_0054'),
('books', '0007_alter_books... | [
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.PositiveIntegerField",
"django.db.models.Index",
"django.db.models.DecimalField",
"django.db.models.DateField"
] | [((472, 591), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""books.classification"""', 'verbose_name': '"""Category"""'}), "(on_delete=django.db.models.deletion.CASCADE, to=\n 'books.classification', verbose_name='Category')\n", (489, 591), False... |
import collections
import datetime
import logging
import os
import syncfin.db.model as mydb
import syncfin.utils.common as common
import syncfin.core.config as config
from prettytable import PrettyTable
log = logging.getLogger(__name__)
class Positions(object):
def parse_and_save(self, fpath):
"""
... | [
"syncfin.db.model.PositionsDB",
"syncfin.utils.common.format_currency",
"syncfin.core.config.get_param",
"os.walk",
"collections.defaultdict",
"prettytable.PrettyTable",
"os.path.join",
"logging.getLogger"
] | [((214, 241), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (231, 241), False, 'import logging\n'), ((1861, 1899), 'syncfin.core.config.get_param', 'config.get_param', (['"""SYNCFIN_FUND_FILES"""'], {}), "('SYNCFIN_FUND_FILES')\n", (1877, 1899), True, 'import syncfin.core.config as confi... |
import argparse
import os
import sys
from src import config
def process_arguments():
# Take arguments from commandline and parse them
parser = argparse.ArgumentParser()
parser.add_argument("--page-id", required=True, help="your facebook page-id")
parser.add_argument("--pdir", required=True, help="dire... | [
"os.path.isdir",
"os.listdir",
"argparse.ArgumentParser",
"sys.exit"
] | [((153, 178), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (176, 178), False, 'import argparse\n'), ((1998, 2024), 'os.path.isdir', 'os.path.isdir', (['config.pdir'], {}), '(config.pdir)\n', (2011, 2024), False, 'import os\n'), ((2088, 2099), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (2... |
#!/usr/bin/env python
# coding: utf-8
# In[9]:
#setup for implementing gpu brought from given file
import numpy as np
import os
import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
import torch.optim as optim
import h5py
import time
# In[3]:
#data augmentation
transfo... | [
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.utils.data.DataLoader",
"torchvision.transforms.RandomHorizontalFlip",
"torch.nn.Conv2d",
"torch.nn.CrossEntropyLoss",
"time.time",
"torchvision.datasets.CIFAR10",
"torchvision.transforms.ToTensor",
"torch.nn.BatchNorm2d",
"torch.cuda.is_available",
... | [((675, 776), 'torchvision.datasets.CIFAR10', 'torchvision.datasets.CIFAR10', ([], {'root': '"""./data"""', 'train': '(True)', 'download': '(True)', 'transform': 'transform_train'}), "(root='./data', train=True, download=True,\n transform=transform_train)\n", (703, 776), False, 'import torchvision\n'), ((825, 922), ... |
import numpy as np
from qiskit import (
QuantumCircuit,
execute,
Aer)
from qiskit.visualization import plot_histogram
# Use Aer's qasm_simulator
simulator = Aer.get_backend('qasm_simulator')
# Create a Quantum Circuit acting on the q register
circuit = QuantumCircuit(3, 3)
# Add a H gate on qubit 0
circu... | [
"qiskit.execute",
"qiskit.visualization.plot_histogram",
"qiskit.QuantumCircuit",
"qiskit.Aer.get_backend"
] | [((170, 203), 'qiskit.Aer.get_backend', 'Aer.get_backend', (['"""qasm_simulator"""'], {}), "('qasm_simulator')\n", (185, 203), False, 'from qiskit import QuantumCircuit, execute, Aer\n'), ((267, 287), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['(3)', '(3)'], {}), '(3, 3)\n', (281, 287), False, 'from qiskit import Qua... |
from urllib.request import urlopen
# if has Chinese, apply decode()
html = urlopen("https://mofanpy.com/static/scraping/basic-structure.html").read().decode('utf-8')
print(html)
import re
res = re.findall(r"<title>(.+?)</title>", html)
print("\nPage title is: ", res[0])
# Page title is: Scraping tutorial 1 | 莫烦Pyth... | [
"re.findall",
"urllib.request.urlopen"
] | [((197, 237), 're.findall', 're.findall', (['"""<title>(.+?)</title>"""', 'html'], {}), "('<title>(.+?)</title>', html)\n", (207, 237), False, 'import re\n'), ((331, 380), 're.findall', 're.findall', (['"""<p>(.*?)</p>"""', 'html'], {'flags': 're.DOTALL'}), "('<p>(.*?)</p>', html, flags=re.DOTALL)\n", (341, 380), False... |
from collections import deque
n, q = map(int, input().split())
ab = [[] for i in range(n)]
for i in range(n - 1):
a, b = map(int, input().split())
ab[a - 1].append(b - 1)
ab[b - 1].append(a - 1)
cd = [list(map(int, input().split())) for i in range(q)]
s = set()
qu = deque()
s.add(0)
qu.append(0)
hugo = [0... | [
"collections.deque"
] | [((281, 288), 'collections.deque', 'deque', ([], {}), '()\n', (286, 288), False, 'from collections import deque\n')] |
#!/usr/bin python3
# Imports
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Python:
import re
from json import loads
from datetime import datetime
# 3rd party:
# Internal:
from app.storage import AsyncStorageClient
from app.caching import from_cache_or_func
# ~~~~~~~~~~... | [
"app.storage.AsyncStorageClient",
"app.caching.from_cache_or_func",
"datetime.datetime.strptime",
"re.compile"
] | [((556, 578), 're.compile', 're.compile', (['"""[\\\\"\')]"""'], {}), '(\'[\\\\"\\\')]\')\n', (566, 578), False, 'import re\n'), ((602, 626), 're.compile', 're.compile', (['"""[\\\\s.(&,]+"""'], {}), "('[\\\\s.(&,]+')\n", (612, 626), False, 'import re\n'), ((1565, 1696), 'app.caching.from_cache_or_func', 'from_cache_or... |
import logging
import traceback
import pkg_resources
from gi.repository import Gtk, GdkPixbuf
from .devicestatusbar import DeviceStatusBar
from .logtreeview import LogTreeView
from ..accounting import UserManager, ProjectManager
from ..core import ToolWindow, error_message, ToolFrame, question_message
from ..devices ... | [
"pkg_resources.get_distribution",
"gi.repository.Gtk.Application.get_default",
"logging.getLogger",
"pkg_resources.resource_filename",
"logging.Formatter",
"traceback.format_exc",
"logging.root.removeHandler",
"logging.root.addHandler"
] | [((1042, 1069), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1059, 1069), False, 'import logging\n'), ((5673, 5714), 'logging.root.addHandler', 'logging.root.addHandler', (['self._loghandler'], {}), '(self._loghandler)\n', (5696, 5714), False, 'import logging\n'), ((5991, 6021), 'loggi... |
#! /usr/bin/env python
# -*-coding:UTF-8-*-
# __author__ : pighui
# __time__ : 2019-11-2 上午11:51
import requests
def get_proxies(params: dict = {}):
'''
:param params: 参数字典 默认为空
:return: 返回一个包含多条代理信息的列表,列表的每一个元素是一个字典
'''
try:
response = requests.get('http://127.0.0.1:8888/ip/', params=pa... | [
"requests.get"
] | [((269, 325), 'requests.get', 'requests.get', (['"""http://127.0.0.1:8888/ip/"""'], {'params': 'params'}), "('http://127.0.0.1:8888/ip/', params=params)\n", (281, 325), False, 'import requests\n'), ((633, 681), 'requests.get', 'requests.get', (['"""http://127.0.0.1:8888/ip/random/"""'], {}), "('http://127.0.0.1:8888/ip... |
import numpy as np
from autocnet.camera.utils import crossform
from cv2 import triangulatePoints
def compute_epipoles(f):
"""
Compute the epipole and epipolar prime
Parameters
----------
f : ndarray
(3,3) fundamental matrix or autocnet Fundamental Matrix object
Returns
-------
... | [
"numpy.sum",
"autocnet.camera.utils.crossform",
"numpy.asarray",
"numpy.empty",
"numpy.linalg.svd",
"numpy.eye",
"cv2.triangulatePoints"
] | [((433, 449), 'numpy.linalg.svd', 'np.linalg.svd', (['f'], {}), '(f)\n', (446, 449), True, 'import numpy as np\n'), ((476, 488), 'autocnet.camera.utils.crossform', 'crossform', (['e'], {}), '(e)\n', (485, 488), False, 'from autocnet.camera.utils import crossform\n'), ((678, 690), 'numpy.eye', 'np.eye', (['(3)', '(4)'],... |
from mock import mock_open, patch
import sure
from keeper.core import get_bucket, use_file
@patch("keeper.core.get_bucket")
def test_basic_decorator(get_bucket):
class FakeKey(object):
def __init__(self, keyname):
self.keyname = keyname
def get_contents_as_string(self):
re... | [
"mock.mock_open",
"keeper.core.use_file",
"mock.patch",
"keeper.core.get_bucket.when.called_with"
] | [((94, 125), 'mock.patch', 'patch', (['"""keeper.core.get_bucket"""'], {}), "('keeper.core.get_bucket')\n", (99, 125), False, 'from mock import mock_open, patch\n'), ((858, 889), 'mock.patch', 'patch', (['"""keeper.core.get_bucket"""'], {}), "('keeper.core.get_bucket')\n", (863, 889), False, 'from mock import mock_open... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-04-15 11:47
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('das', '0004_auto_20180415_1926'),
]
operations = [
... | [
"django.db.models.ForeignKey"
] | [((431, 565), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""children"""', 'to': '"""das.Category"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.CASCADE, related_name='childre... |
# -*- coding: utf-8 -*-
"""
plugin tests
~~~~~~~~~~~~
"""
# (c) 2014-2020 <NAME> <<EMAIL>>
import glob
import os
import sys
import pytest
pytest_plugins = "pytester"
MOCK_PIPELINE = """
#!/usr/bin/env python
if __name__ == "__main__":
import os
import sys
OUT_DIR = "output_dir"
if len(... | [
"pytest.fixture",
"os.path.join",
"os.path.exists"
] | [((678, 710), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (692, 710), False, 'import pytest\n'), ((7869, 7901), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (7883, 7901), False, 'import pytest\n'), ((9258, 9290), 'pytes... |
import aoc_utils
import datetime
si = aoc_utils.read()
starting_nos = list(map(int,si.split(',')))
x = 1
p = [-1 for x in range(30000000)]
previous = 0
for sno in starting_nos:
p[sno] = x
previous = sno
x+=1
first = True
while True:
if first:
nextout = 0
else:
nextout = x-p[previou... | [
"aoc_utils.read"
] | [((39, 55), 'aoc_utils.read', 'aoc_utils.read', ([], {}), '()\n', (53, 55), False, 'import aoc_utils\n')] |
import os
MODULE_PATH = os.path.dirname(__file__)
VERBOSE = True
from ita import loader_file
from ita import parser
from ita import generator
FileLoader = loader_file.FileLoader
Loader = loader_file.FileLoader
Parser = parser.Parser
Generator = generator.Generator
GeneratorException = generator.GeneratorException
_... | [
"os.path.dirname"
] | [((24, 49), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (39, 49), False, 'import os\n')] |
import paramiko
import sys
import os
import time
import re
class CiscoExecBySSH:
def __init__(self):
self.input_file = self.get_input_file()
self.login_params = {'host': '', 'user': '', 'password': '', 'port': 22}
self.get_login_info()
self.client = self.login()
def get_login_... | [
"paramiko.SSHClient",
"time.sleep",
"os.path.isfile",
"paramiko.AutoAddPolicy",
"sys.exit"
] | [((579, 599), 'paramiko.SSHClient', 'paramiko.SSHClient', ([], {}), '()\n', (597, 599), False, 'import paramiko\n'), ((1722, 1739), 'time.sleep', 'time.sleep', (['delay'], {}), '(delay)\n', (1732, 1739), False, 'import time\n'), ((643, 667), 'paramiko.AutoAddPolicy', 'paramiko.AutoAddPolicy', ([], {}), '()\n', (665, 66... |
"""
Copyright 2021 <NAME>
"""
from pathlib import Path
from tempfile import TemporaryDirectory
from textwrap import TextWrapper
from time import sleep
from typing import Optional
import typer
from moviepy.video.io.VideoFileClip import VideoFileClip
from speech_recognition import Recognizer, AudioFile, UnknownValueErro... | [
"typer.echo",
"time.sleep",
"pathlib.Path",
"textwrap.TextWrapper",
"speech_recognition.AudioFile",
"typer.clear",
"speech_recognition.Recognizer"
] | [((363, 376), 'typer.clear', 'typer.clear', ([], {}), '()\n', (374, 376), False, 'import typer\n'), ((927, 988), 'typer.echo', 'typer.echo', (['"""Determining the total minutes that video has..."""'], {}), "('Determining the total minutes that video has...')\n", (937, 988), False, 'import typer\n'), ((1471, 1479), 'tim... |
from django.conf import settings
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
class UserProfile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
... | [
"django.db.models.CharField",
"django.db.models.OneToOneField",
"django.dispatch.receiver",
"django.db.models.ImageField"
] | [((244, 316), 'django.db.models.OneToOneField', 'models.OneToOneField', (['settings.AUTH_USER_MODEL'], {'on_delete': 'models.CASCADE'}), '(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)\n', (264, 316), False, 'from django.db import models\n'), ((329, 372), 'django.db.models.CharField', 'models.CharField', ([], {'m... |
import matplotlib.pyplot as plt
with open('benchmark_local.txt', 'rt') as fd:
lines = fd.readlines()
data = {}
for line in lines:
line = line.strip()
if not line.endswith('ns/op'):
continue
split = line.split()
benchmark_name, record_len = split[0].split('-')[:2]
benchmark_name = benc... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.yscale",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid"
] | [((897, 911), 'matplotlib.pyplot.grid', 'plt.grid', (['(True)'], {}), '(True)\n', (905, 911), True, 'import matplotlib.pyplot as plt\n'), ((912, 940), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""records number"""'], {}), "('records number')\n", (922, 940), True, 'import matplotlib.pyplot as plt\n'), ((941, 960), 'm... |
"""
OpenVINO DL Workbench
Class for exporting the whole project
Copyright (c) 2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICEN... | [
"os.mkdir",
"os.remove",
"wb.main.jobs.interfaces.job_observers.ExportProjectDBObserver",
"yaml.dump",
"os.path.isfile",
"os.path.join",
"wb.extensions_factories.database.get_db_session_for_celery",
"tempfile.TemporaryDirectory",
"json.loads",
"tarfile.open",
"contextlib.closing",
"wb.main.mod... | [((2029, 2073), 'wb.main.jobs.interfaces.job_observers.ExportProjectDBObserver', 'ExportProjectDBObserver', ([], {'job_id': 'self._job_id'}), '(job_id=self._job_id)\n', (2052, 2073), False, 'from wb.main.jobs.interfaces.job_observers import ExportProjectDBObserver\n'), ((2318, 2345), 'wb.extensions_factories.database.g... |
from dataclasses import dataclass
from typing import List, Union, Optional
from pyaniml.utility.utils import SchemaBase, elements, attribute
from pyaniml.core.series import SeriesSet
from pyaniml.core.parameter import Category
@dataclass
class Result(SchemaBase):
"""Container for experiment results"""
result... | [
"pyaniml.utility.utils.elements"
] | [((338, 456), 'pyaniml.utility.utils.elements', 'elements', ([], {'choices': "({'name': 'SeriesSet', 'type': SeriesSet}, {'name': 'Category', 'type':\n Category})", 'default': 'list'}), "(choices=({'name': 'SeriesSet', 'type': SeriesSet}, {'name':\n 'Category', 'type': Category}), default=list)\n", (346, 456), Fa... |
import importlib.util
import os.path
import pytest
import shutil
import unittest
from cookiecutter.main import cookiecutter
def load_module_from_path(module_name, path):
module_spec = importlib.util.spec_from_file_location(module_name, path)
module = importlib.util.module_from_spec(module_spec)
module_sp... | [
"shutil.rmtree",
"cookiecutter.main.cookiecutter"
] | [((575, 805), 'cookiecutter.main.cookiecutter', 'cookiecutter', (['self.cookiecutter_path'], {'no_input': '(True)', 'extra_context': "{'title': 'Test project', 'mailjet_apikey_public': 'public_key',\n 'mailjet_apikey_private': 'private_key', 'mailjet_contactslist_id':\n 'contactslist_id'}"}), "(self.cookiecutter_... |
import os
from gcloud import datastore
def selectAll(client, kind, order=None):
query = client.query(kind=kind)
if order: query.order = order
resultlist = list(query.fetch())
return resultlist
def deleteAll(client, kind):
all = selectAll(client, kind)
keylist = list(map(lambda x:... | [
"oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name",
"gspread.authorize",
"gcloud.datastore.Entity",
"gcloud.datastore.Client"
] | [((556, 651), 'oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name', 'ServiceAccountCredentials.from_json_keyfile_name', (['"""socialmapkorea-credentials.json"""', 'scope'], {}), "(\n 'socialmapkorea-credentials.json', scope)\n", (604, 651), False, 'from oauth2client.service_account import ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from pysc2.maps import lib
from smac.env.starcraft2.maps import smac_maps
map_param_registry = {
"1o_10b_vs_1r": {
"n_agents": 11,
"n_enemies": 1,
"limit": 50,
"a_race": "Z"... | [
"smac.env.starcraft2.maps.smac_maps.get_smac_map_registry",
"smac.env.starcraft2.maps.smac_maps.map_param_registry.update"
] | [((830, 885), 'smac.env.starcraft2.maps.smac_maps.map_param_registry.update', 'smac_maps.map_param_registry.update', (['map_param_registry'], {}), '(map_param_registry)\n', (865, 885), False, 'from smac.env.starcraft2.maps import smac_maps\n'), ((942, 975), 'smac.env.starcraft2.maps.smac_maps.get_smac_map_registry', 's... |
import collections
BOOL = {"BOOLAND", "BOOLOR", "BOOLNOT"}
POW = {"POW"}
MUL_DIV = {"MUL", "DIV"}
ADD_SUB = {"ADD", "SUB"}
SHIFT = {"LSHIFT", "RSHIFT"}
BIN = {"AND", "OR", "XOR"}
CMP = {"EQ", "NEQ", "LEQ", "GEQ", "LT",
"GT", "CONTAINS", "CONTAINED"}
NODES = {
"UnaryExpr": "op val",
"BinExpr": "op left righ... | [
"collections.namedtuple"
] | [((783, 819), 'collections.namedtuple', 'collections.namedtuple', (['name', 'fields'], {}), '(name, fields)\n', (805, 819), False, 'import collections\n')] |
"""Simple test for monochromatic character LCD on Raspberry Pi"""
import time
import board
import digitalio
import adafruit_character_lcd.character_lcd as characterlcd
# Modify this if you have a different sized character LCD
lcd_columns = 16
lcd_rows = 2
# Raspberry Pi Pin Config:
lcd_rs = digitalio.DigitalInOut(boa... | [
"digitalio.DigitalInOut",
"adafruit_character_lcd.character_lcd.Character_LCD_Mono",
"time.sleep"
] | [((294, 327), 'digitalio.DigitalInOut', 'digitalio.DigitalInOut', (['board.D26'], {}), '(board.D26)\n', (316, 327), False, 'import digitalio\n'), ((337, 370), 'digitalio.DigitalInOut', 'digitalio.DigitalInOut', (['board.D19'], {}), '(board.D19)\n', (359, 370), False, 'import digitalio\n'), ((380, 413), 'digitalio.Digit... |
#!/usr/bin/python3
import os
import sys
import re
import argparse
import subprocess
import shlex
import shutil
import datetime
from zoneutils import zonefile, zonefileformatter, nsupdate, utils
SLUG_RGX = re.compile(r"[^a-zA-Z0-9_]")
def parse_args():
""" Parse command line arguments """
parser = argparse... | [
"argparse.ArgumentParser",
"zoneutils.utils.colorize_diff",
"zoneutils.utils.dig_zonetransfer",
"shutil.which",
"os.environ.get",
"zoneutils.zonefile.ZoneFile",
"zoneutils.zonefileformatter.ZoneFileFormatter",
"sys.exit",
"zoneutils.utils.dig_get_authoritative_server",
"datetime.datetime.now",
"... | [((208, 235), 're.compile', 're.compile', (['"""[^a-zA-Z0-9_]"""'], {}), "('[^a-zA-Z0-9_]')\n", (218, 235), False, 'import re\n'), ((312, 371), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""nsupdate-interactive"""'}), "(description='nsupdate-interactive')\n", (335, 371), False, 'import ... |
import asyncio
from types import TracebackType
from typing import Optional, Mapping, Union, Type
from .aio import simple_cache_client as aio
from ._async_utils import wait_for_coroutine
from .cache_operation_types import (
CacheGetResponse,
CacheSetResponse,
CacheDeleteResponse,
CreateCacheResponse,
... | [
"asyncio.set_event_loop",
"asyncio.new_event_loop",
"asyncio.get_running_loop"
] | [((1249, 1275), 'asyncio.get_running_loop', 'asyncio.get_running_loop', ([], {}), '()\n', (1273, 1275), False, 'import asyncio\n'), ((1627, 1651), 'asyncio.new_event_loop', 'asyncio.new_event_loop', ([], {}), '()\n', (1649, 1651), False, 'import asyncio\n'), ((1664, 1692), 'asyncio.set_event_loop', 'asyncio.set_event_l... |
#!/usr/bin/env python
from gmt import app
app.run(debug=app.config['DEBUG'], port=app.config['PORT'])
| [
"gmt.app.run"
] | [((42, 101), 'gmt.app.run', 'app.run', ([], {'debug': "app.config['DEBUG']", 'port': "app.config['PORT']"}), "(debug=app.config['DEBUG'], port=app.config['PORT'])\n", (49, 101), False, 'from gmt import app\n')] |
import io
import json
import logging
import os
import re
from datetime import datetime
from typing import Any, Dict, List, Optional, Tuple
import httpx
from jobs.base.job import Job
from jobs.convert import Convert
logger = logging.getLogger(__name__)
class Register(Job):
"""
A job that registers a DOI wit... | [
"json.dumps",
"datetime.datetime.utcnow",
"jobs.convert.Convert",
"re.sub",
"os.getenv",
"logging.getLogger"
] | [((227, 254), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (244, 254), False, 'import logging\n'), ((1371, 1465), 're.sub', 're.sub', (['"""<doi_batch_id>[^<]*</doi_batch_id>"""', 'f"""<doi_batch_id>{batch}</doi_batch_id>"""', 'xml'], {}), "('<doi_batch_id>[^<]*</doi_batch_id>',\n f'... |
from __future__ import print_function
from datetime import datetime
from threading import Lock
from ingenico.connect.sdk.log.python_communicator_logger import \
CommunicatorLogger
class SysOutCommunicatorLogger(CommunicatorLogger):
"""
A communicator logger that prints its message to sys.stdout
It i... | [
"threading.Lock",
"ingenico.connect.sdk.log.python_communicator_logger.CommunicatorLogger.__init__",
"datetime.datetime.now"
] | [((490, 496), 'threading.Lock', 'Lock', ([], {}), '()\n', (494, 496), False, 'from threading import Lock\n'), ((436, 469), 'ingenico.connect.sdk.log.python_communicator_logger.CommunicatorLogger.__init__', 'CommunicatorLogger.__init__', (['self'], {}), '(self)\n', (463, 469), False, 'from ingenico.connect.sdk.log.pytho... |
from mpl_toolkits.mplot3d import axes3d
ax = plt.subplot(111, projection='3d')
X, Y, Z = axes3d.get_test_data(0.1)
ax.plot_wireframe(X, Y, Z, linewidth=0.1)
plt.savefig('wire.pdf')
| [
"mpl_toolkits.mplot3d.axes3d.get_test_data"
] | [((90, 115), 'mpl_toolkits.mplot3d.axes3d.get_test_data', 'axes3d.get_test_data', (['(0.1)'], {}), '(0.1)\n', (110, 115), False, 'from mpl_toolkits.mplot3d import axes3d\n')] |
# Copyright: See the LICENSE file.
"""Helper to test circular factory dependencies."""
import factory
class Bar:
def __init__(self, foo, y):
self.foo = foo
self.y = y
class BarFactory(factory.Factory):
class Meta:
model = Bar
y = 13
foo = factory.SubFactory('cyclic.foo.Foo... | [
"factory.SubFactory"
] | [((286, 329), 'factory.SubFactory', 'factory.SubFactory', (['"""cyclic.foo.FooFactory"""'], {}), "('cyclic.foo.FooFactory')\n", (304, 329), False, 'import factory\n')] |
# Generated by Django 2.0.4 on 2018-04-18 22:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('todos', '0002_auto_20180418_2213'),
]
operations = [
migrations.AlterField(
model_name='status',
name='status',
... | [
"django.db.models.CharField"
] | [((334, 444), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('NOT DONE', 'NOT DONE'), ('DONE', 'DONE')]", 'default': '"""NOT DONE"""', 'max_length': '(255)'}), "(choices=[('NOT DONE', 'NOT DONE'), ('DONE', 'DONE')],\n default='NOT DONE', max_length=255)\n", (350, 444), False, 'from django.db i... |
import os, sys
sys.path.append(os.getcwd())
from PyQt5.QtWidgets import QApplication, QWidget
from src.controller.lib.ssqt import SSQt
SSQt.load_uifile(True, 'src/view/widgets/ui/field_lookup.ui')
from src.view.widgets.ui.field_lookup import Ui_FieldLookup
class FieldLookupView(QWidget, Ui_FieldLookup, SSQt):
def ... | [
"src.controller.lib.ssqt.SSQt.load_uifile",
"PyQt5.QtWidgets.QApplication",
"os.getcwd"
] | [((138, 199), 'src.controller.lib.ssqt.SSQt.load_uifile', 'SSQt.load_uifile', (['(True)', '"""src/view/widgets/ui/field_lookup.ui"""'], {}), "(True, 'src/view/widgets/ui/field_lookup.ui')\n", (154, 199), False, 'from src.controller.lib.ssqt import SSQt\n'), ((31, 42), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (40, 42... |
from kinematicEnv import KinematicEnv
from QL import QL
from upDDPG import DDPG as uDDPG
import tensorflow as tf
from bottomDDPG import DDPG as bDDPG
import numpy as np
env = KinematicEnv()
s_dim = env.state_dim
a_dim = env.action_dim
a_bound = env.action_bound
g1 = tf.Graph()
isess1 = tf.Session(graph=g1)
with g1.as_... | [
"kinematicEnv.KinematicEnv",
"QL.QL",
"tensorflow.global_variables_initializer",
"tensorflow.Session",
"upDDPG.DDPG",
"numpy.random.randint",
"tensorflow.Graph",
"bottomDDPG.DDPG"
] | [((175, 189), 'kinematicEnv.KinematicEnv', 'KinematicEnv', ([], {}), '()\n', (187, 189), False, 'from kinematicEnv import KinematicEnv\n'), ((268, 278), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (276, 278), True, 'import tensorflow as tf\n'), ((288, 308), 'tensorflow.Session', 'tf.Session', ([], {'graph': 'g1'}... |
import unittest
import warnings
import numpy as np
# import safety_gym
# from safety_gym.envs.engine import Engine
import gym
import gym.spaces as spaces
from gym.envs.registration import register
from edge.gym_wrappers import BoxWrapper, DiscreteWrapper, GymEnvironmentWrapper
from edge.agent import RandomAgent
clas... | [
"unittest.main",
"numpy.abs",
"gym.make",
"warnings.filterwarnings",
"edge.gym_wrappers.DiscreteWrapper",
"gym.spaces.Discrete",
"edge.gym_wrappers.BoxWrapper",
"gym.spaces.Box",
"edge.gym_wrappers.GymEnvironmentWrapper",
"numpy.array",
"edge.agent.RandomAgent"
] | [((4610, 4625), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4623, 4625), False, 'import unittest\n'), ((396, 429), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (419, 429), False, 'import warnings\n'), ((443, 467), 'gym.spaces.Box', 'spaces.Box', (['(0)', '(1)', ... |
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib import messages
from django.http import JsonResponse, HttpResponse
from django.views import generic
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import get_object_or_404, redirect, render
fr... | [
"djvideomem.content.models.Pricing.objects.get",
"django.http.HttpResponse",
"stripe.Webhook.construct_event",
"stripe.Invoice.retrieve",
"django.shortcuts.redirect",
"stripe.Subscription.modify",
"django.contrib.auth.get_user_model",
"stripe.Subscription.retrieve",
"django.shortcuts.get_object_or_4... | [((473, 489), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (487, 489), False, 'from django.contrib.auth import get_user_model\n'), ((3255, 3269), 'django.http.HttpResponse', 'HttpResponse', ([], {}), '()\n', (3267, 3269), False, 'from django.http import JsonResponse, HttpResponse\n'), ((344... |
import os
from datetime import datetime
from typing import Optional
import click
from click import Context
from cellphonedb.src.api_endpoints.terminal_api.tools_terminal_api_endpoints.tools_terminal_commands import \
generate_proteins, generate_complex, _set_paths, generate_interactions, filter_all, generate_gene... | [
"cellphonedb.src.database.manager.DatabaseVersionManager.download_database",
"click.argument",
"click.option",
"datetime.datetime.now",
"cellphonedb.utils.utils.set_paths",
"click.command",
"cellphonedb.src.database.manager.DatabaseVersionManager.list_remote_database_versions",
"cellphonedb.src.databa... | [((583, 607), 'click.command', 'click.command', (['"""collect"""'], {}), "('collect')\n", (596, 607), False, 'import click\n'), ((802, 897), 'click.option', 'click.option', (['"""--result-path"""'], {'default': '""""""', 'help': '"""output folder for the collected database"""'}), "('--result-path', default='', help=\n ... |
"""
Implementation of the model.
Parts of the code are inherited from the official CAAE implementation (https://arxiv.org/abs/1702.08423, https://github.com/ZZUTK/Face-Aging-CAAE).
"""
import os
import sys
import time
from glob import glob
import numpy as np
import tensorflow as tf
from scipy.io import loadmat, save... | [
"tensorflow.compat.v1.losses.mean_squared_error",
"scipy.io.loadmat",
"tensorflow.zeros_like",
"tensorflow.compat.v1.get_variable_scope",
"PK_Utils.PK_subnetworks.generator",
"tensorflow.compat.v1.train.exponential_decay",
"PK_Utils.PK_vgg_face.face_embedding",
"numpy.arange",
"numpy.tile",
"tenso... | [((779, 794), 'scipy.io.loadmat', 'loadmat', (['vggMat'], {}), '(vggMat)\n', (786, 794), False, 'from scipy.io import loadmat, savemat\n'), ((1015, 1118), 'tensorflow.compat.v1.placeholder', 'tf.compat.v1.placeholder', (['tf.float32', '[size_batch, size_image, size_image, 3]'], {'name': '"""input_images"""'}), "(tf.flo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module contains functions used to fix a osm file.
Attributes:
postcode_re (:re obj:): Regex compiler to USA postal codes.
"""
import xml.etree.cElementTree as ET # Use cElementTree or lxml if too slow
import pprint
import re
#postcode reg... | [
"xml.etree.cElementTree.iterparse",
"xml.etree.cElementTree.ElementTree",
"re.compile"
] | [((417, 469), 're.compile', 're.compile', (['""".*(\\\\d{5}(\\\\-\\\\d{4})?)$"""', 're.IGNORECASE'], {}), "('.*(\\\\d{5}(\\\\-\\\\d{4})?)$', re.IGNORECASE)\n", (427, 469), False, 'import re\n'), ((2351, 2387), 'xml.etree.cElementTree.iterparse', 'ET.iterparse', (['osm'], {'events': "('start',)"}), "(osm, events=('start... |
"""
==================================
Plotting two simple sine functions
==================================
A simple example plotting a fit of two sine functions.
"""
import numpy
import matplotlib.pyplot as plt
from pyearth import Earth
# Create some fake data
numpy.random.seed(2)
m = 10000
n = 10
X = 80 * numpy.r... | [
"numpy.random.uniform",
"numpy.random.seed",
"matplotlib.pyplot.show",
"pyearth.Earth",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.random.normal",
"numpy.concatenate"
] | [((266, 286), 'numpy.random.seed', 'numpy.random.seed', (['(2)'], {}), '(2)\n', (283, 286), False, 'import numpy\n'), ((583, 621), 'pyearth.Earth', 'Earth', ([], {'max_degree': '(3)', 'minspan_alpha': '(0.5)'}), '(max_degree=3, minspan_alpha=0.5)\n', (588, 621), False, 'from pyearth import Earth\n'), ((629, 700), 'nump... |
#!/usr/bin/env python
import os
import re
import shutil
import filecmp
import tempfile
import subprocess
from setuptools import setup
VERSIONFILE = "px/version.py"
git_version = (
subprocess.check_output(["git", "describe", "--dirty"]).decode("utf-8").strip()
)
with tempfile.NamedTemporaryFile(suffix=".py", del... | [
"tempfile.NamedTemporaryFile",
"os.remove",
"setuptools.setup",
"os.path.dirname",
"subprocess.check_output",
"re.match",
"os.path.isfile",
"shutil.move",
"filecmp.cmp"
] | [((1445, 2328), 'setuptools.setup', 'setup', ([], {'name': '"""pxpx"""', 'version': 'git_version', 'description': '"""ps and top for Human Beings"""', 'long_description': 'LONG_DESCRIPTION', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/walles/px"""', 'license': '"""MIT"""', '... |
import atexit
import multiprocessing
import pprint
import signal
import time
from contextlib import suppress
from typing import Callable, Union, Any, List, Mapping, Sequence, Tuple, cast
from . import util
from .consts import DEFAULT_NAMESPACE
from .process import Process
from .server import tools
from .state.state im... | [
"atexit.register",
"typing.cast",
"contextlib.suppress",
"time.time",
"signal.signal"
] | [((5651, 5676), 'typing.cast', 'cast', (['str', 'server_address'], {}), '(str, server_address)\n', (5655, 5676), False, 'from typing import Callable, Union, Any, List, Mapping, Sequence, Tuple, cast\n'), ((2193, 2217), 'contextlib.suppress', 'suppress', (['AssertionError'], {}), '(AssertionError)\n', (2201, 2217), Fals... |
import re
from hotsos.core.host_helpers import CLIHelper
from hotsos.core.plugins.storage.bcache import BcacheChecksBase
class BcacheSummary(BcacheChecksBase):
def __summary_cachesets(self):
csets = self.get_sysfs_cachesets()
if csets:
return csets
def __summary_devices(self):
... | [
"hotsos.core.host_helpers.CLIHelper",
"re.compile"
] | [((405, 416), 'hotsos.core.host_helpers.CLIHelper', 'CLIHelper', ([], {}), '()\n', (414, 416), False, 'from hotsos.core.host_helpers import CLIHelper\n'), ((534, 550), 're.compile', 're.compile', (['expr'], {}), '(expr)\n', (544, 550), False, 'import re\n'), ((795, 806), 'hotsos.core.host_helpers.CLIHelper', 'CLIHelper... |
# -*- coding: utf-8 -*-
import random
import urllib
from scrapy.http.headers import Headers
from crawler.misc.spider import CommonSpider
from crawler.misc import agents
class BaseHelper(object):
PROFILE_URL = "https://mobile.qzone.qq.com/profile?hostuin=USER_QQ_NUMBER"
SHUOSHU_URL = "https://mobile.qzone.q... | [
"scrapy.http.headers.Headers"
] | [((1503, 1542), 'scrapy.http.headers.Headers', 'Headers', (["{'Accept': 'application/json'}"], {}), "({'Accept': 'application/json'})\n", (1510, 1542), False, 'from scrapy.http.headers import Headers\n')] |