code stringlengths 1 199k |
|---|
import sys
import threading
import time
class StderrHeartbeat(threading.Thread):
def __init__(self, *args, **kwargs):
super(StderrHeartbeat, self).__init__(*args, **kwargs)
self.daemon = True
def run(self):
while True:
sys.stderr.write("\0")
sys.stderr.flush()
... |
import pythonequations, pythonequations.EquationBaseClasses, pythonequations.ExtraCodeForEquationBaseClasses
import numpy
numpy.seterr(all = 'raise') # numpy raises warnings, convert to exceptions to trap them
class LinearExponential3D(pythonequations.EquationBaseClasses.Equation3D):
RequiresAutoGeneratedGrowthAndD... |
from panoptes.analysis.panels.mapping.maps.base import BaseMap
class SessionMap(BaseMap):
"""A location map that shows the number of sessions per workstation."""
slug = "sessions"
template = "panoptes/analysis/panels/maps/sessions.html" |
from trading_ig.rest import IGService, IGException
import responses
import json
import pytest
"""
unit tests for session methods
"""
class TestSession:
# login v1
@responses.activate
def test_login_v1_happy(self):
with open('tests/data/accounts.json', 'r') as file:
response_body = json.l... |
import Parser
import sys
sys.path.append("../")
TEMPLATE_DIR = 'templates/'
def render(fname, response, context):
"""
> TemplateAPI.render(fname, context)
Renders the file "templates/<fname>" in accordance to the TemplateAPI parser, given context dictionary <context>
Context dictionary should be a python dictionary... |
import py
import sys, os
from pypy.tool.udir import udir
dirpath = py.path.local(__file__).dirpath().dirpath()
def run(filename, outputname):
filepath = dirpath.join(filename)
tmpdir = udir.ensure('testcache-' + os.path.splitext(filename)[0],
dir=True)
tmpdir.join('dumpcache.py').wr... |
"""Base classes for probability distributions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import six
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_u... |
from ceph_deploy import exc, mon
from ceph_deploy.conf.ceph import CephConf
from mock import Mock
import pytest
def make_fake_conf():
return CephConf()
def make_fake_conn(receive_returns=None):
receive_returns = receive_returns or ([b'{}'], [], 0)
conn = Mock()
conn.return_value = conn
conn.execute ... |
__author__ = "OpenSlides Team <support@openslides.org>"
__description__ = "Presentation and assembly system"
__version__ = "3.4-master"
__license__ = "MIT"
__url__ = "https://openslides.com"
args = None |
from pyramid.view import view_config
from pyramid.config import Configurator
from zope.interface import implementer
from pyramid.security import Allow, Everyone
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid_sacrud import PYRAMID_SACR... |
import re
import os
import hashlib
import shutil
import string
import oelite.fetch
import oelite.util
import local
import url
import git
import hg
import svn
FETCHERS = {
"file" : local.LocalFetcher,
"http" : url.UrlFetcher,
"https" : url.UrlFetcher,
"ftp" : url.UrlFetcher,
"git" : git.GitFetcher,
... |
__version__ = "1.26.1" |
test = {
'name': 'Question 2',
'points': 2,
'suites': [
{
'cases': [
{
'code': r"""
>>> read_line("(a . b)")
Pair('a', 'b')
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> read_line("(a b ... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import sys
from __main__ import cli
from ansible.module_utils.six import iteritems
from ansible.errors import AnsibleError
from ansible.parsing.yaml.objects import AnsibleMapping, AnsibleSequence, AnsibleUnicode
from ansib... |
import testtools
from openstack.database.v1 import flavor
IDENTIFIER = 'IDENTIFIER'
EXAMPLE = {
'id': IDENTIFIER,
'links': '1',
'name': '2',
'ram': '3',
}
class TestFlavor(testtools.TestCase):
def test_basic(self):
sot = flavor.Flavor()
self.assertEqual('flavor', sot.resource_key)
... |
import os, sys
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
from pprint import pformat
import json
import pytest
import lasio
import lasio.las_items
test_dir = os.path.dirname(__file__)
egfn = lambda fn: os.path.join(os.path.dirname(__file__), "examples", fn)
stegfn = lambda vers, fn: os.path.join(os.... |
def function_call(x, y, *args, **kwargs):
print x,y,args,kwargs
function_call(42, "stringy\n\"", 5, 6, 7, foo=43+4, bar=22) |
"""Custom exceptions used or raised by tvdb_api
"""
__author__ = "dbr/Ben"
__version__ = "1.10"
__all__ = ["tvdb_error", "tvdb_userabort", "tvdb_shownotfound",
"tvdb_seasonnotfound", "tvdb_episodenotfound", "tvdb_attributenotfound"]
class tvdb_exception(Exception):
"""Any exception generated by tvdb_api
"""
... |
from functools import wraps, update_wrapper
from flask import request, abort, current_app
def validate_account_and_region(f):
@wraps(f)
def check_account_and_region_function(*args, **kwargs):
try:
account = request.view_args.get('account')
if current_app.config['CONFIG']['account... |
"""Core Service Interface Definitions
osid version 3.0.0
Copyright (c) 2002-2004, 2006-2008 Massachusetts Institute of
Technology.
Copyright (c) 2009-2012 Ingenescus. All Rights Reserved.
This Work is being provided by the copyright holder(s) subject to the
following license. By obtaining, using and/or copying this Wor... |
import test.test_support
from test.test_support import verbose
import random
import re
import sys
import threading
import thread
import time
import unittest
import weakref
import lock_tests
class Counter(object):
def __init__(self):
self.value = 0
def inc(self):
self.value += 1
def dec(self)... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from future.builtins import range
import sys
import textwrap
import sqlalchemy as sa
from twisted.python import reflect
from twisted.python import usage
from buildbot.scripts import base
def validateMasterOption... |
from django.db import models
from juser.models import User
import time |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import socket
class LMClient(object):
def __init__(self,host= "localhost",port=12346,n = 0):
self.BUFSIZE = 1024
self.socket = socket.socket(socket.AF_... |
stoplists = {
"da": frozenset(u"""
og i jeg det at en den til er som på de med han af for ikke der var mig
sig men et har om vi min havde ham hun nu over da fra du ud sin dem os
op man hans hvor eller hvad skal selv her alle vil blev kunne ind når
være dog noget ville jo deres efter ned skulle denne... |
"""
Tests a memory leak in the applet
"""
import sys
from rhn import rpclib
def main():
server_name = "xmlrpc.rhn.redhat.com"
ca_cert = "/usr/share/rhn/RHNS-CA-CERT"
try:
server_name = sys.argv[1]
ca_cert = sys.argv[2]
except:
pass
server_url = "https://" + server_name + "/AP... |
"""
Export to non-lilypond file types.
"""
import os
from PyQt5.QtCore import Qt, QUrl, QSize
from PyQt5.QtGui import QKeySequence
from PyQt5.QtWidgets import QAction, QFileDialog, QMessageBox
import app
import icons
import actioncollection
import actioncollectionmanager
import documentinfo
import plugin
import tokenit... |
"""
EasyBuild support for building and installing NCL, implemented as an easyblock
@author: Stijn De Weirdt (Ghent University)
@author: Dries Verdegem (Ghent University)
@author: Kenneth Hoste (Ghent University)
@author: Pieter De Baets (Ghent University)
@author: Jens Timmerman (Ghent University)
"""
import fileinput
... |
import sys
msg = "\nThe gtk python module is missing or not installed properly.\n"
msg += "Is the PYTHONPATH environment variable set correctly?\n"
msg += "Please verify your installation by running on the command line:\n"
msg += "python -c 'import gtk'\n"
msg += "\n"
msg += "This module is optional and required in ord... |
from quodlibet import util
from quodlibet import config
from quodlibet import _
from quodlibet.pattern import XMLFromPattern
from quodlibet.qltk.models import ObjectTreeStore, ObjectModelFilter
from quodlibet.qltk.models import ObjectModelSort
EMPTY = _("Songs not in an album")
ALBUM_PATTERN = r"""
\<b\><album|<album>|... |
"""
VirtualBox Validation Kit - Storage snapshotting and merging testcase.
"""
__copyright__ = \
"""
Copyright (C) 2013-2015 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
you can redistribute it and/or modify it und... |
"""
Generic EasyBuild support for building and installing bar, implemented as an easyblock
@author: Kenneth Hoste (Ghent University)
"""
from easybuild.framework.easyblock import EasyBlock
from easybuild.framework.easyconfig import CUSTOM, MANDATORY
class bar(EasyBlock):
"""Generic support for building/installing b... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "web_TouSIX.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
"""Python 2/3 compatibility
"""
from __future__ import absolute_import
import six
if six.PY2:
# use https://pypi.python.org/pypi/configparser/ on Python 2
from backports import configparser
from urllib import quote as url_escape
from urllib import quote_plus, unquote
from urlparse import parse_qs, u... |
from __future__ import (absolute_import, division, print_function)
import math
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.ticker
import nose.tools
import cartopy.crs as ccrs
from cartopy.tests.mpl import ImageTesting
def _format_lat(val, i):
if val > 0:
return '%.0fN' % val
... |
import sys
from PyQt5.QtCore import QCoreApplication
from PyQt5.QtDBus import QDBusConnection, QDBusInterface, QDBusReply
if __name__ == '__main__':
app = QCoreApplication(sys.argv)
if not QDBusConnection.sessionBus().isConnected():
sys.stderr.write("Cannot connect to the D-Bus session bus.\n"
... |
import re
from time import mktime, strptime
from module.plugins.Account import Account
class MegaRapidCz(Account):
__name__ = "MegaRapidCz"
__type__ = "account"
__version__ = "0.35"
__description__ = """MegaRapid.cz account plugin"""
__license__ = "GPLv3"
__authors__ = [("MikyWoW",... |
from org.esa.beam.framework.datamodel import Product
from org.esa.beam.framework.datamodel import Band
from org.esa.beam.framework.datamodel import VirtualBand
from org.esa.beam.framework.datamodel import TiePointGrid
from org.esa.beam.framework.datamodel import GeoCoding
from org.esa.beam.framework.datamodel import Fl... |
order_kind = []
test_name = []
sample_type = []
handled_descriptions = ['']
def get_db_order_type( type ):
if type == 'Bilan initial':
return 'HIV_firstVisit'
if type == 'Bilan de suivi':
return 'HIV_followupVisit'
if type == 'Bilan initial, Bilan de suivi':
return 'HIV_firstVisit,HI... |
def code_version():
return 'gss'
def check(name, type, country, geometry):
return False |
import os
from utils import make_dir
INSTANCE_FOLDER_PATH = '/tmp'
class BaseConfig(object):
PROJECT = "gastos_abertos"
# Get app root path, also can use flask.root_path.
# ../../config.py
PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
DEBUG = False
TESTING = False
... |
from __future__ import absolute_import, unicode_literals
from django.conf.urls import patterns, url
from .views import AssetDownloadView, AssetStreamView
urlpatterns = patterns('', url(r'download/(?P<type>\w+)/(?P<pk>\d+)/$', AssetDownloadView.as_view(),
name='assets.download'))
urlpatter... |
import logging
import radon.complexity
import radon.visitors
from coalib.bears.LocalBear import LocalBear
from dependency_management.requirements.PipRequirement import PipRequirement
from coalib.results.Result import Result
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
from coalib.results.SourceRange impor... |
import time, sys, os, shutil, subprocess, distutils.dir_util
sys.path.append("../../configuration")
if os.path.isfile("log.log"):
os.remove("log.log")
log = open("log.log", "w")
from scripts import *
from buildsite import *
from process import *
from tools import *
from directories import *
printLog(log, "")
printLog(... |
"""
Grades Application Configuration
Signal handlers are connected here.
"""
from django.apps import AppConfig
from django.conf import settings
from edx_proctoring.runtime import set_runtime_service
from openedx.core.djangoapps.plugins.constants import PluginSettings, PluginURLs, ProjectType, SettingsType
class GradesC... |
{'name': 'Partner Changesets',
'version': '8.0.1.0.0',
'author': 'Camptocamp, Odoo Community Association (OCA)',
'license': 'AGPL-3',
'category': 'Sales Management',
'depends': ['base',
],
'website': 'http://www.camptocamp.com',
'data': ['security/security.xml',
'security/ir.model.access.c... |
''' unit test for BUG #1084 '''
import unittest
from PySide2 import QtNetwork
import py3kcompat as py3k
class QTcpSocketTestCase(unittest.TestCase):
def setUp(self):
self.sock = QtNetwork.QTcpSocket()
self.sock.connectToHost('127.0.0.1', 25)
def testIt(self):
self.sock.write(py3k.unicode... |
"""Copyright © 2005-2009 Collabora Limited
Copyright © 2005-2009 Nokia Corporation
Copyright © 2006 INdT
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, o... |
from .baseapi import BaseAPI, GET, POST, DELETE
class FloatingIP(BaseAPI):
def __init__(self, *args, **kwargs):
self.ip = None
self.droplet = []
self.region = []
super(FloatingIP, self).__init__(*args, **kwargs)
@classmethod
def get_object(cls, api_token, ip):
"""
... |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import (
compat_HTTPError,
compat_str,
)
from ..utils import (
extract_attributes,
try_get,
urlencode_postdata,
ExtractorError,
)
class TVPlayerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tvplaye... |
from __future__ import unicode_literals
import re
import socket
from .common import InfoExtractor
from ..compat import (
compat_etree_fromstring,
compat_http_client,
compat_urllib_error,
compat_urllib_parse_unquote,
compat_urllib_parse_unquote_plus,
)
from ..utils import (
clean_html,
error_... |
import copy
import os
import sys
from alembic import config as alembic_config
import fixtures
import mock
import pkg_resources
from neutron.db import migration
from neutron.db.migration import cli
from neutron.tests import base
from neutron.tests.unit import testlib_api
class FakeConfig(object):
service = ''
class ... |
'''
baseline:
after: true
before: false
counts: 120
detector: H2
mass: 39.862
settling_time: 15.0
default_fits: nominal
equilibration:
eqtime: 1.0
inlet: H
inlet_delay: 3
outlet: V
use_extraction_eqtime: true
multicollect:
counts: 400
detector: H2
isotope: Ar40
peakcenter:
after: false
b... |
"""module for map bolt: MapBolt"""
from heronpy.api.bolt.bolt import Bolt
from heronpy.api.state.stateful_component import StatefulComponent
from heronpy.api.component.component_spec import GlobalStreamId
from heronpy.api.stream import Grouping
from heronpy.streamlet.streamlet import Streamlet
from heronpy.streamlet.im... |
from keystone.common import wsgi
from keystone.contrib.example import controllers
class ExampleRouter(wsgi.ExtensionRouter):
PATH_PREFIX = '/OS-EXAMPLE'
def add_routes(self, mapper):
example_controller = controllers.ExampleV3Controller()
mapper.connect(self.PATH_PREFIX + '/example',
... |
import click
import girder
import sys
from girder.utility.server import configureServer
def _launchShell(context):
"""
Launches a Python shell with the given context.
:param context: A dictionary containing key value pairs
of variable name -> value to be set in the newly
launched shell.
"""
... |
"""This example demonstrates how to handle partial failures.
To get ad groups, run get_ad_groups.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... |
from django.conf.urls import url
from awx.api.views import (
InventoryList,
InventoryDetail,
InventoryHostsList,
InventoryGroupsList,
InventoryRootGroupsList,
InventoryVariableData,
InventoryScriptView,
InventoryTreeView,
InventoryInventorySourcesList,
InventoryInventorySourcesUp... |
import datetime
import iso8601
import six.moves.urllib.parse as urlparse
from webob import exc
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova import exception
from nova.objects import flavor as flavor_obj
from nova.objects import instance a... |
"""DLPack API of MXNet."""
import ctypes
from .base import _LIB, c_str, check_call, NDArrayHandle
DLPackHandle = ctypes.c_void_p
PyCapsuleDestructor = ctypes.CFUNCTYPE(None, ctypes.c_void_p)
_c_str_dltensor = c_str('dltensor')
_c_str_used_dltensor = c_str('used_dltensor')
def _dlpack_deleter(pycapsule):
pycapsule =... |
import socket
import httplib2
import json
from oslo_config import cfg
from oslo_log import helpers as log_helpers
from oslo_log import log as logging
from oslo_concurrency import lockutils
from oslo_serialization import jsonutils
from oslo_service import loopingcall
from networking_bagpipe._i18n import _
from networkin... |
"""Tests for advanced activation layers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python import keras
from tensorflow.python.keras import testing_utils
from tensorflow.python.platform import test
class AdvancedActivationsTest(test.Te... |
import os
import logging
from ConfigParser import ConfigParser, NoOptionError, NoSectionError
class LuigiConfigParser(ConfigParser):
NO_DEFAULT = object()
_instance = None
_config_paths = ['/etc/luigi/client.cfg', 'client.cfg']
if 'LUIGI_CONFIG_PATH' in os.environ:
_config_paths.append(os.enviro... |
import os
import yaml
import ooinstall.cli_installer as cli
from test.oo_config_tests import OOInstallFixture
from click.testing import CliRunner
SAMPLE_CONFIG = """
variant: %s
ansible_ssh_user: root
hosts:
- connect_to: 10.0.0.1
ip: 10.0.0.1
hostname: master-private.example.com
public_ip: 24.222.0.1
... |
"""Http related parsers and protocol."""
import collections
import functools
import http.server
import re
import string
import sys
import zlib
from abc import abstractmethod, ABC
from wsgiref.handlers import format_date_time
from multidict import CIMultiDict, upstr
import aiohttp
from . import errors, hdrs
from .log im... |
"""
Builder for Windows x86 / 32bit
"""
from SCons.Script import AlwaysBuild, Default, DefaultEnvironment
from platformio.util import get_systype
env = DefaultEnvironment()
env.Replace(
_BINPREFIX="",
AR="${_BINPREFIX}ar",
AS="${_BINPREFIX}as",
CC="${_BINPREFIX}gcc",
CXX="${_BINPREFIX}g++",
... |
"""Setup module for the GRPC Python package's optional health checking."""
import os
import setuptools
os.chdir(os.path.dirname(os.path.abspath(__file__)))
import health_commands
import grpc_version
PACKAGE_DIRECTORIES = {
'': '.',
}
SETUP_REQUIRES = (
'grpcio-tools>={version}'.format(version=grpc_version.VERSI... |
import numpy
from tkp.accessors.dataaccessor import DataAccessor
class LofarHdf5Image(DataAccessor):
# Not currently instantiable; LOFAR HDF5 images are not in use
def __init__(self, source, plane=False, beam=False):
super(LofarHdf5Image, self).__init__() # Set defaults
self.plane = plane
... |
import pytest
from datashape.user import *
from datashape import dshape
from datetime import date, time, datetime
import numpy as np
min_np = pytest.mark.skipif(
np.__version__ > '1.14',
reason="issubdtype no longer downcasts"
)
@min_np
def test_validate():
assert validate(int, 1)
assert validate('int',... |
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import numpy as np
import pandas as pd
import math
def compute_accelerations(speeds, timestamps):
r"""
Returns a list of the accelerations along the path.
Each element of the list is the ratio of the... |
from django.contrib.auth.models import User, Group
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from django.contrib.auth.models import Permission
from django.core import mail
from notifier import shortcuts, models
class PreferencesTests(TestCase):
def setUp(self):
... |
from peyotl.phylesystem.phylesystem_umbrella import Phylesystem
from peyotl.api.phylesystem_api import PhylesystemAPI
from peyotl.manip import iter_trees
from peyotl.nexson_syntax import get_nexml_el
def create_phylesystem_obj():
# create connection to local phylesystem
phylesystem_api_wrapper = PhylesystemAPI(... |
from urllib.parse import urlparse
from wal_e.blobstore import s3
from wal_e.operator.backup import Backup
class S3Backup(Backup):
"""
A performs S3 uploads to of PostgreSQL WAL files and clusters
"""
def __init__(self, layout, creds, gpg_key_id):
super(S3Backup, self).__init__(layout, creds, gpg... |
import zlib
from scrapy.utils.gz import gunzip
from scrapy.http import Response, TextResponse
from scrapy.responsetypes import responsetypes
from scrapy.exceptions import NotConfigured
class HttpCompressionMiddleware(object):
"""This middleware allows compressed (gzip, deflate) traffic to be
sent/received from ... |
from twisted.internet.defer import inlineCallbacks
from vumi.dispatchers.simple.dispatcher import SimpleDispatcher
from vumi.tests.helpers import VumiTestCase, WorkerHelper
class TestDispatcher(VumiTestCase):
@inlineCallbacks
def setUp(self):
self.worker_helper = self.add_helper(WorkerHelper())
... |
from typing import (
Any,
List,
Sequence,
Tuple,
Union,
Type,
TypeVar,
Protocol,
TypedDict,
)
import numpy as np
from ._shape import _ShapeLike
from ._generic_alias import _DType as DType
from ._char_codes import (
_BoolCodes,
_UInt8Codes,
_UInt16Codes,
_UInt32Codes,
... |
from __future__ import print_function, division, absolute_import
from .linkedlist import LinkedList, LinkableItem |
from contextlib import contextmanager
from .termui import get_terminal_size
from .parser import split_opt
from ._compat import term_len
def measure_table(rows):
widths = {}
for row in rows:
for idx, col in enumerate(row):
widths[idx] = max(widths.get(idx, 0), term_len(col))
return tuple(... |
'''Foundation for all actions
Actions
=======
Actions purpose is to modify along the time some trait of an object.
The object that the action will modify is the action's target.
Usually the target will be an instance of some CocosNode subclass.
Example::
MoveTo(position, duration)
the target will move smoothly over... |
''' Control global configuration options with environment variables.
A global settings object that other parts of Bokeh can refer to.
``BOKEH_BROWSER`` --- What browser to use when opening plots.
Valid values are any of the browser names understood by the python
standard library webbrowser_ module.
``BOKEH_DEV`` --... |
from django.core.management import execute_manager
import imp
try:
imp.find_module('settings') # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to... |
from framework.dependency_management.dependency_resolver import ServiceLocator
"""
GREP Plugin for Logout and Browse cache management
NOTE: GREP plugins do NOT send traffic to the target and only grep the HTTP Transaction Log
"""
import string, re
import cgi
DESCRIPTION = "Searches transaction DB for Cache snooping pro... |
import numpy as np
from bokeh.models import ColumnDataSource, Plot, LinearAxis, Grid
from bokeh.models.markers import Hex
from bokeh.io import curdoc, show
N = 9
x = np.linspace(-2, 2, N)
y = x**2
sizes = np.linspace(10, 20, N)
source = ColumnDataSource(dict(x=x, y=y, sizes=sizes))
plot = Plot(
title=None, plot_wid... |
import posixpath
from django.conf import settings
JQUERY_URL = getattr(
settings, 'JQUERY_URL',
'http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js')
if not ((':' in JQUERY_URL) or (JQUERY_URL.startswith('/'))):
JQUERY_URL = posixpath.join(settings.MEDIA_URL, JQUERY_URL)
FORM_UTILS_MEDIA_URL = ge... |
import datetime
import warnings
from xml.dom import minidom
from django.contrib.syndication import feeds, views
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.utils import tzinfo
from django.utils.feedgenerator import rfc2822_date, rfc3339_date
from models import En... |
import numpy
from chainer.backends import cuda
from chainer import initializer
class Normal(initializer.Initializer):
"""Initializes array with a normal distribution.
Each element of the array is initialized by the value drawn
independently from Gaussian distribution whose mean is 0,
and standard deviat... |
__author__ = 'varunnayyar' |
"""Tools to be used with Pootle""" |
"""distutils.command.build_py
Implements the Distutils 'build_py' command."""
__revision__ = "$Id: build_py.py,v 1.46 2004/11/10 22:23:15 loewis Exp $"
import sys, string, os
from types import *
from glob import glob
from distutils.core import Command
from distutils.errors import *
from distutils.util import convert_pa... |
import sys
from smart.const import VERSION, DEBUG, DATADIR
from smart.option import OptionParser
from smart import init, initPlugins
from smart import *
if sys.version_info < (2, 3):
sys.exit(_("error: Python 2.3 or later required"))
import pwd
import os
if sys.platform[:5] != "sunos":
import pyexpat
USAGE=_("s... |
"""Additional help about wildcards."""
from __future__ import absolute_import
from gslib.help_provider import HelpProvider
_DETAILED_HELP_TEXT = ("""
<B>DESCRIPTION</B>
gsutil supports URI wildcards. For example, the command:
gsutil cp gs://bucket/data/abc* .
will copy all objects that start with gs://bucket/da... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
DOCUMENTATION = """
---
module: ftd_configuration
short_description: Manages configuration on Cis... |
"""
This integration tests will perform basic operations on Echo, depending on which protocols are available.
It creates a local hierarchy, and then tries to upload, download, remove, get metadata etc
.. warn::
The storage element you test is supposed to be called 'RAL-ECHO'.
(pylint does not play friendly with com... |
import gtk
from otrverwaltung import path
class PluginsDialog(gtk.Dialog, gtk.Buildable):
__gtype_name__ = "PluginsDialog"
def __init__(self):
pass
def do_parser_finished(self, builder):
self.builder = builder
self.builder.connect_signals(self)
self.builder.get_object('treevi... |
MAX_NUM_FIELDS = 20
HEADER = """\
id: variable_struct
label: Struct Variable
parameters:
"""
TEMPLATES = """\
templates:
imports: "def struct(data): return type('Struct', (object,), data)()"
var_make: |-
self.${{id}} = ${{id}} = struct({{
% for i in range({0}):
<%
... |
model_name = 'my_model'
simulation_size = 20
random_seed = 1
def setup_model(model):
"""Write initialization steps here.
e.g. ::
model.put([0,0,0,model.lattice.default_a], model.proclist.species_a)
"""
#from setup_model import setup_model
#setup_model(model)
pass
hist_length = 30
paramete... |
import unittest
from collections import OrderedDict
from overviewer_core import config_parser
from overviewer_core.settingsValidators import ValidationException
from overviewer_core import world
from overviewer_core import rendermodes
class SettingsTest(unittest.TestCase):
def setUp(self):
self.s = config_p... |
"""
This module defines SafeSessionMiddleware that makes use of a
SafeCookieData that cryptographically binds the user to the session id
in the cookie.
The implementation is inspired by the proposal in the following paper:
http://www.cse.msu.edu/~alexliu/publications/Cookie/cookie.pdf
Note: The proposed protocol protec... |
from datetime import datetime
from logging import getLogger
from pickle import dumps, loads
import re
from sqlalchemy import (MetaData, Column, ForeignKey, DateTime, Integer,
PickleType, String, Table, Unicode)
metadata = MetaData()
log = getLogger(__name__)
def are_elements_equal(x, y):
ret... |
from fixtures import Fixture
from storm.tracer import BaseStatementTracer, install_tracer, remove_tracer
class CaptureTracer(BaseStatementTracer, Fixture):
"""Trace SQL statements appending them to a C{list}.
Example:
with CaptureTracer() as tracer:
# Run queries
print tracer.queries... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.