code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import numpy as np
from scipy import stats
import pandas as pd
from sklearn.cross_decomposition import PLSRegression
def standardize_vector(v, center=True, scale=False):
if center:
v = v - np.mean(v)
if scale:
if np.std(v) == 0:
return v
else:
return (v + 0.0)... | [
"numpy.mean",
"numpy.median",
"pandas.DataFrame",
"numpy.array",
"numpy.std",
"numpy.linalg.svd"
] | [((1965, 2008), 'numpy.linalg.svd', 'np.linalg.svd', (['X_stand'], {'full_matrices': '(False)'}), '(X_stand, full_matrices=False)\n', (1978, 2008), True, 'import numpy as np\n'), ((1770, 1785), 'pandas.DataFrame', 'pd.DataFrame', (['X'], {}), '(X)\n', (1782, 1785), True, 'import pandas as pd\n'), ((2507, 2530), 'numpy.... |
"""Tests for AzWebAppHttp20Event plugin."""
import copy
import unittest
from cloudmarker.events import azwebapphttp20event
base_record = {
'ext': {
'record_type': 'web_app_config',
'cloud_type': 'azure',
'http20_enabled': True
},
'com': {
'cloud_type': 'azure'
}
}... | [
"cloudmarker.events.azwebapphttp20event.AzWebAppHttp20Event",
"copy.deepcopy"
] | [((478, 504), 'copy.deepcopy', 'copy.deepcopy', (['base_record'], {}), '(base_record)\n', (491, 504), False, 'import copy\n'), ((551, 592), 'cloudmarker.events.azwebapphttp20event.AzWebAppHttp20Event', 'azwebapphttp20event.AzWebAppHttp20Event', ([], {}), '()\n', (590, 592), False, 'from cloudmarker.events import azweba... |
from flask_restful import Resource
from flask import request, Blueprint, jsonify
from models import db, Post, Comment
from datetime import datetime
commentBp = Blueprint('commentBp', __name__)
class UserComments():
@commentBp.route("/addComment", methods=['POST'])
def addComment():
json_data = re... | [
"models.Comment.timestamp.desc",
"models.Comment.serialize",
"flask.jsonify",
"models.Comment",
"models.db.session.add",
"flask.request.get_json",
"models.db.session.delete",
"models.Comment.query.filter_by",
"models.Comment.upvotes.desc",
"flask.Blueprint",
"models.db.session.commit"
] | [((161, 193), 'flask.Blueprint', 'Blueprint', (['"""commentBp"""', '__name__'], {}), "('commentBp', __name__)\n", (170, 193), False, 'from flask import request, Blueprint, jsonify\n'), ((318, 346), 'flask.request.get_json', 'request.get_json', ([], {'force': '(True)'}), '(force=True)\n', (334, 346), False, 'from flask ... |
import os
import sys
import os.path as osp
from contextlib import contextmanager
############################################################
# Setup path
def add_path(path):
if path not in sys.path:
sys.path.insert(0, path)
curdir = osp.dirname(__file__)
lib_path = osp.join(curdir, '..', 'lib')
add_... | [
"sys.path.insert",
"os.path.join",
"os.getcwd",
"os.chdir",
"os.path.dirname",
"config.cfg.INFIX.startswith",
"utils.proto.prototxt_from_template"
] | [((252, 273), 'os.path.dirname', 'osp.dirname', (['__file__'], {}), '(__file__)\n', (263, 273), True, 'import os.path as osp\n'), ((286, 315), 'os.path.join', 'osp.join', (['curdir', '""".."""', '"""lib"""'], {}), "(curdir, '..', 'lib')\n", (294, 315), True, 'import os.path as osp\n'), ((577, 588), 'os.getcwd', 'os.get... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"numpy.array",
"numpy.linalg.norm",
"matplotlib.pyplot.imshow",
"os.path.exists",
"os.listdir",
"numpy.where",
"os.mkdir",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.title",
"time.time",
"matplotlib.pyplot.show",
"matplotlib.pyplot.text",
"PIL.Image.fromarray",
"os.makedirs",
"time.str... | [((3471, 3498), 'PIL.Image.fromarray', 'Image.fromarray', (['output_img'], {}), '(output_img)\n', (3486, 3498), False, 'from PIL import Image\n'), ((5021, 5033), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (5031, 5033), True, 'import matplotlib.pyplot as plt\n'), ((5039, 5055), 'matplotlib.pyplot.subplo... |
from flask import Blueprint, request
import json
import databaseutils as utils
tiposrefeicao = Blueprint("tiposrefeicao", __name__)
tiposrefeicaoColumns = ["cod_tiporefeicao", "designacao"]
@tiposrefeicao.route("/api/tiposrefeicao", methods=["GET"])
@tiposrefeicao.route("/api/tiposrefeicao/", methods=["GET"])
def g... | [
"databaseutils.deleteOne",
"databaseutils.getOne",
"json.dumps",
"flask.Blueprint",
"databaseutils.getAll"
] | [((96, 132), 'flask.Blueprint', 'Blueprint', (['"""tiposrefeicao"""', '__name__'], {}), "('tiposrefeicao', __name__)\n", (105, 132), False, 'from flask import Blueprint, request\n'), ((351, 426), 'databaseutils.getAll', 'utils.getAll', (['tiposrefeicaoColumns', 'f"""SELECT * FROM selecttiposrefeicao();"""'], {}), "(tip... |
#!/usr/bin/env /usr/local/opt/python@3.9/bin/python3.9
import sys
import psycopg2
from faker import Faker
from contextlib import closing
from random import randint
import time
if __name__ == "__main__":
total = 10
batch_size = 1000
if len(sys.argv) > 1:
total = int(sys.argv[1])
if len(sys.... | [
"faker.Faker",
"time.monotonic",
"random.randint",
"psycopg2.connect"
] | [((384, 421), 'faker.Faker', 'Faker', (["['en_US']"], {'use_weighting': '(False)'}), "(['en_US'], use_weighting=False)\n", (389, 421), False, 'from faker import Faker\n'), ((440, 544), 'psycopg2.connect', 'psycopg2.connect', ([], {'dbname': '"""hla"""', 'user': '"""postgres"""', 'password': '"""<PASSWORD>"""', 'host': ... |
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
import cmasher as cmr
import astropy.units as u
import astropy.coordinates as coord
from astropy.io import ascii
from astropy.io import fits
from astropy.wcs import WCS
from functions import *
plt.rcParams['mathtext.fontset'] = 'cm'
plt.rcParams[... | [
"astropy.coordinates.Angle",
"matplotlib.pyplot.colorbar",
"astropy.coordinates.SkyCoord",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.scatter",
"numpy.loadtxt",
"cmasher.get_sub_cmap",
"matplotlib.pyplot.subplot",
"astropy.wcs.WCS",
"matplotlib.pyplot.rc",
"matplotlib.pyplot.show"
] | [((399, 430), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'size': 'SMALL_SIZE'}), "('font', size=SMALL_SIZE)\n", (405, 430), True, 'import matplotlib.pyplot as plt\n'), ((470, 507), 'matplotlib.pyplot.rc', 'plt.rc', (['"""axes"""'], {'titlesize': 'MEDIUM_SIZE'}), "('axes', titlesize=MEDIUM_SIZE)\n", (476, 507),... |
from flask import Blueprint, render_template
from flask_login import login_required, current_user
articles = Blueprint(
"articles",
__name__,
)
@articles.route("/intro-fgr")
@login_required
def intro():
return render_template("article-intro-fgr.html", user=current_user)
@articles.route("/causes-fgr")
@... | [
"flask.render_template",
"flask.Blueprint"
] | [((110, 141), 'flask.Blueprint', 'Blueprint', (['"""articles"""', '__name__'], {}), "('articles', __name__)\n", (119, 141), False, 'from flask import Blueprint, render_template\n'), ((225, 285), 'flask.render_template', 'render_template', (['"""article-intro-fgr.html"""'], {'user': 'current_user'}), "('article-intro-fg... |
from flask import Flask, render_template, request, redirect, url_for
import tensorflow as tf
from keras.models import load_model
from keras.backend import set_session
from src.utils import image_preprocessing
from src.utils import overall_class_label
from src.utils import infinite_scraper
# sessions and default graphs... | [
"flask.render_template",
"flask.request.args.get",
"src.utils.overall_class_label.give_ovr_class_label_output",
"src.utils.infinite_scraper.unofficial",
"keras.models.load_model",
"flask.Flask",
"tensorflow.Session",
"src.utils.infinite_scraper.official",
"keras.backend.set_session",
"flask.url_fo... | [((397, 409), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (407, 409), True, 'import tensorflow as tf\n'), ((418, 440), 'tensorflow.get_default_graph', 'tf.get_default_graph', ([], {}), '()\n', (438, 440), True, 'import tensorflow as tf\n'), ((441, 458), 'keras.backend.set_session', 'set_session', (['sess'], {... |
# Faça um programa que leia o comprimento do cateto oposto e a do cateto adjacente de um triângulo retângulo.
# Calcule e mostre o comprimento da hipotenusa.
from math import hypot
catoposto = float(input('Cateto oposto: '))
catadjacente = float(input('Cateto adjacente: '))
print(hypot(catoposto, catadjacente))
'''
... | [
"math.hypot"
] | [((283, 313), 'math.hypot', 'hypot', (['catoposto', 'catadjacente'], {}), '(catoposto, catadjacente)\n', (288, 313), False, 'from math import hypot\n')] |
import os
CRAIGSLIST_SITE = 'newjersey'
CRAIGSLIST_CATEGORY = 'apa'
MIN_FT2 = 900
MIN_PRICE = 1500
MAX_PRICE = 3000
MAX_TRANSIT_DISTANCE = 0.75
BOXES = {
"Hoboken": [40.734966101, -74.0439891815, 40.7529789172, -74.0192699432],
"The Heights": [40.7332100782, -74.0573787689, 40.7615609255, -74.0378093719],
... | [
"os.getenv"
] | [((1429, 1457), 'os.getenv', 'os.getenv', (['"""SLACK_TOKEN"""', '""""""'], {}), "('SLACK_TOKEN', '')\n", (1438, 1457), False, 'import os\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import pickle
import numpy as np
from scipy.io import wavfile
import python_speech_features as fextract
audio_filename = sys.argv[1]
features_filename = sys.argv[2]
rate, sig = wavfile.read(audio_filename)
fbank_feat = fextract.logfbank(sig,samplerate=r... | [
"pickle.dump",
"scipy.io.wavfile.read",
"python_speech_features.logfbank"
] | [((242, 270), 'scipy.io.wavfile.read', 'wavfile.read', (['audio_filename'], {}), '(audio_filename)\n', (254, 270), False, 'from scipy.io import wavfile\n'), ((286, 325), 'python_speech_features.logfbank', 'fextract.logfbank', (['sig'], {'samplerate': 'rate'}), '(sig, samplerate=rate)\n', (303, 325), True, 'import pytho... |
import numpy as np
import pymc as pm
import networkx as nx
from matplotlib import pyplot as plt
alpha = 0.5
beta = 0.1
L= 9.0
G0 = nx.Graph()
for i in range(1, 10):
for j in range(i + 1, 11):
G0.add_edge(i, j)
#G0.add_path(range(1, 11))
#G0.add_path(range(1, 11))
#G0.remove_edge(2, 3)... | [
"matplotlib.pyplot.hist",
"networkx.is_connected",
"numpy.log",
"networkx.Graph",
"numpy.exp",
"pymc.Metropolis.__init__",
"pymc.MCMC",
"pymc.stochastic",
"networkx.draw",
"matplotlib.pyplot.show"
] | [((142, 152), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (150, 152), True, 'import networkx as nx\n'), ((478, 507), 'pymc.stochastic', 'pm.stochastic', ([], {'dtype': 'nx.Graph'}), '(dtype=nx.Graph)\n', (491, 507), True, 'import pymc as pm\n'), ((2567, 2597), 'pymc.MCMC', 'pm.MCMC', (['[cwg, average_degree]'], {})... |
from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
from board.feeds import EventFeed
from board.views import IndexView, ServiceView
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', IndexView.as_view(), name='index'),
url(r'^services/(?P<slug>[-\w]+)$', Serv... | [
"board.views.IndexView.as_view",
"django.conf.urls.defaults.include",
"board.views.ServiceView.as_view",
"board.feeds.EventFeed",
"django.contrib.admin.autodiscover"
] | [((176, 196), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (194, 196), False, 'from django.contrib import admin\n'), ((240, 259), 'board.views.IndexView.as_view', 'IndexView.as_view', ([], {}), '()\n', (257, 259), False, 'from board.views import IndexView, ServiceView\n'), ((316, 337), '... |
# region [Imports]
# * Standard Library Imports ---------------------------------------------------------------------------->
import os
import asyncio
from io import BytesIO
from pathlib import Path
from datetime import datetime
from tempfile import TemporaryDirectory
from textwrap import dedent
# * Third Party Impo... | [
"PIL.Image.new",
"antipetros_discordbot.utility.checks.allowed_channel_and_allowed_role_2",
"gidlogger.class_init_notification",
"io.BytesIO",
"antipetros_discordbot.utility.misc.make_config_name",
"gidlogger.aux_logger",
"antipetros_discordbot.utility.embed_helpers.make_basic_embed",
"textwrap.dedent... | [((1642, 1667), 'gidlogger.aux_logger', 'glog.aux_logger', (['__name__'], {}), '(__name__)\n', (1657, 1667), True, 'import gidlogger as glog\n'), ((1668, 1707), 'gidlogger.import_notification', 'glog.import_notification', (['log', '__name__'], {}), '(log, __name__)\n', (1692, 1707), True, 'import gidlogger as glog\n'),... |
import requests
from bs4 import BeautifulSoup as soup
import pandas as pd
# PJ chatlog archive
url_main = 'http://perverted-justice.com/?archive=byName'
# get list of chat URLs
req_main = requests.get(url_main)
main_soup = soup(req_main.text, "html.parser")
# list to store URLs
url_link = []
for link in main_soup.fin... | [
"bs4.BeautifulSoup",
"pandas.DataFrame",
"requests.get"
] | [((190, 212), 'requests.get', 'requests.get', (['url_main'], {}), '(url_main)\n', (202, 212), False, 'import requests\n'), ((225, 259), 'bs4.BeautifulSoup', 'soup', (['req_main.text', '"""html.parser"""'], {}), "(req_main.text, 'html.parser')\n", (229, 259), True, 'from bs4 import BeautifulSoup as soup\n'), ((574, 601)... |
"""
This module contains the basic logging setup for the project.
"""
import datetime
import logging
import os
def setup_logging(module):
"""Set up the logging."""
log_file = os.path.join('/astro/3/mutchler/mt/logs/', module,
module + '_' + datetime.datetime.now().strftime('%Y-%m-%d-%H-%M') + '.log')... | [
"logging.basicConfig",
"datetime.datetime.now"
] | [((325, 474), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': 'log_file', 'format': '"""%(asctime)s %(levelname)s: %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S %p"""', 'level': 'logging.INFO'}), "(filename=log_file, format=\n '%(asctime)s %(levelname)s: %(message)s', datefmt=\n '%m/%d/%Y %H:%... |
from django.shortcuts import render, HttpResponse
from django.views.decorators.csrf import csrf_exempt
import os
import base64
# from .celery_test import test
# from clone_script import clone
def index(request):
return render(request, 'clone/index.html')
def results(request):
return render(request, 'clone/results.... | [
"django.shortcuts.render",
"base64.b64decode",
"django.shortcuts.HttpResponse"
] | [((222, 257), 'django.shortcuts.render', 'render', (['request', '"""clone/index.html"""'], {}), "(request, 'clone/index.html')\n", (228, 257), False, 'from django.shortcuts import render, HttpResponse\n'), ((289, 326), 'django.shortcuts.render', 'render', (['request', '"""clone/results.html"""'], {}), "(request, 'clone... |
from __future__ import (
annotations,
)
import logging
import warnings
from pathlib import (
Path,
)
from typing import (
TYPE_CHECKING,
Optional,
Type,
TypeVar,
Union,
)
from .object import (
Object,
)
if TYPE_CHECKING:
from .config import (
Config,
)
logger = loggin... | [
"logging.getLogger",
"warnings.warn",
"typing.TypeVar"
] | [((314, 341), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (331, 341), False, 'import logging\n'), ((347, 379), 'typing.TypeVar', 'TypeVar', (['"""S"""'], {'bound': '"""SetupMixin"""'}), "('S', bound='SetupMixin')\n", (354, 379), False, 'from typing import TYPE_CHECKING, Optional, Type,... |
from optparse import OptionParser
import yaml
import cwrap_parser
import nn_parse
import native_parse
import preprocess_declarations
import function_wrapper
import dispatch_macros
import copy_wrapper
from code_template import CodeTemplate
parser = OptionParser()
parser.add_option('-s', '--source-path', help='path t... | [
"cwrap_parser.parse",
"nn_parse.run",
"preprocess_declarations.run",
"yaml.dump",
"function_wrapper.create_generic",
"code_template.CodeTemplate.from_file",
"optparse.OptionParser",
"function_wrapper.create_derived",
"dispatch_macros.create",
"native_parse.parse",
"copy_wrapper.create"
] | [((252, 266), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (264, 266), False, 'from optparse import OptionParser\n'), ((809, 870), 'code_template.CodeTemplate.from_file', 'CodeTemplate.from_file', (["(TEMPLATE_PATH + '/GeneratorDerived.h')"], {}), "(TEMPLATE_PATH + '/GeneratorDerived.h')\n", (831, 870), F... |
from logging import getLogger
from typing import Dict, List, Optional
from tmtrader.entity.order import FilledBasicOrder
from tmtrader.entity.position import ClosedPosition, Position, Positions, \
PositionsRef
from tmtrader.exchange_for_backtest.usecase.order_to_share import from_order
logger = getLogger(__name__... | [
"logging.getLogger",
"tmtrader.exchange_for_backtest.usecase.order_to_share.from_order",
"tmtrader.entity.position.Positions"
] | [((302, 321), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (311, 321), False, 'from logging import getLogger\n'), ((1311, 1328), 'tmtrader.exchange_for_backtest.usecase.order_to_share.from_order', 'from_order', (['order'], {}), '(order)\n', (1321, 1328), False, 'from tmtrader.exchange_for_backt... |
import grpc
from concurrent import futures
import time
import sys
sys.path.insert(0, 'service/')
from service_spec import fake_news_pb2
from service_spec import fake_news_pb2_grpc
import json
import test
class fake_news_classificationServicer(fake_news_pb2_grpc.fake_news_classificationServicer):
def classify... | [
"service_spec.fake_news_pb2.OutputMessage",
"sys.path.insert",
"concurrent.futures.ThreadPoolExecutor",
"time.sleep",
"test.predict"
] | [((68, 98), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""service/"""'], {}), "(0, 'service/')\n", (83, 98), False, 'import sys\n'), ((496, 538), 'concurrent.futures.ThreadPoolExecutor', 'futures.ThreadPoolExecutor', ([], {'max_workers': '(10)'}), '(max_workers=10)\n', (522, 538), False, 'from concurrent import fu... |
from io import BytesIO
from PIL import Image
from django.contrib.auth.models import AbstractUser
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.core.mail import send_mail
from django.db import models
from resizeimage import resizeimage
from rest_framework.authtoken.models import Token
from ... | [
"PIL.Image.open",
"django.core.mail.send_mail",
"io.BytesIO",
"django.db.models.ImageField",
"resizeimage.resizeimage.resize_cover",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((681, 758), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(40)', 'unique': '(True)', 'verbose_name': '"""отоброжаемое имя"""'}), "(max_length=40, unique=True, verbose_name='отоброжаемое имя')\n", (697, 758), False, 'from django.db import models\n'), ((803, 948), 'django.db.models.ImageField',... |
# Rewritten by @keinshin
import io
from userbot import CMD_LIST, ALIVE_NAME, bot as light
from userbot import CMD_HELP
from userbot.utils import lightning_cmd
import asyncio
from var import Var
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "Pls Go To Heroku Vars Then in `ALIVE_NAME`place You Telegram `Your Desire... | [
"userbot.utils.lightning_cmd",
"asyncio.sleep"
] | [((361, 396), 'userbot.utils.lightning_cmd', 'lightning_cmd', ([], {'pattern': '"""help ?(.*)"""'}), "(pattern='help ?(.*)')\n", (374, 396), False, 'from userbot.utils import lightning_cmd\n'), ((1075, 1091), 'asyncio.sleep', 'asyncio.sleep', (['(5)'], {}), '(5)\n', (1088, 1091), False, 'import asyncio\n'), ((1541, 155... |
import torch
import torch.nn as nn
from torchvision import models
import torch.nn.functional as F
def model_parser(model, sum_mode=False, dropout_rate=0.0, bayesian=False):
base_model = None
if model == 'Resnet':
base_model = models.resnet34(pretrained=True)
network = HourglassNet(base_model, ... | [
"torch.nn.init.constant_",
"torch.nn.init.kaiming_normal_",
"torch.nn.functional.dropout",
"torch.nn.Conv2d",
"torchvision.models.resnet34",
"torch.nn.functional.relu",
"torch.nn.Linear",
"torch.nn.ConvTranspose2d",
"torch.cat"
] | [((244, 276), 'torchvision.models.resnet34', 'models.resnet34', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (259, 276), False, 'from torchvision import models\n'), ((2234, 2263), 'torch.nn.Linear', 'nn.Linear', (['(56 * 56 * 32)', '(1024)'], {}), '(56 * 56 * 32, 1024)\n', (2243, 2263), True, 'import torch.nn... |
"""MongoDB IO tasks."""
import logging
from typing import List, Optional, Sequence
from urllib.parse import urlparse
import attr
from icecream import ic # noqa pylint: disable=unused-import
from pymongo import MongoClient
from pymongo.errors import ServerSelectionTimeoutError
import voluptuous as vol
from dataplaybo... | [
"logging.getLogger",
"icecream.ic",
"dataplaybook.utils.PlaybookError",
"attr.s",
"urllib.parse.urlparse",
"voluptuous.Invalid",
"pymongo.MongoClient",
"dataplaybook.task",
"voluptuous.InInvalid",
"attr.ib"
] | [((407, 434), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (424, 434), False, 'import logging\n'), ((726, 744), 'attr.s', 'attr.s', ([], {'slots': '(True)'}), '(slots=True)\n', (732, 744), False, 'import attr\n'), ((2186, 2192), 'dataplaybook.task', 'task', ([], {}), '()\n', (2190, 2192... |
import argparse
import json
import numpy as np
import typing
from blockfs.directory import Directory
import logging
from precomputed_tif.blockfs_stack import BlockfsStack
from precomputed_tif.ngff_stack import NGFFStack
import os
import sys
from spimstitch.ngff import NGFFDirectory
from ..stitch import get_output_siz... | [
"os.path.exists",
"json.loads",
"spimstitch.ngff.NGFFDirectory",
"argparse.ArgumentParser",
"precomputed_tif.blockfs_stack.BlockfsStack",
"numpy.arange",
"os.path.join",
"logging.warning",
"os.path.split",
"os.path.dirname",
"blockfs.directory.Directory",
"os.mkdir",
"os.cpu_count",
"json.... | [((394, 419), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (417, 419), False, 'import argparse\n'), ((4039, 4076), 'os.walk', 'os.walk', (['opts.input'], {'followlinks': '(True)'}), '(opts.input, followlinks=True)\n', (4046, 4076), False, 'import os\n'), ((6213, 6247), 'os.path.join', 'os.pat... |
from haystack import indexes
from issues.models import Issue, Proposal
from haystack.fields import IntegerField, CharField, BooleanField, DateField, DateTimeField
from datetime import date, datetime, timedelta
class IssueIndex(indexes.ModelSearchIndex, indexes.Indexable):
community = IntegerField(model_attr='comm... | [
"haystack.fields.DateField",
"issues.models.Issue.objects.active",
"haystack.fields.CharField",
"issues.models.Proposal.objects.active",
"haystack.fields.BooleanField",
"haystack.fields.DateTimeField",
"haystack.fields.IntegerField"
] | [((291, 330), 'haystack.fields.IntegerField', 'IntegerField', ([], {'model_attr': '"""community_id"""'}), "(model_attr='community_id')\n", (303, 330), False, 'from haystack.fields import IntegerField, CharField, BooleanField, DateField, DateTimeField\n'), ((353, 395), 'haystack.fields.BooleanField', 'BooleanField', ([]... |
#
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
import argparse
from typing import Optional
from data.sampler import arguments_sampler
from data.collate_fns import arguments_collate_fn
from options.utils import load_config_file
from data.datasets import argument... | [
"data.sampler.arguments_sampler",
"metrics.arguments_stats",
"options.utils.load_config_file",
"loss_fn.arguments_loss_fn",
"optim.arguments_optimizer",
"argparse.ArgumentParser",
"cvnets.arguments_model",
"optim.scheduler.arguments_scheduler",
"data.collate_fns.arguments_collate_fn",
"cvnets.anch... | [((8652, 8724), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Training arguments"""', 'add_help': '(True)'}), "(description='Training arguments', add_help=True)\n", (8675, 8724), False, 'import argparse\n'), ((8771, 8803), 'data.sampler.arguments_sampler', 'arguments_sampler', ([], {'pa... |
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from django.template.defaultfilters import slugify, linebreaks, date, truncatechars
from wagtail.core.models import Page
from wagtail.core.rich_text import RichText
from migration.models import *
from accounts.models im... | [
"events.models.EventType.objects.get",
"django.contrib.auth.get_user_model",
"accounts.models.DatabaseAccount",
"django.template.defaultfilters.linebreaks",
"django.template.defaultfilters.date",
"django.template.defaultfilters.truncatechars",
"events.models.EventType",
"accounts.models.ShellAccount",... | [((1142, 1207), 'accounts.models.ShellAccount', 'ShellAccount', ([], {'name': 'account.name', 'user': 'user', 'status': 'account.status'}), '(name=account.name, user=user, status=account.status)\n', (1154, 1207), False, 'from accounts.models import CompsocUser, ShellAccount, DatabaseAccount\n'), ((1390, 1458), 'account... |
import flask
import restea.formats as formats
from restea.adapters.base import (
BaseResourceWrapper,
BaseRequestWrapper,
)
class FlaskRequestWrapper(BaseRequestWrapper):
'''
Object wrapping Flask request context.
'''
@property
def data(self):
'''
Returns a payload sent to... | [
"restea.formats.get_formatter",
"flask.Response"
] | [((1781, 1815), 'restea.formats.get_formatter', 'formats.get_formatter', (['data_format'], {}), '(data_format)\n', (1802, 1815), True, 'import restea.formats as formats\n'), ((2018, 2080), 'flask.Response', 'flask.Response', (['res'], {'mimetype': 'content_type', 'status': 'status_code'}), '(res, mimetype=content_type,... |
from datetime import datetime
from tts import tts
def take_notes(speech_text):
words_of_message = speech_text.split()
words_of_message.remove("note")
cleaned_message = ' '.join(words_of_message)
f = open("notes.txt", "a+")
f.write("'" + cleaned_message + "'" + " - note taken at: " + datetime.strfti... | [
"datetime.datetime.now",
"tts.tts"
] | [((377, 408), 'tts.tts', 'tts', (['"""Your note has been saved"""'], {}), "('Your note has been saved')\n", (380, 408), False, 'from tts import tts\n'), ((436, 470), 'tts.tts', 'tts', (['"""Your notes are as follows: """'], {}), "('Your notes are as follows: ')\n", (439, 470), False, 'from tts import tts\n'), ((742, 77... |
#!/usr/bin/env python
# coding: utf-8
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Jan 5 2021
@author: <NAME>
based on the Iso-MPS codes
"""
#%% -- IMPORTS --
import sys
sys.path.append("..") # import one subdirectory up in files
# external packages
import numpy as np
import qiskit as qk
import netwo... | [
"mps.mps.MPO",
"tenpy.networks.site.SpinHalfSite",
"networkx.topological_sort",
"networkx.DiGraph",
"networkx.algorithms.dag.is_directed_acyclic_graph",
"numpy.swapaxes",
"tenpy.networks.mps.MPS.from_Bflat",
"mps.mps.MPS",
"qiskit.QuantumCircuit",
"sys.path.append"
] | [((188, 209), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (203, 209), False, 'import sys\n'), ((8075, 8122), 'tenpy.networks.site.SpinHalfSite', 'tenpy.networks.site.SpinHalfSite', ([], {'conserve': 'None'}), '(conserve=None)\n', (8107, 8122), False, 'import tenpy\n'), ((9621, 9677), 'mps.mps.... |
import sys
import click
from sonic_py_common import multi_asic, device_info
platform_sfputil = None
def load_platform_sfputil():
global platform_sfputil
try:
import sonic_platform_base.sonic_sfp.sfputilhelper
platform_sfputil = sonic_platform_base.sonic_sfp.sfputilhelper.SfpUtilHelper()
... | [
"sonic_py_common.multi_asic.is_multi_asic",
"sonic_py_common.device_info.get_path_to_port_config_file",
"sys.exit",
"sonic_py_common.multi_asic.get_num_asics",
"sonic_py_common.device_info.get_paths_to_platform_and_hwsku_dirs"
] | [((534, 560), 'sonic_py_common.multi_asic.is_multi_asic', 'multi_asic.is_multi_asic', ([], {}), '()\n', (558, 560), False, 'from sonic_py_common import multi_asic, device_info\n'), ((438, 449), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (446, 449), False, 'import sys\n'), ((704, 754), 'sonic_py_common.device_info.... |
import tempfile
from urllib.request import urlretrieve, urlopen
from urllib.error import URLError
import pyscipopt as scip
import os
import pandas as pd
class Loader:
def __init__(self, persistent_directory=None):
"""
Initializes the MIPLIB loader object
Parameters
----------
... | [
"os.listdir",
"pandas.read_csv",
"urllib.request.urlretrieve",
"pyscipopt.Model",
"os.unlink",
"tempfile.NamedTemporaryFile",
"urllib.request.urlopen"
] | [((5028, 5067), 'pandas.read_csv', 'pd.read_csv', (['source'], {'names': "['instance']"}), "(source, names=['instance'])\n", (5039, 5067), True, 'import pandas as pd\n'), ((952, 964), 'pyscipopt.Model', 'scip.Model', ([], {}), '()\n', (962, 964), True, 'import pyscipopt as scip\n'), ((2496, 2516), 'os.listdir', 'os.lis... |
#!/usr/bin/python
import Adafruit_SSD1306
import os
from retrying import retry
from PIL import Image, ImageDraw, ImageFont
class Oled:
def __init__(self, display_bus, font_size):
# declare member variables
self.draw = None
self.font = None
self.disp = None
self.width = Non... | [
"PIL.Image.new",
"PIL.ImageFont.truetype",
"Adafruit_SSD1306.SSD1306_128_64",
"PIL.ImageDraw.Draw",
"retrying.retry",
"os.path.abspath"
] | [((1650, 1657), 'retrying.retry', 'retry', ([], {}), '()\n', (1655, 1657), False, 'from retrying import retry\n'), ((754, 821), 'Adafruit_SSD1306.SSD1306_128_64', 'Adafruit_SSD1306.SSD1306_128_64', ([], {'rst': 'None', 'i2c_bus': 'self.display_bus'}), '(rst=None, i2c_bus=self.display_bus)\n', (785, 821), False, 'import... |
import os
import json
import boto3
def handler(event, context):
table = os.environ.get('table')
dynamodb = boto3.client('dynamodb')
item = {
"name":{'S':event["queryStringParameters"]["name"]},
"location":{'S':event["queryStringParameters"]["location"]},
"age":{'S':even... | [
"boto3.client",
"json.dumps",
"os.environ.get"
] | [((77, 100), 'os.environ.get', 'os.environ.get', (['"""table"""'], {}), "('table')\n", (91, 100), False, 'import os\n'), ((116, 140), 'boto3.client', 'boto3.client', (['"""dynamodb"""'], {}), "('dynamodb')\n", (128, 140), False, 'import boto3\n'), ((589, 608), 'json.dumps', 'json.dumps', (['message'], {}), '(message)\n... |
"""
Module for Gemini FLAMINGOS.
.. include:: ../include/links.rst
"""
import os
from pkg_resources import resource_filename
from IPython import embed
import numpy as np
from pypeit import msgs
from pypeit import telescopes
from pypeit.core import framematch
from pypeit.images import detector_container
from pypeit.... | [
"os.path.join",
"pypeit.images.detector_container.DetectorContainer",
"pypeit.telescopes.GeminiSTelescopePar",
"pypeit.core.framematch.check_frame_exptime",
"numpy.atleast_1d"
] | [((517, 549), 'pypeit.telescopes.GeminiSTelescopePar', 'telescopes.GeminiSTelescopePar', ([], {}), '()\n', (547, 549), False, 'from pypeit import telescopes\n'), ((2994, 3047), 'pypeit.images.detector_container.DetectorContainer', 'detector_container.DetectorContainer', ([], {}), '(**detector_dict)\n', (3030, 3047), Fa... |
import os
from starlette.applications import Starlette
from starlette.responses import PlainTextResponse, Response
from starlette.testclient import TestClient
from apistar.client import Client, decoders
app = Starlette()
@app.route("/text-response/")
def text_response(request):
return PlainTextResponse("hello,... | [
"starlette.applications.Starlette",
"starlette.responses.Response",
"starlette.testclient.TestClient",
"os.path.basename",
"apistar.client.decoders.DownloadDecoder",
"starlette.responses.PlainTextResponse"
] | [((212, 223), 'starlette.applications.Starlette', 'Starlette', ([], {}), '()\n', (221, 223), False, 'from starlette.applications import Starlette\n'), ((295, 328), 'starlette.responses.PlainTextResponse', 'PlainTextResponse', (['"""hello, world"""'], {}), "('hello, world')\n", (312, 328), False, 'from starlette.respons... |
import os, json
from collections import Counter
# test if exist and mkdir
# ../Results/features/corpus_info/
# ../Results/labels
for col in ["FEATS", "PARSEME:MWE", "UPOS", "XPOS", "DEPREL", "DEPS", "LEMMA"]:
for file_type in ["train.cupt", "dev.cupt", "test.blind.cupt"]:
counter_dict = dict()
count_all = Counte... | [
"collections.Counter",
"os.listdir",
"json.dump"
] | [((314, 323), 'collections.Counter', 'Counter', ([], {}), '()\n', (321, 323), False, 'from collections import Counter\n'), ((342, 373), 'os.listdir', 'os.listdir', (['"""../sharedtask_11/"""'], {}), "('../sharedtask_11/')\n", (352, 373), False, 'import os, json\n'), ((394, 436), 'os.listdir', 'os.listdir', (["('../shar... |
#!/usr/bin/env python3
import sys
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, FileType
from Bio import Entrez
from rex.util import batchify
def parse_args(argv):
parser = ArgumentParser(description="eutil", formatter_class=ArgumentDefaultsHelpFormatter)
parser.add_argument(
"eutil", def... | [
"argparse.FileType",
"argparse.ArgumentParser"
] | [((201, 288), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""eutil"""', 'formatter_class': 'ArgumentDefaultsHelpFormatter'}), "(description='eutil', formatter_class=\n ArgumentDefaultsHelpFormatter)\n", (215, 288), False, 'from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, Fil... |
from django.contrib import admin
from establishment.documentation.models import DocumentationEntry
admin.site.register(DocumentationEntry)
| [
"django.contrib.admin.site.register"
] | [((101, 140), 'django.contrib.admin.site.register', 'admin.site.register', (['DocumentationEntry'], {}), '(DocumentationEntry)\n', (120, 140), False, 'from django.contrib import admin\n')] |
from precise.skaters.covariance.allcovskaters import ALL_D0_SKATERS
from precise.skaters.covarianceutil.likelihood import cov_skater_loglikelihood
from uuid import uuid4
import os
import json
import pathlib
from pprint import pprint
import traceback
from collections import Counter
from momentum.functions import rvar
fr... | [
"traceback.format_exc",
"numpy.random.rand",
"pathlib.Path",
"json.dump",
"os.path.join",
"time.sleep",
"uuid.uuid4",
"collections.Counter",
"numpy.array",
"precise.skaters.covarianceutil.likelihood.cov_skater_loglikelihood",
"precise.skatertools.data.equity.random_m6_returns",
"pprint.pprint"... | [((1910, 1924), 'pprint.pprint', 'pprint', (['params'], {}), '(params)\n', (1916, 1924), False, 'from pprint import pprint\n'), ((1929, 1942), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1939, 1942), False, 'import time\n'), ((1992, 2014), 'pprint.pprint', 'pprint', (['ALL_D0_SKATERS'], {}), '(ALL_D0_SKATERS)\... |
"""
Advent of Code : Day 09
"""
from os import path
def parse_input(filename):
""" Parse input file values """
script_dir = path.dirname(__file__)
file_path = path.join(script_dir, filename)
with open(file_path, "r") as file:
val = list(map(int, file.read().splitlines()))
return val
d... | [
"os.path.dirname",
"os.path.join"
] | [((135, 157), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (147, 157), False, 'from os import path\n'), ((174, 205), 'os.path.join', 'path.join', (['script_dir', 'filename'], {}), '(script_dir, filename)\n', (183, 205), False, 'from os import path\n')] |
#!/usr/bin/env python3
'''
==============================================================
Copyright © 2019 Intel Corporation
SPDX-License-Identifier: MIT
==============================================================
'''
import intel.tca as tca
target = tca.get_target(id="whl_u_cnp_lp")
components = [(c.component,... | [
"intel.tca.ComponentWithSelectedSteppingList",
"intel.tca.get_target",
"intel.tca.latest",
"intel.tca.ComponentWithSelectedStepping",
"intel.tca.load",
"intel.tca.connect",
"intel.tca.Profile"
] | [((259, 292), 'intel.tca.get_target', 'tca.get_target', ([], {'id': '"""whl_u_cnp_lp"""'}), "(id='whl_u_cnp_lp')\n", (273, 292), True, 'import intel.tca as tca\n'), ((407, 446), 'intel.tca.ComponentWithSelectedSteppingList', 'tca.ComponentWithSelectedSteppingList', ([], {}), '()\n', (444, 446), True, 'import intel.tca ... |
from cvpro import stackImages
import cv2
cap = cv2.VideoCapture(0)
while True:
success, img = cap.read()
imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
imgList = [img, img, imgGray, img, imgGray]
imgStacked = stackImages(imgList, 2, 0.5)
cv2.imshow("stackedImg", imgStacked)
cv2.w... | [
"cvpro.stackImages",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.waitKey"
] | [((51, 70), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (67, 70), False, 'import cv2\n'), ((130, 167), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (142, 167), False, 'import cv2\n'), ((237, 265), 'cvpro.stackImages', 'stackImages', (['imgList',... |
#!/usr/bin/python2
from pprint import PrettyPrinter
from argparse import ArgumentParser
def parse_image_header(input_file):
comment = None
for num, line in enumerate(input_file):
line = line.strip()
if num == 0:
# First line, has to be a comment with the version, but we don't ... | [
"pprint.PrettyPrinter",
"argparse.ArgumentParser"
] | [((3232, 3280), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Convert a FIG file"""'}), "(description='Convert a FIG file')\n", (3246, 3280), False, 'from argparse import ArgumentParser\n'), ((3945, 3968), 'pprint.PrettyPrinter', 'PrettyPrinter', ([], {'indent': '(2)'}), '(indent=2)\n', (3958, 3... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import dask
from dask_kubernetes import KubeCluster
import numpy as np
# In[ ]:
#tag::remote_lb_deploy[]
# In[2]:
# Specify a remote deployment using a load blanacer, necessary for communication with notebook from cluster
dask.config.set({"kubernetes.scheduler-s... | [
"dask.config.set",
"dask_kubernetes.KubeCluster.from_yaml",
"dask.distributed.Client",
"numpy.take",
"dask.array.ones"
] | [((280, 350), 'dask.config.set', 'dask.config.set', (["{'kubernetes.scheduler-service-type': 'LoadBalancer'}"], {}), "({'kubernetes.scheduler-service-type': 'LoadBalancer'})\n", (295, 350), False, 'import dask\n'), ((374, 460), 'dask_kubernetes.KubeCluster.from_yaml', 'KubeCluster.from_yaml', (['"""worker-spec.yaml"""'... |
from sys import stdin
# Main program
def main():
expenses = [0]*1000
for line in stdin:
n = int(line)
if (n == 0):
break;
total, toExchangePos, toExchangeNeg = (0,)*3
for i in range(n):
line = stdin.readline()
expenses[i] = float(line)
... | [
"sys.stdin.readline"
] | [((262, 278), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (276, 278), False, 'from sys import stdin\n')] |
#!/usr/bin/env python3
# TODO: Write a command line tool to browser and search in the database
# TODO: Define a command set to search for strings, tags, similar talks, mark talks as seen, mark talks as irrelevant, mark talks as relevant, open a browser and watch, show details, quit
# https://opensource.com/article/... | [
"prompt_toolkit.auto_suggest.AutoSuggestFromHistory",
"prompt_toolkit.history.FileHistory",
"dropdata.MediaTagger",
"argparse.ArgumentParser"
] | [((1252, 1321), 'dropdata.MediaTagger', 'MediaTagger', ([], {'frab': '(False)', 'subtitles': '(False)', 'default': '(False)', 'offline': '(True)'}), '(frab=False, subtitles=False, default=False, offline=True)\n', (1263, 1321), False, 'from dropdata import MediaTagger\n'), ((1809, 1834), 'argparse.ArgumentParser', 'argp... |
"""
The pycity_scheduling framework
Copyright (C) 2022,
Institute for Automation of Complex Power Systems (ACS),
E.ON Energy Research Center (E.ON ERC),
RWTH Aachen University
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Softwa... | [
"pycity_scheduling.util.generic_constraints.LowerActivationLimit",
"pyomo.environ.Constraint"
] | [((3280, 3354), 'pycity_scheduling.util.generic_constraints.LowerActivationLimit', 'LowerActivationLimit', (['self', '"""p_th_heat"""', 'lower_activation_limit', '(-p_th_nom)'], {}), "(self, 'p_th_heat', lower_activation_limit, -p_th_nom)\n", (3300, 3354), False, 'from pycity_scheduling.util.generic_constraints import ... |
"""
API functionality for bootcamps
"""
import logging
from datetime import datetime, timedelta
import pytz
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.db.models import Sum
from applications.constants import AppStates
from ecommerce.models import Line, Order
from klasses.constan... | [
"logging.getLogger",
"django.db.models.Sum",
"ecommerce.models.Line.objects.filter",
"datetime.datetime.strptime",
"klasses.models.BootcampRunEnrollment.objects.filter",
"klasses.models.BootcampRunEnrollment.objects.update_or_create",
"datetime.timedelta",
"klasses.models.BootcampRun.objects.filter",
... | [((519, 546), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (536, 546), False, 'import logging\n'), ((8644, 8773), 'klasses.models.BootcampRunEnrollment.objects.update_or_create', 'BootcampRunEnrollment.objects.update_or_create', ([], {'user': 'user', 'bootcamp_run': 'run', 'defaults': "... |
# -*- coding: UTF-8 -*-
# vim: set expandtab sw=4 ts=4 sts=4:
#
# phpMyAdmin web site
#
# Copyright (C) 2008 - 2016 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either vers... | [
"dateutil.parser.parse",
"news.models.Planet.objects.get_or_create"
] | [((1307, 1368), 'news.models.Planet.objects.get_or_create', 'Planet.objects.get_or_create', ([], {'url': 'entry.link', 'defaults': 'params'}), '(url=entry.link, defaults=params)\n', (1335, 1368), False, 'from news.models import Planet\n'), ((1232, 1261), 'dateutil.parser.parse', 'parser.parse', (['entry.published'], {}... |
import collections
import csv
import os
import sys
from enum import Enum
from pathlib import Path
# adapt paths for jupyter
module_path = os.path.abspath(os.path.join('..'))
if module_path not in sys.path:
sys.path.append(module_path)
import face_alignment
from yawn_train.src.blazeface_detector import BlazeFaceD... | [
"yawn_train.src.download_utils.download_blazeface",
"tensorflow.keras.models.load_model",
"cv2.destroyAllWindows",
"yawn_train.src.blazeface_detector.BlazeFaceDetector",
"yawn_train.src.download_utils.download_and_unpack_dlib_68_landmarks",
"sys.path.append",
"os.walk",
"yawn_train.src.ssd_face_detect... | [((1922, 1958), 'os.path.join', 'os.path.join', (['MOUTH_FOLDER', '"""opened"""'], {}), "(MOUTH_FOLDER, 'opened')\n", (1934, 1958), False, 'import os\n'), ((1981, 2017), 'os.path.join', 'os.path.join', (['MOUTH_FOLDER', '"""closed"""'], {}), "(MOUTH_FOLDER, 'closed')\n", (1993, 2017), False, 'import os\n'), ((2624, 268... |
# Copyright (c) 2018, INRIA
# Copyright (c) 2018, University of Lille
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice, thi... | [
"logging.getLogger",
"powerapi.database.BaseDB.__init__",
"influxdb_client.InfluxDBClient"
] | [((3073, 3094), 'powerapi.database.BaseDB.__init__', 'BaseDB.__init__', (['self'], {}), '(self)\n', (3088, 3094), False, 'from powerapi.database import BaseDB, DBError\n'), ((4035, 4104), 'influxdb_client.InfluxDBClient', 'InfluxDBClient', ([], {'url': 'self.complete_url', 'token': 'self.token', 'org': 'self.org'}), '(... |
""" TensorMONK's :: architectures :: ESRGAN """
__all__ = ["Generator", "Discriminator", "VGG19"]
import torch
import torch.nn as nn
import torchvision
from ..layers import Convolution
class DenseBlock(nn.Module):
r"""From DenseNet - https://arxiv.org/pdf/1608.06993.pdf."""
def __init__(self, tensor_size: t... | [
"torchvision.models.vgg19",
"torch.nn.PixelShuffle",
"torch.nn.ModuleList",
"torch.nn.Sequential",
"torch.nn.init.kaiming_normal_",
"torch.no_grad",
"torch.cat"
] | [((883, 902), 'torch.nn.ModuleList', 'nn.ModuleList', (['cnns'], {}), '(cnns)\n', (896, 902), True, 'import torch.nn as nn\n'), ((1879, 1899), 'torch.nn.Sequential', 'nn.Sequential', (['*cnns'], {}), '(*cnns)\n', (1892, 1899), True, 'import torch.nn as nn\n'), ((3964, 3987), 'torch.nn.Sequential', 'nn.Sequential', (['*... |
"""Example for Pytest-Gherkin"""
import ast
from pytest import approx
from pt_gh import step, value_options
operator = value_options("add", "subtract")
@step("I have {num1:d} and {num2:d}")
def given_numbers_i(num1, num2, context):
"""Example of parameter types converted based on annotation
and context i... | [
"ast.literal_eval",
"pytest.approx",
"pt_gh.value_options",
"pt_gh.step"
] | [((124, 156), 'pt_gh.value_options', 'value_options', (['"""add"""', '"""subtract"""'], {}), "('add', 'subtract')\n", (137, 156), False, 'from pt_gh import step, value_options\n'), ((160, 196), 'pt_gh.step', 'step', (['"""I have {num1:d} and {num2:d}"""'], {}), "('I have {num1:d} and {num2:d}')\n", (164, 196), False, '... |
#!/usr/bin/env python3
import logging
import subprocess
import re
import boto.utils
from jinja2 import Environment, FileSystemLoader
from taupage import get_config
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
TPL_NAME = 'td-agent.conf.jinja2'
TD_AGENT_TEMPLATE_PATH = '/etc/td-agent/t... | [
"logging.basicConfig",
"logging.getLogger",
"subprocess.check_output",
"subprocess.Popen",
"jinja2.FileSystemLoader",
"re.sub",
"taupage.get_config",
"re.search"
] | [((167, 206), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (186, 206), False, 'import logging\n'), ((216, 243), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (233, 243), False, 'import logging\n'), ((460, 512), 'subprocess.Popen... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# The MIT License
#
# Copyright (c) 2016 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Soft... | [
"yagocd.util.since",
"csv.DictReader",
"csv.reader",
"six.StringIO"
] | [((1446, 1461), 'yagocd.util.since', 'since', (['"""14.3.0"""'], {}), "('14.3.0')\n", (1451, 1461), False, 'from yagocd.util import RequireParamMixin, since\n'), ((5275, 5298), 'six.StringIO', 'StringIO', (['response.text'], {}), '(response.text)\n', (5283, 5298), False, 'from six import StringIO\n'), ((6464, 6487), 's... |
import discord
import asyncio
import json
import asyncpg
from discord.ext import commands
from discord.ext import tasks
class Tasks(commands.Cog):
def __init__(self, client):
self.client = client
print(f'{__name__} 로드 완료!')
self.change_status.add_exception_type(asyncpg.Postgr... | [
"json.load",
"discord.Game",
"discord.ext.tasks.loop",
"asyncio.sleep"
] | [((449, 461), 'discord.ext.tasks.loop', 'tasks.loop', ([], {}), '()\n', (459, 461), False, 'from discord.ext import tasks\n'), ((565, 577), 'json.load', 'json.load', (['f'], {}), '(f)\n', (574, 577), False, 'import json\n'), ((762, 778), 'asyncio.sleep', 'asyncio.sleep', (['(5)'], {}), '(5)\n', (775, 778), False, 'impo... |
import numpy as np
import math
from scipy.optimize import minimize
class Optimize():
def __init__(self):
self.c_rad2deg = 180.0 / np.pi
self.c_deg2rad = np.pi / 180.0
def isRotationMatrix(self, R) :
Rt = np.transpose(R)
shouldBeIdentity = np.dot(Rt, R)
I = np.id... | [
"numpy.identity",
"numpy.clip",
"numpy.cross",
"math.acos",
"scipy.optimize.minimize",
"math.asin",
"numpy.array",
"numpy.dot",
"math.atan2",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin",
"numpy.transpose"
] | [((246, 261), 'numpy.transpose', 'np.transpose', (['R'], {}), '(R)\n', (258, 261), True, 'import numpy as np\n'), ((289, 302), 'numpy.dot', 'np.dot', (['Rt', 'R'], {}), '(Rt, R)\n', (295, 302), True, 'import numpy as np\n'), ((315, 344), 'numpy.identity', 'np.identity', (['(3)'], {'dtype': 'R.dtype'}), '(3, dtype=R.dty... |
"""
Freyr - A Free stock API
"""
import random
import requests.utils
header = [
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:83.0) Gecko/20100101 Firefox/83.0",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:82.0) Gecko/20100101 Firefox/82.0",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:83.0)... | [
"random.choice"
] | [((9066, 9087), 'random.choice', 'random.choice', (['header'], {}), '(header)\n', (9079, 9087), False, 'import random\n')] |
from mixcoatl.admin.billing_code import BillingCode
from mixcoatl.geography.region import Region
from mixcoatl.admin.group import Group
from mixcoatl.admin.user import User
def get_servers(servers, **kwargs):
""" Returns a list of servers
Arguments:
:param servers: a list of servers that needs to be filt... | [
"mixcoatl.admin.billing_code.BillingCode.all",
"mixcoatl.geography.region.Region.all",
"mixcoatl.admin.group.Group.all",
"mixcoatl.admin.user.User.all"
] | [((7507, 7538), 'mixcoatl.admin.billing_code.BillingCode.all', 'BillingCode.all', ([], {'detail': '"""basic"""'}), "(detail='basic')\n", (7522, 7538), False, 'from mixcoatl.admin.billing_code import BillingCode\n'), ((7914, 7939), 'mixcoatl.admin.group.Group.all', 'Group.all', ([], {'detail': '"""basic"""'}), "(detail=... |
from app import db
# Junction Tables for many-to-many relationships
campaign_users = db.Table('campaign_users',
db.Column('campaign', db.Integer, db.ForeignKey('campaigns.id'), primary_key=True),
db.Column('user', db.Integer, db.ForeignKey('users.username'), primary_key=True),
)
campaign_vehicles = db.Table('... | [
"app.db.Column",
"app.db.ForeignKey",
"app.db.backref"
] | [((752, 791), 'app.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (761, 791), False, 'from app import db\n'), ((803, 836), 'app.db.Column', 'db.Column', (['db.String'], {'unique': '(True)'}), '(db.String, unique=True)\n', (812, 836), False, 'from app import db\... |
from typing import List
from django.shortcuts import render
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from assignment.models import Assignment
from course.models import Course
class CourseListView(ListView):
template_name = 'course/course_list.html'
model... | [
"assignment.models.Assignment.objects.filter"
] | [((709, 754), 'assignment.models.Assignment.objects.filter', 'Assignment.objects.filter', ([], {'course__id': 'self.pk'}), '(course__id=self.pk)\n', (734, 754), False, 'from assignment.models import Assignment\n')] |
# Copyright (c) 2010, <NAME>, <NAME>, and <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this lis... | [
"unittest.main",
"unittest.makeSuite",
"sys.path.append",
"replicant.Position"
] | [((1676, 1701), 'sys.path.append', 'sys.path.append', (['rootpath'], {}), '(rootpath)\n', (1691, 1701), False, 'import sys, os.path\n'), ((3133, 3165), 'unittest.makeSuite', 'unittest.makeSuite', (['TestPosition'], {}), '(TestPosition)\n', (3151, 3165), False, 'import unittest\n'), ((3198, 3232), 'unittest.main', 'unit... |
#!/usr/bin/env python
import sys, time
from backend import daemon
import itchat
import time
from ipcqueue import posixmq
import logging
import datetime as dt
import threading
import time
logFileDir = "/opt/crontab/IpcToItchat/"
nowDateTime = dt.datetime.now().strftime('%Y%m%d%H%M%S')
pyFilename = sys.argv[0].split('/... | [
"logging.basicConfig",
"itchat.send",
"itchat.get_chatrooms",
"itchat.auto_login",
"backend.daemon.restart",
"itchat.load_login_status",
"itchat.search_chatrooms",
"datetime.datetime.now",
"backend.daemon.start",
"sys.exit",
"backend.daemon.stop",
"logging.info",
"ipcqueue.posixmq.Queue"
] | [((402, 585), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""[%(levelname)-8s] [%(asctime)s]: %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""', 'filename': '(logFileDir + logFileName)', 'filemode': '"""w"""'}), "(level=logging.DEBUG, format=\n '[%(levelname)-8s] [%(a... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""mlbgame functions for the people API endpoints.
This module's functions gets the JSON payloads for the mlb.com games API
endpoints.
.. _Google Python Style Guide:
http://google.github.io/styleguide/pyguide.html
"""
from mlbgame.data import request
def get_person... | [
"mlbgame.data.request"
] | [((1494, 1542), 'mlbgame.data.request', 'request', (['(7)'], {'primary_key': 'person_id', 'params': 'params'}), '(7, primary_key=person_id, params=params)\n', (1501, 1542), False, 'from mlbgame.data import request\n'), ((2648, 2718), 'mlbgame.data.request', 'request', (['(7)', '"""stats/game/current"""'], {'primary_key... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import csv
import getopt
import io
import itertools
import logging
import numbers
import os
import re
import sqlite3
import string
import sys
import textwrap
import time
try:
import readline
except ImportError:
pass
try:
... | [
"logging.getLogger",
"itertools.chain",
"logging.debug",
"io.BytesIO",
"csv.Sniffer",
"sys.exit",
"getopt.gnu_getopt",
"wcwidth.wcswidth",
"logging.info",
"re.split",
"textwrap.dedent",
"csv.reader",
"re.match",
"sqlite3.complete_statement",
"logging.warning",
"logging.fatal",
"getop... | [((766, 779), 'csv.Sniffer', 'csv.Sniffer', ([], {}), '()\n', (777, 779), False, 'import csv\n'), ((13520, 13541), 're.split', 're.split', (['"""(;)"""', 'text'], {}), "('(;)', text)\n", (13528, 13541), False, 'import re\n'), ((14251, 14296), 're.sub', 're.sub', (['"""[;\\\\s]+$"""', '""""""', 'original_query', 'flags'... |
"""
Definition of an
:class:`~django_analyses.filters.output.output_definition.OutputDefinitionFilter`
for the :class:`~django_analyses.models.output.definitions.OutputDefinition`
model.
"""
from django_analyses.models.output.definitions.output_definition import \
OutputDefinition
from django_filters import rest_f... | [
"django_filters.rest_framework.AllValuesFilter"
] | [((584, 628), 'django_filters.rest_framework.AllValuesFilter', 'filters.AllValuesFilter', (['"""specification_set"""'], {}), "('specification_set')\n", (607, 628), True, 'from django_filters import rest_framework as filters\n')] |
"""
Created on Mar 12, 2018
@author: SirIsaacNeutron
"""
import tkinter
import tkinter.messagebox
import hanoi
DEFAULT_FONT = ('Helvetica', 14)
class DiskDialog:
"""A dialog window meant to get the number of Disks per Tower for the
Tower of Hanoi puzzle.
"""
def __init__(self):
self._dialog... | [
"tkinter.messagebox.showerror",
"tkinter.Entry",
"tkinter.Toplevel",
"tkinter.Button",
"hanoi.Game",
"tkinter.Canvas",
"tkinter.StringVar",
"tkinter.Tk",
"tkinter.Label",
"tkinter.messagebox.showinfo",
"tkinter.Frame"
] | [((330, 348), 'tkinter.Toplevel', 'tkinter.Toplevel', ([], {}), '()\n', (346, 348), False, 'import tkinter\n'), ((389, 500), 'tkinter.Label', 'tkinter.Label', ([], {'master': 'self._dialog_window', 'text': '"""How many Disks per Tower do you want?"""', 'font': 'DEFAULT_FONT'}), "(master=self._dialog_window, text=\n ... |
import os
import pickle
from Utils import DirectoryUtils, IOUtils, LoggingUtils
# Write to the disk the structure such that will be
# persistent.
from Utils.FilesUtils import readConfigFile
def writePersistentStructure(filename, structure):
try:
writeSerializer = open(filename, "wb")
pickle.dum... | [
"Utils.FilesUtils.readConfigFile",
"pickle.dump",
"pickle.dumps",
"Utils.DirectoryUtils.readDirectoryMetadataObj",
"os.path.join",
"pickle.load",
"os.path.dirname",
"pickle.loads"
] | [((695, 726), 'os.path.join', 'os.path.join', (['dirname', 'filename'], {}), '(dirname, filename)\n', (707, 726), False, 'import os\n'), ((1025, 1041), 'Utils.FilesUtils.readConfigFile', 'readConfigFile', ([], {}), '()\n', (1039, 1041), False, 'from Utils.FilesUtils import readConfigFile\n'), ((1201, 1250), 'Utils.Dire... |
import matplotlib.pyplot as plt
import numpy as np
from flatland.core.grid.grid4_utils import get_new_position
from flatland.envs.agent_utils import TrainState
from flatland.utils.rendertools import RenderTool, AgentRenderVariant
from utils.fast_methods import fast_count_nonzero, fast_argmax
class AgentCanChooseHelp... | [
"matplotlib.pyplot.imshow",
"numpy.size",
"utils.fast_methods.fast_count_nonzero",
"numpy.zeros",
"flatland.utils.rendertools.RenderTool",
"utils.fast_methods.fast_argmax",
"matplotlib.pyplot.pause",
"numpy.full",
"numpy.pad",
"flatland.core.grid.grid4_utils.get_new_position",
"matplotlib.pyplot... | [((1145, 1191), 'numpy.full', 'np.full', (['(self.env.height, self.env.width)', '(-1)'], {}), '((self.env.height, self.env.width), -1)\n', (1152, 1191), True, 'import numpy as np\n'), ((11908, 11982), 'numpy.pad', 'np.pad', (['binary_image', '((1, 0), (1, 0))', '"""constant"""'], {'constant_values': '(0, 0)'}), "(binar... |
#!/usr/bin/env python3
import tuxedo as t
if __name__ == '__main__':
buf = {'TA_CLASS': ['T_SVCGRP'], 'TA_OPERATION': ['GET']}
assert t.tpimport(t.tpexport(buf)) == buf
assert t.tpimport(t.tpexport(buf, t.TPEX_STRING), t.TPEX_STRING) == buf
assert t.Fname32(t.Fldid32('TA_OPERATION')) == 'TA_OPERATIO... | [
"tuxedo.Fmkfldid32",
"tuxedo.Fldid32",
"tuxedo.Fboolev32",
"tuxedo.Fextread32",
"tuxedo.tpexport",
"tuxedo.Ffprint32"
] | [((631, 668), 'tuxedo.tpexport', 't.tpexport', (["{'TA_OPERATION': binstr2}"], {}), "({'TA_OPERATION': binstr2})\n", (641, 668), True, 'import tuxedo as t\n'), ((1197, 1268), 'tuxedo.Fboolev32', 't.Fboolev32', (["{'TA_OPERATION': '123456789'}", '"""TA_OPERATION==\'123456789\'"""'], {}), '({\'TA_OPERATION\': \'123456789... |
"""
Copyright 2012-2019 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... | [
"re.compile",
"json.dumps",
"hqlib.utils.html_escape",
"functools.lru_cache",
"logging.info",
"typing.cast"
] | [((6688, 6721), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': '(1024)'}), '(maxsize=1024)\n', (6707, 6721), False, 'import functools\n'), ((7059, 7092), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': '(1024)'}), '(maxsize=1024)\n', (7078, 7092), False, 'import functools\n'), ((9053, 909... |
from __future__ import absolute_import
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from . import views
urlpatterns = [
url(r'^swagger.json/$',views.swagger_json_api),
url(r'^swagger/$', login_required(views.swagger)),
url(r'charts/$', login_required(views.Char... | [
"django.conf.urls.url",
"django.contrib.auth.decorators.login_required"
] | [((173, 219), 'django.conf.urls.url', 'url', (['"""^swagger.json/$"""', 'views.swagger_json_api'], {}), "('^swagger.json/$', views.swagger_json_api)\n", (176, 219), False, 'from django.conf.urls import url\n'), ((243, 272), 'django.contrib.auth.decorators.login_required', 'login_required', (['views.swagger'], {}), '(vi... |
import logging
import numpy as np
from gunpowder.nodes.batch_filter import BatchFilter
logger = logging.getLogger(__name__)
class TanhSaturate(BatchFilter):
'''Saturate the values of an array to be floats between -1 and 1 by applying the tanh function.
Args:
array (:class:`ArrayKey`):
... | [
"logging.getLogger",
"numpy.tanh"
] | [((98, 125), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (115, 125), False, 'import logging\n'), ((852, 884), 'numpy.tanh', 'np.tanh', (['(array.data / self.scale)'], {}), '(array.data / self.scale)\n', (859, 884), True, 'import numpy as np\n')] |
import requests, json, time, random, datetime, threading, pickle
from termcolor import colored
sitekey = "<KEY>"
def log(event):
d = datetime.datetime.now().strftime("%H:%M:%S")
print("Raffle OFF-S by Azerpas :: " + str(d) + " :: " + event)
class Raffle(object):
def __init__(self):
self.s = requests.session(... | [
"requests.session",
"random.choice",
"pickle.dump",
"json.loads",
"random.uniform",
"termcolor.colored",
"pickle.load",
"time.sleep",
"datetime.datetime.now"
] | [((303, 321), 'requests.session', 'requests.session', ([], {}), '()\n', (319, 321), False, 'import requests, json, time, random, datetime, threading, pickle\n'), ((137, 160), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (158, 160), False, 'import requests, json, time, random, datetime, threading,... |
"""
Core functionality for feature computation
<NAME>
Copyright (c) 2021. Pfizer Inc. All rights reserved.
"""
from abc import ABC, abstractmethod
from collections.abc import Iterator, Sequence
import json
from warnings import warn
from pandas import DataFrame
from numpy import float_, asarray, zeros, sum, moveaxis
... | [
"numpy.asarray",
"numpy.moveaxis",
"numpy.sum",
"json.load",
"warnings.warn",
"json.dump"
] | [((8060, 8077), 'json.dump', 'json.dump', (['out', 'f'], {}), '(out, f)\n', (8069, 8077), False, 'import json\n'), ((8482, 8494), 'json.load', 'json.load', (['f'], {}), '(f)\n', (8491, 8494), False, 'import json\n'), ((11254, 11275), 'numpy.moveaxis', 'moveaxis', (['x', 'axis', '(-1)'], {}), '(x, axis, -1)\n', (11262, ... |
# Copyright 2017 AT&T Intellectual Property. All other 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... | [
"unittest.mock.patch",
"pytest.raises",
"shipyard_airflow.control.action.actions_validations_id_api.ActionsValidationsResource",
"unittest.mock.patch.object"
] | [((1777, 1869), 'unittest.mock.patch.object', 'patch.object', (['ActionsValidationsResource', '"""get_action_validation"""', 'common.str_responder'], {}), "(ActionsValidationsResource, 'get_action_validation', common.\n str_responder)\n", (1789, 1869), False, 'from unittest.mock import patch\n'), ((3294, 3368), 'uni... |
import random
from grid import Grid
from grid import Cell
class Prim():
def grid_to_list(self, grid):
"""
Place all cells from grid matrix into a list
:param grid: a Grid object
:return: a list of all cells contained in the grid
"""
list = []
for r in range(g... | [
"random.choice"
] | [((819, 838), 'random.choice', 'random.choice', (['path'], {}), '(path)\n', (832, 838), False, 'import random\n'), ((953, 977), 'random.choice', 'random.choice', (['neighbors'], {}), '(neighbors)\n', (966, 977), False, 'import random\n')] |
# This file implements file system operations at the level of inodes.
import time
import secfs.crypto
import secfs.tables
import secfs.access
import secfs.store.tree
import secfs.store.block
from secfs.store.inode import Inode
from secfs.store.tree import Directory
from cryptography.fernet import Fernet
from secfs.typ... | [
"secfs.types.I",
"pickle.dumps",
"secfs.store.tree.Directory",
"secfs.store.inode.Inode.load",
"secfs.store.inode.Inode",
"time.time"
] | [((922, 939), 'secfs.store.inode.Inode.load', 'Inode.load', (['ihash'], {}), '(ihash)\n', (932, 939), False, 'from secfs.store.inode import Inode\n'), ((1557, 1564), 'secfs.store.inode.Inode', 'Inode', ([], {}), '()\n', (1562, 1564), False, 'from secfs.store.inode import Inode\n'), ((1619, 1630), 'time.time', 'time.tim... |
from __future__ import division
import io
import matplotlib as mpl
import matplotlib.pyplot as plt
import networkx as nx
import numpy
import os
import tensorflow as tf
def figure_to_buff(figure):
"""Converts the matplotlib plot specified by 'figure' to a PNG image and
returns it. The supplied figure is closed a... | [
"networkx.draw_networkx_edges",
"matplotlib.pyplot.savefig",
"networkx.draw_networkx_edge_labels",
"networkx.get_edge_attributes",
"networkx.DiGraph",
"io.BytesIO",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.close",
"networkx.draw_networkx_nodes",
"matplotlib.pyplot.figure",
"networkx.draw_netw... | [((406, 418), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (416, 418), False, 'import io\n'), ((423, 453), 'matplotlib.pyplot.savefig', 'plt.savefig', (['buf'], {'format': '"""png"""'}), "(buf, format='png')\n", (434, 453), True, 'import matplotlib.pyplot as plt\n'), ((552, 569), 'matplotlib.pyplot.close', 'plt.close'... |
from .GlobalData import global_data
from .utils.oc import oc
import requests
import time
import logging
class App:
def __init__(self, deployment, project, template, build_config,route=""):
self.project = project
self.template = template
self.deployment = deployment
self.build_conf... | [
"logging.getLogger",
"requests.get",
"time.sleep"
] | [((4449, 4463), 'time.sleep', 'time.sleep', (['(30)'], {}), '(30)\n', (4459, 4463), False, 'import time\n'), ((387, 419), 'logging.getLogger', 'logging.getLogger', (['"""reliability"""'], {}), "('reliability')\n", (404, 419), False, 'import logging\n'), ((2358, 2390), 'logging.getLogger', 'logging.getLogger', (['"""rel... |
#!/usr/bin/env python
from __future__ import unicode_literals
import os
import sys
import tarfile
import shutil
import tempfile
from contextlib import contextmanager
from pymatgen.io.gaussian import GaussianInput, GaussianOutput
from tinydb import TinyDB
@contextmanager
def cd(run_path, cleanup=lambda: True):
... | [
"tarfile.open",
"pymatgen.io.gaussian.GaussianInput.from_dict",
"os.path.join",
"os.getcwd",
"os.path.isfile",
"os.chdir",
"pymatgen.io.gaussian.GaussianOutput",
"tempfile.mkdtemp",
"shutil.copy",
"shutil.rmtree",
"os.path.expanduser"
] | [((413, 424), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (422, 424), False, 'import os\n'), ((676, 694), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (692, 694), False, 'import tempfile\n'), ((3652, 3697), 'os.path.join', 'os.path.join', (['""".."""', '"""data"""', '"""structures.json"""'], {}), "('..', '... |
import appdaemon.plugins.hass.hassapi as hass
import datetime
import globals
#
# App which turns on the light based on the room the user is currently in
#
#
# Args:
# room_sensor: the sensor which shows the room the user is in. example: sensor.mqtt_room_user_one
# entity: The entity which gets turned on by alexa/snips.... | [
"globals.get_arg"
] | [((745, 786), 'globals.get_arg', 'globals.get_arg', (['self.args', '"""room_sensor"""'], {}), "(self.args, 'room_sensor')\n", (760, 786), False, 'import globals\n'), ((808, 844), 'globals.get_arg', 'globals.get_arg', (['self.args', '"""entity"""'], {}), "(self.args, 'entity')\n", (823, 844), False, 'import globals\n')] |
#!/usr/bin/env python
'''
Calculating the emissions from deposits in Platypus stable accounts
'''
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator, EngFormatter, PercentFormatter
from strategy_const import *
from const import *
def boosted_pool_... | [
"numpy.sqrt",
"matplotlib.ticker.PercentFormatter",
"matplotlib.ticker.LinearLocator",
"matplotlib.ticker.EngFormatter",
"numpy.meshgrid",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((504, 545), 'numpy.sqrt', 'np.sqrt', (['(your_stable_deposit * vePTP_held)'], {}), '(your_stable_deposit * vePTP_held)\n', (511, 545), True, 'import numpy as np\n'), ((2317, 2379), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'subplot_kw': "{'projection': '3d'}", 'figsize': '(18, 9)'}), "(subplot_kw={'projecti... |
from types import FunctionType
import numpy as np
import pandas as pd
from functools import partial
from multiprocessing import Pool, cpu_count
def get_levenshtein_distance(str1: str, str2: str) -> float:
"""
Computes the Levenshtein distance between two strings
:param str1: first string
:param str... | [
"multiprocessing.cpu_count",
"numpy.array_split",
"numpy.zeros",
"functools.partial",
"multiprocessing.Pool"
] | [((462, 488), 'numpy.zeros', 'np.zeros', (['(size_x, size_y)'], {}), '((size_x, size_y))\n', (470, 488), True, 'import numpy as np\n'), ((2007, 2034), 'numpy.array_split', 'np.array_split', (['df', 'n_cores'], {}), '(df, n_cores)\n', (2021, 2034), True, 'import numpy as np\n'), ((2090, 2103), 'multiprocessing.Pool', 'P... |
import requests_cache
import os.path
import tempfile
try:
from requests_cache import remove_expired_responses
except ModuleNotFoundError:
from requests_cache.core import remove_expired_responses
def caching(
cache=False,
name=None,
backend="sqlite",
expire_after=86400,
allowable_codes=(200... | [
"requests_cache.uninstall_cache",
"requests_cache.install_cache",
"tempfile.gettempdir",
"requests_cache.core.remove_expired_responses"
] | [((2867, 2899), 'requests_cache.uninstall_cache', 'requests_cache.uninstall_cache', ([], {}), '()\n', (2897, 2899), False, 'import requests_cache\n'), ((3121, 3220), 'requests_cache.install_cache', 'requests_cache.install_cache', ([], {'cache_name': 'CACHE_NAME', 'backend': 'backend', 'expire_after': 'expire_after'}), ... |
import os, sys
exp_id=[
"exp1.0",
]
env_source=[
"file",
]
exp_mode = [
"continuous",
#"newb",
#"base",
]
num_theories_init=[
4,
]
pred_nets_neurons=[
8,
]
pred_nets_activation=[
"linear",
# "leakyRelu",
]
domain_net_neurons=[
8,
]
domain_pred_mode=[
"onehot",
]
mse_amp=[
1e-7,
]
simplify_criteria=[
'\("DLs",... | [
"os.path.realpath",
"os.path.dirname",
"shutil.copyfile",
"os.path.isfile",
"os.system"
] | [((2847, 2866), 'os.system', 'os.system', (['exec_str'], {}), '(exec_str)\n', (2856, 2866), False, 'import os\n'), ((2192, 2218), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (2208, 2218), False, 'import os\n'), ((2757, 2786), 'os.path.isfile', 'os.path.isfile', (['(filename + fc)'], {}),... |
import os
import errno
import stat
import logging
from io import BytesIO
from time import time, mktime, strptime
from fuse import FuseOSError, Operations, LoggingMixIn
logger = logging.getLogger('dochub_fs')
def wrap_errno(func):
"""
@brief Transform Exceptions happening inside func into meaningful
... | [
"logging.getLogger",
"time.strptime",
"os.getuid",
"time.mktime",
"io.BytesIO",
"fuse.FuseOSError",
"os.path.split",
"os.getgid",
"time.time"
] | [((180, 210), 'logging.getLogger', 'logging.getLogger', (['"""dochub_fs"""'], {}), "('dochub_fs')\n", (197, 210), False, 'import logging\n'), ((4455, 4474), 'os.path.split', 'os.path.split', (['path'], {}), '(path)\n', (4468, 4474), False, 'import os\n'), ((3558, 3567), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (3565,... |
# Generated by Django 2.1.4 on 2019-01-10 04:07
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('algolab_class_API', '0010_submithistory'),
]
operations = [
migrations.Rem... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((306, 372), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""boardquestion"""', 'name': '"""context"""'}), "(model_name='boardquestion', name='context')\n", (328, 372), False, 'from django.db import migrations, models\n'), ((417, 488), 'django.db.migrations.RemoveField', 'migratio... |
""" Python wrapper for the Spider API """
from __future__ import annotations
import json
import logging
import time
from datetime import datetime, timedelta
from typing import Any, Dict, ValuesView
from urllib.parse import unquote
import requests
from spiderpy.devices.powerplug import SpiderPowerPlug
from spiderpy.d... | [
"logging.getLogger",
"spiderpy.devices.thermostat.SpiderThermostat",
"json.dumps",
"requests.request",
"datetime.datetime.now",
"datetime.datetime.today",
"datetime.timedelta",
"time.time",
"urllib.parse.unquote",
"spiderpy.devices.powerplug.SpiderPowerPlug"
] | [((722, 749), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (739, 749), False, 'import logging\n'), ((9948, 9978), 'urllib.parse.unquote', 'unquote', (["data['refresh_token']"], {}), "(data['refresh_token'])\n", (9955, 9978), False, 'from urllib.parse import unquote\n'), ((10578, 10651),... |
import torch
import torch.nn as nn
from torch3d.nn import SetAbstraction
class PointNetSSG(nn.Module):
"""
PointNet++ single-scale grouping architecture from the `"PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space" <https://arxiv.org/abs/1706.02413>`_ paper.
Args:
in_... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.BatchNorm1d",
"torch3d.nn.SetAbstraction",
"torch.nn.Linear"
] | [((661, 729), 'torch3d.nn.SetAbstraction', 'SetAbstraction', (['in_channels', '[64, 64, 128]', '(512)', '(32)', '(0.2)'], {'bias': '(False)'}), '(in_channels, [64, 64, 128], 512, 32, 0.2, bias=False)\n', (675, 729), False, 'from torch3d.nn import SetAbstraction\n'), ((749, 815), 'torch3d.nn.SetAbstraction', 'SetAbstrac... |
import boto3
import datetime
import requests
import pytest
from unittest.mock import patch
from reports.reporting import release_summary
from collections import Counter
from functools import partial
ENTITIES = [
'participants',
'biospecimens',
'phenotypes',
'genomic-files',
'study-files',
'rea... | [
"reports.reporting.release_summary.run",
"reports.reporting.release_summary.publish",
"reports.reporting.release_summary.get_studies",
"boto3.client",
"reports.reporting.release_summary.count_study",
"reports.reporting.release_summary.count_entity",
"pytest.mark.parametrize",
"boto3.resource",
"repo... | [((998, 1041), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""entity"""', 'ENTITIES'], {}), "('entity', ENTITIES)\n", (1021, 1041), False, 'import pytest\n'), ((521, 547), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {}), "('dynamodb')\n", (535, 547), False, 'import boto3\n'), ((557, 581), 'bot... |
import os
import signal
import atexit
import json
import time
from pathlib import Path
import subprocess
import argparse
import pprint
from distutils.util import strtobool
children_pid = []
@atexit.register
def kill_child():
for child_pid in children_pid:
os.kill(child_pid, signal.SIGTERM)
cmd_parser = ... | [
"os.kill",
"distutils.util.strtobool",
"argparse.ArgumentParser",
"pathlib.Path",
"subprocess.Popen",
"pathlib.Path.home",
"time.sleep",
"os.chdir",
"subprocess.call",
"json.load",
"pprint.pprint",
"json.dump"
] | [((320, 359), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (343, 359), False, 'import argparse\n'), ((534, 545), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (543, 545), False, 'from pathlib import Path\n'), ((548, 565), 'pathlib.Path', 'Path', (['"""... |
# -*- coding: utf-8 -*-
import os
import datetime
import logging
import requests
import numpy
import cv2
import zbar
from Queue import Queue
from threading import Thread
from PIL import Image
logger = logging.getLogger(__name__)
TEMP_DIR = os.path.join(os.getcwd(), 'temp')
def get_temp_dir():
"""Create TEMP_DIR ... | [
"logging.getLogger",
"requests.post",
"numpy.array",
"zbar.Image",
"datetime.timedelta",
"os.remove",
"os.path.exists",
"cv2.threshold",
"cv2.line",
"cv2.contourArea",
"os.mkdir",
"cv2.cvtColor",
"PIL.Image.fromarray",
"os.path.join",
"os.getcwd",
"zbar.ImageScanner",
"datetime.datet... | [((202, 229), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (219, 229), False, 'import logging\n'), ((254, 265), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (263, 265), False, 'import os\n'), ((865, 893), 'os.path.join', 'os.path.join', (['path', 'filename'], {}), '(path, filename)\n', (... |
from threading import *
from tkinter import *
from tkinter.filedialog import askopenfilename
import tkinter, tkinter.scrolledtext
import os
import sys
import urllib.request
import glob
import time
import hashlib
import quarantaene
from vta import vtapi
import argparse
os_name = sys.platform
terminations = []
if "win"... | [
"os.path.exists",
"quarantaene.encode_base64",
"argparse.ArgumentParser",
"hashlib.md5",
"os.makedirs",
"vta.vtapi",
"tkinter.Button",
"os.getcwd",
"quarantaene.decode_base64",
"tkinter.scrolledtext.ScrolledText",
"tkinter.Tk",
"glob.glob",
"sys.exit",
"time.time",
"tkinter.Listbox",
"... | [((1415, 1443), 'glob.glob', 'glob.glob', (['quarantine_folder'], {}), '(quarantine_folder)\n', (1424, 1443), False, 'import glob\n'), ((4976, 4993), 'tkinter.filedialog.askopenfilename', 'askopenfilename', ([], {}), '()\n', (4991, 4993), False, 'from tkinter.filedialog import askopenfilename\n'), ((4998, 5049), 'quara... |
import tensorflow as tf
import numpy as np
import os
import time
from utils import random_batch, normalize, similarity, loss_cal, optim
from configuration import get_config
from tensorflow.contrib import rnn
config = get_config()
def train(path):
tf.reset_default_graph() # reset graph
# dra... | [
"utils.random_batch",
"numpy.array",
"tensorflow.contrib.rnn.LSTMCell",
"tensorflow.clip_by_global_norm",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.nn.dynamic_rnn",
"tensorflow.concat",
"utils.similarity",
"tensorflow.summary.scalar",
"tensorflow.trainable_variables",
"tensor... | [((226, 238), 'configuration.get_config', 'get_config', ([], {}), '()\n', (236, 238), False, 'from configuration import get_config\n'), ((266, 290), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (288, 290), True, 'import tensorflow as tf\n'), ((341, 412), 'tensorflow.placeholder', 'tf.pl... |