filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_14155 | #!/usr/bin/python
# Classification (U)
"""Program: get_status.py
Description: Unit testing of get_status in elastic_db_admin.py.
Usage:
test/unit/elastic_db_admin/get_status.py
Arguments:
"""
# Libraries and Global Variables
# Standard
import sys
import os
if sys.version_info < (2, 7):
... |
the-stack_0_14156 | from enum import Enum
from typing import Optional
import numpy as np
from pydantic import PrivateAttr, validator
from ..events import EventedModel
from ..events.custom_types import Array
from ..translations import trans
from .colorbars import make_colorbar
from .standardize_color import transform_color
class Colorm... |
the-stack_0_14157 | import sys
import gzip
import json
if __name__ == '__main__':
if len(sys.argv) != 3:
print('Usage: python3 convert_mrqa_to_fgc.py <mrqa-format-input-fpath> <fgc-format-output-fpath>')
exit(1)
input_fpath = sys.argv[1]
output_fpath = sys.argv[2]
# Read MRQA-forma... |
the-stack_0_14159 | '''OpenGL extension EXT.separate_shader_objects
This module customises the behaviour of the
OpenGL.raw.GLES2.EXT.separate_shader_objects to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/EXT/separate_shader_objects.txt
'''... |
the-stack_0_14160 | # py-motmetrics - Metrics for multiple object tracker (MOT) benchmarking.
# https://github.com/cheind/py-motmetrics/
#
# MIT License
# Copyright (c) 2017-2020 Christoph Heindl, Jack Valmadre and others.
# See LICENSE file for terms.
"""Functions for loading data and writing summaries."""
from __future__ import absolu... |
the-stack_0_14161 | #
# Copyright 2014 Quantopian, Inc.
# Modifications Copyright 2018 Alpaca
#
# 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 require... |
the-stack_0_14166 | import sys
import threading
import time
from io import StringIO
from typing import Optional
from labml.internal.api import ApiCaller, ApiDataSource, Packet
WARMUP_COMMITS = 5
class ApiLogs(ApiDataSource):
api_caller: Optional[ApiCaller]
frequency: float
def __init__(self):
super().__init__()
... |
the-stack_0_14168 | class NFCTransactionDialog(AnimatedPopup):
mode = OptionProperty('send', options=('send','receive'))
scanner = ObjectProperty(None)
def __init__(self, **kwargs):
# Delayed Init
global NFCSCanner
if NFCSCanner is None:
from electrum_xuez_gui.kivy.nfc_scanner import NFCS... |
the-stack_0_14169 | """
Деменчук Г.М., вариант 6, стандартные задания
"""
import math
import matplotlib.pyplot as plt
class GraphClass:
"""
Вариант задания для операторов цикла + график
Класс для вывода графика варианта задания
для операторов цикла
"""
def __init__(self):
self.graph()
def graph(se... |
the-stack_0_14170 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
the-stack_0_14172 | from topaz.module import ClassDef
from topaz.objects.objectobject import W_Object
class W_ProcObject(W_Object):
classdef = ClassDef("Proc", W_Object.classdef)
def __init__(self, space, bytecode, w_self, lexical_scope, cells, block,
parent_interp, top_parent_interp, regexp_match_cell,
... |
the-stack_0_14173 | #
# Copyright 2013-2014 eNovance <licensing@enovance.com>
#
# Authors: Mehdi Abaakouk <mehdi.abaakouk@enovance.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.... |
the-stack_0_14175 | import datetime
import os
# =================================================
# Background Information
# -------------------------------------------------
mip = "cmip5"
exp = "historical"
frequency = "mo"
realm = "atm"
# =================================================
# Analysis Options
# --------------------------... |
the-stack_0_14176 | import numpy as np
def get_samples_complex(fp,n):
z = fp.read(2*n)
if len(z)!=2*n:
return None
s = np.fromstring(z,dtype='int8')
s.shape = (n,2)
x = np.empty(n,dtype='c8')
x.real = s[:,0]
x.imag = s[:,1]
return x
|
the-stack_0_14177 | import sys
import os
import cfnresponse
import boto3
import botocore
import json
import logging
logger = logging.getLogger()
logger.setLevel(os.getenv("LOG_LEVEL", "DEBUG"))
def lambda_handler(event, context):
try:
logger.debug("Received event: {}".format(json.dumps(event)))
result = cfnresponse.... |
the-stack_0_14178 | import math
from typing import Sequence, Tuple
import torch
from torch import nn
from torch.nn import functional as F
from tensorfn.config import config_model
from pydantic import StrictInt, StrictFloat
from .layer import DropPath, tuple2, PositionwiseFeedForward
LayerNorm = lambda x: nn.LayerNorm(x, eps=... |
the-stack_0_14179 | #!/usr/bin/env python
#
# esp-idf NVS partition generation tool. Tool helps in generating NVS-compatible
# partition binary, with key-value pair entries provided via a CSV file.
#
# Copyright 2018 Espressif Systems (Shanghai) PTE LTD
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use ... |
the-stack_0_14182 | import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
meessage = Mail(
from_email='from_email@example.com',
to_emails='to@example.com',
subject='Sending with Twilio SendGrid is Fun',
html_content='<strong>and easy to do anywhere, even with Python</strong>')
try:
... |
the-stack_0_14183 | """
Density fitting and interpolation classes
"""
import numpy as np
from scipy.optimize import leastsq, least_squares, curve_fit
from scipy.interpolate import PchipInterpolator, CubicSpline
import pdb
# Idealised models
def sech(z):
return 2./(np.exp(z) + np.exp(-z))
def ideal_rho_tanh(z, rho0, drho, dp, L):
... |
the-stack_0_14186 | import math
import json
import numpy as np
import torch
from mmcv.runner import get_dist_info
from torch.utils.data import Sampler
class DistributedClassAwareSampler(Sampler):
def __init__(self, dataset, samples_per_gpu=1, num_replicas=None, rank=None, seed=1, sample_weight_path=None):
_rank, _num_replic... |
the-stack_0_14187 | #!/usr/bin/env python
""" get_result.py """
import click
from urllib.parse import parse_qsl, urljoin, urlparse
import requests
from bs4 import BeautifulSoup
DAUM_DICT_HOST = "https://dic.daum.net/"
LANG = 'eng'
COMMAND_SET = {
'a': 'antonym',
'e': 'example sentences',
's': 'synonym',
'q': 'quit'
}... |
the-stack_0_14188 | import numpy as np
import torch
import torch.nn.functional as F
def restore_bn(kernel, bn, conv_bias):
gamma = bn.weight
std = (bn.running_var + bn.eps).sqrt()
bias = -bn.running_mean
new_bias = (conv_bias - bn.bias) / gamma * std - bias
new_weight = kernel * (std / gamma).reshape(-1, 1, 1, 1)
... |
the-stack_0_14189 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import cv2
"""
image = mpimg.imread('./images/waymo_car.jpg')
#Image Dimensions
print("Image Dimensions: ", image.shape)
"""
"""
Starting with B & W
"""
"""
#Covert to GrayScale
convGrayScale = ... |
the-stack_0_14194 | # (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernme... |
the-stack_0_14195 | import datetime as dt
import functools
import itertools
import logging
from logging.handlers import RotatingFileHandler
import os
import sys
import threading
import traceback
# pylint: disable=redefined-builtin
from codecs import open
from collections import namedtuple
from time import time
from cli_helpers.tabular_out... |
the-stack_0_14196 | import copy
import logging
import os
import time
from collections import Counter
from statistics import mean
import numpy as np
import pandas as pd
from .fold_fitting_strategy import AbstractFoldFittingStrategy, SequentialLocalFoldFittingStrategy
from ..abstract.abstract_model import AbstractModel
from ...constants i... |
the-stack_0_14197 | """
Account (OOC) commands. These are stored on the Account object
and self.caller is thus always an Account, not an Object/Character.
These commands go in the AccountCmdset and are accessible also
when puppeting a Character (although with lower priority)
These commands use the account_caller property which tells the... |
the-stack_0_14200 | import mxnet as mx
import numpy as np
import cv2
from tools.rand_sampler import RandSampler
class DetIter(mx.io.DataIter):
"""
Detection Iterator, which will feed data and label to network
Optional data augmentation is performed when providing batch
Parameters:
----------
imdb : Imdb
i... |
the-stack_0_14204 | from parse_tree import parse_sentence
from statement import *
import statement
def reit(logic_val, reference):
if len(reference) > 1:
return False
logic_tree = parse_sentence(logic_val)
ref_tree = parse_sentence(reference[0])
return compareTree(logic_tree, ref_tree)
def orIntro(logic_val, re... |
the-stack_0_14205 | import logging
import pandas as pd
from scipy.sparse import csr_matrix
from sklearn.feature_extraction.text import TfidfVectorizer
from datasets.nlp import NLP
from representations.representation import Representation
logger = logging.getLogger()
class TfIdf(Representation):
def __init__(self, args):
s... |
the-stack_0_14206 | #
# Copyright (c) 2019-2021 Triad National Security, LLC
# All rights reserved.
#
# This file is part of the bueno project. See the LICENSE file at the
# top-level directory of this distribution for more information.
#
'''
Bueno run script for the unstructured mesh physics mini-app,
PENNANT
'''... |
the-stack_0_14208 | #!/usr/bin/python3
import socket
import threading
import time
import numpy as np
from picamera2 import Picamera2
from picamera2.encoders import H264Encoder
from picamera2.outputs import CircularOutput, FileOutput
lsize = (320, 240)
picam2 = Picamera2()
video_config = picam2.video_configuration(main={"size": (1280, 72... |
the-stack_0_14209 | #!/usr/bin/env python
from __future__ import print_function, division
import itertools, time, copy
import collections, random
import os, pickle
import numba
import numpy as np
board_size = 15
estimate_level = 4
t_random = 0#.01# controls how random the bonus for level=0
show_q = False
def strategy(state):
""" AI'... |
the-stack_0_14210 | # -*- 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 or... |
the-stack_0_14211 | import json
import os
table_objects = ["bowl", "bottle", "can", "computer keyboard", "keypad", "display", "phone", "jar", "knife", "lamp", "laptop", "microphone"
"mug", "remote", "wine bottle"]
data = json.load(open('taxonomy.json'))
for datapoint in data:
for obj in table_objects:
if obj ... |
the-stack_0_14213 | from scripts.logger import Logger
from wows.wowsapi import WowsApi
from wows.wowsdb import Wows_database
import math
class WorldofWarships:
def __init__(self, key, db_path):
self.logger = Logger(self.__class__.__name__)
self.logger.debug('Initializing wows class.')
self.wowsapi = WowsApi(key)
self.wowsdb = Wo... |
the-stack_0_14214 | import graphene
from graphene_django.types import DjangoObjectType
from .models import Category, Ingredient
class CategoryType(DjangoObjectType):
class Meta:
model = Category
class IngredientType(DjangoObjectType):
class Meta:
model = Ingredient
class Query(object):
category = graphen... |
the-stack_0_14215 | """Helpers."""
import inspect
from collections import Iterable, Mapping
from typing import Optional, Tuple, List, Iterable as IterableType
from aiohttp import web
from mimeparse import parse_media_range, _filter_blank
from .abc.field import FieldABC
from .fields.decorators import Tag
from .typings import Callee, Mim... |
the-stack_0_14216 | """
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... |
the-stack_0_14217 | # Copyright 2015 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_14218 | from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7
# importing the Kratos Library
import KratosMultiphysics
import KratosMultiphysics.ShallowWaterApplication as Shallow
# Check that KratosMultiphysics was imported in the main script
Kr... |
the-stack_0_14219 | #!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Run regression test suite.
This module calls down into individual test cases via subprocess. It will
f... |
the-stack_0_14220 | from nonebot import on_request, get_driver
from nonebot.adapters.onebot.v11.bot import Bot
from nonebot.adapters.onebot.v11.event import GroupRequestEvent, FriendRequestEvent
from nonebot.adapters.onebot.v11.message import Message
try:
master = get_driver().config.master
except:
master = []
add_req = on... |
the-stack_0_14221 |
from functools import partial
import threading
import os
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty, OptionProperty
from kivy.core.window import Window
from kivy.uix.button import Button
from kivy.utils import platform... |
the-stack_0_14223 | from urllib.request import urlopen, Request
from urllib.parse import urlparse
from bs4 import BeautifulSoup
import re
import socket
import smtplib
import dns.resolver
import csv
import multiprocessing
TIMEOUT = 120
in_path = "alchemist_accelerator.csv"
out_path = "alchemist_accelerator_result.csv"
headers = {"User-A... |
the-stack_0_14224 | #!/usr/bin/env python3
import subprocess
import os
import tempfile
import shutil
import codecs
import sys
import time
import json
def makeDirs(path) :
os.makedirs(path, exist_ok = True)
def writeFile(fileName, content) :
file = codecs.open(fileName, "w", "utf-8")
file.write(str(content))
file.close()
def execu... |
the-stack_0_14225 | # -*- coding: utf-8 -*-
# Definition of item pipelines
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from w3lib.html import remove_tags, remove_tags_with_content
from scrapy.exceptions import DropItem
class RemoveTagsPipeline(object):
"""removing formatting tags (span, a, ...) from extracted pa... |
the-stack_0_14226 | import logging
import os
import time
import h5py
import numpy as np
from scipy.sparse import coo_matrix, csr_matrix
from implicit.datasets import _download
log = logging.getLogger("implicit")
URL = 'https://github.com/benfred/recommender_data/releases/download/v1.0/reddit.hdf5'
def get_reddit():
""" Returns ... |
the-stack_0_14227 | import numpy as np
from scipy import ndimage
import tifffile as tiff
import matplotlib.pyplot as plt
import pandas as pd
from enum import Enum
from skimage.transform import resize
# Worldview-3 - Panchromatic (3349, 3338): 400nm - 800nm
# Worldview-3 RGB (3350, 3338)
# Worldview-3 - 8 Multispectral bands (838, 835):... |
the-stack_0_14228 | """Base classes for all estimators."""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
import copy
import warnings
from collections import defaultdict
import platform
import inspect
import re
import numpy as np
from . import __version__
from .utils import _IS_32BIT
_DEFAULT_TAGS = ... |
the-stack_0_14231 | import numpy as np
WARMRATE=0.5
class NSB:
def apply(self,data):
self.df = data
def iterrt(self):
df = self.df
# First we'll calculate the hourly RT for NSB: nrt
df['nrt']=0.0
rt=22
newtonK=0.036
for i,row in df.iterrows():
rtsp = row.n... |
the-stack_0_14232 |
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import re
from base64 import b64decode
from flask import Flask, Response, request
from netaddr import IPAddress, IPSet
from typing import Callable, Any, cast, Dict, Tuple
from math import ceil
import dateparser
''' GL... |
the-stack_0_14234 | # 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 the ... |
the-stack_0_14235 | from django import forms
from django.utils.translation import gettext_lazy as _
from i18nfield.forms import I18nModelForm
from pretalx.common.mixins.forms import ReadOnlyFlag
from pretalx.mail.context import get_context_explanation
from pretalx.mail.models import MailTemplate, QueuedMail
from pretalx.person.models imp... |
the-stack_0_14236 | # -*- coding: utf-8 -*-
import hashlib, json, os, sys, socket, traceback, time, struct, collections
from datetime import datetime, timedelta
from struct import calcsize
from google.protobuf.json_format import MessageToJson
from threading import RLock
from futu.common.conn_mng import *
from futu.common.sys_config impor... |
the-stack_0_14237 | #!/usr/bin/env python
# Lint as: python3
from absl.testing import absltest
from grr_response_core.lib.rdfvalues import osquery as rdf_osquery
from grr_response_server.gui.api_plugins import osquery as api_osquery
class UtilsTest(absltest.TestCase):
"""Test for osquery utils."""
def testListToCSVBytes(self):
... |
the-stack_0_14239 | # -*- coding: utf-8 -*-
"""
Package setup
"""
import sys
import os
import io
import setuptools
from setuptools import setup
def read(fname):
with io.open(
os.path.join(os.path.dirname(__file__), fname), encoding="utf-8"
) as _in:
return _in.read()
if __name__ == "__main__":
import versio... |
the-stack_0_14240 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... |
the-stack_0_14242 |
from ..ch09.adaptable_heap_priority_queue import AdaptableHeapPriorityQueue
def shortest_path_lengths(g, src):
"""Compute shortest-path distances from src to reachable vertices of g.
Graph g can be undirected or directed, but must be weighted such that
e.element() returns a numeric weight for each edge e.
Ret... |
the-stack_0_14243 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=12
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for... |
the-stack_0_14245 | """
Parser and serializer for file formats supported by compare-locales library:
https://hg.mozilla.org/l10n/compare-locales/
"""
from __future__ import absolute_import
import logging
from collections import OrderedDict
from compare_locales import (
parser,
serializer,
)
from pontoon.sync import SyncError
fr... |
the-stack_0_14246 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from hanlp import *
"""
File: source/inputters/voc.py
"""
# Default word tokens
PAD_token = 0 # Used for padding short sentences
# SOS_token = 1 # Start-of-sentence token
# EOS_token = 2 # End-of-sentence token
# UNK_token = 3 # unknown token
#
# tokenizer = None
#
#... |
the-stack_0_14247 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import range
from builtins import super
import mock
import string
import unittest
import random
from pprint import pprint
from bhive import Hive
from bhive.e... |
the-stack_0_14248 | # -*- coding: utf-8 -*-
#
# 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
... |
the-stack_0_14249 | from typing import Dict, Optional, Tuple
from kale.types.blockchain_format.program import Program, INFINITE_COST
from kale.types.condition_opcodes import ConditionOpcode
from kale.types.spend_bundle import SpendBundle
from kale.util.condition_tools import conditions_dict_for_solution
from kale.wallet.cc_wallet import ... |
the-stack_0_14250 | import xarray as xr
from matplotlib import pyplot as plt
from matplotlib import dates as mdates
def _get_labels(da, label):
# Add legend label
if label is None:
try:
# Set the label for each line so that they can
# be returned by Legend.get_legend_handles_labels()
... |
the-stack_0_14251 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 3 of the Lic... |
the-stack_0_14252 | # -*- coding: utf-8 -*-
# @Time : 2022/3/31 13:52
# @Author : ZhaoXiangPeng
# @File : create_setting.py
import os
import shutil
class CreateSetting:
def create(self):
if os.path.exists('setting.py'):
confirm = input("配置文件已存在 是否覆盖 (y/n). ")
if confirm != "y":
... |
the-stack_0_14255 | # coding=utf-8
"""
2
2 1 4 3
4
1 2 0 2
"""
def solver(n, init, m, nums):
ret = []
for i in nums:
gap = 2**i
init = reverseNum(init, gap) # 每gap间隔翻转
cur = computeReversePair(init)
ret.append(cur)
return ret
def reverseNum(init, gap):
ret = []
for i in range(0, l... |
the-stack_0_14257 | # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from textwrap import dedent
from typing import Dict
from twitter.common.collections import OrderedSet
from pants.option.config import Config
from pants.testutil.test_base import TestBase... |
the-stack_0_14259 | # Copyright (c) 2017 The Verde Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#
"""
Test the utility functions.
"""
from unittest import mock
import numpy as np
import numpy.... |
the-stack_0_14260 | import warnings
import pytest
import numpy as np
from numpy.testing import (
assert_, assert_equal, assert_raises, assert_warns, assert_array_equal,
temppath,
)
from numpy.core.tests._locales import CommaDecimalPointLocale
LD_INFO = np.finfo(np.longdouble)
longdouble_longer_than_double = (LD_INFO.eps < n... |
the-stack_0_14261 | from datetime import datetime
from telegram import base, messageentity, userprofilephotos
import imageText
from io import BytesIO
import random
userKey = "userDict"
'''
This is the key needed to access the
user dictionary on the cotext.bot_data
dictionary.
'''
randomKey = "randomMsg"
'''
This is the key needed to a... |
the-stack_0_14262 | import math, random
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.autograd as autograd
import torch.nn.functional as F
USE_CUDA = torch.cuda.is_available()
Variable = lambda *args, **kwargs: autograd.Variable(*args, **kwargs).cuda() if USE_CUDA else autograd.Variable(*... |
the-stack_0_14263 | import os
import blend_pproc_render
""" SET THESE AS ARGUMENTS """
""" SET THESE AS ARGUMENTS """
# where to look for the meshes. Use multiple paths if there are more folders to look into
meshes_prefixes = ["C:/Users/benatti/codes/synchrono/src/data/vehicle/sedan/", 'C:/Users/benatti/codes/synchrono/src/data/sim... |
the-stack_0_14264 | from mermer.consensus.constants import ConsensusConstants
from mermer.consensus.pos_quality import _expected_plot_size
from mermer.types.blockchain_format.sized_bytes import bytes32
from mermer.util.hash import std_hash
from mermer.util.ints import uint8, uint64, uint128
def is_overflow_block(constants: ConsensusCons... |
the-stack_0_14266 | #!/usr/bin/env python3
import wellmap
from pytest_unordered import unordered
from .param_helpers import *
class MockPathManager:
def check_named_plates(self, names):
pass
def get_index_for_only_plate(self):
return {'path': '/path/to/data'}
def get_index_for_named_plate(self, name):
... |
the-stack_0_14267 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. 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... |
the-stack_0_14268 | from datasette.plugins import DEFAULT_PLUGINS
from datasette.utils import detect_json1
from .fixtures import ( # noqa
app_client,
app_client_no_files,
app_client_with_hash,
app_client_shorter_time_limit,
app_client_larger_cache_size,
app_client_returned_rows_matches_page_size,
app_client_tw... |
the-stack_0_14269 | """
Background Music Example
If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.background_music
"""
import time
import arcade
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 300
SCREEN_TITLE = "Starting Template Simple"
MUSIC_VOLUME = 0.5
class MyGame(arcade.Windo... |
the-stack_0_14270 | from enum import Enum
class KlineInterval(str, Enum):
ONE_MINUTE = '1m'
THREE_MINUTES = '3m'
FIVE_MINUTES = '5m'
FIFTEEN_MINUTES = '15m'
THIRTY_MINUTES = '30m'
ONE_HOUR = '1h'
TWO_HOURS = '2h'
FOUR_HOURS = '4h'
SIX_HOURS = '6h'
EIGHT_HOURS = '8h'
TWELVE_HOURS = '12h'
ON... |
the-stack_0_14273 | # Copyright 2014-2020 Chris Cummins <chrisc.101@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
#
# Unless required by applicable... |
the-stack_0_14274 | """
In this example we modify the mesh of a shape
by moving the points along the normals to the surface
and along the radius of a sphere centered at the center of mass.
At each step we redefine the actor so that the normals are
recalculated for the underlying polydata.
"""
from __future__ import division, print_functio... |
the-stack_0_14275 | import typing
from datetime import datetime
from ParadoxTrading.Indicator.Bar.BarIndicatorAbstract import BarIndicatorAbstract
from ParadoxTrading.Utils import DataStruct
class OpenBar(BarIndicatorAbstract):
def __init__(
self, _use_key: str, _idx_key: str = 'time', _ret_key: str = 'open'
):
... |
the-stack_0_14276 | # Copyright (c) 2012 OpenStack Foundation
# 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 ... |
the-stack_0_14278 | # coding: utf-8
# pew in unshortener-venv python ~/wm-dist-tmp/Unshortener/unshortener/unshortener.py
import requests
from datatools.url import *
from urllib.request import urlopen
from systemtools.basics import *
from systemtools.location import *
from systemtools.logger import *
import requests.auth
from datastruct... |
the-stack_0_14279 | import hashlib
import json
from time import time
from uuid import uuid4
from flask import Flask, jsonify, request
import sys
class Blockchain(object):
def __init__(self):
self.chain = []
self.current_transactions = []
self.nodes = set()
self.new_block(previous_hash=1, proof=99)
... |
the-stack_0_14280 | from Products.CMFCore.utils import getToolByName
from Products.Five.browser import BrowserView
from isaw.bibitems.browser.view import BibItemView
class PublicationView(BibItemView):
"""view class"""
@property
def authors(self):
members = self._get_members(self.context.authors)
return ', ... |
the-stack_0_14281 | """
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
import asyncio
import unitte... |
the-stack_0_14283 | # -*- coding: utf-8 -*-
name = u'simplejson'
version = '3.15.0'
description = \
"""
Simple, fast, extensible JSON encoder/decoder for Python
"""
variants = []
requires = ['boost' ]
def commands():
import os
libs_path = os.path.join(getenv("PYTHON_LIBS_PATH"), "simplejson", "%s" % version)
... |
the-stack_0_14284 | import requests
import petl
from parsons.etl.table import Table
from parsons.utilities import check_env
URI = 'https://api.targetsmart.com/'
class TargetSmartConnector(object):
def __init__(self, api_key):
self.uri = URI
self.api_key = check_env.check('TS_API_KEY', api_key)
self.headers ... |
the-stack_0_14285 | import datetime
import glob
import gzip
import json
import os
import pickle
import random
import time
from hashlib import sha256
import cv2
import numpy as np
from tqdm import tqdm
from pcs.augmentations import PCSDefaultAugmentor
from pcs.utils import (
convert_min_area_rect,
grayscale_to_float,
grayscal... |
the-stack_0_14286 | """
Copyright 2020, The Regents of the University of California.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this ... |
the-stack_0_14287 | # -*- coding: utf-8 -*-
#
# ResNet152 model definition is based on TensorFlow Slim implementation.
#
# Author: Gencer Sumbul, http://www.user.tu-berlin.de/gencersumbul/
# Email: gencer.suembuel@tu-berlin.de
# Date: 23 Dec 2019
# Version: 1.0.1
import tensorflow as tf
from nets.resnet_utils import resnet_arg_scope
fro... |
the-stack_0_14293 | # Copyright 2020 Tier IV, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
the-stack_0_14295 | # Copyright 2019, by the California Institute of Technology.
# ALL RIGHTS RESERVED. United States Government Sponsorship acknowledged.
# Any commercial use must be negotiated with the Office of Technology
# Transfer at the California Institute of Technology.
#
# This software may be subject to U.S. export control laws.... |
the-stack_0_14296 | import time
import logging
from datetime import datetime
import pytest
from tests.common.fixtures.ptfhost_utils import change_mac_addresses # lgtm[py/unused-import]
from tests.common.fixtures.ptfhost_utils import remove_ip_addresses # lgtm[py/unused-import]
from tests.common.fixtures.ptfhost_utils imp... |
the-stack_0_14298 | # Given a binary tree
# struct TreeLinkNode {
# TreeLinkNode *left;
# TreeLinkNode *right;
# TreeLinkNode *next;
# }
# Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL.
# Initially, all next pointers are set to NULL.
# Note:
# Y... |
the-stack_0_14300 | #
# Copyright 2020--2021 IBM Corp. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
the-stack_0_14305 | import datetime
from pycspr import crypto
from pycspr.serialisation.json.encoder.cl import encode_cl_value
from pycspr.types import Deploy
from pycspr.types import DeployApproval
from pycspr.types import DeployHeader
from pycspr.types import ExecutionArgument
from pycspr.types import ExecutableDeployItem
from pycspr.t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.