content stringlengths 4 20k |
|---|
# time_test.py
"""Try reading large sets of files, profiling how much time it takes"""
# Copyright (c) 2008-2012 Darcy Mason
# This file is part of pydicom, relased under an MIT license.
# See the file license.txt included with this distribution, also
# available at http://pydicom.googlecode.com
import os.path
i... |
ROOT_SCOPE_METHOD( MD( 'Range', 'RANGE_FACTORY_single()' ) )
TEST( """ Range @ 0 4 produce ( StringExtract ) == "[ 0 1 2 3 4 ]" """ )
OBJECT( 'RANGE_FACTORY',
methods = [
MS( ARG( CW( '@' ), CG( 'ANY', 'first' ), CG( 'ANY', 'last' ) ), """
JUMP__return_ANY( CONTEXT, CONTEXT, $CA(RANGE_new( PARAM_first, ... |
#http imports
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.urls import reverse
#User imports
import django.contrib.auth as auth
from gl_site.custom_auth import login_required, logout_required
#forms
from gl_site.forms.user_registration_form import UserForm, InfoRegistra... |
"""Module providing logging capabilities."""
from __future__ import absolute_import, print_function
from .version import __version__
__all__ = (
'__version__',
) |
import os
import sys
# pylint: disable-msg=F0401
# from setuptools import setup, find_packages
from setuptools import find_packages
from numpy.distutils.core import setup
from numpy.distutils.misc_util import Configuration
here = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.normpath(os.path... |
"""Models the effect of prefetching resources from a loading trace.
For example, this can be used to evaluate NoState Prefetch
(https://goo.gl/B3nRUR).
When executed as a script, takes a trace as a command-line arguments and shows
statistics about it.
"""
import itertools
import operator
import common_util
import d... |
__revision__ = "src/engine/SCons/Tool/MSCommon/__init__.py 2009/09/04 16:33:07 david"
__doc__ = """
Common functions for Microsoft Visual Studio and Visual C/C++.
"""
import copy
import os
import re
import subprocess
import SCons.Errors
import SCons.Platform.win32
import SCons.Util
from SCons.Tool.MSCommon.sdk imp... |
import logging
import logging.config
import json
import argparse
import jobs
import utils
logger = logging.getLogger(__name__)
run_logger = logging.getLogger('josync_run')
def main():
parser = argparse.ArgumentParser(description='Test e-mail sending of Josync.')
parser.add_argument('address',help='e-mail ad... |
"""Tests for tfgan.examples.networks.networks."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from google3.third_party.tensorflow_models.gan.pix2pix import networks
class Pix2PixTest(tf.test.TestCase):
def test_generator_run... |
"""
draft
-----
Draft is a small web app designed to make JavaScript library development and
debugging more fun.
"""
import sys
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system("python setup.py sdist upload")
sys... |
# -*- coding: utf-8 -*-
"""
Tests for Wikia helper
"""
import unittest
import mock
from lyricstagger.helpers import DarkLyrics
from test import fakers
# pylint: disable=R0904
class DarkLyricsCheck(unittest.TestCase):
"""Tests for darklyrics.com downloader"""
def test_parse_artist_link_bad(self):
"""T... |
import atexit
import json
import os
import sys
import time
import threading
from py_trace_event import trace_time
from py_utils import lock
_lock = threading.Lock()
_enabled = False
_log_file = None
_cur_events = [] # events that have yet to be buffered
_tls = threading.local() # tls used to detect forking/etc
_... |
from avresearcher.app import _check_es_config, _validate
from copy import deepcopy
from elasticsearch import Elasticsearch
from nose.tools import assert_equal, assert_in, assert_raises, assert_true
config = {
"COLLECTIONS_CONFIG": {
"index1": {
"index_name": "hello?",
"enabled_fac... |
from datetime import date
import os
import logging
class Config:
base_path = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
DATABASE_CONNECT_OPTIONS = {}
SECRET_KEY = 'secret' # Change this for real use
CSRF_ENABLED = True
CSRF_SESSION_KEY = '' # Change this for real use
D... |
from agrc import messaging
import unittest
from mock import patch
@patch('agrc.messaging.SMTP')
class sendEmailFunction(unittest.TestCase):
to = '<EMAIL>'
sub = 'test sub'
body = 'test body'
def test_sendmail_fired(self, SMTP_mock):
# sendmail should fire only when testing is False
sm... |
from thug.ThugAPI.ThugVulnModules import ThugVulnModules
class TestThugVulnModules:
vuln_modules = ThugVulnModules()
def test_invalid_version(self):
assert not self.vuln_modules.invalid_version('1.6.0.32')
assert not self.vuln_modules.invalid_version('1')
assert self.vuln_modules.inva... |
import unittest
import rpy2.robjects as robjects
rinterface = robjects.rinterface
import array
class RInstanceTestCase(unittest.TestCase):
def tearDow(self):
robjects.r._dotter = False
def testGetItem(self):
letters_R = robjects.r["letters"]
self.assertTrue(isinstance(letters_R, rob... |
import subprocess
from subprocess import CalledProcessError
from populator.destination import MongoDestination
from populator.utils.common import info
class DirectDestination(MongoDestination):
def __init__(self, db_name=None, db_host=None, db_user=None, db_password=None,
drop_db=True, direct_us... |
"""
Containers for the type and configuration data of information resources.
Exports
-------
ResourceConfiguration
The type and configuration data of an information resource.
"""
from doxhooks.functions import importattr
__all__ = [
"ResourceConfiguration",
]
class ResourceConfiguration(dict):
"""
... |
from warnings import warn
import pandas as pd
from zipline.assets import Asset, Future
from zipline.utils.input_validation import expect_types
from .utils.enum import enum
from zipline._protocol import BarData # noqa
# Datasource type should completely determine the other fields of a
# message with its type.
DATAS... |
import six
if six.PY3:
import unittest # noqa
else: # noqa
import unittest2 as unittest # noqa
from mock import Mock
from twilio.rest.resources import Applications
class ApplicationsTest(unittest.TestCase):
def setUp(self):
self.parent = Mock()
self.resource = Applications("http://api.... |
#!/usr/bin/env python3
import argparse
import logging
import re
import markdown2 as m
from jinja2 import Environment, FileSystemLoader
from os import makedirs, mkdir, walk
from os.path import basename, exists, getmtime, split
from shutil import copy2
from sys import exit
l = logging.getLogger('Flourish! Makeme')
... |
import os,sys
import numpy as np
from prepare_adult_data import *
sys.path.insert(0, '../../fair_classification/') # the code for fair classification is in this directory
import utils as ut
import loss_funcs as lf # loss funcs that can be optimized subject to various constraints
def test_adult_data():
""" Load t... |
from flask_table import Table, Col
"""What if we need to apply some classes (or any other attribute) to
the td and th HTML attributes? Maybe you want this so you can apply
some styling or attach some javascript.
NB: This example just handles the adding of some fixed attributes to a
column. If you want to do somethin... |
import sys
import select
import socket
import string
import SocketServer
from random import choice
from rhn.connections import idn_ascii_to_puny
from spacewalk.common.rhnLog import initLOG, log_debug, log_error
from spacewalk.common.rhnConfig import initCFG, CFG
from spacewalk.server import rhnSQL
try: # python 3
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from time import strftime
import time
import json
from traceback import format_exc
class StatLogger():
"""StatLog Util"""
def __init__(self, config):
logfile = config['file']
self._f = open(logfile, 'a+')
self._levels = config['levels']
... |
from abc import ABCMeta, abstractmethod
class Artifact(metaclass=ABCMeta):
def __init__(self, *, provider, name=None, image=None, version=None,
environment=None):
if image:
if not version:
raise ValueError(
'Version must be specified togethe... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import re
from collections import defaultdict
from pex.compatibility import to_bytes
from pants.backend.jvm.tasks.classpath_util import ClasspathUtil
from ... |
import copy
import six
import st2common.bootstrap.sensorsregistrar as sensors_registrar
from st2api.controllers.v1.sensors import SensorTypeController
from st2tests.api import FunctionalTest
from st2tests.api import APIControllerWithIncludeAndExcludeFilterTestCase
http_client = six.moves.http_client
__all__ = ["Se... |
'''Convert to and from Roman numerals
This program is part of 'Dive Into Python 3', a free Python book for
experienced programmers. Visit http://diveintopython3.org/ for the
latest version.
'''
roman_numeral_map = (('M', 1000),
('CM', 900),
('D', 500),
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import copy
from collections import OrderedDict, defaultdict
import six
from ezspanner.fields import SpannerField
from ezspanner.query_utils import LOOKUP_SEP, Q, F
from .exceptions import ModelError, SpannerInde... |
import warnings
import numpy as np
from netCDF4 import Dataset
from oceans.ocfis import get_profile, wrap_lon180
def _woa_variable(variable):
_VAR = {
"temperature": "t",
"salinity": "s",
"silicate": "i",
"phosphate": "p",
"nitrate": "n",
"oxygen_saturation": "O",... |
from remacs import log
from remacs.pipebuff import PipeBuff
DEFAULT_WINDOW = 5
class InAcker(object):
def __init__(self):
self.outpipe = None
self.ack_window = DEFAULT_WINDOW
self.ack_cur = 0
self.pkt_count = 0
def inPacket(self):
self.pkt_count = self.pkt_count + 1
... |
"""Support for Xiaomi aqara binary sensors."""
import logging
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.core import callback
from homeassistant.helpers.event import async_call_later
from . import XiaomiDevice
from .const import DOMAIN, GATEWAYS_KEY
_LOGGER = logging.get... |
# stdlib
import asyncio
import json
from typing import Any
from unittest.mock import Mock
from unittest.mock import patch
# third party
from aiortc import RTCDataChannel
from aiortc import RTCPeerConnection
from aiortc import RTCSessionDescription
from aiortc.contrib.signaling import object_from_string
from nacl.signi... |
from essentia_test import *
from numpy import dot # dot product
testdir = join(filedir(), 'singlegaussian')
class TestSingleGaussian(TestCase):
def assertInverse(self, cov, icov):
(rows,cols) = cov.shape
self.assertEqual(rows, cols)
I = zeros([rows,cols]) # identity matrix
for i ... |
from unittest import TestCase
from qtk.templates import Template as T
import copy
from qtk import Controller, Field, QuantLibConverter as qlc
import QuantLib as ql
_bond_sample_data = [
{
'AsOfDate': '2016-06-14',
'Country': 'US',
'Currency': 'USD',
'DataSource': 'TEST',
'InstrumentCollection':... |
#!/usr/bin/env python
import time
import random
import mock
import unittest
import marktime
class ApiTestCase(unittest.TestCase):
@mock.patch('marktime.time.time')
def test_start_stop(self, mock_time):
mock_time.return_value = 123
marktime.start('test run')
self.assertEquals(markt... |
import itertools
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
from openstackclient.i18n import _
from openstackclient.network import common
from openstackclient.network import sdk_utils
RULE_TYPE_BANDWIDTH_LIMIT = 'bandwidth-limit'
RULE_TYPE_DSCP_MARKING = 'dscp-marki... |
"""Evaluation library."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from absl import flags
from absl import logging
from compare_gan import datasets
from compare_gan import eval_utils
from compare_gan import utils
import gin
import numpy a... |
#!/usr/bin/env python3
import pygame,sys
from pygame.locals import *
from random import randint
pygame.init()
from wars.block import Block
from wars.device import Device
# We'll run (target) at 30FPS for now
FPS = 30
fpsClock = pygame.time.Clock()
SCREEN_SIZE = (892, 595)
speed = 1
# Initialise general stuff
DISPL... |
"""
Hurricane Katrina
-----------------
This example uses the power of Shapely to illustrate states that are likely to
have been significantly impacted by Hurricane Katrina.
"""
__tags__ = ['Lines and polygons']
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import shapely.geometry as sgeom
i... |
import Queue
import threading
import os
import sys
_dryrun = False
_log = None
#----------------------------------------------------------------------------
# Option formatting
#----------------------------------------------------------------------------
def formatOpt(flag, arg):
if arg:
arg = str(arg).re... |
from test.conftest import *
import pytest
@pytest.mark.run(order=1)
@post('/user/list', {"name": "Test List"})
def test_create_user_list(result=None):
assert result.status_code == 200
assert result.json()['name'] == 'Test List'
global list_id
list_id = result.json()['id']
global_id['list_id'] = re... |
"""
Tests for open ended grading interfaces
./manage.py lms --settings test test lms/djangoapps/open_ended_grading
"""
import json
from mock import MagicMock, patch, Mock
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Group, User
from django.conf import settings
from mitxmako.sho... |
from msrest.serialization import Model
class ComputeNodeEnableSchedulingOptions(Model):
"""Additional parameters for the ComputeNode_enable_scheduling operation.
:param timeout: The maximum time that the server can spend processing the
request, in seconds. The default is 30 seconds. Default value: 30 .
... |
from openerp import api, fields, models
from openerp.exceptions import UserError
class Summary(models.Model):
_inherit = 'myo.summary'
state = fields.Selection([
('draft', 'Draft'),
('revised', 'Revised'),
('waiting', 'Waiting'),
('done', 'Done'),
('canceled', 'Cancele... |
import os.path as op
import numpy as np
import pytest
import matplotlib.pyplot as plt
from mne import (read_events, Epochs, pick_types, read_cov, create_info,
EpochsArray)
from mne.channels import read_layout
from mne.io import read_raw_fif
from mne.utils import run_tests_if_main
from mne.viz import ... |
import numpy as np
import tensorflow as tf
def xavier_weight_init():
"""
Returns function that creates random tensor.
The specified function will take in a shape (tuple or 1-d array) and must
return a random tensor of the specified shape and must be drawn from the
Xavier initialization distribution.
Hin... |
"""
Tests for views
"""
__test__ = {"doctest": """
# Initialize by deleting all Link objects
>>> from models import Link
>>> Link.objects.all().delete()
>>> from django.test import Client
>>> client = Client()
# Index page
>>> r = client.get('/')
>>> r.status_code # /
200
>>> r.template[0].name
'shortener/index.htm... |
from collections import defaultdict
from django import forms
from django.forms import widgets
from django.utils.translation import ugettext
import jinja2
import olympia.core.logger
from olympia import amo
from olympia.access import acl
from olympia.files.models import File
from olympia.lib import happyforms
from oly... |
"""Test Wallet encryption"""
import time
from test_framework.test_framework import PivxTestFramework
from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
assert_greater_than,
assert_greater_than_or_equal,
)
class WalletEncryptionTest(PivxTestFramework):
def set_test_params(sel... |
# This script tests if full reversability like
# JANUS is achieved by FastPM, without
# using int64 fixed point.
#
# JANUS: https://arxiv.org/pdf/1704.07715v1.pdf
#
# We do not need the high precision int64 representable
# because we only use very few steps (I think)
# Using float32 increases the error to about 1e-5.
... |
from handler.base_plugin import BasePlugin
class UserMetaPlugin(BasePlugin):
__slots__ = ("users",)
def __init__(self):
"""Adds `user_info` to messages and events's meta with user's data
if available (https://vk.com/dev/users.get). You can refresh data
with coroutine stored in `meta['... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import plottool as pt
import utool as ut
import numpy as np
from ibeis.other import ibsfuncs
from ibeis.viz import viz_helpers as vh
from ibeis.viz import viz_chip
from ibeis.viz import viz_matches # NOQA
(print,... |
#!/usr/bin/python
# example invocations:
# ./zikburner.py -m dump -a 0 -l 20 -d /dev/ttyUSB0
# ./zikburner.py -m burn -d /dev/ttyUSB0 -f ../from-serial/lib_crc32.h -v
import sys
import os
import zlib
import time
def readline():
b = None
while True:
c = ser.read()
if c:
if c == '\... |
#!/usr/bin/env python3
import binascii
import struct
import sys
import socket
import time
HOST, PORT = "localhost", 54321
def parse_answer(time, answer):
if len (answer) == 35:
if answer[0] >= 0x08 and answer[0] <= 0x0B:
r_timestamp = answer[1:9]
r_ciphertext = answer[9:-10]
... |
from abc import ABCMeta, abstractmethod, abstractproperty
class IService(object):
__metaclass__ = ABCMeta
@abstractmethod
def get_thread_messages(self, actor, thread, limit=None, offset=None):
"""
:type actor: L{pyligaforex.services.chats.interfaces.IActor}
:type thread: L{pyligaf... |
from __future__ import absolute_import
import logging
from kudzu.context import CONTEXT_VARS, RequestContext
class RequestContextFilter(object):
"""Logging filter which injects information about a current request.
`RequestContextFilter` accepts all log records and extends them by
contextual information... |
import factory
import pemi
import pemi.testing as pt
from pemi.fields import *
class HelloNamePipe(pemi.Pipe):
# Override the constructor to configure the pipe
def __init__(self, **kwargs):
# Make sure to call the parent constructor
super().__init__(**kwargs)
# Add a data source to ou... |
#!/usr/bin/env python
"""
If run as main, ``dumpdistmeta.py`` will print out either a pretty-printed dict
full of the metadata found in the specified distribution or just the value
of a single piece of metadata if metadata-item is specified on the command
line. The distribution can be in the form of an installed eg... |
"""Soundex algorithm
This program is part of "Dive Into Python", a free Python book for
experienced programmers. Visit http://diveintopython.org/ for the
latest version.
"""
__author__ = "Mark Pilgrim (<EMAIL>)"
__version__ = "$Revision: 1.3 $"
__date__ = "$Date: 2004/05/11 19:11:21 $"
__copyright__ = "Copyright (c)... |
#!/usr/bin/env hpython
import hstub, sys
from hermes import misc
from hermes.syslib.completions import getCompleted, Split, SplitSegment
from hermes import Survey
def reversed_iterator(iter):
return reversed(list(iter))
def v2_modified_getStatusFile(survey, only="", reverse=False):
completed = getCompleted(s... |
from constants import *
from time import *
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import GLib
from sound import playWave, audioWrite
import os
import random
from gettext import gettext as _
try:
f... |
from openerp.osv import fields
from openerp.osv.orm import TransientModel
import time
class res_company_create_wizard(TransientModel):
_inherit = 'res.company.create.wizard'
def _get_journal_ids(
self, cr, uid, ids, field_name, arg, context=None):
res = {}
aj_obj = self.pool['acc... |
import datetime
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import kuma.attachments.utils
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
m... |
"""Monkey's Audio streams with APEv2 tags.
Monkey's Audio is a very efficient lossless audio compressor developed
by Matt Ashland.
For more information, see http://www.monkeysaudio.com/.
"""
__all__ = ["MonkeysAudio", "Open", "delete"]
import struct
from ._compat import endswith
from mutagen_culrc import StreamInf... |
# -*- coding: utf8 -*-
import random
import re
from helga.plugins import match
def imgur(image):
"""
Returns an imgur link with a given hash
"""
return 'http://i.imgur.com/{0}.gif'.format(image)
RESPONSES = {
# Direct text responses
r'(gross|disgusting|eww)': (imgur('XEEI0Rn'),), # Dumb an... |
""" Utilities for printing tables """
from __future__ import print_function
from functools import reduce
def print_table(headers, data, col_order=None, sort_by=None):
"""
Print a table.
"""
def get_max_column_widths(cols, headers, data):
return {col_id: reduce(lambda a, x: max(a, len(str(x[col... |
from designate.objects import base
class Record(base.DictObjectMixin, base.PersistentObjectMixin,
base.DesignateObject):
# TODO(kiall): `hash` is an implementation detail of our SQLA driver,
# so we should remove it.
FIELDS = {
'shard': {
'schema': {
... |
from nova.network import model as network_model
from nova import test
from nova.tests import matchers
from nova.virt.vmwareapi import network_util
from nova.virt.vmwareapi import vif
class VMwareVifTestCase(test.NoDBTestCase):
def setUp(self):
super(VMwareVifTestCase, self).setUp()
self.flags(vlan... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'TNLDomains'
db.create_table('tnl_domains', (
('id', self.gf('django.db.models.fi... |
from typing import (
Iterable,
Optional,
)
from pcs.common.fencing_topology import TARGET_TYPE_NODE
from pcs.common import reports as report
from pcs.lib.cib import fencing_topology as cib_fencing_topology
from pcs.lib.cib.tools import (
get_fencing_topology,
get_resources,
)
from pcs.lib.env import Li... |
import numpy as np
import pytest
from numpy.testing import assert_array_equal
from landlab import RasterModelGrid
from landlab.grid import raster_funcs as rfuncs
def test_with_scalars():
"""Test scalar args."""
rmg = RasterModelGrid((4, 5))
id = rfuncs.find_nearest_node(rmg, (0.2, 0.6))
assert id == ... |
"""Public interface for flag definition.
See _example.py for detailed instructions on defining flags.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import REDACTED
from six.moves import shlex_quote
from absl import app as absl_app
from ab... |
import re
from logging import getLogger
from .db import select_groups
from .merge import create_output_table
from .merge import group_by_keys
from .merge import merge_dicts
from .merge import output_row
from .norm import smunch
from .scratch import scratch_tables_with_cols
from .subsidiary import is_subsidiary
from .s... |
import sys
import os
import networkx
import nose.tools
import angr
from angr.analyses.cdg import TemporaryNode
test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../binaries/tests"))
def test_graph_0():
# This graph comes from Fig.1 of paper An Efficient Method of Computing Stati... |
import pytest
from io import StringIO
from ezdxf.lldxf.tagwriter import TagWriter, TagCollector
from ezdxf.lldxf.types import DXFTag, DXFVertex
def setup_stream():
stream = StringIO()
tagwriter = TagWriter(stream)
return stream, tagwriter
def test_write_tag2():
s, t = setup_stream()
t.write_tag2... |
import numpy
from gnuradio import gr
import pmt
import beacon
class aausat4_beacon_parser(gr.basic_block):
"""
docstring for block aausat4_beacon_parser
"""
def __init__(self):
gr.basic_block.__init__(self,
name="aausat4_beacon_parser",
in_sig=[],
out_sig=[]... |
import os
from email.mime.text import MIMEText
import minus.minus as minus
from terminalinterface import TerminalInterface
def create_email(filepaths, collection_name):
"""Create an email message object which implements the
email.message.Message interface and which has the files to be shared
uploaded to m... |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import hashlib
from django.conf import settings
from django.contrib.auth.views import redirect_to_login
from django.core.urlresolvers import resolve, Resolver404, reverse
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.templa... |
import vx
from vx.keybindings import bind, alt, ctrl, keys, KeybindingTable
import vx.movement as move
import vx.utils as utils
import vx.window
import vx.test
import vx.prompt
import vx.undo as undo
from ..pointer import panes, organizer
from functools import partial
def load(window):
return Hopscotch(window)
... |
from pySDC.implementations.problem_classes.HeatEquation_1D_FD_forced import heat1d_forced
from pySDC.implementations.datatype_classes.mesh import mesh, rhs_imex_mesh
from pySDC.implementations.collocation_classes.gauss_radau_right import CollGaussRadau_Right
from pySDC.implementations.sweeper_classes.imex_1st_order imp... |
import mock
import unittest
from yardstick.cmd.commands import testcase
from yardstick.cmd.commands.testcase import TestcaseCommands
class Arg(object):
def __init__(self):
self.casename=('opnfv_yardstick_tc001',)
class TestcaseCommandsUT(unittest.TestCase):
def test_do_list(self):
t = testca... |
from __future__ import division, absolute_import, unicode_literals
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import Qt, SIGNAL
from cola import hotkeys
from cola import qtutils
from cola.compat import ustr
from cola.i18n import N_
from cola.models import prefs
from cola.widgets import defs
def get_value_str... |
from typing import Optional
import logging
from pathlib import Path
from wasabi import msg
import typer
import srsly
from .. import util
from ..training.initialize import init_nlp, convert_vectors
from ..language import Language
from ._util import init_cli, Arg, Opt, parse_config_overrides, show_validation_error
from ... |
from __future__ import division
def round_money(value):
if value is None or value < 0:
raise Exception('Invalid value, amount should be a number and higher than zero.')
return round(value, 2)
def validate_percent_discount(discount):
if discount is None or discount < 0 or discount > 100:
r... |
from PyQt4 import QtCore,QtGui
from tree_sqlalchemy_class import treeNode
import MySQLdb
#import sys
class Nodo():
"""rappresenta i nodi che comporranno l'albero, cioe' tutti gli elementi feature che mmasgis rileva negli shapefiles durante la fase di caricamento del plugin
"""
def __init__(self,header,Id,categor... |
from unittest import TestCase, main
from Rammbock.message import Struct, Field
from Rammbock.templates.primitives import Length
from Rammbock.binary_tools import to_bin
class TestLength(TestCase):
def test_create_length(self):
length = Length('5')
self.assertTrue(length.static)
def test_crea... |
#!/usr/bin/python
"""
Script to apply a primary-beam correction to a mosaic image
"""
import argparse
from argparse import RawTextHelpFormatter
from astropy.io import fits as pf
import astropy.wcs as pywcs
import os
import sys
import numpy as np
import scipy.ndimage
from scipy import interpolate
def main(mosaicfits, ... |
import serial
import json
import random
import time
import datetime
import threading, Queue
import logging
import struct
import collections
from bottle import route, run, template
import IR_functions as irfun
import time
import logging
"""
logging.basicConfig(filename=__file__.replace('.py','.log'),level=logging.DEBU... |
# This program takes a C header/source as the input and produces
#
# with --keyword=enum: the list of all enums
# with --keyword=struct: the list of all structs
#
# the output styles:
#
# --enum DBUS_POINTER_NAME1,
# DBUS_POINTER_NAME2,
# DBUS_POINTER_NAME3,
#
# --list NAME1
# NAME... |
# -*- coding: utf-8 -*-
"""
Serve a dar modo ai giocatori di segnalare una tipica svista nella
digitazione, oppure un errore sintattico o grammaticale.
"""
#= IMPORT ======================================================================
from src.enums import GRAMMAR
from src.log import log
from src.note import ... |
from __future__ import with_statement
from functools import wraps
import sys
from fabric import state
from fabric.utils import abort, warn, error
from fabric.network import to_dict, normalize_to_string
from fabric.context_managers import settings
from fabric.job_queue import JobQueue
from fabric.task_utils import cra... |
import simple_salesforce
from cumulusci.tasks.salesforce import BaseSalesforceApiTask
class is_rd2_enabled(BaseSalesforceApiTask):
def _run_task(self):
try:
settings = self.sf.query(
"SELECT npsp__IsRecurringDonations2Enabled__c "
"FROM npe03__Recurring_Donations... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}
try:
from cs import CloudStackException
except ImportError:
pass # Handled... |
import pkg_resources
from absl.testing import absltest
from absl.testing import parameterized
from integration_tests.dataproc_test_case import DataprocTestCase
class ConnectorsTestCase(DataprocTestCase):
COMPONENT = "connectors"
INIT_ACTIONS = ['connectors/connectors.sh']
BQ_CONNECTOR_VERSION = "1.2.0"
... |
#!/usr/bin/env python
import os, sys, random
import logging as log
from optparse import OptionParser
import numpy as np
import text.util, unsupervised.nmf, unsupervised.rankings, unsupervised.util
# --------------------------------------------------------------
def main():
parser = OptionParser(usage="usage: %prog [... |
import os
PUPPETDB_HOST = os.getenv('PUPPETDB_HOST', 'puppetdb')
PUPPETDB_PORT = int(os.getenv('PUPPETDB_PORT', '8080'))
# Since this is an env it will always be a string, we need
# to conver that string to a bool
SSL_VERIFY = os.getenv('PUPPETDB_SSL_VERIFY', 'True')
if SSL_VERIFY.upper() == 'TRUE':
PUPPETDB_SSL_V... |
import cliapp
import larch
import logging
import os
import socket
import StringIO
import sys
import time
import tracing
import ttystatus
import obnamlib
class ObnamIOError(obnamlib.ObnamError):
msg = 'I/O error: {filename}: {errno}: {strerror}'
class ObnamSystemError(obnamlib.ObnamError):
msg = 'System e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.