code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from rest_framework import serializers
from core.models import Match, Ranking
from users.models import User
class RankingSerializer(serializers.HyperlinkedModelSerializer):
player_username = serializers.Field(source='player.username')
class Meta:
model = Ranking
fields = ("url", "player", "pl... | agconti/pingu-web | pingu/api/serializers.py | Python | bsd-3-clause | 1,466 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-06-22 16:39
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('teamstore', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
... | jonathanmeier5/teamstore | saleor/teamstore/migrations/0002_auto_20170622_1139.py | Python | bsd-3-clause | 448 |
import code
import brackets
import sys
import argparse
import brackets.importer
from brackets.helpers import eval, exec, compile
from brackets import exception_handler
USAGE = "%(prog)s [-h | -c cmd | file | -] [arg] ..."
VERSION = "%(prog)s " + brackets.__version__
EPILOG = """ file program read from script
... | pooya-eghbali/brackets | brackets/shell.py | Python | bsd-3-clause | 3,209 |
from __future__ import absolute_import
from django import forms
from django.contrib.auth.models import Group, User
from django.http import HttpResponse, HttpResponseBadRequest
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
import json
from mezzanine.generic.mo... | hydroshare/hydroshare_temp | hs_core/views/users_api.py | Python | bsd-3-clause | 26,589 |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | flgiordano/netcash | +/google-cloud-sdk/lib/surface/compute/target_vpn_gateways/describe.py | Python | bsd-3-clause | 1,525 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.22 on 2019-08-14 17:37
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auth', '0008_alter_user_username_max_length'),
('j... | hotosm/osm-export-tool2 | jobs/migrations/0063_auto_20190814_1737.py | Python | bsd-3-clause | 1,552 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("MLPClassifier" , "FourClass_10" , "mssql")
| antoinecarme/sklearn2sql_heroku | tests/classification/FourClass_10/ws_FourClass_10_MLPClassifier_mssql_code_gen.py | Python | bsd-3-clause | 140 |
import urlparse
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, QueryDict
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.http import base36_to_int
from django.utils.translation impo... | kantai/passe-framework-prototype | django/contrib/auth/views.py | Python | bsd-3-clause | 10,339 |
#
# io_rgb.py -- RGB image file handling.
#
# 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 __future__ import print_function
import sys, time
import os
import numpy
... | sosey/ginga | ginga/util/io_rgb.py | Python | bsd-3-clause | 18,117 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019, 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.
"""Test single point logfiles in cclib."""
import datetime
import os
import unittest
import numpy
import p... | cclib/cclib | test/data/testSP.py | Python | bsd-3-clause | 24,236 |
global instruction_set
global support_set
instruction_set = {}
support_set = {}
def is_asm(view):
if view is None:
return False
try:
location = view.sel()[0].begin()
except IndexError:
return False
return view.match_selector(location, "source.assembly")
def is_instruction(st... | Nessphoro/sublimeassembly | code/helpers.py | Python | bsd-3-clause | 1,058 |
import threading
from django.conf import settings
import taskforce
class BaseTask(object):
"""Base class for all tasks.
Users are expected to implement their own Task classes by sub-classing this class.
"""
def __init__(self):
self._lock = threading.RLock()
self._status = taskforc... | mallipeddi/django-taskforce | base.py | Python | bsd-3-clause | 1,948 |
"""
sewpy: Source Extractor Wrapper for Python
Recent improvements (latest on top):
- better verbosity about masked output of ASSOC procedure
- ASSOC helper implemented
- run() now returns a dict containing several objects, such as the output astropy table, catfilepath, workdir, and logfilepath.
- now also works with... | dr-guangtou/hs_galphot | mask/hsRunSewpy.py | Python | bsd-3-clause | 51,622 |
"""
DESCRIPTION
-----------
For the directory provided on the command line sort the FITS files in this
way::
destination
|
|
|
|---'BIAS'
|
|---'DARK'
| |---exposure_time_1
| |---exposure_time_2, etc... | mwcraig/msumastro | msumastro/scripts/sort_files.py | Python | bsd-3-clause | 7,342 |
"""
fs.mountfs
==========
Contains MountFS class which is a virtual filesystem which can have other filesystems linked as branched directories.
For example, lets say we have two filesystems containing config files and resources respectively::
[config_fs]
|-- config.cfg
`-- defaults.cfg
[resources_fs]
... | atty303/pyfilesystem | fs/mountfs.py | Python | bsd-3-clause | 16,583 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
import os
try:
from setuptools import setup, find_packages, Command
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages, Command # noqa
from distutils.command.install import INS... | celery/celerymon | setup.py | Python | bsd-3-clause | 2,797 |
#!/usr/bin/env python
# coding: utf-8
#
# Copyright (c) 2015, PAL Team.
# All rights reserved. See LICENSE for details.
from flask import request
from flask.ext.restful import Resource
from flask_restful_swagger import swagger
class Validator(Resource):
REQUIRED_KEYS = ['query', 'client']
@classmethod
d... | Machyne/pal | pal/validator.py | Python | bsd-3-clause | 1,625 |
"""
========================================
Special functions (:mod:`scipy.special`)
========================================
.. module:: scipy.special
Nearly all of the functions below are universal functions and follow
broadcasting and automatic array-looping rules. Exceptions are noted.
Error handling
==========... | juliantaylor/scipy | scipy/special/__init__.py | Python | bsd-3-clause | 19,254 |
from django import forms
from django.conf import settings
from gollum.utils import FieldValues
import unittest
class FieldValuesSuite(unittest.TestCase):
"""Test suite for assessing the FieldValues subclass of dict,
and ensuring it gets values as I expect.
"""
def test_attrs(self):
"""Establis... | lukesneeringer/django-gollum | tests/test_field_values.py | Python | bsd-3-clause | 2,955 |
# Copyright (C) 2015, University of British Columbia
# Written (originally) by Mark Greenstreet (13th March, 2014)
# Counter-example generation: Carl Kwan (May 2016)
# Editted by Yan Peng (15th Nov 2016)
#
# License: A 3-clause BSD license.
# See the LICENSE file distributed with this software
from z3 import *... | pennyan/Smtlink | z3_interface/ACL2_to_Z3.py | Python | bsd-3-clause | 6,525 |
"""
Experiments of the paper 'The Approximation of the Dissimilarity
Projection' accepted at PRNI2012.
Quantification of the dissimilarity approximation of simulated 2D data
across different prototype selection policies and number of prototypes.
Copyright (c) 2012, Emanuele Olivetti
Distributed under the New BSD lic... | emanuele/prni2012_dissimilarity | dissimilarity_2d.py | Python | bsd-3-clause | 1,902 |
""" Tests for the fileio.pipe submodule """
from __future__ import print_function
import tempfile
import os
import glob
import numpy as np
from numpy.testing import assert_array_equal
import nmrglue as ng
from setup import DATA_DIR
# subroutines
def write_readback(dic, data):
""" Write out a NMRPipe file and... | atomman/nmrglue | tests/test_pipe.py | Python | bsd-3-clause | 22,127 |
from threading import Lock, Thread
from django.http import HttpRequest, HttpResponse
from django.test import TestCase
from nose.tools import eq_
from multidb import (DEFAULT_DB_ALIAS, MasterSlaveRouter,
PinningMasterSlaveRouter, get_slave)
from multidb.middleware import (PINNING_COOKIE, PINNING_S... | sonico999/django-multidb-router | multidb/tests.py | Python | bsd-3-clause | 7,867 |
# -*- coding: UTF-8 -*-
"""
Pytest configuration file.
"""
from click.testing import CliRunner
import pytest
@pytest.fixture(scope="function")
def cli_runner(request):
"""click_ CLI runner to execute click_ commands.
.. _click: https://click.pocoo.org/
"""
return CliRunner()
@pytest.fixture(scope="fu... | jenisys/click-configfile | tests/conftest.py | Python | bsd-3-clause | 884 |
#!/usr/bin/env python
#
# $Id$
#
# Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Print system memory information.
"""
import psutil
from psutil._compat import print_
def to_meg(n):
r... | hybridlogic/psutil | examples/meminfo.py | Python | bsd-3-clause | 758 |
from setuptools import setup
'''
Flask-OpenTracing
-----------------
This extension provides simple integration of OpenTracing in Flask applications.
'''
version = open('VERSION').read()
setup(
name='Flask-OpenTracing',
version=version,
url='http://github.com/opentracing-contrib/python-flask',
downloa... | kcamenzind/flask_opentracing | setup.py | Python | bsd-3-clause | 1,249 |
from wagtail.admin.views.bulk_action import BulkAction
from wagtail.core import hooks
class BulkActionRegistry:
def __init__(self):
self.actions = {} # {app_name: {model_name: {action_name: action_class]}}
self.has_scanned_for_bulk_actions = False
def _scan_for_bulk_actions(self):
if... | zerolab/wagtail | wagtail/admin/views/bulk_action/registry.py | Python | bsd-3-clause | 1,429 |
'''
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.
Example:
For num = 5 you should return [0,1,1,2,1,2].
Follow up:
It is very easy to come up with a solution with run time O(n*sizeof(intege... | shub0/algorithm-data-structure | python/count_bits.py | Python | bsd-3-clause | 823 |
"""
byceps.blueprints.admin.brand.authorization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from byceps.util.authorization import create_permission_enum
BrandPermission = create_permission_enum('brand', [
'create',
... | m-ober/byceps | byceps/blueprints/admin/brand/authorization.py | Python | bsd-3-clause | 334 |
#! /usr/bin/env python
# -*- mode: python; indent-tabs-mode: nil; -*-
# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
#
# Copyright (C) 2010,2011 Patrick Crews
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Soft... | jonzobrist/Percona-Server-5.1 | kewpie/lib/server_mgmt/percona.py | Python | bsd-3-clause | 13,075 |
import sys
print 'outputting'
sys.stdout.flush()
print >>sys.stderr, 'erroring'
| mgood/lola | test_scripts/output.py | Python | bsd-3-clause | 80 |
# -*- coding: utf-8 -*-
#
# llvmpy documentation build configuration file, created by
# sphinx-quickstart on Wed Aug 8 17:33:58 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 ... | alex/llvmpy | docs/source/conf.py | Python | bsd-3-clause | 7,890 |
from . import plot_utils
from . import p_utils
from . import stats
| bjedwards/python_lib | graph_comparison/utilities/__init__.py | Python | bsd-3-clause | 67 |
import pytest
from astropy.io.fits.hdu import PrimaryHDU
from astropy.io.fits import Header
from ..fitskeyword import FITSKeyword
class TestGoodFITSKeyword(object):
def setup_method(self, method):
self.name = "kwd"
self.value = 12
self.comment = 'This is a comment'
self.synonyms ... | mwcraig/msumastro | msumastro/header_processing/tests/test_fitskeyword.py | Python | bsd-3-clause | 5,359 |
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import zipfile
from django.core import serializers
from django.core.mail import EmailMessage
from django.utils.translation import ugettext as _
def mail_export(email, filename, serializer_kwargs, query_kwargs):
queryset = get_... | praekelt/django-export | export/utils.py | Python | bsd-3-clause | 1,736 |
from django.shortcuts import get_object_or_404, render, HttpResponse
from datetime import date
from ..models.report_models import Report
from ..models.journal_models import Equipment
from ..forms.report_forms import ChooseReportForm
from ..excel_utils import WriterToExcel
def reports(request):
try:
head_... | Igelinmist/etools | etools/apps/uptime/views/report_views.py | Python | bsd-3-clause | 1,920 |
import datetime
from functools import update_wrapper
from django.contrib import admin, messages
from django.contrib.admin.helpers import AdminErrorList, AdminForm
from django.contrib.auth import get_permission_codename
from django.contrib.auth.admin import csrf_protect_m
from django.core.exceptions import PermissionDe... | janusnic/djangocms-forms | djangocms_forms/admin.py | Python | bsd-3-clause | 9,784 |
from __future__ import absolute_import, unicode_literals
import json
from django.contrib.contenttypes.models import ContentType
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailadmin.widgets import AdminChooser
class AdminPollChooser(Ad... | frague59/wagtailpolls | wagtailpolls/widgets.py | Python | bsd-3-clause | 2,094 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-12-16 21:24
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operatio... | DjangoGirls/djangogirls | applications/migrations/0001_initial.py | Python | bsd-3-clause | 7,211 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 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
... | vlegoff/tsunami | src/primaires/salle/editeurs/redit/edt_sorties.py | Python | bsd-3-clause | 9,244 |
from django.conf import settings
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@python_2_unicode_compatible
class Category(models.Model):
name = models.CharField(_("Name"), max_length=255, unique=True)
positio... | byteweaver/django-forums | forums/models.py | Python | bsd-3-clause | 2,397 |
# fora
# class Site
# Xu [xw901103@gmail.com] Copyright 2015
from fora.core.dbsession import (
DBSession
)
from fora.models.site import SiteModel
class Site(object):
""" This class contains core functionality of fora site manipulation.
"""
model = None
def __init__(self):
self.model = None... | WayStudios/fora | fora/core/site.py | Python | bsd-3-clause | 1,642 |
''' Implements a very low level facility for communicating with a Bokeh
Server. Users will always want to use ``bokeh.client.session`` instead.
'''
from __future__ import absolute_import, print_function
import logging
log = logging.getLogger(__name__)
from tornado import gen, locks
from tornado.httpclient import HT... | DuCorey/bokeh | bokeh/client/_connection.py | Python | bsd-3-clause | 14,368 |
# -*- coding: utf8 -*-
import json
import requests
import os
import socket
import Queue
mainAgentId = -1
eventQueue = Queue.Queue()
status = {'created': 0, 'failed': 1, 'running': 2, 'succeeded': 3, 'canceled': 4, 'canceling': 5, 'destroyed': 6}
URL = os.getenv('CRAFT_DEMO_SAC_URL', '')
CRAFT_RUNTIME_SERVER_URL = o... | cloderic/SmartAlarmClock | src/server/runtime.py | Python | bsd-3-clause | 4,440 |
import os
import smtplib
from email.mime.text import MIMEText
from genshi import template
TPL_PATH = os.path.join('tpl', 'emails')
TPL_LOADER = template.TemplateLoader(TPL_PATH, default_class=template.NewTextTemplate)
MAIL_FROM = None
MAIL_RELAY = 'localhost'
def send_mail(toaddrs, subject, body):
"""Send an e... | FlorianLudwig/python-yawp | yawp/mail.py | Python | bsd-3-clause | 1,293 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2019 Edgewall Software
# Copyright (C) 2003-2005 Jonas Borgström <jonas@edgewall.com>
# Copyright (C) 2004-2006 Christopher Lenz <cmlenz@gmx.de>
# Copyright (C) 2005-2006 Christian Boos <cboos@edgewall.org>
# All rights reserved.
#
# This software is licensed as described ... | rbaumg/trac | trac/versioncontrol/web_ui/changeset.py | Python | bsd-3-clause | 55,336 |
import sys
import os
import serial
import time
from os.path import join
def send_data( c, data ):
c.read( 100 );
length = len( data )
c.write( "%d " % length )
print "Sending:%d bytes" % length
buffersize = 512
sent = 0
while sent < length:
... | SymbiSoft/logman-for-symbian | install.py | Python | bsd-3-clause | 2,830 |
#
# Module providing the `Pool` class for managing a process pool
#
# multiprocessing/pool.py
#
# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt
#
__all__ = ['Pool']
#
# Imports
#
import os
import sys
import errno
import threading
import Queue
import itertools
import collections
import time
import signal
imp... | WoLpH/celery | celery/concurrency/processes/pool.py | Python | bsd-3-clause | 36,955 |
# this contains imports plugins that configure py.test for astropy tests.
# by importing them here in conftest.py they are discoverable by py.test
# no matter how it is invoked within the source tree.
from __future__ import print_function, absolute_import, division
import os
from distutils.version import LooseVersion
... | keflavich/spectral-cube | spectral_cube/conftest.py | Python | bsd-3-clause | 17,148 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import datetime
import logging
import uuid
import functools
import itertools
from mongoengine import connect
from metadatastore.document import Document
from metadatastore.commands import (db_conne... | cowanml/samplemanager | src/samplemanager/commands.py | Python | bsd-3-clause | 15,009 |
#!/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.
"""Central list of tests to run (as appropriate for a given config). Add tests
to run by modifying this file.
Note that this file is b... | chinmaygarde/mojo | mojo/tools/get_test_list.py | Python | bsd-3-clause | 9,163 |
from __future__ import absolute_import
from django.conf import settings
try:
from django.conf.urls import url, patterns
except ImportError:
# for Django version less than 1.4
from django.conf.urls.defaults import url, patterns # NOQA
from django.http import HttpResponse
def handler404(request):
ret... | getsentry/raven-django | tests/urls.py | Python | bsd-3-clause | 1,247 |
from taskplus.core.actions import ListUserRolesRequest
def test_list_user_roles_request_without_parameters():
request = ListUserRolesRequest()
print(request.errors)
assert request.filters is None
assert request.is_valid() is True
def test_list_user_roles_request_with_empty_filters():
request = ... | Himon-SYNCRAFT/taskplus | tests/core/actions/list_user_roles/test_list_user_roles_request.py | Python | bsd-3-clause | 817 |
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
setup(
name='feincms-cleanse',
version='8',
description='Default HTML cleansing in FeinCMS',
long_description=open(
os.path.join(os.path.dirname(__file__), 'README.rst')).read(),
author='Matthias Kestenholz',
... | feincms/feincms-cleanse | setup.py | Python | bsd-3-clause | 1,056 |
from PySide.QtNetwork import QNetworkAccessManager
from PySide.QtNetwork import QNetworkProxy
from PySide.QtCore import SIGNAL, QUrl
import urlparse
from ghost.ghost import QNetworkRequest
class PtNetworkAccessManager(QNetworkAccessManager):
_url_filter = []
def __init__(self, parent):
QNetworkAccess... | ptphp/PtPy | ptapp/base/ptnetworkaccessmanager.py | Python | bsd-3-clause | 3,568 |
from django.conf.urls import url, patterns
from django.contrib import admin
from authx.views import RegistrationView
admin.autodiscover()
urlpatterns = patterns('authx.views',
url(r'^login/', 'login', name='login'),
url(r'^logout/', 'logout', name='logout'),
url(r'^register/', RegistrationView.as_view(),... | ace-han/quanquan | authx/urls.py | Python | bsd-3-clause | 340 |
#! /usr/bin/env python
from __future__ import print_function
import base64
import hashlib
import hmac
import os
import re
import sys
import time
from datetime import datetime, timedelta
from fnmatch import fnmatch
try:
from configparser import ConfigParser
except ImportError: # python 2
from ConfigParser imp... | exoscale/cs | cs/client.py | Python | bsd-3-clause | 18,349 |
from django.utils.translation import gettext_lazy as _, override
from cms.menu_bases import CMSAttachMenu
from menus.base import NavigationNode
from menus.menu_pool import menu_pool
class CatalogMenu(CMSAttachMenu):
name = _("Catalog Menu")
def get_nodes(self, request):
try:
if self.inst... | awesto/django-shop | shop/cms_menus.py | Python | bsd-3-clause | 1,114 |
from codecs import open
from os import path
import setuptools
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setuptools.setup(
name='factor_rotation',
version='0.1.0',... | mvds314/factor_rotation | setup.py | Python | bsd-3-clause | 1,082 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('upload', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='spreadsheetperson'... | opencivicdata/opencivicdata.org | upload/migrations/0002_auto_20141105_1527.py | Python | bsd-3-clause | 798 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import configparser
import math
import sys
OVERHEAT_TEMPERATURE = 1200
BURN_TEMPERATURE = 1500
SOLAR_POWER = 3.094
def print_u(str):
bytes_str = (str + "\n").encode('utf8')
sys.stdout.buffer.write(bytes_str)
class Ship:
name = "Unnamed"
min_heatsink_ratio = 0.0
max_... | arbonagw/HeliumRain | Tools/heatcalculator.py | Python | bsd-3-clause | 9,348 |
class MatchEnumerationType(object):
def __init__(self):
self.exact = ''
self.phonetic = ''
self.none = ''
exact = 'exact'
phonetic = 'phonetic'
none = 'none'
| M4gn4tor/mastercard-api-python | Services/match/domain/matchenumerationtype.py | Python | bsd-3-clause | 199 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 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
... | vlegoff/tsunami | src/primaires/scripting/fonctions/autour.py | Python | bsd-3-clause | 3,174 |
#!/usr/bin/env python
from __future__ import print_function
a=1
while a < 10:
print(a)
a+=1
print("I'm done counting!")
| Caoimhinmg/PmagPy | data_files/LearningPython/while1.py | Python | bsd-3-clause | 128 |
"""
User-level analysis commands, typically for measuring or generating SheetViews.
Most of this file consists of commands for creating SheetViews, paired
with a template for how to construct plots from these SheetViews.
For instance, the implementation of Activity plots consists of the
update_activity() command plus... | jesuscript/topo-mpi | topo/command/analysis.py | Python | bsd-3-clause | 53,640 |
#!/usr/bin/env python
import roslib; roslib.load_manifest('vrep_ros_teleop')
import rospy
from sensor_msgs.msg import Joy
from std_msgs.msg import String
from topic_tools.srv import MuxSelect
mux_proxy = None
joystick_button = 0
joystick_topic = "/joy/topic"
auto_button = 1
auto_topic = "/auto/topic"
selected = ""
las... | cedricpradalier/vrep_ros_ws | src/vrep_ros_teleop/src/teleop_mux.py | Python | bsd-3-clause | 2,155 |
# Copyright 2018 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.
"""Utilities for importing python proto modules."""
import os
import sys
_CURRENT_DIRECTORY = os.path.dirname(os.path.abspath(__file__))
_ROOT_DIRECTORY = ... | endlessm/chromium-browser | chrome/chrome_cleaner/tools/import_util.py | Python | bsd-3-clause | 2,747 |
import struct
import threading
from BAL.Timers.watch_dog_timer import WatchDogTimer
from BAL.protocol.packages.channel_respond import ChannelRespond
from BAL.protocol.packages.clib_status import ClibStatus, CANCEL, SAVE, RESET
from BAL.protocol.serial_hadler import SerialHandler
from BAL.protocol.packages.header import... | robotican/ric | ric_board/scripts/RiCTakeover/BAL/protocol/protocol_handler.py | Python | bsd-3-clause | 4,075 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import unittest
from pp.latchpony.model.competition import LocalCompetition as Competition
skip = pytest.mark.skip
class TestSlotsAPIUsage(unittest.TestCase):
def test_get_slot_types_for(self):
#org_id = "org-user-2719963b00964c01b42b5d81c998... | pythonpro-dev/pp-latchpony | Model/pp/latchpony/model/tests/test_logicforslots.py | Python | bsd-3-clause | 4,560 |
"""
Rickie Kerndt <rkerndt@cs.uoregon.edu>
Module for controlling Andice Labs PowerCape avr
"""
from __future__ import print_function
import smbus
import sys
class AVR:
"""
Monitor and controll operation of Andice Labs PowerCape avr
"""
# AVR constants
I2C_BUS = 1
I2C_ADDRESS = 0x21
STATU... | rkerndt/power_meter | avr.py | Python | bsd-3-clause | 4,632 |
from __future__ import print_function
from sympy import symbols,sqrt
from galgebra.printer import Eprint
from galgebra.ga import Ga
def main():
Eprint()
X = (x,y,z) = symbols('x y z',real=True)
(o3d,ex,ey,ez) = Ga.build('e_x e_y e_z',g=[1,1,1],coords=(x,y,z))
A = x*(ey^ez) + y*(ez^ex) + z*(ex^ey)
... | arsenovic/galgebra | examples/Terminal/prob_not_solenoidal.py | Python | bsd-3-clause | 681 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from django.contrib import admin
from django.utils.encoding impo... | divio/django-shop | shop/admin/customer.py | Python | bsd-3-clause | 5,322 |
''' Extractors that operate on AudioStim inputs. '''
from abc import ABCMeta
from os import path
import sys
import logging
import numpy as np
from scipy import fft
import pandas as pd
from pliers.stimuli.audio import AudioStim
from pliers.stimuli.text import ComplexTextStim
from pliers.extractors.base import Extract... | tyarkoni/featureX | pliers/extractors/audio.py | Python | bsd-3-clause | 22,611 |
from typing import List, Union
import hashlib
import io
# Required for InstallApplication to work.
DEFAULT_MD5_CHUNK_SIZE = 10485760
def chunked_hash(stream: Union[io.RawIOBase, io.BufferedIOBase], chunk_size: int = DEFAULT_MD5_CHUNK_SIZE) -> List[bytes]:
"""Create a list of hashes of chunk_size size in bytes.
... | mosen/commandment | commandment/pkg/manifest.py | Python | mit | 879 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/hair/rodian/shared_hair_rodian_female_s21.iff"
result.attribute_tem... | anhstudios/swganh | data/scripts/templates/object/tangible/hair/rodian/shared_hair_rodian_female_s21.py | Python | mit | 454 |
# Licensed under an MIT open source license - see LICENSE
from __future__ import print_function, absolute_import, division
import pytest
import numpy.testing as npt
import numpy as np
import astropy.units as u
from astropy.io import fits
from astropy.convolution import convolve_fft
import os
try:
import pyfftw
... | e-koch/TurbuStat | turbustat/tests/test_vca.py | Python | mit | 10,168 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# desktop_info.py
#
# Copyright © 2013-2015 DSGos
#
# This file is part of DSGos_Installer.
#
# DSGos_Installer is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundat... | DecisionSystemsGroup/DSGos | airootfs/usr/share/DSGos-Installer/DSGos_Installer/desktop_info.py | Python | mit | 7,098 |
from phonenumber_field.phonenumber import PhoneNumber
from .models import Profile
def has_valid_phone_number(user):
"""Return a boolean signalling if the user has a valid telephone number associated with his account"""
try:
profile = user.profile
except Profile.DoesNotExist:
return False... | mcallistersean/b2-issue-tracker | toucan/user_profile/utils.py | Python | mit | 426 |
from .stop_words import STOP_WORDS
from .lex_attrs import LEX_ATTRS
from ...language import Language, BaseDefaults
class TeluguDefaults(BaseDefaults):
lex_attr_getters = LEX_ATTRS
stop_words = STOP_WORDS
class Telugu(Language):
lang = "te"
Defaults = TeluguDefaults
__all__ = ["Telugu"]
| honnibal/spaCy | spacy/lang/te/__init__.py | Python | mit | 309 |
from ..cart import Cart
def cart(request):
return {'cart': Cart(request) }
| janusnic/dj-21v | unit_15/mysite/cart/processors/context_processors.py | Python | mit | 80 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-23 11:51
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('excerptexport', '0037_auto_20160523_1132'),
]
operations = [
migrations.RemoveField(... | geometalab/osmaxx | osmaxx/excerptexport/migrations/0038_remove_outputfile_file_old.py | Python | mit | 404 |
"""
Support for the google speech service.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/tts/google/
"""
import asyncio
import logging
import re
import aiohttp
import async_timeout
import voluptuous as vol
import yarl
from homeassistant.components.tt... | xifle/home-assistant | homeassistant/components/tts/google.py | Python | mit | 4,233 |
# Print list of rules with invalid algs
import argparse
import logging
import sys
import pytz
from api import config
def shift_timezone(find, replace):
utc = pytz.timezone('UTC')
try:
find_tz = pytz.timezone(find)
replace_tz = pytz.timezone(replace)
except:
logging.excepti... | scitran/api | bin/oneoffs/timezone_shift.py | Python | mit | 2,465 |
#!/usr/bin/env python
import os,sys,subprocess,shutil
#print os.environ
#var="exiftool -if '$jpgfromraw' -b -jpgfromraw -w %d%f_%ue.jpg -execute -if '$previewimage' -b -previewimage -w %d%f_%ue.jpg -execute -tagsfromfile @ -srcfile %d%f_%ue.jpg -overwrite_original -common_args --ext jpg DIR"
#exifcmd = list(var.s... | relic7/prodimages | python/raw_jpg_extractor.py | Python | mit | 1,140 |
#!/usr/bin/env python
#
# Copyright (C) 2017 ShadowMan
#
from functools import reduce
class MaxSubSequenceSum(object):
def __init__(self, sequence: list):
self._seq = sequence
self._sum = sequence[0]
self._left_index = 0
self._right_index = 0
def calc(self):
... | JShadowMan/data-structures-and-algorithm-analysis | ch02/2.4.3_max_sub_sequence_sum/4. Best-algorithm/best_algorithm.py | Python | mit | 1,050 |
# coding: utf-8
# Author: 阿财(Rgveda@github)(11652964@qq.com)
# Created date: 2018-06-08
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2018 yutiansut/QUANTAXIS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to de... | yutiansut/QUANTAXIS | QUANTAXIS/QAFetch/QAhuobi_realtime.py | Python | mit | 32,739 |
from django.conf import settings
from rest_framework import serializers
from rest_framework.fields import empty
class ReadOnlyDatetimeField(serializers.ReadOnlyField):
"""This is a read-only field that properly formats datetime values."""
def to_representation(self, value):
try:
# Ensure... | tndatacommons/tndata_backend | tndata_backend/utils/serializer_fields.py | Python | mit | 2,716 |
from timeit import default_timer as clock
from sympy import ring, ZZ
R, x, y, z, w = ring("x y z w", ZZ)
e = (x+y+z+w)**15
t1 = clock()
f = e*(e+w)
t2 = clock()
#print f
print("Total time:", t2-t1, "s")
print("number of terms:", len(f))
| bjodah/symengine.py | benchmarks/expand2b_sympy.py | Python | mit | 237 |
import json
import os
import shutil
import time
import uuid
from configparser import SafeConfigParser
import requests as _requests
from requests_toolbelt.multipart.encoder import MultipartEncoder
import magic
from installed_clients.DataFileUtilClient import DataFileUtil
from installed_clients.KBaseReportClient import... | Tianhao-Gu/kb_uploadmethods | lib/kb_uploadmethods/Utils/UnpackFileUtil.py | Python | mit | 10,816 |
# Copyright (c) 2010 Resolver Systems Ltd, PythonAnywhere LLP
# See LICENSE.md
#
import json
from datetime import datetime, timedelta
from mock import Mock, patch
import unittest
import django
from django.contrib.auth.models import User
from django.db import transaction
from django.http import Http404, HttpResponse, ... | pythonanywhere/dirigible-spreadsheet | dirigible/sheet/tests/test_views_api_0_1.py | Python | mit | 15,687 |
#!/usr/bin/env python
"""
Read a maf and output a single block fasta file, concatenating blocks
usage %prog species1,species2 maf_file out_file
"""
#Dan Blankenberg
import sys
from galaxy import eggs
import pkg_resources; pkg_resources.require( "bx-python" )
from bx.align import maf
from galaxy.tools.util import maf_... | volpino/Yeps-EURAC | tools/maf/maf_to_fasta_concat.py | Python | mit | 2,085 |
from __future__ import unicode_literals, division, absolute_import
from collections import defaultdict
import logging
import re
from datetime import datetime
from sqlalchemy.orm import relationship
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.schema import Table, ForeignKey
from sqlalchemy import Colum... | camon/Flexget | flexget/plugins/generic/archive.py | Python | mit | 19,359 |
#coding:utf-8
import numpy as np
import pylab
"""
多層パーセプトロンによる関数近似
PRMLと添え字の使い方を合わせたナイーブな実装
ループ処理を行列演算に置き換えるなど高速化はしていない
"""
# 訓練データ数
N = 50
# 学習率
ETA = 0.1
# ループ回数
NUM_LOOP = 1000
# 入力層のユニット数(バイアス含む)
NUM_INPUT = 2
# 隠れ層のユニット数(バイアス含む)
NUM_HIDDEN = 4
# 出力層のユニット数
NUM_OUTPUT = 1
def heviside(x):
"""Heviside関数"""
... | sylvan5/PRML | ch5/function_approximation.py | Python | mit | 5,356 |
"""test stt module."""
import random
import string
try: # py3
from unittest import mock
except ImportError: # py2
import mock
import pytest
skip_because_stt_removed = pytest.mark.skip(reason='stt module removed.')
def get_random_string(exclude_list=None):
"""get random gender which is not 'female' or ... | anurag-ks/Melissa-Core | tests/test_stt.py | Python | mit | 9,203 |
# -*- coding: utf-8 -*-
# Copyright: See the LICENSE file.
import datetime
import functools
import warnings
import factory
from .compat import mock
from . import alter_time
def disable_warnings(fun):
@functools.wraps(fun)
def decorated(*args, **kwargs):
with warnings.catch_warnings():
w... | rrauenza/factory_boy | tests/utils.py | Python | mit | 2,218 |
import sublime, json, urllib
CFDOCS_TEMPLATE = ""
CFDOCS_PARAM_TEMPLATE = ""
CFDOCS_ERROR_TEMPLATE = ""
CFDOCS_BASE_URL = "https://raw.githubusercontent.com/foundeo/cfdocs/master/data/en/"
def load(plugin_path):
global CFDOCS_TEMPLATE, CFDOCS_PARAM_TEMPLATE, CFDOCS_ERROR_TEMPLATE
CFDOCS_TEMPLATE = load_tem... | aaronstoddard/sublimetext-lucee | lib/cfdocs.py | Python | mit | 2,493 |
#-*- coding: utf-8 -*-
"""
Copyright (c) 2012 University of Oxford
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify... | benosteen/RDFDatabank | rdfdatabank/config/environment.py | Python | mit | 2,884 |
import sys
import string
import itertools
import logging
from dateutil.parser import parse as dateparser
from collections import OrderedDict
from namedentities import numeric_entities, named_entities
# some utility functions
letters = [ c for c in string.uppercase ]
double_aff = [ "%c%c" % (x,y) for (x,y) in itertool... | aaccomazzi/adsabs-pyingest | serializers/classic.py | Python | mit | 2,704 |
import json
from botocore.exceptions import ClientError
IAMName = 's3same_travis'
def _policy_string(bucket):
return json.dumps({
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:ListBucket",
],
"Effect": ... | vokal-isaac/s3same | s3same/iam.py | Python | mit | 3,893 |
"""Platform for the iZone AC."""
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_EXCLUDE, Platform
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassis... | rohitranjan1991/home-assistant | homeassistant/components/izone/__init__.py | Python | mit | 1,746 |