content stringlengths 4 20k |
|---|
class ModuleDocFragment(object):
# Standard cloudstack documentation fragment
DOCUMENTATION = '''
options:
api_key:
description:
- API key of the CloudStack API.
required: false
default: null
api_secret:
description:
- Secret key of the CloudStack API.
required: false
de... |
import logging
import mock
import pytest
from clog import handlers, loggers
class TestScribeHandler(object):
@pytest.fixture(autouse=True)
def setup_handler(self):
args = 'localhost', 4545, 'test_stream'
self.handler = handlers.ScribeHandler(*args)
self.record = logging.LogRecord(
... |
"""
Decomposition of the circuit constraint in Google CP Solver.
Cf Global constraint catalog:
http://www.emn.fr/x-info/sdemasse/gccat/Ccircuit.html
Solution of n=4:
x: [2, 0, 3, 1]
x: [3, 0, 1, 2]
x: [1, 3, 0, 2]
x: [3, 2, 0, 1]
x: [1, 2, 3, 0]
x: [2, 3, 1, 0]
The 'orbit' method that is used... |
"""Utility file for visualizing generated images."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.gan.python.eval.python import eval_utils_impl
# pylint: disable=wildcard-import
from tensorflow.contrib.gan.python.eval.python.eval_... |
import logging
import os
import subprocess
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.core.backends import browser_backend
from telemetry.core.backends.chrome import chrome_browser_backend
class CrOSBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
# Some develop... |
"""A node transformer that includes utilities for SCT."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import enum
import gast
from tensorflow.python.autograph.pyct import anno
from tensorflow.python.autograph.pyct import parser
from... |
import sys, os
from pmx import *
options = [
Option( "-s", "string", "default_string", "Description of what this string options is doing"),
Option("-f", "float", 3.1415,"Description of what this float option is doing"),
Option("-i","int",42,"Description of what this int option is doing"),
Option("-b","... |
import sys
import unittest
import mock
from nose.tools import eq_, raises
from ryu.cmd.manager import main
class Test_Manager(unittest.TestCase):
"""Test ryu-manager command
"""
def __init__(self, methodName):
super(Test_Manager, self).__init__(methodName)
def setUp(self):
pass
... |
from communication import create_socket
import select
import socket
import sys
from time import gmtime, strftime
from communication import synchronize_symm
from crypto import decrypt, encrypt, text2ascii, gen_symm_key
from datetime import datetime
import os
VERSION = 0.1 # Client Application Protocol Version
nickname... |
# -*- coding: utf-8 -*-
"""
Tests for leaderboard handlers in Open Assessment XBlock.
"""
import json
from random import randint
from urlparse import urlparse
import boto
from boto.s3.key import Key
import mock
from moto import mock_s3
from django.core.cache import cache
from django.test.utils import override_setting... |
from __future__ import absolute_import
# This file needs to be different from cache.py because cache.py
# cannot import anything from zerver.models or we'd have an import
# loop
from django.conf import settings
from zerver.models import Message, UserProfile, Stream, get_stream_cache_key, \
Recipient, get_recipient... |
import numpy as np
import scipy.io as sio
# Taken from http://stackoverflow.com/questions/7008608/scipy-io-loadmat-nested-structures-i-e-dictionaries
def loadmat(filename):
'''
this function should be called instead of direct sio.loadmat
as it cures the problem of not properly recovering python dictionarie... |
"""Ops related to Tensor Processing Units.
@@cross_replica_sum
@@infeed_dequeue
@@infeed_dequeue_tuple
@@infeed_enqueue
@@infeed_enqueue_tuple
@@outfeed_dequeue
@@outfeed_dequeue_tuple
@@outfeed_enqueue
@@outfeed_enqueue_tuple
@@initialize_system
@@shutdown_system
@@device_assignment
@@core
@@replicate
@@shard
@@batc... |
import urllib
import re
try:
import xml.etree.cElementTree as etree
except ImportError:
import elementtree.ElementTree as etree
import sickbeard
import generic
from sickbeard.common import Quality
from sickbeard import logger
from sickbeard import tvcache
from sickbeard import helpers
class E... |
from __future__ import absolute_import
import io
from google.api_core import protobuf_helpers as protobuf
class VisionHelpers(object):
"""A set of convenience methods to make the Vision GAPIC easier to use.
This class should be considered abstract; it is used as a superclass
in a multiple-inheritance co... |
# I'm going to move all that data dictionary work that has been done
# in odk_logger.models.XForm over to here.
class OldXFormParser(object):
def __init__(self, xml):
assert type(xml)==str or type(xml)==unicode, u"xml must be a string"
self.doc = minidom.parseString(xml)
self.root_node = se... |
from __future__ import absolute_import
import json
import ddt
import mock
from django.urls import reverse
from six.moves import range
from ecommerce.tests.factories import UserFactory
from ecommerce.tests.testcases import TestCase
JSON_CONTENT_TYPE = 'application/json'
@ddt.ddt
@mock.patch('django.conf.settings.U... |
version = '0.14.1' |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
USER_AGENT_VERSION = 'v1'
USER_AGENT_PRODUCT = 'Ansible-gce_eip'
try:
import libcloud
from libcloud.compute.types import Provider
from libcloud.compute.providers impor... |
import sys # noqa
try:
import boto.ec2
import boto.vpc
from boto.exception import EC2ResponseError
HAS_BOTO = True
except ImportError:
HAS_BOTO = False
if __name__ != '__main__':
raise
class AnsibleIGWException(Exception):
pass
def ensure_igw_absent(vpc_conn, vpc_id, check_mode... |
import pickle
from nose.tools import eq_
from .. import indonesian
from ...datasources import revision_oriented
from ...dependencies import solve
from .util import compare_extraction
BAD = [
"anjing",
"bajingan",
"bangsat",
"bispak",
"bloon", "blo'on",
"brengsek", "brengsex",
"bencong",
... |
from django.core.exceptions import ValidationError
from cyder.base.tests import ModelTestMixin, TestCase
from cyder.core.ctnr.models import Ctnr
from cyder.cydns.txt.models import TXT
from cyder.cydns.domain.models import Domain
from cyder.core.ctnr.models import Ctnr
class TXTTests(TestCase, ModelTestMixin):
de... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import json
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils... |
import time
import serial
import sys
import json
ser = serial.Serial(
port='/dev/ttyUSB0', # or /dev/ttyAMA0 for serial on the PI
baudrate=9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
xonxoff=0, rtscts=0, dsrdtr=0,
)
ser.open()
ser.isOpen()
endtime = time.time()+0.2 ... |
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
from django.db import models
from tinymce.widgets import AdminTinyMCE
class FlatPageAdmin(admin.ModelAdmin):
formfield_overrides = {
models.TextField: {'widget': AdminTinyMCE},
}
admin.site.unregister(FlatPage)
admi... |
import dbus
class MprisPlaying:
def __init__(self):
self.artist = self.title = self.album = self.status = None
self.metadata = self.playbackstatus = None
self.bus = dbus.SessionBus()
def getData(self, interface, path):
stop = False
try:
mpris = self.bus.get... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j E Y'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = 'j E Y H:i'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j F'
SHORT_DATE_FORMAT = 'd-m-Y... |
"""Trains the MNIST network using preloaded data stored in a variable.
Run using bazel:
bazel run -c opt \
<...>/tensorflow/examples/how_tos/reading_data:fully_connected_preloaded_var
or, if installed via pip:
cd tensorflow/examples/how_tos/reading_data
python fully_connected_preloaded_var.py
"""
from __future_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
| This file is part of the web2py Web Framework
| Copyrighted by Massimo Di Pierro <<EMAIL>>
| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
import re
import cgi
__all__ = ['highlight']
class Highlighter(object):
"""Does syntax highlighting.
... |
"""Resolvers module.""" |
""" Generator for C style prototypes and definitions """
import glob
import os
import re
import sys
from idl_log import ErrOut, InfoOut, WarnOut
from idl_node import IDLAttribute, IDLNode
from idl_ast import IDLAst
from idl_option import GetOption, Option, ParseOptions
from idl_outfile import IDLOutFile
from idl_pars... |
# -*- coding: utf-8 -*-
import inspect
from django.utils.translation import gettext_lazy as _
class AuthorizationDef:
def __init__(self, codename, label, staff_only=False):
self.codename = codename
self.label = label
self.staff_only = staff_only
class AuthorizationConfig:
""" Defin... |
from nova.db.sqlalchemy import api as model_api
from nova.db.sqlalchemy.models import PciDevice, Instance, ComputeNode
import collections
#, VFAllocation
session = model_api.get_session()
WORK_LOAD = ["cp","cr"]
def execute_vf_allocation(req_vf,los,req_work,bus_list, *args,**kwargs):
"""This method is ... |
import gc
#---- Default implementation when resource is missing ----------------------
PAGE_SIZE = 4096
def getMemoryLimit():
"""
Get current memory limit in bytes.
Return None on error.
"""
return None
def setMemoryLimit(max_mem):
"""
Set memory limit in bytes.
Use value 'None' to d... |
#
# test/stage.py
#
import os
from shutil import rmtree
from sys import argv
from optparse import OptionParser
from gittyup.client import GittyupClient
from gittyup.objects import *
from util import touch, change
parser = OptionParser()
parser.add_option("-c", "--cleanup", action="store_true", default=False)
(option... |
from sos.plugins import Plugin, RedHatPlugin
class Lustre(Plugin, RedHatPlugin):
'''Lustre filesystem'''
plugin_name = 'lustre'
profiles = ('storage', 'network', 'cluster', )
packages = ('lustre', 'lustre-client', )
def get_params(self, name, param_list):
'''Use lctl get_param to collect... |
from __future__ import print_function
import argparse
import glob
import os
import re
import sys
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"filenames", help="list of files to check, all files if unspecified", nargs='*')
rootdir = os.path.dirname(__file__) + "/../"
... |
from openerp.addons.account.tests.account_test_classes import AccountingTestCase
class TestAccountValidateAccount(AccountingTestCase):
def test_account_validate_account(self):
account_move_line = self.env['account.move.line']
account_cash = self.env['account.account'].search([('user_type_id.type',... |
import os
from addons.base.apps import BaseAddonAppConfig
HERE = os.path.dirname(os.path.abspath(__file__))
NODE_SETTINGS_TEMPLATE = os.path.join(
HERE,
'templates',
'zotero_node_settings.mako',
)
class ZoteroAddonAppConfig(BaseAddonAppConfig):
name = 'addons.zotero'
label = 'addons_zotero'
f... |
# -*- coding: utf-8 -*-
"""
SOCKS support for urllib3
~~~~~~~~~~~~~~~~~~~~~~~~~
This contrib module contains provisional support for SOCKS proxies from within
urllib3. This module supports SOCKS4 (specifically the SOCKS4A variant) and
SOCKS5. To enable its functionality, either install PySocks or install this
module w... |
"""
Authoritative resolvers.
"""
from __future__ import absolute_import, division
import os
import time
from twisted.names import dns, error, common
from twisted.internet import defer
from twisted.python import failure
from twisted.python.compat import execfile, nativeString, _PY3
from twisted.python.filepath import... |
# Common framework for syncdb actions
import copy
from django.core import management
from django.conf import settings
# Make sure the template loader cache is fixed _now_ (#448)
import django.template.loaders.app_directories
from south.hacks import hacks
from south.management.commands.syncdb import Command as SyncC... |
import errno
import os
from swift import gettext_ as _
from swift import __version__ as swiftver
from swift.common.swob import Request, Response
from swift.common.utils import get_logger, config_true_value, json, \
SWIFT_CONF_FILE
from swift.common.constraints import check_mount
from resource import getpagesize
fr... |
import warnings
from mutagen._util import DictMixin, loadfile
from mutagen._compat import izip
class FileType(DictMixin):
"""FileType(filething, **kwargs)
Args:
filething (filething): A filename or a file-like object
Subclasses might take further options via keyword arguments.
An abstract ... |
"""Test for the rpc proxy class."""
import unittest
import os
try:
import autotest.common as common
except ImportError:
import common
from autotest.cli import rpc
from autotest.client.shared.settings import settings
class rpc_unittest(unittest.TestCase):
def setUp(self):
self.old_environ = os.en... |
import open_questionnaire
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
# SQLAlchemy database URI. Currently tested, PGSQL, SQLite. Many others should
# also work fine.
SQLALCHEMY_DATABASE_URI = "mydatabaseuri"
# Set to true if you want people to be able to post Tweets from the site index.
INDEX_POSTING_ENABLED = True
# Number of handles an IP address can add to the opted-out list in an ... |
#!/usr/bin/env python3
import argparse
import sys
import os
from mbzextract import mbz
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='''A utility to extract files
from a .mbz Moodle backup file''')
parser.add_argument("input",
metavar="MOODLE BACKUP FI... |
"""
Useful form fields for use with SQLAlchemy ORM.
"""
from __future__ import unicode_literals
import operator
from wtforms import widgets
from wtforms.compat import text_type, string_types
from wtforms.fields import SelectFieldBase
from wtforms.validators import ValidationError
try:
from sqlalchemy.orm.util im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import warnings
import getopt
from shutil import move
from os import remove, close
"""Modify meta information in raw experimental data.
While comparing algorithms with the bbob_proc package, it is sometimes
needed to change the algorithm name (given ... |
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
from time import sleep
import boto3
import commands
from botocore.exceptions import ClientError
APP_NAME = os.getenv('BITBUCKET_REPO_SLUG')
COMMIT_HASH = os.getenv('BITBUCKET_COMMIT')
del os.environ['GIT_DIR']
TAG = commands.getoutput("g... |
#! /usr/bin/env python3
# See #17264.
#
# Generates a module of Luc Maranget's S series
#
# module S where
#
# data T = A | B
#
# s :: T -> T -> T -> T -> T -> T -> T -> T -> ()
# s A A _ _ _ _ _ _ = ()
# s _ _ A A _ _ _ _ = ()
# s _ _ _ _ A A _ _ = ()
# s _ _ _ _ _ _ A A = ()
# s A B A B A B A B = ()
... |
"""BibFormat element - Print link to push an entry to a remote server through SWORD
"""
__revision__ = "$Id$"
from invenio.config import CFG_SITE_URL
from invenio.urlutils import create_html_link
from invenio.access_control_engine import acc_authorize_action
def format_element(bfo, remote_server_id, link_label="Push ... |
from django.contrib.gis.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class SouthTexasCity(models.Model):
"City model on projected coordinate system for South Texas."
name = models.CharField(max_length=30)
point = models.PointField(srid=32140)
... |
# -*- coding: utf-8 -*-
import unittest
import os
class TestUtils(unittest.TestCase):
def setUp(self):
import tempfile
from collective.eggproxy.utils import IndexProxy
from collective.eggproxy.config import config
self.tempdir = tempfile.mkdtemp()
self.base_index = os.pat... |
class UnknownColumnNameException(Exception):
"""Exception type raised when encountering an unknown column name."""
def __init__(self, column_name):
self.column_name = column_name
def __str__(self):
return repr(self.column_name)
def SerializeProfiles(profiles):
"""Returns a serialized string for the gi... |
"""Generate melodies from a trained checkpoint of an improv RNN model."""
import ast
import os
import time
# internal imports
import tensorflow as tf
import magenta
from magenta.models.improv_rnn import improv_rnn_config_flags
from magenta.models.improv_rnn import improv_rnn_model
from magenta.models.improv_rnn imp... |
"""Base class for terminal chains."""
__all__ = [
'Chain',
'Link',
'TerminalChainBase',
]
from mailman.config import config
from mailman.interfaces.chain import (
IChain, IChainIterator, IChainLink, IMutableChain, LinkAction)
from zope.interface import implementer
@implementer(IChainLink)
cla... |
#!/usr/bin/env python
from distutils import ccompiler
from distutils.core import CompileError
try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension
cc = ccompiler.new_compiler()
# leave it to gcc to detect c/c++ files. we'll be linking against -lstdc++
... |
from csp import settings
from crowdsourcing import models
from rest_framework.views import APIView
from django.http import HttpResponse, HttpResponseRedirect
# TODO change this to support ajax requests, remove HttpResponseRedirect
class DropboxOauth(APIView):
"""
Handles the Dropbox Oauth2 integration
... |
# -*- coding: utf-8 -*-
from openerp import tools
from openerp import models, fields, api
class AccountInvoiceReport(models.Model):
_name = "account.invoice.report"
_description = "Invoices Statistics"
_auto = False
_rec_name = 'date'
@api.multi
@api.depends('currency_id', 'date', 'price_tot... |
'''
Copyright (c) 2013, Nikola Wuttke
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following ... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_feature
version_added: "1.7"
short_description: Installs and uninstalls Windows Features on Windows Server
description:
- Installs or uni... |
"""pandevice library is a framework for interacting with Palo Alto Networks devices
Documentation available at http://pandevice.readthedocs.io
"""
__author__ = 'Palo Alto Networks'
__email__ = '<EMAIL>'
__version__ = '0.14.0'
import logging
from distutils.version import LooseVersion # Used by PanOSVersion class
... |
#! /usr/bin/env python
# Perform massive identifier substitution on C source files.
# This actually tokenizes the files (to some extent) so it can
# avoid making substitutions inside strings or comments.
# Inside strings, substitutions are never made; inside comments,
# it is a user option (off by default).
#
... |
from unittest import TestCase
from pyutil import jsonutil as json
# from http://json.org/JSON_checker/test/pass1.json
JSON = r'''
[
"JSON Test Pattern pass1",
{"object with 1 member":["array with 1 element"]},
{},
[],
-42,
true,
false,
null,
{
"integer": 1234567890,
... |
"""
Command to delete all rows from these tables:
microsite_configuration_historicalmicrositeorganizationmapping
microsite_configuration_historicalmicrositetemplate
"""
import logging
from microsite_configuration.models import MicrositeOrganizationMapping, MicrositeTemplate
from openedx.core.djangoapps.util.row_delete... |
"""Provides classes and constants for the XML in the Google Spreadsheets API.
Documentation for the raw XML which these classes represent can be found here:
http://code.google.com/apis/spreadsheets/docs/3.0/reference.html#Elements
"""
__author__ = '<EMAIL> (Jeff Scudder)'
import atom.core
import gdata.data
GS_TE... |
"""
Unit tests for credit eligibility UI in Studio.
"""
import mock
from contentstore.tests.utils import CourseTestCase
from contentstore.utils import reverse_course_url
from openedx.core.djangoapps.credit.api import get_credit_requirements
from openedx.core.djangoapps.credit.models import CreditCourse
from openedx.c... |
#
# Emulator engine main class
#
def dhex(number: int) -> str:
return "0x{:04x}".format(number)
def x0000(opcode):
# Clear screen
if opcode == 0x00E0:
return "CLS"
# Return
if opcode == 0x00EE:
return "RET"
# 1XXX => Jump(XXX)
def x1000(opcode):
return "JP " + dhex(opcode & ... |
"""
Message Board
~~~~~~~~~~~~~
A simple message board application written with Flask and sqlite3.
Since it's a small application, I have not use SQLAlchemy and wtf.
:copyright: (c) 2015 by <EMAIL>
:license: BSD.
"""
import os
import sqlite3
from datetime import datetime
from flask import Flas... |
"""Updates the Chrome reference builds.
To update Chromium (unofficial) reference build, use the -r option and give a
Chromium SVN revision number, like 228977. To update a Chrome (official) build,
use the -v option and give a Chrome version number like 30.0.1595.0.
If you're getting a Chrome build, you can give the ... |
#!/usr/bin/env python
import os
import sys
# For coverage.
if __package__ is None:
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/..")
from unittest import main, TestCase
import requests
import requests_mock
from iris_sdk.client import Client
from iris_sdk.models.account import Account
XML_RES... |
"""Tests for the libpolicy Python bindings.
"""
from samba.tests import TestCase
from samba import policy
class PolicyTests(TestCase):
def test_get_gpo_flags(self):
self.assertEquals(["GPO_FLAG_USER_DISABLE"],
policy.get_gpo_flags(policy.GPO_FLAG_USER_DISABLE))
def test_get_gplink_opti... |
import frappe
def execute():
frappe.reload_doctype("Quotation")
frappe.db.sql("""update tabQuotation set title = customer_name""")
frappe.reload_doctype("Sales Order")
frappe.db.sql("""update `tabSales Order` set title = customer_name""")
frappe.reload_doctype("Delivery Note")
frappe.db.sql("""update `tabDeliv... |
"""Test correct setup/teardowns at module, class, and instance level."""
from typing import List
import pytest
def test_module_and_function_setup(testdir):
reprec = testdir.inline_runsource(
"""
modlevel = []
def setup_module(module):
assert not modlevel
module.mod... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import os
try:
from dnsimple import DNSimple
from dnsimple.dnsimple import DNSimpleException
HAS_DNSIMPLE = True
except ImportError:
HAS_DNSIMPLE = False
def main... |
# stdlib
from xml.etree import ElementTree
# third party
import requests
# project
from checks import AgentCheck
QUEUE_URL = "/admin/xml/queues.jsp"
TOPIC_URL = "/admin/xml/topics.jsp"
SUBSCRIBER_URL = "/admin/xml/subscribers.jsp"
TOPIC_QUEUE_METRICS = {
"consumerCount": "consumer_count",
"dequeueCount": "d... |
from __future__ import print_function
import espressomd
import numpy
import unittest as ut
from tests_common import *
class InteractionsBondedTest(ut.TestCase):
system = espressomd.System(box_l=[1.0, 1.0, 1.0])
box_l = 10.
start_pos = numpy.random.rand(3) * box_l
axis = numpy.random.rand(3)
axis... |
from installclass import BaseInstallClass
from constants import *
from product import *
from flags import flags
import os, types
import iutil
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
import installmethod
from sabayon import Entropy
from sabayon.livecd import LiveCDCopyBackend
class InstallClass... |
import Orange
from OWWidget import *
import OWGUI
from itertools import izip
NAME = "Concatenate"
DESCRIPTION = "Concatenates data tables."
ICON = "icons/Concatenate.svg"
PRIORITY = 1111
MAINTAINER = "Janez Demsar"
MAINTAINER_EMAIL = "janez.demsar(@at@)fri.uni-lj.si"
INPUTS = [("Primary Data", Orange.data.Table, "setD... |
"""
Pad the edges of grids using various methods
=============================================
Sometimes it is useful to add some padding points to the edges of grids, for
example during FFT-based processing to avoid edge effects.
Function :func:`fatiando.gridder.pad_array` does this using various padding
methods.
Fun... |
# -*- coding: utf-8 -*-
import re
import types
from unittest import TestCase
from datetime import datetime, timedelta
from django.core.exceptions import ValidationError
from django.core.validators import *
NOW = datetime.now()
TEST_DATA = (
# (validator, value, expected),
(validate_integer, '42', None),
(... |
from unittest import mock
from django.core.urlresolvers import reverse
from taiga.projects import services
from taiga.base.utils import json
from .. import factories as f
import pytest
pytestmark = pytest.mark.django_db
def test_get_members_from_bulk():
data = [{"role_id": "1", "email": "<EMAIL>"},
... |
from twitch import TwitchOutputStream
import numpy as np
import threading
import time
import collections
from skimage import transform
import multiprocessing
from functools import partial
import Queue
from PIL import Image, ImageFont, ImageDraw
from collections import deque
import sys
font = ImageFont.truetype(font="H... |
#!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from test import run_only
from mock import patch
from diamond.collector import Collector
from puppetagent... |
'''
This module is just for testing concepts. It should be erased later on.
Experiments:
// gdb -p 4957
// call dlopen("/home/fabioz/Desktop/dev/PyDev.Debugger/pydevd_attach_to_process/linux/attach_linux.so", 2)
// call dlsym($1, "hello")
// call hello()
// call open("/home/fabioz/Desktop/dev/PyDev.Debugger/pydevd_... |
from openerp.tools.translate import _
from openerp.osv import fields, osv
class res_partner_mail(osv.Model):
""" Update partner to add a field about notification preferences """
_name = "res.partner"
_inherit = ['res.partner', 'mail.thread']
_mail_flat_thread = False
_mail_mass_mailing = _('Custom... |
#!/usr/bin/env python
"""CRUD tests of APIs (Create, Read, Update, Delete) HLD:
- interface up/down/add/delete - interface type:
- pg (TBD)
- loopback
- vhostuser (TBD)
- af_packet (TBD)
- netmap (TBD)
- tuntap (root privileges needed)
- vxlan (TBD)
"""
import unittest
from scapy.layers.i... |
from urlparse import urlparse
from ceph_deploy.lib import remoto
from ceph_deploy.util import pkg_managers
def install(distro, version_kind, version, adjust_repos):
codename = distro.codename
machine = distro.machine_type
if version_kind in ['stable', 'testing']:
key = 'release'
else:
... |
from __future__ import print_function
from os import path
from flask import _request_ctx_stack
from flask.templating import render_template_string
from webassets.env import (\
BaseEnvironment, ConfigStorage, env_options, Resolver, url_prefix_join)
from webassets.filter import Filter, register_filter
from webassets.... |
from __future__ import print_function
import time
import threading
import sys
if sys.version >= '3':
import queue as Queue
else:
import Queue
from pyspark import SparkConf, SparkContext
def delayed(seconds):
def f(x):
time.sleep(seconds)
return x
return f
def call_in_background(f, ... |
#!/usr/bin/env python2
"""
plot_gaugewave_of_time.py
Author: Jonah Miller (<EMAIL>)
Time-stamp: <2014-02-07 18:01:28 (jonah)>
This is a simple library to plot the norm of g_{xx} as a function of
time for a gaugewave. Several gaugewave files can be plotted at the
same time.
Example call
python2 plot_gaugewave_of_time... |
# -*- coding: utf-8 -*-
from nose.tools import *
from website.addons.badges.model import BadgeAssertion
from utils import *
from tests.base import OsfTestCase
from tests.factories import AuthUserFactory, ProjectFactory
class TestUserSettingsModel(OsfTestCase):
def setUp(self):
super(TestUserSettingsMode... |
# coding: utf-8
from __future__ import unicode_literals
import pytest
from ..util import get_doc, apply_transition_sequence
def test_parser_root(en_tokenizer):
text = "i don't have other assistance"
heads = [3, 2, 1, 0, 1, -2]
deps = ["nsubj", "aux", "neg", "ROOT", "amod", "dobj"]
tokens = en_tokeni... |
""" Support for getting gcloud credentials. """
from __future__ import absolute_import
from __future__ import unicode_literals
import json
import os
import subprocess
import oauth2client.client
import google.auth
import google.auth.exceptions
import google.auth.credentials
import google.auth._oauth2client
# TODO(oj... |
from optparse import make_option
from django.core.management.base import BaseCommand
from linkcheck.utils import check_links
from linkcheck.linkcheck_settings import EXTERNAL_RECHECK_INTERVAL
from linkcheck.linkcheck_settings import MAX_CHECKS_PER_RUN
class Command(BaseCommand):
option_list = BaseCommand.option_l... |
from tests.unit import unittest
from boto.sqs.message import MHMessage
from boto.sqs.message import RawMessage
from boto.sqs.message import Message
from boto.sqs.bigmessage import BigMessage
from boto.exception import SQSDecodeError
from nose.plugins.attrib import attr
class TestMHMessage(unittest.TestCase):
@a... |
"""
Download API class.
"""
from __future__ import print_function
import os
from dbcollection.core.manager import CacheManager
from .metadata import MetadataConstructor
def download(name, data_dir='', extract_data=True, verbose=True):
"""Download a dataset data to disk.
This method will download a datase... |
"""
SAP HANA database backend for Django.
"""
import logging
import sys
from time import time
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
from django.db import utils
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.base.features import BaseDatabaseFe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.