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 |
|---|---|---|---|---|---|
try:
import json
except ImportError:
import simplejson as json
from UserList import UserList
class Resource(object):
"""Object wrapper for resources.
Provides an object interface to resources returned by the Soundcloud API.
"""
def __init__(self, obj):
self.obj = obj
def __getst... | Fauxmoehawkeen/soundcloud-python-master | soundcloud/resource.py | Python | bsd-2-clause | 1,625 |
# Copyright (c) 2017, John Skinner
import unittest
import unittest.mock as mock
import bson
import pymongo.collection
import database.client
import batch_analysis.task_manager as manager
import batch_analysis.tasks.import_dataset_task as import_dataset_task
import batch_analysis.tasks.generate_dataset_task as generate... | jskinn/robot-vision-experiment-framework | batch_analysis/tests/test_task_manager.py | Python | bsd-2-clause | 16,573 |
#!/usr/bin/env python
import telnetlib
import time
import sys
import socket
TEL_PORT = 23
TEL_TO = 3
def write_cmd(cmd, conn):
cmd = cmd.rstrip()
conn.write(cmd + '\n')
time.sleep(1)
return conn.read_very_eager()
def telnet_conn(ip, port, timeout):
try:
conn = telnetlib.Telnet(ip, port, ... | bluetiki/pylab | telnet.py | Python | bsd-2-clause | 1,063 |
import json
import sys
if sys.version_info < (3, 0, 0):
from codecs import open
def build_index(posts, path):
index = []
for post in posts:
index.append({
"episode": post["episode"],
"date": post["date"],
"title": post["title"],
"subtitle": post["subtitle"],
"content": post["content"]
})
wit... | thomersch/Mikrowelle-OS | util/search.py | Python | bsd-2-clause | 386 |
__author__ = 'Frank Sehnke, sehnke@in.tum.de'
from environment import Environment
class GraphicalEnvironment(Environment):
""" Special type of environment that has graphical output and therefore needs a renderer.
"""
def __init__(self):
self.renderInterface = None
def setRenderI... | daanwierstra/pybrain | pybrain/rl/environments/serverInterface.py | Python | bsd-3-clause | 1,099 |
#-----------------------------------------------------------------
# pycparser: cdecl.py
#
# Example of the CDECL tool using pycparser. CDECL "explains" C type
# declarations in plain English.
#
# The AST generated by pycparser from the given declaration is traversed
# recursively to build the explanation. Note that th... | CtheSky/pycparser | examples/cdecl.py | Python | bsd-3-clause | 6,339 |
from glfwpy.glfw import *
import sys
import numpy as np
from OpenGL.GL import *
from OpenGL.arrays import ArrayDatatype
import ctypes
vertex = """
#version 330
in vec3 vin_position;
in vec3 vin_color;
uniform vec3 vu_displacement[2];
out vec3 vout_color;
void main(void)
{
vout_color = vin_color;
gl_Position... | enthought/glfwpy | examples/03_instanced_drawing.py | Python | bsd-3-clause | 4,686 |
from typing import Callable, List, Dict, Optional
import numpy as np
from typeguard import check_argument_types
from neuralmonkey.model.model_part import ModelPart
from neuralmonkey.decoders.beam_search_decoder import (BeamSearchDecoder,
SearchStepOutput)
from ne... | bastings/neuralmonkey | neuralmonkey/runners/beamsearch_runner.py | Python | bsd-3-clause | 5,107 |
import fileinput
for line in fileinput.input():
_line = line.strip()
# super dumb...
if _line.startswith('//') or _line.startswith('/*') or _line.startswith('*') or _line.startswith('*/'):
continue
print line.rstrip()
| gegenschall/cython-ldns | tools/stripcomments.py | Python | bsd-3-clause | 244 |
"""
-- Policy Network for decision making [more general]
"""
from nmt_uni import *
from layers import _p
import os
import time, datetime
import cPickle as pkl
# hyper params
TINY = 1e-7
PI = numpy.pi
E = numpy.e
A = 0.2
B = 1
class Controller(object):
def __init__(self, trng,
option... | nyu-dl/dl4mt-simul-trans | policy.py | Python | bsd-3-clause | 23,644 |
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import object
import pandas as pd
import os
import yaml
import astropy.io.votable as votable
import astropy.units as u
import urllib.request, urllib.error, urllib.parse
import xml.etree.ElementTre... | giacomov/3ML | threeML/utils/photometry/filter_library.py | Python | bsd-3-clause | 10,414 |
from django.conf.urls.defaults import *
urlpatterns = patterns('transaction.views',
(r'^create/(?P<pid>.*)$', 'create'),
(r'^edit/(?P<tid>.*)$', 'edit'),
)
| rimbalinux/LMD3 | transaction/urls.py | Python | bsd-3-clause | 171 |
# 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 1, s, t 2, s, t 3, s, t 4.1, s, t 4.2, s, q"
tags = "FadeIn, FadeOut, ColorLayer"
import pyglet
from pyglet.gl import *
import cocos
from ... | eevee/cocos2d-mirror | test/test_fadeout_layer.py | Python | bsd-3-clause | 802 |
# -*- coding: utf-8 -*-
"""
Implement the declarative descriptor.
"""
from __future__ import absolute_import
import warnings
import weakref
from .events import _DescriptorEvent, _KeywordEvent
from .utils import descriptor__get__, hybridmethod
from ...utils import ReferenceError
from ...exc import CauldronException, Ca... | alexrudy/Cauldron | Cauldron/ext/declarative/descriptor.py | Python | bsd-3-clause | 15,071 |
__author__ = 'flaviocaetano'
from django.utils.translation import ugettext_lazy as _
from admin_tools.dashboard import modules
import psutil
class PelicanAdmin(modules.DashboardModule):
"""Dashboard module for Pelican service administration.
"""
title = 'Pelican Admin'
template = 'pelican_admin.htm... | fjcaetano/pelican_admin | pelican_admin/modules.py | Python | bsd-3-clause | 757 |
#!/Library/Frameworks/Python.framework/Versions/3.1/bin/python3
import os, sys
sys.path.append(os.getcwd().split('slps')[0]+'slps/shared/python')
import slpsns, BGF3
import xml.etree.ElementTree as ET
cx = {}
class TopModel:
def getData(self, id):
if id in self.data.keys():
return self.data[id]
else:
retur... | grammarware/slps | shared/python/MBGF.py | Python | bsd-3-clause | 5,360 |
# -*- coding: utf-8 -*-
"""
test_sphinx
~~~~~~~~~~~
General Sphinx test and check output.
"""
import sys
import pytest
import sphinx
from ipypublish.sphinx.tests import get_test_source_dir
from ipypublish.tests.utils import HTML2JSONParser
@pytest.mark.sphinx(buildername="html", srcdir=get_test_source_... | chrisjsewell/ipypublish | ipypublish/sphinx/tests/test_bibgloss.py | Python | bsd-3-clause | 3,453 |
# -*- coding: utf-8 -*-
'''
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
import os
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEB... | goldhand/product-purchase | config/settings/local.py | Python | bsd-3-clause | 2,534 |
"""
sentry.models.event
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import logging
from django.db import models
from django.utils import timezone
from django.utils.datastructures import SortedDict
from django.utils.tr... | rdio/sentry | src/sentry/models/event.py | Python | bsd-3-clause | 5,941 |
import pytest
from porcupy.compiler import compile as compile_
def test_consts():
assert compile_('X = 4') == ''
assert compile_('X = 4; y = X') == 'p1z 4'
assert compile_('X = 4; Y = X; z = Y') == 'p1z 4'
with pytest.raises(ValueError) as exc_info:
compile_('X = 4; X = 5')
assert 'cann... | Perlence/porcupy | tests/test_assign.py | Python | bsd-3-clause | 12,924 |
import os
from pvfactors.geometry.timeseries import TsPointCoords, TsLineCoords
from pvfactors.geometry.pvrow import TsPVRow
from pvfactors.geometry.pvground import TsGround, TsGroundElement
import pandas as pd
import numpy as np
from pvfactors.geometry.pvrow import PVRow
from pvfactors.geometry.base import \
BaseS... | SunPower/pvfactors | pvfactors/tests/test_geometry/test_timeseries.py | Python | bsd-3-clause | 13,582 |
# -*- coding: utf-8 -*-
from collections import defaultdict
from nose.tools import eq_, ok_
from rest_framework.serializers import ValidationError
import amo
import amo.tests
import mkt
import mkt.feed.constants as feed
from mkt.feed import serializers
from mkt.feed.constants import COLLECTION_LISTING, COLLECTION_PR... | ngokevin/zamboni | mkt/feed/tests/test_serializers.py | Python | bsd-3-clause | 16,035 |
from blueice.test_helpers import *
from blueice.model import Model
def test_mcsource():
conf = test_conf(mc=True)
m = Model(conf)
s = m.sources[0]
bins = conf['analysis_space'][0][1]
assert s.events_per_day == 1000
assert s.fraction_in_range > 0.9999 # Ten sigma events happen sometimes..
... | JelleAalbers/blueice | tests/test_source.py | Python | bsd-3-clause | 494 |
import datetime
from decimal import Decimal
from django_factory import TestCase
from financial_transactions.models import (
Transaction,
)
class TransactionTestCase(TestCase):
def test_unicode(self):
trans = self.factory.make_one(
Transaction, memo=u'Sublime purchase',
date=d... | absoludity/django-financial-transactions | financial_transactions/tests/test_models.py | Python | bsd-3-clause | 664 |
##########################################################################
#
# Copyright (c) 2012-2014, John Haddon. All rights reserved.
# Copyright (c) 2013-2014, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | chippey/gaffer | python/GafferSceneTest/__init__.py | Python | bsd-3-clause | 5,457 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | ericmjl/bokeh | tests/unit/bokeh/util/test_version.py | Python | bsd-3-clause | 3,274 |
#!/usr/bin/env python
import os
import sys
def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sflindy.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
if __name__ == "__main__":
main()
| NorthIsUp/sf-lindy | src/sflindy/manage.py | Python | bsd-3-clause | 277 |
import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.openid import OpenID
from config import basedir
from flask_debugtoolbar import DebugToolbarExtension
app = Flask(__name__)
app.config.from_object('config')
db = SQLAlchemy(app)
lm = Log... | serdimoa/vincenzoext | app/__init__.py | Python | bsd-3-clause | 506 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup, Command
except ImportError:
from distutils.core import setup, Command
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
datadir = os.path.dirname(__file__)
with op... | westurner/provis | setup.py | Python | bsd-3-clause | 2,041 |
def extractDellstoriesWordpressCom(item):
'''
Parser for 'dellstories.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', 'translated'),
('L... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractDellstoriesWordpressCom.py | Python | bsd-3-clause | 562 |
#!/usr/bin/python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, 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 code mu... | WuNL/mylaptop | install/_setup_util.py | Python | bsd-3-clause | 12,274 |
import math
import torch
from .Module import Module
class TemporalConvolution(Module):
def __init__(self, inputFrameSize, outputFrameSize, kW, dW=1):
super(TemporalConvolution, self).__init__()
self.inputFrameSize = inputFrameSize
self.outputFrameSize = outputFrameSize
self.kW = ... | RPGOne/Skynet | pytorch-master/torch/legacy/nn/TemporalConvolution.py | Python | bsd-3-clause | 1,969 |
# Django settings for breeze project.
from unipath import Path
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
PROJECT_DIR = Path(__file__).ancestor(3)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_p... | MFoster/breeze | breeze/breeze/settings/base.py | Python | bsd-3-clause | 6,127 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_flaskpypi
----------------------------------
Tests for `flaskpypi` module.
"""
import pytest
from flaskpypi import flaskpypi
# Code from https://wiki.python.org/moin/PyPISimple
from xml.etree import ElementTree
from urllib.request import urlopen
def get_distri... | waynew/flaskpypi | tests/test_flaskpypi.py | Python | bsd-3-clause | 752 |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# 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
# notic... | turon/openthread | tools/harness-automation/cases/reed_5_2_5.py | Python | bsd-3-clause | 1,875 |
from ipctest import IpcTest
class TestLeaves(IpcTest):
def test_workspace_leaves(self, i3):
ws_name = self.fresh_workspace()
con1 = self.open_window()
i3.command('[id=%s] floating enable' % con1)
self.open_window()
self.open_window()
ws = [w for w in i3.get_tree().... | acrisci/i3ipc-python | test/test_leaves.py | Python | bsd-3-clause | 398 |
# -*- coding: utf-8 -*-
# __author__ = chenchiyuan
from __future__ import division, unicode_literals, print_function
from hawaii.apps.weixin.models import App
from hawaii.apps.weixin.response import MessageResponse, EventResponse
from hawaii.apps.weixin.weixin.interface import StateInterface
class NoCacheState(State... | chenchiyuan/hawaii | hawaii/apps/weixin/states.py | Python | bsd-3-clause | 1,561 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de
# Aplicacion de las TIC basadas en Fuentes Abiertas, Spain.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistribution... | helix84/activae | src/CTK_trunk/CTK/Tab.py | Python | bsd-3-clause | 6,693 |
# -*- coding: utf-8 -*-
#
# Gateway documentation build configuration file, created by
# sphinx-quickstart on Tue Sep 25 06:46:30 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | matrixise/gateway | docs/conf.py | Python | bsd-3-clause | 8,914 |
#################################################################################
# Copyright (c) 2013, Pacific Biosciences of California, 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:
# ... | PacificBiosciences/rDnaTools | src/pbrdna/__init__.py | Python | bsd-3-clause | 1,847 |
"""scvi-tools."""
# Set default logging handler to avoid logging with logging.lastResort logger.
import logging
from logging import NullHandler
from ._constants import _CONSTANTS
from ._settings import settings
from . import data, model
# https://github.com/python-poetry/poetry/pull/2366#issuecomment-652418094
# htt... | YosefLab/scVI | scvi/__init__.py | Python | bsd-3-clause | 791 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
human_curl.debug
~~~~~~~~~~~~~~~~~~~~~~~~~~
Debuggging tests for human_curl
:copyright: (c) 2011 by Alexandr Lispython (alex@obout.ru).
:license: BSD, see LICENSE for more details.
"""
import logging
from .tests import *
logger = logging.getLogger("human_curl")
lo... | llange/human_curl | debug.py | Python | bsd-3-clause | 736 |
import numpy as np
import pandas as pd
from bokeh.plotting import *
# Here is some code to read in some stock data from the Yahoo Finance API
AAPL = pd.read_csv(
"http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000",
parse_dates=['Date'])
GOOG = pd.read_csv(
"http://ichart.yahoo.com/table.csv?s=GOOG&... | sahat/bokeh | sphinx/source/tutorial/exercises/stocks.py | Python | bsd-3-clause | 1,939 |
import chainer
def main():
return chainer.datasets.get_mnist(withlabel=False)[0]
| fukatani/CW_gui | examples/mnist/get_mnist_prediction.py | Python | bsd-3-clause | 87 |
# -*- coding: utf-8 -*-
"""
__init__
A translator using the micrsoft translation engine documented here:
http://msdn.microsoft.com/en-us/library/ff512419.aspx
:copyright: © 2011 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
__all__ = ['Transla... | Akoten/Microsoft-Translator-Python-API | __init__.py | Python | bsd-3-clause | 8,249 |
import re
class CommandError(Exception):
pass
class BaseCommand():
"""
Base command, this will accept and handle some generic features of all commands.
Like error handling, argument retrieving / checking
"""
def __init__(self, args):
"""
Initialize the class
"""
... | snelis/snelis | snelis/management/commands/__init__.py | Python | bsd-3-clause | 1,601 |
from fiona import crs
def test_proj_keys():
assert len(crs.all_proj_keys) == 85
assert 'proj' in crs.all_proj_keys
assert 'no_mayo' in crs.all_proj_keys
def test_from_string():
# A PROJ.4 string with extra whitespace.
val = crs.from_string(
" +proj=longlat +ellps=WGS84 +datum=WGS84 +no_d... | sgillies/Fiona | tests/test_crs.py | Python | bsd-3-clause | 1,622 |
import os
import xlrd
import configparser
import logging
from ..entities import product
def process_cell(cell):
"""Converts the given cell to the appropriate value."""
if cell.value == 'NA':
return ''
ttype = cell.ctype # get the cell's 'type'
if ttype == xlrd.XL_CELL_EMPTY or ttype == xlrd.XL... | johnsaigle/flush-tool | lib/loaders/product_loader.py | Python | bsd-3-clause | 4,102 |
from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.config import ConfigValidationError
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from txircd.modules.xlinebase import XLineBase
from txircd.utils import durationToSeconds, ircLower, now
from zope.int... | ElementalAlchemist/txircd | txircd/modules/core/bans_gline.py | Python | bsd-3-clause | 5,499 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Quantization'] , ['MovingMedian'] , ['Seasonal_DayOfWeek'] , ['LSTM'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Quantization/model_control_one_enabled_Quantization_MovingMedian_Seasonal_DayOfWeek_LSTM.py | Python | bsd-3-clause | 168 |
import unittest
import json
import logintc
class TestLoginTCClient(unittest.TestCase):
def set_response(self, method, url, headers, body):
full_url = ''.join(['https://cloud.logintc.com/api', url])
self.responses[(method, full_url)] = (headers, body)
def verify_request(self, method, url, bod... | logintc/logintc-python | logintc/tests/test.py | Python | bsd-3-clause | 14,005 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('courses', '0002_auto_20150403_2321'),
]
operations = [
migrations.AddField(
model_name='course',
nam... | afg984/nthucourses | courses/migrations/0003_auto_20150403_2325.py | Python | bsd-3-clause | 630 |
from horizon_contrib.utils.dotdict import dotdict, list_to_dotdict, to_dotdict
| michaelkuty/horizon-contrib | horizon_contrib/utils/__init__.py | Python | bsd-3-clause | 79 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Client module for connecting to and interacting with SmartyStreets API
"""
import json
import numbers
import requests
from .data import Address, AddressCollection
from .exceptions import SmartyStreetsError, ERROR_CODES
def validate_args(f):
"""
Ensures that... | audantic/smartystreets.py | smartystreets/client.py | Python | bsd-3-clause | 6,663 |
import datetime
from django.conf import settings
from django.db import DEFAULT_DB_ALIAS
from django.test import TestCase, skipIfDBFeature
from django.utils import tzinfo
from models import Donut, RumBaba
class DataTypesTestCase(TestCase):
def test_boolean_type(self):
d = Donut(name='Apple Fritter')
... | heracek/django-nonrel | tests/regressiontests/datatypes/tests.py | Python | bsd-3-clause | 4,241 |
__all__ = ['threshold_adaptive',
'threshold_otsu',
'threshold_yen',
'threshold_isodata',
'threshold_li', ]
import numpy as np
from scipy import ndimage as ndi
from ..exposure import histogram
from .._shared.utils import assert_nD
import warnings
def threshold_adaptive(imag... | ClinicalGraphics/scikit-image | skimage/filters/thresholding.py | Python | bsd-3-clause | 14,107 |
from __future__ import absolute_import
from rest_framework.response import Response
from sentry.api.base import StatsMixin
from sentry.api.bases.group import GroupEndpoint
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.api.serializers import serialize
from sentry.api.serializers.models.environment... | mitsuhiko/sentry | src/sentry/api/endpoints/group_environment_details.py | Python | bsd-3-clause | 2,927 |
import numpy as np
import os
import time
from ..utils import *
def _costMAD(block1, block2):
block1 = block1.astype(np.float)
block2 = block2.astype(np.float)
return np.mean(np.abs(block1 - block2))
def _minCost(costs):
h, w = costs.shape
if costs[h/2, w/2] == 0:
return np.int((h-1)/2),... | beyondmetis/scikit-video | skvideo/motion/block.py | Python | bsd-3-clause | 38,685 |
import json
import requests
import types
import pandas as pd
from datetime import datetime, date
import gzip
import io
from ..utils.simplenamespace import *
from ..utils.query_helper import query
from ..utils.pi_helper import *
import collections
class PiRest(object):
"""create Pi object that can interact with R... | HKV-products-services/hkvfewspy | hkvfewspy/io/rest_fewspi.py | Python | bsd-3-clause | 21,087 |
from django.conf import settings
from django.utils.importlib import import_module
from django.utils.module_loading import module_has_submodule
for app in settings.INSTALLED_APPS:
if '.' not in app:
continue
mod = import_module(app)
try:
import_module('%s.internal_urls' % app)
except:
... | ddanier/django_internal_urls | django_internal_urls/autoload.py | Python | bsd-3-clause | 393 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# 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
# au... | faircloth-lab/cookiecutter-protocols | {{cookiecutter.repo_name}}/conf.py | Python | bsd-3-clause | 8,239 |
import pygame
from pygame.locals import *
from math import sin
import states
class EndEvent(object):
text = [
"Ah, hello there. Welcome to the center of the moon!",
"Oh, me? I'm just the man in the moon. I live here.",
"Don't act so shocked! It's rude you know.",
"I don't g... | Cynerva/jttcotm | end.py | Python | bsd-3-clause | 3,326 |
#!/usr/bin/python
from fsm import parse_automaton, accept
import re
__author__ = 'Roland'
import sys
keywords = ['float', 'char', 'print', 'input', 'break', 'continue', 'return', 'def', 'if', 'elif',
'else', 'while', 'or', 'and', 'not']
operators = ['=', '<', '>', '==', '>=', '<=', '!=', '+', '-', '*', '... | rolisz/hw3 | LFTC/L2/lexer.py | Python | bsd-3-clause | 6,145 |
# flake8: noqa: F401
from pandas.core.arrays.sparse.accessor import SparseAccessor, SparseFrameAccessor
from pandas.core.arrays.sparse.array import (
BlockIndex,
IntIndex,
SparseArray,
_make_index,
)
from pandas.core.arrays.sparse.dtype import SparseDtype
| TomAugspurger/pandas | pandas/core/arrays/sparse/__init__.py | Python | bsd-3-clause | 273 |
#!/usr/bin/env python
##
## See COPYING file distributed along with the ncanda-data-integration package
## for the copyright and license terms
##
from __future__ import print_function
from builtins import str
import os
import re
import tempfile
import shutil
from sibispy import sibislogger as slog
from sibispy impo... | sibis-platform/ncanda-data-integration | scripts/redcap/import_mr_sessions_stroop.py | Python | bsd-3-clause | 5,597 |
# Copyright (c) 2016, Science and Technology Facilities Council
# This software is distributed under a BSD licence. See LICENSE.txt.
"""
Tests for mrcmemmap.py
"""
# Import Python 3 features for future-proofing
from __future__ import (absolute_import, division, print_function,
unicode_literals... | ccpem/mrcfile | tests/test_mrcmemmap.py | Python | bsd-3-clause | 2,865 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "LinearTrend", cycle_length = 5, transform = "RelativeDifference", sigma = 0.0, exog_count = 0, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_LinearTrend/cycle_5/ar_/test_artificial_32_RelativeDifference_LinearTrend_5__0.py | Python | bsd-3-clause | 273 |
from __future__ import absolute_import
from __future__ import with_statement
import sys
import time
from kombu.tests.utils import redirect_stdouts
from mock import Mock, patch
import celery.utils.timer2 as timer2
from celery.tests.utils import Case, skip_if_quick
class test_Entry(Case):
def test_call(self):
... | mozilla/firefox-flicks | vendor-local/lib/python/celery/tests/utilities/test_timer2.py | Python | bsd-3-clause | 4,966 |
from .fields import CharArrayField, TextArrayField, IntegerArrayField
| aino/django-arrayfields | arrayfields/__init__.py | Python | bsd-3-clause | 70 |
from bisect import bisect
from uhashring.ring_ketama import KetamaRing
from uhashring.ring_meta import MetaRing
class HashRing:
"""Implement a consistent hashing ring."""
def __init__(self, nodes=[], **kwargs):
"""Create a new HashRing given the implementation.
:param nodes: nodes used to c... | ultrabug/uhashring | uhashring/ring.py | Python | bsd-3-clause | 11,224 |
from __future__ import with_statement
import sys
import logging
import warnings
import django
from django.conf import settings
try:
from django.conf.urls import patterns, url
except ImportError: # Django < 1.4
from django.conf.urls.defaults import patterns, url
from django.core.exceptions import ObjectDoesNotEx... | rtucker-mozilla/WhistlePig | vendor-local/lib/python/tastypie/resources.py | Python | bsd-3-clause | 94,814 |
# proxy module
from __future__ import absolute_import
from enable.base_tool import *
| enthought/etsproxy | enthought/enable/base_tool.py | Python | bsd-3-clause | 85 |
"""
Models for code snippets and related data.
Most of these models also have custom managers defined which add
convenient shortcuts for repetitive or common bits of logic; see
``managers.py`` in this directory.
"""
import datetime, re
from django.db import connection, models
from django.template.defaultfilters impo... | girasquid/cab | cab/models.py | Python | bsd-3-clause | 7,952 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('travelogue', '0004_auto_20150418_1655'),
]
operations = [
migrations.AddField(
model_name='tripnote',
... | rahulvgmail/TripMapR | TripMapR/travelogue/migrations/0005_auto_20150420_1747.py | Python | bsd-3-clause | 770 |
##
##
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 09/10/14 #3623 randerso Manually created, do not regenerate
#
##
class SiteActivationNotification(object):
def __ini... | mjames-upc/python-awips | dynamicserialize/dstypes/com/raytheon/uf/common/site/notify/SiteActivationNotification.py | Python | bsd-3-clause | 1,716 |
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 27 10:08:25 2018
@author: cdeline
Using pytest to create unit tests for gencumulativesky.
Note that this can't be included in the repo until TravisCI has a Linux version of gencumsky
set up in .travis.yml
to run unit tests, run pytest from the command line in the bifaci... | NREL/bifacial_radiance | tests/test_gencumsky.py | Python | bsd-3-clause | 4,169 |
# -*- coding: utf-8 -*-
#
# 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.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
imp... | ziggi0703/mymeal | docs/conf.py | Python | bsd-3-clause | 8,168 |
#!/usr/bin/env python
import rospy
from flexbe_core import EventState, Logger
from flexbe_core.proxy import ProxyPublisher
from smach import CBState
class StartCheck(EventState):
'''
Example for a state to demonstrate which functionality is available for state implementation.
This example lets the behavior wai... | tu-darmstadt-ros-pkg/hector_flexbe_behavior | hector_flexbe_states/src/hector_flexbe_states/StartCheck.py | Python | bsd-3-clause | 2,388 |
#!/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.
"""code generator for GL/GLES extension wrangler."""
import os
import collections
import re
import sys
GL_FUNCTIONS = [
{ 'return... | keishi/chromium | ui/gl/generate_bindings.py | Python | bsd-3-clause | 57,794 |
from yoyo.connections import parse_uri, unparse_uri
def _test_parse_uri(connection_string, expected_uri_tuple):
uri_tuple = parse_uri(connection_string)
assert isinstance(uri_tuple, tuple)
assert (uri_tuple == expected_uri_tuple)
def _test_unparse_uri(uri_tuple, expected_connection_string):
connecti... | xlvector/yoyo-migrations | yoyo/tests/test_parse_uri.py | Python | bsd-3-clause | 1,061 |
# -*- coding: utf-8 -*-
import rapidsms
import datetime
from rapidsms.apps.base import AppBase
from .models import Poll
from django.db.models import Q
from rapidsms_httprouter.models import Message,MessageBatch
class App(AppBase):
def respond_to_message(self,message,response_msg,poll):
if response_msg ==... | unicefuganda/edtrac | edtrac_project/rapidsms_polls/poll/app.py | Python | bsd-3-clause | 3,327 |
# -*- coding: utf-8 -*-
""" Friendly Dates and Times """
# Disable pylint's invalid name warning. 'tz' is used in a few places and it
# should be the only thing causing pylint to include the warning.
# pylint: disable-msg=C0103
import calendar
import datetime
import locale
import os
import pytz
import random
# Some... | MVReddy/WhenPy | when.py | Python | bsd-3-clause | 22,733 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Patrols the edges of the map going clockwise. Just drives around in circles,
taking pains not to hit a wall.
When we see a wall, turn right a little.
"""
from courier import RoboLink
robot = RoboLink.connect(name="Patroller", scanner=2, engine=5)
# ... | gcr/robots | client_py/patrol.py | Python | bsd-3-clause | 1,048 |
import theano.sandbox.cuda.basic_ops as sbcuda
import numpy as np
import load_data
import realtime_augmentation as ra
import time
import sys
import os
import json
from custom_for_keras import input_generator
from datetime import datetime, timedelta
from custom_keras_model_x_cat import kaggle_x_cat
from keras.optimizers... | garbersc/keras-galaxies | try_convnet_keras_x_cats.py | Python | bsd-3-clause | 10,142 |
import logging
import uuid
from datetime import timedelta
from typing import List, Optional
import stripe
from django.apps import apps
from django.db import IntegrityError, models, transaction
from django.utils import dateformat, timezone
from django.utils.encoding import smart_str
from stripe.api_resources.abstract.a... | pydanny/dj-stripe | djstripe/models/base.py | Python | bsd-3-clause | 35,315 |
from django.contrib import admin
from models import *
import datetime
admin.site.register(PingHost)
admin.site.register(PingResult)
| alextreme/Django-Bingo | ping/admin.py | Python | bsd-3-clause | 133 |
import factory
from test_utils import TestCase as BaseTestCase
from mozillians.announcements import models
class TestCase(BaseTestCase):
pass
class AnnouncementFactory(factory.DjangoModelFactory):
FACTORY_FOR = models.Announcement
title = factory.Sequence(lambda n: 'Test Announcement {0}'.format(n))
... | glogiotatidis/mozillians-new | mozillians/announcements/tests/__init__.py | Python | bsd-3-clause | 396 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.sites import AdminSite
from django.contrib.contenttypes.generic import (
generic_inlineformset_factory, GenericTabularInline)
from django.form... | vsajip/django | tests/regressiontests/generic_inline_admin/tests.py | Python | bsd-3-clause | 17,051 |
# -*- 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 'ObjAttribute.db_value'
db.delete_column('objects_objattribute', 'db_value')
db.ren... | TaliesinSkye/evennia | src/objects/migrations/0020_remove_old_attr_value_field.py | Python | bsd-3-clause | 8,327 |
#
# Catalogs.py -- Catalogs plugin for fits viewer
#
# 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.
#
from ginga.misc import Bunch, Future
from ginga.gtkw import FitsImag... | astrofrog/ginga | ginga/gtkw/plugins/Catalogs.py | Python | bsd-3-clause | 31,943 |
import dataStructures
import logging, os
log = logging.getLogger("tray_item")
log.setLevel(logging.WARN)
class TrayItem:
"""
Parent Class for all items in a tray.
"""
def __init__(self):
self.selected = False
self.changed = False
dataStructures.changingItems.appe... | tschalch/pyTray | src/dataStructures/tray_item.py | Python | bsd-3-clause | 847 |
from __future__ import absolute_import
from django import forms
from django.db import IntegrityError, transaction
from django.http import HttpResponse
from django.views.generic import View
from django.template.loader import render_to_string
from django.utils import timezone
from django.utils.safestring import mark_saf... | mitsuhiko/sentry | src/sentry/web/frontend/error_page_embed.py | Python | bsd-3-clause | 5,673 |
from core import send_request
from people import get_me
from projects import get_all_active_projects, get_project
from todo_lists import get_todo_list, get_todo, get_all_active_todo_lists
from stars import get_starred_projects
try:
from MY_BC import BC
except ImportError:
from core import MY_BC_NUMBER as BC
cl... | jstacoder/basehead | basehead/basecamp.py | Python | bsd-3-clause | 4,557 |
# Copyright (C) 2010 Google 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 code must retain the above copyright
# notice, this list of conditions and the ... | ric2b/Vivaldi-browser | chromium/third_party/blink/tools/blinkpy/web_tests/port/base.py | Python | bsd-3-clause | 99,778 |
from __future__ import annotations
import random
import pytest
import scitbx.matrix
from cctbx import sgtbx
from cctbx.sgtbx import bravais_types
from dials.algorithms.indexing.max_cell import find_max_cell
from dials.array_family import flex
@pytest.fixture(params=bravais_types.acentric)
def setup(request):
... | dials/dials | tests/algorithms/indexing/test_max_cell.py | Python | bsd-3-clause | 2,598 |
from settings.secure import OAUTH_TOKEN, CANVAS_URL
from canvas_sdk.methods import courses
from canvas_sdk.utils import get_all_list_data
from canvas_sdk import RequestContext
import sys
# Get the course ID from the command line
course_id = None
if len(sys.argv) == 2:
course_id = sys.argv[1]
else:
sys.exit("Er... | Harvard-ATG/canvas-utils | skeleton/get_users_emails.py | Python | bsd-3-clause | 1,128 |
import numpy
import random
import math
from exit_weight import *
from privexUtils import resolution
#def Noise(sensitivity, epsilon, delta, fingerprint, sigma):
def Noise(sigma, fingerprint, sum_of_sq, p_exit):
sigma_i = p_exit*sigma/math.sqrt(sum_of_sq)
random_sample = random.gauss(0,sigma_i)
return ran... | TariqEE/PrivEx | S2/S2-netified/noise.py | Python | bsd-3-clause | 345 |
"""
Plotting (requires matplotlib)
"""
from colorsys import hsv_to_rgb, hls_to_rgb
from libmp import NoConvergence
class VisualizationMethods(object):
plot_ignore = (ValueError, ArithmeticError, ZeroDivisionError, NoConvergence)
def plot(ctx, f, xlim=[-5,5], ylim=None, points=200, file=None, dpi=None,
singul... | mattpap/sympy-polys | sympy/mpmath/visualization.py | Python | bsd-3-clause | 9,017 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['Lag1Trend'] , ['Seasonal_DayOfWeek'] , ['AR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_None/model_control_one_enabled_None_Lag1Trend_Seasonal_DayOfWeek_AR.py | Python | bsd-3-clause | 155 |
import click
import os
import os.path
import ntpath
import serial
import sys
import prosflasher.ports
import prosflasher.upload
import prosconfig
from proscli.utils import default_cfg, AliasGroup
from proscli.utils import get_version
@click.group(cls=AliasGroup)
def flasher_cli():
pass
@flashe... | purduesigbots/purdueros-cli | proscli/flasher.py | Python | bsd-3-clause | 8,643 |