code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 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 ca... | claneys/shinken | shinken/dispatcher.py | Python | agpl-3.0 | 31,411 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from collections imp... | sameerparekh/pants | src/python/pants/engine/round_manager.py | Python | apache-2.0 | 2,387 |
"""Test component/platform setup."""
# pylint: disable=protected-access
import asyncio
import os
from unittest import mock
import threading
import logging
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import EVENT_HOMEASSISTANT_START
import homeassistant.config as config_ut... | JshWright/home-assistant | tests/test_setup.py | Python | apache-2.0 | 14,933 |
# Base classes for ASN.1 types
import sys
from pyasn1.type import constraint, tagmap
from pyasn1 import error
class Asn1Item: pass
class Asn1ItemBase(Asn1Item):
# Set of tags for this ASN.1 type
tagSet = ()
# A list of constraint.Constraint instances for checking values
subtypeSpec = constraint.Const... | jt6562/XX-Net | python27/1.0/lib/noarch/pyasn1/type/base.py | Python | bsd-2-clause | 9,450 |
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import unittest
import numpy as np
import GPy
class MiscTests(unittest.TestCase):
def setUp(self):
self.N = 20
self.N_new = 50
self.D = 1
self.X = np.random.uniform(-3.... | ptonner/GPy | GPy/testing/model_tests.py | Python | bsd-3-clause | 25,915 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import sys
from base64 import b64decode
from kombu.exceptions import ContentDisallowed, EncodeError, DecodeError
from kombu.five import text_t, bytes_t
from kombu.serialization import (
regist... | iris-edu-int/kombu | kombu/tests/test_serialization.py | Python | bsd-3-clause | 11,687 |
"""Undocumented Module"""
__all__ = ['Transitions']
from panda3d.core import *
from direct.gui.DirectGui import *
from direct.interval.LerpInterval import LerpColorScaleInterval, LerpColorInterval, LerpScaleInterval, LerpPosInterval
from direct.interval.MetaInterval import Sequence, Parallel
from direct.interval.Func... | hj3938/panda3d | direct/src/showbase/Transitions.py | Python | bsd-3-clause | 17,107 |
# A sample shell copy hook.
# To demostrate:
# * Execute this script to register the context menu.
# * Open Windows Explorer
# * Attempt to move or copy a directory.
# * Note our hook's dialog is displayed.
import sys, os
import pythoncom
from win32com.shell import shell, shellcon
import win32gui
import win32con
impor... | sserrot/champion_relationships | venv/Lib/site-packages/win32comext/shell/demos/servers/copy_hook.py | Python | mit | 2,881 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
flightlinesToDTMandDSM.py
---------------------
Date : April 2014
Copyright : (C) 2014 by Martin Isenburg
Email : martin near rapidlasso point com
******... | herow/planning_qgis | python/plugins/processing/algs/lidar/lastools/flightlinesToDTMandDSM.py | Python | gpl-2.0 | 6,225 |
# 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... | infinyte/oppia | extensions/interactions/base.py | Python | apache-2.0 | 9,346 |
# Copyright (C) 2010 Jim Washington
#
# 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... | Hasimir/pyjs | pyjswidgets/pyjamas/dnd/__init__.py | Python | apache-2.0 | 1,972 |
import unittest
import logging
#from datetime import datetime, timedelta
#from google.appengine.api import memcache
from google.appengine.ext import ndb
from google.appengine.ext import testbed
import model
class TestConfig(unittest.TestCase):
def setUp(self):
# First, create an instance of the Testbed class.
... | Rio517/pledgeservice | unittests/test_Model.py | Python | apache-2.0 | 4,051 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | HybridF5/tempest_debug | tempest/lib/services/compute/limits_client.py | Python | apache-2.0 | 1,138 |
# 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.
"""The page cycler measurement.
This measurement registers a window load handler in which is forces a layout and
then records the value of performance.now()... | hujiajie/chromium-crosswalk | tools/perf/measurements/page_cycler.py | Python | bsd-3-clause | 6,509 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.freesurfer.preprocess import ApplyVolTransform
def test_ApplyVolTransform_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
fs_ta... | JohnGriffiths/nipype | nipype/interfaces/freesurfer/tests/test_auto_ApplyVolTransform.py | Python | bsd-3-clause | 2,611 |
import unittest
from test import test_support
class DictSetTest(unittest.TestCase):
def test_constructors_not_callable(self):
kt = type({}.viewkeys())
self.assertRaises(TypeError, kt, {})
self.assertRaises(TypeError, kt)
it = type({}.viewitems())
self.assertRaises... | ktan2020/legacy-automation | win/Lib/test/test_dictviews.py | Python | mit | 6,667 |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | Tatsh-ansible/ansible | lib/ansible/modules/cloud/google/gce_instance_template.py | Python | gpl-3.0 | 19,433 |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | luogangyi/bcec-nova | nova/api/openstack/compute/plugins/v3/server_metadata.py | Python | apache-2.0 | 7,733 |
"""
System services
===============
This module provides low-level tools for managing system services,
using the ``service`` command. It supports both `upstart`_ services
and traditional SysV-style ``/etc/init.d/`` scripts.
.. _upstart: http://upstart.ubuntu.com/
"""
from fabric.api import hide, settings
from fabt... | ronnix/fabtools | fabtools/service.py | Python | bsd-2-clause | 3,226 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-MetasploitPayload',
'Author': ['@jaredhaight'],
'Description': ('Spawns a new, hidden PowerShell window that downloads'
'and ... | EmpireProject/Empire | lib/modules/powershell/code_execution/invoke_metasploitpayload.py | Python | bsd-3-clause | 2,826 |
"""
SGMLParser-based Link extractors
"""
from six.moves.urllib.parse import urljoin
import warnings
from sgmllib import SGMLParser
from w3lib.url import safe_url_string
from scrapy.selector import Selector
from scrapy.link import Link
from scrapy.linkextractor import FilteringLinkExtractor
from scrapy.utils.misc impor... | hy-2013/scrapy | scrapy/contrib/linkextractors/sgml.py | Python | bsd-3-clause | 5,233 |
# -*-coding:utf-8 -*
# Copyright (c) 2011-2015, Intel Corporation
# 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, thi... | Makohoek/parameter-framework | test/functional-tests/PfwTestCase/Domains/tDomain_Elements.py | Python | bsd-3-clause | 16,700 |
# (c) 2016, Charles Paul <cpaul@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versio... | ravibhure/ansible | lib/ansible/utils/module_docs_fragments/vca.py | Python | gpl-3.0 | 2,639 |
import os
import tempfile
import uuid
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.core.files.storage import FileSystemStorage
from django.db import models
from django.db.models.fields.files import Imag... | EmadMokhtar/Django | tests/model_fields/models.py | Python | mit | 12,373 |
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2009, Eucalyptus Systems, Inc.
# All rights reserved.
#
# 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 res... | harshilasu/GraphicMelon | y/google-cloud-sdk/platform/gsutil/third_party/boto/tests/integration/ec2/test_connection.py | Python | gpl-3.0 | 8,892 |
import os
import re
import yaml
import types
from keystoneclient.auth.identity import v2
from keystoneclient import session
from keystoneclient.v2_0.client import Client as keyclient
class OpenStack(object):
def __init__(self, conf):
config_file = os.path.join(os.path.dirname(__file__), conf)
tr... | armab/st2contrib | packs/openstack/actions/lib/openstack.py | Python | apache-2.0 | 2,933 |
#
# 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... | ueshin/apache-spark | python/pyspark/sql/catalog.py | Python | apache-2.0 | 16,780 |
# Copyright 2013 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... | luogangyi/bcec-nova | nova/tests/objects/test_instance.py | Python | apache-2.0 | 50,449 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | zenodo/invenio | invenio/modules/workflows/testsuite/test_workflows_delayed.py | Python | gpl-2.0 | 7,683 |
"""
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... | waterponey/scikit-learn | sklearn/linear_model/ridge.py | Python | bsd-3-clause | 51,357 |
# -*- coding: utf-8 -*-
"""
Event objects for the notification system.
These are intended to be used within event handlers such as
`~trigger.utils.notifications.handlers.email_handler()`.
If not customized within :setting:`NOTIFICATION_HANDLERS`, the default
notification type is an `~trigger.utils.notification.event... | coxley/trigger | trigger/utils/notifications/events.py | Python | bsd-3-clause | 4,682 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | thaim/ansible | lib/ansible/modules/cloud/kubevirt/kubevirt_template.py | Python | mit | 14,884 |
# -*- test-case-name: nevow.test.test_appserver -*-
# Copyright (c) 2004 Divmod.
# See LICENSE for details.
"""A web application server built using twisted.web
"""
import cgi
from copy import copy
from urllib import unquote
from types import StringType
import warnings
from twisted.web import server
from twisted.web... | mclois/iteexe | nevow/appserver.py | Python | gpl-2.0 | 13,064 |
# 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... | bw4sz/DeepMeerkat | training/Detection/object_detection/trainer_test.py | Python | gpl-3.0 | 6,550 |
r"""
A simple, fast, extensible JSON encoder and decoder
JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
simplejson exposes an API familiar to uses of the standard library
marshal and pickle modules.
Encoding b... | zepheira/exhibit | src/webapp/api/extensions/curate/files/admin/simplejson/__init__.py | Python | bsd-3-clause | 10,786 |
import logging
import os
import sys
PROJECT_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
# Overrides for os.environ
env_ext = {'DJANGO_SETTINGS_MODULE': 'settings'}
def setup_env():
"""Configures app engine environment for command-line apps."""
# Try to import the appengine code from the... | MediaSapiens/wavesf | djangoappengine/boot.py | Python | bsd-3-clause | 7,691 |
#!/usr/bin/env python
# File created on 02 May 2012
from __future__ import division
__author__ = "William Van Treuren"
__copyright__ = "Copyright 2011, The QIIME project"
__credits__ = ["William Van Treuren"]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__maintainer__ = "William Van Treuren"
__email__ = "wdwvt1@gmail... | adamrp/qiime | tests/test_relatedness.py | Python | gpl-2.0 | 7,588 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class SalesStage(Document):
pass
| ovresko/erpnext | erpnext/crm/doctype/sales_stage/sales_stage.py | Python | gpl-3.0 | 276 |
# -*- coding: utf-8 -*-
import markupsafe
from modularodm import fields
from framework.auth.decorators import Auth
from website.models import NodeLog
from website.addons.base import exceptions
from website.addons.base import AddonNodeSettingsBase, AddonUserSettingsBase
from website.addons.base import StorageAddonBas... | zachjanicki/osf.io | website/addons/figshare/model.py | Python | apache-2.0 | 13,145 |
# Copyright 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 requ... | hayderimran7/tempest | tempest/api/network/test_extra_dhcp_options.py | Python | apache-2.0 | 4,057 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from oscar.core.compat import AUTH_USER_MODEL, AUTH_USER_MODEL_NAME
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'PaymentEvent.reference'
... | jinnykoo/christmas | src/oscar/apps/order/south_migrations/0012_auto__add_field_paymentevent_reference.py | Python | bsd-3-clause | 33,777 |
# coding=utf-8
"""
PayPalResponse parsing and processing.
"""
import logging
from pprint import pformat
from vendor.paypalapi.compat import is_py3
if is_py3:
#noinspection PyUnresolvedReferences
from urllib.parse import parse_qs
else:
# Python 2.6 and up (but not 3.0) have urlparse.parse_qs, which is cop... | AlphaCluster/NewsBlur | vendor/paypalapi/response.py | Python | mit | 4,173 |
from redash.models import db, QuerySnippet
if __name__ == '__main__':
with db.database.transaction():
if not QuerySnippet.table_exists():
QuerySnippet.create_table()
db.close_db(None)
| stefanseifert/redash | old_migrations/0025_add_query_snippets_table.py | Python | bsd-2-clause | 214 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Delivery Costs',
'version': '1.0',
'category': 'Stock',
'description': """
Allows you to add delivery methods in sale orders and picking.
======================================================... | vileopratama/vitech | src/addons/delivery/__openerp__.py | Python | mit | 886 |
# 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... | takeshineshiro/keystone | keystone/token/persistence/backends/memcache_pool.py | Python | apache-2.0 | 1,016 |
from distutils import log
import distutils.command.sdist as orig
import os
import sys
import io
import contextlib
from setuptools.extern import six, ordered_set
from .py36compat import sdist_add_defaults
import pkg_resources
_default_revctrl = list
def walk_revctrl(dirname=''):
"""Find all files under revisio... | sserrot/champion_relationships | venv/Lib/site-packages/setuptools/command/sdist.py | Python | mit | 8,092 |
#!/usr/bin/env python2
#-*-indent-tabs-mode: nil-*-
import sys
import os.path
import gi
from gi.repository import Gtk, Gio
SCHEMAS = "org.cinnamon.desklets.launcher"
LAUNCHER_KEY = "launcher-list"
HOME_DIR = os.path.expanduser("~")+"/"
CUSTOM_LAUNCHERS_PATH = HOME_DIR + ".cinnamon/panel-launchers/"
EDITOR_DIALOG_UI... | artourkin/Cinnamon | files/usr/share/cinnamon/desklets/launcher@cinnamon.org/editorDialog.py | Python | gpl-2.0 | 8,165 |
# 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.
import logging
import os
import subprocess
import sys
import tempfile
from telemetry.core import exceptions
from telemetry.internal.platform import profiler... | Chilledheart/chromium | tools/telemetry/telemetry/internal/platform/profiler/vtune_profiler.py | Python | bsd-3-clause | 5,290 |
import nose
def run_module(name, file):
"""Run current test cases of the file.
Args:
name: __name__ attrinute of the file.
file: __file__ attribute of the file.
"""
if name == '__main__':
nose.runmodule(argv=[file, '-vvs', '-x', '--pdb', '--pdb-failure'],
... | sou81821/chainer | chainer/testing/__init__.py | Python | mit | 336 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
from __future__ import division, print_function
import sys
import numpy as np
from time import sleep
from ..util.event import EmitterGroup, Event, WarningEmitter
from ..util... | sh4wn/vispy | vispy/app/canvas.py | Python | bsd-3-clause | 26,614 |
#!/usr/bin/python
# (c) 2016, Tomas Karasek <tom.to.the.k@gmail.com>
# (c) 2016, Matt Baldwin <baldwin@stackpointcloud.com>
# (c) 2016, Thibaud Morel l'Horset <teebes@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General P... | j00bar/ansible | lib/ansible/modules/cloud/packet/packet_device.py | Python | gpl-3.0 | 18,501 |
import operator
import functools
from optparse import make_option
from django.core.management.base import BaseCommand
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.db.models import Q
from django.utils import six
from wagtail.wagtailcore.models import Page
class Comma... | mephizzle/wagtail | wagtail/wagtailcore/management/commands/fixtree.py | Python | bsd-3-clause | 5,041 |
#!/usr/bin/env python
import time
import random
import xmlrpclib
#create server object
s = xmlrpclib.Server("http://localhost:1234")
#randomly change parameters of the sinusoid
for i in range(10):
#generate random values
new_freq = random.uniform(0, 5000)
new_ampl = random.uniform(0, 2)
new_offset = random.unifo... | gnu-sandhi/sandhi | modules/gr36/grc/examples/xmlrpc/xmlrpc_client_script.py | Python | gpl-3.0 | 463 |
#!/usr/bin/python
# Tool to compare MPlayer translation files against a base file. Reports
# conflicting definitions, mismatching arguments, extra definitions
# not present in the base file and (optionally) missing definitions.
# Written by Uoti Urpala
import sys
import re
def parse(filename):
r = {}
f = op... | philipl/mplayer | TOOLS/mphelp_check.py | Python | gpl-2.0 | 2,073 |
import base_product_merge
| 3dfxsoftware/cbss-addons | product_do_merge/wizard/__init__.py | Python | gpl-2.0 | 26 |
from twisted.spread import pb
class QuoteReader(pb.Root):
def __init__(self, quoter):
self.quoter = quoter
def remote_nextQuote(self):
return self.quoter.getQuote()
| mzdaniel/oh-mainline | vendor/packages/twisted/doc/core/howto/listings/TwistedQuotes/pbquote.py | Python | agpl-3.0 | 193 |
# 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... | gunan/tensorflow | tensorflow/python/kernel_tests/aggregate_ops_test.py | Python | apache-2.0 | 5,147 |
from bears.python.requirements.PinRequirementsBear import PinRequirementsBear
from coalib.testing.LocalBearTestHelper import verify_local_bear
majors_given = """
# So this file contains majors, minors and patch versions
coala==0
coala-bears==0.8
coala-utils==0.5.0
"""
minors_given = """
# So this file contains major... | coala/coala-bears | tests/python/requirements/PinRequirementsBearTest.py | Python | agpl-3.0 | 857 |
""" docstring for file clientmodule.py """
from data2.suppliermodule_test import Interface as IFace, DoNothing
class Toto: pass
class Ancestor:
""" Ancestor method """
__implements__ = (IFace,)
def __init__(self, value):
local_variable = 0
self.attr = 'this method shouldn\'t have a docstr... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/logilab/astng/test/data2/clientmodule_test.py | Python | agpl-3.0 | 801 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Kevin Breit (@kbreit) <kevin.breit@kevinbreit.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
... | hryamzik/ansible | lib/ansible/modules/network/meraki/meraki_mx_l3_firewall.py | Python | gpl-3.0 | 11,897 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Laurent Mignon
# Copyright 2014 'ACSONE SA/NV'
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | cgstudiomap/cgstudiomap | main/parts/server-tools/auth_from_http_remote_user/res_users.py | Python | agpl-3.0 | 2,630 |
__all__ = [
"beast"
, "human"
]
| sushengyang/Data-Science-45min-Intros | python-oop/life/__init__.py | Python | unlicense | 57 |
from __future__ import division
import numpy as np
from numpy.testing import run_module_suite
from scipy.sparse import csr_matrix
from sklearn.utils.testing import (assert_array_equal, assert_almost_equal,
assert_false, assert_raises, assert_equal,
... | Titan-C/scikit-learn | sklearn/feature_selection/tests/test_mutual_info.py | Python | bsd-3-clause | 6,881 |
def main(request, response):
import simplejson as json
f = file('config.json')
source = f.read()
s = json.JSONDecoder().decode(source)
url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1])
url2 = "http://" + s['host'] + ":" + str(s['ports']['http'][0])
_CSP = "object-src " + url2
... | hgl888/web-testing-service | wts/tests/csp/csp_object-src_cross-origin_blocked-manual.py | Python | bsd-3-clause | 2,473 |
from tests.package.test_python import TestPythonPackageBase
class TestPythonPy2Subprocess32(TestPythonPackageBase):
__test__ = True
config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_SUBPROCESS32=y
"""
sample_scripts = ["tests/package/samp... | masahir0y/buildroot-yamada | support/testing/tests/package/test_python_subprocess32.py | Python | gpl-2.0 | 348 |
# 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.
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class FallbackViaHeaderPage(page_module.Page):
def... | sencha/chromium-spacewalk | tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/fallback_viaheader.py | Python | bsd-3-clause | 701 |
"""
Giving models a custom manager
You can use a custom ``Manager`` in a particular model by extending the base
``Manager`` class and instantiating your custom ``Manager`` in your model.
There are two reasons you might want to customize a ``Manager``: to add extra
``Manager`` methods, and/or to modify the initial ``Q... | tbeadle/django | tests/custom_managers/models.py | Python | bsd-3-clause | 7,050 |
#
# Copyright (c) 2017 Apstra Inc, <community@apstra.com>
#
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the m... | tux-00/ansible | lib/ansible/module_utils/aos.py | Python | gpl-3.0 | 5,550 |
# 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.
"""Tests for the AdbWrapper class."""
import os
import tempfile
import time
import unittest
from pylib.device import adb_wrapper
from pylib.device import d... | appknox/xysec_adb | xysec_adb/pylib/device/adb_wrapper_test.py | Python | apache-2.0 | 2,716 |
#!/usr/bin/env python
# Small wrapper script for weeder2, which needs the FreqFiles directory
# where it is executed. This script allows running weeder2 from anywhere.
import os
import sys
import argparse
import subprocess as sp
# Weeder install dir
weeder_dir = os.path.realpath(os.path.join(os.path.dirname(__file__),... | roryk/recipes | recipes/weeder/weeder2.py | Python | mit | 833 |
from flask import Flask, redirect, request
import flask_admin as admin
from flask.views import MethodView
class ViewWithMethodViews(admin.BaseView):
@admin.expose('/')
def index(self):
return self.render('methodtest.html')
@admin.expose_plugview('/_api/1')
class API_v1(MethodView):
d... | radioprotector/flask-admin | examples/methodview/app.py | Python | bsd-3-clause | 1,160 |
from constraint_solver import pywrapcp
def main():
solver = pywrapcp.Solver("time limit test")
n = 10
x = [solver.IntVar(1, n, "x[%i]" % i) for i in range(n)]
solver.Add(solver.AllDifferent(x, True))
solution = solver.Assignment()
solution.Add(x)
db = solver.Phase(x,
solver.CHOOSE_... | capturePointer/or-tools | examples/tests/issue4.py | Python | apache-2.0 | 1,031 |
"""The pioneer component."""
| aronsky/home-assistant | homeassistant/components/pioneer/__init__.py | Python | apache-2.0 | 29 |
import click
from complex.cli import pass_context
@click.command('status', short_help='Shows file changes.')
@pass_context
def cli(ctx):
"""Shows file changes in the current working directory."""
ctx.log('Changed files: none')
ctx.vlog('bla bla bla, debug info')
| staranjeet/fjord | vendor/packages/click/examples/complex/complex/commands/cmd_status.py | Python | bsd-3-clause | 277 |
##############################################################################
#
# 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 Affero General Public L... | jmesteve/saas3 | openerp/addons/crm/wizard/crm_merge_opportunities.py | Python | agpl-3.0 | 4,577 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import parse_filesize
class TagesschauIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tagesschau\.de/multimedia/(?:sendung/ts|video/video)(?P<id>-?[0-9]+)\.html'
_TESTS = [{
... | apllicationCOM/youtube-dl-api-server | youtube_dl_server/youtube_dl/extractor/tagesschau.py | Python | unlicense | 4,945 |
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is dis... | qrkourier/ansible | test/units/modules/network/nxos/test_nxos_feature.py | Python | gpl-3.0 | 2,591 |
import collections
import configparser
import io
import os
import sys
import textwrap
import unittest
import warnings
from test import support
class SortedDict(collections.UserDict):
def items(self):
return sorted(self.data.items())
def keys(self):
return sorted(self.data.keys())
def va... | 837468220/python-for-android | python3-alpha/python3-src/Lib/test/test_cfgparser.py | Python | apache-2.0 | 59,709 |
# -*- coding: utf-8 -*-
# (c) 2015, Toshio Kuratomi <tkuratomi@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (a... | goozbach/ansible | test/units/module_utils/basic/test_heuristic_log_sanitize.py | Python | gpl-3.0 | 3,908 |
# Author: Trevor Perrin
# See the LICENSE file for legal information regarding use of this file.
"""TLS Lite is a free python library that implements SSL and TLS. TLS Lite
supports RSA and SRP ciphersuites. TLS Lite is pure python, however it can use
other libraries for faster crypto operations. TLS Lite integrates wi... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/third_party/tlslite/tlslite/__init__.py | Python | mit | 904 |
"""
This package contains algorithms for extracting document representations from their raw
bag-of-word counts.
"""
# bring model classes directly into package namespace, to save some typing
from .hdpmodel import HdpModel
from .ldamodel import LdaModel
from .lsimodel import LsiModel
from .tfidfmodel import TfidfModel
... | krishna11888/ai | third_party/gensim/gensim/models/__init__.py | Python | gpl-2.0 | 1,920 |
"""Simple code to extract class & function docstrings from a module.
This code is used as an example in the library reference manual in the
section on using the parser module. Refer to the manual for a thorough
discussion of the operation of this code.
"""
import os
import parser
import symbol
import token
import ty... | xbmc/atv2 | xbmc/lib/libPython/Python/Demo/parser/example.py | Python | gpl-2.0 | 5,722 |
import unittest
class FileWidgetWalk(unittest.TestCase):
def test_walk_large_tree(self):
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
''' the tree
BoxLayout
BoxLayout
Label
10 labels
BoxLayout
... | KeyWeeUsr/kivy | kivy/tests/test_widget_walk.py | Python | mit | 1,888 |
# (c) 2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... | camradal/ansible | lib/ansible/utils/display.py | Python | gpl-3.0 | 11,938 |
from clang.cindex import CursorKind
from clang.cindex import Index
from clang.cindex import SourceLocation
from clang.cindex import SourceRange
from clang.cindex import TokenKind
from nose.tools import eq_
from nose.tools import ok_
from .util import get_tu
def test_token_to_cursor():
"""Ensure we can obtain a Cu... | cd80/UtilizedLLVM | tools/clang/bindings/python/tests/cindex/test_tokens.py | Python | unlicense | 1,384 |
from django.db import models
from django.test import TestCase
from .models import (
Book, Car, CustomManager, CustomQuerySet, DeconstructibleCustomManager,
FastCarAsBase, FastCarAsDefault, FunPerson, OneToOneRestrictedModel,
Person, PersonFromAbstract, PersonManager, PublishedBookManager,
RelatedModel,... | nesdis/djongo | tests/django_tests/tests/v22/tests/custom_managers/tests.py | Python | agpl-3.0 | 25,648 |
"""
Mail.ru OAuth2 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/mailru.html
"""
from hashlib import md5
from social.p3 import unquote
from social.backends.oauth import BaseOAuth2
class MailruOAuth2(BaseOAuth2):
"""Mail.ru authentication backend"""
name = 'mailru-oauth2'
ID_KEY = 'uid'... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/social/backends/mailru.py | Python | agpl-3.0 | 1,693 |
def func(a):
pass
func(a=1)
| asedunov/intellij-community | python/testData/refactoring/changeSignature/keywordParam.before.py | Python | apache-2.0 | 31 |
# Copyright 2012 Nebula, 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 agree... | ChinaMassClouds/copenstack-server | openstack/src/horizon-2014.2/horizon/browsers/breadcrumb.py | Python | gpl-2.0 | 1,803 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutDecoratingWithFunctions(Koan):
def addcowbell(fn):
fn.wow_factor = 'COWBELL BABY!'
return fn
@addcowbell
def mediocre_song(self):
return "o/~ We all live in a broken submarine o/~"
def test_de... | Krakn/learning | src/python/python_koans/python2/about_decorating_with_functions.py | Python | isc | 832 |
# -*- coding: utf-8 -*-
import paypal
import res_company
| diogocs1/comps | web/addons/payment_paypal/models/__init__.py | Python | apache-2.0 | 58 |
# Sample script for use by test_gdb.py
def foo(a, b, c):
bar(a, b, c)
def bar(a, b, c):
baz(a, b, c)
def baz(*args):
id(42)
foo(1, 2, 3)
| firmlyjin/brython | www/tests/unittests/test/gdb_sample.py | Python | bsd-3-clause | 153 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Filters
=======
Filter bank construction
------------------------
.. autosummary::
:toctree: generated/
mel
chroma
constant_q
semitone_filterbank
Window functions
----------------
.. autosummary::
:toctree: generated/
window_bandwidth
... | bmcfee/librosa | librosa/filters.py | Python | isc | 37,764 |
import re
import textwrap
__all__ = ['dumps', 'loads']
SPLIT_ITEMS = re.compile(r'\n(?!\s)').split
MATCH_ITEM = re.compile(r'''
(?P<key>\w+): # key
\s?
(?P<value>.*?)$ # first line
(?P<value2>.+)? # optional continuation line(s)
''', re.MULTILINE | re.DOTALL | re.VERBOSE).match
def... | natano/python-git-orm | git_orm/serializer.py | Python | isc | 1,101 |
from django.db import models
from django.shortcuts import reverse
from users.models import Member
body_size = 32768
class Forum(models.Model):
parent = models.ForeignKey(
'self',
on_delete=models.CASCADE,
blank=True, null=True,
related_name='subforums')
sort_index = models.I... | ashbc/tgrsite | forum/models.py | Python | isc | 5,132 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-10-02 21:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("order", "0004_auto_20160111_1108"),
("wellsfargo", ... | thelabnyc/django-oscar-wfrs | src/wellsfargo/migrations/0008_fraudscreenresult.py | Python | isc | 1,998 |
import pytest
def test_zero_division():
with pytest.raises(ZeroDivisionError):
1 / 0
def test_recursion_depth():
with pytest.raises(RuntimeError) as excinfo:
def f():
f()
f()
assert 'maximum recursion depth exceeded' in str(excinfo.value)
| jskksj/cv2stuff | cv2stuff/tests/test_exception.py | Python | isc | 307 |
#!/usr/bin/env python
# encoding: utf-8
"""
${TM_NEW_FILE_BASENAME}.py
Created by ${TM_FULLNAME} on ${TM_DATE}.
Copyright (c) ${TM_YEAR} ${TM_ORGANIZATION_NAME}. All rights reserved.
"""
from __future__ import absolute_import, division, print_function
import sys
import os
import unittest
class ${TM_NEW_FILE_BASENAM... | rcuza/init | devops/templates/python/python_class.py | Python | isc | 501 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020-2022 F4PGA Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | SymbiFlow/prjuray | fuzzers/002-tilegrid/clel_int/top.py | Python | isc | 2,848 |
from setuptools import setup
setup(
name='PyInq',
version='0.2.1',
author='Austin Noto-Moniz',
author_email='pyinq.test@gmail.com',
url='http://auzzy.github.io/pyinq/',
packages=['pyinq', 'pyinq.asserts', 'pyinq.tags', 'pyinq.printers', 'pyinq.printers.html', 'pyinq.printers.cli', 'pyinq.printe... | Auzzy/pyinq | setup.py | Python | isc | 915 |