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 |
|---|---|---|---|---|---|
tylertian/Openstack | openstack F/glance/glance/store/scrubber.py | 1 | 7036 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 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/... | apache-2.0 |
vybstat/scikit-learn | sklearn/ensemble/bagging.py | 57 | 35280 | """Bagging meta-estimator."""
# Author: Gilles Louppe <g.louppe@gmail.com>
# License: BSD 3 clause
from __future__ import division
import itertools
import numbers
import numpy as np
from warnings import warn
from abc import ABCMeta, abstractmethod
from ..base import ClassifierMixin, RegressorMixin
from ..externals.... | bsd-3-clause |
beni55/django | django/utils/datastructures.py | 55 | 9177 | import copy
from collections import OrderedDict
from django.utils import six
class OrderedSet(object):
"""
A set which keeps the ordering of the inserted items.
Currently backs onto OrderedDict.
"""
def __init__(self, iterable=None):
self.dict = OrderedDict(((x, None) for x in iterable) ... | bsd-3-clause |
piotrek-golda/CivilHubCopy | projects/signals.py | 2 | 1043 | # -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from actstream import action
def project_created_action(sender, instance, created, **kwargs):
""" The creation of a project should be visible to the followers of the location. """
if created:
action.send(instance.creator, verb=_(u"cr... | gpl-3.0 |
nkcr/WebIndex | app/venv/lib/python3.5/site-packages/click/exceptions.py | 199 | 6788 | from ._compat import PY2, filename_to_ui, get_text_stderr
from .utils import echo
class ClickException(Exception):
"""An exception that Click can handle and show to the user."""
#: The exit code for this exception
exit_code = 1
def __init__(self, message):
if PY2:
if message is n... | mit |
tboyce1/home-assistant | homeassistant/components/light/tplink.py | 2 | 7236 | """
Support for TPLink lights.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/light.tplink/
"""
import logging
import colorsys
import time
import voluptuous as vol
from homeassistant.const import (CONF_HOST, CONF_NAME)
from homeassistant.components.li... | apache-2.0 |
stinos/micropython | tests/basics/exceptpoly2.py | 63 | 1789 | try:
raise MemoryError
except Exception:
print("Caught MemoryError via Exception")
try:
raise MemoryError
except MemoryError:
print("Caught MemoryError")
try:
raise NameError
except Exception:
print("Caught NameError via Exception")
try:
raise NameError
except NameError:
print("Caught... | mit |
DylannCordel/django-cms | cms/signals/__init__.py | 23 | 5477 | # -*- coding: utf-8 -*-
from cms.signals.apphook import debug_server_restart
from cms.signals.page import pre_save_page, post_save_page, pre_delete_page, post_delete_page, post_moved_page
from cms.signals.permissions import post_save_user, post_save_user_group, pre_save_user, pre_delete_user, pre_save_group, pre_delete... | bsd-3-clause |
sumedhasingla/VTK | Rendering/Core/Testing/Python/TestTransformInterpolator.py | 20 | 5455 | #!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# create two boxes and interpolate between them
#
pts = vtk.vtkPoints()
pts.InsertNextPoint(-1,-1,-1)
pts.InsertNextPoint(1,-1,-1)
pts.InsertNextPoint(1,1,-1)
pts.InsertNextPoint(-1,1... | bsd-3-clause |
pseudonym117/Riot-Watcher | src/riotwatcher/Handlers/TypeCorrectorHandler.py | 1 | 1562 | from . import RequestHandler
class TypeCorrectorHandler(RequestHandler):
"""
The TypeCorrector class is meant to correct any inconsistencies in the types
of objects provided as query parameters.
Currently this only involves changing boolean values into strings,
as the API only accepts lower case ... | mit |
willdecker/adspygoogle | adspygoogle/SOAPpy/Client.py | 4 | 18177 | """
################################################################################
#
# SOAPpy - Cayce Ullman (cayce@actzero.com)
# Brian Matthews (blm@actzero.com)
# Gregory Warnes (Gregory.R.Warnes@Pfizer.com)
# Christopher Blunck (blunck@gst.com)
#
##########################... | mit |
cpennington/edx-platform | openedx/core/lib/tests/test_time_zone_utils.py | 4 | 3514 | """Tests covering time zone utilities."""
from django.test import TestCase
from freezegun import freeze_time
from pytz import timezone
from openedx.core.lib.time_zone_utils import get_display_time_zone, get_time_zone_abbr, get_time_zone_offset
from student.tests.factories import UserFactory
class TestTimeZoneUtils... | agpl-3.0 |
xiaoxq/apollo | modules/tools/prediction/data_pipelines/common/log.py | 3 | 1701 | #!/usr/bin/env python3
###############################################################################
# Copyright 2018 The Apollo 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... | apache-2.0 |
rodrigoasmacedo/l10n-brazil | __unported__/l10n_br_account_service/l10n_br_account.py | 2 | 1821 | # -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2013 Renato Lima - Akretion #
# ... | agpl-3.0 |
lidore/trading-with-python | cookbook/ib_logQuotes.py | 77 | 4901 | '''
Created on May 5, 2013
Copyright: Jev Kuznetsov
License: BSD
Program to log tick events to a file
example usage:
> python ib_logQuotes.py SPY,VXX,XLE
start with -v option to show all incoming events
'''
import argparse # command line argument parser
import datetime as dt # dat... | bsd-3-clause |
eddiejessup/nex | tests/test_state.py | 1 | 12435 | import pytest
from nex.constants.instructions import Instructions
from nex.constants.commands import Commands
from nex.constants.specials import Specials
from nex.state import Mode, GlobalState
from nex import box
from nex.box_writer import write_to_dvi_file
from nex.state import ExecuteCommandError
from nex.utils imp... | mit |
mdj2/django | tests/custom_managers/models.py | 9 | 2042 | """
23. Giving models a custom manager
You can use a custom ``Manager`` in a particular model by extending the base
``Manager`` class and instantiating your custom ``Manager`` in your model.
There are two reasons you might want to customize a ``Manager``: to add extra
``Manager`` methods, and/or to modify the initial... | bsd-3-clause |
cmelange/ansible | lib/ansible/modules/utilities/logic/set_fact.py | 6 | 2760 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2013 Dag Wieers <dag@wieers.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 Lice... | gpl-3.0 |
dya2/python-for-android | python3-alpha/python3-src/Lib/os.py | 45 | 27303 | r"""OS routines for Mac, NT, or Posix depending on what system we're on.
This exports:
- all functions from posix, nt, os2, or ce, e.g. unlink, stat, etc.
- os.path is either posixpath or ntpath
- os.name is either 'posix', 'nt', 'os2' or 'ce'.
- os.curdir is a string representing the current directory ('.' or... | apache-2.0 |
ThunderGemios10/The-Super-Duper-Script-Editor-2 | editor_form.py | 1 | 98101 | # -*- coding: utf-8 -*-
################################################################################
### Copyright © 2012-2013 BlackDragonHunt
###
### This file is part of the Super Duper Script Editor.
###
### The Super Duper Script Editor is free software: you can redistribute it
### and/or modify it under the ... | gpl-3.0 |
endlessm/chromium-browser | third_party/pyelftools/elftools/dwarf/locationlists.py | 21 | 2669 | #-------------------------------------------------------------------------------
# elftools: dwarf/locationlists.py
#
# DWARF location lists section decoding (.debug_loc)
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#---------------------------------------------------------------------------... | bsd-3-clause |
GNOME/meld | meld/accelerators.py | 1 | 2091 |
from typing import Dict, Sequence, Union
from gi.repository import Gtk
VIEW_ACCELERATORS: Dict[str, Union[str, Sequence[str]]] = {
'app.quit': '<Primary>Q',
'view.find': '<Primary>F',
'view.find-next': ('<Primary>G', 'F3'),
'view.find-previous': ('<Primary><Shift>G', '<Shift>F3'),
'view.find-repl... | gpl-2.0 |
caneruguz/osf.io | scripts/tests/test_migrate_from_oldels.py | 9 | 7741 | from urllib import quote
import mock
from framework.auth import Auth
from modularodm import Q
from scripts.osfstorage import finish_oldel_migration as finishm
from scripts.osfstorage import migrate_from_oldels as migration
from tests.base import OsfTestCase
from tests.factories import ProjectFactory
from addons.osfsto... | apache-2.0 |
openfun/edx-platform | common/lib/capa/capa/tests/test_util.py | 45 | 5304 | """
Tests capa util
"""
import unittest
from . import test_capa_system
from capa.util import compare_with_tolerance, sanitize_html
class UtilTest(unittest.TestCase):
"""Tests for util"""
def setUp(self):
super(UtilTest, self).setUp()
self.system = test_capa_system()
def test_compare_with... | agpl-3.0 |
rosmo/ansible | test/units/modules/network/frr/test_frr_facts.py | 43 | 4772 | # (c) 2019, Ansible by Red Hat, 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
from units.compat.mock import patch
from ansible.modules.network.frr import frr_facts
from units.modu... | gpl-3.0 |
rghe/ansible | lib/ansible/modules/network/f5/bigip_iapplx_package.py | 8 | 11731 | #!/usr/bin/python
# -*- 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
rbalda/neural_ocr | env/lib/python2.7/site-packages/scipy/sparse/csgraph/tests/test_reordering.py | 93 | 3457 | from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_equal
from scipy.sparse.csgraph import reverse_cuthill_mckee,\
maximum_bipartite_matching
from scipy.sparse import diags, csr_matrix, coo_matrix
def test_graph_reverse_cuthill_mckee():
A = ... | mit |
estei-master/segment_SOL | PJ/uboot_kernel/u-boot-sunxi/tools/patman/patman.py | 34 | 6028 | #!/usr/bin/env python
#
# Copyright (c) 2011 The Chromium OS Authors.
#
# SPDX-License-Identifier: GPL-2.0+
#
"""See README for more information"""
from optparse import OptionParser
import os
import re
import sys
import unittest
# Our modules
import checkpatch
import command
import gitutil
import patchstream
import ... | gpl-3.0 |
isandlaTech/cohorte-3rdparty | herald/src/main/python/herald/transports/xmpp/directory.py | 1 | 3659 | #!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Herald XMPP transport directory
:author: Thomas Calmant
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.0.1
:status: Alpha
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
... | apache-2.0 |
matmutant/sl4a | python/src/Lib/test/test_types.py | 56 | 25078 | # Python test set -- part 6, built-in types
from test.test_support import run_unittest, have_unicode, run_with_locale
import unittest
import sys
import locale
class TypesTests(unittest.TestCase):
def test_truth_values(self):
if None: self.fail('None is true instead of false')
if 0: self.fail('0 i... | apache-2.0 |
jantman/tuxtruck | networkmanager/TuxTruck_NetworkManager.py | 1 | 2942 | # TuxTruck_NetworkManager.py
#
# Time-stamp: "2009-08-26 08:59:30 jantman"
#
# +----------------------------------------------------------------------+
# | TuxTruck Project http://tuxtruck.jasonantman.com |
# +----------------------------------------------------------------------+
# | Copyright (c) ... | gpl-3.0 |
zycdragonball/tensorflow | tensorflow/python/ops/resources.py | 81 | 4327 | # 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 |
dpshelio/sunpy | sunpy/net/helioviewer.py | 1 | 18644 | """
This module provides a wrapper around the Helioviewer API.
"""
import json
import codecs
import urllib
from pathlib import Path
from collections import OrderedDict
import parfive
from astropy.utils.decorators import lazyproperty
import sunpy
from sunpy.time import parse_time
from sunpy.util.xml import xml_to_dic... | bsd-2-clause |
phalt/django | tests/check_framework/test_model_field_deprecation.py | 183 | 2560 | from django.core import checks
from django.db import models
from django.test import SimpleTestCase
from django.test.utils import isolate_apps
@isolate_apps('check_framework')
class TestDeprecatedField(SimpleTestCase):
def test_default_details(self):
class MyField(models.Field):
system_check_de... | bsd-3-clause |
nagyistoce/odoo-dev-odoo | addons/sale_layout/__openerp__.py | 322 | 1793 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | agpl-3.0 |
kyuridenamida/atcoder-tools | atcodertools/fmtprediction/models/calculator.py | 2 | 6869 | import itertools
import re
from typing import Dict
class CalcParseError(Exception):
pass
class EvaluateError(Exception):
pass
class UnknownOperatorError(Exception):
pass
def add(a, b):
try:
return a + b
except TypeError as e:
raise EvaluateError(e)
d... | mit |
1234-/git | contrib/hooks/multimail/git_multimail.py | 78 | 87082 | #! /usr/bin/env python2
# Copyright (c) 2012-2014 Michael Haggerty and others
# Derived from contrib/hooks/post-receive-email, which is
# Copyright (c) 2007 Andy Parkins
# and also includes contributions by other authors.
#
# This file is part of git-multimail.
#
# git-multimail is free software: you can redistribute ... | gpl-2.0 |
jonathan-beard/edx-platform | cms/djangoapps/contentstore/management/commands/tests/test_reindex_library.py | 43 | 6713 | """ Tests for library reindex command """
import ddt
from django.core.management import call_command, CommandError
import mock
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from common.test.utils... | agpl-3.0 |
campbe13/openhatch | vendor/packages/scrapy/scrapy/contrib/exporter/__init__.py | 16 | 6919 | """
Item Exporters are used to export/serialize items into different formats.
"""
import csv
import pprint
import marshal
import cPickle as pickle
from xml.sax.saxutils import XMLGenerator
from scrapy.utils.py26 import json
__all__ = ['BaseItemExporter', 'PprintItemExporter', 'PickleItemExporter', \
'CsvItemExp... | agpl-3.0 |
firebitsbr/discover | mods/goog-mail.py | 7 | 2107 | #!/usr/bin/python
import sys
import re
import string
import httplib
import urllib2
def StripTags(text):
finished = 0
while not finished:
finished = 1
start = text.find("<")
if start >= 0:
stop = text[start:].find(">")
if stop >= 0:
text = text[:s... | bsd-3-clause |
jjenki11/blaze-chem-rendering | build_utils/scons-2.3.0/build/lib.linux-i686-2.7/SCons/Tool/install.py | 11 | 17425 | """SCons.Tool.install
Tool-specific initialization for the install tool.
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, 2010, 2011, 201... | mit |
google-code-export/marinemap | lingcod/data_distributor/models.py | 3 | 6862 | from django.db import models
from django.conf import settings
from lingcod.data_manager.models import DataLayer
import sys
def functions_in_module(module):
result = {}
mod = sys.modules[module]
for k,v in mod.__dict__.items():
try:
if v.__class__.__name__=='function':
re... | bsd-3-clause |
eenchev/idea-note-taking-app | env/lib/python2.7/site-packages/psycopg2/tests/test_bug_gc.py | 7 | 1722 | #!/usr/bin/env python
# bug_gc.py - test for refcounting/GC bug
#
# Copyright (C) 2010-2011 Federico Di Gregorio <fog@debian.org>
#
# psycopg2 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 ve... | mit |
printedheart/h2o-3 | h2o-py/h2o/model/binomial.py | 5 | 24203 | """
Binomial Models
"""
from metrics_base import *
class H2OBinomialModel(ModelBase):
"""
Class for Binomial models.
"""
def __init__(self, dest_key, model_json):
"""
Create a new binomial model.
"""
super(H2OBinomialModel, self).__init__(dest_key, model_json,H2OBinomialModelMetrics)
def F... | apache-2.0 |
mikebenfield/scikit-learn | sklearn/covariance/tests/test_graph_lasso.py | 33 | 6157 | """ Test the graph_lasso module.
"""
import sys
import numpy as np
from scipy import linalg
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_less
from sklearn.utils.testing import assert_warns_message
from sklearn.covariance import (graph_lasso, GraphLasso, G... | bsd-3-clause |
ls-cwi/heinz | script/makeHeinzRpcstMcDimacs.py | 1 | 1116 | #!/usr/bin/python
import sys
if len(sys.argv) != 5:
sys.stderr.write("Usage: " + sys.argv[0] + " <instances> <full_output_dir> <timelimit_pbs> <timelimit_heinz>\n")
sys.exit(1)
lines = open(sys.argv[1]).readlines()
n = len(lines)
bins = n / 15
if n % 15 != 0:
bins += 1
full_output_dir = sys.argv[2]
timelim... | mit |
mrosemeier/fusedwind | src/fusedwind/plant_cost/fused_opex.py | 2 | 4639 | # KLD: _cost model for FUSED_Wind - most basic structure
from openmdao.lib.datatypes.api import Float, Int, Array, VarTree
from openmdao.main.api import Component, Assembly, VariableTree
from fusedwind.interface import base, implement_base
#############################################################################... | apache-2.0 |
Princessgladys/googleresourcefinder | app/simplejson/encoder.py | 343 | 16033 | """Implementation of JSONEncoder
"""
import re
try:
from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii
except ImportError:
c_encode_basestring_ascii = None
try:
from simplejson._speedups import make_encoder as c_make_encoder
except ImportError:
c_make_encoder = None
... | apache-2.0 |
wdurhamh/statsmodels | statsmodels/sandbox/examples/ex_cusum.py | 33 | 3219 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 02 11:41:25 2010
Author: josef-pktd
"""
import numpy as np
from scipy import stats
from numpy.testing import assert_almost_equal
import statsmodels.api as sm
from statsmodels.sandbox.regression.onewaygls import OneWayLS
from statsmodels.stats.diagnostic import recursive... | bsd-3-clause |
40323211/40323211 | helloworld.py | 73 | 3294 | # coding=utf-8
# 上面的程式內容編碼必須在程式的第一或者第二行才會有作用
################# (1) 模組導入區
# 導入 cherrypy 模組, 為了在 OpenShift 平台上使用 cherrypy 模組, 必須透過 setup.py 安裝
import cherrypy
# 導入 Python 內建的 os 模組, 因為 os 模組為 Python 內建, 所以無需透過 setup.py 安裝
import os
################# (2) 廣域變數設定區
# 確定程式檔案所在目錄, 在 Windows 下有最後的反斜線
_curdir = os.path.join(os... | gpl-3.0 |
synopat/pyload | module/plugins/internal/Captcha.py | 7 | 4589 | # -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import time
from .Plugin import Plugin
class Captcha(Plugin):
__name__ = "Captcha"
__type__ = "captcha"
__version__ = "0.55"
__status__ = "stable"
__description__ = """Base anti-captcha plugin"""
__license__ = "GPLv3"
... | gpl-3.0 |
toshywoshy/ansible | lib/ansible/modules/windows/win_chocolatey.py | 10 | 12955 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2014, Trond Hindenes <trond@hindenes.com>
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub. actual code lives in the .ps1
# file of the ... | gpl-3.0 |
JamesMura/sentry | tests/sentry/interfaces/test_repos.py | 4 | 2189 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import pytest
from sentry.interfaces.base import InterfaceValidationError
from sentry.interfaces.repos import Repos
from sentry.testutils import TestCase
class ReposTest(TestCase):
def test_minimal_valid(self):
assert Repos.to_python({
... | bsd-3-clause |
rsoumyassdi/nuxeo-drive | nuxeo-drive-client/nxdrive/tests/test_local_client.py | 4 | 9524 | import os
import tempfile
import hashlib
from nose import with_setup
from nose.tools import assert_true
from nose.tools import assert_false
from nose.tools import assert_equal
from nose.tools import assert_not_equal
from nose.tools import assert_raises
from nxdrive.client import LocalClient
from nxdrive.client import ... | lgpl-2.1 |
vlinhd11/vlinhd11-android-scripting | python/src/Lib/encodings/cp856.py | 593 | 12679 | """ Python Character Mapping Codec cp856 generated from 'MAPPINGS/VENDORS/MISC/CP856.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='... | apache-2.0 |
2014cdag2/w17x1 | static/Brython3.1.3-20150514-095342/Lib/xml/etree/ElementTree.py | 730 | 61800 | #
# ElementTree
# $Id: ElementTree.py 3440 2008-07-18 14:45:01Z fredrik $
#
# light-weight XML support for Python 2.3 and later.
#
# history (since 1.2.6):
# 2005-11-12 fl added tostringlist/fromstringlist helpers
# 2006-07-05 fl merged in selected changes from the 1.3 sandbox
# 2006-07-05 fl removed support for ... | agpl-3.0 |
appliedx/edx-platform | lms/djangoapps/commerce/api/v1/views.py | 39 | 1588 | """ API v1 views. """
import logging
from django.http import Http404
from rest_framework.authentication import OAuth2Authentication, SessionAuthentication
from rest_framework.generics import RetrieveUpdateAPIView, ListAPIView
from rest_framework.permissions import IsAuthenticated
from commerce.api.v1.models import Co... | agpl-3.0 |
vvv1559/intellij-community | python/helpers/pydev/third_party/pep8/lib2to3/lib2to3/fixes/fix_except.py | 326 | 3352 | """Fixer for except statements with named exceptions.
The following cases will be converted:
- "except E, T:" where T is a name:
except E as T:
- "except E, T:" where T is not a name, tuple or list:
except E as t:
T = t
This is done because the target of an "except" clause must be a
... | apache-2.0 |
davicustodio/geonode | geonode/upload/upload.py | 15 | 22269 | #########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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
#... | gpl-3.0 |
elit3ge/SickRage | autoProcessTV/lib/requests/auth.py | 197 | 6710 | # -*- coding: utf-8 -*-
"""
requests.auth
~~~~~~~~~~~~~
This module contains the authentication handlers for Requests.
"""
import os
import re
import time
import hashlib
from base64 import b64encode
from .compat import urlparse, str
from .cookies import extract_cookies_to_jar
from .utils import parse_dict_header, ... | gpl-3.0 |
googleads/dfp-playground | dfp_playground.py | 1 | 1688 | # Copyright 2016 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 ... | apache-2.0 |
0ED/Toy | auto_sender/gmail.py | 1 | 1234 | #!/usr/bin/ python
# -*- coding: utf-8 -*-
import sys
import smtplib
from email import Encoders
from email.MIMEText import MIMEText
from email.MIMEBase import MIMEBase
from email.MIMEMultipart import MIMEMultipart
from email.Header import Header
from email.Utils import formatdate
class Gmail(object):
def create_mess... | mit |
vitan/hue | desktop/core/ext-py/Django-1.6.10/django/contrib/sitemaps/tests/urls/http.py | 106 | 1647 | from datetime import datetime
from django.conf.urls import patterns, url
from django.contrib.sitemaps import Sitemap, GenericSitemap, FlatPageSitemap, views
from django.views.decorators.cache import cache_page
from django.contrib.sitemaps.tests.base import TestModel
class SimpleSitemap(Sitemap):
changefreq = "ne... | apache-2.0 |
kawu/tagger | utils/tei2linc/tei2linc.py | 1 | 7737 | import sys
import os
import shutil
import argparse
import tarfile
import re
from collections import defaultdict
class Lexem:
def __init__(self, ctag=None, base=None, msds=None):
self.ctag = ctag
self.base = base
self.msds = msds if msds is not None else set()
def add(self, msd):
... | bsd-3-clause |
virneo/nupic | tests/swarming/nupic/swarming/experiments/field_threshold_temporal/description.py | 32 | 17206 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 |
erikulven/flapmagick | camera.py | 1 | 1925 | """ Uses camera and takes images for documentation of motion """
import time
from PIL import Image
import urllib
import StringIO
import settings
user = settings.cam_user
pwd = settings.cam_pwd
cam_url = settings.cam_url
def fetch_snapshot_image():
im = StringIO.StringIO(urllib.urlopen(settings.cam_url).read())
... | bsd-2-clause |
brchiu/tensorflow | tensorflow/contrib/distributions/python/ops/mvn_diag.py | 22 | 8846 | # 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 |
patrickm/chromium.src | tools/perf/measurements/thread_times.py | 1 | 2083 | # 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 measurements import timeline_controller
from metrics import timeline
from telemetry.page import page_measurement
class ThreadTimes(page_measurement.Page... | bsd-3-clause |
amenonsen/ansible | lib/ansible/modules/network/f5/_bigip_asm_policy.py | 38 | 38385 | #!/usr/bin/python
# -*- 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
anakinsolo/backend | Lib/site-packages/pyramid-1.5.7-py2.7.egg/pyramid/tests/test_location.py | 3 | 1345 | import unittest
class TestInside(unittest.TestCase):
def _callFUT(self, one, two):
from pyramid.location import inside
return inside(one, two)
def test_inside(self):
o1 = Location()
o2 = Location(); o2.__parent__ = o1
o3 = Location(); o3.__parent__ = o2
o4 =... | mit |
imron/scalyr-agent-2 | tests/unit/builtin_monitors/url_monitor_test.py | 2 | 7441 | # Copyright 2014-2020 Scalyr 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 |
MTG/dunya | jingju/models.py | 1 | 5375 | from django.db import models
import data.models
from jingju import managers
class JingjuStyle(object):
def get_style(self):
return "jingju"
def get_object_map(self, key):
return {
"performance": RecordingInstrumentalist,
"release": Release,
"artist": Artis... | agpl-3.0 |
trenshy/repository.kodi | plugin.video.armagedomfilmes/mechanize/_pullparser.py | 134 | 14352 | """A simple "pull API" for HTML parsing, after Perl's HTML::TokeParser.
Examples
This program extracts all links from a document. It will print one
line for each link, containing the URL and the textual description
between the <A>...</A> tags:
import pullparser, sys
f = file(sys.argv[1])
p = pullparser.PullParser(f... | gpl-2.0 |
edsu/lochief | kochief/discovery/management/commands/index.py | 1 | 4772 | #! /usr/bin/python
# -*- coding: utf8 -*-
# Copyright 2009 Gabriel Sean Farrell
# Copyright 2008 Mark A. Matienzo
#
# This file is part of Kochief.
#
# Kochief 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,... | gpl-3.0 |
indictranstech/buyback-erp | erpnext/support/doctype/support_ticket/get_support_mails.py | 31 | 2862 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, cint, decode_dict, today
from frappe.utils.email_lib import sendmail
from frappe.utils.email_lib.receive... | agpl-3.0 |
mrquim/repository.mrquim | script.module.covenant/lib/resources/lib/sources/pl/paczamy.py | 7 | 4714 | # -*- coding: utf-8 -*-
'''
Covenant Add-on
Copyright (C) 2017 homik
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 ... | gpl-2.0 |
leki75/ansible | lib/ansible/modules/network/avi/avi_stringgroup.py | 46 | 4045 | #!/usr/bin/python
#
# Created on Aug 25, 2016
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
# Avi Version: 17.1.1
#
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the te... | gpl-3.0 |
varunarya10/heat | heat/tests/test_autoscaling_update_policy.py | 4 | 14228 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | apache-2.0 |
woltage/ansible | v1/ansible/runner/lookup_plugins/etcd.py | 153 | 2238 | # (c) 2013, Jan-Piet Mens <jpmens(at)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 later ver... | gpl-3.0 |
xtiankisutsa/MARA_Framework | tools/qark/qark/modules/createSploit.py | 1 | 2666 | from __future__ import absolute_import
'''Copyright 2015 LinkedIn Corp. 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... | lgpl-3.0 |
Alecardv/College-projects | Metodos Numericos 2012/trapecio.py | 1 | 1308 | import function
from matplotlib.pyplot import *
from pylab import *
import numpy as np
import math
class Trapecio:
def __init__(self, fun, xi, xf):
self.fun = function.Function(fun,'x')
self.a,self.b = xi,xf
self.fig, self.ax = subplots()
def relativeError(self):
f = self.fun.getDerivate()
Ea = ((self.b-... | gpl-3.0 |
hnakamur/django-rest-framework | tests/test_validation.py | 57 | 7876 | from __future__ import unicode_literals
import re
from django.core.validators import MaxValueValidator, RegexValidator
from django.db import models
from django.test import TestCase
from rest_framework import generics, serializers, status
from rest_framework.test import APIRequestFactory
factory = APIRequestFactory(... | bsd-2-clause |
kumar303/zamboni | mkt/reviewers/serializers.py | 13 | 4049 | from rest_framework import serializers
from mkt.api.fields import TranslationSerializerField
from mkt.reviewers.models import (AdditionalReview, CannedResponse,
QUEUE_TARAKO, ReviewerScore)
from mkt.webapps.models import Webapp
from mkt.webapps.serializers import ESAppSerializer
cla... | bsd-3-clause |
giggsey/SickRage | sickrage/media/ShowPoster.py | 15 | 1291 | # This file is part of SickRage.
#
# URL: https://www.sickrage.tv
# Git: https://github.com/SiCKRAGETV/SickRage.git
#
# SickRage 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,... | gpl-3.0 |
dkodnik/Ant | addons/account_payment/wizard/account_payment_pay.py | 54 | 2479 | # -*- 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 |
rahul67/hue | desktop/libs/indexer/src/indexer/conf.py | 22 | 2625 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | apache-2.0 |
HarveyHunt/linux | Documentation/sphinx/kernel_include.py | 949 | 8570 | #!/usr/bin/env python3
# -*- coding: utf-8; mode: python -*-
# pylint: disable=R0903, C0330, R0914, R0912, E0401
u"""
kernel-include
~~~~~~~~~~~~~~
Implementation of the ``kernel-include`` reST-directive.
:copyright: Copyright (C) 2016 Markus Heiser
:license: GPL Version 2, June 1991 see lin... | gpl-2.0 |
mateon1/servo | tests/wpt/web-platform-tests/tools/pytest/_pytest/unittest.py | 176 | 7094 | """ discovery and running of std-library "unittest" style tests. """
from __future__ import absolute_import
import sys
import traceback
import pytest
# for transfering markers
import _pytest._code
from _pytest.python import transfer_markers
from _pytest.skipping import MarkEvaluator
def pytest_pycollect_makeitem(co... | mpl-2.0 |
voxlol/scikit-learn | examples/cluster/plot_dict_face_patches.py | 337 | 2747 | """
Online learning of a dictionary of parts of faces
==================================================
This example uses a large dataset of faces to learn a set of 20 x 20
images patches that constitute faces.
From the programming standpoint, it is interesting because it shows how
to use the online API of the sciki... | bsd-3-clause |
Ceciliae/gourmet | gourmet/plugins/python_shell/__init__.py | 7 | 2361 | from gourmet.plugin import ToolPlugin
import gtk
import ipython_view
from gettext import gettext as _
class ConsolePlugin (ToolPlugin):
menu_items = '''<placeholder name="StandaloneTool">
<menuitem action="ShowConsole"/>
</placeholder>'''
def setup_action_groups (self):
self.action_group = gt... | gpl-2.0 |
developerinlondon/ansible-modules-core | cloud/rackspace/rax_keypair.py | 157 | 4957 | #!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | gpl-3.0 |
seandavi/pelican-plugins | libravatar/test_libravatar.py | 52 | 3409 | """Unit testing suite for the Libravatar Plugin"""
## Copyright (C) 2015 Rafael Laboissiere <rafael@laboissiere.net>
##
## This program is free software: you can redistribute it and/or modify it
## under the terms of the GNU General Affero Public License as published by
## the Free Software Foundation, either version... | agpl-3.0 |
rosmo/aurora | src/test/python/apache/aurora/client/api/test_scheduler_client.py | 4 | 18448 | #
# 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
# distributed under ... | apache-2.0 |
jhseu/tensorflow | tensorflow/python/keras/activations.py | 3 | 14352 | # 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... | apache-2.0 |
NaohiroTamura/ironic | ironic/objects/chassis.py | 2 | 10100 | # coding=utf-8
#
#
# 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 writi... | apache-2.0 |
CurrencyCloud/currencycloud-python | src/currencycloud/clients/reference.py | 1 | 2780 | '''This module provides a class for Reference calls to the CC API'''
from currencycloud.http import Http
from currencycloud.resources import BeneficiaryRequiredDetails, ConversionDates, Currency, SettlementAccount, PayerRequiredDetails, PaymentPurposeCode, BankDetails, PaymentFeeRule
class Reference(Http):
'''Th... | mit |
xinjiguaike/edx-platform | common/djangoapps/util/json_request.py | 110 | 2635 | from functools import wraps
import json
from django.core.serializers import serialize
from django.core.serializers.json import DjangoJSONEncoder
from django.db.models.query import QuerySet
from django.http import HttpResponse, HttpResponseBadRequest
def expect_json(view_function):
"""
View decorator for simpl... | agpl-3.0 |
palashahuja/pgmpy | pgmpy/readwrite/XMLBIF.py | 2 | 14322 | #!/usr/bin/env python
try:
from lxml import etree
except ImportError:
try:
import xml.etree.cElementTree as etree
except ImportError:
try:
import xml.etree.ElementTree as etree
except ImportError:
print("Failed to import ElementTree from any known place")
imp... | mit |
danakj/chromium | mojo/public/tools/bindings/generators/mojom_java_generator.py | 5 | 19746 | # 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.
"""Generates java source files from a mojom.Module."""
import argparse
import ast
import contextlib
import os
import re
import shutil
import tempfile
import... | bsd-3-clause |
shakamunyi/nova | nova/tests/unit/virt/libvirt/test_imagebackend.py | 6 | 53654 | # Copyright 2012 Grid Dynamics
# 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.