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 |
|---|---|---|---|---|---|
tkanemoto/unittest-xml-reporting | xmlrunner/result.py | 1 | 18019 |
import os
import sys
import time
import traceback
import six
import re
from os import path
from six import unichr
from six.moves import StringIO
from .unittest import TestResult, _TextTestResult
# Matches invalid XML1.0 unicode characters, like control characters:
# http://www.w3.org/TR/2006/REC-xml-20060816/#chars... | bsd-2-clause |
yonglehou/spiderfoot | ext/openxmllib/shell.py | 8 | 4048 | #! python
# -*- coding: utf-8 -*-
# $Id: shell.py 61 2009-12-18 10:53:19Z gilles.lenfant $
"""Command line tool"""
import os
import optparse
import time
import codecs
import locale
import types
import openxmllib
DEFAULT_CHARSET = locale.getpreferredencoding()
USAGE = """%%prog [options] command file
Version: %s
%s
Co... | gpl-2.0 |
gpagliuca/pyfas | docs/conf.py | 2 | 4795 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Pyfas documentation build configuration file, created by
# sphinx-quickstart on Tue Jan 24 11:31:38 2017.
#
# 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
# auto... | gpl-3.0 |
mpurzynski/MozDef | alerts/plugins/geomodel_ipintel_enrichment.py | 2 | 3663 | # 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 https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import json
import os
import typing as types
CONFIG_FILE = os.path.join(
... | mpl-2.0 |
lupyuen/RaspberryPiImage | home/pi/GrovePi/Software/Python/others/temboo/Library/PayPal/Payments/VerifyCreditCardPayment.py | 5 | 5434 | # -*- coding: utf-8 -*-
###############################################################################
#
# VerifyCreditCardPayment
# Verifies that a credit card payment from the PayPal REST API has been completed successfully.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Ap... | apache-2.0 |
qboster/parallel-ssh | psshlib/cli.py | 58 | 4364 | # Copyright (c) 2009-2012, Andrew McNabb
# Copyright (c) 2003-2008, Brent N. Chun
import optparse
import os
import shlex
import sys
import textwrap
from psshlib import version
_DEFAULT_PARALLELISM = 32
_DEFAULT_TIMEOUT = 0 # "infinity" by default
def common_parser():
"""
Create a basic OptionParser wit... | bsd-3-clause |
nii-cloud/dodai-compute | nova/scheduler/filters/instance_type_filter.py | 3 | 3532 | # 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 |
googleads/google-ads-python | google/ads/googleads/v8/services/services/domain_category_service/transports/base.py | 1 | 3692 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | apache-2.0 |
ask/kamqp | kamqp/client_0_8/basic_message.py | 1 | 3707 | # Copyright (C) 2007-2008 Barry Pederson <bp@barryp.org>
#
# 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 the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# ... | lgpl-2.1 |
dntt1/youtube-dl | youtube_dl/extractor/macgamestore.py | 142 | 1275 | from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import ExtractorError
class MacGameStoreIE(InfoExtractor):
IE_NAME = 'macgamestore'
IE_DESC = 'MacGameStore trailers'
_VALID_URL = r'https?://www\.macgamestore\.com/mediaviewer\.php\?trailer=(?P<id>\d+)'
_TEST = {... | unlicense |
openearth/aeolis-python | aeolis/gridparams.py | 1 | 6901 | '''This file is part of AeoLiS.
AeoLiS 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.
AeoLiS is distributed in the hope that it will... | gpl-3.0 |
Marx86/xqueue | test_framework/integration_framework.py | 5 | 25363 | """
Framework for writing integration tests for xqueue and external
graders at the level of HTTP requests.
Basic xqueue communication:
1) XQueueTestClient --(push)--> xqueue --(push/pull)--> GraderStub subclass
2) GraderStub subclass --(push)--> xqueue --(push)--> GradeResponseListener
Test cases verify that t... | agpl-3.0 |
jcoady9/python-for-android | python3-alpha/python3-src/Lib/sqlite3/test/regression.py | 46 | 10666 | #-*- coding: ISO-8859-1 -*-
# pysqlite2/test/regression.py: pysqlite regression tests
#
# Copyright (C) 2006-2010 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any dama... | apache-2.0 |
Sotera/datawake-prefetch | server/datawake/plugin/scraper.py | 3 | 2922 | """
Copyright 2014 Sotera Defense Solutions, 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... | apache-2.0 |
jpirko/lnst | lnst/Recipes/ENRT/VlansOverTeamRecipe.py | 1 | 6663 | from lnst.Common.Parameters import Param, StrParam
from lnst.Common.IpAddress import ipaddress
from lnst.Controller import HostReq, DeviceReq, RecipeParam
from lnst.Recipes.ENRT.BaseEnrtRecipe import BaseEnrtRecipe
from lnst.Recipes.ENRT.ConfigMixins.OffloadSubConfigMixin import (
OffloadSubConfigMixin)
from lnst.R... | gpl-2.0 |
Azure/azure-linux-extensions | Common/libpsutil/py2.6-glibc-2.12-pre/psutil/_pswindows.py | 37 | 15618 | #!/usr/bin/env python
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Windows platform implementation."""
import errno
import functools
import os
from collections import namedtuple
from psutil impo... | apache-2.0 |
ashokpant/shotcut | scripts/make-ico.py | 13 | 3092 | #! /usr/bin/env python
"""
make-ico.py
LICENSE: This program is put into the public domain by James Stroud, 2008.
"""
import sys
import os
import base64
win16map = """\
UDYKMTYgMQoyNTUKAAAAgAAAAP//AP8AwMDAAICA/wD//wAAgICAAACAgACA//////8AAIAAgIAA
AAD/
"""
def err(msg):
sys.stderr.write("%s\n" % msg)
def usage(er... | gpl-3.0 |
kod3r/miasm | test/arch/msp430/sem.py | 6 | 8719 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import unittest
import logging
from miasm2.ir.symbexec import symbexec
from miasm2.arch.msp430.arch import mn_msp430 as mn, mode_msp430 as mode
from miasm2.arch.msp430.sem import ir_msp430 as ir_arch
from miasm2.arch.msp430.regs import *
from miasm2.expression.expression im... | gpl-2.0 |
CyanogenMod/android_kernel_samsung_aries | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py | 12527 | 1935 | # Util.py - Python extension for perf script, miscellaneous utility code
#
# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
import errno, os
FUTEX_WAIT = 0... | gpl-2.0 |
yujikato/DIRAC | tests/Integration/ProductionSystem/Test_Client_TS_Prod.py | 2 | 10220 | """ This is a test of the chain
ProductionClient -> ProductionManagerHandler -> ProductionDB
It supposes that the ProductionDB, TransformationDB and the FileCatalogDB to be present
It supposes the ProductionManager, TransformationManager and that DataManagement/FileCatalog services running
"""
from __futur... | gpl-3.0 |
andela-bojengwa/talk | venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/mbcsgroupprober.py | 2769 | 1967 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... | mit |
CopeX/odoo | addons/mrp_repair/wizard/make_invoice.py | 172 | 3150 | # -*- 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 |
michaeltchapman/kubernetes | cluster/juju/charms/trusty/kubernetes-master/unit_tests/kubernetes_installer_test.py | 213 | 4910 | #!/usr/bin/env python
# Copyright 2015 The Kubernetes 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
#
# Unle... | apache-2.0 |
manojadd/bob-demo | node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py | 1283 | 65086 | # 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.
"""
This module contains classes that help to emulate xcodebuild behavior on top of
other build systems, such as make and ninja.
"""
import copy
import gyp.common... | mit |
biicode/common | edition/processors/cpp_implementation.py | 3 | 3907 | from biicode.common.model.bii_type import BiiType, CPP
import os
from collections import defaultdict
from biicode.common.edition.parsing.code_reference import CPPItem
class CPPImplementationsProcessor(object):
'''
processor to detect implementations in C++, a very difficult task, so this processor is not
... | mit |
sony/nnabla | python/src/nnabla/utils/nnp_graph.py | 1 | 10867 | # Copyright 2018,2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group 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
#... | apache-2.0 |
nharraud/b2share | invenio/modules/oauthclient/views/client.py | 2 | 6453 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014, 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any... | gpl-2.0 |
benregn/itu-courses | docs/source/_themes/flask_theme_support.py | 2228 | 4875 | # flasky extensions. flasky pygments style based on tango style
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, \
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
class FlaskyStyle(Style):
background_color = "#f8f8f8"
default_style = "... | mit |
ubiar/odoo | addons/edi/models/res_currency.py | 437 | 2892 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2011-2012 OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | agpl-3.0 |
sinpantuflas/aubio | python/tests/test_fft.py | 14 | 3868 | #! /usr/bin/env python
from numpy.testing import TestCase, run_module_suite
from numpy.testing import assert_equal, assert_almost_equal
from aubio import fvec, fft, cvec
from numpy import array, shape
from math import pi
class aubio_fft_test_case(TestCase):
def test_members(self):
""" check members are s... | gpl-3.0 |
jakirkham/bokeh | bokeh/command/tests/test_bootstrap.py | 3 | 3040 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2018, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | bsd-3-clause |
dennybaa/st2 | st2actions/st2actions/runners/localrunner.py | 2 | 7534 | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 |
jrha/aquilon | tests/scale/serial.py | 2 | 4239 | #!/usr/bin/env python2.6
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2013 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... | apache-2.0 |
bwohlberg/sporco | tests/admm/test_tvl2.py | 1 | 6275 | from __future__ import division
from builtins import object
from past.utils import old_div
import numpy as np
from sporco.admm import tvl2
import sporco.metric as sm
class TestSet01(object):
def setup_method(self, method):
np.random.seed(12345)
self.D = np.random.randn(16, 15)
self.Dc =... | bsd-3-clause |
invokr/protobuf-emscripten | 2.6.1/python/google/protobuf/descriptor.py | 70 | 32743 | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | bsd-3-clause |
rvalyi/OpenUpgrade | addons/crm/wizard/crm_phonecall_to_phonecall.py | 40 | 4562 | # -*- 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 |
jrwdunham/old-webapp | onlinelinguisticdatabase/lib/base.py | 1 | 1441 | # Copyright (C) 2010 Joel Dunham
#
# This file is part of OnlineLinguisticDatabase.
#
# OnlineLinguisticDatabase 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 o... | gpl-3.0 |
nekrut/tools-iuc | tools/vsnp/vsnp_add_zero_coverage.py | 12 | 6321 | #!/usr/bin/env python
import argparse
import os
import re
import shutil
import pandas
import pysam
from Bio import SeqIO
def get_sample_name(file_path):
base_file_name = os.path.basename(file_path)
if base_file_name.find(".") > 0:
# Eliminate the extension.
return os.path.splitext(base_file_... | mit |
SlimRoms/android_external_chromium_org | build/android/symbolize_test.py | 110 | 5004 | #!/usr/bin/env python
#
# 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.
"""Unittest for symbolize.py.
This test uses test libraries generated by the Android g++ toolchain.
Should things break you can rec... | bsd-3-clause |
soldag/home-assistant | homeassistant/components/airvisual/sensor.py | 6 | 8941 | """Support for AirVisual air quality sensors."""
from logging import getLogger
from homeassistant.const import (
ATTR_LATITUDE,
ATTR_LONGITUDE,
ATTR_STATE,
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
CONCENTRATION_PARTS_PER_BILLION,
CONCENTRATION_PARTS_PER_MILLION,
CONF_LATITUDE,
CONF_LON... | apache-2.0 |
michael-dev2rights/ansible | lib/ansible/utils/module_docs_fragments/vmware.py | 149 | 1471 | # (c) 2016, Charles Paul <cpaul@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versio... | gpl-3.0 |
kvar/ansible | test/units/modules/network/netvisor/test_pn_switch_setup.py | 23 | 2940 | # Copyright: (c) 2018, Pluribus Networks
# 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
from units.compat.mock import patch
from ansible.modules.network.netvisor import pn_switch_setup... | gpl-3.0 |
denz/flask_introspect | test/test_base_view.py | 1 | 20172 | from types import NoneType
from collections import OrderedDict as odict
import unittest
from pprint import pprint
from flask.ext.introspect import TreeView, Tree, DictViewMixin, ObjectViewMixin, NOTEXIST
class O(object):
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
class O1(object):
de... | bsd-3-clause |
tedi3231/openerp | openerp/addons/event/wizard/event_confirm.py | 53 | 1442 | # -*- 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 |
treemo/circuits | tests/net/test_pipe.py | 3 | 1042 | #!/usr/bin/env python
import pytest
if pytest.PLATFORM == "win32":
pytest.skip("Unsupported Platform")
from circuits import Manager
from circuits.net.sockets import Pipe
from circuits.core.pollers import Select
from circuits.net.events import close, write
from .client import Client
def pytest_generate_tests(me... | mit |
kfox1111/horizon | openstack_dashboard/dashboards/project/databases/tests.py | 23 | 20379 | # Copyright 2013 Mirantis Inc.
# Copyright 2013 Rackspace Hosting.
#
# 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
#
# Unles... | apache-2.0 |
moio/spacewalk | client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_register_firstboot_gui_window.py | 25 | 3904 | import functions # firstboot stuff
import os
import sys
import gtk
from firstboot_module_window import FirstbootModuleWindow
sys.path.append("/usr/share/rhn/up2date_client/")
sys.path.append("/usr/share/rhn")
import messageWindow
import rhnregGui
class RhnRegisterFirstbootGuiWindow(FirstbootModuleWindow):
"""Thi... | gpl-2.0 |
CenterForOpenScience/waterbutler | waterbutler/providers/googlecloud/provider.py | 2 | 23572 | import time
import base64
import typing
import hashlib
import logging
import functools
from http import HTTPStatus
from google.oauth2 import service_account
from waterbutler.core.path import WaterButlerPath
from waterbutler.core.provider import BaseProvider
from waterbutler.core.utils import make_disposition
from wat... | apache-2.0 |
MirkoRossini/pybuilder_django_enhanced_plugin | src/integrationtest/python/django_test_creates_report_files_tests.py | 1 | 1205 | __author__ = 'Mirko Rossini'
import unittest
import shutil
from integrationtest_support import IntegrationTestSupport
from pybuilder.errors import BuildFailedException
from common import BUILD_FILE_TEMPLATE
class DjangoEnhancedPluginTest(IntegrationTestSupport):
def test_django_test(self):
# self.set_tmp... | bsd-3-clause |
rtrigoso/tastycakes | node_modules/grunt-docker/node_modules/docker/node_modules/pygmentize-bundled/vendor/pygments/build-2.7/pygments/formatters/html.py | 268 | 31089 | # -*- coding: utf-8 -*-
"""
pygments.formatters.html
~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for HTML output.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import sys
import os.path
import StringIO
from pygments.formatter impo... | mit |
nburn42/tensorflow | tensorflow/contrib/boosted_trees/python/utils/losses_test.py | 33 | 3862 | # 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 |
trishnaguha/ansible | lib/ansible/module_utils/netapp_elementsw_module.py | 52 | 5441 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
HAS_SF_SDK = False
try:
import solidfire.common
HAS_SF_SDK = True
except Exception:
HAS_SF_SDK = False
def has_sf_sdk():
return HAS_SF_SDK
class NaElementSW... | gpl-3.0 |
PaulKinlan/cli-caniuse | site/app/scripts/bower_components/jsrepl-build/extern/python/reloop-closured/lib/python2.7/encodings/iso2022_kr.py | 816 | 1053 | #
# iso2022_kr.py: Python Unicode Codec for ISO2022_KR
#
# Written by Hye-Shik Chang <perky@FreeBSD.org>
#
import _codecs_iso2022, codecs
import _multibytecodec as mbc
codec = _codecs_iso2022.getcodec('iso2022_kr')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class IncrementalEncod... | apache-2.0 |
siddhartharay007/PCV | pcv_book/bayes.py | 21 | 1884 | from numpy import *
class BayesClassifier(object):
def __init__(self):
""" Initialize classifier with training data. """
self.labels = [] # class labels
self.mean = [] # class mean
self.var = [] # class variances
self.n = 0 # nbr o... | bsd-2-clause |
TangHao1987/intellij-community | python/helpers/docutils/parsers/rst/directives/parts.py | 41 | 4241 | # $Id: parts.py 6385 2010-08-13 12:17:01Z milde $
# Authors: David Goodger <goodger@python.org>; Dmitry Jemerov
# Copyright: This module has been placed in the public domain.
"""
Directives for document parts.
"""
__docformat__ = 'reStructuredText'
from docutils import nodes, languages
from docutils.transforms impor... | apache-2.0 |
zhenzhai/edx-platform | common/djangoapps/cache_toolbox/middleware.py | 15 | 6068 | """
Cache-backed ``AuthenticationMiddleware``
-----------------------------------------
``CacheBackedAuthenticationMiddleware`` is an
``django.contrib.auth.middleware.AuthenticationMiddleware`` replacement to
avoid querying the database for a ``User`` instance in each request.
Whilst the built-in ``AuthenticationMidd... | agpl-3.0 |
frankyrumple/ope | laptop_credential/gluon/contrib/login_methods/email_auth.py | 44 | 1493 | import smtplib
import logging
def email_auth(server="smtp.gmail.com:587",
domain="@gmail.com",
tls_mode=None):
"""
to use email_login:
from gluon.contrib.login_methods.email_auth import email_auth
auth.settings.login_methods.append(email_auth("smtp.gmail.com:587",
... | mit |
jimi-c/ansible | test/units/modules/network/onyx/test_onyx_mlag_ipl.py | 50 | 3352 | #
# Copyright: 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
from ansible.compat.tests.mock import patch
from ansible.modules.network.on... | gpl-3.0 |
litnimax/addons-yelizariev | project_kanban_customer/models.py | 16 | 1384 | from openerp import api, models, fields, SUPERUSER_ID
class project_project(models.Model):
_inherit = 'project.project'
partner_country_image = fields.Binary('Partner\'s country flag', related='partner_id.country_id.image')
partner_country_name = fields.Char('Partner\'s country name', related='partner_id.... | lgpl-3.0 |
CorySpitzer/ansible | lib/ansible/plugins/cache/__init__.py | 57 | 2122 | # (c) 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) any lat... | gpl-3.0 |
eduardoneira/SistemasDistribuidos_TPFinal | CentroMonitoreoCiudad/FaceRecognizer/modules/old_feature_matcher.py | 1 | 4628 | #!/bin/python3
import numpy as np
import cv2
import base64
import pdb
from tkinter import *
from matplotlib import pyplot as plt
class FeatureMatcher:
__PORC_DISTANCE = 0.7
def __init__(self,feature_extractor='SURF',upright=True,min_match_count=10,threshold=400):
self.MIN_MATCH_COUNT = min_match_count
... | gpl-3.0 |
double12gzh/nova | nova/console/xvp.py | 40 | 7100 | # Copyright (c) 2010 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 |
massot/odoo | addons/base_report_designer/plugin/openerp_report_designer/bin/script/ModifyExistingReport.py | 384 | 8450 | #########################################################################
#
# Copyright (c) 2003-2004 Danny Brewer d29583@groovegarden.com
# Copyright (C) 2004-2010 OpenERP SA (<http://openerp.com>).
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser Gene... | agpl-3.0 |
yeyus/naclports | build_tools/sha1sum.py | 3 | 1056 | #!/usr/bin/env python
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Usage:
sha1sum.py <filename>
will hash the filename in binary mode, generating a
single line of output suitable for inc... | bsd-3-clause |
LarryHillyer/PoolHost | PoolHost/env/Lib/site-packages/pip/_vendor/requests/packages/chardet/langgreekmodel.py | 2763 | 12628 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client 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 R... | gpl-3.0 |
xuleiboy1234/autoTitle | tensorflow/tensorflow/python/training/queue_runner_impl.py | 21 | 17831 | # 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 |
mpdehaan/camp | camp/core/scale.py | 1 | 3292 | """
Copyright 2016, Michael DeHaan <michael.dehaan@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | apache-2.0 |
vikatory/kbengine | kbe/src/lib/python/Lib/test/test_shutil.py | 60 | 69016 | # Copyright (C) 2003 Python Software Foundation
import unittest
import shutil
import tempfile
import sys
import stat
import os
import os.path
import errno
import functools
import subprocess
from contextlib import ExitStack
from test import support
from test.support import TESTFN
from os.path import splitdrive
from dis... | lgpl-3.0 |
beni55/sympy | sympy/physics/unitsystems/tests/test_simplifiers.py | 57 | 1102 | # -*- coding: utf-8 -*-
from __future__ import division
from sympy import Add, Pow, Mul
from sympy.physics.unitsystems.simplifiers import dim_simplify, qsimplify
from sympy.physics.unitsystems.quantities import Quantity as Q
from sympy.physics.unitsystems.systems import mks, mks_dim
L, T = mks_dim["length"], mks_di... | bsd-3-clause |
lampmantech/trytond_scenari | src/behaving/trytond/steps/scenario_account_reconciliation.py | 2 | 9321 | # -*- mode: python; py-indent-offset: 4; coding: utf-8-unix; encoding: utf-8 -*-
"""
===============================
Account Reconciliation Scenario
===============================
This is a straight cut-and-paste from
trytond_account-2.8.1/tests/scenario_account_reconciliation.rst
It should be improved to be more l... | gpl-2.0 |
ingkebil/trost | scripts/process_xls.py | 1 | 1832 | #!/usr/bin/python
# -*- coding: utf8 -*-
import os
import sys
import math
import xlrd
import data_objects as DO
import cast
""" Excel cell type decides which cast function to use. """
CAST_FUNC = {xlrd.XL_CELL_EMPTY: str,
xlrd.XL_CELL_TEXT: cast.cast_str,
xlrd.XL_CELL_NUMBER: float,
... | gpl-2.0 |
GustavoHennig/ansible | lib/ansible/modules/database/postgresql/postgresql_db.py | 6 | 10810 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# 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.
#... | gpl-3.0 |
induane/stomp.py3 | stomp/test/threading_test.py | 1 | 3873 | try:
from queue import Queue, Empty, Full
except ImportError:
from Queue import Queue, Empty, Full
import threading
import sys
import time
import unittest
import stomp
from testutils import *
class MQ(object):
def __init__(self):
self.connection = stomp.Connection(get_standard_host(), 'admin', 'p... | apache-2.0 |
arifsetiawan/edx-platform | common/lib/xmodule/xmodule/tests/test_combined_open_ended.py | 73 | 65471 | """
Tests for the various pieces of the CombinedOpenEndedGrading system
OpenEndedChild
OpenEndedModule
"""
import json
import logging
import unittest
from datetime import datetime
from lxml import etree
from lxml.html import fragment_fromstring
from mock import Mock, MagicMock, patch
from pytz import UTC
from webob... | agpl-3.0 |
ktan2020/legacy-automation | win/Lib/lib-tk/tkMessageBox.py | 9 | 3821 | # tk common message boxes
#
# this module provides an interface to the native message boxes
# available in Tk 4.2 and newer.
#
# written by Fredrik Lundh, May 1997
#
#
# options (all have default values):
#
# - default: which button to make default (one of the reply codes)
#
# - icon: which icon to displa... | mit |
Dziolas/invenio | modules/bibformat/lib/elements/bfe_keywords.py | 1 | 2158 | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 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
## ... | gpl-2.0 |
oudalab/phyllo | phyllo/extractors/frodebertusDB.py | 1 | 2443 | import sqlite3
import urllib
from urllib.request import urlopen
from bs4 import BeautifulSoup, NavigableString
import nltk
nltk.download('punkt')
from nltk import sent_tokenize
def parseRes2(soup, title, url, cur, author, date, collectiontitle):
chapter = '-'
sen = ""
num = 1
[e.extract() for e in s... | apache-2.0 |
MartinHjelmare/home-assistant | homeassistant/components/mastodon/notify.py | 7 | 1994 | """Mastodon platform for notify component."""
import logging
import voluptuous as vol
from homeassistant.const import CONF_ACCESS_TOKEN
import homeassistant.helpers.config_validation as cv
from homeassistant.components.notify import (PLATFORM_SCHEMA,
BaseNotificationServi... | apache-2.0 |
saydulk/django | tests/fixtures_model_package/tests.py | 312 | 2204 | from __future__ import unicode_literals
import warnings
from django.core import management
from django.test import TestCase
from .models import Article
class SampleTestCase(TestCase):
fixtures = ['fixture1.json', 'fixture2.json']
def testClassFixtures(self):
"Test cases can load fixture objects in... | bsd-3-clause |
srjek/gdb-dcpu16 | gdb/python/lib/gdb/command/pretty_printers.py | 107 | 14696 | # Pretty-printer commands.
# Copyright (C) 2010-2012 Free Software Foundation, 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 License, or
# (at your option) any la... | gpl-2.0 |
sodexis/odoo | addons/claim_from_delivery/__openerp__.py | 261 | 1517 | ##############################################################################
#
# 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 the GNU Affero General Public L... | agpl-3.0 |
DTOcean/dtocean-core | tests/test_data_definitions_simplepie.py | 1 | 2601 | import pytest
import matplotlib.pyplot as plt
from aneris.control.factory import InterfaceFactory
from dtocean_core.core import (AutoFileInput,
AutoFileOutput,
AutoPlot,
Core)
from dtocean_core.data import CoreMetaData
from d... | gpl-3.0 |
chaluemwut/fbserver | venv/lib/python2.7/site-packages/numpy/core/_methods.py | 55 | 4309 | """
Array methods which are called by both the C-code for the method
and the Python code for the NumPy-namespace function
"""
from __future__ import division, absolute_import, print_function
import warnings
from numpy.core import multiarray as mu
from numpy.core import umath as um
from numpy.core.numeric import asan... | apache-2.0 |
dmccue/ansible | test/integration/cleanup_rax.py | 71 | 6516 | #!/usr/bin/env python
import os
import re
import yaml
import argparse
try:
import pyrax
HAS_PYRAX = True
except ImportError:
HAS_PYRAX = False
def rax_list_iterator(svc, *args, **kwargs):
method = kwargs.pop('method', 'list')
items = getattr(svc, method)(*args, **kwargs)
while items:
... | gpl-3.0 |
msarahan/bokeh | bokeh/core/validation/decorators.py | 9 | 2909 | ''' Provide decorators help with define Bokeh validation checks.
'''
from __future__ import absolute_import
from functools import partial
from six import string_types
def _validator(code_or_name, validator_type):
if validator_type == "error":
from .errors import codes
from .errors import EXT
... | bsd-3-clause |
manosim/django-rest-framework-docs | demo/project/organisations/serializers.py | 2 | 1249 | from rest_framework import serializers
from project.organisations.models import Organisation, Membership
from project.accounts.serializers import UserProfileSerializer
class MembershipSerializer(serializers.ModelSerializer):
class Meta:
model = Membership
fields = ('joined', 'is_owner', 'role')
... | bsd-2-clause |
amir-qayyum-khan/edx-platform | openedx/core/lib/api/view_utils.py | 10 | 8030 | """
Utilities related to API views
"""
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError, ObjectDoesNotExist
from django.http import Http404
from django.utils.translation import ugettext as _
from rest_framework import status
from rest_framework.exceptions import APIException
from rest_framework.per... | agpl-3.0 |
pombredanne/bup | cmd/fuse-cmd.py | 2 | 3998 | #!/usr/bin/env python
import sys, os, errno
from bup import options, git, vfs, xstat
from bup.helpers import *
try:
import fuse
except ImportError:
log('error: cannot find the python "fuse" module; please install it\n')
sys.exit(1)
class Stat(fuse.Stat):
def __init__(self):
self.st_mode = 0
... | lgpl-2.1 |
jpihet/linux | scripts/rt-tester/rt-tester.py | 11005 | 5307 | #!/usr/bin/python
#
# rt-mutex tester
#
# (C) 2006 Thomas Gleixner <tglx@linutronix.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
import os
import sys
import getopt
import sh... | gpl-2.0 |
APM602/APM602 | Tools/LogAnalyzer/tests/TestBrownout.py | 74 | 1401 | from LogAnalyzer import Test,TestResult
import DataflashLog
import collections
class TestBrownout(Test):
'''test for a log that has been truncated in flight'''
def __init__(self):
Test.__init__(self)
self.name = "Brownout"
def run(self, logdata, verbose):
self.result = TestResult()
self.result.status = T... | gpl-3.0 |
jonboiser/kolibri | kolibri/auth/permissions/base.py | 7 | 12057 | """
This module defines the base classes for Kolibri's class-based Permissions system.
"""
from django.db.models import F
####################################################################################################################
# This section contains base classes that can be inherited and extended to def... | mit |
pilou-/ansible | lib/ansible/plugins/action/yum.py | 64 | 4183 | # (c) 2018, Ansible Project
#
# 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... | gpl-3.0 |
chrismeyersfsu/ansible-modules-core | cloud/azure/azure_rm_storageblob.py | 19 | 21872 | #!/usr/bin/python
#
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
# Chris Houseknecht, <house@redhat.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 Soft... | gpl-3.0 |
frodrigo/osmose-backend | analysers/analyser_merge_poste_FR.py | 4 | 6577 | #!/usr/bin/env python
#-*- coding: utf-8 -*-
###########################################################################
## ##
## Copyrights Frédéric Rodrigo 2012-2015 ##
## ... | gpl-3.0 |
swannapa/erpnext | erpnext/hr/doctype/expense_claim/expense_claim.py | 10 | 8767 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import get_fullname, flt, cstr
from frappe.model.document import Document
from erpnext.hr.utils imp... | gpl-3.0 |
emon10005/sympy | sympy/physics/quantum/tests/test_hilbert.py | 125 | 2513 | from sympy.physics.quantum.hilbert import (
HilbertSpace, ComplexSpace, L2, FockSpace, TensorProductHilbertSpace,
DirectSumHilbertSpace, TensorPowerHilbertSpace
)
from sympy import Interval, oo, Symbol, sstr, srepr
def test_hilbert_space():
hs = HilbertSpace()
assert isinstance(hs, HilbertSpace)
... | bsd-3-clause |
iamthearm/bazel | third_party/protobuf/3.0.0/python/google/protobuf/text_format.py | 14 | 47311 | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | apache-2.0 |
hlamer/enki | enki/__main__.py | 2 | 9764 | #!/usr/bin/env python3
"""
Enki editor entry point.
"""
import sys
import os.path
import traceback
import logging
import logging.handlers
from optparse import OptionParser # Replace with argparse, when python 2.6 is not supported
# Avoid ``ImportError: QtWebEngineWidgets must be imported before a QCoreApplication in... | gpl-2.0 |
coronary/RandomEpisode | depends/Lib/site-packages/pip/_vendor/requests/packages/chardet/__init__.py | 1778 | 1295 | ######################## BEGIN LICENSE BLOCK ########################
# 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 the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later ve... | mit |
szopu/django | django/views/csrf.py | 107 | 4958 | from django.conf import settings
from django.http import HttpResponseForbidden
from django.template import Context, Template
from django.utils.translation import ugettext as _
# We include the template inline since we need to be able to reliably display
# this error message, especially for the sake of developers, and ... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.