src stringlengths 721 1.04M |
|---|
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
import numpy as np
import torch
from torch.testing import assert_allclose
from allennlp.common.testing import (
AllenNlpTestCase,
multi_device,
# global_distributed_metric,
# run_distributed_test,
)
from allennlp.training.metrics import Covariance
class CovarianceTest(AllenNlpTestCase):
@multi_de... |
import os
import sys
import tempfile
from zipfile import ZipFile, ZIP_DEFLATED
from datetime import datetime
import time
from jinja2 import Environment, FileSystemLoader
from . import Color
if getattr(sys, "frozen", False):
_basedir = os.path.join(sys._MEIPASS, "pyexcelerate")
else:
_basedir = os.path.dirname(... |
# Copyright 2016-2017 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import mock
from .common import BaseTest
class ShieldTest(BaseTest):
# most of the shield tests are embedded in other resources
def test_shield_sync(self):
# shield resour... |
#############################################################################
# Copyright 2016 Mass KonFuzion Games
#
# 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... |
from settings_local import SUBSCRIPTION_ID, STORAGE_ACCOUNT_NAME, STORAGE_ACCOUNT_KEY, EMAIL_USERNAME, EMAIL_PASSWORD
__author__ = 'Natalie Sanders'
__author__ = 'Natalie Sanders'
from azure.servicemanagement import *
from azure.storage import *
from subprocess import call
from os import chdir
import os
import socke... |
import os
import sys
import unittest
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from veda_worker.__init__ import VedaWorker
from veda_worker.abstractions import Video, Encode
from veda_worker.config import WorkerSetup
"""
file intake test
"""
class TestIntake(unittest.TestCase):
... |
from undine.api.database.base_client import BaseClient
from undine.database.sqlite import SQLiteConnector
class SQLiteClient(BaseClient):
_QUERY = {
'task': '''
INSERT INTO task(tid, name, cid, iid, wid, reportable, state)
VALUES(:tid, :name, :cid, :iid, :wid, :reportable, 'R')
... |
import numpy as np
import scipy.cluster.hierarchy as hier
import scipy.spatial.distance as dist
import matplotlib.pyplot as plt
import make_data
from transform import count_transform
from cluster_algos import kmeans, hcluster
def clustering(X, labels, algo='hcluster', n_clusters=5, figname='cluster_result.png'):
... |
"""A setuptools based setup module.
See (and based on):
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
h... |
import logging
import pytz
import requests
from StringIO import StringIO
from django.contrib.auth.models import User
from django.core import files
from django.core.files.storage import default_storage
from django.core.files.base import ContentFile
from django.utils import timezone
from django.utils.dateparse import p... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from django.core.cache import caches
from django.http import Http404
from django.test.client import RequestFactory
from d... |
"""
${NAME}
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import numpy
from mcedit2.rendering import renderstates, scenegraph
from mcedit2.rendering.blockmeshes import standardCubeTemplates
from mcedit2.rendering.blockmeshes import ChunkMeshBase
from mcedit2.r... |
# Copyright 2017 <thenakliman@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
from __future__ import division as __division__
import numpy as __np__
from numpy import sqrt as __sqrt__
from numpy import cos as __cos__
from numpy import sin as __sin__
import matplotlib.pyplot as __plt__
from matplotlib import cm as __cm__
class Coefficient(object):
"""
Return a set of Asphere Coefficient
R,k,a... |
# Standard library
import cgi
import itertools
import json
import sys
from textwrap import dedent
import urlparse
# Application modules
from txcas.interface import IServiceManager, IServiceManagerFactory
import txcas.settings
# External modules
from twisted.internet import reactor
from twisted.plugin import IPlugin
... |
from . import conf
from django.conf import settings
from django.db import models
from django import forms
from gmapsmarkers.widgets import GmapsSelectAutocomplete, GeotypeSelect
class GmapsField(models.CharField):
def __init__(self, *args, **kwargs):
kwargs['max_length'] = kwargs.pop("max_length", 250)
... |
# 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 applicabl... |
import os
import sys
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(CWD, '..'))
import aiml
import urllib
import csv
import logging
import glob
from csvUtils import generateAimlFromLongCSV, generateAimlFromSimpleCSV
import xml.etree.ElementTree as ET
logger = logging.getLogger('hr.c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" QiBuild """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print... |
from django.conf.urls import include, url, patterns
from django.contrib import admin
from django.conf.urls.static import static
from django.conf import settings
from django.views.generic import RedirectView, TemplateView
from hera.webapp import account_views
from hera.webapp import sandbox_views
from hera.webapp import... |
# -*- coding: utf-8 -*-
import unittest
import os
from time import sleep
from doublex import *
from hamcrest import *
from infrabbitmq import (
factory,
events,
rabbitmq
)
IRRELEVANT_NETWORK = 'irrelevant_network'
class RabbitMQEventPublisherWithDelayMessagesTest(unittest.TestCase):
def setUp(self):... |
# -*- coding: utf-8 -*-
from nose.tools import *
from tuttle.workflow_builder import *
class TestProjectBuilder():
def test_extract_scheme(self):
"""A file ressource should return a file protocol"""
wb = WorkflowBuilder()
url = "file://test.csv"
assert wb.extract_scheme(url) == "... |
#!/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... |
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import matplotlib
from copy import deepcopy
class planet
''' Represents a snapshot of an evoloving planet, with methods
for comparing different snapshots and relating thermal evolution to
time.'''
def __init__(self, params=None, ... |
#!/usr/bin/env python3
#
# Copyright (c) 2018, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... |
import datetime
from django.contrib.auth.models import User
from django.shortcuts import resolve_url as r
from django.test import TestCase
from django.utils import timezone
from gerencex.core.models import Restday, Office
class OfficeTicketsViewTest(TestCase):
def setUp(self):
self.office = Office.objec... |
# Copyright 2017 Google 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 writing, ... |
# From: Bayesian Models for Astrophysical Data, Cambridge Univ. Press
# (c) 2017, Joseph M. Hilbe, Rafael S. de Souza and Emille E. O. Ishida
#
# you are kindly asked to include the complete citation if you used this
# material in a publication
# Code 6.25 - Zero-truncated negative binomial model in Python using S... |
# -*- coding: utf-8 -*-
# Copyright 2017 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from threading import current_thread
from urllib import urlencode
from decorator import decorator
from mock import patch
from werkzeug.utils import redirect
from odoo import http
from od... |
import unittest
import numpy
from numpy.testing.utils import assert_array_equal
import cmepy.state_enum as state_enum
class StateEnumTests(unittest.TestCase):
def test_simple_init(self):
states = [[0, 0, 1, 1, 2, 1, 2],
[0, 1, 0, 1, 1, 2, 2]]
enum = st... |
import cv2
import time, os
from motion import Motion
from tornado import web, ioloop
import threading
import json
import requests
from config import config
import logging
# Send gesture to node server
logging.getLogger("requests").setLevel(logging.WARNING) # get infos on error
take_photo = False
photo_filepath = ""
de... |
from __future__ import division
import numpy as np
"""Contains some routines to do the (Pade approximant) Fourier transform
as well as some peak-finding routines, useful for post processing a
real-time calculation
"""
def genSpectra(time,dipole,signal):
fw, frequency = pade(time,dipole)
fw_sig, frequen... |
#!/usr/bin/env python
a = [5, 3, 6, 3, 1, 2]
def merge_sort(in_array, left, right):
print 'Before: ({} , {}) : {}'.format(str(left), str(right), (in_array[left:right + 1]))
if right - left >= 1:
mid = ((right - left) / 2) + left
if mid > right:
return
merge_sort(in_array, ... |
# https://cloud.google.com/compute/pricing
# all storage prices are per GB per month.
PRICING = {
'gcs-standard' : 0.026,
'gcs-reduced' : 0.02,
'gcs-nearline' : 0.01,
'snapshot' : 0.026,
'local-ssd' : 0.218,
'pd-ssd' : 0.17,
'pd-standard' : 0.04,
... |
from django.conf import settings
from django.conf.urls.defaults import *
from django.contrib.auth.models import User
from django.db.models import Count
import json
from tastypie import fields
from tastypie.authentication import *
from tastypie.authorization import *
from tastypie.resources import ModelResource, Resourc... |
import hycohanz as hfss
raw_input('Press "Enter" to connect to HFSS.>')
[oAnsoftApp, oDesktop] = hfss.setup_interface()
raw_input('Press "Enter" to create a new project.>')
oProject = hfss.new_project(oDesktop)
raw_input('Press "Enter" to insert a new DrivenModal design named HFSSDesign1.>')
oDesign = hfss.insert... |
"""
django-user-profiles includes a few model managers for commonly used tasks, for
instance to retrieve all objects created by a specific user.
"""
from user_profiles.middleware import CurrentUserMiddleware
from django.db import models
class ByUserManager(models.Manager):
"""
A manager for accessing all obj... |
#
# Generate math tests
#
import random
random.seed(412)
monitor = [ord(x) for x in open("..\monitor_rom\monitor.bin","rb").read(-1)]
mvars = { "C":10,"D":20,"Z":33 }
def rnd(maxval):
n = maxval+1
term = ""
while n >= maxval:
n = random.randrange(0,255)
term = str(n)
if random.randrange(0,3) == 0:
k = m... |
from setuptools.command.test import test as TestCommand
import setuptools
import io
import sys
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
#import here, cause outside th... |
#!/usr/bin/env python
# -----------------------------------------------------------------------------
# calc.py
#
# A simple calculator with variables. This is from O'Reilly's
# "Lex and Yacc", p. 63.
#
# Class-based example contributed to PLY by David McNab
# --------------------------------------------------------... |
# Copyright (c) 2019, NVIDIA CORPORATION. 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 appli... |
"""Coordinate and geometry warping and reprojection"""
from fiona._transform import _transform, _transform_geom
def transform(src_crs, dst_crs, xs, ys):
"""Transform coordinates from one reference system to another.
Parameters
----------
src_crs: str or dict
A string like 'EPSG:4326' or a di... |
"""
config.py
Configuration and settings
"""
from os import getenv
class Config(object):
DEBUG = True
TESTING = False
PRODUCTION = False
# Global stuff
SQLALCHEMY_DATABASE_URI = getenv("SQLALCHEMY_DATABASE_URI", 'postgresql+psycopg2://postgres:postgres@db/meerkat_db')
API_KEY = "test-api"
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 S2S Network Consultoria e Tecnologia da Informacao LTDA
#
# Author: Zhongjie Wang <wzj401@gmail.com>
# Tianwei Liu <liutiawneidlut@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms... |
import argparse
import bz2
from sys import stdin, stdout, stderr
import ipfix
import qof
import pandas as pd
args = None
def characteristic_present(df, flag):
return ((df["qofTcpCharacteristics"] & flag) == flag) | \
((df["reverseQofTcpCharacteristics"] & flag) == flag)
def ecn_negotiated(df):
ec... |
# 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 ... |
# Manipulate file NT ACLs
#
# Copyright Matthieu Patou 2010 <mat@matws.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later ver... |
"""
SOQplot.py - sdbonin (work in progress)
read _plot array from txt and plot them
"""
import numpy as np
import matplotlib.pyplot as plt
S_plot = np.loadtxt('S_plot.txt',delimiter=',')
q_plot = np.loadtxt('q_plot.txt',delimiter=',')
p_plot = np.loadtxt('p_plot.txt',delimiter=',')
time = np.loadtxt('time.txt',delimi... |
'''
Copyright 2013 Cosnita Radu Viorel
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, distribute... |
'''golden section search to minimize a function of one variable in [low,high]
NOTE: the function fun is assumed to be unimodal
RETURN
low
high, such that the minimizer is in [low,high]
dict, dictionary with function evalutions dict[x] = f(x)
ARGS
fun(x) -> number
low -> number
high -> number
tolerance -> number... |
""" Provides the "Tools/Gcov/Compute coverage files" and "Remove coverage
files" menus, which executes gcov automatically.
This script will also perform checks along the way to guide through the
procedure of obtaining gcov info.
The output of the gcov process is displayed in a separate console.
At the end of the proce... |
# -*- coding: utf-8 -*-
#
# 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 ------------------------------------------------------------... |
# -*- coding: utf-8 -*-
# This file is part of wger Workout Manager.
#
# wger Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any ... |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#... |
from __future__ import (absolute_import, print_function, division)
from astropy.table import Table
import numpy as np
from astropy.io import fits
# fix needed till astropy.io get's updated - need to check this
fits.column.ASCII2NUMPY['E'] = fits.column.ASCII2NUMPY['F'] = 'f8'
import matplotlib.pyplot as plt
import ... |
# -*- coding: utf-8 -*-
"""
Problem Statement
Given a word w, rearrange the letters of w to construct another word s in such a way that, s is lexicographically
greater than w. In case of multiple possible answers, find the lexicographically smallest one.
Input Format
The first line of input contains t, number of test... |
# coding:utf-8
from datetime import datetime
import decimal
import json
import six
import logging
import traceback
from tornado import escape
from tornado.web import RequestHandler, HTTPError
def tojson(data, ensure_ascii=True, default=False, **kwargs):
def serializable(obj):
if isinstance(obj, decimal.De... |
#!/usr/bin/env python
# -*- coding: <utf-8> -*-
"""
This file is part of Spartacus project
Copyright (C) 2018 CSE
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or... |
# -*- coding:utf-8 -*-
# Created by Hans-Thomas on 2011-05-29.
#=============================================================================
# colorizer.py --- Colours
#=============================================================================
from __future__ import absolute_import, unicode_literals
import os.pa... |
from .iq_picture import PictureIqProtocolEntity
from yowsup.structs import ProtocolTreeNode
class ResultGetPictureIqProtocolEntity(PictureIqProtocolEntity):
'''
<iq type="result" from="{{jid}}" id="{{id}}">
<picture type="image | preview" id="{{another_id}}">
{{Binary bytes of the picture.}}
... |
# coding=utf-8
import json
import logging
from queue import Queue
from pooled_pika import PooledConn
from scrapy.crawler import CrawlerProcess
from scrapy.settings import Settings
from scrapy.utils.log import log_scrapy_info
from scrapy.utils.ossignal import install_shutdown_handlers
from twisted.internet import defer... |
# Copyright 2013: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
#!/usr/bin/python
import flickrapi
import urllib
import xbmc, xbmcgui, xbmcplugin, xbmcaddon #@UnresolvedImport
import sys, os, time
from urllib2 import HTTPError, URLError
__plugin__ = 'flickr'
__author__ = 'ruuk'
__url__ = 'http://code.google.com/p/flickrxbmc/'
__date__ = '01-07-2013'
__settings__ = xbmcaddon.Addon... |
# -*- coding: utf-8 -*-
"""
test_base
~~~~~~~~~
A way of faking out FluidDB in fom, for testing.
:copyright: (c) 2010 by AUTHOR.
:license: MIT, see LICENSE_FILE for more details.
"""
from collections import deque
from fom.db import FluidDB, _generate_endpoint_url, NO_CONTENT, FluidResponse
cl... |
from utils import STEPS, RESULT, SETUP
import copy
# TODO: use a class for this
DEFAULT = {
'memory': 1048576,
'uuid': 'c156ca6f-3c16-435b-980d-9745e1d84ad1',
'name': 'vm1',
'id': 1,
}
def start_guest(params, env):
"""
Start guest
"""
params.doc_logger.info(STEPS + "# virsh start %s" %... |
import sys
import os
import shutil
import argparse
import tarfile
import re
from collections import defaultdict
class Lexem:
def __init__(self, ctag=None, base=None, msds=None):
self.ctag = ctag
self.base = base
self.msds = msds if msds is not None else set()
def add(self, msd):
... |
import configparser
class Config(object):
def __init__(self):
self.config = configparser.ConfigParser()
self.config.read('../config.ini')
def get_general(self):
general = {'debug': self.config.get('general', 'debug')}
return general
def get_ftp(self):
ftp = {'hos... |
from __future__ import print_function
from describe.descriptors import LMBTR
from describe.core import System
from describe.data.element_data import numbers_to_symbols
import numpy as np
from scipy.sparse import lil_matrix, save_npz
from read_binary import *
data = read_b('../binary/database-mulliken-ccsd-spd.bin')
d... |
#!/usr/bin/python
#
# Copyright (C) 2013 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program... |
# encoding: utf-8
# module gtk._gtk
# from /usr/lib/python2.7/dist-packages/gtk-2.0/gtk/_gtk.so
# by generator 1.135
# no doc
# imports
import atk as __atk
import gio as __gio
import gobject as __gobject
import gobject._gobject as __gobject__gobject
from Bin import Bin
from Activatable import Activatable
class But... |
import os
import shutil
from zipfile import ZipFile, ZIP_DEFLATED
def discover_files(src_dir, archive_path, file_found_callback):
"""
Finds all the files in the source directory, and how they map
into the archive path (a relative directory).
:param src_dir:
:param archive_path:
:param file_f... |
# Wrapper module for _socket, providing some additional facilities
# implemented in Python.
"""\
This module provides socket operations and some related functions.
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
On other systems, it only supports IP. Functions specific for a
socket are avai... |
#!/usr/bin/env python
# encoding: utf8
import imaplib
import optparse
import MySQLdb
import memcache
import ldb
import os
import re
import subprocess
import sys
from samba.param import LoadParm
from samba.samdb import SamDB
from samba.auth import system_session
class SambaOCHelper(object):
def __init__(self):
... |
# You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version
# of your product fails the quality check. Since each version is developed based on the previous version, all the
# versions after a bad version are also bad.
#
# Suppose you have n versions [1, 2, ..., ... |
import datetime
from app import db
class Tournament(db.Model):
id = db.Column(db.Integer, primary_key=True)
upload_user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
uploaded = db.Column(db.DateTime, default=datetime.datetime.utcnow)
date = db.Column(db.Date)
type = db.Column(db.Enum('sc', ... |
#
# Copyright 2017 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
# 6. Trademarks. T... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2015 be-cloud.be
# Jerome Sonnet <jerome.sonnet@be-cloud.be>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... |
# -*- coding: utf-8 -*-
#
# stackexch-nlp documentation build configuration file, created by
# sphinx-quickstart.
#
# 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.
#
# All configuration values ... |
#!/usr/bin/env python
#
from math import sin, cos, radians
from . import danielbates_minecraft_basic as mc
#import pygame.image # comment this out if not using images - it's slow to import. If you uncomment, uncomment the image reference below.
import random
import server
# TODO: use numpy matrices/vectors instead of... |
# TaxiVis product for analyzing trends in taxi trajectories.
# Copyright (C) 2012 David Sheets (dsheets4@kent.edu)
#
# This is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
... |
from unittest import TestCase
from unittest.mock import patch
from src.persistence.persist import Persistence
from src.settings import REDIS_KEY_TTL
from tests import build_task_database, build_task_running
class FakeCache():
def __init__(self):
self.cached = {}
def set(self, key, value, *args):
... |
#!/usr/bin/python
# Copyright: Ansible Project
# 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
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
... |
"""A collection of utility functions to support the notebooks"""
import numpy as np
import astropy.coordinates as coords
import astropy.units as u
import shelve, pickle
from BaryTime import BaryTime
P48_loc = coords.EarthLocation(lat=coords.Latitude('33d21m26.35s'),
lon=coords.Longitude('-116d51m32.04s'),
hei... |
import copy
import logging
log = logging.getLogger()
log.setLevel(logging.WARN)
def feature_lambda(
feature_list,
test,
test_kwargs,
subfeatures=True,
parent=None,
invert=False,
recurse=True,
):
"""Recursively search through features, testing each with a test function, yielding matche... |
"""
An entity tracker
"""
from spockbot.mcdata.utils import Info
from spockbot.plugins.base import PluginBase, pl_announce
class MCEntity(Info):
eid = 0
status = 0
nbt = None
metadata = None
class MovementEntity(MCEntity):
x = 0
y = 0
z = 0
yaw = 0
pitch = 0
on_ground = True
... |
#
# 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
# ... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# Booltron super add-on for super fast booleans.
# Copyright (C) 2014-2019 Mikhail Rachinskiy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eith... |
# -*- encoding: utf-8 -*-
from django.views.generic import TemplateView
from braces.views import (
LoginRequiredMixin,
StaffuserRequiredMixin,
)
from base.view_utils import BaseMixin
from block.forms import ContentEmptyForm
from block.views import (
ContentCreateView,
ContentPublishView,
ContentRe... |
#
# 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
# ... |
# -*- coding: utf-8 -*-
""" Provide the ObjektType class """
import json
import logging
from .util import _fetch_data, build_name2id
class ObjektType(object):
""" Class for individual nvdb-object types. (Data catalogue) """
def __init__(self, nvdb, objekt_type, meta=None):
self.nvdb = nvdb
... |
import os
from datetime import datetime
from unittest import TestCase
from .mailer import Mailer
from mailosaur import MailosaurClient
from mailosaur.models import SearchCriteria, MailosaurException
class EmailsTest(TestCase):
@classmethod
def setUpClass(cls):
api_key = os.getenv('MAILOSAUR_API_KEY')
... |
from primestg.report import Report
from primestg.report.base import Concentrator
with description('Report instance'):
with before.all:
self.data_filenames = [
'CIR4621247027_0_S02_0_20150901111051',
'CIR4621247027_0_S02_0_20150901111051_warnings',
'CIR4621247027_0_S04_0... |
#!/usr/bin/python
#
#
# Copyright 2011, The Android Open Source Project
#
# 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 ... |
# fetch remove data to local excel: AAPL.xls/MSFT.xls
# https://github.com/pydata/pandas-datareader/blob/master/pandas_datareader/data.py
import datetime
import os
import pandas as pd
import pandas_datareader.data as web
import sys
import warnings
if not sys.warnoptions:
warnings.simplefilter("ignore")
warnin... |
#!/usr/bin/env python
# encoding=utf-8
# Copyright (C) 2012 Sunus Lee, CT
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later versi... |
import pebble as p
import audio
class Meeseeks():
def __init__(self, id="464F", name="Mr. Meeseeks"):
self.id = id
self.name = name
self.pebble = None
self.score = []
def connect(self):
self.pebble = p.Pebble(self.id)
def send(self, msg):
self.pebble.notifi... |
from sentence_transformers import util, SentenceTransformer
import unittest
import numpy as np
import sklearn
import torch
class UtilTest(unittest.TestCase):
def test_normalize_embeddings(self):
"""Tests the correct computation of util.normalize_embeddings"""
embedding_size = 100
a = torch... |
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2009 Warp Networks, S.L.
# Author: Pablo Martí
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your opt... |
# -*- coding: utf-8 -*-
# This file is part of Dyko
# Copyright © 2008-2010 Kozea
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.