repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
eniosp/google-python-exercises | basic/string2.py | 1 | 2818 | #!/usr/bin/python2.4 -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic string exercises
# D. verbing
# Given a string, if its length is ... | apache-2.0 |
mcking49/apache-flask | Python/Lib/site-packages/requests/compat.py | 35 | 1568 | # -*- coding: utf-8 -*-
"""
requests.compat
~~~~~~~~~~~~~~~
This module handles import compatibility issues between Python 2 and
Python 3.
"""
from .packages import chardet
import sys
# -------
# Pythons
# -------
# Syntax sugar.
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_p... | mit |
Oblomov/pocl | doc/www/generate_html.py | 3 | 1815 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 Pekka Jääskeläinen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
... | mit |
cuongnv23/ansible | lib/ansible/plugins/cliconf/nxos.py | 58 | 2052 | #
# (c) 2017 Red Hat Inc.
#
# 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 d... | gpl-3.0 |
dgjustice/ansible | lib/ansible/module_utils/gcdns.py | 94 | 2529 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | gpl-3.0 |
polyaxon/polyaxon | core/polyaxon/utils/fqn_utils.py | 1 | 1829 | #!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | apache-2.0 |
NeCTAR-RC/heat | heat/openstack/common/db/sqlalchemy/models.py | 2 | 3967 | # 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.
# Copyright 2011 Piston Cloud Computing, Inc.
# Copyright 2012 Cloudscaling Group, Inc.
# All Rights Reserved.
#
# Licens... | apache-2.0 |
ojii/sandlib | lib/lib-python/2.7/sets.py | 262 | 19050 | """Classes to represent arbitrary sets (including sets of sets).
This module implements sets using dictionaries whose values are
ignored. The usual operations (union, intersection, deletion, etc.)
are provided as both methods and operators.
Important: sets are not sequences! While they support 'x in s',
'len(s)', a... | bsd-3-clause |
lmco/laikaboss | laikaboss/modules/meta_pe.py | 4 | 11472 | # Copyright 2015 Lockheed Martin 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 applicable law or agreed... | apache-2.0 |
keakon/gunicorn | gunicorn/app/django_wsgi.py | 87 | 4363 | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
""" module used to build the django wsgi application """
from __future__ import print_function
import os
import re
import sys
import time
try:
from StringIO import StringIO
except:
fr... | mit |
Parisson/TimeSide | tests/test_component.py | 1 | 3686 | #! /usr/bin/env python
from timeside.core.component import *
from unit_timeside import *
__all__ = ['TestComponentArchitecture']
class TestComponentArchitecture(unittest.TestCase):
"Test the component and interface system"
def testOneInterface(self):
"Test a component implementing one interface"
... | agpl-3.0 |
cloudbau/nova | nova/scheduler/host_manager.py | 2 | 18447 | # Copyright (c) 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | apache-2.0 |
avicizhu/Load-balancer | bindings/python/rad_util.py | 212 | 26013 | # Copyright (c) 2007 RADLogic
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribut... | gpl-2.0 |
MattNolanLab/ei-attractor | grid_cell_model/entry_points/sweepls.py | 1 | 5382 | '''List important information about parameter sweeps.'''
from __future__ import absolute_import, print_function, division
from enum import Enum, IntEnum, unique
import os.path
import collections
from simtools.storage import DataStorage
from grid_cell_model.submitting.base.parsers import BaseParser
from grid_cell_model... | gpl-3.0 |
endolith/scipy | scipy/signal/tests/test_array_tools.py | 12 | 3632 | import numpy as np
from numpy.testing import assert_array_equal
from pytest import raises as assert_raises
from scipy.signal._arraytools import (axis_slice, axis_reverse,
odd_ext, even_ext, const_ext, zero_ext)
class TestArrayTools:
def test_axis_slice(self):
a = np.arange(12).reshape(3, 4)
... | bsd-3-clause |
HydrelioxGitHub/home-assistant | homeassistant/helpers/temperature.py | 18 | 1300 | """Temperature helpers for Home Assistant."""
from numbers import Number
from homeassistant.core import HomeAssistant
from homeassistant.util.temperature import convert as convert_temperature
from homeassistant.const import PRECISION_HALVES, PRECISION_TENTHS
def display_temp(hass: HomeAssistant, temperature: float, ... | apache-2.0 |
Lagovas/themis | docs/examples/python/smessage_test_rabbitMQ_server.py | 3 | 1837 | #
# Copyright (c) 2015 Cossack Labs Limited
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | apache-2.0 |
yakovenkodenis/rethinkdb | external/v8_3.30.33.16/build/gyp/pylib/gyp/generator/gypsh.py | 2779 | 1665 | # Copyright (c) 2011 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.
"""gypsh output module
gypsh is a GYP shell. It's not really a generator per se. All it does is
fire up an interactive Python session with a few local variables... | agpl-3.0 |
JaspervanBlokland/SandyApp | src/Toon/AdReview.py | 1 | 9559 | # -----------------------------------------------------------------------------
# Copyright (c) 2016+ Buro Petr van Blokland + Claudia Mens & Font Bureau
# www.pagebot.io
#
# P A G E B O T
#
# Licensed under MIT conditions
# Made for usage in DrawBot, www.drawbot.com
# ------------------------------... | mit |
ramcn/demo3 | venv/lib/python3.4/site-packages/autofixture/__init__.py | 1 | 7796 | # -*- coding: utf-8 -*-
import inspect
import sys
import warnings
from autofixture.base import AutoFixture
from autofixture.constraints import InvalidConstraint
if sys.version_info[0] < 3:
string_types = basestring
else:
string_types = str
__version__ = '0.10.0'
REGISTRY = {}
def register(model, autofix... | mit |
sometallgit/AutoUploader | Python27/Lib/ssl.py | 8 | 37805 | # Wrapper module for _ssl, providing some additional facilities
# implemented in Python. Written by Bill Janssen.
"""This module provides some more Pythonic support for SSL.
Object types:
SSLSocket -- subtype of socket.socket which does SSL over the socket
Exceptions:
SSLError -- exception raised for I/O erro... | mit |
xaviercobain88/framework-python | openerp/addons/account_analytic_plans/report/__init__.py | 445 | 1084 | # -*- 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... | agpl-3.0 |
georgewhewell/CouchPotatoServer | libs/enzyme/fourcc.py | 163 | 31535 | # -*- coding: utf-8 -*-
# enzyme - Video metadata parser
# Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com>
# Copyright 2003-2006 Dirk Meyer <dischi@freevo.org>
#
# This file is part of enzyme.
#
# enzyme is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public Lice... | gpl-3.0 |
Serag8/Bachelor | google_appengine/lib/cherrypy/cherrypy/_cptools.py | 82 | 19396 | """CherryPy tools. A "tool" is any helper, adapted to CP.
Tools are usually designed to be used in a variety of ways (although some
may only offer one if they choose):
Library calls
All tools are callables that can be used wherever needed.
The arguments are straightforward and should be detail... | mit |
longde123/MultiversePlatform | lib/IPCE/Lib/mimetools.py | 13 | 6759 | """Various tools used by MIME-reading or MIME-writing programs."""
import os
import rfc822
import tempfile
__all__ = ["Message","choose_boundary","encode","decode","copyliteral",
"copybinary"]
class Message(rfc822.Message):
"""A derived class of rfc822.Message that knows about MIME headers and
co... | mit |
switowski/invenio | invenio/legacy/oairepository/scripts/oairepositoryupdater.py | 15 | 1104 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2009, 2010, 2011, 2013 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 |
aESeguridad/GERE | venv/lib/python2.7/site-packages/lxml/html/_diffcommand.py | 93 | 2084 | import optparse
import sys
import re
import os
from lxml.html.diff import htmldiff
description = """\
"""
parser = optparse.OptionParser(
usage="%prog [OPTIONS] FILE1 FILE2\n"
"%prog --annotate [OPTIONS] INFO1 FILE1 INFO2 FILE2 ...",
description=description,
)
parser.add_option(
'-o', '--output',... | gpl-3.0 |
muntasirsyed/intellij-community | python/lib/Lib/UserString.py | 91 | 8186 | #!/usr/bin/env python
## vim:ts=4:et:nowrap
"""A user-defined wrapper around string objects
Note: string objects have grown methods in Python 1.6
This module requires Python 1.6 or later.
"""
import sys
__all__ = ["UserString","MutableString"]
class UserString:
def __init__(self, seq):
if isinstance(seq,... | apache-2.0 |
gcarq/freqtrade | freqtrade/plugins/protections/low_profit_pairs.py | 1 | 3113 |
import logging
from datetime import datetime, timedelta
from typing import Any, Dict
from freqtrade.persistence import Trade
from freqtrade.plugins.protections import IProtection, ProtectionReturn
logger = logging.getLogger(__name__)
class LowProfitPairs(IProtection):
has_global_stop: bool = False
has_lo... | gpl-3.0 |
liqd/a4-meinberlin | tests/maptopicprio/views/test_maptopic_update.py | 1 | 1815 | import pytest
from django.urls import reverse
from adhocracy4.test.helpers import redirect_target
from meinberlin.apps.maptopicprio import models
@pytest.mark.django_db
def test_user_cannot_update(client, user, maptopic_factory,
area_settings_factory):
maptopic = maptopic_factory()
... | agpl-3.0 |
grilofw/grilo-plugins | tests/dleyna/dbusmock/items.py | 6 | 4309 | # -*- coding: utf-8 -*-
'''dLeyna DMS fake content hierarchy'''
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option) any
# later version. ... | lgpl-2.1 |
Acehaidrey/incubator-airflow | airflow/executors/sequential_executor.py | 10 | 2593 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache-2.0 |
scztt/supercollider | external_libraries/simplejson-2.3.2/encoder.py | 44 | 20259 | """Implementation of JSONEncoder
"""
import re
from decimal import Decimal
def _import_speedups():
try:
from . import _speedups
return _speedups.encode_basestring_ascii, _speedups.make_encoder
except ImportError:
return None, None
c_encode_basestring_ascii, c_make_encoder = _import_spee... | gpl-3.0 |
mmbtba/odoo | addons/report/controllers/main.py | 210 | 6943 | # -*- 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 |
waseem18/oh-mainline | vendor/packages/odict/setup.py | 16 | 1342 | # Python Software Foundation License
from setuptools import setup, find_packages
import os
version = '1.4.3'
shortdesc = 'Ordered dictionary.'
longdesc = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
longdesc += open(os.path.join(os.path.dirname(__file__), 'LICENSE.rst')).read()
tests_require = [... | agpl-3.0 |
skipmodea1/plugin.video.xbmctorrent | resources/site-packages/html5lib/inputstream.py | 35 | 30624 | from __future__ import absolute_import, division, unicode_literals
from six import text_type
import codecs
import re
from .constants import EOF, spaceCharacters, asciiLetters, asciiUppercase
from .constants import encodings, ReparseException
from . import utils
from io import StringIO
try:
from io import BytesI... | gpl-3.0 |
drawks/ansible | test/integration/targets/error_from_connection/connection_plugins/dummy.py | 56 | 1040 | from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
author:
- John Doe
connection: dummy
short_description: defective connection plugin
description:
- defective connection plugin
version_added: "2.0"
options: {}
"""
import ... | gpl-3.0 |
asandyz/oppia | core/tests/test_utils.py | 9 | 25100 | # coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | apache-2.0 |
coreycb/horizon | openstack_dashboard/dashboards/project/access_and_security/keypairs/views.py | 6 | 5122 | # Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | apache-2.0 |
wwj718/edx-platform | openedx/core/djangoapps/credit/views.py | 51 | 7791 | """
Views for the credit Django app.
"""
from __future__ import unicode_literals
import logging
import datetime
from django.conf import settings
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys im... | agpl-3.0 |
Spanarchie/pyRest | pyRest/pyRest/lib/python2.7/site-packages/pip/vendor/html5lib/treebuilders/_base.py | 79 | 13710 | from __future__ import absolute_import, division, unicode_literals
from pip.vendor.six import text_type
from ..constants import scopingElements, tableInsertModeElements, namespaces
# The scope markers are inserted when entering object elements,
# marquees, table cells, and table captions, and are used to prevent form... | unlicense |
pplatek/odoo | addons/purchase/wizard/__init__.py | 439 | 1112 | # -*- 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... | agpl-3.0 |
Cynerva/pyipmi | pyipmi/commands/info.py | 2 | 4185 | # Copyright (c) 2012, Calxeda 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 of conditions and th... | bsd-3-clause |
AndBicScadMedia/YouCompleteMe | python/ycm/test_utils.py | 42 | 1202 | #!/usr/bin/env python
#
# Copyright (C) 2011, 2012 Google Inc.
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe 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 |
alexandreleroux/mayavi | docs/source/mayavi/auto/numeric_source.py | 7 | 2117 | #!/usr/bin/env python
"""This script demonstrates how to create a numpy array data and
visualize it as image data using a few modules.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005-2008, Enthought, Inc.
# License: BSD Style.
# Standard library imports
import numpy
# Enthought librar... | bsd-3-clause |
trabacus-softapps/openerp-8.0-cc | openerp/addons/mrp_repair/mrp_repair.py | 2 | 39154 | # -*- 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 |
ltilve/chromium | tools/memory_inspector/memory_inspector/classification/native_heap_classifier.py | 89 | 8377 | # 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.
"""This module classifies NativeHeap objects filtering their allocations.
The only filter currently available is 'stacktrace', which works as follows:
{'na... | bsd-3-clause |
Ensembles/ert | python/python/ert/enkf/local_obsdata.py | 1 | 5106 | from cwrap import BaseCClass
from ert.enkf import EnkfPrototype, LocalObsdataNode
class LocalObsdata(BaseCClass):
TYPE_NAME = "local_obsdata"
_alloc = EnkfPrototype("void* local_obsdata_alloc(char*)", bind = False)
_free = EnkfPrototype("void local_obsdata_free(local_obsdata)")
_size ... | gpl-3.0 |
sivajipr/google_python | logpuzzle/logpuzzle.py | 1 | 1222 | #!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
import os
import re
import sys
import urllib
def sort_url(files):
for line in files:
match... | apache-2.0 |
cedk/odoo | addons/base_gengo/wizard/__init__.py | 434 | 1077 | # -*- 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 |
blampe/M2M | reportlab-2.5/build/lib.win32-2.7/reportlab/graphics/samples/simple_pie.py | 14 | 2914 | #Autogenerated by ReportLab guiedit do not edit
from reportlab.graphics.charts.piecharts import Pie
from reportlab.graphics.widgets.grids import ShadedRect
from reportlab.graphics.charts.legends import Legend
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
from reportlab.graphics.charts.textl... | mit |
joariasl/odoo | addons/base_setup/base_setup.py | 382 | 5430 | # -*- coding: 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 the GNU... | agpl-3.0 |
tensorflow/probability | tensorflow_probability/python/bijectors/fill_triangular_test.py | 1 | 3681 | # Copyright 2018 The TensorFlow Probability 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 law o... | apache-2.0 |
w1ll1am23/home-assistant | tests/components/google_assistant/test_http.py | 8 | 6465 | """Test Google http services."""
from datetime import datetime, timedelta, timezone
from unittest.mock import ANY, patch
from homeassistant.components.google_assistant import GOOGLE_ASSISTANT_SCHEMA
from homeassistant.components.google_assistant.const import (
HOMEGRAPH_TOKEN_URL,
REPORT_STATE_BASE_URL,
)
from... | apache-2.0 |
mcbrune/delphixpy | v1_7_0/dx_provision_vdb.py | 3 | 48516 | #!/usr/bin/env python
#Adam Bowen - Apr 2016
#This script provisions a vdb or dSource
# Updated by Corey Brune Aug 2016
# --- Create vFiles VDB
#requirements
#pip install docopt delphixpy
#The below doc follows the POSIX compliant standards and allows us to use
#this doc to also define our arguments for the script.
... | mit |
libracore/erpnext | erpnext/accounts/doctype/gl_entry/test_gl_entry.py | 6 | 2508 | # 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, unittest
from frappe.model.naming import parse_naming_series
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_j... | gpl-3.0 |
krez13/scikit-learn | sklearn/naive_bayes.py | 29 | 28917 | # -*- coding: utf-8 -*-
"""
The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These
are supervised learning methods based on applying Bayes' theorem with strong
(naive) feature independence assumptions.
"""
# Author: Vincent Michel <vincent.michel@inria.fr>
# Minor fixes by Fabian Pedre... | bsd-3-clause |
JFriel/honours_project | venv/lib/python2.7/site-packages/pip/commands/install.py | 73 | 10903 | import os
import sys
import tempfile
import shutil
from pip.req import InstallRequirement, RequirementSet, parse_requirements
from pip.log import logger
from pip.locations import src_prefix, virtualenv_no_global, distutils_scheme
from pip.basecommand import Command
from pip.index import PackageFinder
from pip.exception... | gpl-3.0 |
gojira/tensorflow | tensorflow/contrib/keras/api/keras/utils/__init__.py | 27 | 1925 | # 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 |
nimble0/plover | test/test_formatting.py | 1 | 39193 | # Copyright (c) 2013 Hesky Fisher
# See LICENSE.txt for details.
"""Unit tests for formatting.py."""
import inspect
import pytest
from plover import formatting
from plover_build_utils.testing import CaptureOutput
from . import parametrize
def action(**kwargs):
# Support using something like `text_and_word='s... | gpl-2.0 |
labrador0115/jluee | shadowsocksr/shadowsocks/obfsplugin/http_simple.py | 7 | 12325 | #!/usr/bin/env python
#
# Copyright 2015-2015 breakwa11
#
# 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... | gpl-3.0 |
brian-l/django-1.4.10 | tests/regressiontests/reverse_single_related/tests.py | 150 | 1491 | from __future__ import absolute_import
from django.test import TestCase
from .models import Source, Item
class ReverseSingleRelatedTests(TestCase):
"""
Regression tests for an object that cannot access a single related
object due to a restrictive default manager.
"""
def test_reverse_single_rel... | bsd-3-clause |
JapuDCret/RocketMap-Do | pogom/cluster.py | 10 | 3667 | from .utils import distance
from .transform import intermediate_point
class SpawnCluster(object):
def __init__(self, spawnpoint):
self._spawnpoints = [spawnpoint]
self.centroid = (spawnpoint['lat'], spawnpoint['lng'])
self.min_time = spawnpoint['time']
self.max_time = spawnpoint['t... | agpl-3.0 |
Mutnick/nicotine-plus | pynicotine/gtkgui/countrycodes.py | 2 | 5861 | # Copyright (C) 2009 quinox. All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is ... | gpl-3.0 |
webmakin/scrapy | scrapy/contracts/default.py | 153 | 2334 | from scrapy.item import BaseItem
from scrapy.http import Request
from scrapy.exceptions import ContractFail
from . import Contract
# contracts
class UrlContract(Contract):
""" Contract to set the url of the request (mandatory)
@url http://scrapy.org
"""
name = 'url'
def adjust_request_args(... | bsd-3-clause |
christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim/first_agent_first_choices.py | 2 | 1024 | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from numpy import array, ones, arange, argsort
from urbansim.lottery_choices import lottery_choices
from scipy.ndimage import sum as ndimage_sum
class first_agent_first_choices(lottery_choices... | gpl-2.0 |
Silight/ComicEnv | ComicEnv/lib/python3.2/site-packages/pip/_vendor/html5lib/filters/whitespace.py | 1730 | 1142 | from __future__ import absolute_import, division, unicode_literals
import re
from . import _base
from ..constants import rcdataElements, spaceCharacters
spaceCharacters = "".join(spaceCharacters)
SPACES_REGEX = re.compile("[%s]+" % spaceCharacters)
class Filter(_base.Filter):
spacePreserveElements = frozenset... | mit |
yosshy/nova | nova/service.py | 1 | 16355 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | apache-2.0 |
CameronLonsdale/sec-tools | letsjusthackshit/lib/python3.5/site-packages/pip/_vendor/requests/packages/chardet/euckrprober.py | 2931 | 1675 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... | mit |
mdgeek/VistA-FHIR-CWF | Utilities/XINDEX/XINDEXExceptGen.py | 7 | 6134 | #!/usr/bin/env python
# Automatically generate XINDEX Exception file list based on CTest log files
# Please run CTest to generate the log files first before running this script
#
# To generate XINDEX Exception file list for routine(s) under package FOO
# python XindexExceptGen.py -l <logDir> -v <VistADir>
# ... | apache-2.0 |
saradbowman/osf.io | osf/models/admin_log_entry.py | 11 | 1135 | from django.contrib.admin.models import LogEntry, LogEntryManager
UNKNOWN = 0
ACCEPT_PREREG = 10
REJECT_PREREG = 11
COMMENT_PREREG = 12
CHECKOUT_CHECKUP = 13
CONFIRM_SPAM = 20
CONFIRM_HAM = 21
NODE_REMOVED = 30
NODE_RESTORED = 31
CONTRIBUTOR_REMOVED = 32
NODE_MADE_PRIVATE = 33
EMBARGO_UPDATED = 34
USER_REMOVED = 4... | apache-2.0 |
anryko/ansible | test/units/modules/network/ingate/ingate_module.py | 50 | 2344 | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Ingate Systems AB
#
# 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 opti... | gpl-3.0 |
tchellomello/home-assistant | homeassistant/components/vizio/config_flow.py | 2 | 18131 | """Config flow for Vizio."""
import copy
import logging
import socket
from typing import Any, Dict, Optional
from pyvizio import VizioAsync, async_guess_device_type
from pyvizio.const import APP_HOME
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.media_player import DE... | apache-2.0 |
pdellaert/ansible | lib/ansible/modules/network/aci/aci_epg_to_contract.py | 27 | 9836 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | gpl-3.0 |
stack-of-tasks/sot-core | src/dynamic_graph/sot/core/utils/thread_interruptible_loop.py | 1 | 2795 | # This class embeds a given loop function (generally by using a decorator) into
# a dedicated thread, whose execution can be stoped or run on demand from the
# script thread.
#
# To use the previous class, a 'loop' function has to be defined.
# Everything will be embedded by using the decorator below. Just
# use it as:... | bsd-2-clause |
peterfpeterson/mantid | scripts/Inelastic/IndirectImport.py | 1 | 3918 | # Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
"""
... | gpl-3.0 |
pgm/StarCluster | starcluster/commands/removeimage.py | 19 | 3357 | # Copyright 2009-2014 Justin Riley
#
# This file is part of StarCluster.
#
# StarCluster is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later ... | gpl-3.0 |
payeldillip/django | django/dispatch/weakref_backports.py | 414 | 2151 | """
weakref_backports is a partial backport of the weakref module for python
versions below 3.4.
Copyright (C) 2013 Python Software Foundation, see license.python.txt for
details.
The following changes were made to the original sources during backporting:
* Added `self` to `super` calls.
* Removed `from None` when... | bsd-3-clause |
shubhdev/edx-platform | common/lib/xmodule/xmodule/tests/xml/factories.py | 77 | 4963 | """
Factories for generating edXML for testing XModule import
"""
import inspect
from fs.memoryfs import MemoryFS
from factory import Factory, lazy_attribute, post_generation, Sequence
from lxml import etree
from xmodule.modulestore.inheritance import InheritanceMixin
from xmodule.x_module import XModuleMixin
from x... | agpl-3.0 |
ericlink/adms-server | playframework-dist/play-1.1/python/Lib/rexec.py | 2 | 20620 | """Restricted execution facilities.
The class RExec exports methods r_exec(), r_eval(), r_execfile(), and
r_import(), which correspond roughly to the built-in operations
exec, eval(), execfile() and import, but executing the code in an
environment that only exposes those built-in operations that are
deemed safe.... | mit |
alexm92/sentry | src/sentry/south_migrations/0063_auto.py | 36 | 19204 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding index on 'MessageCountByMinute', fields ['date']
db.create_index('sentry_messagecountbyminute', ['d... | bsd-3-clause |
crmccreary/openerp_server | openerp/report/pyPdf/pdf.py | 15 | 78970 | # -*- coding: utf-8 -*-
#
# vim: sw=4:expandtab:foldmethod=marker
#
# Copyright (c) 2006, Mathieu Fenniak
# Copyright (c) 2007, Ashish Kulkarni <kulkarni.ashish@gmail.com>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the foll... | agpl-3.0 |
altenia/repodium | node_modules/nodegit/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py | 2736 | 6387 | # 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.
"""Visual Studio project reader/writer."""
import gyp.common
import gyp.easy_xml as easy_xml
#-------------------------------------------------------------------... | mit |
mixturemodel-flow/tensorflow | tensorflow/python/tools/inspect_checkpoint.py | 65 | 5048 | # 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 |
WPMedia/dd-agent | checks.d/kong.py | 9 | 2562 | # stdlib
import urlparse
# 3rd party
import requests
import simplejson as json
# project
from checks import AgentCheck
from util import headers
class Kong(AgentCheck):
METRIC_PREFIX = 'kong.'
""" collects metrics for Kong """
def check(self, instance):
metrics = self._fetch_data(instance)
... | bsd-3-clause |
twobob/buildroot-kindle | output/build/host-python-2.7.2/Mac/Modules/fm/fmscan.py | 34 | 2554 | # Scan an Apple header file, generating a Python file of generator calls.
import sys
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
LONG = "Fonts"
SHORT = "fm"
def main():
input = "Fonts.h"
output = SHORT + "gen.py"
defsoutput = TOOLBOXDIR + LONG + ".... | gpl-2.0 |
sampattuzzi/webvtt-py | tests/segmenter.py | 1 | 7282 | import os
import unittest
from shutil import rmtree
from webvtt import WebVTTSegmenter, Caption
from webvtt.exceptions import InvalidCaptionsError
from webvtt import WebVTT
BASE_DIR = os.path.dirname(__file__)
SUBTITLES_DIR = os.path.join(BASE_DIR, 'subtitles')
OUTPUT_DIR = os.path.join(BASE_DIR, 'output')
class We... | mit |
kenshay/ImageScript | Script_Runner/PYTHON/Lib/site-packages/pip/_vendor/urllib3/connection.py | 137 | 13003 | from __future__ import absolute_import
import datetime
import logging
import os
import sys
import socket
from socket import error as SocketError, timeout as SocketTimeout
import warnings
from .packages import six
from .packages.six.moves.http_client import HTTPConnection as _HTTPConnection
from .packages.six.moves.http... | gpl-3.0 |
DirectXMan12/nova-hacking | nova/network/quantumv2/api.py | 1 | 42326 | # Copyright 2012 OpenStack Foundation
# All Rights Reserved
# Copyright (c) 2012 NEC 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/lic... | apache-2.0 |
dliessi/frescobaldi | frescobaldi_app/midifile/event.py | 3 | 2133 | # Python midifile package -- parse, load and play MIDI files.
# Copyright (c) 2011 - 2014 by Wilbert Berendsen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License... | gpl-2.0 |
alexthered/kienhoc-platform | cms/djangoapps/contentstore/management/commands/reindex_library.py | 155 | 2604 | """ Management command to update libraries' search index """
from django.core.management import BaseCommand, CommandError
from optparse import make_option
from textwrap import dedent
from contentstore.courseware_index import LibrarySearchIndexer
from opaque_keys.edx.keys import CourseKey
from opaque_keys import Inval... | agpl-3.0 |
BryanCutler/spark | examples/src/main/python/ml/vector_indexer_example.py | 27 | 1646 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 |
tannoa2/RackHD | test/tests/switch/test_rackhd11_switch_pollers.py | 1 | 12932 | '''
Copyright 2016, EMC, Inc.
Author(s):
FIT test script template
'''
import fit_path # NOQA: unused import
import sys
import subprocess
import pprint
import fit_common
import test_api_utils
# LOCAL
NODELIST = []
def get_switches():
# returns a list with valid node IDs that match ARGS_LIST.sku in 'Name' or ... | apache-2.0 |
Omegaphora/external_chromium_org | third_party/closure_linter/closure_linter/full_test.py | 84 | 3563 | #!/usr/bin/env python
#
# Copyright 2007 The Closure Linter 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
#... | bsd-3-clause |
vergil1874/ardupilot | Tools/autotest/common.py | 142 | 9612 | import util, pexpect, time, math
from pymavlink import mavwp
# a list of pexpect objects to read while waiting for
# messages. This keeps the output to stdout flowing
expect_list = []
def expect_list_clear():
'''clear the expect list'''
global expect_list
for p in expect_list[:]:
expect_list.remov... | gpl-3.0 |
robbiet480/home-assistant | tests/components/intent_script/test_init.py | 23 | 1305 | """Test intent_script component."""
from homeassistant.bootstrap import async_setup_component
from homeassistant.helpers import intent
from tests.common import async_mock_service
async def test_intent_script(hass):
"""Test intent scripts work."""
calls = async_mock_service(hass, "test", "service")
await... | apache-2.0 |
fbradyirl/home-assistant | homeassistant/components/comfoconnect/fan.py | 2 | 3357 | """Platform to control a Zehnder ComfoAir Q350/450/600 ventilation unit."""
import logging
from homeassistant.components.fan import (
SPEED_HIGH,
SPEED_LOW,
SPEED_MEDIUM,
SPEED_OFF,
SUPPORT_SET_SPEED,
FanEntity,
)
from homeassistant.helpers.dispatcher import dispatcher_connect
from . import DO... | apache-2.0 |
town-hall-pinball/project-omega | tests/lib/util/test_show.py | 1 | 2552 | # Copyright (c) 2014 - 2016 townhallpinball.org
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, p... | mit |
klen/python-mode | pymode/libs/logilab-common-1.4.1/test/unittest_interface.py | 14 | 2703 | # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as publ... | lgpl-3.0 |
jiangming1399/xbmc-addons-chinese | plugin.video.bilibili/resources/lib/subtitle.py | 7 | 2213 | #coding: utf8
import datetime
TIME_FORMAT = '{0:d}:{1:02d}:{2:02d}.{3:02d}'
def _parse_time(time_str):
time_split = time_str.split(':')
hour = int(time_split[0])
minute = int(time_split[1])
second_and_microsecond = time_split[2].split('.')
second = int(second_and_microsecond[0])
mic... | gpl-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.