code stringlengths 1 199k |
|---|
import sys
from time import sleep
from cachey import Cache, Scorer, nbytes
def test_cache():
c = Cache(available_bytes=nbytes(1) * 3)
c.put('x', 1, 10)
assert c.get('x') == 1
assert 'x' in c
c.put('a', 1, 10)
c.put('b', 1, 10)
c.put('c', 1, 10)
assert set(c.data) == set('xbc')
c.put(... |
from __future__ import absolute_import, division, print_function
class TreeError(Exception):
"""General tree error"""
pass
class NoLengthError(TreeError):
"""Missing length when expected"""
pass
class DuplicateNodeError(TreeError):
"""Duplicate nodes with identical names"""
pass
class MissingNod... |
"""
Test for distributed trial worker side.
"""
import os
from cStringIO import StringIO
from zope.interface.verify import verifyObject
from twisted.trial.reporter import TestResult
from twisted.trial.unittest import TestCase
from twisted.trial._dist.worker import (
LocalWorker, LocalWorkerAMP, LocalWorkerTransport... |
from threading import Thread
import Queue
from django.core.urlresolvers import reverse
from django.conf import settings
from django import forms
from django.http import HttpRequest
from django.test import TestCase
import haystack
from haystack.forms import model_choices, SearchForm, ModelSearchForm
from haystack.query ... |
from django.conf import settings
def bitgroup_cache_key(slug):
return "%s:%s" % (
getattr(settings, 'PAGEBIT_CACHE_PREFIX', 'pagebits'),
slug
) |
import logging
import pytest
def test_tracing_by_function_if_enable(track_logger, handler):
msg1 = 'TEST1'
msg2 = 'TEST2'
msg3 = 'TEST3'
track_logger.setLevel(logging.INFO)
track_logger.enable_tracking()
track_logger.debug(msg1)
track_logger.info(msg2)
track_logger.disable_tracking()
... |
import sys
from roslaunch.xmlloader import XmlLoader, loader
from rosgraph.names import get_ros_namespace
from rqt_launchtree.launchtree_context import LaunchtreeContext
class LaunchtreeLoader(XmlLoader):
def _include_tag(self, tag, context, ros_config, default_machine, is_core, verbose):
inc_filename = self.resolve... |
"""
Provides Matlab-like tic, tac and toc functions.
"""
import time
import numpy as np
class __Timer__:
"""Computes elapsed time, between tic, tac, and toc.
Methods
-------
tic :
Resets timer.
toc :
Returns and prints time elapsed since last tic().
tac :
Returns and prin... |
"""Tests that a set of symbols are truly pruned from the translator.
Compares the pruned down "on-device" translator with the "fat" host build
which has not been pruned down.
"""
import glob
import re
import subprocess
import sys
import unittest
class SymbolInfo(object):
def __init__(self, lib_name, sym_name, t, size... |
import os.path
from django.conf import settings
from django.test.utils import override_settings
import mock
from celery.result import AsyncResult
from olympia import amo
from olympia.amo.tests import TestCase, addon_factory, version_factory
from olympia.devhub import tasks, utils
from olympia.files.models import FileUp... |
"""
Test data sources
"""
from nose.tools import ok_, eq_
from carousel.tests import logging
from carousel.core import UREG
from carousel.core.data_sources import DataSource, DataParameter
from carousel.core.data_readers import XLRDReader
from carousel.tests import PROJ_PATH, TESTS_DIR
import os
LOGGER = logging.getLog... |
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise RuntimeError("Python 2.7 or later required")
if __package__ or "." in __name__:
from . import _stable3d
else:
import _stable3d
try:
import builtins as __builtin__
except ImportError:
import __bu... |
from __future__ import absolute_import
import collections
from operator import gt, lt
from .compat import range_
class EarlyStopException(Exception):
"""Exception of early stopping.
Parameters
----------
best_iteration : int
The best iteration stopped.
"""
def __init__(self, best_iterati... |
'''Todo:
* Add multiple thread support for async_process functions
* Potentially thread each handler function? idk
'''
import sys
import socket
import re
import threading
import logging
import time
if sys.hexversion < 0x03000000:
#Python 2
import Queue as queue
BlockingIOError = socket.error
else:
impor... |
import os
def get_html_theme_path():
theme_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
return theme_dir |
import unittest
import chainer
from chainer import testing
from chainer.testing import attr
from chainercv.links.model.deeplab import SeparableASPP
class TestSeparableASPP(unittest.TestCase):
def setUp(self):
self.in_channels = 128
self.out_channels = 32
self.link = SeparableASPP(
... |
"""tests/test_output_format.py.
Tests the output format handlers included with Hug
Copyright (C) 2015 Timothy Edmund Crosley
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, inc... |
import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import gradient_check
from chainer import links
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
@testing.with_requires('theano')
class TheanoFunctionTestBase(object):
forward... |
"""
Created on Mon Jul 23 13:23:20 2018
@author: BallBlueMeercat
"""
from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules = cythonize('firstderivs_cython.pyx')) |
import Base
import VS
import GUI
import XGUITypes
import XGUIDebug
XGUIRootSingleton = None
XGUIPythonScriptAPISingleton = None
"""----------------------------------------------------------------"""
""" """
""" XGUIRoot - root management interface for the X... |
import sys
def inputText():
input = sys.stdin.readline()
return input.strip()
def inputChoices(list, backcmd = "b", backtext = "back"):
repeat = True
while repeat:
repeat = False
count = 0
for item in list:
print count, "-", item
count += 1
print backcmd, "-", backtext
input = inputText()
if input... |
import unittest
from tests.baseclass import CommandTest, CommandSequenceTest
class F23_TestCase(CommandTest):
command = "reqpart"
def runTest(self):
# pass
self.assert_parse("reqpart", "reqpart\n")
# pass
self.assert_parse("reqpart --add-boot", "reqpart --add-boot\n")
class F23_A... |
class Plugin(dict):
"""A dictionary with attribute-style access. It maps attribute access to
the real dictionary. """
def __init__(self, init = None):
if init is None:
init = dict()
dict.__init__(self, init)
def __getstate__(self):
return list(self.__dict__.items())
... |
"""
EasyBuild support for iompi compiler toolchain (includes Intel compilers (icc, ifort) and OpenMPI.
:author: Stijn De Weirdt (Ghent University)
:author: Kenneth Hoste (Ghent University)
"""
from distutils.version import LooseVersion
import re
from easybuild.toolchains.iccifort import IccIfort
from easybuild.toolchai... |
from django.shortcuts import render, redirect
from django.utils.translation import ugettext as _
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.db.models import Sum, Count, Q
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.c... |
import tensorflow as tf
import numpy as np
import scipy.io
import pdb
MEAN_PIXEL = np.array([ 123.68 , 116.779, 103.939])
def net(data_path, input_image):
layers = (
'conv1_1', 'relu1_1', 'conv1_2', 'relu1_2', 'pool1',
'conv2_1', 'relu2_1', 'conv2_2', 'relu2_2', 'pool2',
'conv3_1', 'relu3_... |
import numpy, re
def from_hex(arr, delim=':'):
r=re.compile('\s*(\-?)(.+)%s(.+)%s(.+)'%(delim,delim))
ret=[]
for a in arr:
m = r.search(a)
sign = m.group(1)=='-'
if sign:
sign=-1
else:
sign=1
i1 = int(m.group(2))
i2 = int(m.group(3))
i3 = float(m.group(4))
val = sign*(int(i1)+int(i2)/60.+(float... |
from django.contrib import admin
from article.models import Article
admin.site.register(Article) |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import ast
import contextlib
import datetime
import os
import pwd
import re
import time
from functools import wraps
from io import StringIO
from numbers import Number
try:
from hashlib import sha1
except ImportError:
from sh... |
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
pass
def backwards(self, orm):
pass
models = {
}
complete_apps = ['admin'] |
import sys
import nzbToMedia
section = "Gamez"
result = nzbToMedia.main(sys.argv, section)
sys.exit(result) |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
DOCUMENTATION = '''
---
module: gcp_pubsub_subscription_info
description:
- Gather info for GCP Subscription
short_description: Gather ... |
import random
from cloudbot.util import http, formatting
def api_get(kind, query):
"""Use the RESTful Google Search API"""
url = 'http://ajax.googleapis.com/ajax/services/search/%s?' \
'v=1.0&safe=moderate'
return http.get_json(url % kind, q=query)
def googleimage(text):
"""<query> - returns t... |
import bpy
from bpy.props import IntProperty, FloatProperty
import mathutils
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import updateNode
class SvKDTreeEdgesNodeMK2(bpy.types.Node, SverchCustomTreeNode):
bl_idname = 'SvKDTreeEdgesNodeMK2'
bl_label = 'KDT Closest Edges MK2'
... |
""" UserProfileDB class is a front-end to the User Profile Database
"""
__RCSID__ = "$Id$"
import types
import os
import sys
import hashlib
from DIRAC import S_OK, S_ERROR, gLogger, gConfig
from DIRAC.Core.Utilities import Time
from DIRAC.ConfigurationSystem.Client.Helpers import Registry
from DIRAC.Core.Base.DB impor... |
import copy
import logging
import deluge.component as component
from deluge.common import TORRENT_STATE
log = logging.getLogger(__name__)
STATE_SORT = ["All", "Active"] + TORRENT_STATE
def filter_keywords(torrent_ids, values):
# Cleanup
keywords = ",".join([v.lower() for v in values])
keywords = keywords.sp... |
"""A ${VISUAL} placeholder that will use the text that was last visually
selected and insert it here. If there was no text visually selected, this will
be the empty string. """
import re
import textwrap
from UltiSnips import _vim
from UltiSnips.indent_util import IndentUtil
from UltiSnips.text_objects._transformation i... |
import purchase |
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 field 'Order.name'
db.add_column('valueaccounting_order', 'name',
self.gf('django.db.models.fields.CharF... |
from odoo import api, models
class IRActionsWindow(models.Model):
_inherit = 'ir.actions.act_window'
@api.multi
def read(self, fields=None, context=None, load='_classic_read'):
actions = super(IRActionsWindow, self).read(fields=fields, load=load)
for action in actions:
if action.... |
"""
Logistration API View Tests
"""
from unittest.mock import patch
from urllib.parse import urlencode
import socket
import ddt
from django.conf import settings
from django.urls import reverse
from rest_framework.test import APITestCase
from common.djangoapps.student.models import Registration
from common.djangoapps.st... |
from __future__ import unicode_literals
import frappe
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
def execute(filters=None):
args = {
"party_type": "Supplier",
"naming_by": ["Buying Settings", "supp_master_name"],
}
return ReceivablePayableReport(filters).r... |
default_app_config = 'apps.datasetmanager.apps.datasetmanagerConfig' |
'''
Schedulers determine how worker's queues get filled. They control which
locations get scanned, in what order, at what time. This allows further
optimizations to be easily added, without having to modify the existing
overseer and worker thread code.
Schedulers will recieve:
queues - A list of queues for the workers ... |
__doc__="""This is the BaseClass for audit trails
The audit is supposed to work like this. First we need to create an audit
object. E.g. this can be done in the before_request:
g.audit_object = getAudit(file_config)
During the request, the g.audit_object can be used to add audit information:
g.audit_object.log(... |
"""
Django Admin pages for DiscountRestrictionConfig.
"""
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from openedx.core.djangoapps.config_model_utils.admin import StackedConfigModelAdmin
from .models import DiscountPercentageConfig, DiscountRestrictionConfig
class DiscountRes... |
"""
This module contains external, potentially separately licensed,
packages that are included in spack.
So far:
argparse: We include our own version to be Python 2.6 compatible.
distro: Provides a more stable linux distribution detection.
functools: Used for implementation of total_ordering.
... |
from __future__ import absolute_import, unicode_literals
from case import Mock, patch
from amqp.five import text_t
from amqp.utils import (NullHandler, bytes_to_str, coro, get_errno, get_logger,
str_to_bytes)
class test_get_errno:
def test_has_attr(self):
exc = KeyError('foo')
... |
from spack import *
class Lzma(AutotoolsPackage):
"""LZMA Utils are legacy data compression software with high compression
ratio. LZMA Utils are no longer developed, although critical bugs may be
fixed as long as fixing them doesn't require huge changes to the code.
Users of LZMA Utils should move to XZ... |
import sys, math
if len(sys.argv) != 3:
print("Usage:")
print("%s [RA HH:MM:SS] [DEC Deg:Arcmin:Arcsec] " % sys.argv[0])
exit(0)
ra = sys.argv[1]
dec = sys.argv[2]
rai = ra.split(":")
deci = dec.split(":")
radeg = float(rai[0]) * 15.0 + float(rai[1]) * (1.0 / 60.0) + float(rai[2]) * (1.0 / 3600)
decdeg = fl... |
"""This code example deactivates all active placements. To determine which
placements exist, run get_all_placements.py."""
__author__ = 'api.shamjeff@gmail.com (Jeff Sham)'
import os
import sys
sys.path.insert(0, os.path.join('..', '..', '..', '..'))
from adspygoogle import DfpClient
from adspygoogle.dfp import DfpUtil... |
"""The tests for hls streams."""
from datetime import timedelta
from io import BytesIO
from unittest.mock import patch
from homeassistant.setup import async_setup_component
from homeassistant.components.stream.core import Segment
from homeassistant.components.stream.recorder import recorder_save_worker
import homeassis... |
"""This script runs the following tests in all cases.
- Javascript and Python Linting
- Backend Python tests
Only when frontend files are changed will it run Frontend Karma unit tests.
"""
from __future__ import annotations
import argparse
import subprocess
from . import common
from . import run_backend_tests
from . im... |
from __future__ import absolute_import, division, print_function, unicode_literals
import datetime
import json
import os
from dateutil import zoneinfo
from mock import mock
from .common import BaseTest, instance
from c7n.filters import FilterValidationError
from c7n.filters.offhours import OffHour, OnHour, SchedulePars... |
import logging
logger = logging.getLogger()
import time
import hostapd
from hostapd import HostapdGlobal
import hwsim_utils
from wpasupplicant import WpaSupplicant
from rfkill import RFKill
from utils import HwsimSkip
def get_rfkill(dev):
phy = dev.get_driver_status_field("phyname")
try:
for r, s, h in ... |
"""Installation script for Oppia third-party libraries."""
import contextlib
import json
import os
import shutil
import StringIO
import sys
import tarfile
import urllib
import urllib2
import zipfile
import common
TOOLS_DIR = os.path.join('..', 'oppia_tools')
THIRD_PARTY_DIR = os.path.join('.', 'third_party')
THIRD_PART... |
"""
Test suite for top-level functions.
"""
import unittest
import os
import tempfile
import shutil
import pydoop
class TestPydoop(unittest.TestCase):
def setUp(self):
self.wd = tempfile.mkdtemp(prefix='pydoop_test_')
self.old_env = os.environ.copy()
def tearDown(self):
shutil.rmtree(sel... |
import ssl
from pyOpenSSL import SSL
ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv2)
SSL.Context(method=SSL.SSLv2_METHOD)
SSL.Context(method=SSL.SSLv23_METHOD)
herp_derp(ssl_version=ssl.PROTOCOL_SSLv2)
herp_derp(method=SSL.SSLv2_METHOD)
herp_derp(method=SSL.SSLv23_METHOD)
ssl.wrap_socket(ssl_version=ssl.PROTOCOL_SSLv3)... |
from impacket.helper import ProtocolPacket, Byte, Word, Long, ThreeBytesBigEndian
DOT1X_AUTHENTICATION = 0x888E
class EAPExpanded(ProtocolPacket):
"""EAP expanded data according to RFC 3748, section 5.7"""
WFA_SMI = 0x00372a
SIMPLE_CONFIG = 0x00000001
header_size = 7
tail_size = 0
vendor_id = Th... |
import datetime
import random
import time
from oslo.config import cfg
from oslo.db import exception as db_exc
from oslo import messaging
from oslo.utils import timeutils
import sqlalchemy as sa
from sqlalchemy import func
from sqlalchemy import or_
from sqlalchemy import orm
from sqlalchemy.orm import exc
from sqlalche... |
def check_resource_count(expected_count):
test.assertEqual(expected_count, len(reality.all_resources()))
example_template = Template({
'A': RsrcDef({}, []),
'B': RsrcDef({'a': '4alpha'}, ['A']),
'C': RsrcDef({'a': 'foo'}, ['B']),
'D': RsrcDef({'a': 'bar'}, ['C']),
})
engine.create_stack('foo', examp... |
from datetime import datetime
import argparse
import kudu
from kudu.client import Partitioning
parser = argparse.ArgumentParser(description='Basic Example for Kudu Python.')
parser.add_argument('--masters', '-m', nargs='+', default='localhost',
help='The master address(es) to connect to Kudu.')
pars... |
from Node import error
SYNTAX_NODE_SERIALIZATION_CODES = {
# 0 is 'Token'. Needs to be defined manually
# 1 is 'Unknown'. Needs to be defined manually
'UnknownDecl': 2,
'TypealiasDecl': 3,
'AssociatedtypeDecl': 4,
'IfConfigDecl': 5,
'PoundErrorDecl': 6,
'PoundWarningDecl': 7,
'PoundS... |
""" Restore record file by replacing its video frames with image frames. """
import datetime
import errno
import glob
import os
import shutil
import time
from absl import app
from absl import flags
from absl import logging
import cv2
from cyber.python.cyber_py3.record import RecordReader, RecordWriter
from modules.driv... |
'''
Datastore via remote webdav connection
'''
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
import os
import tarfile
import logging
from fs.contrib.davfs import DAVFS
from urllib.parse import urlparse
from contextlib import closing
from sumatra.core impo... |
class DSF_SIC_Map(object):
"""docstring for SIC_Map"""
def __init__(self, dsffile = 'crsp/dsf.csv', sicfile = 'sic_codes.txt'):
self.dsf = pd.read_csv("dsf.csv", dtype = {'CUSIP': np.str, 'PRC': np.float}, na_values = {'PRC': '-'})
self.sic = pd.read_table(sicfile, header = 1)
self.sic.c... |
from bravado_core.spec import Spec
import mock
from pyramid.config import Configurator
from pyramid.registry import Registry
import pytest
from swagger_spec_validator.common import SwaggerValidationError
import pyramid_swagger
from pyramid_swagger.model import SwaggerSchema
@mock.patch('pyramid_swagger.register_api_doc... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hhlregistrations', '0004_auto_20150411_1935'),
]
operations = [
migrations.AddField(
model_name='event',
name='payment_due',
... |
from tracing.mre import job as job_module
class Failure(object):
def __init__(self, job, function_handle_string, trace_canonical_url,
failure_type_name, description, stack):
assert isinstance(job, job_module.Job)
self.job = job
self.function_handle_string = function_handle_string
self.t... |
from django import forms
from django.contrib import admin
from django.contrib.admin import AdminSite
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.middleware import AuthenticationMiddleware
from django.contrib.contenttypes.admin import GenericStackedInline
from django.contrib.messages.m... |
import IECore
import Gaffer
import GafferUI
import GafferOSL
import imath
import functools
_channelNamesOptions = {
"RGB" : IECore.Color3fData( imath.Color3f( 1 ) ),
"RGBA" : IECore.Color4fData( imath.Color4f( 1 ) ),
"R" : IECore.FloatData( 1 ),
"G" : IECore.FloatData( 1 ),
"B" : IECore.FloatData( 1 ),
"A" : IECo... |
import django.db.models.deletion
import oauthlib.common
from django.db import migrations, models
def move_existing_token(apps, schema_editor):
ServiceAccount = apps.get_model("account", "ServiceAccount")
for service_account in ServiceAccount.objects.iterator():
service_account.tokens.create(
... |
import six
from django import template
from oscar.core.loading import get_model
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import resolve, Resolver404
from oscar.apps.customer import history
from oscar.core.compat import urlparse
Site = get_model('sites', 'Site')
register = te... |
import sys
import config_util # pylint: disable=import-error
class DevToolsFrontend(config_util.Config):
"""Basic Config class for DevTools frontend."""
@staticmethod
def fetch_spec(props):
url = 'https://chromium.googlesource.com/devtools/devtools-frontend.git'
solution = {
'name' : 'devt... |
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: The root of binary tree.
@return: True if this Binary tree is Balanced, or false.
"""
def isBalanced(self, root):
# ... |
import mbuild as mb
from mbuild.lib.surfaces import Betacristobalite
from mbuild.lib.atoms import H
from mbuild.examples.alkane_monolayer.alkylsilane import AlkylSilane
class AlkaneMonolayer(mb.Monolayer):
"""An akylsilane monolayer on beta-cristobalite. """
def __init__(self, pattern, tile_x=1, tile_y=1, chain... |
from app import celery
from flask import current_app as app
from datetime import timedelta
from celery.decorators import periodic_task
from flask import jsonify, request, abort
import requests
import json
@periodic_task(run_every=(timedelta(seconds=1)))
def ping():
print "ping!"
headers = {'content-type': 'appl... |
from django.conf.urls import patterns, url
urlpatterns = patterns(
'',
url(r'^$', 'whatify.views.index'),
url(r'^search/(.+)$', 'whatify.views.search'),
url(r'^torrent_groups/(\d+)$', 'whatify.views.get_torrent_group'),
url(r'^torrent_groups/(\d+)/download$', 'whatify.views.download_torrent_group'),... |
import asposebarcodecloud
from asposebarcodecloud.BarcodeApi import BarcodeApi
from asposebarcodecloud.BarcodeApi import ApiException
import asposestoragecloud
from asposestoragecloud.StorageApi import StorageApi
from asposestoragecloud.StorageApi import ResponseMessage
import ConfigParser
config = ConfigParser.ConfigP... |
"""
This module defines Entry classes for containing experimental data.
"""
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
__date__ = "Jun 27, 2012"
from pymatgen.analysis.phase_diagram import PDE... |
import rnn
import sys
startcol = 64
fouts = {}
def printdef(name, val, file):
fout = fouts[file]
fout.write("#define {}{} {}\n".format(name, " " * (startcol - len(name)), val))
def printvalue(val, shift):
if val.varinfo.dead:
return
if val.value is not None:
printdef(val.fullname, hex(va... |
id_mappings = {
"EX1_097": "Abomination",
"CS2_188": "Abusive Sergeant",
"EX1_007": "Acolyte of Pain",
"NEW1_010": "Al'Akir the Windlord",
"EX1_006": "Alarm-o-Bot",
"EX1_382": "Aldor Peacekeeper",
"EX1_561": "Alexstrasza",
"EX1_393": "Amani Berserker",
"CS2_038": "Ancestral Spirit",
... |
""" Templates for field exporter plugin """
__revision__ = "$Id: webmessage_templates.py,v 1.32 2008/03/26 23:26:23 tibor Exp $"
import cgi
from invenio.config import CFG_SITE_LANG, CFG_SITE_URL
from invenio.base.i18n import gettext_set_language
from invenio.utils.date import convert_datestruct_to_datetext, convert_dat... |
from autotest.client.shared import error
from virttest import qemu_monitor
def run(test, params, env):
"""
QMP Specification test-suite: this checks if the *basic* protocol conforms
to its specification, which is file QMP/qmp-spec.txt in QEMU's source tree.
IMPORTANT NOTES:
o Most tests depend h... |
'''OpenGL extension NV.transform_feedback
This module customises the behaviour of the
OpenGL.raw.GL.NV.transform_feedback to provide a more
Python-friendly API
Overview (from the spec)
This extension provides a new mode to the GL, called transform feedback,
which records vertex attributes of the primitives processed ... |
print(CurrentScript().arguments) |
from __future__ import absolute_import
class DummyException(Exception):
pass
def import_global(
name, modules=None, exceptions=DummyException, locals_=None,
globals_=None, level=-1):
'''Import the requested items into the global scope
WARNING! this method _will_ overwrite your global scope
... |
""" crypto.cipher.rijndael
Rijndael encryption algorithm
This byte oriented implementation is intended to closely
match FIPS specification for readability. It is not implemented
for performance.
Copyright © (c) 2002 by Paul A. Lambert
Read LICENSE.txt for license information.
2002-06-01
"""... |
"""
Tests for L{twisted.trial.distreporter}.
"""
from cStringIO import StringIO
from twisted.trial._dist.distreporter import DistReporter
from twisted.trial.unittest import TestCase
from twisted.trial.reporter import TreeReporter
class DistReporterTestCase(TestCase):
"""
Tests for L{DistReporter}.
"""
d... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: vultr_ssh_key_info
short_description: Get infos about the Vu... |
chips = {
# Generic chip (128 bytes, 8 bytes page size)
'generic': {
'vendor': '',
'model': 'Generic',
'size': 128,
'page_size': 8,
'page_wraparound': True,
'addr_bytes': 1,
'addr_pins': 3,
'max_speed': 400,
},
# Microchip
'microchip_24... |
from gnuradio import gr, filter
from . import dtv_python as dtv
ATSC_CHANNEL_BW = 6.0e6
ATSC_SYMBOL_RATE = 4.5e6/286*684 # ~10.76 Mbaud
ATSC_RRC_SYMS = 8 # filter kernel extends over 2N+1 symbols
class atsc_rx_filter(gr.hier_block2):
def __init__(self, input_rate, sps):
gr.hier_block2.__i... |
from __future__ import print_function
from xml.etree import ElementTree
import sys, os
language, input_file = sys.argv[1:3]
if len(sys.argv) == 4:
mode = sys.argv[3]
input_dir = os.path.dirname(input_file)
index = ElementTree.parse(input_file)
def get_text(node):
paras = node.findall('para')
return str.join... |
from datetime import date, datetime, timedelta
from odoo import api, fields, models, SUPERUSER_ID, _
from odoo.exceptions import UserError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
class MaintenanceStage(models.Model):
""" Model for case stages. This models the main stages of... |
from __future__ import absolute_import
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
VERSION = '1.0.0'
README = open('README.rst').read()
setup(
name='mach',
description='Generic command line command dispatching framework.',
long_description=README,
licen... |
"""add timezone to each station
Revision ID: 4d0be367f095
Revises: 6722b0ef4e1
Create Date: 2014-03-19 16:43:00.326820
"""
revision = '4d0be367f095'
down_revision = '6722b0ef4e1'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_colu... |
from . import models
from .hooks import set_default_map_settings |
from lxml import etree
from openerp import models, fields, api
class PostlogisticsLicense(models.Model):
_name = 'postlogistics.license'
_description = 'PostLogistics Franking License'
_order = 'sequence'
name = fields.Char(string='Description',
translate=True,
... |
from openerp.osv import fields, osv
class account_balance_report(osv.osv_memory):
_inherit = "account.common.account.report"
_name = 'account.balance.report'
_description = 'Trial Balance Report'
_columns = {
'journal_ids': fields.many2many('account.journal', 'account_balance_report_journal_rel'... |
"""
Spanish Fiscal Year Closing Wizards
"""
import wizard_run |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.