text stringlengths 2 999k |
|---|
# gpio_blink.py
# by Scott Kildall (www.kildall.com)
# LED is on pin 27, use a 1K Ohm reistor to ground
import RPi.GPIO as GPIO
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(27, GPIO.OUT)
state = True
# endless loop, on/off for 1 second
# while True:
for i in range(0,10):
GPIO.output(27,Tru... |
#! /usr/bin/env python3
# ------------------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------------------
# Copyright (c) 2017-2020 Nicolas Danet.
# < http://opensource.org/lice... |
# Generated by Django 2.1.3 on 2018-11-30 20:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('easyaudit', '0006_auto_20171018_1242'),
]
operations = [
migrations.AlterField(
model_name='crudevent',
name='event_... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Fourth Paradigm Development, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "Licen... |
# Copyright 2021 portfolio-robustfpm-framework Authors
# Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
# http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
# http://opensource.org/licenses/MIT>, at your option. This file may not be
# copied, modified, or distributed except ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
created by Halo 2020/10/28 11:28
https://tangshusen.me/Dive-into-DL-PyTorch/#/chapter03_DL-basics/3.12_weight-decay
"""
import torch
import torch.nn as nn
import numpy as np
import mytorch.d2lzh_pytorch as d2l
n_train, n_test, num_inputs = 20, 100, 200
true_w, true_b ... |
"""
观察者模式:
定义对象间一对多依赖,当对象改变时,依赖者会受到通知并自动更新
原则:
4.交互对象,采用松耦合
优点:
1.观察者和被观察者建立了松耦合
2.通知统一管理,广播通信
3.表示层和数据逻辑层分离,稳定的消息更新机制,抽象了更新接口
缺点:
1.观察者过多,会费时
2.循环依赖问题会崩溃
3.没法知道观察者是怎么变化的,只知道变化了
课题:
天气数据更新,同步到公告板,公告板可拓展
总结:
1.封装变化:主题状态在变,观察者数目和类型在变,改变观察者而不用改变主题
2.针对接口而不是实现:主题和观察者都使用了接口
3.... |
# -*- coding: utf-8 -*-
__version__ = "0.15"
default_app_config = "djmoney.apps.MoneyConfig"
|
# coding: utf-8
"""
LUSID API
FINBOURNE Technology # noqa: E501
The version of the OpenAPI document: 0.11.4425
Contact: info@finbourne.com
Generated by: https://openapi-generator.tech
"""
try:
from inspect import getfullargspec
except ImportError:
from inspect import getargspec as getf... |
# -*- coding: utf-8
"""Steps for behavioral style tests are defined in this module.
Each step is defined by the string decorating it. This string is used
to call the step in "*.feature" file.
"""
from __future__ import unicode_literals, print_function
from behave import when, then
from textwrap import dedent
import ... |
"""Weak reference support for Python.
This module is an implementation of PEP 205:
http://www.python.org/dev/peps/pep-0205/
This (angr-specific) copy of the weakref library from CPython includes a fix
for https://bugs.python.org/issue35615 . It can be removed, and callers can
revert to using the distribution library... |
"""Test Axis config flow."""
from unittest.mock import patch
import pytest
import respx
from openpeerpower import data_entry_flow
from openpeerpower.components.axis import config_flow
from openpeerpower.components.axis.const import (
CONF_EVENTS,
CONF_MODEL,
CONF_STREAM_PROFILE,
CONF_VIDEO_SOURCE,
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-08-09 00:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='RSVP',
... |
import sys
sys.path.append("./")
from conf.urls_conf import loginUrls
from utils.Log import Log
# from net.NetUtils import EasyHttp
from net.TestNet import EasyHttp
def check_login_magic(func):
def wrapper(*args, **kw):
reslut = False
msg = ''
for count in range(4):
reslut, ms... |
#!/usr/bin/env python
# __BEGIN_LICENSE__
# Copyright (c) 2015, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The xGDS platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this fi... |
# coding=utf-8
# Copyright (C) 2020 NumS Development 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... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# %% [markdown]
# # Decision tree for regression
#
# In this notebook, we present how decision trees are working in regression
# problems. We show differences with the decision trees previously presented in
# a classification setting.
#
# First, we load the penguins dataset specifically for solving a regression
# probl... |
import pandas as pd
import sys
sys.path.append('../')
from src.database.insert_data import ReadData
# Set testing objects
# read song data as dataframe
song_df = ReadData().readSongData()
# random sample n users
random_song_df = ReadData().random_select_user(song_df, 10)
def test_readSongData():
"""Test method... |
import tensorflow as tf
import ops as op
def input_placeholder(image_size, image_channel, label_cnt):
with tf.name_scope('inputlayer'):
inputs = tf.placeholder("float", [None, image_size, image_size, image_channel], 'inputs')
labels = tf.placeholder("float", [None, label_cnt], 'labels')
dropou... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
import os
import io
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import dash_table as dt
import dash_bootstrap_components as dbc
from dash_extensions import Download
fro... |
from django.contrib import admin
from profiles.models import *
class PayloadInline(admin.TabularInline):
model = Payload
class ProfileAdmin(admin.ModelAdmin):
list_display = ('identifier', 'machine', 'uuid', 'install_date', 'verification_state')
list_filter = ('identifier', 'machine', 'install_date', 'v... |
from pullenti.ner.ProcessorService import ProcessorService
from pullenti.ner.SourceOfAnalysis import SourceOfAnalysis
from pullenti.ner.core.VerbPhraseHelper import VerbPhraseHelper
#Запускает стандартный процессор , разбивает текст на токены и производит прверку того что текстовый токен является глаголом,также п... |
import random
import nltk
from pytorch_pretrained_bert import OpenAIGPTDoubleHeadsModel, OpenAIGPTTokenizer
model = OpenAIGPTDoubleHeadsModel.from_pretrained('openai-gpt')
tokenizer = OpenAIGPTTokenizer.from_pretrained('openai-gpt')
SPECIAL_TOKENS = ["<long>", "<quotes>", "<others>", "<cyberpunk>", "<text>", "... |
from .augmentation_wrapper import AugmentationWrapper
|
import torch
from torchvision import datasets, transforms
train_transforms = transforms.Compose([transforms.RandomRotation(30),
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
tra... |
# Copyright 2020 The Magenta 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 ... |
#!/usr/bin/env python3
from setuptools import setup
setup(
name='gwadoc',
version='0.1.0',
description=('Documentation for sense relations '
'for the Open Multilingual Wordnet'),
#long_description=long_description,
url='https://github.com/globalwordnet/gwadoc',
author='GWA Doc... |
class AsyncDevices:
def __init__(self, session):
super().__init__()
self._session = session
def getDevice(self, serial: str):
"""
**Return a single device**
https://developer.cisco.com/meraki/api-v1/#!get-device
- serial (string): (required)
"""
... |
import glob
import os
import numpy as np
from scipy import ndimage
from PIL import Image
import tensorflow as tf
from LabelDefinition import class_d_label
import cv2
import TiffFile
import pims
def readImageAndLabelFromFolders(paths,
number=None,
resize... |
import numpy as np
import matplotlib.pyplot as plt
from pprint import pprint
np.random.seed(0123)
##########################################
# Raw Neural Network using numpy
#
# Three layer neural network that predicts
# output of XOR gate
##########################################
# sigmoid acivation function
def ... |
from cryptography.fernet import Fernet
TARGET_DB = "test.db"
OUTPUT_ENCRYPT_DB = "test-encrypt.db"
OUTPUT_DECRYPT_DB = "test-decrypted.db"
# First let's copy the original file.
# Read the file.
with open(TARGET_DB, "rb") as db_contents:
data_from_file = db_contents.read()
# Encrypt a file.
with open(OUTPUT_ENCR... |
""" TODO """
import math
import sys
import os
from gplpy.gggp.grammar import CFG
from gplpy.evo.evolution import Experiment, Optimization, Setup, Problem, Evolution_EDA_LP_ECO
from gplpy.gggp.metaderivation import EDA
import gym
from GA import GA
randomSeed = 9756745635
# SETUP EXAMPLES ############################... |
# coding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from typing import TYPE_CHECKING, List
from feishu.dt_application import App
from feishu.dt_code import SimpleUser
from feishu.dt_enum import I18NType
from feishu.dt_help import make_datatype
from feishu.exception impo... |
from rest_framework import serializers
from main.models import Directory, Image, Author, Attachment
class AttachmentSerializer(serializers.ModelSerializer):
class Meta:
model = Attachment
fields = ['id', 'name', 'attachment_type']
class AttachmentNestedSerializer(serializers.HyperlinkedModelSeria... |
# Copyright 2017 ETH Zurich
#
# 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, sof... |
"""Setup HACS."""
from custom_components.hacs.enums import HacsStage
from aiogithubapi import AIOGitHubAPIException, GitHub
from homeassistant import config_entries
from homeassistant.const import EVENT_HOMEASSISTANT_STARTED
from homeassistant.const import __version__ as HAVERSION
from homeassistant.exceptions import C... |
# 25/4/2017
# This piece of code will extract the frames from the directory of videos, greyscale and concatenate them. It will then
# save a single video to the corresponding index of an h5py file, and pair it with the correct audio vector.
# The script will incrementally add to the h5py such that the total output is:
... |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import absolute_import
import logging
import re
import socket
import sys
import six
from py_utils import exc_util
from py_utils import retry... |
#!/usr/bin/env python
'''
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")... |
# -*- coding: utf-8 -*-
"""
The :mod:`parsimony.functions.neural` module contains classes for neural
networks.
Loss functions should be stateless. Loss functions may be shared and copied
and should therefore not hold anything that cannot be recomputed the next time
it is called.
Created on Tue Feb 14 22:49:2... |
from channels.routing import ChannelNameRouter, ProtocolTypeRouter, URLRouter
from django.urls import path
from .consumers import ClientConsumer, MainConsumer, WorkerConsumer
from .protocol import CHANNEL_MAIN, CHANNEL_WORKER
application = ProtocolTypeRouter(
{
# Client-facing consumers.
'websocke... |
# btrdb.point
# Module for Point classes
#
# Author: PingThings
# Created: Fri Dec 21 14:57:30 2018 -0500
#
# For license information, see LICENSE.txt
# ID: point.py [] allen@pingthings.io $
"""
Module for Point classes
"""
##########################################################################
## Imports
#####... |
import pkg_resources
import numpy as np
from astropy import units as u
from ginga.util import wcs
from ginga.canvas.types.all import Polygon, Path
from ginga.util.bezier import get_bezier
from hcam_widgets.compo.utils import field_stop_centre, gtc_focalplane_equivalencies
class CCDWin(Polygon):
def __init__(sel... |
"""
test__offline
"""
from __future__ import absolute_import
import os
from unittest import TestCase
from requests.compat import json as _json
import plotly
import json
fig = {
'data': [
plotly.graph_objs.Scatter(x=[1, 2, 3], y=[10, 20, 30])
],
'layout': plotly.graph_objs.Layout(
title... |
import pygame
from pygame.locals import *
from sys import exit
from random import randint
pygame.init()
#pygame.mixer.music.set_volume(0.1)
#musica_de_fundo = pygame.mixer.music.load('BoxCat_Games_-_08_-_CPU_Talk (1).mp3')
#pygame.mixer.music.play(-1)
#barulho_colisao = pygame.mixer.Sound('smw_coin (1).wav')
largur... |
# -*- coding: utf-8 -*-
"""Tests using pytest_resilient_circuits"""
from __future__ import print_function
import json
import os
import pytest
from datetime import datetime
from resilient_circuits.util import get_config_data, get_function_definition
from resilient_circuits import SubmitTestFunction, FunctionResult
from... |
from link import Wrapper
class FakeWrapper(Wrapper):
pass
|
#!/usr/bin/env /usr/bin/python3
import AHT20
import time
# Initialize an AHT20
aht20 = AHT20.AHT20(0)
while 1:
# Fill a string with date, humidity and temperature
#data = str(datetime.datetime.now()) + ";" + "{:10.2f}".format(aht20.get_humidity()) + " %RH;" + "{:10.2f}".format(aht20.get_temperature()) + " °C... |
# wdbsrcwin.py -- source window for wdb
import stdwin
from stdwinevents import *
import srcwin
class DebuggerSourceWindow(srcwin.SourceWindow):
def __init__(self, debugger, filename):
self.debugger = debugger
self.curlineno = 0
self.focus = 0
srcwin.SourceWindow.__init__(self, filename)
def close(self)... |
from greedysnake import GreedySnake, Direction, Signal
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import backend as K
import configparser
import sys
import warnings
from collections import deque
import random
warnings.filterwarnings("ignore")
np.set_printoptions(thresh... |
# Function to send reports
def sendReportEmail():
"""Based on From EMail ID, Password and To EMail ID from Config files,
we are trying to send data from the gmail account.
"""
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mi... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from torch.nn import functional as F
from detectron2.layers import paste_masks_in_image
from detectron2.structures import Instances
def detector_postprocess(results, output_height, output_width, mask_threshold=0.5):
"""
Resize the output ... |
from django.urls import re_path
from oscar.apps.catalogue import apps
class CatalogueConfig(apps.CatalogueConfig):
name = 'tests._site.apps.catalogue'
def get_urls(self):
from .views import ParentProductDetailView
urls = super().get_urls()
urls += [
re_path(
... |
import sys
import logging
from reconcile import queries
from reconcile.status import ExitCodes
from reconcile.utils.oc import OC_Map
from reconcile.utils.vault import VaultClient
QONTRACT_INTEGRATION = "cluster-deployment-mapper"
def run(dry_run, vault_output_path):
"""Get Hive ClusterDeployments from cluster... |
#######################################################################################
# 1.1
# Use a while loop to print out the numbers 1-10
#######################################################################################
# 1.2
# Use a for loop to print out the numbers 1-10
###############################... |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
# Used in the tests for PyRunner
import sys
print("runmod1: passed %s" % sys.argv[1])
|
import sofar as sf
from sofar.sofar import (_update_conventions,
_get_conventions,
_format_value_for_netcdf,
_format_value_from_netcdf,
_atleast_nd,
_nd_newaxis,
_verify_... |
#!/usr/bin/env python
from .lintAll import lint_all
def get_score(source=lint_all):
output = source()
scoreLine = output[-2]
# Score is located between leftmost slash and then rightmost space:
# -> Your code has been rated at 9.57/10 (previous run: 9.57/10, +0.00)
# ... |
#
# 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... |
from django.shortcuts import render
# Create your views here.
from rest_framework.generics import CreateAPIView
from article.views import check_if_user
from prediction.serializers import PredictionSerializer
from rest_framework.response import Response
class PredictAPIView(CreateAPIView):
def post(self, reques... |
"""Command line parsing for all integration commands."""
from __future__ import annotations
import argparse
from ...completers import (
complete_target,
)
from ...environments import (
CompositeActionCompletionFinder,
)
from .network import (
do_network_integration,
)
from .posix import (
do_posix_... |
import os
import json
import sys
def transplant_bookmarks(source, target):
"""Copy over bookmarks"""
source_config = json.loads(source['config'])
target_config = json.loads(target['config'])
source_bookmarks = source_config['bookmarks']
target_config['bookmarks'] = source_bookmarks
ta... |
stored_result = {}
def sum_to_n(n):
result = 0
for i in reversed(range(n)):
if i+1 in stored_result:
print('Stopping sum at %s because we have previously computed it' % str(i + 1))
result += stored_result[i+1]
break
else:
result += i + 1
stored_results[n] = result #ERRORRRRRRRRRRRRRRR... |
import numpy as np
'''
Settings for town generation
'''
town_name = 'Tirschenreuth'
# Make sure to download country-specific population density data
# from https://data.humdata.org/organization/facebook
population_path='lib/data/population/population_deu_2019-07-01.csv' # Population density file
sites_path='lib/dat... |
"""TcEx Generate Configurations CLI Command"""
# standard library
from typing import TYPE_CHECKING, List, Optional
# first-party
from tcex.app_config.permutation import Permutation
from tcex.bin.bin_abc import BinABC
if TYPE_CHECKING:
# first-party
from tcex.app_config import AppSpecYml
from tcex.app_conf... |
from .random_walker_segmentation import random_walker
from ._felzenszwalb import felzenszwalb
from .slic_superpixels import slic
from ._quickshift import quickshift
from .boundaries import find_boundaries, mark_boundaries
from ._clear_border import clear_border
from ._join import join_segmentations, relabel_from_one, r... |
import unittest
def funcattrs(**kwds):
def decorate(func):
func.__dict__.update(kwds)
return func
return decorate
class MiscDecorators (object):
@staticmethod
def author(name):
def decorate(func):
func.__dict__['author'] = name
return func
... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.b (the "License");
# you may not use this file except in compliance with the License.
#
""" Userbot module containing various scrapers. """
import os
import shutil
from bs4 import BeautifulSoup
impo... |
# Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
import copy
import hashlib
import json
import multiprocessing
import os.path
import re
import signal
import subprocess
import sys
import gyp
imp... |
# Generated by Django 2.2.14 on 2020-08-22 12:45
from django.db import migrations, models
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('surveys20', '0008_auto_20200815_2044'),
]
operations = [
migrations.CreateModel(
... |
# Copyright (c) 2014 ITOCHU Techno-Solutions Corporation.
#
# 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... |
import concurrent.futures
import logging
logger = logging.getLogger(__name__)
def ThreadPoolExecutor(max_workers=None, thread_name_prefix=''):
return concurrent.futures.ThreadPoolExecutor(max_workers=max_workers)
#thread_name_prefix=thread_name_prefix)
def Process... |
#
# Copyright 2012 NVIDIA Corporation
#
# 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 ... |
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, constant_init, kaiming_init
from mmcv.ops import ModulatedDeformConv2d, modulated_deform_conv2d
from mmcv.runner import load_checkpoint
from mmedit.models.common import (PixelShufflePack, ResidualBlockNoBN,
make_layer)... |
import argparse
import json
from os.path import join
from typing import List
import numpy as np
import pandas as pd
from tqdm import tqdm
from docqa import trainer
from docqa.config import TRIVIA_QA
from docqa.data_processing.document_splitter import MergeParagraphs, TopTfIdf, ShallowOpenWebRanker, FirstN
from docqa.... |
import icebox
vm = icebox.attach("win10")
# load symbols from current module
# which will allow nice callstack symbols
proc = vm.processes.current()
proc.symbols.load_modules()
counter = icebox.counter()
def print_callstack():
print()
proc = vm.processes.current()
for i, addr in enumerate(proc.callstac... |
# The client could call service directly
# but only in other service or main threading.
import requests
class Client:
"""
通过 TDD 的方式,允许自己编写 SDK
"""
def __init__(self, service_name) -> None:
self.service_name = service_name
self.served = False
def get(self, url, data):
""... |
#!/usr/bin/env python3
from setuptools import setup
setup(
name="dhwebapi",
version="0.1",
description="Python library for easy communication with hub.docker.com.",
author="Filip Čáp",
author_email="ficap@redhat.com",
url="https://github.com/ficap/dhwebapi",
license="MIT",
entry_points... |
"""
Logistic regression implemented using the nn.module class
"""
import torch
import torch.nn as nn
from sklearn import datasets
class Model(nn.Module):
def __init__(self, n_input_features=10):
super().__init__()
self.linear1 = nn.Linear(n_input_features, 30)
self.linear2 = nn.Linear(30,... |
# RUN: mkdir %T/exit_code_for_success
# RUN: cd %T/exit_code_for_success; %{scan-build} true
# RUN: cd %T/exit_code_for_success; %{scan-build} --status-bugs true
# RUN: cd %T/exit_code_for_success; %{scan-build} --status-bugs false
# RUN: cd %T/exit_code_for_success; %{scan-build} --status-bugs --plist true
# RUN: cd %... |
import asyncio
from core.launcher import WorkerLauncher
def main() -> None:
worker = WorkerLauncher()
loop = asyncio.get_event_loop()
loop.run_until_complete(worker.start())
try:
loop.run_forever()
finally:
loop.run_until_complete(worker.stop())
if __name__ == '__main__':
ma... |
'''
Authors: Nishant Kumar.
Copyright:
Copyright (c) 2020 Microsoft Research
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
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 SHIELD, UBIWHERE
# 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
#
# U... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# bossdata documentation build configuration file, created by
# sphinx-quickstart on Thu Dec 14 09:04:21 2017.
#
# 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
# a... |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB 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... |
from tensorflow_parser import TFParser
from tensorflow.core.framework import tensor_pb2 as tpb2
from tensorflow.core.framework import tensor_shape_pb2 as tspb2
from tensorflow.core.framework import attr_value_pb2 as apb2
from tensorflow.python.framework import dtypes
import mxnet as mx
from mxnet import nd
import numpy... |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
from apq import KeyedItem, KeyedPQ
from array import array
from dataclasses import dataclass, field
from enum import auto, Enum
import itertools
from typing import (
Callable,
cast,
DefaultDict,
Dict,
Hashable,
Iterable,
Optional,
Reversible,
Tuple,
TypeVar,
)
from ..classification import Classifier, Combine... |
#!/usr/bin/env python3
from __future__ import unicode_literals, with_statement
import json
from binascii import hexlify
import rsa
try:
input = raw_input
except NameError:
pass
versions_info = json.load(open("update/versions.json"))
if "signature" in versions_info:
del versions_info["signature"]
print(... |
import json
from moto.core.responses import BaseResponse
from moto.events import events_backends
class EventsHandler(BaseResponse):
@property
def events_backend(self):
"""
Events Backend
:return: Events Backend object
:rtype: moto.events.models.EventsBackend
"""
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, of the institute as a whole, departments and individual faculty member:ssn and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestJournalPaper(unittest.TestCase):
pass
|
import pylons.wsgiapp
from ddtrace import Pin
from ddtrace import config
from ddtrace import tracer
from ddtrace.vendor import wrapt
from ...utils.formats import asbool
from ...utils.formats import get_env
from ...utils.wrappers import unwrap as _u
from .middleware import PylonsTraceMiddleware
config._add(
"pyl... |
import unittest
from skills import (
Match,
Matches,
Team,
)
from skills.glicko import (
GlickoCalculator,
GlickoGameInfo
)
class CalculatorTests(object):
ERROR_TOLERANCE_RATING = 0.085
ERROR_TOLERANCE_MATCH_QUALITY = 0.0005
def assertAlmostEqual(self, first, second, places, msg,... |
# Enter your code here. Read input from STDIN. Print output to STDOUT
from itertools import permutations
s,n = input().split()
print(*[''.join(i) for i in permutations(sorted(s),int(n))],sep='\n') |
# Copyright 2022 The MIDI-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... |
import numpy as np
from cv2 import cv2
import os.path
import boundingbox
import CropMaskOverlay
from pathlib import Path
import datetime
import uuid
VIDEO_NUMBER = 266
LM_FOLDER_PATH = "\\Users\\George\\Documents\\Python\\ADS CapStone\\aff_wild_annotations_bboxes_landmarks_new"
LANDMARK_PATH = "\\User... |
import sys
COLUMN_NAMES = ["a", "b", "c", "d", "e", "f", "g", "h"]
PIECE_ORDER = ["K", "Q", "R", "B", "N", "P"]
def compare(o):
c1 = PIECE_ORDER.index(o[0].upper()) * 100
if o[0].isupper():
c2 = o[2] * 10
else:
c2 = (8 - o[2]) * 10
c3 = COLUMN_NAMES.index(o[1])
return c1 + c2 + c3... |
"""Helpers for configuring API backends on API Umbrella."""
import os
import requests
headers = {
'X-Api-Key': os.environ.get('AUTOAPI_UMBRELLA_KEY'),
'X-Admin-Auth-Token': os.environ.get('AUTOAPI_UMBRELLA_TOKEN'),
}
base = 'https://api.data.gov/api-umbrella/v1'
endpoints = {
'apis': os.path.join(base, '... |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.5.1
# kernelspec:
# display_name: Python [conda env:.conda-develop] *
# language: python
# name: conda-env-.conda-develop-py
# ---
# %%
#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.