content
stringlengths
4
20k
def main(request, response): _URL = request.url _CSP = "default-src http://www.tizen.com " + \ _URL[:_URL.index('/csp') + 1] + "; style-src 'unsafe-inline'" _CSSURL = _URL[:_URL.index('/csp') + 1] + "csp/support/w3c/CanvasTest.ttf" print _CSSURL response.headers.set("Content-Security-Policy...
''' This module is for enhancing ansible's inventory parsing capability such that it can deal with hostnames specified using a simple pattern in the form of [beg:end], example: [1:5], [a:c], [D:G]. If beg is not specified, it defaults to 0. If beg is given and is left-zero-padded, e.g. '001', it is taken as a formatti...
"""A helper module for parsing JSON objects from perf tests results.""" import json def GetAverageRunInfo(json_data, name): """Summarizes TraceEvent JSON data for performance metrics. Example JSON Inputs (More tags can be added but these are required): Measuring Duration: [ { "cat": "Java", "ts": ...
from __future__ import unicode_literals import json from jinja2 import Template from moto.core.responses import BaseResponse from .models import cloudformation_backend class CloudFormationResponse(BaseResponse): def create_stack(self): stack_name = self._get_param('StackName') stack_body = self...
""" Parse the NCBI file and check for duplicates. We ignore sample name, title, bioproject accession and description """ import os import sys import argparse from roblib import bcolors __author__ = 'Rob Edwards' def parse_file(fi, verbose): """ Parse a file :param: fi: File to parse :param: verbose: ...
import unittest import datetime from activity_feed import ActivityFeed from activity_feed.utils import datetime_to_timestamp, utcnow def timestamp(*args): return datetime_to_timestamp(datetime.datetime(*args)) def timestamp_utcnow(): return datetime_to_timestamp(utcnow()) class BaseTest(unittest.TestCase):...
"""Global registry for OpDefs.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.core.framework import op_def_pb2 _registered_ops = {} def register_op_list(op_list): """Register all the ops in an op_def_pb2.OpList.""" if not isinsta...
from __future__ import absolute_import import time import logging from collections import namedtuple from itertools import takewhile import email import re from ..exceptions import ( ConnectTimeoutError, MaxRetryError, ProtocolError, ReadTimeoutError, ResponseError, InvalidHeader, ) from ..pack...
"""Test of RPCs made against gRPC Python's application-layer API.""" import unittest import logging import grpc from tests.unit.framework.common import test_constants _SERIALIZE_REQUEST = lambda bytestring: bytestring * 2 _DESERIALIZE_REQUEST = lambda bytestring: bytestring[len(bytestring) // 2:] _SERIALIZE_RESPONS...
"""Fixer for dict methods. d.keys() -> list(d.keys()) d.items() -> list(d.items()) d.values() -> list(d.values()) d.iterkeys() -> iter(d.keys()) d.iteritems() -> iter(d.items()) d.itervalues() -> iter(d.values()) d.viewkeys() -> d.keys() d.viewitems() -> d.items() d.viewvalues() -> d.values() Except in certain very...
# line 1 def wrap(foo=None): def wrapper(func): return func return wrapper # line 7 def replace(func): def insteadfunc(): print('hello') return insteadfunc # line 13 @wrap() @wrap(wrap) def wrapped(): pass # line 19 @replace def gone(): pass # line 24 oll = lambda m: m # lin...
# -*- coding: utf-8 -*- """OSF mailing utilities. Email templates go in website/templates/emails Templates must end in ``.txt.mako`` for plaintext emails or``.html.mako`` for html emails. You can then create a `Mail` object given the basename of the template and the email subject. :: CONFIRM_EMAIL = Mail(tpl_pre...
from mod_pywebsocket import handshake def web_socket_do_extra_handshake(request): raise handshake.AbortedByUserException("abort for test") def web_socket_transfer_data(request): raise handshake.AbortedByUserException("abort for test") # vi:sts=4 sw=4 et
import itk from sys import argv dim = 2 IType = itk.Image[itk.UC, dim] reader = itk.ImageFileReader[IType].New(FileName=argv[1]) filter = itk.MeanImageFilter[IType, IType].New(reader, Radius=eval(argv[3])) watcher = itk.SimpleFilterWatcher(filter, "filter") writer = itk.ImageFileWriter[IType].New(filter, FileName=a...
from website.settings import DOMAIN as OSF_DOMAIN from website.settings import OSF_SUPPORT_EMAIL from osf.models import OSFUser from furl import furl def serialize_comment(comment): reports = [ serialize_report(user, report) for user, report in comment.reports.iteritems() ] author_abs_url ...
''' Video Gstplayer =============== .. versionadded:: 1.8.0 Implementation of a VideoBase with Kivy :class:`~kivy.lib.gstplayer.GstPlayer` This player is the prefered player, using Gstreamer 1.0, working on both Python 2 and 3. ''' from kivy.lib.gstplayer import GstPlayer, get_gst_version from kivy.graphics.texture ...
from ..excel_comparsion_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.maxDiff = None filename = 'chart_scatter07.xlsx' ...
# -*- coding: utf-8 -*- """ Various utility functions used throughout abed """ from __future__ import print_function import errno import os from .conf import settings basename = os.path.basename splitext = os.path.splitext def wrap_text(text, max_length=120): """ Wraps the words into lines of a fixed le...
#!/usr/bin/env python import sys, math, string, optparse, fileinput, struct, array def main(): usage = "%prog [options] <datafile> <mssfile>" version = "%prog 0.2\n Longbin Chen, <EMAIL>" oparser = optparse.OptionParser(usage=usage, version=version) oparser.add_option('-t', '--template', dest...
""" A theano / pylearn2 wrapper for cuda-convnet's convFilterActs function. """ __authors__ = "David Warde-Farley and Ian Goodfellow" __copyright__ = "Copyright 2010-2013, Universite de Montreal" __credits__ = ["David Warde-Farley and Ian Goodfellow"] __license__ = "3-clause BSD" __maintainer__ = "LISA Lab" __email__ =...
"""Abstracted UI interface that will be overriden by different UI types""" from gi.repository import GLib from umake.tools import Singleton, MainLoop class UI(object, metaclass=Singleton): currentUI = None def __init__(self, current_UI): UI.currentUI = current_UI @classmethod def return_ma...
import datetime from nose.tools import eq_ from kitsune.kbforums.models import Thread from kitsune.kbforums.tests import KBForumTestCase, thread, post as post_ from kitsune.sumo.urlresolvers import reverse from kitsune.sumo.helpers import urlparams from kitsune.users.tests import user from kitsune.wiki.tests import d...
""" (c) 2013 LinkedIn Corp. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");?you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing...
import os from types import * ##If you want include files that doesn't have extension then use filter like '*.' def _make_list( argument ): if type(argument) in StringTypes: if argument: return [argument] else: return [] elif type(argument) is ListType: return a...
"""Tests for the AdbWrapper class.""" import os import tempfile import time import unittest from pylib.device import adb_wrapper from pylib.device import device_errors class TestAdbWrapper(unittest.TestCase): def setUp(self): devices = adb_wrapper.AdbWrapper.GetDevices() assert devices, 'A device must be...
import os import sys import mxnet as mx import logging import sd_module def get_conv( name, data, num_filter, kernel, stride, pad, with_relu, bn_momentum ): conv = mx.symbol.Convolution( name=name, data=data, num_filter=num_filter, kernel=kernel, ...
""" This file contains all the classes used by has_access for error handling """ from django.utils.translation import ugettext as _ from xmodule.course_metadata_utils import DEFAULT_START_DATE class AccessResponse(object): """Class that represents a response from a has_access permission check.""" def __init_...
"""distutils.command.upload Implements the Distutils 'upload' subcommand (upload package to PyPI).""" from distutils import errors from distutils import log from distutils.core import Command from distutils.spawn import spawn try: from hashlib import md5 except ImportError: from md5 import md5 import os impor...
"""A stream for a raw/dd file that has been split into multiple pieces.""" # local imports from lf.dec.consts import SEEK_SET from lf.dec.base import SingleStreamContainer from lf.dec.composite import CompositeIStream from lf.dec.raw import RawIStream __docformat__ = "restructuredtext en" __all__ = [ "SplitRaw", ...
""" A FTP server banning clients in case of commands flood. If client sends more than 300 requests per-second it will be disconnected and won't be able to re-connect for 1 hour. """ from pyftpdlib.ftpserver import FTPHandler, FTPServer, DummyAuthorizer, CallEvery class AntiFloodHandler(FTPHandler): cmds_per_se...
from invenio.legacy.dbquery import run_sql depends_on = ['invenio_release_1_1_0'] def info(): return "New bibedit cache (bibEDITCACHE) table" def do_upgrade(): """ Implement your upgrades here """ run_sql("""CREATE TABLE IF NOT EXISTS `bibEDITCACHE` ( `id_bibrec` mediumint(8) unsigned NOT NULL, `uid...
from openerp import fields, models class HrContractType(models.Model): _inherit = 'hr.contract.type' trial_length = fields.Integer( help="Default contract trial length in Days" )
"""Th tests for the Rfxtrx component.""" # pylint: disable=too-many-public-methods,protected-access import unittest import time from homeassistant.bootstrap import _setup_component from homeassistant.components import rfxtrx as rfxtrx from tests.common import get_test_home_assistant class TestRFXTRX(unittest.TestCas...
""" Unit tests for email feature flag in student dashboard. Additionally tests that bulk email is always disabled for non-Mongo backed courses, regardless of email feature flag, and that the view is conditionally available when Course Auth is turned on. """ import unittest from django.conf import settings from django....
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import pytest from mock import ANY from ansible.module_utils.network.fortios.fortios import FortiOSHandler try: from ansible.modules.network.fortios import fortios_alertemail_setting except ImportError: ...
# 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 from test.test_support import requires class Is_Get_Test(unittest.TestCase): """Test the is_ and get_ functions""" ...
from django.conf.urls import url from carnet_auto import views urlpatterns = [ url(r'^$', views.Home.as_view(), name='home'), url(r'^ajout_voiture/$', views.AjoutVoiture.as_view(), name='ajout_voiture'), url(r'^edite_voiture/(?P<pk>[0-9]+)/$', views.EditeVoiture.as_view(), name='edite_voiture'), url(r...
# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- # # $Id$ # # Tix Demostration Program # # This sample program is structured in such a way so that it can be # executed from the Tix demo program "tixwidgets.py": it must have a # procedure called "RunSample". It should also have the "if" sta...
"""Tests running the delete_orphan command""" import ddt from django.core.management import call_command, CommandError from contentstore.tests.test_orphan import TestOrphanBase from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore import ModuleStoreEnum @ddt.ddt class TestDeleteOrph...
from bears.python.PycodestyleBear import PycodestyleBear from coalib.testing.LocalBearTestHelper import verify_local_bear good_file = ''' def hello(): print("hello world") ''' bad_file = ''' import something def hello(): print("hello world") ''' PycodestyleBearTest = verify_local_bear( PycodestyleBe...
# Create your views here. from datetime import datetime import vobject from django.conf import settings from django.http import HttpResponse from auxiliary.views import GetMoreView from hashnav.detail import DetailView from models import Event class EventDetailView(DetailView): model = Event def get_contex...
import logging from .conversation import Statement, Response class Trainer(object): """ Base class for all other trainer classes. """ def __init__(self, storage, **kwargs): self.storage = storage self.logger = logging.getLogger(__name__) def train(self, *args, **kwargs): ...
import report_payslip_details import report_payroll_advice import report_hr_salary_employee_bymonth import payment_advice_report import report_hr_yearly_salary_detail import payslip_report
""" Add semver semrel to reportunknownpackages Revision ID: 8ac9b3343649 Revises: cee07a513404 Create Date: 2019-06-20 15:16:12.340579 """ import sqlalchemy as sa from alembic.op import add_column, alter_column, drop_column, create_index, drop_index, get_bind from pyfaf.storage import custom_types # revision identi...
import unittest from ctypes import * import _ctypes_test dll = CDLL(_ctypes_test.__file__) try: CALLBACK_FUNCTYPE = WINFUNCTYPE except NameError: # fake to enable this test on Linux CALLBACK_FUNCTYPE = CFUNCTYPE class POINT(Structure): _fields_ = [("x", c_int), ("y", c_int)] class BasicWrapTestCase(...
#!/usr/bin/python """This tests the YouTube""" import unittest import re from ircutils3.events import MessageEvent from youtube import YouTubeIdent, YouTubeSearch class TestYouTubeSearch(unittest.TestCase): """ This is for testing the YouTube search functionality. """ user = "TestUser!<EMAIL>" channe...
#!/usr/bin/env python3 """The influence of windowing of lin. bandlimited sweep signals when using a Kaiser Window by fixing beta (=2) and fade_out (=0). fstart = 100 Hz fstop = 5000 Hz Deconvolution: Unwindowed """ import sys sys.path.append('..') import measurement_chain import plotting import calcula...
# -*- coding: utf-8 -*- """ jinja2.testsuite.imports ~~~~~~~~~~~~~~~~~~~~~~~~ Tests the import features (with includes). :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ import unittest from jinja2.testsuite import JinjaTestCase from jinja2 import Environm...
from optparse import OptionParser option_parser = OptionParser(usage='usage: %prog [options] file1 [file2...]') option_parser.add_option('-v', '--verbose', action='store_true', dest='verbose', default=False, help='display debug output') option_parser.add_option('-p', '--properties', dest='proper...
from pytest import fixture from solar.core import resource from solar.dblayer.model import ModelMeta from solar.dblayer.solar_models import Resource @fixture def tagged_resources(): tags = ['n1', 'n2', 'n3'] t1 = Resource.from_dict('t1', {'name': 't1', 'tags': tags, 'base_path': '...
""" simpleTAL Implementation Copyright (c) 2009 Colin Stewart (http://www.owlfish.com/) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the ab...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import shutil from errno import EEXIST from ansible.errors import AnsibleError from ansible.module_utils._text import to_bytes, to_native, to_text __all__ = ['unfrackpath', 'makedirs_safe'] def unfrackpath(path, foll...
""" this module handles all file operations """ from employee import Employee from tax_rate import TaxRate from payslip import Payslip import csv,settings,datetime,os class ProcessCsvFile(object): """ The Class is designed to close read file thread gracefully """ def __init__(self, in...
import zookeeper class AgentStateMixin(object): """A mixin for state objects that will have agents processes. Provides for the observation and connection of agent processes. Subclasses must implement M{_get_agent_path}. """ def has_agent(self): """Does this domain object have an agent co...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='LoginAttempt', fields=[ ('id', models.AutoField...
import unittest import pmt class test_pmt(unittest.TestCase): def test01(self): a = pmt.intern("a") b = pmt.from_double(123765) d1 = pmt.make_dict() d2 = pmt.dict_add(d1, a, b) print d2 def test02(self): const = 123765 x_pmt = pmt.from_double(const) ...
import json import snug BASE = 'https://api.github.com' class repo(snug.Query[dict]): """a repository lookup by owner and name""" def __init__(self, name, owner): self.name, self.owner = name, owner def __iter__(self): request = snug.GET(BASE + f'/repos/{self.owner}/{self.name}') ...
import socket import sys try: import tty, termios except ImportError: # Probably Windows. try: import msvcrt except ImportError: # FIXME what to do on other platforms? # Just give up here. raise ImportError('getch not available') else: getch = msvcrt.getch els...
# -*- coding: utf-8 -*- import pytest from cfme import test_requirements @test_requirements.vmrc @pytest.mark.manual def test_vmrc_console_matrix(): """ This testcase is here to reflect testing matrix for vmrc consoles. Combinations listed are being tested manually. Originally, there was one testcase for...
from .TProtocol import * from struct import pack, unpack class TBinaryProtocol(TProtocolBase): """Binary implementation of the Thrift protocol driver.""" # NastyHaxx. Python 2.4+ on 32-bit machines forces hex constants to be # positive, converting this into a long. If we hardcode the int value # instead it'l...
import json from collections import UserList from django.conf import settings from django.core.exceptions import ValidationError # backwards compatibility from django.utils import timezone from django.utils.encoding import force_text from django.utils.html import escape, format_html, format_html_join, html_safe from ...
"""Functionality for loading events from a record file.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf class EventFileLoader(object): """An EventLoader is an iterator that yields Event protos.""" def __init__(self, file_pat...
""" Signals relating to comments. """ from django.dispatch import Signal # Sent just before a comment will be posted (after it's been approved and # moderated; this can be used to modify the comment (in place) with posting # details or other such actions. If any receiver returns False the comment will be # discarded a...
# -*- coding: utf-8 -*- """ pygments.lexers.php ~~~~~~~~~~~~~~~~~~~ Lexers for PHP and related languages. :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.lexer import RegexLexer, include, bygroups, default, us...
from __future__ import unicode_literals no_sitemap = 1 no_cache = 1 base_template_path = "templates/pages/desk.html" import os, re import frappe from frappe import _ import frappe.sessions def get_context(context): if (frappe.session.user == "Guest" or frappe.db.get_value("User", frappe.session.user, "user_type")...
from io import BytesIO class CallbackFileWrapper(object): """ Small wrapper around a fp object which will tee everything read into a buffer, and when that file is closed it will execute a callback with the contents of that buffer. All attributes are proxied to the underlying file object. Thi...
import us import re from base import JSONSource class GoogleCivicInformation(JSONSource): @classmethod def initialize(cls, key): cls.key = key def __init__(self): super(GoogleCivicInformation, self).__init__( "https://www.googleapis.com/civicinfo/v2/") def lookup_congre...
"""An adaptation of Py2.3/2.4's Queue module which supports reentrant behavior, using RLock instead of Lock for its mutex object. The Queue object is used exclusively by the sqlalchemy.pool.QueuePool class. This is to support the connection pool's usage of weakref callbacks to return connections to the underlying Que...
#!/usr/bin/env python #this is a python 3 script that scrapes the news articles off of tl;dr #Programmer: Matthew Deig import urllib.request, urllib.parse, urllib.error, re def getWebsite(websiteURL): #this is a function it is going to return a string back of the website data #the websiteURL is going to be a str...
# immediately below is stupid hackery for setuptools to work with Cython import distutils.extension import distutils.command.build_ext from distutils.extension import Extension as _Extension from setuptools import setup distutils.extension.Extension = _Extension distutils.command.build_ext.Extension = _Extension Exten...
import datetime import urllib import generic import sickbeard from sickbeard import classes from sickbeard import logger, tvcache, exceptions from sickbeard import helpers from sickbeard.common import Quality from sickbeard.exceptions import ex, AuthException from sickbeard.name_parser.parser import NamePars...
import time import asyncio import rethinkdb as r class AsyncTaskManager(object): def __init__(self, dbReference, connection, logger): self.funcDict = {} self.connection = connection self.dbReference = dbReference self.logger = logger def setFunctionDict(self, newDict): self.funcDict = newDict def pull...
from __future__ import unicode_literals import gzip import io from django.http import HttpRequest, HttpResponse, StreamingHttpResponse from django.http.utils import conditional_content_removal from django.test import SimpleTestCase # based on Python 3.3's gzip.compress def gzip_compress(data): buf = io.BytesIO(...
""" Run ExpGenerator to generate the description and permutations file for a spatial classification experiment """ import os import json from optparse import OptionParser from nupic.swarming.exp_generator.ExpGenerator import expGenerator if __name__ == '__main__': helpString = \ """%prog [options] searchDef ...
from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from Ripples import * from toontown.battle.BattleProps import globalPropPool from toontown.battle import BattleParticles class Splash(NodePath): splashCount = 0 def __init__(self, parent = hidden, wantParticles = 1): NodePa...
import json import os from urlparse import parse_qs, urlparse from django.conf import settings from django.test.client import Client from django.utils import unittest from funfactory.urlresolvers import reverse from mock import ANY, Mock, patch from mozorg.tests import TestCase from nose.tools import eq_, ok_ from p...
# -*- coding: utf-8 -*- """ pygments.lexers.chapel ~~~~~~~~~~~~~~~~~~~~~~ Lexer for the Chapel language. :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.lexer import RegexLexer, bygroups, words from pygments.token import...
__author__ = 'mworden' import os from mi.logging import config from mi.core.log import get_logger from mi.dataset.dataset_parser import DataSetDriverConfigKeys from mi.dataset.dataset_driver import DataSetDriver from mi.dataset.parser.nutnr_b_dcl_full import NutnrBDclFullRecoveredParser from mi.core.versioning import...
""" This configuration is a demonstration of how to implement the stacked LSTM with residual connections, i.e. an LSTM layer takes the sum of the hidden states and inputs of the previous LSTM layer instead of only the hidden states. This architecture is from: Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohamma...
data = ( 'tim', # 0x00 'tib', # 0x01 'tibs', # 0x02 'tis', # 0x03 'tiss', # 0x04 'ting', # 0x05 'tij', # 0x06 'tic', # 0x07 'tik', # 0x08 'tit', # 0x09 'tip', # 0x0a 'tih', # 0x0b 'pa', # 0x0c 'pag', # 0x0d 'pagg', # 0x0e 'pags', # 0x0f 'pan', # 0x10 'panj', # 0x11 ...
from django.contrib import messages from django.core.urlresolvers import reverse from django.shortcuts import redirect from django.utils.translation import ugettext_lazy as _ from misago.admin.views import generic from ...forms.admin import RankForm from ...models import Rank class RankAdmin(generic.AdminBaseMixin)...
from __future__ import unicode_literals import json import os import sys import environment as env import products import testloader import wptcommandline import wptlogging import wpttest from testrunner import ManagerGroup here = os.path.split(__file__)[0] logger = None """Runner for web-platform-tests The runne...
""" Module to enable UAC on a host or host list. Module built by @harmj0y """ from lib import command_methods class Module: def __init__(self, targets=None, creds=None, args=None): self.name = "Enable UAC" self.description = "Enables User Access Control (UAC) on a host or host list." ...
# import the necessary packages import cv2 class ShapeDetector: def __init__(self): pass def detect(self, c): # initialize the shape name and approximate the contour shape = "unidentified" peri = cv2.arcLength(c, True) approx = cv2.approxPolyDP(c, 0.04 * peri, True) # if the shape is a triangle, it wil...
""" XML serializer. """ from __future__ import unicode_literals from django.conf import settings from django.core.serializers import base from django.db import models, DEFAULT_DB_ALIAS from django.utils.xmlutils import SimplerXMLGenerator from django.utils.encoding import smart_unicode from xml.dom import pulldom cl...
{ "name": "ADR Product report", "version": "1.0", "depends": [ "product", ], "author": "OdooMRP team, " "AvanzOSC, " "Serv. Tecnol. Avanzados - Pedro M. Baeza", "contributors": [ "Juan Ignacio Úbeda <<EMAIL>>", "Oihane Crucelaegui <<EMAIL>>", ...
""" Management utility to create a token user """ import hashlib from contextlib import closing from urllib2 import urlopen from django.core.management.base import BaseCommand, CommandError from tardis.tardis_portal.models import Dataset_File CHUNK_SIZE = 32*1024 class AlgorithmNotSupported(Exception): pass cl...
# -*- coding: utf-8 -*- from django.core.management import call_command from tastypie.test import ResourceTestCase, TestApiClient from django.contrib.auth.models import User from ...models import OutboundMessage, OutboundMessageIdentifier class HandleBounces(ResourceTestCase): def setUp(self): super(Handl...
from deluge.log import LOG as log from deluge.ui.client import client from deluge import component from deluge.plugins.pluginbase import WebPluginBase from common import get_resource class WebUI(WebPluginBase): scripts = [get_resource("autoadd.js")] def enable(self): pass def disable(self): ...
from __future__ import unicode_literals import numpy as np from sklearn.feature_extraction import FeatureHasher from nose.tools import assert_raises, assert_true from numpy.testing import assert_array_equal, assert_equal def test_feature_hasher_dicts(): h = FeatureHasher(n_features=16) assert_equal("dict",...
from ajenti.ui import * from ajenti.com import implements from ajenti.api import * from ajenti import apis from backend import * class SquidPlugin(apis.services.ServiceControlPlugin): text = 'Squid' icon = '/dl/squid/icon.png' folder = 'servers' service_name = 'squid' def get_config(self): ...
"""Benchmark Tests Definitions.""" import logging from categories import test_set_base from categories import all_test_sets class SummaryTest(test_set_base.TestBase): def __init__(self, category, category_name): test_set_base.TestBase.__init__( self, key=category, name=category_name, ...
# -*- coding: utf-8 -*- import os, sys, time, random, fcntl, socket, math from conf import * term = os.getenv("TERM") if term and \ ('color' in term or term in ('rxvt', 'xterm')): MESSAGE_SUCCESS = '\033[0;48;36m Success \033[0m' # Blue MESSAGE_FAILED = '\033[0;48;31m Failed \033[0m' # Red MESSA...
from __future__ import absolute_import import logging import os from os.path import join, abspath, isdir from .util.paths import ROOT_DIR, bokehjsdir class Settings(object): _prefix = "BOKEH_" debugjs = False @property def _environ(self): return os.environ def _get(self, key, default=N...
""" calico.geventutils ~~~~~~~~~~~~~~~~~~ Helper utilities for gevent. """ import itertools import logging import gevent import gevent.local _log = logging.getLogger(__name__) tid_storage = gevent.local.local() tid_counter = itertools.count() # Ought to do itertools.count(start=1), but python 2.6 does not support ...
import mock import unittest import os from airflow import configuration from airflow.utils.log.s3_task_handler import S3TaskHandler from airflow.utils.state import State from airflow.utils.timezone import datetime from airflow.hooks.S3_hook import S3Hook from airflow.models import TaskInstance, DAG from airflow.operat...
import glob import getorg from geopy import Nominatim g = glob.glob("*.md") geocoder = Nominatim() location_dict = {} location = "" permalink = "" title = "" for file in g: with open(file, 'r') as f: lines = f.read() if lines.find('location: "') > 1: loc_start = lines.find('location...
import os from cmdutils import * def run(): r=RunTestLib() r.run_test(name='memstats', command="%s -memstats testdata/memstats.abc" % r.avm, expectedout=[ 'gross stats', 'managed overhead', 'gross ...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding index on 'Tag', fields ['name'] db.create_index('tags_tag', ['name']) # Adding index on 'T...
from __future__ import absolute_import from django.conf.urls import patterns, url from django.views.decorators.cache import cache_page from django.views.generic import TemplateView from . import models from . import views urlpatterns = patterns('', # base #(r'^about/login-required/$', # views.Decorat...