code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
import factory
from .models import (FKDummyModel, O2ODummyModel, BaseModel, ManyToManyToBaseModel,
ForeignKeyToBaseModel, OneToOneToBaseModel, ClassLevel1, ClassLevel2, ClassLevel3,
ManyToManyToBaseModelWithRelatedName, ChildModel, SubClassOfBaseModel)
class FKDummyModelFactory(factory.django.DjangoModelFac... | iwoca/django-deep-collector | tests/factories.py | Python | bsd-3-clause | 3,407 |
import io
import os
import sys
import codecs
import contextlib
# We do not trust traditional unixes about having reliable file systems.
# In that case we know better than what the env says and declare this to
# be utf-8 always.
has_likely_buggy_unicode_filesystem = \
sys.platform.startswith('linux') or 'bsd' in s... | mitsuhiko/python-unio | unio.py | Python | bsd-3-clause | 15,682 |
# -*- coding: utf-8 -*-
import wx
from copy import copy
sWhitespace = ' \t\n'
def SplitAndKeep(string, splitchars = " \t\n"):
substrs = []
i = 0
while len(string) > 0:
if string[i] in splitchars:
substrs.append(string[:i])
substrs.append(string[i])
string = string[i+1:]
i = 0
else:
i += 1
... | arthurljones/bikechurch-signin-python | src/controls/autowrapped_static_text.py | Python | bsd-3-clause | 2,223 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from cms.extensions import PageExtensionAdmin, TitleExtensionAdmin
from django.conf import settings
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from .forms import TitleMetaAdmi... | Formlabs/djangocms-page-meta | djangocms_page_meta/admin.py | Python | bsd-3-clause | 1,842 |
#import pytest
#import sys
import test.api as api
#import bauble.db as db
from bauble.model.user import User
def xtest_user_json(session):
username = 'test_user_json'
password = username
users = session.query(User).filter_by(username=username)
for user in users:
session.delete(user)
ses... | Bauble/bauble.api | test/spec/test_user.py | Python | bsd-3-clause | 1,763 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <nipreps@gmail.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... | oesteban/niworkflows | niworkflows/interfaces/bids.py | Python | bsd-3-clause | 35,326 |
#!/usr/bin/env python
#
# Copyright (C) 2009-2020 the sqlparse authors and contributors
# <see AUTHORS file>
#
# This module is part of python-sqlparse and is released under
# the BSD License: https://opensource.org/licenses/BSD-3-Clause
"""Module that contains the command line app.
Why does this file exist, and why ... | andialbrecht/sqlparse | sqlparse/cli.py | Python | bsd-3-clause | 5,712 |
from . import NetworkObject
import z3
class ErroneousAclWebProxy (NetworkObject):
"""A caching web proxy which enforces ACLs erroneously.
The idea here was to present something that is deliberately not path independent"""
def _init (self, node, network, context):
super(ErroneousAclWebProxy, self... | apanda/modeling | mcnet/components/erroneous_aclfull_proxy.py | Python | bsd-3-clause | 10,082 |
#!/usr/bin/env python
'''Print message using ANSI terminal codes'''
__author__ = "Miki Tebeka <miki@mikitebeka.com>"
from sys import stdout, stderr
# Format
bright = 1
dim = 2
underline = 4
blink = 5
reverse = 7
hidden = 8
# Forground
black = 30
red = 31
green = 32
yellow = 33
blue = 34
magenta = 35
cyan = 36
white... | tebeka/pythonwise | ansiprint.py | Python | bsd-3-clause | 2,287 |
# Copyright (c) 2012 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from multiconf import caller_file_line
from .utils.utils import next_line_num
from .utils_test_helpers import bb, fn_aa_exp, ln_aa_exp
ln_bb_exp = None
def test_caller_file_line():
... | lhupfeldt/multiconf | test/utils_test.py | Python | bsd-3-clause | 753 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from nose.tools import raises, eq_, ok_
from werkzeug.test import Client
from werkzeug.wrappers import BaseResponse
from clastic import Application, render_basic
from clastic.application import BaseApplication
from clastic.route import BaseRoute, Route... | kezabelle/clastic | clastic/tests/test_routing.py | Python | bsd-3-clause | 6,586 |
from django.conf import settings
import requests
from mozillians.celery import app
@app.task
def celery_healthcheck():
"""Ping healthchecks.io periodically to monitor celery/celerybeat health."""
response = requests.get(settings.HEALTHCHECKS_IO_URL)
return response.status_code == requests.codes.ok
| johngian/mozillians | mozillians/common/tasks.py | Python | bsd-3-clause | 316 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import date
from django.conf import settings
def settings_context(request):
"""
Makes available a template var for some interesting var in settings.py
"""
try:
ITEMS_PER_PAGE = settings.ITEMS_PER_PAGE
except AttributeError:
... | matagus/django-jamendo | apps/jamendo/context_processors.py | Python | bsd-3-clause | 558 |
# -*- coding: utf-8 -*-
"""
Display vnstat statistics.
Coloring rules.
If value is bigger that dict key, status string will turn to color, specified
in the value.
Example:
coloring = {
800: "#dddd00",
900: "#dd0000",
}
(0 - 800: white, 800-900: yellow, >900 - red)
Format of s... | Spirotot/py3status | py3status/modules/vnstat.py | Python | bsd-3-clause | 4,225 |
"""
kombu.transport.zmq
===================
ZeroMQ transport.
"""
from __future__ import absolute_import, unicode_literals
import errno
import os
import socket
try:
import zmq
from zmq import ZMQError
except ImportError:
zmq = ZMQError = None # noqa
from kombu.five import Empty
from kombu.log import g... | Elastica/kombu | kombu/transport/zmq.py | Python | bsd-3-clause | 8,476 |
from django.conf import settings
from django.conf.urls import url
from django.conf.urls.static import static
from . import views
urlpatterns = [
url(r'^$', views.home),
url(r'^subreddits$', views.subreddits),
url(r'^about$', views.about),
url(r'^api$', views.api),
url(r'^submission/(?P<id>[\w]+)$'... | xgi/aliendb | web/aliendb/apps/analytics/urls.py | Python | bsd-3-clause | 576 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("RidgeClassifier" , "iris" , "oracle")
| antoinecarme/sklearn2sql_heroku | tests/classification/iris/ws_iris_RidgeClassifier_oracle_code_gen.py | Python | bsd-3-clause | 135 |
"""
Perform Levenberg-Marquardt least-squares minimization, based on MINPACK-1.
AUTHORS
The original version of this software, called LMFIT, was written in FORTRAN
as part of the MINPACK-1 package by XXX.
Craig Markwardt converted the FORTRAN code to IDL. The information for ... | philrosenfield/ResolvedStellarPops | utils/mpfit/mpfit.py | Python | bsd-3-clause | 93,267 |
#
# Functions for interacting with the network_types table in the database
#
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
from PLC.Faults import *
from PLC.Parameter import Parameter
from PLC.Table import Row, Table
class NetworkType(Row):
"""
Representat... | dreibh/planetlab-lxc-plcapi | PLC/NetworkTypes.py | Python | bsd-3-clause | 1,417 |
import collections
import copy
import functools
import itertools
import json
import time
import warnings
from sentinels import NOTHING
from .filtering import filter_applies, iter_key_candidates
from . import ObjectId, OperationFailure, DuplicateKeyError
from .helpers import basestring, xrange, print_deprecation_warning... | chartbeat-labs/mongomock | mongomock/collection.py | Python | bsd-3-clause | 39,269 |
from binding import *
from .Value import ValueSymbolTable, Value
from .ADT.StringRef import StringRef
@ValueSymbolTable
class ValueSymbolTable:
if LLVM_VERSION >= (3, 3):
_include_ = 'llvm/IR/ValueSymbolTable.h'
else:
_include_ = 'llvm/ValueSymbolTable.h'
new = Constructor()
delete = De... | llvmpy/llvmpy | llvmpy/src/ValueSymbolTable.py | Python | bsd-3-clause | 486 |
import logging
import emission.storage.timeseries.abstract_timeseries as esta
import emission.core.wrapper.entry as ecwe
def get_last_entry(user_id, time_query, config_key):
user_ts = esta.TimeSeries.get_time_series(user_id)
# get the list of overrides for this time range. This should be non zero
# o... | yw374cornell/e-mission-server | emission/analysis/configs/config_utils.py | Python | bsd-3-clause | 967 |
# $Filename$
# $Authors$
#
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
#
... | DLR-SC/DataFinder | src/datafinder/core/item/privileges/__init__.py | Python | bsd-3-clause | 1,769 |
import torch
from .Criterion import Criterion
from .utils import recursiveResizeAs, recursiveFill, recursiveAdd
class ParallelCriterion(Criterion):
def __init__(self, repeatTarget=False):
super(ParallelCriterion, self).__init__()
self.criterions = []
self.weights = []
self.gradInp... | RPGOne/Skynet | pytorch-master/torch/legacy/nn/ParallelCriterion.py | Python | bsd-3-clause | 1,404 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..epi import ApplyTOPUP
def test_ApplyTOPUP_inputs():
input_map = dict(args=dict(argstr='%s',
),
datatype=dict(argstr='-d=%s',
),
encoding_file=dict(argstr='--datain=%s',
mandatory=True,
),
... | mick-d/nipype | nipype/interfaces/fsl/tests/test_auto_ApplyTOPUP.py | Python | bsd-3-clause | 1,586 |
from django.test import TestCase
from manager.models import Page
from datetime import datetime, timedelta
from django.utils import timezone
class PageTestCase(TestCase):
def setUp(self):
now = timezone.now()
Page.objects.create(url="testurl", description="test description")
def test_regular_page_... | olkku/tf-info | manager/tests.py | Python | bsd-3-clause | 3,567 |
from __future__ import absolute_import, unicode_literals
######################
# MEZZANINE SETTINGS #
######################
# The following settings are already defined with default values in
# the ``defaults.py`` module within each of Mezzanine's apps, but are
# common enough to be put here, commented out, for con... | simodalla/mezzanine_mailchimper | project_template/settings.py | Python | bsd-3-clause | 14,784 |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2014-2015, Dataspeed 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 c... | cmsc421/mobility_base_tools | scripts/urdf_remove_pedestal.py | Python | bsd-3-clause | 3,158 |
def extractFinebymetranslationsWordpressCom(item):
'''
Parser for 'finebymetranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Death Progress Bar', 'Death Progress ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractFinebymetranslationsWordpressCom.py | Python | bsd-3-clause | 666 |
import json
import csv
teamfolder = "teamdata/out/"
with open('combined.json', 'r') as jsonfile:
data = json.load(jsonfile)
for yeardata in data:
year = yeardata['year']
print ""
print "NEW YEAR " + str(year)
for team in yeardata['teams']:
teamname = team['team']
print "Doing team... | Tankske/InfoVisNBA | scraper/remove.py | Python | bsd-3-clause | 1,393 |
#!/usr/bin/env python
from distutils.core import setup
setup(
name = 'pydouban',
version = '1.0.0',
description = 'Lightweight Python Douban API Library',
author = 'Marvour',
author_email = 'marvour@gmail.com',
license = 'BSD License',
url = 'http://i.shiao.org/a/pydouban',
packages = ... | lepture/pydouban | setup.py | Python | bsd-3-clause | 336 |
# -*- coding: UTF-8 -*-
# YaBlog
# (c) Regis FLORET
# 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 fol... | regisf/yablog | blog/templatetags/__init__.py | Python | bsd-3-clause | 1,525 |
from django.contrib.auth.decorators import user_passes_test
from django.contrib.auth.models import Group
def group_required(names, login_url=None):
"""
Checks if the user is a member of a particular group (or at least one
group from the list)
"""
if not hasattr(names,'__iter__'):
names = [n... | solex/django-odesk | django_odesk/auth/decorators.py | Python | bsd-3-clause | 446 |
from unittest import TestCase
from tcontrol.discretization import c2d
from ..transferfunction import tf
from ..model_conversion import *
from ..statespace import StateSpace
import numpy as np
from .tools.test_utility import assert_ss_equal
class TestDiscretization(TestCase):
def setUp(self):
self.s1 = tf... | DaivdZhang/tinyControl | tcontrol/tests/test_discretization.py | Python | bsd-3-clause | 1,236 |
import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, features, eps=1e-6):
super().__init__()
self.gamma = nn.Parameter(torch.ones(features))
self.beta = nn.Parameter(torch.zeros(features))
self.eps = eps
def forward(self, x):
mean = x.mean(... | isaachenrion/jets | src/architectures/utils/layer_norm.py | Python | bsd-3-clause | 446 |
"""
WSGI config for uptee 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_APPLICATION`` se... | upTee/upTee | uptee/wsgi.py | Python | bsd-3-clause | 1,132 |
#---------------------------------
#Joseph Boyd - joseph.boyd@epfl.ch
#---------------------------------
import os ; import sys ; import pickle
def main():
num_partitions = 8
unique_users = {}
print "Merging..."
for filename in os.listdir("."):
if filename[filename.rfind('.')+1:] == 'pickle':
... | FAB4D/humanitas | data_collection/social_media/twitter/merge.py | Python | bsd-3-clause | 933 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2015, MuChu Hsu
Contributed by Muchu Hsu (muchu1983@gmail.com)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
import unittest
import logging
from cameo.spiderForPEDAILY import SpiderForPEDAILY
"""
測試 抓取 PEDAILY
"""
class SpiderForPEDAILYTe... | muchu1983/104_cameo | test/unit/test_spiderForPEDAILY.py | Python | bsd-3-clause | 1,237 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 30, transform = "None", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_None/trend_MovingAverage/cycle_30/ar_12/test_artificial_32_None_MovingAverage_30_12_20.py | Python | bsd-3-clause | 264 |
# -*- 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 'Video2013.created'
db.add_column('videos_video2013', 'created',
self.g... | mozilla/firefox-flicks | flicks/videos/migrations/0020_auto__add_field_video2013_created.py | Python | bsd-3-clause | 7,284 |
import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame, Index
import pandas._testing as tm
@pytest.mark.parametrize(
"interpolation", ["linear", "lower", "higher", "nearest", "midpoint"]
)
@pytest.mark.parametrize(
"a_vals,b_vals",
[
# Ints
([1, 2, 3, 4, 5], [5,... | jreback/pandas | pandas/tests/groupby/test_quantile.py | Python | bsd-3-clause | 9,272 |
from base import *
DEBUG = False | vicalloy/dj-scaffold | dj_scaffold/conf/prj/sites/settings/production.py | Python | bsd-3-clause | 33 |
# -*-coding:Utf-8 -*
# Copyright (c) 2013 LE GOFF Vincent
# 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
# lis... | stormi/tsunami | src/secondaires/navigation/equipage/volontes/relacher_gouvernail.py | Python | bsd-3-clause | 3,566 |
# ----------------------------------------------------------------------------
# Copyright (c) 2011-2015, The American Gut Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# -----------------------------------... | biocore/american-gut-rest | agr/schema.py | Python | bsd-3-clause | 5,875 |
import os
import tempfile
import shutil
def listar(directorio):
"""Regresa uns lista con los archivos contenidos
en unca carpeta"""
archivos = os.listdir(directorio)
buff = []
for archivo in archivos:
ruta = os.path.join(directorio, archivo)
if os.path.isfile(ruta):
buf... | GrampusTeam/Grampus | core/directorio.py | Python | bsd-3-clause | 750 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 7, transform = "RelativeDifference", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_MovingAverage/cycle_7/ar_/test_artificial_32_RelativeDifference_MovingAverage_7__20.py | Python | bsd-3-clause | 276 |
# -----------------------------------------------------------------------------
# Copyright (c) 2016--, The Plate Mapper Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------... | squirrelo/plate-mapper | platemap/lib/plate.py | Python | bsd-3-clause | 11,253 |
# -*- coding: utf-8 -*-
#
# ask-undrgz system of questions uses data from underguiz.
# Copyright (c) 2010, Nycholas de Oliveira e Oliveira <nycholas@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... | nycholas/ask-undrgz | src/ask-undrgz/ask_undrgz/settings.py | Python | bsd-3-clause | 5,653 |
#! /usr/bin/python3
# The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797, 379, 37, and 3.
# Find the sum of the only eleven primes that are... | jeffseif/projectEuler | src/p037.py | Python | bsd-3-clause | 1,027 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# TEST_UNICODE_LITERALS
from ... import table
from .. import pprint
class MyRow(table.Row):
def __str__(self):
return str(self.as_void())
class MyColumn(table.Column):
pass
class MyMaskedColumn(table.MaskedCo... | AustereCuriosity/astropy | astropy/table/tests/test_subclass.py | Python | bsd-3-clause | 2,488 |
import itertools as it
import warnings
import numpy as np
from numpy.testing import assert_equal, assert_raises
from skimage.segmentation import slic
def test_color_2d():
rnd = np.random.RandomState(0)
img = np.zeros((20, 21, 3))
img[:10, :10, 0] = 1
img[10:, :10, 1] = 1
img[10:, 10:, 2] = 1
i... | almarklein/scikit-image | skimage/segmentation/tests/test_slic.py | Python | bsd-3-clause | 4,145 |
# -*- coding: utf-8 -*-
"""
Implement PyPiXmlRpc Service.
See: http://wiki.python.org/moin/PyPiXmlRpc
"""
import logging
from pyramid_xmlrpc import XMLRPCView
from pyshop.models import DBSession, Package, Release, ReleaseFile
from pyshop.helpers import pypi
log = logging.getLogger(__name__)
# XXX not tested.
cla... | last-g/pyshop | pyshop/views/xmlrpc.py | Python | bsd-3-clause | 8,468 |
# -*-coding:Utf-8 -*
# Copyright (c) 2012 LE GOFF Vincent
# 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
# l... | stormi/tsunami | src/secondaires/jeux/plateaux/oie/pion.py | Python | bsd-3-clause | 1,992 |
# -*- coding: utf-8 -*-
from loading import load_plugins, register_plugin
from plugz import PluginTypeBase
from plugintypes import StandardPluginType
__author__ = 'Matti Gruener'
__email__ = 'matti@mistermatti.com'
__version__ = '0.1.5'
__ALL__ = [load_plugins, register_plugin, StandardPluginType, PluginTypeBase]
| mistermatti/plugz | plugz/__init__.py | Python | bsd-3-clause | 317 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013-2014, Martín Gaitán
# Copyright (c) 2012-2013, Alexander Jung-Loddenkemper
# This file is part of Waliki (http://waliki.nqnwebs.com/)
# License: BSD (https://github.com/mgaitan/waliki/blob/master/LICENSE)
#============================================... | mgaitan/waliki_flask | waliki/markup.py | Python | bsd-3-clause | 7,181 |
from setuptools import setup, find_packages
setup(
name='zeit.content.gallery',
version='2.9.2.dev0',
author='gocept, Zeit Online',
author_email='zon-backend@zeit.de',
url='http://www.zeit.de/',
description="vivi Content-Type Portraitbox",
packages=find_packages('src'),
package_dir={''... | ZeitOnline/zeit.content.gallery | setup.py | Python | bsd-3-clause | 1,113 |
# Generated by Django 2.2.1 on 2019-09-19 11:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dojo', '0021_cve_index'),
]
operations = [
migrations.AddField(
model_name='system_settings',
name='credentials',
... | rackerlabs/django-DefectDojo | dojo/db_migrations/0022_google_sheet_sync_additions.py | Python | bsd-3-clause | 963 |
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# Copyright (c) 2014, Arista Networks, 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 reta... | arista-eosext/rphm | setup.py | Python | bsd-3-clause | 3,002 |
import os
import random
import time
import hashlib
import warnings
from tempfile import mkdtemp
from shutil import rmtree
from six.moves.urllib.parse import urlparse
from six import BytesIO
from twisted.trial import unittest
from twisted.internet import defer
from scrapy.pipelines.files import FilesPipeline, FSFilesS... | wujuguang/scrapy | tests/test_pipeline_files.py | Python | bsd-3-clause | 16,352 |
#!/usr/bin/python3
#-*- coding:utf-8 -*-
from functools import wraps
def xxx(func):
@wraps(func)
def my(n):
func(n*100)
return
return my
@xxx
def abc(n):
print(n)
if __name__ == '__main__':
abc(10)
abc.__wrapped__(10)
xx = abc.__wrapped__
xx(1234)
| yuncliu/Learn | python/decorator.py | Python | bsd-3-clause | 299 |
"""Metrics to assess performance on classification task given scores
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.... | mehdidc/scikit-learn | sklearn/metrics/ranking.py | Python | bsd-3-clause | 21,796 |
#
# Module implementing queues
#
# multiprocessing/queues.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
from __future__ import absolute_import
import sys
import os
import threading
import collections
import weakref
import errno
from . import connection
from . import cont... | flaviogrossi/billiard | billiard/queues.py | Python | bsd-3-clause | 12,304 |
from django.utils.importlib import import_module
def function_from_string(string):
module, func = string.rsplit(".", 1)
m = import_module(module)
return getattr(m, func) | chrisdrackett/django-support | support/functions.py | Python | bsd-3-clause | 187 |
#!/usr/bin/env python
# coding=utf-8
__author__ = u'Ahmed Şeref GÜNEYSU'
import ui
| guneysus/packathon2016 | packathon2016/__init__.py | Python | bsd-3-clause | 85 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('telerivet', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='incomingrequest',
n... | qedsoftware/commcare-hq | corehq/messaging/smsbackends/telerivet/migrations/0002_add_index_on_webhook_secret.py | Python | bsd-3-clause | 464 |
#!/usr/bin/env python
# Copyright 2018 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 unpack_pak
import unittest
class UnpackPakTest(unittest.TestCase):
def testMapFileLine(self):
self.assertTrue(unpack_pak... | endlessm/chromium-browser | chrome/browser/resources/unpack_pak_test.py | Python | bsd-3-clause | 1,132 |
from owtf.managers.resource import get_resources
from owtf.plugin.helper import plugin_helper
DESCRIPTION = "Plugin to assist manual testing"
def run(PluginInfo):
resource = get_resources("ExternalSSL")
Content = plugin_helper.resource_linklist("Online Resources", resource)
return Content
| owtf/owtf | owtf/plugins/web/external/Testing_for_SSL-TLS@OWTF-CM-001.py | Python | bsd-3-clause | 305 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# HobsonPy documentation build configuration file, created by
# sphinx-quickstart on Sat Sep 16 18:59:19 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... | asweigart/hobson | docs/conf.py | Python | bsd-3-clause | 8,164 |
from __future__ import with_statement
import logging
import warnings
import django
from django.conf import settings
from django.conf.urls.defaults import patterns, url
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, ValidationError
from django.core.urlresolvers import NoReverseMatch, rev... | VishvajitP/django-tastypie | tastypie/resources.py | Python | bsd-3-clause | 84,667 |
from execnet import Group
from execnet.gateway_bootstrap import fix_pid_for_jython_popen
def test_jython_bootstrap_not_on_remote():
group = Group()
try:
group.makegateway('popen//id=via')
group.makegateway('popen//via=via')
finally:
group.terminate(timeout=1.0)
def test_jython_bo... | bryan-lunt/execnet | testing/test_fixes.py | Python | mit | 1,009 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/component/armor/shared_armor_segment_chitin.iff"
result.attribute_t... | obi-two/Rebelion | data/scripts/templates/object/tangible/component/armor/shared_armor_segment_chitin.py | Python | mit | 489 |
#!/usr/bin/env python
__author__ = 'Rolf Jagerman'
from PySide import QtGui
import os
from authentication import AuthenticationListener, AuthenticationClient
from loadui import loadUi
from config import UI_DIRECTORY
from drawers import Drawers
from users import User
from locations import Location
class AddDelivery(Q... | MartienLagerweij/aidu | aidu_gui/src/aidu_gui/add_delivery.py | Python | mit | 3,609 |
import demistomock as demisto
from CommonServerPython import BaseClient
import BitSightForSecurityPerformanceManagement as bitsight
from datetime import datetime
def test_get_companies_guid_command(mocker):
# Positive Scenario
client = bitsight.Client(base_url='https://test.com')
res = {"my_company": {"g... | demisto/content | Packs/BitSight/Integrations/BitSightForSecurityPerformanceManagement/BitSightForSecurityPerformanceManagement_test.py | Python | mit | 2,406 |
#! /usr/bin/env python
from openturns import *
ref = NumericalMathFunction("x", "sin(x)")
size = 12
locations = NumericalPoint(size)
values = NumericalPoint(size)
derivatives = NumericalPoint(size)
# Build locations/values/derivatives with non-increasing locations
for i in range(size):
locations[i] = 10.0 * i * i... | sofianehaddad/ot-svn | python/test/t_PiecewiseHermiteEvaluationImplementation_std.py | Python | mit | 726 |
#!/usr/bin/env python
import os
import csv
import rospy
from std_msgs.msg import Bool
from dbw_mkz_msgs.msg import ThrottleCmd, SteeringCmd, BrakeCmd, SteeringReport
'''
You can use this file to test your DBW code against a bag recorded with a reference implementation.
The bag can be found at https://s3-us-west-1.a... | zegnus/self-driving-car-machine-learning | p13-final-project/ros/src/twist_controller/dbw_test.py | Python | mit | 3,850 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('projects', '0002_auto_20150401_2057'),
... | bilbeyt/ituro | ituro/projects/migrations/0003_auto_20160131_0706.py | Python | mit | 970 |
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2015, Luis Pedro Coelho <luis@luispedro.org>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# License: MIT. See COPYING.MIT file in the milk distribution
from __future__ import division
from .classifier import normaliselabels, ctransforms_model
from .base import superv... | pombredanne/milk | milk/supervised/svm.py | Python | mit | 15,907 |
"""SCons.Tool.mwcc
Tool-specific initialization for the Metrowerks CodeWarrior compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# Permission is he... | engineer0x47/SCONS | engine/SCons/Tool/mwcc.py | Python | mit | 6,841 |
import os
from countershape import model
from countershape import state
from countershape import widgets
from . import testpages, tutils
class TestContext(testpages.DummyState):
def setUp(self):
testpages.DummyState.setUp(self)
def tearDown(self):
testpages.DummyState.tearDown(self)
def ... | mhils/countershape | test/test_model.py | Python | mit | 13,305 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/wearables/armor/padded/shared_armor_padded_s01_gloves.iff"
result.a... | anhstudios/swganh | data/scripts/templates/object/tangible/wearables/armor/padded/shared_armor_padded_s01_gloves.py | Python | mit | 487 |
import logging
from datetime import datetime
from collections import defaultdict
from servicelayer.jobs import Job
from aleph.core import db, cache
from aleph.authz import Authz
from aleph.queues import cancel_queue, ingest_entity, get_status
from aleph.model import Collection, Entity, Document, Mapping
from aleph.mod... | pudo/aleph | aleph/logic/collections.py | Python | mit | 7,335 |
import pytest
def pytest_addoption(parser):
group = parser.getgroup("debugconfig")
group.addoption(
"--setupplan",
"--setup-plan",
action="store_true",
help="show what fixtures and tests would be executed but "
"don't execute anything.",
)
@pytest.hookimpl(tryfirs... | alfredodeza/pytest | src/_pytest/setupplan.py | Python | mit | 818 |
from .. util import deprecated
if deprecated.allowed():
from . channel_order import ChannelOrder
| rec/BiblioPixel | bibliopixel/drivers/__init__.py | Python | mit | 102 |
import unittest
import pycodestyle
from os.path import exists
class TestCodeFormat(unittest.TestCase):
def test_conformance(self):
"""Test that we conform to PEP-8."""
style = pycodestyle.StyleGuide(quiet=False, ignore=['E501', 'W605'])
if exists('transitions'): # when run from root direc... | tyarkoni/transitions | tests/test_codestyle.py | Python | mit | 710 |
# This file is part of beets.
# Copyright 2011, Adrian Sampson.
#
# 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, ... | karlbright/beets | test/test_vfs.py | Python | mit | 1,621 |
# caution: this module was written by a Python novice learning on the fly
# you should not assume this is "good" or idiomatic Python.
# Hackathons are fun.
from flask import Flask, Blueprint, render_template, abort, request, jsonify
from flask.ext.login import LoginManager, login_required
import logging
import json
fr... | arobson/tutortrueblue | server/app.py | Python | mit | 1,577 |
# author: Fei Gao
#
# Combinations
#
# Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.
# For example,
# If n = 4 and k = 2, a solution is:
# [
# [2,4],
# [3,4],
# [2,3],
# [1,2],
# [1,3],
# [1,4],
# ]
import itertools
class Solution:
# @return a list of lists... | feigaochn/leetcode | p77_combinations.py | Python | mit | 567 |
#!/usr/bin/env python3
#Author: Stefan Toman
if __name__ == '__main__':
n = int(input())
a = set(map(int, input().split()))
m = int(input())
b = set(map(int, input().split()))
print(len(a-b))
| stoman/CompetitiveProgramming | problems/pythonsetdifference/submissions/accepted/stefan.py | Python | mit | 214 |
# -*- 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 unique constraint on 'Company', fields ['slug']
db.create_unique(u'ecg_balancing_company', ['slug']... | sinnwerkstatt/ecg-balancing | ecg_balancing/migrations/0012_auto__add_unique_company_slug.py | Python | mit | 10,698 |
from distutils.core import setup
setup(
name = 'srht',
packages = ['srht'],
version = '1.0.0',
description = 'sr.ht services',
author = 'Drew DeVault',
author_email = 'sir@cmpwn.com',
url = 'https://github.com/SirCmpwn/sr.ht',
download_url = '',
keywords = [],
classifiers = []
)
| Debetux/sr.ht | setup.py | Python | mit | 300 |
import string
class Tree:
def __init__(self,u,vs):
self.u = u
self.vs = vs
def distance(self,w):
if w == self.u:
return 0,[w]
for v in self.vs:
d,path = v.distance(w)
if d != -1:
return d+1,[self.u]+path
return -1,[]... | crf1111/Bio-Informatics-Learning | Bio-StrongHold/src/newick_git.py | Python | mit | 4,136 |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 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 transaction signing using the signrawtransaction* RPCs."""
from test_framework.test_framework imp... | Flowdalic/bitcoin | test/functional/rpc_createmultisig.py | Python | mit | 3,657 |
from __future__ import print_function, division
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer
from lasagne.nonlinearities import sigmoid, rectify
from lasagne.objectives import crossentropy, mse... | JackKelly/neuralnilm_prototype | scripts/e159.py | Python | mit | 5,375 |
"""
Django settings for django_engage project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Buil... | djangothon/django-engage | django_engage/settings.py | Python | mit | 3,040 |
# Time: O(m * n)
# Space: O(m * n)
import collections
class Solution(object):
def findBlackPixel(self, picture, N):
"""
:type picture: List[List[str]]
:type N: int
:rtype: int
"""
rows, cols = [0] * len(picture), [0] * len(picture[0])
lookup = collections... | kamyu104/LeetCode | Python/lonely-pixel-ii.py | Python | mit | 1,287 |
import sys
# If our base template isn't on the PYTHONPATH already, we need to do this:
sys.path.append('../path/to/base/templates')
import basetemplate
class AlteredTemplate(basetemplate.BaseTemplate):
"""This project only needs an S3 bucket, but no EC2 server."""
def add_resources(self):
self.add_b... | broadinstitute/cfn-pyplates | docs/source/examples/advanced/altered_template.py | Python | mit | 899 |
"""
EmailManager - a helper class to login, search for, and delete emails.
"""
import email
import htmlentitydefs
import imaplib
import quopri
import re
import time
import types
from seleniumbase.config import settings
class EmailManager:
""" A helper class to interface with an Email account. These imap methods
... | possoumous/Watchers | seleniumbase/fixtures/email_manager.py | Python | mit | 17,901 |
"""Default website configurations, used only for testing.
"""
from donut import environment
# Public Test Database
TEST = environment.Environment(
db_hostname="localhost",
db_name="donut_test",
db_user="donut_test",
db_password="public",
debug=True,
testing=True,
secret_key="1234567890",
... | ASCIT/donut-python | donut/default_config.py | Python | mit | 472 |
#!/usr/bin/env python
"""
Copyright (c) 2013-2014 Ben Croston
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, modify, mer... | NeoBelerophon/Arietta.GPIO | test/test.py | Python | mit | 18,250 |
#!/usr/bin/env python
#
# Common client code
#
# Copyright 2016 Markus Zoeller
import os
from launchpadlib.launchpad import Launchpad
def get_project_client(project_name):
cachedir = os.path.expanduser("~/.launchpadlib/cache/")
if not os.path.exists(cachedir):
os.makedirs(cachedir, 0o700)
launchp... | mzoellerGit/openstack | scripts/launchpad/common.py | Python | mit | 1,002 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.