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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.views.i18n import javascript_catalog
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtailcore import urls as wagtail_urls
from privagal.cor... | ychab/privagal | privagal/urls.py | Python | bsd-3-clause | 689 |
import re
import random
import hashlib
from django.db import models
SHA1_RE = re.compile('^[a-f0-9]{40}$')
class RegistrationManager(models.Manager):
"""Custom manager for the ``RegistrationProfile`` model.
The methods defined here provide shortcuts for account creation
and activation (including generati... | bruth/django-registration2 | registration/managers.py | Python | bsd-3-clause | 1,879 |
from django.conf import settings
from csp.utils import build_policy
class CSPMiddleware(object):
"""
Implements the X-Content-Security-Policy response header, which
conforming user-agents can use to restrict the permitted sources
of various content.
See https://wiki.mozilla.org/Security/CSP/Spec... | jsocol/django-csp | csp/middleware.py | Python | bsd-3-clause | 1,167 |
# Copyright (c) 2006-2007 The Regents of The University of Michigan
# Copyright (c) 2009 Advanced Micro Devices, 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 co... | ayoubg/gem5-graphics | gem5/configs/ruby/MI_example.py | Python | bsd-3-clause | 8,604 |
# proxy module
from traitsui.qt4.ui_live import *
| enthought/etsproxy | enthought/traits/ui/qt4/ui_live.py | Python | bsd-3-clause | 50 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | bokeh/bokeh | tests/unit/bokeh/model/test_model.py | Python | bsd-3-clause | 9,709 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by ExopyHqcLegacy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ------... | Ecpy/ecpy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/anritsu_signal_source.py | Python | bsd-3-clause | 5,187 |
from __future__ import unicode_literals
import json
import mimetypes
import os
import re
import sys
from copy import copy
from importlib import import_module
from io import BytesIO
from django.conf import settings
from django.core.handlers.base import BaseHandler
from django.core.handlers.wsgi import ISO_8859_1, UTF_... | filias/django | django/test/client.py | Python | bsd-3-clause | 27,179 |
from __future__ import division
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The American Gut Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# --------... | biocore/american-gut-web | amgut/lib/data_access/ag_data_access.py | Python | bsd-3-clause | 57,541 |
# coding: utf-8
from django.db import models
from django.utils.translation import ugettext_lazy as _, pgettext_lazy
class ContentBase(models.Model):
"""
Base class for models that share content attributes
The attributes added by this mixin are ``title``, ``description``,
``content`` and ``is_visible`... | artscoop/django-basemix | basemix/mixins/content/content.py | Python | bsd-3-clause | 1,190 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("RidgeClassifier" , "FourClass_100" , "oracle")
| antoinecarme/sklearn2sql_heroku | tests/classification/FourClass_100/ws_FourClass_100_RidgeClassifier_oracle_code_gen.py | Python | bsd-3-clause | 144 |
#!/usr/bin/env python
"""Dump instances for bunny, in Promela and SlugsIn."""
import argparse
import itertools
import pprint
import logging
import re
from tugs import utils
log = logging.getLogger(__name__)
INPUT_FILE = 'bunny.pml'
PROMELA_PATH = 'pml/bunny_many_goals_{i}.txt'
SLUGSIN_PATH = 'slugsin/bunny_many_goals... | johnyf/gr1experiments | examples/bunny_many_goals/make_instances.py | Python | bsd-3-clause | 2,595 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Business logic - gets request in from Slack, does stuff, sends requests back to Slack.
Notes for developers who want to add or change functionality: You're in the right module.
* If you were to run this behind a server (Flask would work well) instead of behind AWS ... | hangtwenty/yobot | yobot/slack_logic.py | Python | bsd-3-clause | 12,877 |
import sys, Tkinter, tkFont, ttk
sys.path.insert(0, "./src/")
import button, database
from config import *
# Note: need to set size for bg_canvas here; otherwise it will grow disregard the size set while created!
def AuxscrollFunction(event):
bg_canvas.configure(scrollregion=bg_canvas.bbox("all"), height=THUMB_HEI... | ybdarrenwang/DuplicatedPhotoFinder | main.py | Python | bsd-3-clause | 2,866 |
# coding=utf-8
import numpy as np
import bs
t = bs.common_types.table ()
n_rows = 10
n_cols = 5
t.init (n_rows, n_cols);
for i in xrange (n_cols):
t.set_col_name (i, "Col " + str (i))
a = np.linspace (float (i), float (i + 1), n_rows)
t.set_col_values (i, a)
print t
| bs-eagle/bs-eagle | common_types/python/table_test.py | Python | bsd-3-clause | 279 |
from microscopes.mixture.definition import model_definition
from microscopes.models import bb, niw
from nose.tools import (
assert_equals,
assert_is_not,
)
import pickle
import copy
def test_model_definition_pickle():
defn = model_definition(10, [bb, niw(3)])
bstr = pickle.dumps(defn)
defn1 = pic... | datamicroscopes/mixturemodel | test/test_definition.py | Python | bsd-3-clause | 893 |
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'users'
verbose_name = "Usuarios" | flipjack/tecnoservicio | tecnoservicio/ordenes/apps.py | Python | bsd-3-clause | 113 |
SECRET_KEY = 'not-anymore'
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = False
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
INSTALLED_APPS = [
'reverse_unique',
'reverse_unique_tests',
]
| akaariai/django-reverse-unique | reverse_unique_tests/settings.py | Python | bsd-3-clause | 277 |
#!/usr/bin/env python
"""
Hiveary
https://hiveary.com
Licensed under Simplified BSD License (see LICENSE)
(C) Hiveary, Inc. 2013-2014 all rights reserved
"""
import platform
import sys
from hiveary import __version__ as version
current_platform = platform.system()
FROZEN_NAME = 'hiveary-agent'
AUTHOR = "Hiveary"... | hiveary/hiveary-agent | setup.py | Python | bsd-3-clause | 3,550 |
def extractToomtummootstranslationsWordpressCom(item):
'''
Parser for 'toomtummootstranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractToomtummootstranslationsWordpressCom.py | Python | bsd-3-clause | 588 |
# Copyright (c) 2015, Intel Corporation
# 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 condit... | ii0/bits | python/einj.py | Python | bsd-3-clause | 23,447 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import inspect
import itertools
import random
import warnings
import numpy as np
from .gd import GradientDescent
from .bfgs import Lbfgs
from .cg import NonlinearConjugateGradient
from .rprop import Rprop
from .rmsprop import RmsProp
from .adadelta impo... | gabobert/climin | climin/util.py | Python | bsd-3-clause | 11,486 |
#!/usr/bin/env python
# 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.
# Copyright (C) 2008 Evan Martin <martine@danga.com>
"""A git-command for integrating reviews on Rietveld."""
from distutils.vers... | xuyuhan/depot_tools | git_cl.py | Python | bsd-3-clause | 106,464 |
# -----------------------------------------------------------------------------
# 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.
# ------------------------------------------------... | squirrelo/qiita | qiita_ware/commands.py | Python | bsd-3-clause | 8,365 |
import base64, re, traceback, os, string, subprocess
from prompt_toolkit import PromptSession
from prompt_toolkit.history import FileHistory
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
from prompt_toolkit.styles import Style
from poshc2.client.Alias import cs_alias, cs_replace
from poshc2.Colours im... | nettitude/PoshC2 | poshc2/client/command_handlers/SharpHandler.py | Python | bsd-3-clause | 21,566 |
"""Grabber for collecting data"""
import urllib2
from random import sample
from veliberator.settings import PROXY_SERVERS
class Grabber(object):
"""Url encapsultation for making request throught HTTP"""
page = None
data = None
def __init__(self, url, proxies=PROXY_SERVERS):
"""Init the grabb... | Fantomas42/veliberator | veliberator/grabber.py | Python | bsd-3-clause | 1,041 |
import os
import numpy as np
import torch
from ..core import FaceDetector
class FolderDetector(FaceDetector):
'''This is a simple helper module that assumes the faces were detected already
(either previously or are provided as ground truth).
The class expects to find the bounding boxe... | 1adrianb/face-alignment | face_alignment/detection/folder/folder_detector.py | Python | bsd-3-clause | 1,643 |
'''
This mission is the part of the set. Another one - Caesar cipher decriptor.
Your mission is to encrypt a secret message (text only, without special chars like "!", "&", "?" etc.) using Caesar cipher where each letter of input text is replaced by another that stands at a fixed distance. For example ("a b c", 3) ==... | lisprolog/python | to_encrypt.py | Python | bsd-3-clause | 1,378 |
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from threading import local
USER_ATTR_NAME = getattr(settings, 'LOCAL_USER_ATTR_NAME', '_current_user')
_thread_locals = local()
def _do_set_current_user(user_fun):
setattr(_thread_locals, USER_ATTR_NAME, user_fun.__get__(user... | PaesslerAG/django-currentuser | django_currentuser/middleware.py | Python | bsd-3-clause | 1,343 |
from __future__ import absolute_import
import os
import zmq
import uuid as uuid_pkg
import time
import binascii
import random
import socket
import struct
import marshal
import mmap
from multiprocessing import Manager, Condition
from mmap import ACCESS_WRITE, ACCESS_READ
from dpark.utils.log import get_logger
from dpar... | douban/dpark | dpark/broadcast.py | Python | bsd-3-clause | 24,223 |
###############################################################################
# Copyright 2014 Enthought, Inc.
###############################################################################
from traits.adaptation.api import reset_global_adaptation_manager
from traits.api import HasTraits, Instance, List, register_f... | burnpanck/traits | traits/tests/test_automatic_adaptation.py | Python | bsd-3-clause | 2,338 |
"""
Base class for ensemble-based estimators.
"""
# Authors: Gilles Louppe
# License: BSD 3 clause
import multiprocessing
import numpy as np
from ..base import clone
from ..base import BaseEstimator
from ..base import MetaEstimatorMixin
class BaseEnsemble(BaseEstimator, MetaEstimatorMixin):
"""Base class for al... | psarka/uplift | uplift/ensemble/base.py | Python | bsd-3-clause | 4,748 |
"""
Batch processors
These commands implements the 'batch-command' and 'batch-code'
processors, using the functionality in src.utils.batchprocessors.
They allow for offline world-building.
Batch-command is the simpler system. This reads a file (*.ev)
containing a list of in-game commands and executes them in sequence... | TaliesinSkye/evennia | src/commands/default/batchprocess.py | Python | bsd-3-clause | 24,488 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, OneLogin, Inc.
# All rights reserved.
from base64 import b64decode
import json
from lxml import etree
from os.path import dirname, join, exists
import unittest
from xml.dom.minidom import parseString
from onelogin.saml2 import compat
from onelogin.saml2.constants import ... | pitbulk/python3-saml | tests/src/OneLogin/saml2_tests/utils_test.py | Python | bsd-3-clause | 40,950 |
# -*- coding: utf-8 -*-
"""
analytics.models
Models for Demand and Supply data
:copyright: (c) 2013 by Openlabs Technologies & Consulting (P) Limited
:license: see LICENSE for more details.
"""
import operator
from django.db import models
import django.contrib.admin
from admin.models import Occupati... | arpitprogressive/arpittest | apps/analytics/models.py | Python | bsd-3-clause | 14,238 |
# Copyright (c) 2010, Florian Ludwig <dino@phidev.org>
# see LICENSE
"""Helpers for code generation based on genshi [0]
There are good code generator tools out there like cog [1].
But if you already use genshi in your project this module might
help you integrating code generation into your build and
deploy process us... | FlorianLudwig/python-yawp | yawp/template.py | Python | bsd-3-clause | 4,325 |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import *
import json
import bson.json_util as bju
import emission.core.get_database as... | sunil07t/e-mission-server | bin/debug/load_timeline_for_day_and_user.py | Python | bsd-3-clause | 1,612 |
def extractSpearpointtranslationsHomeBlog(item):
'''
Parser for 'spearpointtranslations.home.blog'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Record of the Missing Sect Master', 'Reco... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractSpearpointtranslationsHomeBlog.py | Python | bsd-3-clause | 692 |
"""
Dynamic factor model
Author: Chad Fulton
License: Simplified-BSD
"""
from __future__ import division, absolute_import, print_function
from warnings import warn
from statsmodels.compat.collections import OrderedDict
import numpy as np
import pandas as pd
from .kalman_filter import KalmanFilter, FilterResults
from... | phobson/statsmodels | statsmodels/tsa/statespace/dynamic_factor.py | Python | bsd-3-clause | 57,954 |
#!/usr/bin/env python3
import os
import sys
thispath = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(os.path.dirname(thispath),"helper"))
from MiscFxns import *
from StandardModules import *
import pulsar_psi4
def ApplyBasis(syst,bsname,bslabel="primary"):
return psr.system.apply_si... | pulsar-chem/Pulsar-Core | test/old/Old2/modules/CP.py | Python | bsd-3-clause | 2,969 |
import unittest
from pecan_swagger import utils
class TestUtils(unittest.TestCase):
def test_swagger_build(self):
from .resources import example_app
expected = {
"swagger": "2.0",
"info": {
"version": "1.0",
"title": "example_app"
... | shu-mutou/pecan-swagger | tests/test_utils.py | Python | bsd-3-clause | 10,382 |
# Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project
# All rights reserved.
#
# This file is part of NeuroM <https://github.com/BlueBrain/NeuroM>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... | eleftherioszisis/NeuroM | neurom/fst/_neuronfunc.py | Python | bsd-3-clause | 10,088 |
import collections
import json as jsonlib
import os
import random
import re
from operator import attrgetter
from urlparse import urljoin
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.forms import CheckboxInput
from django.template import defaultfilters, loader
from... | lavish205/olympia | src/olympia/amo/templatetags/jinja_helpers.py | Python | bsd-3-clause | 19,484 |
from django.db import models
from django.contrib.auth.models import User
class OdooUser(models.Model):
user = models.OneToOneField(User)
odoo_id = models.BigIntegerField(primary_key=True)
username = models.CharField(max_length=256)
| JulienDrecq/django-odoo-auth | odoo_auth/models.py | Python | bsd-3-clause | 246 |
import pytest
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from mock import MagicMock, Mock
from prices import Price
from saleor.checkout import views
from saleor.checkout.core import STORAGE_SESSION_KEY, Checkout
from saleor.shipping.models import ShippingMethodCountry
from sa... | rodrigozn/CW-Shop | tests/test_checkout.py | Python | bsd-3-clause | 7,657 |
from __future__ import absolute_import
from django.core.files.base import ContentFile
from sentry.models import File, FileBlob
from sentry.testutils import TestCase
class FileBlobTest(TestCase):
def test_from_file(self):
fileobj = ContentFile("foo bar")
my_file1 = FileBlob.from_file(fileobj)
... | mitsuhiko/sentry | tests/sentry/models/test_file.py | Python | bsd-3-clause | 1,674 |
from django.test import TestCase
from django.urls import reverse
from .utils import add_default_data
from petition.models import PytitionUser, Permission, Organization, Petition
class DelSlugViewTest(TestCase):
"""Test del_slug view"""
@classmethod
def setUpTestData(cls):
add_default_data()
... | fallen/Pytition | pytition/petition/tests/tests_DelSlugView.py | Python | bsd-3-clause | 1,208 |
from django.views.generic import ListView, DetailView
from django.core.exceptions import ObjectDoesNotExist
from competition.models.competition_model import Competition
class CompetitionListView(ListView):
"""Lists every single competition"""
context_object_name = 'competitions'
model = Competition
t... | michaelwisely/django-competition | src/competition/views/competition_views.py | Python | bsd-3-clause | 1,178 |
## Absolute location where all raw files are
RAWDATA_DIR = '/home/cmb-06/as/skchoudh/dna/Oct_10_2016_HuR_Human_Mouse_Liver/rna-seq/Penalva_L_08182016/human'
## Output directory
OUT_DIR = '/staging/as/skchoudh/Oct_10_2016_HuR_Human_Mouse_Liver/RNA-Seq_human'
## Absolute location to 're-ribo/scripts' directory
SRC_... | saketkc/ribo-seq-snakemake | configs/Oct_10_2016_HuR_Human_rna.py | Python | bsd-3-clause | 2,343 |
"""
Tests for django-registration's built-in views.
"""
from django.core.urlresolvers import reverse
from django.test import override_settings, TestCase
from ..models import RegistrationProfile
@override_settings(ROOT_URLCONF='registration.tests.urls')
class ActivationViewTests(TestCase):
"""
Tests for asp... | tdruez/django-registration | registration/tests/test_views.py | Python | bsd-3-clause | 1,271 |
from __future__ import absolute_import
import six
import pytest
import base64
from sentry.utils.compat import mock
from exam import fixture
from six.moves.urllib.parse import urlencode, urlparse, parse_qs
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models
from ... | beeftornado/sentry | tests/sentry/web/frontend/test_auth_saml2.py | Python | bsd-3-clause | 6,945 |
"""
A script for testing / benchmarking HMM Implementations
"""
import argparse
import collections
import logging
import time
import hmmlearn.hmm
import numpy as np
import sklearn.base
LOG = logging.getLogger(__file__)
class Benchmark:
def __init__(self, repeat, n_iter, verbose):
self.repeat = repeat... | hmmlearn/hmmlearn | scripts/benchmark.py | Python | bsd-3-clause | 8,715 |
# Copyright (c) 2006-2007 The Regents of The University of Michigan
# 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 ... | lastweek/gem5 | tests/configs/tsunami-simple-timing-dual.py | Python | bsd-3-clause | 3,357 |
#!/usr/bin/env python
import os
import json
class TermiteCore:
def __init__( self, request, response ):
self.request = request
self.response = response
def GetConfigs( self ):
def GetServer():
return self.request.env['HTTP_HOST']
def GetDataset():
return self.request.application
def GetModel... | jyt109/termite-data-server | server_src/modules/core.py | Python | bsd-3-clause | 4,206 |
from .common import * # noqa
LANGUAGE_CODE = 'nb'
| devilry/trix2 | trix/project/develop/settings/develop.py | Python | bsd-3-clause | 57 |
# -*- coding: utf-8 -*-
import base64
import inspect
import json
import logging
import requests
import types
from django.conf import settings
from django.core.management import call_command
from django_nose import FastFixtureTestCase
from functools import wraps
from mock import patch
from tastypie.test import Resource... | nk113/tastypie-rpc-proxy | rpc_proxy/test.py | Python | bsd-3-clause | 3,241 |
from hq.models import Domain
from xformmanager.models import FormDataColumn, FormDataGroup, FormDataPointer
from xformmanager.manager import *
from xformmanager.storageutility import StorageUtility
from receiver.models import Submission, Attachment
from receiver.tests.util import *
import logging
def clear_data():
... | commtrack/commtrack-old-to-del | apps/xformmanager/tests/util.py | Python | bsd-3-clause | 2,666 |
# -*- coding: utf-8 -*-
from expects import expect
from mamba import describe, context, before
from spec.ui._ipod_helpers import *
from spec.ui._fixture import update_environment
with describe('ipodio playlist create') as _:
@before.all
def setup_all():
_.new_name = 'leño'
_.playlist_name =... | jvrsantacruz/ipodio | spec/ui/playlist_rename_spec.py | Python | bsd-3-clause | 1,953 |
from datetime import datetime, timedelta
from itertools import chain, cycle
from django.shortcuts import render_to_response
from django.utils.translation import ugettext, ugettext_lazy as _
from django.http import HttpResponseRedirect, Http404
from django import forms
from django.views.decorators.http import require_P... | ella/ella-polls | ella_polls/views.py | Python | bsd-3-clause | 18,977 |
import datetime
from decimal import Decimal
from django.utils import translation
import mock
from nose.tools import eq_, ok_
import amo
import amo.tests
from addons.models import Addon, AddonUser
from constants.payments import PROVIDER_BANGO, PROVIDER_BOKU
from market.models import AddonPremium, Price, PriceCurrency... | jinankjain/zamboni | apps/market/tests/test_models.py | Python | bsd-3-clause | 16,762 |
from neon.transforms.cost import Cost
class MulticlsSVMLoss(Cost):
def __init__(self, delta=1.):
self.delta = delta
def __call__(self, y, t):
T = self.be.empty_like(y)
T[:] = self.be.max(y * t, axis=0)
# T = self.be.array(self.be.max(y * t, axis=0).asnumpyarray(), y.shape[0], ... | cs-chan/fuzzyDCN | prune_neon/transformation/cost.py | Python | bsd-3-clause | 979 |
from unittest import mock
from taskplus.core.actions import GetRoleDetailsAction, GetRoleDetailsRequest
from taskplus.core.domain import UserRole
from taskplus.core.shared.response import ResponseFailure
def test_get_role_details_action():
role = mock.Mock()
role = UserRole(name='admin', id=1)
roles_repo... | Himon-SYNCRAFT/taskplus | tests/core/actions/get_role_details/test_get_role_details_action.py | Python | bsd-3-clause | 2,317 |
import math
import net
SIGMOID = 0
TANH = 1
class bp:
def __init__(self, net, learning_rate, momentum):
self.type = net.getType()
self.net = net
self.lr = learning_rate
self.m = momentum
self.layer = net.getLayer()
self.lc = [[[0]*max(self.layer)]*max(self.layer)]*len(self.layer)
def _dfu... | bongtrop/cilab-python | ann/bp.py | Python | bsd-3-clause | 1,933 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The freesurfer module provides basic functions for interfacing with
freesurfer tools.
Currently these tools are supported:
* Dicom2Nifti: using mri_convert
* Resample: using mri_convert
Exam... | dgellis90/nipype | nipype/interfaces/freesurfer/base.py | Python | bsd-3-clause | 6,473 |
'''@file standard_trainer.py
contains the StandardTrainer'''
from nabu.neuralnetworks.trainers import trainer
class StandardTrainer(trainer.Trainer):
'''a trainer with no added functionality'''
def aditional_loss(self):
'''
add an aditional loss
returns:
the aditional los... | vrenkens/nabu | nabu/neuralnetworks/trainers/standard_trainer.py | Python | mit | 844 |
SECRET_KEY = 'fake-key'
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
}
}
INSTALLED_APPS = [
"django_nose",
"tests",
]
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = [
'--with-coverage',
'--cover-package=search_views',
]
| bianchimro/django-search-views | tests/settings.py | Python | mit | 289 |
import _plotly_utils.basevalidators
class TickfontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self, plotly_name="tickfont", parent_name="layout.ternary.aaxis", **kwargs
):
super(TickfontValidator, self).__init__(
plotly_name=plotly_name,
par... | plotly/python-api | packages/python/plotly/plotly/validators/layout/ternary/aaxis/_tickfont.py | Python | mit | 1,549 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('caudexer', '0002_auto_20151107_1409'),
]
operations = [
migrations.AlterField(
model_name='goodreadsdata',
... | hacktm15/caudexer | dexer/caudexer/migrations/0003_auto_20151107_1415.py | Python | mit | 589 |
#!/usr/bin/env python
from ZSI import Binding
MESSAGE = "Hello from Python!"
def main():
binding = Binding(url='http://localhost:8080/server.py')
print ' Sending: %s' % MESSAGE
response = binding.echo(MESSAGE)
print 'Response: %s' % MESSAGE
if __name__ == '__main__':
main()
| acigna/pywez | zsi/doc/examples/client/send_request/simple/Binding/client.py | Python | mit | 301 |
import deepchem as dc
import numpy as np
import sklearn
from sklearn.ensemble import RandomForestClassifier
N = 100
n_feat = 5
n_classes = 3
X = np.random.rand(N, n_feat)
y = np.random.randint(3, size=(N,))
dataset = dc.data.NumpyDataset(X, y)
sklearn_model = RandomForestClassifier(class_weight="balanced", n_estimato... | lilleswing/deepchem | examples/multiclass/multiclass_sklearn.py | Python | mit | 605 |
"""
Support for RESTful binary sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.rest/
"""
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.sensor.rest import RestData... | aoakeson/home-assistant | homeassistant/components/binary_sensor/rest.py | Python | mit | 2,159 |
#!/usr/bin/env python
import sys
args = ' '.join(sys.argv[1:])
print(f"""Deprecated as of commit 959939b771. Use flask utility script instead:
$ flask {args}
""")
raise SystemExit(1)
| betterlife/flask-psi | manage.py | Python | mit | 184 |
# -*- coding: utf-8 -*-
#
# dolphintools documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 12 22:39:14 2015.
#
# 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.
... | nephantes/dolphin-tools | docs/conf.py | Python | mit | 9,231 |
import collections
import numbers
import re
import sqlalchemy as sa
from sqlalchemy.ext import compiler as sa_compiler
from sqlalchemy.sql import expression as sa_expression
# At the time of this implementation, no specification for a session token was
# found. After looking at a few session tokens they appear to be... | solackerman/sqlalchemy-redshift | sqlalchemy_redshift/commands.py | Python | mit | 25,418 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^signin/', views.signin, name='signin'),
url(r'^signout/', views.signout, name='signout'),
url(r'^change_password/', views.change_password, name='change_password'),
] | wasit7/visionmarker | beta/wl_auth/urls.py | Python | mit | 244 |
#!/usr/bin/env python3
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Copyright (c) 2015-2017 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import test_framework.loginit
#
# Test rpc http... | BitcoinUnlimited/BitcoinUnlimited | qa/rpc-tests/httpbasics.py | Python | mit | 4,832 |
import _plotly_utils.basevalidators
class XValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="x", parent_name="isosurface.caps", **kwargs):
super(XValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
data_c... | plotly/python-api | packages/python/plotly/plotly/validators/isosurface/caps/_x.py | Python | mit | 1,178 |
# -*- coding: utf-8 -*-
# http://matplotlib.org/basemap/users/examples.html
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
# create new figure, axes instances.
fig=plt.figure()
ax=fig.add_axes([0.1,0.1,0.8,0.8])
# setup mercator map projection.
m = Basemap(llcrnrlon=0.,llcrn... | sergeimoiseev/othodi_code | old/mpl_msk_spb.py | Python | mit | 1,018 |
# volunteers/urls.py
from django.conf.urls import *
from django.contrib.auth.decorators import login_required
from volunteers.views import *
urlpatterns = patterns('',
#(r'^$', login_required(ShowsInProcessing.as_view()), {}, 'volunteer_show_list'),
#(r'^(?P<show_slug>\[-\w]+)/$', login_required(ShowReview.... | EricSchles/veyepar | dj/volunteers/urls.py | Python | mit | 1,412 |
from . import load_fixture
from lintreview.config import load_config
from lintreview.diff import DiffCollection
from lintreview.review import Review, Problems, Comment
from lintreview.repo import GithubRepository, GithubPullRequest
from mock import Mock, call
from nose.tools import eq_
from github3.issues.comment impor... | zoidbergwill/lint-review | tests/test_review.py | Python | mit | 15,108 |
# Copyright (c) 2009 Canonical Ltd <duncan.mcgreggor@canonical.com>
# Licenced under the txaws licence available at /LICENSE in the txaws source.
from twisted.trial.unittest import TestCase
from txaws.exception import AWSError
from txaws.exception import AWSResponseParseError
from txaws.util import XML
REQUEST_ID =... | lud4ik/txAWS | txaws/tests/test_exception.py | Python | mit | 4,188 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './flowchart/FlowchartTemplate.ui'
#
# Created: Sun Feb 24 19:47:30 2013
# by: pyside-uic 0.2.13 running on PySide 1.1.1
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
class Ui_Form(object):
... | ibressler/pyqtgraph | pyqtgraph/flowchart/FlowchartTemplate_pyside.py | Python | mit | 2,393 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the zapwallettxes functionality.
- start two iopd nodes
- create two transactions on node 0 - one... | Anfauglith/iop-hd | test/functional/zapwallettxes.py | Python | mit | 3,234 |
"""Kytos Napps Module."""
import json
import os
import re
import sys
import tarfile
import urllib
from abc import ABCMeta, abstractmethod
from pathlib import Path
from random import randint
from threading import Event, Thread
from kytos.core.events import KytosEvent
from kytos.core.logs import NAppLog
__all__ = ('Kyt... | kytos/kytos | kytos/core/napps/base.py | Python | mit | 9,959 |
#!/usr/bin/python3
import sqlite3, sys
# It takes one argument: the name of the new database
if (len(sys.argv) < 1):
sys.stderr.write('You need to give the name of the ILI DB\n')
sys.exit(1)
else:
dbfile = sys.argv[1]
################################################################
# CONNECT TO DB
#####... | globalwordnet/OMW | scripts/load-ili-kinds.py | Python | mit | 1,029 |
"""kaxabu URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | Taiwanese-Corpus/kaxabu-muwalak-misa-a-ahan-bizu | 後端/kaxabu/urls.py | Python | mit | 819 |
"""
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
Integers in each row are sorted from left to right.
The first integer of each row is greater than the last integer of the previous row.
For example,
Consider the following matrix:
[
[1... | dominjune/LeetCode | 074 Search a 2D Matrix.py | Python | mit | 1,679 |
from abc import ABCMeta, abstractmethod
from enum import Enum
class InputType(Enum):
ls = 1
dir = 2
unknown = 3
class ParserBase(metaclass=ABCMeta):
def __init__(self, input_text, extensions):
self.input = input_text.splitlines()
self.extensions = extensions
@abstractmethod
... | APMD/PMD | PMD/parser/parsers.py | Python | mit | 2,980 |
"""
Support for an interface to work with a remote instance of Home Assistant.
If a connection error occurs while communicating with the API a
HomeAssistantError will be raised.
For more details about the Python API, please refer to the documentation at
https://home-assistant.io/developers/python_api/
"""
from dateti... | mikaelboman/home-assistant | homeassistant/remote.py | Python | mit | 15,888 |
#### 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 = Intangible()
result.template = "object/draft_schematic/clothing/shared_clothing_ith_backpack_field_06.iff"
result... | anhstudios/swganh | data/scripts/templates/object/draft_schematic/clothing/shared_clothing_ith_backpack_field_06.py | Python | mit | 468 |
#### 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 = Creature()
result.template = "object/mobile/shared_dressed_imperial_officer_m_4.iff"
result.attribute_template_id... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_dressed_imperial_officer_m_4.py | Python | mit | 453 |
# author: Fei Gao
#
# Integer To Roman
#
# Given an integer, convert it to a roman numeral.
# Input is guaranteed to be within the range from 1 to 3999.
class Solution:
# @return a string
def intToRoman(self, n):
roman_numeral_map = (
('M', 1000),
('CM', 900),
('D'... | feigaochn/leetcode | p12_integer_to_roman.py | Python | mit | 1,010 |
from sqlalchemy.testing import eq_, assert_raises, assert_raises_message
import operator
from sqlalchemy import *
from sqlalchemy import exc as sa_exc, util
from sqlalchemy.sql import compiler, table, column
from sqlalchemy.engine import default
from sqlalchemy.orm import *
from sqlalchemy.orm import attributes
from s... | alex/sqlalchemy | test/orm/test_froms.py | Python | mit | 95,771 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - Side by side diffs
@copyright: 2002 Juergen Hermann <jh@web.de>,
2002 Scott Moonen <smoonen@andstuff.org>
@license: GNU GPL, see COPYING for details.
"""
from MoinMoin.support import difflib
from MoinMoin.wikiutil import escape
def i... | Glottotopia/aagd | moin/local/moin/build/lib.linux-x86_64-2.6/MoinMoin/util/diff_html.py | Python | mit | 5,991 |
import platform
def is_windows():
"""Returns true if current platform is windows"""
return any(platform.win32_ver()) | huvermann/MyPiHomeAutomation | HomeAutomation/thingUtils.py | Python | mit | 125 |
from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource,
BLSTMLayer, DimshuffleLayer,
Bidirectio... | mmottahedi/neuralnilm_prototype | scripts/e362.py | Python | mit | 5,901 |
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
from usermgmt import utils
register = template.Library()
@register.filter(is_safe=True)
@stringfilter
def render_attributes(value, autoes... | makyo/honeycomb | usermgmt/templatetags/profile_extras.py | Python | mit | 914 |
import os
import ast
"""
Load the cornell movie dialog corpus.
Available from here:
http://www.cs.cornell.edu/~cristian/Cornell_Movie-Dialogs_Corpus.html
"""
class CornellData:
"""
"""
def __init__(self, dirName):
"""
Args:
dirName (string): directory where to load the corp... | mertyildiran/Dragonfire | dragonfire/deepconv/corpus/cornelldata.py | Python | mit | 2,691 |
# -*- coding: utf-8 -*-
from thumbnails.conf import settings
from thumbnails.engines import DummyEngine
from thumbnails.helpers import get_engine, generate_filename, get_cache_backend
from thumbnails.images import SourceFile, Thumbnail
__version__ = '0.5.1'
def get_thumbnail(original, size, **options):
"""
... | relekang/python-thumbnails | thumbnails/__init__.py | Python | mit | 2,899 |
"""
WSGI config for mords_backend project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | TeppieC/M-ords | mords_backend/mords_backend/wsgi.py | Python | mit | 404 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.