content stringlengths 4 20k |
|---|
from unittest import TestCase
from Rammbock.templates.containers import Protocol
from Rammbock.templates.primitives import UInt, PDU
class TestProtocol(TestCase):
def setUp(self):
self._protocol = Protocol('Test')
def test_header_length(self):
self._protocol.add(UInt(1, 'name1', None))
... |
# Generated from 'Events.h'
nullEvent = 0
mouseDown = 1
mouseUp = 2
keyDown = 3
keyUp = 4
autoKey = 5
updateEvt = 6
diskEvt = 7
activateEvt = 8
osEvt = 15
kHighLevelEvent = 23
mDownMask = 1 << mouseDown
mUpMask = 1 << mouseUp
keyDownMask = 1 << keyDown
keyUpMask = 1 << keyUp
autoKeyMask = 1 << autoKey
updateMask = 1 <... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/mnt/debris/devel/repo/git/luma-fixes/resources/forms/MainWindowDesign.ui'
#
# by: PyQt4 UI code generator 4.8.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QStr... |
from django.conf import settings
from django.contrib.staticfiles.views import serve
from django.shortcuts import render, redirect
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View
from chills_pos.helpers.utils import Permissi... |
from openerp.tests import common
class TestMrpMulticompany(common.TransactionCase):
def setUp(self):
super(TestMrpMulticompany, self).setUp()
cr, uid = self.cr, self.uid
# Usefull models
self.ir_model_data = self.registry('ir.model.data')
self.res_users = self.registry('r... |
#!/usr/bin/env python
import os
import glob
import subprocess as sp
import argparse
import sys
from collections import defaultdict, Iterable
from itertools import product, chain
import networkx as nx
import nose
from conda_build.metadata import MetaData
import yaml
def flatten_dict(dict):
for key, values in di... |
"""
Hawaii gravity data
-------------------
The :mod:`fatiando.datasets` package includes some data sets to make it easier
to try things out in Fatiando.
This example shows the gravity data from Hawaii.
"""
from __future__ import print_function
from fatiando.datasets import fetch_hawaii_gravity
import numpy as np
im... |
"""Example of DNNClassifier for Iris plant dataset, hdf5 format."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from sklearn import datasets
from sklearn import metrics
from sklearn import model_selection
import tensorflow as tf
impor... |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import getdate
def execute(filters=None):
filters["invoices"] = frappe.cache().hget("invoices", frappe.session.user)
validate_filters(filters)
set_filters(filters)
columns = get_columns(filters)
if not filters["invoices"... |
from template import aubio_unit_template
from localaubio import *
import random
buf_size = 2048
channels = 1
flow = float(random.randint(0, 100) + random.random())
fhig = float(random.randint(100, 1000) + random.random())
nelems = 1000
class hist_unit(aubio_unit_template):
def setUp(self):
self.o = new_aubio_... |
#!python
"""Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools... |
from distutils.core import setup, Extension
zookeeper_basedir = "../../../"
zookeepermodule = Extension("zookeeper",
sources=["src/c/zookeeper.c"],
include_dirs=[zookeeper_basedir + "/src/c/include",
zookeeper_basedir + ... |
import email.utils
import mimetypes
from .packages import six
def guess_content_type(filename, default='application/octet-stream'):
"""
Guess the "Content-Type" of a file.
:param filename:
The filename to guess the "Content-Type" of using :mod:`mimetimes`.
:param default:
If no "Cont... |
'''This module contains OpenGL code for rendering a world.'''
from __future__ import division
import climate
import contextlib
import numpy as np
import os
import pyglet
# normally this import should work; the try/except here is so the documentation
# will build on readthedocs.org!
try:
from pyglet.gl import *
e... |
from .safe import (
SafeComputerViewSet, SafeSynchronizationView, SafeEndOfTransmissionView,
)
from .public import (
PackagerKeysView, ProjectKeysView,
RepositoriesKeysView,
)
from .token import (
ComputerViewSet, ErrorViewSet,
FaultDefinitionViewSet, FaultViewSet,
PackageHistoryViewSet, Notific... |
from unittest import TestCase
from django.test import RequestFactory
from mock import patch
from regulations.views.diff import *
class ChromeSectionDiffViewTests(TestCase):
def test_extract_sections_subparts(self):
sub = [{'section_id': '8888-1', 'index': ['8888', '1']},
{'section_id': '... |
import appModuleHandler
import controlTypes
import api
import winUser
from keyboardHandler import KeyboardInputGesture
from NVDAObjects.IAccessible.MSHTML import MSHTML
import msimn
class AboutBlankDocument(MSHTML):
"""A document called about:blank which hosts the HTML message composer document using viewli... |
"""
Microsoft Document summaries structures.
Documents
---------
- Apache POI (HPSF Internals):
http://poi.apache.org/hpsf/internals.html
"""
from lib.hachoir_parser import HachoirParser
from lib.hachoir_core.field import (FieldSet, ParserError,
RootSeekableFieldSet, SeekableFieldSet,
Bit, Bits, NullBits,... |
import superdesk
from apps.archive.archive import SOURCE as ARCHIVE
from apps.content import push_content_notification
from apps.auth import get_user_id
from superdesk import get_resource_service
from superdesk.errors import SuperdeskApiError, InvalidStateTransitionError
from superdesk.metadata.item import CONTENT_STA... |
#!/usr/bin/python
from __future__ import print_function
import sys
import re
import yaml
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
class DataBaseModelProcessor(object):
def __init__(self):
self.db_models = {}
def add_model(self, model):
self.data = model... |
import jmespath
from c7n_gcp.provider import resources
from c7n_gcp.query import QueryResourceManager, TypeInfo
@resources.register('ml-model')
class MLModel(QueryResourceManager):
"""GCP Resource
https://cloud.google.com/ai-platform/prediction/docs/reference/rest/v1/projects.models
"""
class resourc... |
"""
Scheduler host weights
"""
from cinder.openstack.common.scheduler import weight
class WeighedHost(weight.WeighedObject):
def to_dict(self):
return {
'weight': self.weight,
'host': self.obj.host,
}
def __repr__(self):
return ("WeighedHost [host: %s, weight... |
from __future__ import unicode_literals
import frappe, re, os
from werkzeug.urls import url_parse, url_unparse
def delete_page_cache(path):
cache = frappe.cache()
groups = ("page_context", "website_page", "sitemap_options")
if path:
for name in groups:
cache.hdel(name, path)
else:
for name in groups:
cac... |
"""
Common operations on features
"""
import shogun.Features as features
import shogun.Preprocessor as preproc
WORDSTRING_ORDER=3
WORDSTRING_GAP=0
WORDSTRING_REVERSE=False
def get_features(fclass, ftype, data, *args, **kwargs):
if fclass=='simple':
return get_simple(ftype, data, *args, **kwargs)
elif fclass=='s... |
"""
Course Textbooks page.
"""
import requests
from path import Path as path
from common.test.acceptance.pages.common.utils import click_css
from common.test.acceptance.pages.studio.course_page import CoursePage
class TextbookUploadPage(CoursePage):
"""
Course Textbooks page.
"""
url_path = "textboo... |
"""
This module implements the Residue function and related tools for working
with residues.
"""
from __future__ import print_function, division
from sympy import sympify
from sympy.utilities.timeutils import timethis
@timethis('residue')
def residue(expr, x, x0):
"""
Finds the residue of ``expr`` at the po... |
"""Testing tools for byterun."""
from __future__ import print_function
import dis
import sys
import textwrap
import types
import unittest
import six
from byterun.pyvm2 import VirtualMachine, VirtualMachineError
# Make this false if you need to run the debugger inside a test.
CAPTURE_STDOUT = ('-s' not in sys.argv)... |
""" ESC/POS Exceptions classes """
import os
class Error(Exception):
""" Base class for ESC/POS errors """
def __init__(self, msg, status=None):
Exception.__init__(self)
self.msg = msg
self.resultcode = 1
if status is not None:
self.resultcode = status
def __st... |
from os import SEEK_CUR, SEEK_SET
from archipelago.common import (
Request,
string_at,
)
from pithos.workers import monkey
monkey.patch_Request()
_zeros = ''
def zeros(nr):
global _zeros
size = len(_zeros)
if nr == size:
return _zeros
if nr > size:
_zeros += '\0' * (nr - ... |
"""
Scrapy engine tests
This starts a testing web server (using twisted.server.Site) and then crawls it
with the Scrapy crawler.
To view the testing web server in a browser you can start it by running this
module with the ``runserver`` argument::
python test_engine.py runserver
"""
from __future__ import print_... |
from . import constants
from .charsetprober import CharSetProber
from .codingstatemachine import CodingStateMachine
from .mbcssm import UTF8SMModel
ONE_CHAR_PROB = 0.5
class UTF8Prober(CharSetProber):
def __init__(self):
CharSetProber.__init__(self)
self._mCodingSM = CodingStateMachine... |
from collections import defaultdict
from typing import Any, Dict, List, Tuple
from django.db import transaction
from django.db.models import Model
from ..core.config import config
from ..utils.rest_api import ValidationError
from .models import Category, Motion
__all__ = ["numbering"]
def numbering(main_category:... |
import atexit
import cmd
import pprint
import readline
import shlex
import string
import sys
import XenAPI
def logout():
try:
session.xenapi.session.logout()
except:
pass
atexit.register(logout)
class Shell(cmd.Cmd):
def __init__(self):
cmd.Cmd.__init__(self)
self.identcha... |
from struct import pack, unpack
from lib.thrift.protocol.TProtocol import *
class TBinaryProtocol(TProtocolBase):
"""Binary implementation of the Thrift protocol driver."""
# NastyHaxx. Python 2.4+ on 32-bit machines forces hex constants to be
# positive, converting this into a long. If we hardcode the int va... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
try:
import ovirtsdk4.types as otypes
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt impo... |
import urlparse
from openerp.osv import osv, fields
class project_configuration(osv.TransientModel):
_inherit = 'base.config.settings'
_columns = {
'alias_domain': fields.char('Alias Domain',
help="If you have setup a catch-all email domain redirected to "
... |
from openerp import models, api, _
class AccountFiscalyear(models.Model):
_inherit = "account.fiscalyear"
@api.v7
def create_period(self, cr, uid, ids, context=None, interval=1):
recs = self.browse(cr, uid, ids, context)
recs.create_period(interval=interval)
@api.v8
def create_pe... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from ansible.module_utils._text import to_native
from ansible.module_utils.common.validation import check_required_together
@pytest.fixture
def together_terms():
return [
['bananas', 'potatoes'],
... |
"""Typical Client Hello messages sent by different clients."""
import random
from tlslite.messages import ClientHello
from tlslite.constants import \
ECPointFormat, HashAlgorithm, SignatureAlgorithm
from tlslite.extensions import SNIExtension, SupportedGroupsExtension, \
TLSExtension, SignatureAlgorith... |
"""
Django settings for django_daisy project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ..... |
from __future__ import print_function, unicode_literals
from argparse import ArgumentParser
from twisted.internet import reactor
from twisted.internet.protocol import Protocol, connectionDone, ClientFactory
from ircproto.connection import IRCClientConnection
from ircproto.constants import RPL_MYINFO
from ircproto.ev... |
from __future__ import unicode_literals
from decimal import Decimal
import pytest
from shoop.core.models import Tax
from shoop.core.pricing import TaxfulPrice, TaxlessPrice
from shoop.core.taxing.utils import calculate_compounded_added_taxes
from shoop.utils.money import Money
def tax(code, rate=None, amount=None)... |
"""Created on 24 June 2017.
@author: Alex Kost
@description: Training class for CNN and RNN models
Attributes:
DEFAULT_FORMAT (str): Logging format
LOGFILE_NAME (str): Logging file name
OUTPUT_DIR (str): TensorBoard output directory
"""
# Basic Python
import logging
import os
from time import strftime
fro... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from django.utils.six.moves.urllib.parse import quote
from django.utils.translation import ugettext as _
from reviewboard.scmtools.core import HEAD
from reviewboard.scmtools.errors import SCMError
class Client(object):
"""Base SVN client.... |
import os
import re
from setuptools import setup
def read(*paths):
"""Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as f:
return f.read()
def find_version(*file_paths):
"""
Build a path from *file_paths* and search for a ``__version__``
s... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
import base64
from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase
from ansible.mod... |
import socket
import mock
import testtools
import webob
from neutron.agent.metadata import namespace_proxy as ns_proxy
from neutron.common import utils
from neutron.tests import base
class FakeConf(object):
admin_user = 'neutron'
admin_password = 'password'
admin_tenant_name = 'tenant'
auth_url = 'h... |
"""Mixin classes to help make good tests."""
import atexit
import collections
import contextlib
import os
import random
import shutil
import sys
import tempfile
import textwrap
from coverage.backunittest import TestCase
from coverage.backward import StringIO, to_bytes
class Tee(object):
"""A file-like that writ... |
import pygame
def fill(display, color, rect=None):
if rect is None:
display.fill(color)
else:
display.fill(color, rect)
circle = pygame.draw.circle
ellipse = pygame.draw.ellipse
arc = pygame.draw.arc
rect = pygame.draw.rect
def lines(surface, color, closed, points, width=1, antialias... |
"""
Utility functions for generating "lorem ipsum" Latin text.
"""
from __future__ import unicode_literals
import random
COMMON_P = (
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod '
'tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim '
'veniam, quis nostrud e... |
#-*-coding: utf-8
from flask import session, render_template, url_for, redirect, flash
import functools
from datetime import datetime, timedelta
def verify_login(func):
@functools.wraps(func)
def wrappper():
valid_time = timedelta(0, 60*15)
time = session.get('time', None)
if time and \... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class ListAvailableApps(Choreography):
def __init__(self, temboo_session):
"""
Crea... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
(c) 2014 - Copyright Pierre-Yves Chibon
Author: Pierre-Yves Chibon <<EMAIL>>
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2, or (at yo... |
import numpy as np
# TODO: make better exception class?
def check_rank(x):
k = x.shape[1]
rank = np.linalg.matrix_rank(x)
if rank < k:
raise Exception("matrix is rank deficient (rank %i vs cols %i)" % (rank, k))
def add_intercept(x):
"""
Adds an intercept column to the left of the matri... |
#!/usr/bin/env python
import sys, re, operator, string
class DataStorageManager():
""" Models the contents of the file """
_data = ''
def dispatch(self, message):
if message[0] == 'init':
return self._init(message[1])
elif message[0] == 'words':
return self._words()... |
"""Internal support module for sre"""
import _sre, sys
import sre_parse
from sre_constants import *
assert _sre.MAGIC == MAGIC, "SRE module mismatch"
if _sre.CODESIZE == 2:
MAXCODE = 65535
else:
MAXCODE = 0xFFFFFFFFL
_LITERAL_CODES = set([LITERAL, NOT_LITERAL])
_REPEATING_CODES = set([REPEAT, MIN_REPEAT, MA... |
"""Nova instance ID not required
Revision ID: bc5626a5af2a
Revises: 3c7123f2aeba
Create Date: 2016-10-27 18:47:41.163902
"""
# revision identifiers, used by Alembic.
revision = 'bc5626a5af2a'
down_revision = '3c7123f2aeba'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def u... |
# -*- coding: utf-'8' "-*-"
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.osv import osv
from openerp.tools.float_utils import float_compare
from openerp.tools.translate import _
import logging
import pprint
_logger = logging.getLogger(__name__)
class TransferPaymentAcquir... |
import random
import re
import time
import urllib
from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent
sites = {
# Search string to use, domain name the profile will sit on within
# those search results.
"Facebook": ['+intitle:%22{0}%22%20+site:facebook.com',
'"(https... |
import unittest
import my_math
class ProductTestCase(unittest.TestCase):
def testIntegers(self):
for x in xrange(-10, 10):
for y in xrange(-10, 10):
p = my_math.product(x, y)
self.failUnless(p == x * y, 'Interger multiplication failed')
def testFloats(self):
for x in xrange(-10, 10)... |
"""Memorizing file.
A memorizing file wraps a file and memorizes lines read by readline.
"""
import sys
class MemorizingFile(object):
"""MemorizingFile wraps a file and memorizes lines read by readline.
Note that data read by other methods are not memorized. This behavior
is good enough for memorizing... |
import datetime
import time
try:
from zabbix_api import ZabbixAPI
HAS_ZABBIX_API = True
except ImportError:
HAS_ZABBIX_API = False
def create_maintenance(zbx, group_ids, host_ids, start_time, maintenance_type, period, name, desc):
end_time = start_time + period
try:
zbx.maintenance.create... |
import FreeCAD, DraftGeomUtils, Part, Draft
from DraftTools import translate
p = Draft.precision()
if open.__module__ == '__builtin__':
pythonopen = open
def findVert(aVertex,aList):
"finds aVertex in aList, returns index"
for i in range(len(aList)):
if ( round(aVertex.X,p) == round(aList[i].X,p)... |
def build_data(inputdir, outputdir, split=0.9):
data = []
for f in os.listdir(inputdir):
with open(os.path.join(inputdir, f), 'r', encoding='utf-8') as infile:
for l in infile.readlines():
l = l.strip()
if len(l) > 0:
data.append(l)
s... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import base64
import os
import re
import random
import shlex
import time
from ansible.utils.unicode import to_bytes, to_unicode
_common_args = ['PowerShell', '-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Unrestricted']
#... |
import elasticsearch
from django.core.paginator import EmptyPage, Page, PageNotAnInteger, Paginator
from django.utils.html import strip_tags
from django.utils.text import unescape_entities
from elasticsearch.helpers import streaming_bulk
from elasticsearch_dsl import DocType, Long, Nested, Object, String, analysis
from... |
from osv import osv,fields
from tools.misc import attrgetter
import time
# -------------------------------------------------------------------------
# Properties
# -------------------------------------------------------------------------
class ir_property(osv.osv):
_name = 'ir.property'
def _models_field_get... |
import json
from telemetry.core import web_contents
from telemetry.core.chrome import inspector_backend
class MiscWebContentsBackend(object):
"""Provides acccess to chrome://oobe/login page, which is neither an extension
nor a tab."""
def __init__(self, browser_backend):
self._browser_backend = browser_back... |
"""
============================================================
Sparse recovery: feature selection for sparse linear models
============================================================
Given a small number of observations, we want to recover which features
of X are relevant to explain y. For this :ref:`sparse linear ... |
import numpy as np
from qtpy import QtWidgets, QtCore
from .band_widget import BandWidget, BandWidgetModel
class ChannelsDialogModel(object):
def __init__(self, main_window):
self._views = set()
self.main_window = main_window
self.current_index = self.image_names.index(
main_... |
import bpy
from bpy.props import IntProperty, FloatProperty
from sverchok.data_structure import updateNode, match_long_repeat
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.utils.rigid_origami_utils import ObjectParams, \
CreaseLines, InsideVertex, FoldAngleCalculator, FaceRotation
class SvRigidOr... |
import re
import functools
import json
from io import BytesIO
from pytest import fixture, mark
from urllib.parse import urlparse, parse_qs
from tornado.httpclient import HTTPRequest, HTTPResponse
from tornado.httputil import HTTPHeaders
from ..github import GitHubOAuthenticator
from .mocks import setup_oauth_mock
... |
#!/usr/bin/python
# This is a simple example showing how you can send a key press event
# to XBMC using the XBMCClient class
import sys
sys.path.append("../../lib/python")
import time
from xbmcclient import XBMCClient,ACTION_EXECBUILTIN,ACTION_BUTTON
def main():
host = "localhost"
port = 9777
# Cr... |
import collections
import mock
import testtools
from neutron.db import api as db
from neutron.plugins.cisco.common import cisco_exceptions as c_exc
from neutron.plugins.cisco.common import config
from neutron.plugins.cisco.db import nexus_db_v2 as nxdb
from neutron.plugins.cisco.nexus import cisco_nexus_plugin_v2
from... |
import logging
import os
import subprocess
from teuthology.parallel import parallel
from teuthology.task import ansible
from teuthology.exceptions import CommandFailedError
log = logging.getLogger(__name__)
def vm_setup(ctx, config):
"""
Look for virtual machines and handle their initialization
"""
... |
import os
import cognitive_face as cf
import tabulate
import inflection
def handler(context, event):
# extract the stuff we need
image_url = event.body.decode('utf-8').strip()
key = os.environ.get('FACE_API_KEY')
base_url = os.environ.get('FACE_API_BASE_URL')
if key is None:
context.logg... |
from case9_6_1 import Case9_6_1
class Case9_6_5(Case9_6_1):
DESCRIPTION = """Send binary message message with payload of length 1 * 2**20 (1M). Sent out data in chops of 1024 octets."""
EXPECTATION = """Receive echo'ed text message (with payload as sent)."""
def setChopSize(self):
self.chops... |
#! /usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from barf.barf import BARF
if __name__ == "__main__":
# x86
# ======================================================================= #
#
# Open file
#
barf = BARF("./samples/bin/branch4.x86")
... |
from openerp.osv import fields, osv
import openerp.addons.decimal_precision as dp
class membership_invoice(osv.osv_memory):
"""Membership Invoice"""
_name = "membership.invoice"
_description = "Membership Invoice"
_columns = {
'product_id': fields.many2one('product.product','Membership', requi... |
"""MNE software for MEG and EEG data analysis."""
# PEP0440 compatible formatted version, see:
# https://www.python.org/dev/peps/pep-0440/
#
# Generic release markers:
# X.Y
# X.Y.Z # For bugfix releases
#
# Admissible pre-release markers:
# X.YaN # Alpha release
# X.YbN # Beta release
# X.YrcN # Rele... |
"""
====================================
Demonstration of k-means assumptions
====================================
This example is meant to illustrate situations where k-means will produce
unintuitive and possibly unexpected clusters. In the first three plots, the
input data does not conform to some implicit assumptio... |
from UserDict import DictMixin
class OrderedDict(dict, DictMixin):
def __init__(self, *args, **kwds):
if len(args) > 1:
raise TypeError('expected at most 1 arguments, got %d' % len(args))
try:
self.__end
except AttributeError:
self.clear()
self.u... |
from boto.exception import BotoServerError
class ProvisionedThroughputExceededException(BotoServerError):
pass
class LimitExceededException(BotoServerError):
pass
class ExpiredIteratorException(BotoServerError):
pass
class ResourceInUseException(BotoServerError):
pass
class ResourceNotFoundExc... |
#! /usr/bin/env python
# encoding: utf-8
import Logs
import Options
import Utils
class CompilerTraits(object):
def get_warnings_flags(self,level):
raise NotImplementedError
def get_optimization_flags(self,level):
raise NotImplementedError
def get_debug_flags(self,level):
raise NotImplementedError
class GccTra... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
try:
import shade
HAS_SHADE = True
except ImportError:
HAS_SHADE = False
from distutils.version import StrictVersion
def _needs_update(module, service):
if service.enable... |
"""gypd output module
This module produces gyp input as its output. Output files are given the
.gypd extension to avoid overwriting the .gyp files that they are generated
from. Internal references to .gyp files (such as those found in
"dependencies" sections) are not adjusted to point to .gypd files instead;
unlike ... |
"""Integration tests for the User class."""
import github3
from .helper import IntegrationHelper
class TestUser(IntegrationHelper):
"""Integration tests for methods on the User class."""
def test_events(self):
"""Show that a user can retrieve a events performed by a user."""
cassette_name =... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.onyx import onyx_interface
from units.modules.utils import set_module_args
from .onyx_module import TestOnyxModule, load_fixture
class TestOnyxInterfaceModule(TestO... |
import types
from requests.exceptions import HTTPError
from herodb.client import StoreClient
from herodb.test.util import run_server, stop_server
from nose import tools as nt
import time
client = None
def setup_hero():
global client
run_server()
time.sleep(1)
client = StoreClient('http://localhost:808... |
try:
from osgeo import gdal
except ImportError:
import gdal
import sys
import string
if len(sys.argv) < 3:
print('Usage: attachpct.py <pctfile> <infile> <outfile>')
sys.exit(1)
# =============================================================================
# Get the PCT.
# ===========================... |
from __future__ import unicode_literals
import frappe
import unittest, copy
from frappe.test_runner import make_test_objects
from frappe.core.doctype.version.version import get_diff
class TestVersion(unittest.TestCase):
def test_get_diff(self):
test_records = make_test_objects('Event', reset = True)
old_doc = fr... |
from numpy.linalg import inv
from dataclasses import dataclass
from sys import stderr
import numpy as np
import math
from p5.pmath import matrix
import builtins
from vispy import gloo
from vispy.gloo import Texture2D, Program
from contextlib import contextmanager
from p5.core.constants import Z_EPSILON
from p5.core... |
# Import the future
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import datetime
import hashlib
import logging
import os
import re
import shutil
import zipfile
import yaml
from Motome.config import ZIP_EXTENSION, NOTE_EXTENSION, ENCODING, STATUS... |
import build
import buildnet
import writer
def write_library_functions(builder):
for net in builder.project.nets:
write_library_function(builder, net)
write_parameters_setters(builder)
write_library_init_function(builder, )
def write_parameters_setters(builder):
for p in builder.project.ge... |
# Mean Shift: http://scikit-learn.org/stable/auto_examples/cluster/plot_mean_shift.html#example-cluster-plot-mean-shift-py
print(__doc__)
import numpy as np
from sklearn.cluster import MeanShift, estimate_bandwidth
from sklearn.datasets.samples_generator import make_blobs
###########################################... |
# encoding: utf-8
"""
The |Table| object and related proxy classes.
"""
from __future__ import absolute_import, print_function, unicode_literals
from .blkcntnr import BlockItemContainer
from .enum.style import WD_STYLE_TYPE
from .oxml.simpletypes import ST_Merge
from .shared import Inches, lazyproperty, Parented
c... |
from flask.ext.admin.contrib.sqla import ModelView
from models import GenericCollector
from flask.ext import login
from flask_wtf import Form
class GenericCollectorView(ModelView):
"""
ModelView override of Flask Admin for Puppyscripts.
"""
# CSRF protection
form_base_class = Form
# Ensure us... |
"""SCons.Platform.os2
Platform-specific initialization for OS/2 systems.
There normally shouldn't be any need to import this module directly. It
will usually be imported through the generic SCons.Platform.Platform()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, ... |
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
from twitter.common.collections import OrderedSet
from pants.backend.core.tasks.console_task import ConsoleTask
from pants.base.exceptions import TaskError
from pants... |
"""
Tests for the BSE IO functions
"""
# Most functionality is covered under other tests.
# This tests the remainder
import os
import pytest
from basis_set_exchange import fileio
from .common_testvars import data_dir
# yapf: disable
@pytest.mark.parametrize('file_path', ['cc-pVDZ.0.table.json',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.