code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from django.contrib.syndication.feeds import Feed, FeedDoesNotExist
from brainstorm.models import Subsite
class SubsiteFeed(Feed):
title_template = 'brainstorm/feed_title.html'
description_template = 'brainstorm/feed_description.html'
def get_object(self, bits):
return Subsite.objects.get(slug__e... | gandalfar/django-brainstorm | brainstorm/feeds.py | Python | bsd-3-clause | 914 |
# see http://docs.gunicorn.org/en/latest/configure.html#configuration-file
from os import getenv
bind = '0.0.0.0:{}'.format(getenv('PORT', 8000))
workers = int(getenv('WSGI_NUM_WORKERS', 2))
accesslog = '-'
errorlog = '-'
loglevel = getenv('WSGI_LOG_LEVEL', 'info')
keepalive = int(getenv('WSGI_KEEP_ALIVE', 2))
worke... | safwanrahman/kitsune | wsgi/config.py | Python | bsd-3-clause | 399 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class ScraperItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
| cprakashagr/PythonClass | src/scraper/scraper/items.py | Python | mit | 286 |
# Run with python3 simple_server.py PORT
from aiohttp import web
import asyncio
import sys
import uvloop
import ujson as json
loop = uvloop.new_event_loop()
asyncio.set_event_loop(loop)
async def handle(request):
return web.Response(body=json.dumps({"test":True}).encode('utf-8'), content_type='application/json')... | ai0/sanic | tests/performance/aiohttp/simple_server.py | Python | mit | 449 |
from pythonforandroid.toolchain import shprint, current_directory
from pythonforandroid.recipe import Recipe
from multiprocessing import cpu_count
from os.path import exists
import sh
class LibSecp256k1Recipe(Recipe):
url = 'https://github.com/bitcoin-core/secp256k1/archive/master.zip'
def build_arch(self, ... | wexi/python-for-android | pythonforandroid/recipes/libsecp256k1/__init__.py | Python | mit | 1,139 |
# Time: O(n)
# Space: O(1)
# Given a string which consists of lowercase or uppercase letters,
# find the length of the longest palindromes that can be built with those letters.
#
# This is case sensitive, for example "Aa" is not considered a palindrome here.
#
# Note:
# Assume the length of given string will not exce... | tudennis/LeetCode---kamyu104-11-24-2015 | Python/longest-palindrome.py | Python | mit | 985 |
#! /usr/bin/env python
#
# Copyright (C) 2004 Andreas Berger, berger@ftw.at
#
# 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 v... | 0xalen/opencaster_isdb-tb | libs/dvbobjects/dvbobjects/MPEG/DVBH_Descriptors.py | Python | gpl-2.0 | 10,359 |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
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 progra... | mrquim/mrquimrepo | script.module.exodus/lib/resources/lib/sources/en/to_be_fixed/sitedown/icefilmsis.py | Python | gpl-2.0 | 5,058 |
# -*- encoding: utf-8 -*-
# pilas engine: un motor para hacer videojuegos
#
# Copyright 2010-2014 - Hugo Ruscitti
# License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html)
#
# Website - http://www.pilas-engine.com.ar
from pilasengine import colores
from pilasengine.fondos.fondo import Fondo
class Fondos(object):
... | hgdeoro/pilas | pilasengine/fondos/__init__.py | Python | lgpl-3.0 | 2,302 |
#!/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... | jayceyxc/hue | apps/security/src/security/conf.py | Python | apache-2.0 | 1,255 |
"""Services for Fritz integration."""
import logging
from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.service import async_extract_config_entry_ids
from .const import DOMAIN, FRITZ_SERVICES, SERVICE_REBOOT, SERVICE_RECONNECT
... | aronsky/home-assistant | homeassistant/components/fritz/services.py | Python | apache-2.0 | 2,187 |
"""Collection of helper methods.
All containing methods are legacy helpers that should not be used by new
components. Instead call the service directly.
"""
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_BRIGHTNESS_PCT, ATTR_COLOR_NAME, ATTR_COLOR_TEMP,
ATTR_EFFECT, ATTR_FLASH, ATTR_HS_COLO... | MartinHjelmare/home-assistant | tests/components/light/common.py | Python | apache-2.0 | 3,341 |
# coding=utf-8
# Copyright 2016 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)
import re
import re... | pombredanne/pants | contrib/go/src/python/pants/contrib/go/subsystems/go_import_meta_tag_reader.py | Python | apache-2.0 | 2,676 |
# ----------------------------------------------------------------------------
# Copyright 2015 Nervana Systems 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.o... | nhynes/neon | tests/test_optimizer.py | Python | apache-2.0 | 6,823 |
"""A simple actor component.
"""
# Author: Prabhu Ramachandran <prabhu_r@users.sf.net>
# Copyright (c) 2005, Enthought, Inc.
# License: BSD Style.
# Enthought library imports.
from traits.api import Instance
from traitsui.api import View, Group, Item, InstanceEditor
from tvtk.api import tvtk
# Local imports.
from ma... | dmsurti/mayavi | mayavi/components/actor2d.py | Python | bsd-3-clause | 5,263 |
"""
The command template for the default MUX-style command set. There
is also an Player/OOC version that makes sure caller is a Player object.
"""
from evennia.utils import utils
from evennia.commands.command import Command
# limit symbol import for API
__all__ = ("MuxCommand", "MuxPlayerCommand")
class MuxCommand(C... | emergebtc/muddery | evennia/evennia/commands/default/muxcommand.py | Python | bsd-3-clause | 8,473 |
# This is the translator that converts Tcl test to python.
# Not all Tcl test are translatable.
# To ensure that a test can be translated :
# 1) do not use Tcl arrays
# 2) do not use string substitution except in variable names
# eg. obj${i} GetOutput is okay
# obj12 GetOutputAs${i} is not okay.
# 3) do not ... | jeffbaumes/jeffbaumes-vtk | Utilities/vtkTclTest2Py/vtkTclToPyConvertor.py | Python | bsd-3-clause | 18,843 |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
from os.path import join
import sys
def configuration(parent_package='',top_path=None):
import numpy
from numpy.distutils.misc_util import Configuration
config = Configuration('sparse',parent_package,top_path,
... | sargas/scipy | scipy/sparse/setupscons.py | Python | bsd-3-clause | 656 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# MIT License. See license.txt
test_records = [] | rohitw1991/latestadbwnf | core/doctype/workflow_state/test_workflow_state.py | Python | mit | 104 |
from mock import Mock, MagicMock, patch, call, mock_open
# To run unittests on python 2.6 please use unittest2 library
try:
import unittest2 as unittest
except ImportError:
import unittest
import re, jenkinsapi
from jenkinsapi.artifact import Artifact
from jenkinsapi.build import Build
from jenkinsapi.custom_e... | aerickson/jenkinsapi | jenkinsapi_tests/unittests/test_artifact.py | Python | mit | 7,356 |
#!/usr/bin/env python
import socket, ssl
# This is a copy of _RESTRICTED_SERVER_CIPHERS from the current tip of ssl.py
# <https://hg.python.org/cpython/file/af793c7580f1/Lib/ssl.py#l174> except that
# RC4 has been added back in, since it was removed in Python 2.7.10,
# but SSLStreamConnection only supports RC4 cipher... | marco-c/pluotsorbet | tests/sslEchoServer.py | Python | gpl-2.0 | 2,382 |
#
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
'''
Filter blocks and related functions.
'''
import os
from gnuradio.fft import window
try:
from .filter_python import *
except ImportError:
dirname, filename = os.path.split... | dl1ksv/gnuradio | gr-filter/python/filter/__init__.py | Python | gpl-3.0 | 624 |
# Copyright 2008 (C) Nicira, Inc.
#
# This file is part of NOX.
#
# NOX 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.
#
# NOX is d... | bigswitch/snac-nox-zaku | src/nox/lib/packet/dhcp.py | Python | gpl-3.0 | 8,935 |
# -*- python -*-
# Copyright (C) 2009-2015 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later versio... | FabianKnapp/nexmon | buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-x86/arm-none-eabi/lib/armv7e-m/softfp/fpv5-sp-d16/libstdc++.a-gdb.py | Python | gpl-3.0 | 2,501 |
#!/usr/bin/python
#
# Copyright (c) 2017 Obezimnaka Boms, <t-ozboms@microsoft.com>
#
# 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',
... | veger/ansible | lib/ansible/modules/cloud/azure/azure_rm_dnsrecordset_facts.py | Python | gpl-3.0 | 6,511 |
# -*- coding: utf-8 -*-
# Python source code encoding : https://www.python.org/dev/peps/pep-0263/
##############################################################################
#
# Copyright (c) 2015 Antiun Ingeniería S.L. (http://www.antiun.com)
# Endika Iglesias <endikaig@antiun.com>
#
# T... | BT-fgarbely/website | website_blog_facebook_comment/__openerp__.py | Python | agpl-3.0 | 1,587 |
"""Support for XS1 switches."""
import logging
from homeassistant.helpers.entity import ToggleEntity
from . import ACTUATORS, DOMAIN as COMPONENT_DOMAIN, XS1DeviceEntity
_LOGGER = logging.getLogger(__name__)
async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None):
"""Set ... | jnewland/home-assistant | homeassistant/components/xs1/switch.py | Python | apache-2.0 | 1,288 |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | KaranToor/MA450 | google-cloud-sdk/lib/surface/container/node_pools/describe.py | Python | apache-2.0 | 1,997 |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | CSCI1200Course/csci1200OnlineCourse | tests/functional/modules_data_source_providers.py | Python | apache-2.0 | 14,954 |
# Copyright 2015 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://... | rprichard/rust | src/etc/htmldocck.py | Python | apache-2.0 | 14,476 |
#!/usr/bin/python
# Copyright (c) Intel Corporation
# Copyright (c) 2017
#
# 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 ... | arvindn05/osc-core | osc-server-bom/root/opt/vmidc/bin/vmidcShell.py | Python | apache-2.0 | 21,993 |
# (c) Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
from __future__ import absolute_import, division, print_function
import argparse
from collections impo... | dan-blanchard/conda-build | conda_build/main_metapackage.py | Python | bsd-3-clause | 4,053 |
import datetime
import pytz
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.shortcuts import get_current_site
from django.test import RequestFactory, TestCase
from wagtail.core.models import Page, PageViewRestriction, Site
from wagtail.tests.testapp.models import EventIndex, Simpl... | nimasmi/wagtail | wagtail/contrib/sitemaps/tests.py | Python | bsd-3-clause | 6,379 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this softwa... | bl4ckdu5t/registron | tests/import/relimp/relimp1.py | Python | mit | 795 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this softwa... | bl4ckdu5t/registron | tests/interactive/test_ipython.py | Python | mit | 441 |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: Transformation-based learning
#
# Copyright (C) 2001-2017 NLTK Project
# Author: Marcus Uneson <marcus.uneson@gmail.com>
# based on previous (nltk2) version by
# Christopher Maloof, Edward Loper, Steven Bird
# URL: <http://nltk.org/>
# For license information, see... | sdoran35/hate-to-hugs | venv/lib/python3.6/site-packages/nltk/tbl/demo.py | Python | mit | 14,715 |
from .numpy_mixins import NumpyArrayTestingMixIn
| decvalts/landlab | landlab/testing/__init__.py | Python | mit | 50 |
import warnings
try:
from paste.registry import StackedObjectProxy
beaker_session = StackedObjectProxy(name="Beaker Session")
beaker_cache = StackedObjectProxy(name="Cache Manager")
except:
beaker_cache = None
beaker_session = None
from beaker.cache import CacheManager
from beaker.session import S... | abdesslem/malwareHunter | web/controller/beaker/middleware.py | Python | gpl-2.0 | 6,423 |
'''
file clean_dvi.py
This file is part of LyX, the document processor.
Licence details can be found in the file COPYING
or at http://www.lyx.org/about/licence.php
author Angus Leeming
Full author contact details are available in the file CREDITS
or at http://www.lyx.org/about/credits.php
Usage:
python clean_dvi.... | bpiwowar/lyx | lib/scripts/clean_dvi.py | Python | gpl-2.0 | 3,211 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__license__ = 'MIT'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import re
import sys
import os
import codecs
# Spell checker support
try:
import enchant
except ImportError:
enchant = None
# Syntax highligh... | thegooglecodearchive/marave | marave/editor/spelltextedit.py | Python | gpl-2.0 | 13,856 |
""" Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse) """
# Local imports
from lib2to3 import fixer_base
from lib2to3.fixer_util import BlankLine, syms, token
class FixItertoolsImports(fixer_base.BaseFix):
PATTERN = """
import_from< 'from' 'itertools' 'import' imports=any >
... | 2ndy/RaspIM | usr/lib/python2.6/lib2to3/fixes/fix_itertools_imports.py | Python | gpl-2.0 | 1,840 |
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
'''
(C) 2008, 2009 Kerim Mansour
For licensing information please refer to license.txt
'''
from attributes import *
from core import BaseElement, PointAttrib, DimensionAttrib
class linearGradient(BaseElement, CoreAttrib, XLinkAttrib, PaintAttrib, StyleAttrib, ... | 163gal/Time-Line | libs_arm/dependencies/pysvg-0.2.1/pysvg/gradient.py | Python | gpl-3.0 | 5,902 |
# unit tests for ansible fact collectors
# -*- coding: utf-8 -*-
#
# 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.
#
# Ansibl... | tux-00/ansible | test/units/module_utils/facts/test_collectors.py | Python | gpl-3.0 | 12,595 |
# -*- 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... | ovnicraft/openerp-restaurant | point_of_sale/wizard/pos_receipt.py | Python | agpl-3.0 | 2,288 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import _, api, fields, models
from odoo.exceptions import UserError
class RemovalStrategy(models.Model):
_name = 'product.removal'
_description = 'Removal Strategy'
name = fields.Char('Name', req... | ygol/odoo | addons/stock/models/product_strategy.py | Python | agpl-3.0 | 4,217 |
# -*- 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... | ttfseiko/openerp-trunk | openerp/addons/mrp_byproduct/mrp_byproduct.py | Python | agpl-3.0 | 8,796 |
# docstrings not neede here (the type handler doubleerfaces are fully
# documented in base.py) pylint: disable-msg=C0111
from .base import ReturnValue, Parameter, \
ReverseWrapperBase, ForwardWrapperBase
class PyObjectParam(Parameter):
DIRECTIONS = [Parameter.DIRECTION_IN]
CTYPES = ['PyObject*']
d... | cawka/pybindgen | pybindgen/typehandlers/pyobjecttype.py | Python | lgpl-2.1 | 2,516 |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/raw/GL/NV/texture_expand_normal.py | Python | lgpl-3.0 | 591 |
'''OpenGL extension ARB.texture_gather
This module customises the behaviour of the
OpenGL.raw.GL.ARB.texture_gather to provide a more
Python-friendly API
Overview (from the spec)
This extension provides a new set of texture functions
(textureGather) to the shading language that determine 2x2 footprint
that are... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/GL/ARB/texture_gather.py | Python | lgpl-3.0 | 1,072 |
#!/usr/bin/python
'''Launches cassandra-stress instances in Marathon.'''
import json
import logging
import pprint
import random
import string
import sys
import urllib
# non-stdlib libs:
try:
import click
import requests
from requests.exceptions import HTTPError
except ImportError:
print("Failed to lo... | adobe-mds/dcos-cassandra-service | cassandra-test-client/launcher.py | Python | apache-2.0 | 8,836 |
'''
Cache manager
=============
The cache manager can be used to store python objects attached to a unique
key. The cache can be controlled in two ways: with a object limit or a
timeout.
For example, we can create a new cache with a limit of 10 objects and a
timeout of 5 seconds::
# register a new Cache
Cach... | rafalo1333/kivy | kivy/cache.py | Python | mit | 7,962 |
"""
settings.py
Configuration for Flask app
Important: Place your keys in the secret_keys.py module,
which should be kept out of version control.
"""
from secret_keys import CSRF_SECRET_KEY, SESSION_KEY
class Config(object):
# Set secret keys for CSRF protection
SECRET_KEY = CSRF_SECRET_KEY
... | nwinter/bantling | src/application/settings.py | Python | mit | 747 |
comma = ','.join
quest = lambda l: '=?,'.join(l) + '=?'
exists_table = "SELECT name FROM sqlite_master WHERE type='table' AND name='assets'"
read_all = lambda keys: 'select ' + comma(keys) + ' from assets order by play_order'
read = lambda keys: 'select ' + comma(keys) + ' from assets where asset_id=?'
create = lamb... | jpsingleton/screenly-ose | queries.py | Python | gpl-2.0 | 540 |
import time
class Playlist(object):
""" Representation of a playist, has list of songs. """
def __init__(self, name=None, songs=None):
""" class members. """
self.name = name
self.creation = time.time()
self.songs = songs or []
@property
def is_empty(self):
"... | superboonie/mps-youtube | mps_youtube/playlist.py | Python | gpl-3.0 | 985 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from shoop.admin.utils.urls import manipulate_query_string
def test_qs_man... | jaywink/shoop | shoop_tests/admin/test_qs.py | Python | agpl-3.0 | 691 |
# -*- coding: utf-8 -*-
#
# PySPED - Python libraries to deal with Brazil's SPED Project
#
# Copyright (C) 2010-2012
# Copyright (C) Aristides Caldeira <aristides.caldeira at tauga.com.br>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Library General Public Lic... | rodrigoasmacedo/PySPED | pysped/cte/__init__.py | Python | lgpl-2.1 | 3,165 |
"""PyTest fixtures and test helpers."""
from unittest import mock
import blebox_uniapi
import pytest
from homeassistant.components.blebox.const import DOMAIN
from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.setup import async_setup_component
from tests.async_mock import AsyncMock, PropertyMoc... | tchellomello/home-assistant | tests/components/blebox/conftest.py | Python | apache-2.0 | 3,402 |
"""The test for the statistics sensor platform."""
import unittest
import statistics
from homeassistant.setup import setup_component
from homeassistant.const import (ATTR_UNIT_OF_MEASUREMENT, TEMP_CELSIUS)
from tests.common import get_test_home_assistant
class TestStatisticsSensor(unittest.TestCase):
"""Test the... | JshWright/home-assistant | tests/components/sensor/test_statistics.py | Python | apache-2.0 | 3,733 |
"""
Example standalone app for calculating series statistics
"""
import optparse
from thunder import ThunderContext
if __name__ == "__main__":
parser = optparse.OptionParser(description="compute summary statistics on time series data",
usage="%prog datafile outputdir mode [opti... | zhwa/thunder | thunder/standalone/stats.py | Python | apache-2.0 | 835 |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... | sosiouxme/openshift-ansible | roles/lib_openshift/library/oc_scale.py | Python | apache-2.0 | 66,630 |
# 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... | hfp/tensorflow-xsmm | tensorflow/contrib/distribute/python/monitor.py | Python | apache-2.0 | 2,505 |
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2010, Eucalyptus Systems, Inc.
#
# 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
# w... | kumar303/rockit | vendor-local/boto/route53/connection.py | Python | bsd-3-clause | 12,631 |
"""
WSGI config for saleor project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` s... | tfroehlich82/saleor | saleor/wsgi/__init__.py | Python | bsd-3-clause | 1,225 |
import json
def insert_data(data, db):
# Your code here. Insert the data into a collection 'arachnid'
pass
if __name__ == "__main__":
from pymongo import MongoClient
client = MongoClient("mongodb://localhost:27017")
db = client.examples
with open('arachnid.json') as f:
data = ... | tuanvu216/udacity-course | data_wrangling_with_mongodb/Lesson_4_Problem_Set/02-Inserting_into_DB/dbinsert.py | Python | mit | 407 |
from ee.utils import test
from ee.cli.main import get_test_app
class CliTestCaseStack(test.EETestCase):
def test_ee_cli(self):
self.app.setup()
self.app.run()
self.app.close()
def test_ee_cli_stack_install_web(self):
self.app = get_test_app(argv=['stack', 'install', '--web'])... | mehulsbhatt/easyengine | tests/cli/13_test_stack.py | Python | mit | 2,316 |
import ocl
trilist = []
trilist.append(ocl.Triangle(ocl.Point(2.91337, 1, 3.93857),
ocl.Point(2.89783, -7.09741e-016, 4.07462),
ocl.Point(4, -9.79685e-016, 3)))
trilist.append(ocl.Triangle(ocl.Point(2.91337, 1, 3.93857),
ocl.Point(4,... | AlanZatarain/opencamlib | scripts/issues/issue20data.py | Python | gpl-3.0 | 4,416 |
"Memcached cache backend"
from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError
from django.utils.encoding import smart_unicode, smart_str
from google.appengine.api import memcache
class CacheClass(BaseCache):
def __init__(self, server, params):
BaseCache.__init__(self, params)
... | thomazs/geraldo | site/newsite/site-geraldo/django/core/cache/backends/memcached.py | Python | lgpl-3.0 | 1,303 |
"""Home Assistant auth provider."""
import asyncio
import base64
from collections import OrderedDict
import logging
from typing import Any, Dict, List, Optional, Set, cast
import bcrypt
import voluptuous as vol
from homeassistant.const import CONF_ID
from homeassistant.core import HomeAssistant, callback
from homeass... | sdague/home-assistant | homeassistant/auth/providers/homeassistant.py | Python | apache-2.0 | 10,935 |
# Copyright 2014, 2015 SAP SE
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | ralhei/PyHDB | pyhdb/auth.py | Python | apache-2.0 | 3,055 |
"""Invalid Python comment test."""
// invalid python comment # noqa -- tell linters to ignore the intentional syntax error
| duynguyen/incubator-openwhisk | tests/dat/actions/malformed.py | Python | apache-2.0 | 124 |
# -*- coding: iso-8859-1 -*-
# Natural Language Toolkit: York-Toronto-Helsinki Parsed Corpus of Old English Prose (YCOE)
#
# Copyright (C) 2001-2008 University of Pennsylvania
# Author: Selina Dennis <selina@tranzfusion.net>
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
"""
Corpus reader for ... | hectormartinez/rougexstem | taln2016/icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk/corpus/reader/ycoe.py | Python | apache-2.0 | 11,296 |
"""
homeassistant.config
~~~~~~~~~~~~~~~~~~~~
Module to help with parsing and generating configuration files.
"""
import logging
import os
from homeassistant.exceptions import HomeAssistantError
from homeassistant.const import (
CONF_LATITUDE, CONF_LONGITUDE, CONF_TEMPERATURE_UNIT, CONF_NAME,
CONF_TIME_ZONE)
... | alexkolar/home-assistant | homeassistant/config.py | Python | mit | 5,349 |
#!/usr/bin/python
# -*- coding: koi8-r -*-
import blur.Stone
import PyQt4.QtCore
from xmpp import *
import time,os,sys
app = PyQt4.QtCore.QCoreApplication(sys.argv)
blur.Stone.initConfig( 'conference_logger.ini', 'it@conference.blur.com.log' )
blur.RedirectOutputToLog()
#BOT=(botjid,password)
BOT=('thepipe@jabber.blu... | jacksonwilliams/arsenalsuite | python/scripts/conference_logger.py | Python | gpl-2.0 | 1,265 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016, Brian Coca <bcoca@ansible.com>
# 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... | hkariti/ansible | lib/ansible/modules/system/systemd.py | Python | gpl-3.0 | 18,087 |
#! /usr/bin/env python
# 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/.
"""This module defines the class hierarchy for all Socorro applications.
The base of the hierarc... | rhelmer/socorro | socorro/app/socorro_app.py | Python | mpl-2.0 | 19,914 |
from __future__ import print_function
import pytest
from website.app import init_app
from tests.json_api_test_app import JSONAPITestApp
@pytest.fixture()
def app():
return JSONAPITestApp()
# NOTE: autouse so that ADDONS_REQUESTED gets set on website.settings
@pytest.fixture(autouse=True, scope='session')
def a... | Johnetordoff/osf.io | api_tests/conftest.py | Python | apache-2.0 | 378 |
# Copyright (c) 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 ... | zhimin711/nova | nova/tests/unit/cells/test_cells_weights.py | Python | apache-2.0 | 9,003 |
# Copyright 2013, 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... | projectcalico/calico-neutron | neutron/tests/unit/nec/test_security_group.py | Python | apache-2.0 | 3,731 |
# Copyright (C) 2009-2012 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | gkotton/vmware-nsx | vmware-nsx/neutron/tests/unit/vmware/apiclient/test_api_eventlet_request.py | Python | apache-2.0 | 12,642 |
# Copyright 2014 Objectif Libre
# Copyright 2015 DotHill Systems
#
# 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
#
# U... | nikesh-mahalka/cinder | cinder/volume/drivers/dothill/dothill_client.py | Python | apache-2.0 | 14,785 |
#!/usr/bin/env python
# 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.
"""
Test variable expansion of '<|(list.txt ...)' syntax commands.
"""
import os
import sys
import TestGyp
test = TestGyp.TestGyp()
CHDI... | ibc/MediaSoup | worker/deps/gyp/test/variables/filelist/gyptest-filelist.py | Python | isc | 697 |
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
#
# 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, incl... | aubreyrjones/libesp | scons_local/scons-local-2.3.0/SCons/PathList.py | Python | mit | 8,536 |
#
# This file is part of pyasn1-modules software.
#
# Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com>
# License: http://pyasn1.sf.net/license.html
#
# LDAP message syntax
#
# ASN.1 source from:
# http://www.trl.ibm.com/projects/xml/xss4j/data/asn1/grammars/ldap.asn
#
# Sample captures from:
# http://wiki.wire... | saurabhbajaj207/CarpeDiem | venv/Lib/site-packages/pyasn1_modules/rfc2251.py | Python | mit | 26,833 |
from pylab import figure,show,connect,hist,plot,legend
from numpy import array, append, arange, empty, exp
from shogun import Gaussian, GMM
from shogun import RealFeatures
import util
util.set_title('EM for 1d GMM example')
#set the parameters
min_cov=1e-9
max_iter=1000
min_change=1e-9
#setup the real GMM
real_gmm=G... | MikeLing/shogun | examples/undocumented/python/graphical/em_1d_gmm.py | Python | gpl-3.0 | 1,911 |
# coding: utf-8
from __future__ import unicode_literals
from .theplatform import ThePlatformIE
from ..utils import int_or_none
class CNETIE(ThePlatformIE):
_VALID_URL = r'https?://(?:www\.)?cnet\.com/videos/(?P<id>[^/]+)/'
_TESTS = [{
'url': 'http://www.cnet.com/videos/hands-on-with-microsofts-window... | akirk/youtube-dl | youtube_dl/extractor/cnet.py | Python | unlicense | 3,591 |
__author__ = 'gdoermann'
| gdoermann/django-twitter | twit/util/__init__.py | Python | apache-2.0 | 27 |
#!/usr/bin/python2.4
#
# Copyright 2009 Empeeric LTD. 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
#
# Unl... | zackster/HipHopGoblin | trunk/bitly.py | Python | bsd-3-clause | 7,778 |
"""
Convenience interface to N-D interpolation
.. versionadded:: 0.9
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from .interpnd import LinearNDInterpolator, NDInterpolatorBase, \
CloughTocher2DInterpolator, _ndim_coords_from_arrays
from scipy.spatial import cKDTree
_... | Eric89GXL/scipy | scipy/interpolate/ndgriddata.py | Python | bsd-3-clause | 7,557 |
# -*- coding: utf-8 -*-
#
# test_enable_multithread.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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... | tobikausk/nest-simulator | pynest/nest/tests/test_sp/test_enable_multithread.py | Python | gpl-2.0 | 2,237 |
# -*- coding: ISO-8859-1 -*-
###################################################
## Definitions of the different midi events
###################################################
## Midi channel events (The most usual events)
## also called "Channel Voice Messages"
NOTE_OFF = 0x80
# 1000cccc 0nnnnnnn 0vvvvvvv (chann... | maggotgdv/fofix | src/midi/constants.py | Python | gpl-2.0 | 6,364 |
from __future__ import absolute_import, unicode_literals
import logging
import os
logger = logging.getLogger(__name__)
def check_dirs_and_files(config):
if not os.path.isdir(config['local']['media_dir']):
logger.warning(
'Local media dir %s does not exist.' %
config['local']['med... | pacificIT/mopidy | mopidy/local/storage.py | Python | apache-2.0 | 330 |
from django.conf.urls import include, url
from django.contrib import admin
admin.autodiscover()
import hello.views
# Examples:
# url(r'^$', 'gettingstarted.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
urlpatterns = [
url(r'^$', hello.views.index, name='index'),
url(r'^db', hello.views.... | jessefeinman/FintechHackathon | python-getting-started/sample stuff/gettingstarted/urls.py | Python | bsd-2-clause | 385 |
# -*- mode: python; fill-column: 100; comment-column: 100; -*-
import unittest
import sys
import os
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
import base_test
class RefreshPageTest(base_test.WebDriverBaseTest):
# Get a static page that must be the same upon ... | chunywang/crosswalk-test-suite | misc/webdriver-w3c-tests/navigation/refresh-page.py | Python | bsd-3-clause | 1,126 |
"""Undocumented Module"""
__all__ = ['doTest']
from panda3d.core import *
from panda3d.direct import *
from .IntervalGlobal import *
def doTest():
smiley = loader.loadModel('models/misc/smiley')
smiley.reparentTo(render)
pi = ProjectileInterval(smiley, startPos=Point3(0, 0, 0),
... | brakhane/panda3d | direct/src/interval/ProjectileIntervalTest.py | Python | bsd-3-clause | 437 |
# This file is part of Invenio.
# Copyright (C) 2010, 2011 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Inveni... | zenodo/invenio | invenio/legacy/websubmit/functions/Export_Via_SWORD.py | Python | gpl-2.0 | 8,575 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Corwin Brown <corwin@corwinbrown.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the... | gundalow/ansible-modules-extras | windows/win_uri.py | Python | gpl-3.0 | 4,484 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
MISC_HTML_SOURCE = u"""
<font size="2" style="color: rgb(31, 31, 31); font-family: monospace; font-variant: normal; line-height: normal; ">test1</font>
<div style="color: rgb(31, 31, 31); font-family: monospace; font-var... | ygol/odoo | odoo/addons/base/tests/test_mail_examples.py | Python | agpl-3.0 | 21,967 |
from django.db.backends import BaseDatabaseClient
from django.conf import settings
import os
class DatabaseClient(BaseDatabaseClient):
executable_name = 'sqlite3'
def runshell(self):
args = ['', settings.DATABASE_NAME]
os.execvp(self.executable_name, args)
| marcydoty/geraldo | site/newsite/site-geraldo/django/db/backends/sqlite3/client.py | Python | lgpl-3.0 | 283 |
# Copyright 2015 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 agre... | wolverineav/neutron | neutron/tests/common/config_fixtures.py | Python | apache-2.0 | 2,517 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 coding=utf-8
import os
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _, ugettext_lazy
from onadata.libs.logger.import_tools import import_instances_from_z... | jomolinare/kobocat | onadata/apps/logger/management/commands/import_instances.py | Python | bsd-2-clause | 2,293 |