repo_name stringlengths 5 100 | path stringlengths 4 294 | copies stringclasses 990
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
jnewland/home-assistant | homeassistant/components/fixer/sensor.py | 7 | 3237 | """Currency exchange rate support that comes from fixer.io."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, CONF_NAME
import homeassistant.helpers.config_validation as ... | apache-2.0 |
Qalthos/ansible | test/units/modules/network/f5/test_bigiq_application_fastl4_tcp.py | 17 | 7969 | # -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2... | gpl-3.0 |
mensler/ansible | lib/ansible/modules/cloud/amazon/ec2_customer_gateway.py | 61 | 9038 | #!/usr/bin/python
#
# This is a 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 Ansible library is distributed in the hope that i... | gpl-3.0 |
sbidoul/buildbot | master/buildbot/www/rest.py | 6 | 21471 | # This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | gpl-2.0 |
gojira/tensorflow | tensorflow/contrib/tpu/python/tpu/bfloat16_test.py | 31 | 1817 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
RevSquare/gipsy | gipsy/dashboard/apps.py | 1 | 2142 | from functools import update_wrapper
from importlib import import_module
from django.apps import AppConfig
from django.contrib import admin
from django.contrib.admin.sites import AdminSite
from django.conf import settings
from django.conf.urls import url
from django.template.response import TemplateResponse
class De... | mit |
spektom/incubator-airflow | airflow/providers/dingding/example_dags/example_dingding.py | 5 | 7680 | #
# 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 |
lukehsiao/RobotSoccer | MotionControl/scripts/motor_control/mat.py | 1 | 2382 | #!/usr/bin/python
from numpy import matrix
from numpy import linalg
import math
#define s1,s2,s3
realWorldOffset = 1 #1.698
s = .0282977488817 #radius of wheel
r = .08 #radius from center to center of wheel
r1theta = -math.pi/3.0
r1x = math.cos(r1theta)*r
r1y = math.sin(r1theta)*r
r2theta = math.pi/3.0
r2x = math.co... | mit |
mewbak/idc | machine/pentium/bitbyte.py | 1 | 2801 | '''Bit and byte instructions.'''
from transf import parse
from machine.pentium.common import *
from machine.pentium.conditions import *
from machine.pentium.logical import LogFlags
parse.Transfs('''
BitMask(size, offset) =
!Binary(LShift(type), Lit(type,1),
Binary(Mod(type), <offset>, Lit(type,<size>)))
where
... | lgpl-2.1 |
snpabilonia/rgims | modules/eden/doc.py | 4 | 16265 | # -*- coding: utf-8 -*-
""" Sahana Eden Document Library
@copyright: 2011-2012 (c) Sahana Software Foundation
@license: MIT
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 wi... | mit |
AthinaB/synnefo | snf-cyclades-app/synnefo/db/migrations/0077_migrate_networks_to_subnets.py | 10 | 20516 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
import ipaddr
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# Note: Remember to use orm['appname.ModelName'] rather than "f... | gpl-3.0 |
andfoy/margffoy-tuay-server | env/lib/python2.7/site-packages/setuptools/tests/test_upload_docs.py | 522 | 2139 | """build_ext tests
"""
import sys, os, shutil, tempfile, unittest, site, zipfile
from setuptools.command.upload_docs import upload_docs
from setuptools.dist import Distribution
SETUP_PY = """\
from setuptools import setup
setup(name='foo')
"""
class TestUploadDocsTest(unittest.TestCase):
def setUp(self):
... | gpl-2.0 |
jkarnows/scikit-learn | examples/linear_model/plot_ard.py | 248 | 2622 | """
==================================================
Automatic Relevance Determination Regression (ARD)
==================================================
Fit regression model with Bayesian Ridge Regression.
See :ref:`bayesian_ridge_regression` for more information on the regressor.
Compared to the OLS (ordinary l... | bsd-3-clause |
betoesquivel/fil2014 | build/django/django/utils/unittest/__init__.py | 571 | 3069 | """
unittest2
unittest2 is a backport of the new features added to the unittest testing
framework in Python 2.7. It is tested to run on Python 2.4 - 2.6.
To use unittest2 instead of unittest simply replace ``import unittest`` with
``import unittest2``.
Copyright (c) 1999-2003 Steve Purcell
Copyright (c) 2003-2010 P... | mit |
goldeneye-source/ges-python | lib/encodings/mac_cyrillic.py | 272 | 13454 | """ Python Character Mapping Codec mac_cyrillic generated from 'MAPPINGS/VENDORS/APPLE/CYRILLIC.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,inp... | gpl-3.0 |
a-robinson/kubernetes | hack/verify-flags-underscore.py | 205 | 4659 | #!/usr/bin/env python
# Copyright 2015 The Kubernetes 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 appli... | apache-2.0 |
Yuudachimoe/HikariChun-RedBot | lib/youtube_dl/extractor/motorsport.py | 73 | 1804 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import (
compat_urlparse,
)
class MotorsportIE(InfoExtractor):
IE_DESC = 'motorsport.com'
_VALID_URL = r'https?://(?:www\.)?motorsport\.com/[^/?#]+/video/(?:[^/?#]+/)(?P<id>[^/]+)/?(?:$|[?#])'
_TES... | gpl-3.0 |
wwj718/edx-platform | lms/djangoapps/courseware/tests/test_credit_requirements.py | 9 | 6425 | """
Tests for credit requirement display on the progress page.
"""
import datetime
import ddt
from mock import patch
from pytz import UTC
from django.conf import settings
from django.core.urlresolvers import reverse
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.test... | agpl-3.0 |
mvcsantos/QGIS | python/plugins/db_manager/db_plugins/postgis/connector.py | 3 | 42160 | # -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@... | gpl-2.0 |
tjsavage/tmrwmedia | django/contrib/gis/geos/collections.py | 311 | 4663 | """
This module houses the Geometry Collection objects:
GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon
"""
from ctypes import c_int, c_uint, byref
from django.contrib.gis.geos.error import GEOSException, GEOSIndexError
from django.contrib.gis.geos.geometry import GEOSGeometry
from django.contrib.gi... | bsd-3-clause |
valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/mbcsgroupprober.py | 2769 | 1967 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... | gpl-2.0 |
mozilla/moztrap | tests/model/core/api/test_product_resource.py | 3 | 5368 | """
Tests for ProductResource api.
"""
from tests.case.api.crud import ApiCrudCases
class ProductResourceTest(ApiCrudCases):
@property
def factory(self):
"""The model factory for this object."""
return self.F.ProductFactory()
@property
def resource_name(self):
return "pro... | bsd-2-clause |
arnif/CouchPotatoServer | libs/dateutil/parser.py | 278 | 32464 | # -*- coding:iso-8859-1 -*-
"""
Copyright (c) 2003-2007 Gustavo Niemeyer <gustavo@niemeyer.net>
This module offers extensions to the standard python 2.3+
datetime module.
"""
__author__ = "Gustavo Niemeyer <gustavo@niemeyer.net>"
__license__ = "PSF License"
import datetime
import string
import time
import sys
import... | gpl-3.0 |
jmonson2/RTS | s/src/planeZ.py | 1 | 2171 | class planeZ:
def __init__(self, positionRow, positionCol):
self.currentPos_Row = positionRow
self.currentPos_Col = positionCol
#Moves Row+=3 | Col+=(Col+1) % 7
def move(self, positionMatrix):
lastPos_Col = (self.currentPos_Col-1) % 7
self.subCheck(positionMatrix, self.currentPos... | gpl-3.0 |
cuboxi/android_external_chromium_org | chrome/common/extensions/docs/server2/app_yaml_helper_test.py | 43 | 6153 | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from app_yaml_helper import AppYamlHelper
from extensions_paths import SERVER2
from host_file_system_provider import H... | bsd-3-clause |
cgvarela/grpc | src/python/grpcio/grpc/framework/face/_calls.py | 32 | 15163 | # Copyright 2015, 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... | bsd-3-clause |
helium/helium-commander | helium_commander/cli.py | 1 | 2771 | import click
import sys
import os
from importlib import import_module
from functools import update_wrapper
from . import __version__
from . import Client
def main_wrapper(cmd, args, **kwargs):
if args is None:
args = sys.argv[1:]
def decorator():
try:
cmd.main(args=args, **kwargs... | bsd-3-clause |
kofron/bigcouch | couchjs/scons/scons-local-2.0.1/SCons/Tool/g++.py | 61 | 3234 | """SCons.Tool.g++
Tool-specific initialization for g++.
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 The SCons Foundation
#
# P... | apache-2.0 |
srottem/indy-sdk | vcx/libvcx/scripts/provision_agent_keys.py | 2 | 3378 | #!/usr/bin/env python3
# Provided by The Python Standard Library
import json
import argparse
import asyncio
import time
import os
import urllib.request
import sys
from ctypes import *
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("AGENCY_URL")
parser.add_argument("WALLET_KEY")
... | apache-2.0 |
Tanych/CodeTracking | 126-Word-Ladder-II/solution.py | 1 | 2034 | class Solution(object):
def findLadders(self, beginWord, endWord, wordlist):
"""
:type beginWord: str
:type endWord: str
:type wordlist: Set[str]
:rtype: List[List[int]]
"""
# build the whole graph for the possible solution
graph,res={},[]
bwse... | mit |
gavoski/audacity | lib-src/lv2/lv2/waflib/extras/autowaf.py | 65 | 22357 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import glob
import os
import subprocess
import sys
from waflib import Configure,Context,Logs,Node,Options,Task,Utils
from waflib.TaskGen import feature,before,after
global g_i... | gpl-2.0 |
nguyentu1602/statsmodels | statsmodels/sandbox/examples/example_gam.py | 33 | 2343 | '''original example for checking how far GAM works
Note: uncomment plt.show() to display graphs
'''
example = 2 # 1,2 or 3
import numpy as np
import numpy.random as R
import matplotlib.pyplot as plt
from statsmodels.sandbox.gam import AdditiveModel
from statsmodels.sandbox.gam import Model as GAM #?
from statsmode... | bsd-3-clause |
nwokeo/supysonic | venv/lib/python2.7/site-packages/tests/event.py | 4 | 3115 | #
# Copyright (c) 2006, 2007 Canonical
#
# Written by Gustavo Niemeyer <gustavo@niemeyer.net>
#
# This file is part of Storm Object Relational Mapper.
#
# Storm 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 Found... | agpl-3.0 |
ewandor/home-assistant | tests/helpers/test_entity_values.py | 43 | 1940 | """Test the entity values helper."""
from collections import OrderedDict
from homeassistant.helpers.entity_values import EntityValues as EV
ent = 'test.test'
def test_override_single_value():
"""Test values with exact match."""
store = EV({ent: {'key': 'value'}})
assert store.get(ent) == {'key': 'value'}... | apache-2.0 |
JioCloud/oslo.messaging | tests/test_exception_serialization.py | 1 | 11232 |
# Copyright 2013 Red Hat, 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 agr... | apache-2.0 |
City-of-Helsinki/kuulemma | scripts/hearing/latokartanontie.py | 2 | 8469 | # -*- coding: utf-8 -*-
# Kuulemma
# Copyright (C) 2014, Fast Monkeys Oy
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later... | agpl-3.0 |
olapaola/olapaola-android-scripting | python/src/Lib/SimpleHTTPServer.py | 64 | 7341 | """Simple HTTP Server.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
__version__ = "0.6"
__all__ = ["SimpleHTTPRequestHandler"]
import os
import posixpath
import BaseHTTPServer
import urllib
import cgi
import shutil
import mimetypes... | apache-2.0 |
overtherain/scriptfile | software/googleAppEngine/google/appengine/tools/dev_appserver_login.py | 20 | 9009 | #!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | mit |
tashaxe/Red-DiscordBot | lib/chardet/jpcntx.py | 289 | 19643 | ######################## 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 |
ubirch/aws-tools | virtual-env/lib/python2.7/site-packages/pip/req/req_uninstall.py | 249 | 7135 | from __future__ import absolute_import
import logging
import os
import sys
import tempfile
from pip.compat import uses_pycache, WINDOWS, cache_from_source
from pip.exceptions import UninstallationError
from pip.utils import (rmtree, ask, is_local, dist_is_local, renames,
normalize_path)
from pi... | apache-2.0 |
GenericStudent/home-assistant | homeassistant/components/hdmi_cec/switch.py | 18 | 2179 | """Support for HDMI CEC devices as switches."""
import logging
from homeassistant.components.switch import DOMAIN, SwitchEntity
from homeassistant.const import STATE_OFF, STATE_ON, STATE_STANDBY
from . import ATTR_NEW, CecEntity
_LOGGER = logging.getLogger(__name__)
ENTITY_ID_FORMAT = DOMAIN + ".{}"
def setup_pla... | apache-2.0 |
kmee/python-sped | sped/ecd/blocos.py | 1 | 1228 | # -*- coding: utf-8 -*-
from ..blocos import Bloco
from .registros import Registro0001
from .registros import Registro0990
from .registros import RegistroI001
from .registros import RegistroI990
from .registros import RegistroJ001
from .registros import RegistroJ990
from .registros import Registro9001
from .registros ... | mit |
elliotthill/django-oscar | tests/unit/checkout/session_tests.py | 57 | 1639 | from django.test import TestCase
from django.test.client import RequestFactory
from django.contrib.sessions.middleware import SessionMiddleware
import mock
from oscar.apps.checkout.utils import CheckoutSessionData
class TestCheckoutSession(TestCase):
"""
oscar.apps.checkout.utils.CheckoutSessionData
"""
... | bsd-3-clause |
jerem/django-rcsfield | rcsfield/backends/svn.py | 3 | 2818 | """
SVN backend for django-rcsfield.
Uses SVN to versionize content.
"""
import os, codecs, pysvn
from django.conf import settings
from rcsfield.backends.base import BaseBackend
class SvnBackend(BaseBackend):
"""
Rcsfield backend which uses pysvn to versionize content.
"""
def initial(self, pre... | bsd-3-clause |
ArneBab/pypyjs | website/demo/home/rfk/repos/pypy/lib_pypy/msvcrt.py | 3 | 2311 | """
Python interface to the Microsoft Visual C Runtime
Library, providing access to those non-portable, but
still useful routines.
"""
# XXX incomplete: implemented only functions needed by subprocess.py
# PAC: 2010/08 added MS locking for Whoosh
import ctypes
import errno
from ctypes_support import standard_c_lib as... | mit |
jpic/mitmproxy | libmproxy/contrib/wbxml/ASWBXMLByteQueue.py | 42 | 3497 | #!/usr/bin/env python
'''
@author: David Shaw, david.shaw.aw@gmail.com
Inspired by EAS Inspector for Fiddler
https://easinspectorforfiddler.codeplex.com
----- The MIT License (MIT) -----
Filename: ASWBXMLByteQueue.py
Copyright (c) 2014, David P. Shaw
Permission is hereby granted, free of charge, to any person obtai... | mit |
IV-GII/SocialCookies | ENV1/lib/python2.7/site-packages/setuptools/tests/test_egg_info.py | 73 | 1060 | import os
import tempfile
import shutil
import unittest
import pkg_resources
from setuptools.command import egg_info
ENTRIES_V10 = pkg_resources.resource_string(__name__, 'entries-v10')
"An entries file generated with svn 1.6.17 against the legacy Setuptools repo"
class TestEggInfo(unittest.TestCase):
def setUp... | gpl-2.0 |
JuliBakagianni/CEF-ELRC | lib/python2.7/site-packages/dateutil/easter.py | 291 | 2633 | """
Copyright (c) 2003-2007 Gustavo Niemeyer <gustavo@niemeyer.net>
This module offers extensions to the standard python 2.3+
datetime module.
"""
__author__ = "Gustavo Niemeyer <gustavo@niemeyer.net>"
__license__ = "PSF License"
import datetime
__all__ = ["easter", "EASTER_JULIAN", "EASTER_ORTHODOX", "EASTER_WESTE... | bsd-3-clause |
klahnakoski/SpotManager | vendor/jx_elasticsearch/es52/painless/max_op.py | 3 | 1215 | # encoding: 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/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divisi... | mpl-2.0 |
ticosax/django | tests/generic_inline_admin/models.py | 46 | 1623 | from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
class Episode(models.Model):
name = models.CharField(max_length=100)
... | bsd-3-clause |
hj3938/or-tools | examples/python/data/nonogram_regular/nonogram_lambda.py | 74 | 1059 | # Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
astropy/astropy | examples/io/plot_fits-image.py | 11 | 1898 | # -*- coding: utf-8 -*-
"""
=======================================
Read and plot an image from a FITS file
=======================================
This example opens an image stored in a FITS file and displays it to the screen.
This example uses `astropy.utils.data` to download the file, `astropy.io.fits` to open
th... | bsd-3-clause |
Pythonify/awesome | venv/lib/python2.7/site-packages/setuptools/command/py36compat.py | 130 | 4968 | import os
from glob import glob
from distutils.util import convert_path
from distutils.command import sdist
from six.moves import filter
class sdist_add_defaults:
"""
Mix-in providing forward-compatibility for functionality as found in
distutils on Python 3.7.
Do not edit the code in this class exce... | gpl-3.0 |
openstack/glance | glance/api/v2/image_actions.py | 3 | 3771 | # Copyright 2015 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 req... | apache-2.0 |
CredoReference/edx-platform | common/test/acceptance/tests/lms/test_lms_edxnotes.py | 8 | 59841 | """
Test LMS Notes
"""
import random
from datetime import datetime
from unittest import skip
from uuid import uuid4
from nose.plugins.attrib import attr
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc
from common.test.acceptance.fixtures.edxnotes import EdxNotesFixture, Note, Range... | agpl-3.0 |
nihilus/src | pywraps/py_expr.py | 1 | 4407 | # --------------------------------------------------------------------------
import os
import sys
import idaapi
import _idaapi
from sys import getrefcount
import gc
try:
import pywraps
pywraps_there = True
_idaapi.pyw_register_idc_func = pywraps.pyw_register_idc_func
_idaapi.pyw_unregister_idc_func ... | bsd-3-clause |
lumig242/Hue-Integration-with-CDAP | desktop/libs/notebook/src/notebook/models.py | 2 | 4196 | #!/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 |
yoer/hue | desktop/core/ext-py/Django-1.6.10/tests/get_or_create/models.py | 76 | 1128 | """
33. get_or_create()
``get_or_create()`` does what it says: it tries to look up an object with the
given parameters. If an object isn't found, it creates one with the given
parameters.
"""
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compa... | apache-2.0 |
michigraber/scikit-learn | sklearn/preprocessing/label.py | 35 | 28877 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Joel Nothman <joel.nothman@gmail.com>
# Hamzeh Alsalhi <ha258@cornell.edu>
# Licens... | bsd-3-clause |
twobob/buildroot-kindle | output/build/host-python-2.7.2/Mac/Modules/file/filesupport.py | 34 | 32642 | # This script generates a Python interface for an Apple Macintosh Manager.
# It uses the "bgen" package to generate C code.
# The function specifications are generated by scanning the mamager's header file,
# using the "scantools" package (customized for this particular manager).
#
# XXXX TO DO:
# - Implement correct m... | gpl-2.0 |
Peddle/hue | apps/hbase/setup.py | 39 | 1232 | # 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 may not use this file ex... | apache-2.0 |
yotchang4s/cafebabepy | src/main/python/importlib/_bootstrap_external.py | 2 | 54954 | """Core implementation of path-based import.
This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public... | bsd-3-clause |
Omegaphora/external_chromium_org | tools/telemetry/telemetry/core/memory_cache_http_server.py | 41 | 9307 | # Copyright 2012 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.
import BaseHTTPServer
import errno
import gzip
import mimetypes
import os
import SimpleHTTPServer
import socket
import SocketServer
import StringIO
import sy... | bsd-3-clause |
gitaarik/django | django/contrib/sessions/backends/cached_db.py | 231 | 2861 | """
Cached, database-backed sessions.
"""
import logging
from django.conf import settings
from django.contrib.sessions.backends.db import SessionStore as DBStore
from django.core.cache import caches
from django.core.exceptions import SuspiciousOperation
from django.utils import timezone
from django.utils.encoding imp... | bsd-3-clause |
htzy/bigfour | lms/djangoapps/django_comment_client/tests/test_middleware.py | 134 | 1878 | import django.http
from django.test import TestCase
from nose.plugins.attrib import attr
import json
import lms.lib.comment_client
import django_comment_client.middleware as middleware
@attr('shard_1')
class AjaxExceptionTestCase(TestCase):
def setUp(self):
super(AjaxExceptionTestCase, self).setUp()
... | agpl-3.0 |
youprofit/ansible | lib/ansible/plugins/connections/docker.py | 36 | 6028 | # Based on the chroot connection plugin by Maykel Moya
#
# Connection plugin for configuring docker containers
# (c) 2014, Lorin Hochstein
# (c) 2015, Leendert Brouwer
#
# Maintainer: Leendert Brouwer (https://github.com/objectified)
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it... | gpl-3.0 |
kinnou02/navitia | source/navitiacommon/navitiacommon/models/streetnetwork_backend.py | 3 | 2394 | # encoding: utf-8
# Copyright (c) 2001-2019, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobilit... | agpl-3.0 |
Thoshh/wapad | lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.py | 1002 | 25650 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""Utility functions for copying and archiving files and directory trees.
XXX The functions here don't copy the resource fork or other metadata on Mac.
"""
import os
import sys
import stat
from os... | mit |
jrversteegh/softsailor | deps/swig-2.0.4/Examples/test-suite/python/li_boost_shared_ptr_runme.py | 2 | 18306 | import li_boost_shared_ptr
import gc
debug = False
# simple shared_ptr usage - created in C++
class li_boost_shared_ptr_runme:
def main(self):
if (debug):
print "Started"
li_boost_shared_ptr.cvar.debug_shared = debug
# Change loop count to run for a long time to monitor memory
loopCount = 1 ... | gpl-3.0 |
sevenbitbyte/pybluez | examples/simple/asynchronous-inquiry.py | 16 | 2082 | # file: asynchronous-inquiry.py
# auth: Albert Huang <albert@csail.mit.edu>
# desc: demonstration of how to do asynchronous device discovery by subclassing
# the DeviceDiscoverer class
# $Id: asynchronous-inquiry.py 405 2006-05-06 00:39:50Z albert $
#
# XXX Linux only (5/5/2006)
import bluetooth
import select
c... | gpl-2.0 |
xeroc/python-steem | pistonbase/operationids.py | 3 | 2051 | #: Operation ids
operations = {}
operations["vote"] = 0
operations["comment"] = 1
operations["transfer"] = 2
operations["transfer_to_vesting"] = 3
operations["withdraw_vesting"] = 4
operations["limit_order_create"] = 5
operations["limit_order_cancel"] = 6
operations["feed_publish"] = 7
operations["convert"] = 8
operati... | mit |
malept/youtube-dl | youtube_dl/extractor/voicerepublic.py | 20 | 3922 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
)
from ..utils import (
ExtractorError,
determine_ext,
int_or_none,
sanitized_Request,
)
class VoiceRepublicIE(InfoExtractor):
_VALID_URL = r'https?://v... | unlicense |
CubicERP/odoo | addons/stock/wizard/stock_move.py | 242 | 4332 | # -*- 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 |
AlexanderFabisch/scikit-learn | sklearn/cluster/hierarchical.py | 21 | 32892 | """Hierarchical Agglomerative Clustering
These routines perform some hierarchical agglomerative clustering of some
input data.
Authors : Vincent Michel, Bertrand Thirion, Alexandre Gramfort,
Gael Varoquaux
License: BSD 3 clause
"""
from heapq import heapify, heappop, heappush, heappushpop
import warnings
im... | bsd-3-clause |
amyvmiwei/kbengine | kbe/res/scripts/common/Lib/distutils/tests/test_bdist.py | 135 | 1534 | """Tests for distutils.command.bdist."""
import os
import unittest
from test.support import run_unittest
from distutils.command.bdist import bdist
from distutils.tests import support
class BuildTestCase(support.TempdirManager,
unittest.TestCase):
def test_formats(self):
# let's creat... | lgpl-3.0 |
shenlong3030/asv-django-guestbook | django/contrib/admin/widgets.py | 9 | 12046 | """
Form Widget classes specific to the Django admin site.
"""
import django.utils.copycompat as copy
from django import forms
from django.forms.widgets import RadioFieldRenderer
from django.forms.util import flatatt
from django.utils.html import escape
from django.utils.text import truncate_words
from dja... | bsd-3-clause |
ojengwa/oh-mainline | vendor/packages/Pygments/pygments/styles/default.py | 364 | 2532 | # -*- coding: utf-8 -*-
"""
pygments.styles.default
~~~~~~~~~~~~~~~~~~~~~~~
The default highlighting style.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Keyword, Name, Com... | agpl-3.0 |
LeeBergstrand/CDHITtoFASTA | lib.py | 1 | 3425 | #!/usr/bin/env python
"""
Created by: Lee Bergstrand (Copyright 2015)
Description: A provides functions for __main__.py
Requirements: - This software requires the Biopython module: http://biopython.org/wiki/Download
- This software requires the cd_hit_parser.py module (included)
"""
# Imports:
import sys
from ... | mit |
mbayon/TFG-MachineLearning | vbig/lib/python2.7/site-packages/sklearn/preprocessing/label.py | 7 | 27529 | # Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Mathieu Blondel <mathieu@mblondel.org>
# Olivier Grisel <olivier.grisel@ensta.org>
# Andreas Mueller <amueller@ais.uni-bonn.de>
# Joel Nothman <joel.nothman@gmail.com>
# Hamzeh Alsalhi <ha258@cornell.edu>
# Licens... | mit |
JianyuWang/nova | nova/api/openstack/compute/schemas/reset_server_state.py | 110 | 1090 | # Copyright 2014 NEC 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 required ... | apache-2.0 |
guedou/scapy-appveyor | scapy/layers/vrrp.py | 24 | 1220 | ## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) Philippe Biondi <phil@secdev.org>
## Copyright (C) 6WIND <olivier.matz@6wind.com>
## This program is published under a GPLv2 license
"""
VRRP (Virtual Router Redundancy Protocol).
"""
from scapy.packet imp... | gpl-2.0 |
nishantjr/pjproject | pjsip-apps/src/pygui/chatgui.py | 26 | 12278 | # $Id$
#
# pjsua Python GUI Demo
#
# Copyright (C)2013 Teluu Inc. (http://www.teluu.com)
#
# 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) ... | gpl-2.0 |
sephii/django | tests/view_tests/tests/test_csrf.py | 47 | 2663 | from django.test import TestCase, override_settings, Client
from django.utils.translation import override
@override_settings(ROOT_URLCONF="view_tests.urls")
class CsrfViewTests(TestCase):
def setUp(self):
super(CsrfViewTests, self).setUp()
self.client = Client(enforce_csrf_checks=True)
@over... | bsd-3-clause |
moijes12/oh-mainline | vendor/packages/Django/django/utils/functional.py | 79 | 14702 | import copy
import operator
from functools import wraps, update_wrapper
import sys
from django.utils import six
from django.utils.six.moves import copyreg
# You can't trivially replace this `functools.partial` because this binds to
# classes and returns bound instances, whereas functools.partial (on CPython)
# is a ... | agpl-3.0 |
mixturemodel-flow/tensorflow | tensorflow/contrib/tpu/python/tpu/tpu_sharding_test.py | 85 | 4920 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
kazcw/bitcoin | test/functional/wallet_disableprivatekeys.py | 18 | 1269 | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test disable-privatekeys mode.
"""
from test_framework.test_framework import BitcoinTestFramework
from test... | mit |
andrius-preimantas/account-financial-tools | account_default_draft_move/account_bank_statement.py | 19 | 1289 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author Vincent Renaville. Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publis... | agpl-3.0 |
BeDjango/intef-openedx | common/djangoapps/third_party_auth/saml.py | 100 | 2027 | """
Slightly customized python-social-auth backend for SAML 2.0 support
"""
import logging
from social.backends.saml import SAMLAuth, OID_EDU_PERSON_ENTITLEMENT
from social.exceptions import AuthForbidden
log = logging.getLogger(__name__)
class SAMLAuthBackend(SAMLAuth): # pylint: disable=abstract-method
"""
... | agpl-3.0 |
MetGIS/TileStache | TileStache/Goodies/Providers/Cascadenik.py | 13 | 1591 | ''' Cascadenik Provider.
Simple wrapper for TileStache Mapnik provider that parses Cascadenik MML files
directly, skipping the typical compilation to XML step.
More information on Cascadenik:
- https://github.com/mapnik/Cascadenik/wiki/Cascadenik
Requires Cascadenik 2.x+.
'''
from tempfile import gettempdir
try:
... | bsd-3-clause |
Y300-0100/android_kernel_samsung_SM-G355HN_XEC | tools/perf/scripts/python/net_dropmonitor.py | 2669 | 1738 | # Monitor the system for dropped packets and proudce a report of drop locations and counts
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from Util import *
drop_log = {}
kallsyms = []
def... | gpl-2.0 |
xdevelsistemas/taiga-back-community | taiga/external_apps/auth_backends.py | 2 | 1580 | # -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can r... | agpl-3.0 |
dangall/Kaggle-MobileODT-Cancer-Screening | workflow_classes/benchmark_model.py | 1 | 9184 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed May 3 12:04:33 2017
@author: daniele
"""
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from modules.data_loading import load_training_data
from modules.visualization import display_single_image
from modules.path_munging import... | mit |
onitake/ansible | lib/ansible/modules/cloud/google/gcp_compute_network_facts.py | 11 | 7249 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | gpl-3.0 |
lneoe/python-social-auth | social/backends/base.py | 59 | 9755 | from requests import request, ConnectionError
from social.utils import SSLHttpAdapter, module_member, parse_qs, user_agent
from social.exceptions import AuthFailed
class BaseAuth(object):
"""A django.contrib.auth backend that authenticates the user based on
a authentication provider response"""
name = ''... | bsd-3-clause |
saurabh6790/medsyn-app | hr/doctype/hr_settings/hr_settings.py | 30 | 1312 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint
class DocType:
def __init__(self, d, dl):
sel... | agpl-3.0 |
ladybug-tools/honeybee | honeybee_plus/radiance/material/metal.py | 2 | 7343 | """Radiance Metal Material.
http://radsite.lbl.gov/radiance/refer/ray.html#Metal
"""
from .materialbase import RadianceMaterial
from ..datatype import RadianceNumber
class Metal(RadianceMaterial):
"""Radiance metal material."""
r_reflectance = RadianceNumber('r_reflectance', num_type=float, valid_range=(0, ... | gpl-3.0 |
Johnzero/erp | openerp/addons/survey/report/survey_analysis_report.py | 9 | 28532 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# ... | agpl-3.0 |
appleseedhq/cortex | contrib/scripts/convertSceneC++.py | 5 | 3174 | import re
import os
import sys
import glob
import inspect
import argparse
import IECore
import IECoreScene
parser = argparse.ArgumentParser(
description = inspect.cleandoc(
"""
Attempts to modify C++ source files to assist
in the migration from IECore to IECoreScene :
- Replaces #includes
- Replaces IECore::... | bsd-3-clause |
KBIAnews/Podcasts | django-project/shows/migrations/0006_auto_20170505_1439.py | 1 | 1494 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-05 14:39
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('shows', '0005_auto_20170504_1433'),
]
operations = [... | mit |
sudheesh001/oh-mainline | vendor/packages/beautifulsoup4/bs4/testing.py | 440 | 24510 | """Helper classes for tests."""
import copy
import functools
import unittest
from unittest import TestCase
from bs4 import BeautifulSoup
from bs4.element import (
CharsetMetaAttributeValue,
Comment,
ContentMetaAttributeValue,
Doctype,
SoupStrainer,
)
from bs4.builder import HTMLParserTreeBuilder
d... | agpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.