content string |
|---|
import os
from numpy import *
from scipy import *
from scipy import optimize
from string import *
from numpy.linalg import *
class CRBLocation(object):
"""
A CRBLocation contains:
1- a set of RadioNodes (RN) with associated position accuracies (RNQoS),
2- a set of measurements (RSS, TOA, TDOA) with as... |
from flask import Flask, request, abort
import json
import ndb_util
from model import User
from google.appengine.api import users
from google.appengine.ext import ndb
from google.appengine.api import app_identity
from google.appengine.api import mail
from flask_restful import Resource
from google.appengine.runtime i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Command-line wrapper for the tracetool machinery.
"""
__author__ = "Lluís Vilanova <<EMAIL>>"
__copyright__ = "Copyright 2012-2014, Lluís Vilanova <<EMAIL>>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintainer__ = "Stefan Hajnoczi... |
#!/usr/bin/env python3
##########################################################################################
# Date Started: 2017-01-01
# Purpose: Load dataset and create interfaces for piping the data to the model
##########################################################################################
########... |
class Token(object):
def __init__(self, start_mark, end_mark):
self.start_mark = start_mark
self.end_mark = end_mark
def __repr__(self):
attributes = [key for key in self.__dict__
if not key.endswith('_mark')]
attributes.sort()
arguments = ', '.join(['%s=%... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import range
from future import standard_library
standard_library.install_aliases()
import sys
PYTHON_VERSION = sys.version_info[:3]
PY2 = (PYTHON_VERSION[0... |
# -*- coding: utf-'8' "-*-"
import base64
try:
import simplejson as json
except ImportError:
import json
from hashlib import sha1
import hmac
import logging
import urlparse
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.addons.payment_adyen.controllers.main import Adye... |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
unified_strdate,
)
class ExpoTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?expotv\.com/videos/[^?#]*/(?P<id>[0-9]+)($|[?#])'
_TEST = {
'url': 'http://www.expotv.com/videos/rev... |
"""Test processing of unrequested blocks.
Since behavior differs when receiving unrequested blocks from whitelisted peers
versus non-whitelisted peers, this tests the behavior of both (effectively two
separate tests running in parallel).
Setup: two nodes, node0 and node1, not connected to each other. Node0 does not
... |
from __future__ import absolute_import
from django.core.management.base import BaseCommand
from zerver.lib.actions import do_rename_stream
from zerver.models import Realm, get_realm
import sys
class Command(BaseCommand):
help = """Change the stream name for a realm."""
def add_arguments(self, parser):
... |
"""
CherryPy implements a simple caching system as a pluggable Tool. This tool tries
to be an (in-process) HTTP/1.1-compliant cache. It's not quite there yet, but
it's probably good enough for most sites.
In general, GET responses are cached (along with selecting headers) and, if
another request arrives for the same r... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsRelationManager.
.. note:: 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 2 of the License, or
(at your option) any later version.
""... |
from collections import OrderedDict
from typing import Dict, Type
from .base import SecuritySettingsServiceTransport
from .grpc import SecuritySettingsServiceGrpcTransport
from .grpc_asyncio import SecuritySettingsServiceGrpcAsyncIOTransport
# Compile a registry of transports.
_transport_registry = OrderedDict() # ... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
peukerdouglas.py
---------------------
Date : October 2012
Copyright : (C) 2012 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
***********... |
"""
Read temperature information from Eddystone beacons.
Your beacons must be configured to transmit UID (for identification) and TLM
(for temperature) frames.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.eddystone_temperature/
"""
import loggi... |
from __future__ import absolute_import
import curses
import errno
import os
import pydoc
import subprocess
import sys
try:
unicode
except NameError:
unicode = str
def get_pager_command():
command = os.environ.get('PAGER', 'less -r').split()
return command
def page_internal(data):
"""A more tha... |
# pylint: disable=missing-docstring
from lettuce import step
from lettuce import world
from lettuce import before
from pymongo import MongoClient
from nose.tools import assert_equals
from nose.tools import assert_in
REQUIRED_EVENT_FIELDS = [
'agent',
'event',
'event_source',
'event_type',
'host',
... |
import collections
import string
import numpy
import six
import cupy
from cupy import carray
from cupy import elementwise
from cupy import util
six_range = six.moves.range
six_zip = six.moves.zip
_broadcast = elementwise._broadcast
_check_args = elementwise._check_args
_decide_params_type = elementwise._decide_par... |
from google.appengine.ext import db
from rogerthat.bizz.communities.communities import get_community
from rogerthat.bizz.payment import get_api_module
from rogerthat.consts import DEBUG
from rogerthat.dal.profile import get_service_profile
from rogerthat.models import ServiceIdentity
from rogerthat.rpc import users
fr... |
"""Provides a common base for Apache proxies"""
import re
import os
import subprocess
import mock
import zope.interface
from letsencrypt import configuration
from letsencrypt import errors as le_errors
from letsencrypt_apache import configurator
from letsencrypt_compatibility_test import errors
from letsencrypt_compa... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import re
import time
import glob
from ansible.plugins.action.junos import ActionModule as _ActionModule
from ansible.module_utils._text import to_text
from ansible.module_utils.six.moves.urllib.parse import urlsplit
fro... |
import argparse
import datetime
import getopt
import json
import sys
import tempfile
import threading
import time
import urllib.request
import urllib.parse
gFileCache = None;
# A key/value store that stores objects to disk in temporary objects
# for 30 minutes.
class FileCache:
def __init__(self):
self.store = ... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
__description__ = 'A companion tool to autoXLIFF.py. Helps batch-add translation strings to existing XLIFF documents (useful to add arbitrary strings like those that appear in files other than twig templates, since those are not picked-up automatically by autoXLIFF. Exampl... |
import boto
from boto.pyami.scriptbase import ScriptBase
import os, StringIO
class CopyBot(ScriptBase):
def __init__(self):
ScriptBase.__init__(self)
self.wdir = boto.config.get('Pyami', 'working_dir')
self.log_file = '%s.log' % self.instance_id
self.log_path = os.path.join(self.wd... |
import urllib2
import xml.etree.cElementTree as etree
import xml.etree
import re
from name_parser.parser import NameParser, InvalidNameException
from sickbeard import logger, classes, helpers
from sickbeard.common import Quality
def getSeasonNZBs(name, urlData, season):
try:
showXML = etr... |
from django.conf.urls import *
from individuals.views import IndividualDeleteView, GroupDeleteView
from django.contrib.admin.views.decorators import staff_member_required
from . import views
urlpatterns = [
url(r'^create/$', views.create, name='individual_create'),
url(r'^edit/(?P<individual_id>[0-9]+)/$', v... |
"""Utilities provided as part of the links interface."""
from grpc.framework.interfaces.links import links
class _NullLink(links.Link):
"""A do-nothing links.Link."""
def accept_ticket(self, ticket):
pass
def join_link(self, link):
pass
NULL_LINK = _NullLink() |
"""
termcolors.py
"""
from django.utils import six
color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
foreground = dict([(color_names[x], '3%s' % x) for x in range(8)])
background = dict([(color_names[x], '4%s' % x) for x in range(8)])
RESET = '0'
opt_dict = {'bold': '1', 'undersco... |
"""
API for date conversion and date related GUI creation.
Lexicon
datetext:
textual format => 'YEAR-MONTH-DAY HOUR:MINUTE:SECOND'
e.g. '2005-11-16 15:11:44'
default value: '0000-00-00 00:00:00'
datestruct:
tuple format => see http://docs.python.org/lib/module-time.html
... |
from __future__ import absolute_import
from .fixtures import *
from blitzdb.tests.helpers.movie_data import Actor, Director, Movie
import blitzdb
def test_basic_delete(backend, small_test_data):
backend.filter(Actor, {}).delete()
backend.commit()
assert len(backend.filter(Actor, {})) == 0
def test_b... |
import enum
import os
from time import time
from typing import Union, Callable, Tuple, ByteString
import numpy as np
from tensorboard.compat.proto import event_pb2
from tensorboard.compat.proto import summary_pb2
from tensorboard.summary.writer.event_file_writer import EventFileWriter
from tensorboard.util.tensor_util... |
"""
tests for quantecon.models.optgrowth
@author : Spencer Lyon
@date : 2014-08-05 10:20:53
TODO: I'd really like to see why the solutions only match analytical
counter part up to 1e-2. Seems like we should be able to do better
than that.
"""
from __future__ import division
from math import log
import num... |
import generator
from parser import Parser
from compiler import SyntaxCompiler
def compile_string(syntax):
"""
Builds a converter from the given syntax and returns it.
@type syntax: str
@param syntax: A Gelatin syntax.
@rtype: compiler.Context
@return: The compiled converter.
"""
r... |
import datetime
from nose.tools import eq_, ok_, assert_raises
from configman import ConfigurationManager, Namespace
from socorro.external import BadArgumentError
from socorro.lib import datetimeutil
from socorro.lib.search_common import (
SearchBase, SearchParam, convert_to_type, get_parameters, restrict_fields
... |
# -*- coding: utf-8 -*-
from module.plugins.internal.MultiAccount import MultiAccount
from module.plugins.internal.misc import json
class RPNetBiz(MultiAccount):
__name__ = "RPNetBiz"
__type__ = "account"
__version__ = "0.19"
__status__ = "testing"
__config__ = [("mh_mode" , "all;liste... |
from django.db.backends.oracle.creation import DatabaseCreation
from django.db.backends.util import truncate_name
class OracleCreation(DatabaseCreation):
def sql_indexes_for_field(self, model, f, style):
"Return any spatial index creation SQL for the field."
from django.contrib.gis.db.models.field... |
import numpy as np
import seaborn as sns
from matplotlib import patches
import matplotlib.pyplot as plt
from scipy.signal import gaussian
from scipy.spatial import distance
XY_CACHE = {}
STATIC_DIR = "_static"
plt.rcParams["savefig.dpi"] = 300
def poisson_disc_sample(array_radius, pad_radius, candidates=100, d=2, ... |
"""Ugly graph drawing tools"""
import matplotlib.pyplot as plt
import matplotlib.cm as cmap
#import numpy as np
from matplotlib import cbook
# http://stackoverflow.com/questions/4652439/is-there-a-matplotlib-equivalent-of-matlabs-datacursormode
class DataCursor(object):
"""A simple data cursor widget that displays... |
import os
import re
import json
import tarfile
from collections import OrderedDict
from subprocess import CalledProcessError
from wlauto import Workload, Parameter, Executable, File
from wlauto.exceptions import WorkloadError, ResourceError
from wlauto.instrumentation import instrument_is_enabled
from wlauto.utils.mis... |
import urllib2
import lxml.html
import numpy
import scipy
import scipy.misc
import scipy.cluster
import urlparse
import struct
import operator
import gzip
import datetime
import requests
import httplib
from PIL import BmpImagePlugin, PngImagePlugin, Image
from socket import error as SocketError
from boto.s3.key import ... |
"""Read and cache directory listings.
The listdir() routine returns a sorted list of the files in a directory,
using a cache to avoid reading the directory more often than necessary.
The annotate() routine appends slashes to directories."""
from warnings import warnpy3k
warnpy3k("the dircache module has been rem... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
try:
from librar... |
# Test of compaction code in server/db.py
import array
from collections import defaultdict
from os import environ, urandom
from struct import pack
import random
from lib.hash import hash_to_str
from server.env import Env
from server.db import DB
def create_histories(db, hashX_count=100):
'''Creates a bunch of r... |
import report_payslip_details
import report_payroll_advice
import report_hr_salary_employee_bymonth
import payment_advice_report
import report_hr_yearly_salary_detail
import payslip_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
# -*- coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
# Also if needed: retab
'''
Regression test
'''
from __future__ import (unicode_literals, absolute_import, \
print_function, division)
import argparse
import matplotlib.pyplot as plt
import numpy as np
import os
i... |
import ns.applications
import ns.core
import ns.csma
import ns.internet
import ns.network
def main(argv):
#
# Allow the user to override any of the defaults and the above Bind() at
# run-time, via command-line arguments
#
cmd = ns.core.CommandLine()
cmd.Parse(argv)
#
# But since this is a realtime scr... |
from osv import osv
class wiki_wiki_page_open(osv.osv_memory):
""" wizard Open Page """
_name = "wiki.wiki.page.open"
_description = "wiz open page"
def open_wiki_page(self, cr, uid, ids, context=None):
""" Opens Wiki Page of Group
@param cr: the current row, from the database cursor... |
""" Libcaca Python bindings """
import ctypes
from caca import _lib, _PYTHON3, _str_to_bytes
from caca.canvas import _Canvas, Canvas
class _Display(object):
""" Model for Display objects.
"""
def from_param(self):
""" Required by ctypes module to call object as parameter of
a C functi... |
from django.test import TestCase
from geonode.base.models import ResourceBase
from geonode.utils import OGC_Servers_Handler
class ThumbnailTests(TestCase):
def setUp(self):
self.rb = ResourceBase.objects.create()
def tearDown(self):
t = self.rb.thumbnail
if t:
t.delete()
... |
import sys
from twisted.python import log
from twisted.internet import reactor
from twisted.web.server import Site
from twisted.web.static import File
from autobahn.websocket import listenWS
from autobahn.wamp import WampServerFactory, \
WampServerProtocol
class MyServerProtocol(WampServer... |
import numpy as np
from scipy.sparse import csr_matrix
from sklearn.utils.testing import assert_array_equal, assert_equal, assert_true
from sklearn.utils.testing import assert_not_equal
from sklearn.utils.testing import assert_array_almost_equal, assert_raises
from sklearn.utils.testing import assert_less_equal
from ... |
'''
Created on 2010/12/20
@author: Nachi Ueno <<EMAIL>>
'''
import boto
import base64
import boto.ec2
from boto_v6.ec2.instance import ReservationV6
from boto.ec2.securitygroup import SecurityGroup
class EC2ConnectionV6(boto.ec2.EC2Connection):
'''
EC2Connection for OpenStack IPV6 mode
'''
def get_a... |
from .. import exc as sa_exc
from ..util import ScopedRegistry, ThreadLocalRegistry, warn
from . import class_mapper, exc as orm_exc
from .session import Session
__all__ = ['scoped_session']
class scoped_session(object):
"""Provides scoped management of :class:`.Session` objects.
See :ref:`unitofwork_conte... |
import dns.exception
import dns.rdata
import dns.tokenizer
def _validate_float_string(what):
if what[0] == '-' or what[0] == '+':
what = what[1:]
if what.isdigit():
return
(left, right) = what.split('.')
if left == '' and right == '':
raise dns.exception.FormError
if not lef... |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2016 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law o... |
from muntjac.api import VerticalLayout, Label, Embedded, Button, Alignment
from muntjac.terminal.theme_resource import ThemeResource
from muntjac.ui.css_layout import CssLayout
from muntjac.ui.button import IClickListener
from muntjac.ui.custom_component import CustomComponent
from muntjac.ui.horizontal_layout import H... |
from bson import ObjectId
import json
import logging
from bson.errors import InvalidId
from django.http import JsonResponse, HttpResponseNotFound, HttpResponseBadRequest, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from api.models import db_model
from api.models.auth import RequireLogin
from api... |
'''Unit tests for amountchangedpattern.py.'''
import re
import unittest2 as unittest
from webkitpy.common.watchlist.amountchangedpattern import AmountChangedPattern
class AmountChangedPatternTest(unittest.TestCase):
# A quick note about the diff file structure.
# The first column indicated the old line n... |
# -*- coding: utf-8 -*-
from numpy import * # importation du module numpy
from numpy.linalg import * # importation du module numpy.linalg
from numpy.random import *
from matplotlib.pyplot import *
from mpl_toolkits.mplot3d import Axes3D
#Calcul l'erreur en faisant varier Ns
def Ud(x):
y = sin(2*pi*x)*sinh(2*pi)
... |
from openerp import models, fields, api, _
# Erweitert account.invoice
class eq_account_invoice(models.Model):
_inherit = 'account.invoice'
document_template_id = fields.Many2one(comodel_name='eq.document.template', string='Document Template')#TODO: readonly falls Rechnung nicht mehr editierbar?
commen... |
"""
Support for Unifi WAP controllers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.unifi/
"""
import logging
import urllib
from homeassistant.components.device_tracker import DOMAIN
from homeassistant.const import CONF_HOST, CONF_USERN... |
import PyPfw
import EddParser
from PfwBaseTranslator import PfwBaseTranslator, PfwException
import hostConfig
import argparse
import re
import sys
import tempfile
import os
import logging
def wrap_pfw_error_semantic(func):
def wrapped(*args, **kwargs):
ok, error = func(*args, **kwargs)
if not ok:
... |
from __future__ import absolute_import
try:
from corehq.apps.app_manager.tests.test_app_manager import *
from corehq.apps.app_manager.tests.test_xml_parsing import *
from corehq.apps.app_manager.tests.test_xform_parsing import *
from corehq.apps.app_manager.tests.test_form_versioning import *
from ... |
"""Description of YANG & YIN syntax."""
import re
### Regular expressions - constraints on arguments
# keywords and identifiers
identifier = r"[_A-Za-z][._\-A-Za-z0-9]*"
prefix = identifier
keyword = '((' + prefix + '):)?(' + identifier + ')'
comment = '(/\*([^*]|[\r\n\s]|(\*+([^*/]|[\r\n\s])))*\*+/)|(//.*)|(/\*.*)'... |
from common import NoRepo, MissingTool, SKIPREV, mapfile
from cvs import convert_cvs
from darcs import darcs_source
from git import convert_git
from hg import mercurial_source, mercurial_sink
from subversion import svn_source, svn_sink
from monotone import monotone_source
from gnuarch import gnuarch_source
from bzr imp... |
"""Common functions for MongoDB and DB2 backends
"""
from oslo_log import log
import pymongo
from ceilometer.event.storage import base
from ceilometer.event.storage import models
from ceilometer.i18n import _LE, _LI
from ceilometer.storage.mongo import utils as pymongo_utils
from ceilometer import utils
LOG = log.get... |
import socket
import sys
import math
def bytes_needed(n):
if type(n) is str:
return len(n)
elif type(n) is list:
if type(n[0]) is int:
return 4 * len(n)
if n == 0:
return 1
return int(math.log(n, 256)) + 1
class Communication:
def __init__(self, address, port):... |
from __future__ import unicode_literals
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = 'j. F Y H:i'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.m.Y'
SHORT_DATETIME_FORMAT = 'd.m.Y H:i'
FIRST_DAY_OF_WEEK = 1 # Monday
# The *_INPUT_FORMATS strings use the Python strftime fo... |
import os
from django.db import models
from tagging.managers import ModelTaggedItemManager
from tagging.models import Tag
if os.environ.get('READTHEDOCS'):
TagField = lambda *args, **kwargs: None
else:
from tagging.fields import TagField
class Event(models.Model):
when = models.DateTimeField()
what =... |
"""Deal with pyface backend issues."""
#
# License: BSD (3-clause)
import os
import sys
from ..utils import warn, _check_pyqt5_version
def _get_pyface_backend():
"""Check the currently selected Pyface backend.
Returns
-------
backend : str
Name of the backend.
result : 0 | 1 | 2
... |
from neutron_lib.plugins.ml2 import api
from oslo_log import log as logging
from neutron.core_extensions import base as base_core
from neutron.core_extensions import qos as qos_core
LOG = logging.getLogger(__name__)
QOS_EXT_DRIVER_ALIAS = 'qos'
class QosExtensionDriver(api.ExtensionDriver):
def initialize(sel... |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_array_almost_equal, run_module_suite
import scipy.ndimage as ndimage
def test_byte_order_median():
"""Regression test for #413: median_filter does not handle bytes orders."""
a = np.arange(9,... |
"""
=========================================
Nested versus non-nested cross-validation
=========================================
This example compares non-nested and nested cross-validation strategies on a
classifier of the iris data set. Nested cross-validation (CV) is often used to
train a model in which hyperparam... |
# -*- coding: utf-8 -*-
'''
Specto Add-on
Copyright (C) 2015 lambda
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 l... |
import time
from lxml import etree
from openerp.osv import fields, osv
from openerp.osv.orm import setup_modifiers
from openerp.tools.translate import _
class account_common_report(osv.osv_memory):
_name = "account.common.report"
_description = "Account Common Report"
def onchange_chart_id(self, cr, uid,... |
"""Exceptions related to config parsing."""
import typing
import attr
from qutebrowser.utils import jinja, usertypes
class Error(Exception):
"""Base exception for config-related errors."""
class NoAutoconfigError(Error):
"""Raised when this option can't be set in autoconfig.yml."""
def __init__(sel... |
import json
from moto.core.responses import BaseResponse
from .models import config_backends
class ConfigResponse(BaseResponse):
@property
def config_backend(self):
return config_backends[self.region]
def put_configuration_recorder(self):
self.config_backend.put_configuration_recorder(se... |
from django import forms
from django.forms.widgets import HiddenInput
from crits.core import form_consts
from crits.core.handlers import get_source_names
from crits.core.user_tools import get_user_organization
class AddScreenshotForm(forms.Form):
"""
Django form for adding an Object.
"""
error_css_cla... |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-bitcoinrpc"))
import json
import shutil
import subprocess
import tempfile
import traceback
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from util import *
def run_test(nodes):
# Replace t... |
"""
Invenio hash functions.
Usage example:
>>> from invenio_utils.hash import md5
>>> print md5('MyPa$$')
Simplifies imports of hash functions depending on Python version.
"""
try:
from hashlib import sha256, sha1, md5
HASHLIB_IMPORTED = True
except ImportError:
from md5 import md5
from sha impor... |
import re
import datetime
import traceback
from . import generic
from sickbeard import logger, tvcache, helpers
from sickbeard.bs4_parser import BS4Parser
from lib.unidecode import unidecode
class TorrentLeechProvider(generic.TorrentProvider):
def __init__(self):
generic.TorrentProvider.__init__(self, '... |
"""The base interface of RPC Framework.
Implementations of this interface support the conduct of "operations":
exchanges between two distinct ends of an arbitrary number of data payloads
and metadata such as a name for the operation, initial and terminal metadata
in each direction, and flow control. These operations m... |
#!/usr/bin/env python3
import re
import importlib
import sqlite3
import sys
def parse_tollens(part):
keys = list(part.keys());
for key in keys:
if(key[-2:] == '_l' and
key[:-2] + '_h' in part):
part[key[:-2]] = TolLen(float(part[key[:-2] + '_l']), float(part[key[:-2] + '_h']))
part.pop(key[:-2] + '_l')... |
"""Test for directx_9_0_c. These are MEDIUM tests."""
import TestFramework
def TestSConstruct(scons_globals):
"""Test SConstruct file.
Args:
scons_globals: Global variables dict from the SConscript file.
"""
# Get globals from SCons
Environment = scons_globals['Environment']
env = Environment(tool... |
#coding=utf-8
# This module implement prefork model, used for spawn and manage child process
import os
import sys
import time
import errno
import signal
import random
import select
import traceback
from in_trip.lib.pidfile import Pidfile
from in_trip.lib.config import Config
from in_trip.lib.errors import HaltServer... |
"""
Utility functions for working with images.
"""
import logging
import numpy as np
plt = None
axes = None
from theano.compat.six.moves import xrange
from theano.compat.six import string_types
import warnings
try:
import matplotlib.pyplot as plt
import matplotlib.axes
except (RuntimeError, ImportError, TypeErr... |
"""
AMF Remoting support.
A Remoting request from the client consists of a short preamble, headers, and
bodies. The preamble contains basic information about the nature of the
request. Headers can be used to request debugging information, send
authentication info, tag transactions, etc. Bodies contain actual Remoting
... |
# -*- coding: utf-8 -*-
from cms.cache.permissions import clear_user_permission_cache
from cms.models import PageUser, PageUserGroup
from menus.menu_pool import menu_pool
def post_save_user(instance, raw, created, **kwargs):
"""Signal called when new user is created, required only when CMS_PERMISSION.
Assign... |
{
'name': 'Project Management',
'version': '1.1',
'author': 'OpenERP SA',
'website': 'https://www.odoo.com/page/project-management',
'category': 'Project Management',
'sequence': 8,
'summary': 'Projects, Tasks',
'depends': [
'base_setup',
'product',
'analytic',
... |
"""Get stats for estimating keyword search on files."""
import os
import re
import unicodedata
from optparse import OptionParser
import psycopg2
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
def get_keywords_from_path(volume_path):
"""Split keywords from a volume path."""
# we do not inde... |
from openerp.osv import osv, fields
from openerp.addons.edi import EDIMixin
from werkzeug import url_encode
INVOICE_LINE_EDI_STRUCT = {
'name': True,
'origin': True,
'uos_id': True,
'product_id': True,
'price_unit': True,
'quantity': True,
'discount': True,
# fields used for web previ... |
"""
.. module:: knotvector
:platform: Unix, Windows
:synopsis: Provides utility functions related to knot vector generation and validation
.. moduleauthor:: Onur Rauf Bingol <<EMAIL>>
"""
from collections import defaultdict
import numpy as np
def generate(degree, num_ctrlpts, clamped=True):
""" Generate... |
"""
raven.transport.base
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
class Transport(object):
"""
All transport implementations need to subclass this class
You mus... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.UserList.as_view(), name=views.UserList.view_name),
url(r'^(?P<user_id>\w+)/$', views.UserDetail.as_view(), name=views.UserDetail.view_name),
url(r'^(?P<user_id>\w+)/addons/$', views.UserAddonList.as_view(), name=views.U... |
from gi.repository import Gtk
from . import add_css
class MenuButton(Gtk.MenuButton):
"""TODO: remove. This used to be an implementation of Gtk.MenuButton
when it wasn't available in gtk+
"""
def __init__(self, widget=None, arrow=False, down=True):
super(MenuButton, self).__init__()
... |
"""Tests for Wishart."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from scipy import linalg
from tensorflow.contrib import distributions as distributions_lib
from tensorflow.python.framework import dtypes
from tensorflow.python.fram... |
import numpy as np
from system.take_snapshot import take_snapshot
from copy import deepcopy
def within_energized(ps, island_1, bus_ids, spad_lim):
# Take preliminary snapshot of the system
state_list, island_list = take_snapshot(ps, 'Preliminary state', [], [])
# Set opf constraint to SPA diff
# Mak... |
"""Utilities to get a password and/or the current user name.
getpass(prompt[, stream]) - Prompt for a password, with echo turned off.
getuser() - Get the user name from the environment or password database.
GetPassWarning - This UserWarning is issued when getpass() cannot prevent
echoing of the... |
"""Internal support module for sre"""
import _sre, sys
import sre_parse
from sre_constants import *
assert _sre.MAGIC == MAGIC, "SRE module mismatch"
if _sre.CODESIZE == 2:
MAXCODE = 65535
else:
MAXCODE = 0xFFFFFFFFL
def _identityfunction(x):
return x
_LITERAL_CODES = set([LITERAL, NOT_LITERAL])
_REPEA... |
from __future__ import absolute_import
import logging
import os
import warnings
from raven.utils.compat import PY2, text_type
from raven.exceptions import InvalidDsn
from raven.utils.encoding import to_string
from raven.utils.urlparse import parse_qsl, urlparse
ERR_UNKNOWN_SCHEME = 'Unsupported Sentry DSN scheme: {0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.