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 |
|---|---|---|---|---|---|
Komzpa/omim | 3party/Alohalytics/tests/googletest/test/gtest_help_test.py | 2968 | 5856 | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | apache-2.0 |
RefugeeMatchmaking/HackZurich | GAE_Playground/libs/networkx/algorithms/community/tests/test_kclique.py | 94 | 2152 | #!/usr/bin/env python
from nose.tools import *
import networkx as nx
from itertools import combinations
from networkx import k_clique_communities
def test_overlaping_K5():
G = nx.Graph()
G.add_edges_from(combinations(range(5), 2)) # Add a five clique
G.add_edges_from(combinations(range(2,7), 2)) # Add anot... | mit |
teracyhq/flask-classy | test_classful/test_decorators.py | 2 | 7323 | from flask import Flask
from .view_classes import DecoratedView
from .view_classes import DecoratedBoldListView
from .view_classes import DecoratedBoldItalicsListView
from .view_classes import DecoratedListMemberView
from .view_classes import DecoratedListFunctionAttributesView
from .view_classes import DecoratedListMe... | bsd-3-clause |
heeraj123/oh-mainline | vendor/packages/whoosh/src/whoosh/sorting.py | 17 | 33168 | # Copyright 2011 Matt Chaput. 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,
# this list of conditions and the... | agpl-3.0 |
aristanetworks/arista-ovs-nova | nova/scheduler/weights/__init__.py | 4 | 1846 | # Copyright (c) 2011 OpenStack, LLC.
# 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 requi... | apache-2.0 |
inares/edx-platform | common/lib/capa/capa/tests/test_customrender.py | 160 | 2278 | from lxml import etree
import unittest
import xml.sax.saxutils as saxutils
from . import test_capa_system
from capa import customrender
# just a handy shortcut
lookup_tag = customrender.registry.get_class_for_tag
def extract_context(xml):
"""
Given an xml element corresponding to the output of test_capa_sys... | agpl-3.0 |
AIFDR/inasafe | safe/metadata35/encoder.py | 6 | 1214 | # -*- coding: utf-8 -*-
"""
InaSAFE Disaster risk assessment tool developed by AusAid -
**metadata module.**
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Sof... | gpl-3.0 |
fjtc/gtest-tools | gtestgen/tests/test_core.py | 1 | 7457 | # Copyright (c) 2015, FJTC
# 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 follow... | bsd-3-clause |
hnakamur/ansible | lib/ansible/plugins/inventory/directory.py | 74 | 1991 | # (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 |
2mny/mylar | lib/cherrypy/_cpnative_server.py | 87 | 6044 | """Native adapter for serving CherryPy via its builtin server."""
import logging
import sys
import cherrypy
from cherrypy._cpcompat import BytesIO
from cherrypy._cperror import format_exc, bare_error
from cherrypy.lib import httputil
from cherrypy import wsgiserver
class NativeGateway(wsgiserver.Gateway):
... | gpl-3.0 |
40223204/w16b_test | static/Brython3.1.3-20150514-095342/Lib/html/parser.py | 737 | 19605 | """A parser for HTML and XHTML."""
# This file is based on sgmllib.py, but the API is slightly different.
# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable character
# data -- only char and entity references and end tags are special)
# and CDAT... | agpl-3.0 |
klondi/mimicmod-lan | src/core/config.py | 5 | 8720 | #!/usr/bin/env python
"""
uhub - A tiny ADC p2p connection hub
Copyright (C) 2007-2013, Jan Vidar Krey
"""
from xml.dom import minidom, Node
from datetime import datetime
import argparse
class OptionParseError(Exception):
pass
class Option(object):
def _get(self, node, name):
self.__dict__[name] = None
if ... | gpl-3.0 |
iwm911/plaso | plaso/formatters/mcafeeav.py | 1 | 1238 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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 L... | apache-2.0 |
scopatz/rever | tests/test_docker.py | 2 | 8063 | """Docker Tests"""
import os
import builtins
import tempfile
import pytest
from rever import environ
from rever.docker import (apt_deps, conda_deps, pip_deps, make_base_dockerfile,
docker_envvars, make_install_dockerfile, docker_source_from, git_configure, validate_mount,
mount_argument)
@pytest.fixture
def... | bsd-3-clause |
chokribr/PIST | modules/websubmit/lib/functions/Move_Files_Archive.py | 24 | 2177 | ## This file is part of Invenio.
## Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your ... | gpl-2.0 |
abdelkimo/or-tools | examples/python/integer_programming.py | 32 | 4426 | # Copyright 2010-2014 Google
# 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, so... | apache-2.0 |
gaoxiaofeng/troubleShooting | src/troubleshooting/framework/httpserver/CGIHTTPServer.py | 23 | 13089 | """CGI-savvy HTTP Server.
This module builds on SimpleHTTPServer by implementing GET and POST
requests to cgi-bin scripts.
If the os.fork() function is not present (e.g. on Windows),
os.popen2() is used as a fallback, with slightly altered semantics; if
that function is not present either (e.g. on Macintosh), only Py... | apache-2.0 |
goliveirab/odoo | addons/crm_claim/__openerp__.py | 260 | 1939 | # -*- 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 |
mollie/mollie-api-python | tests/test_client.py | 1 | 18333 | import re
import sys
import time
from datetime import datetime
import pytest
import requests.adapters
from mollie.api.client import Client, generate_querystring
from mollie.api.error import (
DataConsistencyError,
IdentifierError,
NotFoundError,
RequestError,
RequestSetupError,
ResponseError,
... | bsd-2-clause |
tejasnikumbh/ThesisCode | lib/python2.7/site-packages/numpy/lib/info.py | 69 | 6306 | """
Basic functions used by several sub-packages and
useful to have in the main name-space.
Type Handling
-------------
================ ===================
iscomplexobj Test for complex object, scalar result
isrealobj Test for real object, scalar result
iscomplex Test for complex elements, array res... | mit |
pnavarro/neutron | neutron/agent/linux/ip_monitor.py | 30 | 2680 | # Copyright 2015 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | apache-2.0 |
Endika/OpenUpgrade | addons/mass_mailing/__openerp__.py | 312 | 2226 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
Tesi-Luca-Davide/ryu | ryu/tests/unit/ofproto/test_ether.py | 63 | 1101 | # Copyright (C) 2012 Nippon Telegraph and Telephone 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 appli... | apache-2.0 |
Endika/server-tools | disable_openerp_online/__openerp__.py | 23 | 1861 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | agpl-3.0 |
wangxuan007/flasky | venv/lib/python2.7/site-packages/flask/json.py | 428 | 8113 | # -*- coding: utf-8 -*-
"""
flask.jsonimpl
~~~~~~~~~~~~~~
Implementation helpers for the JSON support in Flask.
:copyright: (c) 2012 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import io
import uuid
from datetime import datetime
from .globals import current_app, request
fro... | gpl-3.0 |
poulpito/Flexget | flexget/plugins/daemon/irc.py | 1 | 41096 | from __future__ import unicode_literals, division, absolute_import, with_statement
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from past.builtins import basestring
from future.moves.urllib.parse import quote
import os
import re
import threading
import logging
from xml.etree.ElementT... | mit |
2014c2g3/0623exam | static/Brython3.1.1-20150328-091302/Lib/site-packages/pygame/image_1.py | 603 | 19603 | #!/usr/bin/env python
'''Pygame module for image transfer.
The image module contains functions for loading and saving pictures, as
well as transferring Surfaces to formats usable by other packages.
Note that there is no Image class; an image is loaded as a
Surface object. The Surface class allows manipulation (drawi... | gpl-3.0 |
WillisXChen/django-oscar | oscar/lib/python2.7/site-packages/django/utils/dictconfig.py | 82 | 23227 | import logging.handlers
import re
import sys
import types
import warnings
from django.utils import six
from django.utils.deprecation import RemovedInDjango19Warning
warnings.warn("django.utils.dictconfig will be removed in Django 1.9.",
RemovedInDjango19Warning, stacklevel=2)
# This is a copy of the Python loggi... | bsd-3-clause |
woltage/ansible-modules-core | utilities/helper/fireball.py | 132 | 8066 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, 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... | gpl-3.0 |
proxysh/Safejumper-for-Mac | buildlinux/env32/lib/python2.7/site-packages/Crypto/SelfTest/Hash/test_SHA384.py | 116 | 2762 | # -*- coding: utf-8 -*-
#
# SelfTest/Hash/test_SHA.py: Self-test for the SHA-384 hash function
#
# Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that de... | gpl-2.0 |
ademmers/ansible | lib/ansible/plugins/callback/minimal.py | 29 | 3025 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
... | gpl-3.0 |
harmattan/fremantleline | fremantleline/lib/html5lib/utils.py | 60 | 3255 | from __future__ import absolute_import, division, unicode_literals
from types import ModuleType
from six import text_type
try:
import xml.etree.cElementTree as default_etree
except ImportError:
import xml.etree.ElementTree as default_etree
__all__ = ["default_etree", "MethodDispatcher", "isSurrogatePair",
... | gpl-3.0 |
hargup/sympy | sympy/strategies/tests/test_traverse.py | 16 | 1853 | from sympy.strategies.traverse import (top_down, bottom_up, sall, top_down_once,
bottom_up_once, basic_fns)
from sympy.strategies.util import expr_fns
from sympy import Basic, symbols, Symbol, S
zero_symbols = lambda x: S.Zero if isinstance(x, Symbol) else x
x,y,z = symbols('x,y,z')
def test_sall():
zero_... | bsd-3-clause |
rvalyi/OpenUpgrade | addons/document/odt2txt.py | 435 | 2110 | #!/usr/bin/python
# -*- 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 unde... | agpl-3.0 |
damonkohler/sl4a | python/src/Lib/test/test_struct.py | 53 | 24379 | import array
import unittest
import struct
import warnings
warnings.filterwarnings("ignore", "struct integer overflow masking is deprecated",
DeprecationWarning)
from functools import wraps
from test.test_support import TestFailed, verbose, run_unittest
import sys
ISBIGENDIAN = sys.byteorder =... | apache-2.0 |
JoshDaly/footballdb | build/lib.linux-x86_64-2.7/footballdb/db.py | 4 | 5333 | #!/usr/bin/python
###############################################################################
# #
# db.py #
# ... | gpl-2.0 |
ncteisen/grpc | src/boringssl/gen_build_yaml.py | 11 | 4803 | #!/usr/bin/env python2.7
# Copyright 2015 gRPC authors.
#
# 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 la... | apache-2.0 |
adpg211/bitcoin-master | qa/rpc-tests/forknotify.py | 4 | 2327 | #!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test -alertnotify
#
from test_framework.test_framework import BitcoinTestFramework
from test_framew... | mit |
jarrodmcc/OpenFermion | src/openfermion/utils/_sparse_tools_test.py | 1 | 55877 | # 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
# distribu... | apache-2.0 |
3dfxmadscientist/odoo_vi | openerp/addons/base/tests/test_misc.py | 393 | 1111 | import unittest2
from openerp.tools import misc
class test_countingstream(unittest2.TestCase):
def test_empty_stream(self):
s = misc.CountingStream(iter([]))
self.assertEqual(s.index, -1)
self.assertIsNone(next(s, None))
self.assertEqual(s.index, 0)
def test_single(self):
... | agpl-3.0 |
rchuppala/usc_agent | src/usc-agent-dev/common/source/pyang/pyang/syntax.py | 1 | 11073 | """Description of YANG & YIN syntax."""
import re
### Regular expressions - constraints on arguments
# keywords and identifiers
identifier = r"[_A-Za-z][._\-A-Za-z0-9]*"
prefix = identifier
keyword = '((' + prefix + '):)?(' + identifier + ')'
# no group version of keyword
keyword_ng = '(?:(' + prefix + '):)?(?:' + ... | gpl-2.0 |
albertomurillo/ansible | lib/ansible/plugins/inventory/docker_swarm.py | 37 | 11922 | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Stefan Heitmueller <stefan.heitmueller@gmx.com>
# Copyright (c) 2018 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
DOCUM... | gpl-3.0 |
kaarolch/ansible | lib/ansible/modules/source_control/hg.py | 25 | 10473 | #!/usr/bin/python
#-*- coding: utf-8 -*-
# (c) 2013, Yeukhon Wong <yeukhon@acm.org>
# (c) 2014, Nate Coraor <nate@bx.psu.edu>
#
# This module was originally inspired by Brad Olson's ansible-module-mercurial
# <https://github.com/bradobro/ansible-module-mercurial>. This module tends
# to follow the git module implement... | gpl-3.0 |
bocaaust/FreshLife | django_project/fresh_life/fresh_life/wsgi.py | 1 | 1431 | """
WSGI config for fresh_life project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION... | apache-2.0 |
windyuuy/opera | chromium/src/third_party/python_26/Lib/markupbase.py | 243 | 14350 | """Shared support for scanning document type declarations in HTML and XHTML.
This module is used as a foundation for the HTMLParser and sgmllib
modules (indirectly, for htmllib as well). It has no documented
public API and should not be used directly.
"""
import re
_declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z... | bsd-3-clause |
tealover/nova | nova/network/manager.py | 6 | 96421 | # Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you... | apache-2.0 |
Kazade/NeHe-Website | google_appengine/lib/django-1.3/django/core/serializers/json.py | 204 | 1920 | """
Serialize data to/from JSON
"""
import datetime
import decimal
from StringIO import StringIO
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer
from django.utils import datetime_safe
from django.utils import simpl... | bsd-3-clause |
ledtvavs/repository.ledtv | script.module.nanscrapers/lib/nanscrapers/modules/js2py/prototypes/jsjson.py | 6 | 6403 | import json
from nanscrapers.modules.js2py.base import Js
indent = ''
# python 3 support
import six
if six.PY3:
basestring = str
long = int
xrange = range
unicode = str
def parse(text):
reviver = arguments[1]
s = text.to_string().value
try:
unfiltered = json.loads(s)
except:
... | gpl-3.0 |
Azure/azure-sdk-for-python | sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_endpoint_connections_operations.py | 1 | 20474 | # 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 |
ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/django/utils/tzinfo.py | 82 | 3932 | "Implementation of tzinfo classes for use with datetime.datetime."
from __future__ import unicode_literals
import time
import warnings
from datetime import timedelta, tzinfo
from django.utils.deprecation import RemovedInDjango19Warning
from django.utils.encoding import (
DEFAULT_LOCALE_ENCODING, force_str, force... | mit |
BruceDai/crosswalk-test-suite | webapi/tct-browserstate-html5-tests/inst.apk.py | 1996 | 3186 | #!/usr/bin/env python
import os
import shutil
import glob
import time
import sys
import subprocess
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PARAMETERS = None
ADB_CMD = "adb"
def doCMD(cmd):
# Do not need handle timeout in this short script, let tool... | bsd-3-clause |
adamjerickson/namerizer | node_modules/grunt-sass/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py | 1869 | 1247 | # Copyright 2014 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.
"""A clone of the default copy.deepcopy that doesn't handle cyclic
structures or complex types except for dicts and lists. This is
because gyp copies so large structur... | mit |
Danielhiversen/home-assistant | homeassistant/components/light/wemo.py | 2 | 7476 | """
Support for Belkin WeMo lights.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/light.wemo/
"""
import logging
from datetime import timedelta
import requests
from homeassistant import util
from homeassistant.components.light import (
Light, ATTR... | mit |
Tokyo-Buffalo/tokyosouth | env/lib/python3.6/site-packages/zope/interface/exceptions.py | 86 | 1999 | ##############################################################################
#
# Copyright (c) 2002 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... | mit |
def-/commandergenius | project/jni/python/src/Lib/encodings/iso2022_jp_2.py | 816 | 1061 | #
# iso2022_jp_2.py: Python Unicode Codec for ISO2022_JP_2
#
# Written by Hye-Shik Chang <perky@FreeBSD.org>
#
import _codecs_iso2022, codecs
import _multibytecodec as mbc
codec = _codecs_iso2022.getcodec('iso2022_jp_2')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class Incrementa... | lgpl-2.1 |
ibab/tensorflow | tensorflow/user_ops/ackermann_test.py | 15 | 1382 | # Copyright 2015 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 by applicable law or a... | apache-2.0 |
louyihua/edx-platform | lms/djangoapps/bulk_email/tests/test_err_handling.py | 6 | 17900 | # -*- coding: utf-8 -*-
"""
Unit tests for handling email sending errors
"""
from itertools import cycle
from celery.states import SUCCESS, RETRY # pylint: disable=no-name-in-module, import-error
from django.conf import settings
from django.core.management import call_command
from django.core.urlresolvers import reve... | agpl-3.0 |
yangleo/cloud-github | openstack_dashboard/dashboards/project/routers/extensions/routerrules/tables.py | 11 | 2755 | # Copyright 2013, Big Switch Networks, 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 applicabl... | apache-2.0 |
synergeticsedx/deployment-wipro | openedx/core/djangoapps/embargo/test_utils.py | 9 | 2876 | """Utilities for writing unit tests that involve course embargos. """
import contextlib
import mock
import pygeoip
from django.core.urlresolvers import reverse
from django.core.cache import cache
from .models import Country, CountryAccessRule, RestrictedCourse
@contextlib.contextmanager
def restrict_course(course_k... | agpl-3.0 |
joshuajan/odoo | addons/account/report/account_balance.py | 183 | 6162 | # -*- 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 |
eventql/eventql | deps/3rdparty/spidermonkey/mozjs/python/requests/requests/packages/urllib3/util/connection.py | 252 | 3265 | import socket
try:
from select import poll, POLLIN
except ImportError: # `poll` doesn't exist on OSX and other platforms
poll = False
try:
from select import select
except ImportError: # `select` doesn't exist on AppEngine.
select = False
def is_connection_dropped(conn): # Platform-... | agpl-3.0 |
spiritlinxl/BTCGPU | test/functional/getchaintips.py | 35 | 2237 | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the getchaintips RPC.
- introduce a network split
- work on chains of different lengths
- join th... | mit |
DirtyPiece/dancestudio | Build/Tools/Python27/Lib/test/test_calendar.py | 73 | 28850 | import calendar
import unittest
from test import test_support
import locale
import datetime
result_2004_text = """
2004
January February March
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 3 4 ... | mit |
ngokevin/zamboni | mkt/operators/tests/test_authorization.py | 1 | 5750 | from nose.tools import ok_
from rest_framework.generics import GenericAPIView
from django.contrib.auth.models import AnonymousUser
from amo.tests import TestCase
from mkt.access.middleware import ACLMiddleware
from mkt.carriers import CARRIER_MAP as CARRIERS
from mkt.feed.constants import FEED_TYPE_SHELF
from mkt.fee... | bsd-3-clause |
fartashf/python-mode | pymode/libs3/rope/base/resourceobserver.py | 91 | 10266 | import os
class ResourceObserver(object):
"""Provides the interface for observing resources
`ResourceObserver`\s can be registered using `Project.
add_observer()`. But most of the time `FilteredResourceObserver`
should be used. `ResourceObserver`\s report all changes passed
to them and they don... | lgpl-3.0 |
VarnaSuresh/oneanddone | oneanddone/users/models.py | 4 | 4485 | # 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 django.contrib.auth.models import User, UserManager
from django.core.urlresolvers import reverse
from django.db imp... | mpl-2.0 |
alanjw/GreenOpenERP-Win-X86 | python/Lib/site-packages/win32com/test/daodump.py | 4 | 2086 | # import dao3032
# No longer imported here - callers responsibility to load
#
import win32com.client
def DumpDB(db, bDeep = 1):
# MUST be a DB object.
DumpTables(db,bDeep)
DumpRelations(db,bDeep)
DumpAllContainers(db,bDeep)
def DumpTables(db, bDeep = 1):
for tab in db.TableDefs:
... | agpl-3.0 |
vegetalte-dev/DEPRECATED_android_kernel_bq_vegetalte | tools/perf/python/twatch.py | 7370 | 1334 | #! /usr/bin/python
# -*- python -*-
# -*- coding: utf-8 -*-
# twatch - Experimental use of the perf python interface
# Copyright (C) 2011 Arnaldo Carvalho de Melo <acme@redhat.com>
#
# This application is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License... | gpl-2.0 |
joke2k/faker | faker/providers/currency/th_TH/__init__.py | 1 | 10596 | from .. import Provider as CurrencyProvider
# Names taken from https://std.moc.go.th/std/codelist_detail/40
class Provider(CurrencyProvider):
# Format: (code, name)
currencies = (
("AED", "ดีแรห์ม สหรัฐอาหรับเอมิเรตส์"),
("AFN", "อัฟกานิ"),
("ALL", "เลค"),
("AMD", "ดีแรห์ม อาร... | mit |
mrquim/repository.mrquim | script.module.youtube.dl/lib/youtube_dl/extractor/lrt.py | 67 | 3234 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
int_or_none,
parse_duration,
remove_end,
)
class LRTIE(InfoExtractor):
IE_NAME = 'lrt.lt'
_VALID_URL = r'https?://(?:www\.)?lrt\.lt/mediateka/irasas/(?P<id... | gpl-2.0 |
helldorado/ansible | lib/ansible/modules/network/fortios/fortios_firewall_shaper_per_ip_shaper.py | 24 | 10184 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 Lic... | gpl-3.0 |
ishay2b/tensorflow | tensorflow/python/estimator/export/export_output.py | 37 | 6732 | # Copyright 2017 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 |
obedmr/MPIaaS | app/echoserv.py | 1 | 1498 | #!/usr/bin/env python
from twisted.internet.protocol import Protocol, Factory
from twisted.internet import reactor
import twisted.internet.error
import sys
import ConfigParser
CONFIG_CONF = "setup.conf"
PORT=8000
class Echo(Protocol):
def dataReceived(self, data):
"""
As soon as any data is rece... | apache-2.0 |
Jgarcia-IAS/localizacion | openerp/addons-extra/odoo-pruebas/odoo-server/addons/account_asset/wizard/__init__.py | 445 | 1122 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | agpl-3.0 |
cpallares/glance_store | glance_store/_drivers/sheepdog.py | 4 | 10959 | # Copyright 2013 Taobao Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | apache-2.0 |
pyfirst/samplecode | 6_web/brickset_app/brickset_app/urls.py | 2 | 1112 | """brickset_app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cla... | mit |
omerxx/slapybot | setup.py | 5 | 1237 | from os.path import join, dirname
from setuptools import setup, find_packages
__version__ = open(join(dirname(__file__), 'slackbot/VERSION')).read().strip()
install_requires = (
'requests>=2.4.0',
'websocket-client>=0.22.0',
'slacker>=0.5.5',
'six>=1.10.0'
) # yapf: disable
excludes = (
'*test*',... | mit |
rahushen/ansible | lib/ansible/modules/cloud/azure/azure_rm_acs.py | 22 | 29386 | #!/usr/bin/python
#
# Copyright (c) 2017 Julien Stroheker, <juliens@microsoft.com>
#
# 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 |
aalmah/pylearn2 | pylearn2/models/kmeans.py | 44 | 7901 | """K-means as a postprocessing Block subclass."""
import logging
import numpy
from theano.compat.six.moves import xrange
from pylearn2.blocks import Block
from pylearn2.models.model import Model
from pylearn2.space import VectorSpace
from pylearn2.utils import sharedX
from pylearn2.utils.mem import improve_memory_erro... | bsd-3-clause |
rwatson/chromium-capsicum | third_party/scons/scons-local/SCons/Tool/applelink.py | 3 | 2734 | """SCons.Tool.applelink
Tool-specific initialization for the Apple gnu-like linker.
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.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The ... | bsd-3-clause |
elijah513/django | tests/admin_views/models.py | 87 | 24003 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import os
import tempfile
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.core.e... | bsd-3-clause |
Oslandia/vizitown_plugin | twisted/internet/gtk3reactor.py | 62 | 2252 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This module provides support for Twisted to interact with the gtk3 mainloop
via Gobject introspection. This is like gi, but slightly slower and requires a
working $DISPLAY.
In order to use this support, simply do the following::
from twi... | gpl-2.0 |
joopert/home-assistant | homeassistant/components/sisyphus/__init__.py | 4 | 3823 | """Support for controlling Sisyphus Kinetic Art Tables."""
import asyncio
import logging
from sisyphus_control import Table
import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_NAME, EVENT_HOMEASSISTANT_STOP
from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassist... | apache-2.0 |
xiangshouding/nv | node/node_modules/pygmentize-bundled/vendor/pygments/build-2.7/pygments/formatters/bbcode.py | 135 | 3314 | # -*- coding: utf-8 -*-
"""
pygments.formatters.bbcode
~~~~~~~~~~~~~~~~~~~~~~~~~~
BBcode formatter.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.formatter import Formatter
from pygments.util import get_bool_opt
__al... | bsd-3-clause |
avlach/univbris-ocf | expedient/src/python/expedient/common/rpc4django/rpcdispatcher.py | 4 | 9345 | '''
RPC Dispatcher
--------------
This module contains the classes necessary to handle both
`jsonrpc <http://json-rpc.org/>`_ and
`xmlrpc <http://www.xmlrpc.com/>`_ requests.
It also contains a decorator to mark methods as rpc methods.
'''
import inspect
import pydoc
import xmlrpclib
from xmlrpclib import Fault
fro... | bsd-3-clause |
qedsoftware/commcare-hq | custom/ilsgateway/tests/handlers/utils.py | 1 | 8375 | from corehq.apps.accounting.models import BillingAccount, DefaultProductPlan, SoftwarePlanEdition, Subscription
from corehq.apps.accounting.tests import generator
from corehq.apps.commtrack.models import CommtrackActionConfig
from corehq.apps.custom_data_fields import CustomDataFieldsDefinition
from corehq.apps.custom_... | bsd-3-clause |
xavierhardy/libvirt | src/hyperv/hyperv_wmi_generator.py | 46 | 9395 | #!/usr/bin/env python
#
# hyperv_wmi_generator.py: generates most of the WMI type mapping code
#
# Copyright (C) 2011 Matthias Bolte <matthias.bolte@googlemail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by t... | gpl-2.0 |
DirtyUnicorns/android_external_chromium_org | tools/perf/benchmarks/scheduler.py | 29 | 1109 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import benchmark
from measurements import smoothness
import page_sets
class SchedulerToughSchedulingCases(benchmark.Benchmark):
"""Measure... | bsd-3-clause |
gustavrannestig/otp_twilio_encrypted | otp_twilio_encrypted/tests.py | 2 | 4320 | from __future__ import absolute_import, division, print_function, unicode_literals
import re
from django.db import IntegrityError
from django.test.utils import override_settings
from django_otp.tests import TestCase
from .conf import settings
@override_settings(
OTP_TWILIO_NO_DELIVERY=True,
OTP_TWILIO_CHA... | bsd-2-clause |
tedder/ansible | test/units/modules/network/f5/test_bigip_gtm_monitor_tcp.py | 21 | 6810 | # -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, 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 |
zulip/django | tests/syndication_tests/urls.py | 236 | 1027 | from django.conf.urls import url
from . import feeds
urlpatterns = [
url(r'^syndication/rss2/$', feeds.TestRss2Feed()),
url(r'^syndication/rss2/guid_ispermalink_true/$',
feeds.TestRss2FeedWithGuidIsPermaLinkTrue()),
url(r'^syndication/rss2/guid_ispermalink_false/$',
feeds.TestRss2FeedWithG... | bsd-3-clause |
archf/ansible | lib/ansible/modules/packaging/os/yum_repository.py | 12 | 25593 | #!/usr/bin/python
# encoding: utf-8
# (c) 2015-2016, Jiri Tyr <jiri.tyr@gmail.com>
#
# 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 |
SimoneLucia/EmbASP-Python | languages/asp/answer_set.py | 1 | 1221 | from languages.asp.asp_mapper import ASPMapper
class AnserSet(object):
"""A collection of data representing a generic Answer Set"""
def __init__(self, value, weightMap=dict()):
self.__value = value # Where data of answer set is stored
self.__weight_map = weightMap # Where weights of the ... | mit |
Kazade/NeHe-Website | google_appengine/lib/django-1.4/tests/modeltests/or_lookups/tests.py | 150 | 7625 | from __future__ import absolute_import
from datetime import datetime
from operator import attrgetter
from django.db.models import Q
from django.test import TestCase
from .models import Article
class OrLookupsTests(TestCase):
def setUp(self):
self.a1 = Article.objects.create(
headline='Hell... | bsd-3-clause |
jk1/intellij-community | python/helpers/pydev/pydevd_attach_to_process/winappdbg/win32/dbghelp.py | 88 | 46488 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2014, Mario Vilas
# 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... | apache-2.0 |
seem-sky/kbengine | kbe/src/lib/python/Lib/fnmatch.py | 894 | 3163 | """Filename matching with shell patterns.
fnmatch(FILENAME, PATTERN) matches according to the local convention.
fnmatchcase(FILENAME, PATTERN) always takes case in account.
The functions operate by translating the pattern into a regular
expression. They cache the compiled regular expressions for speed.
The function... | lgpl-3.0 |
amith01994/intellij-community | python/lib/Lib/site-packages/django/views/decorators/csrf.py | 227 | 2240 | from django.middleware.csrf import CsrfViewMiddleware
from django.utils.decorators import decorator_from_middleware, available_attrs
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
csrf_protect = decorator_from_middleware(CsrfViewMiddlewar... | apache-2.0 |
romonzaman/newfies-dialer | newfies/dialer_campaign/management/commands/create_subscriber.py | 4 | 2890 | #
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# 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/.
#
# Copyright (C) 2011-2015 Star2Billing S.L.
#
# The primar... | mpl-2.0 |
davidmueller13/L900_3.8_Experiment | tools/perf/util/setup.py | 220 | 1407 | #!/usr/bin/python2
from distutils.core import setup, Extension
from os import getenv
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_optio... | gpl-2.0 |
ahh2131/mchisel | blockrotation.py | 3 | 15883 | import materials
from materials import alphaMaterials
from numpy import arange, zeros
def genericVerticalFlip(cls):
rotation = arange(16, dtype='uint8')
if hasattr(cls, "Up") and hasattr(cls, "Down"):
rotation[cls.Up] = cls.Down
rotation[cls.Down] = cls.Up
if hasattr(cls, "TopNorth") and ... | isc |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.