repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
alexlo03/ansible | lib/ansible/modules/network/cloudengine/ce_netstream_template.py | 43 | 15753 | #!/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 distribut... | gpl-3.0 |
lmorchard/django-teamwork | teamwork/templatetags/teamwork_tags.py | 1 | 3741 | """
``django-teamwork`` template tags, loaded like so:
{% load teamwork_tags %}
"""
from __future__ import unicode_literals
from django import template
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, AnonymousUser
from django.template import get_library
from django.temp... | mpl-2.0 |
zycdragonball/tensorflow | tensorflow/contrib/crf/__init__.py | 64 | 1633 | # 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 |
tahmid-tanzim/youtube-dl | youtube_dl/extractor/streamcloud.py | 127 | 1927 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
compat_urllib_request,
)
class StreamcloudIE(InfoExtractor):
IE_NAME = 'streamcloud.eu'
_VALID_URL = r'https?://streamcloud\.eu/(?P<id>[a-zA-Z0-9_-]+)(?:/(?... | unlicense |
40223143/2015_0505 | static/Brython3.1.1-20150328-091302/Lib/unittest/test/testmock/testpatch.py | 739 | 53126 | # Copyright (C) 2007-2012 Michael Foord & the mock team
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# http://www.voidspace.org.uk/python/mock/
import os
import sys
import unittest
from unittest.test.testmock import support
from unittest.test.testmock.support import SomeClass, is_instance
from unittest.mock import... | agpl-3.0 |
kawamon/hue | desktop/core/ext-py/docutils-0.14/test/test_parsers/test_rst/test_inline_markup.py | 2 | 49212 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# $Id: test_inline_markup.py 8038 2017-02-16 18:03:28Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Tests for inline markup in docutils/parsers/rst/states.py.
Interpreted text tests are in a separ... | apache-2.0 |
miguelparaiso/PracticaOdoo | addons/note/note.py | 223 | 8893 | # -*- 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 |
falbassini/googleads-dfa-reporting-samples | python/v2.0/get_size.py | 3 | 2025 | #!/usr/bin/python
#
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | apache-2.0 |
infoelliex/addons-yelizariev | mrp_custom/models.py | 16 | 4827 | # -*- coding: utf-8 -*-
from openerp import models, fields, api
class mrp_custom_jobs(models.Model):
_name = 'mrp_custom.jobs'
job_number = fields.Integer(string="Job Number")
job_name = fields.Char(compute='_get_name')
_rec_name = 'job_name'
routing_ids = fields.One2many(
'mrp_custom.rou... | lgpl-3.0 |
chiapas/sumatrapdf-new | scripts/generate-htmlparserlookup.py | 5 | 11408 | """
This script generates fairly fast C code for the following function:
Given a string, see if it belongs to a known set of strings. If it does,
return a value corresponding to that string.
"""
import os
from util import group, verify_started_in_right_directory
Template_Defines = """\
#define CS1(c1) ... | gpl-3.0 |
ric2b/Vivaldi-browser | chromium/third_party/Python-Markdown/markdown/postprocessors.py | 73 | 3431 | """
POST-PROCESSORS
=============================================================================
Markdown also allows post-processors, which are similar to preprocessors in
that they need to implement a "run" method. However, they are run after core
processing.
"""
from __future__ import absolute_import
from __futu... | bsd-3-clause |
summychou/TBTracker | src/TBTracker_Gui/TBTracker_Gui_Button.py | 1 | 4941 | # -*- coding: utf-8 -*-
from PyQt5.QtCore import QCoreApplication
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QPushButton
'''
@author : Zhou Jian
@email : zhoujian@hust.edu.cn
@version : V1.1
@date : 2018.04.22
'''
class BaseButton(QPushButton):
'''
基类按钮
'''
def __init__(self, name... | mit |
Mj258/weiboapi | srapyDemo/envs/Lib/site-packages/twisted/test/test_context.py | 11 | 1525 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.python.context}.
"""
from __future__ import division, absolute_import
from twisted.trial.unittest import SynchronousTestCase
from twisted.python import context
class ContextTests(SynchronousTestCase):
"""
Tests ... | mit |
gurneyalex/oerpscenario | features/support/behave_better.py | 7 | 7755 | # -*- coding: utf-8 -*-
"""Enhancements for Behave.
Some of them might be proposed upstream
"""
import os.path
from behave import formatter
from behave import matchers
from behave import model
from behave import runner
from behave.formatter.ansi_escapes import up
from behave.model_describe import escape_cell, escape_... | gpl-2.0 |
idrogeno/enigma2 | lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py | 42 | 4039 | # -*- coding: iso-8859-1 -*-
# (c) 2006 Stephan Reichholf
# This Software is Free, use it where you want, when you want for whatever you want and modify it if you want but don't remove my copyright!
from Screens.Screen import Screen
from Screens.Standby import TryQuitMainloop
from Screens.MessageBox import MessageBox
f... | gpl-2.0 |
AlexStarov/Shop | applications/discount/management/commands/processing_actions.py | 1 | 6004 | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from applications.product.models import Category, Product
from applications.discount.models import Action
__author__ = 'Alex Starov'
class Command(BaseCommand, ):
def handle(self, *args, **options):
try:
action_cate... | apache-2.0 |
Northrend/mxnet | tests/nightly/compilation_warnings/process_output.py | 32 | 2198 | # 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 |
jonsimington/pybbm | pybb/util.py | 5 | 5791 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import warnings
import uuid
from django.utils.importlib import import_module
from django.utils.six import string_types
from django.utils.translation import ugettext as _
from pybb.compat import get_username_field, get_user_model
from pybb.defa... | bsd-2-clause |
ycaihua/scikit-learn | sklearn/decomposition/tests/test_incremental_pca.py | 23 | 8317 | """Tests for Incremental PCA."""
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_raises
from sklearn import datasets
from sklearn.decomposition import PCA, IncrementalPCA
iris = datasets.load... | bsd-3-clause |
alfredhq/alfred | alfred/__main__.py | 1 | 1238 | #!/usr/bin/env python
import os
from argh import arg, ArghParser
from argh.exceptions import CommandError
from functools import wraps
CONFIG = os.environ.get('ALFRED_CONFIG')
def with_app(func):
@wraps(func)
@arg('--config', help='path to config')
def wrapper(args):
from alfred import create_ap... | isc |
sunlightlabs/billy | billy/scrape/utils.py | 2 | 5127 | import re
import itertools
import subprocess
import collections
def convert_pdf(filename, type='xml'):
commands = {'text': ['pdftotext', '-layout', filename, '-'],
'text-nolayout': ['pdftotext', filename, '-'],
'xml': ['pdftohtml', '-xml', '-stdout', filename],
'htm... | bsd-3-clause |
javiroman/rlink | dbconnector/dbconnector_test.py | 1 | 2705 | #!/usr/bin/env python
"""
(C) 2008-2009 Javi Roman <javiroman@kernel-labs.org>
$Id$
"""
import sys
import traceback
import Ice
import socket
import signal
import syslog
import time
import os
#
# Important sanity tests.
#
slice_dir = os.getenv('ICEPY_HOME', '')
if len(slice_dir) == 0 or not os.path.exists(os.path.joi... | gpl-2.0 |
yufish/youtube-dl | youtube_dl/extractor/ir90tv.py | 124 | 1738 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import remove_start
class Ir90TvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?90tv\.ir/video/(?P<id>[0-9]+)/.*'
_TESTS = [{
'url': 'http://90tv.ir/video/95719/%D8%B4%D8%A7%DB%8C%D8%B9%D8%A7%D... | unlicense |
lgiommi/root | interpreter/llvm/src/tools/clang/tools/scan-view/share/Reporter.py | 32 | 8153 | """Methods for reporting bugs."""
import subprocess, sys, os
__all__ = ['ReportFailure', 'BugReport', 'getReporters']
#
class ReportFailure(Exception):
"""Generic exception for failures in bug reporting."""
def __init__(self, value):
self.value = value
# Collect information about a bug.
cl... | lgpl-2.1 |
robhudson/zamboni | apps/amo/tasks.py | 3 | 8387 | import datetime
from django.conf import settings
from django.core.mail import EmailMessage, EmailMultiAlternatives
import commonware.log
import phpserialize
from celeryutils import task
from hera.contrib.django_utils import flush_urls
import amo
from abuse.models import AbuseReport
from addons.models import Addon
fr... | bsd-3-clause |
elky/django | django/contrib/gis/geos/prototypes/topology.py | 50 | 2139 | """
This module houses the GEOS ctypes prototype functions for the
topological operations on geometries.
"""
from ctypes import c_double, c_int
from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory
from django.contrib.gis.geos.prototypes.errcheck import (
check_geom, check_minus_one, check_string... | bsd-3-clause |
eeshangarg/oh-mainline | vendor/packages/twisted/doc/core/howto/listings/pb/pbAnonClient.py | 18 | 1939 | #!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Client which will talk to the server run by pbAnonServer.py, logging in
either anonymously or with username/password credentials.
"""
from sys import stdout
from twisted.python.log import err, startLogging
from twisted... | agpl-3.0 |
marcore/edx-platform | lms/djangoapps/instructor/tests/test_spoc_gradebook.py | 46 | 6276 | """
Tests of the instructor dashboard spoc gradebook
"""
from django.core.urlresolvers import reverse
from nose.plugins.attrib import attr
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from student.tests.factories import UserFactory, CourseEnrollmentFactory, AdminFactory
from xmodule.modul... | agpl-3.0 |
pragmaticcoders/horse | tests/integration/recommendation/test_smart_service.py | 1 | 3551 | from horse.models import User, Movie
import pytest
@pytest.fixture
def service(app):
return app.ctx.recommendations.smart
def assert_recommendations(result, expected):
def readable(lst):
return [(item.pk, item.title) for item in lst]
result_movies = [movie for (movie, weight) in result]
a... | mit |
nullpo-head/linux | tools/perf/scripts/python/export-to-postgresql.py | 617 | 16128 | # export-to-postgresql.py: export perf data to a postgresql database
# Copyright (c) 2014, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# Thi... | gpl-2.0 |
eliksir/mailmojo-python-sdk | test/test_newsletter_api.py | 1 | 1774 | # coding: utf-8
"""
MailMojo API
v1 of the MailMojo API # noqa: E501
OpenAPI spec version: 1.1.0
Contact: hjelp@mailmojo.no
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import mailmojo_sdk
from mailmojo_sdk.api.ne... | apache-2.0 |
nkgilley/home-assistant | homeassistant/components/knx/scene.py | 5 | 2219 | """Support for KNX scenes."""
from typing import Any
import voluptuous as vol
from xknx.devices import Scene as XknxScene
from homeassistant.components.scene import CONF_PLATFORM, Scene
from homeassistant.const import CONF_ADDRESS, CONF_NAME
from homeassistant.core import callback
import homeassistant.helpers.config_... | apache-2.0 |
gunan/tensorflow | tensorflow/compiler/tests/scatter_nd_op_test.py | 13 | 8484 | # Copyright 2018 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 |
raildo/nova | nova/conductor/rpcapi.py | 5 | 15362 | # Copyright 2013 IBM Corp.
# Copyright 2013 Red Hat, 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 r... | apache-2.0 |
d120/pyfeedback | src/feedback/migrations/0043_auto_20190618_2221.py | 1 | 8403 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2019-06-18 22:21
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('feedback', '0042_auto_20180608_1423'),
]
operatio... | agpl-3.0 |
ideasiii/ControllerPlatform | Controller-Mongodb-20170405/extLibs/mongo-cxx-driver/site_scons/buildscripts/docs.py | 6 | 1237 | """Build the C++ client docs.
"""
from __future__ import with_statement
import os
import shutil
import subprocess
def clean_dir(dir):
try:
shutil.rmtree(dir)
except:
pass
os.makedirs(dir)
def gen_cplusplus(dir):
clean_dir(dir)
clean_dir("docs/doxygen")
# Too noisy...
wit... | gpl-3.0 |
mskala/birdie | birdieapp/utils/media.py | 1 | 4300 | # -*- coding: utf-8 -*-
# Copyright (C) 2013-2014 Ivo Nunes/Vasco Nunes
# 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 versio... | gpl-3.0 |
dpyro/servo | components/script/dom/bindings/codegen/parser/tests/test_unenumerable_own_properties.py | 126 | 1628 | def WebIDLTest(parser, harness):
parser.parse(
"""
interface Foo {};
[LegacyUnenumerableNamedProperties]
interface Bar : Foo {
getter long(DOMString name);
};
interface Baz : Bar {
getter long(DOMString name);
};
""");
results ... | mpl-2.0 |
gzzhanghao/mitmproxy | mitmproxy/proxy/root_context.py | 3 | 4924 | from __future__ import absolute_import, print_function, division
import sys
import six
import netlib.exceptions
from mitmproxy import exceptions
from mitmproxy import protocol
from mitmproxy.proxy import modes
class RootContext(object):
"""
The outermost context provided to the root layer.
As a conseq... | mit |
aaron-fz/neutron_full_sync | neutron/plugins/mlnx/db/mlnx_db_v2.py | 15 | 10337 | # Copyright 2013 Mellanox Technologies, Ltd
#
# 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 t... | apache-2.0 |
wenxichen/tensorflow_yolo2 | src/img_dataset/ilsvrc2017_cls.py | 1 | 7175 | """ILSVRC 2017 Classicifation Dataset.
DEPRECATED version. For the purpose of keeping history only.
Use ilsvrc2017_cls_multithread.py instead.
"""
import os
import cv2
import numpy as np
import random
import config as cfg
class ilsvrc_cls:
def __init__(self, image_set, rebuild=False, data_aug=True):
se... | mit |
kaji-project/shinken-mod-influxdb | module/logevent.py | 2 | 5002 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2014 - Savoir-Faire Linux inc.
#
# This file is part of Shinken.
#
# Shinken 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 Foundation, either version 3 ... | agpl-3.0 |
dgarciam/Sick-Beard | lib/tvdb_api/tests/gprof2dot.py | 29 | 53219 | #!/usr/bin/env python2
#
# Copyright 2008 Jose Fonseca
#
# 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 of the License, or
# (at your option) any later version.
#
# This... | gpl-3.0 |
Asana/boto | boto/services/bs.py | 153 | 8144 | #!/usr/bin/env python
# Copyright (c) 2006-2008 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rig... | mit |
elubow/pynsq | tests/test_sync.py | 6 | 2696 | import struct
import time
import os
import sys
# shunt '..' into sys.path since we are in a 'tests' subdirectory
base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
if base_dir not in sys.path:
sys.path.insert(0, base_dir)
import mock_socket
import nsq
nsq.sync.socket = mock... | mit |
shuishoudage/CloudappCLI | env/lib/python2.7/site-packages/pip/operations/freeze.py | 127 | 4048 | from __future__ import absolute_import
import logging
import re
import pip
from pip.req import InstallRequirement
from pip.utils import get_installed_distributions
from pip._vendor import pkg_resources
from pip._vendor.packaging.utils import canonicalize_name
logger = logging.getLogger(__name__)
def freeze(
... | gpl-3.0 |
askeing/fxos-certsuite | mcts/webapi_tests/notification/test_simple_notification.py | 6 | 1550 | # 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 mcts.webapi_tests.semiauto import TestCase
from mcts.webapi_tests.notification import NotificationTestCommon
clas... | mpl-2.0 |
40223135/40223135w17 | static/Brython3.1.1-20150328-091302/Lib/textwrap.py | 745 | 16488 | """Text wrapping and filling.
"""
# Copyright (C) 1999-2001 Gregory P. Ward.
# Copyright (C) 2002, 2003 Python Software Foundation.
# Written by Greg Ward <gward@python.net>
import re
__all__ = ['TextWrapper', 'wrap', 'fill', 'dedent', 'indent']
# Hardcode the recognized whitespace characters to the US-ASCII
# whit... | gpl-3.0 |
arameshkumar/base-nuxeo-drive | nx_cx_Freeze/__init__.py | 3 | 7674 | """cx_Freeze extension
Extends:
- the 'build' command with the 'exe-command' option to allow using a
different command from 'build_exe' to build executables from Python scripts.
- the 'install' command with the 'skip-sub-commands' option to allow not
running a set of sub commands, e.g.:
install --skip-sub-comma... | lgpl-2.1 |
owlzhou/ttornado | env/Lib/encodings/mac_roman.py | 593 | 13736 | """ Python Character Mapping Codec mac_roman generated from 'MAPPINGS/VENDORS/APPLE/ROMAN.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,err... | apache-2.0 |
oss/rutgers-repository-utils | lib/repoclosure.py | 1 | 11619 | #!/usr/bin/python -t
# 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that i... | gpl-2.0 |
dominikgiermala/properties-editor | src/properties_editor.py | 1 | 5314 | import os
import sublime
import sublime_plugin
from .lib.pyjavaproperties import Properties
class AddEditPropertiesCommand(sublime_plugin.WindowCommand):
def run(self, paths = []):
# TODO: validate if *.properties file
self.paths = paths
self.window.show_input_panel("Properties to add/edit:", '', self.on... | mit |
v-iam/azure-sdk-for-python | azure-keyvault/azure/keyvault/models/attributes.py | 5 | 1738 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | mit |
ltiao/networkx | networkx/algorithms/traversal/depth_first_search.py | 14 | 8425 | """
==================
Depth-first search
==================
Basic algorithms for depth-first searching the nodes of a graph.
Based on http://www.ics.uci.edu/~eppstein/PADS/DFS.py
by D. Eppstein, July 2004.
"""
import networkx as nx
from collections import defaultdict
__author__ = """\n""".join(['Aric Hagberg <aric.h... | bsd-3-clause |
adelina-t/neutron | neutron/tests/unit/api/test_extensions.py | 4 | 34804 | # Copyright (c) 2011 OpenStack Foundation.
# 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... | apache-2.0 |
michaelkirk/QGIS | python/ext-libs/dateutil/zoneinfo/__init__.py | 83 | 3558 | # -*- coding: utf-8 -*-
"""
Copyright (c) 2003-2005 Gustavo Niemeyer <gustavo@niemeyer.net>
This module offers extensions to the standard Python
datetime module.
"""
import logging
import os
from subprocess import call
from tarfile import TarFile
from dateutil.tz import tzfile
__author__ = "Tomi Pieviläinen <tomi.p... | gpl-2.0 |
SIPp/pysipp | pysipp/launch.py | 1 | 5708 | """
Launchers for invoking SIPp user agents
"""
import subprocess
import os
import shlex
import select
import threading
import signal
import time
from . import utils
from pprint import pformat
from collections import OrderedDict, namedtuple
log = utils.get_logger()
Streams = namedtuple("Streams", "stdout stderr")
c... | gpl-2.0 |
intgr/django | tests/admin_docs/test_middleware.py | 56 | 1602 | from django.contrib.auth.models import User
from .tests import AdminDocsTestCase, TestDataMixin
class XViewMiddlewareTest(TestDataMixin, AdminDocsTestCase):
def test_xview_func(self):
user = User.objects.get(username='super')
response = self.client.head('/xview/func/')
self.assertNotIn('... | bsd-3-clause |
dhodhala88/Bosch1 | weblate/settings_openshift.py | 2 | 3663 | # -*- coding: utf-8 -*-
#
# Copyright © 2015 Daniel Tschan <tschan@puzzle.ch>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either vers... | gpl-3.0 |
xiaoshaozi52/ansible | v1/ansible/runner/poller.py | 132 | 4480 | # (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 |
blaggacao/odoo | openerp/addons/base/tests/test_basecase.py | 379 | 3895 | # -*- coding: utf-8 -*-
import unittest2
from openerp.tests import common
class test_single_transaction_case(common.SingleTransactionCase):
"""
Check the whole-class transaction behavior of SingleTransactionCase.
"""
def test_00(self):
"""Create a partner."""
cr, uid = self.cr, self.u... | agpl-3.0 |
evensonbryan/yocto-autobuilder | lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/protocols/dict.py | 60 | 10727 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Dict client protocol implementation.
@author: Pavel Pergamenshchik
"""
from twisted.protocols import basic
from twisted.internet import defer, protocol
from twisted.python import log
from StringIO import StringIO
def parseParam(line):
... | gpl-2.0 |
Khan/pyobjc-framework-FSEvents | setup.py | 1 | 1152 | '''
Wrappers for the "FSEvents" API in MacOS X. The functions in this framework
allow you to reliably observe changes to the filesystem, even when your
program is not running al the time.
These wrappers don't include documentation, please check Apple's documention
for information on how to use this framework and PyObj... | mit |
fidomason/kbengine | kbe/res/scripts/common/Lib/turtledemo/clock.py | 99 | 3201 | #!/usr/bin/env python3
# -*- coding: cp1252 -*-
""" turtle-example-suite:
tdemo_clock.py
Enhanced clock-program, showing date
and time
------------------------------------
Press STOP to exit the program!
------------------------------------
"""
from turtle import *
from datetime import datet... | lgpl-3.0 |
kxliugang/edx-platform | openedx/core/djangoapps/credit/tests/test_tasks.py | 62 | 13643 | """
Tests for credit course tasks.
"""
import mock
from datetime import datetime, timedelta
from pytz import UTC
from openedx.core.djangoapps.credit.api import get_credit_requirements
from openedx.core.djangoapps.credit.exceptions import InvalidCreditRequirements
from openedx.core.djangoapps.credit.models import Cred... | agpl-3.0 |
zsh406/MissionPlanner | Scripts/example1.py | 57 | 1491 | # cs.???? = currentstate, any variable on the status tab in the planner can be used.
# Script = options are
# Script.Sleep(ms)
# Script.ChangeParam(name,value)
# Script.GetParam(name)
# Script.ChangeMode(mode) - same as displayed in mode setup screen 'AUTO'
# Script.WaitFor(string,timeout)
# Script.SendRC(chan... | gpl-3.0 |
schleichdi2/OPENNFR-6.1-CORE | bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py | 5 | 1148 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bldcontrol', '0003_add_cancelling_state'),
]
operations = [
migrations.AlterField(
model_name='buildenvironment'... | gpl-2.0 |
maxmind/GeoIP2-python | tests/webservice_test.py | 1 | 12944 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import asyncio
import copy
import ipaddress
import json
import sys
from typing import cast, Dict
import unittest
sys.path.append("..")
# httpretty currently doesn't work, but mocket with the compat interface
# does.
from mocket import Mocket # type: ignore
from mocket.p... | apache-2.0 |
EDUlib/edx-platform | cms/djangoapps/contentstore/views/tests/test_user.py | 4 | 12813 | """
Tests for contentstore/views/user.py.
"""
import json
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from cms.djangoapps.contentstore.tests.utils import CourseTestCase
from cms.djangoapps.contentstore.utils import reverse_course_url
from common.djangoapps.student... | agpl-3.0 |
thekingofkings/focusread | libs/click/globals.py | 21 | 1514 | from threading import local
_local = local()
def get_current_context(silent=False):
"""Returns the current click context. This can be used as a way to
access the current context object from anywhere. This is a more implicit
alternative to the :func:`pass_context` decorator. This function is
prima... | mit |
GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/pyximport/pyxbuild.py | 10 | 5631 | """Build a Pyrex file from .pyx source to .so loadable module using
the installed distutils infrastructure. Call:
out_fname = pyx_to_dll("foo.pyx")
"""
import os
import sys
from distutils.errors import DistutilsArgError, DistutilsError, CCompilerError
from distutils.extension import Extension
from distutils.util impo... | agpl-3.0 |
ClovisIRex/Snake-django | env/lib/python3.6/site-packages/django/contrib/sessions/backends/file.py | 118 | 8034 | import datetime
import errno
import logging
import os
import shutil
import tempfile
from django.conf import settings
from django.contrib.sessions.backends.base import (
VALID_KEY_CHARS, CreateError, SessionBase, UpdateError,
)
from django.contrib.sessions.exceptions import InvalidSessionKey
from django.core.except... | mit |
GeoODK/onadata | onadata/apps/logger/xform_instance_parser.py | 10 | 11470 | import re
import dateutil.parser
from xml.dom import minidom, Node
from django.utils.encoding import smart_unicode, smart_str
from django.utils.translation import ugettext as _
from onadata.libs.utils.common_tags import XFORM_ID_STRING
class XLSFormError(Exception):
pass
class DuplicateInstance(Exception):
... | bsd-2-clause |
annefried/swan | src/main/webapp/node_modules/verror/node_modules/extsprintf/deps/javascriptlint/javascriptlint/jsparse.py | 21 | 15686 | #!/usr/bin/env python2.6
# vim: ts=4 sw=4 expandtab
""" Parses a script into nodes. """
import bisect
import re
import unittest
import spidermonkey
from spidermonkey import tok, op
from util import JSVersion
_tok_names = dict(zip(
[getattr(tok, prop) for prop in dir(tok)],
['tok.%s' % prop for prop in dir(tok... | gpl-2.0 |
TNT-Samuel/Coding-Projects | DNS Server/Source/Lib/site-packages/dnslib/dns.py | 4 | 57312 |
"""
DNS - main dnslib module
Contains core DNS packet handling code
"""
from __future__ import print_function
import base64,binascii,calendar,collections,copy,os.path,random,socket,\
string,struct,textwrap,time
from itertools import chain
try:
from itertools import zip_longest
except ImportErr... | gpl-3.0 |
tealover/nova | nova/tests/unit/image/fake.py | 22 | 9432 | # Copyright 2011 Justin Santa Barbara
# Copyright 2012 OpenStack Foundation
# 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/l... | apache-2.0 |
pbl-cloud/paas-manager | paas_manager/app/util/gmail.py | 1 | 1115 | import sys
import smtplib
from email.mime.text import MIMEText
from email.utils import formatdate
from ... import config
def create_message(from_addr, to_addr, subject, message, encoding):
body = MIMEText(message, 'plain', encoding)
body['Subject'] = subject
body['From'] = from_addr
body['To'] = to_add... | mit |
pranjalpatil/django-allauth | allauth/socialaccount/providers/stackexchange/tests.py | 71 | 1518 | from allauth.socialaccount.tests import create_oauth2_tests
from allauth.tests import MockedResponse
from allauth.socialaccount.providers import registry
from .provider import StackExchangeProvider
class StackExchangeTests(create_oauth2_tests(registry.by_id(StackExchangeProvider.id))):
def get_mocked_response(sel... | mit |
mgit-at/ansible | lib/ansible/modules/cloud/amazon/s3_bucket.py | 3 | 24130 | #!/usr/bin/python
#
# This is a 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.
#
# This Ansible library is distributed in the hope that i... | gpl-3.0 |
domeger/SplunkTAforPuppetEnterprise | bin/splunktaforpuppetenterprise/requests/_internal_utils.py | 414 | 1096 | # -*- coding: utf-8 -*-
"""
requests._internal_utils
~~~~~~~~~~~~~~
Provides utility functions that are consumed internally by Requests
which depend on extremely few external helpers (such as compat)
"""
from .compat import is_py2, builtin_str, str
def to_native_string(string, encoding='ascii'):
"""Given a str... | apache-2.0 |
Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2016_12_01/aio/operations/_bgp_service_communities_operations.py | 1 | 5069 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | mit |
jsteemann/arangodb | 3rdParty/V8-4.3.61/build/gyp/test/defines/gyptest-defines-env-regyp.py | 268 | 1350 | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies build of an executable with C++ define specified by a gyp define, and
the use of the environment during regeneration when the g... | apache-2.0 |
windyuuy/opera | chromium/src/third_party/protobuf/python/google/protobuf/internal/text_format_test.py | 252 | 22615 | #! /usr/bin/python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# ... | bsd-3-clause |
brodyh/tensorflow | tensorflow/python/kernel_tests/unpack_op_test.py | 5 | 2016 | """Functional tests for Unpack Op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.python.platform
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
import tensorflow as tf
from tensorflow.python.kern... | apache-2.0 |
tregaro/ac2016 | day9_input.py | 1 | 16941 | puzzle_input = '''(121x14)(7x7)UOBCTWD(24x1)KBBJJRCFNOTNFFCKJOFGWJZT(12x6)(7x3)CKJUMES(47x12)(2x3)IY(4x12)JSFP(12x13)FDTYFDWLHWXE(5x11)XLPGL(2x7)EK(113x4)(7x2)LTVKCEC(75x4)(22x8)XBUQNQXMZPOAACRFZACRVP(2x2)HV(33x10)HTJYEBCTFDFRIXRIUBWJJXFDNGBIVATET(14x6)(8x10)IGIWGAFX(102x2)(34x6)(6x14)AEVIDQ(8x10)BSMUYCJH(3x9)CQH(2x8)R... | mit |
jkomiyama/duelingbanditlib | gather.py | 1 | 1151 | #!/usr/bin/env python
# coding:utf-8
#a tool for merging multiple simulation results
import sys,os,re
def avg(elems):
return sum(elems)/float(len(elems))
def splitavg(splits):
l = len(splits[0])
for sp in splits:
if len(sp) != l:
print "split size not match"
sys.exit()
sums = [0 for i in ran... | mit |
joelstanner/python-social-auth | social/backends/trello.py | 76 | 1513 | """
Trello OAuth1 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/trello.html
"""
from social.backends.oauth import BaseOAuth1
class TrelloOAuth(BaseOAuth1):
"""Trello OAuth authentication backend"""
name = 'trello'
ID_KEY = 'username'
AUTHORIZATION_URL = 'https://trello.com/1/OAuthA... | bsd-3-clause |
MrLoick/python-for-android | python-modules/zope/zope/interface/tests/odd.py | 50 | 3130 | ##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | apache-2.0 |
dofeldsc/vivo_uos | my_pump/test/test_vivopump.py | 1 | 51767 | #!/usr/bin/env/python
# coding=utf-8
"""
test_vivopump.py -- Test cases for vivopump
"""
import sys
sys.path.insert(0, "/var/fis_data/vivo-pump")
import unittest
from pump.vivopump import new_uri, read_csv, write_csv, vivo_query, write_update_def, \
read_csv_fp, write_csv_fp, get_vivo_ufid, get_vivo_authors,... | gpl-3.0 |
jadsonjs/DataScience | python/arrays_dimesion.py | 1 | 2664 |
# Consider the case where you have one sequence of multiple time steps and one feature.
from numpy import array
data = array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0])
# We can then use the reshape() function on the NumPy array to reshape this one-dimensional array
# into a three-dimensional array with 1... | apache-2.0 |
aldebaran/qibuild | python/qisys/actions/__init__.py | 1 | 1279 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" Common tools for actions """
from __future__ import absolute_import
from __future__ import unicode_literals
from __futu... | bsd-3-clause |
deployed/django | tests/admin_custom_urls/tests.py | 9 | 5565 | from __future__ import unicode_literals
from django.contrib.admin.utils import quote
from django.core.urlresolvers import reverse
from django.template.response import TemplateResponse
from django.test import TestCase, override_settings
from .models import Action, Person, Car
@override_settings(PASSWORD_HASHERS=('dj... | bsd-3-clause |
vadimtk/chrome4sdp | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/coverage/xmlreport.py | 67 | 5682 | """XML reporting for coverage.py"""
import os, sys, time
import xml.dom.minidom
from coverage import __url__, __version__
from coverage.backward import sorted # pylint: disable=W0622
from coverage.report import Reporter
def rate(hit, num):
"""Return the fraction of `hit`/`num`, as a string."""
ret... | bsd-3-clause |
tanmaykm/edx-platform | openedx/core/djangoapps/programs/utils.py | 5 | 16352 | # -*- coding: utf-8 -*-
"""Helper functions for working with Programs."""
import datetime
import logging
from urlparse import urljoin
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.utils.text import slugify
from opaque_keys.edx.keys import Co... | agpl-3.0 |
junalmeida/Sick-Beard | lib/babelfish/tests.py | 7 | 15885 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 the BabelFish authors. All rights reserved.
# Use of this source code is governed by the 3-clause BSD license
# that can be found in the LICENSE file.
#
from __future__ import unicode_literals
import re
import sys
from unittest import TestCase, TestSu... | gpl-3.0 |
SegundoBob/GNXrepeats | hrngpS2.py | 1 | 1831 | #!/usr/bin/python
#coding=utf-8
#@+leo-ver=5-thin
#@+node:bob07.20140715160011.1575: * @file hrngpS2.py
#@@first
#@@first
#@@language python
#@@tabwidth -4
import os
import sys
import leo.core.leoBridge as leoBridge
from leo_lib import lib_leo03
#@+others
#@+node:bob07.20140715160011.1576: ** gnxRepeats()
def gnxRe... | mit |
panzer13/shadowsocks | shadowsocks/common.py | 945 | 8921 | #!/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 |
Vrturo/FrontEndLabz | techTutorials/gulp/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py | 2354 | 10366 | # Unmodified from http://code.activestate.com/recipes/576693/
# other than to add MIT license header (as specified on page, but not in code).
# Linked from Python documentation here:
# http://docs.python.org/2/library/collections.html#collections.OrderedDict
#
# This should be deleted once Py2.7 is available on all bot... | mit |
okolisny/integration_tests | cfme/utils/tests/test_varmeth.py | 11 | 1457 | # -*- coding: utf-8 -*-
import pytest
from cfme.utils.varmeth import variable
class _TestClass(object):
secret = 42
@variable
def meth1(self):
return "default"
@meth1.variant("a")
def m1_va(self):
return "a"
@meth1.variant("b")
def m1_vb(self):
return "b"
@... | gpl-2.0 |
splunk/splunk-ref-pas-code | spikes/googledrive_addon/bin/splunklib/searchcommands/logging.py | 5 | 3782 | # Copyright 2011-2014 Splunk, 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 or agreed to in wri... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.