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
miketheman/opencomparison
package/migrations/0012_auto__add_unique_package_repo_url.py
5
10780
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding unique constraint on 'Package', fields ['repo_url'] db.create_unique('package_package', ['repo_ur...
mit
BT-ojossen/account-invoicing
account_invoice_period_usability/__openerp__.py
4
1555
# -*- coding: utf-8 -*- ############################################################################## # # This file is part of account_invoice_period_usability, # an Odoo module. # # Authors: ACSONE SA/NV (<http://acsone.eu>) # # account_invoice_period_usability is free software: # you can redistribute it and/or modif...
agpl-3.0
Emergya/icm-openedx-educamadrid-platform-basic
openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py
146
9727
"""Generate a list indicating whether users have opted in or out of receiving email from an org. Email opt-in is stored as an org-level preference. When reports are generated, we need to handle: 1) Org aliases: some organizations might have multiple course key "org" values. We choose the most recently set prefere...
agpl-3.0
wangmiao1981/spark
python/pyspark/pandas/tests/data_type_ops/test_complex_ops.py
7
9065
# # 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
BackupGGCode/python-for-android
python3-alpha/python3-src/Tools/scripts/fixnotice.py
48
3058
#! /usr/bin/env python3 """(Ostensibly) fix copyright notices in files. Actually, this sript will simply replace a block of text in a file from one string to another. It will only do this once though, i.e. not globally throughout the file. It writes a backup file and then does an os.rename() dance for atomicity. U...
apache-2.0
SmartInfrastructures/neutron
neutron/plugins/vmware/extensions/qos.py
15
7920
# Copyright 2013 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
6174/libsvm
tools/checkdata.py
144
2479
#!/usr/bin/env python # # A format checker for LIBSVM # # # Copyright (c) 2007, Rong-En Fan # # All rights reserved. # # This program is distributed under the same license of the LIBSVM package. # from sys import argv, exit import os.path def err(line_no, msg): print("line {0}: {1}".format(line_no, msg)) # works...
bsd-3-clause
abhilashnta/edx-platform
lms/djangoapps/notification_prefs/tests.py
137
10272
import json from django.contrib.auth.models import AnonymousUser from django.core.exceptions import PermissionDenied from django.http import Http404 from django.test import TestCase from django.test.client import RequestFactory from django.test.utils import override_settings from mock import Mock, patch from notifica...
agpl-3.0
spirit-code/spirit
core/python/test/hamiltonian.py
1
1520
import os import sys # spirit_py_dir = os.path.dirname(os.path.realpath(__file__)) spirit_py_dir = os.path.abspath(os.path.join(os.path.dirname( __file__ ), "..")) sys.path.insert(0, spirit_py_dir) from spirit import state from spirit import hamiltonian import unittest ########## cfgfile = spirit_py_dir + "/../tes...
mit
cobbr/ObfuscatedEmpire
lib/modules/python/privesc/osx/dyld_print_to_file.py
12
5622
from lib.common import helpers class Module: def __init__(self, mainMenu, params=[]): # metadata info about the module, not modified during runtime self.info = { # name for the module that will appear in module menus 'Name': 'Mac OSX Yosemite DYLD_PRINT_TO_FILE Privilege ...
bsd-3-clause
john-parton/django-oscar
tests/functional/customer/order_status_tests.py
53
1274
from django.utils.six.moves import http_client from django.core.urlresolvers import reverse from oscar.test.factories import create_order from oscar.test.testcases import WebTestCase class TestAnAnonymousUser(WebTestCase): def test_gets_a_404_when_requesting_an_unknown_order(self): path = reverse('cust...
bsd-3-clause
oinopion/django
tests/auth_tests/models/invalid_models.py
251
1340
from django.contrib.auth.models import AbstractBaseUser, UserManager from django.db import models class CustomUserNonUniqueUsername(AbstractBaseUser): """ A user with a non-unique username. This model is not invalid if it is used with a custom authentication backend which supports non-unique username...
bsd-3-clause
iut-ibk/DynaMind-UrbanSim
3rdparty/opus/src/urbansim/configurations/auto_ownership_choice_model_configuration_creator.py
2
9118
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE from opus_core.configuration import Configuration class AutoOwnershipChoiceModelConfigurationCreator(object): _model_name = 'auto_ownership_choice_model' def __ini...
gpl-2.0
ygorshenin/omim
tools/python/mwm/mwm_feature_compare.py
2
2663
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function from mwm import MWM import argparse import os import multiprocessing OMIM_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..') def count_feature(mwm_path, feature_name): mwm = MWM(open(mwm_path, 'rb...
apache-2.0
sicotronic/q-tetris_ia
system/codecs/Python/src/rlglue/agent/ClientAgent.py
3
4648
# # Copyright (C) 2007, Mark Lee # #http://rl-glue-ext.googlecode.com/ # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
gpl-2.0
ondra-novak/chromium.src
third_party/cython/src/Cython/Compiler/Tests/TestParseTreeTransforms.py
89
8720
import os from Cython.Compiler import CmdLine from Cython.TestUtils import TransformTest from Cython.Compiler.ParseTreeTransforms import * from Cython.Compiler.Nodes import * from Cython.Compiler import Main, Symtab class TestNormalizeTree(TransformTest): def test_parserbehaviour_is_what_we_coded_for(self): ...
bsd-3-clause
alihalabyah/flexx
docs/scripts/pyscriptexample.py
21
3927
""" Small sphinx extension to show PyScript code and corresponding JS. """ import os import hashlib from pygments import highlight from pygments.lexers import get_lexer_by_name from pygments.formatters import HtmlFormatter from sphinx.util.compat import Directive from docutils import nodes from flexx.pyscript impor...
bsd-2-clause
WangDequan/kaggle_diabetic
iterator.py
4
4124
import multiprocessing import threading import Queue from uuid import uuid4 import numpy as np import SharedArray import data def load_shared(args): i, array_name, fname, kwargs = args array = SharedArray.attach(array_name) array[i] = data.load_augment(fname, **kwargs) class BatchIterator(object): ...
mit
tlakshman26/cinder-https-changes
cinder/tests/unit/targets/test_iser_driver.py
20
3760
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
apache-2.0
sunyihuan326/DeltaLab
Andrew_NG_learning/class_two/week_one/testCases.py
1
4869
import numpy as np def compute_cost_with_regularization_test_case(): np.random.seed(1) Y_assess = np.array([[1, 1, 0, 1, 0]]) W1 = np.random.randn(2, 3) b1 = np.random.randn(2, 1) W2 = np.random.randn(3, 2) b2 = np.random.randn(3, 1) W3 = np.random.randn(1, 3) b3 = np.random.randn(1, 1)...
mit
cntnboys/410Lab6
build/django/build/lib.linux-x86_64-2.7/django/core/cache/backends/dummy.py
87
1284
"Dummy cache backend" from django.core.cache.backends.base import BaseCache, DEFAULT_TIMEOUT class DummyCache(BaseCache): def __init__(self, host, *args, **kwargs): BaseCache.__init__(self, *args, **kwargs) def add(self, key, value, timeout=DEFAULT_TIMEOUT, version=None): key = self.make_key...
apache-2.0
foobacca/django-cms
cms/plugins/utils.py
5
5643
from collections import defaultdict import operator from itertools import groupby from django.utils.translation import ugettext as _ from cms.exceptions import PluginLimitReached from cms.plugin_pool import plugin_pool from cms.utils import get_language_from_request from cms.utils.i18n import get_redirect_on_fallback...
bsd-3-clause
30loops/nova
nova/db/sqlalchemy/migrate_repo/versions/014_add_instance_type_id_to_instances.py
3
2945
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 OpenStack 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 # ...
apache-2.0
0111001101111010/open-health-inspection-api
venv/lib/python2.7/site-packages/pip/_vendor/html5lib/inputstream.py
168
30602
from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type import codecs import re from .constants import EOF, spaceCharacters, asciiLetters, asciiUppercase from .constants import encodings, ReparseException from . import utils from io import StringIO try: from io i...
gpl-2.0
entropy1337/infernal-twin
Modules/airgraph-ng/graphviz/libOuiParse.py
89
7562
#!/usr/bin/env python __author__ = 'Ben "TheX1le" Smith, Marfi' __email__ = 'thex1le@gmail.com' __website__= '' __date__ = '04/26/2011' __version__ = '2011.4.26' __file__ = 'ouiParse.py' __data__ = 'a class for dealing with the oui txt file' """ ######################################## # # This program and its support...
gpl-3.0
hkupty/python-mode
pymode/libs/pylama/lint/pylama_pylint/astroid/raw_building.py
17
13977
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of astroid. # # astroid 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 #...
lgpl-3.0
gustavo-guimaraes/siga
backend/appengine/lib/unidecode/x07b.py
252
4669
data = ( 'Mang ', # 0x00 'Zhu ', # 0x01 'Utsubo ', # 0x02 'Du ', # 0x03 'Ji ', # 0x04 'Xiao ', # 0x05 'Ba ', # 0x06 'Suan ', # 0x07 'Ji ', # 0x08 'Zhen ', # 0x09 'Zhao ', # 0x0a 'Sun ', # 0x0b 'Ya ', # 0x0c 'Zhui ', # 0x0d 'Yuan ', # 0x0e 'Hu ', # 0x0f 'Gang ', # 0x10 ...
mit
arenadata/ambari
ambari-server/src/main/resources/stacks/BigInsights/4.2/services/SLIDER/package/scripts/service_check.py
2
2065
#!/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 "License");...
apache-2.0
lukauskas/scipy
scipy/weave/__init__.py
92
1690
""" C/C++ integration ================= NOTE: this module is deprecated and will be removed from Scipy before the 1.0 release -- use the standalone weave package (`https://github.com/scipy/weave`_) instead. inline -- a function for including C/C++ code within Python blitz -- a function for co...
bsd-3-clause
dongjoon-hyun/DIGITS
tools/parse_folder.py
5
18647
#!/usr/bin/env python2 # Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. import argparse import logging import os import random import requests import re import sys import time import urllib # Add path for DIGITS package sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))...
bsd-3-clause
cactusbin/nyt
matplotlib/examples/animation/old_animation/histogram_tkagg.py
3
1847
""" This example shows how to use a path patch to draw a bunch of rectangles for an animated histogram """ import numpy as np import matplotlib matplotlib.use('TkAgg') # do this before importing pylab import matplotlib.pyplot as plt import matplotlib.patches as patches import matplotlib.path as path fig, ax = plt.sub...
unlicense
SebastianMerz/calalert
Server/venv/lib/python2.7/site-packages/flask/testsuite/views.py
57
4511
# -*- coding: utf-8 -*- """ flask.testsuite.views ~~~~~~~~~~~~~~~~~~~~~ Pluggable views. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import flask import flask.views import unittest from flask.testsuite import FlaskTestCase from werkzeug.http import pars...
gpl-2.0
gquirozbogner/contentbox-master
third_party/unidecode/x0b7.py
4
5091
data = ( 'ddwim', # 0x00 'ddwib', # 0x01 'ddwibs', # 0x02 'ddwis', # 0x03 'ddwiss', # 0x04 'ddwing', # 0x05 'ddwij', # 0x06 'ddwic', # 0x07 'ddwik', # 0x08 'ddwit', # 0x09 'ddwip', # 0x0a 'ddwih', # 0x0b 'ddyu', # 0x0c 'ddyug', # 0x0d 'ddyugg', # 0x0e 'ddyugs...
apache-2.0
wildchildyn/autism-website
yanni_env/lib/python3.6/site-packages/pkg_resources/_vendor/packaging/markers.py
228
8248
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. from __future__ import absolute_import, division, print_function import operator import os import platform import sys from pkg_resources.e...
gpl-3.0
Carmezim/tensorflow
tensorflow/python/kernel_tests/distributions/dirichlet_test.py
75
9551
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
ajventer/mirthless
src/lib/game.py
1
8107
from player import Player import os from util import gamedir, debug, load_yaml, file_path from tempsprites import Tempsprites from dialog import FloatDialog import pygame from pygame.locals import * from button import Button, Dropdown, render_text, Label, TextInput, BlitButton from item import Item from journal import ...
mit
openworm/PyOpenWorm
owmeta/data_trans/data_with_evidence_ds.py
1
4261
from rdflib.namespace import Namespace from ..context import Context from ..contextDataObject import ContextDataObject from ..datasource import Informational, DataSource from .. import CONTEXT from .common_data import DS_NS from .context_datasource import VariableIdentifierContext class DataWithEvidenceDataSource(Dat...
mit
JFriel/honours_project
networkx/networkx/linalg/algebraicconnectivity.py
10
17992
# -*- coding: utf-8 -*- """ Algebraic connectivity and Fiedler vectors of undirected graphs. """ __author__ = """ysitu <ysitu@users.noreply.github.com>""" # Copyright (C) 2014 ysitu <ysitu@users.noreply.github.com> # All rights reserved. # BSD license. from functools import partial import networkx as nx from networkx...
gpl-3.0
nharraud/invenio
invenio/testsuite/tester_utils_sherpa_romeo.py
19
5524
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2012, 2013 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
koyuawsmbrtn/eclock
windows/Python27/Lib/site-packages/docutils/transforms/references.py
113
36161
# $Id: references.py 7624 2013-03-07 14:10:26Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Transforms for resolving references. """ __docformat__ = 'reStructuredText' import sys import re from docutils import nodes, utils from docutils.trans...
gpl-2.0
JackDanger/sentry
tests/sentry/api/endpoints/test_organization_stats.py
3
2153
from __future__ import absolute_import import functools import sys from django.core.urlresolvers import reverse from sentry import tsdb from sentry.testutils import APITestCase class OrganizationStatsTest(APITestCase): def test_simple(self): self.login_as(user=self.user) org = self.create_orga...
bsd-3-clause
Parrot-Developers/ardupilot
mk/PX4/Tools/genmsg/src/genmsg/msg_loader.py
215
20479
# Software License Agreement (BSD License) # # Copyright (c) 2008, Willow Garage, 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...
gpl-3.0
Tk-Glitch/Glitch_Flo_AOSP
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py
11088
3246
# Core.py - Python extension for perf script, core functions # # Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com> # # This software may be distributed under the terms of the GNU General # Public License ("GPL") version 2 as published by the Free Software # Foundation. from collections import defaultdict def aut...
gpl-2.0
jackrzhang/zulip
zerver/webhooks/trello/view/card_actions.py
6
9738
from datetime import datetime from typing import Any, Dict, Mapping, MutableMapping, Optional, Tuple from .exceptions import UnknownUpdateCardAction SUPPORTED_CARD_ACTIONS = [ u'updateCard', u'createCard', u'addLabelToCard', u'removeLabelFromCard', u'addMemberToCard', u'removeMemberFromCard', ...
apache-2.0
xaxxon/v8-class-wrapper
googletest/googletest/test/gtest_throw_on_failure_test.py
2917
5766
#!/usr/bin/env python # # Copyright 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 list...
gpl-2.0
st135yle/django-site
dbenv/lib/python3.4/site-packages/django/contrib/gis/admin/options.py
47
5390
from django.contrib.admin import ModelAdmin from django.contrib.gis.admin.widgets import OpenLayersWidget from django.contrib.gis.db import models from django.contrib.gis.gdal import OGRGeomType spherical_mercator_srid = 3857 class GeoModelAdmin(ModelAdmin): """ The administration options class for Geographi...
mit
B1gtang/shadowsocks
shadowsocks/crypto/rc4_md5.py
26
1815
#!/usr/bin/env python # Copyright (c) 2014 clowwindy # # 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, me...
mit
tempbottle/rethinkdb
test/rql_test/connections/http_support/werkzeug/testsuite/contrib/cache.py
145
7212
# -*- coding: utf-8 -*- """ werkzeug.testsuite.cache ~~~~~~~~~~~~~~~~~~~~~~~~ Tests the cache system :copyright: (c) 2014 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import os import time import unittest import tempfile import shutil from werkzeug.testsuite import Werkzeug...
agpl-3.0
hartzis/py-fun
optimusprime.py
1
1852
#------------------------------------------------------------------------------- # Name: optimusPrime # Purpose: Figure out if a number is a prime # # Author: brian hartz # # Created: 18-11-2013 # Copyright: (c) brianhartz 2013 # Licence: <your licence> #---------------------------------------...
mit
da1z/intellij-community
python/lib/Lib/site-packages/django/core/serializers/base.py
108
5481
""" Module for abstract serializer/unserializer base classes. """ from StringIO import StringIO from django.db import models from django.utils.encoding import smart_str, smart_unicode from django.utils import datetime_safe class SerializationError(Exception): """Something bad happened during serialization.""" ...
apache-2.0
noirbizarre/bumpr
bumpr/version.py
1
1811
# -*- coding: utf-8 -*- from __future__ import unicode_literals import re class Version(object): MAJOR, MINOR, PATCH = range(3) PATTERN = re.compile(r'(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<suffix>[\w\d.]+))?') FORMAT = r'{major}.{minor}.{patch}' FORMAT_SUFFIXED = r'{major}.{minor}.{pa...
lgpl-3.0
tectronics/pytuio
tuio/observer.py
4
1376
class CursorEvent(object): def __init__(self, objeto, message): self.object = objeto.objects[message[3]] self.message = message def __str__(self): return str(self.object) class ObjectEvent(object): def __init__(self, objeto, message): self.object = objeto.objects[m...
mit
prampey/servo
tests/wpt/css-tests/tools/wptserve/tests/functional/test_handlers.py
293
9198
import json import os import unittest import urllib2 import uuid import wptserve from base import TestUsingServer, doc_root class TestFileHandler(TestUsingServer): def test_GET(self): resp = self.request("/document.txt") self.assertEquals(200, resp.getcode()) self.assertEquals("text/plain"...
mpl-2.0
JohnnyKing94/pootle
pootle/apps/pootle_fs/migrations/0001_initial.py
6
1612
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('pootle_project', '0004_correct_checkerstyle_options_order'), ('pootle_store', '0008_flush_django_cac...
gpl-3.0
ehenry2172/cfeedmon
worker/src/test.py
1
1831
import uuid from functools import partial import json import sys from posix_ipc import MessageQueue class RSSFeedMessagingInterface(object): def __init__(self, queue_name): self.message_queue = MessageQueue(queue_name) def send_whole(self, content): raw_request = { "id": str(uui...
mit
polyaxon/polyaxon
core/polyaxon/schemas/cli/proxies_config.py
1
7674
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, 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 ...
apache-2.0
chenchongli/kinetic-c
vendor/protobuf-2.6.0/examples/add_person.py
432
1656
#! /usr/bin/python # See README.txt for information and build instructions. import addressbook_pb2 import sys # This function fills in a Person message based on user input. def PromptForAddress(person): person.id = int(raw_input("Enter person ID number: ")) person.name = raw_input("Enter name: ") email = raw_...
mpl-2.0
bsipocz/astropy
astropy/timeseries/binned.py
4
15030
# Licensed under a 3-clause BSD style license - see LICENSE.rst from copy import deepcopy import numpy as np from astropy.table import groups, Table, QTable from astropy.time import Time, TimeDelta from astropy import units as u from astropy.units import Quantity from astropy.timeseries.core import BaseTimeSeries, ...
bsd-3-clause
sid-kap/pants
tests/python/pants_test/option/test_options_bootstrapper.py
5
7680
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import unittest from...
apache-2.0
fingthinking/pyspider
tests/data_handler.py
63
1319
#!/usr/bin/env python # -*- encoding: utf-8 -*- # vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8: # Author: Binux<i@binux.me> # http://binux.me # Created on 2014-02-22 14:02:21 from pyspider.libs.base_handler import BaseHandler, catch_status_code_error, every class IgnoreHandler(object): pass class TestHa...
apache-2.0
gennad/www_gennad_org
django/contrib/auth/backends.py
230
4582
from django.db import connection from django.contrib.auth.models import User, Permission class ModelBackend(object): """ Authenticates against django.contrib.auth.models.User. """ supports_object_permissions = False supports_anonymous_user = True supports_inactive_user = True # TODO: Mode...
bsd-3-clause
JonZeolla/incubator-metron
metron-deployment/packaging/ambari/metron-mpack/src/main/resources/common-services/METRON/CURRENT/package/scripts/alerts_ui_commands.py
9
2926
#!/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 "License");...
apache-2.0
afenkart/gcompris-devel
src/connect4-activity/connect4.py
1
13164
# gcompris - connect4 # # Copyright (C) 2005, 2008 Laurent Lacheny # # 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 ver...
gpl-2.0
ayoubg/gem5-graphics
gem5/src/arch/x86/isa/insts/x87/control/save_and_restore_x87_control_word.py
68
2493
# Copyright (c) 2007 The Hewlett-Packard Development Company # All rights reserved. # # The license below extends only to copyright in the software and shall # not be construed as granting a license to any other intellectual # property including but not limited to intellectual property relating # to a hardware implemen...
bsd-3-clause
salamer/django
django/core/cache/backends/locmem.py
586
4287
"Thread-safe in-memory cache backend." import time from contextlib import contextmanager from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache from django.utils.synch import RWLock try: from django.utils.six.moves import cPickle as pickle except ImportError: import pickle # Global in-memor...
bsd-3-clause
mheap/ansible
lib/ansible/modules/windows/win_package.py
15
9647
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2014, Trond Hindenes <trond@hindenes.com>, and others # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # this is a windows documentation stub. actual code lives in the .ps1 # file of the same name ANSIBLE_METADATA...
gpl-3.0
Ex-Mente/auxi.0
auxi/tools/chemistry/stoichiometry.py
1
16146
#!/usr/bin/env python3 """ This module provides a number of functions for doing stoichiometry calculations. """ import collections import functools import parsimonious from auxi.core.objects import Object __version__ = '0.3.6' __license__ = 'LGPL v3' __copyright__ = 'Copyright 2016, Ex Mente Technologies (Pty) Ltd...
lgpl-3.0
Dim0N22/rabbitmq-tutorials
test.py
18
4880
#!/usr/bin/env python import time import random import re import subprocess import signal import sys import os multiplier = float(os.environ.get('SLOWNESS', 1)) def run(cmd, **kwargs): p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIP...
apache-2.0
rdhyee/osf.io
tests/test_institution_model.py
2
2907
from nose.tools import * # flake8: noqa from tests.base import OsfTestCase from tests.factories import InstitutionFactory from website.models import Institution, Node class TestInstitution(OsfTestCase): def setUp(self): super(TestInstitution, self).setUp() self.institution = InstitutionFactory() ...
apache-2.0
AmericanResearchInstitute/poweru-server
pr_services/scorm_system/scorm_server.py
1
5379
from django.core.urlresolvers import reverse from django.template import Context, loader from django.http import HttpResponseBadRequest, HttpResponse, HttpResponseNotFound from pr_services import exceptions from pr_services.utils import Utils import datetime import settings import urllib import facade class ScormServe...
bsd-3-clause
PyGithub/PyGithub
github/StatsCommitActivity.py
2
3280
############################ Copyrights and license ############################ # # # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> # # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> ...
lgpl-3.0
kbrebanov/ansible
lib/ansible/utils/module_docs_fragments/sros.py
25
2887
# # (c) 2015, Peter Sprygada <psprygada@ansible.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) any late...
gpl-3.0
jotes/ansible
v2/ansible/constants.py
2
12771
# (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
pdonis/simpleblog
simpleblog/extensions/quote.py
1
1193
#!/usr/bin/env python """ Module QUOTE -- Simple Blog Quote Extension Sub-Package SIMPLEBLOG.EXTENSIONS Copyright (C) 2012-2013 by Peter A. Donis Released under the GNU General Public License, Version 2 See the LICENSE and README files for more information """ from urllib import quote_plus from urlparse import urljoi...
gpl-2.0
diegoguimaraes/django
django/db/backends/postgresql_psycopg2/operations.py
26
9837
from __future__ import unicode_literals from django.conf import settings from django.db.backends import BaseDatabaseOperations class DatabaseOperations(BaseDatabaseOperations): def __init__(self, connection): super(DatabaseOperations, self).__init__(connection) def date_extract_sql(self, lookup_type...
bsd-3-clause
crisely09/horton
horton/espfit/test/test_cost.py
1
15820
# -*- coding: utf-8 -*- # HORTON: Helpful Open-source Research TOol for N-fermion systems. # Copyright (C) 2011-2016 The HORTON Development Team # # This file is part of HORTON. # # HORTON is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by th...
gpl-3.0
UXE/local-edx
lms/djangoapps/instructor/views/api.py
1
80161
""" Instructor Dashboard API views JSON views which the instructor dashboard requests. Many of these GETs may become PUTs in the future. """ import StringIO import json import logging import re import time import requests from django.conf import settings from django_future.csrf import ensure_csrf_cookie from django.v...
agpl-3.0
andela-earinde/bellatrix-py
app/js/lib/lib/modules/httplib.py
2
48522
r"""HTTP/1.1 client library <intro stuff goes here> <other stuff, too> HTTPConnection goes through a number of "states", which define when a client may legally make another request or fetch the response for a particular request. This diagram details these state transitions: (null) | | HTTPConnection(...
mit
xavierwu/scikit-learn
examples/mixture/plot_gmm_classifier.py
250
3918
""" ================== GMM classification ================== Demonstration of Gaussian mixture models for classification. See :ref:`gmm` for more information on the estimator. Plots predicted labels on both training and held out test data using a variety of GMM classifiers on the iris dataset. Compares GMMs with sp...
bsd-3-clause
AndrewSmart/audacity
lib-src/lv2/lilv/waflib/Tools/c.py
329
1066
#! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file from waflib import TaskGen,Task,Utils from waflib.Tools import c_preproc from waflib.Tools.ccroot import link_task,stlink_task @TaskGen.extension('.c') def c_hook(self,node): ...
gpl-2.0
Windy-Ground/scikit-learn
benchmarks/bench_covertype.py
120
7381
""" =========================== Covertype dataset benchmark =========================== Benchmark stochastic gradient descent (SGD), Liblinear, and Naive Bayes, CART (decision tree), RandomForest and Extra-Trees on the forest covertype dataset of Blackard, Jock, and Dean [1]. The dataset comprises 581,012 samples. It ...
bsd-3-clause
brunobergher/dotfiles
sublime/pyyaml/st3/yaml/constructor.py
190
25554
__all__ = ['BaseConstructor', 'SafeConstructor', 'Constructor', 'ConstructorError'] from .error import * from .nodes import * import collections, datetime, base64, binascii, re, sys, types class ConstructorError(MarkedYAMLError): pass class BaseConstructor: yaml_constructors = {} yaml_multi_constr...
mit
teriyakichild/ansible-modules-extras
cloud/cloudstack/cs_domain.py
33
7788
#!/usr/bin/python # -*- coding: utf-8 -*- # # (c) 2015, René Moser <mail@renemoser.net> # # 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 Lice...
gpl-3.0
Jacques-Florence/schedSim
src/googletest/googlemock/scripts/generator/cpp/keywords.py
1157
2004
#!/usr/bin/env python # # Copyright 2007 Neal Norwitz # Portions 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...
bsd-3-clause
kamyu104/LeetCode
Python/longest-word-in-dictionary-through-deleting.py
2
1191
# Time: O((d * l) * logd), l is the average length of words # Space: O(1) # Given a string and a string dictionary, # find the longest string in the dictionary # that can be formed by deleting some characters of the given string. # If there are more than one possible results, # return the longest word with the smalle...
mit
pchauncey/ansible
test/units/modules/network/nxos/test_nxos_vxlan_vtep_vni.py
47
2464
# (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 dis...
gpl-3.0
njwilson23/scipy
scipy/_lib/_gcutils.py
114
2462
""" Module for testing automatic garbage collection of objects .. autosummary:: :toctree: generated/ set_gc_state - enable or disable garbage collection gc_state - context manager for given state of garbage collector assert_deallocated - context manager to check for circular references on object """ impo...
bsd-3-clause
lsaffre/lino
lino/modlib/forms/__init__.py
1
1132
# -*- coding: UTF-8 -*- # Copyright 2017 Rumma & Ko Ltd # License: BSD (see file COPYING for details) """ This started as a copy of :mod:`lino.modlib.bootstrap`. .. autosummary:: :toctree: views renderer models """ from lino.api.ad import Plugin class Plugin(Plugin): ui_handle_attr_name = 'for...
bsd-2-clause
praekelt/jmbo-music
test_settings.py
1
1829
# We're still on Django 1.4 and use django-setuptest. Use this as a starting # point for your test settings. Typically copy this file as test_settings.py # and replace myapp with your app name. from os.path import expanduser DEBUG = True DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql...
bsd-3-clause
dfc/beets
beetsplug/metasync/amarok.py
24
4001
# This file is part of beets. # Copyright 2015, Heinz Wiesinger. # # 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,...
mit
PythonNut/servo
tests/wpt/web-platform-tests/html/infrastructure/urls/resolving-urls/query-encoding/resources/resource.py
113
6305
import os import re def main(request, response): type = request.GET['type'] encoding = request.GET['encoding'] # We want the raw input for 'q' q = re.search(r'q=([^&]+)', request.url_parts.query).groups()[0] if type == 'html': return [("Content-Type", "text/html; charset=utf-8")], q eli...
mpl-2.0
darjeeling/django
django/contrib/gis/gdal/geometries.py
24
24886
""" The OGRGeometry is a wrapper for using the OGR Geometry class (see http://www.gdal.org/classOGRGeometry.html). OGRGeometry may be instantiated when reading geometries from OGR Data Sources (e.g. SHP files), or when given OGC WKT (a string). While the 'full' API is not present yet, the API is "pythonic" unlik...
bsd-3-clause
hmit/livestreamer
src/livestreamer/stream/akamaihd.py
37
7880
import base64 import io import hashlib import hmac import random from .stream import Stream from .wrappers import StreamIOThreadWrapper, StreamIOIterWrapper from ..buffers import Buffer from ..compat import str, bytes, urlparse from ..exceptions import StreamError from ..utils import swfdecompress from ..packages.fl...
bsd-2-clause
nzjrs/conduit
tools/test-db-wrapper/main.py
2
6409
#!/usr/bin/env python import sys import os.path import tempfile import gtk import pango import random import traceback import thread import getopt import conduit from conduit.Database import GenericDB,ThreadSafeGenericDB from conduit.gtkui.Database import GenericDBListStore class Tester(object): def __init__(sel...
gpl-2.0
safwanrahman/kuma
kuma/wiki/views/utils.py
6
2370
# -*- coding: utf-8 -*- from datetime import datetime import newrelic.agent from kuma.core.cache import memcache from ..constants import DOCUMENT_LAST_MODIFIED_CACHE_KEY_TMPL from ..models import Document def split_slug(slug): """ Utility function to do basic slug splitting """ slug_split = slug.sp...
mpl-2.0
ivandevp/django
tests/many_to_one/tests.py
81
30374
import datetime from copy import deepcopy from django.core.exceptions import FieldError, MultipleObjectsReturned from django.db import models, transaction from django.test import TestCase from django.utils import six from django.utils.translation import ugettext_lazy from .models import ( Article, Category, Child...
bsd-3-clause
michalliu/OpenWrt-Firefly-Libraries
staging_dir/host/lib/python3.4/test/test_genexps.py
97
7286
doctests = """ Test simple loop with conditional >>> sum(i*i for i in range(100) if i&1 == 1) 166650 Test simple nesting >>> list((i,j) for i in range(3) for j in range(4) ) [(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 1), (2, 2), (2, 3)] Test nesting with the inner ...
gpl-2.0
msmolens/VTK
Imaging/Core/Testing/Python/TestShiftScale.py
20
1291
#!/usr/bin/env python import vtk from vtk.test import Testing from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # Shift and scale an image (in that order) # This filter is useful for converting to a lower precision data type. reader = vtk.vtkImageReader() reader.GetExecutive().SetReleaseDataFla...
bsd-3-clause
trishnaguha/ansible
lib/ansible/module_utils/utm_utils.py
44
10446
# 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
Qalthos/ansible
test/units/modules/network/cnos/test_cnos_command.py
45
4330
# Copyright (C) 2017 Lenovo, 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. # # Ansi...
gpl-3.0