content stringlengths 4 20k |
|---|
from sympy import symbols
from sympy.physics.mechanics import *
# -- Declare symbols.
# Declare degrees of freedom, and their time derivatives.
# TODO get rid of those which are unnecessary.
qA, qB, uA, uB = dynamicsymbols('qA qB uA uB')
qAd, qBd, uAd, uBd = dynamicsymbols('qA qB uA uB', 1)
# Declare the constants i... |
import re
import tempfile
class Subversion(object):
def __init__(
self, module, dest, repo, revision, username, password, svn_path):
self.module = module
self.dest = dest
self.repo = repo
self.revision = revision
self.username = username
self.password = ... |
"""
Various data structures used in query construction.
Factored out from django.db.models.query to avoid making the main module very
large and/or so that they can be used by other modules without getting into
circular import difficulties.
"""
from __future__ import unicode_literals
from django.db.backends import uti... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division
from unittests_utils import *
def load_input_data1():
world = World_Trace()
ob = []
from roslib.packages import find_resource
TEST_INPUT_DATA = find_resource(PKG, 'data1.csv')[0]
with open(TEST_INPUT_DATA)... |
import os
import subprocess
def cli_call(context, arg_list, expect_success=True):
"""Executes a CLI command in a subprocess and return the results.
@param context: the behave context
@param arg_list: a list command arguments
@param expect_success: use False to return even if an error occurred when ex... |
import logging
import os
import string
import sys
from itertools import islice
from aspectlib import Aspect
from aspectlib import mimic
try:
from types import InstanceType
except ImportError:
InstanceType = type(None)
logger = logging.getLogger(__name__)
def frame_iterator(frame):
"""
Yields frames... |
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.admin.util import quote
from django.utils.translation import ugettext, ugettext_lazy as _
from django.utils.encoding import smart_text
fro... |
"""This example demonstrates how the LSTM-CRF model can be implemented
in Gluon to perform noun-phrase chunking as a sequence labeling task.
"""
import sys
import mxnet as mx
from mxnet import autograd as ag, ndarray as nd, gluon
from mxnet.gluon import Block, nn, rnn
import mxnet.optimizer as optim
mx.random.seed(1)
... |
"""
a simple multilayer perceptron
"""
import mxnet as mx
def get_symbol(num_classes=10, **kwargs):
data = mx.symbol.Variable('data')
data = mx.sym.Flatten(data=data)
fc1 = mx.symbol.FullyConnected(data=data, name='fc1', num_hidden=128)
act1 = mx.symbol.Activation(data=fc1, name='relu1', act_type="rel... |
import json
import requests
from artifactor import ArtifactorBasePlugin
def overall_test_status(statuses):
# Handle some logic for when to count certain tests as which state
for when, status in statuses.items():
if when == "call" and status[1] and status[0] == "skipped":
return "xfailed"... |
from __future__ import unicode_literals
import json
import sys
from django.conf import settings
from django.core.exceptions import ValidationError # backwards compatibility
from django.utils import six, timezone
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.html import e... |
import constants
# 255: Control characters that usually does not exist in any text
# 254: Carriage/Return
# 253: symbol (punctuation) that does not belong to word
# 252: 0 - 9
# Character Mapping Table:
Latin7_CharToOrderMap = ( \
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
255,255,255,255,... |
oneline = "Read dump files with line segment info"
docstr = """
l = ldump("dump.one") read in one or more dump files
l = ldump("dump.1 dump.2.gz") can be gzipped
l = ldump("dump.*") wildcard expands to multiple files
l = ldump("dump.*",0) two args = store filenames, but don't read
incomplete and... |
"""Test for Groups service."""
__author__ = '<EMAIL>'
import unittest
try:
from xml.etree import ElementTree
except ImportError:
from elementtree import ElementTree
import atom
import gdata.apps
import gdata.apps.service
import gdata.apps.groups.service
import getpass
import time
domain = ''
admin_email = ''
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from tensorflow.core.protobuf import config_pb2
from tensorflow.python.client import session
from tensorflow.python.framework import ops
from tensorflow.python.framework import test_util
from tensorfl... |
"""
Documents:
* "Microsoft Word for Windows 2.0 Binary Format"
http://www.wotsit.org/download.asp?f=word2&sc=275927573
"""
from hachoir_core.field import (FieldSet, Enum,
Bit, Bits,
UInt8, Int16, UInt16, UInt32, Int32,
NullBytes, Bytes, RawBytes, PascalString16,
DateTimeMSDOS32, TimeDateMSDOS32)
f... |
"""
sentry.nodestore.riak.client
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2015 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import socket
from random import shuffle
from time import time
from threading import Lock, ... |
# -*- 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):
# Adding index on 'HostMaintenance', fields ['host', 'maintenance']
db.cr... |
# A sample context menu handler.
# Adds a 'Hello from Python' menu entry to .py files. When clicked, a
# simple message box is displayed.
#
# To demostrate:
# * Execute this script to register the context menu.
# * Open Windows Explorer, and browse to a directory with a .py file.
# * Right-Click on a .py file - locate... |
"""Using takewhile()
"""
__version__ = "$Id$"
#end_pymotw_header
from itertools import *
def should_take(x):
print 'Testing:', x
return (x<2)
for i in takewhile(should_take, [ -1, 0, 1, 2, 3, 4, 1, -2 ]):
print 'Yielding:', i |
import numpy as np
import os
import argparse
import espressomd
from espressomd.observables import ParticlePositions, ParticleVelocities, ParticleAngularVelocities # pylint: disable=unused-import
from espressomd.accumulators import Correlator
espressomd.assert_features(
["ENGINE", "ROTATION", "MASS", "ROTATIONAL_... |
import fixtures
from oslo_config import cfg
import six
class Config(fixtures.Fixture):
"""Allows overriding configuration settings for the test.
`conf` will be reset on cleanup.
"""
def __init__(self, conf=cfg.CONF):
self.conf = conf
def setUp(self):
super(Config, self).setUp()... |
from __future__ import unicode_literals
from frappe import _
from frappe.desk.moduleview import add_setup_section
def get_data():
data = [
{
"label": _("Users"),
"icon": "fa fa-group",
"items": [
{
"type": "doctype",
"name": "User",
"description": _("System and Website Users")
},
... |
"""
Tests for student enrollment.
"""
import ddt
from django.core.cache import cache
from nose.tools import raises
import unittest
from django.test import TestCase
from django.test.utils import override_settings
from django.conf import settings
from enrollment import api
from enrollment.errors import EnrollmentApiLoadE... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import modelcluster.fields
import wagtail.wagtailcore.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0010_change_page_owner_to_null_on_delete'),
]
operations... |
# encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python2.7/dist-packages/PyQt4/QtGui.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
from QLayout import QLayout
class QStackedLayout(QLayout):
"""
QStackedLayout()
QStackedLayout(QWidget)
QStackedLayout(QLayout)
... |
# Module 'ntpath' -- common operations on WinNT/Win95 pathnames
"""Common pathname manipulations, WindowsNT/95 version.
Instead of importing this module directly, import os and refer to this
module as os.path.
"""
import os
import sys
import stat
import genericpath
import warnings
from genericpath import *
from gene... |
# coding: utf-8
from __future__ import print_function, unicode_literals
import datetime
import logging
from django.core.management.base import BaseCommand
from django.utils import timezone
from modoboa.core.models import Log
from modoboa.parameters import tools as param_tools
class Command(BaseCommand):
"""Co... |
from __future__ import absolute_import
from sentry.api.base import DocSection
from sentry.api.bases.project import ProjectEndpoint
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.api.serializers import serialize
from sentry.models import TagKey, TagKeyStatus, TagValue
class ProjectTagKeyValuesEndp... |
# -*- coding: utf-8 -*-
from gluon import *
from s3 import S3CustomController
THEME = "historic.NZRC"
# =============================================================================
class index(S3CustomController):
""" Custom Home Page """
def __call__(self):
output = {}
# Allow editing of... |
from __future__ import division, print_function
if __name__ == '__main__':
import matplotlib
matplotlib.use('Agg')
import os
import numpy as np
from glob import glob
import datetime
import sys
from astrometry.util.ttime import Time
from obiwan.decals_sim import get_parser,ptime
from obiwan.decals_sim import m... |
'''Character CNN code for DSL 2016 task 2
Partly based on:
https://github.com/fchollet/keras/blob/master/examples/imdb_cnn.py
'''
from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
import tensorflow as tf
tf.set_random_seed(1337) # probably not needed
from keras.pr... |
from __future__ import unicode_literals
from pre_commit.languages import node
from pre_commit.languages import pcre
from pre_commit.languages import python
from pre_commit.languages import ruby
from pre_commit.languages import script
from pre_commit.languages import system
# A language implements the following consta... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'curated'}
from ansible.module_utils.basic import *
from ansible.module_utils.azure_rm_common import *
try:
from msrestazure.azure_exceptions import CloudError
from azure.common impor... |
microcode = '''
def macroop UNPCKLPS_XMM_XMM {
unpack xmmh, xmml, xmmlm, ext=1, size=4
unpack xmml, xmml, xmmlm, ext=0, size=4
};
def macroop UNPCKLPS_XMM_M {
ldfp ufp1, seg, sib, disp, dataSize=8
unpack xmmh, xmml, ufp1, ext=1, size=4
unpack xmml, xmml, ufp1, ext=0, size=4
};
def macroop UNPCKLPS... |
import datetime
from collections import defaultdict # , OrderedDict
from copy import copy
from django.conf import settings
from django.db import connection
from django.db.models import Count, Sum
from snf_django.lib.astakos import UserCache
from synnefo.plankton.backend import PlanktonBackend
from synnefo.db.models ... |
'''
Functions for simplifying access to the pyevdev API
'''
import re
import evdev
class Reader:
class InitError(Exception):
"""
Exception raised for deviceInit problems
"""
def __init__(self, message):
self.message = message
class ReaderError(Exception):
... |
#!/usr/bin/env python
""" Standard encoding tables used in PDF.
This table is extracted from PDF Reference Manual 1.6, pp.925
"D.1 Latin Character Set and Encodings"
"""
ENCODING = [
# (name, std, mac, win, pdf)
('A', 65, 65, 65, 65),
('AE', 225, 174, 198, 198),
('Aacute', None, 231, 193, 193),
('Acircu... |
import re
from django.conf import settings
from django.core import urlresolvers
import localeurl.settings
SUPPORTED_LOCALES = dict(settings.LANGUAGES)
LOCALES_RE = '|'.join(SUPPORTED_LOCALES)
PATH_RE = re.compile(r'^/(?P<locale>%s)(?P<path>.*)$' % LOCALES_RE)
DOMAIN_RE = re.compile(r'^(?P<locale>%s)\.(?P<domain>.*)$' ... |
import account_invoice_layout
import report
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""Tests for the factory functions to create proximal operators."""
from __future__ import division
import numpy as np
import scipy.special
import odl
from odl.solvers.nonsmooth.proximal_operators import (
combine_proximals, proximal_const_func,
proximal_box_constraint, proximal_nonnegativity,
proximal_co... |
import os
import sys
import logging
import platform
try:
import sh
except ImportError:
import pbs as sh
SUPPORTED_PLATFORMS = {
"Ubuntu": [
"trusty",
],
}
APT_DEPENDENCIES = {
"trusty": [
"closure-compiler",
"libffi-dev",
"memcached",
"rabbitmq-server",
... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
doSettings.py
---------------------
Date : June 2010
Copyright : (C) 2010 by Giuseppe Sucameli
Email : brush dot tyler at gmail dot com
*****************... |
import string
import tensorflow as tf
import tensorflow_federated as tff
from analytics.heavy_hitters import heavy_hitters_testcase as hh_test
from triehh import triehh_tf
from triehh import triehh_tff
class TriehhTffTest(hh_test.HeavyHittersTest):
def create_dataset(self, size):
def create_dataset_fn(clien... |
import os
import ycm_core
from clang_helpers import PrepareClangFlags
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
# Most projects will NOT n... |
"""
This module contains the core classes of version 2.0 of SAX for Python.
This file provides only default classes with absolutely minimum
functionality, from which drivers and applications can be subclassed.
Many of these classes are empty and are included only as documentation
of the interfaces.
$Id: handler.py 35... |
#!/usr/bin/python
# output xml format:
# <pages>
# <page url="xx"><prev url="yyy">zzz</prev><next url="hhh">lll</next><fragment>file.frag</fragment></page>
# ...
# </pages>
import pickle
import os
import codecs
def dump_pickles(out, dirname, filename, path):
f = open(os.path.join(dirname, filename), 'r')
da... |
"""
Testing Class for Chrome Apps against Indivo
Ben Adida
<EMAIL>
Steve Zabak
<EMAIL>
"""
import urllib
try:
from ..oauth import oauth
except:
from oauth import oauth
class OAuth(object):
def get_oauth_request_header(self,
method,
parameters... |
"""Excerpts of six.py"""
# Copyright (C) 2010-2014 Benjamin Peterson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, ... |
#!/usr/bin/python
"""
This script will scan an autotest server results directory for job result
directories that have completed and that have not yet been published on
a remote dashboard server matching given filtering options and for those it
finds it will rsync them to the tko server and mark them as published (it us... |
from __future__ import print_function
from datetime import datetime
import six
from six.moves.urllib.parse import quote
from email.utils import parsedate
def parse_datetime(string):
return datetime(*(parsedate(string)[:6]))
def parse_html_value(html):
return html[html.find('>')+1:html.rfind('<')]
def ... |
import unittest
import ccs
import datetime
####################################################################################################################
# BTCC #
##########################################... |
from openerp.addons.mail.tests.common import TestMail
from openerp.tools import mute_logger
from datetime import datetime
class TestSale(TestMail):
@mute_logger('openerp.addons.base.ir.ir_model', 'openerp.osv.orm')
def setUp(self):
super(TestSale, self).setUp()
def test_sale_to_invoice(self):
... |
from __future__ import unicode_literals
import os
import re
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL
from django.core.management import call_command
from django.db import connection, connections
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import mod... |
import sys
import os
import shlex
import re
import codecs
import jinja2
import yaml
import optparse
from operator import methodcaller
try:
import json
except ImportError:
import simplejson as json
from ansible import errors
import ansible.constants as C
########################################################... |
"""A module to hold linux specific action implementations."""
import cr
class LinuxRunner(cr.Runner):
"""An implementation of cr.Runner for the linux platform.
This supports directly executing the binaries from the output directory.
"""
@property
def enabled(self):
return cr.LinuxPlatform.GetInstance... |
import mock
from openstackclient.tests import fakes
from openstackclient.tests import utils
from openstackclient.tests.volume.v1 import fakes as volume_fakes
image_id = 'im1'
image_name = 'graven'
image_owner = 'baal'
image_protected = False
image_public = True
image_properties = {
'Alpha': 'a',
'Beta': 'b',... |
from django.conf.urls import patterns
from django.conf.urls import url
from openstack_dashboard.dashboards.identity.projects import views
urlpatterns = patterns(
'',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^create$', views.CreateProjectView.as_view(), name='create'),
url(r'^(?P<ten... |
from msrest.serialization import Model
class PagingGetMultiplePagesOptions(Model):
"""Additional parameters for the Paging_get_multiple_pages operation.
:param maxresults: Sets the maximum number of items to return in the
response.
:type maxresults: int
:param timeout: Sets the maximum time that... |
import base64
import datetime
import logging
from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _, ugettext_lazy as _t
from enum import Enum
from librdbm... |
"""Unit test for depstree."""
__author__ = '<EMAIL> (Nathan Naze)'
import unittest
import jscompiler
class JsCompilerTestCase(unittest.TestCase):
"""Unit tests for jscompiler module."""
def testGetJsCompilerArgs(self):
original_check = jscompiler._JavaSupports32BitMode
jscompiler._JavaSupports32BitM... |
"""
==========================================
Statistical functions (:mod:`scipy.stats`)
==========================================
.. module:: scipy.stats
This module contains a large number of probability distributions as
well as a growing library of statistical functions.
Each univariate distribution is an insta... |
from openerp import tools
from openerp.osv import fields,osv
class report_lunch_order(osv.osv):
_name = "report.lunch.order.line"
_description = "Lunch Orders Statistics"
_auto = False
_rec_name = 'date'
_columns = {
'date': fields.date('Date Order', readonly=True, select=True),
'ye... |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
from os.path import join
def configuration(parent_package='', top_path=None):
import warnings
from numpy.distutils.misc_util import Configuration
from numpy.distutils.system_info import get_info, BlasNotFoundError
... |
"""Setup.py module for the workflow's worker utilities.
All the workflow related code is gathered in a package that will be built as a
source distribution, staged in the staging area for the workflow being run and
then installed in the workers when they start running.
This behavior is triggered by specifying the --se... |
import Queue
import os
import sys
import threading
import traceback
import logging
logger = logging.getLogger(__name__)
from thrift.Thrift import TProcessor
from thrift.protocol import TBinaryProtocol
from thrift.transport import TTransport
class TServer:
"""Base interface for a server, which must have a serve() ... |
import array
from PyQt5.QtCore import Qt
from PyQt5.QtTest import QTest
from tests.QtTestCase import QtTestCase
from urh import constants
from urh.controller.FuzzingDialogController import FuzzingDialogController
from urh.signalprocessing.Encoding import Encoding
from urh.signalprocessing.Modulator import Modulator
... |
import os
import sys
from releaseutils import JIRA, JIRAError, get_jira_name, Github, get_github_name, \
contributors_file_name, is_valid_author, capitalize_author, yesOrNoPrompt
# You must set the following before use!
JIRA_API_BASE = os.environ.get("JIRA_API_BASE", "https://issues.apache.org/jira")
JIRA_USERNAM... |
from . import chart_object
from . import fill_style
from . import font
from . import legend_doc
from . import line_style
from . import theme
from . import tick_mark
from . import pychart_util
from .pychart_types import *
class Entry(chart_object.T):
keys = {"line_len": (UnitType, None,
"L... |
"""
Generator that produces an externs file for the Closure Compiler.
Note: This is a work in progress, and generated externs may require tweaking.
See https://developers.google.com/closure/compiler/docs/api-tutorial3#externs
"""
from code import Code
from js_util import JsUtil
from model import *
from schema_util im... |
"""
# Notes:
- This simulation seeks to emulate the COBAHH benchmark simulations of (Brette
et al. 2007) using the Brian2 simulator for speed benchmark comparison to
DynaSim. However, this simulation includes CLOCK-DRIVEN synapses, for direct
comparison to DynaSim's clock-driven architecture. The synaptic connec... |
#! -*- coding: utf-8 -*-
from __future__ import unicode_literals
from studio.core.engines import db
from sqlalchemy.ext.hybrid import hybrid_property
__all__ = [
'LevelModel',
'StaffModel',
]
class LevelModel(db.Model):
__tablename__ = 'level'
id = db.Column(db.Integer(), nullable=False, primary_k... |
from datetime import date
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from mock import patch
from nose.tools import eq_
import mkt
from mkt.comm.forms import CommAttachmentForm
from mkt.reviewers.forms import ModerateLogForm
from mkt.site.tests import TestCase
@pa... |
# This code is a simple hyperquadratic Baseyain classifier. The training set in the begining is created by matlab
# for tow-dimensional multivariate normal distribution with following mean and coveriance matrix.
#
####### mu = [2 3 1 .5];
####### SIGMA = [1 1/2 1/10 1/25; 1/2 4 1/32 1/5; 1/10 1/32 6 1/8; 1/25 1/5 1/... |
from __future__ import unicode_literals
import unittest
from datetime import datetime
from django.core.paginator import (
EmptyPage, InvalidPage, PageNotAnInteger, Paginator,
)
from django.test import TestCase
from django.utils import six
from .custom import ValidAdjacentNumsPaginator
from .models import Article... |
"""
Helper functions for test tasks
"""
from paver.easy import sh, task
from pavelib.utils.envs import Env
import os
import subprocess
MONGO_PORT_NUM = int(os.environ.get('EDXAPP_TEST_MONGO_PORT', '27017'))
MONGO_HOST = os.environ.get('EDXAPP_TEST_MONGO_HOST', 'localhost')
__test__ = False # do not collect
@task
d... |
__source__ = ' https://leetcode.com/problems/maximum-depth-of-n-ary-tree/'
# Time: O(N)
# Space: O(N)
#
# Description: Leetcode # 559. Maximum Depth of N-ary Tree
#
# Given a n-ary tree, find its maximum depth.
#
# The maximum depth is the number of nodes along the longest path
# from the root node down to the farthes... |
import numpy as np
import pytest
import yaml
from pytest import approx
from pymt.services.constant.constant import ConstantScalars
def test_initialize(tmpdir):
with tmpdir.as_cwd():
with open("params.yml", "w") as fp:
yaml.dump({"foo": 2, "bar": 3.0}, fp)
c = ConstantScalars()
... |
"""Test script for ftplib module."""
# Modified by Giampaolo Rodola' to test FTP class and IPv6 environment
import ftplib
import threading
import asyncore
import asynchat
import socket
import StringIO
from unittest import TestCase
from test import test_support
from test.test_support import HOST
# the dummy data re... |
import unittest
import textwrap
import re
import codewave_core.util as util
import codewave_core.codewave as codewave
import codewave_core.text_parser as text_parser
import test.test_helper as test_helper
class PhpTestCase(unittest.TestCase):
def setUp(self):
codewave.init()
self.replacement = None... |
"""Random number interface of MXNet."""
from __future__ import absolute_import
import ctypes
from .base import _LIB, check_call
from .ndarray._internal import _sample_uniform as uniform
from .ndarray._internal import _sample_normal as normal
from .ndarray._internal import _sample_gamma as gamma
from .ndarray._internal... |
"""
ArXiv Pdf Checker Task
Checks arxiv records for missing pdfs and downloads them from arXiv
"""
import os
import time
import re
from datetime import datetime
from tempfile import NamedTemporaryFile
from xml.dom import minidom
import socket
from invenio.legacy.bibdocfile.cli import bibupload_ffts
from invenio.lega... |
from __future__ import unicode_literals
import json
import re
from .common import InfoExtractor
class NewgroundsIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?newgrounds\.com/audio/listen/(?P<id>[0-9]+)'
_TEST = {
'url': 'http://www.newgrounds.com/audio/listen/549479',
'md5': 'fe6033d2... |
"""Attribute class unit tests."""
import pytest
from vivid.classes.attribute import Attribute
def test___init__():
"""Test Attribute constructor."""
def test_TypeError(label, value_set):
"""Test an individual Attribute construction."""
with pytest.raises(TypeError) as excinfo:
Att... |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function, unicode_literals
""" Example of browsing for a service (in this case, HTTP) """
import logging
import socket
import sys
from time import sleep
from zeroconf import ServiceBrowser, Zeroconf
class MyListener(object):
def rem... |
#===========================================================================
#
# UnitDblFormatter
#
#===========================================================================
"""UnitDblFormatter module containing class UnitDblFormatter."""
#==========================================================================... |
import os
import numpy as np
import rpcm
from s2p import sift
from s2p import rpc_utils
from s2p import estimation
from s2p.config import cfg
def error_vectors(m, F, ind='ref'):
"""
Computes the error vectors for a list of matches and a given fundamental
matrix.
Args:
m: Nx4 numpy array cont... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_eventlog
version_added: "2.4"
short_description: Manage Windows event logs
description:
- Allows the addition, clearing and removal of loc... |
from .proxy_resource import ProxyResource
class VirtualNetworkRule(ProxyResource):
"""A virtual network rule.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from collections import OrderedDict
import sys
from .date import *
from .ordereddefaultdict import *
from .autodict import * |
{
'name': 'Partners Geo-Localization',
'version': '1.0',
'category': 'Customer Relationship Management',
'description': """
Partners geolocalization
========================
""",
'author': 'OpenERP SA',
'depends': ['base'],
'demo': [
],
'data': [
'views/res_partner_view.x... |
import math as python_lib_Math
import math as Math
import builtins as python_lib_Builtins
import inspect as python_lib_Inspect
class Enum:
_hx_class_name = "Enum"
_hx_fields = ["tag", "index", "params"]
_hx_methods = ["__str__"]
def __init__(self,tag,index,params):
self.tag = None
self.index = None
self.pa... |
class Prefs(object):
def __init__(self):
self.prefs = {}
self.callbacks = {}
def set(self, key, value):
"""Set the value of `key` preference to `value`."""
if key in self.callbacks:
self.callbacks[key](value)
else:
self.prefs[key] = value
de... |
from a10sdk.common.A10BaseClass import A10BaseClass
class Force(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param all_partitions: {"type": "number", "description": "All partition configurations", "format": "flag"}
:param name: {"description": "Local Configuratio... |
# encoding: utf-8
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import logging
from sqlalchemy import Column, DDL, event, ForeignKey, Index, types
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalc... |
import os
import os.path
import shutil
from ipapython.ipa_log_manager import *
import ConfigParser
import random
import string
from ipapython import ipautil
from ipaplatform.tasks import tasks
from ipaplatform.paths import paths
SYSRESTORE_PATH = paths.TMP
SYSRESTORE_INDEXFILE = "sysrestore.index"
SYSRESTORE_STATEFIL... |
from bisect import bisect_right
import volatility.plugins.mac.pstasks as mac_tasks
import volatility.plugins.strings as strings
import volatility.plugins.mac.common as mac_common
import volatility.plugins.mac.lsmod as mac_lsmod
class mac_strings(strings.Strings, mac_common.AbstractMacCommand):
"""Match physical of... |
categories = ["move",
"move_with_duplication",
"move_non_temporal",
"move_mask"]
microcode = '''
# SSE instructions
'''
for category in categories:
exec "import %s as cat" % category
microcode += cat.microcode |
from .models import Tweet, TwitterConfiguration
import tweepy
class StreamListener(tweepy.StreamListener):
def __init__(self):
super().__init__()
self.counter = 0
self.limit = 1
def on_status(self, status):
if self.counter < self.limit:
self.counter += 1
... |
import uncertainties.unumpy as unp
import numpy as np
import pandas as pd
# Helpers useful to the user
# --------------------------
def data_out(cbdat, path=None, include_constants=False):
"""
Save output from cbsyst.
Parameters
----------
cbdat : dict / Bunch
The output from Csys, Bsys, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.