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 |
|---|---|---|---|---|---|
import pandas as pd
import sklearn
import sklearn.metrics as metrics
import numpy as np
import scipy
import matplotlib
import matplotlib.pyplot as plt
import scipy.stats as stats
from sklearn import cluster
from sklearn.linear_model import LogisticRegression as LR
from sklearn.ensemble import RandomForestC... | BIDS-collaborative/EDAM | data/brian/predict.py | Python | bsd-2-clause | 15,980 |
# nop.py
# The CIL nop instruction
# Copyright 2010 Marty Dill - see LICENSE for details
from Instruction import Instruction
import unittest
import Types
from MethodDefinition import MethodDefinition
from Instructions.Instruction import register
class nop(Instruction):
def __init__(self, arguments = None):
... | martydill/PyCIL | src/Instructions/nop.py | Python | bsd-2-clause | 847 |
"""Ring buffer for automatic storage of images"""
import os.path
import logging
from datetime import datetime
import numpy as np
from scipy.misc import imsave
import tables
class RingBuffer(object):
"""Ring buffer class.
Attributes
----------
directory : str
Location to store the ring buffer ... | mivade/qCamera | qcamera/ring_buffer.py | Python | bsd-2-clause | 4,596 |
#!/usr/bin/env python
"""
SyntaxError - There's something wrong with how you wrote the surrounding code.
Check your parentheses, and make sure there are colons where needed.
"""
while True
print "Where's the colon at?" | selimnairb/2014-02-25-swctest | lessons/thw-python-debugging/basic_exceptions/syntax_error.py | Python | bsd-2-clause | 223 |
# -*- coding: utf-8 -*-
"""Read data from 'Harvard Library Open Metadata'.
Records: ~12 Million
Size: 12.8 GigaByte (Unpacked)
Info: http://library.harvard.edu/open-metadata
Data: https://s3.amazonaws.com/hlom/harvard.tar.gz
Instructions:
Download datafile and run `tar xvf harvard.tar.gz` to extract marc21 files.... | coblo/isccbench | iscc_bench/readers/harvard.py | Python | bsd-2-clause | 2,886 |
"""
*colorview2d* is a plotting tool intended to be used with
scientific data (with dimensionful axes)
with an easily extendable data modification (or filtering) toolbox.
Tested with Python 2.7 and Python 3.
Dependencies
------------
numpy, scipy, matplotlib, pyyaml, scikit.image
Homepage
--------
https://github.com... | Loisel/colorview2d | colorview2d/__init__.py | Python | bsd-2-clause | 679 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2016 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 | python/py-interpreter/byterun/main.py | Python | bsd-2-clause | 2,143 |
import os
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
except:
README = ''
CHANGES = ''
setup(
name='Flask-Failsafe',
version='0.2',
url... | mgood/flask-failsafe | setup.py | Python | bsd-2-clause | 1,085 |
import numpy as np
from numba import jit
import OSIM.Simulation.Utils as u
from OSIM.Modeling.AbstractComponents.NonlinearComponent import NonlinearComponent
class IBC(NonlinearComponent):
def __init__(self, nodes, name, value, superComponent, **kwargs):
super(IBC, self).__init__(nodes, name, value, supe... | tmaiwald/OSIM | OSIM/Modeling/Components/NPN_Vertical_Bipolar_Intercompany_Model/VBIC_Currents/IBC.py | Python | bsd-2-clause | 4,274 |
from decimal import Decimal
from django.utils import timezone
from rest_framework import serializers
import rest_framework
import datetime
import django
import pytest
import uuid
# Tests for field keyword arguments and core functionality.
# ---------------------------------------------------------
class TestEmpty:
... | ticosax/django-rest-framework | tests/test_fields.py | Python | bsd-2-clause | 38,463 |
from os import system
import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer
def clear_buffer_cache():
system('free -g')
system('sync')
system("sudo sed -n 's/0/3/w /proc/sys/vm/drop_caches' /proc/sys/vm/drop_caches")
system('sync')
system("sudo sed -n 's/3/0/w /proc/sys/vm/drop_caches' /proc/sys/vm/d... | limingzju/ClearCacheServer | server.py | Python | bsd-2-clause | 617 |
# **********************************************
# * Robotic Lamp
# * 26 March 2017
# * Saksham Saini, James Jia and Dhruv Diddi
# **********************************************
import cv2
import sys
sys.path.append('/home/pi/Desktop/RoboticLamp/main/Adafruit_Python_PCA9685/Adafruit_PCA9685')
import numpy as np
import... | ssaini4/RoboticLamp | main/haarDetection.py | Python | bsd-2-clause | 6,327 |
"""
This module contains functions to analyze periodic data.
"""
from __future__ import division, print_function
import numpy as np
def folded_shape(array, period_samples):
if period_samples == 0:
raise ValueError("Cannot fold unmodulated data or with period=0")
shape = list(array.shape)
shape[-1]... | ColumbiaCMB/kid_readout | kid_readout/analysis/timeseries/periodic.py | Python | bsd-2-clause | 1,094 |
import boto.regioninfo
import datetime
from collections import MutableMapping
from json import JSONEncoder, dumps
from time import mktime
def json_encoder(obj):
if isinstance(obj, boto.regioninfo.RegionInfo):
return obj.name
elif isinstance(obj, datetime.datetime):
return int(mktime(obj.timet... | mwhooker/messier | messier/lib/aws/resource.py | Python | bsd-2-clause | 1,293 |
# coding=utf-8
from taggit.forms import TagField
from taggit.managers import TaggableManager
from django.conf import settings
from widgets import TagAutocomplete
class TaggableManagerAutocomplete(TaggableManager):
def formfield(self, form_class=TagField, **kwargs):
field = (super(TaggableManagerAutocompl... | SReiver/django-taggit-autocomplete-jqueryui | taggit_autocomplete_jqueryui/managers.py | Python | bsd-2-clause | 818 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | ganeshgore/myremolab | server/src/test/unit/voodoo/gen/loader/test_SchemaChecker.py | Python | bsd-2-clause | 2,998 |
import os, sys
DISTNAME = 'sardine'
MAINTAINER = 'Geoff Rollins'
MAINTAINER_EMAIL = 'grollins@gmail.com'
VERSION = '0.1'
# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
# update it when the contents of directories change.
if os.path.exists('MANIFEST'):
os.remove('MANIFEST')
print "MA... | grollins/sardine | setup.py | Python | bsd-2-clause | 1,282 |
#!usr/bin/env python2
name = raw_input("Full name: ")
if name == 'Nguyen Viet Hung':
print 'Hi HVN'
namelist = name.split(' ')
for w in namelist:
print w,
| familug/FAMILUG | Python/FCM28RawInput.py | Python | bsd-2-clause | 158 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 12 17:20:10 2012
@author: eba
"""
from numpy import *
from scipy import *
from matplotlib.pyplot import *
from MHFPython import *
def stateAct(gh,trans,inp,noisecov,samples,limit, steps):
z = zeros([steps,steps])
cellArea = (2. * limit / steps) ** 2
mean = p... | enobayram/MHFlib | MHFPython/scripts/actualdist.py | Python | bsd-2-clause | 825 |
"""Model configuration for pascal dataset"""
import numpy as np
from config import base_model_config
def voc_squeezeDet_config():
"""Specify the parameters to tune below."""
mc = base_model_config('PASCAL_VOC')
mc.IMAGE_WIDTH = 320
mc.IMAGE_HEIGHT = 240
mc.BATCH_SI... | fyhtea/squeezeDet-hand | src/config/voc_squeezeDet_config.py | Python | bsd-2-clause | 1,990 |
#!/usr/bin/env python
from . import Stream, StreamError
from ..compat import str, bytes, urlparse
from ..utils import RingBuffer, swfdecompress, swfverify, urlget, urlopen
from ..packages.flashmedia import FLV, FLVError
from ..packages.flashmedia.tag import ScriptData
import base64
import hashlib
import hmac
import ... | derekzhang79/livestreamer | src/livestreamer/stream/akamaihd.py | Python | bsd-2-clause | 6,596 |
#!/usr/bin/env python
import telnetlib
import time
def main():
ip = '50.76.53.27'
port = 23
timeout = 3
user = 'pyclass'
passwd = '88newclass'
conn = telnetlib.Telnet(ip, port, timeout)
conn.read_until("sername:", timeout)
conn.write(user + '\n')
conn.read_until("assword:", ... | bluetiki/pylab | telnet2.py | Python | bsd-2-clause | 657 |
#!/usr/bin/env python
# vim: fileencoding=utf-8 tabstop=2 softtabstop=2 shiftwidth=2 expandtab
""" settings.py """
# address binding
HOST = '127.0.0.1'
PORT = '5000'
# logger name
LOGGER_NAME = 'kanban-gallen'
# database location setting
SQLALCHEMY_DATABASE_URI = 'sqlite:///../db/database.db'
| nellaG/kanban-gallen | kanban_gallen/settings.py | Python | bsd-2-clause | 299 |
from django.forms import ModelForm
from django.forms.models import BaseModelFormSet
import olympia.core.logger
from olympia.files.models import File
admin_log = olympia.core.logger.getLogger('z.addons.admin')
class FileStatusForm(ModelForm):
class Meta:
model = File
fields = ('status',)
de... | eviljeff/olympia | src/olympia/addons/forms.py | Python | bsd-3-clause | 1,601 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from ..extern.six.moves.urllib.parse import parse_qs
from ..extern.six.moves.urllib.request import urlopen
from ..extern.six.moves import input
f... | AustereCuriosity/astropy | astropy/samp/web_profile.py | Python | bsd-3-clause | 5,804 |
# -*- coding: utf-8 -*-
# vim: set et sts=4 sw=4 encoding=utf-8:
###############################################################################
#
# This file is part of socketrpc.
#
# Copyright (C) 2011 Rene Jochum <rene@jrit.at>
#
###############################################################################
from ... | pcdummy/socketrpc | socketrpc/gevent_srpc.py | Python | bsd-3-clause | 10,766 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# 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 copyrigh... | nuagenetworks/vspk-python | vspk/v6/nuconnectionendpoint.py | Python | bsd-3-clause | 14,146 |
"""Module running all examples in the examples directory
Suppresses all openings of plots
"""
__author__ = 'Robert Meyer'
import glob
import os
import sys
import platform
import subprocess
try:
import brian
except ImportError:
print('No BRIAN module found, will skip the example')
brian = None
try:
i... | nigroup/pypet | pypet/tests/all_examples.py | Python | bsd-3-clause | 4,589 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##
# python standard library
#
import unittest
from functools import partial
##
# test helper
#
from testutils import mock, IsA
##
# content bits modules
#
from contentbits.factory import CollectionFactory
class CollectionFactoryTestCase(unittest.TestCase):
def se... | michalbachowski/pycontentbits | test/factory_test.py | Python | bsd-3-clause | 5,366 |
"""
This is an example settings/test.py file.
Use this settings file when running tests.
These settings overrides what's in settings/base.py
"""
from .base import *
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
"USER": "",
"PASSWORD": "",
... | oskarm91/sis | sis/settings/test.py | Python | bsd-3-clause | 435 |
"""Extreme Discovery Protocol."""
import dpkt
import sys
class EDP(dpkt.Packet):
__hdr__ = (
('v', 'B', 1),
('res', 'B', 0),
('hlen', 'H', 0),
('sum', 'H', 0),
('seq', 'H', 0),
('mid', 'H', 0),
('mac', '6s', '')
)
def __str__(self):
... | hexcap/dpkt | dpkt/edp.py | Python | bsd-3-clause | 442 |
"""
Python script to create a new article in a given section id.
"""
import os
import sys
from zdesk import Zendesk
from scripts import file_constants
from colorama import init
from colorama import Fore
init()
def _create_shell(section_id):
# Get subdomain.
try:
subdomain = os.environ["ZENDESK_SU... | aerofs/zendesk-help-center-backer | zendesk/create_new_post_shell.py | Python | bsd-3-clause | 2,438 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-09-17 10:00
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('libretto', '0043_auto_20190905_1126'),
]
operatio... | dezede/dezede | libretto/migrations/0044_auto_20190917_1200.py | Python | bsd-3-clause | 987 |
from flask.ext.wtf import Form
from flask.ext.babel import gettext
from wtforms import StringField, BooleanField, TextAreaField
# DataRequired is a validator, a function that
# can be attached to a field to perform validation
# on the data submitted by the user.
from wtforms.validators import DataRequired, Length
from... | staeff/megaflask | app/forms.py | Python | bsd-3-clause | 1,916 |
from datetime import date
from django.db.models import F, Q, Value, IntegerField
from celery import group
import olympia.core.logger
from olympia import amo
from olympia.addons.models import Addon, FrozenAddon
from olympia.addons.tasks import (
update_addon_average_daily_users as _update_addon_average_daily_user... | eviljeff/olympia | src/olympia/addons/cron.py | Python | bsd-3-clause | 7,792 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division
from xue.tutor.models import *
from django.contrib import admin
class TutorProjectAdmin(admin.ModelAdmin):
list_display = (
'get_teacher_name',
'teacher',
'name',
'year',
)
... | team-xue/xue | xue/tutor/admin.py | Python | bsd-3-clause | 1,563 |
# Initialize App Engine and import the default settings (DB backend, etc.).
# If you want to use a different backend you have to remove all occurences
# of "djangoappengine" from this file.
from djangoappengine.settings_base import *
from private_settings import SECRET_KEY
import os
# Activate django-dbindexer for th... | ukch/gae_simple_blog | settings.py | Python | bsd-3-clause | 2,108 |
from django.db.models.fields import related
def _is_many_to_many_relation(field):
"""Check if a field specified a many-to-many relationship as defined by django.
This is the case if the field is an instance of the ManyToManyDescriptor as generated
by the django framework
Args:
field (django.d... | rackerlabs/django-DefectDojo | dojo/api_v2/prefetch/utils.py | Python | bsd-3-clause | 1,916 |
import tests.periodicities.period_test as per
per.buildModel((60 , 'T' , 100));
| antoinecarme/pyaf | tests/periodicities/Minute/Cycle_Minute_100_T_60.py | Python | bsd-3-clause | 82 |
#!/usr/bin/env python
import roslib; roslib.load_manifest('hanse_behaviourctrl')
import rospy
import smach
import smach_ros
import signal
import os
import actionlib
from hanse_msgs.msg import sollSpeed, pressure
from std_msgs.msg import Float64, Float32, String
from geometry_msgs.msg import PoseStamped, Point, Twist, V... | iti-luebeck/HANSE2012 | hanse_ros/hanse_behaviourctrl/nodes/behaviourctrl_pipe.py | Python | bsd-3-clause | 14,366 |
#
# Collective Knowledge (artifact description (reproducibility, ACM meta, etc))
#
# 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 module)
wor... | ctuning/ck-env | module/artifact/module.py | Python | bsd-3-clause | 12,275 |
"""
WSGI config for devault 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("DJANGO_SETTI... | opportunitynetwork/devault | devault/devault/wsgi.py | Python | bsd-3-clause | 391 |
import pickle, json, requests, base64
from sklearn import datasets
iris = datasets.load_iris()
X = iris.data
Y = iris.target
# print(iris.DESCR)
from sklearn.neural_network import MLPClassifier
clf = MLPClassifier()
clf.fit(X, Y)
def test_ws_sql_gen(pickle_data):
WS_URL="https://sklearn2sql.herokuapp.com... | antoinecarme/sklearn2sql_heroku | tests/databases/test_client_pgsql.py | Python | bsd-3-clause | 740 |
#!python
# ###################################################################
#
# Disclaimer and Notice of Copyright
# ==================================
#
# Copyright (c) 2015, Los Alamos National Security, LLC
# All rights reserved.
#
# Copyright 2015. Los Alamos National Security, LLC.
# This software was... | losalamos/Pavilion | PAV/modules/helperutilities.py | Python | bsd-3-clause | 3,253 |
#!/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.
'''Handling of the <message> element.
'''
import re
import types
from grit.node import base
import grit.format.rc_header
import ... | JoKaWare/WTL-DUI | tools/grit/grit/node/message.py | Python | bsd-3-clause | 10,287 |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("XGBRegressor" , "freidman2" , "sqlite")
| antoinecarme/sklearn2sql_heroku | tests/regression/freidman2/ws_freidman2_XGBRegressor_sqlite_code_gen.py | Python | bsd-3-clause | 129 |
import unittest
import numpy as np
from chaco.array_plot_data import ArrayPlotData
from chaco.plot import Plot
from chaco.tools.range_selection import RangeSelection
from enable.testing import EnableTestAssistant
class RangeSelectionTestCase(EnableTestAssistant, unittest.TestCase):
def test_selecting_mouse_lea... | tommy-u/chaco | chaco/tools/tests/range_selection_test_case.py | Python | bsd-3-clause | 1,955 |
#!/usr/bin/env python
from setuptools import setup
CPSVERSION = '204'
long_description = """
ConPaaS: an integrated runtime environment for elastic Cloud applications
=========================================================================
"""
setup(name='cpsclient',
version=CPSVERSION,
description='Co... | ConPaaS-team/conpaas | conpaas-client/setup.py | Python | bsd-3-clause | 705 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Roboterclub Aachen e.V.
# All rights reserved.
#
# The file is part of the xpcc library and is released under the 3-clause BSD
# license. See the file `LICENSE` for the full license governing this code.
# ----------------------------------------------... | dergraaf/xpcc | tools/device_file_generator/avr_generator.py | Python | bsd-3-clause | 1,677 |
from matplotlib import pyplot as plt
import numpy as np
class Spline(object):
"""Forms a cublic spline on an interval given values and derivatives at the endpoints of that interval."""
def __init__(self, x1, y1, dy1, x2, y2, dy2):
self.x1 = x1
self.x2 = x2
self.y1 = y1
self.y2 ... | amanzi/ats-dev | tools/utils/plot_wrm.py | Python | bsd-3-clause | 6,867 |
from numpy.random import random
from bokeh.models.markers import marker_types
from bokeh.plotting import figure, output_file, show
p = figure(title="Bokeh Markers", toolbar_location=None, output_backend="webgl")
p.grid.grid_line_color = None
p.background_fill_color = "#eeeeee"
p.axis.visible = False
p.y_range.flipped... | ericmjl/bokeh | examples/plotting/file/markers.py | Python | bsd-3-clause | 768 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
r"""
==========================================================
Comparing different variants of squared exponential kernel
==========================================================
Three variants of the squared exponential covariance function are compared:
* Isotropic squar... | jmetzen/skgp | examples/plot_gp_learning_curve.py | Python | bsd-3-clause | 3,042 |
# -*- coding: utf-8 -*-
"""
Created on Nov 30, 2015
@author: jakob
"""
from django.dispatch.dispatcher import receiver
from cms.models.titlemodels import Title
from cms.signals import post_publish, post_unpublish
from .signals import add_to_index, remove_from_index
@receiver(post_publish, dispatch_uid='publish_cms_... | aldryn/aldryn-search | aldryn_search/receivers.py | Python | bsd-3-clause | 797 |
#!/usr/bin/env python
#
#===- check_clang_tidy.py - ClangTidy Test Helper ------------*- python -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===--------------------------------------... | youtube/cobalt | third_party/llvm-project/clang-tools-extra/test/clang-tidy/check_clang_tidy.py | Python | bsd-3-clause | 5,589 |
from __future__ import division, absolute_import, print_function
import sys
import warnings
import itertools
import operator
import platform
import pytest
import numpy as np
from numpy.testing import (
assert_, assert_equal, assert_raises, assert_almost_equal,
assert_array_equal, IS_PYPY, suppress_warnings, _... | MSeifert04/numpy | numpy/core/tests/test_scalarmath.py | Python | bsd-3-clause | 28,365 |
""" test to_datetime """
import calendar
from collections import deque
from datetime import (
datetime,
timedelta,
)
from decimal import Decimal
import locale
from dateutil.parser import parse
from dateutil.tz.tz import tzoffset
import numpy as np
import pytest
import pytz
from pandas._libs import tslib
from... | dsm054/pandas | pandas/tests/tools/test_to_datetime.py | Python | bsd-3-clause | 98,109 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cases', '0021_migrate_case_contacts'),
('msgs', '0008_messageaction'),
]
operations = [
migrations.RemoveField(
... | xkmato/casepro | casepro/cases/migrations/0022_delete_mesageaction.py | Python | bsd-3-clause | 697 |
#!/usr/bin/env python
"""
master script to control different operations in training examples generating pipeline.
usage:
python experiment_run.py <YAML config> -h
sample yaml config file located at config/
requirement:
pygridtools for distributed computing
packages/modules depends on the operation... | vipints/genomeutils | experiment_run.py | Python | bsd-3-clause | 29,698 |
# Copyright (c) 2012 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
def int_to_bin_str(value, max_bits=8192):
"""Convert an int to a string representation of a bitmask (binary number)"""
mask = value
bits = 1
while 1 << bits < value or bi... | lhupfeldt/multiconf | multiconf/bits.py | Python | bsd-3-clause | 515 |
import os
from argparse import Namespace
import tempfile
import io
import zipfile
import tarfile
import json
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.core.files.base import File
from django.test import TestCase
from django.urls import reverse, resolve
f... | cfe-lab/Kive | kive/container/tests_mock.py | Python | bsd-3-clause | 39,450 |
import psycopg2
import psycopg2.extras
from txpostgres import txpostgres
def dict_connect(*args, **kwargs):
kwargs['connection_factory'] = psycopg2.extras.DictConnection
return psycopg2.connect(*args, **kwargs)
class DictConnection(txpostgres.Connection):
connectionFactory = staticmethod(dict_connect)
| gtaylor/btmux_battlesnake | battlesnake/plugins/contrib/pg_db/dict_conn.py | Python | bsd-3-clause | 319 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from time import sleep
msg = [u'あ', u'り', u'が', u'う']
wait = 0.7
for m in msg:
print(m, end="", flush=True)
sleep(wait)
print('\b', end="", flush=True)
sleep(wait)
print(u'と', end="", flush=True)
sleep(wait)
print(u'う', end="", flush=True)
sleep(wait)
print("""
Q.「I... | yutakakn/MyScript | Python/thanks.py | Python | bsd-3-clause | 534 |
import graphene
from ...core.permissions import DiscountPermissions
from ...discount import models
from ..core.mutations import ModelBulkDeleteMutation
class SaleBulkDelete(ModelBulkDeleteMutation):
class Arguments:
ids = graphene.List(
graphene.ID, required=True, description="List of sale ID... | maferelo/saleor | saleor/graphql/discount/bulk_mutations.py | Python | bsd-3-clause | 839 |
from parameter import *
from parse_digit import *
import os
from os import system
cmd = "make -C liblinear >/dev/null 2>/dev/null; make -C tools > /dev/null 2>/dev/null; mkdir log model 2>/dev/null"
system(cmd)
methodlist = ['partial-pairs','l2-loss-ranksvm']
solver = {"partial-pairs":0,"l2-loss-ranksvm":6}
#remove... | JasonWyse/FacRankSvm_c | table10.py | Python | bsd-3-clause | 2,481 |
from djangoautoconf.auto_conf_admin_tools.admin_feature_base import AdminFeatureBase
__author__ = 'weijia'
class FilterHorizontalFeature(AdminFeatureBase):
"""
Use horizontal filter for foreign key attributes instead of multiple select box
"""
def __init__(self, fields):
"""
Init the ... | weijia/djangoautoconf | djangoautoconf/auto_conf_admin_tools/filter_horizontal_feature.py | Python | bsd-3-clause | 739 |
"""Functions to visualize matrices of data."""
import itertools
import warnings
import matplotlib as mpl
from matplotlib.collections import LineCollection
import matplotlib.pyplot as plt
from matplotlib import gridspec
import numpy as np
import pandas as pd
from scipy.cluster import hierarchy
from . import cm
from .a... | anntzer/seaborn | seaborn/matrix.py | Python | bsd-3-clause | 51,063 |
"""Since cyme works as a contained Django APP, this is the default settings
file used when cyme is used outside of a Django project context."""
from __future__ import absolute_import
import os
import djcelery
djcelery.setup_loader()
DEBUG = True
# Broker settings.
BROKER_HOST = 'amqp://127.0.0.1:5672//'
BROKER_POOL... | celery/cyme | cyme/settings.py | Python | bsd-3-clause | 1,738 |
import numpy as np
from skimage.util import img_as_float
class FeatureDetector(object):
def __init__(self):
self.keypoints_ = np.array([])
def detect(self, image):
"""Detect keypoints in image.
Parameters
----------
image : 2D array
Input image.
... | SamHames/scikit-image | skimage/feature/util.py | Python | bsd-3-clause | 4,764 |
"plot average NDCGs"
import cPickle as pickle
from collections import OrderedDict
from matplotlib import pyplot as plt
from os import listdir
from os.path import isfile, join
# minimum number of users we have scores for to average
min_users = 10
input_dir = 'ndcgs/'
# a list of input files
input_files = [ join( in... | zygmuntz/evaluating-recommenders | plot_ndcgs.py | Python | bsd-3-clause | 885 |
def extractPanisal(item):
"""
Parser for 'panisal'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'WATTT' in item['tags']:
return buildReleaseMessageWithType(item, 'WATTT', vol, chp, frag=frag, postfix=pos... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractPanisal.py | Python | bsd-3-clause | 340 |
import amo
import amo.tests
import waffle
from users.models import UserProfile
from mkt.purchase.utils import payments_enabled
from mkt.site.fixtures import fixture
from test_utils import RequestFactory
class TestUtils(amo.tests.TestCase):
fixtures = fixture('user_2519')
def setUp(self):
self.req... | Joergen/zamboni | mkt/purchase/tests/test_utils_.py | Python | bsd-3-clause | 983 |
from __future__ import absolute_import, division, print_function
import functools
import six
from django.conf import settings
from rest_framework.exceptions import PermissionDenied
from rest_framework.response import Response
from sentry import features
from sentry.api.bases import OrganizationEventsEndpointBase, O... | mvaled/sentry | src/sentry/api/endpoints/organization_group_index.py | Python | bsd-3-clause | 14,036 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2015, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | appleseedhq/gaffer | python/GafferUI/__init__.py | Python | bsd-3-clause | 12,297 |
# Copyright (c) 2015, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import absolute_... | tempbottle/mcrouter | mcrouter/test/test_mcrouter.py | Python | bsd-3-clause | 13,301 |
"""
See PEP 386 (https://www.python.org/dev/peps/pep-0386/)
Release logic:
1. Increase version number (change __version__ below).
2. Check that all changes have been documented in CHANGELOG.rst.
3. git add filer/__init__.py CHANGELOG.rst
4. git commit -m 'Bump to {new version}'
5. git push
6. Assure that all tes... | divio/django-filer | filer/__init__.py | Python | bsd-3-clause | 582 |
from django.conf import settings
from forocacao.app.models import Event, Content
def get_or_none(model, objects, *args, **kwargs):
try:
return objects.get(*args, **kwargs)
except model.DoesNotExist:
return None
def current_event(request):
'''
A context processor to add the "current ev... | guegue/forocacao | forocacao/app/context_processors.py | Python | bsd-3-clause | 1,036 |
from __future__ import unicode_literals
from copy import copy
import difflib
import errno
from functools import wraps
import json
import os
import re
import sys
import select
import socket
import threading
import unittest
from unittest import skipIf # Imported here for backward compatibility
from unittest.util... | makinacorpus/django | django/test/testcases.py | Python | bsd-3-clause | 49,061 |
"""
Add table of contents at the beginning;
uses optional metadata value 'toc-depth'
"""
from panflute import *
def prepare(doc):
doc.toc = BulletList()
doc.depth = int(doc.get_metadata('toc-depth', default=1))
def action(elem, doc):
if isinstance(elem, Header) and elem.level <= doc.depth:
item... | sergiocorreia/panflute | docs/source/_static/toc.py | Python | bsd-3-clause | 612 |
#return value
def fun(a=None) :
if a != None:
return a
else:
return -1
print fun()
print fun(1)
| 1GHL/PythonLearn | study/return-argv.py | Python | bsd-3-clause | 123 |
from django.db import models
import datetime
class Category(models.Model):
title = models.CharField(max_length=250, help_text='Maximum 250 characters')
slug = models.SlugField()
description = models.TextField()
class Meta:
ordering = ['title']
verbose_name_plural = "Categories"
class Admin:
pass
#TO... | jamessqr/james-squires-dotcom | blog/models.py | Python | bsd-3-clause | 1,065 |
__author__ = "Sunil Kumar (kumar.sunil.p@gmail.com)"
__copyright__ = "Copyright 2014, Washington University in St. Louis"
__credits__ = ["Sunil Kumar", "Steve Pieper", "Dan Marcus"]
__license__ = "XNAT Software License Agreement " + \
"(see: http://xnat.org/about/license.php)"
__version__ = "2.1.1"
__main... | MokaCreativeLLC/XNATSlicer | XNATSlicer/XnatSlicerLib/ui/FolderMaker.py | Python | bsd-3-clause | 18,465 |
try:
from pip._internal.req import parse_requirements
except ImportError:
from pip.req import parse_requirements
from setuptools import find_packages
from setuptools import setup
def get_long_description():
with open('README.md') as readme_file:
return readme_file.read()
setup(
name='jsonapi... | socialwifi/jsonapi-requests | setup.py | Python | bsd-3-clause | 1,500 |
#-*- coding: utf-8 -*-
"""
Ads specific filters for search
"""
from django.contrib.gis.geos import fromstr
#from django.contrib.gis.db.models.fields import PolygonField
from django_filters.filters import Filter
from django import forms
class LocationFilter(Filter):
"""
Location filter
Used for geo filter... | ouhouhsami/django-geoads | geoads/filters.py | Python | bsd-3-clause | 977 |
import numpy as np
import sys
caffe_root = '/home/guillem/git/caffe/'
sys.path.insert(1, caffe_root+'python/')
import caffe
import cv2
from py_returnCAMmap import py_returnCAMmap
from py_map2jpg import py_map2jpg
import scipy.io
def im2double(im):
return cv2.normalize(im.astype('float'), None, 0.0, 1.0, cv2.NORM_MINM... | zhangyuygss/WSL | evaluate/py_demo.py | Python | bsd-3-clause | 3,102 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.core.urlresolvers import reverse
from django.test import TestCase, override_settings
from wagtail.tests.utils import WagtailTestUtils
from wagtail.wagtailcore.models import Page, Site
from wagtail.wagtailredirects import mode... | iansprice/wagtail | wagtail/wagtailredirects/tests.py | Python | bsd-3-clause | 23,927 |
import json
import logging
import os
import random
import shutil
from uuid import uuid4
from django.contrib.postgres.fields import JSONField
from django.core.exceptions import ValidationError
from django.db import models
from foresite import utils, Aggregation, URIRef, AggregatedResource, RdfLibSerializer
from rdflib ... | hydroshare/hydroshare | hs_file_types/models/base_model_program_instance.py | Python | bsd-3-clause | 24,351 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import contextlib
import imp
import os
import sys
import inspect
# Python 3.3's importlib caches filesystem reads for faster imports in the
# general case. But sometimes it's necessary to manually invalidate those
# caches so that the import system can ... | astrofrog/astropy-helpers | astropy_helpers/utils.py | Python | bsd-3-clause | 6,917 |
try:
from collections.abc import Mapping, MutableMapping
except ImportError:
from collections import Mapping, MutableMapping
class ZictBase(MutableMapping):
"""
Base class for zict mappings.
"""
def update(*args, **kwds):
# Boilerplate for implementing an update() method
if no... | dask/zict | zict/common.py | Python | bsd-3-clause | 1,419 |
"""Tests for Table Schema integration."""
from collections import OrderedDict
import json
import numpy as np
import pytest
from pandas.core.dtypes.dtypes import (
CategoricalDtype,
DatetimeTZDtype,
PeriodDtype,
)
import pandas as pd
from pandas import DataFrame
import pandas._testing as tm
from pandas.i... | jorisvandenbossche/pandas | pandas/tests/io/json/test_json_table_schema.py | Python | bsd-3-clause | 28,054 |
#!/usr/bin/env python
###########################################################
# WARNING: Generated code! #
# ************************** #
# Manual changes may get lost if file is generated again. #
# Only code inside the [MANUAL] tags will be kept. ... | team-vigir/vigir_behaviors | behaviors/vigir_behavior_trigger_cutting_tool/src/vigir_behavior_trigger_cutting_tool/trigger_cutting_tool_sm.py | Python | bsd-3-clause | 17,004 |
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | greasypizza/grpc | src/python/grpcio/grpc_core_dependencies.py | Python | bsd-3-clause | 28,918 |
'''
Created on Sep 4, 2010
@author: expedient
'''
# local modules for auto-approving users's flowspace request used in admin_manager app.
# note: module file name should exist in the auto_approve_scripts directory in the
# openflow/optin_manager.
AUTO_APPROVAL_MODULES = {
# "module display name":"module file nam... | avlach/univbris-ocf | optin_manager/src/python/openflow/optin_manager/defaultsettings/admin_manager.py | Python | bsd-3-clause | 637 |
#!/usr/bin/env python
import time
makefile = '''
{
"rules":
[
{
"inputs": [ "source1" ],
"outputs": [ "output" ],
"cmd": "cat source1 > output && cat source2 >> output && echo 'output: source1 source2' > deps",
"depfile": "deps"
}
]
}
'''
def set_version_1(test):
test.writ... | falcon-org/Falcon | test/TestCache.py | Python | bsd-3-clause | 2,048 |
from platform import python_version
from django import get_version
from distutils.version import LooseVersion
DJANGO_VERSION = get_version()
PYTHON_VERSION = python_version()
# These means "less than or equal to DJANGO_FOO_BAR"
DJANGO_2_2 = LooseVersion(DJANGO_VERSION) < LooseVersion('3.0')
DJANGO_3_0 = LooseVersio... | divio/django-cms | cms/utils/compat/__init__.py | Python | bsd-3-clause | 545 |
from __future__ import unicode_literals
import re
from django import forms
from django.core.validators import RegexValidator
from django.db import models
from django.utils.translation import ugettext_lazy as _
class ColorInput(forms.TextInput):
input_type = 'color'
class ColorField(models.CharField):
defa... | misli/cmsplugin-survey | cmsplugin_survey/fields.py | Python | bsd-3-clause | 744 |
# -*- coding:utf-8 -*-
import random
import unittest
class TestSequenceFunctionsWorld(unittest.TestCase):
def setUp(self):
self.seq = range(10)
def test_shuffle(self):
# make sure the shuffled sequence does not lose any elements
random.shuffle(self.seq)
self.seq.sort()
... | mapix/utknows | examples/test_world.py | Python | bsd-3-clause | 860 |
#!/usr/bin/python2.5
#
# Copyright 2009 Roman Nurik
#
# 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... | frankk00/realtor | scripts/batch/live_interactive.py | Python | bsd-3-clause | 828 |
"""Operations for rigid rotations in Klampt. All rotations are
represented by a 9-list specifying the entries of the rotation matrix
in column major form.
In other words, given a 3x3 matrix
[a11,a12,a13]
[a21,a22,a23]
[a31,a32,a33],
Klamp't represents the matrix as a list [a11,a21,a31,a12,a22,a32,a13,a23,a33... | YilunZhou/Klampt | Python/klampt/math/so3.py | Python | bsd-3-clause | 11,505 |
# -*- coding: utf-8 -*-
"""
test_transaction.py
:copyright: (C) 2014-2015 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
import unittest
import datetime
import random
import authorize
from dateutil.relativedelta import relativedelta
from trytond.tests.te... | openlabs/payment-gateway-authorize-net | tests/test_transaction.py | Python | bsd-3-clause | 23,226 |
"""Computational algebraic number field theory. """
from sympy import (
S, Expr, I, Integer, Rational, Float,
Symbol, Add, Mul, sympify, Q, ask, Dummy,
)
from sympy.polys.polytools import (
Poly, PurePoly, sqf_norm, invert, factor_list, groebner,
)
from sympy.polys.polyutils import (
basic_from_dict,... | minrk/sympy | sympy/polys/numberfields.py | Python | bsd-3-clause | 15,000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.