repo_name stringlengths 5 100 | path stringlengths 4 294 | copies stringclasses 990
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
JiaminXuan/leetcode-python | surrounded_regions/solution.py | 7 | 1646 | class Solution:
# @param board, a 9x9 2D array
# Capture all regions by modifying the input board in-place.
# Do not return any value.
def solve(self, board):
n = len(board)
if n == 0:
return
m = len(board[0])
if m == 0:
return
self.n = n
... | bsd-2-clause |
xsuchy/ordered-set | test.py | 2 | 1338 | from nose.tools import eq_
from ordered_set import OrderedSet
import pickle
def test_pickle():
set1 = OrderedSet('abracadabra')
roundtrip = pickle.loads(pickle.dumps(set1))
assert roundtrip == set1
def test_empty_pickle():
empty_oset = OrderedSet()
empty_roundtrip = pickle.loads(pickle.dumps(emp... | mit |
anas-taji/purchase-workflow | __unported__/purchase_group_hooks/__openerp__.py | 13 | 2003 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Leonardo Pistone
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | agpl-3.0 |
elky/django | tests/forms_tests/field_tests/test_datetimefield.py | 98 | 5103 | import datetime
from django.forms import DateTimeField, ValidationError
from django.test import SimpleTestCase
class DateTimeFieldTest(SimpleTestCase):
def test_datetimefield_1(self):
f = DateTimeField()
self.assertEqual(datetime.datetime(2006, 10, 25, 0, 0), f.clean(datetime.date(2006, 10, 25))... | bsd-3-clause |
zuosc/PythonCode | 8mapandreduce.py | 1 | 3202 | # -*- coding:utf8 -*-
# Power by zuosc 2016-10-12
#map和reduce
def f(x):
return x * x
r = map(f, [1, 2, 3, 4, 5, 6, 7])
print(list(r))
print('---------------------------------')
print(list(map(str, [1, 2, 3, 4, 5, 6, 7, 8, 9])))
print('----------------------------------')
def add(x, y):
return x + y
... | mit |
flyfei/python-for-android | python3-alpha/python3-src/Lib/lib2to3/tests/test_parser.py | 47 | 6147 | """Test suite for 2to3's parser and grammar files.
This is the place to add tests for changes to 2to3's grammar, such as those
merging the grammars for Python 2 and 3. In addition to specific tests for
parts of the grammar we've changed, we also make sure we can parse the
test_grammar.py files from both Python 2 and P... | apache-2.0 |
brandond/ansible | lib/ansible/plugins/strategy/__init__.py | 4 | 54656 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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) an... | gpl-3.0 |
Senseg/Py4A | python-modules/twisted/twisted/web/test/test_domhelpers.py | 53 | 11063 | # -*- test-case-name: twisted.web.test.test_domhelpers -*-
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Specific tests for (some of) the methods in L{twisted.web.domhelpers}.
"""
from xml.dom import minidom
from twisted.trial.unittest import TestCase
from twisted.web import ... | apache-2.0 |
sigrokproject/libsigrokdecode | decoders/usb_request/pd.py | 3 | 14610 | ##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2015 Stefan Brüns <stefan.bruens@rwth-aachen.de>
##
## 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 ... | gpl-3.0 |
chouseknecht/ansible | test/units/modules/network/f5/test_bigiq_regkey_pool.py | 21 | 3056 | # -*- 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
if sys.version_info < (2, ... | gpl-3.0 |
cloudify-cosmo/cloudify-cli | cloudify_cli/commands/ldap.py | 1 | 3144 | from ..cli import cfy
from ..exceptions import CloudifyCliError
@cfy.group(name='ldap')
@cfy.options.common_options
@cfy.assert_manager_active()
def ldap():
"""Set LDAP authenticator.
"""
pass
@ldap.command(name='set',
short_help='Set the manager to use the LDAP authenticator.')
@cfy.optio... | apache-2.0 |
dscdac/Proyecto-IV-modulo2 | lib/python2.7/site-packages/setuptools/command/bdist_wininst.py | 325 | 2283 | from distutils.command.bdist_wininst import bdist_wininst as _bdist_wininst
import os, sys
class bdist_wininst(_bdist_wininst):
_good_upload = _bad_upload = None
def create_exe(self, arcname, fullname, bitmap=None):
_bdist_wininst.create_exe(self, arcname, fullname, bitmap)
installer_name = se... | gpl-2.0 |
CristinaCristescu/root | interpreter/llvm/src/utils/lit/lit/util.py | 25 | 9291 | import errno
import itertools
import math
import os
import platform
import signal
import subprocess
import sys
import threading
def to_bytes(str):
# Encode to UTF-8 to get binary data.
return str.encode('utf-8')
def to_string(bytes):
if isinstance(bytes, str):
return bytes
return to_bytes(byte... | lgpl-2.1 |
yoer/hue | desktop/core/ext-py/Django-1.6.10/django/contrib/auth/tests/test_forms.py | 104 | 16206 | from __future__ import unicode_literals
import os
from django.contrib.auth import get_user_model
from django.contrib.auth.models import User
from django.contrib.auth.forms import (UserCreationForm, AuthenticationForm,
PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm,
ReadOnlyPasswordHash... | apache-2.0 |
watspidererik/testenv | flask/lib/python2.7/site-packages/sqlparse/engine/__init__.py | 119 | 2286 | # Copyright (C) 2008 Andi Albrecht, albrecht.andi@gmail.com
#
# This module is part of python-sqlparse and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php.
"""filter"""
from sqlparse import lexer
from sqlparse.engine import grouping
from sqlparse.engine.filter import StatementF... | mit |
OpenWinCon/OpenWinNet | web-gui/myvenv/lib/python3.4/site-packages/django/contrib/staticfiles/storage.py | 103 | 14788 | from __future__ import unicode_literals
import hashlib
import json
import os
import posixpath
import re
from collections import OrderedDict
from django.conf import settings
from django.contrib.staticfiles.utils import check_settings, matches_patterns
from django.core.cache import (
InvalidCacheBackendError, cache... | apache-2.0 |
slotlocker2/tscreen | tscreen.py | 1 | 3436 | #!/usr/bin/env python
from PyQt4 import QtGui, QtCore
import time, sys
class OverlayWidget(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
# CONSTANTS
self.FONT_SIZE = 35 # The font size of the time displayed
# Timer which fires a signal every 1 second. Used to ... | gpl-2.0 |
kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/sphinx/websupport/search/__init__.py | 3 | 4903 | # -*- coding: utf-8 -*-
"""
sphinx.websupport.search
~~~~~~~~~~~~~~~~~~~~~~~~
Server side search support for the web support package.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from six import text_type
class BaseSearc... | gpl-3.0 |
jk1/intellij-community | python/lib/Lib/textwrap.py | 85 | 14867 | """Text wrapping and filling.
"""
# Copyright (C) 1999-2001 Gregory P. Ward.
# Copyright (C) 2002, 2003 Python Software Foundation.
# Written by Greg Ward <gward@python.net>
__revision__ = "$Id: textwrap.py 46863 2006-06-11 19:42:51Z tim.peters $"
import string, re
# Do the right thing with boolean values for all k... | apache-2.0 |
gauribhoite/personfinder | env/google_appengine/lib/django-1.3/django/contrib/gis/db/backends/spatialite/base.py | 55 | 4480 | from ctypes.util import find_library
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.sqlite3.base import (
_sqlite_extract, _sqlite_date_trunc, _sqlite_regexp, _sqlite_format_dtdelta,
connection_created, Database, DatabaseWrapper as SQLiteDatabase... | apache-2.0 |
jsgf/xen | tools/xm-test/tests/xapi/04_xapi-data_uri_handling.py | 38 | 2566 | #!/usr/bin/python
#============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distribu... | gpl-2.0 |
prasaianooz/pip | pip/_vendor/colorama/ansi.py | 442 | 2304 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
'''
This module generates ANSI character codes to printing colors to terminals.
See: http://en.wikipedia.org/wiki/ANSI_escape_code
'''
CSI = '\033['
OSC = '\033]'
BEL = '\007'
def code_to_chars(code):
return CSI + str(code) + 'm'
class ... | mit |
navotsil/Open-Knesset | simple/management/commands/parse_government_bill_pdf/extra/display_selection.py | 15 | 3234 | """ Code to look at pdf's and check the text selection mechanism
of poppler. Left here for future reference (not used by any management
command).
"""
import os
import itertools
import gtk
import goocanvas
import gobject
import poppler
import read_gov_law_proposal as gov
import pdftotext_ext as ext
pdf=poppler.docu... | bsd-3-clause |
petebachant/daqmx | examples/experiment_run.py | 1 | 3389 | # -*- coding: utf-8 -*-
"""
Created on Tue May 21 21:06:37 2013
@author: Pete
This program commands a National Instruments counter output device to send a
pulse after a target position (read from the ACS controller) is reached.
"""
import daqmx
import acsc
import time
import numpy as np
import matplotlib
matplotlib.... | gpl-2.0 |
etingof/pyasn1-modules | pyasn1_modules/rfc2634.py | 13 | 9425 | #
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
# Modified by Russ Housley to add a map for use with opentypes.
#
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
# Enhanced Security Services for S/MIME
#
#... | bsd-2-clause |
raphael0202/spaCy | spacy/nl/word_sets.py | 1 | 1272 | # coding: utf8
from __future__ import unicode_literals
# Stop words are retrieved from http://www.damienvanholten.com/downloads/dutch-stop-words.txt
STOP_WORDS = set("""
aan af al alles als altijd andere
ben bij
daar dan dat de der deze die dit doch doen door dus
een eens en er
ge geen geweest
haar had heb hebb... | mit |
aosagie/spark | dev/create-release/generate-contributors.py | 35 | 11338 | #!/usr/bin/env python
#
# 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 "Li... | apache-2.0 |
googleinterns/learnbase | learnbase/src/main/webapp/WEB-INF/Lib/mimify.py | 304 | 15021 | #! /usr/bin/env python
"""Mimification and unmimification of mail messages.
Decode quoted-printable parts of a mail message or encode using
quoted-printable.
Usage:
mimify(input, output)
unmimify(input, output, decode_base64 = 0)
to encode and decode respectively. Input and output may be the name
of... | apache-2.0 |
googleads/google-ads-python | google/ads/googleads/v7/common/types/frequency_cap.py | 1 | 3156 | # -*- coding: utf-8 -*-
# Copyright 2020 Google 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 required by applicable law or... | apache-2.0 |
AlbertoPeon/invenio | modules/bibsched/lib/bibtaskex.py | 26 | 3653 | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 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
## ... | gpl-2.0 |
aldariz/Sick-Beard | lib/tvdb_api/tests/test_tvdb_api.py | 18 | 17826 | #!/usr/bin/env python
#encoding:utf-8
#author:dbr/Ben
#project:tvdb_api
#repository:http://github.com/dbr/tvdb_api
#license:unlicense (http://unlicense.org/)
"""Unittests for tvdb_api
"""
import os
import sys
import datetime
import unittest
# Force parent directory onto path
sys.path.insert(0, os.path.dirname(os.pat... | gpl-3.0 |
GetSomeBlocks/Score_Soccer | resources/lib/IMDbPY/imdb/parser/local/personParser.py | 5 | 8552 | """
parser.local.personParser module (imdb package).
This module provides the functions used to parse the
information about people in a local installation of the
IMDb database.
Copyright 2004-2008 Davide Alberani <da@erlug.linux.it>
This program is free software; you can redistribute it and/or modify
it under the te... | mit |
openSUSE/docmanager | src/docmanager/cli/cmd_analyze.py | 1 | 1621 | #
# Copyright (c) 2015 SUSE Linux GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRAN... | gpl-3.0 |
amirkdv/biseqt | tests/test_pw.py | 1 | 11185 | # -*- coding: utf-8 -*-
import pytest
from biseqt.sequence import Alphabet, Sequence
from biseqt.stochastics import rand_seq, MutationProcess
from biseqt.pw import Alignment, Aligner
from biseqt.pw import STD_MODE, BANDED_MODE
from biseqt.pw import GLOBAL, LOCAL, OVERLAP, B_OVERLAP
def test_projected_aln_len():
a... | bsd-3-clause |
bswartz/cinder | cinder/tests/unit/api/v2/test_volumes.py | 1 | 75944 | # Copyright 2013 Josh Durgin
# 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 a... | apache-2.0 |
alanjw/GreenOpenERP-Win-X86 | python/Lib/site-packages/_xmlplus/dom/ext/reader/__init__.py | 10 | 2207 | ########################################################################
#
# File Name: __init__.py
#
#
"""
The 4DOM reader module has routines for deserializing XML and HTML to DOM
WWW: http://4suite.org/4DOM e-mail: support@4suite.org
Copyright (c) 2000 Fourthought Inc, USA. All Rights Reserved.... | agpl-3.0 |
titilambert/harbour-squilla | embedded_libs/bs4/__init__.py | 14 | 15389 | """Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup uses a pluggable XML or HTML parser to parse a
(possibly invalid) document into a tree representation. Beautiful Soup
provides provides methods and Pythonic idioms that make it easy to
navigate... | gpl-3.0 |
adviti/melange | app/soc/modules/gsoc/models/follower.py | 1 | 1523 | #!/usr/bin/env python2.5
#
# Copyright 2009 the Melange authors.
#
# 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 applic... | apache-2.0 |
rschnapka/bank-statement-reconcile | account_easy_reconcile/__init__.py | 8 | 1130 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2012 Camptocamp SA (Guewen Baconnier)
# Copyright (C) 2010 Sébastien Beau
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gen... | agpl-3.0 |
AlanJAS/iknowUruguay | recursos/4paysandu/datos/4paysandu.py | 1 | 3809 | # -*- coding: utf-8 -*-
from gettext import gettext as _
NAME = _('Paysandú')
STATES = [
(_('Salto'), 254, 417, 156, 0),
(_('Paysandú'), 253, 347, 466, 0),
(_('Río Negro'), 252, 294, 767, 0),
(_('Durazno'), 251, 624, 862, 0),
(_('Tacuarembó'), 250, 737, 577, -90),
(_('Argentina'), 249, 33, 15... | gpl-3.0 |
nhicher/ansible | lib/ansible/modules/remote_management/oneview/oneview_ethernet_network.py | 147 | 8911 | #!/usr/bin/python
# Copyright (c) 2016-2017 Hewlett Packard Enterprise Development LP
# 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 |
indictranstech/trufil-erpnext | erpnext/shopping_cart/test_shopping_cart.py | 20 | 6171 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
from erpnext.shopping_cart.cart import _get_cart_quotation, update_cart, get_customer
class TestShoppingCart(unittest.Tes... | agpl-3.0 |
tacodog1/tdameritrade | tdapi.py | 1 | 27387 | from __future__ import unicode_literals
import datetime
import base64
import http.client
import urllib.request, urllib.parse, urllib.error
import getpass
import binascii
import time
import array
import string
import math, types
from struct import pack, unpack
from xml.etree import ElementTree
import logging
import pand... | mit |
RacerXx/GoAtThrottleUp | ServerRelay/cherrypy/test/test_json.py | 12 | 2497 | import cherrypy
from cherrypy.test import helper
from cherrypy._cpcompat import json
class JsonTest(helper.CPWebCase):
def setup_server():
class Root(object):
def plain(self):
return 'hello'
plain.exposed = True
def json_string(self):
re... | mit |
alexmandujano/django | django/contrib/formtools/tests/wizard/namedwizardtests/tests.py | 127 | 15125 | from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.http import QueryDict
from django.test import TestCase
from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.formtools.wizard.views import (NamedUrlS... | bsd-3-clause |
jungker/leetcode-python | remove_duplicates_sorted_listII.py | 1 | 1207 | # Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
def printListNode(p):
while p:
print p.val,
p = p.next
print
class Solution(object):
def deleteDuplicates(self, head):
"""
:type head: Lis... | mit |
ee08b397/LeetCode-4 | 097 Interleaving String.py | 2 | 2690 | """
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.
For example,
Given:
s1 = "aabcc",
s2 = "dbbca",
When s3 = "aadbbcbcac", return true.
When s3 = "aadbbbaccc", return false.
"""
__author__ = 'Danyang'
class Solution:
def isInterleave_TLE(self, s1, s2, s3):
"""
... | mit |
libscie/liberator | liberator/lib/python3.6/site-packages/pip/_vendor/requests/__init__.py | 327 | 2326 | # -*- coding: utf-8 -*-
# __
# /__) _ _ _ _ _/ _
# / ( (- (/ (/ (- _) / _)
# /
"""
Requests HTTP library
~~~~~~~~~~~~~~~~~~~~~
Requests is an HTTP library, written in Python, for human beings. Basic GET
usage:
>>> import requests
>>> r = requests.get('https://www.python.org')
>>> ... | cc0-1.0 |
youssef-poisson/angular | node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py | 426 | 120645 | # 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.
"""Xcode project file generator.
This module is both an Xcode project file generator and a documentation of the
Xcode project file format. Knowledge of the proje... | gpl-2.0 |
kemalakyol48/python-for-android | python-modules/twisted/twisted/conch/ssh/transport.py | 49 | 52415 | # -*- test-case-name: twisted.conch.test.test_transport -*-
# Copyright (c) 2001-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
The lowest level SSH protocol. This handles the key negotiation, the
encryption and the compression. The transport layer is described in
RFC 4253.
Maintainer: Paul Swartz... | apache-2.0 |
Frostman/python-yubico | test/test_yubico.py | 3 | 1657 | #!/usr/bin/env python
#
# Simple test cases for a Python version of the yubikey_crc16() function in ykcrc.c.
#
import struct
import unittest
import yubico.yubico_util as yubico_util
from yubico.yubico_util import crc16
CRC_OK_RESIDUAL=0xf0b8
class TestCRC(unittest.TestCase):
def test_first(self):
""" Te... | bsd-2-clause |
Execut3/CTF | IRAN Cert/2016/3- Harder/Web/my awesome shop/Challenge Sources/shop-server/comments/views.py | 1 | 1251 | from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from app.models import ShopUser
from comments.models import Comment
def create_new(request):
if request.method ==... | gpl-2.0 |
bhmm/bhmm | bhmm/tests/benchmark_hidden.py | 2 | 6242 |
# This file is part of BHMM (Bayesian Hidden Markov Models).
#
# Copyright (c) 2016 Frank Noe (Freie Universitaet Berlin)
# and John D. Chodera (Memorial Sloan-Kettering Cancer Center, New York)
#
# BHMM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public Licen... | lgpl-3.0 |
invisiblek/python-for-android | python-modules/twisted/twisted/test/test_pb.py | 49 | 56066 | # Copyright (c) 2001-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for Perspective Broker module.
TODO: update protocol level tests to use new connection API, leaving
only specific tests for old API.
"""
# issue1195 TODOs: replace pump.pump() with something involving Deferreds.
# Clean up wa... | apache-2.0 |
romain-dartigues/ansible | lib/ansible/modules/network/avi/avi_poolgroupdeploymentpolicy.py | 31 | 5876 | #!/usr/bin/python
#
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
#
# Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
ANSIB... | gpl-3.0 |
candy7393/VTK | Wrapping/Python/vtk/tk/vtkLoadPythonTkWidgets.py | 6 | 2873 | import sys, os, string
import vtkCommonCorePython
def vtkLoadPythonTkWidgets(interp):
"""vtkLoadPythonTkWidgets(interp) -- load vtk-tk widget extensions
This is a mess of mixed python and tcl code that searches for the
shared object file that contains the python-vtk-tk widgets. Both
the python path a... | bsd-3-clause |
mercycorps/TolaActivity | tola/test/utils.py | 1 | 10079 | import time
import datetime
from decimal import Decimal, ROUND_HALF_UP
from contextlib import contextmanager
from factory import Sequence
from django.utils import timezone, translation
from django.core.exceptions import ImproperlyConfigured
from django.test import runner
from unittest import runner as ut_runner
fro... | apache-2.0 |
amydu703/quipsample | node_modules/node-sass/node_modules/pangyp/gyp/pylib/gyp/generator/eclipse.py | 1825 | 17014 | # 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.
"""GYP backend that generates Eclipse CDT settings files.
This backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML
files that can be importe... | mit |
Mafarricos/Mafarricos-modded-xbmc-addons | plugin.video.xbmctorrentV2/resources/site-packages/bs4/tests/test_tree.py | 292 | 70169 | # -*- coding: utf-8 -*-
"""Tests for Beautiful Soup's tree traversal methods.
The tree traversal methods are the main advantage of using Beautiful
Soup over just using a parser.
Different parsers will build different Beautiful Soup trees given the
same markup, but all Beautiful Soup trees can be traversed with the
me... | gpl-2.0 |
JingJunYin/tensorflow | tensorflow/contrib/boosted_trees/python/kernel_tests/training_ops_test.py | 13 | 52856 | # 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... | apache-2.0 |
sbellem/django | django/core/management/commands/dumpdata.py | 305 | 8545 | from collections import OrderedDict
from django.apps import apps
from django.core import serializers
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS, router
class Command(BaseCommand):
help = ("Output the contents of the database as a fixture of the given ... | bsd-3-clause |
oscardagrach/linux | Documentation/sphinx/load_config.py | 456 | 1333 | # -*- coding: utf-8; mode: python -*-
# pylint: disable=R0903, C0330, R0914, R0912, E0401
import os
import sys
from sphinx.util.pycompat import execfile_
# ------------------------------------------------------------------------------
def loadConfig(namespace):
# ------------------------------------------------------... | gpl-2.0 |
alexandrucoman/vbox-neutron-agent | neutron/plugins/oneconvergence/lib/plugin_helper.py | 9 | 6793 | # Copyright 2014 OneConvergence, 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 |
itdc/sublimetext-itdchelper | itdchelper/asanalib/requests/cookies.py | 34 | 13686 | # -*- coding: utf-8 -*-
"""
Compatibility code to be able to use `cookielib.CookieJar` with requests.
requests.utils imports from here, so be careful with imports.
"""
import collections
from .compat import cookielib, urlparse, Morsel
try:
import threading
# grr, pyflakes: this fixes "redefinition of unused... | mit |
TalShafir/ansible | lib/ansible/plugins/action/win_updates.py | 21 | 12639 | from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.errors import AnsibleError
from ansible.module_utils._text import to_text
from ansible.module_utils.parsing.convert_bool import boolean
from ansible.parsing.yaml.objects import AnsibleUnicode
from ansible.... | gpl-3.0 |
Weil0ng/gem5 | src/mem/slicc/ast/InPortDeclAST.py | 29 | 5020 | # Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
# Copyright (c) 2009 The Hewlett-Packard Development Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source co... | bsd-3-clause |
dmitry-sobolev/ansible | lib/ansible/plugins/action/junos.py | 5 | 5656 | #
# (c) 2016 Red Hat Inc.
#
# 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 d... | gpl-3.0 |
zeehio/python-telegram-bot | telegram/document.py | 2 | 2098 | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015 Leandro Toledo de Souza <leandrotoeldodesouza@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the ... | gpl-3.0 |
ZefQ/Flexget | flexget/plugins/cli/database.py | 8 | 3612 | from __future__ import unicode_literals, division, absolute_import
from flexget import options
from flexget.db_schema import reset_schema, plugin_schemas
from flexget.event import event
from flexget.logger import console
from flexget.manager import Base, Session
def do_cli(manager, options):
with manager.acquire... | mit |
fbradyirl/home-assistant | tests/components/device_tracker/test_entities.py | 4 | 1970 | """Tests for device tracker entities."""
import pytest
from homeassistant.components.device_tracker.config_entry import (
BaseTrackerEntity,
ScannerEntity,
)
from homeassistant.components.device_tracker.const import (
SOURCE_TYPE_ROUTER,
ATTR_SOURCE_TYPE,
DOMAIN,
)
from homeassistant.const import S... | apache-2.0 |
PokemonGoF/PokemonGo-Bot-Desktop | build/pywin/Lib/traceback.py | 64 | 11285 | """Extract, format and print information about Python stack traces."""
import linecache
import sys
import types
__all__ = ['extract_stack', 'extract_tb', 'format_exception',
'format_exception_only', 'format_list', 'format_stack',
'format_tb', 'print_exc', 'format_exc', 'print_exception',
... | mit |
luca76/QGIS | python/plugins/processing/script/ScriptAlgorithm.py | 1 | 11619 | # -*- coding: utf-8 -*-
"""
***************************************************************************
ScriptAlgorithm.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***********************... | gpl-2.0 |
seckcoder/lang-learn | python/sklearn/examples/linear_model/plot_sgd_comparison.py | 7 | 1641 | """
==================================
Comparing various online solvers
==================================
An example showing how different online solvers perform
on the hand-written digits dataset.
"""
# Author: Rob Zinkov <rob at zinkov dot com>
# License: Simplified BSD
import numpy as np
import pylab as pl
from ... | unlicense |
jimbobhickville/taskflow | taskflow/utils/schema_utils.py | 4 | 1199 | # -*- coding: utf-8 -*-
# Copyright (C) 2015 Yahoo! 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... | apache-2.0 |
jsteemann/arangodb | 3rdParty/V8-4.3.61/third_party/python_26/Lib/site-packages/pythonwin/pywin/framework/startup.py | 17 | 2151 | # startup.py
#
"The main application startup code for PythonWin."
#
# This does the basic command line handling.
# Keep this as short as possible, cos error output is only redirected if
# this runs OK. Errors in imported modules are much better - the messages go somewhere (not any more :-)
import sys
import win32ui... | apache-2.0 |
willingc/oh-mainline | vendor/packages/twisted/twisted/words/im/basesupport.py | 57 | 7890 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
#
"""Instance Messenger base classes for protocol support.
You will find these useful if you're adding a new protocol to IM.
"""
# Abstract representation of chat "model" classes
from twisted.words.im.locals import ONLINE, OFFLINE, OfflineErro... | agpl-3.0 |
AndrewSallans/osf.io | scripts/migrate_guid.py | 64 | 8584 | """
Create a GUID for all non-GUID database records. If record already has a GUID,
skip; if record has an ID but not a GUID, create a GUID matching the ID. Newly
created records will have optimistically generated GUIDs.
"""
import time
import collections
from framework.mongo import StoredObject
from website import m... | apache-2.0 |
MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.1/Lib/encodings/cp500.py | 266 | 13121 | """ Python Character Mapping Codec cp500 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP500.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input... | mit |
drowsy810301/NTHUOJ_web | vjudge/submit.py | 1 | 2981 | """
The MIT License (MIT)
Copyright (c) 2014 NTHUOJ team
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, ... | mit |
Ghatage/peloton | third_party/logcabin/scripts/electionperf.py | 8 | 4444 | #!/usr/bin/env python
# Copyright (c) 2012 Stanford University
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND T... | apache-2.0 |
vitordouzi/sigtrec_eval | sigtrec_eval.py | 1 | 6354 | import sys, os, subprocess, math, multiprocessing, random
import numpy as np
from numpy import nan
import pandas as pd
from scipy.stats.mstats import ttest_rel
from scipy.stats import ttest_ind, wilcoxon
from imblearn.over_sampling import RandomOverSampler, SMOTE
from collections import namedtuple
Result = namedtuple(... | mit |
zerothi/sisl | sisl/quaternion.py | 1 | 6040 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
import math as m
import numpy as np
from ._internal import set_module
__all__ = ['Quaternion']
@set_module("sisl")
c... | lgpl-3.0 |
mcgoddard/widgetr | env/Lib/site-packages/pip/compat/__init__.py | 49 | 2996 | """Stuff that differs in different Python versions and platform
distributions."""
from __future__ import absolute_import, division
import os
import imp
import sys
from pip._vendor.six import text_type
try:
from logging.config import dictConfig as logging_dictConfig
except ImportError:
from pip.compat.dictcon... | mit |
yaoandw/joke | Pods/AVOSCloudCrashReporting/Breakpad/src/tools/gyp/gyptest.py | 525 | 7988 | #!/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.
__doc__ = """
gyptest.py -- test runner for GYP tests.
"""
import os
import optparse
import subprocess
import sys
class CommandRunner:
"... | mit |
KyleAMoore/KanjiNani | Android/.buildozer/android/platform/build/build/other_builds/kivy-python3crystax-sdl2/armeabi-v7a/kivy/kivy/uix/stacklayout.py | 21 | 11363 | '''
Stack Layout
============
.. only:: html
.. image:: images/stacklayout.gif
:align: right
.. only:: latex
.. image:: images/stacklayout.png
:align: right
.. versionadded:: 1.0.5
The :class:`StackLayout` arranges children vertically or horizontally, as many
as the layout can fit. The siz... | gpl-3.0 |
pombredanne/wrapt | tests/test_inner_classmethod.py | 1 | 6870 | from __future__ import print_function
import unittest
import inspect
import imp
import wrapt
from compat import PY2, PY3, exec_
DECORATORS_CODE = """
import wrapt
@wrapt.decorator
def passthru_decorator(wrapped, instance, args, kwargs):
return wrapped(*args, **kwargs)
"""
decorators = imp.new_module('decorato... | bsd-2-clause |
ssalevan/func | func/yaml/dump.py | 12 | 8711 | """
pyyaml legacy
Copyright (c) 2001 Steve Howell and Friends; All Rights Reserved
(see open source license information in docs/ directory)
"""
import types
import string
from types import StringType, UnicodeType, IntType, FloatType
from types import DictType, ListType, TupleType, InstanceType
from klass i... | gpl-2.0 |
kenshay/ImageScripter | ProgramData/SystemFiles/Python/Lib/site-packages/urllib3/exceptions.py | 87 | 6604 | from __future__ import absolute_import
from .packages.six.moves.http_client import (
IncompleteRead as httplib_IncompleteRead
)
# Base Exceptions
class HTTPError(Exception):
"Base exception used by this module."
pass
class HTTPWarning(Warning):
"Base warning used by this module."
pass
class Po... | gpl-3.0 |
ContinuumBridge/adaptor_test_app | adaptor_test_app.py | 1 | 1179 | #!/usr/bin/env python
# adaptor_test_app.py
"""
Copyright (c) 2014 ContinuumBridge Limited
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 rig... | mit |
robert-budde/smarthome | lib/env/stat.py | 2 | 2025 | # System logic 'stat' of SmartHomeNG
#
# schedule is defined in lib.env.logic.yaml
#
import os
import sys
import shutil
import ephem
import psutil
if sh.env.system.libs.ephem_version is not None:
sh.env.system.libs.ephem_version(ephem.__version__, logic.lname)
# lib/env/statistic.py
# Garbage
gc.collect()
if gc... | gpl-3.0 |
blois/AndroidSDKCloneMin | ndk/prebuilt/linux-x86_64/lib/python2.7/lib2to3/patcomp.py | 304 | 7091 | # Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Pattern compiler.
The grammer is taken from PatternGrammar.txt.
The compiler compiles a pattern to a pytree.*Pattern instance.
"""
__author__ = "Guido van Rossum <guido@python.org>"
# Python imports
import os
imp... | apache-2.0 |
zhangjiajie/PTP | nexus/test/test_regressions.py | 3 | 5632 | """Regression Tests"""
import os
import re
import unittest
from nexus import NexusReader
from nexus.reader import GenericHandler, DataHandler, TreeHandler
EXAMPLE_DIR = os.path.join(os.path.dirname(__file__), '../examples')
REGRESSION_DIR = os.path.join(os.path.dirname(__file__), 'regression')
class Test_DataHandler... | gpl-3.0 |
ayushagrawal288/zamboni | sites/dev/settings_base.py | 6 | 5379 | """private_base will be populated from puppet and placed in this directory"""
import logging
import os
import dj_database_url
from mkt.settings import (CACHE_PREFIX, ES_INDEXES,
KNOWN_PROXIES, LOGGING, HOSTNAME)
from .. import splitstrip
import private_base as private
ALLOWED_HOSTS = ['.a... | bsd-3-clause |
IceCubeDev/SpaceOrNot | psycopg2/tests/test_lobject.py | 39 | 15262 | #!/usr/bin/env python
# test_lobject.py - unit test for large objects support
#
# Copyright (C) 2008-2011 James Henstridge <james@jamesh.id.au>
#
# psycopg2 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 Foundat... | apache-2.0 |
koniiiik/django | tests/sites_framework/migrations/0001_initial.py | 281 | 1672 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sites', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='CustomArticle',
fields=[
... | bsd-3-clause |
credativ/pulp | common/test/unit/common/plugins/test_progress.py | 4 | 13316 | # -*- coding: utf-8 -*-
#
# Copyright © 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or impli... | gpl-2.0 |
abadger/ansible | test/support/windows-integration/plugins/modules/win_file.py | 52 | 2184 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2015, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
... | gpl-3.0 |
azumimuo/family-xbmc-addon | script.mrknow.urlresolver/lib/urlresolver9/plugins/mp4engine.py | 4 | 1256 | """
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
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.
... | gpl-2.0 |
torchingloom/edx-platform | common/djangoapps/terrain/stubs/start.py | 7 | 2687 | """
Command-line utility to start a stub service.
"""
import sys
import time
import logging
from .comments import StubCommentsService
from .xqueue import StubXQueueService
from .youtube import StubYouTubeService
from .ora import StubOraService
from .lti import StubLtiService
USAGE = "USAGE: python -m stubs.start SERV... | agpl-3.0 |
IronLanguages/ironpython3 | Src/StdLib/Lib/json/decoder.py | 89 | 12763 | """Implementation of JSONDecoder
"""
import re
from json import scanner
try:
from _json import scanstring as c_scanstring
except ImportError:
c_scanstring = None
__all__ = ['JSONDecoder']
FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
NaN = float('nan')
PosInf = float('inf')
NegInf = float('-inf')
def line... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.