content string |
|---|
import Expression
import lib
import Fields
import modify
import Repeatln
import ServerParameter
import NewReport
import LoginTest
import Change
import About
import AddAttachment
import ConvertBracesToField
import ConvertFieldsToBraces
import ExportToRML
import SendtoServer
# vim:expandtab:smartindent:tabstop=4:softtab... |
import logging
from ast import literal_eval
from odoo import fields, models, _, api
from odoo.exceptions import UserError
from odoo.fields import Datetime
_logger = logging.getLogger(__name__)
class Employee(models.AbstractModel):
_inherit = 'hr.employee.base'
email_sent = fields.Boolean(default=False)
... |
from django.contrib.auth import models
from django.contrib.auth.mixins import (
LoginRequiredMixin, PermissionRequiredMixin, UserPassesTestMixin,
)
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from django.test import Re... |
'''
Created on Jan 22, 2015
@author: baskaran_k
'''
from commands import getstatusoutput
import MySQLdb
import sys
from string import atof
class CheckDatabase:
def __init__(self,database,outfolder):
self.outFolder=outfolder
self.mysqluser='eppicweb'
self.mysqlhost='eppic01.psi.c... |
from django.conf import settings
from django.contrib.sessions.backends.base import SessionBase
from django.core import signing
class SessionStore(SessionBase):
def load(self):
"""
We load the data from the key itself instead of fetching from
some external data store. Opposite of _get_sess... |
#!/usr/bin/env python
"""Spider to try and find bugs in the parser. Requires httplib2 and elementtree
usage:
import spider
s = spider.Spider()
s.spider("http://www.google.com", maxURLs=100)
"""
import urllib.request, urllib.error, urllib.parse
import urllib.robotparser
import md5
import httplib2
import html5lib
fro... |
categories = ["stack_control",
"clear_state"]
microcode = '''
# X86 microcode
'''
for category in categories:
exec "import %s as cat" % category
microcode += cat.microcode |
"""Convert graminit.[ch] spit out by pgen to Python code.
Pgen is the Python parser generator. It is useful to quickly create a
parser from a grammar file in Python's grammar notation. But I don't
want my parsers to be written in C (yet), so I'm translating the
parsing tables to Python data structures and writing a ... |
# -*- coding: utf-8 -*-
"""
All out rational-rules style gibbs on lexicons.
For MPI or local.
This is much slower than the vectorized versions.
MPI run:
$ mpiexec --hostfile ../../hosts.mpich2 -n 15 python Search_MCMC.py
"""
from LOTlib.MPI.MPI_map import MPI_map
from LOTlib import mh_sample
from LOTlib.FiniteBestSe... |
"""Test result object"""
import sys
import traceback
import unittest
from StringIO import StringIO
from django.utils.unittest import util
from django.utils.unittest.compatibility import wraps
__unittest = True
def failfast(method):
@wraps(method)
def inner(self, *args, **kw):
if getattr(self, 'fail... |
import os
import mock
from st2common.content import utils as content_utils
from st2common.bootstrap.base import ResourceRegistrar
from st2common.persistence.pack import Pack
from st2common.persistence.pack import ConfigSchema
from st2tests import DbTestCase
from st2tests import fixturesloader
__all__ = [
'Reso... |
# -*- coding: utf-8 -*-
"""
Compatibility code to be able to use `cookielib.CookieJar` with requests.
requests.utils imports from here, so be careful with imports.
"""
import copy
import time
import calendar
import collections
from .compat import cookielib, urlparse, urlunparse, Morsel
try:
import threading
... |
"""add oauth
Revision ID: 8eb7162afee7
Revises: f0ba66f2e9b2
Create Date: 2020-11-01 16:10:08.345978
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8eb7162afee7'
down_revision = 'f0ba66f2e9b2'
branch_labels = None
depends_on = None
def upgrade():
# ### ... |
#!/usr/bin/env python
"""These are windows specific installers.
NOTE: Subprocess module is broken on windows in that pipes are not handled
correctly. See for example:
http://bugs.python.org/issue3905
This problem seems to go away when we use pipes for all standard handles:
https://launchpadlibrarian.net/134750748/py... |
# -*- coding: utf-8 -*-
import unittest
from mongoengine import Document, connect
from mongoengine.connection import get_db
from mongoengine.fields import StringField
__all__ = ('ConvertToNewInheritanceModel', )
class ConvertToNewInheritanceModel(unittest.TestCase):
def setUp(self):
connect(db='mongoen... |
# -*- coding: utf-8 -*-
"""
Tests for auth manager WMS/WFS using QGIS Server through HTTP Basic
enabled qgis_wrapped_server.py.
This is an integration test for QGIS Desktop Auth Manager WFS and WMS provider
and QGIS Server WFS/WMS that check if QGIS can use a stored auth manager auth
configuration to access an HTTP Ba... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Smart meter application module for Odroid W.
Setup Description
#################
This application module utilizes the external 12-bit MCP3208 ADC connected
to the Odroid W via SPI to be used as a real-time smart-power-meter. Current
clamps in series with burden resistor... |
from __future__ import division
from __future__ import print_function
# -*- coding: utf-8 -*-
# Copyright 2017 Google Inc.
#
# 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.a... |
#!/usr/bin/env python
# -*- mode:python; tab-width:4; c-basic-offset:4; intent-tabs-mode:nil; -*-
# ex: filetype=python tabstop=4 softtabstop=4 shiftwidth=4 expandtab autoindent smartindent
# Modules
from distutils.core import setup
import os
# Helpers
def filesInDir( sDirectory ):
__lsfilesInDir = list()
for... |
__all__ = [
'LXMLTreeBuilderForXML',
'LXMLTreeBuilder',
]
from io import BytesIO
from StringIO import StringIO
import collections
from lxml import etree
from bs4.element import Comment, Doctype, NamespacedAttribute
from bs4.builder import (
FAST,
HTML,
HTMLTreeBuilder,
PERMISSIVE,
Parse... |
# -*- test-case-name: twisted.web2.test -*-
"""
Implements a simple polling interface for file descriptors that don't work with
select() - this is pretty much only useful on Windows.
"""
from zope.interface import implements
from twisted.internet.interfaces import IConsumer, IProducer
MIN_TIMEOUT = 0.000000001
MAX... |
import os
import subprocess
import struct
import math
from array import array
class WaveParams:
def __init__(self, numChannels=None):
if numChannels is None:
self.numChannels = 2
else:
self.numChannels = numChannels
self.DataOffset = 0
self.sampleByteSize = ... |
import os, sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from Util import syscall_name
usage = "perf script -s syscall-counts-by-pid.py [comm]\n";
for_comm = None
for_pid = None
if len(sys.argv) > 2:
sys.... |
from Components.Converter.Converter import Converter
from enigma import iServiceInformation, iPlayableService
from Components.Element import cached
from os import path
WIDESCREEN = [3, 4, 7, 8, 0xB, 0xC, 0xF, 0x10]
class ServiceInfo(Converter, object):
HAS_TELETEXT = 0
IS_MULTICHANNEL = 1
IS_CRYPTED = 2
IS_WIDES... |
from keystone.common import validation
from keystone.common.validation import parameter_types
basic_property_id = {
'type': 'object',
'properties': {
'id': {
'type': 'string'
}
},
'required': ['id'],
'additionalProperties': False
}
saml_create = {
'type': 'object',... |
#!/usr/bin/env python
import distutils.dist
import os.path
import re
import sys
import tempfile
import zipfile
from argparse import ArgumentParser
from glob import iglob
from shutil import rmtree
import wheel.bdist_wheel
from wheel.archive import archive_wheelfile
egg_info_re = re.compile(r'''(^|/)(?P<name>[^/]+?)-(?... |
import sys
from os.path import join, dirname, abspath, isdir
def _start_linter():
"""
This is a pre-alpha API. You're not supposed to use it at all, except for
testing. It will very likely change.
"""
import jedi
if '--debug' in sys.argv:
jedi.set_debug_function()
for path in sys... |
from contextlib import ExitStack
import os
import sys
from tempfile import NamedTemporaryFile
import unittest
from coalib.misc.Shell import run_interactive_shell_command, run_shell_command
class RunShellCommandTest(unittest.TestCase):
@staticmethod
def construct_testscript_command(scriptname):
retur... |
from selenium.webdriver.common import utils
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from .service import Service
DEFAULT_TIMEOUT = 30
DEFAULT_PORT = 0
DEFAULT_HOST = None
DEFAULT_LOG_LEVEL = None
DEFAULT... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils._text import to_native
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ec2 import camel_dict_to_snake_dict, ec2_argument_s... |
import sys
absolute_import = (sys.version_info[0] >= 3)
if absolute_import :
# Because this syntaxis is not valid before Python 2.5
exec("from . import db")
else :
import db
if sys.version_info < (2, 6) :
from UserDict import DictMixin as MutableMapping
else :
import collections
MutableMapping ... |
# coding: utf-8
'''
Mise en forme d'un gabarit normé pour chaque champ d'un formulaire
_form : Objet formulaire
Retourne un tableau associatif
'''
def sub(_form) :
# Imports
from bs4 import BeautifulSoup
from django.template.defaultfilters import safe
from smmaranim.custom_settings import ERROR_MESSAGES
from smm... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import os, sys, inspect
# ensure pyeq2 can be imported
if -1 != sys.path[0].find('pyeq2-master'):raise Exception('Please rename git checkout directory from "pyeq2-master" to "pyeq2"')
importDir = os.p... |
"""
TimeLine Part in Dashboard Window
"""
import gtk
from umit.icm.agent.I18N import _
from umit.icm.agent.gui.dashboard.timeline.TimeLineGraph import InteractiveGraph
from umit.icm.agent.gui.dashboard.timeline.TimeLineGraphToolbar import TimeLineGraphToolbar
from umit.icm.agent.gui.dashboard.timeline.TimeLineGraphBa... |
# -*- coding: utf-8 -*-
# Last modified: 2017-07-08
# Original data: Adachi 1989, https://doi.org/10.1063/1.343580
# In(1-x)Ga(x)As; x=0.48
import numpy as np
import matplotlib.pyplot as plt
π = np.pi
# model parameters
E0 = 0.75 #eV
Δ0 = 1.04-E0 #eV
E1 = 2.57 #eV
Δ1 = 2.83-E1 #eV
E2 = 4.41 #eV
Eg ... |
import tensorflow as tf
import re
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_boolean('use_fp16', False,
"""Train the model using fp16.""")
TOWER_NAME = 'tower'
NUM_CLASSES = 3
def _variable_on_cpu(name, shape, initializer):
"""Helper to create a Variable stored on CPU memory.
... |
import sys
import logging
from datetime import datetime
from django.db import transaction
from . import models
# trap wrong HTTP methods
from django.http import HttpResponse
from rest_framework import status
import json
logger = logging.getLogger(__name__)
class ChangesetMiddleware(object):
"""
Create a ne... |
"""
Support for Vera sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.vera/
"""
import logging
from datetime import timedelta
from homeassistant.const import (
TEMP_CELSIUS, TEMP_FAHRENHEIT)
from homeassistant.helpers.entity import Ent... |
"""
Decorator module, see
http://www.phyast.pitt.edu/~micheles/python/documentation.html
for the documentation and below for the licence.
"""
## The basic trick is to generate the source code for the decorated function
## with the right signature and to evaluate it.
## Uncomment the statement 'print >> sys.stderr, fun... |
# Example of simple echo server
# www.solusipse.net
import socket
import os
import subprocess
import fileinput
from export import export_json
from parse import parse
import json
def listen():
connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connection.setsockopt(socket.SOL_SOCKET,... |
"""Contains extensions to Atom objects used with Google Documents."""
__author__ = ('api.jfisher (Jeff Fisher), '
'<EMAIL> (Eric Bidelman)')
import atom
import gdata
DOCUMENTS_NAMESPACE = 'http://schemas.google.com/docs/2007'
class Scope(atom.AtomBase):
"""The DocList ACL scope element"""
_tag ... |
"""
Django settings for arguman project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... |
import synapse.lib.module as s_module
class LangModule(s_module.CoreModule):
def getModelDefs(self):
name = 'lang'
ctors = ()
forms = (
('lang:idiom', {}, (
('url', ('inet:url', {}), {
'doc': 'Authoritative URL for the idiom.'
... |
# importing libraries
import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy as sp
import IPython
from IPython.display import display
import sklearn
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.pre... |
"""
urllib3 - Thread-safe connection pooling and re-using.
"""
__author__ = 'Andrey Petrov (<EMAIL>)'
__license__ = 'MIT'
__version__ = 'dev'
from .connectionpool import (
HTTPConnectionPool,
HTTPSConnectionPool,
connection_from_url
)
from . import exceptions
from .filepost import encode_multipart_formd... |
#!/usr/bin/env python
# encoding: utf-8
import sys
import waflib
_board_classes = {}
class BoardMeta(type):
def __init__(cls, name, bases, dct):
super(BoardMeta, cls).__init__(name, bases, dct)
if name == 'Board':
return
_board_classes[name] = cls
class Board:
def config... |
#!/usr/bin/env python3
# --------------------- #
# -- SEVERAL IMPORTS -- #
# --------------------- #
import json
from mistool.os_use import PPath
# ------------------- #
# -- MODULE TESTED -- #
# ------------------- #
from orpyste.parse import ast
# ----------------------- #
# -- GENERAL CONSTANTS -- #
# ------... |
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
def make_page(object_list, page, per_page=8, neighbor_count=5):
"""Return a Django Page object with a list of neighbor pages.
"neighbor pages" is some pages next to the current page.
e.g. page 6 may has neighbor page 5, 4, 3 and 7, ... |
import amulet
import unittest
class TestDeploy(unittest.TestCase):
"""
Trivial deployment test for Apache Bigtop Kafka.
"""
@classmethod
def setUpClass(cls):
cls.d = amulet.Deployment(series='xenial')
cls.d.add('kafka')
cls.d.add('zookeeper')
cls.d.relate('kafka:zo... |
"""
BlurPool layer inspired by
- Kornia's Max_BlurPool2d
- Making Convolutional Networks Shift-Invariant Again :cite:`zhang2019shiftinvar`
Hacked together by Chris Ha and Ross Wightman
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from .padding import get_padding
class ... |
"""
=============================
Species distribution dataset
=============================
This dataset represents the geographic distribution of species.
The dataset is provided by Phillips et. al. (2006).
The two species are:
- `"Bradypus variegatus"
<http://www.iucnredlist.org/apps/redlist/details/3038/0>`_... |
# coding=utf-8
__author__ = "Gina Häußge <<EMAIL>>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
import os
import traceback
import sys
import time
import re
import tempfile
from flask import make_response
from octoprint.settings import settings, default_settings
def getFor... |
from __future__ import division
from collections import defaultdict
from functools import partial
import numpy as np
import scipy.sparse as sp
from sklearn.externals.six.moves import zip
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing imp... |
#
# shift_jis.py: Python Unicode Codec for SHIFT_JIS
#
# Written by Hye-Shik Chang <<EMAIL>>
#
import _codecs_jp, codecs
import _multibytecodec as mbc
codec = _codecs_jp.getcodec('shift_jis')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class IncrementalEncoder(mbc.MultibyteIncreme... |
# coding=utf-8
"""
Collects stats from Endeca Dgraph/MDEX server.
Tested with: Endeca Information Access Platform version 6.3.0.655584
=== Authors
Jan van Bemmelen <<EMAIL>>
Renzo Toma <<EMAIL>>
"""
import diamond.collector
import urllib2
from StringIO import StringIO
import re
import sys
if sys.version_info >= (2... |
#! /usr/local/bin/python2.5
"""
The Py-Client serves as a lightweight altenative to the graphical
NetChat J-Client. Using curses to manage input and output, it is
entirely terminal-based, and can be configured to run to taste via
command line arguments.
"""
import os.path
import signal
import sys
from twisted.inter... |
from SimpleCV.base import *
from SimpleCV.ImageClass import Image
from SimpleCV.Features.FeatureExtractorBase import *
class BOFFeatureExtractor(object):
"""
For a discussion of bag of features please see:
http://en.wikipedia.org/wiki/Bag_of_words_model_in_computer_vision
Initialize the bag of feature... |
# EventClass.py
#
# This is a library defining some events types classes, which could
# be used by other scripts to analyzing the perf samples.
#
# Currently there are just a few classes defined for examples,
# PerfEvent is the base class for all perf event sample, PebsEvent
# is a HW base Intel x86 PEBS event, and use... |
from twisted.trial import unittest
from twisted.python import log as txlog
from twisted.python.failure import Failure
from twisted.internet import defer, reactor
from scrapy.xlib.pydispatch import dispatcher
from scrapy.utils.signal import send_catch_log, send_catch_log_deferred
from scrapy import log
class SendCatch... |
"""API endpoints dealing with batch operations."""
import tornado.web
import dokomoforms.api.batch as batch_api
from dokomoforms.db.survey import IncorrectQuestionIdError
from dokomoforms.handlers.util.base import APIHandler, \
catch_bare_integrity_error, \
get_json_request_body, validation_message
class Batc... |
"""Tests for sonnet.python.ops.nest.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
# Dependency imports
import numpy as np
import six
from sonnet.python.ops import nest
import tensorflow as tf
typekw = "class" if six.PY3 else "typ... |
"""Layer serialization/deserialization functions.
"""
# pylint: disable=wildcard-import
# pylint: disable=unused-import
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import threading
from tensorflow.python import tf2
from tensorflow.python.keras.engine i... |
#!/usr/bin/env python
import os.path
import re
import sys
import tempfile
import zipfile
import wheel.bdist_wheel
import distutils.dist
from distutils.archive_util import make_archive
from shutil import rmtree
from wheel.archive import archive_wheelfile
from argparse import ArgumentParser
from glob import iglob
egg_in... |
import django.http
from autotest.frontend.tko import rpc_interface, graphing_utils
from autotest.frontend.tko import csv_encoder
from autotest.frontend.afe import rpc_handler, rpc_utils
rpc_handler_obj = rpc_handler.RpcHandler((rpc_interface,),
document_module=rpc_interface)
d... |
#
# This module is a pure Python version of pypy.module.struct.
# It is only imported if the vastly faster pypy.module.struct is not
# compiled in. For now we keep this version for reference and
# because pypy.module.struct is not ootype-backend-friendly yet.
#
# this module 'borrowed' from
# https://bitbucket.org/p... |
from __future__ import unicode_literals
import errno
import os
import re
import socket
import sys
from datetime import datetime
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.core.servers.basehttp import (
WSGIServer, get_internal_wsgi_application, r... |
import os
from telemetry.core import util
from telemetry.page import page as page_module
from telemetry.page.actions import scroll
from telemetry.unittest import tab_test_case
class ScrollActionTest(tab_test_case.TabTestCase):
def setUp(self):
self._extra_browser_args.append('--enable-gpu-benchmarking')
sup... |
import boto
import os
import re
import sys
from boto.pyami.config import BotoConfigLocations
from gslib.command import Command
from gslib.command import COMMAND_NAME
from gslib.command import COMMAND_NAME_ALIASES
from gslib.command import CONFIG_REQUIRED
from gslib.command import FILE_URIS_OK
from gslib.command import... |
import json as jsmod
def json_dump(obj, indent=None):
""" Dump an object to json string, only basic types are supported.
@return json string or `None` if failed
>>> json_dump({'int': 1, 'none': None, 'str': 'string'})
'{"int":1,"none":null,"str":"string"}'
"""
try:
jstr = ... |
"""A simple wrapper around enum types to expose utility functions.
Instances are created as properties with the same name as the enum they wrap
on proto classes. For usage, see:
reflection_test.py
"""
__author__ = '<EMAIL> (Kevin Rabsatt)'
class EnumTypeWrapper(object):
"""A utility for finding the names of en... |
import array
import collections
import logging
import numbers
from haystack.reverse import fieldtypes
from haystack.reverse import re_string
from haystack.reverse.heuristics import model
log = logging.getLogger('dsa')
# fieldtypes.Field analysis related functions and classes
def _py3_byte_compat(c):
if isinsta... |
"""Tests of the service health endpoint."""
from __future__ import absolute_import
import mock
from django.conf import settings
from django.contrib.auth import get_user, get_user_model
from django.db import DatabaseError
from django.test.utils import override_settings
from django.urls import reverse
from rest_framewor... |
""" Python Character Mapping Codec koi8_t
"""
# http://ru.wikipedia.org/wiki/КОИ-8
# http://www.opensource.apple.com/source/libiconv/libiconv-4/libiconv/tests/KOI8-T.TXT
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,err... |
"""Tests for our flags implementation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import unittest
from tensorflow.python.platform import app
from tensorflow.python.platform import flags
flags.DEFINE_string("string_foo", "default_val", "H... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
from pants.util.osutil import OS_ALIASES, known_os_names, normalize_os_name
from pants_test.base_test import BaseTest
class OsutilTest(BaseTest):
... |
from __future__ import unicode_literals
from django.db.models import Q
from django.test import TestCase
from .models import (
Comment, Forum, Item, Post, PropertyValue, SystemDetails, SystemInfo,
)
class NullFkTests(TestCase):
def test_null_fk(self):
d = SystemDetails.objects.create(details='First ... |
from collections.abc import Iterable
import re
import warnings
import numpy as np
import h5py
import openmc
import openmc.checkvalue as cv
from openmc.region import Region
_VERSION_SUMMARY = 6
class Summary(object):
"""Summary of geometry, materials, and tallies used in a simulation.
Attributes
------... |
from setuptools import setup, find_packages
import sys
# parse requirements
req_lines = [line.strip() for line in open(
'requirements.txt').readlines()]
install_reqs = list(filter(None, req_lines))
if sys.version_info[:2] == (2, 6):
install_reqs.append('importlib>=1.0.3')
setup(
name="junos-eznc",
nam... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The spm module provides basic functions for interfacing with SPM tools.
In order to use the standalone MCR version of spm, you need to ensure that
the following commands are executed at the beginning o... |
import unittest
import boto3
from airflow import configuration
from airflow.contrib.sensors.aws_redshift_cluster_sensor import AwsRedshiftClusterSensor
try:
from moto import mock_redshift
except ImportError:
mock_redshift = None
class TestAwsRedshiftClusterSensor(unittest.TestCase):
def setUp(self):
... |
import sys
import os
import re
from StringIO import StringIO
from django.conf import settings
from django.core.management import call_command
# 1. turn this into a management command `inspectdbs`
# 2. create a Model mixin that stores attributes in the Meta class per this:
# http://stackoverflow.com/questions/10884... |
#!/usr/bin/env python
"""Installer for gemini: a lightweight db framework for disease and population genetics.
https://github.com/arq5x/gemini
Handles installation of:
- Required third party software
- Required Python libraries
- Gemini application
- Associated data files
Requires: Python 2.7 (or 2.6 and argparse),... |
"""
Machine arithmetics - determine the parameters of the
floating-point arithmetic system
"""
__all__ = ['MachAr']
from numpy.core.fromnumeric import any
from numpy.core.numeric import seterr
# Need to speed this up...especially for longfloat
class MachAr(object):
"""
Diagnosing machine parameters.
A... |
import sys
import os
from astropy.units import ys
sys.path.insert(0, os.path.abspath('..'))
import random
import numpy as np
import matplotlib.pyplot as plt
from assignment2.cs231n.layers import affine_forward
from assignment2.cs231n.layers import affine_backward
from assignment2.cs231n.layers import relu_forward
fro... |
import traceback
import mock
import six
from rally import consts
from rally import exceptions
from rally.task import context
from rally.task import scenario
from rally.task import validation
from tests.unit import fakes
from tests.unit import test
class ScenarioConfigureTestCase(test.TestCase):
def test_config... |
"""
Adjacency matrix and incidence matrix of graphs.
"""
# Copyright (C) 2004-2011 by
# Aric Hagberg <<EMAIL>>
# Dan Schult <<EMAIL>>
# Pieter Swart <<EMAIL>>
# All rights reserved.
# BSD license.
import networkx as nx
__author__ = "\n".join(['Aric Hagberg (<EMAIL>)',
'Pieter ... |
import os
import subprocess
def get_hg_status():
has_modified_files = False
has_untracked_files = False
has_missing_files = False
output = subprocess.Popen(['hg', 'status'],
stdout=subprocess.PIPE).communicate()[0]
for line in output.split('\n'):
if line == '':
conti... |
########################################################################
# $HeadURL $
# File: FileCatalogProxyHandler.py
########################################################################
"""
:mod: FileCatalogProxyHandler
.. module: FileCatalogProxyHandler
:synopsis: This is a service which represents a DIS... |
import hr_timesheet
import wizard
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""
Database models for the LTI provider feature.
This app uses migrations. If you make changes to this model, be sure to create
an appropriate migration file and check it in at the same time as your model
changes. To do that,
1. Go to the edx-platform dir
2. ./manage.py lms schemamigration lti_provider --auto "descr... |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Reporter(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
email = models.EmailField(... |
"""Python wrapper for the Block GRU Op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.rnn.python.ops import core_rnn_cell
from tensorflow.contrib.util import loader
from tensorflow.python.framework import ops
from tensorflow.pyth... |
from tests.support.asserts import assert_success
def get_timeouts(session):
return session.transport.send(
"GET", "session/{session_id}/timeouts".format(**vars(session)))
def test_get_timeouts(session):
response = get_timeouts(session)
assert_success(response)
assert "value" in response.bod... |
import time
try:
from novaclient.v1_1 import client as nova_client
try:
from neutronclient.neutron import client
except ImportError:
from quantumclient.quantum import client
from keystoneclient.v2_0 import client as ksclient
HAVE_DEPS = True
except ImportError:
HAVE_DEPS = False
... |
# encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from .brightcove import BrightcoveIE
from ..utils import ExtractorError
class EitbIE(InfoExtractor):
IE_NAME = 'eitb.tv'
_VALID_URL = r'https?://www\.eitb\.tv/(eu/bideoa|es/video)/[^/]+/(?P<playlist_id>\d+)... |
import bitcoin as bc
import sys
import unittest
class TestStealth(unittest.TestCase):
def setUp(self):
if sys.getrecursionlimit() < 1000:
sys.setrecursionlimit(1000)
self.addr = 'vJmtjxSDxNPXL4RNapp9ARdqKz3uJyf1EDGjr1Fgqs9c8mYsVH82h8wvnA4i5rtJ57mr3kor1EVJrd4e5upACJd58... |
from __future__ import division, absolute_import, print_function
import sys
import os
import shutil
from tempfile import NamedTemporaryFile, TemporaryFile, mktemp, mkdtemp
from numpy import memmap
from numpy import arange, allclose, asarray
from numpy.testing import (
TestCase, run_module_suite, assert_, assert_e... |
"""
Various helper utilities.
"""
import six
from astroid import bases
from astroid import context as contextmod
from astroid import exceptions
from astroid import manager
from astroid import nodes
from astroid import raw_building
from astroid import scoped_nodes
from astroid import util
BUILTINS = six.moves.builti... |
# -*- coding: utf-8 -*-
try:
import simplejson as json
except ImportError:
import json
import logging
import pprint
import werkzeug
from openerp import http, SUPERUSER_ID
from openerp.http import request
_logger = logging.getLogger(__name__)
class BuckarooController(http.Controller):
_return_url = '/pa... |
"""Sanity test for symlinks in the bin directory."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ... import types as t
from . import (
SanityVersionNeutral,
SanityMessage,
SanityFailure,
SanitySuccess,
)
from ...config import (
SanityCon... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.