content string |
|---|
from spack import *
class DealiiParameterGui(CMakePackage):
"""A qt based graphical user interface for editing deal.II .prm parameter
files."""
homepage = "https://github.com/dealii/parameter_gui"
url = "https://github.com/dealii/parameter_gui"
version('develop', git='https://github.com/dea... |
"""
This is the template for extracting the solution for the computation problem of computing
real solution of a polynomial system of equations RR from the output of the computer
algebra system Z3.
.. moduleauthor:: Albert Heinle <<EMAIL>>
"""
import xml.dom.minidom as dom
import re
#--------------------------------... |
from vector3 import Vector3
import Image, ImageDraw
def bounding_cube(layers):
min_x = 999999
min_y = 999999
min_z = 999999
max_x = -999999
max_y = -999999
max_z = -999999
for layer in layers:
for thread in layer:
for point in thread:
if point.x > max_x:
... |
from oslo_log import log as logging
from tempest_lib.common.utils import data_utils
from neutron.tests.api import base
from neutron.tests.tempest import test
LOG = logging.getLogger(__name__)
class MeteringTestJSON(base.BaseAdminNetworkTest):
"""
Tests the following operations in the Neutron API using the... |
import sys
import constants
ANSIBLE_COLOR=True
if constants.ANSIBLE_NOCOLOR:
ANSIBLE_COLOR=False
elif not hasattr(sys.stdout, 'isatty') or not sys.stdout.isatty():
ANSIBLE_COLOR=False
else:
try:
import curses
curses.setupterm()
if curses.tigetnum('colors') < 0:
ANSIBLE_C... |
"""Bootstrap a buildout-based project
Simply run this script in a directory containing a buildout.cfg.
The script accepts buildout command-line options, so you can
use the -c option to specify an alternate configuration file.
"""
import os
import sys
import shutil
import tempfile
try:
import urllib.request as ur... |
# CER decoder
from pyasn1.type import univ
from pyasn1.codec.ber import decoder
from pyasn1.compat.octets import oct2int
from pyasn1 import error
class BooleanDecoder(decoder.AbstractSimpleDecoder):
protoComponent = univ.Boolean(0)
def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet, length,
... |
#!/usr/bin/env python
#
# Use the raw transactions API to spend sidecoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a sidecoind or S... |
"""
Generator for tex-2d* and tex-3d* tests.
This file needs to be run in its folder.
"""
import os
import os.path
import sys
_LICENSE = """<!--
Copyright (c) 2015 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation... |
"""
differential QPSK modulation and demodulation.
"""
from gnuradio import gr, gru, modulation_utils
from math import pi, sqrt
import psk
import cmath
from pprint import pprint
# default values (used in __init__ and add_options)
_def_samples_per_symbol = 2
_def_excess_bw = 0.35
_def_gray_code = True
_def_verbose = F... |
__author__ = 'Robert Smallshire'
class Node(object):
def __init__(self, indent=None, lines=None, parent=None):
if indent is not None:
self.indent = indent
else:
self.indent = 0
if lines is not None:
self.lines = lines
else:
... |
__author__ = "Roland Leuthe <<EMAIL>>"
__date__ = "28 July 2008"
__version__ = "0.9"
from xml.dom import XML_NAMESPACE, XMLNS_NAMESPACE
from xmlifUtils import NsNameTupleFactory, convertToAbsUrl
########################################
# XmlIf builder extension base class
# All not implemented met... |
from twilio.rest import TwilioRestClient
from twilio import TwilioRestException
from redis import StrictRedis
import time
import details
account_sid = details.twilio_account_sid
auth_token = details.twilio_auth_token
client = TwilioRestClient(account_sid, auth_token)
twilio_number = details.twilio_num
r = StrictRed... |
""" Alias module provides facilities to manage
the aliases
"""
import cti
import database_manager, database
#------------------------------------------------------------------------
def get_data_alias(uid):
""" get an alias from a data UID. It uses the database so
this function is faster that core'... |
from st2common.persistence.policy import PolicyType, Policy
from st2common.policies import ResourcePolicyApplicator, get_driver
from st2tests import DbTestCase
from st2tests.fixturesloader import FixturesLoader
__all__ = [
'PolicyTestCase'
]
PACK = 'generic'
TEST_FIXTURES = {
'runners': [
'testrunner1... |
from __future__ import print_function, division
__all__ = ['LagrangesMethod']
from sympy import diff, zeros, Matrix, eye, sympify
from sympy.physics.vector import dynamicsymbols, ReferenceFrame
from sympy.physics.mechanics.functions import (find_dynamicsymbols, msubs,
_f_list_parser)
from sympy.physics.mechan... |
"""Script to generate doxygen documentation.
"""
import re
import os
import os.path
import sys
import shutil
from devtools import tarball
def find_program(*filenames):
"""find a program in folders path_lst, and sets env[var]
@param filenames: a list of possible names of the program to search for
@return: ... |
from airflow.contrib.hooks.bigquery_hook import BigQueryHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class BigQueryToCloudStorageOperator(BaseOperator):
"""
Transfers a BigQuery table to a Google Cloud Storage bucket.
.. seealso::
For more detai... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Scriptharness exceptions.
These exceptions are written with several things in mind:
#. the exceptions should be unicode-capable in python 2.7 (py3 gets that
for free),
#. the exceptions should differentiate between user-facing exceptions and
developer-facing ... |
"""
3D brain mesh viewer.
"""
from timeit import default_timer
import numpy as np
from vispy import gloo
from vispy import app
from vispy.util.transforms import perspective, translate, rotate
from vispy.io import load_data_file
brain = np.load(load_data_file('brain/brain.npz', force_download='2014-09-04'))
data = br... |
from intern.service.cv.service import CloudVolumeService
from intern.service.cv.metadata import MetadataService
from intern.resource.cv.resource import CloudVolumeResource
from cloudvolume import CloudVolume, Vec
class ProjectService(CloudVolumeService):
"""
ProjectService for cloudvolume service.
"""
... |
"""This module adds shared support for generic Amazon AWS modules
**This code is not yet ready for use in user modules. As of 2017**
**and through to 2018, the interface is likely to change**
**aggressively as the exact correct interface for ansible AWS modules**
**is identified. In particular, until this notice goe... |
""" Python 'uu_codec' Codec - UU content transfer encoding
Unlike most of the other codecs which target Unicode, this codec
will return Python string objects for both encode and decode.
Written by Marc-Andre Lemburg (<EMAIL>). Some details were
adapted from uu.py which was written by Lance Ellinghouse... |
"""
Setup script for the Open edX package.
"""
from setuptools import setup
setup(
name="Open edX",
version="0.5",
install_requires=["setuptools"],
requires=[],
# NOTE: These are not the names we should be installing. This tree should
# be reorganized to be a more conventional Python tree.
... |
#!/usr/bin/env python
# Toon Bot - Poster Bot Subprocess
#
# _____ U ___ u U ___ u _ _ ____ U ___ u _____
# |_ " _| \/"_ \/ \/"_ \/ | \ |"| U | __")u \/"_ \/|_ " _|
# | | | | | | | | | |<| \| |> \| _ \/ | | | | | |
# /| |\.-,_| |_| |.-,_| |_| |U| |\ |u ... |
import tempfile
import shutil
from weblate import appsettings
class OverrideSettings(object):
"""
makes a context manager also act as decorator
"""
TEMP_DIR = 0x12346578
def __init__(self, **values):
self._values = values
self._backup = {}
self._tempdir = None
def __... |
import os
import sys
import urllib.parse
try:
from fuzzywuzzy import fuzz
except ImportError:
print('[*] fuzzywuzzy not found.')
print('[*] Please run the script in the setup directory!')
sys.exit()
def process_group(
data, group, toc, toc_table, page_num, section,
sectionid, html):
... |
"""$DOC"""
__version__ = "$VERSION"
import logging
import pytest
logger = logging.getLogger(__name__)
_automark = False
_ignore_unknown = False
def _get_bool(value):
"""Evaluate string representation of a boolean value.
"""
if value:
if value.lower() in ["0", "no", "n", "false", "f", "off"]:
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import copy
from ansible import constants as C
from ansible.module_utils._text import to_text
from ansible.module_utils.connection import Connection
from ansible.plugins.action.normal import ActionModule as _ActionModul... |
#!/usr/bin/env python
import sys,os
from collections import defaultdict
def read_to_hash(fname,ds=0,de=0,flank=0,cover=False):
#print "loading",fname
pos = {}
for line in file(fname):
if line.startswith("#"):
continue
line = line.strip()
chrom,start,end,name,score,sense... |
# A necrobot "casual" race room.
import asyncio
import datetime
import discord
from necrobot.botbase.botchannel import BotChannel
from necrobot.botbase.necrobot import Necrobot
from necrobot.config import Config
from necrobot.race import cmd_race
from necrobot.race import raceinfo
from necrobot.race.publicrace impor... |
"""Temperature util functions."""
from homeassistant.const import (
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
UNIT_NOT_RECOGNIZED_TEMPLATE,
TEMPERATURE
)
def fahrenheit_to_celsius(fahrenheit: float) -> float:
"""Convert a Fahrenheit temperature to Celsius."""
return (fahrenheit - 32.0) / 1.8
def celsiu... |
# -*- coding: utf-8 -*-
"""
werkzeug.debug.tbtools
~~~~~~~~~~~~~~~~~~~~~~
This module provides various traceback related utility functions.
:copyright: (c) 2013 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD.
"""
import re
import os
import sys
import json
import inspect
import ... |
"""Some utility methods for getting and manipulating paths."""
# TODO(pamg): Have the buildbot use these, too.
import errno
import os
import sys
class PathNotFound(Exception): pass
def ScriptDir():
"""Get the full path to the directory containing the current script."""
script_filename = os.path.abspath(sys.arg... |
from django.conf import settings
from django.contrib.messages.views import SuccessMessageMixin
from django.utils.translation import gettext_lazy as _
from django.views.generic import CreateView
from base.business.education_groups.access_requirements import can_postpone_access_requirements
from base.models.admission_co... |
from django.conf.urls.defaults import *
class URLObject(object):
def __init__(self, app_name, namespace):
self.app_name = app_name
self.namespace = namespace
def urls(self):
return patterns('',
url(r'^inner/$', 'empty_view', name='urlobject-view'),
url(r'^inner/... |
import _krunner
import abc
from PyQt5 import QtCore
__all__ = ["AbstractRunner", "QueryMatch", "RunnerContext", "RunnerSyntax"]
for name in __all__[1:]:
cls = getattr(_krunner.Plasma, name)
globals()[name] = cls
cls.__module__ = __name__
del name
del cls
class ARMeta(type(_krunner.Plasma.AbstractRunne... |
"""
Helper functions that can display leaflet maps inline in an ipython notebook
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins i... |
"""This file contains code used in "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2010 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function, division
import math
import pandas
import random
import numpy as np
import statsmode... |
#!/usr/bin/env python
"""
%prog MODE FILES...
Post-processes HTML and Latex files output by Sphinx.
MODE is either 'html' or 'tex'.
"""
from __future__ import division, absolute_import, print_function
import re
import optparse
import io
def main():
p = optparse.OptionParser(__doc__)
options, args = p.parse_... |
#!/usr/bin/env python2
import re
from psparser import PSLiteral
from glyphlist import glyphname2unicode
from latin_enc import ENCODING
## name2unicode
##
STRIP_NAME = re.compile(r'[0-9]+')
def name2unicode(name):
"""Converts Adobe glyph names to Unicode numbers."""
if name in glyphname2unicode:
retu... |
"""This module contains AWS S3 operators."""
from typing import Optional
from airflow.models import BaseOperator
from airflow.providers.amazon.aws.hooks.s3 import S3Hook
from airflow.utils.decorators import apply_defaults
class S3CreateBucketOperator(BaseOperator):
"""
This operator creates an S3 bucket
... |
from __future__ import unicode_literals
from django.apps import apps
from django.contrib.sites.models import Site
from django.test import TestCase
from django.test.utils import modify_settings, override_settings
@override_settings(
ROOT_URLCONF='flatpages_tests.urls',
SITE_ID=1,
)
@modify_settings(
INSTA... |
from openerp.addons.mail.tests.common import TestMail
from openerp.exceptions import AccessError
from openerp.osv.orm import except_orm
from openerp.tools import mute_logger
class TestMailGroup(TestMail):
@mute_logger('openerp.addons.base.ir.ir_model', 'openerp.models')
def test_00_mail_group_access_rights(s... |
# -*- coding: utf-8 -*-
"""
pygments.token
~~~~~~~~~~~~~~
Basic token types and the standard tokens.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
class _TokenType(tuple):
parent = None
def split(self):
buf = []
... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'GeneratedCertificate.certificate_id'
db.alter_column('certificates_generatedcertificate', 'cert... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
video_codec and video_profile property
"""
from rebulk import Rebulk, Rule, RemoveMatch
from rebulk.remodule import re
from ..common import dash
from ..common.pattern import is_disabled
from ..common.validators import seps_after, seps_before, seps_surround
def video_... |
"""Loader implementation for SavedModel with hermetic, language-neutral exports.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from google.protobuf import message
from google.protobuf import text_format
from tensorflow.core.protobuf import... |
"""
This TinyMCE widget was copied and extended from this code by John D'Agostino:
http://code.djangoproject.com/wiki/CustomWidgetsTinyMCE
"""
from django import forms
from django.conf import settings
from django.contrib.admin import widgets as admin_widgets
from django.core.urlresolvers import reverse
from django.for... |
"""Check the integrity of the data."""
import logging
from base64 import b64decode
from .encryption import hashing, decrypt_blob
from .utils import read_in_chunks
from .exceptions import CheckError
from .settings import inventory, stores
def compute_hash(file_object, chunk_size=1024):
"""Return the hash of a fi... |
#!/usr/bin/python
""" The example of using xmpppy's Ad-Hoc Commands (JEP-0050) implementation.
"""
import xmpp
from xmpp.protocol import *
options = {
'JID': '<EMAIL>',
'Password': '********',
}
class TestCommand(xmpp.commands.Command_Handler_Prototype):
""" Example class. You should read source if you wish to und... |
from MenuList import MenuList
from Tools.Directories import SCOPE_ACTIVE_SKIN, resolveFilename
from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont, getDesktop
from Tools.LoadPixmap import LoadPixmap
from Tools.Directories import fileExists
import skin
def ChoiceEntryComponent(key="", text=None):
scre... |
from bpy import data, types
from .. import constants, logger
from .constants import MULTIPLY, WIRE, IMAGE
def _material(func):
"""
:param func:
"""
def inner(name, *args, **kwargs):
"""
:param name:
:param *args:
:param **kwargs:
"""
if isinstance(... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from nose import tools
from ansible.compat.tests import unittest
from ansible.parsing.splitter import split_args, parse_kv
# Tests using nose's test generators cannot use unittest base class.
# http://nose.readthedocs.org/en/lat... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
compat_urllib_request,
)
from ..utils import (
parse_duration,
)
class ShareSixIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?sharesix\.com/(?:f/)?(?P... |
import distutils.sysconfig
import sys
import os
import traceback
import cexceptions
import os
import sys
import xmlrpclib
import cobbler.module_loader as module_loader
import cobbler.utils as utils
plib = distutils.sysconfig.get_python_lib()
mod_path="%s/cobbler" % plib
sys.path.insert(0, mod_path)
def register():
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import os
import time
try:
from f5.bigiq import ManagementRoot
from icontrol.exceptions import iControlUnexpectedHTTPError
HAS_F5SDK = True
except ImportError:
HAS_F5SDK = False
try:
from library.module_utils.n... |
""" Unit tests for sonification methods """
import mir_eval
import numpy as np
import scipy
def test_clicks():
# Test output length for a variety of parameter settings
for times in [np.array([1.]), np.arange(10)*1.]:
for fs in [8000, 44100]:
click_signal = mir_eval.sonify.clicks(times, fs... |
from __future__ import unicode_literals
from datetime import date
from django.conf import settings
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.auth.te... |
import sys
import os
import csv # @UnusedImport
import urllib # @UnusedImport
try:
import hashlib # @UnusedImport
except ImportError:
import md5 # @UnusedImport
import unittest # @UnusedImport
import platform # @UnusedImport
import sre_compile # @UnusedImport
import shutil # @UnusedImport
... |
"""A Chaco file reader.
"""
# Copyright (c) 2009, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from traits.api import Instance, Str
from traitsui.api import View, Group, Item
from tvtk.api import tvtk
# Local imports.
from mayavi.core.source import Source
from mayavi.core.pipeline_info import Pi... |
"""
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
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.
... |
try:
__IPYTHON__
import IPython
import ipywidgets as widgets
from IPython.core import display
from traitlets import Unicode, Integer, Float
import json
from numpy.random import seed
import time
from .backends.base import MultiTrace
from .sampling import _iter_sample
except (NameE... |
"""
FastCGI (or SCGI, or AJP1.3 ...) server that implements the WSGI protocol.
Uses the flup python package: http://www.saddi.com/software/flup/
This is a adaptation of the flup package to add FastCGI server support
to run Django apps from Web servers that support the FastCGI protocol.
This module can be run standalo... |
from openerp.osv import fields, osv
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
'property_delivery_carrier': fields.property(
'delivery.carrier',
type='many2one',
relation='delivery.carrier',
string="Delivery Method",
view_load=Tru... |
from django.contrib import admin
from django.utils import timezone
from django.utils.functional import curry
from django.utils.translation import ugettext_lazy as _
from .forms import AdminPostForm
from .models import Post, Image, ReviewComment, Section
from .utils import can_tweet
class ImageInline(admin.TabularInl... |
import os
import shutil
import tempfile
import zipfile
from utils.file_util import get_files_by_re, gen_new_file_extension
def get_aar_files(proj_dir, des_dir):
rel_aar_dir = r"build\outputs\aar"
aar_dirs = [os.path.join(proj_dir, i) for i in os.listdir(proj_dir) if os.path.isdir(os.path.join(proj_dir, i))]
... |
"""Setup the adhocracy application"""
import logging
import os
import os.path
import pylons
import pylons.test
from pylons import config
import migrate.versioning.api as migrateapi
try:
from migrate.versioning.exceptions import DatabaseAlreadyControlledError
from migrate.versioning.exceptions import DatabaseN... |
#!/usr/bin/env python
"""Test functions for fftpack.helper module
Copied from fftpack.helper by Pearu Peterson, October 2005
"""
from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.testing import TestCase, run_module_suite, assert_array_almost_equal
from numpy import fft
fr... |
""" Various tables for nodes in a route network.
"""
from re import compile as re_compile
import sqlalchemy as sa
from geoalchemy2 import Geometry
from osgende.generic import TransformedTable
from osgende.common.tags import TagStore
from db.configs import GuidePostConfig, NetworkNodeConfig
from db import conf
GUID... |
from subprocess import Popen
from gi.repository import Gtk,Gdk
from stem import CircBuildFlag,CircClosureReason,CircPurpose,CircStatus,HiddenServiceState
from orapplet.utils import get_leek_icon
def _pos(menu, x, y, icon):
print(x)
print(y)
print(icon)
return (Gtk.StatusIcon.position_menu(menu, x, y, ... |
"""
===================================
Swiss Roll reduction with LLE
===================================
An illustration of Swiss Roll reduction
with locally linear embedding
"""
# License: BSD 3 clause (C) INRIA 2011
print(__doc__)
import matplotlib.pyplot as plt
# This import is needed to modify the way figure ... |
"""
Variant on `KexGroup1 <paramiko.kex_group1.KexGroup1>` where the prime "p" and
generator "g" are provided by the server. A bit more work is required on the
client side, and a **lot** more on the server side.
"""
import os
from hashlib import sha1, sha256
from paramiko import util
from paramiko.common import DEBU... |
from openerp.osv import fields, osv
from openerp import tools
class report_project_task_user(osv.osv):
_name = "report.project.task.user"
_description = "Tasks by user and project"
_auto = False
_columns = {
'name': fields.char('Task Summary', readonly=True),
'user_id': fields.many2one... |
from django.core.management.base import NoArgsCommand
from django.contrib.auth.models import User
from django.db.models.signals import pre_save, post_save
import sys
class Command(NoArgsCommand):
def get_user(self, uid_str):
try:
uid = int(uid_str)
return User.objects.get(id=uid)
... |
from django import forms
class UploadStartForm(forms.Form):
blob = forms.IntegerField()
class UploadForm(forms.Form):
blob = forms.IntegerField()
token = forms.CharField()
file = forms.FileField()
resumableChunkNumber = forms.IntegerField()
class UploadFinishForm(forms.Form):
blob = forms.I... |
# -------------------------------------------------------------------------
# This is an example illustrating how to visit all patched bytes in Python
# (c) Hex-Rays
import idaapi
# -------------------------------------------------------------------------
class patched_bytes_visitor(object):
def __init__(self):
... |
"""
Nagios/Icinga plugin to check running nova services.
This corresponds to the output of 'nova service-list'.
"""
import openstacknagios.openstacknagios as osnag
from novaclient.client import Client
class NovaServices(osnag.Resource):
"""
Determines the status of the nova services.
"""
d... |
"""
Copyright 2008-2011 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 l... |
import ir
import workflow
import module
import res
import report
import tests
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from time import time
class TokenBucket(object):
"""An implementation of the token bucket algorithm.
>>> bucket = TokenBucket(80, 0.5)
>>> print bucket.consume(10)
True
>>> print bucket.consume(90)
False
"""
def __init__(self, tokens, fill_rate):
"""tokens is the total tokens... |
from __future__ import generators
import sys
import types
import traceback
from BTL.defer import Deferred, Failure
from BTL.stackthreading import _print_traceback
from twisted.python import failure
debug = False
name_debug = False
class GenWithDeferred(object):
if debug:
__slots__ = ['gen', 'current_defe... |
########################################################
# evaluator.py
# Last updated: 2014/11/03
########################################################
import numpy as np
from numpy import linalg as LA
import time, sys
import random
import core
from utilities import *
###########################################... |
"""
The parent class for all the SSH services. Currently implemented services
are ssh-userauth and ssh-connection.
Maintainer: Paul Swartz
"""
from twisted.python import log
class SSHService(log.Logger):
name = None # this is the ssh name for the service
protocolMessages = {} # these map #'s -> protocol na... |
from gnuradio import gr, gr_unittest
class test_kludged_imports (gr_unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_blks_import(self):
# make sure that this somewhat magic import works
from gnuradio import blks2
def test_gru_import(self):
... |
import numpy as np
import pytest
from pandas import (
Categorical,
CategoricalDtype,
CategoricalIndex,
DataFrame,
MultiIndex,
Series,
Timestamp,
get_dummies,
period_range,
)
import pandas._testing as tm
from pandas.core.arrays import SparseArray
class TestGetitem:
def test_get... |
"""Tests for tf.GrpcServer."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.client import session
from tensorflow.python.framework import ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import variables
fr... |
"""
Counts words in new text files created in the given directory
Usage: hdfs_wordcount.py <directory>
<directory> is the directory that Spark Streaming will use to find and read new text files.
To run this on your local machine on directory `localdir`, run this example
$ bin/spark-submit examples/src/main/p... |
import py
import sys
def test_ne():
code1 = py.code.Code(compile('foo = "bar"', '', 'exec'))
assert code1 == code1
code2 = py.code.Code(compile('foo = "baz"', '', 'exec'))
assert code2 != code1
def test_code_gives_back_name_for_not_existing_file():
name = 'abc-123'
co_code = compile("pass\n", ... |
# -----------------------------------------------------------------------------
# hedit.py
#
# Paring of Fortran H Edit descriptions (Contributed by Pearu Peterson)
#
# These tokens can't be easily tokenized because they are of the following
# form:
#
# nHc1...cn
#
# where n is a positive integer and c1 ... cn are ch... |
import random
import sys
import threading
import time
import xen.lowlevel.xs
from xen.xend.xenstore import xsutil
from xen.xend.xenstore.xstransact import xstransact
from xen.xend.xenstore.xswatch import xswatch
PATH = '/tool/stress_xs'
def stress():
xstransact.Remove(PATH)
xstransact.Mkdir(PATH)
xsw... |
"""
Logistic Regression With LBFGS Example.
"""
from __future__ import print_function
from pyspark import SparkContext
# $example on$
from pyspark.mllib.classification import LogisticRegressionWithLBFGS, LogisticRegressionModel
from pyspark.mllib.regression import LabeledPoint
# $example off$
if __name__ == "__main__... |
"""
I am completely rewriting this framework which was formerly known as weatherPattern. Yau Kwan Kiu, 802 CERB, NTU, 23-1-2013.
== Requirements ==
* python 2.7 or similar (python 2.5 will probably be okay, no python 3 please)
* numpy and scipy
* no sympy needed yet
* no opencv yet
== What's this? ==
ARMOR = Adjustm... |
import unittest
from sqlalchemy.exc import UnboundExecutionError
from sqlalchemy.orm import sessionmaker
from sqlalchemy import func
from iktomi.db.sqla import multidb_binds
from . import multidb_models
from .multidb_models import db1, db2
class MultidbTest(unittest.TestCase):
def setUp(self):
binds = mu... |
"""Extract, format and print information about Python stack traces."""
import linecache
import sys
import types
__all__ = ['extract_stack', 'extract_tb', 'format_exception',
'format_exception_only', 'format_list', 'format_stack',
'format_tb', 'print_exc', 'format_exc', 'print_exception',
... |
"""
Django admin page for credit eligibility
"""
from ratelimitbackend import admin
from openedx.core.djangoapps.credit.models import (
CreditConfig, CreditCourse, CreditProvider, CreditEligibility, CreditRequest, CreditRequirement,
CreditRequirementStatus
)
class CreditCourseAdmin(admin.ModelAdmin):
"""... |
import pytest
import flask_login
from encore import create_app
from encore.user import User
@pytest.fixture(scope="module")
def app(request):
app = create_app()
ctx = app.app_context()
ctx.push()
request.addfinalizer(ctx.pop)
return app
@pytest.fixture(scope="module")
def test_client(request, app)... |
"""psycopg 1.1.x compatibility module
This module uses the new style connection and cursor types to build a psycopg
1.1.1.x compatibility layer. It should be considered a temporary hack to run
old code while porting to psycopg 2. Import it as follows::
from psycopg2 import psycopg1 as psycopg
"""
# psycopg/psycop... |
#!/usr/bin/env python
from __future__ import print_function
"""
test_transform_with_no_re_matches.py
test messages with no regular expression matches
"""
#88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
# options
#888888888888888888888888888888888888888888... |
# coding=utf-8
"""
Get ceph status from one node
"""
import subprocess
import re
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)),
'ceph'))
from ceph import CephCollector
patternchk = re.compile(r'\bclient io .*')
numberchk = re.compile(r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.