code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import argparse
import baselineUtils
import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import os
import time
from transformer.batch import subsequent_mask
from torch.optim import Adam,SGD,RMSprop,Adagrad
from transformer.noam_opt import NoamOpt
import numpy as np
import scipy.io... | [
"torch.utils.data.DataLoader",
"baselineUtils.create_dataset",
"torch.cuda.is_available",
"torch.utils.tensorboard.SummaryWriter",
"argparse.ArgumentParser",
"numpy.stack",
"os.mkdir",
"numpy.concatenate",
"baselineUtils.distance_metrics",
"torch.cat",
"torch.device",
"quantized_TF.QuantizedTF... | [((425, 502), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train the individual Transformer model"""'}), "(description='Train the individual Transformer model')\n", (448, 502), False, 'import argparse\n'), ((2344, 2381), 'torch.utils.tensorboard.SummaryWriter', 'SummaryWriter', (["('lo... |
#!/usr/bin/env python
# Globally average the variance of daily mean precipitation values from a given month spanning a given set of years,
# then take the square root. This is the correct order of operations to get the fraction of total variance, as shown
# by Covey and Gehne 2016 (https://e-reports-ext.llnl.gov/pdf/8... | [
"os.path.exists",
"collections.OrderedDict",
"os.makedirs",
"pcmdi_metrics.diurnal.common.P.add_argument",
"cdp.cdp_run.multiprocess",
"pcmdi_metrics.diurnal.common.populateStringConstructor",
"pcmdi_metrics.diurnal.common.P.get_parameter",
"os.path.join",
"cdutil.region.domain",
"os.getcwd",
"j... | [((2743, 2921), 'pcmdi_metrics.diurnal.common.P.add_argument', 'P.add_argument', (['"""-j"""', '"""--outnamejson"""'], {'type': 'str', 'dest': '"""outnamejson"""', 'default': '"""pr_%(month)_%(firstyear)_%(lastyear)_std_of_dailymeans.json"""', 'help': '"""Output name for jsons"""'}), "('-j', '--outnamejson', type=str, ... |
# Copyright 2019 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | [
"ros2param.api.get_value",
"yaml.dump",
"ros2cli.node.strategy.add_arguments",
"ros2node.api.parse_node_name",
"ros2cli.node.strategy.NodeStrategy",
"os.path.join",
"rclpy.spin_until_future_complete",
"ros2node.api.get_absolute_node_name",
"ros2param.api.call_get_parameters",
"ros2node.api.get_nod... | [((1324, 1345), 'ros2cli.node.strategy.add_arguments', 'add_arguments', (['parser'], {}), '(parser)\n', (1337, 1345), False, 'from ros2cli.node.strategy import add_arguments\n'), ((1459, 1525), 'ros2node.api.NodeNameCompleter', 'NodeNameCompleter', ([], {'include_hidden_nodes_key': '"""include_hidden_nodes"""'}), "(inc... |
from core.advbase import *
from slot.a import *
from slot.d import *
def module():
return Linnea
class FS_Linnea(Action):
def __init__(self, name, conf, act=None):
Action.__init__(self, name, conf, act)
self.atype = 'fs'
self.interrupt_by = ['s']
self.cancel_by = ['s','dodge']
... | [
"core.simulate.test_with_argv"
] | [((4301, 4332), 'core.simulate.test_with_argv', 'test_with_argv', (['None', '*sys.argv'], {}), '(None, *sys.argv)\n', (4315, 4332), False, 'from core.simulate import test_with_argv\n')] |
#!/usr/bin/env python
# coding: utf-8
import requests
import re
import time
import json
from bs4 import BeautifulSoup
onestop_data = {'username': 'Your user name', # 填入用户名
'password': '<PASSWORD>', # 填入密码
'remember': 'checked'}
# ------------------- login onestop ---------------------... | [
"json.loads",
"requests.Session",
"re.compile",
"time.sleep",
"bs4.BeautifulSoup"
] | [((450, 468), 'requests.Session', 'requests.Session', ([], {}), '()\n', (466, 468), False, 'import requests\n'), ((584, 614), 'json.loads', 'json.loads', (['Onestop_Login.text'], {}), '(Onestop_Login.text)\n', (594, 614), False, 'import json\n'), ((855, 873), 'requests.Session', 'requests.Session', ([], {}), '()\n', (8... |
import pybullet as p
from gym import spaces
from diy_gym.addons.addon import Addon
class ExternalForce(Addon):
"""ExternalForce defines a addon that can be used to apply an external force to the base a model.
"""
def __init__(self, parent, config):
super(ExternalForce, self).__init__(parent, confi... | [
"pybullet.applyExternalForce",
"gym.spaces.Box"
] | [((654, 706), 'gym.spaces.Box', 'spaces.Box', (['(-10.0)', '(10.0)'], {'shape': '(3,)', 'dtype': '"""float32"""'}), "(-10.0, 10.0, shape=(3,), dtype='float32')\n", (664, 706), False, 'from gym import spaces\n'), ((837, 904), 'pybullet.applyExternalForce', 'p.applyExternalForce', (['self.uid', '(-1)', 'action', 'self.xy... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from multiprocessing import Pool, Process, Queue, Pipe # Queue 线程安全
# from multiprocessing.dummy import Pool, Process, Queue, Pipe # thread
from time import sleep
import threading
def f(x):
# print(threading.currentThread().getName(), threading.currentThread().ide... | [
"multiprocessing.Process",
"time.sleep",
"multiprocessing.Pool",
"multiprocessing.Queue",
"multiprocessing.Pipe"
] | [((328, 338), 'time.sleep', 'sleep', (['(0.1)'], {}), '(0.1)\n', (333, 338), False, 'from time import sleep\n'), ((517, 524), 'multiprocessing.Queue', 'Queue', ([], {}), '()\n', (522, 524), False, 'from multiprocessing import Pool, Process, Queue, Pipe\n'), ((533, 562), 'multiprocessing.Process', 'Process', ([], {'targ... |
"""A module implementing a pseudo-dict class which is bound to a JSON file.
As you change the contents of the dict, the JSON file will be updated in
real-time. Magic.
"""
import collections.abc as collections
import os
import json
import warnings
warnings.filterwarnings("once", category=DeprecationWarning)
# MISC... | [
"os.path.exists",
"os.path.getsize",
"json.loads",
"json.load",
"os.path.dirname",
"warnings.warn",
"warnings.filterwarnings",
"json.dump",
"os.remove"
] | [((251, 311), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""once"""'], {'category': 'DeprecationWarning'}), "('once', category=DeprecationWarning)\n", (274, 311), False, 'import warnings\n'), ((524, 544), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (538, 544), False, 'import os\n'), ((... |
## This file is adopted from DVE's github repo: https://github.com/jamt9000/DVE
import torch.nn.functional as F
import torch.nn as nn
import time
import torch
from PIL import Image
import numpy as np
from pointcloud_utils import pointcloud_vis
import pointnet3.sinkhorn_approximate as sinkFunc
def save_data_as_image(f... | [
"pointnet3.sinkhorn_approximate.gumbel_sinkhorn",
"PIL.Image.fromarray",
"torch.nn.functional.l1_loss",
"numpy.amin",
"numpy.random.choice",
"torch.mean",
"torch.eye",
"torch.nn.functional.normalize",
"numpy.sum",
"torch.sum",
"torch.matmul",
"torch.no_grad",
"numpy.amax",
"torch.nn.functi... | [((350, 363), 'numpy.amin', 'np.amin', (['data'], {}), '(data)\n', (357, 363), True, 'import numpy as np\n'), ((378, 391), 'numpy.amax', 'np.amax', (['data'], {}), '(data)\n', (385, 391), True, 'import numpy as np\n'), ((520, 545), 'PIL.Image.fromarray', 'Image.fromarray', (['img', '"""P"""'], {}), "(img, 'P')\n", (535... |
from octapp import create_app
# Create the Flask app
application = app = create_app()
if __name__ == "__main__":
print(("* Loading Keras model and Flask starting server..."
"please wait until server has fully started"))
app.run()
| [
"octapp.create_app"
] | [((74, 86), 'octapp.create_app', 'create_app', ([], {}), '()\n', (84, 86), False, 'from octapp import create_app\n')] |
import pytest
from yahooquery import Screener
def test_screener():
s = Screener()
assert s.get_screeners("most_actives") is not None
def test_available_screeners():
s = Screener()
assert s.available_screeners is not None
def test_bad_screener():
with pytest.raises(ValueError):
s = Scr... | [
"yahooquery.Screener",
"pytest.raises"
] | [((78, 88), 'yahooquery.Screener', 'Screener', ([], {}), '()\n', (86, 88), False, 'from yahooquery import Screener\n'), ((186, 196), 'yahooquery.Screener', 'Screener', ([], {}), '()\n', (194, 196), False, 'from yahooquery import Screener\n'), ((278, 303), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueE... |
from django.db import models
# Create your models here.
class Question(models.Model):
question_text= models.CharField(max_length=100)
pub_date = models.DateTimeField()
class Choice (models.Model):
question= models.ForeignKey (Question, on_delete= models.CASCADE)
choice_text= models.CharField(max_lengt... | [
"django.db.models.DateTimeField",
"django.db.models.IntegerField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((106, 138), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (122, 138), False, 'from django.db import models\n'), ((154, 176), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {}), '()\n', (174, 176), False, 'from django.db import models\n'), ((221,... |
from django.urls import path
from .views import HomeView, PostDetail, AddPost, UpdatePost, DeletePost, AddCategory, ListCategory, CategoryView, CategoryList, LikePost
urlpatterns = [
path('', HomeView.as_view(), name="home"),
path('blog_post/<int:pk>', PostDetail.as_view(), name="blog-detail" ),
path('add_... | [
"django.urls.path"
] | [((681, 739), 'django.urls.path', 'path', (['"""category/<str:cats>"""', 'CategoryView'], {'name': '"""category"""'}), "('category/<str:cats>', CategoryView, name='category')\n", (685, 739), False, 'from django.urls import path\n'), ((745, 803), 'django.urls.path', 'path', (['"""category-list/"""', 'CategoryList'], {'n... |
import os
import calendar
from flask import request, session
from flask_session import Session
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from datetime import datetime
from helpers import convertSQLToDict
# Create engine object to manage connections to DB, and scoped ... | [
"helpers.convertSQLToDict",
"datetime.datetime.now",
"sqlalchemy.orm.sessionmaker",
"os.getenv"
] | [((389, 414), 'os.getenv', 'os.getenv', (['"""DATABASE_URL"""'], {}), "('DATABASE_URL')\n", (398, 414), False, 'import os\n'), ((436, 461), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {'bind': 'engine'}), '(bind=engine)\n', (448, 461), False, 'from sqlalchemy.orm import scoped_session, sessionmaker\n'), ((3014,... |
import logging
import typing
try:
from importlib.metadata import entry_points
except ImportError:
from importlib_metadata import entry_points # type: ignore
from karp.domain import events
from karp.services import messagebus, unit_of_work, auth_service
from karp.application import config
from karp.infrastruc... | [
"logging.getLogger",
"logging.StreamHandler",
"karp.services.auth_service.AuthService.create",
"karp.services.unit_of_work.DefaultEntryUowFactory",
"logging.Formatter",
"importlib_metadata.entry_points",
"karp.domain.events.AppStarted",
"karp.infrastructure.sql.sql_unit_of_work.SqlResourceUnitOfWork",... | [((1303, 1508), 'karp.services.messagebus.MessageBus', 'messagebus.MessageBus', ([], {'resource_uow': 'resource_uow', 'entry_uows': 'entry_uows', 'auth_service': 'authservice', 'index_uow': 'index_uow', 'entry_uow_factory': 'entry_uow_factory', 'raise_on_all_errors': 'raise_on_all_errors'}), '(resource_uow=resource_uow... |
import os
os.system('mpg321 /home/pi/RPiserver/alarms/1.mp3')
print("Alarm01 played successfully")
# play sound
| [
"os.system"
] | [((10, 61), 'os.system', 'os.system', (['"""mpg321 /home/pi/RPiserver/alarms/1.mp3"""'], {}), "('mpg321 /home/pi/RPiserver/alarms/1.mp3')\n", (19, 61), False, 'import os\n')] |
from collections import OrderedDict
from fcgiproto.constants import FCGI_KEEP_CONN
class RequestEvent(object):
"""
Base class for events that target a specific request.
:ivar int request_id: identifier of the associated request
"""
__slots__ = ('request_id',)
def __init__(self, request_id)... | [
"collections.OrderedDict"
] | [((999, 1018), 'collections.OrderedDict', 'OrderedDict', (['params'], {}), '(params)\n', (1010, 1018), False, 'from collections import OrderedDict\n')] |
import collections
import audio as vr
class VadBase(object):
def clone(self):
raise Exception("clone not implemented")
def init(self, frames_read, path):
pass
def get_audio_settings(self):
raise Exception("get_audio_settings not implemented")
def is_speech(self, frames):
... | [
"audio.AudioData",
"collections.deque",
"audio.AudioData.load_as_wav"
] | [((846, 874), 'collections.deque', 'collections.deque', ([], {'maxlen': '(50)'}), '(maxlen=50)\n', (863, 874), False, 'import collections\n'), ((899, 927), 'collections.deque', 'collections.deque', ([], {'maxlen': '(50)'}), '(maxlen=50)\n', (916, 927), False, 'import collections\n'), ((615, 655), 'audio.AudioData.load_... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Frappe Technologies and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
import json
class test(Document):
def db_insert(self):
d = self.get_valid_dict(convert_dates_to_str=True)
with open("da... | [
"json.load",
"json.dump"
] | [((358, 381), 'json.dump', 'json.dump', (['d', 'read_file'], {}), '(d, read_file)\n', (367, 381), False, 'import json\n'), ((464, 484), 'json.load', 'json.load', (['read_file'], {}), '(read_file)\n', (473, 484), False, 'import json\n'), ((651, 674), 'json.dump', 'json.dump', (['d', 'read_file'], {}), '(d, read_file)\n'... |
"""Tests for config.py."""
from pytype import config
from pytype import datatypes
import unittest
class ConfigTest(unittest.TestCase):
def test_basic(self):
argv = [
"-V", "3.6",
"--use-pickled-files",
"-o", "out.pyi",
"--pythonpath", "foo:bar",
"test.py"
]
opt... | [
"unittest.main",
"pytype.datatypes.SimpleNamespace",
"pytype.config.Postprocessor",
"pytype.config.Options"
] | [((6678, 6693), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6691, 6693), False, 'import unittest\n'), ((324, 344), 'pytype.config.Options', 'config.Options', (['argv'], {}), '(argv)\n', (338, 344), False, 'from pytype import config\n'), ((677, 697), 'pytype.config.Options', 'config.Options', (['argv'], {}), '(... |
import spacy
nlp = spacy.load('en')
doc = nlp(u'President Trump has a dispute with Mexico over immigration. IBM and Apple are cooperating on marketing in 2014. Pepsi and Coke sell well to Asian and South American customers. He bought a Ford Escort for $20,000 and drove to the lake for the weekend. The parade was last S... | [
"spacy.load"
] | [((19, 35), 'spacy.load', 'spacy.load', (['"""en"""'], {}), "('en')\n", (29, 35), False, 'import spacy\n')] |
#!/usr/bin/env python
############################################################################
#
# Copyright (C) 2004-2005 Trolltech AS. All rights reserved.
#
# This file is part of the example classes of the Qt Toolkit.
#
# This file may be used under the terms of the GNU General Public
# License version 2.0... | [
"PySide.QtGui.QCursor.pos",
"PySide.QtGui.QSizePolicy",
"PySide.QtGui.QFileDialog.getOpenFileName",
"PySide.QtGui.QFrame",
"PySide.QtGui.QMessageBox.warning",
"PySide.QtCore.QPoint",
"PySide.QtCore.QByteArray",
"PySide.QtGui.QListView",
"PySide.QtGui.QMessageBox.information",
"PySide.QtCore.QMimeD... | [((1186, 1201), 'PySide.QtCore.Signal', 'QtCore.Signal', ([], {}), '()\n', (1199, 1201), False, 'from PySide import QtCore, QtGui\n'), ((12996, 13024), 'PySide.QtGui.QApplication', 'QtGui.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (13014, 13024), False, 'from PySide import QtCore, QtGui\n'), ((1416, 1430), 'PyS... |
# Copyright (c) 2012, <NAME>
# This file is distributed under the BSD Licence.
# See python-epub-builder-license.txt for details.
from __future__ import unicode_literals
import epub
from genshi.template import TemplateLoader
class Section:
def __init__(self):
self.title = ''
self.subsections = []... | [
"genshi.template.TemplateLoader",
"epub.EpubBook"
] | [((500, 515), 'epub.EpubBook', 'epub.EpubBook', ([], {}), '()\n', (513, 515), False, 'import epub\n'), ((675, 703), 'genshi.template.TemplateLoader', 'TemplateLoader', (['template_dir'], {}), '(template_dir)\n', (689, 703), False, 'from genshi.template import TemplateLoader\n')] |
import sys
from flask import Flask, jsonify, request
from flask_cors import CORS
from Flask.hardwareMonitor import HardwareMonitor
app = Flask(__name__)
app_config = {"host": "localhost", "port": sys.argv[1]}
"""
---------------------- DEVELOPER MODE CONFIG -----------------------
"""
# Developer mode uses app.py
if "... | [
"flask.jsonify",
"flask.request.environ.get",
"Flask.hardwareMonitor.HardwareMonitor",
"flask.Flask"
] | [((137, 152), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (142, 152), False, 'from flask import Flask, jsonify, request\n'), ((695, 712), 'Flask.hardwareMonitor.HardwareMonitor', 'HardwareMonitor', ([], {}), '()\n', (710, 712), False, 'from Flask.hardwareMonitor import HardwareMonitor\n'), ((652, 675), ... |
import numpy as np
import unittest
from chainer import testing
from chainercv.experimental.links.model.pspnet import convolution_crop
class TestConvolutionCrop(unittest.TestCase):
def test_convolution_crop(self):
size = (8, 6)
stride = (8, 6)
n_channel = 3
img = np.random.uniform... | [
"chainercv.experimental.links.model.pspnet.convolution_crop",
"chainer.testing.run_module",
"numpy.random.uniform"
] | [((1282, 1320), 'chainer.testing.run_module', 'testing.run_module', (['__name__', '__file__'], {}), '(__name__, __file__)\n', (1300, 1320), False, 'from chainer import testing\n'), ((393, 447), 'chainercv.experimental.links.model.pspnet.convolution_crop', 'convolution_crop', (['img', 'size', 'stride'], {'return_param':... |
import os
import re
from error.cpu_err import cpu_err
from managers.devicemanager import DeviceManager
class LinuxHardwareManager:
"""
Instance, implementing `DeviceManager`, for extracting system information
from Linux using the `sysfs` pseudo file system.
https://www.kernel.org/doc/html/latest/admi... | [
"error.cpu_err.cpu_err",
"os.listdir",
"re.search"
] | [((963, 1012), 're.search', 're.search', (['"""(?<=model name\\\\t\\\\: ).+(?=\\\\n)"""', 'cpu'], {}), "('(?<=model name\\\\t\\\\: ).+(?=\\\\n)', cpu)\n", (972, 1012), False, 'import re\n'), ((1029, 1076), 're.search', 're.search', (['"""(?<=flags\\\\t\\\\t\\\\: ).+(?=\\\\n)"""', 'cpu'], {}), "('(?<=flags\\\\t\\\\t\\\\... |
import json
import subprocess
import time
import unittest
from web3 import Web3, IPCProvider
from app import get_ipc
from app.utils.ethereum_utils import EthereumUtils
from app.utils.exceptions import StateError
class TestEthereumUtils(unittest.TestCase):
account = '<KEY>'
password = 'password'
@classm... | [
"app.get_ipc",
"subprocess.Popen",
"time.sleep",
"app.utils.ethereum_utils.EthereumUtils"
] | [((370, 610), 'subprocess.Popen', 'subprocess.Popen', (["['geth', '--datadir', './ethereum_private/data/', '--ethash.dagdir',\n './ethereum_private/data/ethash', '--networkid', '1042',\n '--targetgaslimit', '4000000']"], {'stdout': 'subprocess.DEVNULL', 'stderr': 'subprocess.DEVNULL'}), "(['geth', '--datadir', '.... |
import pygame
pygame.init()
screen = pygame.display.set_mode((300, 300))
pygame.display.set_caption("First Pygame Program")
BLUE = (0, 0, 255)
screen.fill(BLUE)
pygame.display.update()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False... | [
"pygame.init",
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.display.set_caption",
"pygame.display.update"
] | [((15, 28), 'pygame.init', 'pygame.init', ([], {}), '()\n', (26, 28), False, 'import pygame\n'), ((38, 73), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(300, 300)'], {}), '((300, 300))\n', (61, 73), False, 'import pygame\n'), ((74, 124), 'pygame.display.set_caption', 'pygame.display.set_caption', (['"""Fir... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
from .utils import _gather_feat, _transpose_and_gather_feat
def _nms(heat, kernel=3):
pad = (kernel - 1) // 2
hmax = nn.functional.max_pool2d(
heat, (kernel,... | [
"torch.max",
"torch.sigmoid",
"torch.nn.functional.max_pool2d",
"torch.sum",
"torch.zeros_like",
"torch.zeros",
"torch.cat"
] | [((272, 343), 'torch.nn.functional.max_pool2d', 'nn.functional.max_pool2d', (['heat', '(kernel, kernel)'], {'stride': '(1)', 'padding': 'pad'}), '(heat, (kernel, kernel), stride=1, padding=pad)\n', (296, 343), True, 'import torch.nn as nn\n'), ((1408, 1428), 'torch.zeros_like', 'torch.zeros_like', (['xs'], {}), '(xs)\n... |
# -------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ----------------------------------------------------------------------... | [
"numpy.random.gamma",
"GPy.core.parameterization.priors.gammaln",
"numpy.log",
"psbutils.arrayshapes.Shapes"
] | [((1155, 1177), 'GPy.core.parameterization.priors.gammaln', 'priors.gammaln', (['self.a'], {}), '(self.a)\n', (1169, 1177), True, 'import GPy.core.parameterization.priors as priors\n'), ((1184, 1193), 'numpy.log', 'np.log', (['b'], {}), '(b)\n', (1190, 1193), True, 'import numpy as np\n'), ((1474, 1488), 'psbutils.arra... |
from django.contrib import admin
from .models import Translation
# Register your models here.
class TranslationAdmin(admin.ModelAdmin):
list_display = ('text', 'braille_translation')
admin.site.register(Translation, TranslationAdmin) | [
"django.contrib.admin.site.register"
] | [((189, 239), 'django.contrib.admin.site.register', 'admin.site.register', (['Translation', 'TranslationAdmin'], {}), '(Translation, TranslationAdmin)\n', (208, 239), False, 'from django.contrib import admin\n')] |
import numpy as np
from ..Delboeuf.delboeuf_parameters import _delboeuf_parameters_sizeinner, _delboeuf_parameters_sizeouter
def _ebbinghaus_parameters(illusion_strength=0, difference=0, size_min=0.25, distance=1, distance_auto=False):
# Size inner circles
parameters = _delboeuf_parameters_sizeinner(differe... | [
"numpy.max",
"numpy.linspace",
"numpy.cos",
"numpy.min",
"numpy.sin"
] | [((4327, 4369), 'numpy.linspace', 'np.linspace', (['(0)', '(360)'], {'num': 'n', 'endpoint': '(False)'}), '(0, 360, num=n, endpoint=False)\n', (4338, 4369), True, 'import numpy as np\n'), ((3354, 3397), 'numpy.min', 'np.min', (['[inner_size_left, inner_size_right]'], {}), '([inner_size_left, inner_size_right])\n', (336... |
import json
import os
from typing import List, Tuple
import pytest
@pytest.fixture(scope='module')
def here():
return os.path.abspath(os.path.dirname(__file__))
@pytest.fixture(scope='module')
def accounts(here) -> List[Tuple] or None:
"""Return account list"""
accounts_path = os.path.join(here, 'confi... | [
"os.path.exists",
"json.loads",
"os.path.join",
"os.path.dirname",
"pytest.fixture"
] | [((71, 101), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (85, 101), False, 'import pytest\n'), ((171, 201), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (185, 201), False, 'import pytest\n'), ((295, 323), 'os.path.join', 'os.pa... |
import datetime
from typing import TYPE_CHECKING, Generator
import Evtx.Evtx as evtx
from lxml import etree
from beagle.common.logging import logger
from beagle.datasources.base_datasource import DataSource
from beagle.transformers.evtx_transformer import WinEVTXTransformer
if TYPE_CHECKING:
from beagle.transfor... | [
"beagle.common.logging.logger.info",
"Evtx.Evtx.Evtx",
"datetime.datetime.strptime"
] | [((862, 917), 'beagle.common.logging.logger.info', 'logger.info', (['f"""Setting up WinEVTX for {self.file_path}"""'], {}), "(f'Setting up WinEVTX for {self.file_path}')\n", (873, 917), False, 'from beagle.common.logging import logger\n'), ((985, 1010), 'Evtx.Evtx.Evtx', 'evtx.Evtx', (['self.file_path'], {}), '(self.fi... |
# -*- coding: utf-8 -*-
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Deque
from pygerber.mathclasses import BoundingBox
from pygerber.renderer import Renderer
from pygerber.renderer.apertureset import ApertureSet
from pygerber.tokenizer import Tokenizer
from pygerber.token... | [
"pygerber.renderer.Renderer",
"pygerber.tokenizer.Tokenizer"
] | [((536, 564), 'pygerber.tokenizer.Tokenizer', 'Tokenizer', (['ignore_deprecated'], {}), '(ignore_deprecated)\n', (545, 564), False, 'from pygerber.tokenizer import Tokenizer\n'), ((589, 615), 'pygerber.renderer.Renderer', 'Renderer', (['self.apertureSet'], {}), '(self.apertureSet)\n', (597, 615), False, 'from pygerber.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from os import path
from setuptools import setup
import sys
basedir = path.dirname(path.abspath(__file__))
extra_args = {}
if (3, 6) > sys.version_info >= (3, 5):
in_dir = path.join(basedir, 'pyppeteer')
out_dir = path.join(basedir, '.pyppeteer')
packages = [... | [
"os.path.exists",
"py_backwards.compiler.compile_files",
"subprocess.run",
"os.path.join",
"setuptools.setup",
"m2r.M2R",
"os.path.abspath"
] | [((1070, 1101), 'os.path.join', 'path.join', (['basedir', '"""README.md"""'], {}), "(basedir, 'README.md')\n", (1079, 1101), False, 'from os import path\n'), ((1358, 2189), 'setuptools.setup', 'setup', ([], {'name': '"""pyppeteer"""', 'version': '"""0.0.9"""', 'description': '"""Headless chrome/chromium automation libr... |
'''Levenshtein distance'''
from itertools import (accumulate, chain, islice)
from functools import reduce
# levenshtein :: String -> String -> Int
def levenshtein(sa):
'''Levenshtein distance between
two strings.'''
s1 = list(sa)
# go :: [Int] -> Char -> [Int]
def go(ns, c):
n, ns1 = ... | [
"itertools.chain",
"itertools.chain.from_iterable",
"itertools.islice"
] | [((1556, 1580), 'itertools.chain.from_iterable', 'chain.from_iterable', (['xxs'], {}), '(xxs)\n', (1575, 1580), False, 'from itertools import accumulate, chain, islice\n'), ((3236, 3249), 'itertools.islice', 'islice', (['xs', 'n'], {}), '(xs, n)\n', (3242, 3249), False, 'from itertools import accumulate, chain, islice\... |
import hashlib
from defusedxml import ElementTree
from dojo.models import Finding
class DependencyCheckParser(object):
def get_field_value(self, parent_node, field_name):
field_node = parent_node.find(self.namespace + field_name)
field_value = '' if field_node is None else field_node.text
... | [
"defusedxml.ElementTree.fromstring",
"dojo.models.Finding.get_numerical_severity",
"hashlib.md5"
] | [((2100, 2131), 'defusedxml.ElementTree.fromstring', 'ElementTree.fromstring', (['content'], {}), '(content)\n', (2122, 2131), False, 'from defusedxml import ElementTree\n'), ((1668, 1708), 'dojo.models.Finding.get_numerical_severity', 'Finding.get_numerical_severity', (['severity'], {}), '(severity)\n', (1698, 1708), ... |
import datetime
import six
import testtools
import ddt
import falcon
from falcon.request import Request
import falcon.testing as testing
@ddt.ddt
class TestReqVars(testing.TestBase):
def before(self):
self.qs = 'marker=deadbeef&limit=10'
self.headers = {
'Content-Type': 'text/plain... | [
"falcon.request.Request",
"datetime.datetime",
"testtools.skipUnless",
"ddt.data",
"falcon.testing.create_environ"
] | [((3132, 3194), 'testtools.skipUnless', 'testtools.skipUnless', (['six.PY3', '"""Test only applies to Python 3"""'], {}), "(six.PY3, 'Test only applies to Python 3')\n", (3152, 3194), False, 'import testtools\n'), ((21347, 21470), 'ddt.data', 'ddt.data', (["('Date', 'date')", "('If-Modified-since', 'if_modified_since')... |
import tempfile
import strax
import straxen
from straxen.test_utils import nt_test_run_id, DummyRawRecords, testing_config_1T, test_run_id_1T
def _run_plugins(st,
make_all=False,
run_id=nt_test_run_id,
from_scratch=False,
**process_kwargs):
"""
... | [
"straxen.contexts.xenon1t_dali",
"tempfile.TemporaryDirectory",
"strax.DataDirectory",
"straxen.test_utils.testing_config_1T.items",
"straxen.utilix_is_configured",
"straxen.test_utils.nt_test_context"
] | [((5118, 5149), 'straxen.contexts.xenon1t_dali', 'straxen.contexts.xenon1t_dali', ([], {}), '()\n', (5147, 5149), False, 'import straxen\n'), ((5883, 5934), 'straxen.utilix_is_configured', 'straxen.utilix_is_configured', ([], {'warning_message': '(False)'}), '(warning_message=False)\n', (5911, 5934), False, 'import str... |
# (c) 2012-2013 Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
from __future__ import absolute_import, division, print_function, unicode_literals
from argpa... | [
"os.path.exists",
"json.loads",
"os.getenv",
"json.dumps",
"os.environ.get",
"os.path.join",
"os.path.isfile",
"textwrap.wrap",
"sys.stdin.read"
] | [((7458, 7513), 'json.dumps', 'json.dumps', (["details['default_value']"], {'cls': 'EntityEncoder'}), "(details['default_value'], cls=EntityEncoder)\n", (7468, 7513), False, 'import json\n'), ((11669, 11692), 'os.path.exists', 'os.path.exists', (['rc_path'], {}), '(rc_path)\n', (11683, 11692), False, 'import os\n'), ((... |
# smartmirror.py
# requirements
# requests, feedparser, traceback, Pillow
import tkinter as tk
import locale
import threading
import time
import datetime
import dateutil as du
from dateutil import parser
import requests
import json
import traceback
import feedparser
from PIL import Image, ImageTk
from contextlib impo... | [
"dateutil.parser.parse",
"tkinter.Frame.__init__",
"PIL.Image.open",
"locale.setlocale",
"feedparser.parse",
"threading.Lock",
"time.strftime",
"requests.get",
"datetime.datetime.now",
"tkinter.Tk",
"tkinter.Label",
"traceback.print_exc",
"tkinter.Frame",
"PIL.ImageTk.PhotoImage"
] | [((353, 369), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (367, 369), False, 'import threading\n'), ((813, 844), 'locale.setlocale', 'locale.setlocale', (['locale.LC_ALL'], {}), '(locale.LC_ALL)\n', (829, 844), False, 'import locale\n'), ((1859, 1902), 'tkinter.Frame.__init__', 'tk.Frame.__init__', (['self', ... |
import caffe2onnx.src.c2oObject as Node
from typing import List
import copy
def get_concat_attributes(layer):
axis = layer.concat_param.axis
attributes = {"axis": axis}
return attributes
def get_concat_outshape(layer, input_shape: List) -> List:
bottom = input_shape[0]
axis = layer.concat_param.... | [
"caffe2onnx.src.c2oObject.c2oNode",
"copy.deepcopy"
] | [((345, 366), 'copy.deepcopy', 'copy.deepcopy', (['bottom'], {}), '(bottom)\n', (358, 366), False, 'import copy\n'), ((1417, 1516), 'caffe2onnx.src.c2oObject.c2oNode', 'Node.c2oNode', (['layer', 'nodename', '"""Concat"""', 'inname', 'outname', 'input_shape', 'output_shape', 'attributes'], {}), "(layer, nodename, 'Conca... |
#!/usr/bin/env python
'''
This node is both a publisher and a subscriber that will eventually
read information from the ROS system and send it to the RIO as
well as read information from the RIO and send it to the jetson.
PUBLISHED TOPICS:
FOOT_POSITIONS - Float64[] ARRAY OF FOOT POSITIONS XYZ
THETAS = Float64[] A... | [
"rospy.Subscriber",
"rospy.init_node",
"rospy.spin",
"networktables.NetworkTables.getTable",
"networktables.NetworkTables.initialize"
] | [((876, 913), 'networktables.NetworkTables.initialize', 'nt.initialize', ([], {'server': 'DEFAULTS.RIO_IP'}), '(server=DEFAULTS.RIO_IP)\n', (889, 913), True, 'from networktables import NetworkTables as nt\n'), ((940, 964), 'networktables.NetworkTables.getTable', 'nt.getTable', (['"""rio_input"""'], {}), "('rio_input')\... |
import threading
import websocket
import gzip
import ssl
import logging
from urllib import parse
import urllib.parse
from binance_d.base.printtime import PrintDate
from binance_d.impl.utils.timeservice import get_current_timestamp
from binance_d.impl.utils.urlparamsbuilder import UrlParamsBuilder
from binan... | [
"logging.getLogger",
"websocket.WebSocketApp",
"gzip.decompress",
"binance_d.impl.utils.timeservice.get_current_timestamp",
"threading.Thread",
"binance_d.exception.binanceapiexception.BinanceApiException"
] | [((1369, 1481), 'websocket.WebSocketApp', 'websocket.WebSocketApp', (['connection_instance.url'], {'on_message': 'on_message', 'on_error': 'on_error', 'on_close': 'on_close'}), '(connection_instance.url, on_message=on_message,\n on_error=on_error, on_close=on_close)\n', (1391, 1481), False, 'import websocket\n'), ((... |
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... | [
"numpy.mean",
"tensorflow.device",
"tensorflow.tile",
"tensorflow.random_normal",
"dnnlib.util.open_url",
"numpy.log",
"pickle.load",
"dnnlib.tflib.convert_images_to_uint8",
"numpy.exp",
"numpy.sum",
"numpy.empty",
"numpy.std",
"dnnlib.tflib.run"
] | [((1319, 1391), 'numpy.empty', 'np.empty', (['[self.num_images, inception.output_shape[1]]'], {'dtype': 'np.float32'}), '([self.num_images, inception.output_shape[1]], dtype=np.float32)\n', (1327, 1391), True, 'import numpy as np\n'), ((1138, 1262), 'dnnlib.util.open_url', 'dnnlib.util.open_url', (['"""https://nvlabs-f... |
from Gamepad import Gamepad
class Controller(Gamepad):
def __init__(self):
self.names = {
"BTN_TR2": "RT",
"BTN_TR": "RB",
"BTN_TL2": "LT",
"BTN_TL": "LB",
"BTN_THUMBL": "LS_BTN",
"BTN_THUMBR": "RS_BTN",
"BTN_WEST": "Y",
... | [
"Gamepad.Gamepad.__init__"
] | [((611, 633), 'Gamepad.Gamepad.__init__', 'Gamepad.__init__', (['self'], {}), '(self)\n', (627, 633), False, 'from Gamepad import Gamepad\n')] |
from model.mri_srgan import MRI_SRGAN
from dataset.dataset_manager import MRI_Dataset
from tensorflow import keras
def runtest(config, *args, **kwargs):
checkpoint_folder = "D:\\Projets\\srm4bmri\\training_folder\\checkpoints"
dataset_folder = "D:\\Projets\\srm4bmri\\dataset"
logs_folder = "D:\\Projets\\... | [
"model.mri_srgan.MRI_SRGAN"
] | [((1060, 1148), 'model.mri_srgan.MRI_SRGAN', 'MRI_SRGAN', (['"""training"""'], {'checkpoint_folder': 'checkpoint_folder', 'logs_folder': 'logs_folder'}), "('training', checkpoint_folder=checkpoint_folder, logs_folder=\n logs_folder)\n", (1069, 1148), False, 'from model.mri_srgan import MRI_SRGAN\n')] |
import numpy as np
from keras import Model
from keras.layers import Dense , GlobalAveragePooling2D
from PIL import Image, ImageDraw
from keras.applications import resnet
import numpy as np
def create_model(trainable=False):
#model = vgg16.VGG16(include_top=False, weights='imagenet',input_shape=(IMAGE_SIZE_H,IMAGE... | [
"PIL.Image.fromarray",
"keras.Model",
"PIL.ImageDraw.Draw",
"keras.applications.resnet.ResNet50",
"keras.layers.Dense",
"keras.layers.GlobalAveragePooling2D",
"numpy.load"
] | [((1233, 1304), 'numpy.load', 'np.load', (['"""C:\\\\users\\\\ateeb\\\\desktop\\\\localization\\\\X_cow_half_size.npy"""'], {}), "('C:\\\\users\\\\ateeb\\\\desktop\\\\localization\\\\X_cow_half_size.npy')\n", (1240, 1304), True, 'import numpy as np\n'), ((362, 448), 'keras.applications.resnet.ResNet50', 'resnet.ResNet5... |
# Copyright 2018 The Texar 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 applicable ... | [
"tensorflow.zeros_like",
"tensorflow.ones_like"
] | [((2403, 2428), 'tensorflow.ones_like', 'tf.ones_like', (['real_logits'], {}), '(real_logits)\n', (2415, 2428), True, 'import tensorflow as tf\n'), ((2669, 2695), 'tensorflow.zeros_like', 'tf.zeros_like', (['fake_logits'], {}), '(fake_logits)\n', (2682, 2695), True, 'import tensorflow as tf\n'), ((2932, 2957), 'tensorf... |
import os
import re
import time
from random import Random
import pytest
from invoke.context import Context
from src.benchmark_metrics import (
TENSORFLOW2_SM_TRAINING_CPU_1NODE_THRESHOLD,
TENSORFLOW2_SM_TRAINING_CPU_4NODE_THRESHOLD,
TENSORFLOW2_SM_TRAINING_GPU_1NODE_THRESHOLD,
TENSORFLOW2_SM_TRAINING... | [
"pytest.mark.flaky",
"pytest.skip",
"os.getenv",
"pytest.mark.integration",
"random.Random",
"time.strftime",
"os.path.join",
"pytest.mark.model",
"os.path.realpath",
"invoke.context.Context",
"pytest.mark.multinode",
"test.test_utils.LOGGER.info",
"re.search"
] | [((411, 438), 'pytest.mark.flaky', 'pytest.mark.flaky', ([], {'reruns': '(3)'}), '(reruns=3)\n', (428, 438), False, 'import pytest\n'), ((440, 483), 'pytest.mark.integration', 'pytest.mark.integration', (['"""imagenet dataset"""'], {}), "('imagenet dataset')\n", (463, 483), False, 'import pytest\n'), ((485, 509), 'pyte... |
import numpy as np
from numpy.testing import (assert_array_equal, assert_almost_equal,
assert_array_almost_equal, assert_equal, assert_)
from modules.scipy.special import VeroneseMap, VeroneseMapWithIdentity
def test_veronese_map():
x = np.random.randn(10)
n, m = len(x), 784
V... | [
"numpy.testing.assert_array_almost_equal",
"numpy.random.randn",
"modules.scipy.special.VeroneseMap",
"modules.scipy.special.VeroneseMapWithIdentity"
] | [((272, 291), 'numpy.random.randn', 'np.random.randn', (['(10)'], {}), '(10)\n', (287, 291), True, 'import numpy as np\n'), ((323, 362), 'modules.scipy.special.VeroneseMap', 'VeroneseMap', ([], {'shape': '(n, m)', 'shuffle': '(True)'}), '(shape=(n, m), shuffle=True)\n', (334, 362), False, 'from modules.scipy.special im... |
from CyberSource import *
import json
import os
from importlib.machinery import SourceFileLoader
config_file = os.path.join(os.getcwd(), "data", "Configuration.py")
configuration = SourceFileLoader("module.name", config_file).load_module()
def create_payment_instrument():
try:
# Setting the json message ... | [
"importlib.machinery.SourceFileLoader",
"json.dumps",
"os.getcwd"
] | [((125, 136), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (134, 136), False, 'import os\n'), ((182, 226), 'importlib.machinery.SourceFileLoader', 'SourceFileLoader', (['"""module.name"""', 'config_file'], {}), "('module.name', config_file)\n", (198, 226), False, 'from importlib.machinery import SourceFileLoader\n'), ((... |
from django.utils.translation import ugettext as _
from pretalx.common.phrases import BasePhrases, Phrases
class AgendaPhrases(Phrases, app='agenda'):
feedback_success = [
_('Thank you for your feedback!'),
_('Thanks, we (and our speakers) appreciate your feedback!'),
]
changelog_unchange... | [
"django.utils.translation.ugettext"
] | [((324, 424), 'django.utils.translation.ugettext', '_', (['"""Nothing has changed, we just wanted to change the version name. It was going out of style."""'], {}), "('Nothing has changed, we just wanted to change the version name. It was going out of style.'\n )\n", (325, 424), True, 'from django.utils.translation i... |
#!/usr/bin/env python3
import argparse
import itertools
from sys import argv
from vang.bitbucket.api import call
from vang.core.core import pmap_unordered
def get_repos_page(project, limit, start):
response = call(f'/rest/api/1.0/projects/{project}'
f'/repos?limit={limit}&start={start}')
... | [
"vang.bitbucket.api.call",
"argparse.ArgumentParser"
] | [((216, 291), 'vang.bitbucket.api.call', 'call', (['f"""/rest/api/1.0/projects/{project}/repos?limit={limit}&start={start}"""'], {}), "(f'/rest/api/1.0/projects/{project}/repos?limit={limit}&start={start}')\n", (220, 291), False, 'from vang.bitbucket.api import call\n'), ((1470, 1533), 'argparse.ArgumentParser', 'argpa... |
import argparse
import git
import logging
import os
import shutil
from nbcollection.ci.replicate.utils import find_repo_path_by_remote, obtain_pull_request_info, \
select_build_jobs, extract_repo_info
from nbcollection.ci.replicate import virtual_env
from nbcollection.ci.replicate.datatypes import RemoteParts,... | [
"logging.getLogger",
"os.path.exists",
"nbcollection.ci.replicate.datatypes.select_url_type",
"nbcollection.ci.replicate.utils.extract_repo_info",
"nbcollection.ci.replicate.utils.obtain_pull_request_info",
"nbcollection.ci.replicate.datatypes.select_repo_type",
"git.Repo.clone_from",
"nbcollection.ci... | [((374, 401), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (391, 401), False, 'import logging\n'), ((481, 516), 'nbcollection.ci.replicate.datatypes.select_repo_type', 'select_repo_type', (['options.repo_path'], {}), '(options.repo_path)\n', (497, 516), False, 'from nbcollection.ci.repl... |
#!/usr/bin/env python
####################################################################
### This is the PYTHON version of program 3.4 from page 87 of #
### "Modeling Infectious Disease in humans and animals" #
### by Keeling & Rohani. #
### #
### It is the SEIR model wi... | [
"numpy.mean",
"pylab.ylim",
"pylab.subplot",
"numpy.hstack",
"pylab.plot",
"pylab.find",
"scipy.integrate.odeint",
"pylab.xlabel",
"matplotlib.font_manager.FontProperties",
"numpy.array",
"numpy.zeros",
"pylab.semilogy",
"numpy.vstack",
"pylab.xlim",
"pylab.ylabel",
"numpy.arange",
"... | [((766, 809), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0, 1.0 / (55 * 365)]'], {}), '([0.0, 0.0, 0.0, 1.0 / (55 * 365)])\n', (774, 809), True, 'import numpy as np\n'), ((815, 858), 'numpy.array', 'np.array', (['[1.0 / (55 * 365), 0.0, 0.0, 0.0]'], {}), '([1.0 / (55 * 365), 0.0, 0.0, 0.0])\n', (823, 858), True, 'impor... |
#
# ovirt-engine-setup -- ovirt engine setup
# Copyright (C) 2013-2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | [
"otopi.plugin.event",
"ovirt_engine_setup.hostname.Hostname",
"gettext.dgettext"
] | [((881, 937), 'gettext.dgettext', 'gettext.dgettext', ([], {'message': 'm', 'domain': '"""ovirt-engine-setup"""'}), "(message=m, domain='ovirt-engine-setup')\n", (897, 937), False, 'import gettext\n'), ((1103, 1237), 'otopi.plugin.event', 'plugin.event', ([], {'stage': 'plugin.Stages.STAGE_BOOT', 'before': '(otopicons.... |
import os
import time
import logging
from logsight.config import set_host
from logsight.exceptions import InternalServerError
from logsight.authentication import LogsightAuthentication
from logsight.logger.logger import LogsightLogger
from logsight.compare import LogsightCompare
EMAIL = os.getenv('LOGSIGHT_EMAIL') o... | [
"logging.getLogger",
"os.getenv",
"logsight.compare.LogsightCompare",
"time.sleep",
"logsight.authentication.LogsightAuthentication",
"logsight.config.set_host",
"logsight.logger.logger.LogsightLogger"
] | [((390, 434), 'logsight.config.set_host', 'set_host', (['"""https://demo.logsight.ai/api/v1/"""'], {}), "('https://demo.logsight.ai/api/v1/')\n", (398, 434), False, 'from logsight.config import set_host\n'), ((443, 497), 'logsight.authentication.LogsightAuthentication', 'LogsightAuthentication', ([], {'email': 'EMAIL',... |
"""
"""
from config import config
class Factory(object):
def __init__(self, session_name, **context):
self.context = context
self.session = sessions[session_name]()
self.factory = RepositoryFactory(self.session)
def __enter__(self):
self.session.__enter__()
return sel... | [
"config.config.get"
] | [((699, 728), 'config.config.get', 'config.get', (['"""runtime"""', '"""mode"""'], {}), "('runtime', 'mode')\n", (709, 728), False, 'from config import config\n')] |
# This file is part of the Indico plugins.
# Copyright (C) 2002 - 2019 CERN
#
# The Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License;
# see the LICENSE file for more details.
from __future__ import unicode_literals
from flask_pluginengine import curre... | [
"indico_chat.models.chatrooms.ChatroomEventAssociation.find_for_event",
"flask_pluginengine.current_plugin.settings.get"
] | [((657, 708), 'indico_chat.models.chatrooms.ChatroomEventAssociation.find_for_event', 'ChatroomEventAssociation.find_for_event', (['self.event'], {}), '(self.event)\n', (696, 708), False, 'from indico_chat.models.chatrooms import ChatroomEventAssociation\n'), ((1094, 1135), 'flask_pluginengine.current_plugin.settings.g... |
from random import *
from pyramid.request import Request
from pyramid.view import view_config
from silversaucer.services.play_service import RandomRecordService
@view_config(route_name="play", renderer="silversaucer:templates/play/play.pt")
def play(_):
folder = 2162484
album_release_id = RandomRecordServi... | [
"silversaucer.services.play_service.RandomRecordService.get_folder_count",
"silversaucer.services.play_service.RandomRecordService.get_album_data",
"pyramid.view.view_config"
] | [((166, 244), 'pyramid.view.view_config', 'view_config', ([], {'route_name': '"""play"""', 'renderer': '"""silversaucer:templates/play/play.pt"""'}), "(route_name='play', renderer='silversaucer:templates/play/play.pt')\n", (177, 244), False, 'from pyramid.view import view_config\n'), ((473, 570), 'pyramid.view.view_con... |
from setuptools import setup, find_packages
try:
from pip._internal.req import parse_requirements
except ImportError:
from pip.req import parse_requirements
def get_requirements(file):
"""Return a list of requirements from a file."""
requirements = parse_requirements(file, session=False)
return [... | [
"pip.req.parse_requirements",
"setuptools.find_packages"
] | [((268, 307), 'pip.req.parse_requirements', 'parse_requirements', (['file'], {'session': '(False)'}), '(file, session=False)\n', (286, 307), False, 'from pip.req import parse_requirements\n'), ((729, 744), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (742, 744), False, 'from setuptools import setup, f... |
import commands
import logging
import numpy
import math
import psutil
from utilities import BytesToHuman
class System(object):
def __init__(self):
pass
def cpu(mode):
output = psutil.cpu_times_percent(interval=1, percpu=False)
return "%.1f" % output.system
def memory(self):
... | [
"psutil.cpu_times_percent",
"utilities.BytesToHuman",
"psutil.virtual_memory"
] | [((204, 254), 'psutil.cpu_times_percent', 'psutil.cpu_times_percent', ([], {'interval': '(1)', 'percpu': '(False)'}), '(interval=1, percpu=False)\n', (228, 254), False, 'import psutil\n'), ((333, 356), 'psutil.virtual_memory', 'psutil.virtual_memory', ([], {}), '()\n', (354, 356), False, 'import psutil\n'), ((372, 398)... |
import numpy as np
def moving_average(a, n=3) :
"""
perform moving average, return a vector of same length as input
"""
a=a.ravel()
a = np.concatenate(([a[0]]*(n-1),a)) # repeating first values
ret = np.cumsum(a, dtype=float)
ret[n:] = ret[n:] - ret[:-n]
ret=ret[n - 1:] / n
return ... | [
"numpy.cumsum",
"numpy.concatenate"
] | [((158, 195), 'numpy.concatenate', 'np.concatenate', (['([a[0]] * (n - 1), a)'], {}), '(([a[0]] * (n - 1), a))\n', (172, 195), True, 'import numpy as np\n'), ((226, 251), 'numpy.cumsum', 'np.cumsum', (['a'], {'dtype': 'float'}), '(a, dtype=float)\n', (235, 251), True, 'import numpy as np\n')] |
import click
from train_anomaly_detection import main_func
import numpy as np
import os
# Define base parameters.
dataset_name = 'selfsupervised'
net_name = 'StackConvNet'
xp_path_base = 'log'
data_path = 'data/full'
train_folder = 'train'
val_pos_folder = 'val/wangen_sun_3_pos'
val_neg_folder = 'val/wangen_sun_3_neg'... | [
"numpy.mean",
"train_anomaly_detection.main_func",
"os.path.join",
"numpy.std"
] | [((4318, 4355), 'os.path.join', 'os.path.join', (['xp_path_base', '"""auc.npy"""'], {}), "(xp_path_base, 'auc.npy')\n", (4330, 4355), False, 'import os\n'), ((4385, 4409), 'numpy.mean', 'np.mean', (['auc_mat'], {'axis': '(0)'}), '(auc_mat, axis=0)\n', (4392, 4409), True, 'import numpy as np\n'), ((4430, 4453), 'numpy.s... |
import logging
import oscar
'''
This family is deprecated, so it is remaining unimplemented
'''
x0c_name="Translation - deprecated"
log = logging.getLogger('oscar.snac.x0c')
subcodes = {}
def x0c_init(o, sock, cb):
log.info('initializing')
cb()
log.info('finished initializing')
def x0c... | [
"logging.getLogger",
"oscar.snac.SnacError",
"oscar.snac.error"
] | [((152, 187), 'logging.getLogger', 'logging.getLogger', (['"""oscar.snac.x0c"""'], {}), "('oscar.snac.x0c')\n", (169, 187), False, 'import logging\n'), ((504, 526), 'oscar.snac.error', 'oscar.snac.error', (['data'], {}), '(data)\n', (520, 526), False, 'import oscar\n'), ((613, 675), 'oscar.snac.SnacError', 'oscar.snac.... |
# Copyright 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,... | [
"ccnpy.Name.from_uri",
"ccnpy.Name.parse",
"array.array",
"ccnpy.Tlv.deserialize"
] | [((754, 778), 'ccnpy.Name.from_uri', 'ccnpy.Name.from_uri', (['uri'], {}), '(uri)\n', (773, 778), False, 'import ccnpy\n'), ((834, 1029), 'array.array', 'array.array', (['"""B"""', '[0, 0, 0, 39, 0, 1, 0, 5, 97, 112, 112, 108, 101, 0, 1, 0, 6, 98, 97, 110, \n 97, 110, 97, 0, 1, 0, 6, 99, 104, 101, 114, 114, 121, 0, ... |
"""
Module for working with modulemd YAML definitions with the least abstractions as
possible. Within this module, modulemd YAMLs are represented simply as a string,
and all transformation functions are `str` -> `str`.
"""
import os
import gi
import yaml
# python3-packaging in not available in RHEL 8.x
try:
from ... | [
"gi.repository.Modulemd.get_version",
"gi.repository.Modulemd.Profile.new",
"gi.repository.Modulemd.Dependencies",
"gi.repository.Modulemd.read_packager_string",
"os.path.join",
"gi.require_version",
"os.getcwd",
"yaml.safe_load",
"gi.repository.Modulemd.ModuleIndex.new",
"os.path.isdir",
"distu... | [((441, 478), 'gi.require_version', 'gi.require_version', (['"""Modulemd"""', '"""2.0"""'], {}), "('Modulemd', '2.0')\n", (459, 478), False, 'import gi\n'), ((660, 686), 'gi.repository.Modulemd.ModuleIndex.new', 'Modulemd.ModuleIndex.new', ([], {}), '()\n', (684, 686), False, 'from gi.repository import Modulemd\n'), ((... |
from src.environments.slippery_grid import SlipperyGrid
import numpy as np
# A modified version of OpenAI Gym FrozenLake
# only the labelling function needs to be specified
sinks = []
for i in range(12, 16):
for j in range(15, 19):
sinks.append([i, j])
# create a SlipperyGrid object
FrozenLake = SlipperyG... | [
"src.environments.slippery_grid.SlipperyGrid",
"numpy.empty"
] | [((311, 407), 'src.environments.slippery_grid.SlipperyGrid', 'SlipperyGrid', ([], {'shape': '[20, 20]', 'initial_state': '[0, 10]', 'slip_probability': '(0.1)', 'sink_states': 'sinks'}), '(shape=[20, 20], initial_state=[0, 10], slip_probability=0.1,\n sink_states=sinks)\n', (323, 407), False, 'from src.environments.... |
from __future__ import unicode_literals
import io
import json
import os
import unittest
from jsonschema import ValidationError
from clkhash import schema
from clkhash.schema import SchemaError, MasterSchemaError
from tests import *
DATA_DIRECTORY = os.path.join(os.path.dirname(__file__),
... | [
"clkhash.schema._convert_v1_to_v2",
"clkhash.schema.convert_to_latest_version",
"clkhash.schema.validate_schema_dict",
"os.path.join",
"os.path.dirname",
"clkhash.schema.MASTER_SCHEMA_FILE_NAMES.keys",
"clkhash.schema.from_json_file",
"json.load",
"io.StringIO",
"clkhash.schema._convert_v2_to_v3",... | [((266, 291), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (281, 291), False, 'import os\n'), ((384, 409), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (399, 409), False, 'import os\n'), ((473, 517), 'os.path.join', 'os.path.join', (['TEST_DATA_DIRECTORY', 'file... |
from django import forms
class UploadFile(forms.Form):
file=forms.FileField()
| [
"django.forms.FileField"
] | [((65, 82), 'django.forms.FileField', 'forms.FileField', ([], {}), '()\n', (80, 82), False, 'from django import forms\n')] |
"""
Loads the BVH files that make up the databases and processes them into the format required by our training algorithm.
It does NOT subdivide the clips into overlapping windows and does NOT split the data set into training and validation.
For this, use the script `extract_data_splits.py`.
This code is mostly copied ... | [
"numpy.mean",
"os.listdir",
"numpy.amin",
"numpy.minimum",
"Animation.positions_global",
"os.path.join",
"numpy.min",
"Quaternions.Quaternions.between",
"numpy.max",
"numpy.exp",
"numpy.array",
"scipy.ndimage.filters.gaussian_filter1d",
"numpy.concatenate",
"numpy.std",
"Pivots.Pivots.fr... | [((880, 898), 'BVH.load', 'BVH.load', (['filename'], {}), '(filename)\n', (888, 898), True, 'import BVH as BVH\n'), ((993, 1025), 'Animation.positions_global', 'Animation.positions_global', (['anim'], {}), '(anim)\n', (1019, 1025), True, 'import Animation as Animation\n'), ((1686, 1775), 'scipy.ndimage.filters.gaussian... |
#!/usr/bin/env python
# coding: utf-8
import os
import sys
import random
import math
import re
import time
import numpy as np
import cv2
import matplotlib
import matplotlib.pyplot as plt
import tensorflow as tf
from mrcnn.config import Config
# import utils
from mrcnn import model as modellib, utils
from mrcnn import ... | [
"mrcnn.model.MaskRCNN",
"os.path.exists",
"os.listdir",
"PIL.Image.open",
"mrcnn.utils.download_trained_weights",
"numpy.random.choice",
"mrcnn.visualize.display_top_masks",
"numpy.logical_not",
"os.path.join",
"numpy.max",
"numpy.zeros",
"os.path.abspath",
"sys.path.append",
"matplotlib.p... | [((436, 461), 'os.path.abspath', 'os.path.abspath', (['"""../../"""'], {}), "('../../')\n", (451, 461), False, 'import os\n'), ((482, 507), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (497, 507), False, 'import sys\n'), ((592, 622), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""logs"""... |
#!/usr/bin/env python3
# Author: <NAME>
import cv2 as cv
def main():
print(cv.__version__)
image = cv.imread("lena.jpg" , 1)
cv.imshow('image',image)
cv.waitKey(0)
cv.destroyAllWindows()
if __name__ == "__main__":
main()
| [
"cv2.waitKey",
"cv2.imread",
"cv2.destroyAllWindows",
"cv2.imshow"
] | [((110, 134), 'cv2.imread', 'cv.imread', (['"""lena.jpg"""', '(1)'], {}), "('lena.jpg', 1)\n", (119, 134), True, 'import cv2 as cv\n'), ((149, 174), 'cv2.imshow', 'cv.imshow', (['"""image"""', 'image'], {}), "('image', image)\n", (158, 174), True, 'import cv2 as cv\n'), ((178, 191), 'cv2.waitKey', 'cv.waitKey', (['(0)'... |
import argparse
import imagesize
import os
import subprocess
parser = argparse.ArgumentParser(description='MegaDepth Undistortion')
parser.add_argument(
'--colmap_path', type=str, required=True,
help='path to colmap executable'
)
parser.add_argument(
'--base_path', type=str, required=True,
help='pa... | [
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"os.path.join",
"os.mkdir"
] | [((74, 135), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""MegaDepth Undistortion"""'}), "(description='MegaDepth Undistortion')\n", (97, 135), False, 'import argparse\n'), ((379, 427), 'os.path.join', 'os.path.join', (['args.base_path', '"""MegaDepth_v1_SfM"""'], {}), "(args.base_path,... |
from pikarpc.byte_utils import int_to_bytes, int_from_bytes, float_to_bytes, float_from_bytes
from PIL import Image
from pikarpc.image_utils import image_from_byte_array, image_to_byte_array
def bytes_from_value(v, lossless):
result = bytes()
if type(v) == bytes:
result += b'b'
result += v
... | [
"pikarpc.byte_utils.int_from_bytes",
"pikarpc.byte_utils.float_from_bytes",
"pikarpc.byte_utils.float_to_bytes",
"pikarpc.image_utils.image_to_byte_array",
"pikarpc.image_utils.image_from_byte_array",
"pikarpc.byte_utils.int_to_bytes"
] | [((1075, 1109), 'pikarpc.byte_utils.int_from_bytes', 'int_from_bytes', (['b[index:index + 4]'], {}), '(b[index:index + 4])\n', (1089, 1109), False, 'from pikarpc.byte_utils import int_to_bytes, int_from_bytes, float_to_bytes, float_from_bytes\n'), ((3008, 3029), 'pikarpc.byte_utils.int_from_bytes', 'int_from_bytes', ([... |
# -*- coding: utf-8 -*-
"""
zang.connectors.fraud_control_connector
~~~~~~~~~~~~~~~~~~~
Module for communication with `FraudControlConnector` endpoint
"""
from zang.connectors.base_connector import BaseConnector
from zang.helpers.helpers import flatDict
from zang.domain.fraud_control_rule_element import FraudControl... | [
"zang.helpers.helpers.flatDict"
] | [((2026, 2046), 'zang.helpers.helpers.flatDict', 'flatDict', (['bodyParams'], {}), '(bodyParams)\n', (2034, 2046), False, 'from zang.helpers.helpers import flatDict\n'), ((3634, 3654), 'zang.helpers.helpers.flatDict', 'flatDict', (['bodyParams'], {}), '(bodyParams)\n', (3642, 3654), False, 'from zang.helpers.helpers im... |
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"numpy.sqrt",
"tensorflow.compat.v2.keras.optimizers.Adam",
"tensorflow.compat.v2.zeros",
"dice_rl.utils.common.is_categorical_spec",
"dice_rl.data.dataset.convert_to_tfagents_timestep",
"tensorflow.compat.v2.nest.map_structure",
"tensorflow.compat.v2.square",
"tensorflow.compat.v2.einsum",
"tensorf... | [((3547, 3591), 'numpy.zeros', 'np.zeros', (['[self._dimension, self._dimension]'], {}), '([self._dimension, self._dimension])\n', (3555, 3591), True, 'import numpy as np\n'), ((3618, 3645), 'numpy.zeros', 'np.zeros', (['[self._dimension]'], {}), '([self._dimension])\n', (3626, 3645), True, 'import numpy as np\n'), ((3... |
import numpy as np
import util
from linear_model import LinearModel
def main(train_path, eval_path, pred_path):
"""Problem 1(b): Logistic regression with Newton's Method.
Args:
train_path: Path to CSV file containing dataset for training.
eval_path: Path to CSV file containing dataset for ev... | [
"util.load_dataset"
] | [((406, 455), 'util.load_dataset', 'util.load_dataset', (['train_path'], {'add_intercept': '(True)'}), '(train_path, add_intercept=True)\n', (423, 455), False, 'import util\n')] |
import pandas as pd
import numpy as np
from collections import defaultdict
from itertools import combinations
# Alpha interval of .95
# corrected for multiple comparisons
Z_MULT = 2.98
def calculate_significance(array):
"""Calculate significance directly."""
return is_sig(*interval_from_values(array))
def... | [
"numpy.array",
"collections.defaultdict",
"pandas.read_csv"
] | [((776, 877), 'pandas.read_csv', 'pd.read_csv', (['"""/Users/stephantulkens/Google Drive/code/r/lrec/experiment_3_eng-uk_words.csv"""'], {}), "(\n '/Users/stephantulkens/Google Drive/code/r/lrec/experiment_3_eng-uk_words.csv'\n )\n", (787, 877), True, 'import pandas as pd\n'), ((882, 899), 'collections.defaultdic... |
"""<NAME>., 2019 - 2020. All rights reserved.
This file process the IO for the Text similarity """
import math
import os
import datetime
import shutil
import time
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import cosine_similarity
im... | [
"pandas.Series",
"os.path.exists",
"sklearn.metrics.pairwise.cosine_similarity",
"pandas.read_csv",
"numpy.arange",
"sklearn.feature_extraction.text.CountVectorizer",
"os.path.splitext",
"pandas.set_option",
"os.path.isfile",
"os.path.dirname",
"datetime.datetime.now",
"pandas.read_excel",
"... | [((368, 383), 'similarity.similarity_logging.get_logger', 'cl.get_logger', ([], {}), '()\n', (381, 383), True, 'import similarity.similarity_logging as cl\n'), ((2315, 2345), 'os.path.isfile', 'os.path.isfile', (['self.file_path'], {}), '(self.file_path)\n', (2329, 2345), False, 'import os\n'), ((2594, 2624), 'os.path.... |
from struct import *
import subprocess
import os
EXIFTOOL = "/usr/local/bin/exiftool"
LABEL_DATETIME = "Date/Time Original"
def get_info_strings(path):
"""
exiftoolを実行して結果文字列をチャプター情報も含めて取得
Parameters
----------
path : string
対象の写真ファイルパス
Returns
-------
string
exiftool... | [
"os.path.exists",
"os.path.getsize",
"subprocess.run"
] | [((422, 541), 'subprocess.run', 'subprocess.run', (['[EXIFTOOL, path]'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE', 'encoding': '"""utf8"""', 'errors': '"""ignore"""'}), "([EXIFTOOL, path], stdout=subprocess.PIPE, stderr=subprocess.\n PIPE, encoding='utf8', errors='ignore')\n", (436, 541), False, 'im... |
"""
MesoNet
Authors: <NAME> and <NAME>, <NAME>
https://github.com/bf777/MesoNet
Licensed under the Creative Commons Attribution 4.0 International License (see LICENSE for details)
This file has been adapted from data.py in https://github.com/zhixuhao/unet
"""
from __future__ import print_function
from tensorflow.keras.... | [
"numpy.reshape",
"os.path.join",
"tensorflow.keras.preprocessing.image.ImageDataGenerator",
"numpy.max",
"numpy.zeros",
"skimage.transform.resize"
] | [((2002, 2032), 'tensorflow.keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '(**aug_dict)\n', (2020, 2032), False, 'from tensorflow.keras.preprocessing.image import ImageDataGenerator\n'), ((2052, 2082), 'tensorflow.keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([],... |
import math
import sys
while True:
n = sys.stdin.readline().rstrip()
length = len(n)
result = 0
if n == '0':
break
for i in range(length):
result += int(n[i])* math.factorial(length - i)
print(result)
| [
"sys.stdin.readline",
"math.factorial"
] | [((45, 65), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (63, 65), False, 'import sys\n'), ((229, 255), 'math.factorial', 'math.factorial', (['(length - i)'], {}), '(length - i)\n', (243, 255), False, 'import math\n')] |
from lightning import Lightning
from lightning.types.base import Base
from functools import wraps
import inspect
def viztype(VizType):
# wrapper that passes inputs to cleaning function and creates viz
@wraps(VizType.clean)
def plotter(self, *args, **kwargs):
if kwargs['height'] is None and kwarg... | [
"inspect.formatargspec",
"functools.wraps",
"inspect.getargspec"
] | [((213, 233), 'functools.wraps', 'wraps', (['VizType.clean'], {}), '(VizType.clean)\n', (218, 233), False, 'from functools import wraps\n'), ((2198, 2231), 'inspect.getargspec', 'inspect.getargspec', (['VizType.clean'], {}), '(VizType.clean)\n', (2216, 2231), False, 'import inspect\n'), ((2253, 2284), 'inspect.formatar... |
from flask import Flask, render_template
from flask_bootstrap import Bootstrap
app = Flask(__name__)
Bootstrap(app)
@app.route('/')
def math():
#return(y)
return render_template('index.html') | [
"flask.render_template",
"flask_bootstrap.Bootstrap",
"flask.Flask"
] | [((88, 103), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (93, 103), False, 'from flask import Flask, render_template\n'), ((104, 118), 'flask_bootstrap.Bootstrap', 'Bootstrap', (['app'], {}), '(app)\n', (113, 118), False, 'from flask_bootstrap import Bootstrap\n'), ((175, 204), 'flask.render_template', ... |
# -*- coding: utf-8 -*-
# Copyright 2019 Spanish National Research Council (CSIC)
#
# 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
#
# Unle... | [
"sys.exc_info",
"six.reraise"
] | [((962, 976), 'sys.exc_info', 'sys.exc_info', ([], {}), '()\n', (974, 976), False, 'import sys\n'), ((1274, 1324), 'six.reraise', 'six.reraise', (['exc_info[0]', 'exc_info[1]', 'exc_info[2]'], {}), '(exc_info[0], exc_info[1], exc_info[2])\n', (1285, 1324), False, 'import six\n')] |
"""Module for compatible functions."""
import operator
import sys
import toolz
# pandas compat
try:
from pandas.api.types import ( # noqa: F401
DatetimeTZDtype,
CategoricalDtype,
infer_dtype,
)
except ImportError:
from pandas.types.dtypes import ( # noqa: F401
DatetimeTZD... | [
"operator.methodcaller"
] | [((582, 611), 'operator.methodcaller', 'operator.methodcaller', (['"""date"""'], {}), "('date')\n", (603, 611), False, 'import operator\n')] |
#!/usr/bin/python
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import re
import sys
filename = sys.argv[1]
def extract_artifact(line):
splitline = line.split('%')
org = re.sub(r'^revision\.[a-z_]+\.', '... | [
"os.path.exists",
"os.makedirs",
"os.path.join",
"os.path.dirname",
"re.sub"
] | [((287, 337), 're.sub', 're.sub', (['"""^revision\\\\.[a-z_]+\\\\."""', '""""""', 'splitline[0]'], {}), "('^revision\\\\.[a-z_]+\\\\.', '', splitline[0])\n", (293, 337), False, 'import re\n'), ((449, 474), 'os.path.dirname', 'os.path.dirname', (['filename'], {}), '(filename)\n', (464, 474), False, 'import os\n'), ((712... |
import copy
import inspect
import os
import sys
import unittest
import uuid
rootDirectory = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
if rootDirectory not in sys.path:
sys.path.insert(0, rootDirectory)
from oxford.emotion import Emotion
class TestEmotion(unittest.TestCase):
'''Tests the pr... | [
"sys.path.insert",
"os.path.join",
"os.path.realpath",
"copy.copy",
"oxford.emotion.Emotion"
] | [((192, 225), 'sys.path.insert', 'sys.path.insert', (['(0)', 'rootDirectory'], {}), '(0, rootDirectory)\n', (207, 225), False, 'import sys\n'), ((125, 151), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (141, 151), False, 'import os\n'), ((463, 508), 'oxford.emotion.Emotion', 'Emotion', ([... |
from bs4 import BeautifulSoup
import urllib.request
def SearchVid(search):
response = urllib.request.urlopen('https://www.youtube.com/results?search_query='+search.replace(" ", "%20"))
soup = BeautifulSoup(response, 'lxml')
divs = soup.find_all("div", { "class" : "yt-lockup-content"})
vids = []
f... | [
"bs4.BeautifulSoup"
] | [((202, 233), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response', '"""lxml"""'], {}), "(response, 'lxml')\n", (215, 233), False, 'from bs4 import BeautifulSoup\n')] |
# Generated by Django 2.2.4 on 2019-11-10 23:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('usuarios', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='usuarioencentrodesalud',
name='estado'... | [
"django.db.models.PositiveIntegerField"
] | [((340, 430), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'choices': "[(100, 'Inactivo'), (200, 'Activo')]", 'default': '(200)'}), "(choices=[(100, 'Inactivo'), (200, 'Activo')],\n default=200)\n", (367, 430), False, 'from django.db import migrations, models\n')] |
import os.path
from werkzeug.exceptions import NotFound, Forbidden
from werkzeug.wrappers import Request, Response
from werkzeug.wsgi import ClosingIterator
from piecrust import RESOURCES_DIR, CACHE_DIR
from piecrust.data.builder import (
DataBuildingContext, build_page_data)
from piecrust.data.debug import bui... | [
"piecrust.data.debug.build_var_debug_info",
"piecrust.serving.procloop.PipelineStatusServerSentEventProducer",
"werkzeug.exceptions.NotFound",
"werkzeug.exceptions.Forbidden",
"werkzeug.wrappers.Response",
"piecrust.data.builder.DataBuildingContext",
"piecrust.serving.procloop.ProcessingLoop",
"piecru... | [((890, 906), 'werkzeug.wrappers.Request', 'Request', (['environ'], {}), '(environ)\n', (897, 906), False, 'from werkzeug.wrappers import Request, Response\n'), ((2706, 2722), 'werkzeug.wrappers.Request', 'Request', (['environ'], {}), '(environ)\n', (2713, 2722), False, 'from werkzeug.wrappers import Request, Response\... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | [
"rfmt.blocks.StackBlock",
"rfmt.blocks.TextBlock",
"dataclasses.dataclass",
"rfmt.blocks.LineBlock",
"rfmt.blocks.ChoiceBlock"
] | [((1302, 1324), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (1311, 1324), False, 'from dataclasses import dataclass\n'), ((1543, 1566), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(False)'}), '(frozen=False)\n', (1552, 1566), False, 'from dataclasses import dataclass\... |
"""
main app url dispatching
"""
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from .views import (
HomeView, OverviewView, HostView, DeleteHostView, AboutView, GenerateSecretView, GenerateNSSecretView,
RobotsTxtView, DomainOverviewView, DomainView, DeleteDomainView,... | [
"django.views.generic.TemplateView.as_view",
"django.conf.urls.url"
] | [((2320, 2357), 'django.conf.urls.url', 'url', (['"""^myip$"""', 'myip_view'], {'name': '"""myip"""'}), "('^myip$', myip_view, name='myip')\n", (2323, 2357), False, 'from django.conf.urls import patterns, url\n'), ((727, 780), 'django.views.generic.TemplateView.as_view', 'TemplateView.as_view', ([], {'template_name': '... |
###############################################
# ZPEED: Z' Exclusions from Experimental Data #
###############################################
# By <NAME> and <NAME>, 2019
from __future__ import division
import numpy as np
import scipy.integrate as integrate
from chi2_CLs import get_likelihood
from ATLAS_13TeV_calib... | [
"dileptons_functions.dsigmadmll",
"ATLAS_13TeV.calculate_chi2",
"dileptons_functions.dsigmadmll_wint",
"time.clock",
"ATLAS_13TeV_calibration.xi_function",
"chi2_CLs.get_likelihood",
"dileptons_functions.DecayWidth"
] | [((445, 457), 'time.clock', 'time.clock', ([], {}), '()\n', (455, 457), False, 'import time\n'), ((1204, 1227), 'dileptons_functions.DecayWidth', 'df.DecayWidth', (['Zp_model'], {}), '(Zp_model)\n', (1217, 1227), True, 'import dileptons_functions as df\n'), ((1243, 1255), 'time.clock', 'time.clock', ([], {}), '()\n', (... |
from django.core.cache import cache
from django.db.models.signals import post_save
def treenav_save_other_object_handler(sender, instance, created, **kwargs):
"""
This signal attempts to update the HREF of any menu items that point to
another model object, when that objects is saved.
"""
# import ... | [
"django.db.models.signals.post_save.disconnect",
"django.contrib.contenttypes.models.ContentType.objects.get_for_model",
"django.core.cache.cache.delete",
"django.db.models.signals.post_save.connect",
"django.core.cache.cache.set",
"django.core.cache.cache.get"
] | [((588, 608), 'django.core.cache.cache.get', 'cache.get', (['cache_key'], {}), '(cache_key)\n', (597, 608), False, 'from django.core.cache import cache\n'), ((1426, 1478), 'django.db.models.signals.post_save.connect', 'post_save.connect', (['treenav_save_other_object_handler'], {}), '(treenav_save_other_object_handler)... |
import wx
from wx import glcanvas
import sys
import math
import os
full_path_here = os.path.abspath( __file__ )
full_path_here = full_path_here.replace("\\", "/")
slash = full_path_here.rfind("/")
res_folder = full_path_here
if slash != -1:
res_folder = full_path_here[0:slash]
class GraphicsCanvas(gl... | [
"wx.PaintDC",
"wx.GetApp",
"wx.BitmapFromImage",
"wx.Image",
"wx.glcanvas.GLCanvas.__init__",
"wx.Menu",
"os.path.abspath",
"wx.glcanvas.GLContext"
] | [((91, 116), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (106, 116), False, 'import os\n'), ((377, 520), 'wx.glcanvas.GLCanvas.__init__', 'glcanvas.GLCanvas.__init__', (['self', 'parent', '(-1)'], {'attribList': '[glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER, glcanvas.\n WX_GL_DEPTH... |
from torchvision.datasets import CIFAR10
from torchvision.transforms import Pad, RandomAffine
class ScatteredCIFAR10(CIFAR10):
def __init__(self, root, train=True, transform=None, target_transform=None, download=False, pad=32, translate=0.4):
super().__init__(root, train=train, target_transform=target_tra... | [
"torchvision.transforms.Pad",
"torchvision.transforms.RandomAffine"
] | [((463, 471), 'torchvision.transforms.Pad', 'Pad', (['pad'], {}), '(pad)\n', (466, 471), False, 'from torchvision.transforms import Pad, RandomAffine\n'), ((495, 544), 'torchvision.transforms.RandomAffine', 'RandomAffine', (['(0)'], {'translate': '(translate, translate)'}), '(0, translate=(translate, translate))\n', (5... |