content stringlengths 4 20k |
|---|
import unittest
from test.support import check_syntax_error, run_unittest
class ScopeTests(unittest.TestCase):
def testSimpleNesting(self):
def make_adder(x):
def adder(y):
return x + y
return adder
inc = make_adder(1)
plus10 = make_adder(10)
... |
#!/usr/bin/env python3
import os
import time
import socket
from datetime import datetime, timedelta
import argparse
import pickle
import random
import requests
from sqlalchemy import asc
from settings import network, last_seen_delta, notify_offline, notify_blacklist, pa_app_token, pa_user_key
from common import get_ho... |
#coding:utf-8
from itertools import repeat, chain
from itertools import takewhile
from operator import itemgetter
from random import sample
from typing import Iterable, List, Dict, Tuple, Iterator, Optional as Opt, Sequence as Seq, Mapping as Map
from torch import stack
from torch.nn.utils.rnn import pack_padded_seque... |
from google.appengine.ext import db
class SVNRevision(db.Model):
number = db.IntegerProperty()
broken_bots = db.StringListProperty(default=[])
date = db.DateTimeProperty(auto_now_add=True) |
launch_altitude = 100
cruise_altitude = 200
takeoff_azimuth = 270
turn_direction = 0 #1 = right, 0 = left
#DONT MESS WITH ANYTHING BELOW THIS LINE
import sys
import math
import clr
import time
import System
from System import Byte
clr.AddReference("MissionPlanner")
import MissionPlanner
clr.AddReference("Mission... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.six import iteritems, string_types
import os
from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.parsing.yaml.objects import AnsibleBaseYAMLObject, AnsibleMapping
from ansib... |
from rally.plugins.openstack.cfg import cinder
from rally.plugins.openstack.cfg import ec2
from rally.plugins.openstack.cfg import glance
from rally.plugins.openstack.cfg import heat
from rally.plugins.openstack.cfg import ironic
from rally.plugins.openstack.cfg import magnum
from rally.plugins.openstack.cfg import man... |
"""Tests for the type system."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from scss.types import Color, List, Null, Number, String
import pytest
# Operators: arithmetic (+ - * / %), unary (+ -), comparison (== != < > <= >=), boolean
# Types... |
"""
Transparent image file caching middleware, designed to live on
Glance API nodes. When images are requested from the API node,
this middleware caches the returned image file to local filesystem.
When subsequent requests for the same image file are received,
the local cached copy of the image file is returned.
"""
... |
import os
import jinja2
import webapp2
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
# Skip old landing page, go direct to guides.
HOME_PAGE = '/guide'
# Match HTML pages from path; similar to behavior o... |
"""remove status from HealthMonitor
Revision ID: 35c7c198ddea
Revises: 11c6e18605c8
Create Date: 2013-08-02 23:14:54.037976
"""
# revision identifiers, used by Alembic.
revision = '35c7c198ddea'
down_revision = '11c6e18605c8'
# Change to ['*'] if this migration applies to all plugins
migration_for_plugins = [
... |
import matplotlib,numpy,sys,scipy,pickle
import matplotlib.pyplot
sys.path.append('../lib')
import calculateStatistics
### MAIN
matplotlib.rcParams.update({'font.size':36,'font.family':'Times New Roman','xtick.labelsize':28,'ytick.labelsize':28})
thePointSize=12
jarDir='/Users/adriandelomana/scratch/'
# clonal 2
x... |
#!/usr/bin/python3
from __future__ import print_function
import collections
import itertools
import weakref
import pprint
try:
from functools import singledispatch
except ImportError:
from singledispatch import singledispatch
class Tree(collections.Sized, collections.Iterable, collections.Container):
""... |
from rest_framework import status as http_status
import logging
import os
import requests
from addons.base.models import (BaseOAuthNodeSettings, BaseOAuthUserSettings,
BaseStorageAddon)
from boxsdk import Client, OAuth2
from boxsdk.exception import BoxAPIException
from django.db import ... |
"""
This module provides an abstraction for Module Stores that support Draft and Published branches.
"""
import threading
from abc import ABCMeta, abstractmethod
from contextlib import contextmanager
from . import ModuleStoreEnum, BulkOperationsMixin
# Things w/ these categories should never be marked as version=DRAF... |
"""
Base classes for Instance Messenger clients.
"""
from twisted.words.im.locals import OFFLINE, ONLINE, AWAY
class ContactsList:
"""A GUI object that displays a contacts list"""
def __init__(self, chatui):
"""
@param chatui: ???
@type chatui: L{ChatUI}
"""
self.chatu... |
import os
import shutil
import tempfile
from PIL import Image
from django.db.models import get_model
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from fancypages import test
PageType = get_model('fancypages', 'PageType')
FancyPage = get_model('fancypages', 'FancyPage'... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#external imports
import sys
import optparse
#internal imports
from subuserlib.classes.user import User
import subuserlib.resolve
import subuserlib.repository
import subuserlib.commandLineArguments
import subuserlib.profile
def parseCliArgs(sysargs):
usage = "usage: subuser... |
import os
import sys
import yaml
import traceback
import transaction
import json
from elasticsearch import Elasticsearch
if __name__ == "__main__":
test_name = "Add"
configpath = os.path.abspath('./edm.yml') if os.path.exists('./edm.yml') else sys.exit(1)
config=None
with open(configpath , 'r') as stream:
try... |
__date__ = "3 june 2010"
__author__ = '<EMAIL>'
class ParamCardWriter(object):
header = \
"""######################################################################\n""" + \
"""## PARAM_CARD AUTOMATICALY GENERATED BY THE UFO #####################\n""" + \
"""#######################################... |
from __future__ import absolute_import
import random
import datetime
import logging
from mmgen.data import murder
from mmgen.models import person
from mmgen.models import relationship
from mmgen.util.randomize import weighted_roll
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class Myste... |
from django.shortcuts import render
from django.http import Http404
from django.http import HttpResponse
from inventory.models import *
# Mobile Web UI
def index(request):
houses = House.objects.all()
return render(request, 'mobile_web/login/login.html', {
'houses': houses,
})
def map(request):
... |
from . import mail
from . import run
from . import line
from . import account
from . import partner
from . import policy
from . import company
from . import wizard
from . import report
from . import invoice |
from libcloud.common.base import ConnectionKey, BaseDriver
from libcloud.common.types import LibcloudError
__all__ = [
"Member",
"LoadBalancer",
"Driver",
"Algorithm"
]
class Member(object):
def __init__(self, id, ip, port, balancer=None, extra=None):
self.id = str(id) if id else None
... |
from . import test_account_followup
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sites', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Redirect',
fields=[
... |
from django import template
from django.contrib.admin.models import LogEntry
register = template.Library()
class AdminLogNode(template.Node):
def __init__(self, limit, varname, user):
self.limit, self.varname, self.user = limit, varname, user
def __repr__(self):
return "<GetAdminLog Node>"
... |
from networkx import DiGraph
import os
from xml.sax.saxutils import escape
from androguard.core.analysis import analysis
try :
from androguard.core.analysis.libsign.libsign import entropy
except ImportError :
import math
def entropy(data):
entropy = 0
if len(data) == 0 :
retu... |
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
ALLOWED_ORIGINS = ['http://localhost:4200']
Base = declarative_base()
engine = create_engine('mysql+pymysql://keepsafe:7k77xJuGeqZYu97gpFfS8xsheXYHGHjB@localhost/keepsafe_db')
class ... |
#!/usr/bin/python
# -*- coding: ascii -*-
from __future__ import print_function
from __future__ import print_function
__author__ = "@harvie Tomas Mudrunka"
#__email__ = ""
__name__ = _("Difference")
__version__ = "0.0.1"
import math
import os.path
import re
from CNC import CNC,Block
from ToolsPage import Plugin
fr... |
import bitcoin
from bitcoin import *
from i18n import _
from transaction import Transaction, is_extended_pubkey
from util import print_msg, InvalidPassword
class Account(object):
def __init__(self, v):
self.receiving_pubkeys = v.get('receiving', [])
self.change_pubkeys = v.get('change', [])... |
"""Tests for tensorflow.python.client.graph_util."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.core.framework import attr_value_pb2
from tensorflow.core.framework import graph_pb2
from tensorflow.core.framework impo... |
"""The template component."""
from itertools import chain
import logging
from homeassistant.const import MATCH_ALL
_LOGGER = logging.getLogger(__name__)
def initialise_templates(hass, templates, attribute_templates=None):
"""Initialise templates and attribute templates."""
if attribute_templates is None:
... |
data = (
'it', # 0x00
'ix', # 0x01
'i', # 0x02
'ip', # 0x03
'iet', # 0x04
'iex', # 0x05
'ie', # 0x06
'iep', # 0x07
'at', # 0x08
'ax', # 0x09
'a', # 0x0a
'ap', # 0x0b
'uox', # 0x0c
'uo', # 0x0d
'uop', # 0x0e
'ot', # 0x0f
'ox', # 0x10
'o', # 0x11
'op', # 0x12
'ex',... |
from struct import unpack, calcsize
import os
from geo.shapefile import ShapefileException, Array
from geo.shapefile.six import u, b, is_string
from geo.shapefile.shape import Shape
class Reader(object):
"""Reads the three files of a shapefile as a unit or
separately. If one of the three files (.shp, .shx,
... |
import os
import unittest
from telemetry.page import page
from telemetry.page import page_set
class TestPage(unittest.TestCase):
def assertPathEqual(self, path1, path2):
self.assertEqual(os.path.normpath(path1), os.path.normpath(path2))
def testFilePathRelative(self):
apage = page.Page('file://somedir/o... |
from __future__ import absolute_import
from pychron.entry.export.base_irradiation_exporter import BaseIrradiationExporter
class XMLIrradiationExporter(BaseIrradiationExporter):
"""
export irradiations from pychron database to an XML file
"""
# ============= EOF ========================================... |
import github.GithubObject
class RepositoryKey(github.GithubObject.CompletableGithubObject):
"""
This class represents RepositoryKeys. The reference can be found here http://developer.github.com/v3/repos/keys/
"""
def __init__(self, requester, headers, attributes, completed, repoUrl):
github.... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp.addons.website.models.website import slug
import pytz
class event_track_tag(osv.osv):
_name = "event.track.tag"
_order = 'name'
_columns = {
'name': fields.char('Event Track Tag', translate=True)
}
class ev... |
import sys
def setup(core, object):
object.setStringAttribute('faction_restriction', 'Imperial')
object.setIntAttribute('required_combat_level', 75)
object.setStringAttribute('armor_category', '@obj_attr_n:armor_battle')
object.setIntAttribute('cat_stat_mod_bonus.@stat_n:constitution_modified', 18)
object.setIntA... |
# -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
db.rename_column('user_account', 'user_id', 'person_id')
def backwards(self, orm):
db.rename_column('user_account', 'person_id', 'user_id')
mod... |
#!/usr/bin/python
#####################################################################
# Cloud Routes Availability Manager: Broker
# ------------------------------------------------------------------
# Description:
# ------------------------------------------------------------------
# This is a message broker for the ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
指定数据目录,生成对应的合约行业数据
分为两种
1. 全市场数据,将部分标记上权重
2. 只对历史上成为成份股的,进行处理,由于前面已经转换了数据,这里只要跳选数据并处理即可
"""
import os
import pandas as pd
from kquant_data.config import __CONFIG_H5_STK_WEIGHT_DIR__, __CONFIG_H5_STK_DIR__, __CONFIG_TDX_STK_DIR__, \
__CONFIG_H5_STK_DIVIDEND_DIR__
... |
"""Syntax highlighting module, based on the SilverCity module.
Get it at: http://silvercity.sourceforge.net/
"""
import re
from StringIO import StringIO
from genshi.core import Markup
from trac.core import *
from trac.config import ListOption
from trac.env import ISystemInfoProvider
from trac.mimeview.api import IH... |
from __future__ import absolute_import
import itertools
import lit.util
from lit.ShCommands import Command, Pipeline, Seq
class ShLexer:
def __init__(self, data, win32Escapes = False):
self.data = data
self.pos = 0
self.end = len(data)
self.win32Escapes = win32Escapes
def eat(... |
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import forms
from openstack_dashboard.dashboards.settings.password \
import forms as pass_forms
class PasswordView(forms.ModalFormView):
form_class = pass_forms.PasswordForm
form_id = "... |
import pytest
from .base import BaseTestFormgrade
@pytest.mark.js
@pytest.mark.usefixtures("bad_formgrader")
class TestAuthFailures(BaseTestFormgrade):
def test_start(self):
# This is just a fake test, since starting up the browser and formgrader
# can take a little while. So if anything goes wro... |
from __future__ import absolute_import, print_function
from numpy import ones, ndarray, array, asarray, concatenate, zeros, shape, \
alltrue, equal, divide, arccos, arcsin, arctan, cos, cosh, \
sin, sinh, exp, ceil, floor, fabs, log, log10, sqrt, argmin, \
argmax, argsort, around, absolute, ... |
from m5.params import *
from BaseCPU import BaseCPU
class O3Checker(BaseCPU):
type = 'O3Checker'
exitOnError = Param.Bool(False, "Exit on an error")
updateOnError = Param.Bool(False,
"Update the checker with the main CPU's state on an error")
warnOnlyOnLoadError = Param.Bool(False,
"If ... |
from __future__ import print_function
"""
Represents an SDB Domain
"""
from boto.sdb.queryresultset import SelectResultSet
from boto.compat import six
class Domain(object):
def __init__(self, connection=None, name=None):
self.connection = connection
self.name = name
self._metadata = None... |
"""
Creates the default Site object.
"""
from django.apps import apps as global_apps
from django.conf import settings
from django.core.management.color import no_style
from django.db import DEFAULT_DB_ALIAS, connections, router
def create_default_site(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS... |
import csv
import os
from operator import itemgetter
import py
import pytest
import yaml
from .pytest_store import store
from cfme.utils.conf import cfme_data
from cfme.utils.path import project_path
class MarkFromMap(object):
def __init__(self, mark_map):
self.mark_map = mark_map
def pytest_itemco... |
import sys
import traceback
import parse.link_parser
import parse.impl.zeit_title_parser
def is_interesting_url(url):
if url.rfind("?")>0:
return False
if "#comments" in url:
return False
if "#" in url:
return False
if "/201" not in url:
return False
return True
d... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
try:
import tower_cli
import tower_cli.utils.exceptions as exc
from tower_cli.conf import settings
from ansible.module_utils.ansible_tower import tower_auth_confi... |
from classes.LinkedList import *
# Iterative approch
def isPalindrome_iter(linkedlist):
if linkedlist.head == None:
return None
fast = linkedlist.head
slow = linkedlist.head
firsthalf = []
while fast != None and fast.next != None:
firsthalf.append(slow.value)
slow = slow.nex... |
import sys
import argparse
import os
import json
import numpy as np
import matplotlib.pylab as plt
def draw(obj, outfile):
groups, entities_per_group, features = (
obj['args']['groups'],
obj['args']['entities_per_group'],
obj['args']['features'],
)
results = obj['results']
res... |
from .mininode import *
from .script import CScript, OP_TRUE, OP_CHECKSIG
# Create a block (with regtest difficulty)
def create_block(hashprev, coinbase, nTime=None):
block = CBlock()
if nTime is None:
import time
block.nTime = int(time.time()+600)
else:
block.nTime = nTime
bloc... |
import logging
import random
from lxml import etree
from web_fragments.fragment import Fragment
from xblock.fields import Integer, Scope
from xmodule.seq_module import SequenceDescriptor
from xmodule.x_module import STUDENT_VIEW, XModule
log = logging.getLogger('edx.' + __name__)
class RandomizeFields(object):
... |
"""
Modified from
https://github.com/tensorflow/models/blob/master/tutorials/image/cifar10/cifar10.py
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import re
import sys
import glob
import random
import tensorflow as tf
import sres_input
f... |
from ctypes import *
#ctypes.cdll.LoadLibrary("libex.dylib")
chipmunk_lib = cdll.LoadLibrary("ex.dll")
#function_pointer = CFUNCTYPE
function_pointer = WINFUNCTYPE
float_type = c_double
cpFloat = c_double
class Vec2d(Structure):
__slots__ = ['x', 'y']
@classmethod
def from_param(cls... |
__version__ = '0.0.2'
from collections import OrderedDict, MutableMapping, MutableSequence, Sequence
from copy import deepcopy
sentinel = object()
class Error(Exception):
"""Base error"""
class Field:
name = None
def __init__(self, *, default=sentinel, const=False, maker=sentinel):
self.defa... |
#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2008 (ita)
"GLib2 support"
import Task, Utils
from TaskGen import taskgen, before, after, feature
#
# glib-genmarshal
#
@taskgen
def add_marshal_file(self, filename, prefix):
if not hasattr(self, 'marshal_list'):
self.marshal_list = []
self.meths.appe... |
# -*- coding: utf-8 -*-
import sys
import csv
import glob
# This lines increases the csv's line max size
csv.field_size_limit(sys.maxsize)
def readImagesFileNames(_path):
imagesList = []
imgL = glob.glob(_path)
for item in imgL:
item = item.split('/')
item = item[1].split('.')
it... |
#!/usr/bin/env python
# Example script which shows how to use the XenAPI to find a particular Host's management interface
# and send it a wake-on-LAN packet.
import subprocess, sys, socket, struct, time, syslog
import XenAPI, inventory
import XenAPIPlugin
class HOST_POWER_ON_NOT_CONFIGURED(Exception):
"""Base ... |
import os
from pact_test.either import *
from pact_test.config.config_builder import Config
from pact_test.runners.service_providers.test_suite import ServiceProviderTestSuiteRunner # nopep8
def test_empty_tests_list(monkeypatch):
config = Config()
config.provider_tests_path = os.path.join(os.getcwd(), 'tes... |
"""Command to disable billing."""
import textwrap
from googlecloudsdk.api_lib.billing import utils
from googlecloudsdk.calliope import base
class Unlink(base.Command):
"""Unlink the account (if any) linked with a project."""
detailed_help = {
'DESCRIPTION': textwrap.dedent(
"""
This com... |
# -*- coding: utf-8 -*-
from ..installer import utils
def filtered_hosts(config, exclude=True, dbhost=True):
"""
Returns list of hosts which need installation taking into account
CONFIG_MYSQL_INSTAL if parameter dbhost is True and EXCLUDE_SERVERS
if parameter exclude is True.
"""
exclset = se... |
from django.apps import apps
from django.contrib.gis.db.models.fields import GeometryField
from django.contrib.sitemaps import Sitemap
from django.core import urlresolvers
from django.db import models
class KMLSitemap(Sitemap):
"""
A minimal hook to produce KML sitemaps.
"""
geo_format = 'kml'
de... |
from __future__ import unicode_literals
import frappe
from frappe import _
import frappe.model
import frappe.utils
import json, os
@frappe.whitelist()
def get_list(doctype, fields=None, filters=None, order_by=None,
limit_start=None, limit_page_length=20):
return frappe.get_list(doctype, fields=fields, filters=filter... |
"""Tests for kernel_estimators."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib import layers
from tensorflow.contrib.kernel_methods.python import kernel_estimators
from tensorflow.contrib.kernel_methods.python... |
# -*- coding: utf-8 -*-
import functools
from openerp import exceptions
from openerp.tests import common
def noid(d):
""" Removes values that are not relevant for the test comparisons """
d.pop('id', None)
d.pop('action_id', None)
return d
class FiltersCase(common.TransactionCase):
def build(self... |
"""Code generator for Ozone platform list.
This script takes as arguments a list of platform names and generates a C++
source file containing a list of those platforms.
Each platform gets an integer identifier that is used to find objects for that
platform (particularly constructors for platform-specific objects).
E... |
#!/usr/bin/env python
from __future__ import division
__author__ = "Justin Kuczynski"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["Justin Kuczynski"]
__license__ = "GPL"
__version__ = "1.8.0-dev"
__maintainer__ = "Justin Kuczynski"
__email__ = "<EMAIL>"
"""takes a tree and bootstrap support file... |
"""Tests for tensorflow.tools.dist_test.scripts.k8s_tensorflow_lib."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.platform import googletest
from tensorflow.tools.dist_test.scripts import k8s_tensorflow_lib
class K8sTensorflowT... |
"""Tests for window_utils"""
import socket
import sys
import test.support
import unittest
from test.support import IPV6_ENABLED
from unittest import mock
if sys.platform != 'win32':
raise unittest.SkipTest('Windows only')
import _winapi
from asyncio import windows_utils
from asyncio import _overlapped
class W... |
import WebIDL
def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
interface SpecialMethodUniqueness1 {
getter deleter boolean (DOMString name);
getter boolean (DOMString name);
};
""")
results = parser.finish()
ex... |
import logging
from django.template import defaultfilters as filters
from django.utils.translation import ugettext_lazy as _
from horizon import tables
LOG = logging.getLogger(__name__)
class PluginsTable(tables.DataTable):
title = tables.Column("title",
verbose_name=_("Title"),
... |
"""Generates IDL file Omaha3 internfaces."""
import commands
import getopt
import os
import sys
def _GetStatusOutput(cmd):
"""Return (status, output) of executing cmd in a shell."""
if os.name == "nt":
pipe = os.popen(cmd + " 2>&1", "r")
text = pipe.read()
sts = pipe.close()
if sts is None: sts =... |
# coding: utf-8
from pandas.msgpack import packb, unpackb, ExtType
def test_str8():
header = b'\xd9'
data = b'x' * 32
b = packb(data.decode(), use_bin_type=True)
assert len(b) == len(data) + 2
assert b[0:2] == header + b'\x20'
assert b[2:] == data
assert unpackb(b) == data
data = b'x... |
# -*- coding: utf-8 -*-
"""
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 program is distributed in... |
import logging
from collections import defaultdict
from androguard.decompiler.dad.basic_blocks import (build_node_from_block,
StatementBlock, CondBlock)
from androguard.decompiler.dad.util import get_type
from androguard.decompiler.dad.instruction import Variable
log... |
import os
# toolchains options
ARCH='arm'
CPU='i.mx6'
CROSS_TOOL='gcc'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
# EXEC_PATH = r'/opt/arm-2012.09/bin'
EXEC_PATH = '/opt/gcc-arm-none-eabi-4_8-2014q1_gri/bin'
elif CROSS_TOOL == 'keil':
PL... |
"""The Geometric distribution class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from te... |
from oslo_utils import excutils
from sahara.tests.integration.tests import base
class ScalingTest(base.ITestCase):
def _change_node_info_while_ng_adding(self, ngt_id, count, cluster_info):
cluster_info['node_info']['node_count'] += count
node_processes = self.sahara.node_group_templates.get(
... |
"""
Import related utilities and helper functions.
"""
import sys
import traceback
def import_class(import_str):
"""Returns a class from a string including module and class"""
mod_str, _sep, class_str = import_str.rpartition('.')
try:
__import__(mod_str)
return getattr(sys.modules[mod_str... |
import errno
import re
import os
import sys
import subprocess
# Note that gcc uses unicode, which may depend on the locale. TODO:
# force LANG to be set to en_US.UTF-8 to get consistent warnings.
allowed_warnings = set([
"alignment.c:720",
"async.c:122",
"async.c:270",
"dir.c:43",
"dm.c:1053",
... |
# -*- coding: utf-8 -*-
"""
(c) 2014-2016 - Copyright Red Hat Inc
Authors:
Pierre-Yves Chibon <<EMAIL>>
"""
from __future__ import unicode_literals, absolute_import
import sqlalchemy as sa
import pygit2
import wtforms
try:
from flask_wtf import FlaskForm
except ImportError:
from flask_wtf import Form... |
import argparse
import sys
from ros_buildfarm.argument import add_argument_arch
from ros_buildfarm.argument import add_argument_build_name
from ros_buildfarm.argument import add_argument_config_url
from ros_buildfarm.argument import add_argument_os_code_name
from ros_buildfarm.argument import add_argument_os_name
from... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.tests import unittest
from ansible.parsing.yaml.objects import AnsibleBaseYAMLObject
from ansible.errors import AnsibleError
from ansible.compat.tests import BUILTINS
from ansible.compat.tests.mock import mock... |
from cinder.api import common
from cinder import exception
from cinder.i18n import _
def get_manageable_resources(req, is_detail, function_get_manageable,
view_builder):
context = req.environ['cinder.context']
params = req.params.copy()
host = params.get('host')
if host is... |
"""
Application factory.
Use to return a flask app configured.
"""
import os
import logging
logging.debug('init because of salt') # noqa
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
from flask_socketio import SocketIO
from flask_principal import Principal
from flasgger... |
import mock
import netaddr
from oslo_config import cfg
import webob
from nova.api.openstack.compute.contrib import floating_ips_bulk as fipbulk_v2
from nova.api.openstack.compute.plugins.v3 import floating_ips_bulk as\
fipbulk_v21
from nova import context
from nova... |
import ctypes
import struct
import windows.alpc as alpc
import windows.com
import windows.generated_def as gdef
if windows.pycompat.is_py3:
buffer = bytes
KNOW_REQUEST_TYPE = gdef.FlagMapper(gdef.RPC_REQUEST_TYPE_CALL, gdef.RPC_REQUEST_TYPE_BIND)
KNOW_RESPONSE_TYPE = gdef.FlagMapper(gdef.RPC_RESPONSE_TYPE_FAIL,... |
from .base import * # flake8: noqa
DEBUG = env.bool('DJANGO_DEBUG_NEW', default=False)
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
SECRET_KEY = env('DJANGO_SECRET_KEY')
# Compress static files offline
# http://django-compressor.readthedocs.org/en/latest/settings/#django.conf.settings.COMPRESS_OFFLINE
COMPRESS_OFFLI... |
from enigma import *
from Plugins.Plugin import PluginDescriptor
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from Components.MenuList import MenuList
from Components.GUIComponent import GUIComponent
from Components.HTMLComponent import HTMLComponent
from Tools.Directories import fileExi... |
import os
import sys
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
from webdriver import exceptions
class NaturalNonVisibleElementsTest(base_test.WebDriverBaseTest):
def test_0x0_pixel_element_is_not_visible(self):
self.driver.get(self.webserver.whe... |
"""Tests for clif.pybind11.staging.variables.
This file is a copy of clif/testing/python/variables_test.py.
"""
import unittest
from clif.pybind11.staging import variables
class VariableTest(unittest.TestCase):
def test_const_int(self):
self.assertEqual(variables.kMyConstInt, 42)
def test_const_int_renam... |
from __future__ import absolute_import
from . import cache_util
from . import shell
@cache_util.cached
def find(tool, sdk=None, toolchain=None):
"""
Return the path for the given tool, according to `xcrun --find`, using
the given sdk and toolchain.
If `xcrun --find` cannot find the tool, return None... |
# -*- coding: utf-8 -*-
"""
oauthlib.utils
~~~~~~~~~~~~~~
This module contains utility methods used by various parts of the OAuth
spec.
"""
from __future__ import absolute_import, unicode_literals
from oauthlib.common import quote, unicode_type, unquote
try:
import urllib2
except ImportError:
import urllib.r... |
"""
Tests for Deferred handling by L{twisted.trial.unittest.TestCase}.
"""
from __future__ import division, absolute_import
from twisted.trial import unittest
from twisted.internet import defer, threads, reactor
from twisted.trial.util import suppress as SUPPRESS
from twisted.python.util import runWithWarningsSuppres... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.