content stringlengths 4 20k |
|---|
"""
THE TESTS IN THIS MODULE SHOULD BE RUN ON THE SAME PROCESS TO BE MEANINGFUL!!!
The tests in this module look kind of goofy, but the idea is to make sure that
cache values can't leak between different TestCase classes and methods. The need
for this will go away whenever Django merges the fix to reset the caches bet... |
import time
from openerp.osv import fields, osv
from openerp.tools.translate import _
class hr_so_project(osv.osv_memory):
_name = 'hr.sign.out.project'
_description = 'Sign Out By Project'
_columns = {
'account_id': fields.many2one('account.analytic.account', 'Project / Analytic Account', domain=... |
import re
import ast
match_ws = re.compile('^[ \t]+')
def get_ws_len(line):
match = match_ws.search(line)
if match:
return len(match.group(0))
else:
return 0
def renumerate(seq):
i = len(seq) - 1
for r in reversed(seq):
yield i, r
i -= 1
def sanitize_encoding(sourc... |
from functools import partial
import six
from ..utils.is_base_type import is_base_type
from ..utils.get_unbound_function import get_unbound_function
from ..utils.props import props
from .field import Field
from .objecttype import ObjectType, ObjectTypeMeta
class MutationMeta(ObjectTypeMeta):
def __new__(cls, n... |
packs = None
if hasattr(dmd, 'ZenPackManager'):
packs = dmd.ZenPackManager.packs
else:
packs = dmd.packs
phase2 = False
for pack in packs():
try:
unused = pack.primaryAq()
print "%s is fine." % pack.id
except AttributeError:
print "Proble... |
"""
Note: Cost functions are not implemented for RectifierConvNonlinearity,
TanhConvNonlinearity, RectifiedLinear, and Tanh. Here we verify that the
implemented cost functions for convolutional layers give the correct output
by comparing to standard MLP's.
"""
import numpy as np
from numpy.testing import assert_raise... |
import logging
import os
import select
import SimpleHTTPServer
import SocketServer
import threading
HERE = os.path.dirname(__file__)
logger = logging.getLogger(__name__)
class ThisDirHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def translate_path(self, path):
path = path.split('?', 1)[0].split('#'... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'certified'}
DOCUMENTATION = r'''
---
module: ucs_wwn_pool
short_description: Configures WWNN or WWPN pool... |
# -*- coding: utf8 -*-
from datetime import datetime
from django.core import mail
from nose.tools import eq_
import amo
import amo.tests
from addons.models import Addon
from versions.models import Version, version_uploaded, ApplicationsVersions
from files.models import Platform, File
from applications.models import ... |
from fedmsg_meta_fedora_infrastructure import BaseProcessor
from fedmsg_meta_fedora_infrastructure.fasshim import avatar_url
class WaiverDBProcessor(BaseProcessor):
__name__ = "waiverdb"
__description__ = "WaiverDB"
__link__ = "https://pagure.io/waiverdb"
__docs__ = ("https://fedoraproject.org/wiki/In... |
import json
import time
from django.test import LiveServerTestCase
from django.urls import reverse
from django.test.client import Client
from resigner.models import ApiKey
from resigner.client import (
post_signed, get_signed, _send_req, _create_signed_req
)
from resigner.utils import CLIENT_TIME_STAMP_KEY, CLIEN... |
import glob
import logging
import os
import sys
import warnings
from django.utils.translation import ugettext_lazy as _
from horizon.utils.escape import monkeypatch_escape
from openstack_dashboard import enabled
from openstack_dashboard import exceptions
from openstack_dashboard.local import enabled as local_enabled... |
# -*- coding: utf-8 -*-
"""
Website-context rendering needs to add some metadata to rendered fields,
as well as render a few fields differently.
Also, adds methods to convert values back to openerp models.
"""
import cStringIO
import datetime
import itertools
import logging
import os
import urllib2
import urlparse
im... |
import os
import sys
import re
from optparse import OptionParser
import Skype4Py
parser = OptionParser('%prog user [user*]', version="%prog 0.1")
options, args = parser.parse_args()
if len(args) < 1:
parser.print_help()
sys.exit(0)
dest = args
path = os.getcwd() # use current working directory
skype = Skype4Py.... |
from __future__ import (absolute_import, division, print_function)
import sys
import pytest
from ansible.module_utils.ec2 import HAS_BOTO3
from units.modules.utils import set_module_args
if not HAS_BOTO3:
pytestmark = pytest.mark.skip("test_api_gateway.py requires the `boto3` and `botocore` modules")
import an... |
"""
Pure SciPy implementation of Locally Optimal Block Preconditioned Conjugate
Gradient Method (LOBPCG), see
http://www-math.cudenver.edu/~aknyazev/software/BLOPEX/
License: BSD
Authors: Robert Cimrman, Andrew Knyazev
Examples in tests directory contributed by Nils Wagner.
"""
from __future__ import division, prin... |
import time
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "../../lib"))
from bulk_queue import BulkQueue
from query_models import SearchQuery, ExistsMatch
sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
from unit_test_suite import UnitTestSuite
class BulkQueueTest(Uni... |
from distutils.util import convert_path
from distutils import log
from distutils.errors import DistutilsOptionError
import distutils
import os
from setuptools import Command
__all__ = ['config_file', 'edit_config', 'option_base', 'setopt']
def config_file(kind="local"):
"""Get the filename of the distutils, lo... |
from distutils.dir_util import copy_tree
from importlib import import_module
import os
from shutil import move, rmtree
from tempfile import mkdtemp
from django.core.management import CommandError
from django.core.management.commands.startproject import Command as BaseCommand
from django.utils import six
from django.ut... |
from __future__ import print_function
import colorsys
import numpy as np
from keras.models import Model
from cityscapes_labels import trainId2label
from ade20k_labels import ade20k_id2label
from pascal_voc_labels import voc_id2label
def class_image_to_image(class_id_image, class_id_to_rgb_map):
"""Map the class i... |
import inspect
from collections import OrderedDict
from coalib.misc.Enum import enum
class DocstringMetadata:
_ParseMode = enum('DESCRIPTION', 'PARAM', 'RETVAL')
def __init__(self, desc, param_dict, retval_desc):
"""
Represents a docstring of a python class or function.
:param desc:... |
import pytest
import os
from units.utils.amazon_placebo_fixtures import placeboify, maybe_sleep
from ansible.modules.cloud.amazon import ec2_vpc_vpn
from ansible.module_utils._text import to_text
from ansible.module_utils.ec2 import get_aws_connection_info, boto3_conn, boto3_tag_list_to_ansible_dict
class FakeModule(... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import datetime
try:
from nailgun import entities, entity_fields
from nailgun.config import ServerConfig
HAS_NAILGUN_PACKAGE = True
except:
HAS_NAILGUN_PACKAGE = ... |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <<EMAIL>>'
__docformat__ = 'restructuredtext en'
from calibre.constants import islinux, isosx, get_osx_version
class Notifier(object):
DEFA... |
# -*- coding: utf-8 -*-
"""
werkzeug.testsuite.test
~~~~~~~~~~~~~~~~~~~~~~~
Tests the testing tools.
:copyright: (c) 2013 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import sys
import unittest
from io import BytesIO
from werkzeug._com... |
from urllib import urlencode
from lxml.etree import XML
from weightless.http import httpget
from meresco.core import Observable
from digitalecollectie.erfgeo.namespaces import xpathFirst
class SummaryForRecordId(Observable):
def __init__(self, digitaleCollectieHost='127.0.0.1', digitaleCollectiePort=None, **kw... |
import datetime
import json
import random
def ts():
return datetime.datetime.strftime(datetime.datetime(2012, 04, 03,
random.randint(12, 23),
random.randint(0, 59)), '%Y-%m-%dT%H:%M:%SZ')
def ch():
return random.randint(1, 5)
def hum(avg, k=1.):
return round(avg + k*random.random() - k / 2... |
LICENSE = \
"""
The MIT License (MIT)
Copyright (c) 2015 Bryan Worrell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, m... |
from PyQt5.QtCore import (pyqtProperty, pyqtSignal, QEasingCurve, QObject,
QParallelAnimationGroup, QPointF, QPropertyAnimation, qrand, QRectF,
QState, QStateMachine, Qt, QTimer)
from PyQt5.QtGui import (QBrush, QLinearGradient, QPainter, QPainterPath,
QPixmap)
from PyQt5.QtWidgets import (QAppl... |
"""Statement AST Node in TVM.
User do not need to deal with AST node directly.
But they can be helpful for developer to do quick proptyping.
While not displayed in the document and python file.
Each statement node have subfields that can be visited from python side.
.. code-block:: python
x = tvm.var("n")
a ... |
from unittest import TestCase
from pymple import Container
class A:
pass
class D(A):
pass
class B:
def __init__(self, param: A) -> None:
self.param = param
class C:
def __init__(self, param: B) -> None:
self.param = param
class TestContainer(TestCase):
def setUp(self) -> N... |
import pytest
from bravado_core.operation import Operation
from bravado_core.spec import Spec
def test_returns_operation_id_from_operation_spec():
spec = Spec(spec_dict={})
operation_spec = {'operationId': 'getPetById'}
operation = Operation(spec, '/pet/{petId}', 'get', operation_spec)
assert 'getPet... |
import json
import optparse
import os
import re
import sys
if sys.version_info < (2, 7, 0):
sys.stderr.write("python 2.7 or later is required run this script\n")
sys.exit(1)
import buildbot_common
import build_projects
import build_version
import easy_template
import parse_dsc
from build_paths import SDK_SRC_DIR... |
from openerp import models, fields, api, exceptions, _
class WizProductionProductLine(models.TransientModel):
_inherit = 'wiz.production.product.line'
lot = fields.Many2one('stock.production.lot', 'Reserved Lot')
def _prepare_product_addition(
self, product, product_qty, product_uom, product... |
from __future__ import unicode_literals
from sqlalchemy.ext.declarative import declared_attr
from indico.core.db import db
from indico.core.db.sqlalchemy.principals import PrincipalMixin
from indico.core.db.sqlalchemy.util.models import auto_table_args
from indico.util.string import return_ascii
class BlockingPrinc... |
"""
This script is used to configure iptables, ebtables, and arptables rules on
XenServer hosts.
"""
import os
import sys
# This is written to Python 2.4, since that is what is available on XenServer
import simplejson as json
import novalib # noqa
def main(dom_id, command, only_this_vif=None):
xsls = novalib.... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from logging import getLogger, Formatter, StreamHandler, FileHandler
from .errors import *
__all__ = [
"get_logger",
"create_logger",
]
DEFAULT_LOGGER_NAME = "cubes"
DEFAULT_FORMAT = "%(asctime)s %(levelname)s %(message)... |
from django.template import Library, TemplateSyntaxError
from django.template.defaulttags import kwarg_re, SsiNode, URLNode
register = Library()
@register.tag
def ssi(parser, token):
"""
Outputs the contents of a given file into the page.
Like a simple "include" tag, the ``ssi`` tag includes the contents... |
from __future__ import absolute_import, division, print_function
import binascii
import pytest
from cryptography.hazmat.primitives.ciphers.algorithms import (
AES, Camellia, TripleDES, Blowfish, ARC4
)
class TestAES(object):
@pytest.mark.parametrize(("key", "keysize"), [
(b"0" * 32, 128),
(... |
from MemObject import MemObject
from m5.params import *
from m5.proxy import *
class NetworkTest(MemObject):
type = 'NetworkTest'
cxx_header = "cpu/testers/networktest/networktest.hh"
block_offset = Param.Int(6, "block offset in bits")
num_memories = Param.Int(1, "Num Memories")
memory_size = Param... |
# encoding: utf-8
from south.db import db
from south.v2 import SchemaMigration
from django.conf import settings
class Migration(SchemaMigration):
depends_on = []
if 'allauth.socialaccount.providers.facebook' in settings.INSTALLED_APPS:
depends_on.append(('facebook', '0003_tosocialaccount'),)
if 'al... |
"""
Tests that check that we ignore the appropriate files when importing courses.
"""
import unittest
from mock import Mock
from xmodule.modulestore.xml_importer import StaticContentImporter
from opaque_keys.edx.locator import CourseLocator
from xmodule.tests import DATA_DIR
class IgnoredFilesTestCase(unittest.TestCa... |
"""
Implements the PyPI/setuptools setup and installation script.
"""
##########################################################################
## Imports
##########################################################################
try:
from setuptools import setup
from setuptools import find_packages
except I... |
#!/usr/bin/env python
from __future__ import unicode_literals
import sys
import pmt
from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("-H", "--host", default="localhost",
help="Hostname ... |
"""Contains helper functions for creating summaries.
This module contains various helper functions for quickly and easily adding
tensorflow summaries. These allow users to print summary values
automatically as they are computed and add prefixes to collections of summaries.
Example usage:
import tf_slim as slim
s... |
"""
Tests that filenames that contain colons are handled correctly.
(This is important for absolute paths on Windows.)
"""
import os
import sys
import TestGyp
# TODO: Make colons in filenames work with make, if required.
test = TestGyp.TestGyp(formats=['!make'])
CHDIR = 'colon'
source_name = 'colon/a:b.c'
copies_nam... |
import urllib
from urlparse import urlparse
from django.conf import settings
from django.core.handlers.wsgi import WSGIHandler
from django.contrib.staticfiles import utils
from django.contrib.staticfiles.views import serve
class StaticFilesHandler(WSGIHandler):
"""
WSGI middleware that intercepts calls to th... |
from msrest.serialization import Model
class ExpressRouteCircuitServiceProviderProperties(Model):
"""Contains ServiceProviderProperties in an ExpressRouteCircuit.
:param service_provider_name: The serviceProviderName.
:type service_provider_name: str
:param peering_location: The peering location.
... |
import re
import sys
import time
import threading
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from twython import Twython
from social_stream.twitter.models import *
from social_stream.twitter import get_tweet_model
class Comma... |
# -*- coding: utf-8 -*-
from functools import wraps
import logging
from psycopg2 import IntegrityError, OperationalError, errorcodes
import random
import threading
import time
import openerp
from openerp.tools.translate import translate
from openerp.osv.orm import except_orm
from contextlib import contextmanager
imp... |
from osv import osv, fields
from tools.translate import _
class project_timebox_empty(osv.osv_memory):
_name = 'project.timebox.empty'
_description = 'Project Timebox Empty'
_columns = {
'name': fields.char('Name', size=32)
}
def view_init(self, cr , uid , fields_list, context=None):
... |
"""MyDjango URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/dev/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... |
"""IPv6 helper functions."""
import re
import dns.exception
import dns.ipv4
_leading_zero = re.compile(r'0+([0-9a-f]+)')
def inet_ntoa(address):
"""Convert a network format IPv6 address into text.
@param address: the binary address
@type address: string
@rtype: string
@raises ValueError: the ad... |
"""Logging and Summary Operations."""
# pylint: disable=protected-access
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorflow.python.ops import common... |
from __future__ import unicode_literals
from swappable_models.models import Article
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.core import management
from django.test import TestCase, override_settings
from django.utils.six import StringIO
... |
data = (
'Hu ', # 0x00
'Ye ', # 0x01
'Ding ', # 0x02
'Qing ', # 0x03
'Pan ', # 0x04
'Xiang ', # 0x05
'Shun ', # 0x06
'Han ', # 0x07
'Xu ', # 0x08
'Yi ', # 0x09
'Xu ', # 0x0a
'Gu ', # 0x0b
'Song ', # 0x0c
'Kui ', # 0x0d
'Qi ', # 0x0e
'Hang ', # 0x0f
'Yu ', # 0x10
'Wan '... |
from __future__ import with_statement
import re
import os
import marshal
import sys
MIN_FLOAT=-3.14e100
PROB_START_P = "prob_start.p"
PROB_TRANS_P = "prob_trans.p"
PROB_EMIT_P = "prob_emit.p"
PrevStatus = {
'B':('E','S'),
'M':('M','B'),
'S':('S','E'),
'E':('B','M')
}
def load_model():
_curpath=... |
from django.conf import settings
from django.utils import timezone
from django.views.generic.dates import YearMixin, MonthMixin, DayMixin
from cobra.core.constants import EVENTS_PER_PAGE
from cobra.core.loading import get_model
from cobra.core.utils import get_datetime_now, get_local_datetime_now
class ExtraContextMi... |
from __future__ import division
from ..base import * # noqa analysis:ignore
class taxes_indirectes_total(Variable):
column = FloatCol
entity_class = Menages
label = u"Montant total de taxes indirectes payées"
def function(self, simulation, period):
tva_total = simulation.calculate('tva_tot... |
"""!
This module provides command-line argument templating through the Jinja2
templating system.
"""
import jinja2
import dateutil.tz
import datetime
def filter_iso8601(value):
return value.astimezone(dateutil.tz.tzutc()).strftime('%Y-%m-%dT%H:%M:%SZ')
def filter_iso8601_compact(value):
return value.astime... |
import base64
from django.contrib.auth import authenticate, login
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
def render_with(template_name):
"""
Renders the view wrapped by this decorator with the given... |
import boto3
from boto3.dynamodb.conditions import Key
# Toggle Print Statements
DEBUG = True
# Access keys will be moved to config file in production
dynamodb = boto3.resource('dynamodb',
aws_access_key_id='',
aws_secret_access_key='',
re... |
import py
import os, sys
from py._io import terminalwriter
import codecs
import pytest
def test_get_terminal_width():
x = py.io.get_terminal_width
assert x == terminalwriter.get_terminal_width
def test_getdimensions(monkeypatch):
fcntl = py.test.importorskip("fcntl")
import struct
l = []
monke... |
"""
SGMLParser-based Link extractors
"""
from six.moves.urllib.parse import urljoin
import warnings
from sgmllib import SGMLParser
from w3lib.url import safe_url_string
from scrapy.selector import Selector
from scrapy.link import Link
from scrapy.linkextractors import FilteringLinkExtractor
from scrapy.utils.misc impo... |
import threading
class ThreadedMessageQueue(object):
def __init__(self):
self._messages = []
self._is_running = True
self._lock = threading.Lock()
def post(self, message):
with self._lock:
self._messages.append(message)
def stop(self):
with self._lock:... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import os
import traceback
try:
import ovirtsdk4 as sdk
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt imp... |
import io
import sys
import unittest
def resultFactory(*_):
return unittest.TestResult()
class TestSetups(unittest.TestCase):
def getRunner(self):
return unittest.TextTestRunner(resultclass=resultFactory,
stream=io.StringIO())
def runTests(self, *cases... |
import os
from spack import *
class Pdt(AutotoolsPackage):
"""Program Database Toolkit (PDT) is a framework for analyzing source
code written in several programming languages and for making rich
program knowledge accessible to developers of static and dynamic
analysis tools. PDT implements a ... |
"""Logging"""
ident = "$Id$"
import os, sys
WARN = 1
DEBUG = 2
class ILogger:
'''Logger interface, by default this class
will be used and logging calls are no-ops.
'''
level = 0
def __init__(self, msg):
return
def warning(self, *args, **kw):
return
def debug(self, *args, *... |
# test builtin hash function
print(hash(False))
print(hash(True))
print({():1}) # hash tuple
print({1 << 66:1}) # hash big int
print(hash in {hash:1}) # hash function
try:
hash([])
except TypeError:
print("TypeError")
class A:
def __hash__(self):
return 123
def __repr__(self):
return ... |
""" Lexer for PPAPI IDL """
#
# IDL Lexer
#
# The lexer is uses the PLY lex library to build a tokenizer which understands
# WebIDL tokens.
#
# WebIDL, and WebIDL regular expressions can be found at:
# http://dev.w3.org/2006/webapi/WebIDL/
# PLY can be found at:
# http://www.dabeaz.com/ply/
import os.path
import ... |
import sys
import os
import time
import socket
import errno
import struct
import logging
info = sys.version_info
if not (info[0] == 2 and info[1] >= 7):
print 'Python 2.7 required'
sys.exit(1)
import argparse
from shadowsocks import eventloop, asyncdns, lru_cache
BUF_SIZE = 16384
CACHE_TIMEOUT = 10
EMPTY_... |
import os
def configuration(parent_package='', top_path=None):
import numpy
from numpy.distutils.misc_util import Configuration
config = Configuration('neighbors', parent_package, top_path)
libraries = []
if os.name == 'posix':
libraries.append('m')
config.add_extension('ball_tree',
... |
# -*- coding: utf-8 -*-
"""
sphinx.util
~~~~~~~~~~~
Utility functions for Sphinx.
:copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import re
import sys
import shutil
import fnmatch
import tempfile
import posixpath
import traceb... |
#!/usr/bin/env python
"""
APM automatic test suite
Andrew Tridgell, October 2011
"""
from __future__ import print_function
import atexit
import fnmatch
import glob
import optparse
import os
import shutil
import signal
import sys
import time
import traceback
import apmrover2
import arducopter
import arduplane
import ... |
ANSIBLE_METADATA = {'status': ['stableinterface'],
'supported_by': 'community',
'version': '1.0'}
# import cloudstack common
from ansible.module_utils.cloudstack import *
class AnsibleCloudStackProject(AnsibleCloudStack):
def get_project(self):
if not self.projec... |
''' Provide decorators help with define Bokeh validation checks.
'''
from __future__ import absolute_import
from functools import partial
from six import string_types
def _validator(code_or_name, validator_type):
if validator_type == "error":
from .errors import codes
from .errors import EXT
... |
from django.contrib.flatpages.models import FlatPage
from django.template import loader, RequestContext
from django.shortcuts import get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from django.core.xheaders import populate_xheaders
from django.utils.safestri... |
"""AuthZ Adapter implementations of type managers."""
# pylint: disable=no-init
# Numerous classes don't require __init__.
# pylint: disable=too-many-public-methods
# Number of methods are defined in specification
# pylint: disable=too-many-ancestors
# Inheritance defined in specification
from . import s... |
try:
from f5.bigip.contexts import TransactionContextManager
from f5.bigip import ManagementRoot
HAS_F5SDK = True
except ImportError:
HAS_F5SDK = False
REQUIRED = ['name_servers', 'search', 'forwarders', 'ip_version', 'cache']
CACHE = ['disable', 'enable']
IP = [4, 6]
class BigIpDeviceDns(object):
... |
# coding: utf-8
"""Tests for IPython.core.application"""
import os
import tempfile
import nose.tools as nt
from traitlets import Unicode
from IPython.core.application import BaseIPythonApplication
from IPython.testing import decorators as dec
from IPython.utils.tempdir import TemporaryDirectory
@dec.onlyif_unicod... |
from oslo_serialization import jsonutils
from requests import exceptions
import six
from heat.common import exception
from heat.common import grouputils
from heat.common.i18n import _
from heat.common import template_format
from heat.common import urlfetch
from heat.engine import attributes
from heat.engine import env... |
# -*- coding: utf-8 -*-
"""
jinja2.exceptions
~~~~~~~~~~~~~~~~~
Jinja exceptions.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from jinja2._compat import imap, text_type, PY2, implements_to_string
class TemplateError(Exception):
"""Baseclass for al... |
# -*- coding: utf-8 -*-
import unittest
from ansible.parsing.utils.addresses import parse_address
class TestParseAddress(unittest.TestCase):
tests = {
# IPv4 addresses
'192.0.2.3': ['192.0.2.3', None],
'192.0.2.3:23': ['192.0.2.3', 23],
# IPv6 addresses
'::': ['::', None... |
#!/usr/bin/env python
from operator import add, sub
from random import randint, choice
ops = {'+': add, '-': sub}
MAXTRIES = 2
def doprob():
op = choice('+-')
nums = [ randint(1,10) for i in range(2) ]
nums.sort(reverse=True)
ans = ops[op](*nums)
pr = '%d %s %s = ' % (nums[0], op, nums[1])
oo... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
def main():
module = AnsibleModule(
argument_spec=dict(
name=dict(required=True, aliases=['publisher']),
state=dict(default='present', choices=['present'... |
import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
#'-Wall',
#'-Wextra',
#'-Werror',
#'-fexceptions',
'-DMASTER',
'-DVERSION_GI... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from ansible.module_utils._text import to_native
from ansible.plugins.filter.core import to_uuid
from ansible.errors import AnsibleFilterError
UUID_DEFAULT_NAMESPACE_TEST_CASES = (
('example.com', 'ae780c3a-a3ab-... |
from __future__ import absolute_import
from pychron.pipeline.plot.panels.figure_panel import FigurePanel
from pychron.pipeline.plot.plotter.iso_evo import IsoEvo
from pychron.processing.analysis_graph import AnalysisStackedRegressionGraph
class IsoEvoPanel(FigurePanel):
_figure_klass = IsoEvo
_graph_klass = A... |
import datetime
from calendar import timegm
from functools import wraps
from django.contrib.sites.shortcuts import get_current_site
from django.core import urlresolvers
from django.core.paginator import EmptyPage, PageNotAnInteger
from django.http import Http404
from django.template.response import TemplateResponse
fr... |
import types
# Class definition
class vizinfo:
"""
Information holder for Pizza.py visualization tools
acolor,bcolor,tcolor,lcolor = RGB values for each atom/bond/tri/line type
arad = radius of each atom type
brad,lrad = thickness of each bond/line type
tfill = fill flag for each triangle type
all o... |
from urlparse import urlparse
from django.contrib import messages
from django.template.loader import render_to_string
from django.template import RequestContext
from django.core.urlresolvers import reverse, resolve
from django.utils import simplejson as json
from django.db.models import get_model
from django.http impo... |
"""This module can be used for finding similar code"""
import re
import rope.refactor.wildcards
from rope.base import codeanalyze, evaluate, exceptions, ast, builtins
from rope.refactor import (patchedast, sourceutils, occurrences,
wildcards, importutils)
class BadNameInCheckError(exceptio... |
import pytest
from thefuck.rules.fab_command_not_found import match, get_new_command
from thefuck.types import Command
output = '''
Warning: Command(s) not found:
extenson
deloyp
Available commands:
update_config
prepare_extension
Template A string class for supporting $-substitutio... |
from django.conf import settings
PUSH_NOTIFICATIONS_SETTINGS = getattr(settings, "PUSH_NOTIFICATIONS_SETTINGS", {})
# GCM
PUSH_NOTIFICATIONS_SETTINGS.setdefault("GCM_POST_URL", "https://android.googleapis.com/gcm/send")
PUSH_NOTIFICATIONS_SETTINGS.setdefault("GCM_MAX_RECIPIENTS", 1000)
PUSH_NOTIFICATIONS_SETTINGS.set... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DsgTools
A QGIS plugin
Brazilian Army Cartographic Production Tools
-------------------
begin : 2018-09-05
git sha ... |
"""Component for the Goalfeed service."""
import json
import pysher
import requests
import voluptuous as vol
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
import homeassistant.helpers.config_validation as cv
# Version downgraded due to regression in library
# For details: https://github.com/nlsdfnbch/... |
# test the functions imported from cmath
try:
from cmath import *
except ImportError:
print("SKIP")
raise SystemExit
# make sure these constants exist in cmath
print("%.5g" % e)
print("%.5g" % pi)
test_values_non_zero = []
base_values = (0.0, 0.5, 1.2345, 10.)
for r in base_values:
for i in base_valu... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
HubDistanceLines.py
---------------------
Date : May 2010
Copyright : (C) 2010 by Michael Minn
Email : pyqgis at michaelminn dot com
********************... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import copy
import os
import re
import sys
import emit_html
import emit_rst
import emit_xml
topdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../')
topdir = os.path.realpath(topdir)
re_loggermessage = re.compile(r"@... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.