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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from baseframe import __
from baseframe.forms import Form, MarkdownField
import wtforms
import wtforms.fields.html5
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from ..models import PROPOSALSTATUS
__all__ = ['ProposalForm', 'ProposalStatusForm']
class ProposalForm(Form):
sp... | jace/failconfunnel | funnel/forms/proposal.py | Python | bsd-2-clause | 3,581 |
# Copyright (c) 2017, MD2K Center of Excellence
# 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 conditio... | nasirali1/CerebralCortex | cerebralcortex/kernel/DataStoreEngine/Metadata/LoadMetadata.py | Python | bsd-2-clause | 12,562 |
# coding: UTF-8
import json
import logging
import re
from StringIO import StringIO
import threading
LEVELS = {
logging.NOTSET: '',
logging.DEBUG: '', # equals to 'log'
logging.INFO: 'info',
logging.WARNING: 'warn',
logging.ERROR: 'error',
logging.CRITICAL: 'error',
}
def _interleave(msg, args):
""" Returns a... | willywongi/py-browser-logging | browser_logging.py | Python | bsd-2-clause | 3,920 |
from django.db.models.manager import Manager
from query import CachedQuerySet
class CacheManager(Manager):
"""
A manager to store and retrieve cached objects using CACHE_BACKEND
<string key_prefix> -- the key prefix for all cached objects on this model. [default: db_table]
<int timeout> -- in seconds,... | dcramer/django-orm-cache | ormcache/manager.py | Python | bsd-2-clause | 1,190 |
#! /usr/bin/env python
#list.append(x)
#list.extend(L)
#list.insert(i,x)
#list.remove(x)
#list.pop([i])
#list.index(x)
#list.count(x)
#list.sort()
#list.reverse()
a = [66.25, 333, 333, 1, 1234.5]
print a.count(333), a.count(66.25), a.count("x")
a.insert(2,-1)
a.append(333)
print a
print a.index(333)
a.remove(333)... | xiongerqi/enki | sample/datastructure/dataStructure.py | Python | bsd-2-clause | 369 |
from flask import redirect, render_template, session, request
from oidc_rp import app, client
@app.route('/')
def index():
return render_template('index.html')
@app.route('/authenticate')
def authenticate():
redirect_url = client.authenticate(session)
return redirect(redirect_url)
@app.route('/repost_fra... | daserzw/oidcprimer | oidc-python-rp/oidc_rp/webserver.py | Python | bsd-2-clause | 1,225 |
# -*- coding: utf-8 -*-
import logging
from ambry.util import get_logger
logger = get_logger(__name__, level=logging.INFO, propagate=False)
from ambry.library.search_backends import WhooshSearchBackend, SQLiteSearchBackend, PostgreSQLSearchBackend
# All backends.
BACKENDS = {
'whoosh': WhooshSearchBackend,
'... | CivicKnowledge/ambry | ambry/library/search.py | Python | bsd-2-clause | 5,976 |
"""prawcore.sessions: Provides prawcore.Session and prawcore.session."""
import logging
import random
import time
from copy import deepcopy
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
from urllib.parse import urljoin
from requests.exceptions import ChunkedEncodingError, ConnectionError, R... | praw-dev/prawcore | prawcore/sessions.py | Python | bsd-2-clause | 11,648 |
#!/usr/bin/env python3
# Copyright (c) 2013, Ruslan Baratov
# All rights reserved.
import argparse
import os
import re
import subprocess
import sys
import tempfile
parser = argparse.ArgumentParser(
description="""
ios-sim launcher. Expected that application is gtest.
If output is looks like passe... | ruslo/sugar | python/ios_simulator_launcher.py | Python | bsd-2-clause | 4,227 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import StringIO
import hashlib
import logging
import os
import sys
import zipfile
try:
import magic
except ImportError:
pass
from pymongo import MongoClient
import gridfs
from utils import Config, get_type, put_file, get_chunks
JOBNAME = 'FILE2MONGODB'
# create l... | mboman/vxcage-utils | file2mongodb.py | Python | bsd-2-clause | 3,007 |
from __future__ import division
from .graph import StateNode, ActionNode
class Bellman(object):
"""
A dynamical programming update which resembles the Bellman equation
of value iteration.
See Feldman and Domshlak (2014) for reference.
"""
def __init__(self, gamma):
self.gamma = gamma
... | hildensia/mcts | mcts/backups.py | Python | bsd-2-clause | 1,222 |
##
# Securing:
# See: <http://www.debian.org/doc/manuals/securing-debian-howto/ch-sec-services.en.html>
#
# Tomcat on Debian:
# See: <http://www.itoperationz.com/2009/06/how-to-install-and-configure-apache-tomcat-6-on-debian-5/>
# See: <http://www.debian.org/doc/manuals/debian-java-faq/ch7.html#s-openjdk>
#
# Tomcat co... | rinfo/rdl | manage/fabfile/sysconf.py | Python | bsd-2-clause | 8,708 |
from twisted.internet.defer import inlineCallbacks, returnValue
from psycopg2 import IntegrityError
from battlesnake.plugins.contrib.pg_db.api import get_db_connection
from battlesnake.plugins.contrib.inventories.exceptions import \
InsufficientCbills
@inlineCallbacks
def mod_player_cbill_balance(player_dbref,... | gtaylor/btmux_battlesnake | battlesnake/plugins/contrib/inventories/cbill_api.py | Python | bsd-3-clause | 1,632 |
"""Partial dependence plots for tree ensembles. """
# Authors: Peter Prettenhofer
# License: BSD Style.
from itertools import count, izip
import numbers
import numpy as np
from scipy.stats.mstats import mquantiles
from ..utils.extmath import cartesian
from ..externals.joblib import Parallel, delayed
from ..utils ... | lucidfrontier45/scikit-learn | sklearn/ensemble/partial_dependence.py | Python | bsd-3-clause | 14,662 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import json
from django.contrib.admin.sites import AdminSite
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.utils.formats import date_format
from django.utils.http import urle... | dinoperovic/djangoshop-shopit | example/tests/admin/test_product_admin.py | Python | bsd-3-clause | 10,954 |
# 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.
from telemetry import multi_page_benchmark_unittest_base
from telemetry import page
from perf_tools import smoothness_benchmark
from telemetry.page_bench... | nacl-webkit/chrome_deps | tools/perf/perf_tools/smoothness_benchmark_unittest.py | Python | bsd-3-clause | 4,138 |
"""Auto-generated file, do not edit by hand. SD metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_SD = PhoneMetadata(id='SD', country_code=249, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[19]\\d{8}', possible_number_pattern='\\... | vicky2135/lucious | oscar/lib/python2.7/site-packages/phonenumbers/data/region_SD.py | Python | bsd-3-clause | 1,111 |
from __future__ import absolute_import
__all__ = ['DocSection', 'Endpoint', 'StatsMixin']
import logging
import time
from datetime import datetime, timedelta
from django.conf import settings
from django.utils.http import urlquote
from django.views.decorators.csrf import csrf_exempt
from enum import Enum
from pytz im... | mitsuhiko/sentry | src/sentry/api/base.py | Python | bsd-3-clause | 7,981 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Usage:
curl ... | ./serialize_county.py
cat support/example.html | ./serialize_county.py
"""
from __future__ import unicode_literals
import json
import sys
from lxml.html import document_fromstring
def groupby_by_two(iterable):
"""
chunk iterable into gr... | texastribune/tx_election_scrapers | tx_elections_scrapers/sos/serialize_county.py | Python | bsd-3-clause | 3,836 |
import networkx as nx
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.lines as lines
mpl.rcParams['patch.antialiased'] = True
mpl.rcParams['lines.antialiased'] = True
# create graph
G = nx.Graph()
G.add_edge(1, 2)
G.add_edge(1, 3)
G.add_edge(1, 5)
G.add_... | numpy/numpy.org | static/images/content_images/sc_dom_img/graph.py | Python | bsd-3-clause | 1,015 |
from sympy import Eq, factorial, Function, Lambda, rf, S, sqrt, symbols, I, \
expand_func, binomial, gamma, Rational
from sympy.solvers.recurr import rsolve, rsolve_hyper, rsolve_poly, rsolve_ratio
from sympy.utilities.pytest import raises, slow
from sympy.core.compatibility import range
from sympy.abc import a, b
... | kaushik94/sympy | sympy/solvers/tests/test_recurr.py | Python | bsd-3-clause | 7,439 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from doct import Document
from jsonschema import validate as js_validate
import uuid
import time as ttime
class DatumNotFound(Exception):
pass
def doc_or_uid_to_uid(doc_or_uid):
"""Given ... | ericdill/fileStore | filestore/core.py | Python | bsd-3-clause | 6,001 |
#!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
"""
rst_slideoutline
"""
from collections import OrderedDict
from itertools import count
from pprint import pprint
import networkx
# edge types
# document -> hasSection -> Section
# item -> hasSection -> Section
# item -> hasKw -> kw
# item... | westurner/rst-tools | rst_tools/rst_slideoutline.py | Python | bsd-3-clause | 3,705 |
from sqlalchemy.testing import eq_, assert_raises, assert_raises_message
from sqlalchemy.testing import fixtures
from sqlalchemy import Integer, String, ForeignKey, or_, and_, exc, \
select, func, Boolean, case
from sqlalchemy.orm import mapper, relationship, backref, Session, \
joinedload, aliased
from sqlalch... | Abi1ity/uniclust2.0 | SQLAlchemy-0.9.9/test/orm/test_update_delete.py | Python | bsd-3-clause | 27,757 |
from django.contrib import admin
from models import License, Submission, Revision, TagCreation, ZipFile
class LicenseAdmin(admin.ModelAdmin):
list_display = ('name', 'description')
class SubmissionAdmin(admin.ModelAdmin):
list_display = ('sub_type', 'slug', 'created_by', 'date_created',
'n... | oswalpalash/OctaveCodeShare | scipy_central/submission/admin.py | Python | bsd-3-clause | 1,095 |
import csv
import copy
class Field(object):
def __init__(self, name):
self.__name = name
def name(self):
return self.__name
class Time(Field):
def __init__(self, isStart):
self.__isStart = isStart
name = 'Start Time' if isStart else 'End Time'
super(Time, self).__i... | LoneKirov/PyTrace | pytrace/command_statistics.py | Python | bsd-3-clause | 3,632 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
models = class_gen.get_models()
datasets = class_gen.get_datasets()
dialects = ["db2", "hive", "mssql", "mysql", "oracle", "postgresql", "sqlite"];
for model in models.keys():
for ds in datasets.keys():
print("TRAINING_MODEL" , mod... | antoinecarme/sklearn2sql_heroku | tests/classification/test_client_many_class_models.py | Python | bsd-3-clause | 505 |
"""
>>> from blaze.expr import symbol
>>> from blaze.compute.pandas import compute
>>> accounts = symbol('accounts', 'var * {name: string, amount: int}')
>>> deadbeats = accounts[accounts['amount'] < 0]['name']
>>> from pandas import DataFrame
>>> data = [['Alice', 100], ['Bob', -50], ['Charlie', -20]]
>>> df = Data... | maxalbert/blaze | blaze/compute/pandas.py | Python | bsd-3-clause | 16,350 |
from __future__ import absolute_import
from django.db import IntegrityError, transaction
from rest_framework.negotiation import DefaultContentNegotiation
from rest_framework.parsers import FormParser, MultiPartParser
from rest_framework.response import Response
from sentry.api.base import DocSection
from sentry.api.b... | jokey2k/sentry | src/sentry/api/endpoints/release_files.py | Python | bsd-3-clause | 3,206 |
'''
Module to store conda build settings.
'''
from __future__ import absolute_import, division, print_function, unicode_literals
import copy
from collections import namedtuple
import math
import os
from os.path import abspath, expanduser, join, expandvars
import shutil
import sys
import time
from .conda_interface imp... | pelson/conda-build | conda_build/config.py | Python | bsd-3-clause | 32,303 |
# use time() instead on unix
import sys
if sys.platform=='win32':
from time import clock
else:
from time import time as clock
from sympycore import profile_expr
def time1(n=5):
from sympycore import Symbol, sin
x,y,z = map(Symbol,'xyz')
f = (x / (1+sin(x**(y+x**2)))**2)
t1 = clock()
while... | pearu/sympycore | research/test_diff.py | Python | bsd-3-clause | 1,060 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['MovingAverage'] , ['Seasonal_Minute'] , ['MLP'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_None/model_control_one_enabled_None_MovingAverage_Seasonal_Minute_MLP.py | Python | bsd-3-clause | 157 |
import matplotlib.cm as cm
import numpy
import pylab
import operator, copy, os
from myternaryutility import TernaryPlot
from myquaternaryutility import QuaternaryPlot
from quaternary_FOM_bintern import *
gridi=30
comps_10full=[(a*1./gridi, b*1./gridi, c*1./gridi, (gridi-a-b-c)*1./gridi) for a in numpy.arange(0,1+g... | johnmgregoire/PythonCompositionPlots | quaternary_FOM_bintern_demo.py | Python | bsd-3-clause | 1,255 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myhpom', '0009_advancedirective'),
]
operations = [
migrations.CreateModel(
name='StateRequirement',
... | ResearchSoftwareInstitute/MyHPOM | myhpom/migrations/0010_state_requirements.py | Python | bsd-3-clause | 1,703 |
# -*- coding: utf-8; mode: Python; -*-
#
# [Distutils] [issue152] setuptools breaks
# with from __future__ import unicode_literals in setup.py
#
# from __future__ import unicode_literals
import os
import re
import sys
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
def... | peterdv/pyreststore | setup.py | Python | bsd-3-clause | 2,607 |
"""Views
Notes:
* Some views are marked to avoid csrf tocken check because they rely
on third party providers that (if using POST) won't be sending csrf
token back.
"""
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib.auth import login, REDIRECT_FIELD_NAME
from django.cont... | antoviaque/django-social-auth-norel | social_auth/views.py | Python | bsd-3-clause | 7,179 |
from setuptools import setup, find_packages
setup(
name='django-waffle',
version='0.9.1',
description='A feature flipper for Django.',
long_description=open('README.rst').read(),
author='James Socol',
author_email='james.socol@gmail.com',
url='http://github.com/jsocol/django-waffle',
li... | 11craft/django-waffle | setup.py | Python | bsd-3-clause | 867 |
# coding=utf-8
from . import CATALOGS_USE_SOCIAL_GRAPH
if CATALOGS_USE_SOCIAL_GRAPH:
from django.utils.translation import ugettext_lazy as _
from .filters import Filter, MultipleArgumentFilterMixin
def inverse(et):
from social_graph.models import EdgeTypeAssociation
return EdgeTypeAssociat... | suselrd/django-catalog-wizard | catalog/graph_filters.py | Python | bsd-3-clause | 10,052 |
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
from algolib.segment_tree import segment_tree
from algolib.segment_tree import segment_tree_flex
from algolib.segment_tree import lazy_segment_tree
from algolib.segment_tree import lazy_segment_tree_flex
| niemmi/algolib | tests/segment_tree/context.py | Python | bsd-3-clause | 271 |
#!/usr/bin/python
# Origin: https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code
import smbus
# ===========================================================================
# Adafruit_I2C Base Class
# ===========================================================================
class Adafruit_I2C :
def __in... | melvon22/weather-station | Adafruit_I2C.py | Python | bsd-3-clause | 3,354 |
#!/usr/bin/env python2.7
# Python 2.7 version by Alex Eames of http://RasPi.TV
# functionally similar to the Gertboard motor test by
# Gert Jan van Loo & Myra VanInwegen
# Use at your own risk - I'm pretty sure the code is harmless, check it yourself
# This is the WiringPi for Python version which uses hardware PWM
... | barfle/scalextric | test/motor-wp.py | Python | bsd-3-clause | 3,538 |
import sys, time, os
import settings # 設定の読み込み
from mini_batch_loader import DatasetPreProcessor
from fcn_squeeze_dilate import FCN
import chainer
import chainer.functions as F
from chainer import serializers
from chainer import cuda, optimizers, Variable
import numpy as np
np.random.seed(555)
from skimage import io... | ghmagazine/chainerbook | ch6/train.py | Python | bsd-3-clause | 3,340 |
from datetime import datetime
from dateutil import parser
from ffflash.lib.clock import get_iso_timestamp
def test_get_iso_timestamp_dt_passed():
now = datetime.now()
utcnow = datetime.utcnow()
assert parser.parse(get_iso_timestamp(now)) == now
assert parser.parse(get_iso_timestamp(utcnow)) == utcn... | spookey/ffflash | tests/lib/clock/test_get_iso_timestamp.py | Python | bsd-3-clause | 584 |
from setuptools import setup, find_packages
setup(
name="textprocessor",
version="0.2.0",
author="Fabien Schwob",
license="BSD",
url="http://github.com/jibaku/django-textprocessor",
description="""
Templatetags and filter to process text (string) to enhance link (add
link, check typogra... | jibaku/django-textprocessor | setup.py | Python | bsd-3-clause | 798 |
def extractReadingAttic(item):
"""
Reading Attic
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
if 'A Tale of Two Phoenixes (凤囚凰)' in item['tags']:
return buildReleaseMessageWithType(item, 'A Tale of ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractReadingAttic.py | Python | bsd-3-clause | 708 |
# -*- coding: utf-8 -*-
########################################################################
#
# License: BSD
# Created: June 15, 2005
# Author: Antonio Valentino
# Modified by: Francesc Alted
#
# $Id$
#
########################################################################
"""Here is defined the CArray class."... | tp199911/PyTables | tables/carray.py | Python | bsd-3-clause | 10,431 |
"""
The script handler makes sure to check through all stored scripts
to make sure they are still relevant.
A scripthandler is automatically added to all game objects. You
access it through the property `scripts` on the game object.
"""
from evennia.scripts.models import ScriptDB
from evennia.utils import create
from ... | mrkulk/text-world | evennia/scripts/scripthandler.py | Python | bsd-3-clause | 4,615 |
import datetime
import decimal
import json
import traceback
from django.conf import settings
from django.core.mail import EmailMessage
from django.db import models
from django.utils import timezone
from django.template.loader import render_to_string
from django.contrib.sites.models import Site
import stripe
from js... | grue/django-stripe-payments | payments/models.py | Python | bsd-3-clause | 32,579 |
import os
import libtaxii
project = u'libtaxii'
copyright = u'2014, The MITRE Corporation'
version = libtaxii.__version__
release = version
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.ifconfig',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',... | Intelworks/libtaxii | docs/conf.py | Python | bsd-3-clause | 942 |
from __future__ import unicode_literals
import sys
import unittest
from datetime import datetime
from django.utils import http, six
from django.utils.datastructures import MultiValueDict
class TestUtilsHttp(unittest.TestCase):
def test_same_origin_true(self):
# Identical
self.assertTrue(http.sa... | devops2014/djangosite | tests/utils_tests/test_http.py | Python | bsd-3-clause | 7,593 |
VERSION = (0, 2, 0, 'beta', 1)
__author__ = u'Daniel Barreto'
__credits__ = [u'Atamert \xd6l\xe7gen']
__license__ = 'BSD'
__maintainer__ = u'Daniel Barreto'
__email__ = 'daniel.barreto.n@gmail.com'
__status__ = 'Beta'
def get_version(version=VERSION):
"Returns a PEP 386-compliant version number from VERSION."
... | TyVik/django-invitation-backend | invitation/__init__.py | Python | bsd-3-clause | 917 |
# Copyright (c) 2015-2019, Activision Publishing, 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:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of ... | ActivisionGameScience/assertpy | tests/test_type.py | Python | bsd-3-clause | 3,943 |
import smtplib, time,os,datetime
from email.mime.text import MIMEText
from email.header import Header
from toolkit import Toolkit
from email.mime.multipart import MIMEMultipart
from email import Encoders, Utils
from toolkit import Toolkit
import tushare as ts
from pandas import Series
import matplotlib.pyplot as plt
im... | FrederichRiver/neutrino | applications/jupiter/jupiter/message_manager.py | Python | bsd-3-clause | 7,422 |
import unittest
from Src.BioDataManagement.CrossCutting.DTOs.DnaMethylationLevelDto import DnaMethylationLevelDto
from Src.BioDataManagement.CrossCutting.DTOs.DnaMethylationSampleDto import DnaMethylationSampleDto
class MessengerRnaSampleDtoTest(unittest.TestCase):
def test_instance(self):
dna_methylatio... | cemarchi/biosphere | Tests/BioDataManagement/CrossCutting/DTOs/DnaMethylationSampleDtoTest.py | Python | bsd-3-clause | 9,887 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sanic_rest import status
__author__ = 'costular'
class BaseAPIException(Exception):
"""
Base class for Sanic Rest exceptions
"""
status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
message = 'Internal Error'
def __init__(self, status_code=No... | costular/sanic-rest | sanic_rest/exceptions.py | Python | bsd-3-clause | 990 |
"""
"Safe weakrefs", originally from pyDispatcher.
Provides a way to safely weakref any function, including bound methods (which
aren't handled by the core weakref module).
"""
import weakref
import traceback
def safe_ref(target, on_delete=None):
"""Return a *safe* weak reference to a callable target
:para... | mitsuhiko/celery | celery/utils/dispatch/saferef.py | Python | bsd-3-clause | 10,757 |
# # product
import logging
from django.contrib import messages
from django.contrib.auth.decorators import user_passes_test
from django.urls import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render
from dojo.utils import add_breadcrumb
from dojo.forms import ToolTypeForm
from doj... | OWASP/django-DefectDojo | dojo/tool_type/views.py | Python | bsd-3-clause | 2,655 |
from collections import namedtuple
import numpy as np
from numpy.testing import assert_equal
from numpy.testing.decorators import skipif
from skimage import data
from skimage.viewer import ImageViewer, viewer_available
from skimage.viewer.canvastools import (
LineTool, ThickLineTool, RectangleTool, PaintTool)
from... | SamHames/scikit-image | skimage/viewer/tests/test_tools.py | Python | bsd-3-clause | 6,018 |
try:
import Tkinter as tk
except:
import tkinter as tk
'''
Multi-column listbox widget
based on Juan Ramirez activestate recipe 578805 updated to python 3.x
usage: lists can be a list of 3-tuples each denoting a column with
( Title, Width, Stickie )
TODO: Use draggable PanedWindow not Frames, see... | rutherford/tikitiki | tikitiki/multilistbox.py | Python | bsd-3-clause | 5,044 |
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DOCKER_IMAGE = 'gcr.io/skia-public/emsdk-base:2.0.20_v1'
INNER_BUILD_SCRIPT = '/SRC/skia/infra/pathkit/build_pathkit.sh'
def compile_fn(api, checkout_root, ... | youtube/cobalt | third_party/skia_next/third_party/skia/infra/bots/recipe_modules/build/pathkit.py | Python | bsd-3-clause | 3,700 |
# [h] print selected glyphs
# import
from mojo.roboFont import CurrentFont
from vanilla import *
from hTools2 import hDialog
from hTools2.modules.fontutils import print_selected_glyphs, get_glyphs
from hTools2.modules.messages import no_font_open, no_glyph_selected
# objects
class printGlyphsDialog(hDialog):
... | gferreira/hTools2_extension | hTools2.roboFontExt/lib/hTools2/dialogs/glyphs/names_print.py | Python | bsd-3-clause | 2,348 |
"""
Pandoc filter using panflute
"""
import panflute as pf
def prepare(doc):
pf.debug(f' Pandoc version: {doc.pandoc_version}')
pf.debug(' Pandoc reader options:')
for k, v in doc.pandoc_reader_options.items():
pf.debug(f' {k}={v}')
assert doc.pandoc_version >= (2, 11, 0)
standalone... | sergiocorreia/panflute | tests/filters/assert_env.py | Python | bsd-3-clause | 892 |
from __future__ import absolute_import
from django.conf.urls.defaults import *
from .views import request_token, user_authorization, access_token, revoke_token
urlpatterns = patterns('',
url(r'^request_token/$', request_token, name='oauth_request_token'),
url(r'^authorize/$', user_authorizatio... | mdales/django-oauth | urls.py | Python | bsd-3-clause | 518 |
"""Auto-generated file, do not edit by hand. GG metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_GG = PhoneMetadata(id='GG', country_code=44, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[135789]\\d{6,9}', possible_number_patter... | vicky2135/lucious | oscar/lib/python2.7/site-packages/phonenumbers/data/region_GG.py | Python | bsd-3-clause | 2,163 |
import os
import json
CONFFILE = os.path.join(os.getenv('HOME'), '.nuborc')
def read_config():
try:
return json.loads(open(CONFFILE).read())
except IOError:
return {}
def write_config(values):
old_values = read_config()
updated = dict(old_values.items() + values.items())
open(CON... | ema/nubo | nubo/config.py | Python | bsd-3-clause | 418 |
colors = {
"default": 0,
"black":30,
"red":31,
"green":32,
"yellow":33,
"blue":34,
"magenta":35,
"cyan":36,
"white":37,
"black":38,
"black":39
}
def colorize(text, color, bright=False, default_color="default"):
if bright:
bright_int = 1
else:
... | flupke/pyflu | pyflu/shell_color.py | Python | bsd-3-clause | 453 |
from twisted.plugin import IPlugin
from txircd.module_interface import IModuleData, ModuleData
from zope.interface import implements
class ExtendedJoin(ModuleData):
implements(IPlugin, IModuleData)
name = "ExtendedJoin"
def actions(self):
return [ ("capabilitylist", 10, self.addCapability),
("joinm... | ElementalAlchemist/txircd | txircd/modules/ircv3/extendedjoin.py | Python | bsd-3-clause | 1,635 |
import os
from Structures.ProteinEntity import ProteinEntity
from Structures.PDBInfo import PDBInfo
from Parsers.PDBCoordsParser import PDBCoordsParser
class Structure(ProteinEntity):
"""
The Structure class contains a collection of Model instances.
"""
def __init__(self, filename, id=None):... | q10/fiddle | python/Structures/Structure.py | Python | bsd-3-clause | 2,198 |
# -*- coding:utf-8 -*-
"""
交易数据接口
Created on 2014/07/31
@author: Jimmy Liu
@group : waditu
@contact: jimmysoa@sina.cn
"""
from __future__ import division
import time
import json
import lxml.html
from lxml import etree
import pandas as pd
import numpy as np
from tushare.stock import cons as ct
from p... | buptlishantao/stock | tushare/stock/trading.py | Python | bsd-3-clause | 20,412 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.db.models import F
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# Note: Remember to use orm['appname.ModelNam... | rdio/sentry | src/sentry/migrations/0081_fill_trackeduser.py | Python | bsd-3-clause | 23,747 |
from allauth.account.models import EmailAddress
from allauth.account.models import EmailConfirmation
from allauth.socialaccount.models import SocialApp, SocialToken, SocialAccount
from allauth.socialaccount.providers.openid.admin import OpenIDNonceAdmin
from allauth.socialaccount.providers.openid.admin import OpenIDSt... | mverleg/svsite | source/member/admin.py | Python | bsd-3-clause | 5,113 |
# point.post.py
#
# Code that executes in the point module *after* LLVM binding
print "Decorating"
def decorate(func):
def wrapper(*args, **kwargs):
print "Calling", func.__name__
return func(*args, **kwargs)
return wrapper
distance = decorate(distance)
| dabeaz/bitey | examples/advanced/point.post.py | Python | bsd-3-clause | 281 |
"""A more liberal autolinker
Inspired by Django's urlize function.
Positive examples:
>>> import markdown
>>> md = markdown.Markdown(extensions=['urlize'])
>>> md.convert('http://example.com/')
u'<p><a href="http://example.com/">http://example.com/</a></p>'
>>> md.convert('go to http://example.com')
u'<p>go to <a ... | dreikanter/public-static | publicstatic/urlize.py | Python | bsd-3-clause | 2,224 |
from test import support
from test.support import import_helper
support.requires('audio')
from test.support import findfile
ossaudiodev = import_helper.import_module('ossaudiodev')
import errno
import sys
import sunau
import time
import audioop
import unittest
# Arggh, AFMT_S16_NE not defined on all platforms -- se... | brython-dev/brython | www/src/Lib/test/test_ossaudiodev.py | Python | bsd-3-clause | 7,271 |
# -*- coding:utf-8 -*-
import gettext
import json
import os
from os import path
import unittest
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import (
LiveServerTestCase, TestCase, modify_settings, override_settings)
from django.utils import six
from django.utils._o... | jarvys/django-1.7-jdb | tests/view_tests/tests/test_i18n.py | Python | bsd-3-clause | 11,139 |
from django.contrib import admin
from e1337cms.models import Page
class PageAdmin(admin.ModelAdmin):
list_display = ('title', 'published', )
search_fields = ['title', 'content', ]
prepopulated_fields = {"slug": ("title",)}
admin.site.register(Page, PageAdmin) | DNX/django-e1337cms | e1337cms/admin.py | Python | bsd-3-clause | 273 |
from info import __doc__
from numpy.version import version as __version__
import multiarray
import umath
import _internal # for freeze programs
import numerictypes as nt
multiarray.set_typeDict(nt.sctypeDict)
import _sort
from numeric import *
from fromnumeric import *
from defmatrix import *
import ma
import defchar... | santisiri/popego | envs/ALPHA-POPEGO/lib/python2.5/site-packages/numpy-1.0.4-py2.5-linux-x86_64.egg/numpy/core/__init__.py | Python | bsd-3-clause | 856 |
# pylint: disable=I0011,W0613,W0201,W0212,E1101,E1103
from __future__ import absolute_import, division, print_function
from distutils.version import LooseVersion
import tempfile
import io
import os
import sys
import pytest
from mock import patch, MagicMock
import numpy as np
try:
from IPython import __version__... | JudoWill/glue | glue/qt/tests/test_application.py | Python | bsd-3-clause | 6,915 |
#!/usr/bin/env python
GEVENT = False
from regs_common.exceptions import *
from regs_models import *
from optparse import OptionParser
import json, urllib, urllib2, os, re, datetime
from pyquery import PyQuery as pq
import dateutil.parser
import jellyfish
# arguments
arg_parser = OptionParser()
arg_parser.add_optio... | sunlightlabs/regulations-scraper | regscrape/regs_common/commands/annotate_fr_docs.py | Python | bsd-3-clause | 8,946 |
# -*- coding: utf-8 -*-
import logging
from easy_thumbnails.conf import settings
from easy_thumbnails.templatetags import thumbnail as _thumbnail
from django_jinja import library
from functools import wraps
logger = logging.getLogger(__name__)
def debug_silence(error_output=''):
def inner(fn):
@wraps(f... | glogiotatidis/django-jinja | django_jinja/contrib/_easy_thumbnails/templatetags/thumbnails.py | Python | bsd-3-clause | 1,238 |
# '/path/with/gctx/files/to/test/*gct*' refers to a directory of GCT and/or GCTX files to time parsing operations on.
# Cache was cleared in between consecutive operations.
import time
import pandas as pd
import glob
import cmapPy.pandasGEXpress.parse as parse
# for storing timing results
parse_times = {}
# input ... | cmap/cmapPy | performance_testing/python_parse_timing.py | Python | bsd-3-clause | 711 |
##########################################################################
#
# Copyright (c) 2016, Image Engine Design 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:
#
# * Redistrib... | chippey/gaffer | python/GafferAppleseed/AppleseedShaderBall.py | Python | bsd-3-clause | 4,217 |
default_app_config = 'blanc_basic_assets.apps.BlancBasicAssetsConfig'
| blancltd/blanc-basic-assets | blanc_basic_assets/__init__.py | Python | bsd-3-clause | 70 |
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 = "None", sigma = 0.0, exog_count = 0, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_None/trend_MovingAverage/cycle_30/ar_12/test_artificial_1024_None_MovingAverage_30_12_0.py | Python | bsd-3-clause | 265 |
import os
from django import http
from django.db.transaction import non_atomic_requests
from django.shortcuts import get_object_or_404, redirect
import olympia.core.logger
from olympia import amo
from olympia.access import acl
from olympia.addons.decorators import (
addon_view_factory, owner_or_unlisted_reviewer... | psiinon/addons-server | src/olympia/versions/views.py | Python | bsd-3-clause | 5,550 |
from __future__ import absolute_import
from functools import partial
from copy import deepcopy
from rest_framework.response import Response
from sentry.api.bases.organization import OrganizationPermission
from sentry.api.bases import OrganizationEndpoint
from sentry.api.paginator import GenericOffsetPaginator
from s... | mvaled/sentry | src/sentry/discover/endpoints/discover_query.py | Python | bsd-3-clause | 6,200 |
from __future__ import print_function
import doctest
import os
import pytest
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
DOCS_DIRS = [PROJECT_ROOT, os.path.join(PROJECT_ROOT, 'doc')]
@pytest.mark.parametrize("path", [
os.path.join(path, filename)
for path in DOCS_DIRS
... | vmalloc/pact | tests/test_doctests.py | Python | bsd-3-clause | 765 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from datetime import datetime
from django.core.exceptions import ValidationError
from django.utils.dateparse import parse_datetime
from django.utils.timezone import make_aware
from shopit.models.cart import CartItem
from shopit.models.c... | dinoperovic/djangoshop-shopit | example/tests/models/test_product_models.py | Python | bsd-3-clause | 13,604 |
from urllib import urlencode, quote
from urlparse import urlparse, urlunparse
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404, HttpResponse
from django.shortcuts import render_to_response
from django.utils import simplejson as json
from google.appengine.ext import db
... | justinabrahms/permachart | permachart/charter/views.py | Python | bsd-3-clause | 6,463 |
"""Word2vec plug-in module.
This module provides functionality needed to work with word2vec files.
"""
from typing import Callable, List
import numpy as np
from typeguard import check_argument_types
from neuralmonkey.vocabulary import Vocabulary, SPECIAL_TOKENS
class Word2Vec:
def __init__(
self,... | ufal/neuralmonkey | neuralmonkey/util/word2vec.py | Python | bsd-3-clause | 2,937 |
#!/usr/bin/env python3
# Copyright 2017 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.
"""Merges dependency Android manifests into a root manifest."""
import argparse
import contextlib
import os
import sys
import tempfi... | youtube/cobalt | build/android/gyp/merge_manifest.py | Python | bsd-3-clause | 5,352 |
# Django settings for django_hautomation_suite project.
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
#used by the haweb to find the REST API server
HA_SERVER = "HA_REST_API_HOST"
HA_PASSWORD = "HA_REST_API_PASSWORD"
HA_USERNAME = "HA_REST_API_USE... | jpardobl/django-hautomation-suite | django_hautomation_suite/django_hautomation_suite/distro_settings.py | Python | bsd-3-clause | 3,064 |
"""
byceps.services.metrics.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from __future__ import annotations
from dataclasses import dataclass, field
@dataclass(frozen=True)
class Label:
name: str
value: str
d... | homeworkprod/byceps | byceps/services/metrics/models.py | Python | bsd-3-clause | 1,167 |
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
# All rights reserved.
#------------------------------------------------------------------------------
import datetime
from atom.api import Atom, Str, Range, Bool, Value, Int, Tuple, observ... | ContinuumIO/ashiba | enaml/examples/tutorial/employee/employee.py | Python | bsd-3-clause | 2,115 |
from django.utils.encoding import smart_str
from . import settings
class WaffleMiddleware(object):
def process_response(self, request, response):
secure = settings.SECURE
max_age = settings.MAX_AGE
if hasattr(request, 'waffles'):
for k in request.waffles:
name... | mwaaas/django-waffle-session | waffle/middleware.py | Python | bsd-3-clause | 1,016 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from users import views
# URL patterns for Users
urlpatterns = patterns('',
# URL pattern for the UserListView
url(
regex=r'^$',
view=views.UserListView.as_view(),
name='list'
),
# URL pattern for the UserRedir... | neiljdo/readysaster-icannhas-web | readysaster-icannhas-web/users/urls.py | Python | bsd-3-clause | 954 |
# Django settings for chatbot project.
from os import environ
from urlparse import urlparse
import os.path
import sys
#DEBUG = True
#TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'pos... | vkreddy/chatbot | chatbot/settings.py | Python | bsd-3-clause | 6,741 |
# -*- coding: utf-8 -*-
import argparse
import logging
import sys
from collections import namedtuple
from rawdisk.util.logging import setup_logging
from rawdisk.session import Session
from rawdisk.scheme.common import PartitionScheme
def parse_args(args):
parser = argparse.ArgumentParser()
parser.add_argume... | dariusbakunas/rawdisk | rawdisk/main.py | Python | bsd-3-clause | 2,098 |
from django import template
register = template.Library()
@register.filter
def get(h, key):
return h[key]
@register.inclusion_tag('cvinterface/requests/form_fields_snippet.html')
def print_field(field):
return {'field': field} | ODM2/ODM2ControlledVocabularies | src/odm2cvs/cvinterface/templatetags/tools.py | Python | bsd-3-clause | 239 |
import os
from twisted.internet.error import ConnectionRefusedError
from twisted.internet.defer import inlineCallbacks, returnValue
import pika
try:
# Handle django settings if they use django.
from django.conf import settings
except ImportError:
# If django not used, fall back to environment variables
... | gdoermann/classymq | classymq/common.py | Python | bsd-3-clause | 2,412 |