code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# coding:utf-8
# 函数式编程
def add(a, b):
return a + b
def fprintf(fmt, *args):
"""args is tuple"""
print fmt % args
print "{0:s}".format("ljinshuan")
fprintf("%s,%d,%s", "xxx", 1, "gerg")
def fprintf(fmt, **args):
"""args is map"""
print args
fprintf("{name} ,{age}", name="ljinshuan", age=10)
... | ljinshuan/LearningPython | base/Chapter6.py | Python | apache-2.0 | 1,591 |
# Copyright 2015-2017 ProfitBricks GmbH
#
# 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 agreed to i... | StackPointCloud/profitbricks-sdk-python | tests/test_errors.py | Python | apache-2.0 | 2,455 |
"""Auto-generated file, do not edit by hand. NZ metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_NZ = PhoneMetadata(id='NZ', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='[14]\\d{2,3}', possible_length=(3, 4)),... | gencer/python-phonenumbers | python/phonenumbers/shortdata/region_NZ.py | Python | apache-2.0 | 673 |
# Copyright 2013-2014 MongoDB, 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 or agreed to in writin... | agolo/mongo-connector | tests/test_mongo.py | Python | apache-2.0 | 8,734 |
def test_image_export_reference(exporters, state, bpy_image_default, gltf_image_default):
state['settings']['images_data_storage'] = 'REFERENCE'
gltf_image_default['uri'] = '../filepath.png'
output = exporters.ImageExporter.export(state, bpy_image_default)
assert output == gltf_image_default
def test_... | Kupoman/blendergltf | tests/unit/test_image.py | Python | apache-2.0 | 2,570 |
# -*- coding: utf-8 -*-
"""
Common design parameters for minimum order design methods
@author: Christian Muenker
"""
from __future__ import print_function, division, unicode_literals
#from importlib import import_module
#import filterbroker as fb
class min_order_common(object):
def __init__(self):
... | honahursey/pyFDA | work/min_order_common.py | Python | apache-2.0 | 1,902 |
import re
from django import forms
from django.core.urlresolvers import reverse
from django.contrib.formtools.wizard import FormWizard
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.utils.translation import ugettext_lazy as _
from google.appengine.ext.db impor... | devsar/ae-people | apps/users/forms.py | Python | apache-2.0 | 6,966 |
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
# Copyright 2017 IBM RESEARCH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licen... | atilag/qiskit-sdk-py | qiskit/extensions/qasm_simulator_cpp/snapshot.py | Python | apache-2.0 | 2,505 |
import datetime
from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from six import print_
import bigbro
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--store',
dest=... | mikepii/retail_store_foot_traffic_monitor | tracking/management/commands/checkin.py | Python | apache-2.0 | 1,191 |
'''
Created on May 6, 2014
@author: cmills
The idea here is to provide client-side functions to interact with the TASR
repo. We use the requests package here. We provide both stand-alone functions
and a class with methods. The class is easier if you are using non-default
values for the host or port.
'''
import re... | ifwe/tasr | src/py/tasr/client_legacy.py | Python | apache-2.0 | 8,458 |
from app import app
from flask import render_template
@app.route('/')
def index():
return render_template('index.html')
@app.route('/story/')
def story():
return render_template('story.html')
@app.route('/bio/')
def bio():
return render_template('bio.html')
@app.route('/contact/')
def contact():
return render_t... | jacburge/wewillremember | app/views.py | Python | apache-2.0 | 610 |
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | tombstone/models | research/object_detection/meta_architectures/context_rcnn_lib.py | Python | apache-2.0 | 8,672 |
# coding=utf-8
# Copyright 2022 The Trax Authors.
#
# 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 a... | google/trax | trax/shapes_test.py | Python | apache-2.0 | 2,632 |
"""Auto-generated file, do not edit by hand. IS metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_IS = PhoneMetadata(id='IS', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='1\\d{2,5}', possible_length=(3, 4, 6)),... | gencer/python-phonenumbers | python/phonenumbers/shortdata/region_IS.py | Python | apache-2.0 | 1,126 |
# -*- coding: utf-8 -*-
# Lumina User Guide documentation build configuration file.
# All configuration values have a default; values that are commented out
# serve to show the default.
import os
import six
import string
import sys
import time
# If extensions (or modules to document with autodoc) are in another direc... | a-stjohn/lumina-docs | conf.py | Python | bsd-2-clause | 13,283 |
#!/usr/bin/env python
# coding: utf-8
#
# License: BSD; see LICENSE for more details.
from pygments.lexer import RegexLexer, include, bygroups
import pygments.token as t
class SnortLexer(RegexLexer):
name = 'Snort'
aliases = ['snort', 'hog']
filenames = ['*.rules']
tokens = {
'root': [
... | yaunj/hogments | hogments/hog.py | Python | bsd-2-clause | 4,940 |
"""
Utilities for parseing SExtractor files.
H. Ferguson - revised 4/23/03 to promote ints to floats if a value
with a decimal point appears somewhere in the column originally thought
to be integers
version::
v2.1 - fails gracefully when the catalog has no sources
v3.0 - added gettypes to return column types... | sniemi/SamPy | smnIO/sextutils.py | Python | bsd-2-clause | 15,984 |
#
# run all the regression tests
#
# [or, you can request specific ones by giving their names on the command line]
#
import sys
import compile
import os
import subprocess
import context
def run_test (cmd, *args):
cmd = PJ ('tests', cmd)
p = subprocess.Popen ([cmd] + list(args), stdout=subprocess.PIPE)
out... | samrushing/irken-compiler | util/run_tests_py.py | Python | bsd-2-clause | 4,100 |
"""
Basic framework for acquiring a roach measurement that includes both sweep(s) and stream(s).
Acquire
-Initialize equipment.
-Initialize roach: preload frequencies, if necessary.
-Create state dictionary containing state from all equipment, including temperatures, if possible.
-Run a coarse sweep, if necessary: cre... | ColumbiaCMB/kid_readout | kid_readout/measurement/acquire.py | Python | bsd-2-clause | 9,283 |
import os
from flask import Flask, request, render_template
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.debug = True
app.threaded = True
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL', 'sqlite:////tmp/test.db')
db = SQLAlchemy(app)
class Email(db.Model):
id = db... | mjtamlyn/oxford-team | old-flask/app.py | Python | bsd-2-clause | 767 |
# Author: Leland McInnes <leland.mcinnes@gmail.com>
# Enough simple sparse operations in numba to enable sparse UMAP
#
# License: BSD 3 clause
from __future__ import print_function
import locale
import numpy as np
import numba
from pynndescent.utils import (
tau_rand_int,
make_heap,
new_build_candidates,
... | lmcinnes/pynndescent | pynndescent/sparse_nndescent.py | Python | bsd-2-clause | 10,204 |
#!/usr/bin/python
import sys
import osxdaemons
COL_RED = "\033[91m"
COL_GRN = "\033[92m"
COL_END = "\033[0m"
load_actions = ["up", "on", "load", "start"]
unload_actions = ["down", "off", "unload", "stop"]
ACTIONS = {act:"load" for act in load_actions}
ACTIONS.update({act:"unload" for act in unload_actions})
def u... | ZachAnders/MPServices | mpservices.py | Python | bsd-2-clause | 1,761 |
#! /usr/bin/env python
from peyotl.api import OTI
from peyotl.test.support.pathmap import get_test_ot_service_domains
from peyotl.utility import get_logger
import unittest
import os
_LOG = get_logger(__name__)
@unittest.skipIf('RUN_WEB_SERVICE_TESTS' not in os.environ,
'RUN_WEB_SERVICE_TESTS is not in ... | rvosa/peyotl | peyotl/test/test_oti.py | Python | bsd-2-clause | 2,232 |
from setuptools import setup, find_packages
import sys, os
setup(name='nanoweb',
version="1.0",
description="The nano web framework",
long_description="""\
The nano framework provides some glue for Webob and Routes.""",
classifiers=[],
keywords='WSGI',
author='Eric Moritz',
au... | ericmoritz/nanoweb | setup.py | Python | bsd-2-clause | 774 |
#!/usr/bin/python
"""nrvr.util.ipaddress - Utilities regarding IP addresses
Class provided by this module is IPAddress.
Works in Linux and Windows.
Idea and first implementation - Leo Baschy <srguiwiz12 AT nrvr DOT com>
Contributor - Nora Baschy
Public repository - https://github.com/srguiwiz/nrvr-commander
Copy... | srguiwiz/nrvr-commander | src/nrvr/util/ipaddress.py | Python | bsd-2-clause | 7,449 |
from ..errors import ErrorFolderNotFound, ErrorInvalidOperation, ErrorNoPublicFolderReplicaAvailable
from ..util import MNS, create_element
from .common import EWSAccountService, folder_ids_element, parse_folder_elem, shape_element
class GetFolder(EWSAccountService):
"""MSDN: https://docs.microsoft.com/en-us/exch... | ecederstrand/exchangelib | exchangelib/services/get_folder.py | Python | bsd-2-clause | 2,503 |
"""Base settings shared by all environments.
This is a reusable basic settings file.
"""
from django.conf.global_settings import *
import os
import sys
import re
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
TIME_ZONE = 'GB'
USE_TZ = True
US... | seddonym/bobsleigh-seddonym | bobsleigh_seddonym/settings/base.py | Python | bsd-2-clause | 2,877 |
"""
Application for testing syncing algorithm
(c) 2013-2014 by Mega Limited, Wellsford, New Zealand
This file is part of the MEGA SDK - Client Access Engine.
Applications using the MEGA API must present a valid application key
and comply with the the rules set forth in the Terms of Service.
The MEGA SDK is di... | wizzard/sdk | tests/sync_test_megacli.py | Python | bsd-2-clause | 5,819 |
from __future__ import print_function, absolute_import
import weakref
class PDroneCreator(object):
def __init__(self, mainwindow, clipboard, title="drones"):
self._mainwindow = mainwindow
self._clipboard = clipboard
self._subwin = mainwindow.newSubWindow(title)
from . import PTree... | agoose77/hivesystem | hiveguilib/PGui/PDroneCreator.py | Python | bsd-2-clause | 807 |
#!/usr/bin/env python
import os
from setuptools import setup
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
return f.read()
setup(name='django-darkknight',
version='0.9.0',
license="BSD",
description="He's a silent guardian, a watchful protector",
... | fusionbox/django-darkknight | setup.py | Python | bsd-2-clause | 1,503 |
#!/usr/bin/env python
"""Dictionary-based password generator.
Usage: pass.py [options]
Options:
-h --help Show this help text
-d --dictionary=<path> Specify a non-default dictionary
-n --length=N Specify number of words to use [default: 4]
-v --verbose Print entropy estimat... | drakedevel/pass | passgen/__init__.py | Python | bsd-2-clause | 2,565 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
PATH = os.path.dirname(os.path.abspath(__file__))
| damonchen/chan | chan/core/templates/config.py | Python | bsd-2-clause | 109 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_hyperlink15.py | Python | bsd-2-clause | 1,235 |
"""
ROC Analysis Widget
-------------------
"""
import operator
from functools import reduce, wraps
from collections import namedtuple, deque
import numpy
import sklearn.metrics as skl_metrics
from PyQt4 import QtGui
from PyQt4.QtGui import QColor, QPen, QBrush
from PyQt4.QtCore import Qt
import pyqtgraph as pg
impo... | qusp/orange3 | Orange/widgets/evaluate/owrocanalysis.py | Python | bsd-2-clause | 27,533 |
'''
Created on 21.04.2015
@author: marscher
'''
from __future__ import absolute_import
"""Miscellaneous classes/functions/etc."""
import os
import struct
import ctypes
if os.name != 'nt':
import fcntl
import termios
else:
import ctypes.wintypes
DEFAULT_TERMINAL_WIDTH = None
class _WindowsCSBI(object)... | trendelkampschroer/PyEMMA | pyemma/_base/progress/bar/misc.py | Python | bsd-2-clause | 5,371 |
#!/usr/bin/env python
import functools
import itertools
import contextlib
import weakref
import logging
l = logging.getLogger("angr.sim_state")
import claripy
import ana
from archinfo import arch_from_id
from .misc.ux import deprecated
def arch_overrideable(f):
@functools.wraps(f)
def wrapped_f(self, *args,... | f-prettyland/angr | angr/sim_state.py | Python | bsd-2-clause | 30,608 |
import calendar
from django.template import Library
from molo.core.templatetags.core_tags import load_sections
from molo.profiles.models import UserProfilesSettings
from nurseconnect.utils import get_survey_results_for_user
register = Library()
@register.filter('fieldtype')
def fieldtype(field):
return field.... | praekelt/nurseconnect | nurseconnect/templatetags/nurseconnect_tags.py | Python | bsd-2-clause | 2,516 |
#!/usr/bin/env python
# encoding: utf-8
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="cubehelix",
version="0.1.0",
author="James Davenport",
# author_email="",
description="Cubehelix colormaps for matp... | jradavenport/cubehelix | setup.py | Python | bsd-2-clause | 605 |
import unittest
from petsc4py import PETSc
# --------------------------------------------------------------------
class TestVersion(unittest.TestCase):
def testGetVersion(self):
version = PETSc.Sys.getVersion()
self.assertTrue(version > (0, 0, 0))
v, patch = PETSc.Sys.getVersion(patch=Tru... | zonca/petsc4py | test/test_sys.py | Python | bsd-2-clause | 1,904 |
#! /usr/bin/env python
# ______________________________________________________________________
'''test_filter2d
Test the filter2d() example from the PyCon'12 slide deck.
'''
# ______________________________________________________________________
import numpy
from numba import *
from numba.decorators import jit
im... | shiquanwang/numba | numba/tests/test_filter2d.py | Python | bsd-2-clause | 1,782 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 ASMlover. 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
# ... | ASMlover/study | zeroMQ/python/push-pull/sinker.py | Python | bsd-2-clause | 1,726 |
from tastypie.authentication import ApiKeyAuthentication
from tastypie.authorization import Authorization
from tastypie.resources import NamespacedModelResource, fields, ALL, ALL_WITH_RELATIONS
from django.contrib.auth.models import User #BUG: Import the correct user object from settings.py
from .models import Inciden... | darkpixel/statuspage | status/api.py | Python | bsd-3-clause | 1,878 |
# -*- coding: utf-8 -*-
from gensim.models import word2vec
from gensim import models
import jieba
import codecs
import io
from collections import Counter
import operator
import numpy
f = codecs.open("target_article.txt",'r','utf8')
content = f.readlines()
article = []
jieba.set_dictionary('jieba_dict/dict.txt.big')... | chunchih/article-matching | experiment/find_key_relation.py | Python | bsd-3-clause | 2,408 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.main
-----------------
Main entry point for the `cookiecutter` command.
The code in this module is also a good example of how to use Cookiecutter as a
library rather than a script.
"""
from __future__ import unicode_literals
import logging
import os
fro... | jhermann/cookiecutter | cookiecutter/main.py | Python | bsd-3-clause | 3,903 |
# -*- coding: utf-8 -*-
from decouple import config
from mongrey.web.settings import Test as BaseTest
class Test(BaseTest):
DB_SETTINGS = {
'host': config('MONGREY_DB', 'sqlite:///../mongrey_test.db'),
}
| radical-software/mongrey | mongrey/tests/storage/sql/flask_settings.py | Python | bsd-3-clause | 233 |
# Copyright 2021 Google LLC.
#
# 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 above copyright notice,
# this list of conditions and the following disclaimer.
#
#... | google/deepvariant | deepvariant/multisample_make_examples.py | Python | bsd-3-clause | 9,287 |
from django.test import TestCase
from django.conf import settings
from django.contrib.sites.models import Site
from django.db.models.query import QuerySet
from preferences import preferences
from music.models import TrackContributor, Credit, Track, Album, CreditOption
from music.utils import wikipedia, lastfm
class... | praekelt/jmbo-music | music/tests/__init__.py | Python | bsd-3-clause | 3,379 |
from django.conf import settings
def mask_toggle(number_to_mask_or_unmask):
return int(number_to_mask_or_unmask) ^ settings.MASKING_KEY | shafiquejamal/socialassistanceregistry | nr/nr/formulas.py | Python | bsd-3-clause | 137 |
# -*- coding: utf-8 -*-
"""SIP Flask Master Device package."""
import logging
__subsystem__ = 'TangoControl'
__service_name__ = 'FlaskMaster'
__version_info__ = (1, 3, 0)
__version__ = '.'.join(map(str, __version_info__))
__service_id__ = ':'.join(map(str, (__subsystem__,
__service_n... | SKA-ScienceDataProcessor/integration-prototype | sip/tango_control/flask_master/app/release.py | Python | bsd-3-clause | 535 |
#!/usr/bin/env python3
"""Read migrated cache file."""
import argparse
import logging
import sys
import rss2irc
def main():
"""Try to read given cache file."""
args = parse_args()
logger = logging.getLogger('read-migrated-cache')
cache = rss2irc.read_cache(logger, args.cache)
assert isinstance(ca... | zstyblik/rss2irc | migrations/tests/files/read_migrated_cache.py | Python | bsd-3-clause | 714 |
# 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.
import json
from telemetry import timeline_model
def Import(data):
trace = json.loads(data) # pylint: disable=W0612
model = timeline_model.Timeline... | nacl-webkit/chrome_deps | tools/telemetry/telemetry/trace_event_importer.py | Python | bsd-3-clause | 386 |
import h5py
import sys
import os.path as op
from fos import *
import numpy as np
a=np.loadtxt(op.join(op.dirname(__file__), "data", "rat-basal-forebrain.swc") )
pos = a[:,2:5].astype( np.float32 )
radius = a[:,5].astype( np.float32 ) * 4
# extract parent connectivity and create full connectivity
parents = a[1:,6] - ... | fos/fos | examples/neuron.py | Python | bsd-3-clause | 815 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Integration'] , ['MovingAverage'] , ['Seasonal_WeekOfYear'] , ['AR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Integration/model_control_one_enabled_Integration_MovingAverage_Seasonal_WeekOfYear_AR.py | Python | bsd-3-clause | 167 |
# -*-coding:Utf-8 -*
# Copyright (c) 2014 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
# lis... | stormi/tsunami | src/secondaires/diligence/__init__.py | Python | bsd-3-clause | 4,815 |
#!/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... | jiajiax/crosswalk-test-suite | apptools/apptools-android-tests/apptools/comm.py | Python | bsd-3-clause | 7,398 |
# -*- coding: utf-8 -*-
from ooni.utils import log
from twisted.python import usage
from twisted.internet import defer
from ooni.templates import dnst
class UsageOptions(usage.Options):
optParameters = [
['target', 't', None, 'Specify a single hostname to query.'],
['expec... | frankcash/censorship-analyser | dnscompare.py | Python | bsd-3-clause | 3,151 |
"""`Factory of Factories` pattern."""
from dependency_injector import containers, providers
class SqlAlchemyDatabaseService:
def __init__(self, session, base_class):
self.session = session
self.base_class = base_class
class TokensService:
def __init__(self, id_generator, database):
... | rmk135/objects | examples/miniapps/factory-patterns/factory_of_factories.py | Python | bsd-3-clause | 1,394 |
from django.test import TestCase
class CollectionTests(TestCase):
pass
| takeplace/django-composite | composite/tests/urls.py | Python | bsd-3-clause | 77 |
# -*- coding: utf8 -*-
"""
.. module:: burpui.api.misc
:platform: Unix
:synopsis: Burp-UI misc api module.
.. moduleauthor:: Ziirish <hi+burpui@ziirish.me>
"""
from . import api, cache_key, force_refresh
from ..engines.server import BUIServer # noqa
from .custom import fields, Resource
from .client import Cl... | ziirish/burp-ui | burpui/api/misc.py | Python | bsd-3-clause | 35,390 |
# -*- coding: utf-8 -*-
"""
Network Plugin
Network usage and connections
"""
import os, netifaces, psutil, time
from pkm import utils, SHAREDIR
from pkm.decorators import never_raise, threaded_method
from pkm.plugin import BasePlugin, BaseConfig
from pkm.filters import register_filter
NAME = 'Network'
DEFAULT_IGNORES ... | mjs7231/pkmeter | pkm/plugins/network.py | Python | bsd-3-clause | 2,803 |
from parameter import *
from parse_digit import *
from os import system
cmd = "make -C tools >/dev/null 2>/dev/null;mkdir log model 2>/dev/null"
system(cmd)
#remove those method/data you are not interested in its result
methodlist = ['random-forest','gbdt']
data = ['MQ2007','MQ2008','MSLR','YAHOO_SET1','YAHOO_SET2',... | JasonWyse/FacRankSvm_c | table6.py | Python | bsd-3-clause | 2,609 |
"""
Prepare Sparse Matrix for Sparse Affinity Propagation Clustering (SAP)
"""
# Authors: Huojun Cao <bioinfocao at gmail.com>
# License: BSD 3 clause
import numpy as np
import pandas as pd
import sparseAP_cy # cython for calculation
####################################################################################... | bioinfocao/pysapc | pysapc/sparseMatrixPrepare.py | Python | bsd-3-clause | 8,514 |
import cPickle
import numpy as np
import sys
from collections import OrderedDict
def format_chars(chars_sent_ls):
max_leng = max([len(l) for l in chars_sent_ls])
to_pads = [max_leng - len(l) for l in chars_sent_ls]
for i, to_pad in enumerate(to_pads):
if to_pad % 2 == 0:
chars_sent_ls[i... | cosmozhang/NCRF-AE | process_data.py | Python | bsd-3-clause | 7,056 |
from ..module import get_introspection_module
from ..overrides import override
import warnings
GElektra = get_introspection_module('GElektra')
def __func_alias(klass, old, new):
func = getattr(klass, old)
setattr(klass, new, func)
def __func_rename(klass, old, new):
__func_alias(klass, old, new)
delattr(klass, o... | e1528532/libelektra | src/bindings/gi/python/gi/overrides/GElektra.py | Python | bsd-3-clause | 8,767 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test initalization and other aspects of Angle and subclasses"""
import threading
import warnings
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
import astropy.units as u
from ast... | lpsinger/astropy | astropy/coordinates/tests/test_angles.py | Python | bsd-3-clause | 35,759 |
import os
PACKAGE_NAME = 'pyflux'
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration(PACKAGE_NAME, parent_package, top_path)
config.add_subpackage('__check_build')
config.add_subpackage('arma')
config.add_subpacka... | RJT1990/pyflux | pyflux/setup.py | Python | bsd-3-clause | 792 |
import uuid
from couchdbkit import ResourceConflict
from couchdbkit.exceptions import ResourceNotFound
from django.test import TestCase
from toggle.shortcuts import update_toggle_cache, namespaced_item, clear_toggle_cache
from .models import generate_toggle_id, Toggle
from .shortcuts import toggle_enabled, set_toggle... | qedsoftware/commcare-hq | corehq/ex-submodules/toggle/tests.py | Python | bsd-3-clause | 4,576 |
#
# Copyright (c) 2014, Arista Networks, 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 condit... | arista-eosplus/pyeapi | test/system/test_api_system.py | Python | bsd-3-clause | 9,596 |
from __future__ import absolute_import, unicode_literals
from django.conf.urls import url
from django.core.urlresolvers import RegexURLResolver
from django.http import Http404
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.url_routing import RouteResult
_creation_counter = 0
def route(pattern... | Toshakins/wagtail | wagtail/contrib/wagtailroutablepage/models.py | Python | bsd-3-clause | 3,477 |
# -*- coding: utf-8 -*-
from decimal import Decimal
from django.http import HttpResponse, HttpRequest
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
from ....cart.app import cart_app
from ....car... | fusionbox/satchless | satchless/contrib/checkout/multistep/tests.py | Python | bsd-3-clause | 16,546 |
# -*- coding:utf-8 -*-
import logging
import warnings
from flypwd.config import config
with warnings.catch_warnings():
warnings.simplefilter("ignore")
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5
log = logging.getLogger(__name__)
def check_key(keyfile):
"""
checks the R... | giupo/flypwd | flypwd/keys.py | Python | bsd-3-clause | 658 |
import os
import shutil
import unittest
import copy
from nvpy.nvpy import Config
from nvpy.notes_db import NotesDB
notes = {
'1': {
'modifydate': 1111111222,
'tags': [],
'createdate': 1111111111,
'syncdate': 0,
'content': 'active note 1',
'savedate': 0,
},
'2... | yuuki0xff/nvpy | tests/notes_db/filter.py | Python | bsd-3-clause | 5,345 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 12, transform = "None", sigma = 0.0, exog_count = 100, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_None/trend_MovingMedian/cycle_12/ar_12/test_artificial_128_None_MovingMedian_12_12_100.py | Python | bsd-3-clause | 265 |
import tests.periodicities.period_test as per
per.buildModel((120 , 'S' , 25));
| antoinecarme/pyaf | tests/periodicities/Second/Cycle_Second_25_S_120.py | Python | bsd-3-clause | 82 |
from nose.plugins.skip import SkipTest
from oyster.conf import settings
from oyster.core import Kernel
from oyster.storage.gridfs import GridFSStorage
from oyster.storage.dummy import DummyStorage
def _simple_storage_test(StorageCls):
kernel = Kernel(mongo_db='oyster_test')
kernel.doc_classes['default'] = {}... | jamesturk/oyster | oyster/tests/test_storage.py | Python | bsd-3-clause | 1,021 |
#!/usr/bin/env python
from flexbe_core import EventState, Logger
import rospy
from flexbe_core.proxy import ProxyPublisher
from geometry_msgs.msg import Twist
"""Created on June. 21, 2017
@author: Alireza Hosseini
"""
class PublishTwistState(EventState):
"""
Publishes a velocity command from userdata.
-- topi... | FlexBE/generic_flexbe_states | flexbe_utility_states/src/flexbe_utility_states/publish_twist_state.py | Python | bsd-3-clause | 850 |
#! /usr/bin/python
"""
Runs GenomeMapper on single-end or paired-end data.
"""
import optparse, os, sys, tempfile
def stop_err( msg ):
sys.stderr.write( "%s\n" % msg )
sys.exit()
def __main__():
#Parse Command Line
parser = optparse.OptionParser()
parser.add_option('', '--threads', dest='thread... | vipints/oqtans | oqtans_tools/PALMapper/0.5/galaxy/genomemapper_wrapper.py | Python | bsd-3-clause | 4,421 |
#!/usr/bin/env python
r"""Browse raw data.
This uses :func:`mne.io.read_raw` so it supports the same formats
(without keyword arguments).
Examples
--------
.. code-block:: console
$ mne browse_raw sample_audvis_raw.fif \
--proj sample_audvis_ecg-proj.fif \
--eve sample_a... | kambysese/mne-python | mne/commands/mne_browse_raw.py | Python | bsd-3-clause | 5,212 |
"""
Module for parsing & validation of EPICS database definition (dbd) files.
Copyright 2012 Australian National University. Licensed under the new BSD License, as specified in the LICENSE file.
"""
from pyparsing import *
from parserutils import *
import os
import re
import dbparser
import pickle
import traceback
na... | anunuclear/dbpreproc | dbdparser.py | Python | bsd-3-clause | 11,369 |
from django.http import HttpResponse
def hello_world(request):
return HttpResponse("Hello, world.") | xyloeric/pi | piExp/pi/views.py | Python | bsd-3-clause | 101 |
import os
from django.core.urlresolvers import reverse
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from easy_thumbnails.fields import ThumbnailerImageField
class VisibilityModel(models.Model):
is_active = models.BooleanField(_('is active... | matthiask/django-chet | chet/models.py | Python | bsd-3-clause | 2,741 |
# Copyright (C) 2018 Henrique Pereira Coutada Miranda, Alejandro Molina Sanchez, Alexandre Morlet, Fulvio Paleari
#
# All rights reserved.
#
# This file is part of yambopy
#
#
import os
from operator import itemgetter
from collections import OrderedDict
from yambopy import *
#
# by Henrique Miranda.
#
def pack_files_i... | henriquemiranda/yambo-py | yambopy/recipes.py | Python | bsd-3-clause | 20,837 |
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 = 12, transform = "Quantization", sigma = 0.0, exog_count = 0, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Quantization/trend_PolyTrend/cycle_12/ar_12/test_artificial_32_Quantization_PolyTrend_12_12_0.py | Python | bsd-3-clause | 267 |
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.template import loader
from django.template.loader import select_template
from django.utils.translation import ugettext_lazy as _
from . import models
from .conf import settings
from filer.models.imagemodels import Image
cla... | douwevandermeij/cmsplugin-filer | cmsplugin_filer_folder/cms_plugins.py | Python | bsd-3-clause | 2,258 |
###############################
# Author : septicmk
# Date : 2015/07/25 16:14:09
# FileName : main.py
################################
from lambdaimage import preprocess as prep
from lambdaimage import registration as reg
from lambdaimage import fusion as fus
from pyspark import SparkContext, SparkConf
from lamb... | genialwang/lambda-image | script/mehi_local.py | Python | bsd-3-clause | 2,385 |
import os
import io
import shutil
import tempfile
import unittest
from functools import partial
from pathlib import Path
from nbformat import validate
try:
from unittest.mock import patch
except ImportError:
from mock import patch
from .. import engines
from ..log import logger
from ..iorw import load_noteb... | nteract/papermill | papermill/tests/test_execute.py | Python | bsd-3-clause | 16,273 |
#!/usr/bin/env python
"""
This file contains the sample code for XXX. Search for the string CONTENT to
skip directly to it.
Executing this file will begin an enhanced interactive Python session. You
can step through each slide of sample code and explore the results. If your
explorations hose the environment, just ... | dcolish/Presentations | pdxpython/sliderepl.py | Python | bsd-3-clause | 13,115 |
################################
# Author : septicmk
# Date : 2015/07/24 19:41:26
# FileName : test_utils.py
################################
import shutil
import tempfile
import unittest
from numpy import vstack
from pyspark import SparkContext
class PySparkTestCase(unittest.TestCase):
def setUp(self):
... | septicmk/MEHI | test/test_utils.py | Python | bsd-3-clause | 1,542 |
import factory
from questionnaire.models import Theme
class ThemeFactory(factory.DjangoModelFactory):
class Meta:
model = Theme
name = "A title"
description = 'Description' | eJRF/ejrf | questionnaire/tests/factories/theme_factory.py | Python | bsd-3-clause | 196 |
def extractTranslasiSanusiMe(item):
'''
Parser for 'translasi.sanusi.me'
'''
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_extractTranslasiSanusiMe.py | Python | bsd-3-clause | 550 |
__author__ = 'frank'
# Setup our test environment
import os
os.environ['NETKI_ENV'] = 'test'
from unittest import TestCase
from netki.api.domain import *
from mock import patch, Mock
class TestWalletLookup(TestCase):
# This is the open wallet name lookup API
def setUp(self):
self.patcher1 = patch... | netkicorp/wns-api-server | netki/api/test_domain.py | Python | bsd-3-clause | 24,663 |
import base64
import re
import os
URL_FINDER = re.compile('url\(.*?\)')
STRIP_URL = re.compile('url\(|\)|\'|"')
file_extensions_to_types = {
"png": "image/png",
"jpg": "image/jpg",
"gif": "image/gif",
}
def _extract_image_urls_from_css(css):
return URL_FINDER.findall(css)
def _extract_image_urls_fro... | eroh92/asset-manager | asset_manager/datauris.py | Python | bsd-3-clause | 2,268 |
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-faq-views',
version='0.1',... | donnywdavis/Django-faq-views | setup.py | Python | bsd-3-clause | 1,185 |
#!/usr/bin/env python
import re
import os
import time
import sys
import unittest
import ConfigParser
from setuptools import setup, Command
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
class SQLiteTest(Command):
"""
Run the tests on SQLite
"""
description = ... | fulfilio/trytond-waiting-customer-shipment-report | setup.py | Python | bsd-3-clause | 4,152 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 30, transform = "RelativeDifference", sigma = 0.0, exog_count = 0, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_MovingAverage/cycle_30/ar_12/test_artificial_1024_RelativeDifference_MovingAverage_30_12_0.py | Python | bsd-3-clause | 279 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from preggy import expect
import click
from click.testing import CliRunner
from terrible.run import compile_template
from tests.base import TestCase
import os
class CompileTemplateTestCase(TestCase):
def test_compile_template(self):
base_dir = os.path.dirnam... | RobotsAndPencils/terrible | tests/test_run.py | Python | bsd-3-clause | 3,415 |
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2017 by Brendt Wohlberg <brendt@ieee.org>
# All rights reserved. BSD 3-clause License.
# This file is part of the SPORCO package. Details of the copyright
# and user license can be found in the 'LICENSE.txt' file distributed
# with the package.
"""ADMM algorithm for the CMO... | alphacsc/alphacsc | alphacsc/other/sporco/sporco/admm/cmod.py | Python | bsd-3-clause | 8,925 |
# -*- coding: utf-8 -*-
"""Model unit tests."""
import datetime as dt
import pytest
from phonedusk.user.models import User, Role
from .factories import UserFactory
@pytest.mark.usefixtures('db')
class TestUser:
def test_get_by_id(self):
user = User('foo', 'foo@bar.com')
user.save()
retr... | kevana/phonedusk-server | tests/test_models.py | Python | bsd-3-clause | 1,682 |
from robofab.pens.pointPen import BasePointToSegmentPen
from ufoLib.pointPen import AbstractPointPen
"""
Printing pens print their data. Useful for demos and debugging.
"""
__all__ = ["PrintingPointPen", "PrintingSegmentPen", "SegmentPrintingPointPen"]
class PrintingPointPen(AbstractPointPen):
"""A PointPen tha... | adrientetar/robofab | Lib/robofab/pens/printingPens.py | Python | bsd-3-clause | 2,042 |
"""
LICENCE
-------
Copyright 2013 by Kitware, Inc. All Rights Reserved. Please refer to
KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
"""
import flask
from functools import wraps
from flask import Blueprint, redirect, render_temp... | anguoyang/SMQTK | OLD_ROOT/WebUI/login.py | Python | bsd-3-clause | 3,379 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.