text stringlengths 2 999k |
|---|
# Copyright 2021 Canonical Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, soft... |
from __future__ import print_function
import os
try:
from pathlib import Path
except ImportError:
from pathlib2 import Path
import random
from compose.cli.main import TopLevelCommand, project_from_options
from jumpssh import util as jumpssh_util
TESTS_DIR = Path(__file__).parent
class DockerEnv(object):
... |
# -*- coding: UTF-8 -*-
#
# Copyright (C) 2017 DouLe
#
import Queue
import struct
import ctypes.wintypes
# Win32 API
CreateFileW = ctypes.windll.kernel32.CreateFileA
ReadDirectoryChangesW = ctypes.windll.kernel32.ReadDirectoryChangesW
GetLastError = ctypes.windll.kernel32.GetLastError
# Constant
FIL... |
class Solution:
def __init__(self):
self.memo = [[[0 for _ in range(16)] for _ in range(6)] for _ in range(5000)]
def _dfs(self, times_left: int, roll_max: list, prev: int, conti_len: int):
ans = 0
for idx, r in enumerate(roll_max):
if idx != prev or conti_len < r:
... |
#!/usr/bin/env python3
# -*- coding: utf-8; -*-
# The MIT License (MIT)
#
# Copyright (c) 2021 Álan Crístoffer e Sousa
#
# 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, ... |
# coding: utf-8
# In[9]:
import tensorflow as tf
import numpy as np
x_data = np.array([[0,0],[0,1],[1,0],[1,1]], dtype = np.float32)
# In[10]:
y_data = np.array([[0],[1],[1],[0]], dtype = np.float32)
X = tf.placeholder(tf.float32, [None,2])
Y = tf.placeholder(tf.float32, [None,1])
# In[11]:
W1 = tf.Variab... |
"""
The field classes to represent a WASM program.
"""
from io import BytesIO
from struct import pack as spack
from . import OPCODES
LANG_TYPES = {
'i32': b'\x7f',
'i64': b'\x7e',
'f32': b'\x7d',
'f64': b'\x7c',
'anyfunc': b'\x70',
'func': b'\x60',
'emptyblock': b'\x40', # pseudo type f... |
"""
Created on Thu Dec 12 13:19:18 2019
@author: tageldim
"""
# import os
import os
import girder_client
import json
from histomicstk.workflows.workflow_runner import Workflow_runner, \
Slide_iterator, Annotation_iterator
# import warnings
# warnings.simplefilter('once', UserWarning)
def connect_to_api(apiurl, ... |
from __future__ import absolute_import
from .suites import NAMED_SUITES
from .loggers import NAMED_LOGGERS
|
'''
This library provides some simple routines for doing templating.
Owain Kenway, 2017
'''
# Apply dictionary of key, replacements to string s.
def templatestring(s, keys):
r = s
for a in keys.keys():
r = r.replace(a, str(keys[a]))
return r
# Apply dictionary of key, replacements t... |
import nltk
from nltk.corpus import wordnet
from random import randint
from .patalib import PataLib
class Synonym(PataLib):
""" Sub class of PataLib
"""
def generate_synonym(self, input_word):
""" Generate Synonym using a WordNet
synset.
"""
results = []
re... |
"""
Copyright 2018 Goldman Sachs.
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 di... |
"""Module to handle app errors"""
class ValidationError(Exception):
"""Base class for handling errors"""
status_code = 400
def __init__(self, payload=None, status_code=None):
"""Initialize error handler"""
Exception.__init__(self)
if status_code is not None:
self.statu... |
from marshmallow import Schema, fields, pre_dump
from ebl.fragmentarium.application.line_to_vec import LineToVecScore
class LineToVecScoreSchema(Schema):
museum_number = fields.String(required=True, data_key="museumNumber")
script = fields.String(required=True)
score = fields.Int(required=True)
@pre... |
# Adapted from https://github.com/dask/dask-examples/blob/master/tests/nbrun.py
import sys
import os
from pathlib import Path
import nbconvert
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
import glob
def run_notebook(in_filepath):
if not in_filepath.is_file():
raise IOError('Fi... |
# cmdline: -O
# test optimisation output
print(__debug__)
assert 0
|
#!/usr/bin/env python
"""This is a development server for running the UI."""
import logging
import os
import socket
import SocketServer
import ssl
from wsgiref import simple_server
import ipaddr
from grr.config import contexts
# pylint: disable=unused-import,g-bad-import-order
from grr.gui import local
from grr.li... |
# Copyright 2011 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 a... |
# Redis数据库地址
REDIS_HOST = '127.0.0.1'
# Redis端口
REDIS_PORT = 6379
# Redis密码,如无填None
REDIS_PASSWORD = None
REDIS_KEY = 'proxies'
# 代理分数
MAX_SCORE = 100
MIN_SCORE = 0
INITIAL_SCORE = 10
VALID_STATUS_CODES = [200, 302]
# 代理池数量界限
POOL_UPPER_THRESHOLD = 50000
# 检查周期
TESTER_CYCLE = 20
# 获取周期
GETTER_CYCLE = 300
# 测试AP... |
# Collect the results of the various model test runs
import json
import os
SUMMARY_FILE = os.environ["SUMMARY_FILE"]
CONFIG = os.environ["CONFIG"]
DATASET = os.environ["DATASET_NAME"]
task_mapping = {
"story_report.json": "story_prediction",
"intent_report.json": "intent_classification",
"CRFEntityExtracto... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from advertorch.context import ctx_noparamgrad_... |
# Copyright (c) 2010-2017 Bo Lin
# Copyright (c) 2010-2017 Yanhong Annie Liu
# Copyright (c) 2010-2017 Stony Brook University
# Copyright (c) 2010-2017 The Research Foundation of SUNY
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
#... |
import random
import mmcv
import torch
from mmgen.models.architectures.common import get_module_device
from mmgen.models.architectures.stylegan.generator_discriminator_v2 import \
StyleGANv2Generator
from mmgen.models.builder import MODULES
@MODULES.register_module()
class SwapStyleGANv2Generator(StyleGANv2Gener... |
import logging
import random
import concurrent.futures
import threading
import queue
import time
def producer(queue, event):
"""Pretent we're getting a number from the networ."""
while not event.is_set():
message = random.randint(1, 101)
logging.info("Producer get message: %s", message)
... |
from abc_type import IdaTypes
from ida_types import IDA_TYPES
from serializer_ida_type import serialize_to_string
class IdaTTypedef(IdaTypes):
def __init__(self, ida_type=IDA_TYPES['typedef']):
self.ida_type = {'idt': ida_type, 'value': None}
def decode(self, data):
import ida_decoder
... |
import numpy as np
import pytest
from lrbenchmark.dataset import InMemoryCommonSourceKFoldDataset
@pytest.fixture
def X() -> np.ndarray:
return np.reshape(np.array(list(range(25))), (5, 5))
@pytest.fixture
def y() -> np.ndarray:
return np.array(['a', 'b', 'c', 'd', 'e'])
def test_get_splits_is_mutually_e... |
#!/usr/bin/env python3
# Copyright (c) 2019 The PIVX developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# -*- coding: utf-8 -*-
from time import sleep
from test_framework.mininode import network_thread_start
from test_fra... |
# Copyright 2016-2017 Open Source Robotics Foundation, 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 applicabl... |
# - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
Trainers.LightGbmRegressor
"""
import numbers
from ..utils.entrypoints import EntryPoint
from ..utils.utils import try_set, unlist
def trainers_lightgbmregressor(
training_data,
predictor_model=None,
num_boost_round=100,
... |
from .tasks import Task
from .futures import Future
class AbstractEventLoop:
def create_task(self, coro) -> Task:
pass
def run_in_executor(self, executor, func, *args) -> Future:
pass |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
# -*- coding: utf-8 -*-
"""Class for the ogs PARTICLE DEFINITION file for RANDOM_WALK."""
import numpy as np
from ogs5py.fileclasses.base import File
class PCT(File):
"""
Class for the ogs Particle file, if the PCS TYPE is RANDOM_WALK.
Parameters
----------
data : np.array or None
particl... |
#!/usr/bin/env python2
# Copyright (c) 2015-2017 The Syndicate Cash developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Test script for security-check.py
'''
from __future__ import division,print_function
import subproce... |
# Copyright 2016 Hynek Schlawack
#
# 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 writi... |
import argparse
import logging
import os
import torch
import torch.distributed as dist
from ssd.engine.inference import do_evaluation
from ssd.config import cfg
from ssd.data.build import make_data_loader
from ssd.engine.trainer import do_train
from ssd.modeling.detector import build_detection_model
from ssd.solver.b... |
# Copyright (C) 2017-2019 New York University,
# University at Buffalo,
# Illinois Institute of Technology.
#
# 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 th... |
#!/usr/bin/python
##
# @file
# This file is part of SeisSol.
#
# @author Sebastian Rettenberger (rettenbs AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Sebastian_Rettenberger,_M.Sc.)
#
# @section LICENSE
# Copyright (c) 2013, SeisSol Group
# All rights reserved.
#
# Redistribution and use in source and binary for... |
import numpy as np
from UQpy.Distributions import *
from UQpy.RunModel import RunModel
from UQpy.Transformations import *
########################################################################################################################
############################################################################... |
#!/usr/bin/env python
"""
This is an Ansible dynamic inventory for OpenStack.
It requires your OpenStack credentials to be set in clouds.yaml or your shell
environment.
"""
from __future__ import print_function
import json
import os
from keystoneauth1.exceptions.catalog import EndpointNotFound
import shade
def b... |
"""
Provides useful functions and classes. Most useful are probably
printTreeDocs and printTreeSpec.
:copyright: Copyright since 2006 by Oliver Schoenborn, all rights reserved.
:license: BSD, see LICENSE_BSD_Simple.txt for details.
"""
import sys
from .. import py2and3
__all__ = ('printImported', 'StructMsg', 'Callb... |
import unittest
import termcolor
from Quiz import Quiz
from Question import Question
class TestQuizClass(unittest.TestCase):
def test_get_categories(self):
"""Test Quiz.get_categories()"""
categories = Quiz.get_categories()
self.assertEqual(type(categories), dict)
self.assertTrue(le... |
import importlib
import socket as _socket
import pytest
log_udp = importlib.import_module('log-udp')
@pytest.mark.usefixtures('mock_pwd_grp')
def test_log_udp(capsys, mocker, host='127.0.0.1', port=9, encoding='utf-8'):
msg = 'spam lovely spam'
packets = iter([msg.encode(encoding)])
def recvfrom_into(... |
# 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, ... |
"""
Copyright (c) 2016-2019 Keith Sterling http://www.keithsterling.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
the rights to use, copy, m... |
# Generated by Django 2.2.6 on 2019-10-31 13:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0005_auto_20191031_0908'),
]
operations = [
migrations.AddField(
model_name='car',
name='car_image',
... |
"""
WSGI config for widget_tests project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "widget_tests.settings")
from dja... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("myprocess")
process.TFileService=cms.Service("TFileService",fileName=cms.string('JECplots.root'))
##-------------------- Communicate with the DB -----------------------
process.load('Configuration.StandardSequences.Services_cff')
#process.load('Configurat... |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of th... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Project',
fields=[
('id', models.AutoField(auto... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... |
# 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 ... |
"""Top-level package for caulobacter stuff."""
from .img_visualization import *
from .img_processing import *
from .cc_plotter import *
from .modeling import *
from .misc import *
__author__ = 'Rosita Fu'
__email__ = 'rfu@caltech.edu'
__version__ = '0.0.1'
|
# License: MIT
import os
import abc
import time
import numpy as np
from typing import List
from collections import OrderedDict
from openbox.utils.logging_utils import setup_logger, get_logger
class BOBase(object, metaclass=abc.ABCMeta):
def __init__(self, objective_function, config_space, task_id='task_id', outp... |
import echo
print("After import, __name__ is", __name__, "and echo.__name__ is", echo.__name__)
|
from django.urls import path
from notification import views
urlpatterns = [
path('register/', views.ApiFcmDeviceRegister.as_view()),
path('send/', views.ApiSendFcm.as_view()),
path('send/notice/', views.ApiSendNotice.as_view()),
path('send/chat/', views.ApiSendChat.as_view()),
path('list/notice/'... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.5
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... |
# -*- coding: utf-8 -*-
import asyncio
import thriftpy
from thriftpy.rpc import make_aio_server
echo_thrift = thriftpy.load("echo.thrift", module_name="echo_thrift")
class Dispatcher(object):
async def echo(self, param):
print(param)
await asyncio.sleep(0.1)
return param
def main():
... |
import sqlalchemy as sa
from sqlalchemy import and_
from sqlalchemy import desc
from sqlalchemy import exc as sa_exc
from sqlalchemy import ForeignKey
from sqlalchemy import func
from sqlalchemy import Integer
from sqlalchemy import lateral
from sqlalchemy import literal_column
from sqlalchemy import MetaData
from sqla... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
import tensorlayer as tl
from tests.utils import CustomTestCase
class Simple_MNIST_Test(CustomTestCase):
@classmethod
def setUpClass(cls):
# define placeholder... |
import os
import logging
import subprocess
from disco.util.logging import LOG_FORMAT
from raven import Client
from raven.transport.gevent import GeventedHTTPTransport
ENV = os.getenv('ENV', 'local')
DSN = os.getenv('DSN')
REV = subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
VERSION = '1.3.0'
raven_cl... |
from otree.api import (
models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer,
Currency as c, currency_range
)
author = 'Your name here'
doc = """
Your app description
"""
class Constants(BaseConstants):
name_in_url = 'fwt_reread1'
players_per_group = None
num_ro... |
#!/usr/bin/env python3
# Various support routines for processing Fritzing's fzp and svg files.
# Change this from 'no' to 'yes' to cause 0 length/width terminal definitions
# to be warned about but not modified, to being changed (which will cause them
# to move in the svg and need repositioning) to a length/width of ... |
from rest_framework import serializers
from .models import Task
class TaskSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Task
fields = ('id', 'title', 'description', 'date_created', )
|
import igraph
import csv
import Queue
import random
import itertools
import operator
color_list = []
def purify():
people = {}
to_be_discarded = set()
with open('users.csv', 'rb') as csvfile:
reader = csv.reader(csvfile)
v_index = 0
for row in reader:
proc_person = ro... |
import numpy as np
from abc import ABC, abstractmethod
from ml_lib.base.estimator import Estimator
class DecisionTree(Estimator):
def __init__(self, max_depth=-1):
self.max_depth = max_depth
self._node = None
def fit(self, X, y):
self._node = self._build_tree(X, y, depth=0)
def _... |
VERSION = (1, 3, 4)
|
default_app_config = 'danceschool.guestlist.apps.GuestListAppConfig'
|
#coding:utf-8
# pip install lxml
import os
import glob
import json
import shutil
import numpy as np
import xml.etree.ElementTree as ET
path2 = "."
START_BOUNDING_BOX_ID = 1
def get(root, name):
return root.findall(name)
def get_and_check(root, name, length):
vars = root.findall(name)
i... |
from django.shortcuts import render
from .models import Post
def index(request):
latest = Post.objects.order_by("-pub_date")[:11]
return render(request, "index.html", {"posts": latest})
def index_wrong(request):
latest = Post.objects.order_by("-pub_date")[:11]
render(request, "index.html", {"posts"... |
import re,json,sys
def takeFirst(elem):
return elem[1]
def transfer_binary(seqlen,start,end):
bseq='0'+'0'*int(start)+'1'*(int(end)-int(start))+'0'*(int(seqlen)-int(end))
return bseq
def fix_position(pos_list):
pos_fina=[]
for pos in pos_list:
if pos:
pos_fina.app... |
import cv2
import numpy as np
import imutils
import matplotlib.pyplot as plt
matrix_test = None
perimeters=[]
img=cv2.imread("Images/LinkRotated.jpg",1)
img_height,img_width=img.shape[:2]
blur_img = cv2.bilateralFilter(img,1,75,75)
grey_img=cv2.cvtColor(blur_img,cv2.COLOR_BGR2GRAY)
_,thresh_img=cv2.threshold(grey_img,... |
import io
import js
class OutputIO(io.TextIOBase):
def __init__(self):
super().__init__()
self.output = js.document.getElementById("output")
def write(self, string):
self.output.innerHTML += string
def clear(self):
self.output.innerHTML = ""
def notify(self, string)... |
import unittest
class TestPriorityQueue(unittest.TestCase):
def test_priority_queue(self):
priority_queue = PriorityQueue()
self.assertEqual(priority_queue.extract_min(), None)
priority_queue.insert(PriorityQueueNode('a', 20))
priority_queue.insert(PriorityQueueNode('b', 5))
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Model definitions and handling
"""
from .model import Model, ModelFixed, ModelSelect, ModelWeighted
from .model import ModelInterpolate
from .model import model_from_dict
from .fitter import fit_mock, fit_optimize, fit_select, fit_interpolate
|
#install python3 first
import requests
import os
from bs4 import BeautifulSoup as bs #pip install bs4
import pprint
try:
os.mkdir("Octocats")
os.chdir("Octocats")
except OSError:
os.chdir("Octocats")
base_url = "https://octodex.github.com/"
resp = requests.get(base_url)
soup = bs(resp.text, 'html.pars... |
from .. import util
json = util.remove_control_characters(_(r"""
eJztWW1v27oV/iuM74e0gKum6b0DFgwrija4TZcmW5usKJaLgJIomY0sCiQVx2jvf99zDklZdp006YZ92ObWjkSRh+f9PIf6MmnV
jb+0xswvdTk5ED9PxcR5ab1uax7G2JdJK+cKF5OzmRLHqnbiWOYTzJSNlo4e7NFdqVxhdee1aWnsk+mFXMgrJXQrpFjMtFeCSGbi
Jf7mxutCXBtdKOHk0h1c2IuWvh9VU5i5moqXtqA1Nz4T75ai621n... |
"""Constants for the Automower integration."""
from homeassistant.components.vacuum import (
SUPPORT_BATTERY,
SUPPORT_PAUSE,
SUPPORT_RETURN_HOME,
SUPPORT_STATUS,
SUPPORT_STOP,
SUPPORT_TURN_OFF,
SUPPORT_TURN_ON,
)
DOMAIN = "automower"
DEFAULT_ICON = "mdi:robot-mower"
VENDOR = "Husqvarna"
VA... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
# borg cli interface / toplevel archiver code
import sys
import traceback
try:
import argparse
import collections
import configparser
import faulthandler
import functools
import hashlib
import inspect
import itertools
import json
import logging
import os
import re
i... |
# forms.py
import urllib
def scriptInputFormWithErrorMessage(version, errorMessage):
return '''<html><head><title>SlideSpeech {0}</title></head>
<body><br><br><hr><br><center><form action="getScriptName" method="GET">
SlideSpeech Script:<br>
<input type="text" name="name" size... |
import numpy as np
# `pip install easydict` if you don't have it
from easydict import EasyDict as edict
#import datasets
from cityscapes import *
from kitti import *
from virtual_kitti import *
# -----------------------------------
# pathes to change
# -----------------------------------
#
# data_dir: path to data... |
# -*- coding: utf-8 -*-
"""DNACenterAPI devices API fixtures and tests.
Copyright (c) 2019-2021 Cisco Systems.
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 witho... |
from pylps.core import *
from pylps_vis.visualiser import PylpsVisualiserApp
from kivy.uix.label import Label
initialise(max_time=10)
create_fluents('location(_, _)')
create_actions('swap(_, _, _, _)')
create_events('swapped(_, _, _, _)')
create_variables('X', 'Y', 'Z', 'N1', 'N2', 'N3')
observe(swap('E', 5, 'F', 6)... |
"""
Tests for face.processing module
"""
import numpy as np
import face.processing
def test_scale_image_keeping_aspect_ratio_vertial_image():
image = np.zeros(shape=[10, 20])
target_size = 30
# Vertical dimension smaller
rescaled_image = face.processing.scale_image_keeping_aspect_ratio(image, targ... |
"""Joint scatter plot of two variables."""
from ..data import convert_to_dataset
from .plot_utils import _scale_fig_size, xarray_var_iter, get_coords, get_plotting_function
from ..utils import _var_names
def plot_joint(
data,
group="posterior",
var_names=None,
transform=None,
coords=None,
figs... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
import re
import six
import sys
import unittest
import metricbeat
import getpass
import os
SYSTEM_CPU_FIELDS = ["cores", "idle.pct", "iowait.pct", "irq.pct", "nice.pct",
"softirq.pct", "steal.pct", "system.pct", "user.pct", "total.pct"]
SYSTEM_CPU_FIELDS_ALL = ["cores", "idle.pct", "idle.ticks", ... |
#!/usr/bin/env python3
# Copyright (c) 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Create a blockchain cache.
Creating a cache of the blockchain speeds up test execution when running
mu... |
from features.features_extractors_mediapipe import * |
######################################################################
#
# File: b2sdk/v0/__init__.py
#
# Copyright 2019 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
from b2sdk.v1 import *
from b2sd... |
import logging
import time
from .. import api
from .decorators import authentication_required
logger = logging.getLogger(__name__)
class HelloWorldResource:
"""For testing purposes"""
async def on_get(self, req, resp):
logger.info("[Busy-Beaver] Hit hello world endpoint", extra={"test": "payload"})
... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
import pytest
from starlette.applications import Starlette
from starlette.responses import PlainTextResponse
from starlette.testclient import TestClient
from starlette_i18n import (
LocaleDefaultMiddleware,
LocaleFromCookieMiddleware,
LocaleFromHeaderMiddleware,
get_locale_code,
load_gettext_transl... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure tha... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
from odoo.tools.float_utils import float_is_zero, float_repr
class ReplenishmentReport(models.AbstractModel):
_inherit = 'report.stock.report_product_product_replenishment'
def _compute... |
import os
import sys
import math
import time
import codecs
import typing
import asyncio
import logging
import itertools
import collections
from bisect import bisect_right
from asyncio import Event, sleep
from collections import defaultdict, namedtuple
from contextlib import suppress
from functools import partial
from e... |
##################### generated by xml-casa (v2) from ptclean6.xml ##################
##################### 6a89d05724a14fedd7b8ceb75d841936 ##############################
from __future__ import absolute_import
from casashell.private.stack_manip import find_local as __sf__
from casashell.private.stack_manip import find... |
# Copyright 2020 The DDSP Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
from django.conf.urls import url, include
from django.contrib.auth import views as auth_views
from cmdbox.core import views as core_views
from cmdbox.snippets import views as snippets_views
from cmdbox.scaffold_templates import views as scaffold_templates_views
urlpatterns = [
url(r'^$', core_views.home, name='h... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.