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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from odoo import api
from odoo.addons.mail.tests.common import TestMail
class TestTracking(TestMail):
def test_message_track(self):
""" Testing auto tracking of fields. Warning, it has not be cleaned and
should probably be. """
Subtype = self.env['mail.message.sub... | ayepezv/GAD_ERP | addons/mail/tests/test_message_track.py | Python | gpl-3.0 | 6,334 |
import rules
from core.subscription.models import Organisation
@rules.predicate
def can_manage_an_organisation(user):
return is_organisation_member(user)
@rules.predicate
def is_organisation_member(user, organisation=None):
if organisation is None:
return bool(Organisation.objects.filter(members=us... | erudit/zenon | eruditorg/core/subscription/predicates.py | Python | gpl-3.0 | 412 |
#!/usr/bin/env python3
"""
Read BAM file and split each line into columns.
"""
import argparse
import os
import re
import sys
def main():
parser = argparse.ArgumentParser( description='Groups transcripts by mapped read pairs')
parser.add_argument('-i', '--input_sam_file', type=str, required=False, help='... | jonathancrabtree/biocode | sandbox/jcrabtree/group_rnaseq_transcripts_by_read_alignment/3-timing-tests/read_and_split_only.py | Python | gpl-3.0 | 985 |
# framework/templates.py
#
# Copyright 2011 Spencer J. McIntyre <SMcIntyre [at] SecureState [dot] net>
#
# 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
... | manueldelreal/termineter | framework/templates.py | Python | gpl-3.0 | 2,380 |
# coding=utf-8
# Author: miigotu <miigotu@gmail.com>
# URL: http://github.com/SiCKRAGETV/SickRage
#
# 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 version ... | srluge/SickRage | sickbeard/providers/bitcannon.py | Python | gpl-3.0 | 4,265 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, 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... | naslanidis/ansible | lib/ansible/modules/files/copy.py | Python | gpl-3.0 | 14,506 |
# Blender rock creation tool
#
# Based on BlenderGuru's asteroid tutorial and personal experimentation.
# Tutorial: http://www.blenderguru.com/how-to-make-a-realistic-asteroid/
# Update with another tutorial shared by "rusted" of BlenderArtists:
# Tutorial: http://saschahenrichs.blogspot.com/2010/03/3dsmax-environm... | Passtechsoft/TPEAlpGen | blender/release/scripts/addons_contrib/add_mesh_rocks/rockgen.py | Python | gpl-3.0 | 69,120 |
../../../../../../../share/pyshared/ubuntuone-client/ubuntuone/platform/linux/messaging.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/ubuntuone-client/ubuntuone/platform/linux/messaging.py | Python | gpl-3.0 | 90 |
# Copyright (C) 2011 Equinor ASA, Norway.
#
# The file 'lookup_table.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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... | Statoil/libecl | python/ecl/util/util/lookup_table.py | Python | gpl-3.0 | 4,010 |
# -*- coding: utf-8 -*-
# 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 require... | harshilasu/LinkurApp | y/google-cloud-sdk/platform/gsutil/gslib/addlhelp/metadata.py | Python | gpl-3.0 | 8,672 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-05 16:45
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('core', '0001_initial'),
]
opera... | LEDS/sipac | sipac/agricultura/migrations/0001_initial.py | Python | gpl-3.0 | 1,901 |
with open('myfile.txt', "w") as myFile:
for a in ["a", "b", "c"]:
myFile.write(str(a))
for a in [1,2,3,4,5,"6"]:
myFile.write(str(a))
try:
myFile.write("ERRRRR")
except:
print("Error, what are you trying to do with closed file")
| mayankjohri/LetsExplorePython | Section 1 - Core Python/Chapter 11 - Exceptions/code/read_file_proper.py | Python | gpl-3.0 | 263 |
import re
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, validate
from livestreamer.stream import RTMPStream
SWF_URL = "http://www.gaminglive.tv/lib/flowplayer/flash/flowplayer.commercial-3.2.18.swf"
CHANNELS_API_URL = "http://api.gaminglive.tv/channels/{0}"
QUALITY_WEIGHTS = {
"... | noam09/kodi | script.module.israeliveresolver/lib/livestreamer/plugins/gaminglive.py | Python | gpl-3.0 | 2,068 |
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Canonical
#
# Authors:
# Tin Tvrtković
# Jared Ravetch
#
# 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; version 3.
#
# This program is distributed... | Tankypon/ubuntu-make | umake/frameworks/rust.py | Python | gpl-3.0 | 5,879 |
# -*- coding: utf-8 -*-
import re
import time
from module.plugins.internal.Account import Account
from module.plugins.internal.Plugin import set_cookie
class TurbobitNet(Account):
__name__ = "TurbobitNet"
__type__ = "account"
__version__ = "0.07"
__status__ = "testing"
__description__ = ... | jansohn/pyload | module/plugins/accounts/TurbobitNet.py | Python | gpl-3.0 | 1,317 |
from .oauth import BaseOAuth1
class WithingsOAuth(BaseOAuth1):
name = 'withings'
AUTHORIZATION_URL = 'https://developer.health.nokia.com/account/authorize'
REQUEST_TOKEN_URL = 'https://developer.health.nokia.com/account/request_token'
ACCESS_TOKEN_URL = 'https://developer.health.nokia.com/account/acce... | abhikumar22/MYBLOG | blg/Lib/site-packages/social_core/backends/withings.py | Python | gpl-3.0 | 542 |
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
'View board'
import xml.dom.minidom
from parser import ParserBoard
from tryton.gui.window.view_board.action import Action
class ViewBoard(object):
'View board'
def __... | mediafactory/tryton_client_desktop | tryton/gui/window/view_board/view_board.py | Python | gpl-3.0 | 1,291 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the Li... | jhol/libsigrokdecode | decoders/jtag_stm32/__init__.py | Python | gpl-3.0 | 1,090 |
import site
import sys
from os import path
def extendsyspath():
# we want to add the current directory and the vendor/lib/python directory
# at the beginning of sys.path
root_dir = path.abspath(path.join(path.dirname(path.abspath(__file__)), "..", ".."))
prev_sys_path = list(sys.path) # make a copy ... | testbhearsum/balrog | src/auslib/util/thirdparty.py | Python | mpl-2.0 | 665 |
from flask import request, Response, jsonify, current_app, session
from flask_oauth import OAuth
from datetime import datetime, timedelta, date
from functools import update_wrapper
from mongokit import cursor
from bson import ObjectId
from models import connection
from config import APIHOST, YT_SERVICE, BYU_WS_ID, BYU_... | jlmcdonald/byu-hummedia-api | hummedia/helpers.py | Python | mpl-2.0 | 14,633 |
"""
OCL Organization Views
"""
#import requests
import logging
import json
import re
from django.shortcuts import redirect
from django.http import Http404
from django.views.generic import TemplateView, View
from django.views.generic.edit import FormView
from django.core.urlresolvers import reverse
from django.contrib ... | bhawnasingla/ocl_web | ocl_web/apps/orgs/views.py | Python | mpl-2.0 | 15,791 |
from client import Connection, Client
from exceptions import RedisError, ConnectionError, ResponseError, \
InvalidResponse
| kaze/paasmaker | paasmaker/thirdparty/tornadoredis/__init__.py | Python | mpl-2.0 | 146 |
from superdesk.emails import send_user_status_changed_email, send_activity_emails, send_email, send_translation_changed
from superdesk.tests import TestCase
from unittest.mock import patch
class SendEmailTestCase(TestCase):
def test_send_email(self):
with self.app.app_context():
with self.app.... | petrjasek/superdesk-core | tests/send_email_test.py | Python | agpl-3.0 | 2,396 |
'''
Created on Jan 9, 2012
@package: superdesk
@copyright: 2012 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Gabriel Nistor
Contains the services for superdesk.
'''
from ..plugin.registry import addService
from .db_superdesk import bindSuperdeskSession, bindSuperdeskValidations
from... | superdesk/Live-Blog | plugins/superdesk/__plugin__/superdesk/service.py | Python | agpl-3.0 | 955 |
# -*- coding: utf-8 -*-
#
# Copyright 2016 Taŭga Tecnologia
# Aristides Caldeira <aristides.caldeira@tauga.com.br>
# License AGPL-3 or later (http://www.gnu.org/licenses/agpl)
#
from __future__ import division, print_function, unicode_literals
from odoo import fields, models
class SpedNCM(models.Model):
_name... | odoo-brazil/l10n-brazil-wip | sped_imposto/models/sped_ncm_ibptax.py | Python | agpl-3.0 | 980 |
import zerodb
from zerodb.query import *
from models import Employee
PASSPHRASE = "very insecure passphrase - never use it"
SOCKET = ("localhost", 8001)
db = zerodb.DB(SOCKET, username="root", password=PASSPHRASE)
print("Connected")
print(len(db[Employee]))
johns = db[Employee].query(name="John", limit=10)
print(le... | zero-db/zerodb-server | demo/demo.py | Python | agpl-3.0 | 601 |
"""
Modulestore configuration for test cases.
"""
from uuid import uuid4
from django.test import TestCase
from xmodule.modulestore.django import editable_modulestore, \
clear_existing_modulestores
def mixed_store_config(data_dir, mappings):
"""
Return a `MixedModuleStore` configuration, which provides
... | abo-abo/edx-platform | common/lib/xmodule/xmodule/modulestore/tests/django_utils.py | Python | agpl-3.0 | 8,071 |
# -*- coding: utf-8 -*-
"""Stacked Autoencoder Pretrainer"""
import numpy as np
import tensorflow as tf
from tf_helper import tfMSE, fully_connected_layer
from jupyter_notebook_helper import getRunTime
def buildGraphOfStackedAutoencoder(inDim, variables, nonlinearity=tf.nn.tanh, avoidDeadNeurons = 0.,
... | pligor/predicting-future-product-prices | 04_time_series_prediction/mylibs/stacked_autoencoder_pretrainer.py | Python | agpl-3.0 | 5,236 |
# encoding: utf-8
import os.path
import time
import requests
from ..test_common import skipifdev
from ..utils import get_running_krakens
ROOTDIR = os.path.dirname(os.path.abspath(__file__))
instances_names = {'us-wa', 'fr-nw', 'fr-npdc', 'fr-ne-amiens', 'fr-idf', 'fr-cen'}
@skipifdev
def test_upgrade_kraken(dupl... | CanalTP/fabric_navitia | integration_tests/test_tasks/test_duplicated.py | Python | agpl-3.0 | 9,940 |
import os
import traceback
from datetime import datetime
from sqlalchemy import (Column, BigInteger, String, DateTime, Boolean,
ForeignKey, Enum, inspect, bindparam, Index, event)
from sqlalchemy.orm import relationship
from sqlalchemy.orm.session import Session
from sqlalchemy.sql.expression i... | jobscore/sync-engine | inbox/models/account.py | Python | agpl-3.0 | 15,882 |
# coding=utf-8
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
from flask import request, jsonify, abort, make_response
from flask.ext.login import current_user
import astroprint.users as users
from octoprint.server import restricted... | abinashk-inf/AstroBox | src/octoprint/server/api/users.py | Python | agpl-3.0 | 4,325 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes import _
from webnotes.utils import cstr
no_cache = True
def get_context():
from selling.utils.cart import get_lead_or_customer
part... | Yellowen/Owrang | portal/templates/pages/profile.py | Python | agpl-3.0 | 1,175 |
import pybullet as p
import time
import pybullet_data
p.connect(p.GUI)
p.setAdditionalSearchPath(pybullet_data.getDataPath())
fileIO = p.loadPlugin("fileIOPlugin")
if (fileIO >= 0):
#we can have a zipfile (pickup.zip) inside a zipfile (pickup2.zip)
p.executePluginCommand(fileIO, pybullet_data.getDataPath()+"/picku... | nrz/ylikuutio | external/bullet3/examples/pybullet/gym/pybullet_examples/fileIOPlugin.py | Python | agpl-3.0 | 713 |
# -*- 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... | 837278709/metro-openerp | metro/ir_translation.py | Python | agpl-3.0 | 2,901 |
"""
Mixin to support editing in Studio.
"""
from __future__ import absolute_import
import six
from xmodule.x_module import AUTHOR_VIEW, STUDENT_VIEW, module_attr
class StudioEditableBlock(object):
"""
Helper methods for supporting Studio editing of XBlocks.
This class is only intended to be used with an... | ESOedX/edx-platform | common/lib/xmodule/xmodule/studio_editable.py | Python | agpl-3.0 | 2,348 |
import commands
import packetFactory
from packetFactory import SystemMessagePacket
import plugins
maintmode = False
@plugins.CommandHook("maint", "[Admin Only] Toggle maintenance mode", True)
class maintmode(commands.Command):
def call_from_client(self, client):
global maintmode
maintmode = not ma... | alama/PSO2Proxy | proxy/plugins/maint.py | Python | agpl-3.0 | 1,330 |
from mongoengine import *
# connect('edxapp')
class StaticPage(Document):
about = StringField(required=False)
faq = StringField(required=False)
privacy =StringField(required=False)
honor = StringField(required=False)
tos = StringField(required=False)
contact = StringField(required=False)
bl... | synergeticsedx/deployment-wipro | lms/djangoapps/static_pages/models.py | Python | agpl-3.0 | 984 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Ort.polygontype'
db.alter_column(u'projects_ort', 'pol... | BuergerbautStadt/bbs-old | projects/migrations/0004_auto__chg_field_ort_polygontype.py | Python | agpl-3.0 | 5,444 |
# -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2011 Renato Lima - Akretion #
# ... | CLVsol/odoo_addons_l10n_br | l10n_br_zip/wizard/__init__.py | Python | agpl-3.0 | 1,413 |
"""Assertions related to event validation"""
import json
import pprint
def assert_event_matches(expected, actual, tolerate=None):
"""
Compare two event dictionaries.
Fail if any discrepancies exist, and output the list of all discrepancies. The intent is to produce clearer
error messages than "{ so... | eduNEXT/edunext-platform | openedx/core/lib/tests/assertions/events.py | Python | agpl-3.0 | 9,906 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, an open source suite of business apps
# This module copyright (C) 2013-2015 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the t... | open-synergy/partner-contact | partner_street_number/__openerp__.py | Python | agpl-3.0 | 1,475 |
# handles server side table processing
class ServerSideTable:
"""
This class is used to do server-side processing
on the DataTables table such as paginating, sorting,
filtering(not implemented) etc. This takes the load off
the client-side and reduces the size of data interchanged.
... | zsloan/genenetwork2 | wqflask/wqflask/server_side.py | Python | agpl-3.0 | 3,585 |
from django import template
from ecommerce.extensions.offer.utils import format_benefit_value, get_benefit_type
register = template.Library()
@register.filter(name='benefit_discount')
def benefit_discount(benefit):
"""
Format benefit value for display based on the benefit type.
Example:
'100%... | edx/ecommerce | ecommerce/extensions/offer/templatetags/offer_tags.py | Python | agpl-3.0 | 758 |
"""
Public interface for self-assessment.
"""
import logging
from django.db import DatabaseError, transaction
from openassessment.assessment.errors import SelfAssessmentInternalError, SelfAssessmentRequestError
from openassessment.assessment.models import Assessment, AssessmentPart, InvalidRubricSelection
from openas... | Stanford-Online/edx-ora2 | openassessment/assessment/api/self.py | Python | agpl-3.0 | 12,025 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PpopenAt(MakefilePackage):
"""ppOpen-AT is a part of the ppOpenHPC"""
homepage = "ht... | iulian787/spack | var/spack/repos/builtin/packages/ppopen-at/package.py | Python | lgpl-2.1 | 864 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import router
class Connection(object):
"""The connection object pairs a backend with an individual
identity (phone number, nickname, email, etc) so application
authors need not concern themselves with backends."""
def __init__(self, ... | ewheeler/rapidsms-core | lib/rapidsms/connection.py | Python | lgpl-3.0 | 1,406 |
import sys
def setup():
return
def run(core, actor, target, commandString):
newState = actor.toggleGroupDance()
msg = '@performance:dance_group_on' if newState else '@performance:dance_group_off'
actor.sendSystemMessage(msg, 0)
return
| agry/NGECore2 | scripts/commands/groupdance.py | Python | lgpl-3.0 | 258 |
"""
Unit tests for stem.descriptor.hidden_service_descriptor.
"""
import datetime
import functools
import unittest
import stem.descriptor
import stem.prereq
import test.require
from stem.descriptor.hidden_service_descriptor import (
REQUIRED_FIELDS,
DecryptionFailure,
HiddenServiceDescriptor,
)
from test.unit... | ewongbb/stem | test/unit/descriptor/hidden_service_descriptor.py | Python | lgpl-3.0 | 23,069 |
#!/usr/bin/env python
"""
Test runner script.
Please use `tox` to run it in multiple environments.
"""
import django
from django.conf import settings
from django.core.management import call_command
gettext = lambda s: s
conf = dict(
LANGUAGES = (
('ru', gettext('Russian')),
('en', gettext('Engli... | jpaulodit/django-autoslug | run_tests.py | Python | lgpl-3.0 | 758 |
"""
Cross section plots
===================
This example demonstrates contour plots of a cross-sectioned multi-dimensional
cube which features a hybrid height vertical coordinate system.
"""
import matplotlib.pyplot as plt
import iris
import iris.plot as iplt
import iris.quickplot as qplt
def main():
# Load s... | pp-mo/iris | docs/iris/example_code/General/cross_section.py | Python | lgpl-3.0 | 1,110 |
# funcion (recursiva) que imprime la expresion dado una lista de operadores
# y una lista de numeros
def pretty_print(L,sol):
if len(L)==1:
print(L[0],end='')
else:
print('(',end='')
pretty_print(L[:-1],sol[:-1])
print(sol[-1],end='')
print(L[-1],end='')
print('... | jabaier/iic1103.20152.s4 | ejercicios_resueltos_recursion/operadoreslistas.py | Python | unlicense | 1,461 |
# -*- 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 model 'Alignment'
db.create_table('badges_alignment', (
('id', self.gf('django.db.model... | OpenMOOC/moocng | moocng/badges/migrations/0002_auto__add_alignment__add_issuer__add_revocation__add_tag__add_identity.py | Python | apache-2.0 | 14,656 |
#!/usr/bin/env python
#
# Copyright 2011-2015 Splunk, 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... | splunk/splunk-sdk-python | examples/loggers.py | Python | apache-2.0 | 1,407 |
import os
import os.path
import shutil
def get_buildifier():
return os.getenv("BUILDIFIER_BIN") or (
os.path.expandvars("$GOPATH/bin/buildifier")
if os.getenv("GOPATH") else shutil.which("buildifier"))
def get_buildozer():
return os.getenv("BUILDOZER_BIN") or (
os.path.expandvars("$G... | envoyproxy/envoy | tools/code_format/paths.py | Python | apache-2.0 | 405 |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# 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/licens... | USGSDenverPychron/pychron | pychron/managers/motion_controller_managers/newport_motion_controller_manager.py | Python | apache-2.0 | 1,316 |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Use the GitHub API to download built artifacts."""
import datetime
import json
import os
import os.path
import sys
import time
import zipfile
import requests
... | nedbat/coveragepy | ci/download_gha_artifacts.py | Python | apache-2.0 | 2,137 |
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list o... | OscarSwanros/swift | utils/build_swift/driver_arguments.py | Python | apache-2.0 | 47,708 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/incubator-superset | superset/datasets/commands/export.py | Python | apache-2.0 | 3,734 |
"""
Unit tests for variant objects. This is used for all tests
that can be performed in isolation from input data.
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import hashlib
import unittest
import ga4gh.protocol as protocol
import ga4gh.datarepo as... | macieksmuga/server | tests/unit/test_variant_annotations.py | Python | apache-2.0 | 3,956 |
# Copyright (c) 2015 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... | japaniel/CloudFerry | devlab/tests/filtering_utils.py | Python | apache-2.0 | 3,024 |
"""Support for Tellstick sensors."""
from __future__ import annotations
from collections import namedtuple
import logging
from tellcore import telldus
import tellcore.constants as tellcore_constants
import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorDeviceClass,
... | mezz64/home-assistant | homeassistant/components/tellstick/sensor.py | Python | apache-2.0 | 5,393 |
import torch
import torch.nn as nn
from torch.autograd import Variable
from functools import reduce
class LambdaBase(nn.Sequential):
def __init__(self, fn, *args):
super(LambdaBase, self).__init__(*args)
self.lambda_func = fn
def forward_prepare(self, input):
output = []
for m... | jmhsi/justin_tinker | data_science/courses/temp/weights/resnext_50_32x4d.py | Python | apache-2.0 | 10,738 |
#!/usr/bin/env python
import os,sys,json
from datetime import datetime
from filecmp import cmp
from subprocess import check_call
from boto.s3.key import Key
from boto.s3.connection import S3Connection
def ENV(x):
'''Promote an environment variable for global use returning its value'''
retval = os.environ.get(... | proppy/docker | hack/infrastructure/docker-ci/tool/backup.py | Python | apache-2.0 | 1,554 |
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# 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/LICEN... | mahak/cinder | cinder/tests/unit/backup/test_backup.py | Python | apache-2.0 | 101,556 |
from base import Base as BaseTestCase
from roletester.actions.swift import swift_container_create
from roletester.actions.swift import swift_container_delete
from roletester.actions.swift import swift_container_add_metadata
from roletester.actions.swift import swift_object_put
from roletester.actions.swift import swift... | chalupaul/roletester | roletester/roletests/swift_tests.py | Python | apache-2.0 | 12,214 |
#
# 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
# ... | citrix-openstack-build/neutron-lbaas | neutron_lbaas/openstack/common/periodic_task.py | Python | apache-2.0 | 7,750 |
"""Provides device triggers for sensors."""
import voluptuous as vol
import homeassistant.components.automation.numeric_state as numeric_state_automation
from homeassistant.components.device_automation import TRIGGER_BASE_SCHEMA
from homeassistant.components.device_automation.exceptions import (
InvalidDeviceAutom... | joopert/home-assistant | homeassistant/components/sensor/device_trigger.py | Python | apache-2.0 | 5,504 |
import collections
import toml
from dcos import util
from dcos.errors import DCOSException
def load_from_path(path, mutable=False):
"""Loads a TOML file from the path
:param path: Path to the TOML file
:type path: str
:param mutable: True if the returned Toml object should be mutable
:type mutab... | Yhgenomics/dcos-cli | dcos/config.py | Python | apache-2.0 | 5,246 |
# Copyright 2013 IBM Corp.
#
# 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... | Metaswitch/calico-nova | nova/objects/base.py | Python | apache-2.0 | 34,663 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Nebula, 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
#
# ... | rcbops/horizon-buildpackage | horizon/tables/base.py | Python | apache-2.0 | 32,799 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import threading
import unittest
from pants.base.worker_pool import Work, WorkerPool
from pants.base.workunit import WorkUnit
from pants.util.contextutil import temporary_dir
class Fake... | tdyas/pants | tests/python/pants_test/base/test_worker_pool.py | Python | apache-2.0 | 999 |
from collections import defaultdict
from typing import Any, Dict, Set
import ibis.expr.operations as ops
import ibis.expr.types as ir
import ibis.util as util
class FormatMemo:
"""
Class used to manage memoization of intermediate ibis expression format
results in ExprFormatter.
Parameters
------... | cpcloud/ibis | ibis/expr/format.py | Python | apache-2.0 | 9,362 |
# -*- coding: utf-8 -*-
"""The single process extraction engine."""
import collections
import os
import pdb
import threading
import time
from dfvfs.lib import definitions as dfvfs_definitions
from dfvfs.lib import errors as dfvfs_errors
from dfvfs.resolver import resolver
from plaso.containers import counts
from pla... | joachimmetz/plaso | plaso/single_process/extraction_engine.py | Python | apache-2.0 | 14,239 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | dvliman/jaikuengine | .google_appengine/google/appengine/tools/endpointscfg.py | Python | apache-2.0 | 16,252 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/bigtable/admin_v2/proto/common.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descripto... | dhermes/google-cloud-python | bigtable/google/cloud/bigtable_admin_v2/proto/common_pb2.py | Python | apache-2.0 | 2,932 |
from fontbakery.checkrunner import FAIL
from fontbakery.codetesting import (assert_PASS,
assert_results_contain,
CheckTester,
TEST_FILE)
from fontbakery.profiles import iso15008 as iso15008_profile
def test_che... | googlefonts/fontbakery | tests/profiles/iso15008_test.py | Python | apache-2.0 | 4,828 |
#!/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... | kawamon/hue | apps/jobbrowser/src/jobbrowser/apis/beat_api.py | Python | apache-2.0 | 5,168 |
'''
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 this ... | sekikn/ambari | ambari-common/src/main/python/ambari_stomp/adapter/websocket.py | Python | apache-2.0 | 5,073 |
#
# 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... | kevinyu98/spark | python/pyspark/sql/readwriter.py | Python | apache-2.0 | 61,864 |
"""
Data migration to populate tenants.uid with existing tenants.id values.
"""
# pylint: disable=C0103,R0801
import sqlalchemy
meta = sqlalchemy.MetaData()
# define the previous state of tenants
tenant = {}
tenant['id'] = sqlalchemy.Column('id', sqlalchemy.Integer, primary_key=True,
autoincrement=True)
tena... | HugoKuo/keystone-essex3 | keystone/backends/sqlalchemy/migrate_repo/versions/006_populate_tenants_uid.py | Python | apache-2.0 | 1,107 |
#-
# Copyright (c) 2012 Robert M. Norton
# All rights reserved.
#
# @BERI_LICENSE_HEADER_START@
#
# Licensed to BERI Open Systems C.I.C. (BERI) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. BERI licenses t... | 8l/beri | cheritest/trunk/tests/tlb/test_tlb_load_1.py | Python | apache-2.0 | 1,311 |
# Copyright 2014 eBay Software 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 ... | redhat-openstack/trove | trove/tests/unittests/cluster/test_cluster.py | Python | apache-2.0 | 9,650 |
# Copyright 2012 Nebula, 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 agree... | sandvine/horizon | openstack_dashboard/dashboards/admin/instances/tests.py | Python | apache-2.0 | 18,794 |
# Copyright 2018 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | tseaver/google-cloud-python | trace/synth.py | Python | apache-2.0 | 1,937 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from forms_builder.forms import fields, settings
class Migration(migrations.Migration):
dependencies = [
('sites', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | nimbis/django-forms-builder | forms_builder/forms/migrations/0001_initial.py | Python | bsd-2-clause | 6,125 |
from unittest.mock import ANY, Mock, patch
from streamlink_cli.output import PlayerOutput
from tests import posix_only, windows_only
UNICODE_TITLE = "기타치는소율 with UL섬 "
@posix_only
@patch("streamlink_cli.output.sleep", Mock())
@patch("subprocess.Popen")
def test_output_mpv_unicode_title_posix(popen):
po = Player... | beardypig/streamlink | tests/test_cli_playerout.py | Python | bsd-2-clause | 2,813 |
from __future__ import unicode_literals
try:
import configparser
except ImportError:
import ConfigParser as configparser
text = type('')
bool_or_auto = 'bool_or_auto'
class ParseError(Exception):
pass
def parse_ini(fileobj, field_specs, section_name):
parser = configparser.RawConfigParser()
r... | suutari/prequ | prequ/ini_parser.py | Python | bsd-2-clause | 1,443 |
# Use this file to convert the metrorail_sample_data.json data set
# to Excel format.
#
# python create_xls_file.py
#
# will create a file named Metro Rail Data.xlsx.
#
# metrorail.py will produce the same result regardless of whether
# it is run on metrorail_sample_data.json or Metro Rail Data.xlsx.
# This result i... | opalytics/opalytics-ticdat | examples/gurobipy/metrorail/create_xls_file.py | Python | bsd-2-clause | 760 |
#!/bin/env python
import os, sys
run = sys.argv[1]
hummingbird_dir = "/reg/neh/home/hantke/programs/hummingbird"
this_dir = os.path.dirname(os.path.realpath(__file__))
os.system("source /reg/neh/home/hantke/.bashrc; export HUMMINGBIRD_RUN=%s; cd %s; ./hummingbird.py -b %s/conf.py" % (run, hummingbird_dir, this_dir))... | SPIhub/hummingbird | examples/advanced/save_camera/brun.py | Python | bsd-2-clause | 321 |
#!/usr/bin/python3
#
# Copyright (C) 2006, 2007, 2010 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,
#... | ganeti/ganeti | test/py/ganeti.locking_unittest.py | Python | bsd-2-clause | 34,642 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# TEST_UNICODE_LITERALS
import numpy as np
from ... import units as u
from .. import SphericalRepresentation, Longitude, Latitude
from ...tests.helper import pytest
from ...utils.compat.numpycompat import NUMPY_LT_1_9
from ...utils.compat.numpy import br... | joergdietrich/astropy | astropy/coordinates/tests/test_representation_methods.py | Python | bsd-3-clause | 9,461 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <nipreps@gmail.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... | poldracklab/mriqc | mriqc/utils/__init__.py | Python | bsd-3-clause | 1,070 |
import pathlib
from collections import defaultdict
from operator import itemgetter
from itertools import groupby
from flask import Flask, send_from_directory, request, jsonify
from logbook import Logger
from aesop import isocodes, events
from aesop.models import Movie, TVShow, TVShowEpisode, Source, Config, database_... | nathan-hoad/aesop | aesop/ui.py | Python | bsd-3-clause | 9,806 |
import numpy as np
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
from sklearn.metrics import r2_score
import pytest
from sklearn.ensemble._hist_gradient_boosting.binning import _BinMapper
from sklearn.ensemble._hist_gradient_boosting.grower import TreeGrower
from sklearn... | chrsrds/scikit-learn | sklearn/ensemble/_hist_gradient_boosting/tests/test_predictor.py | Python | bsd-3-clause | 2,540 |
"""Small but quite comprehensive example showing the use of PyTables.
The program creates an output file, 'tutorial1.h5'. You can view it
with any HDF5 generic utility.
"""
import numpy as np
import tables as tb
#'-**-**-**-**-**-**- user record definition -**-**-**-**-**-**-**-'
# Define a user record ... | avalentino/PyTables | examples/tutorial1-1.py | Python | bsd-3-clause | 3,487 |
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
import numpy as np
from collections import Counter
def most_common(lst):
return max(set(lst), key=lst.count)
class CLF:
""" Implements a classifier for hierarchical clustering
... | alexandreday/fast_density_clustering | fdc/classify.py | Python | bsd-3-clause | 5,227 |
"""
sentry.testutils.cases
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
__all__ = (
'TestCase', 'TransactionTestCase', 'APITestCase', 'AuthProviderTestCase',
'RuleTest... | alexm92/sentry | src/sentry/testutils/cases.py | Python | bsd-3-clause | 14,299 |
import os
import subprocess
from unittest import mock
from django.conf import settings
from django.core import mail
from olympia import amo
from olympia.amo.cron import gc, write_sitemaps
from olympia.amo.sitemap import get_sitemaps
from olympia.amo.tests import TestCase, addon_factory, user_factory, version_factory
... | mozilla/addons-server | src/olympia/amo/tests/test_cron.py | Python | bsd-3-clause | 10,869 |
class Artifact(object):
def __init__(self, parts, format_name, theme=None, basename=None):
self._parts = parts
self._theme = theme
self._format_name = format_name
self._basename = basename
@property
def parts(self):
return self._parts
@property
def format_na... | venicegeo/eventkit-cloud | eventkit_cloud/utils/artifact.py | Python | bsd-3-clause | 833 |
"""
This file contains a minimal set of tests for compliance with the extension
array interface test suite, and should contain no other tests.
The test suite for the full functionality of the array is located in
`pandas/tests/arrays/`.
The tests in this file are inherited from the BaseExtensionTests, and only
minimal ... | cython-testbed/pandas | pandas/tests/extension/test_interval.py | Python | bsd-3-clause | 3,315 |