text stringlengths 2 999k |
|---|
"""
This module holds the objects that describe the intra-run relationships
between the parameters of that run. Most importantly, the information about
which parameters depend on each other is handled here.
"""
from copy import deepcopy
from typing import (Dict, Any, Tuple, Optional, FrozenSet, List, Set,
... |
import time, math, machine
from lib.config import *
def pulse(l, t):
for i in range(20):
l.duty(int(math.sin(i / 10 * math.pi) * 500 + 500))
time.sleep_ms(t)
buzzer = machine.Pin(DEFAULT_IOTKIT_BUZZER)
while True:
try:
p = machine.PWM(buzzer, freq=3969, duty=50 )
time.sleep( 0... |
#!/usr/bin/env python
import sys
import tos
if len(sys.argv) < 3:
print "Usage:", sys.argv[0], "/dev/ttyUSB0 115200"
sys.exit()
s = tos.Serial(sys.argv[1], int(sys.argv[2]), debug=False)
am = tos.AM(s)
while True:
p = am.read()
|
"""
sudo apt-get install python-pyaudio
sudo apt-get install libportaudio-dev
pip install pyaudio
"""
import time
import math
import pyaudio
import wave
class Beeper(object):
def __init__(self, **kwargs):
self.bitrate = kwargs.pop('bitrate', 16000)
self.channels = kwargs.pop('channels', 1)
... |
import os
import sys
import time
import random
import string
import argparse
import torch
import torch.backends.cudnn as cudnn
import torch.nn.init as init
import torch.optim as optim
import torch.utils.data
import numpy as np
from utils import CTCLabelConverter, AttnLabelConverter, Averager
from dataset import hiera... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Main file to test the whole project"""
import logging
from zsur.readfile import readfile
from matplotlib import pyplot as plt
from zsur.bayes import main as bayes
from zsur.chain_map import main as chmap
from zsur.cluster_levels import main as cluster
from zsur.kmeans i... |
from datetime import datetime
from is_number import is_number
def test_is_number():
assert is_number(1)
def test_is_not_number():
assert not is_number("Hello world")
assert not is_number({"Hello": "world"})
assert not is_number(datetime.now())
assert not is_number(lambda foo: foo)
|
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... |
# coding: utf-8
from os import path
from setuptools import setup, find_packages
NAME = "huaweicloudsdkddm"
VERSION = "3.0.67"
AUTHOR = "HuaweiCloud SDK"
AUTHOR_EMAIL = "hwcloudsdk@huawei.com"
URL = "https://github.com/huaweicloud/huaweicloud-sdk-python-v3"
DESCRIPTION = "DDM"
this_directory = path.abspath(path.dirna... |
'''
Experiments on student dataset.
Continuous sensitive attribute and continuous outcome.
'''
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import sys
sys.path.append('.')
import torch
import torch.nn as nn
import torch.utils.data as data_utils
from torch.utils.tensorboard import Summa... |
#!/usr/bin/env python3
#
# linearize-data.py: Construct a linear, no-fork version of the chain.
#
# Copyright (c) 2013-2016 The Bitcoin Core developers
# Copyright (c) 2017 The LISYNetwork Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/lice... |
from docutils import nodes
from docutils.parsers.rst import Directive
class StOutput(Directive):
"""Insert Streamlit app into HTML doc.
The first argument is a URL to be iframed, and the second argument
(optional) is a string of inline styles to assign to the iframe.
Examples
--------
.... |
from os import getenv
from dotenv import load_dotenv
load_dotenv()
BOT_TOKEN = getenv('BOT_TOKEN')
MONGO_URI = getenv('MONGO_URI')
SUDO_USERS = list('1021875240')
|
import time
from django.conf import settings
import factory
from elasticsearch.exceptions import NotFoundError
from fjord.base.tests import BaseTestCase
from fjord.search.index import get_index, get_es
from fjord.search.models import Record
class ElasticTestCase(BaseTestCase):
"""Base class for Elastic Search ... |
# coding=utf-8
# author: zengyuetian
# get test case and plan info from test link
from testlink import *
url = 'http://sub.site.com/lib/api/xmlrpc/v1/xmlrpc.php' # ip地址为安装的testlink ip
key = 'a16641a2cea5d780ae685beea32dcef1' # API key
def get_manual_case_info():
"""
get test suite and case number
:retu... |
import json
import json
import datetime
import dateutil.relativedelta as rel
from jinja2 import Environment, FileSystemLoader
from dateutil.rrule import rrule, WEEKLY
BASE_DIR_WEB = "/var/www/html/trashdays.com"
BASE_DIR_APP = "/opt/trashdays.com"
TEMPLATE = "trashdays.jinja"
RECYCLING_EPOCH = datetime.datetime(2021,... |
from datetime import datetime
from api import utils
from exchanges.exchange import Exchange
from strategies.strategy import Strategy
class Runner(Strategy):
def __init__(self, exchange: Exchange, timeout=60, *args, **kwargs):
super().__init__(exchange, timeout, *args, **kwargs)
self.buy_price = 0... |
import re
from ipaddress import ip_network, ip_address, IPv4Network
from insightconnect_plugin_runtime.exceptions import PluginException
import validators
import urllib.parse
class Helpers(object):
# status codes constant. Used to id all non 2XX return codes and there causes and assistance
_STATUS_CODES = {
... |
# -*- coding: utf-8 -*- #
# Copyright 2019 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 requir... |
#!/usr/bin/env python3
#
# Copyright (c) 2019 Roberto Riggio
#
# 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... |
from sqlalchemy.sql import operators
from sqlalchemy import MetaData, null, exists, text, union, literal, \
literal_column, func, between, Unicode, desc, and_, bindparam, \
select, distinct, or_, collate, insert, Integer, String, Boolean
from sqlalchemy import inspect
from sqlalchemy import exc as sa_exc, util
... |
import h5py
import numpy as np
data = {}
for field in ["density", "velocity_x", "velocity_y", "velocity_z"]:
f = h5py.File("./dataset.h5")
data[field] = f[field][:]
f.close()
#data['density'] -= (data['density'].min() * 1.001)
data['density'] = (data['density']-data['density'].min())/(data['density'].max... |
#/usr/bin/env python
#Base Server -Chapter three -basicserver.py
import socket, traceback
host=''
port=8080
s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((host, port))
print "Waiting for connections..."
s.listen(1)
while True:
try:
clien... |
import unittest
import os
from conans.paths import CONANFILE, CONAN_MANIFEST, EXPORT_SOURCES_DIR
from conans.util.files import save, load
from conans.model.ref import ConanFileReference
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
from conans.model.manifest import FileTreeManifest
from conans.test... |
# x_1_2
#
# 例のようにあなたの自己紹介を表示する文章を分割してください
print('私の名前は' + '田中' + 'です')
print('好きな食べ物は' + 'オムライス' + 'です')
|
"""Sphinx configuration."""
# Standard Library
from importlib import metadata as md
project = "CrazyHusk"
author = "Nick Haines"
copyright = "2022, Nick Haines"
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx_click",
"myst_parser",
"sphinx.ext.intersphinx",
"sphinx.ext.todo"... |
import numpy as np
np.random.seed(1)
# from tensorflow import set_random_seed
# set_random_seed(1)
import tensorflow as tf
tf.random.set_seed(1)
from neural_stylization.transfer_style import Stylizer
from neural_stylization.optimizers import GradientDescent, L_BFGS, Adam
from neural_stylization.util.build_callback imp... |
# Pok On Cheng and Nhu Tuyet Huynh. Lab Section 1 Project #1
import shutil, os
def Search_files_by_path(path: str) -> None:
''' This method is to search the file with the path.
'''
if os.path.isdir(path):
print("Directory found! LOL")
else:
print("The directory does not exist... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from . import jina_pb2 as jina__pb2
class JinaRPCStub(object):
"""*
jina gRPC service.
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.Call = channel.stream_strea... |
import time
from typing import List
import requests
from telegram import Bot, Update, ParseMode
from telegram.ext import run_async
from gotti import dispatcher, StartTime
from gotti.modules.disable import DisableAbleCommandHandler
sites_list = {
"Telegram": "https://api.telegram.org",
"Kaizoku": "https://ani... |
# -*- coding: utf-8 -*-
"""Setup ``variants_smallvariants`` table as partitioned.
"""
from django.db import migrations
from django.conf import settings
operations = []
if not settings.IS_TESTING:
operations.append(
migrations.RunSQL(
r"""
CREATE INDEX variants_sm_chromosome_no_i... |
# coding: utf-8
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.9
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six im... |
#!/usr/bin/env python3
#
# This module requires HatSploit: https://hatsploit.netlify.app
# Current source: https://github.com/EntySec/HatSploit
#
from hatsploit.lib.module import Module
from hatsploit.utils.http import HTTPClient
class HatSploitModule(Module, HTTPClient):
details = {
'Name': "Netwave IP... |
# (c) Copyright 2007 The Board of Trustees of the University of Illinois.
from binaryfilecompare import eof, many
# Rename the builtin 'float' variable to avoid name conflicts
builtin_float = float
def verbatim(f):
"""Read a line of text from file 'f'."""
line = f.readline()
return line
def float(f):
"""Read a ... |
#!/usr/bin/python
import cgi, os
import cgitb; cgitb.enable()
import MySQLdb
import jwt
import Cookie
import urllib
from os import environ
from datetime import datetime, timedelta
import json
print('Content-type: text/html\r\n')
conn = MySQLdb.connect(host="database", user="root", passwd="MEEP1234", db="webdata")
cu... |
'''
The MIT License (MIT)
Copyright (c) 2014 NTHUOJ team
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, ... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from .coordinate_helpers import CoordinateHelper
from .transforms import WCSPixel2WorldTransform
from .utils import coord_type_from_ctype
from .frame import RectangularFrame
from .coordinate_range import find_coordinate_range
class CoordinatesMap:
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2019-10-10 20:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0011_auto_20191010_1815'),
]
operations = [
migrations.AddField(
... |
# Copyright 2015 gRPC 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 writing... |
# 文字リテラルを記述する
'文字列'
"文字列"
# 文字列は英数字/空白/日本語、全角でも大丈夫です
"Hello, Python"
"myname"
"こんにちは"
"2019"
# ダブルクオーテーションとシングルクオーテーションで囲った場合で違いはありません。
# "myname"
# myname = 変数
# "2019" > 2019 = 整数値
print('hello python')
print('my name is Aenky')
# 文字列の中でシングルクオートを使う
# Tom's vehicle
"Tom's vehicle"
print("Tom's vehicle.")
print('彼... |
"""Clean Code in Python - Chapter 3: General Traits of Good Code
"""
import unittest
from unittest.mock import Mock, patch
from exceptions_1 import DataTransport, Event
class FailsAfterNTimes:
def __init__(self, n_times: int, with_exception) -> None:
self._remaining_failures = n_times
self._exc... |
import pinocchio as se3
import tsid
import numpy as np
import numpy.matlib as matlib
import os
import gepetto.corbaserver
import time
import subprocess
class TsidManipulator:
''' Standard TSID formulation for a robot manipulator
- end-effector task
- Postural task
- torque limits
-... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python version: 3.6
import torch
from torch import nn
import torch.nn.functional as F
class MLP(nn.Module):
def __init__(self, dim_in, dim_hidden, dim_out):
super(MLP, self).__init__()
self.layer_input = nn.Linear(dim_in, dim_hidden)
self.re... |
# merge_json.py 8.5.2020/pekka
# Include JSON files within JSON.
import json
import os
import sys
def merge(merged, di):
for item in di.items():
key = item[0]
value = item[1]
mitem = merged.get(key, None)
if mitem == None:
if value != None:
merged[key] = ... |
import requests
import re
import json
def parse_html(url):
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0"}
response = requests.get(url, headers=headers)
text = response.text
... |
import logging
import anyio
from distmqtt.client import open_mqttclient
from distmqtt.mqtt.constants import QOS_1, QOS_2
#
# This sample shows how to publish messages to broker using different QOS
# Debug outputs shows the message flows
#
logger = logging.getLogger(__name__)
config = {
"will": {
"topic... |
from ..base import *
from six.moves.urllib.parse import quote, unquote
RADIX_CHARS = {'1': 1, '0': 0, '3': 3, '2': 2, '5': 5, '4': 4, '7': 7, '6': 6, '9': 9, '8': 8, 'a': 10, 'c': 12,
'b': 11, 'e': 14, 'd': 13, 'g': 16, 'f': 15, 'i': 18, 'h': 17, 'k': 20, 'j': 19, 'm': 22, 'l': 21,
'o': ... |
#from .pygsm import GlobalSkyModel
import numpy as np
from scipy.interpolate import interp1d, pchip
import h5py
from astropy import units
import healpy as hp
import ephem
from datetime import datetime
from pkg_resources import resource_filename
GSM2016_FILEPATH = resource_filename("pygsm", "gsm2016_components.h5")
k... |
# -*- coding: utf-8 -*-
"""Utility functions for a2r
Author: G.J.J. van den Burg
License: See LICENSE file
Copyright: 2019, G.J.J. van den Burg
"""
import regex
import requests
import string
import subprocess
import time
import unidecode
# from pikepdf import Pdf, PdfError
from .log import Logger
from .exceptions... |
# 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 unde... |
lista=[]
while True:
l = int(input('Digite um valor:'))
if l not in lista:
lista.append(l)
print('Valor adicionado com sucesso...')
else:
print('Valor duplicado! Não vou adicionar...')
resp = ' '
resp = str(input('Quer continuar? [S/N]')).strip().upper()[0]
if resp=='N':
... |
"""Auto-generated file, do not edit by hand. ES metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_ES = PhoneMetadata(id='ES', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='[0-379]\\d{2,5}', possible_number_patte... |
#!/usr/bin/env python
import scipy.stats
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def mean_confidence_interval(data, confidence=0.95):
a = 1.0 * np.array(data)
n = len(a)
m, se = np.mean(a), scipy.stats.sem(a)
h = se * scipy.stats.t.ppf((1 + confidence) / 2., n-1)
ret... |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic.base import View
from django.shortcuts import render, redirect
from report.backend import ReportBackend
class ReportView(LoginRequiredMixin, View):
def get(self, request):
return render(
request,
'r... |
import time
import json
import re
import logging
import io
import os
import paramiko
import six
logger = logging.getLogger(__name__)
def displaycmd(lst):
s = ""
for t in lst:
p = t.find("[[private:")
while p != -1:
q = t.find("]]", p)
if q != -1:
t = t... |
import FWCore.ParameterSet.Config as cms
trackingParticleSelector = cms.EDFilter("TrackingParticleSelector",
src = cms.InputTag("mix","MergedTrackTruth"),
chargedOnly = cms.bool(True),
stableOnly = cms.bool(False),
pdgId = cms.vint32(),
tip = cms.double(3.5),
signalOnly = cms.bool(True),
in... |
import _plotly_utils.basevalidators
class ArrowsizeValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self,
plotly_name='arrowsize',
parent_name='layout.annotation',
**kwargs
):
super(ArrowsizeValidator, self).__init__(
plotly_name=plotl... |
# -----------------------------------------------------------------------------
# Copyright 2015 Bloomberg Finance L.P.
#
# 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.apac... |
from typing import Any, Dict, List, Optional
from prefect import Flow, task, unmapped
from .base import Pipeline, PipelineExecutor, StageAnnotations, StageAnnotationType
def annotations_to_task_kwargs(annotations: Optional[StageAnnotations]) -> Dict[str, Any]:
if annotations is None:
return {}
task_... |
# Copyright 2020, 2021 IBM 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 law or agreed to ... |
from setuptools import setup
version = '0.2'
setup(name='function_logger',
version=version,
description="logs the function functionality",
long_description=open('README.md').read(),
classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
keywords='',
... |
import tensorflow as tf
from ..fastspeech.model import TFFastSpeechEncoder
import numpy as np
class Encoder(tf.keras.layers.Layer):
def __init__(self, config, **kwargs):
super(Encoder, self).__init__(name='Encoder', **kwargs)
self.config = config
self.encoder = TFFastSpeechEncoder(config, ... |
from insights import dr, rule, make_fail, make_pass, make_fingerprint
from insights.core.plugins import component, Response
from insights.core.evaluators import InsightsEvaluator, SingleEvaluator
from insights.combiners.hostname import hostname
from insights.specs import Specs
from insights.tests import context_wrap
... |
#!python3
# PortalBox.py acts as a hardware abstraction layer exposing a somewhat
# simple API to the hardware
# from standard library
import logging
from time import sleep
# Our libraries
from .MFRC522 import MFRC522 # this is a modified version of https://github.com/mxgxw/MFRC522-python
... |
from abc import ABCMeta, abstractmethod
from collections import deque
import threading
import time
from ..utils.generic_utils import log
# Empty history and None value
empty_query = ([], None)
class BaseInputAdapter(metaclass=ABCMeta):
"""Base class for input adapters.
# Arguments:
input_services: ... |
# -*- coding: utf-8 -*-
import logging
from copy import copy, deepcopy
from .request import SnowRequest
from .attachment import Attachment
from .url_builder import URLBuilder
from .exceptions import InvalidUsage
logger = logging.getLogger('pysnow')
class Resource(object):
"""Creates a new :class:`Resource` ob... |
from __future__ import print_function
import os
import argparse
import torch
import torch.backends.cudnn as cudnn
from PIL import Image
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as transforms
import numpy as np
import time
from data.config import cfg_mobilenetv2
from layers.fun... |
# Copyright 2020 Google Research. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
import scipy.io
from os import listdir
from os.path import isfile, join
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import os
import sys
import shutil
# get a single 3D model from .mat file
def get_model(file_path):
mat = scipy.io.loadmat( file_path )
model_... |
age = 19
if age >= 18:
print("成年了")
|
from collections import defaultdict
from dagster import check
from dagster.core.types import config
from dagster.core.types.iterate_types import iterate_config_types
from dagster.core.types.config import ALL_CONFIG_BUILTINS
from dagster.core.types.runtime import ALL_RUNTIME_BUILTINS
from dagster.core.errors import Dag... |
from aocd import get_data
directions = [(1, 1), (1, 0), (1, -1), (0, 1), (0, -1), (-1, 1), (-1, 0), (-1, -1)]
def simulate(m, limit, neighbors_function):
rules = {
'.': lambda m, x, y: '.',
'L': lambda m, x, y: '#' if neighbors_function(m, x, y) == 0 else 'L',
'#': lambda m, x, y: 'L' if ... |
from morpyneural.Neural.NeuralNetworkClass import NeuralNetwork
class Element:
def __init__(self):
"""
Element is a part of Population, it containing the neural network and (will) handle
the score logic
"""
self.active = True
self.neural_network = NeuralNetwork()
... |
import torch
import torch.nn
from typing import Dict, Tuple
from models.encoder_decoder import add_eos
from models.transformer_enc_dec import TransformerResult
from ..model_interface import ModelInterface
import framework
from ..encoder_decoder import EncoderDecoderResult
class TransformerEncDecInterface(ModelInterf... |
"""
OpenVINO DL Workbench
Function for getting and safe parsing of environment variables
Copyright (c) 2018 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.... |
import qi
import argparse
import sys
import time
import almath
def main(session):
"""
This example uses the setAngles method and setStiffnesses method
in order to control joints.
"""
# Get the service ALMotion.
posture_service = session.service("ALRobotPosture")
posture_service.goToPost... |
# -*- encoding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar... |
from django.urls import path
from django.contrib.auth import views as auth_views
from . import views
app_name="data"
urlpatterns = [
path("", views.data, name="data"),
path("<int:my_id>", views.dynamic_lookup_view, name='station_data'),
path("<int:my_id>/getMeanDayData", views.getMeanDayData, name="getMea... |
import time
import logging as defalut_logging
from simpleutil.log import log as logging
import simpleservice
from websocket import create_connection
from simpleutil.config import cfg
from goperation import config
from goperation.api.client import ManagerClient
from gogamechen1.api.client import GogameChen1DBClient
f... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# Copyright (C) 2020 University of Oxford
#
# 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 t... |
import unittest
import pyperclip
from contact import Contact
class TestContact(unittest.TestCase):
def setUp(self):
self.new_contact = Contact("Nyakundi","Lamech","0790406870","Ongondi88@gmail.com")# Create contact object
def tearDown(self):
Contact.contact_list = []
def test_init(self):... |
# Ce script permet les fichiers en lien avec le FTP
# Permet de faire une pause dans le programme
import time
# Importe nos fonctions utiles
import sys
sys.path.insert(0, '../')
from utils import func
# Importe toutes les fonctions FTP dans ce programme pour pouvoir les lancer depuis superscript
from ftp import ftp_... |
# -*- coding: utf-8 -*-
"""
@author: Michael Yeh
"""
from __future__ import print_function
import time
import numpy as np
_EPS = 1e-14
def mstamp(seq, sub_len, return_dimension=False):
""" multidimensional matrix profile with mSTAMP (stamp based)
Parameters
----------
seq : numpy matrix, shape (n_... |
# Copyright 2021 Tianmian Tech. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
import torch
from torch.utils.data import RandomSampler
from pathlib import Path
import sys
FILE = Path(__file__).resolve()
ROOT = FILE.parents[0].parents[0] # CogKGE root directory
if str(ROOT) not in sys.path:
sys.path.append(str(ROOT)) # add CogKGE root directory to PATH
from cogkge import *
device=init_cog... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# simplelogging documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 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... |
import base64
import json
import numpy as np
from werkzeug.wrappers import Request, Response
import predict
def decode_audio(audio_bytes):
return np.frombuffer(base64.b64decode(audio_bytes), dtype="float32")
def make_app(estimate_func):
def app(environ, start_response):
inputs = json.loads(Request(e... |
# 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 python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) Merchise Autrement [~º/~] and Contributors
# All rights reserved.
#
# This is free software; you can do what the LICENCE file allows you to.
#
# Makes sure modules are patched before any... |
import torch, einops
from ..builder import BACKBONES
from .resnet import ResNet
@BACKBONES.register_module()
class PositionalEncodingResNet(ResNet):
def __init__(self, num_frequencies, in_channels=3, **kwargs):
self.L = num_frequencies
in_channels += self.L * 4
super().__init__(in_channels=... |
"""Staking module message types."""
from __future__ import annotations
from typing import Optional, cast
import attr
from terra_proto.cosmos.crypto.ed25519 import PubKey as ValConsPubKey_pb
from terra_proto.cosmos.staking.v1beta1 import \
MsgBeginRedelegate as MsgBeginRedelegate_pb
from terra_proto.cosmos.stakin... |
#----------------------------------------------------------------------------------------------------#
# RS485 Communication using Python (Read) (hardware = USB2SERIAL) (Python 3.x) #
#----------------------------------------------------------------------------------------------------#
# Program r... |
#!/usr/bin/python
#coding: utf-8
__AUTHOR__ = "Fnkoc"
__LICENSE__= "MIT"
"""
MIT License
Copyright (c) 2018 Franco Colombino
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, i... |
# -*- coding: utf-8 -*-
#
# radish documentation build configuration file, created by
# sphinx-quickstart on Sat Jun 13 21:58:55 2015.
#
# 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.
#
# Al... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-10-22 15:36
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations... |
#!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
import os
import re
import sys
import urllib
"""Logpuzzle exercise
Given an apache logfile, ... |
#!/usr/bin/env python
from setuptools import setup, find_packages
import os
__doc__ = "Makes it easier to use PySCSS in Django."
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
install_requires = [
'Django>=1.4',
'pyScss2',
]
try:
import pathlib
except ImportErr... |
from main import app
import ldap
def authenticate(username, password):
LDAP_SERVER = 'ldap://xx'
LDAP_USERNAME = 'DOMAIN\\%s' % username
LDAP_PASSWORD = password
# Tries to validate user with LDAP-bind, returns OK if valid
try:
ldap_client = ldap.initialize(LDAP_SERVER)
ldap_client... |
####################################################
# #
# Python scripting (bitcoin lab I - python part) #
# #
####################################################
# // DOCUMENTATION //
# python bitcoin-utils: ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.