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 |
|---|---|---|---|---|---|
"""Philips Hue sensors platform tests."""
import asyncio
from collections import deque
import datetime
import logging
from unittest.mock import Mock
import aiohue
from aiohue.sensors import Sensors
import pytest
from homeassistant import config_entries
from homeassistant.components import hue
from homeassistant.compo... | fbradyirl/home-assistant | tests/components/hue/test_sensor_base.py | Python | apache-2.0 | 14,721 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | h2oai/sparkling-water | ci/databricksTests/test.py | Python | apache-2.0 | 1,504 |
# -*- coding: ISO-8859-1 -*-
# Copyright 2010 Dirk Holtwick, holtwick.it
#
# 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... | drchrono/pisa | sx/pisa3/pisa_tables.py | Python | apache-2.0 | 14,153 |
"""
Test basics of Minidump debugging.
"""
from __future__ import print_function
from six import iteritems
import lldb
import os
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class MiniDumpUUIDTestCase(TestBase):
mydir = TestBase.compute_mydi... | apple/swift-lldb | packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py | Python | apache-2.0 | 8,803 |
import numpy as np
import tensorflow as tf
DEFAULT_PADDING = 'SAME'
def layer(op):
'''Decorator for composable network layers.'''
def layer_decorated(self, *args, **kwargs):
# Automatically set a name if not provided.
name = kwargs.setdefault('name', self.get_unique_name(op.__name__))
... | mlwithtf/mlwithtf | chapter_12/caffe-tensorflow/kaffe/tensorflow/network.py | Python | apache-2.0 | 9,629 |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2019-12-26 23:05
# Ported from the PyTorch implementation https://github.com/zysite/biaffine-parser
import tensorflow as tf
from hanlp.utils.tf_util import tf_bernoulli
class Biaffine(tf.keras.layers.Layer):
def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True... | hankcs/HanLP | hanlp/components/parsers/biaffine_tf/layers.py | Python | apache-2.0 | 4,019 |
'''
Test for deleting and expunge image created vm ops.
The key step:
-add image1
-create vm1 from image1
-export image1
-create image2 from vm1
-export image2
-create vm2 from image2
-del and expunge image1
-change vm2 os
-del image2
-resize data volume on vm2
-expunge image2
-change vm2 state
@author: PxChen
'''
i... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/bs/test_del_exp_img_cpyd_vm_resize_rvol_reimg_mig.py | Python | apache-2.0 | 3,564 |
def nabar_action_handler_nabar_autocomplete(context, action = None, query = '', **args):
''''''
results = []
query = query.replace('%', '').replace("'", '')
try:
db = IN.db
connection = db.connection
limit = 10
# TODO: make it dynamic
cursor = db.execute('''SELECT
n.id,
n.name,
... | vinoth3v/In | In/nabar/page/nabar_autocomplete.py | Python | apache-2.0 | 1,286 |
# -*- coding: utf-8 -*-
"""
docker_registry.drivers.s3
~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a s3 based driver.
"""
# This fixes an issue where boto sends unicode to gevent.socket.getaddrinfo in
# an eventlet causing the event pool to hang in a deadlock state.
# This initiates the unicode => idna conversion outside of ... | baseboxorg/registry-debootstrap | docker_registry/drivers/s3.py | Python | apache-2.0 | 5,503 |
# Copyright 2011 OpenStack LLC.
# 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 b... | paulmathews/nova | nova/tests/scheduler/test_filter_scheduler.py | Python | apache-2.0 | 12,312 |
# -*- coding: utf-8 -*-
'''
Created on Sep 24, 2013
@author: jin
'''
from django.db import models
from django.contrib.auth.models import User
import re
from django.core import validators
class UserProfile(models.Model):
user=models.OneToOneField(User,verbose_name=r'用户')
gender=models.CharField(verbose_name=r'性... | SnailJin/house | house/models.py | Python | apache-2.0 | 1,183 |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import object
class AvatarPlugin(object):
"""
Abstract interface for all Avata... | Bounti/avatar-python | avatar/plugins/avatar_plugin.py | Python | apache-2.0 | 835 |
import time
from sinchsms import SinchSMS
number = 'your_phone_mobile_number'
message = 'your_sms_message'
#sign up https://www.sinch.com to get app_key & app secret
client = SinchSMS(your_app_key, your_app_secret)
print("Sending '%s' to %s" % (message, number))
response = client.send_message(number, message)
messag... | amanmehara/programming-app-data | Python/Sending SMS/SendingSms.py | Python | apache-2.0 | 559 |
#---------------------------------------------------------------------------
# Introdução a Programação de Computadores - IPC
# Universidade do Estado do Amazonas - UEA
# Prof. Jucimar Jr
# Adham Lucas da Silva Oliveira 1715310059
# Gabriel Barroso da Silva Lima 1715310011
# Guilherme Silva ... | jucimarjr/IPC_2017-1 | lista06/lista06_lista02_questao18.py | Python | apache-2.0 | 1,298 |
# prog6_6.py
# This program sums a list of numbers using functions
# <Chad Hobbs>
def sumList(nums): #function sums a list
total = 0
for i in range((len(nums))):
total = total + nums[i]
return total
def main(): # Main program
initial = [2,3,4,5,6,7,8,9]
print("The o... | itsallvoodoo/csci-school | CSCI220/Week 08 - MAR05-09/prog6_6.py | Python | apache-2.0 | 434 |
import torch
from allennlp.training.learning_rate_schedulers.learning_rate_scheduler import LearningRateScheduler
@LearningRateScheduler.register("noam")
class NoamLR(LearningRateScheduler):
"""
Implements the Noam Learning rate schedule. This corresponds to increasing
the learning rate linearly for the ... | allenai/allennlp | allennlp/training/learning_rate_schedulers/noam.py | Python | apache-2.0 | 2,903 |
# -*- coding: utf-8 -*-
'''
程序:focus on Mi1 on ganji & 58
版本:0.1
@author: Michael Wan
日期:2015.02.16
语言:Python 2.7
操作:输入带分页的地址,去掉最后面的数字,设置一下起始页数和终点页数。
功能:下载对应页码内的所有页面并存储为html文件。
@see: http://blog.csdn.net/pleasecallmewhy/article/details/8927832
'''
import re
import string, urllib2
import sys
import time... | onehao/opensource | pyml/hackerrank/2ndfun_email_tracker.py | Python | apache-2.0 | 623 |
__author__ = 'ono'
import unittest
from pubkey import *
class MyTestCase(unittest.TestCase):
def test_get_key_path(self):
self.assertEqual(
get_key_path("~/.ssh/", "id_rsa"),
("~/.ssh/", "id_rsa", "id_rsa.pub")
)
self.assertEqual(
get_key_path("~/.ssh/... | yuki2006/pubkey | test_pubkey.py | Python | apache-2.0 | 1,837 |
class Grid:
def __init__(self):
self.grid = [["Grass","Dirt","Grass"],["Dirt","Grass","Grass"],["Grass","Rock","Dirt"]]
@property
def height(self):
return len(self.grid)
@property
def width(self):
return len(self.grid[0])
def tile(self,x_pos,y_pos):
try:
... | mgrazebrook/dojo_modular_pyg0 | model.py | Python | apache-2.0 | 1,146 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
*****************************************
Author: zhlinh
Email: zhlinhng@gmail.com
Version: 0.0.1
Created Time: 2016-01-06
Last_modify: 2016-01-07
******************************************
'''
'''
There are two sorted arrays nums1 and num... | zhlinh/leetcode | 0004.Median of Two Sorted Arrays/solution.py | Python | apache-2.0 | 2,180 |
"""app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... | rnzaws/test-ci-codepipeline-elastic-beanstalk | app/app/urls.py | Python | apache-2.0 | 824 |
# 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 pprint import pformat
from six import iteritems
import re
class K8sIoApi... | kubevirt/client-python | kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_status.py | Python | apache-2.0 | 11,208 |
__author__ = 'kaneg'
import json
import os
server_host = '0.0.0.0'
server_port = 8080
debug = False
lxd_api_url = 'unix:/var/lib/lxd/unix.socket'
ssl_key_path = '~/.config/lxc/client.key'
ssl_crt_path = '~/.config/lxc/client.crt'
web_shell_host = 'http://%(host)s:9090/?arg=%(container)s'
login_required = True
admin_u... | kaneg/lxdui | settings.py | Python | apache-2.0 | 493 |
#
# 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
# ... | yeming233/rally | tests/unit/plugins/openstack/test_service.py | Python | apache-2.0 | 1,441 |
from pyneat import Conf
from pyneat import Innovations
from pyneat.genotype import Genome
import mock
import random
def test_genome():
genome = Genome.minimal_fully_connected(0, (3, 2))
assert genome.neurons == [3, 0, 2]
assert len(genome.genes) == 6
def test_crossover_equal_mom_fit():
innovs = Inno... | jasonb5/pyneat | tests/test_genome.py | Python | apache-2.0 | 3,859 |
# Copyright 2013 IBM Corp.
# Copyright 2013 Red Hat, 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 r... | HybridF5/jacket | jacket/compute/conductor/rpcapi.py | Python | apache-2.0 | 16,186 |
"""Event loop using a selector and related classes.
A selector is a "notify-when-ready" multiplexer. For a subclass which
also includes support for signal handling, see the unix_events sub-module.
"""
__all__ = ['BaseSelectorEventLoop']
import collections
import errno
import functools
import socket
import warnings
... | vxgmichel/asyncio | asyncio/selector_events.py | Python | apache-2.0 | 39,781 |
# 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... | nathanbjenx/cairis | cairis/gui/SingleGoalPanel.py | Python | apache-2.0 | 2,502 |
#!/usr/bin/env python
#
# Copyright (C) 2015 Google Inc.
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe 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 you... | istyf/robotframework-ycm | robot/hook.py | Python | apache-2.0 | 898 |
import os
"""
This file contains constants for various things in the app.
DONT STRING MATCH
put stuff in here and import to other files.
Also dont import things into here, circular dependencies == bad
"""
STATE_CHOICES = [
("FL", "Florida"),
]
COUNTRY_CHOICES = [
("US", "United States of America! YEAH!"),
]
... | amberlallen/qipr_approver | qipr_approver/approver/constants.py | Python | apache-2.0 | 1,459 |
# Copyright 2006 James Tauber and contributors
#
# 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 agre... | lovelysystems/pyjamas | library/pyjamas/ui/UIObject.py | Python | apache-2.0 | 7,596 |
# this makes ctypes friendlier (for me, anyways)
from ctypes import *
## page permissions
PAGE_EXECUTE = 0x10
PAGE_EXECUTE_READ = 0x20
PAGE_EXECUTE_READWRITE = 0x40
PAGE_EXECUTE_WRITECOPY = 0x80
PAGE_NOACCESS = 0x01
PAGE_READONLY = 0x02
PAGE_READWRITE = 0x04
PAGE_WRITECOPY = 0x08
PAGE_GUARD = 0x100
PAGE_NOCACHE = 0x20... | arizvisa/syringe | lib/memorymanager/win32context.py | Python | bsd-2-clause | 7,811 |
# ------------------------------------------------------------------------------
# Copyright (c) 2010-2013, 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/contractseedingitem.py | Python | bsd-2-clause | 2,069 |
"""
Sample Python code with syntax that's only available in Python 2.
"""
0xDeadBeefCafeL
0xDeadBeefCafel
0123
0177
# All of the print statements
print
print "x"
print "a",
print 1, 2
print 1, 2,
print 1, 2, 93
print >>x
print >>x, 1
print >>x, 1,
print >>x, 9, 8
print >>x, 9, 8, 7
exec "x=1"
exec "x=1" in x
exec "... | JohnLunzer/flexx | flexx/pyscript/tests/python_sample2.py | Python | bsd-2-clause | 818 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Play one round of Tron.
Robert Xiao, Jan 31 2010
Colorization idea cribbed from Jeremy Roman (jbroman).
----------
2014 Jim Mahoney
tested with python 2.7.5
* added FPS option and slowed default animation
* changed "vis" options to "replay"
* modified r... | CorySpitzer/tron-engine | engines/round.py | Python | bsd-2-clause | 11,949 |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""A tiny Python program to check that Python is working.
Try running this program from t... | askbow/cloaked-octo-ironman | google-python-exercises/hello.py | Python | bsd-2-clause | 1,089 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, by the Pockets team, see AUTHORS.
# Licensed under the BSD License, see LICENSE for details.
"""Tests for :mod:`pockets.iterators` module."""
from __future__ import absolute_import
from unittest import TestCase
from pockets.iterators import peek_iter, modify_iter
from si... | tlatzko/spmcluster | .tox/docs/lib/python2.7/site-packages/tests/test_iterators.py | Python | bsd-2-clause | 11,599 |
# -*- coding: utf-8 -*-
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright Holders: Rene Milk, Stephan Rave, Felix Schindler
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function
from numbers import Numb... | michaellaier/pymor | src/pymor/la/numpyvectorarray.py | Python | bsd-2-clause | 14,173 |
# Copyright (c) 2012-2017, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
import collections
import json
import re
import sys
import types
from . import validators
__version__ = "1.9.3"
# constants for DeletionPolicy
Delete = 'Delete'
Retain = 'Retain'
Snapshot = 'Snapshot'... | horacio3/troposphere | troposphere/__init__.py | Python | bsd-2-clause | 20,073 |
import sys
import unittest
from assertEquals.cli.reporters import detail, _Summarize
from assertEquals.tests.utils import reportersTestCase
OUTPUT_START="""\
-------------------------------<| assertEquals |>-------------------------------
.EF..
======================================================================
E... | whit537/assertEquals | assertEquals/tests/cli.py | Python | bsd-2-clause | 13,568 |
import logging
from math import log, sqrt
from src.ranked_posting import RankedPosting
class WeightCalculator(object):
def set_posting_weights(self, index, numdocs):
N = numdocs
logging.info('calculating tf-idf weights ({} docs)'.format(N))
for term in index:
df = len(i... | foobar999/Suchmaschine | src/vector/weight_calculator.py | Python | bsd-2-clause | 1,578 |
from __future__ import print_function, absolute_import
import ctypes
from ctypes import *
from ctypes.util import find_library
import subprocess
import sys
import unittest
import platform
from llvmlite import six
from llvmlite import binding as llvm
from llvmlite.binding import ffi
from . import TestCase
asm_sum = ... | squisher/llvmlite | llvmlite/tests/test_binding.py | Python | bsd-2-clause | 22,542 |
from pipedream.dispatcher import Dispatcher
from pipedream.exceptions import *
| tgecho/pipedream | pipedream/__init__.py | Python | bsd-2-clause | 79 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2015, Anima Istanbul
#
# This module is part of anima-tools and is released under the BSD 2
# License: http://www.opensource.org/licenses/BSD-2-Clause
"""Fix Bound Joint
v0.1.0
Description
-----------
Fixes bound joints to the correct worldOrientation in connected skinClu... | sergeneren/anima | anima/env/mayaEnv/fix_bound_joint.py | Python | bsd-2-clause | 4,560 |
import logging
import time
import sys
import numpy as np
from sklearn.utils.extmath import safe_sparse_dot
from chain_opt import optimize_chain_fast
from graph_utils import decompose_graph, decompose_grid_graph
def optimize_chain(chain, unary_cost, pairwise_cost, edge_index):
n_nodes = chain.shape[0]
n_state... | kondra/latent_ssvm | over.py | Python | bsd-2-clause | 9,015 |
#!/usr/bin/env python
import sys
import pickle
# Test zip, and format in print
names = ["xxx", "yyy", "zzz"]
ages = [18, 19, 20]
persons = zip(names, ages)
for name, age in persons:
print "{0}'s age is {1}".format(name, age)
# Check argument
if len(sys.argv) != 2:
print("%s filename" % sys.argv[0])
rai... | zzz0072/Python_Exercises | 01_Built-in_Types/tuple.py | Python | bsd-2-clause | 1,022 |
# -*- python -*-
#
# This file is part of the CNO package
#
# Copyright (c) 2012-2013 - EMBL-EBI
#
# File author(s): Thomas Cokelaer (cokelaer@ebi.ac.uk)
#
# Distributed under the GLPv3 License.
# See accompanying file LICENSE.txt or copy at
# http://www.gnu.org/licenses/gpl-3.0.html
#
# website: github.com/... | cellnopt/cellnopt | cno/core/models.py | Python | bsd-2-clause | 17,116 |
import logging
l = logging.getLogger('simuvex.s_action')
import claripy
import functools
#pylint:disable=unidiomatic-typecheck
_noneset = frozenset()
def _raw_ast(a):
if type(a) is SimActionObject:
return a.ast
elif type(a) is dict:
return { k:_raw_ast(a[k]) for k in a }
elif type(a) in ... | chubbymaggie/simuvex | simuvex/s_action_object.py | Python | bsd-2-clause | 3,613 |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from app.myblog.models import Article
from django.db.models import Count, StdDev
from dss import Serializer
from app.blog_lab.proxy.huiyuan import play
class Command(BaseCommand):
def handle(self, *args, **options):
# art_list = A... | madarou/angular-django | app/blog_lab/management/commands/play.py | Python | bsd-2-clause | 541 |
from importlib import import_module
from ..exceptions import UnknownSource, SourceNotSupported
JSON_SCHEMA_NS = 'http://json-schema.org/draft-04/schema#'
SOURCES = {
'sqlite': 'prov_extractor.sources.sqlite',
'postgresql': 'prov_extractor.sources.postgresql',
'delimited': 'prov_extractor.sources.delimit... | chop-dbhi/prov-extractor | prov_extractor/sources/__init__.py | Python | bsd-2-clause | 1,847 |
from classifierBase import *
from PyQt4.QtGui import QInputDialog
#*******************************************************************************
# C l a s s i f i e r R a n d o m F o r e s t *
#*******************************************************************************
class Cl... | ilastik/ilastik-0.5 | ilastik/modules/classification/core/classifiers/classifierRandomForest.py | Python | bsd-2-clause | 4,475 |
#!/usr/bin/env python
# Command line arguments
# 1: taxon.txt
# 2: directory in which to put taxonomy.tsv and synonyms.tsv
col = {"taxonID": 0,
"parentNameUsageID": 1,
"acceptedNameUsageID": 2,
"canonicalName": 3,
"taxonRank": 4,
"taxonomicStatus": 5,
"nameAccordingTo": 6... | OpenTreeOfLife/reference-taxonomy | import_scripts/gbif/process_gbif_taxonomy.py | Python | bsd-2-clause | 8,023 |
# -*- coding: UTF-8 -*-
# Copyright 2012 Luc Saffre
# License: BSD (see file COPYING for details)
from lino.utils.instantiator import Instantiator, i2d
from lino.core.utils import resolve_model
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from lino.api import dd
def obj... | khchine5/book | lino_book/projects/homeworkschool/fixtures/std.py | Python | bsd-2-clause | 876 |
__author__ = 'aj'
| cfrs2005/flask_blog | lib/__init__.py | Python | bsd-2-clause | 18 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division
import astropy.wcs.utils
from astropy.wcs import WCSSUB_CELESTIAL
from .frames import *
__all__ = ['solar_wcs_frame_mapping']
def solar_wcs_frame_mapping(wcs):
"""
This function registers the coordinates frames to their FITS-WCS coordi... | Alex-Ian-Hamilton/sunpy | sunpy/coordinates/wcs_utils.py | Python | bsd-2-clause | 2,000 |
#!/usr/bin/env python
"""Test reading GO IDs from a file."""
import os
import sys
from goatools.base import get_godag
from goatools.gosubdag.gosubdag import GoSubDag
from goatools.grouper.grprdflts import GrouperDflts
from goatools.grouper.hdrgos import HdrgosSections
from goatools.grouper.grprobj import Grouper
from ... | tanghaibao/goatools | tests/test_wr_sections_txt.py | Python | bsd-2-clause | 5,514 |
"""
Todo: I don't think this DHT knits data storage around broken nodes but the fallback on the server should be a temporary work around.
"""
import sys, os
import json
import random
import socket
import select
import hashlib
import re
try:
import socketserver
except:
import SocketServer
socketserver = Soc... | robertsdotpm/spydht | spydht/spydht.py | Python | bsd-2-clause | 20,123 |
"""Compilation database module
"""
import clang.cindex
import logging
import os
import sys
# generator
def compile_commands(dirname):
assert(dirname and os.path.isdir(dirname))
compdb = clang.cindex.CompilationDatabase.fromDirectory(dirname)
yield compdb.getAllCompileCommands()
def get_all_compile_comma... | inlinechan/stags | stags/compdb.py | Python | bsd-2-clause | 933 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2013 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consi... | jun66j5/trac-ja | trac/util/tests/__init__.py | Python | bsd-3-clause | 10,347 |
#!/usr/bin/env python
from getpass import getpass
import sys
from flask.ext.security.utils import encrypt_password
from app import create_app
from app.models import AppUser, db, Service, Role
def main():
app = create_app()
with app.app_context():
db.metadata.create_all(db.engine)
services = S... | codeforamerica/rva-screening | add_data/add_user.py | Python | bsd-3-clause | 1,445 |
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from .name_sanitization_utils import NameSanitizer, sanitize_block
from coremltools.converters.mil.mi... | apple/coremltools | coremltools/converters/mil/mil/passes/sanitize_input_output_names.py | Python | bsd-3-clause | 1,158 |
import WebMirror.OutputFilters.FilterBase
import WebMirror.OutputFilters.util.MessageConstructors as msgpackers
from WebMirror.OutputFilters.util.TitleParsers import extractTitle
import bs4
import re
import markdown
import time
import datetime
import calendar
import WebRequest
from settings import WATTPAD_REQUIR... | fake-name/ReadableWebProxy | WebMirror/OutputFilters/WattPad/WattPadSeriesPageFilter.py | Python | bsd-3-clause | 8,763 |
from django import http
from django.db.models import Q
from django.db.transaction import non_atomic_requests
from django.utils.encoding import force_bytes
from django.utils.translation import ugettext
from django.views.decorators.vary import vary_on_headers
import olympia.core.logger
from olympia import amo
from olym... | harry-7/addons-server | src/olympia/search/views.py | Python | bsd-3-clause | 21,633 |
import functools
import logbook
import werkzeug.exceptions
from flask import make_response, request
from sqlalchemy.orm import class_mapper
from ._compat import httplib, iteritems, PY2
_logger = logbook.Logger(__name__)
class Parameter(object):
optional = False
def __init__(self, parameter_types):
... | vmalloc/weber-utils | weber_utils/request_utils.py | Python | bsd-3-clause | 2,920 |
# Future Imports for py2/3 backwards compat.
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from lxml import etree
from io import StringIO
from future import standard_library
standard_library.install_aliases()
def create_element(tag, optional_attributes=No... | derpadoo/nexpose-client-python | nexpose/xml_utils.py | Python | bsd-3-clause | 2,258 |
"""
UI for controlling how api classes and mel commands are combined into pymel classes.
This UI modifies factories.apiToMelData which is pickled out to apiMelBridge.
It controls:
which mel methods correspond to api methods
disabling of api methods
preference for overloaded methods (since currently only o... | CountZer0/PipelineConstructionSet | python/maya/site-packages/pymel-1.0.3/maintenance/pymelControlPanel.py | Python | bsd-3-clause | 41,766 |
from django.conf.urls import patterns, url, include
from . import views
urlpatterns = patterns(
'',
url(r'^accounts/ClientLogin$', views.login, name='login'),
url(r'^reader/api/0/', include('feedhq.reader.api_urls')),
url(r'^reader/atom/(?P<content_id>.+)?$', views.stream_contents,
{'output':... | vincentbernat/feedhq | feedhq/reader/urls.py | Python | bsd-3-clause | 356 |
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2008-2009, James Vega
# 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 c... | prashantpawar/supybot-rothbot | plugins/Unix/plugin.py | Python | bsd-3-clause | 9,991 |
# Register a SIGTERM signal handler in order for 'coverage' tool
# to function properly
import signal
import sys
def signal_handler(signum, frame):
print('Handled Linux signal number:', signum)
sys.exit()
signal.signal(signal.SIGTERM, signal_handler)
# Run the example
import minimaltaxiapp
| caran/SecureGateway | examples/minimal/minimaltaxiapp_with_signalhandler.py | Python | bsd-3-clause | 304 |
from datetime import datetime
from django.db import models
from django.utils import timezone
class Trip(models.Model):
# real fields
scenic = models.BooleanField(blank=True, default=False)
start_ts = models.DateTimeField(blank=True, null=True, default=timezone.now)
status = models.CharField(
blank=True,
def... | tosfan4ever/hacktheplanet | api/models/_trip.py | Python | bsd-3-clause | 358 |
"""Common imports for generated clouduseraccounts client library."""
# pylint:disable=wildcard-import
import pkgutil
from googlecloudsdk.third_party.apitools.base.py import *
from googlecloudsdk.third_party.apis.clouduseraccounts.beta.clouduseraccounts_beta_client import *
from googlecloudsdk.third_party.apis.cloudus... | flgiordano/netcash | +/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/clouduseraccounts/beta/__init__.py | Python | bsd-3-clause | 429 |
# encoding: latin2
"""Algorithm utilities
G{packagetree core}
"""
__author__ = "Juan C. Duque"
__credits__ = "Copyright (c) 2009-11 Juan C. Duque"
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "RiSE Group"
__email__ = "contacto@rise-group.org"
import copy
import numpy
import dist2Regions
imp... | tectronics/clusterpy | clusterpy/core/toolboxes/cluster/componentsAlg/__init__.py | Python | bsd-3-clause | 83,109 |
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import (ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str,
super, zip)
from ..._endpoint_base import EndpointBase
from ..._utils import send_session_requ... | DavidWhittingham/agsadmin | agsadmin/rest_admin/services/_permissions_mixin.py | Python | bsd-3-clause | 1,441 |
import os
import numpy as np
import Bio.Seq
import mirnylib.genome
NUM_READS = 10000
READ_LENGTH = 75
MOLECULE_LENGTH = 400
NOISE = 0.02
RANDOM_JOINT = True
STD_HEADER = 'SRR000000.{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}'
genome_db = mirnylib.genome.Genome('../../fasta/sacCer3', readChrms=['#'])
if not os.path.exists('tmp... | bxlab/HiFive_Paper | Scripts/HiCLib/mirnylab-hiclib-460c3fbc0f72/tests/mapping/01_generate_random_fastq.py | Python | bsd-3-clause | 1,940 |
def read_airbase_file(filename, station):
"""
Read hourly AirBase data files.
Parameters
----------
filename : string
Path to the data file.
station : string
Name of the station.
Returns
-------
DataFrame
Processed dataframe.
"""
# co... | jorisvandenbossche/DS-python-data-analysis | notebooks/_solutions/case4_air_quality_processing10.py | Python | bsd-3-clause | 1,177 |
# -*-coding:Utf-8 -*
# Copyright (c) 2012 LE GOFF Vincent
# 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
# l... | stormi/tsunami | src/primaires/salle/commandes/decor/liste.py | Python | bsd-3-clause | 2,465 |
from __future__ import print_function, division
from sympy.core.basic import C
from sympy.core.expr import Expr
from sympy.sets.sets import Interval
from sympy.core.singleton import S
from sympy.core.symbol import Symbol
from sympy.core.sympify import sympify
from sympy.core.compatibility import is_sequence, xrange
fr... | AunShiLord/sympy | sympy/concrete/expr_with_limits.py | Python | bsd-3-clause | 14,599 |
# coding:utf-8
import io
import base64
import socket
from apiclient.http import MediaIoBaseUpload
from apiclient.errors import HttpError
from cactus.deployment.file import BaseFile
from cactus.utils.network import retry
class GCSFile(BaseFile):
def get_metadata(self):
"""
Generate metadata for th... | dreadatour/Cactus | cactus/deployment/gcs/file.py | Python | bsd-3-clause | 2,141 |
import os
import pytest
from flask import url_for
from urllib.request import urlopen
from burpui import create_app
@pytest.fixture(scope="session")
def app():
conf = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"../../share/burpui/etc/burpui.sample.cfg",
)
bui = create_app... | ziirish/burp-ui | tests/functional/test_live_server.py | Python | bsd-3-clause | 941 |
# coding: utf-8
# Author: Johannes Schönberger
#
# License: BSD 3 clause
import numpy as np
import warnings
from ..base import BaseEstimator, MetaEstimatorMixin, RegressorMixin, clone
from ..base import MultiOutputMixin
from ..utils import check_random_state, check_consistent_length
from ..utils.random import sample... | bnaul/scikit-learn | sklearn/linear_model/_ransac.py | Python | bsd-3-clause | 19,658 |
#!/usr/bin/env python
#
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Creates a TOC file from a Java jar.
The TOC file contains the non-package API of the jar. This includes all
public/protected/pack... | ChromiumWebApps/chromium | build/android/gyp/jar_toc.py | Python | bsd-3-clause | 3,249 |
"Pgsql Fts backend"
from django.db import transaction
from fts.backends.base import InvalidFtsBackendError
from fts.backends.base import BaseClass, BaseModel, BaseManager
from django.db import models
LANGUAGES = {
'' : 'simple',
'da' : 'danish',
'nl' : 'dutch',
'en' : 'english',
'fi'... | ryszard/django-fts | fts/backends/pgsql.py | Python | bsd-3-clause | 5,071 |
from ..java import (
Method as JavaMethod,
opcodes as JavaOpcodes,
RuntimeVisibleAnnotations,
Annotation,
ConstantElementValue,
)
from .blocks import Block
from .opcodes import (
ALOAD_name, ASTORE_name, free_name,
ILOAD_name, FLOAD_name, DLOAD_name,
Opcode, TRY, CATCH, END_TRY
)
POSIT... | rubacalypse/voc | voc/python/methods.py | Python | bsd-3-clause | 21,563 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Integration'] , ['MovingMedian'] , ['Seasonal_Hour'] , ['SVR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Integration/model_control_one_enabled_Integration_MovingMedian_Seasonal_Hour_SVR.py | Python | bsd-3-clause | 161 |
from django.test import SimpleTestCase
from corehq.apps.reports.view_helpers import normalize_date
from datetime import date, datetime
class TestCaseTags(SimpleTestCase):
def test_normalize_date(self):
self.assertIsInstance(normalize_date(date.today()), datetime)
self.assertIsInstance(normalize_d... | dimagi/commcare-hq | corehq/ex-submodules/casexml/apps/case/tests/test_tags.py | Python | bsd-3-clause | 409 |
import compileall
import os
from importlib import import_module
from django.db import connection, connections
from django.db.migrations.exceptions import (
AmbiguityError, InconsistentMigrationHistory, NodeNotFoundError,
)
from django.db.migrations.loader import MigrationLoader
from django.db.migrations.recorder i... | atul-bhouraskar/django | tests/migrations/test_loader.py | Python | bsd-3-clause | 24,415 |
# -*- coding: utf-8 -*-
import datetime
from flask import current_app, flash, redirect, url_for, render_template
from purchasing.extensions import db
from purchasing.notifications import Notification
from purchasing.scout.forms import FeedbackForm, SearchForm
from purchasing.users.models import Department, User, Ro... | codeforamerica/pittsburgh-purchasing-suite | purchasing/scout/util.py | Python | bsd-3-clause | 9,422 |
from django.core import mail
from app.models import Item
# It doesn't matter which order all the _again methods are run, we just need
# to check the environment remains constant.
# This is possible with some of the testdir magic, but this is a nice lazy to
# it
def test_mail():
assert len(mail.outbox) == 0
m... | bfirsh/pytest_django | tests/test_environment.py | Python | bsd-3-clause | 850 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['MovingMedian'] , ['BestCycle'] , ['SVR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_None/model_control_one_enabled_None_MovingMedian_BestCycle_SVR.py | Python | bsd-3-clause | 150 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read().replace('.. :changelog:', ''... | hotsyk/vulyk-declaration | setup.py | Python | bsd-3-clause | 1,647 |
try:
import unittest2 as unittest
except:
import unittest
import numpy as np
from math3 import quaternion
class test_quaternion(unittest.TestCase):
# many of these values are taken from searches on wolfram alpha
def test_import(self):
import math3
math3.quaternion
from math3 i... | PhloxAR/math3 | math3/tests/test_quaternion.py | Python | bsd-3-clause | 15,824 |
from login.permissions import cache_clear
def mqtt_cache_clear():
# call cache_clear locally
cache_clear()
# and signal through mqtt
from mqtt.publish import SingletonPublishClient
SingletonPublishClient().publish_message('cache_clear')
| EMSTrack/WebServerAndClient | mqtt/cache_clear.py | Python | bsd-3-clause | 261 |
##########################################################################
#
# Copyright (c) 2012-2014, John Haddon. All rights reserved.
# Copyright (c) 2013-2014, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted ... | davidsminor/gaffer | python/GafferSceneTest/__init__.py | Python | bsd-3-clause | 4,468 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | ericmjl/bokeh | bokeh/themes/theme.py | Python | bsd-3-clause | 8,240 |
import numpy as np
from scipy.sparse import csc_matrix
from scipy.optimize._trustregion_constr.qp_subproblem \
import (eqp_kktfact,
projected_cg,
box_intersections,
sphere_intersections,
box_sphere_intersections,
modified_dogleg)
from scipy.optimize._trust... | jamestwebber/scipy | scipy/optimize/_trustregion_constr/tests/test_qp_subproblem.py | Python | bsd-3-clause | 27,931 |
def mul(A, B):
a, b, c = A
d, e, f = B
return a * d + b * e, a * e + b * f, b * e + c * f
def pow(A, n):
if n == 1:
return A
if n & 1 == 0:
return pow(mul(A, A), n // 2)
else:
return mul(A, pow(mul(A, A), (n - 1) // 2))
def fib(n):
if n < 2:
return n
r... | nbari/my-sandbox | python/exercices/fibonacci/fib_matrix.py | Python | bsd-3-clause | 370 |
import os
####### Database config. This assumes Postgres #######
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'commcarehq',
'USER': 'commcarehq',
'PASSWORD': 'commcarehq',
'HOST': 'localhost',
'PORT': '5432'
}
}
### Rep... | SEL-Columbia/commcare-hq | localsettings.example.py | Python | bsd-3-clause | 11,552 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from .utils import load_class
from . import settings
def load_backend_class():
"""
Load a default backend class instance."
"""
return load_class(settings.GREENQUEUE_BACKEND)
def load_worker_class():
"""
Load a default worker cl... | niwinz/django-greenqueue | greenqueue/shortcuts.py | Python | bsd-3-clause | 399 |
import sys
import logging
from raven.utils.testutils import TestCase
from raven.base import Client
from raven import breadcrumbs
from io import StringIO
class BreadcrumbTestCase(TestCase):
def test_crumb_buffer(self):
for enable in 1, 0:
client = Client('http://foo:bar@example.com/0',
... | johansteffner/raven-python | tests/breadcrumbs/tests.py | Python | bsd-3-clause | 6,007 |
"""One and two sample permutation tests.
"""
# Third-party imports
import numpy as np
import scipy.misc as sm
# Our own imports
from nipy.neurospin.graph import graph_3d_grid, graph_cc
from nipy.neurospin.graph.field import Field
from onesample import stat as os_stat, stat_mfx as os_stat_mfx
from twosample import stat... | yarikoptic/NiPy-OLD | nipy/neurospin/group/permutation_test.py | Python | bsd-3-clause | 34,611 |