content string |
|---|
import xml.etree.cElementTree as ET
from DDEXUI.ddex.enum import enum
PartyType = enum(MessageSender=1, MessageRecipient=2)
class Party:
def __init__(self, party_id, name, party_type=PartyType.MessageSender):
self.party_id = party_id
self.name = name
self.party_type = party_type
def w... |
# -*- coding: utf-8 -*-
"""
tests.regression
~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests regressions.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pytest
import os
import gc
import sys
import flask
import threading
from werkzeug.exceptions import NotFound
... |
#!/usr/bin/env python
'''
extra DMA mapping tables from a stm32 datasheet
This assumes a csv file extracted from the datasheet using tablula:
https://github.com/tabulapdf/tabula
'''
import sys, csv, os
def parse_dma_table(fname, table):
dma_num = 1
csvt = csv.reader(open(fname,'rb'))
i = 0
last_cha... |
"""
Testing for the approximate neighbor search using
Locality Sensitive Hashing Forest module
(sklearn.neighbors.LSHForest).
"""
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import a... |
"""
Check that all of the certs on all service endpoints validate.
"""
import unittest
from tests.integration import ServiceCertVerificationTest
import boto.cloudsearch
class CloudSearchCertVerificationTest(unittest.TestCase, ServiceCertVerificationTest):
cloudsearch = True
regions = boto.cloudsearch.region... |
__author__ = 'bromix'
import datetime
import re
__RE_MATCH_TIME_ONLY__ = re.compile(r'^(?P<hour>[0-9]{2})([:]?(?P<minute>[0-9]{2})([:]?(?P<second>[0-9]{2}))?)?$')
__RE_MATCH_DATE_ONLY__ = re.compile(r'^(?P<year>[0-9]{4})[-]?(?P<month>[0-9]{2})[-]?(?P<day>[0-9]{2})$')
__RE_MATCH_DATETIME__ = re.compile(
r'^(?P<yea... |
"""
This file defines RandomPictureExplorer, an explorer for
PictureSensor.
"""
# Third-party imports
import numpy
# Local imports
from nupic.regions.PictureSensor import PictureSensor
class RandomPictureExplorer(PictureSensor.PictureExplorer):
"""
Presents smoothly varying sequences of randomly selected
cat... |
from msrest.serialization import Model
class ApplicationUpgradeUpdateDescription(Model):
"""Describes the parameters for updating an ongoing application upgrade.
:param name:
:type name: str
:param upgrade_kind: Possible values include: 'Invalid', 'Rolling'.
Default value: "Rolling" .
:type ... |
import unittest
from paegan.transport.models.behaviors.capability import Capability
import os
import json
class CapabilityTest(unittest.TestCase):
def test_from_json(self):
data = open(os.path.normpath(os.path.join(os.path.dirname(__file__), "./resources/files/capability_behavior.json"))).read()
... |
__author__ = 'Scott Ficarro, William Max Alexander'
__version__ = '1.0'
#Filter management
import re
def Onms1(filter_dict, id):
filter_dict["mode"]="ms1"
filter_dict["analyzer"]=id.groups()[0]
filter_dict["data"]= "+cent" if id.groups()[1]== "c" else "+prof"
filter_dict["mr"]='[' + id.groups()[2]+'-... |
__doc__ = """This is the starting point for the single web application.
Other html code is dynamically loaded via angularJS and located in
/static/views/...
"""
__author__ = "Cornelius Kölbel, <<EMAIL>>"
from flask import (Blueprint, render_template, request,
current_app)
from privacyidea.api.lib.pr... |
from influxdb_metrics.loader import write_points
from karrot.groups.stats import group_tags
def activity_tags(activity):
tags = group_tags(activity.place.group)
tags.update({
'place': str(activity.place.id),
'type': str(activity.activity_type.id),
'type_name': activity.activity_type.n... |
"""
Tests of .htaccess file generation.
For now, this just checks whether the demo site's generated .htaccess file
matches a known good file.
"""
import os
import sys
from django.conf import settings
TEST_ROOT = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.abspath(TEST_ROOT + "/..")
sys.path = [ROOT]... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_find
version_added: "2.3"
short_description: Return a list of files based on specific criteria
description:
- Return a list of files based ... |
"""
=================================================
SVM: Separating hyperplane for unbalanced classes
=================================================
Find the optimal separating hyperplane using an SVC for classes that
are unbalanced.
We first find the separating plane with a plain SVC and then plot
(dashed) the ... |
"""Generic Internet address helper functions."""
import socket
import dns.ipv4
import dns.ipv6
# We assume that AF_INET is always defined.
AF_INET = socket.AF_INET
# AF_INET6 might not be defined in the socket module, but we need it.
# We'll try to use the socket module's value, and if it doesn't work,
# we'll us... |
"""
The Spatial Reference class, represents OGR Spatial Reference objects.
Example:
>>> from django.contrib.gis.gdal import SpatialReference
>>> srs = SpatialReference('WGS84')
>>> print(srs)
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY... |
from boto.sqs.regioninfo import SQSRegionInfo
from boto.regioninfo import get_regions
def regions():
"""
Get all available regions for the SQS service.
:rtype: list
:return: A list of :class:`boto.sqs.regioninfo.RegionInfo`
"""
from boto.sqs.connection import SQSConnection
return get_regi... |
import json
import os
DEFAULT_CREDENTIAL_PATH = os.path.join(
os.path.dirname(__file__), os.path.pardir, 'data', 'credentials.json')
def GetAccountNameAndPassword(credential,
credentials_path=DEFAULT_CREDENTIAL_PATH):
"""Returns username and password for |credential| in credentia... |
"""
NTLM authenticating pool, contributed by erikcederstran
Issue #10, see: http://code.google.com/p/urllib3/issues/detail?id=10
"""
try:
from http.client import HTTPSConnection
except ImportError:
from httplib import HTTPSConnection
from logging import getLogger
from ntlm import ntlm
from urllib3 import HTT... |
"""Serializer fields"""
from __future__ import absolute_import
import collections
from django.contrib.gis import geos, forms
from django.db.models.query import QuerySet
from rest_framework import renderers
from rest_framework.fields import Field, FileField
from spillway.compat import json
from spillway.forms import f... |
from ctypes import *
import unittest, sys
from ctypes.test import requires
################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.
from _ctypes import PyObj_FromPtr
################################################################
from... |
from oslo_config import cfg
from oslo_log import log as logging
import taskflow.engines
from taskflow.patterns import linear_flow
from taskflow.types import failure as ft
from cinder import exception
from cinder import flow_utils
from cinder.i18n import _LE
from cinder.volume.flows import common
LOG = logging.getLogg... |
import point_of_sale
import res_users
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""
Test methods in twisted.internet.threads and reactor thread APIs.
"""
import sys, os, time
from twisted.trial import unittest
from twisted.internet import reactor, defer, interfaces, threads, protocol, error
from twisted.python import failure, threadable, log, threadpool
class ReactorThreadsTestCase(unittest.... |
from __future__ import unicode_literals
import bisect
import io
import logging
import os
import pkgutil
import shutil
import sys
import types
import zipimport
from . import DistlibException
from .util import cached_property, get_cache_base, path_to_cache_dir, Cache
logger = logging.getLogger(__name__)
cache = None... |
"""Email pipeline to perform notifications"""
from datetime import datetime
# TODO: Investigate improving so we can avoid the pylint disable.
# pylint: disable=line-too-long
from google.cloud.security.common.util import log_util
from google.cloud.security.common.util import parser
from google.cloud.security.common.ut... |
from datetime import datetime
import alerts.geomodel.alert as alert
import alerts.geomodel.factors as factors
class MockMMDB:
'''Mocks a MaxMind database connection with a dictionary of records mapping
IP adresses to dictionaries containing information about ASNs.
'''
def __init__(self, records):
... |
import codecs
import collections
import logging
import os
from binascii import hexlify
from twisted.internet import reactor
from twisted.internet.defer import DeferredList
from Tribler.Core.Modules.channel.channel_rss import ChannelRssParser
import Tribler.Core.Utilities.json_util as json
from Tribler.Core.simpledefs ... |
import os
import sys
import json
import unittest
import luigi
import luigi.format
import luigi.contrib.hadoop
import luigi.contrib.hdfs
import luigi.contrib.mrrunner
import luigi.notifications
import minicluster
import mock
from luigi.mock import MockTarget
from luigi.six import StringIO
from nose.plugins.attrib impor... |
"""
Unit tests for functionsource.
"""
import pickle
import unittest
from nupic.data import FunctionSource
def dataFunction(stat):
ret = {"reset": 0, "sequence": 0, "data": 0}
if stat is not None:
val = stat.get("val", 0) + 1
ret["val"] = stat["val"] = val
return ret
class FunctionSourceTest(unittes... |
"""
Tests for L{twisted.python.hashlib}
"""
from twisted.trial.unittest import TestCase
from twisted.python.hashlib import md5, sha1
class HashObjectTests(TestCase):
"""
Tests for the hash object APIs presented by L{hashlib}, C{md5} and C{sha1}.
"""
def test_md5(self):
"""
L{hashlib.... |
"""Utilities for extracting common archive formats"""
__all__ = [
"unpack_archive", "unpack_zipfile", "unpack_tarfile", "default_filter",
"UnrecognizedFormat", "extraction_drivers", "unpack_directory",
]
import zipfile
import tarfile
import os
import shutil
import posixpath
import contextlib
from pkg_resourc... |
import Adafruit_DHT
import time
import json
import httplib
import sys
URL='bb-smart-home.herokuapp.com'
DEVICE_NAME ='raspberry'
def temperature_humidity(sensor,pin):
humidity, temperature = Adafruit_DHT.read_retry(sensor,pin)
if humidity is not None and temperature is not None:
return [temperature,humidity]
els... |
"""Gets and writes the configurations of the attached devices.
This configuration is used by later build steps to determine which devices to
install to and what needs to be installed to those devices.
"""
import optparse
import sys
from util import build_utils
from util import build_device
def main(argv):
parser... |
from django.conf.urls import url, include
from apps.models.models import Initiative
from . import views
urlpatterns = [
url(r'^initiative$', views.initiative_service, name='get_initiative'),
url(r'^initiatives$', views.initiatives_service, name='get_initiatives'),
url(r'^initiatives_featured$', views.initi... |
#
#-*- coding:utf-8 -*-
"""
Gentoo-Keys - Log.py
Logging module, placeholder for our site-wide logging module
@copyright: 2012 by Brian Dolbec <dol-sen> <<EMAIL>>
@license: GNU GPL2, see COPYING for details.
"""
import logging
import time
import os
NAMESPACE = 'gentoo-keys'
logger = None
Console_h... |
import numpy as np
import swiftnav.lambda_ as l
def test_lambda1():
m = 2
x = np.array([1585184.171,
-6716599.430,
3915742.905,
7627233.455,
9565990.879,
989457273.200])
sigma = np.matrix([[0.227134, 0.112202, 0.112202, 0.11220... |
import os.path
import tornado.gen as gen
import tornado.web
import urlparse
import json
from thumbor.handlers.imaging import ImagingHandler
from thumbor.utils import logger
from tc_shortener.shortener import Shortener
from tc_core.web import RequestParser
class UrlShortenerHandler(ImagingHandler):
should_retur... |
import re
from django.conf import settings
from django.http import HttpResponsePermanentRedirect
class SecurityMiddleware(object):
def __init__(self):
self.sts_seconds = settings.SECURE_HSTS_SECONDS
self.sts_include_subdomains = settings.SECURE_HSTS_INCLUDE_SUBDOMAINS
self.content_type_no... |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 Lic... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
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`... |
"""
Wrapper module around the standard argparse that extends the default
functionality with support for multi-destination actions, an expressive DSL for
constructing parsers and more argument types. This module exposes a strict
super-set of the argparse API and is meant to be used as a drop-in replacement.
"""
from a... |
import mock
import github3
from addons.github.api import GitHubClient
from github3.repos.branch import Branch
from addons.base.tests.base import OAuthAddonTestCaseMixin, AddonTestCase
from addons.github.models import GitHubProvider
from addons.github.tests.factories import GitHubAccountFactory
class GitHubAddonTestC... |
import re
import sys
SWIFTMODULE_BUNDLE_RE = re.compile(
r'key.filepath: ".*[/\\](.*)\.swiftmodule[/\\].*\.swiftmodule"')
SWIFTMODULE_RE = re.compile(r'key.filepath: ".*[/\\](.*)\.swiftmodule"')
SWIFT_RE = re.compile(r'key.filepath: ".*[/\\](.*)\.swift"')
PCM_RE = re.compile(r'key.filepath: ".*[/\\](.*)-[0-9A-Z]*\... |
import os
import tempfile
import shutil
import subprocess
import fxos_appgen
import gaiatest
import mozdevice
import moznetwork
import mozrunner
from marionette import expected
from marionette.by import By
from marionette.wait import Wait
from mozprofile import FirefoxProfile, Preferences
from .base import get_free_p... |
"""
Config.py is a repository of the Cobbler object model
Copyright 2006-2008, Red Hat, Inc
Michael DeHaan <<EMAIL>>
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, ... |
cnfClass = None
class Variable(object):
def __init__(self, name, inverted=False):
self.name = name
self.inverted = inverted
def __neg__(self):
v = Variable(self.name)
v.inverted = not self.inverted
return v
def __and__(self, other):
c = cnfClass.create_from... |
import datetime
from dateutil.parser import parse as parse_date
from dateutil.relativedelta import relativedelta
from dateutil.tz import tzlocal
from random import randint
from weboob.capabilities.base import NotAvailable
from weboob.capabilities.messages import CapMessages, CapMessagesPost, Thread, Message
from weboo... |
"""Unit tests for ttest module."""
import unittest
import ttest
# This test case accesses private functions of the ttest module.
# pylint: disable=W0212
class TTestTest(unittest.TestCase):
"""Tests for the t-test functions."""
def testWelchsFormula(self):
"""Tests calculation of the t value."""
# Resul... |
"""Unit test utilities for gtest_xml_output"""
__author__ = '<EMAIL> (Sean Mcafee)'
import re
from xml.dom import minidom, Node
import gtest_test_utils
GTEST_OUTPUT_FLAG = '--gtest_output'
GTEST_DEFAULT_OUTPUT_FILE = 'test_detail.xml'
class GTestXMLTestCase(gtest_test_utils.TestCase):
"""
Base class f... |
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
from openstack_dashboard.api import nova
from openstack_dashboard.dashboards.admin.hypervisors.compute \
import tabs as cmp_tabs
from openstack_dashboard.dashboards.admin.hypervisors import tables
cla... |
"""Main function to run the layout test analyzer.
The purpose of this script is to run the layout test analyzer for various
teams based on the run configuration file in CSV format. The CSV file is based
on https://sites.google.com/a/chromium.org/dev/developers/testing/
webkit-layout-tests/layout-test-stats-1.
"""
imp... |
# -*- coding: utf-8 -*-
"""
sphinx.ext.autosummary
~~~~~~~~~~~~~~~~~~~~~~
Sphinx extension that adds an autosummary:: directive, which can be
used to generate function/method/attribute/etc. summary lists, similar
to those output eg. by Epydoc and other API doc generation tools.
An :autolink: r... |
"""The testing Environment class.
It holds the WebsiteTest instances, provides them with credentials,
provides clean browser environment, runs the tests, and gathers the
results.
"""
import os
import shutil
import time
from xml.etree import ElementTree
from selenium import webdriver
from selenium.webdriver.chrome.op... |
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.dashboards.project import dashboard
class Clusters(horizon.Panel):
name = _("Clusters")
slug = 'database_clusters'
permissions = ('openstack.services.database',
'openstack.services.object-st... |
# coding=utf-8
import csv
import logging
from random import shuffle
from django.core.mail import send_mail
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.models import User
from xkcdpass import xkcd_password as xp
from unidecode import unidecode
from classgrade import settings
from grada... |
import os
import fnmatch
def find(pattern, classPaths):
paths = classPaths.split(os.pathsep)
# for each class path
for path in paths:
# remove * if it's at the end of path
if ((path is not None) and (len(path) > 0) and (path[-1] == '*')) :
path = path[:-1]
for root... |
"""Tests for the CsvDataset serialization."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gzip
import os
from tensorflow.python.data.experimental.kernel_tests.serialization import dataset_serialization_test_base
from tensorflow.python.data.experi... |
from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User
from django.conf import settings
from django_comment_common.models import (
Role, FORUM_ROLE_ADMINISTRATOR, FORUM_ROLE_MODERATOR, FORUM_ROLE_STUDENT)
from django_comment_common.utils import seed_permis... |
import unittest
from test import WebserviceTest
from intermine.webservice import *
from intermine.query import Template
from intermine.constraints import TemplateConstraint
class TestTemplates(WebserviceTest): # pragma: no cover
def setUp(self):
self.service = Service(self.get_test_root())
def testG... |
from __future__ import print_function, division
from sympy.core.compatibility import reduce
from operator import add
from sympy.core import Add, Basic, sympify
from sympy.functions import adjoint
from sympy.matrices.matrices import MatrixBase
from sympy.matrices.expressions.transpose import transpose
from sympy.strat... |
"""DNS Reverse Map Names.
@var ipv4_reverse_domain: The DNS IPv4 reverse-map domain, in-addr.arpa.
@type ipv4_reverse_domain: dns.name.Name object
@var ipv6_reverse_domain: The DNS IPv6 reverse-map domain, ip6.arpa.
@type ipv6_reverse_domain: dns.name.Name object
"""
import dns.name
import dns.ipv6
import dns.ipv4
i... |
#!/usr/bin/python
import math
import random
from quats import Quat
# Rotates a vector with respect to a quat.
# The vector is from R^3, the result is from R^3, rot_quat is a unit quat.
def rotate1(vector, unit_quat):
"""Return the rotated vector (rot_quat used)."""
# From a vector to a quaternion.
vec_qua... |
"""
Stub implementation of an HTTP service.
"""
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
import urllib
import urlparse
import threading
import json
from functools import wraps
from lazy import lazy
from logging import getLogger
LOGGER = getLogger(__name__)
def require_params(method, *required_k... |
import pygame as pg
import tilerenderer
from tower import Tower, CannonTower, ExplosiveTower, FireTower, SlowTower, MultiTower, LaserTower, CrescentTower
from trap import Mine
from creep import Creep, Worm, Behemoth, SwiftWalker
from os import path, pardir
import random
Vector = pg.math.Vector2
CREEP = 0
WORM = 1
B... |
import functools
import click
from tower_cli.conf import settings
from tower_cli import exceptions # NOQA
@functools.wraps(click.secho)
def secho(message, **kwargs):
"""A wrapper around click.secho that disables any coloring being used
if colors have been disabled.
"""
# If colors are disabled, remo... |
"""
Checks that C-only targets aren't linked against libstdc++.
"""
import TestGyp
import re
import subprocess
import sys
# set |match| to ignore build stderr output.
test = TestGyp.TestGyp(match = lambda a, b: True)
if sys.platform != 'win32' and test.format not in ('make', 'android'):
# TODO: This doesn't pass w... |
from __future__ import print_function, unicode_literals
import importlib
import os
import sys
from django.apps import apps
from django.db.models.fields import NOT_PROVIDED
from django.utils import datetime_safe, six, timezone
from django.utils.six.moves import input
from .loader import MIGRATIONS_MODULE_NAME
class... |
"""Generates .msi from a .zip archive or an unpacked directory.
The structure of the input archive or directory should look like this:
+- archive.zip
+- archive
+- parameters.json
The name of the archive and the top level directory in the archive must match.
When an unpacked directory is used as the i... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import ForemanStatelessEntityAnsibleModule, parameter_value_to_str
class ForemanSettingModule(ForemanStatelessEntityAnsibleModule):
pass
def mai... |
import unittest
from .support import LoggingResult
class Test_TestSkipping(unittest.TestCase):
def test_skipping(self):
class Foo(unittest.TestCase):
def test_skip_me(self):
self.skipTest("skip")
events = []
result = LoggingResult(events)
test = Foo("t... |
# -*- coding: utf-8 -*-
"""
requests.cookies
~~~~~~~~~~~~~~~~
Compatibility code to be able to use `cookielib.CookieJar` with requests.
requests.utils imports from here, so be careful with imports.
"""
import copy
import time
import calendar
import collections
from ._internal_utils import to_native_string
from .co... |
import py, pytest
from _pytest.recwarn import WarningsRecorder
def test_WarningRecorder(recwarn):
showwarning = py.std.warnings.showwarning
rec = WarningsRecorder()
assert py.std.warnings.showwarning != showwarning
assert not rec.list
py.std.warnings.warn_explicit("hello", UserWarning, "xyz", 13)
... |
# -*- coding: utf-8 -*-
"""
flask.logging
~~~~~~~~~~~~~
Implements the logging support for Flask.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from logging import getLogger, StreamHandler, Formatter, getLoggerClas... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
import os
import glob
import math
import imageio
import scipy.misc as misc
import numpy as np
from PIL import Image
def pad_seq(seq, batch_size):
# pad the sequence to be the multiples of batch_size
seq_len ... |
"""
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the 'context_processors' option of the configuration
of a DjangoTemplates backend and use... |
import functools
import re
from nova import availability_zones
from nova import context
from nova import db
from nova import exception
from nova.network import model as network_model
from nova.objects import instance as instance_obj
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
class ZincLanguageMixin(object):
"""A mixin for subsystems for languages compiled with Zinc."""
@classmethod
def register_options(cls, register):
super(Zin... |
# coding=utf-8
"""
Diamond handler that check if values are too high or too low, if so send an
alert to a Sentry server
This handler requires the Python module Raven:
http://raven.readthedocs.org/en/latest/index.html
To work this handler need a similar configuration:
[[SentryHandler]]
# Create a new project in Sen... |
#!/usr/bin/env python
"""Doxygen XML to SWIG docstring converter.
Converts Doxygen generated XML files into a file containing docstrings
that can be used by SWIG-1.3.x. Note that you need to get SWIG
version > 1.3.23 or use Robin Dunn's docstring patch to be able to use
the resulting output.
Usage:
doxy2swig.py i... |
import re
import socket
from sauna.plugins import (Plugin, bytes_to_human, human_to_bytes,
PluginRegister)
my_plugin = PluginRegister('Memcached')
@my_plugin.plugin()
class Memcached(Plugin):
def __init__(self, config):
super().__init__(config)
self.config = {
... |
from distutils.util import convert_path
from distutils import log
from distutils.errors import DistutilsError, DistutilsOptionError
import os
import glob
from pkg_resources import Distribution, PathMetadata, normalize_path
from setuptools.command.easy_install import easy_install
from setuptools.compat import PY3
impor... |
from sahara import conductor as c
from sahara import context
from sahara.service.edp.job_binaries import manager as jb_manager
conductor = c.API
def create_job_binary(values):
return conductor.job_binary_create(context.ctx(), values)
def get_job_binaries(**kwargs):
return conductor.job_binary_get_all(conte... |
from __future__ import print_function
import errno
import os
import re
import signal
import sys
import time
import logging
from logging.config import fileConfig
from subprocess import Popen
from optparse import OptionParser, OptionValueError
from mapproxy.config.loader import load_configuration, ConfigurationError
f... |
{
"name": "Brazilian Localization WMS Accounting",
"category": "Localisation",
"license": "AGPL-3",
"author": "Akretion, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-brazil",
"version": "12.0.4.0.0",
"depends": [
"stock_account",
"stock_picking_i... |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... |
"""Support for the Hitron CODA-4582U, provided by Rogers."""
import logging
from collections import namedtuple
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.device_tracker import (
DOMAIN, PLATFORM_SCHEMA, DeviceScanner)
from homeassist... |
"""
Regression tests for Django built-in views.
"""
from django.db import models
class Author(models.Model):
name = models.CharField(max_length=100)
def __unicode__(self):
return self.name
def get_absolute_url(self):
return '/views/authors/%s/' % self.id
class BaseArticle(models.Model):... |
"""
Base classes for storage engines
"""
import abc
from oslo_config import cfg
from oslo_db import api as db_api
import six
_BACKEND_MAPPING = {'sqlalchemy': 'ironic.db.sqlalchemy.api'}
IMPL = db_api.DBAPI.from_config(cfg.CONF, backend_mapping=_BACKEND_MAPPING,
lazy=True)
def get_... |
"""
API Serializers
"""
from rest_framework import serializers
class GradingPolicySerializer(serializers.Serializer):
""" Serializer for course grading policy. """
assignment_type = serializers.CharField(source='type')
count = serializers.IntegerField(source='min_count')
dropped = serializers.IntegerF... |
from __future__ import absolute_import
import theano.tensor as T
class Regularizer(object):
def set_param(self, p):
self.p = p
def set_layer(self, layer):
self.layer = layer
def __call__(self, loss):
return loss
def get_config(self):
return {"name": self.__class__.__... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
from traceback import format_exc
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.digit... |
"""Testing functions for the external collections search.
More tests of the page getter module can be done with
websearch_external_collections_getter_tests.py
"""
__revision__ = "$Id$"
from invenio.testutils import InvenioTestCase
from invenio.websearch_external_collections_searcher import external_collec... |
from booty import BootyNoKernelWarning
from bootloaderInfo import *
class ia64BootloaderInfo(efiBootloaderInfo):
def getBootloaderConfig(self, instRoot, bl, kernelList,
chainList, defaultDev):
config = bootloaderInfo.getBootloaderConfig(self, instRoot,
... |
"""
Simple REST server that takes commands in a JSON payload
Interface to the :py:class:`~luigi.scheduler.CentralPlannerScheduler` class.
See :doc:`/central_scheduler` for more info.
"""
#
# Description: Added codes for visualization of how long each task takes
# running-time until it reaches the next status (failed or... |
import Tkinter as tk
import tkFont
import tkMessageBox
from pomodoro import Pomodoro
from datetime import timedelta, datetime
from Queue import Queue, Empty
from rest_break import Break as ShortBreak
from rest_break import Break as LongBreak
from timer_log import TimerLog
class NativeUI(tk.Tk):
def __init__(s... |
'''Copyright (c) 2015 HG,DL,UTA
Python program runs on local host, uploads, downloads, encrypts local files to google.
Please use python 2.7.X, pycrypto 2.6.1 and Google Cloud python module '''
#import statements.
import argparse
import httplib2
import os
import sys
import json
import time
import datetime
impor... |
import json
from django.contrib.auth.models import User, Group
from django.http import JsonResponse
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from rest_framework import viewsets
from yelo.lib.elo_utils import play_match
from yelo.lib.http import api_error
from yelo.models ... |
from caper.helpers import is_list_type, update_dict, delta_seconds
from datetime import datetime
from logr import Logr
import re
class FragmentMatcher(object):
def __init__(self, pattern_groups):
self.regex = {}
self.construct_patterns(pattern_groups)
def construct_patterns(self, pattern_gro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.