content stringlengths 4 20k |
|---|
#! /usr/bin/env python
"""
Code is modified (fairly heavily) by <EMAIL> from
https://gist.github.com/MicahElliott/719710
Convert values between RGB tuples and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resour... |
"""
Wheel command-line utility.
"""
import os
import hashlib
import sys
import json
from glob import iglob
from .. import signatures
from ..util import (urlsafe_b64decode, urlsafe_b64encode, native, binary,
matches_requirement)
from ..install import WheelFile, VerifyingZipFile
from ..paths import ... |
from twisted.trial import unittest
from bridgedb import bridgerequest
from bridgedb.bridgerequest import IRequestBridges
from bridgedb.bridgerequest import BridgeRequestBase
class BridgeRequestBaseTests(unittest.TestCase):
"""Unittests for :class:`bridgedb.bridgerequest.BridgeRequestBase`."""
def setUp(self... |
"""Tests for tensorflow.python.framework.function_def_to_graph."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.eager import function
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtype... |
#!/usr/bin/python
import re
import os
import sys
debug = True
lines = sys.stdin.readlines()
lemma = sys.argv[1]
# INPUT:
# - lines contain a list of "%i:goal" where "%i" is the index of the goal
# - lemma contain the name of the lemma under scrutiny
# OUTPUT:
# - (on stdout) a list of ordered index separated by EOL
... |
import logging
from lxml import etree
from pkg_resources import resource_string
from xmodule.raw_module import RawDescriptor
from .x_module import XModule
from xblock.core import Integer, Scope, String, List, Float, Boolean
from xmodule.open_ended_grading_classes.combined_open_ended_modulev1 import CombinedOpenEndedV... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class mrp_config_settings(osv.osv_memory):
_name = 'mrp.config.settings'
_inherit = 'res.config.settings'
_columns = {
'group_product_variant': fields.selection([
(0, "No variants on products"),
(1, '... |
"""Tests for tensorflow.ops.linalg_ops.self_adjoint_eig."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes as dtypes_lib
from tensorflow.... |
import unittest
from scrapy.contrib.downloadermiddleware.ajaxcrawl import AjaxCrawlMiddleware
from scrapy.spider import Spider
from scrapy.http import Request, HtmlResponse, Response
from scrapy.utils.test import get_crawler
__doctests__ = ['scrapy.contrib.downloadermiddleware.ajaxcrawl']
class AjaxCrawlMiddlewareTe... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 16 09:16:56 2015
@author: adelpret
"""
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import numpy as np
DEFAULT_FONT_SIZE = 40;
DEFAULT_AXIS_FONT_SIZE = DEFAULT_FONT_SIZE;
DEFAULT_LINE_WIDTH = 8; #13;
DEFAULT_MARKER_SIZE = 6;... |
"""ndarray print format controller."""
import numpy as onp
from ..util import set_module
__all__ = ['set_printoptions']
@set_module('mxnet.numpy')
def set_printoptions(precision=None, threshold=None, **kwarg):
"""
Set printing options.
These options determine the way floating point numbers and arrays ... |
"""
Very basic field: raw content with a size in byte. Use this class for
unknown content.
"""
from hachoir_core.field import Field, FieldError
from hachoir_core.tools import makePrintable
from hachoir_core.bits import str2hex
from hachoir_core import config
MAX_LENGTH = (2**64)
class RawBytes(Field):
"""
By... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleParserError, AnsibleError
from ansible.module_utils.six import iteritems, string_types
from ansible.module_utils._text import to_text
from ansible.parsing.splitter import parse_kv, split_args
from ... |
import sys
sys.path.append('/home/jwalker/dynamics/python/atmos-tools')
sys.path.append('/home/jwalker/dynamics/python/atmos-read')
import os
import numpy as np
import merra
import atmos as atm
# ----------------------------------------------------------------------
# Save single pressure-level daily data for each mo... |
from __future__ import unicode_literals
import json
import os.path
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_iso8601,
)
class VultureIE(InfoExtractor):
IE_NAME = 'vulture.com'
_VALID_URL = r'https?://video\.vulture\.com/video/(?P<display_id>[^/]+)/'
_TE... |
"""
Directives for document parts.
"""
__docformat__ = 'reStructuredText'
from docutils import nodes, languages
from docutils.transforms import parts
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives
class Contents(Directive):
"""
Table of contents.
The table of co... |
# -*- coding: utf-8 -*-
"""!map <place> return a map of place. Optional "zoom" and "maptype" parameters are accepted."""
# example queries:
# !map new york city
# !map united states zoom=4
# !map united states zoom=4 maptype=satellite
try:
from urllib import quote
except ImportError:
from urllib.request import... |
# -*- coding: utf-8 -*-
from openerp import models, fields, _, api
import openerp.addons.decimal_precision as dp
import logging
from openerp.exceptions import Warning
_logger = logging.getLogger(__name__)
class account_voucher(models.Model):
_inherit = 'account.voucher'
received_third_check_ids = fields.One... |
"""SCons.Tool.Perforce.py
Tool-specific initialization for Perforce Source Code Management system.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 20... |
import numpy
from numpy.testing import assert_array_almost_equal
import pytest
from sklearn.base import BaseEstimator
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score, roc_auc_score
from sklearn.svm import SVC
from sklearn.tree import ... |
"""
Copyright (c) 2016 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import os
import re
from atomic_reactor.plugin import PostBuildPlugin
from atomic_reactor.constants import INSPECT_CONFIG, TAG_NAME_REGEX
fr... |
import urllib
import re
from xml.dom.minidom import parseString
import sickbeard
import generic
from sickbeard.common import Quality
from sickbeard import logger
from sickbeard import tvcache
from sickbeard.helpers import sanitizeSceneName, get_xml_text
from sickbeard.exceptions import ex
class EZRSSPro... |
"""Registry for layers and their parameters/variables.
This represents the collection of all layers in the approximate Fisher
information matrix to which a particular FisherBlock may belong. That is, we
might have several layer collections for one TF graph (if we have multiple K-FAC
optimizers being used, for example.... |
#!/usr/bin/env python
"""
ntlogon.py written by Timothy (rhacer) Grant
Copyright 1999 - 2002 by Timothy Grant
is distributed under the terms of the GNU Public License.
The format for the configuration file is as follows:
While there is some room for confusion, we attempt to process things in
order of specificity: ... |
"""Tests for list_pager."""
import unittest
from apitools.base.py import list_pager
from apitools.base.py.testing import mock
from samples.fusiontables_sample.fusiontables_v1 \
import fusiontables_v1_client as fusiontables
from samples.fusiontables_sample.fusiontables_v1 \
import fusiontables_v1_messages as m... |
from unittest import TestCase
from django.template.loader import get_template_from_string
from django.template import VariableNode
class NodelistTest(TestCase):
def test_for(self):
source = '{% for i in 1 %}{{ a }}{% endfor %}'
template = get_template_from_string(source)
vars = template.n... |
# -*- coding: utf-8 -*-
"""
flask.testsuite.config
~~~~~~~~~~~~~~~~~~~~~~
Configuration and instances.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
import flask
import pkgutil
import unittest
from contextlib import contextmanager
fr... |
from __future__ import absolute_import
import functools
import requests
from twisted.internet.threads import deferToThread
from twisted.internet.defer import CancelledError
from twisted.web.resource import Resource
from twisted.web.server import NOT_DONE_YET
from PyQt4.QtNetwork import QNetworkRequest
from .ferry im... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.errors import AnsibleError
from ansible.plugins import AnsiblePlugin
from ansible.plugins.lookup import LookupBase
from ansible.module_utils._text import to_native
try:
from azure.common.credentials import Service... |
import b2.build.property as property
import b2.build.property_set as property_set
import b2.build.targets
from b2.manager import get_manager
from b2.util.sequence import unique
from b2.util import bjam_signature, value_to_jam
import bjam
import os
__width = 30
def set_width(width):
global __width
__width =... |
from ansible import utils, errors
import os
import codecs
class LookupModule(object):
def __init__(self, basedir=None, **kwargs):
self.basedir = basedir
def run(self, terms, inject=None, **kwargs):
terms = utils.listify_lookup_plugin_terms(terms, self.basedir, inject)
ret = []
... |
"""
selective.py callback plugin.
This callback only prints tasks that have been tagged with `print_action` or that have failed.
Tasks that are not printed are placed with a '.'.
For example:
- debug: msg="This will not be printed"
- debug: msg="But this will"
tags: [print_action]"
This allows operators to focus ... |
"""
iRMC Management Driver
"""
from oslo_log import log as logging
from oslo_utils import importutils
from ironic.common import boot_devices
from ironic.common import exception
from ironic.common.i18n import _
from ironic.common.i18n import _LE
from ironic.conductor import task_manager
from ironic.drivers.modules imp... |
from openerp.osv import osv
class account_unreconcile(osv.osv_memory):
_name = "account.unreconcile"
_description = "Account Unreconcile"
def trans_unrec(self, cr, uid, ids, context=None):
obj_move_line = self.pool.get('account.move.line')
if context is None:
context = {}
... |
"""
Functions for computing minimal sufficient statistics.
"""
from collections import defaultdict
from .lattice import dist_from_induced_sigalg, insert_join, insert_rv
from .prune_expand import pruned_samplespace
from ..helpers import flatten, parse_rvs, normalize_rvs
from ..math import sigma_algebra
from ..samplesp... |
import os
class RabbitMqPlugins(object):
def __init__(self, module):
self.module = module
if module.params['prefix']:
if os.path.isdir(os.path.join(module.params['prefix'], 'bin')):
bin_path = os.path.join(module.params['prefix'], 'bin')
elif os.path.isdir(o... |
#!/usr/bin/env python
"""
Script to fully automate the release process. Requires Python 2.6+
with sphinx installed and the 'hg' command on the path.
"""
from __future__ import print_function
import subprocess
import shutil
import os
import sys
import urllib2
import getpass
import collections
try:
import keyring
ex... |
#!/usr/bin/env python
# Capstone Python bindings, by Nguyen Anh Quynnh <<EMAIL>>
from __future__ import print_function
from capstone import *
import binascii
from xprint import to_hex
X86_CODE16 = b"\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00"
X86_CODE32 = b"\x8d\x4c\x32\x08\x01\xd8\x81\xc6\x34\x12\x00\x00"
X86... |
import urllib, urllib2,xml.dom.minidom
from xml.dom.minidom import parseString
import sickbeard
import telnetlib
import re
import time
from sickbeard import logger
try:
import xml.etree.cElementTree as etree
except ImportError:
import xml.etree.ElementTree as etree
class NMJv2Notifier:
... |
"""
Tests for implementations of L{IReactorThreads}.
"""
__metaclass__ = type
from weakref import ref
import gc
from twisted.internet.test.reactormixins import ReactorBuilder
from twisted.python.threadpool import ThreadPool
class ThreadTestsBuilder(ReactorBuilder):
"""
Builder for defining tests relating t... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 6 11:53:27 2015
@author: http://www.cs.toronto.edu/~rdanek/csc148h_09/lectures/8/bst.py
"""
class BinarySearchTree:
def __init__(self):
""" create an empty binary search tree """
self.root = None
def put(self, key, value):
""" ad... |
from ctypes import byref, c_double
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope
from django.contrib.gis.gdal.error import (
GDALException, OGRIndexError, SRSException,
)
from django.contrib.gis.gdal.feature import Feature
from django.contrib.g... |
#Basketball
import bs
import bsUtils
import math
import random
# This game is played with the same rules as the classic American sport, Bombsquad style!
# Featuring: a hoop, fouls, foul shots, jump-balls, three-pointers, a referee, and two teams ready to duke it out.
# Dedicated to - David
def bsGetAPIVersi... |
"""Runs unit and integrations tests on the library."""
import platform
import sys
import build
import gendeps
import shakaBuildHelpers
def run_tests_single(args):
"""Runs all the karma tests."""
# Update node modules if needed.
if not shakaBuildHelpers.update_node_modules():
return 1
# Generate depende... |
from __future__ import absolute_import
from django.db.models import signals
from django.dispatch import receiver
from django.test import TestCase
from django.utils import six
from .models import Person, Car
# #8285: signals can be any callable
class PostDeleteHandler(object):
def __init__(self, data):
s... |
import unittest
from contextlib import contextmanager
from django.core.exceptions import ImproperlyConfigured
from django.db import connection
from django.test import TestCase, override_settings
@contextmanager
def get_connection():
new_connection = connection.copy()
yield new_connection
new_connection.c... |
from oscar.core.loading import is_model_registered
from oscar.apps.offer.results import (
BasketDiscount, ShippingDiscount, PostOrderAction,
SHIPPING_DISCOUNT, ZERO_DISCOUNT)
from oscar.apps.offer.abstract_models import (
AbstractBenefit, AbstractCondition, AbstractConditionalOffer,
AbstractRange, Abstr... |
"""
Verifies that msvs_external_builder being set will invoke the provided
msvs_external_builder_build_cmd and msvs_external_builder_clean_cmd, and will
not invoke MSBuild actions and rules.
"""
import os
import sys
import TestGyp
if int(os.environ.get('GYP_MSVS_VERSION', 0)) < 2010:
sys.exit(0)
test = TestGyp.Tes... |
# -*- Python -*-
__version__ = '$Revision: 1.3 $'[11:-2]
from twisted.trial import unittest
from twisted.protocols import htb
class DummyClock:
time = 0
def set(self, when):
self.time = when
def __call__(self):
return self.time
class SomeBucket(htb.Bucket):
maxburst = 100
rate =... |
"""This module is responsible for setting up PSD-related jobs in workflows.
"""
from six.moves import range
from pycbc.workflow.core import FileList, make_analysis_dir, Executable, File
from pycbc.workflow.core import SegFile
from ligo.segments import segmentlist
class CalcPSDExecutable(Executable):
current_reten... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
'''
Compat six library. RHEL7 has python-six 1.3.0 which is too old
'''
# The following makes it easier for us to script updates of the bundled code
_BUNDLED_METADATA = { "pypi_name": "six", "version": "1.10.0" }
import os.path
... |
"""
Tests for groups
"""
import httpretty
from ddt import ddt, data
from django.conf import settings
from django.core.urlresolvers import reverse
from courseware.tests.factories import UserFactory
from ..test_utils import SocialFacebookTestCase
@ddt
class TestGroups(SocialFacebookTestCase):
"""
Tests for /ap... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.vars import BaseVarsPlugin
class VarsModule(BaseVarsPlugin):
REQUIRES_WHITELIST = True
def get_vars(self, loader, path, entities, cache=True):
super(VarsModule, self).get_vars(loader, path, ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import unittest
from unittest import skipUnless
from django.conf import settings
from django.contrib.gis.geoip2 import HAS_GEOIP2
from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry
from django.utils import six
if HAS_GEOIP2:
from d... |
"""Middleware for embargoing site and courses.
IMPORTANT NOTE: This code WILL NOT WORK if you have a misconfigured proxy
server. If you are configuring embargo functionality, or if you are
experiencing mysterious problems with embargoing, please check that your
reverse proxy is setting any of the well known client IP... |
#!/usr/bin/python
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email import utils
import email, random, os, time, datetime, socket, email.mime.application, string
''' This file is meant to build the appropriate parts of the phishing me... |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <<EMAIL>>'
__docformat__ = 'restructuredtext en'
import sys, os
from calibre import prints as prints_, preferred_encoding, isbytestring
from calibre.utils.config import Config, ConfigP... |
from django.contrib.auth import get_user, get_user_model
from django.contrib.auth.models import AnonymousUser, User
from django.core.exceptions import ImproperlyConfigured
from django.db import IntegrityError
from django.http import HttpRequest
from django.test import TestCase, override_settings
from django.utils impor... |
from __future__ import unicode_literals
from django.db import models
import six
class StaticModelFieldMixin(object):
def __init__(self, *args, **kwargs):
self._static_model = kwargs.pop('static_model', None)
assert self._static_model, 'static_model required'
self._value_field_name = kwa... |
"""
Access to external loggers at ISIS
"""
from __future__ import print_function, absolute_import, division, unicode_literals
# This file is part of the ISIS IBEX application.
# Copyright (C) 2012-2016 Science & Technology Facilities Council.
# All rights reserved.
#
# This program is distributed in the hope that it w... |
from __future__ import absolute_import
from ..packages.six.moves import http_client as httplib
from ..exceptions import HeaderParsingError
def is_fp_closed(obj):
"""
Checks whether a given file-like object is closed.
:param obj:
The file-like object to check.
"""
try:
# Check `i... |
from os.path import abspath, join, dirname
from pyvows import Vows, expect
from thumbor.context import Context
from thumbor.config import Config
from thumbor.loaders.file_loader import load
STORAGE_PATH = abspath(join(dirname(__file__), 'fixtures/'))
@Vows.batch
class FileLoaderVows(Vows.Context):
def topic(... |
from msrest.serialization import Model
class CreateJobProperties(Model):
"""The common Data Lake Analytics job properties for job submission.
You probably want to use the sub-classes and not this class directly. Known
sub-classes are: CreateUSqlJobProperties, CreateScopeJobProperties
All required pa... |
#coding:utf-8
# Define no-op plugin methods
def preBuildPage(page, context, data):
"""
Called prior to building a page.
:param page: The page about to be built
:param context: The context for this page (you can modify this, but you must return it)
:param data: The raw body for this page (you can m... |
import os
_proc_status = '/proc/%d/status' % os.getpid()
_scale = {'kB': 1024.0, 'mB': 1024.0*1024.0,
'KB': 1024.0, 'MB': 1024.0*1024.0}
def _VmB(VmKey):
'''Private.
'''
global _proc_status, _scale
# get pseudo file /proc/<pid>/status
try:
t = open(_proc_status)
v = t.r... |
# Multiprocessing module for Happy Eyeballs
# Method on high level: start a Process for each IP address (adding a delay for IPv4 addresses), connect &
# find the quickest response, report that and terminate() all other processes that might still be running.
import time, socket
from multiprocessing import Process, Que... |
from sympy import (Symbol, exp, Integer, Float, sin, cos, log, Poly, Lambda,
Function, I, S, sqrt, srepr, Rational, Tuple, Matrix, Interval, Add, Mul,
Pow, Or, true, false, Abs, pi)
from sympy.abc import x, y
from sympy.core.sympify import sympify, _sympify, SympifyError, kernS
from sympy.core.decorators import... |
"""
tests.test_component_history
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests the history component.
"""
# pylint: disable=protected-access,too-many-public-methods
from datetime import timedelta
import os
import unittest
from unittest.mock import patch
import homeassistant.core as ha
import homeassistant.util.dt as dt_util
fro... |
import io
import os
import setuptools
# Package metadata.
name = "google-cloud-videointelligence"
description = "Google Cloud Video Intelligence API client library"
version = "1.12.0"
# Should be one of:
# 'Development Status :: 3 - Alpha'
# 'Development Status :: 4 - Beta'
# 'Development Status :: 5 - Production/S... |
import base64
from openerp.addons.mail.tests.common import TestMail
from openerp.tools import mute_logger
class test_message_compose(TestMail):
def setUp(self):
super(test_message_compose, self).setUp()
# create a 'pigs' and 'bird' groups that will be used through the various tests
self.... |
from datetime import datetime
import colorsys
import os.path
from timelinelib.calendar.gregorian import Gregorian
from timelinelib.data.db import MemoryDB
from timelinelib.data import Category
from timelinelib.data import Event
from timelinelib.db.exceptions import TimelineIOError
def import_db_from_dir(path):
d... |
# -*- coding: utf-8 -*-
"""
flask._compat
~~~~~~~~~~~~~
Some py2/py3 compatibility support based on a stripped down
version of six so we don't have to depend on a specific version
of it.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import sys
PY... |
import logging
from openerp import models, fields, api
logger = logging.getLogger('credit.control.line.mailing')
class CreditCommunication(models.TransientModel):
"""Shell class used to provide a base model to email template and reporting
Il use this approche in version 7 a browse record
will exist even ... |
"""Tests for tensorflow.ops.reverse_sequence_op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.python.framework import constant_op
from tensorflow.pyt... |
import glob
import os
import sys
import ah_bootstrap
from setuptools import setup
#A dirty hack to get around some early import/configurations ambiguities
if sys.version_info[0] >= 3:
import builtins
else:
import __builtin__ as builtins
builtins._ASTROPY_SETUP_ = True
from astropy_helpers.setup_helpers impor... |
"""
Django settings for biblio project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... |
import collections
import weakref
from . import math
from ._SDL import *
from ._GL import *
from ._Window import *
UserQuitEvent = collections.namedtuple("UserQuitEvent", [])
ResizeEvent = collections.namedtuple("ResizeEvent", ["window", "new_size"])
KeyPressEvent = collections.namedtuple("KeyPressEvent", ["window", ... |
import unittest
from mock import patch
from tests.tools import create_mock_json
from twilio.rest.resources.monitor.alerts import Alerts
AUTH = ("AC123", "token")
BASE_URI = "https://monitor.twilio.com/v1"
EVENT_SID = "NOaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
class AlertTest(unittest.TestCase):
@patch('twilio.rest.... |
# coding: utf-8
from __future__ import unicode_literals
import json
import random
from .common import InfoExtractor
from ..compat import (
compat_str,
)
from ..utils import (
ExtractorError,
)
class EightTracksIE(InfoExtractor):
IE_NAME = '8tracks'
_VALID_URL = r'https?://8tracks\.com/(?P<user>[^/]+... |
from .. import util
from . import util as import_util
from importlib import machinery
import sys
import types
import unittest
PKG_NAME = 'fine'
SUBMOD_NAME = 'fine.bogus'
class BadSpecFinderLoader:
@classmethod
def find_spec(cls, fullname, path=None, target=None):
if fullname == SUBMOD_NAME:
... |
# -*- coding: utf-8 -*-
from openerp.osv import orm, fields
class test_converter(orm.Model):
_name = 'web_editor.converter.test'
# disable translation export for those brilliant field labels and values
_translate = False
_columns = {
'char': fields.char(),
'integer': fields.integer()... |
import sys, os
from optparse import OptionParser
from androguard.core import androconf
from androguard.core.bytecodes import apk
from androguard.core.analysis import risk
option_0 = { 'name' : ('-i', '--input'), 'help' : 'file : use these filenames', 'nargs' : 1 }
option_1 = { 'name' : ('-m', '--method'), 'help' : '... |
# -*- coding: utf-8 -*-
__license__ = 'GPL 3'
__copyright__ = '2009, John Schember <<EMAIL>>'
__docformat__ = 'restructuredtext en'
from calibre.utils.config_base import Config, ConfigProxy
class DeviceConfig(object):
HELP_MESSAGE = _('Configure Device')
#: Can be None, a string or a list of strings. When... |
from SipGenericHF import SipGenericHF
class SipContentType(SipGenericHF):
hf_names = ('content-type', 'c')
def __init__(self, body):
SipGenericHF.__init__(self, body)
self.parsed = True
def getCanName(self, name, compact = False):
if compact:
return 'c'
return ... |
#!/usr/bin/env python
import saml2
from saml2 import SamlBase
from xmldsig import X509Data
NAMESPACE = 'urn:net:eustix:names:tc:PEFIM:0.0:assertion'
class SPCertEncType_(SamlBase):
"""The urn:net:eustix:names:tc:PEFIM:0.0:assertion:SPCertEncType element """
c_tag = 'SPCertEncType'
c_namespace = NAMESPA... |
import ConfigParser
import getopt
import logging
import sys
from pycsw import admin, config
logging.basicConfig(format='%(message)s', level=logging.DEBUG)
CONTEXT = config.StaticContext()
def usage():
"""Provide usage instructions"""
return '''
NAME
pycsw-admin.py - pycsw admin utility
SYNOPSIS
py... |
import PositionWeightMatrix as PWM
import math
import random
import multiprocessing
import itertools
from collections import Counter
class PositionWeightMatrix( PWM.PositionWeightMatrix ):
def __init__(self,scores,alphabet):
super( PositionWeightMatrix, self ).__init__(scores)
self._alphabet = alphabet
def _... |
from osv import osv, fields
import decimal_precision as dp
import time
class invoice_cost_breakdown(osv.osv_memory):
"""
This wizard breaks down the cost of the selected transport and custom
invoices to purchase invoices.
"""
_name = "invoice.cost.breakdown"
_rec_name = "id"
_description ... |
class Kind(object):
def __init__(self, spec=None):
self.spec = spec
self.parent_kind = None
class ReferenceKind(Kind):
"""ReferenceKind represents pointer types and handle types.
A type is nullable means that NULL (for pointer types) or invalid handle
(for handle types) is a legal value for the ... |
#!/usr/bin/env python
__author__ = 'Alan Viars @aviars'
import jwt
import sys
from cryptography.x509 import load_pem_x509_certificate, OID_COMMON_NAME
from cryptography.hazmat.backends import default_backend
from collections import OrderedDict
def verify_poet(jws, public_key_string):
python_version = sys.version_i... |
"""
The GeometryColumns and SpatialRefSys models for the PostGIS backend.
"""
from django.db import models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class GeometryColumns(models.Model):
"""
The ... |
from modularodm.exceptions import ValidationValueError
def copy_files(src, target_node, parent=None, name=None):
"""Copy the files from src to the target node
:param Folder src: The source to copy children from
:param Node target_node: The node settings of the project to copy files to
:param Folder pa... |
from sys import exit
def first_room():
# first_room - 3 choices leading to exit or back to the main room.
print "You step through the door into a well lit room."
print "There is a large ticking bomb on a table in front of you."
print "There is a multitool next to the bomb."
print "You can cut the red wire, t... |
"""
Flexx has a command line interface to perform some simple tasks.
Invoke it via ``python -m flexx``. Additional command line arguments
can be provided to configure Flexx, see
:func:`configuring flexx <flexx.config>`.
.. code-block:: none
"""
import sys
ALIASES = {'-h': 'help', '--help': 'help',
'--ver... |
"""
Postgresql extensions
"""
# from psycopg2 documentation
import datetime
import logging # pylint: disable=W0611
import psycopg2
import psycopg2.extensions
class LoggingCursor(psycopg2.extensions.cursor):
"""
Use for cursor that logs all queries
"""
def execute(self, sql, args=None):
""... |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "geonode.settings")
# This application object is used by the development server
# as well as any WSGI server configured to use this file.
application = get_wsgi_application() |
import random
import cmath
from gnuradio import gr, gr_unittest, filter, digital, blocks
class test_pfb_clock_sync(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
def tearDown(self):
self.tb = None
def test01(self):
# Test BPSK sync
excess_bw = 0.35
... |
'''
New Integration Test for KVM VM network disconnect and connect check vm status
Notice that there is no MN HA, considering of plug off the net cable, the MN
should not be impacted after none vm have been killed
@author: SyZhao
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__authors__ = 'Bruno Adelé <<EMAIL>>'
__copyright__ = 'Copyright (C) 2013 Bruno Adelé'
__description__ = """A plugins for serialkiller project"""
__license__ = 'GPL'
__version__ = '0.0.2'
from subprocess import *
from skplugins.checker import checker
class process(chec... |
# Auto generated configuration file
# using:
# Revision: 1.20
# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v
# with command line options: step3_diPhotonP10 --conditions auto:upgradePLS3 -n 100 --eventcontent FEVTDEBUGHLT -s RAW2DIGI,L1Reco,RECO --datatier GEN-SIM-RECO --custom... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.