code stringlengths 1 199k |
|---|
from six import StringIO
import json
from cliff.formatters import json_format
import mock
def test_json_format_one():
sf = json_format.JSONFormatter()
c = ('a', 'b', 'c', 'd')
d = ('A', 'B', 'C', '"escape me"')
expected = {
'a': 'A',
'b': 'B',
'c': 'C',
'd': '"escape me"'... |
"""
Provider for Patreon
"""
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class VimeoOAuth2Account(ProviderAccount):
pass
class VimeoOAuth2Provider(OAuth2Provider):
id = 'vimeo_oauth2'
name = 'Vimeo'
account_c... |
"""
Global settings:
Those which are typically edited during a deployment are in
000_config.py & their results parsed into here. Deployers
shouldn't typically need to edit any settings here.
"""
s3.formats = Storage()
s3.interactive = settings.get_ui_confirm()
s3.base_url = "%s/%s" % (settings.get_base_... |
from taiga import TaigaAPI
import taiga.exceptions
import requests
import unittest
from mock import patch
from .tools import create_mock_json
from .tools import MockResponse
class TestAuthApp(unittest.TestCase):
@patch('taiga.client.requests')
def test_auth_success(self, requests):
requests.post.return_... |
version = 0x1081300
tools = [{'tool': 'relocation', 'tooldir': ['waf-tools'], 'funs': None}, {'tool': 'ar', 'tooldir': None, 'funs': None}, {'tool': 'c', 'tooldir': None, 'funs': None}, {'tool': 'gcc', 'tooldir': None, 'funs': None}, {'tool': 'compiler_c', 'tooldir': None, 'funs': None}, {'tool': 'cxx', 'tooldir': None... |
"""
Created on Tue Dec 9 11:10:56 2014
@author: MasterMac
"""
weight = float(raw_input())
height = float(raw_input())
bmi = weight / height**2
print round(bmi, 2) |
import gobject, sys, dbus
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
MM_DBUS_SERVICE='org.freedesktop.ModemManager'
MM_DBUS_PATH='/org/freedesktop/ModemManager'
MM_DBUS_INTERFACE='org.freedesktop.ModemManager'
MM_DBUS_INTERFACE_MODEM='org.freedesktop.ModemManager.Modem'
def modemAdd... |
import collections
import difflib
def find_common_prefix(a, b):
if not a or not b:
return 0
if a[0] == b[0]:
pointermax = min(len(a), len(b))
pointermid = pointermax
pointermin = 0
while pointermin < pointermid:
if a[pointermin:pointermid] == b[pointermin:poin... |
from skin import parseColor, parseFont, parseSize
from Components.config import config, ConfigClock, ConfigInteger, ConfigSubsection, ConfigYesNo, ConfigSelection, ConfigSelectionNumber
from Components.Pixmap import Pixmap
from Components.Button import Button
from Components.ActionMap import HelpableActionMap
from Comp... |
""" Dialogs for quotes """
from decimal import Decimal
from kiwi.currency import currency
from kiwi.enums import ListType
from kiwi.python import AttributeForwarder
from kiwi.ui.objectlist import Column
from kiwi.ui.listdialog import ListSlave
from storm.expr import And, LeftJoin, Or
from stoqlib.domain.purchase import... |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 lat... |
import os, shutil
version = '3.2.5'
class KeccakInstance:
def __init__(self, r, c, n=0):
self.r = r
self.c = c
self.n = n
self.name = 'keccak'
if (r+c != 1600):
self.name = self.name + 'r{0}'.format(r) + 'c{0}'.format(c)
elif (c != 576):
self.n... |
from gnuradio import gr
from gnuradio import filter
from gnuradio import blocks
import os
def graph ():
print os.getpid()
sampling_freq = 19200000
tb = gr.top_block ()
src0 = blocks.file_source(gr.sizeof_gr_complex,"/tmp/atsc_pipe_1")
duc_coeffs = filter.firdes.low_pass( 1, 19.2e6, 9e6, 1e6, filter.... |
"""Video functionality.
This class brings together PyCEGUI and OpenGL into a comfortable interface.
"""
import sys
import time
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import PyCEGUI
from PyCEGUIOpenGLRenderer import OpenGLRenderer
from constants import *
from errors import Initializat... |
from xbmctorrent import plugin
from xbmctorrent.scrapers import scraper
from xbmctorrent.ga import tracked
from xbmctorrent.caching import cached_route, shelf
from xbmctorrent.utils import ensure_fanart
from xbmctorrent.library import library_context
BASE_URL = "%s/" % plugin.get_setting("base_eztv")
HEADERS = {
"R... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: bigip_gtm_server
short_description: Manages F5 BIG-IP GTM serv... |
"""
THE self.lang[operator] PATTERN IS CASTING NEW OPERATORS TO OWN LANGUAGE;
KEEPING Python AS# Python, ES FILTERS AS ES FILTERS, AND Painless AS
Painless. WE COULD COPY partial_eval(), AND OTHERS, TO THIER RESPECTIVE
LANGUAGE, BUT WE KEEP CODE HERE SO THERE IS LESS OF IT
"""
from __future__ import absolute_import, di... |
import re
import fileinput
import sys
import shlex
nodes = {}
currentNode = None
nodeStartRegx = r'([^:]*):\s*((\'{|[^%{])*)'
nodeOrRegx = r'\|((\'{|[^{])*)'
def handleRule(line):
global currentNode
# Make a list off all nodes, and their expected children
if (line.startswith(';')):
currentNode = Non... |
import meta
import specific
import pdf
assembly_s, assembly_e = 17, 19 # start, end id of assembly
bill_s, bill_e = None, None # start, end number of bill
for a in range(assembly_s, assembly_e+1):
print '\n# Assembly %d' % a
print '## Get meta data'
npages = meta.get_npages(a)
meta.get_html(a, npage... |
"""
Tests for the functionality and infrastructure of grades tasks.
"""
import itertools
from collections import OrderedDict
from contextlib import contextmanager
from datetime import datetime, timedelta
import ddt
import pytz
import six
from django.conf import settings
from django.db.utils import IntegrityError
from d... |
"""
Serializer fields that deal with relationships.
These fields allow you to specify the style that should be used to represent
model relationships, including hyperlinks, primary keys, or slugs.
"""
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.urlresolvers import resolve, get... |
import logging
import time
from openerp.osv import fields,osv
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
from openerp.exceptions import UserError
_logger = logging.getLogger(__name__)
class delivery_carrier(osv.osv):
_name = "delivery.carrier"
_description = "Carrier"
... |
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('course_api.blocks.tests.test_forms', 'lms.djangoapps.course_api.blocks.tests.test_forms')
from lms.djangoapps.course_api.blocks.tests.test_forms import * |
"""Ttk wrapper.
This module provides classes to allow using Tk themed widget set.
Ttk is based on a revised and enhanced version of
TIP #48 (http://tip.tcl.tk/48) specified style engine.
Its basic idea is to separate, to the extent possible, the code
implementing a widget's behavior from the code implementing its
appea... |
import json
import logging
from .lib import validate
def addOptions(parser):
pass
def execCommand(args, following_args):
c = validate.currentDirectoryModule()
if not c:
return 1
if not args.target:
logging.error('No target has been set, use "yotta target" to set one.')
return 1
... |
"""
pygments.lexers.teraterm
~~~~~~~~~~~~~~~~~~~~~~~~
Lexer for Tera Term macro files.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygroups
from pygments.token import Text, Co... |
"""This code example gets all orders for a given advertiser. The statement
retrieves up to the maximum page size limit of 500. To create orders, run
create_orders.py. To determine which companies are advertisers, run
get_companies_by_statement.py."""
__author__ = 'api.shamjeff@gmail.com (Jeff Sham)'
import os
import sy... |
from subprocess import CalledProcessError
from unittest import skip
from tests.st.test_base import TestBase
from tests.st.utils.docker_host import DockerHost
"""
Test the calicoctl container <CONTAINER> ip add/remove commands w/ auto-assign
Tests the use of (libcalico) pycalico.ipam.IPAMClient.auto_assign_ips
within ca... |
import bson.json_util
import dateutil.parser
import inspect
import jsonschema
import os
import six
import cherrypy
from collections import OrderedDict
from girder import constants, logprint
from girder.api.rest import getCurrentUser, getBodyJson
from girder.constants import SettingKey, SortDir
from girder.exceptions im... |
"""The tests for the Google Wifi platform."""
from datetime import datetime, timedelta
from unittest.mock import Mock, patch
import homeassistant.components.google_wifi.sensor as google_wifi
from homeassistant.const import STATE_UNKNOWN
from homeassistant.setup import async_setup_component
from homeassistant.util impor... |
"""gGRC Collection REST services implementation. Common to all gGRC collection
resources.
"""
import datetime
import hashlib
import itertools
import json
import time
from logging import getLogger
from collections import defaultdict
from exceptions import TypeError
from wsgiref.handlers import format_date_time
from urll... |
import apache_beam as beam
from log_elements import LogElements
p = beam.Pipeline()
(p | beam.Create([10, 20, 30, 40, 50])
| beam.Map(lambda num: num * 5)
| LogElements())
p.run() |
x = 1
class C(object):
def __init__(self):
self.attr = 1
raise StopIteration
c = C()
y = 1 |
from __future__ import absolute_import
import argparse
try:
import pika # pylint disable=import-error
except ImportError:
raise ImportError(
"Pika is not installed with StackStorm. Install it manually to use this tool."
)
def main(queue, payload):
connection = pika.BlockingConnection(
p... |
from pathlib import Path
from subprocess import Popen # nosec
from time import sleep
from typing import IO
def _dialer_is_connected(log_path: str) -> bool:
with open(log_path, 'rb') as fobj:
for line in fobj:
if line.startswith(b'--> secondary DNS address'):
return True
retu... |
from oslo_config import cfg
import pkg_resources
from neutron._i18n import _
MIGRATION_ENTRYPOINTS = 'neutron.db.alembic_migrations'
migration_entrypoints = {
entrypoint.name: entrypoint
for entrypoint in pkg_resources.iter_entry_points(MIGRATION_ENTRYPOINTS)
}
INSTALLED_SUBPROJECTS = [project_ for project_ in ... |
from django.conf import settings
from importlib import import_module
import inspect
models_file = settings.NEWT_CONFIG['ADAPTERS']['STATUS']['models']
if models_file:
for name, model in inspect.getmembers(import_module(models_file), inspect.isclass):
locals()[name] = model |
import os
os.system("djtgcfg prog -d Nexys4DDR -i 0 -f ./build/top.bit") |
import m5.objects
import inspect
import sys
from textwrap import TextWrapper
_platform_classes = {}
_platform_aliases_all = [
("RealView_EB", "RealViewEB"),
("RealView_PBX", "RealViewPBX"),
("VExpress_GEM5", "VExpress_GEM5_V1"),
]
_platform_aliases = {}
def is_platform_class(cls):
"""Determine if a ... |
import datetime
from warnings import warn
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
from django.contrib.auth.signals import user_logged_in, user_logged_out
SESSION_KEY = '_auth_user_id'
BACKEND_SESSION_KEY = '_auth_user_backend'
REDIRECT_FIELD_NAME = 'next'... |
r"""
Acoustic pressure distribution in 3D.
Two Laplace equations, one in :math:`\Omega_1`, other in
:math:`\Omega_2`, connected on the interface region :math:`\Gamma_{12}`
using traces of variables.
Find two complex acoustic pressures :math:`p_1`, :math:`p_2` such that:
.. math::
\int_{\Omega} k^2 q p - \int_{\Omeg... |
def bfs(graph, start):
"""
Traverses a graph using Breadth First Search Algorithm.
It returns a set of nodes traversed.
"""
visited, queue = set(), [start]
while queue:
node = queue.pop(0)
if node not in visited:
visited.add(node)
# Add all the adjacent un... |
"""Open an arbitrary URL.
See the following document for more info on URLs:
"Names and Addresses, URIs, URLs, URNs, URCs", at
http://www.w3.org/pub/WWW/Addressing/Overview.html
See also the HTTP spec (from which the error codes are derived):
"HTTP - Hypertext Transfer Protocol", at
http://www.w3.org/pub/WWW/Protocols/
... |
from __future__ import unicode_literals, division, absolute_import
from flexget import options, plugin
from flexget.event import event
from flexget.logger import console
from flexget.manager import Session
try:
from flexget.plugins.api_t411 import (T411Proxy)
except:
raise plugin.DependencyError(issued_by='cli_... |
import pycept
import unittest
class ClientTestCase(unittest.TestCase):
def testTinyEmptyBitMapToSdr(self):
client = pycept.Cept('foo', 'bar')
result = client._bitmapToSdr({
'width': 1,
'height': 1,
'positions': []
})
self.assertEqual(result, "0")
def testTinyFullBitMapToSdr(self):
... |
from __future__ import absolute_import
from __future__ import print_function
import autograd.numpy as np
from autograd import value_and_grad
from scipy.optimize import minimize
import matplotlib.pyplot as plt
import os
from six.moves import range
rows, cols = 40, 60
def occlude(f, occlusion):
return f * (1 - occlus... |
import argparse
from oschecks import utils
def check_amqp():
parser = argparse.ArgumentParser(
description='Check amqp connection of an OpenStack service.')
parser.add_argument(dest='process_name',
help='Process name')
options = parser.parse_args()
utils.check_process_exi... |
import sys
import gi
gi.require_version('NM', '1.0')
from gi.repository import GLib, NM
main_loop = None
def do_notify(self, property):
print "notify: %s" % property
ip4cfg = self.get_ip4_config()
if ip4cfg is not None:
print "ip4-config: %s" % ip4cfg.get_path()
main_loop.quit()
def state_ch... |
import os
import threading
import datetime
import time
import urllib2
from xml.etree import ElementTree
from strings import *
import xbmc
import xbmcgui
import xbmcvfs
import sqlite3
SETTINGS_TO_CHECK = ['source', 'xmltv.type', 'xmltv.file', 'xmltv.url', 'xmltv.logo.folder']
class Channel(object):
def __init__(self... |
"""
Exception used when the URI is not for the current driver
(ie. radio:// for the serial driver ...)
It basically means that an other driver could do the job
It does NOT means that the URI is good or bad
"""
__author__ = 'Bitcraze AB'
__all__ = ['WrongUriType', 'CommunicationException']
class WrongUriType (Exception)... |
from pulp_puppet.devel import base_cli
from pulp_puppet.extensions.admin import structure
class StructureTests(base_cli.ExtensionTests):
def test_ensure_puppet_root(self):
# Test
returned_root_section = structure.ensure_puppet_root(self.cli)
# Verify
self.assertTrue(returned_root_sec... |
"""sympify -- convert objects SymPy internal format"""
from __future__ import print_function, division
from inspect import getmro
from .core import all_classes as sympy_classes
from .compatibility import iterable, string_types, range
from .evaluate import global_evaluate
class SympifyError(ValueError):
def __init__... |
from gnuradio import gr, gru, blocks
from gnuradio import usrp
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from gnuradio.wxgui import stdgui2, fftsink2, waterfallsink2, scopesink2, form, slider
from optparse import OptionParser
import wx
import sys
import numpy
def pick_subdevice(u):
... |
from __future__ import unicode_literals
import re
from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator
from django.utils.deconstruct import deconstructible
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
class NLZipCode... |
from __future__ import print_function
import hdr_parser, sys, re, os
from string import Template
if sys.version_info[0] >= 3:
from io import StringIO
else:
from cStringIO import StringIO
ignored_arg_types = ["RNG*"]
gen_template_check_self = Template(""" if(!PyObject_TypeCheck(self, &pyopencv_${name}_Type))
... |
import pytest_bdd as bdd
bdd.scenarios('keyinput.feature') |
import unittest
import subprocess
import os
class CompatibilityTests(unittest.TestCase):
def test_except(self):
path = os.path.abspath('..')
pyfiles = []
for rootdir in ['sickbeard', 'tests']:
for dirpath, subdirs, files in os.walk(os.path.join(path, rootdir)):
fo... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('model', '0012_branch_maxlen'),
]
operations = [
migrations.AlterField(
model_name='push',
name='revision',
field=models.CharField(db_index=True, max_length=4... |
import logging
from datetime import timedelta
from odoo import api, fields, models
_logger = logging.getLogger(__name__)
class AlarmManager(models.AbstractModel):
_name = 'calendar.alarm_manager'
_description = 'Event Alarm Manager'
def _get_next_potential_limit_alarm(self, alarm_type, seconds=None, partner... |
from osv import fields, osv
from tools.translate import _
import netsvc
from dateutil import parser
from datetime import date
class rent_check_invoicing(osv.osv_memory):
_name = "rent.check.invoicing"
_description = "Force the verficiation of invoices until today"
def fields_view_get(self, cr, uid, view_id=None, vie... |
from spack import *
class Extendee(Package):
"""A package with extensions"""
homepage = "http://www.example.com"
url = "http://www.example.com/extendee-1.0.tar.gz"
extendable = True
version('1.0', '0123456789abcdef0123456789abcdef')
def install(self, spec, prefix):
mkdirp(prefix.bin... |
import myhdl
from myhdl import *
def bug_28(dout, channel):
@always_comb
def comb():
dout.next = 0x8030 + (channel << 10)
return comb
dout = Signal(intbv(0)[16:0])
channel = Signal(intbv(0)[4:0])
def test_bug_28():
try:
toVHDL(bug_28, dout, channel)
except:
raise |
from rtc_handle import *
from BasicDataType_idl import *
import time
import commands
import SDOPackage
import os
g_test_name = "<< component connection test >>"
env = RtmEnv(sys.argv, ["localhost:2809"])
list0 = env.name_space["localhost:2809"].list_obj()
env.name_space['localhost:2809'].rtc_handles.keys()
ns = env.nam... |
import numpy as np
from .base import classifier
from .base import regressor
from numpy import asarray as arr
from numpy import asmatrix as mat
class knnClassify(classifier):
"""A k-nearest neighbor classifier
Attributes:
Xtr,Ytr : training data (features and target classes)
classes : a list of t... |
import fnmatch
import glob
import os
import re
import tempfile
from datetime import datetime
from gppylib import gplog
from gppylib.commands.base import WorkerPool, Command, REMOTE
from gppylib.commands.unix import Scp
from gppylib.db import dbconn
from gppylib.db.dbconn import execSQL
from gppylib.gparray import GpArr... |
from django.conf.urls import url
from api.nodes import views
app_name = 'osf'
urlpatterns = [
# Examples:
# url(r'^$', 'api.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', views.NodeList.as_view(), name=views.NodeList.view_name),
url(r'^(?P<node_id>\w+)/$', views.NodeDe... |
from tempest_lib.common.utils import data_utils
from tempest.api.compute import base
from tempest import test
class ServersTestJSON(base.BaseV2ComputeTest):
@classmethod
def setup_clients(cls):
super(ServersTestJSON, cls).setup_clients()
cls.client = cls.servers_client
def tearDown(self):
... |
"""Tests for Uniform distribution."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from scipy import stats
import tensorflow as tf
class UniformTest(tf.test.TestCase):
def testUniformRange(self):
with self.test_session():
a =... |
"""Script to run unit tests for the entire project.
This script orchestrates stepping into each sub-package and
running tests. It also allows running a limited subset of tests
in cases where such a limited subset can be identified.
"""
from __future__ import print_function
import argparse
import os
import subprocess
im... |
import pytest
from rancher import ApiError
from .common import * # NOQA
namespace = {"p_client": None,
"ns": None,
"cluster": None,
"project": None,
"pv": None,
"pvc": None}
MOUNT_PATH = "/var/nfs"
DELETE_NFS = eval(os.environ.get('RANCHER_DELETE_NFS', "... |
import httplib as http
import contextlib
import mock
from nose.tools import * # flake8: noqa
import re
from tests.base import ApiTestCase, DbTestCase
from tests import factories
from tests.utils import make_drf_request
from api.base.settings.defaults import API_BASE
from api.base.serializers import JSONAPISerializer
f... |
import sys
import unittest
from dynd import nd, ndt
class TestInt128(unittest.TestCase):
def test_pyconvert(self):
# Conversions to/from python longs
a = nd.empty(ndt.int128)
a[...] = 1
self.assertEqual(nd.as_py(a), 1)
a[...] = 12345
self.assertEqual(nd.as_py(a), 1234... |
"""
Tests for CountModel class, which includes various linear models designed for
count data
Test data is the Columbus dataset after it has been rounded to integers to act
as count data. Results are verified using corresponding functions in R.
"""
__author__ = 'Taylor Oshan tayoshan@gmail.com'
import unittest
import nu... |
"""Plot embedded in HTML wrapper with custom user events..."""
import matplotlib
matplotlib.use('module://mplh5canvas.backend_h5canvas')
from pylab import *
import time
sensor_list = ['enviro.wind_speed','enviro.wind_direction','enviro.ambient_temperature','enviro.humidity']
def user_cmd_ret(*args):
"""Handle any d... |
from __future__ import division, unicode_literals, print_function
from django.db import models
from libs.models.mixins import QuerysetMixin
class Rule(models.Model, QuerysetMixin):
class Meta:
app_label = "weixin"
db_table = "weixin_rule"
verbose_name = verbose_name_plural = "关键字"
text =... |
"""This test unit checks node attributes that are persistent (AttributeSet)."""
from __future__ import print_function
import sys
from distutils.version import LooseVersion
import numpy
from numpy.testing import assert_array_equal, assert_almost_equal
import tables
from tables import (IsDescription, Int32Atom, StringCol... |
import datetime
from django.core import signing
from django.test import SimpleTestCase
from django.test.utils import freeze_time
from django.utils.crypto import InvalidAlgorithm
class TestSigner(SimpleTestCase):
def test_signature(self):
"signature() method should generate a signature"
signer = sign... |
from __future__ import absolute_import
import copy
from pkg_resources import iter_entry_points
from . import imageProcessing
from . import imageSegmentation
from . import objectDetection
GROUP = "digits.plugins.data"
builtin_data_extensions = [
imageProcessing.DataIngestion,
imageSegmentation.DataIngestion,
... |
"""
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import os
import astropy as apy
from astropy import units as u
from astropy import constants as const
from astropy.io import fits
from xastropy.xutils import xdebug as xdb
'''
DEPRECATED
''' |
import itertools as it
import warnings
from copy import copy
from time import time
import sqlalchemy as sa
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy_continuum import (
make_versioned,
versioning_manager,
... |
"""
TrainExtension subclass for calculating ROC AUC scores on monitoring
dataset(s), reported via monitor channels.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
__maintainer__ = "Steven Kearnes"
import numpy as np
try:
from sklearn.metrics impo... |
from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns
from .provider import NextCloudProvider
urlpatterns = default_urlpatterns(NextCloudProvider) |
"""Unit tests for pycsw.core.repository"""
import pytest
from pycsw.core import repository
pytestmark = pytest.mark.unit
@pytest.mark.parametrize("data, input_, predicate, distance, expected", [
("LINESTRING(0 0, 1 1)", "POINT(0.5 0.5)", "bbox", 0, "true"),
("LINESTRING(0 0, 1 1)", "POINT(2 2)", "bbox", 0, "fal... |
try:
import array
import ustruct
except ImportError:
print("SKIP")
raise SystemExit
try:
exec('def f(): super()')
except SyntaxError:
print('SyntaxError')
try:
ValueError().x = 0
except AttributeError:
print('AttributeError')
try:
a = array.array('b', (1, 2, 3))
del a[1]
except T... |
import gobject
import pygst
pygst.require("0.10")
import gst
from core import Input, INPUT_TYPE_AUDIO
CAPABILITIES = INPUT_TYPE_AUDIO
class AudioTestInput(Input):
def __init__(self):
Input.__init__(self, CAPABILITIES)
self.audio_src = gst.element_factory_make("audiotestsrc", "audio_src")
sel... |
""" Error handling library """
__revision__ = "$Id$"
import traceback
import os
import sys
import time
import datetime
import re
import inspect
from cStringIO import StringIO
from invenio.config import CFG_SITE_LANG, CFG_LOGDIR, \
CFG_WEBALERT_ALERT_ENGINE_EMAIL, CFG_SITE_ADMIN_EMAIL, \
CFG_SITE_SUPPORT_EMAIL, ... |
import math
import logging
import hashlib
import datetime
import socket
import base64
import warnings
import threading
import six
from six import iteritems
md5string = lambda x: hashlib.md5(utf8(x)).hexdigest()
class ReadOnlyDict(dict):
"""A Read Only Dict"""
def __setitem__(self, key, value):
raise Exc... |
from base64 import b64encode
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
import json
import urllib
import urllib2
class Command(BaseCommand):
help = 'Synchronizes a geogit repository using the Geoserver-Geogit api.'
args = '<arg>'
option_list = BaseComm... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import time
import glob
import urlparse
from ansible.module_utils._text import to_text
from ansible.plugins.action import ActionBase
BOOLEANS = ('true', 'false', 'yes', 'no')
class ActionModule(ActionBase):
TRANSFERS_F... |
import subprocess;
import re;
import json;
import sys;
import os;
import importlib;
import common;
scriptdir = os.path.dirname(os.path.realpath(__file__))
basedir = scriptdir+"/../"
sys.path.append(basedir+"scripts");
sys.path.append(basedir+"boards");
import pinutils;
def die(err):
sys.stderr.write("ERROR: "+err+"\n... |
{
'name': "Tripadvisor Social Media Icon Extension",
'summary': """Tripadvisor Extension for the social media icons from the
odoo core""",
'author': "bloopark systems GmbH & Co. KG, "
"Odoo Community Association (OCA)",
'website': "http://www.bloopark.de",
'license': 'AGPL-3',
... |
import urllib
from weboob.deprecated.browser import Browser, BrowserIncorrectPassword
from weboob.deprecated.browser.parsers.jsonparser import JsonParser
from .pages import LoginPage, PostLoginPage, AccountsPage, TransactionsPage, CBTransactionsPage, UnavailablePage, PredisconnectedPage
__all__ = ['AXABanque']
class AX... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp.tools.safe_eval import safe_eval as eval
import openerp.addons.decimal_precision as dp
from openerp.tools.float_utils import float_round
class product_product(osv.osv):
_inherit = "product.product"
def _stock_move_count(self,... |
from . import account_invoice
from . import sale_order_type
from . import sale_order
from . import stock_picking
from . import res_partner |
from spack import *
class BppSeq(CMakePackage):
"""Bio++ seq library."""
homepage = "http://biopp.univ-montp2.fr/wiki/index.php/Installation"
url = "http://biopp.univ-montp2.fr/repos/sources/bpp-seq-2.2.0.tar.gz"
version('2.2.0', '44adef0ff4d5ca4e69ccf258c9270633')
depends_on('cmake@2.6:', type... |
from load_model import load_checkpoint
from save_model import save_checkpoint
def combine_model(prefix1, epoch1, prefix2, epoch2, prefix_out, epoch_out):
args1, auxs1 = load_checkpoint(prefix1, epoch1)
args2, auxs2 = load_checkpoint(prefix2, epoch2)
arg_names = args1.keys() + args2.keys()
aux_names = au... |
from sahara import exceptions as ex
from sahara.i18n import _
from sahara.plugins import base as plugins_base
from sahara.utils import resources
class ProvisioningPluginBase(plugins_base.PluginInterface):
@plugins_base.required
def get_versions(self):
pass
@plugins_base.required
def get_configs(... |
import gevent
import gevent.event
from gevent.queue import Queue
from gevent import select, socket
import gevent.ssl
from collections import defaultdict
from functools import partial
import logging
import os
import time
from six.moves import range
from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, EINVAL
from cassan... |
"""Support for the IBM Watson IoT Platform."""
import logging
import queue
import threading
import time
from ibmiotf import MissingMessageEncoderException
from ibmiotf.gateway import Client
import voluptuous as vol
from homeassistant.const import (
CONF_DOMAINS,
CONF_ENTITIES,
CONF_EXCLUDE,
CONF_ID,
... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetFolderMetadata(Choreography):
def __init__(self, temboo_session):
"""
Create ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.