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 -*-
"""
This is revision from 3058ab9d9d4875589638cc45e84b59e7e1d7c9c3 of
https://github.com/ojii/django-load.
ANY changes to this file, be it upstream fixes or changes for the cms *must* be
documented clearly within this file with comments.
For documentation on how to use the functions described ... | SurfasJones/djcmsrc3 | venv/lib/python2.7/site-packages/cms/utils/django_load.py | Python | mit | 3,456 |
#!/usr/bin/python
# Import required Python libraries
import RPi.GPIO as GPIO
import time
# Use BM GPIO references instead of physical pin numbers
GPIO.setmode(GPIO.BOARD)
GaragePin = 11
GPIO.setup(GaragePin, GPIO.OUT)
GPIO.output(GaragePin, GPIO.HIGH)
def trigger():
GPIO.output(GaragePin, GP... | JayJanarthanan/RPi-Garage-Opener | garage-node/door.py | Python | mit | 497 |
from vision import *
from vision.alearn import marginals
from vision import visualize, model
from vision.toymaker import *
import os
import multiprocessing
import logging
import random
import ImageColor
import pickle
logging.basicConfig(level = logging.INFO)
#g = frameiterator("/scratch/vatic/uci-basketball")
#b = [B... | WangDequan/pyvision | experiments/marginals.py | Python | mit | 2,264 |
# Copyright (C) 2007 Sadique Puthen <sputhenp@redhat.com>
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public Li... | slashdd/sos | sos/report/plugins/smartcard.py | Python | gpl-2.0 | 1,326 |
#!/usr/bin/env python
__author__ = 'jsommers@colgate.edu'
from abc import ABCMeta, abstractmethod
class FlowExporter(object):
__metaclass__ = ABCMeta
def __init__(self, rname):
self.routername = str(rname)
@abstractmethod
def exportflow(self, ts, flet):
pass
@abstractmethod
... | ashishtanwer/DFS | flowexport/flowexporter.py | Python | gpl-2.0 | 986 |
# -*- coding: utf-8 -*-
#
# test_stdp_nn_synapses.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 2 of the L... | sdiazpier/nest-simulator | testsuite/pytests/test_stdp_nn_synapses.py | Python | gpl-2.0 | 12,892 |
# -*- coding: utf-8 -*-
#
# Copyright 2004-2006 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 2 of the License, or
# ... | phlax/translate | translate/tools/__init__.py | Python | gpl-2.0 | 801 |
# -*- coding: utf-8 -*-
from translate.filters import autocorrect
class TestAutocorrect:
def correct(self, msgid, msgstr, expected):
"""helper to run correct function from autocorrect module"""
corrected = autocorrect.correct(msgid, msgstr)
print(repr(msgid))
print(repr(msgstr))
... | diorcety/translate | translate/filters/test_autocorrect.py | Python | gpl-2.0 | 2,599 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
###########################################################################
## ##
## Copyrights Frédéric Rodrigo 2013 ##
## ... | tkasp/osmose-backend | analysers/analyser_osmosis_relation_restriction.py | Python | gpl-3.0 | 13,460 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2014 Peter Oliver <ansible@mavit.org.uk>
#
# 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 o... | mattbernst/polyhartree | support/ansible/modules/extras/packaging/os/pkg5_publisher.py | Python | gpl-3.0 | 5,651 |
# Copyright 2014 Google Inc. All Rights Reserved.
"""Command for getting health status of backend(s) in a backend service."""
from googlecloudsdk.compute.lib import base_classes
from googlecloudsdk.compute.lib import request_helper
from googlecloudsdk.compute.lib import utils
class GetHealth(base_classes.BaseCommand... | harshilasu/LinkurApp | y/google-cloud-sdk/lib/googlecloudsdk/compute/subcommands/backend_services/get_health.py | Python | gpl-3.0 | 3,692 |
# -*- coding: utf-8 -*-
import re
from module.network.RequestFactory import getURL
from module.plugins.Hoster import Hoster
def getInfo(urls):
result = []
for url in urls:
html = getURL(url)
if re.search(StreamCz.OFFLINE_PATTERN, html):
# File offline
result.append(... | immenz/pyload | module/plugins/hoster/StreamCz.py | Python | gpl-3.0 | 2,109 |
from coala_utils.string_processing.Core import unescaped_search_for
from coalib.bears.LocalBear import LocalBear
from coalib.bearlib import deprecate_settings
from coalib.bearlib.languages.LanguageDefinition import LanguageDefinition
from coalib.bearlib.spacing.SpacingHelper import SpacingHelper
from coalib.results.Sou... | sounak98/coala-bears | bears/general/IndentationBear.py | Python | agpl-3.0 | 22,844 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache/incubator-airflow | airflow/providers/http/sensors/http.py | Python | apache-2.0 | 5,045 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | lumig242/Hue-Integration-with-CDAP | desktop/libs/metadata/src/metadata/urls.py | Python | apache-2.0 | 2,246 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
#
# 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
# ... | DirectXMan12/nova-hacking | nova/virt/vmwareapi/network_util.py | Python | apache-2.0 | 7,343 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC
#
# 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 requ... | ioram7/keystone-federado-pgid2013 | tests/test_keystoneclient_sql.py | Python | apache-2.0 | 6,768 |
# Copyright (c) 2014 VMware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Metaswitch/calico-nova | nova/virt/vmwareapi/ds_util.py | Python | apache-2.0 | 20,387 |
#!/usr/bin/env python
#
# GrovePi Hardware Test
# Connect Buzzer to Port D8
# Connect Button to Analog Port A0
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.grovepi.com
#
# Have a question about this example? Ask on the forums here: http://www.dexteri... | gerald-yang/ubuntu-iotivity-demo | snappy/grovepi/pygrovepi/GrovePi_Hardware_Test.py | Python | apache-2.0 | 1,976 |
# -*- encoding: utf-8 -*-
import codecs
import os
import posixpath
import shutil
import sys
import tempfile
import warnings
from StringIO import StringIO
from django.template import loader, Context
from django.conf import settings
from django.core.cache.backends.base import BaseCache, CacheKeyWarning
from django.core... | leereilly/django-1 | tests/regressiontests/staticfiles_tests/tests.py | Python | bsd-3-clause | 27,280 |
# Generated by Django 2.0.8 on 2018-09-10 13:20
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("order", "0054_move_data_to_order_events")]
operations = [
migrations.RemoveField(model_name="orderhistoryentry", name="order"),
migrations.RemoveField(mo... | maferelo/saleor | saleor/order/migrations/0055_remove_order_note_order_history_entry.py | Python | bsd-3-clause | 617 |
# Copyright (c) 2012-2013 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functiona... | haowu4682/gem5 | src/python/m5/params.py | Python | bsd-3-clause | 53,864 |
# IDLSave - a python module to read IDL 'save' files
# Copyright (c) 2010 Thomas P. Robitaille
# Many thanks to Craig Markwardt for publishing the Unofficial Format
# Specification for IDL .sav files, without which this Python module would not
# exist (http://cow.physics.wisc.edu/~craigm/idl/savefmt).
# This code was... | lesserwhirls/scipy-cwt | scipy/io/idl.py | Python | bsd-3-clause | 22,855 |
"""A functions module, includes all the standard functions.
Combinatorial - factorial, fibonacci, harmonic, bernoulli...
Elementary - hyperbolic, trigonometric, exponential, floor and ceiling, sqrt...
Special - gamma, zeta,spherical harmonics...
"""
from sympy.functions.combinatorial.factorials import (factorial, fac... | beni55/sympy | sympy/functions/__init__.py | Python | bsd-3-clause | 2,663 |
#!/usr/bin/env python
"""usage: %prog [options] filename
Parse a document to a tree, with optional profiling
"""
import sys
import os
import traceback
from optparse import OptionParser
from html5lib import html5parser, sanitizer
from html5lib.tokenizer import HTMLTokenizer
from html5lib import treebuilders, serializ... | lgp171188/fjord | vendor/src/html5lib-python/parse.py | Python | bsd-3-clause | 9,103 |
__all__ = ['imread', 'imsave']
import numpy as np
from six import string_types
from PIL import Image
from ...util import img_as_ubyte, img_as_uint
from ...external.tifffile import imread as tif_imread, imsave as tif_imsave
def imread(fname, dtype=None, img_num=None, **kwargs):
"""Load an image from file.
P... | Britefury/scikit-image | skimage/io/_plugins/pil_plugin.py | Python | bsd-3-clause | 8,372 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""从汉典网(www.zdic.net)获取所有的汉字,找出拼音库未包含的汉字"""
import logging
from time import sleep
from bs4 import BeautifulSoup
import requests
logger = logging.getLogger(__name__)
def parse_words(html):
"""解析 html 源码,返回汉字列表"""
soup = BeautifulSoup(html)
a_list = soup.fin... | wuxqing/python-pinyin | tools/get_words_from_zdic_by_bh.py | Python | mit | 1,984 |
#!/usr/bin/env python2
"""Dump /arc/ppark.narc.
This is an unmaintained one-shot script, only included in the repo for
reference.
"""
import sys
from struct import pack, unpack
import binascii
import pokedex.db
from pokedex.db.tables import PalPark
types = [
'',
'grass',
'fire',
'water',
'bug... | DaMouse404/pokedex | scripts/palpark.py | Python | mit | 1,113 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import sys
from nose.plugins.skip import SkipTest
i... | sgerhart/ansible | test/units/modules/network/f5/test_bigip_wait.py | Python | mit | 3,721 |
#!/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,
... | timj/scons | test/YACC/YACCVCGFILESUFFIX.py | Python | mit | 2,645 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_crm_activity
from . import test_crm_lead
from . import test_crm_lead_assignment
from . import test_crm_lead_notification
from . import test_crm_lead_convert
from . import test_crm_lead_convert_mass
fro... | jeremiahyan/odoo | addons/crm/tests/__init__.py | Python | gpl-3.0 | 592 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of... | galtys/odoo | openerp/tools/image.py | Python | agpl-3.0 | 10,791 |
"""
Tests for the API functions in the credit app.
"""
import datetime
import json
import ddt
import httpretty
import mock
import pytz
import six
from django.contrib.auth.models import User
from django.core import mail
from django.db import connection
from django.test.utils import override_settings
from opaque_keys.... | cpennington/edx-platform | openedx/core/djangoapps/credit/tests/test_api.py | Python | agpl-3.0 | 54,612 |
"""
Discussion API serializers
"""
from urllib import urlencode
from urlparse import urlunparse
from django.contrib.auth.models import User as DjangoUser
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from rest_framework import serializers
from discussion_api.permissi... | jamiefolsom/edx-platform | lms/djangoapps/discussion_api/serializers.py | Python | agpl-3.0 | 14,571 |
"""Tests for the lms module itself."""
import logging
import mimetypes
from django.conf import settings
from django.test import TestCase
from edxmako import LOOKUP, add_lookup
log = logging.getLogger(__name__)
class LmsModuleTests(TestCase):
"""
Tests for lms module itself.
"""
def test_new_mime... | cpennington/edx-platform | lms/tests.py | Python | agpl-3.0 | 771 |
"""Implements basics of Capa, including class CapaModule."""
import json
import logging
import sys
import re
from lxml import etree
from pkg_resources import resource_string
import dogstats_wrapper as dog_stats_api
from .capa_base import CapaMixin, CapaFields, ComplexEncoder
from capa import responsetypes
from .progr... | solashirai/edx-platform | common/lib/xmodule/xmodule/capa_module.py | Python | agpl-3.0 | 10,313 |
"""
Signal handler for setting default course mode expiration dates
"""
import logging
from crum import get_current_user
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.signals import post_save
from django.dispatch.dispatcher import receiver
from xmodule.... | eduNEXT/edunext-platform | common/djangoapps/course_modes/signals.py | Python | agpl-3.0 | 3,507 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Smile (<http://www.smile.fr>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under th... | tiexinliu/odoo_addons | smile_module_repository/tools/osutil.py | Python | agpl-3.0 | 1,146 |
import dbus
bus = dbus.SystemBus()
# This adds a signal match so that the client gets signals sent by Blivet1's
# ObjectManager. These signals are used to notify clients of changes to the
# managed objects (for blivet, this will be devices, formats, and actions).
bus.add_match_string("type='signal',sender='com.redha... | AdamWill/blivet | examples/dbus_client.py | Python | lgpl-2.1 | 825 |
# Copyright 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | brainiak/brainiak | brainiak/fcma/util.py | Python | apache-2.0 | 4,594 |
import mock
import pytest
from urlparse import urlparse
from addons.wiki.tests.factories import NodeWikiFactory
from api.base.settings.defaults import API_BASE
from api.base.settings import osf_settings
from api_tests import utils as test_utils
from framework.auth import core
from osf.models import Guid
from osf_tests... | aaxelb/osf.io | api_tests/comments/views/test_comment_detail.py | Python | apache-2.0 | 39,369 |
from pymongo import MongoClient
import sys
import requests
import time
import dblayer
# client = MongoClient("mongodb://localhost:27017")
#
# db = client.TestUSGS
#vals = []
def doGetData():
sess = requests.Session()
dbobj = dblayer.classDBLayer()
#### TME: Get start time
start_time = time.time()
... | Anveling/sp17-i524 | project/S17-IO-3017/code/projectearth/getusgsdata.py | Python | apache-2.0 | 2,091 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Licen... | StefanoRaggi/Lean | Algorithm.Python/Alphas/VIXDualThrustAlpha.py | Python | apache-2.0 | 7,584 |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
"""Add audit tables
Revision ID: 53c3b75c86ed
Revises: 53ef72c8a867
Create Date... | prasannav7/ggrc-core | src/ggrc/migrations/versions/20130911193408_53c3b75c86ed_add_audit_tables.py | Python | apache-2.0 | 1,991 |
#!/usr/bin/env python
#
# Copyright (c) Greenplum Inc 2012. All Rights Reserved.
#
import unittest
from mock import patch
from gppylib.operations.filespace import is_filespace_configured, MoveTransFilespaceLocally
import os
import tempfile
import shutil
import hashlib
class FileSpaceTestCase(unittest.TestCase):
... | edespino/gpdb | gpMgmt/bin/gppylib/operations/test/unit/test_unit_filespace.py | Python | apache-2.0 | 1,326 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Acehaidrey/incubator-airflow | tests/providers/amazon/aws/sensors/test_batch.py | Python | apache-2.0 | 3,092 |
# -*- coding: utf-8 -*-
""" Print accepted talks not scheduled and not accepted talks which have been
scheduled.
"""
from collections import defaultdict
from optparse import make_option
import operator
import simplejson as json
from django.core.management.base import BaseCommand, CommandError
from djan... | artcz/epcon | p3/management/commands/check_schedule.py | Python | bsd-2-clause | 3,428 |
from cassandra.cqlengine import connection
from stream_framework import settings
def setup_connection():
connection.setup(
hosts=settings.STREAM_CASSANDRA_HOSTS,
consistency=settings.STREAM_CASSANDRA_CONSISTENCY_LEVEL,
default_keyspace=settings.STREAM_DEFAULT_KEYSPACE,
**settings.C... | smuser90/Stream-Framework | stream_framework/storage/cassandra/connection.py | Python | bsd-3-clause | 349 |
# -*- coding: utf-8 -*-
# Copyright 2016 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... | catapult-project/catapult | third_party/gsutil/test/gsutil_measure_imports.py | Python | bsd-3-clause | 3,347 |
from osm import OSM, Node, Way
osm = OSM( "map.osm" )
fp = open("nodes.csv", "w")
for nodeid in osm.nodes.keys():
fp.write( "%s\n"%nodeid )
fp.close()
fp = open("map.csv", "w")
for wayid, way in osm.ways.iteritems():
if 'highway' in way.tags:
fp.write("%s,%s,%s,%f\n"%(wayid, way.fromv, way.tov, way.... | brendannee/Bikesy-Backend | pygs/graphserver/ext/osm/simplify_osm.py | Python | bsd-3-clause | 359 |
from django.core.management.base import BaseCommand
from django.db import models
from wagtail.wagtailcore.models import PageRevision, get_page_types
def replace_in_model(model, from_text, to_text):
text_field_names = [field.name for field in model._meta.fields if isinstance(field, models.TextField) or isinstance... | suziesparkle/wagtail | wagtail/wagtailcore/management/commands/replace_text.py | Python | bsd-3-clause | 1,661 |
# django imports
from django.contrib import admin
# lfs imports
from lfs.tax.models import Tax
admin.site.register(Tax)
| leadbrick/django-lfs | lfs/tax/admin.py | Python | bsd-3-clause | 122 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.six import StringIO
import sys
from django.apps import apps
from django.conf import settings
from django.core import checks
from django.core.checks import Error, Warning
from django.core.checks.model_checks import check_all_models
from ... | benjaminrigaud/django | tests/check_framework/tests.py | Python | bsd-3-clause | 12,962 |
##########################################################################
#
# Copyright (c) 2019, 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... | hradec/gaffer | python/GafferTest/NameValuePlugTest.py | Python | bsd-3-clause | 14,881 |
# Authors: Lars Buitinck
# Dan Blanchard <dblanchard@ets.org>
# License: BSD 3 clause
from random import Random
import numpy as np
import scipy.sparse as sp
from numpy.testing import assert_array_equal
from numpy.testing import assert_allclose
import pytest
from sklearn.feature_extraction import DictVectori... | manhhomienbienthuy/scikit-learn | sklearn/feature_extraction/tests/test_dict_vectorizer.py | Python | bsd-3-clause | 8,675 |
import warnings
import os
import nibabel as nb
import numpy as np
from ...utils.misc import package_check
have_nipy = True
try:
package_check('nipy')
except Exception, e:
have_nipy = False
else:
import nipy.modalities.fmri.design_matrix as dm
import nipy.labs.glm.glm as GLM
if have_nipy:
try:
... | mick-d/nipype_source | nipype/interfaces/nipy/model.py | Python | bsd-3-clause | 12,699 |
#!/usr/bin/env python
# (c) 2014, Will Thames <will@thames.id.au>
#
# This file is part of Ansible
#
# Ansible 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 op... | bootswithdefer/ansible | v2/hacking/get_library.py | Python | gpl-3.0 | 872 |
#!/usr/bin/env python
# HFacer.py - regenerate the Scintilla.h and SciLexer.h files from the Scintilla.iface interface
# definition file.
# The header files are copied to a temporary file apart from the section between a /* ++Autogenerated*/
# comment and a /* --Autogenerated*/ comment which is generated by the printHF... | dluschan/rdo_studio | thirdparty/scintilla/include/HFacer.py | Python | mit | 2,521 |
"""Blink an LED
This script assumes:
- ``board.pins[13]`` is a ``DigitalPin``
- there is an LED attached to it
"""
import time
import pingo
board = pingo.detect.get_board()
led = board.pins[13]
led.mode = pingo.OUT
while True:
led.toggle()
print(led.state)
time.sleep(.5)
| dyegocantu/pingo-py | pingo/examples/blink.py | Python | mit | 290 |
import unittest
import bottle
from tools import api
class TestRoute(unittest.TestCase):
@api('0.12')
def test_callback_inspection(self):
def x(a, b): pass
def d(f):
def w():
return f()
return w
route = bottle.Route(None, None, None, d(x... | SmithSamuelM/bottle | test/test_route.py | Python | mit | 1,829 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | danielcbit/vdt | src/aodv/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 494,944 |
# import libraries
import numpy, pylab
from pylab import *
# plot DOF convergence graph
axis('equal')
pylab.title("Error convergence")
pylab.xlabel("Degrees of freedom")
pylab.ylabel("Error [%]")
data = numpy.loadtxt("conv_dof_hp_iso.dat")
x = data[:, 0]
y = data[:, 1]
loglog(x, y, "-s", label="hp-FEM (iso)")
data = n... | hanak/hermes2d | doc/src/img/singular-perturbation/plot_graph_hp_dof.py | Python | gpl-2.0 | 459 |
def hu(n, s=-1):
return [s]
a = hu(10)
c = [i for i in hu(10)]
| RobertoMalatesta/shedskin | tests/40.py | Python | gpl-3.0 | 68 |
"""
Takes user input.
"""
import sys
from six.moves import input
def query_yes_no(question, default="yes"):
"""Ask a yes/no question via raw_input() and return their answer.
"question" is a string that is presented to the user.
"default" is the presumed answer if the user just hits <Enter>.
It... | stvstnfrd/edx-platform | cms/djangoapps/contentstore/management/commands/prompt.py | Python | agpl-3.0 | 1,176 |
# This file is part of VoltDB.
# Copyright (C) 2008-2015 VoltDB Inc.
#
# This file contains original code and/or modifications of original code.
# Any modifications made by VoltDB Inc. are licensed under the following
# terms and conditions:
#
# Permission is hereby granted, free of charge, to any person obtaining
# a... | kumarrus/voltdb | lib/python/voltcli/utility.py | Python | agpl-3.0 | 55,521 |
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
# pylint: disable=redefined-builtin,wrong-import-position,wildcard-import,useless-suppression,line-too-long
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('terrain.stubs.tests.test_youtube_stub', 'common.dj... | eduNEXT/edunext-platform | import_shims/studio/terrain/stubs/tests/test_youtube_stub.py | Python | agpl-3.0 | 440 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Cradl(Package):
"""The CRADL proxy application captured performance metrics during
inf... | LLNL/spack | var/spack/repos/builtin/packages/cradl/package.py | Python | lgpl-2.1 | 984 |
# ***************************************************************************
# * Copyright (c) 2009, 2010 Yorik van Havre <yorik@uncreated.net> *
# * Copyright (c) 2009, 2010 Ken Cline <cline@frii.com> *
# * *
# * Th... | Fat-Zer/FreeCAD_sf_master | src/Mod/Draft/draftgeoutils/general.py | Python | lgpl-2.1 | 10,720 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorflow | tensorflow/python/kernel_tests/tensor_priority_test.py | Python | apache-2.0 | 2,678 |
# Copyright 2016 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 required by applicable law or ag... | KaranToor/MA450 | google-cloud-sdk/lib/third_party/pyu2f/hid/base.py | Python | apache-2.0 | 2,716 |
# -*- coding: ascii -*-
#
# Copyright 2006, 2007, 2008, 2009, 2010, 2011
# Andr\xe9 Malo or his licensors, as applicable
#
# 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.apa... | ndparker/setup-common | py2/dev/analysis.py | Python | apache-2.0 | 1,003 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorflow | tensorflow/python/kernel_tests/signal/mfcc_ops_test.py | Python | apache-2.0 | 2,320 |
from write import write, writebr
import sys
IN_BROWSER = sys.platform in ['mozilla', 'ie6', 'opera', 'oldmoz', 'safari']
IN_JS = sys.platform in ['mozilla', 'ie6', 'opera', 'oldmoz',
'safari', 'spidermonkey', 'pyv8']
if IN_BROWSER:
from pyjamas.Timer import Timer
class UnitTest:
def... | spaceone/pyjs | pyjs/lib/test/UnitTest.py | Python | apache-2.0 | 7,837 |
"""
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
A simple wrapper for scipy.spatial.kdtree.KDTree for doing KNN
"""
import math,random,sys,bisect,time
import numpy,sci... | grahesh/Stock-Market-Event-Analysis | qstklearn/kdtknn.py | Python | bsd-3-clause | 5,490 |
# -*- coding: utf-8 -*-
"""
profiling.stats
~~~~~~~~~~~~~~~
Stat classes.
"""
from __future__ import absolute_import, division
from collections import defaultdict
import inspect
import time
from six import itervalues
from six.moves import map
from .sortkeys import by_total_time
__all__ = ['Stat', 'Sta... | tuxos/profiling | profiling/stats.py | Python | bsd-3-clause | 9,694 |
# -*- coding: utf-8 -*-
import os
from whoosh import highlight, analysis, qparser
from whoosh.support.charset import accent_map
from flask import Markup
from flask_website import app
from werkzeug import import_string
def open_index():
from whoosh import index, fields as f
if os.path.isdir(app.config['WHOOSH_... | mitsuhiko/flask-website | flask_website/search.py | Python | bsd-3-clause | 4,651 |
#
#[The "BSD license"]
# Copyright (c) 2013 Terence Parr
# Copyright (c) 2013 Sam Harwell
# Copyright (c) 2014 Eric Vergnaud
# 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. Red... | cocosli/antlr4 | runtime/Python3/src/antlr4/atn/LexerAction.py | Python | bsd-3-clause | 11,221 |
import collections
import numpy
import six
import cupy
from cupy import cuda
from cupy.cuda import cublas
from cupy import elementwise
from cupy import internal
def dot(a, b, out=None):
"""Returns a dot product of two arrays.
For arrays with more than one axis, it computes the dot product along the
las... | sou81821/chainer | cupy/linalg/product.py | Python | mit | 11,721 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hiren.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | pyprism/Hiren-Recipes | manage.py | Python | mit | 803 |
# Copyright 2014 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 required by applicable law or a... | thonkify/thonkify | src/lib/gcloud/storage/blob.py | Python | mit | 30,165 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2011 CERN.
##
## Invenio 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 2 of the
## License, or (at your option) a... | Markus-Goetz/CDS-Invenio-Authorlist | modules/bibauthorid/lib/bibauthorid_comparison_functions/stub.py | Python | gpl-2.0 | 4,196 |
from mock import patch, Mock, call
from pulp.agent.lib.report import ContentReport
from pulp.common.constants import PRIMARY_ID
from pulp.server.content.sources.model import DownloadReport, DownloadDetails
from base import ClientTests, Response
from pulp_node.extensions.admin.commands import *
from pulp_node.extensio... | credativ/pulp | nodes/test/nodes_tests/test_admin_extensions.py | Python | gpl-2.0 | 22,381 |
# encoding: utf-8
"""General utilities for kernel related things."""
__docformat__ = "restructuredtext en"
#-------------------------------------------------------------------------------
# Copyright (C) 2008 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
... | mastizada/kuma | vendor/packages/ipython/IPython/kernel/util.py | Python | mpl-2.0 | 3,193 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | patriciolobos/desa8 | openerp/addons/point_of_sale/point_of_sale.py | Python | agpl-3.0 | 74,430 |
# ***************************************************************************
# * Copyright (c) 2009, 2010 Yorik van Havre <yorik@uncreated.net> *
# * Copyright (c) 2009, 2010 Ken Cline <cline@frii.com> *
# * *
# * Th... | sanguinariojoe/FreeCAD | src/Mod/Draft/draftmake/make_wire.py | Python | lgpl-2.1 | 4,714 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-05 20:20
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('osf', '0035_metaschema_active'),
]
operations... | mfraezz/osf.io | osf/migrations/0036_auto_20170605_1520.py | Python | apache-2.0 | 1,657 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Li... | mabeale/Lean | Algorithm.Python/TickDataFilteringAlgorithm.py | Python | apache-2.0 | 2,658 |
# Copyright 2016 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 required by applicable law or a... | catapult-project/catapult | third_party/google-endpoints/endpoints/resource_container.py | Python | bsd-3-clause | 8,074 |
from decimal import Decimal as D
import datetime
from django.test import TestCase
from django_dynamic_fixture import G
from oscar.apps.offer import models
from oscar.apps.order.models import OrderDiscount
from oscar.core.compat import get_user_model
from oscar.test.factories import create_order
User = get_user_mode... | Giftingnation/GN-Oscar-Custom | tests/unit/offer/availability_tests.py | Python | bsd-3-clause | 4,529 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
"""
oauthlib.oauth2.rfc6749
~~~~~~~~~~~~~~~~~~~~~~~
This module is an implementation of various logic needed
for consuming OAuth 2.0 RFC6749.
"""
import time
from oauthlib.oauth2.rfc6749 import tokens
from oauthlib.oauth2.rfc6749.parame... | yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/oauthlib/oauth2/rfc6749/clients/base.py | Python | mit | 8,298 |
import random
import string
from base import *
from util import *
MAGIC = str_random (100)
LENGTH = 100
OFFSET = 15
class Test (TestBase):
def __init__ (self):
TestBase.__init__ (self, __file__)
self.name = "Content Range, start"
self.request = "GET /Range100b HTTP/1.0\r\... | chetan/cherokee | qa/054-ContentRange.py | Python | gpl-2.0 | 704 |
from enigma import eServiceReference, eServiceCenter
class ServiceReference(eServiceReference):
def __init__(self, ref, reftype = eServiceReference.idInvalid, flags = 0, path = ''):
if reftype != eServiceReference.idInvalid:
self.ref = eServiceReference(reftype, flags, path)
elif not isinstance(ref, eServiceRe... | digidudeofdw/enigma2 | ServiceReference.py | Python | gpl-2.0 | 1,038 |
from __future__ import with_statement
import inspect
import logging
import sys
from django.conf import settings
from django.forms.forms import BoundField
from django.template import Context
from django.template.loader import get_template
from django.utils.html import conditional_escape
from django.utils.functional imp... | patrickstocklin/chattR | lib/python2.7/site-packages/crispy_forms/utils.py | Python | gpl-2.0 | 7,226 |
import ocl
import pyocl
import camvtk
import time
import datetime
import vtk
def main(filename="frame/f.png"):
print ocl.revision()
myscreen = camvtk.VTKScreen()
myscreen.camera.SetPosition(-15, -8, 15)
myscreen.camera.SetFocalPoint(5,5, 0)
# axis arrows
camvtk.drawArrows(m... | AlanZatarain/opencamlib | scripts/old/cutsim_test_tux_1.py | Python | gpl-3.0 | 7,645 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
from odoo.modules.loading import force_demo
from odoo.addons.base.models.ir_module import assert_log_admin_access
class IrDemo(models.TransientModel):
_name = 'ir.demo'
_description = '... | jeremiahyan/odoo | odoo/addons/base/models/ir_demo.py | Python | gpl-3.0 | 542 |
"""
Tests for Blocks Views
"""
from django.core.urlresolvers import reverse
from string import join
from urllib import urlencode
from urlparse import urlunparse
from opaque_keys.edx.locator import CourseLocator
from student.models import CourseEnrollment
from student.tests.factories import AdminFactory, CourseEnrollm... | shabab12/edx-platform | lms/djangoapps/course_api/blocks/tests/test_views.py | Python | agpl-3.0 | 9,891 |
"""
Copyright 2009 55 Minutes (http://www.55minutes.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed t... | 21strun/django-coverage | django_coverage/management/commands/test_coverage.py | Python | apache-2.0 | 1,565 |
import base64
import json
from django.core.urlresolvers import reverse
from onadata.apps.main.views import api
from onadata.apps.viewer.models.parsed_instance import ParsedInstance, \
_encode_for_mongo, _decode_from_mongo
from test_base import TestBase
def dict_for_mongo_without_userform_id(parsed_instance):
... | jomolinare/kobocat | onadata/apps/main/tests/test_form_api.py | Python | bsd-2-clause | 7,311 |
"""Tests for calls that span files.
These used to be a problem when we built a (single-file--whoops!) call graph,
but we don't anymore, so we can probably delete this at some point.
"""
from dxr.testing import DxrInstanceTestCase
class CrossFileCallerTests(DxrInstanceTestCase):
def test_callers(self):
"... | gartung/dxr | dxr/plugins/clang/tests/test_cross_file_callers/test_cross_file_callers.py | Python | mit | 576 |
import threading
import shared
import time
import sys
import os
import pickle
import tr#anslate
from helper_sql import *
from debug import logger
"""
The singleCleaner class is a timer-driven thread that cleans data structures
to free memory, resends messages when a remote node doesn't respond, and
sends pong messa... | JosephGoulden/PyBitmessageF2F | src/class_singleCleaner.py | Python | mit | 7,922 |