content stringlengths 4 20k |
|---|
import os
import re
from testrunner.local import testsuite
from testrunner.local import utils
from testrunner.objects import testcase
from testrunner.outproc import message
INVALID_FLAGS = ["--enable-slow-asserts"]
class TestSuite(testsuite.TestSuite):
def _test_loader_class(self):
return testsuite.JSTestLoa... |
"""Unit tests for the common.py file."""
import gyp.common
import unittest
import sys
class TestTopologicallySorted(unittest.TestCase):
def test_Valid(self):
"""Test that sorting works on a valid graph with one possible order."""
graph = {
'a': ['b', 'c'],
'b': [],
'c': ['d'],
... |
from pyVmomi import vim
from vmwarelib import inventory
from vmwarelib.actions import BaseAction
class VMUpdateNic(BaseAction):
def run(self, vm_id, network_id, vnic_key, ip, subnet, gateway=None, domain=None):
# convert ids to stubs
virtualmachine = inventory.get_virtualmachine(self.si_content,... |
'''Publishes ChromeVox to the webstore.
Given an unpacked extension, compresses and sends to the Chrome webstore.
Releasing to the webstore should involve the following manual steps before
running this script:
1. clean the output directory.
2. make a release build.
3. run manual smoke tests.
... |
'''Supports making amessage from a text file.
'''
from grit.gather import interface
from grit import tclib
class TxtFile(interface.GathererBase):
'''A text file gatherer. Very simple, all text from the file becomes a
single clique.
'''
def Parse(self):
self.text_ = self._LoadInputFile()
self.clique... |
import os
import subprocess
try:
import resource # pylint: disable=F0401
except ImportError:
resource = None # Not available on all platforms
from telemetry.core.platform import posix_platform_backend
class MacPlatformBackend(posix_platform_backend.PosixPlatformBackend):
def StartRawDisplayFrameRateMeasurem... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.core.files import File
from django.conf import settings
class Migration(DataMigration):
def forwards(self, orm):
"""Add default mo... |
"""this module contains a set of functions to handle python protocols for nodes
where it makes sense.
"""
__doctype__ = "restructuredtext en"
from logilab.astng.exceptions import InferenceError, NoDefault
from logilab.astng.node_classes import unpack_infer
from logilab.astng.bases import copy_context, \
raise_if... |
from __future__ import unicode_literals
import string
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db import models
from django.db.models.signals import pre_delete, pre_save
from django.http.request import split_domain_port
from django.utils.encoding import python_2_unicode_com... |
import re
from distutils.version import LooseVersion
from mozpack.errors import errors
from collections import OrderedDict
class Flag(object):
'''
Class for flags in manifest entries in the form:
"flag" (same as "flag=true")
"flag=yes|true|1"
"flag=no|false|0"
'''
def __init_... |
from __future__ import division, print_function, unicode_literals
import logging
from odoo import api, fields, models, _
import odoo.addons.decimal_precision as dp
from odoo.addons.sped_imposto.models.sped_calculo_imposto_item import (
SpedCalculoImpostoItem
)
class PurchaseOrderLine(SpedCalculoImpostoItem, mod... |
import time
import boto
from boto.compat import six
from tests.compat import unittest
from boto.ec2.networkinterface import NetworkInterfaceCollection
from boto.ec2.networkinterface import NetworkInterfaceSpecification
from boto.ec2.networkinterface import PrivateIPAddress
class TestVPCConnection(unittest.TestCase):... |
from __future__ import print_function, division
from sympy.core import Basic, Symbol, Dict, Tuple
class CartanType_generator(Basic):
"""
Constructor for actually creating things
"""
def __call__(self, *args):
c = args[0]
c = list(c)
letter, n = c[0], int(c[1])
if n < ... |
from flask import (Flask,
request,
abort,
)
import os
# Flask app
app = Flask(__name__,
static_folder='static', static_url_path='',
instance_relative_config=True)
CONFIG = os.environ.get('CONFIG') or 'config.Development'
app.config.from_... |
import os
import gettext as gettext_module
from django import http
from django.conf import settings
from django.utils import importlib
from django.utils.translation import check_for_language, activate, to_locale, get_language
from django.utils.text import javascript_quote
from django.utils.encoding import smart_unicod... |
r"""Collect images from multiple simultaneous webcams.
Usage:
1. Define some environment variables that describe what you're collecting.
dataset=your_dataset_name
mode=train
num_views=2
viddir=/tmp/tcn/videos
tmp_imagedir=/tmp/tcn/tmp_images
debug_vids=1
2. Run the script.
export DISPLAY=:0.0 && \
root=learning/brai... |
import os
from django.contrib.auth.models import User
from django.contrib.auth.forms import (UserCreationForm, AuthenticationForm,
PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm)
from django.core import mail
from django.forms.fields import Field, EmailField
from django.test import TestCase
f... |
#!/usr/bin/env python
import _mysql
import sys
import time
import os
import xmltodict
import socket
import logging
import logging.handlers
import subprocess
# This folder needs to be added to new myth storage group called Links
TV_PATH="/myth/tv_downloaded/"
BACKEND_HOST='localhost'
BACKEND_USER='mythtv'
BACKEND_PASS=... |
#!/usr/bin/env python
import datetime
from dateutil.parser import parse
import six
from csvkit.exceptions import InvalidValueForTypeException, InvalidValueForTypeListException
NoneType = type(None)
NULL_VALUES = ('na', 'n/a', 'none', 'null', '.')
TRUE_VALUES = ('yes', 'y', 'true', 't')
FALSE_VALUES = ('no', 'n', '... |
# Common utility functions used by various script execution tests
# e.g. test_cmd_line, test_cmd_line_script and test_runpy
import sys
import os
import re
import os.path
import tempfile
import subprocess
import py_compile
import contextlib
import shutil
import zipfile
from test.support import strip_python_stderr
# ... |
from openerp.tests.common import TransactionCase
from mock import Mock
class TestPropagateOwner(TransactionCase):
def test_propagate_owner_to_cost_estimate(self):
self.source.stock_owner_id = self.partner_1
cel_data = self.wizard_model._prepare_cost_estimate_line(self.source)
self.assertEq... |
from openerp.osv import osv
from openerp.osv import fields
from openerp.tools.translate import _
from datetime import datetime
import re
import uuid
import urlparse
emails_split = re.compile(r"[;,\n\r]+")
class survey_mail_compose_message(osv.TransientModel):
_name = 'survey.mail.compose.message'
_inherit =... |
"""Top-level presubmit script for googleurl.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on the presubmit API built into gcl.
"""
# Files with these extensions will be considered source files
SOURCE_FILE_EXTENSIONS = [
'.c', '.cc', '.cpp', '.h', '.m', '.mm', '.py', '.mk... |
import re
from ... import log, util
from ... import types as sqltypes
from .enumerated import _EnumeratedValues, SET
from .types import DATETIME, TIME, TIMESTAMP
class ReflectedState(object):
"""Stores raw information about a SHOW CREATE TABLE statement."""
def __init__(self):
self.columns = []
... |
""" Tests for the comment_classification module. """
import csv
import os
import sys
import unittest
from unittest.mock import patch
import comment_classification
class CommentClassTest(unittest.TestCase):
""" Comment classification test class. """
@patch("os.path.isfile")
def test_get_comments_no_file(... |
"""SCons.Tool.FortranCommon
Stuff for processing Fortran, common to all fortran dialects.
"""
from __future__ import print_function
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this so... |
from openerp.osv import fields, osv
from openerp import tools
class report_transaction_pos(osv.osv):
_name = "report.transaction.pos"
_description = "transaction for the pos"
_auto = False
_columns = {
'date_create': fields.char('Date', size=16, readonly=True),
'journal_id': fields.many... |
"""
Help has buttons and menu items to open help, blog and forum pages in your primary browser.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from... |
import sys
import os
import types
import doctest
import modulefinder
import traceback
import inspect
from StringIO import StringIO
from unittest import *
import pymel.util
from warnings import warn
TEST_MAIN_FUNC_NAME = "test_main"
SUITE_FUNC_NAME = "suite"
def doctestFriendly(func):
"""
Decorator which prep... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from datetime import date, datetime
from ansible.module_utils._text import to_text
from ansible.module_utils.common._collections_compat import Mapping
from ansible.parsing.yaml.objects import AnsibleVaultEncryptedUnic... |
"""
Detect the audio head and/or tail of the given audio file.
"""
from __future__ import absolute_import
from __future__ import print_function
import sys
from aeneas.audiofile import AudioFileConverterError
from aeneas.audiofile import AudioFileNotInitializedError
from aeneas.audiofile import AudioFileUnsupportedFor... |
from __future__ import absolute_import
# python imports
#import sys
# kaa imports
from ..core import ParseError, Media, MEDIA_AUDIO
AUDIOCORE = ['channels', 'samplerate', 'length', 'encoder', 'codec', 'format',
'samplebits', 'bitrate', 'fourcc', 'trackno', 'id', 'userdate' ]
MUSICCORE = ['trackof', 'al... |
import unittest
import os
import sys
import random
from bioio import getTempFile
from bioio import cigarRead
from bioio import cigarWrite
from bioio import getRandomPairwiseAlignment
from bioio import system
from sonLib.bioio import TestStatus
from sonLib.bioio import logger
class TestCase(unittest.TestCase):
... |
import optparse
from base import CmdBase
class CmdHelp(CmdBase):
"""
help
Show TethysCluster usage
"""
names = ['help']
def execute(self, args):
if args:
cmdname = args[0]
try:
sc = self.subcmds_map[cmdname]
lparser = optparse.... |
from __future__ import unicode_literals, absolute_import
import tempfile
import os
import sys
import subprocess
import mimetypes
import collections
import io
import difflib
import six
class EditProcessException(RuntimeError): pass
class EditableFile(object):
"""
EditableFile saves some data to a temporary file, l... |
"""OpenSSL/M2Crypto AES implementation."""
from .cryptomath import *
from .aes import *
if m2cryptoLoaded:
def new(key, mode, IV):
return OpenSSL_AES(key, mode, IV)
class OpenSSL_AES(AES):
def __init__(self, key, mode, IV):
AES.__init__(self, key, mode, IV, "openssl")
... |
from __future__ import absolute_import
__all__ = ('Manager',)
import templatealchemy as TA
from templatealchemy.util import adict, callingPkgName
from . import sender as sendermod
from . import email
#------------------------------------------------------------------------------
class Manager(object):
#----------... |
import doctest
from insights.parsers import redhat_release
from insights.parsers.redhat_release import RedhatRelease
from insights.tests import context_wrap
REDHAT_RELEASE1 = """
Red Hat Enterprise Linux Server release 6.7 (Santiago)
""".strip()
REDHAT_RELEASE2 = """
Red Hat Enterprise Linux Server release 7.2 (Mai... |
# -*- 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 field 'Feed.search_indexed'
db.add_column('feeds', 'search_indexed',
self.gf(... |
from django.conf import settings
from django.contrib.sites.models import Site, RequestSite, get_current_site
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpRequest
from django.test import TestCase
from django.test.utils import override_settings
class SitesFrameworkTests(TestCase):
... |
from django.db.models.fields import FieldDoesNotExist
from django.db.models.sql.constants import LOOKUP_SEP
from django.db.models.sql.expressions import SQLEvaluator
from django.db.models.sql.where import Constraint, WhereNode
from django.contrib.gis.db.models.fields import GeometryField
class GeoConstraint(Constraint... |
{
'name': 'Accounting Consistency Tests',
'version': '1.0',
'category': 'Accounting',
'description': """
Asserts on accounting.
======================
With this module you can manually check consistencies and inconsistencies of accounting module from menu Reporting/Accounting/Accounting Tests.
You can ... |
import logging
import os
import numpy as np
import pandas as pd
from logutils import BraceMessage as __
from tqdm import tqdm
import simulators
from mingle.models.broadcasted_models import one_comp_model
from mingle.utilities.chisqr import chi_squared
from mingle.utilities.phoenix_utils import generate_bhm_config_par... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from django.conf import settings
from django.core.urlresolvers import reverse
from tests.utils import pipeline_settings
class MiddlewareTest(TestCase):
def test_middleware_off(self):
response = self.client.g... |
import json
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.serializers.json import DjangoJSONEncoder
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from django.shortcuts import render_to_response
from django.template import RequestC... |
"""
BioVida-Images Subpackage Unit Testing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
# Note: 'medpix.png' is simply a blank images of same correct size.
# To test the OpeniImageProcessing() class, it will need to be replaced
# with an actual MedPix image.
import os
import sys
import unittest
import pandas a... |
"""
This module converts code written for Numeric to run with numpy
Makes the following changes:
* Changes import statements (warns of use of from Numeric import *)
* Changes import statements (using numerix) ...
* Makes search and replace changes to:
- .typecode()
- .iscontiguous()
- .byteswapped()
- .... |
import re
from pykwalify.core import Core
from pykwalify.errors import SchemaError
# we can't use pkg-relative imports here because pykwalify imports this file as
# its own pkg
from papr.utils import common
# http://stackoverflow.com/questions/2532053/
def _valid_hostname(hostname):
if len(hostname) > 253:
... |
from copy import deepcopy
from itertools import count,repeat
import json
import networkx as nx
__author__ = """Aric Hagberg (<EMAIL>))"""
__all__ = ['adjacency_data', 'adjacency_graph']
def adjacency_data(G):
"""Return data in adjacency format that is suitable for JSON serialization
and use in Javascript docum... |
import os
from mutagen import asf
from tests import TestCase, get_data_path
from quodlibet.formats.wma import WMAFile, unpack_image, pack_image
from quodlibet.formats._image import APICType, EmbeddedImage
from quodlibet.compat import cBytesIO
from .helper import get_temp_copy
class TWMAFile(TestCase):
def set... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import SafeClass, UnsafeClass, setup
class AutoescapeTagTests(SimpleTestCase):
@setup({'autoescape-tag01': '{% autoescape off %}hello{% endautoescape %}'})
def te... |
"""Test converted models layer by layer
"""
import argparse
import logging
import os
import warnings
import numpy as np
import cv2
import mxnet as mx
logging.basicConfig(level=logging.INFO)
def read_image(img_path, image_dims=None, mean=None):
"""
Reads an image from file path or URL, optionally resizing to... |
"""OpenStack logging handler.
This module adds to logging functionality by adding the option to specify
a context object when calling the various log methods. If the context object
is not specified, default formatting is used. Additionally, an instance uuid
may be passed as part of the log message, which is intended ... |
from case import Case
class Case1_2_8(Case):
DESCRIPTION = """Send binary message message with payload of length 65536. Sent out data in chops of 997 octets."""
EXPECTATION = """Receive echo'ed binary message (with payload as sent). Clean close with normal code."""
def onOpen(self):
payload ... |
from quantum.openstack.common.rpc import proxy
class LbaasAgentApi(proxy.RpcProxy):
"""Agent side of the Agent to Plugin RPC API."""
API_VERSION = '1.0'
def __init__(self, topic, context, host):
super(LbaasAgentApi, self).__init__(topic, self.API_VERSION)
self.context = context
s... |
import base64
import cgi
import Cookie
import StringIO
import tempfile
import urlparse
import stash
from utils import HTTPException
missing = object()
class Server(object):
"""Data about the server environment
.. attribute:: config
Environment configuration information with information about the
v... |
# -*- coding: utf-8 -*-
__author__ = 'Alex Bo'
__email__ = '<EMAIL>'
import math
from torhandlers.exceptions import ImproperlyConfigured
from torhandlers.base import ContextMixin, GenericHandler, TemplateResponseMixin
from torhandlers.pagination import Page
from sqlalchemy import func
class MultipleObjectsMixin(Cont... |
from meld.matchers import diffutil
from meld.matchers.myers import MyersSequenceMatcher
LO, HI = 1, 2
class AutoMergeDiffer(diffutil.Differ):
_matcher = MyersSequenceMatcher
# _matcher = PatienceSequenceMatcher
def __init__(self):
super().__init__()
self.auto_merge = False
self.... |
import abc
import six
from ryu.lib import stringify
@six.add_metaclass(abc.ABCMeta)
class PacketBase(stringify.StringifyMixin):
"""A base class for a protocol (ethernet, ipv4, ...) header."""
_TYPES = {}
@classmethod
def get_packet_type(cls, type_):
"""Per-protocol dict-like get method.
... |
import res_users
import controllers
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'build'))
import time
import random
import psmove
def mapidx(l):
x, y = l.split(': ')
return (y, int(x))
# Run mk-index.py to create the file serials.txt, which contains an ordered
# list of controllers' serial number... |
""" Code generation for slicing.
This is about slice lookups, assignments, and deletions. There is also a
special case, for using index values instead of objects. The slice objects
are also created here, and can be used for indexing.
"""
from .ErrorCodes import (
getErrorExitBoolCode,
getErrorExitCode,
ge... |
import argparse
import datetime
import os
import re
import sys
from collections import defaultdict
################################################################################
# Argument Parser
################################################################################
DESCRIPTION = """Python script to help... |
"""
====================================================
Plot multinomial and One-vs-Rest Logistic Regression
====================================================
Plot decision surface of multinomial and One-vs-Rest Logistic Regression.
The hyperplanes corresponding to the three One-vs-Rest (OVR) classifiers
are repre... |
"""Tests for the bulk_change_enrollment command."""
import ddt
from django.core.management import call_command
from django.core.management.base import CommandError
from mock import patch, call
from student.tests.factories import UserFactory, CourseModeFactory, CourseEnrollmentFactory
from student.models import CourseE... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import codecs
import json
from ansible.parsing.ajson import AnsibleJSONEncoder, AnsibleJSONDecoder
from ansible.plugins.cache import BaseFileCacheModule
class CacheModule(BaseFileCacheModule):
"""
A caching module backed... |
import time
from openerp.osv import fields, osv
from openerp.tools.translate import _
class hr_holidays_summary_dept(osv.osv_memory):
_name = 'hr.holidays.summary.dept'
_description = 'HR Leaves Summary Report By Department'
_columns = {
'date_from': fields.date('From', required=True),
'de... |
import os
from webassets.filter import ExternalTool
__all__ = ('CleanCSS',)
class CleanCSS(ExternalTool):
"""
Minify css using `Clean-css <https://github.com/GoalSmashers/clean-css/>`_.
Clean-css is an external tool written for NodeJS; this filter assumes that
the ``cleancss`` executable is in the... |
#! /usr/bin/python
#
# Dilip Antony Joseph (dilip.antony.joseph at gmail.com)
# http://www.cs.berkeley.edu/~dilip/wireshark-protobuf
#
# NOTE FROM AUTHOR:
# This is my first Python program. I am still learning the
# language. If you find any glaring errors or coding style
# violations, please do email me.
import sy... |
import datetime
import StringIO
import sys
from django.conf import settings
from django.core.mail import mail_managers, mail_admins
from django.template.loader import render_to_string
from django.contrib.sites.models import Site
from twill.parse import execute_string
from twill.errors import TwillAssertionError
def ... |
import random
class Node(object):
val = None
pri = 0
parent = None
left = None
right = None
size = 0
def __init__(self, val):
self.val = val
self.size = 1
self.pri = random.random()
def rotate(self):
if not self.parent: return
p = self.parent
gp = self.pare... |
# Python
import json
import logging
import os
# Requests
import requests
from requests.structures import CaseInsensitiveDict
__all__ = []
logger = logging.getLogger('lmiapi.public')
class LogMeInPublicAPIBase(object):
API_ROOT = None
def __init__(self, creds):
assert self.API_ROOT
self.cr... |
import time
from tests.compat import unittest
from nose.plugins.attrib import attr
from boto.route53.connection import Route53Connection
from boto.exception import TooManyRecordsException
from boto.vpc import VPCConnection
@attr(route53=True)
class TestRoute53Zone(unittest.TestCase):
@classmethod
def setUpCla... |
from lxml import html
from lxml import etree
import copy
import json
import os
import requests
import shutil
import subprocess
import urllib
# Paths for en-US plugins included in the core Android repo.
EN_PLUGINS_DIR_URL = "https://hg.mozilla.org/releases/mozilla-aurora/file/default/mobile/locales/en-US/searchplugins"... |
"""
Dict client protocol implementation.
@author: Pavel Pergamenshchik
"""
from twisted.protocols import basic
from twisted.internet import defer, protocol
from twisted.python import log
from StringIO import StringIO
def parseParam(line):
"""Chew one dqstring or atom from beginning of line and return (param, rem... |
from __future__ import absolute_import, unicode_literals
from case import Mock, patch
from amqp.utils import (NullHandler, bytes_to_str, coro, get_errno, get_logger,
str_to_bytes)
class test_get_errno:
def test_has_attr(self):
exc = KeyError('foo')
exc.errno = 23
... |
from oslo_config import cfg
from ironic.common.i18n import _
opts = [
cfg.BoolOpt('enabled', default=False,
help=_('whether to enable inspection using ironic-inspector')),
cfg.StrOpt('service_url',
help=_('ironic-inspector HTTP endpoint. If this is not set, '
... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys
import os
import subprocess
import tempfile
import re
CLIENT_DATA_ROOT = os.path.realpath(
os.path.join(
os.path.dirname(__file__),
u'..',
)
)
class MinimapRenderer(object):
MAP_RE = re.compile(r'^\d{3}-\d{1}(\.tmx)?$')
PROGRAMS ... |
import copy
import time
import base64
import hmac
from hashlib import sha256
from libcloud.utils.py3 import httplib
from libcloud.utils.py3 import b
from libcloud.utils.xml import fixxpath
try:
from lxml import etree as ET
except ImportError:
from xml.etree import ElementTree as ET
from libcloud.common.type... |
"""
Tools for sending email.
"""
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
# Imported for backwards compatibility, and for the sake
# of a cleaner namespace. These symbols used to be in
# django/core/mail.py before the int... |
from google.appengine.ext import ndb
import webapp2
COUNTER_KEY = 'default counter'
class Counter(ndb.Model):
count = ndb.IntegerProperty(indexed=False)
class UpdateCounterHandler(webapp2.RequestHandler):
def post(self):
amount = int(self.request.get('amount'))
# This task should run at m... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
# A list of C++ examples to run in order to ensure that they remain
# buildable and runnable over time. Each tuple in the list contains
#
# (example_name, do_run, do_valgrind_run).
#... |
# -*- coding: utf-8 -*-
"""
werkzeug.testsuite.datastructures
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests the functionality of the provided Werkzeug
datastructures.
TODO:
- FileMultiDict
- convert to proper asserts
- Immutable types undertested
- Split up dict tests
:copy... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : code_property
Description : Set properties for Lookup data type
Date : 09/February/2017
copyright : (C) 2017 by UN-Habitat and implementing partners.
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import signal
import select
import time
from subprocess import Popen, PIPE
sys.path.insert(0, './')
if sys.argv[-3] == '-c':
client_config = sys.argv[-1]
server_config = sys.argv[-2]
elif sys.argv[-2] == '-c':
client_config = sys.argv[-1]
... |
from __future__ import absolute_import
from chaco.abstract_overlay import AbstractOverlay
from traits.has_traits import on_trait_change
from traits.trait_types import List
# ============= standard library imports ========================
# ============= local library imports ==========================
from pychron.spe... |
from Plugins.Plugin import PluginDescriptor
from GraphMultiEpg import GraphMultiEPG
from Screens.ChannelSelection import BouquetSelector
from enigma import eServiceCenter, eServiceReference
from ServiceReference import ServiceReference
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from Co... |
import smtplib
import datetime
from email.mime.text import MIMEText
from flask import render_template
from flask_mail import Message
from webapp.extensions import celery, mail
from webapp.models import Reminder, Post
@celery.task()
def log(msg):
return msg
@celery.task()
def multiply(x, y):
return x * y
... |
# -*- coding: utf-8 -*-
from django.contrib.localflavor.se.forms import (SECountySelect,
SEOrganisationNumberField, SEPersonalIdentityNumberField,
SEPostalCodeField)
import datetime
from utils import LocalFlavorTestCase
class SELocalFlavorTests(LocalFlavorTestCase):
def setUp(self):
# Mocking da... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urllib_request
from ..utils import (
ExtractorError,
find_xpath_attr,
)
class FlickrIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.|secure\.)?flickr\.com/photos/(?P<uploader_id>[\w\-_@]+)/... |
from collections import Counter, OrderedDict
from itertools import chain
from operator import attrgetter
from django.db import IntegrityError, connections, transaction
from django.db.models import signals, sql
from django.utils import six
class ProtectedError(IntegrityError):
def __init__(self, msg, protected_ob... |
import glob
import os
import re
from oslo_log import log as logging
import six
from neutron.common import utils
from neutron.i18n import _LE, _LW
from neutron.plugins.ml2.drivers.mech_sriov.agent.common \
import exceptions as exc
from neutron.plugins.ml2.drivers.mech_sriov.agent import pci_lib
LOG = logging.getL... |
"""
This component provides HA sensor support for Amcrest IP cameras.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.amcrest/
"""
from datetime import timedelta
import logging
import voluptuous as vol
import homeassistant.helpers.config_validatio... |
# -*- coding: utf-8 -*-
"""
Method to extend interpolation objects to constantly / linearly extrapolate.
"""
#:copyright: Copyright 2015 by Christoph Kirst, The Rockefeller University, New York City
#:license: GNU, see LICENSE.txt for details.
import scipy.interpolate
from numpy import array
def extrap1d(x, y, int... |
#!/usr/bin/python
'''
entrydns-updater.py ~ ajclarkson.co.uk
Updater for Dynamic DNS on EntryDNS Domains
Performs an update for each given domain access token in
the hosts.json file.
'''
import json
from urllib2 import urlopen
import requests
import os
from time import strftime
SCRIPT_PATH = os.path.dirname(os.path.r... |
from django.template.defaultfilters import rjust
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class RjustTests(SimpleTestCase):
@setup({'rjust01': '{% autoescape off %}.{{ a|rjust:"5" }}. .{{ b|rjust:"5" }}.{% endautoescape %}'})
def test_rju... |
from openerp.osv import fields, osv
class product_price_list(osv.osv_memory):
_name = 'product.price_list'
_description = 'Price List'
_columns = {
'price_list': fields.many2one('product.pricelist', 'PriceList', required=True),
'qty1': fields.integer('Quantity-1'),
'qty2': fields.... |
#!/usr/bin/env python
# Parse the options the user provided from the command line
def option_parser():
parser = OptionParser()
parser.add_option("-v", action="store_true", dest="verbose", default=False)
parser.add_option("--inplace", action="store_true", dest="inplace", default=False)
parser.add_option(... |
import unittest
import numpy
from chainer.backends import cuda
from chainer import functions
from chainer import testing
from chainer.testing import attr
from chainer.utils import type_check
@testing.inject_backend_tests(
None,
# CPU tests
[
{},
]
# GPU tests
+ testing.product({
... |
from case9_3_1 import Case9_3_1
class Case9_3_5(Case9_3_1):
DESCRIPTION = """Send fragmented text message message with message payload of length 4 * 2**20 (4M). Sent out in fragments of 16k."""
EXPECTATION = """Receive echo'ed text message (with payload as sent)."""
def init(self):
self.DATA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.