content stringlengths 4 20k |
|---|
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... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 19