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 |
|---|---|---|---|---|---|
from datetime import datetime
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse_lazy
from django.utils.feedgenerator import (
Atom1Feed, Rss201rev2Feed)
from .models import Post
class BasePostFeedMixin():
title = "Latest Startup Organizer Blog Posts"
link = r... | jambonrose/DjangoUnleashed-1.8 | blog/feeds.py | Python | bsd-2-clause | 914 |
# -*- coding: utf-8 -*-
# Author: <Your name>
# License see LICENSE
from PyKDE4.kdecore import i18n
from PyKDE4.kdeui import KAction, KIcon
from PyQt4.QtCore import QObject
from PyQt4.QtGui import QMenu
from libkatepate.errors import showOk, showError
import kate
class MyPlugin(QObject):
def __init__(self):
... | LarsBV/kate_plugin_template | my_plugin.py | Python | bsd-2-clause | 1,396 |
# Create your views here.
import json
from django.views.generic import (
ListView,
UpdateView,
CreateView,
)
from django.core.urlresolvers import reverse
from contractions.models import Contraction
from django.http import HttpResponse
from django.http import HttpResponseRedirect
class AjaxableResponseMixin(obj... | dreinhold/pregnancy | contractions/views.py | Python | bsd-2-clause | 2,352 |
from __future__ import print_function, division, absolute_import
from collections import namedtuple
import sys
from functools import partial
from llvmlite.ir import Value
from llvmlite.llvmpy.core import Constant, Type, Builder
from . import (_dynfunc, cgutils, config, funcdesc, generators, ir, types,
... | stefanseefeld/numba | numba/lowering.py | Python | bsd-2-clause | 36,946 |
import os
import command
import serverinfo
import accounts
from google.appengine.ext.webapp import template
class Drain(command.Command):
def have_access(self):
account = accounts.account()
if not account or not account.DRAIN_ACCESS_RIGHT:
return False
return True
def fini... | spiffcode/hostile-takeover | stats/drain.py | Python | bsd-2-clause | 1,517 |
import pytz
from datetime import datetime, timedelta
def is_dst(zonename, date):
local_tz = pytz.timezone(zonename)
localized_time = local_tz.localize(date)
return localized_time.dst() != timedelta(0)
def get_offset(zonename, date):
local_tz = pytz.timezone(zonename)
if zonename == 'UTC':
... | tidepool-org/dfaker | dfaker/tools.py | Python | bsd-2-clause | 3,495 |
#!/usr/bin/env python3
from lmap import ldap
from getpass import getpass
import threading
pw = getpass()
def bind_fnord(num):
def do_teh_action():
ld = ldap.ldap('ldap://emmi.physik-pool.tu-berlin.de/')
ld.simple_bind('uid=jaseg,ou=people,ou=pcpool,ou=physik,o=tu-berlin,c=de', pw)
print(num, len(ld.search('ou=... | jaseg/python-lmap | testfnord.py | Python | bsd-2-clause | 490 |
#!/usr/bin/env python
"""
@package mi.idk.test.test_comm_config
@file mi.idk/test/test_comm_config.py
@author Bill French
@brief test metadata object
"""
__author__ = 'Bill French'
__license__ = 'Apache 2.0'
from os.path import basename, dirname
from os import makedirs
from os import remove
from os.path import exist... | mikeh77/mi-instrument | mi/idk/test/test_comm_config.py | Python | bsd-2-clause | 8,878 |
# -*- coding: ISO-8859-15 -*-
from twisted.web import client
from twisted.internet.defer import inlineCallbacks
from core.Uusipuu import UusipuuModule
import urllib, simplejson
class Module(UusipuuModule):
def startup(self):
self.log('google.py loaded')
@inlineCallbacks
def cmd_google(self, ... | desaster/uusipuu | modules/google.py | Python | bsd-2-clause | 1,007 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import date
from decimal import Decimal, ROUND_DOWN
from django.contrib.sites.models import Site
from django.db import models
from django.db.models import Sum
from django.db.models.signals import post_save
from django.dispatch import receiv... | muhleder/timestrap | core/models.py | Python | bsd-2-clause | 6,476 |
# coding: utf8
"""
weasyprint.css.validation
-------------------------
Expand shorthands and validate property values.
See http://www.w3.org/TR/CSS21/propidx.html and various CSS3 modules.
:copyright: Copyright 2011-2014 Simon Sapin and contributors, see AUTHORS.
:license: BSD, see LICENSE for... | frewsxcv/WeasyPrint | weasyprint/css/validation.py | Python | bsd-3-clause | 57,182 |
# coding: utf-8
# This file is part of Thomas Aquinas.
#
# Thomas Aquinas is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thomas Aq... | shackra/thomas-aquinas | notestno/test_openwindow.py | Python | bsd-3-clause | 3,333 |
"""
DatabaseMap is used to model a database.
"""
__version__= '$Revision: 3194 $'[11:-2]
__author__ = "Duan Guoqiang (mattgduan@gmail.com)"
import string
import proof.pk.IDMethod as IDMethod
import proof.pk.generator.IDBroker as IDBroker
import proof.mapper.TableMap as TableMap
class DatabaseMap:
def __init__... | mattduan/proof | mapper/DatabaseMap.py | Python | bsd-3-clause | 3,615 |
# Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de
# Aplicacion de las TIC basadas en Fuentes Abiertas, Spain.
#
# 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... | helix84/activae | deployment/__init__.py | Python | bsd-3-clause | 3,590 |
"""Functions copypasted from newer versions of numpy.
"""
from __future__ import division, print_function, absolute_import
import warnings
import sys
from warnings import WarningMessage
import re
from functools import wraps
import numpy as np
from scipy._lib._version import NumpyVersion
def import_nose():
""" ... | apbard/scipy | scipy/_lib/_numpy_compat.py | Python | bsd-3-clause | 23,885 |
from flask import render_template, flash, redirect, session, url_for, request, g
from flask.ext.login import login_user, logout_user, current_user, login_required
from app import app, db, lm, oid
from forms import LoginForm, EditForm
from models import User, ROLE_USER, ROLE_ADMIN
from datetime import datetime
@lm.user... | hmdavis/flask-mega-tutorial | app/views.py | Python | bsd-3-clause | 4,940 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Difference'] , ['Lag1Trend'] , ['Seasonal_MonthOfYear'] , ['NoAR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Difference/model_control_one_enabled_Difference_Lag1Trend_Seasonal_MonthOfYear_NoAR.py | Python | bsd-3-clause | 165 |
from datetime import datetime
from django.core.exceptions import ValidationError
from django.db import models
def validate_answer_to_universe(value):
if value != 42:
raise ValidationError('This is not the answer to life, universe and everything!', code='not42')
class ModelToValidate(models.Model):
na... | disqus/django-old | tests/modeltests/validation/models.py | Python | bsd-3-clause | 3,826 |
from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from external_auth.auth_utils import authenticate_without_pass
from utils import get_view_url
import django
import urllib2
import urllib
def google_login(request):
return_to = get_view_url( request, check_and_auth )
ret... | ubgarbage/gae-blog | external_auth/google_login/views.py | Python | bsd-3-clause | 2,352 |
#!C:\Users\DMoran\Downloads\WinPython-64bit-2.7.13.1Zero\python-2.7.13.amd64\python.exe
# See http://cens.ioc.ee/projects/f2py2e/
from __future__ import division, print_function
import os
import sys
for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]:
try:
i = sys.argv.index("--" + mode)
... | tequa/ammisoft | ammimain/WinPython-64bit-2.7.13.1Zero/python-2.7.13.amd64/Scripts/f2py.py | Python | bsd-3-clause | 827 |
# -*- coding: utf-8 -*-
import requests
from datetime import datetime
from fplassist.models import Team_Info, Player_Info, Player_Basic_Stats, Player_Detailed_Stats, FPL_Config
def get_data(api_url):
api_response = requests.get(api_url)
try:
api_response.raise_for_status()
api_data = api_respon... | mdameenh/elysia | fplassist/update_database.py | Python | bsd-3-clause | 10,609 |
import unittest
import sys
import os
import errno
import commands
from xml.dom import minidom
sys.path.append('bin')
from umdinst import wrap
from testsuccessfulcompiledata import getfield, timezonecheck, xmlifystring
from testcapturecompile import programcheck
def createemptyfile(fname):
"""Creates an empty fil... | lorin/umdinst | test/testidentifysourcefiles.py | Python | bsd-3-clause | 1,396 |
import mock
from olympia.amo.tests import addon_factory, TestCase, user_factory
from olympia.ratings.models import Rating
from olympia.ratings.tasks import addon_rating_aggregates
class TestAddonRatingAggregates(TestCase):
# Prevent <Rating>.refresh() from being fired when setting up test data,
# since it'd ... | tsl143/addons-server | src/olympia/ratings/tests/test_tasks.py | Python | bsd-3-clause | 3,772 |
'''Simple dense network encoders
'''
import logging
import torch.nn as nn
from .base_network import BaseNet
logger = logging.getLogger('cortex.arch' + __name__)
class FullyConnectedNet(BaseNet):
def __init__(self, dim_in, dim_out=None, dim_h=64, dim_ex=None,
nonlinearity='ReLU', n_levels=N... | rdevon/cortex | cortex/built_ins/networks/fully_connected.py | Python | bsd-3-clause | 863 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | qiita-spots/qiita_client | qiita_client/util.py | Python | bsd-3-clause | 2,813 |
from django.db import models
class AdjacencyListModel(models.Model):
title = models.CharField(max_length=100)
parent = models.ForeignKey(
'self', related_name='%(class)s_parent', on_delete=models.CASCADE, db_index=True, null=True, blank=True)
def __str__(self):
return 'adjacencylistmode... | idlesign/django-admirarchy | admirarchy/tests/testapp/models.py | Python | bsd-3-clause | 633 |
import numpy as np
import pyroms
from pyroms_toolbox.BGrid_GFDL import BGrid_GFDL
def get_nc_BGrid_GFDL(grdfile, name='GFDL_CM2.1_North_Pacific', \
# xrange=(80,189), yrange=(96,198)):
xrange=(60,175), yrange=(120, 190)):
"""
Bgrd = get_nc_BGrid_GFDL(gr... | dcherian/pyroms | pyroms_toolbox/pyroms_toolbox/BGrid_GFDL/get_nc_BGrid_GFDL.py | Python | bsd-3-clause | 1,731 |
# 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.
trusted_scons_files = [
'src/shared/ppapi/build.scons',
'src/shared/ppapi_proxy/build.scons',
'src/trusted/plugin/build.scons',
'tests/p... | robclark/chromium | ppapi/native_client/ppapi_scons_files.py | Python | bsd-3-clause | 2,682 |
from argparse import Namespace
from contextlib import contextmanager
import logging
import mock
import os
import sys
import unittest
from conda_build_all.tests.unit.dummy_index import DummyIndex, DummyPackage
from conda_build_all.artefact_destination import (ArtefactDestination,
... | pelson/conda-build-all | conda_build_all/tests/unit/test_artefact_destination.py | Python | bsd-3-clause | 5,716 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("SGDClassifier" , "FourClass_500" , "mysql")
| antoinecarme/sklearn2sql_heroku | tests/classification/FourClass_500/ws_FourClass_500_SGDClassifier_mysql_code_gen.py | Python | bsd-3-clause | 141 |
# Generated by Django 2.2.23 on 2021-07-16 05:56
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('customercare', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='reply',
name='user',
),
... | mozilla/kitsune | kitsune/customercare/migrations/0002_auto_20210716_0556.py | Python | bsd-3-clause | 640 |
import json
from django.utils import unittest
from django.test.client import RequestFactory
from formalizr.tests.views import SimpleFormView, SimpleCreateView, SimpleUpdateView
from formalizr.tests.models import SimpleModel
class AjaxFormViewTest(unittest.TestCase):
view_class = SimpleFormView
VALUE = 1
... | krasnoperov/django-formalizr | formalizr/tests/tests.py | Python | bsd-3-clause | 4,412 |
from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from txircd.utils import isValidIdent, trimStringToByteLength
from zope.interface import implementer
from typing import Any, Dict, List, Optional, Tuple
@implementer... | Heufneutje/txircd | txircd/modules/rfc/cmd_user.py | Python | bsd-3-clause | 1,685 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Anscombe'] , ['MovingMedian'] , ['Seasonal_Minute'] , ['LSTM'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Anscombe/model_control_one_enabled_Anscombe_MovingMedian_Seasonal_Minute_LSTM.py | Python | bsd-3-clause | 161 |
# -*- coding: utf-8 -*-
from collections import Counter
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.core.urlresolvers import reverse
from django.db import transaction
import waffle
import olympia.core.logger
from olympia import amo
from olympia.edito... | harikishen/addons-server | src/olympia/editors/management/commands/auto_approve.py | Python | bsd-3-clause | 7,550 |
"""
This code was originally published by the following individuals for use with
Scilab:
Copyright (C) 2012 - 2013 - Michael Baudin
Copyright (C) 2012 - Maria Christopoulou
Copyright (C) 2010 - 2011 - INRIA - Michael Baudin
Copyright (C) 2009 - Yann Collette
Copyright (C) 2009 - CEA - Jean-Ma... | tisimst/pyDOE | pyDOE/doe_factorial.py | Python | bsd-3-clause | 7,200 |
from datetime import datetime
class ModelManager(object):
def __init__(self, db, collection_name, has_stats=False, **kwargs):
self.property_helper = None
self.log_helper = None
self.collection_name = collection_name
self.db = db
if 'logger' in kwargs:
self.log_... | texttochange/vusion-backend | vusion/persist/model_manager.py | Python | bsd-3-clause | 2,407 |
# -*- coding: utf-8 -*-
from mock import Mock
from nose.tools import eq_, ok_
from rest_framework.request import Request
from rest_framework.serializers import CharField, Serializer
from rest_framework.test import APIRequestFactory
from test_utils import RequestFactory
import amo
from amo.tests import TestCase
from mk... | andymckay/zamboni | mkt/api/tests/test_fields.py | Python | bsd-3-clause | 13,052 |
from __future__ import absolute_import, division, print_function
from ...external.qt import QtGui
from ...core.edit_subset_mode import (EditSubsetMode, OrMode, AndNotMode,
AndMode, XorMode, ReplaceMode)
from ..actions import act
from ..qtutil import nonpartial
def set_mode(mode... | JudoWill/glue | glue/qt/widgets/edit_subset_mode_toolbar.py | Python | bsd-3-clause | 2,391 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['ConstantTrend'] , ['Seasonal_Hour'] , ['ARX'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Logit/model_control_one_enabled_Logit_ConstantTrend_Seasonal_Hour_ARX.py | Python | bsd-3-clause | 156 |
import datetime
from django.apps import apps
from django.core.mail import EmailMessage, EmailMultiAlternatives
import olympia.core.logger
from olympia import amo
from olympia.activity.models import ActivityLog
from olympia.amo.celery import task
from olympia.amo.utils import get_email_backend
from olympia.bandwagon.... | lavish205/olympia | src/olympia/amo/tasks.py | Python | bsd-3-clause | 2,217 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""Python client API for CouchDB.
>>> server = Server()
>>> db = server.create('python-tests')
>>> ... | infinit/couchdb-python | couchdb/client.py | Python | bsd-3-clause | 45,376 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2014-2015, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | chippey/gaffer | apps/execute/execute-1.py | Python | bsd-3-clause | 5,996 |
from __future__ import absolute_import
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import numpy as np
import scipy.stats as sp_stats
# Use the nibabel image object
from nibabel import Nifti1Image as Image
from nibabel.affines import apply_affine
fr... | alexis-roche/nipy | nipy/labs/statistical_mapping.py | Python | bsd-3-clause | 15,304 |
import django
from django.conf.urls import patterns, include
from django.core.exceptions import ValidationError
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User
from django.db import model... | rfleschenberg/django-safedelete | safedelete/tests.py | Python | bsd-3-clause | 11,086 |
import gc
import sys
import time
import weakref
import unittest
from dispatch import Signal, receiver
if sys.platform.startswith('java'):
def garbage_collect():
# Some JVM GCs will execute finalizers in a different thread, meaning
# we need to wait for that to complete before we go on looking for... | edgeflip/dispatch | tests/test_dispatcher.py | Python | bsd-3-clause | 6,294 |
def extractItsjustadreamwebWordpressCom(item):
'''
Parser for 'itsjustadreamweb.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
if "WATTT" in item['tags']:
return buildReleaseMessageWithType(... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractItsjustadreamwebWordpressCom.py | Python | bsd-3-clause | 389 |
#######################################################
# Copyright (c) 2015, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
######################################################... | arrayfire/arrayfire_python | arrayfire/statistics.py | Python | bsd-3-clause | 8,560 |
BREADABILITY_AVAILABLE = True
try:
from breadability.readable import Article, prep_article, check_siblings
except ImportError:
BREADABILITY_AVAILABLE = False
Article = object
from operator import attrgetter
from werkzeug.utils import cached_property
import re
from lxml.etree import tounicode, tostring
... | denz/swarm-crawler | swarm_crawler/text.py | Python | bsd-3-clause | 2,172 |
# flake8: noqa
from voluptuous.schema_builder import *
from voluptuous.validators import *
from voluptuous.util import *
from voluptuous.error import *
__version__ = '0.12.2'
__author__ = 'alecthomas'
| alecthomas/voluptuous | voluptuous/__init__.py | Python | bsd-3-clause | 203 |
import unittest
import asyncio
from pulsar import send
from pulsar.apps.test import test_timeout
from .manage import DiningPhilosophers
class TestPhylosophers(unittest.TestCase):
app_cfg = None
concurrency = 'thread'
@classmethod
@asyncio.coroutine
def setUpClass(cls):
app = DiningPhilo... | dejlek/pulsar | examples/philosophers/tests.py | Python | bsd-3-clause | 1,021 |
# Copyright (c) 2005-2014, Enthought, Inc.
# some parts copyright 2002 by Space Telescope Science Institute
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the a... | tommy-u/enable | kiva/pdf.py | Python | bsd-3-clause | 25,949 |
# -*- coding: UTF-8 -*-
from django import forms
from apps.registro.models import DependenciaFuncional, Jurisdiccion, TipoGestion, TipoDependenciaFuncional, TipoEducacion
class DependenciaFuncionalFormFilters(forms.Form):
jurisdiccion = forms.ModelChoiceField(queryset=Jurisdiccion.objects.order_by('nombre'), lab... | MERegistro/meregistro | meregistro/apps/registro/forms/DependenciaFuncionalFormFilters.py | Python | bsd-3-clause | 1,595 |
from django.test.testcases import SimpleTestCase
from corehq.apps.app_manager.const import APP_V2
from corehq.apps.app_manager.models import Application, Module, OpenCaseAction, ParentSelect, OpenSubCaseAction, \
AdvancedModule, LoadUpdateAction, AdvancedOpenCaseAction
from mock import patch
class CaseMetaTest(Si... | puttarajubr/commcare-hq | corehq/apps/app_manager/tests/test_case_meta.py | Python | bsd-3-clause | 2,721 |
#! /usr/bin/python
'''
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
Find the minimum element.
'''
class Solution:
# @param num, a list of integer
# @return an integer
# You may assume no duplicate exists in the array.
def fi... | shub0/algorithm-data-structure | python/find_minimum.py | Python | bsd-3-clause | 1,730 |
# Generated by Django 2.1.3 on 2018-12-14 10:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('product', '0079_default_tax_rate_instead_of_empty_field'),
]
operations = [
migrations.AddField(
model_name='category',
... | UITools/saleor | saleor/product/migrations/0080_auto_20181214_0440.py | Python | bsd-3-clause | 616 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Composition) on 2019-05-07.
# 2019, SMART Health IT.
from . import domainresource
class Composition(domainresource.DomainResource):
""" A set of resources composed into a single coher... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_4_0_0/models/composition.py | Python | bsd-3-clause | 13,565 |
from __future__ import absolute_import,unicode_literals
from functools import update_wrapper
from django.db import connection
from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature
from django.utils import six
from .models import Reporter, Article
#
# The introspection module is optional, so methods... | vsajip/django | tests/regressiontests/introspection/tests.py | Python | bsd-3-clause | 6,655 |
# -*- coding: utf-8 -*-
"""
This file only serves as a test fixture to be included.
"""
FIXTURE_VALUE = __file__
| Charnelx/django-split-settings | tests/settings/basic/fixture_to_include.py | Python | bsd-3-clause | 115 |
import SocketServer
class ProtoHandler(SocketServer.BaseRequestHandler):
def handle(self):
msg = self.request.recv(1024)
a = msg.split(" ",2)
if len(a) >1 and a[0] == "GET":
a = a[1].split("/")
a =[i for i in a if i != '']
if len(a) == 0:
... | wizgrav/protobot | server.py | Python | bsd-3-clause | 861 |
'''
This program super imposes the camera onto the television in the picture
'''
from __future__ import print_function
print(__doc__)
from SimpleCV import Camera, Image, Display
tv_original = Image("family_watching_television_1958.jpg", sample=True)
tv_coordinates = [(353, 379), (433,380),(432, 448), (354,446)]
tv_m... | tpltnt/SimpleCV | SimpleCV/examples/manipulation/tvexample.py | Python | bsd-3-clause | 599 |
# -*- coding: utf-8 -*-
import handlers
from django.conf.urls import url, patterns
from anaf.core.api.auth import auth_engine
from anaf.core.api.doc import documentation_view
from anaf.core.api.resource import CsrfExemptResource
ad = {'authentication': auth_engine}
# events resources
eventResource = CsrfExemptResour... | tovmeod/anaf | anaf/events/api/urls.py | Python | bsd-3-clause | 723 |
from pvmismatch import *
import os
import numpy as np
BASEDIR = os.path.dirname(__file__)
def test_pvconst_npts_setter():
"""Test pvconst property and setter methods"""
pvconst = pvconstants.PVconstants()
assert pvconst.npts == pvconstants.NPTS
assert len(pvconst.pts) == pvconst.npts
assert pvco... | SunPower/PVMismatch | pvmismatch/tests/test_pvconstants.py | Python | bsd-3-clause | 1,544 |
from wtforms import StringField, BooleanField, PasswordField
from flask_wtf.recaptcha import RecaptchaField
from flask_babelpkg import lazy_gettext
from wtforms.validators import DataRequired, EqualTo, Email
from ..fieldwidgets import BS3PasswordFieldWidget, BS3TextFieldWidget
from ..forms import DynamicForm
class Lo... | qpxu007/Flask-AppBuilder | flask_appbuilder/security/forms.py | Python | bsd-3-clause | 3,248 |
import json
from autobahn.twisted.websocket import WebSocketClientProtocol, WebSocketClientFactory
class SocketClientProtocol(WebSocketClientProtocol):
def emit(self, event_name, **kwargs):
payload = self._format_outbound_data(event_name, **kwargs)
self.sendMessage(payload)
def _format_out... | CptLemming/django-socket-server | socket_server/client.py | Python | bsd-3-clause | 1,594 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['Lag1Trend'] , ['Seasonal_DayOfWeek'] , ['SVR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_RelativeDifference/model_control_one_enabled_RelativeDifference_Lag1Trend_Seasonal_DayOfWeek_SVR.py | Python | bsd-3-clause | 170 |
"""Core routines for QHA."""
# Copyright (C) 2012 Atsushi Togo
# All rights reserved.
#
# This file is part of phonopy.
#
# 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 ... | atztogo/phonopy | phonopy/qha/core.py | Python | bsd-3-clause | 40,784 |
from fractions import Fraction as f
import sys
# draw points of squares->tiling a rectangle
# size of squares = fibonacci seq
def sqr(x): return x*x
def greenq(x,y,x2,y2): return 2*(x2-x)*(y2-y)
def redq(x,y,x2,y2): return sqr(x2-x)-sqr(y2-y)
def blueq(x,y,x2,y2): return sqr(x2-x)+sqr(y2-y)
xs,ys=[],[]
depth=50
clas... | donbright/piliko | experiment/fiborec.py | Python | bsd-3-clause | 1,405 |
# -*- coding: utf-8 -*-
from django.contrib.gis import admin
from django import forms
from .models import Country
# create a geoadmin instance
geoadmin = admin.GeoModelAdmin(Country, admin.site)
geoadmin.num_zoom = 4
geoadmin.modifiable = False
geoadmin.layerswitcher = False
geoadmin.mouse_position = False
geoadmin.s... | samueladam/worldgame | src/worldgame/forms.py | Python | bsd-3-clause | 737 |
'''Multiple Testing and P-Value Correction
Author: Josef Perktold
License: BSD-3
'''
from statsmodels.compat.python import range
from statsmodels.compat.collections import OrderedDict
import numpy as np
#==============================================
#
# Part 1: Multiple Tests and P-Value Correction
#
#=========... | rgommers/statsmodels | statsmodels/stats/multitest.py | Python | bsd-3-clause | 16,540 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import recordlinkage as rl
import numpy
import pandas
FULL_INDEX = pandas.MultiIndex.from_product(
[[1, 2, 3], [1, 2, 3]], # 3x3 matrix
names=['first', 'second'])
LINKS_TRUE = pandas.MultiIndex.from_tuples(
[(1, 1), (2, 2), (... | J535D165/recordlinkage | tests/test_measures.py | Python | bsd-3-clause | 4,180 |
import hashlib
import logging
import random
import re
import time
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.contrib.sites.models import Site
from django.db import models
from django.utils.translation import ugettext as _, ug... | anushbmx/kitsune | kitsune/users/models.py | Python | bsd-3-clause | 24,753 |
# -*- coding: utf-8 -*-
import pytest
@pytest.mark.integration
def test_fake_int(api_app):
assert True
def test_fake_unit(api_app):
assert True
| derek-miller/flask-template | tests/test_api.py | Python | bsd-3-clause | 156 |
import time
import logging
import struct
import socket
from mesos.interface.mesos_pb2 import TASK_LOST, MasterInfo
from .messages_pb2 import (
RegisterFrameworkMessage, ReregisterFrameworkMessage,
DeactivateFrameworkMessage, UnregisterFrameworkMessage,
ResourceRequestMessage, ReviveOffersMessage, LaunchTa... | sdgdsffdsfff/pymesos | pymesos/scheduler.py | Python | bsd-3-clause | 8,630 |
# $Id: PlotItems.py,v 2.13 2003/08/18 22:33:00 mhagger Exp $
# Copyright (C) 1998-2003 Michael Haggerty <mhagger@alum.mit.edu>
#
# This file is licensed under the GNU Lesser General Public License
# (LGPL). See LICENSE.txt for details.
"""PlotItems.py -- Objects that can be plotted by Gnuplot.
This module contains ... | pombredanne/ompc | ompclib/gplot/PlotItems.py | Python | bsd-3-clause | 24,085 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-09-11 19:15
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("plan", "0016_plan_test_dashboard"),
("plan", "0016_auto_20180904_1457"),
]
operati... | SalesforceFoundation/mrbelvedereci | metaci/plan/migrations/0017_merge_20180911_1915.py | Python | bsd-3-clause | 329 |
# Copyright (c) 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.
import copy
import hashlib
import multiprocessing
import os.path
import re
import signal
import subprocess
import sys
import gyp
import gyp.common
import gyp.msvs_... | DanialLiu/SkiaWin32Port | third_party/externals/gyp/pylib/gyp/generator/ninja.py | Python | bsd-3-clause | 74,180 |
# Copyright (c) 2009,2016 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""A collection of general purpose tools for reading files."""
from __future__ import print_function
import bz2
from collections import namedtuple
import gzip
import logging
f... | jrleeman/MetPy | metpy/io/_tools.py | Python | bsd-3-clause | 13,290 |
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | danakj/chromium | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py | Python | bsd-3-clause | 4,329 |
class HostCommands(object):
def __new__(cls, host):
if host.is_ol6:
return HostCommandOL6(host)
if host.is_ol7:
return HostCommandOL7(host)
class HostBaseCommands(object):
def __init__(self, host):
self.host = host
self.infra = host.infra
self.e... | globocom/database-as-a-service | dbaas/physical/commands.py | Python | bsd-3-clause | 3,573 |
#!/usr/bin/env python
"""This module has unit tests for the pvl __init__ functions."""
# Copyright 2019, Ross A. Beyer (rbeyer@seti.org)
#
# 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
#
# ... | planetarypy/pvl | tests/test_init.py | Python | bsd-3-clause | 7,666 |
# -*- coding: utf-8 -*-
"""A recipe to implement named gauge. Named gauge keeps momenta and their
names. You can manipulate a specific momentum by the name you named.
Test it by `py.test <http://pytest.org/>`_:
.. sourcecode:: console
$ py.test recipes/namedgauge.py
"""
from collections import namedtuple
from ti... | what-studio/gauge | recipes/namedgauge.py | Python | bsd-3-clause | 5,860 |
"""
This module is not part of the original setuptools code.
It was created because much of the code in order modules was (and still
is) unorganized and simple utility functions were defined as class methods
for no obious reason, uselessly cluttering some of the large classes.
This module is a place such functions.
""... | cournape/ensetuptools | setuptools/utils.py | Python | bsd-3-clause | 2,491 |
from joblib import Parallel, delayed
from epac import Methods
import numpy as np
from sklearn import datasets
from sklearn.svm import SVC
X, y = datasets.make_classification(n_samples=500,
n_features=200000,
n_informative=2,
... | neurospin/pylearn-epac | test/bug_joblib/test_joblib_2000fts.py | Python | bsd-3-clause | 1,126 |
# 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.
"""Top-level presubmit script for swarm_client.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on the presubmit... | leighpauls/k2cro4 | tools/swarm_client/PRESUBMIT.py | Python | bsd-3-clause | 1,409 |
""" $lic$
Copyright (C) 2016-2020 by Tsinghua University and The Board of Trustees of
Stanford University
This program is free software: you can redistribute it and/or modify it under
the terms of the Modified BSD-3 License as published by the Open Source
Initiative.
This program is distributed in the hope that it wi... | stanford-mast/nn_dataflow | nn_dataflow/core/loop_enum.py | Python | bsd-3-clause | 705 |
# -*- coding: utf-8 -*-
from django.db import models
from apps.postitulos.models.EstadoPostitulo import EstadoPostitulo
from apps.postitulos.models.TipoPostitulo import TipoPostitulo
from apps.postitulos.models.PostituloTipoNormativa import PostituloTipoNormativa
from apps.postitulos.models.CarreraPostitulo import Carr... | MERegistro/meregistro | meregistro/apps/postitulos/models/Postitulo.py | Python | bsd-3-clause | 2,464 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import jsonfield.fields
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('travel_times', '0002_auto_20150717_1221'),
]
operatio... | lm-tools/situational | situational/apps/travel_report/migrations/0001_initial.py | Python | bsd-3-clause | 1,406 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import fnmatch
import imp
import logging
import modulefinder
import optparse
import os
import sys
import zipfile
from telemetry import benchmark
from teleme... | chromium2014/src | tools/telemetry/telemetry/util/find_dependencies.py | Python | bsd-3-clause | 9,256 |
from ..helpers import ResourceBase, FilteredIterableResource
from ..errors import ok_or_error, response_or_error
from ..compat import update_doc
class Users(ResourceBase, FilteredIterableResource):
@response_or_error
def add(self, name, password, displayName, emailAddress, addToDefaultGroup=True):
"""
... | robinson96/GRAPE | stashy/stashy/admin/users.py | Python | bsd-3-clause | 3,086 |
def extractWwwNovicetranslationsCom(item):
'''
Parser for 'www.novicetranslations.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
(... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractWwwNovicetranslationsCom.py | Python | bsd-3-clause | 564 |
# Copyright (c) 2011 Adi Roiban.
# See LICENSE for details.
"""
Shared pavement methods used in Chevah project.
This file is copied into the root of each repo as pavement_lib.py
Brace yoursef for watching how wheels are reinvented.
Do not modify this file inside the branch.
A `product` is a repository delived to c... | chevah/brink | brink/pavement_commons.py | Python | bsd-3-clause | 36,882 |
# -*- coding: utf8 -*-
"""
This is part of shot detector.
Produced by w495 at 2017.05.04 04:18:27
"""
from __future__ import absolute_import, division, print_function
import collections
import itertools
import logging
from shot_detector.utils.dsl import DslOperatorMixin
from shot_detector.utils.dsl.dsl_kwarg... | w495/python-video-shot-detector | shot_detector/filters/dsl/dsl_filter_mixin.py | Python | bsd-3-clause | 6,383 |
import os
import codecs
from datetime import datetime
from stat import ST_MTIME, ST_CTIME
from re import search
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponseForbidden
from django.utils.translation import ugettext as _
from django.shortcuts import render_to_resp... | barrabinfc/django-templatesadmin | templatesadmin/views.py | Python | bsd-3-clause | 9,025 |
from __future__ import unicode_literals, with_statement
import re
import os
import subprocess
from collections import OrderedDict
from django.utils.encoding import smart_str
from django.core.files.temp import NamedTemporaryFile
from sorl.thumbnail.base import EXTENSIONS
from sorl.thumbnail.compat import b
from sorl.t... | JordanReiter/sorl-thumbnail | sorl/thumbnail/engines/convert_engine.py | Python | bsd-3-clause | 6,419 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['Lag1Trend'] , ['Seasonal_Hour'] , ['ARX'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_RelativeDifference/model_control_one_enabled_RelativeDifference_Lag1Trend_Seasonal_Hour_ARX.py | Python | bsd-3-clause | 165 |
# coding=utf-8
"""
Created by Chouayakh Mahdi
26/08/2010
The package contains the unit test of timescale_manager function
unit_tests : to perform un... | severin-lemaignan/dialogs | src/dialogs/timescale_manager_test.py | Python | bsd-3-clause | 33,296 |
#! encoding: utf-8
# ######################################################################
# Copyright (c) 2014, Brookhaven Science Associates, Brookhaven #
# National Laboratory. All rights reserved. #
# #
# Redistr... | celiafish/scikit-xray | skxray/core/utils.py | Python | bsd-3-clause | 38,692 |
"""
sentry.conf.server
~~~~~~~~~~~~~~~~~~
These settings act as the default (base) settings for the Sentry-provided web-server
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.conf.global_se... | fotinakis/sentry | src/sentry/conf/server.py | Python | bsd-3-clause | 32,297 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import numpy as np
from scipy.spatial.distance import cdist
import matplotlib.pyplot as plt
from math import sqrt
import matplotlib.animation as animation
from dana import *
''' Spikes model in computational neuroscience with Brian library. '''
# -------------... | Aurelien1609/Computational-model | frequency_model.py | Python | bsd-3-clause | 13,265 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.