code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python3
#
# Copyright (c) 2016, The OpenThread Authors.
# 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
# ... | lanyuwen/openthread | tests/scripts/thread-cert/Cert_9_2_14_PanIdQuery.py | Python | bsd-3-clause | 3,516 |
import datetime
from corehq.apps.accounting import generator
from corehq.apps.accounting.invoicing import DomainInvoiceFactory
from corehq.apps.accounting.models import DefaultProductPlan, BillingAccount, Subscription, SubscriptionAdjustment
from corehq.apps.accounting.tests.base_tests import BaseAccountingTest
from co... | SEL-Columbia/commcare-hq | corehq/apps/accounting/tests/test_invoice_factory.py | Python | bsd-3-clause | 5,026 |
from gelato.models.addons import AddonBase, Category, AddonCategoryBase, AddonUser
| washort/gelato.admin | addons/models.py | Python | bsd-3-clause | 83 |
# -*- coding: utf-8 -*-
"""
envoy.core
~~~~~~~~~~
This module provides envoy awesomeness.
Copyright 2012, Kenneth Reitz.
MIT Licensed.
"""
import os
import shlex
import subprocess
import threading
__version__ = '0.0.2'
__license__ = 'MIT'
__author__ = 'Kenneth Reitz'
class Command(object):
def __init__(self... | guidowb/buildpack-python | test/distutils/envoy.py | Python | mit | 4,797 |
import requests
def run(data, settings):
message = data['payload']
key = None
if message.startswith('wfh'):
key = 'wfh'
elif message.startswith('anubis'):
key = 'anu'
else:
return None
url = "http://api.xxiivv.com/?key={0}&cmd=read".format(key)
r = requests.get(url... | cblgh/tenyks-contrib | src/tenyksscripts/scripts/orihaus_games.py | Python | mit | 770 |
# The number of elements to print for dataset ids/tasks
_print_threshold = 10
def get_print_threshold() -> int:
"""Return the printing threshold for datasets.
The print threshold is the number of elements from ids/tasks to
print when printing representations of `Dataset` objects.
Returns
----------
thre... | deepchem/deepchem | deepchem/utils/debug_utils.py | Python | mit | 1,744 |
from google.appengine.ext import ndb
class Account(ndb.Model):
"""
Accounts represent accounts people use on TBA.
"""
# Set by login/registration
# Not editable by the user
email = ndb.StringProperty()
nickname = ndb.StringProperty()
registered = ndb.BooleanProperty()
created = nd... | bvisness/the-blue-alliance | models/account.py | Python | mit | 521 |
from __future__ import unicode_literals
import collections
from django import template
from django.template import VariableDoesNotExist
from six import text_type, string_types
from djangoseo.base import get_metadata, get_linked_metadata
register = template.Library()
class MetadataNode(template.Node):
def __in... | romansalin/django-seo | djangoseo/templatetags/seo.py | Python | mit | 4,087 |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from emcee.autocorr import AutocorrError, integrated_time
def get_chain(seed=1234, ndim=3, N=100000):
np.random.seed(seed)
a = 0.9
x = np.empty((N, ndim))
x[0] = np.zeros(ndim)
for i in range(1, N):
x[i] = x[i - 1] * a + np.random.... | joezuntz/emcee | src/emcee/tests/unit/test_autocorr.py | Python | mit | 1,236 |
__author__ = 'dwae'
| gameduell/dslib | dslib/util/__init__.py | Python | mit | 20 |
"""
Book: Building RESTful Python Web Services
Chapter 3: Improving and adding authentication to an API with Django
Author: Gaston C. Hillar - Twitter.com/gastonhillar
Publisher: Packt Publishing Ltd. - http://www.packtpub.com
"""
"""gamesapi URL Configuration
The `urlpatterns` list routes URLs to views. For more info... | xianjunzhengbackup/code | http/REST/Building-RESTful-Python-Web-Services-master/Chapter 3/restful_python_chapter_03_03/gamesapi/gamesapi/urls.py | Python | mit | 972 |
import unittest
from conans.test.utils.tools import TestServer, TestClient
from conans.model.version import Version
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
from collections import OrderedDict
class VersionCheckTest(unittest.TestCase):
def check_versions_test(self):
# Client dep... | birsoyo/conan | conans/test/integration/version_check_test.py | Python | mit | 6,100 |
"""
WSGI config for cloudpebble project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATIO... | pebble/cloudpebble | cloudpebble/wsgi.py | Python | mit | 1,469 |
from itertools import islice
from math import exp
from math import log
import random
import unittest
from rasmus import stats
from rasmus import util
from rasmus.gnuplot import Gnuplot
from rasmus.testing import make_clean_dir
from rasmus import hmm
#================================================================... | abhishekgahlot/compbio | test/rasmus/test_hmm.py | Python | mit | 4,355 |
#
# 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
# ... | bcl/pykickstart | pykickstart/commands/zerombr.py | Python | gpl-2.0 | 3,174 |
# -*- coding: utf-8 -*-
#
# Copyright © 2008 Ricky Zhou
# Copyright © 2014 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 tha... | bstinsonmhk/fas | fas/validators.py | Python | gpl-2.0 | 14,256 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
# Copyright (C) 2006 Lukáš Lalinský
#
# 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... | dufferzafar/picard | picard/ui/options/tags.py | Python | gpl-2.0 | 6,114 |
#
# yuminstall.py
#
# Copyright (C) 2005, 2006, 2007 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option)... | Rogentos/legacy-anaconda | yuminstall.py | Python | gpl-2.0 | 77,924 |
#!/usr/bin/python3
# -*- encoding: utf-8 -*-
import datetime
import logging
import unittest
import clitests
from abrtcli.match import (get_match_data,
match_completer,
match_get_problems,
match_lookup)
from abrtcli.utils import captured... | mkutlak/abrt | src/cli/tests/test_match.py | Python | gpl-2.0 | 2,765 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2014 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) a... | MSusik/invenio | invenio/utils/vcs/svn.py | Python | gpl-2.0 | 2,585 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0005_event_outcome_reason'),
]
operations = [
migrations.CreateModel(
name='RelatedEvent',
... | JulianVolodia/Politikon | events/migrations/0006_relatedevent.py | Python | gpl-2.0 | 749 |
"""Default tags used by the template system, available to all templates."""
from __future__ import unicode_literals
import os
import sys
import re
from datetime import datetime
from itertools import groupby, cycle as itertools_cycle
import warnings
from django.conf import settings
from django.template.base import (No... | 912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/template/defaulttags.py | Python | gpl-2.0 | 50,803 |
# -*- coding: utf-8 -*-
import pytest
from cfme import test_requirements
from cfme.cloud.provider import CloudProvider
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.wait import TimedOutError
pytestmark = [
pytest.mark.tier(2),
test_requirements.general_ui,
pytest.mark.use... | Yadnyawalkya/integration_tests | cfme/tests/cloud/test_delete_cloud_object.py | Python | gpl-2.0 | 2,638 |
def main():
n = 2000000
sum = 0
prime = [True] * n
for p in range(2, n):
if prime[p]:
sum += p
for i in range(p * p, n, p):
prime[i] = False
print(sum)
if __name__ == "__main__":
main()
| OpenGenus/cosmos | code/online_challenges/src/project_euler/problem_010/problem_010.py | Python | gpl-3.0 | 262 |
# Copyright (c) 2012 The Regents of The University of Michigan
# Copyright (c) 2016 Centre National de la Recherche Scientifique
# 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 o... | vineodd/PIMSim | GEM5Simulation/gem5/configs/common/cores/arm/ex5_LITTLE.py | Python | gpl-3.0 | 5,637 |
#!/usr/bin/python
# This example integrates Jupiter and Saturn in the Solar system for a variety of initial conditions.
# Alongside the normal equations of motions, IAS15 is used to integrate the variational equations.
# These can be used to measure the Mean Exponential Growth of Nearby Orbits (MEGNO), a chaos indicato... | dchandan/rebound | python_examples/megno/problem.py | Python | gpl-3.0 | 3,314 |
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPD... | etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-eth_keyfile.py | Python | gpl-3.0 | 517 |
import sys, math
| pyta-uoft/pyta | examples/pylint/c0410_multiple_imports.py | Python | gpl-3.0 | 17 |
"""
Widget meta description classes
===============================
"""
import os
import sys
import warnings
# Exceptions
class DescriptionError(Exception):
pass
class WidgetSpecificationError(DescriptionError):
pass
class SignalSpecificationError(DescriptionError):
pass
class CategorySpecificati... | PythonCharmers/orange3 | Orange/canvas/registry/description.py | Python | gpl-3.0 | 16,985 |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2015 Daniel Rodriguez
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pub... | YuepengGuo/backtrader | backtrader/indicators/trix.py | Python | gpl-3.0 | 2,942 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import abc
import os
try:
from collections.abc import MutableMapping
except ImportError:
from collections import M... | pymedusa/SickRage | ext2/backports/configparser/helpers.py | Python | gpl-3.0 | 7,648 |
# SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
import logging
import requests
from cachecontrol.adapter import CacheControlAdapter
from cachecontrol.cache import DictCache
from cachecontrol.controller import logger
from argparse import ArgumentParser
def setup_logging():
lo... | SickGear/SickGear | lib/cachecontrol/_cmd.py | Python | gpl-3.0 | 1,326 |
import numpy as np
from gpaw.grid_descriptor import GridDescriptor
from gpaw.localized_functions import create_localized_functions
from gpaw.spline import Spline
s=Spline(0, 1.2, [1, 0.6, 0.1, 0.0])
a = 4.0
n = 24
gd = GridDescriptor((n, n, n), (a, a, a))
print gd.get_boxes((0, 0, 0), 1.2, 0)
if 0:
p = create_loca... | qsnake/gpaw | gpaw/test/gp2.py | Python | gpl-3.0 | 447 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2021, 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... | mrcslws/nupic.research | packages/self_supervised_learning/tests/unit/self_supervised_learning_test.py | Python | agpl-3.0 | 3,847 |
#-*- coding:utf-8 -*-
#
#
# Copyright (C) 2011 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# 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, eith... | bwrsandman/openerp-hr | hr_wage_increment/wizard/wage_increment.py | Python | agpl-3.0 | 2,472 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2013 jmesteve All Rights Reserved
# https://github.com/jmesteve
# <jmesteve@me.com>
#
# This program is... | jmesteve/openerpseda | openerp/addons_extra/account_move_line_extend/__init__.py | Python | agpl-3.0 | 1,071 |
#
# soaplib - Copyright (C) Soaplib contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This l... | soaplib/soaplib | src/soaplib/core/util/__init__.py | Python | lgpl-2.1 | 4,150 |
# Copyright 2013-2020 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 PyPyproj(PythonPackage):
"""Python interface to the PROJ.4 Library."""
homepage = "ht... | iulian787/spack | var/spack/repos/builtin/packages/py-pyproj/package.py | Python | lgpl-2.1 | 1,652 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#
import time
from kubernetes_py.K8sExceptions import TimedOutException
from kubernetes_py.K8sObject import K8sObject
from kubernetes_py.models... | mnubo/kubernetes-py | kubernetes_py/K8sPersistentVolumeClaim.py | Python | apache-2.0 | 3,778 |
# 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 use ... | zzcclp/carbondata | python/pycarbon/sdk/ArrowCarbonReader.py | Python | apache-2.0 | 3,613 |
from yapsy.IPlugin import IPlugin
class IContainerCrawler(IPlugin):
"""
Crawler plugin interface
Subclasses of this class can be used to implement crawling functions
for different systems.
"""
def crawl(self, container_id):
"""
Crawling function that should return a list of ... | cloudviz/agentless-system-crawler | crawler/icrawl_plugin.py | Python | apache-2.0 | 1,847 |
#!/usr/bin/env python
import json
import os
from os.path import join, exists
import argparse
def main(args):
prefix = os.path.abspath(os.path.dirname(__file__))
# Let's read the opcode and type files
with open(join(prefix, '..', '..', 'core', 'codegen', 'types.json')) as f:
types = json.loads(f... | madsbk/bohrium | bridge/c/gen_types.py | Python | apache-2.0 | 3,684 |
from __future__ import absolute_import
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.http import Http404
from django.shortcuts import redirect
from django.utils.translation import ugettext
from django.views.decorators.http import require_POST
import ... | Pinecast/pinecast | dashboard/views_network.py | Python | apache-2.0 | 6,500 |
# 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... | Laurawly/tvm-1 | tests/python/driver/tvmc/test_registry_options.py | Python | apache-2.0 | 2,904 |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | nzlosh/st2 | st2reactor/st2reactor/rules/engine.py | Python | apache-2.0 | 3,603 |
#!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo 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 ... | ycool/apollo | modules/tools/rosbag/copy_bags_between_disks.py | Python | apache-2.0 | 6,623 |
"""SmartApp functionality to receive cloud-push notifications."""
import asyncio
import functools
import logging
import secrets
from urllib.parse import urlparse
from uuid import uuid4
from aiohttp import web
from pysmartapp import Dispatcher, SmartAppManager
from pysmartapp.const import SETTINGS_APP_ID
from pysmartth... | jawilson/home-assistant | homeassistant/components/smartthings/smartapp.py | Python | apache-2.0 | 17,223 |
from django.utils import timezone
from django.contrib.contenttypes.models import ContentType
from nose.tools import * # noqa: F403
from api.base.settings.defaults import API_BASE
from tests.base import ApiTestCase
from osf_tests.factories import (
AuthUserFactory,
PreprintFactory
)
from osf.utils.permissions... | mattclark/osf.io | api_tests/preprints/views/test_preprint_files_list.py | Python | apache-2.0 | 15,540 |
#
#
# 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 th... | mdb/incubator-trafficcontrol | docs/source/conf.py | Python | apache-2.0 | 10,587 |
#
# 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... | maropu/spark | python/pyspark/pandas/categorical.py | Python | apache-2.0 | 5,290 |
# Copyright 2016 Hewlett Packard Enterprise Development LP
#
# 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... | sebrandon1/neutron | neutron/services/trunk/rpc/server.py | Python | apache-2.0 | 8,117 |
"""Unit tests for the javascript code."""
__author__ = 'John Orr (jorr@google.com)'
import os
import subprocess
import unittest
import appengine_config
class AllJavaScriptTests(unittest.TestCase):
def karma_test(self, test_folder):
karma_conf = os.path.join(
appengine_config.BUNDLE_ROOT, ... | daafgo/CourseBuilder-Xapi | tests/unit/javascript_tests.py | Python | apache-2.0 | 1,327 |
"""
Unit test for Treadmill linux runtime presence module.
"""
import os
import io
import shutil
import tempfile
import time
import unittest
from tests.testutils import mockzk
import mock
import kazoo
import kazoo.client
import yaml
import treadmill
from treadmill import exc
from treadmill import presence
from trea... | ThoughtWorksInc/treadmill | tests/presence_test.py | Python | apache-2.0 | 27,098 |
from lino.api import dd, _
from lino.utils.mldbc.mixins import BabelDesignated
class Expression(BabelDesignated):
class Meta:
verbose_name = _('Expression')
verbose_name_plural = _('Expressions')
class Expressions(dd.Table):
model = Expression
column_names = 'id designation *'
| lino-framework/book | lino_book/projects/de_BE/models.py | Python | bsd-2-clause | 313 |
from PyObjCTools.TestSupport import *
from Foundation import *
class TestNSDateFormatter (TestCase):
def testOutput(self):
formatter = NSDateFormatter.alloc().init()
formatter.setDateFormat_("yyyy/mm/dd")
self.assertResultIsBOOL(NSDateFormatter.getObjectValue_forString_range_error_)
... | albertz/music-player | mac/pyobjc-framework-Cocoa/PyObjCTest/test_nsdateformatter.py | Python | bsd-2-clause | 2,500 |
import os
import angr
import angr.analyses.decompiler
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
def test_smoketest():
p = angr.Project(os.path.join(test_location, 'x86_64', 'all'), auto_load_libs=False)
cfg = p.analyses.CFG(normalize=True)
... | angr/angr | tests/test_regionidentifier.py | Python | bsd-2-clause | 459 |
SECRET_KEY = 'bla'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'XXX',
'USER': 'XXX',
'PASSWORD': 'XXX',
'HOST': 'XXX',
'PORT': XXX
}
}
INSTALLED_APPS = (
'django_extensions',
'app',
)
| mkuiack/tkp | documentation/devref/database/schema/settings.py | Python | bsd-2-clause | 293 |
#!/usr/bin/env python
'''
@author David Stuebe
@file pyon/core/interceptor/test/test_msgpack_numpy_hook.py
@description test for raw msgpack hook
'''
from nose.tools import *
import unittest
import collections
import time
import numpy
import random
from msgpack import packb, unpackb
import hashlib
from pyon.core.i... | crchemist/scioncc | src/pyon/core/interceptor/test/test_msgpack_numpy_hook.py | Python | bsd-2-clause | 4,296 |
#
# JpHelp.py -- Jupyter web notebook help routines.
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import time
import random
import datetime
import threading
from tornado.ioloop import IOLoop
from ginga.misc import Bunch, Callback, log
default_timer_i... | pllim/ginga | ginga/web/jupyterw/JpHelp.py | Python | bsd-3-clause | 4,515 |
# -*- 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 model 'ThreadedComment'
db.create_table('threadedcomments_comment', (
('comment_ptr', s... | PolicyStat/django-threadedcomments | threadedcomments/migrations/0001_initial.py | Python | bsd-3-clause | 7,192 |
# -*- coding: utf-8 -*-
import logging
from django.db import models, transaction
from south.db import db
from south.v2 import DataMigration
logger = logging.getLogger(__name__)
class Migration(DataMigration):
def forwards(self, orm):
logger.debug("Migrating Issue abstracts...")
n = 0
for ... | nonZero/OpenCommunity | src/meetings/south_migrations/0007_update_agendaitem_background.py | Python | bsd-3-clause | 12,710 |
from __future__ import division, print_function, absolute_import
from os.path import join
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
from scipy._build_utils.system_info import get_info
lapack_opt = get_info('lapack_opt', notfound_action=2)
... | Eric89GXL/scipy | scipy/interpolate/setup.py | Python | bsd-3-clause | 1,571 |
"""
:author: Gary Ruben, 2009
:license: modified BSD
"""
__all__ = ["frt2", "ifrt2"]
import numpy as np
from numpy import roll, newaxis
def frt2(a):
"""Compute the 2-dimensional finite radon transform (FRT) for an n x n
integer array.
Parameters
----------
a : array_like
A 2-D square n ... | chintak/scikit-image | skimage/transform/finite_radon_transform.py | Python | bsd-3-clause | 3,206 |
from django.db.models import Q
from rest_framework import generics, serializers
from kitsune.gallery.models import Image
from kitsune.sumo.api import (
LocaleNegotiationMixin, InequalityFilterBackend, DateTimeUTCField, ImageUrlField)
class ImageShortSerializer(serializers.ModelSerializer):
url = ImageUrlFie... | YOTOV-LIMITED/kitsune | kitsune/gallery/api.py | Python | bsd-3-clause | 1,747 |
from django.db import models
from publisher.query import PublisherQuerySet
class PublisherManager(models.Manager):
"""Manager with some support handling publisher.
"""
def get_query_set(self):
"""Change standard model queryset to our own.
"""
return PublisherQuerySet(self.model)
... | emiquelito/django-cms-2.0 | publisher/manager.py | Python | bsd-3-clause | 777 |
import os
import skimage as si
import skimage.io as sio
import numpy as np
from numpy.testing import (
assert_array_equal, assert_array_almost_equal, run_module_suite)
from tempfile import NamedTemporaryFile
_plugins = sio.plugin_order()
sio.use_plugin('tifffile')
np.random.seed(0)
def teardown():
sio.re... | newville/scikit-image | skimage/io/tests/test_tifffile.py | Python | bsd-3-clause | 1,620 |
"""This module contains auxiliary functions for augmenting the ELFI graph."""
from functools import partial, reduce
from operator import add, mul
from toolz.functoolz import compose
from elfi.model.elfi_model import NodeReference, Operation
from elfi.utils import args_to_tuple
def add_pdf_gradient_nodes(model, log... | HIIT/elfi | elfi/model/augmenter.py | Python | bsd-3-clause | 3,269 |
"""Provider traversal tests."""
from dependency_injector import providers
def test_traversal_overriding():
provider1 = providers.Provider()
provider2 = providers.Provider()
provider3 = providers.Provider()
provider = providers.Provider()
provider.override(provider1)
provider.override(provid... | ets-labs/python-dependency-injector | tests/unit/providers/traversal/test_provider_py3.py | Python | bsd-3-clause | 1,525 |
"""
If the arbitrary constant class from issue 1336 is ever implemented, this
should serve as a set of test cases.
"""
from sympy import (acos, cos, cosh, Eq, exp, Function, I, Integral, log, Pow,
S, sin, sinh, sqrt, Symbol)
from sympy.solvers.ode import constant_renumber, constantsimp
from sympy.ut... | flacjacket/sympy | sympy/solvers/tests/test_constantsimp.py | Python | bsd-3-clause | 8,997 |
"""
:mod:`disco.settings` -- Disco Settings
=======================================
Settings can be specified in a Python file and/or using environment variables.
Settings specified in environment variables override those stored in a file.
The default settings are intended to make it easy to get Disco running on a sin... | mozilla/disco | lib/disco/settings.py | Python | bsd-3-clause | 15,713 |
"""
#;+
#; NAME:
#; abs_line
#; Version 1.0
#;
#; PURPOSE:
#; Module for individual absorption lines
#; 01-Nov-2014 by JXP
#;-
#;------------------------------------------------------------------------------
"""
from pdb import *
from xastropy.xutils.printing import printcol as xpcol
from xastropy.plotting.sim... | alfeinsod/xastropy | xastropy/xutils/xdebug.py | Python | bsd-3-clause | 541 |
# -*- test-case-name: vumi.components.tests.test_message_formatters -*-
from csv import writer
from zope.interface import Interface, implements
class IMessageFormatter(Interface):
""" Interface for writing messages to an HTTP request. """
def add_http_headers(request):
"""
Add any needed HT... | TouK/vumi | vumi/components/message_formatters.py | Python | bsd-3-clause | 2,440 |
from wtforms import Form
from tests import MultiDict
from wtforms_alchemy import null_or_unicode, SelectField
class TestSelectField(object):
def test_understands_none_values(self):
class MyForm(Form):
choice_field = SelectField(
choices=[('', '-- Choose --'), ('choice 1', 'Som... | kelvinhammond/wtforms-alchemy | tests/test_custom_fields.py | Python | bsd-3-clause | 498 |
# Copyright (c) 2017 Civic Knowledge. This file is licensed under the terms of the
# Revised BSD License, included in this distribution as LICENSE
"""
CLI program for managing Metatab files
"""
import json
import sys
from genericpath import exists
from metatab import DEFAULT_METATAB_FILE, MetatabDoc, parse_app_url
... | CivicKnowledge/metatab | metatab/cli.py | Python | bsd-3-clause | 7,253 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
"""
Utilities for using modules
"""
import frappe, os
import frappe.utils
from frappe import _
lower_case_files_for = ['DocType', 'Page', 'Report',
"Workflow", 'Module Def',... | gangadharkadam/letzfrappe | frappe/modules/__init__.py | Python | mit | 3,117 |
# coding=utf-8
"""
This class collects data on memory utilization
Note that MemFree may report no memory free. This may not actually be the case,
as memory is allocated to Buffers and Cache as well. See
[this link](http://www.linuxatemyram.com/) for more details.
#### Dependencies
* /proc/meminfo or psutil
"""
im... | mfriedenhagen/Diamond | src/collectors/memory/memory.py | Python | mit | 4,359 |
from . import Event, get_timestamp
from ..shared import console_repr
class Console(Event):
contains = ('line', 'time', 'user', 'source', 'kind', 'data', 'level')
requires = ('line',)
line = Event.Arg(required=True)
kind = Event.Arg()
time = Event.Arg()
user = Event.Arg(default='')
sou... | frostyfrog/mark2 | mk2/events/console.py | Python | mit | 626 |
from __future__ import print_function
from .CoherentLaser import *
| acq4/acq4 | acq4/devices/CoherentLaser/__init__.py | Python | mit | 67 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import pytest
class TestCookies(object):
config = """
tasks:
test_cookies:
text:
url: http://httpbin.org/cookies
... | qvazzler/Flexget | tests/test_cookies.py | Python | mit | 695 |
import os
from django.core.urlresolvers import reverse_lazy
try:
import otp_yubikey
except ImportError:
otp_yubikey = None
BASE_DIR = os.path.dirname(__file__)
SECRET_KEY = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.co... | mathspace/django-two-factor-auth | tests/settings.py | Python | mit | 1,499 |
# -*- coding: utf-8 -*-
"""
(c) 2014 - Copyright Red Hat Inc
Authors:
Pierre-Yves Chibon <pingou@pingoured.fr>
"""
from anitya.lib.backends import BaseBackend
from anitya.lib.exceptions import AnityaPluginException
class RubygemsBackend(BaseBackend):
''' The custom class for projects hosted on rubygems.o... | Prashant-Surya/anitya | anitya/lib/backends/rubygems.py | Python | gpl-2.0 | 2,448 |
import logging
from autotest.client.shared import error
from virttest import qemu_monitor
def run(test, params, env):
"""
QMP Specification test-suite: this checks if the *basic* protocol conforms
to its specification, which is file QMP/qmp-spec.txt in QEMU's source tree.
IMPORTANT NOTES:
o ... | uni-peter-zheng/tp-qemu | qemu/tests/qmp_basic_rhel6.py | Python | gpl-2.0 | 14,360 |
#!/usr/bin/env python
# encoding: utf-8
# Convert help for ginsh functions from man page to C source
import sys, re, optparse
rxStart = re.compile('^.*GINSH_FCN_HELP_START$')
rxEnd = re.compile('^.*GINSH_FCN_HELP_END$')
fcnRx = re.compile('^[.]BI\s+')
hlpRx = re.compile('\\\\[-]')
codeFmt = 'insert_help("%s",\n"%s"\n)... | ARudik/feelpp.ginac | ginsh/ginsh_fcn_help.py | Python | gpl-2.0 | 1,558 |
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error
class tcsh(test.test):
"""
Autotest module for testing basic functionality
of tcsh
@author Robert Paulsen, rpaulsen@us.ibm.com
"""
version = 1
nfail = 0
path =... | PoornimaNayak/autotest-client-tests | linux-tools/tcsh/tcsh.py | Python | gpl-2.0 | 1,158 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... | jcftang/ansible | lib/ansible/modules/cloud/ovirt/ovirt_affinity_groups.py | Python | gpl-3.0 | 10,833 |
from xml.dom.minidom import parseString
tracker_N={}
tracker_S={}
file = open('audiogames.xml','r')
data = file.read()
file.close()
dom = parseString(data)
lang = dom.getElementsByTagName('language')[0].toxml()
kin= dom.getElementsByTagName('number')[0].toxml()
kinects=kin.replace('<number>','').replace('</number>','')... | husk00/audiogames | argentina/readconf.py | Python | gpl-3.0 | 1,107 |
"""Utility functions for copying and archiving files and directory trees.
XXX The functions here don't copy the resource fork or other metadata on Mac.
"""
import os
import sys
import stat
from os.path import abspath
import fnmatch
import collections
import errno
import tarfile
try:
import bz2
del bz2
_... | lfcnassif/MultiContentViewer | release/modules/ext/libreoffice/program/python-core-3.3.0/lib/shutil.py | Python | lgpl-3.0 | 38,079 |
# -*- coding: utf-8 -*-
import logging
import collections
logger = logging.getLogger(__name__)
class WriteAction(object):
def __init__(self, method, *args, **kwargs):
if not callable(method):
raise ValueError('Argument `method` must be callable')
self.method = method
# Note... | sloria/modular-odm | modularodm/writequeue.py | Python | apache-2.0 | 2,146 |
#
# 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... | apache/incubator-airflow | tests/providers/amazon/aws/sensors/test_athena.py | Python | apache-2.0 | 2,442 |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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.apa... | jehine-MSFT/azure-storage-python | samples/file/share_usage.py | Python | apache-2.0 | 7,607 |
from rest_framework.exceptions import APIException
from rest_framework.exceptions import PermissionDenied as RestFrameworkPermissionDenied
class XOSProgrammingError(APIException):
status_code=400
def __init__(self, why="programming error", fields={}):
APIException.__init__(self, {"error": "XOSProgrammi... | xmaruto/mcord | xos/xos/exceptions.py | Python | apache-2.0 | 3,056 |
"""
Compare Image Tests
-------------------
This script compares all the mis-matching images found when running
$ nosetests astroML_fig_tests
The result of running this script is an html page comparing each output file
to the baseline result, showing only the ones with a mismatch above the
threshold specified in ast... | nhuntwalker/astroML | compare_images.py | Python | bsd-2-clause | 1,676 |
"""Simple validation of specifications passed to slybot"""
from os.path import dirname, join
import json
import rfc3987
from urlparse import urlparse, parse_qsl
from urllib import urlencode
from urllib2 import unquote
from jsonschema import Draft3Validator, RefResolver, FormatChecker
_PATH = dirname(__file__)
def... | flip111/portia | slybot/slybot/validation/schema.py | Python | bsd-3-clause | 1,712 |
from __future__ import division, absolute_import, print_function
import sys
import time
from datetime import date
import numpy as np
from numpy.testing import (
assert_, assert_equal, assert_allclose, assert_raises,
)
from numpy.lib._iotools import (
LineSplitter, NameValidator, StringConverter,
has_n... | tynn/numpy | numpy/lib/tests/test__iotools.py | Python | bsd-3-clause | 13,506 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import re
import sys
import subprocess
def RunCmdAndCheck(cmd, err_string, output_api, cwd=None):
results = []
p = subprocess.Popen(cmd, ... | keishi/chromium | ppapi/PRESUBMIT.py | Python | bsd-3-clause | 7,397 |
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.contenttypes.models import ContentType
from .conf import settings
def load_media_defaults():
media = []
defaults = {}
for key, backend in settings.PINAX_NOTIFICATIONS_BACKENDS.items():
# key is a tuple (medium_id, backend_... | coldmind/pinax-notifications | pinax/notifications/utils.py | Python | mit | 1,624 |
# -*- coding: utf-8 -*-
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
#
# Copyright (c) 2015 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the ... | tomkralidis/pycsw | pycsw/sru.py | Python | mit | 11,101 |
from socketserver import StreamRequestHandler, TCPServer
import socket
class EchoHandler(StreamRequestHandler):
timeout = 5
rbufsize = -1
wbufsize = 0
disable_nagle_algorithm = False
def handle(self):
print('Got connection from', self.client_address)
# self.rfile is a file-like obje... | tuanavu/python-cookbook-3rd | src/11/creating_a_tcp_server/echoserv4.py | Python | mit | 696 |
#!/usr/bin/env python2
"""SSH into a running appliance and install VMware VDDK.
"""
import argparse
import sys
from six.moves.urllib.parse import urlparse
from cfme.utils.appliance import IPAppliance, get_or_create_current_appliance
def log(message):
print("[VDDK-INSTALL] {}".format(message))
def main():
... | mfalesni/cfme_tests | scripts/install_vddk.py | Python | gpl-2.0 | 1,290 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
OpenLayers Plugin
A QGIS plugin
-------------------
begin : 2010-02-03
copyright : (C) 2010 by Pirmin Kalberer, Sourcepole
email : pka at source... | nextgis/ngq_compulink | qgis-installer/customization-conf/plugins/openlayers_plugin/openlayers_plugin_layer_type.py | Python | gpl-2.0 | 1,645 |