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
# tests the standard library of math functions
import unittest
import math
import cmath
import string
import commands
import types
import testbase
import absyn
import codegen
import fractparser
import fractlexer
import fsymbol
import translate
class Test(testbase.TestBase):
def setUp(self... | ericchill/gnofract4d | fract4d/test_stdlib.py | Python | bsd-3-clause | 14,992 |
"""
URLconf for registration and activation, using the paypal_registration backend
If the default behavior of these views is acceptable to you, simply
use a line like this in your root URLconf to set up the default URLs
for registration::
(r'^accounts/', include('registration.backends.default.urls')),
"""
from ... | buchuki/django-registration-paypal | paypal_registration/urls.py | Python | bsd-3-clause | 1,950 |
from django.contrib import admin
from api.models import OAuthClient
@admin.register(OAuthClient)
class SequenceAdmin(admin.ModelAdmin):
pass
| harvard-vpal/bridge-adaptivity | bridge_adaptivity/api/admin.py | Python | bsd-3-clause | 148 |
#
# Guernsey REST client package, based on the Java Jersey client.
# Copyright (c) 2011 Simon Johnston (simon@johnstonshome.org)
# See LICENSE.txt included in this distribution or more details.
#
import logging
try:
import json
except:
json = None
from xml.etree.ElementTree import fromstring, _ElementInterfac... | johnstonskj/guernsey | guernsey/entities.py | Python | bsd-3-clause | 4,713 |
from typing import Tuple
import torch
import torchvision
from torch import Tensor
from torchvision.extension import _assert_has_ops
from ..utils import _log_api_usage_once
from ._box_convert import _box_cxcywh_to_xyxy, _box_xyxy_to_cxcywh, _box_xywh_to_xyxy, _box_xyxy_to_xywh
def nms(boxes: Tensor, scores: Tensor, ... | pytorch/vision | torchvision/ops/boxes.py | Python | bsd-3-clause | 12,872 |
from django.conf.urls import url
from corehq.apps.toggle_ui.views import ToggleListView, ToggleEditView
urlpatterns = [
url(r'^$', ToggleListView.as_view(), name=ToggleListView.urlname),
url(r'^edit/(?P<toggle>[\w_-]+)/$', ToggleEditView.as_view(), name=ToggleEditView.urlname),
]
| qedsoftware/commcare-hq | corehq/apps/toggle_ui/urls.py | Python | bsd-3-clause | 291 |
import os
import sys
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
# Include BOOTSTRAP3_FOLDER in path
BOOTSTRAP3_FOLDER = os.path.abspath(os.path.join(BASE_DIR, "..", "bootstrap3"))
if BOOTSTRAP3_FOLDER not in sys.path:
sys.path.insert(0, BOOTSTRAP3_FOLDER)
DEBUG = True
ADMINS = ()
... | dyve/django-bootstrap3 | example/app/settings.py | Python | bsd-3-clause | 5,053 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from argparse import ArgumentError
import textwrap
from warnings import warn
class Plugin(object):
"""
Base class for test plugins. It's recommended but not *necessary* to
subclass this class to create a plugin, but all plugins *must* implem... | samuelmaudo/yepes | yepes/test/plugins/base.py | Python | bsd-3-clause | 8,371 |
#!/usr/bin/env python
#Copyright (c) 2010 Gerson Minichiello
#
#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... | bretlowery/snakr | lib/PyOpenGraph/PyOpenGraph.py | Python | bsd-3-clause | 3,011 |
#!/usr/bin/env python
"""
Parts of this file were taken from the pyzmq project
(https://github.com/zeromq/pyzmq) which have been permitted for use under the
BSD license. Parts are from lxml (https://github.com/lxml/lxml)
"""
import os
from os.path import join as pjoin
import pkg_resources
import platform
from distut... | toobaz/pandas | setup.py | Python | bsd-3-clause | 28,584 |
"""
An IPython extension that provides a magic command that displays
a table with information about versions of installed modules.
This makes it much easier to determine which versions of modules
were installed in the source IPython interpreter's environment.
Produces output in:
* Plaintext (IPython [qt]console)
* H... | chrisdembia/yeadon | examples/bicyclerider/version_information.py | Python | bsd-3-clause | 5,785 |
for t in range(100000000):
if (11 + (t + 1)) % 13 == 0:
if (0 + (t + 2)) % 5 == 0:
if (11 + (t + 3)) % 17 == 0:
if (0 + (t + 4)) % 3 == 0:
if (2 + (t + 5)) % 7 == 0:
if (17 + t + 6) % 19 == 0:
if (0... | MaxwellBo/Advent_Of_Code_2016 | Day_15.py | Python | bsd-3-clause | 420 |
#!/usr/bin/env python
"""
Makecpptraj
===========
Usage
-----
./makecpptraj.py title trajlen interval parm traj
"""
import sys
def getwindow(trajlen,interval=2000):
i = trajlen
timewindows=[]
while i > 0:
timewindows.append(i)
i = i - interval
timewindows.append(0)
return tim... | avishek-r-kumar/dfitools | MD_DFI_analysis/makecpptraj.py | Python | bsd-3-clause | 1,742 |
'''
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.html
version: 1.0.0b1
'''
ACCESS='access'
ATTRIBUTE='attribute'
BEFORE='before'
BETA='beta'
BUBBLES='bubbles'
CANCELABLE='cancelable'
CHAINABLE='chainable'
CHANGEEVENT='Change'
CLASS='cl... | isaacs/yuidoc | bin/const.py | Python | bsd-3-clause | 1,665 |
from django.apps import AppConfig
class Report2019Config(AppConfig):
name = "report_2019"
| DemocracyClub/Website | democracy_club/apps/report_2019/apps.py | Python | bsd-3-clause | 96 |
"""
Support for cftime axis in matplotlib.
"""
import warnings
import cftime
import matplotlib.dates as mdates
import matplotlib.ticker as mticker
import matplotlib.transforms as mtransforms
import matplotlib.units as munits
import numpy as np
from ._version import version as __version__ # noqa: F401
_DEFAULT_RESO... | SciTools/nc-time-axis | nc_time_axis/__init__.py | Python | bsd-3-clause | 16,851 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-06-06 15:28
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auth', '0008_alter_user_u... | hydroshare/hydroshare | hs_access_control/migrations/0030_groupcommunityinvite_groupcommunityrequest.py | Python | bsd-3-clause | 2,842 |
# -*- coding: utf-8 -*-
from cms import constants
from cms.utils.conf import get_cms_setting
from django.core.exceptions import PermissionDenied
from cms.exceptions import NoHomeFound, PublicIsUnmodifiable
from cms.models.managers import PageManager, PagePermissionsPermissionManager
from cms.models.metaclasses import P... | adaptivelogic/django-cms | cms/models/pagemodel.py | Python | bsd-3-clause | 44,462 |
# coding:utf-8
import unittest2 as unittest
from cactus import ui
class UITestCase(unittest.TestCase):
def test_coerce_yes_no(self):
self.assertEqual(True, ui._yes_no_coerce_fn("y"))
self.assertEqual(True, ui._yes_no_coerce_fn("Y"))
self.assertEqual(False, ui._yes_no_coerce_fn("n"))
... | dreadatour/Cactus | cactus/tests/test_ui.py | Python | bsd-3-clause | 2,199 |
#!/usr/bin/env python
import glob
import os
import platform
import shutil
import stat
import sys
from distutils import log
from distutils import dir_util
from distutils.command.build_clib import build_clib
from distutils.command.sdist import sdist
from distutils.core import setup
from distutils.sysconfig import get_py... | zneak/capstone | bindings/python/setup.py | Python | bsd-3-clause | 6,134 |
__author__ = 'anthony <>'
from collections import OrderedDict
from django import forms
class FormOrderMixin(object):
def order_fields(self, field_order):
"""
Rearranges the fields according to field_order.
field_order is a list of field names specifying the order. Fields not
inclu... | unicefuganda/uSurvey | survey/forms/form_helper.py | Python | bsd-3-clause | 1,258 |
""" Client-side interactivity. """
from __future__ import absolute_import
from types import FunctionType
from ..model import Model
from ..util.dependencies import import_required
from ..util.compiler import nodejs_compile, CompilationError
from ..core.properties import abstract
from ..core.properties import Dict, In... | azjps/bokeh | bokeh/models/callbacks.py | Python | bsd-3-clause | 3,093 |
from pytest_djangoapp import configure_djangoapp_plugin
pytest_plugins = configure_djangoapp_plugin(
{
'LANGUAGE_CODE': 'ru',
},
admin_contrib=True,
)
| idlesign/django-admirarchy | admirarchy/tests/conftest.py | Python | bsd-3-clause | 174 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import url, include
from rest_framework import routers
from shop.forms.checkout import ShippingAddressForm, BillingAddressForm
from shop.views.address import AddressEditView
from shop.views.cart import CartViewSet, WatchViewSet
from... | nimbis/django-shop | shop/urls/rest_api.py | Python | bsd-3-clause | 1,168 |
# -*- coding: utf-8 -*-
import pytest
from bravado_core.exception import SwaggerMappingError
from bravado_core.unmarshal import unmarshal_object
from bravado_core.spec import Spec
@pytest.fixture
def address_spec():
return {
'type': 'object',
'properties': {
'number': {
... | admetricks/bravado-core | tests/unmarshal/unmarshal_object_test.py | Python | bsd-3-clause | 4,494 |
#!/usr/bin/env python
from __future__ import print_function, division, absolute_import
import re
import os
from copy import deepcopy
import numpy as np
import toytree
import toyplot
#######################################################
# Exception Classes
#######################################################
c... | eaton-lab/toytree | toytree/utils.py | Python | bsd-3-clause | 22,118 |
##########################################################################
#
# Copyright (c) 2015, Image Engine Design 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:
#
# * Redistrib... | goddardl/gaffer | python/GafferTest/ApplicationTest.py | Python | bsd-3-clause | 2,198 |
"""
Simple http server to create streams for asyncio tests
"""
import asyncio
import aiohttp
from aiohttp import web
import codecs
from utils.streamdecoder import DecodingStreamReader
async def get_data(host, port):
url = 'http://{}:{}/'.format(host, port)
decoder = codecs.getincrementaldecoder('utf-8')(erro... | ethanfrey/aiojson | aiojson/echo_server.py | Python | bsd-3-clause | 1,771 |
from typing import Any
from dependency_injector import providers
# Test 1: to check the return type
provider1 = providers.Selector(
lambda: 'a',
a=providers.Factory(object),
b=providers.Factory(object),
)
var1: Any = provider1()
# Test 2: to check the provided instance interface
provider2 = providers.Se... | rmk135/objects | tests/typing/selector.py | Python | bsd-3-clause | 1,159 |
# This file is part of the ISIS IBEX application.
# Copyright (C) 2012-2016 Science & Technology Facilities Council.
# All rights reserved.
#
# This program is distributed in the hope that it will be useful.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License... | ISISComputingGroup/EPICS-inst_servers | ArchiverAccess/test_modules/test_database_config_builder.py | Python | bsd-3-clause | 16,638 |
#
# Author: Travis Oliphant 2002-2011 with contributions from
# SciPy Developers 2004-2011
#
from functools import partial
from scipy import special
from scipy.special import entr, logsumexp, betaln, gammaln as gamln, zeta
from scipy._lib._util import _lazywhere, rng_integers
from numpy import floor, ceil, ... | WarrenWeckesser/scipy | scipy/stats/_discrete_distns.py | Python | bsd-3-clause | 50,628 |
import shutil
import os
import re
import logging
class RenameTo(object):
"""
Renames a given file. Performs a case sensitive search and replace on the filename, then renames it.
Also supports regular expressions.
"""
config_name = 'rename-to'
def __init__(self, parameters):
self.logge... | jashort/SmartFileSorter | smartfilesorter/actionplugins/renameto.py | Python | bsd-3-clause | 2,257 |
from conf import config
from util import *
import settings
import base64
qpat = re.compile(r'\?')
if settings.DEBUG:
import logging
logging.basicConfig()
log = logging.getLogger('PyGoogleVoice')
log.setLevel(logging.DEBUG)
else:
log = None
class Voice(object):
"""
Main voice instance for... | twbarber/pygooglevoice | googlevoice/voice.py | Python | bsd-3-clause | 11,310 |
# importing anything from analysis segfaults java with netlogo on a mac
# for now no clue why
#
from . import pairs_plotting
from .b_and_w_plotting import set_fig_to_bw
from .cart import setup_cart, CART
from .feature_scoring import (get_ex_feature_scores, get_feature_scores_all,
get_rf_f... | quaquel/EMAworkbench | ema_workbench/analysis/__init__.py | Python | bsd-3-clause | 682 |
import numpy as np
from numpy import linalg as la
from numpy import testing as np_testing
from pymanopt.manifolds import FixedRankEmbedded
from .._test import TestCase
class TestFixedRankEmbeddedManifold(TestCase):
def setUp(self):
self.m = m = 10
self.n = n = 5
self.k = k = 3
se... | pymanopt/pymanopt | tests/test_manifolds/test_fixed_rank.py | Python | bsd-3-clause | 7,028 |
from south.db import db
from django.db import models
from mypage.rsswidgets.models import *
class Migration:
def forwards(self, orm):
# Adding field 'MultiRSSWidget.config_json'
db.add_column('rsswidgets_multirsswidget', 'config_json', models.TextField())
def b... | ella/mypage | mypage/rsswidgets/migrations/0003_add_config.py | Python | bsd-3-clause | 1,553 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import unittest
import sys
from .common_imports import StringIO, etree, HelperTestCase, _str, _bytes, _chr, needs_libxml
try:
unicode
except NameError:
unicode = str
ascii_uni = _bytes('a').decode('utf8')
klingon = _bytes("\\uF8D2").decode("uni... | lxml/lxml | src/lxml/tests/test_unicode.py | Python | bsd-3-clause | 7,379 |
import windows.generated_def as gdef
def test_format_charactere_values():
assert gdef.FC_ZERO == 0
assert gdef.FC_PAD == 0x5c
assert gdef.FC_PAD == 0x5c
assert gdef.FC_SPLIT_DEREFERENCE == 0x74
assert gdef. FC_SPLIT_DIV_2 == 0x75
assert gdef.FC_HARD_STRUCT == 0xb1
assert gdef.FC_TRANSMIT_A... | hakril/PythonForWindows | tests/test_midl.py | Python | bsd-3-clause | 380 |
import operator
import pytest
from pandas import Series
@pytest.fixture
def dtype():
"""A fixture providing the ExtensionDtype to validate."""
raise NotImplementedError
@pytest.fixture
def data():
"""Length-100 array for this type.
* data[0] and data[1] should both be non missing
* data[0] an... | cbertinato/pandas | pandas/tests/extension/conftest.py | Python | bsd-3-clause | 3,728 |
# -*- coding: utf-8 -*-
#
# PressMess processors.py.
# This file contains template processor functions.
# Copyright (C) 2013 Michał Kwiatkowski <michaelflowersky at gmail dot com>
# This file is released under the BSD license, see the COPYING file
from django.conf import settings
def disqus(request):
"""
Hand... | michaelflowersky/pressmess | blog/processors.py | Python | bsd-3-clause | 1,181 |
from corehq.apps.domain.auth import formplayer_auth
from corehq.apps.ota.case_restore import get_case_restore_response
@formplayer_auth
def migration_restore(request, domain, case_id):
"""Moved to `ota` app. Can be removed once Formplayer is updated."""
return get_case_restore_response(domain, case_id)
| dimagi/commcare-hq | corehq/apps/case_migrations/views.py | Python | bsd-3-clause | 314 |
"""pyaiot messaging test module."""
import json
from pytest import mark
from pyaiot.common.messaging import Message
@mark.parametrize('message', [1234, "test", "àéèïôû"])
def test_serialize(message):
serialized = Message.serialize(message)
assert serialized == json.dumps(message, ensure_ascii=False)
def ... | pyaiot/pyaiot | pyaiot/tests/test_messaging.py | Python | bsd-3-clause | 2,476 |
#!/usr/bin/env python3
# vim: set et sw=4 sts=4 fileencoding=utf-8:
#
# An alternate Python Minecraft library for the Rasperry-Pi
# Copyright (c) 2013-2016 Dave Jones <dave@waveform.org.uk>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following c... | waveform80/picraft | setup.py | Python | bsd-3-clause | 4,929 |
# -*- coding: utf-8 -*-
"""
A class to load the SeparatorRegion of a PageXml to add features to the
edges of a graph conjugate used for segmentation.
It specialises the _index method to add specific attributes to the edges
, so that the specific feature transformers can be used.
Copyright... | Transkribus/TranskribusDU | TranskribusDU/graph/pkg_GraphBinaryConjugateSegmenter/PageXmlSeparatorRegion.py | Python | bsd-3-clause | 6,028 |
import numpy as np
from config import *
from get_tile_data import get_tile_data
from compute_accuracy_iou import compute_accuracy_and_iou
[test_x, test_y] = get_tile_data(NUM_DATA['TEST'], RAND_SEED['TEST'])
def predict(prototxt, caffe_model):
net = caffe.Net(prototxt, caffe_model, caffe.TEST)
dinputs = {}
... | MPI-IS/bilateralNN | bilateralnn_code/examples/tile_segmentation/predict.py | Python | bsd-3-clause | 710 |
"""
Whip database storage module.
All IP ranges with associated information are stored in a LevelDB
database.
Some remarks about the construction of database records:
* The most recent version of a record is stored in full, and older dicts
are stored in a history structure of (reverse) diffs. This saves a lot
of... | wbolster/whip | whip/db.py | Python | bsd-3-clause | 12,080 |
# -*- coding: utf-8 -*-
#
# Copyright (C)2005-2010 Edgewall Software
# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.e... | zjj/trac_hack | trac/db/sqlite_backend.py | Python | bsd-3-clause | 11,446 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2013 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consi... | dafrito/trac-mirror | trac/ticket/tests/report.py | Python | bsd-3-clause | 4,474 |
# Copyright 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.
"""Provides stubs for os, sys and subprocess for testing
This test allows one to test code that itself uses os, sys, and subprocess.
"""
import ntpath
impo... | Bysmyyr/chromium-crosswalk | tools/telemetry/telemetry/testing/system_stub.py | Python | bsd-3-clause | 14,620 |
"""
The Precomputed format is a neuroscience imaging format
designed for cloud storage. The specification is located
here:
https://github.com/google/neuroglancer/tree/master/src/neuroglancer/datasource/precomputed
This datasource contains the code for manipulating images.
"""
from functools import reduce
import iter... | seung-lab/cloud-volume | cloudvolume/datasource/precomputed/image/__init__.py | Python | bsd-3-clause | 18,157 |
from unittest import TestCase
from melta.transactions.transactional import Transaction
class TransactionTestClass(Transaction):
def __init__(self):
self.plant_type = 'Pointisera'
self.plant_age = 3
self.plant_pot = 'plastic'
self.combination = 'one\ntwo\nthree'
class Transactiona... | bossiernesto/melta | test/transactions/test_transactional.py | Python | bsd-3-clause | 1,365 |
"""
Tests for dit.profiles.MUIProfile. Known examples taken from http://arxiv.org/abs/1409.4708 .
"""
import pytest
import numpy as np
from dit import Distribution
from dit.profiles import MUIProfile
ex1 = Distribution(['000', '001', '010', '011', '100', '101', '110', '111'], [1 / 8] * 8)
ex2 = Distribution(['000'... | dit/dit | tests/profiles/test_mui.py | Python | bsd-3-clause | 907 |
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#
import unittest
import os
import yaml
import numpy as np
from basil.dut import Dut
from basil.utils.sim... | MarcoVogt/basil | examples/mio_sram_test/tests/test_Sim.py | Python | bsd-3-clause | 6,711 |
# -*- coding: utf-8 -*-
import logging
import requests_mock
from django.test import TestCase
from eventkit_cloud.utils.ogcapi_process import get_format_field_from_config
logger = logging.getLogger(__name__)
class TestOgcApiProcess(TestCase):
def setUp(self):
self.mock_requests = requests_mock.Mocker()
... | terranodo/eventkit-cloud | eventkit_cloud/utils/tests/test_ogcapi_process.py | Python | bsd-3-clause | 1,104 |
# -*-coding:Utf-8 -*
# Copyright (c) 2012 NOEL-BARON Léo
# 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
# li... | stormi/tsunami | src/primaires/objet/types/pierre_feu.py | Python | bsd-3-clause | 2,715 |
# -*- coding: utf-8 -*-
"""
AMPLPY
------
AMPL API is an interface that allows developers to access the features of the
AMPL interpreter from within a programming language. All model generation and
solver interaction is handled directly by AMPL, which leads to great stability
and speed; the library just acts as an int... | ampl/amplpy | setup.py | Python | bsd-3-clause | 5,545 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from nose_parameterized import parameterized, param
from dateparser.languages import default_language_loader, Language
from dateparser.languages.detection import AutoDetectLanguage, ExactLanguages
from tests import BaseTestCase
class TestBundledLanguag... | seagatesoft/dateparser | tests/test_languages.py | Python | bsd-3-clause | 18,881 |
#!/bin/env python
#
# Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
# 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 n... | wayfinder/Wayfinder-CppCore-v3 | ngplib/generator_print.py | Python | bsd-3-clause | 2,826 |
import httplib
try:
import json
except ImportError: # < Python 2.6
from django.utils import simplejson as json
from testcases import TestServerTestCase
class HTTPTestCase(TestServerTestCase):
def setUp(self):
self.start_test_server(address='localhost', port=8001)
def tearDown(self):
s... | grischa/django-tastypie | tests/alphanumeric/tests/http.py | Python | bsd-3-clause | 4,725 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..registration import MeasureImageSimilarity
def test_MeasureImageSimilarity_inputs():
input_map = dict(args=dict(argstr='%s',
),
dimension=dict(argstr='--dimensionality %d',
position=1,
),
envir... | mick-d/nipype | nipype/interfaces/ants/tests/test_auto_MeasureImageSimilarity.py | Python | bsd-3-clause | 1,674 |
from django.http import HttpResponse
from _internalredirect import _convert_file_to_url
def sendfile(request, filename, **kwargs):
response = HttpResponse()
url = _convert_file_to_url(filename)
response['X-Accel-Redirect'] = url.encode('utf-8')
return response
| pv/mediasnake | mediasnake_sendfile/backends/nginx.py | Python | bsd-3-clause | 280 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import models, migrations
def update_site_forward(apps, schema_editor):
"""Set site domain and name."""
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings... | zenweasel/travelsite | travelsite/contrib/sites/migrations/0002_set_site_domain_and_name.py | Python | bsd-3-clause | 953 |
'''
Braubuddy Thermostat.
'''
from braubuddy.thermostat.base import IThermostat
from braubuddy.thermostat.simpleranged import SimpleRangedThermostat
| amorphic/braubuddy | braubuddy/thermostat/__init__.py | Python | bsd-3-clause | 150 |
#!/usr/bin/env python
###
# Copyright (c) 2002-2007 Systems in Motion
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS I... | bleepbloop/Pivy | examples/Mentor/10.7.PickFilterManip.py | Python | isc | 6,102 |
#!/usr/bin/env python
# Run the various build scripts
import sys
import os
from parse import parse_machines
from machines import machines
from assemblies import assemblies
from vitamins import vitamins
from printed import printed
from guides import guides
from publish import publish
def build(do_publish=0):
prin... | Axford/AFRo | hardware/ci/build.py | Python | mit | 1,275 |
#!/usr/bin/env python
#coding: utf-8
class Solution:
def _gen(self, r, cr, n_left, n_combined, n):
if n_combined == n:
r.append(''.join(cr))
return
if n_left < n - n_combined:
cr.append('(')
self._gen(r, cr, n_left+1, n_combined, n)
cr.po... | wh-acmer/minixalpha-acm | LeetCode/Python/generate_parentheses.py | Python | mit | 812 |
#!/usr/bin/env python3
# Copyright (c) 2021 The Dogecoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Fee limit QA test.
# Tests nodes under fee limit, verifies fee rounding
"""
from test_framework.test_frame... | patricklodder/dogecoin | qa/rpc-tests/feelimit.py | Python | mit | 2,983 |
#!/usr/bin/env python3
import datetime
import logging
import math
import os
import re
import signal
import sys
import vrnetlab
def handle_SIGCHLD(signal, frame):
os.waitpid(-1, os.WNOHANG)
def handle_SIGTERM(signal, frame):
sys.exit(0)
signal.signal(signal.SIGINT, handle_SIGTERM)
signal.signal(signal.SIGTE... | plajjan/vrnetlab | sros/docker/launch.py | Python | mit | 15,040 |
import random
import unittest
from hearthbreaker.cards.spells.neutral import TheCoin
from tests.agents.testing_agents import OneCardPlayingAgent, MinionAttackingAgent, CardTestingAgent, \
PlayAndAttackAgent
from tests.testing_utils import generate_game_for
from hearthbreaker.cards import *
from hearthbreaker.const... | kingoflolz/hearthbreaker | tests/card_tests/shaman_tests.py | Python | mit | 30,173 |
import cavejohnson
cavejohnson.set_github_status("drewcrawford/DCAKit", "a5840df1d9cf2f1176c63e81009361d7850a3dd9", "pending") | kiancheong/CaveJohnson | test.py | Python | mit | 126 |
#!/usr/bin/env python
# ===================================
# Copyright (c) Microsoft Corporation. All rights reserved.
# See license.txt for license information.
# ===================================
import os
import sys
import imp
protocol = imp.load_source('protocol', '../protocol.py')
nxDSCLog = imp.load_source('n... | MSFTOSSMgmt/WPSDSCLinux | Providers/Scripts/2.4x-2.5x/Scripts/nxEnvironment.py | Python | mit | 9,103 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import frappe
import frappe.defaults
import datetime
from frappe.utils import get_datetime, add_to_date, getdate
from frappe.utils.data import get_first_day, get_first_day_of_week, get_quarter_start, get_year_start,\
get_... | frappe/frappe | frappe/utils/dateutils.py | Python | mit | 4,402 |
import time
import socket
NUM_TRIES = 10
request = "poipoipoipoi"
myAddress = '' #means 'all'
myPort = 21568
hisAddress = 'bbbb::1415:92cc:0:2'
hisPort = 7
delays = []
succ = 0
fail = 0
print "Testing udpEcho..."
for i in range(NUM_TRIES):
# log
output = []
output... | barriquello/iotstack | openwsn-fw-work/firmware/openos/openwsn/07-App/udpecho/udpecho.py | Python | mit | 2,057 |
import re
import dataclasses
from . import settings
class Tokens:
def __init__(self, tokens):
self.tokens = tokens
self.pos = 0
def __str__(self):
return " ".join(self.tokens[:self.pos]) + " ^ " + " ".join(self.tokens[self.pos:])
def __getitem__(self, index):
return self.t... | ND-CSE-30151/tock | tock/syntax.py | Python | mit | 7,939 |
# This file is part of beets.
# Copyright 2014, Jakob Schnitzer.
#
# 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,... | Wen777/beets | beetsplug/mbsync.py | Python | mit | 5,703 |
from django.contrib import admin
from .models import (
Log,
RequestLog,
EventLog,
)
class LogAdmin(admin.ModelAdmin):
readonly_fields = [
'log_level', 'request_url', 'request_method', 'get_data',
'request_body', 'cookies', 'meta',
'exception_type', 'message', 'stack_trace', 'u... | eshandas/simple_django_logger | simple_django_logger/admin.py | Python | mit | 1,281 |
from unittest import TestCase, main
import account
class AccountTestCase(TestCase):
def test_basic(self):
a = account.find_or_create("A")
| kalafut/go-ledger | account_test.py | Python | mit | 151 |
# views.py
from flask import render_template
from app import app
@app.route('/')
def index():
return render_template("index.html")
@app.route('/about')
def about():
return render_template("about.html")
| rayidghani/CharBucks | app/views.py | Python | mit | 214 |
#!/usr/bin/env python
import json
import os
import requests
import urllib
import ConfigParser
import time
import sys
from bson.json_util import dumps
import pyinotify
from multiprocessing import Process
config = ConfigParser.ConfigParser()
config.read('config.ini')
url = config.get("repl", "api-url")
base = config.g... | sdfdemo/replication | agent/agent.py | Python | mit | 2,792 |
"""
A Pillow loader for .ftc and .ftu files (FTEX)
Jerome Leclanche <jerome@leclan.ch>
The contents of this file are hereby released in the public domain (CC0)
Full text of the CC0 license:
https://creativecommons.org/publicdomain/zero/1.0/
Independence War 2: Edge Of Chaos - Texture File Format - 16 October 2001
... | ryfeus/lambda-packs | pytorch/source/PIL/FtexImagePlugin.py | Python | mit | 3,322 |
from __future__ import unicode_literals
from reviewboard.diffviewer.myersdiff import MyersDiffer
from reviewboard.testing import TestCase
class MyersDifferTest(TestCase):
"""Unit tests for MyersDiffer."""
def test_equals(self):
"""Testing MyersDiffer with equal chunk"""
self._test_diff(['1',... | chipx86/reviewboard | reviewboard/diffviewer/tests/test_myersdiff.py | Python | mit | 1,475 |
#!/usr/bin/python2
#
# Start sshd on the emulated hosts and create a specialized host
# emulated at the Frontend which tunnels ssh from the Frontend to the
# emulated hosts.
#
import subprocess
from mininet.node import OVSSwitch
from mininet.topo import Topo
from MaxiNet.Frontend import maxinet
from MaxiNet.tools i... | kilda/MaxiNet | MaxiNet/Frontend/examples/sshd.py | Python | mit | 2,376 |
import unittest
from alertaclient.api import Client
class AlertTestCase(unittest.TestCase):
def setUp(self):
self.client = Client(endpoint='http://api:8080', key='demo-key')
def test_group(self):
group = self.client.create_group(name='myGroup', text='test group')
group_id = group.i... | alerta/python-alerta | tests/integration/test_groups.py | Python | mit | 937 |
"""
Page navigation groups allow assigning pages to differing navigation lists
such as header, footer and what else.
"""
from __future__ import absolute_import, unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from feincms import extensions
class Extension(exten... | mcmaxwell/idea_digital_agency | idea/feincms/module/page/extensions/navigationgroups.py | Python | mit | 1,036 |
from mpfmc.tests.MpfMcTestCase import MpfMcTestCase
class TestAnimation(MpfMcTestCase):
def get_machine_path(self):
return 'tests/machine_files/animation'
def get_config_file(self):
return 'test_animation.yaml'
def test_animation_config_processing(self):
# The animation sections ... | missionpinball/mpf-mc | mpfmc/tests/test_Animation.py | Python | mit | 18,424 |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Nils Weiss <nils@we155.de>
# This program is published under a GPLv2 license
# scapy.contrib.description = Unified Diagnostic Service (UDS)
# scapy.contrib.status = loads
import struct
import time
from iterto... | 4shadoww/usploit | lib/scapy/contrib/automotive/uds.py | Python | mit | 44,266 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/__init__.py | Python | mit | 700 |
"""
Tests that deepchem models make deterministic predictions.
"""
__author__ = "Bharath Ramsundar"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"
import os
import tempfile
import numpy as np
import unittest
import sklearn
import shutil
import tensorflow as tf
import deepchem as dc
from ten... | lilleswing/deepchem | deepchem/models/tests/test_predict.py | Python | mit | 1,924 |
from ddt import data, ddt
from rest_framework import status, test
from waldur_core.structure.models import ProjectRole
from waldur_openstack.openstack.models import Tenant
from waldur_openstack.openstack_tenant.models import Instance
from . import factories, fixtures
@ddt
class FlavorChangeInstanceTestCase(test.API... | opennode/nodeconductor-assembly-waldur | src/waldur_openstack/openstack_tenant/tests/test_flavor_change.py | Python | mit | 11,479 |
import os, sys, sqlite3
DBNAME = '../../tidy.db'
SQLPATH = '../../../sql/tidy.sql'
class SQLite3(object):
def __new__(cls, *args, **kwargs):
if not hasattr(cls, '__instance__'):
try:
d = os.path.dirname(os.path.abspath(__file__))
cls.__instance__ = sqlite3.... | after12am/expecto | machine_learning/feed_classifier/src/core/db/db.py | Python | mit | 741 |
# -*- coding: utf-8 -*-
"""
zang.inboundxml.elements.play
~~~~~~~~~~~~~~~~~~~
Module containing `Play` inbound xml element
"""
from zang.inboundxml.elements.base_node import BaseNode
class Play(BaseNode):
_allowedContentClass = ()
def __init__(self, url, loop=None):
if url is None:
rai... | jaymin-panchal/zang-python | zang/inboundxml/elements/play.py | Python | mit | 599 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as lite
import sys
uId = 4
con = lite.connect('test.db')
with con:
cur = con.cursor()
cur.execute("SELECT Name, Price FROM Cars WHERE Id=:Id",
{"Id": uId})
con.commit()
row = cur.fetchone()
print row[0], row[1] | janusnic/21v-python | unit_14/car8.py | Python | mit | 319 |
import sys, os
sys.path.insert(1, os.path.join(sys.path[0], '../../../'))
import script.rio as io
import script.initial_condition.noh1D as noh1D
# Domain properties
lx = 1.0
ly = 1.0
Nx = 131072
Ny = 1
# Scheme execution options
T = 0.6
CFL = 0.5
gamma = 5./3.
BClayer = 1
quantityList = ['rho', 'rhou_x', 'rhou_y',... | will-iam/Variant | casepy/eulerRuO2/nNoh131072x1/chars.py | Python | mit | 472 |
"""Simple python implementation of Peskin's delta function.
"""
from numpy import abs, sqrt
def delta(x):
"""Discretised Dirac delta function.
Returns an approximation to the delta function, as explained in
Peskin Acta Numerica (2002) pp. 479-517, chapter 6.
"""
abs_x = abs(x)
if abs_x <= 1.0... | rupertnash/subgrid | python/d3q15/delta.py | Python | mit | 510 |
"""
Benchmark dataset from:
https://github.com/ekzhu/set-similarity-search-benchmark.
Use "Canada US and UK Open Data":
Indexed sets: canada_us_uk_opendata.inp.gz
Query sets (10 stratified samples from 10 percentile intervals):
Size from 10 - 1k: canada_us_uk_opendata_queries_1k.inp.gz
Size fro... | chubbymaggie/datasketch | benchmark/lshensemble_benchmark.py | Python | mit | 10,558 |
#### 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/ship/components/armor/shared_arm_reward_alderaan_elite.iff"
result.... | anhstudios/swganh | data/scripts/templates/object/tangible/ship/components/armor/shared_arm_reward_alderaan_elite.py | Python | mit | 494 |
"""Test that app config can override a directory name conflict (.e.g. "salesforce")"""
from salesforce.testrunner.settings import * # NOQA pylint: disable=unused-wildcard-import,wildcard-import
from salesforce.testrunner.settings import INSTALLED_APPS
INSTALLED_APPS = [x for x in INSTALLED_APPS if x != 'salesforce.te... | django-salesforce/django-salesforce | tests/test_app_label/settings.py | Python | mit | 439 |
#!/usr/bin/env python
from requests.exceptions import HTTPError
from datetime import datetime
import ystockquote
from m2x.client import M2XClient
def post_stock_price(symbol, apikey, devicename):
'''
Retrieve the stock price for the given ticker symbol ("T" for AT&T) and
post it in the correct M2X data ... | attm2x/m2x-demo-heroku-python | stockreport.py | Python | mit | 1,141 |
"""
Uphold Python SDK
This is a python module to ease integration between python apps and the Uphold API.
Repo: http://github.com/byrnereese/uphold-python-sdk
TODO
* Create custom exceptions for common errors
* Add support for updating records
* Turn off authentication/authorization for public transactions (or make t... | byrnereese/uphold-sdk-python | uphold/uphold.py | Python | mit | 15,514 |
from __future__ import print_function, absolute_import
import re
import logging
import numpy as np
from ...utils import int_else_float_except_string
logging.basicConfig()
logger = logging.getLogger(__file__)
def find_name(string):
return re.search('function\s*mpc\s*=\s*(?P<data>.*?)\n', string).groupdict()['d... | kdheepak/psst | psst/case/matpower/reader.py | Python | mit | 1,747 |