repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
webmull/phantomjs | src/breakpad/src/third_party/protobuf/protobuf/python/google/protobuf/internal/message_listener.py | 590 | 3354 | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions o... | bsd-3-clause |
AdamPI314/SOHR | include/tools/check_available_hosts.py | 2 | 2084 | #/usr/bin/env python
import subprocess as sp
import numpy as np
import re
import signal
def check_host():
cmd= "echo `hostname`"
pid=sp.Popen(cmd, shell= True, stdout=sp.PIPE, stderr= sp.PIPE)
out, err= pid.communicate()
if "linus" in out:
host= "linus"
elif "pople" in out:
host= "pople"
pid.wait()
retu... | mit |
pyjs/pyjs | pyjswidgets/pyjamas/ui/FormPanel.ie6.py | 7 | 1124 | class FormPanel:
def getTextContents(self, iframe):
JS("""
try {
if (!@{{iframe}}['contentWindow']['document'])
return null;
return @{{iframe}}['contentWindow']['document']['body']['innerText'];
} catch (e) {
return null;
}
... | apache-2.0 |
efiring/numpy-work | numpy/testing/decorators.py | 2 | 5819 | """Decorators for labeling test objects
Decorators that merely return a modified version of the original
function object are straightforward. Decorators that return a new
function object need to use
nose.tools.make_decorator(original_function)(decorator) in returning
the decorator, in order to preserve metadata such ... | bsd-3-clause |
anupam2221/isprime | isprime.py | 1 | 1522 | ##written 9-6-2017
##by Anupam KP (c)
##anupam2221@yahoo.in
##
##
##preprocessing time- O(n loglogn)
##Tells if a prime number in O(1)
dexterprime=[0]*500
def akpprocess(n):
n=int(n)
global dexterprime
dexterprime=[0]*(n+1)
dexterprime[0]=dexterprime[1]=1
for i in range(2,n+... | mit |
mumble-voip/libmumble-gyp | test/generator-output/gyptest-relocate.py | 216 | 1670 | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies that a project hierarchy created with the --generator-output=
option can be built even when it's relocated to a different path.... | bsd-3-clause |
ninemoreminutes/lmiapi | lmiapi/central.py | 1 | 7685 | # Python
import json
import logging
import re
import urllib
import urlparse
import warnings
import webbrowser
# Requests
import requests
# BeautifulSoup4
from bs4 import BeautifulSoup
__all__ = ['LogMeInCentralAPI']
logger = logging.getLogger('lmiapi.central')
class LogMeInCentralAPI(object): # pragma: no cover
... | bsd-3-clause |
jlspyaozhongkai/Uter | third_party_build/Python-2.7.9/lib/python2.7/lib-tk/tkCommonDialog.py | 193 | 1418 | # base class for tk common dialogues
#
# this module provides a base class for accessing the common
# dialogues available in Tk 4.2 and newer. use tkFileDialog,
# tkColorChooser, and tkMessageBox to access the individual
# dialogs.
#
# written by Fredrik Lundh, May 1997
#
from Tkinter import *
class Dialog:
com... | gpl-3.0 |
h3biomed/ansible-modules-core | network/vyos/vyos_facts.py | 29 | 9161 | #!/usr/bin/python
#
# 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 option) any later version.
#
# Ansible is distribut... | gpl-3.0 |
BT-rmartin/odoo | addons/web_diagram/controllers/main.py | 268 | 4321 | import openerp
from openerp.tools.safe_eval import safe_eval as eval
class DiagramView(openerp.http.Controller):
@openerp.http.route('/web_diagram/diagram/get_diagram_info', type='json', auth='user')
def get_diagram_info(self, req, id, model, node, connector,
src_node, des_node, label... | agpl-3.0 |
karolciba/playground | ds_algos/heap.py | 1 | 3241 | #!/usr/bin/env python
def heapsort(ary, strategy = 'up'):
swaps = 0
def swap(i,j):
nonlocal swaps
swaps += 1
ary[i], ary[j] = ary[j], ary[i]
lst = len(ary)
def siftup(pos):
while pos:
if ary[pos] < ary[pos//2]:
swap(pos,pos//2)
... | unlicense |
sorenk/ansible | test/units/modules/network/f5/test_bigiq_regkey_license.py | 17 | 3902 | # -*- 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 pytest
import sys
from nose.plugins.skip i... | gpl-3.0 |
ekarlso/python-jolokiaclient | jolokiaclient/exceptions.py | 17 | 11913 | # Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 Nebula, Inc.
# Copyright 2013 Alessio Ababilov
# Copyright 2013 OpenStack Foundation
# 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
# ... | apache-2.0 |
SimtterCom/gyp | test/win/gyptest-link-deffile.py | 344 | 1252 | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Make sure a .def file is handled in the link.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test = TestGyp.TestGyp(form... | bsd-3-clause |
kuznetz/rabbitvcs | rabbitvcs/vcs/git/gittyup/tests/commit.py | 4 | 1027 | #
# test/stage.py
#
import os
from shutil import rmtree
from sys import argv
from optparse import OptionParser
from gittyup.client import GittyupClient
from gittyup.objects import *
from util import touch, change
parser = OptionParser()
parser.add_option("-c", "--cleanup", action="store_true", default=False)
(option... | gpl-2.0 |
Endika/edx-platform | openedx/core/djangoapps/credit/migrations/0001_initial.py | 48 | 12567 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import openedx.core.djangoapps.credit.models
import model_utils.fields
import xmodule_django.models
import jsonfield.fields
import django.db.models.deletion
import django.utils.timezone
from django.conf import sett... | agpl-3.0 |
jclakkis/discus-inferno | flaskenv/lib/python2.7/site-packages/flask/testsuite/testing.py | 561 | 7411 | # -*- coding: utf-8 -*-
"""
flask.testsuite.testing
~~~~~~~~~~~~~~~~~~~~~~~
Test client and more.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
import unittest
from flask.testsuite import FlaskTestCase
from flask._compat import text_type
c... | mit |
3dfxsoftware/cbss-addons | npg_bank_account_reconciliation/npg_bank_account_reconciliation.py | 1 | 21839 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 NovaPoint Group LLC (<http://www.novapointgroup.com>)
# Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>)
#
# This program is f... | gpl-2.0 |
robobrobro/ballin-octo-shame | lib/Python-3.4.3/Lib/idlelib/idle_test/test_config_name.py | 93 | 2399 | """Unit tests for idlelib.configSectionNameDialog"""
import unittest
from idlelib.idle_test.mock_tk import Var, Mbox
from idlelib import configSectionNameDialog as name_dialog_module
name_dialog = name_dialog_module.GetCfgSectionNameDialog
class Dummy_name_dialog:
# Mock for testing the following methods of name_... | mit |
geraldarthur/qgis-openlayers-plugin | openlayers/weblayers/weblayer_registry.py | 5 | 2552 | # -*- coding: utf-8 -*-
"""
/***************************************************************************
OpenLayers Plugin
A QGIS plugin
-------------------
begin : 2009-11-30
copyright : (C) 2009 by Pirmin Kalberer, Sourcepole
email : pka at source... | gpl-2.0 |
johngian/remo | remo/profiles/migrations/0050_auto__add_field_userprofile_is_rotm_nominee.py | 3 | 11048 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'UserProfile.is_rotm_nominee'
db.add_column(u'profiles_userprofile', 'is_rotm_nominee',
... | bsd-3-clause |
jianhuashao/WebDownloadJobsManage | dbs/google_drive/oauth2client/keyring_storage.py | 273 | 3227 | # Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | apache-2.0 |
gbaty/shiboken2 | tests/samplebinding/ownership_delete_child_in_python_test.py | 6 | 1815 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of the Shiboken Python Bindings Generator project.
#
# Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
#
# Contact: PySide team <contact@pyside.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms... | gpl-2.0 |
KitKatXperience/platform_external_chromium_org | chrome/test/webdriver/test/chromedriver.py | 41 | 7950 | # 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.
"""Chrome WebDriver that implements extra Chrome-specific functionality.
This module is experimental and will change and break without warning.
Use at y... | bsd-3-clause |
porjo/docker | docs/docs-update.py | 12 | 8230 | #!/usr/bin/env python
#
# Sven's quick hack script to update the documentation
#
# call with:
# ./docs/update.py /usr/bin/docker
#
import datetime
import re
from sys import argv
import subprocess
import os
import os.path
script, docker_cmd = argv
date_string = datetime.date.today().strftime('%B %Y')
def pri... | apache-2.0 |
bclau/nova | nova/availability_zones.py | 10 | 4790 | # Copyright (c) 2012 OpenStack Foundation
# 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 ... | apache-2.0 |
alyosha1879/ryu | ryu/utils.py | 6 | 4894 | # Copyright (C) 2011 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2011 Isaku Yamahata <yamahata at valinux co jp>
#
# 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://... | apache-2.0 |
caldwell/servo | tests/wpt/css-tests/tools/wptserve/tests/functional/base.py | 293 | 1831 | import base64
import logging
import os
import unittest
import urllib
import urllib2
import urlparse
import wptserve
logging.basicConfig()
here = os.path.split(__file__)[0]
doc_root = os.path.join(here, "docroot")
class Request(urllib2.Request):
def __init__(self, *args, **kwargs):
urllib2.Request.__init... | mpl-2.0 |
akash1808/nova_test_latest | nova/tests/unit/virt/libvirt/volume/test_fibrechannel.py | 33 | 1894 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | apache-2.0 |
storm-computers/odoo | addons/account_budget/wizard/account_budget_report.py | 47 | 1121 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from openerp.osv import fields, osv
class account_budget_report(osv.osv_memory):
_name = "account.budget.report"
_description = "Account Budget report for analytic account"
_columns = {
... | agpl-3.0 |
venkey-ariv/fullerite | src/diamond/collectors/nginx/nginx.py | 6 | 3290 | # coding=utf-8
"""
Collect statistics from Nginx
#### Dependencies
* urllib2
#### Usage
To enable the nginx status page to work with defaults,
add a file to /etc/nginx/sites-enabled/ (on Ubuntu) with the
following content:
<pre>
server {
listen 127.0.0.1:8080;
server_name localhost;
location /... | apache-2.0 |
wschenck/nest-simulator | extras/ConnPlotter/examples/non_dale.py | 20 | 2836 | # -*- coding: utf-8 -*-
#
# non_dale.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 License, or
# ... | gpl-2.0 |
bentilly/heroes | lib/flask/testsuite/helpers.py | 405 | 21973 | # -*- coding: utf-8 -*-
"""
flask.testsuite.helpers
~~~~~~~~~~~~~~~~~~~~~~~
Various helpers.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import os
import flask
import unittest
from logging import StreamHandler
from flask.testsuite import FlaskTestCase,... | apache-2.0 |
newemailjdm/pybrain | examples/rl/environments/ode/ccrl_glass_pgpe.py | 30 | 2812 | #!/usr/bin/env python
#########################################################################
# Reinforcement Learning with PGPE on the CCRL ODE Environment
#
# The CCRL robot is a body structure with 2x 7 DoF Arms.
# Complex grasping tasks can be learned with this environment.
#
# Control/Actions:
# The agent can c... | bsd-3-clause |
Omegaphora/external_chromium_org | tools/memory_inspector/memory_inspector/classification/native_heap_classifier_unittest.py | 89 | 5824 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from memory_inspector.classification import native_heap_classifier
from memory_inspector.core import native_heap
from memory_inspector.core ... | bsd-3-clause |
skbkontur/Diamond | src/collectors/mesos_cgroup/test/testmesos_cgroup.py | 16 | 6777 | #!/usr/bin/python
# coding=utf-8
##########################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import MagicMock, Mock, mock_open
from mock import patch
from diamond.collector import Collector
fro... | mit |
usingnamespace/pyramid_authsanity | src/pyramid_authsanity/__init__.py | 1 | 2689 | from pyramid.settings import asbool, aslist
from .interfaces import IAuthSourceService
from .policy import AuthServicePolicy
from .sources import (
CookieAuthSourceInitializer,
HeaderAuthSourceInitializer,
SessionAuthSourceInitializer,
)
from .util import int_or_none, kw_from_settings
default_settings = (... | isc |
Rickyfox/MLMA2 | core/DataHandler.py | 1 | 1770 | '''
Created on Dec 17, 2014
@author: Dominik Lang
'''
import csv
import os.path
from random import shuffle
import collections
import numpy
from sklearn.preprocessing import Imputer
class DataHandler(object):
def __init__(self):
pass
'''
@summary: A method to handle reading the data in from... | gpl-2.0 |
shakamunyi/tensorflow | tensorflow/contrib/layers/python/layers/feature_column.py | 19 | 105773 | # 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... | apache-2.0 |
laurenrevere/osf.io | scripts/osfstorage/glacier_audit.py | 6 | 3553 | #!/usr/bin/env python
# encoding: utf-8
"""Verify that all `OsfStorageFileVersion` records created earlier than two
days before the latest inventory report are contained in the inventory, point
to the correct Glacier archive, and have an archive of the correct size.
Should be run after `glacier_inventory.py`.
"""
impo... | apache-2.0 |
tdenniston/Halide | python_bindings/tutorial/lesson_11_cross_compilation.py | 6 | 6731 | #!/usr/bin/python3
# Halide tutorial lesson 11.
# This lesson demonstrates how to use Halide as a cross-compiler.
# This lesson can be built by invoking the command:
# make tutorial_lesson_11_cross_compilation
# in a shell with the current directory at the top of the halide source tree.
# Otherwise, see the platf... | mit |
wzmao/mbio | format.py | 2 | 1229 | import os
import sys
def autop(x, allyes=0):
print x
a = os.popen('autopep8 ' + x + ' -d').read()
if a == '':
print '>>>> No change.'
else:
print a
print x
if not allyes:
a = raw_input("Do you want to change?(y/n):")
if a == 'y':
... | mit |
Pikecillo/genna | external/4Suite-XML-1.0.2/test/Xml/XPath/Core/test_nodeset_expr.py | 1 | 2062 | #!/usr/bin/env python
#
# File Name: File Name
#
# Documentation: http://docs.fourthought.com/file/name.html
#
def Test(tester):
tester.startGroup('Node-set Expressions')
tester.startTest('Creating test environment')
from Ft.Xml.XPath import ParsedExpr
from Ft.Xml.XPath import ParsedPredi... | gpl-2.0 |
AstroTech/atlassian-python-api | examples/bamboo/bamboo_label_based_cleaner.py | 2 | 2343 | import logging
from datetime import datetime
from datetime import timedelta
from atlassian import Bamboo
"""
Example shows how to clean up expired build results for specific label.
Feel free to modify OLDER_DAYS and LABEL parameters.
You can remove, after changing value for DRY_RUN variable
"""
logging.basicConfig(l... | apache-2.0 |
jfmartinez64/test | couchpotato/core/media/movie/_base/main.py | 15 | 14072 | import traceback
import time
from CodernityDB.database import RecordNotFound
from couchpotato import get_db
from couchpotato.api import addApiView
from couchpotato.core.event import fireEvent, fireEventAsync, addEvent
from couchpotato.core.helpers.encoding import toUnicode
from couchpotato.core.helpers.variable import... | gpl-3.0 |
mlmurray/TensorFlow-Experimentation | examples/3 - Neural Networks/alexnet.py | 1 | 5087 | '''
AlexNet implementation example using TensorFlow library.
This example is using the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/)
AlexNet Paper (http://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf)
Author: Aymeric Damien
Project: https://gi... | mit |
kuasha/cosmos | samples/barebone/views.py | 1 | 3616 | import logging
import settings
from tornado.httpclient import AsyncHTTPClient
import cosmos
from cosmos.service.auth import BasicLoginHandler
__author__ = 'Maruf Maniruzzaman'
import tornado
from tornado import gen
import json
from cosmos.service.requesthandler import RequestHandler
class IndexHandler(RequestHan... | mit |
ismail-s/urwid | urwid/listbox.py | 12 | 59569 | #!/usr/bin/python
#
# Urwid listbox class
# Copyright (C) 2004-2012 Ian Ward
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at ... | lgpl-2.1 |
Ch00k/ansible | lib/ansible/module_utils/known_hosts.py | 80 | 6716 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | gpl-3.0 |
crepererum/invenio | invenio/modules/previewer/previewerext/gview.py | 15 | 1631 | # This file is part of Invenio.
# Copyright (C) 2013, 2014 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) any later version.
#
# Inveni... | gpl-2.0 |
liberorbis/libernext | env/lib/python2.7/site-packages/celery/tests/bin/test_worker.py | 4 | 24058 | from __future__ import absolute_import
import logging
import os
import sys
from functools import wraps
from billiard import current_process
from kombu import Exchange, Queue
from celery import platforms
from celery import signals
from celery.app import trace
from celery.apps import worker as cd
from celery.bin.work... | gpl-2.0 |
JohannesBuchner/doit | doc/samples/parameters.py | 5 | 1732 | def task_py_params():
def show_params(param1, param2):
print(param1)
print(5 + param2)
return {'actions':[(show_params,)],
'params':[{'name':'param1',
'short':'p',
'default':'default value'},
{'name':'param2',
... | mit |
stackforge/monasca-api | monasca_api/policies/versions.py | 2 | 1175 | # Copyright 2018 OP5 AB
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | apache-2.0 |
uclaros/QGIS | tests/src/python/test_qgssymbolexpressionvariables.py | 45 | 4493 | # -*- coding: utf-8 -*-
"""
***************************************************************************
test_qgssymbolexpressionvariables.py
---------------------
Date : January 2016
Copyright : (C) 2016 by Matthias Kuhn
Email : matthias at opengis dot ch
*... | gpl-2.0 |
cfg2015/EPT-2015-2 | addons/fetchmail/fetchmail.py | 64 | 15663 | # -*- 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... | agpl-3.0 |
pumaking/hackracer | lib/flask/_compat.py | 783 | 2164 | # -*- coding: utf-8 -*-
"""
flask._compat
~~~~~~~~~~~~~
Some py2/py3 compatibility support based on a stripped down
version of six so we don't have to depend on a specific version
of it.
:copyright: (c) 2013 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import sys
PY... | apache-2.0 |
vladikr/nova_drafts | nova/tests/integrated/api/client.py | 3 | 11942 | # Copyright (c) 2011 Justin Santa Barbara
#
# 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 applicab... | apache-2.0 |
marcoarruda/MissionPlanner | Lib/lib2to3/main.py | 50 | 7057 | """
Main program for 2to3.
"""
from __future__ import with_statement
import sys
import os
import difflib
import logging
import shutil
import optparse
from . import refactor
def diff_texts(a, b, filename):
"""Return a unified diff of two strings."""
a = a.splitlines()
b = b.splitlines... | gpl-3.0 |
Sarah-Alsinan/muypicky | lib/python3.6/site-packages/pip/_vendor/html5lib/filters/lint.py | 328 | 3365 | from __future__ import absolute_import, division, unicode_literals
from pip._vendor.six import text_type
from . import base
from ..constants import namespaces, voidElements
from ..constants import spaceCharacters
spaceCharacters = "".join(spaceCharacters)
class Filter(base.Filter):
def __init__(self, source, r... | mit |
lanfker/tdma_imac | .waf-1.6.7-0a94702c61504c487a251b8d0a04ca9a/waflib/Node.py | 4 | 11193 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/svn/docs/wafbook/single.html#_obtaining_the_waf_file
import sys
if sys.hexversion < 0x020400f0: from sets import Set as set
import os,re,sys,shutil
from waflib import Utils,Errors
exclude_regs='''
**/*~
**/#*#
**/.#*
**/%*%
**/.... | gpl-2.0 |
siutanwong/scikit-learn | sklearn/neighbors/tests/test_approximate.py | 142 | 18692 | """
Testing for the approximate neighbor search using
Locality Sensitive Hashing Forest module
(sklearn.neighbors.LSHForest).
"""
# Author: Maheshakya Wijewardena, Joel Nothman
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_a... | bsd-3-clause |
AngelkPetkov/titanium_mobile | support/iphone/filetail.py | 37 | 7564 | ## {{{ http://code.activestate.com/recipes/436477/ (r1)
# filetail.py
# Copyright (C) 2005 by The Trustees of the University of Pennsylvania
# Licensed under the Python license http://www.python.org/psf/license/
# Author: Jon Moore
"""
Module to allow for reading lines from a continuously-growing file (such as
a syste... | apache-2.0 |
gurgeh/data-preppy | convert_coords.py | 1 | 2602 | import math
# Code converted from JS: http://latlong.mellifica.se/
axis = 6378137.0
flattening = 1.0 / 298.257222101
central_meridian = 15.00
lat_of_origin = 0.0
scale = 0.9996
false_northing = 0.0
false_easting = 500000.0
def grid_to_geodetic(x, y):
e2 = flattening * (2.0 - flattening)
n = flattening / (2... | apache-2.0 |
lasershow/codecombat | scripts/devSetup/repositoryInstaller.py | 70 | 4158 | from __future__ import print_function
__author__ = u'schmatz'
import configuration
import errors
import subprocess
import os
import sys
from which import which
#git clone https://github.com/nwinter/codecombat.git coco
class RepositoryInstaller():
def __init__(self,config):
self.config = config
asser... | mit |
hecchi777/S3-SlaacSecuritySolution | impacket-0.9.11/examples/lookupsid.py | 1 | 5922 | #!/usr/bin/python
# Copyright (c) 2012-2014 CORE Security Technologies
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# $Id: lookupsid.py 1101 2014-01-14 22:15:30Z bethus@gmail.com $
#
# DCE/RPC lookup s... | apache-2.0 |
ambikeshwar1991/sandhi-2 | module/gr36/grc/python/convert_hier.py | 16 | 3773 | """
Copyright 2008-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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) any l... | gpl-3.0 |
Pixyn25/blakecoin_p2pool | p2pool/test/test_p2p.py | 269 | 2724 | import random
from twisted.internet import defer, endpoints, protocol, reactor
from twisted.trial import unittest
from p2pool import networks, p2p
from p2pool.bitcoin import data as bitcoin_data
from p2pool.util import deferral
class Test(unittest.TestCase):
@defer.inlineCallbacks
def test_sharereq(self):
... | gpl-3.0 |
EduPepperPD/pepper2013 | common/lib/capa/capa/util.py | 19 | 3128 | from calc import evaluator
from cmath import isinf
#-----------------------------------------------------------------------------
#
# Utility functions used in CAPA responsetypes
def compare_with_tolerance(v1, v2, tol):
''' Compare v1 to v2 with maximum tolerance tol
tol is relative if it ends in %; otherwis... | agpl-3.0 |
emergebtc/muddery | evennia/evennia/utils/ansi.py | 1 | 33100 | """
ANSI - Gives colour to text.
Use the codes defined in ANSIPARSER in your text
to apply colour to text according to the ANSI standard.
Examples:
This is %crRed text%cn and this is normal again.
This is {rRed text{n and this is normal again.
Mostly you should not need to call parse_ansi() explicitly;
it is run b... | bsd-3-clause |
VOLTTRON/volttron-applications | kisensum/openadr/openadr/vtn/migrations/0005_auto_20171020_2019.py | 2 | 1165 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-20 20:19
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('vtn', '0004_auto_20171020_2019'),
... | bsd-3-clause |
botify-labs/simpleflow | simpleflow/swf/process/worker/base.py | 1 | 13859 | import json
import multiprocessing
import os
import sys
import traceback
import uuid
from base64 import b64decode
import psutil
import swf.actors
import swf.exceptions
from simpleflow import format, logger, settings
from simpleflow.dispatch import dynamic_dispatcher
from simpleflow.download import download_binaries
f... | mit |
repotvsupertuga/tvsupertuga.repository | script.module.streamlink.base/resources/lib/streamlink/utils/six.py | 172 | 30888 | # Copyright (c) 2010-2017 Benjamin Peterson
#
# 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, publi... | gpl-2.0 |
lokirius/python-for-android | python3-alpha/python3-src/Lib/ctypes/test/test_loading.py | 52 | 4097 | from ctypes import *
import sys, unittest
import os
from ctypes.util import find_library
from ctypes.test import is_resource_enabled
libc_name = None
if os.name == "nt":
libc_name = find_library("c")
elif os.name == "ce":
libc_name = "coredll"
elif sys.platform == "cygwin":
libc_name = "cygwin1.dll"
else:
... | apache-2.0 |
brian-yang/mozillians | vendor-local/lib/python/django_filters/filterset.py | 16 | 15216 | from __future__ import absolute_import
from __future__ import unicode_literals
import types
import copy
from django import forms
from django.core.validators import EMPTY_VALUES
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.utils import six
from django.utils.text import... | bsd-3-clause |
beni55/furious.js | configure.py | 3 | 4556 | #!/usr/bin/python
from __future__ import print_function
import optparse
import os
import sys
import glob
import ninja_syntax
def replace_ext(filename, ext):
return os.path.splitext(filename)[0] + ext
if __name__ == '__main__':
parser = optparse.OptionParser()
parser.add_option("--with-protoc-c", dest="pr... | mit |
stbuehler/pdns | regression-tests.dnsdist/test_Routing.py | 1 | 12809 | #!/usr/bin/env python
import threading
import time
import dns
from dnsdisttests import DNSDistTest
class TestRoutingPoolRouting(DNSDistTest):
_config_template = """
newServer{address="127.0.0.1:%s", pool="real"}
addAction(makeRule("poolaction.routing.tests.powerdns.com"), PoolAction("real"))
"""
... | gpl-2.0 |
ixc/django-fluent-contents | fluent_contents/tests/utils.py | 2 | 4672 | from __future__ import print_function
from future.builtins import str
from functools import wraps
from django.conf import settings, UserSettingsHolder
from django.contrib.auth import get_user_model
from django.core.management import call_command
from django.contrib.sites.models import Site
from django.db.models import ... | apache-2.0 |
Ichag/openerp-server | openerp/addons/base/res/res_config.py | 1 | 28694 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
eufarn7sp/egads-eufar | egads/thirdparty/quantities/constants/alpha.py | 4 | 1344 | # -*- coding: utf-8 -*-
"""
"""
from __future__ import absolute_import
from ._utils import _cd
from ..unitquantity import UnitConstant
m_alpha = alpha_particle_mass = UnitConstant(
'alpha_particle_mass',
_cd('alpha particle mass'),
symbol='m_alpha',
u_symbol='m_α'
)
alpha_particle_mass_energy_equival... | bsd-3-clause |
untom/keras | tests/auto/keras/test_normalization.py | 33 | 3810 | import unittest
import numpy as np
from numpy.testing import assert_allclose
from theano import tensor as T
from keras.layers import normalization
from keras.models import Sequential
class TestBatchNormalization(unittest.TestCase):
def setUp(self):
self.input_1 = np.arange(10)
self.input_2 = np.ze... | mit |
afloren/nipype | nipype/interfaces/cmtk/convert.py | 14 | 10363 | """
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
>>> os.chdir(datadir)
"""
import os, os.path as op
import datetime
import string
imp... | bsd-3-clause |
autosportlabs/RaceCapture_App | autosportlabs/racecapture/views/configuration/rcp/configview.py | 1 | 20903 | #
# Race Capture App
#
# Copyright (C) 2014-2017 Autosport Labs
#
# This file is part of the Race Capture App
#
# This 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 ... | gpl-3.0 |
jetty840/ReplicatorG | skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft_plugins/export_plugins/static_plugins/gcode_small.py | 6 | 4301 | """
This page is in the table of contents.
Gcode_small is an export plugin to remove the comments and the redundant z and feed rate parameters from a gcode file.
An export plugin is a script in the export_plugins folder which has the getOutput function, the globalIsReplaceable variable and if it's output is not replac... | gpl-2.0 |
sencha/chromium-spacewalk | chrome/test/chromedriver/third_party/googlecode/googlecode_upload.py | 160 | 8608 | #!/usr/bin/env python
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is intended to be both a useful script for people who want to
# streamline project uploads and a reference implementation for
... | bsd-3-clause |
RCOSDP/waterbutler | waterbutler/core/streams/base64.py | 4 | 1100 | import base64
import asyncio
class Base64EncodeStream(asyncio.StreamReader):
@staticmethod
def calculate_encoded_size(size):
size = 4 * size / 3
if size % 4:
size += 4 - size % 4
return int(size)
def __init__(self, stream, **kwargs):
self.extra = b''
s... | apache-2.0 |
Mashape/unirest-python | unirest/test/test_unirest.py | 4 | 5262 | # -*- coding:utf-8 -*-
import sys
import os
import unittest
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
import unirest
class UnirestTestCase(unittest.TestCase):
def test_get(self):
response = unirest.get('http://httpbin.org/get?name=Mark', params={"nick":"thefosk"})
self.assertEqual(... | mit |
pabloborrego93/edx-platform | common/lib/xmodule/xmodule/annotator_token.py | 211 | 1542 | """
This file contains a function used to retrieve the token for the annotation backend
without having to create a view, but just returning a string instead.
It can be called from other files by using the following:
from xmodule.annotator_token import retrieve_token
"""
import datetime
from firebase_token_generator im... | agpl-3.0 |
pabloborrego93/edx-platform | pavelib/tests.py | 9 | 11010 | """
Unit test tasks
"""
import re
import os
import sys
from paver.easy import sh, task, cmdopts, needs
from pavelib.utils.test import suites
from pavelib.utils.envs import Env
from pavelib.utils.timer import timed
from pavelib.utils.passthrough_opts import PassthroughTask
from optparse import make_option
try:
from... | agpl-3.0 |
demiangomez/Parallel.GAMIT | com/ScanArchive.py | 1 | 66663 | """
Project: Parallel.Archive
Date: 02/16/2017
Author: Demian D. Gomez
Main routines to load the RINEX files to the database, load station information, run PPP on the archive files and obtain
the OTL coefficients
usage: pyScanArchive.py [-h] [-rinex] [-otl]
[-stninfo [argument [argument ...]]]... | gpl-3.0 |
ekasitk/sahara | sahara/utils/hacking/logging_checks.py | 6 | 4253 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed u... | apache-2.0 |
codasus/django-blogages | blogages/django/contrib/gis/gdal/tests/test_ds.py | 233 | 10504 | import os, os.path, unittest
from django.contrib.gis.gdal import DataSource, Envelope, OGRGeometry, OGRException, OGRIndexError, GDAL_VERSION
from django.contrib.gis.gdal.field import OFTReal, OFTInteger, OFTString
from django.contrib.gis.geometry.test_data import get_ds_file, TestDS
# List of acceptable data sources.... | mit |
Daniex/horizon | openstack_dashboard/dashboards/admin/instances/views.py | 8 | 7555 | # Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 OpenStack Foundation
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use t... | apache-2.0 |
x303597316/hue | desktop/core/ext-py/Paste-2.0.1/tests/test_auth/test_auth_cookie.py | 47 | 1527 | # (c) 2005 Clark C. Evans
# This module is part of the Python Paste Project and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from six.moves import xrange
import six
from paste.auth import cookie
from paste.wsgilib import raw_interactive, dump_environ
from paste.response impo... | apache-2.0 |
ntddk/pemu | scripts/tracetool/format/simpletrace_stap.py | 84 | 2400 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Generate .stp file that outputs simpletrace binary traces (DTrace with SystemTAP only).
"""
__author__ = "Stefan Hajnoczi <redhat.com>"
__copyright__ = "Copyright (C) 2014, Red Hat, Inc."
__license__ = "GPL version 2 or (at your option) any later version"
__m... | gpl-2.0 |
CSC301H-Fall2013/JuakStore | site-packages/tests/modeltests/or_lookups/tests.py | 150 | 7625 | from __future__ import absolute_import
from datetime import datetime
from operator import attrgetter
from django.db.models import Q
from django.test import TestCase
from .models import Article
class OrLookupsTests(TestCase):
def setUp(self):
self.a1 = Article.objects.create(
headline='Hell... | mit |
jjx02230808/project0223 | examples/decomposition/plot_kernel_pca.py | 353 | 2011 | """
==========
Kernel PCA
==========
This example shows that Kernel PCA is able to find a projection of the data
that makes data linearly separable.
"""
print(__doc__)
# Authors: Mathieu Blondel
# Andreas Mueller
# License: BSD 3 clause
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomp... | bsd-3-clause |
zibneuro/brainvispy | generators/uniformpointcloud.py | 1 | 2947 | import vtk
import math
import numpy as np
from core.settings import Settings
class UPoint:
def __init__(self, p, dist_to_closest_point):
self.p = p
self.dist_to_closest_point = dist_to_closest_point
def compute_energy(self):
diff = self.dist_to_closest_point - Settings.inter_neuron_distance
if... | bsd-3-clause |
openmicroscopy/omero-marshal | omero_marshal/decode/decoders/screen.py | 1 | 1831 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Glencoe Software, Inc. All rights reserved.
#
# This software is distributed under the terms described by the LICENCE file
# you can find at the root of the distribution bundle.
# If the file is missing please request a copy by contacting
# jason@glen... | gpl-2.0 |
tellesnobrega/storm_plugin | sahara/tests/unit/service/validation/test_cluster_template_create_validation.py | 5 | 8632 | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | apache-2.0 |
nwjs/chromium.src | tools/cr/cr/actions/runner.py | 10 | 2365 | # Copyright 2013 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.
"""A module for the Runner base class."""
import cr
class Runner(cr.Action, cr.Plugin.Type):
"""Base class for implementing target runners.
Runner im... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.