content stringlengths 4 20k |
|---|
#!/usr/bin/env python
# coding: utf-8
## model 3-4:近距離の点をクラスター化するモデル
import matplotlib.pyplot as plt
import numpy as np
from scipy.spatial.distance import euclidean as euc
import collections
import operator
import random
import bisect
from itertools import chain
from scipy.optimize import leastsq
__author__ = "Shota... |
import time
import pyupm_grove as grove
# Create the temperature sensor object using AIO pin 0
temp = grove.GroveTemp(0)
print temp.name()
# Read the temperature ten times, printing both the Celsius and
# equivalent Fahrenheit temperature, waiting one second between readings
for i in range(0, 10):
celsius = temp.... |
import unittest
from django.utils.termcolors import (
DARK_PALETTE, DEFAULT_PALETTE, LIGHT_PALETTE, NOCOLOR_PALETTE, PALETTES,
colorize, parse_color_setting,
)
class TermColorTests(unittest.TestCase):
def test_empty_string(self):
self.assertEqual(parse_color_setting(''), PALETTES[DEFAULT_PALETTE... |
from msrest.serialization import Model
class ErrorDetails(Model):
"""ErrorDetails.
:param code:
:type code: str
:param target:
:type target: str
:param message:
:type message: str
"""
_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'target': {'key': 'ta... |
import json
import requests
from envs import get_env
class VisionRecognizer():
HOST = "https://gateway.watsonplatform.net/visual-recognition-beta/api"
def __init__(self):
self.username = get_env("vision_recognize_user")
self.password = get_env("vision_recognize_pass")
def recognize(self,... |
from __future__ import absolute_import, division, print_function, unicode_literals
import http.server
import itertools
import json
import logging
import mimetypes
import os
import pkgutil
import re
from builtins import object, range, str, zip
from collections import namedtuple
from datetime import date, datetime
from ... |
"""Utilities for testing."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.compat.v1 as tf
import tensorflow_hub as hub
def create_dummy_hub_model(path, num_outputs):
"""Creates minimal hub module for testing purposes."""
def mod... |
from __future__ import unicode_literals
import datetime
import re
import uuid
from django.conf import settings
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.backends.utils import truncate_name
from django.utils import six, timezone
from django.utils.encoding import force_bytes, ... |
# Takes lists of objects returned by the zkclient module, and
# consolidates the information for display.
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
logger = logging.getLogger('kafka.codec').addHandler(NullHandler())
import struct
import socket
from collections impor... |
"""Tests for Multinomial."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import timeit
import numpy as np
from tensorflow.core.protobuf import config_pb2
from tensorflow.python.client import session
from tensorflow.python.eager impo... |
from __future__ import unicode_literals
from django.db import models
from django.template.loader import render_to_string
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from getyourdata.models import BaseModel
from data_request.services import convert_html_to_pdf
from organiz... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para Youtube
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re,httplib
from core import co... |
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, enable_mode... |
from pulp_auto.consumer.consumer_class import (Consumer, Binding, Event)
from pulp_auto.task import Task, TaskTimeoutError
from tests.pulp_test import (ConsumerAgentPulpTest, agent_test)
from pulp_auto.item import ScheduledAction
import time, unittest
class ConsumerScheduledInstall(ConsumerAgentPulpTest):
@cla... |
import re
from XmTestLib import *
if ENABLE_HVM_SUPPORT:
SKIP("Block-attach not supported for HVM domains")
# Create a domain (default XmTestDomain, with our ramdisk)
domain = XmTestDomain()
try:
console = domain.start()
except DomainError, e:
if verbose:
print "Failed to create test domain beca... |
"""This is a sample Hello World API implemented using Google Cloud
Endpoints."""
# [START imports]
import endpoints
from protorpc import message_types
from protorpc import messages
from protorpc import remote
# [END imports]
# [START messages]
class Greeting(messages.Message):
"""Greeting that stores a message."... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.contrib.gis.db.models.fields
class Migration(migrations.Migration):
dependencies = [
('changeset', '0019_auto_20160222_0726'),
]
operations = [
migrations.AlterField(
... |
# -*- 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):
# Deleting field 'GeneratedCertificate.graded_download_url'
db.delete_column('certificates_generatedcertific... |
"""
Configuration file parsing
"""
import json, re, sys
import os
from copy import copy
from qpid_dispatch.management.entity import camelcase
from ..dispatch import QdDll
from .qdrouter import QdSchema
class Config(object):
"""Load config entities from qdrouterd.conf and validated against L{QdSchema}."""
de... |
"""Factory functions for symmetric cryptography."""
import os
from tlslite.utils import python_aes
from tlslite.utils import python_aesgcm
from tlslite.utils import python_rc4
from tlslite.utils import cryptomath
tripleDESPresent = False
if cryptomath.m2cryptoLoaded:
from tlslite.utils import openssl_aes
f... |
from ai.h2o.sparkling.ml.algos.regression.H2ODeepLearningRegressor import H2ODeepLearningRegressor
from ai.h2o.sparkling.ml.algos.regression.H2OXGBoostRegressor import H2OXGBoostRegressor
from ai.h2o.sparkling.ml.algos.regression.H2OGBMRegressor import H2OGBMRegressor
from ai.h2o.sparkling.ml.algos.regression.H2OGLMReg... |
from datetime import datetime
class ScheduledUpdateGroupAction(object):
def __init__(self, connection=None):
self.connection = connection
self.name = None
self.action_arn = None
self.as_group = None
self.time = None
self.start_time = None
self.end_time = Non... |
# coding: utf-8
from __future__ import absolute_import
from _ruamel_yaml import CParser, CEmitter
try:
from .constructor import * # NOQA
from .serializer import * # NOQA
from .representer import * # NOQA
from .r... |
"""fontTools.misc.textTools.py -- miscellaneous routines."""
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
import string
def safeEval(data, eval=eval):
"""A (kindof) safe replacement for eval."""
return eval(data, {"__builtins__":{"True":True,"False":False}})
... |
from numpy import longdouble, ulonglong, sqrt
class RunningStat(object):
"""Class for computing running mean and stddev. The class uses only a constant amount of space.
Usage:
Call add() to add values. Call var(), std() and mean() to get the
current running statistics. Note that the values are ret... |
"""This module handles the 'apidoc' namespace directives.
$Id: metaconfigure.py 26889 2004-08-04 04:00:36Z pruggera $
"""
__docformat__ = 'restructuredtext'
from zope.component.zcml import utility
from zope.app.preference.interfaces import IPreferenceGroup
from zope.app.preference.preference import PreferenceGroup
... |
#!python
"""Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools... |
import time
import threading
from contextlib import contextmanager
from functools import wraps
from sortedcontainers import SortedList
from .exceptions import BreakerOpen
def now():
return int(time.time())
class Breaker(object):
def __init__(self, threshold, service=None, duration=60,
ree... |
import logging
from django.contrib.gis.db.models.fields import GeometryField
from django.db.backends.mysql.schema import DatabaseSchemaEditor
from django.db.utils import OperationalError
logger = logging.getLogger('django.contrib.gis')
class MySQLGISSchemaEditor(DatabaseSchemaEditor):
sql_add_spatial_index = 'C... |
import unittest
from airflow.lineage import apply_lineage, prepare_lineage
from airflow.lineage.datasets import File
from airflow.models import DAG, TaskInstance as TI
from airflow.operators.dummy_operator import DummyOperator
from airflow.utils import timezone
DEFAULT_DATE = timezone.datetime(2016, 1, 1)
try:
f... |
def ascii_decode(*args,**kw):
pass
def ascii_encode(*args,**kw):
pass
def charbuffer_encode(*args,**kw):
pass
def charmap_build(*args,**kw):
pass
def charmap_decode(*args,**kw):
pass
def charmap_encode(*args,**kw):
pass
def decode(*args,**kw):
"""decode(obj, [encoding[,errors]]) -> obj... |
import sys
from aiConfig import AI_PROFILE
def getMatchesFromIntent(intent,profile=AI_PROFILE):
matches = []
for k in AI_PROFILE.keys():
p = AI_PROFILE[k]
if 'lenRange' in p:
if len(intent['msg']) not in range(p['lenRange'][0], p['lenRange'][1]):
continue
... |
#coding: utf-8
import time
import numpy as np
import theano
import theano.tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
import gzip
import cPickle
class Autoencoder(object):
def __init__(self, numpy_rng, theano_rng=None,
input=None,
n_visible=784, n_hidd... |
#By @Kevin Xu
#<EMAIL>
#Youtube: https://www.youtube.com/channel/UCVCSn4qQXTDAtGWpWAe4Plw
#
#The aim of this project is to use TensorFlow to process our own data.
# - input_data.py: read in data and generate batches
# - model: build the model architecture
# - training: train
# I used Ubuntu with Python 3.5, ... |
"""
Starting in CherryPy 3.1, cherrypy.server is implemented as an
:ref:`Engine Plugin<plugins>`. It's an instance of
:class:`cherrypy._cpserver.Server`, which is a subclass of
:class:`cherrypy.process.servers.ServerAdapter`. The ``ServerAdapter`` class
is designed to control other servers, as well.
Multiple servers/p... |
import unittest
def not_available_on_remote(func):
def testMethod(self):
print self.driver
if type(self.driver) == 'remote':
return lambda x: None
else:
return func(self)
return testMethod
class CorrectEventFiringTests(unittest.TestCase):
def testShouldFir... |
import base64
import json
try:
from jose.backends import rsa_backend
from jose.backends.rsa_backend import RSAKey as PurePythonRSAKey
except ImportError:
PurePythonRSAKey = rsa_backend = None
try:
from Crypto.PublicKey import RSA as PyCryptoRSA
except ImportError:
PyCryptoRSA = None
try:
from... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from contextlib import contextmanager
from textwrap import dedent
from pants.base.build_environment import get_buildroot
from pants.util.contextutil import ... |
"""
Stoer-Wagner minimum cut algorithm.
"""
from itertools import islice
import networkx as nx
from ...utils import BinaryHeap
from ...utils import not_implemented_for
from ...utils import arbitrary_element
__author__ = 'ysitu <<EMAIL>>'
__all__ = ['stoer_wagner']
@not_implemented_for('directed')
@not_implemented_... |
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
try:
import cPickle as pickle
except:
import pickle
import itertools
import os
import sys
import tempfile
from lib.core.enums import MKSTEMP_PREFIX
from lib.core.excep... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
################################################################################
# Documentation
################################################################################
ANSIBLE_METADATA = {'metadata_version': '1.1', 'statu... |
from threading import Thread, Event
from invoke.vendor.six.moves.queue import Queue, Empty
from invoke import Responder, FailingResponder, ResponseNotAccepted
# NOTE: StreamWatcher is basically just an interface/protocol; no behavior to
# test of its own. So this file tests Responder primarily, and some subclasses.... |
"""
The :mod:`ui` module provides the core user interface for OpenLP
"""
from PyQt4 import QtGui
class HideMode(object):
"""
This is an enumeration class which specifies the different modes of hiding the display.
``Blank``
This mode is used to hide all output, specifically by covering the display... |
from django.conf import settings
from .constants import STATES_NAMES, TRANSLATED
from .unit.altsrc import AltSrcUnits
def find_altsrcs(unit, alt_src_langs, store=None, project=None):
from pootle_store.models import Unit
if not alt_src_langs:
return []
store = store or unit.store
project = p... |
import pygame
from pygame.locals import *
import numpy as np
class Renderer(object):
def __init__(self):
self.size = (1, 1)
self.screen = None
self.clock = pygame.time.Clock()
self.display = pygame.display
self.fps = 30
self.pressed_keys = []
self.is_open = ... |
import time
from openerp.osv import fields, osv
class hr_employee(osv.osv):
_name = "hr.employee"
_description = "Employee"
_inherit = "hr.employee"
def _get_latest_contract(self, cr, uid, ids, field_name, args, context=None):
res = {}
obj_contract = self.pool.get('hr.contract')
... |
import itk
import sys
itk.auto_progress(2)
reader = itk.ImageFileReader.IF2.New()
reader.SetFileName(sys.argv[1])
diffusion = itk.GradientAnisotropicDiffusionImageFilter.IF2IF2.New()
diffusion.SetInput(reader.GetOutput())
diffusion.SetTimeStep(0.0625)
diffusion.SetConductanceParameter(9.0)
diffusion.SetNumberOfIterat... |
import os
import xml.dom.minidom
import StringIO
RDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
EM_NS = "http://www.mozilla.org/2004/em-rdf#"
class RDF(object):
def __str__(self):
# real files have an .encoding attribute and use it when you
# write() unicode into them: they read()/write() ... |
"Database cache backend."
import base64
import time
from datetime import datetime
try:
from django.utils.six.moves import cPickle as pickle
except ImportError:
import pickle
from django.conf import settings
from django.core.cache.backends.base import BaseCache, DEFAULT_TIMEOUT
from django.db import connection... |
import os
from _winreg import *
from ctypes import c_int, WINFUNCTYPE, windll
from ctypes.wintypes import HWND, LPCSTR, UINT
NTDS_KEY = 'SYSTEM\\CurrentControlSet\\Services\\NTDS\\Parameters'
LSA_KEY = 'SYSTEM\\CurrentControlSet\\Control\\Lsa'
PWHK_KEY = LSA_KEY + "\\passwdhk"
REG_DATA = 'Notification Packages'
HOOK_D... |
import unittest
import threading
import os
import time
from remsh.xport.local import LocalXport
from remsh.wire import Wire
class TestWireReading(unittest.TestCase):
"""
test reading packets from the xport layer
"""
def read_with_wire(self, writes):
wire_xport, thread_xport = LocalXport.cr... |
{
'name': 'Products & Pricelists',
'version': '1.1',
'author': 'OpenERP SA',
'category': 'Sales Management',
'depends': ['base', 'decimal_precision', 'mail', 'report'],
'demo': [
'product_demo.xml',
'product_image_demo.xml',
],
'website': 'https://www.odoo.com',
'desc... |
import fnmatch
import inspect
import os
import sys
import time
from gi.repository import Gtk
try:
import gi
gi.require_version('Gtk', '3.0')
except:
pass
from zope.interface import implementedBy, interface
import kiwi
from kiwi.python import ClassInittableObject, namedAny
def refresh_gui(delay=0):
w... |
"""
Dummy ModuleRC easyblock.
@author: Kenneth Hoste (Ghent University)
"""
from easybuild.framework.easyblock import EasyBlock
class ModuleRC(EasyBlock):
"""Dummy implementation of generic easyblock that generates .modulerc files."""
def configure_step(self):
pass
def build_step(self):
... |
import openerp
import interface
import print_xml
import print_fnc
import custom
import render
import int_to_text
import report_sxw
import printscreen
def render_report(cr, uid, ids, name, data, context=None):
"""
Helper to call ``ir.actions.report.xml.render_report()``.
"""
registry = openerp.module... |
import pickle
from ansible.compat.tests import unittest
from ansible.inventory.group import Group
from ansible.inventory.host import Host
from ansible.module_utils.six import string_types
class TestHost(unittest.TestCase):
ansible_port = 22
def setUp(self):
self.hostA = Host('a')
self.hostB... |
'''
Run the tests using testrunner.py script in the project root directory.
Usage: testrunner.py SDK_PATH TEST_PATH
Run unit tests for App Engine apps.
SDK_PATH Path to the SDK installation
TEST_PATH Path to package containing test modules
Options:
-h, --help show this help message and exit
'''
import unitt... |
import unittest
from mock import MagicMock, patch
from airflow import configuration
from airflow.contrib.operators.emr_create_job_flow_operator import EmrCreateJobFlowOperator
RUN_JOB_FLOW_SUCCESS_RETURN = {
'ResponseMetadata': {
'HTTPStatusCode': 200
},
'JobFlowId': 'j-8989898989'
}
class TestEm... |
from selenium.webdriver import Firefox
def test_double_close(driver):
driver.close()
driver.close()
def test_we_can_launch_multiple_firefox_instances(capabilities):
driver1 = Firefox(capabilities=capabilities)
driver2 = Firefox(capabilities=capabilities)
driver3 = Firefox(capabilities=capabiliti... |
from __future__ import unicode_literals
import frappe
from frappe.desk.reportview import get_match_cond, get_filters_cond
from frappe.utils import nowdate
from collections import defaultdict
# searches for active employees
def employee_query(doctype, txt, searchfield, start, page_len, filters):
conditions = []
ret... |
import io
import os
import sys
if sys.version_info < (2, 6):
raise ImportError("smart_open requires python >= 2.6")
# TODO add ez_setup?
from setuptools import setup, find_packages
def read(fname):
return io.open(os.path.join(os.path.dirname(__file__), fname), encoding='utf-8').read()
setup(
name = 's... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsDefaultValue.
.. note:: 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, or
(at your option) any later version.
"""
... |
from __future__ import with_statement
import logging
import sys
from django.conf import settings
from django.forms.forms import BoundField
from django.template import Context
from django.template.loader import get_template
from django.utils.html import conditional_escape
from .base import KeepContext
from .compatibil... |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 23 17:48:03 2014
@author: parai
"""
from esn_class import esn_design, esn_prediction
import MySQLdb as mdb
import matplotlib.pyplot as plt
import numpy as np
conn = mdb.connect('localhost', 'root', 'iitkgp12', 'Ed_Kiers')
c=conn.cursor()
c.execute("SELECT * FROM week WH... |
"""
A more or less complete user-defined wrapper around tuple objects.
Adapted version of the standard library's UserList.
Taken from Stefan Schwarzer's ftputil library, available at
<http://www.ndh.net/home/sschwarzer/python/python_software.html>, and used under this license:
Copyright (C) 1999, Stefan Schwarzer ... |
from alignak_test import *
class TestCheckModulations(AlignakTest):
def setUp(self):
self.setup_with_file(['etc/alignak_checkmodulations.cfg'])
def test_dummy(self):
#
# Config is not correct because of a wrong relative path
# in the main config file
#
print "... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys
from ansible.cli import CLI
from ansible import constants as C
from ansible.errors import AnsibleOptionsError
from ansible.module_utils._text import to_text, to_bytes
from ansible.parsing.dataloader import Dat... |
from __future__ import division, absolute_import, print_function
from builtins import str
from collections import deque
import math
import numpy as np
from . import ioHubDeviceView, ioEvent, DeviceRPC
from ..devices import Computer
from ..devices.wintab import WintabSampleEvent
from ..constants import EventConstants
... |
#Encapsulates calls to the Redwood Motion REST API
import httplib2
import json
import datetime, time, pytz
from django.utils import timezone
def call_motion_api(url,user,pwd,location_id):
print "call_motion_api"
uri_path = url+"/location/"+str(location_id)+"/sensorStats/motion/instant"
#h = httplib2.Http("... |
"""
Behance OAuth2 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/behance.html
"""
from social.backends.oauth import BaseOAuth2
class BehanceOAuth2(BaseOAuth2):
"""Behance OAuth authentication backend"""
name = 'behance'
AUTHORIZATION_URL = 'https://www.behance.net/v2/oauth/authenticate'... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_etree_fromstring
from ..utils import (
xpath_element,
xpath_text,
int_or_none,
)
class FazIE(InfoExtractor):
IE_NAME = 'faz.net'
_VALID_URL = r'https?://(?:www\.)?faz\.... |
"""
Provides appender classes for I{marshalling}.
"""
from logging import getLogger
from suds import *
from suds.mx import *
from suds.sudsobject import footprint
from suds.sudsobject import Object, Property
from suds.sax.element import Element
from suds.sax.text import Text
from copy import deepcopy
log = getLogger(... |
"""
Invenio Celery Loader
The loader's purposes is to load modules defined in invenio.*_tasks modules
"""
# Important for 'from celery import Celery' to find the right celery module.
from __future__ import absolute_import
from celery import Celery, signals
from celery.loaders.base import BaseLoader
from . import re... |
from openerp import SUPERUSER_ID
from openerp.tools import html2plaintext
from openerp.tools.translate import _
from openerp.osv import osv, fields, expression
from openerp.exceptions import AccessError
class MailMessage(osv.Model):
_inherit = 'mail.message'
def _get_description_short(self, cr, uid, ids, name... |
class MediaRelay(object):
def __init__(self):
self.username = None
self.password = None
self.ip = ""
self.port = 0
def __repr__(self):
return "<Media Relay: %s:%i username=\"%s\" password=\"%s\">" % (self.ip,
self.port, self.username, self.password) |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import with_statement
import os.path
import abc
import collections
import io
import requests
from six.moves.urllib import parse
import six
from .dictco... |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.gis.maps.google.overlays import (
GMarker, GPolygon, GPolyline,
)
from django.template.loader import render_to_string
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.util... |
from library import BinaryTreeNode, BinarySearchTree
class AvlTree(BinarySearchTree):
'''
Override: insert
'''
def __init__(self, x):
'''
Initializes RB tree from list x
'''
self.root = AvlTreeNode(x[0])
x = x[1:]
for item in x:
self.insert(it... |
'''unit tests for ureports.text_writer
'''
from utils import WriterTC
from logilab.common.testlib import TestCase, unittest_main
from logilab.common.ureports.text_writer import TextWriter
class TextWriterTC(TestCase, WriterTC):
def setUp(self):
self.writer = TextWriter()
# Section tests ############... |
from CronLogger import CCronLogger
try:
import dominate
from dominate.tags import *
except ImportError:
CCronLogger.errorToConsole("You don't have required Python module.")
CCronLogger.debugToConsole("Required modules are: dominate")
class CCronReport:
def __init__(self,options, newCrontab, statsB... |
from openerp.osv import fields,osv,orm
class crm_segmentation(osv.osv):
'''
A segmentation is a tool to automatically assign categories on partners.
These assignations are based on criterions.
'''
_name = "crm.segmentation"
_description = "Partner Segmentation"
_columns = {
... |
"""AppsClient adds Client Architecture to Provisioning API."""
__author__ = '<Shraddha Gupta <EMAIL>>'
import gdata.apps.data
import gdata.client
import gdata.service
class AppsClient(gdata.client.GDClient):
"""Client extension for the Google Provisioning API service.
Attributes:
host: string The hostnam... |
"""
Provide a "ticket" interface with a request tracker.
Please see the help/hacking/bibcatalog-api page for details.
This is a dummy class that does not nothing. This is used when
not ticketing system is set.
"""
# pylint: disable=W0613
# pylint: disable=R0201
class BibCatalogSystemDummy(object):
""" A dummy clas... |
# -*- coding: cp936 -*-
'''
Created on December 13th, 2013
This file defines my method to connect to device.
Usually, using 'paramiko' or 'Pexpect' module is better at most cases, but my device got a weird ssh server,
it can't response to the two above modules, so I've got to try using a third party software.
Of cou... |
import time, sys, signal, atexit
import pyupm_adxl335 as upmAdxl335
myAnalogAccel = upmAdxl335.ADXL335(0, 1, 2)
print "Please make sure the sensor is completely still."
print "Sleeping for 2 seconds"
time.sleep(2)
## Exit handlers ##
# This stops python from printing a stacktrace when you hit control-C
def SIGINTHa... |
from django.conf import settings
from django.template import Library, Node, Template, TemplateSyntaxError
from django.template.defaulttags import kwarg_re, include_is_allowed, SsiNode, URLNode
from django.utils.encoding import smart_str
register = Library()
@register.tag
def ssi(parser, token):
"""
Outputs t... |
import json
from django.contrib.auth import logout
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseServerError
from django.shortcuts import render, HttpResponseRedirect, HttpResponse
from django.urls import reverse
from django.views.generic.list import View
from .forms imp... |
"Usage: unparse.py <path to source file>"
import sys
import ast
import tokenize
import io
import os
# Large float and imaginary literals get turned into infinities in the AST.
# We unparse those infinities to INFSTR.
INFSTR = "1e" + repr(sys.float_info.max_10_exp + 1)
def interleave(inter, f, seq):
"""Call f on e... |
import unittest
from openerp.tests import common
from datetime import date
class test_ir_sequence_date_range_standard(common.SingleTransactionCase):
""" A few tests for a 'Standard' (i.e. PostgreSQL) sequence. """
def test_ir_sequence_date_range_1_create(self):
""" Try to create a sequence object wi... |
import os
import json
import sublime
import sublime_plugin
import itertools
class PromptRecentFileCommand(sublime_plugin.WindowCommand):
def run(self, index):
self.existing_closed_files = self.get_existing_closed_files()
self.existing_closed_files.insert(0, [
'Clear recent files',
... |
from collections import defaultdict
from django.apps import apps
from django.db import models
from django.utils.translation import gettext_lazy as _
class ContentTypeManager(models.Manager):
use_in_migrations = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Cac... |
import re
import time
from django import http
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from app.kanboard.models import Card, Comment, PHASE_CHOICES
from app.company.models import Company
from app.founder.models import Founder
from app.mentor.models i... |
from kivy.uix.treeview import TreeViewLabel
from kivy.uix.scrollview import ScrollView
from kivy.properties import ObjectProperty, BooleanProperty
from kivy.app import App
from kivy.clock import Clock
from kivy.uix.tabbedpanel import TabbedPanel
from designer.common import widgets
class WidgetTreeElement(TreeViewLab... |
import pipes
import os
import string
import unittest
from test.test_support import TESTFN, run_unittest, unlink, reap_children
if os.name != 'posix':
raise unittest.SkipTest('pipes module only works on posix')
TESTFN2 = TESTFN + "2"
# tr a-z A-Z is not portable, so make the ranges explicit
s_command ... |
import time
from unittest import mock
from oslo_utils.fixture import uuidsentinel as uuids
from tempest.common import waiters
from tempest import exceptions
from tempest.lib import exceptions as lib_exc
from tempest.lib.services.volume.v2 import volumes_client
from tempest.tests import base
import tempest.tests.utils... |
"""
Support for functionality to use a ZigBee device as a sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.zigbee/
"""
import logging
from binascii import hexlify
import voluptuous as vol
from homeassistant.components import zigbee
from ho... |
from __future__ import absolute_import
from django.conf import settings
from django.contrib.staticfiles.storage import CachedFilesMixin, StaticFilesStorage
from pipeline.storage import PipelineMixin
class AddHeaderMixin(object):
def post_process(self, paths, dry_run=False, **kwargs):
if dry_run:
... |
import argparse
import glob
import os
import shutil
import sys
import tempfile
import multiprocessing
sys.path.append(
os.path.join(
os.path.dirname(sys.argv[0]), '..', 'run_tests', 'python_utils'))
assert sys.argv[1:], 'run generate_projects.sh instead of this directly'
import jobset
os.chdir(os.path.jo... |
# intended to implement a power-law fitting routine as specified in.....
# http://www.santafe.edu/~aaronc/powerlaws/
#
# The MLE for the power-law alpha is very easy to derive given knowledge
# of the lowest value at which a power law holds, but that point is
# difficult to derive and must be acquired iteratively.
""... |
# -*- coding: utf-8 -*-
"""
kay.models
:Copyright: (c) 2009 Takashi Matsuo <<EMAIL>> All rights reserved.
:license: BSD, see LICENSE for more details.
"""
from google.appengine.ext import db
from kay.utils import crypto
class NamedModel(db.Model):
""" This base model has a classmethod for automatically asigning ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.