text stringlengths 1 927k |
|---|
from facenet_pytorch import InceptionResnetV1
from torchvision.models import inception_v3
def create_evaluator(model_name: str):
model_dict = {
"default": (lambda: (inception_v3(pretrained=True, aux_logits=False).eval(), 299, 1000)),
"vggface2": (lambda: (InceptionResnetV1(pretrained="vggface2", c... |
## Added by Brian Blaylock
## September 30, 2021
"""
! Experimental
This is a special case template for GRIB2 model data that is stored on
your local machine rather than retrieving data from remote sources.
Index files are assumed to be in the same directory as the file with
".idx" appended to the file name. If you d... |
def day22_part1(instructions):
grid = {}
for instruction in instructions:
if instruction["x_from"] < -50 or instruction["x_to"] > 50 \
or instruction["y_from"] < -50 or instruction["y_to"] > 50 \
or instruction["z_from"] < -50 or instruction["z_to"] > 50:
cont... |
from load import ROOT as R
import numpy as N
from gna.env import env, namespace
from collections import OrderedDict
from mpl_tools.root2numpy import get_buffer_hist1, get_bin_edges_axis
from gna.constructors import Histogram
from gna.configurator import NestedDict
from gna.grouping import Categories
from gna.bundle im... |
from distutils import log, dir_util
import os
from setuptools.extern.six.moves import map
from setuptools import Command
from setuptools.archive_util import unpack_archive
import pkg_resources
class install_egg_info(Command):
"""Install an .egg-info directory for the package"""
description = "Install an .e... |
#!/usr/bin/env python
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. ... |
"""
Tests for the pure dephasing analytical computations.
"""
import numpy as np
from numpy.testing import (run_module_suite, assert_,
assert_array_almost_equal, assert_raises)
from matsubara.pure_dephasing import (pure_dephasing_integrand,
pure_dephasin... |
import pygame
class WelcomeScreen():
def __init__(self, root):
self.root = root
font = pygame.font.SysFont('digitaltsplum', 70)
img = font.render('Cellular Automaton', True,(81, 113, 165))
self.center_element(img, 40)
def center_element(self, text_img: pygame.Surface, y:int):
... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... |
# Released under the MIT License. See LICENSE for details.
#
"""Custom json compressor/decompressor with support for more data times/etc."""
from __future__ import annotations
import datetime
import json
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Any
# Special attr we included for our... |
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
unicode_literals)
import re
import webbrowser
import requests
from beets.plugins import BeetsPlugin
from beets.ui import decargs
from beets import ui
from requests.exceptions import HTTPError
class Spo... |
"""
Author: youngorsu
Email : zhiyongsu@qq.com
Last edited: 2018.1.29
"""
# coding=utf-8
import sys
import os
from PyQt5.QtWidgets import (
QMainWindow,
QLabel,
QLineEdit,
QPushButton,
QHBoxLayout,
QVBoxLayout,
QGridLayout,
QTableWidget,
QWidget,
QAbstractItemView,
QHeaderV... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import setuptools
import textwrap
version = "1.0"
if __name__ == "__main__":
setuptools.setup(
name="jams",
version=version,
description="Consistent hashing algorithm",
author="Sergey Romanov",
author_email="xxsmotur@gmail.com"... |
"""include ml-flag field and language detection
Revision ID: 30108f70cb3b
Revises: 72901249ace9
Create Date: 2021-01-21 16:23:27.650967
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '30108f70cb3b'
down_revision = '72901249ace9'
branch_labels = None
depends_on... |
""" SEC View """
__docformat__ = "numpy"
import logging
import os
from typing import List, Optional
from datetime import datetime, timedelta
import pandas as pd
from matplotlib import pyplot as plt
from gamestonk_terminal.config_terminal import theme
from gamestonk_terminal.decorators import log_start_end
from games... |
# MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2020
#
# 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
# r... |
import argparse
import logging
import math
import cv2
import dlib
import numpy as np
class Detector():
def __init__(self, datafile='shape_predictor_68_face_landmarks.dat', verbose=False):
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s')
self.logger = logging.getLogger(__name__)
... |
description = 'Simulated DN3 instrument'
group = 'lowlevel'
devices = dict(
mon = device('nicos.devices.generic.VirtualCounter',
description = 'Simulated Monitor Detector',
fmtstr = '%d',
type = 'monitor',
lowlevel = True,
),
tim = device('nicos.devices.generic.VirtualTimer... |
# -*- coding: utf-8 -*-
import pytest
import os
from ruamel.yaml import YAML
import pandas as pd
from six import PY3
import shutil
from great_expectations.exceptions import BatchKwargsError
from great_expectations.datasource import PandasDatasource
from great_expectations.datasource.types.batch_kwargs import (
... |
#!/usr/bin/env python3
from mastermind.board import Board
from mastermind.player import Player
from mastermind.user_interface import UserInterface
from mastermind.utils.timer import Timer
class Game:
"""
Game class.
"""
def __init__(self):
"""
Game constructor.
"""
se... |
#!/usr/bin/env python3
# Copyright (c) 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.
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test... |
# Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
# Project developers. See the top-level LICENSE file for dates and other
# details. No copyright assignment is required to contribute to VisIt.
"""
file: flow_pyocl_compile_example_1.py
author: Cyrus Harrison <cyrush@llnl.gov>
created: 3/25... |
from celery.utils.time import maybe_make_aware
from redbeat.decoder import to_timestamp, from_timestamp
from tests.basecase import RedBeatCase
class Test_utils(RedBeatCase):
def test_roundtrip(self):
now = self.app.now()
# 3.x returns naive, but 4.x returns aware
now = maybe_make_aware(no... |
class _TemplateMetaclass(type):
def __init__(cls, name, bases, dct):
super(_TemplateMetaclass, cls).__init__(name, bases, dct) |
#!/usr/bin/env python3
""" Functionality related to binned data.
.. codeauthor:: Ramyond Ehlers <raymond.ehlers@cern.ch>, ORNL
"""
import collections
import itertools
import logging
import operator
import uuid
from functools import reduce
from typing import TYPE_CHECKING, Any, Dict, List, Mapping, Sequence, Tuple, T... |
# -*- coding: utf-8 -*-
from .loggers import init_default_log
import os
import platform
PACKAGE_NAME = "pyleecan"
# User folder (to store machine/materials/config)
if platform.system() == "Windows":
USER_DIR = os.path.join(os.environ["APPDATA"], PACKAGE_NAME)
USER_DIR = USER_DIR.replace("\\", "/")
else:
US... |
from django.contrib.auth.forms import UserCreationForm
from user_app.models import User
class UserRegForm(UserCreationForm):
class Meta:
model = User
fields = ('email', 'first_name', 'last_name', 'age', 'sex', 'tags', 'city') |
"""
Item pipeline
See documentation in docs/item-pipeline.rst
"""
from scrapy.middleware import MiddlewareManager
from scrapy.utils.conf import build_component_list
from scrapy.utils.defer import deferred_f_from_coro_f
class ItemPipelineManager(MiddlewareManager):
component_name = 'item pipeline'
@classme... |
import pickle
from main import clf
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
def test_accuracy():
# Load test data
with open("data/test_data.pkl", "rb") as file:
test_data = pickle.load(file)
# Unpack the tuple
X_test, y_test = test_data
# Co... |
from setuptools import find_packages, setup
setup(
name="ken_perlin_noise",
version="0.0.1",
packages=find_packages(),
include_package_data=True,
python_requires='>=3',
url="https://github.com/EgorVoron/py-perlin-noise",
author="EgorVoron",
license="MIT",
install_requires=[
... |
# Copyright 2015 OpenStack Foundation
#
# 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 ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime, json, logging, pprint
from django.conf import settings
from django.contrib.auth import login as django_login
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseForbidden, HttpResponseRedirect,... |
from flask import Flask, request
import pandas as pd
import numpy as np
import json
import pickle
import os
app = Flask(__name__)
# Load Model and Scaler Files
model_path = os.path.join(os.path.pardir,os.path.pardir,'models')
model_filepath = os.path.join(model_path, 'lr_model.pkl')
scaler_filepath = os.path.join(mod... |
import os
import sys
from collections import OrderedDict
import pandas as pd
from .data import extract_label_values
sys.path.append("../")
from config import DATASETS_PATH
from sklearn.metrics import fbeta_score
def evaluate_performance_validation(predictions, beta=2):
labels = pd.read_csv(os.path.join(DATASE... |
# 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... |
from scipy.stats.distributions import chi2
#
# def ipte_formula(iterations_or_ipte, number_of_incidents, confidence):
# chi_square_inverse_right_tailed = chi2.ppf(confidence, df=2 * (number_of_incidents + 1))
# return chi_square_inverse_right_tailed * (1000 / (iterations_or_ipte * 2))
#
def calculate_iterati... |
"""
a base class whose attributes are read-only,
unless use the context _context_allow_change to change attributes
"""
from contextlib import contextmanager
class AttributeReadOnlyError(Exception):
def __init__(self, obj: object, attr: str):
self.obj = obj
self.attr = attr
def __str__(self):... |
import cv2 as _cv
import numpy as _np
from _util import get_frames as _get_frames, matrix_to_video as _matrix_to_video
def to_grayscale(source: str, destination: str) -> None:
vid = _cv.VideoCapture(source)
# (t,y,x,chan)
denoised_color_movie = _get_frames(vid)
print("Converting to grayscale...")
... |
"""
Simple check list from AllenNLP repo: https://github.com/allenai/allennlp/blob/master/setup.py
To create the package for pypi.
1. Change the version in __init__.py, setup.py as well as docs/source/conf.py. Remove the master from the links in
the new models of the README:
(https://huggingface.co/transformers... |
"""2D Scatter plot for data points of one iteration."""
import numpy as np
class StatePlot:
"""Plot data of one time step."""
def __init__(self, x_lim=None, y_lim=None, pos_lbl=1, neg_lbl=0, pos_cls=1, neg_cls=0):
"""
Args:
x_lim [int, int]: Min and max value for x-axis of plot.
... |
# Natural Language Toolkit: Indian Language POS-Tagged Corpus Reader
#
# Copyright (C) 2001-2014 NLTK Project
# Author: Steven Bird <stevenbird1@gmail.com>
# Edward Loper <edloper@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Indian Language POS-Tagged Corpus
Collected by ... |
# 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
import os
import sys
import unittest
sys.path.insert(0, os.getcwd() + '/src')
from pidcontroller2 import PIDController
from wheelencoder2 import Encoder
from mock import MagicMock, patch
from utilities import *
class TestPIDController(unittest.TestCase):
def setUp(self):
self.... |
import pytest
import pystatuspage
import os
SECRETS_FILE = 'secrets.json'
@pytest.fixture(scope="module")
def secrets():
if os.path.exists(SECRETS_FILE):
import json
with open(SECRETS_FILE) as json_file:
secrets = json.load(json_file)
else:
secrets = {}
secrets['o... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import os
import tensorflow as tf
import math
"""
BCL + OMEGA = 180 / 32. + data aug + ms
FLOPs: 1321979063; Trainable params: 52136440
This is your result for task 1:
mAP: 0.7197849386403127
ap of each class:
pla... |
# Copyright (c) 2001-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.python.threadpool}
"""
import pickle, time, weakref, gc, threading
from twisted.trial import unittest, util
from twisted.python import threadpool, threadable, failure, context
from twisted.internet import reacto... |
from reading_stats import __version__
def test_version():
assert __version__ == '0.1.0' |
import gi
from .tts import readText
from .Bible_Parser import BibleParser
gi.require_version('Gtk', '4.0')
gi.require_version('Gst', '1.0')
from gi.repository import Gtk, Gio, Gst, Gdk
gi.require_version('Adw', '1')
from gi.repository import Adw
from .config import pkgdatadir, application_id, user_data_dir
import os
i... |
import json
import torch
import argparse
import torch.nn as nn
from torch import optim
import config
from model import NERModel
from dataset_loader import DatasetLoader
from progressbar import ProgressBar
from ner_metrics import SeqEntityScore
from data_processor import CluenerProcessor
from lr_scheduler import ReduceL... |
import pytest
import torch
from torch.autograd import gradcheck
import kornia
import kornia.geometry.transform.imgwarp
import kornia.testing as utils # test utils
from kornia.testing import assert_close
class TestAngleToRotationMatrix:
def test_shape(self, device):
inp = torch.ones(1, 3, 4, 4).to(device... |
import RPi.GPIO as GPIO
import time,threading
LED = 26
KEY = 20
GPIO.setmode(GPIO.BCM)
GPIO.setup(LED,GPIO.OUT)
GPIO.setup(KEY, GPIO.IN,GPIO.PUD_UP) # 上拉电阻
freq=1#闪烁频率
state=0#当前状态(亮/暗)
pulse_time=time.time()#记录时间轴上最近一次上跳沿的时刻
p = GPIO.PWM(LED,freq)
def callback1(ch):
global state
state=1 if state==0 else... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Branko Majic <branko@majic.rs>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
module: dconf
author... |
from ethereum.tools import tester
from ethereum.tools.tester import TransactionFailed
from pytest import fixture, raises, mark
from utils import longToHexString, EtherDelta, TokenDelta, PrintGasUsed
from reporting_utils import proceedToNextRound, proceedToFork, finalizeFork
def test_redeem_reporting_participants(kitch... |
#BOLTS - Open Library of Technical Specifications
#Copyright (C) 2013 Johannes Reinhardt <jreinhardt@ist-dein-freund.de>
#
#This library is free software; you can redistribute it and/or
#modify it under the terms of the GNU Lesser General Public
#License as published by the Free Software Foundation; either
#version 2.1... |
import random
import numpy as np
def strategy(history, memory): # defects until opponent cooperates, then cooperates forever
righted = False
if memory is not None and memory: # Has memory that it was already righted.
righted = True
else: # Has not been wronged yet, historically.
if hist... |
from tkinter import *
from tkinter import messagebox
import socket
import pickle
class clase_U_Inicio():
def __init__(self,sock):
self.nom = []
self.paginas=0
self.fila=0
self.columna=0
self.frmdic={}
self.btn={}
self.pagina_actual=0
self.listapostale... |
#!/usr/bin/env python
# encoding: utf-8
"""
build_makelink.py
Created by zonble on 2009-09-07.
"""
import sys
import os
def build_debug():
project_target_name = "OpenVanilla (Loader IMK)"
clean_command = "xcodebuild -project ../OpenVanilla.xcodeproj -configuration Debug clean"
build_command = "xcodebuild -project... |
from dateutil import parser
from dataclasses import field, Field
from datetime import datetime
from typing import *
from dataclasses_json import config
from marshmallow import fields
from .enum import Characteristic, Difficulty, AccountType
def datetime_from_iso_format(time):
if time:
return parser.isop... |
import boto3
def get_es_client(access_key, secret_key, region):
"""
Returns the client object for AWS Elasticsearch
Args:
access_key (str): AWS Access Key
secret_key (str): AWS Secret Key
region (str): AWS Region
Returns:
obj: AWS Elasticsearch Object
"""
retu... |
import mylib
obj = mylib.initialize()
res = obj.myfunc()
print(res) |
"""Generate the file shapes.txt."""
import networkx as nx
import multiprocessing as mp
from hashlib import sha1
from tqdm import tqdm
import pandas as pd
from mixer.gtfs.reader.controller import Controller
class EstimateShapes(object):
"""Gen or fill shapes."""
def __init__(self, gtfs_path):
"""Con... |
''' Cleave protocol
'''
from datetime import datetime
from assignment_utilities import call_responder
class Cleave:
'''
Cleave protocol object
'''
def __init__(self):
self.num_tasks = 100
self.task_populate_method = 'query_neuprint'
self.unit = 'body_id'
self.cypher_uni... |
import collections
import logging
import os
from zipfile import ZipFile
import pkg_resources
import pytest
import tarfile
import tempfile
import req_compile.metadata
import req_compile.metadata.dist_info
import req_compile.metadata.metadata
import req_compile.utils
from req_compile.repos.repository import Repository... |
# 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... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-03-14 08:49
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('dog', '0001_initial'),
]
operations = [
migrations.DeleteModel(
name='... |
"""
DenseNet, implemented in Gluon.
Original paper: 'Densely Connected Convolutional Networks,' https://arxiv.org/abs/1608.06993.
"""
__all__ = ['DenseNet', 'densenet121', 'densenet161', 'densenet169', 'densenet201']
import os
from mxnet import cpu
from mxnet.gluon import nn, HybridBlock
from .common import p... |
from keras.callbacks import ModelCheckpoint
from keras import backend as K
from keras import optimizers
from keras.layers import Dense
from keras.layers import Dense, Dropout
from keras.models import Sequential
from keras.wrappers.scikit_learn import KerasClassifier
from pandas import ExcelFile
from pandas import Excel... |
from django.core.management.base import BaseCommand
from django.db import IntegrityError
from convocatorias.models import Convocatoria
import json
from datetime import datetime
class Command(BaseCommand):
help = 'Importa las convocatorias encontradas por la araña en infosicoes'
def add_arguments(self, pars... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible_collections.testns.testcoll.plugins.action.echoaction import ActionModule as BaseAM
class ActionModule(BaseAM):
pass |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
import unittest
import os,sys,inspect
sys.path.append('..')
from neural.neuron import Neuron
class NeuronTests(unittest.TestCase):
def test_size(self):
n = Neuron(10)
self.failUnless(n.size == 10)
def test_serialization(self):
n = Neuron(10)
original = [0.1,0.2,0.3,0.4,0.5,... |
# Author: Jonathan Armoza
# Project: Art of Literary Modeling
# Date: October 22, 2019
# Purpose: Some brief explorations of the TEI XML files and other (meta)data from
# Mark Twain Project Online (http://www.marktwainproject.org/)
# Credits: Terence Catapano of MTPO (assisted with file location and usage
# r... |
from flask import render_template
import models
import app
@app.route("/")
@app.route("/index")
def home():
return render_template("index.html", posts=app.post_store.get_all()) |
# See LICENSE for licensing information.
#
#Copyright (c) 2016-2019 Regents of the University of California and The Board
#of Regents for the Oklahoma Agricultural and Mechanical College
#(acting for and on behalf of Oklahoma State University)
#All rights reserved.
#
"""
This is a DRC/LVS interface for Assura. It imple... |
# Generated by Django 2.1.12 on 2019-09-09 18:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('surveys', '0003_auto_20180330_1812'),
]
operations = [
migrations.AlterField(
model_name='even... |
# Copyright 2015 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 a... |
# Generated by Django 2.1.7 on 2019-09-09 13:58
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
... |
import argparse
import ncrmodel
import numpy as np
import os
from onto import Ontology
import json
import fastText
import pickle
import tensorflow as tf
import accuracy
import annotate_text
import eval
import tempfile
import shutil
import random
tf.enable_eager_execution()
def save_ont_and_args(ont, args, param_dir)... |
import unittest
import nose.tools
from nose_parameterized import parameterized
import mock
import shutil, tempfile
from os import path
import fb_credentials
@parameterized([ # token, username, password
('a', 'a', ''), # token and username
('a', '', 'a'), # token and password
('', 'a', ''), # username and... |
""" Converts owl or ttl or raw rdflib graph into a pandas DataFrame. Saved in .pickle format.
Usage:
Graph2Pandas.py [-h | --help]
Graph2Pandas.py [-v | --version]
Graph2Pandas.py [-f=<path>] [-a | -t=<str>] [-o=<path>]
Options:
-h --help Display this help message
... |
import numpy as np
from qaoa.operators import Kronecker, SumSigmaXOperator, Propagator
class SumSigmaXPropagator(Propagator):
def __init__(self,D,theta=0):
assert( isinstance(D,SumSigmaXOperator) )
self.kronecker = Kronecker(np.eye(2),D.num_qubits(),dtype=complex)
super().__init__(D,th... |
from sympy import *
from sympy.polys.orderings import monomial_key
x, y = symbols('x y')
print(groebner([y * y + 2 * x * y - 1, x * x + 1], x, y, order='lex')) |
# Copyright 2020 ByteDance 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 applicable law or agreed to in writin... |
#
# PySNMP MIB module ITU-ALARM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ITU-ALARM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:47:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... |
"""Kea HA fail detection"""
# pylint: disable=invalid-name,line-too-long
import pytest
from forge_cfg import world
import srv_msg
import misc
import srv_control
from HA.steps import generate_leases, wait_until_ha_state, send_increased_elapsed_time, send_heartbeat
from HA.steps import HOT_STANDBY, LOAD_BALANCING
@p... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from rest_framework import mixins
from rest_framework.viewsets import GenericViewSet
from irekua_database import models
from irekua_rest_api import serializers
from irekua_rest_api import utils
class DeviceTypeViewSet(mixins.RetrieveModelMixin,
... |
from django.conf.urls import url
from django.contrib import admin
from boards import views
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^admin/', admin.site.urls),
] |
import os
import pytest
from appdirs import user_config_dir
import genomepy
import genomepy.utils
from tests import linux, travis
def test_head_annotations(caplog, capsys):
genomepy.functions.head_annotations("ASM14646v1", provider="ncbi", n=1)
captured = capsys.readouterr().out.strip()
assert "NCBI" i... |
from . import *
class TestHttpManager(TestCase):
def test_standalone_c(self):
pkg = MockPackage('test_standalone_c', 'c_configure_make_install', {'NAME': 'foo'})
pkg.render_commit()
vee(['install', mock_url('packages/test_standalone_c.tgz'),
'--install-name', 'foo/1.0.0',
... |
# -*- coding: utf-8 -*-
from flexmock import flexmock, flexmock_teardown
from orator.connections import Connection
from orator.schema.grammars import PostgresSchemaGrammar
from orator.schema.blueprint import Blueprint
from ... import OratorTestCase
class PostgresSchemaGrammarTestCase(OratorTestCase):
def tearDo... |
# this file is copied from https://github.com/NVIDIA/DeepLearningExamples/blob/master/PyTorch/LanguageModeling/BERT/processors/glue.py
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the ... |
import os
import socket
s=socket.socket()
host=socket.gethostname()
port=8080
s.bind((host,port))
print("\n[*] Server Is Currently Runninng @",host)
print("\nWaiting For Incoming Connections....")
s.listen(1)
con,addr=s.accept()
print(addr, " has connected to the server successfully ")
while 1:
command=input(s... |
# Return the lines from a spline.
#
import pyvista
import numpy as np
points = np.random.random((3, 3))
spline = pyvista.Spline(points, 10)
spline.lines
# Expected:
## array([10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) |
"""Define Server class."""
import reapy
from reapy.tools import json
from .socket import Socket
import socket
import traceback
class Server(Socket):
"""
Server part of the ``reapy`` dist API.
It is instantiated inside REAPER. It receives and processes API
call requests coming from the outside.
... |
#***************************************************************************************************
# Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
# Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights
# in this software.
# Licensed... |
import os
import json
from unittest import TestCase, mock
from dotenv import load_dotenv
from flask import jsonify
from src import create_app
from src.google import decode_token, login
from src.constants.http_status_codes import HTTP_200_OK, HTTP_405_METHOD_NOT_ALLOWED,HTTP_400_BAD_REQUEST
class TestUser(TestCase):... |
from google.cloud import translate, datastore
import google.auth
import json
import pyrebase
import json
import logging
FIREBASE_CONFIG = None
with open('keys/firebase-secrets.json') as f:
FIREBASE_CONFIG = json.load(f)
class DataStore(object):
def __init__(self, project_id):
self.client = datastore.C... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
import sys
from setuptools import find_packages, setup
with open("README.rst") as readme_file:
readme = readme_file.read()
with open("HISTORY.rst") as history_file:
history = history_file.read()
requirements = ["cffi>=1.0.0"]
setup_requ... |
import itertools
import logging
import os.path
import re
import urllib.request
import uuid
from textwrap import dedent
from typing import List, Optional, Tuple
from unittest import mock
import pytest
from pip._vendor import html5lib, requests
from pip._internal.exceptions import NetworkConnectionError
from pip._inter... |
#!/usr/bin/env python3
"""AbodePy setup script."""
from setuptools import setup, find_packages
from abodepy.helpers.constants import (__version__, PROJECT_PACKAGE_NAME,
PROJECT_LICENSE, PROJECT_URL,
PROJECT_EMAIL, PROJECT_DESCRIPTION,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.