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 |
|---|---|---|---|---|---|
#
# Generated by TigerShark.tools.convertPyX12 on 2012-07-10 16:29:58.682345
#
from tigershark.X12.parse import Message, Loop, Segment, Composite, Element, Properties
parsed_277U_HEADER = Loop( u'HEADER', Properties(looptype=u'wrapper',repeat=u'1',pos=u'015',req_sit=u'R',desc=u'Table 1 - Header'),
Segment( u'BHT', Prop... | jdavisp3/TigerShark | tigershark/parsers/M277U_4010_X070.py | Python | bsd-3-clause | 49,720 |
# -*- coding:utf-8 -*-
import os
import webbrowser
import wx
import wx.richtext as rt
import wx.lib.scrolledpanel as scrolled
import wx.lib.platebtn as platebtn
import StickyNote
class NoteWidget(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, style = wx.BORDER_THEME)
self.S... | DrsExplorer/StickyNotes | src/StickyNoteBook.py | Python | bsd-3-clause | 3,157 |
#!/usr/bin/env python
import os
import sys
try:
from setuptools import setup, Command
except ImportError:
from distutils.core import setup, Command
version = "1.0.1"
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
os.system('python setup.py bdist_wheel upload')
sys.exit()... | jhermann/cookiecutter | setup.py | Python | bsd-3-clause | 3,212 |
from __future__ import division
from .base import Equation
class KDV(Equation):
"""
The equation is : -c*u + 3/4u^2 + (u + 1/6u")=0
"""
def degree(self):
return 2
def compute_kernel(self, k):
return 1.0-1.0/6*k**2
def flux(self, u):
return 0.75*u*u
def flux_p... | olivierverdier/SpecTraVVave | travwave/equations/kdv.py | Python | bsd-3-clause | 676 |
from ev import Command, CmdSet
from src.commands.default.muxcommand import MuxCommand
class CmdAttack(Command):
"""
Begin to fight a target, typically an npc enemy.
Usage:
attack target-name
"""
key = 'attack'
aliases = ['kill']
help_category = "Combat"
locks = "cmd:all()"
... | GhostshipSoftware/avaloria | game/gamesrc/commands/world/character_commands.py | Python | bsd-3-clause | 7,180 |
from jinja2 import escape
from flask.globals import _request_ctx_stack
from flask import json
from wtforms import widgets
from mytrade.utils import _, get_url
class Select2Widget(widgets.Select):
"""
`Select2 <https://github.com/ivaynberg/select2>`_ styled select widget.
You must include select2... | hellwen/mytrade | mytrade/form/widgets.py | Python | bsd-3-clause | 8,982 |
#!/usr/bin/python
#
# Copyright 2014-2015 Facebook, 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 l... | rtrouton/Recipes-for-AutoPkg | android_sdk/AndroidExtraXMLParser.py | Python | bsd-3-clause | 5,235 |
def extractGhosttouchWordpressCom(item):
'''
Parser for 'ghosttouch.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loi... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractGhosttouchWordpressCom.py | Python | bsd-3-clause | 560 |
from web import views
if __name__ == "__main__":
views.app.run(debug=True)
| pythonLearning-bigData/Snail | run.py | Python | bsd-3-clause | 80 |
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.html import strip_tags
from django.utils.safestring import mark_safe
from django.core.exceptions import ValidationError
from make_mozilla.... | mozilla/make.mozilla.org | make_mozilla/pages/models.py | Python | bsd-3-clause | 5,208 |
"""
Query subclasses which provide extra functionality beyond simple data retrieval.
"""
from django.core.exceptions import FieldError
from django.db import connections
from django.db.models.sql.constants import *
from django.db.models.sql.datastructures import Date
from django.db.models.sql.expressions import SQLEval... | t11e/django | django/db/models/sql/subqueries.py | Python | bsd-3-clause | 7,675 |
"""
Test if Matplotlib is using PyQt4 as backend
"""
def test_matplotlib_qt_backend():
print ("testing matplotlib qt backend ...")
try:
# Matplot changed its file structure several times in history, so we
# must test all
try:
from matplotlib.backends.qt_compat import QtCore... | jjhelmus/artview | tests/qt.py | Python | bsd-3-clause | 1,431 |
from __future__ import print_function
from __future__ import division
import hoomd
import pytest
import numpy as np
import hoomd.hpmc.pytest.conftest
def test_before_attaching():
xmax = 0.02
dx = 1e-4
sdf = hoomd.hpmc.compute.SDF(xmax=xmax, dx=dx)
assert np.isclose(sdf.xmax, xmax)
assert np.isclos... | joaander/hoomd-blue | hoomd/hpmc/pytest/test_compute_sdf.py | Python | bsd-3-clause | 8,801 |
#!/usr/bin/python3
import sys
if len(sys.argv)!=4:
print("Usage: %s infile outfile num"%sys.argv[0])
sys.exit(0)
infile = open(sys.argv[1], "r")
outfile = open(sys.argv[2], "w")
num = float(sys.argv[3])
cont = True
while cont:
curnum = ""
c = infile.read(1)
while c!=" " and c!="":
curnum+=c
... | rhaps0dy/os-experiments | p1/RWNums.py | Python | bsd-3-clause | 516 |
import functools
import unittest2
from sentry import app
from sentry.db import get_backend
def with_settings(**settings):
def wrapped(func):
@functools.wraps(func)
def _wrapped(*args, **kwargs):
defaults = {}
for k, v in settings.iteritems():
defaults[k] = a... | dcramer/sentry-old | tests/__init__.py | Python | bsd-3-clause | 1,088 |
# -*- coding: utf-8 -*-
"""Tests for cookiecutter's output directory customization feature."""
import pytest
from cookiecutter import main
@pytest.fixture
def context():
"""Fixture to return a valid context as known from a cookiecutter.json."""
return {
u'cookiecutter': {
u'email': u'ra... | luzfcb/cookiecutter | tests/test_specify_output_dir.py | Python | bsd-3-clause | 1,852 |
from __future__ import with_statement
import datetime
import logging
import pytz
import rdflib
from django.conf import settings
from humfrey.update.transform.base import Transform
from humfrey.update.uploader import Uploader
from humfrey.sparql.endpoint import Endpoint
from humfrey.utils.namespaces import NS
logge... | ox-it/humfrey | humfrey/update/transform/upload.py | Python | bsd-3-clause | 2,982 |
# python
from distutils.core import setup
setup(
name = 'zplot',
packages = ['zplot'],
version = '1.41',
description = 'A simple graph-creation library',
author = 'Remzi H. Arpaci-Dusseau',
author_email = 'remzi.arpacidusseau@gmail.com',
url = 'https://github.com/z-plot/z-plot',
down... | z-plot/z-plot | setup.py | Python | bsd-3-clause | 472 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2015, MuChu Hsu
Contributed by Muchu Hsu (muchu1983@gmail.com)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
import os
import datetime
import re
import json
import logging
from scrapy import Selector
from cameo.utility import Utility
"""
I... | muchu1983/104_cameo | cameo/parserV2ForINDIEGOGO.py | Python | bsd-3-clause | 53,089 |
#
# Copyright (C) 2005-2016 Christoph Rupp (chris@crupp.de).
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | yorickdewid/Mavicona | third_party/upscaledb/python/unittests/transaction.py | Python | bsd-3-clause | 2,363 |
# -*- coding: utf-8 -*-
__version__ = '0.7.0'
| MathieuDuponchelle/django-sortedm2m | sortedm2m/__init__.py | Python | bsd-3-clause | 48 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""DataGroupXanes: work with XANES data sets
============================================
- DataGroup
- DataGroup1D
- DataGroupXanes
"""
from .datagroup import MODNAME
from .datagroup1D import DataGroup1D
class DataGroupXanes(DataGroup1D):
"""DataGroup for XANES... | maurov/xraysloth | sloth/collects/datagroup_xan.py | Python | bsd-3-clause | 767 |
from django.conf import settings
# Safe User import for Django < 1.5
try:
from django.contrib.auth import get_user_model
except ImportError:
from django.contrib.auth.models import User
else:
User = get_user_model()
# Safe version of settings.AUTH_USER_MODEL for Django < 1.5
auth_user_model = getattr(sett... | kevindias/django-chalk | chalk/compat.py | Python | bsd-3-clause | 358 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2012, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | chippey/gaffer | python/GafferUITest/GadgetTest.py | Python | bsd-3-clause | 8,732 |
import pcs
from socket import AF_INET, inet_ntop
import struct
import time
import pcs.packets.ipv4
import pcs.packets.igmpv2 as igmpv2
import pcs.packets.igmpv3 as igmpv3
#import pcs.packets.dvmrp
#import pcs.packets.mtrace
IGMP_HOST_MEMBERSHIP_QUERY = 0x11
IGMP_v1_HOST_MEMBERSHIP_REPORT = 0x12
IGMP_DVMRP = 0x13
IGM... | gvnn3/PCS | pcs/packets/igmp.py | Python | bsd-3-clause | 3,526 |
"""
Tests for content parsing, and form-overloaded content parsing.
"""
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from django.contrib.sessions.middleware import SessionMiddleware
from django.core.handlers.wsgi import W... | MobileWebApps/backend-python-rest-gae | lib/rest_framework/tests/test_request.py | Python | bsd-3-clause | 13,239 |
import logging
import fmcapi
def test__failoverinterfacemacaddressconfigs(fmc):
logging.info(
"Test FailoverInterfaceMACAddressConfigs. get, post, put, "
"delete FailoverInterfaceMACAddressConfigs Objects"
)
obj1 = fmcapi.DeviceHAFailoverMAC(fmc=fmc, ha_name="HaName")
obj1.p_interface... | daxm/fmcapi | unit_tests/failoverinterfacemacaddressconfigs.py | Python | bsd-3-clause | 958 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Python interface to the Chandra Data Archive (CDA) web services and an
interface to a local disk copy of the Observation Catalog (Ocat).
"""
from pathlib import Path
import re
import warnings
import time
import requests
import numpy as np
import tables... | sot/mica | mica/archive/cda/services.py | Python | bsd-3-clause | 23,345 |
import torch
from torch.optim.optimizer import Optimizer, required
_available = False
try:
from pcl_embedding_bag import bf16_update
_available = True
except ImportError as e:
#print(e)
pass
def is_available():
return _available
class SplitSGD(Optimizer):
r"""Implements low precision stochast... | hfp/libxsmm | samples/deeplearning/sparse_training/dlrm/split_sgd.py | Python | bsd-3-clause | 3,392 |
"""
WSGI config for this 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.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.wsgi import ... | aldryn/aldryn-boilerplate-bootstrap3 | tools/server/src/wsgi.py | Python | bsd-3-clause | 378 |
import sys
import random
from test_base import *
class TestAtomic1(TestBase):
def generate(self):
self.clear_tag()
for iteration in range(10):
for n in range(10000):
tag = random.randint(0,9)
index = random.randint(0,1)
block_offset = random.randint(0,self.block_size_in_word... | litex-hub/pythondata-cpu-blackparrot | pythondata_cpu_blackparrot/system_verilog/black-parrot/external/basejump_stl/testing/bsg_cache/regression_v2/test_atomic4.py | Python | bsd-3-clause | 1,146 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("SGDClassifier" , "iris" , "oracle")
| antoinecarme/sklearn2sql_heroku | tests/classification/iris/ws_iris_SGDClassifier_oracle_code_gen.py | Python | bsd-3-clause | 133 |
"""An alternative Rasterio raster calculator."""
__version__ = '0.1'
__author__ = 'Kevin Wurster'
__email__ = 'wursterk@gmail.com'
__source__ = 'https://github.com/geowurster/rio-eval-calc'
__license__ = """
New BSD License
Copyright (c) 2015-2016, Kevin D. Wurster
All rights reserved.
Redistribution and use in sou... | geowurster/rio-eval-calc | rio_eval_calc/__init__.py | Python | bsd-3-clause | 1,703 |
import pandas as pd
import numpy as np
import pyaf.ForecastEngine as autof
import pyaf.Bench.TS_datasets as tsds
import logging
import logging.config
#logging.config.fileConfig('logging.conf')
logging.basicConfig(level=logging.INFO)
#get_ipython().magic('matplotlib inline')
b1 = tsds.load_ozone()
df = b1.mPastDa... | antoinecarme/pyaf | tests/neuralnet/test_ozone_rnn_only_LSTM.py | Python | bsd-3-clause | 1,418 |
import sys
import random
from test_base import *
class TestBlockLD2(TestBase):
def generate(self):
self.clear_tag()
for n in range(50000):
tag = random.randint(0, 15)
index = random.randint(0,self.sets_p-1)
taddr = self.get_addr(tag,index)
op = random.randint(0,2)
if op == ... | litex-hub/pythondata-cpu-blackparrot | pythondata_cpu_blackparrot/system_verilog/black-parrot/external/basejump_stl/testing/bsg_cache/regression_non_blocking/test_block_ld2.py | Python | bsd-3-clause | 747 |
#! /usr/bin/env python3
assert __name__ == '__main__'
'''
To update ANGLE in Gecko, use Windows with git-bash, and setup depot_tools, python2, and
python3. Because depot_tools expects `python` to be `python2` (shame!), python2 must come
before python3 in your path.
Upstream: https://chromium.googlesource.com/angle/an... | ppy/angle | scripts/export_targets.py | Python | bsd-3-clause | 10,578 |
from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseShpStationsShpDistrictsImporter
class Command(BaseShpStationsShpDistrictsImporter):
srid = 27700
council_id = 'W06000021'
districts_name = 'polling_district'
stations_name = 'polling_station.shp'
elections... | chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_monmouthshire.py | Python | bsd-3-clause | 1,244 |
from piliko import *
print
print 'example 5'
v1,v2 = vector(3,0),vector(0,4)
print 'vectors v1, v2:', v1, v2
print ' v1 + v2, v1 - v2: ', v1 + v2, v1 - v2
print ' v1 * 5/4:', v1 * Fraction(5,4)
print ' v1 perpendicular v1? ', v1.perpendicular( v1 )
print ' v1 perpendicular v2? ', v1.perpendicular( v2 )
print ' v2 perp... | donbright/piliko | examples/example05.py | Python | bsd-3-clause | 1,688 |
from rtree import index
import numpy as np
#from shapely.prepared import prep
import shapely
def polygon2points(p):
"""
convert a polygon to a sequence of points for DS documents
:param p: shapely.geometry.Polygon
returns a string representing the set of points
"""
return ",".join(l... | Transkribus/TranskribusDU | TranskribusDU/util/geoTools.py | Python | bsd-3-clause | 2,557 |
# -*- coding: utf-8 -*-
from django.shortcuts import render
from units.models import Unit
def startpage(request):
"""Start page.
Shows list of units available for statistics/filtering.
"""
units = Unit.objects.all()
# t = loader.get_template('startpage.html')
# c = RequestContext(request, ... | lemonad/behorighet | behorighet/main/views.py | Python | bsd-3-clause | 532 |
"""Showcases *Automatic Colour Conversion Graph* computations."""
import numpy as np
import colour
from colour.utilities import message_box
message_box("Automatic Colour Conversion Graph")
message_box(
'Converting a "ColorChecker" "dark skin" sample spectral distribution to '
'"Output-Referred" "sRGB" colou... | colour-science/colour | colour/examples/graph/examples_graph.py | Python | bsd-3-clause | 2,239 |
import random
import numpy as np
import copy
class Genotype():
def __init__(self, L, M, N):
self.genotype = np.random.randint(0, M, (L,N))
self.L = L
self.M = M
self.N = N
def apply_mutation(self, i, j):
gene = self.genotype[i][j] + random.randint(-2, 2)
if gen... | kimhc6028/pathnet-pytorch | genotype.py | Python | bsd-3-clause | 1,720 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# au... | TriOptima/tri.form | docs/conf.py | Python | bsd-3-clause | 8,612 |
from app import db, app
from hashlib import md5
import flask.ext.whooshalchemy as whooshalchemy
ROLE_USER = 0
ROLE_ADMIN = 1
followers = db.Table('followers',
db.Column('follower_id', db.Integer, db.ForeignKey('user.id')),
db.Column('followed_id', db.Integer, db.ForeignKey('user.id'))
)
class User(db.Mod... | holly00shit/blogMM | app/models.py | Python | bsd-3-clause | 2,981 |
from __future__ import absolute_import, unicode_literals
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Profile(models.Model):
"""
Extension for the user class
"""
user = models.OneToOneField(User)
full_name ... | ewheeler/tracpro | tracpro/profiles/models.py | Python | bsd-3-clause | 509 |
# -*- coding: utf-8 -*-
# Copyright 2013 Google Inc. 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 require... | endlessm/chromium-browser | third_party/catapult/third_party/gsutil/gslib/tests/testcase/unit_testcase.py | Python | bsd-3-clause | 16,831 |
# ===============================================================================
# Copyright (c) 2014 Geoscience Australia
# 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... | alex-ip/agdc | api/source/main/python/datacube/api/__init__.py | Python | bsd-3-clause | 6,195 |
import logging
import os
import socket
import subprocess
import sys
import tempfile
import time
from django.core.management.base import BaseCommand
import redisutils
import redis as redislib
log = logging.getLogger('z.redis')
# We process the keys in chunks of size CHUNK.
CHUNK = 3000
# Remove any sets with less th... | clouserw/zamboni | mkt/site/management/commands/clean_redis.py | Python | bsd-3-clause | 3,336 |
from django import forms
from django.core.urlresolvers import reverse, NoReverseMatch
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.core.validators import URLValidator
from treenav.models import MenuItem
from mptt.forms import TreeNodeChoic... | NetstationMurator/django-treenav | treenav/forms.py | Python | bsd-3-clause | 2,787 |
from openarticlegauge import plugin
class mock_licence_plugin(plugin.Plugin):
_short_name="mock_doi"
def capabilities(self):
return {
"type_detect_verify" : False,
"canonicalise" : [],
"detect_provider" : [],
"license_detect" : True
}
def supp... | CottageLabs/OpenArticleGauge | openarticlegauge/tests/plugins/test_workflow/test_11_1/test_11_1.py | Python | bsd-3-clause | 543 |
#!/usr/bin/env python
#------------------------------------------------------------
# Script which demonstrates how to find the best-fit
# parameters of a Voigt line-shape model
#
# Vog, 26 Mar 2012
#------------------------------------------------------------
import numpy
from matplotlib.pyplot import figure, show, r... | kapteyn-astro/kapteyn | doc/source/EXAMPLES/kmpfit_voigt.py | Python | bsd-3-clause | 4,841 |
# Generated by Django 2.1.7 on 2019-04-26 17:55
from django.db import migrations, models
from scheduler.models import RepeatableJob
from django.utils import timezone
from django_rq import job
@job("short")
def install_generate_summaries_job(apps, schema_editor):
job, created = RepeatableJob.objects.get_or_create... | SalesforceFoundation/mrbelvedereci | metaci/testresults/migrations/0013_install_summary_job.py | Python | bsd-3-clause | 1,046 |
from django.contrib.auth import get_user_model
from django.views.generic import DetailView
from rest_framework import viewsets
from rest_framework import permissions
from rest_framework.decorators import detail_route, list_route
from rest_framework.response import Response
from .serializers import UserSerializer
clas... | openpolis/op-accesso | project/accesso/users/views.py | Python | bsd-3-clause | 819 |
import sys # pragma: no cover
from remoteappmanager.command_line_config import (
CommandLineConfig) # pragma: no cover
from remoteappmanager.environment_config import (
EnvironmentConfig) # pragma: no cover
from remoteappmanager.file_config import FileConfig # pragma: no cover
from tornado.options impor... | simphony/simphony-remote | remoteappmanager/cli/remoteappadmin/__main__.py | Python | bsd-3-clause | 1,056 |
from django.test import Client
from questionnaire.forms.sections import SectionForm, SubSectionForm
from questionnaire.models import Questionnaire, Section, SubSection
from questionnaire.tests.base_test import BaseTest
class SectionsViewTest(BaseTest):
def setUp(self):
self.client = Client()
se... | testvidya11/ejrf | questionnaire/tests/views/test_sections_view.py | Python | bsd-3-clause | 6,630 |
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 = "MovingAverage", cycle_length = 12, transform = "Integration", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Integration/trend_MovingAverage/cycle_12/ar_/test_artificial_32_Integration_MovingAverage_12__100.py | Python | bsd-3-clause | 271 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from sentry.utils.db import is_postgres
class Migration(SchemaMigration):
# Flag to indicate if this migration is too risky
# to run online and... | mvaled/sentry | src/sentry/south_migrations/0425_auto__add_index_pullrequest_organization_id_merge_commit_sha.py | Python | bsd-3-clause | 107,666 |
import numpy as np
from holoviews.core.overlay import NdOverlay
from holoviews.core.spaces import HoloMap
from holoviews.element import Points
from .testplot import TestMPLPlot, mpl_renderer
from ..utils import ParamLogStream
try:
from matplotlib import pyplot
except:
pass
class TestPointPlot(TestMPLPlot):... | basnijholt/holoviews | holoviews/tests/plotting/matplotlib/testpointplot.py | Python | bsd-3-clause | 15,100 |
# ------------------------------------------------------------------------------
# OCCAM
#
# Copyright © 2011-2012, SRI International
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redis... | Wajihulhassan/SelfContainedPrevirt | tools/occam/occam/targets/run.py | Python | bsd-3-clause | 2,270 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | ericmjl/bokeh | tests/codebase/test_flake8.py | Python | bsd-3-clause | 1,453 |
# coding=utf-8
from __future__ import unicode_literals, division
import sys
import logging
from subprocess import Popen, PIPE
import shutil
import os
import re
from os.path import join as pjoin
from PIL import Image
from django.utils.six import StringIO
from django.core import management
from django.core.files.storag... | caioariede/sorl-thumbnail | tests/thumbnail_tests/tests.py | Python | bsd-3-clause | 29,267 |
from django_sprinkler.models import Program, Context
from datetime import datetime
import pytz, logging
from django.conf import settings
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG if settings.DEBUG else logging.INFO)
logger_watering = logging.getLogger("watering")
logger_watering.setLevel(logg... | jpardobl/django_sprinkler | django_sprinkler/cicles.py | Python | bsd-3-clause | 1,692 |
"""Define statements for retrieving the data for each of the types."""
CONSTRAINTS = """
select
o.owner,
o.constraint_name,
o.constraint_type,
o.table_name,
o.search_condition,
o.r_owner,
o.r_constraint_name,
o.delete_rule,
... | marhar/cx_OracleTools | cx_PyOracleLib/cx_OracleObject/Statements.py | Python | bsd-3-clause | 5,193 |
# Hidden Markov Models
#
# Author: Ron Weiss <ronweiss@gmail.com>
# and Shiqiao Du <lucidfrontier.45@gmail.com>
# API changes: Jaques Grobler <jaquesgrobler@gmail.com>
"""
The :mod:`sklearn.hmm` module implements hidden Markov models.
**Warning:** :mod:`sklearn.hmm` is orphaned, undocumented and has known
numerical s... | mrshu/scikit-learn | sklearn/hmm.py | Python | bsd-3-clause | 46,104 |
class Error(Exception):
"""
Base error for all coco exceptions.
Only when throwing an instance of this error one can be sure it
will get caught by the application. All other exceptions might
be unhandled leading to crashes.
"""
pass
class BackendError(Error):
"""
Base error for... | coco-project/contract | src/coco/contract/errors.py | Python | bsd-3-clause | 3,806 |
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | VisTrails/VisTrails | vistrails/core/api.py | Python | bsd-3-clause | 37,639 |
#!/usr/bin/env python
"""
Find the sets of characters used in RST section headers,
and replace with a standard sequcne
For input like
::
##########
header
##########
Section
********
Subsection
===========
Section 2
**********
and HEADER_CHAR_LEVELS = '*=-^"+:~'
this should produce
::
*****... | astropy/astropy-tools | discontinued_usage/unify_section_headings.py | Python | bsd-3-clause | 2,718 |
import logging; logger = logging.getLogger("morse." + __name__)
import sys
import yarp
from morse.core.request_manager import RequestManager, MorseRPCInvokationError
from morse.core import status
class YarpRequestManager(RequestManager):
"""Implements services to control the MORSE simulator over YARP
The sy... | Arkapravo/morse-0.6 | src/morse/middleware/yarp_request_manager.py | Python | bsd-3-clause | 7,609 |
"""
Django JSON Field. This extends Django Model Fields to store JSON as a field-type.
"""
#TODO - Move this to utils or another application. This is tangential to reporting and useful for other things.
from django.db import models
try:
import json as simplejson
except ImportError:
from django.utils import s... | jrutila/django-reportengine | reportengine/jsonfield.py | Python | bsd-3-clause | 5,953 |
# -*- coding: utf-8 -*-
"""Functional tests using WebTest.
See: http://webtest.readthedocs.org/
"""
import pytest
from flask import url_for
from myflaskapp.models.user import User
from .factories import UserFactory
class TestLoggingIn:
def test_can_log_in_returns_200(self, user, testapp):
# Goes to ho... | wdm0006/myflaskapp | tests/test_functional.py | Python | bsd-3-clause | 3,662 |
from sys import intern
import os
import numpy as np
import pandas as pd
import re
from .exceptions import UnsupportedFile
def sort_intervals(starts, ends):
intervals = [(s, e) for s, e in zip(starts, ends)]
sorted_by_lower_bound = sorted(intervals, key=lambda tup: tup[0])
starts, ends = zip(*sorted_by_lo... | varnion/genial | genial/utils.py | Python | bsd-3-clause | 6,193 |
from cerberus import errors
from cerberus.tests import assert_fail, assert_success
def test_regex(validator):
field = 'a_regex_email'
assert_success({field: 'valid.email@gmail.com'}, validator=validator)
assert_fail(
{field: 'invalid'},
update=True,
error=(
field,
... | funkyfuture/cerberus | cerberus/tests/test_rule_regex.py | Python | isc | 651 |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... | jkonecki/autorest | AutoRest/Generators/Python/Python.Tests/AcceptanceTests/complex_tests.py | Python | mit | 14,727 |
from enum import Enum
__author__ = 'dirkfuchs'
class Format(Enum):
oneLine = 0
oracle = 1
| erget/tnsmaster | tnsnames/format.py | Python | mit | 101 |
import sys
import textwrap
from pip.basecommand import Command, SUCCESS
from pip.util import get_terminal_size
from pip.log import logger
from pip.backwardcompat import xmlrpclib, reduce, cmp
from pip.exceptions import CommandError
from pip.status_codes import NO_MATCHES_FOUND
from pip._vendor import pkg_resources
fro... | blueyed/pip | pip/commands/search.py | Python | mit | 4,909 |
from tg import request, abort, override_template
from tg.decorators import before_validate, before_render
@before_validate
def ajax_only(*args, **kwargs):
if not request.is_xhr:
abort(400)
def ajax_expose(template):
@before_render
def _ajax_expose(*args, **kwargs):
if request.is_xhr:
... | amol-/tgext.utils | tgext/utils/ajax.py | Python | mit | 414 |
# -*- coding: utf-8 -*-
"""
=============================
Chemtrails
=============================
The past trajectory of an animated plot can be visualized with the chemtrails
argument. This displays a low opacity version of the trace behind the
current points being plotted. This can be used in conjunction with the... | ContextLab/hypertools | examples/chemtrails.py | Python | mit | 575 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/crafted/chassis/shared_tieinterceptor_deed.iff"
result.attribu... | obi-two/Rebelion | data/scripts/templates/object/tangible/ship/crafted/chassis/shared_tieinterceptor_deed.py | Python | mit | 479 |
from __future__ import print_function, division, unicode_literals
import operator
from pymatgen.core.periodic_table import Element
from pymatgen.core.structure import Structure
from mpinterfaces.mat2d.intercalation.analysis import get_interstitial_sites
__author__ = "Michael Ashton"
__copyright__ = "Copyright 2017... | henniggroup/MPInterfaces | mpinterfaces/mat2d/intercalation/startup.py | Python | mit | 3,088 |
import random
import string
import cherrypy
class StringGenerator(object):
@cherrypy.expose
def index(self):
return "Hello world!"
@cherrypy.expose
def generate(self, length=8):
return ''.join(random.sample(string.hexdigits, int(length)))
if __name__ == '__main__':
cherrypy.quick... | guillaume-havard/test_cherrypy | src/tut3.py | Python | mit | 345 |
from .nvd3 import NVD3
from flask import jsonify, request
import numpy as np
class TwoAxisFocus(NVD3):
_allowed_axes = ["sigma", "minmax"]
def __init__(self, x, y1, y2, data_source, init_params={},
chart_id="new_chart", url="/new_chart/", colors=[], auto_scale="sigma",
y1_axis_range=[], y2_axi... | MKridler/pyxley | pyxley/charts/nvd3/two_axis_focus.py | Python | mit | 2,870 |
# -*- coding: utf-8 -*-
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
from __future__ import print_function
from datetime import datetime
from importlib import import_module
from itertools import chain, islice
import sys
import traceback
im... | koendeschacht/python-logstash-async | logstash_async/utils.py | Python | mit | 2,122 |
"""
Support for Honeywell Round Connected and Honeywell Evohome thermostats.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/climate.honeywell/
"""
import logging
import socket
import voluptuous as vol
from homeassistant.components.climate import (Clima... | Smart-Torvy/torvy-home-assistant | homeassistant/components/climate/honeywell.py | Python | mit | 8,927 |
#!/usr/bin/env python
import os
import os.path
import platform
import sys
##----------------------------------------------------------------##
def isPythonFrozen():
return hasattr( sys, "frozen" )
def getMainModulePath():
if isPythonFrozen():
p = os.path.dirname(unicode(sys.executable, sys.getfilesystemencoding(... | cloudteampro/juma-editor | JumaEditor.app/Contents/Resources/juma_bin.py | Python | mit | 1,472 |
# Time: O(n) ~ O(n^2)
# Space: O(1)
from random import randint
class Solution:
# @param {integer[]} nums
# @param {integer} k
# @return {integer}
def findKthLargest(self, nums, k):
left, right = 0, len(nums) - 1
while left <= right:
pivot_idx = randint(left, right)
... | kamyu104/LeetCode | Python/kth-largest-element-in-an-array.py | Python | mit | 1,142 |
import test.support
# Skip tests if _multiprocessing wasn't built.
test.support.import_module('_multiprocessing')
# Skip tests if sem_open implementation is broken.
test.support.import_module('multiprocessing.synchronize')
# import threading after _multiprocessing to raise a more revelant error
# message: "No module n... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.2/Lib/test/test_concurrent_futures.py | Python | mit | 20,163 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Ship()
result.template = "object/ship/shared_rebel_gunboat_tier5.iff"
result.attribute_template_id = -1
result.s... | anhstudios/swganh | data/scripts/templates/object/ship/shared_rebel_gunboat_tier5.py | Python | mit | 416 |
import cv2
def outlineRect(image, rect, color):
if rect is None:
return
x, y, w, h = rect
cv2.rectangle(image, (x, y), (x+w, y+h), color)
def copyRect(src, dst, srcRect, dstRect,
interpolation = cv2.INTER_LINEAR):
"""Copy part of the source to part of the destination."""
... | StefQM/facedetect | facedetect/rects.py | Python | mit | 1,352 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 Piero Dalle Pezze
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the ... | pdp10/sbpipe | sbpipe/utils/dependencies.py | Python | mit | 3,141 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-11-28 13:35
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depende... | sebastienbarbier/723e_server | seven23/models/accounts/migrations/0002_auto_20161128_1335.py | Python | mit | 1,974 |
import demistomock as demisto
from CommonServerPython import *
import subprocess
import re
def main():
try:
dest = demisto.args()['address']
ping_out = subprocess.check_output(
['ping', '-c', '3', '-q', dest], stderr=subprocess.STDOUT, universal_newlines=True
)
s = re.s... | demisto/content | Packs/CommonScripts/Scripts/Ping/Ping.py | Python | mit | 1,264 |
#!/usr/bin/env python
"""
Twython is a library for Python that wraps the Twitter API.
It aims to abstract away all the API endpoints, so that additions to the library
and/or the Twitter API won't cause any overall problems.
Questions, comments? ryan@venodesigns.net
"""
__author__ = "Ryan McGrath <rya... | davish/Twitter-World-Mood | twython/twython.py | Python | mit | 22,902 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | datalogics/scons | test/Script-import.py | Python | mit | 2,675 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dwarf_gronda.iff"
result.attribute_template_id = 9
result.stf... | obi-two/Rebelion | data/scripts/templates/object/mobile/shared_dwarf_gronda.py | Python | mit | 432 |
import pymel.core as pm
def set_pivot_to_selected_face(face):
cur_sel = pm.select(face,r=1)
if cur_sel and len(cur_sel) == 1 and cur_sel.split(:
pm.mel.eval("setToolTo Move;")
piv = pm.manipMoveContext("Move",q=1,p=1)
mesh = pm.listRelatives(pm.listRelatives(face,p=1)[0],p=1)
vt... | aaronfang/personal_scripts | af_scripts/tmp/setPivotToFace.py | Python | mit | 1,729 |
import os
import time
from ethereum import utils
from ethereum import pruning_trie as trie
from ethereum.refcount_db import RefcountDB
from ethereum.db import OverlayDB
from ethereum.utils import to_string, is_string
import rlp
from rlp.utils import encode_hex
from ethereum import blocks
from ethereum import processblo... | vaporry/pyethereum | ethereum/chain.py | Python | mit | 15,969 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/components/reactor/shared_rct_sfs_imperial_4.iff"
result.attri... | obi-two/Rebelion | data/scripts/templates/object/tangible/ship/components/reactor/shared_rct_sfs_imperial_4.py | Python | mit | 482 |
import time
import functools
import itertools as it
import requests
from requests.exceptions import ConnectTimeout, ReadTimeout, ConnectionError
from circuit import CircuitOpenError
import logging
from .breaker import CircuitBreakerSet
from .exceptions import AllHostsUnreachableException, MaxRetriesReached
logger =... | jbeluch/smartclient | smartclient/client.py | Python | mit | 5,176 |
"""
Support for RFXtrx lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.rfxtrx/
"""
import logging
import homeassistant.components.rfxtrx as rfxtrx
from homeassistant.components.light import ATTR_BRIGHTNESS, Light
from homeassistant.componen... | luxus/home-assistant | homeassistant/components/light/rfxtrx.py | Python | mit | 6,729 |
from grow.pods.preprocessors import closure_compiler
from grow.pods.preprocessors import google_sheets
from grow.pods.preprocessors import sass_preprocessor
from protorpc import protojson
import json
_preprocessor_kinds_to_classes = {}
_builtins = (
sass_preprocessor.SassPreprocessor,
google_sheets.GoogleShee... | vitorio/pygrow | grow/pods/preprocessors/preprocessors.py | Python | mit | 1,086 |