content stringlengths 4 20k |
|---|
""" Modules dependency graph. """
import os, sys, imp
from os.path import join as opj
import itertools
import zipimport
import openerp
import openerp.osv as osv
import openerp.tools as tools
import openerp.tools.osutil as osutil
from openerp.tools.safe_eval import safe_eval as eval
from openerp.tools.translate impor... |
from unittest import TestCase
from mock import patch
from gofer import Options
from gofer.proxy import Agent
from gofer.rmi.container import Container
class TestProxy(TestCase):
def test_init(self):
url = 'qpid+amqp://host'
address = 'xyz'
options = {'A': 1, 'B': 2}
_agent = Age... |
{
'name' : 'Accounting and Finance',
'version' : '1.1',
'author' : 'OpenERP SA',
'category': 'Accounting & Finance',
'sequence': 10,
'summary': 'Financial and Analytic Accounting',
'description': """
Accounting Access Rights
========================
It gives the Administrator user access to ... |
from openerp import models, fields
class ProjectProject(models.Model):
_inherit = 'project.project'
automatic_creation = fields.Boolean('Automatic Creation') |
"""The Gamma 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 tenso... |
import os
from setuptools import setup, find_packages
import librarian_football as pkg
def read(fname):
""" Return content of specified file """
return open(os.path.join(os.path.dirname(__file__), fname)).read()
VERSION = pkg.__version__
setup(
name='librarian-football',
version=VERSION,
licen... |
# $HeadURL$
__RCSID__ = "$Id$"
from DIRAC.Core.Utilities import Network, List
from DIRAC.ConfigurationSystem.Client.ConfigurationData import gConfigurationData
from DIRAC.ConfigurationSystem.Client import PathFinder
from DIRAC.Core.DISET.private.Protocols import gDefaultProtocol
class ServiceConfiguration:
def __i... |
#vim: set encoding=utf-8
from layer import Layer
from regparser.tree.struct import Node
class TableOfContentsLayer(Layer):
def check_toc_candidacy(self, node):
""" To be eligible to contain a table of contents, all of a node's
children must have a title element. If one of the children is an
... |
"""Given a full set of results (boxes, masks, or keypoints) on the 2017 COCO
test set, this script extracts the results subset that corresponds to 2017
test-dev. The test-dev subset can then be submitted to the COCO evaluation
server.
"""
from __future__ import absolute_import
from __future__ import division
from __fu... |
from __future__ import division, absolute_import, print_function
import sys
from numpy.distutils.fcompiler import FCompiler
compilers = ['NAGFCompiler']
class NAGFCompiler(FCompiler):
compiler_type = 'nag'
description = 'NAGWare Fortran 95 Compiler'
version_pattern = r'NAGWare Fortran 95 compiler Relea... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import re
import json
from ansible.errors import AnsibleConnectionFailure
from ansible.module_utils._text import to_bytes, to_text
from ansible.module_utils.network.common.utils import to_list
from ansible.module_utils.connection ... |
from __future__ import absolute_import
import os
import six
import logging
import warnings
from django.apps import apps
from django import VERSION
from leonardo.conf.spec import DJANGO_CONF
from leonardo.base import leonardo, default
from leonardo.utils.settings import (get_conf_from_module, merge,
... |
"""
Storages used to assist in the deprecation of contrib.auth User messages.
"""
from django.contrib.messages import constants
from django.contrib.messages.storage.base import BaseStorage, Message
from django.contrib.auth.models import User
from django.contrib.messages.storage.fallback import FallbackStorage
class ... |
import getopt, sys
from indico.core.db import DBMgr
from MaKaC.plugins.RoomBooking.default.factory import Factory
from MaKaC.plugins.RoomBooking.default.reservation import Reservation
from MaKaC.rb_reservation import ReservationBase
from MaKaC.rb_location import CrossLocationQueries
from MaKaC.user import AvatarHolder
... |
# -*- coding: ISO-8859-1 -*-
#############################################
## (C)opyright by Dirk Holtwick, 2002-2007 ##
## All rights reserved ##
#############################################
__reversion__ = "$Revision: 20 $"
__author__ = "$Author: holtwick $"
__date__ = "$Date: 2007-10-09... |
from django.conf.urls import include, url
from fir_irma.settings import settings
api_urlpatterns = [
url(r'^$', 'fir_irma.views.not_found', name='base'),
url(r'^scans$', 'fir_irma.views.irma_scan_new'),
url(r'^scans/(?P<scan_id>[^/]+)/files$', 'fir_irma.views.irma_scan_upload'),
url(r'^scans/(?P<scan_... |
import unittest
import os
import sys
import commands
import comm
class TestAppMultipleApkFalse(unittest.TestCase):
def test_multiple_apk_false(self):
comm.setUp()
app_name = "testMultipleApk"
pkg_name = " com.example." + app_name.lower()
content = "<a href='http://www.intel.com'>I... |
from direct.showbase.DirectObject import DirectObject
from direct.showbase import GarbageReport
class GarbageLeakServerEventAggregator(DirectObject):
def __init__(self, cr):
self.cr = cr
self._doLaterName = None
self._sentLeakDesc2num = {}
self._curLeakDesc2num = {}
self.ac... |
import argparse
import sys
import os
from novaclient import utils as novaclient_utils
from tukey_middleware.modules.ids import Client
class TokenFileClient(object):
''' Handles saving the id_service_auth_token from the id client and
providing with statement functionality. '''
def __init__(self, args, pat... |
# -*- coding: utf-8 -*
"""
sagewui_kernels.sage interfaces
AUTHORS:
- William Stein
- J Miguel Farto
"""
#############################################################################
#
# Copyright (C) 2009 William Stein <<EMAIL>>
# Copyright (C) 2015 J Miguel Farto <<EMAIL>>
# Distributed under the... |
from django.utils.translation import gettext_lazy as _
from base.models.utils.utils import ChoiceEnum
class LinkTypes(ChoiceEnum):
REFERENCE = _("Reference") |
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint
import MySQLdb
def execute():
webnotes.reload_doc("setup", "doctype", "price_list")
webnotes.reload_doc("setup", "doctype", "item_price")
try:
for price_list in webnotes.conn.sql_list("""select name from `tabPrice List`"""):... |
import itertools
from qtpy.QtCore import QAbstractItemModel, QModelIndex, Qt
class BaseItem(object):
"""Base Item class for all tree item classes."""
def __init__(self, data, parent=None):
self.colType = 1
self.colParam = 2
self.parentItem = parent
self.itemData = None
... |
__author__ = 'Fabian'
import sys
import appdirs
import os
import shutil
join = os.path.join
directories = appdirs.AppDirs("FactorioManager", "", roaming=True)
configpath = join(directories.user_config_dir, "config.cfg")
tempfolder = appdirs.user_cache_dir("FactorioManager", "", opinion=False)
log = join(tempfolder, ... |
# -*- coding: utf-8 -*-
"""
tests.test_jwt
~~~~~~~~~~~~~~
Flask-JWT tests
"""
import time
from datetime import timedelta
from itsdangerous import TimedJSONWebSignatureSerializer
from flask import Flask, json, jsonify
import flask_jwt
def post_json(client, url, data):
resp = client.post(
ur... |
from setuptools import setup, find_packages
import codecs
import os
import re
long_description = open(
os.path.join(os.path.dirname(__file__), 'README.rst')).read()
setup(
name="httpbin",
version="0.2.1",
description="HTTP Request and Response Service",
long_description=long_description,
# Th... |
import MySQLdb
def transtime(timestr):
timestr=str(timestr)
timestr=timestr.split(":")
return int(timestr[1])*60+int(timestr[2])
hometeamid=0
awayteamid=0
timetick=-1
homeps=0
awayps=0
conn=MySQLdb.connect(host='localhost',
user='research',
passwd='asdfgh',
... |
# Design and implement a class Country that stores the name of the country, its popula-
# tion, and its area. Then write a program that reads in a set of countries and prints
# • The country with the largest area.
# • The country with the largest population.
# • The country with the largest population density ... |
{
'name': 'Prices Visible Discounts',
'version': '1.0',
'author': 'OpenERP SA',
'category': 'Sales Management',
'website': 'https://www.odoo.com',
'description': """
This module lets you calculate discounts on Sale Order lines and Invoice lines base on the partner's pricelist.
==================... |
# Lint as: python3
"""Utils to annotate and trace benchmarks."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import REDACTED
from absl import flags
from absl import logging
from absl.testing import flagsaver
FLAGS = flags.FLAGS
flags.DEFINE_multi_stri... |
import os
import sys as _sys
PY2 = _sys.version_info < (3,)
PY3 = not PY2
if not PY2:
# these were moved around for Python 3
from urllib.parse import (quote as url_quote, unquote as url_unquote,
urlencode)
# Python 3 does not have basestring anymore; we include
# *only*... |
# fdrake@...
#
# This is a simple little module I wrote to make life easier. I didn't
# see anything quite like it in the library, though I may have overlooked
# something. I wrote this when I was trying to read some heavily nested
# tuples with fairly non-descriptive content. This is modeled very ... |
#!/usr/bin/env python
from __future__ import absolute_import
import logging
import os
import optparse
import warnings
import sys
import re
from pip.exceptions import InstallationError, CommandError, PipError
from pip.utils import get_installed_distributions, get_prog
from pip.utils import deprecation, dist_is_editab... |
import scope_window
import common
from gnuradio import gr
from pubsub import pubsub
from constants import *
import math
class ac_couple_block(gr.hier_block2):
"""
AC couple the incoming stream by subtracting out the low pass signal.
Mute the low pass filter to disable ac coupling.
"""
def __init__(self, controll... |
#!/usr/bin/env python
# coding: utf-8
import unittest
import nose
import cesiumpy
class TestDataSource(unittest.TestCase):
def test_czmldatasource(self):
ds = cesiumpy.CzmlDataSource('xxx.czml')
exp = 'Cesium.CzmlDataSource.load("xxx.czml")'
self.assertEqual(ds.script, exp)
ds =... |
import sys
import tweepy
from config import oauth
try:
auth = tweepy.OAuthHandler(oauth.CONSUMER_KEY, oauth.CONSUMER_SECRET)
auth.set_access_token(oauth.ACCESS_TOKEN, oauth.ACCESS_TOKEN_SECRET)
print tweepy.API(auth).get_user(sys.argv[1]).screen_name
except tweepy.error.TweepError, err:
print(err.reason) |
from django import forms
import taggit
from geonode.services.models import Service, ServiceLayer
from geonode.services.enumerations import SERVICE_TYPES
from django.utils.translation import ugettext_lazy as _
class CreateServiceForm(forms.Form):
# name = forms.CharField(label=_("Service Name"), max_length=512,
... |
from django.shortcuts import render
from ponies.common.views import BaseView
from ponies.apps.main.models import Pony
class HomeView(BaseView):
template_name = "main/home.jade"
def get(self, request):
return render(request, self.template_name, {
'ponies': Pony.objects.all()
}) |
#!/usr/bin/env python3
"""
Created on 5 Mar 2019
@author: Bruno Beloff (<EMAIL>)
"""
import pytz
from scs_core.aqcsv.data.aqcsv_datetime import AQCSVDatetime
from scs_core.data.datetime import LocalizedDatetime
from scs_core.data.json import JSONify
# -------------------------------------------------------------... |
#-------------------------------------------------------------------------------
# android-create-apk.py
#
# Helper script to create an APK project directory and create
# an APK.
#
# The Android SDK is expected under "fips-sdks/android/"
#
# Arguments:
#
# --path the current cmake binary dir (where the... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 import get_exception
import ansible.module_utils.netapp as netapp_utils
HAS_NETAPP_LIB = netapp_ut... |
from os import environ
import datetime
from twisted.internet.defer import inlineCallbacks
from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner
class Component(ApplicationSession):
"""
A simple time service application component.
"""
@inlineCallbacks
def onJoin(self, details):... |
from flask import request
from netman.api.api_utils import BadRequest, to_response
from netman.api.switch_api_base import SwitchApiBase
from netman.api.validators import resource, content, Session, \
Resource, is_session
class SwitchSessionApi(SwitchApiBase):
def __init__(self, switch_factory, sessions_manag... |
import xmlrpc.client
from datetime import datetime, timedelta
from matrixbot import utils
class TracPlugin:
def __init__(self, bot, settings):
self.logger = utils.get_logger()
self.name = "TracPlugin"
self.bot = bot
self.settings = settings
self.logger.info("TracPlugin loade... |
"""BibEdit Database Layer."""
__revision__ = "$Id$"
try:
import cPickle as Pickle
except ImportError:
import Pickle
import zlib
from datetime import datetime, timedelta
from invenio.dbquery import run_sql
from invenio.config import CFG_BIBEDIT_TIMEOUT
def get_name_tags_all():
"""Return a dictionary of... |
import itertools
import os.path
import sys
import unittest
sys.path.append(os.path.join(os.path.dirname(__file__),
*itertools.repeat("..", 3)))
from pox.lib.mock_socket import MockSocket
from pox.lib.ioworker import IOWorker, RecocoIOLoop
from nose.tools import eq_
class IOWorkerTest(unittest.TestCase):
def te... |
from numpy.testing import *
import numpy as np
rlevel = 1
class TestRegression(TestCase):
def test_kron_matrix(self,level=rlevel):
"""Ticket #71"""
x = np.matrix('[1 0; 1 0]')
assert_equal(type(np.kron(x,x)),type(x))
def test_matrix_properties(self,level=rlevel):
"""Ticket #12... |
# coding: utf-8
from __future__ import unicode_literals
import calendar
import re
import time
from .amp import AMPIE
from .common import InfoExtractor
from ..compat import compat_urlparse
class AbcNewsVideoIE(AMPIE):
IE_NAME = 'abcnews:video'
_VALID_URL = r'https?://abcnews\.go\.com/[^/]+/video/(?P<display_... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import re
from ansible.module_utils.basic import AnsibleModule
def parse_out(string):
... |
data = open('Real_Final_database_02.csv')
alldata = data.readlines()
listdata = []
for i in alldata:
listdata.append(i.strip().split(','))
#Seperate each list to display in graph
year = []
affect = []
damage = []
death =[]
for j in listdata:
if j[0] == 'Indonesia'and j[2] == 'Flood':
year.append(int(j[... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: influxdb_write
short_description: Write data points into I... |
try:
import shade
HAS_SHADE = True
except ImportError:
HAS_SHADE = False
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
def _can_update(subnet, module, cloud):
"""Check for differences in non-updatable values"""
ne... |
"""
The mmcfg command allows direct access to memory mapped config space.
"""
import time
from chipsec.command import BaseCommand
from chipsec.hal import mmio
# Access to Memory Mapped PCIe Configuration Space (MMCFG)
class MMCfgCommand(BaseCommand):
"""
>>> chipsec_util mmcfg <bus> <device> <function> <... |
source_link = "https://github.com/frappe/frappe"
docs_base_url = "https://frappe.github.io/frappe"
headline = "Superhero Web Framework"
sub_heading = "Build extensions to ERPNext or make your own app"
hide_install = True
long_description = """Frappe is a full stack web application framework written in Python,
Javascrip... |
"""Fast counter functions for CTR cipher modes.
CTR is a chaining mode for symmetric block encryption or decryption.
Messages are divideded into blocks, and the cipher operation takes
place on each block using the secret key and a unique *counter block*.
The most straightforward way to fulfil the uniqueness property ... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import shlex
import shutil
import subprocess
import ansible.constants as C
from ansible.module_utils._text import to_bytes, to_native
from ansible.plugins.connection import ConnectionBase, ensure_connect
try:
from __main__... |
import json
import logging
from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.exceptions import PermissionDenied
from django.db import transaction
from django.http import Http404, HttpResponseBadRequest
from django.shortcuts import get_object_or_404
from django.utils.decorator... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import sys
"""Helpers to provide compile strategies to unit tests.
These methods work around the fact that pytest.mark.parametrize does not support methods.
"""
_S... |
import BoostBuild
# Create a temporary working directory.
t = BoostBuild.Tester()
# Create the needed files.
t.write("jamroot.jam", """
exe hello : hello.cpp ;
""")
t.write("hello.cpp", """
int main() {}
"""
# Run the build.
t.run_build_system()
# First, create a list of three pathnames.
file_list = BoostBuild.Li... |
from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.sqlite3.introspection import DatabaseIntrospection, FlexibleFieldLookupDict
class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict):
"""
Sublcass that includes updates the `base_data_types_reverse` dict
for geometry field types.
... |
"""The Normal (Gaussian) distribution class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
from tensorflow.contrib.bayesflow.python.ops import special_math
from tensorflow.contrib.distributions.python.ops import distribution
from tensorflo... |
#!/usr/bin/env python
# Line too long - pylint: disable=C0301
# Invalid name - pylint: disable=C0103
"""
gp_dbid.py
Copyright (c) EMC/Greenplum Inc 2011. All Rights Reserved.
"""
import re
import os, stat
class DummyLogger:
def info(self, msg): pass
def debug(self, msg): pass
DBID_RE = re.com... |
#!/usr/bin/env python
# -*- mode: python; encoding: utf-8 -*-
"""Tests for grr.parsers.windows_registry_parser."""
from grr.lib import flags
from grr.lib import test_lib
from grr.lib import utils
from grr.lib.rdfvalues import client as rdf_client
from grr.lib.rdfvalues import paths as rdf_paths
from grr.lib.rdfvalues ... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.mininode import COIN, MAX_BLOCK_SIZE
class PrioritiseTransactionTest(BitcoinTestFramework):
def __init__(self):
self.txouts = gen_return_txouts()
def setup_chain(self):
print("... |
"""Impact function based on Padang 2009 post earthquake survey
This impact function estimates percentual damage to buildings as a
function of ground shaking measured in MMI.
Buildings are assumed to fall the 9 classes below as described in
the Geoscience Australia/ITB 2009 Padang earthquake
survey (http://trove.nla.go... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
try:
from librar... |
import sys, os
import thread, threading
from logger import Logger
from time import sleep
import pdb
import socket
from sendfile import sendfile
import commands
import json
import consts
import util
#from util import pause_coalscer, resume_coalescer
#globals
DEFAULT_SERVER_PORT = 22122
#Error messages
INVALID_SYNTA... |
import os
import re
import sys
from distutils import log
import xml.dom.pulldom
import shlex
import locale
import codecs
import unicodedata
import warnings
from setuptools.compat import unicode
from setuptools.py31compat import TemporaryDirectory
from xml.sax.saxutils import unescape
try:
import url... |
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.models import get_current_site
from django.template import Context, loader
from django import forms
from django.utils.translation import ugett... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import (
compat_urlparse,
)
from ..utils import (
determine_ext,
)
class GolemIE(InfoExtractor):
_VALID_URL = r'^https?://video\.golem\.de/.+?/(?P<id>.+?)/'
_TEST = {
'url': 'http://video.g... |
{
"P1": {
"columns": (("CASH", FastSerializer.VOLTTYPE_DECIMAL),
("ID", FastSerializer.VOLTTYPE_INTEGER),
("CREDIT", FastSerializer.VOLTTYPE_DECIMAL),
("RATIO", FastSerializer.VOLTTYPE_FLOAT)),
"partitions": (),
"indexes": ("ID")
... |
"""Run nightly, this script will activate any pending embargoes that have
elapsed the pending approval time and make public and registrations whose
embargo end dates have been passed.
"""
import logging
import django
from django.utils import timezone
from django.db import transaction
django.setup()
from framework.ce... |
from __future__ import unicode_literals, division, absolute_import
from tests import FlexGetBase
class TestRegexExtract(FlexGetBase):
__yaml__ = """
tasks:
test_1:
mock:
- {title: 'The.Event.New.York'}
regex_extract:
prefix: event_
... |
from optparse import make_option
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from student.models import CourseEnrollment
from shoppingcart.models import CertificateItem
from opaque_keys.edx.locations import SlashSeparatedCourseKey
class Command(BaseCommand):
hel... |
import sys
import csv
import numpy as np
############################################################################
def writeSimpleTest1(filePath, numRecords, testNumber):
""" Generates requested number of records and saves in a csv file
"""
with open(filePath+'.csv', 'wb') as f:
writer = csv.writer(f)
... |
from eve.utils import config
from superdesk.commands.data_updates import DataUpdate
class DataUpdate(DataUpdate):
resource = 'vocabularies'
update_fields = ['name', 'qcode']
def forwards(self, mongodb_collection, mongodb_database):
for vocabulary in mongodb_collection.find({}):
if 's... |
"""
==============================================================
Compute full spectrum source space connectivity between labels
==============================================================
The connectivity is computed between 4 labels across the spectrum
between 5 and 40 Hz.
"""
# Authors: Alexandre Gramfort <<EMA... |
from django import forms
from pootle.i18n.gettext import ugettext as _
from pootle_store.forms import MultiStringFormField
from pootle_store.models import Store, Unit
def term_unit_form_factory(terminology_store):
store_pk = terminology_store.pk
# Set store for new terms
qs = Store.objects.filter(pk=stor... |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
import unittest
import math
import data
class TestPoint(unittest.TestCase):
def setUp(self):
pass
def test_test(self):
self.assertEqual(True, True)
def test_chunk_distance(self):... |
'''
Cloudforms.ProvisionRequestManager
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provision Request Manager
:license: MIT, see LICENSE for more details.
'''
from time import sleep
from datetime import datetime, timedelta
from Cloudforms.utils import (
update_params,
normalize_object,
normalize_coll... |
"""Self-test for random number generators"""
__revision__ = "$Id$"
def get_tests(config={}):
tests = []
from Crypto.SelfTest.Random import Fortuna; tests += Fortuna.get_tests(config=config)
from Crypto.SelfTest.Random import OSRNG; tests += OSRNG.get_tests(config=config)
from... |
import tkinter as tk
import os
class Navodila:
def __init__(self, master):
self.master = master
self.polje = tk.Canvas(master)
self.polje.pack(fill='both', expand='yes')
self.polje.config(bg="grey20")
# Vse slike:
master.slika_ozadje_id = tk.PhotoImage(
... |
"""This module fetches and syncs prebuilts from Google Cloud Storage (GCS).
See prebuilts/README for a description of the respository <> GCS sync mechanism.
"""
import hashlib
import logging
import os
import urllib
from memory_inspector import constants
# Bypass the GCS download logic in unittests and use the *_Fo... |
"""Module for image data."""
import os
import cv2
class Image:
"""Object containing image metadata."""
def __init__(self, cls, name, path):
"""
Instantiate an 'Image' object.
:param cls: The image's class; the name of the person.
:type cls: str
:param name: The imag... |
from ansible.plugins.callback import CallbackBase
class CallbackModule(CallbackBase):
"""
This is a very trivial example of how any callback function can get at play and task objects.
play will be 'None' for runner invocations, and task will be None for 'setup' invocations.
"""
CALLBACK_VERSION = 2... |
import contextlib
import mock
from nova import test
from nova.tests.unit.virt.vmwareapi import fake as vmwareapi_fake
from nova.tests.unit.virt.vmwareapi import stubs
from nova.virt.vmwareapi import driver
from nova.virt.vmwareapi import volumeops
class VMwareVolumeOpsTestCase(test.NoDBTestCase):
def setUp(sel... |
# -*- coding: utf-8 -*-
"""
click.parser
~~~~~~~~~~~~
This module started out as largely a copy paste from the stdlib's
optparse module with the features removed that we do not need from
optparse because we implement them in Click on a higher level (for
instance type handling, help formatting a... |
from __future__ import division
import numpy as np
import scipy as sp
from scipy.optimize import minimize
from .Rmax import Rmax
from .convmaxR import convmaxR
def Zmax(Z1A, Z1As, Z1B, Z1Bs, Z2A, Z2As, Z2B, Z2Bs):
m1 = len(Z1As)
m2 = len(Z2As)
n1 = len(Z1Bs)
n2 = len(Z2Bs)
e = 0.0... |
import time
from openerp.osv import fields, osv
class hr_holidays_summary_employee(osv.osv_memory):
_name = 'hr.holidays.summary.employee'
_description = 'HR Leaves Summary Report By Employee'
_columns = {
'date_from': fields.date('From', required=True),
'emp': fields.many2many('hr.employe... |
from invenio.celery import celery
@celery.task
def invenio_version():
""" Task that will return the current running Invenio version """
from invenio.config import CFG_VERSION
return CFG_VERSION
@celery.task
def invenio_db_test(num):
""" Task will execute a simple query in the database"""
from in... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import copy
import inspect
from ..engine import Layer
from ..engine import InputSpec
from .. import backend as K
class Wrapper(Layer):
"""Abstract wrapper base class.
Wrappers take another layer and augment it in various ways.
Do not use thi... |
# Processes from:
# id, views, comments, related_video_1, ... , related_video_20
# to:
# views(id), comments(id), views(related_video_1), comments(related_video_1)
# ...
# views(id), comments(id), views(related_video_20), comments(related_video_20)
import csv
import copy
global dict1File
global dict2File
def ... |
from openerp.osv import osv
class ir_needaction_mixin(osv.AbstractModel):
"""Mixin class for objects using the need action feature.
Need action feature can be used by models that have to be able to
signal that an action is required on a particular record. If in
the business logic an action must be pe... |
from django.utils import unittest
from django.utils.functional import lazy, lazy_property
class FunctionalTestCase(unittest.TestCase):
def test_lazy(self):
t = lazy(lambda: tuple(range(3)), list, tuple)
for a, b in zip(t(), range(3)):
self.assertEqual(a, b)
def test_lazy_base_clas... |
from openstack_dashboard.test.integration_tests import helpers
PROJECT_NAME = helpers.gen_random_resource_name("project")
class TestCreateDeleteProject(helpers.AdminTestCase):
def setUp(self):
super(TestCreateDeleteProject, self).setUp()
self.projects_page = self.home_pg.go_to_identity_projects... |
from __future__ import unicode_literals
import frappe
from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty
def execute():
""" Set the Serial Numbers in Sales Invoice Item from Delivery Note Item """
frappe.reload_doc("stock", "doctype", "serial_no")
frappe.db.sql(""" update `tabSales Invoice I... |
"""Exception types for TensorFlow errors."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# pylint: disable=unused-import
from tensorflow.python.framework import errors_impl as _impl
# pylint: enable=unused-import
# go/tf-wildcard-import
# pylint: disabl... |
"""
Watches the key ``paste.httpserver.thread_pool`` to see how many
threads there are and report on any wedged threads.
"""
import sys
import cgi
import time
import traceback
from cStringIO import StringIO
from thread import get_ident
from paste import httpexceptions
from paste.request import construct_url, parse_form... |
# stdlib
from nose.plugins.attrib import attr
# project
from checks import AgentCheck
from tests.checks.common import AgentCheckTest
@attr(requires='mysql')
class TestMySql(AgentCheckTest):
CHECK_NAME = 'mysql'
METRIC_TAGS = ['tag1', 'tag2']
SC_TAGS = ['host:localhost', 'port:0']
MYSQL_CONFIG = [{
... |
from case import Case
class Case4_1_4(Case):
DESCRIPTION = """Send small text message, then send frame with reserved non-control <b>Opcode = 6</b> and non-empty payload, then send Ping."""
EXPECTATION = """Echo for first message is received, but then connection is failed immediately, since reserved opcod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.