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 |
|---|---|---|---|---|---|
from .flag_button import * | vinoth3v/In | In/flag/form/__init__.py | Python | apache-2.0 | 26 |
#!/usr/bin/env python
# coding: utf-8
# Copyright 2014 The Crashpad Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | atom/crashpad | util/net/http_transport_test_server.py | Python | apache-2.0 | 6,017 |
# Define a custom User class to work with django-social-auth
from django.db import models
from django.contrib.auth.models import User
class Task(models.Model):
name = models.CharField(max_length=200)
owner = models.ForeignKey(User)
finished = models.BooleanField(default=False)
shared ... | kurdd/Oauth | app/models.py | Python | apache-2.0 | 1,109 |
#!/usr/bin/env python
#-*- encoding:utf-8 -*-
import json
from datetime import datetime
from bottle import route, mako_template as template, redirect, request, response, get, post
from bottle import static_file, view #为了不经过controller直接返回诸如html,css等静态文件引入
from model.documents import *
from setting import *
DATE_FORM... | buddyli/android_intership | controller/restaurant_oper.py | Python | apache-2.0 | 2,323 |
# coding=latin-1
from flask import request, g
from flask import abort, flash
from functools import wraps
def checa_permissao(permissao):
def decorator(f):
@wraps(f)
def inner(*args, **kwargs):
if g.user and g.user.checa_permissao(permissao):
return f(*args, *... | dedeco/cnddh-denuncias | cnddh/decorators.py | Python | apache-2.0 | 593 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-04-23 19:37
''' Миграция '''
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
''' Добавляем опциональные поля '''
dependencies = [
('lawe', '0006_remove_account_unit'),
]
operation... | DronMDF/laweb | lawe/migrations/0007_auto_20170423_1937.py | Python | apache-2.0 | 1,029 |
#-
# Copyright (c) 2014 Michael Roe
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# Licensed to BER... | 8l/beri | cheritest/trunk/tests/cp2/test_cp2_x_cincoffset_sealed.py | Python | apache-2.0 | 2,058 |
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | tensorflow/tfx | tfx/orchestration/experimental/kubernetes/examples/taxi_pipeline_kubernetes_test.py | Python | apache-2.0 | 1,478 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | fingeronthebutton/RIDE | src/robotide/lib/robot/libraries/BuiltIn.py | Python | apache-2.0 | 140,502 |
from include import IncludeManager
from django.apps import apps
from django.db import models
from django.utils import timezone
from osf.models.base import BaseModel, ObjectIDMixin
from osf.utils.datetime_aware_jsonfield import DateTimeAwareJSONField
from osf.utils.fields import NonNaiveDateTimeField
from website.util ... | binoculars/osf.io | osf/models/nodelog.py | Python | apache-2.0 | 7,092 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tombstone/models | official/benchmark/transformer_benchmark.py | Python | apache-2.0 | 29,410 |
##
# Copyright (c) 2009-2017 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | macosforge/ccs-calendarserver | twistedcaldav/datafilters/filter.py | Python | apache-2.0 | 3,318 |
#!/usr/bin/env python3
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | chronicle/api-samples-python | feeds/create_azure_ad_context_feed.py | Python | apache-2.0 | 4,356 |
# Copyright (c) 2015, Matt Layman
from ConfigParser import ConfigParser, NoOptionError, NoSectionError
import os
import sys
import requests
API_URL = 'https://www.transifex.com/api/2'
LANGUAGES = [
'es',
'fr',
'it',
'nl',
]
def fetch_po_for(language, username, password):
print 'Downloading po f... | blakev/tappy | transifex.py | Python | bsd-2-clause | 1,750 |
#!/usr/bin/env python
'''
@author Luke C
@date Mon Mar 25 09:57:59 EDT 2013
@file ion/util/stored_values.py
'''
from pyon.core.exception import NotFound
import gevent
class StoredValueManager(object):
def __init__(self, container):
self.store = container.object_store
def stored_value_cas(self, doc_... | ooici/coi-services | ion/util/stored_values.py | Python | bsd-2-clause | 1,331 |
import os
import subprocess
import sys
import threading
try:
os.mkfifo("/tmp/shutdown",0666)
except OSError:
pass
try:
os.mkfifo("/tmp/abort",0666)
except OSError:
pass
subprocess.check_call(["go","build", "-ldflags", "-X main.FALLBACK_SHUTDOWN_PIPE /tmp/shutdown -X main.FALLBACK_ABORT_PIPE /tmp/abort -... | danielrh/repeatexec | build.py | Python | bsd-2-clause | 1,647 |
""" config file for eth tracker feel your keys and secrets here """
""" twilio api """
account_sid = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
auth_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
my_num = "+xxxxxxxxxxx",
twilio_num = "+xxxxxxxx",
""" CEX.IO API is limited to 600 requests per 10 minutes """
username = "xxxxxxxxx"
api... | binary-signal/Ethereum-Tracker | config.py | Python | bsd-2-clause | 614 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "gettingstarted.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) | jessefeinman/FintechHackathon | python-getting-started/manage.py | Python | bsd-2-clause | 256 |
import settings
globals().update(i for i in settings.__dict__.items() if i[0].isupper())
# Require the mezzanine.accounts app. We use settings.INSTALLED_APPS here so
# the syntax test doesn't complain about an undefined name.
if "mezzanine.accounts" not in settings.INSTALLED_APPS:
INSTALLED_APPS = list(settings.I... | damnfine/mezzanine | mezzanine/project_template/test_settings.py | Python | bsd-2-clause | 1,926 |
from os.path import abspath
import sys
import logging
editorconfig_path = abspath('editorconfig-core-py/')
if editorconfig_path not in sys.path:
sys.path.append(editorconfig_path)
from editorconfig import get_properties, EditorConfigError
class EditorConfigPluginMixin(object):
def activate_plugin(self, win... | dublebuble/editorconfig-gedit | editorconfig_plugin/shared.py | Python | bsd-2-clause | 5,356 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.db import models, transaction, DatabaseError
from django.template.defaultfilters import slugify
from django.utils.encoding import python_2_unicode_compatible
from django.utils.functional import cach... | springmerchant/pybbm | pybb/models.py | Python | bsd-2-clause | 17,800 |
# -*- coding: utf-8 -*-
"""
consolor
Copyright (c) 2013-2014, Friedrich Paetzke (f.paetzke@gmail.com)
All rights reserved.
"""
from __future__ import print_function
from consolor import BgColor, Color, get_line
try:
from unittest.mock import call, patch
except ImportError:
from mock import call, patch
def... | paetzke/consolor | tests/test_consolor.py | Python | bsd-2-clause | 3,238 |
#!/usr/bin/env python
from setuptools import setup
try:
import unittest2 # noqa
except ImportError:
test_loader = 'unittest:TestLoader'
else:
test_loader = 'unittest2:TestLoader'
setup(
name='mockldap',
version='0.1.8',
description=u"A simple mock implementation of python-ldap.",
long_d... | coreos/mockldap | setup.py | Python | bsd-2-clause | 1,346 |
from __future__ import print_function, division
import hashlib
from copy import deepcopy
import h5py
import numpy as np
from astropy import log as logger
from ..util.meshgrid import meshgrid_nd
from ..util.functions import FreezableClass, is_numpy_array, monotonically_increasing, link_or_copy, as_str
from .grid_help... | hyperion-rt/hyperion | hyperion/grid/cartesian_grid.py | Python | bsd-2-clause | 19,544 |
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
import streamkinect2.version as meta
# Utility function to read the README file.
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = meta.__project__,
version = meta.__version__,
... | rjw57/streamkinect2 | setup.py | Python | bsd-2-clause | 1,148 |
"""latex.py
Character translation utilities for LaTeX-formatted text.
Usage:
- unicode(string,'latex')
- ustring.decode('latex')
are both available just by letting "import latex" find this file.
- unicode(string,'latex+latin1')
- ustring.decode('latex+latin1')
where latin1 can be replaced by any other known encod... | jterrace/sphinxtr | extensions/natbib/latex_codec.py | Python | bsd-2-clause | 15,250 |
from show_latent import LatentView | mzwiessele/GPyNotebook | GPyNotebook/latent/__init__.py | Python | bsd-2-clause | 34 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from molo.core.models import ArticlePage, ArticlePageRecommendedSections
from wagtail.wagtailcore.blocks import StreamValue
def create_recomended_articles(main_article, article_list):
'''
Creates recommended arti... | praekelt/molo-iogt | iogt/migrations/0003_convert_recomended_articles.py | Python | bsd-2-clause | 2,316 |
import base64
import cPickle as pickle
import datetime
from email import message_from_string
from email.utils import getaddresses
from django import forms
from django.contrib.auth.models import User, Group
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from dja... | melinath/django-kiki | kiki/models.py | Python | bsd-2-clause | 8,088 |
import pygame
# EXPORT
KeyCodes = {
"BACKSPACE": pygame.K_BACKSPACE,
"TAB": pygame.K_TAB,
"CLEAR": pygame.K_CLEAR,
"RETURN": pygame.K_RETURN,
"PAUSE": pygame.K_PAUSE,
"ESCAPE": pygame.K_ESCAPE,
"SPACE": pygame.K_SPACE,
"EXCLAIM": pygame.K_EXCLAIM,
"QUOTEDBL": pygame.K_QUOTEDBL,
... | amirgeva/py2d | engine/keycodes.py | Python | bsd-2-clause | 3,668 |
import sys
# widgets
class Button:
"""
Represents button
Keyword arguments:
text -- button text
| str
onclick -- function invoked after pressing the button
| function: Button -> void
Attributes:
wide -- makes the button wide
"""
def __new__(cl... | klausweiss/python-aui | aui/widgets.py | Python | bsd-2-clause | 4,207 |
# ENVISIoN
#
# Copyright (c) 2019 Jesper Ericsson
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list o... | rartino/ENVISIoN | envisionpy/utils/exceptions.py | Python | bsd-2-clause | 2,304 |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
# --------------------------------------------------------
# R*CNN
# Wri... | gkioxari/RstarCNN | lib/attr_data_layer/layer.py | Python | bsd-2-clause | 5,647 |
from .. import Availability, Class, Constant, Define, Method, Parameter, Type
gx_class = Class('VM',
doc="""
In-memory vector data methods
The :class:`VM` class will store vector (array) data in a memory buffer which
can be accessed using the :class:`... | GeosoftInc/gxapi | spec/core/VM.py | Python | bsd-2-clause | 9,250 |
"""The tower of Hanoi."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def tower_of_hanoi(height, from_pole, to_pole, with_pole, counter):
"""Tower of Hanoi.
Time complexity: T(1) = 1, T(n) = 2T(n - 1) + 1 => O(2^n).
Space complexity: O(1).
... | bowen0701/algorithms_data_structures | alg_tower_of_hanoi.py | Python | bsd-2-clause | 1,320 |
from django.conf.urls.defaults import patterns, include, url
from singlecontrol.views import index, socketio
urlpatterns = patterns('',
url(r'^$', view=index, name='index'),
url(r'^socket\.io', view=socketio, name='socketio'),
)
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns ... | victorpoluceno/python_kinect_socketio | urls.py | Python | bsd-2-clause | 349 |
## @file
# generate capsule
#
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may b... | MattDevo/edk2 | BaseTools/Source/Python/GenFds/Capsule.py | Python | bsd-2-clause | 10,886 |
# Inviwo Python script
import inviwo
inviwo.loadTransferFunction("SimpleRaycaster.transferFunction",inviwo.getDataPath() + "transferfunction.itf")
| sarbi127/inviwo | data/scripts/loadtransferfunction.py | Python | bsd-2-clause | 150 |
import sys
import time
from mpi4py.futures import MPICommExecutor
x0 = -2.0
x1 = +2.0
y0 = -1.5
y1 = +1.5
w = 1600
h = 1200
dx = (x1 - x0) / w
dy = (y1 - y0) / h
def julia(x, y):
c = complex(0, 0.65)
z = complex(x, y)
n = 255
while abs(z) < 3 and n > 1:
z = z**2 + c
n -= 1
retur... | mpi4py/mpi4py | demo/futures/run_julia.py | Python | bsd-2-clause | 1,252 |
"""
The GUI to QCRI.
"""
# pylint: disable=I0011, no-member, missing-docstring
import threading
import logging
from sys import version_info
import pythoncom
from qcri.application import importer
from qcri.application import qualitycenter
# pylint: disable=I0011, import-error
if version_info.major == 2:
import Tki... | douville/qcri | qcri/application/gui.py | Python | bsd-2-clause | 27,582 |
#
# Autogenerated by Thrift
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
from thrift.Thrift import *
from ttypes import *
EDAM_VERSION_MAJOR = 1
EDAM_VERSION_MINOR = 20
| vinodc/evernote | src/evernote/edam/userstore/constants.py | Python | bsd-2-clause | 199 |
from datetime import (
datetime,
timedelta,
)
import re
import numpy as np
import pytest
from pandas import (
Index,
NaT,
Timedelta,
TimedeltaIndex,
Timestamp,
notna,
timedelta_range,
to_timedelta,
)
import pandas._testing as tm
class TestGetItem:
def test_ellipsis(self):... | jorisvandenbossche/pandas | pandas/tests/indexes/timedeltas/test_indexing.py | Python | bsd-3-clause | 12,228 |
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns(
'show.views',
url(r'^radioshow/entrylist/$', 'radioshow_entryitem_list', name='radioshow_entryitem_list'),
url(r'^showcontributor/list/(?P<slug>[\w-]+)/$', 'showcontributor_content_list', name='showcontributor_content_list'),
u... | praekelt/panya-show | show/urls.py | Python | bsd-3-clause | 804 |
from nose.tools import eq_, ok_
from django.test import TestCase
from us_ignite.snippets.models import Snippet
from us_ignite.snippets.tests import fixtures
class TestSnippetModel(TestCase):
def tearDown(self):
Snippet.objects.all().delete()
def get_instance(self):
data = {
'nam... | us-ignite/us_ignite | us_ignite/snippets/tests/models_tests.py | Python | bsd-3-clause | 1,160 |
"""
Tests for line search routines
"""
from __future__ import division, print_function, absolute_import
from numpy.testing import (assert_, assert_equal, assert_array_almost_equal,
assert_array_almost_equal_nulp, assert_warns,
suppress_warnings)
import scipy.optimi... | arokem/scipy | scipy/optimize/tests/test_linesearch.py | Python | bsd-3-clause | 10,206 |
# -*- coding: utf-8 -*-
import webview
"""
This example demonstrates how to localize GUI strings used by pywebview.
"""
if __name__ == '__main__':
localization = {
'global.saveFile': u'Сохранить файл',
'cocoa.menu.about': u'О программе',
'cocoa.menu.services': u'Cлужбы',
'cocoa.me... | r0x0r/pywebview | examples/localization.py | Python | bsd-3-clause | 1,251 |
# Django settings for wireframe project.
import os
PROJECT_DIR = os.path.dirname(__file__)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DAT... | batiste/django-wireframes | example/settings.py | Python | bsd-3-clause | 3,055 |
import numpy as np
from menpo.model import PCAModel
from menpo.visualize import print_progress
def prune(weights, n_retained=50):
w_norm = (weights[:, :n_retained] ** 2).sum(axis=1)
# High weights here suggest problematic samples
bad_to_good_index = np.argsort(w_norm)[::-1]
return w_norm, bad_to_good_... | menpo/lsfm | lsfm/model.py | Python | bsd-3-clause | 968 |
# proxy module
from __future__ import absolute_import
from etsdevtools.developer.tools.vet.class_browser import *
| enthought/etsproxy | enthought/developer/tools/vet/class_browser.py | Python | bsd-3-clause | 114 |
#!/usr/bin/env python
from __future__ import division
from __future__ import print_function
from builtins import input
from builtins import range
from past.utils import old_div
import sys
import numpy
import matplotlib
if matplotlib.get_backend() != "TKAgg":
matplotlib.use("TKAgg")
import pylab
import pmagpy.pmag as... | Caoimhinmg/PmagPy | programs/foldtest.py | Python | bsd-3-clause | 6,056 |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import sys
import numpy
from math import floor
def movingAverage(x, N):
cumsum = numpy.cumsum(numpy.insert(x, 0, 0))
return (cumsum[N:] - cumsum[:-N])/N
filename = "reports/configuration.confrewardRecordReport.txt"
if (len(sys.argv) > 1):
filename = sys.argv[1]... | Jacques-Florence/schedSim | src/analysis/reward.py | Python | bsd-3-clause | 847 |
from matplotlib import pyplot
from .algo import _bs_fit
def axes_object(ax):
""" Checks if a value if an Axes. If None, a new one is created.
Both the figure and axes are returned (in that order).
"""
if ax is None:
ax = pyplot.gca()
fig = ax.figure
elif isinstance(ax, pyplot.Ax... | phobson/mpl-probscale | probscale/validate.py | Python | bsd-3-clause | 2,443 |
from storitell.tastypie.resources import ModelResource
from storitell.stories.models import Story
from storitell.stories.extra_methods import moderate_comment
from storitell.tastypie.validation import Validation
# Stories can be read through a REST-ful interface. It'd be nice
# to be able to POST as well, but that req... | esten/StoriTell | StoriTell/stories/api.py | Python | bsd-3-clause | 583 |
from Player import Player
import random
import numpy
import time
class Connect4_RandomAI(Player):
def __init__(self,value):
# Initialize the random number generator using the current time as a seed so that we don't see the exact same AI
# behavior every time.
random.seed(time.clock())
... | cmdunkers/DeeperMind | Players/Connect4_RandomAI.py | Python | bsd-3-clause | 894 |
from bokeh.plotting import figure, output_file, show
output_file("title.html")
p = figure(width=400, height=400, title="Some Title")
p.title.text_color = "olive"
p.title.text_font = "times"
p.title.text_font_style = "italic"
p.circle([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=10)
show(p)
| bokeh/bokeh | sphinx/source/docs/user_guide/examples/styling_title.py | Python | bsd-3-clause | 289 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: Gazetteer.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _ref... | apple/coremltools | coremltools/proto/Gazetteer_pb2.py | Python | bsd-3-clause | 4,337 |
"""Tests for `cookiecutter.hooks` module."""
import os
import errno
import stat
import sys
import textwrap
import pytest
from cookiecutter import hooks, utils, exceptions
def make_test_repo(name, multiple_hooks=False):
"""Create test repository for test setup methods."""
hook_dir = os.path.join(name, 'hooks... | pjbull/cookiecutter | tests/test_hooks.py | Python | bsd-3-clause | 10,560 |
from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from zope.interface import implements
class ConnectCommand(ModuleData, Command):
implements(IPlugin, IModuleData, ICommand)
name = "ConnectCommand"
core = True
... | ElementalAlchemist/txircd | txircd/modules/rfc/cmd_connect.py | Python | bsd-3-clause | 1,451 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('form_processor', '0019_allow_closed_by_null'),
]
operations = [
migrations.RenameField(
model_name='commcarecaseindexsql',
old_name='relationship',
new_name='rel... | dimagi/commcare-hq | corehq/form_processor/migrations/0020_rename_index_relationship.py | Python | bsd-3-clause | 352 |
# -*- 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):
# Deleting field 'BillStage.stage'
db.delete_column(u'bills_billstage', 'stage')
def backwards(self, o... | adieyal/billtracker | code/billtracker/bills/migrations/0005_auto__del_field_billstage_stage.py | Python | bsd-3-clause | 3,234 |
import os
import mimetypes
import warnings
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.conf import settings
from django.core.files.base import File
from django.core.files.storage import Storage
from django.core.exceptions import ImproperlyConfigured
try:
... | rnoldo/django-avatar | storages/backends/s3.py | Python | bsd-3-clause | 10,680 |
"""Gradient descent
"""
import numpy as np
from frankenstein.tools.perf_utils import TIMER
from pyscf.lib import logger
""" Helper functions
"""
def get_gHp_fd(get_grad, p, order=1, eps=1.E-4):
""" Compute gradient-Hessian product using finite difference
Inps:
get_grad (callable):
gra... | hongzhouye/frankenstein | sgscf/sgopt.py | Python | bsd-3-clause | 6,925 |
from collections import OrderedDict
from django.contrib.auth.models import AnonymousUser
from kitsune.questions.forms import NewQuestionForm, WatchQuestionForm
from kitsune.questions.tests import TestCaseBase
from kitsune.users.tests import UserFactory
from nose.tools import eq_
class WatchQuestionFormTests(TestCase... | mozilla/kitsune | kitsune/questions/tests/test_forms.py | Python | bsd-3-clause | 3,899 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.
"""Parser for DALTON output files"""
from __future__ import print_function
import numpy
from . import logfileparser
f... | Schamnad/cclib | src/cclib/parser/daltonparser.py | Python | bsd-3-clause | 52,550 |
"""Precompute the polynomials for the asymptotic expansion of the
generalized exponential integral.
Sources
-------
[1] NIST, Digital Library of Mathematical Functions,
https://dlmf.nist.gov/8.20#ii
"""
import os
try:
import sympy
from sympy import Poly
x = sympy.symbols('x')
except ImportError:
... | scipy/scipy | scipy/special/_precompute/expn_asy.py | Python | bsd-3-clause | 1,333 |
"""This tutorial introduces the LeNet5 neural network architecture
using Theano. LeNet5 is a convolutional neural network, good for
classifying images. This tutorial shows how to build the architecture,
and comes with all the hyper-parameters you need to reproduce the
paper's MNIST results.
This implementation simpl... | webeng/DeepLearningTutorials | code/convolutional_mlp.py | Python | bsd-3-clause | 12,771 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-19 03:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('library', '0001_initial'),
]
operations = [
... | harikvpy/django-popupcrud | demo/library/migrations/0002_auto_20170919_0319.py | Python | bsd-3-clause | 2,833 |
import unittest
import pylab as pl
import matplotlib as mpl
import itertools
import sys
import math
import timeit
import copy
from em import *
def generate_synthetic_data(N):
np.random.seed(0)
C = np.array([[0., -0.7], [3.5, .7]])
C1 = np.array([[-0.4, 1.7], [0.3, .7]])
Y = np.r_[
np.dot(np.ra... | mbdriscoll/asp-old | tests/em_ahc_test.py | Python | bsd-3-clause | 9,721 |
#
# Widgets.py -- wrapped Qt widgets and convenience functions
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import os.path
from functools import reduce
from ginga.q... | Cadair/ginga | ginga/qtw/Widgets.py | Python | bsd-3-clause | 54,587 |
from django.conf import settings
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from mymoney.core.utils.currencies import get_currencies
class BankAccountManager(models.Manager):
def get_user_bankaccounts(self, user):
if not hasattr(... | ychab/mymoney | mymoney/apps/bankaccounts/models.py | Python | bsd-3-clause | 2,268 |
from collections import ChainMap
from py4jdbc.exceptions import dbapi2
exc_classes = ChainMap(sqlstate.exc_classes).new_child()
class _VCodeAgg(dbapi2.CodeAggregatorMeta):
exc_classes = exc_classes
class VerticaMultinodeError(dbapi2.DatabaseError, metaclass=_VCodeAgg):
code = 'V1'
class VerticaMiscellan... | massmutual/py4jdbc | py4jdbc/exceptions/vertica.py | Python | bsd-3-clause | 11,366 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2017, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | maxvonhippel/q2-diversity | q2_diversity/_alpha/_visualizer.py | Python | bsd-3-clause | 8,213 |
# coding=utf-8
# Django settings for bluebottle project.
import os, datetime
# Import global settings for overriding without throwing away defaults
from django.conf import global_settings
from django.utils.translation import ugettext as _
from admin_dashboard import *
from .payments import *
# Set PROJECT_ROOT to th... | onepercentclub/onepercentclub-site | onepercentclub/settings/base.py | Python | bsd-3-clause | 20,342 |
##########################################################################
#
# Copyright (c) 2017, Image Engine Design 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:
#
# * Redistribu... | hradec/cortex | test/IECore/MeshAlgoTest.py | Python | bsd-3-clause | 14,716 |
# Class that represents a King DF
import numpy
from scipy import special, integrate, interpolate
from ..util import conversion
from .df import df
from .sphericaldf import isotropicsphericaldf
_FOURPI= 4.*numpy.pi
_TWOOVERSQRTPI= 2./numpy.sqrt(numpy.pi)
class kingdf(isotropicsphericaldf):
"""Class that represents ... | jobovy/galpy | galpy/df/kingdf.py | Python | bsd-3-clause | 6,898 |
# -*- coding: utf-8 -*-
# vispy: gallery 2
# -----------------------------------------------------------------------------
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# ------------------------------------------------------------... | Eric89GXL/vispy | examples/basics/plotting/grid_x_y_viewbox.py | Python | bsd-3-clause | 1,194 |
# -*- coding: utf-8 -*-
"""Test audit columns"""
import pytest
from pyrseas.testutils import AugmentToMapTestCase
CREATE_STMT = "CREATE TABLE t1 (c1 integer, c2 text)"
FUNC_SRC1 = """
BEGIN
NEW.modified_by_user = SESSION_USER;
NEW.modified_timestamp = CURRENT_TIMESTAMP;
RETURN NEW;
END"""
FUNC_SRC2 = """
BEGI... | dvarrazzo/Pyrseas | tests/augment/test_audit.py | Python | bsd-3-clause | 12,757 |
import heapq
class AbstractSimulation(object):
def __init__(self, reality, antmoves, stats):
self.reality = reality
self.antmoves = antmoves
heapq.heapify(antmoves)
self.stats = stats
self.ticks = 0
def tick(self):
ant_move = heapq.heappop(self.antmoves)
... | ppolewicz/ant-colony | antcolony/simulation.py | Python | bsd-3-clause | 2,667 |
from django import forms
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import RequestFactory
from djadmin2.site import djadmin2_site
from ..admin2 import UserAdmin2
class UserAdminTest(TestCase):
def setUp(self):
... | andrewsmedina/django-admin2 | djadmin2/tests/test_auth_admin.py | Python | bsd-3-clause | 2,211 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 9.3 from Kane 1985."""
from __future__ import division
from sympy import cos, diff, expand, pi, solve, symbols
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics import dot, dynamicsymbols
from util import msprint, subs, part... | nouiz/pydy | examples/Kane1985/Chapter5/Ex9.3.py | Python | bsd-3-clause | 3,590 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Integration'] , ['PolyTrend'] , ['Seasonal_Minute'] , ['NoAR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Integration/model_control_one_enabled_Integration_PolyTrend_Seasonal_Minute_NoAR.py | Python | bsd-3-clause | 161 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/configuration.py
#
# 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, th... | 0x0mar/king-phisher | king_phisher/configuration.py | Python | bsd-3-clause | 7,045 |
import re
from collections import namedtuple, deque
from .regex import RE_SPLIT, RE_KEY, RE_INDEX
from .utils import Enum, _missing
StackItem = namedtuple('StackItem', ['name', 'access_method'])
# Accessor methods:
# INDEX means this accessor is index or key-based, eg. [1] or ['foo']
# DEFAULT means property
Access... | dansimau/pystringattr | stringattr.py | Python | bsd-3-clause | 5,928 |
# Copyright 2017 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | youtube/cobalt | starboard/build/application_configuration.py | Python | bsd-3-clause | 4,981 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
import collections
from django.db import models
from django.utils import six
from django.utils.six.moves import zip
from yepes.contrib.datamigrations.exceptions import (
UnableToCreateError,
UnableToExportError,
UnableToImportError,
Unab... | samuelmaudo/yepes | yepes/contrib/datamigrations/data_migrations.py | Python | bsd-3-clause | 17,481 |
import unittest
from tornadowebapi.renderers import JSONRenderer
class TestJSONRenderer(unittest.TestCase):
def test_basic_rendering(self):
renderer = JSONRenderer()
self.assertEqual(renderer.render({}), "{}")
self.assertEqual(renderer.render(None), None)
| simphony/tornado-webapi | tornadowebapi/renderers/tests/test_json_renderer.py | Python | bsd-3-clause | 287 |
# -*- coding: utf-8 -*-
import os
import os.path
from StringIO import StringIO
from time import time
__all__ = ['Parser', 'IncrementalParser', 'DispatchParser']
import xml.dom as xd
import xml.dom.minidom as xdm
import xml.sax as xs
import xml.sax.handler as xsh
import xml.sax.saxutils as xss
from xml.sax.saxutils i... | Lawouach/bridge | bridge/parser/bridge_default.py | Python | bsd-3-clause | 21,896 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'DiskOffering.available_size_kb'
db.add_column(u'physical_... | globocom/database-as-a-service | dbaas/physical/migrations/0025_auto__add_field_diskoffering_available_size_kb.py | Python | bsd-3-clause | 11,926 |
# -*- coding: utf-8 -*-
#
# flask_slack documentation build configuration file, created by
# sphinx-quickstart on Sun Oct 19 16:31:35 2014.
#
# 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.
#... | VeryCB/flask-slack | docs/conf.py | Python | bsd-3-clause | 8,287 |
# 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.
import os
import sys
import json
from telemetry.page import page_set
from telemetry.page import page_test
from telemetry.core import util
src_path = os.... | loopCM/chromium | content/test/gpu/gpu_tests/webgl_conformance_test.py | Python | bsd-3-clause | 3,821 |
#!/usr/bin/env python
# coding=UTF-8
__author__ = "Pierre-Yves Langlois"
__copyright__ = "https://github.com/pylanglois/uwsa/blob/master/LICENCE"
__credits__ = ["Pierre-Yves Langlois"]
__license__ = "BSD"
__maintainer__ = "Pierre-Yves Langlois"
from uwsas.common import *
from uwsas.commands.abstract_command import A... | pylanglois/uwsa | uwsas/commands/command_manager.py | Python | bsd-3-clause | 619 |
# Copyright (c) 2011 Tencent Inc.
# All rights reserved.
#
# Author: Michaelpeng <michaelpeng@tencent.com>
# Date: January 09, 2012
"""
This is the configuration parse module which parses
the BLADE_ROOT as a configuration file.
"""
import os
import sys
import console
from blade_util import var_to_list
from cc_t... | project-zerus/blade | src/blade/configparse.py | Python | bsd-3-clause | 11,273 |
import tests.periodicities.period_test as per
per.buildModel((60 , 'D' , 100));
| antoinecarme/pyaf | tests/periodicities/Day/Cycle_Day_100_D_60.py | Python | bsd-3-clause | 82 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided ... | cedriclaunay/gaffer | python/GafferUI/ApplicationMenu.py | Python | bsd-3-clause | 5,283 |
import string
from random import choice
from django.contrib.auth.models import User
def get_random_id():
valid_id = False
test_name = 'EMPTY'
while valid_id is False:
s1 = ''.join([choice(string.ascii_uppercase) for i in range(2)])
s2 = ''.join([choice(string.digits) for i in range(8)])
... | pocketone/django-shoppy | shoppy/util/randomuserid.py | Python | bsd-3-clause | 499 |
from __future__ import unicode_literals
import numpy as np
import param
from ..core import (HoloMap, DynamicMap, CompositeOverlay, Layout,
GridSpace, NdLayout, Store)
from ..core.util import (match_spec, is_number, wrap_tuple, basestring,
get_overlay_spec, unique_iterator,... | vascotenner/holoviews | holoviews/plotting/util.py | Python | bsd-3-clause | 10,673 |
from sympy.core import *
def test_rational():
a = Rational(1, 5)
assert a**Rational(1, 2) == a**Rational(1, 2)
assert 2 * a**Rational(1, 2) == 2 * a**Rational(1, 2)
assert a**Rational(3, 2) == a * a**Rational(1, 2)
assert 2 * a**Rational(3, 2) == 2*a * a**Rational(1, 2)
assert a**Rational(17... | certik/sympy-oldcore | sympy/core/tests/test_eval_power.py | Python | bsd-3-clause | 1,302 |
##
##
# File auto-generated against equivalent DynamicSerialize Java class
from .Property import Property
class Header(object):
def __init__(self, properties=None, multimap=None):
if properties is None:
self.properties = []
else:
self.properties = properties
if m... | mjames-upc/python-awips | dynamicserialize/dstypes/com/raytheon/uf/common/message/Header.py | Python | bsd-3-clause | 611 |
"""
See LICENSE file for copyright and license details.
"""
from app import app
from flask import render_template, flash, redirect
#from app.forms import LoginForm
from app.modules.constant import *
@app.route("/")
@app.route("/index")
@app.route("/index/")
@app.route("/<app_profile>/index")
@app.route... | rockwolf/python | cece/app/views.py | Python | bsd-3-clause | 4,840 |
# -*- coding: utf-8 -*-
from datetime import datetime
import json
from urlparse import urlparse
from django.core.urlresolvers import reverse
from django.db import reset_queries
from django.http import QueryDict
from django.test.utils import override_settings
import mock
from mock import patch
from nose.tools import ... | clouserw/zamboni | mkt/ratings/tests/test_views.py | Python | bsd-3-clause | 32,940 |