content stringlengths 4 20k |
|---|
#!/usr/bin/env python
"""
A simple server that ckecks IP throughput
"""
import socket, struct
import sys
import time
import random
import string
import os
from subprocess import Popen,PIPE,call
def mysendall(client,data):
size = len(data)
totalsent = 0
while totalsent < 32768:
sent = client.send(data[totalsent:... |
# -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.co... |
#!/usr/bin/env python3
import unittest
from unittest.mock import patch, MagicMock
import pandas as pd
import numpy as np
from tmc import points
from tmc.utils import load, get_out, patch_helper
module_name="src.bicycle_timeseries"
bicycle_timeseries = load(module_name, "bicycle_timeseries")
main = load(module_name... |
# -*- coding: utf-8 -*-
#################################################################################################
import json
import logging
import time
import requests
from exceptions import HTTPException
#################################################################################################
LOG... |
from __future__ import unicode_literals
import os
import subprocess
import sys
import errno
from .common import PostProcessor
from ..compat import compat_os_name
from ..utils import (
check_executable,
hyphenate_date,
version_tuple,
PostProcessingError,
encodeArgument,
encodeFilename,
)
clas... |
"""Tests for the MatchingFilesDataset serialization."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import shutil
import tempfile
from absl.testing import parameterized
from tensorflow.python.data.experimental.kernel_tests.serialization impor... |
# -----------------------------------------------------------------------------
# calc.py
#
# A calculator parser that makes use of closures. The function make_calculator()
# returns a function that accepts an input string and returns a result. All
# lexing rules, parsing rules, and internal state are held inside the ... |
#
# TreeFragments - parsing of strings to trees
#
import re
from StringIO import StringIO
from Scanning import PyrexScanner, StringSourceDescriptor
from Symtab import ModuleScope
import PyrexTypes
from Visitor import VisitorTransform
from Nodes import Node, StatListNode
from ExprNodes import NameNode
import Parsing
im... |
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.testtools
~~~~~~~~~~~~~~~~~~~~~~~~~~
This module implements extended wrappers for simplified testing.
`TestResponse`
A response wrapper which adds various cached attributes for
simplified assertions on various content types.
:copyright:... |
'''
This package is for GUI tools that are of general use to
visior researchers.
''' |
"""Wrapper around the jQuery UI library
Exposes a single object, jq, to manipulate the widgets designed in the library
This object supports :
- subscription : js[elt_id] returns an object matching the element with the
specified id
- a method get(**kw). The only keyword currently supported is "selector". The
metho... |
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'pootle.settings'
from pootle_app.management.commands import PootleCommand
class Command(PootleCommand):
help = "mass update from templates."
def handle_translation_project(self, translation_project, **options):
translation_project.update_from_template... |
import io
import os
import pytest
from tempfile import TemporaryFile, NamedTemporaryFile
from unittest import mock
from cylc.flow import __version__
import cylc.flow.flags
from cylc.flow.job_file import JobFileWriter
from cylc.flow.platforms import platform_from_name
@pytest.mark.parametrize(
'in_value, out_valu... |
from antlr4.RuleContext import RuleContext
from antlr4.Token import Token
from antlr4.error.ErrorListener import ProxyErrorListener, ConsoleErrorListener
# need forward delcaration
RecognitionException = None
class Recognizer(object):
tokenTypeMapCache = dict()
ruleIndexMapCache = dict()
def __init__(se... |
"""This package manipulates Docker image layer metadata."""
from collections import namedtuple
import copy
import json
import os
import os.path
import sys
import tarfile
from third_party.py import gflags
gflags.DEFINE_string(
'name', None, 'The name of the current layer')
gflags.DEFINE_string(
'base', None, ... |
import errno
import os
import warnings
from datetime import datetime
from django.conf import settings
from django.core.exceptions import SuspiciousFileOperation
from django.core.files import File, locks
from django.core.files.move import file_move_safe
from django.utils._os import abspathu, safe_join
from django.utils... |
import sys
import os
import logging
LOG = logging.getLogger("ResourcePath")
_hdlr = logging.StreamHandler()
_hdlr.setFormatter(logging.Formatter(fmt="%(name)s.%(levelname)s: %(message)s"))
LOG.addHandler(_hdlr)
from ..constfunc import get_env_var
class ResourcePath:
"""
ResourcePath is a singleton, meaning th... |
from __future__ import print_function, division, absolute_import
from numba import unittest_support as unittest
from numba import jit, cffi_support, types
from numba.compiler import compile_isolated, Flags
from numba.tests.support import TestCase
from numba.tests.cffi_usecases import *
import numpy as np
enable_pyob... |
import argparse
import datetime
import json
import functools
import glob
import os
import re
import shutil
import subprocess
import sys
from typing import List, Tuple
import docker
print = functools.partial(print, file=sys.stderr, flush=True)
DOCKER_USERNAME = "raytravisbot"
DOCKER_CLIENT = None
PYTHON_WHL_VERSION = ... |
"""maintain history for compatibility with earlier migrations
Revision ID: 13eb55f81627
Revises: 1507a7289a2f
Create Date: 2015-08-23 05:12:49.732174
"""
# revision identifiers, used by Alembic.
revision = '13eb55f81627'
down_revision = '1507a7289a2f'
branch_labels = None
depends_on = None
def upgrade():
pass
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import re
from ansible.errors import AnsibleConnectionFailure
from ansible.module_utils._text import to_text, to_bytes
from ansible.plugins.terminal import TerminalBase
class TerminalModule(TerminalBase):
termin... |
from django.template import Library, Node, TemplateSyntaxError
from django.utils import formats
register = Library()
@register.filter(is_safe=False)
def localize(value):
"""
Force a value to be rendered as a localized value,
regardless of the value of ``settings.USE_L10N``.
"""
return str(formats... |
data = (
'Chu ', # 0x00
'Jing ', # 0x01
'Nie ', # 0x02
'Xiao ', # 0x03
'Bo ', # 0x04
'Chi ', # 0x05
'Qun ', # 0x06
'Mou ', # 0x07
'Shu ', # 0x08
'Lang ', # 0x09
'Yong ', # 0x0a
'Jiao ', # 0x0b
'Chou ', # 0x0c
'Qiao ', # 0x0d
'[?] ', # 0x0e
'Ta ', # 0x0f
'Jian ', # 0x10... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from proySoftware import app
from flask import request
from flask import render_template
from flask import flash
from flask_wtf import FlaskForm
from wtforms import Form, BooleanField, StringField, PasswordField, validators
from wtforms.validators import *
from ..model... |
"""Handle Python version/platform incompatibilities."""
import sys
try:
import threading
except ImportError:
import dummy_threading as threading
py33 = sys.version_info >= (3, 3)
py32 = sys.version_info >= (3, 2)
py3k = sys.version_info >= (3, 0)
py2k = sys.version_info < (3, 0)
py265 = sys.version_info >= (... |
'''
This is a Unit Test for Rule ConfigureAppleSoftwareUpdate
@author: ekkehard j. koch
@change: 02/27/2013 Original Implementation
@change: 2016/02/10 roy Added sys.path.append for being able to unit test this
file as well as with the test harness.
'''
import unittest
import sys
sys.path.app... |
from univention.management.console.module import Manager, Module
__all__ = ['Manager', 'Module'] |
"""
================================
Nearest Neighbors Classification
================================
Sample usage of Nearest Neighbors classification.
It will plot the decision boundaries for each class.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColorm... |
"""attitude constraint corrections
Revision ID: 420f9b8b9e
Revises: 162f93d4393
Create Date: 2015-06-24 16:52:02.606637
"""
# revision identifiers, used by Alembic.
revision = '420f9b8b9e'
down_revision = '162f93d4393'
branch_labels = None
depends_on = None
from alembic import op
def upgrade():
op.drop_constr... |
"""
resolveurl XBMC Addon
Copyright (C) 2018 jsergio
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
... |
{
"name" : "Venezuela - Accounting",
"version" : "1.0",
"author" : ['OpenERP SA', "Netquatro"],
"category" : "Localization/Account Charts",
"description":
'''
This is the module to manage the accounting chart for Venezuela in OpenERP.
=================================================================... |
"""Pytest fixtures to be used in other test modules"""
import os
import shutil
import logging
import getpass
from functools import wraps
import numpy as np
import pytest
import shapely.geometry as shpg
import matplotlib.pyplot as plt
from oggm.shop import cru, histalp, ecmwf
from oggm import cfg, tasks
from oggm.cor... |
"""
tknorris shared module
Copyright (C) 2016 tknorris
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
... |
import tempfile
import datetime
from openerp.tools.translate import _
from openerp.addons.account_statement_base_import.parser import \
BankStatementImportParser
try:
import ofxparse
except:
raise Exception(_('Please install python lib ofxparse'))
class OfxParser(BankStatementImportParser):
"""Class f... |
from __future__ import print_function
from tweepy.models import ModelFactory
from tweepy.utils import import_simplejson
from tweepy.error import TweepError
class Parser(object):
def parse(self, method, payload):
"""
Parse the response payload and return the result.
Returns a tuple that c... |
from pyvows import Vows, expect
from tornado_pyvows.context import TornadoHTTPContext
from thumbor.app import ThumborServiceApp
from thumbor.config import Config
from thumbor.context import Context
@Vows.batch
class HealthCheck(TornadoHTTPContext):
def get_app(self):
cfg = Config()
ctx = Context(... |
"""AstronClientRepository module: contains the AstronClientRepository class"""
from direct.directnotify import DirectNotifyGlobal
from ClientRepositoryBase import ClientRepositoryBase
from MsgTypes import *
from direct.distributed.PyDatagram import PyDatagram
from pandac.PandaModules import STUint16, STUint32
class A... |
# -*- coding: utf-8 -*-
from urllib import urlencode
from openerp.addons.web import http
from openerp.addons.web.http import request
from openerp.tools.mail import html_sanitize
class WebsiteEmailDesigner(http.Controller):
@http.route('/website_mail/email_designer', type='http', auth="user", website=True)
... |
"""R-network and some related functions to train R-networks."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tempfile
from absl import logging
from third_party.keras_resnet import models
import numpy as np
import tensorflow as tf
from tensorflow... |
"""
Module provides utilities for validation.
"""
import socket
def is_valid_ipv4(ipv4):
"""Returns True if given is a valid ipv4 address.
Given value should be a dot-decimal notation string.
"""
valid = True
if not isinstance(ipv4, str):
valid = False
else:
try:
... |
"""Utilities for building profiler options."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
from tensorflow.python.profiler import tfprof_logger
from tensorflow.python.util.tf_export import tf_export
@tf_export('profiler.ProfileOptionBuilde... |
{
'name': 'Ecuador - Accounting',
'version': '1.1',
'category': 'Localization/Account Charts',
'description': """
This is the base module to manage the accounting chart for Ecuador in OpenERP.
==============================================================================
Accounting chart and localizati... |
"""Offer Home Assistant core automation rules."""
import voluptuous as vol
from homeassistant.const import CONF_EVENT, CONF_PLATFORM, EVENT_HOMEASSISTANT_STOP
from homeassistant.core import HassJob, callback
# mypy: allow-untyped-defs
EVENT_START = "start"
EVENT_SHUTDOWN = "shutdown"
TRIGGER_SCHEMA = vol.Schema(
... |
# coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
short_description: Manage HPE StoreServ 3PAR CPG
author:
- Farha... |
from collections import defaultdict, deque
import logging
import pprint
from scrapy.exceptions import NotConfigured
from scrapy.utils.misc import create_instance, load_object
from scrapy.utils.defer import process_parallel, process_chain, process_chain_both
logger = logging.getLogger(__name__)
class MiddlewareManag... |
"""Lowers break statements to conditionals."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.autograph.core import converter
from tensorflow.contrib.autograph.pyct import anno
from tensorflow.contrib.autograph.pyct import templates... |
from urllib.parse import urlencode
from xml.dom.minidom import parseString
from django.contrib.auth.decorators import login_required, permission_required
from django.core import mail
from django.forms import fields
from django.forms.forms import Form, ValidationError
from django.forms.formsets import BaseFormSet, form... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
back.py is a part of colored.
Copyright 2014-2017 Dimitris Zlatanidis <<EMAIL>>
All rights reserved.
Colored is very simple Python library for color and formatting in terminal.
https://github.com/dslackw/colored
colored is free software: you can redistribute it and/or
... |
import logging
import subprocess
import time
from lebut.config import PATH
log = logging.getLogger(__name__)
class LiveReloader:
cmd = "livereload"
def start_with_keep_alive(self, **_):
self.start()
while self._is_alive:
log.info("livereload is active")
time.sleep(10... |
# Adapted from test_file.py by Daniel Stutzbach
from __future__ import unicode_literals
import sys
import os
import errno
import unittest
from array import array
from weakref import proxy
from functools import wraps
from UserList import UserList
import _testcapi
from test.test_support import TESTFN, check_warnings, ... |
from __future__ import unicode_literals
import io
import json
import logging
import os
from django.apps import AppConfig, apps
from django.core import exceptions
from django.db import DEFAULT_DB_ALIAS, router
from django.db.models.signals import post_migrate
from django.utils.translation import ugettext_lazy as _
lo... |
"""A thorough test of polling PAIR sockets."""
#-----------------------------------------------------------------------------
# Copyright (c) 2010 Brian Granger
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distributed as part of this software.
#------------... |
PLURAL_EXCEPTIONS_MAP = { \
'women' : 'woman', \
'men' : 'man', \
'children' : 'child', \
'teeth' : 'tooth', \
'feet' : 'foot', \
'people' : 'person', \
'leaves' : 'leaf', \
'mice' : 'mouse', \
'geese' : 'goose', \
'halves' : 'half', \
'knives' : 'knife', \
'wives' : 'wife',... |
import errno
import threading
from xen.xend.xenstore.xsutil import xshandle
class xswatch:
##
# Create a watch on the given path in the store. The watch will fire
# immediately, then subsequently each time the watched path is changed,
# until the watch is deregistered, either by the return value fro... |
"""
ckwg +31
Copyright 2016 by Kitware, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the ... |
from __future__ import division
import numpy as np
np.random.seed(0)
import matplotlib
# matplotlib.use("macosx") # might be necessary for animation to work
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import autoregressive
from pyhsmm.basic.distributions import PoissonDuration
from pybasic... |
import os
import pathlib
import six
import yaml
import quantities as pq
import numpy as np
import pytest
import exdir
import exdir.core
import exdir.core.exdir_object as exob
import exdir.core.quantities_conversion as pqc
from exdir.core import filename_validation as fv
from conftest import remove
def test_convert_... |
"""Conflict finder for Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/poconflicts.html
for examples and usage instructions.
"""
import os
import six
import sys
from translate.misc import optrecurse
from translate.storage import factory, po
class Con... |
"""
Unit tests for the notes app.
"""
from mock import patch, Mock
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from django.test import TestCase, RequestFactory
from django.test.client import Client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.c... |
"""
The :mod:`workspace.spatialite` module a workspace implementation based on the contents of a SpatiaLite database.
"""
import os
from geoscript.workspace import Workspace
from org.geotools.data.spatialite import SpatiaLiteDataStoreFactory
class SpatiaLite(Workspace):
"""
A subclass of :class:`Workspace <geoscr... |
import unittest
import colorsys
def frange(start, stop, step):
while start <= stop:
yield start
start += step
class ColorsysTest(unittest.TestCase):
def assertTripleEqual(self, tr1, tr2):
self.assertEqual(len(tr1), 3)
self.assertEqual(len(tr2), 3)
self.assertAlmostEqua... |
"""Student's t distribution class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from ten... |
from time import asctime, gmtime
import gdb # silence pyflakes
class TimePrinter:
def __init__(self, val):
self.val = val
def to_string(self):
secs = int(self.val)
return "%s (%d)" % (asctime(gmtime(secs)), secs)
def build_pretty_printer():
pp = gdb.printing.RegexpCollectionPre... |
from metrics import Metric
class IOMetric(Metric):
"""IO-related metrics, obtained via telemetry.core.Browser."""
@classmethod
def CustomizeBrowserOptions(cls, options):
options.AppendExtraBrowserArgs('--no-sandbox')
def Start(self, page, tab):
raise NotImplementedError()
def Stop(self, page, tab)... |
from nova import db
from nova import exception
from nova.objects import aggregate
from nova.openstack.common import timeutils
from nova.tests.objects import test_objects
NOW = timeutils.utcnow().replace(microsecond=0)
fake_aggregate = {
'created_at': NOW,
'updated_at': None,
'deleted_at': None,
'delet... |
# -*- coding: UTF-8 -*
'''
Created on 2013-10-14
@author: RobinTang
'''
import time
from HttpHolder import HttpHolder
import sys
try:
sys.setdefaultencoding("utf-8")
except:
pass
def strbetween(s, ss, es):
si = s.index(ss)
return s[si:s.index(es, si)]
class BaseBaiduUser():
'''
基础百度用户
'''
def __init__(s... |
"""utilities for interacting with processes"""
import errno
import os
import signal
import sys
import time
from flumotion.common import log
from flumotion.common.common import ensureDir
from flumotion.configure import configure
__version__ = "$Rev: 6690 $"
def startup(processType, processName, daemonize=False, dae... |
import inspect
import os
try:
import trace
except ImportError:
pass
else:
trace._warn = lambda *args: None # workaround for http://bugs.python.org/issue17143 (PY-8706)
import gc
from pydevd_comm import CMD_SIGNATURE_CALL_TRACE, NetCommand
import pydevd_vars
from pydevd_constants import xrange
class Sig... |
import logging
from django.core.management.base import BaseCommand, CommandError
from smra.smra_portal.repos import Bonza2
from smra.smra_portal.ReposPlugin import ReposPlugin
logger = logging.getLogger(__name__)
class Command(BaseCommand):
args = ''
help = 'Utility functions for the Bonza2 DB.\nmakeschem... |
from __future__ import division, print_function, absolute_import
from numpy import sqrt, cos, sin, arctan, exp, log, pi, Inf
from numpy.testing import assert_, TestCase, run_module_suite, dec
from scipy.integrate import quad, dblquad, tplquad
from scipy.lib.six.moves import xrange
import sys
import math
try:
impo... |
# -*- coding: utf-8 -*-
"""Class for a user on Yik Yak"""
from yaklient import helper
from yaklient import settings
from yaklient.api import notifyapi, parseapi, yikyakapi
from yaklient.objects.comment import Comment
from yaklient.objects.location import Location
from yaklient.objects.message import Message
from yakl... |
"""Utilities for multi-gpu training."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.keras import backend as K
from tensorflow.python.keras.engine.training import Model
from tensorflow.pyt... |
import base64
import logging
from email.utils import formataddr
from urlparse import urljoin
from openerp import api, tools
from openerp import SUPERUSER_ID
from openerp.addons.base.ir.ir_mail_server import MailDeliveryException
from openerp.osv import fields, osv
from openerp.tools.safe_eval import safe_eval as eval
... |
"""Tests for hermendre module.
"""
from __future__ import division
import numpy as np
import numpy.polynomial.laguerre as lag
import numpy.polynomial.polynomial as poly
from numpy.testing import *
L0 = np.array([1 ])/1
L1 = np.array([1 , -1 ])/1
L2 = np.array([2 , -4 , 1 ])/2
L3 = np.array([6 , -18 , 9 , -1 ])/6
L4 ... |
import unittest
from netzob.Common.ExecutionContext import ExecutionContext
#+---------------------------------------------------------------------------+
#| Local Imports
#+---------------------------------------------------------------------------+
class test_ExecutionContext(unittest.TestCase):
def test_getC... |
"""distutils.emxccompiler
Provides the EMXCCompiler class, a subclass of UnixCCompiler that
handles the EMX port of the GNU C compiler to OS/2.
"""
# issues:
#
# * OS/2 insists that DLLs can have names no longer than 8 characters
# We put export_symbols in a def-file, as though the DLL can have
# an arbitrary len... |
{
'name': 'Multiple Analytic Plans',
'version': '1.0',
'category': 'Accounting & Finance',
'description': """
This module allows to use several analytic plans according to the general journal.
==================================================================================
Here multiple analytic line... |
""" Configuration for the Horse riding map.
"""
from db.configs import *
from os.path import join as os_join
from config.defaults import MEDIA_ROOT
MAPTYPE = 'routes'
ROUTEDB = RouteDBConfig()
ROUTEDB.schema = 'riding'
ROUTEDB.relation_subset = """
tags ? 'route' and tags->'type' IN ('route', 'superroute')
A... |
import boto
from boto.utils import find_class, Password
from boto.sdb.db.key import Key
from boto.sdb.db.model import Model
from boto.compat import six, encodebytes
from datetime import datetime
from xml.dom.minidom import getDOMImplementation, parse, parseString, Node
ISO8601 = '%Y-%m-%dT%H:%M:%SZ'
class XMLConverte... |
from test import test_support as support
import unittest
import __builtin__ as builtins
import rlcompleter
class CompleteMe(object):
""" Trivial class used in testing rlcompleter.Completer. """
spam = 1
class TestRlcompleter(unittest.TestCase):
def setUp(self):
self.stdcompleter = rlcompleter.Com... |
import time
import struct
from twisted.python import log
from twisted.internet import reactor, defer
from twisted.internet.defer import inlineCallbacks, returnValue, Deferred
from twisted.internet.defer import DeferredQueue, CancelledError
from twisted.internet.protocol import ClientFactory, Protocol
from twisted.inte... |
import json
import logging
from lxml import etree
from xmodule.capa_module import ComplexEncoder
from xmodule.progress import Progress
from xmodule.stringify import stringify_children
import openendedchild
from .combined_open_ended_rubric import CombinedOpenEndedRubric
log = logging.getLogger("edx.courseware")
cla... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from packaging.version import InvalidVersion
from versionhelper.version_helper import AnsibleVersionMunger
@pytest.mark.parametrize('version,revision,codename,output_propname,expected', [
('2.5.0.dev1', None, Non... |
"""
Utilities for Twisted.names tests.
"""
from __future__ import division, absolute_import
from random import randrange
from zope.interface import implementer
from zope.interface.verify import verifyClass
from twisted.internet.address import IPv4Address
from twisted.internet.defer import succeed
from twisted.inter... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from contextlib import contextmanager
from textwrap import dedent
from pants.util.contextutil import temporary_dir
from pants_test.pants_run_integration_tes... |
__all__ = ["ServiceException", "BaseXMLRPC", "CreateSetAssetsCmd"]
import shutil, os
from pyasm.common import System, TacticException
from pyasm.security import *
from pyasm.search import *
from pyasm.command import Command
from pyasm.checkin import FileGroupCheckin
from pyasm.prod.checkin import *
from pyasm.prod.b... |
#!/usr/bin/python
# #RED
import argparse
import boto.ec2
from boto.vpc import VPCConnection
import sys
def main():
try:
conn = boto.vpc.VPCConnection(aws_access_key_id=args.aws_access_key_id, aws_secret_access_key=args.aws_secret_access_key, region=boto.ec2.get_region(args.region))
except:
pr... |
from __future__ import absolute_import, division, unicode_literals
from pip._vendor.six import text_type
from ..constants import scopingElements, tableInsertModeElements, namespaces
# The scope markers are inserted when entering object elements,
# marquees, table cells, and table captions, and are used to prevent for... |
"""Base class for all backup drivers."""
import abc
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils
import six
from cinder.db import base
from cinder import exception
from cinder.i18n import _
service_opts = [
cfg.IntOpt('backup_metadata_version', default... |
"""Self-test suite for Crypto.Random.OSRNG.winrandom"""
__revision__ = "$Id$"
import unittest
class SimpleTest(unittest.TestCase):
def runTest(self):
"""Crypto.Random.OSRNG.winrandom"""
# Import the winrandom module and try to use it
from Crypto.Random.OSRNG import winrandom
rando... |
from oslo_config import cfg
from oslo_log import log as logging
from nova.i18n import _LW
from nova.scheduler import filters
from nova.scheduler.filters import utils
LOG = logging.getLogger(__name__)
max_instances_per_host_opt = cfg.IntOpt("max_instances_per_host",
default=50,
help="Ignore hosts that... |
import unittest
from typ import json_results
class TestMakeUploadRequest(unittest.TestCase):
maxDiff = 4096
def test_basic_upload(self):
results = json_results.ResultSet()
full_results = json_results.make_full_results([], 0, [], results)
url, content_type, data = json_results.make_up... |
import platform
from cytoolz.functoolz import (thread_first, thread_last, memoize, curry,
compose, pipe, complement, do, juxt)
from cytoolz.functoolz import _num_required_args
from operator import add, mul, itemgetter
from cytoolz.utils import raises
from functools import partial
from cyt... |
"""OpenShift plugin for integration tests."""
from __future__ import absolute_import, print_function
import json
import os
import re
import time
from lib.cloud import (
CloudProvider,
CloudEnvironment,
)
from lib.util import (
find_executable,
ApplicationError,
display,
SubprocessError,
)
fr... |
from utils import *
class Basics(Component):
@bash_command
def disk_usage(self):
return "df"
@bash_command
def open_files(self):
return 'lsof'
@bash_command
def memory_usage(self):
return "free"
class Apache(Component):
@bash_command
def running_procs(self):
... |
import json
from django.core.management.base import BaseCommand
from accounts.models import UserSettings
from accounts.payment_plans import PLAN_DEMO
from pinecast.email import send_notification_email
from podcasts.models import Podcast
MESSAGE_INCREASE = '''
We recently performed an audit of our analytics database.... |
from __future__ import division
from pymongo import MongoClient
"""
Question 5:
What is the mean length of a message?
Question 7:
What is the average number of hashtags (#) used within a message?
"""
# import pymongo
client = MongoClient('localhost', 27017)
if client is None:
print "Couldn't connect!"
else:
... |
from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from optparse import make_option
from django.core.management.base import BaseCommand, CommandParser
from zerver.models import Recipient, Message
from zerver.lib.timestamp import timestamp_to_datetime
import datetime
im... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .message import *
from .message_parser import *
from .message_serializer import *
from .ping_message import *
from .ping_message_parser import *
from .ping_message_serializer import *
from .pong_message ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.