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
#
# Copyright 2007 Google Inc.
#
# 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... | Suwmlee/XX-Net | gae_proxy/server/lib/google/appengine/datastore/document_pb.py | Python | bsd-2-clause | 55,713 |
'''
Created by auto_sdk on 2015.04.21
'''
from aliyun.api.base import RestApi
class Ecs20130110CreateSnapshotRequest(RestApi):
def __init__(self,domain='ecs.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.ClientToken = None
self.DiskId = None
self.InstanceId = None
self.SnapshotNam... | wanghe4096/website | aliyun/api/rest/Ecs20130110CreateSnapshotRequest.py | Python | bsd-2-clause | 411 |
from pip.req import parse_requirements
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
# parse_requirements() returns generator of pip.req.InstallRequirement objects
install_reqs = parse_requirements("requirements.txt")
# reqs is a list of requirement
reqs = [str(ir.... | ResilientScience/wot | setup.py | Python | bsd-2-clause | 720 |
from __future__ import print_function
import functools
_modes = ["push", "pull"]
_types = set((
"event", "exception",
"int", "float", "bool", "str",
"mstr", "id",
"object",
"block", "blockcontrol", "blockmodel",
"expression",
"bee",
))
_objecttypes = "object", "mstr", "id", "block", "bloc... | agoose77/hivesystem | bee/types.py | Python | bsd-2-clause | 16,351 |
"""
Declares Model object of a database-server
"""
from afs.model.BaseModel import BaseModel
class DBServer(BaseModel):
"""
Model object of a database-server
"""
def __init__(self):
"""
initialize an empty object.
"""
# declare db-internal attributes
BaseMo... | openafs-contrib/afspy | afs/model/DBServer.py | Python | bsd-2-clause | 971 |
"""The Bundle object is the root object for a bundle, which includes accessors
for partitions, schema, and the filesystem.
Copyright (c) 2015 Civic Knowledge. This file is licensed under the terms of
the Revised BSD License, included in this distribution as LICENSE.txt
"""
import os
import sys
from time import time
... | CivicKnowledge/ambry | ambry/bundle/bundle.py | Python | bsd-2-clause | 100,351 |
from __future__ import division
import math
import itertools
import operator
from .utils import (get_func, aliasing, funcs_no_separate_nan,
aggregate_common_doc, isstr)
# min - builtin
# max - builtin
# sum - builtin
# all - builtin
# any - builtin
def _last(x):
return x[-1]
def _first(x... | ml31415/numpy-groupies | numpy_groupies/aggregate_purepy.py | Python | bsd-2-clause | 4,714 |
from copy import deepcopy
from sqlalchemy import inspect
from sqlalchemy.orm.base import DEFAULT_STATE_ATTR
from sqlalchemy.orm.state import InstanceState
from mongosql.bag import ModelPropertyBags
class ModelHistoryProxy:
""" Proxy object to gain access to historical model attributes.
This leverages SqlAlc... | kolypto/py-mongosql | mongosql/util/history_proxy.py | Python | bsd-2-clause | 5,787 |
"""
This module provides a wrapper around the Helioviewer API.
"""
from __future__ import absolute_import
#pylint: disable=E1101,F0401,W0231
__author__ = ["Keith Hughitt"]
__email__ = "keith.hughitt@nasa.gov"
import os
import urllib
import urllib2
import json
import sunpy
from sunpy.time import parse_time
from sunp... | mjm159/sunpy | sunpy/net/helioviewer.py | Python | bsd-2-clause | 9,598 |
from unittest import TestCase
from pyramid_restful.decorators import list_route, detail_route
class DecoratorTests(TestCase):
def test_list_route(self):
@list_route(methods=['GET'], url_path='my-list-route')
def my_list_route():
pass
assert my_list_route.bind_to_methods == [... | danpoland/pyramid-restful-framework | tests/test_decorartors.py | Python | bsd-2-clause | 768 |
"""
Demo which illustrates how to use solve_bayesopt as a simple method for global
optimization. The return values are the sequence of recommendations made by the
algorithm as well as the final model. The point `xbest[-1]` is the final
recommendation, i.e. the expected maximizer.
"""
from __future__ import division
fr... | mwhoffman/pybo | pybo/demos/solve.py | Python | bsd-2-clause | 1,238 |
from ailment.expression import UnaryOp
from .base import PeepholeOptimizationExprBase
class RemoveRedundantNots(PeepholeOptimizationExprBase):
__slots__ = ()
name = "Remove redundant Nots"
expr_classes = (UnaryOp, ) # all expressions are allowed
def optimize(self, expr: UnaryOp):
# Not(No... | angr/angr | angr/analyses/decompiler/peephole_optimizations/remove_redundant_nots.py | Python | bsd-2-clause | 531 |
import fileinput
import itertools
import subprocess
def insert_line_file(file, new_line, anchor):
insert = False
for line in fileinput.input(file, inplace=1):
if line.startswith(anchor):
insert = True
else:
if insert:
print new_line
insert = ... | alvico/solaris | solaris/helpers.py | Python | bsd-2-clause | 1,048 |
import os
import glob
SOURCE_FILES = glob.glob(os.path.dirname(__file__) + "/*.py")
__all__ = [os.path.basename(f)[: -3] for f in SOURCE_FILES]
__doc__ = """\
Module for advanced plotting based on matplotlib
"""
from .popups import * | Repythory/Libraries | amolf/plotting/__init__.py | Python | bsd-2-clause | 236 |
# -*- coding: UTF-8 -*-
"""
Configure pytest environment.
Add project-specific information.
.. seealso::
* https://github.com/pytest-dev/pytest-html
"""
import behave
import pytest
@pytest.fixture(autouse=True)
def _annotate_environment(request):
"""Add project-specific information to test-run environment:
... | Abdoctor/behave | conftest.py | Python | bsd-2-clause | 703 |
#!/usr/bin/env python
import time
import sys
from pysovo.comms import email
from pysovo.comms.email import keys as acc_keys
from pysovo.local import contacts
import base64
from imbox import Imbox
def make_imbox(account):
imbox = Imbox('imap.gmail.com',
account[acc_keys.username],
... | timstaley/pysovo | integration_tests/readmail_test.py | Python | bsd-2-clause | 1,781 |
#!/usr/bin/env python
#
# Licensed under the BSD license. See full license in LICENSE file.
# http://www.lightshowpi.org/
#
# Author: Ryan Jennings
# Author: Chris Usey
# Author: Todd Giles (todd@lightshowpi.org)
# Author: Tom Enos (tomslick.ca@gmail.com)
"""Control the Raspberry pi hardware.
The hardware controller... | wheeldog515/lightshowPi | py/hardware_controller.py | Python | bsd-2-clause | 30,723 |
from PyPDF2 import PdfFileReader, PdfFileWriter
from rect import Rect
from rect.packer import pack
from reportlab.lib import pagesizes
from reportlab.lib.units import mm
__version__ = "0.1.0"
class PDFPagePacker(object):
def __init__(self, pdf_file, canvas_size=pagesizes.A4, padding=5 * mm):
super(PDFPag... | beyond-content/python-pdf-paper-saver | src/pdfpapersaver/__init__.py | Python | bsd-2-clause | 2,516 |
"""
Define typing templates
"""
from abc import ABC, abstractmethod
import functools
import sys
import inspect
import os.path
from collections import namedtuple
from collections.abc import Sequence
from types import MethodType, FunctionType
import numba
from numba.core import types, utils
from numba.core.errors impor... | sklam/numba | numba/core/typing/templates.py | Python | bsd-2-clause | 43,345 |
# coding: utf-8
"""
This scripts scrapy the use licenses of the scielo documents from the website
and load them into the Articlemeta, this process is necessary because the
legacy databases does not have the licenses persisted for each document.
"""
import re
import os
import sys
import argparse
import logging
import lo... | scieloorg/articles_meta | processing/load_licenses.py | Python | bsd-2-clause | 6,277 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import subprocess
import sys
import unittest
COMMAND_PREFIX = 'gettextmath'
def generate_command_call(name, prefix, *args):
return '\\' + prefix + name + '{' + '}{'.join(args) + '}'
class Parser:
class Token:
function = False
def proce... | mplucinski/tex-gettext | tex_math.py | Python | bsd-2-clause | 15,267 |
import pytest
from .. import aggregate_purepy, aggregate_numpy_ufunc, aggregate_numpy
try:
from .. import aggregate_numba
except ImportError:
aggregate_numba = None
try:
from .. import aggregate_weave
except ImportError:
aggregate_weave = None
try:
from .. import aggregate_pandas
except ImportError... | ml31415/numpy-groupies | numpy_groupies/tests/__init__.py | Python | bsd-2-clause | 2,023 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import ctypes
import cffi
import unittest
from flypy import jit, typeof, NULL
from flypy.types import int32, float64
ffi = cffi.FFI()
arr = ffi.new('int[3]')
arr[0] = 5
arr[1] = 6
p = ffi.cast('int *', arr)
class TestPointers(u... | flypy/flypy | flypy/runtime/obj/tests/test_pointers.py | Python | bsd-2-clause | 2,989 |
import riak
import time
from random import randint
start_time = time.time()
pool = ['10.15.129.215',
'10.15.129.216',
'10.15.129.217',
'10.15.129.218',
'10.15.129.219']
# Connect to Riak.
client = []
for ip in pool:
print ip
c = riak.RiakClient(host=ip)
c = c.bucket('test... | nbari/db-sandbox | riak/cluster_read.py | Python | bsd-3-clause | 597 |
# -*- coding: utf-8 -*-
"""
flask.jsonimpl
~~~~~~~~~~~~~~
Implementation helpers for the JSON support in Flask.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import io
import uuid
from datetime import datetime
from .globals import current_app, request
fro... | Aaron1992/flask | flask/json.py | Python | bsd-3-clause | 8,303 |
"""
The :mod:`sklearn.lda` module implements Linear Discriminant Analysis (LDA).
"""
# Authors: Matthieu Perrot
# Mathieu Blondel
import warnings
import numpy as np
from scipy import linalg
from .base import BaseEstimator, ClassifierMixin, TransformerMixin
from .utils.extmath import logsumexp
from .utils.fi... | mrshu/scikit-learn | sklearn/lda.py | Python | bsd-3-clause | 9,304 |
from guizero import App, PushButton, TextBox
def welcome():
print("Welcome")
def hi():
print("Hi")
def message(my_message):
print(my_message)
def whatever():
# say whatever using the message function, passing the text as an argument
app.after(200, message, args=["Whatever"])
def cancel_hi():
... | lawsie/guizero | examples/after_repeat.py | Python | bsd-3-clause | 629 |
#!/usr/bin/env python
# A simple script for copying bencode.hpp to mettle's include directory. This
# eliminates the need for users to manually download bencode.hpp if they don't
# want to.
import os
import shutil
import tarfile
from io import BytesIO
try:
from urllib.request import urlopen
except ImportError:
... | jimporter/mettle | scripts/vendorize_bencode.py | Python | bsd-3-clause | 1,150 |
#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 2015-2016 California Institute of Technology.
# Copyright (c) 2016-2019 Mike McKerns.
# License: 3-clause BSD.
"""
check environment scipt
"""
import sys
# requirements
has = dict(
# optimization
scipy='0.6.0',... | mmckerns/tutmom | check_env.py | Python | bsd-3-clause | 3,306 |
import click
@click.group(help="Command line interface for trefoil")
def cli():
pass | consbio/clover | trefoil/cli/__init__.py | Python | bsd-3-clause | 90 |
import os
import shutil
import numpy as np
import flopy
from flopy.utils.util_array import Util2d, Util3d, Transient2d
out_dir = "temp"
if os.path.exists(out_dir):
shutil.rmtree(out_dir)
os.mkdir(out_dir)
def test_transient2d():
ml = flopy.modflow.Modflow()
dis = flopy.modflow.ModflowDis(ml, nlay=10, nro... | mrustl/flopy | autotest/t004_test.py | Python | bsd-3-clause | 19,118 |
# -*- coding: utf-8 -*-
"""
lets.processlet
~~~~~~~~~~~~~~~
Maximizing multi-core use in gevent environment.
:class:`Processlet` is a subclass of :class:`gevent.Greenlet` but focuses
to CPU-bound tasks instead of I/O-bound.
Never give up high concurrency gevent offered.
.. sourcecode:: python
... | sublee/lets | lets/processlet.py | Python | bsd-3-clause | 15,632 |
from test_proxyviews import TestProxyViews
import uuid
class TestProxyViewsGenerate(TestProxyViews):
def test_generate_user_nobody(self):
assert(not self.views.generate_user(None, None))
def test_generate_user_ano(self):
user = self.views.generate_user('ano')
assert(user)
a... | ebu/PlugIt | tests/proxy_internal/test_proxyviews_generate.py | Python | bsd-3-clause | 3,938 |
# -*- coding: utf-8 -*-
"""exception_handling.py
Author: Alan D. Snow, 2017
License: BSD 3-Clause
"""
from contextlib import contextmanager
from functools import wraps
import logging
import os
from django.http import HttpResponseBadRequest, HttpResponseServerError
from .app import StreamflowPredictionTool a... | erdc-cm/tethysapp-streamflow_prediction_tool | tethysapp/streamflow_prediction_tool/exception_handling.py | Python | bsd-3-clause | 3,527 |
from datetime import datetime
from django.contrib import messages
from django.http import Http404, HttpResponseRedirect, JsonResponse
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext, ugettext_lazy
from django.views import View
from cou... | dimagi/commcare-hq | corehq/apps/linked_domain/views.py | Python | bsd-3-clause | 22,021 |
import pandas as pd
from unittest.mock import patch
from cartoframes.data.observatory.catalog.entity import CatalogList
from cartoframes.data.observatory.catalog.variable_group import VariableGroup
from cartoframes.data.observatory.catalog.repository.variable_repo import VariableRepository
from cartoframes.data.obser... | CartoDB/cartoframes | tests/unit/data/observatory/catalog/test_variable_group.py | Python | bsd-3-clause | 5,716 |
from event_model import Filler
import event_model
from bluesky.plans import count
import numpy
from ophyd.sim import NumpySeqHandler
def test_fill_event(RE, hw):
docs = []
def callback(name, doc):
docs.append((name, doc))
RE(count([hw.img]), callback)
docs
dask_filler = Filler({'NPY_SEQ... | ericdill/databroker | databroker/tests/test_v2/test_dask_filler.py | Python | bsd-3-clause | 1,490 |
# -*- mode:python -*-
# Copyright (c) 2007 MIPS Technologies, 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 ... | lixt/lily2-gem5 | src/arch/lily2/Lily2System.py | Python | bsd-3-clause | 2,762 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010-2015, 2degrees Limited.
# All Rights Reserved.
#
# This file is part of wsgi-xsendfile <http://pythonhosted.org/xsendfile/>,
# which is subject to the provisions of the BSD at
# <http://dev.2deg... | 2degrees/wsgi-xsendfile | setup.py | Python | bsd-3-clause | 2,005 |
from multiprocessing import Pool, cpu_count
import psutil
from pyiid.adp import has_adp
import numpy as np
from pyiid.experiments.elasticscatter.atomics.cpu_atomics import (
cpu_k_space_fq_allocation, cpu_k_space_fq_adp_allocation, atomic_fq,
get_normalization_array, k_space_dfq_dadp_allocation,
k_space_gra... | CJ-Wright/pyIID | pyiid/experiments/elasticscatter/cpu_wrappers/flat_multi_cpu_wrap.py | Python | bsd-3-clause | 5,576 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import copy
import os
import pickle
import unittest
import warnings
from django.core.exceptions import SuspiciousOperation
from django.core.signals import request_finished
from django.db import close_old_connections
from django.http import (QueryDict, ... | makinacorpus/django | tests/httpwrappers/tests.py | Python | bsd-3-clause | 23,131 |
import os
import peewee
from rivr_peewee import Database
DATABASE_URL = os.environ.get('DATABASE_URL')
if DATABASE_URL and DATABASE_URL.startswith('postgres://'):
DATABASE_URL = DATABASE_URL.replace('postgres://', 'postgres+pool://')
# disable auto connection
EXTRA_OPTIONS = 'autoconnect=false'
if '... | cocodelabs/api.palaverapp.com | palaverapi/models.py | Python | bsd-3-clause | 1,143 |
from .connection import MongoConnection | sopython/kesh | kesh/api/__init__.py | Python | bsd-3-clause | 39 |
# -*- coding: utf-8 -*-
"""
Class for reading data from pCLAMP and AxoScope
files (.abf version 1 and 2), developed by Molecular device/Axon technologies.
- abf = Axon binary file
- atf is a text file based format from axon that could be
read by AsciiIO (but this file is less efficient.)
This code is a... | SummitKwan/python-neo | neo/io/axonio.py | Python | bsd-3-clause | 33,046 |
from django import template
from django.conf import settings
from django.contrib.sites.models import Site
from django.utils.functional import curry
from django.utils.encoding import force_unicode
register = template.Library()
class ContextSetterNode(template.Node):
def __init__(self, var_name, var_value):
... | vhf/django-disqus | disqus/templatetags/disqus_tags.py | Python | bsd-3-clause | 4,607 |
from unittest import TestCase
import re
from scrapy.http import Response, Request
from scrapy.spider import Spider
from scrapy.contrib.downloadermiddleware.cookies import CookiesMiddleware
class CookiesMiddlewareTest(TestCase):
def assertCookieValEqual(self, first, second, msg=None):
cookievaleq = lambd... | scrapinghub/scrapy | tests/test_downloadermiddleware_cookies.py | Python | bsd-3-clause | 6,842 |
from modeltranslation.translator import translator, TranslationOptions
from contact_form.models import Subject
class SubjectTranslationOptions(TranslationOptions):
fields = ('title', 'description')
fallback_languages = {'default': ('en',)}
translator.register(Subject, SubjectTranslationOptions)
| dlancer/django-crispy-contact-form | contact_form/translation.py | Python | bsd-3-clause | 308 |
"""
HTTP server that implements the Python WSGI protocol (PEP 333, rev 1.21).
Based on wsgiref.simple_server which is part of the standard library since 2.5.
This is a simple server for use in testing or debugging Django apps. It hasn't
been reviewed for security issues. DON'T USE IT FOR PRODUCTION USE!
"""
from __f... | bretlowery/snakr | lib/django/core/servers/basehttp.py | Python | bsd-3-clause | 7,315 |
#!/usr/bin/env python
from __future__ import print_function
"""
an example of using the multigrid class to solve Poisson's equation via
smoothing only. Here, we solve
u_xx = sin(x)
u = 0 on the boundary [0,1]
The analytic solution is u(x) = -sin(x) + x sin(1)
M. Zingale
"""
import numpy as np
import multigrid
i... | zingale/hydro_examples | multigrid/smooth.py | Python | bsd-3-clause | 2,935 |
"""
6. Specifying ordering
Specify default ordering for a model using the ``ordering`` attribute, which
should be a list or tuple of field names. This tells Django how to order
``QuerySet`` results.
If a field name in ``ordering`` starts with a hyphen, that field will be
ordered in descending order. Otherwise, it'll ... | hugs/django | tests/modeltests/ordering/models.py | Python | bsd-3-clause | 3,031 |
"""Command Line Interface"""
import os
import re
import codecs
import logging
from holland.core.exceptions import BackupError
from holland.lib.compression import open_stream, lookup_compression
from holland.lib.mysql import MySQLSchema, connect, MySQLError
from holland.lib.mysql import include_glob, exclude_glob, \
... | m00dawg/holland | plugins/holland.backup.mysqldump/holland/backup/mysqldump/plugin.py | Python | bsd-3-clause | 21,830 |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# 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... | threefoldfoundation/app_backend | plugins/tff_backend/api/rogerthat/documents.py | Python | bsd-3-clause | 3,285 |
import mimetypes
import os.path
from django.core.files.storage import default_storage
from django.template.defaultfilters import slugify
def slugify_filename(filename):
u""" Slugify filename """
name, ext = os.path.splitext(filename)
return slugify(name) + ext
def get_thumb_filename(file_name):
"""... | makinacorpus/django-ckeditor | ckeditor/utils.py | Python | bsd-3-clause | 699 |
# -*- coding: utf-8 -*-
import re
import unicodedata
# FIXME: these patterns works for English/Chinese mixed content, but not tested among other languages
WORD_COUNT_SPLIT_PATTERN = re.compile(u'[\s\u4e00-\u9fff]')
ASIAN_CHAR_PATTERN = re.compile(u'[\u4e00-\u9fff]')
ENDING_CHAR_CATEGORIES = ('Po', 'Cc', 'Zs')
def w... | yshlin/tildeslash | tildeslash/blog/utils.py | Python | bsd-3-clause | 787 |
# -*- coding: utf-8 -*-
"""View model for clustered data."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import os.path as op
import numpy as np
from six import string_types
from ...io.kwik... | nsteinme/phy | phy/cluster/manual/view_models.py | Python | bsd-3-clause | 37,793 |
# -*- coding: utf-8 -*-
# simple prepopulated tables querier -- input parser
from __future__ import unicode_literals, division
INPUT_ENCODING = 'utf-8'
FIELDS = ('name', 'gender', 'phone', 'role', 'ident', )
def parse_line(ln):
lst = ln.split('$')
# may silently eat some items... maybe
return lst[0], di... | team-xue/xue | xue/prepopulate/parse.py | Python | bsd-3-clause | 718 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 mjirik <mjirik@mjirik-Latitude-E6520>
#
# Distributed under terms of the MIT license.
"""
"""
import numpy as np
from loguru import logger
# logger = logging.getLogger()
import argparse
from scipy import ndimage
from . import qmisc... | mjirik/lisa | lisa/shape_model.py | Python | bsd-3-clause | 8,801 |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, include, url
from .views import *
urlpatterns = patterns('',
url(r'^$', QuestionsListView.as_view(), name='questions'),
url(r'^create/$', QuestionsCreateView.as_view(), name='questions-create'),
url(r'^(?P<qslug>[\w\d\-]+)/view/$', Q... | niwinz/Green-Mine | src/greenmine/questions/urls.py | Python | bsd-3-clause | 564 |
#!/usr/bin/env python
# Thomas Nagy, 2005-2013
# Modifications by Hans-Martin von Gaudecker for econ-project-templates
"""
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the ab... | RoyalTS/econ-python-environment | waf.py | Python | bsd-3-clause | 1,785 |
from south.db import db
from django.db import models
from ietf.idtracker.models import *
class Migration:
def forwards(self, orm):
# Changing field 'InternetDraft.shepherd'
# (to signature: django.db.models.fields.related.ForeignKey(to=orm['idtracker.PersonOrOrgInfo'], null=True, bla... | mcr/ietfdb | ietf/idtracker/migrations/0003_internet_draft_shepred_fk_blank_true.py | Python | bsd-3-clause | 37,706 |
###############################################################################
##
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary forms, with or without
## modification, ... | CMUSV-VisTrails/WorkflowRecommendation | vistrails/packages/pythonCalcQt/__init__.py | Python | bsd-3-clause | 2,396 |
from copy import deepcopy
from functools import reduce, singledispatch, wraps
from codecs import decode
from inspect import signature, Parameter
from typing import Any, Collection, Union, Mapping, MutableMapping, Optional
from warnings import warn
import h5py
from scipy.sparse import spmatrix
import numpy as np
import... | theislab/anndata | anndata/compat/__init__.py | Python | bsd-3-clause | 10,424 |
from __future__ import absolute_import
import shutil
from sympy.external import import_module
from sympy.utilities.pytest import skip
from sympy.utilities._compilation.compilation import compile_link_import_strings
numpy = import_module('numpy')
cython = import_module('cython')
_sources1 = [
('sigmoid.c', r"""
... | kaushik94/sympy | sympy/utilities/_compilation/tests/test_compilation.py | Python | bsd-3-clause | 1,775 |
"""
Normalize Array
~~~~~~~~~~~~~~~
This example will demonstrate how to perform a normalization or any custom
mathematical operation on a single data array for an input data set.
This filter allow the user to select an array from the input data set to be
normalized. The filter will append another array to that data ... | banesullivan/ParaViewGeophysics | examples/filters-general/normalize-array.py | Python | bsd-3-clause | 1,235 |
__doc__ = r"""
This module implements the SPARQL 1.1 Property path operators, as
defined in:
http://www.w3.org/TR/sparql11-query/#propertypaths
In SPARQL the syntax is as follows:
+--------------------+-------------------------------------------------+
|Syntax | Matches ... | RDFLib/rdflib | rdflib/paths.py | Python | bsd-3-clause | 16,568 |
# Django settings for example_project project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add '... | caspyyy/SCRAPY_DDS | example_project/example_project/settings.py | Python | bsd-3-clause | 5,820 |
# encoding: latin2
"""
Distance functions from an area to a region
"""
__author__ = "Juan C. Duque"
__credits__ = "Copyright (c) 2009-11 Juan C. Duque"
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "RiSE Group"
__email__ = "contacto@rise-group.org"
import numpy
import distanceFunctions
de... | tectronics/clusterpy | clusterpy/core/toolboxes/cluster/componentsAlg/dist2Regions.py | Python | bsd-3-clause | 1,076 |
from django.test import TestCase
from srl.services.parse import numtosxg, sxgtonum
from srl.management.commands.create_fake_users import create_fake_users
from srl.views import get_random_user
from django.contrib.auth.models import User
class TestBaseConversion(TestCase):
def test_check0(self):
assert num... | jms/potential-bassoon | srl/tests.py | Python | bsd-3-clause | 1,507 |
__version__ = version = '0.0.1'
from pyportfolio.models import Equity, Option, Future, Account, Trade, Commodity, Index, Currency
| davidastephens/pyportfolio | pyportfolio/__init__.py | Python | bsd-3-clause | 131 |
# -*- coding: utf-8 -*-
import 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 'Category.description'
db.add_column('submissions_category', 'description',
... | mozilla/gameon | gameon/submissions/migrations/0005_auto__add_field_category_description.py | Python | bsd-3-clause | 6,583 |
from django.test import SimpleTestCase
from corehq.apps.tzmigration.api import phone_timezones_should_be_processed
from corehq.apps.tzmigration.test_utils import \
run_pre_and_post_timezone_migration
from corehq.form_processor.utils import adjust_datetimes
class AdjustDatetimesTest(SimpleTestCase):
def test_... | qedsoftware/commcare-hq | corehq/form_processor/tests/test_adjust_datetimes.py | Python | bsd-3-clause | 1,377 |
import json
from nose.tools import eq_
from pyquery import PyQuery as pq
import amo
import amo.tests
from amo.urlresolvers import reverse
from addons.models import Addon
from compat.models import CompatReport, CompatTotals
# This is the structure sent to /compatibility/incoming from the ACR.
incoming_data = {
'... | SuriyaaKudoIsc/olympia | apps/compat/tests.py | Python | bsd-3-clause | 9,967 |
import unittest
from webtest import TestApp
import test_helper
class ErrorsControllerTests(unittest.TestCase):
def test_error_404(self):
app = TestApp(test_helper.get_app())
assert app.get('/error/404').status == '200 OK'
def test_error_500(self):
app = TestApp(test_helper.get_app()... | Rolinh/pydeo | pydeo/test/functional/errors_controller_test.py | Python | bsd-3-clause | 378 |
import logging, openravepy, prpy
from prpy.action import ActionMethod
from prpy.planning.base import PlanningError
from contextlib import contextmanager
logger = logging.getLogger('herbpy')
@ActionMethod
def Grasp(robot, obj, manip=None, preshape=[0., 0., 0., 0.],
tsrlist=None, render=True, **kw_args):
... | mharding01/herbpy | src/herbpy/action/grasping.py | Python | bsd-3-clause | 9,013 |
"""
Module to set up run time parameters for Clawpack -- classic code.
The values set in the function setrun are then written out to data files
that will be read in by the Fortran code.
"""
import os
import numpy as np
#------------------------------
def setrun(claw_pkg='classic'):
#---------------------------... | amath574w2015/am574-class | labs/lab4/chap6/compareadv/setrun.py | Python | bsd-3-clause | 7,172 |
"""
Tests for game_theory/random.py
"""
import numpy as np
from numpy.testing import assert_allclose, assert_raises
from nose.tools import eq_, ok_
from quantecon.game_theory import (
random_game, covariance_game, random_pure_actions, random_mixed_actions
)
def test_random_game():
nums_actions = (2, 3, 4)
... | oyamad/QuantEcon.py | quantecon/game_theory/tests/test_random.py | Python | bsd-3-clause | 2,411 |
# -*- coding: utf-8 -*-
from framework.gui.common.basepage import BasePage
from framework.gui.common.locators import HOMEPAGE
from framework.gui.common.tools import wait_for_page_load, page_contain_assert
from selenium.webdriver.common.keys import Keys
# from selenium.webdriver.support import expected_conditions as ... | AButenko/selenium_tests | framework/gui/loginpage.py | Python | bsd-3-clause | 1,961 |
"""
WSGI config for osm-export-tool2 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJA... | dodobas/osm-export-tool2 | core/wsgi.py | Python | bsd-3-clause | 402 |
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_alm... | DonBeo/scikit-learn | sklearn/covariance/tests/test_covariance.py | Python | bsd-3-clause | 10,594 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 30, transform = "RelativeDifference", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_PolyTrend/cycle_30/ar_/test_artificial_32_RelativeDifference_PolyTrend_30__20.py | Python | bsd-3-clause | 273 |
# -*- coding: utf-8 -*-
"""test_replay."""
import os
import pytest
from cookiecutter import replay, main, exceptions
def test_get_replay_file_name():
"""Make sure that replay.get_file_name generates a valid json file path."""
exp_replay_file_name = os.path.join('foo', 'bar.json')
assert replay.get_file... | luzfcb/cookiecutter | tests/replay/test_replay.py | Python | bsd-3-clause | 2,207 |
"""
simplesim_fsm.py
By Ryan Lam
Defines the Finite State Machine (Flying Spaghetti Monster) controller element
for the datapath.
"""
from simplesim_elements import Element, bits_required
from constants import State, Flags, ALUSelA, ALUSelB, ALUOp, Op
class Controller(Element):
def __init__(self,
... | darthryking/simpleisa | simplesim_fsm.py | Python | bsd-3-clause | 28,564 |
#
# Collective Knowledge (Base soft templates to be reused via inheritance mechanism)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
##
# Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net
#
cfg = {} # Will be updated by CK (meta description of this mod... | ctuning/ck | ck/repo/module/soft.template/module.py | Python | bsd-3-clause | 826 |
'''
Created on Nov 08, 2013
@author: philipkershaw
'''
from os import path
import unittest
import logging
log = logging.getLogger(__name__)
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.DEBUG)
from libcloud import security
from libcloud.compute.types import Provider
from libcloud.compute.provide... | cedadev/cloudhands-ops | functional/cloudclient/aws/test_aws_client.py | Python | bsd-3-clause | 1,689 |
"""
Parse spotify URLs
"""
from __future__ import unicode_literals
import re
import logging
log = logging.getLogger('spotify')
def handle_privmsg(bot, user, channel, args):
"""Grab Spotify URLs from the messages and handle them"""
m = re.match(".*(http:\/\/open.spotify.com\/|spotify:)(?P<item>album|artist|... | EArmour/pyfibot | pyfibot/modules/module_spotify.py | Python | bsd-3-clause | 1,777 |
#!/usr/bin/env python
# Copyright (C) 2013 Intel Corporation. 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, thi... | was4444/chromium.src | third_party/WebKit/Source/build/scripts/make_style_shorthands.py | Python | bsd-3-clause | 3,202 |
import sys
import numpy as np
import mne
from mne.minimum_norm import read_inverse_operator, apply_inverse_epochs
from my_settings import (mne_folder, epochs_folder, source_folder, conditions)
subject = sys.argv[1]
method = "dSPM"
snr = 3.
lambda2 = 1. / snr**2
# labels = mne.read_labels_from_annot(
# subject=s... | MadsJensen/RP_scripts | extract_ts_epochs.py | Python | bsd-3-clause | 1,400 |
# -*- coding: utf-8 -*-
#
# mfp documentation build configuration file, created by
# sphinx-quickstart.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a def... | levental/visualizer | docs/conf.py | Python | bsd-3-clause | 7,793 |
import zipfile
from stat import S_IRUSR, S_IRGRP, S_IWUSR
import netCDF4
import numpy as np
import os.path
import rasterio
import tempfile
from django.conf import settings
from io import BytesIO
from django.template.loader import render_to_string
from django.utils.translation import activate
from ncdjango.geoprocessi... | consbio/seedsource-core | seedsource_core/django/seedsource/tasks/write_tif.py | Python | bsd-3-clause | 2,684 |
import pytz
from django.conf import settings
from django.utils.dates import MONTHS, WEEKDAYS, WEEKDAYS_ABBR
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy
# Wagtail languages with >=90% coverage
# This list is manually maintained
WAGTAILADMIN_PROVIDED_LANGUAGES = ... | kaedroho/wagtail | wagtail/admin/localization.py | Python | bsd-3-clause | 3,698 |
"""
desisim.pixsim
==============
Tools for DESI pixel level simulations using specter
"""
from __future__ import absolute_import, division, print_function
import sys
import os
import os.path
import random
from time import asctime
import socket
import astropy.units as u
import numpy as np
import desimodel.io
impo... | desihub/desisim | py/desisim/pixsim.py | Python | bsd-3-clause | 30,517 |
#!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Evaluate the perplexity of a trained language model.
"""
import logging
import math
import os
import torch
fr... | hfp/libxsmm | samples/deeplearning/sparse_training/fairseq/fairseq_cli/eval_lm.py | Python | bsd-3-clause | 8,725 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import uuid
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
('invite', '0001_initial'),
]
operations = [
migrations.DeleteModel('PasswordRe... | unt-libraries/django-invite | invite/migrations/0002_abstract_invitation.py | Python | bsd-3-clause | 1,634 |
# -*- coding: utf8 -*-
"""Cache module for libcrowds-statistics."""
import operator
import pygeoip
import re
from collections import defaultdict
from sqlalchemy.sql import text
from flask import current_app
from pybossa.core import db
from pybossa.cache import cache, memoize, ONE_HOUR
session = db.slave_session
@ca... | LibCrowds/libcrowds-statistics | libcrowds_statistics/cache.py | Python | bsd-3-clause | 14,408 |
from django.contrib import admin
from nonprofit.mailroom.models import Slot
class SlotAdmin(admin.ModelAdmin):
list_display = ('description','forward_to','enabled')
admin.site.register(Slot, SlotAdmin) | sunlightlabs/django-nonprofit | nonprofit/mailroom/admin.py | Python | bsd-3-clause | 207 |
# -*- coding: utf-8 -*-
"""Forms for medical history."""
import datetime
import os
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse... | carthagecollege/django-djsani | djsani/medical_history/waivers/views.py | Python | bsd-3-clause | 3,562 |
import re
from bisect import bisect
from django.conf import settings
from django.db.models.related import RelatedObject
from django.db.models.fields.related import ManyToManyRel
from django.db.models.fields import AutoField, FieldDoesNotExist
from django.db.models.fields.proxy import OrderWrt
from django.db.models.loa... | vsajip/django | django/db/models/options.py | Python | bsd-3-clause | 21,628 |
# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved.
#
# This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA.
#
# SIPPY is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... | hgascon/pulsar | pulsar/core/sippy/SipCCDiversion.py | Python | bsd-3-clause | 1,314 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..featuredetection import DumpBinaryTrainingVectors
def test_DumpBinaryTrainingVectors_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_ex... | mick-d/nipype | nipype/interfaces/semtools/filtering/tests/test_auto_DumpBinaryTrainingVectors.py | Python | bsd-3-clause | 1,115 |
import autoargs
def main(arg1: int, arg2: int, *, val=10, val2:int):
"""my docstring"""
return arg1 + arg2 + val + val2
def example(a, b: int, *others, d: float, e=10):
"""Here is my docstring"""
return str(locals())
import numpy
@cmdable
def f2(x: int, y: int, *z: int, op: {'sum', 'mul'}='mul'):
... | metaperture/autoargs | examples/usage.py | Python | bsd-3-clause | 857 |