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
zstyblik/infernal-twin
build/pillow/PIL/WebPImagePlugin.py
52
1961
from PIL import Image from PIL import ImageFile from io import BytesIO from PIL import _webp _VALID_WEBP_MODES = { "RGB": True, "RGBA": True, } _VP8_MODES_BY_IDENTIFIER = { b"VP8 ": "RGB", b"VP8X": "RGBA", b"VP8L": "RGBA", # lossless } def _accept(prefix): is_riff_file_format = pre...
gpl-3.0
ogenstad/ansible
lib/ansible/module_utils/gcdns.py
187
2531
# 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
elky/django
tests/view_tests/tests/test_static.py
19
6686
import mimetypes import unittest from os import path from urllib.parse import quote from django.conf.urls.static import static from django.core.exceptions import ImproperlyConfigured from django.http import FileResponse, HttpResponseNotModified from django.test import SimpleTestCase, override_settings from django.util...
bsd-3-clause
sj26/webapp
webapp/check.py
2
4467
# This file is part of WebApp. # # WebApp 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. # # WebApp is distributed in the hope that ...
gpl-3.0
mapr/hue
desktop/core/ext-py/Django-1.6.10/tests/view_tests/tests/test_defaults.py
49
3332
from __future__ import absolute_import, unicode_literals from django.contrib.contenttypes.models import ContentType from django.test import TestCase from django.test.utils import (setup_test_template_loader, restore_template_loaders, override_settings) from ..models import Author, Article, UrlArticle class Defa...
apache-2.0
biocore/qiime
qiime/validate_demultiplexed_fasta.py
15
20195
#!/usr/bin/env python # File created Feb 1 2012 from __future__ import division __author__ = "William Anton Walters" __copyright__ = "Copyright 2011, The QIIME Project" __credits__ = ["William Anton Walters", "Emily TerAvest"] __license__ = "GPL" __version__ = "1.9.1-dev" __maintainer__ = "William Anton Walters" __em...
gpl-2.0
vishnu-kumar/PeformanceFramework
rally_os/ui/utils.py
12
1638
# Copyright 2014: Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
apache-2.0
IanMezza/edx-6.00.1x
midterm/tests.py
1
2648
import unittest from p4 import * from p5 import * from p6 import * from p7 import * from p8 import * from p9 import * # Test cases class TestCodeEdX(unittest.TestCase): def test_count(self): # Problem 4 self.assertEqual(is_triangular(1), True) self.assertEqual(is_triangular(3), True) ...
mit
AOSPU/external_chromium_org
chrome/common/extensions/docs/server2/converter_html_parser.py
165
1723
# 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. from HTMLParser import HTMLParser from StringIO import StringIO class _ConverterHTMLParser(HTMLParser): def __init__(self, io): HTMLParser.__init_...
bsd-3-clause
therearesomewhocallmetim/omim
3party/protobuf/gtest/test/gtest_list_tests_unittest.py
1068
5415
#!/usr/bin/env python # # Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
apache-2.0
pwoodworth/intellij-community
plugins/hg4idea/testData/bin/mercurial/parsers.py
91
3343
# parsers.py - Python implementation of parsers.c # # Copyright 2009 Matt Mackall <mpm@selenic.com> and others # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. from mercurial.node import bin, nullid from mercurial import util impor...
apache-2.0
gdub/mysql-connector-python
tests/test_fabric.py
1
38399
# MySQL Connector/Python - MySQL driver written in Python. # Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. # MySQL Connector/Python is licensed under the terms of the GPLv2 # <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most # MySQL Connectors. There are special exceptio...
gpl-2.0
ryfeus/lambda-packs
Pdf_docx_pptx_xlsx_epub_png/source/pptx/__init__.py
2
1700
# encoding: utf-8 """ Initialization module for python-pptx """ __version__ = '0.6.5' import pptx.exc as exceptions import sys sys.modules['pptx.exceptions'] = exceptions del sys from pptx.api import Presentation # noqa from pptx.opc.constants import CONTENT_TYPE as CT from pptx.opc.package import PartFactory fr...
mit
c2corg/v6_api
c2corg_api/markdown/img.py
1
2901
''' c2corg img Extension for Python-Markdown ============================================== Converts tags like [img=<id>(<options>)(/)?](<caption>)?([/img])? to advanced HTML img tags. ''' from markdown.extensions import Extension from markdown.blockprocessors import BlockProcessor from markdown.util import etree im...
agpl-3.0
chauhanhardik/populo_2
common/djangoapps/student/cookies.py
116
5305
""" Utility functions for setting "logged in" cookies used by subdomains. """ import time import json from django.utils.http import cookie_date from django.conf import settings from django.core.urlresolvers import reverse, NoReverseMatch def set_logged_in_cookies(request, response, user): """ Set cookies in...
agpl-3.0
yufengg/tensorflow
tensorflow/python/platform/gfile.py
106
2636
# 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
wyc/django
tests/ordering/models.py
261
1379
""" Specifying ordering Specify default ordering for a model using the ``ordering`` attribute, which should be a list or tuple of field names. This tells Django how to order ``QuerySet`` results. If a field name in ``ordering`` starts with a hyphen, that field will be ordered in descending order. Otherwise, it'll be ...
bsd-3-clause
aadityabhatia/gtags-appengine
gdata/tlslite/utils/PyCrypto_RSAKey.py
361
1814
"""PyCrypto RSA implementation.""" from cryptomath import * from RSAKey import * from Python_RSAKey import Python_RSAKey if pycryptoLoaded: from Crypto.PublicKey import RSA class PyCrypto_RSAKey(RSAKey): def __init__(self, n=0, e=0, d=0, p=0, q=0, dP=0, dQ=0, qInv=0): if not d: ...
gpl-3.0
PepperPD/edx-pepper-platform
common/lib/capa/capa/tests/test_input_templates.py
7
36586
""" Tests for the logic in input type mako templates. """ import unittest import capa import os.path import json from lxml import etree from mako.template import Template as MakoTemplate from mako import exceptions class TemplateError(Exception): """ Error occurred while rendering a Mako template. """ ...
agpl-3.0
bobisme/odoo
addons/web_graph/controllers/main.py
97
3556
from openerp import http import simplejson from openerp.http import request, serialize_exception as _serialize_exception from cStringIO import StringIO from collections import deque try: import xlwt except ImportError: xlwt = None class TableExporter(http.Controller): @http.route('/web_graph/check_xlwt',...
agpl-3.0
vie-camera-team/linux-socfpga
scripts/analyze_suspend.py
445
49020
#!/usr/bin/python # # Tool for analyzing suspend/resume timing # Copyright (c) 2013, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, # version 2, as published by the Free Software Foundation. # # This prog...
gpl-2.0
TheAlgorithms/Python
backtracking/n_queens_math.py
1
4930
r""" Problem: The n queens problem is of placing N queens on a N * N chess board such that no queen can attack any other queens placed on that chess board. This means that one queen cannot have any other queen on its horizontal, vertical and diagonal lines. Solution: To solve this problem we will use simple math. F...
mit
Ashaba/rms
rmslocalenv/lib/python2.7/site-packages/django/core/management/color.py
309
1807
""" Sets up the terminal color scheme. """ import os import sys from django.utils import lru_cache, termcolors def supports_color(): """ Returns True if the running system's terminal supports color, and False otherwise. """ plat = sys.platform supported_platform = plat != 'Pocket PC' and (pl...
mit
martinstuga/elasticsearch
dev-tools/create_bwc_index_with_conficting_mappings.py
217
2963
import create_bwc_index import logging import os import random import shutil import subprocess import sys import tempfile def fetch_version(version): logging.info('fetching ES version %s' % version) if subprocess.call([sys.executable, os.path.join(os.path.split(sys.argv[0])[0], 'get-bwc-version.py'), version]) != ...
apache-2.0
ovidiu-beldie/closure-linter-tweaked
closure_linter/ecmametadatapass.py
85
20327
#!/usr/bin/env python # # Copyright 2010 The Closure Linter 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 #...
apache-2.0
joyhchen/zulip
zerver/views/auth.py
2
20946
from __future__ import absolute_import from django.conf import settings from django.contrib.auth import authenticate, login, get_backends from django.contrib.auth.views import login as django_login_page, \ logout_then_login as django_logout_then_login from django.core.urlresolvers import reverse from zerver.decora...
apache-2.0
qnu/gxp
inst_local.py
1
25756
# Copyright (c) 2009 by Kenjiro Taura. All rights reserved. # Copyright (c) 2008 by Kenjiro Taura. All rights reserved. # Copyright (c) 2007 by Kenjiro Taura. All rights reserved. # Copyright (c) 2006 by Kenjiro Taura. All rights reserved. # Copyright (c) 2005 by Kenjiro Taura. All rights reserved. # # THIS MATERIAL IS...
bsd-3-clause
michaelrice/vBurgundy
tests/test_forms.py
1
2240
# -*- coding: utf-8 -*- import pytest from vBurgundy.public.forms import LoginForm from vBurgundy.user.forms import RegisterForm from .factories import UserFactory class TestRegisterForm: def test_validate_user_already_registered(self, user): # Enters username that is already registered form = Re...
apache-2.0
antonioUnina/neutron
neutron/db/l3_db.py
6
64870
# Copyright 2012 VMware, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
apache-2.0
jonahbull/rabbitpy
docs/conf.py
2
8056
# -*- coding: utf-8 -*- # # rabbitpy documentation build configuration file, created by # sphinx-quickstart on Wed Mar 27 18:31:37 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # Al...
bsd-3-clause
taknevski/tensorflow-xsmm
tensorflow/python/kernel_tests/unstack_op_test.py
99
5236
# 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
adammenges/statsmodels
statsmodels/sandbox/panel/correlation_structures.py
37
5044
# -*- coding: utf-8 -*- """Correlation and Covariance Structures Created on Sat Dec 17 20:46:05 2011 Author: Josef Perktold License: BSD-3 Reference --------- quick reading of some section on mixed effects models in S-plus and of outline for GEE. """ import numpy as np def corr_equi(k_vars, rho): '''create e...
bsd-3-clause
dice-project/DICE-Monitoring
src/pyUtil.py
4
32334
''' Copyright 2015, Institute e-Austria, Timisoara, Romania http://www.ieat.ro/ Developers: * Gabriel Iuhasz, iuhasz.gabriel@info.uvt.ro 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: ht...
apache-2.0
mmatyas/servo
tests/wpt/css-tests/tools/html5lib/html5lib/html5parser.py
423
117297
from __future__ import absolute_import, division, unicode_literals from six import with_metaclass import types from . import inputstream from . import tokenizer from . import treebuilders from .treebuilders._base import Marker from . import utils from . import constants from .constants import spaceCharacters, ascii...
mpl-2.0
flochaz/horizon
openstack_dashboard/dashboards/admin/routers/tables.py
9
2280
# Copyright 2012, Nachi Ueno, NTT MCL, 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 applic...
apache-2.0
nistormihai/superdesk-core
superdesk/users/__init__.py
10
1302
# -*- coding: utf-8; -*- # # This file is part of Superdesk. # # Copyright 2013, 2014 Sourcefabric z.u. and contributors. # # For the full copyright and license information, please see the # AUTHORS and LICENSE files distributed with this source code, or # at https://www.sourcefabric.org/superdesk/license from .users ...
agpl-3.0
jswope00/griffinx
pavelib/utils/test/suites/bokchoy_suite.py
7
4933
""" Class used for defining and running Bok Choy acceptance test suite """ from paver.easy import sh from pavelib.utils.test.suites import TestSuite from pavelib.utils.envs import Env from pavelib.utils.test import bokchoy_utils from pavelib.utils.test import utils as test_utils try: from pygments.console import c...
agpl-3.0
fredericlepied/ansible
test/units/module_utils/facts/base.py
118
2325
# base unit test classes for ansible/module_utils/facts/ tests # -*- coding: utf-8 -*- # # 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 lat...
gpl-3.0
ytaben/cyphesis
rulesets/acorn/mapentities.py
2
36238
m.make('birch_summer_1_us',type='birch_summer_1_us',desc='a dumb birch_summer_1_us object', xyz=(-72,85,village_height)) m.make('birch_summer_1_us',type='birch_summer_1_us',desc='a dumb birch_summer_1_us object', xyz=(-72,81,village_height)) m.make('poplar_summer_1_us',type='poplar_summer_1_us',desc='a dumb...
gpl-2.0
Poles/Poles
platforms/linux/JsonCpp/scons-local-2.3.0/SCons/Tool/hplink.py
11
2402
"""SCons.Tool.hplink Tool-specific initialization for the HP linker. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2...
gpl-3.0
alexthered/kienhoc-platform
openedx/core/djangoapps/credit/migrations/0014_auto__add_field_creditprovider_fulfillment_instructions.py
66
12629
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'CreditProvider.fulfillment_instructions' db.add_column('c...
agpl-3.0
tlatzko/spmcluster
.tox/clean/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/specifiers.py
527
28079
# Copyright 2014 Donald Stufft # # 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...
bsd-2-clause
Suwmlee/XX-Net
gae_proxy/server/lib/google/appengine/api/search/ExpressionLexer.py
1
38281
#!/usr/bin/env python # # Copyright 2007 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 o...
bsd-2-clause
hachreak/invenio-accounts
tests/test_models.py
1
3354
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015, 2016 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...
gpl-2.0
OmniLayer/omniwallet
api/get_balance.py
2
3607
import urlparse import os, sys import json #tools_dir = os.environ.get('TOOLSDIR') #lib_path = os.path.abspath(tools_dir) #sys.path.append(lib_path) from msc_apps import * from debug import * from balancehelper import * TIMEOUT='timeout -s 9 10 ' # Get the Mastercoin balances. Not that this is also creating the defau...
agpl-3.0
LukeM12/samba
python/samba/netcmd/vampire.py
40
1947
# Vampire # # Copyright Jelmer Vernooij 2010 <jelmer@samba.org> # # 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. # # Th...
gpl-3.0
pocketone/django-shoppy
shoppy/shop/admin.py
1
1163
import datetime from django.contrib import admin from shoppy.shop.models import * from shoppy.shop.mail import sendOrderSendMail class OrderAdmin(admin.ModelAdmin): list_display = ['billnumber', 'user', 'order_date', 'state_of_order', 'overview_link'] list_display_links = ['billnumber'] list_filter = ['ord...
bsd-3-clause
lmcro/letsencrypt
letshelp-letsencrypt/letshelp_letsencrypt/apache_test.py
39
9300
"""Tests for letshelp.letshelp_letsencrypt_apache.py""" import argparse import functools import os import pkg_resources import subprocess import tarfile import tempfile import unittest import mock import letshelp_letsencrypt.apache as letshelp_le_apache _PARTIAL_CONF_PATH = os.path.join("mods-available", "ssl.load"...
apache-2.0
amenonsen/ansible
lib/ansible/module_utils/network/junos/config/lag_interfaces/lag_interfaces.py
2
10118
# # -*- coding: utf-8 -*- # Copyright 2019 Red Hat # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) """ The junos_lag_interfaces class It is in this file where the current configuration (as dict) is compared to the provided configuration (as dict) and the command set necess...
gpl-3.0
ibressler/pyqtgraph
examples/PlotSpeedTest.py
28
1396
#!/usr/bin/python # -*- coding: utf-8 -*- """ Update a simple plot as rapidly as possible to measure speed. """ ## Add path to library (just for examples; you do not need this) import initExample from pyqtgraph.Qt import QtGui, QtCore import numpy as np import pyqtgraph as pg from pyqtgraph.ptime import time app = Q...
mit
meiavy/python-weixin
lib/python2.7/site-packages/web/wsgi.py
34
2198
""" WSGI Utilities (from web.py) """ import os, sys import http import webapi as web from utils import listget from net import validaddr, validip import httpserver def runfcgi(func, addr=('localhost', 8000)): """Runs a WSGI function as a FastCGI server.""" import flup.server.fcgi as flups return flup...
apache-2.0
mdeff/ntds_2016
project/reports/compressed_sensing/utils.py
1
44865
import scipy.misc import os import shutil import zipfile import numpy as np from itertools import product import pywt import matplotlib.pyplot as plt import mpl_toolkits.axes_grid1 import warnings import tensorflow as tf def is_array_str(obj): """ Check if obj is a list of strings or a tuple of strings or a se...
mit
Charlotte-Morgan/inasafe
safe/test/qgis_interface.py
6
9877
# coding=utf-8 """Fake QGIS Interface.""" import logging from qgis.PyQt.QtCore import QObject, pyqtSlot, pyqtSignal from qgis.core import QgsMapLayer, QgsProject from qgis.gui import QgsLayerTreeMapCanvasBridge # pylint: disable=no-name-in-module from qgis.gui import QgsMessageBar from safe.test.qgis_legend_interfa...
gpl-3.0
rstreif/rvi_backend
web/sota/migrations/0003_update.py
8
1103
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import sota.models class Migration(migrations.Migration): dependencies = [ ('vehicles', '0003_auto_20141009_2054'), ('sota', '0002_package_pac_arch'), ] operations = [ migrat...
mpl-2.0
thenetcircle/dino
dino/rest/resources/full_history.py
1
2794
# 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 under the Li...
apache-2.0
apruden/mica2
mica-python-client/src/main/python/mica/perm_study_dataset.py
1
1189
""" Apply permissions on a study dataset. """ import sys import mica.core import mica.perm def add_arguments(parser): """ Add command specific options """ mica.perm.add_permission_arguments(parser) parser.add_argument('id', help='Study dataset ID') def do_command(args): """ Execute permis...
gpl-3.0
dkrikun/ffmpeg-rcd
agent.py
1
6670
# coding: utf-8 __version__ = '0.1.0' __author__ = 'Daniel Krikun' __license__ = 'MIT' import sys import logging import msvcrt from argparse import ArgumentParser import zmq from agent_pb2 import * from ffmpeg_recorder import * def parse_cmdline_args(): """Parse command-line arguments.""" prsr = ArgumentPa...
mit
sbidoul/odoo
addons/account_voucher/report/__init__.py
378
1083
# -*- 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
VladimirVystupkin/AMRParsing1.x
stanfordnlp/pexpect/__init__.py
56
85657
'''Pexpect is a Python module for spawning child applications and controlling them automatically. Pexpect can be used for automating interactive applications such as ssh, ftp, passwd, telnet, etc. It can be used to a automate setup scripts for duplicating software package installations on different servers. It can be u...
gpl-2.0
FunctionLab/function
flib/core/xdsl.py
1
5740
''' Created on Feb 4, 2013 @author: atadych ''' from xml.etree import ElementTree import sys import numpy def isodd(num): return num & 1 and True or False class CptNodesHolder: ''' Parses xdsl file and holds all the nodes as dictionary ''' def __init__(self, filename=None): #dictionary o...
gpl-3.0
Gamebasis/3DGamebasisServer
GameData/blender-2.71-windows64/2.71/python/lib/site-packages/requests/packages/chardet/escprober.py
2936
3187
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Con...
gpl-3.0
antiface/ga-bitbot
mgws.py
18
3549
""" mgws v0.01 MtGox Web Socket Interface configuration loader Copyright 2011 Brian Monkaba This file is part of ga-bitbot. ga-bitbot 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 versio...
gpl-3.0
mpmendenhall/rotationshield
Scripts/ArrowPlotter.py
1
1787
#!/sw/bin/python from pyx import * from math import * class ArrowPlotter: def __init__(self,g): self.g = g # graph to plot to self.gsize = (g.width,g.height) # size of graph canvas self.gaxes = (g.axes['x'].axis, g.axes['y'].axis) self.axi...
gpl-3.0
ywcui1990/nupic.research
projects/nlp/junit_test4.py
11
5015
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2016, Numenta, Inc. Unless you have purchased from # Numenta, Inc. a separate commercial license for this software code, the # following terms and conditio...
agpl-3.0
NicovincX2/Python-3.5
Algèbre/Algèbre linéaire/Matrice/Matrice inversible/inverseGauss1_iter.py
1
2030
# -*- coding: utf-8 -*- import os # compute the inverse of a matrix via Newton iteration. This is based # on problem 4.12 in Garcia. See also # http://amca01.wordpress.com/2010/08/18/the-nsh-method-for-matrix-inversion/ # (which cites Gunther Schultz 1933 and Harold Hotelling 1943) # also Wikipedia for invertible ...
gpl-3.0
avicennax/jedi
scripts/stability_flipflop.py
1
6588
# CHECK script parameters to ensure # everything is koscher from __future__ import division from jedi import jedi from jedi.utils import seedutil, mailer, init_tools import sys import time import numpy as np from numpy import tanh, dot, sqrt, cos, pi, abs def main(argv): # Loading seeds seeds = seedutil.load...
mit
meletakis/collato
lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/alias.py
135
2477
import distutils, os from setuptools import Command from distutils.util import convert_path from distutils import log from distutils.errors import * from setuptools.command.setopt import edit_config, option_base, config_file def shquote(arg): """Quote an argument for later parsing by shlex.split()""" for c in ...
gpl-2.0
binoculars/osf.io
tests/test_auth.py
2
34804
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from nose.tools import * # noqa; PEP8 asserts from webtest_plus import TestApp as WebtestApp # py.test tries to collect `TestApp` import mock import urllib import urlparse import httplib as http from flask import Flask from werkzeug.wrappers import BaseRe...
apache-2.0
michaelbrundage/vowpal_wabbit
python/examples/xor.py
16
1089
from __future__ import print_function from vowpalwabbit import pyvw class LatentVariableClassifier(pyvw.SearchTask): def __init__(self, vw, sch, num_actions): pyvw.SearchTask.__init__(self, vw, sch, num_actions) sch.set_options( sch.AUTO_CONDITION_FEATURES ) def _run(self, y_x): y,(x...
bsd-3-clause
beni55/picochess
libs/serial/tools/list_ports_windows.py
2
7703
import ctypes import re def ValidHandle(value, func, arguments): if value == 0: raise ctypes.WinError() return value import serial from serial.win32 import ULONG_PTR, is_64bit from ctypes.wintypes import HANDLE from ctypes.wintypes import BOOL from ctypes.wintypes import HWND from ctypes.wintypes impo...
gpl-3.0
webmasterraj/FogOrNot
flask/lib/python2.7/site-packages/pandas/stats/math.py
25
3253
# pylint: disable-msg=E1103 # pylint: disable-msg=W0212 from __future__ import division from pandas.compat import range import numpy as np import numpy.linalg as linalg def rank(X, cond=1.0e-12): """ Return the rank of a matrix X based on its generalized inverse, not the SVD. """ X = np.asarray(...
gpl-2.0
ChenJunor/hue
desktop/core/ext-py/PyYAML-3.09/tests/lib/test_representer.py
60
1562
import yaml import test_constructor import pprint def test_representer_types(code_filename, verbose=False): test_constructor._make_objects() for allow_unicode in [False, True]: for encoding in ['utf-8', 'utf-16-be', 'utf-16-le']: native1 = test_constructor._load_code(open(code_filename, 'r...
apache-2.0
andyraib/data-storage
python_scripts/env/lib/python3.6/site-packages/numpy/core/generate_numpy_api.py
36
7417
from __future__ import division, print_function import os import genapi from genapi import \ TypeApi, GlobalVarApi, FunctionApi, BoolValuesApi import numpy_api # use annotated api when running under cpychecker h_template = r""" #if defined(_MULTIARRAYMODULE) || defined(WITH_CPYCHECKER_STEALS_REFERENCE_TO_AR...
apache-2.0
bittylicious/bitcoin
qa/rpc-tests/invalidateblock.py
146
3110
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test InvalidateBlock code # from test_framework.test_framework import BitcoinTestFramework from test_fram...
mit
hatwar/Das_erpnext
erpnext/stock/doctype/stock_entry/test_stock_entry.py
3
32109
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe, unittest import frappe.defaults from frappe.utils import flt, nowdate, nowtime, getdate from erpnext.stock.doctype.serial_no.serial_no im...
agpl-3.0
amit0701/rally
tests/unit/common/plugin/test_discover.py
15
4128
# Copyright 2015: Mirantis Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
apache-2.0
2014c2g12/c2g12
c2wp/w2/static/Brython2.0.0-20140209-164925/Lib/copy.py
113
8787
"""Generic (shallow and deep) copying operations. Interface summary: import copy x = copy.copy(y) # make a shallow copy of y x = copy.deepcopy(y) # make a deep copy of y For module specific errors, copy.Error is raised. The difference between shallow and deep copying is only relev...
gpl-2.0
bikeNomad/mbed
workspace_tools/test_exporters.py
3
14589
""" mbed SDK Copyright (c) 2011-2014 ARM Limited 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
cchurch/ansible
lib/ansible/modules/cloud/vmware/vmware_cluster_drs.py
16
7493
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2015, Joseph Callen <jcallen () csc.com> # Copyright: (c) 2018, Ansible Project # # 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__ = typ...
gpl-3.0
cloudera/recordservice
tests/common/custom_cluster_test_suite.py
13
4828
# Copyright (c) 2012 Cloudera, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
apache-2.0
jeremiedecock/snippets
python/tkinter/python3/geometry_manager_pack_short_syntax.py
1
1304
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org) # 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 witho...
mit
poojavade/Genomics_Docker
Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/saga_python-0.18-py2.7.egg/saga/filesystem/file.py
10
11606
__author__ = "Andre Merzky, Ole Weidner, Alexander Grill" __copyright__ = "Copyright 2012-2013, The SAGA Project" __license__ = "MIT" import radical.utils.signatures as rus import saga.adaptors.base as sab import saga.session as ss import saga.task as st import saga.url ...
apache-2.0
mjfarmer/scada_py
env/lib/python2.7/site-packages/twisted/conch/ssh/keys.py
3
43907
# -*- test-case-name: twisted.conch.test.test_keys -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Handling of RSA and DSA keys. """ from __future__ import absolute_import, division import base64 import itertools import warnings from hashlib import md5 from cryptography.exceptions i...
gpl-3.0
raven47git/readthedocs.org
readthedocs/projects/filters.py
15
1872
from django.utils.translation import ugettext_lazy as _ import django_filters from projects import constants from projects.models import Project ANY_REPO = ( ('', _('Any')), ) REPO_CHOICES = ANY_REPO + constants.REPO_CHOICES def sort_slug(queryset, query): queryset = queryset.filter(slug__icontains=query)...
mit
popazerty/test-gui
lib/python/Tools/NumericalTextInput.py
16
3334
# -*- coding: UTF-8 -*- from enigma import eTimer from Components.Language import language # Dict languageCode -> array of strings MAP_SEARCH = ( u"%_0", u" 1", u"abc2", u"def3", u"ghi4", u"jkl5", u"mno6", u"pqrs7", u"tuv8", u"wxyz9", ) MAP_SEARCH_UPCASE = ( U"0%_", U"1 ", U"ABC2", U"DEF3", U"GHI4", U...
gpl-2.0
wkhtmltopdf/qtwebkit
Tools/Scripts/webkitpy/layout_tests/reftests/extract_reference_link_unittest.py
122
3414
# Copyright (C) 2011 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the ...
gpl-2.0
hwroitzsch/BikersLifeSaver
lib/python3.5/site-packages/wheel/test/test_install.py
455
1866
# Test wheel. # The file has the following contents: # hello.pyd # hello/hello.py # hello/__init__.py # test-1.0.data/data/hello.dat # test-1.0.data/headers/hello.dat # test-1.0.data/scripts/hello.sh # test-1.0.dist-info/WHEEL # test-1.0.dist-info/METADATA # test-1.0.dist-info/RECORD # The ...
mit
thaihungle/deepexp
dm-dnc/addressing.py
1
16107
import collections import sonnet as snt import tensorflow as tf import util # Ensure values are greater than epsilon to avoid numerical instability. _EPSILON = 1e-6 TemporalLinkageState = collections.namedtuple('TemporalLinkageState', ('link', 'precedence_weights')) de...
mit
blockstack/blockstack-server
integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_xfer_renew_expire_reregister_failure.py
1
5703
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Blockstack ~~~~~ copyright: (c) 2014-2015 by Halfmoon Labs, Inc. copyright: (c) 2016 by Blockstack.org This file is part of Blockstack Blockstack is free software: you can redistribute it and/or modify it under the terms of the GNU General...
gpl-3.0
becomejapan/yahooads-python-lib
examples/RetargetingListService/RetargetingListService_mutate_ADD.py
1
11983
# Copyright 2017 Become Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
apache-2.0
dshean/pygeotools
pygeotools/lib/geolib.py
1
85261
#! /usr/bin/env python """ Geospatial functions for rasters, vectors. """ #Need to make sure all geom have spatial reference included import sys import os import requests import numpy as np from osgeo import gdal, ogr, osr #Enable GDAL exceptions gdal.UseExceptions() #Below are many spatial reference system defin...
mit
uwdata/termite-visualizations
web2py/applications/admin/models/menu.py
22
1588
# ########################################################### # ## generate menu # ########################################################### _a = request.application _c = request.controller _f = request.function response.title = '%s %s' % (_f, '/'.join(request.args)) response.subtitle = 'admin' response.menu = [(T('...
bsd-3-clause
CumulusNetworks/netshow-cumulus-lib
netshow/cumulus/show.py
1
3928
# print() is required for py3 not py2. so need to disable C0325 # pylint: disable=C0325 # pylint: disable=W0232 # pylint: disable=E0611 # pylint: disable=E1101 """ Usage: netshow system [--json | -j ] netshow counters [errors] [all] [--json | -j | -l | --legend ] netshow lldp [--json | -j | -l | --legend ] ...
gpl-2.0
lokeshpancharia/data-science-from-scratch
code/visualizing_data.py
58
5116
import matplotlib.pyplot as plt from collections import Counter def make_chart_simple_line_chart(plt): years = [1950, 1960, 1970, 1980, 1990, 2000, 2010] gdp = [300.2, 543.3, 1075.9, 2862.5, 5979.6, 10289.7, 14958.3] # create a line chart, years on x-axis, gdp on y-axis plt.plot(years, gdp, color='gr...
unlicense
40223236/2015cd_midterm_1
static/Brython3.1.1-20150328-091302/Lib/io.py
623
9405
import builtins open = builtins.open # for seek() SEEK_SET = 0 SEEK_CUR = 1 SEEK_END = 2 r"""File-like objects that read from or write to a string buffer. This implements (nearly) all stdio methods. f = StringIO() # ready for writing f = StringIO(buf) # ready for reading f.close() # explicitly rel...
gpl-3.0
aforalee/keystone
keystone/tests/unit/test_contrib_simple_cert.py
4
1996
# 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 under t...
apache-2.0
diezguerra/cassandra-dbapi2
cql/decoders.py
12
2524
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
pkoutsias/SickRage
sickbeard/metadata/kodi_12plus.py
4
15685
# coding=utf-8 # URL: http://code.google.com/p/sickbeard/ # # This file is part of SickRage. # # SickRage 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)...
gpl-3.0
orbnauticus/silk
silk/webreq/header.py
1
2402
#!/usr/bin/env python from email.utils import quote as param_quote, unquote as param_unquote class Header(dict): def __init__(self, key, *args, **kwargs): dict.__init__(self, *args, **kwargs) self.key = key @classmethod def parse(cls, line): name, _, value = line.partition(': ') ...
bsd-3-clause
tsdmgz/ansible
test/units/modules/network/ios/test_ios_vrf.py
7
6309
# # (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