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 |
|---|---|---|---|---|---|
loveward/yingsuo | shadowsocks/crypto/sodium.py | 17 | 4595 | #!/usr/bin/env python
#
# Copyright 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 required by applicable law or ... | apache-2.0 |
thomas-schmid-ubnt/avocado | selftests/unit/test_restclient_response.py | 1 | 2038 | import unittest
from avocado.core.restclient import response
class ResultResponseTest(unittest.TestCase):
GOOD_DATA = ('{"count": 1, "next": null, "previous": null, '
'"results": [ { "name": "unknown" } ] }')
BAD_DATA_JSON = '{"count": 1'
BAD_DATA_COUNT = ('{"counter": 1, "next": null... | gpl-2.0 |
kcartier/tensorflow-toe-in-the-water | tensorflow/python/framework/random_seed.py | 5 | 4427 | """For seeding individual ops based on a graph-level seed.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
_DEFAULT_GRAPH_SEED = 87654321
def get_seed(op_seed):
"""Returns the local seeds an operation sh... | apache-2.0 |
tlatzko/spmcluster | .tox/2.7-nocov/lib/python2.7/site-packages/pip/_vendor/distlib/locators.py | 223 | 50347 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2015 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import gzip
from io import BytesIO
import json
import logging
import os
import posixpath
import re
try:
import threading
except Impo... | bsd-2-clause |
ChristopherHogan/pip | tests/unit/test_locations.py | 19 | 3847 | """
locations.py tests
"""
import os
import sys
import shutil
import tempfile
import getpass
from mock import Mock
from pip.locations import distutils_scheme
if sys.platform == 'win32':
pwd = Mock()
else:
import pwd
class TestLocations:
def setup(self):
self.tempdir = tempfile.mkdtemp()
... | mit |
aivarsk/scrapy | scrapy/spidermiddlewares/httperror.py | 128 | 1706 | """
HttpError Spider Middleware
See documentation in docs/topics/spider-middleware.rst
"""
import logging
from scrapy.exceptions import IgnoreRequest
logger = logging.getLogger(__name__)
class HttpError(IgnoreRequest):
"""A non-200 response was filtered"""
def __init__(self, response, *args, **kwargs):
... | bsd-3-clause |
davidfraser/sqlalchemy | test/sql/test_returning.py | 22 | 13405 | from sqlalchemy.testing import eq_
from sqlalchemy import testing
from sqlalchemy.testing.schema import Table, Column
from sqlalchemy.types import TypeDecorator
from sqlalchemy.testing import fixtures, AssertsExecutionResults, engines, \
assert_raises_message
from sqlalchemy import exc as sa_exc
from sqlalchemy imp... | mit |
bpshetty/erpnext | erpnext/accounts/report/unpaid_expense_claim/unpaid_expense_claim.py | 48 | 1269 | # Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
def execute(filters=None):
columns, data = [], []
columns = get_columns()
data = get_unclaimed_expese_claims(filters)
re... | gpl-3.0 |
amwelch/a10sdk-python | a10sdk/core/export/export_periodic_thales_secworld.py | 2 | 2050 | from a10sdk.common.A10BaseClass import A10BaseClass
class ThalesSecworld(A10BaseClass):
"""Class Description::
export Thales security world files.
Class thales-secworld supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:pa... | apache-2.0 |
codrut3/tensorflow | tensorflow/contrib/metrics/__init__.py | 5 | 7264 | # 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 |
hofschroeer/gnuradio | gr-digital/python/digital/cpm.py | 6 | 8872 | #
# CPM modulation and demodulation.
#
#
# Copyright 2005-2007,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either versio... | gpl-3.0 |
jkonecny12/pykickstart | tests/parser/post.py | 6 | 3497 | import unittest
from tests.baseclass import ParserTest
from pykickstart import constants
from pykickstart.errors import KickstartParseError
from pykickstart import version # pylint: disable=unused-import
class Script_Includes_Percent_Sign(ParserTest):
ks = """
%post
echo "# Added by kickstart
%wheel ALL=(... | gpl-2.0 |
roadmapper/ansible | lib/ansible/modules/network/onyx/onyx_l3_interface.py | 77 | 10109 | #!/usr/bin/python
#
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | gpl-3.0 |
jstammers/EDMSuite | NavPython/IronPython/Lib/lib2to3/fixes/fix_exitfunc.py | 291 | 2505 | """
Convert use of sys.exitfunc to use the atexit module.
"""
# Author: Benjamin Peterson
from lib2to3 import pytree, fixer_base
from lib2to3.fixer_util import Name, Attr, Call, Comma, Newline, syms
class FixExitfunc(fixer_base.BaseFix):
keep_line_order = True
BM_compatible = True
PATTERN = """
... | mit |
kmike/opencorpora-tools | tests/test_corpora.py | 1 | 10519 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division, unicode_literals
import os
try:
import unittest2 as unittest
except ImportError:
import unittest
import tempfile
import shutil
from collections import OrderedDict
from opencorpora.reader import CorpusReader
TEST_DATA = ... | mit |
geerlingguy/ansible-modules-extras | notification/typetalk.py | 15 | 2695 | #!/usr/bin/python
# -*- coding: utf-8 -*-
DOCUMENTATION = '''
---
module: typetalk
version_added: "1.6"
short_description: Send a message to typetalk
description:
- Send a message to typetalk using typetalk API ( http://developers.typetalk.in/ )
options:
client_id:
description:
- OAuth2 client ID
req... | gpl-3.0 |
pztrick/django-allauth | allauth/socialaccount/providers/digitalocean/tests.py | 7 | 1130 | from allauth.socialaccount.tests import OAuth2TestsMixin
from allauth.tests import MockedResponse, TestCase
from .provider import DigitalOceanProvider
class DigitalOceanTests(OAuth2TestsMixin, TestCase):
provider_id = DigitalOceanProvider.id
def get_mocked_response(self):
return MockedResponse(200, ... | mit |
jackdpage/libxpxpy | docs/conf.py | 1 | 9182 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# libxpxpy documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 8 10:16:11 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... | apache-2.0 |
sh4t/Sick-Beard | lib/requests/packages/chardet/eucjpprober.py | 215 | 3506 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... | gpl-3.0 |
beck/django | tests/test_runner/test_discover_runner.py | 210 | 6196 | import os
from contextlib import contextmanager
from unittest import TestSuite, TextTestRunner, defaultTestLoader
from django.test import TestCase
from django.test.runner import DiscoverRunner
@contextmanager
def change_cwd(directory):
current_dir = os.path.abspath(os.path.dirname(__file__))
new_dir = os.pat... | bsd-3-clause |
colinligertwood/odoo | addons/note/__openerp__.py | 62 | 2293 | # -*- 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 |
v-iam/azure-sdk-for-python | azure-mgmt-dns/azure/mgmt/dns/operations/zones_operations.py | 2 | 18777 | # 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 |
krocard/parameter-framework | test/functional-tests-legacy/PfwTestCase/Domains/tDomain_Configuration.py | 2 | 28194 | # -*-coding:utf-8 -*
# Copyright (c) 2011-2015, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, thi... | bsd-3-clause |
LukeMurphey/splunk-syndication-input | src/bin/syndication_app/feedparser/datetimes/korean.py | 6 | 3436 | # Copyright 2010-2019 Kurt McKee <contactme@kurtmckee.org>
# Copyright 2002-2008 Mark Pilgrim
# All rights reserved.
#
# This file is a part of feedparser.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistrib... | gpl-3.0 |
vuntz/glance | glance/cmd/replicator.py | 7 | 25625 | #!/usr/bin/env python
# Copyright 2012 Michael Still and Canonical Inc
# Copyright 2014 SoftLayer Technologies, 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 Lice... | apache-2.0 |
gchp/django | django/core/management/commands/runserver.py | 14 | 7826 | from __future__ import unicode_literals
import errno
import os
import re
import socket
import sys
from datetime import datetime
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand, CommandError
from django.core.servers.basehttp i... | bsd-3-clause |
cedi4155476/QGIS | python/plugins/processing/gui/ProcessingToolbox.py | 4 | 16598 | # -*- coding: utf-8 -*-
"""
***************************************************************************
ProcessingToolbox.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*********************... | gpl-2.0 |
knossos-project/PythonQt | examples/NicePyConsole/pygments/sphinxext.py | 62 | 4459 | # -*- coding: utf-8 -*-
"""
pygments.sphinxext
~~~~~~~~~~~~~~~~~~
Sphinx extension to generate automatic documentation of lexers,
formatters and filters.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import print... | lgpl-2.1 |
3quarterstack/simple_blog | django/middleware/cache.py | 61 | 9096 | """
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::
MIDDLEWARE_CLASSES = [
'django.middleware.cache.UpdateCa... | mit |
tunneln/CarnotKE | jyhton/lib-python/2.7/toaiff.py | 293 | 3142 | """Convert "arbitrary" sound files to AIFF (Apple and SGI's audio format).
Input may be compressed.
Uncompressed file type may be AIFF, WAV, VOC, 8SVX, NeXT/Sun, and others.
An exception is raised if the file is not of a recognized type.
Returned filename is either the input filename or a temporary filename;
in the la... | apache-2.0 |
jramos/p2pool | wstools/UserTuple.py | 295 | 4047 | """
A more or less complete user-defined wrapper around tuple objects.
Adapted version of the standard library's UserList.
Taken from Stefan Schwarzer's ftputil library, available at
<http://www.ndh.net/home/sschwarzer/python/python_software.html>, and used under this license:
Copyright (C) 1999, Stefan Schwarzer ... | gpl-3.0 |
rhuss/bazel | third_party/py/gflags/gflags2man.py | 407 | 18864 | #!/usr/bin/env python
# Copyright (c) 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this l... | apache-2.0 |
hainm/numpy | numpy/distutils/command/install_clib.py | 258 | 1315 | from __future__ import division, absolute_import, print_function
import os
from distutils.core import Command
from distutils.ccompiler import new_compiler
from numpy.distutils.misc_util import get_cmd
class install_clib(Command):
description = "Command to install installable C libraries"
user_options = []
... | bsd-3-clause |
icereval/scrapi | tests/test_database_managment.py | 4 | 2130 | import mock
from scrapi import database
from scrapi import settings
class TestDatabaseManager(object):
def test_setup_calls_setup(self, monkeypatch):
mock_connect = mock.Mock()
mock_create_keyspace = mock.Mock()
monkeypatch.setattr(database.connection, 'setup', mock_connect)
monke... | apache-2.0 |
AkaZuko/gstudio | gnowsys-ndf/gnowsys_ndf/ndf/views/task.py | 2 | 38472 | import datetime
import json
from django.http import HttpResponseRedirect
from django.http import StreamingHttpResponse
from django.http import HttpResponse
from django.shortcuts import render_to_response #render uncomment when to use
from django.template import RequestContext
from django.core.urlresolvers import reve... | agpl-3.0 |
balloob/home-assistant | homeassistant/components/homekit/type_sensors.py | 16 | 11855 | """Class to hold all sensor accessories."""
import logging
from pyhap.const import CATEGORY_SENSOR
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_UNIT_OF_MEASUREMENT,
STATE_HOME,
STATE_ON,
TEMP_CELSIUS,
)
from homeassistant.core import callback
from .accessories import TYPES, HomeAcces... | apache-2.0 |
ucb-sejits/ctree | ctree/c/codegen.py | 1 | 6213 | """
Code generator for C constructs.
"""
from ctree.codegen import CodeGenVisitor
from ctree.c.nodes import Op
from ctree.types import codegen_type, get_suffix
from ctree.precedence import UnaryOp, BinaryOp, TernaryOp, Cast
from ctree.precedence import get_precedence, is_left_associative
from numbers import Number
f... | bsd-2-clause |
agiliq/django | django/template/response.py | 15 | 6152 | from django.http import HttpResponse
from django.template import loader, Context, RequestContext
from django.utils import six
class ContentNotRenderedError(Exception):
pass
class SimpleTemplateResponse(HttpResponse):
rendering_attrs = ['template_name', 'context_data', '_post_render_callbacks']
def __in... | bsd-3-clause |
FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/test/test_list.py | 3 | 5684 | import sys
from test import list_tests
import pickle
import unittest
class ListTest(list_tests.CommonTest):
type2test = list
def test_basic(self):
self.assertEqual(list([]), [])
l0_3 = [0, 1, 2, 3]
l0_3_bis = list(l0_3)
self.assertEqual(l0_3, l0_3_bis)
self.assertTrue(l... | gpl-2.0 |
FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/distutils/tests/test_install_scripts.py | 118 | 2625 | """Tests for distutils.command.install_scripts."""
import os
import unittest
from distutils.command.install_scripts import install_scripts
from distutils.core import Distribution
from distutils.tests import support
from test.support import run_unittest
class InstallScriptsTestCase(support.TempdirManager,
... | gpl-2.0 |
betoesquivel/fil2014 | filenv/lib/python2.7/site-packages/south/management/commands/schemamigration.py | 94 | 10490 | """
Startmigration command, version 2.
"""
from __future__ import print_function
import sys
import os
import re
import string
import random
import inspect
from optparse import make_option
try:
set
except NameError:
from sets import Set as set
from django.core.management.base import BaseCommand
from django.c... | mit |
riteshshrv/django | django/contrib/postgres/aggregates/statistics.py | 493 | 2033 | from django.db.models import FloatField, IntegerField
from django.db.models.aggregates import Aggregate
__all__ = [
'CovarPop', 'Corr', 'RegrAvgX', 'RegrAvgY', 'RegrCount', 'RegrIntercept',
'RegrR2', 'RegrSlope', 'RegrSXX', 'RegrSXY', 'RegrSYY', 'StatAggregate',
]
class StatAggregate(Aggregate):
def __in... | bsd-3-clause |
theoryno3/pylearn2 | pylearn2/scripts/papers/maxout/tests/test_mnist.py | 44 | 1773 | """
This file tests some of the YAML files in the maxout paper
"""
import os
import pylearn2
from pylearn2.datasets import control
from pylearn2.datasets.mnist import MNIST
from pylearn2.termination_criteria import EpochCounter
from pylearn2.testing.skip import skip_if_no_gpu
from pylearn2.utils.serial import load_tra... | bsd-3-clause |
coderbone/SickRage-alt | lib/unidecode/x0d1.py | 253 | 4767 | data = (
'tyal', # 0x00
'tyalg', # 0x01
'tyalm', # 0x02
'tyalb', # 0x03
'tyals', # 0x04
'tyalt', # 0x05
'tyalp', # 0x06
'tyalh', # 0x07
'tyam', # 0x08
'tyab', # 0x09
'tyabs', # 0x0a
'tyas', # 0x0b
'tyass', # 0x0c
'tyang', # 0x0d
'tyaj', # 0x0e
'tyac', # 0x0f
'tyak', # ... | gpl-3.0 |
pbfy0/visvis | processing/statistics.py | 3 | 11837 | # -*- coding: utf-8 -*-
# Copyright (C) 2012, Almar Klein
#
# Visvis is distributed under the terms of the (new) BSD License.
# The full license can be found in 'license.txt'.
import numpy as np
def statistics(data):
""" Get StatData object for the given data.
"""
return StatData(data)
class StatData:
... | bsd-3-clause |
nuagenetworks/vspk-python | vspk/v6/nuegressauditacltemplate.py | 1 | 21660 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# 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 copyrigh... | bsd-3-clause |
burzillibus/RobHome | venv/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/version.py | 1151 | 11556 | # 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 collections
import itertools
import re
from ._structures import In... | mit |
grap/OCB | addons/email_template/tests/test_mail.py | 22 | 14119 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | agpl-3.0 |
trueblue2704/AskMeAnything | lib/python2.7/site-packages/jinja2/testsuite/ext.py | 402 | 18086 | # -*- coding: utf-8 -*-
"""
jinja2.testsuite.ext
~~~~~~~~~~~~~~~~~~~~
Tests for the extensions.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
import unittest
from jinja2.testsuite import JinjaTestCase
from jinja2 import Environment, DictLoader... | mit |
whs/django | django/db/models/functions/datetime.py | 23 | 9441 | from datetime import datetime
from django.conf import settings
from django.db.models import (
DateField, DateTimeField, IntegerField, TimeField, Transform,
)
from django.db.models.lookups import (
YearExact, YearGt, YearGte, YearLt, YearLte,
)
from django.utils import timezone
from django.utils.functional impo... | bsd-3-clause |
nhenezi/kuma | vendor/packages/translate-toolkit/translate/storage/placeables/test_base.py | 6 | 7786 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009 Zuza Software Foundation
#
# This file is part of the Translate Toolkit.
#
# 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... | mpl-2.0 |
agrista/odoo-saas | addons/google_spreadsheet/google_spreadsheet.py | 103 | 5583 | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2012 OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General... | agpl-3.0 |
mbartling/TAMU_senior_design | Python/gps2local.py | 1 | 1458 | #! /usr/bin/env python
from numpy import *
import sys
#p1 = [30.625621, -96.336753]
#p2 = [30.624388, -96.335755]
#p3 = [30.626050, -96.333368]
#p4 = [30.627195, -96.334945]
xres = 300
yres = 500
lat = []
lon = []
for line in sys.stdin:
line.strip()
(latS, lonS, dummy) = line.split(',')
lat.appe... | mit |
dennisguse/pjsip | tests/pjsua/inc_const.py | 38 | 1330 | # $Id$
# Useful constants
##########################
# MENU OUTPUT
#
##########################
# EVENTS
#
# Text to expect when there is incoming call
EVENT_INCOMING_CALL = "Press .* answer"
##########################
# CALL STATES
#
# Call state is CALLING
STATE_CALLING = "state.*CALLING"
# Call state is EARL... | gpl-2.0 |
OpenTrons/opentrons-api | api/tests/opentrons/protocol_api/test_paired_context.py | 2 | 13193 | import pytest
from unittest import mock
import opentrons.protocol_api as papi
from opentrons.hardware_control import API
from opentrons.types import Mount, Point
from opentrons.protocol_api import paired_instrument_context as pc
from opentrons.hardware_control.pipette import Pipette
@pytest.fixture
def set_up_paired... | apache-2.0 |
lexchou/shadowsocks | tests/nose_plugin.py | 1072 | 1164 | #!/usr/bin/env python
#
# Copyright 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 required by applicable law or ... | apache-2.0 |
rasbt/python-machine-learning-book | code/optional-py-scripts/ch05.py | 1 | 19830 | # Sebastian Raschka, 2015 (http://sebastianraschka.com)
# Python Machine Learning - Code Examples
#
# Chapter 5 - Compressing Data via Dimensionality Reduction
#
# S. Raschka. Python Machine Learning. Packt Publishing Ltd., 2015.
# GitHub Repo: https://github.com/rasbt/python-machine-learning-book
#
# License: MIT
# ht... | mit |
BlindHunter/django | tests/forms_tests/tests/test_widgets.py | 112 | 10410 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.admin.tests import AdminSeleniumWebDriverTestCase
from django.core.urlresolvers import reverse
from django.forms import (
CheckboxSelectMultiple, ClearableFileInput, RadioSelect, TextInput,
)
from django.forms.widgets import (
... | bsd-3-clause |
Dragon2fly/vpngate-with-proxy | old/config.py | 1 | 4265 | # -*- coding: utf-8 -*-
__author__ = 'duc_tin'
import ConfigParser
import re
import sys
def ctext(text, color):
""" Add color to printed text
:type text: str
:type color: str
"""
fcolor = {'p': '\033[95m', # purple
'b': '\033[94m', # blue
'g': '\033[92m', # green
... | gpl-2.0 |
tobegit3hub/glance_docker | glance/tests/unit/test_artifact_type_definition_framework.py | 2 | 43802 | # Copyright (c) 2015 Mirantis, 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 writin... | apache-2.0 |
Learningtribes/edx-platform | common/lib/symmath/symmath/test_symmath_check.py | 166 | 2648 | from unittest import TestCase
from .symmath_check import symmath_check
class SymmathCheckTest(TestCase):
def test_symmath_check_integers(self):
number_list = [i for i in range(-100, 100)]
self._symmath_check_numbers(number_list)
def test_symmath_check_floats(self):
number_list = [i + ... | agpl-3.0 |
koobonil/Boss2D | Boss2D/addon/tensorflow-1.2.1_for_boss/tensorflow/python/framework/sparse_tensor.py | 91 | 9294 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | mit |
taichatha/youtube-dl | youtube_dl/extractor/snotr.py | 158 | 2272 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
float_or_none,
str_to_int,
parse_duration,
)
class SnotrIE(InfoExtractor):
_VALID_URL = r'http?://(?:www\.)?snotr\.com/video/(?P<id>\d+)/([\w]+)'
_TESTS = [{
'url': '... | unlicense |
doheekim/chuizonetest | lib/sqlalchemy/orm/strategy_options.py | 32 | 32170 | # orm/strategy_options.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
"""
from .interfaces import MapperOption, PropComparator
from .. impor... | apache-2.0 |
christianurich/VIBe2UrbanSim | 3rdparty/opus/src/opus_core/variables/expression_tests/interaction_aggregate_disaggregate.py | 2 | 23668 | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.tests import opus_unittest
from opus_core.datasets.dataset import Dataset
from opus_core.datasets.dataset_pool import DatasetPool
fr... | gpl-2.0 |
gengwg/leetcode | 179_largest_number.py | 1 | 1445 | # -*- coding: utf-8 -*-
# 179. Largest Number
# Given a list of non negative integers,
# arrange them such that they form the largest number.
#
# For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.
#
# Note: The result may be very large,
# so you need to return a string instead of an integer.
#
... | apache-2.0 |
richardbeare/ITK | Modules/Core/Common/wrapping/test/itkImageTest.py | 2 | 1201 | #==========================================================================
#
# Copyright NumFOCUS
#
# 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 |
Drooids/odoo | addons/crm/validate_email.py | 462 | 5978 | # RFC 2822 - style email validation for Python
# (c) 2012 Syrus Akbary <me@syrusakbary.com>
# Extended from (c) 2011 Noel Bush <noel@aitools.org>
# for support of mx and user check
# This code is made available to you under the GNU LGPL v3.
#
# This module provides a single method, valid_email_address(),
# which return... | agpl-3.0 |
stfp/git-lint | gitlint/linters.py | 2 | 7516 | # Copyright 2013-2014 Sebastian Kreft
#
# 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 |
dya2/python-for-android | python-modules/twisted/twisted/words/im/baseaccount.py | 57 | 1818 | # -*- Python -*-
#
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
#
class AccountManager:
"""I am responsible for managing a user's accounts.
That is, remembering what accounts are available, their settings,
adding and removal of accounts, etc.
@ivar accounts: A c... | apache-2.0 |
LewBurton/sklearn_pycon2015 | notebooks/fig_code/sgd_separator.py | 54 | 1148 | import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import SGDClassifier
from sklearn.datasets.samples_generator import make_blobs
def plot_sgd_separator():
# we create 50 separable points
X, Y = make_blobs(n_samples=50, centers=2,
random_state=0, cluster_std=0.60... | bsd-3-clause |
xrg/django-static-gitified | django/db/transaction.py | 41 | 9516 | """
This module implements a transaction manager that can be used to define
transaction handling in a request or view function. It is used by transaction
control middleware and decorators.
The transaction manager can be in managed or in auto state. Auto state means the
system is using a commit-on-save strategy (actual... | bsd-3-clause |
srenatus/dxr | tests/test_operator_call.py | 6 | 2045 | from dxr.testing import SingleFileTestCase
class OperatorCallTests(SingleFileTestCase):
source = """
struct Foo
{
void operator()(int)
{
}
void operator[](int)
{
}
};
int main()
... | mit |
android-ia/platform_external_chromium_org | build/android/pylib/perf/thermal_throttle.py | 42 | 4532 | # Copyright 2013 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
from pylib import android_commands
from pylib.device import device_utils
class OmapThrottlingDetector(object):
"""Class to detect and trac... | bsd-3-clause |
ftomassetti/intellij-community | python/lib/Lib/site-packages/django/conf/locale/lv/formats.py | 316 | 1490 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = r'Y. \g\a\d\a j. F'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = r'Y. \g\a\d\a ... | apache-2.0 |
gauravbose/digital-menu | digimenu2/build/lib.linux-x86_64-2.7/django/contrib/auth/models.py | 104 | 17967 | from __future__ import unicode_literals
from django.contrib import auth
from django.contrib.auth.hashers import (
check_password, is_password_usable, make_password,
)
from django.contrib.auth.signals import user_logged_in
from django.contrib.contenttypes.models import ContentType
from django.core import validators... | bsd-3-clause |
ShaolongHu/python-nitrate | source/mutable.py | 2 | 54783 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Python API for the Nitrate test case management system.
# Copyright (c) 2012 Red Hat, Inc. All rights reserved.
# Author: Petr Splichal <psplicha@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Th... | lgpl-2.1 |
klnrajareddy/PyGithub | github/CommitComment.py | 72 | 6837 | # -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... | gpl-3.0 |
alex-bauer/kelvin-power-challenge | src/features/features_saaf.py | 1 | 1680 | """Concatenate and resample SAAF data"""
import sys
import os
sys.path.append("../")
from utils.utils import *
folder = config.features_folder
if not os.path.exists(folder):
os.makedirs(folder)
def parse_saaf(filename, dropna=True):
df = pd.read_csv(config.data_folder + '/' + filename)
df = convert_t... | mit |
jkern/bigcouch | couchjs/scons/scons-local-2.0.1/SCons/Tool/rpm.py | 61 | 4549 | """SCons.Tool.rpm
Tool-specific initialization for rpm.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
The rpm tool calls the rpmbuild command. The first and only argument should a
tar.gz consisting of the sourc... | apache-2.0 |
heray1990/google-python-exercises | babynames/babynames.py | 1 | 2636 | #!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
import sys
import re
"""Baby Names exercise
Define the extract_names() function below and c... | apache-2.0 |
hovsepm/AutoRest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/Validation/autorestvalidationtest/auto_rest_validation_test.py | 3 | 12404 | # 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 |
Azulinho/ansible | lib/ansible/modules/cloud/softlayer/sl_vm.py | 52 | 11276 | #!/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)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
sodafree/backend | build/ipython/IPython/frontend/terminal/console/app.py | 3 | 5217 | """ A minimal application using the ZMQ-based terminal IPython frontend.
This is not a complete console app, as subprocess will not be able to receive
input, there is no real readline support, among other limitations.
Authors:
* Min RK
* Paul Ivanov
"""
#------------------------------------------------------------... | bsd-3-clause |
toejoefull/limbo-android | jni/qemu/scripts/tracetool/__init__.py | 205 | 7624 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Machinery for generating tracing-related intermediate files.
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
__copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__m... | gpl-2.0 |
wiki05/youtube-dl | youtube_dl/extractor/tass.py | 166 | 2017 | # encoding: utf-8
from __future__ import unicode_literals
import json
from .common import InfoExtractor
from ..utils import (
js_to_json,
qualities,
)
class TassIE(InfoExtractor):
_VALID_URL = r'https?://(?:tass\.ru|itar-tass\.com)/[^/]+/(?P<id>\d+)'
_TESTS = [
{
'url': 'http://t... | unlicense |
ryanjoneil/docker-image-construction | dicp/solvers/most_common.py | 1 | 1247 | from collections import defaultdict
class MostCommonHeuristic(object):
'''Heuristic that shares the most common command at any point'''
_slug = 'most-common'
def slug(self):
return MostCommonHeuristic._slug
def solve(self, problem, saver):
# Keep track of what hasn't been assigned and... | mit |
zhimin711/nova | nova/tests/unit/api/openstack/compute/test_networks.py | 9 | 33961 | # Copyright 2011 Grid Dynamics
# Copyright 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... | apache-2.0 |
stewartpark/django | django/contrib/gis/gdal/raster/band.py | 28 | 7690 | import math
from ctypes import byref, c_double, c_int, c_void_p
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.gdal.prototypes import raster as capi
from django.contrib.gis.shortcuts import numpy
from django.utils import six
from django... | bsd-3-clause |
RachitKansal/scikit-learn | sklearn/manifold/isomap.py | 229 | 7169 | """Isomap for manifold learning"""
# Author: Jake Vanderplas -- <vanderplas@astro.washington.edu>
# License: BSD 3 clause (C) 2011
import numpy as np
from ..base import BaseEstimator, TransformerMixin
from ..neighbors import NearestNeighbors, kneighbors_graph
from ..utils import check_array
from ..utils.graph import... | bsd-3-clause |
gau-veldt/godot | tools/glwrapper/makewrapper.py | 19 | 3887 | #! /usr/bin/python
import sys
if (len(sys.argv)<2):
print("usage: makewrapper.py <headers>")
sys.exit(255)
functions=[]
types=[]
constants=[]
READ_FUNCTIONS=0
READ_TYPES=1
READ_CONSTANTS=2
read_what=READ_TYPES
for x in (range(len(sys.argv)-1)):
f=open(sys.argv[x+1],"r")
while(True):
line=f.readline(... | mit |
jiajiax/crosswalk-test-suite | webapi/tct-time-tizen-tests/inst.wgt.py | 372 | 6809 | #!/usr/bin/env python
import os
import shutil
import glob
import time
import sys
import subprocess
import string
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PKG_NAME = os.path.basename(SCRIPT_DIR)
PARAMETERS = None
#XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=... | bsd-3-clause |
Facetracker-project/facetracker-core | lib/youtube-dl/youtube_dl/extractor/goshgay.py | 127 | 1579 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import (
compat_parse_qs,
)
from ..utils import (
parse_duration,
)
class GoshgayIE(InfoExtractor):
_VALID_URL = r'https?://www\.goshgay\.com/video(?P<id>\d+?)($|/)'
_TEST = {
'url'... | gpl-2.0 |
dreamsxin/kbengine | kbe/src/lib/python/Lib/idlelib/HyperParser.py | 86 | 12877 | """Provide advanced parsing abilities for ParenMatch and other extensions.
HyperParser uses PyParser. PyParser mostly gives information on the
proper indentation of code. HyperParser gives additional information on
the structure of code.
"""
import string
from keyword import iskeyword
from idlelib import PyParse
... | lgpl-3.0 |
nthiep/global-ssh-server | lib/python2.7/site-packages/oauth2_provider/views/mixins.py | 2 | 8532 | from __future__ import unicode_literals
import logging
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponseForbidden
from ..oauth2_backends import OAuthLibCore
from ..exceptions import FatalClientError
from ..settings import oauth2_settings
log = logging.getLogger("oauth2_pr... | agpl-3.0 |
Balannen/LSMASOMM | atom3/Kernel/ErrorHandlers/exceptionStreamHook.py | 1 | 1233 | """
exceptionStreamHook.py
A custom stderr hook by Denis Dube, http://msdl.cs.mcgill.ca/people/denis/
"""
import tkMessageBox, sys
class exceptionStreamHook:
"""
This class pretends to be an open stderr file stream
Perhaps it should subclass File to be safer... but what would be the default
... | gpl-3.0 |
webjunkie/python-social-auth | social/tests/backends/test_soundcloud.py | 92 | 1631 | import json
from social.tests.backends.oauth import OAuth2Test
class SoundcloudOAuth2Test(OAuth2Test):
backend_path = 'social.backends.soundcloud.SoundcloudOAuth2'
user_data_url = 'https://api.soundcloud.com/me.json'
expected_username = 'foobar'
access_token_body = json.dumps({
'access_token'... | bsd-3-clause |
blademainer/intellij-community | python/helpers/profiler/thriftpy3/transport/TSocket.py | 51 | 5735 | #
# 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 |
AudriusButkevicius/TurboVNC | unix/Xvnc/extras/freetype2/src/autohint/mather.py | 13 | 1621 | #!/usr/bin/env python
#
#
# autohint math table builder
#
# Copyright 1996-2000 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use... | gpl-2.0 |
elliott10/decaf-qemu | tests/qemu-iotests/iotests.py | 23 | 11474 | # Common utilities and Python wrappers for qemu-iotests
#
# Copyright (C) 2012 IBM Corp.
#
# 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) ... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.