code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# pylint: disable=too-many-lines
"""Test for certbot_apache._internal.configurator AutoHSTS functionality"""
import re
import unittest
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from certbot import errors
from certbot_apache._internal import constants
impo... | [
"util.get_apache_configurator",
"unittest.mock.MagicMock",
"unittest.main",
"util.get_vh_truth",
"unittest.mock.patch"
] | [((1543, 1621), 'unittest.mock.patch', 'mock.patch', (['"""certbot_apache._internal.configurator.ApacheConfigurator.restart"""'], {}), "('certbot_apache._internal.configurator.ApacheConfigurator.restart')\n", (1553, 1621), False, 'from unittest import mock\n'), ((1627, 1713), 'unittest.mock.patch', 'mock.patch', (['"""... |
# Copyright 2019 The KRules Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing,... | [
"krules_core.providers.subject_storage_factory",
"multiprocessing.Process",
"os.environ.get",
"time.sleep",
"krules_core.subject.SubjectExtProperty",
"pytest.raises",
"krules_core.providers.subject_storage_factory.reset_last_overriding",
"krules_core.subject.SubjectProperty",
"dependency_injector.pr... | [((1125, 1177), 'dependency_injector.providers.Factory', 'providers.Factory', (['storage_impl.SubjectsRedisStorage'], {}), '(storage_impl.SubjectsRedisStorage)\n', (1142, 1177), True, 'from dependency_injector import providers as providers\n'), ((1217, 1289), 'os.environ.get', 'os.environ.get', (['"""TEST_REDIS_SUBJECT... |
import matplotlib.pyplot as plt
import torch
import os
import pdb
import gc
import PIL.Image as Image
import torch.nn.functional as F
import torchvision
import numpy as np
from torchvision.transforms import Compose, Normalize, ToTensor
from torch.autograd.variable import Variable
from torch.utils import data
from torch... | [
"torch.autograd.variable.Variable",
"torch.ones",
"transform.ReLabel",
"utils.FCN_metric",
"utils.make_image_grid",
"model.Seg",
"utils.make_label_grid",
"torch.max",
"resnet.resnet50",
"transform.ToSP",
"datetime.datetime.now",
"torchvision.transforms.Normalize",
"transform.ToLabel",
"tra... | [((1599, 1613), 'torch.ones', 'torch.ones', (['(22)'], {}), '(22)\n', (1609, 1613), False, 'import torch\n'), ((1212, 1330), 'dataset.VOCDataSet', 'VOCDataSet', (['"""../datasets/VOC/VOCdevkit/VOC2012/"""'], {'img_transform': 'input_transform', 'label_transform': 'target_transform'}), "('../datasets/VOC/VOCdevkit/VOC20... |
import random
from itertools import product
from django.test import TestCase
from matrixstore.tests.contextmanagers import (
patched_global_matrixstore_from_data_factory,
)
from matrixstore.tests.data_factory import DataFactory
from frontend.utils.bnf_hierarchy import simplify_bnf_codes, _prune_paths
class Tes... | [
"random.sample",
"frontend.utils.bnf_hierarchy._prune_paths",
"frontend.utils.bnf_hierarchy.simplify_bnf_codes",
"random.seed",
"matrixstore.tests.data_factory.DataFactory",
"matrixstore.tests.contextmanagers.patched_global_matrixstore_from_data_factory"
] | [((918, 934), 'random.seed', 'random.seed', (['(123)'], {}), '(123)\n', (929, 934), False, 'import random\n'), ((1884, 1897), 'matrixstore.tests.data_factory.DataFactory', 'DataFactory', ([], {}), '()\n', (1895, 1897), False, 'from matrixstore.tests.data_factory import DataFactory\n'), ((597, 627), 'frontend.utils.bnf_... |
#!/usr/bin/env python
import os
import json
import dbwrapper as dbw
def initSchema():
basepath = '/app/db/tables'
entries = os.listdir(basepath)
with os.scandir(basepath) as entries:
for entry in entries:
if entry.is_file():
print('Running '+ entry.name)
... | [
"dbwrapper.initDb",
"os.listdir",
"dbwrapper.dbEngine.connect",
"os.scandir"
] | [((687, 699), 'dbwrapper.initDb', 'dbw.initDb', ([], {}), '()\n', (697, 699), True, 'import dbwrapper as dbw\n'), ((136, 156), 'os.listdir', 'os.listdir', (['basepath'], {}), '(basepath)\n', (146, 156), False, 'import os\n'), ((167, 187), 'os.scandir', 'os.scandir', (['basepath'], {}), '(basepath)\n', (177, 187), False... |
# coding=utf-8
import json
from os.path import join
from subprocess import Popen
from mock import patch
from jig.tests.testcase import PluginTestCase
from jig.exc import PluginError
from jig.plugins import PluginManager
class TestPluginManager(PluginTestCase):
"""
Test the plugin manager.
"""
def ... | [
"mock.patch.object",
"json.loads",
"os.path.join",
"jig.plugins.PluginManager"
] | [((442, 471), 'jig.plugins.PluginManager', 'PluginManager', (['self.jigconfig'], {}), '(self.jigconfig)\n', (455, 471), False, 'from jig.plugins import PluginManager\n'), ((696, 725), 'jig.plugins.PluginManager', 'PluginManager', (['self.jigconfig'], {}), '(self.jigconfig)\n', (709, 725), False, 'from jig.plugins impor... |
#!/usr/bin/env python3
from nucleus.dataset import DataSet
from nucleus.constants import NETS
import argparse
import cv2
import os
import numpy as np
def get_args():
parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
parser.add_argument("--net")
parser.add_argument("--data_root")
parser.add... | [
"numpy.clip",
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"nucleus.dataset.DataSet",
"numpy.array"
] | [((183, 233), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'fromfile_prefix_chars': '"""@"""'}), "(fromfile_prefix_chars='@')\n", (206, 233), False, 'import argparse\n'), ((1103, 1150), 'nucleus.dataset.DataSet', 'DataSet', (['(input_height, input_width)', 'data_root'], {}), '((input_height, input_width)... |
import json
import subprocess
cmd = subprocess.run(['osascript', '-e', 'tell application "Bunch Beta" to list open bunches'], capture_output=True)
# cmd=subprocess.run(['ruby', 'bunch.rb', '-l'], capture_output=True)
items=cmd.stdout.decode('utf-8')
def make_json_path(p):
return {
"title": p,
"sub... | [
"json.dumps",
"subprocess.run"
] | [((37, 151), 'subprocess.run', 'subprocess.run', (['[\'osascript\', \'-e\', \'tell application "Bunch Beta" to list open bunches\']'], {'capture_output': '(True)'}), '([\'osascript\', \'-e\',\n \'tell application "Bunch Beta" to list open bunches\'], capture_output=True)\n', (51, 151), False, 'import subprocess\n'),... |
from flask_wtf import FlaskForm
from wtforms import StringField, SelectField, DecimalField, IntegerField, SubmitField, PasswordField, BooleanField, DateField
from wtforms.validators import DataRequired, NumberRange, Length, ValidationError, DataRequired, Email, EqualTo
from ftd_main.models import User
#from ftd_main im... | [
"wtforms.DecimalField",
"wtforms.validators.NumberRange",
"wtforms.IntegerField",
"wtforms.validators.Email",
"wtforms.validators.ValidationError",
"ftd_main.models.User.query.filter_by",
"wtforms.BooleanField",
"wtforms.SubmitField",
"wtforms.StringField",
"wtforms.validators.EqualTo",
"wtforms... | [((1270, 1304), 'wtforms.StringField', 'StringField', (['"""End Date dd/mm/yyyy"""'], {}), "('End Date dd/mm/yyyy')\n", (1281, 1304), False, 'from wtforms import StringField, SelectField, DecimalField, IntegerField, SubmitField, PasswordField, BooleanField, DateField\n'), ((1591, 1641), 'wtforms.IntegerField', 'Integer... |
# -*- coding: utf-8 -*-
from mock import patch
import xml.dom.minidom
from tests.unit import unittest
from tests.unit import AWSMockServiceTestCase
from boto.exception import BotoClientError
from boto.s3.connection import S3Connection
from boto.s3.bucket import Bucket
from boto.s3.deletemarker import DeleteMarker
fro... | [
"mock.patch.object",
"boto.s3.bucket.Bucket"
] | [((3923, 3964), 'mock.patch.object', 'patch.object', (['S3Connection', '"""head_bucket"""'], {}), "(S3Connection, 'head_bucket')\n", (3935, 3964), False, 'from mock import patch\n'), ((4639, 4671), 'mock.patch.object', 'patch.object', (['Bucket', '"""_get_all"""'], {}), "(Bucket, '_get_all')\n", (4651, 4671), False, 'f... |
import torch
import torch.nn as nn
import torch.nn.functional as f
import numpy as np
from layers import GraphAttentionLayer
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1. / np.sqrt(fan_in)
return (-lim, lim)
class GAT(nn.Module):
def __init__(self, nfeat, nhid, nclass, dropou... | [
"torch.tanh",
"numpy.sqrt",
"torch.nn.functional.dropout",
"torch.flatten",
"torch.norm",
"torch.nn.Linear",
"layers.GraphAttentionLayer",
"torch.cat"
] | [((207, 222), 'numpy.sqrt', 'np.sqrt', (['fan_in'], {}), '(fan_in)\n', (214, 222), True, 'import numpy as np\n'), ((742, 832), 'layers.GraphAttentionLayer', 'GraphAttentionLayer', (['(nhid * nheads)', 'nclass'], {'dropout': 'dropout', 'alpha': 'alpha', 'concat': '(False)'}), '(nhid * nheads, nclass, dropout=dropout, al... |
import hikari
import lightbulb
from datetime import datetime
class guild(lightbulb.SlashCommand):
description: str = "Get info about guild"
async def callback(self, ctx: lightbulb.SlashCommandContext) -> None:
guild = ctx.get_guild()
guild_createdAt= int(guild.created_at.timestamp())
... | [
"datetime.datetime.now",
"hikari.Embed.add_field"
] | [((445, 678), 'hikari.Embed.add_field', 'hikari.Embed.add_field', ([], {'self': 'guild_embed', 'name': '"""♤ Guild info:"""', 'value': 'f"""**Guild name:** {guild}\n**ID:** {guild.id}\n**Guild was made:** <t:{guild_createdAt}:d> (<t:{guild_createdAt}:R>)\n**Members:** {guild.member_count}"""'}), '(self=guild_embed, nam... |
"""
Simple training loop; Boilerplate that could apply to any arbitrary neural
network, so nothing in this file really has anything to do with GPT
specifically.
"""
from datetime import datetime as dt
import math
import tensorflow as tf
class TrainerConfig:
# optimization parameters
max_epochs = 10
batc... | [
"tensorflow.keras.callbacks.TensorBoard",
"tensorflow.math.cos",
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"tensorflow.cond",
"tensorflow.keras.optimizers.Adam",
"datetime.datetime.now",
"tensorflow.constant",
"tensorflow.cast"
] | [((2005, 2113), 'tensorflow.cond', 'tf.cond', (['less_than', '(lambda : self.learning_rate * lr_mult_warmup)', '(lambda : self.learning_rate * lr_mult)'], {}), '(less_than, lambda : self.learning_rate * lr_mult_warmup, lambda : \n self.learning_rate * lr_mult)\n', (2012, 2113), True, 'import tensorflow as tf\n'), ((... |
"""Clean old tests/builds/etc from the working directory."""
from pathlib import Path
from pavilion import clean
from pavilion import filters
from pavilion import output
from .base_classes import Command
class CleanCommand(Command):
"""Cleans outdated test and series run directories."""
def __init__(self):... | [
"pavilion.clean.delete_builds",
"pavilion.clean.delete_series",
"pavilion.clean.delete_lingering_build_files",
"pavilion.output.fprint",
"pavilion.filters.make_test_run_filter",
"pavilion.clean.delete_tests",
"pavilion.filters.add_test_filter_args"
] | [((854, 890), 'pavilion.filters.add_test_filter_args', 'filters.add_test_filter_args', (['parser'], {}), '(parser)\n', (882, 890), False, 'from pavilion import filters\n'), ((1825, 1887), 'pavilion.output.fprint', 'output.fprint', (['"""Removing Tests..."""'], {'file': 'self.outfile', 'end': 'end'}), "('Removing Tests.... |
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from . import models, serializers
from nomadgram.users import models as user_models
from nomadgram.users import serializers as user_serializers
from nomadgram.images import serializers as image_serial... | [
"nomadgram.images.models.Image.objects.filter",
"rest_framework.response.Response",
"nomadgram.images.serializers.ImageSerializer"
] | [((523, 582), 'nomadgram.images.models.Image.objects.filter', 'image_models.Image.objects.filter', ([], {'location__id': 'location_id'}), '(location__id=location_id)\n', (556, 582), True, 'from nomadgram.images import models as image_models\n'), ((607, 697), 'nomadgram.images.serializers.ImageSerializer', 'image_serial... |
import torch
import numpy as np
from core import predict
def sigmoid_threshold(tensor, threshold=0.5):
"""Applies the sigmoid function to the tensor and thresholds the values
out_tensor = sigmoid(tensor) > threshold
Arguments:
tensor (torch.Tensor): the tensor to threshold.
threshold (sc... | [
"numpy.median",
"core.predict",
"torch.sigmoid",
"torch.tensor",
"numpy.linspace",
"numpy.zeros"
] | [((705, 726), 'torch.sigmoid', 'torch.sigmoid', (['tensor'], {}), '(tensor)\n', (718, 726), False, 'import torch\n'), ((2131, 2190), 'core.predict', 'predict', (['model', 'dataloader'], {'device': 'device', 'ret_targets': '(True)'}), '(model, dataloader, device=device, ret_targets=True)\n', (2138, 2190), False, 'from c... |
from requests import get as rget
from time import sleep
from threading import Thread
from html import escape
from urllib.parse import quote
from telegram import InlineKeyboardMarkup
from telegram.ext import CommandHandler, CallbackQueryHandler
from bot import dispatcher, LOGGER, SEARCH_API_LINK, SEARCH_PLUGINS, get_cl... | [
"bot.helper.telegram_helper.message_utils.editMessage",
"bot.helper.ext_utils.telegraph_helper.telegraph.create_page",
"bot.helper.ext_utils.bot_utils.get_readable_file_size",
"bot.LOGGER.info",
"bot.helper.telegram_helper.message_utils.sendMarkup",
"bot.helper.telegram_helper.message_utils.sendMessage",
... | [((10679, 10820), 'telegram.ext.CommandHandler', 'CommandHandler', (['BotCommands.SearchCommand', 'torser'], {'filters': '(CustomFilters.authorized_chat | CustomFilters.authorized_user)', 'run_async': '(True)'}), '(BotCommands.SearchCommand, torser, filters=CustomFilters.\n authorized_chat | CustomFilters.authorized... |
import os
import yaml
def _replace_desdata(pth, desdata):
"""Replace the NERSC DESDATA path if needed.
Parameters
----------
pth : str
The path string on which to do replacement.
desdata : str
The desired DESDATA. If None, then the path is simply returned as is.
Returns
-... | [
"os.path.join",
"yaml.load",
"os.path.normpath",
"os.path.dirname",
"os.path.basename"
] | [((1196, 1224), 'os.path.basename', 'os.path.basename', (['image_path'], {}), '(image_path)\n', (1212, 1224), False, 'import os\n'), ((1305, 1340), 'os.path.join', 'os.path.join', (['bkg_dir', 'bkg_filename'], {}), '(bkg_dir, bkg_filename)\n', (1317, 1340), False, 'import os\n'), ((1653, 1681), 'os.path.basename', 'os.... |
import datetime
import lxml.html
import re
import requests
from sqlalchemy import or_
import time
from .db import db, Book, User, UserBook, UserKeyword, Setting
def bookInfoFromHtml(tree):
title, titleUrl = titleFromHtml(tree)
image = imageFromHtml(tree)
asin = asinFromUrl(titleUrl)
date ... | [
"time.sleep",
"requests.get",
"re.search"
] | [((1055, 1083), 're.search', 're.search', (['"""/dp/(\\\\w+)"""', 'url'], {}), "('/dp/(\\\\w+)', url)\n", (1064, 1083), False, 'import re\n'), ((1209, 1258), 're.search', 're.search', (['"""(\\\\d{4})/(\\\\d{1,2})/(\\\\d{1,2})"""', 'text'], {}), "('(\\\\d{4})/(\\\\d{1,2})/(\\\\d{1,2})', text)\n", (1218, 1258), False, '... |
# coding: utf-8
# /*##########################################################################
#
# Copyright (C) 2016-2018 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to d... | [
"logging.getLogger"
] | [((1636, 1663), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1653, 1663), False, 'import logging\n')] |
"""
Copyright (c) 2021 Aiven Ltd
See LICENSE for details
"""
from astacus.common.ipc import SnapshotFile
from astacus.coordinator.plugins.clickhouse.parts import (
add_file_to_parts, check_parts_replication, distribute_parts_to_servers, get_frozen_parts_pattern,
group_files_into_parts, Part, PartFile, PartKey
)... | [
"astacus.coordinator.plugins.clickhouse.parts.PartFile",
"astacus.coordinator.plugins.clickhouse.parts.group_files_into_parts",
"uuid.UUID",
"astacus.coordinator.plugins.clickhouse.parts.PartKey",
"pathlib.Path",
"astacus.coordinator.plugins.clickhouse.parts.check_parts_replication",
"astacus.coordinato... | [((1330, 1341), 'uuid.UUID', 'UUID', ([], {'int': 'i'}), '(int=i)\n', (1334, 1341), False, 'from uuid import UUID\n'), ((1962, 2028), 'copy.deepcopy', 'copy.deepcopy', (['[*TABLE_1_PART_1, *TABLE_1_PART_2, *TABLE_1_PART_3]'], {}), '([*TABLE_1_PART_1, *TABLE_1_PART_2, *TABLE_1_PART_3])\n', (1975, 2028), False, 'import c... |
# coding=utf-8
from __future__ import absolute_import, print_function
import os
import json
import torch
from time import time
import numpy as np
import pandas as pd
from sklearn import metrics
from glob import glob
from DataSet.dataset import get_iwildcam_loader, data_prefetcher
from Utils.train_utils import cross_en... | [
"torch.optim.lr_scheduler.MultiStepLR",
"pandas.read_csv",
"Utils.train_utils.get_optimizer",
"torch.cuda.is_available",
"Models.model_factory.create_model",
"numpy.mean",
"os.path.exists",
"Utils.train_utils.mixup_data",
"numpy.random.random",
"os.mkdir",
"glob.glob",
"DataSet.dataset.get_iwi... | [((474, 507), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (497, 507), False, 'import warnings\n'), ((1395, 1433), 'sklearn.metrics.accuracy_score', 'metrics.accuracy_score', (['y_true', 'y_pred'], {}), '(y_true, y_pred)\n', (1417, 1433), False, 'from sklearn import metr... |
# Copyright 2018 Rackspace, US 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
#
# Unless required by applicable law or... | [
"octavia.i18n._",
"octavia.api.drivers.data_models.L7Rule.from_dict",
"octavia.api.drivers.data_models.L7Policy.from_dict",
"octavia.api.drivers.data_models.Listener.from_dict",
"octavia.api.drivers.data_models.Pool.from_dict",
"octavia.common.exceptions.ProviderDriverError",
"octavia.common.exceptions.... | [((1031, 1058), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1048, 1058), True, 'from oslo_log import log as logging\n'), ((2935, 2962), 'copy.deepcopy', 'copy.deepcopy', (['current_dict'], {}), '(current_dict)\n', (2948, 2962), False, 'import copy\n'), ((5377, 5424), 'octavia.api... |
# Copyright (c) 2008-2016, <NAME> <<EMAIL>>
# All rights reserved.
# See LICENSE for details.
"""\
``interval.imath`` --- Mathematical functions for intervals
-----------------------------------------------------------
This module provides transcendental functions with interval argument.
"""
try:
import crlibm
e... | [
"crlibm.cosh_rd",
"crlibm.exp_rd",
"crlibm.tan_rd",
"crlibm.sinh_ru",
"crlibm.cos_rd",
"crlibm.tanpi_ru",
"crlibm.acos_ru",
"crlibm.cos_ru",
"crlibm.sin_ru",
"functools.wraps",
"crlibm.sinpi_ru",
"crlibm.sin_rd",
"sys.stderr.write",
"crlibm.cospi_rd",
"crlibm.acos_rd",
"crlibm.sinpi_rd... | [((359, 463), 'sys.stderr.write', 'sys.stderr.write', (['"""Cannot load crlibm extension. The imath functions will not be available.\n"""'], {}), "(\n 'Cannot load crlibm extension. The imath functions will not be available.\\n'\n )\n", (375, 463), False, 'import sys\n'), ((968, 976), 'functools.wraps', 'wraps', ... |
# -*- coding: utf-8 -*-
"""Functions for building magical KGE model CLIs."""
import inspect
import json
import logging
import sys
from typing import Any, Mapping, Optional, Type, Union
import click
from class_resolver import HintOrType
from torch import nn
from . import options
from .options import CLI_OPTIONS
from... | [
"logging.getLogger",
"click.option",
"inspect.signature",
"click.File",
"click.echo",
"sys.exit"
] | [((583, 610), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (600, 610), False, 'import logging\n'), ((1565, 1598), 'inspect.signature', 'inspect.signature', (['model.__init__'], {}), '(model.__init__)\n', (1582, 1598), False, 'import inspect\n'), ((3600, 3695), 'click.option', 'click.opt... |
#!/usr/bin/env python3
"""
Test
"""
from __future__ import print_function
import sys
import random
import logging
import time
# external modules
from colorama import Fore, Style, init
from pyVmomi import vim, vmodl
# custom modules
from cephops import CephOps
from config import Config
from utils import _setup_logging, ... | [
"logging.getLogger",
"sys.exit",
"random.randrange",
"utils._setup_logging",
"config.Config.__init__",
"utils.SshUtil",
"ops.Ops",
"cephops.CephOps",
"sys.exc_info",
"time.time",
"vmwareops.VMwareOps",
"colorama.init"
] | [((426, 453), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (443, 453), False, 'import logging\n'), ((7451, 7471), 'colorama.init', 'init', ([], {'autoreset': '(True)'}), '(autoreset=True)\n', (7455, 7471), False, 'from colorama import Fore, Style, init\n'), ((7490, 7506), 'utils._setup_... |
from concurrent.futures import ThreadPoolExecutor
from io import BytesIO
from typing import Iterator, Optional
import tiledb
def iter_segments(
uri: str,
start_time: Optional[float] = None,
end_time: Optional[float] = None,
max_threads: int = 0,
) -> Iterator[BytesIO]:
"""Fetch the minimum sequen... | [
"concurrent.futures.ThreadPoolExecutor",
"io.BytesIO",
"tiledb.open"
] | [((1266, 1282), 'tiledb.open', 'tiledb.open', (['uri'], {}), '(uri)\n', (1277, 1282), False, 'import tiledb\n'), ((1715, 1733), 'io.BytesIO', 'BytesIO', (['chunks[0]'], {}), '(chunks[0])\n', (1722, 1733), False, 'from io import BytesIO\n'), ((1801, 1844), 'concurrent.futures.ThreadPoolExecutor', 'ThreadPoolExecutor', (... |
import numpy as np
import math
from ..miniworld import MiniWorldEnv, Room
from ..entity import Box
from ..params import DEFAULT_PARAMS
from gym import spaces
class OneRoom(MiniWorldEnv):
"""
Environment in which the goal is to go to a red box
placed randomly in one big room.
"""
def __init__(self,... | [
"gym.spaces.Discrete"
] | [((610, 656), 'gym.spaces.Discrete', 'spaces.Discrete', (['(self.actions.move_forward + 1)'], {}), '(self.actions.move_forward + 1)\n', (625, 656), False, 'from gym import spaces\n')] |
from schematics.models import Model
from schematics.types import StringType, ModelType
class XmsParameterGrouping(Model):
"""
By default operation parameters are generated in the client as method arguments. This behavior can sometimes be undesirable when the number of parameters is high. x-ms-parameter-groupi... | [
"schematics.types.StringType"
] | [((530, 542), 'schematics.types.StringType', 'StringType', ([], {}), '()\n', (540, 542), False, 'from schematics.types import StringType, ModelType\n'), ((613, 625), 'schematics.types.StringType', 'StringType', ([], {}), '()\n', (623, 625), False, 'from schematics.types import StringType, ModelType\n')] |
from pythonforandroid.toolchain import Recipe, shprint, ArchAndroid, current_directory, debug, info, ensure_dir
from os.path import exists, join
import sh
import glob
class PygameRecipe(Recipe):
name = 'pygame'
version = '1.9.1'
url = 'http://pygame.org/ftp/pygame-{version}release.tar.gz'
depends = ['... | [
"os.path.join",
"pythonforandroid.toolchain.ArchAndroid",
"pythonforandroid.toolchain.debug",
"pythonforandroid.toolchain.info",
"pythonforandroid.toolchain.shprint",
"sh.Command",
"pythonforandroid.toolchain.ensure_dir",
"glob.glob"
] | [((565, 608), 'os.path.join', 'join', (['self.ctx.root_dir', '"""tools"""', '"""liblink"""'], {}), "(self.ctx.root_dir, 'tools', 'liblink')\n", (569, 608), False, 'from os.path import exists, join\n'), ((945, 969), 'pythonforandroid.toolchain.ensure_dir', 'ensure_dir', (['liblink_path'], {}), '(liblink_path)\n', (955, ... |
from dragonfly import Function, Repeat, Dictation, Choice, MappingRule
from castervoice.lib.actions import Key, Text
from castervoice.lib.ctrl.mgr.rule_details import RuleDetails
from castervoice.lib.merge.additions import IntegerRefST
from castervoice.lib.merge.state.short import R
def capitalize(text):
output ... | [
"dragonfly.Dictation",
"castervoice.lib.ctrl.mgr.rule_details.RuleDetails",
"dragonfly.Choice",
"castervoice.lib.actions.Text",
"castervoice.lib.merge.additions.IntegerRefST",
"castervoice.lib.actions.Key",
"dragonfly.Function",
"dragonfly.Repeat"
] | [((4469, 4486), 'dragonfly.Dictation', 'Dictation', (['"""dict"""'], {}), "('dict')\n", (4478, 4486), False, 'from dragonfly import Function, Repeat, Dictation, Choice, MappingRule\n'), ((4496, 4513), 'dragonfly.Dictation', 'Dictation', (['"""text"""'], {}), "('text')\n", (4505, 4513), False, 'from dragonfly import Fun... |
# Generated by Django 3.2.7 on 2021-10-03 07:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0361_realm_create_web_public_stream_policy"),
]
operations = [
migrations.AddField(
model_name="realmuserdefault",
... | [
"django.db.models.BooleanField"
] | [((389, 422), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(True)'}), '(default=True)\n', (408, 422), False, 'from django.db import migrations, models\n'), ((578, 611), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(True)'}), '(default=True)\n', (597, 611), False... |
from celery import task
from django.conf import settings
from django.core.cache import cache
from django.core.mail import send_mail
from django.template import loader
from .my_utils import *
import oss2
from io import BytesIO
@task
def send_verify_mail(url,user_id,reveiver):
#发送邮件
title = '欢迎注册'
... | [
"django.core.mail.send_mail",
"io.BytesIO",
"oss2.Auth",
"oss2.Bucket",
"django.template.loader.get_template"
] | [((354, 392), 'django.template.loader.get_template', 'loader.get_template', (['"""user/email.html"""'], {}), "('user/email.html')\n", (373, 392), False, 'from django.template import loader\n'), ((483, 551), 'django.core.mail.send_mail', 'send_mail', (['title', 'content', 'email_from', '[reveiver]'], {'html_message': 'h... |
import pdb
import copy
import bchscript.bchopcodes as bchopcodes
statementConsumerCallout = None
def SetStatementConsumerCallout(t):
global statementConsumerCallout
statementConsumerCallout = t
def compileStatementList(statements, symbols):
ret = []
for s in statements:
if type(s) in [int, ... | [
"copy.copy",
"pdb.set_trace",
"bchscript.bchopcodes.opcode2bin.items"
] | [((9731, 9760), 'bchscript.bchopcodes.opcode2bin.items', 'bchopcodes.opcode2bin.items', ([], {}), '()\n', (9758, 9760), True, 'import bchscript.bchopcodes as bchopcodes\n'), ((2997, 3023), 'copy.copy', 'copy.copy', (['self.invocation'], {}), '(self.invocation)\n', (3006, 3023), False, 'import copy\n'), ((3480, 3498), '... |
# -*- coding:utf-8 -*-
import pytest
# node-semver/test/index.js
cands = [
['1.2.3', 'v1.2.3', True],
['1.2.3', '=1.2.3', True],
['1.2.3', 'v 1.2.3', True],
['1.2.3', '= 1.2.3', True],
['1.2.3', ' v1.2.3', True],
['1.2.3', ' =1.2.3', True],
['1.2.3', ' v 1.2.3', True],
['1.2.3', ' = 1.2... | [
"nodesemver.eq",
"nodesemver.gt",
"nodesemver.lt",
"nodesemver.neq",
"pytest.mark.parametrize",
"nodesemver.gte",
"nodesemver.cmp",
"nodesemver.lte"
] | [((1515, 1562), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""v0, v1, loose"""', 'cands'], {}), "('v0, v1, loose', cands)\n", (1538, 1562), False, 'import pytest\n'), ((1661, 1708), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""v0, v1, loose"""', 'cands'], {}), "('v0, v1, loose', cands)\n", ... |
import gc
import os
import hydra
import torch
from omegaconf import DictConfig
from src.experiment import Experiment
@hydra.main(config_path='conf',
config_name="config_small.yaml")
def main(config: DictConfig):
experiment = Experiment(config)
experiment.run()
# Return the experiment test R... | [
"hydra.main",
"gc.collect",
"src.experiment.Experiment",
"os.system",
"torch.cuda.empty_cache"
] | [((122, 185), 'hydra.main', 'hydra.main', ([], {'config_path': '"""conf"""', 'config_name': '"""config_small.yaml"""'}), "(config_path='conf', config_name='config_small.yaml')\n", (132, 185), False, 'import hydra\n'), ((245, 263), 'src.experiment.Experiment', 'Experiment', (['config'], {}), '(config)\n', (255, 263), Fa... |
# Generated by Django 2.0.13 on 2019-05-19 10:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0009_user_is_streaming'),
]
operations = [
migrations.AlterField(
model_name='channel',
name='channel_name... | [
"django.db.models.CharField"
] | [((341, 419), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(255)', 'unique': '(True)', 'verbose_name': '"""Name"""'}), "(blank=True, max_length=255, unique=True, verbose_name='Name')\n", (357, 419), False, 'from django.db import migrations, models\n')] |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | [
"geojson.dumps",
"cv2.__version__.split",
"geojson.FeatureCollection",
"numpy.unique",
"argparse.ArgumentParser",
"utils.Raster",
"geojson.Polygon",
"cv2.approxPolyDP",
"cv2.findContours",
"codecs.open",
"numpy.zeros_like"
] | [((2355, 2410), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""input parameters"""'}), "(description='input parameters')\n", (2378, 2410), False, 'import argparse\n'), ((1035, 1052), 'utils.Raster', 'Raster', (['mask_path'], {}), '(mask_path)\n', (1041, 1052), False, 'from utils import R... |
#!/usr/bin/env runaiida
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import sys
from aiida.engine import submit
from aiida.orm import load_code
from aiida_siesta.calculations.siesta import SiestaCalculation
from aiida_siesta.data.psf import get_pseudos_from_str... | [
"sys.exit",
"aiida.plugins.DataFactory",
"aiida.engine.submit",
"aiida_siesta.data.psf.get_pseudos_from_structure",
"aiida.orm.load_code"
] | [((492, 517), 'aiida.plugins.DataFactory', 'DataFactory', (['"""siesta.psf"""'], {}), "('siesta.psf')\n", (503, 517), False, 'from aiida.plugins import DataFactory\n'), ((525, 544), 'aiida.plugins.DataFactory', 'DataFactory', (['"""dict"""'], {}), "('dict')\n", (536, 544), False, 'from aiida.plugins import DataFactory\... |
"""Support for media metadata handling."""
from __future__ import annotations
import datetime
import logging
from typing import Any
from soco.core import (
MUSIC_SRC_AIRPLAY,
MUSIC_SRC_LINE_IN,
MUSIC_SRC_RADIO,
MUSIC_SRC_SPOTIFY_CONNECT,
MUSIC_SRC_TV,
SoCo,
)
from soco.data_structures import D... | [
"logging.getLogger",
"homeassistant.helpers.dispatcher.dispatcher_send",
"homeassistant.helpers.config_validation.time_period_str",
"homeassistant.util.dt.utcnow"
] | [((1210, 1237), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1227, 1237), False, 'import logging\n'), ((3653, 3715), 'homeassistant.helpers.dispatcher.dispatcher_send', 'dispatcher_send', (['self.hass', 'SONOS_MEDIA_UPDATED', 'self.soco.uid'], {}), '(self.hass, SONOS_MEDIA_UPDATED, sel... |
#!/usr/bin/env python3
import numpy as np
import cv2
# import tensorflow as tf
import sys
sys.path.append("/home/oyster/Tensorflow/Monk_Object_Detection/13_tf_obj_2/lib/")
# from infer_detector_nano import Infer
# from bag_detection.msg import FlipPos, PathPos
def get_rectangles(mask, threshold_area):
"""
... | [
"cv2.erode",
"cv2.contourArea",
"cv2.morphologyEx",
"numpy.array",
"cv2.cvtColor",
"cv2.findContours",
"sys.path.append",
"cv2.dilate",
"cv2.Canny",
"cv2.getStructuringElement",
"cv2.boundingRect"
] | [((92, 178), 'sys.path.append', 'sys.path.append', (['"""/home/oyster/Tensorflow/Monk_Object_Detection/13_tf_obj_2/lib/"""'], {}), "(\n '/home/oyster/Tensorflow/Monk_Object_Detection/13_tf_obj_2/lib/')\n", (107, 178), False, 'import sys\n'), ((595, 661), 'cv2.findContours', 'cv2.findContours', (['mask', 'cv2.RETR_EX... |
import copy
from .gotypes import Player
class Move():
def __init__(self, point=None, is_pass=False, is_resign=False):
assert (point is not None) ^ is_pass ^ is_resign
self.point = point
self.is_play = (self.point is not None)
self.is_pass = is_pass
self.is_resign = is_resign... | [
"copy.deepcopy"
] | [((5031, 5056), 'copy.deepcopy', 'copy.deepcopy', (['self.board'], {}), '(self.board)\n', (5044, 5056), False, 'import copy\n'), ((5436, 5461), 'copy.deepcopy', 'copy.deepcopy', (['self.board'], {}), '(self.board)\n', (5449, 5461), False, 'import copy\n'), ((4125, 4150), 'copy.deepcopy', 'copy.deepcopy', (['self.board'... |
import os
from collections import Counter, OrderedDict
import torch
class RenormalizeVocab(object):
def __init__(self, vocab_map_fn=None, vocab_fn=None, add_eos=True,
add_double_eos=False, delimiter=None, lower_case=True, special=[]):
self.lock = False
self.delimiter = delimiter
... | [
"torch.zeros_like",
"os.path.exists",
"collections.OrderedDict",
"torch.cat"
] | [((3393, 3406), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (3404, 3406), False, 'from collections import Counter, OrderedDict\n'), ((3872, 3892), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (3886, 3892), False, 'import os\n'), ((4747, 4768), 'torch.cat', 'torch.cat', (['encoded[0]']... |
import os
import imageio
import numpy as np
import torch
from scipy.spatial.distance import pdist
from src.parser.visualize import parser
from src.utils.bvh_export import save_generated_motion
from src.utils.get_model_and_data import get_model_and_data
from src.visualize.anim import plot_3d_motion
class VisualizeLa... | [
"src.visualize.anim.plot_3d_motion",
"torch.as_tensor",
"src.parser.visualize.parser",
"torch.ones",
"numpy.hstack",
"torch.load",
"os.path.join",
"imageio.get_reader",
"torch.cat",
"src.utils.bvh_export.save_generated_motion",
"numpy.random.randint",
"numpy.zeros",
"torch.no_grad",
"torch... | [((5632, 5663), 'imageio.get_writer', 'imageio.get_writer', (['output_path'], {}), '(output_path)\n', (5650, 5663), False, 'import imageio\n'), ((6186, 6194), 'src.parser.visualize.parser', 'parser', ([], {}), '()\n', (6192, 6194), False, 'from src.parser.visualize import parser\n'), ((6537, 6567), 'src.utils.get_model... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import argparse
import numpy as np
import torch
from torch.autograd import Variable
from torchvision.utils import mak... | [
"src.loader.DataSampler",
"src.loader.load_images",
"argparse.ArgumentParser",
"torch.load",
"os.path.isfile",
"numpy.linspace",
"src.logger.create_logger",
"torchvision.utils.make_grid",
"torch.FloatTensor",
"torch.cat"
] | [((499, 557), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Attributes swapping"""'}), "(description='Attributes swapping')\n", (522, 557), False, 'import argparse\n'), ((1632, 1665), 'os.path.isfile', 'os.path.isfile', (['params.model_path'], {}), '(params.model_path)\n', (1646, 1665),... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# See "LICENSE... | [
"os.listdir",
"re.compile",
"os.path.join",
"unittest.main",
"os.path.dirname",
"pylint.epylint.py_run",
"os.path.abspath"
] | [((528, 553), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (543, 553), False, 'import os, pylint, re, sys, unittest\n'), ((1176, 1198), 're.compile', 're.compile', (['""".*\\\\.py$"""'], {}), "('.*\\\\.py$')\n", (1186, 1198), False, 'import os, pylint, re, sys, unittest\n'), ((1205, 1225), ... |
from __future__ import unicode_literals
import json
import datetime
import django
from django.db import models
from django.db.models.fields.related import ForeignObjectRel
from django.db.models.fields import FieldDoesNotExist
from django.utils.encoding import is_protected_type
from django.core.serializers.json import... | [
"json.loads",
"django.utils.timezone.localtime",
"django.utils.timezone.is_naive",
"django.utils.timezone.make_aware",
"django.utils.encoding.is_protected_type",
"django.utils.timezone.is_aware",
"django.utils.timezone.get_default_timezone"
] | [((1124, 1148), 'django.utils.encoding.is_protected_type', 'is_protected_type', (['value'], {}), '(value)\n', (1141, 1148), False, 'from django.utils.encoding import is_protected_type\n'), ((836, 860), 'django.utils.timezone.is_naive', 'timezone.is_naive', (['value'], {}), '(value)\n', (853, 860), False, 'from django.u... |
"""
https://docs.opencv.org/master/d8/d19/tutorial_stitcher.html
Stitching sample (advanced)
===========================
Show how to use Stitcher API from python.
"""
# Python 2/3 compatibility
from __future__ import print_function
import argparse
from collections import OrderedDict
from imutils import paths
import... | [
"numpy.sqrt",
"cv2.normalize",
"cv2.detail.leaveBiggestComponent",
"cv2.samples.findFile",
"numpy.log",
"cv2.detail.BestOf2NearestMatcher_create",
"cv2.PyRotationWarper",
"cv2.imshow",
"cv2.detail.Blender_createDefault",
"cv2.detail.matchesGraphAsString",
"cv2.detail.Timelapser_createDefault",
... | [((372, 385), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (383, 385), False, 'from collections import OrderedDict\n'), ((763, 776), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (774, 776), False, 'from collections import OrderedDict\n'), ((1031, 1044), 'collections.OrderedDict', 'OrderedD... |
import datman.scanid as scanid
import pytest
def test_parse_empty():
with pytest.raises(scanid.ParseException):
scanid.parse("")
def test_parse_None():
with pytest.raises(scanid.ParseException):
scanid.parse(None)
def test_parse_garbage():
with pytest.raises(scanid.ParseException):
... | [
"datman.scanid.parse_filename",
"datman.scanid.get_kcni_identifier",
"datman.scanid.is_scanid",
"datman.scanid.is_scanid_with_session",
"datman.scanid.parse",
"pytest.raises",
"datman.scanid.parse_bids_filename"
] | [((402, 436), 'datman.scanid.parse', 'scanid.parse', (['"""DTI_CMH_H001_01_02"""'], {}), "('DTI_CMH_H001_01_02')\n", (414, 436), True, 'import datman.scanid as scanid\n'), ((658, 693), 'datman.scanid.parse', 'scanid.parse', (['"""DTI_CMH_PHA_ADN0001"""'], {}), "('DTI_CMH_PHA_ADN0001')\n", (670, 693), True, 'import datm... |
try:
from unittest import mock
except ImportError:
import mock
from rest_email_auth import serializers
@mock.patch(
"rest_email_auth.serializers.models.EmailAddress.send_confirmation",
autospec=True,
)
def test_create(mock_send_confirmation, user_factory):
"""
Test creating a new email addres... | [
"mock.patch.object",
"rest_email_auth.serializers.EmailSerializer",
"mock.patch"
] | [((115, 213), 'mock.patch', 'mock.patch', (['"""rest_email_auth.serializers.models.EmailAddress.send_confirmation"""'], {'autospec': '(True)'}), "('rest_email_auth.serializers.models.EmailAddress.send_confirmation',\n autospec=True)\n", (125, 213), False, 'import mock\n'), ((914, 1028), 'mock.patch', 'mock.patch', (... |
from dwave.system.samplers import DWaveSampler
from dwave.system.composites import FixedEmbeddingComposite
embedding = {'x1': {1}, 'x2': {5}, 'z': {0, 4}}
sampler = DWaveSampler()
print(sampler.properties['extended_j_range'])
sampler_embedded = FixedEmbeddingComposite(sampler, embedding)
Q = {('x1', 'x2'): 1, ('x1', ... | [
"dwave.system.samplers.DWaveSampler",
"dwave.system.composites.FixedEmbeddingComposite"
] | [((166, 180), 'dwave.system.samplers.DWaveSampler', 'DWaveSampler', ([], {}), '()\n', (178, 180), False, 'from dwave.system.samplers import DWaveSampler\n'), ((246, 289), 'dwave.system.composites.FixedEmbeddingComposite', 'FixedEmbeddingComposite', (['sampler', 'embedding'], {}), '(sampler, embedding)\n', (269, 289), F... |
#!/usr/bin/env python2.6
#nknguyen at soe ucsc edu
#May 30 2012
#Draw scatter plot of each clones and their size for each pair of samples
#xaxis: Sample 1, yaxis: sample 2
#each dot represents a clonotype with same amino acid, and V and J genes
#
import os, re, sys, copy
from optparse import OptionParser
from immuno... | [
"matplotlib.cm.jet",
"sys.stderr.write",
"optparse.OptionParser",
"sys.exit"
] | [((5377, 5402), 'optparse.OptionParser', 'OptionParser', ([], {'usage': 'usage'}), '(usage=usage)\n', (5389, 5402), False, 'from optparse import OptionParser\n'), ((6099, 6140), 'sys.stderr.write', 'sys.stderr.write', (['"""Done readding pairs\n"""'], {}), "('Done readding pairs\\n')\n", (6115, 6140), False, 'import os... |
import cv2
import numpy as np
from sklearn.cluster import KMeans
def give_shape(n, arena, w_pos, r):
ret, frame = cap.read()
cv2.imwrite("new_a.jpg", frame)
# frame = cv2.imread("new_a.jpg")
frame = frame[int(r[1]):int(r[1] + r[3]), int(r[0]):int(r[0] + r[2])]
shape = frame.shape
... | [
"sklearn.cluster.KMeans",
"cv2.imwrite",
"numpy.ones",
"cv2.inRange",
"cv2.erode",
"cv2.contourArea",
"cv2.moments",
"cv2.findContours",
"numpy.load",
"cv2.boundingRect"
] | [((142, 173), 'cv2.imwrite', 'cv2.imwrite', (['"""new_a.jpg"""', 'frame'], {}), "('new_a.jpg', frame)\n", (153, 173), False, 'import cv2\n'), ((713, 734), 'sklearn.cluster.KMeans', 'KMeans', ([], {'n_clusters': '(12)'}), '(n_clusters=12)\n', (719, 734), False, 'from sklearn.cluster import KMeans\n'), ((960, 984), 'nump... |
"""
This script is an example of how to manipulate cookies both outgoing (requests)
and ingoing (responses). In particular, this script inserts a cookie (specified
in a json file) into every request (overwriting any existing cookie of the same
name), and removes cookies from every response that have a certain set of na... | [
"json.load"
] | [((1083, 1095), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1092, 1095), False, 'import json\n')] |
from loguru import logger
from discourtesy.utils import simple_message
class Dispatch:
def __init__(self):
self.commands = dict()
self.components = dict()
def add_command(self, command):
self.commands[command.name] = command
def add_component(self, component):
self.compo... | [
"discourtesy.utils.simple_message",
"loguru.logger.warning"
] | [((570, 631), 'loguru.logger.warning', 'logger.warning', (['f"""Command {command_name} could not be found."""'], {}), "(f'Command {command_name} could not be found.')\n", (584, 631), False, 'from loguru import logger\n'), ((652, 710), 'discourtesy.utils.simple_message', 'simple_message', (['"""This command is currently... |
# Generated by Django 3.1.6 on 2021-08-26 19:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('jobs', '0017_merge_20210826_1952'),
]
operations = [
migrations.DeleteModel(
name='HistoricalJob',
),
]
| [
"django.db.migrations.DeleteModel"
] | [((225, 269), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""HistoricalJob"""'}), "(name='HistoricalJob')\n", (247, 269), False, 'from django.db import migrations\n')] |
""" Checks that reversed() receive proper argument """
# pylint: disable=missing-docstring, useless-object-inheritance
# pylint: disable=too-few-public-methods,no-self-use,no-absolute-import
from collections import deque, OrderedDict
from enum import IntEnum
class GoodReversed(object):
""" Implements __reversed__... | [
"collections.OrderedDict",
"collections.deque"
] | [((1740, 1749), 'collections.deque', 'deque', (['[]'], {}), '([])\n', (1745, 1749), False, 'from collections import deque, OrderedDict\n'), ((2091, 2104), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2102, 2104), False, 'from collections import deque, OrderedDict\n')] |
import typing
import uuid
from contextlib import contextmanager
import requests_mock
import wrapt
from commercetools.testing.abstract import BaseBackend
from commercetools.testing.auth import AuthBackend
from commercetools.testing.carts import CartsBackend
from commercetools.testing.categories import CategoriesBacken... | [
"commercetools.testing.product_discounts.ProductDiscountsBackend",
"commercetools.testing.tax_categories.TaxCategoryBackend",
"commercetools.testing.product_projections.ProductProjectionsBackend",
"commercetools.testing.auth.AuthBackend",
"commercetools.testing.carts.CartsBackend",
"commercetools.testing.... | [((2352, 2365), 'commercetools.testing.auth.AuthBackend', 'AuthBackend', ([], {}), '()\n', (2363, 2365), False, 'from commercetools.testing.auth import AuthBackend\n'), ((2387, 2414), 'commercetools.testing.carts.CartsBackend', 'CartsBackend', (['self._storage'], {}), '(self._storage)\n', (2399, 2414), False, 'from com... |
# Copyright 2020 Huawei Technologies Co., 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... | [
"src.alexnet.AlexNet",
"mindspore.train.loss_scale_manager.FixedLossScaleManager",
"mindspore.nn.SoftmaxCrossEntropyWithLogits",
"src.dataset.create_dataset_imagenet",
"mindspore.context.reset_auto_parallel_context",
"mindspore.train.callback.LossMonitor",
"src.dataset.create_dataset_cifar10",
"mindsp... | [((1703, 1717), 'mindspore.common.set_seed', 'set_seed', (['(1234)'], {}), '(1234)\n', (1711, 1717), False, 'from mindspore.common import set_seed\n'), ((1718, 1742), 'mindspore.dataset.config.set_seed', 'de.config.set_seed', (['(2345)'], {}), '(2345)\n', (1736, 1742), True, 'from mindspore import dataset as de\n'), ((... |
#!/usr/bin/python
from __future__ import print_function
from bcc import BPF
from bcc.containers import filter_by_containers
from bcc.utils import ArgString, printb
import bcc.utils as utils
import argparse
import re
import time
import pwd
from collections import defaultdict
from time import strftime
def parse_uid(use... | [
"pwd.getpwnam",
"time.strftime",
"bcc.utils.printb",
"collections.defaultdict",
"bcc.BPF",
"time.time"
] | [((3140, 3158), 'bcc.BPF', 'BPF', ([], {'text': 'bpf_text'}), '(text=bpf_text)\n', (3143, 3158), False, 'from bcc import BPF\n'), ((3582, 3593), 'time.time', 'time.time', ([], {}), '()\n', (3591, 3593), False, 'import time\n'), ((3601, 3618), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (3612, ... |
# - *- coding: utf- 8 - *-
from __future__ import absolute_import
import dateutil.parser
from tzlocal import get_localzone
def iso_to_datetime(s):
return dateutil.parser.parse(s)
def get_nice_date(date):
return iso_to_datetime(date).astimezone(get_localzone()).strftime("%A, %d. %B %Y %I:%M%p")
| [
"tzlocal.get_localzone"
] | [((256, 271), 'tzlocal.get_localzone', 'get_localzone', ([], {}), '()\n', (269, 271), False, 'from tzlocal import get_localzone\n')] |
import os
import math
import glob
import random
import importlib
from pathlib import Path
from collections import defaultdict
import torch
import torch.nn as nn
import numpy as np
from tqdm import tqdm
from tensorboardX import SummaryWriter
from optimizers import get_optimizer
from schedulers import get_scheduler
fro... | [
"torch.nn.utils.clip_grad_norm_",
"schedulers.get_scheduler",
"torch.cuda.is_available",
"os.remove",
"tensorboardX.SummaryWriter",
"torch.cuda.device",
"pathlib.Path",
"tqdm.tqdm.write",
"numpy.random.seed",
"glob.glob",
"importlib.import_module",
"torch.save",
"utility.helper.count_paramet... | [((703, 729), 'tensorboardX.SummaryWriter', 'SummaryWriter', (['args.expdir'], {}), '(args.expdir)\n', (716, 729), False, 'from tensorboardX import SummaryWriter\n'), ((3408, 3504), 'optimizers.get_optimizer', 'get_optimizer', (['model_params', "self.config['runner']['total_steps']", "self.config['optimizer']"], {}), "... |
# Copyright 2019 Huawei Technologies Co., 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... | [
"numpy.ones",
"mindspore.context.set_context",
"numpy.array",
"mindspore.common.tensor.Tensor",
"mindspore.ops.composite.GradOperation",
"numpy.concatenate",
"numpy.all",
"mindspore.ops.operations.LSTM"
] | [((1095, 1135), 'mindspore.context.set_context', 'context.set_context', ([], {'device_target': '"""GPU"""'}), "(device_target='GPU')\n", (1114, 1135), True, 'import mindspore.context as context\n'), ((6168, 6424), 'numpy.array', 'np.array', (['[[[-0.021429, 0.1176], [0.31144, 0.6309]], [[-0.0005019, -0.045812], [\n ... |
import pandas as pd
import hashlib
x = pd.read_csv(
"/Users/nishantjha/Downloads/Social Network Survey NCS (Responses) - Form Responses 1.csv"
)
d = x.to_dict("records")
new_data = []
def encrypt_string(s):
s = s.lower().strip()
return hashlib.sha512(str.encode(s)).hexdigest()
my_data = []
for x in d... | [
"pandas.read_csv"
] | [((40, 153), 'pandas.read_csv', 'pd.read_csv', (['"""/Users/nishantjha/Downloads/Social Network Survey NCS (Responses) - Form Responses 1.csv"""'], {}), "(\n '/Users/nishantjha/Downloads/Social Network Survey NCS (Responses) - Form Responses 1.csv'\n )\n", (51, 153), True, 'import pandas as pd\n')] |
#!/usr/bin/env python
import rospy
import RPi.GPIO as GPIO
from .outputs import *
from .inputs import *
Fs = 50 # Hz
#GPIO MAP
PIN_BTN_BLUE = 29
PIN_BTN_GREEN = 23
PIN_LED_BLUE = 31
PIN_LED_GREEN = 33
PIN_LED_COIL = 18
out_blue = None
in_blue = None
out_green = None
in_green = None
out_coil = None
def hmi_start():... | [
"RPi.GPIO.cleanup",
"rospy.Subscriber",
"rospy.is_shutdown",
"rospy.init_node",
"rospy.Rate",
"rospy.Publisher",
"RPi.GPIO.setmode"
] | [((386, 413), 'rospy.init_node', 'rospy.init_node', (['"""hmi_node"""'], {}), "('hmi_node')\n", (401, 413), False, 'import rospy\n'), ((424, 470), 'rospy.Publisher', 'rospy.Publisher', (['"""gpio"""', 'String'], {'queue_size': '(10)'}), "('gpio', String, queue_size=10)\n", (439, 470), False, 'import rospy\n'), ((482, 4... |
from __future__ import print_function
import codecs
import logging
import os
import sys
from optparse import OptionParser
from pypugjs.utils import process
def convert_file():
support_compilers_list = [
'django',
'jinja',
'underscore',
'mako',
'tornado',
... | [
"pypugjs.utils.process",
"codecs.getreader",
"codecs.getwriter",
"logging.warning",
"optparse.OptionParser",
"os.path.splitext",
"sys.stdin.read",
"codecs.open",
"sys.stdout.write"
] | [((756, 775), 'optparse.OptionParser', 'OptionParser', (['usage'], {}), '(usage)\n', (768, 775), False, 'from optparse import OptionParser\n'), ((2297, 2397), 'pypugjs.utils.process', 'process', (['template'], {'compiler': 'available_compilers[compiler]', 'staticAttrs': '(True)', 'extension': 'extension'}), '(template,... |
# -*- coding: utf-8 -*-
import codecs
import os
import uuid
from datetime import datetime
import requests
import main
PATH_TO_HTML_FOLDER = "./html-data"
def get_important_part_of_html(filename, html_as_string, start_year, end_year):
"""Removes useless beginning and end of html file. Uses HTML Comments as Orien... | [
"os.path.exists",
"os.makedirs",
"requests.get",
"uuid.uuid1",
"datetime.datetime.now",
"codecs.open"
] | [((1509, 1548), 'codecs.open', 'codecs.open', (['filename', '"""w"""', '"""utf-8-sig"""'], {}), "(filename, 'w', 'utf-8-sig')\n", (1520, 1548), False, 'import codecs\n'), ((2245, 2257), 'uuid.uuid1', 'uuid.uuid1', ([], {}), '()\n', (2255, 2257), False, 'import uuid\n'), ((1902, 1931), 'requests.get', 'requests.get', ([... |
# Definindo Funções
from time import sleep
def lerSalario():
while True:
try:
l = float(input("\033[0;32mQual é o salário do funcionário?\033[m R$"))
except:
print("\033[0;31m< ERROR > Falha ao ler salário < ERRO >\033[m")
sleep(0.5)
print("\033[0;32mT... | [
"time.sleep"
] | [((610, 618), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (615, 618), False, 'from time import sleep\n'), ((279, 289), 'time.sleep', 'sleep', (['(0.5)'], {}), '(0.5)\n', (284, 289), False, 'from time import sleep\n')] |
# URS0000BD9FEB_10089 -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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.... | [
"rnacentral_pipeline.rnacentral.precompute.description.description_of",
"pytest.mark.xfail",
"pytest.param"
] | [((13108, 13142), 'rnacentral_pipeline.rnacentral.precompute.description.description_of', 'description_of', (['rna_type', 'sequence'], {}), '(rna_type, sequence)\n', (13122, 13142), False, 'from rnacentral_pipeline.rnacentral.precompute.description import description_of\n'), ((12860, 12945), 'pytest.param', 'pytest.par... |
import csv
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from math import ceil
from constants import ENV_NAMES
import seaborn # sets some style parameters automatically
COLORS = [(57, 106, 177), (218, 124, 48)]
def switch_to_outer_plot(fig):
ax0 = fig.add_subplot(111, frame_on=False)
a... | [
"numpy.mean",
"numpy.sqrt",
"numpy.array",
"numpy.sum",
"numpy.isnan",
"csv.reader",
"numpy.std",
"numpy.shape",
"numpy.zeros_like",
"matplotlib.pyplot.subplots"
] | [((424, 446), 'numpy.zeros_like', 'np.zeros_like', (['data_in'], {}), '(data_in)\n', (437, 446), True, 'import numpy as np\n'), ((936, 952), 'numpy.shape', 'np.shape', (['data_y'], {}), '(data_y)\n', (944, 952), True, 'import numpy as np\n'), ((1177, 1200), 'numpy.mean', 'np.mean', (['data_y'], {'axis': '(0)'}), '(data... |
import torch
from torch import nn, Tensor
from torch.nn import functional as F
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, c1, c2, s=1, downsample= None, no_relu=False) -> None:
super().__init__()
self.conv1 = nn.Conv2d(c1, c2, 3, s, 1, bias=False)
self.bn1 = nn.Batch... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"torch.load",
"torch.nn.init.kaiming_normal_",
"torch.nn.Conv2d",
"torch.nn.functional.relu",
"torch.nn.functional.interpolate",
"torch.nn.AvgPool2d",
"torch.zeros",
"torch.cat"
] | [((8849, 8876), 'torch.zeros', 'torch.zeros', (['(2)', '(3)', '(224)', '(224)'], {}), '(2, 3, 224, 224)\n', (8860, 8876), False, 'import torch\n'), ((254, 292), 'torch.nn.Conv2d', 'nn.Conv2d', (['c1', 'c2', '(3)', 's', '(1)'], {'bias': '(False)'}), '(c1, c2, 3, s, 1, bias=False)\n', (263, 292), False, 'from torch impor... |
from typing import Any, Dict, Optional, Union
import numpy as np
import torch
import torch.nn.functional as F
from tianshou.data import Batch, to_torch
from tianshou.policy import BasePolicy
class ImitationPolicy(BasePolicy):
"""Implementation of vanilla imitation learning.
:param torch.nn.Module model: a ... | [
"tianshou.data.to_torch",
"tianshou.data.Batch",
"torch.nn.functional.mse_loss",
"torch.nn.functional.nll_loss"
] | [((1351, 1387), 'tianshou.data.Batch', 'Batch', ([], {'logits': 'logits', 'act': 'a', 'state': 'h'}), '(logits=logits, act=a, state=h)\n', (1356, 1387), False, 'from tianshou.data import Batch, to_torch\n'), ((1648, 1705), 'tianshou.data.to_torch', 'to_torch', (['batch.act'], {'dtype': 'torch.float32', 'device': 'a.dev... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('drip', '0002_dripsplitsubject'),
]
operations = [
migrations.RemoveField(
model_name='sentdrip',
nam... | [
"django.db.models.EmailField",
"django.db.migrations.RemoveField"
] | [((246, 304), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""sentdrip"""', 'name': '"""body"""'}), "(model_name='sentdrip', name='body')\n", (268, 304), False, 'from django.db import models, migrations\n'), ((452, 551), 'django.db.models.EmailField', 'models.EmailField', ([], {'he... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pathlib
import functools
import torch
import torchvision
DATA_CACHE = pathlib.Path(__file__).parents[1] / 'data'
# a convenience for the MNIST dataset
# set `train` and transforms as per
# MNIST = functools.partial(torchvision.datasets.MNIST, DATA_CACHE, downlo... | [
"torch.cuda.is_available",
"pathlib.Path",
"torch.device"
] | [((371, 396), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (394, 396), False, 'import torch\n'), ((411, 431), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (423, 431), False, 'import torch\n'), ((451, 470), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n"... |
#!/usr/bin/python
import urllib2
import sys
import cv2.cv as cv
import numpy
if __name__ == "__main__":
cv.NamedWindow("camera", 1)
capture = cv.CaptureFromCAM(0)
paste = cv.CreateMat(960, 1280, cv.CV_8UC3)
topleft = numpy.asarray(cv.GetSubRect(paste, (0, 0, 640, 480)))
topright = numpy.asarray(c... | [
"cv2.cv.CaptureFromCAM",
"cv2.cv.GetSubRect",
"cv2.cv.NamedWindow",
"numpy.asarray",
"cv2.cv.CreateMat",
"cv2.cv.DestroyAllWindows",
"cv2.cv.ShowImage",
"cv2.cv.WaitKey",
"cv2.cv.QueryFrame"
] | [((109, 136), 'cv2.cv.NamedWindow', 'cv.NamedWindow', (['"""camera"""', '(1)'], {}), "('camera', 1)\n", (123, 136), True, 'import cv2.cv as cv\n'), ((152, 172), 'cv2.cv.CaptureFromCAM', 'cv.CaptureFromCAM', (['(0)'], {}), '(0)\n', (169, 172), True, 'import cv2.cv as cv\n'), ((186, 221), 'cv2.cv.CreateMat', 'cv.CreateMa... |
import time, math, copy
import numpy as np
import pandas as pd
import machineLearning
import pickle
INFINITY = float("inf")
class GameAI(object):
def __init__(self, game):
super().__init__()
self.game = game
self.move = (-1,-1)
self.timeLimit = 3 # 3 seconds is the time limit for search
self.debug = Fals... | [
"pandas.Series",
"pickle.load",
"machineLearning.predict",
"numpy.asarray",
"numpy.append",
"numpy.array",
"copy.deepcopy",
"time.time"
] | [((405, 433), 'pickle.load', 'pickle.load', (['self.fileObject'], {}), '(self.fileObject)\n', (416, 433), False, 'import pickle\n'), ((1813, 1824), 'time.time', 'time.time', ([], {}), '()\n', (1822, 1824), False, 'import time, math, copy\n'), ((4286, 4297), 'time.time', 'time.time', ([], {}), '()\n', (4295, 4297), Fals... |
from easydict import EasyDict
from typing import Optional, List
import copy
final_eval_reward_wrapper = EasyDict(type='final_eval_reward')
def get_default_wrappers(env_wrapper_name: str, env_id: Optional[str] = None) -> List[dict]:
if env_wrapper_name == 'mujoco_default':
return [
EasyDict(ty... | [
"easydict.EasyDict",
"copy.deepcopy"
] | [((105, 139), 'easydict.EasyDict', 'EasyDict', ([], {'type': '"""final_eval_reward"""'}), "(type='final_eval_reward')\n", (113, 139), False, 'from easydict import EasyDict\n'), ((386, 426), 'copy.deepcopy', 'copy.deepcopy', (['final_eval_reward_wrapper'], {}), '(final_eval_reward_wrapper)\n', (399, 426), False, 'import... |
""" Parses the `models.dat` input file for MechDriver that specifies all
of the parameters used to construct the partition functions and
master equations for the calculation of rate constants and thermochemistry.
"""
import automol
import ioformat
from mechanalyzer.inf import thy as tinfo
from mechlib.amech_i... | [
"ioformat.ptt.keyword_dcts_from_blocks",
"ioformat.ptt.named_end_blocks",
"mechlib.amech_io.parser._keywrd.defaults_with_dcts"
] | [((3303, 3362), 'ioformat.ptt.named_end_blocks', 'ioformat.ptt.named_end_blocks', (['mod_str', '"""kin"""'], {'footer': '"""kin"""'}), "(mod_str, 'kin', footer='kin')\n", (3332, 3362), False, 'import ioformat\n'), ((3389, 3448), 'ioformat.ptt.named_end_blocks', 'ioformat.ptt.named_end_blocks', (['mod_str', '"""spc"""']... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | [
"aiida.common.json.dumps",
"sys.stdout.isatty",
"sys.exit",
"click.secho"
] | [((1566, 1613), 'click.secho', 'click.secho', (['message'], {'bold': 'bold', 'nl': 'nl', 'err': 'err'}), '(message, bold=bold, nl=nl, err=err)\n', (1577, 1613), False, 'import click\n'), ((2012, 2074), 'click.secho', 'click.secho', (['"""Info: """'], {'fg': '"""blue"""', 'bold': '(True)', 'nl': '(False)', 'err': 'err'}... |
#!/usr/bin/env python
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
def runtests():
from django.core.management import execute_from_command_line
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE",
"test_project.settings"
)
argv = [sys.argv[0], ... | [
"os.environ.setdefault",
"os.path.dirname",
"sys.exit",
"django.core.management.execute_from_command_line"
] | [((195, 267), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""test_project.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'test_project.settings')\n", (216, 267), False, 'import os\n'), ((349, 380), 'django.core.management.execute_from_command_line', 'execute_from_command_line',... |
from CNNectome.networks import scale_net
from CNNectome.networks import ops3d
import tensorflow as tf
import numpy as np
import json
def make_net(labels, added_steps, mode="train", loss_name="loss_total"):
unet0 = scale_net.SerialUNet(
[12, 12 * 6, 12 * 6 ** 2],
[48, 12 * 6, 12 * 6 ** 2],
... | [
"tensorflow.train.AdamOptimizer",
"tensorflow.tensordot",
"tensorflow.summary.merge_all",
"CNNectome.networks.scale_net.SerialUNet",
"tensorflow.placeholder",
"CNNectome.networks.scale_net.ScaleNet",
"tensorflow.add_n",
"tensorflow.reshape",
"tensorflow.summary.scalar",
"tensorflow.losses.mean_squ... | [((220, 483), 'CNNectome.networks.scale_net.SerialUNet', 'scale_net.SerialUNet', (['[12, 12 * 6, 12 * 6 ** 2]', '[48, 12 * 6, 12 * 6 ** 2]', '[(3, 3, 3), (3, 3, 3)]', '[[(3, 3, 3), (3, 3, 3)], [(3, 3, 3), (3, 3, 3)], [(3, 3, 3), (3, 3, 3)]]', '[[(3, 3, 3), (3, 3, 3)], [(3, 3, 3), (3, 3, 3)]]'], {'input_voxel_size': '(4... |
# -*- coding: utf-8 -*-
"""Tests for the redirect.py script."""
#
# (C) Pywikibot team, 2017
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
try:
from unittest.mock import Mock, patch
except ImportError:
from mock import Mock, patch
import pywikib... | [
"mock.Mock",
"scripts.redirect.RedirectRobot",
"mock.patch.object"
] | [((959, 993), 'scripts.redirect.RedirectRobot', 'RedirectRobot', (['"""broken"""'], {}), "('broken', **options)\n", (972, 993), False, 'from scripts.redirect import RedirectRobot\n'), ((1297, 1333), 'scripts.redirect.RedirectRobot', 'RedirectRobot', (['"""broken"""'], {'delete': '(True)'}), "('broken', delete=True)\n",... |
"""
While *nussl* does not come with any data sets, it does have the capability to interface with
many common source separation data sets used within the MIR and speech separation communities.
These data set "hooks" subclass BaseDataset and by default return AudioSignal objects in
labeled dictionaries for ease of use. ... | [
"os.path.exists",
"os.listdir",
"os.path.splitext",
"os.path.join",
"jams.load"
] | [((17400, 17425), 'os.path.join', 'os.path.join', (['root', 'split'], {}), '(root, split)\n', (17412, 17425), False, 'import os\n'), ((17643, 17674), 'os.path.join', 'os.path.join', (['self.folder', 'item'], {}), '(self.folder, item)\n', (17655, 17674), False, 'import os\n'), ((17741, 17764), 'jams.load', 'jams.load', ... |
from enum import Enum
import nltk
nltk.download("punkt", quiet=True)
nltk.download("stopwords", quiet=True)
class Split(str, Enum):
TRAIN: str = "train"
DEV: str = "dev"
TEST: str = "test"
| [
"nltk.download"
] | [((35, 69), 'nltk.download', 'nltk.download', (['"""punkt"""'], {'quiet': '(True)'}), "('punkt', quiet=True)\n", (48, 69), False, 'import nltk\n'), ((70, 108), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {'quiet': '(True)'}), "('stopwords', quiet=True)\n", (83, 108), False, 'import nltk\n')] |
from datetime import datetime
from datetime import timezone
from uuid import UUID
from bson import ObjectId
UUID_1_EPOCH = datetime(1582, 10, 15, tzinfo=timezone.utc)
UUID_TICKS = 10000000
UUID_VARIANT_1 = 0b1000000000000000
def is_uuid(candidate):
"""Determine if this is a uuid"""
try:
UUID(candid... | [
"datetime.datetime",
"bson.ObjectId.is_valid",
"uuid.UUID",
"bson.ObjectId"
] | [((126, 169), 'datetime.datetime', 'datetime', (['(1582)', '(10)', '(15)'], {'tzinfo': 'timezone.utc'}), '(1582, 10, 15, tzinfo=timezone.utc)\n', (134, 169), False, 'from datetime import datetime\n'), ((1474, 1491), 'uuid.UUID', 'UUID', (['string_uuid'], {}), '(string_uuid)\n', (1478, 1491), False, 'from uuid import UU... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Google Factory Tool.
This tool is intended to be used on factory assembly lines. It
provides all of t... | [
"cros.factory.gooftool.report_upload.FtpUpload",
"cros.factory.utils.process_utils.Spawn",
"logging.debug",
"cros.factory.utils.debug_utils.SetupLogging",
"logging.exception",
"cros.factory.gooftool.crosfw.LoadEcFirmware",
"sys.exit",
"logging.info",
"cros.factory.utils.sys_utils.GetRunningFactoryPy... | [((1942, 1958), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1956, 1958), False, 'import threading\n'), ((4501, 4588), 'cros.factory.utils.argparse_utils.CmdArg', 'CmdArg', (['"""--project"""'], {'metavar': '"""PROJECT"""', 'default': 'None', 'help': '"""Project name to test."""'}), "('--project', metavar='PR... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2017-08-10 21:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('symposion_reviews', '0001_initial'),
]
operations = [
migrations.RenameField... | [
"django.db.models.TextField",
"django.db.migrations.RenameField",
"django.db.models.PositiveIntegerField",
"django.db.models.CharField"
] | [((298, 401), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""proposalresult"""', 'old_name': '"""minus_one"""', 'new_name': '"""strong_reject"""'}), "(model_name='proposalresult', old_name='minus_one',\n new_name='strong_reject')\n", (320, 401), False, 'from django.db import mi... |
# 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
# distributed under t... | [
"openstack_dashboard.api.cinder.volume_list",
"django.utils.translation.ugettext_lazy",
"django.utils.datastructures.SortedDict",
"openstack_dashboard.api.nova.server_list",
"openstack_dashboard.api.cinder.volume_snapshot_list",
"django.core.urlresolvers.reverse",
"openstack_dashboard.api.cinder.volume_... | [((972, 985), 'django.utils.translation.ugettext_lazy', '_', (['"""Overview"""'], {}), "('Overview')\n", (973, 985), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((3926, 3945), 'django.utils.translation.ugettext_lazy', '_', (['"""Volume Backups"""'], {}), "('Volume Backups')\n", (3927, 3945), Tru... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'mayanqiong'
import math
from datetime import datetime
from typing import Callable
from tqsdk.datetime import _is_in_trading_time
from tqsdk.diff import _simple_merge_diff
from tqsdk.sim.utils import _get_price_range, _get_option_margin, _get_premium, _get_c... | [
"tqsdk.sim.utils._get_future_margin",
"datetime.datetime.strptime",
"tqsdk.sim.utils._get_premium",
"tqsdk.sim.utils._get_option_margin",
"tqsdk.sim.utils._get_price_range",
"math.isnan",
"tqsdk.sim.utils._get_commission",
"tqsdk.sim.utils._get_close_profit"
] | [((4161, 4192), 'math.isnan', 'math.isnan', (["quote['last_price']"], {}), "(quote['last_price'])\n", (4171, 4192), False, 'import math\n'), ((4809, 4834), 'tqsdk.sim.utils._get_future_margin', '_get_future_margin', (['quote'], {}), '(quote)\n', (4827, 4834), False, 'from tqsdk.sim.utils import _get_price_range, _get_o... |
"""
.. module: lemur.plugins.lemur_acme.plugin
:platform: Unix
:synopsis: This module is responsible for communicating with an ACME CA.
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
Snippets from https://raw.githubusercontent.com/alex/let... | [
"flask.current_app.logger.debug",
"lemur.authorizations.service.create",
"json.loads",
"acme.messages.NewRegistration.from_data",
"lemur.authorizations.service.get",
"lemur.common.utils.generate_private_key",
"time.sleep",
"lemur.exceptions.InvalidAuthority",
"datetime.datetime.now",
"lemur.except... | [((4916, 4945), 'json.loads', 'json.loads', (['authority.options'], {}), '(authority.options)\n', (4926, 4945), False, 'import json\n'), ((5392, 5424), 'acme.client.ClientNetwork', 'ClientNetwork', (['key'], {'account': 'None'}), '(key, account=None)\n', (5405, 5424), False, 'from acme.client import BackwardsCompatible... |
# -*- coding: utf-8 -*-
import dash_bootstrap_components as dbc
import dash_html_components as html
def Navbar(application):
navbar = dbc.Navbar(
dbc.Container(
[
html.Div(
className="col-xs-12 col-sm-6 col-lg-3 px-0 text-center",
childre... | [
"dash_html_components.H2",
"dash_html_components.Img"
] | [((348, 457), 'dash_html_components.Img', 'html.Img', ([], {'className': '"""my-auto"""', 'src': '"""https://team75.s3.amazonaws.com/electridash-logo.png"""', 'height': '"""35px"""'}), "(className='my-auto', src=\n 'https://team75.s3.amazonaws.com/electridash-logo.png', height='35px')\n", (356, 457), True, 'import d... |
#! python3
import socket
import threading
import select
import queue
class RobotConnection(object):
"""
Create a RobotConnection object with a given robot ip.
"""
VIDEO_PORT = 40921
AUDIO_PORT = 40922
CTRL_PORT = 40923
PUSH_PORT = 40924
EVENT_PORT = 40925
IP_PORT = 40926
def ... | [
"threading.Thread",
"queue.Queue",
"select.select",
"socket.socket"
] | [((411, 460), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (424, 460), False, 'import socket\n'), ((489, 538), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (502, ... |
"""Tests for the motionEye binary sensor platform."""
from __future__ import annotations
import datetime
from datetime import timedelta
import logging
from unittest.mock import patch
from pytest_homeassistant_custom_component.common import async_fire_time_changed
from custom_components.motioneye import get_motioneye... | [
"logging.getLogger",
"homeassistant.util.dt.utcnow",
"homeassistant.helpers.entity_registry.async_get_registry",
"pytest_homeassistant_custom_component.common.async_fire_time_changed",
"homeassistant.helpers.device_registry.async_get",
"custom_components.motioneye.get_motioneye_device_identifier",
"date... | [((1080, 1107), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1097, 1107), False, 'import logging\n'), ((1860, 1878), 'homeassistant.helpers.device_registry.async_get', 'dr.async_get', (['hass'], {}), '(hass)\n', (1872, 1878), True, 'from homeassistant.helpers import device_registry as ... |
#!/usr/bin/env python3
from broker.config import env
from broker.eudat.submit import submit_eudat
def main():
job_yaml = env.HOME / "ebloc-broker" / "broker" / "_test" / "eudat" / "job.yaml"
# job_yaml_temp = job_yaml.replace(".yaml", "_temp.yaml")
# copyfile(job_yaml, job_yaml_temp)
submit_eudat(jo... | [
"broker.eudat.submit.submit_eudat"
] | [((305, 327), 'broker.eudat.submit.submit_eudat', 'submit_eudat', (['job_yaml'], {}), '(job_yaml)\n', (317, 327), False, 'from broker.eudat.submit import submit_eudat\n')] |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This will attempt to import the actual App Engine modules, and if it fails,
# they will be replaced with fake modules. This is useful during testing.
... | [
"google.appengine.api.memcache.set",
"google.appengine.api.memcache.get"
] | [((845, 895), 'google.appengine.api.memcache.set', 'memcache.set', (['k', 'v'], {'namespace': 'namespace', 'time': 'time'}), '(k, v, namespace=namespace, time=time)\n', (857, 895), True, 'import google.appengine.api.memcache as memcache\n'), ((1051, 1098), 'google.appengine.api.memcache.get', 'memcache.get', (['k'], {'... |
from django.db import models
from json import dumps
class Task(models.Model):
creation_date = models.CharField(null=True, max_length=64)
creation_ip = models.CharField(null=True, max_length=64)
input_dot = models.TextField()
dot_rep = models.TextField()
svg_rep = models.TextField()
svg_rep0 ... | [
"django.db.models.TextField",
"django.db.models.FloatField",
"django.db.models.CharField"
] | [((99, 141), 'django.db.models.CharField', 'models.CharField', ([], {'null': '(True)', 'max_length': '(64)'}), '(null=True, max_length=64)\n', (115, 141), False, 'from django.db import models\n'), ((160, 202), 'django.db.models.CharField', 'models.CharField', ([], {'null': '(True)', 'max_length': '(64)'}), '(null=True,... |
import numpy as np
import tensorflow as tf
class NeuralBandit:
def __init__(self, nPicos, ABSval, CREval, initExploration, epsilon_0, batch_size=1):
nActivePicosVal = np.arange(0, (nPicos+1))
self.controlSpace = np.array(np.meshgrid(nActivePicosVal, ABSval, CREval)).T.reshape(-1, 3)
self.... | [
"tensorflow.random_normal",
"numpy.random.rand",
"tensorflow.nn.relu",
"tensorflow.pow",
"numpy.where",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"numpy.sum",
"numpy.zeros",
"numpy.random.randint",
"tensorflow.matmul",
"numpy.expand_dims",
"... | [((182, 206), 'numpy.arange', 'np.arange', (['(0)', '(nPicos + 1)'], {}), '(0, nPicos + 1)\n', (191, 206), True, 'import numpy as np\n'), ((825, 849), 'numpy.zeros', 'np.zeros', (['self.nControls'], {}), '(self.nControls)\n', (833, 849), True, 'import numpy as np\n'), ((880, 904), 'numpy.zeros', 'np.zeros', (['self.nCo... |
"""
Linux joystick support
borrowed from http://entitycrisis.blogspot.com/2008/02/pyglet-joystick.html
"""
from pyglet import event
from glob import glob
import struct
from select import select
from jaraco.input import NormalizingAxisJoystick as NormalizingJS
# Linux only gives us axis numbers: translate these to ... | [
"struct.calcsize",
"select.select",
"pyglet.event.EventDispatcher.__init__",
"struct.unpack",
"glob.glob"
] | [((795, 820), 'struct.calcsize', 'struct.calcsize', (['JS_EVENT'], {}), '(JS_EVENT)\n', (810, 820), False, 'import struct\n'), ((1014, 1050), 'pyglet.event.EventDispatcher.__init__', 'event.EventDispatcher.__init__', (['self'], {}), '(self)\n', (1044, 1050), False, 'from pyglet import event\n'), ((1207, 1229), 'glob.gl... |
################################################################################
##
## BY: <NAME>
## PROJECT MADE WITH: Qt Designer and PySide2
## V: 1.0.0
##
## This project can be used freely for all uses, as long as they maintain the
## respective credits only in the Python scripts, any information in the visual
## ... | [
"logging.basicConfig",
"PySide2.QtGui.QPixmap",
"PySide2.QtGui.QFontDatabase.addApplicationFont",
"os.listdir",
"PIL.Image.new",
"subprocess.Popen",
"os.path.join",
"PySide2.QtCore.QSize",
"time.sleep",
"PySide2.QtCore.Signal",
"platform.release",
"PIL.ImageDraw.Draw",
"platform.system",
"... | [((17814, 17873), 'PySide2.QtGui.QFontDatabase.addApplicationFont', 'QtGui.QFontDatabase.addApplicationFont', (['"""fonts/segoeui.ttf"""'], {}), "('fonts/segoeui.ttf')\n", (17852, 17873), False, 'from PySide2 import QtCore, QtGui, QtWidgets\n'), ((17878, 17938), 'PySide2.QtGui.QFontDatabase.addApplicationFont', 'QtGui.... |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import torch
import torch.nn as nn
import torch.nn.functional as F
from crlapi.core import CLModel
from crlapi.sl.clmodel... | [
"numpy.prod",
"torch.stack",
"torch.nn.functional.cross_entropy",
"copy.deepcopy",
"torch.no_grad"
] | [((963, 980), 'torch.stack', 'torch.stack', (['outs'], {}), '(outs)\n', (974, 980), False, 'import torch\n'), ((2910, 2930), 'copy.deepcopy', 'copy.deepcopy', (['model'], {}), '(model)\n', (2923, 2930), False, 'import copy\n'), ((1661, 1676), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1674, 1676), False, 'imp... |