text stringlengths 2 999k |
|---|
# 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 may ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-04 13:18
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... |
#!/usr/bin/env python
from uuid import uuid4
from datetime import datetime
from passbook.models import Pass, Barcode, EventTicket, BarcodeFormat, Location
class Passgen():
def __init__(self, private_key, private_key_password, certificate, wwdrca, pass_type_identifier, team_identifier):
self._private_key =... |
#!/usr/bin/env python
# Copyright 2017 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.
import argparse
import json
import shutil
import sys
import merge_api
def noop_merge(output_json, jsons_to_merge):
"""Use the firs... |
import onnx
import unittest
import torchvision
import numpy as np
from onnxruntime_customops.utils import trace_for_onnx, op_from_model
from onnxruntime_customops import eager_op, hook_model_op, PyOp, mytorch as torch
class TestTorchE2E(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.mobilen... |
import logging
import os
import uuid
import zmq
import zmq.auth
from zmq.auth.thread import ThreadAuthenticator
log = logging.getLogger(__name__)
class TaskQueue:
"""Outgoing task queue from the executor to the Interchange"""
def __init__(
self,
address: str,
port: int = 55001,
... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 22 21:57:50 2016
@author: HZJ
"""
import numpy as np
import uuid
class Cartisian(object):
def __init__(self,origin, pt1, pt2, name=None):
"""
origin: 3x1 vector
pt1: 3x1 vector
pt2: 3x1 vector
"""
self.__origin=origin ... |
# Copyright 2018 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... |
from app.utils import db
import click
from config import get_env
from app import create_app
from flask_script import Manager
from app.utils.auth import Auth
from flask_migrate import Migrate, MigrateCommand
from app.utils.seeders.seed_database import SEED_OPTIONS, seed_db
app = create_app(get_env("APP_ENV"))
migrate =... |
# Copyright 2020 The Flax 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... |
# Generated by Django 2.1 on 2019-03-13 04:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookmodule', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='libraryprofile',
name='dateOfEstablish... |
# Copyright European Organization for Nuclear Research (CERN)
#
# 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
#
# Authors:
# - Mario Lassnig, <mar... |
#!/usr/bin/python
# coding: utf8
# /*##########################################################################
#
# Copyright (c) 2015-2018 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ... |
# 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 Li... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "leaderboard.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that ... |
#
# PySNMP MIB module BCSSIMULCRYPTSCS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BCSSIMULCRYPTSCS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:36:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... |
from pydispatch import dispatcher
from twisted.internet import task
from twisted.internet.protocol import Factory
from phxd.protocol import HLTransferProtocol
from phxd.server.config import conf
from phxd.server.signals import *
from phxd.transfer import HLIncomingTransfer, HLOutgoingTransfer
import logging
import ti... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 23 17:52:31 2019
@author: Weike (Vicky) Sun vickysun@mit.edu/weike.sun93@gmail.com
(c) 2020 Weike Sun, all rights reserved
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 4 09:15:46 2018
@author: weiksun
@comment: this file conta... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
#written by W.Jabi for ecaade 2021 workshop - to be run on blender/topologic.
import bpy
from bpy.props import EnumProperty, FloatProperty
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import updateNode, list_match_func, list_match_modes
import topologic
import time
#import sys
#sys... |
from __future__ import absolute_import
from django.template.utils import get_app_template_dirs
from django.template.loaders.filesystem import Loader as FilesystemLoader
from django.core.exceptions import SuspiciousFileOperation
from django.utils._os import safe_join
try:
from django.template import Origin # Djang... |
# Copyright (C) 2011-2019 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd 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 License, or
# (at your option) any later version.
#
#... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Read qc utilities
Created: Jul 24 2013
sulsj
"""
import os
import subprocess
import matplotlib
import numpy as np
from common import checkpoint_step
from os_utility import make_dir, change_mod, run_sh_command, rm_dir
from readqc_constants import RQCReadQcConfig... |
[[Step(cur_state=0, action=0, next_state=7, reward=0.0, done=False), Step(cur_state=7, action=0, next_state=14, reward=0.0, done=False), Step(cur_state=14, action=2, next_state=15, reward=0.0, done=False), Step(cur_state=15, action=0, next_state=22, reward=0.0, done=False), Step(cur_state=22, action=0, next_state=29, r... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
from datetime import datetime
from django.contrib.admin.models import ADDITION, CHANGE, DELETION, LogEntry
from django.contrib.admin.utils import quote
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import... |
# 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 ... |
# coding: utf-8
"""
여보세요
"""
from yeoboseyo.services.joplin import Joplin
from yeoboseyo.services.mail import Mail
from yeoboseyo.services.mastodon import Mastodon
from yeoboseyo.services.reddit import Reddit
from yeoboseyo.services import Service
__version__ = '0.1.0'
|
import abc
import typing_extensions as te
import dataclasses
from databind.core.annotations import fieldinfo, union
from databind.json import loads
@dataclasses.dataclass
class Person:
name: str
age: te.Annotated[int, fieldinfo(strict=False)]
@union()
class Plugin(abc.ABC):
pass
@union.subtype(Plugin)
@dat... |
from data.datasets.dataset import ComplexDataset, InMemoryComplexDataset
from data.datasets.sr import SRDataset, load_sr_graph_dataset
from data.datasets.cluster import ClusterDataset
from data.datasets.tu import TUDataset, load_tu_graph_dataset
from data.datasets.flow import FlowDataset
from data.datasets.ocean import... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. currentmodule:: luiji
.. moduleauthor:: Pat Daburu <pat@daburu.net>
Extensions for Spotify's Luigi.
"""
__version__ = '0.0.19' #: the working version
__release__ = '0.0.19' #: the release version
|
from ggame import App, Color, LineStyle, Sprite, CircleAsset, Frame, RectangleAsset, TextAsset
from math import floor, sin, cos
#-----------------------------------------------------
red = Color(0xff0000, 1.0)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)
green = Color(0x0fff6f, 1.0)
white = Color(0xffffff... |
x = 10
print(x)
Y = 2
print(y)
|
#!/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... |
"""Example for using pysouliss."""
from souliss import souliss_mqtt
from optparse import OptionParser
import logging
import time
_LOGGER = logging.getLogger(__name__)
def set_main_options():
usage = "usage: %prog [options]"
parser = OptionParser(usage)
parser.add_option("-g", "--gateway", dest="gateway",
... |
from typing import Tuple, FrozenSet
from collections import Iterable
from mathsat import msat_term, msat_env
from mathsat import msat_make_constant, msat_declare_function
from mathsat import msat_get_integer_type, msat_get_rational_type, msat_get_bool_type
from mathsat import msat_make_and, msat_make_not, msat_mak... |
import os
from plotnine import ggplot, aes, geom_point, labs, facet_grid
from plotnine import (theme, theme_538, theme_bw, theme_classic,
theme_dark, theme_gray, theme_light,
theme_linedraw, theme_matplotlib, theme_minimal,
theme_seaborn, theme_void, th... |
# Copyright 2013,2014 Cray Inc
#
# Authors: David Hewson <dhewson@cray.com>
# Stig Telfer <stelfer@cray.com>
# Mark Goddard <mgoddard@cray.com>
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the L... |
#!/usr/bin/env python3
# Remove unversioned links from a page
## Overview
# This script removes unversioned labels (i.e. Sphinx labels without the _N
# suffix, where N is the name of the protocol) from one doc page.
# If this was a local label (i.e. referred in this or other pages of protocol
# _N) a versioned label... |
from typing import List, Union
from twisted.plugin import IPlugin
from zope.interface import implementer
from desertbot.message import IRCMessage
from desertbot.moduleinterface import IModule
from desertbot.modules.commandinterface import BotCommand
from desertbot.response import IRCResponse
@implementer(IPlugin, I... |
# Copyright 2018 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... |
import numpy as np
from scipy.integrate import odeint
from bokeh.plotting import *
def streamlines(x, y, u, v, density=1):
'''Returns streamlines of a vector flow.
* x and y are 1d arrays defining an *evenly spaced* grid.
* u and v are 2d arrays (shape [y,x]) giving velocities.
* density controls th... |
class Solution:
def XXX(self, root: TreeNode) -> bool:
stack = []
cur = root
last = float("-inf")
while cur or stack:
while cur:
stack.append(cur)
cur = cur.left
cur = stack.pop()
if cur.val > last:
... |
class OverpassError(Exception):
"""An error during your request occurred.
Super class for all Overpass api errors."""
pass
class OverpassSyntaxError(OverpassError, ValueError):
"""The request contains a syntax error."""
def __init__(self, request):
self.request = request
class TimeoutEr... |
import dummyml
import numpy as np
import pytest
def test_fit_predict():
input_dim = 784
k = 10
dataset_size = 60
kms = dummyml.k_means(input_dim,k)
x = np.random.rand(dataset_size,input_dim)
y = np.random.randint(0,k,size=dataset_size, dtype=np.int32)
for i in range(10):
kms.fit(x... |
""" Functions for encoding and decoding fixed size structs """
import struct
import binascii
import six
from blackboxprotobuf.lib.exceptions import DecoderException, EncoderException
# Generic functions for encoding/decoding structs based on the "struct" format
def encode_struct(fmt, value):
"""Generic method for ... |
# Copyright (c) 2015 Intel 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 ... |
#!/usr/bin/env python2
# Copyright (c) 2014 The Bogcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test InvalidateBlock code
#
from test_framework import BogcoinTestFramework
from bogcoinrpc.authproxy imp... |
import sys
from exotel import Exotel
from requests import RequestException
from elastalert.alerts import Alerter
from elastalert.util import EAException, elastalert_logger
class ExotelAlerter(Alerter):
""" Sends an exotel alert """
required_options = frozenset(['exotel_account_sid', 'exotel_auth_token', 'ex... |
import codecs
import gnupg
gpg = gnupg.GPG(gnupghome='/home/robert/.gnupg')
class Decryptor:
def __init__(self, filename='pphrase.txt'):
self.__pphrase = self.load_passphrase(filename)
def decrypt(self, data):
decrypted_data = gpg.decrypt(data, passphrase=self.__pphrase)
return decr... |
def get_common_elements(seq1, seq2, seq3):
# return tuple(set(seq1).intersection(set(seq2).intersection(set(seq3))))
# return tuple(set(seq1).intersection(set(seq2), set(seq3)))
return tuple(set(seq1) & set(seq2) & set(seq3)) # same as above
print(get_common_elements("abcd", ['a', 'b', 'd'], ('b', 'c', '... |
from typing import Callable, Optional
from cannabis.introducer.introducer import Introducer
from cannabis.protocols.introducer_protocol import RequestPeersIntroducer, RespondPeersIntroducer
from cannabis.protocols.protocol_message_types import ProtocolMessageTypes
from cannabis.server.outbound_message import Message, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : first.py
# @Author : jinjianfeng
# @Contact : 553041800@qq.com
# @Link : https://github.com/jinjf553
# @software: PyCharm
# @Date : 2019/5/4 13:34
# @Version : ??
def method1():
print(type("foo"))
if __name__ == "__main__":
method1() |
import torch
import unittest
from fusion.model import AE
class TestAE(unittest.TestCase):
def test_forward(self):
# define parameters
dim_in = 1
dim_l = 4
input_size = 32
architecture = 'DcganAutoEncoder'
architecture_params = dict(
input_size = input_si... |
import os
import subprocess
import errno
import time
import sys
from JumpScale import j
PIPE = subprocess.PIPE
if subprocess.mswindows:
from win32file import ReadFile, WriteFile
from win32pipe import PeekNamedPipe
import msvcrt
else:
import select
import fcntl
if sys.platform.startswith('li... |
default_prefix = "SMOKE"
known_chains = {
"SMOKE": {
"chain_id": "",
"prefix": "SMOKE",
"steem_symbol": "SMOKE",
"vests_symbol": "VESTS",
},
"TEST": {
"chain_id": "",
"prefix": "TST",
"steem_symbol":"TESTS",
"vests_symbol": "VESTS",
},
}
|
import os
import numpy as np
import pandas as pd
import cv2
path_input_images = 'input_images/'
path_input_txts = 'input_txts/'
path_output_labels = 'output_labels/'
# configuration
# maximum resolution
max_pixels = 600
# train/test ratio
all_images_list = sorted([name for name in os.listdir(path_input_images)])
tr... |
# -*- coding: utf-8 -*-
#
import re
import json
import time
from urlparse import urlsplit
from django.shortcuts import render
from django.contrib import messages
from django.core.mail import send_mail
from django.conf import settings
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.decorat... |
"""This platform allows several cover to be grouped into one cover."""
import logging
from typing import Dict, Optional, Set
import voluptuous as vol
from homeassistant.const import (
ATTR_ASSUMED_STATE,
ATTR_ENTITY_ID,
ATTR_SUPPORTED_FEATURES,
CONF_ENTITIES,
CONF_NAME,
STATE_CLOSED,
)
from ho... |
__________________________________________________________________________________________________
sample 900 ms submission
class Solution:
def findMaxLength(self, nums: List[int]) -> int:
if len(nums) < 2:
return 0
mapping = {0: -1}
result = 0
curr = 0
for i, n... |
# Lint as: python3
# 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 agr... |
from charmhelpers.core.hookenv import (
config,
status_set,
log,
)
import common_utils
import docker_utils
config = config()
MODULE = "kubernetes-node"
BASE_CONFIGS_PATH = "/etc/contrail"
CONFIGS_PATH = BASE_CONFIGS_PATH + "/contrail-kubernetes-node"
IMAGES = [
"contrail-kubernetes-cni-init",
]
de... |
# Copyright 2019 ChangyuLiu 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... |
from __future__ import absolute_import
import logging
import operator
import os
import tempfile
import shutil
import warnings
#import statements for in-toto
import sys
import argparse
try:
import wheel
except ImportError:
wheel = None
from pip.req import RequirementSet
from pip.basecommand import Requireme... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
from django.contrib import admin # type: ignore
from job_position.models import JobPosition
admin.site.register(JobPosition)
|
import numpy as np
####################################################################################################################
# geometry inputs
####################################################################################################################
DIAMETER = 0.15 # hole diameter
STEP_DIST = 0.... |
"""
tests: this package contains motus unittests
see https://docs.scrapy.org/en/latest/contributing.html#running-tests
"""
|
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
#
# Code generated. DO NOT EDIT!
# template_file: python-cli-command.j2
# justice-basic-service (1.36.3)
# pylint: disable=duplicate-code
... |
import csv
from gevent.pool import Pool
from django.core.management.base import BaseCommand
from django.core.management import call_command
from datetime import datetime
DEVICE_ID = __name__ + ".run_all_management_command"
def run_command(command, *args, location=None, inactive_location=None, username=None, output... |
#!/usr/bin/env python3
import logging
import os
import urwim
from .dir_entry import *
class FileBrowser(urwim.ViewWidget):
footer_text = 'Browser'
def __init__(self, commands):
self._commands = commands
self.dir_name = os.getcwd()
self.header = urwim.Header(self.dir_name)
se... |
import os
import unittest
from unittest import mock
from cherry.base import DATA_DIR, load_data
class PerformanceTest(unittest.TestCase):
def setUp(self):
self.x_data = [1, 2]
self.y_data = [0, 1]
|
#!/usr/bin/env python3
# Форматтер, приводящий fluent-файлы (.ftl) в соответствие стайлгайду
# path - путь к папке, содержащий форматируемые файлы. Для форматирования всего проекта, необходимо заменить значение на root_dir_path
import typing
from file import FluentFile
from project import Project
from fluent.syntax i... |
"""
This file offers the methods to automatically retrieve the graph Candidatus Brennerbacteria bacterium RIFOXYD1_FULL_41_16.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
t... |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... |
from flask import Flask, render_template, request
import jsonify
import requests
import pickle
import numpy as np
import pandas as pd
import sklearn
from sklearn.preprocessing import StandardScaler
app = Flask(__name__, template_folder='templates')
model = pickle.load(open('heart_model.pkl', 'rb'))
@app.route('/',me... |
import abc
class Writer(abc.ABC):
@abc.abstractmethod
def write_cur_frame(self, frame_info, output):
pass
@abc.abstractmethod
def write_frame_exec(self, frame_info, exec_time, exec_times):
pass
@abc.abstractmethod
def write_add(self, var, val, history, *, action, plural):
... |
from ._ctypes._api import NodeBase, register_node
class Expr(NodeBase):
pass
@register_node("VarNode")
class Var(Expr):
pass
@register_node("BinaryOpNode")
class BinaryOpNode(Expr):
pass
|
from skmultiflow.data import RandomRBFGeneratorDrift
from skmultiflow.evaluation.evaluate_stream_gen_speed import EvaluateStreamGenerationSpeed
def demo():
""" _test_stream_speed
This demo tests the sample generation speed of the file stream.
"""
# Setup the stream
# stream = FileStream(... |
import os
import numpy as np
from keras.applications.imagenet_utils import preprocess_input
from keras.layers import Input
from PIL import Image
from retinanet import Retinanet
from utils.utils import BBoxUtility, letterbox_image, retinanet_correct_boxes
from tqdm import tqdm
class mAP_Retinanet(Retinan... |
from setuptools import setup, Extension, Command, find_packages
import distutils.command.build as _build
import distutils.command.sdist as _sdist
import glob
import os
import re
VERSION_MAJOR = 0
VERSION_MINOR = 1
VERSION_PATCH = 0
VERSION_DEV = 0
IS_RELEASED = False
VERSION = "{}.{}.{}".format(VERSION_MAJOR, VERSION... |
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2008-2020 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# navadmin_feed documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# 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... |
# this is a python package
|
"""Unit test for Sensor objects."""
import asyncio
import unittest
from unittest.mock import Mock
from xknx import XKNX
from xknx.devices import Sensor
from xknx.dpt import DPTArray
from xknx.telegram import GroupAddress, Telegram, TelegramType
class TestSensor(unittest.TestCase):
"""Test class for Sensor object... |
import time
def execution_time(method, repeat_count=1):
def timed(*args, **kwargs):
for i in range(repeat_count):
ts = time.time()
result = method(*args, **kwargs)
te = time.time()
print('>>> function %r executed in %2.2f ms <<<' % (method.__name__, (te - ts... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from exps.model.darknet import CSPDarknet
from yolox.models.network_blocks import BaseConv, CSPLayer, DWConv
class DFPPAFPN(nn.Module):
""... |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2011 Piston Cloud Computing, 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... |
import asyncio
import websockets
class MultiEARWebsocket():
"""
Class MultiEARWebsocket
Wrapper for broadcasting data over the HTML5 Websocket protocol
Author: Mathijs Koymans, 2021
"""
def __init__(self):
"""
Def MultiEARWebsocket.__init__
Instantiates the MultiEAR... |
import mesh.reconstruction as reconstruction
def unsplit_fluxes(my_data, rp, dt, scalar_name):
"""
Construct the fluxes through the interfaces for the linear advection
equation:
.. math::
a_t + u a_x + v a_y = 0
We use a second-order (piecewise linear) unsplit Godunov method
(foll... |
#!/usr/bin/python
#
# Copyright 2013 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.0
#
# Unless required b... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import json
import os
import shutil
import sqlite3
from contextlib import contextmanager
from typing import Iterator, List, Optional, Tuple
... |
# orm/util.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import re
import types
import weakref
from . import attributes # noqa
from .base impo... |
import torch
import numpy as np
import os
import json
import random
from dmc_gen.algorithms import augmentations
from datetime import datetime
class Eval(object):
def __init__(self, *models):
self.models = models
def __enter__(self):
self.prev_states = []
for model in self.models:
self.prev_states.append(... |
"""Defines the linter class."""
import os
import time
import logging
from typing import (
Any,
Generator,
List,
Sequence,
Optional,
Tuple,
Union,
cast,
Iterable,
)
import pathspec
from sqlfluff.core.errors import (
SQLBaseError,
SQLLexError,
SQLLi... |
import matplotlib
#matplotlib.use('Agg')
import numpy as np
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import pandas as pd
import warnings
warnings.filterwarnings('ignore')
# with open(csv_dataset_path) as module_1_inp:
# lines = module_1_inp.readlines()
#
# #only read the first line (in case it... |
'''
input: direct user input in string
no filtering
sink: check if a file exists
'''
'''
Created by Paul E. Black and William Mentzer 2020
This software was developed at the National Institute of Standards and Technology
by employees of the Federal Government in the course of their official duties.
Pursuant to title ... |
# Gareth Duffy 13-3-2018
# basic numpy WTOP
import numpy as np
x = np.arange(1, 10)
print(x)
print(x ** 2)
M = x.reshape((3, 3)) # multidimensional
print(M)
print(M.T) # transpose
print(np.dot(M, [5, 6, 7])) # matrix vector
print(np.linalg.eigvals(M)) # eigenvalues decompostion
|
# -*- encoding: utf-8 -*-
"""
======================
Obtain run information
======================
The following example shows how to obtain information from a finished
Auto-sklearn run. In particular, it shows:
* how to query which models were evaluated by Auto-sklearn
* how to query the models in the final ensemble
... |
""" Defines classes and functions for working with Qt's rich text system.
"""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports.
import os
import re
# System library imports... |
import pygame
from pygame.locals import *
import sys
import time
import pyganim
window=pygame.display.set_mode((400,800))
pygame.display.set_caption("JUMPY")
loadnames=pygame.image.load('loading/loadingnames.png').convert_alpha()
BGCOLOR = (250, 250, 245)
window.fill(BGCOLOR)
pygame.display.update()
def... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.