text stringlengths 2 999k |
|---|
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2010 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import pbtest
import unittest
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# where to run the acceptance tests
PBTEST_ORG_URL = "https://pbtest.org/tra... |
from django.test import Client, RequestFactory, TestCase
from blog.models import Article, Category, Tag
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
import datetime
from accounts.models import BlogUser
from django.core.urlresolvers import reverse
# Create your tests here... |
import pycondor, argparse, sys, os
from glob import glob
import numpy as np
import pandas as pd
import francis.utils as utils
f_path = utils.get_francis_path()
error = '/scratch/apizzuto/fast_response/condor/error'
output = '/scratch/apizzuto/fast_response/condor/output'
log = '/scratch/apizzuto/fast_response/condor/l... |
import time
import logging
from typing import List
from spaceone.inventory.connector.aws_efs_connector.schema.data import FileSystem, MountTarget, LifecyclePolicy
from spaceone.inventory.connector.aws_efs_connector.schema.resource import FileSystemResource, FileSystemResponse
from spaceone.inventory.connector.aws_efs_... |
#!/usr/bin/env python3
import time
from SidechainTestFramework.sc_boostrap_info import SCNodeConfiguration, SCCreationInfo, MCConnectionInfo, \
SCNetworkConfiguration
from SidechainTestFramework.sc_test_framework import SidechainTestFramework
from test_framework.util import fail, assert_false, assert_true, start_n... |
"""
Your module description
"""
#print("hello world") #my first attempt at a single line comment
"""
this is my second py code for my 2nd lecture
"""
"""
2nd regional comment
"""
#this is my 2nd line comment
#print("Hello World".lower())
"""
print(123)
print(123.)
print("123")
"""
#print(" hello world ".strip())... |
from os import name
from werkzeug.security import generate_password_hash
import csv
from faker import Faker
import random
# num_users = 110
num_users = 500
num_products = 10000
num_purchases = 4000
num_sellers = 300
num_accounts = 400
num_categories = 20
num_carts = 1000
num_reviews = 20000
images = [
"https://lh... |
"""
WSGI config for devops project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... |
import argparse
import sys
import inspect
from collections import defaultdict, Iterable
import json
import os
import colorama
import textwrap
import pickle
import hashlib
_parser = argparse.ArgumentParser(prog= '',
add_help=True,
formatter_class=lamb... |
class TimexRelativeConvert:
@staticmethod
def convert_timex_to_string_relative(timex, reference_date):
from .english import english_convert_timex_to_string_relative
return english_convert_timex_to_string_relative(timex=timex, date=reference_date)
|
# Copyright 2014-2016 Insight Software Consortium.
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
from . import namespace
from . import calldef
from . import cpptypes
from . import type_traits
from . import class_d... |
"""RESTful Investor resource."""
from flask import request
from flask_restx import Resource
from flask_restx._http import HTTPStatus
from ..service.investor_service import (
delete_investor,
get_all_investors,
get_investor_by_id,
save_investor,
update_investor,
)
from .dto import InvestorDTO
api ... |
# Imports
import numpy as np
from scipy.ndimage import convolve
from matplotlib import pyplot as plt
from matplotlib import animation
import pickle
import time
shape = (300, 300) # Shape of the grid (width x height)
density = 0.30 # ~Living cells density at t0
n_steps = 250 # Number of steps
delay = 0.1 # ... |
#/************************************************************************************************************************
# Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modificat... |
"""
CustomQtDialog.py - Example of how to create a custom Qt dialog in Deadline monitor
Copyright Thinkbox Software 2016
"""
import sys
from System.IO import *
from Deadline.Scripting import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
import PyQt5.QtCore
import ... |
# coding=utf8
# Copyright 2018 JDCLOUD.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 or agreed ... |
"""Mypy Inline Configs.
see https://mypy.readthedocs.io/en/stable/inline_config.html
# mypy: disallow-untyped-defs = False
# mypy:
"""
def add(lhs: int, rhs: int) -> int:
"""Add two integers.
Args:
lhs (int): an integer.
rhs (int): an integer.
Returns:
int: sum of lhs and rhs.
... |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Base class for RPC testing."""
import configparser
from enum import Enum
import argparse
import loggin... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-10-12 15:36
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
m... |
# Generated by Django 2.2.5 on 2019-09-23 22:17
import django.contrib.postgres.fields.jsonb
import django.core.serializers.json
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("api", "0019_scratchorg_login_url")]
operations = [
migrations.AddField(
... |
class CarouselMedia:
#TODO create class
def __init__(
self,
type,
image_low_resolution_url,
image_thumbnail_url,
image_standard_resolution_url,
image_high_resolution_url,
video_low_resolution_url,
video_standard_resolution_url,
video_low... |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
import pandas as pd
from pandas import Index, Int64Index, NaT, Period, PeriodIndex, period_range
import pandas.util.testing as tm
class TestPeriodIndexAsType(object):
@pytest.mark.parametrize('dtype', [
float, 'timedelta64', 'timedelta64[ns]'])
... |
"""Consts used by Tradfri."""
from homeassistant.components.light import SUPPORT_BRIGHTNESS, SUPPORT_TRANSITION
from homeassistant.const import CONF_HOST # noqa: F401 pylint: disable=unused-import
ATTR_DIMMER = "dimmer"
ATTR_HUE = "hue"
ATTR_SAT = "saturation"
ATTR_TRADFRI_GATEWAY = "Gateway"
ATTR_TRADFRI_GATEWAY_MOD... |
import dash
import dash_bootstrap_components as dbc
# meta_tags are required for the app layout to be mobile responsive
app = dash.Dash(__name__,
meta_tags=[{'name': 'viewport',
'content': 'width=device-width, initial-scale=1.0'}],
external_stylesheets=[dbc.... |
# 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 agreed ... |
n = int(input())
a, b = 1, 1
count = 0
def isprime(n):
if n> 1:
for i in range(2, n// 2 + 1):
if (n % i) == 0:
return False
else:
return True
else:
return False
if n == 1:
print("Fibonacci sequence : ", n, ":")
print(a)
else:
while co... |
import os
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
class ReadParams:
def __init__(self):
self.DotFileHeaders = [ 'FrameTime', 'X0', 'Y0', 'X1', 'Y1', 'X2', 'Y2',
'X3', 'Y3', 'X4', 'Y4', 'E11', 'E22', 'E12',
... |
# Copyright (c) 2020 PaddlePaddle 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 app... |
try:
from urllib2 import urlopen, URLError
except ImportError:
# urllib2 has been merged into urllib as of Python 3.0
# http://docs.python.org/release/3.2.2/whatsnew/3.0.html?highlight=urllib2#library-changes
from urllib.request import urlopen
from urllib.error import URLError
# Test against Google... |
from . import aqmesh, beaco2n, pipeline, utils, handlers
import sys as _sys
__all__ = ["aqmesh", "beaco2n", "utils", "pipeline", "handlers"]
if _sys.version_info.major < 3:
raise ImportError("openghg requires Python 3.7 minimum")
if _sys.version_info.minor < 7:
raise ImportError("openghg requires Python 3.7 ... |
# -*- coding: utf-8 -*-
#
# intake_iris documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 15 18:11:02 2018.
#
# 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.
#... |
"""SCons.Tool.linkloc
Tool specification for the LinkLoc linker for the Phar Lap ETS embedded
operating system.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# __COPYRIGHT__
#
# Permission is hereby gran... |
"""
Copyright 2020 Taxamo, Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... |
# Generated by Django 3.1.5 on 2021-01-19 15:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('benefits', '0004_auto_20210116_1813'),
]
operations = [
migrations.AddField(
model_name='benefit',
name='highlights'... |
# This file is part of the bumpver project
# https://github.com/mbarkhau/bumpver
#
# Copyright (c) 2018-2020 Manuel Barkhau (mbarkhau@gmail.com) - MIT License
# SPDX-License-Identifier: MIT
import os
import sys
import setuptools
try:
import fastentrypoints # noqa
except ImportError:
pass
def project_path(*... |
import nonexistent_lib_1
from nonexistent_lib_2 import nonexistent_function
from nonexistent_lib_3 import nonexistent_class
class ClassObject(object):
def __init__(self, param_1, param_2, param_3):
"""
:param param_1: parameter 1
:param param_2: parameter 2
:param param_3: paramete... |
#! /usr/bin/env python3
'''SMTP/ESMTP client class.
This should follow RFC 821 (SMTP), RFC 1869 (ESMTP), RFC 2554 (SMTP
Authentication) and RFC 2487 (Secure SMTP over TLS).
Notes:
Please remember, when doing ESMTP, that the names of the SMTP service
extensions are NOT the same thing as the option keywords for the R... |
# coding: utf-8
# In[1]:
#import matplotlib.pyplot as plt
#import seaborn as sns
import pandas as pd
import numpy as np
import random as rnd
from sklearn.cross_validation import KFold, cross_val_score
# machine learning
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC, LinearSVC
fr... |
import random
from ansible_collections.community.general.tests.unit.compat import unittest
from ansible_collections.community.general.plugins.module_utils.cloud import _exponential_backoff, \
_full_jitter_backoff
class ExponentialBackoffStrategyTestCase(unittest.TestCase):
def test_no_retries(self):
... |
# -*- coding: utf-8 -*-
__all__ = ('Timeouter', 'multievent', )
from ...backend.event_loop import LOOP_TIME
from ...discord.core import KOKORO
class multievent:
"""
Helper class to hold more waitfor event handlers together allowing to add `target` - `waiter` pairs at the same to
more.
Attributes
... |
# ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: py_queires.py
#
# Tests: python filters / python queries
# plots - Pseudocolor
#
#
# Programmer: Cyrus Harrison
# Date: Fri May 21 09:14:07 PDT 2010
#
# Modifications:
#
# ... |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2020
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... |
# 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 or agreed to in... |
"""Check Makefile parsing (allows selection of sections)
WARNING: use unittest framework, pytest conflicts with test templates:
template/tests/test_*.py ( {{ }} syntax)
or exclude these tests
"""
import unittest
from itertools import chain
import tempfile
from devopstemplate.makefile import MakefileTemplate as MkTempl... |
# coding: utf8
"""Ner Model"""
from .predict import predict_ner
|
import logging
import envi.archs.amd64 as e_amd64
import vivisect.impemu.emulator as v_i_emulator
logger = logging.getLogger(__name__)
########################################################################
#
# NOTE: For each architecture we intend to do workspace emulation on,
# extend an emulator to allow an... |
"""
Displays a NetworkX barbell graph to screen using a CircosPlot.
Features of this example:
- MatrixPlot
- Styling matrix plot with different colormap.
"""
import matplotlib.pyplot as plt
import networkx as nx
from nxviz.plots import MatrixPlot
G = nx.barbell_graph(m1=10, m2=3)
# Instantiate a MatrixPlot with no... |
import mycsv
headers, data = mycsv.readcsv(mycsv.getdata())
|
from setuptools import setup
with open("README.md", "r") as fh:
readme = fh.read()
setup(name='Maceio',
version='1.0.5',
url='https://github.com/yuca-live/maceio',
license='MIT License',
author='Yuca Live',
long_description=readme,
long_description_content_type="text/markdown",... |
import time
from functools import wraps
class EventHandlerRepo(type):
handlers = []
def __init__(cls, name, bases, attrs):
if name != "EventHandler":
EventHandlerRepo.handlers.append(cls)
class EventHandler(metaclass=EventHandlerRepo):
MASK = 0
def __init__(self, disp, root, co... |
# Copyright 2017-2020 EPAM Systems, Inc. (https://www.epam.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 appli... |
from django.contrib import admin
from .models import Kitten
class KittenAdmin(admin.ModelAdmin):
list_display = ['admin_thumb', '__str__', '__unicode__', 'url', 'path']
def admin_thumb(self, obj):
return '<img src="{0}" />'.format(obj.thumbnail.url)
admin_thumb.allow_tags = True
admin_thumb.s... |
from flask import Flask, abort, make_response, jsonify
from modules import file_management as fmanage
import asyncio, aiohttp
import os
from modules.utils import settings
app = Flask(settings.Config.getConfigValue('default', 'name'))
# todo actually work on the REST interface
@app.route('/')
def hello_world():
retu... |
import argparse
import logging
import threading
from bluesky.callbacks.zmq import Proxy, RemoteDispatcher
logger = logging.getLogger('bluesky')
def start_dispatcher(host, port, logfile=None):
"""The dispatcher function
Parameters
----------
logfile : string
string come from user command. ex ... |
"""
Message processor - the heart of our robot
Parse messages from Facebook:
https://developers.facebook.com/docs/messenger-platform/webhook-reference
TO DO:
- Make caching of messages more sophisticated
"""
import time
import random
import bot_response_text
import response_dicts
import ... |
"""Future-proof self-describing hashes.
Examples:
decode(data).digest
"""
from typing import NamedTuple
import uvarint
class MultiHash(NamedTuple):
"""The digest, its length and the hashing algorithm that produced it."""
function: int
length: int
digest: bytes
class LengthMismatchError(Except... |
# Copyright (c) 2020 PaddlePaddle 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 app... |
# coding=utf-8
from .action import action
from .concurrency import *
from .signals import *
|
# Copyright 2017 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 django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import render
from django.template.loader import get_template
from hackerspace.models import Error, Person,Project, Event, Guilde, MeetingNote, Space, Machine, Consensus,Photo
from hackerspace.tools.space_open import getOpenNowStatus
from... |
# 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 u... |
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from pathlib import Path
plt.style.use("seaborn-colorblind") # "ggplot"
palette = plt.cm.Dark2.colors
font = {"family": "STIXGeneral", "size": 16}
savefig = {"dpi": 600, "bbox": "tight"}
lines = {"linewidth": 4}
figure =... |
from __future__ import print_function
import re
try:
from argparse import ArgumentParser
except:
print("Failed to import module 'argparse'. Upgrade to Python 2.7, copy argparse.py to this directory or try 'apt-get install python-argparse'")
raise
parser = ArgumentParser(description='Patch calling conventions f... |
# Copyright 2017 - Nokia
# All Rights Reserved.
import testtools
from tempest.lib import decorators
from tempest.lib import exceptions as tempest_exceptions
from nuage_tempest_plugin.lib.test.nuage_test import NuageBaseTest
from nuage_tempest_plugin.lib.topology import Topology
class RouterAttachmentTest(NuageBase... |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import pytest
import functools
from io import BytesIO
from devtools_testutils.aio import recorded_by_proxy_async
from azure.core.exceptions import Servic... |
import pandas as pd
import os
import io
import yaml
from typing import NamedTuple
def save_csv(df: pd.DataFrame, ticker: str, path: str):
file_path = os.path.join(path, ticker + '.csv').replace('\\', '/')
df.to_csv(file_path, index=False)
def write_yaml(data, file_path, encoding='uft8'):
with io.open(fi... |
async def m001_initial(db):
"""
Initial offlineshop tables.
"""
await db.execute(
f"""
CREATE TABLE offlineshop.shops (
id {db.serial_primary_key},
wallet TEXT NOT NULL,
method TEXT NOT NULL,
wordlist TEXT
);
"""
)
... |
#!/usr/bin/env python3
# Copyright (c) 2019-2020 The YEP developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import time
from test_framework.test_framework import YepTestFramework
from test_framework.util import (
asse... |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import contextlib
import funsor
from funsor.adjoint import AdjointTape
from pyro.contrib.funsor import to_data, to_funsor
from pyro.contrib.funsor.handlers import enum, plate, replay, trace
from pyro.contrib.funsor.infer.elbo import ... |
import sys
from queue import Queue
try:
import LabJackPython
import u3
from . import ei1050
except:
raise ImportError('Driver error - The driver could not be imported.\n\
Please install the UD driver (Windows) or Exodriver (Linux and Mac OS X) from www.labjack.com')
class mai... |
import os
import platform
from pathlib import Path
from torchaudio.datasets import tedlium
from torchaudio_unittest.common_utils import (
get_whitenoise,
save_wav,
skipIfNoSox,
TempDirMixin,
TorchaudioTestCase,
)
# Used to generate a unique utterance for each dummy audio file
_UTTERANCES = [
"... |
import requests_mock
from pathlib import Path
from send_to_kindle.downloader.image_downloader import download_images
def test_download_images(tmpdir, get_file_content):
tmp_dir = Path(tmpdir)
image_map = {
"ABC.jpg": "http://image/ABC",
"DEF.jpg": "http://image/DEF",
"GHI.jpg": "http:/... |
# coding=utf-8
from django.core.management import call_command
from django.core.urlresolvers import reverse
from rest_framework.test import APIClient, APITestCase
from rest_framework import status
class ApiTest(APITestCase):
def setUp(self):
"""Setup test http client"""
self.client = APIClient()
... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
from unitls import __get_file_extension
solutionName = str()
VST_UniqueID = str()
projects = dict()
def saveToFile( file ) :
def loadFromFile( file ) :
def set_solution_name( solutionName ) :
solutionName = solutionName
def set_project_VST_UniqueID( id ) :
... |
# Copyright 2017 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 .tensor_shape import *
from .tensor import *
|
"""Holds edited version of external lib incorporated into wiki_music."""
import logging
logging.getLogger(__name__)
|
#!/usr/bin/env python
"""Some tests covering the parameters code.
"""
import os
import pytest
import requests
import shutil
import unittest
from nf_core.workflow import parameters as pms
from nf_core.workflow import validation as valid
WD = os.path.dirname(__file__)
PATH_WORKING_EXAMPLE = os.path.join(WD, 'example.js... |
# Copyright 2015 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... |
import glob
import os.path
import shutil
import argparse
import cv2
def clean_folder(folder_name):
try:
shutil.rmtree(folder_name)
except OSError:
pass
except TypeError:
return
os.makedirs(folder_name, exist_ok=True)
def make_folder(folder_name):
os.makedirs(folder_name,... |
# -*- coding: utf-8 -*-
__author__ = 'vincent'
import uuid
import json
from redis_help import redis_client
from werkzeug.security import generate_password_hash, check_password_hash
from . import redis_help
# 下面这个包 itsdangerous 用于生成确认令牌
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
def gen... |
x=int(input())
print(1000*(x//500)+5*((x-(x//500)*500)//5)) |
#!/usr/bin/python -tt
# 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/
"""Wordcount exercise
Google's Python class
The main() below is already defined and comp... |
import unittest
import numpy as np
import pytest
from skfda.representation import FDataGrid
from skfda.representation.basis import Fourier
from skfda.datasets import fetch_gait
from skfda.inference.anova import oneway_anova, v_asymptotic_stat, \
v_sample_stat
class OnewayAnovaTests(unittest.TestCase):
def t... |
"""
network2.py
~~~~~~~~~~~~~~
An improved version of network.py, implementing the stochastic
gradient descent learning algorithm for a feedforward neural network.
Improvements include the addition of the cross-entropy cost function,
regularization, and better initialization of network weights. Note
that I have... |
#!/usr/bin/env python3
import sys
import os
import re
def error_search(log_file):
error = input("What is the error? ")
returned_errors = []
with open(log_file, mode='r',encoding='UTF-8') as file:
for log in file.readlines():
error_patterns = ["error"]
for i in range(len(error.split(' '))):
... |
__author__ = 'jules'
import numpy as np
from scipy.stats import uniform
from customDistributions import Hyperexp2_gen, Erlangk_gen, Gamma, BranchingErlang, TruncatedErlangk_gen, MixtureNormUni, TruncatedHyperexp2
import math
def infer_distribution(job):
X = np.array(job.execution_history)
mean = np.mean(X... |
"""Tests for aiohttp/worker.py"""
import asyncio
import os
import socket
import ssl
from unittest import mock
import pytest
from aiohttp import web
base_worker = pytest.importorskip('aiohttp.worker')
try:
import uvloop
except ImportError:
uvloop = None
WRONG_LOG_FORMAT = '%a "%{Referrer}i" %(h)s %(l)s %s... |
# qubit number=3
# total number=15
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
import networkx as nx
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collectio... |
# -*- coding: UTF-8 -*-
from nonebot.default_config import *
# 也可以在此处对nonebot进行设置
# 全局管理员
SUPERUSERS = {
#12345,
#...,
}
# 命令起始标识
COMMAND_START = {'!', '!'}
# nonebot的debug开关
DEBUG = False
# 有命令在运行时的显示
SESSION_RUNNING_EXPRESSION = '您有命令正在运行!' |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
from os.path import abspath, join, dirname
# Insert module path here
sys.path.insert(0, abspath(dirname(__file__)))
sys.path.insert(0, abspath(join(dirname(__file__), '..')))
import ctre
# -- RTD configuration -------------------------------------... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import map
from builtins import *
import sys
from genestack_... |
"""Pulse penetration ratio and density absolute mean calculations.
See https://github.com/eEcoLiDAR/eEcoLiDAR/issues/23.
"""
import numpy as np
from laserchicken.feature_extractor.base_feature_extractor import FeatureExtractor
from laserchicken.keys import point, normalized_height
# classification according to
# ht... |
import numpy as np
def dialog_f1_eval(logits, labels):
def getpred(result, T1=0.5, T2=0.4):
# 使用阈值得到preds, result = logits
# T2 表示如果都低于T2 那么就是 no relation, 否则选取一个最大的
ret = []
for i in range(len(result)):
r = []
maxl, maxj = -1, -1
for... |
import os
import json
from ave.broker.profile import *
from ave.workspace import Workspace
from ave.broker._broker import Broker, RemoteBroker
from ave.network.connection import find_free_port
import setup
cfg = {
'testdrive': {
'uid' : 'spirent1',
'host' : 'testdrive-ho... |
from sane_doc_reports.domain.CellObject import CellObject
from sane_doc_reports.domain.Element import Element
from sane_doc_reports.elements import error
from sane_doc_reports.populate.utils import insert_text
from sane_doc_reports.conf import DEBUG, TREND_MAIN_NUMBER_FONT_SIZE, \
TREND_SECOND_NUMBER_FONT_SIZE, PYD... |
# 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 u... |
import pandas as pd
from torch.utils.data import Dataset, DataLoader
from sklearn.preprocessing import StandardScaler
import numpy as np
from keras.preprocessing.sequence import TimeseriesGenerator
import torch
class DataPreperator:
"""
This class provides methods for pre-processing the sensor data so it can
... |
import pdf_to_json as p2j
import json
url = "file:data/multilingual/Latn.HAT/Sun-ExtA_12/udhr_Latn.HAT_Sun-ExtA_12.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.