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 |
|---|---|---|---|---|---|
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2015, Hewlett-Packard Development Company, L.P.
# 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'... | aperigault/ansible | lib/ansible/modules/cloud/openstack/os_ironic_node.py | Python | gpl-3.0 | 12,322 |
#!/usr/bin/env python
import linchpin.FilterUtils.FilterUtils as filter_utils
class FilterModule(object):
''' A filter to filter list by attribute '''
def filters(self):
return {
'filter_list_by_attr': filter_utils.filter_list_by_attr
}
| samvarankashyap/linch-pin | linchpin/provision/roles/azure/filter_plugins/filter_list_by_attr.py | Python | gpl-3.0 | 275 |
#!/usr/bin/python
#
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
# Chris Houseknecht, <house@redhat.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
ANS... | fxfitz/ansible | lib/ansible/modules/cloud/azure/azure_rm_storageaccount.py | Python | gpl-3.0 | 18,878 |
# encoding: utf-8
"""Foolscap related utilities."""
__docformat__ = "restructuredtext en"
#-------------------------------------------------------------------------------
# Copyright (C) 2008 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYI... | mastizada/kuma | vendor/packages/ipython/IPython/kernel/fcutil.py | Python | mpl-2.0 | 2,107 |
# -*- coding: utf-8 -*-
""" Imports and provides the 'correct' version of readline for the platform.
Readline is used throughout IPython as 'import IPython.rlineimpl as readline'.
In addition to normal readline stuff, this module provides have_readline
boolean and _outputfile variable used in genutils.
"""
import sy... | mastizada/kuma | vendor/packages/ipython/IPython/rlineimpl.py | Python | mpl-2.0 | 1,760 |
from typing import Dict
import re
from pcp.pmda import PMDA, pmdaMetric
from pcp.pmapi import pmUnits
import cpmapi as c_api
from .models import Script, MetricType, VariableDefinition, Logger
from .service import BPFtraceService
from .uncached_indom import UncachedIndom
class Consts:
class Script:
"""it... | adfernandes/pcp | src/pmdas/bpftrace/bpftrace/cluster.py | Python | lgpl-2.1 | 9,225 |
# 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... | tensorflow/tensorflow | tensorflow/python/data/kernel_tests/interleave_test.py | Python | apache-2.0 | 17,486 |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch.nn as nn
from fairse... | mlperf/training_results_v0.5 | v0.5.0/nvidia/submission/code/translation/pytorch/fairseq/modules/learned_positional_embedding.py | Python | apache-2.0 | 1,420 |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | ronfung/incubator-airflow | airflow/contrib/hooks/spark_submit_hook.py | Python | apache-2.0 | 10,915 |
#Note: code gotten from importsTipper.
import sys
def _imp(name, log=None):
try:
return __import__(name)
except:
if '.' in name:
sub = name[0:name.rfind('.')]
if log is not None:
log.AddContent('Unable to import', name, 'trying with', sub)
... | akiokio/centralfitestoque | src/.pycharm_helpers/pydev/pydevd_import_class.py | Python | bsd-2-clause | 1,825 |
#!/usr/bin/env python
"""Create a "virtual" Python installation
"""
__version__ = "13.1.0"
virtualenv_version = __version__ # legacy
import base64
import sys
import os
import codecs
import optparse
import re
import shutil
import logging
import tempfile
import zlib
import errno
import glob
import distutils.sysconfig
... | victor-lin/npact | virtualenv.py | Python | bsd-3-clause | 99,413 |
from django import forms
from django.conf import settings
from django.contrib.admin import widgets as admin_widgets
from django.template import loader, Context
from django.utils.html import conditional_escape
from django.utils.encoding import force_unicode
class MarkEdit(forms.Textarea):
def render(self, name, v... | pyconjp/pyconjp-website | markedit/widgets.py | Python | bsd-3-clause | 1,439 |
# -*- coding: utf-8 -*-
"""
flask.ext.cache
~~~~~~~~~~~~~~
Adds cache support to your application.
:copyright: (c) 2010 by Thadeus Burgess.
:license: BSD, see LICENSE for more details
"""
__version__ = '0.13.1'
__versionfull__ = __version__
import base64
import functools
import hashlib
import in... | gdimitris/FleetManagerBackend | virtual_env/lib/python2.7/site-packages/flask_cache/__init__.py | Python | mit | 24,578 |
# -*- coding: utf-8 -*-
import os
import time
from StringIO import StringIO
from PIL import Image
from django.conf import settings
from easy_thumbnails.base import Thumbnail
from easy_thumbnails.main import DjangoThumbnail, get_thumbnail_setting
from easy_thumbnails.processors import dynamic_import, get_valid_options... | samabhi/pstHealth | venv/lib/python2.7/site-packages/easy_thumbnails/sorl-tests/classes.py | Python | mit | 8,008 |
# Copyright 2016 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | ininex/geofire-python | resource/lib/python2.7/site-packages/gcloud/monitoring/test_timeseries.py | Python | mit | 6,799 |
"""Test runner for all Ansible tests."""
from __future__ import annotations
import os
import sys
import typing as t
# This import should occur as early as possible.
# It must occur before subprocess has been imported anywhere in the current process.
from .init import (
CURRENT_RLIMIT_NOFILE,
)
from .util import ... | mattclay/ansible | test/lib/ansible_test/_internal/__init__.py | Python | gpl-3.0 | 2,387 |
#Copyright 2009,2010 Alex Graves
#
# This file is part of RNNLIB.
#
# RNNLIB 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.
#
# RNNL... | bquast/rnnlib | utils/min_max.py | Python | gpl-3.0 | 1,350 |
"""
Tests for users API
"""
import datetime
from django.utils import timezone
from xmodule.modulestore.tests.factories import ItemFactory, CourseFactory
from xmodule.modulestore.django import modulestore
from student.models import CourseEnrollment
from .. import errors
from ..testutils import MobileAPITestCase, Mobi... | olexiim/edx-platform | lms/djangoapps/mobile_api/users/tests.py | Python | agpl-3.0 | 9,422 |
################################################################################
# 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... | apache/flink | flink-python/pyflink/datastream/tests/test_connectors.py | Python | apache-2.0 | 20,161 |
"""Test system log component."""
import asyncio
import logging
import queue
from unittest.mock import MagicMock, patch
import pytest
from homeassistant.bootstrap import async_setup_component
from homeassistant.components import system_log
from homeassistant.core import callback
_LOGGER = logging.getLogger("test_logg... | sander76/home-assistant | tests/components/system_log/test_init.py | Python | apache-2.0 | 11,361 |
# Copyright (c) 2014 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | esikachev/scenario | sahara/tests/unit/service/test_ops.py | Python | apache-2.0 | 7,257 |
import base64
import datetime
import json
from M2Crypto import EVP, X509, Rand
class TicketEncoder():
@staticmethod
def _formatDate(d):
return d.strftime("%Y%m%d%H%M%S")
def __init__(self, cert, key, lifetime=5):
self._lifetime = lifetime
self._x509 = X509.load_cert(cert)
... | walteryang47/ovirt-engine | packaging/pythonlib/ovirt_engine/ticket.py | Python | apache-2.0 | 3,464 |
#!/usr/bin/env python
import os
import sys
import time
import yaml
import urllib
import hashlib
import argparse
required_keys = ['caffemodel', 'caffemodel_url', 'sha1']
def reporthook(count, block_size, total_size):
"""
From http://blog.moleculea.com/2012/10/04/urlretrieve-progres-indicator/
"""
glob... | wangg12/caffe | scripts/download_model_binary.py | Python | bsd-2-clause | 2,496 |
# coding=utf-8
# Copyright 2021 TF.Text 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 or ag... | chromium/chromium | third_party/tensorflow-text/src/tensorflow_text/python/ops/regex_split_ops.py | Python | bsd-3-clause | 10,403 |
"""
Support for MQTT sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.mqtt/
"""
import logging
import voluptuous as vol
import homeassistant.components.mqtt as mqtt
from homeassistant.const import CONF_NAME, CONF_VALUE_TEMPLATE, STATE_UNK... | deisi/home-assistant | homeassistant/components/sensor/mqtt.py | Python | mit | 2,630 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | Southpaw-TACTIC/TACTIC | src/pyasm/application/maya/maya_environment.py | Python | epl-1.0 | 1,612 |
#
# QAPI introspection generator
#
# Copyright (C) 2015-2016 Red Hat, Inc.
#
# Authors:
# Markus Armbruster <armbru@redhat.com>
#
# This work is licensed under the terms of the GNU GPL, version 2.
# See the COPYING file in the top-level directory.
from qapi import *
# Caveman's json.dumps() replacement (we're stuck... | gongleiarei/qemu | scripts/qapi-introspect.py | Python | gpl-2.0 | 7,230 |
import gc
import sys
import unittest
import weakref
from test import support
class FinalizationTest(unittest.TestCase):
def test_frame_resurrect(self):
# A generator frame can be resurrected by a generator's finalization.
def gen():
nonlocal frame
try:
yie... | michalliu/OpenWrt-Firefly-Libraries | staging_dir/target-mipsel_1004kc+dsp_uClibc-0.9.33.2/usr/lib/python3.4/test/test_generators.py | Python | gpl-2.0 | 54,447 |
#!/usr/bin/env python2
"""Contains functions to do word-wrapping on text paragraphs."""
import random
import re
import string
def JustifyLine(line, width):
"""Stretch a line to width by filling in spaces at word gaps.
The gaps are picked randomly one-after-another, before it starts
over again.
Auth... | fjpavon/vimrc | doc/db2vim/textutils.py | Python | gpl-3.0 | 6,329 |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | kamal-gade/rockstor-core | src/rockstor/storageadmin/views/views.py | Python | gpl-3.0 | 704 |
# -*- coding: utf-8 -*-
import logging
import werkzeug.utils
from openerp import http
from openerp.http import request
from openerp.addons.web.controllers.main import login_redirect, abort_and_redirect
_logger = logging.getLogger(__name__)
class PosController(http.Controller):
@http.route('/pos/web', type='htt... | addition-it-solutions/project-all | addons/point_of_sale/controllers/main.py | Python | agpl-3.0 | 1,015 |
"""
Using redirect route instead of simple routes since it supports strict_slash
Simple route: http://webapp-improved.appspot.com/guide/routing.html#simple-routes
RedirectRoute: http://webapp-improved.appspot.com/api/webapp2_extras/routes.html#webapp2_extras.routes.RedirectRoute
"""
from webapp2_extras.routes import R... | roninio/gae-boilerplate | boilerplate/routes.py | Python | lgpl-3.0 | 2,607 |
# Copyright 2014 Mellanox Technologies, Ltd
#
# 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 t... | projectcalico/calico-neutron | neutron/tests/unit/agent/linux/test_ip_link_support.py | Python | apache-2.0 | 7,147 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | sandeepdsouza93/TensorFlow-15712 | tensorflow/contrib/learn/python/learn/learn_io/pandas_io.py | Python | apache-2.0 | 6,001 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | maropu/spark | python/pyspark/ml/tests/test_algorithms.py | Python | apache-2.0 | 15,743 |
# CER decoder
from pyasn1.type import univ
from pyasn1.codec.ber import decoder
from pyasn1.compat.octets import oct2int
from pyasn1 import error
class BooleanDecoder(decoder.AbstractSimpleDecoder):
protoComponent = univ.Boolean(0)
def valueDecoder(self, fullSubstrate, substrate, asn1Spec, tagSet, length,
... | hexlism/xx_net | python27/1.0/lib/noarch/pyasn1/codec/cer/decoder.py | Python | bsd-2-clause | 1,229 |
# $Id$
#
# Copyright (C) 2003 Rational Discovery LLC
# All Rights Reserved
#
from rdkit import Chem
from rdkit.VLib.Output import OutputNode as BaseOutputNode
class OutputNode(BaseOutputNode):
""" dumps smiles output
Assumptions:
- destination supports a write() method
- inputs (parents) ... | greglandrum/rdkit | rdkit/VLib/NodeLib/SmilesOutput.py | Python | bsd-3-clause | 2,131 |
# encoding: utf-8
from bs4 import BeautifulSoup
from okscraper.base import BaseScraper
from okscraper.sources import UrlSource, ScraperSource
from okscraper.storages import ListStorage, DictStorage
from lobbyists.models import LobbyistHistory, Lobbyist, LobbyistData, LobbyistRepresent, LobbyistRepresentData
from perso... | otadmor/Open-Knesset | lobbyists/scrapers/lobbyist.py | Python | bsd-3-clause | 5,096 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from django.contrib import admin
from patterns.models import *
class PatternAdmin(admin.ModelAdmin):
list_display = ['name', 'regex']
admin.site.register(Pattern, PatternAdmin)
| adammck/rapidsms-community-apps | patterns/admin.py | Python | bsd-3-clause | 235 |
from django.contrib.auth.models import User
from django.db.utils import DatabaseError
from django.views.generic import FormView
from customers.forms import GenerateUsersForm
from customers.models import Client
from random import choice
class TenantView(FormView):
form_class = GenerateUsersForm
template_name =... | bernardopires/django-tenant-schemas | examples/tenant_tutorial/customers/views.py | Python | mit | 1,718 |
## $id: webstatadmin.py,v 1.28 2007/04/01 23:46:46 tibor exp $
##
## This file is part of Invenio.
## Copyright (C) 2007, 2008, 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; ... | NikolaYolov/invenio_backup | modules/webstat/lib/webstatadmin.py | Python | gpl-2.0 | 10,293 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | wulczer/ansible | v2/ansible/executor/playbook_iterator.py | Python | gpl-3.0 | 4,905 |
# -*- 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... | crmccreary/openerp_server | openerp/addons/document_ftp/wizard/ftp_browse.py | Python | agpl-3.0 | 2,556 |
# 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 ... | wijnandb/CodeCult-Scratch | tests/unit/common_locales.py | Python | apache-2.0 | 2,868 |
import unittest, random, sys, time, os, stat, pwd, grp
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_exec as h2e
FILENUM=100
def write_syn_dataset(csvPathname, rowCount, colCount, SEED, translateList):
r1 = random.Random(SEED)
dsf = open(csvPathname, "... | vbelakov/h2o | py/testdir_single_jvm/test_enum_multi_permission.py | Python | apache-2.0 | 6,221 |
# The following import is required to register the 'cesu8' codec in Python:
import pyhdb.cesu8
| patani1/PyHDB | pyhdb/protocol/__init__.py | Python | apache-2.0 | 95 |
#!/usr/bin/env python
#
# GrovePi Example for using the Grove Vibration Motor (http://www.seeedstudio.com/wiki/Grove_-_Vibration_Motor)
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
#
# Have a question about this example? A... | gerald-yang/ubuntu-iotivity-demo | snappy/grovepi/pygrovepi/grove_vibration_motor.py | Python | apache-2.0 | 2,209 |
from .comparison import Cast, Coalesce, Greatest, Least
from .datetime import (
Extract, ExtractDay, ExtractHour, ExtractIsoYear, ExtractMinute,
ExtractMonth, ExtractQuarter, ExtractSecond, ExtractWeek, ExtractWeekDay,
ExtractYear, Now, Trunc, TruncDate, TruncDay, TruncHour, TruncMinute,
TruncMonth, Tru... | frankvdp/django | django/db/models/functions/__init__.py | Python | bsd-3-clause | 1,872 |
from sympy import (pi, sin, cos, Symbol, Integral, summation, sqrt, log,
oo, LambertW, I, meijerg, exp_polar, Max)
from sympy.plotting import (plot, plot_parametric, plot3d_parametric_line,
plot3d, plot3d_parametric_surface)
from sympy.plotting.plot import unset_show
from ... | sahilshekhawat/sympy | sympy/plotting/tests/test_plot.py | Python | bsd-3-clause | 8,460 |
# DExTer : Debugging Experience Tester
# ~~~~~~ ~ ~~ ~ ~~
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
from ctypes import *
from enum import *
f... | endlessm/chromium-browser | third_party/llvm/debuginfo-tests/dexter/dex/debugger/dbgeng/client.py | Python | bsd-3-clause | 7,990 |
from django.core.exceptions import ValidationError
from django.db import IntegrityError, models, transaction
from django.test import SimpleTestCase, TestCase
from .models import BooleanModel, FksToBooleans, NullBooleanModel
class BooleanFieldTests(TestCase):
def _test_get_prep_value(self, f):
self.assert... | tbeadle/django | tests/model_fields/test_booleanfield.py | Python | bsd-3-clause | 4,416 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('crowdsourcing', '0040_auto_20150824_2013'),
]
operations = [
migrations.AlterModelOptions(
name='comment',
... | xasos/crowdsource-platform | crowdsourcing/migrations/0041_auto_20150825_0240.py | Python | mit | 1,146 |
"""empty message
Revision ID: 8e7f7864cb60
Revises: ('80a704b880db', 'adf34c11b0df')
Create Date: 2016-06-19 15:43:23.027000
"""
# revision identifiers, used by Alembic.
revision = '8e7f7864cb60'
down_revision = ('80a704b880db', 'adf34c11b0df')
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
... | Achint08/open-event-orga-server | migrations/versions/8e7f7864cb60_.py | Python | gpl-3.0 | 374 |
import requests
from allauth.account.utils import get_next_redirect_url
from allauth.socialaccount.providers.oauth2.views import (OAuth2LoginView,
OAuth2CallbackView)
from allauth.socialaccount.providers.github.views import GitHubOAuth2Adapter
from kuma.core.u... | scrollback/kuma | kuma/users/providers/github/views.py | Python | mpl-2.0 | 1,715 |
"""Support for Ampio Air Quality data."""
from __future__ import annotations
import logging
from typing import Final
from asmog import AmpioSmog
import voluptuous as vol
from homeassistant.components.air_quality import (
PLATFORM_SCHEMA as BASE_PLATFORM_SCHEMA,
AirQualityEntity,
)
from homeassistant.const im... | lukas-hetzenecker/home-assistant | homeassistant/components/ampio/air_quality.py | Python | apache-2.0 | 3,182 |
# 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... | ghchinoy/tensorflow | tensorflow/contrib/distribute/python/monitor.py | Python | apache-2.0 | 2,460 |
# 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... | jbedorf/tensorflow | tensorflow/python/ops/ragged/ragged_map_fn_op_test.py | Python | apache-2.0 | 10,897 |
"""The tests for the Sonarr platform."""
import unittest
import time
from datetime import datetime
import pytest
from homeassistant.components.sensor import sonarr
from tests.common import get_test_home_assistant
def mocked_exception(*args, **kwargs):
"""Mock exception thrown by requests.get."""
raise OSEr... | LinuxChristian/home-assistant | tests/components/sensor/test_sonarr.py | Python | apache-2.0 | 34,600 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from sentry.models import Event, Group, GroupTagValue, TagValue, TagKey
from sentry.runner.commands.cleanup import cleanup
from sentry.testutils import CliTestCase
ALL_MODELS = (Event, Group, GroupTagValue, TagValue, TagKey)
class SentryCleanupTest(Cli... | JackDanger/sentry | tests/sentry/runner/commands/test_cleanup.py | Python | bsd-3-clause | 1,102 |
# Version 5
'''This takes a base MineCraft level and adds or edits trees.
Place it in the folder where the save files are (usually .../.minecraft/saves)
Requires mcInterface.py in the same folder.'''
# Here are the variables you can edit.
# This is the name of the map to edit.
# Make a backup if you are experimenting... | DragonQuiz/MCEdit-Unified | stock-filters/Forester.py | Python | isc | 51,634 |
from django.db import connection
def make_key(key, key_prefix, version):
"""
Tenant aware function to generate a cache key.
Constructs the key used by all other methods. Prepends the tenant
`schema_name` and `key_prefix'.
"""
return '%s:%s:%s:%s' % (connection.schema_name, key_prefix, version... | bernardopires/django-tenant-schemas | tenant_schemas/cache.py | Python | mit | 510 |
import os
import re
import json
import cocos
class Project(object):
CPP = 'cpp'
LUA = 'lua'
JS = 'js'
CONFIG = '.cocos-project.json'
KEY_PROJ_TYPE = 'project_type'
KEY_HAS_NATIVE = 'has_native'
KEY_CUSTOM_STEP_SCRIPT = "custom_step_script"
CUSTOM_STEP_PRE_BUILD = "pre-build"
... | yylangchen/Sample_CPP_Cocos2dx | tools/cocos2d-console/bin/cocos_project.py | Python | mit | 18,116 |
# -*- 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, ... | alxgu/ansible | test/units/modules/network/f5/test_bigip_device_facts.py | Python | gpl-3.0 | 4,137 |
# ***************************************************************************
# * Copyright (c) 2016 Ofentse Kgoa <kgoaot@eskom.co.za> *
# * Copyright (c) 2018 Bernd Hahnebach <bernd@bimstatik.org> *
# * Based on the FemElementGeometry1D by Bernd Hahnebach *
# * ... | sanguinariojoe/FreeCAD | src/Mod/Fem/femtaskpanels/task_element_fluid1D.py | Python | lgpl-2.1 | 22,417 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
)
class YouJizzIE(InfoExtractor):
_VALID_URL = r'https?://(?:\w+\.)?youjizz\.com/videos/[^/#?]+-(?P<id>[0-9]+)\.html(?:$|[?#])'
_TEST = {
'url': 'http://www.youjizz.com/video... | nandhp/youtube-dl | youtube_dl/extractor/youjizz.py | Python | unlicense | 2,297 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | damien-dg/horizon | openstack_dashboard/test/integration_tests/regions/menus.py | Python | apache-2.0 | 8,108 |
#==========================================================================
#
# Copyright Insight Software Consortium
#
# 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... | itkvideo/ITK | Wrapping/WrapITK/Languages/Python/Tests/SmoothingRecursiveGaussianImageFilter.py | Python | apache-2.0 | 1,074 |
# -*- coding: utf-8 -*-
"""
===========================
Cross-hemisphere comparison
===========================
This example illustrates how to visualize the difference between activity in
the left and the right hemisphere. The data from the right hemisphere is
mapped to the left hemisphere, and then the difference is... | rkmaddox/mne-python | examples/visualization/xhemi.py | Python | bsd-3-clause | 1,520 |
#!/usr/bin/env python
# scapy.contrib.description = OSPF
# scapy.contrib.status = loads
"""
OSPF extension for Scapy <http://www.secdev.org/scapy>
This module provides Scapy layers for the Open Shortest Path First
routing protocol as defined in RFC 2328 and RFC 5340.
Copyright (c) 2008 Dirk Loss : mail dirk-loss ... | zverevalexei/trex-http-proxy | trex_client/external_libs/scapy-2.3.1/python3/scapy/contrib/ospf.py | Python | mit | 30,345 |
import os
import re
import sys
import subprocess
import shutil
from os.path import dirname, abspath
from pip.backwardcompat import urllib
from pip.util import rmtree
src_folder = dirname(dirname(abspath(__file__)))
def all_projects():
data = urllib.urlopen('http://pypi.python.org/simple/').read()
projects ... | integricho/heroku-buildpack-python-ffmpeg2-lame | vendor/pip-1.2.1/tests/test_all_pip.py | Python | mit | 3,610 |
"""SCons.Tool.Packaging.targz
The targz SRC packager.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 Sof... | makinacorpus/mapnik2 | scons/scons-local-1.2.0/SCons/Tool/packaging/targz.py | Python | lgpl-2.1 | 1,677 |
my_expr = 42
s = u'foo{my_e<caret>' | siosio/intellij-community | python/testData/completion/fStringLikeCompletionNotAvailableInUnicodeLiterals.py | Python | apache-2.0 | 35 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Defines custom errors and exceptions used in `astropy.samp`.
"""
import xmlrpc.client as xmlrpc
from astropy.utils.exceptions import AstropyUserWarning
__all__ = ['SAMPWarning', 'SAMPHubError', 'SAMPClientError', 'SAMPProxyError']
class SAMPWarn... | pllim/astropy | astropy/samp/errors.py | Python | bsd-3-clause | 637 |
# -*- 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 = 'j E Y'
TIME_FORMAT = 'H:i:s'
DATE... | rebost/django | django/conf/locale/pl/formats.py | Python | bsd-3-clause | 1,327 |
from yowsup.layers import YowLayer, YowLayerEvent, YowProtocolLayer
from .protocolentities import *
class YowIbProtocolLayer(YowProtocolLayer):
def __init__(self):
handleMap = {
"ib": (self.recvIb, self.sendIb),
"iq": (None, self.sendIb)
}
super(YowIbProtocolLayer, s... | felix-dumit/campusbot | yowsup2/yowsup/layers/protocol_ib/layer.py | Python | mit | 861 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os
sys.path.append(sys.path[0]+os.sep+'pygccxml-1.0.0')
import pygccxml, sys, cStringIO
# the output file
outputFile = cStringIO.StringIO()
# init the pygccxml stuff
pygccxml.declarations.scopedef_t.RECURSIVE_DEFAULT = False
pygccxml.declarations.scopedef_t.A... | daviddoria/itkHoughTransform | Wrapping/WrapITK/Languages/SwigInterface/idx.py | Python | apache-2.0 | 1,236 |
from __future__ import print_function
__author__ = "akniazev"
from datetime import date
from sys import path
from foo import bar
from collections import OrderedDict
from datetime import time
date(1, 1, 1)
time(1)
OrderedDict()
bar() | siosio/intellij-community | python/testData/optimizeImports/moduleLevelDunderWithImportFromFutureAbove.py | Python | apache-2.0 | 236 |
# Copyright 2013 Viewfinder Inc. All Rights Reserved.
"""Handlers for database administration.
MetricsHandler: main handler for detailed metrics. We don't use ajax-y tables, so there is no data handler.
"""
from tornado.escape import url_escape
__author__ = 'marc@emailscrubbed.com (Marc Berhault)'
import base64
i... | 0359xiaodong/viewfinder | backend/www/admin/metrics.py | Python | apache-2.0 | 4,540 |
from __future__ import absolute_import
__all__ = ('get_auth_header',)
def get_auth_header(client, api_key=None, secret_key=None):
header = [
('sentry_client', client),
('sentry_version', '5'),
]
if api_key:
header.append(('sentry_key', api_key))
if secret_key:
header.... | jokey2k/sentry | src/sentry/testutils/helpers/auth_header.py | Python | bsd-3-clause | 431 |
#!/usr/bin/env python
#
# Copyright 2015 clowwindy
#
# 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 ... | Ju2ender/CSharp-Exercise | shadowsocks/shadowsocks/crypto/openssl.py | Python | mit | 5,414 |
"""
Authentication module that defers to Apache and trusts
what Apache trusts.
Copyright 2008-2009, Red Hat, Inc
Michael DeHaan <mdehaan@redhat.com>
This software may be freely redistributed under the terms of the GNU
general public license.
You should have received a copy of the GNU General Public License
along wit... | rsampaio/cobbler | cobbler/modules/authn_passthru.py | Python | gpl-2.0 | 1,058 |
"""Tests for the auth store."""
import asyncio
from unittest.mock import patch
from homeassistant.auth import auth_store
async def test_loading_no_group_data_format(hass, hass_storage):
"""Test we correctly load old data without any groups."""
hass_storage[auth_store.STORAGE_KEY] = {
"version": 1,
... | Danielhiversen/home-assistant | tests/auth/test_auth_store.py | Python | apache-2.0 | 9,513 |
# vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | trustedanalytics/spark-tk | integration-tests/tests/test_arima.py | Python | apache-2.0 | 2,540 |
###############################################################################
##
## Copyright 2011 Tavendo GmbH
##
## 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
##
## ht... | frivoal/presto-testo | wpt/websockets/autobahn/oberstet-Autobahn-643d2ee/lib/python/autobahn/case/case1_2_1.py | Python | bsd-3-clause | 1,305 |
#!/usr/bin/env python
# Copyright (c) 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.
"""Unit tests for rietveld.py."""
import logging
import os
import ssl
import sys
import time
import traceback
import unittest
sys... | liaorubei/depot_tools | tests/rietveld_test.py | Python | bsd-3-clause | 15,103 |
from ceph_deploy.util import pkg_managers
def install(distro, packages):
return pkg_managers.yum(
distro.conn,
packages
)
def remove(distro, packages):
return pkg_managers.yum_remove(
distro.conn,
packages
)
| jumpstarter-io/ceph-deploy | ceph_deploy/hosts/rhel/pkg.py | Python | mit | 260 |
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# 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://opensource.org/licenses/MIT>, at your
#... | birryree/servo | python/servo/bootstrap_commands.py | Python | mpl-2.0 | 16,812 |
# -*- coding: iso-8859-5 -*-
# Ʋ³´µ¶
class DummyƲ³´µ¶(object):
def Print(self):
print ('Ʋ³´µ¶')
DummyƲ³´µ¶().Print()
| fabioz/PyDev.Debugger | tests_python/resources/_pydev_coverage_cyrillic_encoding_py3.py | Python | epl-1.0 | 135 |
"""
==============
Tool Box Widget
==============
A reimplementation of the :class:`QToolBox` widget that keeps all the tabs
in a single :class:`QScrollArea` instance and can keep multiple open tabs.
"""
from collections import namedtuple
from operator import eq, attrgetter
from PyQt4.QtGui import (
QWidget, QF... | PythonCharmers/orange3 | Orange/canvas/gui/toolbox.py | Python | gpl-3.0 | 18,272 |
import functools
import json
import os
import warnings
from modularodm import fields, Q
from modularodm.exceptions import NoResultsFound
from framework.mongo import (
ObjectId,
StoredObject,
utils as mongo_utils
)
from website import settings
def _serialize(fields, instance):
return {
field:... | haoyuchen1992/osf.io | website/project/licenses/__init__.py | Python | apache-2.0 | 3,350 |
# 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 use ... | ZhangXFeng/hadoop | src/hadoop-mapreduce1-project/src/contrib/cloud/src/py/hadoop/cloud/util.py | Python | apache-2.0 | 2,562 |
# Copyright (C) 2009 Paraguay Educa, Martin Abente
#
# 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... | samdroid-apps/sugar | extensions/cpsection/modemconfiguration/__init__.py | Python | gpl-2.0 | 885 |
#!/usr/bin/python
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
Element Software Backup Manager
"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | rosmo/ansible | lib/ansible/modules/storage/netapp/na_elementsw_backup.py | Python | gpl-3.0 | 9,175 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | andreaso/ansible | lib/ansible/modules/network/nxos/nxos_static_route.py | Python | gpl-3.0 | 10,343 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Agile Business Group sagl (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Licen... | BT-ojossen/website | website_logo/models/company.py | Python | agpl-3.0 | 1,095 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | dhalperi/beam | sdks/python/apache_beam/internal/pickler_test.py | Python | apache-2.0 | 2,947 |
#!/usr/bin/env python
# Copyright (c) 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.
"""Python API for retrieving API keys.
Note that this cannot have the exact same semantics (at the moment) as
the C++ API in googl... | plxaye/chromium | src/google_apis/google_api_keys.py | Python | apache-2.0 | 2,873 |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | gilt/incubator-airflow | airflow/migrations/versions/947454bf1dff_add_ti_job_id_index.py | Python | apache-2.0 | 1,041 |
import os
import sys
from setuptools import setup, Extension, Feature
from distutils.command.build_ext import build_ext
from distutils.errors import CCompilerError, DistutilsExecError, \
DistutilsPlatformError
# fail safe compilation shamelessly stolen from the simplejson
# setup.py file. Original author: Bob Ip... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/markupsafe-0.15/setup.py | Python | bsd-3-clause | 3,627 |
from bokeh.core.enums import enumeration
NamedIcon = enumeration(*[
"adjust", "adn", "align-center", "align-justify", "align-left", "align-right", "ambulance",
"anchor", "android", "angellist", "angle-double-down", "angle-double-left", "angle-double-right",
"angle-double-up", "angle-down", "angle-left", "a... | timsnyder/bokeh | examples/custom/font-awesome/named_icon.py | Python | bsd-3-clause | 7,263 |