text stringlengths 2 999k |
|---|
# Copyright The PyTorch Lightning team.
#
# 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 i... |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
# Copyright (c) 2018 Juniper Networks, Inc.
# All rights reserved.
# Use is subject to license terms.
#
# Author: cklewar
import datetime
import yaml
import lib.constants as c
from peewee import BooleanField
from peewee import CharField
from peewee import... |
class CNN(nn.Module):
def __init__(self):
super().__init__() # Important, otherwise will throw an error
self.cnn = nn.Sequential(
nn.Conv2d(3, 32, kernel_size=5, stride=1, padding=2), # 32x32x32
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=2, stride=2, padding=0), # 32x16x16
... |
"""
11720 : 숫자의 합
URL : https://www.acmicpc.net/problem/11720
Input #1:
1
1
Output #1:
1
Input #2:
5
54321
Output #2:
15
"""
input()
numbers = input()
sum = 0
for n in numbers:
sum += int(n)
print(sum) |
# coding=utf8
# --------------------------------------------------------
# Scene Graph Generation by Iterative Message Passing
# Licensed under The MIT License [see LICENSE for details]
# Written by Danfei Xu
# --------------------------------------------------------
import argparse, json, string
from collections impo... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
主页: https://docs.locust.io/en/stable/
压力测试框架,有web ui
"""
from locust import HttpLocust, TaskSet, between, task
# 定义的用户行为集合
class UserBehavior(TaskSet):
"""用户单次需要执行的任务"""
def on_start(self):
"""当所有任务集合开始之前调用"""
self.log... |
#!/usr/bin/python
'''The MIT License (MIT)
Copyright (c) 2017 Yu Xiong Wei(try.dash.now@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation... |
""" define the IntervalIndex """
from operator import le, lt
import textwrap
from typing import Any, Optional, Tuple, Union
import numpy as np
from pandas._config import get_option
from pandas._libs import lib
from pandas._libs.interval import Interval, IntervalMixin, IntervalTree
from pandas._libs.tslibs import Bas... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationE... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2015-2017, Lars Asplund lars.anders.asplund@gmail.com
"""
Generic simulator interface
"""
from __futu... |
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
# Copyright 2017 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use th... |
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import flt, cstr,nowdate,cint,get_datetime, now_datetime,add_months,getdate
@frappe.whitelist()
def get_data(curr_date=None,shift=None):
non_member_count,member_count,non_member_qty,member_qty,member_am... |
from django.test import SimpleTestCase
from django.urls import reverse, resolve
from payments.views import charge
class TestUrls(SimpleTestCase):
def test_url(self):
url = reverse('charge')
print(resolve(url))
self.assertEqual(resolve(url).func, charge)
|
"""WeightController URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
... |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import permission_required
from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.utils.translation import... |
#!/usr/bin/env python
import os
from setuptools import setup
from setuptools.command.test import test
import codecs
def root_dir():
rd = os.path.dirname(__file__)
if rd:
return rd
return '.'
class pytest_test(test):
def finalize_options(self):
test.finalize_options(self)
sel... |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 15 21:38:13 2018
@author: david
"""
#!/usr/bin/env python
# encoding: utf-8
from collections import namedtuple
from datasketch import MinHash
from graphviz import Digraph
import hashlib
import json
import math
import networkx as nx
import os
import os.path
import re
imp... |
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
"""
Base Learner, without Meta-Learning.
Can be used to train for good average performance, or for the oracle environment.
"""
import os
import time
import wandb
import gym
import numpy as np
import torch
from algorithms.a2c import A2C
from algorithms.online_storage import OnlineStorage
from algorithms.ppo import PPO... |
from __future__ import print_function
from skimage.io import imread, imshow
from skimage.transform import rotate
import matplotlib.pyplot as plt
from PIL import Image
import multiprocessing
from tqdm import tqdm
import numpy as np
import sys
import os
import arg_config
import nuclear_gen
use_multiprocessing = True
n... |
from __future__ import absolute_import
from __future__ import division
import torch
from torch import nn
from torch.nn import functional as F
import torchvision
from ..utils.torchtools import weights_init_kaiming
__all__ = ['ResNet50', 'ResNet101', 'ResNet50M', 'ResNet50B']
class ResNet50(nn.Module):
def __ini... |
# -*- coding: utf-8 -*-
# Copyright 2022 <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
#
# Unle... |
import click
class IntOrPercent(click.ParamType):
name = "click_union"
def convert(self, value, param, ctx):
try:
float_value = float(value)
if 0 <= float_value <= 1:
return float_value
elif float_value == int(float_value):
return in... |
total = cont = 0
barato = 9999
nome = ' '
while True:
produto = str(input('Prduto: '))
preço = float(input('Preço: '))
total += preço
if preço >= 1000:
cont += 1
if barato > preço:
barato = preço
nome = produto
continuar = str(input('Deseja continuar? [S/N]: ')).upper()... |
import re
from faker.utils.decorators import slugify_domain
from .. import Provider as InternetProvider
class Provider(InternetProvider):
free_email_domains = (
'hol.gr', 'gmail.com', 'hotmail.gr', 'yahoo.gr', 'googlemail.gr',
'otenet.gr', 'forthnet.gr',
)
tlds = ('com', 'com', 'com', '... |
"""
CORE ANALYTICS MODULE: Generates the analytical meta-data from tables database, this distribution is consumed in data generation and augmentation
methods.
Max Row Support: 17
Max Column Support: 40
"""
import os
import cv2
import glob
import pickle
import numpy as np
import utility as ut
from tqdm import tqdm
... |
"""
schema.py - support for subSchemaSubEntry information
See http://www.python-ldap.org/ for details.
\$Id: models.py,v 1.48 2015/06/06 09:21:38 stroeder Exp $
"""
import UserDict,ldap.cidict
from ldap.schema.tokenizer import split_tokens,extract_tokens
if __debug__:
from types import TupleType,StringType,IntTy... |
import tensorflow as tf
import nature
LAYER = nature.Layer
MIN_LAYERS, MAX_LAYERS = 2, 4
UNITS_OPTIONS = [64, 128, 256, 512]
class MLP(tf.keras.layers.Layer):
"""
units_list: list of int for units
fns_list: list of strings for activations (default None)
"""
def __init__(self, AI, units=None, la... |
import data_provider
base_dir = '/root/shared_data/300W_LP/semi_frontal/'
out_dir = base_dir + 'experiments/reference_shapes_101/'
gt_dir = base_dir + '300W_LP_semi_frontal_101/'
bb_dir = base_dir + '300W_LP_semi_frontal_99/300W_LP_semi_frontal_bbs_VRA_new/'
pose_dir = base_dir + '300W_LP_semi_frontal_99/300W_LP_semi_... |
# coding: utf-8
from .future import * |
"""
Config dict for vanilla DQN(SIMPLE_CONFIG), DDQN with Priority Replay(DOUBLE_PRIO) and PPO(PPO_CONFIG)
̣__author__ = "Jonas Heitz"
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import numpy as np
import gym
from ray.rllib.models i... |
# Copyright (C) 2022. Huawei Technologies Co., Ltd. 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 restriction, including without limitation the rights to use, co... |
"""DictForArgs.py
See the doc string for the DictForArgs() function.
Also, there is a test suite in Tests/TestDictForArgs.py
"""
import re
class DictForArgsError(Exception):
"""Error when building dictionary from arguments."""
def _SyntaxError(s):
raise DictForArgsError('Syntax error: %r' % s)
_nameRE ... |
from setuptools import setup, find_packages
def read_requirements():
with open('requirements.txt', 'r') as req:
content = req.read()
requirements = content.split('\n')
return requirements
setup(
name='games_seeker',
version='1.0.0',
packages=find_packages(),
include_package_da... |
# uncompyle6 version 3.2.0
# Python bytecode 2.4 (62061)
# Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
# Embedded file name: pirates.pirate.BattleNPCGameFSM
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from direct.interval.IntervalGlobal... |
# -----------------------------------------------------.
# 独立した表面材質を持つ形状を検索.
#
# @title \en Search for independent materials \enden
# @title \ja 独立した表面材質を検索 \endja
# -----------------------------------------------------.
scene = xshade.scene()
# 階層をたどり、独立した材質を持つ形状を検索
# @param[in] shape 対象形状.
# @param[out] se... |
#!/usr/bin/python
# coding:utf8
'''
Created on 2017-04-07
Update on 2017-06-20
MapReduce version of Pegasos SVM
Using mrjob to automate job flow
@author: Peter/ApacheCN-xy/片刻
《机器学习实战》更新地址:https://github.com/apachecn/MachineLearning
'''
from mrjob.job import MRJob
import pickle
from numpy import *
class MRsvm(MRJob)... |
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from cgtsclient.common import base
class KubeUpgrade(base.Resource):
def __repr__(self):
return "<kube_upgrade %s>" % self._info
class KubeUpgradeManager(base.Manager):
resource_class = KubeUpgrade
@stati... |
import unittest
import verif.driver
import os
import numpy as np
import tempfile
np.seterr('raise')
all_axes = ["time", "leadtime", "timeofday", "dayofyear", "monthofyear", "day", "week", "month", "year", "leadtimeday", "location", "lat", "lon", "elev"]
class IntegrationTest(unittest.TestCase):
"""
These te... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from typing import Any, Dict, List
from ..data_objects import UnitData, MetaData, DisplayData
###############################################################################
log = logging.getLogger(__name__)
##############################################... |
meta = dict(
name='ping'
)
|
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "purefap.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
|
from tree import RGBXmasTree
from colorzero import Color, Hue
from time import sleep
import random
tree = RGBXmasTree()
# tree.brightness = 0.04
def random_colour():
colours = ['blue', 'green', 'yellow', 'cyan', 'magenta', 'red']
randomIndex = int(len(colours) * random.random())
return colours[randomIndex]
co... |
import argparse
import signal
import sys
import os
import time
import logging as log
from queue import Queue
from threading import Thread
import cv2 as cv
from expiringdict import ExpiringDict
# local modules
import config
import face_detection
import face_encoding
import face_matcher
import announcer
# globals
worke... |
from Class.locationClass import KH2Location, KH2ItemStat, KH2LevelUp, KH2FormLevel, KH2Bonus, KH2Treasure, KH2StartingItem, KH2ItemStat
from List.configDict import itemType, locationType
from Module.importantItems import getImportantChecks,getUsefulItems
from Module.itemPlacementRestriction import ItemPlacementRestr... |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from openapi_server.models.base_model_ import Model
from openapi_server import util
class KmAttribute(Model):
"""NOTE: This class is auto generated by OpenAPI Gen... |
#!/usr/bin/env python
"""
test_SAcC.py
test harness for SAcC.py
"""
import SAcC
import numpy as np
config = {}
# Input/Output files
filename = 'input8k.wav'
#filename = '60sec_37497_20120228_020100_24537_appen-cts-pus_F.wav'
outfilename = 'sacc8k.txt'
#outfilename = '60sec_37497_20120228_020100_24537_appen-cts-... |
import math
import pandas as pd
import numpy as np
from collections import defaultdict
from joblib import Parallel, delayed
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("darkgrid")
class ExponentiallyWeighted(object):
"""
Exponentially Weighted Moving Average Control Chart.
Implem... |
s = str(input()).replace(" ","")
q, p = input().split()
q = int(q)
p = str(p)
teste = s.count(p)
print(teste)
if teste == q:
print("SIM!")
else:
print("NAO!")
|
import sys
import torch
import argparse
from datetime import timedelta
import logging
sys.path.append("../")
sys.path.append("../../")
sys.path.append("../../../")
sys.path.append("../../../../")
sys.path.append("../../../../../")
from experiments.utils import evaluate_mnist_uncertainty
from src.data import *
from sr... |
"""Modules containing pytorch classes to fit 3D meshes to images using differentiable rendering."""
import copy
import numpy as np
import scipy.sparse.linalg
import scipy.spatial.transform.rotation
import torch
from . import CameraPytorch, LaplacianRigidEnergyPytorch, Scene3DPytorch
from .triangulated_mesh_pytorc... |
# coding=utf-8
from OTLMOW.OTLModel.Classes.Kamer import Kamer
# Generated with OTLClassCreator. To modify: extend, do not edit
class Reservoir(Kamer):
"""Een reservoir is een complexe kamer die verschillende niveaus en gekoppelde oppervlaktes kan hebben."""
typeURI = 'https://wegenenverkeer.data.vlaanderen.... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the resolution of forks via avalanche."""
import random
from test_framework.mininode import P2PInterface, m... |
# Generated by Django 2.1.5 on 2020-02-28 13:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('codeinthedark', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Contestant',
fields=[
... |
def test_4_Arbinbool():
candidato = []
f = open('salidas/generador_arboles/4_Arbin[bool].txt', 'r')
for arbol in f:
arbol = arbol.replace('\n','')
candidato.append(arbol)
solucion = []
f = open('tests/soluciones/generador_arboles/4_Arbin[bool].txt', 'r')
for arbol in f:
... |
"""Plot PCA for a given GEO dataset
Based on the tpm expression values of the given GEO dataset this script
post-processes the expression values and applies the PCA. The first two
principal components are used to plot samples in two dimensions. As
described in the paper, the quality probabilities are added to 10% of
t... |
from vg.compat import v2 as vg
from .._common.shape import check_shape_any
__all__ = ["project_point_to_line", "coplanar_points_are_on_same_side_of_line"]
def project_point_to_line(points, reference_points_of_lines, vectors_along_lines):
"""
Project a point to a line, or pairwise project a stack of points to... |
from mayan.apps.appearance.classes import Icon
icon_api = Icon(driver_name='fontawesome', symbol='plug')
icon_api_documentation = Icon(driver_name='fontawesome', symbol='book')
icon_api_documentation_redoc = Icon(driver_name='fontawesome', symbol='book')
|
from enum import Enum
from fastapi import HTTPException
from youwol.backends.treedb.models import PathResponse, DriveResponse
from youwol.environment.clients import RemoteClients, LocalClients
from youwol.environment.youwol_environment import Context
from youwol_utils.clients.assets_gateway.assets_gateway import Asse... |
#!/usr/bin/env python3
# Copyright (c) 2015-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Utilities for manipulating blocks and transactions."""
from .address import (
key_to_p2sh_p2wpkh,
... |
# Copyright (c) 2016 by Revisify. All Rights Reserved.
import calendar
import flask_sijax
import jinja2
import os
import re
from flask import Markup
from bleach import clean
from datetime import datetime
def configureJinja(app, version):
# Removes whitespace from rendered HTML
app.jinja_env.trim_blocks = Tr... |
class Matcher(object):
def __init__(self, df=None, metric=None):
pass
def match(self, pair):
self.features = []
self.tsim = None
@classmethod
def normalize(cls, s, df):
return s, 1
def features(self):
try:
return self._features
except AttributeError:
return [self.tsim]
def names(self):
try... |
# DADSA - Assignment 1
# Reece Benson
import json
import random
from classes import Player as Player
from classes import Season as Season
from classes import Tournament as Tournament
from classes import Round as Round
from classes import Match as Match
class Handler():
# Define the variables we will be using
... |
# coding: utf-8
"""Find the path to xgboost dynamic library files."""
import os
import platform
from typing import List
import sys
class XGBoostLibraryNotFound(Exception):
"""Error thrown by when xgboost is not found"""
def find_lib_path() -> List[str]:
"""Find the path to xgboost dynamic library files.
... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing M2M table for field phases on 'JudgingCriterion'
db.delete_table('challenges_judgingcriterion_p... |
from decimal import Decimal
import pytest
from model_mommy import mommy
from usaspending_api.financial_activities.models import (
FinancialAccountsByProgramActivityObjectClass,
TasProgramActivityObjectClassQuarterly,
)
from usaspending_api.submissions.models import SubmissionAttributes
@pytest.fixture
@pyt... |
from django.contrib import admin
from . import models
# Register your models here.
@admin.register(models.Image)
class ImageAdmin(admin.ModelAdmin):
search_fields = (
'location',
'caption',
)
list_display_links = (
'caption',
)
list_filter = (
'location',
... |
# Copyright (c) 2015 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 or agreed to ... |
import hither2 as hi
import kachery_client as kc
import multiprocessing
import os
from pymysql.err import OperationalError
import traceback
import time
from ._config import DATAJOINT_SERVER_PORT
DOCKER_IMAGE_NAME = 'datajoint-server-pytest'
def run_service_datajoint_server():
# The following cleanup is needed ... |
# BSD 3-Clause License
#
# Copyright (c) 2019, Elasticsearch BV
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, t... |
from abc import abstractmethod, ABCMeta
from collections import defaultdict, namedtuple
import logging
import numpy as np
import queue
import threading
import time
from typing import Any, Callable, Dict, List, Iterable, Optional, Set, Tuple,\
TYPE_CHECKING, Union
from ray.util.debug import log_once
from ray.rllib.... |
# -*- coding:utf-8 -*-
#!/usr/bin/env python
from .database_configer import IDatabaseConfiger
__all__ = [ 'IDatabaseConfiger' ] |
# -*- coding: utf-8 -*-
#
# files management documentation build configuration file.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that... |
import _plotly_utils.basevalidators
class ShowscaleValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self,
plotly_name='showscale',
parent_name='scattergeo.marker',
**kwargs
):
super(ShowscaleValidator, self).__init__(
plotly_name=plot... |
from paginator import Paginator
sequence = list(range(30))
paginator = Paginator(sequence, 5) # sequence to paginate, items on page
print("Amount of pages:", paginator.num_pages)
print()
page = paginator.page(6)
print("Current page:", page)
print("Current page number:", page.number)
print("Current page data:", pa... |
from rest_framework import serializers
from rest_auth.registration.serializers import RegisterSerializer
from allauth.account.adapter import get_adapter
from allauth.account.utils import setup_user_email
from . import models
from ritmusgram.images import serializers as images_serializers
class UserProfileSerializer(se... |
import numpy
from numpy import fft
from numpy.testing import (assert_almost_equal, assert_array_almost_equal)
import pytest
from scipy import ndimage
class TestNdimageFourier:
@pytest.mark.parametrize('shape', [(32, 16), (31, 15)])
@pytest.mark.parametrize('dtype, dec',
[(numpy... |
from sample_factory.runner.run_description import RunDescription, Experiment, ParamGrid
_params = ParamGrid([
('env', ['MiniGrid-MemoryS7-v0', 'MiniGrid-RedBlueDoors-8x8-v0', 'MiniGrid-MemoryS17Random-v0']),
('use_rnn', [True, False]),
('mem_size', [4, 0]),
])
_experiment = Experiment(
'mem_minigrid',... |
from collections import Counter
class Solution:
def permuteUnique(self, nums):
"""
Time complexity: (N - w) * O(Summation of P(N-w, k))
w = number of duplicate elements
P(N - w, k) := permutation of unique elements of k from N - w elements
P(N - w, k) = (N-w)!/(N-... |
# Webhooks for external integrations.
import json
import os
from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webho... |
'''
Created on May 25, 2012
@author: Jason Huang
'''
def getV(a, i):
if(i < 0):
return -float('inf')
if(i >= len(a)):
return float('inf')
return a[i]
def findK(a, b, K):
'''binary search based approach
'''
def findKImpl(a, b, k):
lo = 0
... |
#!/usr/bin/env python3
import argparse
import os
import subprocess
import sys
def setup():
global args, workdir
programs = ['ruby', 'git', 'apt-cacher-ng', 'make', 'wget']
if args.kvm:
programs += ['python-vm-builder', 'qemu-kvm', 'qemu-utils']
elif args.docker:
dockers = ['docker.io',... |
import numpy as np
from test.util import generate_kernel_test_case, wrap_template
from webdnn.graph.graph import Graph
from webdnn.graph.operators.sigmoid import Sigmoid
from webdnn.graph.order import OrderCNHW, OrderNHWC
from webdnn.graph.variable import Variable
@wrap_template
def template(r=1.0, x_order=OrderNHWC... |
# 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 ... |
import numpy as np
import os
import warnings
import openseespy.opensees as ops
def _getNodesandElements():
"""
This function returns the nodes and elments for an active model, in a
standardized format. The OpenSees model must be active in order for the
function to work.
Returns
-------
nodes : 2dArray
... |
from unittest import TestCase
from nose_parameterized import parameterized
import os
import gzip
import pandas as pd
from pandas import read_csv
from pyfolio.utils import to_utc
from pandas.util.testing import assert_frame_equal, assert_series_equal
from pyfolio.risk import (compute_style_factor_exposures,
... |
# [SublimeLinter @python:3]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division, print_function, absolute_import
from .pygubuapp import GUIApplication
from .exceptioncatcher import TkExceptionCatcher
from .filedialog import *
from .messagebox import *
from .custombox import *
from . import mess... |
#!/usr/bin/env python2
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test mulitple rpc user config option rpcauth
#
from test_framework.test_framework import BitcoinTestFrame... |
"""
sine.py
Play a sine wave over the default output device.
Supports specifying backend, device, sample rate, block size.
"""
import array as ar
import argparse
import math
import time
from pysoundio import (
PySoundIo,
SoundIoFormatFloat32LE,
)
class Player:
def __init__(self, freq=None, backend=Non... |
"""
homeassistant.components.media_player.kodi
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides an interface to the XBMC/Kodi JSON-RPC API
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.kodi/
"""
import logging
import urllib
from homeass... |
import os
import unittest
import unittest.mock as mock
from google.cloud import bigquery
from google.cloud import exceptions
from parsons import GoogleBigQuery, Table
class TestGoogleBigQuery(unittest.TestCase):
def setUp(self):
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'foo'
self.tmp_gcs_buc... |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... |
import streamlit as st
import pandas as pd
import joblib
def create_inference_input(df):
"""
Function that creates an input form for ML model.
The function will build the structure for an input form
using Streamlit functions. The input from the form will be
taken and converted into a dictionary wi... |
# compute business duration records
import csv
import sys
fname = "sa.txt" # default file name
argn=0
asic_only = False
all = False
known_start = False
current = False
inactive = False
old = False
for arg in sys.argv:
argn += 1
if (argn == 1):
continue
if arg[0:1] != "-":
fname = str(arg)
continue
if arg... |
import codecs
import gzip
import hashlib
import lzma
import os
import tarfile
import zipfile
import numpy as np
import torch
from torch.utils.model_zoo import tqdm
def _gen_bar_updater():
pbar = tqdm(total=None)
def bar_update(count, block_size, total_size):
if pbar.total is None and total_size:
... |
"""
A collection of image utilities using the Python Imaging Library (PIL).
Note that PIL is not a dependency of SciPy and this module is not
available on systems that don't have PIL installed.
"""
from __future__ import division, print_function, absolute_import
# Functions which need the PIL
import numpy
import te... |
import cv2 as cv
import numpy as np
import time
def intersection(img):
height,width,channels=img.shape
ppt = np.array([
[width/20,height/20*19],
[width/20*19,height/20*19],
[width/20*19,height/20],
[width/20,height/20]
], np.int32)
ppt = ppt.reshape((-1, 1, 2))
c... |
# python3
def change(full_sum, denoms):
sums = [0]
for current_sum in range(1, full_sum + 1):
prev_sums = [current_sum - coin for coin in denoms
if current_sum - coin >= 0]
sums.append(min([sums[ps] + 1 for ps in prev_sums]))
return sums[-1]
if __name__ == '__main__... |
import sys
import time
import os.path as osp
from progressbar import ProgressBar
from .reader import VideoReader
VIDEO_LIST = [
'2018-03-11.16-30-08.16-35-08.hospital.G436.avi', # no missing
'2018-03-07.16-55-06.17-00-06.school.G336.avi', # have missing
'2018-03-11.11-25-01.11-30-01.school.G424.avi',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.