code stringlengths 1 199k |
|---|
"""Google Analytics Admin API sample application which provisions the Google
Analytics account creation ticket and prints the Terms of Service link that
can be used by an end user to complete the account creation flow.
This sample invokes the provision_account_ticket() method of the Google
Analytics Admin API to start ... |
import kfp
import kfp.dsl as dsl
from kfp import components
from kubeflow.katib import ApiClient
from kubeflow.katib import V1beta1ExperimentSpec
from kubeflow.katib import V1beta1AlgorithmSpec
from kubeflow.katib import V1beta1AlgorithmSetting
from kubeflow.katib import V1beta1ObjectiveSpec
from kubeflow.katib import ... |
from CondorCE import CondorCE
from autopyfactory import jsd
class CondorGRAM(CondorCE):
def __init__(self, apfqueue, config, section):
qcl = config
newqcl = qcl.clone().filterkeys('batchsubmit.condorgram', 'batchsubmit.condorce')
super(CondorGRAM, self).__init__(apfqueue, newqcl, section)
... |
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 field 'Response.source1'
db.add_column('responses', 'source1',
self.gf('django.db.models.fields.related.... |
"""
.. module:: pidigits._tests.test_pidigits
:synopsis: Unittest for pidigits.
.. moduleauthor:: Sameer Marathe
"""
from unittest import TestCase
from pidigits import piGenerator
from pidigits import piGenLeibniz
from pidigits import piGenGosper
from timeit import default_timer
class TestPiDigits(TestCase):
@c... |
import pulleffect.lib.google.gcal_helper as gc_helper
import moment
from flask import Blueprint
from flask import jsonify
from flask import redirect
from flask import request
from flask import session
from flask import url_for
from pulleffect.lib.utilities import require_signin
from pulleffect.lib.utilities import Widg... |
from setuptools import setup
setup(
name='allthingstalk',
version='0.2.5',
description='AllThingsTalk Python SDK',
url='https://github.com/allthingstalk/python-sdk',
download_url='https://github.com/allthingstalk/python-sdk/archive/0.2.5.tar.gz',
author='Danilo Vidovic',
author_email='dv@all... |
from __future__ import print_function
import zss
import re
import json
import argparse
import editdistance
def editdist(clargs):
with open(clargs.input_file[0]) as f:
js = json.load(f)
with open(clargs.corpus) as f:
corpus = json.load(f)
for i, program in enumerate(js['programs']):
p... |
import logging
import math
class Inference:
def __init__(self):
pass
def add_weight(self, weight, coefficients, variables, constant, two_sided=False, squared=False):
current_weight = self.get_weight(coefficients, variables, constant, two_sided, squared)
self.set_weight(current_weight + w... |
import types
import unittest
from iptest import run_test
x = 123456 # global to possibly mislead the closures
class ClosureTest(unittest.TestCase):
def test_simple_cases(self):
def f():
x = 1
def g():
return x
return g
self.assertEqual(f()(), ... |
"""Module containing the boiler plate required to construct GCI views.
"""
from soc.views.base import RequestHandler
from soc.modules.gci.views import base_templates
from soc.modules.gci.views.helper import access_checker
from soc.modules.gci.views.helper.request_data import RequestData
from soc.modules.gci.views.helpe... |
"""
====================================================================
K-means clustering and vector quantization (:mod:`scipy.cluster.vq`)
====================================================================
Provides routines for k-means clustering, generating code books
from k-means models, and quantizing vectors b... |
"""
Manages information about the host OS and hypervisor.
This class encapsulates a connection to the libvirt
daemon and provides certain higher level APIs around
the raw libvirt API. These APIs are then used by all
the other libvirt related classes
"""
import operator
import os
import socket
import sys
import threadin... |
from edmunds.globals import has_request_context
from werkzeug.datastructures import MultiDict
class Input(MultiDict):
"""
The request input
"""
def __init__(self, request):
"""
Constructor
:param request: Flask request
"""
if has_request_context():
dat... |
"""Library of spectral processing functions.
Includes transforming linear to mel frequency scales and phase to instantaneous
frequency.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow.compat.v1 as tf
_MEL_BREAK_FREQUEN... |
"""Auto-generated file, do not edit by hand. GH metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_GH = PhoneMetadata(id='GH', country_code=233, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='(?:[235]\\d{3}|800)\\d{5}', possible_leng... |
"""
* Copyright 2007,2008,2009 John C. Gunther
* Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
*
* 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/lic... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from configurable import Configurable
class BaseOptimizer(Configurable):
""""""
#=============================================================
def __init__(self, *args, **kwargs):
... |
from flask import Flask
from redis import Redis
import os
import socket
app = Flask(__name__)
redis = Redis(host=os.environ.get('REDIS_HOST', '127.0.0.1'), port=6379)
@app.route('/')
def hello():
redis.incr('hits')
return 'Hello Container World! I have been seen %s times and my hostname is %s.\n' % (redis.get('... |
"""Interfaces for Kaldi's readers and writers
This subpackage contains a factory function, :func:`open`, which is intended to behave
similarly to python's built-in :func:`open` factory. :func:`open` gives the specifics
behind Kaldi's different read/write styles. Here, they are described in a general way.
Kaldi's stream... |
"""Functions to discover OpenID endpoints from identifiers.
"""
__all__ = [
'DiscoveryFailure',
'OPENID_1_0_NS',
'OPENID_1_0_TYPE',
'OPENID_1_1_TYPE',
'OPENID_2_0_TYPE',
'OPENID_IDP_2_0_TYPE',
'OpenIDServiceEndpoint',
'discover',
]
import urlparse
from openid import oidutil, fetchers... |
from modular.image_preparation import *
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets,transforms
from torch.autograd import Variable, Function
from torch.utils.data import TensorDataset, DataLoader
batch_size = 128
num_classes = 2
epochs ... |
from typing import Any, Dict, Mapping, Union
from unittest import mock
from django.utils.timezone import now as timezone_now
from zerver.lib.push_notifications import get_apns_badge_count, get_apns_badge_count_future
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import mock_queue_publis... |
import itertools
from math import isnan
import numpy as np
from cgpm.cgpm import CGpm
from cgpm.mixtures.dim import Dim
from cgpm.network.importance import ImportanceNetwork
from cgpm.utils import config as cu
from cgpm.utils import general as gu
from cgpm.utils.config import cctype_class
from cgpm.utils.general import... |
from caldavclientlibrary.protocol.caldav.definitions import caldavxml
from caldavclientlibrary.protocol.caldav.multiget import Multiget
from caldavclientlibrary.protocol.http.data.string import ResponseDataString
from caldavclientlibrary.protocol.webdav.definitions import davxml, statuscodes
from contrib.performance.sq... |
class SingletonType(type):
def __call__(cls, *args, **kwargs):
try:
return cls.__instance
except AttributeError:
cls.__instance = super(SingletonType, cls).__call__(*args, **kwargs)
return cls.__instance |
"""Support for FluxLED/MagicHome lights."""
from __future__ import annotations
from abc import abstractmethod
from typing import Any, cast
from flux_led.aiodevice import AIOWifiLedBulb
from homeassistant.const import (
ATTR_MANUFACTURER,
ATTR_MODEL,
ATTR_NAME,
ATTR_SW_VERSION,
)
from homeassistant.core ... |
import os
from setuptools import setup, find_packages
setup(
name='project_generator',
version='0.3',
description='Project generators for various embedded tools (IDE). IAR, uVision, Makefile and many more in the roadmap!',
author='Martin Kojtal, Matthew Else',
author_email='c0170@rocketmail.com, mat... |
"""Callbacks the runtime invokes when requests end."""
import os
REQUEST_ID_KEY = 'HTTP_X_CLOUD_TRACE_CONTEXT'
_callback_storage = {}
def SetRequestEndCallback(callback):
"""Stores a callback by the request ID.
The request ID currently uses the cloud trace ID.
Args:
callback: A zero-argument callable whose re... |
"""Commands to import or export the current command stack to or from a file."""
import click
import unsync
from unsync.core import NestedUnsyncCommands
import pickle
@unsync.command()
@click.option('--output-file', '-o', type=click.Path(dir_okay=False, readable=True, resolve_path=True), help='File that the command stac... |
from flask.ext.script import Manager, Shell, Server
from shortner import app
manager = Manager(app)
manager.add_command("runserver", Server())
manager.add_command("shell", Shell())
manager.run() |
from webiopi.utils.types import toint
from webiopi.devices.i2c import I2C
from webiopi.devices.clock import Clock
from webiopi.devices.memory import Memory
from webiopi.decorators.rest import request, response, api
from datetime import datetime, date, time
class MCP7940(I2C, Clock, Memory):
# Common I2C registers f... |
import tempfile
import fixtures
import mock
from oslo_concurrency import processutils
from nova import test
from nova import utils
from nova.virt.disk import api
from nova.virt.disk.mount import api as mount
from nova.virt.image import model as imgmodel
class FakeMount(object):
device = None
@staticmethod
d... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "XYBlog.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is reall... |
"""
Support to interface with Sonos players.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.sonos/
"""
import datetime
import functools as ft
import logging
import socket
import threading
import urllib
import requests
import voluptuous as vol... |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='GradingStandard',
fields=[
('id', models.AutoField(auto_created=... |
import numpy as np
def sample_images_from_each_class(X, Y, n_classes=None, n=5):
""" Given a batch of images (stored as a numpy array), and an array of
labels, It creates a grid of images such that:
- Each row contains images for each class.
- Each column contains the first `n` image... |
"""
Base classes for models
"""
from elasticsearch_dsl import Date, Document, Keyword
class Model(Document):
"""
Base for all models. Any model instance has a primary key and created/updated timestamps,
as well as a field indicating the doctype.
See README#polymorphic-models for more details
"""
... |
import bluetooth
import select
import time
import threading
from moteCache import MoteCache
class SimpleDiscoverer(bluetooth.DeviceDiscoverer):
def __init__(self):
bluetooth.DeviceDiscoverer.__init__(self)
def pre_inquiry(self):
self.done = False
def device_discovered(self, address, device_c... |
from django.core.urlresolvers import reverse
import mock
import unittest
from manila_ui.api import manila as api_manila
from manila_ui.dashboards.project.shares import test_data
from manila_ui.test import helpers as test
from openstack_dashboard import api
from openstack_dashboard.usage import quotas
SHARE_INDEX_URL = ... |
'''
Copyright 2016, EMC, Inc.
Author(s):
George Paulos
'''
import os
import sys
import subprocess
sys.path.append(subprocess.check_output("git rev-parse --show-toplevel", shell=True).rstrip("\n") + "/test/fit_tests/common")
import fit_common
from nose.plugins.attrib import attr
@attr(all=True, regression=True, smoke=Tr... |
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
import kubevirt
from kub... |
"""
Updates the version infos
"""
from __future__ import print_function
import time
import re
import cgi
VERSION = open("VERSION.txt", "r").read().strip()
BUILD = time.strftime("%Y-%m-%d")
FILES = [
"setup.py",
"setup_exe.py",
# "setup_egg.py",
"sx/pisa3/pisa_version.py",
"doc/pisa-en.html",
]
try:
... |
import urllib2
url = 'http://blog.csdn.net/yangzhenping'
url_headers = {
"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36",
"GET":url,
"Host":"blog.csdn.net",
"Referer":"http://blog.csdn.net/experts.html"
}
req = urllib2.Request(url,headers=u... |
import zoo.pipeline.api.keras.layers as zlayers
from zoo.pipeline.api.onnx.mapper.operator_mapper import OperatorMapper
from zoo.pipeline.api.onnx.onnx_loader import OnnxLoader
class DropoutMapper(OperatorMapper):
def __init__(self, node, _params, _all_tensors):
super(DropoutMapper, self).__init__(node, _pa... |
import collections
from rx import AnonymousObservable, Observable
from rx.disposables import CompositeDisposable
from rx.internal import default_comparer
from rx.internal import extensionmethod
@extensionmethod(Observable)
def sequence_equal(self, second, comparer=None):
"""Determines whether two sequences are equa... |
import pyaudio
import cv2
import numpy
import math
import time
def readFile(path):
with open(path, "rt") as f:
return f.read()
def findChordFile(chord):
chords = readFile("chordList").splitlines()
for i in chords:
if(i.startswith(chord)):
return "chord" + i.split()[-1] + ".wav"
def findDownLocale(boa... |
from south.utils import datetime_utils as 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 'Token'
db.create_table('dd_invitation_token', (
('id', self.gf('django.d... |
import requests, os, bs4, threading
os.makedirs('xkcd', exist_ok=True) # store comics in ./xkcd
def downloadXkcd(startComic, endComic):
for urlNumber in range(startComic, endComic)
# Download the page.
print('Downloading page http://xkcd.com/%s...' % (urlNumber))
res = requests.get('http://xkcd.com/%s' % (urlNumber... |
import sys, os
sys.path.append(os.path.abspath('exts'))
highlight_language = 'scala'
extensions = ['sphinx.ext.extlinks', 'includecode', 'apilinks']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'Slick'
copyright = u'2011-2012 Typesafe, Inc.'
version = '0.11.2'
release = '0.11.2... |
from __future__ import absolute_import
from decimal import Decimal
import pytest
from mock import patch
from django.db import models
from easymoney import MoneyField
from .models import Product, Game, GameMoney
pytestmark = pytest.mark.django_db
def test_save():
p = Product()
p.price = 3.14
p.save()
def tes... |
import sqlite3
import nfc
import sys
def get_tag():
context = nfc.init()
pnd = nfc.open(context)
if pnd is None:
print('ERROR: Unable to open NFC device.')
exit()
if nfc.initiator_init(pnd) < 0:
nfc.perror(pnd, "nfc_initiator_init")
print('ERROR: Unable to init NFC device... |
from app.views import *
from django.conf.urls import url
urlpatterns = [
url(r'^$', HomeView.as_view())
] |
'''
implements an image view to show a colored image of a hdf5 dataset.
'''
if __name__ == '__main__':
#Used to guarantee to use at least Wx2.8
import wxversion
wxversion.ensureMinimal('2.8')
import wx
import os,h5py
import numpy as np
import utilities as ut
from GLCanvasImg import *
class HdfImageGLFrame(wx.Fr... |
import sys
import maya.OpenMaya as OpenMaya
import maya.OpenMayaMPx as OpenMayaMPx
kPluginNodeTypeName = "spClosestPointOnCurve"
cpocPluginId = OpenMaya.MTypeId(0x00349)
class closestPointOnCurve(OpenMayaMPx.MPxNode):
# the plugs
aInCurve = OpenMaya.MObject()
aInPosition = OpenMaya.MObject()
aOutPositio... |
import os
import glob
import json
from collections import OrderedDict
jar_files = ':'.join(glob.glob("external/gwt/*.jar"))
BIN_DIR = 'war/WEB-INF/classes/:%s' % jar_files
SUMMARY_TXT = 'clients_summary.txt'
JSON_FILE = '../server/src/weblab/clients.json'
os.system("java -classpath %s es.deusto.weblab.server.ClientSumm... |
import os
import sys
import shlex
import shutil
import socket
from collections import deque
from lib.admin_connection import AdminConnection
class Namespace(object):
pass
class LuaPreprocessorException(Exception):
def __init__(self, val):
super(LuaPreprocessorException, self).__init__()
self.val... |
from myhdl import Signal, Simulation, delay, always_comb, instances
from random import randrange
from MyHDLSim.combinational import Mux41
out, c1, c0, d0, d1, d2 = [Signal(0) for i in range(6)]
one = Signal(1)
mux = Mux41(out, c0, c1, d0, d1, d2, one)
def test():
print "c0 c1 d0 d1 d2 d3 out"
for data_0 in rang... |
import os
class DirectoryChanger:
def __init__(self, dir):
self.dir = dir
self.old_dir = os.getcwd()
def print_dir(self):
for item in os.listdir(os.getcwd()):
print(item)
def __enter__(self):
os.chdir(self.dir)
print("current dir (enter):", os.getcwd())
... |
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from datetime import datetime
import commands
import os
from paloma.management.commands import GenericCommand
from paloma.models import Schedule
from paloma.tasks import enqueue_schedule
class Command(GenericCommand):
... |
"""
Created on Jan 11, 2013
@author: Mourad Mourafiq
About: This is an attempt to solve the Quora challenge Feed Optimizer.
"""
import itertools
import copy
import math
from random import choice, random
BRUTE_FORCE = 1
ANNEALING_SIMULATED = 2
class Story(object):
"""
Story object
@type _cpt: int
@param ... |
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename('image29.xlsx')
def test_create_file(self):
... |
'''
Created on Mar 23, 2012
@author: garcia
'''
import numpy as np
import matplotlib.pyplot as plt
class NoEquilibriumSelected(Exception):
"""
An exception to be thrown when a given function cannot select a unique equilibrium.
"""
def __innit__(self, errno, msg):
self.args = (errno, msg)... |
import time
from functools import wraps
def timethis(func):
'''
Decorator that reports the execution time.
'''
@wraps(func)
def wrapper(*args, **kwargs):
start = time.time()
result = func(*args, **kwargs)
end = time.time()
print(func.__name__, end-start)
retur... |
import pika
connection = pika.BlockingConnection(
pika.URLParameters('amqp://test:test@localhost:5672/testvhost')
)
channel = connection.channel()
channel.queue_declare(queue='hello')
channel.basic_publish(exchange='', routing_key='hello', body='Hello World!')
print(" [x] Sent 'Hello World!'")
connection.close() |
import pickle
from datetime import timedelta
from uuid import uuid4
from memcache import Client
from werkzeug.datastructures import CallbackDict
from flask.sessions import SessionInterface, SessionMixin
class McSession(CallbackDict, SessionMixin):
def __init__(self, initial=None, sid=None, new=False):
def o... |
"""
PySparse: A Fast Sparse Matrix Library for Python
Pysparse is a fast sparse matrix library for Python. It provides several sparse
matrix storage formats and conversion methods. It also implements a number of
iterative solvers, preconditioners, and interfaces to efficient factorization
packages. Both low-level and h... |
from copy import copy
def _convert(x, context):
if isinstance(x, basestring) and x.startswith('%'):
return context[x[1:]]
elif hasattr(x, '_convert'):
return x._convert(context)
else:
return x
def fn(func, *args, **kwargs):
def _fn_for_context(context):
_args = [_convert(... |
"""
Created on Sat May 04 14:20:51 2013
@author: VHOEYS
"""
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
from scipy.stats import norm
from matplotlib import cm, colors
import matplotlib.axes as maxes
from matplotlib.ticker import MaxNLocator
from mpl_toolkits.axes_grid import m... |
import logging
import networkx
from . import Analysis, register_analysis
l = logging.getLogger("angr.analyses.loopfinder")
class Loop(object):
def __init__(self, entry, entry_edges, break_edges, continue_edges, body_nodes, graph, subloops):
self.entry = entry
self.entry_edges = entry_edges
s... |
'''
'''
from ambry.bundle import BuildBundle
class Bundle(BuildBundle):
''' '''
records_per_segment = 5000
def __init__(self,directory=None):
super(Bundle, self).__init__(directory)
def build(self):
import uuid
import random
lr = self.init_log_rate(N=2000)
for se... |
from indra.sparser.sparser_api import process_xml |
"""SCons.Tool.msvs
Tool-specific initialization for Microsoft Visual Studio project files.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
__revision__ = "src/engine/SCons/Tool/msvs.py 5023 2010/06/14 22:05:46 s... |
import optparse;
from xml.etree.ElementTree import ElementTree
parser = optparse.OptionParser(description='Update BOXM2 Scene without refinement 0');
parser.add_option('--boxm2_dir', action="store", dest="boxm2_dir");
parser.add_option('--min_i', action="store", dest="min_i", type="int");
parser.add_option('--min_j', a... |
from common import Logic
class FuzzyLogic(Logic):
'''
Implementation of fuzzy logic for MLNs.
'''
@staticmethod
def min_undef(*args):
'''
Custom minimum function return None if one of its arguments
is None and min(*args) otherwise.
'''
if len(filter(lambda x: ... |
import unittest
from pyvap import Store, UnsolvableError
from pyvap.constraints import Count
import pyvap.types
class TestBasics(unittest.TestCase):
def setUp(self):
self.store = Store()
self.a = self.store.IntVar('a')
self.b = self.store.IntVar('b')
self.c = self.store.IntVar('c')
self.d = self.store.IntVar... |
"""
Created on Wed Feb 1 11:30:49 2012
@author: eba
"""
from numpy import *
from scipy import *
from matplotlib.pyplot import *
from MHFPython import *
from plotGaussians import *
def rotate(x,y,rot):
return [x*rot[0,0]+y*rot[0,1],x*rot[1,0]+y*rot[1,1]]
theta = arange(-pi,pi,0.01)
r = 1;
limit = 3.;
[x,y] = [r*cos... |
import sys
from seisflows.tools import msg
from seisflows.tools import unix
from seisflows.config import ParameterError, custom_import
from seisflows.workflow.base import base
PAR = sys.modules['seisflows_parameters']
PATH = sys.modules['seisflows_paths']
optimize = sys.modules['seisflows_optimize']
class thrifty_inver... |
''' setup.py - Distutils setup file for PyBERT package
David Banas
October 22, 2014
'''
from setuptools import setup
setup(
name='PyBERT',
version='1.2.2',
packages=['pybert',],
license='BSD',
description='Serial communication link bit error rate tester simulator, written in Python.',
lo... |
"""Tests for LUBackup*"""
from ganeti import constants
from ganeti import objects
from ganeti import opcodes
from ganeti import query
from testsupport import *
import testutils
class TestLUBackupQuery(CmdlibTestCase):
def setUp(self):
super(TestLUBackupQuery, self).setUp()
self.fields = query._BuildExportFiel... |
"""
Dynamically generate the NRT module
"""
from numba.core.config import MACHINE_BITS
from numba.core import types, cgutils
from llvmlite import ir, binding
_debug_print = False
_word_type = ir.IntType(MACHINE_BITS)
_pointer_type = ir.PointerType(ir.IntType(8))
_meminfo_struct_type = ir.LiteralStructType([
_word_t... |
from ...utils.deprecation import _deprecate
from . import channels
Fillopacity = _deprecate(channels.FillOpacity, "Fillopacity")
FillopacityValue = _deprecate(channels.FillOpacityValue, "FillopacityValue")
Strokeopacity = _deprecate(channels.StrokeOpacity, "Strokeopacity")
StrokeopacityValue = _deprecate(channels.Strok... |
from threading import local
from urllib.parse import urlsplit, urlunsplit
from django.utils.encoding import force_text, iri_to_uri
from django.utils.functional import lazy
from django.utils.translation import override
from .exceptions import NoReverseMatch, Resolver404
from .resolvers import get_ns_resolver, get_resolv... |
import datetime
from django.conf import settings
from django.contrib.sites.models import Site
from django.core import mail
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.utils import override_settings
from registration import signals
from registration.admin import Registr... |
from __future__ import unicode_literals
import bleach
import markdown
from django.conf import settings
def parse(text):
"""Convert markdown text to sanitized HTML."""
text = markdown.markdown(text, extensions=["extra"], safe_mode=False)
text = bleach.clean(text, tags=settings.BLEACH_ALLOWED_TAGS)
return... |
"""--------------------------------------------------------------------
COPYRIGHT 2014 Stanley Innovation Inc.
Software License Agreement:
The software supplied herewith by Stanley Innovation Inc. (the "Company")
for its licensed Vector Robotic Platforms is intended and supplied to you,
the Company's customer, for use ... |
app_label = 'django_couchdb_utils_sessions' |
import pytest
from clair_singularity.clair import check_clair, post_layer, get_report
API_URL = 'http://clair:6060/v1/'
@pytest.mark.needs_clair
def test_check_clair():
# We can talk to the API
assert check_clair(API_URL,False) |
import unittest
import struct
import socket
from hetzner.util.addr import (parse_ipv4, parse_ipv6, parse_ipaddr,
get_ipv4_range, get_ipv6_range,
ipv4_bin2addr, ipv6_bin2addr)
class UtilAddrTestCase(unittest.TestCase):
def test_parse_ipv4(self):
s... |
"""A Pandora Client Written in Python EFLs/Elm
Uses Emotion as a streaming backend
By: Jeff Hoogland (JeffHoogland@Linux.com)
Started: 12/20/12
"""
import os
import elementary
import evas
import time
import pandora
import urllib
import sys
from loginWindow import *
from playerWindow import *
from settingsWindow import ... |
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.unittest import tab_test_case
class InspectorRuntimeTest(tab_test_case.TabTestCase):
def testRuntimeEvaluateSimple(self):
res = self._tab.EvaluateJavaScript('1+1')
assert res == 2
def testRuntimeEvaluateThatFails(self):
... |
from configparser import RawConfigParser
class AttrConfig(RawConfigParser):
def __init__(self, path):
RawConfigParser.__init__(self)
self.read(path)
# Add sections based on the names
for sname in self.sections():
if ((sname not in self.__dict__)
and sname.replace('_', '').isalnum()
and not sname.r... |
from django.db.models import Manager
from django.db.models.query import QuerySet
class SnippetManager(Manager):
def match_client(self, client):
from snippets.base.models import CHANNELS, STARTPAGE_VERSIONS
# Retrieve the first item that starts with an available item. Allows
# things like "re... |
from django.core.urlresolvers import resolve
def get_breadcrumbs(url):
"""Given a url returns a list of breadcrumbs, which are each a tuple of (name, url)."""
from djangorestframework.views import View
def breadcrumbs_recursive(url, breadcrumbs_list):
"""Add tuples of (name, url) to the breadcrumbs ... |
"""
@copyright Copyright (c) 2014 Submit Consulting
@author Angel Sullon (@asullom)
@package sad
Descripcion: Implementacion de los controladores de la app sad
"""
from django.shortcuts import render_to_response, get_object_or_404, redirect
from django.template.context import RequestContext
import json
from ... |
from __future__ import absolute_import
from .fiberassign_test_suite import runtests |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [("course_catalog", "0030_related_name_instructors_bootcamp")]
operations = [
migrations.CreateModel(
name="CourseRun",
fields=[
(
... |
import logging
import os
import os.path as osp
import platform
from subprocess import (
CalledProcessError,
check_call,
check_output,
)
import sys
import thread # To manage the windows process asynchronously
from guidata.configtools import (
add_image_path,
get_family,
get_icon,
MONOSPACE,
... |
"""
Make sure TargetMachine setting is extracted properly.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
CHDIR = 'linker-flags'
test.run_gyp('target-machine.gyp', chdir=CHDIR)
# The .cc file is compiled as x86 (the default), so the link/libs that are... |
import json
import pytest
from saleor.seo.schema.email import (
get_order_confirmation_markup, get_organization, get_product_data)
def test_get_organization(site_settings):
example_name = 'Saleor Brand Name'
site = site_settings.site
site.name = example_name
site.save()
result = get_organization... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.