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 .binary_search_tree import BinarySearchTree
| dskoda1/hpds | hpds/trees/__init__.py | Python | bsd-2-clause | 49 |
from pytest import mark
from django.urls import reverse
from email_template.models import Email
from assopy.models import AssopyUser
from conference.accounts import PRIVACY_POLICY_CHECKBOX, PRIVACY_POLICY_ERROR
from conference.models import CaptchaQuestion
from conference.users import RANDOM_USERNAME_LENGTH
from te... | EuroPython/epcon | tests/test_user_login_and_registration.py | Python | bsd-2-clause | 8,704 |
# -*- encoding: utf-8 -*-
import mock
import os
from shutil import rmtree
from tempfile import mkdtemp
from django.test import TestCase
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test.utils import override_settings
... | johan--/Geotrek | geotrek/common/tests/test_parsers.py | Python | bsd-2-clause | 5,465 |
from hippiehug import RedisStore, Tree, Leaf, Branch
import pytest
## ============== TESTS ===================
def test_evidence():
t = Tree()
# Test positive case
t.add(b"Hello", b"Hello")
t.add(b"World", b"World")
root, E = t.evidence(b"World")
assert len(E) == 2
store = dict... | gdanezis/rousseau-chain | hippiehug-package/tests/test_tree.py | Python | bsd-2-clause | 5,884 |
from flask import *
from pyZPL import *
from printLabel import printLabel
import xml.etree.ElementTree as ET
import os
app = Flask(__name__)
dn = os.path.dirname(os.path.realpath(__file__))+"/"
tree = ET.parse(dn+"pace.xml")
customElements = tree.findall(".//*[@id]")
customItems = []
for element in customElements:
... | OHRI-BioInfo/pyZPL | web.py | Python | bsd-2-clause | 1,418 |
# coding: utf-8
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('logger', '0011_add-index-to-instance-uuid_and_xform_uuid'),
]
operations = [
migrations.AddField(
model_name='xform',
name='kpi_asset_uid',
... | kobotoolbox/kobocat | onadata/apps/logger/migrations/0012_add_asset_uid_to_xform.py | Python | bsd-2-clause | 390 |
import copy
import mufsim.utils as util
import mufsim.gamedb as db
import mufsim.stackitems as si
from mufsim.errors import MufRuntimeError
from mufsim.insts.base import Instruction, instr
class InstPushItem(Instruction):
value = 0
def __init__(self, line, val):
self.value = val
super(InstPus... | revarbat/mufsim | mufsim/insts/stack.py | Python | bsd-2-clause | 11,103 |
#!/usr/bin/env python
# encoding: utf-8
class MyRange(object):
def __init__(self, n):
self.idx = 0
self.n = n
def __iter__(self):
return self
def next(self):
if self.idx < self.n:
val = self.idx
self.idx += 1
return val
else:
... | feixiao5566/Py_Rabbic | IO/自定义迭代器.py | Python | bsd-2-clause | 402 |
# Homework 2 solution, part 1: cnf.py
# Andrew Gordon
# Feb 18, 2015
# Revised June 19, 2015 for better input/output and implies->if
import sys
import fileinput
def biconditionalElimination(s):
if type(s) is str:
return s
elif type(s) is list and s[0] == "iff":
return(["and",
[... | asgordon/DPLL | cnf.py | Python | bsd-2-clause | 5,803 |
from mpi4py import MPI
from pySDC.helpers.stats_helper import filter_stats, sort_stats
from pySDC.implementations.controller_classes.controller_MPI import controller_MPI
from pySDC.implementations.collocation_classes.gauss_radau_right import CollGaussRadau_Right
from pySDC.implementations.problem_classes.HeatEquation_... | Parallel-in-Time/pySDC | pySDC/playgrounds/compression/run_parallel_Heat_NumPy.py | Python | bsd-2-clause | 4,544 |
from django.test import TestCase
from addressbase.models import Address
from addressbase.tests.factories import AddressFactory, UprnToCouncilFactory
class TestAddressFactory(TestCase):
def test_address_factory(self):
address = AddressFactory()
self.assertEqual(len(address.uprn), 9)
self.a... | DemocracyClub/UK-Polling-Stations | polling_stations/apps/addressbase/tests/test_factories.py | Python | bsd-3-clause | 562 |
""" Test functions for stats module
"""
import warnings
import re
import sys
import pickle
import os
from numpy.testing import (assert_equal, assert_array_equal,
assert_almost_equal, assert_array_almost_equal,
assert_allclose, assert_, assert_warns,
... | aeklant/scipy | scipy/stats/tests/test_distributions.py | Python | bsd-3-clause | 165,416 |
from __future__ import absolute_import, unicode_literals, division, print_function
from . import model_base
__all__ = ['PhotomModelB4']
class PhotomModelB4(model_base.DataModel):
"""
A data model for photom reference files.
"""
schema_url = "photomb4.schema.yaml"
def __init__(self, init=None, p... | mdboom/jwst_lib.models | jwst_lib/models/photom_b4.py | Python | bsd-3-clause | 2,355 |
"""
* Copyright (c) 2012-2017, Nic McDonald and Adriana Flores
* 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, t... | adrifloresm/sssweep | setup.py | Python | bsd-3-clause | 2,611 |
import pytest
from collections import namedtuple
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_less
from skopt import dummy_minimize
from skopt.benchmarks import bench1
from skopt.callbacks import TimerCallback
from skopt.callbacks import DeltaYStopper
@pytest.mark.fast_te... | ccauet/scikit-optimize | skopt/tests/test_callbacks.py | Python | bsd-3-clause | 832 |
import os
import sys
import re
from bento.compat \
import \
inspect as compat_inspect
from bento.commands.core \
import \
command
SAFE_MODULE_NAME = re.compile("[^a-zA-Z_]")
__HOOK_REGISTRY = {}
__PRE_HOOK_REGISTRY = {}
__POST_HOOK_REGISTRY = {}
__COMMANDS_OVERRIDE = {}
__INIT_FUNCS = {}
def... | abadger/Bento | bento/commands/hooks.py | Python | bsd-3-clause | 3,935 |
import os
import nose
import django
NAME = os.path.basename(os.path.dirname(__file__))
ROOT = os.path.abspath(os.path.dirname(__file__))
os.environ['DJANGO_SETTINGS_MODULE'] = 'fake_settings'
os.environ['PYTHONPATH'] = os.pathsep.join([ROOT,
os.path.join(ROOT, 'examples')]... | jbalogh/jingo | run_tests.py | Python | bsd-3-clause | 522 |
# -*-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
# list... | stormi/tsunami | src/primaires/salle/commandes/chercherbois/__init__.py | Python | bsd-3-clause | 5,680 |
from __future__ import absolute_import, unicode_literals
import pickle
from io import StringIO, BytesIO
from kombu import version_info_t
from kombu import utils
from kombu.five import python_2_unicode_compatible
from kombu.utils.text import version_string_as_tuple
from kombu.tests.case import Case, Mock, patch, moc... | Elastica/kombu | kombu/tests/utils/test_utils.py | Python | bsd-3-clause | 10,301 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Unit tests for the admin template gatherer.'''
import os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(o... | JoKaWare/WTL-DUI | tools/grit/grit/gather/admin_template_unittest.py | Python | bsd-3-clause | 3,990 |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 3, s, t 6.1, s, q"
tags = "MoveBy"
import cocos
from cocos.director import director
from cocos.actions import MoveBy
from cocos.sprite imp... | eevee/cocos2d-mirror | test/test_moveby.py | Python | bsd-3-clause | 867 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import subprocess
from devtoolslib.shell import Shell
from devtoolslib import http_server
class LinuxShell(Shell):
"""Wrapper around Mojo shell running ... | collinjackson/mojo | mojo/devtools/common/devtoolslib/linux_shell.py | Python | bsd-3-clause | 2,385 |
# Copyright 2013 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.
DEPS = [
'recipe_engine/buildbucket',
'recipe_engine/context',
'recipe_engine/path',
'recipe_engine/platform',
'recipe_engine/properties',
'recip... | endlessm/chromium-browser | third_party/depot_tools/recipes/recipe_modules/git/examples/full.py | Python | bsd-3-clause | 5,942 |
from django.test import TestCase
import time
from .models import SimpleTree, MPTTTree, TBMP, TBNS
def timeit(method):
""" Measure time of method's execution.
"""
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
print '\n%r: %2.2f sec'... | klen/simpletree | benchmark/main/tests.py | Python | bsd-3-clause | 3,596 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-28 17:08
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
(... | WebCampZg/conference-web | voting/migrations/0003_votetoken.py | Python | bsd-3-clause | 880 |
import uuid
import os
import shutil
import urlparse
import re
import hashlib
from lxml import html
from PIL import Image, ImageFile
from django.conf import settings
import views
ImageFile.MAXBLOCKS = 10000000
def match_or_none(string, rx):
"""
Tries to match a regular expression and returns an integer if it... | ZG-Tennis/django-ckeditor | ckeditor/utils.py | Python | bsd-3-clause | 8,404 |
from django.conf import settings
from site_news.models import SiteNewsItem
def site_news(request):
"""
Inserts the currently active news items into the template context.
This ignores MAX_SITE_NEWS_ITEMS.
"""
# Grab all active items in proper date/time range.
items = SiteNewsItem.current_a... | glesica/django-site-news | site_news/context_processors.py | Python | bsd-3-clause | 379 |
# -*- coding: utf-8 -*-
import logging
import re
import importlib
import django
import six
from django.contrib.sites.shortcuts import get_current_site
from django.utils.functional import lazy
from django.utils.safestring import mark_safe
from django.utils.module_loading import import_string
from django.utils.html impo... | whyflyru/django-seo | djangoseo/utils.py | Python | bsd-3-clause | 7,375 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kitchen_sink.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| publica-io/django-publica-kitchen-sink | kitchen_sink/manage.py | Python | bsd-3-clause | 255 |
#!/usr/bin/env python3
import logging
from . import SubprocessHook
logger = logging.getLogger("barython")
class PulseAudioHook(SubprocessHook):
"""
Listen on pulseaudio events with pactl
"""
def __init__(self, cmd=["pactl", "subscribe", "-n", "barython"],
*args, **kwargs):
... | Anthony25/barython | barython/hooks/audio.py | Python | bsd-3-clause | 363 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" Common filesystem operations """
from __future__ import absolute_import
from __future__ import unicode_literals
from __... | aldebaran/qibuild | python/qisys/sh.py | Python | bsd-3-clause | 22,082 |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("SVR_rbf" , "freidman1" , "db2")
| antoinecarme/sklearn2sql_heroku | tests/regression/freidman1/ws_freidman1_SVR_rbf_db2_code_gen.py | Python | bsd-3-clause | 121 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-04 05:22
from __future__ import unicode_literals
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
depe... | acercado/jd-ph-cms | jd-ph-cms/policies/migrations/0001_initial.py | Python | bsd-3-clause | 2,519 |
from __future__ import absolute_import
# What follows is part of a hack to make control breaking work on windows even
# if scipy.stats ims imported. See:
# http://stackoverflow.com/questions/15457786/ctrl-c-crashes-python-after-importing-scipy-stats
import sys
import os
import imp
import ctypes
if sys.platform == 'wi... | gabobert/climin | climin/__init__.py | Python | bsd-3-clause | 899 |
#The DF of a tidal stream
import copy
import numpy
import multiprocessing
import scipy
from scipy import special, interpolate, integrate
if int(scipy.__version__.split('.')[1]) < 10: #pragma: no cover
from scipy.maxentropy import logsumexp
else:
from scipy.misc import logsumexp
from galpy.orbit import Orbit
fro... | followthesheep/galpy | galpy/df_src/streamdf.py | Python | bsd-3-clause | 117,381 |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import models
class Location(models.Model):
address = models.CharField(blank=True)
latitude = models.DecimalField(max_digits=10, decimal_places=6)
longitude = models.DecimalField(max_digits=10, decimal_... | derrickyoo/serve-tucson | serve_tucson/locations/models.py | Python | bsd-3-clause | 956 |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import print_function, unicode_literals, absolute_import
import json
import pytest
import requests
import requests.exception... | projectatomic/atomic-reactor | tests/conftest.py | Python | bsd-3-clause | 2,306 |
import shutil
import os
import jinja2
import string
import subprocess
import re
from xen.provisioning.HdManager import HdManager
from settings.settingsLoader import OXA_XEN_SERVER_KERNEL,OXA_XEN_SERVER_INITRD,OXA_DEBIAN_INTERFACES_FILE_LOCATION,OXA_DEBIAN_UDEV_FILE_LOCATION, OXA_DEBIAN_HOSTNAME_FILE_LOCATION, OXA_DEB... | avlach/univbris-ocf | vt_manager/src/python/agent/xen/provisioning/configurators/ofelia/OfeliaDebianVMConfigurator.py | Python | bsd-3-clause | 6,611 |
"""
This module implements atom/bond/structure-wise descriptor calculated from
pretrained megnet model
"""
import os
from typing import Dict, Union
import numpy as np
from tensorflow.keras.models import Model
from megnet.models import GraphModel, MEGNetModel
from megnet.utils.typing import StructureOrMolecule
DEFAU... | materialsvirtuallab/megnet | megnet/utils/descriptor.py | Python | bsd-3-clause | 6,396 |
from traitlets import Unicode, Bool
from textwrap import dedent
from .. import utils
from . import NbGraderPreprocessor
class ClearSolutions(NbGraderPreprocessor):
code_stub = Unicode(
"# YOUR CODE HERE\nraise NotImplementedError()",
config=True,
help="The code snippet that will replace ... | EdwardJKim/nbgrader | nbgrader/preprocessors/clearsolutions.py | Python | bsd-3-clause | 5,142 |
# Implementation of RAKE - Rapid Automtic Keyword Exraction algorithm
# as described in:
# Rose, S., D. Engel, N. Cramer, and W. Cowley (2010).
# Automatic keyword extraction from indi-vidual documents.
# In M. W. Berry and J. Kogan (Eds.), Text Mining: Applications and Theory.unknown: John Wiley and Sons, Ltd.
impo... | idf/tagr | rake_app/rake/rake.py | Python | bsd-3-clause | 6,809 |
from django.utils.datastructures import SortedDict
from bencode import bencode, bdecode
def sort_dict(D):
result = SortedDict()
for key in sorted(D.keys()):
if type(D[key]) is dict:
D[key] = sort_dict(D[key])
result[key] = D[key]
return result | abshkd/benzene | torrents/utils/__init__.py | Python | bsd-3-clause | 254 |
import klampt.math.autodiff.ad as ad
import torch,numpy as np
class TorchModuleFunction(ad.ADFunctionInterface):
"""Converts a PyTorch function to a Klamp't autodiff function class."""
def __init__(self,module):
self.module=module
self._eval_params=[]
torch.set_default_dtype(torch.float... | krishauser/Klampt | Python/klampt/math/autodiff/pytorch.py | Python | bsd-3-clause | 6,627 |
# Copyright 2008-2010 Neil Martinsen-Burrell
#
# 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, merge, publ... | jobovy/mwdust | mwdust/util/fortranfile.py | Python | bsd-3-clause | 8,822 |
import pathlib
from typing import Optional
from cumulusci.core.exceptions import TaskOptionsError
from cumulusci.core.utils import process_bool_arg, process_list_arg
from cumulusci.salesforce_api.metadata import ApiDeploy
from cumulusci.salesforce_api.package_zip import MetadataPackageZipBuilder
from cumulusci.tasks.s... | SalesforceFoundation/CumulusCI | cumulusci/tasks/salesforce/Deploy.py | Python | bsd-3-clause | 5,848 |
# Copyright the Karmabot authors and contributors.
# All rights reserved. See AUTHORS.
#
# This file is part of 'karmabot' and is distributed under the BSD license.
# See LICENSE for more details.
from karmabot.core.facets import Facet
from karmabot.core.commands import CommandSet, thing
import random
predictions = ... | chromakode/karmabot | karmabot/extensions/eightball.py | Python | bsd-3-clause | 1,155 |
#! /usr/bin/env python
"""
# control_get_firmware.py: get firmware version of Gemalto readers
# Copyright (C) 2009-2012 Ludovic Rousseau
"""
# 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 Software Foun... | vicamo/pcsc-lite-android | UnitaryTests/control_get_firmware.py | Python | bsd-3-clause | 1,904 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-31 14:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('news', '0010_auto_20170530_1509'),
]
operations = [
migrations.AddField(
... | GeorgiaTechDHLab/TOME | news/migrations/0011_auto_20170531_1426.py | Python | bsd-3-clause | 658 |
import sys
from . import (
utils, env, defs, context, layers, parser, preprocessor, loader, analyzer,
generator)
LAYERS = (
(parser.Parser, "parse"),
(preprocessor.Preprocessor, "transform_ast"),
(loader.Loader, "expand_ast"),
(analyzer.Analyzer, "expand_ast"),
(generator.Generator, "expa... | adrian-lang/margolith | solyanka/solyanka/__init__.py | Python | bsd-3-clause | 1,936 |
# -*- coding: utf-8 -*-
from bda.plone.discount import UUID_PLONE_ROOT
from bda.plone.discount.tests import Discount_INTEGRATION_TESTING
from bda.plone.discount.tests import set_browserlayer
from plone.uuid.interfaces import IUUID
import unittest2 as unittest
class TestDiscount(unittest.TestCase):
layer = Discou... | TheVirtualLtd/bda.plone.discount | src/bda/plone/discount/tests/test_discount.py | Python | bsd-3-clause | 592 |
'''
YARN Cluster Metrics
--------------------
yarn.metrics.appsSubmitted The number of submitted apps
yarn.metrics.appsCompleted The number of completed apps
yarn.metrics.appsPending The number of pending apps
yarn.metrics.appsRunning The number of running apps
yarn.metrics.apps... | StackVista/sts-agent-integrations-core | yarn/check.py | Python | bsd-3-clause | 20,533 |
def extractRoontalesCom(item):
'''
Parser for 'roontales.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', 'Loiterous',... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractRoontalesCom.py | Python | bsd-3-clause | 539 |
# See e.g. http://stackoverflow.com/a/14076841/931303
try:
import pymysql
pymysql.install_as_MySQLdb()
except ImportError:
pass
| jorgecarleitao/public-contracts | main/__init__.py | Python | bsd-3-clause | 140 |
def hanoi(n, source, helper, target):
if n > 0:
# move tower of size n - 1 to helper
hanoi(n - 1, source, target, helper)
# move disk from source peg to target peg
if source:
target.append(source.pop())
# move tower of size n-1 from helper to target
hanoi(... | talapus/Ophidian | Games/Hanoi/hanoi_prototype4.py | Python | bsd-3-clause | 486 |
import itertools
import numpy as np
import pandas as pd
import pytest
from numpy.testing import assert_allclose
from pvlib import atmosphere
from pvlib import solarposition
latitude, longitude, tz, altitude = 32.2, -111, 'US/Arizona', 700
times = pd.date_range(start='20140626', end='20140626', freq='6h', tz=tz)
e... | uvchik/pvlib-python | pvlib/test/test_atmosphere.py | Python | bsd-3-clause | 5,239 |
from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404
from django.template.response import TemplateResponse
from django.utils.decorators import method_decorator
from ..core.app import SatchlessApp
from . import models
class ... | fusionbox/satchless | satchless/order/app.py | Python | bsd-3-clause | 2,122 |
"""Utility functions for handling and fetching repo archives in zip format."""
from __future__ import absolute_import
import os
import tempfile
from zipfile import ZipFile
import requests
try:
# BadZipfile was renamed to BadZipFile in Python 3.2.
from zipfile import BadZipFile
except ImportError:
from z... | luzfcb/cookiecutter | cookiecutter/zipfile.py | Python | bsd-3-clause | 4,640 |
from base import StreetAddressValidation, AddressValidation
UPS_XAV_CONNECTION = 'https://onlinetools.ups.com/ups.app/xml/XAV'
UPS_XAV_CONNECTION_TEST = 'https://wwwcie.ups.com/ups.app/xml/XAV'
UPS_AV_CONNECTION = 'https://onlinetools.ups.com/ups.app/xml/AV'
UPS_AV_CONNECTION_TEST = 'https://wwwcie.ups.com/ups.app/xm... | cuker/python-ups | ups/addressvalidation/__init__.py | Python | bsd-3-clause | 326 |
import code
import sys
from awesomestream.jsonrpc import Client
def main():
try:
host = sys.argv[1]
except IndexError:
host = 'http://localhost:9997/'
banner = """>>> from awesomestream.jsonrpc import Client
>>> c = Client('%s')""" % (host,)
c = Client(host)
code.interact(banner, l... | ericflo/awesomestream | awesomestream/repl.py | Python | bsd-3-clause | 391 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import uuid
import socket
import time
__appname__ = "pymessage"
__author__ = "Marco Sirabella, Owen Davies"
__copyright__ = ""
__credits__ = "Marco Sirabella, Owen Davies"
__license__ = "new BSD 3-Clause"
__version__ = "0.0.3"
__maintainers__ = "Ma... | mjsir911/pymessage | client.py | Python | bsd-3-clause | 1,124 |
from diesel import Loop, fork, Application, sleep
def sleep_and_print(num):
sleep(1)
print num
sleep(1)
a.halt()
def forker():
for x in xrange(5):
fork(sleep_and_print, x)
a = Application()
a.add_loop(Loop(forker))
a.run()
| dieseldev/diesel | examples/forker.py | Python | bsd-3-clause | 255 |
# -*- coding: utf-8 -*-
"""
zine.forms
~~~~~~~~~~
The form classes the zine core uses.
:copyright: (c) 2010 by the Zine Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from copy import copy
from datetime import datetime
from zine.i18n import _, lazy_gettext, l... | mitsuhiko/zine | zine/forms.py | Python | bsd-3-clause | 55,129 |
from falcor import *
def render_graph_BSDFViewer():
g = RenderGraph("BSDFViewerGraph")
loadRenderPassLibrary("AccumulatePass.dll")
loadRenderPassLibrary("BSDFViewer.dll")
BSDFViewer = createPass("BSDFViewer")
g.addPass(BSDFViewer, "BSDFViewer")
AccumulatePass = createPass("AccumulatePass")
... | NVIDIAGameWorks/Falcor | Tests/image_tests/renderpasses/graphs/BSDFViewer.py | Python | bsd-3-clause | 569 |
from django.conf.urls.defaults import *
from django_de.apps.authors.models import Author
urlpatterns = patterns('django.views.generic.list_detail',
(r'^$', 'object_list',
dict(
queryset = Author.objects.order_by('name', 'slug'),
template_object_name = 'author',
allow_emp... | django-de/django-de-v2 | django_de/apps/authors/urls.py | Python | bsd-3-clause | 348 |
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from djangoautoconf.local_key_manager import get_default_admin_username, \
get_default_admin_password
from djangoautoconf.management.commands.web_manage_tools.user_creator import create_admin
def create_default_admin()... | weijia/djangoautoconf | djangoautoconf/management/commands/create_default_super_user.py | Python | bsd-3-clause | 844 |
"""
Parsing resource files.
See base.py for the ParsedResource base class.
"""
import os.path
from pontoon.sync.formats import (
compare_locales,
ftl,
json_extensions,
lang,
po,
silme,
xliff,
)
# To add support for a new resource format, add an entry to this dict
# where the key is the ex... | jotes/pontoon | pontoon/sync/formats/__init__.py | Python | bsd-3-clause | 2,225 |
import astar
import os
import sys
import csv
import math
from difflib import SequenceMatcher
import unittest
class Station:
def __init__(self, id, name, position):
self.id = id
self.name = name
self.position = position
self.links = []
def build_data():
"""builds the 'map' by ... | jrialland/python-astar | tests/london/test_london_underground.py | Python | bsd-3-clause | 2,878 |
# !usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under a 3-clause BSD license.
#
# @Author: Brian Cherinka
# @Date: 2018-10-11 17:51:43
# @Last modified by: Brian Cherinka
# @Last Modified time: 2018-11-29 17:23:15
from __future__ import print_function, division, absolute_import
import numpy as np
impor... | sdss/marvin | python/marvin/contrib/vacs/hi.py | Python | bsd-3-clause | 9,230 |
from djpcms import sites
if sites.settings.CMS_ORM == 'django':
from djpcms.core.cmsmodels._django import *
elif sites.settings.CMS_ORM == 'stdnet':
from djpcms.core.cmsmodels._stdnet import *
else:
raise NotImplementedError('Objecr Relational Mapper {0} not available for CMS model... | strogo/djpcms | djpcms/models.py | Python | bsd-3-clause | 354 |
import os
import tempfile
from rest_framework import status
from hs_core.hydroshare import resource
from .base import HSRESTTestCase
class TestPublicResourceFlagsEndpoint(HSRESTTestCase):
def setUp(self):
super(TestPublicResourceFlagsEndpoint, self).setUp()
self.tmp_dir = tempfile.mkdtemp()
... | RENCI/xDCIShare | hs_core/tests/api/rest/test_resource_flags.py | Python | bsd-3-clause | 3,544 |
################################################################
# File: e621.py
# Title: MANGAdownloader's site scraper
# Author: ASL97/ASL <asl97@outlook.com>
# Version: 1
# Notes : DON'T EMAIL ME UNLESS YOU NEED TO
# TODO: *blank*
################################################################
import misc
# used ... | asl97/MANGAdownloader | scrapers/e621.py | Python | bsd-3-clause | 1,343 |
#!/usr/bin/env python
import setuptools
# Hack to prevent stupid TypeError: 'NoneType' object is not callable error on
# exit of python setup.py test # in multiprocessing/util.py _exit_function when
# running python setup.py test (see
# http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html)
try:
i... | orwell-int/agent-server-game-python | setup.py | Python | bsd-3-clause | 1,239 |
# -*- coding: utf8 -*-
"""
.. module:: burpui.misc.backend.burp2
:platform: Unix
:synopsis: Burp-UI burp2 backend module.
.. moduleauthor:: Ziirish <hi+burpui@ziirish.me>
"""
import re
import os
import time
import json
from collections import OrderedDict
from .burp1 import Burp as Burp1
from .interface impo... | ziirish/burp-ui | burpui/misc/backend/burp2.py | Python | bsd-3-clause | 30,550 |
from enum import Enum
from typing import List, Any, cast
import yass
from tutorial.base_types_external import Integer
# shows how to use contract internal base types
class ExpirationHandler(yass.BaseTypeHandler):
def readBase(self, reader: yass.Reader) -> 'Expiration':
return Expiration(
rea... | softappeal/yass | py3/tutorial/generated/contract/__init__.py | Python | bsd-3-clause | 2,223 |
import re
from nexusmaker.tools import natsort
is_combined_cognate = re.compile(r"""(\d+)([a-z]+)""")
class CognateParser(object):
UNIQUE_IDENTIFIER = "u_"
def __init__(self, strict=True, uniques=True, sort=True):
"""
Parses cognates.
- strict (default=True): remove dubious cognat... | SimonGreenhill/NexusMaker | nexusmaker/CognateParser.py | Python | bsd-3-clause | 2,824 |
#!/usr/bin/env python
# Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tests for analyzer
"""
import json
import TestGyp
found = 'Found dependency'
found_all = 'Found dependency (all)'
not_found = 'No depend... | pnigos/gyp | test/analyzer/gyptest-analyzer.py | Python | bsd-3-clause | 13,761 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('entries', '0005_resultsmode_json'),
]
operations = [
migrations.AlterField(
model_name='resultsmode',
name='json',
field=models.... | mjtamlyn/archery-scoring | entries/migrations/0006_auto_20150612_2307.py | Python | bsd-3-clause | 372 |
from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.config import ConfigValidationError
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from txircd.utils import durationToSeconds, ipAddressToShow, ircLower, now
from zope.interface import implementer
from... | Heufneutje/txircd | txircd/modules/rfc/cmd_whowas.py | Python | bsd-3-clause | 4,564 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from django.views import defaults as default_views
urlpat... | ylitormatech/terapialaskutus | config/urls.py | Python | bsd-3-clause | 1,837 |
import json
from json_url_rewriter import config
from json_url_rewriter.rewrite import URLRewriter
class HeaderToPathPrefixRewriter(object):
"""
A rewriter to take the value of a header and prefix any path.
"""
def __init__(self, keys, base, header_name):
self.keys = keys
self.base =... | ionrock/json_url_rewriter | json_url_rewriter/middleware.py | Python | bsd-3-clause | 2,398 |
def extractSweetjamtranslationsCom(item):
'''
Parser for 'sweetjamtranslations.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'),
('Lo... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractSweetjamtranslationsCom.py | Python | bsd-3-clause | 561 |
def extractMiratlsWordpressCom(item):
'''
Parser for 'miratls.wordpress.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_extractMiratlsWordpressCom.py | Python | bsd-3-clause | 554 |
from textwrap import dedent
from sympy import (
symbols, Integral, Tuple, Dummy, Basic, default_sort_key, Matrix,
factorial, true)
from sympy.combinatorics import RGS_enum, RGS_unrank, Permutation
from sympy.utilities.iterables import (
_partition, _set_partitions, binary_partitions, bracelets, capture,
... | hrashk/sympy | sympy/utilities/tests/test_iterables.py | Python | bsd-3-clause | 24,090 |
from pypom import Region
from selenium.webdriver.common.by import By
from base import Base
class Collections(Base):
"""Collections page."""
_item_locator = (By.CSS_SELECTOR, '.item')
def wait_for_page_to_load(self):
self.wait.until(lambda _: len(self.collections) > 0 and
... | harikishen/addons-server | tests/ui/pages/desktop/collections.py | Python | bsd-3-clause | 779 |
from __future__ import unicode_literals
from django.db import models
from modelcluster.fields import ParentalKey
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore import fields
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailadmin.edit_handlers import InlinePanel
from... | abirafdirp/blog-wagtail | about/models.py | Python | bsd-3-clause | 785 |
import eqpy
import sympy
from eqpy._utils import raises
def test_constants():
assert eqpy.nums.Catalan is sympy.Catalan
assert eqpy.nums.E is sympy.E
assert eqpy.nums.EulerGamma is sympy.EulerGamma
assert eqpy.nums.GoldenRatio is sympy.GoldenRatio
assert eqpy.nums.I is sympy.I
assert eqpy.nums... | eriknw/eqpy | eqpy/tests/test_nums.py | Python | bsd-3-clause | 747 |
from contextlib import contextmanager
from datetime import datetime
from django import forms
from django.conf import settings
from django.contrib.auth.models import AbstractBaseUser
from django.core import validators
from django.db import models
from django.utils import translation
from django.utils.encoding import sm... | andymckay/zamboni | mkt/users/models.py | Python | bsd-3-clause | 9,476 |
def extractVodkatranslationsCom(item):
'''
Parser for 'vodkatranslations.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Ordinary I and Extraordinary Them', 'Ordinary I and Extraordin... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractVodkatranslationsCom.py | Python | bsd-3-clause | 671 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from aldryn_client import forms
class Form(forms.BaseForm):
plugin_module = forms.CharField('Plugin module name', initial='Generic')
plugin_name = forms.CharField('Plugin name', initial='Facebook Comments')
plugin_template = forms.CharField(... | mishbahr/djangocms-fbcomments | aldryn_config.py | Python | bsd-3-clause | 819 |
from django.conf.urls.defaults import *
from models import Entry, Tag
from django.views.generic.dates import ArchiveIndexView, DateDetailView
from django.views.generic import TemplateView
urlpatterns = patterns('',
url(r'^/?$', ArchiveIndexView.as_view(model=Entry, date_field="published_on"), name="news-main"),
... | underbluewaters/marinemap | lingcod/news/urls.py | Python | bsd-3-clause | 788 |
import logging
from django.http import HttpResponse
from receiver.submitresponse import SubmitResponse
def duplicate_attachment(way_handled, additional_params):
'''Return a custom http response associated the handling
of the xform. In this case, telling the sender that
they sub... | icomms/wqmanager | apps/receiver/__init__.py | Python | bsd-3-clause | 1,031 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.test import TestCase
from models import Student, StudyGroup, Task, Lab, Subject, GroupSubject
class PortalTest(TestCase):
def setUp(self):
self.study_group1 = StudyGroup.objects.... | vinneyto/lab-portal | portal/test_models.py | Python | bsd-3-clause | 2,587 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2007 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | certik/sympy-oldcore | sympy/plotting/pyglet/window/__init__.py | Python | bsd-3-clause | 54,133 |
from .working_gif import working_encoded
from .splash import SplashScreen, Spinner, CheckProcessor
from .multilistbox import MultiListbox
from .utils import set_widget_state, set_binding, set_button_action, set_tab_order
from .tooltip import ToolTip
| rutherford/tikitiki | tikitiki/__init__.py | Python | bsd-3-clause | 255 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The freesurfer module provides basic functions for interfacing with
freesurfer tools.
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os... | fprados/nipype | nipype/interfaces/freesurfer/model.py | Python | bsd-3-clause | 41,958 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/TestScript) on 2017-03-22.
# 2017, SMART Health IT.
from . import domainresource
class TestScript(domainresource.DomainResource):
""" Describes a set of tests.
A structured set of... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_3_0_0/models/testscript.py | Python | bsd-3-clause | 50,708 |
import shelve, time, random
def main(connection, info) :
"""This is the old plugin"""
#"""Run every time a message is seen"""
if info["message"].startswith("\x01ACTION") and info["message"].endswith("\x01") :
on_ACTION(connection, info)
return None
# if info["sender"] == "OperServ" :
... | sonicrules1234/sonicbot | oldplugins/on_PRIVMSG.py | Python | bsd-3-clause | 10,821 |
import math
import random
import onmt
from torch.autograd import Variable
class Dataset(object):
def __init__(self, srcData, tgtData, batchSize, cuda, volatile=False):
self.src = srcData
if tgtData:
self.tgt = tgtData
assert(len(self.src) == len(self.tgt))
else:
... | bmccann/examples | OpenNMT/onmt/Dataset.py | Python | bsd-3-clause | 1,722 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..utils import AffineInitializer
def test_AffineInitializer_inputs():
input_map = dict(args=dict(argstr='%s',
),
dimension=dict(argstr='%s',
position=0,
usedefault=True,
),
environ=dict(nohas... | mick-d/nipype | nipype/interfaces/ants/tests/test_auto_AffineInitializer.py | Python | bsd-3-clause | 1,633 |
name = "neurogenesis"
| juliusf/Neurogenesis | neurogenesis/__init__.py | Python | bsd-3-clause | 22 |