code stringlengths 1 199k |
|---|
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, cstr
from frappe import _
from erpnext.stock.doctype.item.item import get_last_purchase_details
from erpnext.controllers.buying_controller import BuyingController
class PurchaseCommon(BuyingController):
def update_last_purchase_rate(se... |
from django.db import migrations, models
def populate_id_verification_aggregate(apps, schema_editor):
"""
The code from this migration was removed because it caused a spike in database errors
when it was run in the edX production environment. More details can be found here:
https://openedx.atlassian.net... |
from openerp.tests.common import SavepointCase
class TestStockPickingBackorderToSale(SavepointCase):
@classmethod
def setUpClass(cls):
super(TestStockPickingBackorderToSale, cls).setUpClass()
cls.pricelist = cls.env.ref('product.list0')
cls.category = cls.env['product.category'].create({... |
"""
Platform plugins to support the course experience.
This includes any locally defined CourseTools.
"""
from django.urls import reverse
from django.utils.translation import ugettext as _
from lms.djangoapps.courseware.courses import get_course_by_id
from student.models import CourseEnrollment
from . import SHOW_REVIE... |
'''
parse a MAVLink protocol XML file and generate a python implementation
Copyright Andrew Tridgell 2011
Released under GNU GPL version 3 or later
'''
import sys, textwrap, os
import mavparse, mavtemplate
t = mavtemplate.MAVTemplate()
def generate_preamble(outf, msgs, args, xml):
print("Generating preamble")
t... |
__author__ = 'osboxes' |
import json
class SaveableWidget(object):
'''
Inherited by widgets that want to save and restore settings.
Implement vqGetSaveState/vqSetSaveState.
'''
def vqSaveState(self, settings, name):
state = self.vqGetSaveState()
settings.setValue(name, json.dumps(state))
def vqRestoreSta... |
from oslo.config import cfg
import testtools
from testtools import matchers
from neutron.common import exceptions as exc
from neutron.db import api as db
from neutron.plugins.common import constants as p_const
from neutron.plugins.ml2 import driver_api as api
from neutron.plugins.ml2.drivers import type_vxlan
from neut... |
import math
class Histogram:
"""Represents a Histogram chart."""
def __init__(self, data, number_of_bins, method=None, key=None):
"""Initialize a Histogram object
:param data: a list of numbers
:param number_of_bins: an integer
:param description: a string
:param key: a s... |
from django.test import TestCase
from django.conf import settings
from restclients.r25.spaces import get_space_by_id, get_spaces
from restclients.exceptions import DataFailureException
class R25TestSpaces(TestCase):
def test_space_by_id(self):
with self.settings(
RESTCLIENTS_R25_DAO_CLASS='r... |
from temboo.Library.Fitbit.Sleep.DeleteSleepLog import DeleteSleepLog, DeleteSleepLogInputSet, DeleteSleepLogResultSet, DeleteSleepLogChoreographyExecution
from temboo.Library.Fitbit.Sleep.GetSleep import GetSleep, GetSleepInputSet, GetSleepResultSet, GetSleepChoreographyExecution
from temboo.Library.Fitbit.Sleep.LogSl... |
"""Automatically generated by hassfest.
To update, run python3 -m script.hassfest
"""
SSDP = {
"arcam_fmj": [
{
"deviceType": "urn:schemas-upnp-org:device:MediaRenderer:1",
"manufacturer": "ARCAM"
}
],
"axis": [
{
"manufacturer": "AXIS"
}
... |
"""Tests for warm_starting_util with Distribution Strategy.
These tests are located here instead of as part of `WarmStartingUtilTest`
because they need access to distribution strategies which are only present in
contrib right now.
TODO(priyag): Move the tests to core `WarmStartingUtilTest` when distribution
strategy mo... |
from __future__ import print_function, absolute_import
import inspect
import re
from collections import Mapping, defaultdict
import textwrap
from contextlib import closing
from numba.io_support import StringIO
from numba import ir
import numba.dispatcher
import os
import sys
try:
from collections import OrderedDict... |
from django import forms
from tower import ugettext_lazy as _lazy
import mkt
from mkt.constants import (CATEGORY_CHOICES, CATEGORY_CHOICES_DICT,
CATEGORY_REDIRECTS, TARAKO_CATEGORIES_MAPPING,
TARAKO_CATEGORY_CHOICES)
from mkt.constants.applications import DEVICE_LOO... |
"""
Regression tests for Model inheritance behavior.
"""
from __future__ import unicode_literals
import datetime
from operator import attrgetter
from unittest import expectedFailure
from django import forms
from django.test import TestCase
from .models import (Place, Restaurant, ItalianRestaurant, ParkingLot,
Parki... |
"""
Add country to heartbeat Answer table.
"""
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('heartbeat', '0008_auto_20150305_1442'),
]
operations = [
migrations.AddField(
model_name='answ... |
"""
=========
Constants
=========
A simple list of important constants in CGS units
"""
hplanck = h = 6.626068e-27 # Planck's Constant (erg s)
k = kb = kB = 1.3806503e-16 # Boltzmann's Constant (erg / K)
G = 6.67300e-8 # Newton's constant (cm^3 g^-1 s^-2)
c = 2.99792458e10 # Speed of Lig... |
import getopt, sys, string
import xmlrpclib
command = "status"
device = ''
volume = 50
uri = ''
id = 1000
arguments = {}
try:
optlist, args = getopt.getopt( sys.argv[1:], "c:d:i:v:u:", ['command=', 'device=', 'id=', 'volume=', 'uri='])
except getopt.GetoptError:
print "falsche parameter"
sys.exit(1)
for opt... |
"""Plugin which generates HTML pages for each image.
Currently this plugin can be used only with the colorbox theme, the other
themes have to be adapted.
For themes, the ``previous_media`` and ``next_media`` variables contain the
previous/next :class:`~sigal.gallery.Media` objects.
"""
import codecs
import logging
impo... |
"""
unit test for the test functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2009 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from jinja2 import Environment, Markup
env = Environment()
DEFINED = '''{{ missing is defined }}|{{ true is defined }}'''
EVEN = '''{{ 1 is even ... |
from math import radians
from OpenGL.GL import *
from OpenGL.GLU import *
import pygame
from pygame.locals import *
SCREEN_SIZE = (800, 600)
def resize(width, height):
glViewport(0, 0, width, height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(60.0, float(width)/height, .1, 1000.)
gl... |
import gtk, os.path
from gourmet import gglobals
from gourmet import cb_extras as cb
from gourmet import dialog_extras as de
from gourmet.gdebug import debug
from gettext import gettext as _
class DatabaseChooser:
"""This is a simple interface for getting database information from the user."""
def __init__ (sel... |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
_sym_db = _sym... |
"""
Copyright (C) 2010 Dariusz Suchojad <dsuch at zato.io>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from zato.common import SCHEDULER
from zato.common.util import decrypt
SSL_KEY_FILE = './config/rep... |
import pytest
from pages.firefox.welcome.page10 import FirefoxWelcomePage10
@pytest.mark.skip_if_not_firefox(reason="Welcome pages are shown to Firefox only.")
@pytest.mark.nondestructive
def test_vpn_button_displayed(base_url, selenium):
page = FirefoxWelcomePage10(selenium, base_url).open()
assert page.is_get... |
import unittest
import sys
import os.path
import mozunit
from mozbuild.preprocessor import Expression, Context
class TestContext(unittest.TestCase):
"""
Unit tests for the Context class
"""
def setUp(self):
self.c = Context()
self.c['FAIL'] = 'PASS'
def test_string_literal(self):
"""test string li... |
from spack import *
class AlsaLib(AutotoolsPackage):
"""The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI
functionality to the Linux operating system. alsa-lib contains the user
space library that developers compile ALSA applications against."""
homepage = "https://www.alsa-project.or... |
"""Simple example that demonstrates how to use a GtkSizeGroup.
In this case we'll have two labels and two entries.
The labels have different width, but we'd like to have the entries
aligned vertically. We can accomplish this by adding a horizontal
sizegroup to the labels.
"""
import pygtk
pygtk.require('2.0')
import gt... |
from test.support import run_unittest, run_doctest, check_warnings
import unittest
from http import cookies
import warnings
class CookieTests(unittest.TestCase):
def setUp(self):
self._warnings_manager = check_warnings()
self._warnings_manager.__enter__()
warnings.filterwarnings("ignore", ".... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
from OpenGL.raw.GLES1 import _types as _cs
from OpenGL.raw.GLES1._types import *
from OpenGL.raw.GLES1 import _errors
from OpenGL.constant import Constant as _C
import ctypes
_EXTENSION_NAME = 'GLES1_ARM_rgba8'
def _f( fu... |
"""Test for the BigQuery side input example."""
from __future__ import absolute_import
import logging
import unittest
import apache_beam as beam
from apache_beam.examples.cookbook import bigquery_side_input
from apache_beam.testing.test_pipeline import TestPipeline
from apache_beam.testing.util import assert_that
from ... |
import time
from ikalog.inputs import CVCapture
from ikalog.engine import IkaEngine
from ikalog import outputs
from ikalog.utils import *
class IkaRename:
def createMP4Filename(self, context):
map = IkaUtils.map2text(context['game']['map'], unknown='マップ不明')
rule = IkaUtils.rule2text(context['game'][... |
"""Benchmarks using custom training loop on MNIST dataset."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import timeit
import numpy as np
import tensorflow as tf
from tensorflow.python.keras.benchmarks import distribution_util
class CustomMnistBenchmark(... |
import json
import math
import multiprocessing
import optparse
import os
from os.path import join
import random
import shlex
import subprocess
import sys
import time
from testrunner.local import execution
from testrunner.local import progress
from testrunner.local import testsuite
from testrunner.local import utils
fro... |
from __future__ import division
import os
import time
from collections import defaultdict
try:
import cPickle as pickle
except ImportError:
import pickle
import pytest
from mapproxy.seed.seeder import TileWalker, SeedTask, SeedProgress
from mapproxy.cache.dummy import DummyLocker
from mapproxy.cache.tile import... |
import fileinput, re, os, sys, operator
preamble = '''// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/l... |
"""Support for openSenseMap Air Quality data."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.air_quality import (
PLATFORM_SCHEMA, AirQualityEntity)
from homeassistant.const import CONF_NAME
from homeassistant.helpers.aiohttp_client import async_get_clientses... |
"""Python layer for image_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.image.ops import gen_image_ops
from tensorflow.contrib.util import loader
from tensorflow.python.framework import common_shapes
from tensorflow.python.fr... |
import mock
from rally.plugins.openstack.context.sahara import sahara_job_binaries
from tests.unit import test
CTX = "rally.plugins.openstack.context.sahara"
class SaharaJobBinariesTestCase(test.ScenarioTestCase):
def setUp(self):
super(SaharaJobBinariesTestCase, self).setUp()
self.tenants_num = 2
... |
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 model 'Playlist'
db.create_table('gadget_playlist', (
('id', self.gf('django.db.models.fields.AutoField')(primary_... |
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('interfaces', parent_package, top_path)
config.add_subpackage('afni')
config.add_subpackage('ants')
config.add_subpackage('camino')
config.add_subpackage('camino2trackv... |
DOCUMENTATION = '''
---
module: ec2_ami_search
short_description: Retrieve AWS AMI information for a given operating system.
deprecated: "in favor of the ec2_ami_find module"
version_added: "1.6"
description:
- Look up the most recent AMI on AWS for a given operating system.
- Returns C(ami), C(aki), C(ari), C(seri... |
""" This test ensure `inherit_id` update is correctly replicated on cow views.
The view receiving the `inherit_id` update is either:
1. in a module loaded before `website`. In that case, `website` code is not
loaded yet, so we store the updates to replay the changes on the cow views
once `website` module is loade... |
from django.shortcuts import render
from pootle.core.decorators import get_path_obj, permission_required
from pootle_app.views.admin import util
from pootle_store.models import Store, Unit
from .forms import term_unit_form_factory
def get_terminology_filename(translation_project):
try:
# See if a terminolog... |
"""Replacement authentication decorators that work around redirection loops"""
from __future__ import absolute_import
from __future__ import unicode_literals
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps
from django.contrib.auth import REDIRECT_FIELD_NAME
from dj... |
"""
Tests for the recently enrolled messaging within the Dashboard.
"""
import datetime
import unittest
import ddt
from django.conf import settings
from django.urls import reverse
from django.utils.timezone import now
from nose.plugins.attrib import attr
from opaque_keys.edx import locator
from pytz import UTC
from com... |
import subprocess
import socket
import ssl
import sys
import time
if sys.version < '2.7':
print("WARNING: SSL not supported on Python 2.6")
exit(0)
import inspect, os, sys
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
if cmd_sub... |
"""Support for BH1750 light sensor."""
from functools import partial
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
import homeassistant.helpers.config_validation as cv
from homeassistant.const import CONF_NAME, DEVICE_CLASS_ILLUMINANCE
from homeassistant.helpers.ent... |
"""base class for anything that connects to helix"""
import partition
from helixexceptions import HelixException
class ResourceGroup(object):
"""Object to deal with resource groups"""
def __init__(self, name, count, replicas, statemode, data):
super(ResourceGroup, self).__init__()
self.name = na... |
"""
Base and utility classes for tseries type pandas objects.
"""
from datetime import datetime, timedelta
from pandas import compat
from pandas.compat.numpy import function as nv
import numpy as np
from pandas.types.common import (is_integer, is_float,
is_bool_dtype, _ensure_int64,
... |
import os
from os import path
from itertools import chain
from webassets import six
from webassets.six.moves import map
from webassets.six.moves import zip
from webassets.utils import is_url
try:
import glob2 as glob
from glob import has_magic
except ImportError:
import glob
from glob import has_magic
f... |
"""Client for interacting with the Reauth HTTP API.
This module provides the ability to do the following with the API:
1. Get a list of challenges needed to obtain additional authorization.
2. Send the result of the challenge to obtain a rapt token.
3. A modified version of the standard OAuth2.0 refresh grant that take... |
"""stats_kit package driver file.
Inserts the following modules in sys.modules: stats.
@author: Charl P. Botha <http://cpbotha.net/>
"""
import sys
VERSION = 'Strangman - May 10, 2002'
def init(theModuleManager, pre_import=True):
# import the main module itself
global stats
import stats
# if we don't do... |
import stringmanipulation
import filemanagement
import sys
extensions = ['.h']
ignore_these = ['my_ignore_header.h']
if((len(sys.argv) != 2) and (len(sys.argv) != 3)):
print 'parameters are: directory [--commit]'
quit()
directory = sys.argv[1];
if(not filemanagement.pathexist(directory)):
print 'path ' + di... |
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(833, 568)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.se... |
import GemRB
from ie_restype import *
from AutodetectCommon import CheckFiles
files = (
("START", "CHU", RES_CHU),
("STARTPOS", "2DA", RES_2DA),
("STARTARE", "2DA", RES_2DA),
("EXPTABLE", "2DA", RES_2DA),
("MUSIC", "2DA", RES_2DA),
("CHMB1A1", "BAM", RES_BAM),
("TRACKING", "2DA", RES_2DA),
... |
import pytest
from utils import safe_string
@pytest.mark.parametrize("source, result", [
(u'\u25cf', '●'),
(u'ěšč', 'ěšč'),
(u'взорваться', 'взорваться'),
(4, '4')],
ids=['ugly_nonunicode_character', 'latin_diacritics',... |
from fpdf import FPDF
import sys
pdf = FPDF()
pdf.add_page()
pdf.add_font('DejaVu','','DejaVuSansCondensed.ttf',uni=True)
pdf.set_font('DejaVu','',14)
fn = 'ex.pdf'
txt = open('HelloWorld.txt').read()
pdf.write(8, txt)
pdf.set_font('Arial','',14)
pdf.ln(10)
pdf.write(5, 'The file size of this PDF is only 12 KB.')
pdf.o... |
def should_run(active_plugins, migrate_plugins):
if '*' in migrate_plugins:
return True
else:
return set(active_plugins) & set(migrate_plugins) |
"""Tests for dense_features_v2."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.client import session
from tensorflow.python.eager import backprop
from tensorflow.python.eager import context
from tensorflow.python.... |
"""
***
Modified generic daemon class
***
Author: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
www.boxedice.com
www.datadoghq.com
License: http://creativecommons.org/licenses/by-sa/3.0/
"""
import atexit
import errno
import loggin... |
"""Runs an exe through Valgrind and puts the intermediate files in a
directory.
"""
import datetime
import glob
import logging
import optparse
import os
import re
import shutil
import stat
import subprocess
import sys
import tempfile
import common
import drmemory_analyze
import memcheck_analyze
import tsan_analyze
clas... |
'''
MOSSE tracking sample
This sample implements correlation-based tracking approach, described in [1].
Usage:
mosse.py [--pause] [<video source>]
--pause - Start with playback paused at the first video frame.
Useful for tracking target selection.
Draw rectangles around objects with a mouse to tra... |
''' The resources module provides the Resources class for easily configuring
how BokehJS code and CSS resources should be located, loaded, and embedded in
Bokeh documents.
Also provides some pre-configured Resources objects:
Attributes:
CDN : load minified BokehJS from CDN
INLINE : provide minified BokehJS from... |
"""
Kay framework dbutils module.
:Copyright: (c) 2009 Takashi Matsuo <tmatsuo@candit.jp> All rights reserved.
:license: BSD, see LICENSE for more details.
"""
from google.appengine.ext import db
from google.appengine.datastore import entity_pb
import datetime
import time
SIMPLE_TYPES = (int, long, float, bool, dict, b... |
"""Suite Standard Suite: Common terms for most applications
Level 1, version 1
Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5
AETE/AEUT resource version 1/0, language 0, script 0
"""
import aetools
import MacOS
_code = 'CoRe'
from StdSuites.St... |
import sys
import traceback
from math import sin,cos
from interpreter import *
from emccanon import MESSAGE
from util import lineno, call_pydevd
throw_exceptions = 1 # raises InterpreterException if execute() or read() fail
def g886(self, **words):
for key in words:
MESSAGE("word '%s' = %f" % (key, words[ke... |
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class AssetMaintenanceTask(Document):
pass |
"""
tipfy.config
~~~~~~~~~~~~
Configuration object.
:copyright: 2011 by tipfy.org.
:license: BSD, see LICENSE.txt for more details.
"""
from werkzeug import import_string
__all__ = [
'DEFAULT_VALUE', 'REQUIRED_VALUE',
]
DEFAULT_VALUE = object()
REQUIRED_VALUE = object()
class Config(dict):
"... |
import unittest, time, sys, random
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_rf
def write_syn_dataset(csvPathname, rowCount, colCount, headerData):
dsf = open(csvPathname, "w+")
# output is just 0 or 1 randomly
dsf.write(headerData + "\n")
# ... |
import re, os, datetime, cPickle,logging
from django.test import TestCase
from django.test.client import Client
from django.conf import settings
from simple.management.commands import parse_knesset_bill_pdf
from simple.management.commands.parse_government_bill_pdf import pdftools
from simple.management.commands.parse_l... |
from __future__ import print_function
import argparse
import csv
import datetime
import errno
import json
import multiprocessing
import os
import platform
import re
import shutil
import subprocess
import sys
import traceback
DESCRIPTION = (
"""Tool to download and aggregate traces from a given Pinpoint job.
The too... |
import sys
from pack_currenttypes import *
import apiutil
apiutil.CopyrightC()
print '''
typedef void (*convert_func) (GLfloat *, const unsigned char *);
'''
import convert
for k in current_fns.keys():
name = k
name = '%s%s' % (k[:1].lower(),k[1:])
ucname = k.upper()
num_members = len(current_fns[k]['default']) + 1... |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... |
import collections
import functools
from itertools import ifilterfalse
from heapq import nsmallest
from operator import itemgetter
class Counter(dict):
'Mapping where default values are zero'
@staticmethod
def __missing__(key):
return 0
def lru_cache(maxsize=100):
'''Least-recently-used cache de... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: nxos_acl_interface
version_added: "2.2"
short_description: Manages applying ACLs to interfaces.
description:
- Manages applying ACLs to interfaces.
author... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: nxos_interface_ospf
version_added: "2.2"
short_description: Manages configuration of an OSPF interface instance.
description:
- Manages configuration of a... |
UI_SPATH = "https://cloudcaptive-userinfuser.appspot.com/api/"
UI_PATH = "http://cloudcaptive-userinfuser.appspot.com/api/"
LOCAL_TEST = "http://localhost:8080/api/"
API_VER = "1"
VALID_WIDGETS = ["trophy_case", "milestones", "notifier", "points", "rank", "availablebadges", "leaderboard"]
UPDATE_USER_PATH = "updateuser... |
from errbot import BotPlugin
from queue import Queue
import logging
log = logging.getLogger(__name__)
class RoomTest(BotPlugin):
def activate(self):
super().activate()
self.purge()
def callback_room_joined(self, room):
log.info("join")
self.events.put("callback_room_joined {!s}".... |
import sys
import argparse
import textwrap
import re
parser = argparse.ArgumentParser(description=textwrap.dedent("""
Takes an input SIL fragment and changes all SSA variables into FileCheck
variables.
"""))
parser.add_argument('input', type=argparse.FileType('r'),
help='Input file. \'-\' for stdin.... |
import datetime
from oslo.config import cfg
import webob.exc
from nova.api.openstack import extensions
from nova import compute
from nova.openstack.common.gettextutils import _
from nova import utils
CONF = cfg.CONF
CONF.import_opt('compute_topic', 'nova.compute.rpcapi')
authorize = extensions.extension_authorizer('com... |
import logging
import pytest
import os
from subprocess import call
from tests.common.test_vector import *
from tests.common.test_dimensions import *
from tests.common.impala_test_suite import ImpalaTestSuite
from tests.common.impala_cluster import ImpalaCluster
from tests.beeswax.impala_beeswax import ImpalaBeeswaxExce... |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2011 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
import base64
from sleekxmpp.util import bytes
from sleekxmpp.xmlstream import StanzaBase
class Success(StanzaBase):
"""
"""
name = 's... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: xattr
version_added: "1.3"
short_description: Manage us... |
"""
Code relating to interfaces and policies.
To run a program, the following steps are typical:
1. Create some L{requirements.Requirements}, giving the root interface's URI.
2. Instantiate a L{driver.Driver}, giving it the requirements
3. Ask the driver to choose a set of implementations.
1. The driver will try ... |
"""Tests for convolution related functionality in tensorflow.ops.nn."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
from tensorflow.python.client ... |
"File-based cache backend"
import os
import time
import shutil
try:
import cPickle as pickle
except ImportError:
import pickle
from django.core.cache.backends.base import BaseCache
from django.utils.hashcompat import md5_constructor
class CacheClass(BaseCache):
def __init__(self, dir, params):
BaseC... |
"""
Monitor the jobs present in the repository
"""
__RCSID__ = "$Id$"
import DIRAC
from DIRAC.Core.Base import Script
import os, sys
Script.setUsageMessage( '\n'.join( [ __doc__.split( '\n' )[1],
'Usage:',
' %s [option|cfgfile] ... RepoDir' % ... |
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
_count = 0
import time, cStringIO
from Queue import Queue, Empty
from calibre import prints
from calibre.constants import DEBUG
class BaseJob(object):
WAITI... |
"""This script fixes links like href="/Arch_Wall" into href="/Arch_Wall.html" where needed. Dirty hack, downloadwiki.py should be fixed instead"""
import os,re
files = [f for f in os.listdir("localwiki") if f.endswith(".html")]
for fn in files:
f = open(os.path.join("localwiki",fn))
b = f.read()
f.close()
... |
from django.test import TestCase
from django.conf import settings
from django.contrib.contenttypes.generic import generic_inlineformset_factory
from models import Episode, EpisodeExtra, EpisodeMaxNum, EpisodeExclude, \
Media, EpisodePermanent, MediaPermanentInline
class GenericAdminViewTest(TestCase)... |
"""
Report from a cobbler master.
FIXME: reinstante functionality for 2.0
Copyright 2007-2009, Red Hat, Inc and Others
Anderson Silva <ansilva@redhat.com>
Michael DeHaan <michael.dehaan AT gmail>
This software may be freely redistributed under the terms of the GNU
general public license.
You should have received a copy... |
from __future__ import unicode_literals
from frappe.model.document import Document
class ItemBarcode(Document):
pass |
import os
import datetime
import collections
import tabulate
from modularodm import Q
from dateutil.relativedelta import relativedelta
from framework.analytics import get_basic_counters
from website import settings
from website.app import init_app
from website.models import User, Node, PrivateLink
from website.addons.d... |
import sys
import pickle
import unittest
from dpark.task import *
from dpark.schedule import *
from dpark.env import env
from dpark.context import parse_options
class MockDriver:
def __init__(self):
self.tasks = []
def reviveOffers(self):
pass
def launchTasks(self, oid, tasks):
self.... |
from __future__ import with_statement
import threading
import time
from whoosh.store import LockError
from whoosh.util import abstractmethod, synchronized
class IndexingError(Exception):
pass
class IndexWriter(object):
"""High-level object for writing to an index.
To get a writer for a particular index, cal... |
class Root(object):
def allowChildType(self, t):
return t in [Runner, Ticker, ]
StrategySchema = Root
class Runner(object):
""" Runners describe when to execute the Callables they contain.
The Strategy class turns Runner descriptions into various types of
callable code; it does the work of impor... |
import socket
import os
import sys
def tcp_connect_or_die(sock_addr):
"""
@param sock_addr: (host, port) to connect to
@type sock_addr: tuple
@returns: socket or exits
"""
s = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect(sock_addr)
except socket.error, err:
... |
from . import l10n_fr
from . import account_chart_template
from . import res_company |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.