content string |
|---|
import base64
import re
import threading
from openerp.tools.safe_eval import safe_eval as eval
from openerp import tools
import openerp.modules
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp import SUPERUSER_ID
def one_in(setA, setB):
"""Check the presence of an element of s... |
import warnings
from typing import Callable, Dict, Optional, Sequence, Tuple
from google.api_core import grpc_helpers # type: ignore
from google.api_core import operations_v1 # type: ignore
from google.api_core import gapic_v1 # type: ignore
import google.auth # type: ignore
from googl... |
"""Test BIP66 (DER SIG).
Test that the DERSIG soft-fork activates at (regtest) height 1251.
"""
from test_framework.blocktools import create_coinbase, create_block, create_transaction
from test_framework.messages import msg_block
from test_framework.mininode import mininode_lock, P2PInterface
from test_framework.scri... |
from __future__ import absolute_import
from openid.extensions import ax
import requests
from requests_oauthlib import OAuth1
from pyramid.security import NO_PERMISSION_REQUIRED
from ..api import register_provider
from ..compat import parse_qsl
from .oid_extensions import OAuthRequest
from .openid import (
Open... |
from cached_property import cached_property
from netengine.backends.ssh import SSH
__all__ = ['AirOS']
class AirOS(SSH):
"""
Ubiquiti AirOS SSH backend
Version 5.5.8
"""
def __str__(self):
""" print a human readable object description """
return u"<SSH (Ubiquity AirOS): %s@%s>"... |
###new function:shuffling the reviewing time and debug the program
###R is set to a constant value
import simplejson as json
import datetime
import time
import numpy as np
import math
from multiprocessing import Pool
from multiprocessing.dummy import Pool as ThreadPool
from dateutil.relativedelta import *
from sklearn... |
"""Posix reactor base class
API Stability: stable
Maintainer: U{Itamar Shtull-Trauring<mailto:<EMAIL>>}
"""
import warnings
import socket
import errno
import os
from zope.interface import implements, classImplements
from twisted.internet.interfaces import IReactorUNIX, IReactorUNIXDatagram
from twisted.internet.int... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
parse_iso8601,
str_to_int,
)
class CrackedIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?cracked\.com/video_(?P<id>\d+)_[\da-z-]+\.html'
_TESTS = [{
'url': 'http://www.cracked.com/... |
"""Utility module to import a JSON module
Hides all the messy details of exactly where
we get a simplejson module from.
"""
__author__ = '<EMAIL> (Joe Gregorio)'
try: # pragma: no cover
# Should work for Python2.6 and higher.
import json as simplejson
except ImportError: # pragma: no cover
try:
import sim... |
from ....const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#-------------------------------------------------------------------------
#
# Gramps modules
#
#-------------------------------------------------------------------------
from .._hasreferencecountbase import HasReferenceCountBase
#--------... |
# encoding: utf-8
from __future__ import unicode_literals
import re
import json
import xml.etree.ElementTree
from .common import InfoExtractor
from ..utils import (
compat_urllib_parse,
find_xpath_attr,
fix_xml_ampersands,
compat_urlparse,
compat_str,
compat_urllib_request,
compat_parse_qs... |
import os
import sys
from collections import defaultdict
from UserList import UserList
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
sys.path.append('scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from SchedGui... |
from twisted.internet import reactor, defer
from twisted.spread import pb
from zope.interface import implements
from flumotion.common import testsuite
from flumotion.twisted import flavors
class TestStateCacheable(flavors.StateCacheable):
pass
class TestStateRemoteCache(flavors.StateRemoteCache):
pass
pb.... |
"""Ganeti python modules"""
try:
from ganeti import ganeti
except ImportError:
pass
else:
raise Exception("A module named \"ganeti.ganeti\" was successfully imported"
" and should be removed as it can lead to importing the"
" wrong module(s) in other parts of the code, consequ... |
"""Utilities to evaluate models with respect to a variable
"""
#
# License: BSD 3 clause
import warnings
import numpy as np
from .base import is_classifier, clone
from .cross_validation import check_cv
from .externals.joblib import Parallel, delayed
from .cross_validation import _safe_split, _score, _fit_and_score
f... |
#!/usr/bin/python3
import codecs
##########################################################################################################
# #
# Based on: ... |
from flask.ext.wtf import Form
from wtforms import TextField, PasswordField, BooleanField, IntegerField
from wtforms.validators import Required, Email, EqualTo
class LoginForm(Form):
user_name = TextField('user_name', validators = [Required(), Email(message=u'Invalid email address')])
#Not an encrypted password
pas... |
import argparse
import os
import signal
import sys
def main():
parser = argparse.ArgumentParser(description='Mock tool with control over its output & termination.')
parser.add_argument('--print-args', action='store_true', default=False,
help='print the (non-option) arguments')
pars... |
from itertools import izip
from warnings import warn
import numpy
from tractography import Tractography
from nibabel import trackvis
def tractography_to_trackvis_file(filename, tractography, affine=None, image_dimensions=None):
trk_header = trackvis.empty_header()
if affine is not None:
pass
e... |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
def execute(filters=None):
period_list = get_period_list(filters.fiscal_year, filters.periodicity)
income = get_da... |
import traceback
import imp
class Module():
def __init__(self, module_filename):
# the filename e.g. mod_list.py
self.filename = module_filename
# the filename without extension
self.name = module_filename[:-3]
# start marked as unloaded, so this will hold true if anything... |
#!/usr/bin/python
import unittest
import optparse
from common import check_env
from regressionc import TestOpenmamac
from regressioncpp import TestOpenmamacpp
import globals
if __name__ == '__main__':
parser = optparse.OptionParser()
parser.add_option("--tport", dest="transport",nargs=2,help='Name of pub and... |
from __future__ import absolute_import
from contextlib import contextmanager
import pkg_resources
import time
import logging
import stat
import os
import json
import tempfile
import shutil
import threading
import six
logger = logging.getLogger(__name__)
def first_entry_point(group, name=None):
for ep in pkg_reso... |
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class MseCasesPage(page_module.Page):
def __init__(self, url, page_set):
super(MseCasesPage, self).__init__(url=url, page_set=page_set)
def RunNavigateSteps(self, action_runner):
super(MseCasesPage, sel... |
import unittest
class TestOperation(unittest.TestCase):
OPERATION_NAME = '123456789'
@staticmethod
def _get_target_class():
from google.cloud.speech.operation import Operation
return Operation
def _make_one(self, *args, **kwargs):
return self._get_target_class()(*args, **kwa... |
class WebDocument:
"Web document"
def Info(self):
return "Web document"
# Get the Parameter Group of this module
ParGrp = App.ParamGet("System parameter:Modules").GetGroup("Web")
# Set the needed information
ParGrp.SetString("HelpIndex", "Web/Help/index.html")
ParGrp.SetString("Do... |
import datetime
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self): # __unicode__ on Pytho... |
from oslo_log import log
from manila.api.middleware import auth
from manila.i18n import _LW
LOG = log.getLogger(__name__)
class ManilaKeystoneContext(auth.ManilaKeystoneContext):
def __init__(self, application):
LOG.warn(_LW('manila.api.auth:ManilaKeystoneContext is deprecated. '
'P... |
"""Holds the constants for pretty printing histograms.xml."""
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
import pretty_print_xml
# Desired order for tag attributes; attributes listed here will appear first,
# and in the same order as in these lists.
# { tag_name: [a... |
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest ; pytest
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
import time
# E... |
"""
Django settings for website project.
Generated by 'django-admin startproject' using Django 1.11.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os... |
from sqlalchemy import Column
from sqlalchemy import MetaData
from sqlalchemy import Table
from sqlalchemy import Text
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
# Add a new column metrics to save metrics info for compute nodes
compute_nodes = Table('compute_nodes', met... |
import argparse
import logging
import os
import sys
from Bio import SeqIO
from setuptools import glob
L = logging.getLogger(__name__)
def read_fastq_file(file_name):
# type: (str) -> List[str]
reads = []
with open(file_name, "rU") as handle:
for record in SeqIO.parse(handle, "fastq"):
... |
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
import selenium.webdriver.chrome.service as service
import inspect
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Logit function
=========================================================
Show in the plot is how the logistic regression would, in this
synthetic dataset, classify values as either 0 or 1,
i.e. class one or two, u... |
import torch
import torch.utils.data as data
import torchvision.transforms as transforms
import os
import nltk
from PIL import Image
# from pycocotools.coco import COCO
import numpy as np
import json as jsonmod
def get_paths(path, name='coco', use_restval=False):
"""
Returns paths to images and annotations fo... |
import sys, logging
from PyQt4.QtCore import *
from PyQt4.QtGui import *
try:
from osgeo import gdal
from osgeo import ogr
except:
import gdal
import ogr
from stdm.data import (
columnType,
geometryType
)
from enums ... |
# -*- coding: UTF-8 -*-
import wx
import pmt
from gnuradio import gr, blocks
wxDATA_EVENT = wx.NewEventType()
def EVT_DATA_EVENT(win, func):
win.Connect(-1, -1, wxDATA_EVENT, func)
class DataEvent(wx.PyEvent):
def __init__(self, data):
wx.PyEvent.__init__(self)
self.SetEventType (wxDATA_EVENT)
self.data = da... |
import os
import libtorrent as lt
from seedbank.cli.command import Command
class CreateCommand(Command):
def __init__(self, **kwargs):
Command.__init__(self, **kwargs)
self._output_file = kwargs.get('output_file', None)
self._torrent_data = kwargs.get('torrent_data', None)
self._tra... |
'''A node that groups members for control propagation and status monitoring - see script.py for notes'''
# For disappearing member support:
# (see readme, requires at least Nodel Host rev. 322 or later)
#
# - remote "Disappearing" signals should be wired to the actual signals
# - the usual remote signals shou... |
from __future__ import absolute_import
import hashlib
import logging
import sys
from pip.basecommand import Command
from pip.status_codes import ERROR
from pip.utils import read_chunks
from pip.utils.hashes import FAVORITE_HASH, STRONG_HASHES
logger = logging.getLogger(__name__)
class HashCommand(Command):
""... |
RHNROOT = '/usr/share/rhn'
import sys
if RHNROOT not in sys.path:
sys.path.append(RHNROOT)
from config_common.rhn_main import BaseMain
class Main(BaseMain):
modes = [
'add',
'create-channel',
'diff',
'diff-revisions',
'download-channel',
'get',
'list',
... |
import proto # type: ignore
from google.cloud.dialogflow_v2beta1.types import gcs
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore
__protobuf__ = proto.module(
package="google.cloud.dialogflow.v... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from ansible.errors import AnsibleParserError
from ansible.playbook import Playbook
from ansible.vars.manager import VariableManager
from units.mock.loader import DictDataLoader
class TestPlaybo... |
"""Describe Shelly logbook events."""
from homeassistant.const import ATTR_DEVICE_ID
from homeassistant.core import callback
from .const import (
ATTR_CHANNEL,
ATTR_CLICK_TYPE,
ATTR_DEVICE,
DOMAIN,
EVENT_SHELLY_CLICK,
)
from .utils import get_device_name, get_device_wrapper
@callback
def async_d... |
from django.contrib.messages.storage.base import BaseStorage
class SessionStorage(BaseStorage):
"""
Stores messages in the session (that is, django.contrib.sessions).
"""
session_key = '_messages'
def __init__(self, request, *args, **kwargs):
assert hasattr(request, 'session'), "The sessi... |
from sqlalchemy.orm import exc
from neutron.db import api as db_api
from neutron.db import models_v2
from neutron.db import securitygroups_db as sg_db
from neutron.extensions import portbindings
from neutron import manager
from neutron.openstack.common import log
from neutron.openstack.common import uuidutils
from neu... |
from tastypie.serializers import Serializer
from tastypie.authentication import Authentication
from tastypie.http import HttpUnauthorized
from django.utils.timezone import is_naive
class ISOSerializer(Serializer):
"""
Our own serializer to format datetimes in ISO 8601 but with timezone
offset.
"""
... |
class ModuleDocFragment(object):
# AWS only documentation fragment
DOCUMENTATION = """
options:
ec2_url:
description:
- Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints).
Ignored for modules where region is required. Must be specified for a... |
import Image, ImageFile
_handler = None
##
# Install application-specific BUFR image handler.
#
# @param handler Handler object.
def register_handler(handler):
global _handler
_handler = handler
# --------------------------------------------------------------------
# Image adapter
def _accept(prefix):
... |
"""
urllib3 - Thread-safe connection pooling and re-using.
"""
from __future__ import absolute_import
import warnings
from .connectionpool import (
HTTPConnectionPool,
HTTPSConnectionPool,
connection_from_url
)
from . import exceptions
from .filepost import encode_multipart_formdata
from .poolmanager imp... |
""" Constants used by the justbytes package.
Categories of constants:
* Rounding methods
* Size units, e.g., Ki, Mi
"""
# isort: STDLIB
import abc
from numbers import Rational
# isort: FIRSTPARTY
import justbases
from ._errors import RangeValueError
RoundingMethods = justbases.RoundingMethods
class... |
from django.template import Library, Node, TemplateSyntaxError
from django.utils import formats
from django.utils.encoding import force_text
register = Library()
@register.filter(is_safe=False)
def localize(value):
"""
Forces a value to be rendered as a localized value,
regardless of the value of ``setti... |
import time
import sys
import pyborg
import cfgfile
import traceback
import thread
try:
import msnp
except:
print "ERROR !!!!\msnp not found, please install it ( http://msnp.sourceforge.net/ )"
sys.exit(1)
def get_time():
"""
Return time as a nice yummy string
"""
return time.strftime("%H:%M:%S", time.localtime... |
import socket
import mock
from essential import context
from essential.fixture import config
from essential.fixture import moxstubout
from essential import log
from essential.notifier import api as notifier_api
from essential.notifier import log_notifier
from essential.notifier import no_op_notifier
from essential.no... |
"""Support for Z-Wave covers."""
import logging
from homeassistant.core import callback
from homeassistant.components.cover import (
DOMAIN, SUPPORT_OPEN, SUPPORT_CLOSE, ATTR_POSITION)
from homeassistant.components.cover import CoverDevice
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .... |
"""Unit Tests for bug hunter."""
import logging
from optparse import Values
import smtplib
import sys
import unittest
from bug_hunter import BugHunter
from bug_hunter import BugHunterUtils
try:
import atom.data
import gdata.data
import gdata.projecthosting.client
except ImportError:
logging.error('gdata-clie... |
#!/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... |
from django.core.management.base import NoArgsCommand
from django_mailer import models
from django_mailer.management.commands import create_handler
from optparse import make_option
import logging
class Command(NoArgsCommand):
help = 'Place deferred messages back in the queue.'
option_list = NoArgsCommand.opti... |
from bs4 import BeautifulSoup
from sickbeard import classes, show_name_helpers, logger
from sickbeard.common import Quality
import generic
import cookielib
import sickbeard
import urllib
import random
import urllib2
import re
class XTHORProvider(generic.TorrentProvider):
def __init__(self):
gener... |
import asyncio
from pulsar import HAS_C_EXTENSIONS
from pulsar.apps.test import check_server
from pulsar.apps.data import RedisScript
from .pulsards import unittest, RedisCommands, create_store
from .lock import RedisLockTests
OK = check_server('redis')
@unittest.skipUnless(OK, 'Requires a running Redis server')
... |
from os import mkdir
from os.path import exists
import numpy as np
import pandas as pd
from old.project import CassandraUtils
from old.project import get_time
RTD_STS_KEY = 'retweetedStatus'
MT_STS_KEY = 'userMentionEntities'
PATH = '/home/joao/Dev/Data/Twitter/'
FRIENDS_PATH = '/home/joao/Dev/Data/Twitter/friendshi... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
SITE_CACHE = {}
class SiteManager(models.Manager):
def get_current(self):
"""
Returns the current ``Site`` based on the SITE_ID in the
project's settings. The ``Site`` object is cached the first
... |
import mock
from nova.conductor.tasks import base
from nova import test
class FakeTask(base.TaskBase):
def __init__(self, context, instance, fail=False):
super(FakeTask, self).__init__(context, instance)
self.fail = fail
def _execute(self):
if self.fail:
raise Exception
... |
from marionette_driver.by import By
from marionette_harness import MarionetteTestCase
class RenderedElementTests(MarionetteTestCase):
def testWeCanGetComputedStyleValueOnElement(self):
test_url = self.marionette.absolute_url('javascriptPage.html')
self.marionette.navigate(test_url)
eleme... |
"""Distributed training and evaluation of a wide and deep model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
from six.moves import urllib
import tensorflow as tf
from tensorflow.contrib.learn.python.learn import learn_runner
... |
#!/usr/bin/env python
"""
Allow you smoothly surf on many websites blocking non-mainland visitors.
Copyright (C) 2012, 2013 Bo Zhu http://zhuzhu.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the ... |
data = (
'Zhi ', # 0x00
'Liu ', # 0x01
'Mei ', # 0x02
'Hoy ', # 0x03
'Rong ', # 0x04
'Zha ', # 0x05
'[?] ', # 0x06
'Biao ', # 0x07
'Zhan ', # 0x08
'Jie ', # 0x09
'Long ', # 0x0a
'Dong ', # 0x0b
'Lu ', # 0x0c
'Sayng ', # 0x0d
'Li ', # 0x0e
'Lan ', # 0x0f
'Yong ', # 0x10... |
from __future__ import print_function, division
from time import time
import argparse
import numpy as np
from sklearn.dummy import DummyClassifier
from sklearn.datasets import fetch_20newsgroups_vectorized
from sklearn.metrics import accuracy_score
from sklearn.utils.validation import check_array
from sklearn.ensemb... |
common_security_group_rule = {
'from_port': {'type': ['integer', 'null']},
'to_port': {'type': ['integer', 'null']},
'group': {
'type': 'object',
'properties': {
'tenant_id': {'type': 'string'},
'name': {'type': 'string'}
},
'additionalProperties': Fal... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'core'}
DOCUMENTATION = r'''
---
module: assemble
short_description: Assemble configuration files ... |
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 AddPermission(Choreography):
def __init__(self, temboo_session):
"""
Create a... |
class ModuleDocFragment(object):
# Standard files documentation fragment
DOCUMENTATION = """
options:
host:
description:
- Specifies the DNS host name or address for connecting to the remote
device over the specified transport. The value of host is used as
the destination address f... |
"""
Python Blueprint
================
Does not install python itself, only develop and setup tools.
Contains pip helper for other blueprints to use.
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.python
"""
from fabric.decorators import task
from refabric.api import run, info
from refa... |
VALID_ENGINES = [
'mysql5.1',
'mysql5.5',
'mysql5.6',
'oracle-ee-11.2',
'oracle-se-11.2',
'oracle-se1-11.2',
'postgres9.3',
'postgres9.4',
'sqlserver-ee-10.5',
'sqlserver-ee-11.0',
'sqlserver-ex-10.5',
'sqlserver-ex-11.0',
'sqlserver-se-10.5',
'sqlserver-se-11.0',... |
TIS620CharToOrderMap = (
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, # 10
253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, # 20
252,252,252,252,252,252,252,252,252,252,253,253,253,253,253,253, # 30
253,182,106... |
from mini import app
from mini.util import AnonymousUser
from mini.models import User, Email
from datetime import datetime as dt, date as d, timedelta as td
from flask import Markup
import time, os, pygments, pygments.lexers, pygments.formatters, git, re
from os.path import *
from json import dumps
# UTILITY to wrap a... |
import unittest, sys, time
sys.path.extend(['.','..','../..','py'])
import h2o2 as h2o
import h2o_cmd, h2o_import as h2i
from h2o_test import dump_json, verboseprint, OutputObj
import h2o_jobs
DO_CLASSIFICATION = True
DO_FAIL_CASE = False
DO_FROM_TO_STEP = False
class Basic(unittest.TestCase):
def tearDown(self):... |
from buildbot.steps.shell import ShellCommand
from buildbot.steps.transfer import FileDownload
from buildbot.status.builder import SUCCESS, FAILURE, SKIPPED, WARNINGS
from buildbot.process.buildstep import LoggingBuildStep, RemoteShellCommand
import buildbot.status.builder
from twisted.python import log
import re
cla... |
from lxml import etree
from nova.api.openstack import compute
from nova.api.openstack.compute.plugins.v3 import server_diagnostics
from nova.api.openstack import wsgi
from nova.compute import api as compute_api
from nova import exception
from nova.openstack.common import jsonutils
from nova import test
from nova.tests... |
import os
import struct
import subprocess
__all__ = [
'get_terminal_size'
]
def get_terminal_size(default=(80, 20)):
"""
:return: (lines, cols)
"""
def ioctl_GWINSZ(fd):
import fcntl
import termios
return struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from fabric.state import env
from fabric.utils import puts
from .base import ConnectionDict, get_local_port
from .tunnel import LocalTunnel
class SocketTunnels(ConnectionDict):
"""
Cache for **socat** tunnels to the remote machine.
Instant... |
try:
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
_os_keystone = None
_os_tenant_id = None
_os_network_id = None... |
from django.test import SimpleTestCase, override_settings
from django.test.utils import require_jinja2
@override_settings(ROOT_URLCONF='shortcuts.urls')
class RenderTests(SimpleTestCase):
def test_render(self):
response = self.client.get('/render/')
self.assertEqual(response.status_code, 200)
... |
"""Configuration for deposit search."""
from elasticsearch_dsl import Q, TermsFacet
from flask import g
from flask_login import current_user
from flask_principal import RoleNeed
from invenio_access.models import Role
from invenio_search import RecordsSearch
from invenio_search.api import DefaultFilter
from cap.module... |
import datetime
from six import string_types
from ._generalslice import OPEN_OPEN, CLOSED_CLOSED, OPEN_CLOSED, CLOSED_OPEN, GeneralSlice
from ._parse import parse
INTERVAL_LOOKUP = {(True, True): OPEN_OPEN,
(False, False): CLOSED_CLOSED,
(True, False): OPEN_CLOSED,
... |
import datetime
import pytz
from django.test import TestCase
from django.core.urlresolvers import reverse
from mock import Mock, patch
from opaque_keys.edx.locations import SlashSeparatedCourseKey
import courseware.access as access
from courseware.masquerade import CourseMasquerade
from courseware.tests.factories imp... |
from tests.compat import unittest
from boto.ec2.connection import EC2Connection
from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping
from tests.compat import OrderedDict
from tests.unit import AWSMockServiceTestCase
class BlockDeviceTypeTests(unittest.TestCase):
def setUp(self):
s... |
from django import forms
from django.forms.widgets import Textarea, HiddenInput
class CreateZNodeForm(forms.Form):
name = forms.CharField(max_length=64)
data = forms.CharField(required=False, widget=Textarea)
sequence = forms.BooleanField(required=False)
class EditZNodeForm(forms.Form):
data = forms.CharFie... |
"""Add FailureReason
Revision ID: 1c5907e309f1
Revises: 4a12e7f0159d
Create Date: 2014-06-02 15:31:02.991394
"""
# revision identifiers, used by Alembic.
revision = '1c5907e309f1'
down_revision = '4a12e7f0159d'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembi... |
"""Manages cached OAuth2 tokens used by other depot_tools scripts.
Usage:
depot-tools-auth login codereview.chromium.org
depot-tools-auth info codereview.chromium.org
depot-tools-auth logout codereview.chromium.org
"""
import logging
import optparse
import sys
from third_party import colorama
import auth
impo... |
from openerp.addons.hr_holidays.tests import test_holidays_flow
checks = [
test_holidays_flow,
]
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""Add support for the Xiaomi TVs."""
import logging
import pymitv
import voluptuous as vol
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
from homeassistant.components.media_player.const import (
SUPPORT_TURN_OFF,
SUPPORT_TURN_ON,
SUPPORT_VOLUME_STEP,
)
from homeassi... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
import os
from ansible.compat.six import iteritems, binary_type, text_type
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.playbook.attribute import FieldAttribute
from ansible.playbook.... |
import forms
from flask import current_app as app
from generic.editor import GenericEditor
from bson import ObjectId
class ConsumeEditor(GenericEditor):
def __init__(self, *args, **kwargs):
super(ConsumeEditor, self).__init__(*args, **kwargs)
def _create_form(self, *args, **kwargs):
return f... |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 Lic... |
#!/usr/bin/env python
import contextlib
import download
import os
import shutil
import sys
import tarfile
if os.environ.get('BITS') == '32':
host_bits = 'i686'
extra_bits = 'x86_64'
else:
host_bits = 'x86_64'
extra_bits = 'i686'
extra = None
libdir = 'lib'
# Figure out our target triple
if sys.platf... |
from spack import *
class DeconseqStandalone(Package):
"""The DeconSeq tool can be used to automatically detect and efficiently
remove sequence contaminations from genomic and metagenomic datasets."""
homepage = "http://deconseq.sourceforge.net"
url = "https://sourceforge.net/projects/deconseq/f... |
from contextlib import contextmanager
import os
import shutil
import subprocess
import logging
from snapcraft.internal.errors import (
RequiredCommandFailure,
RequiredCommandNotFound,
RequiredPathDoesNotExist,
)
logger = logging.getLogger(__name__)
def replace_in_file(directory, file_pattern, search_pa... |
import logging
from app import db
from app.models import ContactGroup, ContactSubGroup, Gender, Contact
import random
from datetime import datetime
log = logging.getLogger(__name__)
def get_random_name(names_list, size=1):
name_lst = [
names_list[random.randrange(0, len(names_list))].decode("utf-8").capi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.