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 |
|---|---|---|---|---|---|
sum =0
num1 = 1
num2 = 2
num3 = 3
while( num2 <= 4000000):
sum = sum + num2
num1 = num2 + num3
num2 = num3 + num1
num3 = num1 + num2
print sum,
| khaleeque-ansari/Online-Coding- | ProjectEulerCode/prob2.py | Python | apache-2.0 | 188 |
# Copyright (c) 2016 Jiocloud.com, Inc. or its affiliates. All Rights Reserved
#
# 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 right... | jiocloudservices/jcsclient | src/jcsclient/compute_api/instance.py | Python | apache-2.0 | 7,005 |
# -*- python -*-
import electionfraud.countmethod.abc as efcmabc
import electionfraud.countmethod.exception as efcmx
import electionfraud.countmethod.fptp as fptp
class MultiRoundExhaustible(efcmabc.AbstractCountMethod):
"""
A base class for implementing counting methods that could possibly
span multiple ... | tnalpgge/electionfraud | python/electionfraud/countmethod/mrx.py | Python | artistic-2.0 | 2,363 |
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import redhawk
import hashlib
import operator
import os
import sys
import traceback
from functools import reduce
def AssertWithError(condition, error):
""" If condition is false, exit with error."""
if callable(cond... | spranesh/Redhawk | redhawk/utils/util.py | Python | bsd-2-clause | 5,087 |
# -*- 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 model 'SampleRun'
db.delete_table('sample_run')
def backwards(self, orm):
# Adding ... | chop-dbhi/varify-data-warehouse | vdw/samples/migrations/0038_auto__del_samplerun.py | Python | bsd-2-clause | 24,516 |
import cPickle
import nz_houses_dao as dao
from nltk.corpus import stopwords
import re
import gzip
class Residential:
distionary
def
def __init__():
pass
def generate_word_lists(descriptions):
descriptions_features = {}
i = 0
for listingId in descriptions.keys():
a = descriptions[listingId... | statX/nz-houses | analysis/listing_text.py | Python | bsd-2-clause | 1,824 |
import signal
import weakref
from airy.utils.unittest.compatibility import wraps
__unittest = True
class _InterruptHandler(object):
def __init__(self, default_handler):
self.called = False
self.default_handler = default_handler
def __call__(self, signum, frame):
installed_handler = ... | letolab/airy | airy/utils/unittest/signals.py | Python | bsd-2-clause | 1,682 |
"""
Locks used to synchronize mutations on queues.
"""
import time
from redset.exceptions import LockTimeout
__all__ = (
'Lock',
)
# redis or redis-py truncates timestamps to the hundredth
REDIS_TIME_PRECISION = 0.01
class Lock(object):
"""
Context manager that implements a distributed lock with red... | percolate/redset | redset/locks.py | Python | bsd-2-clause | 2,908 |
import copy
from typing import Tuple
import numpy as np
from opensfm import pyrobust, pygeometry
def line_data() -> Tuple[int, int, np.ndarray, int]:
a, b = 2, 3
samples = 100
x = np.linspace(0, 100, samples)
return a, b, x, samples
def similarity_data() -> Tuple[np.ndarray, np.ndarray, int, np.nda... | mapillary/OpenSfM | opensfm/test/test_robust.py | Python | bsd-2-clause | 11,385 |
class Student(object):
def __init__(self, name):
self.name = name
def __repr__(self):
print "8"*20
return 'Student object (name: %s)' % self.name
def __str__(self):
print "*"*20
return 'Student object str (name: %s)' % self.name
def __call__(self):
print ... | waytai/open | python/st.py | Python | bsd-2-clause | 396 |
from validation.validationresult.resultenum import ResultType
from validation.validationresult.result import Result
class BaseMixin:
def __init__(self, result_type: ResultType = ResultType.Base) -> None:
self._validators = []
self._result_type = result_type
@property
def validators(self)... | iraklikhitarishvili/data2class | base/base.py | Python | bsd-2-clause | 2,011 |
import numpy as np
from pySDC.core.Sweeper import sweeper
from pySDC.implementations.collocation_classes.gauss_lobatto import CollGaussLobatto
class verlet(sweeper):
"""
Custom sweeper class, implements Sweeper.py
Second-order sweeper using velocity-Verlet as base integrator
Attributes:
QQ:... | Parallel-in-Time/pySDC | pySDC/implementations/sweeper_classes/verlet.py | Python | bsd-2-clause | 7,323 |
#-*- coding: utf-8 -*-
# Author : Jeonghoonkang, github.com/jeonghoonkang
import platform
import sys
import os
import time
import traceback
import requests
import RPi.GPIO as GPIO
from socket import gethostname
hostname = gethostname()
SERVER_ADDR = '211.184.76.80'
GPIO.setwarnings(False)
GPIO.cleanup()
GPIO.setm... | jeonghoonkang/BerePi | apps/check/monitor.py | Python | bsd-2-clause | 1,308 |
import model
model.train() | uditsaxena/CS689_final_project | train.py | Python | bsd-2-clause | 27 |
from rctk.layouts.layouts import Layout, LayoutException
import types
import math
class Cell(object):
def __init__(self, o, row, column, rowspan=1, colspan=1, **options):
self.o = o
self.row = row
self.column = column
self.rowspan = rowspan
self.colspan = colspan
sel... | rctk/rctk | rctk/layouts/grid.py | Python | bsd-2-clause | 10,125 |
# Copyright (c) 2013, Kevin Greenan (kmgreen2@gmail.com)
# 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 c... | tsg-/pyeclib | pyeclib/__init__.py | Python | bsd-2-clause | 1,348 |
import os
from collections import defaultdict
import dill
import numpy as np
import pySDC.helpers.plot_helper as plt_helper
from pySDC.helpers.stats_helper import filter_stats, sort_stats
from pySDC.implementations.collocation_classes.gauss_lobatto import CollGaussLobatto
from pySDC.implementations.controller_classes... | Parallel-in-Time/pySDC | pySDC/projects/Hamiltonian/fput.py | Python | bsd-2-clause | 8,363 |
from invoke import task
@task
def expect(c, subroutine, pty=True):
"""
Call a subroutine within signaling.py, then sleep, waiting for a signal.
Integration tests use this task to run a subroutine within signaling.py;
those subroutines are the actual test bodies, which expect a given signal
to be ... | pfmoore/invoke | integration/_support/signal_tasks.py | Python | bsd-2-clause | 630 |
import numpy as np
import theano
import theano.tensor as T
import theano.typed_list
import operator
class BIRNN(object):
def __init__(self, word_dim, hidden_dim=10, sequence_length=3):
# Assign instance variables
self.word_dim = word_dim
self.hidden_dim = hidden_dim
self.seq_length = ... | ranarag/theano_works | birnn_theano.py | Python | bsd-2-clause | 4,947 |
# -*- coding: utf8 -*-
import logging
import logging.handlers
import traceback
from argparse import ArgumentParser
from config import Config
from telegram import Telegram
TRACE = 5
def main():
parser = ArgumentParser()
parser.add_argument("-c", "--config", help="yaml config file name", defau... | Fly33/telegram-ingress-bot | src/main.py | Python | bsd-2-clause | 1,204 |
# -*- coding: utf-8 -*-
from pydeps.dot import dot, cmd2args
def test_svg(tmpdir):
tmpdir.chdir()
ab = tmpdir.join('ab.svg')
dot(u"""
digraph G {
a -> b
}
""", o=ab.basename)
assert ab.exists()
def test_svg_str(tmpdir):
tmpdir.chdir()
ab = tmpdir.join('ab.svg')
dot(""... | thebjorn/pydeps | tests/test_dot.py | Python | bsd-2-clause | 1,018 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-03 07:40
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.manager
class Migration(migrations.Migration):
initial = True
dependencies = [
('routes'... | meshy/django-conman | example/example/migrations/0001_initial.py | Python | bsd-2-clause | 1,026 |
import matplotlib.pyplot as plt
from OSIM.Modeling.Components.NPN_Vertical_Bipolar_Intercompany_Model.VBIC_Currents.IRCI import *
from OSIM.Modeling.Components.Resistor import Resistor
from OSIM.Modeling.Components.VoltageSource import VoltageSource
from OSIM.Modeling.CircuitSystemEquations import CircuitSystemEquation... | tmaiwald/OSIM | OSIM/Modeling/Testbenches/VBIC_Kennlinien_TBs/VBIC_NPN_TB.py | Python | bsd-2-clause | 2,279 |
from inspect import getmembers
from django.shortcuts import render
from utilities import get_wps_service_engine, list_wps_service_engines, abstract_is_link
def home(request):
"""
Home page for Tethys WPS tool. Lists all the WPS services that are linked.
"""
wps_services = list_wps_service_engines()
... | CI-WATER/django-tethys_wps | tethys_wps/views.py | Python | bsd-2-clause | 1,115 |
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
#
# 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... | frew/simpleproto | scons-local-1.1.0/SCons/compat/_scons_itertools.py | Python | bsd-2-clause | 3,817 |
'''
Example:
'''
import os,sys
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0,parentdir)
from pyN import *
A = IzhikevichPopulation(name='thalamus', N=5, a=0.02, b=0.2, c=-65, d=6, v0=-70, u0=None)#tonic spiking
B = IzhikevichPopulation(name='cortex', N=10, a=0.02, b=0.25, c... | ericjang/pyN | pyn_examples/4_connectivity.py | Python | bsd-2-clause | 955 |
"""autogenerated by genpy from arm/cartesian_moves.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import arm.msg
import genpy
import std_msgs.msg
class cartesian_moves(genpy.Message):
_md5sum = "56c11a250225b8cc4f58b0e6670caaa1"
_type = "arm/car... | uml-robotics/manus_arm | arm/src/arm/msg/_cartesian_moves.py | Python | bsd-2-clause | 9,235 |
from PyQt4 import QtCore
import sys
from ilastik.core.projectClass import Project
from ilastik.core.testThread import TestThread
from ilastik.modules.unsupervised_decomposition.core.unsupervisedMgr import UnsupervisedDecompositionModuleMgr
from ilastik.modules.unsupervised_decomposition.core.algorithms.unsupervisedDeco... | ilastik/ilastik-0.5 | ilastik/modules/unsupervised_decomposition/core/testModule.py | Python | bsd-2-clause | 11,269 |
""" cbas_names.py
Extract the names of CBSAs from the list given by the OMB.
"""
from xlrd import open_workbook
#
# READ DATA
#
book = open_workbook('data/gz/List1.xls',on_demand=True)
for sheet_name in book.sheet_names():
sheet = book.sheet_by_name(sheet_name)
# Read
## CBSA fips
cbsa_fips = ... | scities-data/metro-atlas_2014 | bin/names/cbsa_names.py | Python | bsd-2-clause | 1,257 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# ABOUT : This script checks in which wheel and in which
# position a filter, a slit or a grism is located.
# It can also be used to move this wheel to the right
# position with an optional argument "-m". Filters
# are searched ... | sniemi/SamPy | sandbox/src2/src/alfosc_optics.py | Python | bsd-2-clause | 21,844 |
"""
# # #### ##### # # ##### # # # #
# # # # # ## ## # # # ## # #
### #### #### # # # # # # # # #####
# # # # # # # # ## # # #
# # # ##### # # # # # # # #
Kremlin Mag... | glasnost/kremlin | kremlin/forms.py | Python | bsd-2-clause | 2,312 |
#!/usr/bin/env python
#####
#
# Synthetic Biology Gene Standardizer
# Copyright (c) 2015, Tyson R. Shepherd, PhD
# 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 co... | trsheph/SynBioStandardizer | SynColi2/SyGS_v2.py | Python | bsd-2-clause | 3,078 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import unittest
from flypy import jit
class TestCallingConventionFromPython(unittest.TestCase):
def test_varargs(self):
@jit
def f(a, b, *args):
return [a, b, args[1]]
self.assertEqual(f... | flypy/flypy | flypy/tests/test_calling_conv.py | Python | bsd-2-clause | 1,235 |
from __future__ import absolute_import
from flask import url_for, redirect, abort, request, Blueprint, current_app
from flask_login import login_required, current_user
import six
from six.moves import filter, map
from sqlalchemy.orm.exc import NoResultFound
from itertools import chain
from .. import ships, systems, db... | paxswill/evesrp | src/evesrp/views/api.py | Python | bsd-2-clause | 12,023 |
# Copyright (c) by it's authors.
# Some rights reserved. See LICENSE, AUTHORS.
from peer import *
class SMPeer(Peer):
def __init__(self, room, statePillow, states=[], initState="Start"):
Peer.__init__(self, room)
self._routings = set()
self._transitions = set()
self._callbacks = s... | FreshXOpenSource/wallaby-base | wallaby/pf/peer/sm.py | Python | bsd-2-clause | 4,120 |
import os
from setuptools import setup
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(os.path.join(os.path.di... | eemiliosl/pyanno_voting | setup.py | Python | bsd-2-clause | 916 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 1.0.2.7202 on 2016-06-23.
# 2016, SMART Health IT.
import io
import json
import os
import unittest
from . import devicecomponent
from .fhirdate import FHIRDate
class DeviceComponentTests(unittest.TestCase):
def instantiate_from(self, filen... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_1_0_6/models/devicecomponent_tests.py | Python | bsd-3-clause | 4,893 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
try:
from six.moves.urllib_parse import SplitResult, urlsplit
except ImportError:
from six.moves.urllib_parse import SplitResult, urlsplit
import os.path
def urljoin_keep_path(url, path):
"""Join a base URL and a relative or absolute path. Th... | imbasimba/astroquery | astroquery/utils/url_helpers.py | Python | bsd-3-clause | 1,603 |
from django.db import models
class UploadManager(models.Manager):
def published(self):
return self.get_query_set().annotate(
article_count=models.Count('article')
).filter(article_count__gt=0)
| boar/boar | boar/uploads/manager.py | Python | bsd-3-clause | 227 |
from django.conf.urls import patterns, url
from django.contrib.auth import views as auth_views
urlpatterns = patterns('',
url(r'^login/$',
auth_views.login,
{'template_name': 'authstrap/login.html'},
name='auth_login'),
url(r'^logout/$',
auth_views.logo... | alixedi/django_authstrap | authstrap/urls.py | Python | bsd-3-clause | 1,659 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
class AbstractProduct(models.Model):
item_number = models.CharField(_("Item number"), max_length=255, unique=True)
name = models.CharField(_("Name"), max_length=128)
description = models.TextField(_("Description"), blank=... | byteweaver/django-eca-catalogue | eca_catalogue/product/abstract_models.py | Python | bsd-3-clause | 579 |
import sys
from deap import base, creator, tools
import numpy as np
from csep.loglikelihood import calcLogLikelihood
# from models.mathUtil import calcNumberBins
import models.model
import random
import array
import time
from operator import attrgetter
# from scoop import futures
import fgeneric
import bbobbenchmarks a... | PyQuake/earthquakemodels | code/gaModel/gamodel_bbob.py | Python | bsd-3-clause | 6,592 |
"""
byceps.services.email.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from __future__ import annotations
from typing import Optional
from sqlalchemy.exc import IntegrityError
from ...database import db, upsert
from ... i... | homeworkprod/byceps | byceps/services/email/service.py | Python | bsd-3-clause | 4,293 |
import pandas as pd
from bokeh.sampledata.glucose import data
from bokeh.plotting import *
output_cloud("glucose")
hold()
dates = data.index.to_series()
figure(x_axis_type="datetime", tools="pan,wheel_zoom,box_zoom,reset,previewsave")
line(dates, data['glucose'], color='red', legend='glucose')
line(dates, data['... | sahat/bokeh | examples/plotting/cloud/glucose.py | Python | bsd-3-clause | 1,424 |
from django.urls import path
from story.views import StoryListView
app_name = "story"
urlpatterns = [
path('', StoryListView.as_view(), name='stories'),
]
| DjangoGirls/djangogirls | story/urls.py | Python | bsd-3-clause | 161 |
# Copyright 2013 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.
from future import Future
from object_store import ObjectStore
class TestObjectStore(ObjectStore):
'''An object store which records its namespace and beha... | codenote/chromium-test | chrome/common/extensions/docs/server2/test_object_store.py | Python | bsd-3-clause | 727 |
"""This module contains classes for handling matrices in a linear algebra setting.
The primary objects are the `Matrix` and `Cov`. These objects overload most numerical
operators to autoalign the elements based on row and column names."""
from .mat_handler import Matrix, Cov, Jco, concat, save_coo
| jtwhite79/pyemu | pyemu/mat/__init__.py | Python | bsd-3-clause | 301 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Downloads the FITS files that are used in image testing and for building documentation.
"""
import time
from ....utils.data import download_file
from ....io import fits
__all__ = ['fetch_msx_hdu',
'fetch_rosat_hdu',
'fetch_twoMA... | joergdietrich/astropy | astropy/visualization/wcsaxes/tests/datasets.py | Python | bsd-3-clause | 1,655 |
from sqlagg.columns import SimpleColumn
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumnGroup
from corehq.apps.reports.generic import GenericTabularReport
from corehq.apps.reports.sqlreport import DatabaseColumn
from corehq.apps.reports.standard import DatespanMixin, CustomProjectReport
fro... | qedsoftware/commcare-hq | custom/up_nrhm/reports/district_functionality_report.py | Python | bsd-3-clause | 3,729 |
from conans.util.files import mkdir, save, rmdir
import os
from conans.util.log import logger
from conans.paths import CONANINFO, CONAN_MANIFEST
from conans.errors import ConanException, format_conanfile_exception
from conans.model.build_info import DEFAULT_RES, DEFAULT_BIN, DEFAULT_LIB, DEFAULT_INCLUDE
import shutil
f... | AversivePlusPlus/AversivePlusPlus | tools/conan/conans/client/packager.py | Python | bsd-3-clause | 2,736 |
###############################################################################
#
# Drone Simulator
#
# Copyright (c) 2017, Mandar Chitre
#
# This file is part of dronesim which is released under Simplified BSD License.
# See file LICENSE or go to http://www.opensource.org/licenses/BSD-3-Clause
# for full license detai... | org-arl/dronesim | dronesim.py | Python | bsd-3-clause | 6,968 |
from glob import glob
import os
import time
import tornado.ioloop
from tornado import gen
from .core import Stream, convert_interval, RefCounter
def PeriodicCallback(callback, callback_time, asynchronous=False, **kwargs):
source = Stream(asynchronous=asynchronous)
def _():
result = callback()
... | mrocklin/streams | streamz/sources.py | Python | bsd-3-clause | 25,985 |
# coding=utf-8
import json
from django.test import SimpleTestCase
from corehq.util.test_utils import generate_cases
from pillowtop.utils import prepare_bulk_payloads
class BulkTest(SimpleTestCase):
def test_prepare_bulk_payloads_unicode(self):
unicode_domain = u'हिंदी'
bulk_changes = [
... | qedsoftware/commcare-hq | corehq/ex-submodules/pillowtop/tests/test_bulk.py | Python | bsd-3-clause | 1,267 |
import warnings
import sys
import numpy as np
from numpy.testing import *
import unittest
class _GenericTest(object):
def _test_equal(self, a, b):
self._assert_func(a, b)
def _test_not_equal(self, a, b):
try:
self._assert_func(a, b)
passed = True
except Asserti... | qsnake/numpy | numpy/testing/tests/test_utils.py | Python | bsd-3-clause | 15,034 |
"""Exceptions used by basic support utilities."""
__author__ = "Ian Goodfellow"
import inspect
import sys
import textwrap
from pylearn2.utils.common_strings import environment_variable_essay
class EnvironmentVariableError(Exception):
"""
An exception raised when a required environment variable is not defined... | kastnerkyle/pylearn2 | pylearn2/utils/exc.py | Python | bsd-3-clause | 2,941 |
#!/usr/bin/env python
from ropper import RopperService
# not all options need to be given
options = {'color' : False, # if gadgets are printed, use colored output: default: False
'badbytes': '00', # bad bytes which should not be in addresses or ropchains; default: ''
'all' : False, #... | sashs/Ropper | sample.py | Python | bsd-3-clause | 4,732 |
# Copyright (c) 2015,Vienna University of Technology,
# Department of Geodesy and Geoinformation
# All rights reserved.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND F... | TUW-GEO/SMDC-performance | tests/test_test_scripts.py | Python | bsd-3-clause | 4,415 |
from django.urls import path
from ..views import popular, snippets
urlpatterns = [
path('', popular.top_authors, name='cab_top_authors'),
path('<username>/', snippets.author_snippets, name='cab_author_snippets'),
]
| django-de/djangosnippets.org | cab/urls/users.py | Python | bsd-3-clause | 225 |
import os
import socket
# Django settings for isthatanearthquake project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
if socket.gethostname() == 'adam-air' or socket.gethostname() == 'TWC101037.local':
DATABASES = {
'default': {
... | adamfast/isthatanearthquake | isthatanearthquake/settings.py | Python | bsd-3-clause | 7,204 |
'''
Created on 27 Feb 2015
@author: michaelwhelehan
'''
from django.views import generic as generic_views
from django.core.urlresolvers import reverse
from tunobase.console import mixins as console_mixins
class ConsoleHome(console_mixins.ConsoleUserRequiredMixin,
generic_views.TemplateView):
... | unomena/unoconsole | unoconsole/views.py | Python | bsd-3-clause | 325 |
from __future__ import absolute_import
from sentry import features
from sentry.api.base import Endpoint
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.api.bases.project import ProjectPermission
from sentry.models import Monitor, Project, ProjectStatus
from sentry.utils.sdk import configure_scope
... | mvaled/sentry | src/sentry/api/bases/monitor.py | Python | bsd-3-clause | 1,422 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_social_launch_test_project.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| elricgit/django-social-launch | manage.py | Python | bsd-3-clause | 276 |
from flask.ext.mongoengine import MongoEngine
db = MongoEngine()
| cybertoast/flask-mongoutils | loader.py | Python | bsd-3-clause | 65 |
"""
=====================================================
Spatiotemporal permutation F-test on full sensor data
=====================================================
Tests for differential evoked responses in at least
one condition using a permutation clustering test.
The FieldTrip neighbor templates will be used to d... | effigies/mne-python | examples/stats/plot_spatio_temporal_cluster_stats_sensor.py | Python | bsd-3-clause | 5,435 |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
def norm_col_init(weights, std=1.0):
x = torch.randn(weights.size())
x *= std / torch.sqrt((x**2).sum(1, keepdim=True))
return x
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Conv') !=... | Nasdin/ReinforcementLearning-AtariGame | A3CModel.py | Python | bsd-3-clause | 2,624 |
import doctest
from contextlib import contextmanager
from django.core.exceptions import ValidationError
from django.db import IntegrityError, transaction
from django.db.models import ProtectedError
from django.test import TestCase
from nose.tools import assert_in
from corehq.apps.data_dictionary.models import CasePr... | dimagi/commcare-hq | corehq/motech/fhir/tests/test_models.py | Python | bsd-3-clause | 21,406 |
import requests
import logging
import cmapPy.clue_api_client.setup_logger as setup_logger
import json
__authors__ = "David L. Lahr"
__email__ = "dlahr@broadinstitute.org"
logger = logging.getLogger(setup_logger.LOGGER_NAME)
class ClueApiClient(object):
"""Basic class for running queries against CLUE api
""... | cmap/cmapPy | cmapPy/clue_api_client/clue_api_client.py | Python | bsd-3-clause | 3,549 |
#
# NOTE: This is the settings file for the server at https://testing.onepercentclub.com
# This is not for running tests!
#
try:
from .secrets import *
except ImportError:
import sys
sys.exit('secrets.py settings file not found. Please run `prepare.sh` to create one.')
from .server import *
#
# Put... | onepercentclub/onepercentclub-site | onepercentclub/settings/testing.py | Python | bsd-3-clause | 670 |
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Documentation on PRESUBMIT.py can be found at:
# http://www.chromium.org/developers/how-tos/depottools/presubmit-scripts
import os.path
import sy... | cvsuser-chromium/native_client | PRESUBMIT.py | Python | bsd-3-clause | 6,342 |
#!/usr/bin/env python2.7
import urllib2
import json
import ConfigParser
import argparse
import os
import collections
class DigitalOceanInventory(object):
def __init__(self):
self.conf = ConfigParser.SafeConfigParser()
self.args = None
self.api_token = None
def read_config(self):
... | 2bithacker/ansible-modules | inventory/digitalocean.py | Python | bsd-3-clause | 2,629 |
#!/usr/bin/env python
#export CC=mpicc
#export CXX=mpic++
from distutils.core import setup, Extension
from distutils import sysconfig
import sys
print "Remember to set your preferred MPI C++ compiler in the CC and CXX environment variables. For example, in Bash:"
print "export CC=mpicxx"
print "export CXX=mpicxx"
pr... | harperj/KDTSpecializer | setup.py | Python | bsd-3-clause | 6,192 |
import unittest
from cumulusci.core import template_utils
class TemplateUtils(unittest.TestCase):
def test_string_generator(self):
x = 100
y = template_utils.StringGenerator(lambda: str(x))
assert str(y) == "100"
x = 200
assert str(y) == "200"
def test_faker_library(se... | SalesforceFoundation/CumulusCI | cumulusci/robotframework/tests/test_template_util.py | Python | bsd-3-clause | 1,872 |
from itertools import chain
from django.db import models
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
from django.db.models import Sum
from django.template import Template, Context
class AbstractOrder(models.Mod... | aykut/django-oscar | oscar/apps/order/abstract_models.py | Python | bsd-3-clause | 19,620 |
from distutils.core import setup
from os import path
ROOT = path.dirname(__file__)
README = path.join(ROOT, 'README.rst')
setup(
name='hurl',
py_modules=['hurl'],
url='https://github.com/oinopion/hurl',
author='Tomek Paczkowski & Aleksandra Sendecka',
author_email='tomek@hauru.eu',
version='2.... | oinopion/hurl | setup.py | Python | bsd-3-clause | 827 |
import os
from django.conf import settings
from django.contrib.auth.models import User
import requests
from test_utils import TestCase, SkipTest
from commons.urlresolvers import reverse
from projects import cron
from projects.models import DEFAULT_INACTIVE_MESSAGE, Link, Project
from topics.models import Topic
from ... | mozilla/betafarm | apps/projects/tests.py | Python | bsd-3-clause | 17,989 |
# encoding: utf-8
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
depends_on = (
('product', '0010_add_discountable_categories'),
)
def forwards(self, orm):
db.rename_table('product_downloadableproduct', 'downloadable_downloadableproduct')
... | dokterbob/satchmo | satchmo/apps/product/modules/downloadable/migrations/0001_split.py | Python | bsd-3-clause | 18,953 |
# Copyright (c) 2011-2013 Andreas Sembrant
# 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 conditi... | uart/scarphase | pyscarphase/plot/color.py | Python | bsd-3-clause | 1,885 |
from django.conf.urls.defaults import *
urlpatterns = patterns('crowdsource.views',
url(r'^post_cs_entry/$', 'post_csentry', name = 'post-cs-entry'),
)
| rmanocha/django-crowdsource | crowdsource/urls.py | Python | bsd-3-clause | 186 |
from conans import ConanFile, CMake
class AversivePlusPlusModuleConan(ConanFile):
name = "stream-hal"
version = "0.1"
exports = "*.hpp"
requires = "stream/0.1@AversivePlusPlus/dev", "hal-switch/0.1@AversivePlusPlus/dev"
def package(self):
self.copy("*.hpp", src="include", dst="include")
| AversivePlusPlus/AversivePlusPlus | modules/hal/stream-hal/conanfile.py | Python | bsd-3-clause | 318 |
# Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: Simplified BSD
import os.path as op
import warnings
from numpy.testing import assert_raises
from mne import io, read_events, pick_types
from mne.utils import requires_version, run_tests_if_main
from mne.viz.utils import _fake_click
# Set our plotters to ... | yousrabk/mne-python | mne/viz/tests/test_raw.py | Python | bsd-3-clause | 4,727 |
#!/usr/bin/env python
# Copyright (c) 2015, Robot Control and Pattern Recognition Group,
# Institute of Control and Computation Engineering
# Warsaw University of Technology
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the ... | dseredyn/velma_scripts | scripts/test_jar_grasping.py | Python | bsd-3-clause | 5,867 |
import numpy as np
import scipy
from scipy import linalg
from scipy import sparse
from scipy import ndimage
import scipy.sparse.linalg.eigen.arpack
from scipy.sparse.linalg.eigen.arpack import eigen, eigen_symmetric
#from pyamg.graph import lloyd_cluster
import pyamg
from pyamg import smoothed_aggregation_solver
from s... | GaelVaroquaux/diffusion-segmentation | spectral_embedding.py | Python | bsd-3-clause | 11,610 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import datetime
import logging
import os
import random
import shutil
import StringIO
import sys
import tempfile
from catapult_base import cloud_storage # p... | SummerLW/Perf-Insight-Report | telemetry/telemetry/value/trace.py | Python | bsd-3-clause | 4,564 |
from gi.repository import Gtk
class ChannelWindow:
def __init__(self, sources, client_thread):
self.sources = sources
self.client_thread = client_thread
self.changes = {}
self.widgets = {}
self.gtkwin = Gtk.Window()
self.gtkwin.set_position(Gtk.WindowPosition.CENTER)
self.gtkwin.set_default_size(320,... | krzotr/kismon | kismon/windows/channel.py | Python | bsd-3-clause | 3,856 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
import csv
from datetime import date, datetime, time
from decimal import Decimal
from io import open
import os
from unittest import expectedFailure
import warnings
from django import test
from django.test.utils import override_settings
from django.utils ... | samuelmaudo/yepes | tests/datamigrations/tests_fields.py | Python | bsd-3-clause | 89,595 |
input_names = {'TL': '../examples/large_deformation/hyperelastic.py',
'UL': '../examples/large_deformation/hyperelastic_ul.py',
'ULM': '../examples/large_deformation/hyperelastic_ul_up.py'}
output_name_trunk = 'test_hyperelastic_'
from sfepy.base.testing import TestCommon
from tests_basic... | RexFuzzle/sfepy | tests/test_hyperelastic_tlul.py | Python | bsd-3-clause | 3,003 |
# coding: utf-8
"""
regex.tests
~~~~~~~~~~~
:copyright: 2012 by Daniel Neuhäuser
:license: BSD, see LICENSE.rst
"""
from unittest import TestCase
from itertools import izip
from contextlib import contextmanager
from regex.parser import (
parse, ParserError, Parser, DEFAULT_ALPHABET, DEFAULT_LANGUA... | DasIch/editor | prototypes/regex/tests.py | Python | bsd-3-clause | 17,417 |
#! /usr/bin/env python3
#
# multicast chat
#
# usage:
# mcc [-bs4] myname
# -4 use IPv4 (default: IPv6)
# mode: default receiver mode
# -s sender mode
# -b bot mode
import pickle
import struct
import socket
import sys
import subprocess
import random
import unicodedata
MYPORT = 8123
MYGRO... | shingoichii/netpgm | mcc.py | Python | bsd-3-clause | 4,757 |
"""URL Shortener backend for Zinnia Hashids"""
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
from zinnia.settings import PROTOCOL
from zinnia_hashids.factory import hashids
def backend(entry):
"""
Hashids URL shortener backend for Zinnia.
"""
hashed_pk = h... | django-blog-zinnia/zinnia-url-shortener-hashids | zinnia_hashids/backend.py | Python | bsd-3-clause | 501 |
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from .job import PretrainedModelJob
__all__ = ['PretrainedModelJob']
| gheinrich/DIGITS-GAN | digits/pretrained_model/__init__.py | Python | bsd-3-clause | 174 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verify the settings that cause a set of programs to be created in
a specific build directory, and that no intermediate built fil... | Jet-Streaming/gyp | test/builddir/gyptest-default.py | Python | bsd-3-clause | 2,759 |
# Copyright (c) 2001-2005 Twisted Matrix Laboratories.
# See LICENSE for details.
import sys, os, sha
from twisted.trial import unittest
from twisted.words.protocols.jabber.component import ConnectComponentAuthenticator, ComponentInitiatingInitializer
from twisted.words.protocols import jabber
from twisted.words.pro... | santisiri/popego | envs/ALPHA-POPEGO/lib/python2.5/site-packages/twisted/words/test/test_jabbercomponent.py | Python | bsd-3-clause | 4,313 |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 5, s, t 10.1, s, q"
tags = "RichLabel"
import cocos
from cocos.director import director
from cocos.sprite import Sprite
from cocos.actions ... | eevee/cocos2d-mirror | test/test_rich_label.py | Python | bsd-3-clause | 1,040 |
import json
import logging
from datetime import date, datetime, timedelta
from elasticsearch.exceptions import ConnectionError
from nose.tools import eq_
from pyquery import PyQuery
from django.contrib.auth.models import Group
from django.http import QueryDict
from fjord.analytics import views
from fjord.base.tests ... | DESHRAJ/fjord | fjord/analytics/tests/test_views.py | Python | bsd-3-clause | 16,139 |
import re
locale_US = {'symbol': r'\$',
'currency': r'dollar[s]*',
'units': [('million', 10**6), ('m', 10**6), ('mn', 10**6), ('mil', 10**6),
('thousand', 10**3), ('k', 10**3),
('billion', 10**9), ('b', 10**9), ('bn', 10**9),
... | bgarrels/sky | sky/money.py | Python | bsd-3-clause | 3,699 |
from __future__ import unicode_literals
import datetime
import re
import sys
import warnings
from contextlib import contextmanager
from unittest import SkipTest, skipIf
from xml.dom.minidom import parseString
from django.contrib.auth.models import User
from django.core import serializers
from django.core.... | yephper/django | tests/timezones/tests.py | Python | bsd-3-clause | 59,648 |
#!/usr/bin/env python
# Author: Phani Vadrevu <pvadrevu@uga.edu>
import psycopg2
import config
from config import *
# Connect to database
try:
conn = psycopg2.connect("dbname=%s host=%s user=%s password=%s"
%(db_name,db_host,db_user,db_password))
except:
print "Unable to connect to database: "+db_nam... | phani-vadrevu/amico | amico_scripts/db_cleanup.py | Python | bsd-3-clause | 847 |
""" $lic$
Copyright (C) 2016-2020 by Tsinghua University and The Board of Trustees of
Stanford University
This program is free software: you can redistribute it and/or modify it under
the terms of the Modified BSD-3 License as published by the Open Source
Initiative.
This program is distributed in the hope that it wi... | stanford-mast/nn_dataflow | nn_dataflow/nns/lstm_phoneme.py | Python | bsd-3-clause | 1,086 |
J = sym.Matrix(ydot).jacobian(y) # EXERCISE: jacobian
J_cb = sym.lambdify((y, t) + k, J) # EXERCISE: (y, t) + k
| sympy/scipy-2017-codegen-tutorial | notebooks/exercise_lambdify_jac.py | Python | bsd-3-clause | 114 |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.exceptions import APIException
class ResourceDoesNotExist(APIException):
status_code = status.HTTP_404_NOT_FOUND
class SentryAPIException(APIException):
code = ''
me... | ifduyue/sentry | src/sentry/api/exceptions.py | Python | bsd-3-clause | 2,003 |