content string |
|---|
"""
Based on the python xreload.
Changes
======================
1. we don't recreate the old namespace from new classes. Rather, we keep the existing namespace,
load a new version of it and update only some of the things we can inplace. That way, we don't break
things such as singletons or end up with a second repres... |
from spack import *
class PyFastaindex(PythonPackage):
"""FastA index (.fai) handler compatible with samtools faidx is extended
with 4 columns storing counts for A, C, G & T for each sequence.."""
homepage = "https://github.com/lpryszcz/FastaIndex"
url = "https://pypi.io/packages/source/F/Fas... |
from iris.core.interfaces import Interface
from iris.core.decorators import rpc
from iris.events.base import BaseEventSystem
from iris.core.events import Event
class SimpleBrokerClient(Interface):
service_type = 'simple_broker_client'
register_with_coordinator = False
@rpc()
def event(self, channel, ... |
#!/usr/bin/python #!/usr/bin/env python
#
# GrovePi Python Setup
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
#
# Have a question about this example? Ask on the forums here: http://forum.dexterindustries.com/c/grovepi
#
'... |
from __future__ import absolute_import, unicode_literals
import pytest
import sys
import traceback
from collections import deque
from struct import pack, unpack
import weakref
from case import Mock
from vine.funtools import wrap
from vine.promises import promise
class test_promise:
def test_example(self):
... |
from __future__ import absolute_import
from django.utils.datastructures import SortedDict
from horizon.utils.memoized import memoized # noqa
from openstack_dashboard.api import neutron
neutronclient = neutron.neutronclient
class IKEPolicy(neutron.NeutronAPIDictWrapper):
"""Wrapper for neutron VPN IKEPolicy.... |
"""A parser of RFC 2822 and MIME email messages."""
__all__ = ['Parser', 'HeaderParser', 'BytesParser', 'BytesHeaderParser',
'FeedParser', 'BytesFeedParser']
from io import StringIO, TextIOWrapper
from email.feedparser import FeedParser, BytesFeedParser
from email._policybase import compat32
class Par... |
import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import workflows
from openstack_dashboard import api
from openstack_dashboard.dashboards.project.networks import workflows \
as... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six.moves im... |
import unittest
from datetime import datetime, timedelta
from airflow.ti_deps.deps.not_in_retry_period_dep import NotInRetryPeriodDep
from airflow.utils.state import State
from fake_models import FakeDag, FakeTask, FakeTI
class NotInRetryPeriodDepTest(unittest.TestCase):
def test_still_in_retry_period(self):
... |
"""
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the 'context_processors' option of the configuration
of a DjangoTemplates backend and use... |
def DistanceToPlane(plane, point):
"""Returns the distance from a 3D point to a plane
Parameters:
plane (plane): the plane
point (point): List of 3 numbers or Point3d
Returns:
number: The distance if successful, otherwise None
Example:
import rhinoscriptsyntax as rs
... |
from django.contrib.gis import admin
from django.contrib.messages import error
from django.db import models
from django.forms.widgets import RadioSelect
from .models import Property
class PropertyAdmin(admin.ModelAdmin):
search_fields = ["address", "description"]
list_display = ["address", "bedrooms", "bath... |
from django.contrib.localflavor.fi.forms import (FIZipCodeField,
FISocialSecurityNumber, FIMunicipalitySelect)
from utils import LocalFlavorTestCase
class FILocalFlavorTests(LocalFlavorTestCase):
def test_FIMunicipalitySelect(self):
f = FIMunicipalitySelect()
out = u'''<select name="municipal... |
#._cv_part guppy.etc.tkcursors
# A Tk window that shows what cursor shapes are available.
# Moving the mouse over the cursor name shows the cursor in that shape.
from Tkinter import *
def tkcursors(master=None):
if master is None:
root = Tk()
else:
root = master
for i, cursor in enumerate((
'X_cursor'... |
import logging
from unittest.mock import patch
from datetime import timedelta
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from libfaketime import fake_time
from munch.apps.campaigns.models import Mail
from munch.apps.campaigns.models import MailSt... |
#=======================================================================
#
# Python Lexical Analyser
#
# Lexical Analyser Specification
#
#=======================================================================
import types
import Actions
import DFA
import Errors
import Machines
import Regexps
# debug_flags for ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=============================================
Manifold Learning methods on a severed sphere
=============================================
An application of the different :ref:`manifold` techniques
on a spherical data-set. Here one can see the use of
dimensionality reducti... |
# -*- coding: 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):
# Adding index on 'Feed', fields ['active_subscribers']
db.create_index('feeds', ['active_subscribers'])
... |
import logging
import string
import datetime
import re
_logger = logging.getLogger(__name__)
try:
import vatnumber
except ImportError:
_logger.warning("VAT validation partially unavailable because the `vatnumber` Python library cannot be found. "
"Install it to support... |
from openerp import SUPERUSER_ID
def set_partner_id_from_partner_address_id(
cr, pool, model_name, partner_field, address_field, table=None):
"""
Set the new partner_id on any table with migrated contact ids
:param model_name: the model name of the target table
:param partner_field: the colum... |
from urlparse import urlsplit, parse_qsl
from datetime import datetime
from weboob.deprecated.browser import Browser, BrowserIncorrectPassword, BrowserBanned
from .pages import LoginPage, Initident, CheckPassword, repositionnerCheminCourant, BadLoginPage, AccountDesactivate, \
AccountList, AccountH... |
import sqlite3
db = sqlite3.connect('im.db');
db.row_factory = sqlite3.Row
cur = db.execute('select * from movie;');
movies = [];
import json
convert = {};
import csv
with open('convert.csv', newline='') as csvfile:
spamreader = csv.reader(csvfile)
for row in spamreader:
convert[int(row[0])] = float(r... |
from oslo_config import cfg
from nova.network import api as network_api
from nova.tests.functional.api_sample_tests import api_sample_base
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.legacy_v2.extensions')
class NetworksAssociateJsonTests(api_sample_base.Ap... |
__author__ = 'Keyvan'
class MindAgent(object):
def run(self, atomspace):
pass
class Request(object):
def __init__(self):
pass
def run(self, args=[], atomspace=None):
self.send("This is the default python request.")
def send(self, msg):
print str(msg)... |
import os, sys
import tokenize
from k_script import BaseScript, ParseError, HTTP_ERROR
from k_encodings import k_encoding
import urllib
class Error:
def __init__(self,msg,errorLine):
self.msg = msg
self.errorLine = errorLine
class Script(BaseScript):
"""Karrigell Service"""
def __init__(... |
"""Compiler tools with improved interactive support.
Provides compilation machinery similar to codeop, but with caching support so
we can provide interactive tracebacks.
Authors
-------
* Robert Kern
* Fernando Perez
* Thomas Kluyver
"""
# Note: though it might be more natural to name this module 'compiler', that
# ... |
import sys
import random
import string
import re
class Field:
def __init__(self, name, is_nullible):
self.name = name
self.is_nullible = is_nullible
class Field_int(Field):
sizes = [ 1, 2, 3, 4, 8 ]
types = [ "TINYINT", "SMALLINT", "MEDIUMINT", "INT", "BIGINT" ]
uint_ranges = [ (0,(1<<... |
{
'name': 'Authentification - Brute-force Attack',
'version': '8.0.1.0.0',
'category': 'base',
'summary': "Tracks Authentication Attempts and Prevents Brute-force"
" Attacks module",
'author': "GRAP,Odoo Community Association (OCA)",
'website': 'http://www.grap.coop',
'license... |
"""
Custom-written pure powershell meterpreter/reverse_tcp stager.
Module @harmj0y
"""
from modules.common import helpers
class Payload:
def __init__(self):
# required options
self.description = "pure windows/meterpreter/reverse_tcp stager, no shellcode"
self.rating = "Excellent"
... |
import re
import time
from bs4 import BeautifulSoup
from couchpotato.core.helpers.encoding import toUnicode
from couchpotato.core.helpers.rss import RSS
from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog
from couchpotato.core.event import fireEvent
from couchpotato.core.medi... |
"""
Example showing the use of a TriFinder object. As the mouse is moved over the
triangulation, the triangle under the cursor is highlighted and the index of
the triangle is displayed in the plot title.
"""
import matplotlib.pyplot as plt
from matplotlib.tri import Triangulation
from matplotlib.patches import Polygon... |
# -*- coding: utf-8 -*-
"""Algorithms for spectral clustering"""
# Brian Cheung
# Wei LI <<EMAIL>>
# License: BSD 3 clause
import warnings
import numpy as np
from ..base import BaseEstimator, ClusterMixin
from ..utils import check_random_state, as_float_array
from ..utils.validation import check_arra... |
#!/usr/bin/env python
'''
Created Dec 1, 2009
Main driver for application
Author: Sam Gleske
'''
import socket,sys,os.path,eventlet,binascii,urllib2,re
from lib import *
from time import sleep
from time import ctime
from sys import exit
proxyRegEx=re.compile("([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3... |
import re
import datetime
class InvalidCard(Exception):
pass
class CardNotSupported(Exception):
pass
class CreditCard(object):
# The regexp attribute should be overriden by the subclasses.
# Attribute value should be a regexp instance
regexp = None
# Has to be set by the user after calling... |
import os
import xml.dom.minidom
import uuid
from collections import Sequence
from gi.repository import Gtk, GdkPixbuf, CMenu, GLib, Gdk
DESKTOP_GROUP = GLib.KEY_FILE_DESKTOP_GROUP
KEY_FILE_FLAGS = GLib.KeyFileFlags.KEEP_COMMENTS | GLib.KeyFileFlags.KEEP_TRANSLATIONS
def fillKeyFile(keyfile, items):
for key, item... |
import os
import re
from setuptools import setup
def rel(*parts):
'''returns the relative path to a file wrt to the current directory'''
return os.path.abspath(os.path.join(os.path.dirname(__file__), *parts))
README = open('README.md', 'r').read()
with open(rel('webpack_loader', '__init__.py')) as handler:... |
import numpy as np
import scipy
from scipy import misc, ndimage
import pywt
import matplotlib.pyplot as plt
filename = "3-IS61836062.jpg" # EY : 20150704 obviously, you can use your own image or the built-in lena
simona = ndimage.imread(filename)
# let's get only the R,G,B values
simonaRGB = [simona[:,:,k] for k ... |
# coding: utf-8
import random
import sys
from werkzeug.datastructures import FileStorage
from flask import current_app
from flask.ext.admin import form
from flask.ext.admin.form.upload import ImageUploadInput
from flask.ext.admin._compat import urljoin
from quokka.core.models import SubContent, SubContentPurpose
from... |
def main(request, response):
# Set mode to 'init' for initial fetch.
mode = 'init'
if 'update-recovery-mode' in request.cookies:
mode = request.cookies['update-recovery-mode'].value
# no-cache itself to ensure the user agent finds a new version for each update.
headers = [('Cache-Control', ... |
from django.contrib.contenttypes.models import ContentType
from django.db.models import get_apps, get_models, signals
from django.utils.encoding import smart_unicode
def update_contenttypes(app, created_models, verbosity=2, **kwargs):
"""
Creates content types for models in the given app, removing any mo... |
from __future__ import print_function
import os
import sys
import logging
logger = None
def get_standard_logger():
"""
Retrieves and configures a standard logger for the Instana package
@return: Logger
"""
standard_logger = logging.getLogger("instana")
ch = logging.StreamHandler()
f = l... |
from cinder import context
from cinder import exception
from cinder.tests.unit import fake_volume
from cinder.tests.unit.volume.drivers.emc import scaleio
class TestCreateVolume(scaleio.TestScaleIODriver):
"""Test cases for ``ScaleIODriver.create_volume()``"""
def setUp(self):
"""Setup a test case env... |
# -*- coding: utf-8 -*-
import math
import os
from loguru import logger as log
import varint
import iscc
from iscc_bench.shortid import bech32
from iscc_bench.shortid.utils import (
iscc_decode,
HEAD_SID_PU,
HEAD_SID_CB,
b58i_encode,
b58i_decode,
)
def short_id(code: str, chain: bytes = HEAD_SID_P... |
"""Unit tests for update_webgl_conformance_tests."""
import unittest2 as unittest
from webkitpy.to_be_moved import update_webgl_conformance_tests as webgl
def construct_script(name):
return "<script src=\"" + name + "\"></script>\n"
def construct_style(name):
return "<link rel=\"stylesheet\" href=\"" + nam... |
import imp
import os
import sys
from django.conf import settings
from django.template import Template, Context
import traceback
import configparser
import schema
class PatchewModule(object):
""" Module base class """
name = None # The name of the module, must be unique
default_config = "" # The default... |
"""
Third party auth API related permissions
"""
from rest_framework import permissions
from third_party_auth.models import ProviderApiPermissions
class ThirdPartyAuthProviderApiPermission(permissions.BasePermission):
"""
Allow someone to access the view if they have valid OAuth client credential.
"""
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import time
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
from ansible... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'core'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
import re
import time
from ansible.module_utils.basic import get_exception
from ansible.module_utils.six import iteritems
from ansible.module_utils.ordnance import get_config
fr... |
ANSIBLE_METADATA = {'status': ['stableinterface'],
'supported_by': 'community',
'version': '1.0'}
# import cloudstack common
from ansible.module_utils.cloudstack import *
class AnsibleCloudStackZone(AnsibleCloudStack):
def __init__(self, module):
super(AnsibleCloud... |
"""Compilation of serialized models for testing purposes."""
RESOURCE_EXPANSION_1 = {
'resources': {
'r/res1': {
'r/res2': {},
'r/res3': {},
'r/res4': {},
'r/res5': {
'r/res6': {
'r/res7': {},
'r/res8': ... |
from django.template.defaultfilters import urlize
from django.test import SimpleTestCase
from django.utils.functional import lazy
from django.utils.safestring import mark_safe
from ..utils import setup
class UrlizeTests(SimpleTestCase):
@setup({'urlize01': '{% autoescape off %}{{ a|urlize }} {{ b|urlize }}{% en... |
import json
import os
import tarfile
from unittest import mock
from testtools.matchers import Contains, DirExists, Equals, FileExists, Not
import snapcraft
from snapcraft import file_utils
from snapcraft.internal import sources
from snapcraft.plugins.v1 import dotnet
from tests import unit
from . import PluginsV1Bas... |
"""
This module is indended to provide a pluggable way to add assertions about
the rendered content of XBlocks.
For each view on the XBlock, this module defines a @singledispatch function
that can be used to test the contents of the rendered html.
The functions are of the form:
@singledispatch
def assert_stu... |
"""Individualized delivery with header/footer decorations."""
from __future__ import absolute_import, print_function, unicode_literals
__metaclass__ = type
__all__ = [
'DecoratingDelivery',
'DecoratingMixin',
]
from mailman.config import config
from mailman.mta.verp import VERPDelivery
class Decorat... |
from datetime import date, datetime
from django.conf.urls import url
from django.conf.urls.i18n import i18n_patterns
from django.contrib.sitemaps import (
FlatPageSitemap, GenericSitemap, Sitemap, views,
)
from django.http import HttpResponse
from django.utils import timezone
from django.views.decorators.cache imp... |
import mock
from nova import objects
from nova.scheduler.filters import aggregate_instance_extra_specs as agg_specs
from nova import test
from nova.tests.unit.scheduler import fakes
@mock.patch('nova.scheduler.filters.utils.aggregate_metadata_get_by_host')
class TestAggregateInstanceExtraSpecsFilter(test.NoDBTestCas... |
from setuptools import find_packages, setup
setup(
name='django-postman',
version=__import__('postman').__version__,
description='User-to-User messaging system for Django, with gateway to AnonymousUser,' \
' moderation and thread management, user & exchange filters, inbox/sent/archives/trash folder... |
"""
https://leetcode.com/problems/bulb-switcher-ii/
https://leetcode.com/submissions/detail/140962396/
"""
class Solution1:
def flipLights(self, n, m):
"""
:type n: int
:type m: int
:rtype: int
"""
def flipEvery(x, index):
return not x
def flip... |
import os
import math
from Crypto.Hash import SHA256
# convert a large integer to a big-endian bitstring
def encode_mpi(n):
if n >= 256:
return encode_mpi(n / 256) + chr(n % 256)
else:
return chr(n)
# convert a large integer to a big-endian bitstring, padded with \x00s to
# a multiple of 16 bytes
def encode_mp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Related to AboutOpenClasses in the Ruby Koans
#
from runner.koan import *
class AboutMonkeyPatching(Koan):
class Dog:
def bark(self):
return "WOOF"
def test_as_defined_dogs_do_bark(self):
fido = self.Dog()
self.assertEqual... |
# -*- coding: utf-8 -*-
from collections import OrderedDict
import pytest
from pandas.util._validators import validate_bool_kwarg, validate_kwargs
_fname = "func"
def test_bad_kwarg():
good_arg = "f"
bad_arg = good_arg + "o"
compat_args = OrderedDict()
compat_args[good_arg] = "foo"
compat_args... |
"""
Test cases for catalog_integrations command.
"""
import pytest
from django.core.management import call_command, CommandError
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
from openedx.core.djangoapps.catalog.models import CatalogIntegration
from openedx.core.djangoapps.catalog.tests.mixi... |
__all__ = ['keywords_header']
from portage import settings as ports
from portage.output import colorize
from gentoolkit.eshowkw.display_pretty import colorize_string
from gentoolkit.eshowkw.display_pretty import align_string
class keywords_header:
__IMPARCHS = [ 'arm', 'amd64', 'x86' ]
__ADDITIONAL_FIELDS = [ 'unus... |
"""Conversion pipeline templates.
The problem:
------------
Suppose you have some data that you want to convert to another format,
such as from GIF image format to PPM image format. Maybe the
conversion involves several steps (e.g. piping it through compress or
uuencode). Some of the conversion steps may require th... |
from __future__ import print_function
import collections
import re
import sys
import gzip
import zlib
_COMPRESSED_MARKER = 0xFF
def check_non_ascii(msg):
for c in msg:
if ord(c) >= 0x80:
print(
'Unable to generate compressed data: message "{}" contains a non-ascii character... |
"""
Event tracker backend that saves events to a Django database.
"""
# TODO: this module is very specific to the event schema, and is only
# brought here for legacy support. It should be updated when the
# schema changes or eventually deprecated.
from __future__ import absolute_import
import logging
from django.d... |
# pylint: skip-file
# flake8: noqa
#pylint: disable=too-many-branches
def main():
'''
ansible oc module for pvc
'''
module = AnsibleModule(
argument_spec=dict(
kubeconfig=dict(default='/etc/origin/master/admin.kubeconfig', type='str'),
state=dict(default='present', type... |
"""Utility for testing certificate display.
This command will create a fake certificate for a user
in a course. The certificate will display on the student's
dashboard, but no PDF will be generated.
Example usage:
$ ./manage.py lms create_fake_cert test_user edX/DemoX/Demo_Course --mode honor --grade 0.89
"""
... |
"""Support for Velbus thermostat."""
import logging
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
STATE_HEAT, SUPPORT_TARGET_TEMPERATURE)
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from . import DOMAIN as VELBUS... |
import cherrypy
from cherrypy.test import helper
from cherrypy._cpcompat import json
class JsonTest(helper.CPWebCase):
def setup_server():
class Root(object):
def plain(self):
return 'hello'
plain.exposed = True
def json_string(self):
re... |
"""
Verifies that a rule that generates multiple outputs rebuilds
correctly when the inputs change.
"""
import TestGyp
test = TestGyp.TestGyp(workdir='workarea_all')
test.run_gyp('same_target.gyp', chdir='src')
test.relocate('src', 'relocate/src')
test.build('same_target.gyp', test.ALL, chdir='relocate/src')
exp... |
# -*- coding: utf-8 -*-
"""
Kay framework.
:Copyright: (c) 2009 Takashi Matsuo <<EMAIL>> All rights reserved.
:license: BSD, see LICENSE for more details.
"""
import sys
import getpass
from google.appengine.ext.remote_api import remote_api_stub
import kay.app
from kay.misc import get_appid
def print_status(msg=''... |
"""
Values that are used throughout the app
"""
FRAGMENT_TYPE_PLAINTEXT = 'plaintext'
FRAGMENT_TYPE_HTML = 'html'
FRAGMENT_TYPE_MARKDOWN = 'markdown'
FRAGMENT_TYPE_IMAGE = 'image'
FRAGMENT_TYPE_CODE = 'code'
FRAGMENT_TYPE_EMBED = 'embed'
FRAGMENT_TYPE_CHOICES = (
(FRAGMENT_TYPE_PLAINTEXT, 'Plaintext'),
(FRAGM... |
from qtools import QtGui, QtCore
from collections import OrderedDict
# Generic classes
# ---------------
class TreeItem(object):
def __init__(self, parent=None, data=None):
"""data is an OrderedDict"""
self.parent_item = parent
self.index = QtCore.QModelIndex()
self.childr... |
"""
Input for test_profile.py and test_cprofile.py.
IMPORTANT: This stuff is touchy. If you modify anything above the
test class you'll have to regenerate the stats by running the two
test files.
*ALL* NUMBERS in the expected output are relevant. If you change
the formatting of pstats, please don't just regenerate t... |
#!/usr/bin/python3
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-management public/distro-tree public/config public/dhcp publ... |
"""
Zabbix Server external inventory script.
========================================
Returns hosts and hostgroups from Zabbix Server.
Configuration is read from `zabbix.ini`.
Tested with Zabbix Server 2.0.6.
"""
import os, sys
import argparse
import ConfigParser
try:
from zabbix_api import ZabbixAPI
except:
... |
import gtk
import pygtk
class cuon_dialog:
def __init__(self):
# Dialog - Flags
# DIALOG_MODAL - make the dialog modal
# DIALOG_DESTROY_WITH_PARENT - destroy dialog when its parent is destroyed
# DIALOG_NO_SEPARATOR - omit the separator between the vbox and the action_area
... |
#!/bin/env python
from __future__ import absolute_import
__author__ = "Gina Haeussge <<EMAIL>>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
import errno
import subproces... |
import os
try:
import ConfigParser as configparser
except ImportError: # py3 compat
import configparser
class PulpConfig(object):
"""
pulp configuration:
1. look in ~/.pulp/admin.conf
configuration contents:
[server]
host = <pulp-server-hostname.example.com>
verify_ssl = false
... |
"""Test label RPCs.
RPCs tested are:
- getaddressesbylabel
- listaddressgroupings
- setlabel
"""
from collections import defaultdict
from test_framework.blocktools import COINBASE_MATURITY
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal, assert_r... |
from __future__ import absolute_import
import logging
import tempfile
import os.path
from pip.compat import samefile
from pip.exceptions import BadCommand
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves.urllib import request as urllib_request
from pip._vendor.packaging.versio... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
LinesIntersection.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*********************... |
from chemlab.mviewer.representations import BallAndStickRepresentation
from chemlab.graphics.qttrajectory import format_time
from .core import *
from chemlab.db import CirDB
from chemlab.io import datafile
from chemlab.core import System
import numpy as np
db = CirDB()
def display_system(system, autozoom=True):
... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import unittest
from pants.engine.engine import LocalSerialEngine
from pants.engine.fs import Files, PathGlobs
from pants.engine.isolated_process import (Bi... |
"""The deferred instance delete extension."""
import webob
from nova.api.openstack import common
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import compute
from nova import exception
ALIAS = 'os-deferred-delete'
authorize = extensions.extension_authorizer('compute',
... |
#!/usr/bin/env python3
"""
This module provides physical property data sets and models for coals and
cokes.
"""
from sys import modules
from os.path import realpath, dirname, join
from math import exp
from auxi.tools.materialphysicalproperties.core import Model
from auxi.tools.chemistry.stoichiometry import molar_mas... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import random
import subprocess
from test.helper import (
FakeYDL,
get_params,
)
from you... |
microcode = '''
#
# Regular moves
#
def macroop MOV_R_MI {
limm t1, imm, dataSize=asz
ld reg, seg, [1, t0, t1]
};
def macroop MOV_MI_R {
limm t1, imm, dataSize=asz
st reg, seg, [1, t0, t1]
};
def macroop MOV_R_R {
mov reg, reg, regm
};
def macroop MOV_M_R {
st reg, seg, sib, disp
};
def ma... |
from datetime import date, timedelta
from django.conf import settings
from django.contrib.auth.models import User, AnonymousUser
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.test import TestCase
class TokenGeneratorTest(TestCase):
def test_make_token(self):
"""
... |
"""Script for unittesting the drbd module"""
import os
from ganeti import constants
from ganeti import errors
from ganeti.storage import drbd
from ganeti.storage import drbd_info
from ganeti.storage import drbd_cmdgen
import testutils
class TestDRBD8(testutils.GanetiTestCase):
def testGetVersion(self):
data... |
import os
import stat
import sys
import tempfile
import unittest
from django.core.exceptions import SuspiciousOperation
from django.test import SimpleTestCase
from django.utils import archive
class TestArchive(unittest.TestCase):
def setUp(self):
self.testdir = os.path.join(os.path.dirname(__file__), 'a... |
"""
Contains the querying interface.
Starting with :class:`~tinydb.queries.Query` you can construct complex
queries:
>>> ((where('f1') == 5) & (where('f2') != 2)) | where('s').matches(r'^\w+$')
(('f1' == 5) and ('f2' != 2)) or ('s' ~= ^\w+$ )
Queries are executed by using the ``__call__``:
>>> q = where('val') == 5
>>>... |
import numpy as np
from statsmodels.compat import range
from . import utils
def dot_plot(points, intervals=None, lines=None, sections=None,
styles=None, marker_props=None, line_props=None,
split_names=None, section_order=None, line_order=None,
stacked=False, styles_order=None, s... |
import json
from tempest.common import rest_client
from tempest import config
CONF = config.CONF
class BaseExtensionsClientJSON(rest_client.RestClient):
def __init__(self, auth_provider):
super(BaseExtensionsClientJSON, self).__init__(auth_provider)
self.service = CONF.volume.catalog_type
... |
"""
Make sure debug format settings are extracted properly.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test = TestGyp.TestGyp(formats=['ninja'])
CHDIR = 'compiler-flags'
test.run_gyp('debug-format.gyp', chdir=CHDIR)
# While there's ways to via .pdb contents, the .pdb doesn't include
# whic... |
from oslo_log import log as logging
from oslo_utils import excutils
import six
from heat.common.i18n import _
from heat.common.i18n import _LE
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import properties
from heat.engine import resource
from heat.engine import support
LOG ... |
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.forms.models import (BaseModelForm, BaseModelFormSet, fields_for_model,
_get_foreign_key)
from django.contrib.admin.util import get_fields_from_path, NotRelationFiel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.