content string |
|---|
import os, popen2, re, sys
class MyPOpen(object):
def __init__(self, cmd, input = None, output = None, bufsize = -1):
self.status = -1
if input is None:
p2c_read, p2c_write = os.pipe()
self.tochild = os.fdopen(p2c_write, 'w', bufsize)
else:
p2c_write = N... |
from django.test import Client, SimpleTestCase, override_settings
from django.utils.translation import override
@override_settings(ROOT_URLCONF="view_tests.urls")
class CsrfViewTests(SimpleTestCase):
def setUp(self):
super(CsrfViewTests, self).setUp()
self.client = Client(enforce_csrf_checks=True... |
from django.utils.translation import ugettext_lazy as _
AUTO = "AUTO"
OWS = "OWS"
WMS = "WMS"
WFS = "WFS"
TMS = "TMS"
CSW = "CSW"
REST_MAP = "REST_MAP"
REST_IMG = "REST_IMG"
OGP = "OGP"
HGL = "HGL"
GN_WMS = "GN_WMS"
GN_CSW = "GN_CSW"
LOCAL = "L"
CASCADED = "C"
HARVESTED = "H"
INDEXED = "I"
LIVE = "X"
OPENGEOPORTAL =... |
from __future__ import division, print_function, absolute_import
_have_pil = True
try:
from scipy.misc.pilutil import imread as _imread
except ImportError:
_have_pil = False
__all__ = ['imread']
# Use the implementation of `imread` in `scipy.misc.pilutil.imread`.
# If it weren't for the different names of... |
from __future__ import absolute_import, unicode_literals
from operator import attrgetter
from django.core.exceptions import FieldError
from django.db import connection
from django.test import TestCase
from django.test.utils import CaptureQueriesContext
from django.utils import six
from .models import (Chef, CommonIn... |
"""Supports the unit-testing of logging code.
Provides support for unit-testing messages logged using the built-in
logging module.
Inherit from the LoggingTestCase class for basic testing needs. For
more advanced needs (e.g. unit-testing methods that configure logging),
see the TestLogStream class, and perhaps also ... |
import collections
import os
import sys
from optparse import OptionParser, NO_DEFAULT
import imp
import warnings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand, CommandError, handle_default_options
from django.core.management.color import color_style
from dj... |
from types import NoneType
import copy
import re
import sys
import pymongo
from pulp.common.dateutils import parse_iso8601_datetime
from pulp.server import exceptions as pulp_exceptions
from pulp.server.db.model.base import Model
class Criteria(Model):
def __init__(self, filters=None, sort=None, limit=None, ski... |
#!/opt/datadog-agent/embedded/bin/python
'''
Datadog
www.datadoghq.com
----
Make sense of your IT Data
Licensed under Simplified BSD License (see LICENSE)
(C) Boxed Ice 2010 all rights reserved
(C) Datadog, Inc. 2010-2014 all rights reserved
'''
# set up logging before importing any other c... |
#!/usr/bin/env python
'''
Ansible module for mediatype
'''
# vim: expandtab:tabstop=4:shiftwidth=4
#
# Zabbix mediatype ansible module
#
#
# Copyright 2015 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You... |
import unittest
import tarfile
import base64
from io import BytesIO
from google.protobuf.json_format import ParseDict
from fedlearner_webconsole.job.yaml_formatter import format_yaml, code_dict_encode, generate_self_dict
from fedlearner_webconsole.job.models import Job, JobState
from fedlearner_webconsole.proto.workflo... |
from os import path
from types import ListType
from mock import patch
from django.conf import settings
from django.test import TestCase as DjangoTestCase
from django.test.utils import override_settings
from eulxml.xmlmap import load_xmlobject_from_file, load_xmlobject_from_string
from eulxml.xmlmap.eadmap import EAD_... |
import unittest
import time
from nose.plugins.attrib import attr
from boto.redshift.layer1 import RedshiftConnection
from boto.redshift.exceptions import ClusterNotFoundFault
from boto.redshift.exceptions import ResizeNotFoundFault
class TestRedshiftLayer1Management(unittest.TestCase):
redshift = True
def ... |
"""multiple comments
Remove all comment column and add 2 new tables:
* one comment table
* one table to make the link between pt object and the comments
Revision ID: 538bc4ea9cd1
Revises: 29fc422c56cb
Create Date: 2015-05-05 11:03:45.982893
"""
# revision identifiers, used by Alembic.
revision = '538bc4ea9cd... |
"""Bisection algorithms."""
def insort_right(a, x, lo=0, hi=None):
"""Insert item x in list a, and keep it sorted assuming a is sorted.
If x is already in a, insert it to the right of the rightmost x.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched.
"""
... |
import Ice
import sys, time, random, numpy
from gnuradio import gr, gr_unittest, blocks
from gnuradio.ctrlport import GNURadio
from gnuradio import ctrlport
import os, struct
class test_ctrlport_probes(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
os.environ['GR_CONF_CONTROLPOR... |
# encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import int_or_none
class MusicPlayOnIE(InfoExtractor):
_VALID_URL = r'https?://(?:.+?\.)?musicplayon\.com/play(?:-touch)?\?(?:v|pl=100&play)=(?P<id>\d+)'
_TEST = {
'url': 'http://en.mu... |
# -*- coding: utf-8 -*-
from contextlib import contextmanager
from django.utils import six
from django.utils.encoding import force_text
from django.utils.translation import get_language as _get_language
from django.utils.translation import get_language_info
from django.utils.functional import lazy
from modeltranslati... |
import mox
from nova import context
from nova import db
from nova import exception
from nova.tests.xenapi import stubs
from nova.virt.xenapi import driver as xenapi_conn
from nova.virt.xenapi import fake
from nova.virt.xenapi import vm_utils
from nova.virt.xenapi import volume_utils
import unittest
class GetInstanceF... |
# -*- coding: utf-8 -*-
#
# spikeplot - plot_xvf_tensor.py
#
# Philipp Meier <pmeier82 at googlemail dot com>
# 2011-09-29
#
"""plot the xi vs f tensor in a grid"""
__docformat__ = 'restructuredtext'
__all__ = ['xvf_tensor']
##---IMPORTS
from .common import save_figure, check_plotting_handle, plt
##---FUNCTION
... |
"""
XML serializer.
"""
from __future__ import unicode_literals
from collections import OrderedDict
from xml.dom import pulldom
from xml.sax import handler
from xml.sax.expatreader import ExpatParser as _ExpatParser
from django.apps import apps
from django.conf import settings
from django.core.serializers import bas... |
import crm_profiling
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from openerp.osv import osv
from openerp.tools.translate import _
class pos_open_statement(osv.osv_memory):
_name = 'pos.open.statement'
_description = 'Open Statements'
def open_statement(self, cr, uid, ids, context=None):
"""
Open the statements
@param self: The object ... |
"""Configuration classes."""
from __future__ import absolute_import, print_function
import os
import sys
from lib.util import (
CommonConfig,
is_shippable,
docker_qualify_image,
)
from lib.metadata import (
Metadata,
)
class EnvironmentConfig(CommonConfig):
"""Configuration common to all comma... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}
def load_fixture(name):
path = os.p... |
#!/usr/bin/env python
import argparse
import json
import logging
import multiprocessing as mp
import os
import signal
import time
from collections import defaultdict
from random import sample
from insights.core import archives
from insights.core import load_package
from insights.core.evaluators import MultiEvaluator,... |
"""Package Index Tests
"""
import sys
import os
import unittest
import pkg_resources
from setuptools.compat import urllib2, httplib, HTTPError, unicode, pathname2url
import distutils.errors
import setuptools.package_index
from setuptools.tests.server import IndexServer
class TestPackageIndex(unittest.TestCase):
d... |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
from os.path import join
def configuration(parent_package='',top_path=None):
from numpy.distutils.system_info import get_info, NotFoundError
from numpy.distutils.misc_util import Configuration
from scipy._build_utils i... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.network.aruba.aruba import run_commands, get_config, load_config
f... |
import json
from xmodule_django.models import UsageKey
from xmodule.modulestore.django import SignalHandler
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from openedx.core.djangoapps.content.course_structures.models imp... |
"""
homeassistant.components.device_tracker.owntracks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OwnTracks platform for the device tracker.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.owntracks/
"""
import json
import logging
im... |
"""
Course Goals Views - includes REST API
"""
import analytics
from django.contrib.auth import get_user_model
from django.conf import settings
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.http import JsonResponse
from edx_rest_framework_extensions.authentication impo... |
#_*_ coding:utf-8 _*_
import sys,os,getpass
#######################################################################
def start_screen():
print ('''
*****************************************************************************
If you have one account,then choose "登录(L)";if none, please choose "注册(R)"
... |
import sys, os.path
# We put the system installed Anki first!
sys.path.insert(0, "/usr/share/anki")
# We'll put our bundled Anki after it
sys.path.insert(1, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'anki-bundled'))
__author__ = "David Snopek <<EMAIL>>"
__copyright__ = "Copyright (C) 2013 David Snopek"
... |
import account_sequence
import account_sequence_installer
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
import random
import openerp
import json
import openerp.addons.im_chat.im_chat
from openerp.osv import osv, fields
from openerp import tools
from openerp import http
from openerp.http import request
class im_livechat_channel(osv.Model):
_name = 'im_livechat.channel'
def _get_default_image(self, cr, uid, cont... |
#! /usr/bin/python
# -*- coding: latin-1 -*-
# $Id: Message.py 662 2007-02-06 13:59:26Z mtr $
"""
An implementation of the TUC Transfer Protocol.
This module contains a TTP message class and an XML parser that
transforms XML into a TTP message.
Copyright (C) 2004, 2007 by Lingit AS
Modified 25-may-2007, Kristian Ska... |
"""
Tests common to list and UserList.UserList
"""
import sys
import os
import unittest
from test import test_support, seq_tests
class CommonTest(seq_tests.CommonTest):
def test_init(self):
# Iterable arg is optional
self.assertEqual(self.type2test([]), self.type2test())
# Init clears p... |
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.executor.task_result import TaskResult
class TestTaskResult(unittest.TestCase):
def test_task_result_basic(self):
... |
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
from odoo.tests import tagged
@tagged('post_install', '-at_install')
class TestProductMargin(AccountTestInvoicingCommon):
def test_product_margin(self):
''' In order to test the product_margin module '''
supplier = self.env[... |
"""tzinfo implementations for psycopg2
This module holds two different tzinfo implementations that can be used as
the 'tzinfo' argument to datetime constructors, directly passed to psycopg
functions or used to set the .tzinfo_factory attribute in cursors.
"""
# psycopg/tz.py - tzinfo implementation
#
# Copyright (C) 2... |
from __future__ import with_statement
import os
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file ... |
VERSION='1.2.0.dev0' |
"""Probability data from various sources.
In this module, the "Essen corpus" refers to a corpus of 6,217 European folk
songs from the Essen Folksong Collection. The songs are available at
http://kern.ccarh.org/cgi-bin/ksbrowse?l=/essen and the list of songs used to
train the monophonic key and meter programs is publis... |
"""
YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
from StringIO import StringIO
import decimal
import yaml
from django.db import models
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as... |
from route_formatter_mixin import RouteFormatterMixin
from ryu.services.protocols.bgp.operator.command import Command
from ryu.services.protocols.bgp.operator.command import CommandsResponse
from ryu.services.protocols.bgp.operator.command import STATUS_ERROR
from ryu.services.protocols.bgp.operator.command import STA... |
from abc import ABCMeta, abstractmethod
import inspect
import pickle
import string
import sys
import xml.etree.cElementTree as ET
class UnitResult(object):
"""Results of a single test unit.
A test result can be one of:
- STATE_OK: Test ran successfully.
- STATE_SKIPPED: The test was skipped.
... |
from django.core.urlresolvers import reverse
from django.views.generic import TemplateView
from contact_form.views import ContactFormView as OriginalContactFormView
from pootle.core.views import AjaxResponseMixin
from .forms import ContactForm, ReportForm
SUBJECT_TEMPLATE = 'Unit #%d (%s)'
BODY_TEMPLATE = '''
Unit... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import unittest
from pants.base.build_root import BuildRoot
from pants.util.contextutil import environment_as, pushd, temporary_dir
from pants.util.dirutil ... |
"""Tests for regularizers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.layers.python.layers import summaries as summaries_lib
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorf... |
#/u/Goldensights
import praw
import time
import datetime
'''USER CONFIG'''
USERNAME = ""
#This is the bot's Username. In order to send mail, he must have some amount of Karma.
PASSWORD = ""
#This is the bot's Password.
USERAGENT = ""
#This is a short description of what the bot does. For example "/u/GoldenSights'... |
"""List package items."""
# :license: MIT, see LICENSE for more details.
import click
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.managers import ordering
from SoftLayer.utils import lookup
COLUMNS = ['category', 'keyName', 'description', 'priceId']
COLUMNS_ITEM_PRICES = ... |
import fnmatch
import glob
import os
import re
import sys
from itertools import dropwhile
from optparse import make_option
from subprocess import PIPE, Popen
from django.core.management.base import CommandError, BaseCommand
from django.utils.text import get_text_list
pythonize_re = re.compile(r'(?:^|\n)\s*//')
plural... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import re
decimal_point = re.compile(r"(\d+)")
def mkversion(major, minor, patch):
return (1000 * 1000 * int(major)) + (1000 * int(minor)) + int(patch)
def parse_lvs(data):... |
"""
Many-to-many relationships via an intermediary table
For many-to-many relationships that need extra fields on the intermediary
table, use an intermediary model.
In this example, an ``Article`` can have multiple ``Reporter`` objects, and
each ``Article``-``Reporter`` combination (a ``Writer``) has a ``position``
f... |
"""
Audio Interchange File Format (AIFF) parser.
Author: Victor Stinner
Creation: 27 december 2006
"""
from lib.hachoir_parser import Parser
from lib.hachoir_core.field import (FieldSet,
UInt16, UInt32, Float80, TimestampMac32,
RawBytes, NullBytes,
String, Enum, PascalString32)
from lib.hachoir_core.endia... |
# -*- coding: utf-8 -*-
import os
""" Merge Sort
----------
Uses divide and conquer to recursively divide and sort the list
Time Complexity: O(n log n)
Space Complexity: O(n) Auxiliary
Stable: Yes
Psuedo Code: CLRS. Introduction to Algorithms. 3rd ed. """
def merge(left, right):
"""
... |
"""
Decorators for views based on HTTP headers.
"""
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from calendar import timegm
from datetime import timedelta
from email.Utils import formatdate
from django.utils.decorators import decorato... |
"""Profiler tools for CherryPy.
CherryPy users
==============
You can profile any of your pages as follows::
from cherrypy.lib import profiler
class Root:
p = profile.Profiler("/path/to/profile/dir")
def index(self):
self.p.run(self._index)
index.exposed = Tr... |
class Keys(object):
NULL = u'\ue000'
CANCEL = u'\ue001' # ^break
HELP = u'\ue002'
BACK_SPACE = u'\ue003'
TAB = u'\ue004'
CLEAR = u'\ue005'
RETURN = u'\ue006'
ENTER = u'\ue007'
SHIFT = u'\ue008'
LEFT_SHIFT = u'\ue008'... |
"""
Backport of Python 3's int, based on Py2's long.
They are very similar. The most notable difference is:
- representation: trailing L in Python 2 removed in Python 3
"""
from __future__ import division
import struct
import collections
from future.types.newbytes import newbytes
from future.types.newobject import ... |
import sys
import os
sys.path.append('../../software/models/')
from utilFunctions import wavread
import scipy.io.wavfile
import numpy as np
"""
A1-Part-2: Basic operations with audio
Write a function that reads an audio file and returns the minimum and the maximum values of the audio
samples in that file.
The in... |
import re
from telemetry.core import util
from telemetry.core import exceptions
from telemetry.page.actions import page_action
def _EscapeSelector(selector):
return selector.replace('\'', '\\\'')
class ClickElementAction(page_action.PageAction):
def __init__(self, attributes=None):
super(ClickElementAction, ... |
"""Base class module for nRF Connect SDK platform device."""
import os
from typing import Dict, Tuple
from gazoo_device import custom_types
from gazoo_device import decorators
from gazoo_device import errors
from gazoo_device import gdm_logger
from gazoo_device.base_classes import auxiliary_device
from gazoo_device.ca... |
"""
Views used by XQueue certificate generation.
"""
import json
import logging
from django.contrib.auth.models import User
from django.http import HttpResponse, Http404, HttpResponseForbidden
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
import dogstats_wra... |
import os
import unittest
from servo_tidy import tidy
base_path = 'servo_tidy_tests/' if os.path.exists('servo_tidy_tests/') else 'python/tidy/servo_tidy_tests/'
def iterFile(name):
return iter([os.path.join(base_path, name)])
class CheckTidiness(unittest.TestCase):
def assertNoMoreErrors(self, errors):
... |
"""mercurial utilities (mercurial should be installed)"""
__docformat__ = "restructuredtext en"
import os
import sys
import os.path as osp
try:
from mercurial.error import RepoError
from mercurial.__version__ import version as hg_version
except ImportError:
from mercurial.repo import RepoError
from m... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
try:
# Change main dir to this (need for Pentest Box)
import os
os.path.abspath(__file__)
from Classes import (Credits,
OKadminFinderClass,
MessengerClass)
import argparse
from colorama import Fore,... |
from __future__ import unicode_literals
import re
from django.core.exceptions import ValidationError
from django.utils import six
from django.utils.deconstruct import deconstructible
from django.utils.encoding import force_text
from django.utils.functional import SimpleLazyObject
from django.utils.ipv6 import is_vali... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import atexit
import errno
import os
import shutil
import stat
import tempfile
import threading
import uuid
from collections import defaultdict
from contextlib import ... |
"""External user authentication for CERN NICE/CRA Invenio."""
__revision__ = \
"$Id$"
import httplib
import socket
import re
from invenio.errorlib import register_exception
from invenio.external_authentication import ExternalAuth, \
InvenioWebAccessExternalAuthError
from invenio.external_authentication_c... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = 'j. F Y H:i'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.... |
# -*- coding: utf-8 -*-
IS_POSTALCODES = (
('101', u'101 Reykjavík'),
('103', u'103 Reykjavík'),
('104', u'104 Reykjavík'),
('105', u'105 Reykjavík'),
('107', u'107 Reykjavík'),
('108', u'108 Reykjavík'),
('109', u'109 Reykjavík'),
('110', u'110 Reykjavík'),
('111', u'111 Reykjavík'... |
#! /usr/bin/python3
import sys
import json
import os
import subprocess
import apt
import apt_pkg
import apt.progress.text
import apt.progress.base
from urllib.request import urlretrieve
from gi.repository import Gtk
# harus diganti saat rilis
PREFIX = '/home/mnirfan/Projects/modularitea/'
# executable apt
APT_PATH =... |
# coding: UTF-8
# !/usr/bin/env python
from __future__ import absolute_import
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import usig_normalizador_amba
with open('README.rst', 'r') as f:
readme = f.read()
setup(
name=usig_normalizador_amba.__title__,
ver... |
#runas solve()
#unittest.skip recursive generator
#pythran export solve()
''' From O'Reilly's Python Cookbook '''
def _combinators(_handle, items, n):
if n==0:
yield []
return
for i, item in enumerate(items):
this_one = [ item ]
for cc in _combinators(_handle, _handle(items, i),... |
import os
import pickle
import copy
import numpy as np
CODES = {'<PAD>': 0, '<EOS>': 1, '<UNK>': 2, '<GO>': 3 }
def load_data(path):
"""
Load Dataset from File
"""
input_file = os.path.join(path)
with open(input_file, 'r', encoding='utf-8') as f:
return f.read()
def preprocess_and_save... |
#!/usr/bin/python
# coding=utf-8
import argparse
import atexit
import json
import os
import sys
from bson import SON
from mongo_orchestration.daemon import Daemon
work_dir = os.environ.get('MONGO_ORCHESTRATION_HOME', os.getcwd())
pid_file = os.path.join(work_dir, 'server.pid')
log_file = os.path.join(work_dir, 'ser... |
"""
Django settings for the diagnostic_feedback project.
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/
"""
# Build paths inside the project like this: os.path.join(B... |
import logging
import pickle
import sys
import unittest
from typ.host import Host
class TestHost(unittest.TestCase):
def host(self):
return Host()
def test_capture_output(self):
try:
logging.basicConfig()
h = self.host()
h.capture_output()
h.p... |
"""
WSGI config for djember project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... |
"""This module is deprecated. Please use `airflow.providers.amazon.aws.hooks.sagemaker`."""
import warnings
# pylint: disable=unused-import
from airflow.providers.amazon.aws.hooks.sagemaker import ( # noqa
LogState, Position, SageMakerHook, argmin, secondary_training_status_changed,
secondary_training_status... |
"""Constants and functions for data used in testing."""
import os
import pkgutil
_ROOT_CERTIFICATES_RESOURCE_PATH = 'credentials/ca.pem'
_PRIVATE_KEY_RESOURCE_PATH = 'credentials/server1.key'
_CERTIFICATE_CHAIN_RESOURCE_PATH = 'credentials/server1.pem'
def test_root_certificates():
return pkgutil.get_data(__nam... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import copy
from ansible import constants as C
from ansible.plugins.action.normal import ActionModule as _ActionModule
from ansible.module_utils.six import iteritems
from ansible.module_utils.dellos9 import dellos9_argu... |
"""Anomaly-related algorithms."""
import numpy
from nupic.algorithms.anomaly_likelihood import AnomalyLikelihood
from nupic.utils import MovingAverage
def computeRawAnomalyScore(activeColumns, prevPredictedColumns):
"""Computes the raw anomaly score.
The raw anomaly score is the fraction of active columns not ... |
from pyvirtualdisplay import Display
from selenium.webdriver.support.ui import Select
from selenium import webdriver
from bs4 import BeautifulSoup
keys=webdriver.common.keys.Keys
def scroll_element_into_view(driver, element):
"""Scroll element into view"""
y = element.location['y']
driver.execute_script('... |
import unittest
import pytest
class ElementAttributeTests(unittest.TestCase):
def testShouldReturnNullWhenGettingTheValueOfAnAttributeThatIsNotListed(self):
self._loadSimplePage()
head = self.driver.find_element_by_xpath("/html")
attribute = head.get_attribute("cheese")
self.asse... |
""" Contains Imagenette and Imagewoof datasets """
import os
from os.path import dirname, basename
import tempfile
import logging
import urllib.request
import tarfile
from io import BytesIO
import PIL
import tqdm
import numpy as np
from sklearn.preprocessing import LabelEncoder
from . import ImagesOpenset
logger =... |
"""
Created on Apr 7, 2015
@author: ayan
"""
from __future__ import absolute_import, division, print_function
from gridded.pysgrid.read_netcdf import NetCDFDataset, find_grid_topology_var
from .write_nc_test_files import roms_sgrid, wrf_sgrid
"""
Test NetCDF Dataset With Nodes.
"""
def test_finding_node_variab... |
# -*- coding: iso-8859-1 -*-
from time import time
from boxbranding import getImageVersion
from enigma import eConsoleAppContainer
from Components.Console import Console
from Components.PackageInfo import PackageInfoHandler
from Components.Language import language
from Components.Sources.List import List
from Compone... |
"""BibFormat element - Links to arXiv"""
from cgi import escape
from invenio.messages import gettext_set_language
def format_element(bfo, tag="037__", target="_blank"):
"""
Extracts the arXiv preprint information and
presents it as a direct link towards arXiv.org
"""
_ = gettext_set_language(bfo.l... |
from msrest.serialization import Model
class PoolExistsOptions(Model):
"""Additional parameters for the Pool_exists operation.
:param timeout: The maximum time that the server can spend processing the
request, in seconds. The default is 30 seconds. Default value: 30 .
:type timeout: int
:param c... |
import pathlib
from typing import Optional
from cumulusci.core.exceptions import TaskOptionsError
from cumulusci.core.utils import process_bool_arg, process_list_arg
from cumulusci.salesforce_api.metadata import ApiDeploy
from cumulusci.salesforce_api.package_zip import MetadataPackageZipBuilder
from cumulusci.tasks.s... |
from sahara.utils import patches
patches.patch_all()
import os
import sys
import eventlet
from eventlet import wsgi
from oslo import i18n
# If ../sahara/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
possible_topdir = os.path.... |
"""website URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... |
"""Tests and benchmarks for creating RPC clusters on localhost."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import numpy as np
import portpicker
from tensorflow.python.client import session as session_lib
from tensorflow.python.framewor... |
"""
Copyright (c) 2015 Marshall Farrier
license http://opensource.org/licenses/MIT
lib/ui/handlers.py
Handlers for edit menu
"""
from bson.codec_options import CodecOptions
import datetime as dt
from functools import partial
import json
from pymongo.errors import BulkWriteError
from ..dbschema import SPREADS
from ... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import sys
import os
import yaml
from .util import data
class Config(object):
def __init__(self, configFile=None, configPath=None):
print("Config Module Loaded.")
if configFile is None:
... |
"""Test IAM Policy construction."""
import json
from unittest import mock
from foremast.iam.create_iam import create_iam_resources
from foremast.utils import get_template
EC2_TEMPLATE_NAME = 'infrastructure/iam/trust/ec2_role.json.j2'
LAMBDA_TEMPLATE_NAME = 'infrastructure/iam/trust/lambda_role.json.j2'
@mock.patch... |
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from lettuce import world, steps
from nose.tools import assert_in, assert_true # pylint: disable=no-name-in-module
from common import i_am_registered_for_the_course, visit_scenario_item
from problems_setup import add_problem_to_course, answer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.