text stringlengths 1 927k |
|---|
import numpy as np
from numba import njit as jit
@jit
def _kepler_equation(E, M, ecc):
return E_to_M(E, ecc) - M
@jit
def _kepler_equation_prime(E, M, ecc):
return 1 - ecc * np.cos(E)
@jit
def _kepler_equation_hyper(F, M, ecc):
return F_to_M(F, ecc) - M
@jit
def _kepler_equation_prime_hyper(F, M, ec... |
import os
# Given a relative path, the full path is returned
def get_full_path(rel_path):
cur_dir = os.path.dirname(os.path.realpath(__file__))
return os.path.join(cur_dir, rel_path)
# ============================================================
# Constants that actually need to be changed.
# Be sure to... |
# Generated by Django 2.2.12 on 2020-06-05 15:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('employee', '0002_auto_20200605_2224'),
]
operations = [
migrations.AddField(
model_name='profile',
name='img_profil... |
import toto
import zmq
import cPickle as pickle
import zlib
import logging
from threading import Thread
from tornado.options import options
from tornado.gen import Task
from collections import deque
from zmq.eventloop.ioloop import ZMQPoller, IOLoop, PeriodicCallback
from zmq.eventloop.zmqstream import ZMQStream
from t... |
import cv2
import torch
from Services.NeuralNetwork.tool.torch_utils import do_detect
from Services.NeuralNetwork.tool.darknet2pytorch import Darknet
class NeuralNetwork:
@staticmethod
def isCudaAvailable() -> bool:
return torch.cuda.is_available()
@staticmethod
def getAvailableCalculationDev... |
from setuptools import setup, find_packages
version = '0.1'
install_requires = [
'numpy',
'tensorflow',
'keras'
]
dev_requires = [
'elpy',
'jedi',
'rope',
'yapf'
]
tests_requires = [
]
setup(
name='lelantos',
version=version,
description="A deep learning attempt at splitting... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from collections import defaultdict
import json
from odoo.tests.common import TransactionCase, users, warmup
from odoo.tools import pycompat
class TestPerformance(TransactionCase):
@users('__system__', 'demo')
... |
###############################################################################
# Way to use this:
# cmsRun testHGCalWaferValidation_cfg.py geometry=D83
#
# Options for geometry D77, D82, D83, D88, D92
#
###############################################################################
import FWCore.ParameterSet.Confi... |
from django.db import models
from imagekit.models import ProcessedImageField
class Titleable(models.Model):
title = models.CharField(
verbose_name='Название',
max_length=200
)
class Meta:
abstract = True
class Textable(models.Model):
text = models.TextField(
verbose_... |
"""Project models."""
import fnmatch
import logging
import os
import re
from shlex import quote
from urllib.parse import urlparse
from allauth.socialaccount.providers import registry as allauth_registry
from django.conf import settings
from django.conf.urls import include
from django.contrib.auth.models import User
f... |
# Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
#
# 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... |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import uuid
from django.contrib.sites.models import Site
from django.core.management import CommandError
from cms.models import Page, StaticPlaceholder
from django.core import management
from cms.test_utils.fixtures.navextenders import NavextendersFixture
f... |
from catstrace.events.base_event import Event, EventType
import simplejson as json
import codecs
class DiskEvent(Event):
def __init__(self, timestamp, host, pid, filename, fd):
self._fd = fd
if (fd == 0): self._filename = "STDIN"
elif (fd == 1): self._filename = "STDOUT"
elif (fd == 2): self._filename = "STD... |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 22 11:21:01 2017
@author: Zlatko
"""
from pyEPR import *
if 0:
# Specify the HFSS project to be analyzed
project_info = Project_Info(r"X:\Simulation\\hfss\\KC\\")
project_info.project_name = '2013-12-03_9GHzCavity' # Name of the project file (string). "Non... |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, publish... |
# Generated by Django 2.0.5 on 2018-06-14 02:39
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('imag... |
import torch.nn as nn
from fairseq import utils
from fairseq.models import FairseqEncoder
class SimpleLSTMEncoder(FairseqEncoder):
def __init__(
self, args, dictionary, embed_dim=128, hidden_dim=128, dropout=0.1,
):
super().__init__(dictionary)
self.args = args
# Our encoder w... |
"""test unit for utils/data_iterator.py"""
import runtime_path # isort:skip
import numpy as np
from utils.data_iterator import BatchIterator
def test_batch_iterator():
batch_size = 10
n_data = 10 * batch_size # 10 batches
iterator = BatchIterator(batch_size=batch_size)
x_dim, y_dim = 10, 5
fa... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import fractions
from wolframclient.utils.dispatch import Dispatch
encoder = Dispatch()
@encoder.dispatch(fractions.Fraction)
def encode_faction(serializer, o):
return serializer.serialize_fraction(o) |
import os
import json
from typing import Dict, Tuple
from flask import current_app
from google.cloud import storage, kms_v1
from google.cloud.kms_v1 import enums
from google.cloud.kms_v1.types import CryptoKey
from google.api_core.exceptions import NotFound, FailedPrecondition
key_client = kms_v1.KeyManagementServic... |
# -*- coding: utf-8 -*-
"""
Parse and analyse orbital conjunctions' data.
Created on Wed Apr 23 15:12:47 2014
TO be used to analyse one on all data for Envisat and compare those to STK CAT results.
@author: Aleksander Lidtke
@version 1.0.0
@since 22/05/2014 15:42:00
CHANGELOG:
"""
import datetime, pylab, scipy.integ... |
#!/usr/bin/python
'''Creates a folder containing text files of Cocoa keywords.'''
import os, commands, re
from sys import argv
def find(searchpath, ext):
'''Mimics the "find searchpath -name *.ext" unix command.'''
results = []
for path, dirs, files in os.walk(searchpath):
for filename in files:
... |
import logging
import os
from collections import OrderedDict
import torch
import torch.nn as nn
from torch.nn.parallel import DistributedDataParallel
logger = logging.getLogger('base')
class BaseSolver:
def __init__(self, opt):
self.opt = opt
if opt['gpu_id'] is not None and torch.cuda.is_availabl... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.17
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... |
'''
Primary Author: Will LeVine
Email: levinewill@icloud.com
'''
from sklearn.base import clone
import numpy as np
from joblib import Parallel, delayed
class LifeLongDNN():
def __init__(self, acorn = None, verbose = False, model = "uf", parallel = True, n_jobs = None):
self.X_across_tasks = []
... |
# This file is part of CycloneDX Python module.
#
# 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 agr... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/bigtable/v2/data.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import refl... |
from synapse_pay_rest.http_client import HttpClient
class Subnets():
"""Abstraction of the /subnets endpoint.
Used to make subnets-related calls to the API.
https://docs.synapsepay.com/docs/subnets
"""
def __init__(self, client):
self.client = client
def create_subnet_path(self, use... |
#!/usr/bin/env python
#
# Electrum - Lightweight Bitcoin Client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... |
from __future__ import absolute_import
import six
from django.db.models import Q
from sentry.api.base import Endpoint
from sentry.api.paginator import DateTimePaginator
from sentry.api.permissions import SuperuserPermission
from sentry.api.serializers import serialize
from sentry.db.models.query import in_iexact
fro... |
"""A sample GUI."""
from tkinter import *
from tkinter.ttk import * # type: ignore
import log
class Application:
"""A sample class."""
def __init__(self):
log.info("Starting the application...")
# Configure the root window
self.root = Tk()
self.root.title("Feet to Meters")... |
""" PyTorch EfficientNet Family
An implementation of EfficienNet that covers variety of related models with efficient architectures:
* EfficientNet (B0-B8, L2 + Tensorflow pretrained AutoAug/RandAug/AdvProp/NoisyStudent weight ports)
- EfficientNet: Rethinking Model Scaling for CNNs - https://arxiv.org/abs/1905.119... |
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
import re # noq... |
from __future__ import print_function
import os
import glob
from time import sleep
import blocktrail
while True:
try:
client = blocktrail.APIClient(api_key="731ac7a92afe05e7640b3e89d69ecce514d3ea1d", api_secret="cb816f06d9722244f7489deb71cc65c43b97bccd", network="BTC", testnet=False)
# address =... |
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or ... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: yandex/cloud/mdb/redis/v1/maintenance.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _... |
# File: netskope_connector.py
#
# Copyright (c) 2018-2022 Splunk 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/LICENSE-2.0
#
# Unless required by... |
from ._util import get_app_id, create_app, get_app_info
from ._constants import *
def get_id(c):
"""
Find app-id by project name. Add id to config.
"""
app_name = c.config.project.name
app_id = get_app_id(c, app_name)
if not isinstance(app_id, str):
return app_id
c.config.data.app... |
#!/usr/bin/python3
import re
import sys
import os
# Función que genera el MAP de un proceso:
def map(pid):
try:
# Se abre el archivo /proc/pid/maps para obtener la informacion del proceso
with open('/proc/' + pid + '/maps' , 'r') as file:
buffer = [] # Arreglo donde se almacenara cada ... |
from flask_restx import Namespace
# This is the index of which models are available per user
api_ns_geomodels = Namespace('geomodels',
description='This is the logic that manage the '
'different model stored in the server.'
... |
# 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 ... |
#!/usr/bin/env python
# encoding: utf-8
from flask import Blueprint
route_mqtt = Blueprint( 'mqtt_page',__name__ )
from app.views.mqttc.Client import *
@route_mqtt.route("/")
def index():
return "mqtt v1.0" |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... |
# 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 logging, sys
if __name__ == '__main__':
if len(sys.argv) < 2:
print('Please provide logging file name as argument')
sys.exit(1)
logging_file = sys.argv[1]
logging.basicConfig(level=logging.INFO, filename=logging_file,
format='%(asctime)s %(name)s %(levelname)... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import sys
sys.path.append('../')
from nnplot.pycore.tikzeng import *
from nnplot.pycore.blocks import *
arch = [
to_head('..'),
to_cor(),
to_begin(),
#input
to_input( 'examples/fcn8s/cats.jpg' ),
#block-001
to_ConvConvRelu( name='ccr_b1', s_filer=500, n_filer=(64,64), offset="(0,0... |
from urllib.parse import urlparse
from requests import post
def Shortner(big_url: str) -> str:
"""
Function short the big urls to short
"""
return post(f"https://is.gd/create.php?format=json&url={big_url}").json()[
"shorturl"
]
def MaskUrl(target_url: str, mask_domain: str, keyword: str... |
# --------------
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
# Code starts here
df=pd.read_csv(path)
#print(df.head())
#print(df.info)
df['INCOME'] = df['INCOME'].str.replace('$','')
df['INCOME'] = df['INCOME'].str.rep... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import autoslug.fields
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
('taggit', '0001_initial'),
]
operations = [
migrations.CreateModel(
... |
from zycelium.ansiformat import AnsiFormat
af = AnsiFormat()
print(af("Bold").bold)
print(af("Dim").dim)
print(af("Italic").italic)
print(af("Underline").underline)
print(af("Blink").blink)
print(af("Inverse").inverse)
print(af("Hidden").hidden)
print(af("Strike").strike) |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""
This module implements loading meshes from glTF 2 assets stored in a
GLB container file or a glTF JSON file ... |
"""
desispec.fluxcalibration
========================
Flux calibration routines.
"""
from __future__ import absolute_import
import numpy as np
from .resolution import Resolution
from .linalg import cholesky_solve, cholesky_solve_and_invert, spline_fit
from .interpolation import resample_flux
from desiutil.log import g... |
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
from django.shortcuts import render,reverse,redirect
from django.http import HttpResponse
from django.contrib.auth import authenticate, login, logout
from django.db.models imp... |
#!/usr/bin/env python
# -*- mode: python; encoding: utf-8 -*-
"""Test the hunt_view interface."""
import traceback
from grr.gui import runtests_test
from grr.lib import aff4
from grr.lib import flags
from grr.lib import flow
from grr.lib import hunts
from grr.lib import rdfvalue
from grr.lib import test_lib
cla... |
import os
from surfer import Brain, io
subj_id = 'Bend1'
subjects_dir = "/media/BlackBook_/ERIKPETDTIFMRI/ComaSample/subjects"
os.environ['SUBJECTS_DIR'] = subjects_dir
brain = Brain(subj_id, "lh", "pial", subjects_dir=subjects_dir,
config_opts=dict(background="white"))
"""Project the volume file and r... |
import argparse
from pathlib import Path
import torch
import torch.nn as nn
from PIL import Image
from torchvision import transforms
from torchvision.utils import save_image
import numpy as np
import math
import time
import net
from function import adaptive_instance_normalization, coral
# Example code:
# python Meta... |
from random import random, choice, uniform, betavariate
from math import log, exp, expm1
class Bandit(object):
"""The primary bandit interface. Don't use this unless you really
want uniform random arm selection (which defeats the whole purpose, really)
Used as a control to test against and as an interfac... |
# -*- coding: utf-8 -*-
"""
951. Flip Equivalent Binary Trees
For a binary tree T, we can define a flip operation as follows:
choose any node, and swap the left and right child subtrees.
A binary tree X is flip equivalent to a binary tree Y if and only if we can make X equal to Y
after some number of flip operations.... |
# Exercise 2.5: Write a program which prompts the user for a Celsius temperature,
# convert the temperature to Fahrenheit, and print out the converted temperature.
# Python for Everybody: Exploring Data Using Python 3
# by Charles R. Severance
celsius_temperature = float(input("Enter Celsius temperature: "))
fahrenh... |
import boto
from pyftpdlib.authorizers import DummyAuthorizer, AuthenticationFailed
class S3Authorizer(DummyAuthorizer):
def __init__(self, *args, **kwargs):
DummyAuthorizer.__init__(self, *args, **kwargs)
self.conn = None
def validate_authentication(self, aws_access_key_id, aws_secret_access_... |
BEST_CONFIGS = {
"node_classification": {
"chebyshev": {"general": {}},
"dropedge_gcn": {"general": {}},
"gat": {
"general": {"lr": 0.005, "max_epoch": 1000},
"citeseer": {"weight_decay": 0.001},
"pubmed": {"weight_decay": 0.001},
"ppi-large": ... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 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 bitcoind with different proxy configuration.
Test plan:
- Start bitcoind's with different proxy c... |
"""
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import pytest
import salt.states.ssh_auth as ssh_auth
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {ssh_auth: {}}
def test_present():
"""
Test to verifies that the specified SSH key
... |
import pytest
from fontbakery.utils import TEST_FILE
from fontbakery.checkrunner import (
DEBUG
, INFO
, WARN
, ERROR
, SKIP
, PASS
, FAIL
)
check_statuses = (ERROR, FAIL, SKIP, PASS, WARN, INFO, DEBUG)
from fontTools.t... |
#!/usr/bin/env python3
"""Zeff record config generator for HousePrice records."""
import logging
import urllib.parse
import csv
LOGGER = logging.getLogger("zeffclient.record.generator")
def HousePriceRecordGenerator(arg: str):
"""Return house primary key value."""
with open(arg, "r") as csvfile:
for ... |
import unittest
import numpy as np
from op_test import OpTest
class TestFTRLOp(OpTest):
def setUp(self):
self.op_type = "ftrl"
w = np.random.random((102, 105)).astype("float32")
g = np.random.random((102, 105)).astype("float32")
sq_accum = np.full((102, 105), 0.1).astype("float32")... |
from mycloud.drive.filesync.downsync import downsync_file, downsync_folder
from mycloud.drive.filesync.tree import RelativeFileTree
from mycloud.drive.filesync.upsync import upsync_file, upsync_folder |
"""
Export events for use in the Besa pipeline.
Use :func:`meg160_triggers` to export a trigger list for MEG160, then reject
unwanted events, and finally use :func:`besa_evt` to export a corresponding
``.evt`` file.
"""
import numpy as np
from .._data_obj import Var, Dataset
from .._utils import ui
from . import _tx... |
# 279. Perfect Squares
# https://leetcode.com/problems/perfect-squares
import unittest
class Solution(object):
def numSquares(self, n):
if n < 2:
return n
squares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)]
queue, depth = {n}, 1
while queue:
next_nodes =... |
class Task:
@testcases
def solveOne(self):
pass
if __name__ == '__main__':
task = Task()
task.solveOne() |
import FWCore.ParameterSet.Config as cms
import copy
from Configuration.Eras.Modifier_phase2_common_cff import phase2_common
'''
Sequences for HPS taus
'''
## Discriminator sources
from RecoTauTag.RecoTau.PFRecoTauDiscriminationByIsolation_cfi import *
from RecoTauTag.RecoTau.PFRecoTauDiscrimin... |
"""
Tensorflow GAN model
"""
import os
from pathlib import Path
import tensorflow as tf
DIRECTORY = Path('network')
DATA = Path('data')
IMAGE_LIST = DATA / 'images.txt'
ART_LIST = DATA / 'art.txt'
ART_BLACK_LIST = DATA / 'art_black.txt'
ART_GREEN_LIST = DATA / 'art_green.txt'
ART_WHITE_LIST = DATA / 'art_white.txt... |
# -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
import shutil
import threading
import time
import logging
# Import Salt Testing Libs
from tests.support.case import SSHCase
from tests.support.helpers import flaky
from tests.support.paths i... |
import tensorflow as tf
import numpy as np
from tensorflow.contrib import rnn
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
learning_rate = 0.001
training_iters = 100000
batch_size = 128
display_step = 10
n_input = 28
n_steps = 28
n_hidden ... |
import numpy as np
# Mini Dataset
input_data = np.array([5, 7, 8, 1])
weights = {'node0': np.array([1, 1]),
'node1': np.array([-1, 1]),
'output': np.array([2, -1])}
# Activation Function
def ReLu(x):
out = max(0, x)
return out
def predict_with_NN(input_data_row, weights):
print("... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.12.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... |
import argparse
from tools import Scanner
def main():
# Init parser
parser = argparse.ArgumentParser(usage='%(prog)s [options]', description='Basic port scanner with cmd line handler')
# Add arguments
parser.add_argument('-t', '--target', type=str, default='w3c.com',
help='Set ... |
# -*- coding: utf-8 -*-
from profiling.viewer import fmt
def test_fmt():
assert fmt.markup_percent(1.00) == ('danger', '100')
assert fmt.markup_percent(0.80) == ('caution', '80.0')
assert fmt.markup_percent(0.50) == ('warning', '50.0')
assert fmt.markup_percent(0.20) == ('notice', '20.0')
assert f... |
#!/usr/bin/env python3
import sys
from binascii import hexlify
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import padding
msg = sys.argv[1].encode()
with open("/tmp/gdgsnf.pub", "rb") as key_... |
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('', include('website.urls')),
path('admin/', admin.site.urls),
] |
"""
Set up defaults and read sentinel.conf
"""
import sys
import os
from sov_config import SovereignConfig
default_sentinel_config = os.path.normpath(
os.path.join(os.path.dirname(__file__), '../sentinel.conf')
)
sentinel_config_file = os.environ.get('SENTINEL_CONFIG', default_sentinel_config)
sentinel_cfg = S... |
# Copyright 2019 The Kubeflow 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... |
import json
import os
import logging
from os.path import join, normpath
from django.core.cache import cache
from django.conf import settings
from datetime import datetime, timedelta
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from biostar.accounts.models import Profile, Us... |
# Copyright (c) 2006-2011, 2013-2014 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
# Copyright (c) 2013-2014 Google, Inc.
# Copyright (c) 2014-2016 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2015-2016 Cara Vinson <ceridwenv@gmail.com>
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/l... |
RECOMMENDED_FEE = 50000
COINBASE_MATURITY = 100
COIN = 100000000
# supported types of transaction outputs
TYPE_ADDRESS = 1
TYPE_PUBKEY = 2
TYPE_SCRIPT = 4
TYPE_CLAIM = 8
TYPE_SUPPORT = 16
TYPE_UPDATE = 32
# claim related constants
EXPIRATION_BLOCKS = 262974
RECOMMENDED_CLAIMTRIE_HASH_CONFIRMS = 1
NO_SIGNATURE = 'ff'... |
########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... |
import unittest
from main.maincontroller import MainController
import ocsp_responder
class XroadDeleteOcspResponder(unittest.TestCase):
"""
TRUST_11 Delete an OCSP Responder of a CA
RIA URL: https://jira.ria.ee/browse/XT-437, https://jira.ria.ee/browse/XTKB-67
Depends on finishing other test(s): Xroad... |
# encoding: utf-8
from flask import Flask
from flask_restful import Resource, Api
from flask_restful import reqparse
import cPickle as pickle
from keras.preprocessing import sequence
from keras.preprocessing.text import Tokenizer
from utils import load_production_model
app = Flask(__name__)
api = Api(app)
with open... |
# Copyright (C) 2020-2021 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... |
import easydict
import os
import time
import re
import warnings
from selenium import webdriver
from others.logging import init_logger
from train_abstractive import validate_abs, train_abs, baseline, test_abs, test_text_abs
from train_extractive import train_ext, validate_ext, test_ext, test_text_ext
url = "https://ed... |
from unittest.mock import patch
from rest_framework import status
from posthog.models import FeatureFlag, User
from .base import APIBaseTest, TransactionBaseTest
class TestFeatureFlag(TransactionBaseTest):
TESTS_API = True
def test_key_exists(self):
feature_flag = self.client.post(
"/a... |
import tensorflow as tf
class MockModel(tf.keras.Model):
"""
A Mock keras model to test basic tester functionality.
This model only has one variable: a weight matrix of shape 2x1.
This model accepts 2-dimensional input data and outputs 1-d data
"""
def __init__(self):
super(MockModel, ... |
"""
Tests adapted and expanded from:
https://github.com/benediktschmitt/py-filelock/blob
/b30bdc4fb998f5f4350257235eb51147f9e81862/test.py
"""
import gc
from pathlib import Path
from itertools import repeat, chain
from concurrent.futures import ThreadPoolExecutor
import pytest
from aiuti.filelock import FileLock
fro... |
import _plotly_utils.basevalidators
class EnabledValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self,
plotly_name="enabled",
parent_name="layout.coloraxis.colorbar.tickformatstop",
**kwargs
):
super(EnabledValidator, self).__init__(
... |
_base_ = './mask_rcnn_r50_fpn_sample1e-3_mstrain_1x_lvis_v1.py'
model = dict(
pretrained='open-mmlab://resnext101_64x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=64,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
no... |
#!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 10.03.2019 22:00
:Licence MIT
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import Grammar
class TempClass:
pass
class TerminalAddingTest(TestCase):
def test_haveTermEmpty(self):
gr = Grammar()
self.assertNot... |
# coding:utf-8
#
import math
import numpy as np
from scipy import stats
import matplotlib as mpl
from matplotlib import cm
import matplotlib.pyplot as plt
def calc_statistics(x):
# 使用系统函数验证
mu = np.mean(x, axis=0)
sigma = np.std(x, axis=0)
skew = stats.skew(x)
kurtosis = stats.kurtosis(x)
retu... |
import pandas as pd
import matplotlib.pyplot as plt
dataframe = pd.read_csv('data/problem1data.txt', header=None)
datasetClass0 = dataframe.loc[dataframe[2] == 0]
datasetClass1 = dataframe.loc[dataframe[2] == 1]
figure = plt.figure()
axis = figure.add_subplot(111)
axis.scatter(datasetClass0[0], datasetClass0[1], mark... |
from typing import Callable, Sequence, Optional, TypeVar, Any
T = TypeVar("T")
def first(predicate: Callable[[Optional[T]], Any], sequence: Sequence[T]) -> Optional[T]:
return next(filter(predicate, sequence), None) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.