code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
"""
WSGI config for myproject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
from django.co... | Perkville/django-tastypie | docs/code/myproject/wsgi.py | Python | bsd-3-clause | 409 |
# Copyright 2019 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.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import itertools
from dashboard.pinpoint.model... | endlessm/chromium-browser | third_party/catapult/dashboard/dashboard/pinpoint/models/evaluators/job_serializer.py | Python | bsd-3-clause | 10,578 |
from six import string_types
from django.db import models
from django.db.models.query import F
from .constants import collection_kinds
from .errors import InvalidHierarchyRelationsArgument
class HierarchyRelationsFilter(object):
"""
Helper class for efficiently making queries based on relations between mode... | christianmemije/kolibri | kolibri/auth/filters.py | Python | mit | 10,993 |
# -*- coding: utf-8 -*-
from ..Qt import QtGui, QtCore
from ..python2_3 import asUnicode
from ..SignalProxy import SignalProxy
from .. import functions as fn
from math import log
from decimal import Decimal as D ## Use decimal to avoid accumulating floating-point errors
from decimal import *
import weakref
__all__ =... | vallsv/pyqtgraph | pyqtgraph/widgets/SpinBox.py | Python | mit | 19,955 |
"""
PyRSVD
------
This package provides a regularized singular value decomposition (RSVD) solver used to compute low-rank approximations of a large partial matrices
(i.e. a matrices with lots of missing valus).
R ~ U*V' where R: MxC, U: MxK and V: CxK. M is the number of movies, C is the number of clients
This kind o... | matted/bracketbot | pyrsvd/pyrsvd_orig/rsvd/__init__.py | Python | mit | 1,640 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2010 Prof. William H. Green (whgreen@mit.edu) and the
# RMG Team (rmg_dev@mit.edu)
#
# Permission is hereby granted, free of c... | pierrelb/RMG-Py | rmgpy/reduction/rates.py | Python | mit | 6,711 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'f0x11'
| f0x11/Merak | spider/__init__.py | Python | mit | 68 |
import ex1
import async
import socket
sock = socket.socket ()
fd = sock.fileno ()
x = async.arpc.axprt_stream (fd)
cl = async.arpc.aclnt (x, ex1.foo_prog_1 ())
| vonwenm/pbft | sfslite-1.2/Attic/python/ex1/tst.py | Python | gpl-2.0 | 165 |
import os
from mocker import MockerTestCase, ARGS, KWARGS
from cloudinit import handlers
from cloudinit import helpers
from cloudinit import importer
from cloudinit import settings
from cloudinit import url_helper
from cloudinit import util
class FakeModule(handlers.Handler):
def __init__(self):
handler... | racker/cloud-init-debian-pkg | tests/unittests/test__init__.py | Python | gpl-3.0 | 8,253 |
# Copyright 2011 Kyriakos Zarifis
# Copyright 2008 (C) Nicira, Inc.
#
# 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) ... | lewischeng-ms/pox | pox/forwarding/l2_ofcommand_learning.py | Python | gpl-3.0 | 5,023 |
""" Tools for creating pools of worker processes
"""
from __future__ import absolute_import
import multiprocessing.pool
import functools
from multiprocessing import TimeoutError
import types
import signal
import atexit
def is_main_process():
""" Check if this is the main control process and may handle one time tas... | cmbiwer/pycbc | pycbc/pool.py | Python | gpl-3.0 | 4,235 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2013 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU ... | drolando/SoftDev | tests/fife_test/tests/MultiPathfinderTest.py | Python | lgpl-2.1 | 7,856 |
# -*- coding: utf-8 -*-
# Automatic provisioning of EC2 placement groups
import boto.ec2.placementgroup
import nixops.resources
import nixops.util
import nixops.ec2_utils
class EC2PlacementGroupDefinition(nixops.resources.ResourceDefinition):
"""Definition of an EC2 placement group."""
@classmethod
def ... | atsukotakahashi/ops | nixops/resources/ec2_placement_group.py | Python | lgpl-3.0 | 5,002 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | sunu/oppia | extensions/rules/unicode_string.py | Python | apache-2.0 | 1,757 |
# Copyright 2020 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... | tensorflow/tensorflow | tensorflow/python/ops/ragged/row_partition.py | Python | apache-2.0 | 58,566 |
# Copyright 2013 dotCloud 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 or agreed t... | shakamunyi/docker-py | docker/unixconn/unixconn.py | Python | apache-2.0 | 3,189 |
# Copyright (c) 2018 PaddlePaddle 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 app... | luotao1/Paddle | python/paddle/fluid/dygraph/profiler.py | Python | apache-2.0 | 886 |
# swift_build_support/products/llvm.py --------------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.tx... | JGiola/swift | utils/swift_build_support/swift_build_support/products/llvm.py | Python | apache-2.0 | 2,666 |
# Copyright 2013 Red Hat, 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 or a... | badock/nova | nova/tests/objects/test_flavor.py | Python | apache-2.0 | 10,207 |
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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 a... | Juniper/neutron | neutron/db/migration/cli.py | Python | apache-2.0 | 4,441 |
#
# 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... | dims/neutron | neutron/tests/unit/db/test_api.py | Python | apache-2.0 | 1,611 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 th... | lakshmi-kannan/st2 | st2tests/st2tests/action_aliases.py | Python | apache-2.0 | 4,628 |
# Copyright (c) 2013 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... | wolverineav/neutron | neutron/extensions/external_net.py | Python | apache-2.0 | 2,051 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 14 14:11:38 2017
@author: lywen
"""
| lywen52/quantproject | strategy/__init__.py | Python | apache-2.0 | 109 |
# 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... | airbnb/superset | superset/migrations/versions/67a6ac9b727b_update_spatial_params.py | Python | apache-2.0 | 1,978 |
class i18n(object):
def __init__(self):
# Default domain
self._domain = 'idn'
def domain(self, country):
self._domain = country
def translate(self, domain):
dic = {}
dic['idn'] = {
# Month
'Januari': 'January',
'Februari': 'Febru... | pyk/rojak | rojak-pantau/rojak_pantau/i18n/i18n.py | Python | bsd-3-clause | 1,202 |
"""
============================================
Tractography Clustering - Available Features
============================================
This page lists available features that can be used by the tractography
clustering framework. For every feature a brief description is provided
explaining: what it does, when it's ... | villalonreina/dipy | doc/examples/segment_clustering_features.py | Python | bsd-3-clause | 11,258 |
from OpenGL.GL import *
from OpenGL.GLU import *
import pygame
import os.path
class Material(object):
def __init__(self):
self.name = ""
self.texture_fname = None
self.texture_id = None
class FaceGroup(object):
def __init__(self):
self.tri_indices = []
self.mater... | MaxWayne/Beginning-Game-Development-with-Python-and-Pygame | Chapter 12/model3d.py | Python | mit | 5,468 |
# Add ability to pass TF_Input_Dialog a data structure
# instead of an XML filename. XML file is only for
# initial creation, but for updates or showing user-
# modified settings, need this other option.
#---------------------------------------------------------
#!/usr/bin/env python
# August 8 & 11, 2008
# Febru... | peckhams/topoflow | topoflow/gui/Input_Dialog.py | Python | mit | 21,814 |
#!/usr/bin/env python
#
# time-scons.py: a wrapper script for running SCons timings
#
# This script exists to:
#
# 1) Wrap the invocation of runtest.py to run the actual TimeSCons
# timings consistently. It does this specifically by building
# SCons first, so .pyc compilation is not part of the t... | timj/scons | bin/time-scons.py | Python | mit | 12,346 |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the blocksdir option.
"""
import os
import shutil
from test_framework.test_framework import BitcoinTe... | GlobalBoost/GlobalBoost | test/functional/feature_blocksdir.py | Python | mit | 1,487 |
from __future__ import absolute_import
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
| eli261/jumpserver | apps/common/__init__.py | Python | gpl-2.0 | 150 |
#!/usr/bin/python
#
# Copyright (C) 2008 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 ... | alon/polinax | libs/external_libs/gdata.py-1.0.13/src/gdata/contacts/service.py | Python | gpl-2.0 | 5,972 |
import requests
from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter,
OAuth2LoginView,
OAuth2CallbackView)
from .provider import RedditProvider
class RedditAdapter(OAuth2Adapter):
... | Alexander-M-Waldman/local_currency_site | lib/python2.7/site-packages/allauth/socialaccount/providers/reddit/views.py | Python | gpl-3.0 | 1,335 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_controller_args
from . import test_custom_snippet
from . import test_error
from . import test_image_upload_progress
from . import test_is_multilang
from . import test_multi_company
from . import test_p... | jeremiahyan/odoo | addons/test_website/tests/__init__.py | Python | gpl-3.0 | 466 |
"""Configuration classes."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys
from . import types as t
from .util import (
find_python,
generate_pip_command,
ApplicationError,
)
from .util_common import (
docker_qualify_image,
get_docke... | azaghal/ansible | test/lib/ansible_test/_internal/config.py | Python | gpl-3.0 | 13,139 |
#!/usr/bin/env python
traindat = '../data/fm_train_real.dat'
testdat = '../data/fm_test_real.dat'
label_traindat = '../data/label_train_multiclass.dat'
parameter_list = [[traindat,testdat,label_traindat,2.1,1,1e-5],[traindat,testdat,label_traindat,2.2,1,1e-5]]
def classifier_gmnpsvm (train_fname=traindat,test_fname=t... | MikeLing/shogun | examples/undocumented/python/classifier_gmnpsvm.py | Python | gpl-3.0 | 912 |
# -*- coding: utf-8 -*-
"""
This generate diagram in .png and .svg from neo.core
Author: sgarcia
"""
from datetime import datetime
import numpy as np
import quantities as pq
from matplotlib import pyplot
from matplotlib.patches import Rectangle, ArrowStyle, FancyArrowPatch
from matplotlib.font_manager import FontP... | CINPLA/expipe-dev | python-neo/doc/source/images/generate_diagram.py | Python | gpl-3.0 | 7,653 |
"""Support the ISY-994 controllers."""
import asyncio
from functools import partial
from typing import Optional
from urllib.parse import urlparse
from pyisy import ISY
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
from homeass... | tchellomello/home-assistant | homeassistant/components/isy994/__init__.py | Python | apache-2.0 | 8,442 |
"""
Support for particulate matter sensors connected to a serial port.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.serial_pm/
"""
import logging
import voluptuous as vol
from homeassistant.const import CONF_NAME
from homeassistant.helpers.ent... | jamespcole/home-assistant | homeassistant/components/serial_pm/sensor.py | Python | apache-2.0 | 2,805 |
#-------------------------------------------------------------
#
# 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... | nakul02/incubator-systemml | src/main/python/systemml/mlcontext.py | Python | apache-2.0 | 25,332 |
# 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 agreed ... | supriyagarg/pydatalab | datalab/bigquery/_view.py | Python | apache-2.0 | 11,620 |
# 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 agreed ... | yebrahim/pydatalab | datalab/utils/_gcp_job.py | Python | apache-2.0 | 1,521 |
# PyVot
# Copyright(c) Microsoft Corporation
# 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
#
# THIS CODE IS PROVIDED ON AN ... | Microsoft/PTVS | Python/Product/Pyvot/Pyvot/xl/version.py | Python | apache-2.0 | 704 |
import setuptools
import io
import sys
import os.path
import subprocess
setuptools.setup(
name='jsonpath-rw',
version='1.4.0',
description='A robust and significantly extended implementation of JSONPath for Python, with a clear AST for metaprogramming.',
author='Kenneth Knowles',
author_email='ken... | pkilambi/python-jsonpath-rw | setup.py | Python | apache-2.0 | 1,220 |
#!/usr/bin/env python
import argparse
import atexit
import copy
import gc
import os
import shutil
import socket
import subprocess
import sys
import tempfile
import warnings
from pathlib import Path
try:
import django
except ImportError as e:
raise RuntimeError(
'Django module not found, reference tests... | ar4s/django | tests/runtests.py | Python | bsd-3-clause | 25,311 |
"""Trust-region optimization."""
from __future__ import division, print_function, absolute_import
import math
import numpy as np
import scipy.linalg
from .optimize import (_check_unknown_options, wrap_function, _status_message,
OptimizeResult)
__all__ = []
class BaseQuadraticSubproblem(objec... | pbrod/scipy | scipy/optimize/_trustregion.py | Python | bsd-3-clause | 8,925 |
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
from collections import defaultdict
from glob import glob
import os
import time
from xml.etree.ElementTree import ElementTree
# project
from checks import AgentCheck
class Skip(Exception):
"""
R... | WPMedia/dd-agent | checks.d/jenkins.py | Python | bsd-3-clause | 8,601 |
# -*- coding: utf-8 -*-
""" Tablib - JSON Support
"""
import tablib
import sys
from tablib.packages import omnijson as json
title = 'json'
extentions = ('json', 'jsn')
def export_set(dataset):
"""Returns JSON representation of Dataset."""
return json.dumps(dataset.dict)
def export_book(databook):
"... | justinpotts/mozillians | vendor-local/lib/python/tablib/formats/_json.py | Python | bsd-3-clause | 991 |
__version__ = '0.14' | andris210296/andris-projeto | backend/venv/test/lib/python2.7/site-packages/gaeforms/__init__.py | Python | mit | 20 |
#!/usr/bin/python
# Author: Jon Trulson <jtrulson@ics.com>
# Copyright (c) 2016 Intel Corporation.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without l... | whbruce/upm | examples/python/t8100.py | Python | mit | 3,663 |
"""
WSGI config for server project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` s... | jackTheRipper/iotrussia | web_server/src/server/server/wsgi.py | Python | gpl-2.0 | 1,419 |
import sys
import re
# Copyright
# =========
# Copyright (C) 2015 Trustwave Holdings, Inc.
#
# 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
# (at your optio... | jack51706/malware-analysis | Python/CherryPicker/cherryConfig.py | Python | gpl-3.0 | 3,456 |
import sys,getopt,string
filenames = None
fileOut = None
filePath = None
blocksize = 1024
i = 0
license ='/*\n'\
' ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio\n'\
'\n'\
' Licensed under the Apache License, Version 2.0 (the "License");\n'\
' you may not use this file except in compliance ... | serdzz/ChibiOS | test/crypto/ref/genfile.py | Python | gpl-3.0 | 1,842 |
# -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
#
# This file is part of the LibreOffice project.
#
# 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/.
#
# ... | jvanz/core | pyuno/demo/swritercomp.py | Python | gpl-3.0 | 5,309 |
#!/usr/bin/python
# Copyright 2004 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Test that the <library> property has no effect on "obj" targets. Previously,
# it affected all targets, so
#
# project : ... | TGAC/KAT | deps/boost/tools/build/test/library_property.py | Python | gpl-3.0 | 1,127 |
# -*- coding: utf-8 -*-
# Copyright 2016 Alex Comba - Agile Business Group
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import wizards
| open-synergy/account-invoicing | stock_picking_invoice_product_group/__init__.py | Python | agpl-3.0 | 163 |
"""
Tests for manager.py
"""
from nose.plugins.attrib import attr
from unittest import TestCase
from ..block_structure import BlockStructureBlockData
from ..exceptions import UsageKeyNotInBlockStructure
from ..manager import BlockStructureManager
from ..transformers import BlockStructureTransformers
from .helpers impo... | Learningtribes/edx-platform | openedx/core/lib/block_structure/tests/test_manager.py | Python | agpl-3.0 | 6,900 |
#!/usr/bin/env python
# Test whether a retained PUBLISH to a topic with QoS 1 is retained.
# Subscription is made with QoS 0 so the retained message should also have QoS
# 0.
import subprocess
import socket
import time
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-fr... | telefonicaid/fiware-IoTAgent-Cplusplus | third_party/mosquitto-1.4.4/test/broker/04-retain-qos1-qos0.py | Python | agpl-3.0 | 1,749 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import collections
import datetime
import errno
import io
import json
import locale
import os
import platform
import re
import shutil
import subprocess
import socket
import sys
import time
import traceback
if os.na... | riking/youtube-dl | youtube_dl/YoutubeDL.py | Python | unlicense | 58,331 |
# Copyright (c) 2018 PaddlePaddle 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 app... | QiJune/Paddle | python/paddle/trainer_config_helpers/tests/configs/projections.py | Python | apache-2.0 | 2,317 |
################################################################################
# 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... | GJL/flink | flink-python/pyflink/dataset/tests/test_execution_environment_completeness.py | Python | apache-2.0 | 3,235 |
"""Binary sensor support for Wireless Sensor Tags."""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
PLATFORM_SCHEMA, BinarySensorDevice)
from homeassistant.const import CONF_MONITORED_CONDITIONS, STATE_OFF, STATE_ON
from homeassistant.core import callback
import home... | jnewland/home-assistant | homeassistant/components/wirelesstag/binary_sensor.py | Python | apache-2.0 | 4,265 |
"""The tests for the Splunk component."""
import unittest
from unittest import mock
from homeassistant.setup import setup_component
import homeassistant.components.splunk as splunk
from homeassistant.const import STATE_ON, STATE_OFF, EVENT_STATE_CHANGED
from tests.common import get_test_home_assistant
class TestSpl... | MungoRae/home-assistant | tests/components/test_splunk.py | Python | apache-2.0 | 3,879 |
"""
Tests for DBSCAN clustering algorithm
"""
import pickle
import numpy as np
from scipy.spatial import distance
from scipy import sparse
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing im... | smartscheduling/scikit-learn-categorical-tree | sklearn/cluster/tests/test_dbscan.py | Python | bsd-3-clause | 10,974 |
"""
========================================
Release Highlights for scikit-learn 0.22
========================================
.. currentmodule:: sklearn
We are pleased to announce the release of scikit-learn 0.22, which comes
with many bug fixes and new features! We detail below a few of the major
features of this r... | glemaitre/scikit-learn | examples/release_highlights/plot_release_highlights_0_22_0.py | Python | bsd-3-clause | 10,115 |
###############################################################################
# Language Modeling on Penn Tree Bank
#
# This file generates new sentences sampled from the language model
#
###############################################################################
import argparse
import torch
from torch.autograd... | tshadley/examples | word_language_model_bptt_hsm/generate.py | Python | bsd-3-clause | 2,597 |
"""Test script for the binhex C module
Uses the mechanism of the python binhex module
Based on an original test by Roger E. Masse.
"""
import binhex
import unittest
from test import support
class BinHexTestCase(unittest.TestCase):
def setUp(self):
self.fname1 = support.TESTFN + "1"
self.fn... | yotchang4s/cafebabepy | src/main/python/test/test_binhex.py | Python | bsd-3-clause | 1,498 |
from djapian.tests.utils import BaseIndexerTest, BaseTestCase, Entry
def query_test(query, count):
class _QueryTest(BaseIndexerTest, BaseTestCase):
def setUp(self):
super(_QueryTest, self).setUp()
self.result = Entry.indexer.search(query)
def test_result_count(self):
... | pombreda/djapian | src/djapian/tests/query.py | Python | bsd-3-clause | 718 |
from eventlet import patcher
from eventlet.green import BaseHTTPServer
from eventlet.green import threading
from eventlet.green import socket
from eventlet.green import urllib2
patcher.inject('test.test_urllib2_localnet',
globals(),
('BaseHTTPServer', BaseHTTPServer),
('threading', threading),
('socke... | JeremyGrosser/python-eventlet | tests/stdlib/test_urllib2_localnet.py | Python | mit | 410 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
# You need to write the triangle method in the file 'triangle.py'
from triangle import *
class AboutTriangleProject(Koan):
def test_equilateral_triangles_have_equal_sides(self):
self.assertEqual('equilateral', triangle(2, 2, 2))
... | mfortner/MyPythonKoans | python2/koans/about_triangle_project.py | Python | mit | 910 |
#!/usr/bin/env python3
# Test file for price database stuff
# To update the price database call
# $PATH/gnucash --add-price-quotes $PATHTOFILE
# before running this.
# Adding to a calling bash script would be better
# Although calling it from here would be even better!
# OR: export PYTHONPATH=<path-to-gnucash-inst-d... | codesmythe/gnucash | bindings/python/example_scripts/priceDB_test.py | Python | gpl-2.0 | 1,772 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | chenzheng128/ns-3-dev-git | src/dsdv/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 525,693 |
# -*- coding: utf-8 -*-
"""
Models for Credit Eligibility for courses.
Credit courses allow students to receive university credit for
successful completion of a course on EdX
"""
import datetime
from collections import defaultdict
import logging
import pytz
from django.conf import settings
from django.core.cache im... | shashank971/edx-platform | openedx/core/djangoapps/credit/models.py | Python | agpl-3.0 | 24,732 |
# Copyright 2017 The Bazel 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 applicable la... | juhalindfors/bazel-patches | tools/build_defs/pkg/make_rpm_test.py | Python | apache-2.0 | 3,259 |
#
# 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... | practice-vishnoi/dev-spark-1 | python/pyspark/mllib/__init__.py | Python | apache-2.0 | 1,208 |
class MimeError(Exception):
pass
class DecodingError(MimeError):
"""Thrown when there is an encoding error."""
pass
class EncodingError(MimeError):
"""Thrown when there is an decoding error."""
pass
| alex/flanker | flanker/mime/message/errors.py | Python | apache-2.0 | 223 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jvrsantacruz/XlsxWriter | xlsxwriter/test/comparison/test_chart_data_labels11.py | Python | bsd-2-clause | 1,503 |
#!/usr/bin/env python
""" This example shows a ball that bounces on a surface and has
two balls rotating around it. It illustrates the use of timers
and how object hierarchy can be used to build (and move) complex
models consisting of multiple simple objects.
"""
import visvis as vv
# Create floor
floor = vv.solidBox... | chiluf/visvis.dev | examples/bouncingBall.py | Python | bsd-3-clause | 1,483 |
import numpy as np
from numpy import linalg
from scipy.sparse import dok_matrix, csr_matrix, issparse
from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing impo... | kashif/scikit-learn | sklearn/metrics/tests/test_pairwise.py | Python | bsd-3-clause | 25,509 |
import logging
from autotest.client import utils
from autotest.client.shared import error
from virttest import remote
from virttest import utils_misc
from virttest import utils_test
from virttest import utils_net
@error.context_aware
def run(test, params, env):
"""
Test Steps:
1. boot up guest with snd... | tolimit/tp-qemu | qemu/tests/virtual_nic_send_buffer.py | Python | gpl-2.0 | 3,680 |
from ajenti.ui import UI
from ajenti.api import event, helpers, ConfManager
from ajenti.utils import shell
import backend
class CronPlugin(helpers.CategoryPlugin):
text = 'Cron'
icon = '/dl/cron/icon.png'
folder = 'system'
def on_init(self):
self._tasks, self._others = backend.read_crontab(se... | casualuser/ajenti | plugins/cron/main.py | Python | lgpl-3.0 | 13,334 |
#
# Autogenerated by Thrift Compiler (0.10.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
import sys
import logging
f... | aweisberg/cassandra-dtest | thrift_bindings/thrift010/Cassandra.py | Python | apache-2.0 | 403,615 |
#
# 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... | SHASHANKB/spark | python/pyspark/ml/param/__init__.py | Python | apache-2.0 | 17,158 |
#!/usr/bin/python2
import argparse
import os
import subprocess
import sys
BASE_DIR = os.getcwd()
def build_install_orca(prefix, path):
# by default conan will install the files under /usr/local
return subprocess.call(["./configure --prefix={0} && make && make install_local".format(prefix)],
... | yuanzhao/gpdb | concourse/scripts/build_orca.py | Python | apache-2.0 | 1,492 |
from datetime import datetime
from operator import attrgetter
from django.db.models import F
from django.db.models.functions import Upper
from django.test import TestCase
from .models import Article, Author, Reference
class OrderingTests(TestCase):
@classmethod
def setUpTestData(cls):
cls.a1 = Arti... | mlavin/django | tests/ordering/tests.py | Python | bsd-3-clause | 12,431 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import unicode_literals
"""
This package provides the modules to perform FEFF IO.
FEFF: http://feffproject.org/feffproject-feff.html
"""
from .inputs import *
from .outputs import *
| johnson1228/pymatgen | pymatgen/io/feff/__init__.py | Python | mit | 311 |
from itertools import starmap, repeat
try:
from itertools import imap
except ImportError:
imap = map
import numpy as np
import weakref
from ..Qt import QtGui, QtCore, USE_PYSIDE, USE_PYQT5
from ..Point import Point
from .. import functions as fn
from .GraphicsItem import GraphicsItem
from .GraphicsObject import... | AOtools/soapy | soapy/pyqtgraph/graphicsItems/ScatterPlotItem.py | Python | gpl-3.0 | 37,649 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | ywcui1990/nupic | examples/opf/experiments/classification/category_hub_TP_0/description.py | Python | agpl-3.0 | 1,688 |
import os
import time
from .common import FileDownloader
from ..utils import (
compat_urllib_request,
compat_urllib_error,
ContentTooShortError,
encodeFilename,
sanitize_open,
format_bytes,
)
class HttpFD(FileDownloader):
_TEST_FILE_SIZE = 10241
def real_download(self, filename, inf... | riking/youtube-dl | youtube_dl/downloader/http.py | Python | unlicense | 8,667 |
import time
import math
import cv2
from pymavlink import mavutil
from droneapi.lib import VehicleMode, Location
import sc_config
from sc_video import sc_video
from sc_webcam import SmartCameraWebCam
from sc_SonyQX1 import SmartCamera_SonyQX
"""
sc_main.py - runs top level smart camera function
To run this module:
* R... | mazafrav/JdeRobot | src/drivers/MAVLinkServer/modules/mavproxy_smartcamera/sc_main.py | Python | gpl-3.0 | 7,941 |
# Copyright 2012 IBM Corp.
#
# 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 agree... | ewindisch/nova | nova/tests/compute/test_virtapi.py | Python | apache-2.0 | 7,425 |
# Copyright 2019 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... | karllessard/tensorflow | tensorflow/lite/testing/op_tests/equal.py | Python | apache-2.0 | 2,749 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test transaction signing using the signrawtransaction RPC."""
from test_framework.test_framework impor... | cryptoprojects/ultimateonlinecash | test/functional/signrawtransactions.py | Python | mit | 7,187 |
import numpy as np
import theano
import theano.tensor as T
theano.config.exception_verbosity = 'high'
theano.config.compute_test_value = 'warn'
floatX = theano.config.floatX
def iscalar(name=None):
Av = 1
A = T.iscalar(name=name)
A.tag.test_value = Av
return A, Av
def fscalar(name=None):
Av... | jbornschein/y2k | learning/tests/testing.py | Python | agpl-3.0 | 974 |
from jnpr.junos.utils.util import Util
| JamesNickerson/py-junos-eznc | lib/jnpr/junos/utils/__init__.py | Python | apache-2.0 | 39 |
"""
XML tag writer utilities.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
import cStringIO
__author__ = 'Enrique Perez (perez_enrique@yahoo.c... | dob71/x2swn | skeinforge/fabmetheus_utilities/xml_simple_writer.py | Python | gpl-3.0 | 4,447 |
#!/usr/bin/env python
"""Execute the tests for the seqcons2 program.
The golden test outputs are generated by the script generate_outputs.sh.
You have to give the root paths to the source and the binaries as arguments to
the program. These are the paths to the directory that contains the 'projects'
directory.
Usage... | rrahn/jst_bench | include/seqan/apps/seqcons2/tests/run_tests.py | Python | gpl-3.0 | 7,418 |
# Copyright 2013 IBM Corp.
# 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 app... | petrutlucian94/nova | nova/tests/unit/api/openstack/compute/contrib/test_multiple_create.py | Python | apache-2.0 | 22,783 |
#!/usr/bin/env python3
import random
import os
import asyncpg
from quart import Quart, jsonify, make_response, request, render_template
app = Quart(__name__)
GET_WORLD = "select id,randomnumber from world where id = $1"
UPDATE_WORLD = "update world set randomNumber = $2 where id = $1"
@app.before_serving
async def... | treefrogframework/FrameworkBenchmarks | frameworks/Python/quart/app.py | Python | bsd-3-clause | 2,817 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.