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 __future__ import absolute_import
from six.moves.urllib.parse import urlencode
from sentry.models import GroupHash
from sentry.testutils import APITestCase
class GroupHashesTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
group = self.create_group()
GroupHash... | ifduyue/sentry | tests/sentry/api/endpoints/test_group_hashes.py | Python | bsd-3-clause | 1,432 |
from pandac.PandaModules import *
from otp.otpbase.OTPGlobals import *
from direct.gui.DirectGui import *
from MultiPageTextFrame import *
from direct.directnotify import DirectNotifyGlobal
from otp.otpbase import OTPLocalizer
from otp.otpgui import OTPDialog
class PrivacyPolicyTextPanel(getGlobalDialogClass()):
n... | ksmit799/Toontown-Source | otp/login/PrivacyPolicyPanel.py | Python | mit | 5,598 |
# coding: utf-8
# pylint: disable=missing-docstring, invalid-name
import flask
import auth
import config
import model
from main import app
yahoo_config = dict(
access_token_url='https://api.login.yahoo.com/oauth/v2/get_token',
authorize_url='https://api.login.yahoo.com/oauth/v2/request_auth',
base_url=... | sidharta/hansel-app | main/auth/yahoo.py | Python | mit | 2,275 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2014 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) a... | tsgit/invenio | modules/miscutil/lib/upgrades/invenio_2014_06_10_new_field_address.py | Python | gpl-2.0 | 2,257 |
'''
facebook urlresolver plugin
Copyright (C) 2013 icharania
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is d... | dejay313/dojostreams | script.module.urlresolver/lib/urlresolver/plugins/facebook.py | Python | gpl-2.0 | 2,383 |
#!/usr/bin/env python
#
# Copyright 2015 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.
'''Prepares the Google Play services split client libraries before usage by
Chrome's build system.
We need to preprocess Google Play... | geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/build/android/play_services/preprocess.py | Python | gpl-3.0 | 9,974 |
# -*- coding: utf-8 -*-
class RomanianHelper(object):
@staticmethod
def englishize_romanian(string):
symbols = (u"țţȚŢșşȘŞăǎĂîÎâÂ",
u"ttTTssSSaaAiIaA")
tr = {ord(a):ord(b) for a, b in zip(*symbols)}
return string.translate(tr)
@staticmethod
def beautify_rom... | costibleotu/czl-scrape | sanatate/scrapy_proj/helpers/romanian.py | Python | mpl-2.0 | 509 |
# -*- coding: utf-8 -*-
from contextlib import closing
from functools import wraps
import logging
import os
import shutil
import threading
import traceback
import tempfile
import zipfile
import psycopg2
import openerp
from openerp import SUPERUSER_ID
from openerp.exceptions import Warning
import openerp.release
impor... | pedrobaeza/odoo | openerp/service/db.py | Python | agpl-3.0 | 15,507 |
# -*- coding: utf-8 -*-
#
#
# Author: Guewen Baconnier
# Copyright 2010-2012 Camptocamp SA
# Copyright (C) 2011 Akretion Sébastien BEAU <sebastien.beau@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
#... | Therp/stock-logistics-warehouse | __unported__/stock_available_immediately/__openerp__.py | Python | agpl-3.0 | 1,363 |
"""co2_emission column added
Revision ID: 2d86200bcb93
Revises: 82749d34a18
Create Date: 2014-12-30 17:23:39.654559
"""
# revision identifiers, used by Alembic.
revision = '2d86200bcb93'
down_revision = '82749d34a18'
from alembic import op
import sqlalchemy as sa
import geoalchemy2 as ga
def upgrade():
op.add... | pbougue/navitia | source/sql/alembic/versions/2d86200bcb93_co2_emission_column_added.py | Python | agpl-3.0 | 558 |
"""
Middleware for dark-launching languages. These languages won't be used
when determining which translation to give a user based on their browser
header, but can be selected by setting the Preview Languages on the Dark
Language setting page.
This middleware must be placed before the LocaleMiddleware, but after
the S... | stvstnfrd/edx-platform | openedx/core/djangoapps/dark_lang/middleware.py | Python | agpl-3.0 | 5,890 |
from PyQt4 import QtCore, QtGui
import vtrace.qt
import vdb.qt.base
from vqt.main import *
class VdbRegistersWindow(vdb.qt.base.VdbWidgetWindow):
def __init__(self, db, dbt, parent=None):
vdb.qt.base.VdbWidgetWindow.__init__(self, db, dbt, parent=parent)
self.regsWidget = vtrace.qt.RegistersView... | joshuahoman/vivisect | vdb/qt/registers.py | Python | apache-2.0 | 753 |
import unittest
import textwrap
import antlr3
import antlr3.tree
import testbase
import sys
from io import StringIO
class T(testbase.ANTLRTest):
def setUp(self):
self.oldPath = sys.path[:]
sys.path.insert(0, self.baseDir)
def tearDown(self):
sys.path = self.oldPath
def testOver... | ekcs/congress | thirdparty/antlr3-antlr-3.5/runtime/Python3/tests/t054main.py | Python | apache-2.0 | 7,739 |
# -*- coding: utf-8 -*-
###############################################################################
#
# UpdateBike
# Updates an existing bike action.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file exc... | jordanemedlock/psychtruths | temboo/core/Library/Facebook/Actions/Fitness/Bikes/UpdateBike.py | Python | apache-2.0 | 4,899 |
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | datacommonsorg/data | scripts/eurostat/regional_statistics_by_nuts/population_density/csv_template_mcf_compatibility_checker.py | Python | apache-2.0 | 976 |
# -*- coding: utf-8 -*-
#
# 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
#... | artwr/airflow | airflow/hooks/base_hook.py | Python | apache-2.0 | 3,203 |
# Copyright 2013 Rackspace Hosting
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | hanlind/nova | nova/tests/unit/api/openstack/compute/test_instance_actions.py | Python | apache-2.0 | 9,409 |
"""Tests for the Awair sensor platform."""
from unittest.mock import patch
from homeassistant.components.awair.const import (
API_CO2,
API_HUMID,
API_LUX,
API_PM10,
API_PM25,
API_SCORE,
API_SPL_A,
API_TEMP,
API_VOC,
ATTR_UNIQUE_ID,
DOMAIN,
SENSOR_TYPES,
)
from homeassist... | sander76/home-assistant | tests/components/awair/test_sensor.py | Python | apache-2.0 | 9,940 |
# Copyright 2019 Capital One Services, LLC
#
# 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... | FireballDWF/cloud-custodian | tools/sandbox/c7n_autodoc/c7n-autodoc.py | Python | apache-2.0 | 6,289 |
# Python action which uses the same module name as built-in Python module
# (test)
from st2common.runners.base_action import Action
class TestAction(Action):
def run(self):
return 'test action'
| punalpatel/st2 | st2tests/st2tests/resources/packs/pythonactions/actions/test.py | Python | apache-2.0 | 209 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Case.priority'
db.add_column('library_case', 'priority',
self.gf('djan... | peterbe/moztrap | moztrap/model/library/migrations/0008_auto__add_field_case_priority.py | Python | bsd-2-clause | 25,572 |
#! /usr/bin/env python
from __future__ import division, absolute_import, print_function
# System imports
from distutils.util import get_platform
from math import sqrt
import os
import sys
import unittest
# Import NumPy
import numpy as np
major, minor = [ int(d) for d in np.__version__.split(".")[:2] ]
i... | ahaldane/numpy | tools/swig/test/testTensor.py | Python | bsd-3-clause | 16,439 |
# Copyright (c) 2017 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
Four Panel Map
===============
By reading model output data from a netCDF file, we can create a four panel plot showing:
* 300 hPa heights and winds
* 500 hPa heights and absol... | metpy/MetPy | v0.9/_downloads/8de42c0f44fb2568ca140f44d6554022/Four_Panel_Map.py | Python | bsd-3-clause | 4,683 |
"""
Example that sends a single message and exits using the simple interface.
You can use `simple_receive.py` (or `complete_receive.py`) to receive the
message sent.
"""
from __future__ import absolute_import, unicode_literals
from kombu import Connection
#: Create connection
#: If hostname, userid, password and v... | urbn/kombu | examples/simple_send.py | Python | bsd-3-clause | 1,022 |
'''
Build a simple neural machine translation model
'''
import theano
import theano.tensor as tensor
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
import cPickle as pkl
import numpy
import copy
import os
import warnings
import sys
import time
from scipy import optimize, stats
from collections... | skaasj/dl4mt-material | session2/nmt.py | Python | bsd-3-clause | 39,416 |
'''
PiCamera Camera: Implement CameraBase with PiCamera
'''
#
# TODO: make usage of thread or multiprocess
#
__all__ = ('CameraPiCamera', )
from math import ceil
from kivy.logger import Logger
from kivy.clock import Clock
from kivy.graphics.texture import Texture
from kivy.core.camera import CameraBase
from picame... | LogicalDash/kivy | kivy/core/camera/camera_picamera.py | Python | mit | 2,837 |
class Ring(object):
def start(self, xpos, ypos):
self.x = xpos # x-coordinate
self.y = ypos # y-coordinate
self.diameter = 1 # Diameter of the ring
self.on = False # Turns the display on and off
self.on = True
def grow(self):
if self.on:
self.dia... | kantel/processingpy | sketches/modes/PythonMode/examples/Basics/Objects/CompositeObjects/ring.py | Python | mit | 600 |
#!/usr/bin/python
import h5py
import matplotlib.pylab as plt
import sys
# Go over each feioutput and plot each one.
thefile = "Frictional_SDOF_freeVibration.h5.feioutput";
finput = h5py.File(thefile)
# Read the time and displacement
times = finput["time"][:]
disp = finput["/Model/Nodes/Generalized_Displacements"][2... | BorisJeremic/Real-ESSI-Examples | education_examples/_Chapter_Modeling_and_Simulation_Examples_Dynamic_Examples/Friction_SDOF_Oscillator_SoftContact_Nonlinear_Hardening_Softening_Shear_Model/plot.py | Python | cc0-1.0 | 812 |
import os
import warnings
import cherrypy
class Checker(object):
"""A checker for CherryPy sites and their mounted applications.
on: set this to False to turn off the checker completely.
When this object is called at engine startup, it executes each
of its own methods whose names start with... | CeltonMcGrath/TACTIC | 3rd_party/CherryPy/cherrypy/_cpchecker.py | Python | epl-1.0 | 14,288 |
#
# Copyright 2014 Red Hat, Inc
#
# Author: Chris Dent <chdent@redhat.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 requi... | ChinaMassClouds/copenstack-server | openstack/src/ceilometer-2014.2.2/ceilometer/tests/ipmi/notifications/ipmi_test_data.py | Python | gpl-2.0 | 30,224 |
# coding=UTF-8
# Author: Dennis Lutter <lad1337@gmail.com>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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 vers... | Maximilian-Reuter/SickRage-1 | tests/pp_tests.py | Python | gpl-3.0 | 6,013 |
#
# 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... | nwokeo/supysonic | venv/lib/python2.7/site-packages/storm/zope/metaconfigure.py | Python | agpl-3.0 | 1,225 |
"""Handle processing and setting web content into Readability/cleaned
"""
import httplib
import logging
import lxml
import socket
import urllib2
from BaseHTTPServer import BaseHTTPRequestHandler as HTTPH
from breadability.readable import Article
from urlparse import urlparse
LOG = logging.getLogger(__name__)
class... | GreenLunar/Bookie | bookie/lib/readable.py | Python | agpl-3.0 | 6,558 |
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
# pylint: disable=redefined-builtin,wrong-import-position,wildcard-import,useless-suppression,line-too-long
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('student.management', 'common.djangoapps.student.ma... | eduNEXT/edunext-platform | import_shims/studio/student/management/__init__.py | Python | agpl-3.0 | 383 |
# -*- 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 __future__ import unicode_literals, with_statement
from django.core.ex... | arth-co/shoop | shoop/front/views/payment.py | Python | agpl-3.0 | 2,387 |
import numpy as np
class PointBrowser:
"""
Click on a point to select and highlight it -- the data that
generated the point will be shown in the lower axes. Use the 'n'
and 'p' keys to browse through the next and previous points
"""
def __init__(self):
self.lastind = 0
self.t... | cactusbin/nyt | matplotlib/examples/event_handling/data_browser.py | Python | unlicense | 2,233 |
"""
Demo of the errorbar function.
"""
import numpy as np
import matplotlib.pyplot as plt
# example data
x = np.arange(0.1, 4, 0.5)
y = np.exp(-x)
plt.errorbar(x, y, xerr=0.2, yerr=0.4)
plt.show()
| cactusbin/nyt | matplotlib/examples/statistics/errorbar_demo.py | Python | unlicense | 200 |
"""Denon HEOS Media Player."""
import asyncio
from datetime import timedelta
import logging
from typing import Dict
from pyheos import Heos, HeosError, const as heos_const
import voluptuous as vol
from homeassistant.components.media_player.const import DOMAIN as MEDIA_PLAYER_DOMAIN
from homeassistant.config_entries i... | leppa/home-assistant | homeassistant/components/heos/__init__.py | Python | apache-2.0 | 12,267 |
#!/usr/bin/python
# Copyright 2003 Dave Abrahams
# Copyright 2006 Rene Rivera
# Copyright 2003 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# Demonstration that module variables have the ... | flingone/frameworks_base_cmds_remoted | libs/boost/tools/build/test/module_actions.py | Python | apache-2.0 | 2,354 |
"""Tests for Modalities."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from layers import common_hparams
from layers import modalities
class ModalityTest(tf.test.TestCase):
def testSymbolModalityInputs(s... | mlperf/training_results_v0.6 | Google/benchmarks/transformer/implementations/tpu-v3-512-transformer/transformer/layers/modalities_test.py | Python | apache-2.0 | 1,941 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | sparkslabs/kamaelia_ | Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/Apps/IRCLogger/Support.py | Python | apache-2.0 | 7,622 |
# Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 Nebula, Inc.
# Copyright 2013 Alessio Ababilov
# Copyright 2013 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
# ... | metacloud/python-keystoneclient | keystoneclient/apiclient/exceptions.py | Python | apache-2.0 | 1,124 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ver... | sparkslabs/kamaelia_ | Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/Support/Data/tests/test_Escape.py | Python | apache-2.0 | 7,515 |
from bottle import Bottle, route, run, template, static_file, get, jinja2_template as template, post, request, response, redirect
import json
import requests
import runtime
import actions
"""
DisplayEvent
"""
defaultInputParams = {}
defaultOutputParams = {}
sim_parameters = dict()
# Register actions
def registerAct... | cloderic/SmartAlarmClock | src/actions/DisplayEvent.py | Python | bsd-3-clause | 1,317 |
from rest_framework import exceptions
from rest_framework import permissions
from rest_framework import serializers
import rest_framework.response
import rest_framework.views
from fjord.alerts.models import Alert, AlertFlavor, AlertSerializer, Link
from fjord.api_auth.api_utils import TokenAuthentication
from fjord.ba... | staranjeet/fjord | fjord/alerts/api_views.py | Python | bsd-3-clause | 6,843 |
import logging
from autotest.client import utils
from autotest.client.shared import error
from virttest import env_process, utils_test
@error.context_aware
def run(test, params, env):
"""
Vhost zero copy test
1) Enable/Disable vhost_net zero copy in host
1) Boot the main vm.
3) Run the ping test, ... | ehabkost/tp-qemu | qemu/tests/zero_copy.py | Python | gpl-2.0 | 2,659 |
#!/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... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/desktop/libs/indexer/src/indexer/api.py | Python | gpl-2.0 | 9,276 |
# A plugin for yum which notifies yum-updatesd to refresh its data
#
# Written by James Bowes <jbowes@redhat.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 Licens... | Distrotech/yum-utils | plugins/refresh-updatesd/refresh-updatesd.py | Python | gpl-2.0 | 1,858 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = [Extension("_orange", ["_orange.pyx"],
include_dirs=[np.get_include()]
)]... | PythonCharmers/orange3 | Orange/src/setup.py | Python | gpl-3.0 | 324 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import project_create_sale_order
from . import project_create_invoice
from . import sale_make_invoice_advance
from . import project_task_create_sale_order
| ygol/odoo | addons/sale_timesheet/wizard/__init__.py | Python | agpl-3.0 | 262 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from libavg import avg, player
canvas = player.createMainCanvas(size=(160,120))
rootNode = canvas.getRootNode()
avg.ImageNode(pos=(80,30), size=(40,30), href="rgb24-64x64.png", angle=1.570, pivot=(0,0),
parent=rootNode)
player.play()
| lynxis/libavg | src/samples/rotcustompivot.py | Python | lgpl-2.1 | 291 |
'''OpenGL extension SGIX.flush_raster
This module customises the behaviour of the
OpenGL.raw.GL.SGIX.flush_raster to provide a more
Python-friendly API
Overview (from the spec)
This extensions provides a way to ensure that all raster operations
currently in the pipeline will be completed before the next
rast... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/GL/SGIX/flush_raster.py | Python | lgpl-3.0 | 1,414 |
{
'name' : 'Signature templates for user emails',
'version' : '1.0.0',
'author' : 'IT-Projects LLC, Ivan Yelizariev',
'license': 'GPL-3',
'category' : 'Social Network',
'website' : 'https://yelizariev.github.io',
'depends' : ['base'],
'data':[
'res_users_signature_views.xml',
... | Antiun/yelizariev-addons | res_users_signature/__openerp__.py | Python | lgpl-3.0 | 443 |
# Copyright 2012 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 ... | atljohnsen/adlcoursebuilder | modules/review/stats.py | Python | apache-2.0 | 5,775 |
#from pydec.testing import *
#
#import numpy
#from scipy.sparse import coo_matrix, csr_matrix
#
#from pydec.math.graph import maximal_independent_set
#
#
#class test_maximal_independent_set(TestCase):
# def is_MIS(self,graph,mis):
# mis = set(mis)
# unmarked = set(range(graph.shape[0]))
# graph ... | pkuwwt/pydec | pydec/math/tests/test_graph.py | Python | bsd-3-clause | 2,078 |
"""
Module containing single call export functions.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this s... | WillisXChen/django-oscar | oscar/lib/python2.7/site-packages/IPython/nbconvert/exporters/export.py | Python | bsd-3-clause | 5,674 |
# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# All rights reserved.
#
# 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 withou... | lochiiconnectivity/boto | tests/integration/dynamodb2/test_cert_verification.py | Python | mit | 1,511 |
# coding: utf-8
"""
>>> from pyun import *
>>> yun = YunBridge('192.168.2.9')
>>> yun.pinMode(13, INPUT)
'input'
>>> yun.digitalRead(13)
0
>>> yun.digitalWrite(13, 1)
1
>>> yun.digitalWrite(13, 0)
0
>>> 0 <= yun.analogRead(5) < 1024
True
"""
import doctest
doctest.te... | oturing/pyun | pyun_tests.py | Python | mit | 373 |
"""
Support for Google Play Music Desktop Player.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.gpmdp/
"""
import logging
import json
import os
import socket
import time
import voluptuous as vol
from homeassistant.components.media_player ... | xifle/home-assistant | homeassistant/components/media_player/gpmdp.py | Python | mit | 12,337 |
from base import *
TYPE = "example/ejemplo"
EXTENSION = "mime_test_1"
MIME_TYPES = """
mime!application/java-archive!extensions = jar
mime!application/java-serialized-object!extensions = ser
mime!application/java-vm!extensions = class
mime!%s!extensions = %s
mime!x-world/x-vrml!extensions = vrm vrml wrl
""" % ... | chetan/cherokee | qa/137-Mime1.py | Python | gpl-2.0 | 797 |
#!/usr/bin/env python
{
# "singular form (0)": ["first plural form (1)", "second plural form (2)", ...],
'выбрана': ['выбраны', 'выбрано'],
'запись': ['записи', 'записей'],
'изменена': ['изменены', 'изменено'],
'строка': ['строки', 'строк'],
'удалена': ['удалены', 'удалено'],
'день': ['дня',... | UB-Heidelberg/UBHD-OMPArthistorikum | languages/plural-ru.py | Python | gpl-3.0 | 743 |
# -*- 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
from nose.plugins.skip i... | trondhindenes/ansible | test/units/modules/network/f5/test_bigip_profile_oneconnect.py | Python | gpl-3.0 | 3,947 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
#
# 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
#
# Unle... | dsiddharth/access-keys | keystone/contrib/oauth1/__init__.py | Python | apache-2.0 | 690 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | sjperkins/tensorflow | tensorflow/contrib/keras/python/keras/engine/training.py | Python | apache-2.0 | 81,895 |
#
# Copyright 2015 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 or agreed to in writing... | catapult-project/catapult | third_party/gsutil/third_party/apitools/samples/storage_sample/uploads_test.py | Python | bsd-3-clause | 6,523 |
"""
Forms and validation code for user registration.
"""
from django.contrib.auth.models import User
from django import forms
from django.utils.translation import ugettext_lazy as _
# I put this on all required fields, because it's easier to pick up
# on them with CSS or JavaScript if they have a class of "require... | ogirardot/django-registration | registration/forms.py | Python | bsd-3-clause | 4,861 |
import pytest
from tests.plugins.constants import default_upload
from tests.plugins.upload_to_s3 import upload_file_to_s3_by_job_id
pytest_plugins = (
"tests.examples.examples_report_plugin",
"tests.integration.integration_tests_plugin",
"tests.plugins.bokeh_server",
"tests.plugins.jupyter_notebook",
... | phobson/bokeh | tests/conftest.py | Python | bsd-3-clause | 1,448 |
"""The tests for the logbook component."""
# pylint: disable=protected-access
from datetime import timedelta
import unittest
from unittest.mock import patch
from homeassistant.components import sun
import homeassistant.core as ha
from homeassistant.const import (
EVENT_STATE_CHANGED, EVENT_HOMEASSISTANT_START, EVE... | xifle/home-assistant | tests/components/test_logbook.py | Python | mit | 21,113 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
BASH_ATTRIBUTES = {"regular": "0",
"bold": "1", "underline": "4", "strike": "9",
"light": "1", "dark": "2",
"invert": "7"} # invert bg and fg
BASH_COLORS = {"black": "30", "red": "31", "green": "32", "yel... | Ye-Yong-Chi/xortool | xortool/libcolors.py | Python | mit | 2,323 |
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
import re
import csv
import sys
from collections import defaultdict
try:
import vim
except ImportError:
vim = object()
from powerline.bindings.vim import (vim_get_func, getbufvar, vim_getbu... | zeroc0d3/docker-lab | vim/rootfs/usr/lib/python2.7/dist-packages/powerline/segments/vim/__init__.py | Python | mit | 24,099 |
import unittest
from turn_ticket import TicketDispenser
class TicketDispenserTest(unittest.TestCase):
def test_do_something(self):
dispenser = TicketDispenser()
ticket = dispenser.getTurnTicket()
if __name__ == "__main__":
unittest.main() | plipp/Python-Coding-Dojos | katas/2X-Racing-Car-Katas/TurnTicketDispenser/test_turn_ticket.py | Python | mit | 264 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""A stupid message compiler for C++."""
import os.path
import re
import struct
def truncateLong(x):
"""Returns the uint32 part of a long x."""
assert x > 0
unsigned_bytes = struct.pack("<Q", x)
return struct.unpack("<I", unsigned_bytes[:4])[0]
def reinterp... | apavlo/h-store | src/dtxn/stupidcompiler.py | Python | gpl-3.0 | 20,928 |
# flake8: noqa (not ideal, but nicer than adding noqa: F401 to every line!)
from base import (executor_kwargs,
testharness_result_converter,
reftest_result_converter,
TestExecutor)
| danlrobertson/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/__init__.py | Python | mpl-2.0 | 235 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
def _default_visible_expense_policy(self):
visibility = self.user_has_groups('hr_expense.group_hr_expense... | ddico/odoo | addons/sale_expense/models/product_template.py | Python | agpl-3.0 | 1,032 |
# Copyright 2019 The gRPC 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 agreed to in writ... | ctiller/grpc | src/python/grpcio_tests/tests_aio/interop/server.py | Python | apache-2.0 | 1,611 |
# 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 writing, so... | miarmak/CloudFerry | cloudferrylib/scheduler/namespace.py | Python | apache-2.0 | 936 |
# 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.
"""Generates Dart source files from a mojom.Module."""
import mojom.generate.generator as generator
import mojom.generate.module as mojom
import mojom.gener... | mohamed--abdel-maksoud/chromium.src | mojo/public/tools/bindings/generators/mojom_dart_generator.py | Python | bsd-3-clause | 11,104 |
# Copyright (c) 2009-2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 wit... | matthappens/taskqueue | taskqueue/venv_tq/lib/python2.7/site-packages/boto/ec2/blockdevicemapping.py | Python | mit | 5,727 |
#!/usr/bin/python
'''
The MIT License (MIT)
Copyright (c) 2013-2015 SRS(simple-rtmp-server)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the r... | drunknbass/srs | trunk/research/code-statistic/cs.py | Python | mit | 3,920 |
# encoding: utf-8
"""Tests of Branding API """
from __future__ import unicode_literals
from django.test import TestCase
import mock
from branding.api import get_logo_url, get_footer
from django.test.utils import override_settings
class TestHeader(TestCase):
"""Test API end-point for retrieving the header. """
... | synergeticsedx/deployment-wipro | lms/djangoapps/branding/tests/test_api.py | Python | agpl-3.0 | 4,864 |
"""Config flow for AWS component."""
from homeassistant import config_entries
from .const import DOMAIN
class AWSFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle a config flow."""
VERSION = 1
async def async_step_import(self, user_input):
"""Import a config entry."""
if... | jawilson/home-assistant | homeassistant/components/aws/config_flow.py | Python | apache-2.0 | 507 |
#!/usr/bin/python
import sys
assert len(sys.argv) > 2
with open(sys.argv[1], "w") as out:
for l in sys.argv[2:]:
out.write("# %s\n" % l)
| facebook/buck | test/com/facebook/buck/android/testdata/android_project/native/proguard_gen/generator.py | Python | apache-2.0 | 151 |
#
# 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... | wangmiao1981/spark | python/pyspark/sql/pandas/map_ops.py | Python | apache-2.0 | 3,806 |
# 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... | eadgarchen/tensorflow | tensorflow/python/keras/_impl/keras/layers/merge_test.py | Python | apache-2.0 | 8,416 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
import itertools
import json
from telemetry.internal.results import output_formatter
from telemetry.value import summary as summary_modul... | js0701/chromium-crosswalk | tools/telemetry/telemetry/internal/results/chart_json_output_formatter.py | Python | bsd-3-clause | 3,098 |
sql = [
#-- Make the node_change table contain more information, and force a resync
"""DROP TABLE revision;""",
"""DROP TABLE node_change;""",
"""CREATE TABLE revision (
rev text PRIMARY KEY,
time integer,
author text,
message text
);""",
"""CREATE TABLE node_chan... | dokipen/trac | trac/upgrades/db10.py | Python | bsd-3-clause | 697 |
#################################### IMPORTS ###################################
from __future__ import generators
if __name__ == '__main__':
import sys
import os
pkg_dir = os.path.split(os.path.abspath(__file__))[0]
parent_dir, pkg_name = os.path.split(pkg_dir)
is_pygame_pkg = (pkg_name == 'tests... | gmittal/aar-nlp-research-2016 | src/pygame-pygame-6625feb3fc7f/test/_vlcmovietest.py | Python | mit | 4,005 |
from ..Qt import QtCore, QtGui, QtOpenGL, USE_PYQT5
from OpenGL.GL import *
import OpenGL.GL.framebufferobjects as glfbo
import numpy as np
from .. import Vector
from .. import functions as fn
##Vector = QtGui.QVector3D
ShareWidget = None
class GLViewWidget(QtOpenGL.QGLWidget):
"""
Basic widget for displayin... | onlyjus/pyqtgraph | pyqtgraph/opengl/GLViewWidget.py | Python | mit | 18,189 |
from layer import *
class TanhLayer(Layer):
def __init__(self, *args, **kwargs):
super(TanhLayer, self).__init__(*args, **kwargs)
@classmethod
def IsLayerType(cls, proto):
return proto.hyperparams.activation == deepnet_pb2.Hyperparams.TANH
def ApplyActivation(self):
cm.tanh(self.state)
def Sam... | 7404N/deepnet | deepnet/tanh_layer.py | Python | bsd-3-clause | 1,606 |
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from mojom_parser_test_case import MojomParserTestCase
class EnumTest(MojomParserTestCase):
"""Tests enum parsing behavior."""
def testExplicitValues(... | scheib/chromium | mojo/public/tools/mojom/enum_unittest.py | Python | bsd-3-clause | 4,363 |
from helpers.manipulator_base import ManipulatorBase
class InsightManipulator(ManipulatorBase):
"""
Handle Insight database writes.
"""
@classmethod
def updateMerge(self, new_insight, old_insight, auto_union=True):
"""
Given an "old" and a "new" Insight object, replace the fields ... | the-blue-alliance/the-blue-alliance | old_py2/helpers/insight_manipulator.py | Python | mit | 1,096 |
#!/usr/bin/python
import unittest
import os
import sys
# simple magic for using scripts within a source tree
basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if os.path.isdir(os.path.join(basedir, 'virttest')):
sys.path.append(basedir)
from virttest import utils_params
BASE_DICT = {
'im... | spcui/avocado-vt | selftests/unit/test_utils_params.py | Python | gpl-2.0 | 3,700 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | SiderZhang/p2pns3 | src/propagation/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 180,584 |
from buildbot.status import build
from buildbot.status import builder
from buildbot.status import buildrequest
from buildbot.status import buildset
from buildbot.status import master
# styles.Versioned requires this, as it keys the version numbers on the fully
# qualified class name; see master/buildbot/test/regressio... | anish/buildbot | master/buildbot/status/__init__.py | Python | gpl-2.0 | 714 |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
def search_obj_in_list(item, lst, key):
for o in lst:
if o[key] == item:
return o
return None
| roadmapper/ansible | lib/ansible/module_utils/network/exos/utils/utils.py | Python | gpl-3.0 | 210 |
"""
Extrude is a script to display and extrude a gcode file.
It controls the extruder and movement. It can read linear and helical move commands. It saves a log file with the suffix _log.
To run extrude, install python 2.x on your machine, which is avaliable from http://www.python.org/download/
Then in the folder w... | dob71/x2swn | skeinforge/fabmetheus_utilities/miscellaneous/fabricate/extrude.py | Python | gpl-3.0 | 14,234 |
#!/usr/bin/python
#
# Copyright 2016 Red Hat | Ansible
#
# 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 la... | sonaht/ansible | lib/ansible/modules/cloud/docker/docker_image.py | Python | gpl-3.0 | 21,946 |
#!/usr/bin/env python
########################################################################
# $HeadURL$
# File : dirac-admin-get-site-mask
# Author : Stuart Paterson
########################################################################
__RCSID__ = "$Id$"
from DIRAC.Core.Base import Script
Script.setUsageMe... | Sbalbp/DIRAC | Interfaces/scripts/dirac-admin-get-site-mask.py | Python | gpl-3.0 | 781 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import json
from odoo import tests
from odoo.tools import mute_logger
@tests.tagged('post_install', '-at_install')
class TestControllers(tests.HttpCase):
@mute_logger('odoo.addons.http_routing.models.ir_http', 'o... | jeremiahyan/odoo | addons/website/tests/test_controllers.py | Python | gpl-3.0 | 1,810 |
import turtle
class C(turtle.TurtleScreenBase):
pass | siosio/intellij-community | python/testData/override/qualified.py | Python | apache-2.0 | 57 |