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 |
|---|---|---|---|---|---|
"""The tests for the Tasmota binary sensor platform."""
import copy
from datetime import timedelta
import json
from unittest.mock import patch
from hatasmota.utils import (
get_topic_stat_result,
get_topic_stat_status,
get_topic_tele_sensor,
get_topic_tele_will,
)
from homeassistant.components import ... | jawilson/home-assistant | tests/components/tasmota/test_binary_sensor.py | Python | apache-2.0 | 13,393 |
# Copyright 2017 The Meson development team
# 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 ... | mesonbuild/meson | mesonbuild/minit.py | Python | apache-2.0 | 7,660 |
From SimpleCV import Camera
# Initialize the camera
cam = Camera()
# Loop to continuously get images
while True:
# Get Image from camera
img = cam.getImage()
# Make image black and white
img = img.binarize()
# Draw the text "Hello World" on image
img.drawText("Hello World!")
# Show the image... | RoboticaBrasil/-ComputerVision | camera.py | Python | apache-2.0 | 336 |
#import In.entity
class RelationHistory(In.entity.Entity):
'''RelationHistory Entity class.
'''
def __init__(self, data = None, items = None, **args):
# default
self.relation_id = 0
self.action = ''
self.actor_entity_type = ''
self.actor_entity_id = 0
self.message = ''
super().__init__(data, item... | vinoth3v/In_addon_relation | relation/entity_relation_history.py | Python | apache-2.0 | 1,675 |
# -*- 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):
# Deleting field 'ToIndexStore.basemodel_ptr'
db.delete_column(u'catalog_... | Makeystreet/makeystreet | woot/apps/catalog/migrations/0029_auto__del_field_toindexstore_basemodel_ptr__add_field_toindexstore_id.py | Python | apache-2.0 | 26,077 |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | rahulunair/nova | nova/tests/unit/api/openstack/compute/test_image_metadata.py | Python | apache-2.0 | 17,106 |
"""File system module."""
# Copyright 2014 Cloudera 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... | cloudera/ibis | ibis/backends/impala/hdfs.py | Python | apache-2.0 | 17,817 |
#
# Copyright 2021 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 wri... | google/ghost-dataplane | orchestrator/src/docker.py | Python | apache-2.0 | 7,385 |
#!/usr/bin/env python
# Copyright 2017 Calico 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 ... | calico/basenji | bin/sonnet_predict_bed.py | Python | apache-2.0 | 9,710 |
#!/usr/bin/env python
# standard library imports
import signal
# third party related imports
import boto.sqs
import ujson
# local library imports
from mobile_push.config import setting
from mobile_push.logger import logger
from mobile_push.message_router import MessageRouter
keep_running = True
def sigterm_handl... | theKono/mobile-push | bin/competing_consumer.py | Python | apache-2.0 | 1,384 |
import os
import subprocess
from ruamel import yaml
import great_expectations as ge
context = ge.get_context()
# NOTE: The following code is only for testing and depends on an environment
# variable to set the gcp_project. You can replace the value with your own
# GCP project information
gcp_project = os.environ.ge... | great-expectations/great_expectations | tests/integration/docusaurus/setup/configuring_metadata_stores/how_to_configure_an_expectation_store_in_gcs.py | Python | apache-2.0 | 6,223 |
"""Support for KNX/IP climate devices."""
import voluptuous as vol
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice
from homeassistant.components.climate.const import (
STATE_DRY, STATE_ECO, STATE_FAN_ONLY, STATE_HEAT, STATE_IDLE, STATE_MANUAL,
SUPPORT_ON_OFF, SUPPORT_OPERATION_MODE,... | jamespcole/home-assistant | homeassistant/components/knx/climate.py | Python | apache-2.0 | 11,048 |
#!/usr/bin/env python3
############################################################################
# Copyright 2017 RIFT.IO Inc #
# #
# Licensed under the Apache License, Version 2.0 (the "License");... | RIFTIO/rift.ware-descriptor-packages | 4.3/src/nsd/haproxy_waf_http_ns/scripts/waf_config.py | Python | apache-2.0 | 9,663 |
# Copyright (c) 2010-2013 OpenStack, 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 ... | zackmdavis/python-swiftclient | tests/test_multithreading.py | Python | apache-2.0 | 14,131 |
import concurrent
from concurrent.futures._base import Future
import json
from threading import Barrier
import time
import unittest
import requests_mock
from rpcclient.client import RpcClient
from rpcclient.deserialize import DictDeserializer
from rpcclient.exceptions import RemoteFailedError
from rpcclient.handlers im... | ajillion-by-crossrider/ajillion-rpc-client | rpcclient/test/test_with_httpretty.py | Python | apache-2.0 | 17,368 |
"""
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 ... | alexryndin/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.2/services/YARN/package/scripts/historyserver.py | Python | apache-2.0 | 7,308 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | davidzchen/tensorflow | tensorflow/python/kernel_tests/cwise_ops_binary_test.py | Python | apache-2.0 | 36,605 |
#!/usr/bin/env python
#
# Copyright 2020 Confluent 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... | confluentinc/examples | clients/cloud/python/ccloud_lib.py | Python | apache-2.0 | 5,500 |
from django.shortcuts import redirect
from django.shortcuts import render
from django.views.decorators.cache import never_cache
from django.contrib.auth.decorators import permission_required
from django.contrib.auth.decorators import login_required
from registration.backends import get_backend
def register(request, ba... | chop-dbhi/biorepo-portal | registration/views.py | Python | bsd-2-clause | 3,005 |
import happybase
from StringIO import StringIO
from PIL import Image
def decode_image_PIL(binary_data):
""" Returns PIL image from binary buffer.
"""
f = StringIO(binary_data)
img = Image.open(f)
return img
if __name__=="__main__":
tab_image = 'image_cache'
col_image = dict()
col_imag... | svebk/DeepSentiBank_memex | scripts/tests/deprecated/read_image_from_hbase.py | Python | bsd-2-clause | 875 |
import os
import json
import tempfile
import urllib, urllib2
import requests
from indra.java_vm import autoclass, JavaException
import indra.databases.pmc_client as pmc_client
from processor import ReachProcessor
def process_pmc(pmc_id):
xml_str = pmc_client.get_xml(pmc_id)
with tempfile.NamedTemporaryFile() ... | decarlin/indra | indra/reach/reach_api.py | Python | bsd-2-clause | 3,264 |
import copy
import re
import sys
import tempfile
import unittest
from mock.tests.support import ALWAYS_EQ
from mock.tests.support import is_instance
from mock import (
call, DEFAULT, patch, sentinel,
MagicMock, Mock, NonCallableMock,
NonCallableMagicMock, AsyncMock,
create_autospec, mock
)
from mock.mo... | testing-cabal/mock | mock/tests/testmock.py | Python | bsd-2-clause | 72,280 |
import logging
from redash.query_runner import *
from redash.utils import json_dumps
logger = logging.getLogger(__name__)
try:
from influxdb import InfluxDBClusterClient
enabled = True
except ImportError:
enabled = False
def _transform_result(results):
result_columns = []
result_rows = []
... | chriszs/redash | redash/query_runner/influx_db.py | Python | bsd-2-clause | 2,575 |
import unittest
from pyramid import testing
class ViewTests(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
def tearDown(self):
testing.tearDown()
def test_my_view(self):
from formhelpers2.views import comment
request = testing.DummyRequest()
in... | tholo/formhelpers2 | formhelpers2/tests.py | Python | bsd-2-clause | 406 |
"""
Python module presenting an API to an ELM327 serial interface
(C) 2015 Jamie Fraser <fwaggle@fwaggle.org>
http://github.com/fwaggle/pyELM327
Please see License.txt and Readme.md.
"""
# Pretty much taken from https://en.wikipedia.org/wiki/OBD-II_PIDs
__pids ={
0x01: {
# TODO: ignoring fuel system #2 atm
0x... | fwaggle/pyELM327 | elm327/pids.py | Python | bsd-2-clause | 14,201 |
# *****************************************************************
# Copyright (c) 2013 Massachusetts Institute of Technology
#
# Developed exclusively at US Government expense under US Air Force contract
# FA8721-05-C-002. The rights of the United States Government to use, modify,
# reproduce, release, perform, disp... | y4n9squared/HEtest | hetest/python/circuit_generation/ibm/ibm_wire.py | Python | bsd-2-clause | 1,345 |
#!/usr/bin/env python
from __future__ import print_function
import time
import numpy as np
from numba import jit, stencil
@stencil
def jacobi_kernel(A):
return 0.25 * (A[0,1] + A[0,-1] + A[-1,0] + A[1,0])
@jit(parallel=True)
def jacobi_relax_core(A, Anew):
error = 0.0
n = A.shape[0]
m = A.shape[1]... | jriehl/numba | examples/laplace2d/laplace2d-pa.py | Python | bsd-2-clause | 1,199 |
# -*- coding: utf-8 -*-
"""
Custom module logger
"""
import logging
module_name = 'moflow'
logger = logging.getLogger(module_name)
logger.addHandler(logging.NullHandler()) # best practice to not show anything
def use_basic_config(level=logging.INFO, format=logging.BASIC_FORMAT):
"""Add basic configuration and f... | mwtoews/moflow | moflow/_logger.py | Python | bsd-2-clause | 773 |
from airy.core.conf import settings
from mongoengine import *
connect(getattr(settings, 'database_name', 'airy'))
| letolab/airy | airy/core/db.py | Python | bsd-2-clause | 116 |
from .sizedist import *
from .WD01 import make_WD01_DustSpectrum
| eblur/dust | astrodust/distlib/__init__.py | Python | bsd-2-clause | 67 |
import ana
import weakref
default_plugins = { }
# This is a base class for SimState plugins. A SimState plugin will be copied along with the state when the state is branched. They
# are intended to be used for things such as tracking open files, tracking heap details, and providing storage and persistence for SimProc... | zhuyue1314/simuvex | simuvex/plugins/plugin.py | Python | bsd-2-clause | 1,953 |
from collections import Counter
from django.contrib import admin
from django.contrib.auth.models import User
from gem.models import GemCommentReport, Invite
from gem.rules import ProfileDataRule, CommentCountRule
from molo.commenting.admin import MoloCommentAdmin, MoloCommentsModelAdmin
from molo.commenting.models i... | praekelt/molo-gem | gem/admin.py | Python | bsd-2-clause | 3,379 |
# Copyright 2014-2016 Morgan Delahaye-Prat. All Rights Reserved.
#
# Licensed under the Simplified BSD License (the "License");
# you may not use this file except in compliance with the License.
import pytest
from hypr.helpers.mini_dsl import Range
@pytest.mark.populate(10)
class TestIntervalTypes:
models = 'S... | project-hypr/hypr2 | tests/models/test_range_filter.py | Python | bsd-2-clause | 4,895 |
#!/usr/bin/env python
'''Tool to generate computationally-rarefied graphs kmer spectra'''
import sys
import os
import scipy.stats
from optparse import OptionParser
import numpy as np
import ksatools
def fract(aa, epsilon, threshold):
'''Evaluates the fraction of theoretically-subsampled spectra
above a speci... | MG-RAST/kmerspectrumanalyzer | ksatools/rare.py | Python | bsd-2-clause | 6,250 |
from django.contrib.auth import get_user_model
from django.db import models
from imagekit.cachefiles import ImageCacheFile
from imagekit.registry import generator_registry
from imagekit.templatetags.imagekit import DEFAULT_THUMBNAIL_GENERATOR
from rest_framework import serializers
User = get_user_model()
class Thumb... | incuna/django-user-management | user_management/api/avatar/serializers.py | Python | bsd-2-clause | 2,513 |
# -*- mode: python; coding: utf-8 -*-
# Copyright 2016 the HERA Collaboration
# Licensed under the 2-clause BSD License.
"""This script is some boilerplate needed by Alembic to do its fancy database
migration stuff.
"""
# A hack so that we can get the librarian_server module.
import sys
sys.path.insert(0, '.')
fro... | HERA-Team/librarian | alembic/env.py | Python | bsd-2-clause | 1,321 |
import dragonfly
import dragonfly.pandahive
import bee
from bee import connect
import math, functools
from panda3d.core import NodePath
import dragonfly.scene.unbound, dragonfly.scene.bound
import dragonfly.std
import dragonfly.io
import dragonfly.canvas
import Spyder
# ## random matrix generator
from random impor... | agoose77/hivesystem | manual/movingpanda/panda-12b.py | Python | bsd-2-clause | 7,088 |
import sys, pygame, math, random, time
from Level import *
from Player import *
from Enemy import *
from NPC import *
from Menu import *
from Item import *
pygame.init()
clock = pygame.time.Clock()
width = 1000
height = 700
size = width, height
bgColor = r,b,g = 255,255,255
screen = pygame.display.set_mode(size)
m... | KRHS-GameProgramming-2015/Adlez | Adlez.py | Python | bsd-2-clause | 6,657 |
# coding: utf-8
import flask
from flask import url_for
from .base import BaseTestCase
from . import utils
class TOCTestCase(BaseTestCase):
# TOC
def test_the_title_of_the_article_list_when_language_pt(self):
"""
Teste para verificar se a interface do TOC esta retornando o título no
... | scieloorg/opac | opac/tests/test_interface_TOC.py | Python | bsd-2-clause | 11,514 |
__author__ = 'Mark Worden'
from mi.core.log import get_logger
log = get_logger()
from mi.idk.config import Config
import unittest
import os
from mi.dataset.driver.adcps_jln.stc.adcps_jln_stc_recovered_driver import parse
from mi.dataset.dataset_driver import ParticleDataHandler
class SampleTest(unittest.TestCase... | JeffRoy/mi-dataset | mi/dataset/driver/adcps_jln/stc/test/test_adcps_jln_stc_recovered_driver.py | Python | bsd-2-clause | 1,063 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_chart_bar10.py | Python | bsd-2-clause | 1,580 |
from envs.common import *
DEBUG = False
TEMPLATE_DEBUG = DEBUG
# EMAIL_BACKEND = 'django_ses.SESBackend'
STATIC_URL = 'http://%s.s3.amazonaws.com/' % AWS_STORAGE_BUCKET_NAME
COMPRESS_URL = STATIC_URL
FAVICON_URL = "%sfavicon.ico" % STATIC_URL
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
STATICFIL... | skoczen/weexist | project/envs/live.py | Python | bsd-2-clause | 451 |
#!/usr/bin/python
#
# Copyright (C) 2009, 2011 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,
# this l... | apyrgio/snf-ganeti | test/py/ganeti.mcpu_unittest.py | Python | bsd-2-clause | 9,694 |
from __future__ import print_function
import types
import warnings
import sys
import traceback
import pickle
from copy import deepcopy
import numpy as np
from scipy import sparse
from scipy.stats import rankdata
import struct
from sklearn.externals.six.moves import zip
from sklearn.externals.joblib import hash, Memor... | zorroblue/scikit-learn | sklearn/utils/estimator_checks.py | Python | bsd-3-clause | 71,139 |
#!/bin/env python
#==========================================================================
# (c) 2004 Total Phase, Inc.
#--------------------------------------------------------------------------
# Project : Aardvark Sample Code
# File : aaspi_file.c
#-------------------------------------------------------------... | oceansystemslab/thrusters_controller | docs/examples/aaspi_file.py | Python | bsd-3-clause | 5,024 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-13 18:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myblog', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | NischalLal/Humpty-Dumpty-SriGanesh | myblog/migrations/0002_contact_project_socialsite.py | Python | bsd-3-clause | 1,637 |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from ...territori.models import Territorio
class Command(BaseCommand):
help = 'Fix for provincie autonome'
def handle(self, *args, **options):
Territorio.objects.regioni().get(denominazione='TRENTINO-ALTO ADIGE/SUDTIROL').de... | DeppSRL/open-partecipate | project/open_partecipate/management/commands/fix_provincie_autonome.py | Python | bsd-3-clause | 995 |
from django.contrib import admin
from .models import dynamic_models
# Register your models here.
admin.site.register(dynamic_models.values())
| potar/django_test | django_test/dynamic_models/admin.py | Python | bsd-3-clause | 144 |
from __future__ import print_function
import numpy as np
import sys
import mesh.patch as patch
import compressible_sr.eos as eos
from util import msg
def init_data(my_data, rp):
""" initialize the bubble problem """
msg.bold("initializing the bubble problem...")
# make sure that we are passed a valid ... | zingale/pyro2 | compressible_sr/problems/bubble.py | Python | bsd-3-clause | 2,964 |
import os
import pygame
import sys
import threading, time
from pygame.locals import *
import logging
log = logging.getLogger('pytality.term.pygame')
log.debug("pygame version: %r", pygame.version.ver)
"""
A mapping of special keycodes into representative strings.
Based off the keymap in WConio, but with 'alt... | jtruscott/ld27 | pytality/term_pygame.py | Python | bsd-3-clause | 11,584 |
"""Benchmark Walk algorithm"""
import numpy as np
import bench
import obsoper.walk
class BenchmarkWalk(bench.Suite):
def setUp(self):
longitudes, latitudes = np.meshgrid([1, 2, 3],
[1, 2, 3],
indexing="ij")
sel... | met-office-ocean/obsoper | benchmarks/bench_walk.py | Python | bsd-3-clause | 551 |
"""flatty - marshaller/unmarshaller for light-schema python objects"""
VERSION = (0, 1, 2)
__version__ = ".".join(map(str, VERSION))
__author__ = "Christian Haintz"
__contact__ = "christian.haintz@orangelabs.at"
__homepage__ = "http://packages.python.org/flatty"
__docformat__ = "restructuredtext"
from flatty import *... | ceelian/Flatty | src/flatty/__init__.py | Python | bsd-3-clause | 423 |
from django.db import models
SETTING_NAME = (
('conf_space', 'Confluence Space Key'),
('conf_page', 'Confluence Page'),
('jira_project', 'JIRA Project Code Name'),
('github_project', 'GitHub Project'),
)
class AppSettings(models.Model):
name = models.CharField(max_length=50,
primary_ke... | pbs/powwow | powwow/apps/models.py | Python | bsd-3-clause | 467 |
#!/usr/bin/env python
import sys
from . import main
if __name__ == '__main__':
sys.exit(main.main())
| jfining/mincss | mincss/__main__.py | Python | bsd-3-clause | 109 |
# $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
#
... | DLR-SC/DataFinder | src/datafinder/persistence/principal_search/constants.py | Python | bsd-3-clause | 2,236 |
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
... | amnona/heatsequer | ui/plotmetadata.py | Python | bsd-3-clause | 1,925 |
import os
import shutil
class BasicOperations_TestClass:
TEST_ROOT =' __test_root__'
def setUp(self):
self.regenerate_root
print(self.TEST_ROOT)
assert os.path.isdir(self.TEST_ROOT)
def tearDown(self):
return True
def test_test(self):
assert self.bar == 1
... | aleksclark/replfs | nosetests/basic_operations_tests.py | Python | bsd-3-clause | 469 |
import Adafruit_BBIO.GPIO as GPIO
import time
a=0
b=0
def derecha(channel):
global a
a+=1
print 'cuenta derecha es {0}'.format(a)
def izquierda(channel):
global b
b+=1
print 'cuenta izquierda es {0}'.format(b)
GPIO.setup("P9_11", GPIO.IN)
GPIO.setup("P9_13", GPIO.IN)
GPIO.add_event_detect("P9_11", GP... | edwarod/quickbot_bbb | test.py | Python | bsd-3-clause | 571 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import logging
from django.core.cache import cache
from django.test import TestCase
from django.contrib import admin
from physical.tests.factory import DiskOfferingFactory, EnvironmentFactory
from physical.errors import NoDiskOfferingGreat... | globocom/database-as-a-service | dbaas/physical/tests/test_disk_offering.py | Python | bsd-3-clause | 9,097 |
from __future__ import print_function
from permuta import *
import permstruct
import permstruct.dag
from permstruct import *
from permstruct.dag import taylor_dag
import sys
# -- Example from Kuszmaul paper -- #
# STATUS ================================================ >
task = '1234_1243_2134_2431_4213'
patts = [ ... | PermutaTriangle/PermStruct | examples/classical_5x4/1234_1243_2134_2431_4213.py | Python | bsd-3-clause | 693 |
import sys
import os
import os.path as op
__version__ = '2.0.5'
from cfchecker.cfchecks import getargs, CFChecker
def cfchecks_main():
"""cfchecks_main is based on the main program block in cfchecks.py
"""
(badc,coards,uploader,useFileName,standardName,areaTypes,udunitsDat,version,files)=getargs(sys.ar... | RosalynHatcher/CFChecker | src/cfchecker/__init__.py | Python | bsd-3-clause | 598 |
"""fitsdiff is now a part of Astropy.
Now this module just provides a wrapper around astropy.io.fits.diff for backwards
compatibility with the old interface in case anyone uses it.
"""
import os
import sys
from astropy.io.fits.diff import FITSDiff
from astropy.io.fits.scripts.fitsdiff import log, main
def fitsdiff(... | spacetelescope/stsci.tools | lib/stsci/tools/fitsdiff.py | Python | bsd-3-clause | 1,825 |
"""
Model class that unites theory with data.
"""
import logging
logger = logging.getLogger('Model_mod')
import copy
import scipy
import SloppyCell
import SloppyCell.Residuals as Residuals
import SloppyCell.Collections as Collections
import SloppyCell.Utility as Utility
from . import KeyedList_mod as KeyedList_mod
... | GutenkunstLab/SloppyCell | SloppyCell/Model_mod.py | Python | bsd-3-clause | 42,681 |
###############################################################################
##
## Copyright (C) 2014-2015, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | hjanime/VisTrails | vistrails/core/modules/basic_modules.py | Python | bsd-3-clause | 69,112 |
"""Base class for all the objects in SymPy"""
from __future__ import print_function, division
from .assumptions import BasicMeta, ManagedProperties
from .cache import cacheit
from .sympify import _sympify, sympify, SympifyError
from .compatibility import (iterable, Iterator, ordered,
string_types, with_metaclass, ... | mafiya69/sympy | sympy/core/basic.py | Python | bsd-3-clause | 59,455 |
# coding: utf-8
"""
Picarto.TV API Documentation
The Picarto.TV API documentation Note, for fixed access tokens, the header that needs to be sent is of the format: `Authorization: Bearer yourTokenHere` This can be generated at https://oauth.picarto.tv/ For chat API, see https://docs.picarto.tv/chat/chat.pr... | Sythelux/Picarto.bundle | Contents/Libraries/Shared/PicartoClientAPI/models/video_search_result.py | Python | bsd-3-clause | 3,920 |
import six
from decimal import Decimal as D
from oscar.core.loading import get_model
from django.test import TestCase
from oscar.test import factories, decorators
from oscar.apps.partner import abstract_models
Partner = get_model('partner', 'Partner')
PartnerAddress = get_model('partner', 'PartnerAddress')
Country =... | DrOctogon/unwash_ecom | tests/unit/partner/model_tests.py | Python | bsd-3-clause | 4,657 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from libmozdata import utils as lmdutils
from auto_nag import utils
from auto_nag.bzcleaner import BzCleaner
from auto_... | mozilla/relman-auto-nag | auto_nag/scripts/workflow/p1_no_assignee.py | Python | bsd-3-clause | 3,281 |
# Experiment with boundary for collections
L = [0, 1, 2, 3]
print('-------- Part A --------')
# Index beyond, generates a IndexError exception
try:
L[4] # part (a) of question
except IndexError as err:
print('IndexError Exception', err)
print('-------- Part B --------')
# Slice out of bounds
sliced = L[-10:10... | skellykiernan/pylearn | II/q2.py | Python | bsd-3-clause | 809 |
from django_nose.tools import assert_equal
from pontoon.base.tests import TestCase
from pontoon.base.utils import NewlineEscapePlaceable, mark_placeables
class PlaceablesTests(TestCase):
def test_newline_escape_placeable(self):
"""Test detecting newline escape sequences"""
placeable = NewlineEsca... | participedia/pontoon | pontoon/base/tests/test_placeables.py | Python | bsd-3-clause | 3,308 |
## Automatically adapted for numpy.oldnumeric Jun 27, 2008 by -c
# $Id$
#
# Copyright (C) 2003-2008 Greg Landrum and Rational Discovery LLC
# All Rights Reserved
#
"""
"""
from __future__ import print_function
import numpy
from rdkit.ML.DecTree import SigTree
from rdkit.ML import InfoTheory
try:
from rdkit.ML... | adalke/rdkit | rdkit/ML/DecTree/BuildSigTree.py | Python | bsd-3-clause | 7,724 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 12, transform = "Logit", sigma = 0.0, exog_count = 100, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Logit/trend_MovingAverage/cycle_12/ar_12/test_artificial_128_Logit_MovingAverage_12_12_100.py | Python | bsd-3-clause | 267 |
from django.core.urlresolvers import reverse, resolve
from django.utils.html import escape
from .base import Widget
from ..libs import List as TogaList, SimpleListElement as TogaSimpleListElement
class SimpleListElement(Widget):
def __init__(self, content, detail=None, **style):
super(SimpleListElement, ... | freakboy3742/toga_web_demo | toga_django/widgets/list.py | Python | bsd-3-clause | 3,836 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounting', '0027_more_prbac_bootstrap'),
('accounting', '0030_remove_softwareplan_visibility_trial_internal'),
]
operations = [
... | qedsoftware/commcare-hq | corehq/apps/accounting/migrations/0031_merge.py | Python | bsd-3-clause | 324 |
import msgpackrpc
import time
class SumServer(object):
def sum(self, x, y):
return x + y
def sleepy_sum(self, x, y):
time.sleep(1)
return x + y
server = msgpackrpc.Server(SumServer())
server.listen(msgpackrpc.Address("localhost", 18800))
server.start()
| jpfairbanks/streaming | server.py | Python | bsd-3-clause | 286 |
import logging
import pytest
from traitlets.config import Config
from dockerspawner import DockerSpawner
def test_deprecated_config(caplog):
cfg = Config()
cfg.DockerSpawner.image_whitelist = {"1.0": "jupyterhub/singleuser:1.0"}
log = logging.getLogger("testlog")
spawner = DockerSpawner(config=cfg,... | jupyter/dockerspawner | tests/test_deprecations.py | Python | bsd-3-clause | 972 |
from django.conf.urls import url
from .views import GetAuthToken, GetAuthTokenFacebook
urlpatterns = [
url(r'^$', GetAuthToken.as_view()),
url(r'^facebook/$', GetAuthTokenFacebook.as_view()),
]
| jsmesami/naovoce | src/user/api/token_auth/urls.py | Python | bsd-3-clause | 205 |
import os
def get(var, default, type_=None):
"""Return a function to recover latest env variable contents."""
def _env_getter():
"""Recover the latest setting from the environment."""
val = os.environ.get(var, default)
if type_:
val = type_(val)
return val
retur... | oisinmulvihill/nozama-cloudsearch | nozama/cloudsearch/service/environ_settings.py | Python | bsd-3-clause | 599 |
"""Helper module for parsing AWS ini config files."""
import os
try:
import configparser
except ImportError:
import ConfigParser as configparser
AWS_CLI_CREDENTIALS_PATH = "~/.aws/credentials"
AWS_CLI_CONFIG_PATH = "~/.aws/config"
DEFAULT_PROFILE_NAME = os.getenv("AWS_DEFAULT_PROFILE", "default")
class N... | bearops/ebzl | ebzl/lib/config.py | Python | bsd-3-clause | 3,082 |
from django.test import TestCase
from trix.trix_core import trix_markdown
class TestTrixMarkdown(TestCase):
def test_simple(self):
self.assertEqual(
trix_markdown.assignment_markdown('# Hello world\n'),
'<h1>Hello world</h1>')
def test_nl2br(self):
self.assertEqual(
... | devilry/trix2 | trix/trix_core/tests/test_trix_markdown.py | Python | bsd-3-clause | 421 |
import os
import mimetypes
from django.conf import settings as django_settings
from django.db import models
from django.template.defaultfilters import slugify
from django.core.files.images import get_image_dimensions
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes.models impor... | carljm/django-adminfiles | adminfiles/models.py | Python | bsd-3-clause | 3,651 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Cabu documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 15 00:48:40 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... | thylong/cabu | docs/conf.py | Python | bsd-3-clause | 9,963 |
import factory
import factory.django
from faker import Faker
from machina.core.db.models import get_model
from machina.test.factories.auth import UserFactory
from machina.test.factories.conversation import TopicFactory
faker = Faker()
TopicPoll = get_model('forum_polls', 'TopicPoll')
TopicPollOption = get_model('fo... | ellmetha/django-machina | machina/test/factories/polls.py | Python | bsd-3-clause | 1,023 |
def _types_gen(T):
yield T
if hasattr(T, 't'):
for l in T.t:
yield l
if hasattr(l, 't'):
for ll in _types_gen(l):
yield ll
class Type(type):
""" A rudimentary extension to `type` that provides polymorphic
types for run-time type checking of JSON data types. IE:
assert type... | regmi/codenode-unr | codenode/external/jsonrpc/types.py | Python | bsd-3-clause | 1,860 |
#!/usr/bin/env python
'''
Main entry to worch from a waf wscript file.
Use the following in the options(), configure() and build() waf wscript methods:
ctx.load('orch.tools', tooldir='.')
'''
def options(opt):
opt.add_option('--orch-config', action = 'store', default = 'orch.cfg',
help='G... | hwaf/hwaf | py-hwaftools/orch/tools.py | Python | bsd-3-clause | 7,185 |
from djpcms import sites
from djpcms.http import get_http
from djpcms.template import RequestContext, loader
from djpcms.views.baseview import djpcmsview
class badview(djpcmsview):
def __init__(self, template, httphandler):
self.template = template
self.httphandler = httphandler
super... | strogo/djpcms | djpcms/views/specials.py | Python | bsd-3-clause | 963 |
""" Models for controlling the text and visual formatting of tick
labels on Bokeh plot axes.
"""
from __future__ import absolute_import
from .tickers import Ticker
from ..model import Model
from ..core.properties import abstract
from ..core.properties import Bool, Int, String, Enum, Auto, List, Dict, Either, Instance... | quasiben/bokeh | bokeh/models/formatters.py | Python | bsd-3-clause | 13,993 |
"""
Base/mixin classes for the spatial backend database operations and the
`SpatialRefSys` model the backend.
"""
import re
from django.contrib.gis import gdal
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
class BaseSpatialOperations(object):
"""
This module holds... | ericholscher/django | django/contrib/gis/db/backends/base.py | Python | bsd-3-clause | 11,584 |
__author__ = 'oglebrandon'
import logging as logger
import types
from ib.ext.EWrapper import EWrapper
def showmessage(message, mapping):
try:
del(mapping['self'])
except (KeyError, ):
pass
items = mapping.items()
items.sort()
print '### %s' % (message, )
for k, v in items:
... | CarterBain/Medici | ib/client/msg_wrapper.py | Python | bsd-3-clause | 6,312 |
#!/usr/bin/env python
#(c) 2014 Emory University. All Rights Reserved
# Code written by: Michael Sauria (mgehrin@emory.edu)
import sys
import os
import subprocess
file_list, tmp_dir, out_dir, fastq_dump = sys.argv[1:5]
files = []
for line in open(file_list, 'r'):
line = line.strip()
if not line or line.start... | bxlab/HiFive_Paper | Scripts/Support/fetch_sra_files.py | Python | bsd-3-clause | 1,432 |
# encoding: utf-8
'''
Various vertical coordinates
Presently, only ocean s-coordinates are supported. Future plans will be to
include all of the vertical coordinate systems defined by the CF conventions.
'''
__docformat__ = "restructuredtext en"
import numpy as np
import warnings
class s_coordinate(object):
""... | kshedstrom/pyroms | pyroms/pyroms/vgrid.py | Python | bsd-3-clause | 14,274 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['BoxCox'] , ['LinearTrend'] , ['BestCycle'] , ['MLP'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_BoxCox/model_control_one_enabled_BoxCox_LinearTrend_BestCycle_MLP.py | Python | bsd-3-clause | 151 |
from eisoil.core.exception import CoreException
class ScheduleException(CoreException):
def __init__(self, desc):
self._desc = desc
def __str__(self):
return "Schedule: %s" % (self._desc,)
class ScheduleOverbookingError(ScheduleException):
def __init__(self, schedule_subject, resou... | EICT/C-BAS | src/vendor/schedule/scheduleexceptions.py | Python | bsd-3-clause | 857 |
from __future__ import unicode_literals
from collections import Counter
from itertools import groupby
from operator import itemgetter
import numpy
from django.db.models import F
from tracpro.charts.formatters import format_number
from .utils import get_numeric_values
from . import rules
def get_map_data(response... | rapidpro/tracpro | tracpro/polls/maps.py | Python | bsd-3-clause | 2,550 |
from setuptools import setup, find_packages
setup(
name="gevent-websocket",
version="0.3.6",
description="Websocket handler for the gevent pywsgi server, a Python network library",
long_description=open("README.rst").read(),
author="Jeffrey Gelens",
author_email="jeffrey@noppo.pro",
license... | imankulov/gevent-websocket | setup.py | Python | bsd-3-clause | 946 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent 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:
# * Redistributions of source code must retain the above copyright
# no... | nuagenetworks/bambou | bambou/__init__.py | Python | bsd-3-clause | 12,559 |
import numpy as np
from pysal.lib.common import requires
@requires('matplotlib')
def shift_colormap(cmap, start=0, midpoint=0.5, stop=1.0, name='shiftedcmap'):
'''
Function to offset the "center" of a colormap. Useful for
data with a negative min and positive max and you want the
middle of the colormap... | lixun910/pysal | pysal/model/mgwr/utils.py | Python | bsd-3-clause | 6,190 |
"""Template loader for app-namespace"""
import errno
import io
import os
from collections import OrderedDict
import django
from django.apps import apps
try:
from django.template import Origin
except ImportError: # pragma: no cover
class Origin(object):
def __init__(self, **kwargs):
for k, ... | Fantomas42/django-app-namespace-template-loader | app_namespace/loader.py | Python | bsd-3-clause | 4,361 |
from sympy.core import (Basic, Expr, S, C, Symbol, Wild, Add, sympify, diff,
oo, Tuple, Dummy, Equality, Interval)
from sympy.core.symbol import Dummy
from sympy.core.compatibility import ordered_iter
from sympy.integrals.trigonometry import trigintegrate
from sympy.integrals.deltafunctions imp... | minrk/sympy | sympy/integrals/integrals.py | Python | bsd-3-clause | 31,617 |
#! /usr/bin/env python
from zplot import *
t = table('horizontalintervals.data')
canvas = postscript('horizontalintervals.eps')
d = drawable(canvas, coord=[50,30], xrange=[0,900],
yrange=[0,t.getmax('nodes')])
axis(d, xtitle='Throughput (MB)', xauto=[0,900,300],
ytitle='Nodes', yauto=[0,t.getmax('no... | z-plot/z-plot | examples/basics/horizontalintervals.py | Python | bsd-3-clause | 492 |