repo_name
stringlengths
5
100
path
stringlengths
4
375
copies
stringclasses
991 values
size
stringlengths
4
7
content
stringlengths
666
1M
license
stringclasses
15 values
ubc/edx-platform
common/djangoapps/cors_csrf/migrations/0001_initial.py
98
4870
# -*- 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 model 'XDomainProxyConfiguration' db.create_table('cors_csrf_xdo...
agpl-3.0
fw1121/BDA_py_demos
demos_ch3/demo3_2.py
19
6319
"""Bayesian Data Analysis, 3rd ed Chapter 3, demo 2 Visualise factored sampling and the corresponding marginal and conditional densities. """ from __future__ import division import os import numpy as np from scipy import stats import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec # import from util...
gpl-3.0
jrversteegh/softsailor
deps/numpy-1.6.1/numpy/f2py/cb_rules.py
36
20543
#!/usr/bin/env python """ Build call-back mechanism for f2py2e. Copyright 2000 Pearu Peterson all rights reserved, Pearu Peterson <pearu@ioc.ee> Permission to use, modify, and distribute this software is given under the terms of the NumPy License. NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. $Date: 20...
gpl-3.0
fretscha/pfa
config/settings/local.py
1
2385
# -*- coding: utf-8 -*- ''' Local settings - Run in Debug mode - Use console backend for emails - Add Django Debug Toolbar - Add django-extensions as app ''' from .common import * # noqa # DEBUG # ------------------------------------------------------------------------------ DEBUG = env.bool('DJANGO_DEBUG', default...
bsd-3-clause
ihatevim/spotbot
plugins/media.py
1
8305
# IMDb lookup plugin by Ghetto Wizard (2011). from util import hook, http import re import datetime from urllib2 import URLError from zipfile import ZipFile from cStringIO import StringIO from lxml import etree from util import hook, http, web base_url = "http://thetvdb.com/api/" api_key = "469B73127CA0C411" # ht...
gpl-3.0
pombredanne/mitmproxy
test/test_script.py
24
3236
import os import time import mock from libmproxy import script, flow import tutils def test_simple(): s = flow.State() fm = flow.FlowMaster(None, s) sp = tutils.test_data.path("scripts/a.py") p = script.Script("%s --var 40" % sp, fm) assert "here" in p.ns assert p.run("here") == 41 assert...
mit
cosmo-ethz/CosmoHammer
Tests/test_SampleFileUtil.py
1
2747
""" Test the TestSampleFileUtil module. Execute with py.test -v """ from __future__ import print_function, division, absolute_import, unicode_literals import tempfile import os import numpy import cosmoHammer.Constants as c from cosmoHammer.util.SampleFileUtil import SampleFileUtil class TestSampleFileUtil(object)...
gpl-3.0
sigma-random/avmplus
test/cmdline/testVMbaseConcurrencySelfTest.py
8
2383
#!/usr/bin/env python # 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 http://mozilla.org/MPL/2.0/. from cmdutils import * import os def run(): r=RunTestLib() r.run_test('VMbaseConcurre...
mpl-2.0
lepistone/odoo
addons/plugin_thunderbird/plugin_thunderbird.py
92
2075
# -*- 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
datalogics/scons
test/Scanner/scan-once.py
2
2747
#!/usr/bin/env python # # __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, ...
mit
Arable/evepod
lib/python2.7/site-packages/gunicorn/config.py
23
37678
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import copy import grp import inspect try: import argparse except ImportError: # python 2.6 from . import argparse_compat as argparse import os import pwd import sys import textwrap im...
apache-2.0
prashanthr/wakatime
wakatime/packages/pygments_py2/pygments/formatters/latex.py
72
17615
# -*- coding: utf-8 -*- """ pygments.formatters.latex ~~~~~~~~~~~~~~~~~~~~~~~~~ Formatter for LaTeX fancyvrb output. :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import division from pygments.formatter import Forma...
bsd-3-clause
cjwagner/test-infra
gubernator/third_party/defusedxml/common.py
55
6086
# defusedxml # # Copyright (c) 2013 by Christian Heimes <christian@python.org> # Licensed to PSF under a Contributor Agreement. # See http://www.python.org/psf/license for licensing details. """Common constants, exceptions and helpe functions """ import sys from types import MethodType PY3 = sys.version_info[0] == 3 P...
apache-2.0
abujehad139/damnvid
ui/dMainFrame/dMainGoPanel.py
12
1325
# -*- coding: utf-8 -*- from ..dUI import * def DamnMainStopButton(panel=None, parent=None): stopbutton = wx.Button(panel, -1, DV.l('Stop')) stopbutton.Disable() if parent is not None: panel.Bind(wx.EVT_BUTTON, parent.onStop, stopbutton) return stopbutton class DamnMainGoPanel(wx.Panel): def __init__(self, par...
gpl-3.0
dieterich-lab/rp-bp
rpbp/reference_preprocessing/label_orfs.py
1
21436
#! /usr/bin/env python3 """This script labels the ORFs based on their exon transcript structure with respect to annotated coding sequences """ import argparse import logging import pbio.misc.logging_utils as logging_utils import pbio.utils.bed_utils as bed_utils from rpbp.defaults import default_num_cpus logger = ...
mit
umitproject/tease-o-matic
django/templatetags/future.py
226
3486
from django.conf import settings from django.template import Library, Node, Template, TemplateSyntaxError from django.template.defaulttags import kwarg_re, include_is_allowed, SsiNode, URLNode from django.utils.encoding import smart_str register = Library() @register.tag def ssi(parser, token): """ Outputs t...
bsd-3-clause
OwaJawa/kaggle_diabetic
config.py
5
2232
from datetime import datetime import pprint import os import numpy as np from util import mkdir from data import FEATURE_DIR mkdir(FEATURE_DIR) class Config(object): def __init__(self, layers, cnf=None): self.layers = layers self.cnf = cnf pprint.pprint(cnf) def get(self, k, default...
mit
pstratem/python-bitcoinlib
examples/make-bootstrap-rpc.py
5
1552
#!/usr/bin/env python3 # Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modifie...
lgpl-3.0
rishab96/chessEndGame
userTest.py
1
6281
import copy import chess import chess.syzygy import chess.gaviota import collections from collections import Counter import features from features import * import os.path weight_vector_3_piece = {'black_king_closer_to_winning_square': -1.400000000000001, 'black_opposition': -1.9200000000000015, 'cant catch pawn': 1.0...
gpl-3.0
tod31/pyload
module/plugins/crypter/DataHuFolder.py
5
1721
# -*- coding: utf-8 -*- import re from module.plugins.internal.SimpleCrypter import SimpleCrypter class DataHuFolder(SimpleCrypter): __name__ = "DataHuFolder" __type__ = "crypter" __version__ = "0.12" __status__ = "testing" __pattern__ = r'http://(?:www\.)?data\.hu/dir/\w+' __config_...
gpl-3.0
zcoinui/zetacoin
contrib/devtools/symbol-check.py
138
4151
#!/usr/bin/python # Copyright (c) 2014 Wladimir J. van der Laan # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' A script to check that the (Linux) executables produced by gitian only contain allowed gcc, glibc and libstdc++...
mit
six600110/xmms2
waftools/plugin.py
7
1326
# Stock plugin configuration and build methods. These factor out the # common tasks carried out by plugins in order to configure and build # themselves. from waflib.Errors import ConfigurationError from copy import copy def plugin(name, source=None, configure=False, build=False, build_replace=False, libs=[...
lgpl-2.1
Mchakravartula/rockstor-core
src/rockstor/scripts/bootstrap.py
2
3111
""" Copyright (c) 2012-2015 RockStor, Inc. <http://rockstor.com> This file is part of RockStor. RockStor 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 la...
gpl-3.0
liavkoren/djangoDev
tests/bash_completion/tests.py
19
3224
""" A series of tests to establish that the command-line bash completion works. """ import os import sys import unittest from django.apps import apps from django.core.management import ManagementUtility from django.utils.six import StringIO class BashCompletionTests(unittest.TestCase): """ Testing the Python...
bsd-3-clause
doismellburning/edx-platform
common/test/acceptance/tests/lms/test_lms_user_preview.py
59
15999
# -*- coding: utf-8 -*- """ Tests the "preview" selector in the LMS that allows changing between Staff, Student, and Content Groups. """ from ..helpers import UniqueCourseTest, create_user_partition_json from ...pages.studio.auto_auth import AutoAuthPage from ...pages.lms.courseware import CoursewarePage from ...pages...
agpl-3.0
hacksterio/pygments.rb
vendor/simplejson/simplejson/tests/test_decimal.py
45
2357
import decimal from decimal import Decimal from unittest import TestCase from StringIO import StringIO import simplejson as json class TestDecimal(TestCase): NUMS = "1.0", "10.00", "1.1", "1234567890.1234567890", "500" def dumps(self, obj, **kw): sio = StringIO() json.dump(obj, sio, **kw) ...
mit
suiyuan2009/tensorflow
tensorflow/contrib/ndlstm/python/lstm2d.py
51
8016
# 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 applicable ...
apache-2.0
asser/django
tests/admin_custom_urls/tests.py
8
5656
from __future__ import unicode_literals from django.contrib.admin.utils import quote from django.contrib.auth.models import User from django.template.response import TemplateResponse from django.test import TestCase, override_settings from django.urls import reverse from .models import Action, Car, Person @override...
bsd-3-clause
cyx1231st/nova
nova/tests/unit/test_wsgi.py
7
11923
# Copyright 2011 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # 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 ...
apache-2.0
cneill/designate
designate/api/v2/controllers/limits.py
7
1830
# Copyright 2013 Hewlett-Packard Development Company, L.P. # # Author: Kiall Mac Innes <kiall@hp.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/L...
apache-2.0
drewandersonnz/openshift-tools
openshift/installer/vendored/openshift-ansible-3.9.40/roles/openshift_health_checker/library/ocutil.py
49
2182
#!/usr/bin/python """Interface to OpenShift oc command""" import os import shlex import shutil import subprocess from ansible.module_utils.basic import AnsibleModule ADDITIONAL_PATH_LOOKUPS = ['/usr/local/bin', os.path.expanduser('~/bin')] def locate_oc_binary(): """Find and return oc binary file""" # htt...
apache-2.0
Microvellum/Fluid-Designer
win64-vc/2.78/python/lib/heapq.py
19
22930
"""Heap queue algorithm (a.k.a. priority queue). Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for all k, counting elements from 0. For the sake of comparison, non-existing elements are considered to be infinite. The interesting property of a heap is that a[0] is always its smallest element. Usag...
gpl-3.0
schristakidis/p2ner
p2ner/components/overlay/completeclient/completeclient/messages/validationmessages.py
1
2128
# -*- coding: utf-8 -*- # Copyright 2012 Loris Corazza, Sakis Christakidis # # 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 # # U...
apache-2.0
wonder-sk/inasafe
safe/impact_functions/volcanic/volcano_point_building/parameter_definitions.py
10
2338
# coding=utf-8 """InaSAFE Disaster risk tool by Australian Aid - Parameter definition for Flood Vector on Building QGIS IF Contact : ole.moller.nielsen@gmail.com .. note:: 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 ...
gpl-3.0
sansna/PythonWidgets.py
lib3/web/client.py
1
2235
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Author: user # Date : 2021 Jun 27 10:16:32 PM import os import sys sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))) import time import ujson import datetime import requests from lib3.decorator.safe_run import safe_run_wrap # App Confi...
lgpl-3.0
technologiescollege/s2a_fr
s2a/Python/Lib/test/test_deque.py
60
25329
from collections import deque import unittest from test import test_support, seq_tests import gc import weakref import copy import cPickle as pickle import random import struct BIG = 100000 def fail(): raise SyntaxError yield 1 class BadCmp: def __eq__(self, other): raise RuntimeError class Muta...
gpl-3.0
joone/chromium-crosswalk
tools/telemetry/telemetry/core/memory_cache_http_server_unittest.py
8
2630
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os from telemetry.core import util from telemetry.testing import tab_test_case class MemoryCacheHTTPServerTest(tab_test_case.TabTestCase): def s...
bsd-3-clause
apixandru/intellij-community
python/lib/Lib/site-packages/django/db/models/sql/compiler.py
71
43002
from django.core.exceptions import FieldError from django.db import connections from django.db.backends.util import truncate_name from django.db.models.sql.constants import * from django.db.models.sql.datastructures import EmptyResultSet from django.db.models.sql.expressions import SQLEvaluator from django.db.models.sq...
apache-2.0
Vogeltak/pauselan
lib/python3.4/site-packages/sqlalchemy/testing/schema.py
79
3446
# testing/schema.py # Copyright (C) 2005-2015 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php from . import exclusions from .. import schema, event from . import config __all_...
gpl-2.0
cloudnull/ansible
lib/ansible/module_utils/rax.py
280
11974
# 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
Elektropippo/kernel_852i
tools/perf/scripts/python/sched-migration.py
11215
11670
#!/usr/bin/python # # Cpu task migration overview toy # # Copyright (C) 2010 Frederic Weisbecker <fweisbec@gmail.com> # # perf script event handlers have been generated by perf script -g python # # This software is distributed under the terms of the GNU General # Public License ("GPL") version 2 as published by the Fre...
gpl-2.0
arbrandes/edx-platform
cms/djangoapps/contentstore/tests/test_clone_course.py
4
6454
""" Unit tests for cloning a course between the same and different module stores. """ import json from unittest.mock import Mock, patch from django.conf import settings from opaque_keys.edx.locator import CourseLocator from cms.djangoapps.contentstore.tasks import rerun_course from cms.djangoapps.contentstore.tests...
agpl-3.0
ariakerstein/twitterFlaskClone
project/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/fields.py
1007
5833
import email.utils import mimetypes from .packages import six def guess_content_type(filename, default='application/octet-stream'): """ Guess the "Content-Type" of a file. :param filename: The filename to guess the "Content-Type" of using :mod:`mimetypes`. :param default: If no "Cont...
mit
2013Commons/HUE-SHARK
desktop/core/ext-py/Mako-0.7.2/build/lib.linux-i686-2.7/mako/pygen.py
19
9485
# mako/pygen.py # Copyright (C) 2006-2012 the Mako authors and contributors <see AUTHORS file> # # This module is part of Mako and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """utilities for generating and formatting literal Python code.""" import re, string from StringIO ...
apache-2.0
sajuptpm/contrail-controller
src/config/svc-monitor/svc_monitor/physical_service_manager.py
1
4391
import uuid from vnc_api.vnc_api import * from instance_manager import InstanceManager from config_db import ( VirtualMachineSM, VirtualMachineInterfaceSM, ServiceApplianceSetSM, ServiceApplianceSM, PhysicalInterfaceSM, ServiceInstanceSM, PortTupleSM) from cfgm_common import svc_info class...
apache-2.0
uclmr/inferbeddings
scripts/guo-fb122/UCL_ARRAY_GUO-FB122_adv_KALE_v2.py
1
4329
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import itertools import os import os.path import sys import argparse import logging def cartesian_product(dicts): return (dict(zip(dicts, x)) for x in itertools.product(*dicts.values())) def summary(configuration): kvs = sorted([(k, v) for k, v in configurati...
mit
devs1991/test_edx_docmode
venv/lib/python2.7/site-packages/nltk/sem/lfg.py
12
6372
# Natural Language Toolkit: Lexical Functional Grammar # # Author: Dan Garrette <dhgarrette@gmail.com> # # Copyright (C) 2001-2012 NLTK Project # URL: <http://www.nltk.org/> # For license information, see LICENSE.TXT from collections import defaultdict from nltk.internals import Counter class FStructure(dict): ...
agpl-3.0
stevenvo/rpi-gpio-scripts
06_rgb.py
2
1605
#!/usr/bin/env python import RPi.GPIO as GPIO import time colors = [0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0xFF00FF, 0x00FFFF] LedPinRed = 11 LedPinGreen = 12 LedPinBlue = 13 def setup(Rpin, Gpin, Bpin): global pins global p_R, p_G, p_B pins = {'pin_R': Rpin, 'pin_G': Gpin, 'pin_B': Bpin} GPIO.setmode(GPIO.BOARD...
gpl-2.0
plaes/numpy
numpy/lib/tests/test_ufunclike.py
5
1776
""" >>> import numpy.core as nx >>> import numpy.lib.ufunclike as U Test fix: >>> a = nx.array([[1.0, 1.1, 1.5, 1.8], [-1.0, -1.1, -1.5, -1.8]]) >>> U.fix(a) array([[ 1., 1., 1., 1.], [-1., -1., -1., -1.]]) >>> y = nx.zeros(a.shape, float) >>> U.fix(a, y) array([[ 1., 1., 1., 1.], [-1., -1., -1., -...
bsd-3-clause
meteorcloudy/tensorflow
tensorflow/python/kernel_tests/lrn_op_test.py
138
5675
# 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
gautamkrishnar/hatter
venv/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.py
310
4625
from __future__ import absolute_import, division, unicode_literals try: from collections import OrderedDict except ImportError: try: from ordereddict import OrderedDict except ImportError: OrderedDict = dict import gettext _ = gettext.gettext import re from pip._vendor.six import text_typ...
gpl-3.0
jmartinm/invenio-master
modules/websubmit/lib/websubmitadmincli.py
21
21304
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 ve...
gpl-2.0
martonw/phantomjs
src/qt/qtwebkit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
113
20678
# Copyright (C) 2010 Google Inc. All rights reserved. # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Szeged # Copyright (C) 2011 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following ...
bsd-3-clause
seize-the-dave/XlsxWriter
xlsxwriter/test/comparison/test_chart_column03.py
8
1586
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org # from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """...
bsd-2-clause
dorotan/pythontraining
env/Lib/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.py
353
14161
"""Module for supporting the lxml.etree library. The idea here is to use as much of the native library as possible, without using fragile hacks like custom element names that break between releases. The downside of this is that we cannot represent all possible trees; specifically the following are known to cause proble...
apache-2.0
huiyi1990/grab
grab/util/module.py
12
2512
import logging import six from grab.spider.base import Spider from grab.spider.error import SpiderInternalError from grab.util.config import build_root_config, build_spider_config SPIDER_REGISTRY = {} logger = logging.getLogger('grab.util.module') def build_spider_registry(config): SPIDER_REGISTRY.clear() ...
mit
gameduell/duell
bin/mac/python2.7.9/lib/python2.7/encodings/iso8859_11.py
593
12591
""" Python Character Mapping Codec iso8859_11 generated from 'MAPPINGS/ISO8859/8859-11.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,errors...
bsd-2-clause
xiaoixa/python
ddkangfu/0003/0003.py
40
1351
#coding=utf-8 import uuid import redis """ 003, 将 0001 题生成的 200 个激活码(或者优惠券)保存到 **Redis** 非关系型数据库中. """ def get_redis_instance(host='localhost', port=6379): return redis.StrictRedis(host=host, port=port) def generate_activation_code(count): code_list = [] for i in xrange(count): code = str(uui...
mit
cmoutard/mne-python
logo/generate_mne_logos.py
12
6091
# -*- coding: utf-8 -*- """ =============================================================================== Script 'mne logo' =============================================================================== This script makes the logo for MNE. """ # @author: drmccloy # Created on Mon Jul 20 11:28:16 2015 # License: BSD ...
bsd-3-clause
JianyuWang/nova
nova/tests/unit/volume/encryptors/test_cryptsetup.py
21
3918
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory # 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/...
apache-2.0
Eric-Zhong/odoo
addons/website_membership/controllers/main.py
115
9181
# -*- coding: utf-8 -*- from openerp import SUPERUSER_ID from openerp.addons.web import http from openerp.addons.web.http import request from openerp.addons.website.models.website import unslug from openerp.tools.translate import _ import werkzeug.urls class WebsiteMembership(http.Controller): _references_per_pa...
agpl-3.0
varunarya10/nova_test_latest
nova/tests/unit/virt/hyperv/test_networkutilsv2.py
68
1724
# Copyright 2013 Cloudbase Solutions Srl # # 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
cad-lab/blog
plugin/liquid_tags/b64img.py
312
3085
""" Image Tag --------- This implements a Liquid-style image tag for Pelican, based on the liquid img tag which is based on the octopress image tag [1]_ Syntax ------ {% b64img [class name(s)] [http[s]:/]/path/to/image [width [height]] [title text | "title text" ["alt text"]] %} Examples -------- {% b64img /images/ni...
agpl-3.0
giorgiop/scikit-learn
sklearn/metrics/tests/test_pairwise.py
13
26241
import numpy as np from numpy import linalg from scipy.sparse import dok_matrix, csr_matrix, issparse from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski from sklearn.utils.testing import assert_greater from sklearn.utils.testing import assert_array_almost_equal from sklearn.utils.testing impo...
bsd-3-clause
frdb194/django
django/apps/config.py
224
8284
import os from importlib import import_module from django.core.exceptions import AppRegistryNotReady, ImproperlyConfigured from django.utils._os import upath from django.utils.module_loading import module_has_submodule MODELS_MODULE_NAME = 'models' class AppConfig(object): """ Class representing a Django ap...
bsd-3-clause
joongh/robotframework
utest/writer/test_filewriters.py
7
2607
import unittest from robot.parsing import TestCaseFile from robot.parsing.model import TestCaseTable from robot.utils import ET, ETSource, StringIO from robot.utils.asserts import assert_equal def create_test_case_file(): data = TestCaseFile(source='foo.txt') table = TestCaseTable(data) data.testcase_tab...
apache-2.0
treejames/shaka-player
third_party/gjslint/python-gflags-2.0/tests/flags_modules_for_testing/module_foo.py
139
5150
#!/usr/bin/env python # # Copyright (c) 2009, 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 ...
apache-2.0
hachreak/invenio-records
setup.py
1
4671
# -*- 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
luofei98/qgis
python/plugins/processing/gui/ProcessingToolbox.py
1
16100
# -*- coding: utf-8 -*- """ *************************************************************************** ProcessingToolbox.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com *********************...
gpl-2.0
m1ck/bookadoptions
django/views/decorators/vary.py
307
1285
try: from functools import wraps except ImportError: from django.utils.functional import wraps # Python 2.4 fallback. from django.utils.cache import patch_vary_headers from django.utils.decorators import available_attrs def vary_on_headers(*headers): """ A view decorator that adds the specified heade...
bsd-3-clause
jiangzhuo/kbengine
kbe/res/scripts/common/Lib/pickletools.py
74
91170
'''"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...
lgpl-3.0
niteoweb/libcloud
libcloud/compute/drivers/ecs.py
5
56343
# 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 use ...
apache-2.0
jvkops/django
django/utils/html_parser.py
348
5155
import re import sys from django.utils import six from django.utils.six.moves import html_parser as _html_parser current_version = sys.version_info use_workaround = current_version < (2, 7, 3) try: HTMLParseError = _html_parser.HTMLParseError except AttributeError: # create a dummy class for Python 3.5+ whe...
bsd-3-clause
neithere/monk
tests/molding_tests.py
1
1746
# coding: utf-8 # # Monk is an unobtrusive data modeling, manipulation and validation library. # Copyright © 2011—2015 Andrey Mikhaylenko # # This file is part of Monk. # # Monk is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as publi...
gpl-3.0
kagetsu-claire/IzuminShogiBot
izumin/math.py
2
1802
# -*- coding: utf-8 -*- import importlib from math import sqrt import psycopg2 import psycopg2.extras from izumin import config if config.IS_PRODUCTION_ENVIRONMENT: db = importlib.import_module("izumin.db") else: db = importlib.import_module("izumin.db_local") def is_prime(x): """ 引数が素数であればTrue、そうで...
mit
raptorz/userga
config.py
1
1121
# -*- coding: utf-8 -*- """ default config file :copyright: 20160204 by raptor.zh@gmail.com. """ #from __future__ import unicode_literals import sys PY3=sys.version>"3" from os.path import dirname, abspath, expanduser, join as joinpath import json import logging logger = logging.getLogger(__name__) config...
mit
eyalfa/spark
python/pyspark/ml/common.py
119
4372
# # 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 us...
apache-2.0
7kbird/chrome
tools/telemetry/telemetry/core/browser_info.py
55
1147
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. _check_webgl_supported_script = """ (function () { var c = document.createElement('canvas'); var gl = c.getContext('webgl'); if (gl == null) { gl =...
bsd-3-clause
agconti/njode
env/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py
304
15086
'''SSL with SNI_-support for Python 2. Follow these instructions if you would like to verify SSL certificates in Python 2. Note, the default libraries do *not* do certificate checking; you need to do additional work to validate certificates yourself. This needs the following packages installed: * pyOpenSSL (tested wi...
bsd-3-clause
CloudVLab/professional-services
examples/ml-audio-content-profiling/tests/test_perspective_api_function.py
2
5636
#!/usr/bin/env python3 # Copyright 2019 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...
apache-2.0
huanchenz/STX-h-store
third_party/python/boto/exception.py
9
13323
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # 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 without res...
gpl-3.0
Mappy/mapnik
bindings/python/build.py
2
8178
# # This file is part of Mapnik (c++ mapping toolkit) # # Copyright (C) 2013 Artem Pavlenko # # Mapnik is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your op...
lgpl-2.1
nkgilley/home-assistant
homeassistant/components/mfi/sensor.py
19
3314
"""Support for Ubiquiti mFi sensors.""" import logging from mficlient.client import FailedToLogin, MFiClient import requests import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_SSL, CONF_US...
apache-2.0
kaithar/muhubot
utils/plumbing/http_sink/jisho.py
1
1391
from __future__ import print_function, unicode_literals import json from utils.protocol import Socket as sock from funchain import AsyncCall import traceback tracker = {} cid = 0 def receiver(body): asc = tracker.get(body['cid'], None) if asc: del tracker[body['cid']] asc.fire_callback(body['...
gpl-2.0
sgerhart/ansible
lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py
8
11842
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (C) 2017 Google # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # ---------------------------------------------------------------------------- # # *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** # ...
mit
sumedh123/debatify
venv/lib/python2.7/site-packages/pip/_vendor/html5lib/constants.py
497
86873
from __future__ import absolute_import, division, unicode_literals import string EOF = None E = { "null-character": "Null character in input stream, replaced with U+FFFD.", "invalid-codepoint": "Invalid codepoint in stream.", "incorrectly-placed-solidus": "Solidus (/) incorrectly ...
mit
mivanov/editkit
editkit/users/models.py
1
1488
import urllib from django.contrib.auth.models import User from django.utils.encoding import smart_str from django.db import models from django.conf import settings from django.contrib.sites.models import Site ####################################################################### # # "Monkey-pathcing is bad, but co...
gpl-2.0
p4datasystems/CarnotKE
jyhton/lib-python/2.7/test/test_runpy.py
43
16184
# Test the runpy module import unittest import os import os.path import sys import re import tempfile from test.test_support import verbose, run_unittest, forget from test.script_helper import (temp_dir, make_script, compile_script, make_pkg, make_zip_script, make_zip_pkg) from runpy i...
apache-2.0
grantsewell/nzbToMedia
libs/unidecode/x082.py
252
4649
data = ( 'Yao ', # 0x00 'Yu ', # 0x01 'Chong ', # 0x02 'Xi ', # 0x03 'Xi ', # 0x04 'Jiu ', # 0x05 'Yu ', # 0x06 'Yu ', # 0x07 'Xing ', # 0x08 'Ju ', # 0x09 'Jiu ', # 0x0a 'Xin ', # 0x0b 'She ', # 0x0c 'She ', # 0x0d 'Yadoru ', # 0x0e 'Jiu ', # 0x0f 'Shi ', # 0x10 'Tan ...
gpl-3.0
s0enke/boto
boto/exception.py
117
17106
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # 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 without res...
mit
j4s0nh4ck/you-get
src/you_get/extractors/ehow.py
20
1099
#!/usr/bin/env python __all__ = ['ehow_download'] from ..common import * def ehow_download(url, output_dir = '.', merge = True, info_only = False): assert re.search(r'http://www.ehow.com/video_', url), "URL you entered is not supported" html = get_html(url) contentid = r1(r'<meta name="contentid" scheme="DMINS...
mit
Yelp/paasta
setup.py
1
5208
#!/usr/bin/env python # Copyright 2015-2016 Yelp 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 ...
apache-2.0
ahmed-mahran/hue
desktop/core/ext-py/Pygments-1.3.1/pygments/formatters/terminal.py
75
4012
# -*- coding: utf-8 -*- """ pygments.formatters.terminal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Formatter for terminal output with ANSI sequences. :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.formatter import Formatter from pyg...
apache-2.0
cm-a7lte/device_samsung_a7lte
tools/perf/scripts/python/syscall-counts.py
11181
1522
# system call counts # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # Displays system-wide system call totals, broken down by syscall. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. import os import sys sys.path.append(os.envir...
gpl-2.0
nrsimha/wagtail
wagtail/wagtailimages/rich_text.py
9
1466
from wagtail.wagtailimages.models import get_image_model from wagtail.wagtailimages.formats import get_image_format class ImageEmbedHandler(object): """ ImageEmbedHandler will be invoked whenever we encounter an element in HTML content with an attribute of data-embedtype="image". The resulting element in ...
bsd-3-clause
WhireCrow/openwrt-mt7620
staging_dir/target-mipsel_r2_uClibc-0.9.33.2/root-ralink/usr/lib/python2.7/fpformat.py
322
4699
"""General floating point formatting functions. Functions: fix(x, digits_behind) sci(x, digits_behind) Each takes a number or a string and a number of digits as arguments. Parameters: x: number to be formatted; or a string resembling a number digits_behind: number of digits behind the decimal point """ f...
gpl-2.0
gautamMalu/rootfs_xen_arndale
usr/lib/python3/dist-packages/dbus/mainloop/glib.py
10
1773
# Copyright (C) 2004 Anders Carlsson # Copyright (C) 2004-2006 Red Hat Inc. <http://www.redhat.com/> # Copyright (C) 2005-2006 Collabora Ltd. <http://www.collabora.co.uk/> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Softw...
gpl-2.0
traveloka/ansible
lib/ansible/modules/cloud/rackspace/rax_keypair.py
50
5128
#!/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
PetePriority/home-assistant
homeassistant/components/xiaomi_aqara/binary_sensor.py
3
17451
"""Support for Xiaomi aqara binary sensors.""" import logging from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.xiaomi_aqara import (PY_XIAOMI_GATEWAY, XiaomiDevice) from homeassistant.core import callback from homeass...
apache-2.0
Lyleo/nupic
nupic/datafiles/extra/firstOrder/raw/makeDataset.py
17
3488
#! /usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions...
gpl-3.0