content string |
|---|
from openerp.osv import fields, osv
class product_ul(osv.osv):
_inherit = "product.ul"
_columns = {
'container_id' : fields.many2one('product.product', 'Container Product', domain=[('container_ok','=',True)]),
}
product_ul()
class product_product(osv.Model):
_inherit = 'product.product'
... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Choice.value'
db.alter_column('questionnaire_choice', 'value', self.gf('django.db.models.fields.CharField')(max_l... |
# Typical run:
# C:\home\eric\wrk\scipy\weave\examples>python fibonacci.py
# Recursively computing the first 30 fibonacci numbers:
# speed in python: 4.31599998474
# speed in c: 0.0499999523163
# speed up: 86.32
# Looping to compute the first 30 fibonacci numbers:
# speed in python: 0.000520999908447
# speed in c:... |
#!/usr/bin/env python
"""
Reorder the integer arguments to the commands in a LAMMPS input
file if these arguments violate LAMMPS order requirements.
We have to do this because the moltemplate.sh script will automatically
assign these integers in a way which may violate these restrictions
and the user ... |
import pika
import json
import logging
from collections import defaultdict
from sockjs.tornado.conn import SockJSConnection
from sockjs.tornado import SockJSRouter
from tornado.ioloop import IOLoop
from tornado.web import Application
from uuid import uuid4
from cloudbrain.core.auth import CloudbrainAuth
_LOGGER = l... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
test = TestSCons.TestSCons()
test.run(arguments = '-h')
test.must_contain_all_lines(test.stdout(), ['-h, --help'])
test.run(arguments = '-u -h')
test.must_contain_all_lines(test.stdout(), ['-h, --help'])
test.run(arguments = '-U -h')
te... |
"""Helpers for coverage.py tests."""
import subprocess
def run_command(cmd):
"""Run a command in a sub-process.
Returns the exit status code and the combined stdout and stderr.
"""
proc = subprocess.Popen(
cmd, shell=True,
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stder... |
"""Implementation of JSONDecoder
"""
import re
import sys
import struct
from simplejson.scanner import make_scanner
try:
from simplejson._speedups import scanstring as c_scanstring
except ImportError:
c_scanstring = None
__all__ = ['JSONDecoder']
FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
def _floatconst... |
"""This script is intended for reproducing figure A3 of the Traub et
al 2005 paper. This is a test for spiny stellate cell."""
import numpy as np
import pylab
import moose
from moose import utils
from cells import SpinyStellate
import config
simtime = 500e-3
simdt = 2e-5
plotdt=1e-4
def setup_model(root='/', hsolve... |
"""Custom op used by periodic_resample."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.periodic_resample.python.ops.periodic_resample_op import periodic_resample
from tensorflow.python.util.all_util import remove_undocumented
_al... |
import codecs
import os
from distutils.dir_util import copy_tree
from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand
from django.test.client import Client
from django.template.defaultfilters import slugify
from labels.models import DigitalLabel, Portal
... |
"""
Offsite Spider Middleware
See documentation in docs/topics/spider-middleware.rst
"""
import re
import logging
import warnings
from scrapy import signals
from scrapy.http import Request
from scrapy.utils.httpobj import urlparse_cached
logger = logging.getLogger(__name__)
class OffsiteMiddleware(object):
de... |
"""
Module for debugging mod_python && mod_wsgi applications that run inside
the Apache webserver (or any other webserver). This is a utility module
that makes remote debugging possible and easy.
"""
import warnings
from invenio.utils.deprecation import RemovedInInvenio21Warning
warnings.warn("Remote debugger is goi... |
import six
import sqlalchemy
from keystone import catalog
from keystone.catalog import core
from keystone.common import sql
from keystone import config
from keystone import exception
CONF = config.CONF
class Region(sql.ModelBase, sql.DictBase):
__tablename__ = 'region'
attributes = ['id', 'description', 'p... |
"""
test_zigbee.py
By Paul Malmsten, 2010
<EMAIL>
Tests the XBee ZB (ZigBee) implementation class for API compliance
"""
import unittest
from xbee.zigbee import ZigBee
class TestZigBee(unittest.TestCase):
"""
Tests ZigBee-specific features
"""
def setUp(self):
self.zigbee = ZigBee(None)
... |
from grit.format.policy_templates.writers import xml_formatted_writer
from xml.dom import minidom
from xml.sax import saxutils as xml_escape
def GetWriter(config):
'''Factory method for creating AndroidPolicyWriter objects.
See the constructor of TemplateWriter for description of
arguments.
'''
return Andro... |
"""
Unit test for stub YouTube implementation.
"""
import unittest
import requests
from ..youtube import StubYouTubeService
class StubYouTubeServiceTest(unittest.TestCase):
def setUp(self):
super(StubYouTubeServiceTest, self).setUp()
self.server = StubYouTubeService()
self.url = "http://... |
"""Holds the common resource management messages."""
from __future__ import absolute_import
from abc import ABCMeta
from basicstruct import BasicStruct
import six
def slots_extender(new_slots):
"""Extender decorator to add new slots to the wrapped class.
Arguments:
new_slots (tuple): new slots names... |
SUM_FILE_NAME = "perftest.sum"
# Raw data that went into the report is written here.
# This is the perftest counterpart to gdb.log.
LOG_FILE_NAME = "perftest.log"
class Reporter(object):
"""Base class of reporter to report test results in a certain format.
Subclass, which is specific to a report format, sho... |
"""
This module adds shared support for Web Application Firewall modules
"""
from ansible.module_utils.ec2 import camel_dict_to_snake_dict, AWSRetry
from ansible.module_utils.aws.waiters import get_waiter
try:
import botocore
except ImportError:
pass # caught by imported HAS_BOTO3
MATCH_LOOKUP = {
'byt... |
import pytest
import logging
import json
import jsonpickle
import os.path
import importlib
from fixture.TestBase import BaseClass
from fixture.variables import UserLogin
fixture = None
target = None
@pytest.fixture
def app(request):
global fixture
global target
browser = request.config.getoption('--bro... |
import logging
from heatclient.v1 import resource_types
from heatclient.v1 import resources
from heatclient.v1 import services
from heatclient.v1 import stacks
from openstack_dashboard.test.test_data import utils
# suppress warnings about our use of object comparisons in heatclient
logging.getLogger('heatclient.open... |
def main(j, args, params, tags, tasklet):
params.merge(args)
doc = params.doc
tags = params.tags
params.result = ""
# spaces = sorted(j.core.portal.active.getSpaces())
# spacestxt=""
# for item in spaces:
# if item[0] != "_" and item.strip() != "" and item.find("space_system")==-... |
import time, threading, urllib, urllib2, re
from xml.etree import ElementTree
import lazylibrarian
from lazylibrarian import logger, SimpleCache
def NewzNab(book=None):
HOST = lazylibrarian.NEWZNAB_HOST
results = []
logger.info('Searching for %s.' % book['searchterm'])
if lazylibrarian.EBOOK_TYP... |
"""
Utility methods, ported to Python 3.
"""
from __future__ import division, absolute_import
import sys, warnings
from functools import wraps
from twisted.python.compat import reraise
from twisted.internet import defer
def _resetWarningFilters(passthrough, addedFilters):
for f in addedFilters:
try:
... |
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import messages
from horizon import tables
from horizon import workflows
from openstack_dashboard import api
from openstack_dashboard import policy
from openstack_dashboard... |
import datetime
from operator import attrgetter
from django import forms
from django.core.exceptions import FieldError
from django.test import TestCase, skipUnlessDBFeature
from django.utils import translation
from .models import (
Article, ArticleIdea, ArticleTag, ArticleTranslation, Country, Friendship,
Gro... |
from . import output
class TestCase(object):
def __init__(self, suite, path, variant=None, flags=None,
override_shell=None):
self.suite = suite # TestSuite object
self.path = path # string, e.g. 'div-mod', 'test-api/foo'
self.flags = flags or [] # list of strings, flags sp... |
""" version info, help messages, tracing configuration. """
import py
import pytest
import os, sys
def pytest_addoption(parser):
group = parser.getgroup('debugconfig')
group.addoption('--version', action="store_true",
help="display pytest lib version and import information.")
group._addoption(... |
import datetime
import time
import jinja2
from nose.tools import ok_, eq_
from django.test import TestCase
from airmozilla.main.models import Event
from airmozilla.manage.helpers import (
almost_equal,
event_status_to_css_label,
format_message,
formatduration,
)
class TestAlmostEqual(TestCase):
... |
import binascii
import stem.response
import stem.socket
import stem.util.str_tools
import stem.util.tor_tools
class AuthChallengeResponse(stem.response.ControlMessage):
"""
AUTHCHALLENGE query response.
:var str server_hash: server hash provided by tor
:var str server_nonce: server nonce provided by tor
"... |
"""Support for VeSync switches."""
import logging
from homeassistant.components.switch import SwitchEntity
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .common import VeSyncDevice
from .const import DOMAIN, VS_DISCOVERY, VS_DISPATCHERS, VS_SWITCHES... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: acme_inspect
author: "Felix Fontein (@felixfontein)"
versi... |
"""Handle voice commands locally.
This code lets you link keywords to actions. The actions are declared in
action.py.
"""
class Actor(object):
"""Passes commands on to a list of action handlers."""
def __init__(self):
self.handlers = []
def add_keyword(self, keyword, action):
self.hand... |
from StringIO import StringIO
from itertools import chain
from google.protobuf.message import Message
from b3j0f.aop import weave, unweave, is_intercepted, weave_on
from jinja2 import Environment, PackageLoader, select_autoescape, FileSystemLoader, Template
env = Environment(
loader=FileSystemLoader(searchpath="t... |
"""
Acceptance tests for Studio related to the acid xblock.
"""
from bok_choy.web_app_test import WebAppTest
from ...pages.studio.auto_auth import AutoAuthPage
from ...pages.studio.overview import CourseOutlinePage
from ...pages.xblock.acid import AcidView
from ...fixtures.course import CourseFixture, XBlockFixtureDes... |
from __future__ import absolute_import
import sys
import base64
import itertools
import json
import os.path
import ntpath
import types
import pipes
import glob
import re
import crypt
import hashlib
import string
from functools import partial
import operator as py_operator
from random import SystemRandom, shuffle
impor... |
"""Functional tests for Ftrl operations."""
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
from tensorflow.python.framework import ops
fr... |
"""
A script for generating siege files with a bunch of URL variations.
"""
import re
import sys
part_re = re.compile(r'\{([-\w]+)\}')
AMO_LANGUAGES = (
'af', 'ar', 'ca', 'cs', 'da', 'de', 'el', 'en-US', 'es', 'eu', 'fa', 'fi',
'fr', 'ga-IE', 'he', 'hu', 'id', 'it', 'ja', 'ko', 'mn', 'nl', 'pl',
'pt-BR', ... |
#!/usr/bin/python2
from distutils.core import setup, Extension
from os import getenv
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_optio... |
from majormajor.majormajor import MajorMajor
from majormajor.document import Document
class TestMajorMajorHelpers:
def setup_method(self, method):
self.collab0 = MajorMajor()
def test_new_document(self):
# leaving nothing specified
doc = self.collab0.new_document()
a... |
import numpy as np
from sklearn import utils as skutils
from rng import np_rng, py_rng
def center_crop(x, ph, pw=None):
if pw is None:
pw = ph
h, w = x.shape[:2]
j = int(round((h - ph)/2.))
i = int(round((w - pw)/2.))
return x[j:j+ph, i:i+pw]
def patch(x, ph, pw=None):
if pw is None:
... |
from os.path import join, dirname, abspath, isabs, exists
from os import makedirs, environ
import warnings
from scrapy.utils.conf import closest_scrapy_cfg, get_config
from scrapy.utils.python import is_writable
from scrapy.exceptions import NotConfigured
DATADIR_CFG_SECTION = 'datadir'
def inside_project():
scr... |
import os
from ConfigParser import ConfigParser
from .exceptions import WorldifyConfigException
class WorldifyConfig(object):
def __init__(self):
self._config_path = os.path.expanduser("~/.worldify")
self.conf = ConfigParser()
self.conf.read(self._config_path)
self._check_config_... |
try:
import simplejson as json
except ImportError:
import json # noqa
import urllib
from openerp.osv import osv, fields
from openerp import tools
from openerp.tools.translate import _
def geo_find(addr):
url = 'https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address='
url += urllib... |
# -*- coding: utf-8 -*-
"""
pygments.lexers._clbuiltins
~~~~~~~~~~~~~~~~~~~~~~~~~~~
ANSI Common Lisp builtins.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
BUILTIN_FUNCTIONS = [ # 638 functions
'<', '<=', '=', '>', '>=', '-', '... |
"""
Models to support Course Surveys feature
"""
import logging
from lxml import etree
from collections import OrderedDict
from django.db import models
from student.models import User
from django.core.exceptions import ValidationError
from model_utils.models import TimeStampedModel
from survey.exceptions import Surv... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'StewardProject.external_id'
db.add_column(u'steward_stewardproject', 'external_id',
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import stat
from ansible.cli import CLI
from ansible.errors import AnsibleError, AnsibleOptionsError
from ansible.executor.playbook_executor import PlaybookExecutor
from ansible.inventory import Inventory
from ansible.pa... |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from nose.tools import assert_equal
from rapidsms.conf import settings
from .utils import get_handlers
def test_get_handlers():
# store current settings.
_settings = (
settings.INSTALLED_APPS,
settings.INSTALLED_HANDLERS,
settings.E... |
# Plots
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import re
import random
def plot_several_countries(df, ylabel, title, country_list="", save=False, num="", xticks_hourly=False, kind='bar', linestyle='-', color='mbygcr', marker='o', linewidth=4.0, fontsize=16, legend=True):
"""
This... |
# -*- coding: utf-8 -*-
from django.conf.urls import url, patterns
from tcms.testruns.views import TestRunReportView
from tcms.testruns.views import AddCasesToRunView
urlpatterns = patterns(
'tcms.testruns.views',
url(r'^new/$', 'new'),
url(r'^(?P<run_id>\d+)/$', 'get'),
url(r'^(?P<run_id>\d+)/clone/... |
"""Test low-level utility functions from ``module_utils.common.collections``."""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from ansible.module_utils.six import Iterator
from ansible.module_utils.common._collections_compat import Sequence
from ansible.module_u... |
import purchase_analytic_plans
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import macpath
from test import support, test_genericpath
import unittest
class MacPathTestCase(unittest.TestCase):
def test_abspath(self):
self.assertEqual(macpath.abspath("xx:yy"), "xx:yy")
def test_isabs(self):
isabs = macpath.isabs
self.assertTrue(isabs("xx:yy"))
self.ass... |
"""
Defines a form for providing validation of subsection grade templates.
"""
import logging
from django import forms
from lms.djangoapps.grades.config.models import CoursePersistentGradesFlag
from opaque_keys import InvalidKeyError
from xmodule.modulestore.django import modulestore
from opaque_keys.edx.locator imp... |
#!/usr/bin/env python
"""
A comparison of multilabel target formats and metrics over them
"""
from __future__ import division
from __future__ import print_function
from timeit import timeit
from functools import partial
import itertools
import argparse
import sys
import matplotlib.pyplot as plt
import scipy.sparse as... |
"""This example gets all campaigns. To add a campaign, run add_campaign.py.
Tags: CampaignService.get
"""
__author__ = '<EMAIL> (Kevin Winter)'
import os
import sys
sys.path.insert(0, os.path.join('..', '..', '..', '..', '..'))
# Import appropriate classes from the client library.
from adspygoogle import AdWordsCli... |
"""By using execfile(this_file, dict(__file__=this_file)) you will
activate this virtualenv environment.
This can be used when you must use an existing Python interpreter, not
the virtualenv bin/python
"""
try:
__file__
except NameError:
raise AssertionError(
"You must run this like execfile('path/to/... |
from rf2db.utils import urlutil
from rf2db.db.RF2DBConnection import cp_values
from rf2db.db.RF2FileCommon import rf2_values
from server.BaseNode import BaseNode, expose, xmlVal, htmlHead
html = htmlHead + """
<html>
<head>
<title>RF2 Server Configuration</title>
</head>
<body>
<h1>Database Configuration</h1>
<tab... |
import glob
from os.path import join, split
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration, get_mathlibs
config = Configuration('random',parent_package,top_path)
source_files = [join('mtrand', i) for i in ['mtrand.c',
... |
from fuel.datasets import H5PYDataset
from fuel.utils import find_in_data_path
class Iris(H5PYDataset):
u"""Iris dataset.
Iris [LBBH] is a simple pattern recognition dataset, which consist of
3 classes of 50 examples each having 4 real-valued features each, where
each class refers to a type of iris p... |
"""
#######################################################################################
# #
# kmotif.py is a command-line front-end to the KIRMES pipeline #
# BibTeX entries below. Please cite: ... |
import logging
l = logging.getLogger("angr.block")
import pyvex
from archinfo import ArchARM
from .engines import SimEngineVEX
DEFAULT_VEX_ENGINE = SimEngineVEX() # this is only used when Block is not initialized with a project
class Block(object):
BLOCK_MAX_SIZE = 4096
__slots__ = ['_project', '_bytes', ... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsServerApiContext class.
.. 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 vers... |
# -*- coding: utf-8 -*-
"""Style functions for zazu."""
import zazu.imports
zazu.imports.lazy_import(locals(), [
'click',
'difflib',
'functools',
'os',
'threading',
'sys',
'zazu.config',
'zazu.git_helper',
'zazu.styler',
'zazu.util'
])
__author__ = 'Nicholas Wiles'
__copyright__... |
import datetime
import os
import posixpath
import time
import unittest
import luigi.target
from luigi import six
from nose.plugins.attrib import attr
if six.PY3:
raise unittest.SkipTest("snakebite doesn't work on Python 3 yet.")
try:
from luigi.contrib.hdfs import SnakebiteHdfsClient
from minicluster imp... |
import argparse
import os
import sys
from collections import defaultdict
from pprint import pprint
import config
from postprocess import processdata
from utility import utility
parser = argparse.ArgumentParser(description="Prints out the SPARQL statistic")
parser.add_argument(
"--monthsFolder",
"-m",
defa... |
"""
Counts words in text encoded with UTF8 received from the network every second.
Usage: recoverable_network_wordcount.py <hostname> <port> <checkpoint-directory> <output-file>
<hostname> and <port> describe the TCP server that Spark Streaming would connect to receive
data. <checkpoint-directory> directory to... |
# -*- coding=utf-8 -*-
#### for testing steps
import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm
from sklearn.externals import joblib
from PIL import Image
from process import toBin, cropLetters
from img2feature import toFeature
from main import readAllFiles
TEMP_DIR = 'tmp/'
def test_onePi... |
{
'name': 'Hardware Proxy',
'version': '1.0',
'category': 'Point Of Sale',
'sequence': 6,
'summary': 'Connect the Web Client to Hardware Peripherals',
'website': 'https://www.odoo.com/page/point-of-sale',
'description': """
Hardware Poxy
=============
This module allows you to remotely use ... |
# -*- coding: utf-8 -*-
"""
werkzeug.testapp
~~~~~~~~~~~~~~~~
Provide a small test application that can be used to test a WSGI server
and check it for WSGI compliance.
:copyright: (c) 2013 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
impo... |
import os
import sys
from django.db.backends.creation import BaseDatabaseCreation
class DatabaseCreation(BaseDatabaseCreation):
# SQLite doesn't actually support most of these types, but it "does the right
# thing" given more verbose field definitions, so leave them as is so that
# schema inspection is mor... |
# -*- encoding: utf-8 -*-
"""
Tests for django.core.servers.
"""
from __future__ import unicode_literals
import os
import socket
from django.core.exceptions import ImproperlyConfigured
from django.test import LiveServerTestCase
from django.test.utils import override_settings
from django.utils.http import urlencode
fr... |
"""
Tests for L{twisted.internet.default}.
"""
from __future__ import division, absolute_import
import select, sys
from twisted.trial.unittest import SynchronousTestCase
from twisted.python.runtime import Platform
from twisted.python.reflect import requireModule
from twisted.internet import default
from twisted.inter... |
import json
import os
import sys
import unittest
from appengine_blobstore import AppEngineBlobstore
from appengine_url_fetcher import AppEngineUrlFetcher
from appengine_wrappers import files
from fake_fetchers import ConfigureFakeFetchers
from github_file_system import GithubFileSystem
from object_store_creator import... |
#!/usr/bin/python2.7
from Crypto.Cipher import AES
from Crypto import Random
'''
key = 'Sixteen byte key'
plain_text = 'Attack at dawn'
iv = Random.new().read(AES.block_size)
#if ECB, use PCKS#7
# append bytes to reach mod 16 boundary.
# All padding bytes have the same value: the number of bytes that you are adding... |
"""The command to list installed/available gcloud components."""
import textwrap
from googlecloudsdk.calliope import base
class List(base.Command):
"""List the status of all Cloud SDK components.
List all packages and individual components in the Cloud SDK and provide
information such as whether the componen... |
#!/usr/bin/env python
try:
import netCDF4 as netCDF
except:
import netCDF3 as netCDF
class PISMDataset(netCDF.Dataset):
def create_time(self, use_bounds = False, length = None, units = None):
self.createDimension('time', size = length)
t_var = self.createVariable('time', 'f8', ('time',))
... |
"""
Set of "markup" template filters for Django. These filters transform plain text
markup syntaxes to HTML; currently there is support for:
* Textile, which requires the PyTextile library available at
http://loopcore.com/python-textile/
* Markdown, which requires the Python-markdown library from
... |
"""Encode and decode Bitcoin addresses.
- base58 P2PKH and P2SH addresses.
- bech32 segwit v0 P2WPKH and P2WSH addresses."""
import enum
import unittest
from .script import hash256, hash160, sha256, CScript, OP_0
from .segwit_addr import encode_segwit_address
from .util import assert_equal, hex_str_to_bytes
ADDRESS... |
'''
Crunchyroll urlresolver plugin
Copyright (C) 2013 voinage
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 ... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
TestData.py
---------------------
Date : March 2013
Copyright : (C) 2013 by Victor Olaya
Email : volayaf at gmail dot com
*******************************... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
try:
import ovirtsdk4.types as otypes
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt impo... |
# See: http://hunterford.me/django-custom-model-manager-chaining/
import models
class ArticleManagerMixin(object):
def published(self, status=True):
if status:
return self.filter(status=models.Article.STATUS_PUBLISHED)
else:
return self.filter(status=models.Article.STATUS_... |
#! -*- coding: utf8 -*-
"Herramienta para procesar y consultar el Padrón Unico de Contribuyentes AFIP"
# Documentación e información adicional:
# http://www.sistemasagiles.com.ar/trac/wiki/PadronContribuyentesAFIP
# Basado en pyafipws padron.py de Mariano Reingart
from trytond.model import ModelView, ModelSQL, fie... |
"""
Tests for RFC-2822 headers in PEPs (readers/pep.py).
"""
from __init__ import DocutilsTestSupport
def suite():
s = DocutilsTestSupport.PEPParserTestSuite()
s.generateTests(totest)
return s
totest = {}
totest['rfc2822'] = [
["""\
Author: Me
Version: 1
Date: 2002-04-23
""",
"""\
<document source="test... |
"""
sentry.models.auditlogentry
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from django.db import models
from django.utils import timezone
from sentry.db... |
#!/usr/bin/env python
"""
Python interface to euroc ROS multirotor simulator
See https://pixhawk.org/dev/ros/sitl
"""
import time
import mav_msgs.msg as mav_msgs
import px4.msg as px4
import rosgraph_msgs.msg as rosgraph_msgs
import rospy
import sensor_msgs.msg as sensor_msgs
from aircraft import Aircraft
from rotma... |
import mysqlhack
import org.bukkit as bukkit
import json
from java.util import UUID as UUID
from helpers import *
from org.bukkit import *
from traceback import format_exc as trace
from iptracker_secrets import *
iptrack_permission = "utils.iptrack"
iptrack_version = "1.1.0"
@hook.event("player.Player... |
"""California housing dataset.
The original database is available from StatLib
http://lib.stat.cmu.edu/
The data contains 20,640 observations on 9 variables.
This dataset contains the average house value as target variable
and the following input variables (features): average income,
housing average age, averag... |
import click
import snapcraft
SNAPCRAFT_VERSION_TEMPLATE = 'snapcraft, version %(version)s'
@click.group()
def versioncli():
"""Version commands"""
pass
@versioncli.command('version')
def version():
"""Obtain snapcraft's version number.
Examples:
snapcraft version
snapcraft --vers... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#-----------------------
# Name: util.py Assorted utilities used in tmdb_api
# Python Library
#-----------------------
from copy import copy
from locales import get_locale
from tmdb_auth import get_session
class NameRepr(object):
"""Mixin for __repr__ methods usin... |
# -*- coding: utf-8 -*-
"""Word cloud integration tests using mongo modulestore."""
import json
from operator import itemgetter
from nose.plugins.attrib import attr
from . import BaseTestXmodule
from xmodule.x_module import STUDENT_VIEW
@attr('shard_1')
class TestWordCloud(BaseTestXmodule):
"""Integration test ... |
from scipy import sparse
import numpy as np
from scipy import sparse
from numpy.testing import assert_equal, assert_raises
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_array_equal
from sklearn.utils import check_random_state
from sklearn.utils.testing import assert_raises_rege... |
from jinja2.ext import Extension
from jinja2 import nodes
from django_assets.conf import settings
from django_assets.merge import process
from django_assets.bundle import Bundle
from django_assets import registry
__all__ = ('assets',)
class AssetsExtension(Extension):
"""
As opposed to the Djan... |
"""Tests for Cauchy."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import importlib
import numpy as np
from tensorflow.contrib.distributions.python.ops import cauchy as cauchy_lib
from tensorflow.python.framework import constant_op
from tensorflow.pyt... |
from tools import config, ustr
fontsize = 15
"""
This class generate EAN bar code, it required PIL (python imaging library)
installed.
If the code has not checksum (12 digits), it added automatically.
Create bar code sample :
from EANBarCode import EanBarCode
bar = EanBarCode()
bar.getImage("9782212110708",... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from collections import Iterable
from ansible.module_utils.six import string_types
from ansible.template.safe_eval import safe_eval
__all__ = ['listify_lookup_plugin_terms']
def listify_lookup_plugin_terms(terms, templar, load... |
"""Fixer for removing uses of the types module.
These work for only the known names in the types module. The forms above
can include types. or not. ie, It is assumed the module is imported either as:
import types
from types import ... # either * or specific types
The import statements are not modified.
Th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.