code stringlengths 1 199k |
|---|
"""
=========================================================================
2 samples permutation test on source data with spatio-temporal clustering
=========================================================================
Tests if the source space data are significantly different between
2 groups of subjects (simul... |
from __future__ import print_function
import side_effect
def useless_function(first, second):
print("I have the wrong number of arguments.")
def function(frame, bp_loc, dict):
side_effect.bktptcmd = "function was here"
def another_function(frame, bp_loc, extra_args, dict):
se_value = extra_args.GetValueForK... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
import time
from flexget import plugin
from flexget.event import event
from flexget.utils.log import log_once
from flexget.utils.titles.movie import MoviePars... |
import inspect
from biicode.client.shell.biistream import Color
class ToolCatalog(dict):
def __init__(self, main_class, tools):
dict.__init__(self)
self.main_class = main_class
# dict from tool group name to set of classes
for c in tools:
self[c.group] = c
self.sh... |
"""
Support for functionality to have conversations with Home Assistant.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/conversation/
"""
import logging
import re
import warnings
import voluptuous as vol
from homeassistant import core
from homeassistant.... |
'Finite difference RTM as a linear operator'
import os, sys, tempfile, subprocess
import rsf.prog, rsf.path
bindir=os.path.join(rsf.prog.RSFROOT,'bin')
datapath=rsf.path.datapath().rstrip('/')
cp=os.path.join(bindir,'sfcp')
rtm=os.path.join(bindir,'sfmpifdlsrtm')
inpd,inpfile=tempfile.mkstemp(dir=datapath)
outd,outfile... |
import portage.versions
import os,sys
import subprocess
import json
from merge_utils import *
dirpath = os.path.dirname(os.path.realpath(__file__))
print("List of differences between funtoo and gentoo")
print("=============================================")
def getKeywords(portdir, ebuild, warn):
a = subprocess.getsta... |
import random
import struct
class base_primitive (object):
'''
The primitive base class implements common functionality shared across most primitives.
'''
def __init__ (self):
self.fuzz_complete = False # this flag is raised when the mutations are exhausted.
self.fuzz_library = []... |
"""Persistent identifier minters."""
from __future__ import absolute_import
from invenio_pidstore.models import PersistentIdentifier, PIDStatus, \
RecordIdentifier
def zenodo_concept_recid_minter(record_uuid=None, data=None):
"""Mint the Concept RECID.
Reserves the Concept RECID for the record.
"""
... |
"""
A utility for displaying lexical dispersion.
"""
def dispersion_plot(text, words, ignore_case=False, title="Lexical Dispersion Plot"):
"""
Generate a lexical dispersion plot.
:param text: The source text
:type text: list(str) or enum(str)
:param words: The target words
:type words: list of s... |
import sys
import time
from hypertable.thriftclient import *
from hyperthrift.gen.ttypes import *
if (len(sys.argv) < 2):
print sys.argv[0], "<hql>"
sys.exit(1);
try:
client = ThriftClient("localhost", 15867)
namespace = client.open_namespace("/")
res = client.hql_query(namespace, sys.argv[1]);
print res
... |
"""
Tests related to the cohorting feature.
"""
from uuid import uuid4
from .helpers import BaseDiscussionMixin
from .helpers import CohortTestMixin
from ..helpers import UniqueCourseTest
from ...pages.lms.auto_auth import AutoAuthPage
from ...fixtures.course import (CourseFixture, XBlockFixtureDesc)
from ...pages.lms.... |
from spack import *
class PerlFontTtf(PerlPackage):
"""Perl module for TrueType Font hacking"""
homepage = "http://search.cpan.org/~bhallissy/Font-TTF-1.06/lib/Font/TTF.pm"
url = "http://search.cpan.org/CPAN/authors/id/B/BH/BHALLISSY/Font-TTF-1.06.tar.gz"
version('1.06', '241b59310ad4450e6e050d5e79... |
def pow(a, b, mod):
res = 1
while b > 0:
if b & 1 != 0:
res = res * a % mod
a = a * a % mod
b >>= 1
return res
print(1024 == pow(2, 10, 1000000007)) |
from nose.tools import * # flake8: noqa
from django.db.models import Q
from tests.base import AdminTestCase
from osf_tests.factories import SubjectFactory
from osf.models import Subject
from osf.models.preprint_provider import rules_to_subjects
from admin.base.utils import get_subject_rules
import logging
logger = log... |
from robot.utils import elapsed_time_to_string, html_escape, normalize
from .tags import TagPatterns
class Stat(object):
"""Generic statistic object used for storing all the statistic values."""
def __init__(self, name):
#: Human readable identifier of the object these statistics
#: belong to. E... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from textwrap import dedent
from mock import MagicMock
from pants.backend.codegen.targets.java_thrift_library import JavaThriftLibrary
from pants.backend.jvm.... |
from django.conf.urls import url
from dojo.engagement import views
urlpatterns = [
# engagements and calendar
url(r'^calendar$', views.engagement_calendar, name='calendar'),
url(r'^calendar/engagements$', views.engagement_calendar, name='engagement_calendar'),
url(r'^engagement$', views.engagement, nam... |
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 DeleteWaterLog(Choreography):
def __init__(self, temboo_session):
"""
Create a n... |
from django.utils.translation import ugettext_lazy as _
PANEL_GROUP = 'database'
PANEL_GROUP_NAME = _('Database')
PANEL_GROUP_DASHBOARD = 'project' |
"""Produce contact map for Figure 5D from the PySB publication"""
from __future__ import print_function
import pysb.integrate
import pysb.util
import numpy as np
import scipy.optimize
import scipy.interpolate
import matplotlib.pyplot as plt
import os
import sys
import inspect
from earm.lopez_embedded import model
obs_n... |
import mock
from django_images.models import Thumbnail
from taggit.models import Tag
from tastypie.exceptions import Unauthorized
from tastypie.test import ResourceTestCase
from .helpers import ImageFactory, PinFactory, UserFactory
from ..models import Pin, Image
from ...users.models import User
__all__ = ['ImageResour... |
from django.conf import settings
from django.contrib import admin
if 'django.contrib.auth' in settings.INSTALLED_APPS:
from tastypie.models import ApiKey
class ApiKeyInline(admin.StackedInline):
model = ApiKey
extra = 0
ABSTRACT_APIKEY = getattr(settings, 'TASTYPIE_ABSTRACT_APIKEY', False)
... |
import math
from pyface.qt import QtCore, QtGui
class GutterWidget(QtGui.QWidget):
min_width = 5
background_color = QtGui.QColor(220, 220, 220)
def sizeHint(self):
return QtCore.QSize(self.min_width, 0)
def paintEvent(self, event):
""" Paint the line numbers.
"""
painter ... |
"""
tests.basic
~~~~~~~~~~~~~~~~~~~~~
The basic functionality.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pytest
import re
import uuid
import time
import flask
import pickle
from datetime import datetime
from threading import Thread
from flask._co... |
import datetime as dt
import csv
import copy
import os
import pickle
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from QSTK.qstkutil import qsdateutil as du
import QSTK.qstkutil.DataEvolved as de
def get_data(ls_symbols, ls_keys):
'''
@summary: Gets a data chunk for backtesting
@pa... |
import unittest
from scrabble import score
class WordTest(unittest.TestCase):
def test_invalid_word_scores_zero(self):
self.assertEqual(0, score(''))
self.assertEqual(0, score(' \t\n'))
self.assertEqual(0, score('hous3'))
self.assertEqual(0, score('wo rd'))
def test_scores_very_s... |
from django.conf.urls import patterns, url
from polls import views
urlpatterns = patterns('',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<pk>\d+)/$', views.DetailView.as_view(), name='detail'),
url(r'^(?P<pk>\d+)/results/$', views.ResultsView.as_view(), name='results'),
url(r'^(?P<qu... |
__all__ = ['ArgumentParser']
try:
from argparse import ArgumentParser
except ImportError:
# Compatibility with Python 2.6 and 3.1
from optparse import OptionGroup, OptionParser
from portage.localization import _
class ArgumentParser(object):
def __init__(self, **kwargs):
add_help = kwargs.pop("add_help", None... |
""" Component tests for VPC network functionality - Port Forwarding Rules.
"""
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.base import (stopRouter,
startRouter,
Account,
... |
'''
Copyright (C) 2007
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 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be u... |
from ecl.summary import EclSum
OIL_PRICES = {
"2010-01-01": 78.33,
"2010-02-01": 76.39,
"2010-03-01": 81.20,
"2010-04-01": 84.29,
"2010-05-01": 73.74,
"2010-06-01": 75.34,
"2010-07-01": 76.32,
"2010-08-01": 76.60,
"2010-09-01": 75.24,
"2010-10-01": 81.89,
"2010-11-01": 84.25,... |
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 model 'Follow'
db.create_table('actstream_follow', (
('id', self.gf('django.db.models.fields.AutoField')(primary_k... |
import unittest
from datetime import datetime
from flask import url_for
from app import current_app as app
from app.helpers.data import save_to_db
from app.models.call_for_papers import CallForPaper
from tests.unittests.object_mother import ObjectMother
from tests.unittests.utils import OpenEventTestCase
class TestGues... |
"""Commands for reading and manipulating snapshots."""
from googlecloudsdk.calliope import base
class Snapshots(base.Group):
"""List, describe, and delete Google Compute Engine snapshots."""
Snapshots.detailed_help = {
'brief': 'List, describe, and delete Google Compute Engine snapshots',
} |
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from couchpotato.environment import Env
log = CPLog(__name__)
class Automation(Plugin):
def __init__(self):
addEvent('app.load', self.setCrons)
if not Env... |
import unittest
from PySide.QtCore import QSizeF
from PySide.QtGui import QGraphicsProxyWidget, QSizePolicy, QPushButton, QGraphicsScene, QGraphicsView
from helper import TimedQApplication
def createItem(minimum, preferred, maximum, name):
w = QGraphicsProxyWidget()
w.setWidget(QPushButton(name))
w.setMinim... |
"""@package PyToAPI
This module handles parsing of information from RIOT periph_uart test.
"""
try:
from riot_pal import DutShell
except ImportError:
raise ImportError('Cannot find riot_pal, try "pip install riot_pal"')
class PeriphUartIf(DutShell):
"""Interface to the node with periph_uart firmware."""
... |
import pilasengine
import sys
sys.path.insert(0, "..")
pilas = pilasengine.iniciar()
mono = pilas.actores.Mono(y=-100)
def cuando_cambia_escala(valor):
mono.escala = valor * 2
deslizador_escala = pilas.interfaz.Deslizador(y=50)
deslizador_escala.conectar(cuando_cambia_escala)
def cuando_cambia_rotacion(valor):
... |
tutorial_tests = """
Let's try a simple generator:
>>> def f():
... yield 1
... yield 2
>>> for i in f():
... print(i)
1
2
>>> g = f()
>>> next(g)
1
>>> next(g)
2
"Falling off the end" stops the generator:
>>> next(g)
Traceback (most recent call last):
... |
'''
Analysis plugin for supporting WorkspaceEmulators during analysis pass.
Finds and connects Switch Cases, most specifically from Microsoft.
'''
import envi
import envi.archs.i386 as e_i386
import vivisect
import vivisect.analysis.generic.codeblocks as vagc
def analyzeJmp(amod, emu, op, starteip):
'''
Top lev... |
import json
from six.moves.urllib import parse as urllib
from tempest_lib import exceptions as lib_exc
from tempest.api_schema.response.compute.v2_1 import images as schema
from tempest.common import service_client
from tempest.common import waiters
class ImagesClient(service_client.ServiceClient):
def create_image... |
"""Tests for acme.challenges."""
import unittest
import mock
import OpenSSL
import requests
from six.moves.urllib import parse as urllib_parse # pylint: disable=import-error
from acme import errors
from acme import jose
from acme import test_util
CERT = test_util.load_comparable_cert('cert.pem')
KEY = jose.JWKRSA(key=... |
"""Datasets for random number generators."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.data.util import random_seed
from tensorflow.python.framework import dtypes
from tensorflow.... |
from tempest_lib.common.utils import data_utils
from testtools import matchers
from tempest.api.compute import base
from tempest import config
from tempest import test
CONF = config.CONF
class VolumesGetTestJSON(base.BaseV2ComputeTest):
@classmethod
def skip_checks(cls):
super(VolumesGetTestJSON, cls).s... |
from __future__ import division, print_function, absolute_import
import numpy
import pandas
from numpy.random.mtrand import RandomState
from sklearn.metrics.pairwise import pairwise_distances
from hep_ml import commonutils
from hep_ml.commonutils import weighted_quantile, build_normalizer, \
compute_cut_for_efficie... |
"""Routines to help recognizing sound files.
Function whathdr() recognizes various types of sound file headers.
It understands almost all headers that SOX can decode.
The return tuple contains the following items, in this order:
- file type (as SOX understands it)
- sampling rate (0 if unknown or hard to decode)
- numb... |
"""docstring"""
__revision__ = ''
class Interface:
"""base class for interfaces"""
class IMachin(Interface):
"""docstring"""
def truc(self):
"""docstring"""
def troc(self, argument):
"""docstring"""
class Correct1:
"""docstring"""
__implements__ = IMachin
def __init__(self):
... |
from __future__ import print_function
import time, sys, signal, atexit
from upm import pyupm_bmx055 as sensorObj
def main():
# Instantiate a BMX055 instance using default i2c bus and address
sensor = sensorObj.BMX055()
## Exit handlers ##
# This function stops python from printing a stacktrace when you ... |
"""Test that `yield` or `yield from` can't be used inside an async function."""
async def good_coro():
def _inner():
yield 42
yield from [1, 2, 3]
async def bad_coro():
yield 42
yield from [1, 2, 3] # [yield-inside-async-function] |
from __future__ import absolute_import, unicode_literals
def connect_sqs(aws_access_key_id=None, aws_secret_access_key=None, **kwargs):
"""Return async connection to Amazon SQS."""
from .sqs.connection import AsyncSQSConnection
return AsyncSQSConnection(
aws_access_key_id, aws_secret_access_key, **k... |
"""
This file implements the CLA Classifier region. See the comments in the class
definition of CLAClassifierRegion for a description.
"""
from PyRegion import PyRegion
from nupic.algorithms.cla_classifier_factory import CLAClassifierFactory
class CLAClassifierRegion(PyRegion):
"""
CLAClassifierRegion implements a ... |
from nose.tools import * # noqa
import mock
from boto.s3.connection import * # noqa
from tests.base import OsfTestCase, get_default_metaschema
from tests.factories import ProjectFactory
from framework.auth import Auth
from website.addons.base.testing import models
from website.addons.s3.model import S3NodeSettings
fr... |
"""Support for Nanoleaf Lights."""
import logging
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_HS_COLOR,
ATTR_TRANSITION, PLATFORM_SCHEMA, SUPPORT_BRIGHTNESS,
SUPPORT_COLOR, SUPPORT_COLOR_TEMP, SUPPORT_EFFECT,
SUPPORT_TRANSITIO... |
from __future__ import absolute_import
from __future__ import print_function
import filecmp
import os
import ujson
from django.core import mail
from django.http import HttpResponse
from django.test import override_settings
from mock import patch
from typing import Any, Dict, List
from zerver.lib.actions import do_chang... |
from typing import Optional, Set, Text
import re
find_mentions = r'(?<![^\s\'\"\(,:<])@(\*\*[^\*]+\*\*|all|everyone)'
user_group_mentions = r'(?<![^\s\'\"\(,:<])@(\*[^\*]+\*)'
wildcards = ['all', 'everyone']
def user_mention_matches_wildcard(mention: Text) -> bool:
return mention in wildcards
def extract_name(s: Te... |
from __future__ import unicode_literals
from django.contrib.syndication.views import Feed
from django.contrib.sites.models import get_current_site
from django.shortcuts import get_object_or_404
from django.contrib.auth.models import User
from django_images.models import Thumbnail
from taggit.models import Tag
from .mod... |
from __future__ import division
import numpy as np
import scipy as sp
from warnings import warn
from scipy.sparse import issparse
import numbers
from ..externals import six
from ..tree import ExtraTreeRegressor
from ..utils import check_random_state, check_array
from .bagging import BaseBagging
__all__ = ["IsolationFor... |
from __future__ import unicode_literals
import codecs
import os
import shutil
import tempfile
import unittest
from admin_scripts.tests import AdminScriptTestCase
from django.conf import settings
from django.contrib.staticfiles import storage
from django.contrib.staticfiles.management.commands import collectstatic
from ... |
from doit.action import CmdAction
def task_hello():
"""hello cmd """
def create_cmd_string():
return "echo hi"
return {
'actions': [CmdAction(create_cmd_string)],
'verbosity': 2,
} |
from app.config.cplog import CPLog
from app.lib.provider.movie.base import movieBase
from imdb import IMDb
from urllib import quote_plus
from urllib2 import URLError
import cherrypy
import os
import urllib2
log = CPLog(__name__)
class theMovieDb(movieBase):
"""Api for theMovieDb"""
apiUrl = 'http://api.themovie... |
import gnome15.g15locale as g15locale
_ = g15locale.get_translation("sysmon", modfile = __file__).ugettext
import gnome15.util.g15convert as g15convert
import gnome15.util.g15uigconf as g15uigconf
import gnome15.util.g15gconf as g15gconf
import gnome15.util.g15cairo as g15cairo
import gnome15.util.g15icontools as g15ic... |
from openerp.osv import fields, osv
class account_chart(osv.osv_memory):
"""
For Chart of Accounts
"""
_name = "account.chart"
_description = "Account chart"
_columns = {
'fiscalyear': fields.many2one('account.fiscalyear', \
'Fiscal year', \
... |
"""
Specific overrides to the base prod settings to make development easier.
"""
from os.path import abspath, dirname, join
from .aws import * # pylint: disable=wildcard-import, unused-wildcard-import
del DEFAULT_FILE_STORAGE
MEDIA_ROOT = "/edx/var/edxapp/uploads"
DEBUG = True
USE_I18N = True
TEMPLATE_DEBUG = True
SIT... |
from redhatPatching import redhatPatching
class centosPatching(redhatPatching):
def __init__(self, hutil):
super(centosPatching,self).__init__(hutil) |
"""The Energy integration."""
from __future__ import annotations
from homeassistant.components import frontend
from homeassistant.core import HomeAssistant
from homeassistant.helpers import discovery
from homeassistant.helpers.typing import ConfigType
from . import websocket_api
from .const import DOMAIN
from .data imp... |
"""Reference implementation for health checking in gRPC Python."""
import threading
import grpc
from grpc_health.v1 import health_pb2
class HealthServicer(health_pb2.HealthServicer):
"""Servicer handling RPCs for service statuses."""
def __init__(self):
self._server_status_lock = threading.Lock()
... |
from absl import app
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.ui import WebDriverWait
import test_util
def getElementFromShadowRoot(driver, element, selector):
if element is None:
return None
else:
return driver.ex... |
import unittest, StringIO, robotparser
from test import test_support
from urllib2 import urlopen, HTTPError
class RobotTestCase(unittest.TestCase):
def __init__(self, index, parser, url, good, agent):
unittest.TestCase.__init__(self)
if good:
self.str = "RobotTest(%d, good, %s)" % (index... |
"""SCons.Tool.gfortran
Tool-specific initialization for gfortran, the GNU Fortran 95/Fortran
2003 compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
__revision__ = "src/engine/SCons/Tool/gfortran.py 2014... |
import os.path, string, posix, pyvms
IDIR = ['swig_root:[source.swig]', 'swig_root:[source.doh.include]',
'swig_root:[source.include]', 'swig_root:[source.preprocessor]']
def new_file(fg, dirname):
global IDIR
fn = 'swig_root:[vms.scripts]compil_' + os.path.basename(dirname) + '.com'
print >> fg, '$... |
"""
Plugin's Base Class
"""
import sys
import cli
from cli.docopt import docopt
PLUGIN_NAME = "base-plugin"
PLUGIN_CLASS = "PluginBase"
VERSION = "Mesos Plugin Base 1.0"
SHORT_HELP = "This is the base plugin from which all other plugins inherit."
USAGE = \
"""
{short_help}
Usage:
mesos {plugin} (-h | --help)
mesos ... |
from django.contrib import admin |
import threading
import time
import unittest
from grpc import _grpcio_metadata
from grpc._adapter import _types
from grpc._adapter import _low
from tests.unit import test_common
def wait_for_events(completion_queues, deadline):
"""
Args:
completion_queues: list of completion queues to wait for events on
dea... |
import optparse
import os
import platform
import shutil
import subprocess
import sys
import tempfile
import unittest
import zipfile
from telemetry.util import cloud_storage
from telemetry.util import find_dependencies
class FindDependenciesTest(unittest.TestCase):
@unittest.skipUnless(
cloud_storage.SupportsPro... |
from .code_generator_info import CodeGeneratorInfo
from .composition_parts import WithCodeGeneratorInfo
from .composition_parts import WithComponent
from .composition_parts import WithDebugInfo
from .composition_parts import WithIdentifier
from .ir_map import IRMap
from .make_copy import make_copy
class Typedef(WithIde... |
import json
from django.conf import settings
from django.contrib.messages.storage.base import BaseStorage, Message
from django.http import SimpleCookie
from django.utils.crypto import salted_hmac, constant_time_compare
from django.utils.safestring import SafeData, mark_safe
from django.utils import six
class MessageEnc... |
from telemetry.core.backends.chrome import timeline_recorder
from telemetry.timeline import inspector_timeline_data
class TabBackendException(Exception):
"""An exception which indicates an error response from devtools inspector."""
pass
class InspectorTimeline(timeline_recorder.TimelineRecorder):
"""Implementatio... |
"""Test cases for bounce message generation
"""
from twisted.trial import unittest
from twisted.mail import bounce
import cStringIO
import email.message
import email.parser
class BounceTests(unittest.TestCase):
"""
testcases for bounce message generation
"""
def testBounceFormat(self):
from_, to... |
import urllib
from askbot.deps.django_authopenid.util import OAuthConnection
class Twitter(OAuthConnection):
def __init__(self):
super(Twitter, self).__init__('twitter')
self.tweet_url = 'https://api.twitter.com/1.1/statuses/update.json'
def tweet(self, text, access_token=None):
client =... |
from django.db import models
class BigAutoField(models.AutoField):
description = "Big Integer"
def db_type(self, connection):
engine = connection.settings_dict['ENGINE']
if 'mysql' in engine:
return "bigint AUTO_INCREMENT"
elif 'postgres' in engine:
return "bigser... |
"""Support for sending data to Emoncms."""
import logging
from datetime import timedelta
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import (
CONF_API_KEY, CONF_WHITELIST, CONF_URL, STATE_UNKNOWN, STATE_UNAVAILABLE,
CONF_SCAN_INTERVAL)
f... |
"""Add standard attribute table
Revision ID: 32e5974ada25
Revises: 13cfb89f881a
Create Date: 2015-09-10 00:22:47.618593
"""
revision = '32e5974ada25'
down_revision = '13cfb89f881a'
from alembic import op
import sqlalchemy as sa
TABLES = ('ports', 'networks', 'subnets', 'subnetpools', 'securitygroups',
'floati... |
"""
Boolean geometry difference of solids.
"""
from __future__ import absolute_import
import __init__
from fabmetheus_utilities.geometry.geometry_utilities import boolean_solid
from fabmetheus_utilities.geometry.geometry_utilities import evaluate
from fabmetheus_utilities.geometry.solids import group
__author__ = 'Enri... |
__title__ = "FreeCAD FEM constraint electrostatic potential document object"
__author__ = "Markus Hovorka, Bernd Hahnebach"
__url__ = "https://www.freecadweb.org"
from . import base_fempythonobject
class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject):
Type = "Fem::ConstraintElectrostatic... |
try:
import os, gettext
locale_dir = os.path.split(__file__)[0]
gettext.install('4Suite', locale_dir)
except (ImportError,AttributeError,IOError):
def _(msg):
return msg
SYNTAX_ERR_MSG = _("Error parsing expression:\n'%s'\nSyntax error at or near '%s' Line: %d")
INTERNAL_ERR_MSG = _("Error parsi... |
import maya.cmds
import IECore
import IECoreMaya
class TestPluginLoadUnload( IECoreMaya.TestCase ) :
def test( self ):
""" Test loading/unloading of plugin """
# Plugin should be loaded by MayaUnitTest.TestProgram when we get here
self.assert_( maya.cmds.pluginInfo( "ieCore", query = True, loaded = True ) )
fo... |
import json
import traceback
from couchpotato.core._base.downloader.main import DownloaderBase
from couchpotato.core.helpers.encoding import isInt
from couchpotato.core.helpers.variable import cleanHost
from couchpotato.core.logger import CPLog
import requests
log = CPLog(__name__)
autoload = 'Synology'
class Synology(... |
"""Tests for parser module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import textwrap
from tensorflow.contrib.autograph.pyct import parser
from tensorflow.python.platform import test
class ParserTest(test.TestCase):
def test_parse_entity(self):
... |
import subprocess as sp
def main(args):
with open(args.disk, 'rb') as f:
f.seek(args.block * args.block_size)
block = (f.read(args.block_size)
.ljust(args.block_size, b'\xff'))
# what did you expect?
print("%-8s %-s" % ('off', 'data'))
return sp.run(['xxd', '-g1', '-'], inpu... |
"""Generated message classes for fusiontables version v1.
API for working with Fusion Tables data.
"""
from apitools.base.protorpclite import messages as _messages
package = 'fusiontables'
class Column(_messages.Message):
"""Specifies the id, name and type of a column in a table.
Messages:
BaseColumnValue... |
from crits.vocabulary.vocab import vocab
class RelationshipTypes(vocab):
"""
Vocabulary for Relationship Types.
"""
COMPRESSED_FROM = "Compressed From"
COMPRESSED_INTO = "Compressed Into"
CONNECTED_FROM = "Connected From"
CONNECTED_TO = "Connected To"
CONTAINS = "Contains"
CONTAINED_... |
class RequestHeaders(object):
'''A custom dictionary impementation for headers which ignores the case
of requests, since different HTTP libraries seem to mangle them.
'''
def __init__(self, dict_):
if isinstance(dict_, RequestHeaders):
self._dict = dict_
else:
self._dict = dict((k.lower(), v... |
from cStringIO import StringIO
import unittest
import unittest2
from unittest2.test.support import resultFactory
class TestUnittest(unittest2.TestCase):
def assertIsSubclass(self, actual, klass):
self.assertTrue(issubclass(actual, klass), "Not a subclass.")
def testInheritance(self):
self.assert... |
licenses = [
"""\
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
""",
"""\
""",
"""\
// This Source Code Form is subject to the terms of the Mozilla Public
// Lic... |
import numpy as np
from .base import SelectorMixin
from ..base import BaseEstimator, clone
from ..externals import six
from ..exceptions import NotFittedError
from ..utils.fixes import norm
def _get_feature_importances(estimator, norm_order=1):
"""Retrieve or aggregate feature importances from estimator"""
impo... |
import sys
import re
import os
import argparse
import requests
from lxml import html as lxml_html
try:
import html
except ImportError:
import HTMLParser
html = HTMLParser.HTMLParser()
try:
import cPickle as pk
except ImportError:
import pickle as pk
class LeetcodeProblems(object):
def get_proble... |
KEYIDS = {
"KEY_RESERVED": 0,
"KEY_ESC": 1,
"KEY_1": 2,
"KEY_2": 3,
"KEY_3": 4,
"KEY_4": 5,
"KEY_5": 6,
"KEY_6": 7,
"KEY_7": 8,
"KEY_8": 9,
"KEY_9": 10,
"KEY_0": 11,
"KEY_MINUS": 12,
"KEY_EQUAL": 13,
"KEY_BACKSPACE": 14,
"KEY_TAB": 15,
"KEY_Q": 16,
"KEY_W": 17,
"KEY_E": 18,
"KEY_R": 19,
"KEY_T": 20,
"KEY_Y": 21,
"KEY_U... |
from __future__ import unicode_literals
from .. import Provider as PhoneNumberProvider
class Provider(PhoneNumberProvider):
phonenumber_prefixes = [134, 135, 136, 137, 138, 139, 147, 150,
151, 152, 157, 158, 159, 182, 187, 188,
130, 131, 132, 145, 155, 156, 18... |
"""Test result object"""
import os
import sys
import traceback
from StringIO import StringIO
from . import util
from functools import wraps
__unittest = True
def failfast(method):
@wraps(method)
def inner(self, *args, **kw):
if getattr(self, 'failfast', False):
self.stop()
return met... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.