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 |
|---|---|---|---|---|---|
syphar/django | django/core/validators.py | 6 | 17890 | from __future__ import unicode_literals
import os
import re
from django.core.exceptions import ValidationError
from django.utils import six
from django.utils.deconstruct import deconstructible
from django.utils.encoding import force_text
from django.utils.functional import SimpleLazyObject
from django.utils.ipv6 impo... | bsd-3-clause |
dimakarp1996/Hangman | Hangman/__init__.py | 1 | 1330 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 14 10:59:51 2017
@author: tcs-user
"""
import random # calculate random numbers
DICT = ['east', 'eats', 'seat', 'teas']
def loss(attempts, num): # calculate loss
if attempts >= num:
return 'You lost!'
return 'You won!'
def chec... | gpl-3.0 |
boogiekodi/plugin.program.ump | lib/providers/wip/!video_link_koreanturk.py | 2 | 2559 | import json
import re
from urllib2 import HTTPError
encoding="utf-8"
domain = 'http://www.koreanturk.com'
def run(ump):
globals()['ump'] = ump
i=ump.info
is_serie,names=ump.get_vidnames()
found=False
if not i["code"][:2]=="tt" or not is_serie:
return None
for name in names:
ump.add_log("koreanturk is se... | gpl-2.0 |
darkryder/django | tests/forms_tests/field_tests/test_filepathfield.py | 22 | 5261 | from __future__ import unicode_literals
import os.path
from django.forms import FilePathField, ValidationError, forms
from django.test import SimpleTestCase
from django.utils import six
from django.utils._os import upath
def fix_os_paths(x):
if isinstance(x, six.string_types):
return x.replace('\\', '/'... | bsd-3-clause |
LucasGandel/ITK | Modules/IO/GDCM/wrapping/test/ReadDicomAndReadTagTest.py | 7 | 2059 | # ==========================================================================
#
# Copyright NumFOCUS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/... | apache-2.0 |
gmalmquist/pants | src/python/pants/base/exceptions.py | 9 | 1672 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
class TaskError(Exc... | apache-2.0 |
simontakite/sysadmin | pythonscripts/masteroop/Code bundle_0971OS/Chapter 1/p1_c01.py | 1 | 17099 | #!/usr/bin/env python3
# Chapter 1 -- The ``__init__()`` Method
# -----------------------------------------
# .. sectnum::
#
# .. contents::
#
# Simple Objects: Cards
# ==============================
# Definition of a simple class hierarchy
# ::
class Card:
insure= False
def __init__( self, rank, suit )... | gpl-2.0 |
synkarius/dragonfly | build_dist.py | 5 | 5034 | #
# This file is part of Dragonfly.
# (c) Copyright 2007, 2008 by Christo Butcher
# Licensed under the LGPL.
#
# Dragonfly 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... | lgpl-3.0 |
Pluto-tv/chromium-crosswalk | tools/perf/page_sets/page_cycler/moz.py | 13 | 3453 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import page as page_module
from telemetry import story
class MozPage(page_module.Page):
def __init__(self, url, page_set):
super(M... | bsd-3-clause |
epssy/hue | apps/search/src/search/conf.py | 26 | 1409 | #!/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 |
salberin/libsigrokdecode | decoders/sdcard_spi/pd.py | 2 | 14641 | ##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2012-2014 Uwe Hermann <uwe@hermann-uwe.de>
##
## 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 t... | gpl-3.0 |
firerszd/kbengine | kbe/res/scripts/common/Lib/turtledemo/penrose.py | 150 | 3540 | #!/usr/bin/env python3
""" xturtle-example-suite:
xtx_kites_and_darts.py
Constructs two aperiodic penrose-tilings,
consisting of kites and darts, by the method
of inflation in six steps.
Starting points are the patterns "sun"
consisting of five kites and "star"
consisting of five darts.
For more inf... | lgpl-3.0 |
cloudbase/maas | src/provisioningserver/import_images/tests/test_tgt.py | 1 | 9954 | # Copyright 2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for import script's iSCSI code."""
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
str = None
__metaclass__ = type
__all__... | agpl-3.0 |
UK992/servo | tests/wpt/web-platform-tests/tools/third_party/hyper/hyper/packages/hpack/huffman.py | 42 | 5021 | # -*- coding: utf-8 -*-
"""
hpack/huffman_decoder
~~~~~~~~~~~~~~~~~~~~~
An implementation of a bitwise prefix tree specially built for decoding
Huffman-coded content where we already know the Huffman table.
"""
from .compat import to_byte, decode_hex
from .exceptions import HPACKDecodingError
def _pad_binary(bin_str,... | mpl-2.0 |
kevin8909/xjerp | openerp/addons/lunch/wizard/lunch_validation.py | 440 | 1296 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2012 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | agpl-3.0 |
charettes/django-mutant | mutant/contrib/geo/models/field.py | 1 | 2845 | from __future__ import unicode_literals
from django.contrib.gis.db import models
from django.utils.translation import ugettext_lazy as _
from mutant.models import FieldDefinition, FieldDefinitionManager
srid_help_text = _('Spatial Reference System Identity')
spatial_index_help_text = _('Creates a spatial index for t... | mit |
matthiasdiener/spack | var/spack/repos/builtin/packages/xf86rushproto/package.py | 5 | 1561 | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 |
jandrest2018/TWJ-2017-A | 04 Angular/A-Web/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py | 1534 | 3426 | # 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.
import collections
import os
import gyp
import gyp.common
import gyp.msvs_emulation
import json
import sys
generator_supports_multiple_toolsets = True
generator_... | mit |
Lessig2016/pledgeservice | lib/requests/packages/urllib3/util/url.py | 304 | 4273 | from collections import namedtuple
from ..exceptions import LocationParseError
class Url(namedtuple('Url', ['scheme', 'auth', 'host', 'port', 'path', 'query', 'fragment'])):
"""
Datastructure for representing an HTTP URL. Used as a return value for
:func:`parse_url`.
"""
slots = ()
def __new... | agpl-3.0 |
luckylavish/zamboni | mkt/constants/platforms.py | 13 | 1391 | from tower import ugettext_lazy as _
def FREE_PLATFORMS():
platforms = (
('free-firefoxos', _('Firefox OS')),
('free-desktop', _('Firefox for Desktop')),
('free-android-mobile', _('Firefox Mobile')),
('free-android-tablet', _('Firefox Tablet')),
)
return platforms
def PA... | bsd-3-clause |
hengqujushi/shadowsocks | setup.py | 929 | 1321 | import codecs
from setuptools import setup
with codecs.open('README.rst', encoding='utf-8') as f:
long_description = f.read()
setup(
name="shadowsocks",
version="2.8.2",
license='http://www.apache.org/licenses/LICENSE-2.0',
description="A fast tunnel proxy that help you get through firewalls",
... | apache-2.0 |
LaoZhongGu/kbengine | kbe/src/lib/python/Lib/unittest/util.py | 794 | 4157 | """Various utility functions."""
from collections import namedtuple, OrderedDict
__unittest = True
_MAX_LENGTH = 80
def safe_repr(obj, short=False):
try:
result = repr(obj)
except Exception:
result = object.__repr__(obj)
if not short or len(result) < _MAX_LENGTH:
return result
... | lgpl-3.0 |
noroutine/ansible | lib/ansible/modules/monitoring/statusio_maintenance.py | 49 | 17259 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Benjamin Copeland (@bhcopeland) <ben@copeland.me.uk>
# 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_... | gpl-3.0 |
xbezdick/tempest | tempest/api/compute/servers/test_server_personality.py | 6 | 2878 | # Copyright 2012 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 requ... | apache-2.0 |
ThiefMaster/indico | indico/modules/events/surveys/fields/__init__.py | 4 | 1029 | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from indico.core import signals
from indico.modules.events.surveys.fields.base import SurveyField
from ind... | mit |
heytcass/homeassistant-config | deps/requests/packages/urllib3/util/retry.py | 360 | 10664 | from __future__ import absolute_import
import time
import logging
from ..exceptions import (
ConnectTimeoutError,
MaxRetryError,
ProtocolError,
ReadTimeoutError,
ResponseError,
)
from ..packages import six
log = logging.getLogger(__name__)
class Retry(object):
""" Retry configuration.
... | mit |
ShassAro/ShassAro | DockerAdmin/dockerVirtualEnv/lib/python2.7/site-packages/requests/packages/chardet/chardistribution.py | 2755 | 9226 | ######################## 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-2.0 |
victorkeophila/alien4cloud-cloudify3-provider | src/test/resources/outputs/blueprints/amazon/artifact_testOverridden/wrapper/War_Tomcat/warHostedOnTomcatWithPropertiesTomcat/artifacts/artifact-test-types/scripts/_a4c_tomcat_install_war.py | 2 | 17094 |
from cloudify import ctx
from cloudify.exceptions import NonRecoverableError
from cloudify.state import ctx_parameters as inputs
import subprocess
import os
import re
import sys
import time
import threading
import platform
from StringIO import StringIO
from cloudify_rest_client import CloudifyClient
from cloudify impo... | apache-2.0 |
buzzfeed/facepy | facepy/exceptions.py | 3 | 1107 | class FacepyError(Exception):
"""Base class for exceptions raised by Facepy."""
class FacebookError(FacepyError):
"""Exception for Facebook errors."""
def __init__(self, message=None, code=None, error_data=None, error_subcode=None,
is_transient=None, error_user_title=None, error_user_msg=... | mit |
ProjectSWGCore/NGECore2 | scripts/mobiles/tatooine/desert_demon_leader.py | 2 | 1368 | import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | lgpl-3.0 |
nilmini20s/gem5-2016-08-13 | src/arch/x86/isa/insts/x87/arithmetic/division.py | 41 | 2926 | # Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... | bsd-3-clause |
Pablo126/SSBW | Entrega1/lib/python3.5/site-packages/rest_framework/utils/html.py | 27 | 2079 | """
Helpers for dealing with HTML input.
"""
import re
from django.utils.datastructures import MultiValueDict
def is_html_input(dictionary):
# MultiDict type datastructures are used to represent HTML form input,
# which may have more than one value for each key.
return hasattr(dictionary, 'getlist')
de... | gpl-3.0 |
morningman/palo | gensrc/script/gen_builtins_functions.py | 3 | 4356 | """
This module is palo builtin functions
"""
import sys
import os
from string import Template
import palo_builtins_functions
java_registry_preamble = '\
// Modifications copyright (C) 2017, Baidu.com, Inc. \n\
// Copyright 2017 The Apache Software Foundation \n\
// \n\
// Licensed to the Apache Software Foundation... | apache-2.0 |
ojii/django-shop | shop/urls.py | 1 | 2662 | #-*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, include, url
from shop.models.productmodel import Product
from shop.views import ShopListView, ShopTemplateView
from shop.views.cart import CartDetails, CartItemDetail
from shop.views.checkout import ThankYouView, CheckoutSelectionView, \
Shippi... | bsd-3-clause |
frdb194/django | tests/gis_tests/test_geoforms.py | 292 | 14830 | from unittest import skipUnless
from django.contrib.gis import forms
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geos import GEOSGeometry
from django.forms import ValidationError
from django.test import SimpleTestCase, skipUnlessDBFeature
from django.utils import six
from django.utils.html imp... | bsd-3-clause |
kaichogami/sympy | sympy/polys/orderings.py | 123 | 8498 | """Definitions of monomial orderings. """
from __future__ import print_function, division
__all__ = ["lex", "grlex", "grevlex", "ilex", "igrlex", "igrevlex"]
from sympy.core import Symbol
from sympy.core.compatibility import iterable
class MonomialOrder(object):
"""Base class for monomial orderings. """
al... | bsd-3-clause |
gloryofrobots/obin | arza/misc/_platform_python.py | 2 | 4672 | __author__ = 'gloryofrobots'
import re
import random as r
class rfloat:
INFINITY = 1e200 * 1e200
NAN = abs(INFINITY / INFINITY)
@staticmethod
def isnan(v):
return v == rfloat.NAN
@staticmethod
def isinf(v):
return v == rfloat.INFINITY
class rarithmetic:
r_uint = long
r_i... | gpl-2.0 |
AlexeyKruglov/Skeinforge-fabmetheus | fabmetheus_utilities/geometry/manipulation_shapes/_outset.py | 8 | 3424 | """
Create inset.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from fabmetheus_utilities.geometry.creation import lineation
from fabmetheus_utili... | agpl-3.0 |
eamosov/thrift | lib/py/src/server/TNonblockingServer.py | 19 | 12495 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
jonyroda97/redbot-amigosprovaveis | lib/pip/_vendor/chardet/langbulgarianmodel.py | 269 | 12839 | ######################## 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 |
mewtaylor/django | django/http/cookie.py | 460 | 4390 | from __future__ import unicode_literals
import sys
from django.utils import six
from django.utils.encoding import force_str
from django.utils.six.moves import http_cookies
# Some versions of Python 2.7 and later won't need this encoding bug fix:
_cookie_encodes_correctly = http_cookies.SimpleCookie().value_encode(';... | bsd-3-clause |
rexshihaoren/scikit-learn | sklearn/utils/fixes.py | 29 | 12072 | """Compatibility fixes for older version of python, numpy and scipy
If you add content to this file, please give the version of the package
at which the fixe is no longer needed.
"""
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# ... | bsd-3-clause |
JCBarahona/edX | common/test/acceptance/tests/studio/test_studio_settings_certificates.py | 24 | 12265 | """
Acceptance tests for Studio's Setting pages
"""
import re
import uuid
from .base_studio_test import StudioCourseTest
from ...pages.studio.settings_certificates import CertificatesPage
from ...pages.studio.settings_advanced import AdvancedSettingsPage
class CertificatesTest(StudioCourseTest):
"""
Tests for... | agpl-3.0 |
VisTrails/VisTrails | vistrails/packages/tabledata/write/write_numpy.py | 3 | 4325 | from __future__ import division
from vistrails.core.modules.vistrails_module import Module
from ..common import get_numpy
from ..read.read_numpy import NumPyArray
class WriteNumPy(Module):
"""Writes a list as a Numpy file.
NumPy can use one of two schemes: either 'plain' binary arrays, i.e. just
the bi... | bsd-3-clause |
zorroz/microblog | flask/lib/python2.7/site-packages/sqlalchemy/log.py | 33 | 6712 | # sqlalchemy/log.py
# Copyright (C) 2006-2017 the SQLAlchemy authors and contributors
# <see AUTHORS file>
# Includes alterations by Vinay Sajip vinay_sajip@yahoo.co.uk
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Logging control a... | bsd-3-clause |
detiber/ansible | lib/ansible/modules/packaging/language/npm.py | 70 | 8945 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Chris Hoffman <christopher.hoffman@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 ... | gpl-3.0 |
uzbit/mlutils | test/test_MetaClassifier.py | 1 | 3528 |
import unittest, os
import numpy as np
import pickle as pickle
from sklearn import datasets
from sklearn.model_selection import train_test_split
from mlutils.MetaClassifier import MetaClassifier
from mlutils.mlutils import get_auc
SEED = 42
class MetaClassifierTest(unittest.TestCase):
@classmethod
def setUpClass... | apache-2.0 |
ManiacalLabs/BiblioPixel | test/bibliopixel/layout/layout_matrix_test.py | 2 | 1319 | import unittest
from bibliopixel.layout.geometry import matrix
class MatrixTest(unittest.TestCase):
def test_simple(self):
m = matrix.Matrix(list(range(12)), 3)
self.assertEqual(m.get(0, 0), 0)
self.assertEqual(m.get(1, 0), 1)
self.assertEqual(m.get(0, 1), 3)
self.assertEqu... | mit |
bbbenja/SickRage | lib/chardet/langbulgarianmodel.py | 53 | 12786 | ######################## 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 |
kou/zulip | zerver/tests/test_muting.py | 6 | 6841 | from datetime import datetime, timedelta, timezone
from typing import Any, Dict
from unittest import mock
from django.utils.timezone import now as timezone_now
from zerver.lib.stream_topic import StreamTopicTarget
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.topic_mutes import (
add_topic_mut... | apache-2.0 |
nfletton/django-oscar | tests/integration/order/creator_tests.py | 45 | 7517 | from decimal import Decimal as D
from django.test import TestCase
from django.test.utils import override_settings
from mock import Mock
from oscar.apps.catalogue.models import ProductClass, Product
from oscar.apps.offer.utils import Applicator
from oscar.apps.order.models import Order
from oscar.apps.order.utils impo... | bsd-3-clause |
lmazuel/azure-sdk-for-python | azure-mgmt-authorization/azure/mgmt/authorization/models/role_assignment.py | 1 | 2190 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | mit |
njantrania/osf.io | website/addons/osfstorage/tests/test_views.py | 4 | 18982 | # encoding: utf-8
from __future__ import unicode_literals
import datetime
from nose.tools import * # noqa
from framework.auth.core import Auth
from website.addons.osfstorage.tests.utils import (
StorageTestCase, Delta, AssertDeltas,
recursively_create_file,
)
from website.addons.osfstorage.tests import facto... | apache-2.0 |
TheOpenSourceNinja/gimp-unsplash-browser | unsplash-browser.py | 2 | 1240 | #!/usr/bin/env python
import sys
import os
sys.path.append(os.path.abspath("/usr/lib/gimp/2.0/python/")) #Not needed when running the script from within GIMP; I added this so my IDE won't complain about gimpfu
from gimpfu import *
#We want GTK so we can create windows; my current GIMP (2.8) relies on GTK 2 and... | cc0-1.0 |
rstreif/rvi_backend | server/mqsinkserver.py | 8 | 2730 | """
Copyright (C) 2014, Jaguar Land Rover
This program is licensed under the terms and conditions of the
Mozilla Public License, version 2.0. The full text of the
Mozilla Public License is at https://www.mozilla.org/MPL/2.0/
Maintainer: Rudolf Streif (rstreif@jaguarlandrover.com)
"""
"""
GPS Data Collector
Messa... | mpl-2.0 |
HarryRybacki/osf.io | website/addons/dataverse/tests/test_serializer.py | 29 | 5681 | # -*- coding: utf-8 -*-
from nose.tools import * # noqa
import mock
from tests.factories import AuthUserFactory
from website.util import api_url_for
from website.addons.dataverse.tests.utils import (
create_mock_connection, DataverseAddonTestCase, create_external_account,
)
from website.addons.dataverse.serial... | apache-2.0 |
Voluntarynet/BitmessageKit | BitmessageKit/Vendor/static-python/Lib/bsddb/test/test_db.py | 72 | 5796 | import unittest
import os, glob
from test_all import db, test_support, get_new_environment_path, \
get_new_database_path
#----------------------------------------------------------------------
class DB(unittest.TestCase):
def setUp(self):
self.path = get_new_database_path()
self.db = db.D... | mit |
anarang/robottelo | tests/foreman/ui/test_activationkey.py | 1 | 42863 | # -*- encoding: utf-8 -*-
"""Test class for Activation key UI"""
import random
from fauxfactory import gen_string
from nailgun import entities
from robottelo import manifests
from robottelo.api.utils import (
enable_rhrepo_and_fetchid,
promote,
upload_manifest,
)
from robottelo.constants import (
DEFAU... | gpl-3.0 |
La0/mozilla-relengapi | src/tooltool/api/tooltool_api/models.py | 2 | 4384 | # -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sqlalchemy as sa
from backend_common.db import db
ALLOWED_REGIONS = ('us-east-1', 'us-w... | mpl-2.0 |
tensorflow/probability | tensorflow_probability/python/stats/calibration_test.py | 1 | 14333 | # Copyright 2019 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 |
vladikr/nova_drafts | nova/cells/filters/image_properties.py | 26 | 2528 | # Copyright (c) 2012-2013 Rackspace Hosting
# 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
#
# Unles... | apache-2.0 |
libvirt/libvirt-test-API | libvirttestapi/utils/process.py | 1 | 25766 | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | gpl-2.0 |
KarolBedkowski/mna | mna/lib/appconfig.py | 1 | 8263 | # -*- coding: utf-8 -*-
# pylint: disable=C0103
""" Application configuration.
Copyright (c) Karol Będkowski, 2007-2015
This file is part of kPyLibs,mna
This 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, vers... | gpl-2.0 |
johnsonc/airquality | apps/aqi/utils.py | 1 | 3391 | from datetime import date, datetime, timedelta
import random
from models import AQFeed, AQDevice
import dateutil.parser
def datespan(startDate, endDate, delta=timedelta(days=1)):
currentDate = startDate
while currentDate < endDate:
yield currentDate
currentDate += delta
def generate_rando... | mit |
jdelight/django | django/conf/locale/zh_Hant/formats.py | 1008 | 1810 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'Y年n月j日' # 2016年9月5... | bsd-3-clause |
oscarolar/odoo | openerp/addons/base/module/report/ir_module_reference_print.py | 384 | 3704 | # -*- 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... | agpl-3.0 |
frank10704/DF_GCS_W | MissionPlanner-master/Lib/site-packages/scipy/linalg/tests/test_lapack.py | 51 | 1527 | #!"C:\Users\hog\Documents\Visual Studio 2010\Projects\ArdupilotMega\ArdupilotMega\bin\Debug\ipy.exe"
#
# Created by: Pearu Peterson, September 2002
#
from numpy.testing import TestCase, run_module_suite, assert_equal, \
assert_array_almost_equal, assert_
from numpy import ones
from scipy.linalg import flapack
c... | gpl-3.0 |
chenziliang/google | Splunk_TA_google/bin/pyasn1_modules/rfc1157.py | 127 | 3285 | #
# SNMPv1 message syntax
#
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc1157.txt
#
# Sample captures from:
# http://wiki.wireshark.org/SampleCaptures/
#
from pyasn1.type import univ, namedtype, namedval, tag, constraint
from pyasn1_modules import rfc1155
class Version(univ.Integer):
namedValues = namedval.Na... | mit |
chengjunjian/flexx | flexx/webruntime/selenium.py | 20 | 1737 | """ Web runtime based on Selenium.
Selenium is a Python library to automate browsers.
"""
import os
import logging
from .common import BaseRuntime
class SeleniumRuntime(BaseRuntime):
""" Runtime based on Selenium (http://www.seleniumhq.org/), a tool
to automate browsers, e.g. for testing. Requires the Py... | bsd-2-clause |
kevin-coder/tensorflow-fork | tensorflow/python/keras/utils/vis_utils.py | 4 | 6384 | # Copyright 2018 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 |
zyc9012/sdrl | sdrl/Gui/Domains/PuddleWorld.py | 1 | 3242 | import os
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4 import uic
from sdrl.Gui import BaseFrame
from sdrl.Gui.Utils import *
from rlpy.Domains.PuddleWorld import PuddleGapWorld, PuddleWorld
class PuddleWorldFrame( BaseFrame ):
title = 'PuddleWorld'
def __init__( self, parent=None ):
... | gpl-2.0 |
Dioptas/pymatgen | pymatgen/util/io_utils.py | 1 | 2750 | # coding: utf-8
from __future__ import unicode_literals
"""
This module provides utility classes for io operations.
"""
__author__ = "Shyue Ping Ong, Rickard Armiento, Anubhav Jain, G Matteo, Ioannis Petousis"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Shyue Ping On... | mit |
ashang/calibre | src/calibre/gui2/preferences/toolbar.py | 14 | 12964 | #!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
from functools import partial
from PyQt5.Qt import QAbstractListModel, Qt, QIcon, \
QItemSelectionModel
from cal... | gpl-3.0 |
itbabu/cmsplugin-filer | src/cmsplugin_filer_teaser/migrations/0006_fix_migration_mess.py | 28 | 15276 | # encoding: 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):
# Deleting field 'FilerTeaser.external_image'
db.delete_column('cmsplugin_filerteaser', 'external_image')
... | mit |
codeback/openerp-cbk_account_reports | __init__.py | 2 | 1060 | # -*- 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 |
pchaigno/grr | lib/flows/cron/data_retention.py | 6 | 4464 | #!/usr/bin/env python
"""These cron flows do the datastore cleanup."""
from grr.lib import aff4
from grr.lib import client_index
from grr.lib import config_lib
from grr.lib import flow
from grr.lib import rdfvalue
from grr.lib import utils
from grr.lib.aff4_objects import cronjobs
class CleanHunts(cronjobs.System... | apache-2.0 |
jaeick/ts | dns/cfg_tunnel.py | 1 | 5155 | import dsnet
def msan1():
cmdlist=[]
# loopback
cmdlist.append('inter lo')
for x in range(2, 129):
cmdlist.append('ip address 172.1.0.{}/32 secon'.format(x))
cmdlist.append('exit')
intf = 1001
for i in range(1,129):
# vlan intf
cmdlist.append('interface br{}'.for... | apache-2.0 |
dreamsxin/kbengine | kbe/res/scripts/common/Lib/encodings/cp1125.py | 213 | 34597 | """ Python Character Mapping Codec for CP1125
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,deco... | lgpl-3.0 |
sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/requests/models.py | 8 | 29180 | # -*- coding: utf-8 -*-
"""
requests.models
~~~~~~~~~~~~~~~
This module contains the primary objects that power Requests.
"""
import collections
import datetime
from io import BytesIO, UnsupportedOperation
from .hooks import default_hooks
from .structures import CaseInsensitiveDict
from .auth import HTTPBasicAuth
... | mit |
dudonwai/dudonsblog | Lib/site-packages/static.py | 7 | 16402 | #!/usr/bin/env python
"""
Copyright (C) 2012 Roman Mohr <roman@fenkhuber.at>
"""
"""static - A stupidly simple WSGI way to serve static (or mixed) content.
(See the docstrings of the various functions and classes.)
Copyright (C) 2006-2009 Luke Arno - http://lukearno.com/
This library is free software; you can redis... | mit |
pombredanne/django-rest-framework-braces | drf_braces/parsers.py | 1 | 2182 | from __future__ import print_function, unicode_literals
import json
from collections import OrderedDict
import six
from django.conf import settings
from rest_framework import parsers
class SortedJSONParser(parsers.JSONParser):
"""
Parses JSON-serialized data into OrderedDict.
"""
def parse(self, str... | mit |
cafecivet/django_girls_tutorial | Lib/site-packages/django/contrib/auth/management/commands/changepassword.py | 58 | 2060 | from __future__ import unicode_literals
import getpass
from optparse import make_option
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS
from django.utils.encoding import force_str
class Command(BaseCommand):
... | gpl-2.0 |
cpcloud/bokeh | bokeh/mplexporter/renderers/vincent_renderer.py | 64 | 1922 | import warnings
from .base import Renderer
from ..exporter import Exporter
class VincentRenderer(Renderer):
def open_figure(self, fig, props):
self.chart = None
self.figwidth = int(props['figwidth'] * props['dpi'])
self.figheight = int(props['figheight'] * props['dpi'])
def draw_line(... | bsd-3-clause |
reiaaoyama/contrail-controller | src/opserver/analytics_db.py | 7 | 14728 | #
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#
#
# analytics_db.py
# Implementation of database purging
#
import redis
import pycassa
from pycassa.pool import ConnectionPool
from pycassa.columnfamily import ColumnFamily
from pycassa.types import *
from pycassa import *
from sandesh.viz.constants... | apache-2.0 |
pongem/python-bot-project | appengine/standard/botapp/env/lib/python2.7/site-packages/django/conf/locale/lt/formats.py | 504 | 1830 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = r'Y \m. E j \d.'
TIME_FORMAT = 'H:... | apache-2.0 |
trnewman/VT-USRP-daughterboard-drivers | gnuradio-core/src/python/gnuradio/blks2/__init__.py | 17 | 1295 | #
# Copyright 2005 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#... | gpl-3.0 |
onceuponatimeforever/oh-mainline | vendor/packages/python-openid/openid/test/test_accept.py | 75 | 3323 | import unittest
import os.path
from openid.yadis import accept
def getTestData():
"""Read the test data off of disk
() -> [(int, str)]
"""
filename = os.path.join(os.path.dirname(__file__), 'data', 'accept.txt')
i = 1
lines = []
for line in file(filename):
lines.append((i, line))
... | agpl-3.0 |
johndpope/tensorflow | tensorflow/tensorboard/tensorboard.py | 25 | 7486 | # 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 |
JAOSP/aosp_platform_external_chromium_org | chrome/PRESUBMIT.py | 39 | 2758 | # Copyright (c) 2011 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.
"""Presubmit script for changes affecting chrome/
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the... | bsd-3-clause |
evilpie/servo | tests/wpt/css-tests/tools/pywebsocket/src/mod_pywebsocket/handshake/hybi00.py | 675 | 11294 | # Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | mpl-2.0 |
Learningtribes/edx-platform | common/test/acceptance/pages/lms/edxnotes.py | 16 | 20608 | from bok_choy.page_object import PageObject, PageLoadError, unguarded
from bok_choy.promise import BrokenPromise, EmptyPromise
from .course_page import CoursePage
from ..common.paging import PaginatedUIMixin
from ...tests.helpers import disable_animations
from selenium.webdriver.common.action_chains import ActionChains... | agpl-3.0 |
behzadnouri/scipy | scipy/weave/examples/vtk_example.py | 100 | 3653 | """ A simple example to show how to use weave with VTK. This lets one
create VTK objects using the standard VTK-Python API (via 'import
vtk') and then accelerate any of the computations by inlining C++ code
inside Python.
Please note the use of the `inc_dirs` and the `lib_dirs` variables in
the call to weave.inline. ... | bsd-3-clause |
HirokiNakahara/GUINNESS | net3.py | 1 | 1352 | import math
import numpy as np
import six
import chainer
from chainer import cuda
from chainer import functions as F
from chainer import links as L
from chainer import initializers
import link_binary_linear as BL
import bst
import link_binary_conv2d as BC
import link_integer_conv2d as IC
import sys
sys.path.append('./... | gpl-2.0 |
blutooth/gp-svi | examples/data.py | 1 | 1375 | from __future__ import absolute_import
import autograd.numpy as np
import autograd.numpy.random as npr
import data_mnist
def load_mnist():
partial_flatten = lambda x : np.reshape(x, (x.shape[0], np.prod(x.shape[1:])))
one_hot = lambda x, k: np.array(x[:,None] == np.arange(k)[None, :], dtype=int)
train_imag... | mit |
mitar/django | django/forms/widgets.py | 73 | 34574 | """
HTML Widget classes
"""
from __future__ import absolute_import
import copy
import datetime
from itertools import chain
from urlparse import urljoin
from django.conf import settings
from django.forms.util import flatatt, to_current_timezone
from django.utils.datastructures import MultiValueDict, MergeDict
from dj... | bsd-3-clause |
openstack/tempest | tempest/lib/services/identity/v3/oauth_token_client.py | 1 | 9816 | # Copyright 2017 AT&T Corporation.
# 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 require... | apache-2.0 |
noironetworks/nova | nova/tests/unit/api/openstack/compute/test_keypairs.py | 8 | 24904 | # Copyright 2011 Eldar Nugaev
# 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 |
cscorley/mud2014-modeling-changeset-topics | tests/test_corpora.py | 1 | 20703 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# [The "New BSD" license]
# Copyright (c) 2014 The Board of Trustees of The University of Alabama
# All rights reserved.
#
# See LICENSE for details.
if __name__ == '__main__':
import nose
nose.main()
import unittest
import os.path
from io import StringIO
from ... | bsd-3-clause |
sudheesh001/oh-mainline | vendor/packages/Django/django/contrib/auth/backends.py | 37 | 5055 | from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
class ModelBackend(object):
"""
Authenticates against settings.AUTH_USER_MODEL.
"""
def authenticate(self, username=None, password=None, **kwargs):
UserMode... | agpl-3.0 |
jbassen/edx-platform | lms/djangoapps/bulk_email/tests/test_email.py | 1 | 18663 | # -*- coding: utf-8 -*-
"""
Unit tests for sending course email
"""
import json
from mock import patch, Mock
from nose.plugins.attrib import attr
import os
from unittest import skipIf
from django.conf import settings
from django.core import mail
from django.core.urlresolvers import reverse
from django.core.management ... | agpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.