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 |
|---|---|---|---|---|---|
# Copyright 2015 Internap.
#
# 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, so... | godp1301/netman | netman/core/switch_sessions.py | Python | apache-2.0 | 3,672 |
# 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... | zasdfgbnm/tensorflow | tensorflow/contrib/timeseries/examples/lstm_test.py | Python | apache-2.0 | 1,806 |
#!/usr/bin/env python
#
# 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 "Li... | cloudera/hue | desktop/core/ext-py/apache-ranger-0.0.3/apache_ranger/model/ranger_role.py | Python | apache-2.0 | 1,619 |
"""Custom loader."""
from collections import OrderedDict
import fnmatch
import logging
import os
import sys
from typing import Dict, Iterator, List, TypeVar, Union, overload
import yaml
from homeassistant.exceptions import HomeAssistantError
from .const import _SECRET_NAMESPACE, SECRET_YAML
from .objects import Node... | postlund/home-assistant | homeassistant/util/yaml/loader.py | Python | apache-2.0 | 10,840 |
from unittest import mock
import datetime
import hashlib
import json
import pkg_resources
import uuid
import stevedore
import factory
from factory import fuzzy
from factory.django import DjangoModelFactory
import faker
from project import celery_app
from share import models
from share.harvest import BaseHarvester
f... | CenterForOpenScience/SHARE | tests/factories/__init__.py | Python | apache-2.0 | 6,604 |
from unittest import TestCase
import numpy as np
import pandas as pd
from zipline.history.history import HistorySpec
from zipline.protocol import BarData
from zipline.finance.trading import TradingEnvironment
from powerline.history.history_container import EpexHistoryContainer
__author__ = 'Max'
class TestHistory(... | grundgruen/powerline | tests/test_history.py | Python | apache-2.0 | 15,600 |
#-
# Copyright (c) 2011 Robert N. M. Watson
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# License... | 8l/beri | cheritest/trunk/tests/alu/test_mult_exception.py | Python | apache-2.0 | 1,575 |
#!/usr/bin/env python
# Copyright 2016 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 or... | clarko1/Cramd | vision/api/label/snippets_test.py | Python | apache-2.0 | 1,777 |
from a10sdk.common.A10BaseClass import A10BaseClass
class AclCfg(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param ve: {"type": "number", "description": "Virtual ethernet interface (Virtual ethernet interface number)", "format": "interface"}
:param loopback: {"t... | amwelch/a10sdk-python | a10sdk/core/router/router_ipv6_rip_offset_list.py | Python | apache-2.0 | 3,591 |
#
# 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... | Leemoonsoo/incubator-zeppelin | spark/interpreter/src/main/resources/python/zeppelin_ipyspark.py | Python | apache-2.0 | 2,958 |
# 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... | mahak/keystone | keystone/tests/unit/ksfixtures/jws_key_repository.py | Python | apache-2.0 | 1,906 |
# Copyright (c) 2012 Rackspace Hosting
# 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 req... | Juniper/nova | nova/tests/unit/cells/test_cells_rpcapi.py | Python | apache-2.0 | 38,135 |
"""
Support for AquaLogic sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.aqualogic/
"""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (CONF_MONITORED_... | tinloaf/home-assistant | homeassistant/components/sensor/aqualogic.py | Python | apache-2.0 | 3,622 |
"""
# Name: check_answer_api/utilities/plane_geometry_prove_checker.py
# Description:
# Created by: Martinus Alexander
# Date Created: Dec 2, 2016
# Last Modified: Jan 9, 2017
# Modified by: Martinus Alexander
"""
import answer_formatter, expression_checker
import re
"""
Check the similarity betwe... | deka108/mathqa-server | assessment/utilities/plane_geometry_prove_checker.py | Python | apache-2.0 | 7,481 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
#
# 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
#
# Unle... | dsiddharth/access-keys | keystone/tests/test_backend_kvs.py | Python | apache-2.0 | 9,170 |
#!/usr/bin/env python3
import json
import os
import time
import dcos_launch
from dcos_test_utils import logger, helpers, ssh_client
# Here we create 4 MOUNT volumes on every agent, where the first two have no
# profile and their filesystem default to ext4, and the last two have the "xfs"
# profile and filesystem.
MOU... | mesosphere/dcos-kafka-service | tools/create_testing_volumes.py | Python | apache-2.0 | 4,410 |
import struct
import numpy as np
# Tools to read the generated pattern files and the hex output files
def readQ31Pattern(r):
l = []
with open(r, 'r') as f:
f.readline()
nb = int(f.readline())
for i in range(nb):
f.readline()
# Read the hex and interpret the sign
... | JonatanAntoni/CMSIS_5 | CMSIS/DSP/Testing/PatternGeneration/DebugTools.py | Python | apache-2.0 | 2,549 |
#!/usr/bin/python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import sys
import argparse
import ConfigParser
from provision_bgp import BgpProvisioner
class MxProvisioner(object):
def __init__(self, args_str=None):
self._args = None
if not args_str:
args_str ... | tcpcloud/contrail-controller | src/config/utils/provision_mx.py | Python | apache-2.0 | 4,300 |
#!/usr/bin/env python
from setuptools import setup, find_packages
from os import path
import codecs
import os
import re
import sys
# When creating the distribution, make sure the django.mo file also exists:
if 'sdist' or 'bdist_wheel' in sys.argv:
os.chdir('oscar_docdata')
from django.core import management
... | edoburu/django-oscar-docdata | setup.py | Python | apache-2.0 | 2,572 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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... | varunarya10/ironic | ironic/tests/db/utils.py | Python | apache-2.0 | 4,305 |
# match.py - filename matching
#
# Copyright 2008, 2009 Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import re
import util
class match(object):
def __init__(self, root, cwd, patte... | joewalnes/idea-community | plugins/hg4idea/testData/bin/mercurial/match.py | Python | apache-2.0 | 7,697 |
from rest_framework import serializers as ser
from api.base.serializers import (
JSONAPISerializer,
RelationshipField,
RestrictedDictSerializer,
LinksField,
is_anonymized,
DateByVersion,
HideIfNotNodePointerLog,
HideIfNotRegistrationPointerLog,
)
from osf.models import OSFUser, Abstrac... | TomBaxter/osf.io | api/logs/serializers.py | Python | apache-2.0 | 8,957 |
# Copyright 2011 OpenStack LLC.
# Copyright (c) 2015 Mirantis 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/L... | NetApp/manila | manila/api/v2/quota_sets.py | Python | apache-2.0 | 9,341 |
# -*- coding: utf-8 -*-
"""Download helper object implementations."""
import abc
import logging
import os
from l2tdevtools.download_helpers import interface
class ProjectDownloadHelper(interface.DownloadHelper):
"""Helps in downloading a project."""
def __init__(self, download_url):
"""Initializes a downlo... | joachimmetz/l2tdevtools | l2tdevtools/download_helpers/project.py | Python | apache-2.0 | 4,914 |
from time import sleep
topic = "mrl"
qos = 2
broker = "tcp://iot.eclipse.org:1883" //if you have your own just change the hostname/IP
clientID = "MRL MQTT python"
mqtt1 = Runtime.createAndStart("mqtt", "MQTT")
mqtt1.startService()
print mqtt1.getDescription()
mqtt1.setBroker(broker)
mqtt1.setQos(qos)
mqtt1.setPubTop... | mecax/pyrobotlab | service/MQTT.py | Python | apache-2.0 | 460 |
# Copyright (c) 2014 Quobyte Inc.
# Copyright (c) 2013 Red Hat, 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... | Akrog/cinder | cinder/volume/drivers/quobyte.py | Python | apache-2.0 | 16,982 |
"""Provides device automations for deconz events."""
import voluptuous as vol
from homeassistant.components.device_automation import TRIGGER_BASE_SCHEMA
from homeassistant.components.device_automation.exceptions import (
InvalidDeviceAutomationConfig,
)
from homeassistant.components.homeassistant.triggers import e... | tchellomello/home-assistant | homeassistant/components/deconz/device_trigger.py | Python | apache-2.0 | 19,744 |
import os
import pytest
from mockito import mock, verify, when, unstub, ANY
from selenium import webdriver
from SeleniumLibrary.keywords import WebDriverCreator
LOG_DIR = "/log/dir"
@pytest.fixture(scope="module")
def creator():
return WebDriverCreator(LOG_DIR)
def teardown_function():
unstub()
def tes... | emanlove/robotframework-selenium2library | utest/test/keywords/test_webdrivercreator.py | Python | apache-2.0 | 30,539 |
######################################
# Example Document Processing pipeline
######################################
from org.myrobotlab.service import Runtime
from org.myrobotlab.document.transformer import WorkflowConfiguration
from org.myrobotlab.document.transformer import StageConfiguration
# create the pipeline s... | MyRobotLab/myrobotlab | src/main/resources/resource/DocumentPipeline/DocumentPipeline.py | Python | apache-2.0 | 1,999 |
# Copyright 2013 Canonical Ltd
# 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... | orbitfp7/nova | nova/api/metadata/vendordata_json.py | Python | apache-2.0 | 2,139 |
from pylons import g, c
import ew as ew_core
from ew import jinja2_ew as ew
import formencode
from formencode import validators as fev
from allura import model as M
from allura.lib import validators as V
from allura.lib import security
from allura.lib.widgets import forms as ff
from allura.lib.widgets import form_fie... | pombredanne/SourceForge-Allura | Allura/allura/ext/admin/widgets.py | Python | apache-2.0 | 6,482 |
# 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 applicable ... | clinc/models | slim/preprocessing/preprocessing_factory.py | Python | apache-2.0 | 2,590 |
### refer Zhizheng and Simon's ICASSP'16 paper for more details
### http://www.zhizheng.org/papers/icassp2016_lstm.pdf
import numpy as np
import theano
import theano.tensor as T
from theano import config
from theano.tensor.shared_randomstreams import RandomStreams
class VanillaRNN(object):
""" This class impleme... | ashmanmode/TTSDNNRepo | src/layers/gating.py | Python | apache-2.0 | 39,236 |
#!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
'''Local spin expectation value <Psi |(local S^2)|Psi >
The local S^2 operator only couples the orbitals specified in aolst. The
cross term which involves the interaction between the local part (in aolst)
and non-local part (not in aolst) is not in... | gkc1000/pyscf | examples/mcscf/23-local_spin.py | Python | apache-2.0 | 5,232 |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import atexit
from functools import partial
import json
import os
from urllib.parse import urlparse
import tempfile
import vcr
from c7n.testing import TestUtils
from c7n.resources import load_resources
from c7n_kube.client import Session
... | thisisshi/cloud-custodian | tools/c7n_kube/tests/common_kube.py | Python | apache-2.0 | 3,144 |
# coding=utf-8
import logging
import random
import string
import sys
import unittest
from time import time, sleep
import apiritif
import os
import re
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from selenium.webdriver.common.by import By
from seleniu... | Blazemeter/taurus | tests/resources/selenium/generated_from_requests.py | Python | apache-2.0 | 10,841 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Cisco Systems, 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... | tpaszkowski/quantum | quantum/plugins/cisco/nexus/cisco_nexus_plugin_v2.py | Python | apache-2.0 | 9,459 |
#!/usr/bin/env python
#
# Copyright 2010 NorthScale, 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... | couchbaselabs/litmus | lib/testrunner_common.py | Python | apache-2.0 | 11,961 |
# Copyright (c) 2012-2016 Seafile Ltd.
from django.views.generic import TemplateView
from constance import config
class DirectTemplateView(TemplateView):
"""
Extend Django ``TemplateView`` to accept extra contexts.
"""
extra_context = None
def get_context_data(self, **kwargs):
context = s... | miurahr/seahub | seahub/base/generic.py | Python | apache-2.0 | 764 |
#!/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... | cloudera/hue | desktop/core/src/desktop/lib/scheduler/lib/oozie.py | Python | apache-2.0 | 1,076 |
# 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 agreed t... | ntt-sic/nova | nova/tests/api/openstack/compute/plugins/v3/test_services.py | Python | apache-2.0 | 11,561 |
from test_basics import run_hummingbird
from test_imports import test_import_backend_lcls
import os, sys, warnings
__thisdir__ = os.path.dirname(os.path.realpath(__file__))
# Testing basic examples
def test_dummy_example():
run_hummingbird(conf=__thisdir__ + '/../examples/basic/dummy.py')
def test_simulation_examp... | FXIhub/hummingbird | tests/test_examples.py | Python | bsd-2-clause | 1,245 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import urlquery
import json
import smtplib
from email.mime.text import MIMEText
import time
import datetime
c = 'Luxembourg'
cc = 'LU'
tld = 'lu'
sender = 'urlquery@example.com'
to = 'dest@example.com'
smtp_server = 'smtp_server'
def get_country():
feed = urlq... | pombredanne/urlquery_python_api | examples/by_country.py | Python | bsd-2-clause | 2,826 |
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS
from django.utils.six.moves import input
class Command(BaseCommand):
help = (
"Deletes all data from this instance and recreates the original "
"... | cdubz/timestrap | core/management/commands/reset.py | Python | bsd-2-clause | 2,734 |
"""empty message
Revision ID: 3f13ffdc44e8
Revises: dfa7d259be4
Create Date: 2017-02-06 22:47:21.538364
"""
# revision identifiers, used by Alembic.
revision = '3f13ffdc44e8'
down_revision = 'dfa7d259be4'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - pl... | moonlitlaputa/scheduler-service | old/migrations/versions/3f13ffdc44e8_.py | Python | bsd-2-clause | 2,072 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('program', '0003_host_is_active'),
]
operations = [
migrations.AddField(
model_name='show',
name='is_... | nnrcschmdt/helsinki | program/migrations/0004_show_is_active.py | Python | bsd-3-clause | 441 |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
# Copyright (c) 2017, Battelle Memorial Institute
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistri... | VOLTTRON/volttron-applications | kisensum/openadr/openadr/api/builders.py | Python | bsd-3-clause | 12,872 |
#!/usr/bin/env python
"""
Pandoc filter to convert all links to cross-references.
"""
from pandocfilters import attributes, toJSONFilter, Cite, Link, Space, Span, Str
import urlparse
def is_absolute(url):
return bool(urlparse.urlparse(url).netloc)
def links(key, value, format, meta):
if key == 'Link':
... | smaccm/smaccm | fm-workbench/resolute/org.osate.resolute.help/link-to-ref.py | Python | bsd-3-clause | 1,486 |
#!/usr/bin/env python
__author__ = 'robswift'
import sys
from BlastNFilter.Utilities import IOParser
from BlastNFilter.Utilities import Run
def main(argv=[__name__]):
itf = IOParser.interface(argv[1:])
options = IOParser.SplitInput(itf)
Run.run(options)
if __name__ == "__main__":
sys.exit(main(sys... | rvswift/BlastNFilter | build/lib/BlastNFilter/blastnfilter.py | Python | bsd-3-clause | 328 |
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
'''
MapReduce Job Metrics
---------------------
mapreduce.job.elapsed_ime The elapsed time since the application started (in ms)
mapreduce.job.maps_total The total number of maps
map... | c960657/dd-agent | checks.d/mapreduce.py | Python | bsd-3-clause | 21,114 |
#!/usr/bin/env python
import os
import sys
import subprocess
import time
import json
import nose
import re
dirname = os.path.dirname(os.path.realpath(__file__))
os.chdir(dirname)
sys.path.append("../lib")
from util import cmd
from mzb_test_utils import run_successful_bench, run_failing_bench, restart_bench, start_m... | timofey-barmin/mzbench | acceptance_tests/mzb_basic_tests.py | Python | bsd-3-clause | 13,182 |
# -*- coding: utf-8 -*-
from django.contrib.localflavor.ro.forms import (ROCIFField, ROCNPField,
ROCountyField, ROCountySelect, ROIBANField, ROPhoneNumberField,
ROPostalCodeField)
from utils import LocalFlavorTestCase
class ROLocalFlavorTests(LocalFlavorTestCase):
def test_ROCountySelect(self):
f... | mitsuhiko/django | tests/regressiontests/forms/localflavor/ro.py | Python | bsd-3-clause | 5,449 |
# -*- coding: utf-8 -*-
"""classes.py
Functions to uncover the classes that emerge from the spatial repartition of the
original categories.
"""
from __future__ import division
import copy
import math
import csv
from marble.common import (compute_totals,
return_categories)
__author__ = """\t""".... | walkerke/marble | marble/classes.py | Python | bsd-3-clause | 7,982 |
# coding: utf-8
from flask import Flask
from flask import g, session, request, url_for, flash
from flask import redirect, render_template
from flask_oauthlib.client import OAuth
app = Flask(__name__)
app.debug = True
app.secret_key = 'development'
oauth = OAuth(app)
twitter = oauth.remote_app(
'twitter',
c... | RealGeeks/flask-oauthlib | example/twitter.py | Python | bsd-3-clause | 2,505 |
# Copyright (c) 2014, The Boovix authors that are listed
# in the AUTHORS file. All rights reserved. Use of this
# source code is governed by the BSD 3-clause license that
# can be found in the LICENSE file.
"""Package utils"""
| cztomczak/boovix | boovix1/utils/__init__.py | Python | bsd-3-clause | 229 |
from django.db import models
from django.contrib.auth.models import User
class Profile(models.Model):
user = models.OneToOneField(User)
short_info = models.TextField(blank=True)
| stephrdev/django-userprofiles | test_project/test_accounts/models.py | Python | bsd-3-clause | 189 |
import pytest
from tests.plugins.upload_to_s3 import upload_file_to_s3_by_job_id
pytest_plugins = (
"tests.examples.examples_report_plugin",
"tests.integration.integration_tests_plugin",
"tests.plugins.bokeh_server",
"tests.plugins.image_diff",
"tests.plugins.jupyter_notebook",
"tests.plugins.... | Karel-van-de-Plassche/bokeh | tests/conftest.py | Python | bsd-3-clause | 1,394 |
from appenlight_client import client
from appenlight_client.timing import time_trace
import time
class Foo(object):
@time_trace(name='Foo.test', min_duration=0.1)
def test(self):
time.sleep(0.1)
return 1
@time_trace(name='Foo.__call__', min_duration=0.2)
def __call__(self):
t... | jpwilliams/appenlight-client-python | experiements/test2.py | Python | bsd-3-clause | 811 |
class Command(object):
def __init__(self, *args, **kwargs):
self.args = args
for k, v in kwargs.iteritems():
setattr(self, k, v)
def __call__(self):
self._execute()
self.on_action()
def _execute(self):
pass
def on_action(self, undo=False):
p... | carloscanova/python-odml | odml/gui/commands.py | Python | bsd-3-clause | 5,898 |
"""Breast Cancer Data"""
from statsmodels.datasets import utils as du
__docformat__ = 'restructuredtext'
COPYRIGHT = """???"""
TITLE = """Breast Cancer Data"""
SOURCE = """
This is the breast cancer data used in Owen's empirical likelihood. It is taken from
Rice, J.A. Mathematical Statistics and Data An... | statsmodels/statsmodels | statsmodels/datasets/cancer/data.py | Python | bsd-3-clause | 1,177 |
"""
This module houses a utility class for mocking deprecated modules.
It is for internal use only and should not be used beyond this purpose.
"""
import importlib
import warnings
class _DeprecatedModule:
""" Class for mocking deprecated modules.
Parameters
----------
deprmod : name of module to be ... | toobaz/pandas | pandas/util/_depr_module.py | Python | bsd-3-clause | 3,658 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | stonebig/bokeh | bokeh/tests/test_palettes.py | Python | bsd-3-clause | 2,377 |
#!/usr/bin/env python
import pytest
import numpy as np
import sklearn.datasets as datasets
import sklearn.svm as svm
import pandas_ml as pdml
import pandas_ml.util.testing as tm
class TestSVM(tm.TestCase):
def test_objectmapper(self):
df = pdml.ModelFrame([])
self.assertIs(df.svm... | sinhrks/expandas | pandas_ml/skaccessors/test/test_svm.py | Python | bsd-3-clause | 2,995 |
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
#
# License: BSD (3-clause)
import os
import os.path as op
import re
import shutil
import sys
from unittest import SkipTest
import numpy as np
from numpy.testing import (assert_allclose, assert_equal,
assert_array_almost_equal)
import... | teonlamont/mne-python | mne/gui/tests/test_coreg_gui.py | Python | bsd-3-clause | 11,267 |
#import os
#import itertools
#import pytest
#import numpy as np
#from .get_data_path import data_path
#try:
#import pandas
#HAS_PANDAS = True
#except ImportError:
#HAS_PANDAS = False
#details_type = ["det_global", "det_oct", "det_third"]
#int_time = ["2000ms", "1000ms", "0500ms", "0250ms", "0063ms", "00... | giumas/python-acoustics | tests/test_aio.py | Python | bsd-3-clause | 1,442 |
"""
===========================
Read/Write streamline files
===========================
Overview
========
dipy_ can read and write many different file formats. In this example
we give a short introduction on how to use it for loading or saving streamlines.
Read :ref:`faq`
"""
import numpy as np
from dipy.data imp... | nilgoyyou/dipy | doc/examples/streamline_formats.py | Python | bsd-3-clause | 1,556 |
"""
=====================================================================
Compute Phase Slope Index (PSI) in source space for a visual stimulus
=====================================================================
This example demonstrates how the Phase Slope Index (PSI) [1] can be computed
in source space based on si... | effigies/mne-python | examples/connectivity/plot_mne_inverse_psi_visual.py | Python | bsd-3-clause | 4,677 |
import time
import json
from kraken.core.profiler import Profiler
profiler = Profiler()
time.sleep(0.15)
profiler.push('fn1')
time.sleep(0.05)
profiler.push('fn2')
time.sleep(0.01)
profiler.pop()
profiler.pop()
time.sleep(0.25)
profiler.push('fn3')
time.sleep(0.05)
profiler.push('fn2')
time.sleep(0.01)
profiler.pop(... | oculusstorystudio/kraken | tests/profiler/profiler.py | Python | bsd-3-clause | 476 |
from __future__ import absolute_import
from hashlib import sha1
from django.core.files.base import ContentFile
from sentry.testutils import TestCase
from sentry.tasks.assemble import assemble_dif
from sentry.models import FileBlob
from sentry.models.file import ChunkFileState
from sentry.models.dsymfile import get_a... | ifduyue/sentry | tests/sentry/tasks/test_assemble.py | Python | bsd-3-clause | 2,176 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | stonebig/bokeh | bokeh/core/property/tests/test_override.py | Python | bsd-3-clause | 2,348 |
"""A high-speed, production ready, thread pooled, generic HTTP server.
Simplest example on how to use this module directly
(without using CherryPy's application machinery)::
from cherrypy import wsgiserver
def my_crazy_app(environ, start_response):
status = '200 OK'
response_headers = [('... | rsgalloway/grit | grit/server/cherrypy/__init__.py | Python | bsd-3-clause | 81,156 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("msgs", "0010_label_migrate_pt4")]
operations = [
migrations.AlterField(
model_name="label",
name="description",
... | praekelt/casepro | casepro/msgs/migrations/0011_auto_20160222_1422.py | Python | bsd-3-clause | 631 |
"""Module which provides utility functions used across the package."""
import tensorflow as tf
def dropout(variable: tf.Tensor,
keep_prob: float,
train_mode: tf.Tensor) -> tf.Tensor:
"""Perform dropout on a variable, depending on mode.
Arguments:
variable: The variable to be ... | ufal/neuralmonkey | neuralmonkey/nn/utils.py | Python | bsd-3-clause | 764 |
from django.conf.urls.defaults import *
import maps.views as views
urlpatterns = patterns('',
(r'^mapview$', 'maps.views.index'),
(r'^map/resource/(?P<pk>\d+)$', 'maps.views.map_resource'),
(r'^my_admin/jsi18n', 'django.views.i18n.javascript_catalog'),
) | commtrack/commtrack-core | apps/maps/urls.py | Python | bsd-3-clause | 267 |
from __future__ import unicode_literals
from django import template
from django.template.base import VariableDoesNotExist
from waffle import flag_is_active, sample_is_active, switch_is_active
from waffle.views import _generate_waffle_js
register = template.Library()
class WaffleNode(template.Node):
child_node... | willkg/django-waffle | waffle/templatetags/waffle_tags.py | Python | bsd-3-clause | 2,642 |
import os.path
import pprint
import subprocess
import sys
import transfer.protocol
class RsyncOverSsh(transfer.protocol.Protocol):
def __init__(self, options, config):
super(RsyncOverSsh, self).__init__(options, config)
self.ssh_config = config.get_value("ssh")
def build_rsync_command(self,... | youtube/cobalt | third_party/llvm-project/lldb/utils/sync-source/lib/transfer/rsync.py | Python | bsd-3-clause | 1,949 |
from unittest import TestCase
from chatterbot.adapters.storage import MongoDatabaseAdapter
from chatterbot.conversation import Statement
class BaseMongoDatabaseAdapterTestCase(TestCase):
def setUp(self):
"""
Instantiate the adapter.
"""
database_name = "test_db"
self.adap... | iAmMrinal0/ChatterBot | tests/storage_adapter_tests/test_mongo_adapter.py | Python | bsd-3-clause | 8,354 |
#!/usr/bin/env python
import glob
import numpy as np
import chainer_mask_rcnn as mrcnn
import instance_occlsegm_lib
import contrib
def main():
class_names = contrib.core.get_class_names()
# get lbl_clss from sequential frames
imgs = []
lbl_clss = []
class_ids_timeline = []
whole_masks = {... | start-jsk/jsk_apc | demos/instance_occlsegm/examples/synthetic2d/arc2017_occlusion_dataset/annotation_view_dataset.py | Python | bsd-3-clause | 2,865 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("schedule", "0002_event_color_event")]
operations = [
migrations.AlterField(
model_name="event",
name="end",
field=models.DateTimeField(
help_text="The... | llazzaro/django-scheduler | schedule/migrations/0003_auto_20160715_0028.py | Python | bsd-3-clause | 1,591 |
from django import forms
from django.forms import widgets
from core.hwadapter.models import HWAdapter
from truth.models import Truth
class HWAdapterForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(HWAdapterForm, self).__init__(*args, **kwargs)
if not self.instance.pk:
... | rtucker-mozilla/inventory | core/hwadapter/forms.py | Python | bsd-3-clause | 1,295 |
"""
Module to set up run time parameters for Clawpack.
The values set in the function setrun are then written out to data files
that will be read in by the Fortran code.
"""
import os
from pyclaw import data
#------------------------------
def setrun(claw_pkg='classic'):
#------------------------------
... | clawpack/clawpack-4.x | apps/acoustics/2d/example1/setrun.py | Python | bsd-3-clause | 5,803 |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# 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/command_modules/azure-cli-find/setup.py | Python | mit | 1,894 |
# -*- coding: utf-8 -*-
#
# highlight.js documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 12 23:48:27 2012.
#
# 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.
#
... | malisancube/GuavaBlog | src/GuavaBlog.Web/wwwroot/lib/highlight/docs/conf.py | Python | mit | 7,782 |
# Natural Language Toolkit: Translation metrics
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Will Zhang <wilzzha@gmail.com>
# Guan Gui <ggui@student.unimelb.edu.au>
# Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
def alignment_error_rate(... | nelango/ViralityAnalysis | model/lib/nltk/translate/metrics.py | Python | mit | 1,471 |
import os
import sys
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
PROJECT_DIR = PROJECT_ROOT.split(os.sep)[-1]
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
full_path = lambda *parts: os.path.join(PROJECT_ROOT, *parts)
example_path = full_path("..", "..")
if example_path not in sy... | dongguangming/django-social-widgets | example_project/settings.py | Python | mit | 703 |
""" MAAS module for configuring endpoint
"""
from conjureup import errors, juju
from conjureup.app_config import app
def setup_maas():
maascreds = juju.get_credential(app.provider.cloud,
app.provider.credential)
if not maascreds:
raise errors.MAASConfigError(
... | conjure-up/conjure-up | conjureup/maas.py | Python | mit | 1,369 |
"""
glucosetools - tools for cleaning, condensing, and reformatting history data
"""
from .version import __version__
import argparse
import json
from openaps.uses.use import Use
from glucose import clean as clean_glucose
# set_config is needed by openaps for all vendors.
# set_config is used by `device add` com... | oskarpearson/openaps-glucosetools | openapscontrib/glucosetools/__init__.py | Python | mit | 2,884 |
from __future__ import absolute_import
from __future__ import print_function
import os
import json
import sys
from .common import epsilon
from .common import floatx
from .common import set_epsilon
from .common import set_floatx
from .common import get_uid
from .common import cast_to_floatx
from .common import image_dim... | marcsans/cnn-physics-perception | phy/lib/python2.7/site-packages/keras/backend/__init__.py | Python | mit | 2,487 |
"""
Django settings for migration_test project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ... | percipient/django_migration_testcase | tests/test_project_sqlite_south/migration_test/settings.py | Python | mit | 2,049 |
"""Filename matching with shell patterns.
fnmatch(FILENAME, PATTERN) matches according to the local convention.
fnmatchcase(FILENAME, PATTERN) always takes case in account.
The functions operate by translating the pattern into a regular
expression. They cache the compiled regular expressions for speed.
The function... | amisrs/one-eighty | angular_flask/lib/python2.7/site-packages/docker/utils/fnmatch.py | Python | mit | 2,819 |
from aleph.util import dict_list, ensure_list
from aleph.text import string_value
from aleph.schema.types import resolve_type
class SchemaValidationException(Exception):
"""Schema validation errors will be caught by the API."""
def __init__(self, errors):
self.errors = errors
super(SchemaVali... | gazeti/aleph | aleph/schema/__init__.py | Python | mit | 6,969 |
"""SCons.Tool.aixlink
Tool-specific initialization for the IBM Visual Age linker.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby gr... | EmanueleCannizzaro/scons | src/engine/SCons/Tool/aixlink.py | Python | mit | 2,750 |
# encoding: utf-8
import mock
from pagarme import Customer
from pagarme.transaction import Transaction, PagarmeApiError, NotPaidException, NotBoundException
from .mocks import fake_request, fake_request_fail, fake_request_refund
from .pagarme_test import PagarmeTestCase
class TransactionTestCase(PagarmeTestCase):
... | reginaldojunior/pagarme-python | tests/transaction_test.py | Python | mit | 4,846 |
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2012 Dustin Lacewell
# Copyright (c) 2011 Mounier Florian
# Copyright (c) 2012 Craig Barnes
# Copyright (c) 2012 Maximilian Köhl
# Copyright (c) 2012, 2014-2015 Tycho Andersen
# Copyright (c) 2013 jpic
# Copyright (c) 2013 babadoo
# Copyright (c) 2013 Jure Ham
# Copyright (c... | jdowner/qtile | libqtile/layout/xmonad.py | Python | mit | 28,380 |
#!/usr/bin/env python3
# Copyright (c) 2017-2021 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 external signer.
Verify that a bitcoind node can use an external signer command
See also rpc_sign... | MarcoFalke/bitcoin | test/functional/wallet_signer.py | Python | mit | 8,899 |
"""Raw transforms between coordinate frames, as NumPy matrices."""
from numpy import array
from .constants import ASEC2RAD
def build_matrix():
# 'xi0', 'eta0', and 'da0' are ICRS frame biases in arcseconds taken
# from IERS (2003) Conventions, Chapter 5.
xi0 = -0.0166170 * ASEC2RAD
eta0 = -0.0068192... | exoanalytic/python-skyfield | skyfield/framelib.py | Python | mit | 793 |
# AprilTags Example
#
# This example shows the power of the OpenMV Cam to detect April Tags
# on the OpenMV Cam M7. The M4 versions cannot detect April Tags.
import sensor, image, time, math
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.VGA) # we run out of memory if the resolution is... | openmv/openmv | scripts/examples/OpenMV/26-April-Tags/find_apriltags_w_lens_zoom.py | Python | mit | 1,630 |
for dogname in ["Max", "Molly", "Buster", "Maggie", "Lucy"]:
print(dogname)
print(" Arf, arf!")
print("All done.")
| djpine/pyman | Book/chap6/Supporting Materials/doggyloop.py | Python | cc0-1.0 | 126 |
# ===========================================================================
# eXe
# Copyright 2004-2006, University of Auckland
#
# 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 versio... | kohnle-lernmodule/exeLearningPlus1_04 | exe/webui/casestudyblock.py | Python | gpl-2.0 | 5,802 |
#!/usr/bin/python
# -*- coding: ascii -*-
# $Id$
#
# Author: https://github.com/carlosgs
# Date: 14-Sep-2015
from __future__ import absolute_import
from __future__ import print_function
__author__ = "Carlos Garcia Saura"
__email__ = ""
__name__ = _("Bowl")
import math
from CNC import CNC,Block
from ToolsPage impor... | samowitsch/bCNC | bCNC/plugins/bowl.py | Python | gpl-2.0 | 3,981 |