content stringlengths 4 20k |
|---|
"""
Interfaces with Verisure alarm control panel.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/alarm_control_panel.verisure/
"""
import logging
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.verisure import ... |
import os
from flask import Flask
import psycopg2
db_user = os.environ.get('CLOUD_SQL_USERNAME')
db_password = os.environ.get('CLOUD_SQL_PASSWORD')
db_name = os.environ.get('CLOUD_SQL_DATABASE_NAME')
db_connection_name = os.environ.get('CLOUD_SQL_CONNECTION_NAME')
app = Flask(__name__)
@app.route('/')
def main():
... |
# coding=utf-8
setThrowException(True)
class Konqueror:
REMOTE = 0
LOCAL = 1
_tab = None
_dirs = {}
def __init__(self):
self._dirs = {self.LOCAL: [], self.REMOTE: []}
self._startKonqueror()
self._initWebdav()
sleep(2)
self._initLocal()
sleep(2)
def _startKonqu... |
import re
from pimlico.core.modules.map import skip_invalid
from pimlico.core.modules.map.multiproc import multiprocessing_executor_factory
def worker_setup(worker):
worker.case = worker.executor.info.options["case"]
worker.remove_empty = worker.executor.info.options["remove_empty"]
worker.remove_only_pu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from no import No
from graphviz import Digraph
class Grafo:
"""Gera um grafo cujos nós vão sendo
definidos a partir de seu tipo, número de linha,
etc.
Disponibiliza a opção de gerar uma visualização do grafo
utilizando a ferramenta graphvi... |
""" ResourceStatusDB:
This module provides definition of the DB tables, and methods to access them.
Written using sqlalchemy declarative_base
For extending the ResourceStatusDB tables:
1) In the extended module, call:
from DIRAC.ResourceStatusSystem.DB.ResourceStatusDB import rmsBase, TABLESLIS... |
"""
Attach open standard audit information to request.environ
AuditMiddleware filter should be place after Keystone's auth_token middleware
in the pipeline so that it can utilise the information Keystone provides.
"""
from pycadf.audit import api as cadf_api
from healing.openstack.common.middleware import notifier
... |
from __future__ import absolute_import, division, unicode_literals
import os
import sys
import codecs
import glob
base_path = os.path.split(__file__)[0]
test_dir = os.path.join(base_path, 'testdata')
sys.path.insert(0, os.path.abspath(os.path.join(base_path,
os.path.pa... |
from eventlet import semaphore
from eventlet.pools import Pool
from synaps import flags
from synaps.utils import strtime
from synaps import log as logging
from synaps.exception import RpcInvokeException
import uuid, time
import pika, json
from pika.exceptions import (ConnectionClosed, AMQPConnectionError,
... |
# coding=utf-8
from .test_base_class import ZhihuClientClassTest
from zhihu_oauth.zhcls.search import SearchResult, SearchType
from zhihu_oauth.zhcls.people import People
from zhihu_oauth.zhcls.column import Column
from zhihu_oauth.zhcls.topic import Topic
from zhihu_oauth.zhcls.live import Live
GeniusQiQi = '7sDrea... |
from Components.VariableText import VariableText
from enigma import eLabel, eDVBVolumecontrol, eTimer
from Renderer import Renderer
class VolumeText(Renderer, VariableText):
def __init__(self):
Renderer.__init__(self)
VariableText.__init__(self)
self.vol_timer = eTimer()
self.vol_timer.callback.append(self.po... |
import time
from typing import Any, Callable
from flask import current_app
from shared import configuration, repo
def start() -> float:
return time.perf_counter()
def check(start_time: float, kind: str, detail: Any, location: str) -> None:
run_time = time.perf_counter() - start_time
limit = configurati... |
#!/usr/bin/env python
import glob, re, json, os, datetime
from metar import Metar
def conversion(old):
if (len(old)>3):
direction = {'N':1, 'S':-1, 'E': 1, 'W':-1}
new_dir = old[-1:]
new = old[:-1]
new = new.split('-')
new.extend([0,0,0])
return (int(new[0])+int(new... |
import os
import sys
import antlr3
import testbase
import unittest
from cStringIO import StringIO
import difflib
class t020fuzzy(testbase.ANTLRTest):
def setUp(self):
self.compileGrammar('t020fuzzyLexer.g')
def testValid(self):
inputPath = os.path.splitext(__file__)[0] + '.input'
... |
"""The Python implementation of the GRPC helloworld.Greeter client."""
from __future__ import print_function
from grpc.beta import implementations
import helloworld_pb2
_TIMEOUT_SECONDS = 10
def run():
channel = implementations.insecure_channel('localhost', 50051)
stub = helloworld_pb2.beta_create_Greeter_stu... |
from zerver.lib.test_classes import WebhookTestCase
class SlackWebhookTests(WebhookTestCase):
STREAM_NAME = 'slack'
URL_TEMPLATE = "/api/v1/external/slack?stream={stream}&api_key={api_key}"
FIXTURE_DIR_NAME = 'slack'
def test_slack_channel_to_topic(self) -> None:
expected_topic = "channel: g... |
import inspect, re, sys, threading, json, socket
import monopoly, events, states
class GameFactory(object):
def __init__(self, game_class):
self.games = {}
self.last_id = -1
self.game_class = game_class
def get_instance(self, game_id):
return self.games[game_id]
def create_instance(self, Game):
self.last_... |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
pipe2py.twisted.collections
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides methods for creating asynchronous pipe2py pipes
"""
from __future__ import (
absolute_import, division, print_function, with_statement,
unicode_literals)
from twisted.internet.d... |
from django import http, shortcuts
from django.db.transaction import non_atomic_requests
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import condition
from django.utils.translation import ugettext as _
import commonware.log... |
"""A functions module, includes all the standard functions.
Combinatorial - factorial, fibonacci, harmonic, bernoulli...
Elementary - hyperbolic, trigonometric, exponential, floor and ceiling, sqrt...
Special - gamma, zeta,spherical harmonics...
"""
from sympy.functions.combinatorial.factorials import (factorial, fac... |
from django.contrib import admin
from blog.models import *
class CategoryAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('title',)}
admin.site.register(Category, CategoryAdmin)
class PostAdmin(admin.ModelAdmin):
list_display = ('title', 'publish', 'status')
list_filter = ('publish', 'categor... |
import random
import time
import sys
import iothub_client
from iothub_client import *
from iothub_client_args import *
# HTTP options
# Because it can poll "after 9 seconds" polls will happen effectively
# at ~10 seconds.
# Note that for scalabilty, the default value of minimumPollingTime
# is 25 minutes. For more inf... |
# coding: utf-8
from dartcms import get_model
from dartcms.utils.config import DartCMSConfig
from dartcms.views import UpdateObjectView
from django.conf.urls import url
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.csrf import csrf_exempt
from .forms import ProductSectionForm
fro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.cm as cm
import pylab
import pywt
Fs=2048
x = pylab.arange(0, 1, 1. / Fs)
#data = pylab.sin((5 * 50 * pylab.pi * x ** 2))
data = pylab.sin((100 * 2*pylab.pi * x**2))
wavelet = 'db4'
level = 4
order = "freq" # "normal"
interpolation = 'nearest'
cmap = ... |
"""Tests for state sampler."""
import logging
import time
import unittest
from nose.plugins.skip import SkipTest
from apache_beam.utils.counters import CounterFactory
class StateSamplerTest(unittest.TestCase):
def setUp(self):
try:
# pylint: disable=global-variable-not-assigned
global statesampl... |
"""
Utility classes for spread.
"""
from twisted.internet import defer
from twisted.python.failure import Failure
from twisted.spread import pb
from twisted.protocols import basic
from twisted.internet import interfaces
from zope.interface import implementer
class LocalMethod:
def __init__(self, local, name):
... |
"""
Tests of re-verification service.
"""
import ddt
from course_modes.tests.factories import CourseModeFactory
from student.tests.factories import UserFactory
from verify_student.models import VerificationCheckpoint, VerificationStatus, SkippedReverification
from verify_student.services import ReverificationService
... |
"""Keras-based attention layer."""
# pylint: disable=g-classes-have-attributes
import math
import tensorflow as tf
EinsumDense = tf.keras.layers.experimental.EinsumDense
MultiHeadAttention = tf.keras.layers.MultiHeadAttention
@tf.keras.utils.register_keras_serializable(package="Text")
class CachedAttention(tf.keras... |
from functools import wraps
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponseServerError
from django.utils.importlib import import_module
from social_auth.backends import get_backend
from social_auth.utils import setting, log, backend_setting
LOGIN_ERROR_URL = s... |
from __future__ import division
from gnuradio import gr, gr_unittest, analog, blocks
class test_pwr_squelch(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
def tearDown(self):
self.tb = None
def test_pwr_squelch_001(self):
# Test set/gets
alpha = 0.0001... |
from __future__ import (absolute_import, division, print_function)
import numpy as np
import pytest
import shapely.geometry as sgeom
import cartopy.crs as ccrs
class TestBoundary(object):
def test_cuts(self):
# Check that fragments do not start or end with one of the
# original ... ?
lin... |
Latin7_char_to_order_map = (
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10
253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20
252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30
25... |
"""Provides factories for Split."""
from xmodule.modulestore import ModuleStoreEnum
from xmodule.course_module import CourseDescriptor
from xmodule.x_module import XModuleDescriptor
import factory
from factory.helpers import lazy_attribute
from opaque_keys.edx.keys import UsageKey
# Factories don't have __init__ method... |
"""
Factories for Bookmark models.
"""
from functools import partial
import factory
from factory.django import DjangoModelFactory
from opaque_keys.edx.locator import CourseLocator
from student.tests.factories import UserFactory
from ..models import Bookmark, XBlockCache
COURSE_KEY = CourseLocator(u'edX', u'test_c... |
#!/usr/bin/env python
from tools.load import LoadMatrix
import shogun as sg
lm=LoadMatrix()
traindat =lm.load_dna('../data/fm_train_dna.dat')
testdat = lm.load_dna('../data/fm_test_dna.dat')
parameter_list = [[traindat,testdat,3,0,False ],[traindat,testdat,4,0,False]]
def kernel_comm_ulong_string (fm_train_dna=train... |
"""Adapter to wrap the rachiopy api for home assistant."""
from homeassistant.helpers import device_registry
from homeassistant.helpers.entity import Entity
from .const import DEFAULT_NAME, DOMAIN
class RachioDevice(Entity):
"""Base class for rachio devices."""
def __init__(self, controller):
"""In... |
"""
Render to qt from agg
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import os # not used
import sys
import ctypes
import warnings
import matplotlib
from matplotlib.figure import Figure
from .backend_qt5agg import FigureCanvasQTAggBa... |
"""Support for Z-Wave switches."""
import logging
import time
from homeassistant.components.switch import DOMAIN, SwitchDevice
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from . import ZWaveDeviceEntity, workaround
_LOGGER = logging.getLogger(__name__... |
#!/usr/bin/env python
import datetime
import logging
import os
import re
from urllib.parse import urljoin, unquote
from bs4 import Tag, NavigableString, Comment
from utils import utils, inspector, admin
# https://www.oig.lsc.gov
archive = 1994
# options:
# standard since/year options for a year range to fetch fro... |
# -*- encoding:utf-8 -*-
from __future__ import unicode_literals
MESSAGES = {
"Also available in": "Διαθέσιμο και στα",
"Archive": "Αρχείο",
"LANGUAGE": "Ελληνικά",
"More posts about": "Περισσότερες αναρτήσεις για",
"Newer posts": "Νεότερες αναρτήσεις",
"Next post": "Επόμενη ανάρτηση",
"Old... |
import wx
import math
import random
import os
import sys
try:
from agw import flatmenu as FM
from agw.artmanager import ArtManager, RendererBase, DCSaver
from agw.fmresources import ControlFocus, ControlPressed
from agw.fmresources import FM_OPT_SHOW_CUSTOMIZE, FM_OPT_SHOW_TOOLBAR, FM_OPT_MIN... |
#!/usr/bin/env python
# Test whether a client sends a correct PUBLISH to a topic with QoS 2 and responds to a disconnect.
import inspect
import os
import subprocess
import socket
import sys
import time
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realp... |
# -*- coding: utf-8 -*-
# This file is placed into the public domain.
# Calculates the current version number. If possible, this is the
# output of “git describe”, modified to conform to the versioning
# scheme that setuptools uses. If “git describe” returns an error
# (most likely because we're in an unpacked copy ... |
import os
from avocado import Test
from avocado import main
from avocado.utils import process
from avocado.utils.software_manager import SoftwareManager
class Fsx(Test):
'''
The Fsx test is a file system exerciser test
'''
def setUp(self):
'''
Setup fsx
'''
smm = Softw... |
import hmac
import hashlib
import unittest
import warnings
from test import support
class TestVectorsTestCase(unittest.TestCase):
def test_md5_vectors(self):
# Test the HMAC module against test vectors from the RFC.
def md5test(key, data, digest):
h = hmac.HMAC(key, data)
... |
from keystone import catalog
from keystone.common import kvs
class Catalog(kvs.Base, catalog.Driver):
# Public interface
def get_catalog(self, user_id, tenant_id, metadata=None):
return self.db.get('catalog-%s-%s' % (tenant_id, user_id))
# region crud
def _delete_child_regions(self, region_i... |
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
then create a function that returns the calculated value based on the value of
FEATURES[...]. Modules that extend this one can change the feature
configuration ... |
persistModule = '1.2.0'
log.debug('Loading module [persist.py] version [' + persistModule + ']')
#=======================================================================================
# Configure filestores
#=======================================================================================
def createFileStores... |
"""
Tests for implementations of L{IReactorUDP}.
"""
__metaclass__ = type
from socket import SOCK_DGRAM
from zope.interface.verify import verifyObject
from twisted.internet.test.reactormixins import ReactorBuilder
from twisted.internet.interfaces import IListeningPort
from twisted.internet.address import IPv4Addres... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import os
import re
import time
import paramiko
from ansible.module_utils.nxos import run_commands
from ansible.module_utils.nxos import nxos_argument_spec, check_args
from ansi... |
"""
Security channels module for Zigbee Home Automation.
For more details about this component, please refer to the documentation at
https://home-assistant.io/integrations/zha/
"""
import asyncio
from zigpy.exceptions import ZigbeeException
import zigpy.zcl.clusters.security as security
from homeassistant.core impor... |
from __future__ import print_function
from __future__ import unicode_literals
import sys
from .extensions import DEFAULT_EXTENSIONS
from .format import __available_formats__
__doc__ = _("""Usage: {0} [OPTION]... [REPOSITORY]...
List information about the repository in REPOSITORY. If no repository is
specified, the cu... |
from abc import ABCMeta, abstractmethod
from collections import namedtuple
import hashlib
from textwrap import dedent
import warnings
from logbook import Logger
import numpy
import pandas as pd
from pandas import read_csv
import pytz
import requests
from six import StringIO, iteritems, with_metaclass
from zipline.err... |
"""TransformDiagonal bijector."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.ops import array_ops
from tensorflow.python.ops.distributions import bijector
from tensorflow.python.util import deprecation
__all__ = [
"Transform... |
import os.path
import io
import tempfile
import shutil
from firewall import config
from firewall.core.logger import log
from firewall.functions import b2u, u2b, PY2
valid_keys = [ "DefaultZone", "MinimalMark", "CleanupOnExit", "Lockdown",
"IPv6_rpfilter", "IndividualCalls", "LogDenied",
... |
from __future__ import absolute_import
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse
from django.utils.decorators import method_decorator
from django.views import generic
from .forms import AuthorForm
from .models imp... |
import scope_window
import common
from gnuradio import gr
from pubsub import pubsub
from constants import *
import math
class ac_couple_block(gr.hier_block2):
"""
AC couple the incoming stream by subtracting out the low pass signal.
Mute the low pass filter to disable ac coupling.
"""
def __init__(self, controll... |
"""
Tests for instructor_task/models.py.
"""
from cStringIO import StringIO
import mock
import time
from datetime import datetime
from unittest import TestCase
from instructor_task.models import LocalFSReportStore, S3ReportStore
from instructor_task.tests.test_base import TestReportMixin
from opaque_keys.edx.locator ... |
#!/usr/bin/python
import os,sys
import lcm
import time
from lcm import LCM
import math
home_dir =os.getenv("HOME")
#print home_dir
sys.path.append(home_dir + "/drc/software/build/lib/python2.7/site-packages")
sys.path.append(home_dir + "/drc/software/build/lib/python2.7/dist-packages")
sys.path.append(home_dir + "/ot... |
# -*- coding: utf-8 -*-
"""celery.backends.cassandra"""
from __future__ import absolute_import
try: # pragma: no cover
import pycassa
from thrift import Thrift
C = pycassa.cassandra.ttypes
except ImportError: # pragma: no cover
pycassa = None # noqa
import socket
import time
from celery import st... |
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from re import compile
from guardian.shortcuts import get_anonymous_user
class LoginRequiredMiddleware(object):
"""
Requires a user to be logged in to access any page that is not white-l... |
from pyomo.environ import *
def initialize_generators(model,
generator_names=None,
generator_at_bus=None):
model.Generators = Set(initialize=generator_names)
model.GeneratorsAtBus = Set(model.Buses, initialize=generator_at_bus)
def initialize_non_dispatchable... |
import lxml.etree
import os
import sys
import traceback
from fs.osfs import OSFS
from path import path
from django.core.management.base import BaseCommand
from xmodule.modulestore.xml import XMLModuleStore
def traverse_tree(course):
'''Load every descriptor in course. Return bool success value.'''
queue =... |
#!/usr/bin/env python3
from urllib.request import urlopen
from bs4 import BeautifulSoup
import pandas as pd
import html5lib
import pdb
import json
import csv
from collections import OrderedDict
import contextlib
url = "http://www.espn.com/mens-college-basketball/tournament/bracket"
print ("Scrape Bracket Tool")
prin... |
"""
Represent an exception with a lot of information.
Provides 2 useful functions:
format_exc: format an exception into a complete traceback, with full
debugging instruction.
format_outer_frames: format the current position in the stack call.
Adapted from IPython's VerboseTB.
"""
# Authors: Gael Varoqua... |
import os
from avocado import Test
from avocado.utils import archive, build, distro, process
from avocado.utils.software_manager import SoftwareManager
class XMLSec(Test):
"""
xmlsec-testsuite
:avocado: tags=security,testsuite
"""
def setUp(self):
'''
Install the basic packages to ... |
import datetime
from decimal import Decimal as D
from django.views import generic
from django.core.urlresolvers import reverse
from django import http
from django.utils import timezone
from django.shortcuts import get_object_or_404
from django.db.models import get_model, Sum
from django.contrib import messages
from dj... |
from __future__ import with_statement
from xml.dom.minidom import parse, parseString
from google.appengine.api import files
from settings import PROJECT_PATH
import shutil
def clean_alphabet_string_from_garbage(alphabet_garbage, inputstring):
outputstring = ''
for character in inputstring:
if character... |
""" contains the Cluster class for representing hierarchical cluster trees
"""
import numpy
CMPTOL=1e-6
class Cluster(object):
"""a class for storing clusters/data
**General Remarks**
- It is assumed that the bottom of any cluster hierarchy tree is composed of
the individual data points which wer... |
#!/usr/bin/python
""" PN CLI vlag-create/vlag-delete/vlag-modify """
#
# This file is part of Ansible
#
# Ansible 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... |
# -*- coding: utf-8 -*-
from cms.models import CMSPlugin, Placeholder
from cms.models.aliaspluginmodel import AliasPluginModel
from cms.models.placeholderpluginmodel import PlaceholderReference
from cms.plugin_base import CMSPluginBase, PluginMenuItem
from cms.plugin_pool import plugin_pool
from cms.plugin_rendering im... |
import discord
from discord.ext import commands
import socket
import time
import datetime
import traceback
import os
from pathlib import Path
class Technical:
def __init__(self, bot):
self.bot = bot
async def unfurl_b(self, link):
max_depth = int(self.bot.config["advanced"]["unfurl-depth"])
... |
#!/usr/bin/python
import sys
import getopt
import gtk
import vte
# FIXME: figure out why we don't get a PID here.
def exited_cb(terminal):
gtk.main_quit()
def nuke(button, (box, terminal)):
box.remove(terminal)
box.pack_start(terminal)
if __name__ == '__main__':
child_pid = -1;
# Defaults.
emulation = "xterm"
... |
"""Utilities related to disk I/O."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import defaultdict
import sys
import numpy as np
try:
import h5py # pylint:disable=g-import-not-at-top
except ImportError:
h5py = None
class HDF5M... |
"""
Usage:
def options(opt):
opt.load('eclipse')
$ waf configure eclipse
"""
import sys, os
from waflib import Utils, Logs, Context, Options, Build, TaskGen, Scripting
from xml.dom.minidom import Document
STANDARD_INCLUDES = [ '/usr/local/include', '/usr/include' ]
oe_cdt = 'org.eclipse.cdt'
cdt_mk = oe_cdt + '.m... |
#!/usr/bin/env python
import rospy
import smach
from std_msgs.msg import String
import actionlib
from actionlib_msgs.msg import GoalStatus
from aaf_walking_group.msg import GuidingAction, GuidingGoal
from sound_player_server.srv import PlaySoundService
from threading import Thread
class FinalApproach(smach.State):
... |
class ZiplineError(Exception):
msg = None
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
self.message = str(self)
def __str__(self):
msg = self.msg.format(**self.kwargs)
return msg
__unicode__ = __str__
__repr__ = __str__
class... |
"""
Handles all requests relating to transferring ownership of volumes.
"""
import hashlib
import hmac
import os
from oslo.config import cfg
from cinder.db import base
from cinder import exception
from cinder.i18n import _
from cinder.openstack.common import excutils
from cinder.openstack.common import log as loggi... |
import sys
import socket
import tornado.httpserver
import tornado.ioloop
import tornado.iostream
import tornado.web
import tornado.httpclient
__all__ = ['ProxyHandler', 'run_proxy']
class ProxyHandler(tornado.web.RequestHandler):
SUPPORTED_METHODS = ['GET', 'POST', 'CONNECT']
@tornado.web.asynchronous
... |
# -*- coding: latin-1 -*-
"""GnuVet Version, Help and Copyleft"""
# Copyright (c) 2015 Dipl.Tzt. Enno Deimel <ennodotvetatgmxdotnet>
#
# This file is part of gnuvet, published under the GNU General Public License
# version 3 or later (GPLv3+ in short). See the file LICENSE for information.
version = "GnuVet 1.0.1 ... |
from flask import current_app, g, jsonify, request
from flask_cors import cross_origin
from alerta.app import qb
from alerta.auth.decorators import permission
from alerta.exceptions import ApiError
from alerta.models.customer import Customer
from alerta.models.enums import Scope
from alerta.utils.audit import admin_au... |
# class of a node
class Node:
def __init__(self, data):
self.data = data
self.next = None
# class of the signly linked list
class SinglyLinkedList:
def __init__(self):
self.head = None
# function to calculate size of the list
def size(self):
# initialize temporary vari... |
# -*- coding: utf-8 -*-
"""
This is a tutorial for interacting with a database in python.
Before you execute this script, make sure you have MySQL database and its drivers installed.
Create a test database with a test table having some records.
Created on Wed Jul 15 13:22:10 2015
@author: Allen Thomas Varghese
"""
im... |
from __future__ import absolute_import
import os
import sys
import warnings
import pkg_resources
from . import core
from . import orange, orangeom
sys.modules["orange"] = orange
sys.modules["orangeom"] = orangeom
# Little trick so that legacy imports work automatically
import Orange.orng
if Orange.orng.__path__[0] ... |
#-*-coding: utf-8 -*-
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import EnsJeux
import EnsEmprunt
import EnsExemplaires
import EnsExtensions
import EnsReservation
from ExtensionsView import ExtensionsView
import sys
class JeuView(QWidget):
def __init__(self,item="",session="",*args):
# ESPACEM... |
"""Utility methods for working with WSGI servers."""
from __future__ import print_function
import os.path
import socket
import ssl
import sys
import eventlet.wsgi
import greenlet
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from paste import deploy
import routes.mid... |
"""
A wrapper for L{twisted.internet.test._awaittests}, as that test module
includes keywords not valid in Pythons before 3.5.
"""
from __future__ import absolute_import, division
import sys
from twisted.python.compat import _PY3, execfile
from twisted.python.filepath import FilePath
if sys.version_info >= (3, 5, 0)... |
"""
Provides commands for manipulating channel topics.
"""
import supybot
import supybot.world as world
# Use this for the version of this plugin. You may wish to put a CVS keyword
# in here if you're keeping the plugin in CVS or some similar system.
__version__ = "%%VERSION%%"
__author__ = supybot.authors.jemfinch... |
import inspect
import sys
import django.shortcuts
import django.views.defaults
def dispatcher(request, test_name):
# import is included in this non-standard location to avoid
# problems importing mox. See bug/1288245
from horizon.test.jasmine import jasmine_tests as tests
classes = inspect.getmember... |
import logging
import os
import subprocess
import sys
from .cd import current_directory
from .filesystem import TempDir
from .utility import Style
def __log_check_output(cmd, verbosity, **kwargs):
shell = not isinstance(cmd, list)
with open(os.devnull, 'w') as devnull:
logging.log(verbosity, __format... |
"""
raven.transport.http
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from raven.conf import defaults
from raven.exceptions import APIError, RateLimited
from raven.transport.base... |
# -*- coding: utf-8 -*-
"""
pyspecific.py
~~~~~~~~~~~~~
Sphinx extension with Python doc-specific markup.
:copyright: 2008, 2009 by Georg Brandl.
:license: Python license.
"""
ISSUE_URI = 'http://bugs.python.org/issue%s'
from docutils import nodes, utils
# monkey-patch reST parser to disable al... |
"""Library for loading train and eval data.
This libary contains two functions, make_train_iterator for generating a
training data iterator from multiple sources of different formats and
make_eval_function for creating an evaluation function that evaluates on
data from multiple sources of different formats.
"""
# pyl... |
import pox.lib.graph.minigraph as nx
from collections import defaultdict
from copy import copy
LINK = 'link'
class Link (object):
def reorder (self, l):
"""
Flips a list of Links so that this node is first in each
"""
return Link.order(l, self)
@staticmethod
def order (links, n):
"""
G... |
#!/usr/bin/env python2
# coding:utf-8
# Based on GAppProxy 2.0.0 by Du XiaoGang <<EMAIL>>
# Based on WallProxy 0.4.0 by Hust Moon <<EMAIL>>
# Contributor:
# Phus Lu <<EMAIL>>
# Hewig Xu <<EMAIL>>
# Ayanamist Yang <<EMAIL>>
# V.E.O <<EMAIL>>
# Max Lv ... |
import os
from PyQt4 import QtCore, QtGui
class RatingWidget(QtGui.QWidget):
"""A QWidget that enables a user to choose a rating.
"""
# Signal thta emits the value of the widget when changed.
value_updated = QtCore.pyqtSignal(int)
def __init__(self, parent=None, icon_path=None, num_icons=5):
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import json
from itertools import chain
from ansible.module_utils._text import to_bytes, to_text
from ansible.module_utils.network.common.utils import to_list
from ansible.plugins.cliconf import CliconfBase
class Clic... |
#!/usr/bin/env python
# coding:utf-8
"Database utilities API (sqlite3)"
__author__ = "Mariano Reingart (<EMAIL>)"
__copyright__ = "Copyright (C) 2014 Mariano Reingart"
__license__ = "GPL 3.0"
import os
import sqlite3
import UserDict
DEBUG = True
SQL_TYPE_MAP = {int: "INTEGER", float: "REAL", str:... |
"""
Tests For Scheduler Utils
"""
import contextlib
import uuid
import mock
from mox3 import mox
from oslo_config import cfg
from nova.compute import flavors
from nova.compute import utils as compute_utils
from nova import db
from nova import exception
from nova import notifications
from nova import objects
from nova... |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# this script tests vtkImageReslice with various axes permutations,
# in order to cover a nasty set of "if" statements that check
# the intersections of the raster lines with the inpu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.