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 ceph_deploy.util import templates
from ceph_deploy.lib import remoto
from ceph_deploy.hosts.common import map_components
from ceph_deploy.util.paths import gpg
NON_SPLIT_PACKAGES = ['ceph-osd', 'ceph-mon', 'ceph-mds']
def rpm_dist(distro):
if distro.normalized_name in ['redhat', 'centos', 'scientific'] and... | branto1/ceph-deploy | ceph_deploy/hosts/centos/install.py | Python | mit | 6,289 |
from __future__ import absolute_import
import os
from celery import Celery
from django.conf import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'assembly.settings.local')
app = Celery('assembly')
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
ap... | Karolain/cms | assembly/celery.py | Python | mit | 408 |
#!/usr/bin/env python
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings modu... | CBien/django-alert | test_project/manage.py | Python | mit | 698 |
import unittest
import ctypes
import gc
MyCallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int)
OtherCallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_int, ctypes.c_ulonglong)
import _ctypes_test
dll = ctypes.CDLL(_ctypes_test.__file__)
class RefcountTestCase(unittest.TestCase):
def test_1(self):
fro... | sauloal/pycluster | pypy-1.9_64/lib-python/2.7/ctypes/test/test_refcounts.py | Python | mit | 2,502 |
#
# Copyright (c) 2015 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
from collections import OrderedDict
import logging
import re
import sys
import json
from django.conf import settings
from django.utils.encoding import smart_text
from contrib import drf_introspection
from dja... | lao605/product-definition-center | pdc/apps/common/renderers.py | Python | mit | 14,144 |
# -*- coding: utf-8 -*-
""" Translation API
@copyright: 2012-14 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restr... | collective/eden | modules/s3/s3translate.py | Python | mit | 64,871 |
from .generate_detachment_ltd_erosion import DetachmentLtdErosion
from .generate_erosion_by_depth_slope import DepthSlopeProductErosion
__all__ = ["DetachmentLtdErosion", "DepthSlopeProductErosion"]
| landlab/landlab | landlab/components/detachment_ltd_erosion/__init__.py | Python | mit | 200 |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import (assert_allclose, assert_, assert_raises,
assert_array_equal)
import pywt
# Check that float32, float64, complex64, complex128 are preserved.
# Other real type... | PyWavelets/pywt | pywt/tests/test_dwt_idwt.py | Python | mit | 10,352 |
# Time: O(n)
# Space: O(1)
#
# Say you have an array for which the ith element is
# the price of a given stock on day i.
#
# Design an algorithm to find the maximum profit.
# You may complete as many transactions as you like
# (ie, buy one and sell one share of the stock multiple times).
# However, you may not eng... | yiwen-luo/LeetCode | Python/best-time-to-buy-and-sell-stock-ii.py | Python | mit | 912 |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: IBM Model 3
#
# Copyright (C) 2001-2013 NLTK Project
# Authors: Chin Yee Lee, Hengfeng Li, Ruxin Hou, Calvin Tanujaya Lim
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Translation model that considers how a word can be aligned to
multiple w... | nelango/ViralityAnalysis | model/lib/nltk/translate/ibm3.py | Python | mit | 13,875 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('premises', '0030_report_reason'),
]
operations = [
migrations.AddField(
model_name='premise',
name='... | bahattincinic/arguman.org | web/premises/migrations/0031_premise_weight.py | Python | mit | 431 |
if __name__ == '__main__':
import os
import sys
port = int(sys.argv[1])
root_dirname = os.path.dirname(os.path.dirname(__file__))
if root_dirname not in sys.path:
sys.path.append(root_dirname)
print('before pydevd.settrace')
breakpoint(port=port) # Set up through custo... | Elizaveta239/PyDev.Debugger | tests_python/resources/_debugger_case_breakpoint_remote_no_import.py | Python | epl-1.0 | 406 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Form_NewProject.ui'
#
# Created: Mon Sep 9 21:29:21 2013
# by: PyQt4 UI code generator 4.8.6
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except... | dlintott/gns3 | src/GNS3/Ui/Form_NewProject.py | Python | gpl-2.0 | 5,837 |
# $Id$
#
import inc_const as const
PJSUA = ["--null-audio --max-calls=1 --auto-answer=200 --no-tcp --srtp-secure 0 --use-srtp 2 --srtp-keying=0"]
PJSUA_EXPECTS = [[0, "SRTP uses keying method SDES", ""],
[0, "SRTP uses keying method DTLS-SRTP", ""]
]
| asterisk/pjproject | tests/pjsua/scripts-sipp/uac-srtp-sdes-reinv-dtls.py | Python | gpl-2.0 | 258 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 University of Dundee & Open Microscopy Environment
# All Rights Reserved.
#
# 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 Foundat... | sbesson/snoopycrimecop | test/integration/Sandbox.py | Python | gpl-2.0 | 5,211 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2008-2010 Zuza Software Foundation
#
# This file is part of Virtaal.
#
# 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 ... | unho/virtaal | virtaal/views/widgets/storecellrenderer.py | Python | gpl-2.0 | 10,840 |
# $Id$
#
import inc_const as const
PJSUA = ["--null-audio --max-calls=1 --no-tcp $SIPP_URI"]
PJSUA_EXPECTS = [[0, "Audio updated", ""]]
| ismangil/pjproject | tests/pjsua/scripts-sipp/uas-answer-183-without-to-tag.py | Python | gpl-2.0 | 138 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0019_auto_20160518_0048'),
]
operations = [
migrations.AddField(
model_name='userprofile',
... | JulianVolodia/Politikon | accounts/migrations/0020_userprofile_last_transaction.py | Python | gpl-2.0 | 428 |
# -*- coding: utf-8 -*-
# This file is part of Invenio.
# Copyright (C) 2006, 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; either version 2 of the
# License, or (at... | jmacmahon/invenio | modules/websearch/lib/websearch_external_collections_templates.py | Python | gpl-2.0 | 7,238 |
# Rekall Memory Forensics
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Authors:
# Michael Cohen <scudette@google.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 ... | dsweet04/rekall | rekall-core/rekall/plugins/renderers/xls.py | Python | gpl-2.0 | 9,365 |
import pytest
import sys
import logging
from sqlalchemy import create_engine
import zk.model.meta as zkmeta
import zkpylons.model.meta as pymeta
from zkpylons.config.routing import make_map
from paste.deploy import loadapp
from webtest import TestApp
from paste.fixture import Dummy_smtplib
from .fixtures import Co... | zookeepr/zookeepr | zkpylons/tests/functional/conftest.py | Python | gpl-2.0 | 3,543 |
#!/usr/bin/env python
# Copyright 2007, Michael J. Harms
# This program is distributed under General Public License v. 3. See the file
# COPYING for a copy of the license.
__author__ = "Michael J. Harms"
__date__ = "070709"
__description__ = \
"""
pdb_dist-filter.py
Takes pdb file and calculates the distance betw... | AndreaEdwards/pdbtools | pdb_dist-filter.py | Python | gpl-3.0 | 4,013 |
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import unittest
import frappe
import erpnext
test_dependencies = ["Employee", "Leave Type", "Leave Policy"]
class TestLeavePeriod(unittest.TestCase):
pass
def create_leave_period(from_date, to_date, company=None):
leave_perio... | mhbu50/erpnext | erpnext/hr/doctype/leave_period/test_leave_period.py | Python | gpl-3.0 | 775 |
# -*- encoding: utf-8 -*-
"""
Usage::
hammer capsule [OPTIONS] SUBCOMMAND [ARG] ...
Parameters::
SUBCOMMAND subcommand
[ARG] ... subcommand arguments
Subcommands::
content Manage the capsule content
create Creat... | ares/robottelo | robottelo/cli/capsule.py | Python | gpl-3.0 | 3,537 |
#!/usr/bin/env python
import freenect
import cv
import numpy as np
cv.NamedWindow('Depth')
cv.NamedWindow('RGB')
def display_depth(dev, data, timestamp):
data -= np.min(data.ravel())
data *= 65536 / np.max(data.ravel())
image = cv.CreateImageHeader((data.shape[1], data.shape[0]),
... | cnr-isti-vclab/meshlab | src/external/openkinect/wrappers/python/demo_cv_async.py | Python | gpl-3.0 | 988 |
# -*- coding: utf-8 -*-
from south.v2 import DataMigration
class Migration(DataMigration):
def forwards(self, orm):
orm.Boundary.objects.filter(category='Zip Code').update(sort_order=5)
def backwards(self, orm):
pass
models = {
u'auth.group': {
'Meta': {'object_name':... | johnsonc/OTM2 | opentreemap/treemap/migrations/0061_change_zip_code_sort_order.py | Python | gpl-3.0 | 20,859 |
"""
Copyright 2008-2016 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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 l... | stwunsch/gnuradio | grc/core/Platform.py | Python | gpl-3.0 | 11,876 |
# Linktastic Module
# - A python2/3 compatible module that can create hardlinks/symlinks on windows-based systems
#
# Linktastic is distributed under the MIT License. The follow are the terms and conditions of using Linktastic.
#
# The MIT License (MIT)
# Copyright (c) 2012 Solipsis Development
#
# Permission is here... | tortib/nzbToMedia | nzbtomedia/linktastic/linktastic.py | Python | gpl-3.0 | 4,260 |
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
import frappe
from frappe import _
def execute(filters=None):
if not filters: filters = {}
if not filters.get("date"):
frappe.throw(_("Please select date"))
columns = get_columns(filters)
... | mhbu50/erpnext | erpnext/accounts/report/share_ledger/share_ledger.py | Python | gpl-3.0 | 1,816 |
import frappe
from frappe.model.utils.rename_field import rename_field
def execute():
frappe.reload_doc("Healthcare", "doctype", "Inpatient Record")
if frappe.db.has_column("Inpatient Record", "discharge_date"):
rename_field("Inpatient Record", "discharge_date", "discharge_datetime")
| frappe/erpnext | erpnext/patches/v13_0/rename_discharge_date_in_ip_record.py | Python | gpl-3.0 | 291 |
import numpy as np
def CG(A, X, B, maxiter=20, tolerance=1.0e-10, verbose=False):
"""Solve X*A=B using conjugate gradient method.
``X`` and ``B`` are ``ndarrays```of shape ``(m, nx, ny, nz)``
coresponding to matrices of size ``m*n`` (``n=nx*ny*nz``) and
``A`` is a callable representing an ``n*n`` matr... | qsnake/gpaw | gpaw/utilities/cg.py | Python | gpl-3.0 | 1,346 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | elfnor/sverchok | nodes/layout/wifi_out.py | Python | gpl-3.0 | 4,974 |
# This code has been taken from http://www.assembla.com/spaces/datatables_demo/wiki
from django.db.models import Q
from django.template.loader import render_to_string
from django.http import HttpResponse
from django.utils.cache import add_never_cache_headers
from django.utils import simplejson
import os
fro... | OrlyMar/gasistafelice | gasistafelice/lib/views_support.py | Python | agpl-3.0 | 10,577 |
# -*- coding: utf-8 -*-
# ____________
# ___/ | \_____________ _ _ ___
# / ___/ | _ __ _ _| | ___ __ _ __| | \
# / \___/ ______/ | '_ \ || | |__/ _ \/ _` / _` | \
# \ ◯ | | .__/\_, |____\___/\__,_\__,_| /
# \_______\ /_______|_| |__/... | vuolter/pyload | src/pyload/__init__.py | Python | agpl-3.0 | 1,504 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0009_auto_20160303_2340'),
('manager', '0005_auto_20160303_2008'),
]
operations = [
migrations.RenameField(
... | DeveloperMal/wger | wger/manager/migrations/0006_auto_20160303_2138.py | Python | agpl-3.0 | 986 |
"""
Tests course_creators.admin.py.
"""
import mock
import django
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User
from django.core import mail
from django.http import HttpRequest
from django.test import TestCase
from course_creators.admin import CourseCreatorAdmin
from cou... | procangroup/edx-platform | cms/djangoapps/course_creators/tests/test_admin.py | Python | agpl-3.0 | 8,540 |
""" Overrides for Docker-based devstack. """
from .devstack import * # pylint: disable=wildcard-import, unused-wildcard-import
# Docker does not support the syslog socket at /dev/log. Rely on the console.
LOGGING['handlers']['local'] = LOGGING['handlers']['tracking'] = {
'class': 'logging.NullHandler',
}
LOGGIN... | lduarte1991/edx-platform | lms/envs/devstack_docker.py | Python | agpl-3.0 | 2,419 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Albert SHENOUDA <albert.shenouda@efrei.net>
#
# The licence is in the fi... | MickSandoz/compassion-modules | contract_compassion/tests/test_base_module.py | Python | agpl-3.0 | 4,143 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import SUPERUSER_ID
from odoo.http import request, route
from odoo.addons.bus.controllers.main import BusController
class MailChatController(BusController):
def _default_request_uid(self):
""" Fo... | Aravinthu/odoo | addons/mail/controllers/bus.py | Python | agpl-3.0 | 3,026 |
import psutil
def is_up(ps_name):
return True in [psutil.Process(pid).name() == ps_name for pid in psutil.get_pid_list()]
| knmkr/perGENIE | pergenie/lib/utils/service.py | Python | agpl-3.0 | 127 |
"""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('lms_initialization.apps', 'lms.djangoapps.lms_init... | eduNEXT/edunext-platform | import_shims/lms/lms_initialization/apps.py | Python | agpl-3.0 | 392 |
from browser import window
from preprocess import transform
from reeborg_en import * # NOQA
src = transform(window.editor.getValue())
exec(src)
| code4futuredotorg/reeborg_tw | src/python/editor.py | Python | agpl-3.0 | 145 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/wt/package.py | Python | lgpl-2.1 | 4,106 |
#!/usr/bin/env python
import os, sys, codecs, re
def usage():
print "Usage info for extract_references.py"
print " extract_references.py ref_sgml ref_prefix"
print
sys.exit()
def main():
if (len(sys.argv) < 3 or sys.argv[1] == "-h"):
usage()
sgml = codecs.open(sys.argv[1], "r", "utf-8")
pref... | gwenniger/joshua | scripts/toolkit/extract_references.py | Python | lgpl-2.1 | 1,922 |
"""Clock/event scheduler.
This is a Pygame implementation of a scheduler inspired by the clock
classes in Pyglet.
"""
import heapq
from weakref import ref
from functools import total_ordering
from types import MethodType
__all__ = [
'Clock', 'schedule', 'schedule_interval', 'unschedule'
]
def weak_method(metho... | yrobla/pyjuegos | pgzero/clock.py | Python | lgpl-3.0 | 5,190 |
# Copyright (c) 2010-2012 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
#
# Unless required by applicable law or agree... | kalrey/swift | swift/common/constraints.py | Python | apache-2.0 | 10,266 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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.apa... | ntt-sic/cinder | cinder/tests/brick/test_brick_linuxscsi.py | Python | apache-2.0 | 8,511 |
#
# 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... | DinoCow/airflow | tests/providers/amazon/aws/hooks/test_kinesis.py | Python | apache-2.0 | 2,545 |
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import argparse
import base64
import fnmatch
import glob
import hashlib
import os
import re
import zipfile
from pants.util.contextutil import open_zip,... | patricklaw/pants | build-support/bin/reversion.py | Python | apache-2.0 | 7,174 |
# 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... | jermainewang/mxnet | tests/python/unittest/test_gluon.py | Python | apache-2.0 | 16,438 |
"""
Django settings for the admin project.
"""
import os
from urlparse import urlparse
from website import settings as osf_settings
from django.contrib import messages
from api.base.settings import * # noqa
# TODO ALL SETTINGS FROM API WILL BE IMPORTED AND WILL NEED TO BE OVERRRIDEN
# TODO THIS IS A STEP TOWARD INTEG... | hmoco/osf.io | admin/base/settings/defaults.py | Python | apache-2.0 | 6,690 |
import collections
import datetime
import mock
import pytz
from babel import dates, Locale
from schema import Schema, And, Use, Or
from modularodm import Q
from modularodm.exceptions import NoResultsFound
from nose.tools import * # noqa PEP8 asserts
from framework.auth import Auth
from framework.auth.core import Use... | brandonPurvis/osf.io | tests/test_notifications.py | Python | apache-2.0 | 59,970 |
#!/usr/bin/env python
import logging
from tornado.ioloop import IOLoop
from stormed import Connection, Message
def fib(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n-1) + fib(n-2)
def on_connect():
global ch
ch = conn.channel()
ch.queue_declare(queue=... | SimonWang2014/DockerConsoleApp | libs/stormed-amqp/examples/tutorial6/rpc_server.py | Python | apache-2.0 | 972 |
#
# 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
# distributed under... | froyobin/ironic | ironic/drivers/modules/drac/common.py | Python | apache-2.0 | 4,782 |
# Copyright (c) 2016 Claudiu Popa <pcmanticore@gmail.com>
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER
import sys
import textwrap
import six
import astroid
PY33 = sys.version_info >= (3, 3)
PY36 = s... | arju88nair/projectCulminate | venv/lib/python3.5/site-packages/astroid/brain/brain_subprocess.py | Python | apache-2.0 | 3,314 |
"""Tests for 1-Wire devices connected on OWServer."""
import copy
from unittest.mock import patch
import pytest
from homeassistant.components.onewire.switch import DEVICE_SWITCHES
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TOGGLE, STATE_... | sander76/home-assistant | tests/components/onewire/test_switch.py | Python | apache-2.0 | 2,860 |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... | mlperf/training_results_v0.5 | v0.5.0/google/research_v3.32/gnmt-tpuv3-32/code/gnmt/model/t2t/tensor2tensor/bin/t2t_trainer_test.py | Python | apache-2.0 | 1,357 |
#!Measurement
# all of this is configuration info that can be used in the script.
# you refer to these values using mx.<group>.<attribute>
# e.g
# mx.baseline.counts is 180
# mx.multicollect.detector is H1
'''
baseline:
after: true
before: false
counts: 180
detector: H1
mass: 34.2
settling_time: 15
d... | USGSDenverPychron/pychron | docs/user_guide/operation/scripts/examples/basic.py | Python | apache-2.0 | 2,487 |
"""Constants for the Toon integration."""
from datetime import timedelta
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_PROBLEM,
)
from homeassistant.components.sensor import DEVICE_CLASS_POWER
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_ICON,... | nkgilley/home-assistant | homeassistant/components/toon/const.py | Python | apache-2.0 | 11,757 |
# 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... | hfp/tensorflow-xsmm | tensorflow/contrib/tpu/python/tpu/session_support.py | Python | apache-2.0 | 15,206 |
import unittest
import sys
import inspect
from robot.running.handlers import _PythonHandler, _JavaHandler, DynamicHandler
from robot import utils
from robot.utils.asserts import *
from robot.running.testlibraries import TestLibrary
from robot.running.dynamicmethods import (
GetKeywordArguments, GetKeywordDocumenta... | yahman72/robotframework | utest/running/test_handlers.py | Python | apache-2.0 | 12,868 |
#!/usr/bin/env python
import rospy
import os
import roslib
roslib.load_manifest("denso_pendant_publisher")
roslib.load_manifest("actionlib_msgs")
import denso_pendant_publisher.msg
import std_msgs.msg
import actionlib_msgs.msg
rospy.init_node("moveit_canceler")
g_runnable = True
g_prev_status = None
def pendantC... | mikewrock/phd_backup_full | src/wrock/vs060/scripts/moveit_canceler.py | Python | apache-2.0 | 1,094 |
import sys
sys.path.insert(1, "../../../")
import h2o
def iris_nfolds(ip,port):
iris = h2o.import_file(path=h2o.locate("smalldata/iris/iris.csv"))
model = h2o.random_forest(y=iris[4], x=iris[0:4], ntrees=50, nfolds=5)
model.show()
# Can specify both nfolds >= 2 and validation = H2OParsed... | weaver-viii/h2o-3 | h2o-py/tests/testdir_algos/rf/pyunit_iris_nfoldsRF.py | Python | apache-2.0 | 616 |
#!/usr/bin/env python
from grr.lib import access_control
from grr.lib import aff4
from grr.lib import rdfvalue
from grr.lib import test_lib
from grr.lib.aff4_objects import user_managers
class GRRUserTest(test_lib.AFF4ObjectTest):
def testUserPasswords(self):
with aff4.FACTORY.Create("aff4:/users/test", "GRR... | ForensicTools/GRREAT-475_2141-Chaigon-Failey-Siebert | lib/aff4_objects/user_managers_test.py | Python | apache-2.0 | 7,156 |
"""Add same_tool and tool_id
Revision ID: 16f121110a0f
Revises: 2c58f1b857f1
Create Date: 2015-11-09 12:28:43.019410
"""
# revision identifiers, used by Alembic.
revision = '16f121110a0f'
down_revision = '2c58f1b857f1'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated b... | go-lab/appcomposer | alembic/versions/16f121110a0f_add_same_tool_and_tool_id.py | Python | bsd-2-clause | 1,266 |
# -*- coding: utf-8 -*-
from itertools import product
from itertools import permutations
from numba import njit
from numba.core import types, utils
import unittest
from numba.tests.support import (TestCase, no_pyobj_flags, MemoryLeakMixin)
from numba.core.errors import TypingError, UnsupportedError
from numba.cpython.... | cpcloud/numba | numba/tests/test_unicode.py | Python | bsd-2-clause | 93,714 |
import datetime
import json
import time
import urllib
import urlparse
from django.contrib.humanize.templatetags import humanize
from django.contrib.staticfiles.storage import staticfiles_storage
from django.template import defaultfilters
from django.utils.encoding import smart_str
from django.utils.html import strip_t... | staranjeet/fjord | fjord/base/helpers.py | Python | bsd-3-clause | 3,652 |
from .db_settings import get_model_indexes
from djangotoolbox.db.creation import NonrelDatabaseCreation
class StringType(object):
def __init__(self, internal_type):
self.internal_type = internal_type
def __mod__(self, field):
indexes = get_model_indexes(field['model'])
if fiel... | rimbalinux/MSISDNArea | djangoappengine/db/creation.py | Python | bsd-3-clause | 1,719 |
"""
pytest hooks and fixtures used for our unittests.
Please note that there should not be any Django/Olympia related imports
on module-level, they should instead be added to hooks or fixtures directly.
"""
import os
import uuid
import warnings
import pytest
import responses
import six
@pytest.fixture(autouse=True)... | kumar303/addons-server | conftest.py | Python | bsd-3-clause | 7,121 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from astropy.utils.tests.test_metadata import MetaBaseTest
import operator
import pytest
import numpy as np
from numpy.testing import assert_array_equal
from astropy.tests.helper import assert_follows_unicode_guidelines
from astr... | pllim/astropy | astropy/table/tests/test_column.py | Python | bsd-3-clause | 34,643 |
"""Tests for user-friendly public interface to polynomial functions. """
from sympy.polys.polytools import (
Poly, PurePoly, poly,
parallel_poly_from_expr,
degree, degree_list,
LC, LM, LT,
pdiv, prem, pquo, pexquo,
div, rem, quo, exquo,
half_gcdex, gcdex, invert,
subresultants,
resu... | ChristinaZografou/sympy | sympy/polys/tests/test_polytools.py | Python | bsd-3-clause | 106,569 |
# -*- coding: utf-8 -*-
"""WAV file IO functions
"""
import numpy as np
from scipy.io import wavfile
from os import path as op
import warnings
from .._utils import verbose_dec, logger, _has_scipy_version
@verbose_dec
def read_wav(fname, verbose=None):
"""Read in a WAV file
Parameters
----------
fna... | LABSN/expyfun | expyfun/io/_wav.py | Python | bsd-3-clause | 3,494 |
# -*- coding: utf-8 -*-
# Copyright 2019 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... | catapult-project/catapult | third_party/gsutil/gslib/commands/hmac.py | Python | bsd-3-clause | 13,530 |
#
# cocos2d
# http://python.cocos2d.org
#
from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
from cocos.director import directo... | dangillet/cocos | samples/demo_multiple_scenes.py | Python | bsd-3-clause | 3,011 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | samedder/azure-cli | src/azure-cli-core/azure/cli/core/tests/test_cloud.py | Python | mit | 10,518 |
# -*- coding: utf-8 -*-
import sys
from inspect import getmembers
from ._hoedown import lib
def _set_constants():
is_int = lambda n: isinstance(n, int)
for name, value in getmembers(lib, is_int):
if not name.startswith('HOEDOWN_'):
continue
setattr(sys.modules[__name__], name[8:... | Weasyl/misaka | misaka/constants.py | Python | mit | 406 |
import unittest
import numpy
import six
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import backend
@testing.parameterize(*testing.product({
'dtype': [numpy.float16, numpy.float32, numpy.float64],
}))
@backend... | rezoo/chainer | tests/chainer_tests/functions_tests/normalization_tests/test_local_response_normalization.py | Python | mit | 2,648 |
class Solution(object):
def wordsTyping(self, sentence, rows, cols):
"""
:type sentence: List[str]
:type rows: int
:type cols: int
:rtype: int
"""
cnt = 0
start = 0
row_circ = len(''.join(sentence)) + len(sentence)
nrc = (cols + 1) / ro... | Chasego/cod | leetcode/418-Sentence-Screen-Fitting/SentenceScreenFitting_001.py | Python | mit | 921 |
"""
The outputs.py module represents some form of all outputs
from the Automater program to include all variation of
output files. Any addition to the Automater that brings
any other output requirement should be programmed in this module.
Class(es):
SiteDetailOutput -- Wrapper class around all functions that print out... | CSIRTUK/TekDefense-Automater | outputs.py | Python | mit | 39,375 |
#!/usr/bin/env python
import argparse
import getpass
import sys
import csv
from cassandra.auth import PlainTextAuthProvider
from cassandra.cqlengine import connection
from ddb import configuration
import utils
from coveragestore import SampleCoverage
from collections import defaultdict
def get_target_amplicons(fi... | dgaston/ddbio-variantstore | Misc_and_Old/create_sample_coverage_reports.py | Python | mit | 3,582 |
# -*- coding: utf-8 -*-
"""Parse Archimate XML Exchange File Format into a MongoDB DB""" | RafaAguilar/archi2mongodb | archimate2mongodb/pkg/utils/__init__.py | Python | mit | 88 |
from django.core.management.base import NoArgsCommand
from django.conf import settings
class Command(NoArgsCommand):
help = "Removes CompSlides from the database that do not have matching files on the drive."
def handle_noargs(self, **options):
from stager.staging.models import CompSlide
im... | broderboy/ai-stager | stager/staging/management/commands/cleanupslides.py | Python | mit | 596 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# file include_bib.py
# This file is part of LyX, the document processor.
# Licence details can be found in the file COPYING.
# authors Richard Heck and [SchAirport]
# Full author contact details are available in file CREDITS
# This script is intended to include a BibTe... | hashinisenaratne/HSTML | lib/scripts/include_bib.py | Python | gpl-2.0 | 2,972 |
# -*- coding: UTF-8 -*-
"""
Copyright (C) 2015 tknorris
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.
... | wndias/bc.repository | script.module.urlresolver/lib/urlresolver/plugins/usersfiles.py | Python | gpl-2.0 | 2,201 |
# -*- coding: utf-8 -*-
from openerp import api, fields, models, _
from openerp.osv import expression
from openerp.tools import float_is_zero
from openerp.tools import float_compare, float_round
from openerp.tools.misc import formatLang
from openerp.exceptions import UserError, ValidationError
import time
import math... | zbqf109/goodo | openerp/addons/account/models/account_bank_statement.py | Python | gpl-3.0 | 46,649 |
#-*- coding:utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from datetime import date, datetime, timedelta
from openerp.osv import fields, osv
from openerp.tools import float_compare, float_is_zero
from openerp.tools.translate import _
from openerp.exceptions import Use... | QinerTech/QinerApps | openerp/addons/hr_payroll_account/hr_payroll_account.py | Python | gpl-3.0 | 9,968 |
# Orca
#
# Copyright 2006-2009 Sun Microsystems Inc.
# Copyright 2010 Joanmarie Diggs
#
# This library 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 Foundation; either
# version 2.1 of the License, or (at your op... | ruibarreira/linuxtrail | usr/lib/python3/dist-packages/orca/scripts/toolkits/J2SE-access-bridge/script.py | Python | gpl-3.0 | 10,245 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright: (c) 2017, Ansible Project
# 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__ ... | Shaps/ansible | lib/ansible/modules/files/file.py | Python | gpl-3.0 | 37,706 |
import util, pexpect, time, math
from pymavlink import mavwp
# a list of pexpect objects to read while waiting for
# messages. This keeps the output to stdout flowing
expect_list = []
def expect_list_clear():
'''clear the expect list'''
global expect_list
for p in expect_list[:]:
expect_list.remov... | owenson/ardupilot | Tools/autotest/common.py | Python | gpl-3.0 | 8,336 |
# Timed mute: !tm <player> <seconds> <reason>
# default time 5 minutes, default reason None
# by topologist June 30th 2012
from scheduler import Scheduler
from commands import add, admin, get_player, join_arguments, name
@name('tm')
@admin
def timed_mute(connection, *args):
protocol = connection.protocol
... | Architektor/PySnip | contrib/scripts/timedmute.py | Python | gpl-3.0 | 1,733 |
"""
This file contains the logic for cohorts, as exposed internally to the
forums, and to the cohort admin views.
"""
import logging
import random
import request_cache
from courseware import courses
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.core.validat... | pepeportela/edx-platform | openedx/core/djangoapps/course_groups/cohorts.py | Python | agpl-3.0 | 21,299 |
import unittest
from os.path import relpath
from coalib.results.SourcePosition import SourcePosition
from coala_utils.ContextManagers import prepare_file
class SourcePositionTest(unittest.TestCase):
def test_initialization(self):
with self.assertRaises(TypeError):
SourcePosition(None, 0)
... | coala/coala | tests/results/SourcePositionTest.py | Python | agpl-3.0 | 1,906 |
from . import ir_ui_view
| Vauxoo/website | website_lazy_load_image/models/__init__.py | Python | agpl-3.0 | 25 |
from __future__ import absolute_import
from dbm import *
from ..version_info import PY2
if PY2:
from . import dumb, gnu, ndbm
from whichdb import *
from anydbm import *
| EnTeQuAk/dotfiles | sublime-text-3/Packages/isort/pies/dbm/__init__.py | Python | unlicense | 184 |
"""Remove unused models
Revision ID: 3f289637f530
Revises: 4ba1dd8c3080
Create Date: 2014-04-17 11:08:50.963964
"""
# revision identifiers, used by Alembic.
revision = '3f289637f530'
down_revision = '4ba1dd8c3080'
from alembic import op
def upgrade():
op.drop_table('aggtestgroup')
op.drop_table('testgroup... | bowlofstew/changes | migrations/versions/3f289637f530_remove_unused_models.py | Python | apache-2.0 | 442 |
#!/usr/bin/env python
#
# Copyright 2013 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
#... | GBGamer/rust | src/etc/generate-deriving-span-tests.py | Python | apache-2.0 | 4,526 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 th... | punalpatel/st2 | contrib/runners/action_chain_runner/tests/unit/test_actionchain.py | Python | apache-2.0 | 40,041 |
input = """
1 2 0 0
1 3 0 0
1 4 0 0
1 5 0 0
1 6 0 0
1 7 0 0
1 8 0 0
1 9 0 0
1 10 0 0
1 11 0 0
1 12 0 0
1 13 0 0
1 14 0 0
1 15 0 0
1 16 0 0
1 17 0 0
1 18 0 0
1 19 0 0
1 20 0 0
1 21 0 0
1 22 0 0
1 23 0 0
1 24 0 0
1 25 0 0
1 26 0 0
1 27 0 0
1 28 0 0
1 29 0 0
1 30 0 0
1 31 0 0
1 32 0 0
1 33 0 0
1 34 0 0
1 35 0 0
1 36 0 0
1... | Yarrick13/hwasp | tests/asp/AllAnswerSets/aggregates/solitaire15.test.py | Python | apache-2.0 | 40,300 |
import sys
import socket
import fcntl
import struct
import random
import os
import shutil
import subprocess
import time
import csv
import ipaddress
# Run `python3 -m unittest discover` in this dir to execute tests
default_mount_options_nfs = "nfs hard,nointr,proto=tcp,mountproto=tcp,retry=30 0 0"
default_mount_option... | j-coll/opencga | opencga-app/app/cloud/azure/arm/scripts/mount.py | Python | apache-2.0 | 7,799 |
# 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 ... | reminisce/mxnet | tests/python/mkl/test_quantization_mkldnn.py | Python | apache-2.0 | 1,289 |