code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#! /usr/bin/env python2
"""
Copyright 2018 ARM Limited
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 ... | betzw/mbed-os | tools/run_icetea.py | Python | apache-2.0 | 12,808 |
# This is a demo script. It finds all tissue sections, crops them and downloads them as separate images.
import girder_client
import urllib2
import numpy as np
import scipy
import cv2
def load_low_res(gc, item_id, mag):
chip_url = gc.urlBase + "item/%s/tiles/region?magnification=%f&encoding=JPEG&jpegQuality=9... | law12019/deep_learning | scripts/download_tissue_sections.py | Python | apache-2.0 | 3,540 |
#
# Copyright (c) SAS Institute 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 w... | sassoftware/rmake | rmake/multinode/workernode.py | Python | apache-2.0 | 16,683 |
"""
WSGI config for isa project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "isa.settings")
from django.core.wsgi impo... | sthiers/Marc | isa/wsgi.py | Python | apache-2.0 | 381 |
# Copyright 2019 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, ... | google-research/dads | unsupervised_skill_learning/skill_discriminator.py | Python | apache-2.0 | 10,897 |
import mongomock
import pymongo
from mock import mock
from mdstudio.db.impl.mongo_client_wrapper import MongoClientWrapper
from mdstudio.db.impl.mongo_database_wrapper import MongoDatabaseWrapper
from mdstudio.unittest import db
from mdstudio.unittest.db import DBTestCase
class TestMongoClientWrapper(DBTestCase):
... | MD-Studio/MDStudio | mdstudio/mdstudio/tests/db/impl/test_mongo_client_wrapper.py | Python | apache-2.0 | 1,761 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | shakamunyi/tensorflow | tensorflow/python/ops/histogram_ops.py | Python | apache-2.0 | 2,771 |
#!/usr/bin/env python
from __future__ import print_function
import sys
import os
import argparse
import re
"""
Clean up valgrind output and produce
1) suppressions file containing everything that is considered to be a false positive.
2) a file containing everything else (these should be actual errors)
3)... | CWSL/access-cm-tools | debug/valgrind_suppressions.py | Python | apache-2.0 | 3,664 |
# -*- coding: utf-8 -*-
# Copyright 2016 Mark Brand - c01db33f (at) 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 obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.... | c01db33f/reil | arm64/control_flow.py | Python | apache-2.0 | 1,207 |
from setuptools import setup, find_packages
import sys, os, io
# List all of your Python package dependencies in the
# requirements.txt file
def readfile(filename, split=False):
with io.open(filename, encoding="utf-8") as stream:
if split:
return stream.read().split("\\n")
re... | rchristie/mapclientplugins.smoothfitstep | setup.py | Python | apache-2.0 | 1,287 |
import sys
from oba_rvtd_deployer.aws import launch_new, tear_down
from oba_rvtd_deployer.gtfs import validate_gtfs, update
from oba_rvtd_deployer.oba import install, deploy, start, copy_gwt,\
install_watchdog
def run_all():
'''A single script to deploy OBA in one command to a new EC2 instance
'''
... | trilliumtransit/oba_rvtd_deployer | oba_rvtd_deployer/master.py | Python | apache-2.0 | 1,050 |
import convert
import random
import tensorflow as tf
import tensorflow.contrib as tfc
from tensorflow.contrib.learn import DNNRegressor, SKCompat
random.seed(0xbedbeef) # so we get consistent results
fit_boards = []
fit_moves = []
with open('train_data/acm.pgn') as pgn:
boards, moves = convert.generate_next_... | wspeirs/nnpychess | main.py | Python | apache-2.0 | 767 |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from rest_framework import authentication, exceptions
from rest_framework.compat import is_authenticated
from rest_framework.exceptions import APIException
from rest_framework.pagination... | snazy2000/netbox | netbox/utilities/api.py | Python | apache-2.0 | 6,324 |
"""Support for BH1750 light sensor."""
from __future__ import annotations
from functools import partial
import logging
from i2csense.bh1750 import BH1750 # pylint: disable=import-error
import smbus
import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorDeviceClass,
... | mezz64/home-assistant | homeassistant/components/bh1750/sensor.py | Python | apache-2.0 | 4,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 the Li... | openstack/ironic-inspector | ironic_inspector/migrations/versions/2970d2d44edc_add_manage_boot_to_nodes.py | Python | apache-2.0 | 999 |
# Copyright 2015 Observable Networks
#
# 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 ... | obsrvbl/flowlogs-reader | tests/test_flowlogs_reader.py | Python | apache-2.0 | 38,204 |
# Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
import torch
import torch.nn.functional as F
from ..builder import BBOX_CODERS
from ..transforms import bbox_rescale
from .base_bbox_coder import BaseBBoxCoder
@BBOX_CODERS.register_module()
class BucketingBBoxCoder(BaseBBoxCoder):
""... | open-mmlab/mmdetection | mmdet/core/bbox/coder/bucketing_bbox_coder.py | Python | apache-2.0 | 14,119 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... | huggingface/transformers | src/transformers/models/roberta/modeling_roberta.py | Python | apache-2.0 | 67,545 |
"""Support for Blink Alarm Control Panel."""
import logging
from homeassistant.components.alarm_control_panel import AlarmControlPanel
from homeassistant.const import (
ATTR_ATTRIBUTION, STATE_ALARM_ARMED_AWAY, STATE_ALARM_DISARMED)
from . import BLINK_DATA, DEFAULT_ATTRIBUTION
_LOGGER = logging.getLogger(__name... | jamespcole/home-assistant | homeassistant/components/blink/alarm_control_panel.py | Python | apache-2.0 | 2,424 |
# Copyright (c) OpenMMLab. All rights reserved.
import warnings
from abc import abstractmethod
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import force_fp32
from mmdet.core import build_bbox_coder, multi_apply
from mmdet.core.anchor.point_generator import MlvlPointGenerator
fro... | open-mmlab/mmdetection | mmdet/models/dense_heads/anchor_free_head.py | Python | apache-2.0 | 13,958 |
from setuptools import setup
setup(
name='simulator',
version='0.1.0',
description='',
license='Apache-2.0',
url='',
author=['Felipe Zapata'],
author_email='tifonzafel_gmail.com',
keywords='microservices',
packages=['simulator', 'simulator.simulator', 'simulator.storage'],
class... | felipeZ/microservices | setup.py | Python | apache-2.0 | 555 |
# Copyright 2014 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 agreed t... | openstack/tempest | tempest/api/compute/test_networks.py | Python | apache-2.0 | 1,541 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2015 flw_dream@126.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless ... | AquariusCoder/xtpuiplugin | tools/makeplugin.py | Python | apache-2.0 | 4,793 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | salamb/girder | plugins/worker/server/constants.py | Python | apache-2.0 | 1,027 |
"""
WSGI config for codingPortal project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_... | SJIT-Hackerspace/SJIT-CodingPortal | codingPortal/wsgi.py | Python | apache-2.0 | 401 |
#!/usr/bin/env python
# @@xxx_skip_license@@
# -*- coding: utf-8 -*-
# @PydevCodeAnalysisIgnore
#
# Generated Tue Nov 6 11:26:05 2018 by generateDS.py version 2.29.24.
# Python 3.7.0 (default, Jul 23 2018, 20:22:55) [Clang 9.1.0 (clang-902.0.39.2)]
#
# Command line options:
# ('-f', '')
# ('--no-questions', '')
... | our-city-app/oca-backend | src/rogerthat/bizz/service/mfd/gen.py | Python | apache-2.0 | 404,967 |
from model.contact import Contact
import os.path
import jsonpickle
import getopt
import sys
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of contact", "output file"])
except getopt.GetoptError as err:
sys.exit(2)
n = 5
f = "data/contact.json"
for option, arg in opts:
if option == '-n':
... | IKeiran/FPT-Sinyakov | generator/contact.py | Python | apache-2.0 | 775 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from datetime import date
import os.path
import re
from flask import abort, current_app, jsonify, render_template, redirect, request, send_file, url_for
from flask.ext.babel import gettext, format_date
from sqlalchemy.orm import undefer, undefer_group
from sqlalchemy.or... | teampopong/pokr.kr | pokr/views/meeting.py | Python | apache-2.0 | 6,379 |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
i... | kubevirt/client-python | test/test_v1_hotplug_volume_status.py | Python | apache-2.0 | 951 |
from flask import (
Blueprint,
g,
request,
url_for,
Response,
redirect,
flash
)
from .utils import project_file, template, user_audit_record, app_logger
from .auth import require_login
from .models import User, Transcript, Taxonomy
admin = Blueprint('admin', __name__)
@admin.route('/admi... | memphis-iis/gluten | gluten/admin.py | Python | apache-2.0 | 3,285 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | hfp/tensorflow-xsmm | tensorflow/python/keras/metrics_test.py | Python | apache-2.0 | 67,231 |
from . import foreach
from . import toiterable | dbrattli/RxPY | rx/linq/observable/blocking/__init__.py | Python | apache-2.0 | 46 |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | sillywilly42/simian | src/tests/simian/mac/models/munki_test.py | Python | apache-2.0 | 33,982 |
from database.model import Session, Grainbin, TemperatureCable, TemperatureSensor
from monitor.rrd.rrd import RRD
from .message import Message
class GrainbinInfo(Message):
def __init__(self, source, destination):
Message.__init__(self, source, destination)
self.command = 'rescan'
... | nstoik/sensor_monitor | message/grainbin_message.py | Python | apache-2.0 | 4,897 |
import math
def solution(n):
steps = int(math.ceil(math.log(n,2)))
if n & 1 == 1:
steps += 1
if n > 1:
if int(math.log(n+1,2)) == math.log(n+1,2):
steps -= 1
if int(math.log(n-1,2)) == math.log(n+1,2):
steps -= 1
return steps
solutions = [ 0, 0, 1, 2, 2,... | perlygatekeeper/glowing-robot | google_test/fuel-injection-perfection/test_log_2.py | Python | artistic-2.0 | 4,655 |
# $language = "python"
# $interface = "1.0"
# for GCCSFRMs01-06, SCCSFRMs01-12
import os
import csv
import re
import sys
import msvcrt
int_total10g = 0
int_total1g = 0
def connect(str_hostname, str_username, str_password, csvws_10g, csvws_1g, csvws_pair):
"""
(str, str, str, csv.writer, csv.writer) -> None
Conne... | kelvinongtoronto/SecureCRT | sfrms_pairs.py | Python | artistic-2.0 | 4,716 |
from lib.Site import *
from lib.Page import *
from lib.Element import *
from lib.Forms import *
from lib.Render import *
from flask import Flask, request, render_template, redirect, send_file
from flask.ext.basicauth import BasicAuth
from werkzeug import secure_filename
import json
import sys
import string
import html
... | ayypot/dillys-place | app.py | Python | bsd-2-clause | 12,694 |
# coding: utf-8
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
impor... | mindbody/API-Examples | SDKs/Python/swagger_client/models/pagination_response.py | Python | bsd-2-clause | 6,069 |
import os
import datetime
import lxml
import subprocess
import HTMLParser
from urlparse import urlparse, urlunparse
from rknfilter.conf import settings
from rknfilter.exceptions import VerifyDumpSigError
class DumpFiles(object):
def __init__(self, **kwargs):
self.xml_path = kwargs.get('xml_path', settings... | DmitryFillo/rknfilter | rknfilter/core/dump.py | Python | bsd-2-clause | 3,801 |
# encoding: 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):
# Deleting model 'DistributionChannel'
db.delete_table('subscriptions_distributionchannel')
# Ren... | mjumbewu/django-subscriptions | subscriptions/migrations/0004_auto__del_distributionchannel__del_field_rsschannel_distributionchanne.py | Python | bsd-2-clause | 9,074 |
## An example of the simple Schnorr sigma protocol
## to prove that one knows x, such that h = g^x for
## a public generator h and g.
from petlib.bn import Bn
from petlib.ec import EcGroup, EcPt
from hashlib import sha256
def challenge(elements):
"""Packages a challenge in a bijective way"""
elem = [len(ele... | gdanezis/petlib | examples/zkp.py | Python | bsd-2-clause | 1,694 |
__version__ = '0.1.1'
from .OxCaptcha import OxCaptcha
| gbaydin/OxCaptcha | OxCaptcha/__init__.py | Python | bsd-2-clause | 56 |
#!/usr/bin/env python
"""
Copyright (c) 2013, Citrix 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
list of condi... | xenserver/python-libs | xcp/repository.py | Python | bsd-2-clause | 12,464 |
import unittest
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import SVC
from skmultilearn.ensemble import RakelD
from skmultilearn.tests.classifier_basetest import ClassifierBaseTest
TEST_LABELSET_SIZE = 3
class RakelDTest(ClassifierBaseTest):
def get_rakeld_with_svc(self):
return Rakel... | scikit-multilearn/scikit-multilearn | skmultilearn/ensemble/tests/test_rakeld.py | Python | bsd-2-clause | 1,966 |
__version__ = '0.4.4'
__url__ = 'https://github.com/imposeren/django-happenings'
| imposeren/django-happenings | happenings/__init__.py | Python | bsd-2-clause | 81 |
"""
@package mi.dataset.driver.wfp.ctdpfk.test.test_driver
@file marine-integrations/mi/dataset/driver/wfp/ctdpfk/test/test_driver.py
@author Bill French (template)
@author Roger Unwin
@brief Test cases for wfp/ctdpfk driver
USAGE:
Make tests verbose and provide stdout
* From the IDK
$ bin/test_driver
... | ooici/marine-integrations | mi/dataset/driver/issm/nutnrb/test/test_driver.py | Python | bsd-2-clause | 11,328 |
# -*- coding: utf-8 -*-
import unittest
from romanizer import to_hepburn, to_kunrei
class HepbernTestCase(unittest.TestCase):
def test_hepburn(self):
self.assertEqual(u'', to_hepburn(u''))
self.assertEqual(u'aiueo', to_hepburn(u'あいうえお'))
self.assertEqual(u'gumma', to_hepburn(u'ぐんま'))
... | kosugi/alfred.romanizer | test_romanizer.py | Python | bsd-2-clause | 2,289 |
import re
import struct
import string
import timepro
import logging
import uuid
import sys
# Import lzma this way so we get the built in version for
# Python 3.3 or the backported one otherwize. Don't just
# do a try/catch for import lzma because the older
# pyliblzma uses that package name, and we do not want
# to us... | braddockcg/internet-in-a-box | iiab/zimpy.py | Python | bsd-2-clause | 17,389 |
import math
import numpy
import random
import operator
import types
import numpy as np
import h5py
import IPython as ipy
import os
import sys
def one_l_print(string, pad=20):
for _ in range(pad): string += ' '
string += '\r'
sys.stdout.write(string)
sys.stdout.flush()
# Define a context manager to su... | dhadfieldmenell/bootstrapping-lfd | scripts/dhm_utils.py | Python | bsd-2-clause | 24,683 |
from fabric.api import settings, sudo, hide
def vhost_exists(vhost_name):
with settings(hide('running', 'stdout', 'stderr'), warn_only=True):
return sudo('rabbitmqctl list_vhosts | grep -c {0}'.format(vhost_name)) >= '1'
def user_exists(username):
with settings(hide('running', 'stdout', 'stderr'), w... | sociateru/fabtools | fabtools/rabbitmq.py | Python | bsd-2-clause | 948 |
import matplotlib
from kid_readout.roach import baseband
matplotlib.use('agg')
import numpy as np
import time
import sys
from kid_readout.utils import data_file,sweeps
from kid_readout.analysis.resonator import Resonator
ri = baseband.RoachBasebandWide()
#ri.initialize(use_config=False)
#f0s = np.load('/home/gjones/... | ColumbiaCMB/kid_readout | apps/data_taking_scripts/old_scripts/fast_noise_sweep_downstairs.py | Python | bsd-2-clause | 2,991 |
from pyomo.environ import *
infinity = float('inf')
model = AbstractModel()
# Foods
model.F = Set()
# Nutrients
model.N = Set()
# Cost of each food
model.c = Param(model.F, within=PositiveReals)
# Amount of nutrient in each food
model.a = Param(model.F, model.N, within=NonNegativeReals)
# Lower and upper bound... | Pyomo/PyomoGallery | diet/diet.py | Python | bsd-2-clause | 1,317 |
# ------------------------------------------------------------------------------
# Copyright (c) 2010-2014, EVEthing team
# 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... | cmptrgeekken/evething | thing/models/planetarypin.py | Python | bsd-2-clause | 3,456 |
import os
import uuid
from api.authentication.AuthenticatedHandler import AuthenticatedHandler
from api.Utils import authenticated
from api.model.models import User
class PUTHandler(AuthenticatedHandler):
@authenticated
def post(self, user_name):
session = self.settings['db']
allowed_types =... | CrystalKoan/morpheus-api | api/routes/Uploads.py | Python | bsd-2-clause | 3,102 |
import logging
import os
import types
from io import BytesIO, IOBase
import pickle
import string
from collections import defaultdict
import archinfo
from archinfo.arch_soot import SootAddressDescriptor, ArchSoot
import cle
from .misc.ux import deprecated
l = logging.getLogger(name=__name__)
def load_shellcode(shell... | iamahuman/angr | angr/project.py | Python | bsd-2-clause | 33,203 |
import json
import re
from gernetHelpers import *
import operator
def recurseDependencies(dependenciesDict):
newDependenciesDict = dict()
hasNewData = False
for k,v in dependenciesDict.items():
read_data = readJson(os.path.join(PROJECTS_ROOT_PATH,getPath(v["path"]),'gernet.json') )
if read_data == None:
... | osblinnikov/gernet | src/parsing_c_kernel.py | Python | bsd-2-clause | 23,127 |
#! /usr/bin/env python3
import setuptools
import os
pkgs = setuptools.find_packages()
setuptools.setup(
name = "PiCon Registration Agent",
version = "0.0.1",
author = "Team Kickass",
author_email = "ryan@u13.net",
description = "PiCon registration agent for the PiCon console registry",
license... | piconsole/picon | agent/setup.py | Python | bsd-2-clause | 549 |
import errno
import os
import re
import requests
import sys
import signal
import webbrowser
from contextlib import closing
from time import sleep
from distutils.version import StrictVersion
from livestreamer import (Livestreamer, StreamError, PluginError,
NoPluginError)
from livestreamer.cac... | breunigs/livestreamer | src/livestreamer_cli/main.py | Python | bsd-2-clause | 22,087 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json, sys, copy, os, re
import pprint
import locale
import csv
locale.setlocale(locale.LC_ALL, 'en_US')
from collections import defaultdict
from operator import itemgetter
pp = pprint.PrettyPrinter(indent=4)
# For MacPorts ... need to eliminate TODO
sys.path.append... | Kevin-Prichard/webrobots-kickstarter-python | wr_ks_reader.py | Python | bsd-2-clause | 6,159 |
"""Parse MUV datasets.
MUV datasets are provided as supporting data to
http://jcheminf.springeropen.com/articles/10.1186/1758-2946-5-26
This script can also be used for the other datasets in the supporting data.
"""
import gflags as flags
import glob
import gzip
import logging
import os
import re
import sys
flags.D... | skearnes/color-features | paper/code/parse_muv.py | Python | bsd-3-clause | 1,468 |
from django.conf.urls import *
from corehq.apps.export.views import (
CreateFormExportView,
CreateCaseExportView,
CreateCustomFormExportView,
CreateCustomCaseExportView,
EditCustomFormExportView,
EditCustomCaseExportView,
DeleteCustomExportView,
)
urlpatterns = patterns(
'corehq.apps.ex... | puttarajubr/commcare-hq | corehq/apps/export/urls.py | Python | bsd-3-clause | 1,147 |
from django.test import TestCase
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.linked_domain.models import DomainLink
class DomainLinkUrlsTest(TestCase):
domain = 'domain-link-tests'
@classmethod
def setUpClass(cls):
super(DomainLinkUrlsTest, cls).setUpClass()
... | dimagi/commcare-hq | corehq/apps/linked_domain/tests/test_domain_link_methods.py | Python | bsd-3-clause | 2,197 |
# Copyright 2012 Dorival de Moraes Pedroso. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
bl_info = {
'name' : 'FEMmesh mesh generator',
'author' : 'Dorival Pedroso',
'version' : (1, 0),
'blender' : (2, 6, ... | cpmech/tlfem | scripts/tlfem_blender_addon.py | Python | bsd-3-clause | 17,995 |
from __future__ import division, print_function, absolute_import
import numpy.testing as npt
import numpy as np
from scipy._lib.six import xrange
import pytest
from scipy import stats
from .common_tests import (check_normalization, check_moment, check_mean_expect,
check_var_expect, check_sk... | jamestwebber/scipy | scipy/stats/tests/test_discrete_basic.py | Python | bsd-3-clause | 8,418 |
"""
pyshtools constants for Earth's Moon.
Each object is an astropy Constant that possesses the attributes name, value,
unit, uncertainty, and reference.
"""
import numpy as _np
from astropy.constants import Constant as _Constant
from astropy.constants import G as _G
gm = _Constant(
abbrev='gm_moon',
name='G... | MarkWieczorek/SHTOOLS | pyshtools/constants/Moon.py | Python | bsd-3-clause | 5,749 |
"""
Copyright (c) 2013, Jurriaan Bremer
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 notice,
this list of conditions and the followi... | radare/darm | darmgen.py | Python | bsd-3-clause | 24,307 |
"""
Various complex queries that have been problematic in the past.
"""
from __future__ import unicode_literals
import threading
from django.db import models
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
class DumbCategory(models.Model):
pass
class ProxyCategory(Dum... | denisenkom/django | tests/queries/models.py | Python | bsd-3-clause | 13,742 |
import json
import uuid
from datetime import datetime, timedelta
from django.conf import settings
from django.test import TestCase
from django.utils.http import urlencode
from casexml.apps.case.mock import CaseBlock
from dimagi.utils.parsing import json_format_datetime
from corehq.apps.api.resources import v0_4
from... | dimagi/commcare-hq | corehq/apps/api/tests/form_resources.py | Python | bsd-3-clause | 14,905 |
'''
test_custom_cache.py: Testing custom cache function
Copyright (c) 2016-2017, Vanessa Sochat. All rights reserved.
"Singularity" Copyright (c) 2016, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Ener... | Trophime/singularity | libexec/python/tests/test_custom_cache.py | Python | bsd-3-clause | 2,123 |
#!/usr/bin/env python
import os
import sys
from os.path import join
from distutils.sysconfig import get_python_inc
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('special', parent_package, top_path)
define_macros = []
if ... | huard/scipy-work | scipy/special/setup.py | Python | bsd-3-clause | 2,409 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Little utility that help automate tests and optimization with XDS.
"""
__version__ = "0.4.5"
__date__ = "12-06-2012"
__author__ = "Pierre Legrand (pierre.legrand _at_ synchrotron-soleil.fr)"
__copyright__ = "Copyright (c) 2004-2012 Pierre Legrand"
__license__ = "New B... | jsburg/xdsme | XDS/runxds.py | Python | bsd-3-clause | 2,046 |
import tempfile
from django import forms
from django.conf import settings
from django.contrib import admin
from django.core.exceptions import ValidationError
from django.forms import BaseInlineFormSet
from django.utils.safestring import mark_safe
from olympia.amo.storage_utils import copy_stored_file
from olympia.amo... | eviljeff/olympia | src/olympia/hero/admin.py | Python | bsd-3-clause | 3,617 |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
Script for building docker image. This is expected to run inside container.
"""
import json
import logging
import tempfile
from atomic_reactor... | fatherlinux/atomic-reactor | atomic_reactor/inner.py | Python | bsd-3-clause | 13,409 |
import functools
import datetime
from .exceptions import EmitterValidationError
REDUCE_TYPES = set(['sum', 'count', 'min', 'max', 'sumsqr'])
class base_emitter(object):
fluff_emitter = ''
def __init__(self, reduce_type='sum'):
assert reduce_type in REDUCE_TYPES, 'Unknown reduce type'
self.r... | qedsoftware/commcare-hq | corehq/ex-submodules/fluff/emitters.py | Python | bsd-3-clause | 2,557 |
from __future__ import absolute_import
import re
from django.conf.urls import patterns, include, url
from sentry.plugins import plugins
urlpatterns = patterns("")
for _plugin in plugins.all():
_plugin_url_module = _plugin.get_url_module()
if _plugin_url_module:
urlpatterns += (url("^%s/" % re.escap... | mvaled/sentry | src/sentry/plugins/base/urls.py | Python | bsd-3-clause | 368 |
#!/usr/bin/env python
# coding=utf-8
__author__ = 'bjorne'
"""Handles all commands regarding analysis, i.e. get_available_analysis_modules and perform_analysis.
Uses JSON objects to represent the analysismodules, which are returned from get_available_analysis_modules(username, dbHandler), on the form:
{
"analysismo... | improve-project/platform | AnalysisPackage/analysishandler.py | Python | bsd-3-clause | 16,009 |
from django.test import TestCase
class InsertRowFuncionalTestCase(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
| kula1922/kfusiontables | kfusiontables/tests/functional/test_insert_row.py | Python | bsd-3-clause | 151 |
class VirtualMachine:
def __init__(self, ram_size=512, executing=True):
self.data = {i: None for i in range(ram_size)}
self.stack = []
self.executing = executing
self.pc = 0
self.devices_start = 256
def push(self, value):
"""Push something onto the stack."""
... | darbaga/simple_compiler | virtual_machine.py | Python | bsd-3-clause | 2,139 |
import matplotlib.pyplot as plt
import numpy as np
import numpy.testing as npt
import pandas as pd
import pandas.util.testing as pdt
import pytest
class TestModalityEstimator(object):
@pytest.fixture
def step(self):
return 1.
@pytest.fixture
def vmax(self):
return 20.
@pytest.fix... | YeoLab/anchor | anchor/tests/test_bayesian.py | Python | bsd-3-clause | 2,694 |
# -*- coding: utf-8 -*-
import unittest
import os
from mongrey.utils import get_db_config
from mongrey.storage.sql import models
from ...base import BaseFlaskTestCase
from ...web.test_login import LoginTestCaseMixin
@unittest.skipIf(os.environ.get('MONGREY_STORAGE', "sql") != "sql", "Skip no sql tests")
class Login... | radical-software/mongrey | mongrey/tests/storage/sql/test_login.py | Python | bsd-3-clause | 1,144 |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# 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... | threefoldfoundation/app_backend | plugins/tff_backend/bizz/payment.py | Python | bsd-3-clause | 3,919 |
from django.db import models
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from cyndiloza.apps.news import managers
from cyndiloza.apps.places.models import Place
from cyndiloza.apps.people.models import Person
class Author(models.Model):
name = models.CharF... | richardcornish/cyndiloza | cyndiloza/apps/news/models.py | Python | bsd-3-clause | 10,632 |
"""
Define the interface for a plugin class.
"""
import abc
class PluginPrototype(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def set_model(self, likelihood_model_instance):
"""
Set the model to be used in the joint minimization. Must be a LikelihoodModel instance.
"... | sybenzvi/3ML | threeML/plugin_prototype.py | Python | bsd-3-clause | 1,341 |
from setuptools import setup, find_packages
setup(
name='django-userprofile',
version='0.0.6',
description='Django user profile app.',
long_description = open('README.rst', 'r').read() + open('AUTHORS.rst', 'r').read() + open('CHANGELOG.rst', 'r').read(),
author='Praekelt Foundation',
author_em... | praekelt/django-userprofile | setup.py | Python | bsd-3-clause | 1,168 |
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
UserModel = get_user_model()
class ModelBackend:
"""
Authenticates against settings.AUTH_USER_MODEL.
"""
def authenticate(self, request, username=None, password=None, **kwargs):
if username is No... | ebar0n/django | django/contrib/auth/backends.py | Python | bsd-3-clause | 6,648 |
# Copyright (c) 2016, the GPyOpt Authors
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
from ..util.general import reshape
class alpine1:
'''
Alpine1 function
:param bounds: the box constraints to define the domain in which the function is optimized.
:param sd: sta... | SheffieldML/GPyOpt | GPyOpt/objective_examples/experimentsNd.py | Python | bsd-3-clause | 4,131 |
from setuptools import setup, find_packages
install_requires = [
'South',
'django-piston',
'django-extensions',
'python-memcached',
'gunicorn',
'psycopg2',
]
setup(
name = "obudget",
version = "0.1",
url = 'http://github.com/hasadna/obudget',
description = "B... | daonb/obudget | setup.py | Python | bsd-3-clause | 967 |
# Use stackless to bounce functions and avoid the stack.
def Bouncy(f):
try:
import stackless
def new_f(*args, **kwargs):
def wrap(channel, f, args, kwargs):
try:
result = f(*args, **kwargs)
channel.send(result)
except Exception as e:
channel.send(e)
channel = stackless.channel()
... | jpverkamp/schempy | Decorators.py | Python | bsd-3-clause | 960 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
import page_sets
import re
from core import perf_benchmark
from telemetry.core import util
from telemetry.page import action_runner
from... | highweb-project/highweb-webcl-html5spec | tools/perf/benchmarks/service_worker.py | Python | bsd-3-clause | 7,142 |
#
# Copyright (c) 2009-2015, Jack Poulson
# All rights reserved.
#
# This file is part of Elemental and is under the BSD 2-Clause License,
# which can be found in the LICENSE file in the root directory, or at
# http://opensource.org/licenses/BSD-2-Clause
#
import El
m = 2000
n = 4000
k = 3000
testMehrotra = Tru... | birm/Elemental | examples/interface/QPAffine.py | Python | bsd-3-clause | 4,826 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Quantization'] , ['Lag1Trend'] , ['Seasonal_WeekOfYear'] , ['ARX'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Quantization/model_control_one_enabled_Quantization_Lag1Trend_Seasonal_WeekOfYear_ARX.py | Python | bsd-3-clause | 165 |
# -*- 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 index on 'Comment', fields ['fetched']
db.create_index(u'vkontakte_board_comment', ['fetched'])
... | ramusus/django-vkontakte-board | vkontakte_board/migrations/0006_auto.py | Python | bsd-3-clause | 17,402 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Test Fixtures
.. moduleauthor:: Timothy Helton <timothy.j.helton@gmail.com>
"""
from chromalog.mark.objects import Mark
import testfixtures as tf
class ChromalogLogCapture(tf.LogCapture):
"""Class will remove color markings from chromalog logger entries.
.... | TimothyHelton/strumenti | strumenti/tests/fixtures.py | Python | bsd-3-clause | 1,215 |
"""
Put Canvas specific configuration here.
Note that this project has three different configuration files:
/var/canvas/website/settings.py
That is where we keep all Django specific settings.
/var/canvas/common/configuration.py
That is where we keep AWS and infrastructure related settings. No... | canvasnetworks/canvas | website/canvas/knobs.py | Python | bsd-3-clause | 5,468 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""
==============
desiutil.plots
==============
Module for code plots.
"""
import os
import warnings
from datetime import date
from types import MethodType
import numpy as np
import numpy.ma
import matplotlib.pyplot as plt
import ... | desihub/desiutil | py/desiutil/plots.py | Python | bsd-3-clause | 41,964 |
# Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Script to remove unused gconv charset modules from a build."""
from __future__ import print_function
import ahocorasick
import glob
import lddtree
im... | mxOBS/deb-pkg_trusty_chromium-browser | third_party/chromite/scripts/gconv_strip.py | Python | bsd-3-clause | 12,027 |
import os
import shutil
import pickle
from tests import add, TestCase
from mutagen.id3 import ID3FileType
from mutagen.easyid3 import EasyID3, error as ID3Error
from tempfile import mkstemp
class TEasyID3(TestCase):
def setUp(self):
fd, self.filename = mkstemp('.mp3')
os.close(fd)
empty = ... | hanvo/MusicCloud | Crawler/Install Files/mutagen-1.22/tests/test_easyid3.py | Python | bsd-3-clause | 11,253 |
from django.shortcuts import render
from .models import Sample, SampleGroup
from files.models import File
from tasks.models import Task
import json
from tasks.tasks import annotate_vcf, run_qc
from django.shortcuts import render, redirect, get_object_or_404
from django.db.models import Q
from django.contrib import me... | raonyguimaraes/mendelmd | samples/views.py | Python | bsd-3-clause | 3,269 |
from datetime import datetime
from decimal import Decimal
import six
from unittest import TestCase
from databuild import functional
class FunctionalTestCase(TestCase):
def test_compose(self):
f1 = lambda x: x + 1
f2 = lambda x: x + 2
f3 = lambda x: x + 3
fn = functional.compose(f1... | databuild/databuild | databuild/tests/test_functional.py | Python | bsd-3-clause | 1,696 |
# Copyright (c) 2008-2015 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for `calc.tools` module."""
import numpy as np
from metpy.calc import find_intersections, nearest_intersection_idx, resample_nn_1d
from metpy.testing import assert_ar... | ahill818/MetPy | metpy/calc/tests/test_tools.py | Python | bsd-3-clause | 1,247 |