code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Edgewall Software
# Copyright (C) 2007 Alec Thomas <alec@swapoff.org>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.ed... | dokipen/trac | tracopt/perm/authz_policy.py | Python | bsd-3-clause | 8,731 |
from __future__ import unicode_literals
from datetime import timedelta
import logging
import os
import re
import time
from django.conf import settings
from django.db import models
from django.db.models import Q
from django.utils.crypto import get_random_string
from django.utils.encoding import python_2_unicode_compat... | orbitvu/django-mama-cas | mama_cas/models.py | Python | bsd-3-clause | 13,586 |
"""
Model and manager used by the two-step (sign up, then activate)
workflow. If you're not using that workflow, you don't need to have
'registration' in your INSTALLED_APPS.
This is provided primarily for backwards-compatibility with existing
installations; new installs of django-registration should look into
the HMA... | tdruez/django-registration | registration/models.py | Python | bsd-3-clause | 10,792 |
from flask import Flask
from . import config
from . import ElaborateCharts
app = Flask(__name__)
app.config['SECRET_KEY'] = config.SECRET_KEY
charts = ElaborateCharts(app)
if __name__ == '__main__':
app.run(host='127.0.0.1', debug=True)
| Perlence/elaborate-lastfm-charts | elaboratecharts/app.py | Python | bsd-3-clause | 246 |
import glob
import os
from .. import *
@skip_if('java' not in test_features, 'skipping java tests')
@skip_if_backend('msbuild')
class TestJava(IntegrationTest):
def __init__(self, *args, **kwargs):
super().__init__(os.path.join('languages', 'java'), install=True,
*args, **kwargs)... | jimporter/bfg9000 | test/integration/languages/test_java.py | Python | bsd-3-clause | 2,704 |
#!/usr/bin/env python
from __future__ import print_function
import re
import ast
import subprocess
import sys
from optparse import OptionParser
DEBUG = False
CONFIRM_STEPS = False
DRY_RUN = False
def skip_step():
"""
Asks for user's response whether to run a step. Default is yes.
:return: boolean
"""... | koljonen/pgcli | release.py | Python | bsd-3-clause | 2,731 |
from configurations import values
from . import common, databases, email
from .. import __version__
class Raven(object):
"""Report uncaught exceptions to the Sentry server."""
INSTALLED_APPS = common.Common.INSTALLED_APPS + ('raven.contrib.django.raven_compat',)
RAVEN_CONFIG = {
'dsn': values.U... | CodeforLeipzig/fog | fog/config/settings/public.py | Python | bsd-3-clause | 1,254 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Copyright (C) 2009-2010 Nicolas P. Rougier
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#---------------... | davidcox/glumpy | glumpy/image.py | Python | bsd-3-clause | 8,858 |
#!/usr/bin/env python -u
# encoding: utf-8
#
# Copyright (c) 2012, Peter Hillerström <peter.hillerstrom@gmail.com>
# All rights reserved. This software is licensed under 3-clause BSD license.
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
... | peterhil/prism | prism/test/grep_test.py | Python | bsd-3-clause | 738 |
# -*- coding: utf-8 -*-
"""
Контролер веб интерфейса бота
:copyright: (c) 2013 by Pavel Lyashkov.
:license: BSD, see LICENSE for more details.
"""
import re
import os
from flask import Flask, Blueprint, abort, request, make_response, url_for, render_template
from web import app
from web import cache
api ... | shaiban/flask-btce | web/views/api.py | Python | bsd-3-clause | 442 |
"""
This module contains a class, :class:`Query`, that was implemented to provide
users with means to programmatically query the
`ACS Zeropoints Calculator <https://acszeropoints.stsci.edu>`_.
The API works by submitting requests to the
ACS Zeropoints Calculator referenced above and hence, it is only valid for ACS
spec... | jhunkeler/acstools | acstools/acszpt.py | Python | bsd-3-clause | 14,427 |
from django.conf import settings
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import gettext_lazy as _
from churchill.apps.core.models import BaseModel
from churchill.apps.currencies.services import get_default_currency_id
class StatsCalculationStrategy(model... | manti-by/Churchill | churchill/apps/profiles/models.py | Python | bsd-3-clause | 2,037 |
# import argcomplete
# import httplib
# import logging
# import simplejson
# import sys
# import urllib2
# from time import strftime, localtime
# from conpaas.core import https
# from .base import BaseClient
# from .config import config
# from .service import ServiceCmd
# MODES = ['DEMO', 'REAL']
# TASKFARM_MNG_POR... | ConPaaS-team/conpaas | cps-tools/src/cps_tools/taskfarm.py | Python | bsd-3-clause | 10,346 |
__authors__ = ""
__copyright__ = "(c) 2014, pymal"
__license__ = "BSD License"
__contact__ = "Name Of Current Guardian of this file <email@address>"
USER_AGENT = 'api-indiv-0829BA2B33942A4A5E6338FE05EFB8A1'
HOST_NAME = "http://myanimelist.net"
DEBUG = False
RETRY_NUMBER = 4
RETRY_SLEEP = 1
SHORT_SITE_FORMAT_TIME = ... | pymal-developers/pymal | pymal/consts.py | Python | bsd-3-clause | 496 |
#!/usr/bin/env python
#
# Program: $Id: $
# Author: Robert Beverly <rbeverly@nps.edu>
# Description: Experimental tracebox warts parser
import sys
import struct
import dpkt
from sc_warts import *
if dpkt.__version__ == '1.8':
print "Upgrade dpkt"
sys.exit(-1)
TRACEBOXTYPE = 0x0c
def dict_diff(a, b):... | cmand/scamper | sc_tracebox.py | Python | bsd-3-clause | 7,053 |
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 = "ConstantTrend", cycle_length = 12, transform = "None", sigma = 0.0, exog_count = 100, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_None/trend_ConstantTrend/cycle_12/ar_12/test_artificial_32_None_ConstantTrend_12_12_100.py | Python | bsd-3-clause | 265 |
from django.db import models
from django.db.models import Q
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth import get_user_model
from django.contrib.auth.models import UserManager, Permission, AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.utils.enco... | bioinformatics-ua/django-userena | userena/managers.py | Python | bsd-3-clause | 12,823 |
from django import forms
from django.core import validators
from comperio.accounts.models import cUser, Settings, cGroup
from django.core.validators import email_re
import random, datetime, sha
MIN_PASSWORD_LENGTH = 6
class LoginForm(forms.Form):
"""account login form"""
username = forms.CharField(widget=form... | neutrinog/Comperio | comperio/accounts/forms.py | Python | bsd-3-clause | 8,980 |
# -*- coding: utf-8 -*-
from classytags.arguments import Argument, MultiValueArgument
from classytags.core import Options, Tag
from classytags.helpers import InclusionTag
from classytags.parser import Parser
from cms.models import Page, Placeholder as PlaceholderModel
from cms.plugin_rendering import render_plugins, re... | VillageAlliance/django-cms | cms/templatetags/cms_tags.py | Python | bsd-3-clause | 14,804 |
import hashlib
import json
import os
import uuid
from django import forms
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.core.paginator import Emp... | takeflight/wagtail | wagtail/tests/testapp/models.py | Python | bsd-3-clause | 43,462 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import base
from misc import GetPageInfo
from models import PageIdentifier
from category import GetSubcategoryInfos
from revisions import GetCurrentContent, GetPageRevisionInfos
from meta import GetSourceInfo
def test_unicode_title():
get_beyonce ... | mahmoud/wapiti | wapiti/operations/test_basic.py | Python | bsd-3-clause | 1,717 |
import math
from numba import njit
from tardis.montecarlo.montecarlo_numba import (
njit_dict_no_parallel,
)
import tardis.montecarlo.montecarlo_numba.numba_config as nc
from tardis.montecarlo.montecarlo_numba.numba_config import (
C_SPEED_OF_LIGHT,
MISS_DISTANCE,
SIGMA_THOMSON,
CLOSE_LINE_THRESH... | tardis-sn/tardis | tardis/montecarlo/montecarlo_numba/calculate_distances.py | Python | bsd-3-clause | 3,846 |
"""URI API
This file contains the part of the blaze API dealing with URIs. The
"URI API". In Blaze persistence is provided by the means of this URI
API, that allows specifying a "location" for an array as an URI.
The URI API allows:
- saving existing arrays to an URI.
- loading an array into memory from an URI.
- ... | mwiebe/blaze | blaze/io/storage.py | Python | bsd-3-clause | 7,420 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | ardekantur/pyglet | pyglet/app/cocoa.py | Python | bsd-3-clause | 7,023 |
from .. utils import TranspileTestCase, BuiltinFunctionTestCase
class InputTests(TranspileTestCase):
pass
# FIXME: This test can't run without a redirection for stdin.
# class BuiltinInputFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):
# functions = ["input"]
# not_implemented = [
# ... | glasnt/voc | tests/builtins/test_input.py | Python | bsd-3-clause | 687 |
from bokeh.plotting import figure, show
# prepare some data
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]
# create a new plot with a title and axis labels
p = figure(title="Simple line example", x_axis_label="x", y_axis_label="y")
# add a line renderer with legend and line thickness
p.line(x, y, legend_label="Temp.", line... | bokeh/bokeh | sphinx/source/docs/first_steps/examples/first_steps_1_simple_line.py | Python | bsd-3-clause | 358 |
from Chip import OpCodeDefinitions
from Tests.OpCodeTests.OpCodeTestBase import OpCodeTestBase
class TestRtiOpCode(OpCodeTestBase):
def test_execute_rti_implied_command_calls_and_method(self):
self.assert_opcode_execution(OpCodeDefinitions.rti_implied_command, self.target.get_rti_command_executed)
| jeroanan/Nes2 | Tests/OpCodeTests/TestRtiOpCode.py | Python | bsd-3-clause | 313 |
#encoding=utf-8
"""
26. Invalid models
This example exists purely to point out errors in models.
"""
from __future__ import unicode_literals
from django.db import connection, models
class FieldErrors(models.Model):
charfield = models.CharField()
charfield2 = models.CharField(max_length=-1)
charfield3 =... | RaoUmer/django | tests/modeltests/invalid_models/invalid_models/models.py | Python | bsd-3-clause | 29,360 |
import sys
import os
import commands
import nipype.pipeline.engine as pe
import nipype.algorithms.rapidart as ra
import nipype.interfaces.fsl as fsl
import nipype.interfaces.io as nio
import nipype.interfaces.utility as util
from utils import *
from CPAC.vmhc import *
from nipype.interfaces.afni import preprocess
from ... | sgiavasis/C-PAC | CPAC/vmhc/vmhc.py | Python | bsd-3-clause | 22,733 |
# -*- coding: utf-8 -*-
import mock
from rest_framework import serializers
from waffle.testutils import override_switch
from olympia.amo.tests import (
BaseTestCase, addon_factory, collection_factory, TestCase, user_factory)
from olympia.bandwagon.models import CollectionAddon
from olympia.bandwagon.serializers im... | atiqueahmedziad/addons-server | src/olympia/bandwagon/tests/test_serializers.py | Python | bsd-3-clause | 6,482 |
from django.utils.safestring import mark_safe
from corehq.apps.data_interfaces.dispatcher import EditDataInterfaceDispatcher
from corehq.apps.groups.models import Group
from django.core.urlresolvers import reverse
from corehq.apps.reports import util
from corehq.apps.reports.datatables import DataTablesHeader, DataTabl... | gmimano/commcaretest | corehq/apps/data_interfaces/interfaces.py | Python | bsd-3-clause | 3,559 |
import numpy as np
import pandas as pd
import pytest
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.impute import SimpleImputer
from sklearn.model_selection import GridSearchCV, cross_val_score
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import FunctionTransformer, StandardScaler
f... | Featuretools/featuretools | featuretools/tests/wrappers/test_sklearn_wrapper.py | Python | bsd-3-clause | 3,577 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-09-24 19:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('controlled_vocabularies', '0001_initial'),
]
opera... | unt-libraries/django-controlled-vocabularies | controlled_vocabularies/migrations/0002_auto_20180924_1938.py | Python | bsd-3-clause | 3,376 |
{% block meta %}
name: Base
description: SMACH base template.
language: Python
framework: SMACH
type: Base
tags: [core]
includes: []
extends: []
variables:
- - manifest:
description: ROS manifest name.
type: str
- - node_name:
description: ROS node name for the state machine.
type: str
- outcome... | ReconCell/smacha | smacha/src/smacha/templates/Base.tpl.py | Python | bsd-3-clause | 2,545 |
# Copyright (C) 2014 - The MITRE Corporation
# For license information, see the LICENSE.txt file
#: Namespace map of namespaces libtaxii knows about
NS_MAP = {
'taxii': 'http://taxii.mitre.org/messages/taxii_xml_binding-1',
'taxii_11': 'http://taxii.mitre.org/messages/taxii_xml_binding-1.1',
'tdq': 'http:/... | Intelworks/libtaxii | libtaxii/constants.py | Python | bsd-3-clause | 13,355 |
#!/usr/bin/env python
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Linux specific tests."""
import contextlib
import errno
import io
import os
import pprint
import re
import shutil
import socket
... | 0-wiz-0/psutil | psutil/tests/test_linux.py | Python | bsd-3-clause | 27,328 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
import django.contrib.postgres.fields.hstore
class Migration(migrations.Migration):
dependencies = [
('hs_core', '0035_remove_deprecated_fields'),
]
operations = [
migrations.AddField(
model_name='contributor'... | hydroshare/hydroshare | hs_core/migrations/0036_auto_20171117_0422.py | Python | bsd-3-clause | 639 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import sys
import time
import pytest
try:
import yajl
except ImportError:
yajl = None
try:
import simplejson
except ImportError:
simplejson = None
try:
import json
except ImportError:
json = None
try:
import rapidjson
except I... | thedrow/cyrapidjson | tests/test_benchmarks.py | Python | bsd-3-clause | 7,481 |
from __future__ import absolute_import
########################################################################
# File based on https://github.com/Blosc/bcolz
########################################################################
#
# License: BSD
# Created: October 5, 2015
# Author: Carst Vaartjes - cva... | visualfabriq/bqueryd | setup.py | Python | bsd-3-clause | 4,002 |
from copy import deepcopy
from operator import mul
import joblib
import numpy as np
from scipy import sparse
import pandas as pd
import pytest
import anndata as ad
from anndata._core.index import _normalize_index
from anndata._core.views import ArrayView, SparseCSRView, SparseCSCView
from anndata.utils import asarray... | theislab/anndata | anndata/tests/test_views.py | Python | bsd-3-clause | 18,418 |
#!/usr/bin/env python
'''use marquise_telemetry to build throughput info as visible from the client
e.g.:
$ marquse_telemetry broker | marquise_throughput.py
'''
import sys
from time import *
import os
import fcntl
class TimeAware(object):
'''simple timing aware mixin
The default implementation of o... | anchor/vaultaire-tools | telemetry/marquise_throughput.py | Python | bsd-3-clause | 14,550 |
DEBUG = False
BASEDIR = ''
SUBDIR = ''
PREFIX = ''
QUALITY = 85
CONVERT = '/usr/bin/convert'
WVPS = '/usr/bin/wvPS'
PROCESSORS = (
'populous.thumbnail.processors.colorspace',
'populous.thumbnail.processors.autocrop',
'populous.thumbnail.processors.scale_and_crop',
'populous.thumbnail.processors.filters'... | caiges/populous | populous/thumbnail/defaults.py | Python | bsd-3-clause | 324 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 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
# ... | vlegoff/tsunami | src/primaires/scripting/actions/detruire_sortie.py | Python | bsd-3-clause | 2,726 |
from flask import Flask, render_template, flash, session, redirect, url_for
from wtforms import TextAreaField
from wtforms.validators import DataRequired
from flask.ext.wtf import Form
from flask.ext.wtf.recaptcha import RecaptchaField
DEBUG = True
SECRET_KEY = 'secret'
# keys for localhost. Change as appropriate.
... | Maxence1/flask-wtf | examples/recaptcha/app.py | Python | bsd-3-clause | 1,299 |
from django.template import TemplateDoesNotExist, TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
from .test_extends import inheritance_templates
class ExceptionsTests(SimpleTestCase):
@setup({'exception01': "{% extends 'nonexistent' %}"})
def test_exception01(... | yephper/django | tests/template_tests/syntax_tests/test_exceptions.py | Python | bsd-3-clause | 2,158 |
import collections
from .settings import preferences_settings
from .exceptions import CachedValueNotFound, DoesNotExist
class PreferencesManager(collections.Mapping):
"""Handle retrieving / caching of preferences"""
def __init__(self, model, registry, **kwargs):
self.model = model
self.re... | willseward/django-dynamic-preferences | dynamic_preferences/managers.py | Python | bsd-3-clause | 4,981 |
import unittest
import helper.config
import mock
from vetoes import config
class FeatureFlagMixinTests(unittest.TestCase):
def test_that_flags_are_processed_during_initialize(self):
settings = helper.config.Data({
'features': {'on': 'on', 'off': 'false'}
})
consumer = config... | dave-shawley/vetoes | tests/feature_flag_tests.py | Python | bsd-3-clause | 751 |
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 = "PolyTrend", cycle_length = 7, transform = "Logit", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Logit/trend_PolyTrend/cycle_7/ar_12/test_artificial_1024_Logit_PolyTrend_7_12_20.py | Python | bsd-3-clause | 262 |
"""
Module containing functions to differentiate functions using tensorflow.
"""
try:
import tensorflow as tf
from tensorflow.python.ops.gradients import _hessian_vector_product
except ImportError:
tf = None
from ._backend import Backend, assert_backend_available
class TensorflowBackend(Backend):
def... | j-towns/pymanopt | pymanopt/tools/autodiff/_tensorflow.py | Python | bsd-3-clause | 2,913 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
import photolib.models
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
('taggit', '0001_initial'),
]
operations = [
migrations.CreateMo... | sunlightlabs/horseradish | photolib/migrations/0001_initial.py | Python | bsd-3-clause | 1,986 |
"""empty message
Revision ID: 2357b6b3d76
Revises: fecca96b9d
Create Date: 2015-10-27 10:26:52.074526
"""
# revision identifiers, used by Alembic.
revision = '2357b6b3d76'
down_revision = 'fecca96b9d'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please... | codeforamerica/comport | migrations/versions/2357b6b3d76_.py | Python | bsd-3-clause | 794 |
# -*- 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 'Person.education'
db.add_column('person_person', 'education',
self.gf(... | elin-moco/ffclub | ffclub/person/migrations/0005_auto__add_field_person_education__add_field_person_birthday.py | Python | bsd-3-clause | 5,302 |
"""
Given a positive integer n and you can do operations as follow:
If n is even, replace n with n/2.
If n is odd, you can replace n with either n + 1 or n - 1.
What is the minimum number of replacements needed for n to become 1?
Example 1:
Input:
8
Output:
3
Explanation:
8 -> 4 -> 2 -> 1
Example 2:
Input:
7
Out... | shub0/algorithm-data-structure | python/integer_replacement.py | Python | bsd-3-clause | 763 |
# -*- coding: utf-8 -*-
#
# django-intercom documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 23 13:50:08 2012.
#
# 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
# autogenerated file.... | Kagiso-Future-Media/django-intercom | docs/conf.py | Python | bsd-3-clause | 9,137 |
from log4mongo.handlers import MongoHandler
from pymongo.errors import PyMongoError
from StringIO import StringIO
import unittest
import logging
import sys
class TestMongoHandler(unittest.TestCase):
host_name = 'localhost'
database_name = 'log4mongo_test'
collection_name = 'logs_test'
def setUp(self):... | EzyInsights/log4mongo-python | log4mongo/test/test_handlers.py | Python | bsd-3-clause | 6,198 |
import logging
import os
import os.path
import shutil
import sys
import tempfile
import unittest
import pytest
import fiona
from fiona.collection import supported_drivers
from fiona.errors import FionaValueError, DriverError, SchemaError, CRSError
from fiona.ogrext import calc_gdal_version_num, get_gdal_version_num
... | perrygeo/Fiona | tests/test_geopackage.py | Python | bsd-3-clause | 2,690 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | mbr/Babel-CLDR | babel/messages/extract.py | Python | bsd-3-clause | 22,451 |
from django.utils import translation
from nose.tools import eq_
from olympia import amo
from olympia.amo.tests import TestCase, ESTestCase
from olympia.addons.models import Addon
from olympia.reviews import tasks
from olympia.reviews.models import (
check_spam, GroupedRating, Review, ReviewFlag, Spam)
from olympi... | jpetto/olympia | src/olympia/reviews/tests/test_models.py | Python | bsd-3-clause | 4,623 |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from parlai.core.agents im... | calee88/ParlAI | parlai/agents/rnn_baselines/seq2seq.py | Python | bsd-3-clause | 10,385 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This software is under a BSD license. See LICENSE.txt for details.
from datatank_py.DTStructuredGrid2D import DTStructuredGrid2D, _squeeze2d
import numpy as np
class DTStructuredMesh2D(object):
"""2D structured mesh object.
This class corresponds to DataT... | amaxwell/datatank_py | datatank_py/DTStructuredMesh2D.py | Python | bsd-3-clause | 4,176 |
#: one
x = 1
print(x)
import time
time.sleep(10)
#: two
#x = 2
print(x)
| lemon24/intercessor | examples/book.py | Python | bsd-3-clause | 78 |
import errno
import os
import shutil
def mkdir(path, mode=0o777, exist_ok=False):
try:
os.mkdir(path, mode)
except OSError as e:
if not exist_ok or e.errno != errno.EEXIST or not os.path.isdir(path):
raise
def makedirs(path, mode=0o777, exist_ok=False):
try:
os.makedi... | jimporter/doppel | doppel/__init__.py | Python | bsd-3-clause | 1,483 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.core.urlresolvers import reverse
from vkontakte_api.admin import VkontakteModelAdmin
from .models import Album, Video
class VideoInline(admin.TabularInline):
def image(self, instance):
return '<img src="%s" />' % (instance.photo_130,)
... | ramusus/django-vkontakte-video | vkontakte_video/admin.py | Python | bsd-3-clause | 1,566 |
"""
This scripts compares the autocorrelation in statsmodels with
the one that you can build using only correlate.
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as signal
import statsmodels.api as sm
from signals.time_series_class import MixAr, AR
from signals.aux_functions import sidekick... | h-mayorquin/time_series_basic | examples/auto_correlations_compare.py | Python | bsd-3-clause | 1,897 |
import os.path
from flask import url_for
from npactflask import app
# TODO: I think this is more simply a template_global:
# http://flask.pocoo.org/docs/0.10/api/#flask.Flask.template_global
@app.context_processor
def vSTATIC():
def STATICV(filename):
if app.config['DEBUG']:
vnum = os.path.... | victor-lin/npact | npactflask/npactflask/helpers.py | Python | bsd-3-clause | 525 |
from toyz.web import app
from toyz.web import tasks | fred3m/toyz | toyz/web/__init__.py | Python | bsd-3-clause | 51 |
from StringIO import StringIO
from django.test import TestCase
from django.test.client import Client
from corehq.apps.app_manager.models import Application, APP_V1, Module
from corehq.apps.app_manager.success_message import SuccessMessage
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.users.mod... | gmimano/commcaretest | corehq/apps/app_manager/tests/test_success_message.py | Python | bsd-3-clause | 3,754 |
from django import forms
from oldcontrib.media.document.models import Document
class DocumentUpload(forms.ModelForm):
class Meta:
model = Document
fields = ('document',) | servee/django-servee-oldcontrib | oldcontrib/media/document/forms.py | Python | bsd-3-clause | 190 |
#!/usr/bin/env python
from setuptools import setup, Extension
setup(
name = "python-libmemcached",
version = "0.17.0",
description="python memcached client wrapped on libmemcached",
maintainer="subdragon",
maintainer_email="subdragon@gmail.com",
requires = ['pyrex'],
# This assumes that lib... | k0001/python-libmemcached | setup.py | Python | bsd-3-clause | 517 |
#
# init_lib.py
#
# functions for initialization
#
from aws_lib import SpinupError
import base64
from boto import vpc, ec2
from os import environ
from pprint import pprint
import re
import sys
import time
from yaml_lib import yaml_attr
def read_user_data( fn ):
"""
Given a filename, returns the file's co... | smithfarm/ceph-auto-aws | susecon2015/init_lib.py | Python | bsd-3-clause | 9,277 |
#!/usr/bin/env python
import sys
import os
import re
def setup_python3():
# Taken from "distribute" setup.py
from distutils.filelist import FileList
from distutils import dir_util, file_util, util, log
from os.path import join, exists
tmp_src = join("build", "src")
# Not covered by "setup.py ... | lrowe/rdflib | setup.py | Python | bsd-3-clause | 5,590 |
try:
from primitives import Mem
except ImportError:
from mem import Mem
import sys
if sys.version >= '3':
xrange = range
class MMU():
def __init__(self, mem, size=0):
""" Initialize MMU
"""
self._enabled = False
self._mem = mem
self._wordsize = 4
self._t... | jroivas/cpus | primitives/mmu.py | Python | bsd-3-clause | 23,832 |
"""
pyfire.contact
~~~~~~~~~~
Handles Contact ("roster item") interpretation as per RFC-6121
:copyright: 2011 by the pyfire Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import xml.etree.ElementTree as ET
from sqlalchemy import Table, Column, Boolean, Integ... | IgnitedAndExploded/pyfire | pyfire/contact.py | Python | bsd-3-clause | 3,814 |
# -*- coding: utf-8 -*-
#
# example_project documentation build configuration file, created by
# sphinx-quickstart on Wed Aug 19 10:27:46 2009.
#
# 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
# autogenerated file.... | bkonkle/chef-cookbooks | example_project/docs/conf.py | Python | bsd-3-clause | 6,394 |
# -*- coding: utf-8 -*-
# Copyright 2013 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import os
import unittest
import sys
from splinter import Browser
from .base import BaseBrowserTests
from .fake_webapp import EXAMPLE_A... | bmcculley/splinter | tests/test_zopetestbrowser.py | Python | bsd-3-clause | 5,355 |
#-*- coding: utf-8 -*-
from decimal import Decimal
from shop.cart.cart_modifiers_base import BaseCartModifier
class TextOptionsOptionsCartModifier(BaseCartModifier):
'''
This modifier adds an extra field to the cart to let the lineitem "know"
about product options and their respective price.
'''
d... | jrief/django-shop-productvariations | shop_textoptions/cart_modifier.py | Python | bsd-3-clause | 1,084 |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('My Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
import tempfile, os
from django import contrib
tempdata = tempfile.mkdtemp()
approot = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
adminroot = os.path.join(contrib.__path__[0], 'admin')
DATAB... | fish2000/django-signalqueue | signalqueue/settings/__init__.py | Python | bsd-3-clause | 4,884 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name='pfile-tools',
version='0.5.0',
author='Nathan Vack',
author_email='njvack@wisc.edu',
license='BSD License',
url='https://github.com/njvack/pfile-tools',
packages=['pfile_tools'],
entry_points={
... | njvack/pfile-tools | setup.py | Python | bsd-3-clause | 1,098 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | stonebig/bokeh | bokeh/core/tests/test_enums.py | Python | bsd-3-clause | 10,191 |
"""
Methods for exporting mediawiki pages & images to a dokuwiki data/ directory.
Tested with Dokuwiki 2014-05-05 "Ponder Stibbons".
Copyright (C) 2014 Angus Gratton
Licensed under New BSD License as described in the file LICENSE.
"""
from __future__ import print_function, unicode_literals, absolute_import, division
... | lordofbikes/yamdwe | dokuwiki.py | Python | bsd-3-clause | 10,121 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import logging
log = logging.getLogger(__name__)
from .trajectories import Trajectories
try: # pragma: no cover
from . import draw
__a... | bnoi/scikit-tracker | sktracker/trajectories/__init__.py | Python | bsd-3-clause | 533 |
from setuptools import setup
import os
execfile(os.path.join('sheetsync','version.py'))
with open('README.rst') as fh:
long_description = fh.read()
with open('requirements.txt') as fh:
requirements = [line.strip() for line in fh.readlines()]
setup(
name='sheetsync',
version=__version__,
descript... | mbrenig/SheetSync | setup.py | Python | mit | 800 |
from django.db.models import manager
from .query import QuerySet
__all__ = 'Manager',
class Manager(manager.Manager.from_queryset(QuerySet)):
use_for_related_fields = True
use_in_migrations = True
| jdzero/foundation | foundation/models/manager.py | Python | mit | 209 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [... | CharlesGust/django-imagr | imagr_site/imagr_app/migrations/0001_initial.py | Python | mit | 5,413 |
#### 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 = Building()
result.template = "object/building/poi/shared_endor_ewok_medium4.iff"
result.attribute_template_id = -... | obi-two/Rebelion | data/scripts/templates/object/building/poi/shared_endor_ewok_medium4.py | Python | mit | 449 |
# Copyright (c) 2014 Museum Victoria
# This software is released under the MIT license (see license.txt for details)
from Queue import *
import threading
import atexit
remote_action_PowerOn = RemoteAction()
remote_action_PowerOff = RemoteAction()
remote_action_SetInput = RemoteAction()
def local_action_activate(x = ... | museumsvictoria/nodel-recipes | (retired)/pjlinkqueue/script.py | Python | mit | 1,588 |
'''The Example from Huang and Darwiche's Procedural Guide'''
from __future__ import division
from bayesian.factor_graph import *
from bayesian.utils import make_key
def f_a(a):
return 1 / 2
def f_b(a, b):
tt = dict(
tt=0.5,
ft=0.4,
tf=0.5,
ff=0.6)
return tt[make_key(a, b)... | kamijawa/ogc_server | bayesian/examples/factor_graphs/huang_darwiche.py | Python | mit | 1,341 |
def plotLearningCurve(Xtrn, Ytrn, model, param_name, param_range):
'''
Plot the bias/variance tradeoff for a given model. This curve is
the training and test error (via split) of the model as a function
of model complexity.
Wrapper for validation_curve in sklearn.
---
I:
O: Plot of the... | mattdelhey/kaggle-galaxy | plotBiasVarTradeoff.py | Python | mit | 564 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from sqlalchemy.ext.declarative import declared_attr
from indico... | mvidalgarcia/indico | indico/core/db/sqlalchemy/review_comments.py | Python | mit | 2,710 |
"""blah."""
from pyiem.util import get_dbconn
pgconn = get_dbconn("idep")
cursor = pgconn.cursor()
cursor.execute(
"""
SELECT r.hs_id, r.huc_12, p.fpath, extract(year from valid) as yr,
sum(runoff) as sum_runoff,
sum(loss) as sum_loss, sum(delivery) as sum_delivery from
results r JOIN flowpaths p on (r.hs... | akrherz/idep | scripts/convergence/dump_results.py | Python | mit | 656 |
import functools
import sys
import traceback
from stacked import Stacked
from .xtraceback import XTraceback
class TracebackCompat(Stacked):
"""
A context manager that patches the stdlib traceback module
Functions in the traceback module that exist as a method of this class are
replaced with equival... | g2p/xtraceback | xtraceback/tracebackcompat.py | Python | mit | 3,453 |
import urllib2, json, time, sys
from datetime import date, datetime
from dateutil.rrule import rrule, DAILY
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-f", dest="fahrenheit", action="store", default=False, type="string", help="Convert to FAHRENHEIT")
parser.add_option("-e", dest="end"... | heatseeknyc/data-science | src/wunderground.py | Python | mit | 2,014 |
# Copyright (c) 2014 Katsuya Noguchi
#
# 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, merge, publish, dis... | DavidHHShao/slack | tests/unit/http_client/test_raise_error.py | Python | mit | 3,437 |
#ImportModules
import ShareYourSystem as SYS
#define and get two children
MyParenter=SYS.ParenterClass(
).array(
[
['-Layers'],
['|First','|Second'],
['-Neurons'],
['|E','|I']
]
).command(
'+-.values+|.values',
'#call:parent',
_AfterWalkRigidBool=True
).command(
'+-.values+|.values',
{
... | Ledoux/ShareYourSystem | Pythonlogy/build/lib/ShareYourSystem/Standards/Itemizers/Parenter/07_ExampleDoc.py | Python | mit | 959 |
import numpy
import chainer
from chainer import backend
from chainer import configuration
import chainer.functions as F
from chainer import link_hook
import chainer.links as L
from chainer import variable
import chainerx
from chainerx import _fallback_workarounds as fallback
def l2normalize(xp, v, eps):
"""Norma... | keisuke-umezawa/chainer | chainer/link_hooks/spectral_normalization.py | Python | mit | 11,583 |
from SimpleTCPClient import SimpleTCPClient
from SimpleTCPClientException import HTTPError, URLError
__all__ = [SimpleTCPClient, HTTPError, URLError] | umairghani/py-jrpc | jrpc/jrpcClient/__init__.py | Python | mit | 150 |
import sys as _sys
import ast as _ast
from ast import boolop, cmpop, excepthandler, expr, expr_context, operator
from ast import slice, stmt, unaryop, mod, AST
def _make_node(Name, Fields, Attributes, Bases):
def create_node(self, *args, **kwargs):
nbparam = len(args) + len(kwargs)
assert nbparam ... | ryfeus/lambda-packs | Tensorflow_Pandas_Numpy/source3.6/gast/gast.py | Python | mit | 9,289 |
# Invert gray image
import cv2
from . import print_image
from . import plot_image
def invert(img, device, debug=None):
"""Inverts grayscale images.
Inputs:
img = image object, grayscale
device = device number. Used to count steps in the pipeline
debug = None, print, or plot. Print = save ... | AntonSax/plantcv | plantcv/invert.py | Python | mit | 794 |
def token_encryption_algorithm():
return 'HS256' | aaivazis/nautilus | nautilus/auth/util/token_encryption_algorithm.py | Python | mit | 52 |
import re
import quantities as pq
from numbers import NumberService
class ConversionService(object):
__exponents__ = {
'square': 2,
'squared': 2,
'cubed': 3
}
def _preprocess(self, input):
def handleExponents(input):
m = re.search(r'\bsquare (\w+)', input)
... | jobdash/semantic | semantic/units.py | Python | mit | 4,744 |