text stringlengths 2 999k |
|---|
#
# Test unroll
#
from chill import *
source('unroll1.c')
destination('unroll1cmodified.c')
procedure('foo')
# fully unroll a loop with known iteration count
loop(0)
original()
unroll(0,1,20)
#print
#print space
|
"""software bill of materials
"""
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.ZhimaCreditEpSceneFulfillmentSyncModel import ZhimaCreditEpSceneFulfillmentSyncModel
class ZhimaCreditEpSceneFulfillmentSyncRequest(... |
import requests
import base64
import six
import textwrap
import re
import logging
from fuzzywuzzy import process
MORBO_BASE_URL = 'https://morbotron.com'
FRINK_BASE_URL = 'https://frinkiac.com'
WRAP_WIDTH = 24
log = logging.getLogger()
class RequestFailedException(Exception):
pass
class Frinkotron(object):
... |
import FWCore.ParameterSet.Config as cms
#
# cff file with trigger mask for L1Menu2007:
# block the corresponding algorithm if bit value is 1
# 8-bit mask - for all DAQ partitions
#
from L1TriggerConfig.L1GtConfigProducers.l1GtTriggerMaskAlgoTrig_cfi import *
l1GtTriggerMaskAlgoTrig.TriggerMask = [
0x00,
... |
import yaml
class OntologyTreeNode(object):
def __init__(self,**kwargs):
self.__dict__.update(kwargs)
class InternalOntologyTreeNode(OntologyTreeNode):
pass
def dfs_visit_build_internal_ontology_treenode(root,node_name_to_nodes_mapping,current_node_key):
children = list()
key_dict = dict()
... |
#!/usr/bin/env python3
# encoding: utf-8
"""
Written by Colin Grambow
"""
import numpy as np
from openbabel import openbabel as ob
from openbabel import pybel
from rdkit import Chem
from rdkit.Chem import GetPeriodicTable
from arc.exceptions import SanitizationError
_rdkit_periodic_table = GetPeriodicTable()
cl... |
###
# Copyright (c) 2013, Adam Harwell
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions,... |
"""add site attribute in visit table
Revision ID: 4cdf45858e47
Revises: 927d5ceb3e86
Create Date: 2017-03-02 11:35:22.015314
"""
# revision identifiers, used by Alembic.
revision = '4cdf45858e47'
down_revision = '927d5ceb3e86'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class MybankCreditLoanapplyBlockchainOpenSendModel(object):
def __init__(self):
self._business_type = None
self._data_object = None
@property
def business_type(self):
r... |
import os
import mock
import pytest
from chalice.config import Config
from chalice import package
from chalice.deploy.deployer import ApplicationGraphBuilder
from chalice.deploy.deployer import DependencyBuilder
from chalice.deploy.deployer import BuildStage
from chalice.deploy import models
from chalice.deploy.swagge... |
# flake8: noqa
class STALibValidationError(Exception):
"""
Algorithm data validation raised Error.
if the data is not homogenous.
"""
def __init__(self, _type: str = None) ->None:
self._type = _type
super().__init__()
def __str__(self):
return "For Algorithms Data sh... |
from PIL import Image
import os
import sys
paths = [
"dataset/DATASET_NAME/testA/"
"dataset/DATASET_NAME/testB/"
"dataset/DATASET_NAME/trainA/"
"dataset/DATASET_NAME/trainB/"
]
def resize():
for path in paths:
dirs = os.listdir(path)
for item in dirs:
if os.path.isfile... |
from os import getcwd, mkdir
from os.path import isdir, join
import matplotlib.pyplot as plt
def plot(exp_name, value_dict, scatter=False):
save_path = join(getcwd(), f'{exp_name}.png')
for label, values in value_dict.items():
if scatter:
iters = [i for i, v in enumerate(values) if v >= 0... |
import datetime
import threading
import time
import paho.mqtt.publish as publish
import requests
from flask import Flask
from grove.gpio import GPIO
from grove.grove_ultrasonic_ranger import GroveUltrasonicRanger
import logging
# Connect the GroveUltrasonicRanger to D5 & D16
ultrasonic_ranger_1 = GroveUltrasonicRange... |
"""
Author: Sabar Singh Ahuja
"""
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from os.path import expanduser
import PyPDF2
import Helper
class UpdatePdfWindow(QMainWindow):
def __init__(self):
super().__init__()
self.title = "Pdf Update page"
self.pdfToUpdat... |
"""
Django settings for Blog project.
Generated by 'django-admin startproject' using Django 1.11.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
#... |
from typing import Union
from fastapi.exceptions import HTTPException
from fastapi.requests import Request
from watch_n_learn.authentication.main import manager
from watch_n_learn.database.models import User
async def get_authentication(request__: Request) -> Union[User, bool]:
authentication_token = request__.... |
from funciones import unique, flatten, get_words
import operator
import itertools
from tqdm.auto import tqdm
from collections import defaultdict
def constante_1(c): # pickleable
return 1
class Modelo():
def predict_title(self,title):
scores = self.predict_proba(title)
if len(scores)>0:
... |
try:
from . import generic as g
except BaseException:
import generic as g
class SimplifyTest(g.unittest.TestCase):
def polygon_simplify(self, polygon, arc_count):
# loading the polygon will make all arcs discrete
path = g.trimesh.load_path(polygon)
# save the md5 before doing op... |
"""
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"... |
"""Generated client library for networkconnectivity version v1."""
# NOTE: This file is autogenerated and should not be edited by hand.
from __future__ import absolute_import
from apitools.base.py import base_api
from googlecloudsdk.third_party.apis.networkconnectivity.v1 import networkconnectivity_v1_messages as mes... |
#-*- coding: utf-8 -*-
import zipfile
import json
class ScratchReader():
def __init__(self,JSONOrFileName,isFile = False):
if (isFile):
self.thejson = self.readfile(JSONOrFileName)
else:
self.thejson = JSONOrFileName
def parseJSON(self):
try:
return(json.loads(self.thejson.replace('\... |
import os
import shutil
import pytest
from pre_commit_hooks.check_merge_conflict import main
from pre_commit_hooks.util import cmd_output
from testing.util import get_resource_path
from testing.util import git_commit
@pytest.fixture
def f1_is_a_conflict_file(tmpdir):
# Make a merge conflict
repo1 = tmpdir.j... |
# -*- coding: utf-8 -*-
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2016 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from numbers import Number
import time
import numpy as np
from pymor.cor... |
from struct import pack
from bgapi.base_command import command
from bgapi.types import (MessageType, MessageClass)
def get_counters(reset):
MSG_TYPE = MessageType.COMMAND_RESPONSE.value
MSG_CLASS = MessageClass.COEX.value
MSG_ID = 0x01
payload = pack('<B', reset)
return command(MSG_TYPE, MSG_CLAS... |
import itertools
import os
import random
from collections import defaultdict
from datetime import datetime
from typing import Any, Callable, Dict, List, Mapping, Sequence, Tuple
import bmemcached
import orjson
from django.conf import settings
from django.contrib.sessions.models import Session
from django.core.manageme... |
#!/usr/bin/env python
""" Translator Class and builder """
from __future__ import print_function
import configargparse
import codecs
import os
import math
import torch
from itertools import count
from onmt.utils.misc import tile
import onmt.model_builder
import onmt.translate.beam
import onmt.inputters as inputters
... |
# -*- coding: utf-8 -*-
# Copyright 2016 OpenMarket 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 la... |
import datetime
import cgi
from bson.objectid import ObjectId
from helper_functions import *
class Post:
def __init__(self, default_config):
self.collection = default_config['POSTS_COLLECTION']
self.response = {'error': None, 'data': None}
self.debug_mode = default_config['DEBUG']
de... |
# -*- coding: utf-8 -*-
"""
simplenote.py
~~~~~~~~~~~~~~
Python library for accessing the Simplenote API
:copyright: (c) 2011 by Daniel Schauenberg
:license: MIT, see LICENSE for more details.
"""
import urllib
import urllib2
from urllib2 import HTTPError
import base64
try:
import json
except... |
from typing import Text, Dict, Any, List, Tuple, Union
import numpy as np
import collections
import six
import PIL.Image as Image
import PIL.ImageDraw as ImageDraw
import PIL.ImageFont as ImageFont
coco_id_mapping = {
1: 'person', 2: 'bicycle', 3: 'car', 4: 'motorcycle', 5: 'airplane',
6: 'bus', 7: 'train', 8:... |
from big_ol_pile_of_manim_imports import *
from once_useful_constructs import *
EXAMPLE_TRANFORM = [[0, 1], [-1, 1]]
TRANFORMED_VECTOR = [[1], [2]]
def matrix_multiplication():
return TexMobject("""
\\left[
\\begin{array}{cc}
a & b \\\\
c & d
\\end{a... |
#!/usr/bin/env python3
"""
This is a set of common functions used by each naumachia VPN script
"""
import yaml
import os
from redis import Redis
from naumdb import DB
ENVFILE = '/env.yaml'
def get_env():
env = {}
yamlenv = {}
with open(ENVFILE, 'r') as f:
yamlenv = yaml.safe_load(f)
env['RED... |
from __future__ import print_function
import argparse
from math import log10
import os
import torch
import torch.nn as nn
import torch.optim as optim
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
from torch.utils.data import DataLoader
from rbpn_deeper import Net as RBPN
from rbpn_deeper im... |
from .meta import BaseFilter
from .binary import BinaryFilter
from .webshell import WebshellPrechecker
|
# Write a function that combines two lists by alternatingly taking elements.
# For example: given the two lists [a, b, c] and [1, 2, 3], the function should return [a, 1, b, 2, c, 3].
def alternatively_combine(list1, list2):
result = []
bigger_list_len = len(list1) > len(list2) and len(list1) or len(list2)
... |
import unittest
from kbmodpy import kbmod as kb
class test_multires(unittest.TestCase):
def setUp(self):
# test pass thresholds
im_count = 10
self.ix = 136
self.iy = 103
self.xv = 34.0
self.yv = 21.0
self.flux = 350.0
p = kb.psf(1.0)
imgs = []
for i in r... |
"""This module contains acceptance tests of scripts that bring up dockerized
test environment.
"""
__author__ = "Jakub Kudzia"
__copyright__ = "Copyright (C) 2016 ACK CYFRONET AGH"
__license__ = "This software is released under the MIT license cited in " \
"LICENSE.txt"
from tests import *
from tests.uti... |
import asyncio
from db import DB
from lib.logger import get_logger
from models.http_bridge import HttpBridge
from models.genesis import Genesis
from models.scheduler import Scheduler
from routers import Routers
from tornado.web import Application
from tornado.ioloop import IOLoop
from tornado.options import define, opt... |
"""
CUDA driver bridge implementation
NOTE:
The new driver implementation uses a *_PendingDeallocs* that help prevents a
crashing the system (particularly OSX) when the CUDA context is corrupted at
resource deallocation. The old approach ties resource management directly
into the object destructor; thus, at corruptio... |
#!/bin/bash
#!/usr/bin/python3
# -*- coding:utf-8 -*-
#encoding:utf-8
import os,sys
import csv
import time
import RPi.GPIO as GPIO
switch = 26
GPIO.setmode(GPIO.BCM)
GPIO.setup(switch,GPIO.OUT)
try:
while True:
now = time.strftime("%Y-%m-%d-%H_%M_%S",time.localtime(time.time()))
str = 'sudo raspivi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from nornir.core.task import Task
from netests import log
from netests.tools.file import open_file
from netests.select_vars import select_host_vars
from netests.comparators.log_compare import log_compare, log_no_yaml_data
from netests.constants import NOT_SET, BGP_SESSION... |
# Generated by Django 3.2.12 on 2022-03-04 11:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('marketplace_flows', '0006_json_field'),
]
operations = [
migrations.AddField(
model_name='projectcreaterequest',
na... |
#!/usr/bin/env python3
import requests
import re
import paho.mqtt.publish as publish
import sys
def wifi_host_count(url):
response = requests.get(url)
if response.status_code != requests.code.ok:
return 0
match = re.search('(?<=active_wireless::).*?(?=})', response.text)
data = match.group(0)
# data i... |
"""Enterasys support."""
from typing import Any
from netmiko.cisco_base_connection import CiscoSSHConnection
class EnterasysSSH(CiscoSSHConnection):
"""Enterasys support."""
def session_preparation(self) -> None:
"""Enterasys requires enable mode to disable paging."""
self._test_channel_read(... |
# 927000100 | demon slayer 4th job adv
sm.spawnNpc(2159335, 377, 69)
sm.removeEscapeButton()
sm.setPlayerAsSpeaker()
sm.sendNext("#b(I remember the feeling of unleashing my Fury... But I can't hold onto it for long...)")
sm.spawnMob(9001041, 377, 69, False)
sm.removeNpc(2159335)
sm.waitForMobDeath(9001041)
sm.addQRValu... |
# ###################
# Licensed under the MIT license. See LICENSE
# ###################
###
# MOSDEF data viewer--
# io.py:
# provide functions to make Data Viewer databse,
# and query it.
###
from __future__ import print_function
import sqlite3
import os.path
import os
fr... |
from __future__ import annotations
from typing import Union
from dkc_api.v1.const import URL_DOMAIN
from dkc_api.v1.models.error import ResponceError, ResponceErrorAlternative
from dkc_api.v1.exceptions.exceptions import NotValidVariables
from .models import DeliveryTimeContent, GetDeliveryTime
import loguru
import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Add `is_in_testset` to raw_datasets in MySQL database, so that at least 10%
of the data online has the flag `is_in_testset`.
"""
import pymysql
import pymysql.cursors
import random
import math
# hwrt modules
from hwrt.handwritten_data import HandwrittenData
import hw... |
import asyncio
from decimal import Decimal
import threading
from typing import TYPE_CHECKING, List, Optional, Dict, Any
from kivy.app import App
from kivy.clock import Clock
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from kivy.factory import Factory
from kivy.uix.recycleview import Recycl... |
"""
This file is part of the TheLMA (THe Laboratory Management Application) project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
This handler converts the results of the library member parser into a
molecule design set (:class:`thelma.entities.molecule.MoleculeDesignSet`).
At this, the... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="pymysql-pooling",
version="1.0.6",
description="pymysql-based database connection pool",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://... |
#
# 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... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import distutils.util
import os
import sys
import pprint
import subprocess
from collections import defaultdict
from six.moves import xrange
# Use a non-interactive backend
import matplotlib
mat... |
def test_valid(cldf_dataset, cldf_logger):
assert cldf_dataset.validate(log=cldf_logger)
def test_forms(cldf_dataset):
assert len(list(cldf_dataset["FormTable"])) == 1055
def test_parameters(cldf_dataset):
assert len(list(cldf_dataset["ParameterTable"])) == 233
def test_languages(cldf_dataset):
as... |
"""
kinto.core.scripts: utilities to build admin scripts for kinto-based services
"""
import logging
from pyramid.settings import asbool
logger = logging.getLogger(__name__)
def migrate(env, dry_run=False):
"""
User-friendly frontend to run database migrations.
"""
registry = env["registry"]
set... |
# Copyright 2014: Mirantis 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) 2015 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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sys import argv
from os import popen
from docker import Client
height, width = popen('stty size', 'r').read().split()
threshold = 128
padding = 1 + int(width) // 80
columns = 4
col = { 'cid': 12, 'image': 0, 'command': 0, 'status': 11, 'names': 0 }
def calc_width(de... |
import os,sys,time
import argparse
import json
base_houdini = os.path.dirname(sys.path[0])
print("%s/cg_houdini/function"%base_houdini)
sys.path.append("%s/cg_houdini/function"%base_houdini)
from HoudiniUtil import HoudiniUtil
from HoudiniPlugin import HoudiniPlugin
parser = argparse.ArgumentParser()
parser.add_argum... |
print ('''
What is the best kind of doggo?
a - shiba
b - pit bull
c - cat
''')
answer = input().lower()
if answer == "a":
print ("YES MI AMIGO/A")
elif answer == "b":
print ("sorry fam... you're stupid")
elif answer == "c":
print ('''You're so stupid, how did you even get to take this quiz????
... |
# Copyright 2019 PrivateStorage.io, 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 agreed to i... |
from nocloud.cloud_init.models import MetaDataGenerator, VendorDataGenerator
mdg = MetaDataGenerator()
mdg.render()
mdg2 = MetaDataGenerator('d0251e2c-66ae-4c6f-b8fa-f65418070ee6')
mdg2.render()
vdg = VendorDataGenerator('test', 'test')
vdg.render()
vdg2 = VendorDataGenerator('test', 'test', False, False, False)
vd... |
import pytest
@pytest.mark.usefixtures("app", "client")
class TestFlaskClient(object):
"""
Test creating a Flask app and a client
connect to the client without access to DB
"""
@pytest.mark.parametrize('url', ['/'])
def test_home_page(self, url, client):
"""Test accessing the ... |
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RVipor(RPackage):
"""Plot Categorical Data Using Quasirandom Noise and Density Estimates""... |
from hawkdet.utils.registry import Registry
detor_registry = Registry('detor')
backbone_registry = Registry('backbone')
stem_registry = Registry('stem')
head_registry = Registry('head')
def build_detor(cfg):
detector = detor_registry.get(cfg.name)
backbone = backbone_registry.get(cfg.Backbone.name)(**cfg.Bac... |
"""
Django settings for NoNamed project.
Generated by 'django-admin startproject' using Django 1.9.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
#... |
# coding: utf-8
"""
Justap API
欢迎阅读 Justap Api 文档 Justap 是为移动端应用和PC端应用打造的下一代聚合支付SAAS服务平台,通过一个 SDK 即可快速的支持各种形式的应用,并且一次接口完成多个不同支付渠道的接入。平台除了支持服务商子商户模式,同时还对商家自有商户(即自己前往微信、支付宝等机构开户)提供了完整的支持。 感谢您的支持,我们将不断探索,为您提供更优质的服务!如需技术支持可前往商户中心提交工单,支持工程师会尽快与您取得联系! # 文档说明 采用 REST 风格设计。所有接口请求地址都是可预期的以及面向资源的。使用规范的 HTTP 响应代码来表示请... |
#!/usr/bin/env python3
# Script: 401 Op Challenge Day 38
# Author: Courtney Hans
# Date of latest revision: 11/25/20
# Purpose: XSS detection
### Install requests bs4 before executing this in Python3
# Import libraries
import requests
from pprint import pprin... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
from .action import QueryLogs
|
from ..core.Processor import Processor
class LogOnDestructionProcessor(Processor):
def __init__(self, schedule={'scheduling period': '2 sec'}):
super(LogOnDestructionProcessor, self).__init__(
'LogOnDestructionProcessor',
schedule=schedule)
|
#!/usr/bin/python3
import datetime
import math
import os
import shutil
import sys
import time
import numpy as np
from opensfm import geo
try:
# pyre-fixme[21]: Could not find module `pyexiv2`.
import pyexiv2
# pyre-fixme[21]: Could not find module `pyexiv2.utils`.
from pyexiv2.utils import make_frac... |
"""gettext tool
"""
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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... |
"""
mixcoatl.resource
------------------
"""
import os
import requests as r
import mixcoatl.auth as auth
from mixcoatl.settings.load_settings import settings
from mixcoatl.decorators.lazy import lazy_property
from mixcoatl.utils import camel_keys
import json
import datetime
class Endpoint(object):
""" A class fo... |
# Copyright 2013 UnitedStack 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... |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
from fortran_format import *
from for2py_arrays import *
def main():
A = Array([(1,4),(1,6)])
C = Array([(1,3)])
C.set_elems(subscripts(C), [1,3,4]) # C = (/1,3,4/)
for i in range(1,4+1):
for j in range(1,6+1):
A.set((i,j), i*i+j*j) # A(i,j) = i*i+j*j
fmt_obj_1... |
import pytest
import pexpect
from ansible_runner.runner_config import RunnerConfig
@pytest.fixture(scope='function')
def rc(request, tmpdir):
rc = RunnerConfig(str(tmpdir))
rc.suppress_ansible_output = True
rc.expect_passwords = {
pexpect.TIMEOUT: None,
pexpect.EOF: None
}
rc.cwd =... |
#!/usr/bin/env python3
# Copyright (c) 2014-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.
"""Test the RPC HTTP basics."""
from test_framework.test_framework import BitcoinTestFramework
from test_... |
import json
import re
import uuid
from unittest.mock import ANY, MagicMock, Mock, patch
import graphene
import pytest
from django.contrib.auth.tokens import default_token_generator
from django.core.exceptions import ValidationError
from django.core.files import File
from django.core.validators import URLValidator
from... |
import pika
credentials = pika.PlainCredentials(username='admin', password='admin')
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost', port=5672, credentials=credentials))
channel = connection.channel()
channel.queue_declare(queue='simulation')
channel.basic_publish(exchange='',
... |
# 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
"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class AuthRegistrationsCredentia... |
# Copyright 2010 Hakan Kjellerstrand hakank@gmail.com
#
# 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 ... |
# 9.3.2
# 11.2.1
# 12.4.3
import numpy as np
from typing import List, Union, Optional
from .individual import Individual
def gaussian_mutation(chromosome: np.ndarray, prob_mutation: float,
mu: List[float] = None, sigma: List[float] = None,
scale: Optional[float... |
# (C) Copyright 2010-2020 Enthought, Inc., Austin, TX
# All rights reserved.
from force_bdss.api import BaseOptimizerEngine
class DummyOptimizerEngine(BaseOptimizerEngine):
def optimize(self):
return [0.0]
|
"""
This helper script creates a documentation page from the materials database
that is stored in JSON format.
To run it, just do
python ./make_materials_table.py
This will create the `pyroomacoustics.materials.database.rst` file in the doc.
"""
import json
from pathlib import Path
from tabulate import tabulat... |
from .genes import Genes, RecurrentGenes
from .individual_base import IndividualBase, RecurrentIndividualBase
from .numpy import Individual, RecurrentIndividual
|
import time
import pyautogui
# Prevents pyautogui.FailSafeException to be raised if the
# mouse is in one of the screen corners during move(),
# see https://pyautogui.readthedocs.io/en/latest/#fail-safes
pyautogui.FAILSAFE = False
SECONDS_BETWEEN_MOVEMENTS = 60 * 3
def move():
pyautogui.move(+1, +1) # 1 pixel ... |
import re
from urllib.parse import urlparse
def is_internal_url(url: str, main_url) -> bool:
return main_url in url or "http" not in url
def is_xe_based_url(url: str) -> bool:
return "?mid" in url
def is_gnu_based_url(url: str) -> bool:
return "bo_table" in url
def assemble_url(href_without_http: st... |
import sys
import csv
import re
import datetime
import time
# class for an activity record
# three values, a date, time, and intensity
class Activity:
def __init__(self, record):
self.time = ''
self.date = ''
self.intensity = ''
if not self.validate(record):
pr... |
# -*- mode:python; coding:utf-8 -*-
# Copyright (c) 2020 IBM Corp. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
... |
import os
from ib_miniprojects_backend.settings.base import *
from ib_miniprojects_backend.settings.base_pg_db import *
from ib_miniprojects_backend.settings.base_swagger_utils import *
from ib_miniprojects_backend.settings.base_aws_s3 import *
# SECURITY WARNING: keep the secret key used in production secret!
SECR... |
# Deep Learning Quick Reference Chapter 5: Multiclass Classification
# Mike Bernico <mike.bernico@gmail.com>
from keras.datasets import mnist
from keras.utils import to_categorical
from keras.models import Model
from keras.layers import Input, Dense
from keras.callbacks import TensorBoard, ModelCheckpoint
from sklearn... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
import subprocess
import argparse
import re
import json
from collections import defaultdict
import eyed3
def get_config():
parser = argparse.ArgumentParser(description='Copy audio library to USB')
parser.add_argument('-c', '--config', hel... |
from future import standard_library
standard_library.install_aliases()
import pickle as pkl
import unittest
from nineml.utils.comprehensive_example import instances_of_all_types
class TestPickle(unittest.TestCase):
def test_pickle(self):
for obj in instances_of_all_types:
pkl_str = pkl.dumps(... |
import torch
import torch.nn as nn
import superp
############################################
# self-defined activation function
############################################
class my_act(nn.Module):
def __init__(self, bd):
super(my_act, self).__init__()
self.bent_degree = bd
def forwar... |
def return_media_duration(fname, playlist = None):
# Check input ...
if fname.startswith("bluray:") and playlist is None:
raise Exception("a Blu-ray was specified but no playlist was supplied")
# Import modules ...
import json
import subprocess
# Find format info ...
if fname.start... |
# Tests of the alloc service
import unittest
import calipertest as cat
class CaliperAllocServiceTest(unittest.TestCase):
""" Caliper sysalloc service test cases """
def helper_test_hook(self, hook):
# test allocated.0
self.assertTrue(cat.has_snapshot_with_keys(
self.snapshots, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.