filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_5904 | """Single slice vgg with normalised scale.
"""
import functools
import lasagne as nn
import numpy as np
import theano
import theano.tensor as T
import data_loader
import deep_learning_layers
import image_transform
import layers
import preprocess
import postprocess
import objectives
import theano_print... |
the-stack_0_5906 | import re
from queries import *
from expresiones import *
# -----------------------------------------------------------------------------
# Grupo 6
#
# Universidad de San Carlos de Guatemala
# Facultad de Ingenieria
# Escuela de Ciencias y Sistemas
# Organizacion de Lenguajes y Compiladores 2
# ------------------------... |
the-stack_0_5909 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import random
import torch
import torchvision
from torchvision.transforms import functional as F
from .rf_transforms import (
RandomHorizontalFlip3D,
RandomVerticalFlip3D,
Pad3D,
CalibrateMWPose,
GenerateHMS,
)
from .pc_trans... |
the-stack_0_5910 | # Forked from https://github.com/psobot/keynote-parser/blob/master/keynote_parser/codec.py
import struct
import snappy
from functools import partial
from numbers_parser.mapping import ID_NAME_MAP
from numbers_parser.exceptions import NotImplementedError
from google.protobuf.internal.decoder import _DecodeVarint32
fr... |
the-stack_0_5911 | from __future__ import division
import argparse
import copy
import os
import os.path as osp
import time
import mmcv
import torch
from mmcv import Config
from mmcv.runner import init_dist
from mmdet import __version__
from mmdet.apis import set_random_seed, train_detector
from mmdet.datasets import build_dataset
from ... |
the-stack_0_5913 | from __future__ import absolute_import, print_function
"""
Command for starting up an authenticating reverse proxy for use in development.
Please, don't use me in production!
"""
import six.moves.BaseHTTPServer
from django.conf import settings
import getpass
import socket
from nsot.util.commands import NsotCommand... |
the-stack_0_5914 | """Builder for websites."""
import os
import shutil
from regolith.builders.basebuilder import BuilderBase
from regolith.dates import get_dates
from regolith.fsclient import _id_key
from regolith.sorters import ene_date_key, position_key
from regolith.tools import (
all_docs_from_collection,
filter_publications... |
the-stack_0_5915 | """
# Definition for a Node.
class Node(object):
def __init__(self, val, children):
self.val = val
self.children = children
"""
class Solution(object):
def maxDepth(self, root):
"""
:type root: Node
:rtype: int
"""
if not root:
return 0
... |
the-stack_0_5916 | # Copyright (c) 2009 Aldo Cortesi
# Copyright (c) 2011 Florian Mounier
# Copyright (c) 2011 Anshuman Bhaduri
# Copyright (c) 2012 Tycho Andersen
#
# 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 Softw... |
the-stack_0_5917 | # -*- coding: utf-8 -*-
import json
import os.path
import sys
import yaml
from lemoncheesecake.project import Project
class MyProject(Project):
def build_report_title(self):
with open(os.path.join(os.path.dirname(__file__), "docker-compose.yml")) as compose_file:
compose = yaml.load(compose_... |
the-stack_0_5918 | "Script to add SimPizza to Haldis"
from app import db
from models import Location, Product
pizzas = [
"Bolognese de luxe",
"Hawaï",
"Popeye",
"Pepperoni",
"Seafood",
"Hot pizzaaah!!!",
"Salmon delight",
"Full option",
"Pitza kebab",
"Multi cheese",
"4 Seasons",
"Mega fis... |
the-stack_0_5919 | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
the-stack_0_5921 | from toontown.toonbase.ToonBaseGlobal import *
from panda3d.core import *
from panda3d.toontown import *
from toontown.toonbase.ToontownGlobals import *
import random
from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal
from direct.actor import Actor
import ToonInteriorCol... |
the-stack_0_5924 | # -*- coding: utf-8 -*-
"""Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, 2017, 2018, 2019, 2020 Caleb Bell <Caleb.Andrew.Bell@gmail.com>
Copyright (C) 2020 Yoel Rene Cortes-Pena <yoelcortes@gmail.com>
Permission is hereby granted, free of charge, to any person obtaini... |
the-stack_0_5926 | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Ai the coins developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the RPC HTTP basics."""
from test_framework.test_framework import BitcoinTestFramework
from test_... |
the-stack_0_5927 | """SciUnit tests live in this module."""
import inspect
import traceback
from sciunit import settings
from sciunit.base import SciUnit
from .capabilities import ProducesNumber
from .models import Model
from .scores import Score, BooleanScore, NoneScore, ErrorScore, TBDScore,\
NAScore
from .validat... |
the-stack_0_5930 | #FLM: Adjust Anchors
__copyright__ = __license__ = """
Copyright (c) 2010-2012 Adobe Systems Incorporated. All rights reserved.
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 restrictio... |
the-stack_0_5934 | import numpy as np
import torch
def to_tensor(blob):
if isinstance(blob, np.ndarray):
return torch.from_numpy(blob)
if isinstance(blob, int) or isinstance(blob, float):
return torch.Tensor(blob)
if isinstance(blob, dict):
ts = {}
for k, v in blob.items():
ts[k]... |
the-stack_0_5935 | """
odm2rest
--------
A Python RESTful web service inteface for accessing data in an
ODM2 database via Django rest swagger APIs.
"""
from __future__ import (absolute_import, division, print_function)
import os
from setuptools import find_packages, setup
import versioneer
here = os.path.abspath(os.path.dirname(__f... |
the-stack_0_5938 | """Window Covering devices."""
from ..extended_property import (
DURATION_HIGH,
DURATION_LOW,
ON_LEVEL,
RAMP_RATE,
X10_HOUSE,
X10_UNIT,
)
from ..groups import COVER
from ..operating_flag import (
DUAL_LINE_ON,
FORWARD_ON,
KEY_BEEP_ON,
LED_BLINK_ON_ERROR_OFF,
LED_BLINK_ON_TX_... |
the-stack_0_5942 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import click
from calendar import month_abbr
from datetime import datetime, date, timedelta
from dateutil.relativedelta import relativedelta
FILLED = u'\u25CF'
EMPTY = u'\u25CB'
row_label_formats = {
'year': '{year:<{max_year_width}}',
'age': 'Age {age:<{max... |
the-stack_0_5944 | import run_squad as rs
import tokenization
import collections
import json
import os
import modeling
import requests
import math
def read_squad_data(json_input, is_training):
"""Read a SQuAD json file into a list of SquadExample."""
# input_data = json_input["data"]
input_data = json_input
def is_whitespace... |
the-stack_0_5945 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 23 09:47:26 2019
@author: Artem Los
"""
import xml.etree.ElementTree
import json
import base64
import datetime
import copy
import time
from licensing.internal import HelperMethods
class ActivatedMachine:
def __init__(self, IP, Mid, Time, FriendlyName="", FloatingExp... |
the-stack_0_5949 | import abc
from collections import OrderedDict
from torch import nn as nn
from utils.logging import logger
import utils.eval_util as eval_util
from utils.rng import get_global_pkg_rng_state
import utils.pytorch_util as ptu
import gtimer as gt
from replay_buffer import ReplayBuffer
from path_collector import MdpPathCo... |
the-stack_0_5950 | from cvxopt import matrix
from cvxopt.lapack import syev
import numpy as np
class LatentPCA:
""" Structured Extension for Principle Component Analysis.
Written by Nico Goernitz, TU Berlin, 2014
"""
def __init__(self, sobj):
self.sobj = sobj # structured object
self.sol = None ... |
the-stack_0_5951 | # -*- coding: utf-8 -*-
from brawlpython.sessions import SyncSession
from brawlpython.api_toolkit import unique, same
from configobj import ConfigObj
import pytest
import time
url_uuid = "http://httpbin.org/uuid"
config = ConfigObj("config.ini")
api_key = config["DEFAULT"].get("API_KEY")
@pytest.yield_fixture
def... |
the-stack_0_5953 | # -*- coding: utf-8 -*-
"""
String formatting functionality for some primitive types. We do this since
it depends on several object implementations at once (e.g. Buffer and String),
which themselves need say, integers.
"""
from __future__ import print_function, division, absolute_import
import math
import flypy.type... |
the-stack_0_5957 | # -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls.defaults import patterns, include, url
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
from ....cart.app import cart_app
from ....cart.models import Cart, CART_SESSION_KEY
from ....delivery.tests import... |
the-stack_0_5958 | from rest_framework import serializers
from data_ocean.models import Status, Authority, TaxpayerType, Register
class StatusSerializer(serializers.ModelSerializer):
class Meta:
model = Status
fields = ['name']
class AuthoritySerializer(serializers.ModelSerializer):
class Meta:
model ... |
the-stack_0_5960 | # -*- coding: utf-8 -*-
# From https://github.com/wiseodd/hipsternet/blob/master/hipsternet/im2col.py
import numpy as np
def get_im2col_indices(x_shape, field_height, field_width, padding=1, stride=1):
# First figure out what the size of the output should be
N, C, H, W = x_shape
assert (H + 2 * padding ... |
the-stack_0_5962 | #!/usr/bin/env python3
# coding:utf-8
import email
message = open("email.txt", "rb").read().decode() # 将本题注释的所有内容保存为 email.txt
mail = email.message_from_string(message)
audio = mail.get_payload(0).get_payload(decode=True)
f = open("indian.wav", "wb") # 音频内容:sorry
f.write(audio)
f.close()
|
the-stack_0_5964 | from zzcore import StdAns
import requests
import sxtwl
from datetime import datetime
from config import HFWEATHERKEY
class Ans(StdAns):
def GETMSG(self):
msg = f'早上好,今天是{calendar()}\n\n'
msg += getWeather() + '\n\n'
# t = requests.get('https://v1.hitokoto.cn/?c=k&encode=text').text
... |
the-stack_0_5966 | from mldesigner import command_component
from azure.ai.ml.entities._job.resource_configuration import ResourceConfiguration
resources = ResourceConfiguration()
resources.instance_count = 2
@command_component(resources = resources)
def basic_component(
port1: str,
param1: int,
):
""" module run logic goes ... |
the-stack_0_5968 | from typing import Any, List, Union, Optional, Dict
import gym
import numpy as np
import pettingzoo
from functools import reduce
from ding.envs import BaseEnv, BaseEnvTimestep, FrameStackWrapper
from ding.torch_utils import to_ndarray, to_list
from ding.envs.common.common_function import affine_transform
from ding.uti... |
the-stack_0_5970 | import copy
from datetime import datetime
import threading
import uuid
from optuna import distributions # NOQA
from optuna.exceptions import DuplicatedStudyError
from optuna.storages import base
from optuna.storages.base import DEFAULT_STUDY_NAME_PREFIX
from optuna.study import StudyDirection
from optuna.study import... |
the-stack_0_5971 | from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User, Permission
from majora2 import models
from tatl import models as tmodels
from django.utils import timezone
class Command(BaseCommand):
help = "Load a list of organisations"
def add_arguments(self, pa... |
the-stack_0_5975 | # ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... |
the-stack_0_5978 | """
The unit test module for AutoTVM dialect.
"""
# pylint:disable=missing-docstring, redefined-outer-name, invalid-name
# pylint:disable=unused-argument, unused-import, wrong-import-position, ungrouped-imports
import argparse
import glob
import os
import tempfile
from copy import deepcopy
import json
import mock
impo... |
the-stack_0_5980 | """
This file offers the methods to automatically retrieve the graph Hydrogenophaga flava NBRC 102514.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protei... |
the-stack_0_5981 | # Definisikan function validate
def validate(hand):
# Tambahkan control flow berdasarkan nilai hand
if hand < 0 or hand > 2:
return False
else:
return True
def print_hand(hand, name='Tamu'):
hands = ['Batu', 'Kertas', 'Gunting']
print(name + ' memilih: ' + hands[hand])
print('Memu... |
the-stack_0_5982 | import argparse
import torch
import benchmark_core
import benchmark_utils
"""Performance microbenchmarks's main binary.
This is the main function for running performance microbenchmark tests.
It also registers existing benchmark tests via Python module imports.
"""
def main():
parser = argparse.ArgumentParser... |
the-stack_0_5983 | #INSERTION SORT
def insertion_sort(array):
# We start from 1 since the first element is trivially sorted
for index in range(1, len(array)):
currentValue = array[index]
currentPosition = index
while currentPosition > 0 and array[currentPosition - 1] > currentValue:
... |
the-stack_0_5984 | #!/usr/bin/env python3
# Copyright (c) 2014-2017 The Syndicate Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test mempool persistence.
By default, syndicated will dump mempool on shutdown and
then reload it on... |
the-stack_0_5987 | # !/usr/bin/python3
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger(__name__)
class ChannelType(object):
"""
Define if channel type is input or output.
These values must be set according to Bpod firmware specification.
"""
#: Input channel
INPUT = 1
#: Output channel
... |
the-stack_0_5988 | from pydex.core.designer import Designer
import numpy as np
import sobol_seq
"""
Setting : a non-dynamic experimental system with 2 time-invariant control variables
and 1 response.
Problem : design optimal experiment for a order 2 polynomial.
Solution : 3^2 factorial design, varying efforts... |
the-stack_0_5989 | import logging
from .models import TwitterBotResponseLog, TwitterBotVisitLog
logger = logging.getLogger(__name__)
class LogTwitterbotLinkVisitMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
param = 'twitterbot_log_id'
... |
the-stack_0_5990 | import pickle
import random
import numpy as np
from soepy.simulate.simulate_python import simulate
from soepy.soepy_config import TEST_RESOURCES_DIR
from development.tests.auxiliary.auxiliary import cleanup
def test1():
"""This test runs a random selection of test regression tests from
our regression test b... |
the-stack_0_5991 | import ctypes
import time, math, random
from random import randint
import win32gui, win32con, win32api
dx=10
def OnPaint(hwnd, msg, wp, lp):
global dx
font=win32gui.LOGFONT()
font.lfFaceName="Consolas"
font.lfHeight=48
# font.lfWidth=font.lfHeight
# font.lfWeight=150
# font.lfItalic=1
# font.lfUnderline=1
hf... |
the-stack_0_5995 | """Base segment definitions.
Here we define:
- BaseSegment. This is the root class for all segments, and is
designed to hold other subsegments.
- UnparsableSegment. A special wrapper to indicate that the parse
function failed on this block of segments and to prevent further
analysis.
"""
from io import StringIO... |
the-stack_0_5996 | from typing import Any, Optional, Union
from castutils.builtins.strings import to_str
from castutils.types import GenericType
def as_float(obj: Any, /) -> float:
if isinstance(obj, float):
return obj
else:
raise TypeError("Object is not of instance float")
def as_float_or(obj: Any, fallback... |
the-stack_0_5999 | # Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# slice paddle model generator
#
import sys
import os
import numpy as np
import paddle
from save_model import exportModel
from save_model import saveModel
data_type = 'float32'
def slice(name : str, x, axes : list, start : list, en... |
the-stack_0_6000 | # -*- coding: utf-8 -*-
'''
Utilities to enable exception reraising across the master commands
'''
# Import python libs
import exceptions
# Import salt libs
import salt.exceptions
def raise_error(name=None, args=None, message=''):
'''
Raise an exception with __name__ from name, args from args
If args ... |
the-stack_0_6003 | from pdb import set_trace as breakpoint
class Dog():
def __init__(self, name, age, housebroken = True):
self.name = name
self.age = age
self.housebroken = housebroken
def bark(self):
print(f'{self.name} likes to bark!')
class Beagle(Dog):
def __init__(self, n... |
the-stack_0_6007 | # -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 ... |
the-stack_0_6009 | def build_poetry_assistant(words_to_phonemes):
# complete the function body (8 MARKS)
''' (dict of {str: list of str}) -> dict of {tuple of str: list of str}
Return a poetry assistant dictionary from the words to phonemes in
words_to_phonemes.
>>> word_to_phonemes = {'BEFORE': ['B', 'IH0',... |
the-stack_0_6011 | import datetime
import functools
import json
import operator
import re
import requests
from django.conf import settings
from django.contrib import auth
from django.core import signing
from django.db import transaction
from django.db.models import Q, F
from django.http import Http404, HttpResponseForbidden, HttpRespon... |
the-stack_0_6012 | import game, server, menu_utils, df_utils, items
from srabuilder import rules
import functools
import dragonfly as df
wrapper = menu_utils.InventoryMenuWrapper()
async def get_shipping_menu():
menu = await menu_utils.get_active_menu(menu_type='itemsToGrabMenu')
if not menu['shippingBin']:
raise menu_u... |
the-stack_0_6013 | import pytest
from django.urls import resolve, reverse
from pinterest.users.models import User
pytestmark = pytest.mark.django_db
def test_detail(user: User):
assert (
reverse("users:detail", kwargs={"username": user.username})
== f"/users/{user.username}/"
)
assert resolve(f"/users/{use... |
the-stack_0_6014 | """SIGMET"""
# stdlib
from collections import defaultdict
# 3rd Party
import pytest
# this
from pyiem.exceptions import SIGMETException
from pyiem.nws.products.sigmet import parser, compute_esol
from pyiem.util import utc, get_test_file
def mydict():
"""return dict."""
return dict(lon=-85.50, lat=42.79)
N... |
the-stack_0_6015 | import hashlib
import json
from sanic import response
from datasette.utils import (
CustomJSONEncoder,
InterruptedError,
detect_primary_keys,
detect_fts,
)
from datasette.version import __version__
from .base import HASH_LENGTH, RenderMixin
class IndexView(RenderMixin):
name = "index"
def ... |
the-stack_0_6018 | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""pydoc widget"""
# Standard library imports
import os.path as osp
import sys
# Third party imports
from qtpy.QtCore import Qt, QThread, QUrl, Signal
... |
the-stack_0_6026 | """Definition of the Element Summation Component."""
import collections
import numpy as np
from scipy import sparse as sp
from six import string_types
from openmdao.core.explicitcomponent import ExplicitComponent
class SumComp(ExplicitComponent):
r"""
Compute a vectorized summation.
Use the add_equatio... |
the-stack_0_6028 | # 不觉得代码顶头没有几句`import`很难受吗?
# 有条件者可使用PyPy运行。
result = set()
with open('words_alpha.txt', encoding='utf-8') as f:
for word in f.read().splitlines():
result.add(word)
with open('out.txt', 'wb') as f:
for word in sorted(result):
if len(word) >= 5: # 过滤单词!
try:
f.write... |
the-stack_0_6030 | # Copyright (c) 2020, NVIDIA CORPORATION.
import itertools
import warnings
import numpy as np
import pandas as pd
import cudf
import cudf._lib as libcudf
from cudf._lib.join import compute_result_col_names
from cudf.core.dtypes import CategoricalDtype
class Merge(object):
def __init__(
self,
lh... |
the-stack_0_6031 | """
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
import re
from cfnlint.rules import CloudFormationLintRule
from cfnlint.rules import RuleMatch
class SubNeeded(CloudFormationLintRule):
"""Check if a substitution string exists without a substitution fun... |
the-stack_0_6033 | import clara
import requests as r
import os
from flask import json
from flask import jsonify
from flask import Flask
from flask import request
app = Flask(__name__)
telegram_key = ''
@app.route("/")
def main():
return "Personal Clara instance."
@app.route("/new-message", methods=['POST'])
def handle_message():
... |
the-stack_0_6034 | # coding=utf-8
# This is a sample Python script.
from aliyunIoT import Device
import ujson
import network
import utime as time
from driver import GPIO
from driver import UART
t1 = 30
gas_threshold = 5.0
liq_mdcn_alarm = False
gas_alarm = False
version = 'v0.0.1'
uart1 = UART('serail1')
liq_level = GPIO()
gpio = GPIO()... |
the-stack_0_6035 | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from .mixins import PrometheusScraperMixin
from ..base import AgentCheck
from ...errors import CheckException
from six import string_types
class PrometheusScraper(PrometheusScraperMixin):
"""
This class... |
the-stack_0_6041 | # -*- coding: utf-8 -*-
#
# Copyright 2014 Thomas Amland <thomas.amland@gmail.com>
#
# 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
#
# Unles... |
the-stack_0_6042 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
the-stack_0_6043 | import logging
import os
import sys
import click
from rich.logging import RichHandler
from labfunctions.conf.server_settings import settings
# from labfunctions.control_plane import rqscheduler
from labfunctions.types.agent import AgentConfig
from labfunctions.utils import get_external_ip, get_hostname
hostname = g... |
the-stack_0_6044 | from .ad_hoc import *
from nltk import WordNetLemmatizer
from config import cfg
def extract_tokens(sentence, str_list=None):
"""
Extract tokens among a sentences, meanwhile picking out the
proper nouns and numbers.
:param str sentence: The sentence to tokenize.
:param list str_list: Proper nouns.
... |
the-stack_0_6046 | import time
from multiprocessing import Pool, cpu_count
import click
from lib.lsun_room_api.lsun_room.item import DataItems
def worker(item):
#item.remap_layout()
item.save_layout()
@click.command()
@click.option('--dataset_root', default='../data/lsun_room/')
def main(dataset_root):
for phase in ['tr... |
the-stack_0_6047 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
the-stack_0_6048 | from __future__ import print_function, absolute_import
import sys
import time
from collections import OrderedDict
import torch
import numpy as np
from .evaluation_metrics import cmc, mean_ap
from .tlift import TLift
def pre_tlift(gallery, query):
gal_cam_id = np.array([cam for _, _, cam, _ in gallery])
gal_... |
the-stack_0_6050 | # Copyright (c) 2013, TeamPRO and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from datetime import datetime
from calendar import monthrange
from frappe import _, msgprint
from frappe.utils import flt
def execute(filters=None):
if not filt... |
the-stack_0_6054 | # -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... |
the-stack_0_6057 | import os
import numpy as np
import xarray as xr
import netCDF4 as nc
from glob import glob
from functools import partial
from os import makedirs as mkdir
from multiprocessing import get_context
from datetime import datetime, timedelta
os.environ['OMP_NUM_THREAD'] = '1'
# Set up init to use sys.argv later
init = dat... |
the-stack_0_6058 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
the-stack_0_6060 | """
Copyright 2016 Rackspace
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
dist... |
the-stack_0_6064 | import textwrap
import unittest
from stone.backends.js_client import JavascriptClientBackend
from test.backend_test_util import _mock_output
from stone.ir import Api, ApiNamespace, ApiRoute, Void, Int32
from stone.ir.data_types import Struct
MYPY = False
if MYPY:
import typing # noqa: F401 # pylint: disable=impo... |
the-stack_0_6065 | # Copyright 2014 OpenStack Foundation
#
# 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 ... |
the-stack_0_6067 | import json
import os
import sys
import argparse
import shutil
import logging
import re
from zipfile import ZipFile
from google.cloud.storage import Blob, Bucket
from Tests.scripts.utils.log_util import install_logging
from Tests.Marketplace.marketplace_services import init_storage_client, Pack, \
load_json, store... |
the-stack_0_6069 | # (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
import mock
import pytest
from datadog_checks.base.utils.common import get_docker_hostname
from datadog_checks.dev.kube_port_forward import port_forward
from datadog_checks.dev.terraform import... |
the-stack_0_6072 | import logging
from django.apps import apps
from django.db.utils import OperationalError, ProgrammingError
from django.utils import six
from django.utils.translation import ugettext_lazy as _
from mayan.apps.common.class_mixins import AppsModuleLoaderMixin
from mayan.apps.common.classes import PropertyHelper
from may... |
the-stack_0_6073 | # Gamma is a discrete RandomVariable that represents
# the instantaneous values of a model parameter
# to be embedded into continuous space
# parameters:
#
# stencil : list of values that the parameter takes
# alphas: probabilities of taking each value.
# For example, stencil = [2, 3] and alphas=[0.2, 0.8]
# means th... |
the-stack_0_6077 | #
# Copyright 2018 Quantopian, 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 agreed to in wr... |
the-stack_0_6078 | # Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import unittest
import numpy as np
from extensions.ops.reorgyolo import ReorgYoloOp
from mo.front.common.extractors.utils import layout_attrs
from mo.graph.graph import Node
from unit_tests.utils.graph import build_graph
nodes_attribu... |
the-stack_0_6079 | import numpy
import theano
from theano import tensor
from theano.tests.breakpoint import PdbBreakpoint
from theano.tests import unittest_tools as utt
from theano.tensor.tests import test_basic
import theano.sandbox.gpuarray
from .. import basic_ops
from ..type import GpuArrayType, gpuarray_shared_constructor, get_con... |
the-stack_0_6080 | import math
import torch
import torch.nn as nn
from .utils import to_cpu
# This new loss function is based on https://github.com/ultralytics/yolov3/blob/master/utils/loss.py
def bbox_iou(box1, box2, x1y1x2y2=True, GIoU=False, DIoU=False, CIoU=False, eps=1e-9):
# Returns the IoU of box1 to box2. box1 is 4, box2... |
the-stack_0_6082 | """A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abs... |
the-stack_0_6083 | # Copyright 2017 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... |
the-stack_0_6090 | import argparse
import datetime
import gym
import envs
import numpy as np
import torch
import imageio
import itertools
from rl.model import GaussianPolicy, QNetwork, DeterministicPolicy
from transformer_split.util import getGraphStructure
from transformer_split.vae_model import VAE_Model
from torch.nn import functio... |
the-stack_0_6091 | # ===================================================================================== #
# Module for solving Ising models exactly.
#
# Distributed with ConIII.
#
# NOTE: This code needs cleanup.
#
# Author : Edward Lee, edlee@alumni.princeton.edu
# ===================================================================... |
the-stack_0_6092 | #!/usr/bin/env python3
"""
GTSAM Copyright 2010-2020, Georgia Tech Research Corporation,
Atlanta, Georgia 30332-0415
All Rights Reserved
See LICENSE for the license information
Code generator for wrapping a C++ module with Pybind11
Author: Duy Nguyen Ta, Fan Jiang, Matthew Sklar, Varun Agrawal, and Frank Dellaert
"""... |
the-stack_0_6093 | # Copyright (c) 2014 Dark Secret Software 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 agree... |
the-stack_0_6094 | from common.func_plots import get_plot_pca
from common.func_plots import get_plot_line
from sklearn.preprocessing import StandardScaler, MinMaxScaler
from sklearn.decomposition import PCA
from datetime import datetime as ddtime
from scipy import signal
import datetime as dtime
import pmdarima as pm
import pandas as pd
... |
the-stack_0_6099 | #!/usr/bin/env python
import os
import re
#Definitions
def run(files=None,verbose=True,overwrite=None,output=None,macros={},build='',compile_string=''):
l=create_file_objs(files,macros)
mod2fil=file_objs_to_mod_dict(file_objs=l)
depends=get_depends(fob=l,m2f=mod2fil)
if verbose:
for i in depe... |
the-stack_0_6100 | from django import forms
def should_be_empty(value):
if value:
raise forms.ValidationError('Field is not empty')
class ContactForm(forms.Form):
name = forms.CharField(max_length=80, widget=forms.TextInput(
attrs={'placeholder': 'Your Name', 'class': 'form-control'}))
email = forms.EmailF... |
the-stack_0_6101 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.