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 |
|---|---|---|---|---|---|
"""inline_tags
Revision ID: 0f740a081d20
Revises: a92d92aa678e
Create Date: 2018-05-10 15:47:56.120338
"""
import re
from funcy import flatten, compact
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import text
from redash import models
# revision identifiers, used by Alembic.
revision = '0f740a... | chriszs/redash | migrations/versions/0f740a081d20_inline_tags.py | Python | bsd-2-clause | 884 |
"""HTML reporting for Coverage."""
import os, re, shutil
import coverage
from coverage.backward import pickle
from coverage.misc import CoverageException, Hasher
from coverage.phystokens import source_token_lines
from coverage.report import Reporter
from coverage.templite import Templite
# Disable pylint msg W0612, ... | akiokio/centralfitestoque | src/.pycharm_helpers/coverage/html.py | Python | bsd-2-clause | 10,555 |
import collections
import copy
import pickle
import unittest
class DictSetTest(unittest.TestCase):
def test_constructors_not_callable(self):
kt = type({}.keys())
self.assertRaises(TypeError, kt, {})
self.assertRaises(TypeError, kt)
it = type({}.items())
self.assertRaises(Ty... | yotchang4s/cafebabepy | src/main/python/test/test_dictviews.py | Python | bsd-3-clause | 11,391 |
from django.core.exceptions import ObjectDoesNotExist
from django.template import Context, RequestContext, loader
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django import http
def shortcut(request, content_type_id, object_id):
"Redirect to an object... | rawwell/django | django/views/defaults.py | Python | bsd-3-clause | 3,482 |
import os
import time
import math
import director.vtkAll as vtk
import PythonQt
from PythonQt import QtCore
from PythonQt import QtGui
from director import getDRCBaseDir as getDRCBase
from director import botspy
from director import openscope
import functools
_mainWindow = None
_defaultRenderView = None
def getMainW... | mitdrc/director | src/python/director/applogic.py | Python | bsd-3-clause | 8,862 |
# Copyright 2013 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 core import perf_benchmark
from measurements import rasterize_and_record_micro
import page_sets
from telemetry import benchmark
class _RasterizeAndRe... | CapOM/ChromiumGStreamerBackend | tools/perf/benchmarks/rasterize_and_record_micro.py | Python | bsd-3-clause | 3,644 |
#ckwg +28
#Copyright 2013-2014 by Kitware, 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 of cond... | linus-sherrill/maptk | scripts/blender/io_import_krtd_camera.py | Python | bsd-3-clause | 7,275 |
from django.conf.urls.defaults import patterns, url
from moca.mrs import api_handlers
urlpatterns = patterns(
'',
url(r'^notifications/submit/$',
'moca.mrs.legacy_api.notification_submit',
name="moca-api-notification-submit"),
url(r'^notifications/submit/email/$',
'moca.mrs.legac... | satvikdhandhania/vit-11 | moca/mrs/legacy_urls.py | Python | bsd-3-clause | 1,339 |
import sys
import re
import fnmatch
import os
import shutil
import zipfile
from pip.util import display_path, backup_dir
from pip.log import logger
from pip.exceptions import InstallationError
from pip.basecommand import Command
class ZipCommand(Command):
name = 'zip'
usage = '%prog [OPTIONS] PACKAGE_NAMES...'... | BadDNA/anolis | web/env/lib/python2.6/site-packages/pip-0.7.2-py2.6.egg/pip/commands/zip.py | Python | bsd-3-clause | 14,475 |
from esri2open import toOpen, writeFile, closeUp, closeJSON
from prepare import prepareFile, prepareGeoJSON | calvinmetcalf/esri2topo | scripts/esri2open/__init__.py | Python | mit | 107 |
#!/usr/bin/env python
#*******************************************************************************
# ALMA - Atacama Large Millimiter Array
# (c) Associated Universities Inc., 2002
# (c) European Southern Observatory, 2002
# Copyright by ESO (in the framework of the ALMA collaboration)
# and Cosylab 2002, All right... | csrg-utfsm/acscb | LGPL/CommonSoftware/acspy/test/acspyTestConsumer.py | Python | mit | 2,283 |
# -*- coding: utf-8 -*-
import fakeredis
import logging
import mock
import tempfile
import unittest
import beaver
from beaver.config import BeaverConfig
from beaver.transports import create_transport
from beaver.transports.base_transport import BaseTransport
class DummyTransport(BaseTransport):
pass
with mock.... | thomasalrin/beaver | beaver/tests/test_transport_config.py | Python | mit | 2,499 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2019 by nils_2 <weechatter@arcor.de>
#
# add a plain text or evaluated content to item bar
#
# 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... | MatthewCox/dotfiles | weechat/python/text_item.py | Python | mit | 10,764 |
# -*- python -*-
# Copyright (C) 2009, 2010 Free Software Foundation, 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 option) any later versi... | yangjoo/kernel_samsung_smdk4412 | linaro_4.7.3-2013.04/arm-linux-gnueabihf/lib/arm-linux-gnueabi/libstdc++.so.6.0.17-gdb.py | Python | gpl-2.0 | 2,471 |
# -*- coding: utf-8 -*-
#
# test-aeif_cond_alpha_RK5.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of th... | synergetics/nest | pynest/examples/test-aeif_cond_alpha_RK5.py | Python | gpl-2.0 | 3,520 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0201
"""Default flavor utils class, used for desktop builders."""
import json
WIN_TOOLCHAIN_DIR = 't'
class DeviceDirs(object):
... | geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/third_party/skia/infra/bots/recipe_modules/flavor/default_flavor.py | Python | gpl-3.0 | 5,232 |
# -*- coding: latin-1 -*-
'''
Dictionary called **Models** with PSS/E Models
The dictionary contains info about:
* CON number (J, J+1, ..., J+NC)
* Description of the constant
* Typical values
'''
psse_models_dic={
'DEGOV1':{ # ANEXO 15 MODELOS DINÁMICOS - Asep www.asep.gob.pa/electric/Anexos/ANEX... | jmmauricio/pypstools | pypstools/models2dict.py | Python | gpl-3.0 | 24,923 |
#
# The classes of the abstract syntax tree
#
# AST
# |
# +-- Exp
# | |
# | +-- NumLitExp
# | +-- StringLitExp
# | +-- IdentExp
# | +-- ArrayRefExp
# | +-- FunCallExp
# | +-- UnaryExp
# | +-- BinOpExp
# | +-- ParenthExp
# |
# +-- Stmt
# | |
# | +--... | tajkhan/pluto-pocc | annotations/module/loop/ast.py | Python | gpl-3.0 | 20,819 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import core.models
class Migration(migrations.Migration):
dependencies = [
('core', 'rename_core_politician_unique_url'),
]
operations = [
migrations.AlterModelOptions(
n... | nicorikken/freedomvote | app/core/migrations/0002_auto_20150401_0929.py | Python | gpl-3.0 | 850 |
# 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/.
"""
Common functions for search-related external modules.
"""
import datetime
import json
from socorro.lib import (
... | Tayamarn/socorro | socorro/lib/search_common.py | Python | mpl-2.0 | 21,214 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2011 NUMA Extreme Systems (www.numaes.com) for Cubic ERP - Teradata SAC. (http://cubicerp.com).
#
# WARNING: This program as such is intended to be use... | Jgarcia-IAS/SAT | openerp/addons-extra/odoo-pruebas/odoo-server/addons-extra/l10n_pe_ple03/sunat_3_8.py | Python | agpl-3.0 | 12,504 |
#
# Copyright 2010-2012 Fabric Engine Inc. All rights reserved.
#
import fabric
fabricClient = fabric.createClient()
node1 = fabricClient.DependencyGraph.createNode("one")
node2 = fabricClient.DependencyGraph.createNode("two")
try:
node1.setDependency( node1, "reflex" )
fabricClient.flush()
except Exception as ... | ghostx2013/FabricEngine_Backup | Native/Test/Python/dependency-loop.py | Python | agpl-3.0 | 493 |
# Politician models are actually in core/models.py | twhyte/openparliament | parliament/politicians/models.py | Python | agpl-3.0 | 50 |
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Publ... | addition-it-solutions/project-all | addons/auth_ldap/users_ldap.py | Python | agpl-3.0 | 10,681 |
# Copyright 2013-2021 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 RFpc(RPackage):
"""Flexible Procedures for Clustering
Various methods for clustering ... | LLNL/spack | var/spack/repos/builtin/packages/r-fpc/package.py | Python | lgpl-2.1 | 2,666 |
# Copyright 2013-2021 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)
import pytest
from spack.main import SpackCommand
providers = SpackCommand('providers')
@pytest.mark.parametrize('pkg... | LLNL/spack | lib/spack/spack/test/cmd/providers.py | Python | lgpl-2.1 | 1,317 |
#-----------------------------------------------------------------------------
# Copyright (c) 2010-2012 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distributed as part of this software.
#-----... | IsCoolEntertainment/debpkg_python-pyzmq | zmq/tests/test_poll.py | Python | lgpl-3.0 | 7,724 |
# 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... | google/grumpy | testing/builtin_test.py | Python | apache-2.0 | 9,127 |
import logging
import traceback
import json
from pylons import request, response, session, tmpl_context as c
from pylons import app_globals
from pylons.controllers.util import abort
# added for auth
from authkit.authorize.pylons_adaptors import authorize
from authkit.permissions import RemoteUser, ValidAuthKitUser, Us... | klyap/pypes | ui/pypesvds/controllers/project.py | Python | apache-2.0 | 2,530 |
from vt_manager.communication.sfa.util.xrn import urn_to_hrn
from vt_manager.communication.sfa.trust.credential import Credential
from vt_manager.communication.sfa.trust.auth import Auth
class Start:
def __init__(self, xrn, creds, **kwargs):
hrn, type = urn_to_hrn(xrn)
valid_creds = Auth().che... | dana-i2cat/felix | vt_manager/src/python/vt_manager/communication/sfa/methods/Start.py | Python | apache-2.0 | 459 |
# 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... | ppwwyyxx/tensorflow | tensorflow/lite/testing/op_tests/rank.py | Python | apache-2.0 | 1,913 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Test Creator role with Program scoped roles
"""
from integration.ggrc import TestCase
from ggrc.models import all_models
from integration.ggrc.api_helper import Api
from integration.ggrc.generator impor... | edofic/ggrc-core | test/integration/ggrc_basic_permissions/test_creator_program.py | Python | apache-2.0 | 12,063 |
# Copyright 2016 Intel Corporation
# Copyright 2015 FUJITSU LIMITED
#
# 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 ... | SauloAislan/ironic | ironic/conf/irmc.py | Python | apache-2.0 | 3,160 |
'''
https://pynet.twb-tech.com
Applied Python, Class2, Exercise1
Note, you will need to update the ip_addr, SNMP username and keys to use this script.
You will also need to update the sender and recipient in send_notification.
Note, this alternate version supports Pickle, YAML, and JSON file formats. Change the net_... | cb1234/pynet-test | pynet/appliedpy_ecourse/class2/ex1_run_config_chg_alt.py | Python | apache-2.0 | 7,578 |
"""Support for IKEA Tradfri switches."""
from homeassistant.components.switch import SwitchDevice
from .base_class import TradfriBaseDevice
from .const import CONF_GATEWAY_ID, KEY_API, KEY_GATEWAY
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Load Tradfri switches based on a config entr... | leppa/home-assistant | homeassistant/components/tradfri/switch.py | Python | apache-2.0 | 1,789 |
# Copyright (c) 2016 Cloudbase Solutions Srl
#
# 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 applicab... | sebrandon1/nova | nova/virt/hyperv/block_device_manager.py | Python | apache-2.0 | 9,863 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | xzturn/tensorflow | tensorflow/python/kernel_tests/variable_scope_test.py | Python | apache-2.0 | 82,171 |
# Copyright (c) 2013 Mirantis 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 to in writ... | ekasitk/sahara | sahara/topology/topology_helper.py | Python | apache-2.0 | 5,871 |
# Copyright (c) 2016-present, Facebook, 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... | davinwang/caffe2 | caffe2/python/cached_reader.py | Python | apache-2.0 | 4,051 |
# Copyright 2012 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 ... | masters3d/coursebuilder-masters3d | modules/dashboard/filer.py | Python | apache-2.0 | 22,273 |
"""Chat with Cleverbot in Python."""
import traceback
import cleverbot
def main():
# instantiate a Cleverbot object
cleverbot_client = cleverbot.Cleverbot()
while True:
question = raw_input('>> You: ')
answer = cleverbot_client.ask(question)
print '>> Cleverbot: {}'.format(answer... | marquesds/cleverbot.py | examples/human_bot_chat.py | Python | bsd-2-clause | 501 |
# coding: utf-8
"""
Deals with generating the site-wide navigation.
This consists of building a set of interlinked page and header objects.
"""
from __future__ import unicode_literals
import datetime
import logging
import os
from mkdocs import utils, exceptions
log = logging.getLogger(__name__)
def filename_to_t... | davidgillies/mkdocs | mkdocs/nav.py | Python | bsd-2-clause | 9,645 |
from . import AWSProperty, AWSAttribute, validate_pausetime
from .validators import positive_integer, integer, boolean
class AutoScalingRollingUpdate(AWSProperty):
props = {
'MaxBatchSize': (positive_integer, False),
'MinInstancesInService': (integer, False),
'MinSuccessfulInstancesPercent... | 7digital/troposphere | troposphere/policies.py | Python | bsd-2-clause | 1,477 |
from optparse import make_option
from StringIO import StringIO
import os
from django.core.management.base import BaseCommand
from django.core.serializers.xml_serializer import Deserializer
# For any version <= 0.2.0 where this command existed, there is no backwards-incompatible schema change
# Note:
# The data conve... | DuVale/snapboard | snapboard/management/commands/snapboard_loaddata.py | Python | bsd-3-clause | 5,517 |
"""
Ridge regression
"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# Reuben Fletcher-Costin <reuben.fletchercostin@gmail.com>
# Fabian Pedregosa <fabian@fseoane.net>
# Michael Eickenberg <michael.eickenberg@nsup.org>
# License: BSD 3 clause
from abc import ABCMeta, abstractmethod
impor... | vortex-ape/scikit-learn | sklearn/linear_model/ridge.py | Python | bsd-3-clause | 55,029 |
"""Benchmarks of Singular Values Decomposition (Exact and Approximate)
The data is mostly low rank but is a fat infinite tail.
"""
import gc
from time import time
import numpy as np
from collections import defaultdict
from scipy.linalg import svd
from sklearn.utils.extmath import randomized_svd
from sklearn.datasets.... | florian-f/sklearn | benchmarks/bench_plot_svd.py | Python | bsd-3-clause | 2,809 |
# Version 0.2.0
# 2009/06/18
# Copyright Michael Foord 2005-2009
# akismet.py
# Python interface to the akismet API
# E-mail fuzzyman@voidspace.org.uk
# http://www.voidspace.org.uk/python/modules.shtml
# http://akismet.com
# Released subject to the BSD License
# See http://www.voidspace.org.uk/python/license.shtml
... | mrkiwi-nz/django-helpdesk | helpdesk/akismet.py | Python | bsd-3-clause | 13,267 |
import random
import string
from django.db.models import get_model
Account = get_model('accounts', 'Account')
def generate(size=12, chars=None):
"""
Generate a new account code
:size: Length of code
:chars: Character set to choose from
"""
if chars is None:
chars = string.ascii_uppe... | Mariana-Tek/django-oscar-accounts | accounts/codes.py | Python | bsd-3-clause | 589 |
from sympy import (Abs, exp, Expr, I, pi, Q, Rational, refine, S, sqrt,
atan, atan2, nan, Symbol)
from sympy.abc import x, y, z
from sympy.core.relational import Eq, Ne
from sympy.functions.elementary.piecewise import Piecewise
def test_Abs():
assert refine(Abs(x), Q.positive(x)) == x
asser... | atreyv/sympy | sympy/assumptions/tests/test_refine.py | Python | bsd-3-clause | 6,241 |
#!/usr/bin/env python
import json
import os
import urllib2
from scriptCommon import catchPath
def upload(options):
request = urllib2.Request('http://melpon.org/wandbox/api/compile.json')
request.add_header('Content-Type', 'application/json')
response = urllib2.urlopen(request, json.dumps(options))
re... | ric2b/Vivaldi-browser | update_notifier/thirdparty/wxWidgets/3rdparty/catch/scripts/updateWandbox.py | Python | bsd-3-clause | 1,357 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pkgutil
import urlparse
import json
import logging
import urllib2
from argparse import ArgumentParser
__all__ = ['main']
gfwlist_url = 'https://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt'
def parse_args():
parser = ArgumentParser()
parser.add_ar... | jamesmaxwell/gfwlist2pac | gfwlist2pac/main.py | Python | mit | 4,750 |
import logging
def main():
# Configure the logging system
logging.basicConfig(
filename='app.log',
level=logging.ERROR
)
# Variables (to make the calls that follow work)
hostname = 'www.python.org'
item = 'spam'
filename = 'data.csv'
mode = 'r'
# Example logging ca... | tuanavu/python-cookbook-3rd | src/13/simple_logging_for_scripts/example1.py | Python | mit | 620 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('volontulo', '0005_removing_badges'),
]
operations = [
migrations.CreateModel(
name='Page',
fields=[
... | w1stler/volontulo | backend/apps/volontulo/migrations/0006_page.py | Python | mit | 922 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
import json
print(json.dumps(dict(os.environ)))
| DonJayamanne/pythonVSCode | pythonFiles/printEnvVariables.py | Python | mit | 154 |
#
# QAPI types generator
#
# Copyright IBM, Corp. 2011
#
# Authors:
# Anthony Liguori <aliguori@us.ibm.com>
#
# This work is licensed under the terms of the GNU GPLv2.
# See the COPYING.LIB file in the top-level directory.
from ordereddict import OrderedDict
from qapi import *
import sys
import os
import getopt
impor... | vincent-d/qemu | scripts/qapi-types.py | Python | gpl-2.0 | 10,549 |
#!/usr/bin/env python
## Copyright (C) 2008 University of Texas at Austin
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option... | TobbeTripitaka/src | plot/test/7ab.py | Python | gpl-2.0 | 3,289 |
#
# This file is part of fimap.
#
# Copyright(c) 2009-2012 Iman Karim(ikarim2s@smail.inf.fh-brs.de).
# http://fimap.googlecode.com
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' bas... | crunchsec/fimap | src/singleScan.py | Python | gpl-2.0 | 6,127 |
# Text progress hub classes
#
# Copyright (C) 2012 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed... | mairin/anaconda | pyanaconda/ui/tui/spokes/progress.py | Python | gpl-2.0 | 5,593 |
import os
import subprocess
import sys
from pipes import quote
PRISTINE_ENV = dict(os.environ)
if PRISTINE_ENV.get('CFME_QUICKSTART_DEBUG'):
_call = subprocess.check_call
else:
_call = subprocess.check_output
def command_text(command, shell):
if shell:
return command
else:
return ' '... | nachandr/cfme_tests | cfme/scripting/quickstart/proc.py | Python | gpl-2.0 | 874 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('services', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='serviceprofilerole',
... | fargalaxy1/geonode-wagtail | geonode/services/migrations/0002_auto_20160821_1919.py | Python | gpl-3.0 | 2,311 |
"""
CourseBlocks API views
"""
from django.core.exceptions import ValidationError
from django.http import Http404
from rest_framework.generics import ListAPIView
from rest_framework.response import Response
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from openedx.core.lib.api.vie... | simbs/edx-platform | lms/djangoapps/course_api/blocks/views.py | Python | agpl-3.0 | 9,379 |
"""
Test authorization functions
"""
import pytest
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from ..permissions import can_view_courses_for_username
from .mixins import CourseApiFactoryMixin
class ViewCoursesForUsernameTestCase(CourseApiFactoryMixin, TestCase):
"""
... | edx/edx-platform | lms/djangoapps/course_api/tests/test_permissions.py | Python | agpl-3.0 | 1,658 |
# Copyright (c) 2013 Mirantis 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 to in writ... | ekasitk/sahara | sahara/tests/integration/tests/base.py | Python | apache-2.0 | 30,796 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | strint/tensorflow | tensorflow/contrib/distributions/python/ops/normal.py | Python | apache-2.0 | 9,111 |
"""Test reproduce state for Lock."""
from homeassistant.core import State
from tests.common import async_mock_service
async def test_reproducing_states(hass, caplog):
"""Test reproducing Lock states."""
hass.states.async_set("lock.entity_locked", "locked", {})
hass.states.async_set("lock.entity_unlocked"... | leppa/home-assistant | tests/components/lock/test_reproduce_state.py | Python | apache-2.0 | 1,712 |
#
# Copyright 2016 Quantopian, 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 to in wr... | humdings/zipline | tests/test_data_portal.py | Python | apache-2.0 | 20,093 |
# 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... | grengojbo/st2 | st2common/st2common/models/api/policy.py | Python | apache-2.0 | 4,733 |
# Copyright (c) 2016 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/LICENSE-2.0
#
# Unless require... | Hybrid-Cloud/cinder | cinder/tests/unit/db/test_cluster.py | Python | apache-2.0 | 13,570 |
# -*- coding: utf-8 -*-
#
# Fasteners documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 5 14:47:29 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.
#
#... | catapult-project/catapult | third_party/gsutil/third_party/fasteners/doc/source/conf.py | Python | bsd-3-clause | 9,425 |
'''
array slice syntax
'''
def somefunc():
a = [1,2,3,4,5]
print('a addr:', a)
print('len a:', len(a))
b = a[1:]
print('b addr (should not be `a` above):', b)
print('len b (should be 4):', len(b))
c = a[:]
print('c addr (should not be `a` or `b` above):', c)
print('len c:', len(c))
c.append(6)
print('len ... | pombredanne/Rusthon | regtests/c++/array_slice.py | Python | bsd-3-clause | 1,087 |
# Copyright 2012 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.
"""Runs Mozilla's Kraken JavaScript benchmark."""
import os
from core import perf_benchmark
from telemetry import page as page_module
from telemetry.page ... | danakj/chromium | tools/perf/benchmarks/kraken.py | Python | bsd-3-clause | 5,339 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# Tree (Hierarchical) Nested Set Model (nsm)
#
# To use the nested set model,
# use the following pattern
# 1. name your parent field as "parent_item_group" if not have a property nsm_parent_field as your field name in ... | indictranstech/fbd_frappe | frappe/utils/nestedset.py | Python | mit | 8,675 |
#!/usr/bin/env python
import base64, sys
stSpam, stHam, stDump = 0, 1, 2
# The markers parameters is in form ('start1', 'stop1'), ('start2', 'stop2')...
# Return is (marker-index, substrate)
def readPemBlocksFromFile(fileObj, *markers):
startMarkers = dict(map(lambda x: (x[1],x[0]),
en... | Acimaz/Google_Apple_Financial_Reporter | lib/third_party/pyasn1_modules/pem.py | Python | mit | 1,915 |
"""
Mark.
pymdownx.mark
Really simple plugin to add support for
<mark>test</mark> tags as ==test==
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 associated
documentation files (the "Software")... | brunobergher/dotfiles | sublime/pymdownx/st3/pymdownx/mark.py | Python | mit | 2,751 |
#!/usr/bin/python
#
# Copyright 2008 Google Inc. All Rights Reserved.
"""Tests for test."""
import unittest, sys, os
try:
import autotest.common as common
except ImportError:
import common
from autotest.cli import cli_mock, topic_common, test
class test_list_unittest(cli_mock.cli_unittest):
values = [{... | spcui/autotest | cli/test_unittest.py | Python | gpl-2.0 | 6,665 |
import sys
sys.path = ['.'] + sys.path
from test_support import verbose, TestFailed
import re
import sys, os, string, traceback
# Misc tests from Tim Peters' re.doc
if verbose:
print 'Running tests on re.search and re.match'
try:
assert re.search('x*', 'axx').span(0) == (0, 0)
assert re.search('x*', 'ax... | atmark-techno/atmark-dist | user/python/Lib/test/test_re.py | Python | gpl-2.0 | 12,182 |
import xbmc
import json
import re
import urllib
import urlparse
import requests
from BeautifulSoup import BeautifulSoup as BS
from nanscrapers.common import clean_title, random_agent, replaceHTMLCodes
from ..scraper import Scraper
session = requests.Session()
headers = {"User-Agent": random_agent()}
class BeeMP3(Sc... | mrquim/mrquimrepo | script.module.nanscrapers/lib/nanscrapers/scraperplugins/beemp3.py | Python | gpl-2.0 | 2,672 |
#!/usr/bin/env python
#
# Copyright 2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your optio... | iohannez/gnuradio | gr-analog/python/analog/qa_quadrature_demod.py | Python | gpl-3.0 | 1,882 |
# 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/.
import Queue
import json
import os
import sys
import unittest
import uuid
import time
from tornado import web
from torn... | Conjuror/fxos-certsuite | mcts/webapi_tests/semiauto/server.py | Python | mpl-2.0 | 5,707 |
import sys
import os
import pwd
import __builtin__
from os.path import abspath, basename, dirname, join
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
try:
import cPickle as pickle
USING_CPICKLE = True
except ImportError:
import pickle
USING_CPICKLE = False
from time... | mleinart/carbon | lib/carbon/util.py | Python | apache-2.0 | 7,647 |
import pycuda.autoinit
import pycuda.driver as drv
import numpy
from pycuda.compiler import SourceModule
from jinja2 import Environment, PackageLoader
def main():
#FourPermutations set-up
FourPermutations = numpy.array([ [1,2,3,4],
[1,2,4,3],
... | schroeder-dewitt/polyomino-self-assembly | test/SearchSpaceAdv/alpha-multi-edge2/main.py | Python | apache-2.0 | 6,783 |
# -*- coding: utf-8 -*-
#
# 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
... | gilt/incubator-airflow | tests/models.py | Python | apache-2.0 | 56,892 |
# Copyright 2015 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | zhimin711/nova | nova/tests/unit/test_notifier.py | Python | apache-2.0 | 2,202 |
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# 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. Redistributions of source code must retain the above copyright notice, this
# list of condit... | ignaeche/barf-project | barf/barf/utils/utils.py | Python | bsd-2-clause | 2,700 |
# -*- coding: utf-8 -*-
#
# django-permissions documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 11 07:25:51 2010.
#
# 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 fi... | SergioDzul/django-permissions | docs/conf.py | Python | bsd-3-clause | 6,487 |
# -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# please also see AUTHORS file
# :copyright: (c) 2007-2013, The Tor Project, Inc.
# (c) 2007-2013, all entities within the AUTHORS file... | pagea/bridgedb | lib/bridgedb/_langs.py | Python | bsd-3-clause | 912 |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^$', 'templatesadmin.views.listing', name='templatesadmin-overview'),
url(r'^edit(?P<path>.*)/$', 'templatesadmin.views.modify', name='templatesadmin-edit'),
)
| barttc-archive/django-templatesadmin | templatesadmin/urls.py | Python | bsd-3-clause | 242 |
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as publ... | dbbhattacharya/kitsune | vendor/packages/logilab-common/sphinxutils.py | Python | bsd-3-clause | 4,444 |
def parse_contract_items(api_result):
rowset = api_result.find('rowset')
results = []
for row in rowset.findall('row'):
a = row.attrib
item = {
'id': int(a['recordID']),
'type_id': int(a['typeID']),
'quantity': int(a['quantity']),
'singleton': ... | bastianh/evelink | evelink/parsing/contract_items.py | Python | mit | 564 |
from pandas import Series, DataFrame
import pandas as pd
import collections
import numpy
import uncertainties
import pint
from uncertainties import ufloat
from uncertainties import ufloat_fromstr
from pint import UnitRegistry
import string
ureg = UnitRegistry()
Q_ = ureg.Quantity
def return_int(num):
num_str = str(... | stefangri/s_s_productions | Vorlagen/Ordnerstruktur_Praktikum/Messdaten/latex.py | Python | mit | 4,043 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import timedelta
import io
import os
from babelfish import Language
import pytest
try:
from unittest.mock import Mock
except ImportError:
from mock import Mock
from vcr import VCR
from subliminal import (ProviderPool, check_video, d... | oxan/subliminal | tests/test_api.py | Python | mit | 11,165 |
from autotest_lib.client.common_lib import error
from autotest_lib.client.bin import test
class aborttest(test.test):
version = 1
def execute(self):
raise error.JobError('Arrrrrrrrggggh. You are DOOOMED')
| clebergnu/autotest | client/tests/aborttest/aborttest.py | Python | gpl-2.0 | 223 |
#!/usr/bin/env python
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redistribute it and/or mod... | staute/shinken_package | cli/shinkenio/cli.py | Python | agpl-3.0 | 21,282 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | nathanaevitas/odoo | openerp/addons/stock/stock.py | Python | agpl-3.0 | 270,249 |
try:
import inspect
except:
try:
import _pydev_inspect as inspect # for older versions
except:
import traceback;traceback.print_exc() #Ok, no inspect available (search will not work)
try:
import re
except:
try:
import _pydev_re as re # for older versions @UnresolvedImport
... | hinesmr/mica | util/pydevd/pysrc/_pydev_tipper_common.py | Python | apache-2.0 | 1,704 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Remove deprecated tables
Revision ID: 235b7b9989be
Revises: 2b1ba26f2123
Create Date: 2014-08-04 20:34:04.786894
"""
# revision identifiers, used by Alembic.
revision = '235b7b9989be'
down_revision = ... | andrei-karalionak/ggrc-core | src/ggrc_workflows/migrations/versions/20140804203404_235b7b9989be_remove_deprecated_tables.py | Python | apache-2.0 | 560 |
# Copyright 2013 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
#
# Unless required by applicable law or agreed to in w... | reeshupatel/demo | keystone/tests/ksfixtures/appserver.py | Python | apache-2.0 | 2,648 |
#!/usr/bin/env python
"""
@package mi.dataset.driver.dbg_pdbg.cspp
@file mi/dataset/driver/dbg_pdbg/cspp/dbg_pdbg_cspp_recovered_driver.py
@author Jeff Roy
@brief Driver for the dbg_pdbg_cspp instrument
Release notes:
Initial Release
"""
from mi.dataset.dataset_parser import DataSetDriverConfigKeys
from mi.dataset.... | janeen666/mi-instrument | mi/dataset/driver/dbg_pdbg/cspp/dbg_pdbg_cspp_recovered_driver.py | Python | bsd-2-clause | 2,149 |
"""
=========================================
Reading/Writing a noise covariance matrix
=========================================
How to plot a noise covariance matrix.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD-3-Clause
# %%
from os import path as op
import mne
from mne.datasets... | mne-tools/mne-tools.github.io | stable/_downloads/015cfbeb818b1cad0d29b832d89e12c2/read_noise_covariance_matrix.py | Python | bsd-3-clause | 668 |
##########################################################################
#
# Copyright (c) 2020, Cinesite VFX Ltd. 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 ... | hradec/gaffer | python/GafferSceneUI/CurveSamplerUI.py | Python | bsd-3-clause | 2,954 |