content string |
|---|
# -*- coding: utf8 -*-
"""Utility and helper methods for script.
util
~~~~
"""
from __future__ import absolute_import, unicode_literals
import re
import sys
from ._compat import Mapping, string_types, text_type, unichr
def ucn_to_unicode(ucn):
"""Return a python unicode value from a UCN.
Converts a Unico... |
from enum import Enum
from functools import wraps
from typing import Iterable, Union
from graphql_jwt import exceptions
from graphql_jwt.decorators import context
def account_passes_test(test_func):
"""Determine if user/service_account has permission to access to content."""
def decorator(f):
@wraps... |
from . import base as _base
class Calendar (_base.Component):
"""A calendar
As defined in :RFC:`5545`, section 3.4 (iCalendar Object).
"""
name = 'VCALENDAR'
# contents defined in RFC 5545, section 3.6 (Calendar Components)
required = [
'PRODID',
'VERSION',
]
optio... |
# -*- coding: utf-8 -*-
import traceback
from pylons import cache
from tg import config
from gapproject.model import *
__all__ = ['getOrsayCustomerList', 'getOrsayCustomerInfo', 'getOrsayWashingList', 'getOrsayWashingDetailInfo', 'populateTranslation', 'populateTranslation1']
def getOrsayCustomerList():
def _get... |
#!/usr/bin/env python3
from sys import exit
from test.http_test import HTTPTest
from misc.wget_file import WgetFile
"""
This test ensures Wget's Basic Authorization Negotiation.
Also, we ensure that Wget saves the host after a successfull auth and
doesn't wait for a challenge the second time.
"""
TEST_NAME... |
"""
GitLab API: https://docs.gitlab.com/ce/api/system_hooks.html
GitLab API: https://docs.gitlab.com/ce/api/groups.html#hooks
GitLab API: https://docs.gitlab.com/ee/api/projects.html#hooks
"""
import re
import pytest
import responses
from gitlab.v4.objects import GroupHook, Hook, ProjectHook
hooks_content = [
{... |
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, flt, cint, nowdate, add_days, comma_and
from frappe import msgprint, _
from frappe.model.document import Document
from erpnext.manufacturing.doctype.bom.bom import validate_bom_no
from erpnext.manufacturing.doctype.production_order.p... |
import os
import re
import urllib
from django.conf import settings
from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.test import TestCase
from dja... |
"""
A second, custom AdminSite -- see tests.CustomAdminSiteTests.
"""
from __future__ import unicode_literals
from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.http import HttpResponse
from . import... |
from objects.objects import *
from os.path import join
from PyQt5.QtCore import Qt, QSize
from PyQt5.QtGui import QIcon
from .graph_dimension import GraphDimensionWindow
from PyQt5.QtWidgets import (
QGridLayout,
QGroupBox,
QWidget... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, division
import io
import warnings
import collections
from psd_tools.utils import (read_pascal_string, unpack, read_fmt,
read_unicode_string, be_array_from_bytes,
decode_fixed_poi... |
"""
The ``atmosphere`` module contains methods to calculate
relative and absolute airmass and to determine
pressure from altitude or vice versa.
"""
from __future__ import division
import logging
pvl_logger = logging.getLogger('pvlib')
import numpy as np
AIRMASS_MODELS = ['kastenyoung1989', 'kasten1966', 'simple',... |
import logging
import os
import random
import re
import shutil
import string
import sys
import tempfile
from webkitpy.common.memoized import memoized
from webkitpy.common.system.executive import Executive, ScriptError
from .scm import SCM
_log = logging.getLogger(__name__)
class SVN(SCM):
executable_name = "s... |
#!/usr/bin/python3
# This Amulet based tests
# The goal is to ensure the Ubuntu charm
# sucessfully deploys and can be accessed.
# Note the Ubuntu charm does not have any
# relations or config options.
import amulet
#import os
#import requests
# Timeout value, in seconds to deploy the environment
seconds = 900
# S... |
from direct.distributed.ClockDelta import *
from direct.distributed.DistributedObject import DistributedObject
from direct.fsm import ClassicFSM, State
from direct.interval.IntervalGlobal import *
from pandac.PandaModules import *
import random
import ToonInteriorColors
from toontown.dna.DNAParser import DNADoor
from ... |
import os
import sys
from django.db.backends import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name = 'mysql'
def runshell(self):
settings_dict = self.connection.settings_dict
args = [self.executable_name]
db = settings_dict['OPTIONS'].get('db', settings_... |
#!/usr/bin/env python
'''Upload dist/ files to code.google.com. For Alex only :-)
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import os
import re
import sys
base = os.path.dirname(__file__)
root = os.path.join(base, '../..')
dist = os.path.join(root, 'dist')
sys.path.insert(0, root)
import pyglet
... |
import matplotlib
matplotlib.use("Agg")
from matplotlib import pyplot
from math import fabs
from formulae import sigmoid, sigmoid_derivative, random_weight, get_synapse_colour, adjust_line_to_perimeter_of_circle, layer_left_margin
import parameters
class Synapse():
def __init__(self, input_neuron_index, x1, x2, y... |
from Components.Converter.Converter import Converter
from Components.Element import cached, ElementError
from Tools.Directories import SCOPE_SKIN_IMAGE, SCOPE_ACTIVE_SKIN, resolveFilename
from Tools.LoadPixmap import LoadPixmap
class ValueToPixmap(Converter, object):
LANGUAGE_CODE = 0
PATH = 1
def __init__(self, ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def create_homepage(apps, schema_editor):
# Get models
ContentType = apps.get_model('contenttypes.ContentType')
Page = apps.get_model('wagtailcore.Page')
Site = apps.get_model('wagtailcore.Site')
Home... |
"""
Contains view unit tests.
"""
from django.core.urlresolvers import reverse
from wagtailplus.tests import views
from ..models import Link
class TestLinkIndexView(views.BaseTestIndexView):
url_namespace = 'wagtaillinks'
template_dir = 'wagtaillinks/links'
def _create_sequential_instance(self, ind... |
win1255_CharToOrderMap = (
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10
253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20
252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30
253, 69, ... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import time
import traceback
try:
import botocore
HAS_BOTOCORE = True
except Import... |
class Errors(Exception):
__status_code = 400
__error_cat = "General Error"
__default_message = "System Error Occurred"
def __init__(self, message=None, status_code=None, payload=None):
Exception.__init__(self)
self.category = self.__error_cat
self.message = message or self.__def... |
import time
from openerp.osv import osv, fields
class account_analytic_cost_ledger(osv.osv_memory):
_name = 'account.analytic.cost.ledger'
_description = 'Account Analytic Cost Ledger'
_columns = {
'date1': fields.date('Start of period', required=True),
'date2': fields.date('End of period... |
# coding: utf-8
from __future__ import unicode_literals
import re
from django.utils.translation import ugettext_lazy as _
from rest_framework import exceptions
from rest_framework.compat import unicode_http_header
from rest_framework.reverse import _reverse
from rest_framework.settings import api_settings
from rest_... |
from m5.objects import *
from x86_generic import *
root = LinuxX86FSSystemUniprocessor(mem_mode='timing',
mem_class=DDR3_1600_x64,
cpu_class=TimingSimpleCPU).create_root() |
"""GLib main loop integration.
"""
__docformat__ = "restructuredtext en"
import inspect
import sys
import logging
import glib
import functools
from .interfaces import HandlerReady, PrepareAgain
from .base import MainLoopBase
logger = logging.getLogger("pyxmpp2.mainloop.glib")
def hold_exception(method):
"""D... |
from __future__ import absolute_import, division, print_function
from datetime import timedelta
from flask import make_response, request, current_app
from functools import update_wrapper
from ... import py2help
def crossdomain(origin=None, methods=None, headers=None,
automatic_headers=True,
... |
"""
Sync courses from catalog service. This is used to setup a master's
integration environment.
"""
import logging
from textwrap import dedent
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.core.management.base import BaseCommand, CommandError
from opaque_... |
from flask import (
current_app, render_template, redirect, Blueprint, flash, url_for, g
)
from flask.ext.github import GitHubError
from flask.ext.login import login_user, logout_user
from realms import github
from realms.modules.github.models import User
blueprint = Blueprint('github', __name__)
@blueprint.rout... |
"""
Tests for discussion API permission logic
"""
import itertools
import ddt
from nose.plugins.attrib import attr
from discussion_api.permissions import (
can_delete,
get_editable_fields,
get_initializable_comment_fields,
get_initializable_thread_fields
)
from lms.lib.comment_client.comment import Co... |
"""Confusion matrix related metrics."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.framework import tensor_util
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.op... |
from fbdownload.downloader import FacebookDownloader
class FacebookGroupDownloader(FacebookDownloader):
'''
Downloads data from a Facebook group, including events.
Images are not downloaded.
In this package of classes, that is done by the
FacebookHtmlExporter, even though a stand alone download
function wo... |
"""
Dumps info about switches when they first connect
"""
from pox.core import core
import pox.openflow.libopenflow_01 as of
from pox.lib.util import dpid_to_str
log = core.getLogger()
# Formatted switch descriptions we've logged
# (We rememeber them so that we only print them once)
_switches = set()
# .. unless al... |
# -*- coding: utf-8 -*-
#
# Django documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 27 09:06:53 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleab... |
from libtaxii.constants import (
SVC_COLLECTION_MANAGEMENT,
MSG_COLLECTION_INFORMATION_REQUEST, MSG_FEED_INFORMATION_REQUEST,
MSG_MANAGE_COLLECTION_SUBSCRIPTION_REQUEST,
MSG_MANAGE_FEED_SUBSCRIPTION_REQUEST,
)
from .abstract import TAXIIService
from .handlers import (
CollectionInformationRequestHa... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
try:
from pyVmomi import vim, vmodl
HAS_PYVMOMI = True
except ImportError:
HAS_PYVMOMI = False
class VMwareDvsPortgroup(object):
def __init__(self, module):
self.m... |
import re
import telnetlib
from couchpotato.api import addApiView
from couchpotato.core.event import addEvent
from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification
try:
import xml.etree.cElementTree as etr... |
import logging
import traceback
import threading
from contextlib import contextmanager
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured
from sleekxmpp import ClientXMPP
from sleekxmpp.exceptions import IqError, IqTimeout
from sleekxmp... |
from axolotl.state.axolotlstore import AxolotlStore
from .liteidentitykeystore import LiteIdentityKeyStore
from .liteprekeystore import LitePreKeyStore
from .litesessionstore import LiteSessionStore
from .litesignedprekeystore import LiteSignedPreKeyStore
from .litesenderkeystore import LiteSenderKeyStore
import sqlite... |
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
from gunicorn import __version__
CLASSIFIERS = [
'Development Status :: 4 - Beta',
'Environment :: Other Environment',
'Intended Audience :: Developers',
'License :: OSI Approved ... |
from io import open
import unittest
import re
import toc
from pelican.readers import MarkdownReader
from pelican.contents import Article
from pelican.tests.support import get_settings
class TestToCGeneration(unittest.TestCase):
@classmethod
def setUpClass(cls):
toc.init_default_config(None)
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime
import os
from unittest import TestCase
from django.utils import html
from django.utils._os import upath
from django.utils.encoding import force_text
class TestUtilsHtml(TestCase):
def check_output(self, function, val... |
#!/usr/bin/env python
import json
from boto.cloudtrail.layer1 import CloudTrailConnection
from tests.unit import AWSMockServiceTestCase
class TestDescribeTrails(AWSMockServiceTestCase):
connection_class = CloudTrailConnection
def default_body(self):
return b'''
{"trailList":
... |
"""Command-line tools for authenticating via OAuth 2.0
Do the OAuth 2.0 Web Server dance for a command line application. Stores the
generated credentials in a common file that is used by other example apps in
the same directory.
"""
__author__ = '<EMAIL> (Joe Gregorio)'
__all__ = ['run']
import BaseHTTPServer
impor... |
import pytest
from api.base.settings.defaults import API_BASE
from framework.auth.core import Auth
from api_tests.utils import disconnected_from_listeners
from website.project.signals import contributor_removed
from osf_tests.factories import (
NodeFactory,
AuthUserFactory,
RegistrationFactory
)
@pytest.... |
"""Test discovery helpers."""
from unittest.mock import patch
from homeassistant import setup
from homeassistant.core import callback
from homeassistant.helpers import discovery
from homeassistant.helpers.dispatcher import dispatcher_send
from homeassistant.util.async_ import run_callback_threadsafe
from tests.common... |
"""Asynchronous VO service requests."""
from __future__ import absolute_import, division, print_function, unicode_literals
# LOCAL
from ...utils.compat.futures import ThreadPoolExecutor
from ...utils.decorators import deprecated
__all__ = ['AsyncBase']
@deprecated(
'2.0', alternative='astroquery.vo_conesearch.... |
from __future__ import absolute_import, division, print_function
INCLUDES = """
#include <openssl/bio.h>
"""
TYPES = """
typedef struct bio_st BIO;
typedef void bio_info_cb(BIO *, int, const char *, int, long, long);
struct bio_method_st {
int type;
const char *name;
int (*bwrite)(BIO *, const char *, int... |
# -*- encoding: utf-8 -*-
import StringIO
import xlsxwriter
"""
Web app module.
"""
__author__ = 'Bernardo Martínez Garrido'
__license__ = 'MIT'
__status__ = 'Development'
def generate_match_report_excel(matches, filename):
output = StringIO.StringIO()
workbook = xlsxwriter.Workbook(output, {'in_memory': ... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ansible.module_utils.facts.virtual.base import Virtual, VirtualCollector
from ansible.module_utils.facts.virtual.sysctl import VirtualSysctlDetectionMixin
class FreeBSDVirtual(Virtual, VirtualSysctlDetectionMixin)... |
"""
Tests for interrupting tests with Control-C.
"""
from __future__ import absolute_import, division
from twisted.python.compat import NativeStringIO
from twisted.trial import unittest
from twisted.trial import reporter, runner
class TrialTest(unittest.SynchronousTestCase):
def setUp(self):
self.outpu... |
import math
import sys
import unittest
from pyspark import serializers
from pyspark.serializers import CloudPickleSerializer, CompressedSerializer, \
AutoBatchedSerializer, BatchedSerializer, AutoSerializer, NoOpSerializer, PairDeserializer, \
FlattenedValuesSerializer, CartesianDeserializer, PickleSerializer,... |
#!/usr/bin/env python3
""" NumPy is the fundamental package for array computing with Python.
It provides:
- a powerful N-dimensional array object
- sophisticated (broadcasting) functions
- tools for integrating C/C++ and Fortran code
- useful linear algebra, Fourier transform, and random number capabilities
- and muc... |
#!/usr/bin/env python
'''
Video histogram sample to show live histogram of video
Keys:
ESC - exit
'''
import numpy as np
import cv2
# built-in modules
import sys
# local modules
import video
if __name__ == '__main__':
hsv_map = np.zeros((180, 256, 3), np.uint8)
h, s = np.indices(hsv_map.shape[:2]... |
"""
Client side of the volume RPC API.
"""
from oslo.config import cfg
from oslo import messaging
from cinder.openstack.common import jsonutils
from cinder import rpc
CONF = cfg.CONF
class VolumeAPI(object):
'''Client side of the volume rpc API.
API version history:
1.0 - Initial version.
... |
"""Runs protoc with the gRPC plugin to generate messages and gRPC stubs."""
from grpc.tools import protoc
protoc.main(
(
'',
'-I../../protos',
'--python_out=.',
'--grpc_python_out=.',
'../../protos/helloworld.proto',
)
) |
"""This code example gets all companies.
To create companies, run create_companies.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication information"
section of... |
# Python imports
# Don't add any from __future__ imports here. This code should execute
# against standard Python.
import unittest
import time
import os
# Project imports
import sysv_ipc
# Hack -- add tests directory to sys.path so Python 3 can find base.py.
import sys
sys.path.insert(0, os.path.join(os.getcwd(), 'tes... |
# coding: utf-8
from django.conf import settings
from journalmanager import models
from maintenancewindow import models as maintenance_models
def dynamic_template_inheritance(request):
"""
Changes between base_lv0.html e base_lv1.html
"""
if request.GET.get('popup', None):
return {'dynamic_tpl... |
# -*- coding: utf-8 -*-
from openerp.addons.website_forum.tests.common import KARMA, TestForumCommon
from openerp.addons.website_forum.models.forum import KarmaError
from openerp.exceptions import Warning, AccessError
from openerp.tools import mute_logger
class TestForum(TestForumCommon):
@mute_logger('openerp.... |
import time
from openerp.osv import fields, osv
from openerp.tools.translate import _
class product_margin(osv.osv_memory):
_name = 'product.margin'
_description = 'Product Margin'
_columns = {
'from_date': fields.date('From'),
'to_date': fields.date('To'),
'invoice_state': fields... |
"""Test the test support."""
from __future__ import absolute_import
import filecmp
import re
from os.path import join, isdir
from tests.lib import SRC_DIR
def test_tmp_dir_exists_in_env(script):
"""
Test that $TMPDIR == env.temp_path and path exists and env.assert_no_temp()
passes (in fast env)
"""
... |
# Chris Riederer
# Google, Inc
# 2014-08-15
"""Record baselines and show improvements for working on magnet"""
import test_detect as t
import glob
cleanedList = t.GetRunDataFromArgs(glob.glob('cleaned/*.json'))
snipList = t.GetRunDataFromArgs(glob.glob('snips/*.json'))
decalCleanedList = t.GetRunDataFromArgs(glob.... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import os
def get_local_version(pear_output):
"""Take pear remoteinfo output and get the installed version"""
lines = pear_output.split('\n')
for line in lines:
... |
"""Pattern compiler.
The grammer is taken from PatternGrammar.txt.
The compiler compiles a pattern to a pytree.*Pattern instance.
"""
__author__ = "Guido van Rossum <<EMAIL>>"
# Python imports
import os
import StringIO
# Fairly local imports
from .pgen2 import driver, literals, token, tokenize, parse, grammar
# R... |
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.limiter
~~~~~~~~~~~~~~~~~~~~~~~~
A middleware that limits incoming data. This works around problems with
Trac_ or Django_ because those directly stream into the memory.
.. _Trac: http://trac.edgewall.org/
.. _Django: http://www.djangoproject.com/
... |
import testtools
from neutron.agent.linux import keepalived
from neutron.common import constants as n_consts
from neutron.tests import base
# Keepalived user guide:
# http://www.keepalived.org/pdf/UserGuide.pdf
class KeepalivedGetFreeRangeTestCase(base.BaseTestCase):
def test_get_free_range(self):
free_... |
"""
Shadertoy demo. You can copy-paste shader code from an example on
www.shadertoy.com and get the demo.
TODO: support cubes and videos as channel inputs (currently, only images
are supported).
"""
# NOTE: This example throws warnings about variables not being used;
# this is normal because only some shadertoy exam... |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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.
T... |
import os,sys,subprocess,tempfile,re,shutil
import argparse
import time
import urlparse
import json
from StringIO import StringIO
from . import builtins
from .ostbuildlog import log, fatal
from . import ostbuildrc
from . import privileged_subproc
class OstbuildDeployQemu(builtins.Builtin):
name = "deploy-qemu"
... |
import warnings
from importlib import import_module
from django.core.exceptions import ImproperlyConfigured
from django.urls import (
LocaleRegexURLResolver, RegexURLPattern, RegexURLResolver,
)
from django.utils import six
from django.utils.deprecation import RemovedInDjango20Warning
__all__ = ['handler400', 'ha... |
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup uses a pluggable XML or HTML parser to parse a
(possibly invalid) document into a tree representation. Beautiful Soup
provides provides methods and Pythonic idioms that make it easy to
navigate... |
"""
Unit tests for our dependencies in the pytest package; at the time of this
writing, we were using an unreleased version of pytest that added support for
the unittest setUpModule fixture and friends. Some of our tests rely on
setUpModule. Once, there was a conflict with pytest installation in our build
system, and a... |
import mock
from oslo_vmware import exceptions as vexc
from oslo_vmware import vim_util
from nova import exception
from nova.network import model as network_model
from nova import test
from nova.tests.unit import matchers
from nova.tests.unit import utils
from nova.tests.unit.virt.vmwareapi import fake
from nova.virt.... |
"""SCons.Tool.javac
Tool-specific initialization for javac.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Founda... |
#!/usr/bin/env python3
import re
from ruamel import yaml
class PrefixedUnit(yaml.YAMLObject):
PREFIXES = {'k': 1e3, 'M': 1e6, 'G': 1e9, 'T': 1e13, 'P': 1e16, 'E': 1e19, 'Z': 1e21, 'Y': 1e24,
'': 1}
yaml_loader = yaml.Loader
yaml_dumper = yaml.Dumper
yaml_tag = u'!prefixed'
yaml_... |
import os
import sys
modeules_path = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
sys.path.append(modeules_path)
from Devices.application import Application
test = os.path.split(os.path.dirname(os.path.abspath(__file__)))[-1]
print(test)
testintex = 2
testscript = os.path.basename(os.path.abspath(__fil... |
from browser import window
def _randint(a, b):
return int(window.Math.random()*(b-a+1)+a)
def _urandom(n):
"""urandom(n) -> str
Return n random bytes suitable for cryptographic use."""
randbytes= [_randint(0,255) for i in range(n)]
return bytes(randbytes)
class Random:
"""Random n... |
import time
from datetime import datetime
from dateutil import relativedelta
from osv import osv, fields
class payslip_lines_contribution_register(osv.osv_memory):
_name = 'payslip.lines.contribution.register'
_description = 'PaySlip Lines by Contribution Registers'
_columns = {
'date_from': field... |
import numpy as np
import matplotlib.pyplot as plt
from math import sqrt, copysign
from scipy.optimize import brenth
from scipy.optimize import fsolve,fmin_l_bfgs_b,fmin_cg,fminbound
"""
sign of the number
"""
def sign(x):
if x==0:
return 0
else:
return copysign(1,x)
"""
if function f can't b... |
import unittest
import os
import sys
import utils
TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.insert(0, TOPDIR)
try:
from python_tools import cpp_format
finally:
del sys.path[0]
from pygments import token
# Tokens we'd expect to see in an OK header
ok_header_tokens = [
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: ucs_wwn_pool
short_description: Configures WWNN or WWPN pool... |
# -*- coding: utf-8 -*-
import random
from openerp import SUPERUSER_ID
from openerp.osv import osv, orm, fields
from openerp.addons.web.http import request
class payment_transaction(orm.Model):
_inherit = 'payment.transaction'
_columns = {
# link with the sale order
'sale_order_id': fields.m... |
from django.db.models import Q
from django.test import TestCase
from .models import Issue, User, UnicodeReferenceModel
class RelatedObjectTests(TestCase):
def test_m2m_and_m2o(self):
r = User.objects.create(username="russell")
g = User.objects.create(username="gustav")
i1 = Issue(num=1)
... |
"""Constants for SavedModel save and restore operations.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.util.all_util import remove_undocumented
# Subdirectory name containing the asset files.
ASSETS_DIRECTORY = "assets"
# Coll... |
import os
import re
import subprocess
import sys
import BaseHTTPServer
import SimpleHTTPServer
import SocketServer
import threading
import urlparse
# List of jQuery modules that will be tested.
# TODO(gw): Disabled most of them as something has been
# introduced very recently that causes the resource task
# to panic -... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Test context-sensitive Parser registry.
"""
from unittest import TestCase
#logging.basicConfig(level=logging.DEBUG)
from sneakylang.register import *
from sneakylang.macro import Macro
from sneakylang.parser import Parser
from sneakylang.treebuilder import TreeBuil... |
from sahara import conductor # noqa
from sahara.plugins import base as plugins_base
from sahara.utils import remote
try:
import guestfs
except ImportError:
raise Exception("The image packing API depends on the system package "
"python-libguestfs (and libguestfs itself.) Please "
... |
"""A server that handles a connection with an OpenBCI board and serves that
data over both a UDP socket server and a WebSocket server.
Requires:
- pyserial
- asyncio
- websockets
"""
import argparse
import cPickle as pickle
import json
import sys; sys.path.append('..') # help python find open_bci_v3.py relative... |
"""Extract histogram names from the description XML file.
For more information on the format of the XML file, which is self-documenting,
see histograms.xml; however, here is a simple example to get you started. The
XML below will generate the following five histograms:
HistogramTime
HistogramEnum
Histogra... |
r"""Benchmarks for remote worker eager execution.
To run CPU benchmarks:
bazel run -c opt remote_benchmarks_test -- --benchmarks=.
To run GPU benchmarks:
bazel run --config=cuda -c opt --copt="-mavx" remote_benchmarks_test -- \
--benchmarks=.
"""
from __future__ import absolute_import
from __future__ import ... |
"""Platform-specific utility methods shared by several scripts."""
import os
import subprocess
import google.path_utils
class PlatformUtility(object):
def __init__(self, base_dir):
"""Args:
base_dir: the base dir for running tests.
"""
self._base_dir = base_dir
self._httpd_cmd_string = No... |
# -*- coding: utf-8 -*-
"""Utilities for application plugin-system.
NOTE: for simplicity, language and runner templates are referred to as plug-ins
in this file (along with site plug-ins).
"""
import imp
import os
import sys
import re
import requests
from string import Template
from difflib import SequenceMatche... |
# encoding: utf-8
# 2013 © Václav Šmilauer <<EMAIL>>
import unittest
from minieigen import *
import woo._customConverters
import woo.core
import woo.dem
import woo.utils
import math
from woo.dem import *
class TestShapePack(unittest.TestCase):
# def setUp(self):
def testLoadSampleTxt(self):
'ShapePack: load sampl... |
import string # pylint: disable=W0402
import random
from django.contrib.auth.models import User
from django.test import TestCase
from student.models import CourseEnrollment
from django_comment_client.permissions import has_permission
from django_comment_common.models import Role
class PermissionsTestCase(Test... |
"""
Tests for class dashboard (Metrics tab in instructor dashboard)
"""
import json
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from mock import patch
from nose.plugins.attrib import attr
from capa.tests.response_xml_factory import StringResponseXMLFactory
from coursewa... |
"""Tests for SoftmaxCrossEntropyWithLogits op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import sys
import numpy as np
from tensorflow.python.client import session
from tensorflow.python.framework import constant_op
from tensorfl... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re
import time
import glob
from ansible.plugins.action.network import ActionModule as _ActionModule
from ansible.module_utils._text import to_text
from ansible.module_utils.six.moves.urllib.parse import urlsplit
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.