repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
Proggie02/TestRepo | tests/modeltests/model_forms/models.py | """
XX. Generating HTML forms from models
This is mostly just a reworking of the ``form_for_model``/``form_for_instance``
tests to use ``ModelForm``. As such, the text may not make sense in all cases,
and the examples are probably a poor fit for the ``ModelForm`` syntax. In other
words, most of these tests should be r... |
rs2/pandas | pandas/tests/frame/methods/test_round.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Series,
date_range,
)
import pandas._testing as tm
class TestDataFrameRound:
def test_round(self):
# GH#2665
# Test that rounding an empty DataFrame does nothing
df = DataFrame()
tm.a... |
nistormihai/superdesk-core | apps/apps_tests.py | """Preference_Tests Class"""
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/su... |
pombredanne/pants | contrib/scrooge/tests/python/pants_test/contrib/scrooge/tasks/test_thrift_linter.py | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from mock import Moc... |
vthorsteinsson/tensor2tensor | tensor2tensor/data_generators/stanford_nli.py | # coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
alex-dow/pybuilder | src/integrationtest/python/should_raise_exception_when_no_default_goal_is_given_tests.py | # -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2015 PyBuilder Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... |
yongshengwang/builthue | desktop/core/src/desktop/log/formatter.py | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
lukecwik/incubator-beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/latest_test.py | # coding=utf-8
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License");... |
tboyce021/home-assistant | homeassistant/components/owntracks/messages.py | """OwnTracks Message handlers."""
import json
import logging
from nacl.encoding import Base64Encoder
from nacl.secret import SecretBox
from homeassistant.components import zone as zone_comp
from homeassistant.components.device_tracker import (
SOURCE_TYPE_BLUETOOTH_LE,
SOURCE_TYPE_GPS,
)
from homeassistant.co... |
youtube/cobalt | third_party/skia_next/third_party/skia/infra/bots/recipe_modules/builder_name_schema/api.py | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0201
from recipe_engine import recipe_api
from . import builder_name_schema
class BuilderNameSchemaApi(recipe_api.RecipeApi):
def ... |
ULHPC/modules | easybuild/easybuild-easyblocks/easybuild/easyblocks/c/clang.py | ##
# Copyright 2013 Dmitri Gribenko
#
# This file is triple-licensed under GPLv2 (see below), MIT, and
# BSD three-clause licenses.
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemi... |
ismailsunni/inasafe | safe_extras/raven/base.py | """
raven.base
~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import zlib
import logging
import os
import sys
import time
import uuid
import warnings
from datetime import datetime
from ins... |
adobe-flash/avmplus | build/buildbot/master/sandbox.py | # -*- python -*-
# ex: set syntax=python:
# 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/.
from buildbot.process import factory
from buildbot.steps.source import Merc... |
martin-flaska/dleyna-server | test/dbus/download_sync_controller.py | # download_sync_controller
#
# Copyright (C) 2012-2013 Intel Corporation. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU Lesser General Public License,
# version 2.1, as published by the Free Software Foundation.
#
# This prog... |
Chuban/moose | gui/gui/ParamTable.py | #!/usr/bin/python
try:
from PyQt4 import QtCore, QtGui
QtCore.Signal = QtCore.pyqtSignal
QtCore.Slot = QtCore.pyqtSlot
except ImportError:
try:
from PySide import QtCore, QtGui
QtCore.QString = str
except ImportError:
raise ImportError("Cannot load either PyQt or PySide")
f... |
barnsnake351/neutron | neutron/tests/unit/agent/dhcp/test_agent.py | # Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
pombredanne/bokeh | bokeh/util/callback_manager.py | ''' Provides ``CallbackManager`` mixin class for adding an ``on_change``
callback interface to classes.
'''
from __future__ import absolute_import
from functools import partial
from inspect import formatargspec, getargspec, isfunction, ismethod
from types import FunctionType
def _callback_argspec(callback):
'''Bo... |
ntuecon/server | pyenv/Lib/site-packages/attr/validators.py | """
Commonly useful validators.
"""
from __future__ import absolute_import, division, print_function
from ._make import attr, attributes
@attributes(repr=False, slots=True)
class _InstanceOfValidator(object):
type = attr()
def __call__(self, inst, attr, value):
"""
We use a callable class t... |
justinslee/Wai-Not-Makahiki | makahiki/apps/widgets/resource_goal/management/commands/update_water_baseline.py | """Invocation: python manage.py update_water_baseline
update the daily baseline."""
import datetime
from apps.widgets.resource_goal import resource_goal
from apps.managers.challenge_mgr.challenge_mgr import MakahikiBaseCommand
class Command(MakahikiBaseCommand):
"""command"""
help = 'Update water baseline ... |
kernevil/openchange | python/openchange/tests/test_provision.py | #!/usr/bin/python
# OpenChange provisioning
# Copyright (C) Jelmer Vernooij <jelmer@openchange.org> 2009
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# ... |
yanchen036/tensorflow | tensorflow/contrib/autograph/pyct/static_analysis/annos.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
jdunck/google-visualization-python | gviz_api.py | #!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
staslev/incubator-beam | sdks/python/apache_beam/examples/complete/estimate_pi_test.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
Chaparqanatoos/kaggle-knowledge | src/main/python/logistic_sgd.py | """
This tutorial introduces logistic regression using Theano and stochastic
gradient descent.
Logistic regression is a probabilistic, linear classifier. It is parametrized
by a weight matrix :math:`W` and a bias vector :math:`b`. Classification is
done by projecting data points onto a set of hyperplanes, the distance... |
unnikrishnankgs/va | venv/lib/python3.5/site-packages/IPython/frontend.py | """
Shim to maintain backwards compatibility with old frontend imports.
We have moved all contents of the old `frontend` subpackage into top-level
subpackages (`html`, `qt` and `terminal`), and flattened the notebook into
just `IPython.html`, formerly `IPython.frontend.html.notebook`.
This will let code that was maki... |
macmanes/trinityrnaseq | util/eXpress_util/filter_contigs.py | #!/usr/bin/env python
# filter_contigs.py
# June 2012 Matthew MacManes (macmanes@gmail.com)
#
# This wrapper is free software: you can redistribute it and/or modify
#
import sys
import subprocess
import optparse
import shutil
import os
from datetime import datetime, date, time
from Bio import SeqIO
print ... |
Lekensteyn/buildbot | master/buildbot/test/unit/test_util_ssl.py | # This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
zainabg/NOX | src/nox/lib/packet/lldp.py | # Copyright 2008 (C) Nicira, Inc.
#
# This file is part of NOX.
#
# NOX is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# NOX is d... |
Achint08/open-event-orga-server | migrations/versions/01b6969ef4e5_.py | """empty message
Revision ID: 01b6969ef4e5
Revises: ffbb4d4dad39
Create Date: 2016-06-29 15:43:56.161000
"""
# revision identifiers, used by Alembic.
revision = '01b6969ef4e5'
down_revision = 'ffbb4d4dad39'
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
def upgrade():
### commands auto... |
jia200x/RIOT | tests/gnrc_dhcpv6_client/tests-with-config/01-run.py | #!/usr/bin/env python3
# Copyright (C) 2018 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testrunner import run
from ipaddress import (
IPv6Address,
... |
bathepawan/workload-automation | wlauto/external/louie/dispatcher.py | """Multiple-producer-multiple-consumer signal-dispatching.
``dispatcher`` is the core of Louie, providing the primary API and the
core logic for the system.
Internal attributes:
- ``WEAKREF_TYPES``: Tuple of types/classes which represent weak
references to receivers, and thus must be dereferenced on retrieval
to... |
tongwang01/tensorflow | tensorflow/python/training/proximal_adagrad_test.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
sgiavasis/nipype | nipype/interfaces/ants/tests/test_spec_JointFusion.py | from __future__ import division
from builtins import range
from nipype.testing import assert_equal, assert_raises, example_data
from nipype.interfaces.base import InputMultiPath
from traits.trait_errors import TraitError
from nipype.interfaces.ants import JointFusion
def test_JointFusion_dimension():
at = JointFu... |
abaumhauer/onie | contrib/oce/modules/atftp.py |
DEFAULT_CONF_FILENAME = None
DEFAULT_DIRS = ['logs', 'tftp-root']
DEFAULT_CMD_BINARY = 'atftpd'
DEFAULT_CMD_USER = 'nobody'
DEFAULT_CMD_GROUP = 'nogroup'
DEFAULT_CMD_TEMPLATE = \
'''
touch {{ log_file }}
sudo chown {{ user }}:{{ group }} {{ log_file }}
chmod 777 {{ tftp_root }}
sudo {{ binary }} {{ options }} {{ tftp_... |
ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/block_device.py | # Copyright 2011 Isaku Yamahata <yamahata@valinux co jp>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... |
QuLogic/iris | docs/iris/example_tests/test_COP_maps.py | # (C) British Crown Copyright 2010 - 2016, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... |
rubikloud/gpdb | gpMgmt/bin/gppylib/programs/test/unit/test_cluster_clsrecoversegment.py | #!/usr/bin/env python
import os
import unittest2 as unittest
from gppylib import gparray
from gppylib.commands.base import CommandResult
from gppylib.mainUtils import ExceptionNoStackTraceNeeded
from gppylib.programs.clsRecoverSegment import GpRecoverSegmentProgram
from mock import MagicMock, Mock, mock_open, patch
... |
discoproject/disco | lib/disco/worker/task_io.py | """
:mod:`disco.worker.task_io` -- I/O Utility functions for Disco tasks
=====================================================================
"""
from disco import util
from disco.error import DataError
from disco.compat import bytes_to_str, str_to_bytes, UnpicklingError
def gzip_reader(fd, size, url, params):
... |
TDAbboud/micropython | drivers/display/ssd1306.py | # MicroPython SSD1306 OLED driver, I2C and SPI interfaces
from micropython import const
import time
import framebuf
# register definitions
SET_CONTRAST = const(0x81)
SET_ENTIRE_ON = const(0xa4)
SET_NORM_INV = const(0xa6)
SET_DISP = const(0xae)
SET_MEM_ADDR = const(0x20)
SET_COL_... |
912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/db/migrations/operations/special.py | from __future__ import unicode_literals
from .base import Operation
class SeparateDatabaseAndState(Operation):
"""
Takes two lists of operations - ones that will be used for the database,
and ones that will be used for the state change. This allows operations
that don't support state change to have i... |
ahmedaljazzar/edx-platform | common/djangoapps/third_party_auth/management/commands/tests/test_saml.py | """
Tests for `saml` management command, this command fetches saml metadata from providers and updates
existing data accordingly.
"""
import unittest
import os
import mock
from django.test import TestCase
from django.core.management import call_command
from django.core.management.base import CommandError
from django.c... |
rhdedgar/openshift-tools | openshift/installer/vendored/openshift-ansible-3.5.91/roles/lib_openshift/library/oc_serviceaccount_secret.py | #!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... |
bitcrystal/buildtools-BaseTools | Source/Python/Eot/CLexer.py | # $ANTLR 3.0.1 C.g 2010-02-23 09:58:53
from antlr3 import *
from antlr3.compat import set, frozenset
## @file
# The file defines the Lexer for C source files.
#
# THIS FILE IS AUTO-GENENERATED. PLEASE DON NOT MODIFY THIS FILE.
# This file is generated by running:
# java org.antlr.Too... |
simongibbons/numpy | numpy/core/tests/test_scalarbuffer.py | """
Test scalar buffer interface adheres to PEP 3118
"""
import numpy as np
from numpy.core._rational_tests import rational
from numpy.core._multiarray_tests import get_buffer_info
import pytest
from numpy.testing import assert_, assert_equal, assert_raises
# PEP3118 format strings for native (standard alignment and ... |
jmartinm/invenio | modules/miscutil/lib/dbquery.py | ## This file is part of Invenio.
## Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 CERN.
##
## Invenio 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... |
sivel/ansible-modules-core | network/nxos/nxos_ntp_auth.py | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... |
nburn42/tensorflow | tensorflow/contrib/constrained_optimization/python/external_regret_optimizer.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
afrolov1/nova | nova/tests/api/openstack/compute/contrib/test_hosts.py | # Copyright (c) 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
oldmantaiter/disco | lib/setup.py | #!/usr/bin/env python
import os
from distutils.core import setup
def ispackage(path):
return os.path.isdir(path) and '__init__.py' in os.listdir(path)
def packages(dirpath):
for name in os.listdir(dirpath):
path = os.path.join(dirpath, name)
if ispackage(path):
yield name
... |
nanobox-io/nanobox-pkgsrc-base | nodejs9/patches/patch-tools_install.py | $NetBSD$
--- tools/install.py.orig 2016-08-26 15:27:23.000000000 +0000
+++ tools/install.py
@@ -98,6 +98,37 @@ def npm_files(action):
else:
assert(0) # unhandled action type
+def yarn_files(action):
+ target_path = 'lib/node_modules/yarn/'
+
+ # don't install npm if the target path is a symlink, it probabl... |
crepererum/invenio | invenio/modules/documents/recordext/functions/get_record_documents.py | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014 CERN.
#
# Invenio 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... |
rbramwell/pulp | server/test/unit/server/agent/direct/test_services.py | from unittest import TestCase
from mock import patch, Mock
from gofer.messaging.model import Document
from gofer.rmi.async import Accepted, Rejected, Started, Succeeded, Failed, Progress
from pulp.common import constants
from pulp.server.agent.direct.services import Services, ReplyHandler
messaging = {
'url': '... |
kennethd/moto | moto/ec2/responses/virtual_private_gateways.py | from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from moto.ec2.utils import filters_from_querystring
class VirtualPrivateGateways(BaseResponse):
def attach_vpn_gateway(self):
vpn_gateway_id = self.querystring.get('VpnGatewayId')[0]
vpc_id = self.querystring.get(... |
OriHoch/Open-Knesset | video/management/commands/sub_commands/UpdateMembersRelatedVideos.py | # encoding: utf-8
from video.management.commands.sub_commands import SubCommand
from video.utils.youtube import GetYoutubeVideos
from mks.models import Member
from video.utils.parse_dict import validate_dict
from video.utils import get_videos_queryset
from video.models import Video
class UpdateMembersRelatedVideos(Su... |
astaninger/speakout | venv/lib/python3.6/site-packages/click/_compat.py | import re
import io
import os
import sys
import codecs
from weakref import WeakKeyDictionary
PY2 = sys.version_info[0] == 2
CYGWIN = sys.platform.startswith('cygwin')
# Determine local App Engine environment, per Google's own suggestion
APP_ENGINE = ('APPENGINE_RUNTIME' in os.environ and
'Development/' ... |
waseem18/oh-mainline | vendor/packages/django-celery/docs/conf.py | # -*- coding: utf-8 -*-
import sys
import os
# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
sys.path.append(os.path.join(os.pardir, "tests"))
from django.core.management import setup_envi... |
tchellomello/home-assistant | tests/components/mailbox/test_init.py | """The tests for the mailbox component."""
from hashlib import sha1
import pytest
from homeassistant.bootstrap import async_setup_component
import homeassistant.components.mailbox as mailbox
from homeassistant.const import HTTP_INTERNAL_SERVER_ERROR, HTTP_NOT_FOUND
@pytest.fixture
def mock_http_client(hass, hass_cl... |
doselect/django-tastypie | tests/core/tests/commands.py | from django.core.management import call_command
from django.db import models
from django.test import TestCase
from tastypie.compat import get_user_model
from tastypie.models import ApiKey, create_api_key
class BackfillApiKeysTestCase(TestCase):
def setUp(self):
super(BackfillApiKeysTestCase, self).setUp(... |
aurofable/medhack-server | venv/lib/python2.7/site-packages/sqlalchemy/util/__init__.py | # util/__init__.py
# Copyright (C) 2005-2012 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from compat import callable, cmp, reduce, defaultdict, py25_dict, \
threading, py... |
javiplx/cobbler-debian | cobbler/func_utils.py | """
Misc func functions for cobbler
Copyright 2006-2008, Red Hat, Inc
Scott Henson <shenson@redhat.com>
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 o... |
uclaros/QGIS | python/console/console_settings.py | # -*- coding:utf-8 -*-
"""
/***************************************************************************
Python Console for QGIS
-------------------
begin : 2012-09-10
copyright : (C) 2012 by Salvatore Larosa
email : lrssvtml (at) gmail (dot) com
***... |
rolando-contrib/scrapy | scrapy/downloadermiddlewares/httpcompression.py | import zlib
from scrapy.utils.gz import gunzip
from scrapy.http import Response, TextResponse
from scrapy.responsetypes import responsetypes
from scrapy.exceptions import NotConfigured
ACCEPTED_ENCODINGS = [b'gzip', b'deflate']
try:
import brotli
ACCEPTED_ENCODINGS.append(b'br')
except ImportError:
pass... |
jmetzen/scikit-learn | examples/linear_model/plot_bayesian_ridge.py | """
=========================
Bayesian Ridge Regression
=========================
Computes a Bayesian Ridge Regression on a synthetic dataset.
See :ref:`bayesian_ridge_regression` for more information on the regressor.
Compared to the OLS (ordinary least squares) estimator, the coefficient
weights are slightly shift... |
nsoranzo/tools-iuc | tools/calculate_contrast_threshold/calculate_contrast_threshold.py | #!/usr/bin/python
import getopt
import math
import sys
import numpy as np
"""
Program to calculate the contrast thresholds for heatmap from tagPileUp CDT
"""
def rebin(a, new_shape):
M, N = a.shape
m, n = new_shape
if m >= M:
# repeat rows in data matrix
a = np.repeat(a, math.ceil(float... |
jbonofre/beam | sdks/python/apache_beam/error.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/djkombu/managers.py | # Partially stolen from Django Queue Service
# (http://code.google.com/p/django-queue-service)
from django.db import transaction, connection, models
try:
from django.db import connections, router
except ImportError: # pre-Django 1.2
connections = router = None
class QueueManager(models.Manager):
def pub... |
Epidilius/laikaboss | laikaboss/modules/explode_rar.py | # Copyright 2015 Lockheed Martin Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
pblottiere/QGIS | tests/src/python/test_qgsprojectmetadata.py | # -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsProjectMetadata.
Run with: ctest -V -R PyQgsProjectMetadata
.. note:: 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 Licens... |
KyleJamesWalker/ansible | lib/ansible/errors/__init__.py | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
gptech/ansible | lib/ansible/modules/network/junos/_junos_template.py | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... |
junhuac/MQUIC | src/build/android/pylib/remote/device/remote_device_environment.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Environment setup and teardown for remote devices."""
import distutils.version
import json
import logging
import os
import random
import sys
from devil.... |
azaghal/ansible | lib/ansible/galaxy/login.py | ########################################################################
#
# (C) 2015, Chris Houseknecht <chouse@ansible.com>
#
# This file is part of Ansible
#
# Ansible 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 Fo... |
vileopratama/vitech | src/addons/mail/models/mail_mail.py | # -*- coding: utf-8 -*-
import base64
import logging
from email.utils import formataddr
import psycopg2
from openerp import _, api, fields, models
from openerp import tools
from openerp.addons.base.ir.ir_mail_server import MailDeliveryException
from openerp.tools.safe_eval import safe_eval as eval
_logger = logging... |
grimmjow8/ansible | lib/ansible/modules/network/ovs/openvswitch_port.py | #!/usr/bin/python
#coding: utf-8 -*-
# pylint: disable=C0111
# (c) 2013, David Stygstra <david.stygstra@gmail.com>
#
# Portions copyright @ 2015 VMware, Inc.
#
# This file is part of Ansible
#
# This module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... |
hryamzik/ansible | test/units/modules/network/f5/test_bigip_trunk.py | # -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
from nose.plugins.skip i... |
ryfeus/lambda-packs | pytorch/source/numpy/distutils/fcompiler/compaq.py |
#http://www.compaq.com/fortran/docs/
from __future__ import division, absolute_import, print_function
import os
import sys
from numpy.distutils.fcompiler import FCompiler
from numpy.distutils.compat import get_exception
from distutils.errors import DistutilsPlatformError
compilers = ['CompaqFCompiler']
if os.name !... |
mzp/iTerm2 | tests/esctest/tests/da.py | import escargs
import esccmd
import escio
from escutil import AssertEQ, knownBug
class DATests(object):
@knownBug(terminal="xterm", reason="xterm double-reports 6.")
@knownBug(terminal="iTerm2", reason="iTerm2 doesn't report 18 or 22.")
def handleDAResponse(self):
params = escio.ReadCSI('c', expected_prefix=... |
0x7678/youtube-dl | youtube_dl/extractor/vice.py | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from .ooyala import OoyalaIE
from ..utils import ExtractorError
class ViceIE(InfoExtractor):
_VALID_URL = r'http://www\.vice\.com/.*?/(?P<name>.+)'
_TEST = {
'url': 'http://www.vice.com/Fringes/cowboy-capitalists-par... |
newkek/incubator-tinkerpop | gremlin-python/src/main/jython/tests/structure/io/__init__.py | '''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... |
Hons/troposphere | examples/Route53_A.py | # Converted from Route53_A.template located at:
# http://aws.amazon.com/cloudformation/aws-cloudformation-templates/
from troposphere import FindInMap, GetAtt, Join, Output
from troposphere import Parameter, Ref, Template
from troposphere.ec2 import Instance
from troposphere.route53 import RecordSetType
t = Template... |
RPGOne/Skynet | scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/benchmarks/bench_plot_ward.py | """
Benchmark scikit-learn's Ward implement compared to SciPy's
"""
import time
import numpy as np
from scipy.cluster import hierarchy
import pylab as pl
from sklearn.cluster import AgglomerativeClustering
ward = AgglomerativeClustering(n_clusters=3, linkage='ward')
n_samples = np.logspace(.5, 3, 9)
n_features = n... |
vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/desktop/core/ext-py/django-extensions-1.5.0/django_extensions/management/commands/reset_db.py | """
originally from http://www.djangosnippets.org/snippets/828/ by dnordberg
"""
import logging
from optparse import make_option
from django.conf import settings
from django.core.management.base import CommandError, BaseCommand
from six.moves import input, configparser
from django_extensions.management.utils import s... |
hackerbot/DjangoDev | tests/auth_tests/test_models.py | import datetime
from django.contrib.auth import get_user_model
from django.contrib.auth.models import (
AbstractUser, Group, Permission, User, UserManager,
)
from django.contrib.contenttypes.models import ContentType
from django.core import mail
from django.db.models.signals import post_save
from django.test impor... |
alxgu/ansible | lib/ansible/modules/cloud/ovirt/ovirt_quota_facts.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... |
teeple/pns_server | work/install/Python-2.7.4/Lib/test/test_str.py |
import struct
import sys
from test import test_support, string_tests
class StrTest(
string_tests.CommonTest,
string_tests.MixinStrUnicodeUserStringTest,
string_tests.MixinStrUserStringTest,
string_tests.MixinStrUnicodeTest,
):
type2test = str
# We don't need to propagate to str
def ... |
xbmc/atv2 | xbmc/lib/libPython/Python/Demo/tkinter/matt/canvas-mult-item-sel.py | from Tkinter import *
# allows moving dots with multiple selection.
SELECTED_COLOR = "red"
UNSELECTED_COLOR = "blue"
class Test(Frame):
###################################################################
###### Event callbacks for THE CANVAS (not the stuff drawn on it)
###################################... |
leighpauls/k2cro4 | third_party/python_26/Lib/test/test_urllib2_localnet.py | #!/usr/bin/env python
import mimetools
import threading
import urlparse
import urllib2
import BaseHTTPServer
import unittest
import hashlib
from test import test_support
# Loopback http server infrastructure
class LoopbackHttpServer(BaseHTTPServer.HTTPServer):
"""HTTP server w/ a few modifications that make it u... |
c0defreak/python-for-android | python3-alpha/python3-src/Lib/test/test_symtable.py | """
Test the API of the symtable module.
"""
import symtable
import unittest
from test import support
TEST_CODE = """
import sys
glob = 42
class Mine:
instance_var = 24
def a_method(p1, p2):
pass
def spam(a, b, *var, **kw):
global bar
bar = 47
x = 23
glob
def internal():
... |
FNST-OpenStack/horizon | horizon/tabs/views.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
BitWriters/Zenith_project | zango/lib/python3.5/site-packages/django/contrib/gis/geos/error.py | """
This module houses the GEOS exceptions, specifically, GEOSException and
GEOSGeometryIndexError.
"""
class GEOSException(Exception):
"The base GEOS exception, indicates a GEOS-related error."
pass
class GEOSIndexError(GEOSException, KeyError):
"""
This exception is raised when an invalid index ... |
sgerhart/ansible | lib/ansible/modules/cloud/azure/_azure.py | #!/usr/bin/python
#
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['removed... |
garyjyao1/ansible | lib/ansible/modules/core/cloud/docker/docker_image.py | #!/usr/bin/python
#
# (c) 2014, Pavel Antonov <antonov@adwz.ru>
#
# This file is part of Ansible
#
# This module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your ... |
zephyrplugins/zephyr | zephyr.plugin.jython/jython2.5.2rc3/Lib/encodings/mac_croatian.py | """ Python Character Mapping Codec mac_croatian generated from 'MAPPINGS/VENDORS/APPLE/CROATIAN.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,inp... |
npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/tensorboard/plugins/projector/__init__.py | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
teeple/pns_server | work/install/Python-2.7.4/Lib/test/test_slice.py | # tests for slice objects; in particular the indices method.
import unittest
from test import test_support
from cPickle import loads, dumps
import sys
class SliceTest(unittest.TestCase):
def test_constructor(self):
self.assertRaises(TypeError, slice)
self.assertRaises(TypeError, slice, 1, 2, 3, ... |
shinglyu/servo | etc/ci/chaos_monkey_test.py | # Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
#... |
xingyepei/edx-platform | cms/djangoapps/contentstore/views/dev.py | """
Views that are only activated when the project is running in development mode.
These views will NOT be shown on production: trying to access them will result
in a 404 error.
"""
# pylint: disable=unused-argument
from edxmako.shortcuts import render_to_response
from mako.exceptions import TopLevelLookupException
fro... |
nawawi/wkhtmltopdf | webkit/Source/ThirdParty/gyp/test/generator-output/gyptest-top-all.py | #!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies building a project hierarchy created when the --generator-output=
option is used to put the build configuration files in a sepa... |
DONIKAN/django | tests/admin_filters/tests.py | from __future__ import unicode_literals
import datetime
from django.contrib.admin import (
AllValuesFieldListFilter, BooleanFieldListFilter, ModelAdmin,
RelatedOnlyFieldListFilter, SimpleListFilter, site,
)
from django.contrib.admin.views.main import ChangeList
from django.contrib.auth.admin import UserAdmin
... |
Semi-global/edx-platform | common/djangoapps/cache_toolbox/templatetags/cache_toolbox.py | from django import template
from django.core.cache import cache
from django.template import Node, TemplateSyntaxError, Variable
from django.template import resolve_variable
register = template.Library()
class CacheNode(Node):
def __init__(self, nodelist, expire_time, key):
self.nodelist = nodelist
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.