text stringlengths 2 999k |
|---|
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 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 app... |
"""
stream.py
Individual thread for event stream processing
"""
import datetime
import time
import json
import re
import requests
from falconpy import APIHarness
import logger
class Stream(): # pylint: disable=R0902
"""Class to represent a single stream."""
def __init__(self, stream_config, api_interface, ... |
def plug_in(symbol_values):
# placeholder, a little dumb
# will be partly replaced with CrystalPrototypeClassifier
structure = symbol_values['s']
# support other anions too?
if 'O' not in [sp.symbol for sp in structure.types_of_specie]:
raise ValueError("No oxygen in structure")
if struc... |
def standard_answer(a):
max_element = -1e20
current = 0
for i in range(len(a)):
if a[i] >= max_element:
current = i
max_element = a[i]
return current
test_inputs = [([1, 2, 5, 6, 3, 4, 7, 8, 99, 99, 1, 2, 7], ),
([7, 9, 88, 2, -100, -100, 1... |
#!/usr/bin/env python3
import numpy as np
import pyheclib as phl
# write regular time series
dss_tseries6 = phl.hecdss("tseries_dss6.dss",6)
dss_tseries7 = phl.hecdss("tseries_dss7.dss",7)
# write regular tseries data
reg_data = np.array([1.11, 2.12, 45.33, 2.32, 7.486868686, 9.89, 8888888.4440420])
regular_... |
import sys
if './' not in sys.path: sys.path.append('./')
from objects.CSCG._3d.ADF.trace.base.main import _3dCSCG_Algebra_DUAL_Trace_Form
class _3dCSCG_T2_ADF(_3dCSCG_Algebra_DUAL_Trace_Form):
"""
Dual trace 2-form.
:param mesh:
:param space:
:param orientation:
:param name:
"""
de... |
# coding=utf-8
"""
This is a Python implementation of the examples in https://www.currencycloud.com/developers/cookbooks/
Additional documentation for each API endpoint can be found at https://www.currencycloud.com/developers/overview.
If you have any queries or you require support, please contact our Support team at s... |
"""
This file offers the methods to automatically retrieve the graph Bifidobacterium gallicum.
The graph is automatically retrieved from the STRING repository.
Report
---------------------
At the time of rendering these methods (please see datetime below), the graph
had the following characteristics:
Datetime: 20... |
"""
This contains data structure and constants related with animation handling.
"""
# index for keyFramesInfo list structure
# data strucrure: {[nodeUID, propertyName] : [frameNum,
# value,
# [inSlopeX, inSlopeY],
... |
import asyncio
import time
CONTEXT_SWITCHES = 1000000
async def run():
wait_event = asyncio.Event()
wait_event.set()
counter = 0
while counter <= CONTEXT_SWITCHES:
await wait_event.wait()
wait_event.clear()
counter += 1
wait_event.set()
def main():
now = time.per... |
# 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 -*-
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests that our test infrastructure is really working!"""
import datetime
import os
import sys
import pytest
import coverage
from cover... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import uni... |
from django.http import HttpResponse
from django.template import loader
from wagtail.documents.models import Document
from beer.models import Beer
# Create your views here.
def shop_landing_page(request):
template_name = 'shop/shop_landing_page.html'
documents = Document.objects.filter(collection__name='shop_i... |
from typing import Optional, Sequence, Union
import xnmt.tensor_tools as tt
from xnmt import batchers, input_readers, sent
from xnmt.persistence import Serializable, serializable_init
class TrainableModel(object):
"""
A template class for a basic trainable model, implementing a loss function.
"""
def calc_n... |
import os
import shutil
import subprocess
import sys
from contextlib import contextmanager
from os.path import isfile
from hatch.clean import remove_compiled_scripts
from hatch.config import get_proper_python, get_venv_dir
from hatch.exceptions import InvalidVirtualEnv
from hatch.utils import (
NEED_SUBPROCESS_SHE... |
#!/usr/bin/python2
#-*- coding:utf-8 -*-
import os
import time
import platform
import socket
import sys
import select
import logging
import readline
banner = '''
\033[1;96m
██████ ▓█████ ▄████▄ ██▀███ ▓█████▄▄▄█████▓
▒██ ▒ ▓█ ▀ ▒██▀ ▀█ ▓██ ▒ ██▒▓█ ▀▓ ██▒ ▓▒
░ ▓██▄ ▒███ ▒▓█ ▄ ▓██ ░▄█ ▒▒███ ▒ ▓██... |
"""
Spectral bipartivity measure.
"""
import networkx as nx
__all__ = ["spectral_bipartivity"]
def spectral_bipartivity(G, nodes=None, weight="weight"):
"""Returns the spectral bipartivity.
Parameters
----------
G : NetworkX graph
nodes : list or container optional(default is all nodes)
... |
'''
Tests of output_plots.py module
'''
import pytest
import os
import numpy as np
import matplotlib.image as mpimg
from ogcore import utils, output_plots
# Load in test results and parameters
CUR_PATH = os.path.abspath(os.path.dirname(__file__))
base_ss = utils.safe_read_pickle(
os.path.join(CUR_PATH, 'test_io_... |
#============================================================================
#
# Copyright (c) Kitware Inc.
#
# 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... |
import pytest
from pathlib import Path
from jack_compiler import fs_utils
def test_validateInputPath():
# Success scenarios
fs_utils.validateInputPath(Path("tests/jackFiles"))
fs_utils.validateInputPath(Path("tests/jackFiles/"))
fs_utils.validateInputPath(Path("tests/jackFiles/Main.jack"))
fs_util... |
from data import *
from utils.augmentations import SSDAugmentation, BaseTransform
from utils.functions import MovingAverage, SavePath
from utils.logger import Log
from utils import timer
from layers.modules import MultiBoxLoss
from yolact import Yolact
import os
import sys
import time
import math, random
from pathlib i... |
a ==b !=c< d<=e > f
f >= g is True is not False in ["True", "False"] not in ["hi"] |
# 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 to in writing, ... |
# coding=utf-8
from pytdx.parser.base import BaseParser
from pytdx.helper import get_datetime, get_volume, get_price
from collections import OrderedDict
import struct
"""
tradex 结果
7、查询分时...
时间 价格 均价 成交量 成交额
09:30 3706.199951 3706.199951 27 13336
09:31 3705.199951 3705.910400... |
import sys
sys.path.append('../')
from error import error
errores = list()
reservadas = {
'smallint' : 'SMALLINT',
'integer' : 'INTEGER',
'bigint' : 'BIGINT',
'decimal' : 'DECIMAL',
'numeric' : 'NUMERIC',
'real' : 'REAL',
'double' : 'DOUBLE',
'precision' : "PRECISION",
... |
#####################################################################
# #
# settings.py #
# #
# Copyright 2013, Monash University ... |
# -*- coding: utf-8 -*-
# Copyright 2014-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 applicab... |
import os
import re
RESOURCES_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "resources"))
class pytest_regex: # noqa: N801
"""Assert that a given string meets some expectations."""
def __init__(self, pattern, flags=0):
self._regex = re.compile(pattern, flags)
def __eq__(self, ... |
# This is an input class. Do not edit.
class AncestralTree:
def __init__(self, name):
self.name = name
self.ancestor = None
def getYoungestCommonAncestor(topAncestor, descendantOne, descendantTwo):
depthOne = getDescendantDepth(descendantOne, topAncestor)
depthTwo = getDescendantDepth(descend... |
"""
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... |
"""
BoingBoing web scraping.
"""
import urllib.request as urllib2
from datetime import datetime
import http
import sys
import time
import re
from bs4 import BeautifulSoup
from selenium import webdriver
from util import connectToDatabaseServer
from boingboing_comments import fetch_comment_info
# system default value ... |
# Copyright 2020 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... |
import argparse
from azureml.core.run import Run, _OfflineRun
from sklearn.model_selection import train_test_split
import lightgbm as lgb
import os
parser = argparse.ArgumentParser()
parser.add_argument("--dataset", type=str, dest="dataset", default="loans")
parser.add_argument(
"--output-path",
type=str,
... |
import time
import arcade
import random
from bird import Bird
from pipe import Pipe
from game_state import State
from game_variables import *
import numpy as np
class Game(arcade.Window):
def __init__(self, width, height):
"""
Initializer for the game window, note that we need to ... |
import sys
import os
from puzzy import fset
from puzzy.inferencer import Inferencer
from extract_features import process_image
from commons import *
class ShapeRecognizer(object):
def __init__(self, rule_base='rule_base.txt'):
fsets = {}
rules = {}
try:
with open(rule_base, 'r... |
#!/usr/bin/env python
# encoding: utf-8
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2017 Prof. William H. Green (whgreen@mit.edu),
# Prof. Richard H. West (r.west@neu.edu) and the RMG Team (rmg_dev@mit.edu)
#
# ... |
from urllib2 import urlopen
from bs4 import BeautifulSoup
import requests
#point to FRUS volumes
html = urlopen("http://digicoll.library.wisc.edu/cgi-bin/FRUS/FRUS-idx?type=browse&scope=FRUS.FRUS1")
soup = BeautifulSoup(html, 'html.parser')
with open("frus_section_title.txt", "w") as file:
#scrape FRUS volume relati... |
"""Strength of Connection functions"""
__docformat__ = "restructuredtext en"
from warnings import warn
import numpy as np
import pyamg
from pyamg.util.utils import scale_rows, scale_columns
from scipy import sparse
import amg_core
__all__ = ['classical_strength_of_connection',
'symmetric_strength_of_con... |
import random
import datetime
import importlib
from django.core.management.base import BaseCommand
from alfheimproject.settings import CONFIG
models = importlib.import_module('core.{emu}.models'.format(emu=CONFIG['server']['conf']['emu_type']))
class Command(BaseCommand):
help = 'This command will generate rand... |
import numpy as np
from pandas._libs import lib
from pandas.core.dtypes.cast import maybe_downcast_to_dtype
from pandas.core.dtypes.common import (
ensure_object, is_datetime_or_timedelta_dtype, is_decimal, is_number,
is_numeric_dtype, is_scalar)
from pandas.core.dtypes.generic import ABCIndexClass, ABCSeries... |
# encoding:utf-8
"""
@Time : 2020-02-12 18:24
@Author : yshhuang@foxmail.com
@File : trace.py
@Software: PyCharm
"""
import torch
import torchvision
# An instance of your model.
model = torchvision.models.resnet18()
# An example input you would normally provide to your model's forward() method.
example = torc... |
# let's write a script that tells us the most common character in
# adventures of sherlock holmes.
with open("english/adventures_of_sherlock_holmes.txt", 'r', encoding="utf8") as rf:
text = rf.read().lower()
# tokenize the text into words
words = text.split(" ")
print(words[100:110])
unique_word = set(wo... |
import sys, os, time
from subprocess import Popen, list2cmdline
def cpu_count():
''' Returns the number of CPUs in the system
'''
num = 1
if sys.platform == 'win32':
try:
num = int(os.environ['NUMBER_OF_PROCESSORS'])
except (ValueError, KeyError):
pass
elif s... |
"""
WSGI config for ProyectoHuevos 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/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANG... |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 3 16:07:03 2014
@author: juanma
"""
from .FuzzyVars import *
from scipy.optimize import fmin_slsqp
from numpy import percentile, array, diff
def optimize_partition(FClass, Variable, VarName, terms):
'''Optimize the partition of a variable to reduce the ambiguity in... |
# Copyright (c) 2012 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.
{
'variables': {
'cc_source_files': [
'animation.cc',
'animation.h',
'animation_curve.cc',
'animation_curve.h',
'anim... |
class Switch(object):
def __init__(self, session):
super(Switch, self).__init__()
self._session = session
def getDeviceSwitchPorts(self, serial: str):
"""
**List the switch ports for a switch**
https://developer.cisco.com/meraki/api-v1/#!get-device-switch-ports... |
import asyncio
import time
import socketio
loop = asyncio.get_event_loop()
sio = socketio.AsyncClient()
start_timer = None
async def send_ping():
global start_timer
start_timer = time.time()
await sio.emit('ping_from_client')
@sio.event
async def connect():
print('connected to server')
await se... |
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, World! Poovannan :)"
|
# -*- test-case-name: twisted.internet.test.test_core -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
A reactor for integrating with U{CFRunLoop<http://bit.ly/cfrunloop>}, the
CoreFoundation main loop used by macOS.
This is useful for integrating Twisted with U{PyObjC<http://pyobjc.sf.... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... |
"""
MenuController [DiamondQuest]
Controller for Menu.
Author(s): Harley Davis, Jason C. McDonald, Stanislav Schmidt
"""
# LICENSE (BSD-3-Clause)
# Copyright (c) 2020 MousePaw Media.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided t... |
# -*- coding: utf-8 -*-
"""
author: jiangxf
date: 2020-01-29
description: 数据库连接中心
"""
import pymysql
def connect_mysql(host, port, user, password, database):
return pymysql.connect(host=host, port=port, user=user, password=password, database=database, ssl=None)
def connect_short(keyname):
if keyname == "te... |
from util.primitives import dictdiff
import cPickle
from traceback import print_exc
from base64 import b64encode
def uname_str(name):
if isinstance(name, unicode):
return name.encode('utf8')
else:
assert isinstance(name, str)
return str(name)
def password_str(password):
... |
# Breakthrough/PySceneDetect
from __future__ import print_function
import os
import scenedetect
from scenedetect.video_manager import VideoManager
from scenedetect.scene_manager import SceneManager
from scenedetect.frame_timecode import FrameTimecode
from scenedetect.stats_manager import StatsManager
from scenedetect.d... |
"""Load all the files in this directory as modules.
http://stackoverflow.com/questions/1057431/loading-all-modules-in-a-folder-in-python
"""
import os
for module in os.listdir(os.path.dirname(__file__)):
if module == '__init__.py' or module[-3:] != '.py':
continue
__import__(module[:-3], locals(), glo... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables
class Functi... |
from datetime import date
from time import sleep
import unittest
from app import create_app, db
from app.models import User
class UserModelTest(unittest.TestCase):
def setUp(self):
self.app = create_app("testing")
self.app_context = self.app.app_context()
self.app_context.push()
d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=35
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for... |
import asyncio
import os
import sys
import toga
from rubicon.objc.eventloop import EventLoopPolicy, CocoaLifecycle
from .libs import *
from .window import Window
class MainWindow(Window):
def on_close(self):
self.interface.app.exit()
class AppDelegate(NSObject):
@objc_method
def applicationDid... |
from unittest import TestCase
from tests import abspath
from pytezos.repl.interpreter import Interpreter
from pytezos.michelson.converter import michelson_to_micheline
from pytezos.repl.parser import parse_expression
class OpcodeTestmap_map_112(TestCase):
def setUp(self):
self.maxDiff = None
se... |
from agents.dqn_agent import DQNAgent
from estimators import get_estimator as get_model
from policy_evaluation import CategoricalPolicyEvaluation
from policy_improvement import CategoricalPolicyImprovement
class CategoricalDQNAgent(DQNAgent):
def __init__(self, action_space, cmdl):
DQNAgent.__init__(self,... |
import numpy as np
from config import Config
from data import BALANCE_WEIGHTS
from layers import *
cnf = {
'name': __name__.split('.')[-1],
'w': 112,
'h': 112,
'train_dir': 'data/train_tiny',
'test_dir': 'data/test_tiny',
'batch_size_train': 128,
'batch_size_test': 128,
'balance_weight... |
import json
from bs4 import BeautifulSoup
from logger import parser
from db.models import WeiboDialogue
from decorators import parse_decorator
from .comment import get_html_cont
@parse_decorator([])
def get_comment_id(html, wb_id):
"""
获取评论列表
:param html:
:param wb_id:
:return:
"""
cont ... |
# https://deeplearningcourses.com/c/deep-learning-prerequisites-the-numpy-stack-in-python
# https://www.udemy.com/deep-learning-prerequisites-the-numpy-stack-in-python
from __future__ import print_function, division
from future.utils import iteritems
from builtins import range, input
# Note: you may need to update you... |
from cached_property import cached_property
from torch import Tensor
from fancy import config as cfg
from . import ImporterConfig
class LossFunctionConfig(ImporterConfig):
param: dict = cfg.Option(default={}, type=cfg.process.flag_container)
@cached_property
def loss_func(self):
if isinstance(se... |
# --------------------------------------------
# Main part of the plugin
# Defines the VariablesPlugin class
#
# Laurent Franceschetti (c) 2018
# MIT License
# --------------------------------------------
import os
import traceback
from copy import copy
import importlib
import yaml
from jinja2 import (Environment, F... |
from sqlalchemy import Column, String, Integer, TIMESTAMP
from models.Model import Model
class LogDetail(Model):
__tablename__ = 'log_details'
__table_args__ = {"schema": "ufapi"}
log_details_id = Column(Integer, primary_key=True, nullable=False, autoincrement=True)
user_name = Column(String(511))
... |
"""Tests for aiohttp/worker.py"""
import asyncio
import pytest
from unittest import mock
base_worker = pytest.importorskip('aiohttp.worker')
class MyWorker(base_worker.GunicornWebWorker):
def __init__(self):
self.servers = []
self.exit_code = 0
self.cfg = mock.Mock()
self.cfg.gr... |
"""
seamm_datastore
The database models for the seamm datastore
"""
# Imports - alias class to "connect".
from .connect import session_scope # noqa: F401
from .connect import SEAMMDatastore as connect # noqa: F401
__all__ = ["connect"]
# Handle versioneer
from ._version import get_versions
versions = get_versions... |
import os
import sys
import time
import math
import argparse
import subprocess
import numpy as np
np.set_printoptions(precision=2, linewidth=160)
# MPI
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
from wann_src import * # WANN evolution
from domain import * # Task environments
# -- Run NE ... |
#Copyright 2017 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 by applicable law or agree... |
from argparse import ArgumentParser
from typing import Tuple
from warnings import warn
import torch
import torch.nn as nn
from torch import Tensor
from lasaft.data.musdb_wrapper import SingleTrackSet
from lasaft.source_separation.conditioned.separation_framework import Spectrogram_based
from lasaft.utils.functions im... |
from sklearn.datasets import make_blobs
def create_data():
# Define datasets
# Example settings
n_samples = 300
outliers_fraction = 0.15
n_outliers = int(outliers_fraction * n_samples)
n_inliers = n_samples - n_outliers
blobs_params = dict(random_state=0, n_samples=n_inliers, n_features=2)... |
#!/usr/bin/env python3
# Copyright (c) 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.
"""Class for namecoind node under test"""
import decimal
import errno
import http.client
import json
import lo... |
# Copyright 2021 The Tekton 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 wr... |
### MDP Value Iteration and Policy Iteratoin
# You might not need to use all parameters
import numpy as np
import gym
import time
from test_env import *
import os
np.set_printoptions(precision=3)
def BellmanOp(P, V, state, action, gamma):
"""Represent R(s,a) + gamma * sum(p(s'|(s,a)) * V(s'))
Notice that R(... |
#!/usr/bin/env python3
import pytest
from distracticat import chooser
def test_simple():
choices, feedback = chooser.parse_choices("this or that?")
assert choices == ["this", "that"]
assert feedback is None
def test_surrounding_whitespace():
choices, feedback = chooser.parse_choices(" this or that... |
import pandas as pd
import numpy as np
def mean_absolute_deviation(s1, s2):
if len(s1) != len(s2):
return np.nan
return np.abs(s1 - s2).mean()
def nan_matching(s1, s2):
if len(s1) != len(s2):
return False
flag = True
for i, j in zip(s1, s2):
if pd.isnull(i) == pd.isnull(j... |
import os
import torch
from copy import deepcopy
from src.agents.agents import *
from src.utils.setup import process_config, _process_config
from src.utils.utils import load_json
def run(config_path, ir_checkpoint_dir=None):
config = process_config(config_path)
AgentClass = globals()[config.agent]
agent =... |
#We know for a permutation palindrome that if we have an even number of appearnces of the letters with at most one letter having a odd apperance this is a valid permutation palindrome
def permutationpalindrome(word):
checker = {}
for i in word.strip().lower():
if i.isalpha():
if i not i... |
"""Utilities to get a password and/or the current user name.
getpass(prompt) - prompt for a password, with echo turned off
getuser() - get the user name from the environment or password database
On Windows, the msvcrt module will be used.
On the Mac EasyDialogs.AskPassword is used, if available.
"""
# From CPython ... |
"""Kernels for Gaussian process regression and classification.
The kernels in this module allow kernel-engineering, i.e., they can be
combined via the "+" and "*" operators or be exponentiated with a scalar
via "**". These sum and product expressions can also contain scalar values,
which are automatically converted to... |
# _*_ coding: utf-8 _*_
import logging
import aiohttp
import asyncio
import traceback
from aiohttp_sse_client import client as aio_sse_client
from .http.request import Request
from .http.response import Response
from .middleware import DownloaderMiddlewareManager
logger = logging.getLogger(__name__)
class Downloade... |
"""
Copyright (C) 2018-2020 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 law or agreed to i... |
"""
The :mod:`sklearn.kernel_approximation` module implements several
approximate kernel feature maps base on Fourier transforms.
"""
# Author: Andreas Mueller <amueller@ais.uni-bonn.de>
#
# License: BSD 3 clause
import warnings
import numpy as np
import scipy.sparse as sp
from scipy.linalg import svd
from .base im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
from typing import Optional
from funfact.lang._ast import _AST, _ASNode, Primitives as P
from funfact.lang._terminal import AbstractIndex, AbstractTensor, LiteralValue
from ._base import _deep_apply, TranscribeInterpreter
class SlicingPropagator():
'''The ... |
from lib.base import CheckBase
class CheckRolesAreListedBeforeRoleBindings(CheckBase):
whitelist = ['List']
enable_parameter = 'rbac'
description = 'check that Roles are listed before RoleBindings'
default_enabled = False
def check_roles_before_rolebindings(self, m):
msg = 'RoleBinding "{... |
# -*- coding: utf-8 -*-
"""
flaskext.uploads
================
This module provides upload support for Flask. The basic pattern is to set up
an `UploadSet` object and upload your files to it.
:copyright: 2010 Matthew "LeafStorm" Frazier
:license: MIT/X11, see LICENSE for details
"""
import sys
PY3 = sys.version_inf... |
from datamart.utilities.utils import Utils
import unittest, os, json
from datamart.materializers.materializer_base import MaterializerBase
from datamart.materializers.noaa_materializer import NoaaMaterializer
import pandas as pd
from pandas.util.testing import assert_frame_equal
class TestUtils(unittest.TestCase):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Define the Model abstract class from which all learning models inherit from.
Dependencies: None
"""
from abc import ABCMeta, abstractmethod
import copy
import numpy as np
__author__ = "Brian Delhaisse"
__copyright__ = "Copyright 2018, PyRoboLearn"
__credits__ = ["Bria... |
# Module doctest.
# Released to the public domain 16-Jan-2001, by Tim Peters (tim@python.org).
# Major enhancements and refactoring by:
# Jim Fulton
# Edward Loper
# Provided as-is; use at your own risk; no warranty; no promises; enjoy!
r"""Module doctest -- a framework for running examples in docstrings.
In... |
"""
Copyright (c) 2022 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 law or agreed to in writin... |
# Copyright 2013-2019 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 *
import sys
import os
class Boost(Package):
"""Boost provides free peer-reviewed portable C++ sou... |
import unittest
import numpy as np
import colorednoise
from itertools import product
import eeglib.features as features
#Supress warnings
import warnings
warnings.filterwarnings("ignore")
class TestDFA(unittest.TestCase):
n_tests = 100
n_points = 1000
def test_white_noise(self):
results =... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import json
from google.protobuf.struct_pb2 import ListValue
from flask import Flask, Blueprint, request
import numpy as np
from .proto import prediction_pb2
class SeldonMicroserviceException(Exception):
status_code = 400
... |
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
# the next line can be removed after installation
sys.path.insert(0, os.path.dirname(os.path.dirname(
os.path.dirname(os.path.abspath(__file__)))))
from veriloggen import *
import veriloggen.thread as vthread
import ... |
#!/usr/bin/python3
import sys
import time
import math
import struct
import signal
import resource
import ctypes as ct
import multiprocessing
from bcc import BPF
bpf_text = '''
#include <linux/sched.h>
#include <linux/net.h>
#include <uapi/linux/un.h>
#include <net/af_unix.h>
#define SS_MAX_SEG_SIZE __SS_MAX_SEG_... |
from abc import ABCMeta
import numpy as np
from six.moves import xrange
import warnings
import collections
import cleverhans.utils as utils
from cleverhans.model import Model, CallableModelWrapper
_logger = utils.create_logger("cleverhans.attacks")
class Attack(object):
"""
Abstract base class for all atta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.