content stringlengths 4 20k |
|---|
"""Runs Chromium's IndexedDB performance test. These test:
Databases:
create/delete
Keys:
create/delete
Indexes:
create/delete
Data access:
Random read/write
Read cache
Cursors:
Read & random writes
Walking multiple
Seeking.
"""
import json
import os
from metrics import memory
from metrics import pow... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#from __future__ import unicode_literals
''' NB: The sub-dict module design pattern is used here to merge over defaults in the module.
but merging of cfg[<module>] keys over module.default-cfg keys only occurs at the module level
Details:
If a top level key is a modu... |
#!/usr/bin/env python
# vim: sw=2 ts=2
import click
import os
import sys
@click.command()
### AWS/EC2 options
@click.option('--gluster-stack', help='Specify a gluster stack name. Making the name unique will allow for multiple deployments',
show_default=True)
@click.option('--region', default='us-east-1... |
#! /usr/bin/env python
import unittest
import codecs
import json
import os
import re
from peyotl.test.support import pathmap
from peyotl.utility import get_logger
_LOG = get_logger(__name__)
PUSHABLE_PATTERN = re.compile(r'\s*url\s*[=]\s*git@')
_MINI_PHYL_SHA1 = 'aa8964b55bfa930a91af7a436f55f0acdc94b918'
_SID = 'xy_1... |
"""Summary Operations."""
# pylint: disable=protected-access
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.ops import gen_logging_ops
from tensorflow.python.ops import summary_op_util
# go/... |
from __future__ import unicode_literals
import frappe, unittest, json
# commented due to commits -- only run when comments are modified
# class TestComment(unittest.TestCase):
# def setUp(self):
# self.cleanup()
# self.test_rec = frappe.get_doc({
# "doctype":"Event",
# "subject":"__Comment Test Event",
# ... |
#! /usr/bin/env python
from __future__ import print_function
import getopt
import os
import re
import six
from six.moves import socketserver
import subprocess
import sys
import tempfile
import threading
from ryu.ofproto import ofproto_parser
from ryu.ofproto import ofproto_v1_0
from ryu.ofproto import ofproto_v1_0_p... |
from __future__ import absolute_import
from __future__ import print_function
import re
from twisted.internet import defer
from twisted.python import log
from buildbot.process.properties import Interpolate
from buildbot.process.properties import Properties
from buildbot.process.results import CANCELLED
from buildbot.... |
import json
from test import CollectorTestCase
from test import get_collector_config
from mock import Mock, patch
from scribe import ScribeCollector
class ScribeCollectorTestCase(CollectorTestCase):
def setUp(self):
config = get_collector_config('ScribeCollector', {})
self.collector = ScribeCo... |
# Configuration file for measureCoaddSources
import lsst.meas.extensions.shapeHSM
hsm_plugins = set([
"ext_shapeHSM_HsmShapeBj", # Bernstein & Jarvis 2002
"ext_shapeHSM_HsmShapeLinear", # Hirata & Seljak 2003
"ext_shapeHSM_HsmShapeKsb", # KSB 1995
"ext_shapeHSM_HsmShapeRegauss", # Hirata & Se... |
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.azure_rm_common import AzureRMModuleBase
try:
from msrestazu... |
from __future__ import absolute_import
import logging
import os
import re
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip.index import Link
from pip.utils import rmtree, display_path, call_subprocess
from pip.utils.logging import indent_log
from pip.vcs import vcs, VersionControl
_svn_xml_ur... |
#!/user/bin/env python
# -*- coding:utf-8 -*-
# @Time : 2018/5/30 13:56
# @Author : zhangjun
# Title :
import random
import re
import traceback
import datetime
import sys
from lxml import etree
reload(sys)
sys.setdefaultencoding("utf8")
import base64
from des_js import des_encode
from fake_u... |
from __future__ import unicode_literals
from operator import attrgetter
from django.apps import apps
from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.backends.db import SessionStore
from django.db.models import Count
from django.db.models.query_utils import (
DeferredAttribu... |
import unittest
from datetime import datetime, date, timedelta
from decimal import Decimal
from django.conf import settings
from django.contrib.auth import get_user_model
from hiicart.models import HiiCart, LineItem, RecurringLineItem
User = get_user_model()
class HiiCartTestCase(unittest.TestCase):
"""Basic t... |
import numpy as np
import cv2
def get_image(roi_rec, short, max_size, mean, std):
"""
read, resize, transform image, return im_tensor, im_info, gt_boxes
roi_rec should have keys: ["image", "boxes", "gt_classes", "flipped"]
0 --- x (width, second dim of im)
|
y (height, first dim of im)
"""... |
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import os
import subprocess
import pytest
from pants.util.contextutil import temporary_dir
from pants_test.pants_run_integration_test import PantsRunIntegrationTest
... |
from couchpotato import get_session
from couchpotato.api import addApiView
from couchpotato.core.event import addEvent
from couchpotato.core.helpers.encoding import toUnicode
from couchpotato.core.helpers.request import jsonified, getParams
from couchpotato.core.helpers.variable import mergeDicts, md5, getExt
from couc... |
#!/usr/bin/python
"""
Debugging
"""
import sys
import re
import logging
import binascii
from cStringIO import StringIO
# create a root logger
root_logger = logging.getLogger('bacpypes')
def btox(data, sep=''):
"""Return the hex encoding of a blob (string)."""
# translate the blob into hex
hex_str = bin... |
from LinkedList_Basic import Node
from LinkedList_Basic import LinkedList
# Remove duplicates from an unsorted linked list
# With buffer
def remove_duplicate(aList):
recordDict = {}
prev = None
current = aList.head
while not current == None:
if current.data in recordDict:
if current == aList.tail:
prev.ne... |
import rasterio
from rasterio.enums import Compression, Interleaving
def test_enum_compression_JPEG():
assert Compression('JPEG').name == 'jpeg'
def test_enum_compression_LZW():
assert Compression('LZW').name == 'lzw'
def test_enum_compression_PACKBITS():
assert Compression('PACKBITS').name == 'packb... |
"""
MSN Live Connect oAuth 2.0
Settings:
LIVE_CLIENT_ID
LIVE_CLIENT_SECRET
LIVE_EXTENDED_PERMISSIONS (defaults are: wl.basic, wl.emails)
References:
* oAuth http://msdn.microsoft.com/en-us/library/live/hh243649.aspx
* Scopes http://msdn.microsoft.com/en-us/library/live/hh243646.aspx
* REST http://msdn.microsoft.co... |
"""
Accelerated Failure Time (AFT) Model with empirical likelihood inference.
AFT regression analysis is applicable when the researcher has access
to a randomly right censored dependent variable, a matrix of exogenous
variables and an indicatior variable (delta) that takes a value of 0 if the
observation is censored ... |
from django.apps import apps
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.core.exceptions import FieldDoesNotExist
from django.db.models.fields import CharField, Field, related
from django.db.models.options import EMPTY_RELATION_TREE, IMMUTABLE_WARNING
from djan... |
import os
import os.path as osp
import numpy as np
import h5py
import theano
from model.scene_mlp import SceneMlp
from optimizer import adam_optimizer
from config import DATA_ROOT, SAVE_ROOT
def train(dataset='mscoco', ensemble=10, mb=500, max_epoch=80, lr=0.0001):
print '... loading topic'
data_dir = osp.joi... |
"""
Django settings for cocoa project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impo... |
from __future__ import absolute_import
import collections
# FIXME: can we store these as something else before we ship it?
import sys
import time
try:
import simplejson as json
except ImportError:
import json
from ansible import constants as C
from ansible.utils import jsonify
from ansible.cache.base import B... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
try:
from nssrc.com.citrix.netscaler.nitro.resource.config.ssl.sslcertkey import sslcer... |
import yaml
import inspect
import types
from pylearn2.utils.exc import reraise_as
global resolvers
def load(json_file_path):
""" given a file path to a json file, returns the dictionary definde by the json file """
f = open(json_file_path)
lines = f.readlines()
f.close()
content = ''.join(lines... |
"""Tests for binary transforms."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from tensorflow.contrib.learn.python.learn.dataframe import tensorflow_dataframe as df
from tensorflow.contrib.learn.python.learn.... |
# encoding: utf-8
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse_urlparse,
compat_urlparse,
)
from ..utils import (
clean_html,
ExtractorError,
int_or_none,
parse_duration,
)
class FranceTVBaseInfoEx... |
"""
This app is used for creating/updating site's configuration. This app encapsulate configuration related logic for sites
and provides a way for sites to override default/system behavioural or presentation logic.
Models:
SiteConfiguration (models.Model):
This model contains configuration for a site and c... |
from __future__ import unicode_literals
from unittest import skipUnless
from django.db import connection
from django.db.utils import DatabaseError
from django.test import TransactionTestCase, mock, skipUnlessDBFeature
from .models import Article, Reporter
class IntrospectionTests(TransactionTestCase):
availab... |
# -*- encoding: utf-8 -*-
"""
Django settings for dp project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.j... |
from __future__ import absolute_import
import logging
import os
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._internal.download import path_to_url
from pip._internal.utils.misc import (
display_path, make_vcs_requirement_url, rmtree,
)
from pip._internal.utils.temp_dir import TempDirec... |
"""
Seseman Convent problem in Google CP Solver.
n is the length of a border
There are (n-2)^2 "holes", i.e.
there are n^2 - (n-2)^2 variables to find out.
The simplest problem, n = 3 (n x n matrix)
which is represented by the following matrix:
a b c
d e
f g h
Where the following constrai... |
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.models import get_current_site
from django.template import Context, loader
from django import forms
from django.utils.translation import ugett... |
import platform
import json
from ajenti.ui import UI
from ajenti.com import *
from ajenti import version
from ajenti.api import ICategoryProvider, EventProcessor, SessionPlugin, event, URLHandler, url, get_environment_vars
from ajenti.ui import BasicTemplate
from ajenti.utils import ConfigurationError
from api import ... |
# -*- coding: utf-8 -*-
"""
werkzeug._internal
~~~~~~~~~~~~~~~~~~
This module provides internally used helpers and constants.
:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import inspect
from weakref import WeakKeyDictiona... |
"""Registry mechanism for "registering" classes/functions for general use.
This is typically used with a decorator that calls Register for adding
a class or function to a registry.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import traceback
from ... |
from openerp import api, models, fields
class crm_lead(models.Model):
_inherit = "crm.lead"
planned_sponsorships = fields.Integer(
'Expected new sponsorships', track_visibility='onchange')
event_ids = fields.One2many(
'crm.event.compassion', 'lead_id', 'Event',
readonly=... |
import urllib
from lxml import etree
from tempest.common import rest_client
from tempest.common import xml_utils as common
from tempest import config
from tempest import exceptions
CONF = config.CONF
class VolumeTypesClientXML(rest_client.RestClient):
"""
Client class to send CRUD Volume Types API requests... |
# encoding: UTF-8
import sys,os
from PyQt4 import QtGui,QtCore
from pymongo import MongoClient
import matplotlib.dates as mpd
sys.path.append('..')
from vtConstantMid import *
import datetime as dt
import pytz
from ui.uiCrosshair import Crosshair
"""mid
读取保存在mongodb中的tick数据并图形化,以方便观察某个阶段的tick细节
"""
class Tick... |
import json
from time import sleep
import os
from subprocess import call
import getopt
from sys import argv, exit
import requests
container_list = {}
def add_dns(name, hostname, ip, is_slave=None):
if is_slave:
r = requests.put("http://%s/%s/%s/%s/" % (is_slave, name, hostname, ip))
if r.status_co... |
"""Text wrapping and filling.
"""
# Copyright (C) 1999-2001 Gregory P. Ward.
# Copyright (C) 2002, 2003 Python Software Foundation.
# Written by Greg Ward <<EMAIL>>
__revision__ = "$Id: textwrap.py 68135 2009-01-01 15:46:10Z georg.brandl $"
import string, re
# Do the right thing with boolean values for all known Py... |
"""
Copyright (c) 2021 The Orbit Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
"""
import os, sys
import subprocess
def install_orbitutils():
# This must be the folder that contains the setup.py file and the "orbitutils"
# folde... |
#!/usr/bin/env python
import os
import optparse
import sys
import re
from pip.exceptions import InstallationError, CommandError, PipError
from pip.log import logger
from pip.util import get_installed_distributions, get_prog
from pip.vcs import git, mercurial, subversion, bazaar # noqa
from pip.baseparser import Conf... |
from __future__ import absolute_import
import shlex
from six import PY3
from ansible.utils.unicode import to_bytes, to_unicode
if PY3:
# shlex.split() wants Unicode (i.e. ``str``) input on Python 3
shlex_split = shlex.split
else:
# shlex.split() wants bytes (i.e. ``str``) input on Python 2
def shlex... |
"""
http://www.akeric.com/python/pygameWindowInfo/pygameWindowInfo_0_1.py
Eric Pavey - <EMAIL> - 2009-10-25
http://www.akeric.com/blog
Permission to use and modify given by author, as long as author is given credit.
Python module containing class allowing the user to query Pygame window and
display screen extent value... |
import logging
import zlib
import io
from .exceptions import DecodeError
from .packages.six import string_types as basestring, binary_type
from .util import is_fp_closed
log = logging.getLogger(__name__)
class DeflateDecoder(object):
def __init__(self):
self._first_try = True
self._data = bina... |
import warnings
import geoalchemy2
from flask import current_app
from shapely.geometry import shape
from sqlalchemy import func
from flask_admin.form import JSONField
from .widgets import LeafletWidget
class GeoJSONField(JSONField):
widget = LeafletWidget()
def __init__(self, label=None, validators=None, ... |
import os
import rasterio
from rasterstats.point import point_window_unitxy, bilinear, geom_xys
from rasterstats import point_query
raster = os.path.join(os.path.dirname(__file__), 'data/slope.tif')
raster_nodata = os.path.join(os.path.dirname(__file__), 'data/slope_nodata.tif')
with rasterio.open(raster) as src:
... |
from erppeek import Client
from datetime import datetime,timedelta
import configdb
import psycopg2
import psycopg2.extras
import argparse
O = Client(**configdb.erppeek)
pol_obj = O.GiscedataPolissa
sw_obj = O.GiscedataSwitching
parser = argparse.ArgumentParser(description='Seguiment de casos de contractes amb 3.0A')... |
"""Component to embed TP-Link smart home devices."""
import logging
import voluptuous as vol
from homeassistant.const import CONF_HOST
from homeassistant import config_entries
from homeassistant.helpers import config_entry_flow
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name_... |
#!/usr/bin/env python
"""
@file pois2inductionLoops.py
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2010-02-18
@version $Id: pois2inductionLoops.py 13811 2013-05-01 20:31:43Z behrisch $
Converts a given pois located on lanes into induction loop detectors;
Each poi is replicated to cover all lanes ... |
#!/usr/bin/env python
"""This module contains tests for stats API renderers."""
from grr.gui import api_test_lib
from grr.lib import aff4
from grr.lib import flags
from grr.lib import stats
from grr.lib import test_lib
from grr.lib import utils
# TODO(user): Implement unit tests in addition to regression tests.
... |
from __future__ import division
import os
import numpy
from matplotlib._pylab_helpers import Gcf
from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\
FigureManagerBase, FigureCanvasBase, NavigationToolbar2
from matplotlib.cbook import maxdict
from matplotlib.figure import Figure
from matplotl... |
'Link to manual - http://ridl.cfd.rit.edu/products/manuals/Baytech/Baytech%20MRP%20Manual.pdf'
DEFAULT_ADMINPORT = 10008
from time import sleep
# Extron Bridge 2001 - 2004
param_ipAddress = Parameter({'title': 'IP address', 'schema': {'type': 'string'}})
param_adminPort = Parameter({'title': 'Admin port', 'schema':... |
import re
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, validate
from livestreamer.stream import RTMPStream
INFO_URL = "http://mvn.vaughnsoft.net/video/edge/{domain}_{channel}"
DOMAIN_MAP = {
"breakers": "btv",
"vapers": "vtv",
"vaughnlive": "live",
}
_url_re = re.comp... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import sys
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from ansible.compat.tests import unittest
from ansible.compat.te... |
#!/usr/bin/env python
# Created by Eugenio Cutolo <<EMAIL>> using QtDesinger
#
# This program can be distributed under the terms of the GNU GPL.
# See the file COPYING.
#
#QtTracker Relase 0.1
from qt import *
class QRichListViewItem(QListViewItem):
def __init__(self,*args):
QListViewItem.__init__(self,... |
import os
# We'll render HTML templates and access data sent by POST
# using the request object from flask. Redirect and url_for
# will be used to redirect the user once the upload is done
# and send_from_directory will help us to send/show on the
# browser the file that the user just uploaded
from flask import Flask, ... |
import os
def generate(env, gcc_cross_prefix=None, gcc_strict=True, gcc_stop_on_warning=None):
if gcc_stop_on_warning == None: gcc_stop_on_warning = env['stop_on_warning']
### compiler flags
if gcc_strict:
env.AppendUnique(CCFLAGS = ['-pedantic', '-Wall', '-W', '-Wundef', '-Wno-long-long'])
... |
import windmill
import logging
from time import sleep
import os, sys
from datetime import datetime
from threading import Thread
import shutil
import socket
import functest
functest.configure()
def process_options(argv_list):
"""Process all the command line options"""
import admin_options
admin_options.proc... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import copy
from ansible import constants as C
from ansible.module_utils._text import to_text
from ansible.module_utils.connection import Connection
from ansible.errors import AnsibleError
from ansible.plugins.action im... |
from support.helpers import (
approve_approval_request,
create_approval_request,
enable_recipe,
new_recipe,
)
from support.assertions import assert_valid_schema
from urllib.parse import urljoin
def test_recipe_disable(conf, requests_session, headers):
# Get a list of actions and pick the first one... |
from sympy import Symbol, Integer, Mul
from sympy.utilities import numbered_symbols
from sympy.physics.quantum.gate import (X, Y, Z, H, S, T, CNOT,
CGate)
from sympy.physics.quantum.identitysearch import bfs_identity_search
from sympy.physics.quantum.circuitutils import (kmp_table, find_subcircuit,
repl... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import ExtractorError
class TestURLIE(InfoExtractor):
""" Allows addressing of the test cases as test:yout.*be_1 """
IE_DESC = False # Do not list
_VALID_URL = r'test(?:url)?:(?P<id>(?P<extractor>.+?)(?:_(... |
"""
Pulls the data from Swift and places it into the empty directory
SWIFT_KEY environment variable to be passed by the template
"""
import os
import zipfile
import time
import fasteners
from io import BytesIO
from swift_handler import SwiftHandler
class SwiftStore():
swiftConnection = None
def _getObject... |
# -*- coding: utf-8 -*-
from os import path
from django.conf.urls import include, url
from django.utils._os import upath
from django.views import defaults, i18n, static
from . import views
base_dir = path.dirname(path.abspath(upath(__file__)))
media_dir = path.join(base_dir, 'media')
locale_dir = path.join(base_dir,... |
# -*- coding: utf-8 -*-
import json
from cms.toolbar.constants import ALIGNMENTS
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.encoding import force_unicode
from django.utils.functional import Promise
class Serializable(object):
"""
Base class for ... |
# coding: utf8
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" è un\'espressione opzionale come "campo1=\'nuovo valore\'". Non si può fare "update" o "delete" dei risultati di un JOIN ',
'%Y-%m-%d': '%d/%m/%Y',
'%Y-%m-%d %H:%M:%S': '%d/%m/%... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import time
import traceback
try:
import ovirtsdk4.types as otypes
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule
from ansible.module_util... |
import numpy as np
class NormalizePositive(object):
def __init__(self, axis=0):
self.axis = axis
def fit(self, features, y=None):
# count features that are greater than zero in axis `self.axis`:
if self.axis == 1:
features = features.T
binary = (features > 0)
... |
"""
Package generated from /System/Library/CoreServices/Finder.app
"""
from warnings import warnpy3k
warnpy3k("In 3.x, the Finder package is removed.", stacklevel=2)
import aetools
Error = aetools.Error
import Standard_Suite
import Legacy_suite
import Containers_and_folders
import Files
import Finder_Basics
import Fi... |
import re
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, validate
from livestreamer.stream import RTMPStream
PLAYER_URL = "http://leton.tv/player.php"
SWF_URL = "http://files.leton.tv/jwplayer.flash.swf"
_url_re = re.compile("""
http?://(\w+.)?leton.tv
(?:
/player\.p... |
"""Classes used in pickling tests, need to be at the module level for
unpickling.
"""
from . import fixtures
class User(fixtures.ComparableEntity):
pass
class Order(fixtures.ComparableEntity):
pass
class Dingaling(fixtures.ComparableEntity):
pass
class EmailUser(User):
pass
class Address(fixt... |
import numpy as np
import os
import shutil
import tempfile
import unittest
from chainer import testing
from chainer.testing import attr
from chainercv.datasets.cityscapes.cityscapes_utils import cityscapes_labels
from chainercv.datasets import CityscapesSemanticSegmentationDataset
from chainercv.datasets import Citys... |
from os import path
import maskgen.video_tools
import maskgen.ffmpeg_api
import shlex # For handling paths with spaces
import logging
from collections import OrderedDict
def validate_codec_name(codec_name, codec_type='video'):
"""
Checks if a name is in the list of valid codecs.
:param codec_name: string,... |
from .error import Error, ErrorException
from .int_wrapper import IntWrapper
from .int_optional_wrapper import IntOptionalWrapper
from .string_wrapper import StringWrapper
from .string_optional_wrapper import StringOptionalWrapper
from .array_wrapper import ArrayWrapper
from .array_optional_wrapper import ArrayOptional... |
try:
from functools import lru_cache
except ImportError:
# backport of Python's 3.3 lru_cache, written by Raymond Hettinger and
# licensed under MIT license, from:
# <http://code.activestate.com/recipes/578078-py26-and-py30-backport-of-python-33s-lru-cache/>
# Should be removed when Django only sup... |
from __future__ import absolute_import
from sentry.api.base import EnvironmentMixin
from sentry.api.bases import OrganizationMemberEndpoint
from sentry.api.paginator import DateTimePaginator
from sentry.api.serializers import serialize, OrganizationActivitySerializer
from sentry.models import Activity, OrganizationMem... |
"""
PageLayout
==========
The :class:`PageLayout` class allow to create a simple multiple page
layout, in a way that allows easy flipping of one page to another using
borders.
:class:`PageLayout` doesn't honor size_hint or pos_hint in any way currently.
.. versionadded:: 1.8.0
example::
PageLayout:
But... |
from kapteyn import maputils
import numpy
from service import *
fignum = 24
fig = plt.figure(figsize=figsize)
frame = fig.add_axes(plotbox)
theta1 = 45
title = r"Bonne's equal area projection (BON) with $\theta_1=45^\circ$. (Cal. fig.28)"
header = {'NAXIS' : 2, 'NAXIS1': 100, 'NAXIS2': 80,
'CTYPE1' : 'RA---... |
# functions for handling ABI checking of libraries
import Options, Utils, os, Logs, samba_utils, sys, Task, fnmatch, re, Build
from TaskGen import feature, before, after
# these type maps cope with platform specific names for common types
# please add new type mappings into the list below
abi_type_maps = {
'_Bool... |
"""
Enums for use in the STDM Import/Export module
"""
__author__ = 'John Gitau'
__license__ = 'GNU Lesser General Public License (LGPL)'
__url__ = 'http://www.unhabitat.org'
try:
from osgeo import gdal
from osgeo import ogr
except ImportError:
import gdal
import ogr
drivers = {
"sh... |
from __future__ import unicode_literals
import datetime
from decimal import Decimal
from unittest import skipIf
from django.contrib.humanize.templatetags import humanize
from django.template import Context, Template, defaultfilters
from django.test import TestCase, modify_settings, override_settings
from django.utils... |
""" A manual scoring plugin for students submissions """
from inginious.frontend.plugins.utils import create_static_resource_page
from inginious.frontend.plugins.manual_scoring.pages import students_list, student_submissions, manual_scoring, \
course_task_list, student_feedback_list, feedback
from inginious.fron... |
import Sofa
from Compliant import StructuralAPI, Tools
path = Tools.path( __file__ )
def createFixedRigidBody(node,name,pos):
body = StructuralAPI.RigidBody( node, name )
body.setManually( [pos,0,0,0,0,0,1], 1, [1,1,1] )
body.node.createObject('FixedConstraint')
return body
def createRigidBody(nod... |
import os.path
from collections import OrderedDict
import execjs.runtime_names as runtime_names
import execjs._external_runtime as external_runtime
import execjs._pyv8runtime as pyv8runtime
import execjs._exceptions as exceptions
def register(name, runtime):
'''Register a JavaScript runtime.'''
_runtimes.app... |
from spack import *
import os
class PpopenApplAmrFdm(MakefilePackage):
"""
ppOpen-APPL/AMR-FDM is an adaptive mesh refinement (AMR) framework
for development of 3D parallel finite-difference method (FDM)
applications.
"""
homepage = "http://ppopenhpc.cc.u-tokyo.ac.jp/ppopenhpc/"
url ... |
"""ACME utilities for testing."""
import datetime
import itertools
from acme import challenges
from acme import jose
from acme import messages
from letsencrypt.tests import test_util
KEY = test_util.load_rsa_private_key('rsa512_key.pem')
# Challenges
SIMPLE_HTTP = challenges.SimpleHTTP(
token="evaGxfADs6pSRb2L... |
import hashlib
import logging
import os
import re
import tempfile
import bb.data
logger = logging.getLogger('BitBake.SigGen')
try:
import cPickle as pickle
except ImportError:
import pickle
logger.info('Importing cPickle failed. Falling back to a very slow implementation.')
def init(d):
siggens = [o... |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
float_or_none,
int_or_none,
)
class DotsubIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?dotsub\.com/view/(?P<id>[^/]+)'
_TEST = {
'url': 'http://dotsub.com/view/aed3b8b2-1889-4df5-ae63-ad85f... |
#!/usr/bin/env python
"""A simple wrapper to send email alerts."""
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import logging
import re
import smtplib
import socket
from grr.lib import config_lib
from grr.lib im... |
from essentia_test import *
class TestBarkBands(TestCase):
def testRegression(self):
# read expected output
expected = readMatrix( join(filedir(), 'barkbands', 'output.txt') )
# Simple regression test, comparing to reference values
audio = MonoLoader(filename = join(testdata.audio... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import re
from ansible.module_utils.basic import AnsibleModule
def query_package(module, ... |
"""
Tests for `field_overrides` module.
"""
import unittest
from nose.plugins.attrib import attr
from django.test.utils import override_settings
from xblock.field_data import DictFieldData
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import (
ModuleStore... |
"""A utility script for downloading versioned Syzygy binaries."""
import cStringIO
import hashlib
import errno
import json
import logging
import optparse
import os
import re
import shutil
import stat
import sys
import subprocess
import urllib2
import zipfile
_LOGGER = logging.getLogger(os.path.basename(__file__))
#... |
'''
180upload urlresolver plugin
Copyright (C) 2011 anilkuj
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is di... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.