content string |
|---|
"""
Helper functions for writing to terminals and files.
"""
import sys, os
import py
py3k = sys.version_info[0] >= 3
from py.builtin import text, bytes
win32_and_ctypes = False
colorama = None
if sys.platform == "win32":
try:
import colorama
except ImportError:
try:
import ctyp... |
import sys
from . import constants
from .mbcharsetprober import MultiByteCharSetProber
from .codingstatemachine import CodingStateMachine
from .chardistribution import EUCJPDistributionAnalysis
from .jpcntx import EUCJPContextAnalysis
from .mbcssm import EUCJPSMModel
class EUCJPProber(MultiByteCharSetProber):
def... |
#!/usr/bin/env python
"""
Return GeoJSON centroids for each postcode in Luxembourg
- Downloads the latest geojson from UDATA_ADDRESSES
- Average the position of all postcodes
- Spit out geojson
Run like :
python3 postcode-centroid.py > centroids.geojson
A sample centroids.geojson.xz (from 2016-07-11) is included.
... |
from __future__ import absolute_import, division, print_function
import collections
import itertools
import re
from ._structures import Infinity
__all__ = [
"parse", "Version", "LegacyVersion", "InvalidVersion", "VERSION_PATTERN"
]
_Version = collections.namedtuple(
"_Version",
["epoch", "release", "d... |
# -*- encoding:utf-8 -*-
from __future__ import unicode_literals
MESSAGES = {
"%d min remaining to read": "",
"(active)": "",
"Also available in:": "",
"Archive": "",
"Authors": "",
"Categories": "",
"Comments": "",
"LANGUAGE": "",
"Languages:": "",
"More posts about %s": "",
... |
"""
Searches nyt API for articles related to climate change and returns them.
API returns pages, each page has 10 articles. This currently only returns one page.
Cannot specify how many articles per page in api.
get_trending function returns articles for the past 3 days.
"""
from nytimesarticle impor... |
"""Script for testing ganeti.server.rapi"""
import re
import unittest
import random
import mimetools
import base64
from cStringIO import StringIO
from ganeti import constants
from ganeti import utils
from ganeti import compat
from ganeti import errors
from ganeti import serializer
from ganeti import rapi
from ganeti ... |
# -*- coding: utf-8 -*-
from poser.apphook_pool import apphook_pool
from poser.utils.page_resolver import get_page_queryset
from django.conf import settings
from django.conf.urls.defaults import patterns
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
from django.co... |
import os
import json
import time
import re
import random
from modules import userDatabase
class CaseInsensitiveDict(dict):
def __contains__(self, key):
return dict.__contains__(self, key.lower())
def __getitem__(self, key):
return dict.__getitem__(self, key.lower())
def __setitem__(self... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
import json
import sys
try:
import boto
import boto.iam
import boto.ec2
HAS_BOTO = True
except ImportError:
HAS_BOTO = False
def boto_exception(err):
'''generic err... |
# -*- coding: utf-8 -*-
import logging
import threading
from openerp import _, api, fields, models, tools
from openerp.osv import expression
_logger = logging.getLogger(__name__)
class Partner(models.Model):
""" Update partner to add a field about notification preferences. Add a generic opt-out field that can b... |
"""
Filename: test_graph_tools.py
Author: Daisuke Oyama
Tests for graph_tools.py
"""
import sys
import numpy as np
from numpy.testing import assert_array_equal
import nose
from nose.tools import eq_, ok_, raises
from quantecon.graph_tools import DiGraph
def list_of_array_equal(s, t):
"""
Compare two lists ... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from units.compat.mock import patch
from ansible.playbook.task import Task
from ansible.parsing.yaml import objects
from ansible import errors
basic_command_task = dict(
name='Test Task',
... |
import matplotlib.pyplot as pyplot
import Moog960
import MoogTools
import numpy
import glob
correctionFiles = glob.glob('/home/deen/MoogPyData/AbsorptionLines/corrections/*Solar_results.dat')
solarSpectrum = Moog960.ObservedMelody.fromFile(filename='SolarSpectrum.fits')
solarSpectrum.loadData()
arcturusSpectrum = Mo... |
from common.globals import handle_err_msg
from common.globals import format_citystatezip
import consts.switches as switches
class HomeObj(object):
def __init__(self, type, address, city, state, zip, dom, listing_id, beds, baths, yearbuilt, sqfootage, lotsize, latitude, longitude, homelink, graphlink, maplink, comp... |
from __future__ import unicode_literals
from django import forms
from django.contrib.admin.util import (flatten_fieldsets, lookup_field,
display_for_field, label_for_field, help_text_for_field)
from django.contrib.admin.templatetags.admin_static import static
from django.contrib.contenttypes.models import ContentT... |
"""
Starter fabfile for deploying the bigfattemplate project.
Change all the things marked CHANGEME. Other things can be left at their
defaults if you are happy with the default layout.
"""
import posixpath
from fabric.api import run, local, env, settings, cd, task
from fabric.contrib.files import exists
from fabric... |
""" Test Shannon entropy calculations """
import unittest
import math
from sparktkregtests.lib import sparktk_test
class EntropyTest(sparktk_test.SparkTKTestCase):
def test_entropy_coin_flip(self):
""" Get entropy on balanced coin flip. """
# initialize data and expected result
frame_load... |
# -*-coding:utf-8-*-
import string
class senseWord():
def __init__(self):
self.list=[]
self.word=[]
inputfile=file('filtered_word.txt','r')
for lines in inputfile.readlines():
self.list.append(lines.decode('utf-8').encode('gbk'))#I've set the file coding type as utf-8
... |
from __future__ import unicode_literals
import calendar
import datetime
from django.utils.html import avoid_wrapping
from django.utils.timezone import is_aware, utc
from django.utils.translation import ugettext, ungettext_lazy
TIMESINCE_CHUNKS = (
(60 * 60 * 24 * 365, ungettext_lazy('%d year', '%d years')),
... |
{
'name': 'Cancel Journal Entries',
'version': '1.1',
'author': 'OpenERP SA',
'category': 'Accounting & Finance',
'description': """
Allows canceling accounting entries.
====================================
This module adds 'Allow Canceling Entries' field on form view of account journal.
If set to ... |
from website.models import User
from rest_framework import permissions
class ReadOnlyOrCurrentUser(permissions.BasePermission):
""" Check to see if the request is coming from the currently logged in user,
and allow non-safe actions if so.
"""
def has_object_permission(self, request, view, obj):
... |
#!/usr/bin/env python
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import (
assertGreaterEqual,
expect_warnings,
get_params,
gettestcases,
expe... |
"""
Example Airflow DAG that uses Google AutoML services.
"""
import os
from airflow import models
from airflow.providers.google.cloud.hooks.automl import CloudAutoMLHook
from airflow.providers.google.cloud.operators.automl import (
AutoMLCreateDatasetOperator, AutoMLDeleteDatasetOperator, AutoMLDeleteModelOperato... |
"""Tests the text output of Google C++ Testing Framework.
SYNOPSIS
gtest_output_test.py --build_dir=BUILD/DIR --gengolden
# where BUILD/DIR contains the built gtest_output_test_ file.
gtest_output_test.py --gengolden
gtest_output_test.py
"""
__author__ = '<EMAIL> (Zhanyong Wan)'
import ... |
"""Edit the properties of a service group."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import loadbal
import click
@click.command()
@click.argument('identifier')
@click.option('--enabled / --disabled',
default=None,
... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urlparse,
)
from ..utils import (
determine_ext,
int_or_none,
)
class QuickVidIE(InfoExtractor):
_VALID_URL = r'https?://(www\.)?quickvid\.org/watch\.php\?v=(?P<id>[a-zA-Z_0-9-]+)'
_... |
from __future__ import print_function
# $example on$
from pyspark.ml.feature import StopWordsRemover
# $example off$
from pyspark.sql import SparkSession
if __name__ == "__main__":
spark = SparkSession\
.builder\
.appName("StopWordsRemoverExample")\
.getOrCreate()
# $example on$
s... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import aria2app.a2jsonrpc as a2jsonrpc
import aria2app.a2config as a2config
######################## Convenience Methods for Server#############################
class Aria2ServerWrapper(object):
def __init__(self, cfgfile, token=None):
self.tok... |
from django.core.urlresolvers import reverse
from django import http
from mox3.mox import IsA # noqa
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
INDEX_URL = reverse('horizon:project:volumes:index')
VOLUME_SNAPSHOTS_TAB_URL = reverse('horizon:project:volumes:snapshots_ta... |
#!/usr/bin/python
import copy
import multiprocessing
import os
import subprocess
import sys
import tempfile
import time
import traceback
class Builder(object):
"""Class that represents the actions for a builder"""
def __init__(self, repeat_no_clean):
self.repeat_no_clean = repeat_no_clean
self... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import unittest
from copy import copy
from decimal import Decimal
from django.conf import settings
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geos import HAS_GEOS
from django.db import connection
from django.test impor... |
"""Parameters for PyTables."""
__docformat__ = 'reStructuredText'
"""The format of documentation strings in this module."""
_KB = 1024
"""The size of a Kilobyte in bytes"""
_MB = 1024 * _KB
"""The size of a Megabyte in bytes"""
# Tunable parameters
# ==================
# Be careful when touching these!
# Parameter... |
# -*- coding: utf-8 -*-
import itertools
import openerp.modules.registry
import openerp
from openerp.tests import common
class CreatorCase(common.TransactionCase):
model_name = False
def __init__(self, *args, **kwargs):
super(CreatorCase, self).__init__(*args, **kwargs)
self.model = None
... |
'''
ROH Wrestling Add-on
Copyright (C) 2017 BludhavenGrayson
Copyright (C) 2016 rw86
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 la... |
"""Utilities for dealing with the python unittest module."""
import fnmatch
import sys
import unittest
class _TextTestResult(unittest._TextTestResult):
"""A test result class that can print formatted text results to a stream.
Results printed in conformance with gtest output format, like:
[ RUN ] autofi... |
# -*- coding: utf-8 -*-
"""
.. _tut_phantom_4Dbti:
============================================
4D Neuroimaging/BTi phantom dataset tutorial
============================================
Here we read 4DBTi epochs data obtained with a spherical phantom
using four different dipole locations. For each condition we
comput... |
"""Beam fn API log handler."""
# pytype: skip-file
from __future__ import absolute_import
from __future__ import print_function
import logging
import math
import queue
import sys
import threading
import time
import traceback
import grpc
from apache_beam.portability.api import beam_fn_api_pb2
from apache_beam.porta... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
try:
from pyVmomi import vim, vmodl
HAS_PYVMOMI = True
except ImportError:
HAS_PYVMOMI = False
# https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/execute... |
import imp
import os
from six.moves.urllib.parse import urljoin
from fnmatch import fnmatch
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
from xml.etree import ElementTree
here = os.path.dirname(__file__)
localpaths = imp.load_source("localpaths", os.path.abspath(os.path.join(here,... |
from django.conf.urls import url
from django.contrib.auth.models import User
from rest_framework.authentication import TokenAuthentication
from rest_framework.authtoken.models import Token
from rest_framework.test import APITestCase
from rest_framework.views import APIView
urlpatterns = [
url(r'^$', APIView.as_vi... |
import unittest
import random, sys, time, re
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_glm, h2o_util, h2o_rf, h2o_jobs as h2j
DO_DELETE_KEYS_AND_CAUSE_PROBLEM = False
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_er... |
from views.tasks_list_view import convert_time
use_kv_file = False
form_input_formats = [
{
'label': 'Title',
'key': 'title',
'formatter': None
},
{
'label': 'Description',
'key': 'body',
'formatter': None,
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Auteur : Marc-Antoine Fortier
Date : Mars 2015
"""
import json
HP_DEVICES = ("HP", "Hewlett-Packard", "ProCurve")
JUNIPER_DEVICES = ("Juniper", "JUNOS")
LINUX_DEVICES = ("Linux", "Debian", "Ubuntu")
SUPPORTED_DEVICES = HP_DEVICES + JUNIPER_DEVICES + LINUX_DEVICES
... |
from compiled_file_system import Unicode
from extensions_paths import (
API_FEATURES, JSON_TEMPLATES, MANIFEST_FEATURES, PERMISSION_FEATURES)
import features_utility
from future import Gettable, Future
from third_party.json_schema_compiler.json_parse import Parse
def _AddPlatformsFromDependencies(feature,
... |
#!/usr/bin/env python
from __future__ import print_function
import os, sys, json
from common_paths import *
import spec_validator
import argparse
def expand_test_expansion_pattern(spec_test_expansion, test_expansion_schema):
expansion = {}
for artifact in spec_test_expansion:
artifact_value = spec_t... |
from billy.utils.fulltext import pdfdata_to_text, text_after_line_numbers
from .bills import HIBillScraper
from .legislators import HILegislatorScraper
from .events import HIEventScraper
settings = dict(SCRAPELIB_TIMEOUT=300)
metadata = dict(
name='Hawaii',
abbreviation='hi',
capitol_timezone='Pacific/Hon... |
# -*- coding: utf-8 -*-
import unittest
from trac.ticket.model import Ticket
from trac.ticket.roadmap import Milestone
from trac.wiki.tests import formatter
TICKET_TEST_CASES = u"""
============================== ticket: link resolver
ticket:1
ticket:12
ticket:abc
------------------------------
<p>
<a class="new tic... |
"""
SoftLayer.CLI.template
~~~~~~~~~~~~~~~~~~~~~~
Provides functions for loading/parsing and writing template files. Template
files are used for storing CLI arguments in the form of a file to be used
later with the --template option.
:license: MIT, see LICENSE for more details.
"""
import os.pa... |
import sys
from _pydevd_bundle import pydevd_xml
from os.path import basename
import traceback
try:
from urllib import quote, quote_plus, unquote, unquote_plus
except:
from urllib.parse import quote, quote_plus, unquote, unquote_plus #@Reimport @UnresolvedImport
#==============================================... |
import mock
from neutron.agent.linux import ovsdb_monitor
from neutron.tests import base
class TestOvsdbMonitor(base.BaseTestCase):
def setUp(self):
super(TestOvsdbMonitor, self).setUp()
self.monitor = ovsdb_monitor.OvsdbMonitor('Interface')
def read_output_queues_and_returns_result(self, o... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
WSGI config for the OMERO.web project.
Copyright 2014 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
"""
This module contains the WSGI application used by Django's development server
and any productio... |
ip_range = {
# TODO(eliqiao) need to find a better pattern
'type': 'string',
'pattern': '^[0-9./a-fA-F]*$',
}
create = {
'type': 'object',
'properties': {
'floating_ips_bulk_create': {
'type': 'object',
'properties': {
'ip_range': ip_range,
... |
__revision__ = "src/engine/SCons/Tool/mssdk.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
"""engine.SCons.Tool.mssdk
Tool-specific initialization for Microsoft SDKs, both Platform
SDKs and Windows SDKs.
There normally shouldn't be any need to import this module directly.
It will usually be imported thro... |
import numpy as np
from astropy import log
from pyspeckit.spectrum.readers import read_class
from make_apex_cubes import all_apexfiles
import os
import paths
import collections
"""
Calibrators can be IDd with:
for ds in all_apexfiles:
cl = read_class.ClassObject(ds)
spdata = cl.get_spectra(line='CO(2-1)', ra... |
"""New implementation of Visual Studio project generation."""
import os
import random
import gyp.common
# hashlib is supplied as of Python 2.5 as the replacement interface for md5
# and other secure hashes. In 2.6, md5 is deprecated. Import hashlib if
# available, avoiding a deprecation warning under 2.6. Import ... |
from collections import Counter
from datetime import datetime
from dateutil.tz import tzutc
import hashlib
import jmespath
import json
from .core import BaseAction
from c7n.utils import (
type_schema, local_session, chunks, dumps, filter_empty, get_partition)
from c7n.exceptions import PolicyValidationError
from... |
from openerp.osv import fields, orm
class policy_presence(orm.Model):
_name = 'hr.policy.presence'
_columns = {
'name': fields.char('Name', size=128, required=True),
'date': fields.date('Effective Date', required=True),
'work_days_per_month': fields.integer(
'Working Days... |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals
import json
import os
from osbs.api import OSBS
from osbs.conf import Configuration
from atomic_rea... |
# This line prints out a string about counting chickens.
print "I will now count my chickens:"
# This line prints the string "Hens" concatenated with the value derived from dividing 30 by 6 and then adding 5. (which is 30)
print "Hens", 25.0 + 30 / 6
# Prints Roosters although I do not understand how the result i... |
"""
Middleware that tests the validity of all generated HTML using the
`WDG HTML Validator <http://www.htmlhelp.com/tools/validator/>`_
"""
from cStringIO import StringIO
import subprocess
from paste.response import header_value
import re
import cgi
__all__ = ['WDGValidateMiddleware']
class WDGValidateMiddleware(obj... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
doDEM.py
---------------------
Date : March 2011
Copyright : (C) 2011 by Giuseppe Sucameli
Email : brush dot tyler at gmail dot com
*********************... |
import testtools
from cloudify import decorators
from cloudify.workflows import tasks
from cloudify.test_utils import workflow_test
@decorators.operation
def operation(ctx, arg, total_retries=0, **_):
runtime_properties = ctx.instance.runtime_properties
invocations = runtime_properties.get('invocations', []... |
"""local_session_caching.py
Grok everything so far ? This example
creates a new dogpile.cache backend that will persist data in a dictionary
which is local to the current session. remove() the session
and the cache is gone.
Create a new Dogpile cache backend that will store
cached data local to the current Sessio... |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2018 (ita)
"""
Support for translation tools such as msgfmt and intltool
Usage::
def configure(conf):
conf.load('gnu_dirs intltool')
def build(bld):
# process the .po files into .gmo files, and install them in LOCALEDIR
bld(features='intltool_po', ... |
#!/usr/bin/env python
#
# Wrapper script for starting the biopet-extractadaptersfastqc JAR package
#
# This script is written for use with the Conda package manager and is copied
# from the peptide-shaker wrapper. Only the parameters are changed.
# (https://github.com/bioconda/bioconda-recipes/blob/master/recipes/pepti... |
'''
SimpleListAdapter
=================
.. versionadded:: 1.5
.. warning::
This code is still experimental, and its API is subject to change in a
future version.
:class:`~kivy.adapters.simplelistadapter.SimpleListAdapter` is for basic lists,
such as for showing a text-only display of strings, that have no u... |
import bouwer.util
from test import *
class DummySingleton1(bouwer.util.Singleton):
""" First Dummy Singleton class """
def __init__(self, arg1, arg2):
""" Constructor """
self.arg1 = arg1
self.arg2 = arg2
class DummySingleton2(bouwer.util.Singleton):
""" Second Dummy Singleton cl... |
from openerp import tools
from openerp.osv import fields,osv
import openerp.addons.decimal_precision as dp
class account_treasury_report(osv.osv):
_name = "account.treasury.report"
_description = "Treasury Analysis"
_auto = False
def _compute_balances(self, cr, uid, ids, field_names, arg=None, context... |
"""Module for discover nodes requests."""
from pyvlx.const import Command, NodeType
from .frame import FrameBase
class FrameDiscoverNodesRequest(FrameBase):
"""Frame for discover nodes request."""
PAYLOAD_LEN = 1
def __init__(self, node_type=NodeType.NO_TYPE):
"""Init Frame."""
super().... |
from __future__ import unicode_literals, print_function, division
from sys import argv
import coh
import logging
import os
from itertools import chain
import nltk
from nltk.data import load
import multiprocessing
coh.config.from_object('config')
logger = logging.getLogger(__name__)
stopwords = nltk.corpus.stopwords.... |
from odoo import api, fields, models
class StockScrap(models.Model):
_inherit = 'stock.scrap'
production_id = fields.Many2one(
'mrp.production', 'Manufacturing Order',
states={'done': [('readonly', True)]}, check_company=True)
workorder_id = fields.Many2one(
'mrp.workorder', 'Work... |
import unittest
from test import test_support
def funcattrs(**kwds):
def decorate(func):
func.__dict__.update(kwds)
return func
return decorate
class MiscDecorators (object):
@staticmethod
def author(name):
def decorate(func):
func.__dict__['author'] = name
... |
from openerp import SUPERUSER_ID
from openerp.addons.web import http
from openerp.addons.web.http import request
from openerp.addons.website_event.controllers.main import website_event
from openerp.tools.translate import _
class website_event(website_event):
@http.route(['/event/cart/update'], type='http', auth=... |
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from student.models import UserTestGroup
import random
import sys
import datetime
import json
from pytz import UTC
def group_from_value(groups, v):
''' Given group: (('a',0.3),('b',0.4),('c',0.3)) And random value
... |
import json
import logging
import pytz
import datetime
import dateutil.parser
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import redirect
from django.conf import settings
from mitxmako.shortcuts import render_to_response
from django_future.csrf ... |
import os
import sys
import time
import pyauto_functional # Must be imported before pyauto
import pyauto
import test_utils
class MemoryTest(pyauto.PyUITest):
"""Tests for memory usage of Chrome-related processes.
These tests are meant to be used manually, not as part of the continuous
test cycle. This is be... |
# -*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from django.utils import timezone
from tinymce.models import HTMLField
# Create your models here.
class Subject(models.Model):
"""
name:
description: is a new field that comes packaged with
django-tinymce. It enables... |
"""Helpers to deal with permissions."""
from functools import wraps
from typing import Callable, Dict, List, Optional, Union, cast # noqa: F401
from .const import SUBCAT_ALL
from .models import PermissionLookup
from .types import CategoryType, SubCategoryDict, ValueType
LookupFunc = Callable[[PermissionLookup, SubC... |
#! /usr/bin/env python3
"""
"PYSTONE" Benchmark Program
Version: Python/1.1 (corresponds to C/1.1 plus 2 Pystone fixes)
Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
Translated from ADA to C by Rick Richardson.
Every method to preserve ADA-likeness ... |
"""Mapreduce execution context.
Mapreduce context provides handler code with information about
current mapreduce execution and organizes utility data flow
from handlers such as counters, log messages, mutation pools.
"""
__all__ = ["get",
"Pool",
"Context",
"COUNTER_MAPPER_CALLS",
... |
import ctypes
import ConfigParser
import logging
from archipelago.common import (
Request,
xseg_reply_map,
xseg_reply_map_scatterlist,
string_at,
XF_ASSUMEV0,
XF_MAPFLAG_READONLY,
)
from pithos.workers import (
glue,
monkey,
)
monkey.patch_Request()
logger = logging.getLogger... |
"""
Tests related to the basic footer-switching based off SITE_NAME to ensure
edx.org uses an edx footer but other instances use an Open edX footer.
"""
from nose.plugins.attrib import attr
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from openedx.... |
from django.contrib.auth.checks import (
check_models_permissions, check_user_model,
)
from django.contrib.auth.models import AbstractBaseUser
from django.core import checks
from django.db import models
from django.test import (
SimpleTestCase, override_settings, override_system_checks,
)
from django.test.utils... |
from oslo_utils import strutils
from webob import exc
from nova.api.openstack import common
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import compute
from nova import context as nova_context
from nova import exception
from nova.i18n import _
from nova import utils
authoriz... |
""" Various HBase helpers
"""
import copy
import datetime
import json
import bson.json_util
from happybase.hbase import ttypes
from oslo_log import log
import six
from ceilometer.i18n import _
from ceilometer import utils
LOG = log.getLogger(__name__)
EVENT_TRAIT_TYPES = {'none': 0, 'string': 1, 'integer': 2, 'floa... |
"""publishes state-enter and state-leave events to Watchman
Extension that is responsible for publishing state-enter and state-leave
events to Watchman for the following states:
- hg.filemerge
- hg.update
This was originally part of the fsmonitor extension, but it was split into its
own extension that can be used wi... |
# -*- coding: utf-8 -*-
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 'TestCenterRegistration'
db.create_table('student_testcenterregistration', (
('id... |
from openerp import tools
from openerp.osv import fields, osv
class hr_evaluation_report(osv.Model):
_name = "hr.evaluation.report"
_description = "Evaluations Statistics"
_auto = False
_columns = {
'create_date': fields.date('Create Date', readonly=True),
'delay_date': fields.float('D... |
########################################################################
# $HeadURL $
# File: TracedTests.py
########################################################################
""" :mod: TracedTests
=======================
.. module: TracedTests
:synopsis: Traced test cases
.. moduleauthor:: <E... |
"""A module target for TraverseTest.test_module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.tools.common import test_module2
class ModuleClass1(object):
def __init__(self):
self._m2 = test_module2.ModuleClass2()
def __mod... |
"""
@author: Nick Gk (@ngkogkos)
@license: The MIT License (MIT)
@contact: <EMAIL>
"""
# Volatility's stuff
import volatility.commands as commands
import volatility.scan as scan
import volatility.utils as utils
import volatility.addrspace as addrspace
import volatility.obj as obj
from volatility.render... |
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = r'''
options:
file_mode:
description:
- Don't connect to any device, only use I(config_file) as input and Output.
type: bool
default: no
version_added: "2.4"
config_file:
description:
- ... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class TMZIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tmz\.com/videos/(?P<id>[^/]+)/?'
_TEST = {
'url': 'http://www.tmz.com/videos/0_okj015ty/',
'md5': '791204e3bf790b1426cb2db0706184c0',
... |
from whoosh.util.text import rcompile
# Tagger objects
class Tagger(object):
"""Base class for taggers, objects which match syntax in the query string
and translate it into a :class:`whoosh.qparser.syntax.SyntaxNode` object.
"""
def match(self, parser, text, pos):
"""This method should see i... |
"""
NOTE: Anytime a `key` is passed into a function here, we assume it's a raw byte
string. It should *not* be a string representation of a hex value. In other
words, passing the `str` value of
`"32fe72aaf2abb44de9e161131b5435c8d37cbdb6f5df242ae860b283115f2dae"` is bad.
You want to pass in the result of calling .decode... |
from openerp.osv import fields, osv
class account_invoice(osv.osv):
_inherit = 'account.invoice'
def action_number(self, cr, uid, ids, *args, **kargs):
result = super(account_invoice, self).action_number(cr, uid, ids, *args, **kargs)
for inv in self.browse(cr, uid, ids):
self.pool.... |
from __future__ import with_statement, absolute_import
from django.test import TestCase
from .models import Domain, Kingdom, Phylum, Klass, Order, Family, Genus, Species
class SelectRelatedTests(TestCase):
def create_tree(self, stringtree):
"""
Helper to create a complete tree.
"""
... |
import sys
import time
import os
import subprocess
import webbrowser
import threading
import traceback
from django.http import HttpResponse
from django.shortcuts import render
from robot_control.models import Category, Question, Response
from django.core.mail import send_mail
import json
MAX_TIME = 180 # seconds
POR... |
#!/usr/bin/env python
# encoding: utf-8
# PYTHON_ARGCOMPLETE_OK
# from __future__ imports must occur at the beginning of the file
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
import sys
import logging
import json
from functools import partial
import r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.