content stringlengths 4 20k |
|---|
import os
import pathlib
import shutil
import subprocess
import sys
import nox # type: ignore
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
LOWER_BOUND_CONSTRAINTS_FILE = CURRENT_DIRECTORY / "constraints.txt"
PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], encoding="ut... |
# -*- coding: utf-8 -*-
"""Check all our redirects from remora to zamboni."""
from django.db import connection
from olympia import amo
from olympia.addons.models import Category
from olympia.amo.tests import TestCase
class TestRedirects(TestCase):
fixtures = ['ratings/test_models', 'addons/persona', 'base/global... |
#!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import Mock
from mock import patch
from diamond.collector import Collector
from uwsgi import Uw... |
from nova import context
from nova import exception
from nova import test
class EC2APIErrorTestCase(test.TestCase):
def test_return_valid_error(self):
# without 'code' arg
err = exception.EC2APIError('fake error')
self.assertEqual(err.__str__(), 'fake error')
self.assertEqual(err.c... |
import unittest
import os
from rle_python_interface.rle_python_interface import RLEInterface
import numpy as np
class RleTest(unittest.TestCase):
def setUp(self):
cwd = os.getcwd()
core = 'snes'
romName = os.path.join(cwd, 'roms', 'classic_kong.smc')
self.rle = RLEInterface()
... |
#!/usr/bin/env python
#
# This python file contains script to find the maximum frequency carriers
# and origin and destination airports
#
# Author - Prateek & Nishant
#
#
# After running it on 10^6 random samples the max are
# Top 20 carriers : ['WN', 'DL', 'AA', 'UA', 'US', 'NW', 'CO', 'MQ', 'HP', 'OO', 'TW', 'AS', '... |
import os, sys, unittest
def genpath(somepath):
return os.path.sep.join(somepath.split('/'))
_paths = ('engine/swigwrappers/python', 'engine/extensions')
for p in _paths:
if p not in sys.path:
sys.path.append(os.path.sep.join(p.split('/')))
import fife, fifelog
def getEngine(minimized=False):
e = fife.Engine()... |
"""
simplesim.py
By Ryan Lam
A simulator for a very simple ISA that I made up. Unlike the VM, this actually
simulates the hardware involved with running the assembly code.
"""
import sys
import pdb
from constants import ALUOp, ALUSelA, ALUSelB
from simplesim_elements import (
Wire, Element,
OrGate, Mux,
... |
from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.random import random
from numpy.testing import (
run_module_suite, assert_array_almost_equal, assert_array_equal,
assert_raises,
)
import threading
import sys
if sys.version_info[0] >= 3:
import q... |
import json
import os.path
from PySide import QtGui, QtCore
from PySide.QtCore import Qt
from juma.core import *
from juma.core.ModelManager import *
from PropertyEditor import FieldEditor, registerSimpleFieldEditorFactory
from juma.qt.IconCache import getIcon
from juma.qt.helpers import repolishWidget
from SearchFi... |
import utilities
def get_probesetfreezes(inbredsetid):
cursor, con = utilities.get_cursor()
sql = """
SELECT ProbeSetFreeze.`Id`, ProbeSetFreeze.`Name`, ProbeSetFreeze.`FullName`
FROM ProbeSetFreeze, ProbeFreeze
WHERE ProbeSetFreeze.`ProbeFreezeId`=ProbeFreeze.`Id`
AND ProbeFree... |
import psycopg2
from openerp.osv import orm
from openerp.addons.mozaik_base import testtool
class abstract_coordinate(object):
""" unittest2 run test for the abstract class too
resolved with a dual inherit on the abstract and the common.NAME
"""
def setUp(self):
super(abstract_coordinate, s... |
"""The command group for the Projects CLI."""
from googlecloudsdk.api_lib.projects import util
from googlecloudsdk.calliope import base
from googlecloudsdk.core import resources
@base.ReleaseTracks(base.ReleaseTrack.BETA, base.ReleaseTrack.GA)
class Projects(base.Group):
"""Manage your Projects.
Commands to get... |
"""
Collectors for sockets, interfaces, etc.
"""
__author__ = "Adam Sindelar <<EMAIL>>"
from rekall import utils
from rekall.entities import definitions
from rekall.plugins.collectors.darwin import common
from rekall.plugins.collectors.darwin import zones
class DarwinIfnetCollector(common.DarwinEntityCollector):
... |
from xml.dom.minidom import parseString
from rspecs.src.geni.v3.container.resource import Resource
from rspecs.src.geni.v3.container.sliver import Sliver
from rspecs.src.geni.v3.container.link import Link
class ParserManager:
def __init__(self):
pass
def parse_request_rspec(self,rspec):
... |
"""ResourceSync explorer
This is the guts of a client designed to 'explore' the ResourceSync
facilities offered by a source. Will use standard practices to
look for and interpret capabilities.
"""
import sys
import urllib
import urlparse
import os.path
import datetime
import distutils.dir_util
import re
import time... |
try:
import boto.ec2
from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping
HAS_BOTO=True
except ImportError:
HAS_BOTO=False
import json
def get_block_device_mapping(image):
"""
Retrieves block device mapping from AMI
"""
bdm_dict = dict()
bdm = getattr(image,... |
"""
Projection classes.
A Projection is a connection between two Sheets, generally implemented
as a large set of ConnectionFields.
Any new Projection classes added to this directory will automatically
become available for any model.
"""
from copy import copy
import numpy as np
import param
# So all Projections ar... |
from django.conf.urls import patterns, url
from django.contrib.auth.views import login, logout, password_reset, password_reset_done, password_reset_confirm, password_reset_complete
from django.views.generic.base import TemplateView
from apps.user_management import views
from apps.user_management.models import UserCreat... |
from mock import patch
from nose.tools import eq_
from helper import MockXPI
from js_helper import _do_test_raw
import validator.xpi as xpi
import validator.testcases.content as content
from validator.errorbundler import ErrorBundle
from validator.chromemanifest import ChromeManifest
from validator.constants import *... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2016 Ryan Fan
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, c... |
'''
Gets the offset and limit parameters from the request with the
proper offset and limit settings.
Created on Dec 20, 2013
@author: Andrew Oberlin
'''
from django.conf import settings
import hashlib
'''
Gets the correct value for the offset and limit based on the application
settings.
... |
#!/usr/bin/python
import random
board = []
for i in range(5):
board.append(["O"] * 5)
#print board
def board_print(board):
for row in board:
print " ".join(row)
return
#print board
board_print(board)
## Now hide our ship
my_ship_xaxis = random.randrange(5)
my_ship_yaxis = random.randrange(5)
p... |
"""One liners that make the code shorter."""
try:
import simplejson as json
except ImportError:
import json
from json_schema_validator.schema import Schema
from json_schema_validator.validator import Validator
_default_deserializer = json.loads
def validate(schema_text, data_text, deserializer=_default_des... |
from re import search
from lib.utils.printer import *
def errors(content,url):
patterns = ("<font face=\"Arial\" size=2>error \'800a0005\'</font>",
"<h2> <i>Runtime Error</i> </h2></span>",
"<p>Active Server Pages</font> <font face=\"Arial\" size=2>error \'ASP 0126\'</font>",
"<b> Description: </b>An unha... |
"""This module is used to find files used by run-webkit-tests and
perftestrunner. It exposes one public function - find() - which takes
an optional list of paths, optional set of skipped directories and optional
filter callback.
If a list is passed in, the returned list of files is constrained to those
found under the... |
import sys
import os
import sys
sys.stderr.write("Warning: You are using test runners in legacy mode\n. "
"That means you have 'python.tests.enableUniversalTests=false' in registry.\n"
"This mode will be dropped in 2021. Consider removing this entry from registry and migrating to new t... |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import os
import socket
from oslo_config import cfg
from oslo_db import options as db_options
from oslo_log import log as logging
from oslo_middleware import cors
from oslo_policy import opts as policy_opts
f... |
# -*- coding: latin1 -*-
################################################################################################
# Script para coletar egos do Twitter:
# Mínimo de 2 listas
# Mínimo de 5 membros em cada lista
#
import tweepy, datetime, sys, time, json, os.path, shutil, time
reload(sys)
sys.setdefaultencoding... |
"""
Settings for Oscar's demo site.
Notes:
* The demo site uses the stores extension which requires a spatial database.
The DATABASES settings is not set in this module. Instead, you should add
the appropriate details to your settings_local module.
"""
import os
# Django settings for oscar project.
PROJECT_DI... |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
tests.test_process
~~~~~~~~~~~~~~~~~~
Provides main unit tests.
"""
import nose.tools as nt
import itertools as it
from decimal import Decimal
from functools import partial
from operator import itemgetter, truediv, eq, is_not, contains
from collections import def... |
#!/usr/bin/env python
import os
import sys
from Cython.Build import cythonize
import numpy as np
## TODO: debug setuptools & cython
try:
from setuptools import setup, find_packages, Extension, Command
except ImportError:
from distutils.core import setup, Extension, Command
if sys.argv[-1] == 'publish':
... |
from django.shortcuts import render
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.contrib import auth
from django.core.context_processors import csrf
from forms import MyRegistrationForm
def home(request):
return render(request,"home.html")
def login(req... |
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import authenticate, login, logout
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.contrib.auth.decorators import login_required
from django.conf import settings
def user_... |
# -*- coding: utf-8 -*-
u"""Test auth.guest
:copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import pytest
def test_happy_path(auth_fc):
fc = auth_fc
from pykern... |
"""
Django settings for humangen project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
from dja... |
"""Unit tests for LocalFileSystem."""
import filecmp
import os
import shutil
import tempfile
import unittest
import mock
from apache_beam.io import localfilesystem
from apache_beam.io.filesystem import BeamIOError
from apache_beam.io.filesystems import FileSystems
def _gen_fake_join(separator):
"""Returns a call... |
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GObject
from .plantlist import PlantList
from .reslist import ResourceList
from .cards import PlantType
class FireBox(Gtk.Box):
def __init__(self, plant_index, dcb):
super(FireBox, self).__init__(\
orientation = Gtk... |
#!/usr/bin/etc python
import sys
import time
import os
import json
def readfile(fn):
result = {}
result["Turns"] = {}
current_turn = 0
key_index = 0
keys = ["Turn", "You", "TickTock", "Appropriateness"]
for l in open(fn):
if ":" in l:
key = l.split(":")[0]
value = ":".join(l.split(":")[1:]... |
import json
jsondata = open('exer1-interface-data.json').read()
json_object = json.loads(jsondata)
print(
"=======================================================================================" "\n"
"DN Description Speed MTU" "\n"
"---------... |
"""Dispatches tests, either sharding or replicating them.
Performs the following steps:
* Create a test collection factory, using the given tests
- If sharding: test collection factory returns the same shared test collection
to all test runners
- If replciating: test collection factory returns a unique test co... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2016 Ryan Fan
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, c... |
""" Populate test database for examples.
Check to see if the user has created an example test profile, if not
create a fake example profile. A fake example profile uses an in memory
pretent hypervisor. This is sufficient for seeing the Testpool client
API in action and for debugging.
This code would normally not be r... |
from setuptools import find_packages, setup
__plugin_name__ = "Blocklist"
__author__ = "John Garland"
__author_email__ = "<EMAIL>"
__version__ = "1.3"
__url__ = "http://deluge-torrent.org"
__license__ = "GPLv3"
__description__ = "Download and import IP blocklists"
__long_description__ = __description__
__pkg_data__ = ... |
import numpy
from chainer import backend
from chainer import initializer
# Original code forked from MIT licensed keras project
# https://github.com/fchollet/keras/blob/master/keras/initializations.py
class Uniform(initializer.Initializer):
"""Initializes array with a scaled uniform distribution.
Each ele... |
from rest_framework import serializers
from bulbs.content.serializers import ContentSerializer
from bulbs.super_features.models import BaseSuperFeature
from bulbs.super_features.utils import get_superfeature_model
SUPERFEATURE_MODEL = get_superfeature_model()
class BaseSuperFeatureDataField(serializers.Field):
... |
from lxml.html import tostring
import logging
import lxml.html
import re, sys
from .cleaners import normalize_spaces, clean_attributes
from .encoding import get_encoding
from .compat import str_
utf8_parser = lxml.html.HTMLParser(encoding='utf-8')
def build_doc(page):
if isinstance(page, str_):
encoding ... |
"""Functions to manage the user's Launchpad user ID.
This allows the user to configure their Launchpad user ID once, rather
than once for each place that needs to take it into account.
"""
from __future__ import absolute_import
from bzrlib import (
errors,
trace,
transport,
)
from bzrlib.config impor... |
"""The setuptools based setup module for saokit.
Based on:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description... |
#!/usr/bin/env python
"""Execute the tests for bs_mason.
The golden test outputs are generated by the script generate_outputs.sh.
You have to give the root paths to the source and the binaries as arguments to
the program. These are the paths to the directory that contains the 'projects'
directory.
Usage: run_tests... |
"""
An enumeration type that lists the render modes supported by FreeType 2. Each
mode corresponds to a specific type of scanline conversion performed on the
outline.
FT_PIXEL_MODE_NONE
Value 0 is reserved.
FT_PIXEL_MODE_MONO
A monochrome bitmap, using 1 bit per pixel. Note that pixels are stored in
most-si... |
from django.core.exceptions import ValidationError
from oscar.core.loading import get_model
from rest_framework import generics, exceptions
from rest_framework.relations import HyperlinkedRelatedField
from oscarapi import permissions
__all__ = ('BasketPermissionMixin',)
Basket = get_model('basket', 'Basket')
clas... |
"""
Time and datetime picker widgets
"""
from traitlets import Unicode, Bool, validate, TraitError
from .trait_types import datetime_serialization, Datetime, naive_serialization
from .valuewidget import ValueWidget
from .widget import register
from .widget_core import CoreWidget
from .widget_description import Descri... |
try:
import cProfile as profile
except ImportError:
import profile
import pstats
from cStringIO import StringIO
from django.conf import settings
class ProfileMiddleware(object):
"""
Simple profile middleware to profile django views. To run it, add ?prof to
the URL like this:
http://localh... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'wufulin'
v1 = [(0, -1), (0, 1)] # 竖直方向
v2 = [(1, 0), (-1, 0)] # 水平方向
v3 = [(1, -1), (-1, 1)] # 右上到左下
v4 = [(-1, -1), (1, 1)] # 左上到右下
v = [v1, v2, v3, v4]
WIN_NUMBER = 5
MAX_NUMBER = 15
def whowin(clist, x, y, chesstype, n=WIN_NUMBER):
re... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import json
import traceback
try:
import boto
import boto.ec2
import boto.sns
... |
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Translation.revision'
db.alter_column('trans_translation', 'revision', self.gf('django.db.models.fields.CharField')(max_length=100))
def backwards(self, ... |
#!/usr/bin/python2
import sys
import time
import subprocess
import re
def format_report(client_output):
version_re = re.compile('TLS (v1\.[0-2]) using ([A-Z0-9_]+)')
version_match = version_re.search(client_output)
#print client_output
if version_match:
return "Established %s %s" % (version... |
""" Unit tests for the ninja.py file. """
import gyp.generator.ninja as ninja
import unittest
import StringIO
import sys
import TestCommon
class TestPrefixesAndSuffixes(unittest.TestCase):
if sys.platform in ('win32', 'cygwin'):
def test_BinaryNamesWindows(self):
writer = ninja.NinjaWriter('f... |
from mock import patch, MagicMock
from .. import forwarding_rule
from ...tests import TestGCP
@patch('cloudify_gcp.utils.assure_resource_id_correct', return_value=True)
@patch('cloudify_gcp.gcp.ServiceAccountCredentials.from_json_keyfile_dict')
@patch('cloudify_gcp.utils.get_gcp_resource_name', return_value='valid_n... |
import unittest
import ctypes
import numpy
import numpy as np
from pyscf.pbc import gto as pgto
L = 1.5
n = 41
cl = pgto.Cell()
cl.build(
a = [[L,0,0], [0,L,0], [0,0,L]],
mesh = [n,n,n],
atom = 'He %f %f %f' % ((L/2.,)*3),
basis = 'ccpvdz')
numpy.random.seed(1)
cl1 = pgto.Cell()
cl1.build(a = numpy.r... |
"""
The records module defines the Record class, which gathers and stores
information about an individual simulation or analysis run.
Classes
-------
Record - gathers and stores information about an individual simulation or
analysis run.
Can be instantiated directly, but more usually created by the
... |
import django_tables2 as tables
from django_tables2.utils import Accessor
from utilities.tables import BaseTable, ToggleColumn
from .models import Tenant, TenantGroup
TENANTGROUP_ACTIONS = """
{% if perms.tenancy.change_tenantgroup %}
<a href="{% url 'tenancy:tenantgroup_edit' slug=record.slug %}" class="btn bt... |
from myhdl import Signal, always, intbv, instance, block, delay, instances
from hdmi.models import EncoderModel
class HDMITxModel(object):
"""
A non-convertible HDMI Transmitter Model which encodes the input video and AUX data and transmits it.
This is modelled after the xapp495 HDMI Tx module.
Ar... |
#!/usr/bin/env python
"""
Script that emulates the behaviour of a shell to edit the CS config.
"""
import sys
import os.path
import cmd
from DIRAC.Core.Utilities.ColorCLI import colorize
from DIRAC.Core.Base import Script
from DIRAC.ConfigurationSystem.private.M... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
from ansible_collect... |
from __future__ import print_function
import argparse
import glob
import os
import re
import sys
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"filenames", help="list of files to check, all files if unspecified", nargs='*')
rootdir = os.path.dirname(__file__) + "/../"
... |
import re
import os
import logging
from autotest.client import utils
from autotest.client import lv_utils
from autotest.client.shared import error
from virttest import libvirt_storage
from virttest import utils_test
from virttest import virsh
from virttest.libvirt_xml.pool_xml import PoolXML
from provider import libvir... |
"""Actions to start various modules.
"""
# Copyright (c) 2005-2008, Enthought, Inc.
# License: BSD Style.
import new
# Local imports.
from mayavi.core.registry import registry
from mayavi.core.metadata import ModuleMetadata
from mayavi.core.pipeline_info import PipelineInfo
from mayavi.action.filters import FilterAc... |
import logging
import time
import uuid
import redis
LOG = logging.getLogger("fuzzmanager.utils")
class RedisLock(object):
"""Simple Redis mutex lock.
based on: https://redislabs.com/ebook/part-2-core-concepts/chapter-6-application-components-in-redis \
/6-2-distributed-lo... |
"""
WSGI config for djbuildbot project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION... |
#!/usr/bin/env python
# encoding: utf-8
# -*- coding: iso-8859-15 -*-
'''
PyfichAnaly -- shortdesc
PyfichAnaly is a description
It defines classes_and_methods
@author: user_name
@copyright: 2014 organization_name. All rights reserved.
@license: license
@contact: user_email
@deffield updated: Updated
'''
... |
r"""
Summary
----------
Start up a simple ``/bin/true`` container while monitoring
output from ``docker events`` command. Verify expected events
appear after container finishes and is removed.
Operational Summary
----------------------
#. Listen for events
#. Run /bin/true container
#. Check parsing of events and c... |
# -*- coding: utf-8 -*-
import xlrd
import re
class Reader(object):
def __init__(self, FileName):
self.filename = FileName
def readline(self):
return ''
class XlsReader(Reader):
def __init__(self, fileName):
super(XlsReader, self).__init__(self)
self.__book__ = xlrd.open... |
"""Common classes and functions for the `doorstop.core` package."""
import hashlib
import os
import re
import yaml
from doorstop import common, settings
from doorstop.common import DoorstopError
log = common.logger(__name__)
class Prefix(str):
"""Unique document prefixes."""
UNKNOWN_MESSGE = "no document... |
"""Test HomeKit util module."""
from unittest.mock import Mock
import pytest
import voluptuous as vol
from homeassistant.components.homekit.const import (
BRIDGE_NAME,
CONF_FEATURE,
CONF_FEATURE_LIST,
CONF_LINKED_BATTERY_SENSOR,
CONF_LOW_BATTERY_THRESHOLD,
DEFAULT_CONFIG_FLOW_PORT,
DOMAIN,... |
from .config import initialize, extra_settings
from .core.config import global_settings, ignore_status_code
from .core.agent import shutdown_agent, register_data_source
from .samplers.decorators import data_source_generator, data_source_factory
from .api.application import (application_instance as application,
... |
from openpathsampling.engines.dynamics_engine import DynamicsEngine
from openpathsampling.engines.snapshot import BaseSnapshot
from openpathsampling.engines.toy import ToySnapshot
import numpy as np
import os
import logging
import psutil
import signal
import shlex
import time
import linecache
logger = logging.getLo... |
# Stack Packages
from pyramid.httpexceptions import HTTPMethodNotAllowed, HTTPFound
from pyramid.renderers import render
from pyramid.response import Response
# Home Automation Packages
from core.models import List, ListCategory
from .models import User
class BaseView(object):
"""
Delegates HTTP requests to V... |
from rest_framework import serializers as ser
from rest_framework import exceptions
from framework.auth.oauth_scopes import public_scopes
from osf.models import ApiOAuth2PersonalToken
from api.base.serializers import JSONAPISerializer, LinksField, IDField, TypeField
class ApiOAuth2PersonalTokenSerializer(JSONAPISer... |
import os
import sys
import tempfile
import unittest
if sys.version_info[0] == 2:
import mock
else:
import unittest.mock as mock
from pyfakefs import fake_filesystem_unittest
from skia_gold_common import output_managerless_skia_gold_session as omsgs
from skia_gold_common import skia_gold_properties
from skia_gol... |
{
'name': 'Price list report',
'version': '0.4',
'depends': ['product'],
'author': 'Vadim',
'website': 'http://based.at',
'category': 'Sales Management',
'summary': 'Products list with prices',
'description': """
Price list report
=================
Generates products list with prices. In... |
"""Shared testing utilities."""
class _MockCalled(object):
def __init__(self, result=None):
self.called_args = []
self.called_kwargs = []
self.result = result
def check_called(self, test_case, args_list, kwargs_list=None):
test_case.assertEqual(self.called_args, args_list)
... |
import mock
from django.core.management import call_command
from django.test import TestCase
from django.core.management.base import CommandError
from seqr.models import VariantTagType
class CopyProjectTagsTest(TestCase):
fixtures = ['users', '1kg_project']
@mock.patch('seqr.management.commands.copy_projec... |
import os
import pyexcel as p
from pyexcel_io import get_data, save_data
from pyexcel_io.exceptions import NoSupportingPluginFound
from nose import SkipTest
from nose.tools import eq_, raises
IN_TRAVIS = "TRAVIS" in os.environ
def test_issue_8():
test_file = "test_issue_8.csv"
data = [[1, 2], [], [], [], [... |
#! /usr/bin/env python
########################################################################
# $HeadURL$
# File : dirac-admin-get-site-protocols
########################################################################
"""
Check the defined protocols for all SEs of a given site
"""
__RCSID__ = "$Id$"
from DIRAC... |
#!/bin/env python
# -*- coding: utf-8 -*-
from project import models
class BaseSolution(object):
"""Base abstract class for a CVRP solution"""
def __init__(self, cvrp_problem, vehicles):
"""Initialize class
Parameters:
cvrp_problem: CVRPData instance
vehicles: Vehicle... |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... |
import pytest
from tests.hs2.hs2_test_suite import HS2TestSuite, needs_session
from TCLIService import TCLIService
from tests.common.impala_cluster import ImpalaCluster
class TestFetchFirst(HS2TestSuite):
IMPALA_RESULT_CACHING_OPT = "impala.resultset.cache.size";
def __test_invalid_result_caching(self, sql_stmt):... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""A module that implements an iterator for reading mini-batches with random
sentence order.
"""
import sys
import mmap
import logging
import numpy
from numpy import random
from theanolm.backend import IncompatibleStateError
from theanolm.parsing.batchiterator import Ba... |
# -*- coding: utf-8 -*-
from datetime import datetime
from sqlalchemy.types import Integer, String, DateTime
from geoalchemy2.types import Geometry
from geoalchemy2.shape import to_shape, from_shape
from shapely.geometry import LineString, box
import xcsoar
from flask import current_app
from skylines.database impor... |
from os.path import join as pjoin
# Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z"
_version_major = 0
_version_minor = 2
_version_micro = '' # use '' for first of series, number for 1 and above
_version_extra = 'dev'
#_version_extra = '' # Uncomment this for full releases
# Construct ful... |
"""Asynchronous Actor-Critic Agents.
Implementations refer to Denny Britz implementations at
https://github.com/dennybritz/reinforcement-learning/tree/master/PolicyGradient/a3c
"""
import copy
import threading
import numpy as np
from SafeRLBench import AlgorithmBase
from SafeRLBench.error import add_dependency
tr... |
import avango
import avango.script
import avango.gua
from examples_common.GuaVE import GuaVE
class TimedRotate(avango.script.Script):
TimeIn = avango.SFFloat()
MatrixOut = avango.gua.SFMatrix4()
def evaluate(self):
self.MatrixOut.value = avango.gua.make_rot_mat(self.TimeIn.value * 2.0,
... |
from setuptools import setup, find_packages
setup(
name='tuhi-flask',
version='0.1',
license='AGPL3',
author='icasdri',
author_email='<EMAIL>',
description='Simple self-hosted synchronized notes (Tuhi Server Reference Implementation)',
url='https://github.com/icasdri/tuhi-flask',
classi... |
from progressivis.core.utils import filepath_to_buffer
from . import ProgressiveTest, skip, skipIf
import requests, tempfile, os
HTTP_URL = ('http://s3.amazonaws.com/h2o-release/h2o/master'
'/1193/docs-website/resources/publicdata.html')
S3_URL = ('s3://h2o-release/h2o/master/1193/docs-website'
... |
from datetime import datetime, timedelta
from random import choice, randint
sites = {
"checkio.org": [
"http://checkio.org/task2",
"http://www.checkio.org/task2",
"http://wwww.checkio.org/profile",
"http://checkio.org/info/task/1",
"http://new.checkio.org",
"http://d... |
from vitrage.graph.utils import check_property_with_regex
def check_filter(data, attr_filter, *args):
"""Check attr_filter against data
:param data: a dictionary of field_name: value
:param attr_filter: a dictionary of either
field_name : value (mandatory)
field_name : list of values - data[field... |
from django.contrib.auth import models as auth_models
from django.core import validators
from django.core.files.storage import FileSystemStorage
from django.core.mail import send_mail
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from disease.fil... |
import configparser
from datetime import datetime, timedelta, timezone
from io import BytesIO
from pathlib import Path
import subprocess
from typing import Any, Optional
from . import ConfigurationError, TemporaryCheckError, Wakeup
from .util import CommandMixin, NetworkMixin, XPathMixin
from ..util.subprocess import ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.