code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# Copyright (c) 2006-2007 The Regents of The University of Michigan
# 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 ... | aferr/LatticeMemCtl | configs/example/memtest.py | Python | bsd-3-clause | 7,651 |
# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2016 Google, Inc
# Written by Simon Glass <sjg@chromium.org>
#
# Entry-type module for the 16-bit x86 reset code for U-Boot
#
from binman.entry import Entry
from binman.etype.blob import Entry_blob
class Entry_x86_reset16(Entry_blob):
"""x86 16-bit reset code fo... | Digilent/u-boot-digilent | tools/binman/etype/x86_reset16.py | Python | gpl-2.0 | 1,018 |
# -*- coding: utf-8 -*-
#
# twoneurons.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 the License, or
... | kristoforcarlson/nest-simulator-fork | pynest/examples/twoneurons.py | Python | gpl-2.0 | 1,209 |
# -*- coding: utf-8 -*-
'''
Specto Add-on
Copyright (C) 2015 lambda
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 l... | azumimuo/family-xbmc-addon | plugin.video.specto/resources/lib/resolvers/cloudmailru.py | Python | gpl-2.0 | 1,296 |
import StringIO
class Plugin(object):
ANGULAR_MODULE = None
JS_FILES = []
CSS_FILES = []
@classmethod
def PlugIntoApp(cls, app):
pass
@classmethod
def GenerateHTML(cls, root_url="/"):
out = StringIO.StringIO()
for js_file in cls.JS_FILES:
js_file = js... | dsweet04/rekall | rekall-gui/manuskript/plugin.py | Python | gpl-2.0 | 836 |
#
# Copyright (C) 2016 FreeIPA Contributors see COPYING for license
#
# pylint: disable=unused-import
import six
from . import Command, Method, Object
from ipalib import api, parameters, output
from ipalib.parameters import DefaultFrom
from ipalib.plugable import Registry
from ipalib.text import _
from ipapython.dn ... | redhatrises/freeipa | ipaclient/remote_plugins/2_164/passwd.py | Python | gpl-3.0 | 2,428 |
# coding=utf-8
# Copyright 2015 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)
import os
import shu... | sameerparekh/pants | src/python/pants/util/fileutil.py | Python | apache-2.0 | 961 |
"""Support for the MAX! Cube LAN Gateway."""
import logging
from socket import timeout
from threading import Lock
import time
from maxcube.cube import MaxCube
import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_SCAN_INTERVAL
import homeassistant.helpers.config_validation as cv
from hom... | jawilson/home-assistant | homeassistant/components/maxcube/__init__.py | Python | apache-2.0 | 3,289 |
#
# Copyright 2015 Cisco 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 writing... | cernops/ceilometer | ceilometer/tests/unit/publisher/test_kafka_broker_publisher.py | Python | apache-2.0 | 8,865 |
#!/usr/bin/python2.4
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of... | nguyentran/openviber | tools/swtoolkit/site_scons/site_tools/collada_dom.py | Python | mit | 1,817 |
"""
Utility function to facilitate testing.
"""
from __future__ import division, absolute_import, print_function
import os
import sys
import re
import operator
import warnings
from functools import partial
import shutil
import contextlib
from tempfile import mkdtemp, mkstemp
from .nosetester import import_nose
from ... | MyRookie/SentimentAnalyse | venv/lib/python2.7/site-packages/numpy/testing/utils.py | Python | mit | 66,431 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf import settings
def duplicate_txn_id(ipn_obj):
"""Returns True if a record with this transaction id exists and it is not
a payment which has gone from pending to completed.
"""
query = ipn_obj._default_manager.filter(txn_id = ipn_obj.t... | zsuzhengdu/camp | paypal/standard/helpers.py | Python | mit | 2,448 |
'''tzinfo timezone information for US/Eastern.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Eastern(DstTzInfo):
'''US/Eastern timezone definition. See datetime.tzinfo for details'''
zone = 'US/Eastern'
_utc_transi... | newvem/pytz | pytz/zoneinfo/US/Eastern.py | Python | mit | 9,981 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | GirlsCodePy/girlscode-coursebuilder | modules/ajax_registry/registry.py | Python | gpl-3.0 | 1,249 |
# Copyright (c) 2014 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 ... | ekasitk/sahara | sahara/tests/tempest/scenario/data_processing/client_tests/test_data_sources.py | Python | apache-2.0 | 3,802 |
from __future__ import absolute_import
from typing import Callable, Tuple, Text
from django.conf import settings
from diff_match_patch import diff_match_patch
import platform
import logging
# TODO: handle changes in link hrefs
def highlight_with_class(klass, text):
# type: (Text, Text) -> Text
return '<spa... | niftynei/zulip | zerver/lib/html_diff.py | Python | apache-2.0 | 4,261 |
"""Print 'Hello World' every two seconds, using a coroutine."""
import asyncio
@asyncio.coroutine
def greet_every_two_seconds():
while True:
print('Hello World')
yield from asyncio.sleep(2)
if __name__ == '__main__':
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(g... | gvanrossum/asyncio | examples/hello_coroutine.py | Python | apache-2.0 | 380 |
import pandas as pd
import pandas.util.testing as tm
from pandas import compat
from pandas.io.sas import XportReader, read_sas
import numpy as np
import os
# CSV versions of test XPT files were obtained using the R foreign library
# Numbers in a SAS xport file are always float64, so need to convert
# before making co... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/pandas/io/tests/test_sas.py | Python | artistic-2.0 | 3,638 |
from olympia import amo
import mkt
from mkt.webapps.models import AddonExcludedRegion
def run():
"""Unleash payments in USA."""
(AddonExcludedRegion.objects
.exclude(addon__premium_type=amo.ADDON_FREE)
.filter(region=mkt.regions.US.id).delete())
| harikishen/addons-server | src/olympia/migrations/532-unleash-payments-in-usa.py | Python | bsd-3-clause | 266 |
#
# Chris Lumens <clumens@redhat.com>
#
# Copyright 2005, 2006, 2007 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. This program is distributed in the hope that it
# ... | marcosbontempo/inatelos | poky-daisy/scripts/lib/mic/3rdparty/pykickstart/commands/mouse.py | Python | mit | 2,610 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import json
import datetime
import mimetypes
import os
import frappe
from frappe import _
import frappe.model.document
import frappe.utils
import frappe.sessions
import werkzeug.u... | gangadharkadam/saloon_frappe | frappe/utils/response.py | Python | mit | 4,943 |
#
# Chris Lumens <clumens@redhat.com>
#
# Copyright 2007 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. This program is distributed in the hope that it
# will be usef... | marcosbontempo/inatelos | poky-daisy/scripts/lib/mic/3rdparty/pykickstart/commands/bootloader.py | Python | mit | 9,658 |
# -*- coding: utf-8 -*-
'''
Specto Add-on
Copyright (C) 2015 lambda
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 l... | felipenaselva/repo.felipe | plugin.video.specto/resources/lib/sources/disabled/directdl_tv.py | Python | gpl-2.0 | 4,247 |
"""Ansible integration test infrastructure."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import contextlib
import json
import os
import shutil
import tempfile
from .. import types as t
from ..target import (
analyze_integration_target_dependencies,
walk_integrati... | kvar/ansible | test/lib/ansible_test/_internal/integration/__init__.py | Python | gpl-3.0 | 11,813 |
"""Tests for the DirecTV integration."""
from homeassistant.components.directv.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from tests.components.directv import setup_integration
from tests.test_util.aiohttp import AiohttpClientMocker
# pyl... | Danielhiversen/home-assistant | tests/components/directv/test_init.py | Python | apache-2.0 | 1,186 |
"""
Plot spherical harmonics on the surface of the sphere, as well as a 3D
polar plot.
This example requires scipy.
In this example we use the mlab's mesh function:
:func:`mayavi.mlab.mesh`.
For plotting surfaces this is a very versatile function. The surfaces can
be defined as functions of a 2D grid.
For each spher... | dmsurti/mayavi | examples/mayavi/mlab/spherical_harmonics.py | Python | bsd-3-clause | 1,373 |
from __future__ import unicode_literals
import os
from subprocess import PIPE, Popen
import sys
from django.utils.encoding import force_text, DEFAULT_LOCALE_ENCODING
from django.utils import six
from .base import CommandError
def popen_wrapper(args, os_err_exc_type=CommandError):
"""
Friendly wrapper aroun... | simbha/mAngE-Gin | lib/django/core/management/utils.py | Python | mit | 2,822 |
"""
gmagoon 05/03/10: new class for MM4 parsing, based on mopacparser.py, which, in turn, is based on gaussianparser.py from cclib, described below:
cclib (http://cclib.sf.net) is (c) 2006, the cclib development team
and licensed under the LGPL (http://www.gnu.org/copyleft/lgpl.html).
"""
__revision__ = "$Revisi... | faribas/RMG-Java | source/cclib/parser/mm4parser.py | Python | mit | 11,929 |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | adviti/melange | thirdparty/google_appengine/google/appengine/api/prospective_search/prospective_search_pb.py | Python | apache-2.0 | 60,260 |
#
# Copyright 2013 eNovance
#
# 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, ... | Juniper/ceilometer | ceilometer/alarm/notifier/test.py | Python | apache-2.0 | 1,257 |
# -*- coding: utf-8 -*-
# (c) 2015 Incaser Informatica S.L. - Sergio Teruel
# (c) 2015 Incaser Informatica S.L. - Carlos Dauden
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import main
| incaser/incaser-odoo-addons | website_maintenance/controllers/__init__.py | Python | agpl-3.0 | 213 |
# coding: utf8
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"更新" 是選擇性的條件式, 格式就像 "欄位1=\'值\'". 但是 JOIN 的資料不可以使用 update 或是 delete"',
'%Y-%m-%d': '%Y-%m-%d',
'%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S',
'%s rows deleted': '已刪除 %s 筆',
'%s rows updated': ... | tectronics/pyafipws.web2py-app | languages/zh-tw.py | Python | agpl-3.0 | 8,854 |
"""SCons.Tool.g++
Tool-specific initialization for g++.
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, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
#
# Permission is... | makinacorpus/mapnik2 | scons/scons-local-1.2.0/SCons/Tool/g++.py | Python | lgpl-2.1 | 3,111 |
# Copyright 2015 Cisco Systems, 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... | yangleo/cloud-github | openstack_dashboard/enabled/_9001_developer.py | Python | apache-2.0 | 948 |
# -*- coding: utf-8 -*-
# Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
import time
import unittest
from django.core.cache import cache
from django.utils.cache import patch_vary_headers
from django.http import HttpResponse
# functions/classes for complex data type tes... | paulsmith/geodjango | tests/regressiontests/cache/tests.py | Python | bsd-3-clause | 5,938 |
"""
Provides a set of pluggable permission policies.
"""
from __future__ import unicode_literals
from django.http import Http404
from rest_framework import exceptions
from rest_framework.compat import is_authenticated
SAFE_METHODS = ('GET', 'HEAD', 'OPTIONS')
class BasePermission(object):
"""
A base class ... | hchen1202/django-react | virtualenv/lib/python3.6/site-packages/rest_framework/permissions.py | Python | mit | 6,655 |
import tarfile
import time
import os
import json
class BackupTool(object):
"""Simple backup utility."""
def __init__(self):
pass
@staticmethod
def backup(openbazaar_installation_path,
backup_folder_path,
on_success_callback=None,
on_error_callback... | atsuyim/OpenBazaar | node/backuptool.py | Python | mit | 4,817 |
uname = ParseFunction('uname -a > {OUT}')
for group in ('disc', 'ccl', 'gh'):
batch_options = 'requirements = MachineGroup == "{0}"'.format(group)
uname(outputs='uname.{0}'.format(group), environment={'BATCH_OPTIONS': batch_options})
#for group in ('disc', 'ccl', 'gh'):
# with Options(batch='requirements =... | isanwong/cctools | weaver/src/examples/batch.py | Python | gpl-2.0 | 410 |
"""
This module hosts all the extension functions and classes created via SDK.
The function :py:func:`ext_import` is used to import a toolkit module (shared library)
into the workspace. The shared library can be directly imported
from a remote source, e.g. http, s3, or hdfs.
The imported module will be under namespace... | ypkang/Dato-Core | src/unity/python/graphlab/extensions.py | Python | agpl-3.0 | 27,795 |
# pylint: skip-file
# vim: expandtab:tabstop=4:shiftwidth=4
#pylint: disable=too-many-branches
def main():
''' ansible module for gcloud iam servicetaccount'''
module = AnsibleModule(
argument_spec=dict(
# credentials
state=dict(default='present', type='str',
... | appuio/ansible-role-openshift-zabbix-monitoring | vendor/openshift-tools/ansible/roles/lib_gcloud/build/ansible/gcloud_iam_sa.py | Python | apache-2.0 | 2,675 |
# encoding: UTF-8
import os
class Constant:
conf_dir = os.path.join(os.path.expanduser('~'), '.netease-musicbox')
download_dir = conf_dir + "/cached"
| smileboywtu/LTCodeSerialDecoder | netease/const.py | Python | apache-2.0 | 163 |
# Copyright (C) Mesosphere, Inc. See LICENSE file for details.
"""MesosDNS mock endpoint"""
import copy
import logging
import re
from exceptions import EndpointException
from mocker.endpoints.recording import (
RecordingHTTPRequestHandler,
RecordingTcpIpEndpoint,
)
# pylint: disable=C0103
log = logging.getL... | asridharan/dcos | packages/adminrouter/extra/src/test-harness/modules/mocker/endpoints/mesos_dns.py | Python | apache-2.0 | 5,228 |
from os.path import dirname, join
from math import ceil
import numpy as np
from bokeh.io import curdoc
from bokeh.layouts import row, column, widgetbox
from bokeh.models import ColumnDataSource, Slider, Div
from bokeh.plotting import figure
import audio
from audio import MAX_FREQ, TIMESLICE, NUM_BINS
from waterfall ... | percyfal/bokeh | examples/app/spectrogram/main.py | Python | bsd-3-clause | 4,299 |
#
# Copyright (c) 2008--2015 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | xkollar/spacewalk | backend/server/importlib/productNamesImport.py | Python | gpl-2.0 | 1,057 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2018, Simon Dodsley (simon@purestorage.com)
# 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',... | kvar/ansible | lib/ansible/modules/storage/purestorage/_purefa_facts.py | Python | gpl-3.0 | 32,021 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub. actual code lives in the .ps1
# file of the same name
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | Jorge-Rodriguez/ansible | lib/ansible/modules/windows/win_find.py | Python | gpl-3.0 | 9,583 |
# Copyright (C) 2009 Kevin Ollivier 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 conditions and th... | danialbehzadi/Nokia-RM-1013-2.0.0.11 | webkit/Tools/wx/build/build_utils.py | Python | gpl-3.0 | 6,778 |
"""Tests for the Plaato integration."""
| lukas-hetzenecker/home-assistant | tests/components/plaato/__init__.py | Python | apache-2.0 | 40 |
# Copyright (c) 2012 NTT DOCOMO, 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 requ... | Brocade-OpenSource/OpenStack-DNRM-Nova | nova/tests/virt/baremetal/db/test_bm_node.py | Python | apache-2.0 | 6,918 |
import numpy as np
from scipy import linalg
from sklearn.decomposition import nmf
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import raises
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_gr... | ningchi/scikit-learn | sklearn/decomposition/tests/test_nmf.py | Python | bsd-3-clause | 6,123 |
"""
test pretrained models
"""
from __future__ import print_function
import mxnet as mx
from common import find_mxnet, modelzoo
from score import score
VAL_DATA='data/val-5k-256.rec'
def download_data():
return mx.test_utils.download(
'http://data.mxnet.io/data/val-5k-256.rec', VAL_DATA)
def test_imagenet... | hotpxl/mxnet | example/image-classification/test_score.py | Python | apache-2.0 | 1,493 |
# Copyright 2014 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 ... | yuewko/neutron | neutron/db/migration/alembic_migrations/versions/19180cf98af6_nsx_gw_devices.py | Python | apache-2.0 | 3,023 |
from coalib.bearlib.abstractions.Linter import linter
from dependency_management.requirements.DistributionRequirement import (
DistributionRequirement)
@linter(executable='chktex',
output_format='regex',
output_regex=r'(?P<severity>Error|Warning) \d+ in .+ line '
r'(?P<line>\d... | IPMITMO/statan | coala-bears/bears/latex/LatexLintBear.py | Python | mit | 886 |
from __future__ import unicode_literals, division, absolute_import
from .schedule import *
| ratoaq2/Flexget | flexget/ui/plugins/schedule/__init__.py | Python | mit | 91 |
#!/usr/bin/python
#
# Example nfcpy to wpa_supplicant wrapper for P2P NFC operations
# Copyright (c) 2012-2013, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import os
import sys
import time
import random
import threading
import argparse... | HazyTeam/platform_external_wpa_supplicant_8 | wpa_supplicant/examples/p2p-nfc.py | Python | gpl-2.0 | 20,200 |
# Author: Mr_Orange <mr_orange@hotmail.it>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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 Lic... | guijomatos/SickRage | sickbeard/clients/qbittorrent_client.py | Python | gpl-3.0 | 2,391 |
#
# Created by: Pearu Peterson, September 2002
#
import sys
import subprocess
import time
from functools import reduce
from numpy.testing import (assert_equal, assert_array_almost_equal, assert_,
assert_allclose, assert_almost_equal,
assert_array_equal)
import pyt... | WarrenWeckesser/scipy | scipy/linalg/tests/test_lapack.py | Python | bsd-3-clause | 116,267 |
''' Some tests for the documenting decorator and support functions '''
from __future__ import division, print_function, absolute_import
import sys
import pytest
from numpy.testing import assert_equal
from scipy.misc import doccer
# python -OO strips docstrings
DOCSTRINGS_STRIPPED = sys.flags.optimize > 1
docstring... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/scipy/misc/tests/test_doccer.py | Python | mit | 3,171 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Red Hat Inc.
# 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',
... | alxgu/ansible | lib/ansible/modules/remote_management/manageiq/manageiq_alerts.py | Python | gpl-3.0 | 12,976 |
class A(B):
pass
class A(object):
pass
class A(x.y()):
pass
class A(B, C):
pass
| warner83/micropython | tests/bytecode/mp-tests/class5.py | Python | mit | 96 |
# 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 a... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/api/openstack/compute/contrib/server_usage.py | Python | gpl-2.0 | 4,148 |
import pytest
from tests.support.asserts import assert_success
"""
Tests that WebDriver can transcend site origins.
Many modern browsers impose strict cross-origin checks,
and WebDriver should be able to transcend these.
Although an implementation detail, certain browsers
also enforce process isolation based on si... | scheib/chromium | third_party/blink/web_tests/external/wpt/webdriver/tests/get_title/iframe.py | Python | bsd-3-clause | 2,183 |
#!/usr/bin/python
# Copyright 2016 Google Inc.
# 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',
'status': ['preview'],
... | anryko/ansible | lib/ansible/modules/cloud/google/gcpubsub_info.py | Python | gpl-3.0 | 4,597 |
import datetime
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.contrib.admin.utils import (
display_for_field, display_for_value, label_for_field, lookup_field,
)
from django.contrib.admin.views.main import (
ALL_VAR, ORDER_VAR, PAGE_VAR, SEARCH_VAR,
)
from django.co... | georgemarshall/django | django/contrib/admin/templatetags/admin_list.py | Python | bsd-3-clause | 18,018 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('email_marketing', '0003_auto_20160715_1145'),
]
operations = [
migrations.AddField(
model_name='emailmarketingco... | ahmedaljazzar/edx-platform | lms/djangoapps/email_marketing/migrations/0004_emailmarketingconfiguration_welcome_email_send_delay.py | Python | agpl-3.0 | 552 |
#! /usr/bin/env python
import requests
import sys
import urllib
from requests.auth import HTTPBasicAuth
if len(sys.argv) != 5:
print "usage: verify-topo-links onos-node cluster-id first-index last-index"
sys.exit(1)
node = sys.argv[1]
cluster = sys.argv[2]
first = int(sys.argv[3])
last = int(sys.argv[4])
f... | planoAccess/clonedONOS | tools/test/scenarios/bin/verify-topo-devices.py | Python | apache-2.0 | 1,143 |
from __future__ import division, absolute_import, print_function
import sys
from itertools import product
import numpy as np
from numpy.core import zeros, float64
from numpy.testing import dec, TestCase, assert_almost_equal, assert_, \
assert_raises, assert_array_equal, assert_allclose, assert_equal
from numpy.c... | Reagankm/KnockKnock | venv/lib/python3.4/site-packages/numpy/core/tests/test_blasdot.py | Python | gpl-2.0 | 8,880 |
# Copyright 2009 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 agreed to in writing, ... | chheplo/jaikuengine | common/models.py | Python | apache-2.0 | 22,503 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
entries = webnotes.conn.sql("""select voucher_type, voucher_no
from `tabGL Entry` group by voucher_type, voucher_no""", as_dict=1)
for entry in entries:... | saurabh6790/test-med-app | patches/october_2013/p05_delete_gl_entries_for_cancelled_vouchers.py | Python | agpl-3.0 | 683 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
try:
webnotes.conn.sql("""delete from `tabSearch Criteria` where ifnull(standard, 'No') = 'Yes'""")
except Except... | saurabh6790/test-med-app | patches/june_2013/p05_remove_search_criteria_reports.py | Python | agpl-3.0 | 334 |
"""Mycroft AI notification platform."""
import logging
from mycroftapi import MycroftAPI
from homeassistant.components.notify import BaseNotificationService
_LOGGER = logging.getLogger(__name__)
def get_service(hass, config, discovery_info=None):
"""Get the Mycroft notification service."""
return MycroftNo... | nkgilley/home-assistant | homeassistant/components/mycroft/notify.py | Python | apache-2.0 | 908 |
# 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 compiled_file_system import CompiledFileSystem
from file_system import FileNotFoundError
class ChainedCompiledFileSystem(object):
''' A CompiledFileS... | windyuuy/opera | chromium/src/chrome/common/extensions/docs/server2/chained_compiled_file_system.py | Python | bsd-3-clause | 3,233 |
# TODO: use a unit-testing library for asserts
# invoke with:
# ./pox.py --script=tests.topology.topology topology
#
# Maybe there is a less awkward way to invoke tests...
from pox.core import core
from pox.lib.revent import *
topology = core.components['topology']
def autobinds_correctly():
topology.listenTo(c... | sstjohn/pox | tests/topology/topology.py | Python | gpl-3.0 | 423 |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are ... | sangh/LaserShow | pyglet-hg/examples/window_platform_event.py | Python | bsd-3-clause | 3,351 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2018 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',
... | kvar/ansible | lib/ansible/modules/network/edgeos/edgeos_facts.py | Python | gpl-3.0 | 8,337 |
from __future__ import absolute_import
from django import template
from django.utils.unittest import TestCase
from .templatetags import custom
class CustomFilterTests(TestCase):
def test_filter(self):
t = template.Template("{% load custom %}{{ string|trim:5 }}")
self.assertEqual(
t.r... | LethusTI/supportcenter | vendor/django/tests/regressiontests/templates/custom.py | Python | gpl-3.0 | 24,013 |
#! /usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions... | cngo-github/nupic | examples/opf/experiments/missing_record/make_datasets.py | Python | agpl-3.0 | 4,661 |
__author__ = 'Tom Schaul, tom@idsia.ch'
from pybrain.rl.learners.learner import Learner
class MetaLearner(Learner):
""" Learners that make use of other Learners, or learn how to learn. """ | hassaanm/stock-trading | src/pybrain/rl/learners/meta/meta.py | Python | apache-2.0 | 196 |
# Unix SMB/CIFS implementation.
# Copyright (C) Sean Dague <sdague@linux.vnet.ibm.com> 2011
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your optio... | yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/samba/tests/samba_tool/base.py | Python | mit | 4,702 |
"""
This module collects helper functions and classes that "span" multiple levels
of MVC. In other words, these functions/classes introduce controlled coupling
for convenience's sake.
"""
from django.http import (
Http404, HttpResponse, HttpResponsePermanentRedirect, HttpResponseRedirect,
)
from django.template imp... | georgemarshall/django | django/shortcuts.py | Python | bsd-3-clause | 4,896 |
import json
import logging
from lxml import etree
from xmodule.capa_module import ComplexEncoder
from xmodule.progress import Progress
from xmodule.stringify import stringify_children
import openendedchild
from .combined_open_ended_rubric import CombinedOpenEndedRubric
log = logging.getLogger("edx.courseware")
cla... | carsongee/edx-platform | common/lib/xmodule/xmodule/open_ended_grading_classes/self_assessment_module.py | Python | agpl-3.0 | 11,892 |
# =============================================================================
# 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
#... | drpngx/tensorflow | tensorflow/contrib/periodic_resample/__init__.py | Python | apache-2.0 | 1,176 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class HarkIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?hark\.com/clips/(?P<id>.+?)-.+'
_TEST = {
'url': 'http://www.hark.com/clips/mmbzyhkgny-obama-beyond-the-afghan-theater-we-only-target-al-qaeda-on-ma... | Tithen-Firion/youtube-dl | youtube_dl/extractor/hark.py | Python | unlicense | 1,341 |
# (c) 2018, NetApp Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from ansible.modules.storage.netapp.netapp_e_auditlog import AuditLog
from units.modules.utils import AnsibleFailJson, ModuleTestCase, set_module_args
__metaclass__ = type
from units.compat import mock... | alxgu/ansible | test/units/modules/storage/netapp/test_netapp_e_auditlog.py | Python | gpl-3.0 | 10,758 |
"""Utility to compare (Numpy) version strings.
The NumpyVersion class allows properly comparing numpy version strings.
The LooseVersion and StrictVersion classes that distutils provides don't
work; they don't recognize anything like alpha/beta/rc/dev versions.
"""
import re
from scipy._lib.six import string_types
... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/scipy/_lib/_version.py | Python | mit | 4,793 |
def foo(a):
pass
foo(1)
| akosyakov/intellij-community | python/testData/quickFixes/PyRemoveArgumentQuickFixTest/unexpected_after.py | Python | apache-2.0 | 32 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urllib_request
class VideoMegaIE(InfoExtractor):
_VALID_URL = r'(?:videomega:|https?://(?:www\.)?videomega\.tv/(?:(?:view|iframe|cdn)\.php)?\?ref=)(?P<id>[A-Za-z0-9]+)'
_TESTS = [{... | miminus/youtube-dl | youtube_dl/extractor/videomega.py | Python | unlicense | 1,920 |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_array_almost_equal
from scipy.sparse.csgraph import breadth_first_tree, depth_first_tree,\
csgraph_to_dense, csgraph_from_dense
def test_graph_breadth_first():
csgraph = np.array([[0, 1, 2, 0,... | jlcarmic/producthunt_simulator | venv/lib/python2.7/site-packages/scipy/sparse/csgraph/tests/test_traversal.py | Python | mit | 2,390 |
from test_support import *
prove_all ()
| ptroja/spark2014 | testsuite/gnatprove/tests/riposte__usergroup_examples/test.py | Python | gpl-3.0 | 41 |
# Copyright (c) 2001 Autonomous Zone Industries
# Copyright (c) 2002-2009 Zooko Wilcox-O'Hearn
# This file is part of pyutil; see README.rst for licensing terms.
"""
An object that makes some of the attributes of your class persistent, pickling
them and lazily writing them to a file.
"""
# from the Python Standard... | heathseals/CouchPotatoServer | libs/pyutil/PickleSaver.py | Python | gpl-3.0 | 8,932 |
# -*- coding: utf-8 -*-
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, royalty-free,
# non-exclusive license to e... | ktan2020/legacy-automation | win/Lib/site-packages/Crypto/Hash/hashalgo.py | Python | mit | 3,984 |
"""Newton-CG trust-region optimization."""
from __future__ import division, print_function, absolute_import
import math
import numpy as np
import scipy.linalg
from ._trustregion import (_minimize_trust_region, BaseQuadraticSubproblem)
__all__ = []
def _minimize_trust_ncg(fun, x0, args=(), jac=None, hess=None, hess... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/scipy/optimize/_trustregion_ncg.py | Python | mit | 4,646 |
# 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
# (at your o... | lberruti/ansible | test/units/parsing/test_unquote.py | Python | gpl-3.0 | 2,073 |
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.wrappers
~~~~~~~~~~~~~~~~~~~~~~~~~
Extra wrappers or mixins contributed by the community. These wrappers can
be mixed in into request objects to add extra functionality.
Example::
from werkzeug.wrappers import Request as RequestBase
fr... | DasIch/werkzeug | werkzeug/contrib/wrappers.py | Python | bsd-3-clause | 10,337 |
class Project(object):
def __init__(self, name, start, end):
self.name = name
self.start = start
self.end = end
def __repr__(self):
return "Project '%s from %s to %s" % (
self.name, self.start.isoformat(), self.end.isoformat()
)
| jskksj/cv2stuff | cv2stuff/gendata.py | Python | isc | 282 |
"""
Performs management commands for the scheduler app
"""
import hashlib
from flask.ext.script import Manager
from sqlalchemy import exc
# Importing routes causes our URL routes to be registered
from src import routes
from src import models
from src import scheduler
scheduler.app.config.from_object(scheduler.Config... | ginstrom/scheduler | manage.py | Python | mit | 1,385 |
#!/usr/bin/python3
"""
Script to check recently uploaded files.
This script checks if a file description is present and if there are other
problems in the image's description.
This script will have to be configured for each language. Please submit
translations as addition to the Pywikibot framework.
Everything that ... | wikimedia/pywikibot-core | scripts/checkimages.py | Python | mit | 76,106 |
from django.db import connection
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from rest_framework.generics import RetrieveAPIView
from jarbas.core.models import Company
from jarbas.core.serializers import CompanySerializer
from jarbas.chamber_of_deputies.serializers import format... | datasciencebr/serenata-de-amor | jarbas/core/views.py | Python | mit | 867 |
#!/usr/bin/env python3
"""
Created on 17 Sep 2019
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
"""
import time
from scs_core.sys.timeout import Timeout
# --------------------------------------------------------------------------------------------------------------------
# run...
timeout = Timeout(5... | south-coast-science/scs_core | tests/sys/timeout_test.py | Python | mit | 494 |
class Solution(object):
def searchInsert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
O(logn)
"""
low = 0
high = len(nums) - 1
if target <= nums[low]:
return low
if target > nums[high]:
... | comicxmz001/LeetCode | Python/35. Search Insert Position.py | Python | mit | 973 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.