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 __future__ import unicode_literals
from django.db import migrations, models
import treemap.json_field
class Migration(migrations.Migration):
dependencies = [
('modeling', '0002_remove_plan_currentscenarioid'),
]
operations = [
migrations.AddField(
... | maurizi/otm-core | opentreemap/modeling/migrations/0003_plan_zoom_lat_lng.py | Python | agpl-3.0 | 462 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Ssmtp(AutotoolsPackage):
"""A program that replaces sendmail on workstations that should s... | LLNL/spack | var/spack/repos/builtin/packages/ssmtp/package.py | Python | lgpl-2.1 | 2,247 |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server.models.tapi_photonic_media_media_channel_properties_pac import TapiPhotonicMediaMediaChannelProperties... | karthik-sethuraman/ONFOpenTransport | RI/flask_server/tapi_server/models/tapi_photonic_media_media_channel_connection_end_point_spec.py | Python | apache-2.0 | 2,409 |
'''
Created on Jun 10, 2010
@author: jnaous
'''
from django import forms
from django.contrib.auth.models import User
from models import PermissionUser, PermissionRequest
class PermissionRequestForm(forms.ModelForm):
"""
A form that can be used to request a permission from another user.
"""
class ... | dana-i2cat/felix | optin_manager/src/python/openflow/common/permissions/forms.py | Python | apache-2.0 | 688 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from typing import Any, Dict
from django.conf import settings
from zerver.lib.test_helpers import (
most_recent_message,
)
from zerver.lib.test_classes import (
ZulipTestCase,
)
from zerver.models import (
... | vaidap/zulip | zerver/tests/test_tutorial.py | Python | apache-2.0 | 2,671 |
from __future__ import absolute_import, unicode_literals
from mock import patch
from mopidy.mpd.protocol.status import SUBSYSTEMS
from tests.mpd import protocol
class IdleHandlerTest(protocol.BaseTestCase):
def idle_event(self, subsystem):
self.session.on_event(subsystem)
def assertEqualEvents(se... | ZenithDK/mopidy | tests/mpd/protocol/test_idle.py | Python | apache-2.0 | 8,146 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | gunan/tensorflow | tensorflow/python/keras/layers/pooling.py | Python | apache-2.0 | 39,575 |
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
#
# 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 restriction, including
# without limitation the rights to use, copy, modi... | YanjieGao/sparrow | deploy/third_party/boto-2.1.1/boto/s3/bucketlistresultset.py | Python | apache-2.0 | 5,867 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# 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... | mycFelix/heron | heronpy/api/serializer.py | Python | apache-2.0 | 1,874 |
#
# 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... | spektom/incubator-airflow | airflow/providers/apache/hive/operators/s3_to_hive.py | Python | apache-2.0 | 12,661 |
# Copyright (c) 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 ... | LoHChina/nova | nova/scheduler/host_manager.py | Python | apache-2.0 | 28,870 |
# 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 a... | lukas-krecan/tensorflow | tensorflow/python/summary/event_multiplexer_test.py | Python | apache-2.0 | 8,901 |
"""
AWS SQS platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.aws_sqs/
"""
import logging
import json
import voluptuous as vol
from homeassistant.const import (
CONF_PLATFORM, CONF_NAME)
from homeassistant.compone... | HydrelioxGitHub/home-assistant | homeassistant/components/notify/aws_sqs.py | Python | apache-2.0 | 2,607 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2011 Openstack, LLC.
# 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... | prometheanfire/openstack-guest-agents-unix | commands/redhat/__init__.py | Python | apache-2.0 | 730 |
"""Hierarchy of warnings to feed back to users."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# abdt_userwarning
#
# Public Classes:
# Base
# UsedDefaultTestPlan
# UnknownReviewers
# S... | kjedruczyk/phabricator-tools | py/abd/abdt_userwarning.py | Python | apache-2.0 | 2,673 |
from unittest.mock import Mock
from app.master.atom import Atom, AtomState
from app.master.job_config import JobConfig
from app.master.subjob import Subjob
from app.project_type.project_type import ProjectType
from test.framework.base_unit_test_case import BaseUnitTestCase
class TestSubjob(BaseUnitTestCase):
def... | box/ClusterRunner | test/unit/master/test_subjob.py | Python | apache-2.0 | 3,214 |
def test_helloWorld():
assert 1==1 | AnsgarSchmidt/sensomatic | web/Test.py | Python | apache-2.0 | 38 |
from django.contrib import admin
from .models import Tag
class TagAdmin(admin.ModelAdmin):
list_display = ('tag_text', 'num_addons', 'created', 'enable_for_random_shelf')
ordering = ('-created',)
search_fields = ('^tag_text',)
readonly_fields = ('num_addons', 'created')
list_editable = ('enable_f... | mozilla/addons-server | src/olympia/tags/admin.py | Python | bsd-3-clause | 376 |
from lib.common import helpers
class Stager:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'pkg',
'Author': ['@xorrior'],
'Description': ('Generates a pkg installer. The installer will copy a custom (empty) application to the /Applications folder. Th... | Hackplayers/Empire-mod-Hpys-tests | lib/stagers/osx/pkg.py | Python | bsd-3-clause | 3,867 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from ... import NDData, NDIOMixin, NDDataRef
# Alias NDDataAllMixins in case this will be renamed ... :-)
NDDataIO = NDDataRef
def test_simple_write_read(tmpdir):
ndd = NDDataIO([1, 2, 3])
assert ha... | tbabej/astropy | astropy/nddata/mixins/tests/test_ndio.py | Python | bsd-3-clause | 372 |
##########################################################################
#
# Copyright (c) 2015, Image Engine Design 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:
#
# * Redistrib... | appleseedhq/gaffer | python/GafferImageUI/ShuffleUI.py | Python | bsd-3-clause | 4,256 |
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals
from django.contrib import admin
from .models import CaptionedFile, UncaptionedFile
admin.site.register(CaptionedFile)
admin.site.register(UncaptionedFile)
| hnakamur/django-admin2 | example/files/admin.py | Python | bsd-3-clause | 251 |
##########################################################################
#
# Copyright (c) 2011, John Haddon. All rights reserved.
# Copyright (c) 2011-2012, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided ... | appleseedhq/gaffer | python/GafferUITest/NodeGadgetTest.py | Python | bsd-3-clause | 3,936 |
"""EntryAdmin for Zinnia"""
from __future__ import unicode_literals
from django.contrib import admin
from django.db.models import Q
from django.utils import timezone
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from django.core.urlresolvers import NoReverseMatch
from django... | aorzh/django-blog-zinnia | zinnia/admin/entry.py | Python | bsd-3-clause | 13,945 |
# 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 the... | rhurkes/chasegame | venv/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/conf.py | Python | mit | 846 |
from __future__ import print_function
import time
start = time.clock()
count = 0
for i in range(0, 1000000):
if "abc" == "abc":
count = count + 1
if "a slightly longer string" == \
"a slightly longer string":
count = count + 1
if "a significantly longer string but still not overwhelmingly long st... | foresterre/wren | test/benchmark/string_equals.py | Python | mit | 1,008 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | unreleased/azure-mgmt-machinelearning/azure/mgmt/machinelearning/__init__.py | Python | mit | 665 |
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
import signal
import sys
from portage.output import bold, create_color_func
def userquery(prompt, enter_invalid, responses=None, colours=None):
"""Displays a prompt and a... | prometheanfire/portage | pym/_emerge/userquery.py | Python | gpl-2.0 | 2,062 |
#
# Copyright 2013 Intel Corp.
#
# Author: Yunhong Jiang <yunhong.jiang@intel.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | ChinaMassClouds/copenstack-server | openstack/src/ceilometer-2014.2.2/ceilometer/transformer/__init__.py | Python | gpl-2.0 | 2,862 |
#!/usr/bin/env python
data = '../data/fm_train_real.dat'
parameter_list = [[data]]
def converter_factoranalysis(data_fname):
try:
import numpy
from shogun import RealFeatures, FactorAnalysis, EuclideanDistance, CSVFile
features = RealFeatures(CSVFile(data_fname))
converter = FactorAnalysis()
converter.set... | cfjhallgren/shogun | examples/undocumented/python/converter_factoranalysis.py | Python | gpl-3.0 | 630 |
########################################################################
# $HeadURL $
# File: FTSStrategy.py
# Author: Krzysztof.Ciba@NOSPAMgmail.com
# Date: 2013/04/12 13:12:07
########################################################################
""" :mod: FTSStrategy
=================
.. module: FTSStrate... | vmendez/DIRAC | DataManagementSystem/private/FTS2/FTS2Strategy.py | Python | gpl-3.0 | 18,293 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _, tools
class MrpRoutingWorkcenter(models.Model):
_name = 'mrp.routing.workcenter'
_description = 'Work Center Usage'
_order = 'bom_id, sequence, id'
_check_compan... | jeremiahyan/odoo | addons/mrp/models/mrp_routing.py | Python | gpl-3.0 | 6,018 |
## Copyright 2009 Laurent Bovet <laurent.bovet@windmaster.ch>
## Jordi Puigsegur <jordi.puigsegur@gmail.com>
##
## This file is part of wfrog
##
## wfrog 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 Softwar... | zedoude/wfrog | wfcommon/storage/mysql.py | Python | gpl-3.0 | 2,700 |
# -*- coding: utf-8 -*-
from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo
class ILoadTo(DeadCrypter):
__name__ = "ILoadTo"
__type__ = "crypter"
__version__ = "0.11"
__pattern__ = r'http://(?:www\.)?iload\.to/go/\d+-[\w.-]+/'
__config__ = []
__description__ =... | sebdelsol/pyload | module/plugins/crypter/ILoadTo.py | Python | gpl-3.0 | 458 |
# coding: utf-8
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from babel.core import UnknownLocaleError, Locale
from mock import patch
from bedrock.mozorg.tests impo... | ericawright/bedrock | lib/l10n_utils/tests/test_helpers.py | Python | mpl-2.0 | 4,181 |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
from os.path import join, dirname
import sys
import os
import glob
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
from numpy.distutils.system_info import get_info
... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/scipy/sparse/linalg/dsolve/setup.py | Python | agpl-3.0 | 1,730 |
#!/usr/bin/env python
# coding=utf-8
# aeneas is a Python/C library and a set of tools
# to automagically synchronize audio and text (aka forced alignment)
#
# Copyright (C) 2012-2013, Alberto Pettarin (www.albertopettarin.it)
# Copyright (C) 2013-2015, ReadBeyond Srl (www.readbeyond.it)
# Copyright (C) 2015-2017, A... | danielbair/aeneas | aeneas/syncmap/smftsv.py | Python | agpl-3.0 | 1,593 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RLdheatmap(RPackage):
"""Graphical Display of Pairwise Linkage Disequilibria Between SNPs
... | LLNL/spack | var/spack/repos/builtin/packages/r-ldheatmap/package.py | Python | lgpl-2.1 | 1,552 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import tempfile
class PyDmTree(PythonPackage):
"""tree is a library for working with nested data structures. In a
... | LLNL/spack | var/spack/repos/builtin/packages/py-dm-tree/package.py | Python | lgpl-2.1 | 2,296 |
"""Debounce helper."""
import asyncio
from logging import Logger
from typing import Any, Awaitable, Callable, Optional
from homeassistant.core import HassJob, HomeAssistant, callback
class Debouncer:
"""Class to rate limit calls to a specific command."""
def __init__(
self,
hass: HomeAssista... | tboyce1/home-assistant | homeassistant/helpers/debounce.py | Python | apache-2.0 | 3,861 |
input = """
1 2 2 1 3 4
1 3 2 1 2 4
1 4 0 0
1 5 2 1 6 7
1 6 2 1 5 7
1 7 0 0
1 1 1 1 2
1 1 1 1 5
5 9 4 2 0 2 5 2 2
1 8 1 0 9
0
5 c
3 b
2 a
8 ok
6 d
0
B+
0
B-
1
0
1
"""
output = """
{a, c, ok}
"""
| alviano/wasp | tests/asp/cautious/sum.example15.cautious.asp.test.py | Python | apache-2.0 | 195 |
import os
import asyncio
import tornado.web
import tornado.httpserver
import tornado.platform.asyncio
from waterbutler import settings
from waterbutler.server.api import v0
from waterbutler.server.api import v1
from waterbutler.server import handlers
from waterbutler.core.utils import AioSentryClient
from waterbutler... | cosenal/waterbutler | waterbutler/server/app.py | Python | apache-2.0 | 1,490 |
# Copyright (C) 2014 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2014 YAMAMOTO Takashi <yamamoto at valinux co jp>
#
# 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:... | o3project/ryu-oe | ryu/cfg.py | Python | apache-2.0 | 1,809 |
from cloudmailin import __version__
from setuptools import setup, find_packages
import os
f = open(os.path.join(os.path.dirname(__file__), 'README.rst'))
readme = f.read()
f.close()
setup(
name='django-cloudmailin',
version=__version__,
description='Client for CloudMailin incoming email service',
long... | mjbrownie/django-cloudmailin | setup.py | Python | bsd-3-clause | 897 |
"""
The :mod:`sklearn.model_selection._search` includes utilities to fine-tune the
parameters of an estimator.
"""
from __future__ import print_function
from __future__ import division
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Andreas... | hlin117/scikit-learn | sklearn/model_selection/_search.py | Python | bsd-3-clause | 49,204 |
"""
Some models for pulling data from Trac.
Initially generated by inspectdb then modified heavily by hand, often by
consulting http://trac.edgewall.org/wiki/TracDev/DatabaseSchema.
These are far from perfect: many (most?) Trac tables have composite primary
keys, which Django can't represent. This means a lot of buil... | hassanabidpk/djangoproject.com | tracdb/models.py | Python | bsd-3-clause | 8,724 |
#!/usr/bin/python
#
# Copyright 2017 Steven Watanabe
#
# 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)
from MockProgram import *
command('g++', '-print-prog-name=ar', stdout=script('ar.py'))
command('g++', '-print... | nawawi/poedit | deps/boost/tools/build/test/toolset-mock/src/gcc-4.8.3-linux.py | Python | mit | 6,602 |
#
# 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 module, and may assign their own license
# to the complet... | dmitry-sobolev/ansible | lib/ansible/module_utils/nxos.py | Python | gpl-3.0 | 12,464 |
from django.test import TestCase
from student.tests.factories import UserFactory, CourseEnrollmentFactory
from django_comment_common.models import Role, Permission
from factories import RoleFactory
import django_comment_client.utils as utils
class DictionaryTestCase(TestCase):
def test_extract(self):
d = ... | abhinavp13/IITBX-edx-platform-dev | lms/djangoapps/django_comment_client/tests/test_utils.py | Python | agpl-3.0 | 2,650 |
#!/usr/bin/env python2
# 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/LICENS... | JioCloud/tempest-lib | tempest_lib/cmd/skip_tracker.py | Python | apache-2.0 | 5,466 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorflow | tensorflow/lite/testing/op_tests/unroll_batch_matmul.py | Python | apache-2.0 | 3,288 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | sachinpro/sachinpro.github.io | tensorflow/contrib/metrics/python/ops/set_ops.py | Python | apache-2.0 | 7,963 |
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import numpy as np
import cv2
import matplotlib.pyplot as plt
from .... | EricssonResearch/scott-eu | simulation-ros/src/turtlebot2i/turtlebot2i_msdn/msdn/faster_rcnn/rpn_msr/generate.py | Python | apache-2.0 | 4,403 |
'''
'''
# 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");... | duke8253/trafficserver | tests/gold_tests/tls/tls_origin_session_reuse.test.py | Python | apache-2.0 | 8,300 |
'''
'''
# 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");... | duke8253/trafficserver | tests/gold_tests/runroot/runroot_use.test.py | Python | apache-2.0 | 2,902 |
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of condit... | gitttt/barf-project | barf/tests/core/reil/test_reilemulator.py | Python | bsd-2-clause | 13,141 |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = os.path.realpat... | carolFrohlich/nipype | nipype/interfaces/cmtk/nx.py | Python | bsd-3-clause | 26,027 |
import json
from django.contrib.auth.models import User
from django.http import HttpRequest
from django.test import TestCase
from tastypie.api import Api
from tastypie.exceptions import NotRegistered, BadRequest
from tastypie.resources import ModelResource
from tastypie.serializers import Serializer
from core.models i... | doselect/django-tastypie | tests/core/tests/api.py | Python | bsd-3-clause | 8,771 |
from tastypie.validation import Validation
from tastytools.exceptions import ValidationError, MissingField
class FieldsValidation(Validation):
def __init__(self, required=None, validated=None, **kwargs):
if required is None:
required = []
if validated is None:
validated =... | rtucker-mozilla/inventory | vendor-local/src/django-tastytools/tastytools/validation.py | Python | bsd-3-clause | 3,369 |
# -*- coding:utf-8 -*-
'''
同步排序队列的测试:
实际上, PriorityQueue就是用heapq实现的阻塞式队列
'''
import time
import bisect
from heapq import *
import threading
import queue
from collections import deque
"""
在满足功能要求的情况下, heapq的方式最快也最简洁效率最稳定
均为 100次循环,每次循环先插入1000个,然后弹出所有 #这个不是使用环境
在正式使用环境下,因为排序方式不需要全部检查,所以开销会比测试的要... | lovelylain/pyctp | example/pyctp2/testbed/tqueue.py | Python | mit | 6,474 |
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
"""
SPL
The ST Standard Peripheral Library provides a set of functions for
handling the peripherals on the STM32 Cortex-M3 family.
The idea is to save the user (the new user, in particular) having to deal
directly with the registers.
http://ww... | mcanthony/platformio | platformio/builder/scripts/frameworks/spl.py | Python | mit | 1,823 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2012, 2013, 2014, 2015 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... | SamiHiltunen/invenio-deposit | invenio_deposit/fields/pages_number.py | Python | gpl-2.0 | 1,526 |
from test.support import verbose, run_unittest, gc_collect, bigmemtest, _2G, \
cpython_only, captured_stdout
import io
import re
from re import Scanner
import sre_compile
import sre_constants
import sys
import string
import traceback
import unittest
from weakref import proxy
# Misc tests from Tim Peters' re.do... | PennartLoettring/Poettrix | rootfs/usr/lib/python3.4/test/test_re.py | Python | gpl-2.0 | 68,165 |
import numpy
import os
import argparse
import makeXYZ
parser = argparse.ArgumentParser(description="Take an XYZ file as input, rotate it in various directions and output a bunch of XYZ files into separate folders")
parser.add_argument("-o", "--output", default="output/", help="produced files and folders will be saved ... | SINGROUP/readAFM | databaseCode/toyDB/twoDiffAtomsHC/doXYZstuff.py | Python | gpl-3.0 | 3,212 |
# Copyright 2012-2015 MongoDB, 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... | kastriothaliti/techstitution | venv/lib/python3.5/site-packages/pymongo/read_preferences.py | Python | gpl-3.0 | 13,084 |
import csv
import itertools
import logging
import operator
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import psycopg2
from openerp.osv import orm, fields
from openerp.tools.translate import _
FIELDS_RECURSION_LIMIT = 2
ERROR_PREVIEW_BYTES = 200
_logger = logging.ge... | Jgarcia-IAS/SAT | openerp/addons/base_import/models.py | Python | agpl-3.0 | 13,840 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | addition-it-solutions/project-all | openerp/addons/base/res/ir_property.py | Python | agpl-3.0 | 12,186 |
# This is a component of LinuxCNC
# Copyright 2011 Michael Haberler <git@mah.priv.at>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your... | bmwiedemann/linuxcnc-mirror | tests/remap/fail/epilog/remap.py | Python | lgpl-2.1 | 1,063 |
#
# Copyright 2015 Hewlett Packard
#
# 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... | cernops/ceilometer | ceilometer/dns/notifications.py | Python | apache-2.0 | 2,410 |
import json
from django import VERSION
from django.core.serializers.json import DjangoJSONEncoder
from django.http import (HttpResponse as BaseHttpResponse,
HttpResponseBadRequest as Base400)
class ContentTypeMixin(object):
def __init__(self, *args, **kwargs):
if VERSION < (1, 5)... | johnseekins/graphite-web | webapp/graphite/compat.py | Python | apache-2.0 | 1,404 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 Rackspace Hosting
#
# 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... | TieWei/nova | nova/tests/virt/xenapi/test_driver.py | Python | apache-2.0 | 2,891 |
# Copyright 2016 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
from battor import battor_error
from battor import battor_wrapper
from py_utils import cloud_storage
from devil.android import battery_utils
... | benschmaus/catapult | telemetry/telemetry/internal/platform/tracing_agent/battor_tracing_agent.py | Python | bsd-3-clause | 4,035 |
"""Helpers for listening to events."""
import functools as ft
from datetime import timedelta
from ..core import HomeAssistant, callback
from ..const import (
ATTR_NOW, EVENT_STATE_CHANGED, EVENT_TIME_CHANGED, MATCH_ALL)
from ..util import dt as dt_util
from ..util.async import run_callback_threadsafe
# PyLint doe... | srcLurker/home-assistant | homeassistant/helpers/event.py | Python | mit | 9,620 |
"""Base classes for cursors.
These classes centralize common code.
"""
from vtdb import dbexceptions
class BasePEP0249Cursor(object):
"""Cursor with common PEP0249 implementations."""
def __init__(self):
self._clear_common_state()
self._conn = None
def callproc(self):
"""For PEP 0249."""
rai... | danielmt/vshard | vendor/github.com/youtube/vitess/py/vtdb/base_cursor.py | Python | mit | 5,310 |
"""
This page is in the table of contents.
Viewpoint move is a mouse tool to move the viewpoint in the xy plane.
When the mouse is clicked and dragged on the canvas, viewpoint move will drag the scroll pane accordingly. If the shift key is also pressed, the scroll pane will be moved only in the x or y direction, whic... | makerbot/ReplicatorG | skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/analyze_plugins/analyze_utilities/view_move.py | Python | gpl-2.0 | 3,600 |
# -*- coding: utf-8 -*-
#
# This file is part of NINJA-IDE (http://ninja-ide.org).
#
# NINJA-IDE 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
# any later version.
#
# NIN... | centaurialpha/ninja-ide | ninja_ide/intellisensei/analyzer/analyzer.py | Python | gpl-3.0 | 13,250 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jvrsantacruz/XlsxWriter | xlsxwriter/test/comparison/test_chart_gradient04.py | Python | bsd-2-clause | 1,716 |
"""
An example illustrating how to use the
:meth:`~rdflib.graph.Graph.transitive_subjects` and
:meth:`~rdflib.graph.Graph.transitive_objects` graph methods
Formal definition
^^^^^^^^^^^^^^^^^^
The :meth:`~rdflib.graph.Graph.transitive_objects` method finds all
nodes such that there is a path from subject to one of t... | ssssam/rdflib | examples/transitive.py | Python | bsd-3-clause | 2,627 |
import pymysql
from pymysql.tests import base
try:
import unittest2 as unittest
except ImportError:
import unittest
try:
import imp
reload = imp.reload
except AttributeError:
pass
import datetime
class TestOldIssues(base.PyMySQLTestCase):
def test_issue_3(self):
""" undefined methods... | MonicaHsu/truvaluation | venv/lib/python2.7/site-packages/pymysql/tests/test_issues.py | Python | mit | 13,281 |
#!/usr/bin/env python
class Bitmap(object):
def __init__(self):
pass
def __getitem__(self, item):
pass
def find(self, searchbox = (), tol = 0, frm = (), _type = 'default', client
= None):
if iterable(searchbox):
if len(searchbox) != 4:
... | riwu/Simba | Projects/libmml/pymml/mml/bitmap.py | Python | gpl-3.0 | 402 |
from scapy.all import *
def insert_ap(pkt):
## Done in the lfilter param
# if Dot11Beacon not in pkt and Dot11ProbeResp not in pkt:
# return
bssid = pkt[Dot11].addr3
if bssid in aps:
return
p = pkt[Dot11Elt]
cap = pkt.sprintf("{Dot11Beacon:%Dot11Beacon.cap%}"
... | firebitsbr/infernal-twin | w-sniffer.py | Python | gpl-3.0 | 1,165 |
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'heatmap': True,
'heatmap_message': _('Member Activity'),
'fieldname': 'member',
'transactions': [
{
'label': _('Membership Details'),
'items': ['Membership']
}
]
} | ovresko/erpnext | erpnext/non_profit/doctype/member/member_dashboard.py | Python | gpl-3.0 | 277 |
import os
import sys
here = os.path.abspath(os.path.split(__file__)[0])
repo_root = os.path.abspath(os.path.join(here, os.pardir))
sys.path.insert(0, os.path.join(here))
sys.path.insert(0, os.path.join(here, "six"))
sys.path.insert(0, os.path.join(here, "html5lib"))
sys.path.insert(0, os.path.join(here, "wptserve"))
... | Varentsov/servo | tests/wpt/web-platform-tests/tools/localpaths.py | Python | mpl-2.0 | 802 |
#!/usr/bin/env python
#
# Copyright 2008, 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... | fvacek/freeopcua | tests/gtest/test/gtest_xml_outfiles_test.py | Python | lgpl-3.0 | 5,345 |
#!/usr/bin/env python2.7
# Copyright 2015 gRPC 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
#
# Unless required by applicable la... | stanley-cheung/grpc | test/cpp/naming/utils/tcp_connect.py | Python | apache-2.0 | 1,629 |
#!/usr/bin/env python
#
# Copyright (c) Greenplum Inc 2008. All Rights Reserved.
#
'''
Greenplum logging facilities.
This Module contains some helper functions for setting up the
python builtin logging module. Tools and libraries are expected
to centralize configuration of logging through these functions.
Typical ... | hornn/interviews | tools/bin/gppylib/gplog.py | Python | apache-2.0 | 11,449 |
from collections import namedtuple
import logging
from pyleus.json_fields_bolt import JSONFieldsBolt
log = logging.getLogger('fields_bolt')
Fields = namedtuple('Fields', "url timestamp")
class FieldsBolt(JSONFieldsBolt):
OUTPUT_FIELDS = Fields
def extract_fields(self, json_dict):
log.debug(json_d... | ecanzonieri/pyleus | examples/top_urls/top_urls/fields.py | Python | apache-2.0 | 753 |
import logging
from framework.celery_tasks.handlers import enqueue_task
from website import settings
logger = logging.getLogger(__name__)
if settings.SEARCH_ENGINE == 'elastic':
import elastic_search as search_engine
else:
search_engine = None
logger.warn('Elastic search is not set to load')
def requir... | aaxelb/osf.io | website/search/search.py | Python | apache-2.0 | 3,664 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | dhruvg/luigi | luigi/contrib/hdfs/__init__.py | Python | apache-2.0 | 2,996 |
#
# Copyright 2012 eNovance <licensing@enovance.com>
# Copyright 2012 Red Hat, 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
#
# Unle... | eayunstack/ceilometer | ceilometer/compute/pollsters/instance.py | Python | apache-2.0 | 1,129 |
# Copyright 2015-present Scikit Flow 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... | panmari/tensorflow | tensorflow/contrib/skflow/python/skflow/tests/__init__.py | Python | apache-2.0 | 620 |
import logging
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from apps.bigbang import utils
class Command(BaseCommand):
args = '/path/to/file1.csv /path/to/file2.csv ...'
help = 'For creating product catalogues based on a CSV file'
option_list = Base... | elliotthill/django-oscar | sites/demo/apps/bigbang/management/commands/create_products.py | Python | bsd-3-clause | 1,243 |
# 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.
import csv
import json
import logging
import os
import subprocess
import tempfile
import threading
from collections import namedtuple
from core.perfetto_bi... | scheib/chromium | tools/perf/core/tbmv3/trace_processor.py | Python | bsd-3-clause | 13,087 |
##############################################################################
#
# 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... | daniel2101/fleosa | sale/wizard/sale_make_invoice.py | Python | gpl-3.0 | 3,022 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2017, 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... | subutai/nupic | tests/unit/nupic/regions/tm_region_test.py | Python | agpl-3.0 | 4,021 |
# Copyright 2013, Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
"""A Vitess keyspace represents a sharded MySQL database."""
import struct
from vtdb import keyrange_constants
pack_keyspace_id = struct.Struct('!Q').pack
class... | theskyinflames/bpulse-go-client | vendor/github.com/youtube/vitess/py/vtdb/keyspace.py | Python | apache-2.0 | 2,633 |
################################################################################
# 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... | apache/flink | flink-python/setup.py | Python | apache-2.0 | 14,871 |
import traceback
from django.db import connection
from django.http import HttpResponseNotAllowed
from django.template import RequestContext
from django.template import loader
from django.middleware.locale import LocaleMiddleware
from django.utils.translation.trans_real import parse_accept_lang_header
class Exception... | jomolinare/kobocat | onadata/libs/utils/middleware.py | Python | bsd-2-clause | 1,865 |
import errno
import os
from datetime import datetime
from django.conf import settings
from django.contrib.staticfiles.storage import CachedStaticFilesStorage
from django.core.files import storage
from django.utils import timezone
class DummyStorage(storage.Storage):
"""
A storage class that implements get_mo... | filias/django | tests/staticfiles_tests/storage.py | Python | bsd-3-clause | 2,085 |
from __future__ import with_statement
import os
from django.contrib.auth.models import User
from django.contrib.auth.forms import (UserCreationForm, AuthenticationForm,
PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm)
from django.core import mail
from django.forms.fields import Field, EmailFi... | uiri/pxqz | venv/lib/python2.7/site-packages/django/contrib/auth/tests/forms.py | Python | gpl-3.0 | 12,516 |