content stringlengths 4 20k |
|---|
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand
from optparse import make_option
class Command(BaseCommand):
help = 'Updates a Site object.'
args = '<site id>'
option_list = BaseCommand.option_list + (
make_option('-s', '--site-id',
... |
"""test_kill_stmgr_metricsmgr.py"""
from . import test_template
class TestKillStmgrMetricsMgr(test_template.TestTemplate):
def execute_test_case(self):
self.kill_strmgr()
self.kill_metricsmgr() |
# -*- coding: utf-8 -*-
"""
Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
The MIT License (MIT)
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 res... |
"""Leverage curl to make XMLRPC requests that check the server's credentials."""
import xmlrpc.client
import curlwrapper
class CertificateCheckingSafeTransport (xmlrpc.client.Transport):
def __init__(self, cacert, timeout):
self.cacert = cacert
self.timeout = timeout
def request(self, host... |
{
'name': 'Inter Company Module for Sale/Purchase Orders and Invoices',
'version': '1.1',
'summary': 'Intercompany SO/PO/INV rules',
'description': ''' Module for synchronization of Documents between several companies. For example, this allow you to have a Sale Order created automatically when a Purchas... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import pkgutil
import runpy
from time import time
thismodname = __name__.split('.')[-2:]
thismodname = '.'.join(thismodname)
# Note there is a bug in pkgutil.walk_packages
# excluding all modules that have the same name as modules in
# the st... |
import re
from lxml import objectify, etree
import unittest
import sys
sys.path.insert(0, '.')
import check
check.VERIFICATION_SCHEMA_LOCATION = u'../verification.xsd'
from check import Verification, RulesParser, Rule
from check import XSAMS_NS
from check import printRules
from test import LocalResolver
parser = etr... |
"""Support for UK public transport data provided by transportapi.com."""
from datetime import datetime, timedelta
import logging
import re
import requests
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_MODE, HTTP_OK, TIME_MINUTES
import homeas... |
import IECore
import GafferUI
QtCore = GafferUI._qtImport( "QtCore" )
## \todo Move other enums here - ListContainer.Orientation for instance.
__all__ = [ "HorizontalAlignment", "VerticalAlignment", "Edge" ]
# HorizontalAlignment
HorizontalAlignment = IECore.Enum.create( "None", "Left", "Right", "Center", "Justify"... |
# coding=utf-8
"""
Test unit, using simple graph made in bpmn.io editor for import/export operation
"""
import os
import unittest
import bpmn_python.bpmn_diagram_visualizer as visualizer
import graph.bpmn_diagram_rep as diagram
class CamundaSimpleTests(unittest.TestCase):
"""
This class contains test for bpm... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'第 0002 题:将 0001 题生成的 200 个激活码(或者优惠券)保存到 MySQL 关系型数据库中。'
__author__ = 'Drake-Z'
import mysql.connector
def write_to_mysql(filename):
conn = mysql.connector.connect(user='root', password='986535', database='test')
cursor = conn.cursor()
cursor.execute("DROP ... |
import logging
from datetime import timedelta
from datetime import datetime
from opcua import Subscription
from opcua import ua
from opcua.common import utils
class UaNodeAlreadyHistorizedError(ua.UaError):
pass
class HistoryStorageInterface(object):
"""
Interface of a history backend.
Must be imp... |
import datetime
import random
import helpers
from django.http import JsonResponse
from dateutil.parser import parse
from utils import value_maps
from django.contrib.auth.decorators import login_required
from api.models import ( Applicant, Client, Disabilities, EmploymentEducation,
Enrollment, HealthAndDV, IncomeBen... |
"""
Licensing:
This code is distributed under the MIT license.
Authors:
Original FORTRAN77 version of i4_sobol by Bennett Fox.
MATLAB version by John Burkardt.
PYTHON version by Corrado Chisari
Original Python version of is_prime by Corrado Chisari
Original MATLAB versions of other functi... |
"""Tests for the gRPC Interceptor Mixin class."""
from importlib import import_module
import mock
from unittest import TestCase
import grpc
from google.ads.googleads.client import _DEFAULT_VERSION as default_version
from google.ads.googleads.interceptors.interceptor import Interceptor
errors_path = f"google.ads.go... |
'''Mulliken partitioning'''
import numpy as np
from horton.gbasis.cext import get_shell_nbasis
__all__ = ['partition_mulliken', 'get_mulliken_operators']
def partition_mulliken(operator, obasis, index):
'''Fill in the mulliken operator in the first argument
**Arguments:**
operator
... |
# Assign scores to each PK domain in kinDB, based on various properties such as
# number of PDB structures, references, disease associations etc.
#
# Daniel L. Parton <<EMAIL>> - 29 April 2013
#
import sys, os
from lxml import etree
from numpy import *
import choderalab as clab
# ==============
# Parameters
# =======... |
"""
Falkonry Client
Client to access Condition Prediction APIs
:copyright: (c) 2016-2018 by Falkonry Inc.
:license: MIT, see LICENSE for more details.
"""
import json
class Assessment:
"""Assessment schema class"""
def __init__(self, **kwargs):
self.raw = kwargs.get('assessment') if 'assessment' ... |
from matplotlib.pyplot import figure, xlim, ylim, gca, arrow, text, scatter
from mpl_toolkits.axes_grid.axislines import SubplotZero
from numpy import linspace, arange, sqrt, pi, sin, cos, sign
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('png', 'pdf')
# axis style
def make_plot_ax():
... |
#!/usr/bin/python3
'''
Output the volume level for use in the status bar.
Originally for wmii's status bar, this version has been modified to work with
xmobar.
@note
assumes pulse audio w/ alsa backend. B/c pacmd doesn't work w/ pulseaudio
--system, we have to hack some stuff together. This uses amixer to get the dat... |
import datetime
from cryptography import exceptions as crypto_exceptions
from cryptography.hazmat import backends
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives import serialization
from cryptography import x509
import octavia.certificates.generator.local as local_cert_gen
from ... |
import itertools
from collections import OrderedDict
from datetime import timedelta, date
from sqlalchemy.orm import joinedload
import flask.json as json
from flask import render_template, jsonify, request, Response
from flask_httpauth import HTTPBasicAuth
from passlib.hash import phpass
from app import app, db
impor... |
from math import modf, floor
def quantile(x, q, qtype = 7, issorted = False):
"""
Args:
x - input data
q - quantile
qtype - algorithm
issorted- True if x already sorted.
Compute quantiles from input array x given q.For median,
specify q=0.5.
Referen... |
from __future__ import absolute_import
import six
from django.core.validators import validate_slug, ValidationError
from django.db import transaction
from rest_framework.response import Response
from sentry.api.bases.organization import OrganizationEndpoint
from sentry.models import Project
class SlugsUpdateEndpoi... |
import StringIO
class Element(object):
def __init__(self):
self.__dict__['children'] = []
def create_child(self, name):
child = Element()
self._add(name, child)
return child
def __setattr__(self, name, value):
self._add(name, value)
def _a... |
"""Tests for noise layers."""
import numpy as np
from tensorflow.python import keras
from tensorflow.python.framework import dtypes
from tensorflow.python.keras import keras_parameterized
from tensorflow.python.keras import testing_utils
from tensorflow.python.platform import test
@keras_parameterized.run_all_keras... |
from ereuse_devicehub.validation.validation import DeviceHubValidator
_score = {
'type': 'number',
'min': 0,
'max': 10
}
_score_negative = {
'type': 'number',
'min': -3,
'max': 10
}
"""Grades the state of the device in different areas."""
condition = {
'appearance': {
'type': 'dic... |
# -*- coding: utf-8 -*-
from django.contrib import admin
from skwissh.models import Probe, Server, Measure, ServerGroup, GraphType, \
MeasureDay, MeasureWeek, MeasureMonth, CronLog
class GraphTypeAdmin(admin.ModelAdmin):
pass
admin.site.register(GraphType, GraphTypeAdmin)
class ServerGroupAdmin(admin.ModelA... |
import copy
import logging
import os
import threading
import time
from threading import Thread, Lock
logger = logging.getLogger(__name__)
class TaskThread(Thread):
def __init__(self, task_computer, subtask_id, working_directory, src_code,
extra_data, short_desc, res_path, tmp_path, timeout=0):
... |
import unittest as ut
import importlib_wrapper
import numpy as np
tutorial, skipIfMissingFeatures = importlib_wrapper.configure_and_import(
"@TUTORIALS_DIR@/02-charged_system/02-charged_system-1.py",
num_steps_equilibration=100, num_configs=50, integ_steps_per_config=100)
@skipIfMissingFeatures
class Tutoria... |
import os
import sys
OldPy = sys.version_info[0] == 2 and sys.version_info[1] < 7
class TestingConfig:
""""
TestingConfig - Information on the tests inside a suite.
"""
@staticmethod
def fromdefaults(litConfig):
"""
fromdefaults(litConfig) -> TestingConfig
Create a Testin... |
from Plugins.Plugin import PluginDescriptor
from twisted.internet.protocol import Protocol, Factory
from twisted.internet import reactor
from Blackhole.BhInterface import DeliteInterface
import socket
DeliteInt = None
class Deliteapi(Protocol):
def connectionMade(self):
self.received = ''
def dataRec... |
#!/usr/bin/env python3
"""
Utility to count the number of free parameters in a saved network
"""
_help_subset='only consider a subset of the configuration'
import json, sys
from argparse import ArgumentParser
from collections import Mapping, Sequence, Counter
from numbers import Number, Integral
def count_numbers(n... |
import numpy as np
from typing import Tuple
from dedop.model import SurfaceData
from ..base_algorithm import BaseAlgorithm
from ....util.parameter import Parameter
@Parameter("flag_stack_masking", data_type=bool)
class StackMaskingAlgorithm(BaseAlgorithm):
def __call__(self, working_surface_location: SurfaceDat... |
from __future__ import print_function
# Flux surface generator for tokamak grid files
try:
import os
import sys
import glob
except ImportError:
print("ERROR: os, sys or glob modules not available")
raise
try:
import numpy as np
except ImportError:
print("ERROR: NumPy module not available")... |
## Animal is-a object (yes, sort of confusing) look at the extra credit
class Animal(object):
pass
## Dog is-a animal
class Dog(Animal):
def __init__(self, name):
## __init__ has-a reference with Dog's name
self.name = name
## Cat is-a animal
class Cat(Animal):
def __init__(self, name):
... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding index on 'Report', fields ['reported_date']
db.create_index('mapping_report', ['reported_date'])
... |
{
'name': 'Country prefix sequence',
'version': '1.1',
'author': 'Vertel AB',
'category': 'Base',
'website': 'http://www.vertel.se',
'description': """ Adds country prefix to sequences, depending on user
Syntax: %(country)s
Sponsor:
SMart EU
70 rue Emile Féron
1060 Brussels, Belgium
"""... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from uuid import uuid4
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import models
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from dj... |
import sys
import time
import pyaml
try:
from blessed import Terminal
except ImportError:
Terminal = None
from lacore.adf.util import creation
def format_size(bytes):
size = ""
if bytes:
kib = bytes // 1024
mib = kib // 1024
gib = mib // 1024
if not kib:
siz... |
from distutils.core import setup, Extension
from glob import glob
# Modifiy this if BLAS and LAPACK libraries are not in /usr/lib.
BLAS_LIB_DIR = '/usr/lib'
# Default names of BLAS and LAPACK libraries
BLAS_LIB = ['blas']
LAPACK_LIB = ['lapack']
BLAS_EXTRA_LINK_ARGS = []
# Set environment variable BLAS_NOUNDERSCORES... |
from .store import Store
import json
from os.path import expanduser
_services = {}
_last = None
test = False
test_port = None
import base
def registered(svc_name):
global test
if test:
# print("REGISTERED",svc_name in _services, svc_name, _services)
# print('bc',base.config.conf['services'... |
import copy, re, errno, os
import threading, traceback, sys, time, Queue
import socket
import ssl
import requests
ca_path = requests.certs.where()
import util
import x509
from version import ELECTRUM_VERSION, PROTOCOL_VERSION
from simple_config import SimpleConfig
def Interface(server, response_queue, config = None... |
# -*- coding: utf-8 -*-
#= DESCRIZIONE =================================================================
# queste room sono accessibili solo tramite altri script.
# una volta entrati se si supera il peso massimo consentito si viene teleportati
# alla base della pianta
# diversamente si viene sputati in room diverse a... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'UserProfile'
db.create_table('controlnext_userprofile', (
('id', self.gf('django... |
import unittest
from property_address import *
class TestAddresses(unittest.TestCase):
def setUp(self):
self.home = Address( name='Steve Holden', street_address='1972 Flying Circus', city='Arlington', state='VIR', zip_code='12345-3425' )
def test_name(self):
self.assertEqual(sel... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import range
from future import standard_library
standard_library.install_aliases()
import sys
PYTHON_VERSION = sys.version_info[:3]
PY2 = (PYTHON_VERSION[0... |
"""
Disqus OAuth2 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/disqus.html
"""
from social.backends.oauth import BaseOAuth2
class DisqusOAuth2(BaseOAuth2):
name = 'disqus'
AUTHORIZATION_URL = 'https://disqus.com/api/oauth/2.0/authorize/'
ACCESS_TOKEN_URL = 'https://disqus.com/api/oauth... |
"""This module contains constants used by cbuildbot and related code."""
import os
def _FindSourceRoot():
"""Try and find the root check out of the chromiumos tree"""
source_root = path = os.path.realpath(os.path.join(
os.path.abspath(__file__), '..', '..', '..'))
while True:
if os.path.isdir(os.path.... |
#! /usr/bin/env python
from openturns import *
TESTPREAMBLE()
RandomGenerator.SetSeed(0)
try:
# Instanciate one distribution object
distribution = Uniform(-0.5, 1.5)
print "Distribution ", repr(distribution)
print "Distribution ", distribution
# Get mean and covariance
print "Mean= ", repr(d... |
from pycket import impersonators as imp
from pycket import values
from pycket import values_struct
from pycket import values_hash
from pycket.error import SchemeException
from pycket.prims.expose import expose, expose_val
from pycket.prims.equal import equal_f... |
#!/usr/bin/env python
from omics_pipe.parameters.default_parameters import default_parameters
from omics_pipe.utils import *
p = Bunch(default_parameters)
def Qualimap(sample, extension, Qualimap_flag):
'''Runs Qualimap on a processed .bam file.
input:
_gatk_recal.bam
output:
... |
from __future__ import with_statement
import unittest
import os.path
import IECore
import IECoreGL
IECoreGL.init( False )
class CoordinateSystemTest( unittest.TestCase ) :
__outputFileName = os.path.dirname( __file__ ) + "/output/testCoordinateSystem.tif"
def testNoVisualisation( self ) :
r = IECoreGL.Render... |
# coding=utf-8
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import re
import logging
from flexget import plugin
from flexget.event import event
from flexget.plugins.plugin_urlrewriting import UrlRewritingError
from flexge... |
import os
from setuptools import setup, find_packages
install_requires = [
"Flask==0.10.1",
"Flask-RESTful==0.2.12",
"Flask-PyMongo==0.3.0",
"pymongo==2.7.1",
"python-dateutil==2.2",
"SQLAlchemy==1.0.9",
"Flask-SQLAlchemy==2.1",
"MarkupSafe<=1.1.1",
"Jinja2<=2.11.2",
"itsdangero... |
import os
import pyauto_functional # Must be imported before pyauto
import pyauto
import test_utils
class PasswordTest(pyauto.PyUITest):
"""Tests that passwords work correctly."""
INFOBAR_TYPE = 'password_infobar'
URL = 'https://www.google.com/accounts/ServiceLogin'
URL_HTTPS = 'https://www.google.com/acco... |
#!/usr/bin/env py.test
"Unit tests for the mesh library"
# Copyright (C) 2006 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 o... |
__all__ = ["SearchClassTagExamplesWdg"]
from pyasm.web import DivWdg
from tactic.ui.container import PopupWdg
from base_example_wdg import BaseExampleWdg
class SearchClassTagExamplesWdg(BaseExampleWdg):
def get_example_title(my):
return "Javascript Search Clas Tag Examples"
def get_example_descr... |
import json
import os
import re
import shutil
from contextlib import contextmanager
from test.support import EnvironmentVarGuard
import pytest
import requests_mock
from click.testing import CliRunner
from sentinelsat import SentinelAPI, InvalidChecksumError, QuerySyntaxError
from sentinelsat.scripts.cli import cli
t... |
import mock
from django.conf import settings
from openstack_dashboard.api.rest import cinder
from openstack_dashboard.test import helpers as test
class CinderRestTestCase(test.TestCase):
def test_volumes_get(self):
self._test_volumes_get(False, {})
def test_volumes_get_all(self):
self._test... |
#!/usr/bin/env python
"""
Created on Apr 22, 2013
Create a file of FERPA de-identified demographic data
The program takes five arguments:
A string that names the course;
A file containing the userprofile data, in CSV format;
A file containing the user data, in CSV format;
A file containing the mappin... |
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect
from django.core.exceptions import SuspiciousOperation
from django.shortcuts import render_to_response
from django.utils import simplejson
from django.utils.encoding impo... |
# Defines which version of the trace_dispatch we'll use.
# Should give warning only here if cython is not available but supported.
import os
import sys
from _pydevd_bundle.pydevd_constants import CYTHON_SUPPORTED
use_cython = os.getenv('PYDEVD_USE_CYTHON', None)
dirname = os.path.dirname(os.path.dirname(__file__))
#... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("common", "0014_squashed_60")]
operations = [
migrations.AlterModelOptions(
name="comment",
options={
"default_permissions": [],
"ordering": ("id",),
... |
"""
WSGI config for Ansible Commander project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
# Copyright (c) 2013 AnsibleWorks, INc.
#
# This file is part of Ansible Commander
#
# ... |
from selenium.webdriver.common.by import By
from pages.base import BasePage
class LocalesPage(BasePage):
URL_TEMPLATE = '/locales/'
_america_locales_locator = (By.CSS_SELECTOR, '#america ul > li > a')
_asia_pacific_locales_locator = (By.CSS_SELECTOR, '#asia-pacific ul > li > a')
_europe_locales_loc... |
# GET REVIEWS FROM YELP
# Import libraries
import urllib # to query a website
from bs4 import BeautifulSoup # to parse the data returned from the website
import pandas as pd
import time
import random
# List of possible user agents to prevent getting blacklisted
# more options here: http://www.useragentstring.com/p... |
from _util import *
try:
import sys,re,os,subprocess
except Exception,e:
sys.stderr.write(str(e))
exit(84)
command=""
try:
from _argv import *
if not options.misc: raise Exception("Gitty Error: The delete tag at remote command requires a tag.")
tag=sanitize_str(options.misc[0])
remote=sanitize_str(options.misc[1... |
import angr
from angr.sim_type import SimTypeTop, SimTypeLength, SimTypeInt
import logging
l = logging.getLogger(name=__name__)
class memcmp(angr.SimProcedure):
#pylint:disable=arguments-differ
def run(self, s1_addr, s2_addr, n):
# TODO: look into smarter types here
self.argument_types = {0: ... |
import unittest
from api import command, plugin
class TestCommandSuite(unittest.TestCase):
def test_plugin_basic_args(self):
cmd_test = command.Command(unittest, 'TestCommand')
plugin_test = plugin.Plugin(unittest, 'TestPlugin', [cmd_test])
self.assertEqual(plugin_test.plugin, unittest)
... |
# -*- coding: utf-8 -*-
import sqlite3
from datetime import datetime
dbname = 'database.db'
tablename = 'books'
conn = sqlite3.connect(dbname)
c = conn.cursor()
# 削除するなら
c.execute("SELECT * FROM sqlite_master WHERE type='table' and name='%s'" % tablename)
if c.fetchone() != None: #存在してたら初期化
c.execute('DROP TABLE b... |
'''Top-level entry points to yakonfig.
.. This software is released under an MIT/X11 open source license.
Copyright 2014-2015 Diffeo, Inc.
Most programs' `main()` functions will call yakonfig as::
parser = argparse.ArgumentParser()
yakonfig.parse_args(parser, [yakonfig, module, module...])
where the list... |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils.six.moves.urllib.parse import urlsplit
from django_dynamic_fixture import get
from django_dynamic_fixture import new
from readthedocs.builds.constants import LATEST
from readthedo... |
#=========================================================================
# TestSimpleNetSink.py
#=========================================================================
from copy import deepcopy
from pymtl import *
from pclib.ifcs import InValRdyBundle, OutValRdyBundle
#-------------------------------... |
# coding: utf-8
import sys, os
sys.path.append(os.pardir) # 부모 디렉터리의 파일을 가져올 수 있도록 설정
import numpy as np
from perceptron.layers import *
from perceptron.gradient import numerical_gradient
from collections import OrderedDict
class TwoLayerNet:
def __init__(self, input_size, hidden_size, output_size, weight_init_... |
"""
URLs for the certificates app.
"""
from django.conf import settings
from django.conf.urls import patterns, url
from certificates import views
urlpatterns = patterns(
'',
# Certificates HTML view end point to render web certs by user and course
url(
r'^user/(?P<user_id>[^/]*)/course/{course_i... |
from __future__ import absolute_import
import operator
import uuid
from pgshovel.interfaces.streams_pb2 import Message
from pgshovel.relay.handlers.kafka import KafkaWriter
from pgshovel.utilities import import_extras
from pgshovel.utilities.protobuf import BinaryCodec
from tests.pgshovel.streams.fixtures import tran... |
import logging
import random
from pajbot.managers.handler import HandlerManager
from pajbot.managers.redis import RedisManager
from pajbot.modules.base import ModuleSetting
from pajbot.modules.quest import QuestModule
from pajbot.modules.quests import BaseQuest
from pajbot.streamhelper import StreamHelper
log = logg... |
"""
Copyright 2014-2016 University of Illinois
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writ... |
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.utils.timezone import now
from django.utils.http import is_safe_url
from django.utils.safestring import mark_safe
from django.views import generic
from django.utils.translation impor... |
"""
Copyright 2013 OpERA
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwar... |
import gobject
import os
import re
import signal
import sys
import time
import threading
import traceback
import scanmanager
class Main(object):
"""
Main class of the Bluetooth tracker.
"""
def __init__(self, configfile, errorlogfile):
"""
Initialisation of configuration, logging and D... |
import shared
import templates
import string
import random
import re
from xml.dom import minidom
class Metric(object):
attributes = [ "name", "source", "hw_id", "config" ]
elements = [ "variation_detector", "variation_monitor" ]
values = dict()
count = 0
Table = []
D = dict()
... |
#!/usr/bin/env python
"""
This application presents a 'console' prompt to the user asking for
subscribe commands which create SubscribeCOVRequests. The other commands are
for changing the type of reply to the confirmed COV notification that gets
sent.
"""
from bacpypes.debugging import bacpypes_debugging, ModuleLogg... |
"""The data layer used during training to train a R*CNN network.
AttributesDataLayer implements a Caffe Python layer.
"""
import caffe
from fast_rcnn.config import cfg
from attr_data_layer.minibatch import get_minibatch
import numpy as np
import yaml
from multiprocessing import Process, Queue
# import pdb
class Attr... |
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.backends import ModelBackend
import facebook
class FacebookBackend(ModelBackend):
""" Authenticate a facebook user. """
def authenticate(self, fb_uid=None, fb_graphtoken=None):
""" If we receive a face... |
"""
Tests For Scheduler
"""
import mock
from oslo_config import cfg
from cinder import context
from cinder import db
from cinder import exception
from cinder.scheduler import driver
from cinder.scheduler import filter_scheduler
from cinder.scheduler import manager
from cinder import test
CONF = cfg.CONF
class Sch... |
import re
import string
from typing import Any, Dict
from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook... |
from django import template
from django.template import Library, Node
from django_zoook.settings import *
import os
import cStringIO # *much* faster than StringIO
import urllib
from PIL import Image
register = template.Library()
class ThumbnailNode(Node):
def __init__(self, source_var, size, default):
se... |
from oslo_versionedobjects import base as obj_base
from oslo_versionedobjects import fields as obj_fields
from neutron.common import utils
from neutron.db.models import allowed_address_pair as models
from neutron.objects import base
from neutron.objects import common_types
@obj_base.VersionedObjectRegistry.register
... |
"""Defines a sync module for Blink."""
import logging
from requests.structures import CaseInsensitiveDict
from blinkpy import api
from blinkpy.camera import BlinkCamera, BlinkCameraMini
from blinkpy.helpers.util import time_to_seconds
from blinkpy.helpers.constants import ONLINE
_LOGGER = logging.getLogger(__name__)... |
from django.shortcuts import render, get_object_or_404, redirect
from django.http import HttpResponse, Http404, HttpResponseRedirect, StreamingHttpResponse, JsonResponse
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_http_methods
from django.core.exceptions import ... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from json import loads
from datetime import datetime
from functools import partial
from django.db.models import Q
from django.contrib.gis.measure import Distance
from django.contrib.g... |
#!/usr/bin/python
import re
import smbus
# ===========================================================================
# Adafruit_I2C Class
# ===========================================================================
class Adafruit_I2C(object):
@staticmethod
def getPiRevision():
"Gets the version number of ... |
import os
import magic
import pefile
import base64
import logging
import hashlib
import zipfile
import tempfile
SSDEEP = True
try:
import ssdeep
except ImportError: # pragma: no cover
SSDEEP = False
log = logging.getLogger("Thug")
class SampleLogging(object):
def __init__(self):
self.types = (... |
import ads
from unidecode import unidecode
##### bibcodes.txt has the bibcodes of the publications, one per line (maximum of 10)
with open('bibcodes.txt') as f:
bibcodes = f.read().splitlines()
# PI last name. Does not need to be the full name to help with the woes
# of accented characters, but be careful that it do... |
import csv
import re
from libqtile.widget import base
sensors_mapping = {
'fan_speed': 'fan.speed',
'perf': 'pstate',
'temp': 'temperature.gpu',
}
def _all_sensors_names_correct(sensors):
return all(map(lambda x: x in sensors_mapping, sensors))
class NvidiaSensors(base.ThreadPoolText):
"""Disp... |
# -*- coding: utf-8 -*-
#
# mpmath documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 13 00:14:30 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleab... |
import theano
from theano import tensor, config
import numpy
import linear_cg
import warnings
from pylearn2.testing.skip import skip_if_no_scipy
try:
import scipy.linalg
except ImportError:
warnings.warn("Could not import scipy.linalg")
import time
def test_linear_cg():
rng = numpy.random.RandomState([1,2,... |
import contextlib
from gi.repository import GObject, Gtk
from quodlibet import _
from quodlibet import app
from quodlibet.plugins.events import EventPlugin
from quodlibet.qltk import Icons
from quodlibet.qltk.seekbutton import TimeLabel
from quodlibet.qltk.tracker import TimeTracker
from quodlibet.qltk import Align
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.