content stringlengths 4 20k |
|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Manalyzer output to ATT&CK mapping
# Created by Ronan Mouchoux, Daniel Creus and Ivan Kwiatkowski for BotConf 2018.
#
# Usage: manalyze -p all -o json ... | ./attack.py
import json
import re
import sys
from collections import OrderedDict
mapping = {
# Plugin Import... |
from datetime import timedelta
from furl import furl
from httpretty import httpretty, httprettified
import pendulum
import pytest
from share.models import SourceConfig
main_page = '''
<html>
<head>
<title>SEINet - Arizona Chapter Collection Profiles</title>
</head>
<body>
<table>
<div id="innertext">
... |
""" Connectivity nodes are points where terminals of conducting equipment are connected together with zero impedance.
"""
# <<< imports
# @generated
from cpsm.core.identified_object import IdentifiedObject
from cpsm.core.connectivity_node_container import ConnectivityNodeContainer
from google.appengine.ext import ... |
import datetime
import os
import warnings
from inspect import getargspec
from django import forms
from django.core import checks
from django.core.files.base import File
from django.core.files.images import ImageFile
from django.core.files.storage import default_storage
from django.db.models import signals
from django.... |
"""Functionality for expressing and evaluating logical triggers."""
import math
from cylc.conditional_simplifier import ConditionalSimplifier
from cylc.cycling.loader import get_point
from cylc.suite_logging import ERR
class TriggerExpressionError(Exception):
def __init__(self, msg):
self.msg = msg
... |
"""Wrapper for invoking the BFD loader
A simple script to invoke the bfd loader instead of gold.
This script is in a filename "ld" so it can be invoked from gcc
via the -B flag.
"""
# TODO(bradchen): Delete this script when Gold supports linker scripts properly.
import os
import subprocess
import sys
def PathTo(fname... |
import unittest
import subprocess
import json
import os
import util
import time
from TestConfig import *
config = {}
test_env = os.getenv('test_env', 'aiaas')
env_setup = TestConfig()
config = env_setup.setEnvironment(test_env)
cli = os.path.abspath('./pb-cli/index.js')
class TestPBAtalk(unittest.TestCase):
@clas... |
# Created by zaizai at 2017/9/21
from com.anjie.module.default_download import DefaultDownload;
from com.anjie.module.default_scheduler import DefaultScheduler;
from com.anjie.module.default_pipeline import DefaultPipeline;
from com.anjie.module.mongo_scheduler import MongoScheduler;
from com.anjie.utils.elog import ... |
#!/usr/bin/env python
import xml.etree.ElementTree as ET
class brocade_ha(object):
"""Auto generated class.
"""
def __init__(self, **kwargs):
self._callback = kwargs.pop('callback')
def reload_input_rbridge_id(self, **kwargs):
"""Auto Generated Code
"""
co... |
import json
import pytz
import datetime
from urllib import quote
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response, get_object_or_404
from django.utils import timezone
from django.http import HttpResponseRedirect, Http404
from... |
# -*- coding: utf-8 -*-
import random
import math
from sensor import Sensor, SensorFloatValue
class SensorDS18B20(SensorFloatValue):
W1PATH = "/sys/bus/w1/devices/"
RETRIES = 3
def __init__(self, w1address, maxlogs, windows):
SensorFloatValue.__init__(self, maxlogs, windows)
self._w1addres... |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_allclose, run_module_suite
from scipy.stats import (binned_statistic, binned_statistic_2d,
binned_statistic_dd)
from scipy._lib.six import u
from common_tests import check_name... |
import os
from pip._vendor.lockfile import LockFile
__author__ = 'brucewootton'
"""
Simple blob store with file lock and appending support.
"""
DATA_DIR = "/home/odroid/data_rep".format(os.path.dirname(os.path.abspath(__file__)))
def startup():
if not os.path.isdir(DATA_DIR):
os.mkdir(DATA_DIR)
def file... |
# -*- coding: utf-8 -*-
from south.db import db
from django.db import models
from django_lean.experiments.models import *
class Migration:
def forwards(self, orm):
# Adding field 'DailyReport.confidence'
db.add_column('experiments_dailyreport', 'confidence', orm['experiments.dailyreport:confidenc... |
"""
v2 Neutron Plug-in API specification.
:class:`NeutronPluginBaseV2` provides the definition of minimum set of
methods that needs to be implemented by a v2 Neutron Plug-in.
"""
import abc
import six
from neutron import worker as neutron_worker
@six.add_metaclass(abc.ABCMeta)
class NeutronPluginBaseV2(neutron_wo... |
"""
Estimate Functional Connectivity using an estimator for Sparse Inverse Covariances
==================================================================================
This example constructs a functional connectome using the sparse penalized MLE
estimator implemented using QUIC.
This function extracts time-series f... |
"""
This file contains utility functions which will responsible for sending emails.
"""
import HTMLParser
import logging
import os
import urlparse
import uuid
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from django.conf import settings
from django.contrib.auth.models import U... |
#!/usr/bin/env python3
"""
Created on 15 Oct 2020
@author: Bruno Beloff (<EMAIL>)
DESCRIPTION
The disk_volume utility is used to determine whether a volume is mounted and, if so, the free and used space on
the volume. Space is given in blocks. The volume is identified by its mount point.
If the "is-available" field... |
"""WebStat Regression Test Suite."""
__revision__ = "$Id$"
from invenio.testutils import InvenioTestCase
from invenio.config import CFG_SITE_URL
from invenio.testutils import make_test_suite, run_test_suite, \
test_web_page_content, merge_error_messages
class WebStatWebPagesAvailabilityTest(InvenioTestCase):
... |
"""
Unit Tests for nova.compute.rpcapi
"""
from oslo.config import cfg
from nova.compute import rpcapi as compute_rpcapi
from nova import context
from nova import db
from nova.openstack.common import jsonutils
from nova.openstack.common import rpc
from nova import test
CONF = cfg.CONF
class ComputeRpcAPITestCase(t... |
import warnings
import unittest
import sys
import numpy as np
from scipy import sparse
from sklearn.utils.deprecation import deprecated
from sklearn.utils.metaestimators import if_delegate_has_method
from sklearn.utils.testing import (
assert_true,
assert_raises,
assert_less,
assert_greater,
assert... |
import sys
import os
import logging
import types
import random
import string
import imp
ANDROGUARD_VERSION = "3.0-dev"
from androguard.core.api_specific_resources.aosp_permissions.aosp_permissions import AOSP_PERMISSIONS
from androguard.core.api_specific_resources.api_permission_mappings.api_permission_mappings impor... |
from distutils.version import LooseVersion
# import module snippets
from ansible.module_utils.basic import *
class UnimplementedStrategy(object):
def __init__(self, module):
self.module = module
def get_current_hostname(self):
self.unimplemented_error()
def set_current_hostname(self, na... |
import cherrypy.process.plugins
import datetime
import errno
import girder
import json
import six
import os
from girder.api import access
from girder.constants import SettingKey, VERSION
from girder.models.model_base import GirderException
from girder.utility import plugin_utilities
from girder.utility import system
f... |
import pimath as p
import napalm.core as n
import napalmImageIO as ni
import math, os
def createImage():
w = 320
h = 240
b = n.V3fBuffer(w * h, p.V3f(0, 0, 0))
print '# creating pixel data'
for y in range(h):
for x in range(w):
s = float(x) / w
t = float(y) / h
... |
from m5.params import *
from m5.proxy import *
from Device import BasicPioDevice, PioDevice, IsaFake, BadAddr, DmaDevice
from Pci import PciConfigAll
from Ethernet import NSGigE, IGbE_e1000, IGbE_igb
from Ide import *
from Platform import Platform
from Terminal import Terminal
from Uart import Uart
from SimpleMemory im... |
from Tkinter import *
import string
# This program shows how to use a simple type-in box
class App(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.entrythingy = Entry()
self.entrythingy.pack()
# and here we get a callback when the user hits return. we could
# make ... |
from ecl.util.geometry import Polyline, GeometryTools
from ecl.util.geometry.xyz_io import XYZIo
from ecl.util.test import TestAreaContext
from tests import EclTest
class PolylineTest(EclTest):
def setUp(self):
self.polyline = self.createTestPath("local/geometry/pol11.xyz")
self.closed_polyline = ... |
#!/usr/bin/env python
# Requires: 'pyexcel-ods3 >= 0.2.0',
import os
import textwrap
from collections import OrderedDict
from inspect import getsourcefile
from string import Template
from pyexcel_ods3 import get_data
# Directory where this file is found
basedir = os.path.abspath(os.path.join(getsourcefile(lambda: 0... |
from __future__ import unicode_literals, absolute_import
from django import template
from django.core.urlresolvers import reverse, NoReverseMatch
from django.http import QueryDict
from django.utils.html import escape
from django.utils.safestring import SafeData, mark_safe
from rest_framework.compat import urlparse, for... |
from unittest import TestCase
import jinja2
from nose.tools import assert_equal, assert_raises
import mock
from tg import config
from allura.lib.package_path_loader import PackagePathLoader
class TestPackagePathLoader(TestCase):
@mock.patch('pkg_resources.resource_filename')
@mock.patch('pkg_resources.iter... |
import abc
import six
from tacker.api import extensions
@six.add_metaclass(abc.ABCMeta)
class VNFMonitorAbstractDriver(extensions.PluginInterface):
@abc.abstractmethod
def get_type(self):
"""Return one of predefined type of the hosting vnf drivers."""
pass
@abc.abstractmethod
def g... |
from __future__ import division
from __future__ import print_function
from scipy.stats import norm
import numpy as np
from . import common_args
from ..util import read_param_file
from multiprocessing import Pool, cpu_count
from functools import partial
try:
from itertools import zip_longest
except... |
from django.db import models, migrations
import django.contrib.gis.db.models.fields
class Migration(migrations.Migration):
"""
Used for gis.specific migration tests.
"""
operations = [
migrations.CreateModel(
name='Neighborhood',
fields=[
('id', models.A... |
import unittest
from airflow import DAG
from airflow.api_connexion.schemas.event_log_schema import (
EventLogCollection,
event_log_collection_schema,
event_log_schema,
)
from airflow.models import Log, TaskInstance
from airflow.operators.dummy import DummyOperator
from airflow.utils import timezone
from ai... |
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.api import glance
class MetadataDefinitions(horizon.Panel):
name = _("Metadata Definitions")
slug = 'metadata_defs'
policy_rules = (("image", "get_metadef_namespaces"),)
permissions = ('openstack.services... |
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404
from django.shortcuts import get_object_or_404
from pressgang.accounts.decorators import can_manage_blogs
from pressgang.actions import store_action
from pressgang.actions.lockdown import LockdownAction
from pressgang.ac... |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import re
from calibre.ebooks.oeb.base import XPath, urlunquote
class DataU... |
#!/usr/bin/env python3
# coding: utf-8
from decimal import getcontext
from decimal import Decimal as D
class Sampling():
"""classe statistique d'échantillonage et d'estimation
Cette classe fourni un certains nombre d'outils permettant de calculer des intervales de confiance et des intervales de fluctuation.... |
# -*- coding: utf-8 -*-
"""
This scripts configures the test suite. We do two things:
- setup the logging module
- create ONE SINGLE INSTANCE of QApplication:
this implies that you must use **QApplication.instance** in your
test scripts (or the app fixture).
"""
import logging
import sys
import pyt... |
"""Script for testing hypervisor functionality"""
import unittest
from ganeti import constants
from ganeti import compat
from ganeti import objects
from ganeti import errors
from ganeti import hypervisor
from ganeti.hypervisor import hv_base
import testutils
class TestParameters(unittest.TestCase):
def test(self... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt import (
check_sdk,
create_connection,
get_dict_of_struct,
ovirt_facts... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
OTBUtils.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
(C) 2013 by CS Systemes d'information (CS SI)
Email... |
"""Test server shutdown."""
import os
from magicicadaprotocol import request
from magicicadaprotocol.content_hash import content_hash_factory
from magicicadaprotocol.client import StorageClientFactory, StorageClient
from twisted.trial.unittest import TestCase as TwistedTestCase
from twisted.internet import reactor, d... |
import wsme
import wsme.types as wtypes
from surveil.api.datamodel import types
class Acknowledgement(types.Base):
host_name = wsme.wsattr(wtypes.text, mandatory=True)
"""The name of the host"""
service_description = wsme.wsattr(wtypes.text, mandatory=False)
time_stamp = wsme.wsattr(wtypes.text, ma... |
#!/usr/bin/python
# This script builds the base flocker-dev box.
import sys
import os
from subprocess import check_call, check_output
from textwrap import dedent
from urlparse import urljoin
if len(sys.argv) != 4:
print "Wrong number of arguments."
raise SystemExit(1)
rpm_version = sys.argv[1]
branch = sys.... |
"""
Exception related utilities.
"""
import logging
import sys
import time
import traceback
import six
from monasca.openstack.common.gettextutils import _LE
class save_and_reraise_exception(object):
"""Save current exception, run some code and then re-raise.
In some cases the exception context can be clea... |
import sys
import os.path
import time
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
from sim import sim_router
from sim import sim_card
from util import types
import unittest
import logging
from sim import sim_reader
MODE_SIM = sim_reader.MODE_SIM_SOFT
PIN_1 = "1111"
PUK_1 = "11111111"
PIN_1_FA... |
import math;
from decimal import Decimal
def expbysquaring(x, n):
if n < 0:
return expbysquaring(1 / x, -n);
elif n == 0:
return 1;
elif n == 1:
return x;
elif n%2 == 0:
return expbysquaring(x*x, n/2);
else:
return x * expbysquaring(x*x, (n-1) / 2);
def cal... |
'''
>>> from extract_ext import *
Just about anything has a truth value in Python
>>> assert check_bool(None)
>>> extract_bool(None)
0
>>> assert check_bool(2)
>>> extract_bool(2)
1
>>> assert not check_bool('')
Check that object manager types work properly. These are a different
ca... |
import os
from pybuilder.core import use_plugin, after, task, init
use_plugin("python.core")
use_plugin("analysis")
@init
def init_pylint(project):
project.plugin_depends_on("pymetrics")
@after("prepare")
def check_pymetrics_available(project, logger, reactor):
logger.debug("Checking availability of pymet... |
from tempest.api.network import base_security_groups as base
from tempest.common import utils
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
CONF = config.CONF
class NegativeSecGroupTest(base.BaseSecGroupTest... |
import sys
from time import sleep
from sys import stdin, exit
import code
import readline
import atexit
import os
from PodSixNet.Connection import connection, ConnectionListener
from PodSix.Config import config
# This example uses Python threads to manage async input from sys.stdin.
# This is so that I can receive in... |
import re
from PIL import Image, ImageFile
__version__ = "0.2"
#
# --------------------------------------------------------------------
field = re.compile(br"([a-z]*) ([^ \r\n]*)")
##
# Image plugin for IM Tools images.
class ImtImageFile(ImageFile.ImageFile):
format = "IMT"
format_description = "IM To... |
from django.core.paginator import Paginator as DjangoPaginator, InvalidPage
from django.utils import six
from rest_framework.exceptions import NotFound
from rest_framework.pagination import PageNumberPagination
from rest_framework.response import Response
from .shortcuts import pagination_dict
class BaseApiPaginato... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
import xml.etree.ElementTree as ET
from flexget import plugin
from flexget.config_schema import one_or_more
from flexget.event import event
from flexget.plu... |
"""
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
push(x) -- Push element x onto stack.
pop() -- Removes the element on top of the stack.
top() -- Get the top element.
getMin() -- Retrieve the minimum element in the stack.
"""
class MinStack:
# @para... |
from guessittest import *
def new_guesser(filename):
m = IterativeMatcher(filename, filetype = 'episode')
return m.matched()
class TestEpisode(TestGuessit):
def testNewMatcher(self):
self.checkMinimumFieldsCorrect(new_guesser, 'episodes.yaml')
suite = allTests(TestEpisode)
if __name__ == '__ma... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
import logging
import sys
from os import path
from time import time
from glob import glob
from functools import partial
import numpy as np
import cPickle as pickle
from joblib import Parallel, delayed
import more_itertools
__author__ =... |
import collections
import string
import sys
from .platform.time import monotonic_time
_formatter = string.Formatter()
# Yay VT100
LINE_START = '\r'
CLEAR_END_OF_LINE = '\x1b[K'
CLEAR_LINE = LINE_START + CLEAR_END_OF_LINE
# XXX nowrap doesn't work well in screen (over gnome-term, libvte)
# with some non-ascii charact... |
from __future__ import print_function
import sys
from . import actions
from . import axioms
from . import conditions
from . import predicates
from . import pddl_types
from . import functions
from . import f_expression
class Task(object):
def __init__(self, domain_name, task_name, requirements,
t... |
import tensorflow as tf
import pipeline
import filters
import model_fn
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string( 'model','../data/model',
"""Directory for model checkpoints""" )
tf.app.flags.DEFINE_string( 'lexicon',None,
"""File containing lexicon of image words""" )
t... |
from .pls_ import _PLS
__all__ = ['CCA']
class CCA(_PLS):
"""CCA Canonical Correlation Analysis.
CCA inherits from PLS with mode="B" and deflation_mode="canonical".
Parameters
----------
n_components : int, (default 2).
number of components to keep.
scale : boolean, (default True)
... |
#!/usr/bin/python2
# -*- coding:utf-8 -*-
#/*******************************************************************************
# * Author : ljingb.
# * Email : <EMAIL>
# * Last modified : 2013-11-18 17:33
# * Filename : workers.py
# * Description : 继承gearman的基类,并进行相应的扩展.
# * *******************************************... |
#coding: utf-8
import re
import logging
from urlparse import urljoin, urlsplit
from datetime import datetime, timedelta
from bs4 import BeautifulSoup as BS
from null import Null
from page_content_extractor import legendary_parser_factory
logger = logging.getLogger(__name__)
from config import sites_for_users, summar... |
"""A wrapper for the GStreamer Python bindings that exposes a simple
music player.
"""
from __future__ import division, absolute_import, print_function
import six
import sys
import time
from six.moves import _thread
import os
import copy
from six.moves import urllib
from beets import ui
import gi
gi.require_version(... |
from django.db import models
from django.contrib.auth.models import User
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Group(models.Model):
name = models.CharField(max_length=200)
slug = models.SlugField(max_length=30)
users = models.ManyToManyField(User,... |
## @package users.py
# Used to manage users in the database
from flask import request, jsonify
from flask.views import MethodView
from flask.ext.login import current_user, login_user
from sqlalchemy import and_, update
import logger
from backend.api.mail import sendEmail
from backend import db, app
from ... |
# -*- coding: utf-8 -*-
import types
import AID
try:
import json
except ImportError:
import simplejson as json
class Envelope:
"""
FIPA envelope
"""
def __init__(self, to=None, _from=None, comments=None, aclRepresentation=None, payloadLength=None, payloadEncoding=None, date=None, encrypted=No... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Bar',
fields=[
('id', models.AutoField(serializ... |
"""Generally useful helper functionality."""
from contextlib import contextmanager
from datetime import datetime
import gzip
from io import BytesIO
import shutil
import sys
import tempfile
from pytz import UTC
import six
if sys.version_info < (2, 7): # pragma: no cover
# the io module was pure-python in 2.6, us... |
"""Classes for ADMM algorithms for Robust PCA optimisation"""
from __future__ import division
from __future__ import absolute_import
import copy
import numpy as np
from sporco.admm import admm
import sporco.linalg as sl
import sporco.prox as sp
from sporco.util import u
__author__ = """Brendt Wohlberg <<EMAIL>>"""... |
"""Allows HTTP upload to AppEngine forms which contain files.
Currently does not make use of HTTP streaming, or file streaming.
TODO(jeff.carollo): Add file and http stream support.
"""
__author__ = '<EMAIL> (Jeff Carollo)'
import base64
import logging
import mimetypes
import urllib2
def EncodeMultipartHttpFormDat... |
"""
Notebook Tag
------------
This is a liquid-style tag to include a static html rendering of an IPython
notebook in a blog post.
Syntax
------
{% notebook filename.ipynb [ cells[start:end] ]%}
The file should be specified relative to the ``notebooks`` subdirectory of the
content directory. Optionally, this subdire... |
import struct
import base64
import binascii
import dns.exception
import dns.rdata
import dns.rdatatype
class HIP(dns.rdata.Rdata):
"""HIP record
@ivar hit: the host identity tag
@type hit: string
@ivar algorithm: the public key cryptographic algorithm
@type algorithm: int
@ivar key: the pub... |
import unittest
from robot.utils.asserts import assert_equals, assert_true
from robot.model.statistics import Statistics
from robot.result.testsuite import TestSuite
from robot.result.testcase import TestCase
def verify_stat(stat, name, passed, failed, critical=None, non_crit=None,
id=None, elapsed=0... |
def _GetJSONParseError(input_api, filename):
try:
contents = input_api.ReadFile(filename)
json_comment_eater = input_api.os_path.join(
input_api.PresubmitLocalPath(),
'..', '..', '..', '..', 'tools',
'json_comment_eater', 'json_comment_eater.py')
process = input_api.subprocess.Pope... |
"""
Django Blueprint
================
Management helper blueprint.
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.django
settings:
# manage: ../manage.py # Manage module relative to python path; ./src (Default: manage.py)
# use_south: false # Enable south migra... |
# -*- coding: utf-8 -*-
'''obexd mock template
This creates the expected methods and properties of the object manager
org.bluez.obex object (/), the manager object (/org/bluez/obex), but no agents
or clients.
This supports BlueZ 5 only.
'''
# This program is free software; you can redistribute it and/or modify it u... |
from django.test import TestCase
from django.test import Client
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from datetime import datetime, timedelta
import json
from comments.models import Comment, Site, Thread
User = get_user_model()
class AdminUsertestCases(TestCa... |
import numpy as np
import os
from models.model import AbstractModel
from numerics.solver import Adam
from numerics.softmax import softmax_loss, softmax
class LogisticRegression(AbstractModel):
def __init__(self, batch_size=10000, add_bias=False):
super(LogisticRegression, self).__init__('LogisticRegressi... |
"""Zenodo Communities API."""
from __future__ import absolute_import
from invenio_communities.errors import InclusionRequestMissingError
from invenio_communities.models import Community, InclusionRequest
from invenio_db import db
from invenio_pidrelations.contrib.versioning import PIDVersioning
from invenio_pidstore.... |
#!/usr/bin/env python2
# regadr2osm
# skonvertuje xml subor ziskany zo sluzby register adries (http://www.minv.sk/?register-adries)
# do osm suboru
#
# ocakava jediny argument: xml subor z datovej schranky
import xml.etree.ElementTree as ET
from xml.dom import minidom
import sys, os
def prettify(elem):
"""Return... |
"""Unit tests for language automatic and manual selection."""
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils import translation
from django.utils.importlib import import_module
from django.test import TestCase
from i18nurl.settings import I18N_REDIRECT_URL_NAME
class ... |
"""This plugin is useful for building parts that use maven.
The maven build system is commonly used to build Java projects.
The plugin requires a pom.xml in the root of the source tree.
This plugin uses the common plugin keywords as well as those for "sources".
For more information check the 'plugins' topic for the f... |
"""Implementing pooling of connections to MySQL servers.
"""
import re
from uuid import uuid4
# pylint: disable=F0401
try:
import queue
except ImportError:
# Python v2
import Queue as queue
# pylint: enable=F0401
import threading
from . import errors
from .connection import MySQLConnection
CONNECTION_POO... |
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
import asyncio
import json
from unittest.mock import MagicMock, patch
from aiohttp import web
import pytest
from foglamp.services.core import routes
from foglamp.services.core import connect
from foglamp.common.storage_clien... |
from django import http
from django.template import RequestContext, loader
from regulations.generator import api_reader
from regulations.generator.layers.utils import convert_to_python
from regulations.views import utils
class MissingContentException(Exception):
""" This is essentially a generic 404. """
def... |
"""
Tests for the system config system
"""
import io
import json
import os.path
import unittest
import unittest.mock
import nose
from mymcadmin import errors
from mymcadmin.config import Config
class TestConfig(unittest.TestCase):
"""
Tests for the Config class
"""
def setUp(self):
self.use... |
"""
Given a protein alignment and unaligned nucleotides, align the nucleotides
using the protein alignment.
Protein and nucleotide sequence files must contain the same number of
sequences, in the same order, with the same IDs.
"""
# TODO: Add tests
import itertools
import logging
import sys
from Bio import SeqIO
fr... |
import os
import sys
import subprocess
import tempfile
from time import sleep
from os.path import exists, join, abspath
from shutil import rmtree
from tempfile import mkdtemp
from twisted.trial import unittest
from twisted.internet import defer
from scrapy.utils.python import retry_on_eintr
from scrapy.utils.test imp... |
"""A `Predictor` constructed from an `learn.python.estimator.Estimator`."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.predictor import predictor
from tensorflow.python.estimator import model_fn
from tensorflow.python.framework ... |
"""
Copyright 2008, 2009 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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 2
of the License, or (at your option) any ... |
# -*- coding: utf-8 -*-
"""
flaskext.fungiform
~~~~~~~~~~~~~~~~~~
Implements fungiform support for Flask.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from flask import _request_ctx_stack, redirect, url_for
import... |
"""
OpenVZ containers
=================
"""
from __future__ import with_statement
from contextlib import contextmanager
import hashlib
import os
import posixpath
import tempfile
from fabric.api import (
env,
hide,
output,
settings,
sudo,
)
from fabric.operations import (
_AttributeString,
... |
from collections import namedtuple
import newrelic.core.trace_node
from newrelic.core.metric import TimeMetric
_DatastoreNode = namedtuple('_DatastoreNode',
['product', 'target', 'operation', 'children', 'start_time',
'end_time', 'duration', 'exclusive'])
class DatastoreNode(_DatastoreNode):
d... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import pkgutil
import pystache
import six
class MustacheRenderer(object):
"""Renders text using mustache templates."""
class MustacheError(Exception)... |
"""A simple least-recently-used (LRU) cache."""
_null_key = object()
class _LRUNode(object):
"""This maintains the linked-list which is the lru internals."""
__slots__ = ('prev', 'next_key', 'key', 'value', 'cleanup', 'size')
def __init__(self, key, value, cleanup=None):
self.prev = None
... |
import unittest
import os, sys, commands
import comm
import time
class TestSampleAppFunctions(unittest.TestCase):
def test_uninstall_withAppRunning(self):
comm.setUp()
app_name = "Sysapps"
cmdfind = "adb -s " + comm.device + " shell pm list packages |grep org.xwalk.%s" % (app_name.lower())
... |
import logging
import re
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.internal.backends import browser_backend
from telemetry.internal.backends.chrome import tab_list_backend
from telemetry.internal.backends.chrome_inspector import devtools_client_backend
from telemetry.internal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.