content stringlengths 4 20k |
|---|
import numpy as np
from numba import jit, njit
from scipy_numba.spatial.distance import squareform
from MyML.utils.sparse import EAC_CSR
class EAC_FULL():
def __init__(self, n_samples, dtype=np.uint8, condensed=False):
self.n_samples = n_samples
self.dtype = dtype
self.nnz = 0
s... |
"""Tests the graph freezing tool."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from tensorflow.core.framework import graph_pb2
from tensorflow.core.protobuf import saver_pb2
from tensorflow.python.client import session
from tensorflow.pytho... |
#! /usr/bin/env python
from numpy.testing import TestCase, assert_equal, assert_almost_equal
from aubio import fvec, cvec, pvoc
from numpy import array, shape
from numpy.random import random
precision = 6
class aubio_pvoc_test_case(TestCase):
""" pvoc object test case """
def test_members_automatic_sizes_de... |
"""
Tools for creating edxnotes content fixture data.
"""
import json
import factory
import requests
from . import EDXNOTES_STUB_URL
class Range(factory.Factory):
FACTORY_FOR = dict
start = "/div[1]/p[1]"
end = "/div[1]/p[1]"
startOffset = 0
endOffset = 8
class Note(factory.Factory):
FACTO... |
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... |
from __future__ import absolute_import
from django.conf import settings
import hashlib
from zerver.lib.utils import make_safe_digest
def gravatar_hash(email):
"""Compute the Gravatar hash for an email address."""
# Non-ASCII characters aren't permitted by the currently active e-mail
# RFCs. However, the I... |
#!/usr/bin/python
# coding=utf-8
##########################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import Mock
from mock import patch
from diamond.collector import Collector
from exim import EximColle... |
from __future__ import division, absolute_import, print_function
import platform
from distutils.unixccompiler import UnixCCompiler
from numpy.distutils.exec_command import find_executable
from numpy.distutils.ccompiler import simple_version_match
if platform.system() == 'Windows':
from numpy.distutils.msvc9compil... |
"""Tensor utility functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
from tensorflow.python.platform import tf_logging as logging
from tensorflow.python.util import decorator_utils
def _add_experimental_function_notice_to_docst... |
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"label": _("Issues"),
"items": [
{
"type": "doctype",
"name": "Issue",
"description": _("Support queries from customers."),
"onboard": 1,
},
{
"type": "doctype",
"name": "Issue Typ... |
# -*- coding: utf-8 -*-
import json
from termcolor import colored
def diff(actual, expected, keypath=[], indent=''):
tp = type(expected)
if tp != type(actual):
return [_unequal(keypath, actual, expected, indent)]
if tp == list:
return _diff_lists(actual, expected, keypath, indent)
if... |
import os
import tarfile
import zipfile
from cerbero.packages import PackageType
from cerbero.packages.disttarball import DistTarball
from cerbero.errors import UsageError
class AndroidPackager(DistTarball):
''' Creates a distribution tarball for Android '''
def __init__(self, config, package, store):
... |
from casadi import *
from casadi.tools import *
#! Let's revisit briefly the difference between SX and MX
a = MX.sym("a",2,2)
b = MX.sym("b",2,2)
c = MX.sym("c",2,2)
d = a+b
e = d*c
#! The element-wise addition and multiplication operators appear just as a single node in the MX expression graph
dotdraw(e)
#! We can... |
"""An optimizer wrapper for stateful optimizers with multitask loss."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import types
import six
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.pytho... |
"""Updates NetErrorCodes enum in histograms.xml file with values read
from net_error_list.h.
If the file was pretty-printed, the updated version is pretty-printed too.
"""
import os.path
import re
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
from update_histogram_enum import U... |
import logging
import os
import unittest
from telemetry.core import browser_credentials
from telemetry.core import discover
from telemetry.page import page_set as page_set_module
from telemetry.page import page_set_archive_info
class PageSetSmokeTest(unittest.TestCase):
def CheckArchive(self, page_set):
"""Ve... |
from openerp import models, fields, api
class ProjectProject(models.Model):
_inherit = 'project.project'
@api.one
def _project_purchase_shortcut_count(self):
purchase_obj = self.env['purchase.order']
purchases = purchase_obj.search([('main_project_id', '=', self.id)])
self.purcha... |
import mox
from oslo.config import cfg
from cinder import exception
from cinder import test
from cinder.volume import configuration as conf
from cinder.volume.drivers import xiv_ds8k
FAKE = "fake"
VOLUME = {'size': 16,
'name': FAKE,
'id': 1}
CONNECTOR = {'initiator': "iqn.2012-07.org.fake:01:948... |
"""Test the SQL API."""
import pytest
from PyQt5.QtSql import QSqlError
from qutebrowser.misc import sql
pytestmark = pytest.mark.usefixtures('init_sql')
@pytest.mark.parametrize('klass', [sql.KnownError, sql.BugError])
def test_sqlerror(klass):
text = "Hello World"
err = klass(text)
assert str(err) ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import copy
from django.core.exceptions import ValidationError
from django.forms.utils import ErrorDict, ErrorList, flatatt
from django.test import SimpleTestCase
from django.utils import six
from django.utils.encoding import force_text, python_2_unicode... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from units.compat.mock import patch, MagicMock
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.playbook.block import Block
from ansible.playbook.play import Play
from ansi... |
b_uuid = None
def store_b_uuid():
global b_uuid
b_uuid = next(iter(reality.resources_by_logical_name('B'))).uuid
def check_b_not_replaced():
test.assertEqual(b_uuid,
next(iter(reality.resources_by_logical_name('B'))).uuid)
test.assertIsNotNone(b_uuid)
example_template = Template(... |
# -*- 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):
# Changing field 'CourseEnrollment.course_id'
db.alter_column('student_courseenrollment', 'course_id', self... |
import logging
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.api import neutron
LOG = logging.getLogger(__name__)
class VPN(horizon.Panel):
name = _("VPN")
slug = 'vpn'
permissions = ('openstack.services.network',)
def allowed(self, context):
... |
import unittest2 as unittest
from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.tool.mocktool import MockOptions, MockTool
from webkitpy.tool.steps.suggestreviewers import SuggestReviewers
class SuggestReviewersTest(unittest.TestCase):
def test_disabled(self):
step = SuggestRevi... |
# coding=utf-8
from __future__ import absolute_import
__author__ = "Mr Beam Team <<EMAIL>>"
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
__copyright__ = "Copyright (C) 2015 The Mr Beam Project - Released under terms of the AGPLv3 License"
import logging
import logging.handle... |
"""
Generates random traces to pass directly to the simulations (as input).
"""
##########################################################################
## Imports
##########################################################################
import sys
import logging
import argparse
from commis import Command
from cl... |
def none_shall_pass(who):
if who is not None:
raise AssertionError('None shall pass!')
print '*HTML* <object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/dhRUe-gz690&hl=en_US&fs=1&rel=0&color1=0x234900&color2=0x4e9e00"></param><param name="allowFullScreen" value="true"></... |
"""Tests for registry system.
This test uses two other modules:
* registry_test_base, which defines a registered base class.
* registry_test_impl, which defines a subclass.
Critically, although we use both as build dependencies, we do not explicitly
import registry_test_impl.
"""
import traceback
from tensorflo... |
"""
A few bits of helper functions for comment views.
"""
import urllib
import textwrap
from django.http import HttpResponseRedirect
from django.core import urlresolvers
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.exceptions import ObjectDoesNotExist
from... |
from django.core.paginator import Paginator, EmptyPage
from django.utils.unittest import TestCase
class PaginatorTests(TestCase):
"""
Tests for the Paginator and Page classes.
"""
def check_paginator(self, params, output):
"""
Helper method that instantiates a Paginator object from the... |
#coding:utf-8
import logging
from boto import s3
from boto.exception import S3ResponseError, S3CreateError
from boto.route53.exception import DNSServerError
from cactus.deployment.engine import BaseDeploymentEngine
from cactus.deployment.s3.auth import AWSCredentialsManager
from cactus.deployment.s3.file import S3Fil... |
from distutils.core import setup
import unittest
import warnings
warnings.filterwarnings("ignore", "Unknown distribution option")
import sys
# patch distutils if it can't cope with the "classifiers" keyword
if sys.version < '2.2.3':
from distutils.dist import DistributionMetadata
DistributionMetadata.classifie... |
from django.apps import apps as django_apps
from django.core import urlresolvers, paginator
from django.core.exceptions import ImproperlyConfigured
from django.utils.six.moves.urllib.parse import urlencode
from django.utils.six.moves.urllib.request import urlopen
PING_URL = "http://www.google.com/webmasters/tools/pin... |
import array
from ctypes import byref, create_string_buffer
from .pm_ctypes import (
libpm, libpt,
pmHostError, PmEvent,
PmTimeProcPtr, NullTimeProcPtr,
PortMidiStreamPtr,
)
from . import MidiException
__all__ = [
'TRUE',
'FALSE',
'Initialize',
'Terminate',
'CountDevices',
'G... |
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from misago.admin.views import generic
from misago.core import cachebuster
from misago.threads.models import Label
from misago.threads.forms.admin import LabelForm
class LabelsAdmin(generic.AdminBaseMixin):
root_link = '... |
from widget.constant import PROGRAM_NAME, PROGRAM_VERSION
from dtk.ui.init_skin import init_skin
from deepin_utils.file import get_parent_dir
import os
app_theme = init_skin(
PROGRAM_NAME,
PROGRAM_VERSION,
"dark_black",
os.path.join(get_parent_dir(__file__, 2), "skin"),
os.path.join(get_parent_dir(... |
from .vehicle import Vehicle
from ..basics.shape import Rectangle
from ..basics.spline_extra import sample_splines, definite_integral
from casadi import inf
import numpy as np
class HolonomicOrient(Vehicle):
def __init__(self, shapes=Rectangle(width=0.2, height=0.4), options=None, bounds=None):
bounds = ... |
from dasbus.server.interface import dbus_interface
from dasbus.typing import * # pylint: disable=wildcard-import
from pyanaconda.modules.common.base import KickstartModuleInterfaceTemplate
from pyanaconda.modules.common.constants.objects import ZFCP
from pyanaconda.modules.common.containers import TaskContainer
@dbu... |
try:
from importlib.machinery import SourceFileLoader
_loader = lambda *args: SourceFileLoader(*args).load_module()
except ImportError:
import imp
_loader = lambda *args: imp.load_source(*args)
import os
def WrapperPath():
return os.path.join(os.path.dirname(__file__), 'repo')
_wrapper_module = None
def... |
"""
========================= IMAGE LINKS =================================
Turns paragraphs like
<~~~~~~~~~~~~~~~~~~~~~~~~
dir/subdir
dir/subdir
dir/subdir
~~~~~~~~~~~~~~
dir/subdir
dir/subdir
dir/subdir
~~~~~~~~~~~~~~~~~~~>
Into mini-photo galleries.
"""
import re, markdown
import url_manager
IMAGE_LINK = """... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'BadgeAssertion'
db.create_table('certificates_badgeassert... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
from mock import ANY
from ansible.module_utils.network.fortios.fortios import FortiOSHandler
try:
from ansible.modules.network.fortios import fortios_router_prefix_list6
except ImportError:
... |
#!/usr/bin/env python
'''
Run this script inside of src/ and it will look for all the files
that were changed this year that still have the last year in the
copyright headers, and it will fix the headers on that file using
a perl regex one liner.
For example: if it finds something like this and we're in 2014
// Copyr... |
import os
import calendar
import datetime
import logging
from primitives import *
from constants import *
from helpers import OrderedAttrDict, utc
"""
The AS types and their FLV representations.
"""
log = logging.getLogger('flvlib.astypes')
class MalformedFLV(Exception):
pass
# Number
def get_number(f, max_... |
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.utm_utils import UTM, UTMModule
from ansible.module_utils._text import to_native
def main(... |
from m5.params import *
from m5.SimObject import SimObject
class BasicRouter(SimObject):
type = 'BasicRouter'
router_id = Param.Int("ID in relation to other routers") |
"""
Reusable mixins for XBlocks and/or XModules
"""
from xblock.fields import Scope, String, XBlockMixin
# Make '_' a no-op so we can scrape strings. Using lambda instead of
# `django.utils.translation.ugettext_noop` because Django cannot be imported in this file
_ = lambda text: text
class LicenseMixin(XBlockMixin... |
import xml.etree.ElementTree as ET
import collections
from pathlib import Path
import os
FunctionData = collections.namedtuple(
'FunctionData', ['name', 'refid', 'brief', 'argsstring', 'definition', 'params', 'returns', 'seealso'])
SymbolData = collections.namedtuple('SymbolData', ['name', 'brief'])
def xml_t... |
import json
import logging
import time
from superset.models.core import Dashboard
from superset.utils.core import decode_dashboards
def import_dashboards(session, data_stream, import_time=None):
"""Imports dashboards from a stream to databases"""
current_tt = int(time.time())
import_time = current_tt if ... |
import time
from gnuradio import gr, gr_unittest, digital, blocks
import pmt
class qa_header_payload_demux (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
def tearDown (self):
self.tb = None
def test_001_t (self):
""" Simplest possible test: put in zeros, the... |
from ironic.common import exception
from ironic.common.i18n import _
from ironic.common.i18n import _LW
from ironic.drivers import base
from ironic.openstack.common import log as logging
LOG = logging.getLogger(__name__)
def _raise_unsupported_error(method=None):
if method:
raise exception.UnsupportedDr... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class product(osv.osv):
_inherit = 'product.product'
_columns = {
'event_ok': fields.boolean('Event Subscription', help='Determine if a product needs to create automatically an event registration at the confirmation of a sales or... |
import argparse
import collections
import os
import sys
from landscape_api.base import API, HTTPError
try:
import json
except ImportError:
import simplejson as json
_key = 'landscape'
class EnvironmentConfig(object):
uri = os.getenv('LANDSCAPE_API_URI')
access_key = os.getenv('LANDSCAPE_API_KEY')
... |
# -*- coding: utf-8 -*-
import json
from openerp import SUPERUSER_ID
from openerp.addons.web import http
from openerp.addons.web.http import request
class google_map(http.Controller):
'''
This class generates on-the-fly partner maps that can be reused in every
website page. To do so, just use an ``<ifram... |
from pyemma.datasets import get_umbrella_sampling_data
from pyemma.datasets import get_multi_temperature_data
from pyemma.thermo import estimate_umbrella_sampling
from pyemma.thermo import estimate_multi_temperature
from numpy.testing import assert_allclose
import unittest
def test_umbrella_sampling_data():
req_k... |
from openstack.tests.functional import base
class TestAutoAllocatedTopology(base.BaseFunctionalTest):
NETWORK_NAME = 'auto_allocated_network'
NETWORK_ID = None
PROJECT_ID = None
def setUp(self):
super(TestAutoAllocatedTopology, self).setUp()
projects = [o.project_id for o in self.con... |
from app.config import db_sql
from app.models import Detalle_registro, Registro, Lugar, Computadora
def get_lugares_activos(id_user):
lugar_activo = db_sql.session.query(
Lugar.nombre, Lugar.id, Registro.fecha_hora_entrada
).join(
Registro
).filter(
(Registro.id... |
import argparse
import io
import struct
import json
import random
import numpy as np
import itertools
import math
import sys
def GetGaussInt(a, b):
value = random.gauss((a+b)/2, (b-a)/4)
while int(value) < a or int(value) > b:
value = random.gauss((a+b)/2, (b-a)/2)
return int(value)
def header()... |
"""
Tests for open ended grading interfaces
./manage.py lms --settings test test lms/djangoapps/open_ended_grading
"""
import json
from mock import MagicMock, patch, Mock
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Group, User
from django.conf import settings
from mitxmako.sho... |
#!python3
# -*- coding:utf-8 -*-
import os
import sys
import time
import ctypes
import shutil
import subprocess
IsPy3 = sys.version_info[0] >= 3
if IsPy3:
import winreg
else:
import codecs
import _winreg as winreg
BuildType = 'Release'
IsRebuild = True
Build = 'Rebuild'
Update = False
Copy = False
CleanAl... |
"""argvemulator - create sys.argv from OSA events. Used by applets that
want unix-style arguments.
"""
from warnings import warnpy3k
warnpy3k("In 3.x, the argvemulator module is removed.", stacklevel=2)
import sys
import traceback
from Carbon import AE
from Carbon.AppleEvents import *
from Carbon import Evt
from Carb... |
"""
SQLAlchemy models for service broker data
"""
from oslo_db.sqlalchemy import models
import sqlalchemy as sa
from sqlalchemy.ext import declarative
class _ServiceBrokerBase(models.ModelBase):
pass
Base = declarative.declarative_base(cls=_ServiceBrokerBase)
class CFOrganization(Base):
__tablename__ = "c... |
""" Classes from base modified to ease testing. """
from accumulate.sim.base import Trials
class SelectTrials(Trials):
""" Experiment on a set of select trials whose modeled results should be
intuitive or otherwise easy to analyze for correctness and consistency. """
def __init__(self, l):
... |
"""
simplified test for continulet without checking for partial writes
to enable continulets you only need to call uwsgi_pypy_setup_continulets() soon after startup:
uwsgi --pypy-wsgi-file t/pypy/t_continulet1.py --http-socket :9090 --pypy-home /opt/pypy --pypy-eval "uwsgi_pypy_setup_continulets()" --async 8
"""
imp... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}
# import cloudstack common
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.cloudstack import (
AnsibleCloudStack,
cs_required_togeth... |
#!/usr/bin/env python3
# Find errors in Postfix log SQLite DB
import re
import sys
from collections import defaultdict
from sqlite3 import connect
class PostfixSearch(object):
"""
"""
def __init__(self):
self._sql = None
def load_db(self, dbpath):
self._sql = connect(dbpath)
d... |
import re
from rope.base import (exceptions, pynames, resourceobserver,
taskhandle, pyobjects, builtins, resources)
from rope.refactor import importutils
class AutoImport(object):
"""A class for finding the module that provides a name
This class maintains a cache of global names in p... |
"""
Some fluids that are part of CoolProp 4 or another
software and that have to be reimplemented for
CoolProp 5.
The most famous one is probably the aqueous Lithium
bromide solution. This one is going to be transferred
from the equations from the publication to the standard
parameter form.
"""
from __future__ import... |
import build_server
build_server.main()
import json
import optparse
import os
import posixpath
import sys
import time
import unittest
from branch_utility import BranchUtility
from chroot_file_system import ChrootFileSystem
from extensions_paths import (
CONTENT_PROVIDERS, CHROME_EXTENSIONS, PUBLIC_TEMPLATES)
from... |
def get_sheet_from_doc(document, index=None, name=None):
""" Returns a sheet object for a Spreadsheet document
Keyword arguments:
index -- the 0-based index of the sheet (may not be used together with name)
name -- the name of the sheet (may not be used together with index)
"""
return document.... |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... |
from __future__ import print_function
import unittest
import paddle.fluid.core as core
from paddle.fluid.op import Operator
class TestFakeInitOpSelectedRows(unittest.TestCase):
def check_with_place(self, place, is_selected_rows):
scope = core.Scope()
out_var_name = 'Out'
if is_selected_... |
try:
from collections import OrderedDict # Python 2.7
except ImportError:
from ordereddict import OrderedDict # Python 2.6
import re
import urllib2 as urllib
class ConfigurationSettingsType(type):
""" Metaclass for constructing ConfigurationSettings classes.
Instances of the ConfigurationSettingsT... |
"""A manager to handle when cursors are killed after they are closed.
New cursor managers should be defined as subclasses of CursorManager and can be
installed on a client by calling
:meth:`~pymongo.mongo_client.MongoClient.set_cursor_manager`.
.. versionchanged:: 3.0
Undeprecated. :meth:`~pymongo.cursor_manager.C... |
# coding=utf-8
"""Geonode uploader."""
from requests.compat import urljoin
from qgis.core import QgsProject
from qgis.PyQt.QtWidgets import QDialog, QDialogButtonBox
from qgis.PyQt.QtGui import QIcon
from safe.common.exceptions import GeoNodeLayerUploadError
from safe.gui.gui_utilities import layer_from_combo
from... |
"""Base classes for all estimators."""
# License: BSD 3 clause
import copy
import warnings
import numpy as np
from scipy import sparse
from .externals import six
from .utils.fixes import signature
from .utils.deprecation import deprecated
from .exceptions import ChangedBehaviorWarning as _ChangedBehaviorWarning
@d... |
#!/usr/bin/env python
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__))))
from test.helper import try_rm
from youtube_dl import YoutubeDL
def _download_restricted(url, filename, age):
... |
from django.conf.urls import patterns, url
from readthedocs.projects.views.public import ProjectIndex, ProjectDetailView
from readthedocs.builds import views as build_views
from readthedocs.constants import pattern_opts
urlpatterns = patterns(
# base view, flake8 complains if it is on the previous line.
'',
... |
from BaseHTTPServer import BaseHTTPRequestHandler
from BaseHTTPServer import HTTPServer
import json
from multiprocessing import Process, Value
import psutil
import time
from itertools import izip, tee
def pairwise(iterable):
a, b = tee(iterable)
next(b, None)
return izip(a, b)
def UpdateStats(cpu, memory, net_... |
"""
Support for Snips on-device ASR and NLU.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/snips/
"""
import asyncio
import json
import logging
import voluptuous as vol
from homeassistant.helpers import intent, config_validation as cv
DOMAIN = 'snips'... |
"""The main samba-tool command implementation."""
from samba import getopt as options
from samba.netcmd import SuperCommand
from samba.netcmd.dbcheck import cmd_dbcheck
from samba.netcmd.delegation import cmd_delegation
from samba.netcmd.dns import cmd_dns
from samba.netcmd.domain import cmd_domain
from samba.netcmd.... |
"""Pyshgp setup file."""
import os
from setuptools import setup, find_packages
exec(open("pyshgp/__init__.py").read())
def read(fname):
"""Read a file to a string."""
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="pyshgp",
version=__version__,
description="Push... |
# -*- coding: utf-8 -*-
from django.test.utils import override_settings
from django.contrib.auth import get_user_model
from cms.tests.test_menu_page_viewperm import ViewPermissionTests
__all__ = [
'ViewPermissionComplexMenuStaffNodeTests',
]
@override_settings(
CMS_PERMISSION=True,
CMS_PUBLIC_FOR='staff... |
"""Tensor Handle Operations.
See the [Session Ops](https://tensorflow.org/api_guides/python/session_ops)
guide.
"""
# pylint: disable=g-bad-name
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.core.framework import resou... |
import sqlalchemy as sa
from neutron.db import db_base_plugin_v2
from neutron.db import l3_db
from neutron.extensions import l3
from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
EXTERNAL_GW_INFO = l3.EXTERNAL_GW_INFO
# Modify the Router Data Model adding the enable_snat attribute... |
from twisted.trial import unittest
from twisted.python import util
from twisted.python.runtime import platformType
import os.path, sys
import shutil, errno
class UtilTestCase(unittest.TestCase):
def testUniq(self):
l = ["a", 1, "ab", "a", 3, 4, 1, 2, 2, 4, 6]
self.assertEquals(util.uniquify(l), [... |
#!/usr/bin/env python
from optparse import OptionParser
import h5py
import numpy as np
import dna_io
################################################################################
# hdf5_fasta.py
#
# Extract the FASTA sequences from an HDF5 file.
####################################################################... |
__all__ = ['Flags']
__version__ = 0.1
import sys
class Flag(object):
def __init__(self, flag, help, value, opt, coll):
self.flag = flag
self.help = help
self.value = value
self.opt = opt
self.coll = coll
class Positional(object):
def __init__(self, name, help, opt, col... |
"""distutils.command.install_data
Implements the Distutils 'install_data' command, for installing
platform-independent data files."""
# contributed by Bastian Kleineidam
# This module should be kept compatible with Python 2.1.
__revision__ = "$Id: install_data.py 37828 2004-11-10 22:23:15Z loewis $"
import os
from... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from six import PY2, PY3, StringIO, string_types, text_type, integer_types
from six.moves import filter, map, range
from dateutil.tz import tzical
from arrow.arrow import Arrow
import arrow
import copy
import colle... |
from openerp.osv import fields, osv
class fetchmail_config_settings(osv.osv_memory):
""" This wizard can be inherited in conjunction with 'res.config.settings', in order to
define fields that configure a fetchmail server.
It relies on the following convention on the object::
class my_... |
import importlib
import json
import jwt
import time
import uuid
from collections import namedtuple
from contextlib import closing
from hyper import HTTP20Connection
from .exceptions import (
InternalException,
ImproperlyConfigured,
PayloadTooLarge,
BadDeviceToken,
PartialBulkMessage,
BadTopic,... |
'''commands to sign and verify changesets'''
import os, tempfile, binascii
from mercurial import util, commands, match, cmdutil
from mercurial import node as hgnode
from mercurial.i18n import _
cmdtable = {}
command = cmdutil.command(cmdtable)
testedwith = 'internal'
class gpg(object):
def __init__(self, path, k... |
from spack import *
class RProto(RPackage):
"""An object oriented system using object-based, also called
prototype-based, rather than class-based object oriented ideas."""
homepage = "http://r-proto.googlecode.com/"
url = "https://cran.r-project.org/src/contrib/proto_0.3-10.tar.gz"
version(... |
import os
import sys
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../")
sys.path.insert(0, path)
import unittest
import numpy as np
from pyspark.ml import Pipeline
from pyspark.ml.feature import HashingTF, Tokenizer
from pyspark.sql import SparkSession
from sklearn import datasets, metrics, neigh... |
from __future__ import absolute_import, unicode_literals
from django.template import Context, RequestContext, Template, engines
from django.test import TestCase
from wagtail.tests.testapp.models import TestSetting
from wagtail.tests.utils import WagtailTestUtils
from wagtail.wagtailcore.models import Page, Site
cla... |
"""Exposes the immutable `dictproxy` type to all (?) versions of Python.
Should work in 2.3+, 3.0+. Actually tried on 2.6, 2.7, 3.2, 3.3, and PyPy 2.1.
Usage is easy:
from dictproxyhack import dictproxy
myproxy = dictproxy(dict(foo="bar"))
print(myproxy['foo'])
myproxy['baz'] = "quux" # TypeError
d... |
from base import Base
#AUTHORIZATION
from role import Role
from realm import Realm
from user_principal import UserPrincipal
#LOCATION
from location import Location
from company import Company
from hub import Hub
from continent import Continent
from country import Country
from city import City
from building import Bui... |
import Framework
import datetime
class PullRequestComment(Framework.TestCase):
def setUp(self):
Framework.TestCase.setUp(self)
self.comment = self.g.get_user().get_repo("PyGithub").get_pull(31).get_comment(886298)
def testAttributes(self):
self.assertEqual(self.comment.body, "Comment... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.