content string |
|---|
from autobahn.asyncio.websocket import WebSocketClientProtocol, \
WebSocketClientFactory
import asyncio
class MyClientProtocol(WebSocketClientProtocol):
def onConnect(self, response):
print("Server connected: {0}".format(response.peer))
@asyncio.coroutine
def ... |
from itertools import chain
from django.utils.itercompat import is_iterable
class Tags:
"""
Built-in tags for internal checks.
"""
admin = 'admin'
caches = 'caches'
compatibility = 'compatibility'
database = 'database'
models = 'models'
security = 'security'
signals = 'signals... |
"""
The :mod:`sklearn.utils` module includes various utilites.
"""
from collections import Sequence
import numpy as np
from scipy.sparse import issparse
import warnings
from .murmurhash import murmurhash3_32
from .validation import (as_float_array, check_arrays, safe_asarray,
assert_all_fini... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import os
import re
from ansible.module_utils.basic import AnsibleModule
class Blacklist(o... |
from contextlib import contextmanager
from datetime import datetime
from inspect import isclass
from celery import chord, group
from celery_once import QueueOnce
from celery.schedules import crontab
from celery.utils.log import get_task_logger
from sqlalchemy.orm.attributes import flag_modified
# from pipet import ce... |
import os
from importlib import import_module
from django.core.exceptions import ImproperlyConfigured
from django.utils.module_loading import module_has_submodule
MODELS_MODULE_NAME = 'models'
class AppConfig:
"""Class representing a Django application and its configuration."""
def __init__(self, app_name,... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import sys
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from ansible.compat.tests import unittest
from ansible.compat.te... |
import unittest, os, errno
from ctypes import *
from ctypes.util import find_library
from test import test_support
try:
import threading
except ImportError:
threading = None
class Test(unittest.TestCase):
def test_open(self):
libc_name = find_library("c")
if libc_name is None:
r... |
import os
import shutil
import sys
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.base.creation import BaseDatabaseCreation
from django.utils.encoding import force_text
from django.utils.six.moves import input
class DatabaseCreation(BaseDatabaseCreation):
@staticmethod
def i... |
from __future__ import absolute_import, unicode_literals
import json
import hashlib
from django import forms
from django.conf import settings
from django.db import connections
from django.utils.encoding import force_text
from django.utils.functional import cached_property
from django.core.exceptions import Validation... |
import os, sys, requests, pprint, re, json
from uritemplate import URITemplate, expand
from subprocess import call
changelog_file = '../../changelog.txt'
token_file = '../../../TelegramPrivate/github-releases-token.txt'
version = ''
commit = ''
for arg in sys.argv:
if re.match(r'\d+\.\d+', arg):
version = arg
... |
import os
import numpy as np
import uuid
import unittest
import pylab
import hhfit
class TestFindRateFn(unittest.TestCase):
def setUp(self):
self.vmin = -120e-3
self.vmax = 40e-3
self.vdivs = 640
self.v_array = np.linspace(self.vmin, self.vmax, self.vdivs+1)
# Parameters for... |
"""Schur decomposition functions."""
import numpy
from numpy import asarray_chkfinite, single
# Local imports.
import misc
from misc import LinAlgError, _datacopied
from lapack import get_lapack_funcs
from decomp import eigvals
__all__ = ['schur', 'rsf2csf']
_double_precision = ['i','l','d']
def schur(a, output='... |
from keystone import exception
class DictKvs(dict):
def get(self, key, default=None):
try:
return self[key]
except KeyError:
if default is not None:
return default
raise exception.NotFound(target=key)
def set(self, key, value):
if is... |
"""Simple MNIST classifier example with JIT XLA and timelines.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
from tensorflow.python.client ... |
from django.forms.widgets import Textarea
from django.template import loader, Context
from django.templatetags.static import static
from django.utils import translation
from django.contrib.gis.gdal import OGRException
from django.contrib.gis.geos import GEOSGeometry, GEOSException
# Creating a template context that c... |
"""Module to parse ANSI escape sequences
Maintainer: Jean-Paul Calderone
"""
import string
# Twisted imports
from twisted.python import log
class ColorText:
"""
Represents an element of text along with the texts colors and
additional attributes.
"""
# The colors to use
COLORS = ('b', 'r', '... |
# Test the functions and main class method of FormatParagraph.py
import unittest
from idlelib import FormatParagraph as fp
from idlelib.EditorWindow import EditorWindow
from tkinter import Tk, Text, TclError
from test.support import requires
class Is_Get_Test(unittest.TestCase):
"""Test the is_ and get_ functions... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import unescapeHTML
class BaiduVideoIE(InfoExtractor):
IE_DESC = '百度视频'
_VALID_URL = r'https?://v\.baidu\.com/(?P<type>[a-z]+)/(?P<id>\d+)\.htm'
_TESTS = [{
'url': 'http://v.baidu.com... |
import json
import logging
from oslo_utils import units
from django import conf
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import tables
fr... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class account_move_line_reconcile_select(osv.osv_memory):
_name = "account.move.line.reconcile.select"
_description = "Move line reconcile select"
_columns = {
'account_id': fields.many2one('account.account', 'Account', \
... |
__doc__ = """
SCons compatibility package for old Python versions
This subpackage holds modules that provide backwards-compatible
implementations of various things that we'd like to use in SCons but which
only show up in later versions of Python than the early, old version(s)
we still support.
Other code will not gen... |
import unittest
from IECore import *
class TestShader( unittest.TestCase ) :
def test( self ) :
s = Shader()
self.assertEqual( s.name, "defaultsurface" )
self.assertEqual( s.type, "surface" )
self.assertEqual( len( s.parameters ), 0 )
self.assertEqual( s.parameters.typeName(), "CompoundData" )
s = Sha... |
from __future__ import unicode_literals
import frappe
from frappe.utils import cint, validate_email_add
from frappe import throw, msgprint, _
from frappe.model.document import Document
class Warehouse(Document):
def autoname(self):
suffix = " - " + frappe.db.get_value("Company", self.company, "abbr")
if not sel... |
from vcoptparse import *
import vm_build
import sys
from threading import Thread, Semaphore
class Builder(Thread):
def __init__(self, name, branch, target, semaphore):
Thread.__init__(self)
self.name = name
self.branch = branch
self.target = target
self.semaphore = semaphore... |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013 ARM Limited
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 ... |
"""
Various tests for synchronization primitives.
"""
import sys
import time
from thread import start_new_thread, get_ident
import threading
import unittest
from test import test_support as support
def _wait():
# A crude wait/yield function not relying on synchronization primitives.
time.sleep(0.01)
class ... |
from __future__ import unicode_literals
from datetime import datetime, timedelta
from django.template.defaultfilters import timesince_filter
from django.test import SimpleTestCase
from django.test.utils import requires_tz_support
from ..utils import setup
from .timezone_utils import TimezoneTestCase
class Timesinc... |
"""
============================================================================
Decoding in time-frequency space data using the Common Spatial Pattern (CSP)
============================================================================
The time-frequency decomposition is estimated by iterating over raw data that
has be... |
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class Scope(object):
USERINFO_PROFILE = "/authenticate"
class OrcidAccount(ProviderAccount):
def get_profile_url(self):
return extract_from_dict(self.account.ex... |
import json
import re
import yaml
import base64
import velruse
import datetime
from pygithub3 import Github
from pyramid.httpexceptions import HTTPFound
from pyramid.view import view_config
from verse.utils import set_content
#from pyramid.i18n import TranslationString as _
from .models import (
DBSession,
Us... |
from javascript import JSObject
from browser import window
import urllib.request
class TempMod:
def __init__(self, name):
self.name=name
#define my custom import hook (just to see if it get called etc).
class BaseHook:
def __init__(self, fullname=None, path=None):
self._fullname=fullname
self._p... |
"""An optimizer that switches between several methods."""
import tensorflow as tf
from tensorflow.python.training import optimizer
class CompositeOptimizer(optimizer.Optimizer):
"""Optimizer that switches between several methods.
"""
def __init__(self,
optimizer1,
optimizer2,
... |
{
'name': 'Invoice on Timesheets',
'version': '1.0',
'category': 'Sales Management',
'description': """
Generate your Invoices from Expenses, Timesheet Entries.
========================================================
Module to generate invoices based on costs (human resources, expenses, ...).
You can... |
from django.conf.urls import patterns
urlpatterns = patterns('survey.views',
# Survey urls
(r'^module/survey/$', 'survey_list'),
(r'^module/survey/add/$', 'survey_add'),
(r'^module/sealed_survey_view/(.+)/$', 'sealed_survey_view'),
(r'^module/survey/del/(.+)/$', 'survey_del'),
(r'^module/surve... |
"""Definition of WebDriverException classes."""
def create_webdriver_exception_strict(status_code, message):
"""Create the appropriate WebDriverException given the status_code."""
if status_code in _exceptions_strict:
return _exceptions_strict[status_code](message)
return UnknownStatusCodeException... |
from __future__ import unicode_literals
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.http import Http404
from django.utils.translation import ugettext as _
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
class SingleObjectMixin(Conte... |
from .utils import kwarg_decorator, last_arg_decorator
from .version import version as __version__
from .version import version_info
__all__ = [
'__version__', 'version_info', 'registry', 'register_model_chooser',
'register_simple_model_chooser', 'register_filter',
]
class Registry(object):
def __init__(... |
__all__ = ['FlashFileNaming']
import os, re
from pyasm.biz import FileNaming, Project, Snapshot, File
from pyasm.common import TacticException
class FlashFileNaming(FileNaming):
def add_ending(my, parts, auto_version=False):
context = my.snapshot.get_value("context")
version = my.snapshot.get_v... |
"""
Various asynchronous TCP/IP classes.
End users shouldn't use this module directly - use the reactor APIs instead.
Maintainer: Itamar Shtull-Trauring
"""
# System imports
import os, sys, stat, socket, struct
from errno import EINTR, EMSGSIZE, EAGAIN, EWOULDBLOCK, ECONNREFUSED, ENOBUFS
from zope.interface import ... |
"""DSA public-key signature algorithm.
DSA_ is a widespread public-key signature algorithm. Its security is
based on the discrete logarithm problem (DLP_). Given a cyclic
group, a generator *g*, and an element *h*, it is hard
to find an integer *x* such that *g^x = h*. The problem is believed
to be difficult, and it h... |
"""Setup for instrumentation host-driven tests."""
import logging
import os
import sys
import types
from pylib.host_driven import test_case
from pylib.host_driven import test_info_collection
from pylib.host_driven import test_runner
def _GetPythonFiles(root, files):
"""Returns all files from |files| that end in '... |
"""
Simple DOM for both SGML and XML documents.
"""
from __future__ import division
from __future__ import generators
from __future__ import nested_scopes
import transforms
class Container:
def __init__(self):
self.children = []
def add(self, child):
child.parent = self
self.children.append(child)
... |
"""
Support for MyQ-Enabled Garage Doors.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/cover.myq/
"""
import logging
import voluptuous as vol
from homeassistant.components.cover import CoverDevice
from homeassistant.const import (
CONF_USERNAME, CON... |
#!/usr/bin/env python
"""This file abstracts the loading of the private key."""
from cryptography import x509
from cryptography.hazmat.backends import openssl
from cryptography.hazmat.primitives import hashes
from cryptography.x509 import oid
from grr.lib import rdfvalue
from grr.lib.rdfvalues import crypto as rdf_c... |
import gdb
import os
import re
from linux import modules
if hasattr(gdb, 'Breakpoint'):
class LoadModuleBreakpoint(gdb.Breakpoint):
def __init__(self, spec, gdb_command):
super(LoadModuleBreakpoint, self).__init__(spec, internal=True)
self.silent = True
self.gdb_comman... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'N j, Y'
TIME_FORMAT = 'P'
DATETIME_FORMAT = 'N j, Y, P'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'F j'
SHORT_DATE_FORMAT = 'm/d/Y'... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible import constants as C
from ansible.plugins.action import ActionBase
from ansible.utils.vars import merge_hash
class ActionModule(ActionBase):
def run(self, tmp=None, task_vars=None):
self._supports_async... |
"""
``httm.transformations.metadata``
=================================
This module contains metadata related to transformation functions.
- ``electron_flux_transformations`` is metadata describing transformation functions from images in
electron counts to simulated raw images in *Analogue to Digital Converter ... |
from __future__ import unicode_literals
import os
from flask_webpackext import FlaskWebpackExt
from flask_webpackext.manifest import JinjaManifestLoader
from pywebpack import ManifestLoader
from indico.web.assets.util import get_custom_assets
class IndicoManifestLoader(JinjaManifestLoader):
cache = {}
def... |
"""
Views and functions for serving static files. These are only to be used
during development, and SHOULD NOT be used in a production setting.
"""
from __future__ import unicode_literals
import mimetypes
import os
import posixpath
import re
import stat
from django.http import (
FileResponse, Http404, HttpRespons... |
'''Unit tests for grit.tclib'''
import sys
import os.path
if __name__ == '__main__':
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import types
import unittest
from grit import tclib
from grit import exception
import grit.extern.tclib
class TclibUnittest(unittest.TestCase):
def testInit(self... |
import terminal
import curses
import time
from curses import panel
class InfoContainer(object):
def __init__(self, stdscreen, title, debug_console):
self.debug_console = debug_console
self.height = int(terminal.height/2)
self.width = terminal.width - 2
self.title = title
s... |
#!/usr/bin/env python
"""Node Server Example
This example demonstrates how to create a very simple node server
that supports bi-diractional messaging between server and connected
clients forming a cluster of nodes.
"""
from __future__ import print_function
from os import getpid
from optparse import OptionParser
... |
import logging
import os
import time
from webkitpy.common.system.crashlogs import CrashLogs
from webkitpy.common.system.executive import ScriptError
from webkitpy.port.apple import ApplePort
from webkitpy.port.leakdetector import LeakDetector
_log = logging.getLogger(__name__)
class MacPort(ApplePort):
port_na... |
import os
import shutil
import stat
import sys
SRC_DIR = os.path.join(sys.path[0], os.pardir, os.pardir, os.pardir, os.pardir,
os.pardir)
THIRD_PARTY_DIR = os.path.join(SRC_DIR, 'third_party')
LOCAL_THIRD_PARTY_DIR = os.path.join(sys.path[0], 'third_party')
TOOLS_DIR = os.path.join(SRC_DIR, 'tools')
SCHEMA_COMPILE... |
import l10n_fr
import report
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
# Program to show the maps of RMSE averaged over time
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error
import os
from netCDF4 import Dataset as NetCDFFile
import numpy as np
from CCLM_OUTS import Plot_CCLM
# option == 1 -> shift 4 with default cclm domain and nboundlines = 3
# option == 2... |
"""App Engine configuration file.
See:
https://developers.google.com/appengine/docs/python/tools/appengineconfig
"""
import os
import logging
import os
import sys
# Log to disk for managed VMs:
# https://cloud.google.com/appengine/docs/managed-vms/custom-runtimes#logging
if os.environ.get('LOG_TO_DISK'):
lo... |
from __future__ import unicode_literals
import frappe
from frappe import _
def execute(filters=None):
columns = get_columns()
proj_details = get_project_details()
pr_item_map = get_purchased_items_cost()
se_item_map = get_issued_items_cost()
dn_item_map = get_delivered_items_cost()
data = []
for project in pr... |
#!/usr/bin/python
"""
Data Models for books.service
All classes can be instantiated from an xml string using their FromString
class method.
Notes:
* Book.title displays the first dc:title because the returned XML
repeats that datum as atom:title.
There is an undocumented gbs:ope... |
"""
13. Adding hooks before/after saving and deleting
To execute arbitrary code around ``save()`` and ``delete()``, just subclass
the methods.
"""
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Per... |
from copy import deepcopy
from django.core.checks.templates import E001
from django.test import SimpleTestCase
from django.test.utils import override_settings
class CheckTemplateSettingsAppDirsTest(SimpleTestCase):
TEMPLATES_APP_DIRS_AND_LOADERS = [
{
'BACKEND': 'django.template.backends.djan... |
"""Documentation Flask Blueprint."""
import os
from flask import render_template, current_app, abort, url_for, Blueprint
from flask.helpers import send_from_directory
from werkzeug.utils import cached_property, import_string
from sphinx.websupport import WebSupport
from sphinx.websupport.errors import DocumentNotFou... |
"""
Concatenates module scripts based on the module.json descriptor.
Optionally, minifies the result using rjsmin.
"""
from cStringIO import StringIO
from os import path
import os
import re
import sys
try:
import simplejson as json
except ImportError:
import json
rjsmin_path = path.abspath(path.join(
... |
# -*- coding: utf-8 -*-
"""
Pelican Mathjax Markdown Extension
==================================
An extension for the Python Markdown module that enables
the Pelican python blog to process mathjax. This extension
gives Pelican the ability to use Mathjax as a "first class
citizen" of the blog
"""
import markdown
from... |
"""
=========================================================
Multi-dimensional image processing (:mod:`scipy.ndimage`)
=========================================================
.. currentmodule:: scipy.ndimage
This package contains various functions for multi-dimensional image
processing.
Filters :mod:`scipy.ndima... |
from __future__ import unicode_literals
from guessit import Guess
from guessit.transfo import SingleNodeGuesser
from guessit.patterns import weak_episode_rexps
import re
import logging
log = logging.getLogger(__name__)
def guess_weak_episodes_rexps(string, node):
if 'episodeNumber' in node.root.info:
ret... |
# -*- coding: utf-8 -*-
"""
Created on Wed May 06 11:00:53 2015
@author: newJustin
"""
import ChronoTrack_pandas as CT
import pylab as py
if __name__ == '__main__':
# logger
import logging as lg
lg.basicConfig(fileName = 'logFile.log', level=lg.WARN, format='%(message)s')
# default fo... |
# -*- coding: utf-8 -*-
'''
FanFilm Add-on
Copyright (C) 2015 lambda
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any ... |
import os
import shutil
import zipfile
import fnmatch
import uuid
def main():
kits = findAll(".")
for kit in kits:
print("* ", kit, " -> ", kits[kit])
print()
print()
print("Starting extraction:")
print("------------------------------------------")
extractKits(kits)
def findAll(dir... |
import abc
import collections
from oslo_log import log as logging
import six
from neutron.api.rpc.callbacks import exceptions as rpc_exc
from neutron.api.rpc.callbacks import resources
from neutron.callbacks import exceptions
LOG = logging.getLogger(__name__)
# TODO(QoS): split the registry/resources_rpc modules in... |
# coding: utf-8
from __future__ import unicode_literals
import os.path
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
remove_start,
sanitized_Request,
urlencode_postdata,
)
class MonikerIE(InfoExtractor):
IE_DESC = 'allmyvideos.net and vidspot.net'
_VALID_U... |
"""
Management utility to create superusers.
"""
from __future__ import unicode_literals
import getpass
import sys
from django.contrib.auth import get_user_model
from django.contrib.auth.management import get_default_username
from django.core import exceptions
from django.core.management.base import BaseCommand, Comm... |
class DiskStatSample:
def __init__(self, time):
self.time = time
self.diskdata = [0, 0, 0]
def add_diskdata(self, new_diskdata):
self.diskdata = [ a + b for a, b in zip(self.diskdata, new_diskdata) ]
class CPUSample:
def __init__(self, time, user, sys, io = 0.0, swap = 0.0):
... |
import netaddr
from neutron.common import utils
from neutron.openstack.common import log as logging
from neutron.plugins.nec.common import config
from neutron.plugins.nec.common import exceptions as nexc
from neutron.plugins.nec.db import api as ndb
from neutron.plugins.nec import drivers
LOG = logging.getLogger(__n... |
import sys
import struct
i = 0
while True:
buf = sys.stdin.read(4)
if len(buf) == 0:
break
elif len(buf) != 4:
sys.stdout.write("\n")
sys.stderr.write("Error: read {0} not 4 bytes\n".format(len(buf)))
sys.exit(1)
if i > 0:
sys.stdout.write(" ")
sys.stdout.write("{0:x}={1}".format(i, struct.unpack("<I"... |
import random
from utils import constrained_sum_sample_pos, arr_str
scenario_description = (
"During the fueling period of the DAO, send enough ether from all "
"accounts to create tokens and then assert that the user's balance is "
"indeed correct and that the minimum fueling goal has been reached"
)
d... |
# -*- coding: utf-8 -*-
# taken from http://code.activestate.com/recipes/252524-length-limited-o1-lru-cache-implementation/
import threading
from func import synchronized
__all__ = ['LRU']
class LRUNode(object):
__slots__ = ['prev', 'next', 'me']
def __init__(self, prev, me):
self.prev = prev
... |
"""Unit Tests for BibAuthority"""
from invenio.testsuite import InvenioTestCase
from invenio.testsuite import make_test_suite, run_test_suite
class TestBibAuthorityEngine(InvenioTestCase):
"""Unit tests for bibauthority_engine"""
def test_split_name_parts(self):
"""bibauthority - test get_type_from_... |
"""Support for Dyson Pure Cool Link Sensors."""
import logging
from libpurecool.dyson_pure_cool import DysonPureCool
from libpurecool.dyson_pure_cool_link import DysonPureCoolLink
from homeassistant.const import PERCENTAGE, STATE_OFF, TEMP_CELSIUS, TIME_HOURS
from homeassistant.helpers.entity import Entity
from . im... |
from gnuradio import gr, gr_unittest, digital
class test_digital(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
def tearDown(self):
self.tb = None
if __name__ == '__main__':
gr_unittest.run(test_digital, "test_digital.xml") |
from django.test import TestCase
from django.test.utils import override_settings
from template_preprocess.processor import process_template_content
from template_preprocess.test import get_test_template_settings
template_settings = get_test_template_settings()
@override_settings(**template_settings)
class TestExten... |
from __future__ import print_function
import argparse
import collections
import json
import logging
import sys
from grocsvs import options as svoptions
from grocsvs import log
from grocsvs import pipeline
from grocsvs import utilities
from grocsvs import stages as svstages
logging.basicConfig(format='%(message)s', ... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
try:
import pyodbc
except ImportError:
pyodbc_found = False
else:
pyodbc_found = True
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 ... |
# -*- coding: utf-8 -*-
"""
markupsafe
~~~~~~~~~~
Implements a Markup string.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import re
import string
from collections import Mapping
from markupsafe._compat import text_type, string_types, int_types, \
u... |
"""
Views for groups info API
"""
from rest_framework import generics, status, mixins
from rest_framework.response import Response
from django.conf import settings
import facebook
from ...utils import mobile_view
from . import serializers
@mobile_view()
class Groups(generics.CreateAPIView, mixins.DestroyModelMixin)... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from time import sleep
from django.core.urlresolvers import reverse
from django.core import mail
from registration.models import RegistrationProfile
from treemap.tests.ui import UITes... |
#!/usr/bin/env python3
import builtins
from pmlr import pmlr
debug_write = pmlr.util.debug_write
ERR_DATA = {
ZeroDivisionError: {"IS_FATAL": False, "TYPE": "DEBUG"},
LookupError: {"IS_FATAL": False, "TYPE": "RANGE"},
IndexError: {"IS_FATAL": False, "TYPE": "RANGE"},
TypeError: ... |
'''The 'grit build' tool along with integration for this tool with the
SCons build system.
'''
import filecmp
import getopt
import os
import shutil
import sys
from grit import grd_reader
from grit import util
from grit.tool import interface
from grit import shortcuts
# It would be cleaner to have each module regist... |
#!/usr/bin/env python
"""blinky.py: A small library that uses wiriping pi access to raspbery pi GPIO
ports,aimed at providing a simple notification interface"""
__author__ = "<EMAIL>"
__license__ = "LGPL"
__version__ = "0.0.1"
__email__ = "Minos Galanakis"
__project__ = "smartpi"
__date__ = "01-06-2015"
import io... |
#!/usr/bin/env python
from __future__ import print_function
from ImageD11.grain import read_grain_file
import sys, os
gf = read_grain_file(sys.argv[1])
mapfile=open(sys.argv[2],"w")
def dodot(xyz,k):
mapfile.write("%f %f %f %d\n"%(xyz[0],xyz[1],xyz[2],k))
def getmedian(s):
items=s.split()
j = -1
fo... |
import base64
from openerp.addons.mail.tests.common import TestMail
from openerp.tools import mute_logger
class test_message_compose(TestMail):
def setUp(self):
super(test_message_compose, self).setUp()
# create a 'pigs' and 'bird' groups that will be used through the various tests
self.... |
from odoo.addons.message_center_compassion.mappings.base_mapping import \
OnrampMapping
class HouseHoldMapping(OnrampMapping):
ODOO_MODEL = 'compassion.household'
CONNECT_MAPPING = {
"BeneficiaryHouseholdMemberList": ('member_ids',
'compassion.household.... |
import numpy
from nupic.data.fieldmeta import FieldMetaType
from nupic.data import SENTINEL_VALUE_FOR_MISSING_DATA
from nupic.encoders.base import Encoder, EncoderResult
from nupic.encoders.scalar import ScalarEncoder
UNKNOWN = "<UNKNOWN>"
class CategoryEncoder(Encoder):
"""Encodes a list of discrete categorie... |
from __future__ import unicode_literals
import copy
import datetime
from django.contrib.auth.models import User
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class RevisionableModel(models.Model):
base = models.ForeignKey('self', null=Tru... |
"""
.. dialect:: mysql+pyodbc
:name: PyODBC
:dbapi: pyodbc
:connectstring: mysql+pyodbc://<username>:<password>@<dsnname>
:url: http://pypi.python.org/pypi/pyodbc/
Limitations
-----------
The mysql-pyodbc dialect is subject to unresolved character encoding issues
which exist within the current ODBC... |
# -*- coding: utf-8 -*-
import babel.dates
import re
import werkzeug
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from odoo import fields, http, _
from odoo.addons.website.models.website import slug
from odoo.http import request
class WebsiteEventController(http.Controll... |
"""Cell structure used by NAS."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from deeplab.core.utils import resize_bilinear
from deeplab.core.utils import scale_dimension
arg_scope = tf.contrib.framework.arg_scope
slim = tf.con... |
import pickle
import tempfile
import shutil
import os
import numbers
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_raises_regexp
from sklearn.utils.t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.