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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from lxml import html
from tinydb import TinyDB, Query
import requests
from . import get_logger, CONFIG
class TracklistManager(object):
db = TinyDB(CONFIG["technical"]["tracklist-db"], indent=2, separators=(',', ': '))
ge... | julien-hadleyjack/genrss-py | src/genrss/tracklist.py | Python | bsd-2-clause | 1,857 |
import os
from glob import glob
from setuptools import setup, find_packages
# Setup flags and parameters
pkg_name = 'libbot' # top-level package name
# Cache readme contents for use as long_description
readme = open('README.md').read()
# Call setup()
setup(
name=pkg_name,
version='0.1',
description='Library o... | IEEERobotics/libbot | setup.py | Python | bsd-2-clause | 970 |
"""Misc support code.
Copyright (c) 2015 Civic Knowledge. This file is licensed under the terms of
the Revised BSD License, included in this distribution as LICENSE.txt
"""
from collections import OrderedDict, defaultdict, Mapping, deque, MutableMapping, Callable
from functools import partial, reduce, wraps
import j... | CivicKnowledge/ambry | ambry/util/__init__.py | Python | bsd-2-clause | 39,947 |
import os
from setuptools import find_packages, setup
root = os.path.dirname(os.path.realpath(__file__))
long_description = open(os.path.join(root, 'README.rst')).read()
setup(
name='range-regex',
version='1.0.3',
description='Python numeric range regular expression generator',
long_description=long_d... | dimka665/range-regex | setup.py | Python | bsd-2-clause | 628 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2018-03-11 17:04
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('board', '0006_merge_20180311_1702'),
]
operations ... | hangpark/kaistusc | apps/board/migrations/0007_auto_20180311_1704.py | Python | bsd-2-clause | 1,864 |
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# 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 of condit... | programa-stic/barf-project | barf/arch/__init__.py | Python | bsd-2-clause | 1,406 |
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2020 David Shah <dave@ds0.me>
# Copyright (c) 2020 Florent Kermarrec <florent@enjoy-digital.fr>
# SPDX-License-Identifier: BSD-2-Clause
from litex.build.generic_platform import Pins, Subsignal, IOStandard, Misc
from litex.build.xilinx import XilinxPlatform, Viva... | litex-hub/litex-boards | litex_boards/platforms/sqrl_xcu1525.py | Python | bsd-2-clause | 14,980 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
requests_cache.backends.base
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Contains BaseCache class which can be used as in-memory cache backend or
extended to support persistence.
"""
from datetime import datetime
import hashlib
from copy import copy
from io import Byt... | YetAnotherNerd/requests-cache | requests_cache/backends/base.py | Python | bsd-2-clause | 8,344 |
from educollections import ArrayList
def print_list_state(lst):
print('Size is', lst.size())
print('Contents are', lst)
print()
arr = ArrayList(10)
print('Capacity is', arr.capacity())
print_list_state(arr)
for i in range(10):
print('Prepend', i)
arr.prepend(i)
print_list_state(arr)
for i in ... | nkraft/educollections | test_educollections.py | Python | bsd-2-clause | 1,009 |
"""Sections variable used for grouping Gjoneska 2015 GO IDs."""
__copyright__ = "Copyright (C) 2016-2018, DV Klopfenstein, H Tang. All rights reserved."
__author__ = "DV Klopfenstein"
SECTIONS = [ # 18 sections
("immune", [ # 15 GO-headers
"GO:0002376", # BP 564 L01 D01 M immune system process
... | tanghaibao/goatools | goatools/test_data/sections/gjoneska_pfenning.py | Python | bsd-2-clause | 9,848 |
# *****************************************************************
# Copyright (c) 2013 Massachusetts Institute of Technology
#
# Developed exclusively at US Government expense under US Air Force contract
# FA8721-05-C-002. The rights of the United States Government to use, modify,
# reproduce, release, perform, disp... | y4n9squared/HEtest | hetest/python/circuit_generation/circuit_common/file_handle_object.py | Python | bsd-2-clause | 2,432 |
# Copyright (c) 2016, Matt Layman
'''Storage services which use the file system to store data'''
| mblayman/markwiki | markwiki/storage/fs/__init__.py | Python | bsd-2-clause | 97 |
import re
from binascii import unhexlify
from collections import namedtuple
from itertools import starmap
from streamlink.compat import urljoin, urlparse
__all__ = ["load", "M3U8Parser"]
# EXT-X-BYTERANGE
ByteRange = namedtuple("ByteRange", "range offset")
# EXT-X-KEY
Key = namedtuple("Key", "method uri iv key_fo... | javiercantero/streamlink | src/streamlink/stream/hls_playlist.py | Python | bsd-2-clause | 10,407 |
import functools
import itertools
from ..backend_object import BackendObject
def normalize_types(f):
@functools.wraps(f)
def normalizer(self, region, o):
'''
Convert any object to an object that we can process.
'''
if isinstance(o, IfProxy):
return NotImplemented
... | zhuyue1314/claripy | claripy/vsa/valueset.py | Python | bsd-2-clause | 9,471 |
import matplotlib.pyplot as plt
import numpy as np
import os
import time
import yaml
from sklearn.learning_curve import learning_curve
from keras.layers.core import Dense, Activation, Dropout
from keras.layers.recurrent import LSTM
from keras.models import Sequential, model_from_yaml
from keras.wrappers.scikit_learn i... | jayArnel/crimemapping | crimeprediction/network.py | Python | bsd-2-clause | 6,415 |
from JumpScale import j
import unittest
import JumpScale.portal
descr = """
test jpackages over rest to portal (appserver)
"""
organization = "jumpscale"
author = "kristof@incubaid.com"
license = "bsd"
version = "1.0"
category = "appserver.jpackages.rest,portal"
enable=True
priority=5
class TEST(unittest.TestCase):... | Jumpscale/jumpscale6_core | apps/gridportal/tests/jpackagesRest__test.py | Python | bsd-2-clause | 1,238 |
try:
import simplejson as json
except ImportError:
import json
import functools
from cgi import parse_header
def wrap_json(func=None, *, encoder=json.JSONEncoder, preserve_raw_body=False):
"""
A middleware that parses the body of json requests and
encodes the json responses.
NOTE: this middle... | jespino/anillo | anillo/middlewares/json.py | Python | bsd-2-clause | 3,333 |
from __future__ import absolute_import
import re, os, sys
from clay import app
import clay.config
from flask import make_response, request, redirect, render_template, url_for
from epubber.fimfic_epubgen import FimFictionEPubGenerator
site_epub_classes = [
FimFictionEPubGenerator
]
accesslog = clay.config.get... | revarbat/epubber | epubber/views/main.py | Python | bsd-2-clause | 2,968 |
# -*- coding: utf-8 -*-
"""
PyLTI is module that implements IMS LTI in python
The API uses decorators to wrap function with LTI functionality.
"""
VERSION = "0.3.2" # pragma: no cover
| layus/pylti | pylti/__init__.py | Python | bsd-2-clause | 185 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import matplotlib as mpl
import matplotlib.pyplot as plt
from .theme import theme_base
class theme_xkcd(theme_base):
"""
xkcd theme
The theme internaly uses the settings from pyplot.xkcd().
""... | yhat/ggplot | ggplot/themes/theme_xkcd.py | Python | bsd-2-clause | 1,582 |
# THREE GOLD STARS
# Sudoku [http://en.wikipedia.org/wiki/Sudoku]
# is a logic puzzle where a game
# is defined by a partially filled
# 9 x 9 square of digits where each square
# contains one of the digits 1,2,3,4,5,6,7,8,9.
# For this question we will generalize
# and simplify the game.
# Define a procedure, check_s... | ezralalonde/cloaked-octo-sansa | 03/hw/06.py | Python | bsd-2-clause | 1,984 |
###############################################################################
## Imports
###############################################################################
# Django
from django import template
from django.forms.forms import BoundField
####################################################################... | scdoshi/django-bits | bits/templatetags/custom_utils.py | Python | bsd-2-clause | 1,358 |
# The Nexus software is licensed under the BSD 2-Clause license.
#
# You should have recieved a copy of this license with the software.
# If you did not, you can find one at the following link.
#
# http://opensource.org/licenses/bsd-license.php
import time
def Rank(self, parts, fromloc, overriderank, server=None):
... | TheArchives/Nexus | core/globals.py | Python | bsd-2-clause | 18,259 |
#
# Copyright (c) 2017 Intel Corporation
# SPDX-License-Identifier: BSD-2-Clause
#
from numba import njit, prange
import numpy as np
import argparse
import time
def kde(X):
b = 0.5
points = np.array([-1.0, 2.0, 5.0])
N = points.shape[0]
n = X.shape[0]
exps = 0
# "prange" in a normal function i... | jriehl/numba | examples/kernel-density-estimation/kernel_density_estimation.py | Python | bsd-2-clause | 1,135 |
# -*- coding: utf-8 -*-
from django.db.models import Q
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.utils.timezone import now
from django.conf import settings
from django import template # import Template,Context
from djang... | hdknr/paloma | src/paloma/models.py | Python | bsd-2-clause | 33,915 |
# -*- coding: UTF-8 -*-
# Copyright 2011-2018 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
from __future__ import unicode_literals
from builtins import str
import six
import datetime
from django.db import models
from django.db.models import Q
from django.conf import settings
from django.core.validat... | khchine5/xl | lino_xl/lib/cal/models.py | Python | bsd-2-clause | 36,436 |
#!/usr/bin/env python
"""
Benchmark how long it takes to set 10,000 keys in the database.
"""
from __future__ import print_function
import trollius as asyncio
from trollius import From
import logging
import trollius_redis
import time
from six.moves import range
if __name__ == '__main__':
loop = asyncio.get_event_l... | benjolitz/trollius-redis | examples/benchmarks/speed_test.py | Python | bsd-2-clause | 1,736 |
import os
import unittest
from math import pi
import numpy
from kiva import agg
def save_path(filename):
return filename
def draw_arcs(gc, x2, y2, radiusstep=25.0):
gc.set_stroke_color((0.2,0.2,0.2)) # lightgray
gc.move_to(0, 0)
gc.line_to(100, 0)
gc.line_to(x2, y2)
gc.stroke_path()
gc... | tommy-u/enable | integrationtests/kiva/agg/test_arc.py | Python | bsd-3-clause | 3,344 |
# Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
import os
import time
import shutil
import traceback
import signal
from collections import OrderedDict
import re
import flask
import gevent
import gevent.event
import gevent.queue
from config import config_value
from . import utils
from status impo... | batra-mlp-lab/DIGITS | digits/scheduler.py | Python | bsd-3-clause | 18,363 |
"Run the keyword-names example pipeline, which has keyword-style inputs."
import kiveapi
import example_tools
# Use HTTPS on a real server, so your password is encrypted.
# Don't put your real password in source code, store it in a text file
# that is only readable by your user account or some more secure storage.
ses... | cfe-lab/Kive | api/example_5.py | Python | bsd-3-clause | 1,920 |
__all__ = ['Kane']
from sympy import Symbol, zeros, Matrix, diff, solve_linear_system_LU, eye
from sympy.utilities import default_sort_key
from sympy.physics.mechanics.essential import ReferenceFrame, dynamicsymbols
from sympy.physics.mechanics.particle import Particle
from sympy.physics.mechanics.point import Point
f... | ichuang/sympy | sympy/physics/mechanics/kane.py | Python | bsd-3-clause | 37,447 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import csv
from io import TextIOWrapper
import six
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.urls import reverse
from django.db import transaction
from django.http import HttpResponseRedirect
from django... | lsgunth/rapidsms | rapidsms/contrib/registration/views.py | Python | bsd-3-clause | 4,844 |
# Copyright (c) 2014, Salesforce.com, 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... | fritzo/distributions | distributions/tests/test_models.py | Python | bsd-3-clause | 20,478 |
import HTMLParser
import json
from xml.etree import ElementTree
from django.conf import settings
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse, HttpResponseBadRequest, Http404
from django.shortcuts import get_object_or_404
fr... | qedsoftware/commcare-hq | corehq/apps/cloudcare/views.py | Python | bsd-3-clause | 29,447 |
#
# AggHelp.py -- help classes for the Agg drawing
#
# 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 aggdraw as agg
from ginga import colors
class AggContext(o... | bsipocz/ginga | ginga/aggw/AggHelp.py | Python | bsd-3-clause | 1,635 |
"""
#;+
#; NAME:
#; spec_guis
#; Version 1.0
#;
#; PURPOSE:
#; Module for Spectroscopy Guis with QT
#; These call pieces from spec_widgets
#; 12-Dec-2014 by JXP
#;-
#;------------------------------------------------------------------------------
"""
from __future__ import print_function, absolute_import, ... | profxj/old_xastropy | xastropy/xguis/spec_guis.py | Python | bsd-3-clause | 22,801 |
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
import os.path
import subprocess
import sys
libpg_query = os.path.join('.', 'libpg_query')
class PSqlParseBuildExt(build_ext):
def run(self):
return_code = subprocess.call(['make', '-C', libpg_query, 'build'])
... | alculquicondor/psqlparse | setup.py | Python | bsd-3-clause | 1,405 |
import pulsar as psr
def load_ref_system():
""" Returns l-arginine as found in the IQMol fragment library.
All credit to https://github.com/nutjunkie/IQmol
"""
return psr.make_system("""
N 0.8592 -2.9103 -0.8578
C 1.3352 -1.5376 -1.1529
C 2.8596... | pulsar-chem/Pulsar-Core | lib/systems/l-arginine.py | Python | bsd-3-clause | 1,416 |
from unittest import mock
from olympia.amo.cron import gc
from olympia.amo.tests import TestCase
from olympia.files.models import FileUpload
@mock.patch('olympia.amo.cron.storage')
class TestGC(TestCase):
def test_file_uploads_deletion(self, storage_mock):
fu_new = FileUpload.objects.create(path='/tmp/ne... | psiinon/addons-server | src/olympia/amo/tests/test_cron.py | Python | bsd-3-clause | 1,830 |
from gurtel.util import Url
class TestUrl(object):
def equal(self, one, two):
"""
For this test, want to ensure that compare-equal implies hash-equal.
"""
return (one == two) and (hash(one) == hash(two))
def test_no_qs(self):
assert self.equal(
Url("http:/... | oddbird/gurtel | tests/test_util.py | Python | bsd-3-clause | 1,076 |
# encoding: latin2
"""Repository of clusterPy's main class "Layer"
"""
__author__ = "Juan C. Duque, Alejandro Betancourt"
__credits__ = "Copyright (c) 2009-10 Juan C. Duque"
__license__ = "New BSD License"
__version__ = "1.0.0"
__maintainer__ = "RiSE Group"
__email__ = "contacto@rise-group.org"
__all__ = ['Layer']
... | clusterpy/clusterpy | clusterpy/core/layer.py | Python | bsd-3-clause | 75,262 |
# coding: utf-8
from __future__ import division, print_function, unicode_literals, \
absolute_import
import unittest
import os
import json
import numpy as np
import pandas as pd
from pymatgen import Structure
from veidt.describer.general import FuncGenerator, MultiDescriber
from veidt.describer.structural_descr... | materialsvirtuallab/veidt | veidt/describer/tests/test_general_describer.py | Python | bsd-3-clause | 2,379 |
from webargs import fields
from ..api.validators import Email, password
user_args = {
'email': fields.Str(validate=Email, required=True),
'password': fields.Str(validate=password, required=True)
}
role_args = {
'name': fields.Str(required=True),
'description': fields.Str(required=True)
}
| teracyhq/flask-boilerplate | app/api_1_0/args.py | Python | bsd-3-clause | 308 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Utilities for generating the version string for Astropy (or an affiliated
package) and the version.py module, which contains version info for the
package.
Within the generated astropy.version module, the `major`, `minor`, and `bugfix`
variables hold ... | larrybradley/astropy-helpers | astropy_helpers/version_helpers.py | Python | bsd-3-clause | 9,639 |
import json
import logging
import time
from datetime import datetime, timedelta
from itertools import chain
from django.conf import settings
from django.http import (
HttpResponse, HttpResponseBadRequest, HttpResponseRedirect)
from django.shortcuts import render
from django.utils.html import escape
from django.uti... | Osmose/kitsune | kitsune/search/views.py | Python | bsd-3-clause | 23,529 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following cond... | blazbratanic/protobuf | python/google/protobuf/internal/reflection_test.py | Python | bsd-3-clause | 119,310 |
from mission.constants.config import PIPE_SEARCH_DEPTH
from mission.framework.combinators import *
from mission.framework.primitive import *
from mission.framework.position import *
from mission.framework.movement import *
from mission.framework.task import *
from mission.framework.timing import *
from mission.framewor... | cuauv/software | mission/missions/old/2017/aslam_buoys.py | Python | bsd-3-clause | 7,476 |
from gevent import monkey
monkey.patch_all()
import pytest
import gevent
import marshmallow
from channelstream.server_state import get_state
from channelstream.channel import Channel
@pytest.mark.usefixtures("cleanup_globals", "pyramid_config")
class TestConnectViews(object):
def test_bad_json(self, dummy_reque... | AppEnlight/channelstream | tests/tests_views.py | Python | bsd-3-clause | 21,292 |
import wx
import wx.glcanvas
import pyglet
import pyglet.gl as gl
import pyglet.gl
import motmot.wxvideo.wxvideo as wxvideo
# XXX TODO:
# check off-by-one error in width/coordinate settings (e.g. glOrtho call)
# allow sharing of OpenGL context between instances
NewImageReadyEvent = wx.NewEventType() # use to trigge... | motmot/wxglvideo | motmot/wxglvideo/wxglvideo.py | Python | bsd-3-clause | 4,761 |
# Standard library imports
import logging
# Third party imports
from django.contrib import messages
from django.contrib.auth.decorators import user_passes_test
from django.contrib.admin.utils import NestedObjects
from django.urls import reverse
from django.db import DEFAULT_DB_ALIAS
from django.http import HttpRespons... | rackerlabs/django-DefectDojo | dojo/github_issue_link/views.py | Python | bsd-3-clause | 3,843 |
import logging
from django.conf import settings
from django.db import models
from mkt.site.mail import send_mail
from mkt.site.models import ModelBase
from mkt.users.models import UserProfile
from mkt.webapps.models import Webapp
from mkt.websites.models import Website
log = logging.getLogger('z.abuse')
class Abu... | eviljeff/zamboni | mkt/abuse/models.py | Python | bsd-3-clause | 3,467 |
from itertools import product
from inspect import signature
import warnings
from textwrap import dedent
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from ._core import VectorPlotter, variable_type, categorical_order
from . import utils
from .utils import _check_argum... | mwaskom/seaborn | seaborn/axisgrid.py | Python | bsd-3-clause | 87,264 |
from PIL import Image
from maskgen import exif
import numpy as np
import PIL
"""
Save the image as PDF. If the image has a orientation and 'Image Rotated', rotate the image according to the EXIF.
"""
def transform(img,source,target, **kwargs):
if 'resolution' in kwargs:
res = float(int(kwargs['resolution']... | rwgdrummer/maskgen | plugins/OutputPDF/__init__.py | Python | bsd-3-clause | 1,012 |
# -*- coding: utf-8 -*-
"""
Kay preparse management command.
:Copyright: (c) 2009 Accense Technology, Inc.
Takashi Matsuo <tmatsuo@candit.jp>,
All rights reserved.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
from os import listdir, path, mkdir
fro... | IanLewis/kay | kay/management/preparse.py | Python | bsd-3-clause | 3,612 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Deglitch utilities
=====================
"""
import numpy as np
import logging
_logger = logging.getLogger("sloth.math.deglitch")
def remove_spikes_medfilt1d(y_spiky, backend="silx", kernel_size=3, threshold=0.1):
"""Remove spikes in a 1D array using medfilt fr... | maurov/xraysloth | sloth/math/deglitch.py | Python | bsd-3-clause | 5,178 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
__all__ = ['pdb']
__version__ = '0.9.0'
import sys
# backwards compatibility to support `from fairseq.meters import AverageMeter`
from fairs... | hfp/libxsmm | samples/deeplearning/sparse_training/fairseq/fairseq/__init__.py | Python | bsd-3-clause | 802 |
#from spectrum import datasets
from spectrum.datasets import *
def test_marple_data():
d = marple_data
assert len(d) == 64
def test_timeseries():
data = data_cosine(N=1024, A=0.1, sampling=1024, freq=200)
ts = TimeSeries(data, sampling=1)
#assert ts.N == 1024
#assert ts.sampling == 1024
t... | cokelaer/spectrum | test/test_datasets.py | Python | bsd-3-clause | 589 |
# -*- coding:utf-8 -*-
#!/usr/bin/env python3
"""
"""
from collections import namedtuple
from minghu6.internet.proxy_ip import proxy_ip
from minghu6.text.seq_enh import filter_invalid_char
URL_LIST_FILE_PATH = 'URList-{username:s}.txt'
UrlNameTuple = namedtuple('UrlNameTuple', ['url', 'title']) | minghu6/csdn | csdn/csdn_offline/csdn_offline_common.py | Python | bsd-3-clause | 313 |
"""Test segzify."""
| ne-sachirou/segzi-tools | segzify/tests/__init__.py | Python | bsd-3-clause | 20 |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2013, LastSeal S.A.
Copyright (c) 2011-2012, Joaquin G. Duo
All rights reserved.
This code is distributed under BSD 3-clause License.
For details check the LICENSE file in the root of the project.
'''
class context_singleton(object):
'''
Singleton pattern decorator... | joaduo/python-simplerpc | simplerpc/common/abstract/decorators/context_singleton.py | Python | bsd-3-clause | 1,380 |
from django.db.models import Prefetch, prefetch_related_objects
from django.test import TestCase
from .models import Author, Book, Reader
class PrefetchRelatedObjectsTests(TestCase):
"""
Since prefetch_related_objects() is just the inner part of
prefetch_related(), only do basic tests to ensure ... | yephper/django | tests/prefetch_related/test_prefetch_related_objects.py | Python | bsd-3-clause | 4,853 |
# Major, Minor
VERSION = (1, 4) | duointeractive/python-bluefin | bluefin/__init__.py | Python | bsd-3-clause | 31 |
from zeit.cms.i18n import MessageFactory as _
from zope.cachedescriptors.property import Lazy as cachedproperty
import os.path
import zeit.cms.browser.view
import zeit.cms.content.interfaces
import zeit.cms.interfaces
import zeit.content.image.interfaces
import zeit.content.video.interfaces
import zeit.edit.browser.for... | ZeitOnline/zeit.newsletter | src/zeit/newsletter/browser/edit.py | Python | bsd-3-clause | 2,579 |
# Copyright 2016 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 re
# Note: this module is tested by a unit test config_validation_test.py,
# rather than recipe simulation tests.
_BISECT_CONFIG_SCHEMA = {
'com... | eunchong/build | scripts/slave/recipe_modules/auto_bisect/config_validation.py | Python | bsd-3-clause | 3,647 |
def print_from_queue(q):
"""
prints values read from queue q to
standard out.
"""
while True:
v = q.get()
if v is None:
# exit loop
return
else:
print (str(v))
class queue_to_file(object):
"""
self.actuate(a) puts values from a qu... | AssembleSoftware/IoTPy | IoTPy/agent_types/actuators_simple.py | Python | bsd-3-clause | 930 |
from __future__ import absolute_import
from exam import fixture
from six.moves.urllib.parse import parse_qs, urlparse
from sentry.models import ApiApplication, ApiAuthorization, ApiGrant, ApiToken
from sentry.testutils import TestCase
class OAuthAuthorizeCodeTest(TestCase):
@fixture
def path(self):
... | beeftornado/sentry | tests/sentry/web/frontend/test_oauth_authorize.py | Python | bsd-3-clause | 13,174 |
# -*- coding: utf-8 -*-
import os
import tempfile
import shutil
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.test.client import RequestFactory
from mock import patch
from olympia import amo, core
from olympia.addons import forms
from olympia.addons.mod... | lavish205/olympia | src/olympia/addons/tests/test_forms.py | Python | bsd-3-clause | 13,654 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from keras.optimizers import SGD
from keras.optimizers import Adam
from keras.optimizers import adadelta
from keras.optimizers import rmsprop
from keras.layers import Layer
from keras import backend as K
K.set_... | AutonomyLab/deep_intent | code/autoencoder_model/scripts/config_nmta.py | Python | bsd-3-clause | 3,079 |
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import Co... | netconstructor/django-activity-stream | actstream/views.py | Python | bsd-3-clause | 3,684 |
import os
from setuptools import setup
from setuptools import find_packages
version = '0.1'
shortdesc = "Klarna Payment for bda.plone.shop"
setup(
name='bda.plone.klarnapayment',
version=version,
description=shortdesc,
classifiers=[
'Environment :: Web Environment',
'License :: OSI Ap... | espenmn/bda.plone.klarnapayment | setup.py | Python | bsd-3-clause | 1,088 |
import importlib
import inspect
from celery import task
from django.conf import settings
from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk as es7_bulk
from elasticsearch.helpers.errors import BulkIndexError
from elasticsearch_dsl import Document, UpdateByQuery, analyzer, char_filter, token... | mozilla/kitsune | kitsune/search/es7_utils.py | Python | bsd-3-clause | 7,848 |
import os
# Django settings for mysite project.
DEBUG = True
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
SITE_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
DATABASES = {
'default': {
'ENGINE... | sebnorth/extended_user | mysite/settings.py | Python | bsd-3-clause | 5,917 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
help_txt = """
:help, show this help menu. :help [command] for detail
:dict [word], only find translation on dict.cn
:google [sentence], only find translation on google api
:lan2lan [sentence], translate from one language to another language
:add [word], add new word to yo... | lepture/mardict | utils/helper.py | Python | bsd-3-clause | 2,325 |
'''
TODO:
optimize adds, multiplies, 'or' and 'and' as they can accept more than two values
validate type info on specific functions
'''
from .matching import AstHandler, ParseError, DateTimeFunc
class AggregationParser(AstHandler):
FUNC_TO_ARGS = {'concat': '+', # more than 1
'strcasecmp': 2... | alonho/pql | pql/aggregation.py | Python | bsd-3-clause | 4,848 |
# -*- coding: utf-8 -*-
# TEST_UNICODE_LITERALS
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function
import pytest
import numpy as np
from ...extern import six
from ..data_info import dtype_info_name
STRING_TYPE_NAMES = {(False, 'S'): 'str... | AustereCuriosity/astropy | astropy/utils/tests/test_data_info.py | Python | bsd-3-clause | 1,575 |
from __future__ import division, print_function
from os.path import join, split, dirname
import os
import sys
from distutils.dep_util import newer
from distutils.msvccompiler import get_build_version as get_msvc_build_version
def needs_mingw_ftime_workaround():
# We need the mingw workaround for _ftime if the msv... | NextThought/pypy-numpy | numpy/random/setup.py | Python | bsd-3-clause | 3,228 |
"""Watch for changes in a collection of source files. If changes, run
the specified test runner (nosetests, by default).
"""
from argparse import ArgumentParser
import ConfigParser
import glob
import os
import stat
import subprocess
import sys
import time
class Nosy(object):
"""Watch for changes in all source fil... | dougbeal/nosy | nosy/nosy.py | Python | bsd-3-clause | 5,722 |
from magicbot.state_machine import (
default_state,
state,
timed_state,
AutonomousStateMachine,
StateMachine,
IllegalCallError,
NoFirstStateError,
MultipleFirstStatesError,
MultipleDefaultStatesError,
InvalidStateName,
)
from magicbot.magic_tunable import setup_tunables
import ... | robotpy/robotpy-wpilib-utilities | tests/test_magicbot_sm.py | Python | bsd-3-clause | 13,059 |
from mod_python import apache
from mod_python import util
import os.path
import urllib
import logging
debug = True
def handler(req):
"""
This is called by Apache and maps the request to the resource class.
Process of maping:
1. Try import a python script which handles this resource.
T... | spahan/unixdmoain | wwwlib/rest.py | Python | bsd-3-clause | 2,782 |
def extractWwwTccedwardsCom(item):
'''
Parser for 'www.tccedwards.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'),
('Loiterous', 'Lo... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractWwwTccedwardsCom.py | Python | bsd-3-clause | 548 |
import unittest
from restkiss.preparers import Preparer, FieldsPreparer
class InstaObj(object):
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
class LookupDataTestCase(unittest.TestCase):
def setUp(self):
super(LookupDataTestCase, self).setUp()
... | CraveFood/restkiss | tests/test_preparers.py | Python | bsd-3-clause | 2,628 |
import sys
from arrowhead.core import Step
from arrowhead.core import ErrorArrow
from arrowhead.core import NormalArrow
from arrowhead.core import ValueArrow
def print_flow_state(flow, active_step_name=None, file=sys.stdout):
"""
Display the state of a given flow.
:param flow:
A Flow, instance o... | zyga/arrowhead | arrowhead/inspector.py | Python | bsd-3-clause | 6,120 |
# proxy module
from __future__ import absolute_import
from mayavi.core.api import *
| enthought/etsproxy | enthought/mayavi/core/api.py | Python | bsd-3-clause | 84 |
__author__ = 'michael'
from django import template
from unobase import models as unobase_models
register = template.Library()
@register.inclusion_tag('blog/widgets/tag_cloud.html')
def tag_cloud(blog_slug):
tags = unobase_models.TagModel.get_distinct_tags('blogentry')
#set(unobase_models.TagModel.get_tags(... | unomena/unobase | unobase/blog/templatetags/blog_widgets.py | Python | bsd-3-clause | 407 |
"""
Google Code Wiki translator.
Syntax defined by http://code.google.com/p/support/wiki/WikiSyntax
Here called gwiki to make the dialect clear (g for google).
"""
import re, os, commands, sys
from common import default_movie, plain_exercise, insert_code_and_tex, \
fix_ref_section_chapter
from plaintext import p... | dragly/doconce | lib/doconce/gwiki.py | Python | bsd-3-clause | 9,341 |
import os
import shutil
import addSubproject
import option
import utility
import grapeGit as git
import grapeConfig
import grapeMenu
import checkout
# update your custom sparse checkout view
class UpdateView(option.Option):
"""
grape uv - Updates your active submodules and ensures you are on a consistent ... | robinson96/GRAPE | vine/updateView.py | Python | bsd-3-clause | 20,286 |
# -*- coding: utf-8 -*-
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import sy, sy.path
setup(
name='sy',
version=sy.__version__,
url='http://sy.afajl.com',
license='BSD',
author='Paul Diaconescu',
author_email='p@afajl.com',
de... | afajl/sy | setup.py | Python | bsd-3-clause | 1,024 |
"""
WSGI config for goska project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "goska.settings")
from django.core.wsgi ... | jasminka/goska | goska/wsgi.py | Python | bsd-3-clause | 385 |
from enable.api import ColorTrait
from .base_patch_stylus import BasePatchStylus
class RectangleStylus(BasePatchStylus):
""" A Flyweight object for drawing filled rectangles.
"""
edge_color = ColorTrait('black')
fill_color = ColorTrait('yellow')
def draw(self, gc, rect):
with gc:
... | tonysyu/deli | deli/stylus/rect_stylus.py | Python | bsd-3-clause | 543 |
'''
Created on 14.07.2015
@author: Aaron Klein
'''
import numpy as np
from robo.task.base_task import BaseTask
class Hartmann6(BaseTask):
def __init__(self):
X_lower = np.array([0, 0, 0, 0, 0, 0])
X_upper = np.array([1, 1, 1, 1, 1, 1])
opt = np.array([[0.20169, 0.150011, 0.476874, 0.27... | aaronkl/RoBO | robo/task/synthetic_functions/hartmann6.py | Python | bsd-3-clause | 1,747 |
"""Common settings and globals."""
from os.path import abspath, basename, dirname, join, normpath
from sys import path
########## PATH CONFIGURATION
# Absolute filesystem path to the Django project directory:
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Absolute filesystem path to the top-level project fold... | vandorjw/django-traceability | demo/demo/settings/base.py | Python | bsd-3-clause | 7,577 |
# -*- 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.
"""Bridge for using cclib data in PyQuante (http://pyquante.sourceforge.net)."""
from __future__ import print_fu... | Schamnad/cclib | src/cclib/bridge/cclib2pyquante.py | Python | bsd-3-clause | 1,092 |
"""
Documents metadata tools.
"""
from __future__ import absolute_import, print_function, unicode_literals
import yaml
DELIMITER = '---'
def stripped(stream):
"""
Read stream to strip YAML header, returns stripped data.
"""
data = []
meta_started = False
meta_ended = False
# TODO: cleane... | 05bit/docta | docta/utils/meta.py | Python | bsd-3-clause | 1,835 |
from canvas.exceptions import ServiceError, ValidationError
from canvas.economy import InvalidPurchase
from drawquest import knobs
from drawquest.apps.palettes.models import get_palette_by_name, all_palettes
from drawquest.signals import balance_changed
def balance(user):
return int(user.kv.stickers.currency.get()... | canvasnetworks/canvas | website/drawquest/economy.py | Python | bsd-3-clause | 1,765 |
# Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
import sys
import os.path
import re
import operator
import digits
from digits import utils
from digits.utils import subclass, override
from digits.task import Task
# NOTE: Increment this everytime the pickled version changes
PICKLE_VERSION = 3
@su... | batra-mlp-lab/DIGITS | digits/dataset/tasks/create_db.py | Python | bsd-3-clause | 11,328 |
from django.shortcuts import get_object_or_404
from apps.canvas_auth.models import User
from canvas.api_decorators import api_decorator
from canvas.metrics import Metrics
from canvas.models import Comment
from canvas.view_guards import require_user
urlpatterns = []
api = api_decorator(urlpatterns)
@api('hide_comment... | canvasnetworks/canvas | website/apps/comment_hiding/api.py | Python | bsd-3-clause | 1,093 |
# -----------------------------------------------------------------------------
#
# FreeType high-level python API - Copyright 2011 Nicolas P. Rougier
# Distributed under the terms of the new BSD license.
#
# -----------------------------------------------------------------------------
'''
Show how to access glyph ou... | nlhepler/freetype-py3 | examples/glyph-vector.py | Python | bsd-3-clause | 2,878 |
# encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from django.core.management import call_command
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Completely rebuilds the search index by removing the old data and then upda... | antonyr/django-haystack | haystack/management/commands/rebuild_index.py | Python | bsd-3-clause | 1,324 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('latest_tweets', '0010_photo_unique'),
]
operations = [
migrations.AddField(
model_name='photo',
name... | blancltd/django-latest-tweets | latest_tweets/migrations/0011_photo_image_file.py | Python | bsd-3-clause | 434 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# l... | stormi/tsunami | src/primaires/interpreteur/masque/fonctions.py | Python | bsd-3-clause | 2,032 |