content stringlengths 4 20k |
|---|
"""
Period benchmarks with non-tslibs dependencies. See
benchmarks.tslibs.period for benchmarks that rely only on tslibs.
"""
from pandas import DataFrame, Period, PeriodIndex, Series, date_range, period_range
from pandas.tseries.frequencies import to_offset
class PeriodIndexConstructor:
params = [["D"], [True... |
import sys, os
from optparse import OptionParser
from thrift.Thrift import *
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from fb303 import *
from fb303.ttypes import *
def service_ctrl(
command,
port,
... |
# module 'string' -- A collection of string operations
# Warning: most of the code you see here isn't normally used nowadays. With
# Python 1.6, many of these functions are implemented as methods on the
# standard string object. They used to be implemented by a built-in module
# called strop, but strop is now ob... |
from __future__ import absolute_import, division, unicode_literals
from pip._vendor.six import text_type
try:
from functools import reduce
except ImportError:
pass
from ..constants import voidElements, booleanAttributes, spaceCharacters
from ..constants import rcdataElements, entities, xmlEntities
from .. imp... |
# -*- coding: utf-8 -*-
from .models import StundenAufzeichnung, Firma, Arbeitnehmer
from tastypie.resources import ModelResource
from tastypie import fields
from tastypie.authentication import ApiKeyAuthentication
from tastypie.authorization import DjangoAuthorization
from tastypie.throttle import BaseThrottle
from ta... |
import datetime
import sys
import unittest
import test_env
test_env.setup_test_env()
# From components/third_party/
import webtest
import webapp2
import stats
from components import stats_framework
from support import stats_framework_mock
from support import test_case
# pylint: disable=R0201
class Store(webapp2.... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.hdl
~~~~~~~~~~~~~~~~~~~
Lexers for hardware descriptor languages.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, bygroups, include, using, t... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
# Import Datadog
try:
from datadog import initialize, api
HAS_DATADOG = True
except:
HAS_DATADOG = False
def main():
module = AnsibleModule(
argument_spec=dict(
... |
"""Student Proposal (Model) query functions.
"""
__authors__ = [
'"Lennard de Rijk" <<EMAIL>>',
]
from soc.logic.models import base
from soc.modules.gsoc.logic.models import student as student_logic
import soc.models.linkable
import soc.modules.gsoc.models.student_proposal
class Logic(base.Logic):
"""Logi... |
import account_central_journal
import account_general_journal
import account_journal
import account_balance
import account_partner_balance
import account_general_ledger
import account_partner_ledger
import account_print_overdue
import account_aged_partner_balance
import report_vat
import account_invoice_report
import a... |
import sys
import traceback
import logging
import time
from threading import Thread
from hone_util import LogUtil
import hone_exeLib
import hone_rts as rts
jobGoFun = {} # key: jobID, value: a dictionary: key: flowIndex, value: go
jobEvent = {} # key: jobID, value: a dictionary: key: flowIndex, value: event
# key: j... |
from __future__ import with_statement
import sys
__all__ = ['nested', 'catch_warnings', 'examine_warnings']
try:
from contextlib import nested
except ImportError:
from contextlib import contextmanager
@contextmanager
def nested(*managers):
exits = []
vars = []
exc = (None, No... |
"""Symlink PyQt into a given virtualenv."""
import os
import argparse
import shutil
import os.path
import sys
import subprocess
import tempfile
import filecmp
class Error(Exception):
"""Exception raised when linking fails."""
pass
def run_py(executable, *code):
"""Run the given python code with the g... |
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = r'''
options:
provider:
description:
- A dict object containing connection details.
suboptions:
host:
description:
- Specifies the DNS host name or address for connecting to the remo... |
import mock
import novaclient
from oslo_config import fixture as fixture_config
from oslotest import base
from oslotest import mockpatch
from ceilometer import nova_client
class TestNovaClient(base.BaseTestCase):
def setUp(self):
super(TestNovaClient, self).setUp()
self._flavors_count = 0
... |
import sys
import _pytest._code
import py
import pytest
def test_ne():
code1 = _pytest._code.Code(compile('foo = "bar"', '', 'exec'))
assert code1 == code1
code2 = _pytest._code.Code(compile('foo = "baz"', '', 'exec'))
assert code2 != code1
def test_code_gives_back_name_for_not_existing_file():
... |
"""WebDoc module unit tests."""
__revision__ = "$Id$"
import unittest
from invenio.config import CFG_SITE_LANG, \
CFG_SITE_LANGS, \
CFG_SITE_URL
from invenio.messages import gettext_set_language
from invenio.testutils import make_test_suite, \
... |
"""
RPL
===
RFC 6550 - Routing Protocol for Low-Power and Lossy Networks (RPL)
draft-ietf-roll-efficient-npdao-17 - Efficient Route Invalidation
+----------------------------------------------------------------------+
| RPL Options : Pad1 PadN TIO RIO PIO Tgt TgtDesc DODAGConfig DAGMC ...|
+--------------------------... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import json
import os
from ansible.module_utils.basic import AnsibleModule
def main():
... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'CourseUserGroupPartitionGroup'
db.create_table('course_groups_courseusergrouppartitiongroup'... |
"""Proxy that uses requests."""
# pylint: disable=broad-except
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from hypebot.proxies import proxy_lib
import requests
class RequestsProxy(proxy_lib.Proxy):
"""Use p... |
from itertools import chain
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from Orange.widgets import gui
from Orange.widgets.widget import OWWidget
from Orange.widgets.settings import Setting
from Orange.widgets.utils.saveplot import save_plot
from Orange.widgets.io import FileFormat
DefDroppletBrush = QBrush... |
from testfixtures import StringComparison as S, compare
from testfixtures.compat import PY2
from unittest import TestCase
class Tests(TestCase):
def test_equal_yes(self):
self.failUnless('on 40220' == S('on \d+'))
def test_equal_no(self):
self.failIf('on xxx' == S('on \d+'))
def test_no... |
import datetime
import os
from google.appengine.ext import ndb
from base_controller import CacheableHandler
from models.insight import Insight
from template_engine import jinja2_engine
MAX_YEAR = 2017
VALID_YEARS = list(reversed(range(1992, MAX_YEAR + 1)))
class InsightsOverview(CacheableHandler):
"""
Sh... |
import signal
import subprocess
import sys
import tempfile
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.core.platform import profiler
class _SingleProcessSampleProfiler(object):
"""An internal class for using iprofiler for a given process."""
def __init__(self, pid, output... |
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.k8s.common import KubernetesAnsibleModule, AUTH_ARG_SPEC
import c... |
"""Functional tests for UnicodeScript op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import test_util
from tensorflow... |
import mraa as m
# this example will show the 'advanced' i2c functionality from python i2c
# read/write
x = m.I2c(0)
x.address(0x77)
# initialise device
if x.readReg(0xd0) != 0x55:
print("error")
# we want to read temperature so write 0x2e into control reg
x.writeReg(0xf4, 0x2e)
# read a 16bit reg, obviously it'... |
# -*- coding: utf-8 -*-
__author__ = 'wgz'
from StringIO import StringIO
import gzip
import urllib2
import datetime
url = 'https://tickdata.fxcorporate.com/' ##This is the base url
url_suffix = '.csv.gz' ##Extension of the file name
symbol = 'EURUSD' ##symbol we want to get tick data for
##Available Currencies
##A... |
#
# Complexer smoke simulation with wavlet turbulence plus
# - obstacle handling
# - and uv coordinates
#
from manta import *
import os, shutil, math, sys
# how much to upres the XL sim?
# set to zero to disable the second one completely
upres = 4
# overall wavelet noise strength
wltStrength = 0.3
# how many gri... |
"""
Testing some internals of the template processing. These are *not* examples to be copied in user code.
"""
from __future__ import unicode_literals
from django.template import (TokenParser, FilterExpression, Parser, Variable,
TemplateSyntaxError)
from django.utils.unittest import TestCase
class ParserTests(Te... |
import os
# Use 'final' as the 4th element to indicate
# a full release
VERSION = (0, 0, 1, 'alpha', 0)
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
# Append 3rd digit if > 0
version = ... |
"""Provides methods needed by installation script for OpenStack development
virtual environments.
Since this script is used to bootstrap a virtualenv from the system's Python
environment, it should be kept strictly compatible with Python 2.6.
Synced in from openstack-common
"""
from __future__ import print_function
... |
# -*- coding: utf-8 -*-
from openerp.osv import orm, fields
class test_converter(orm.Model):
_name = 'website.converter.test'
# disable translation export for those brilliant field labels and values
_translate = False
_columns = {
'char': fields.char(),
'integer': fields.integer(),
... |
from __future__ import print_function, division
from sympy import pi, I
from sympy.core.singleton import S
from sympy.core import Dummy, sympify
from sympy.core.function import Function, ArgumentIndexError
from sympy.functions import assoc_legendre
from sympy.functions.elementary.trigonometric import sin, cos, cot
fro... |
from __future__ import absolute_import, division, print_function
from .common import Benchmark, squares_
import numpy as np
ufuncs = ['abs', 'absolute', 'add', 'arccos', 'arccosh', 'arcsin',
'arcsinh', 'arctan', 'arctan2', 'arctanh', 'bitwise_and',
'bitwise_not', 'bitwise_or', 'bitwise_xor', 'cb... |
# -*- coding: utf-8 -*-
from django.db.models import Q
from django.conf import settings
from dictionaries import *
from models import *
from vamdctap import sqlparse
from itertools import chain
from HITRANfuncsenvs import *
import formula_parser
import sys
import time
# YYY XXX
class Bunch(object):
def __init__(... |
def main():
module = AnsibleModule(
argument_spec = dict(
src = dict(required=True),
dest = dict(required=True),
dest_port = dict(default=22),
delete = dict(default='no', type='bool'),
private_key = dict(default=None),
rsync_path = dict... |
# -*- encoding: utf-8 -*-
from abjad.tools.abctools import AbjadValueObject
class StringContactPoint(AbjadValueObject):
r'''String contact point indicator.
.. container:: example
**Example 1.** Sul ponticello:
::
>>> indicator = indicatortools.StringContactPoint('sul ponticell... |
"""
@author: Brendan Dolan-Gavitt
@license: GNU General Public License 2.0
@contact: <EMAIL>
"""
import volatility.debug as debug
import volatility.obj as obj
import struct
ROOT_INDEX = 0x20
LH_SIG = "lh"
LF_SIG = "lf"
RI_SIG = "ri"
NK_SIG = "nk"
VK_SIG = "vk"
BIG_DATA_MAGIC = 0x3fd8
KEY_FLAGS = {
... |
"""
This module provides a KEY_FUNCTION suitable for use with a memcache backend
so that we can cache any keys, not just ones that memcache would ordinarily accept
"""
from django.utils.encoding import smart_str
import hashlib
import urllib
def fasthash(string):
"""
Hashes `string` into a string representatio... |
import numpy as np
from sklearn.utils.testing import (assert_allclose, assert_raises,
assert_equal)
from sklearn.neighbors import KernelDensity, KDTree, NearestNeighbors
from sklearn.neighbors.ball_tree import kernel_norm
from sklearn.pipeline import make_pipeline
from sklearn.dataset... |
"""Record list box."""
import itertools
from flask import url_for
from six import add_metaclass
from invenio_search.api import Query
from .base import BoxBase
@add_metaclass(BoxBase)
class RecordListBox(object):
"""Build a box with the content of a search query."""
__display_name__ = 'Search'
__temp... |
"""
Released under the MIT license
Copyright (c) 2014, Jason Millward
@category misc
@author Jason Millward <<EMAIL>>
@license http://opensource.org/licenses/MIT
Usage:
stats.py <EXIF Attr>... [--dir=<dir>]
"""
import exifread
import docopt
import unicodedata
from os import listdir
from os.path impor... |
"""Argument-less script to select what to run on the buildbots."""
import os
import shutil
import subprocess
import sys
if sys.platform in ['win32', 'cygwin']:
EXE_SUFFIX = '.exe'
else:
EXE_SUFFIX = ''
BUILDBOT_DIR = os.path.dirname(os.path.abspath(__file__))
TRUNK_DIR = os.path.dirname(BUILDBOT_DIR)
ROOT_DIR... |
# -*- coding: utf-8 -*-
from flask import request
from modularodm.storedobject import StoredObject as GenericStoredObject
from modularodm.ext.concurrency import with_proxies, proxied_members
from bson import ObjectId
from .handlers import client, database, set_up_storage
from api.base.api_globals import api_globals... |
import logging
import subprocess
from telemetry.core import forwarders
from telemetry.core.forwarders import do_nothing_forwarder
from telemetry.core import util
class CrOsForwarderFactory(forwarders.ForwarderFactory):
def __init__(self, cri):
super(CrOsForwarderFactory, self).__init__()
self._cri = cri
... |
"""Module scan and load system.
The main interface to this module is the Scan function, which triggers a
recursive scan of all packages and modules below cr, with modules being
imported as they are found.
This allows all the plugins in the system to self register.
The aim is to make writing plugins as simple as possib... |
"""The hosts admin extension."""
import webob.exc
from nova.api.openstack.compute.schemas.v3 import hosts
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api import validation
from nova import compute
from nova import exception
from nova.i18n import _
from nova.openstack.common... |
import os
from keystoneauth1 import loading
from keystoneauth1 import plugin
class AodhNoAuthPlugin(plugin.BaseAuthPlugin):
"""No authentication plugin for Aodh
This is a keystoneauth plugin that instead of
doing authentication, it just fill the 'x-user-id'
and 'x-project-id' headers with the user p... |
import os
import fixtures
import mock
from oslo_config import cfg
from oslotest import base as oslotest_base
from kolla.common import config as common_config
TESTS_ROOT = os.path.dirname(os.path.abspath(__file__))
class TestCase(oslotest_base.BaseTestCase):
'''All unit test should inherit from this class'''
... |
# pylint: disable=missing-docstring,unused-argument
from django.http import (HttpResponse, HttpResponseServerError,
HttpResponseNotFound)
from edxmako.shortcuts import render_to_string, render_to_response
import functools
from openedx.core.lib.js_utils import escape_json_dumps
__all__ = ['not... |
from gnuradio import gr, gru
from gnuradio import blocks
from gnuradio.eng_option import eng_option
from optparse import OptionParser
import sys
class my_graph(gr.top_block):
def __init__(self):
gr.top_block.__init__(self)
parser = OptionParser(option_class=eng_option)
(options, args) = p... |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## This is a sample controller
## - index is the default action of any application
## - user is required for authentication and authorization... |
"""Provides utility functions used with command line samples."""
# This module is used for version 2 of the Google Data APIs.
import sys
import getpass
import urllib.request, urllib.parse, urllib.error
import gdata.gauth
__author__ = '<EMAIL> (Jeff Scudder)'
CLIENT_LOGIN = 1
AUTHSUB = 2
OAUTH = 3
HMAC = 1
RSA = 2... |
"""TELNET implementation, with line-oriented command handling.
"""
import warnings
warnings.warn(
"As of Twisted 2.1, twisted.protocols.telnet is deprecated. "
"See twisted.conch.telnet for the current, supported API.",
DeprecationWarning,
stacklevel=2)
# System Imports
try:
from cStringIO impor... |
"""
Implement a client for Echo service using Identity service
"""
import httplib
import json
import sys
def keystone_conn():
""" Get a connection. If it is SSL, needs the '-s' option, optionally
followed by the location of the cert_file with private key. """
if '-s' in sys.argv:
cert_file =... |
from PyQt4 import QtGui,QtCore
from PIL import ImageGrab, ImageFilter, Image
import cv2
import numpy as np
from PyQt4.QtGui import QApplication, QMainWindow, QPushButton,QLabel, QVBoxLayout, QWidget
from pytank.Core import Settings
import os
import copy
from PyQt4.QtGui import QPalette
def replace_all(text, dic... |
from . import common
from . import test_logistic_order_line_to_source_line
from . import test_agreement_souce_line_to_po
checks = [test_logistic_order_line_to_source_line,
test_agreement_souce_line_to_po] |
""" Generic Unification algorithm for expression trees with lists of children
This implementation is a direct translation of
Artificial Intelligence: A Modern Approach by Stuart Russel and Peter Norvig
Second edition, section 9.2, page 276
It is modified in the following ways:
1. We allow associative and commutati... |
# -*- coding: utf-8 -*-
"""
Test parsing of simple date and times using the Australian locale
"""
from __future__ import unicode_literals
import sys
import time
import datetime
import parsedatetime as pdt
from . import utils
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
cl... |
#!/usr/bin/python
import sys
s = ""
index = 0 # The index of the current char into |s|
vars = { }
exprs = []
lastExpr = 0
stack = []
verboseMode = False
# Read the file with the name specified by the second arg
# (the first arg is the name of the executable)
if len(sys.argv) >= 2:
s = open(sys.argv[1]).read()
n... |
#
# A pair of directives for inserting content that will only appear in
# either html or latex.
#
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from docutils.nodes import Body, Element
from docutils.parsers.rst import directives
class only_ba... |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.MultiCrypter import MultiCrypter
class LinkdecrypterCom(MultiCrypter):
__name__ = "LinkdecrypterCom"
__type__ = "crypter"
__version__ = "0.32"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
__config__ = [("use_sub... |
import hy
from hy.importer import (import_file_to_module, import_buffer_to_ast,
MetaLoader, get_bytecode_path)
from hy.errors import HyTypeError
import os
import ast
import tempfile
from fractions import Fraction
import pytest
def test_basics():
"Make sure the basics of the importer work"... |
"""
Views for creating, editing and viewing site-specific user profiles.
"""
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.http import Http404
from dja... |
import feedparser
import re
import pywiki
import pwutils
supported_anime = {
#u"title in args": [u"title in rss feed", u"on-wiki title"],
u"Détective Conan": [u"Case Closed", u"Détective Conan"],
u"Naruto Shippuden": [u"Naruto Shippuden", u"Naruto Shippuden"],
u"One Piece": [u"One Piece", u"One Piece"]... |
from openerp.tools.translate import _
from openerp.osv import osv
class Invoice(osv.osv):
_inherit = 'account.invoice'
# Forbid to cancel an invoice if the related move lines have already been
# used in a payment order. The risk is that importing the payment line
# in the bank statement will result in... |
from twisted.internet import reactor
from twisted.internet.protocol import ReconnectingClientFactory
from twisted.protocols.basic import Int32StringReceiver
from carbon.conf import settings
from carbon import log
try:
import cPickle as pickle
except ImportError:
import pickle
MAX_DATAPOINTS_PER_MESSAGE = setting... |
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException, UnexpectedTagNameException
class Select:
def __init__(self, webelement):
"""
Constructor. A check is made that the given element is, indeed, a SELECT tag. If it is not,
then an Unexpe... |
"""
Methods to convert an object to csv
"""
import datetime
from pandas import Series, DataFrame
import os
from .utils import mkdir_p
from datetime import timedelta, datetime
from collections import defaultdict
from ..eles.models import (Unit, UnitStatus, KeyStatuses, Station, DailyServiceReport, SystemServiceReport)
... |
import numpy as np
from riemanntheta import RiemannTheta_Function
import pylab as p
import matplotlib.pyplot as plt
from pycuda import gpuarray
import time
def demo1():
theta = RiemannTheta_Function()
Omega = np.array([[1.j, .5], [.5, 1.j]])
print
print "Calculating 3,600 points of the Riemann Theta Fu... |
"""
Objects for Microsoft Word.
.. moduleauthor:: Michael Murr (<EMAIL>)
"""
__docformat__ = "restructuredtext en"
__all__ = [
"Fib", "SttbShort", "SttbLong", "SttbShortUnicode", "SttbLongUnicode"
]
from copy import copy
from lf.io.consts import SEEK_SET
from lf.datatype import Extractor, structuple
from lf.dat... |
from keystone.tests import unit as tests
from keystone.tests.unit import test_sql_migrate_extensions
from keystone.tests.unit import test_sql_upgrade
class PostgresqlMigrateTests(test_sql_upgrade.SqlUpgradeTests):
def setUp(self):
self.skip_if_env_not_set('ENABLE_LIVE_POSTGRES_TEST')
super(Postgre... |
#
# Dr. D Studios
# ---------------------------------------------------
# Load centralised configuration
# ---------------------------------------------------
from miki.sphinx_config import *
# Add any overrides required below
# ---------------------------------------------------
# Copyright 2008-2012 Dr D Studios ... |
# -*- coding: utf-8 -*-
from numpy import *
from numpy.linalg import *
from numpy.random import *
from matplotlib.pyplot import *
print('Valeur de pi :', pi)
print(finfo(float).eps)
#Create a Vector
X1 = array([1, 2, 3, 4, 5])
print('Simple vecteur :',X1)
X2 = arange(0,1,.25)
print('Subdvision uniforme :', X2)
X3 =... |
import os
try:
import json
except ImportError:
import simplejson as json
class Npm(object):
def __init__(self, module, **kwargs):
self.module = module
self.glbl = kwargs['glbl']
self.name = kwargs['name']
self.version = kwargs['version']
self.path = kwargs['path']
... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'Y년 n월 j일'
TIME_FORMAT = 'A g:i:s'
DATETIME_FORMAT = 'Y년 n월 j일 g:i:s A'
YEAR_MONTH_FORMAT = 'Y년 F월'
MONTH_DAY_FORMAT = 'F월 j일'
SHORT_DA... |
import warnings
import os.path as op
import numpy as np
from nose.tools import assert_true, assert_raises
from numpy.testing import assert_array_equal
from mne import io, read_events, Epochs, pick_types
from mne.decoding.classifier import Scaler, FilterEstimator
from mne.decoding.classifier import PSDEstimator, Conca... |
{
'name': 'Canada - Accounting',
'version': '1.2',
'author': 'Savoir-faire Linux',
'website': 'http://www.savoirfairelinux.com',
'category': 'Localization/Account Charts',
'description': """
This is the module to manage the English and French - Canadian accounting chart in OpenERP.
=============... |
from __future__ import print_function, division
import random
from itertools import permutations
import numpy as np
from scipy.stats.distributions import vonmises
from msmbuilder.example_datasets import AlanineDipeptide
from msmbuilder.featurizer import DihedralFeaturizer
from msmbuilder.hmm import VonMisesHMM
def... |
from test import support
import random
import sys
import unittest
from functools import cmp_to_key
verbose = support.verbose
nerrors = 0
def check(tag, expected, raw, compare=None):
global nerrors
if verbose:
print(" checking", tag)
orig = raw[:] # save input in case of error
if compar... |
from __future__ import print_function
import os
import glob
import sys
import yaml
import codecs
import json
import ast
import re
import optparse
import time
import datetime
import subprocess
import cgi
import warnings
from jinja2 import Environment, FileSystemLoader
from six import iteritems
from ansible.utils import... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
class sale_order(osv.osv):
_name = 'sale.order'
_inherit = 'sale.order'
_columns= {
'budget_move_id': fields.many2one('budget.move', 'Budget move' )
}
def action_inv... |
"""This is the Bokeh charts interface. It gives you a high level API to build
complex plot is a simple way.
This is the Step class which lets you build your Step charts just
passing the arguments to the Chart class and calling the proper functions.
"""
#-----------------------------------------------------------------... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import copy
import os
import os.path
import re
import tempfile
from ansible import constants as C
from ansible.errors import AnsibleFileNotFound, AnsibleParserError
from ansible.module_utils.basic import is_executable
from ansible... |
import moviepy.editor as movie_editor
import numpy
from ..audio_tools import AudioBlock, AudioFileBlock, AudioFileBlockCache
class AudioClipGenerator(movie_editor.AudioClip):
def __init__(self, time_offset, slice_offset, scale, duration, time_slice):
movie_editor.AudioClip.__init__(self, make_frame=None, d... |
import sys
from contextlib import contextmanager
from qgis.core import QgsApplication
@contextmanager
def qgisapp(args=None, guienabled=True, configpath=None, sysexit=True):
"""
Create a new QGIS Qt application.
You should use this before creating any Qt widgets or QGIS objects for
your custom QGIS b... |
import unittest
import logging
import six
import struct
import netaddr
from struct import *
from nose.tools import *
from ryu.ofproto import ether, inet
from ryu.lib.packet.ethernet import ethernet
from ryu.lib.packet.packet import Packet
from ryu.lib.packet.arp import arp
from ryu.lib import addrconv
LOG = logging.g... |
from . import document_url |
from Screens.Screen import Screen
from Components.MovieList import AUDIO_EXTENSIONS
from Components.ServiceEventTracker import ServiceEventTracker
from Components.Pixmap import Pixmap
from enigma import ePoint, eTimer, iPlayableService
import os
class Screensaver(Screen):
def __init__(self, session):
self.skin = "... |
import json
import pytest
from .. import base
from .api_test import DockerClientTest, url_prefix, fake_request
class VolumeTest(DockerClientTest):
@base.requires_api_version('1.21')
def test_list_volumes(self):
volumes = self.client.volumes()
self.assertIn('Volumes', volumes)
self.as... |
import math
import point
class Agent(object):
def __init__(self, model_x, model_y):
self.model_x = model_x
self.model_y = model_y
self.delta_t = 0.01
self.r = 1.5
self.k = 1.0
def get_normal_dist(self, X, std):
coeff = 1.0 / (std * math.sqrt(2.0 * math.pi))
... |
# ==============================================================
import os
import tempfile
import re
class SysctlModule(object):
def __init__(self, module):
self.module = module
self.args = self.module.params
self.sysctl_cmd = self.module.get_bin_path('sysctl', required=True)
se... |
"""
This scripts specifies all PTX special objects.
"""
import functools
class Stub(object):
'''
A stub object to represent special objects that are meaningless
outside the context of a CUDA kernel
'''
_description_ = '<ptx special value>'
__slots__ = () # don't allocate __dict__
def __ne... |
try:
import floppyforms as forms
except ImportError:
from django import forms
class BaseMongoAdmin(object):
search_fields = []
# Show the fields to be displayed as columns
# TODO: Confirm that this is what the Django admin uses
list_fields = []
#This shows up on the DocumentListView of ... |
from threading import Thread, Timer
from socket import socket, AF_INET, SOCK_DGRAM
from urllib2 import urlopen
import time
import re
#------------------_EVT_ACTIONS----------------------#
ERR_TIMEOUT = 'e0'
ERR_BAD_RCON_PASSWORD = 'e1'
EVT_CHAT = 'ev0'
EVT_ELIM = 'ev1'
EVT_RESPAWN = 'ev2'
EVT_MAPCHANGE = 'ev... |
def main(request, response):
import simplejson as json
f = file('config.json')
source = f.read()
s = json.JSONDecoder().decode(source)
url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1])
url2 = "http://" + s['host'] + ":" + str(s['ports']['http'][0])
_CSP = "style-src 'none'"
... |
"""
jsonapi.sqlalchemy.database
===========================
The database adapter for *sqlalchemy*.
"""
# std
from itertools import groupby
import logging
# local
import jsonapi
from . import schema
__all__ = [
"Database",
"Session"
]
LOG = logging.getLogger(__file__)
class Database(jsonapi.base.databas... |
#!/usr/bin/env python
import unittest, sciunittest
from PyQuante.NumWrap import arange
from PyQuante.dft import dft
from PyQuante.Molecule import Molecule
energy = -1.132710
name = 'H2/DFT'
def dissoc(**opts):
rmin = opts.get('rmin',0.65)
rmax = opts.get('rmax',1.01)
step = opts.get('step',0.05)
dopl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.