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 |
|---|---|---|---|---|---|
# coding=utf-8
from safe.common.exceptions import NoAttributeInLayerError
from safe.impact_functions.bases.utilities import check_attribute_exist
__author__ = 'Rizky Maulana Nugraha "lucernae" <lana.pcfre@gmail.com>'
__date__ = '08/05/15'
class ClassifiedVectorExposureMixin(object):
def __init__(self):
... | cchristelis/inasafe | safe/impact_functions/bases/layer_types/classified_vector_exposure.py | Python | gpl-3.0 | 1,719 |
"""
Tests for instructor.basic
"""
from django.test import TestCase
from student.models import CourseEnrollment
from student.tests.factories import UserFactory
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from analytics.basic import enrolled_students_features, AVAILABLE_FEATURES, STUDENT_FEATURES, PR... | geekaia/edx-platform | lms/djangoapps/analytics/tests/test_basic.py | Python | agpl-3.0 | 2,084 |
import io
import random
import docker
import six
from .base import BaseAPIIntegrationTest, BUSYBOX
class TestRegressions(BaseAPIIntegrationTest):
def test_443_handle_nonchunked_response_in_stream(self):
dfile = io.BytesIO()
with self.assertRaises(docker.errors.APIError) as exc:
for l... | vpetersson/docker-py | tests/integration/regression_test.py | Python | apache-2.0 | 2,323 |
#!/usr/bin/python2.5
# Copyright (C) 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 la... | zarnold/transitfeed | transitfeed/fareattribute.py | Python | apache-2.0 | 5,348 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | DaanHoogland/cloudstack | plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmVmModule.py | Python | apache-2.0 | 22,802 |
"""Test Met weather entity."""
from homeassistant.components.met import DOMAIN
from homeassistant.components.weather import DOMAIN as WEATHER_DOMAIN
async def test_tracking_home(hass, mock_weather):
"""Test we track home."""
await hass.config_entries.flow.async_init("met", context={"source": "onboarding"})
... | tchellomello/home-assistant | tests/components/met/test_weather.py | Python | apache-2.0 | 2,271 |
# ----------------------------------------------------------------------------
# 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 met:
#
# * Redistribu... | mpasternak/pyglet-fix-issue-552 | pyglet/input/__init__.py | Python | bsd-3-clause | 7,205 |
from django import template
from django.utils.safestring import mark_safe
from pygments import highlight
from pygments.formatters.html import HtmlFormatter
from pygments.lexers import get_lexer_by_name
from ..forms import DocSearchForm
from ..models import DocumentRelease
from ..utils import get_doc_path, get_doc_root... | gnarf/djangoproject.com | docs/templatetags/docs.py | Python | bsd-3-clause | 2,576 |
#-*- coding: utf-8 -*-
import re
try:
from PIL import Image
from PIL import ImageDraw
except ImportError:
try:
import Image
import ImageDraw
except ImportError:
raise ImportError("The Python Imaging Library was not found.")
from django.utils import six
from easy_thumbnails import... | lory87/django-filer | filer/thumbnail_processors.py | Python | bsd-3-clause | 5,654 |
import functools
import operator
import unittest
from itertools import count
from scrapy.utils.python import str_to_unicode, unicode_to_str, \
memoizemethod_noargs, isbinarytext, equal_attributes, \
WeakKeyCache, stringify_dict, get_func_args
__doctests__ = ['scrapy.utils.python']
class UtilsPythonTestCase(u... | ofanoyi/scrapy | scrapy/tests/test_utils_python.py | Python | bsd-3-clause | 6,570 |
# 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 import test
from measurements import smoothness
import page_sets
@test.Disabled('linux') # crbug.com/368767
class SchedulerToughSchedulingC... | TeamEOS/external_chromium_org | tools/perf/benchmarks/scheduler.py | Python | bsd-3-clause | 1,116 |
# -*- coding: utf8 -*-
"""Autogenerated file - DO NOT EDIT
If you spot a bug, please report it on the mailing list and/or change the generator."""
from nipype.interfaces.base import CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, isdefined, InputMultiPath, OutputMultiPath
i... | grlee77/nipype | nipype/interfaces/semtools/brains/classify.py | Python | bsd-3-clause | 2,306 |
# -*- coding: utf-8 -*-
import re
import sys
try:
from hashlib import md5
except ImportError:
from md5 import md5
from rdflib.py3compat import format_doctest_out
try:
from uuid import uuid4
except ImportError:
def uuid4():
"""
Generates a uuid on behalf of Python 2.4
"""
... | armandobs14/rdflib | test/test_bnode_ncname.py | Python | bsd-3-clause | 2,632 |
# -*- coding: utf-8 -*-
print('a')
| 3nids/QGIS | tests/testdata/not_a_processing_script.py | Python | gpl-2.0 | 36 |
import json, time
import glob
import timer
from utils import *
class Item(object):
__slots__ = ( 'type', 'cbid', 'dbid', 'wfid', 'step', 'when', 'meta', 'body', 'repo', 'path', 'size', 'id' )
def __init__( self, obj={}, **kwargs ):
# Three situations: Network streamed data (obj), Database data (obj), Newly create... | nkremerh/cctools | prune/src/prune/class_item.py | Python | gpl-2.0 | 6,649 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | tomsilver/nupic | examples/opf/tools/MirrorImageViz/mirrorImageViz.py | Python | gpl-3.0 | 7,336 |
""" Python Character Mapping Codec generated from 'CP437.TXT' with gencodec.py.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
(c) Copyright 2000 Guido van Rossum.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,error... | remybaranx/qtaste | tools/jython/lib/Lib/encodings/cp437.py | Python | gpl-3.0 | 7,146 |
# -*- 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... | crmccreary/openerp_server | openerp/addons/point_of_sale/report/account_statement.py | Python | agpl-3.0 | 1,923 |
import uuid
from datetime import datetime
import pytest
from tests.util.crispin import crispin_client
ACCOUNT_ID = 1
NAMESPACE_ID = 1
THREAD_ID = 2
# These tests use a real Gmail test account and idempotently put the account
# back to the state it started in when the test is done.
@pytest.fixture(scope='function'... | nylas/sync-engine | tests/imap/network/test_drafts_syncback.py | Python | agpl-3.0 | 3,701 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
# Administrator of the National Aeronautics and Space Administration.
# 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... | ntt-sic/nova | nova/tests/consoleauth/test_consoleauth.py | Python | apache-2.0 | 7,413 |
# mock.py
# Test tools for mocking and patching.
# E-mail: fuzzyman AT voidspace DOT org DOT uk
#
# mock 1.0.1
# http://www.voidspace.org.uk/python/mock/
#
# Copyright (c) 2007-2013, Michael Foord & the mock team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modificatio... | catapult-project/catapult | third_party/gsutil/third_party/mock/mock/mock.py | Python | bsd-3-clause | 83,928 |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0401,W0614
from telemetry import story
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
clas... | HalCanary/skia-hc | tools/skp/page_sets/skia_cnn_desktop.py | Python | bsd-3-clause | 1,145 |
"""
tests.test_search
~~~~~~~~~~~~~~~~~
Provides unit tests for the :mod:`flask_restless.search` module.
:copyright: 2012, 2013, 2014, 2015 Jeffrey Finkelstein
<jeffrey.finkelstein@gmail.com> and contributors.
:license: GNU AGPLv3+ or BSD
"""
from nose.tools import assert_raises
f... | ternaris/flask-restless | tests/test_search.py | Python | bsd-3-clause | 17,467 |
import ast
import re
class OS(object):
"""
Class that parses either /etc/os-release or the output of 'lsb_release -a'
and provides OS name and version information.
Must be initialized with OS.from_lsb_release or OS.from_os_release
"""
__slots__ = ['name', 'version', 'codename', 'package_type... | ktdreyer/teuthology | teuthology/orchestra/opsys.py | Python | mit | 4,270 |
"""
Copyright 2008-2015 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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 l... | cfriedt/gnuradio | grc/core/Block.py | Python | gpl-3.0 | 30,996 |
#
# 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... | amitsela/incubator-beam | sdks/python/apache_beam/utils/path_test.py | Python | apache-2.0 | 2,494 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
typos={'feature':'features','sources':'source','targets':'target','include':'includes','export_include':'export_includes','define':'defines','importpath':'includes','installpath':'install_path','isco... | softDi/clusim | ns3/ns-3.26/.waf-1.8.19-b1fc8f7baef51bd2db4c2971909a568d/waflib/Tools/errcheck.py | Python | apache-2.0 | 6,003 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, filter_strip_join
from frappe.website.website_generator import WebsiteGenerator
from frappe.contacts.addres... | vishdha/erpnext | erpnext/setup/doctype/sales_partner/sales_partner.py | Python | gpl-3.0 | 1,584 |
# -*- encoding: utf-8 -*-
###############################################################################
#
# sale_automatic_workflow for OpenERP
# Copyright (C) 2011 Akretion Sébastien BEAU <sebastien.beau@akretion.com>
# Author: Guewen Baconnier
# Copyright 2014 Camptocamp SA
#
# This program is free s... | vauxoo-dev/e-commerce | sale_automatic_workflow/sale_workflow_process.py | Python | agpl-3.0 | 3,372 |
import envi.archs.arm as e_arm
class ArmMixin(e_arm.ArmModule, e_arm.ArmRegisterContext):
def __init__(self):
e_arm.ArmModule.__init__(self)
e_arm.ArmRegisterContext.__init__(self)
def archGetStackTrace(self):
pc = self.getProgramCounter()
sp = self.getStackCounter()
r... | imjonsnooow/vivisect | vtrace/archs/arm.py | Python | apache-2.0 | 339 |
# 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... | jwlawson/tensorflow | tensorflow/contrib/rnn/python/ops/lstm_ops.py | Python | apache-2.0 | 24,941 |
"""
Support for tracking the proximity of a device.
Component to monitor the proximity of devices to a particular zone and the
direction of travel.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/proximity/
"""
import logging
from homeassistant.helpers... | mikaelboman/home-assistant | homeassistant/components/proximity.py | Python | mit | 8,866 |
"""
Classes to cache and read specific items from github issues in a uniform way
"""
from functools import partial as Partial
import datetime
import time
import shelve
# Requires PyGithub version >= 1.13 for access to raw_data attribute
import github
# Needed to not confuse cached 'None' objects
class Nothing(object... | autotest/virt-test | tools/github/github_issues.py | Python | gpl-2.0 | 29,542 |
# (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.com>
# (c) 2017 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
DOCUMENTATION = """
name: lines
author: Daniel H... | mattclay/ansible | lib/ansible/plugins/lookup/lines.py | Python | gpl-3.0 | 2,214 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Guillaume Martinez (lunik@tiwabbit.fr)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import
import pytest
from ansible.modules.source_control.gitlab.gitlab_runner import GitLabRunner
def _... | roadmapper/ansible | test/units/modules/source_control/gitlab/test_gitlab_runner.py | Python | gpl-3.0 | 3,198 |
from django.conf import settings
from django.shortcuts import render
def handler500(request):
data = {'product': settings.DEFAULT_PRODUCT}
return render(request, '500.html', data, status=500)
def handler404(request):
data = {'product': settings.DEFAULT_PRODUCT}
return render(request, '404.html', dat... | cliqz/socorro | webapp-django/crashstats/base/views.py | Python | mpl-2.0 | 335 |
"""
====================
Breadth-first search
====================
Basic algorithms for breadth-first searching the nodes of a graph.
"""
import networkx as nx
from collections import defaultdict, deque
__author__ = """\n""".join(['Aric Hagberg <aric.hagberg@gmail.com>'])
__all__ = ['bfs_edges', 'bfs_tree', 'bfs_prede... | jcurbelo/networkx | networkx/algorithms/traversal/breadth_first_search.py | Python | bsd-3-clause | 3,994 |
from collections import defaultdict
import numpy as np
from numpy.testing import assert_array_almost_equal
from sklearn.utils.graph import (graph_shortest_path,
single_source_shortest_path_length)
def floyd_warshall_slow(graph, directed=False):
N = graph.shape[0]
#set nonzer... | depet/scikit-learn | sklearn/utils/tests/test_shortest_path.py | Python | bsd-3-clause | 2,892 |
from wsgiref.util import FileWrapper
import imghdr
from django.shortcuts import get_object_or_404
from django.http import HttpResponse
from django.core.exceptions import PermissionDenied
from wagtail.wagtailimages.models import get_image_model
from wagtail.wagtailimages.utils import verify_signature
from wagtail.wagt... | stevenewey/wagtail | wagtail/wagtailimages/views/frontend.py | Python | bsd-3-clause | 977 |
from sympy.polys.domains import QQ, EX
from sympy.polys.rings import PolyElement, ring, sring
from sympy.polys.polyerrors import DomainError
from sympy.polys.monomials import (monomial_min, monomial_mul, monomial_div,
monomial_ldiv)
from mpmath.libmp.libintmath import ifac
from sympy.... | atreyv/sympy | sympy/polys/ring_series.py | Python | bsd-3-clause | 54,558 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, 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 Lic... | thaim/ansible | lib/ansible/modules/network/fortios/fortios_dnsfilter_profile.py | Python | mit | 18,043 |
#
# Secret Labs' Regular Expression Engine
#
# convert template to internal format
#
# Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support module for sre"""
import _sre
import sre_parse
from sre_constants import *
... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/sre_compile.py | Python | gpl-2.0 | 26,872 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cint, cstr, flt, nowdate, comma_and, date_diff
from frappe import msgprint, _
from frappe.model.document import ... | bhupennewalkar1337/erpnext | erpnext/hr/doctype/leave_control_panel/leave_control_panel.py | Python | gpl-3.0 | 1,939 |
# pylint: skip-file
class GCPResource(object):
'''Object to represent a gcp resource'''
def __init__(self, rname, rtype, project, zone):
'''constructor for gcp resource'''
self._name = rname
self._type = rtype
self._project = project
self._zone = zone
@property
... | appuio/ansible-role-openshift-zabbix-monitoring | vendor/openshift-tools/ansible/roles/lib_gcloud/build/lib/gcpresource.py | Python | apache-2.0 | 683 |
#!/usr/bin/python
# Copyright 2002-2005 Dave Abrahams.
# Copyright 2002-2006 Vladimir Prus.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import BoostBuild
import os
import os.path
import sys
xml = ... | NixaSoftware/CVis | venv/bin/tools/build/v2/test/test_all.py | Python | apache-2.0 | 8,651 |
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | petrutlucian94/nova | nova/tests/unit/console/test_websocketproxy.py | Python | apache-2.0 | 11,560 |
#
# 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... | prestona/qpid-proton | tests/java/shim/curl.py | Python | apache-2.0 | 1,678 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'XForm.last_submission_time'
db.add_column(u'odk_logger_xform', 'last_submission_time',
... | awemulya/fieldsight-kobocat | onadata/apps/logger/south_migrations/0031_auto__add_field_xform_last_submission_time.py | Python | bsd-2-clause | 10,336 |
# -*- coding: utf-8 -*-
# Author: Vincent Dubourg <vincent.dubourg@gmail.com>
# (mostly translation, see implementation details)
# Licence: BSD 3 clause
from __future__ import print_function
import numpy as np
from scipy import linalg, optimize
from ..base import BaseEstimator, RegressorMixin
from ..metrics... | Garrett-R/scikit-learn | sklearn/gaussian_process/gaussian_process.py | Python | bsd-3-clause | 34,404 |
"""Example code using Python threads.
Copyright 2010 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from threading import Thread
from time import sleep
def counter(xs, delay=1):
for x in xs:
print x
sleep(delay)
# one thread counts backwards, fast
t = Thread(target=... | simontakite/sysadmin | pythonscripts/thinkpython/thread.py | Python | gpl-2.0 | 439 |
# 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... | nburn42/tensorflow | tensorflow/python/util/deprecation.py | Python | apache-2.0 | 21,885 |
"""The tests for the automation component."""
import asyncio
from datetime import timedelta
import unittest
from unittest.mock import patch
from homeassistant.core import State, CoreState
from homeassistant.setup import setup_component, async_setup_component
import homeassistant.components.automation as automation
fro... | ct-23/home-assistant | tests/components/automation/test_init.py | Python | apache-2.0 | 25,931 |
# Copyright 2013 VMware, 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 ap... | samsu/neutron | tests/unit/test_provider_configuration.py | Python | apache-2.0 | 8,840 |
from django.core.management.base import NoArgsCommand
from askbot.models import Thread
from askbot.utils.console import ProgressBar
class Command(NoArgsCommand):
def handle_noargs(self, **options):
message = "Rebuilding thread summary cache"
count = Thread.objects.count()
for thread in Prog... | PearsonIOKI/compose-forum | askbot/management/commands/build_thread_summary_cache.py | Python | gpl-3.0 | 413 |
# Ansible module to manage CheckPoint Firewall (c) 2019
#
# 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 dist... | thaim/ansible | test/units/modules/network/check_point/test_cp_mgmt_install_policy.py | Python | mit | 2,564 |
#########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... | drxaero/calibre | src/calibre/ebooks/rtf2xml/hex_2_utf8.py | Python | gpl-3.0 | 22,353 |
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test fee estimation code
#
from test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy impo... | Jheguy2/Mercury | qa/rpc-tests/smartfees.py | Python | mit | 4,241 |
#
# Authors: Travis Oliphant, Ed Schofield, Robert Cimrman, Nathan Bell, and others
""" Test functions for sparse matrices. Each class in the "Matrix class
based tests" section become subclasses of the classes in the "Generic
tests" section. This is done by the functions in the "Tailored base
class for generic tests" ... | nvoron23/scipy | scipy/sparse/tests/test_base.py | Python | bsd-3-clause | 151,696 |
from .headerid import *
| kura/kura.io | plugins/headerid/__init__.py | Python | mit | 24 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import int_or_none
class TumblrIE(InfoExtractor):
_VALID_URL = r'http://(?P<blog_name>.*?)\.tumblr\.com/(?:post|video)/(?P<id>[0-9]+)(?:$|[/?#])'
_TESTS = [{
'url': 'http://tatian... | Hakuba/youtube-dl | youtube_dl/extractor/tumblr.py | Python | unlicense | 4,840 |
"""
Create and delete FILES_PER_THREAD temp files (via tempfile.TemporaryFile)
in each of NUM_THREADS threads, recording the number of successes and
failures. A failure is a bug in tempfile, and may be due to:
+ Trying to create more than one tempfile with the same name.
+ Trying to delete a tempfile that doesn't sti... | svanschalkwyk/datafari | windows/python/Lib/test/test_threadedtempfile.py | Python | apache-2.0 | 2,021 |
#
# ElementTree
# $Id: ElementInclude.py 3225 2007-08-27 21:32:08Z fredrik $
#
# limited xinclude support for element trees
#
# history:
# 2003-08-15 fl created
# 2003-11-14 fl fixed default loader
#
# Copyright (c) 2003-2004 by Fredrik Lundh. All rights reserved.
#
# fredrik@pythonware.com
# http://www.pythonware... | SMALLplayer/smallplayer-image-creator | storage/.xbmc/addons/script.module.elementtree/lib/elementtree/ElementInclude.py | Python | gpl-2.0 | 5,051 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, Darren Worrall <darren@iweb.co.uk>
#
# 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 L... | caphrim007/ansible-modules-extras | cloud/cloudstack/cs_ip_address.py | Python | gpl-3.0 | 8,291 |
# Copyright (C) 2011, 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 conditions and the... | leighpauls/k2cro4 | third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/deps.py | Python | bsd-3-clause | 2,587 |
from __future__ import division, print_function
import os
import sys
import pickle
import copy
import warnings
from os.path import join
from numpy.distutils import log
from distutils.dep_util import newer
from distutils.sysconfig import get_config_var
from numpy._build_utils.apple_accelerate import (
uses_accelera... | jjas0nn/solvem | tensorflow/lib/python2.7/site-packages/numpy/core/setup.py | Python | mit | 41,471 |
from typing import Any
class StringDescriptor:
def __get__(self, instance, owner):
return 'foo'
class AnyDescriptor:
def __get__(self, instance, owner) -> Any:
return 'bar'
class ListDescriptor:
def __get__(self, instance: Any, owner: Any) -> list:
return 'baz'
class C:
f... | jwren/intellij-community | python/testData/inspections/PyUnresolvedReferencesInspection3K/descriptorAttribute.py | Python | apache-2.0 | 884 |
__author__ = "David Rusk <drusk@uvic.ca>"
| CFIS-Octarine/octarine | validate/gui/views/__init__.py | Python | gpl-3.0 | 42 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the... | InakiZabala/odoomrp-wip | product_packaging_through_attributes/__openerp__.py | Python | agpl-3.0 | 1,619 |
#!/usr/bin/env python
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | pcamp/google-appengine-wx-launcher | launcher/taskcontroller.py | Python | apache-2.0 | 12,617 |
# Copyright (c) 2014 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 ... | samsu/neutron | tests/unit/ml2/drivers/mechanism_bulkless.py | Python | apache-2.0 | 872 |
import unittest
from coalib.results.Result import Result
from coalib.results.result_actions.ResultAction import ResultAction
from coalib.settings.Section import Section
class ResultActionTest(unittest.TestCase):
def test_api(self):
uut = ResultAction()
result = Result('', '')
self.asser... | refeed/coala | tests/results/result_actions/ResultActionTest.py | Python | agpl-3.0 | 1,388 |
from datetime import datetime
from boto.resultset import ResultSet
class Stack(object):
def __init__(self, connection=None):
self.connection = connection
self.creation_time = None
self.description = None
self.disable_rollback = None
self.notification_arns = []
self... | catapult-project/catapult | third_party/gsutil/gslib/vendored/boto/boto/cloudformation/stack.py | Python | bsd-3-clause | 14,230 |
from unittest import skipIf
from django.contrib.gis.db.models import fields
from django.contrib.gis.geos import MultiPolygon, Polygon
from django.core.exceptions import ImproperlyConfigured
from django.db import connection, migrations, models
from django.db.migrations.migration import Migration
from django.db.migratio... | georgemarshall/django | tests/gis_tests/gis_migrations/test_operations.py | Python | bsd-3-clause | 9,026 |
"""Tests for util.request module."""
import unittest
from django.conf import settings
from django.core.exceptions import SuspiciousOperation
from django.test.client import RequestFactory
from util.request import course_id_from_url, safe_get_host
class ResponseTestCase(unittest.TestCase):
""" Tests for response-... | solashirai/edx-platform | common/djangoapps/util/tests/test_request.py | Python | agpl-3.0 | 3,500 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
"""
Events:
always
daily
monthly
weekly
"""
from __future__ import unicode_literals
import frappe
import frappe.utils
from frappe.utils.file_lock import create_lock, check_lock, delete_lock
from datetime import ... | gangadhar-kadam/smrterpfrappe | frappe/utils/scheduler.py | Python | mit | 3,893 |
# A minimal SQLite shell for experiments
import sqlite3
con = sqlite3.connect(":memory:")
con.isolation_level = None
cur = con.cursor()
buffer = ""
print "Enter your SQL commands to execute in sqlite3."
print "Enter a blank line to exit."
while True:
line = raw_input()
if line == "":
break
buff... | MicroTrustRepos/microkernel | src/l4/pkg/python/contrib/Doc/includes/sqlite3/complete_statement.py | Python | gpl-2.0 | 670 |
def f():
if True:
try:
pass
finally:
pass
x = 42
pass | idea4bsd/idea4bsd | python/testData/copyPaste/AmbiguousParentBlockLargestIndent.after.py | Python | apache-2.0 | 113 |
from PIL import Image, ImageDraw, ImageFont
class Image_unread_message:
def open(self,path):
self.im=Image.open(path)
return True
def __init__(self):
self.fnt=None
self.im=None
def setFont(self,font_path,size):
self.fnt=ImageFont.truetype(font_path,size)
return True
def draw_text(self,position,str,col... | snailwalker/python | burness/0000/test.py | Python | mit | 607 |
# This test can be run stand-alone with something like:
# > PYTHONPATH=. python2 openerp/tests/test_view_validation.py
from lxml import etree
from StringIO import StringIO
import unittest
from openerp.tools.view_validation import (valid_page_in_book, valid_att_in_form, valid_type_in_colspan,
... | vileopratama/vitech | src/openerp/addons/base/tests/test_view_validation.py | Python | mit | 3,424 |
#!/usr/bin/python -tt
# 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 distrib... | mattbernst/polyhartree | support/ansible/modules/core/cloud/rackspace/rax_cdb_database.py | Python | gpl-3.0 | 4,837 |
s3gis_tests = load_module("tests.unit_tests.modules.s3.s3gis")
def test_GeoJSONLayer():
s3gis_tests.layer_test(
db,
db.gis_layer_geojson,
dict(
name = "Test GeoJSON",
description = "Test GeoJSON layer",
enabled = True,
created_on = datetime.d... | devinbalkind/eden | tests/unit_tests/modules/s3/s3gis/GeoJSONLayer.py | Python | mit | 812 |
from __future__ import print_function
from pylearn2.devtools.run_pyflakes import run_pyflakes
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "pylearn-dev@googlegroups"
de... | JazzeYoung/VeryDeepAutoEncoder | pylearn2/pylearn2/devtools/tests/test_via_pyflakes.py | Python | bsd-3-clause | 639 |
from django.conf import settings
from django.contrib.sessions.backends.base import CreateError, SessionBase
from django.core.cache import caches
from django.utils.six.moves import range
KEY_PREFIX = "django.contrib.sessions.cache"
class SessionStore(SessionBase):
"""
A cache-based session store.
"""
... | WhySoGeeky/DroidPot | venv/lib/python2.7/site-packages/django/contrib/sessions/backends/cache.py | Python | mit | 2,594 |
# Copyright 2015, Thales Services SAS
# 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... | yangleo/cloud-github | openstack_dashboard/dashboards/project/routers/extensions/extraroutes/tables.py | Python | apache-2.0 | 2,682 |
import os
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase, override_settings
from django.utils import translation
@override_settings(
USE_I18N=True,
LOCALE_PATHS=[
os.path.join(os.path.dirname(__file__), 'locale'),
],
LANGUAGE_CODE='en',
LANGUAG... | wkschwartz/django | tests/i18n/contenttypes/tests.py | Python | bsd-3-clause | 752 |
"""distutils.command.install_scripts
Implements the Distutils 'install_scripts' command, for installing
Python scripts."""
# contributed by Bastian Kleineidam
__revision__ = "$Id$"
import os
from distutils.core import Command
from distutils import log
from stat import ST_MODE
class install_scripts (C... | nmercier/linux-cross-gcc | win32/bin/Lib/distutils/command/install_scripts.py | Python | bsd-3-clause | 2,132 |
from __future__ import unicode_literals
from collections import OrderedDict
import hashlib
import os
import posixpath
import re
import json
from django.conf import settings
from django.core.cache import (caches, InvalidCacheBackendError,
cache as default_cache)
from django.core.exception... | rooshilp/CMPUT410Lab6 | virt_env/virt1/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py | Python | apache-2.0 | 14,802 |
# ------------------------------------------------------------------------
# Copyright 2015 Intel Corporation
#
# 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/li... | iotk/iochibity-java | site_scons/iotivityconfig/compiler/configuration.py | Python | epl-1.0 | 6,546 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def add_legacy_name(apps, schema_editor):
ContentType = apps.get_model('contenttypes', 'ContentType')
for ct in ContentType.objects.all():
try:
ct.name = apps.get_model(ct.app_label, c... | BitWriters/Zenith_project | zango/lib/python3.5/site-packages/django/contrib/contenttypes/migrations/0002_remove_content_type_name.py | Python | mit | 1,168 |
dict([(k, chr(k + 65)) for k in range(10)]) | asedunov/intellij-community | python/testData/intentions/convertDictComp_after.py | Python | apache-2.0 | 43 |
"""
Parent of all (field) classes in Hachoir: Field.
"""
from hachoir_core.compatibility import reversed
from hachoir_core.stream import InputFieldStream
from hachoir_core.error import HachoirError, HACHOIR_ERRORS
from hachoir_core.log import Logger
from hachoir_core.i18n import _
from hachoir_core.tools import makePr... | kreatorkodi/repository.torrentbr | plugin.video.yatp/site-packages/hachoir_core/field/field.py | Python | gpl-2.0 | 8,646 |
p<caret>rint 1
print 3
| idea4bsd/idea4bsd | python/testData/copyPaste/LineToBegin.dst.py | Python | apache-2.0 | 23 |
#!/usr/bin/env python
# Copyright 2009 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... | repomain/namebench | libnamebench/nameserver.py | Python | apache-2.0 | 18,079 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_remath
----------------------------------
Tests for `remath` module.
"""
import unittest
from remath import remath
class TestRemath(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_downpayment(self):
... | austinmcconnell/remath | tests/test_remath.py | Python | isc | 1,766 |
'''
Name: Weather Application
Author: Redder04
Extra Requirements: Unirest, Mashape Key
Unirest: http://unirest.io/
Mashape: https://www.mashape.com/
Description: This application will connect to a Mashape Weather API. The user will
supply a City or State (I might add GPS Capabilites later) and send the request. The ... | Redder/Weather-App-Python | Weather.py | Python | mit | 4,583 |
# testing/requirements.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Global database feature support policy.
Provides decorators to mark tests ... | michaelBenin/sqlalchemy | lib/sqlalchemy/testing/requirements.py | Python | mit | 17,967 |
def f1():
class A(object):
pass
class B(A):
pass
" Invalid mro:"
class C(A,B): # e 4
pass
def f2():
class A(object):
w = ''
x = ''
y = ''
z = ''
class B(A):
y = 1
z = 1
class C(A):
x = True
y = True
... | kmod/icbd | icbd/type_analyzer/tests/multiple_inheritance.py | Python | mit | 543 |
"""
Django settings for serverctl_prototype project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
""... | uehara1414/serverctl-prototype | serverctl_prototype/settings.py | Python | mit | 3,666 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-05-29 10:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('django_p', '0001_initial'),
]
operations = [
... | lucemia/django-p | django_p/migrations/0002_auto_20160529_1026.py | Python | mit | 549 |
from i3pystatus.playerctl import Playerctl
class Spotify(Playerctl):
"""
Get Spotify info using playerctl. Based on `Playerctl`_ module.
"""
player_name = "spotify"
| m45t3r/i3pystatus | i3pystatus/spotify.py | Python | mit | 183 |