code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python2
from distutils.core import setup
setup(name='python-hivemindrpc',
version='0.1',
description='Enhanced version of python-jsonrpc for use with Hivemind',
long_description=open('README').read(),
author='Jeff Garzik',
author_email='<jgarzik@exmulti.com>',
mainta... | bitcoin-hivemind/hivemind | qa/rpc-tests/python-hivemindrpc/setup.py | Python | mit | 622 |
import unittest
import numpy as np
import six
import chainer
from chainer import cuda
import chainer.functions as F
from chainer import optimizers
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
if cuda.available:
cuda.init()
class LinearModel(object):
UNI... | woodshop/chainer | tests/optimizers_tests/test_optimizers_by_linear_model.py | Python | mit | 4,152 |
# -*- coding: utf-8 -*-
try:
# The 'demandimport' breaks pyflakes and flake8._pyflakes
from mercurial import demandimport
except ImportError:
pass
else:
demandimport.disable()
import os
import pep8
import pyflakes
import pyflakes.checker
def patch_pyflakes():
"""Add error codes to Pyflakes messag... | wdv4758h/flake8 | flake8/_pyflakes.py | Python | mit | 4,605 |
__version_info__ = (2, 4, 2)
__version__ = ".".join(map(str, __version_info__))
| SergeyCherepanov/ansible | ansible/paramiko/_version.py | Python | mit | 80 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | QingChenmsft/azure-cli | src/azure-cli-core/azure/cli/core/parser.py | Python | mit | 9,504 |
# Copyright 2015 Google Inc. 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 applicable law or ag... | Sorsly/subtle | google-cloud-sdk/lib/surface/functions/describe.py | Python | mit | 2,021 |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class InstalledApplication(Document):
pass
| adityahase/frappe | frappe/core/doctype/installed_application/installed_application.py | Python | mit | 278 |
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
fig=plt.figure(figsize=(9, 3))
map = Basemap(width=12000000,height=8000000,
resolution='l',projection='stere',
lat_ts=50,lat_0=50,lon_0=-107.)
lons, lats, x, y = map.makegrid(30, 30, returnxy=True)
ax... | rveciana/BasemapTutorial | code_examples/utilities/makegrid.py | Python | cc0-1.0 | 675 |
"""BitBake Persistent Data Store
Used to store data in a central location such that other threads/tasks can
access them at some future date. Acts as a convenience wrapper around sqlite,
currently, providing a key/value store accessed by 'domain'.
"""
# Copyright (C) 2007 Richard Purdie
# Copyright (C) 2010 ... | sentient-energy/emsw-bitbake-mirror | lib/bb/persist_data.py | Python | gpl-2.0 | 6,609 |
from django.db import models
from django.core.validators import validate_email, validate_slug, validate_ipv46_address
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from ava.core.models import TimeStampedModel
from ava.core_group.models import Group
from ava.core_identi... | cnbird1999/ava | ava/core_identity/models.py | Python | gpl-2.0 | 4,406 |
import math
def square_root ( a ):
"""Computes squar root of a
"""
espilon = 0.1e-11
x = a
while True:
y = ( x + a / x ) / 2.0
if abs( y - x ) < espilon:
return y
x = y
def test_square_root():
"""Compares custom square and math.sqrt.
"""
a = 1.0
... | hacpai/show-me-the-code | Python/0033/main.py | Python | gpl-2.0 | 540 |
import os
import unittest
import mock
from pulp.server.db import connection
class PulpWebservicesTests(unittest.TestCase):
"""
Base class for tests of webservice controllers. This base is used to work around the
authentication tests for each each method
"""
def setUp(self):
connection.in... | beav/pulp | devel/pulp/devel/unit/server/base.py | Python | gpl-2.0 | 2,511 |
""" (disabled by default) support for testing pytest and pytest plugins. """
from __future__ import absolute_import, division, print_function
import codecs
import gc
import os
import platform
import re
import subprocess
import sys
import time
import traceback
from fnmatch import fnmatch
from weakref import WeakKeyDic... | hoehnp/navit_test | lib/python2.7/site-packages/_pytest/pytester.py | Python | gpl-2.0 | 40,423 |
#!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | EpicCM/SPH-D700-Kernel | external/webkit/WebKitTools/pywebsocket/test/test_memorizingfile.py | Python | gpl-2.0 | 2,887 |
'''
ListAdapter
=================
.. versionadded:: 1.5
.. warning::
This code is still experimental, and its API is subject to change in a
future version.
A :class:`ListAdapter` is an adapter around a python list.
Selection operations are a main concern for the class.
From an :class:`Adapter`, a :class:`... | JulienMcJay/eclock | windows/kivy/kivy/adapters/listadapter.py | Python | gpl-2.0 | 17,276 |
"""HTTP related handlers.
Note that some other HTTP handlers live in more specific modules: _auth.py,
_gzip.py, etc.
Copyright 2002-2006 John J Lee <jjl@pobox.com>
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD or ZPL 2.1 licenses (see the file
COPYING.txt included w... | Andrew-Dickinson/FantasyFRC | customMechanize/_googleappengine.py | Python | gpl-2.0 | 26,831 |
from __future__ import print_function
import six.moves.cPickle as pickle
import os
import sys
import theano
from six import iteritems, itervalues
DISPLAY_DUPLICATE_KEYS = False
DISPLAY_MOST_FREQUENT_DUPLICATE_CCODE = False
dirs = []
if len(sys.argv) > 1:
for compiledir in sys.argv[1:]:
dirs.extend([os.p... | valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/misc/check_duplicate_key.py | Python | gpl-2.0 | 2,482 |
# $Id: 126_sdp_with_port_0_and_no_rtpmap_for_dynamic_pt.py 369517 2012-07-01 17:28:57Z file $
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=video 0 RTP/AVP 100
m=audio 5000 RTP/AVP 0
"""
pjsua_args = "--null-audio --auto-answer 200"
extra_headers =... | fluentstream/asterisk-p2p | res/pjproject/tests/pjsua/scripts-sendto/126_sdp_with_port_0_and_no_rtpmap_for_dynamic_pt.py | Python | gpl-2.0 | 659 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | t794104/ansible | lib/ansible/modules/cloud/google/gcp_iam_role.py | Python | gpl-3.0 | 9,028 |
class Token:
"""
Class representing a token.
kind: the kind of token, e.g. filename, number, other
value: specific instance value, e.g. "/tmp/foo.c", or 5
offset: byte offset from start of parse string
"""
def __init__(self, kind, value=None, offset=None):
self.offset = offset
... | rocky/python3-trepan | trepan/processor/parse/tok.py | Python | gpl-3.0 | 1,426 |
# -*- coding: utf-8 -*-
#
# license.py
#
# Выводит окно с текстом лицензии.
#
import os
from kivy.clock import Clock
from kivy.uix.rst import RstDocument
from libs.uix.dialogs import dialog, card
class ShowLicense(object):
def show_license(self, *args):
def choice_language_license(on_language):
... | Dezmonius/Deslium | Deslium Software/Deslium Hestia/master/libs/programclass/show_license.py | Python | gpl-3.0 | 1,705 |
props.bf_Shank_Dia = 5.0
#props.bf_Pitch = 0.8 # Coarse
props.bf_Pitch = 0.5 # Fine
props.bf_Crest_Percent = 10
props.bf_Root_Percent = 10
props.bf_Major_Dia = 5.0
props.bf_Minor_Dia = props.bf_Major_Dia - (1.082532 * props.bf_Pitch)
props.bf_Hex_Head_Flat_Distance = 8.0
props.bf_Hex_Head_Height = 3.5
props.bf_Cap_Hea... | cschenck/blender_sim | fluid_sim_deps/blender-2.69/2.69/scripts/addons/add_mesh_BoltFactory/presets/M5.py | Python | gpl-3.0 | 795 |
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPD... | etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-gadfly.py | Python | gpl-3.0 | 458 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | leki75/ansible | lib/ansible/module_utils/asa.py | Python | gpl-3.0 | 5,158 |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool by AusAid - **Clipper test suite.**
Contact : ole.moller.nielsen@gmail.com
.. 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... | Gustry/inasafe | safe/datastore/test/test_geopackage.py | Python | gpl-3.0 | 5,299 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
# gwindetk.py #
# #
# Part of UMass Amherst's Wind... | kmonsoor/windenergytk | windenergytk/gwindtk.py | Python | gpl-3.0 | 30,991 |
import numpy
def numerov_integration(domain, a, f0, f1):
f = numpy.zeros(len(domain), dtype=numpy.complex)
f[0] = f0
f[1] = f1
step = domain.step
for i in range(2, len(domain)):
phi_i1 = f[i-1] * (2.0 + 5.0 * step**2 * a[i-1] / 6.0)
phi_i2 = f[i-2] * (1.0 - step**2 * a[i-... | frapa/Schr | windows/compy/numerov.py | Python | gpl-3.0 | 414 |
#!/usr/bin/env python
# by Chris Truncer
# Script to attempt to forge a packet that will inject a new value
# for a dns record. Check nessus plugin #35372
# Some great documentation and sample code came from:
# http://bb.secdev.org/scapy/src/46e0b3e619547631d704c133a0247cf4683c0784/scapy/layers/dns.py
import argpar... | ChrisTruncer/PenTestScripts | HostScripts/DNSInject.py | Python | gpl-3.0 | 4,615 |
# Copyright (C) 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
#
# Based on test_handler_set_hostname.py
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# ... | prometheanfire/cloud-init | tests/unittests/test_handler/test_handler_locale.py | Python | gpl-3.0 | 2,046 |
#! /usr/bin/env python
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import * # noqa: F401
'''Runs a full joinmarket pit (using `nirc` miniircd servers,
with `nirc` options specified as an option to pytest),in
bitcoin regtest mode with 3 maker... | undeath/joinmarket-clientserver | test/test_full_coinjoin.py | Python | gpl-3.0 | 6,442 |
#
# Copyright 2013, 2018-2020 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
""" Remove blocks module """
import os
import re
import sys
import glob
import logging
from ..tools import remove_pattern_from_file, CMakeFileEditor, CPPFileEditor, get_bl... | dl1ksv/gnuradio | gr-utils/modtool/core/rm.py | Python | gpl-3.0 | 9,217 |
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from unittest import TestCase
from sklearn.datasets.samples_generator import make_spd_matrix
from sklearn import hmm
from sklearn import mixture
from sklearn.utils.extmath import logsumexp
from sklearn.utils import check_random... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/sklearn/tests/test_hmm.py | Python | agpl-3.0 | 26,383 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, json, copy
from frappe.utils import cstr, flt, getdate
from frappe import _
from frappe.utils.file_manager import save_file
from frappe.... | indictranstech/reciphergroup-erpnext | erpnext/setup/page/setup_wizard/setup_wizard.py | Python | agpl-3.0 | 17,443 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/Users/ckla/Documents/workspace/opus_trunk/opus_gui/main/views/list_editor.ui'
#
# Created: Sun May 10 00:57:43 2009
# by: PyQt4 UI code generator 4.4.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore,... | apdjustino/DRCOG_Urbansim | src/opus_gui/main/views/ui_list_editor.py | Python | agpl-3.0 | 3,680 |
DATE_FORMAT = '%Y-%m-%dT%H:%M:%S+00:00'
| liveblog/liveblog | server/liveblog/tests/test_settings.py | Python | agpl-3.0 | 40 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RPhilentropy(RPackage):
"""Computes 46 optimized distance and similarity measures for comp... | iulian787/spack | var/spack/repos/builtin/packages/r-philentropy/package.py | Python | lgpl-2.1 | 1,356 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Wgsim(Package):
"""Wgsim is a small tool for simulating sequence reads from a reference
... | iulian787/spack | var/spack/repos/builtin/packages/wgsim/package.py | Python | lgpl-2.1 | 1,027 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyUnicycler(PythonPackage):
"""Unicycler is an assembly pipeline for bacterial genomes. It... | iulian787/spack | var/spack/repos/builtin/packages/py-unicycler/package.py | Python | lgpl-2.1 | 1,554 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | lib/spack/spack/schema/mirrors.py | Python | lgpl-2.1 | 1,811 |
{
'name': "Sync POS orders across multiple sessions",
'version': '1.0.0',
'author': 'Ivan Yelizariev',
'category': 'Point Of Sale',
'website': 'https://yelizariev.github.io',
'depends': ['pos_disable_payment', 'bus'],
'data': [
'security/ir.model.access.csv',
'views.xml',
... | odoocn/pos-addons | pos_multi_session/__openerp__.py | Python | lgpl-3.0 | 424 |
#!/usr/bin/env python
import os, sys
import unittest
from gppylib import gplog
from gpsegstart import GpSegStart
from mock import patch
logger = gplog.get_unittest_logger()
class GpSegStartTestCase(unittest.TestCase):
@patch('gpsegstart.GpSegStart.getOverallStatusKeys', return_value=[])
@patch('gpsegstart.g... | Chibin/gpdb | gpMgmt/bin/gppylib/test/unit/test_cluster_gpsegstart.py | Python | apache-2.0 | 1,956 |
# Copyright 2014 Google Inc. 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 applicable law or ag... | KaranToor/MA450 | google-cloud-sdk/lib/surface/compute/instances/set_scheduling.py | Python | apache-2.0 | 2,935 |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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.apa... | rajrohith/blobstore | azure/storage/_http/__init__.py | Python | apache-2.0 | 2,461 |
#!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2015 Microsoft 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
#
# U... | varunkumta/azure-linux-extensions | VMEncryption/main/oscrypto/ubuntu_1604/encryptstates/UnmountOldrootState.py | Python | apache-2.0 | 5,976 |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of t... | tempbottle/ironpython3 | Tests/compat/sbs_exceptions/try_except3.py | Python | apache-2.0 | 904 |
# Lint as: python2, python3
# 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
#
... | mlperf/training_results_v0.7 | Google/benchmarks/transformer/implementations/transformer-research-TF-tpu-v4-16/lingvo/model_imports.py | Python | apache-2.0 | 2,689 |
# 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 u... | mambocab/cassandra | pylib/cqlshlib/cql3handling.py | Python | apache-2.0 | 55,793 |
import json
from collections import OrderedDict
from django import forms
from django.template.loader import get_template
from django.utils.translation import ugettext_lazy as _
from pretix.base.payment import BasePaymentProvider
class BankTransfer(BasePaymentProvider):
identifier = 'banktransfer'
verbose_na... | akuks/pretix | src/pretix/plugins/banktransfer/payment.py | Python | apache-2.0 | 2,341 |
"""Module for testing cursor objects."""
import cx_Oracle
class TestCursor(BaseTestCase):
def testExecuteNoArgs(self):
"""test executing a statement without any arguments"""
result = self.cursor.execute(u"begin null; end;")
self.failUnlessEqual(result, None)
def testExecuteNoStatemen... | jayceyxc/hue | desktop/core/ext-py/cx_Oracle-5.2.1/test/uCursor.py | Python | apache-2.0 | 10,123 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 PLUMgrid, Inc. 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/lic... | subramani95/neutron | neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py | Python | apache-2.0 | 24,717 |
"""deCONZ scene platform tests."""
from copy import deepcopy
from asynctest import patch
from homeassistant.components import deconz
from homeassistant.setup import async_setup_component
import homeassistant.components.scene as scene
from .test_gateway import ENTRY_CONFIG, DECONZ_WEB_REQUEST, setup_deconz_integrati... | joopert/home-assistant | tests/components/deconz/test_scene.py | Python | apache-2.0 | 2,229 |
"""The Hyperion component."""
from __future__ import annotations
import asyncio
from contextlib import suppress
import logging
from typing import Any, Callable, cast
from awesomeversion import AwesomeVersion
from hyperion import client, const as hyperion_const
from homeassistant.components.camera.const import DOMAIN... | sander76/home-assistant | homeassistant/components/hyperion/__init__.py | Python | apache-2.0 | 11,527 |
# Copyright 2019 gRPC 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 law or agreed to in writing... | jboeuf/grpc | examples/python/data_transmission/server.py | Python | apache-2.0 | 4,492 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Pedro Navarro Perez
# Copyright 2013 Cloudbase Solutions Srl
# 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... | zestrada/nova-cs498cc | nova/virt/hyperv/volumeops.py | Python | apache-2.0 | 9,291 |
# -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket Ltd
#
# 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 la... | rzr/synapse | tests/rest/client/v1/utils.py | Python | apache-2.0 | 4,828 |
# Copyright 2018 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import random
# List of configuration experiments for correctness fuzzing.
# List of <probability>, <1st config name>, <2nd config name>, <2nd d8>.
# Prob... | weolar/miniblink49 | v8_7_5/tools/clusterfuzz/v8_fuzz_config.py | Python | apache-2.0 | 1,510 |
# 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 pants_test.pant... | pombredanne/pants | contrib/scrooge/tests/python/pants_test/contrib/scrooge/tasks/test_scrooge_gen_integration.py | Python | apache-2.0 | 2,191 |
# Specify the response and predictor columns
y = "C785"
x = train.names[0:784]
# We encode the response column as categorical for multinomial classification
train[y] = train[y].asfactor()
test[y] = test[y].asfactor()
# Train a Deep Learning model and validate on a test set
model = h2o.deeplearning(x=x,
... | printedheart/h2o-3 | h2o-docs/src/booklets/v2_2015/source/deeplearning/deeplearning_examplerun.py | Python | apache-2.0 | 719 |
# Copyright (c) 2013-2014 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
#
# Un... | shakamunyi/neutron-vrrp | neutron/tests/unit/ml2/test_mechanism_odl.py | Python | apache-2.0 | 9,006 |
# Copyright 2016 Google Inc. 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 applicable law or a... | AlexEKoren/grumpy | testing/try_test.py | Python | apache-2.0 | 3,365 |
"""The Tile component."""
import asyncio
from datetime import timedelta
from pytile import async_login
from pytile.errors import SessionExpiredError, TileError
from homeassistant.const import ATTR_ATTRIBUTION, CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import callback
from homeassistant.helpers import aioht... | tboyce1/home-assistant | homeassistant/components/tile/__init__.py | Python | apache-2.0 | 3,733 |
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016, 2017
class DataAlreadyExistsError(RuntimeError):
def __init__(self, label):
self.message = str("Data with label '%s' already exists and cannot be added" % (label))
def get_patient_id(d):
return d['patient']['identifier']
def get_index_... | IBMStreams/streamsx.health | samples/HealthcareJupyterDemo/package/healthdemo/utils.py | Python | apache-2.0 | 2,562 |
from __future__ import print_function, unicode_literals
core_store_students_programs = False
core_store_students_programs_path = 'files_stored'
core_experiment_poll_time = 350 # seconds
# Ports
core_facade_port = 28345
core_facade_server_route = 'provider1-route'
# Will only work in JSON in this conf... | morelab/weblabdeusto | server/src/test/deployments/federated_basic_sql/provider1/core_config.py | Python | bsd-2-clause | 1,626 |
#!/usr/bin/env python
# -*- Mode: python -*-
# Copyright (c) 2009, Andrew McNabb
"""Implementation of SSH_ASKPASS to get a password to ssh from pssh.
The password is read from the socket specified by the environment variable
PSSH_ASKPASS_SOCKET. The other end of this socket is pssh.
The ssh man page discusses SSH_... | jorik041/parallel-ssh | psshlib/askpass_client.py | Python | bsd-3-clause | 3,462 |
from __future__ import division
import numpy as np
from numpy.testing import assert_almost_equal
import pytest
from acoustics.power import lw_iso3746
@pytest.mark.parametrize("background_noise, expected", [
(79, 91.153934187),
(83, 90.187405234),
(88, 88.153934187),
])
def test_lw_iso3746(background_no... | FRidh/python-acoustics | tests/test_power.py | Python | bsd-3-clause | 637 |
from django import forms as django_forms
from django.core.urlresolvers import reverse
from django.http import Http404
import commonware
import waffle
from rest_framework import exceptions, response, serializers, status, viewsets
from rest_framework.decorators import detail_route
from rest_framework.response import Res... | ingenioustechie/zamboni | mkt/webapps/views.py | Python | bsd-3-clause | 7,946 |
"""
Easy-to-use UMFPACK interface
=============================
.. currentmodule:: scikits.umfpack
The following functions can be used for LU decompositions and solving
equation systems:
.. autosummary::
:toctree: reference/
spsolve
splu
UmfpackLU
"""
from __future__ import division, print_function, a... | rc/scikit-umfpack-rc | scikits/umfpack/interface.py | Python | bsd-3-clause | 8,440 |
"""
A standalone test runner script, configuring the minimum settings
required for tests to execute.
Re-use at your own risk: many Django applications will require
different settings and/or templates to run their tests.
"""
import os
import sys
# Make sure the app is (at least temporarily) on the import path.
APP_... | tdruez/django-registration | registration/runtests.py | Python | bsd-3-clause | 2,003 |
"""
This file contains the DynamicsValidator class for validating component
:copyright: Copyright 2010-2017 by the NineML Python team, see AUTHORS.
:license: BSD-3, see LICENSE for details.
"""
from builtins import object
from nineml.visitors.validators import NoDuplicatedObjectsValidator
from .general import (
Ti... | INCF/lib9ML | nineml/abstraction/dynamics/visitors/validators/base.py | Python | bsd-3-clause | 2,819 |
import json
# django imports
from django.contrib.auth.decorators import permission_required
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from dja... | baffolobill/django-lfs | lfs/manage/voucher/views.py | Python | bsd-3-clause | 10,411 |
from django import forms
from django.contrib import messages
from django.core.exceptions import ValidationError
from django.db.models import ObjectDoesNotExist
from django.shortcuts import get_object_or_404, redirect, render_to_response
from django.template import RequestContext
from django.utils.translation import uge... | ixc/plata | examples/simple/views.py | Python | bsd-3-clause | 1,810 |
"""
Extensions to pickle allowing items in __main__ to be saved.
"""
# CEBALERT: move into snapshots.py?
import new
import pickle
import types
import __main__
from StringIO import StringIO
import copy
def _name_is_main(obj):
# CEBALERT: see IPython hack in commandline.py
return obj.__module__ == "__main__" ... | Tasignotas/topographica_mirror | topo/misc/picklemain.py | Python | bsd-3-clause | 7,106 |
import re
from waliki.signals import page_saved
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from waliki.models import Page
from django.utils.translation import ugettext_lazy as _
from django.utils.text import get_text_list
try:
from waliki.attachments.models im... | RobertoMaurizzi/waliki | waliki/management/commands/moin_migration_cleanup.py | Python | bsd-3-clause | 6,418 |
# -*- coding: utf-8 -*-
#
# Pontoon documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 4 21:51:51 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... | jotes/pontoon | docs/conf.py | Python | bsd-3-clause | 9,297 |
from better_zoom import BetterZoom
from better_selecting_zoom import BetterSelectingZoom
from broadcaster import BroadcasterTool
from dataprinter import DataPrinter
from data_label_tool import DataLabelTool
from enable.tools.drag_tool import DragTool
from draw_points_tool import DrawPointsTool
from drag_zoom import Dra... | tommy-u/chaco | chaco/tools/api.py | Python | bsd-3-clause | 1,366 |
#!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
import os
from . import spd
# K temps: [0.0, 100.0, 150.0, 200.0, 225.0, 250.0, 275.0, 300.0, 325.0, 350.0, 375.0, 400.0, 425.0, 450.0, 475.0, 500.0, 525.0, 550.0]
# C temps: [273, 373.0, 423.0, 473.0, 498.0, 523.0, 548.... | Caoimhinmg/PmagPy | SPD/test_instance.py | Python | bsd-3-clause | 3,635 |
from __future__ import print_function
import flask
import os
import threading
import time
import webbrowser
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
_basedir = os.path.join("..", os.path.dirname(__file__))
app = flask.Flask(__name__, static... | phobson/bokeh | sphinx/docserver.py | Python | bsd-3-clause | 1,749 |
"""
Magic Link.
pymdownx.magiclink
An extension for Python Markdown.
Find http|ftp links and email address and turn them to actual links
MIT license.
Copyright (c) 2014 - 2017 Isaac Muse <isaacmuse@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associate... | brunobergher/dotfiles | sublime/pymdownx/st3/pymdownx/magiclink.py | Python | mit | 10,950 |
import sys
for line in sys.stdin:
data = line.strip().split(" ")
if len(data) == 10:
page = data[6]
ip_address = data[0]
print "{0}\t{1}".format(page, ip_address) | mi1980/projecthadoop3 | udacity/ud617-intro-hadoop/code/lesson3/server-project/mapper1.py | Python | mit | 170 |
#!/usr/bin/env python3
# Copyright (c) 2019-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Run fuzz test targets.
"""
from concurrent.futures import ThreadPoolExecutor, as_completed
import argp... | Sjors/bitcoin | test/fuzz/test_runner.py | Python | mit | 10,859 |
""" Python Character Mapping Codec generated from 'CP861.TXT' with gencodec.py.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
(c) Copyright 2000 Guido van Rossum.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,error... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.1/Lib/encodings/cp861.py | Python | mit | 7,192 |
"""
Support for Unifi WAP controllers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.unifi/
"""
import logging
import urllib
from homeassistant.components.device_tracker import DOMAIN
from homeassistant.const import CONF_HOST, CONF_USERN... | deisi/home-assistant | homeassistant/components/device_tracker/unifi.py | Python | mit | 2,645 |
#!/usr/bin/env python
from setuptools import find_packages, setup
from eventlet import __version__
from os import path
setup(
name='eventlet',
version=__version__,
description='Highly concurrent networking library',
author='Linden Lab',
author_email='eventletdev@lists.secondlife.com',
url='htt... | collinstocks/eventlet | setup.py | Python | mit | 1,289 |
# Hack, hide DataLossWarnings
# Based on html5lib code namespaceHTMLElements=False should do it, but nope ...
# Also it doesn't seem to be available in older version from html5lib, removing it
import warnings
from typing import IO, Union
from bs4 import BeautifulSoup
from html5lib.constants import DataLossWarning
war... | Flexget/Flexget | flexget/utils/soup.py | Python | mit | 491 |
from __future__ import unicode_literals, division, absolute_import
import re
from argparse import ArgumentParser, ArgumentTypeError
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from flexget import options
from flexget.event import event
from flexget.terminal import TerminalTable, Te... | gazpachoking/Flexget | flexget/components/managed_lists/lists/regexp_list/cli.py | Python | mit | 5,302 |
# -*- coding: utf-8 -*-
# adaped from https://www.djangosnippets.org/snippets/1376/
from os.path import abspath, dirname, isdir, join
from django.apps import apps
from django.core.exceptions import ImproperlyConfigured
from django.template import TemplateDoesNotExist
from django.template.loaders.filesystem import Load... | rambo/asylum | project/asylum/apptemplateloader.py | Python | mit | 1,416 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Openstack Monitoring script for Sensu / Nagios
#
# Copyright © 2013-2014 eNovance <licensing@enovance.com>
#
# Author: Mehdi Abaakouk <mehdi.abaakouk@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in ... | juliovp01/ops_tools | roles/monitoring/files/ceilometer.py | Python | mit | 2,011 |
"""
Support for showing the date and the time.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.time_date/
"""
import logging
import homeassistant.util.dt as dt_util
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__nam... | justyns/home-assistant | homeassistant/components/sensor/time_date.py | Python | mit | 2,911 |
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
# read in data.
file = open('fcover.dat','r')
ul=[];vl=[];pl=[]
nlons=73; nlats=73
dellat = 2.5; dellon = 5.
for line in file.readlines():
l = line.replace('\n','').split()
ul.append(float(l[0]))
vl.append(float(l[1]))... | raincoatrun/basemap | examples/barb_demo.py | Python | gpl-2.0 | 2,853 |
from Screen import Screen
from Components.Label import Label
class PVRState(Screen):
def __init__(self, session):
Screen.__init__(self, session)
self["state"] = Label(text="")
class TimeshiftState(PVRState):
pass
| blzr/enigma2 | lib/python/Screens/PVRState.py | Python | gpl-2.0 | 224 |
# -*- coding: utf-8 -*-
from time import localtime, mktime, time, strftime
from datetime import datetime
from enigma import eEPGCache
from Screens.Screen import Screen
import ChannelSelection
from ServiceReference import ServiceReference
from Components.config import config, ConfigSelection, ConfigText, ConfigSubList... | mrnamingo/vix4-34-enigma2-bcm | lib/python/Screens/TimerEntry.py | Python | gpl-2.0 | 25,002 |
# -*- coding: UTF-8 -*-
#--------------------------------------------------------------------------
# Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas
# Copyright: (C) 2001 Centro de Pesquisas Renato Archer
# Homepage: http://www.softwarepublico.gov.br
# Contact: invesalius@cti.gov... | rmatsuda/invesalius3 | invesalius/gui/dialogs.py | Python | gpl-2.0 | 189,985 |
from Plugins.Plugin import PluginDescriptor
from Screens.Console import Console
from Screens.ChoiceBox import ChoiceBox
from Screens.MessageBox import MessageBox
from Screens.Screen import Screen
from Screens.Standby import TryQuitMainloop
from Screens.Ipkg import Ipkg
from Screens.SoftwareUpdate import UpdatePlugin
fr... | vit2/vit-e2 | lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py | Python | gpl-2.0 | 81,553 |
# This file is part of Scapy
# Copyright (C) 2007, 2008, 2009 Arnaud Ebalard
# 2015, 2016, 2017 Maxence Tury
# This program is published under a GPLv2 license
"""
TLS Pseudorandom Function.
"""
from __future__ import absolute_import
from scapy.error import warning
from scapy.utils import strxor
from scapy.layers.tls... | gpotter2/scapy | scapy/layers/tls/crypto/prf.py | Python | gpl-2.0 | 12,924 |
# Copyright (C) 2015 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman 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 opt... | khushboo9293/mailman | src/mailman/rest/tests/test_api.py | Python | gpl-3.0 | 2,194 |
# This challenge is similar to the previous one. It operates under the same
# premise that you will have to replace the check_equals_ function. In this
# case, however, check_equals_ is called so many times that it wouldn't make
# sense to hook where each one was called. Instead, use a SimProcedure to write
# your ow... | cliffe/SecGen | modules/utilities/unix/ctf/metactf/files/repository/src_angr/dist/scaffold10.py | Python | gpl-3.0 | 4,519 |
from __future__ import absolute_import, unicode_literals
from .celery import app
@app.task
def add(x, y):
return x + y
@app.task
def mul(x, y):
return x * y
@app.task
def xsum(numbers):
return sum(numbers)
| ginolhac/tutorials | python/advanced/celery/code/ulhpccelery/tasks.py | Python | gpl-3.0 | 224 |
# Copyright 2011,2012 James McCauley
#
# This file is part of POX.
#
# POX 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.
#
# POX is d... | mikeing2001/LoopDetection | pox/web/webcore.py | Python | gpl-3.0 | 15,662 |
#!/usr/bin/env python
# Meran - MERAN UNLP is a ILS (Integrated Library System) wich provides Catalog,
# Circulation and User's Management. It's written in Perl, and uses Apache2
# Web-Server, MySQL database and Sphinx 2 indexing.
# Copyright (C) 2009-2013 Grupo de desarrollo de Meran CeSPI-UNLP
#
# This file is part ... | Desarrollo-CeSPI/meran | dev-plugins/node64/lib/node/wafadmin/Utils.py | Python | gpl-3.0 | 20,212 |
from __future__ import absolute_import
from django.utils.translation import ugettext_lazy as _
from smart_settings import LocalScope
from .icons import icon_icons_app
from .literals import DEFAULT_ICON_SET
name = 'icons'
label = _(u'Icons')
description = _(u'Handles the registration and rendering of icons and sprit... | rosarior/rua | rua/apps/icons/registry.py | Python | gpl-3.0 | 617 |