content string |
|---|
from django.utils.translation import ugettext_lazy as _
import django_filters
from readthedocs.builds import constants
from readthedocs.builds.models import Build, Version
ANY_REPO = (
('', _('Any')),
)
BUILD_TYPES = ANY_REPO + constants.BUILD_TYPES
class VersionSlugFilter(django_filters.FilterSet):
cla... |
from nova.api.openstack.compute import admin_actions as admin_actions_v21
from nova.api.openstack.compute.legacy_v2.contrib import admin_actions \
as admin_actions_v2
from nova import exception
from nova import test
from nova.tests.unit.api.openstack.compute import admin_only_action_common
from nova.tests.unit.... |
from django.utils import timezone
import mock
import pytest
from addons.wiki.tests.factories import WikiFactory
from api.base.settings.defaults import API_BASE
from api_tests import utils as test_utils
from osf.models import Guid
from osf_tests.factories import (
ProjectFactory,
AuthUserFactory,
CommentFac... |
"""
This module is deprecated. Please use `airflow.providers.google.cloud.hooks.gcs`.
"""
import warnings
from airflow.providers.google.cloud.hooks.gcs import GCSHook
warnings.warn(
"This module is deprecated. Please use `airflow.providers.google.cloud.hooks.gcs`.",
DeprecationWarning, stacklevel=2
)
class ... |
import os
import sys
import tempfile
import operator
import functools
import itertools
import re
import contextlib
import pickle
import six
from six.moves import builtins, map
import pkg_resources
if sys.platform.startswith('java'):
import org.python.modules.posix.PosixModule as _os
else:
_os = sys.modules[o... |
"""
This module houses the ctypes function prototypes for OGR DataSource
related data structures. OGR_Dr_*, OGR_DS_*, OGR_L_*, OGR_F_*,
OGR_Fld_* routines are relevant here.
"""
from ctypes import c_char_p, c_double, c_int, c_long, c_void_p, POINTER
from django.contrib.gis.gdal.envelope import OGREnvelope
from djang... |
import re
import sys
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver import DesiredCapabilities
from webdriver_manager.chrome import ChromeDriverManager
from util.exceptions import WebDriverException
from util.instalogger import InstaLogger
from util.settin... |
"""Support for exposing NX584 elements as sensors."""
import logging
import threading
import time
from nx584 import client as nx584_client
import requests
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_OPENING,
DEVICE_CLASSES,
PLATFORM_SCHEMA,
BinarySensorEn... |
import sys,string,os
sys.path.insert(1, os.path.join(sys.path[0], '..')) ### import parent dir dependencies
def importFPKMFile(input_file):
added_key={}
firstLine = True
for line in open(input_file,'rU').xreadlines():
data = line.rstrip('\n')
t = string.split(data,'\t')
if firstLine... |
"""
The MIT License (MIT)
Copyright (c) 2014 NTHUOJ team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, ... |
"""
Models for the event
"""
import datetime
from django.utils import timezone
from django.db import models
from django.template.defaultfilters import slugify
from taggit.managers import TaggableManager
from geoposition.fields import GeopositionField
from django_countries.fields import CountryField
from django.conf imp... |
class Solution:
def sampleStats(self, count: List[int]) -> List[float]:
# minimum, maximum, mean, median, and mode
result = [0] * 5
for i, c in enumerate(count):
if c > 0:
result[0] = float(i)
break
for i in range(255, -1, -1):
... |
try:
import pyrax
HAS_PYRAX = True
except ImportError:
HAS_PYRAX = False
def rax_meta(module, address, name, server_id, meta):
changed = False
cs = pyrax.cloudservers
if cs is None:
module.fail_json(msg='Failed to instantiate client. This '
'typically ind... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
class ModuleDocFragment(object):
DOCUMENTATION = r'''
options:
display_skipped_hosts:
name: Show skipped hosts
description: "Toggle to control displaying skipped task/host results in a task"
... |
name = raw_input("Username: ")
##while True == True:
## boat = raw_input("Enter your message: ")
## mc.postToChat(name + ": " + boat)
##x = int(raw_input("Giveth to me numbers: "))
##y = int(raw_input("Giveth to me numbers: "))
##z = int(raw_input("Giveth to me numbers: "))
##blockType = int(raw_input("Giveth t... |
import re
import sys
from decimal import Decimal
from django.contrib.gis.db.backends.base import BaseSpatialOperations
from django.contrib.gis.db.backends.utils import SpatialOperation, SpatialFunction
from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter
from django.contrib.gis.geometry.back... |
# ############################################################################
#
# Copyright (c) Microsoft Corporation.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of this distribution... |
#!/usr/bin/env python
# coding=utf-8
from toughlib import utils
from toughlib import logger
import logging
try:
import redis
except:
pass
class LogTrace(object):
radius_key = "toughradius.syslog.trace.radius.{0}".format
trace_key = "toughradius.syslog.trace.{0}".format
def __init__(self, cache_... |
"""Constants and static functions to support protocol buffer wire format."""
__author__ = '<EMAIL> (Will Robinson)'
import struct
from google.protobuf import message
TAG_TYPE_BITS = 3 # Number of bits used to hold type info in a proto tag.
_TAG_TYPE_MASK = (1 << TAG_TYPE_BITS) - 1 # 0x7
# These numbers identify ... |
import sys
import unittest
from unittest import mock
from django import __version__
from django.core.management import CommandError, call_command
from django.test import SimpleTestCase
from django.test.utils import captured_stdin, captured_stdout, patch_logger
class ShellCommandTestCase(SimpleTestCase):
def tes... |
import sys
import numpy as np
from IPython.core.display import Image
import praw
reddit = praw.Reddit("BayesianMethodsForHackers")
subreddit = reddit.get_subreddit( "pics" )
top_submissions = subreddit.get_top()
n_pic = int( sys.argv[1] ) if sys.argv[1] else 1
i = 0
while i < n_pic:
top_submission = top_su... |
"""
Sane parameters for stats.distributions.
"""
distcont = [
['alpha', (3.5704770516650459,)],
['anglit', ()],
['arcsine', ()],
['beta', (2.3098496451481823, 0.62687954300963677)],
['betaprime', (5, 6)],
['bradford', (0.29891359763170633,)],
['burr', (10.5, 4.3)],
['burr12', (10, 4)],
... |
from django.db import models
class ThingItem(object):
def __init__(self, value, display):
self.value = value
self.display = display
def __iter__(self):
return (x for x in [self.value, self.display])
def __len__(self):
return 2
class Things(object):
def __iter__(se... |
__author__ = 'raminbarati'
import incremental_learner as incLer
import networkx as nx
class IncrementalLearnerMcsMinimal(incLer.IncrementalLearnerBase):
def triangulate(self, graph):
def check(start,goal):
# return True
def is_goal(node):
return node == goal
... |
"""Module for testing interval variables."""
import datetime
class TestIntervalVar(BaseTestCase):
def setUp(self):
BaseTestCase.setUp(self)
self.rawData = []
self.dataByKey = {}
for i in range(1, 11):
delta = datetime.timedelta(days = i, hours = i, minutes = i * 2,
... |
"""<name>R Script</name>
<description>Run R scripts</description>
<icon>icons/RScript.png</icon>
"""
from OWWidget import *
from OWPythonScript import OWPythonScript, Script, ScriptItemDelegate, PythonConsole
from OWItemModels import PyListModel, ModelActionsWidget
import Orange.utils.r as r
globalenv = r.globalen... |
# -*- coding: utf-8 -*-
'''
fantastic Add-on
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 later version.
This pro... |
## \file
## \ingroup tutorial_pyroot
## This macro displays the Tree data structures
##
## \macro_image
## \macro_code
##
## \author Wim Lavrijsen
from ROOT import TCanvas, TPaveLabel, TPaveText, TPavesText, TText
from ROOT import TArrow, TLine
from ROOT import gROOT, gBenchmark
#gROOT.Reset()
c1 = TCanvas('c1','Tre... |
from django.conf import settings
from django.conf.urls import include, url
from django.views.generic import TemplateView
from pootle.core.delegate import url_patterns
urlpatterns = []
# Allow url handlers to be overriden by plugins
for delegate_urls in url_patterns.gather().values():
urlpatterns += delegate_url... |
from nl import kb, Exists, Thing, Fact, Rule, Instant, Duration, During, Finish, Coincide, MinComStart, MaxComEnd
# BASIC STUFF
# a person is a thing:
class Person(Thing): pass
# Can is a verb that takes a thing as a subject and a state as a modificator
class Can(Exists):
subject = Thing
mods = {'what': Exis... |
"""
==================
Two-class AdaBoost
==================
This example fits an AdaBoosted decision stump on a non-linearly separable
classification dataset composed of two "Gaussian quantiles" clusters
(see :func:`sklearn.datasets.make_gaussian_quantiles`) and plots the decision
boundary and decision scores. The di... |
from clang.cindex import CursorKind
from clang.cindex import Index
from clang.cindex import SourceLocation
from clang.cindex import SourceRange
from clang.cindex import TokenKind
from nose.tools import eq_
from nose.tools import ok_
from .util import get_tu
def test_token_to_cursor():
"""Ensure we can obtain a Cu... |
"""Heap queue algorithm (a.k.a. priority queue).
Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0. For the sake of comparison,
non-existing elements are considered to be infinite. The interesting
property of a heap is that a[0] is always its smallest element.
Usag... |
"""The tests for Monoprice Media player platform."""
from collections import defaultdict
from unittest.mock import patch
from serial import SerialException
from homeassistant.components.media_player.const import (
ATTR_INPUT_SOURCE,
ATTR_INPUT_SOURCE_LIST,
ATTR_MEDIA_VOLUME_LEVEL,
DOMAIN as MEDIA_PLAY... |
"""
Tests for stuff in django.utils.datastructures.
"""
import copy
from django.test import SimpleTestCase
from django.utils import six
from django.utils.datastructures import (
DictWrapper, ImmutableList, MultiValueDict, MultiValueDictKeyError,
OrderedSet,
)
class OrderedSetTests(SimpleTestCase):
def ... |
from __future__ import absolute_import
import json
import logging
from django.http import HttpResponseBadRequest, Http404
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_GET
from django.core.exceptions import PermissionDenied
from django.conf import settings
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Checker for file headers
~~~~~~~~~~~~~~~~~~~~~~~~
Make sure each Python file has a correct file header
including copyright and license information.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE fo... |
"""openid.py: an openid library for web.py
Notes:
- This will create a file called .openid_secret_key in the
current directory with your secret key in it. If someone
has access to this file they can log in as any user. And
if the app can't find this file for any reason (e.g. you
moved the app somewhe... |
import boto
import time
from tests.compat import unittest
class TestIAM(unittest.TestCase):
iam = True
def test_group_users(self):
# A very basic test to create a group, a user, add the user
# to the group and then delete everything
iam = boto.connect_iam()
name = 'boto-test... |
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
from django.utils.translation import ugettext_lazy as _
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
FIXTURE_DIRS = [os.path.join(BASE_DIR, 'fixtures')]
SECRET_KEY = 'dg0pdghh4andk^v=rw^l-i81yz-h2co%mlj4)+p(cqz... |
# -*- coding: utf-8 -*-
import six
from django import forms
from django.contrib.admin.widgets import RelatedFieldWidgetWrapper
from django.forms.fields import EMPTY_VALUES
from django.utils.translation import ugettext_lazy as _
from cms.forms.utils import get_site_choices, get_page_choices
from cms.forms.widgets impo... |
"""
tdc_helper.py - tdc helper functions
Copyright (C) 2017 Lucas Bates <<EMAIL>>
"""
def get_categorized_testlist(alltests, ucat):
""" Sort the master test list into categories. """
testcases = dict()
for category in ucat:
testcases[category] = list(filter(lambda x: category in x['category'], al... |
"""
Copyright (c) 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
Self-test of the matcher infrastructure. This is less about individual matchers,
and more about if the various sequences and groups work (and fail!) as expected.
"""
from __future__ import print_function
import unittest
import plugin_test_helpe... |
import typing
import inspect
from cauldron.docgen import conversions
def get_args_index(target) -> int:
"""
Returns the index of the "*args" parameter if such a parameter exists in
the function arguments or -1 otherwise.
:param target:
The target function for which the args index should be de... |
# ==============================================================
import os
import tempfile
import re
class SysctlModule(object):
def __init__(self, module):
self.module = module
self.args = self.module.params
self.sysctl_cmd = self.module.get_bin_path('sysctl', required=True)
se... |
"""
Asset Manager
Interface allowing course asset saving/retrieving.
Handles:
- saving asset in the BlobStore -and- saving asset metadata in course modulestore.
- retrieving asset metadata from course modulestore -and- returning URL to asset -or- asset bytes.
Phase 1: Checks to see if an asset's metadata can be f... |
"""Lists physical networks"""
from baseCmd import *
from baseResponse import *
class listPhysicalNetworksCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "false"
"""list physical network by id"""
self.id = None
self.typeInfo['id'] = 'uuid'
"""List by key... |
"""
Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's
Smalltalk testing framework.
This module contains the core framework classes that form the basis of
specific test cases and suites (TestCase, TestSuite etc.), and also a
text-based utility class for running the tests and reporting the resu... |
"""
Decorators for views based on HTTP headers.
"""
import logging
from calendar import timegm
from functools import wraps
from django.utils.decorators import decorator_from_middleware, available_attrs
from django.utils.http import http_date, parse_http_date_safe, parse_etags, quote_etag
from django.middleware.http i... |
from openerp.tests.common import TransactionCase
import time
class TestReconciliation(TransactionCase):
"""Tests for reconciliation (account.tax)
Test used to check that when doing a sale or purchase invoice in a different currency,
the result will be balanced.
"""
def setUp(self):
super(... |
# -*- mode: python -*-
import sys, os, string, time, commands, re, pickle, StringIO, popen2, commands, pdb, zipfile
import SCons
# need an Environment and a matching buffered_spawn API .. encapsulate
class idBuffering:
def buffered_spawn( self, sh, escape, cmd, args, env ):
stderr = StringIO.StringIO()
stdout = ... |
import sys
import time
import os
if __name__ == '__main__':
if len(sys.argv) < 3:
print "Usage: {0} <word_vec_fn> <vocab_fn>".format(sys.argv[0])
sys.exit()
word_vec_fn = sys.argv[1]
vocab_fn = sys.argv[2]
save_fn = os.path.splitext(vocab_fn)[0] + '_glove.txt'
fea_save_fn = o... |
import cherrypy
# 這是 MAN 類別的定義
'''
# 在 application 中導入子模組
import programs.cdag3.remsub6 as cdag3_remsub6
# 加入 cdag3 模組下的 remsub6.py 且以子模組 remsub6 對應其 remsub6() 類別
root.cdag3.remsub6 = cdag3_remsub6.remsub6()
# 完成設定後, 可以利用
/cdag3/remsub6
# 呼叫 man.py 中 MAN 類別的 assembly 方法
'''
class remsub6(object):
# 各組利用 index 引... |
"""Various TensorFlow Ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=wildcard-import
from tensorflow.contrib.learn.python.learn.ops.embeddings_ops import *
from tensorflow.contrib.learn.python.learn.ops.losses_ops import *
from te... |
"Functions that help with dynamically creating decorators for views."
try:
from contextlib import ContextDecorator
except ImportError:
ContextDecorator = None
from functools import WRAPPER_ASSIGNMENTS, update_wrapper, wraps
from django.utils import six
class classonlymethod(classmethod):
def __get__(se... |
"""This module contains a object that represents a Telegram Location"""
from telegram import TelegramObject
class Location(TelegramObject):
"""This object represents a Telegram Sticker.
Attributes:
longitude (float):
latitude (float):
Args:
longitude (float):
latitude (f... |
import time
import base64
from openerp.tools.translate import _
from openerp.osv import fields, osv
from openerp.report import report_sxw
class vat_listing_clients(osv.osv_memory):
_name = 'vat.listing.clients'
_columns = {
'name': fields.char('Client Name'),
'vat': fields.char('VAT'),
... |
#!/usr/bin/python
"""
ResultReport.py - Handles the gathering and xml-formatting of xm-test
results
Copyright (C) International Business Machines Corp., 2005
Author: Dan Smith <<EMAIL>>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General ... |
# -*- coding: ISO-8859-1 -*-
from MidiOutStream import MidiOutStream
from RawOutstreamFile import RawOutstreamFile
from constants import *
from DataTypeConverters import fromBytes, writeVar
class MidiOutFile(MidiOutStream):
"""
MidiOutFile is an eventhandler that subclasses MidiOutStream.
... |
# This script generates a Python interface for an Apple Macintosh Manager.
# It uses the "bgen" package to generate C code.
# The function specifications are generated by scanning the mamager's header file,
# using the "scantools" package (customized for this particular manager).
import string
# Declarations that cha... |
"""Interface to the libbzip2 compression library.
This module provides a file interface, classes for incremental
(de)compression, and functions for one-shot (de)compression.
"""
__all__ = ["BZ2File", "BZ2Compressor", "BZ2Decompressor",
"open", "compress", "decompress"]
__author__ = "Nadeem Vawda <<EMAIL>>... |
from urllib import urlencode
import formencode
from pylons import request
from pylons import response
from pylons import session
from pylons.controllers.util import redirect
from pylons.i18n import _
from adhocracy import config
from adhocracy import forms
from adhocracy.lib import helpers as h
from adhocracy.lib.auth ... |
#!/usr/bin/env python
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.enums import DBMS
from lib.core.settings import MAXDB_SYSTEM_DBS
from lib.core.unescaper import unescaper
from plugins.dbms.maxdb.enumeration import Enumeration
... |
class Class001(object):
unique_attr = 1
class Class002(Class001):
unique_attr = 2
class Class003(Class002, Class001):
unique_attr = 3
class Class004(Class003, Class002, Class001):
unique_attr = 4
class Class005(Class004, Class003, Class002):
unique_attr = 5
class Class006(Class005, Class00... |
import os
import sys
from nova import exception
from nova import test
from nova.tests.unit.virt.disk.vfs import fakeguestfs
from nova.virt.disk import api as diskapi
from nova.virt.disk.vfs import guestfs as vfsguestfs
class VirtDiskTest(test.NoDBTestCase):
def setUp(self):
super(VirtDiskTest, self).set... |
# This code is in the public domain, it comes
# with absolutely no warranty and you can do
# absolutely whatever you want with it.
# Figment: Edits add element_closer to elements
# to enhance expressiveness
__date__ = '1 October 2012'
__version__ = '1.9'
__doc__ = """
This is markup.py - a Python module that... |
# -*- coding: utf-8 -*-
"""
httpbin.filters
~~~~~~~~~~~~~~~
This module provides response filter decorators.
"""
import gzip as gzip2
import zlib
from decimal import Decimal
from time import time as now
from io import BytesIO
from decorator import decorator
from flask import Flask, Response
app = Flask(__name__)... |
import os
import re
from pip.backwardcompat import urlparse
from pip.index import Link
from pip.util import rmtree, display_path, call_subprocess
from pip.log import logger
from pip.vcs import vcs, VersionControl
_svn_xml_url_re = re.compile('url="([^"]+)"')
_svn_rev_re = re.compile('committed-rev="(\d+)"')
_svn_url_r... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def create_ratelimit_bypass_perm(apps, schema_editor):
# First we get or create the content type.
ContentType = apps.get_model('contenttypes', 'ContentType')
global_permission_ct, created = ContentTyp... |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 coding=utf-8
import os
import glob
import csv
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext_lazy
from odk_logger.models.xform import XForm, DuplicateUUIDError
from optparse import make_option
from utils... |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
BitBake 'Fetch' git submodules implementation
"""
# Copyright (C) 2013 Richard Purdie
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as... |
import json
import unittest
from api_models import APIModels
from compiled_file_system import CompiledFileSystem
from extensions_paths import (API_PATHS, CHROME_API, CHROME_EXTENSIONS,
EXTENSIONS_API)
from features_bundle import FeaturesBundle
from file_system import FileNotFoundError
from mock_file_system import ... |
import datetime
from django import template
from micro_blog.microblog.models import Post, Tags, UserRole
from micro_blog.microblog.views import get_user_role
register = template.Library()
@register.assignment_tag(takes_context=True)
def get_archives(context):
archives = []
dates = []
for each_object in P... |
import os
from sys import platform
from shutil import copyfile
# cross-platform hosts file path
if "linux" in platform:
HPATH = "/etc/hosts"
else:
# windows is a pain in the ass
HPATH = os.getenv("systemroot")
if os.path.isdir(HPATH + "\\System32"):
HPATH += "\\System32"
else:
HPAT... |
from keystone.common import kvs
class Ec2(kvs.Base):
# Public interface
def get_credential(self, credential_id):
credential_ref = self.db.get('credential-%s' % credential_id)
return credential_ref
def list_credentials(self, user_id):
credential_ids = self.db.get('credential_list',... |
import csv
import sys
if len(sys.argv) != 3:
print ("Usage: python heirarchical-cluster.py [in file] [out file]")
exit(-1)
in_file = sys.argv[1]
out_file = sys.argv[2]
sortedDistances = [] #Tuples to be sorted by distances.
clusterDistances = {}
clusters = {} # Clusters is a list of tracts in a cluster - num... |
"""
Verifies build of an executable with C++ define specified by a gyp define.
"""
import os
import TestGyp
test = TestGyp.TestGyp()
# With the value only given in environment, it should be used.
try:
os.environ['GYP_DEFINES'] = 'value=10'
test.run_gyp('defines-env.gyp')
finally:
del os.environ['GYP_DEFINES']
... |
from __future__ import print_function
from builtins import range
from argparse import ArgumentParser
from pdb import pm
import json
from future.utils import viewitems
from miasm.analysis.machine import Machine
from miasm.analysis.binary import Container
from miasm.analysis.depgraph import DependencyGraph
from miasm.e... |
"""Fixer for has_key().
Calls to .has_key() methods are expressed in terms of the 'in'
operator:
d.has_key(k) -> k in d
CAVEATS:
1) While the primary target of this fixer is dict.has_key(), the
fixer will change any has_key() method call, regardless of its
class.
2) Cases like this will not be converted:
... |
from django import VERSION
if VERSION < (1, 5):
from django.utils import simplejson
else:
import json as simplejson
from oembed.exceptions import OEmbedException
class OEmbedResource(object):
"""
OEmbed resource, as well as a factory for creating resource instances
from response json
"""
_... |
from gnuradio import gr, gr_unittest, blocks
import lte_swig as lte
import numpy as np
import lte_test
class qa_pbch_demux_vcvc (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
self.N_rb_dl = N_rb_dl = 50
self.key = key = "symbol"
n_carriers = 12*N_rb_dl
... |
# -*- coding: utf-8 -*-
"""
flask.testsuite.signals
~~~~~~~~~~~~~~~~~~~~~~~
Signalling.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
import unittest
from flask.testsuite import FlaskTestCase
class SignalsTestCase(FlaskTestCase):
def ... |
"""Module for handling messages and concurrency for run-webkit-tests
and test-webkitpy. This module follows the design for multiprocessing.Pool
and concurrency.futures.ProcessPoolExecutor, with the following differences:
* Tasks are executed in stateful subprocesses via objects that implement the
Worker interface - ... |
#!/usr/bin/python -u
import sys, unittest
import libxml2
class TestCase(unittest.TestCase):
def runTest(self):
self.test1()
self.test2()
def setUp(self):
libxml2.debugMemory(1)
def tearDown(self):
libxml2.cleanupParser()
if libxml2.debugMemory(1) != 0:
... |
from base64 import b64encode
from collections import namedtuple
from socket import error as SocketError
try:
from select import poll, POLLIN
except ImportError: # `poll` doesn't exist on OSX and other platforms
poll = False
try:
from select import select
except ImportError: # `select` doesn't e... |
import unittest
import mock
from apache_beam.examples.snippets.util import assert_matches_stdout
from apache_beam.testing.test_pipeline import TestPipeline
from . import map
def check_plants(actual):
expected = '''[START plants]
🍓Strawberry
🥕Carrot
🍆Eggplant
🍅Tomato
🥔Potato
[END plants]'''.splitlines()[1:-1... |
"""
Django settings for FastReading project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... |
# -*- coding: utf-8 -*-
"""
This config file runs the simplest dev environment using sqlite, and db-based
sessions. Assumes structure:
/envroot/
/db # This is where it'll write the database file
/edx-platform # The location of this repo
/log # Where we're going to write log files
"""
# We ... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.cloudengine.ce import execute_nc_action, ce_argument_spec
try:
from ncclient.operations.... |
import apt_pkg
from apt import Package
import apt.progress
import os
import sys
class FetchCancelledException(IOError):
" Exception that is thrown when the user cancels a fetch operation "
pass
class FetchFailedException(IOError):
" Exception that is thrown when fetching fails "
pass
class LockFailedEx... |
import unittest
from telemetry.core.platform.power_monitor import sysfs_power_monitor
class SysfsPowerMonitorMonitorTest(unittest.TestCase):
initial_freq = {
'cpu0': '1700000 6227\n1600000 0\n1500000 0\n1400000 28\n1300000 22\n'
'1200000 14\n1100000 19\n1000000 22\n900000 14\n800000 20\n'
... |
# -*- coding: utf-8 -*-
"""
requests.structures
~~~~~~~~~~~~~~~~~~~
Data structures that power Requests.
"""
import collections
class CaseInsensitiveDict(collections.MutableMapping):
"""
A case-insensitive ``dict``-like object.
Implements all methods and operations of
``collections.MutableMapping... |
"""
Settings and configuration for Django.
Values will be read from the module specified by the DJANGO_SETTINGS_MODULE environment
variable, and then from django.conf.global_settings; see the global settings file for
a list of all possible variables.
"""
import importlib
import os
import time
import warnings
from dj... |
"""Tests for stochastic graphs."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib import distributions
from tensorflow.contrib.bayesflow.python.ops import stochastic_tensor
from tensorflow.contrib.bayesflow.python... |
from nova.api.validation import parameter_types
evacuate = {
'type': 'object',
'properties': {
'evacuate': {
'type': 'object',
'properties': {
'host': parameter_types.hostname,
'onSharedStorage': parameter_types.boolean,
'adminPas... |
import pytest
import numpy
from bliss.common.measurement import SamplingCounter, IntegratingCounter
class Diode(SamplingCounter):
def __init__(self, diode, convert_func):
SamplingCounter.__init__(self, 'test_diode', None,
grouped_read_handler = None,
... |
import sys
import codecs
from sequences.sequence import *
from sequences.sequence_list import *
import readers.pos_corpus as pcc
import readers.brown_pos_corpus as bpc
import sequences.extended_feature as exfc
import sequences.structured_perceptron as spc
import sequences.confusion_matrix as bcm
MAX_SENT_SIZE = 1000
... |
from sahara.plugins import utils as u
def get_namenode(cluster):
return u.get_instance(cluster, "namenode")
def get_jobtracker(cluster):
instance = u.get_instance(cluster, "jobtracker")
return instance
def get_resourcemanager(cluster):
return u.get_instance(cluster, 'resourcemanager')
def get_n... |
# -*- coding: utf-8 -*-
from cms.constants import PUBLISHER_STATE_DIRTY
from cms.models import CMSPlugin, Title, Page, StaticPlaceholder, Placeholder
def get_placeholder(plugin):
if plugin.placeholder_id:
try:
return plugin.placeholder
except Placeholder.DoesNotExist:
retur... |
import os
from telemetry.core import util
DEFAULT_WEB_CONTENTS_TIMEOUT = 90
# TODO(achuith, dtu, nduca): Add unit tests specifically for WebContents,
# independent of Tab.
class WebContents(object):
"""Represents web contents in the browser"""
def __init__(self, inspector_backend):
self._inspector_backend = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.