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 python
from __future__ import absolute_import, print_function
from logging import getLogger
from .units import ok
from .validation import validate_duration
from threading import Condition, Thread
log = getLogger("failover.background")
class Background(Thread):
"""
Background(task, delay, start=... | dacut/FailoverSample | failover/background.py | Python | bsd-2-clause | 2,003 |
import ptypes
from ptypes import *
# integral types
class u8(pint.uint8_t): pass
class u16(pint.uint16_t): pass
class u32(pint.uint32_t): pass
class u64(pint.uint64_t): pass
class s8(pint.sint8_t): pass
class s16(pint.sint16_t): pass
class s32(pint.sint32_t): pass
class s64(pint.sint64_t): pass
# lzh-specific integr... | arizvisa/syringe | template/archive/lha.py | Python | bsd-2-clause | 5,683 |
# -*- coding: utf-8 -*-
#
# generic tools for apps
#
def format_float(number): # {{{
"""
format the display style of a float number
"""
threshold_min = 0.001
threshold_max = 9999.9
fix_fmt = '{:,.1f}' # comma as a thousands separator
exp_fmt = '{:.1... | liweitianux/97dev | 97suifangqa/apps/utils/tools.py | Python | bsd-2-clause | 644 |
__version__ = "1.4.7"
| eRestin/Mezz | mezzanine/__init__.py | Python | bsd-2-clause | 23 |
# test_collection.py
from rctk.tests.base import BaseTest
from rctk.widgets import StaticText
class BaseCollectionTest(BaseTest):
""" Test basic collection behaviour. """
item = StaticText
collection = None
def create_collection(self):
return self.collection(self.tk, self.item)
... | rctk/rctk | rctk/tests/test_collection.py | Python | bsd-2-clause | 1,284 |
#!/usr/bin/env python
"""
Copyright (C) Jeremy O'Donoghue, 2003
License: This work is licensed under the PSF. A copy should be included
with this source code, and is also available at
http://www.python.org/psf/license.html
This is a sample showing how to embed a matplotlib figure in a wxPanel,
and update the contents... | sniemi/SamPy | sandbox/src1/examples/dynamic_demo_wx.py | Python | bsd-2-clause | 3,927 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_comment02.py | Python | bsd-2-clause | 1,011 |
from gevent import monkey
# monkey.patch_all(aggressive=False)
monkey.patch_socket()
monkey.patch_thread()
monkey.patch_time()
monkey.patch_ssl()
from JumpScale import j
from gevent.pywsgi import WSGIServer
import JumpScale.grid.serverbase
import time
import gevent
class GeventWSServer():
def __init__(self, addr,... | Jumpscale/jumpscale6_core | lib/JumpScale/grid/geventws/GeventWSServer.py | Python | bsd-2-clause | 3,848 |
'''
Created by auto_sdk on 2015.04.21
'''
from aliyun.api.base import RestApi
class Ecs20130110DescribeInstanceAttributeRequest(RestApi):
def __init__(self,domain='ecs.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.InstanceId = None
def getapiname(self):
return 'ecs.aliyuncs.com.Des... | wanghe4096/website | aliyun/api/rest/Ecs20130110DescribeInstanceAttributeRequest.py | Python | bsd-2-clause | 356 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import array
from collections import Mapping, defaultdict
import numbers
import re
import unicodedata
import nltk
import numpy as np
from numpy import bincount
import scipy.sparse as sp
def _make_int_array():
return array.array(str("i"))
def _docum... | keyvhinng/sense-me | classifier/tfidf_vectorization/tfidf.py | Python | bsd-2-clause | 3,741 |
"""
Generate
"""
vdw_radii = {}
vdw_radii[1] = 1.2
vdw_radii[6] = 1.5
vdw_radii[7] = 1.5
vdw_radii[8] = 1.4
vdw_radii[16] = 1.89
"""
"""
import numpy
EPS = 1.0e-8
def grid(ntes, r, z, rscal):
temp_coords = []
final_coords = []
for i, (ri, zi) in enumerate(zip(r, z)):
riscal = vdw_radii[zi] ... | cstein/qfitlib | tools/python/connolly.py | Python | bsd-2-clause | 2,192 |
from .version import __version__
from ecospold2matrix.ecospold2matrix import Ecospold2Matrix
| majeau-bettez/ecospold2matrix | ecospold2matrix/__init__.py | Python | bsd-2-clause | 94 |
'''freevolv.models'''
| genevolv/dbrev | py/freevolv/models/__init__.py | Python | bsd-2-clause | 22 |
"""
oscar_stripe.views
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2014 by Xavier Ordoquy,
see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.views.generic import FormView
class StripeView(FormView):
template_name = 'oscar_stripe/form.html'
def form_valid(form):
email... | linovia/django-oscar-stripe | oscar_stripe/views.py | Python | bsd-3-clause | 431 |
"""Test utility functions."""
import numpy as np
from compoda.utils import truncate_range, scale_range
def test_truncate_range():
"""Test range truncation."""
# Given
data = np.random.random(100)
data.ravel()[np.random.choice(data.size, 10, replace=False)] = 0
data.ravel()[np.random.choice(data.s... | ofgulban/tetrahydra | compoda/tests/test_utils.py | Python | bsd-3-clause | 1,154 |
from django.conf.urls import patterns, url
from interim_cms.views import ExampleTileView
urlpatterns = patterns("",
url(r"^example-tile/$", ExampleTileView.as_view(), name="example-tile"),
)
| praekelt/django-interim-cms | interim_cms/urls.py | Python | bsd-3-clause | 198 |
"""Django email backend for celery."""
VERSION = (1, 0, 3, 1)
__version__ = '.'.join(map(str, VERSION))
__author__ = 'Paul McLanahan'
__contact__ = 'paul@mclanahan.net'
__homepage__ = 'http://bitbucket.org/pmclanahan/django-celery-email'
__license__ = 'BSD (3 clause)'
| public/django-celery-email | djcelery_email/__init__.py | Python | bsd-3-clause | 271 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "LinearTrend", cycle_length = 12, transform = "None", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_None/trend_LinearTrend/cycle_12/ar_12/test_artificial_128_None_LinearTrend_12_12_20.py | Python | bsd-3-clause | 263 |
import gc
import operator
import os
import random
import dozer
import flask
import objgraph
app = flask.Flask(__name__)
app.secret_key = "it's a secret to everyone"
# Dozer
app.wsgi_app = dozer.Dozer(app.wsgi_app)
#
# Our leaky app -- simulate a leak by storing some objects in a global var.
#
LEAKY = []
class Leak... | jacobian/python-leaks-demo | app.py | Python | bsd-3-clause | 2,330 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_django-onedeploy
------------
Tests for `django-onedeploy` models module.
"""
from django.test import TestCase
from onedeploy import models
class TestOnedeploy(TestCase):
def setUp(self):
pass
def test_something(self):
pass
def ... | huogerac/django-onedeploy | tests/test_models.py | Python | bsd-3-clause | 349 |
from base import AbstractLogicalFile, AbstractFileMetaData # noqa
from generic import GenericFileMetaData, GenericLogicalFile # noqa
from raster import GeoRasterFileMetaData, GeoRasterLogicalFile # noqa
from netcdf import NetCDFFileMetaData, NetCDFLogicalFile # noqa
from geofeature import GeoFeatureFil... | ResearchSoftwareInstitute/MyHPOM | hs_file_types/models/__init__.py | Python | bsd-3-clause | 530 |
from __future__ import print_function
import sys
import numpy as np
from astropy.wcs import WCSSUB_CELESTIAL
try:
from astropy.coordinates import BaseCoordinateFrame
except ImportError: # astropy <= 0.3
from astropy.coordinates import SphericalCoordinatesBase as BaseCoordinateFrame
from ..utils.wcs_utils i... | bsipocz/glue | glue/external/pvextractor/geometry/path.py | Python | bsd-3-clause | 7,926 |
from collections import namedtuple
from dimagi.ext import jsonobject
from dimagi.utils import parsing as dateparse
from django.utils.translation import ugettext as _
from corehq.apps.commtrack import const
from corehq.apps.commtrack.const import StockActions
from corehq.apps.commtrack.exceptions import MissingProductId... | qedsoftware/commcare-hq | corehq/form_processor/parsers/ledgers/helpers.py | Python | bsd-3-clause | 4,653 |
import os
import shutil
import tempfile
from PIL import Image
from django.db.models import get_model
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from oscar_testsupport.testcases import WebTestCase
FancyPage = get_model('fancypages', 'FancyPage')
TEMP_IMAGE_DIR = tem... | tangentlabs/django-oscar-fancypages | tests/functional/tests_page.py | Python | bsd-3-clause | 2,437 |
from flask_wtf import Form
from mongoengine import DoesNotExist
from wtforms import PasswordField, StringField, BooleanField
from wtforms.validators import DataRequired
from Norman.models import Hospital
from Norman.utils import hash_data
class LoginForm(Form):
"""Login form."""
email = StringField('email', ... | Olamyy/Norman | Norman/auth/forms.py | Python | bsd-3-clause | 2,878 |
from django.conf import settings
from django.db.models.signals import post_save
from django.dispatch import receiver
from dash.orgs.models import Org
from dash.utils import random_string
@receiver(post_save, sender=Org)
def create_org_backend(sender, instance=None, created=False, **kwargs):
if created:
i... | praekelt/casepro | casepro/orgs_ext/signals.py | Python | bsd-3-clause | 609 |
import collections
import random
import sys
import re
from raco.algebra import *
from raco.expression import NamedAttributeRef as AttRef
from raco.expression import UnnamedAttributeRef as AttIndex
from raco.expression import StateVar
from raco.expression import aggregate
from raco.backends.myria import (
MyriaShu... | uwescience/raco | raco/myrial/optimizer_tests.py | Python | bsd-3-clause | 58,294 |
from __future__ import absolute_import
import socket
import struct
from .consts import *
import six
def uint8(n):
return struct.pack("B", n)
def uint64(n):
return struct.pack("!Q", n)
class Error(Exception):
def __init__(self, code):
self.code = code
def __str__(self):
return str... | windreamer/dpark | dpark/file_manager/utils.py | Python | bsd-3-clause | 5,115 |
# -*- coding: utf-8 -*-
"""Skunked terms.
---
layout: post
source: Garner's Modern American Usage
source_url: http://bit.ly/1T4alrY
title: Skunked terms.
date: 2014-06-10 12:31:19
categories: writing
---
Archaism.
"""
from proselint.tools import existence_check, memoize
@memoize
def check_skunke... | jstewmon/proselint | proselint/checks/garner/skunked_terms.py | Python | bsd-3-clause | 776 |
from django.forms import ModelForm
from .models import TaggedItem
class TagItForm(ModelForm):
class Meta:
model = TaggedItem
fields = ['tag']
| acidjunk/django-tagger | tagger/forms.py | Python | bsd-3-clause | 165 |
# -*- coding: utf-8 -*-
import pytest
from _utils import foo, spin
from profiling.profiler import Profiler, ProfilerWrapper
class NullProfiler(Profiler):
def run(self):
yield
class NullProfilerWrapper(ProfilerWrapper):
def run(self):
with self.profiler:
yield
@pytest.fixture... | JeanPaulShapo/profiling | test/test_profiler.py | Python | bsd-3-clause | 1,471 |
import os
import pytest
if __name__ == '__main__':
os.environ['PYWEBVIEW_GUI'] = 'cef'
pytest.main() | r0x0r/pywebview | tests/run_cef.py | Python | bsd-3-clause | 110 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "LinearTrend", cycle_length = 5, transform = "Logit", sigma = 0.0, exog_count = 0, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Logit/trend_LinearTrend/cycle_5/ar_12/test_artificial_1024_Logit_LinearTrend_5_12_0.py | Python | bsd-3-clause | 263 |
"""
Mean log loss from 5-fold CV: 0.480065955962
"""
import copy
import itertools
import numpy as np
import lasagne
import math
import os
import theano
import theano.tensor as T
import time
from lasagne.layers import DenseLayer, DropoutLayer, InputLayer, get_all_params
from lasagne.nonlinearities import rectify, softm... | ahara/kaggle_otto | otto/model/model_09_nn_adagrad/nn_adagrad.py | Python | bsd-3-clause | 11,589 |
import os
import shutil
import tempfile
import re
from StringIO import StringIO
# import zipfile
import custom_zip as zipfile
from xml.etree import ElementTree
try:
# Python 3
from urllib.parse import urlparse, urljoin
except ImportError:
# Python 2
from urlparse import urlparse, urljoin
import metadat... | FreakyBytes/pyCombineArchive | combinearchive/combinearchive.py | Python | bsd-3-clause | 15,637 |
from __future__ import absolute_import, print_function
__all__ = ['JavaScriptStacktraceProcessor']
import logging
import re
import base64
import six
import zlib
from django.conf import settings
from os.path import splitext
from requests.utils import get_encoding_from_headers
from six.moves.urllib.parse import urlpar... | jean/sentry | src/sentry/lang/javascript/processor.py | Python | bsd-3-clause | 28,607 |
"""Tests for UIAWrapper"""
from __future__ import print_function
from __future__ import unicode_literals
import time
import os
import sys
import collections
import unittest
import mock
import six
sys.path.append(".")
from pywinauto.windows.application import Application # noqa: E402
from pywinauto.base_application i... | pywinauto/pywinauto | pywinauto/unittests/test_uiawrapper.py | Python | bsd-3-clause | 96,696 |
{% block meta %}
name: SleepState
description:
SMACH state that pauses state machine execution for a specified length of
time.
language: Python
framework: SMACH
type: State
tags: [core]
includes:
- State
extends: []
variables:
- time:
description: The length of time to sleep for in seconds.
type: float
in... | ReconCell/smacha | smacha_ros/src/smacha_ros/templates/SleepState.tpl.py | Python | bsd-3-clause | 1,351 |
from __future__ import absolute_import
from sentry.api.serializers import Serializer, register
from sentry.models import Release
@register(Release)
class ReleaseSerializer(Serializer):
def serialize(self, obj, attrs, user):
d = {
'id': str(obj.id),
'version': obj.version,
... | camilonova/sentry | src/sentry/api/serializers/models/release.py | Python | bsd-3-clause | 382 |
# -*- coding: utf-8 -*-
"""Tests of misc type utility functions."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import os.path as op
import numpy as np
from numpy.testing import assert_array... | kwikteam/klusta | klusta/tests/test_utils.py | Python | bsd-3-clause | 4,913 |
from django.template import Library
from django.template.defaultfilters import stringfilter
from math import ceil
register = Library()
@register.filter
def columns(thelist, n):
"""
Split a list into `n` columns
"""
try:
n = int(n)
thelist = list(thelist)
except (ValueError, TypeE... | babsey/django-forums-bootstrap | webapp/templatetags/webapp_filters.py | Python | bsd-3-clause | 867 |
# -*- coding: utf-8 -*-
from django.utils.datastructures import SortedDict
from django.db.models.sql.where import ExtraWhere
from .sql.tree import AND, OR
from .sql.utils import _setup_joins_for_fields
class StatementMixIn(object):
def annotate_functions(self, **kwargs):
extra_select, params = SortedDic... | cr8ivecodesmith/django-orm-extensions-save22 | django_orm/core/queryset.py | Python | bsd-3-clause | 955 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import include
from django.conf.urls.i18n import i18n_patterns
from django.conf.urls import url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# Local application / specific lib... | kapt-labs/django-cross-site-urls | tests/_testsite/urls.py | Python | bsd-3-clause | 598 |
from __future__ import division, absolute_import, print_function
import copy
import pickle
import sys
import platform
import gc
import copy
import warnings
import tempfile
from os import path
from io import BytesIO
import numpy as np
from numpy.testing import (
run_module_suite, TestCase, assert_, assert_equa... | NextThought/pypy-numpy | numpy/core/tests/test_regression.py | Python | bsd-3-clause | 77,655 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A demonstration of evoMPS by simulation of quench dynamics
for the transverse Ising model.
@author: Ashley Milsted
"""
import scipy as sp
import evoMPS.tdvp_gen as tdvp
import unittest
x_ss = sp.array([[0, 1],
[1, 0]])
y_ss = 1.j * sp.array([[0, -1... | ftranschel/evoMPS | evoMPS/tests/tdvp_gen_test_ising.py | Python | bsd-3-clause | 1,990 |
try:
#version 0.9+
from klampt.plan.motionplanning import interpolate_nd_min_time,brake_nd
from klampt.plan.motionplanning import combine_nd_cubic
except ImportError:
#version 0.8.x
from klampt.plan.motionplanning import interpolateNDMinTime as interpolate_nd_min_time
from klampt.plan.motionplan... | krishauser/Klampt | Python/klampt/control/motion_generation.py | Python | bsd-3-clause | 15,765 |
from __future__ import print_function
import sys, time, random, os, json
from six.moves.urllib.parse import urlencode
from subprocess import Popen, PIPE
from twisted.web.server import Site, NOT_DONE_YET
from twisted.web.resource import Resource
from twisted.web.static import File
from twisted.web.test.test_webclient i... | taito/scrapy | tests/mockserver.py | Python | bsd-3-clause | 6,893 |
__author__ = "Iacopo Spalletti"
__email__ = "i.spalletti@nephila.it"
__version__ = "2.0.1.dev0"
| nephila/djangocms-installer | djangocms_installer/__init__.py | Python | bsd-3-clause | 96 |
# Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Chromite main test runner.
Run the specified tests. If none are specified, we'll scan the
tree looking for tests to run and then only run the semi-fa... | guorendong/iridium-browser-ubuntu | third_party/chromite/cbuildbot/run_tests.py | Python | bsd-3-clause | 14,581 |
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-attachments',
version='0.1'... | zdot/django-attachments | setup.py | Python | bsd-3-clause | 1,381 |
import json
from tornado import web
import werkzeug.http
def get_handlers():
return [
('/login', AuthHandler),
]
class AuthHandler(web.RequestHandler):
"""Authorization Endpoint.
This is the primary endpoint for this service.
"""
def prepare(self):
super(AuthHandler, self... | dave-shawley/tokenauth | tokenauth/handlers.py | Python | bsd-3-clause | 1,390 |
# -*- coding: utf-8 -*-
import os
from flask import Flask, redirect, url_for
app = Flask(__name__)
app.config.from_object('app.config')
from app import views
| pengan1987/pythonDev | app/__init__.py | Python | bsd-3-clause | 166 |
from selenium.webdriver.common.by import By
from pages.desktop.base import Base
class DevhubSubmission(Base):
"""Devhub submission page legacy view.
This will fill and submit an addon.
"""
_name_locator = (By.ID, 'id_name')
_summary_locator = (By.ID, 'id_summary_0')
_license_btn_locator = (... | psiinon/addons-server | tests/ui/pages/desktop/devhub_submission.py | Python | bsd-3-clause | 1,947 |
# -*- coding: utf-8 -*-
"""The check functions."""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
from builtins import input # no-op here but facilitates testing
from difflib import get_close_matches
from distutils.version import LooseVersion
import operator
import os
import o... | kambysese/mne-python | mne/utils/check.py | Python | bsd-3-clause | 27,288 |
"""Monitor and influence the optimization procedure via callbacks.
Callbacks are callables which are invoked after each iteration of the optimizer
and are passed the results "so far". Callbacks can monitor progress, or stop
the optimization early by returning `True`.
"""
try:
from collections.abc import Callable
... | scikit-optimize/scikit-optimize | skopt/callbacks.py | Python | bsd-3-clause | 9,377 |
"""Beatles Dataset Loader
.. admonition:: Dataset Info
:class: dropdown
The Beatles Dataset includes beat and metric position, chord, key, and segmentation
annotations for 179 Beatles songs. Details can be found in http://matthiasmauch.net/_pdf/mauch_omp_2009.pdf and
http://isophonics.net/content/refe... | mir-dataset-loaders/mirdata | mirdata/datasets/beatles.py | Python | bsd-3-clause | 9,857 |
#!/usr/bin/env python
# A test file must start with a header, where each line starts with '// '.
# The first line of the header must be 'Plinth Test'.
# Successive lines can specify options for the test. Valid options are:
# Main: <type name>
# Uses the specified type name as the main type argument to the compil... | abryant/Plinth | test/runtest.py | Python | bsd-3-clause | 8,056 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rvws.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| gardenm/hypetra.in | rvws/manage.py | Python | bsd-3-clause | 247 |
"""Metrics to assess performance on classification task given classe prediction
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.gram... | chrisburr/scikit-learn | sklearn/metrics/classification.py | Python | bsd-3-clause | 68,445 |
import re
from threading import Thread
import rostopic
from BAL.Handlers.keepAliveHandler import KeepAliveHandler
from BAL.Header.Requests.PublishRequest import PublishRequest
from BAL.Header.Response.ParamBuildResponse import URF_HRLV
__author__ = 'tom1231'
from BAL.Interfaces.Device import Device
from rospy import P... | robotican/ric | ric_board/scripts/RiCTraffic/BAL/Devices/RiCURF.py | Python | bsd-3-clause | 2,326 |
import sys
import traceback
from django.conf import settings
class AppNotFoundError(Exception):
pass
class ClassNotFoundError(Exception):
pass
def get_class(module_label, classname):
return get_classes(module_label, [classname, ])[0]
def get_classes(module_label, classnames):
""" Imports a set ... | ellmetha/django-machina | machina/core/loading.py | Python | bsd-3-clause | 3,900 |
from __future__ import absolute_import
from .base import *
########## IN-MEMORY TEST DATABASE
DATABASES = {
"default": env.db('sqlite://:memory:'),
}
########## EMAIL CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBac... | openpolis/op-accesso | project/accesso/settings/test.py | Python | bsd-3-clause | 934 |
# -*- coding: utf-8 -*-
from widelanguagedemo.app import create_app
from widelanguagedemo.settings import ProdConfig, DevConfig
def test_production_config():
app = create_app(ProdConfig)
assert app.config['ENV'] == 'prod'
assert app.config['DEBUG'] is False
assert app.config['DEBUG_TB_ENABLED'] is Fals... | larsyencken/wide-language-demo | tests/test_config.py | Python | bsd-3-clause | 548 |
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
engine_url = 'sqlite:///good-happens.db'
if 'DB_URL' in os.environ:
engine_url = os.environ['DB_URL']
engine = create_engine(engine_url, convert_unicode=Tru... | wastevensv/good-happens | src/server/database.py | Python | bsd-3-clause | 838 |
class ContactData(SQLObject):
_connection = SQLiteConnection('slingshotsms.db')
# in reference to
# http://en.wikipedia.org/wiki/VCard
TEL = StringCol()
UID = StringCol()
PHOTO = BLOBCol()
N = StringCol()
FN = StringCol()
# contains all data as serialized vc, including the above colu... | developmentseed/slingshotSMS | messagesystem/messagesystem.py | Python | bsd-3-clause | 2,124 |
# vim: set fileencoding=utf-8 :
from __future__ import absolute_import
from subprocess import Popen, PIPE
import logging
import os
logger = logging.getLogger(__name__)
class Script(object):
def __init__(self, name, path):
# Identifier for the script. Usually the file name, but doesn't need
# t... | roac-monitoring/roac-agent | roac/script.py | Python | bsd-3-clause | 1,908 |
def catch1():
try:
blah()
except Exception as e:
print(e) #, e.args)
def catch2():
try:
raise BaseException()
except Exception as e:
print(e) #, e.args)
def catch3():
try:
raise BaseException()
except:
pass
catch1()
#catch2()
# catch3()
| talapus/Ophidian | Exceptions.py | Python | bsd-3-clause | 318 |
from datetime import date
import logging
import pytz
from sqlalchemy import and_, desc, func, or_
from sqlalchemy.orm.exc import DetachedInstanceError
from werkzeug.exceptions import BadRequest, NotFound, Conflict, InternalServerError
from rdr_service import config
from rdr_service.clock import CLOCK
from rdr_service.... | all-of-us/raw-data-repository | rdr_service/dao/deceased_report_dao.py | Python | bsd-3-clause | 29,962 |
import graphene
from ...core.permissions import PagePermissions
from ...page import models
from ..core.mutations import BaseBulkMutation, ModelBulkDeleteMutation
class PageBulkDelete(ModelBulkDeleteMutation):
class Arguments:
ids = graphene.List(
graphene.ID, required=True, description="List ... | maferelo/saleor | saleor/graphql/page/bulk_mutations.py | Python | bsd-3-clause | 1,076 |
# Authors: Marijn van Vliet <w.m.vanvliet@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Teon Brooks <teon.brooks@gmail.com>
#
# License: BSD (3-clause)
import warnings
import os.path as op
import numpy as np
from nose.tools import assert_true, assert_equal, assert_raise... | jaeilepp/mne-python | mne/io/tests/test_reference.py | Python | bsd-3-clause | 20,218 |
# coding: utf-8
# python-3
# Author: Sreejith Menon (smenon8@uic.edu)
# Description: Contains a single method that generates mechanical turk jobs for generating photo-albums in bulk.
# This script contains a __main__() method that accepts command line arguments and can be directly executed through terminal.
# To run... | smenon8/AnimalWildlifeEstimator | script/CreateTurkFilesBulk.py | Python | bsd-3-clause | 3,489 |
"""Test that the window can be hidden and shown.
Expected behaviour:
One window will be opened. Every 5 seconds it will toggle between
hidden and shown.
Press escape or close the window to finish the test.
"""
import time
import unittest
from pyglet import window
class WindowSetVisible(unittest.Test... | bitcraft/pyglet | tests/interactive/window/window_set_visible.py | Python | bsd-3-clause | 772 |
from __future__ import absolute_import, division, unicode_literals
from colorsys import hsv_to_rgb
import cProfile
import inspect
import os
from pstats import Stats
from six import PY2
from django.utils.translation import ugettext_lazy as _
from django.utils.safestring import mark_safe
from django.utils.six.moves imp... | dmclain/django-debug-toolbar-line-profiler | debug_toolbar_line_profiler/panel.py | Python | bsd-3-clause | 9,567 |
import threading
from ctypes import POINTER, Structure, byref, c_char, c_char_p, c_int, c_size_t
from django.contrib.gis.geos.base import GEOSBase
from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory
from django.contrib.gis.geos.prototypes.errcheck import (
check_geom, check_sized_string, check_st... | auready/django | django/contrib/gis/geos/prototypes/io.py | Python | bsd-3-clause | 11,322 |
from django.db.models.signals import m2m_changed, post_delete, post_save
from kitsune.products.models import Product, Topic
from kitsune.search.decorators import search_receiver
from kitsune.search.es7_utils import delete_object, index_object, remove_from_field
from kitsune.wiki.models import Document
@search_receiv... | mozilla/kitsune | kitsune/search/signals/wiki.py | Python | bsd-3-clause | 1,049 |
"""
==========
Exceptions
==========
NepidemiX project exceptions.
"""
__author__ = "Lukas Ahrenberg <lukas@ahrenberg.se>"
__license__ = "Modified BSD License"
__all__ = ["NepidemiXBaseException"]
class NepidemiXBaseException(Exception):
"""
Generic exception for the Network Model class.
"""
... | impact-hiv/NepidemiX | nepidemix/exceptions.py | Python | bsd-3-clause | 423 |
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
import argparse
from util import io
import mesh.patch as patch
# plot a single variable from an output file
#
# Usage: ./plotvar.py filename variable
def makeplot(plotfile, variable, outfile,
width=6.5, height=5.25,
... | harpolea/pyro2 | analysis/plotvar.py | Python | bsd-3-clause | 2,438 |
"""
django-helpdesk - A Django powered ticket tracker for small enterprise.
(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details.
views/public.py - All public facing views, eg non-staff (no authentication
required) views.
"""
from django.core.urlresolvers import reverse
from djang... | vladyslav2/django-helpdesk | helpdesk/views/public.py | Python | bsd-3-clause | 5,141 |
"""Functions to be used with hyperopt for doing hyper parameter optimization."""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from builtins import super
from builtins import open
from future import standard_library
... | rlpy/rlpy | rlpy/Tools/hypersearch.py | Python | bsd-3-clause | 12,247 |
import inspect
import os
import subprocess
import sys
from abc import ABCMeta, abstractmethod
from .exception import StashException
class FileStatus(object):
"""Enum for all possible file states that are handled by stash."""
Added, Removed = range(2)
class Repository(object):
"""Abstract class that defi... | ton/stash | stash/repository.py | Python | bsd-3-clause | 9,261 |
"""Blog models."""
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.conf import settings
from django.db import models
from arpegio.core.models import ContentMixin, Timestampable
from .managers import PostManager
class Post(ContentMixin, # pylint: disable=model-missin... | arpegio-dj/arpegio | arpegio/blog/models.py | Python | bsd-3-clause | 1,334 |
# -*- coding: utf-8 -*-
import time
import os,sys
import itertools
import math
import argparse
import numpy as np
from multiprocessing import Pool
from hashlib import sha1
import random, struct
from random import sample,choice
from sklearn import metrics
#we truncate sha1 for now. We should probably replace this with ... | benbo/FastDocumentClusters | fast_document_clusters.py | Python | bsd-3-clause | 8,883 |
# sqlalchemy/__init__.py
# Copyright (C) 2005-2011 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import inspect
import sys
import sqlalchemy.exc as exceptions
from sqlalchemy... | intelie/pycollector | src/third/sqlalchemy/__init__.py | Python | bsd-3-clause | 1,975 |
"""Models lslsl."""
from django.db import models
estado_civil = (
('Soltero', 'Soltero'),
('Casado', 'Casado'),
('Divorciado', 'Divorciado'),
('Viudo', 'Viudo'),
('Conviviente', 'Conviviente'),
)
sexo = (
('Femenino', 'Femenino'),
('Masculino', 'Masculino'),
)
ocupacion = (
('Estudi... | upeu-jul-20161-epis-ads2/MedicFast | apps/atencion/models.py | Python | bsd-3-clause | 9,675 |
from django.conf import settings
from corehq.apps.commtrack.helpers import make_supply_point
from corehq.form_processor.abstract_models import AbstractSupplyInterface
from corehq.form_processor.backends.sql.dbaccessors import CaseAccessorSQL
from corehq.util.soft_assert import soft_assert
_supply_point_dynamically_cr... | qedsoftware/commcare-hq | corehq/form_processor/backends/sql/supply.py | Python | bsd-3-clause | 1,490 |
from django.conf.urls.defaults import *
from django.views.generic.list_detail import object_detail, object_list
from models import Article, Category
from views import article_detail
article_info = {
'queryset': Article.objects.all(),
'template_object_name': 'article',
}
category_info = {
'queryset': Cate... | nnrcschmdt/atix-django | atix/articles/urls.py | Python | bsd-3-clause | 869 |
from .RFScore import rfscore
from .NNScore import nnscore
__all__ = ['rfscore', 'nnscore']
| mwojcikowski/opendrugdiscovery | oddt/scoring/functions/__init__.py | Python | bsd-3-clause | 92 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###########################################################
# WARNING: Generated code! #
# ************************** #
# Manual changes may get lost if file is generated again. #
# Only code inside the [MANUAL] ta... | WalkingMachine/sara_behaviors | sara_flexbe_behaviors/src/sara_flexbe_behaviors/test_look_at_sound_sm.py | Python | bsd-3-clause | 4,211 |
#!/usr/bin/env python
from setuptools import setup, find_packages
import os
# Utility function to read README file
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='feincms-tinymce-image-browser',
version='0.1.1',
description="Provides a way to select im... | jamstooks/feincms-tinymce-image-browser | setup.py | Python | bsd-3-clause | 1,084 |
# -*- coding: utf-8 -*-
#
# records.py
# csvdiff
#
from typing.io import TextIO
from typing import Any, Dict, Tuple, Iterator, List, Sequence
import csv
import sys
from . import error
Column = str
PrimaryKey = Tuple[str, ...]
Record = Dict[Column, Any]
Index = Dict[PrimaryKey, Record]
class InvalidKeyError(Exce... | larsyencken/csvdiff | csvdiff/records.py | Python | bsd-3-clause | 2,402 |
# proxy module
from pyface.xrc_dialog import *
| enthought/etsproxy | enthought/pyface/xrc_dialog.py | Python | bsd-3-clause | 47 |
from django.contrib.postgres.signals import register_hstore_handler
from django.db.migrations.operations.base import Operation
class CreateExtension(Operation):
reversible = True
def __init__(self, name):
self.name = name
def state_forwards(self, app_label, state):
pass
def database... | alexallah/django | django/contrib/postgres/operations.py | Python | bsd-3-clause | 1,801 |
# -*- encoding: utf-8 -*-
from . import db
class Constellation(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=False)
name = db.Column(db.String(100), nullable=False)
region_id = db.Column(db.Integer, db.ForeignKey('region.id'))
| Kyria/LazyBlacksmith | lazyblacksmith/models/sde/constellation.py | Python | bsd-3-clause | 266 |
# $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/persistence/adapters/lucene/__init__.py | Python | bsd-3-clause | 1,810 |
from __future__ import absolute_import
from datetime import datetime, timedelta
from sentry.models import GroupHash
from sentry.testutils import TestCase, SnubaTestCase
from sentry.utils import snuba
class SnubaUtilTest(TestCase, SnubaTestCase):
def test_filter_keys_set(self):
snuba.raw_query(
... | mvaled/sentry | tests/snuba/test_util.py | Python | bsd-3-clause | 3,144 |
__author__ = 'Afief'
from datetime import datetime
from peewee import CharField, TextField, BooleanField, ForeignKeyField, \
DateField
from apps.models import db
from apps.models.auth import User
class Phile(db.Model):
filename = CharField(max_length=100)
filetype = CharField(max_length=100)
filepa... | ap13p/elearn | apps/models/others.py | Python | bsd-3-clause | 1,428 |
from twisted.internet.defer import inlineCallbacks, returnValue
from vumi.config import Config, ConfigBool, ConfigList
from go.vumitools.utils import MessageMetadataHelper
class OptOutHelperConfig(Config):
case_sensitive = ConfigBool(
"Whether case sensitivity should be enforced when checking message "
... | praekelt/vumi-go | go/vumitools/opt_out/utils.py | Python | bsd-3-clause | 2,270 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.six import string_types
from django.utils.translation import ugettext_lazy as _
import likert_field.forms as forms
@python_2_unicod... | kelvinwong-ca/django-likert-field | likert_field/models.py | Python | bsd-3-clause | 1,847 |
#!/usr/bin/env python
from wsgi import *
from django.contrib.auth.models import User
try:
wunki = User.objects.get(username='wunki')
except User.DoesNotExist:
pass
else:
wunki.is_staff = True
wunki.is_superuser = True
wunki.save()
| pjdelport/django-userena | demo/superuser.py | Python | bsd-3-clause | 251 |
AR[AR%2==0] = 0.
AR | jorisvandenbossche/DS-python-data-analysis | notebooks/python_recap/_solutions/05-numpy75.py | Python | bsd-3-clause | 19 |