content stringlengths 4 20k |
|---|
import unittest
from node import Identity, NewNode, NewRelation, NewRelationship
class TestMongoNode(unittest.TestCase):
def test_relationship_identifier(self):
pass
def test_shared_secret(self):
pass
def test_identity(self):
assert Identity('foo', 'http://imgur.com')
def te... |
# -*- coding: utf-8 -*-
"""
jinja2.sandbox
~~~~~~~~~~~~~~
Adds a sandbox layer to Jinja as it was the default behavior in the old
Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the
default behavior is easier to use.
The behavior can be changed by subclassing the environm... |
#!/usr/bin/env python
import os
import sys
import tempfile
import time
import unittest
import hardlink
testdata1 = "1234" * 1024 + "abc"
testdata2 = "1234" * 1024 + "xyz"
def get_inode(filename):
return os.lstat(filename).st_ino
class TestHappy(unittest.TestCase):
def setUp(self):
self.root = tem... |
import bottle
import shared_state
import os
import uuid
import shared_state as shared
import logging
import types
from bottle import run, install, mount, request
from bottle.ext import mongo
from beaker.middleware import SessionMiddleware
from datetime import datetime
from kumo.loggly import Loggly
from cork import Cor... |
import github.GithubObject
import github.NamedUser
class StatsContributor(github.GithubObject.NonCompletableGithubObject):
"""
This class represents statistics of a contibutor. The reference can be found here http://developer.github.com/v3/repos/statistics/#get-contributors-list-with-additions-deletions-and-... |
from openerp import api, fields, models
import logging
_logger = logging.getLogger(__name__)
class AddressSummaryWizard(models.TransientModel):
_name = 'myo.address.summary.wizard'
address_ids = fields.Many2many('myo.address', string='Addresses')
category_id = fields.Many2one('myo.summary.category', st... |
"""Module containing data providers for PhoneNumberProperty.
"""
from soc.modules.seeder.logic.providers.provider import BaseDataProvider
from soc.modules.seeder.logic.providers.provider import FixedValueProvider
import random
__authors__ = [
'"Felix Kerekes" <<EMAIL>>',
]
# pylint: disable=W0223
class PhoneN... |
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
from odoo.tests import Form, tagged
from datetime import datetime
@tagged('post_install', '-at_install')
class TestPurchaseOrderReport(AccountTestInvoicingCommon):
def test_00_purchase_order_report(self):
uom_dozen = self.env.ref('u... |
# -*- coding: utf-8 -*-
'''
Specto Add-on
Copyright (C) 2015 lambda
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 l... |
#!/usr/bin/env python
"""
Parses the output of efi.exe.
TODO:
- do a per .obj file string size changes
"""
import bz2, bisect
g_file_name = "efi.txt"
(SECTION_CODE, SECTION_DATA, SECTION_BSS, SECTION_UNKNOWN) = ("C", "D", "B", "U")
# maps a numeric string idx to string. We take advantage of the fa... |
"""Tests for data_utils."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from itertools import cycle
import threading
import numpy as np
from tensorflow.contrib.keras.python import keras
from tensorflow.python.platform import test
class ThreadsafeIte... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
PreconfiguredAlgorithm.py
---------------------
Date : April 2016
Copyright : (C) 2016 by Victor Olaya
Email : volayaf at gmail dot com
*****************... |
"""
Tests for Layer1 of Simple Workflow
"""
import time
import uuid
import json
import traceback
from boto.swf.layer1_decisions import Layer1Decisions
from tests.integration.swf.test_layer1 import SimpleWorkflowLayer1TestBase
class SwfL1WorkflowExecutionTest(SimpleWorkflowLayer1TestBase):
"""
test a simpl... |
#!/usr/bin/env python
# coding: utf-8
"""
Github version of hyperparameter optimization for Vowpal Wabbit via hyperopt
"""
__author__ = 'kurtosis'
from hyperopt import hp, fmin, tpe, rand, Trials, STATUS_OK
from sklearn.metrics import roc_curve, auc, log_loss, precision_recall_curve
import numpy as np
from datetime ... |
from connection import SESConnection
from boto.regioninfo import RegionInfo
def regions():
"""
Get all available regions for the SES service.
:rtype: list
:return: A list of :class:`boto.regioninfo.RegionInfo` instances
"""
return [RegionInfo(name='us-east-1',
endpoint=... |
import functools
import signal
import time
from oslo_utils import importutils
from osprofiler.drivers import base
class Messaging(base.Driver):
def __init__(self, connection_str, project=None, service=None, host=None,
context=None, conf=None, transport_url=None,
idle_timeout=1,... |
"""A Series represents a deferred Tensor computation in a DataFrame."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from abc import ABCMeta
from tensorflow.python.util.deprecation import deprecated
class Series(object):
"""A single output series.
... |
import json
import logging
import re
import signal
import subprocess
import sys
import tempfile
from telemetry.internal.platform import profiler
from telemetry.timeline import model
from telemetry.timeline import trace_data as trace_data_module
# Parses one line of strace output, for example:
# 6052 1311456063.15972... |
#!/usr/bin/env python
import os
import shutil
import glob
import time
import sys
import subprocess
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PARAMETERS = None
ADB_CMD = "adb"
def doCMD(cmd):
# Do not need handle timeout in this short script, let tool... |
"""
This is the testing module for Calm applications.
This defines a handy subclass with its utilities, so that you can use them to
test your Calm applications more conveniently and with less code.
"""
import json
from tornado.testing import AsyncHTTPTestCase
from tornado.websocket import websocket_connect
from calm... |
"""
Weblate wrapper around translate-toolkit formats to add missing
functionality.
"""
import json
from translate.storage.jsonl10n import JsonFile as JsonFileTT
class JsonFile(JsonFileTT):
"""
Workaround ttkit bug on not including added units in saved file.
"""
def __str__(self):
data = {}
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'tanchao'
import sys
SIZE = 256 # defined in challenge description
MATRIX = [[0] * SIZE for i in range(SIZE)]
def set_col(orders_):
col_ = orders_[1] - 1
val_ = orders_[2]
for i in range(SIZE):
MATRIX[i][col_] = val_
def set_row(orde... |
"""Tests for model_card_toolkit.model_card."""
import json
import os
import pkgutil
from absl.testing import absltest
import jsonschema
from model_card_toolkit import model_card
from model_card_toolkit.proto import model_card_pb2
from google.protobuf import text_format
_FULL_PROTO_FILE_NAME = "full.pbtxt"
_FULL_PRO... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
test_qgssimplefillsymbollayer.py
---------------------
Date : November 2018
Copyright : (C) 2018 by Nyall Dawson
Email : nyall dot dawson at gmail dot co... |
"""
@author: Cem Gurkok
@license: GNU General Public License 2.0
@contact: <EMAIL>
@organization: Volatility Foundation
"""
import re
import volatility.utils as utils
import volatility.obj as obj
import volatility.debug as debug
import volatility.plugins.taskmods as taskmods
class TokenXP2003(obj.Pr... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime, timedelta
from multiprocessing.pool import ThreadPool
import logging
import os
import sys
from compat import atomic
from compat import import_module
from django.utils import timezone
from django.utils.encoding import python... |
# -*- coding: utf-8 -*-
""" S3 Synchronization: Peer Repository Adapter
@copyright: 2014 (c) Sahana Software Foundation
@license: MIT
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 S... |
import json
from oslo_config import cfg
from six.moves.urllib import parse as urlparse
from sahara import context
from sahara import exceptions as ex
from sahara.i18n import _
CONF = cfg.CONF
def url_for(service_catalog, service_type, admin=False, endpoint_type=None):
if not endpoint_type:
endpoint_typ... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import sys
import paramiko
import time
import argparse
import socket
import array
import json
import time
import re
try:
from ansible.module_utils import cnos
HAS_LIB = Tru... |
"""
===============================================
Feature transformations with ensembles of trees
===============================================
Transform your features into a higher dimensional, sparse space. Then
train a linear model on these features.
First fit an ensemble of trees (totally random trees, a rand... |
"""
The :mod:`websockets.client` module defines a simple WebSocket client API.
"""
import asyncio
import collections.abc
import email.message
from .exceptions import InvalidHandshake
from .handshake import build_request, check_response
from .http import USER_AGENT, read_response
from .protocol import CONNECTING, OPE... |
#!/usr/bin/env python
import sys
try:
from setuptools import setup
except:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
readme = file('docs/README.txt','rb').read()
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers... |
from nose.tools import raises
from superdesk.tests import TestCase
from superdesk.privilege import privilege, get_privilege_list, _privileges
class PrivilegeTestCase(TestCase):
def setUp(self):
_privileges_saved = _privileges.copy()
_privileges.clear()
def revert():
_privilege... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from time import sleep
try:
from docker.errors import APIError, NotFound
except ImportError:
# missing Docker SDK for Python handled in ansible.module_utils.docker.common
pass
from ansible.module_utils._t... |
# -*- coding: utf-8 -*-
"""
AipBase
"""
import hmac
import json
import hashlib
import datetime
import base64
import time
import sys
import requests
requests.packages.urllib3.disable_warnings()
if sys.version_info.major == 2:
from urllib import urlencode
from urllib import quote
from urlparse import u... |
"""REST for users."""
from __future__ import absolute_import, unicode_literals
__metaclass__ = type
__all__ = [
'AUser',
'AllUsers',
]
from flufl.password import lookup, make_secret, generate
from restish import http, resource
from uuid import UUID
from zope.component import getUtility
from mailman.con... |
from array import array
from base64 import urlsafe_b64encode
import hashlib
import hmac
import sys
try:
import json
except ImportError:
import simplejson as json
import time
import datetime
__all__ = ['create_token']
TOKEN_VERSION = 0
TOKEN_SEP = '.'
CLAIMS_MAP = {
'expires': 'exp',
'notBefore': 'nbf... |
import unittest2 as unittest
from webkitpy.layout_tests.models.test_failures import *
class TestFailuresTest(unittest.TestCase):
def assert_loads(self, cls):
failure_obj = cls()
s = failure_obj.dumps()
new_failure_obj = TestFailure.loads(s)
self.assertIsInstance(new_failure_obj, c... |
#!/usr/bin/python -u
'''
ADOdb version update script
Updates the version number, and release date in all php and html files
'''
from datetime import date
import getopt
import os
from os import path
import re
import subprocess
import sys
# ADOdb version validation regex
# These are used by sed - they are not... |
#################################################################
# Program: Business time logger
"""
"""
__author__ = "Oleg Noga"
__date__ = "$Date: 2004/03/24 12:36:39 $"
__version__ = "$Revision: 1.2 $"
# $Source: D:/HOME/cvs/toolib/scripts/businesstime.py,v $
# #
##################################... |
"""
This module adds shared support for generic cloud modules
In order to use this module, include it as part of a custom
module as shown below.
from ansible.module_utils.cloud import CloudRetry
The 'cloud' module provides the following common classes:
* CloudRetry
- The base class to be used by other c... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from svgplotlib.SVG.Parsers import Lexer, EOF
class ParseTransformError(Exception):
pass
class Transform(Lexer):
"""
Break SVG transform into tokens.
"""
numfloat = object()
numint = object()
string = object()
skip = object()
numbers =... |
"""Support for Blockchain.com sensors."""
from datetime import timedelta
import logging
from pyblockchain import get_balance, validate_address
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME
import homeassistant.helpers.c... |
"""
======================================
Gradient Boosting Out-of-Bag estimates
======================================
Out-of-bag (OOB) estimates can be a useful heuristic to estimate
the "optimal" number of boosting iterations.
OOB estimates are almost identical to cross-validation estimates but
they can be compute... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# change those symbols to whatever you prefer
symbols = {'ahead of': '↑', 'behind': '↓', 'staged':'♦', 'changed':'‣', 'untracked':'…', 'clean':'⚡', 'unmerged':'≠', 'sha1':':'}
from subprocess import Popen, PIPE
output,error = Popen(['git','status'], stdout=PIPE, stderr=P... |
"""
Base/mixin classes for the spatial backend database operations and the
`SpatialRefSys` model the backend.
"""
import re
from django.conf import settings
from django.contrib.gis import gdal
class BaseSpatialOperations(object):
"""
This module holds the base `BaseSpatialBackend` object, which is
instanti... |
#!/usr/bin/env python
'''
PEXPECT LICENSE
This license is approved by the OSI and FSF as GPL-compatible.
http://opensource.org/licenses/isc-license.txt
Copyright (c) 2012, Noah Spurrier <<EMAIL>>
PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY
PURPOSE WITH OR WITHOUT F... |
import errno
import re
import os
import sys
import subprocess
# Note that gcc uses unicode, which may depend on the locale. TODO:
# force LANG to be set to en_US.UTF-8 to get consistent warnings.
allowed_warnings = set([
"alignment.c:720",
"async.c:122",
"async.c:270",
"dir.c:43",
"dm.c:1053",
... |
import github.GithubObject
class PaginatedListBase:
def __init__(self):
self.__elements = list()
def __getitem__(self, index):
assert isinstance(index, (int, slice))
if isinstance(index, (int, long)):
self.__fetchToIndex(index)
return self.__elements[index]
... |
# Ink image scraping from Klundtasaur's Airtable
# https://airtable.com/shrF8Vr0O5VPB6ZoR/tblp9rsxx6AsHwOzW/viw42CNIgWnLe5NSl
import csv
import os
import urllib
import multiprocessing
from time import time
def retrieve_airtable(filename):
'''
Download CSV file from source and save as airtable-sou... |
from nova.compute import utils as compute_utils
from nova import db
from nova import exception
from nova import objects
from nova.objects import base
from nova.objects import fields
# TODO(berrange): Remove NovaObjectDictCompat
@base.NovaObjectRegistry.register
class Aggregate(base.NovaPersistentObject, base.NovaObje... |
"""Base Manager class.
Managers are responsible for a certain aspect of the system. It is a logical
grouping of code relating to a portion of the system. In general other
components should be using the manager to make changes to the components that
it is responsible for.
For example, other components that need to d... |
#!/usr/bin/env python3
"""Test the mib_ciscocdp module."""
import os
import sys
import unittest
from mock import Mock
# Try to create a working PYTHONPATH
TEST_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
SWITCHMAP_DIRECTORY = os.path.abspath(os.path.join(TEST_DIRECTORY, os.pardir))
ROOT_DIRECTORY = os.pat... |
"""
Stepper Motor Controller
"""
__author__ = '<EMAIL> (Dave McCoy)'
import os
import sys
import argparse
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.Qt import *
from nysa.common import status
from nysa.host import platform_scanner
from nysa.host.driver.stepper import Stepper
sys.path.append(o... |
"""
.. moduleauthor:: Gabriel Martin Becedillas Ruiz <<EMAIL>>
"""
import datetime
import common
import strategy_test
from pyalgotrade.barfeed import yahoofeed
from pyalgotrade.barfeed import membf
from pyalgotrade.stratanalyzer import drawdown
from pyalgotrade import broker
from pyalgotrade import bar
def build_b... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class RetrieveUserInfo(Choreography):
def __init__(self, temboo_session):
"""
Creat... |
"""empty message
Revision ID: a89a143735e5
Revises: f1531223b9e5
Create Date: 2016-07-24 15:10:24.786000
"""
# revision identifiers, used by Alembic.
revision = 'a89a143735e5'
down_revision = 'f1531223b9e5'
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
def upgrade():
### commands auto... |
import frappe
from frappe.website.utils import find_first_image
from frappe.utils import cstr
import re
def execute():
item_details = frappe._dict()
for d in frappe.db.sql("select name, description_html, description from `tabItem`", as_dict=1):
description = cstr(d.description_html).strip() or cstr(d.description).... |
#-*- coding: utf-8 -*-
'''
python-libtorrent for Kodi (script.module.libtorrent)
Copyright (C) 2015-2016 DiMartino, srg70, RussakHH, aisman
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 t... |
"""This code example gets all line items.
To create line items, run create_line_items.py."""
__author__ = ('Nicholas Chen',
'Joseph DiLallo')
# Import appropriate modules from the client library.
from googleads import dfp
def main(client):
# Initialize appropriate service.
line_item_service = cli... |
"""
A mapping of state misspellings/abbreviations to normalized
abbreviations, and alphabetical lists of US states, territories,
military mail regions and non-US states to which the US provides
postal service.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
# The... |
#!/usr/bin/env python
import zlib
from lzw import lzwdecode
from ascii85 import ascii85decode, asciihexdecode
from runlength import rldecode
from ccitt import ccittfaxdecode
from psparser import PSException, PSObject
from psparser import LIT, STRICT
from utils import apply_png_predictor, isnumber
LITERAL_CRYPT = LIT('... |
"""Test setup for integration and functional tests.
When we import PloneTestCase and then call setupPloneSite(), all of
Plone's products are loaded, and a Plone site will be created. This
happens at module level, which makes it faster to run each test, but
slows down test runner startup.
"""
from Products.Five import... |
from node import nullrev
from i18n import _
class basedag(object):
'''generic interface for DAGs
terms:
"ix" (short for index) identifies a nodes internally,
"id" identifies one externally.
All params are ixs unless explicitly suffixed otherwise.
Pluralized params are lists or sets.
'''
... |
import re
try:
from exceptions import Exception
except ImportError:
# Python3
pass
offset = re.compile(r"(CONTROL_PADCONF_.*?)\s+(0x\w+)")
offsets = {}
for line in open('mux.h').readlines():
m = offset.search(line)
if m:
offsets[m.group(1)] = int(m.group(2), 16) - 0x800
mux = re.compile(r"(CONTROL_PADC... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.nxos import nxos_nxapi
from .nxos_module import TestNxosModule, load_fixture, set_module_args
class TestNxosNxapiModule(TestNxosModule):
module = nxos_nxapi
... |
from __future__ import print_function, division, absolute_import
import re
from collections import namedtuple
from datetime import date, datetime
from decimal import Decimal
import pytz
# noinspection PyCompatibility,PyUnresolvedReferences
from builtins import str
from dateutil import parser
from .. import errors
fr... |
import BaseHTTPServer
import logging
import multiprocessing
import optparse
import os
import SimpleHTTPServer # pylint: disable=W0611
import socket
import sys
import time
import urlparse
if sys.version_info < (2, 7, 0):
sys.stderr.write("python 2.7 or later is required run this script\n")
sys.exit(1)
SCRIPT_DIR... |
from tempest_lib.common.utils import data_utils
from tempest.api.image import base
from tempest import test
class ImagesTagsTest(base.BaseV2ImageTest):
@test.idempotent_id('10407036-6059-4f95-a2cd-cbbbee7ed329')
def test_update_delete_tags_for_image(self):
body = self.create_image(container_format='... |
# Created by Tyrell Rutledge - <EMAIL> & IRC Freenode as TheRinger, Contributions welcome and will be credited.
from influxdb import InfluxDBClient
from influxdb import SeriesHelper
import RPi.GPIO as GPIO
import time
import datetime
import logging
import random
import Adafruit_DHT
import sys
import serial
import os
... |
"""
Django settings for growth_studio project.
Generated by 'django-admin startproject' using Django 1.10.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
imp... |
import sys, json
markdown = ""
def loadJSON(file):
data = open(file, 'r')
return json.load(data)
def parseJSON(d, depth):
if isinstance(d, dict):
parseDict(d, depth)
if isinstance(d, list):
parseList(d, depth)
def parseDict(d, depth):
for k in d:
if isinstance(d[k], unicode):
addValue(k, d[k], depth... |
#!/usr/bin/python3
import argparse
import glob
import os
import time
import random
COLOURS = (b'\xFF\x00\x00', b'\x00\xFF\x00', b'\x00\x00\xFF', b'\xFF\xFF\x00', b'\xFF\x00\xFF', b'\x00\xFF\xFF')
def write_binary(driver_path, device_file, payload):
with open(os.path.join(driver_path, device_file), 'wb') as open... |
from CIM15.Element import Element
class IEC62325CIMVersion(Element):
"""IEC 62325 version number assigned to this UML model.IEC 62325 version number assigned to this UML model.
"""
def __init__(self, date='', version='', *args, **kw_args):
"""Initialises a new 'IEC62325CIMVersion' instance.
... |
"""
Integration with systemd.
Currently only the minimum APIs necessary for using systemd's socket activation
feature are supported.
"""
from __future__ import division, absolute_import
__all__ = ['ListenFDs']
from os import getpid
class ListenFDs(object):
"""
L{ListenFDs} provides access to file descript... |
from __future__ import with_statement
import os
import maya.cmds
import IECore
import IECoreMaya
class TemporaryAttributeValuesTest( IECoreMaya.TestCase ) :
def test( self ) :
s = maya.cmds.spaceLocator()[0]
maya.cmds.addAttr( s, at="enum", sn="enumTest", enumName="A:B:C", defaultValue = 1 )
self.assertEq... |
import os
from bears.js.ESLintBear import ESLintBear
from coalib.testing.LocalBearTestHelper import verify_local_bear
test_good = """function addOne(i) {
if (!isNaN(i)) {
return i+1;
}
return i;
}
addOne(3);
"""
test_bad = """function addOne(i) {
if (i != NaN) {
return i ++
}
... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""A viewer (part of Qt model-view-delegate classes) for layer selection
and parameters alternating.
"""
from numpy import array_equal
from numpy import around
from PyQt4.QtCore import *
from PyQt4.QtGui... |
import copy
import datetime
import uuid
import mock
from oslo_config import cfg
import six
import webob
import manila.api.v1.cgsnapshots as cgs
from manila.common import constants
from manila import exception
from manila import test
from manila.tests.api import fakes
CONF = cfg.CONF
class CGSnapshotApiTest(test.T... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
try:
import ovirtsdk4.types as otypes
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt impor... |
"""
Module for interacting with midi input and output.
The midi module can send output to midi devices, and get input
from midi devices. It can also list midi devices on the system.
Including real midi devices, and virtual ones.
It uses the portmidi library. Is portable to which ever platforms
portmidi supports (c... |
"""TensorFlow ops for deep neural networks."""
# Copyright 2015-present The Scikit Flow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apac... |
#!/usr/bin/env python
# -*- mode: pymode; coding: latin1; -*-
import sys
import re
#
# You must include the following class definition at the top of
# your method specification file.
#
class MethodSpec(object):
def __init__(self, name='', source='', class_names='',
class_names_compiled=None):
... |
"""
A Python "serializer". Doesn't do much serializing per se -- just converts to
and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for
other serializers.
"""
from django.conf import settings
from django.core.serializers import base
from django.db import models
from django.utils.encodin... |
# -*- coding: utf-8 -*-
"""
celery.execute.trace
~~~~~~~~~~~~~~~~~~~~
This module defines how the task execution is traced:
errors are recorded, handlers are applied and so on.
:copyright: (c) 2009 - 2011 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
from __future__ import ab... |
# -*- 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 'CourseMode'
db.create_table('course_modes_coursemode', (
('id', self.gf('django.... |
"Dialog to specify or edit the parameters for a user configured help source."
import os
import sys
from tkinter import *
import tkinter.messagebox as tkMessageBox
import tkinter.filedialog as tkFileDialog
class GetHelpSourceDialog(Toplevel):
def __init__(self, parent, title, menuItem='', filePath=''):
""... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.tests import unittest
from ansible.compat.tests.mock import patch, MagicMock
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.executor.task_executor import TaskExecutor, remove_omit
from ... |
from __future__ import absolute_import
import myhdl
from myhdl import *
from myhdl.conversion import analyze
def issue_117(clk, sdi, pdo, sel, const=False):
assert isinstance(const, (bool, intbv))
delay_reg = Signal(intbv(0)[8:])
rlen = len(pdo)
plen = 1 if isinstance(const, bool) else len(const)
... |
from __future__ import unicode_literals
import mimetypes
from os import path
import unittest
from django.conf.urls.static import static
from django.http import FileResponse, HttpResponseNotModified
from django.test import SimpleTestCase, override_settings
from django.utils.http import http_date
from django.views.stat... |
"""
Test for lms courseware app, module data (runtime data storage for XBlocks)
"""
import json
from mock import Mock, patch
from nose.plugins.attrib import attr
from functools import partial
from courseware.model_data import DjangoKeyValueStore, FieldDataCache, InvalidScopeError
from courseware.models import StudentM... |
data = (
'Di ', # 0x00
'Zhuang ', # 0x01
'Le ', # 0x02
'Lang ', # 0x03
'Chen ', # 0x04
'Cong ', # 0x05
'Li ', # 0x06
'Xiu ', # 0x07
'Qing ', # 0x08
'Shuang ', # 0x09
'Fan ', # 0x0a
'Tong ', # 0x0b
'Guan ', # 0x0c
'Ji ', # 0x0d
'Suo ', # 0x0e
'Lei ', # 0x0f
'Lu ', # 0x1... |
from __future__ import absolute_import, division, print_function
import errno
import glob
import os
import numpy as np
def mkdir_p(path):
'''
make directory recursively
adapted from http://stackoverflow.com/questions/600268/
'''
try:
os.makedirs(path)
except OSError as exc: # Python >... |
# -*- coding: utf-8 -*-
""" Tests for the language API. """
from django.test import TestCase
import ddt
from lang_pref import api as language_api
@ddt.ddt
class LanguageApiTest(TestCase):
INVALID_LANGUAGE_CODES = ['', 'foo']
def test_released_languages(self):
released_languages = language_api.rele... |
from __future__ import print_function
from time import sleep
import sys
from BeautifulSoup import BeautifulSoup # Python 2 only, sorry.
import requests
from streamz import Stream
import toolz
import urlparse
def links_of_page((content, page)):
uri = urlparse.urlparse(page)
domain = '%s://%s' % (uri.schem... |
"""
Provides a function for importing a git repository into the lms
instance when using a mongo modulestore
"""
import os
import re
import StringIO
import subprocess
import logging
from django.conf import settings
from django.core import management
from django.core.management.base import CommandError
from django.util... |
#!usr/bin/env py.test
"""Tests for DOLFIN integration of various form operations"""
# Copyright (C) 2011 Marie E. Rognes
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.junos.... |
from spack import *
class PyElasticsearch(PythonPackage):
"""Python client for Elasticsearch"""
homepage = "https://github.com/elastic/elasticsearch-py"
url = "https://pypi.io/packages/source/e/elasticsearch/elasticsearch-5.2.0.tar.gz"
version('5.2.0', '66692fd1b4189039206c2fde4a4d616a')
version... |
from django.core import serializers
from django.test import TestCase
from fields import Small
from models import DataModel, MyModel, OtherModel
class CustomField(TestCase):
def test_defer(self):
d = DataModel.objects.create(data=[1, 2, 3])
self.assertTrue(isinstance(d.data, list))
d = D... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.