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 python3
#
# Copyright 2019 Ryan Peck
#
# 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 o... | RyPeck/python-ipgroup | setup.py | Python | apache-2.0 | 2,027 |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2014-2019 Contributor
#
# 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 co... | quattor/aquilon | lib/aquilon/worker/dbwrappers/change_management.py | Python | apache-2.0 | 34,999 |
# Copyright (c) 2014 eBay Software Foundation
# Copyright 2015 HP Software, LLC
# 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.o... | dklyle/trove-dashboard | trove_dashboard/content/database_clusters/tests.py | Python | apache-2.0 | 12,810 |
from __future__ import unicode_literals
import json
from moto.core import BaseBackend
from .parsing import ResourceMap, OutputMap
from .utils import generate_stack_id
class FakeStack(object):
def __init__(self, stack_id, name, template):
self.stack_id = stack_id
self.name = name
self.tem... | djmitche/moto | moto/cloudformation/models.py | Python | apache-2.0 | 2,874 |
# Copyright 2017 DataCentred Ltd
#
# 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... | spjmurray/openstack-sentinel | sentinel/api/controllers/network/v2/quotas.py | Python | apache-2.0 | 2,073 |
"""
"""
import numpy
import theano
import theano.tensor as T
from pythonDnn.layers.logistic_sgd import LogisticRegression
from pythonDnn.layers.mlp import HiddenLayer
from pythonDnn.layers.rbm import RBM, GBRBM
from pythonDnn.models import nnet
class DBN(nnet):
"""Deep Belief Network
A deep belief network ... | IITM-DONLAB/python-dnn | src/pythonDnn/models/dbn.py | Python | apache-2.0 | 8,684 |
# Python Substrate Interface Library
#
# Copyright 2018-2020 Stichting Polkascan (Polkascan Foundation).
#
# 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/LIC... | vertexproject/synapse | synapse/vendor/substrateinterface/utils/__init__.py | Python | apache-2.0 | 1,064 |
import time
import wiringpi2 as wiringpi
#use Broadcom pin numbers
wiringpi.wiringPiSetupGpio()
LED_PIN = 25
# setup pin as an output
wiringpi.pinMode(LED_PIN, 1)
while True:
# enable LED
wiringpi.digitalWrite(LED_PIN, 1)
# wait 1 second
time.sleep(1)
# disable LED
wiringpi.digitalWrite(LED_PIN, 0)
... | lukaszo/rpitips-examples | wiringpi/led.py | Python | apache-2.0 | 392 |
# coding: utf-8
"""
Cloudbreak API
Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloud... | Chaffelson/whoville | whoville/cloudbreak/models/platform_vmtypes_response.py | Python | apache-2.0 | 4,040 |
"""
Copyright 2015 Matthew D. Ball (M4Numbers)
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 o... | M4Numbers/Walkers | walkers/ImgurCrawler.py | Python | apache-2.0 | 1,092 |
i = int(input("The first number: "))
j = int(input("The second number: "))
k = int(input("The third number: "))
l = int(input("The fourth number: "))
pairs = 0
if i == j or i == k or i == l:
pairs += 1
if j == k or j == l:
pairs += 1
if k == l:
pairs += 1
if pairs >= 2:
print("Two pairs")
else:
prin... | JoachimVandersmissen/CodingSolutions | python/PythonForEveryone/chapter3/8.py | Python | apache-2.0 | 339 |
#!/usr/bin/env python
# Copyright (c) 2015 by Ken Guyton. All Rights Reserved.
"""Create a random grid and compute the solution."""
from __future__ import print_function
import argparse
import walk_grid
import random
MAX_GRID_SIZE = 20
MAX_FOOD = 200
MAX_ROOM_FOOD = 10
def get_args():
"""Parse command line arg... | kmggh/python-walk-grid | spec_solution.py | Python | artistic-2.0 | 1,718 |
"""
Last.fm support for Django-Social-Auth.
An application must be registered first on Last.fm and the settings LASTFM_API_KEY
and LASTFM_SECRET must be defined with they corresponding values.
"""
from hashlib import md5
from re import sub
from urllib import urlencode
from urllib2 import urlopen
from django.conf imp... | mlavin/django-lastfm-auth | lastfm_auth/backend.py | Python | bsd-2-clause | 4,889 |
#!/usr/bin/python
from __future__ import print_function
import os
import sys
from os.path import join, dirname
from setuptools import Extension, find_packages, setup
from distutils.command import build_ext as _build_ext
try:
# we use Cython if possible then resort to pre-build intermediate files
# noinspection... | dashesy/pyavfcam | setup.py | Python | bsd-2-clause | 3,259 |
# -*- coding: utf-8 -*-
from glyph import Glyph, glyphs
from context import mergeSubPolys
from kerning import kernGlyphs
from punctuation import spaceGlyph
class LineBreak(object):
def __init__(self, leading):
super(LineBreak, self).__init__()
self.leading = leading
class TextBox(object):
de... | hortont424/phiface | phiface/text.py | Python | bsd-2-clause | 6,558 |
import glob
import os
import unicodedata
from string import punctuation
from nltk import word_tokenize, SnowballStemmer
from nltk.corpus import stopwords, PlaintextCorpusReader
class StemmingController:
def __init__(self):
ADDITIONAL_STOPWORDS = ['%', '?', '¿', 'please', 'your', 'flash', 'plugin', 'Tags... | gcvalderrama/Palantir | worker/StemmingController.py | Python | bsd-2-clause | 1,443 |
'''Autogenerated by get_gl_extensions script, do not edit!'''
from OpenGL import platform as _p
from OpenGL.GL import glget
EXTENSION_NAME = 'GL_SGIS_texture_lod'
_p.unpack_constants( """GL_TEXTURE_MIN_LOD_SGIS 0x813A
GL_TEXTURE_MAX_LOD_SGIS 0x813B
GL_TEXTURE_BASE_LEVEL_SGIS 0x813C
GL_TEXTURE_MAX_LEVEL_SGIS 0x813D""", ... | frederica07/Dragon_Programming_Process | PyOpenGL-3.0.2/OpenGL/raw/GL/SGIS/texture_lod.py | Python | bsd-2-clause | 522 |
import logging
from ob2.util.hooks import register_job
logging.info("Hello world!")
@register_job("hw0")
def hw0_job_handler(repo, commit_hash):
return "You get full credit!", 10.0
| octobear2/ob2 | config/functions.py | Python | bsd-2-clause | 188 |
import time
import socket
import struct
import urllib.parse
import select
from . import pac_server
from . import global_var as g
from .socket_wrap import SocketWrap
import utils
from .smart_route import handle_ip_proxy, handle_domain_proxy, netloc_to_host_port
from xlog import getLogger
xlog = getLogger("smart_router"... | xyuanmu/XX-Net | code/default/smart_router/local/proxy_handler.py | Python | bsd-2-clause | 11,386 |
#!/usr/bin/env python
# Put your app specific configs here
consumer_key = ""
consumer_secret = ""
| honza/clitwi | config.py | Python | bsd-2-clause | 100 |
#!/usr/bin/env python
import os
import sys
from django.core.management import execute_from_command_line
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dispensa.settings.dev")
execute_from_command_line(sys.argv)
| evonove/dispensa-website | django-dispensa/manage.py | Python | bsd-2-clause | 251 |
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from . import views
urlpatterns = [
url(r'^$', views.InventoryView.as_view(), name='inventory'),
url(r'^(?P<node_type>\w+)/(?P<node_id>[0-9]+)/$',
login_required(views.NodesView.as_view()), name='nodes'),
... | ptonini/battuta-manager | battuta/inventory/urls.py | Python | bsd-2-clause | 618 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_array_formula01.py | Python | bsd-2-clause | 2,513 |
import logging
from django.conf import settings
from django.conf.urls import patterns, url
from django.db.models import Q
from django.http import Http404
from django.views.decorators.cache import never_cache
from guardian.shortcuts import get_objects_for_user
from preserialize.serialize import serialize
from serrano.re... | chop-dbhi/varify | varify/variants/resources.py | Python | bsd-2-clause | 9,609 |
# Copyright (c) 2020, Matt Layman
"""
nose-tap is a reporting plugin for nose that outputs
`Test Anything Protocol (TAP) <http://testanything.org/>`_ data.
TAP is a line based test protocol for recording test data in a standard way.
Follow development on `GitHub <https://github.com/python-tap/nose-tap>`_.
Developer do... | python-tap/nose-tap | setup.py | Python | bsd-2-clause | 2,573 |
# Copyright (c) 2010, Sancho McCann
# 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 following disclaimer.
... | sanchom/sjm | naive_bayes_nearest_neighbor/caltech_util_test.py | Python | bsd-2-clause | 8,679 |
# -*- coding: UTF-8 -*-
# Copyright 2011-2018 Luc Saffre
#
# License: BSD (see file COPYING for details)
from __future__ import unicode_literals
import datetime
from dateutil.easter import easter
from lino.api import dd, _
from lino.utils.format_date import fds
from .utils import day_and_month
class Weekdays(dd.C... | khchine5/xl | lino_xl/lib/cal/choicelists.py | Python | bsd-2-clause | 3,543 |
"""
Module for handling redis IO
"""
import redis
import hashlib
from flickipedia.config import log, settings
__author__ = 'Ryan Faulkner'
__date__ = "2014-04-01"
def hmac(key):
""" Use an hmac to generate a hash key """
return hashlib.md5(key + settings.__secret_key__).hexdigest()
def _decode_list(data)... | rfaulkner/Flickipedia | flickipedia/redisio.py | Python | bsd-2-clause | 3,307 |
import dbf
import os.path
THRIFT_DIR_PATH = os.path.join(
os.path.dirname(__file__), "..", "src", "pastpy", "models"
)
class RecordField:
THRIFT_IMPORTS_BY_TYPE = {
"date.Date": 'include "thryft/native/date.thrift"',
"date_time.DateTime": 'include "thryft/native/date_time.thrift"',
"... | minorg/pastpy | devbin/generate_record_thrift.py | Python | bsd-2-clause | 4,135 |
#!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_dosta_ln_wfp_sio_mule
@file marine-integrations/mi/dataset/parser/test/test_dosta_ln_wfp_sio_mule.py
@author Christopher Fortin
@brief Test code for a dosta_ln_wfp_sio_mule data parser
"""
#!/usr/bin/env python
import os
import ntplib, struct
from nose.pl... | ooici/marine-integrations | mi/dataset/parser/test/test_dosta_ln_wfp_sio_mule.py | Python | bsd-2-clause | 18,792 |
# -*- mode: python; coding: utf-8; -*-
__author__ = "Kenny Meyer"
__email__ = "knny.myer@gmail.com"
from django.conf.urls.defaults import *
import views
urlpatterns = patterns('',
url(r'^$',
views.list_flashcards,
name = 'list_flashcards'),
url(r'^practice/$',
views.practice_flashca... | kennym/django-flashcard | src/flashcard/urls.py | Python | bsd-2-clause | 927 |
#!/usr/bin/env python
""" statistic
# ----
# License: BSD
# ----
# 0.1: init version - 2016.6 - by Nick Qian
"""
def statistic(bags):
"""example:
Niu 1-9: 1:98598, 2:100122, 3:100394, 4:101250, 5:100785, 6:100239, 7:100176, 8:100327, 9:100417
Niu 10: 97692 <NiuNiu> ... | NickQian/pyWager | statistic.py | Python | bsd-2-clause | 4,094 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from kaarmebot import KaarmeBotApp
from kaarmebot import predicates as p
import example_plugin
app_conf = {
'servers': {
'some_server': {
'address': ('someserver.org', 6667),
'real_name': 'Sir Bot McBotsworth, Esq.',
'nick':... | jkpl/kaarmebot | example.py | Python | bsd-2-clause | 900 |
# -*-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/joueur/commandes/chgroupe/commande.py | Python | bsd-3-clause | 4,114 |
import unittest
from maskgen.external.api import *
from tests.test_support import TestSupport
import os
import numpy as np
import random
from maskgen.maskgen_loader import MaskGenLoader
import sys
class TestExternalAPI(TestSupport):
loader = MaskGenLoader()
def setUp(self):
self.loader.load()
d... | rwgdrummer/maskgen | tests/external/test_external_api.py | Python | bsd-3-clause | 711 |
""" Tests for glm function in glm module
This checks the glm function with the procedure in the "Basic linear
modeling" exercise from Day 14.
Run at the project directory with:
nosetests code/utils/tests/test_glm.py
"""
# Loading modules.
import numpy as np
import nibabel as nib
import os
import sys
from numpy.t... | reychil/project-alpha-1 | code/utils/tests/test_imaging.py | Python | bsd-3-clause | 1,461 |
import os
import numpy as np
if __name__ == '__main__':
HOME = os.environ['HOME']
dataset_path = os.path.join(HOME, 'CaffeProjects/data/style')
source_path = os.path.join(HOME, 'PycharmProjects/Dataset/wikipainting/style')
f = open('classes', 'w')
images_path = os.path.join(source_path)
prin... | cs-chan/fuzzyDCN | prune_caffe/data/wikiart/style/gen_cls_file.py | Python | bsd-3-clause | 541 |
# Imports from Django
from django.conf.urls.defaults import *
from django.contrib.sites.models import Site
# Imports from brubeck
from brubeck.podcasts.models import Channel, Episode
urlpatterns = patterns('django.views.generic.list_detail',
url(r'^episodes/(?P<object_id>\d+)/$', 'object_detail', {'queryset': Epi... | albatrossandco/brubeck_cms | brubeck/podcasts/urls.py | Python | bsd-3-clause | 2,320 |
import pytest
from unittest.mock import MagicMock
from torrt.toolbox import *
from torrt.utils import BotObjectsRegistry
@pytest.fixture(scope='function', autouse=True)
def clear_bot_registry():
"""HACK: clears all registered bots before each test.
otherwise test order matters
"""
BotObjectsRegist... | idlesign/torrt | tests/test_toolbox.py | Python | bsd-3-clause | 3,339 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | jensreeder/scikit-bio | skbio/sequence/tests/test_iupac_sequence.py | Python | bsd-3-clause | 16,144 |
import os
from textwrap import dedent
from nipype import Workflow, Node, Function
from traits.api import TraitError
import pytest
from .. import frontend
class TestFrontend(object):
@pytest.fixture
def lyman_dir(self, execdir):
lyman_dir = execdir.mkdir("lyman")
os.environ["LYMAN_DIR"] = str... | mwaskom/lyman | lyman/tests/test_frontend.py | Python | bsd-3-clause | 6,368 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from django.shortcuts import render
from django.http import JsonResponse
from django.conf import settings
from author.models import author
from subprocess import Popen, PIPE, check_call
from django.conf import settings
import paramiko
import datetime
import os
def gotoReader... | 0lidaxiang/WeArt | reader/view/readerManageView.py | Python | bsd-3-clause | 5,816 |
title = "Page d'accueil"
| dbaty/soho | docs/_tutorial/4-i18n/src/fr/index.html.meta.py | Python | bsd-3-clause | 25 |
from __future__ import print_function
import matplotlib.pyplot as plt
from neatsociety.ifnn import IFNeuron
n = IFNeuron()
times = []
currents = []
potentials = []
fired = []
for i in range(1000):
times.append(1.0 * i)
n.current = 0.0 if i < 100 or i > 800 else 16.0
currents.append(n.current)
n.adv... | machinebrains/neat-python | examples/visualize/ifnn_visualize.py | Python | bsd-3-clause | 816 |
from __future__ import annotations
import asyncio
import bisect
import builtins
import errno
import heapq
import logging
import os
import random
import sys
import threading
import warnings
import weakref
from collections import defaultdict, deque
from collections.abc import (
Callable,
Collection,
Containe... | dask/distributed | distributed/worker.py | Python | bsd-3-clause | 177,089 |
import os
from PIL import Image
from django.template import Library
register = Library()
def thumbnail(file, size='104x104', noimage=''):
# defining the size
x, y = [int(x) for x in size.split('x')]
# defining the filename and the miniature filename
try:
filehead, filetail = os.path.split(file... | mjbrownie/ascet_filer_teaser | ascet_filer_teaser/templatetags/huski_thumbnail.py | Python | bsd-3-clause | 4,022 |
# -*- coding: utf-8 -*-
import time
import pytest
from selenium.webdriver import ActionChains
from django.db.models import get_model
from fancypages.test import factories
from fancypages.test.fixtures import admin_user # noqa
FancyPage = get_model('fancypages', 'FancyPage')
@pytest.mark.browser
def test_can_move... | tangentlabs/django-fancypages | tests/browser/test_moving_blocks.py | Python | bsd-3-clause | 1,547 |
__author__="cooke"
__date__ ="$01-Mar-2012 11:17:43$" | agcooke/ExperimentControl | experimentcontrol/test/__init__.py | Python | bsd-3-clause | 53 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | zCFD/zCFD-docker | sphinx-doc/tests/test-init/expected/source/conf.py | Python | bsd-3-clause | 7,345 |
# -*-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/objet/types/cape.py | Python | bsd-3-clause | 1,924 |
from .base import call_method_or_dispatch, create_registerer
sym_decision_function_dispatcher = {}
sym_decision_function = call_method_or_dispatch('sym_decision_function', sym_decision_function_dispatcher)
register_sym_decision_function = create_registerer(sym_decision_function_dispatcher, 'register_sym_decision_func... | jcrudy/sklearntools | sklearntools/sym/sym_decision_function.py | Python | bsd-3-clause | 328 |
'''
Created on 9 jan. 2013
@author: sander
'''
from bitstring import ConstBitStream, BitStream, Bits
from ipaddress import IPv4Address
from pylisp.packet.ip import protocol_registry
from pylisp.packet.ip.protocol import Protocol
from pylisp.utils import checksum
import math
import numbers
class IPv4Packet(Protocol):... | steffann/pylisp | pylisp/packet/ip/ipv4.py | Python | bsd-3-clause | 10,727 |
def extractManaTankMagus(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'Mana Tank Magus' in item['tags']:
return buildReleaseMessageWithType(item, 'Mana Tank Magus', vol, chp, frag=frag, postfi... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractManaTankMagus.py | Python | bsd-3-clause | 360 |
# -*- coding: utf-8 -*-
'''Custom validators used by RoodKamer'''
from wtforms.validators import StopValidation
from isbnlib import to_isbn13, is_isbn10, is_isbn13
class ValidateISBN(object):
"""
Validates that input is valid ISBN, either the 10 digit one from prior to
2007, or the 13 digit one from on o... | brotherjack/Rood-Kamer | roodkamer/validators.py | Python | bsd-3-clause | 1,509 |
# Copyright (c) 2016, the GPyOpt Authors
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
import GPy
from .base import BOModel
##
## TODO: not fully tested yet.
##
class WarpedGPModel(BOModel):
analytical_gradient_prediction = False
def __init__(self, kernel=None, noise_var... | SheffieldML/GPyOpt | GPyOpt/models/warpedgpmodel.py | Python | bsd-3-clause | 2,206 |
import sys, os
try:
import sphinxtogithub
optional_extensions = ['sphinxtogithub']
except ImportError:
optional_extensions = []
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary'] + optional_extensions
master_doc = 'index'
project = u'gevent-utils'
copyright = u'2011, Travis Cline'
version = '0.0.2'
re... | tmc/gevent-utils | docs/conf.py | Python | bsd-3-clause | 722 |
#!/usr/bin/python
# Copyright 2008, 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 co... | eseidel/native_client_patches | build/cook_tarball.py | Python | bsd-3-clause | 8,837 |
# -*- coding: utf-8 -*-
from rawdisk.filesystems.volume import Volume
class AppleBootVolume(Volume):
"""Structure for Apple_Boot volume
"""
def __init__(self):
self.fd = None
def load(self, filename, offset):
"""Will eventually load information for Apple_Boot volume.
Not yet... | dariusbakunas/rawdisk | rawdisk/plugins/filesystems/apple_boot/apple_boot_volume.py | Python | bsd-3-clause | 667 |
"""Calculation of density of states."""
# Copyright (C) 2011 Atsushi Togo
# All rights reserved.
#
# This file is part of phonopy.
#
# 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 m... | atztogo/phonopy | phonopy/phonon/dos.py | Python | bsd-3-clause | 21,665 |
import mock
import pytest
from olympia import amo
from olympia.access.models import Group, GroupUser
from olympia.amo.tests import TestCase, req_factory_factory
from olympia.addons.models import Addon, AddonUser
from olympia.users.models import UserProfile
from .acl import (action_allowed, check_addon_ownership, chec... | harikishen/addons-server | src/olympia/access/tests.py | Python | bsd-3-clause | 9,484 |
#!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... | pk-sam/crosswalk-test-suite | embeddingapi/embedding-api-ios-tests/embeddingapi/xwalkview.py | Python | bsd-3-clause | 2,795 |
'''
------------------------------------------
Red9 Studio Pack: Maya Pipeline Solutions
Author: Mark Jackson
email: rednineinfo@gmail.com
Red9 blog : http://red9-consultancy.blogspot.co.uk/
MarkJ blog: http://markj3d.blogspot.co.uk
------------------------------------------
This is the heart of the Red9 StudioPack's... | Free3Dee/Red9_StudioPack | startup/setup.py | Python | bsd-3-clause | 44,595 |
#!/usr/bin/env python
import csv
import sys
filename = sys.argv[1]
filename_out = sys.argv[2]
with open(filename, 'rb') as fd:
reader = csv.reader(fd)
header = reader.next()
rows = [row for row in reader]
with open(filename_out, 'w') as fd:
fd.write('dataset, -delta angle, centre angle, +delta angle,... | rc/dist_mixtures | make_aa_table.py | Python | bsd-3-clause | 624 |
# -*- 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
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Contact.content_type_label'
db.add_column(u'contacts_cont... | suselrd/django-allcontacts | contacts/migrations/0002_auto__add_field_contact_content_type_label.py | Python | bsd-3-clause | 3,604 |
"""functions relating to Jobma"""
import logging
from urllib.parse import urljoin
from django.conf import settings
from django.urls import reverse
from requests import Session
from profiles.api import get_first_and_last_names
log = logging.getLogger(__name__)
def get_jobma_client():
"""
Get an authenticate... | mitodl/bootcamp-ecommerce | jobma/api.py | Python | bsd-3-clause | 2,105 |
#!/usr/bin/env python
#
# Copyright (c) 2011 Ivan Zakrevsky
# Licensed under the terms of the BSD License (see LICENSE.txt)
import os.path
from setuptools import setup, find_packages
import metadata
app_name = metadata.name
version = metadata.version
setup(
name = app_name,
version = version,
packages = ... | emacsway/django-modeltranslation-ext | setup.py | Python | bsd-3-clause | 1,312 |
__author__ = 'oddBit'
import json
settings_json = json.dumps([
{'type': 'title',
'title': 'game settings'},
{'type': 'bool',
'title': 'hardcore mode',
'desc': 'adds enemies and a portal to the map',
'section': 'game',
'key': 'hardcoreOption'},
{'type': 'title',
'title': 'soun... | oddbitdev/hexTap | SettingsJson.py | Python | bsd-3-clause | 580 |
import py
from ..base import BaseTopazTest
class TestLocalPropagation(BaseTopazTest):
def test_simple(self, space):
w_res = space.execute("""
require "libdeltablue"
string, number = "0", 0
always predicate: -> { string == number.to_s },
methods: -> {[ string <-> { ... | babelsberg/babelsberg-r | tests/constraints/test_local_propagation.py | Python | bsd-3-clause | 2,923 |
__author__ = "Jens Thomas & Felix Simkovic"
__date__ = "10 June 2019"
__version__ = "1.0"
import argparse
import os
from ample.modelling.multimer_definitions import MULTIMER_MODES
class BoolAction(argparse.Action):
"""Class to set a boolean value either form a string or just from the use of the command-line flag... | linucks/ample | ample/util/argparse_util.py | Python | bsd-3-clause | 25,356 |
#! /usr/bin/env python
#
# Copyright (C) 2016 Rich Lewis <rl403@cam.ac.uk>
# License: 3-clause BSD
"""
## skchem.cross_validation
Module implementing cross validation routines useful for chemical data.
"""
from .similarity_threshold import SimThresholdSplit
__all__ = [
'SimThresholdSplit'
] | richlewis42/scikit-chem | skchem/cross_validation/__init__.py | Python | bsd-3-clause | 300 |
#coding=utf-8
import time
class ConfsModel:
def __init__(self):
self.reload()
def reload(self, datum = None):
self._cache = {}
if datum is not None:
ret = datum.result('select conf_name, conf_vals from confs')
if ret:
for row in ret:
... | finron/luokr.com | www.luokr.com/app/model/confs.py | Python | bsd-3-clause | 1,204 |
import json
import os
import time
import phonenumbers
import psycopg2
from ndoh_hub.constants import LANGUAGES
def get_addresses(addresses):
addresses = addresses.get("msisdn") or {}
result = []
for addr, details in addresses.items():
try:
p = phonenumbers.parse(addr, "ZA")
... | praekeltfoundation/ndoh-hub | scripts/migrate_to_rapidpro/collect_information.py | Python | bsd-3-clause | 10,809 |
# -*- coding: utf-8 -*-
from pytest import raises
from watson.filters import abc
class TestFilterBase(object):
def test_call_error(self):
with raises(TypeError):
abc.Filter()
| watsonpy/watson-filters | tests/watson/filters/test_abc.py | Python | bsd-3-clause | 202 |
from typing import Any, List, Union
from apistar import app
from apistar.pipelines import ArgName
class Settings(dict):
@classmethod
def build(cls, app: app.App):
return cls(app.settings)
def get(self, indexes: Union[str, List[str]], default: Any=None) -> Any:
if isinstance(indexes, str)... | thimslugga/apistar | apistar/settings.py | Python | bsd-3-clause | 787 |
import numpy as np
import scipy.sparse as sp
from scipy import linalg, optimize, sparse
import scipy
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from... | jmschrei/scikit-learn | sklearn/linear_model/tests/test_logistic.py | Python | bsd-3-clause | 39,145 |
"""
Flask-CouchDBKit
----------------
Flask extension that provides integration with CouchDBKit.
Links
`````
* `documentation <http://packages.python.org/Flask-CouchDBKit>`_
* `development version
<http://github.com/sirn/flask-couchdbkit/zipball/master#egg=Flask-CouchDBKit-dev>`_
"""
from setuptools import setup
... | sirn/flask-couchdbkit | setup.py | Python | bsd-3-clause | 1,410 |
""" Test functions for stats module
WRITTEN BY LOUIS LUANGKESORN <lluang@yahoo.com> FOR THE STATS MODULE
BASED ON WILKINSON'S STATISTICS QUIZ
http://www.stanford.edu/~clint/bench/wilk.txt
Additional tests by a host of SciPy developers.
"""
from __future__ import division, print_function, absolute_impo... | mortonjt/scipy | scipy/stats/tests/test_stats.py | Python | bsd-3-clause | 124,000 |
from features_to_hdf5 import features_to_hdf5
from videos_to_hdf5 import *
| EderSantana/seya | seya/preprocessing/__init__.py | Python | bsd-3-clause | 75 |
""" Utilities for working with Images and common neuroimaging spaces
Images are very general things, and don't know anything about the kinds of
spaces they refer to, via their coordinate map.
There are a set of common neuroimaging spaces. When we create neuroimaging
Images, we want to place them in neuroimaging spac... | arokem/nipy | nipy/core/image/image_spaces.py | Python | bsd-3-clause | 14,025 |
import json
import os
import shutil
import tempfile
from django.conf import settings
from django.test.utils import override_settings
import mock
import pytest
from nose.tools import eq_
from PIL import Image
import amo
import amo.tests
from addons.models import Addon
from amo.helpers import user_media_path
from amo.... | Joergen/olympia | apps/devhub/tests/test_tasks.py | Python | bsd-3-clause | 8,425 |
from __future__ import absolute_import
import os.path
import pytest
import subprocess
from django.conf import settings
from raven.versioning import fetch_git_sha, fetch_package_version
from raven.utils import six
def has_git_requirements():
return os.path.exists(os.path.join(settings.PROJECT_ROOT, '.git', 'ref... | ronaldevers/raven-python | tests/versioning/tests.py | Python | bsd-3-clause | 874 |
from io import StringIO
from .. import *
from bfg9000 import path
from bfg9000 import safe_str
from bfg9000.shell.syntax import *
class my_safe_str(safe_str.safe_string):
pass
class TestWriteString(TestCase):
def test_variable(self):
out = Writer(StringIO())
out.write('foo', Syntax.variabl... | jimporter/bfg9000 | test/unit/shell/test_syntax.py | Python | bsd-3-clause | 3,803 |
################################################################################
# Copyright (c) 2011-2021, National Research Foundation (SARAO)
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at
#
# ... | ska-sa/katdal | katdal/h5datav1.py | Python | bsd-3-clause | 23,433 |
'''Unit test package for module "tws.helper._hook_currenttime".'''
__copyright__ = "Copyright (c) 2009 Kevin J Bluck"
__version__ = "$Id$"
import unittest
import tws
from tws.helper import HookCurrentTime
class test_helper_HookCurrentTime(unittest.TestCase):
'''Test type "tws.helper.HookCurrentTime"'''
d... | kbluck/pytws | test_tws/test_helper/test_hook_currenttime.py | Python | bsd-3-clause | 821 |
def extractWwwLiterarynerdsCom(item):
'''
Parser for 'www.literarynerds.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractWwwLiterarynerdsCom.py | Python | bsd-3-clause | 554 |
from __future__ import absolute_import
from rest_framework.response import Response
from sentry import features
from sentry.api.base import DocSection
from sentry.api.bases.organization import OrganizationEndpoint
from sentry.api.paginator import OffsetPaginator
from sentry.api.serializers import serialize
from sentr... | looker/sentry | src/sentry/api/endpoints/organization_repositories.py | Python | bsd-3-clause | 3,426 |
# -*- coding: utf-8 -*-
import pytest
from schematics.models import Model
from schematics.types import *
from schematics.types.compound import *
from schematics.exceptions import *
from schematics.undefined import Undefined
def autofail(value, context):
raise ValidationError("Fubar!", info=99)
class M(Model):
... | mlyundin/schematics | tests/test_conversion.py | Python | bsd-3-clause | 7,830 |
# coding: utf-8
"""
Environmental Exposures API
Environmental Exposures API
OpenAPI spec version: 1.0.0
Contact: stealey@renci.org
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file ex... | ResearchSoftwareInstitute/greendatatranslator | src/greentranslator/python-client/setup.py | Python | bsd-3-clause | 1,462 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['PolyTrend'] , ['BestCycle'] , ['LSTM'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_None/model_control_one_enabled_None_PolyTrend_BestCycle_LSTM.py | Python | bsd-3-clause | 148 |
"""Talks forms."""
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from flask_wtf import Form
from wtforms.validators import Optional
from wtforms_alchemy import model_form_factory
from pygotham.talks.models import Duration, Talk
__all__ = ('TalkSubmissionForm',)
ModelForm = model_form_factory(Form)
de... | djds23/pygotham-1 | pygotham/talks/forms.py | Python | bsd-3-clause | 2,225 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | bokeh/bokeh | tests/unit/bokeh/command/subcommands/test___init___subcommands.py | Python | bsd-3-clause | 2,184 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from corehq.sql_db.operations import RawSQLMigration
migrator = RawSQLMigration(('custom', 'icds_reports', 'migrations', 'sql_templates'))
class Migration(migrations.Migration):
dependencies = [
]
operatio... | qedsoftware/commcare-hq | custom/icds_reports/migrations/0001_initial.py | Python | bsd-3-clause | 452 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('orders', '0006_auto_20150223_1523'),
]
operations = [
migrations.AlterField(
model_name='mealdefaultmeal',
... | delphcf/sis | sis/orders/migrations/0007_auto_20150224_1134.py | Python | bsd-3-clause | 442 |
from __future__ import annotations
from dials.algorithms.refinement.restraints.restraints_parameterisation import (
RestraintsParameterisation,
)
__all__ = ["RestraintsParameterisation"]
| dials/dials | algorithms/refinement/restraints/__init__.py | Python | bsd-3-clause | 193 |
from sklearn import linear_model as lm_
from dask_ml import linear_model as lm
from dask_ml.utils import assert_estimator_equal
class TestStochasticGradientClassifier(object):
def test_basic(self, single_chunk_classification):
X, y = single_chunk_classification
a = lm.PartialSGDClassifier(class... | daniel-severo/dask-ml | tests/linear_model/test_stochastic_gradient.py | Python | bsd-3-clause | 1,014 |
#!/usr/bin/env python
from setuptools import setup, find_packages
try:
README = open('README.rst').read()
except:
README = None
try:
REQUIREMENTS = open('requirements.txt').read()
except:
REQUIREMENTS = None
setup(
name = 'django-legacymigrations',
version = "0.1",
description = 'Continuo... | onepercentclub/django-legacymigrations | setup.py | Python | bsd-3-clause | 1,058 |
# 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.
import os
import six.moves.urllib.parse # pylint: disable=import-error
from core import benchmark_finders
from core import benchmark_utils
from telemetry.s... | nwjs/chromium.src | tools/perf/core/bot_platforms.py | Python | bsd-3-clause | 25,195 |
# -*- coding: utf-8 -*-
"""Basic regex lexer implementation"""
# :copyright: (c) 2009 - 2012 Thom Neale and individual contributors,
# All rights reserved.
# :license: BSD (3 Clause), see LICENSE for more details.
from __future__ import absolute_import
import logging.config
from rexlex import config... | twneale/rexlex | rexlex/__init__.py | Python | bsd-3-clause | 1,346 |
# mapper/sync.py
# Copyright (C) 2005, 2006, 2007, 2008 Michael Bayer mike_mp@zzzcomputing.com
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Contains the ClauseSynchronizer class, which is used to map
attributes between two objects ... | santisiri/popego | envs/ALPHA-POPEGO/lib/python2.5/site-packages/SQLAlchemy-0.4.3-py2.5.egg/sqlalchemy/orm/sync.py | Python | bsd-3-clause | 9,024 |
'''
Created on Dec 16, 2011
@author: t4aalton
'''
from socialDevices.action import Action, actionbody, actionprecondition
from socialDevices.deviceInterfaces.talkingDevice import TalkingDevice
from socialDevices.device import Device
import socialDevices.misc as misc
class DialogTest(Action):
def __init__(self, ... | socialdevices/manager | core/fixtures/talkingDevices/invalid_files/dialog_action_exists.py | Python | bsd-3-clause | 928 |