code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright The IETF Trust 2020, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-03-18 16:18
from __future__ import unicode_literals
from django.db import migrations
def cancel_sessions(apps, schema_editor):
Session = apps.get_model('meeting', 'Session')
SchedulingEvent = ap... | [
"django.db.migrations.RunPython"
] | [((1449, 1495), 'django.db.migrations.RunPython', 'migrations.RunPython', (['cancel_sessions', 'reverse'], {}), '(cancel_sessions, reverse)\n', (1469, 1495), False, 'from django.db import migrations\n')] |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""This config file is for running experiments needed for the EMNLP camera ready.
It will generate the following experiments (depending on the value of eval_split and model):
- 100 dev examples
- GPT-3 Constrained Canonical, n = 1000
- GPT-3 C... | [
"semantic_parsing_with_constrained_lm.lm_openai_gpt3.IncrementalOpenAIGPT3",
"semantic_parsing_with_constrained_lm.configs.lib.common.make_semantic_parser",
"semantic_parsing_with_constrained_lm.search.StartsWithSpacePartialParse",
"semantic_parsing_with_constrained_lm.fit_max_steps.compute_and_print_fit",
... | [((2847, 3082), 'semantic_parsing_with_constrained_lm.domains.qdmr_break.BreakPieces.build', 'BreakPieces.build', ([], {'tokenizer': 'lm.tokenizer', 'data_type': 'output_type', 'train_sampling_type': 'BreakSamplingType.proportional', 'test_sampling_type': 'BreakSamplingType.random', 'train_total': 'train_size', 'test_t... |
# ___________________________________________________________________________
#
# EGRET: Electrical Grid Research and Engineering Tools
# Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains certain r... | [
"pyomo.core.expr.numeric_expr.LinearExpression",
"pyomo.environ.Expression",
"pyomo.environ.Constraint",
"math.radians",
"egret.model_library.decl.declare_expr",
"egret.model_library.decl.declare_set",
"egret.model_library.decl.declare_var"
] | [((1025, 1091), 'egret.model_library.decl.declare_var', 'decl.declare_var', (['"""vr"""'], {'model': 'model', 'index_set': 'index_set'}), "('vr', model=model, index_set=index_set, **kwargs)\n", (1041, 1091), True, 'import egret.model_library.decl as decl\n'), ((1234, 1300), 'egret.model_library.decl.declare_var', 'decl... |
import os
from pymco.test import ctxt
from . import base
class RabbitMQTestCase(base.IntegrationTestCase):
'''RabbitMQ integration test case.'''
CTXT = {
'connector': 'rabbitmq',
'plugin.rabbitmq.vhost': '/mcollective',
'plugin.rabbitmq.pool.size': '1',
'plugin.rabbitmq.pool.... | [
"os.path.join"
] | [((1408, 1450), 'os.path.join', 'os.path.join', (['ctxt.ROOT', '"""fixtures/ca.pem"""'], {}), "(ctxt.ROOT, 'fixtures/ca.pem')\n", (1420, 1450), False, 'import os\n'), ((1549, 1605), 'os.path.join', 'os.path.join', (['ctxt.ROOT', '"""fixtures/activemq_private.pem"""'], {}), "(ctxt.ROOT, 'fixtures/activemq_private.pem')\... |
import contextlib
import functools
import io
import os
from pathlib import Path
from typing import Callable, Union, Dict, Optional
import babel.localedata
from babel.core import Locale
__all__ = [
"get_locale",
"set_locale",
"reload_locales",
"cog_i18n",
"Translator",
"get_babel_locale",
]
_c... | [
"contextlib.suppress",
"pathlib.Path",
"babel.core.Locale.negotiate",
"functools.lru_cache",
"babel.core.Locale"
] | [((4597, 4618), 'functools.lru_cache', 'functools.lru_cache', ([], {}), '()\n', (4616, 4618), False, 'import functools\n'), ((4121, 4168), 'contextlib.suppress', 'contextlib.suppress', (['IOError', 'FileNotFoundError'], {}), '(IOError, FileNotFoundError)\n', (4140, 4168), False, 'import contextlib\n'), ((3408, 3427), '... |
#!/bin/env/python3
import sys
import os
import argparse
#location = '.'
#suffix = '.py'
def get_filelist(location, suffix = None, recursive = False):
""" Get a list of files in a directory and optionally its subdirs,
with optional suffix matching requirement."""
if recursive == False:
if suffix is No... | [
"os.walk",
"os.path.join",
"os.listdir"
] | [((556, 573), 'os.walk', 'os.walk', (['location'], {}), '(location)\n', (563, 573), False, 'import os\n'), ((361, 381), 'os.listdir', 'os.listdir', (['location'], {}), '(location)\n', (371, 381), False, 'import os\n'), ((428, 448), 'os.listdir', 'os.listdir', (['location'], {}), '(location)\n', (438, 448), False, 'impo... |
import csv
from django.core.management.base import BaseCommand
from django.utils.text import slugify
from dcim.models import Site
from tenancy.models import Tenant
from sidekick.utils import MEMBER_TYPES
class Command(BaseCommand):
help = "Import existing members"
def add_arguments(self, parser):
... | [
"dcim.models.Site.objects.get",
"tenancy.models.Tenant.objects.get",
"csv.reader",
"django.utils.text.slugify"
] | [((896, 915), 'csv.reader', 'csv.reader', (['csvfile'], {}), '(csvfile)\n', (906, 915), False, 'import csv\n'), ((1531, 1560), 'tenancy.models.Tenant.objects.get', 'Tenant.objects.get', ([], {'name': 'name'}), '(name=name)\n', (1549, 1560), False, 'from tenancy.models import Tenant\n'), ((3528, 3555), 'dcim.models.Site... |
import json
import os
import shutil
import functools
import re
import requests
from unidecode import unidecode as udecode
from PIL import Image
from slugify import slugify
class ImageNotFound(Exception):
pass
def parse_string(string):
if string is None:
return None
return string.strip()
clas... | [
"json.dump",
"slugify.slugify",
"os.makedirs",
"ipdb.set_trace",
"PIL.Image.open",
"re.findall",
"requests.get",
"shutil.copyfileobj",
"os.path.join"
] | [((2834, 2877), 'os.makedirs', 'os.makedirs', (['self.image_path'], {'exist_ok': '(True)'}), '(self.image_path, exist_ok=True)\n', (2845, 2877), False, 'import os\n'), ((3522, 3536), 'slugify.slugify', 'slugify', (['value'], {}), '(value)\n', (3529, 3536), False, 'from slugify import slugify\n'), ((4015, 4045), 'reques... |
import sys, os
sys.path.append('yolov3_detector')
from yolov3_custom_helper import yolo_detector
from darknet import Darknet
sys.path.append('pytorch-YOLOv4')
from tool.darknet2pytorch import Darknet as DarknetYolov4
import argparse
import cv2,time
import numpy as np
from tool.plateprocessing import find_coordinates, p... | [
"sys.path.append",
"os.path.join",
"pandas.concat",
"cv2.cvtColor",
"pandas.read_csv",
"cv2.waitKey",
"cv2.imshow",
"tool.utils.plot_boxes_cv2",
"utility_codes.tsv_converter.ConverterTSV",
"cv2.destroyAllWindows",
"tool.darknet2pytorch.Darknet",
"os.listdir",
"cv2.resize"
] | [((15, 49), 'sys.path.append', 'sys.path.append', (['"""yolov3_detector"""'], {}), "('yolov3_detector')\n", (30, 49), False, 'import sys, os\n'), ((125, 158), 'sys.path.append', 'sys.path.append', (['"""pytorch-YOLOv4"""'], {}), "('pytorch-YOLOv4')\n", (140, 158), False, 'import sys, os\n'), ((662, 683), 'tool.darknet2... |
#! /usr/bin/env python
__author__ = "<NAME>"
__copyright__ = "Copyright 2021, ningh"
__credits__ = [ "<NAME>" ]
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = [ "<NAME>" ]
__email__ = [ "<EMAIL>" ]
__status__ = "Beta"
import subprocess, json, socket, psutil, os, wmi
from pymongo import MongoCl... | [
"pymongo.MongoClient",
"psutil.virtual_memory",
"json.load",
"os.path.dirname",
"wmi.WMI",
"os.environ.get",
"socket.gethostname",
"psutil.cpu_count"
] | [((421, 461), 'pymongo.MongoClient', 'MongoClient', (['"""mongodb://127.0.0.1:27017"""'], {}), "('mongodb://127.0.0.1:27017')\n", (432, 461), False, 'from pymongo import MongoClient\n'), ((517, 526), 'wmi.WMI', 'wmi.WMI', ([], {}), '()\n', (524, 526), False, 'import subprocess, json, socket, psutil, os, wmi\n'), ((991,... |
# -*- coding: utf-8 -*-
#
# MAPCore class: mAP Core API handling
#
# @COPYRIGHT@
#
import sys
import time
import json
import logging
import hashlib
import requests
from urllib.parse import urlencode
from django.utils import timezone
from django.db import transaction
from osf.models.user import OSFUser
from website.s... | [
"json.loads",
"urllib.parse.urlencode",
"django.utils.timezone.now",
"sys._getframe",
"time.sleep",
"time.time",
"json.dumps",
"requests.post",
"osf.models.user.OSFUser.objects.select_for_update",
"django.db.transaction.atomic",
"logging.getLogger"
] | [((2289, 2316), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2306, 2316), False, 'import logging\n'), ((5211, 5228), 'urllib.parse.urlencode', 'urlencode', (['params'], {}), '(params)\n', (5220, 5228), False, 'from urllib.parse import urlencode\n'), ((5307, 5392), 'requests.post', 'req... |
import openpyxl
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.urls import reverse
from datetime import datetime, timedelta
from dateutil import tz, parser
from tutorial.auth_helper import get_sign_in_flow, get_token_from_code, store_user, remove_user_and_toke... | [
"dateutil.parser.parse",
"tutorial.auth_helper.get_sign_in_flow",
"tutorial.auth_helper.remove_user_and_token",
"tutorial.auth_helper.get_token_from_code",
"tutorial.auth_helper.store_user",
"dateutil.tz.gettz",
"tutorial.auth_helper.get_token",
"openpyxl.load_workbook",
"django.urls.reverse",
"da... | [((487, 533), 'django.shortcuts.render', 'render', (['request', '"""tutorial/home.html"""', 'context'], {}), "(request, 'tutorial/home.html', context)\n", (493, 533), False, 'from django.shortcuts import render\n'), ((1077, 1095), 'tutorial.auth_helper.get_sign_in_flow', 'get_sign_in_flow', ([], {}), '()\n', (1093, 109... |
import os
import json
import logging
import traceback
from importlib import import_module
class PluginLoader:
def __init__(self):
self.logger = logging.getLogger('newsbot.py')
self.actions = []
self.parsers = []
self.action_dir = 'actions'
self.parser_dir = 'parsers'
... | [
"importlib.import_module",
"os.path.isdir",
"traceback.format_exc",
"os.path.join",
"logging.getLogger"
] | [((158, 189), 'logging.getLogger', 'logging.getLogger', (['"""newsbot.py"""'], {}), "('newsbot.py')\n", (175, 189), False, 'import logging\n'), ((835, 877), 'os.path.join', 'os.path.join', (['self.action_dir', 'plugin_file'], {}), '(self.action_dir, plugin_file)\n', (847, 877), False, 'import os\n'), ((1369, 1411), 'os... |
'''tests for admins endpoints'''
import json
from unittest import TestCase
from manage import Connection
from app import create_app
class TestOrders(TestCase):
'''loads up all confiugration settings'''
def setUp(self):
self.app = create_app("testing")
self.client = self.app.test_client()
... | [
"app.create_app",
"manage.Connection",
"json.dumps"
] | [((249, 270), 'app.create_app', 'create_app', (['"""testing"""'], {}), "('testing')\n", (259, 270), False, 'from app import create_app\n'), ((832, 854), 'json.dumps', 'json.dumps', (['login_data'], {}), '(login_data)\n', (842, 854), False, 'import json\n'), ((1262, 1285), 'json.dumps', 'json.dumps', (['signup_data'], {... |
import hmac
from typing import Optional
from fastapi import FastAPI, Request
from .config import get_config
import logging
import os
import subprocess
import uvicorn
from shellescape import quote
app = FastAPI()
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def run_hooks(repo_config, ... | [
"logging.basicConfig",
"os.getcwd",
"logging.info",
"uvicorn.run",
"shellescape.quote",
"os.chdir",
"logging.getLogger",
"fastapi.FastAPI"
] | [((203, 212), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (210, 212), False, 'from fastapi import FastAPI, Request\n'), ((214, 253), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (233, 253), False, 'import logging\n'), ((263, 290), 'logging.getLogger', 'log... |
#
# import modules
#
from ahvl.options.generate.password import OptionsGeneratePassword
from ahvl.helper import AhvlMsg, AhvlHelper
from passlib import pwd
#
# helper/message
#
msg = AhvlMsg()
hlp = AhvlHelper()
#
# GeneratePassword
#
class GeneratePassword:
def __init__(self, lookup_plugin):
# set look... | [
"ahvl.helper.AhvlMsg",
"ahvl.options.generate.password.OptionsGeneratePassword",
"ahvl.helper.AhvlHelper"
] | [((184, 193), 'ahvl.helper.AhvlMsg', 'AhvlMsg', ([], {}), '()\n', (191, 193), False, 'from ahvl.helper import AhvlMsg, AhvlHelper\n'), ((200, 212), 'ahvl.helper.AhvlHelper', 'AhvlHelper', ([], {}), '()\n', (210, 212), False, 'from ahvl.helper import AhvlMsg, AhvlHelper\n'), ((522, 560), 'ahvl.options.generate.password.... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 23 12:03:59 2017
@author: Kevin
"""
import numpy as np
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import roc_auc_score
from sklearn.model_selection import LeaveOneGroupOut,GridSearchCV
dataPath = 'UTDallas/'
dataName = 'UTD'
nJobs = 12 # Numb... | [
"sklearn.metrics.roc_auc_score",
"numpy.shape",
"numpy.where",
"numpy.arange",
"numpy.loadtxt",
"sklearn.neural_network.MLPClassifier",
"sklearn.model_selection.LeaveOneGroupOut"
] | [((480, 539), 'numpy.loadtxt', 'np.loadtxt', (["(dataPath + dataName + '_all.csv')"], {'delimiter': '""","""'}), "(dataPath + dataName + '_all.csv', delimiter=',')\n", (490, 539), True, 'import numpy as np\n'), ((549, 608), 'numpy.loadtxt', 'np.loadtxt', (["(dataPath + dataName + '_acc.csv')"], {'delimiter': '""","""'}... |
# Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
# vertices: frames x meshVerNum x 3
# trifaces: facePolygonNum x 3 = 22800 x 3
def ComputeNormal(vertices, trifaces):
if vertices.shape[0] > 5000:
print('ComputeNormal: Warning: too big to compute {0}'.format(vertices.shape) )
... | [
"numpy.ravel",
"numpy.cross",
"numpy.zeros",
"numpy.max",
"sklearn.preprocessing.normalize",
"numpy.reshape",
"torch.reshape",
"torch.nn.functional.normalize",
"numpy.unique",
"torch.from_numpy"
] | [((620, 642), 'numpy.reshape', 'np.reshape', (['U', '[-1, 3]'], {}), '(U, [-1, 3])\n', (630, 642), True, 'import numpy as np\n'), ((650, 672), 'numpy.reshape', 'np.reshape', (['V', '[-1, 3]'], {}), '(V, [-1, 3])\n', (660, 672), True, 'import numpy as np\n'), ((690, 704), 'numpy.cross', 'np.cross', (['U', 'V'], {}), '(U... |
import os
import numpy as np
import cv2
import sys
#sys.path.insert(0, '/home/kumarak/Desktop/campus_temp/pred2/')
#import get_dataset_colormap
read="./all_at_100_nocol/"
gtread=open("./thinglabels.txt").readlines()
gt={}
#print(gtread)
for i in gtread:
gt[int(i.split(':')[0])]=i.split(':')[1][1:-1]
#print(gt)
#map=... | [
"cv2.imread",
"os.listdir",
"numpy.unique"
] | [((435, 451), 'os.listdir', 'os.listdir', (['read'], {}), '(read)\n', (445, 451), False, 'import os\n'), ((508, 535), 'cv2.imread', 'cv2.imread', (['(read + filename)'], {}), '(read + filename)\n', (518, 535), False, 'import cv2\n'), ((560, 574), 'numpy.unique', 'np.unique', (['img'], {}), '(img)\n', (569, 574), True, ... |
import cv2
import numpy as np
img = cv2.imread('imagem.jpg')
##img = cv2.imread('imagem3.jpg',0)
cv2.imshow('imagem',img)
img = cv2.GaussianBlur(img, (7, 5), 0)
cv2.imshow('imagemblur',img)
gray_img = cv2.cvtColor(img,cv2.COLOR_RGB2GRAY)
circles = cv2.HoughCircles(gray_img,cv2.HOUGH_GRADIENT,1,30,
... | [
"cv2.GaussianBlur",
"cv2.HoughCircles",
"cv2.circle",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.imread",
"numpy.around",
"cv2.imshow"
] | [((40, 64), 'cv2.imread', 'cv2.imread', (['"""imagem.jpg"""'], {}), "('imagem.jpg')\n", (50, 64), False, 'import cv2\n'), ((103, 128), 'cv2.imshow', 'cv2.imshow', (['"""imagem"""', 'img'], {}), "('imagem', img)\n", (113, 128), False, 'import cv2\n'), ((135, 167), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['img', '(7, 5)... |
# Generated by Django 1.11.10 on 2018-02-27 19:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [("letters", "0017_auto_20180227_1908")]
operations = [
migrations.AlterField(
model_name="letter",
... | [
"django.db.models.OneToOneField"
] | [((356, 528), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""letters_letter_related"""', 'related_query_name': '"""letters_letters"""', 'to': '"""records.Record"""'}), "(on_delete=django.db.models.deletion.CASCADE,\n related_name=... |
# Author: <NAME>
# Date: Nov 13, 2018; revision: Mar 13, 2019
# License: MIT
import torch.nn as nn
import torch.nn.init as init
from torch.nn.init import kaiming_normal_, constant_
activation_functions = {
'relu': nn.ReLU,
'leaky_relu': nn.LeakyReLU,
'elu': nn.ELU,
'sigmoid': nn.Sigmoid,
'tanh': n... | [
"torch.nn.init.kaiming_normal_",
"torch.nn.ConvTranspose2d",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d",
"torch.nn.init.constant_",
"torch.nn.LeakyReLU"
] | [((1895, 2068), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': 'in_channels', 'out_channels': 'out_channels', 'kernel_size': 'kernel_size', 'stride': 'stride', 'padding': 'padding', 'dilation': 'dilation', 'groups': 'groups', 'bias': 'bias'}), '(in_channels=in_channels, out_channels=out_channels, kernel_size=\n ... |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from enum import Enum
from unittest import mock
import numpy as np
import pandas as pd
from ax.core.arm import Arm
f... | [
"ax.core.arm.Arm",
"ax.metrics.chemistry.ChemistryMetric",
"ax.utils.testing.core_stubs.get_trial",
"numpy.isnan"
] | [((1119, 1181), 'ax.metrics.chemistry.ChemistryMetric', 'ChemistryMetric', ([], {'name': '"""test_metric"""', 'problem_type': 'problem_type'}), "(name='test_metric', problem_type=problem_type)\n", (1134, 1181), False, 'from ax.metrics.chemistry import ChemistryMetric, ChemistryProblemType\n'), ((2811, 2822), 'ax.utils.... |
from unittest import mock
from zeit.cms.testcontenttype.testcontenttype import ExampleContentType
import lxml.objectify
import persistent.interfaces
import zeit.cms.interfaces
import zeit.edit.testing
import zeit.edit.tests.fixture
import zope.component
class ElementUniqueIdTest(zeit.edit.testing.FunctionalTestCase):... | [
"unittest.mock.patch",
"unittest.mock.Mock"
] | [((3761, 3772), 'unittest.mock.Mock', 'mock.Mock', ([], {}), '()\n', (3770, 3772), False, 'from unittest import mock\n'), ((1723, 1776), 'unittest.mock.patch', 'mock.patch', (['"""zeit.edit.tests.fixture.Container.index"""'], {}), "('zeit.edit.tests.fixture.Container.index')\n", (1733, 1776), False, 'from unittest impo... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
""" setup.py
The setup for this package.
"""
# Package Header #
from src.hdf5objects.__header__ import *
# Header #
__author__ = __author__
__credits__ = __credits__
__maintainer__ = __maintainer__
__email__ = __email__
# Imports #
# Standard Libraries #
import io
impo... | [
"os.path.basename",
"os.path.dirname",
"glob.glob",
"setuptools.find_packages",
"re.compile"
] | [((1256, 1276), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (1269, 1276), False, 'from setuptools import find_packages\n'), ((642, 659), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (649, 659), False, 'from os.path import dirname\n'), ((1363, 1379), 'glob.glob', '... |
import rospy
from sensor_msgs.msg import PointCloud2
from sensor_msgs import point_cloud2
from geometry_msgs.msg import PoseArray, Pose
from tf.transformations import euler_from_quaternion
import time
import math
import struct
import ctypes
from scipy import ndimage
import matplotlib.pyplot as plt
from nav_msgs.msg im... | [
"rospy.Subscriber",
"sensor_msgs.point_cloud2.read_points",
"matplotlib.pyplot.show",
"matplotlib.pyplot.axes",
"numpy.asarray",
"numpy.zeros",
"rospy.Publisher",
"time.time",
"numpy.append",
"numpy.sin",
"numpy.array",
"rospy.init_node",
"numpy.cos",
"tf.transformations.euler_from_quatern... | [((602, 658), 'rospy.Publisher', 'rospy.Publisher', (['"""/build_map3D"""', 'PoseArray'], {'queue_size': '(1)'}), "('/build_map3D', PoseArray, queue_size=1)\n", (617, 658), False, 'import rospy\n'), ((751, 762), 'time.time', 'time.time', ([], {}), '()\n', (760, 762), False, 'import time\n'), ((810, 839), 'rospy.init_no... |
import re
class HttpRequest:
"""
Parser for HTTP requests
"""
def __init__(self, request):
"""
Accepts an HTTP request bytestring
"""
# Convert from bytes to string
self.request = request.decode("utf-8")
self.requestline = re.match("GET .* HTTP/1.1", s... | [
"re.search",
"re.match"
] | [((291, 332), 're.match', 're.match', (['"""GET .* HTTP/1.1"""', 'self.request'], {}), "('GET .* HTTP/1.1', self.request)\n", (299, 332), False, 'import re\n'), ((361, 400), 're.search', 're.search', (['"""\\\\s.*\\\\s"""', 'self.requestline'], {}), "('\\\\s.*\\\\s', self.requestline)\n", (370, 400), False, 'import re\... |
# Copyright 2018/2019 The RLgraph 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... | [
"tensorflow.cond",
"numpy.argmax",
"tensorflow.identity",
"rlgraph.get_backend",
"torch.cat",
"tensorflow.assign",
"tensorflow.one_hot",
"rlgraph.components.ContainerMerger",
"tensorflow.concat",
"tensorflow.no_op",
"torch.exp",
"tensorflow.exp",
"rlgraph.spaces.BoolBox",
"rlgraph.utils.de... | [((1376, 1389), 'rlgraph.get_backend', 'get_backend', ([], {}), '()\n', (1387, 1389), False, 'from rlgraph import get_backend\n'), ((5665, 5700), 'rlgraph.utils.decorators.rlgraph_api', 'rlgraph_api', ([], {'must_be_complete': '(False)'}), '(must_be_complete=False)\n', (5676, 5700), False, 'from rlgraph.utils.decorator... |
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
from constants import START_TAG, STOP_TAG, DEVICE
from helper import argmax, log_sum_exp, hamming_loss, convert_to_char_tensor
from data import tag_vocab, max_word_len, char_vocab, word_vocab
class BiLSTM_CRF(... | [
"torch.nn.utils.rnn.pack_padded_sequence",
"torch.nn.Dropout",
"helper.log_sum_exp",
"helper.convert_to_char_tensor",
"torch.nn.Embedding",
"torch.nn.Conv1d",
"torch.nn.MaxPool1d",
"torch.randn",
"torch.cat",
"torch.full",
"helper.hamming_loss",
"torch.nn.utils.rnn.pad_packed_sequence",
"tor... | [((592, 606), 'helper.hamming_loss', 'hamming_loss', ([], {}), '()\n', (604, 606), False, 'from helper import argmax, log_sum_exp, hamming_loss, convert_to_char_tensor\n'), ((1009, 1063), 'torch.nn.Embedding', 'nn.Embedding', (['vocab_size', 'embedding_dim'], {'padding_idx': '(0)'}), '(vocab_size, embedding_dim, paddin... |
"""Provides a QtPluginSorter that allows the user to change plugin call order.
"""
from typing import List, Optional, Union
from qtpy.QtCore import QEvent, Qt, Signal, Slot
from qtpy.QtWidgets import (
QCheckBox,
QComboBox,
QDialog,
QFrame,
QGraphicsOpacityEffect,
QHBoxLayout,
QLabel,
Q... | [
"qtpy.QtWidgets.QCheckBox",
"qtpy.QtWidgets.QHBoxLayout",
"qtpy.QtWidgets.QLabel",
"qtpy.QtWidgets.QVBoxLayout",
"qtpy.QtWidgets.QGraphicsOpacityEffect",
"qtpy.QtWidgets.QListWidgetItem",
"qtpy.QtCore.Signal",
"qtpy.QtCore.Slot",
"qtpy.QtWidgets.QComboBox"
] | [((3900, 3912), 'qtpy.QtCore.Signal', 'Signal', (['list'], {}), '(list)\n', (3906, 3912), False, 'from qtpy.QtCore import QEvent, Qt, Signal, Slot\n'), ((6659, 6669), 'qtpy.QtCore.Slot', 'Slot', (['list'], {}), '(list)\n', (6663, 6669), False, 'from qtpy.QtCore import QEvent, Qt, Signal, Slot\n'), ((1630, 1658), 'qtpy.... |
import unittest
from unittest import mock
from easybill_rest import Client
from easybill_rest.resources.resource_logins import ResourceLogins
from easybill_rest.tests.test_case_abstract import EasybillRestTestCaseAbstract
class TestResourceLogins(unittest.TestCase, EasybillRestTestCaseAbstract):
def setUp(self)... | [
"easybill_rest.resources.resource_logins.ResourceLogins",
"unittest.mock.Mock",
"easybill_rest.Client"
] | [((354, 365), 'unittest.mock.Mock', 'mock.Mock', ([], {}), '()\n', (363, 365), False, 'from unittest import mock\n'), ((395, 421), 'unittest.mock.Mock', 'mock.Mock', ([], {'return_value': '{}'}), '(return_value={})\n', (404, 421), False, 'from unittest import mock\n'), ((451, 480), 'easybill_rest.resources.resource_log... |
import os
from PIL import Image
import numpy as np
## 图像数据集的均值与方差的计算
root_path = '../train_data'
_filename = os.listdir(root_path)
filename = []
for _file in _filename:
if not _file.endswith('.txt'):
filename.append(_file)
#均值之和
R_channel_m = 0
G_channel_m = 0
B_channel_m = 0
#方差之和
R_channel_s = 0
G_ch... | [
"numpy.sum",
"numpy.power",
"numpy.array",
"os.path.join",
"os.listdir",
"numpy.sqrt"
] | [((112, 133), 'os.listdir', 'os.listdir', (['root_path'], {}), '(root_path)\n', (122, 133), False, 'import os\n'), ((1446, 1472), 'numpy.sqrt', 'np.sqrt', (['(B_channel_s / num)'], {}), '(B_channel_s / num)\n', (1453, 1472), True, 'import numpy as np\n'), ((1479, 1505), 'numpy.sqrt', 'np.sqrt', (['(G_channel_s / num)']... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020. Distributed under the terms of the MIT License.
from pydefect.cli.vasp.make_unitcell import make_unitcell_from_vasp
from pymatgen.io.vasp import Vasprun, Outcar
def test_unitcell(vasp_files):
"""
HEAD OF MICROSCOPIC STATIC DIELECTRIC TENSOR (INDEPENDENT PARTICLE... | [
"pymatgen.io.vasp.Vasprun",
"pymatgen.io.vasp.Outcar"
] | [((1057, 1091), 'pymatgen.io.vasp.Vasprun', 'Vasprun', (["(path / 'vasprun-band.xml')"], {}), "(path / 'vasprun-band.xml')\n", (1064, 1091), False, 'from pymatgen.io.vasp import Vasprun, Outcar\n'), ((1113, 1141), 'pymatgen.io.vasp.Outcar', 'Outcar', (["(path / 'OUTCAR-band')"], {}), "(path / 'OUTCAR-band')\n", (1119, ... |
import argparse
import numpy as np
import torch
import torch.optim as optim
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
from torch.utils import data
from skimage import color
from PIL import Image
import matplotlib.pyplot as plt
from cnn_model import Model
# from cnn_model2... | [
"cnn_model.Model",
"matplotlib.pyplot.show",
"keras.datasets.cifar10.load_data",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"sklearn.model_selection.train_test_split",
"torch.cat",
"torch.Tensor",
"numpy.array",
"torch.utils.data.TensorDataset",
"torch.nn.functional.interpolate",
... | [((2261, 2280), 'keras.datasets.cifar10.load_data', 'cifar10.load_data', ([], {}), '()\n', (2278, 2280), False, 'from keras.datasets import cifar10\n'), ((2357, 2411), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)', 'random_state': '(42)'}), '(X, y, test_size=0.2, ran... |
from django.db import models
from django.contrib.auth.models import BaseUserManager, AbstractUser
from django.core.validators import EmailValidator
from django.contrib.auth.validators import UnicodeUsernameValidator
class UserManager(BaseUserManager):
def validate_email(self, email):
""" Verify email arg... | [
"django.db.models.CharField",
"django.db.models.EmailField"
] | [((2185, 2420), 'django.db.models.EmailField', 'models.EmailField', ([], {'verbose_name': '"""email address"""', 'error_messages': "{'unique': 'A user with that email already exists.'}", 'help_text': '"""Required. 150 characters or fewer."""', 'max_length': '(150)', 'unique': '(True)', 'validators': '[EmailValidator]'}... |
import math
# Triangle Solver
print("Welcome to the Right Triangle Solver App.")
side_a = float(input("\nWhat is the first leg of the triangle: "))
side_b = float(input("What is the second leg of the triangle: "))
# Calculations
side_c = math.sqrt(side_a**2 + side_b**2)
side_c = round(side_c, 3)
area = 0.5 * side... | [
"math.sqrt"
] | [((243, 279), 'math.sqrt', 'math.sqrt', (['(side_a ** 2 + side_b ** 2)'], {}), '(side_a ** 2 + side_b ** 2)\n', (252, 279), False, 'import math\n')] |
# Copyright 2020 Petuum, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | [
"pkg_resources.get_distribution",
"logging.basicConfig",
"multiprocessing.set_start_method",
"portpicker.pick_unused_port",
"semver.VersionInfo.isvalid",
"sys.platform.lower",
"requests.get",
"logging.getLogger"
] | [((1214, 1253), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (1233, 1253), False, 'import logging\n'), ((1260, 1287), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1277, 1287), False, 'import logging\n'), ((626, 646), 'sys.plat... |
import myutils
from torch.nn import Module, Parameter
import torch.nn.functional as F
import torch
import torch.nn as nn
import numpy as np
class TripletLoss(Module):
def __init__(self, instance, margin=1.0):
super(TripletLoss, self).__init__()
self.margin = margin
self.instance = instance
... | [
"torch.mean",
"torch.t",
"torch.from_numpy",
"torch.eye",
"torch.where",
"torch.exp",
"numpy.where",
"torch.max",
"torch.arange",
"torch.nn.functional.log_softmax",
"torch.pow",
"torch.zeros",
"torch.tensor",
"torch.no_grad",
"torch.sum",
"torch.min",
"numpy.unique",
"torch.transpo... | [((564, 601), 'torch.arange', 'torch.arange', (['(0)', 'nB'], {'dtype': 'torch.long'}), '(0, nB, dtype=torch.long)\n', (576, 601), False, 'import torch\n'), ((2262, 2299), 'torch.arange', 'torch.arange', (['(0)', 'nB'], {'dtype': 'torch.long'}), '(0, nB, dtype=torch.long)\n', (2274, 2299), False, 'import torch\n'), ((3... |
"""
GraphQL + Relay interface to Rough Trade Calendar data.
"""
import django_filters
import graphene
import graphene.relay
from graphene_django import DjangoObjectType
from graphene_django.filter import DjangoFilterConnectionField
from rough_trade_calendar import models
class CountConnection(graphene.Connection):
... | [
"django_filters.OrderingFilter",
"graphene_django.filter.DjangoFilterConnectionField",
"django_filters.DateTimeFilter",
"graphene.Int",
"graphene.Schema"
] | [((1846, 1874), 'graphene.Schema', 'graphene.Schema', ([], {'query': 'Query'}), '(query=Query)\n', (1861, 1874), False, 'import graphene\n'), ((403, 417), 'graphene.Int', 'graphene.Int', ([], {}), '()\n', (415, 417), False, 'import graphene\n'), ((709, 756), 'django_filters.DateTimeFilter', 'django_filters.DateTimeFilt... |
#!/usr/bin/env python
import rospy
import numpy
from duckietown_msgs.msg import FSMState, AprilTags, BoolStamped
from std_msgs.msg import String, Int16 #Imports msg
class SRTurnsNode(object):
def __init__(self):
# Save the name of the node
self.node_name = rospy.get_name()
self.turn_type = ... | [
"rospy.Subscriber",
"rospy.Publisher",
"rospy.Rate",
"rospy.loginfo",
"rospy.on_shutdown",
"rospy.init_node",
"rospy.get_name",
"rospy.spin"
] | [((1818, 1867), 'rospy.init_node', 'rospy.init_node', (['"""sr_turns_node"""'], {'anonymous': '(False)'}), "('sr_turns_node', anonymous=False)\n", (1833, 1867), False, 'import rospy\n'), ((1970, 2005), 'rospy.on_shutdown', 'rospy.on_shutdown', (['node.on_shutdown'], {}), '(node.on_shutdown)\n', (1987, 2005), False, 'im... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# moldynplot.relaxation.py
#
# Copyright (C) 2012-2017 <NAME>
# All rights reserved.
#
# This software may be modified and distributed under the terms of the
# BSD license. See the LICENSE file for details.
"""
Processes NMR relaxation and related data
"""
###########... | [
"numpy.abs",
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.argmin",
"numpy.isnan",
"numpy.exp",
"multiprocessing.Queue",
"numpy.random.normal",
"pandas.DataFrame",
"numpy.std",
"numpy.loadtxt",
"pandas.concat",
"re.match",
"scipy.optimize.curve_fit",
"os.path.expandvars",
"panda... | [((1673, 1681), 'multiprocessing.Queue', 'Queue', (['(1)'], {}), '(1)\n', (1678, 1681), False, 'from multiprocessing import Queue, Process\n'), ((1698, 1705), 'multiprocessing.Queue', 'Queue', ([], {}), '()\n', (1703, 1705), False, 'from multiprocessing import Queue, Process\n'), ((5319, 5349), 'pandas.DataFrame.from_i... |
"""
Certain periodic packets are sent by connected MUDs (is-alive, user-cache,
etc). The IMC2 protocol assumes that each connected MUD will capture these and
populate/maintain their own lists of other servers connected. This module
contains stuff like this.
"""
from time import time
class IMC2Mud(object):
... | [
"time.time"
] | [((979, 985), 'time.time', 'time', ([], {}), '()\n', (983, 985), False, 'from time import time\n'), ((2495, 2501), 'time.time', 'time', ([], {}), '()\n', (2499, 2501), False, 'from time import time\n')] |
import numpy as np
import matplotlib.pyplot as plt
import VoigtFit
import pickle
### Fit DLA towards quasar Q1313+1441
### Observed in X-shooter P089.A-0068
z_DLA = 1.7941
logNHI = 21.3, 0.1 # value, uncertainty
# If log(NHI) is not known use:
#logNHI = None
#### Load UVB and VIS data:
UVB_fname = 'data/test_UVB_1... | [
"VoigtFit.DataSet",
"numpy.loadtxt",
"VoigtFit.SaveDataSet"
] | [((424, 458), 'numpy.loadtxt', 'np.loadtxt', (['UVB_fname'], {'unpack': '(True)'}), '(UVB_fname, unpack=True)\n', (434, 458), True, 'import numpy as np\n'), ((487, 521), 'numpy.loadtxt', 'np.loadtxt', (['VIS_fname'], {'unpack': '(True)'}), '(VIS_fname, unpack=True)\n', (497, 521), True, 'import numpy as np\n'), ((533, ... |
import mock
import pytest
from nengo_spinnaker.utils import application
@pytest.mark.parametrize("app_name", ["Arthur", "Robin"])
def test_get_application(app_name):
with mock.patch.object(application, "pkg_resources") as pkg_resources:
pkg_resources.resource_filename.return_value = "Camelot"
# ... | [
"pytest.mark.parametrize",
"mock.patch.object",
"nengo_spinnaker.utils.application.get_application"
] | [((76, 132), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""app_name"""', "['Arthur', 'Robin']"], {}), "('app_name', ['Arthur', 'Robin'])\n", (99, 132), False, 'import pytest\n'), ((178, 225), 'mock.patch.object', 'mock.patch.object', (['application', '"""pkg_resources"""'], {}), "(application, 'pkg_resour... |
from functions import _read, write_lines
import re
a, b = _read("1.en"), _read("1.ne")
# For English
# Joins an incomplete line to the line above
i = 1
while i < len(a):
if re.match("^([a-z0-9])+[^0-9i\.\)]", a[i]):
a[i-1] = a[i-1].strip() + ' ' + a[i].strip()
del(a[i])
else:
i += 1
# Joins ... | [
"functions._read",
"re.match",
"functions.write_lines"
] | [((521, 547), 'functions.write_lines', 'write_lines', (['a', '"""1_bpf.en"""'], {}), "(a, '1_bpf.en')\n", (532, 547), False, 'from functions import _read, write_lines\n'), ((894, 920), 'functions.write_lines', 'write_lines', (['b', '"""1_bpf.ne"""'], {}), "(b, '1_bpf.ne')\n", (905, 920), False, 'from functions import _... |
from time import time
import os
import numpy as np
from scipy.stats import multivariate_normal
from experiments.lnpdfs.create_target_lnpfs import build_Goodwin_grad
from sampler.SVGD.python.svgd import SVGD as SVGD
unknown_params = [1, 2] + np.arange(4, 12).tolist()
num_dimensions = len(unknown_params)
seed=1
target_l... | [
"numpy.atleast_2d",
"os.makedirs",
"os.path.dirname",
"numpy.zeros",
"os.path.exists",
"time.time",
"numpy.array",
"numpy.arange",
"numpy.eye",
"numpy.savez",
"sampler.SVGD.python.svgd.SVGD",
"numpy.sqrt"
] | [((711, 731), 'numpy.atleast_2d', 'np.atleast_2d', (['theta'], {}), '(theta)\n', (724, 731), True, 'import numpy as np\n'), ((1126, 1132), 'time.time', 'time', ([], {}), '()\n', (1130, 1132), False, 'from time import time\n'), ((1227, 1233), 'time.time', 'time', ([], {}), '()\n', (1231, 1233), False, 'from time import ... |
from scipy import stats
import sys
import utils.name_convention as name
from similarity.SimTopicLists import SimTopicLists
if len(sys.argv) <= 1:
src = "pp_reuters"
else:
src = sys.argv[1]
stl = SimTopicLists()
distance_list, rank_list = [], []
jtotal, ktotal, cos_total, kl_total, bha_total = [], [], [], [],... | [
"scipy.stats.kendalltau",
"utils.name_convention.get_output_dir",
"similarity.SimTopicLists.SimTopicLists",
"scipy.stats.pearsonr"
] | [((205, 220), 'similarity.SimTopicLists.SimTopicLists', 'SimTopicLists', ([], {}), '()\n', (218, 220), False, 'from similarity.SimTopicLists import SimTopicLists\n'), ((520, 571), 'utils.name_convention.get_output_dir', 'name.get_output_dir', (['corpus_type', 'topics_count', 'src'], {}), '(corpus_type, topics_count, sr... |
#!/usr/bin/env python
# -*- coding: utf=8 -*-
import click
import fortytwocli.init as init_
import fortytwocli.status as status_
import fortytwocli.project as project
import fortytwocli.util as util
import fortytwocli.ipCalc as ip
@click.group()
def fourtyTwo():
pass
@fourtyTwo.command(help="initializes setti... | [
"fortytwocli.init.init",
"fortytwocli.status.showStatus",
"fortytwocli.project.cloneProject",
"fortytwocli.ipCalc.calc",
"click.group",
"fortytwocli.util.checkConfigExists"
] | [((236, 249), 'click.group', 'click.group', ([], {}), '()\n', (247, 249), False, 'import click\n'), ((343, 355), 'fortytwocli.init.init', 'init_.init', ([], {}), '()\n', (353, 355), True, 'import fortytwocli.init as init_\n'), ((866, 875), 'fortytwocli.ipCalc.calc', 'ip.calc', ([], {}), '()\n', (873, 875), True, 'impor... |
from unittest import TestCase
from grid_path.string_permutations import Permutations
class TestPermutations(TestCase):
def test_get_permutations_with_empty_string(self):
self.assertEqual(Permutations('').get_permutations(), set(['']))
def test_get_permutations_with_one_letter_word(self):
self... | [
"grid_path.string_permutations.Permutations"
] | [((201, 217), 'grid_path.string_permutations.Permutations', 'Permutations', (['""""""'], {}), "('')\n", (213, 217), False, 'from grid_path.string_permutations import Permutations\n'), ((333, 350), 'grid_path.string_permutations.Permutations', 'Permutations', (['"""A"""'], {}), "('A')\n", (345, 350), False, 'from grid_p... |
#!/usr/bin/env python3
# -*- mode: python; coding: utf-8 -*-
# By HarJIT in 2020. MIT/Expat licence.
import os, xml.dom.minidom, shutil, re, glob
svgpresattrs = ("alignment-baseline", "baseline-shift", "clip", "clip-path", "clip-rule", "color",
"color-interpolation", "color-interpolation-filters", "color-profile", "... | [
"os.unlink",
"os.path.basename",
"shutil.move",
"glob.glob",
"re.compile"
] | [((1217, 1242), 're.compile', 're.compile', (['"""(?m)^\\\\s*\n"""'], {}), "('(?m)^\\\\s*\\n')\n", (1227, 1242), False, 'import os, xml.dom.minidom, shutil, re, glob\n'), ((1743, 1780), 'glob.glob', 'glob.glob', (['"""**/*.svg"""'], {'recursive': '(True)'}), "('**/*.svg', recursive=True)\n", (1752, 1780), False, 'impor... |
from sets import Set
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from django.forms import widgets, ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext
from snapboard.models import C... | [
"django.contrib.auth.models.User.objects.get",
"snapboard.models.Category.objects.all",
"django.forms.TextInput",
"django.contrib.auth.models.User.objects.filter",
"snapboard.models.Category.objects.get",
"django.contrib.auth.authenticate",
"django.utils.translation.ugettext_lazy",
"django.forms.Texta... | [((3394, 3458), 'django.contrib.auth.authenticate', 'authenticate', ([], {'username': "scd['username']", 'password': "scd['password']"}), "(username=scd['username'], password=scd['password'])\n", (3406, 3458), False, 'from django.contrib.auth import authenticate\n'), ((442, 492), 'django.forms.Textarea', 'forms.Textare... |
#!/usr/bin/env python
"""
Reads and writes weight data files.
!!! Weight data files must be in Image row ordering (0, 0) in the top-left. !!!
"""
from __future__ import print_function, division
from numpy import *
import gzip
def read_tex_from_file(ioFile):
'''
Reads a .data file into memory.
Inputs:
... | [
"sys.exit",
"gzip.GzipFile"
] | [((592, 632), 'gzip.GzipFile', 'gzip.GzipFile', ([], {'fileobj': 'ioFile', 'mode': '"""rb"""'}), "(fileobj=ioFile, mode='rb')\n", (605, 632), False, 'import gzip\n'), ((2608, 2648), 'gzip.GzipFile', 'gzip.GzipFile', ([], {'fileobj': 'ioFile', 'mode': '"""wb"""'}), "(fileobj=ioFile, mode='wb')\n", (2621, 2648), False, '... |
# Generated by Django 2.0 on 2018-01-20 23:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('customer', '0013_auto_20180120_2322'),
]
operations = [
migrations.AddField(
model_name='pspuser'... | [
"django.db.models.ForeignKey"
] | [((376, 489), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""customer.Deposit"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.CASCADE, to='customer.Deposit')\n", (393, 489), False, 'from... |
"""
Copyright 2021 Nirlep_5252_
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
d... | [
"random.randint",
"random.choice"
] | [((1828, 1860), 'random.choice', 'random.choice', (['(letters + numbers)'], {}), '(letters + numbers)\n', (1841, 1860), False, 'import random\n'), ((1961, 1987), 'random.randint', 'random.randint', (['(1)', 'chances'], {}), '(1, chances)\n', (1975, 1987), False, 'import random\n')] |
import numpy as np
import hypers as hp
class TestLearning:
def setup(self):
self.n3 = np.random.rand(10, 10, 30)
self.n4 = np.random.rand(10, 10, 10, 30)
self.n5 = np.random.rand(10, 10, 10, 2, 30)
self.h3 = hp.hparray(self.n3)
self.h4 = hp.hparray(self.n4)
self.h5... | [
"numpy.random.rand",
"hypers.hparray"
] | [((100, 126), 'numpy.random.rand', 'np.random.rand', (['(10)', '(10)', '(30)'], {}), '(10, 10, 30)\n', (114, 126), True, 'import numpy as np\n'), ((145, 175), 'numpy.random.rand', 'np.random.rand', (['(10)', '(10)', '(10)', '(30)'], {}), '(10, 10, 10, 30)\n', (159, 175), True, 'import numpy as np\n'), ((194, 227), 'num... |
import pytest
from page_object.page.MainPage import MainPage
class TestSelfChoice(object):
def test_price(self):
main = MainPage()
assert main.click_self_choice() | [
"page_object.page.MainPage.MainPage"
] | [((135, 145), 'page_object.page.MainPage.MainPage', 'MainPage', ([], {}), '()\n', (143, 145), False, 'from page_object.page.MainPage import MainPage\n')] |
#! /usr/bin/env python
"""
runcalsaa.py - Module to perform SAA correction in the CALNIC pipeline
(After CALNICA, before CALNICB) by running the PEDSUB, BEP, and SAACLEAN tasks.
PEDSUB is run only to improve the calculations of the SAA persistence and BEP
signature; no pedestal correction is actually applied to the fin... | [
"pyraf.iraf.flprcache",
"os.remove",
"os.rename",
"nictools.nic_rem_persist.NicRemPersist",
"os.path.exists",
"time.strftime",
"pyraf.iraf.pedsub",
"pyraf.iraf.saaclean.unlearn",
"time.time",
"os.path.isfile",
"numpy.where",
"time.localtime",
"astropy.io.fits.open",
"pyraf.iraf.pedsub.unle... | [((3892, 3912), 'astropy.io.fits.open', 'pyfits.open', (['calname'], {}), '(calname)\n', (3903, 3912), True, 'from astropy.io import fits as pyfits\n'), ((6895, 6922), 'os.rename', 'os.rename', (['F_Final', 'calname'], {}), '(F_Final, calname)\n', (6904, 6922), False, 'import os, time, sys\n'), ((7553, 7588), 'astropy.... |
"""
MongoKeyValueStorageImpl
"""
from waves_gateway.common import Injectable, KEY_VALUE_STORAGE_COLLECTION
from waves_gateway.model import PollingState
from waves_gateway.serializer import PollingStateSerializer
from waves_gateway.storage.key_value_storage import KeyValueStorage
from pymongo.collection import Collectio... | [
"waves_gateway.common.Injectable"
] | [((433, 534), 'waves_gateway.common.Injectable', 'Injectable', ([], {'deps': '[KEY_VALUE_STORAGE_COLLECTION, PollingStateSerializer]', 'provides': 'KeyValueStorage'}), '(deps=[KEY_VALUE_STORAGE_COLLECTION, PollingStateSerializer],\n provides=KeyValueStorage)\n', (443, 534), False, 'from waves_gateway.common import I... |
"""
Author: <NAME>
Date : 12/4/19
Brief : Handles the pareto frontier dictionary updates and accessing
Notes :
Copyright 2019 California Institute of Technology. ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
"""
import collections
from collections import Mapping
import copy
import json
import num... | [
"threading.Lock",
"copy.deepcopy"
] | [((797, 813), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (811, 813), False, 'import threading\n'), ((4253, 4288), 'copy.deepcopy', 'copy.deepcopy', (['self.fitness_metrics'], {}), '(self.fitness_metrics)\n', (4266, 4288), False, 'import copy\n')] |
import gym
import numpy as np
from gym_UR3.envs.mujoco import MujocoUR3Env
import time
def main():
env = gym.make('UR3-v0')
Da = env.action_space.shape[0]
obs=env.reset()
start = time.time()
for i in range(100):
env.reset()
print('{}th episode'.format(i+1))
for j i... | [
"numpy.random.uniform",
"numpy.zeros",
"gym.make",
"time.time"
] | [((115, 133), 'gym.make', 'gym.make', (['"""UR3-v0"""'], {}), "('UR3-v0')\n", (123, 133), False, 'import gym\n'), ((201, 212), 'time.time', 'time.time', ([], {}), '()\n', (210, 212), False, 'import time\n'), ((581, 592), 'time.time', 'time.time', ([], {}), '()\n', (590, 592), False, 'import time\n'), ((425, 436), 'nump... |
import datetime
from decimal import Decimal
import unittest
from qstrader.event import FillEvent, OrderEvent, SignalEvent
from qstrader.portfolio_handler import PortfolioHandler
from qstrader.price_handler.base import AbstractTickPriceHandler
from qstrader.compat import queue
class PriceHandlerMock(AbstractTickPrice... | [
"unittest.main",
"qstrader.event.SignalEvent",
"qstrader.event.OrderEvent",
"decimal.Decimal",
"qstrader.portfolio_handler.PortfolioHandler",
"datetime.datetime.utcnow",
"qstrader.compat.queue.Queue"
] | [((4581, 4596), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4594, 4596), False, 'import unittest\n'), ((1296, 1368), 'qstrader.event.OrderEvent', 'OrderEvent', (['sized_order.ticker', 'sized_order.action', 'sized_order.quantity'], {}), '(sized_order.ticker, sized_order.action, sized_order.quantity)\n', (1306, ... |
import os
import numpy as np
from . import __file__ as filepath
__all__ = ["Inoue14"]
class Inoue14(object):
def __init__(self, scale_tau=1.):
"""
IGM absorption from Inoue et al. (2014)
Parameters
----------
scale_tau : float
Parameter multiplied to t... | [
"numpy.zeros_like",
"scipy.interpolate.CubicSpline",
"os.path.dirname",
"numpy.exp",
"numpy.loadtxt",
"os.path.join"
] | [((692, 726), 'os.path.join', 'os.path.join', (['path', '"""LAFcoeff.txt"""'], {}), "(path, 'LAFcoeff.txt')\n", (704, 726), False, 'import os\n'), ((746, 780), 'os.path.join', 'os.path.join', (['path', '"""DLAcoeff.txt"""'], {}), "(path, 'DLAcoeff.txt')\n", (758, 780), False, 'import os\n'), ((801, 834), 'numpy.loadtxt... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
sys.path.append("..")
try:
from datetime import datetime, timezone
import pytz
except Exception as e:
print('Import error {}, check requirements.txt'.format(e))
sys.exit(1)
DATEFORMAT_MISCAN = '%Y-%m-%d %H:%M:%S'
DATEFORMAT_UTC = '%Y-%m-%dT%... | [
"sys.path.append",
"datetime.datetime.today",
"datetime.datetime.strptime",
"pytz.timezone",
"sys.exit"
] | [((59, 80), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (74, 80), False, 'import sys\n'), ((586, 636), 'datetime.datetime.strptime', 'datetime.strptime', (['mi_timestamp', 'DATEFORMAT_MISCAN'], {}), '(mi_timestamp, DATEFORMAT_MISCAN)\n', (603, 636), False, 'from datetime import datetime, timez... |
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from converter.models import Transformation
from .literals import SOURCE_UNCOMPRESS_CHOICE_ASK
from .models import POP3Email, IMAPEmail, WatchFolderSource, WebFormSource
def create_default_document_source(sender, **kwar... | [
"django.utils.translation.ugettext_lazy"
] | [((423, 435), 'django.utils.translation.ugettext_lazy', '_', (['"""Default"""'], {}), "('Default')\n", (424, 435), True, 'from django.utils.translation import ugettext_lazy as _\n')] |
import fileinput
import re
data = ''.join(fileinput.input()).split('\n')
def searchData(target):
return [d for d in data if re.search(target, d) is not None]
# part 1
targets = ['shiny gold']
searched = []
all_bags = []
converged = False
while not converged:
new_targets = []
for t in targe... | [
"fileinput.input",
"re.search",
"re.match"
] | [((46, 63), 'fileinput.input', 'fileinput.input', ([], {}), '()\n', (61, 63), False, 'import fileinput\n'), ((136, 156), 're.search', 're.search', (['target', 'd'], {}), '(target, d)\n', (145, 156), False, 'import re\n'), ((1214, 1235), 're.match', 're.match', (['pattern2', 'b'], {}), '(pattern2, b)\n', (1222, 1235), F... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from icalendar import Calendar, Event
from datetime import datetime, timedelta
from lxml import html
import requests
import argparse
import logging
import secrets
def get_holidays_grouped_by_months(year):
page = requests.get(
"http://www.consultant.ru/law/re... | [
"argparse.ArgumentParser",
"logging.basicConfig",
"datetime.datetime.today",
"logging.warning",
"more_itertools.consecutive_groups",
"secrets.token_hex",
"icalendar.Event",
"lxml.html.fromstring",
"datetime.datetime",
"datetime.timedelta",
"icalendar.Calendar"
] | [((451, 480), 'lxml.html.fromstring', 'html.fromstring', (['page.content'], {}), '(page.content)\n', (466, 480), False, 'from lxml import html\n'), ((976, 983), 'icalendar.Event', 'Event', ([], {}), '()\n', (981, 983), False, 'from icalendar import Calendar, Event\n'), ((1284, 1305), 'secrets.token_hex', 'secrets.token... |
"""
Work in progress for reading some other kind of complex NITF.
"""
__classification__ = "UNCLASSIFIED"
__author__ = "<NAME>"
import logging
from typing import Union, Tuple, List, Optional, Callable, Sequence
import copy
from datetime import datetime
import numpy
from scipy.constants import foot
from sarpy.geomet... | [
"sarpy.io.general.format_function.ComplexFormatFunction._forward_magnitude_theta",
"sarpy.io.complex.sicd_elements.GeoData.SCPType",
"sarpy.io.complex.sicd_elements.RadarCollection.RadarCollectionType",
"sarpy.io.general.format_function.ComplexFormatFunction",
"logging.error",
"sarpy.io.complex.sicd_eleme... | [((2044, 2071), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2061, 2071), False, 'import logging\n'), ((24348, 24410), 'sarpy.io.complex.sicd_elements.SICD.SICDType', 'SICDType', ([], {'CollectionInfo': 'collection_info', 'ImageData': 'image_data'}), '(CollectionInfo=collection_info, I... |
import threading
import time
import airobot.utils.common as arutil
from airobot.ee_tool.simple_gripper_pybullet import SimpleGripperPybullet
from airobot.utils.arm_util import wait_to_reach_jnt_goal
class SimpleGripperMimicPybullet(SimpleGripperPybullet):
"""
A base class for gripper with mimic joints in pyb... | [
"threading.Thread",
"airobot.utils.arm_util.wait_to_reach_jnt_goal",
"time.sleep"
] | [((1917, 1964), 'threading.Thread', 'threading.Thread', ([], {'target': 'self._th_mimic_gripper'}), '(target=self._th_mimic_gripper)\n', (1933, 1964), False, 'import threading\n'), ((5237, 5254), 'time.sleep', 'time.sleep', (['(0.005)'], {}), '(0.005)\n', (5247, 5254), False, 'import time\n'), ((3476, 3671), 'airobot.u... |
#
# This file is part of Bakefile (http://bakefile.org)
#
# Copyright (C) 2008-2013 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limita... | [
"bkl.error.warning",
"passes.remove_disabled_model_parts",
"passes.make_variables_for_missing_props",
"passes.eliminate_superfluous_conditionals",
"bkl.error.Error",
"passes.detect_potential_problems",
"passes.validate_vars",
"passes.normalize_paths_in_model",
"passes.normalize_vars",
"passes.simp... | [((1515, 1551), 'logging.getLogger', 'logging.getLogger', (['"""bkl.interpreter"""'], {}), "('bkl.interpreter')\n", (1532, 1551), False, 'import logging\n'), ((5532, 5576), 'passes.detect_potential_problems', 'passes.detect_potential_problems', (['self.model'], {}), '(self.model)\n', (5564, 5576), False, 'import passes... |
import time
import threading
import serial
import parameter
class Rs232Connection(threading.Thread):
exit = True
stop = True
try:
__ser = serial.Serial(
port='/dev/ttyS0', # Open RPI buit-in serial port
baudrate=9600,
parity=serial.PARITY_NONE,
... | [
"serial.Serial",
"threading.Thread.__init__",
"threading.Thread.start",
"time.sleep"
] | [((170, 316), 'serial.Serial', 'serial.Serial', ([], {'port': '"""/dev/ttyS0"""', 'baudrate': '(9600)', 'parity': 'serial.PARITY_NONE', 'stopbits': 'serial.STOPBITS_ONE', 'bytesize': 'serial.EIGHTBITS', 'timeout': '(1)'}), "(port='/dev/ttyS0', baudrate=9600, parity=serial.PARITY_NONE,\n stopbits=serial.STOPBITS_ONE,... |
from flask import render_template, session, redirect, url_for
from flask_login import login_required
from . import core
@core.route('/', methods=['GET', 'POST'])
@login_required
def index():
return redirect(url_for('aurora.aurora_overview'))
@core.route('/offline.html')
def offline():
return core.send_stati... | [
"flask.url_for"
] | [((213, 246), 'flask.url_for', 'url_for', (['"""aurora.aurora_overview"""'], {}), "('aurora.aurora_overview')\n", (220, 246), False, 'from flask import render_template, session, redirect, url_for\n')] |
# -*- coding: UTF-8 -*-
import numpy as np
import pandas as pd
import torch
import time
from torch.autograd import Variable
import captcha_setting
import my_dataset
from captcha_cnn_model import CNN
def main():
print('开始对图片进行预测')
cnn = CNN()
cnn.eval()
cnn.load_state_dict(torch.load('model.pkl'))
... | [
"pandas.DataFrame",
"torch.autograd.Variable",
"torch.load",
"numpy.hstack",
"time.time",
"captcha_cnn_model.CNN",
"my_dataset.get_predict_data_loader"
] | [((246, 251), 'captcha_cnn_model.CNN', 'CNN', ([], {}), '()\n', (249, 251), False, 'from captcha_cnn_model import CNN\n'), ((383, 419), 'my_dataset.get_predict_data_loader', 'my_dataset.get_predict_data_loader', ([], {}), '()\n', (417, 419), False, 'import my_dataset\n'), ((1442, 1461), 'numpy.hstack', 'np.hstack', (['... |
import os
import yaml
import tornado.ioloop
import tornado.gen
import tornado.web
from job_server.context import JobServerContext
from job_server.routes import PostJobHandler, RunJobHandler
from job_server.db import init_db
def job_server(context):
return tornado.web.Application([
(r'/job/run', RunJobHan... | [
"os.path.realpath",
"job_server.db.init_db"
] | [((738, 754), 'job_server.db.init_db', 'init_db', (['context'], {}), '(context)\n', (745, 754), False, 'from job_server.db import init_db\n'), ((577, 603), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (593, 603), False, 'import os\n')] |
#!/usr/bin/env python3
import requests
import sys
import argparse
import uuid
from time import sleep
from string import Template
def Spray(domain, users, target_url, output_file, wait, verbose, more_verbose, debug):
i = 0
results = []
if verbose or more_verbose:
print("Targeting: " + target_url + "\n")
for... | [
"argparse.ArgumentParser",
"time.sleep",
"requests.post",
"argparse.FileType",
"sys.exit"
] | [((1129, 1201), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Enumerate users against Office365"""'}), "(description='Enumerate users against Office365')\n", (1152, 1201), False, 'import argparse\n'), ((442, 478), 'requests.post', 'requests.post', (['target_url'], {'data': 'body'}), '(t... |
#!/usr/bin/python3
# Script to shape the desired output to be processed (MMODES)
# the datatable way
# @author: <NAME>
# Creation: 09/06/2019
import os
import re
import numpy as np
import datatable as dt
from datatable import f
def log(cons, media):
'''
Writes information of consortium object to file
''... | [
"os.path.isfile",
"datatable.fread",
"numpy.linspace",
"re.compile"
] | [((359, 396), 're.compile', 're.compile', (['"""#+ SIMULATION (\\\\d+) #+"""'], {}), "('#+ SIMULATION (\\\\d+) #+')\n", (369, 396), False, 'import re\n'), ((404, 424), 'os.path.isfile', 'os.path.isfile', (['logf'], {}), '(logf)\n', (418, 424), False, 'import os\n'), ((1072, 1103), 'numpy.linspace', 'np.linspace', (['(d... |
# Copyright 2020 The TensorFlow 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 applica... | [
"tensorflow.python.autograph.pyct.anno.getanno",
"tensorflow.python.autograph.pyct.anno.setanno",
"tensorflow.python.autograph.pyct.qual_names.QN"
] | [((4158, 4186), 'tensorflow.python.autograph.pyct.qual_names.QN', 'qual_names.QN', (['"""__getitem__"""'], {}), "('__getitem__')\n", (4171, 4186), False, 'from tensorflow.python.autograph.pyct import qual_names\n'), ((4215, 4238), 'tensorflow.python.autograph.pyct.qual_names.QN', 'qual_names.QN', (['"""__eq__"""'], {})... |
#!/pxrpythonsubst
#
# Copyright 2018 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... | [
"unittest.main",
"maya.cmds.loadPlugin",
"os.path.abspath",
"maya.standalone.uninitialize",
"maya.cmds.getAttr",
"maya.cmds.usdExport",
"maya.cmds.usdImport",
"pxr.Usd.Stage.Open",
"maya.cmds.objExists",
"maya.standalone.initialize"
] | [((3166, 3192), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (3179, 3192), False, 'import unittest\n'), ((1289, 1314), 'maya.standalone.uninitialize', 'standalone.uninitialize', ([], {}), '()\n', (1312, 1314), False, 'from maya import standalone\n'), ((1366, 1394), 'maya.standalone.i... |
"""
Utility routines for the maximum entropy module.
Most of them are either Python replacements for the corresponding Fortran
routines or wrappers around matrices to allow the maxent module to
manipulate ndarrays, scipy sparse matrices, and PySparse matrices a
common interface.
Perhaps the logsumexp() function belon... | [
"math.exp",
"numpy.log",
"numpy.std",
"numpy.empty",
"numpy.asarray",
"cmath.log",
"numpy.transpose",
"numpy.ones",
"numpy.arange",
"numpy.array",
"numpy.reshape",
"cmath.exp",
"numpy.dot",
"math.log",
"builtins.range",
"doctest.testmod"
] | [((3174, 3199), 'numpy.empty', 'np.empty', (['n'], {'dtype': 'object'}), '(n, dtype=object)\n', (3182, 3199), True, 'import numpy as np\n'), ((6991, 7002), 'math.log', 'math.log', (['s'], {}), '(s)\n', (6999, 7002), False, 'import math\n'), ((25128, 25145), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (25143... |
import six
if six.PY2:
from backports import tempfile
else:
import tempfile
import pytest as pt
import os
from ditto.readers.opendss.read import Reader as Reader_opendss
from ditto.readers.cyme.read import Reader as Reader_cyme
from ditto.writers.json.write import Writer
from ditto.store import Store
import lo... | [
"ditto.store.Store",
"tempfile.TemporaryDirectory",
"os.walk",
"ditto.writers.json.write.Writer",
"os.path.join",
"logging.getLogger"
] | [((355, 382), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (372, 382), False, 'import logging\n'), ((395, 410), 'os.walk', 'os.walk', (['"""data"""'], {}), "('data')\n", (402, 410), False, 'import os\n'), ((531, 538), 'ditto.store.Store', 'Store', ([], {}), '()\n', (536, 538), False, 'f... |
import unittest
from pyatlas import identifier_converters
class IdentifierConvertersTest(unittest.TestCase):
def setUp(self):
pass
def test_osm_conversion(self):
atlas_id = 222222000000
osm_id = 222222
self.assertEqual(osm_id, identifier_converters.get_osm_identifier(atlas_id... | [
"pyatlas.identifier_converters.get_country_code",
"pyatlas.identifier_converters.get_way_section_index",
"pyatlas.identifier_converters.get_osm_identifier"
] | [((271, 321), 'pyatlas.identifier_converters.get_osm_identifier', 'identifier_converters.get_osm_identifier', (['atlas_id'], {}), '(atlas_id)\n', (311, 321), False, 'from pyatlas import identifier_converters\n'), ((407, 457), 'pyatlas.identifier_converters.get_osm_identifier', 'identifier_converters.get_osm_identifier'... |
import numpy as np
def softmax(x, axis=None):
max = np.max(x,axis=axis,keepdims=True)
e_x = np.exp(x - max)
sum = np.sum(e_x,axis=axis,keepdims=True)
f_x = e_x / sum
return f_x | [
"numpy.max",
"numpy.sum",
"numpy.exp"
] | [((57, 92), 'numpy.max', 'np.max', (['x'], {'axis': 'axis', 'keepdims': '(True)'}), '(x, axis=axis, keepdims=True)\n', (63, 92), True, 'import numpy as np\n'), ((101, 116), 'numpy.exp', 'np.exp', (['(x - max)'], {}), '(x - max)\n', (107, 116), True, 'import numpy as np\n'), ((127, 164), 'numpy.sum', 'np.sum', (['e_x'],... |
import cv2
import numpy as np
import statistics as stat
class optical_braille_recognition():
def __init__(self) -> None:
pass
def make_histogram_y(self, img):
'''
Organiza os dados da projeção horizontal na imagem
Entrada:
img -> Array da imagem
... | [
"numpy.zeros",
"cv2.warpAffine",
"numpy.max",
"numpy.array",
"numpy.arange",
"statistics.mode",
"cv2.getRotationMatrix2D"
] | [((467, 483), 'numpy.zeros', 'np.zeros', (['height'], {}), '(height)\n', (475, 483), True, 'import numpy as np\n'), ((1098, 1113), 'numpy.zeros', 'np.zeros', (['width'], {}), '(width)\n', (1106, 1113), True, 'import numpy as np\n'), ((2554, 2573), 'numpy.array', 'np.array', (['distances'], {}), '(distances)\n', (2562, ... |
import time
import pexpect
import re
import subprocess
from pexpect_strip_ansi import StripAnsiSpawn
class BluetoothctlError(Exception):
"""This exception is raised when bluetoothctl fails to start."""
pass
class Bluetoothctl:
"""A wrapper for bluetoothctl utility."""
def __init__(self, log=False):... | [
"re.match",
"subprocess.check_output",
"pexpect_strip_ansi.StripAnsiSpawn",
"time.sleep"
] | [((335, 398), 'subprocess.check_output', 'subprocess.check_output', (['"""rfkill unblock bluetooth"""'], {'shell': '(True)'}), "('rfkill unblock bluetooth', shell=True)\n", (358, 398), False, 'import subprocess\n'), ((487, 564), 'pexpect_strip_ansi.StripAnsiSpawn', 'StripAnsiSpawn', (['"""bluetoothctl"""'], {'echo': '(... |
import heapq as hq
import math
import numpy as np
from models.geometry_utils import *
# TODO: Generalize to 3D?
class Node:
def __init__(self, pos, parent=None, g_cost=math.inf, f_cost=math.inf):
self.pos = pos
self.parent = parent
self.g_cost = g_cost
self.f_cost =... | [
"heapq.heappush",
"math.ceil",
"math.floor",
"heapq.heappop",
"heapq._siftdown",
"heapq._siftup",
"numpy.array",
"numpy.linalg.norm"
] | [((1065, 1117), 'math.ceil', 'math.ceil', (['((bounds[1][0] - bounds[0][0]) / cell_size)'], {}), '((bounds[1][0] - bounds[0][0]) / cell_size)\n', (1074, 1117), False, 'import math\n'), ((1137, 1189), 'math.ceil', 'math.ceil', (['((bounds[1][1] - bounds[0][1]) / cell_size)'], {}), '((bounds[1][1] - bounds[0][1]) / cell_... |
#!/usr/bin/env python
# import required libraries
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
import sys
import numpy as np
from pyrf.devices.thinkrf import WSA
from pyrf.util import read_data_and_context
from pyrf.numpy_util import compute_fft
# plot constants
CENTER_FREQ = 2450 * 1e6
SAMPLE_SIZE... | [
"pyrf.util.read_data_and_context",
"pyqtgraph.Qt.QtGui.QApplication.instance",
"pyqtgraph.Qt.QtCore.QTimer",
"pyqtgraph.Qt.QtGui.QInputDialog.getText",
"pyrf.devices.thinkrf.WSA",
"pyrf.numpy_util.compute_fft"
] | [((407, 412), 'pyrf.devices.thinkrf.WSA', 'WSA', ([], {}), '()\n', (410, 412), False, 'from pyrf.devices.thinkrf import WSA\n'), ((2340, 2355), 'pyqtgraph.Qt.QtCore.QTimer', 'QtCore.QTimer', ([], {}), '()\n', (2353, 2355), False, 'from pyqtgraph.Qt import QtGui, QtCore\n'), ((1876, 1915), 'pyrf.util.read_data_and_conte... |
import picamera
from time import sleep
import os
# Xlib: extension "RANDR" missing on display ":10.0".
#(gpicview:2869):
# GLib-GObject-WARNING **:
# Attempt to add property GtkSettings:
# :gtk-scrolled-window-placement after class was initialised
camera = picamera.PiCamera()
camera.rotation = 180
print ('klick1.py: ... | [
"time.sleep",
"os.system",
"picamera.PiCamera"
] | [((259, 278), 'picamera.PiCamera', 'picamera.PiCamera', ([], {}), '()\n', (276, 278), False, 'import picamera\n'), ((406, 451), 'os.system', 'os.system', (['"""gpicview python-camera.jpg &"""'], {}), "('gpicview python-camera.jpg &')\n", (415, 451), False, 'import os\n'), ((480, 488), 'time.sleep', 'sleep', (['... |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import, unicode_literals
import argparse, os, sys, re, fcntl, time, subprocess, textwrap, threading, signal
# utilities for compatibility.
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
if PY2:
input = raw_input
def... | [
"textwrap.dedent",
"threading.Thread",
"sys.exit",
"signal.signal",
"subprocess.check_call"
] | [((1177, 1188), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (1185, 1188), False, 'import argparse, os, sys, re, fcntl, time, subprocess, textwrap, threading, signal\n'), ((1344, 1386), 'signal.signal', 'signal.signal', (['signal.SIGTERM', 'sig_handler'], {}), '(signal.SIGTERM, sig_handler)\n', (1357, 1386), False, ... |
import cv2
import os
import sys
if sys.version_info[0] == 2:
import xml.etree.cElementTree as ET
else:
import xml.etree.ElementTree as ET
if __name__ == "__main__":
for line in open("MOT17/train/ImageSets/Main/trainval.txt", "r"):
line = line.rstrip()
img_path = os.path.join("M... | [
"xml.etree.ElementTree.parse",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.imread",
"cv2.rectangle",
"cv2.imshow",
"os.path.join"
] | [((305, 358), 'os.path.join', 'os.path.join', (['"""MOT17/train/JPEGImages"""', "(line + '.jpg')"], {}), "('MOT17/train/JPEGImages', line + '.jpg')\n", (317, 358), False, 'import os\n'), ((380, 434), 'os.path.join', 'os.path.join', (['"""MOT17/train/Annotations"""', "(line + '.xml')"], {}), "('MOT17/train/Annotations',... |
# Generated by Django 3.0.3 on 2020-10-28 07:13
from django.db import migrations, models
import profiles.models
class Migration(migrations.Migration):
dependencies = [
('profiles', '0034_auto_20201028_0358'),
]
operations = [
migrations.AlterField(
model_name='profile',
... | [
"django.db.models.ImageField"
] | [((360, 467), 'django.db.models.ImageField', 'models.ImageField', ([], {'default': 'profiles.models.default_image', 'upload_to': 'profiles.models.upload_images_path'}), '(default=profiles.models.default_image, upload_to=profiles\n .models.upload_images_path)\n', (377, 467), False, 'from django.db import migrations, ... |
from datetime import datetime, timedelta
def parse_line(line):
date = datetime.strptime(line[1:17], "%Y-%m-%d %H:%M")
message = line[19:]
return (date, message)
with open('data.txt') as data:
unordered_list = [parse_line(line) for line in data.readlines()]
ordered_list = sorted(unordered_list, key= lambda i ... | [
"datetime.datetime.strptime",
"datetime.timedelta"
] | [((73, 120), 'datetime.datetime.strptime', 'datetime.strptime', (['line[1:17]', '"""%Y-%m-%d %H:%M"""'], {}), "(line[1:17], '%Y-%m-%d %H:%M')\n", (90, 120), False, 'from datetime import datetime, timedelta\n'), ((1235, 1246), 'datetime.timedelta', 'timedelta', ([], {}), '()\n', (1244, 1246), False, 'from datetime impor... |
"""Notifier package responsible for user notification
"""
import json
import logging
import re
import time
import traceback
# std
from abc import ABC, abstractmethod
from dataclasses import dataclass
from json_logic import jsonLogic
from typing import List
from enum import Enum
# Ignore Chiadog alerts about being of... | [
"traceback.print_exc",
"json.loads",
"time.time",
"json_logic.jsonLogic",
"re.search"
] | [((1581, 1592), 'time.time', 'time.time', ([], {}), '()\n', (1590, 1592), False, 'import time\n'), ((3364, 3375), 'time.time', 'time.time', ([], {}), '()\n', (3373, 3375), False, 'import time\n'), ((4320, 4376), 're.search', 're.search', (["ignore['message']", 'event.message', '(re.M | re.I)'], {}), "(ignore['message']... |
import typing
from dataclasses import dataclass
import yaml
if typing.TYPE_CHECKING:
from app.web.app import Application
@dataclass
class Config:
username: str
password: str
def setup_config(app: "Application"):
with open("config/config.yaml", "r") as f:
raw_config = yaml.safe_load(f)
... | [
"yaml.safe_load"
] | [((298, 315), 'yaml.safe_load', 'yaml.safe_load', (['f'], {}), '(f)\n', (312, 315), False, 'import yaml\n')] |
# validated: 2018-03-01 DS b3d643236ddc libraries/driver/include/ctre/phoenix/Motion/TrajectoryPoint.h
from collections import namedtuple
__all__ = ["TrajectoryPoint"]
#: Motion Profile Trajectory Point for use with pushMotionProfileTrajectory
TrajectoryPoint = namedtuple(
"TrajectoryPoint",
[
"posit... | [
"collections.namedtuple"
] | [((265, 425), 'collections.namedtuple', 'namedtuple', (['"""TrajectoryPoint"""', "['position', 'velocity', 'auxiliaryPos', 'profileSlotSelect0',\n 'profileSlotSelect1', 'isLastPoint', 'zeroPos', 'timeDur']"], {}), "('TrajectoryPoint', ['position', 'velocity', 'auxiliaryPos',\n 'profileSlotSelect0', 'profileSlotSe... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
#import difflib
import datetime
import logging
import os
from selenium import webdriver
# from selenium.webdriver.firefox.options import Options
# from selenium import selenium
# from selenium.common.exceptions import TimeoutException
... | [
"os.mkdir",
"logging.FileHandler",
"selenium.webdriver.Firefox",
"logging.StreamHandler",
"os.path.exists",
"urllib.request.urlopen",
"time.sleep",
"logging.Formatter",
"sys.setdefaultencoding",
"selenium.webdriver.firefox.options.Options",
"datetime.datetime.now",
"os.getenv",
"logging.getL... | [((529, 559), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf8"""'], {}), "('utf8')\n", (551, 559), False, 'import sys\n'), ((3623, 3642), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (3640, 3642), False, 'import logging\n'), ((4783, 4818), 'selenium.webdriver.firefox.options.Options', 'web... |
from injector import inject
from domain.operation.GetDataOperationJobExecutionLogList.GetDataOperationJobExecutionLogListMapping import GetDataOperationJobExecutionLogListMapping
from domain.operation.GetDataOperationJobExecutionLogList.GetDataOperationJobExecutionLogListQuery import GetDataOperationJobExecutionLogList... | [
"domain.operation.GetDataOperationJobExecutionLogList.GetDataOperationJobExecutionLogListResponse.GetDataOperationJobExecutionLogListResponse",
"domain.operation.GetDataOperationJobExecutionLogList.GetDataOperationJobExecutionLogListMapping.GetDataOperationJobExecutionLogListMapping.to_dtos"
] | [((1364, 1409), 'domain.operation.GetDataOperationJobExecutionLogList.GetDataOperationJobExecutionLogListResponse.GetDataOperationJobExecutionLogListResponse', 'GetDataOperationJobExecutionLogListResponse', ([], {}), '()\n', (1407, 1409), False, 'from domain.operation.GetDataOperationJobExecutionLogList.GetDataOperatio... |
"""
Copyright (c) 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
"""
import unittest
from wlsdeploy.exception import exception_helper
from wlsdeploy.exception.expection_types import Excep... | [
"wlsdeploy.exception.exception_helper.create_exception"
] | [((429, 537), 'wlsdeploy.exception.exception_helper.create_exception', 'exception_helper.create_exception', (['ExceptionType.CREATE', '"""WLSDPLY-12400"""', '"""createDomain"""', '"""-oracle_home"""'], {}), "(ExceptionType.CREATE, 'WLSDPLY-12400',\n 'createDomain', '-oracle_home')\n", (462, 537), False, 'from wlsdep... |
#!/usr/bin/env python3
from subprocess import check_output
def sed(fn, in_reg_exp, out_reg_exp, inline=True):
""" wrapper around sed """
ret = check_output(["sed", "-i", "s/" + in_reg_exp + "/" + out_reg_exp + "/g", fn])
def clean_block_from_file(fn, block_starts, block_end, replace):
""" cleans everyth... | [
"subprocess.check_output",
"os.walk",
"re.findall",
"re.compile"
] | [((153, 230), 'subprocess.check_output', 'check_output', (["['sed', '-i', 's/' + in_reg_exp + '/' + out_reg_exp + '/g', fn]"], {}), "(['sed', '-i', 's/' + in_reg_exp + '/' + out_reg_exp + '/g', fn])\n", (165, 230), False, 'from subprocess import check_output\n'), ((2648, 2694), 'subprocess.check_output', 'check_output'... |
# -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket 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 la... | [
"synapse.federation.pdu_codec.decode_event_id",
"synapse.federation.pdu_codec.PduCodec",
"synapse.server.HomeServer",
"synapse.federation.units.Pdu",
"synapse.federation.pdu_codec.encode_event_id"
] | [((960, 985), 'synapse.server.HomeServer', 'HomeServer', (['"""blargle.net"""'], {}), "('blargle.net')\n", (970, 985), False, 'from synapse.server import HomeServer\n'), ((1065, 1082), 'synapse.federation.pdu_codec.PduCodec', 'PduCodec', (['self.hs'], {}), '(self.hs)\n', (1073, 1082), False, 'from synapse.federation.pd... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from os.path import join, dirname, exists
from os import makedirs, pardir
FOLDER_REAL_DATA = join(dirname(__file__), 'real_data')
FOLDER_SIMULATOR_INPUT = join(dirname(__file__), 'simulator_input')
FOLDER_REAL_DATA_ANALYSIS = join(FOLDER_REAL_DATA,... | [
"numpy.sum",
"pandas.read_csv",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.figure",
"os.path.join",
"pandas.DataFrame",
"matplotlib.pyplot.close",
"os.path.dirname",
"os.path.exists",
"numpy.cumsum",
"numpy.intersect1d",
"matplotlib.pyplot.xticks",
"numpy.average",
"matplotlib.pyplot.lege... | [((298, 332), 'os.path.join', 'join', (['FOLDER_REAL_DATA', '"""analysis"""'], {}), "(FOLDER_REAL_DATA, 'analysis')\n", (302, 332), False, 'from os.path import join, dirname, exists\n'), ((357, 392), 'os.path.join', 'join', (['pardir', '"""experiments/results"""'], {}), "(pardir, 'experiments/results')\n", (361, 392), ... |
import numpy as np
from numpy import linalg as la
import invprob.sparse as sparse
def fb_lasso(A, y, reg_param, iter_nb, x_ini=None, inertia=False, verbose=False):
''' Use the Forward-Backward algorithm to find a minimizer of:
reg_param*norm(x,1) + 0.5*norm(Ax-y,2)**2
Eventually outputs the f... | [
"numpy.abs",
"numpy.zeros",
"numpy.ones",
"numpy.arange",
"numpy.linalg.norm"
] | [((628, 645), 'numpy.zeros', 'np.zeros', (['iter_nb'], {}), '(iter_nb)\n', (636, 645), True, 'import numpy as np\n'), ((665, 682), 'numpy.zeros', 'np.zeros', (['iter_nb'], {}), '(iter_nb)\n', (673, 682), True, 'import numpy as np\n'), ((719, 750), 'numpy.zeros', 'np.zeros', (['(A.shape[1], iter_nb)'], {}), '((A.shape[1... |