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 |
|---|---|---|---|---|---|
SanketDG/networkx | networkx/algorithms/centrality/tests/test_katz_centrality.py | 43 | 11513 | # -*- coding: utf-8 -*-
import math
from nose import SkipTest
from nose.tools import *
import networkx
class TestKatzCentrality(object):
def test_K5(self):
"""Katz centrality: K5"""
G = networkx.complete_graph(5)
alpha = 0.1
b = networkx.katz_centrality(G, alpha)
v = math.s... | bsd-3-clause |
defance/edx-platform | common/lib/xmodule/xmodule/assetstore/tests/test_asset_xml.py | 113 | 3631 | """
Test for asset XML generation / parsing.
"""
from path import Path as path
from lxml import etree
from contracts import ContractNotRespected
import unittest
from opaque_keys.edx.locator import CourseLocator
from xmodule.assetstore import AssetMetadata
from xmodule.modulestore.tests.test_assetstore import AssetSto... | agpl-3.0 |
nchah/inf1340_2015_asst1 | test_exercise3.py | 17 | 1680 | #!/usr/bin/env python
""" Module to test exercise3.py """
__author__ = 'Susan Sim'
__email__ = "ses@drsusansim.org"
__copyright__ = "2015 Susan Sim"
__license__ = "MIT License"
import pytest
import mock
from exercise3 import diagnose_car
def test_accepted_inputs(capsys):
with mock.patch("__builtin__.raw_input... | mit |
Lessig2016/teams | wtforms/i18n.py | 52 | 2063 | import os
def messages_path():
"""
Determine the path to the 'messages' directory as best possible.
"""
module_path = os.path.abspath(__file__)
return os.path.join(os.path.dirname(module_path), 'locale')
def get_builtin_gnu_translations(languages=None):
"""
Get a gettext.GNUTranslations ... | agpl-3.0 |
immesys/smap | schema/test/test.py | 7 | 2821 |
import sys
import os
import uuid
import json
import glob
from avro import schema
from avro import io
class SmapSchemas:
SCHEMAS = [
# new extension types
"uuid",
"UnitofTime", "Duration",
"ReadingType", "ReadingValue",
'InstrumentMetadata', 'LocationMetadata', 'Operato... | bsd-2-clause |
NitrousPG/forkbot | server_events.py | 1 | 4992 | # LICENSE
# 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 later version.
#
# This program is distributed in the hope that it will be us... | gpl-3.0 |
joshloyal/scikit-learn | sklearn/utils/arpack.py | 68 | 73115 | """
This contains a copy of the future version of
scipy.sparse.linalg.eigen.arpack.eigsh
It's an upgraded wrapper of the ARPACK library which
allows the use of shift-invert mode for symmetric matrices.
Find a few eigenvectors and eigenvalues of a matrix.
Uses ARPACK: http://www.caam.rice.edu/software/ARPACK/
"""
#... | bsd-3-clause |
mancoast/CPythonPyc_test | fail/335_test_caching.py | 29 | 3582 | """Test that sys.modules is used properly by import."""
from .. import util
from . import util as import_util
import sys
from types import MethodType
import unittest
class UseCache(unittest.TestCase):
"""When it comes to sys.modules, import prefers it over anything else.
Once a name has been resolved, sys.m... | gpl-3.0 |
Pragmatismo/TimelapsePi-EasyControl | webcamcap_show_numpy.py | 1 | 8684 | #!/usr/bin/python
import time
import os
import sys
import pygame
import numpy
from PIL import Image, ImageDraw, ImageChops
print("")
print("")
print(" USE l=3 to take a photo every 3 somethings, try a 1000 or 2")
print(" t to take triggered photos ")
print(" cap=/home/pi/folder/ to set caps path other than c... | gpl-2.0 |
mbj4668/pyang | pyang/xpath.py | 1 | 12087 | from . import xpath_lexer
from . import xpath_parser
from .error import err_add
from .util import prefix_to_module, search_data_node, data_node_up
from .syntax import re_identifier
core_functions = {
'last': ([], 'number'),
'position': ([], 'number'),
'count': (['node-set'], 'number'),
'id': (['object'... | isc |
AnySDK/Sample_CPP_Cocos2dx | cocos2d/download-deps.py | 17 | 12760 | #!/usr/bin/env python
#coding=utf-8
#
# ./download-deps.py
#
# Download Cocos2D-X resources from github (https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin) and extract from ZIP
#
# Helps prevent repo bloat due to large binary files since they can
# be hosted separately.
#
"""*************************************... | mit |
YUNZHONGTAN/MY_Python_script | soft_ware/pymongo-3.2/pymongo/uri_parser.py | 19 | 12336 | # Copyright 2011-2015 MongoDB, 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 writi... | gpl-3.0 |
simone-campagna/zapper | lib/python/zapper/lock_file.py | 1 | 1913 | #!/usr/bin/env python3
#
# Copyright 2013 Simone Campagna
#
# 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 ... | apache-2.0 |
LinguList/server | app/settings/sound_classes/asjp/asjp.py | 1 | 3293 | #! /usr/bin/env python
from __future__ import division,print_function
from lingpy.data.derive import compile_model
from scipy.spatial.distance import squareform
from time import sleep
from pickle import dump
asjp = {}
score = open('score','r').read()
score = score.split('\n')
del score[-1]
dicto = {}
for line in sco... | gpl-2.0 |
ovnicraft/openerp-restaurant | mail/mail_message_subtype.py | 387 | 3094 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
wevoice/wesub | dev_settings_test.py | 1 | 2112 | # Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your op... | agpl-3.0 |
jk1/intellij-community | python/lib/Lib/os.py | 74 | 24851 | r"""OS routines for Mac, NT, or Posix depending on what system we're on.
This exports:
- all functions from posix, nt, os2, or ce, e.g. unlink, stat, etc.
- os.path is one of the modules posixpath, or ntpath
- os.name is 'posix', 'nt', 'os2', 'ce' or 'riscos'
- os.curdir is a string representing the current di... | apache-2.0 |
ahmbas/django-ajax-selects | ajax_select/views.py | 6 | 2842 |
from ajax_select import get_lookup
from django.contrib.admin import site
from django.db import models
from django.http import HttpResponse
try:
import json
except ImportError:
from django.utils import simplejson as json
from django.utils.encoding import force_text
def ajax_lookup(request, channel):
""" ... | gpl-3.0 |
doismellburning/edx-platform | common/djangoapps/terrain/stubs/xqueue.py | 123 | 8708 | """
Stub implementation of XQueue for acceptance tests.
Configuration values:
"default" (dict): Default response to be sent to LMS as a grade for a submission
"<submission>" (dict): Grade response to return for submissions containing the text <submission>
"register_submission_url" (str): URL to send grader... | agpl-3.0 |
vongochung/ngudan | permission_backend_nonrel/admin.py | 4 | 5050 | from django import forms
from django.contrib import admin
from django.utils.translation import ugettext
from django.contrib.auth.admin import UserAdmin
from django.contrib.admin.sites import NotRegistered
from django.contrib.auth.models import User, Group, Permission
from django.contrib.admin.widgets import FilteredSel... | bsd-3-clause |
jdoblas/obsxingu | oauth2client/crypt.py | 20 | 10913 | # -*- coding: utf-8 -*-
#
# 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 requ... | gpl-3.0 |
ddalex/python-prompt-toolkit | prompt_toolkit/contrib/completers/base.py | 5 | 1670 | from __future__ import unicode_literals
from six import string_types
from prompt_toolkit.completion import Completer, Completion
__all__ = (
'WordCompleter',
)
class WordCompleter(Completer):
"""
Simple autocompletion on a list of words.
:param words: List of words.
:param ignore_case: If True,... | bsd-3-clause |
robotican/ric | ric_board/scripts/RiCConfigurator/GUI/SimulationWindow.py | 1 | 5700 | import GUI.MainWindow
__author__ = 'tom'
from PyQt4.QtGui import *
from GUI.Schemes.gazeboGui import Ui_gazebo_gui
from BAL.Interface.DeviceFrame import SERVO, BATTERY, SWITCH, IMU, PPM, GPS, RELAY, URF, CLOSE_LOP_ONE, CLOSE_LOP_TWO, \
OPEN_LOP, DIFF_CLOSE, DIFF_OPEN, EX_DEV, HOKUYO, OPRNNI, USBCAM, DIFF_CLOSE_FOU... | bsd-3-clause |
jmcarp/django | tests/custom_lookups/tests.py | 177 | 22547 | from __future__ import unicode_literals
import contextlib
import time
import unittest
from datetime import date, datetime
from django.core.exceptions import FieldError
from django.db import connection, models
from django.test import TestCase, override_settings
from django.utils import timezone
from .models import Au... | bsd-3-clause |
dhp-denero/LibrERP | purchase_order_reopen/__openerp__.py | 2 | 1803 | # -*- 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 |
ISTweak/android_kernel_sony_apq8064 | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 11088 | 3246 | # Core.py - Python extension for perf script, core functions
#
# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
from collections import defaultdict
def aut... | gpl-2.0 |
chienlieu2017/it_management | odoo/odoo/addons/test_mimetypes/tests/test_guess_mimetypes.py | 35 | 1870 | # -*- coding: utf-8 -*-
import os.path
import unittest
from odoo.tools.mimetypes import guess_mimetype
def contents(extension):
with open(os.path.join(
os.path.dirname(__file__),
'testfiles',
'case.{}'.format(extension)
), 'rb') as f:
return f.read()
class TestMimeGuessing(uni... | gpl-3.0 |
nazo/ansible | lib/ansible/modules/network/f5/bigip_ssl_certificate.py | 4 | 16388 | #!/usr/bin/python
#
# (c) 2016, Kevin Coming (@waffie1)
#
# 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 l... | gpl-3.0 |
OTAkeys/RIOT | tests/gnrc_sixlowpan_iphc_w_vrb/tests/01-run.py | 14 | 3963 | #!/usr/bin/env python3
# Copyright (C) 2019 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testrunner import run, check_unittests
def testfunc(child):
... | lgpl-2.1 |
andrey-yemelyanov/competitive-programming | cp-book/ch1/adhoc/chess/10849_MoveTheBishop.py | 1 | 1456 | # Problem name: 10849 Move the bishop
# Problem url: https://uva.onlinejudge.org/external/108/10849.pdf
# Author: Andrey Yemelyanov
import sys
import math
WHITE, BLACK = 0, 1
INFINITY = -1
def main():
n_test_cases = int(sys.stdin.readline().strip())
for i in range(n_test_cases):
sys.stdin.readline()
... | mit |
ZachRiegel/scriptbin | pypyjs/modules/test/test_multibytecodec.py | 8 | 10781 | # test_multibytecodec.py
# Unit test for multibytecodec itself
#
from test import test_support
from test.test_support import TESTFN
import unittest, StringIO, codecs, sys, os
import _multibytecodec
ALL_CJKENCODINGS = [
# _codecs_cn
'gb2312', 'gbk', 'gb18030', 'hz',
# _codecs_hk
'big5hkscs',
# _codecs_jp
... | gpl-3.0 |
SMTorg/smt | smt/surrogate_models/tests/test_surrogate_model_examples.py | 2 | 17391 | """
Author: John Hwang <<hwangjt@umich.edu>>
This package is distributed under New BSD license.
"""
import unittest
import matplotlib
matplotlib.use("Agg")
try:
from smt.surrogate_models import IDW, RBF, RMTB, RMTC
compiled_available = True
except:
compiled_available = False
class Test(unittest.Tes... | bsd-3-clause |
zfrxiaxia/Code-zfr | 计蒜客/比赛/2015/light.py | 1 | 1148 | # -*- coding: utf-8 -*-
"""
Created on Sat May 28 19:17:42 2016
@author: AtoZ
"""
N,M = raw_input().split()
N,M = int(N),int(M)
while(1):
i0 = 0
while(i0<2**(M*N)):
bit = [0]*M*N
t_bit = bin(i0)
lt_bit = len(t_bit)
for j0 in range(lt_bit-2):
bit[j0] = int(t_bit[j0+2])
i0 +=1
print ... | gpl-3.0 |
mtakaki/jodd | jodd-core/src/main/python/ConvertBean.py | 10 | 3443 |
f = open('ConvertBean.java', 'r')
java = f.read()
f.close()
genStart = java.find('@@generated')
java = java[0:genStart + 11]
### -----------------------------------------------------------------
types = [
[0, 'Boolean', 'boolean', 'false'],
[2, 'Integer', 'int', '0'],
[4, 'Long', 'long', '0'],
[6,... | bsd-2-clause |
strint/tensorflow | tensorflow/contrib/layers/python/kernel_tests/sparse_feature_cross_op_test.py | 97 | 18209 | # Copyright 2016 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 |
podhmo/boto | docs/source/extensions/githublinks/__init__.py | 102 | 1745 | """Add github roles to sphinx docs.
Based entirely on Doug Hellmann's bitbucket version, but
adapted for Github.
(https://bitbucket.org/dhellmann/sphinxcontrib-bitbucket/)
"""
from urlparse import urljoin
from docutils import nodes, utils
from docutils.parsers.rst.roles import set_classes
def make_node(rawtext, ap... | mit |
linearb/mojo | rasppi/rasp.py | 1 | 3195 | #!/usr/bin/python
"""Sound an alarm if a raspberry pi hasn't been heard from lately
To set an alarm for pi named 'pi', create a file in mmdata/pulse.d named pi.alarm
"""
import os.path
import time
pulse="/home/mojotronadmin/mmdata/pulse.d/"
logfile="/home/mojotronadmin/mmdata/incoming.log"
maxinterval = 15*60 # h... | mit |
twisted/txmongo | tests/test_auth.py | 3 | 21340 | # coding: utf-8
# Copyright 2015 Ilya Skriblovsky <ilyaskriblovsky@gmail.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 require... | apache-2.0 |
hainm/scipy | scipy/stats/_discrete_distns.py | 34 | 21220 | #
# Author: Travis Oliphant 2002-2011 with contributions from
# SciPy Developers 2004-2011
#
from __future__ import division, print_function, absolute_import
from scipy import special
from scipy.special import entr, gammaln as gamln
from scipy.misc import logsumexp
from numpy import floor, ceil, log, exp, ... | bsd-3-clause |
garrettr/securedrop | securedrop/journalist_app/col.py | 1 | 3264 | # -*- coding: utf-8 -*-
from flask import (Blueprint, redirect, url_for, render_template, flash,
request, abort, send_file, current_app)
from flask_babel import gettext
from sqlalchemy.orm.exc import NoResultFound
import crypto_util
import store
from db import db_session, Submission
from journalis... | agpl-3.0 |
Haizs/NEU-mathe | FILEtoCSV.py | 1 | 1799 | import os.path
import csv
import re
headers = ['Id', 'KnowledgeId', 'Type', 'Src', 'Name', 'Count']
def doSubject(subject):
idCount = 0
rows = []
for root, dirs, files in os.walk('ChoiceSource/' + subject):
for name in files:
if (name != '.DS_Store'):
idCount += 1
... | gpl-3.0 |
Memeo/samba-unovero | python/samba/tests/credentials.py | 42 | 3667 | # Unix SMB/CIFS implementation.
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
#
# 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) a... | gpl-3.0 |
DecipherOne/Troglodyte | Trog Build Dependencies/Python26/Lib/encodings/hp_roman8.py | 647 | 7391 | """ Python Character Mapping Codec generated from 'hp_roman8.txt' with gencodec.py.
Based on data from ftp://dkuug.dk/i18n/charmaps/HP-ROMAN8 (Keld Simonsen)
Original source: LaserJet IIP Printer User's Manual HP part no
33471-90901, Hewlet-Packard, June 1989.
"""#"
import codecs
### Codec APIs
class ... | mit |
Ryanglambert/pybrain | pybrain/optimization/populationbased/coevolution/multipopulationcoevolution.py | 24 | 2325 | __author__ = 'Tom Schaul, tom@idsia.ch'
from random import choice
from pybrain.optimization.coevolution.coevolution import Coevolution
class MultiPopulationCoevolution(Coevolution):
""" Coevolution with a number of independent populations. """
numPops = 10
def __str__(self):
return 'MultiPop'+... | bsd-3-clause |
ktan2020/legacy-automation | win/Lib/distutils/tests/test_install_headers.py | 13 | 1310 | """Tests for distutils.command.install_headers."""
import sys
import os
import unittest
import getpass
from distutils.command.install_headers import install_headers
from distutils.tests import support
from test.test_support import run_unittest
class InstallHeadersTestCase(support.TempdirManager,
... | mit |
alivecor/tensorflow | tensorflow/contrib/cudnn_rnn/python/kernel_tests/cudnn_rnn_ops_benchmark.py | 25 | 6913 | # Copyright 2016 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 |
Semi-global/edx-platform | lms/djangoapps/certificates/tests/test_webview_views.py | 6 | 21580 | """Tests for certificates views. """
import json
from uuid import uuid4
from nose.plugins.attrib import attr
from mock import patch
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.test.utils import override_settings
from openedx.core.lib... | agpl-3.0 |
obulpathi/poppy | poppy/manager/base/driver.py | 1 | 2204 | # Copyright (c) 2014 Rackspace, 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 wr... | apache-2.0 |
cheery/essence | essence3/renderer/patch9.py | 1 | 2518 | import pygame
from texture import Texture
def borders(surface):
width, height = surface.get_size()
y0 = 0
y1 = 0
x0 = 0
x1 = 0
i = 0
while i < height:
r,g,b,a = surface.get_at((0,i))
if a > 0:
y0 = i
break
i += 1
while i < height:
... | gpl-3.0 |
neurodata/NeuroDataViz | python/ndviz/viewer.py | 2 | 1835 | # @license
# Copyright 2017 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... | apache-2.0 |
MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.3.0/Lib/test/encoded_modules/__init__.py | 179 | 1274 | # -*- encoding: utf-8 -*-
# This is a package that contains a number of modules that are used to
# test import from the source files that have different encodings.
# This file (the __init__ module of the package), is encoded in utf-8
# and contains a list of strings from various unicode planes that are
# encoded diffe... | mit |
alexanderturner/ansible | lib/ansible/modules/cloud/amazon/rds.py | 5 | 44369 | #!/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 distributed... | gpl-3.0 |
hmcmooc/muddx-platform | lms/djangoapps/dashboard/views.py | 23 | 3191 | from django.http import Http404
from edxmako.shortcuts import render_to_response
from django.db import connection
from student.models import CourseEnrollment
from django.contrib.auth.models import User
def dictfetchall(cursor):
'''Returns a list of all rows from a cursor as a column: result dict.
Borrowed fr... | agpl-3.0 |
kenshay/ImageScripter | ProgramData/SystemFiles/Python/Lib/site-packages/win32/Demos/BackupRead_BackupWrite.py | 17 | 3556 | ## demonstrates using BackupRead and BackupWrite to copy all of a file's data streams
import win32file, win32api, win32con, win32security, ntsecuritycon
from win32com import storagecon
import pythoncom, pywintypes
import struct, traceback
from pywin32_testutil import str2bytes, ob2memory
all_sd_info=win32security.DAC... | gpl-3.0 |
lucashmorais/x-Bench | mozmill-env/python/Lib/xmllib.py | 227 | 34865 | """A parser for XML, using the derived class as static DTD."""
# Author: Sjoerd Mullender.
import re
import string
import warnings
warnings.warn("The xmllib module is obsolete. Use xml.sax instead.",
DeprecationWarning, 2)
del warnings
version = '0.3'
class Error(RuntimeError):
pass
# Regular e... | mit |
koppen/PrettyCode | lib/js-beautify/python/jsbeautifier/unpackers/evalbased.py | 221 | 1171 | #
# Unpacker for eval() based packers, a part of javascript beautifier
# by Einar Lielmanis <einar@jsbeautifier.org>
#
# written by Stefano Sanfilippo <a.little.coder@gmail.com>
#
# usage:
#
# if detect(some_string):
# unpacked = unpack(some_string)
#
"""Unpacker for eval() based packers: runs JS code and retu... | mit |
geopython/stetl | tests/outputs/test_ogr2ogr_exec_output_lco.py | 2 | 2025 | import mock
import os
import shutil
import sys
from stetl.etl import ETL
from stetl.outputs.execoutput import Ogr2OgrExecOutput
from tests.stetl_test_case import StetlTestCase
class Ogr2OgrExecOutputTest(StetlTestCase):
"""Unit tests for Ogr2OgrExecOutput"""
def setUp(self):
super(Ogr2OgrExecOutputTe... | gpl-3.0 |
jhancock93/autorest | src/generator/AutoRest.Python.Azure.Tests/Expected/AcceptanceTests/Lro/setup.py | 14 | 1153 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | mit |
amitay/samba | source4/scripting/python/samba/samdb.py | 1 | 31787 | # Unix SMB/CIFS implementation.
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2010
# Copyright (C) Matthias Dieter Wallnoefer 2009
#
# Based on the original in EJS:
# Copyright (C) Andrew Tridgell <tridge@samba.org> 2005
# Copyright (C) Giampaolo Lauria <lauria2@yahoo.com> 2011
#
# This program is free softwa... | gpl-3.0 |
slank/ansible | test/units/parsing/utils/test_addresses.py | 131 | 3741 | # -*- coding: utf-8 -*-
import unittest
from ansible.parsing.utils.addresses import parse_address
class TestParseAddress(unittest.TestCase):
tests = {
# IPv4 addresses
'192.0.2.3': ['192.0.2.3', None],
'192.0.2.3:23': ['192.0.2.3', 23],
# IPv6 addresses
'::': ['::', None... | gpl-3.0 |
eayunstack/python-neutronclient | neutronclient/shell.py | 1 | 41584 | # Copyright 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 requ... | apache-2.0 |
way2heavy/youtube-dl-1 | youtube_dl/extractor/bambuser.py | 98 | 4856 | from __future__ import unicode_literals
import re
import itertools
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
compat_urllib_request,
compat_str,
)
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
)
class BambuserIE(InfoExtractor):
IE_NA... | unlicense |
motion2015/edx-platform | common/djangoapps/course_modes/migrations/0007_auto__add_coursemodesarchive__chg_field_coursemode_course_id.py | 102 | 4360 | # -*- 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 model 'CourseModesArchive'
db.create_table('course_modes_coursemodesarchive', (
('id', ... | agpl-3.0 |
alanjw/GreenOpenERP-Win-X86 | python/Lib/site-packages/unidecode/x0b3.py | 253 | 4741 | data = (
'dae', # 0x00
'daeg', # 0x01
'daegg', # 0x02
'daegs', # 0x03
'daen', # 0x04
'daenj', # 0x05
'daenh', # 0x06
'daed', # 0x07
'dael', # 0x08
'daelg', # 0x09
'daelm', # 0x0a
'daelb', # 0x0b
'daels', # 0x0c
'daelt', # 0x0d
'daelp', # 0x0e
'daelh', # 0x0f
'daem', # ... | agpl-3.0 |
roman-verchikov/CloudFerry | data_storage.py | 3 | 2836 | # Copyright (c) 2014 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 writing, so... | apache-2.0 |
mwrlabs/veripy | contrib/rfc3633/dr/renew_message.py | 1 | 1596 | from contrib.rfc3315.constants import *
from contrib.rfc3633.dhcpv6_pd import DHCPv6PDHelper
from scapy.all import *
from veripy.assertions import *
class RenewMessageTestCase(DHCPv6PDHelper):
"""
Requesting Router Initiated: Renew Message
Verify that a device can properly interoperate while using DHCPv6... | gpl-3.0 |
fr34kyn01535/PyForum | server.py | 1 | 2451 | # coding:utf-8
import os.path
import cherrypy
import sys
if sys.version[0] == '2':
reload(sys)
sys.setdefaultencoding("utf-8")
from app import themen,diskussionen,beitraege,login,logout,administration,templates
def error_page(status, message, traceback, version):
return templates.RenderTemplate("error.html"... | gpl-2.0 |
Dino0631/RedRain-Bot | lib/youtube_dl/extractor/fc2.py | 40 | 5593 | # coding: utf-8
from __future__ import unicode_literals
import hashlib
import re
from .common import InfoExtractor
from ..compat import (
compat_parse_qs,
compat_urllib_request,
compat_urlparse,
)
from ..utils import (
ExtractorError,
sanitized_Request,
urlencode_postdata,
)
class FC2IE(Info... | gpl-3.0 |
harlequin/sickbeard | cherrypy/_cpserver.py | 35 | 4921 | """Manage HTTP servers with CherryPy."""
import warnings
import cherrypy
from cherrypy.lib import attributes
# We import * because we want to export check_port
# et al as attributes of this module.
from cherrypy.process.servers import *
class Server(ServerAdapter):
"""An adapter for an HTTP server... | gpl-3.0 |
viggates/nova | nova/scheduler/filters/exact_ram_filter.py | 26 | 1513 | # Copyright (c) 2014 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 |
chinageology/GeoPython | Experimental/PreTreat.py | 2 | 6940 | # coding:utf-8
import math
import sys
import os
import csv
import random
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from sklearn import datasets
from sklearn.decomposition import PCA
from sklearn.neighbors import NearestNeighbors
import matplotlib
impo... | gpl-3.0 |
bvcms/bvcms | CmsWeb/Lib/pickletools.py | 4 | 74557 | '''"Executable documentation" for the pickle module.
Extensive comments about the pickle protocols and pickle-machine opcodes
can be found here. Some functions meant for external use:
genops(pickle)
Generate all the opcodes in a pickle, as (opcode, arg, position) triples.
dis(pickle, out=None, memo=None, indentl... | gpl-2.0 |
int19h/PTVS | Python/Product/Miniconda/Miniconda3-x64/Lib/encodings/quopri_codec.py | 100 | 1525 | """Codec for quoted-printable encoding.
This codec de/encodes from bytes to bytes.
"""
import codecs
import quopri
from io import BytesIO
def quopri_encode(input, errors='strict'):
assert errors == 'strict'
f = BytesIO(input)
g = BytesIO()
quopri.encode(f, g, quotetabs=True)
return (g.getvalue(),... | apache-2.0 |
CauldronDevelopmentLLC/buildbot | buildbot/status/web/slaves.py | 1 | 6579 |
import time, urllib
from twisted.python import log
from twisted.web import html
from twisted.web.util import Redirect
from buildbot.status.web.base import HtmlResource, abbreviate_age, OneLineMixin, path_to_slave
from buildbot import version, util
# /buildslaves/$slavename
class OneBuildSlaveResource(HtmlResource, O... | gpl-2.0 |
Plain-Andy/android_platform_external_skia | platform_tools/android/tests/gyp_to_android_tests.py | 68 | 1434 | #!/usr/bin/python
# Copyright 2014 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Test gyp_to_android.py
"""
import os
import shutil
import sys
import tempfile
import test_variables
import unittest
# Path to gyp_to_android
sys.path.append(test... | bsd-3-clause |
tmhm/scikit-learn | examples/model_selection/plot_roc_crossval.py | 247 | 3253 | """
=============================================================
Receiver Operating Characteristic (ROC) with cross validation
=============================================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
classifier output quality using cross-validation.
ROC curv... | bsd-3-clause |
fmoo/sparts | demo/demo_tui.py | 5 | 1682 | # Copyright (c) 2014, Facebook, Inc. All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
from sparts.tasks.tui import UIT... | bsd-3-clause |
BackupTheBerlios/espressopp | contrib/mpi4py/mpi4py-1.3/test/test_environ.py | 3 | 3184 | from mpi4py import MPI
import mpiunittest as unittest
class TestEnviron(unittest.TestCase):
def testIsInitialized(self):
flag = MPI.Is_initialized()
self.assertTrue(type(flag) is bool)
self.assertTrue(flag)
def testIsFinalized(self):
flag = MPI.Is_finalized()
self.asse... | gpl-3.0 |
chop-dbhi/varify-data-warehouse | vdw/assessments/migrations/0005_copy_categories.py | 1 | 21123 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.core.management import call_command
class Migration(DataMigration):
def forwards(self, orm):
call_command("loaddata", "assessment_categories.json")
f... | bsd-2-clause |
watchtower/asynctest | asynctest/__init__.py | 1 | 2295 | import functools
class TestStatus: # FIXME should really be an Enum
pending = -1
failure = 0
success = 1
class Test:
def __init__(self, func, description):
self.func = func
self.description = description
self.status = TestStatus.pending
self._callback = None
sel... | mit |
markYoungH/chromium.src | tools/telemetry/telemetry/core/platform/android_platform_backend.py | 9 | 23595 | # 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.
import logging
import os
import re
import shutil
import subprocess
import tempfile
import time
from telemetry import decorators
from telemetry.core import e... | bsd-3-clause |
boostbob/zerorpc-python | tests/test_buffered_channel.py | 17 | 13416 | # -*- coding: utf-8 -*-
# Open Source Initiative OSI - The MIT License (MIT):Licensing
#
# The MIT License (MIT)
# Copyright (c) 2012 DotCloud Inc (opensource@dotcloud.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Softwa... | mit |
dahiro/shotgun-replica | shotgun_replica/python/tests/shotgun_replica_tests/sync/shotgun_to_local/test_link.py | 1 | 10024 | # -*- coding: utf-8 -*-
'''
Created on 25.06.2012
@author: bach
'''
from shotgun_replica.connectors import DatabaseModificator, PostgresEntityType
from shotgun_replica.sync.shotgun_to_local import EventProcessor
from shotgun_replica.entities import InOut
from tests_elefant import testProjectID, testShotID, testTaskI... | bsd-3-clause |
marcelometal/Django-facebook | open_facebook/tests.py | 2 | 12358 | # -*- coding: utf-8 -*-
from open_facebook.api import *
import unittest
import logging
import mock
import datetime
from open_facebook.exceptions import OpenGraphException
logger = logging.getLogger()
from open_facebook.utils import json
TEST_USER_FORCE_CREATE = False
TEST_USER_DICT = {
'tommy': dict(name='Tommas... | bsd-3-clause |
ppp2006/runbot_number0 | qbo_stereo_anaglyph/hrl_srvs/src/hrl_srvs/srv/_Bool_None.py | 2 | 5742 | """autogenerated by genmsg_py from Bool_NoneRequest.msg. Do not edit."""
import roslib.message
import struct
class Bool_NoneRequest(roslib.message.Message):
_md5sum = "8b94c1b53db61fb6aed406028ad6332a"
_type = "hrl_srvs/Bool_NoneRequest"
_has_header = False #flag to mark the presence of a Header object
_full_... | lgpl-2.1 |
linktlh/Toontown-journey | toontown/distributed/HoodMgr.py | 1 | 13166 | from direct.directnotify import DirectNotifyGlobal
from direct.showbase import DirectObject
from pandac.PandaModules import *
import random
from toontown.hood import ZoneUtil
from toontown.toonbase import ToontownGlobals
class HoodMgr(DirectObject.DirectObject):
notify = DirectNotifyGlobal.directNotify.newCatego... | apache-2.0 |
shiquanwang/numba | numba/control_flow/cfstats.py | 1 | 4105 | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from numba import nodes
from numba.reporting import getpos
class StatementDescr(object):
is_assignment = False
class LoopDescr(object):
def __init__(self, next_block, loop_block):
self.next_block = next_block
... | bsd-2-clause |
endrebak/epic | tests/run/test_merge_chip_and_input.py | 1 | 4225 | import pytest
import pandas as pd
import numpy as np
import logging
from io import StringIO
from joblib import delayed, Parallel
@pytest.fixture
def input_data():
pass
@pytest.fixture
def expected_result():
pass
def merge_chip_and_input(windows, nb_cpu):
"""Merge lists of chromosome bin df chromosom... | mit |
saintbird/django-userena | userena/contrib/umessages/tests/test_managers.py | 14 | 1896 | from django.test import TestCase
from userena.contrib.umessages.models import (Message, MessageContact,
MessageRecipient)
from userena.utils import get_user_model
User = get_user_model()
class MessageManagerTests(TestCase):
fixtures = ['users', 'messages']
def ... | bsd-3-clause |
arifsetiawan/edx-platform | common/lib/xmodule/xmodule/modulestore/modulestore_settings.py | 197 | 5460 | """
This file contains helper functions for configuring module_store_setting settings and support for backward compatibility with older formats.
"""
import warnings
import copy
def convert_module_store_setting_if_needed(module_store_setting):
"""
Converts old-style module_store_setting configuration settings... | agpl-3.0 |
alexei-matveev/ccp1gui | idle/keydefs.py | 4 | 2235 | windows_keydefs = \
{'<<Copy>>': ['<Control-c>'],
'<<Cut>>': ['<Control-x>'],
'<<Paste>>': ['<Control-v>'],
'<<beginning-of-line>>': ['<Control-a>', '<Home>'],
'<<center-insert>>': ['<Control-l>'],
'<<close-all-windows>>': ['<Control-q>'],
'<<close-window>>': ['<Alt-F4>'],
'<<dump-undo-state>>': ['<Control-backs... | gpl-2.0 |
40223136/w17test1 | static/Brython3.1.1-20150328-091302/Lib/binascii.py | 620 | 24585 | """A pure Python implementation of binascii.
Rather slow and buggy in corner cases.
PyPy provides an RPython version too.
"""
# borrowed from https://bitbucket.org/pypy/pypy/src/f2bf94943a41/lib_pypy/binascii.py
class Error(Exception):
pass
class Done(Exception):
pass
class Incomplete(Exception):
pass
... | gpl-3.0 |
DeltaEpsilon-HackFMI2/FMICalendar-REST | venv/lib/python2.7/site-packages/rest_framework/utils/mediatypes.py | 13 | 2720 | """
Handling of media types, as found in HTTP Content-Type and Accept headers.
See http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7
"""
from __future__ import unicode_literals
from django.http.multipartparser import parse_header
from rest_framework import HTTP_HEADER_ENCODING
def media_type_matches(lhs, ... | mit |
phantomjinx/modeshape | bin/jira.py | 17 | 13334 | #!/usr/bin/python
import re
import urllib
import htmlentitydefs
try:
import simplejson as json
except ImportError:
import json
##
# Removes HTML or XML character references and entities from a text string.
#
# @param text The HTML (or XML) source text.
# @return The plain text, as a Unicode string, if necessa... | apache-2.0 |
cisco-openstack/networking-cisco | networking_cisco/plugins/cisco/l3/hosting_device_drivers/csr1kv_hd_driver.py | 2 | 2856 | # Copyright 2014 Cisco Systems, 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 requir... | apache-2.0 |
Jgarcia-IAS/SAT | openerp/addons/resource/faces/__init__.py | 448 | 1325 | # -*- 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... | agpl-3.0 |
Xeleste/namebench | nb_third_party/jinja2/_stringdefs.py | 412 | 404256 | # -*- coding: utf-8 -*-
"""
jinja2._stringdefs
~~~~~~~~~~~~~~~~~~
Strings of all Unicode characters of a certain category.
Used for matching in Unicode-aware languages. Run to regenerate.
Inspired by chartypes_create.py from the MoinMoin project, original
implementation from Pygments.
:co... | apache-2.0 |
dablak/boto | tests/integration/ec2/cloudwatch/test_cert_verification.py | 12 | 1580 | # Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# All rights reserved.
#
# 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 withou... | mit |
Noviat/odoo | addons/account/wizard/account_report_print_journal.py | 378 | 3440 | # -*- 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 |
michael-dev2rights/ansible | lib/ansible/modules/notification/irc.py | 10 | 9058 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Jan-Piet Mens <jpmens () gmail.com>
# 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.