content stringlengths 4 20k |
|---|
import abc
from oslo_serialization import jsonutils
from neutron.api import extensions
from neutron import wsgi
class FoxInSocksController(wsgi.Controller):
def index(self, request):
return "Try to say this Mr. Knox, sir..."
class FoxInSocksPluginInterface(extensions.PluginInterface):
@abc.abstr... |
import copy
import hashlib
import json
import string
import sys
import urllib2
MANIFEST_VERSION = 2
# Some commonly-used key names.
ARCHIVES_KEY = 'archives'
BUNDLES_KEY = 'bundles'
NAME_KEY = 'name'
REVISION_KEY = 'revision'
VERSION_KEY = 'version'
# Valid values for the archive.host_os field
HOST_OS_LITERALS = fro... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.openstack im... |
import traceback
# Auto-load all functions/commands.
# Modules to auto-load, and the paths where those modules exist.
module_dict = {
'gdb.function': os.path.join(gdb.PYTHONDIR, 'gdb', 'function'),
'gdb.command': os.path.join(gdb.PYTHONDIR, 'gdb', 'command')
}
# Iterate the dictionary, collating the Python file... |
"""
API related to providing field overrides for individual students. This is used
by the individual due dates feature.
"""
import json
from .field_overrides import FieldOverrideProvider
from .models import StudentFieldOverride
class IndividualStudentOverrideProvider(FieldOverrideProvider):
"""
A concrete i... |
from __future__ import unicode_literals
import frappe
from frappe.utils import flt
def execute():
from erpnext.stock.stock_balance import repost
repost(allow_zero_rate=True, only_actual=True)
frappe.reload_doctype("Account")
warehouse_account = frappe.db.sql("""select name, master_name from tabAccount
where i... |
import sqlalchemy as sa
TABLES_012 = ['resource', 'sourceassoc', 'user',
'project', 'meter', 'source', 'alarm']
TABLES_027 = ['user', 'project', 'alarm']
def upgrade(migrate_engine):
meta = sa.MetaData(bind=migrate_engine)
for table_name in TABLES_027:
try:
(sa.Table('dump02... |
from recommends.converters import IdentifierManager
class BaseRecommendationStorage(object):
threshold_similarities = 0
threshold_recommendations = 0
can_lock = False
def __init__(self, settings=None):
self.identifier_manager = IdentifierManager()
self.settings = settings
def ge... |
# -*- coding: utf-8 -*-
"""
jinja2.bccache
~~~~~~~~~~~~~~
This module implements the bytecode cache system Jinja is optionally
using. This is useful if you have very complex template situations and
the compiliation of all those templates slow down your application too
much.
Situations whe... |
'''
Created on 13/05/2014
@author: Alex Montes Barrios
'''
import xbmcgui
class menuHistory:
def __init__(self, base_url):
self.actualMenu = []
self.prevMenu = []
self.initHistStack(base_url)
def initHistStack(self, base_url):
self.appendMenu((-1, base_url, True))
... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.cloudstack import (
AnsibleCloudStack,
cs_argument_spec,
cs_required_together,
)... |
from django.contrib.admin.filterspecs import FilterSpec
from django.contrib.admin.options import IncorrectLookupParameters
from django.contrib.admin.util import quote, get_fields_from_path
from django.core.exceptions import SuspiciousOperation
from django.core.paginator import Paginator, InvalidPage
from django.db impo... |
from __future__ import unicode_literals
import frappe
import urllib
from frappe.utils.nestedset import NestedSet
from frappe.website.website_generator import WebsiteGenerator
from frappe.website.render import clear_cache
from frappe.website.doctype.website_slideshow.website_slideshow import get_slideshow
class ItemGr... |
# -*- coding: utf-8 -*-
"""
Author: Xi Lin <<EMAIL>>
website: http://www.cs.cityu.edu.hk/~xilin4/
github:
This code is a demo for this paper:
A Decomposition based Multiobjective Evolutionary Algorithm
with Classification
Xi Lin, Qingfu Zhang, Sam Kwong
IEEE World Congress on Computat... |
#!/usr/bin/python
# coding=utf-8
# ------------------------------------------------------------------------------
#
# Common utility functions
#
#
# ------------------------------------------------------------------------------
import time
import subprocess
# print a string to a file
def fprint(f, s):
f = open(f, ... |
"""
title: 'Necessities'
input: ['fairy', 'cakes', 'happy', 'fish', 'disgustipated', 'melon-balls']
output:
+---------------+
| Necessities |
+---------------+
| fairy |
| cakes |
| happy |
| fish |
| disgustipated |
| melon-balls |
+-------... |
"""Patch to the python wrapper of ../linear_solver.h providing an algebraic API.
This is directly imported, and use exclusively in ./linear_solver.swig. See that
file.
For examples leveraging the code defined here, see ./pywraplp_test.py and
../../../python/linear_programming.py.
"""
import numbers
from six import it... |
"""Support for the Netatmo devices."""
import logging
from datetime import timedelta
from urllib.error import HTTPError
import voluptuous as vol
from homeassistant.const import (
CONF_API_KEY, CONF_PASSWORD, CONF_USERNAME, CONF_DISCOVERY, CONF_URL,
EVENT_HOMEASSISTANT_STOP)
from homeassistant.helpers import d... |
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_framework.comptool import TestManager, TestInstance
from test_framework.mininode import *
from test_framework.blocktools import *
import logging
import copy
import time
'''
In this test we connect to one node... |
import os
import base64
from django.db.models import F, Q
from xos.config import Config
from synchronizers.base.openstacksyncstep import OpenStackSyncStep
from core.models.image import Image
from xos.logger import observer_logger as logger
class SyncImages(OpenStackSyncStep):
provides=[Image]
requested_interva... |
import datetime
import logging
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (QApplication, QCheckBox, QComboBox, QGridLayout, QHBoxLayout,
QLabel, QLineEdit, QMessageBox, QPlainTextEdit, QPushButton,
QSpacerItem, QStyle, QTableWidgetItem, QTabWidget, ... |
'''
cp.py - this file is part of S3QL.
Copyright © 2008 Nikolaus Rath <<EMAIL>>
This work can be distributed under the terms of the GNU GPLv3.
'''
from .logging import logging, setup_logging, QuietError
from .common import assert_fs_owner
from .parse_args import ArgumentParser
import llfuse
import os
import stat
imp... |
from oslo_serialization import jsonutils
import webob
from nova import test
from nova.tests.unit.api.openstack import fakes
import nova.tests.unit.image.fake
class UrlmapTest(test.NoDBTestCase):
def setUp(self):
super(UrlmapTest, self).setUp()
fakes.stub_out_rate_limiting(self.stubs)
nova... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='BasicConfiguration',
fields=[
('id', models.Aut... |
#! /usr/bin/env python
#
# Provide some simple capabilities from number theory.
#
# Version of 2008.11.14.
#
# Written in 2005 and 2006 by Peter Pearson and placed in the public domain.
# Revision history:
# 2008.11.14: Use pow( base, exponent, modulus ) for modular_exp.
# Make gcd and lcm accept arbitr... |
from django.conf import settings
from django.db.models import signals
from django.utils.translation import ugettext_noop as _
import logging
logger = logging.getLogger(__name__)
if "notification" in settings.INSTALLED_APPS:
import notification
def create_notice_types(app, created_models, verbosity, **kwargs):... |
from openerp.tests.common import TransactionCase
class TestIntSaleToReservation(TransactionCase):
"""Integration tests of the propagation of the owner.
Here we check the whole trip from the quotation line to the reservation of
the stock.
"""
def test_one_line_with_owner_reserves_its_stock(self)... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing M2M table for field subcategories on 'Category'
db.delete_tabl... |
import urllib
import urllib2
try:
import json
except ImportError:
import simplejson as json
import os
import sys
from optparse import OptionParser
class ProxmoxNodeList(list):
def get_names(self):
return [node['node'] for node in self]
class ProxmoxQemu(dict):
def get_variables(self):
... |
import os
import pmtest
class pmenv(object):
"""Environment object
"""
testcases = []
passed = 0
failed = 0
expectedfail = 0
unexpectedpass = 0
def __init__(self, root = "root"):
self.root = os.path.abspath(root)
self.pacman = {
"bin": "pacman",
... |
"""distutils.command.install_scripts
Implements the Distutils 'install_scripts' command, for installing
Python scripts."""
# contributed by Bastian Kleineidam
__revision__ = "$Id$"
import os
from distutils.core import Command
from distutils import log
from stat import ST_MODE
class install_scripts (C... |
from __future__ import unicode_literals
import keyword
import re
from optparse import make_option
from django.core.management.base import NoArgsCommand, CommandError
from django.db import connections, DEFAULT_DB_ALIAS
from django.utils import six
class Command(NoArgsCommand):
help = "Introspects the database tab... |
import os
import logging
# validate, , validate things, internal
from yotta.lib import validate
# access_common, , things shared between different component access modules, internal
from yotta.lib import access_common
# CMakeGen, , generate build files, internal
from yotta.lib import cmakegen
# Target, , represents a... |
from __future__ import (absolute_import, division, print_function,
unicode_literals, with_statement)
import ast
import configparser
import imp
import os
import sys
from multiscanner.config import PY3
try:
import paramiko
SSH = True
except ImportError:
SSH = False
def load_module... |
from datetime import datetime as DateTime
from vesper.tests.test_case import TestCase
from vesper.util.datetime_formatter import DateTimeFormatter
class DateTimeFormatterTests(TestCase):
def test_get_min_time_increment(self):
get_increment = DateTimeFormatter.get_min_time_increment
... |
from neutron.api.v2 import attributes
from neutron.common import constants as l3_const
from neutron.extensions import external_net
from neutron.tests.common import helpers
from neutron.tests.unit.plugins.ml2 import base as ml2_test_base
class L3DvrTestCase(ml2_test_base.ML2TestFramework):
def setUp(self):
... |
__rev_id__ = """$Id: Column.py,v 1.4 2005/07/20 07:24:11 rvk Exp $"""
import Style
from BIFFRecords import ColInfoRecord
from Deco import *
from Worksheet import Worksheet
class Column(object):
@accepts(object, int, Worksheet)
def __init__(self, indx, parent_sheet):
self.__index = indx
self.... |
######################################################################
# This file should be kept compatible with Python 2.3, see PEP 291. #
######################################################################
# The most useful windows datatypes
from ctypes import *
BYTE = c_byte
WORD = c_ushort
DWORD = c_ulong
W... |
"""Sanity test for proper import exception handling."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from .. import types as t
from ..sanity import (
SanityMultipleVersion,
SanityMessage,
SanityFailure,
SanitySuccess,
SanitySkipped,
SANITY_... |
import os
import sys
PYLINT_BLACKLIST = []
PYLINT_DISABLED_WARNINGS = ['R0923', 'R0201', 'E1101']
def _CommonChecks(input_api, output_api):
results = []
# TODO(nduca): This should call update_docs.IsUpdateDocsNeeded().
# Disabled due to crbug.com/255326.
if False:
update_docs_path = os.path.join(
i... |
"""urls for raffle widget"""
from django.conf.urls.defaults import url, patterns
urlpatterns = patterns('',
url(r'^(\d+)/add_ticket/$', 'apps.widgets.raffle.views.add_ticket',
name="raffle_add_ticket"),
url(r'^(\d+)/remove_ticket/$', 'apps.widgets.raffle.views.remove_ticket',
name="raffle_remov... |
from builtins import object
import numpy as np
from sporco.admm import ppp
import sporco.prox as sp
import sporco.metric as sm
class TestSet01(object):
def setup_method(self, method):
np.random.seed(12345)
def test_01(self):
N = 64
lmbda = 0.1
s = np.random.randn(N, 1)
... |
from case import Case
class Case1_2_6(Case):
DESCRIPTION = """Send binary message message with payload of length 65535."""
EXPECTATION = """Receive echo'ed binary message (with payload as sent). Clean close with normal code."""
def onOpen(self):
payload = "\xfe" * 65535
self.expected[... |
#!/usr/bin/env python
import sys, os, shutil, struct
import intelhex
# make two intel hex files, one including bootloader and one without
# for loading with DFU based tools
if len(sys.argv) != 4:
print("Usage: make_intel_hex.py BINFILE BOOTLOADER RESERVE_KB")
sys.exit(1)
scripts = os.path.dirname(__file__)
... |
"""Thread-local objects.
(Note that this module provides a Python version of the threading.local
class. Depending on the version of Python you're using, there may be a
faster one available. You should always import the `local` class from
`threading`.)
Thread-local objects support the management of thread-local d... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
import re
from abc import abstractmethod
from pants.build_graph.source_mapper import SpecSourceMapper
from pants.goal.workspace import ScmWorkspace
fro... |
import errno
import logging
import logging.handlers
import os
from flask import Flask
from flask_socketio import SocketIO
from config import DevelopmentConfig
def mkdir_p(path):
try:
os.makedirs(path, exist_ok=True) # Python>3.2
except TypeError:
try:
os.makedirs(path)
e... |
"""TensorFlow Ops to work with embeddings (deprecated).
This module and all its submodules are deprecated. See
[contrib/learn/README.md](https://www.tensorflow.org/code/tensorflow/contrib/learn/README.md)
for migration instructions.
Note: categorical variables are handled via embeddings in many cases.
For example, in... |
import unittest
import os, glob
from test_all import db, test_support, get_new_environment_path, \
get_new_database_path
#----------------------------------------------------------------------
class pget_bugTestCase(unittest.TestCase):
"""Verify that cursor.pget works properly"""
db_name = 'test-curs... |
'''Recipes for more efficient work with linalg using classes
intended for use for multivariate normal and linear regression
calculations
x is the data (nobs, nvars)
m is the moment matrix (x'x) or a covariance matrix Sigma
examples:
x'sigma^{-1}x
z = Px where P=Sigma^{-1/2} or P=Sigma^{1/2}
Initially assume po... |
import sys
from .mbcharsetprober import MultiByteCharSetProber
from .codingstatemachine import CodingStateMachine
from .chardistribution import SJISDistributionAnalysis
from .jpcntx import SJISContextAnalysis
from .mbcssm import SJISSMModel
from . import constants
class SJISProber(MultiByteCharSetProber):
... |
#!/usr/bin/env python3
"""Play the immortal game using push_san() from chess.Board()."""
import chess
import timeit
def play_immortal_game() -> None:
board = chess.Board()
# 1. e4 e5
board.push_san("e4")
board.push_san("e5")
# 2. f4 exf4
board.push_san("f4")
board.push_san("exf4")
... |
import collections
requirements = None
db = None
db_url = None
db_opts = None
file_config = None
test_schema = None
test_schema_2 = None
_current = None
_skip_test_exception = None
class Config(object):
def __init__(self, db, db_opts, options, file_config):
self.db = db
self.db_opts = db_opts
... |
"""Test mining RPCs
- getmininginfo
- getblocktemplate proposal mode
- submitblock"""
import copy
from decimal import Decimal
from test_framework.blocktools import (
create_coinbase,
NORMAL_GBT_REQUEST_PARAMS,
TIME_GENESIS_BLOCK,
)
from test_framework.messages import (
CBlock,
CBlockHeader,
B... |
"""Tests for discogs plugin.
"""
from __future__ import division, absolute_import, print_function
import unittest
from test import _common
from test._common import Bag
from test.helper import capture_log
from beetsplug.discogs import DiscogsPlugin
class DGAlbumInfoTest(_common.TestCase):
def _make_release(self,... |
## ONLY FOR NOOBS :D
##CONVERSION OF following encryption by shani into python
## only decryption function is implemented
'''
* jQuery JavaScript Library v1.4.2
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes S... |
import unittest
import IECore
class ExclusionFrameListTest( unittest.TestCase ) :
def test( self ) :
f = IECore.ExclusionFrameList( IECore.FrameRange( 1, 10 ), IECore.FrameRange( 1, 11, 2 ) )
self.assert_( isinstance( f, IECore.ExclusionFrameList ) )
self.assertEqual( f.asList(), [ 2, 4, 6, 8, 10 ] )
def te... |
#!/usr/bin/python
"""
generate_friends.py
Generates data file "baseball_friends.csv" to be used for lab8 MapReduce
example.
Reads list of names from "names.txt", randomly assigns team alligiences,
then assigns friendships based on super simple algorithm, and finally
writes out the file in the following csv format:
... |
""" Tests for run_command() in manager.py """
import os
import subprocess
import tempfile
from tests import mock
# pylint: disable=missing-function-docstring, missing-class-docstring, attribute-defined-outside-init
class TestRunCommand:
def setup_method(self, method):
_unused = method
self.workd... |
"""
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
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 version.
... |
"""External function interface to NNPACK libraries."""
from __future__ import absolute_import as _abs
from .. import api as _api
from .. import intrin as _intrin
from .._ffi.function import _init_api
def is_available():
"""Check whether NNPACK is available, that is, `nnp_initialize()`
returns `nnp_status_succ... |
from gi.repository import Gtk
import cups
from gi.repository import GObject
from timedops import TimedOperation
from .base import *
class ChooseNetworkPrinter(Question):
def __init__ (self, troubleshooter):
Question.__init__ (self, troubleshooter, "Choose network printer")
page1 = self.initial_vbox... |
"""Unit test for jsonchecker.py."""
import unittest2 as unittest
import jsonchecker
class MockErrorHandler(object):
def __init__(self, handle_style_error):
self.turned_off_filtering = False
self._handle_style_error = handle_style_error
def turn_off_line_filtering(self):
self.turned_... |
"""Ops for fused Cudnn RNN models.
@@CudnnCompatibleGRUCell
@@CudnnCompatibleLSTMCell
@@CudnnGRU
@@CudnnLSTM
@@CudnnRNNRelu
@@CudnnRNNTanh
@@CudnnLSTMSaveable
@@CudnnGRUSaveable
@@CudnnRNNReluSaveable
@@CudnnRNNTanhSaveable
"""
from __future__ import absolute_import
from __future__ import division
from __future__ imp... |
import sys
import logging
from media_processors import TemplateProcessor
def load_processor(name):
(module_name, _ , processor) = name.rpartition(".")
__import__(module_name)
module = sys.modules[module_name]
return getattr(module, processor)
class Processor(object):
def __init__(self, settings):
... |
""""Module containing classes related to OpenStack Networking."""
import json
import threading
from perfkitbenchmarker import errors
from perfkitbenchmarker import flags
from perfkitbenchmarker import network
from perfkitbenchmarker import vm_util
from perfkitbenchmarker.providers.openstack import utils
from perfkitb... |
from peachpy import *
from peachpy.x86_64 import *
def add_offset(int_size, array, offset):
if int_size == 64:
SHL(offset, 3)
elif int_size == 32:
SHL(offset, 2)
ADD(array, offset)
return array
class MM:
gen_reg = [rax, rbx, rcx, rdx,
rsi, rdi, r8, r9,
... |
from decimal import Decimal
from unittest import TestCase, main
from sys import version_info
# Import from itools
from itools.i18n import is_similar, get_most_similar, guess_language
from itools.i18n import AcceptLanguageType, format_number
###########################################################################... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
RETURNS = '''
name:
description: Name of the Device, usually the serial-number.
returned: always
type: str
sample: Server-IpAddrs
id:
description: AOS unique ID assigne... |
"""
kombu.utils.finalize
====================
Execute cleanup handlers when objects go out of scope.
Taken from :class:`multiprocessing.util.Finalize`.
:copyright: (c) 2009 - 2012 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import weakref
from itertools im... |
from django.shortcuts import render, render_to_response
def render_to_response_view(request):
return render_to_response('shortcuts/render_test.html', {
'foo': 'FOO',
'bar': 'BAR',
})
def render_to_response_view_with_multiple_templates(request):
return render_to_response([
'shortc... |
# -*- coding: utf-8 -*-
"""
pygments.lexers._postgres_builtins
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Self-updating data files for PostgreSQL lexer.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import urllib
# One man's cons... |
from google.apputils import app
import gflags
from ortools.constraint_solver import pywrapcp
FLAGS = gflags.FLAGS
gflags.DEFINE_string('data', 'python/data/bacp/bacp12.txt',
'path to data file')
#----------------helper for binpacking posting----------------
def BinPacking(solver, binvars, weig... |
"""A utility script that can extract and edit resources in a Windows binary.
For detailed help, see the script's usage by invoking it with --help."""
import ctypes
import ctypes.wintypes
import logging
import optparse
import os
import shutil
import sys
import tempfile
import win32api
import win32con
_LOGGER = loggi... |
#!/usr/bin/env python
#
# Generated by generateDS.py.
#
import sys
import anywildcard2_sup as supermod
etree_ = None
Verbose_import_ = False
( XMLParser_import_none, XMLParser_import_lxml,
XMLParser_import_elementtree
) = range(3)
XMLParser_import_library = None
try:
# lxml
from lxml import etree... |
__version__=''' $Id$ '''
__all__ = ('USPS_4State',)
from reportlab.lib.colors import black
from reportlab.graphics.barcode.common import Barcode
from reportlab.lib.utils import asNative
class USPS_4State(Barcode):
''' USPS 4-State OneView (TM) barcode. All info from USPS-B-3200A
'''
_widthSize = 1
_he... |
import os
from six.moves import cPickle as pickle
import warnings
from importlib import import_module
from os.path import join, dirname, abspath, isabs, exists
from scrapy.utils.conf import closest_scrapy_cfg, get_config, init_env
from scrapy.settings import Settings
from scrapy.exceptions import NotConfigured
ENVVA... |
"""
Extracts the version of the PostgreSQL server.
"""
import re
# This reg-exp is intentionally fairly flexible here.
# Needs to be able to handle stuff like:
# PostgreSQL 8.3.6
# EnterpriseDB 8.3
# PostgreSQL 8.3 beta4
# PostgreSQL 8.4beta1
VERSION_RE = re.compile(r'\S+ (\d+)\.(\d+)\.?(\d+)?')
def _parse_... |
import os
import sys
import unicodedata
from subprocess import Popen as _Popen, PIPE as _PIPE
def _which_dirs(cmd):
result = set()
for path in os.environ.get('PATH', '').split(os.pathsep):
filename = os.path.join(path, cmd)
if os.access(filename, os.X_OK):
result.add(path)
ret... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.authproxy import JSONRPCException
from test_framework.util import (
start_nodes,
assert_raises_message,
)
class SigmaNonHDWalletTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
self.setup_c... |
import unittest
from random import randint
from src.runner import SingleprocessRunner
class SingleprocessRunnerTest(unittest.TestCase):
def setUp(self):
self.runner = SingleprocessRunner()
self.func_call_counter = 0
self.results = []
def tearDown(self):
del self.runner
... |
import io
import os
import sys
import pickle
import subprocess
import unittest
from .support import LoggingResult, ResultWithNoStartTestRunStopTestRun
class TestCleanUp(unittest.TestCase):
def testCleanUp(self):
class TestableTest(unittest.TestCase):
def testNothing(self):
p... |
import os.path as op
import numpy as np
from ...io import BaseRaw
from ...io.constants import FIFF
from ...utils import _validate_type
from ..nirs import source_detector_distances, _channel_frequencies,\
_check_channels_ordered, _channel_chromophore
def beer_lambert_law(raw, ppf=0.1):
r"""Convert NIRS optic... |
from __future__ import print_function
import sys, os
import numpy as np
import numpy.ma as ma
from os.path import join as pjoin
import os.path
from numba import jit
from multiprocessing import Pool,cpu_count
from skimage.measure import marching_cubes
from netCDF4 import Dataset
import time
from mayavi import mlab
... |
from StandardDataSets.scripts import JudgeAssistant
# Please feed your node list here:
tagLst = []
attrName = ''
attrVal = ''
dataToCheck = ''
class SimpleJudgingObject:
def __init__(self, _tagLst, _attrName, _attrVal, _data):
self.tagList = _tagLst
self.attrName = _attrName
self.attrVal =... |
import os
try:
# python2.6
import unittest2 as unittest
except ImportError:
import unittest
import polib
from autotranslate.management.commands.translate_messages import humanize_placeholders, restore_placeholders, Command
class HumanizeTestCase(unittest.TestCase):
def test_named_placeholders(self)... |
import json
import pytest
from units.compat.mock import patch
from ansible.modules.notification import slack
from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args
class TestSlackModule(ModuleTestCase):
def setUp(self):
super(TestSlackModule, self).setUp()
... |
import json
import os
from decimal import Decimal
from unittest import TestCase
from nba_data.data.player_status import PlayerStatusType
from nba_data.data.team import Team
from nba_data.deserializers.box_scores.game import AdvancedGameBoxScoreDeserializer
from tests.config import ROOT_DIRECTORY
class TestAdvancedBo... |
{
'name' : 'Fleet Management',
'version' : '0.1',
'sequence': 165,
'category': 'Human Resources',
'website' : 'https://www.odoo.com/page/fleet',
'summary' : 'Vehicle, leasing, insurances, costs',
'description' : """
Vehicle, leasing, insurances, cost
==================================
With t... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'core'}
import os
try:
import selinux
HAVE_SELINUX = True
except ImportError:
HAVE_SE... |
"""Tests for util.db module."""
import threading
import time
import unittest
import ddt
from django.contrib.auth.models import User
from django.core.management import call_command
from django.db import IntegrityError, connection
from django.db.transaction import TransactionManagementError, atomic
from django.test imp... |
import os
import sys
import time
import imp
def shortPythonVersion():
hv = sys.hexversion
major = (hv & 0xff000000L) >> 24
minor = (hv & 0x00ff0000L) >> 16
teeny = (hv & 0x0000ff00L) >> 8
return "%s.%s.%s" % (major,minor,teeny)
knownPlatforms = {
'nt': 'win32',
'ce': 'win32',
'posix':... |
# Capstone Python bindings, by Nguyen Anh Quynnh <<EMAIL>>
import ctypes
from . import copy_ctypes_list
from .arm64_const import *
# define the API
class Arm64OpMem(ctypes.Structure):
_fields_ = (
('base', ctypes.c_uint),
('index', ctypes.c_uint),
('disp', ctypes.c_int32),
)
class Arm... |
"""Tests for SWIG wrapped brain::Status."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.core.lib.core import error_codes_pb2
from tensorflow.python import pywrap_tensorflow
from tensorflow.python.platform import googletest
class Status... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
las2lasPro_transform.py
---------------------
Date : October 2014
Copyright : (C) 2014 by Martin Isenburg
Email : martin near rapidlasso point com
******... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from ycmd.utils import ToCppStringCompatible as ToCppStr
from ycmd.c... |
def uglyNumbers(n):
#print nth ugly number
#http://www.geeksforgeeks.org/ugly-numbers/
ulist= [-1]*n;
ulist[0]=1
q2=0
q3=0
q5=0
nq2=2
nq3=3
nq5=5
for i in range(1,n):
minq = min(nq5,nq3,nq2)
ulist[i] = minq
if minq == nq2:
q2+=1
nq2=ulist[q2]*2
elif minq == nq3:
q3+=1
nq3=ulist[q3]*3
el... |
import re
class CrashLogs(object):
def __init__(self, host):
self._host = host
def find_newest_log(self, process_name, pid=None, include_errors=False, newer_than=None):
if self._host.platform.is_mac():
return self._find_newest_log_darwin(process_name, pid, include_errors, newer_th... |
"""
@author: Andrew Case
@license: GNU General Public License 2.0
@contact: <EMAIL>
@organization:
"""
import os
import volatility.commands as commands
import volatility.utils as utils
import volatility.obj as obj
def set_plugin_members(obj_ref):
obj_ref.addr_space = utils.load_as(obj_ref._confi... |
import re
from collections import namedtuple
from inspect import signature
from unicodedata import category, normalize
from flask_babel import lazy_gettext as _
fields = ("title", "description", "input", "output", "order", "function")
Command = namedtuple("Command", fields)
def main_command_function(lines, transfor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.