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 |
|---|---|---|---|---|---|
#! python3
# countdown.py - A simple countdown script.
import time, subprocess
timeLeft = 60
while timeLeft > 0:
print(timeLeft, end='')
time.sleep(1)
timeLeft = timeLeft - 1
# TODO: At the end of the countdown, play a sound file.
subprocess.Popen(['start', 'alarm.wav'], shell=True)
| rfreiberger/Automate-the-Boring-Stuff | ch15/countdown.py | Python | bsd-2-clause | 317 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import url
from . import feeds, views
urlpatterns = [
url(r'^$', views.PostListView.as_view(), name='list'),
url(
r'^category/(?P<slug>[-\w]+)/$',
views.PostListCategoryView.... | blancltd/glitter-news | glitter_news/urls.py | Python | bsd-2-clause | 849 |
from django import template
from django.template.defaultfilters import safe
from arkestra_utilities.models import Insert
from classytags.arguments import Argument
from classytags.core import Tag, Options
register = template.Library()
class RenderInserter(Tag):
name = 'insert'
options = Options(
Argu... | bubenkoff/Arkestra | arkestra_utilities/templatetags/insert_tags.py | Python | bsd-2-clause | 798 |
""" Simple JSON-RPC 2.0 protocol for aiohttp"""
from .exc import (ParseError, InvalidRequest, InvalidParams,
InternalError, InvalidResponse)
from .errors import JError, JResponse
from validictory import validate, ValidationError, SchemaError
from functools import wraps
from uuid import uuid4
from aio... | zloidemon/aiohttp_jrpc | aiohttp_jrpc/__init__.py | Python | bsd-2-clause | 6,064 |
def func_a(_):
func_b()
def func_b():
func_c()
def func_c():
func_d()
def func_d():
raise Exception("Guessing time !")
def bad_syntax():
import badsyntax
badsyntax
def bad_module():
import badmodule
badmodule
| ionelmc/python-tblib | tests/examples.py | Python | bsd-2-clause | 251 |
import icoshift
import numpy as np
test = np.array([
[0, 0, 0, 2, 3, 2, 0, 0, 2, 1, 2, np.nan, 3, 4, 2, 3, 2, 0, 2, 3, 2],
[0, 0, 2, 3, 2, 0, 0, 2, 3, 1, 2, np.nan, 3, 4, 3, 2, 0, 2, 3, 2, 0],
[0, 2, 3, 2, 0, 0, 2, 3, 2, 1, 2, np.nan, 3, 4, 2, 0, 2, 3, 2, 0, 1],
])
xCS, ints, ind, target = icoshift.icoshift('average',... | mfitzp/icoshift | icoshift/tests.py | Python | bsd-2-clause | 710 |
#!/usr/bin/env python3
class LogicGate:
def __init__(self, label):
self.name = label
self.output = None
def getName(self):
return self.name
def getOutput(self):
self.output = self.calcLogicOutput()
return self.output
class BinaryGate(LogicGate):
def __init__(s... | zzz0072/Python_Exercises | 07_RSI/ch01/logic_gate.py | Python | bsd-2-clause | 4,604 |
# Copyright (c) by it's authors.
# Some rights reserved. See LICENSE, AUTHORS.
from wallaby.pf.peer.peer import *
from wallaby.pf.peer.database import *
from wallaby.pf.peer.abstractQuery import *
from wallaby.pf.peer.documentIDQueryResult import *
from wallaby.pf.peer.valueQueryResult import *
from wallaby.common.qu... | FreshXOpenSource/wallaby-plugin-elasticsearch | wallaby/pf/peer/elasticsearch.py | Python | bsd-2-clause | 5,705 |
#===========================================================================
#
# Common data packet structures. Used for requests and replies.
#
#===========================================================================
from .. import util
#===========================================================================... | TD22057/T-Home | python/tHome/sma/Header.py | Python | bsd-2-clause | 2,886 |
__author__ = 'gjones'
import time
import sys
import numpy as np
from kid_readout.roach import heterodyne
from kid_readout.utils import data_file, sweeps
from kid_readout.equipment import hittite_controller, lockin_controller
hittite = hittite_controller.hittiteController(addr='192.168.0.200')
lockin = lockin_contro... | ColumbiaCMB/kid_readout | apps/data_taking_scripts/2015-10-jpl-park/sweep_and_stream_at_min_s21_two_groups_cw_noise_power.py | Python | bsd-2-clause | 4,432 |
from ndlib.models.compartments.Compartment import Compartiment
import networkx as nx
import numpy as np
import operator
__author__ = 'Giulio Rossetti'
__license__ = "BSD-2-Clause"
__email__ = "giulio.rossetti@gmail.com"
class NodeNumericalAttribute(Compartiment):
def __init__(self, attribute, value=None, op=Non... | GiulioRossetti/ndlib | ndlib/models/compartments/NodeNumericalAttribute.py | Python | bsd-2-clause | 2,351 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "infodiscovery.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| daljeetv/infodiscovery | manage.py | Python | bsd-2-clause | 256 |
# coding=utf-8
from pages.models import Page
def nav_pages(request):
return {'nav_pages': Page.objects.filter(public=True, in_navigation=True),}
| wonderbeyond/ezlog | pages/context_processors.py | Python | bsd-2-clause | 150 |
import time
import fractions
from functools import reduce
import logging
class Scheduler:
def __init__(self, jobs):
"""
Create a new Scheduler.
>>> s = Scheduler([Job(1, max, 100, 200)])
>>> for jobs in s:
... time.sleep(s.tick_duration)
:param jobs: Sequence ... | bewiwi/sauna | sauna/scheduler.py | Python | bsd-2-clause | 3,120 |
'''Autogenerated by get_gl_extensions script, do not edit!'''
from OpenGL import platform as _p
from OpenGL.GL import glget
EXTENSION_NAME = 'GL_ARB_compressed_texture_pixel_storage'
_p.unpack_constants( """GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127
GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128
GL_UNPACK_COMPRESSED_BLOCK_DEPTH... | frederica07/Dragon_Programming_Process | PyOpenGL-3.0.2/OpenGL/raw/GL/ARB/compressed_texture_pixel_storage.py | Python | bsd-2-clause | 743 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-08-15 20:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('annotator', '0008_video_labels'),
]
operations = [
migrations.AlterField(
... | antingshen/BeaverDam | annotator/migrations/0009_auto_20170815_1341.py | Python | bsd-2-clause | 469 |
#!/usr/bin/env python
# Copyright (c) 2015, Nate Rosenblum
#
# 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... | flandr/kerberos-keyutil | keyutil/keytab.py | Python | bsd-2-clause | 5,159 |
#!/bin/env python
import urllib2
from datetime import datetime
site = 'http://www.fuel-prices-europe.info/'
fh = urllib2.urlopen(site)
lines = fh.readlines()
fh.close()
now = datetime.now()
my_str_date = now.strftime('%Y%m%d')
outdir = '/Users/scollis/tmp/'
prefix = 'fuel'
postfix = '.html'
ofh = open(outdir+prefix+my... | scollis/price_watch | scripts/get_html.py | Python | bsd-2-clause | 379 |
import os
import sys
class ServerGroup(object):
"""
This class will work with Halo server groups.
"""
##########
#
# Halo Server Group examples
#
# Parameters:
#
# self (object) - A ServerGroup object
# halo (object) - A HaloGeneral object
#
####... | cloudpassage-community/halo_api_examples | app/halo_api_examples/server_group/server_group.py | Python | bsd-2-clause | 5,733 |
# a worker factory class
# the worker has input "bind" (taking a tuple containing the bindantenna parameters)
# "pause"/"resume" (to control the eventmatcher taking keyboard/mouse events; the eventmatcher also checks that the bound hive has not been stopped)
# "stop" (taking a bindname), which ends the event dispatchi... | agoose77/hivesystem | bee/bind.py | Python | bsd-2-clause | 17,026 |
"""
viscount.task.models
Task models
"""
from ..core import db
from ..utils import JSONSerializer
class TaskInputFile(JSONSerializer, db.Model):
__tablename__ = 'tasks_input_files'
id = db.Column(db.Integer, primary_key=True)
task_id = db.Column(db.Integer, db.ForeignKey('tasks.id'), nullable=False)
file_type_... | dacb/viscount | viscount/tasks/models.py | Python | bsd-2-clause | 2,077 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
from {{project}} import app as application
@click.command()
@click.option('--debug/--no-debug', default=True,
envvar='REPO_DEBUG')
@click.option('--host', default='0.0.0.0')
@click.option('--port', default=5000)
def main(debug, host, port):
... | damonchen/chan | chan/core/templates/uwsgi_handler.py | Python | bsd-2-clause | 429 |
from yuuhpizzakebab import app
if __name__ == '__main__':
app.run(host='0.0.0.0')
| lex/yuuh-pizza-kebab | app.py | Python | bsd-2-clause | 87 |
# -*- encoding = utf-8 -*-
def test(n, flag=8):
return pow(3, n) < 10 ** flag
def main():
n = 0
while test(n):
print(pow(3, n))
n += 1
print(n)
print(pow(3, n))
if __name__ == '__main__':
main()
# 2D:
# 134217728 ---> (17 month) ---> 1024
# Pixel: x y color owner price is_... | sharkspeed/dororis | scripts/1w_1w.py | Python | bsd-2-clause | 555 |
# Copyright (c) 2015, Warren Weckesser. All rights reserved.
# This software is licensed according to the "BSD 2-clause" license.
from __future__ import print_function
from setuptools import setup
from os import path
def get_heatmapcluster_version():
"""
Find the value assigned to __version__ in heatmapclu... | WarrenWeckesser/heatmapcluster | setup.py | Python | bsd-2-clause | 1,668 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import os.path as op
import sys
import logging
import numpy as np
from jcvi.formats.base import LineFile
from jcvi.apps.base import OptionParser, ActionDispatcher, need_update, sh, \
get_abs_path, which
class Sizes (LineFile):
"""
Two-colu... | sgordon007/jcvi_062915 | formats/sizes.py | Python | bsd-2-clause | 4,608 |
import sys
py3 = sys.version_info[0] == 3
# python 2/3 compatibility
if py3:
# borrowed from six
def b(s):
'''Byte literal'''
return s.encode("latin-1")
def u(s):
'''Text literal'''
return s
else:
# borrowed from six
def b(s):
'''Byte literal'''
retu... | hyunchel/redis-dump-load | tests/util.py | Python | bsd-2-clause | 1,620 |
import unittest
from sympy import symbols
from galgebra.ga import Ga
class TestLt(unittest.TestCase):
# reproduce gh-105
def test_lt_matrix(self):
base = Ga('a b', g=[1,1], coords=symbols('x,y',real=True))
a,b = base.mv()
A = base.lt([a+b,2*a-b])
assert str(A) == 'Lt(a) = a + ... | arsenovic/galgebra | test/test_lt.py | Python | bsd-3-clause | 402 |
# -*- coding: utf-8 -*-
# Author: Joris Jensen <jjensen@techfak.uni-bielefeld.de>
#
# License: BSD 3 clause
from __future__ import division
import numpy as np
from scipy.optimize import minimize
from sklearn.utils import validation
from .rslvq import RslvqModel
class LmrslvqModel(RslvqModel):
"""Localized Mat... | MrNuggelz/sklearn-glvq | sklearn_lvq/lmrslvq.py | Python | bsd-3-clause | 15,649 |
#!/usr/bin/env python
import warnings
# Dropping a table inexplicably produces a warning despite
# the "IF EXISTS" clause. Squelch these warnings.
warnings.simplefilter('ignore')
import logging
import unittest
import environment
import tablet
import utils
use_mysqlctld = True
tablet_master = tablet.Tablet(use_mysq... | yaoshengzhe/vitess | test/backup.py | Python | bsd-3-clause | 5,848 |
# -*- coding: utf-8 -*-
"""
Extensions to Cauldron are user-facing helpful features
which do not strictly obey the KTL API, but which are
compatible with the KTL API when used via Cauldron.
""" | alexrudy/Cauldron | Cauldron/ext/__init__.py | Python | bsd-3-clause | 193 |
# -*- coding: utf-8 -*-
#
# pymorph documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 26 15:03:10 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't picklea... | luispedro/pymorph | docs/source/conf.py | Python | bsd-3-clause | 6,193 |
#!/usr/bin/python
# Copyright 2015 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.
"""Pulls down the current dart sdk to third_party/dart-sdk/.
You can manually force this to run again by removing
third_party/dart-sdk/STA... | mdakin/engine | tools/dart/update.py | Python | bsd-3-clause | 3,372 |
# stdlib
from collections import defaultdict
from Queue import Empty, Queue
import threading
import time
# project
from checks import AgentCheck
from checks.libs.thread_pool import Pool
from config import _is_affirmative
TIMEOUT = 180
DEFAULT_SIZE_POOL = 6
MAX_LOOP_ITERATIONS = 1000
FAILURE = "FAILURE"
class Status... | amalakar/dd-agent | checks/network_checks.py | Python | bsd-3-clause | 8,122 |
import numpy as np
import matplotlib.pyplot as pl
def tvbox(box=(1,1), xcen=0, ycen=0, center=None,**kwargs):
"""
draw a circle on an image.
radius
xcen
ycen
center= tuple in (Y,X) order.
"""
if center is not None:
xcen=center[1]
... | mperrin/misc_astro | idlastro_ports/tvbox.py | Python | bsd-3-clause | 511 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Reinaesaya/OUIRL-ChatBot | chatterbot/imgcaption/im2txt/show_and_tell_model_test.py | Python | bsd-3-clause | 6,824 |
import numpy as np
import sys
from random import randint
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
from scipy.io import loadmat
from scipy.io import savemat
mat = loadmat('../data_release/benchmark/language_original.mat')
for k, v in mat.iteritems():
exec(k +... | zhusz/ICCV17-fashionGAN | language/test_te.py | Python | bsd-3-clause | 2,918 |
import os, sys
sys.path.insert(0, os.path.join("..",".."))
from nodebox.graphics.context import *
from nodebox.graphics import *
txt = Text("So long!\nThanks for all the fish.",
font = "Droid Serif",
fontsize = 20,
fontweight = BOLD,
lineheight = 1.2,
fill = color(0.25))
# Text.s... | pepsipepsi/nodebox_opengl_python3 | examples/04-text/02-style.py | Python | bsd-3-clause | 687 |
from collections import defaultdict
import string
from bson.objectid import ObjectId
from deform.exception import ValidationFailure
from pyramid.httpexceptions import HTTPSeeOther
from pyramid.i18n import get_localizer
from pyramid.renderers import get_renderer
from mnemos.forms import ContactSchema
from mnemos.for... | dbaty/Mnemos | mnemos/views.py | Python | bsd-3-clause | 11,326 |
# -*- coding: utf-8 -*-
"""
celery.canvas
~~~~~~~~~~~~~
Composing task workflows.
Documentation for these functions are in :mod:`celery`.
You should not import from this module directly.
"""
from __future__ import absolute_import
from copy import deepcopy
from functools import partial as _partia... | mozilla/firefox-flicks | vendor-local/lib/python/celery/canvas.py | Python | bsd-3-clause | 14,524 |
#!/usr/bin/env python
# Remove .egg-info directory if it exists, to avoid dependency problems with
# partially-installed packages (20160119/dphiffer) ... | whosonfirst/py-mapzen-whosonfirst-pip-utils | setup.py | Python | bsd-3-clause | 1,676 |
from __future__ import unicode_literals
import json
import socket
from uuid import uuid4
from time import sleep
from urllib import urlencode
from random import randrange
from unittest import TestCase
from Queue import Queue, Empty
from contextlib import closing
from urlparse import urlparse, parse_qsl
import pytest
im... | robdennis/sideboard | sideboard/tests/test_server.py | Python | bsd-3-clause | 19,922 |
from pypylon.cython.factory import Factory
from pypylon.cython.version import PylonVersion
factory = Factory()
pylon_version = PylonVersion() | mabl/PyPylon | pypylon/__init__.py | Python | bsd-3-clause | 142 |
# -*- coding: utf-8 -*-
## normalize the noise level to one scan : divide intensity by sqrt(NS)
def norm(ns=None, dataset=None):
import sys
import os
import os.path
import subprocess
import JTutils
# if this function is called from imported module then one needs to import TOPSPIN functions
... | jtrebosc/JTutils | TSpy/norm_noise_per_scan.py | Python | bsd-3-clause | 1,676 |
#!/usr/bin/env python
# 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.
"""Builds the complete main.html file from the basic components.
"""
from HTMLParser import HTMLParser
import os
import re
import sys
... | ChromiumWebApps/chromium | remoting/webapp/build-html.py | Python | bsd-3-clause | 2,936 |
'''
anaconda-client configuration
Get, Set, Remove or Show the anaconda-client configuration.
###### anaconda-client sites
anaconda-client sites are a mechanism to allow users to quickly switch
between Anaconda repository instances. This is primarily used for testing
the anaconda alpha site. But also has application... | Anaconda-Platform/anaconda-client | binstar_client/commands/config.py | Python | bsd-3-clause | 6,043 |
# -*- coding: utf8 -*-
"""
This is part of shot detector.
Produced by w495 at 2017.05.04 04:18:27
"""
from __future__ import absolute_import, division, print_function
import datetime
from collections import Iterable
from enum import Enum
from types import BuiltinFunctionType, FunctionType
from uuid import UUI... | w495/python-video-shot-detector | shot_detector/utils/repr_hash.py | Python | bsd-3-clause | 2,296 |
# -*- coding: utf-8 -*-
" WebSite models "
import os
import shutil
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.db import connection
from django.db import models
from django.db.utils import IntegrityError
from django.utils.transla... | makinacorpus/ionyweb | ionyweb/website/models.py | Python | bsd-3-clause | 9,120 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Tests for `astropy.vo.validator.validate`.
.. note::
This test will fail if external URL query status
changes. This is beyond the control of AstroPy.
When this happens, rerun or update the test.
"""
from __future__ import absolute_import,... | joergdietrich/astropy | astropy/vo/validator/tests/test_validate.py | Python | bsd-3-clause | 3,067 |
a = "hello"
a += " "
a += "world"
print a
| jplevyak/pyc | tests/t39.py | Python | bsd-3-clause | 42 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import base64
import hashlib
import warnings
from io import BytesIO
from django.core.files.base import ContentFile
from django.utils import six
from easy_thumbnails import fields as easy_thumbnails_fields
from easy_thumbnails import files as easy_thumbnai... | jakob-o/django-filer | filer/fields/multistorage_file.py | Python | bsd-3-clause | 5,617 |
import unittest
import coapy.options
from coapy.connection import *
import time
import binascii
class Test_is_multicast (unittest.TestCase):
def testIpv4 (self):
self.assertFalse(is_multicast(('localhost', 0)))
self.assertTrue(is_multicast(('224.0.0.1', 0)))
self.assertTrue(is_multicast(('2... | okoye/COAP | unittests/test-connection.py | Python | bsd-3-clause | 7,153 |
# (c) The James Hutton Institute 2013
# Author: Leighton Pritchard
#
# Contact:
# leighton.pritchard@hutton.ac.uk
#
# Leighton Pritchard,
# Information and Computing Sciences,
# James Hutton Institute,
# Errol Road,
# Invergowrie,
# Dundee,
# DD6 9LH,
# Scotland,
# UK
#
# This program is free software: you can redistri... | bluegenes/MakeMyTranscriptome | scripts/util/KGML_pathway.py | Python | bsd-3-clause | 28,215 |
# -*- coding: utf-8 -*-
'''
website
'''
from trytond.pool import Pool, PoolMeta
from nereid import request, route, render_template
from pagination import ElasticPagination
__metaclass__ = PoolMeta
__all__ = ['Website']
class Website:
"Nereid Website"
__name__ = 'nereid.website'
@classmethod
de... | fulfilio/nereid-webshop-elastic-search | website.py | Python | bsd-3-clause | 2,063 |
##########################################################################
#
# Copyright (c) 2012, 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 provided ... | cedriclaunay/gaffer | python/GafferImageTest/ImageReaderTest.py | Python | bsd-3-clause | 10,516 |
from django import template
from go.base.utils import get_router_view_definition
register = template.Library()
@register.simple_tag
def router_screen(router, view_name='show'):
view_def = get_router_view_definition(router.router_type, router)
return view_def.get_view_url(view_name, router_key=router.key)
| praekelt/vumi-go | go/router/templatetags/router_tags.py | Python | bsd-3-clause | 319 |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Various utilities
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = o... | carolFrohlich/nipype | nipype/interfaces/utility.py | Python | bsd-3-clause | 22,277 |
# $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
#
... | DLR-SC/DataFinder | src/datafinder/gui/user/controller/output/facade.py | Python | bsd-3-clause | 6,124 |
from django.conf.urls import url, include
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
admin.site.site_header = 'TwoRavens Administration'
admin.site.index_title = ('TwoRavens Admin')
admin.site.site_title = ('TwoRavens Admin page')
urlpatterns = [
u... | vjdorazio/TwoRavens | tworavensproject/urls.py | Python | bsd-3-clause | 979 |
import pytest
from distributed.protocol import serialize, deserialize
from dask.dataframe.utils import assert_eq
import pandas as pd
@pytest.mark.parametrize("collection", [tuple, dict])
@pytest.mark.parametrize("y,y_serializer", [(50, "cuda"), (None, "pickle")])
def test_serialize_cupy(collection, y, y_serializer):... | blaze/distributed | distributed/protocol/tests/test_collection_cuda.py | Python | bsd-3-clause | 2,448 |
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import os
# Find the best implementation available
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import caffe_pb2
import flask
import lmdb
import PIL.Image
from... | brainstorm-ai/DIGITS | digits/dataset/images/classification/views.py | Python | bsd-3-clause | 15,470 |
# From https://gist.github.com/destan/5540702#file-text2png-py
# coding=utf8
import multiprocessing
import threading
import time
import atexit
import os
import vmprof
def install_vmprof(name="thread"):
cpid = multiprocessing.current_process().name
ctid = threading.current_thread().name
fname = "vmprof-{}-{}-{}-... | fake-name/ReadableWebProxy | Misc/install_vmprof.py | Python | bsd-3-clause | 616 |
def extractDanielyangNinja(item):
'''
Parser for 'danielyang.ninja'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
if "WATTT" in item['tags']:
return buildReleaseMessageWithType(item, "WATTT", vol, chp, fr... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractDanielyangNinja.py | Python | bsd-3-clause | 362 |
from decimal import Decimal as D
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import ugettext_lazy as _
from oscar.core import loading
Scale = loading.get_class('shipping.scales', 'Scale')
weight_precision = getattr(settings, 'OSCAR_SHIPPING_WE... | okfish/django-oscar-shipping | oscar_shipping/packers.py | Python | bsd-3-clause | 4,871 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from uuid import UUID
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Choice.code'
db.add_column(u'polls_c... | miraculixx/django-polls | polls/south_migrations/0008_auto__add_field_choice_code.py | Python | bsd-3-clause | 6,286 |
import unittest
from entities import *
class TestField(unittest.TestCase):
def test_make_default(self):
field = Field(default=None, null=True)
self.assertEqual(field.make_default(), None)
field = Field(default=lambda: 1, null=True)
self.assertEqual(field.make_default(), 1)
... | eseraygun/python-entities | tests/field.py | Python | bsd-3-clause | 5,621 |
import os
DEBUG = False
try:
from local_settings import * # noqa
except ImportError:
pass
| pjdufour/slackbot-osm | slackbotosm/settings.py | Python | bsd-3-clause | 101 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "LinearTrend", cycle_length = 5, transform = "Anscombe", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_LinearTrend/cycle_5/ar_12/test_artificial_1024_Anscombe_LinearTrend_5_12_20.py | Python | bsd-3-clause | 267 |
#!/usr/bin/env python
# This file should be run using a non-ros unit test framework such as nose using
# nosetests test_dotname.py. Alternatively, just run with python test_dotname.py.
# You will get the output from rostest as well.
import unittest
from dotname_cases import DotnameLoadingTest, NotTestCase
import ro... | ros/ros | tools/rosunit/test/test_dotname.py | Python | bsd-3-clause | 1,950 |
#!/usr/bin/python -OO
# -*- coding: utf-8 -*-
# vim: set et sts=4 sw=4 encoding=utf-8:
#
###############################################################################
#
# This file is part of socketrpc.
#
# Copyright (C) 2011 Rene Jochum <rene@jrit.at>
#
##############################################################... | pcdummy/socketrpc | examples/gevent_srpc.py | Python | bsd-3-clause | 5,981 |
from __future__ import absolute_import
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app # noqa
__version__ = '1.1.4'
__url__ = 'https://github.com/rackerlabs/django-DefectDojo'
__docs__ = 'http://defectdojo.readthedocs.... | grendel513/django-DefectDojo | dojo/__init__.py | Python | bsd-3-clause | 376 |
from unittest import TestCase, main
from datetime import datetime
from future.utils import viewitems
from qiita_core.exceptions import IncompetentQiitaDeveloperError
from qiita_core.util import qiita_test_checker
from qiita_db.base import QiitaObject
from qiita_db.study import Study, StudyPerson
from qiita_db.investi... | RNAer/qiita | qiita_db/test/test_study.py | Python | bsd-3-clause | 28,241 |
# ----------------------------------------------------------------------------
# Copyright (c) 2017-, LabControl development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -------------------------------------------------... | jdereus/labman | labcontrol/gui/handlers/plate.py | Python | bsd-3-clause | 9,784 |
#!/usr/bin/env python
PACKAGE = 'hanse_pipefollowing'
import roslib; roslib.load_manifest('hanse_pipefollowing')
import rospy
import dynamic_reconfigure.server
import math
import smach
import smach_ros
import numpy
from geometry_msgs.msg import PoseStamped, Point, Twist, Vector3
from hanse_msgs.msg import Object, sollS... | iti-luebeck/HANSE2012 | hanse_ros/hanse_pipefollowing/nodes/pipefollowing.py | Python | bsd-3-clause | 10,171 |
import json
import pytest
from sqlalchemy_json_api import QueryBuilder
@pytest.mark.usefixtures('table_creator', 'dataset')
class TestSelectRelated(object):
@pytest.mark.parametrize(
('id', 'result'),
(
(
1,
{'data': [{'type': 'users', 'id': '2'}]}
... | kvesteri/sqlalchemy-json-api | tests/test_select_related.py | Python | bsd-3-clause | 8,572 |
# ----------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------
from VyPy.data import OrderedBunch as obunch
from VyPy.tools import atleast_2d_row, atleast_2d_col, array_type
from copy import deepcopy
import numpy ... | aerialhedgehog/VyPy | trunk/VyPy/optimize/gradients/FiniteDifference.py | Python | bsd-3-clause | 3,032 |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("LGBMRegressor" , "boston" , "postgresql")
| antoinecarme/sklearn2sql_heroku | tests/regression/boston/ws_boston_LGBMRegressor_postgresql_code_gen.py | Python | bsd-3-clause | 131 |
#!/usr/bin/env python
#
# Copyright (c) 2018, Nagoya University
# 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, th... | suzlab/Autoware | ros/src/sensing/fusion/packages/autoware_camera_lidar_calibrator/scripts/tarfile_calibration.py | Python | bsd-3-clause | 11,900 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('README.rst').read()
requirements = open('requir... | Vauxoo/vauxootools | setup.py | Python | bsd-3-clause | 1,380 |
# -*- coding: utf-8 -*-
"""
game.commands.menu
~~~~~~~~~~~~~~~~~~
Entry point, handles dispatch for all game commands received and
pre-processed by the Eval.evaluate listener
:copyright: (c) 2012 by Mek
:license: BSD, see LICENSE for more details.
"""
from configs.formatting import *
from game... | mekarpeles/dungeons | dungeon/game/commands/menu.py | Python | bsd-3-clause | 2,698 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-16 15:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catalog', '0006_auto_20170316_1444'),
]
operations = [
migrations.AlterFiel... | pavlenk0/my-catalog | catalog/migrations/0007_auto_20170316_1730.py | Python | bsd-3-clause | 649 |
from django.conf.urls import url
from custom.fri.views import upload_message_bank
urlpatterns = [
url(r'^upload_message_bank/$', upload_message_bank, name='fri_upload_message_bank'),
]
| qedsoftware/commcare-hq | custom/fri/urls.py | Python | bsd-3-clause | 191 |
# -*- coding: utf-8 -*-
"""
WOLFEYES'S FRAMEWORK
Python 3 / OpenCV 3
This file describes some TypeCheking decorators.
Might be useless, but allows for almost very precise type checking,
especially on keyworded args, which might help.
"""
# 'kargs' get the arguments and passes the decorator
def args(*types, **ktypes)... | TBIproject/WolfEyes | WolfEyes/Utils/TypeChecker.py | Python | bsd-3-clause | 2,472 |
import logging
import emission.core.wrapper.wrapperbase as ecwb
class TourModel(ecwb.WrapperBase):
props = {"user_id" : ecwb.WrapperBase.Access.WORM, # user_id of the E-Missions user the graph represnts
}
geojson = []
enums = {}
nullable = []
def _populateDependencies(self):
pass
| joshzarrabi/e-mission-server | emission/core/wrapper/tour_model.py | Python | bsd-3-clause | 318 |
"""
Vector heads and tails
----------------------
Many modules in PyGMT allow plotting vectors with individual
heads and tails. For this purpose, several modifiers may be appended to
the corresponding vector-producing parameters for specifying the placement
of vector heads and tails, their shapes, and the justificatio... | GenericMappingTools/gmt-python | examples/gallery/lines/vector_heads_tails.py | Python | bsd-3-clause | 3,149 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import fishbone
version = fishbone.__version__
setup(
name='fishbone',
version=version,
author="Mohamed Termoul",
author_email='mtermoul@... | mtermoul/fishbone | setup.py | Python | bsd-3-clause | 518 |
# Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
from digits.utils import subclass
@subclass
class Error(Exception):
pass
@subclass
class BadNetworkError(Error):
"""
Errors that occur when validating a network
"""
def __init__(self, message):
self.message = message
def... | batra-mlp-lab/DIGITS | digits/frameworks/errors.py | Python | bsd-3-clause | 825 |
#! /usr/bin/env python
"""U.S. Strike Duration Data"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = __doc__
SOURCE = """
This is a subset of the data used in Kennan (1985). It was originally
published by the Bureau of Labor Statistics.
::
Kennan, J. 1985. "The... | pprett/statsmodels | statsmodels/datasets/strikes/data.py | Python | bsd-3-clause | 1,924 |
###############################################################################
# trainingSet: training-set class for training a GP
#
# main routine: __init__
#
# example usage:
#
# trainingSetObject= trainingSet(listx=,listy=,noise=)
#
# where listx is a list of abcissae, listy is the corresponding set or... | jobovy/flexgp | flexgp/trainingSet.py | Python | bsd-3-clause | 5,727 |
'''
Build the pipeline workflow by plumbing the stages together.
'''
from ruffus import Pipeline, suffix, formatter, add_inputs, output_from
from stages import Stages
def make_pipeline(state):
'''Build the pipeline by constructing stages and connecting them together'''
# Build an empty pipeline
pipeline ... | bjpop/complexo_pipeline | src/pipeline.py | Python | bsd-3-clause | 6,819 |
"""
This defines a the Server's generic session object. This object represents
a connection to the outside world but don't know any details about how the
connection actually happens (so it's the same for telnet, web, ssh etc).
It is stored on the Server side (as opposed to protocol-specific sessions which
are stored o... | mrkulk/text-world | evennia/server/serversession.py | Python | bsd-3-clause | 11,791 |
"""
This script fixes data files that were recorded with a version of spikedetekt2
that contained a minor bug. This bug prevented the program to save the start time
of each recording. As a result, KlustaViewa was not able to display correlograms
because the spike times were not sorted (the spike times were in local tim... | klusta-team/kwiklib | patches/add_start_time.py | Python | bsd-3-clause | 1,769 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from collections import namedtuple
import sip
from PyQt5.QtWebKitWidgets import QWebPage, QWebView
from PyQt5.QtCore import QByteArray
from twisted.python import log
import six
from splash.har_builder import HarBuilder
RenderErrorInfo = namedtuple('Rende... | pawelmhm/splash | splash/qwebpage.py | Python | bsd-3-clause | 6,186 |
# -*- coding: utf-8 -*-
import subprocess
import shutil
import os
| fsys/js.lesscss | js/lesscss/script.py | Python | bsd-3-clause | 67 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import logging
import socket
import sys
from telemetry.core import util
from telemetry.core import exceptions
from telemetry.core.chrome impo... | codenote/chromium-test | tools/telemetry/telemetry/core/chrome/inspector_backend.py | Python | bsd-3-clause | 9,767 |
# Copyright 2016, 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 f... | googleapis/protoc-java-resource-names-plugin | plugin/utils/proto_utils.py | Python | bsd-3-clause | 3,560 |
"""Tests for the activitylog."""
from datetime import datetime
from nose.tools import eq_
import amo
import amo.tests
from mkt.webapps.models import Webapp
from mkt.users.models import UserProfile
class LogTest(amo.tests.TestCase):
def setUp(self):
u = UserProfile.objects.create(username='foo')
... | ngokevin/zamboni | apps/amo/tests/test_log.py | Python | bsd-3-clause | 976 |
# ----------------------------------------------------------------------------
# Copyright (c) 2015--, micronota development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ---------------------------------------------... | mortonjt/micronota | micronota/bfillings/_base.py | Python | bsd-3-clause | 5,337 |
import json
import os
from django.conf import settings
from django.core.management.base import BaseCommand
import commonware.log
import amo
from applications.models import Application, AppVersion
log = commonware.log.getLogger('z.cron')
# The validator uses the file created here to keep up to date with the
# apps a... | jbalogh/zamboni | apps/applications/management/commands/dump_apps.py | Python | bsd-3-clause | 1,065 |
#!/usr/bin/env python
from __future__ import division
import argparse
import os
import shutil as sh
import daedalus.lib.utils as du
#make_quantification_table
def parse_argument():
parser = argparse.ArgumentParser()
parser.add_argument("-i",help = "",required = True , dest = "features_path" , )
parser.add_a... | maxrbc/daedalus | scripts/make_features_quatification_table.py | Python | bsd-3-clause | 1,805 |