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
johndpope/tensorflow
tensorflow/contrib/sparsemax/python/ops/sparsemax.py
104
2649
# 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
jayceyxc/hue
desktop/libs/hadoop/src/hadoop/fs/webhdfs_types.py
9
3011
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ma...
apache-2.0
syphar/django
django/templatetags/tz.py
57
5411
from datetime import datetime, tzinfo import pytz from django.template import Library, Node, TemplateSyntaxError from django.utils import six, timezone register = Library() # HACK: datetime is an old-style class, create a new-style equivalent # so we can define additional attributes. class datetimeobject(datetime,...
bsd-3-clause
javachengwc/hue
desktop/core/ext-py/MySQL-python-1.2.5/MySQLdb/converters.py
76
5312
"""MySQLdb type conversion module This module handles all the type conversions for MySQL. If the default type conversions aren't what you need, you can make your own. The dictionary conversions maps some kind of type to a conversion function which returns the corresponding value: Key: FIELD_TYPE.* (from MySQLd...
apache-2.0
simongoffin/website_version
addons/l10n_fr_rib/__openerp__.py
425
2754
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2011 Numérigraphe SARL. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero Genera...
agpl-3.0
barachka/odoo
addons/payment_paypal/models/res_company.py
422
1752
# -*- coding: utf-8 -*- from openerp.osv import fields, osv class ResCompany(osv.Model): _inherit = "res.company" def _get_paypal_account(self, cr, uid, ids, name, arg, context=None): Acquirer = self.pool['payment.acquirer'] company_id = self.pool['res.users'].browse(cr, uid, uid, context=co...
agpl-3.0
sdgdsffdsfff/jumpserver
apps/settings/signals_handler.py
1
3398
# -*- coding: utf-8 -*- # import json from django.dispatch import receiver from django.db.models.signals import post_save, pre_save from django.conf import LazySettings, empty, global_settings from django.db.utils import ProgrammingError, OperationalError from django.core.cache import cache from jumpserver.utils impo...
gpl-2.0
damirda/ansible-modules-core
cloud/openstack/_quantum_floating_ip_associate.py
41
8255
#!/usr/bin/python #coding: utf-8 -*- # (c) 2013, Benno Joy <benno@ansible.com> # # This module 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 ...
gpl-3.0
deedwar/kernel_sony_msm8x60
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py
12527
1935
# Util.py - Python extension for perf script, miscellaneous utility code # # 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. import errno, os FUTEX_WAIT = 0...
gpl-2.0
chiragjogi/odoo
addons/edi/__init__.py
437
1157
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Business Applications # Copyright (c) 2011 OpenERP S.A. <http://openerp.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GN...
agpl-3.0
solin319/incubator-mxnet
example/image-classification/benchmark.py
46
11905
# 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
tanmaykm/edx-platform
lms/djangoapps/course_api/tests/test_permissions.py
61
1738
""" Test authorization functions """ from django.contrib.auth.models import AnonymousUser from django.test import TestCase from .mixins import CourseApiFactoryMixin from ..permissions import can_view_courses_for_username class ViewCoursesForUsernameTestCase(CourseApiFactoryMixin, TestCase): """ Verify func...
agpl-3.0
tylertian/Openstack
openstack F/nova/nova/volume/netapp_nfs.py
7
10177
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2012 NetApp, 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.or...
apache-2.0
leiferikb/bitpop
src/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/breakpad/dump_reader_multipart.py
1
6171
# Copyright (C) 2013 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-3.0
marcelocure/django
django/utils/crypto.py
452
6878
""" Django's standard crypto functions and utilities. """ from __future__ import unicode_literals import binascii import hashlib import hmac import random import struct import time from django.conf import settings from django.utils import six from django.utils.encoding import force_bytes from django.utils.six.moves i...
bsd-3-clause
GheRivero/ansible
lib/ansible/modules/database/mongodb/mongodb_user.py
25
15355
#!/usr/bin/python # (c) 2012, Elliott Foster <elliott@fourkitchens.com> # Sponsored by Four Kitchens http://fourkitchens.com. # (c) 2014, Epic Games, Inc. # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __m...
gpl-3.0
Fydot/tornado
tornado/test/testing_test.py
144
7361
#!/usr/bin/env python from __future__ import absolute_import, division, print_function, with_statement from tornado import gen, ioloop from tornado.log import app_log from tornado.testing import AsyncTestCase, gen_test, ExpectLog from tornado.test.util import unittest import contextlib import os import traceback @...
apache-2.0
TomAugspurger/pandas
pandas/tests/indexes/datetimes/test_to_period.py
1
6562
import warnings import dateutil.tz from dateutil.tz import tzlocal import pytest import pytz from pandas._libs.tslibs.ccalendar import MONTHS from pandas._libs.tslibs.frequencies import INVALID_FREQ_ERR_MSG from pandas import ( DatetimeIndex, Period, PeriodIndex, Timestamp, date_range, period...
bsd-3-clause
xguse/bioconda-recipes
recipes/mz_to_sqlite/mz_to_sqlite.py
60
3265
#!/usr/bin/env python # # Wrapper script for Java Conda packages that ensures that the java runtime # is invoked with the right options. Adapted from the bash script (http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128). # # Program Parameters # import os import s...
mit
persandstrom/home-assistant
homeassistant/components/notify/xmpp.py
1
4055
""" Jabber (XMPP) notification service. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/notify.xmpp/ """ import logging import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant.components.notify import ( ATTR_...
apache-2.0
lindamar/ecclesi
ecclesi-web/app/mod_auth/controllers.py
1
1990
# Importar las dependencias de flask from flask import Blueprint, request, render_template, flash, g, session, redirect, url_for # Importar clave/ayudantes de encriptacion from werkzeug import check_password_hash, generate_password_hash # Importar FireBase from firebase import firebase # Importar el objeto de base d...
mit
frsong/pycog
paper/fig1a.py
2
1718
#! /usr/bin/env python from __future__ import division import cPickle as pickle import imp from os.path import join import numpy as np from pycog import RNN from pycog.figtools import gradient, mpl, Figure from pycog.utils import get_here, get_parent from examples.analysis import rdm import pap...
mit
Mozhuowen/brython
www/src/Lib/importlib/__init__.py
12
3479
"""A pure Python implementation of import.""" __all__ = ['__import__', 'import_module', 'invalidate_caches'] # Bootstrap help ##################################################### # Until bootstrapping is complete, DO NOT import any modules that attempt # to import importlib._bootstrap (directly or indirectly). Since...
bsd-3-clause
cwisecarver/osf.io
addons/googledrive/migrations/0001_initial.py
28
1585
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2017-03-23 20:34 from __future__ import unicode_literals from django.db import migrations, models import osf.models.base import osf.utils.datetime_aware_jsonfield class Migration(migrations.Migration): initial = True dependencies = [ ] operation...
apache-2.0
chusine/dlnd
seq2seq/helper.py
154
1381
import os def load_data(path): input_file = os.path.join(path) with open(input_file, "r", encoding='utf-8', errors='ignore') as f: data = f.read() return data def extract_vocab(data): special_words = ['<pad>', '<unk>', '<s>', '<\s>'] set_words = set([word for line in data.split('\n') ...
mit
ppiecuch/CocosBuilder
CocosBuilder/libs/nodejs/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py
47
88398
# Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Notes: # # This is all roughly based on the Makefile system used by the Linux # kernel, but is a non-recursive make -- we put the entire dependency # graph in fr...
mit
sklnet/openatv-enigma2
lib/python/Plugins/SystemPlugins/CableScan/plugin.py
57
10276
from enigma import eCableScan, eDVBFrontendParametersCable, eTimer from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Plugins.Plugin import PluginDescriptor from Components.Label import Label from Components.ActionMap import ActionMap from Components.NimManager import nimmanager from Comp...
gpl-2.0
hlin117/scikit-learn
sklearn/feature_selection/tests/test_mutual_info.py
30
6881
from __future__ import division import numpy as np from numpy.testing import run_module_suite from scipy.sparse import csr_matrix from sklearn.utils.testing import (assert_array_equal, assert_almost_equal, assert_false, assert_raises, assert_equal, ...
bsd-3-clause
skirpichev/omg
diofant/polys/solvers.py
1
1233
"""Low-level linear systems solver.""" from ..matrices import Matrix, zeros class RawMatrix(Matrix): """Dummy class with overriden sympify() helper.""" _sympify = staticmethod(lambda x: x) def eqs_to_matrix(eqs, ring): """Transform from equations to matrix form.""" m = zeros(len(eqs), len(ring.gen...
bsd-3-clause
open-o/nfvo
lcm/lcm/ns/tests/sfcs/test_create_flow_classifier.py
1
2168
# Copyright 2016 ZTE Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
apache-2.0
mvaled/OpenUpgrade
addons/l10n_be/__openerp__.py
9
3667
# -*- 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
nvoron23/gensim
ez_setup.py
86
12155
#!python """Bootstrap setuptools installation If you want to use setuptools in your package's setup.py, just include this file in the same directory with it, and add this to the top of your setup.py:: from ez_setup import use_setuptools use_setuptools() If you want to require a specific version of setuptools...
lgpl-3.0
13k/pygmentize
vendor/pygments/lexers/asm.py
72
11831
# -*- coding: utf-8 -*- """ pygments.lexers.asm ~~~~~~~~~~~~~~~~~~~ Lexers for assembly languages. :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.lexer import RegexLexer, include, bygroups, using, DelegatingL...
mit
armicron/django-allauth
allauth/utils.py
5
6768
import re import unicodedata import json from django.core.exceptions import ImproperlyConfigured from django.core.validators import validate_email, ValidationError from django.core import urlresolvers from django.db.models import FieldDoesNotExist from django.db.models.fields import (DateTimeField, DateField, ...
mit
fernandog/Medusa
ext/subliminal/converters/addic7ed.py
63
1734
# -*- coding: utf-8 -*- from babelfish import LanguageReverseConverter, language_converters class Addic7edConverter(LanguageReverseConverter): def __init__(self): self.name_converter = language_converters['name'] self.from_addic7ed = {u'Català': ('cat',), 'Chinese (Simplified)': ('zho',), 'Chinese...
gpl-3.0
EnviroCentre/jython-upgrade
jython/lib/distutils/command/upload.py
176
7002
"""distutils.command.upload Implements the Distutils 'upload' subcommand (upload package to PyPI).""" import os import socket import platform from urllib2 import urlopen, Request, HTTPError from base64 import standard_b64encode import urlparse import cStringIO as StringIO from hashlib import md5 from distutils.errors...
mit
citrix-openstack-build/nova
nova/virt/xenapi/vif.py
10
6560
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2011 Citrix Systems, Inc. # Copyright 2011 OpenStack Foundation # Copyright (C) 2011 Nicira, 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...
apache-2.0
kimiyoung/review_net
image_caption_offline/eval/neuraltalk2/coco-caption/pycocotools/coco.py
2
15410
__author__ = 'tylin' __version__ = '1.0.1' # Interface for accessing the Microsoft COCO dataset. # Microsoft COCO is a large image dataset designed for object detection, # segmentation, and caption generation. pycocotools is a Python API that # assists in loading, parsing and visualizing the annotations in COCO. # Ple...
mit
zhangpanrobot/myblog
node_modules/grunt-docker/node_modules/docker/node_modules/pygmentize-bundled/vendor/pygments/build-3.3/pygments/lexers/sql.py
94
23454
# -*- coding: utf-8 -*- """ pygments.lexers.sql ~~~~~~~~~~~~~~~~~~~ Lexers for various SQL dialects and related interactive sessions. Postgres specific lexers: `PostgresLexer` A SQL lexer for the PostgreSQL dialect. Differences w.r.t. the SQL lexer are: - keywords and dat...
mit
Relrin/aiorest-ws
tests/utils/date/test_timezone.py
1
5012
# -*- coding: utf-8 -*- import pytest import datetime as dt from aiorest_ws.conf import settings from aiorest_ws.utils.date.timezone import UTC, ZERO, FixedOffset, \ get_fixed_timezone, get_default_timezone, get_current_timezone, \ get_current_timezone_name, localtime, now, is_aware, is_naive, \ make_aware...
bsd-3-clause
tensor-tang/Paddle
python/paddle/dataset/tests/test_sentiment.py
5
2044
# /usr/bin/env python # -*- coding:utf-8 -*- # Copyright (c) 2016 PaddlePaddle 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/lice...
apache-2.0
skg-net/ansible
lib/ansible/modules/cloud/openstack/os_port.py
30
11492
#!/usr/bin/python # Copyright (c) 2015 Hewlett-Packard Development Company, L.P. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
gpl-3.0
kigawas/shadowsocks
shadowsocks/common.py
22
9410
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2013-2015 clowwindy # # 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 requi...
apache-2.0
SlimRoms/kernel_htc_msm8994
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
simone/django-gb
django/contrib/sessions/middleware.py
70
2090
from importlib import import_module import time from django.conf import settings from django.utils.cache import patch_vary_headers from django.utils.http import cookie_date class SessionMiddleware(object): def __init__(self): engine = import_module(settings.SESSION_ENGINE) self.SessionStore = eng...
bsd-3-clause
jeremiahyan/odoo
addons/membership/tests/common.py
4
1032
# -*- coding: utf-8 -*- import datetime from dateutil.relativedelta import relativedelta from odoo.addons.account.tests.common import AccountTestInvoicingCommon class TestMembershipCommon(AccountTestInvoicingCommon): @classmethod def setUpClass(cls, chart_template_ref=None): super().setUpClass(char...
gpl-3.0
Darkmer/masterchief
CourseBuilderenv/lib/python2.7/site-packages/setuptools/command/install.py
5
4506
import setuptools import inspect import glob import warnings import platform from distutils.command.install import install as _install from distutils.errors import DistutilsArgError class install(_install): """Use easy_install to install the package, w/dependencies""" user_options = _install.user_options + [ ...
mit
lowitty/server
libsDarwin/twisted/runner/inetd.py
67
1968
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # """ Twisted inetd. Maintainer: Andrew Bennetts Future Plans: Bugfixes. Specifically for UDP and Sun-RPC, which don't work correctly yet. """ import os from twisted.internet import process, reactor, fdesc from twisted.internet.protocol imp...
mit
ErnieAllen/qpid-dispatch
tests/system_tests_priority.py
1
18349
# # 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...
apache-2.0
Dunkas12/BeepBoopBot
lib/pip/req/req_uninstall.py
510
6897
from __future__ import absolute_import import logging import os import tempfile from pip.compat import uses_pycache, WINDOWS, cache_from_source from pip.exceptions import UninstallationError from pip.utils import rmtree, ask, is_local, renames, normalize_path from pip.utils.logging import indent_log logger = loggin...
gpl-3.0
dhruvagarwal/django
django/forms/formsets.py
362
17988
from __future__ import unicode_literals from django.core.exceptions import ValidationError from django.forms import Form from django.forms.fields import BooleanField, IntegerField from django.forms.utils import ErrorList from django.forms.widgets import HiddenInput from django.utils import six from django.utils.encodi...
bsd-3-clause
saurabh6790/pow-app
selling/doctype/sales_order/templates/pages/order.py
21
1086
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import webnotes from webnotes import _ no_cache = True def get_context(): from portal.utils import get_transaction_context context = get_transact...
agpl-3.0
mbauskar/tele-erpnext
erpnext/templates/pages/user.py
38
1214
# 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 from frappe import _ from frappe.utils import cstr from erpnext.shopping_cart.cart import get_lead_or_customer no_cache = 1 no_sitemap = ...
agpl-3.0
eddiel/Play
gluon/contrib/pysimplesoap/simplexml.py
32
19730
#!/usr/bin/python # -*- coding: utf-8 -*- # This program 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 3, or (at your option) any later # version. # # This program is distributed in the...
gpl-2.0
geopython/GeoHealthCheck
docker/config_site.py
1
4086
# ================================================================= # # Authors: Tom Kralidis <tomkralidis@gmail.com> # # Copyright (c) 2014 Tom Kralidis # # 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 ...
mit
adelina-t/neutron
neutron/callbacks/manager.py
23
6570
# 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
weimingtom/python-for-android
python-modules/twisted/twisted/conch/error.py
60
2677
# Copyright (c) 2001-2008 Twisted Matrix Laboratories. # See LICENSE for details. """ An error to represent bad things happening in Conch. Maintainer: Paul Swartz """ from twisted.cred.error import UnauthorizedLogin class ConchError(Exception): def __init__(self, value, data = None): Exception.__init_...
apache-2.0
nitzmahone/ansible
lib/ansible/modules/windows/win_stat.py
28
8215
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2017, Ansible Project # 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 = {'metadata_version': '1.1', ...
gpl-3.0
chrK/wget-url-crawler
wget-url-crawler.py
1
2704
#!/usr/bin/python # -*- coding: utf-8 -*- import sys, os, csv import xlsxwriter def main(argv): if len(argv) < 2: print("You need to give me a domain to crawl.") exit() domain_name = argv[1] os.system('wget -r %s' % argv[1]) # Set the directory you want to start from root_dir = ...
bsd-2-clause
v4nz666/7drl2017
RoguePy/UI/UI.py
1
1493
''' Documentation, License etc. @package RoguePy ''' import os import sys from RoguePy.libtcod import libtcod class UI: _path = '' def __init__(self): self._rootPath = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) self._font = self._rootPath + b'/libtcod/dundalk12x12_gs_tc.png'#lucida10x1...
gpl-3.0
AnishShah/tensorflow
tensorflow/contrib/learn/python/learn/graph_actions_test.py
1
26395
# 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
harmy/kbengine
kbe/src/lib/python/Tools/scripts/mailerdaemon.py
97
8039
#!/usr/bin/env python3 """Classes to parse mailer-daemon messages.""" import calendar import email.message import re import os import sys class Unparseable(Exception): pass class ErrorMessage(email.message.Message): def __init__(self): email.message.Message.__init__(self) self.sub = '' ...
lgpl-3.0
fpeyre/shinken
shinken/misc/md5crypt.py
19
4073
######################################################### # md5crypt.py # # 0423.2000 by michal wallace http://www.sabren.com/ # based on perl's Crypt::PasswdMD5 by Luis Munoz (lem@cantv.net) # based on /usr/src/libcrypt/crypt.c from FreeBSD 2.2.5-RELEASE # # MANY THANKS TO # # Carey Evans - http://home.clear.net.nz/p...
agpl-3.0
ghedsouza/django
tests/auth_tests/urls_deprecated.py
51
2450
from django.conf.urls import url from django.contrib import admin from django.contrib.auth import views from django.contrib.auth.decorators import login_required # special urls for deprecated function-based views urlpatterns = [ url(r'^login/$', views.login, name='login'), url(r'^logout/$', views.logout, name=...
bsd-3-clause
mistio/libcloud
libcloud/common/onapp.py
6
2132
# 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
archesproject/arches
arches/management/commands/load_ontology.py
1
8828
""" ARCHES - a program developed to inventory and manage immovable cultural heritage. Copyright (C) 2013 J. Paul Getty Trust and World Monuments Fund This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Founda...
agpl-3.0
haphaeu/yoshimi
EulerProject/057.py
1
1302
''' Project Euler - Problem 57 It is possible to show that the square root of two can be expressed as an infinite continued fraction. 2 = 1 + 1/(2 + 1/(2 + 1/(2 + ... ))) = 1.414213... By expanding this for the first four iterations, we get: 1 + 1/2 = 3/2 = 1.5 1 + 1/(2 + 1/2) = 7/5 = 1.4 1 + 1/(2 + 1/(2 + 1/2)) = 17...
lgpl-3.0
summanlp/gensim
gensim/test/test_parsing.py
1
3144
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Automated tests for the parsing module. """ import logging import unittest import numpy as np from gensim.parsing.preprocessing import remove_stopwords, strip_punctuation2, strip_tags, strip_short, strip_numeric, strip_non_alphanum, strip_multiple_whitespaces, split_a...
lgpl-2.1
hgl888/chromium-crosswalk
tools/telemetry/telemetry/core/platform/android_action_runner.py
10
6080
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import logging import time from telemetry.core import util class ActionNotSupported(Exception): pass class AndroidActionRunner(object): """Provides a...
bsd-3-clause
prarthitm/edxplatform
lms/djangoapps/course_api/permissions.py
85
1125
""" Course API Authorization functions """ from student.roles import GlobalStaff def can_view_courses_for_username(requesting_user, target_username): """ Determine whether `requesting_user` has permission to view courses available to the user identified by `target_username`. Arguments: reque...
agpl-3.0
tequa/ammisoft
ammimain/WinPython-64bit-2.7.13.1Zero/python-2.7.13.amd64/Lib/site-packages/jedi/evaluate/jedi_typing.py
21
2563
""" This module is not intended to be used in jedi, rather it will be fed to the jedi-parser to replace classes in the typing module """ try: from collections import abc except ImportError: # python 2 import collections as abc def factory(typing_name, indextypes): class Iterable(abc.Iterable): ...
bsd-3-clause
Brother-Simon/AutobahnTestSuite
autobahntestsuite/autobahntestsuite/case/case9_3_6.py
14
1253
############################################################################### ## ## Copyright 2011 Tavendo GmbH ## ## 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
SergiuTudos/Selenium2Library
test/unit/keywords/test_keyword_arguments_alert.py
1
1776
import unittest from mockito import when, mock, verify, unstub from Selenium2Library.keywords import AlertKeywords TRUES = ['True', True, '1', 1, 'text'] FALSES = ['False', False, '', None, 'NONE'] class KeywordArgumentsAlertTest(unittest.TestCase): @classmethod def setUpClass(self): self.alert =...
apache-2.0
z/xonotic-map-repository
bin/xmr/entities.py
1
7870
import json import re from xmr.util import * def parse_entity_file(entities_file): f = open(entities_file, 'r') file_data = f.read() f.close() # Turn it into JSON file_data = re.sub(r'(".*") (".*")', r'\1: \2,', file_data) file_data = re.sub(r'(".*": ".*"),\n}', r'\1\n},', file_data) fil...
mit
faassen/morepath
morepath/traject.py
1
17916
"""Implementation of routing. The idea is to turn the routes into a tree, so that the routes:: a/b a/b/c a/d become a tree like this:: a b b c d Nodes in the tree can have a value attached that can be found through routing; in Morepath the value is a model instance factory. When presente...
bsd-3-clause
18padx08/PPTex
PPTexEnv_x86_64/lib/python2.7/site-packages/scipy/io/arff/arffread.py
7
21661
#! /usr/bin/env python # Last Change: Mon Aug 20 08:00 PM 2007 J from __future__ import division, print_function, absolute_import import re import itertools import datetime from functools import partial import numpy as np from scipy.lib.six import next """A module to read arff files.""" __all__ = ['MetaData', 'loa...
mit
hkdahal/DevelopersShelf
hkplayer/viewsAPI.py
1
2238
from django.shortcuts import get_object_or_404 from rest_framework import generics, mixins, viewsets from rest_framework.decorators import detail_route from rest_framework.response import Response from . import models from . import serializers class ListCreateMovie(generics.ListCreateAPIView): queryset = models...
mit
jrcbriggs/srgp
SRGP/test_uploader.py
1
6244
''' Created on 30 Nov 2014 @author: julian ''' from base64 import b64encode, b64decode import json import unittest from unittest.mock import MagicMock from uploader import Uploader import uploader class Test(unittest.TestCase): def setUp(self): self.endpoint = '/api/v1/imports' self.headers = {...
gpl-2.0
trungnt13/scikit-learn
examples/neighbors/plot_approximate_nearest_neighbors_scalability.py
225
5719
""" ============================================ Scalability of Approximate Nearest Neighbors ============================================ This example studies the scalability profile of approximate 10-neighbors queries using the LSHForest with ``n_estimators=20`` and ``n_candidates=200`` when varying the number of sa...
bsd-3-clause
mdanielwork/intellij-community
python/lib/Lib/string.py
92
16675
"""A collection of string operations (most are no longer used). Warning: most of the code you see here isn't normally used nowadays. Beginning with Python 1.6, many of these functions are implemented as methods on the standard string object. They used to be implemented by a built-in module called strop, but strop is n...
apache-2.0
albertomurillo/ansible
test/units/modules/network/f5/test_bigip_device_auth.py
37
4184
# -*- coding: utf-8 -*- # # Copyright: (c) 2018, F5 Networks Inc. # GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import json import pytest import sys if sys.version_info < (2...
gpl-3.0
mglukhikh/intellij-community
python/helpers/pycharm/teamcity/flake8_v3_plugin.py
12
1916
import re from io import BytesIO from flake8.formatting import base from teamcity.messages import TeamcityServiceMessages from teamcity import __version__, is_running_under_teamcity class TeamcityReport(base.BaseFormatter): name = 'teamcity-messages' version = __version__ options_added = False @cl...
apache-2.0
xq262144/hue
desktop/core/ext-py/Django-1.6.10/django/conf/locale/nb/formats.py
118
1763
# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'j. F Y' TIME_FORMAT = 'H:i' DATET...
apache-2.0
defionscode/ansible-modules-core
cloud/docker/docker_image.py
14
21487
#!/usr/bin/python # # Copyright 2016 Red Hat | Ansible # # 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 la...
gpl-3.0
desihub/desispec
py/desispec/test/test_ql.py
1
9261
""" Test capabilities of QuickLook pipeline python -m desispec.test.test_ql """ import os, sys import shutil from uuid import uuid4 import unittest import yaml import numpy as np from desispec.util import runcmd from desispec.io.raw import write_raw from desispec.io import empty_fibermap from desispec.io.fibermap imp...
bsd-3-clause
damiansoriano/odoo
addons/account/report/account_partner_ledger.py
81
13063
# -*- 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
KennethPierce/pylearnk
pylearn2/packaged_dependencies/theano_linear/spconv.py
5
22522
""" Convolution-like operations with sparse matrix multiplication. To read about different sparse formats, see U{http://www-users.cs.umn.edu/~saad/software/SPARSKIT/paper.ps}. @todo: Automatic methods for determining best sparse format? """ #### COPIED FROM hpu/icml09/sp.py import logging import numpy from scipy imp...
bsd-3-clause
antidata/htmengine-traffic-tutorial
python-engine/create_cpu_percent_model.py
11
1458
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2015, Numenta, Inc. Unless you have purchased from # Numenta, Inc. a separate commercial license for this software code, the # following terms and conditio...
gpl-3.0
jonyroda97/redbot-amigosprovaveis
lib/numpy/core/tests/test_scalarmath.py
9
25033
from __future__ import division, absolute_import, print_function import sys import warnings import itertools import operator import numpy as np from numpy.testing.utils import _gen_alignment_data from numpy.testing import ( TestCase, run_module_suite, assert_, assert_equal, assert_raises, assert_almost_equal,...
gpl-3.0
eino-makitalo/odoo
addons/email_template/html2text.py
440
14143
#!/usr/bin/env python """html2text: Turn HTML into equivalent Markdown-structured text.""" __version__ = "2.36" __author__ = "Aaron Swartz (me@aaronsw.com)" __copyright__ = "(C) 2004-2008 Aaron Swartz. GNU GPL 3." __contributors__ = ["Martin 'Joey' Schulze", "Ricardo Reyes", "Kevin Jay North"] # TODO: # Support deco...
agpl-3.0
bq/bitbloq-offline
app/res/web2board/linux32/res/Scons/sconsFiles/SCons/Conftest.py
12
28164
"""SCons.Conftest Autoconf-like configuration support; low level implementation of tests. """ # # Copyright (c) 2003 Stichting NLnet Labs # Copyright (c) 2001, 2002, 2003 Steven Knight # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation file...
gpl-3.0
e-koch/FilFinder
fil_finder/tests/test_input_types.py
1
2778
# Licensed under an MIT open source license - see LICENSE import pytest import numpy as np import numpy.testing as npt import astropy.units as u from astropy.io.fits import PrimaryHDU try: from spectral_cube import Projection, Slice SPECTRALCUBE_INSTALL = True except ImportError: SPECTRALCUBE_INSTALL = F...
mit
yash-nisar/coala-bears
tests/haskell/HaskellLintBearTest.py
4
2019
from queue import Queue from bears.haskell.HaskellLintBear import HaskellLintBear from coalib.testing.LocalBearTestHelper import LocalBearTestHelper from coalib.testing.BearTestHelper import generate_skip_decorator from coalib.settings.Section import Section good_single_line_file = """ myconcat = (++) """.splitlines...
agpl-3.0
jfpla/odoo
addons/account_accountant/__openerp__.py
313
1878
# -*- 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
40023154/2015cd_midterm
static/Brython3.1.1-20150328-091302/Lib/unittest/test/test_case.py
738
51689
import difflib import pprint import pickle import re import sys import warnings import weakref import inspect from copy import deepcopy from test import support import unittest from .support import ( TestEquality, TestHashing, LoggingResult, ResultWithNoStartTestRunStopTestRun ) class Test(object): "Ke...
gpl-2.0
juanique/django-tastytools
tastytools/resources.py
6
8940
from tastypie.resources import Resource as TastyResource from tastypie.resources import ModelResource as TastyModelResource from django.conf.urls.defaults import url from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from tastytools import fields from test.resources import TestData from djan...
bsd-3-clause
binux/pyspider
pyspider/libs/dataurl.py
77
1318
#!/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 2012-11-16 10:33:20 import six from base64 import b64encode, b64decode from . import utils from six.moves.urllib.parse import quote, unquote def encode(d...
apache-2.0
mKeRix/home-assistant
homeassistant/components/nut/const.py
3
7850
"""The nut component.""" from homeassistant.components.sensor import ( DEVICE_CLASS_BATTERY, DEVICE_CLASS_POWER, DEVICE_CLASS_TEMPERATURE, ) from homeassistant.const import ( ELECTRICAL_CURRENT_AMPERE, ELECTRICAL_VOLT_AMPERE, FREQUENCY_HERTZ, POWER_WATT, TEMP_CELSIUS, TIME_SECONDS, ...
mit
globau/servo
components/script/dom/bindings/codegen/parser/tests/test_typedef.py
154
1880
def WebIDLTest(parser, harness): parser.parse(""" typedef long mylong; typedef long? mynullablelong; interface Foo { const mylong X = 5; const mynullablelong Y = 7; const mynullablelong Z = null; void foo(mylong arg); }; """) results = parser.finish()...
mpl-2.0
QTek/QRadio
stations/threatcrowd/station.py
1
7789
################################################################# # Threatcrowd station for QRadio # # ~ Tune In # # Tuned to: # # http://www.threatcrowd.org/ API v2 ...
apache-2.0