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 |
|---|---|---|---|---|---|
# Copyright 2021 The ParallelAccel 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 appl... | google/parallel_accel | parallel_accel/Server/src/tasks.py | Python | apache-2.0 | 5,832 |
from gini.semantics import Bottle,Concept
bottle = Bottle()
def print_me(stuff):
print repr(stuff)
print_concept = Concept('print', ['print','show','list','blah'])
print_concept.action = print_me
bottle.vocab = [
print_concept,
Concept('say', ['say','speak','sprechen']),
Concept('money', ['money','mo... | azraq27/gini | demo.py | Python | apache-2.0 | 665 |
'''
###########################################################################
# Author: tangtang
# Date: Apri 28th 2017
# Modified:
#
# use example :
# need net-snmp python egg
# python -m testSNMPv3
###########################################################################
'''
import unittest
... | Wuguanping/Server_Manage_Plugin | Zenoss_Plugin/ZenPacks/community/HuaweiServer/tests/TestSNMPv3.py | Python | apache-2.0 | 3,232 |
#
# 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
# ... | noironetworks/heat | heat/engine/resources/openstack/octavia/pool.py | Python | apache-2.0 | 8,488 |
#
# Author:: Noah Kantrowitz <noah@coderanger.net>
#
# Copyright 2014, Noah Kantrowitz
#
# 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
#
# Unles... | coderanger/fabric-rundeck | test/test_visitor.py | Python | apache-2.0 | 5,407 |
# Copyright 2014 The Oppia 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 applicable ... | souravbadami/oppia | schema_utils.py | Python | apache-2.0 | 13,374 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: mnist-tfslim.py
import numpy as np
import os
import sys
import argparse
"""
MNIST ConvNet example using TensorFlow-slim.
Mostly the same as 'mnist-convnet.py',
the only differences are:
1. use slim.layers, slim.arg_scope, etc
2. use slim names to summarize ... | haamoon/tensorpack | examples/mnist-tfslim.py | Python | apache-2.0 | 3,558 |
import sys
from deriva.transfer import DerivaUploadCLI, GenericUploader
DESC = "Deriva Data Upload Utility - CLI"
INFO = "For more information see: https://github.com/informatics-isi-edu/deriva-py"
def main():
cli = DerivaUploadCLI(GenericUploader, DESC, INFO)
return cli.main()
if __name__ == '__main__':
... | informatics-isi-edu/deriva-py | deriva/transfer/upload/__main__.py | Python | apache-2.0 | 340 |
# Copyright (c) 2016 Mirantis, 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 requir... | openstack/manila | manila/share/drivers/container/driver.py | Python | apache-2.0 | 33,700 |
import logging
import os
import shutil
import subprocess
import sys
from scripts.lib.zulip_tools import run, run_as_root, ENDC, WARNING
from scripts.lib.hash_reqs import expand_reqs
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
VENV_CACHE_PATH = "/srv/zulip-venv-cache"
if ... | rishig/zulip | scripts/lib/setup_venv.py | Python | apache-2.0 | 13,972 |
# Copyright 2021 DeepMind Technologies 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 agr... | deepmind/xmanager | xmanager/xm/resources.py | Python | apache-2.0 | 13,390 |
import copy
import shutil
from pathlib import Path
from typing import List, Dict, Text, Any, Tuple, Optional, Union
import rasa.shared.utils.io
import rasa.shared.utils.cli
from rasa.shared.constants import (
REQUIRED_SLOTS_KEY,
IGNORED_INTENTS,
)
from rasa.shared.core.constants import (
ACTIVE_LOOP,
R... | RasaHQ/rasa_nlu | rasa/core/migrate.py | Python | apache-2.0 | 10,234 |
#!/usr/bin/env python
# Copyright (c) 2006-2007 Open Source Applications Foundation
# Copyright (c) 2008-2009 Mikeal Rogers <mikeal.rogers@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 o... | windmill/windmill | windmill/bin/shell_objects.py | Python | apache-2.0 | 8,159 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the L... | iwm911/plaso | plaso/formatters/utmpx.py | Python | apache-2.0 | 1,168 |
# Copyright 2015 Cisco Systems, 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 requi... | CiscoSystems/fabric_enabler | dfa/server/dfa_listen_dcnm.py | Python | apache-2.0 | 7,128 |
"""
Support for Enphase Envoy solar energy monitor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.enphase_envoy/
"""
import logging
import voluptuous as vol
from homeassistant.helpers.entity import Entity
from homeassistant.components.sensor im... | persandstrom/home-assistant | homeassistant/components/sensor/enphase_envoy.py | Python | apache-2.0 | 2,927 |
# -*- coding: utf-8 -*-
#
# Copyright 2014-2020 BigML
#
# 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 ... | mmerce/python | bigml/domain.py | Python | apache-2.0 | 5,460 |
# Copyright (C) 2013-2014 Computer Sciences Corporation
#
# 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 a... | ezbake/ezbake-base-thrift | src/main/python/ezbakeBaseTypes/ttypes.py | Python | apache-2.0 | 80,240 |
from setuptools import setup
setup(
name='omtd-rspub-elastic',
version=0.1,
packages=['omtdrspub.elastic'],
license='Creative Commons Attribution-Noncommercial-Share Alike license',
author='Giorgio Basile',
author_email='giorgio.basile@open.ac.uk',
description='ResourceSync documents genera... | openminted/omtd-rspub-elastic | setup.py | Python | apache-2.0 | 750 |
"""
Copyright 2018 Dispel, LLC
Apache 2.0 License, see https://github.com/dispel/jak/blob/master/LICENSE for details.
"""
class JakException(Exception):
"""Something obvious went wrong."""
class WrongKeyException(Exception):
"""The wrong key was used when trying to decrypt"""
| dispel/jak | jak/exceptions.py | Python | apache-2.0 | 289 |
# Copyright 2012 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... | BeenzSyed/tempest | tempest/api/database/Flavors/test_flavors.py | Python | apache-2.0 | 1,445 |
class SymbolItem(object):
'''
An object of Item is a basic element in
a sequence.
'''
def __init__(self, content):
self.content=content
def __eq__(self, other):
"""Override the default Equals behavior"""
if isinstance(other, self.__class__) :
return self.c... | zhiweiuu/secs | Symbol.py | Python | apache-2.0 | 1,074 |
# -*- coding: utf-8 -*-
# Copyright 2009-2013, Peter A. Bigot
# Copyright 2012, Jon Foster
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain a
# copy of the License at:
#
# http://www.apache.org/licenses/LICEN... | CantemoInternal/pyxb | pyxb/utils/xmlre.py | Python | apache-2.0 | 12,907 |
import pytest
@pytest.mark.moto
@pytest.mark.asyncio
async def test_batch(batch_client):
job_queues = await batch_client.describe_job_queues()
assert job_queues['jobQueues'] == []
| aio-libs/aiobotocore | tests/test_batch.py | Python | apache-2.0 | 190 |
#!/usr/bin/env python
import warnings as _warnings
_warnings.resetwarnings()
_warnings.filterwarnings('error')
# BEGIN INCLUDE
from tdi import html
from tdi.tools import javascript
template = html.from_string("""
<html>
<body>
<tdi tdi="-script">
<div tdi="*html"><h1 tdi="h1">dynamic js-only-content</h1></div... | ndparker/tdi | tests/rendering/subrender5.py | Python | apache-2.0 | 842 |
import asyncio
import sys
import threading
from asyncio import QueueEmpty as AsyncQueueEmpty
from asyncio import QueueFull as AsyncQueueFull
from collections import deque
from heapq import heappop, heappush
from queue import Empty as SyncQueueEmpty
from queue import Full as SyncQueueFull
from typing import Any, Callabl... | aio-libs/janus | janus/__init__.py | Python | apache-2.0 | 21,507 |
import setuptools
setuptools.setup(
name = "either",
version = "0.1",
url = "https://github.com/kennknowles/python-either",
maintainer = "Kenneth Knowles",
maintainer_email = "kenn.knowles@gmail.com",
packages = setuptools.find_packages())
| kennknowles/python-either | setup.py | Python | apache-2.0 | 272 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | mrunge/openstack_horizon | openstack_horizon/dashboards/identity/groups/urls.py | Python | apache-2.0 | 1,246 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | mbohlool/client-python | kubernetes/client/models/v1beta2_rolling_update_stateful_set_strategy.py | Python | apache-2.0 | 3,448 |
# -*- coding: utf-8 -*-
# Copyright 2020 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... | googleads/google-ads-python | google/ads/googleads/v8/services/services/account_link_service/transports/base.py | Python | apache-2.0 | 4,529 |
from givabit.backend.charity import Charity
from givabit.backend.errors import MissingValueException, MultipleValueException
from google.appengine.api.datastore_errors import BadKeyError
class CharityRepository(object):
def list_charities(self):
return [charity for charity in Charity.all().run()]
def... | illicitonion/givabit | src/givabit/backend/charity_repository.py | Python | apache-2.0 | 1,277 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | lcostantino/healing-os | healing/openstack/common/db/sqlalchemy/session.py | Python | apache-2.0 | 35,175 |
# 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... | keras-team/keras | keras/legacy_tf_layers/convolutional.py | Python | apache-2.0 | 82,763 |
#
# Copyright 2014 Modeliosoft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | juniper-project/modelling-mongodb | src/main/conf/res/scripts/createDocument.py | Python | apache-2.0 | 773 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright (c) 2002-2016 "Neo Technology,"
# Network Engine for Objects in Lund AB [http://neotechnology.com]
#
# This file is part of Neo4j.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Li... | nigelsmall/py2neo | py2neo/packages/neo4j/v1/ssl_compat.py | Python | apache-2.0 | 1,052 |
#!/usr/bin/env python3
"""Unit tests run as PYTHONPATH=../../.. python3 ./test_large_topology.py."""
# Copyright (C) 2015 Research and Innovation Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2019 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fil... | trungdtbk/faucet | tests/generative/unit/test_topology.py | Python | apache-2.0 | 8,026 |
# Copyright 2014 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 required by applicable law or a... | VitalLabs/gcloud-python | gcloud/storage/test_bucket.py | Python | apache-2.0 | 42,334 |
##
# Copyright (c) 2005-2017 Apple 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 required by applicable l... | macosforge/ccs-calendarserver | txdav/caldav/datastore/scheduling/ischedule/test/test_resource.py | Python | apache-2.0 | 13,198 |
class Solution(object):
def increasingTriplet(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
import bisect
length = len(nums)
if length < 3:
return False
increasing_numbers = [nums[0]]
for i in range(1, length):
... | danielsunzhongyuan/my_leetcode_in_python | increasing_triplet_subsequence_334.py | Python | apache-2.0 | 952 |
# -*- 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):
# Removing M2M table for field manySources on 'Response'
db.delete_table(db.shorten_name('responses_manySour... | shh-dlce/pulotu | website/apps/survey/migrations/0015_auto.py | Python | apache-2.0 | 12,858 |
import sys
sys.path.append('../../../..')
import simplejson
from smart_client.common.rdf_tools import rdf_ontology
import rdflib
seen = {}
context = {}
ns = rdf_ontology.SMART_Class["http://smartplatforms.org/terms#Statement"].graph.namespace_manager
def add_term(uri):
if not isinstance(uri, rdflib.URIRef):
... | smart-classic/smart_sample_apps | static/framework/smart/scripts/build_smart_jsonld_context.py | Python | apache-2.0 | 2,076 |
from insights import tests
from insights.core.plugins import load
from itertools import islice
import pytest
def integration_test(module, test_func, input_data, expected):
test_func(tests.integrate(input_data, module), expected)
def generate_tests(metafunc, test_func, package_names, pattern=None):
"""
T... | PaulWay/insights-core | insights/tests/integration.py | Python | apache-2.0 | 1,358 |
"""winss service directory management.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import os
from . import services
from .. import _scan_dir_base
from .. import _utils
_LOGGER = logging.getLog... | captiosus/treadmill | treadmill/supervisor/winss/scan_dir.py | Python | apache-2.0 | 1,357 |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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
... | kdart/pycopia | core/pycopia/inet/httputils.py | Python | apache-2.0 | 44,054 |
#/usr/bin/python
import pyaudio
import math
import struct
import wave
#Assuming Energy threshold upper than 30 dB
Threshold = 30
SHORT_NORMALIZE = (1.0/32768.0)
chunk = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 16000
swidth = 2
Max_Seconds = 10
TimeoutSignal=((RATE / chunk * Max_Seconds) + 2)
silence = True
... | JohnOmernik/pimeup | animatronics/JO_sound.py | Python | apache-2.0 | 1,495 |
#!/usr/bin/env python3
# Copyright 2021 Stanford University, NVIDIA Corporation
#
# 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 ... | StanfordLegion/legion | tools/legion_spy.py | Python | apache-2.0 | 570,049 |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | google/active-learning | utils/utils.py | Python | apache-2.0 | 10,503 |
"""
variables_to_restore是为了在保持模型的时候方便使用滑动平均的参数,如果不使用这个保存,那模型就会保存所以参数,
除非你提前设定,就是在保存的时候指定保存变量也是可以的,比如saver = tf.train.Saver([v])这样就可以指定保存变量v,
在模型导入的时候只有这个变量会被导入。
"""
import tensorflow as tf
# v = tf.Variable(tf.constant(0.0, dtype=tf.float32), name='v')
# ema = tf.train.ExponentialMovingAverage(0.99) # 设定滑动平均函数
# main... | Asurada2015/TFAPI_translation | Variables/tf_variables_to_restore.py | Python | apache-2.0 | 2,124 |
# 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/test/test_ProjectAPI.py | Python | apache-2.0 | 13,532 |
# -*- coding: utf-8 -*-
#
# 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
#... | owlabs/incubator-airflow | tests/contrib/hooks/test_segment_hook.py | Python | apache-2.0 | 2,032 |
import logging
from pprint import pprint
import hashlib
from adwords_client.client import AdWords
from adwords_client import reports
from adwords_client.internal_api.builder import OperationsBuilder
from datetime import datetime
logging.basicConfig(level=logging.INFO)
logging.getLogger('googleads').setLevel(logging.E... | getninjas/adwords-client | tests/test_unit.py | Python | apache-2.0 | 44,918 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2018 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... | quattor/aquilon | lib/aquilon/aqdb/types/__init__.py | Python | apache-2.0 | 1,401 |
# -*- coding: utf-8 -*-
"""
flask_raven.keys
~~~~~~~~~~~~~~~~
:copyright: (c) 2014 Daniel Chatfield
:license: Artistic 2.0
"""
LIVE_KEY = """-----BEGIN RSA PUBLIC KEY-----
MIGJAoGBAL/2pwBbVcJKTRF8B+K6W9Oi4xkoPiOb32te0whw7Zuf7cTFCk5tvBa6
CI7wM0R99LtvNLFmoantTps92LjF9fvrCBYZDqpaLnk5clXShKKqt3do4SykqYkq
... | danielchatfield/shreddi.es | libs/flask_raven/keys.py | Python | artistic-2.0 | 413 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'miyanishi'
import msgpackrpc
import snappy
import numpy as np
from caffe_extractor import CaffeExtractor
class CaffeServer(object):
def __init__(self, caffe_root, feature_layers, gpu):
self.extractor = CaffeExtractor(caffe_root=caffe_root, feat... | miyanishi2/caffe-rpc | caffe_server.py | Python | bsd-2-clause | 1,149 |
import asyncio
import warnings
import weakref
from collections.abc import Mapping, Sequence
from sqlalchemy.sql import expression, sqltypes
from ..utils import PY_35, PY_352
from . import exc
class RowProxy(Mapping):
__slots__ = ('_result_proxy', '_row', '_processors', '_keymap')
def __init__(self, result... | eirnym/aiopg | aiopg/sa/result.py | Python | bsd-2-clause | 14,505 |
import dragonfly
import dragonfly.pandahive
import bee
from bee import connect
import math, functools
from panda3d.core import NodePath
import dragonfly.scene.unbound
import dragonfly.std
import dragonfly.io
import dragonfly.canvas
import Spyder
# ## random matrix generator
from random import random
def random_m... | agoose77/hivesystem | manual/movingpanda/panda-8h.py | Python | bsd-2-clause | 4,672 |
'''Autogenerated by get_gl_extensions script, do not edit!'''
from OpenGL import platform as _p
from OpenGL.GL import glget
EXTENSION_NAME = 'GL_SGIX_shadow_ambient'
_p.unpack_constants( """GL_SHADOW_AMBIENT_SGIX 0x80BF""", globals())
def glInitShadowAmbientSGIX():
'''Return boolean indicating whether this extens... | frederica07/Dragon_Programming_Process | PyOpenGL-3.0.2/OpenGL/raw/GL/SGIX/shadow_ambient.py | Python | bsd-2-clause | 429 |
#! /usr/bin/env python
import threading
import time
from pika.adapters import BlockingConnection
class QueueThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.name = self.__class__.__name__
self.connection = BlockingConnection()
self._stop = threading.Event()
sel... | flz/portbuild-ng | lib/portbuild/qthreads.py | Python | bsd-2-clause | 1,448 |
# -*- coding: utf-8 -*-
"""Sphinx directive to display and execute Python code.
This directive accepts Python code, and produces output similar to
docstrings showing interactive sessions, with the "commands" and their
output. The code is executed at documentation build time.
To enable this directive, simply list it i... | keszybz/sphinxcontrib-codesample | sphinxcontrib/codesample_directive/__init__.py | Python | bsd-2-clause | 5,094 |
import sys
import numpy as np
from mpi4py import MPI
from pySDC.helpers.stats_helper import filter_stats, sort_stats
from pySDC.implementations.collocation_classes.gauss_radau_right import CollGaussRadau_Right
from pySDC.implementations.controller_classes.controller_MPI import controller_MPI
from pySDC.implementations... | Parallel-in-Time/pySDC | pySDC/playgrounds/deprecated/pmesh/AC_benchmark_NEW.py | Python | bsd-2-clause | 5,474 |
import random
from fysom import Fysom
from zort.entity import GameEntity
from zort.euclid import Vector2, Vector3
from zort.hex_model import *
from zort.level import Task
from zort import resources
__all__ = ['Enemy',
'Stalker',
'Rambler',
'Tosser',
'Saucer']
class Enem... | bitcraft/pyweek19 | zort/enemies.py | Python | bsd-2-clause | 8,298 |
#! /usr/bin/env python
from random import randint
def randGen(aList):
while len(aList) > 0:
yield aList.pop(randint(0,len(aList)-1)
if __name__ == "__main__" :
for item in randGen(['rock','paper','scissors']):
print item
| xiongerqi/enki | sample/control/exa_yield.py | Python | bsd-2-clause | 298 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ComssServiceDevelopment.connectors.tcp.msg_stream_connector import OutputMessageConnector #import modułów konektora msg_stream_connector
from ComssServiceDevelopment.connectors.tcp.object_connector import OutputObjectConnector #import modułów konektora object_connector... | HAL90000/tirt | classifier/input_file.py | Python | bsd-2-clause | 1,628 |
from .. import Availability, Class, Constant, Define, Method, Parameter, Type
gx_class = Class('NGRD',
doc="Neargrid")
gx_defines = [
]
gx_methods = {
'': [
Method('_Clear_NGRD', module='geocslib', version='6.0.0',
availability=Availability.EXTENSION,
doc=... | GeosoftInc/gxapi | spec/ps/NGRD.py | Python | bsd-2-clause | 4,092 |
__author__ = 'Jason'
import icalendar
from icalendar import (
vText,
)
import unittest
def ical_str_rn(ical_str):
ical_str = ical_str.replace('\r', '')
return ical_str.replace('\n', '\r\n')
class NewCalendarExample(unittest.TestCase):
def test_class_fields(self):
"""Component class fields.... | JasonCozens/CalTools | cal_tools/examples/calendar_ex.py | Python | bsd-2-clause | 3,805 |
# -*- coding: utf-8 -*-
#
# Copyright (c) J. A. Zanardo Jr. <zanardo@gmail.com>
#
# https://github.com/zanardo/ticket
#
# Para detalhes do licenciamento, ver COPYING na distribuição
#
import random
from hashlib import sha1
from bottle import get, view, post, request, redirect
import ticket.user
import ticket.db
imp... | zanardo/ticket | ticket/webadmin.py | Python | bsd-2-clause | 4,620 |
'''
Segregated version of #12
Things to try:
- Go/NoGo populations also inhibit each other (so no two actions can fire at once)
'''
import os,sys
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0,parentdir)
from pyN import *
#substantia nigra releases dopamine. Stimulate this ... | ericjang/pyN | pyn_examples/14_segregated_AdEx.py | Python | bsd-2-clause | 7,366 |
import re
import six
from spec import Spec, eq_
import invoke
import invoke.collection
import invoke.exceptions
import invoke.tasks
import invoke.program
class Init(Spec):
"__init__"
def dunder_version_info(self):
assert hasattr(invoke, '__version_info__')
ver = invoke.__version_info__
... | pfmoore/invoke | tests/init.py | Python | bsd-2-clause | 2,770 |
"""
Main plugin tests.
.. note:: Please to not run nosetests with this plugin for testing the plugin
itself. Also, mock.patch is not much help here as it would try to mock the
module that would be already imported by nose itself if plugin was installed
globally (it would take module from sys.modules).
"""
imp... | lukaszb/nose-watch | tests/test_plugin.py | Python | bsd-2-clause | 1,900 |
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
from falcon import HTTPNotFound, HTTPForbidden, HTTP_201
from ...auth import login_required
from .ical_key import get_ical_key, update_ical_key, delete_ical_ke... | diegocepedaw/oncall | src/oncall/api/v0/ical_key_user.py | Python | bsd-2-clause | 2,738 |
#!/usr/bin/env python
"""
A class to represent and draw gene sets
"""
__author__ = "Adam Richards"
import os,csv,re
import numpy as np
import networkx as nx
import matplotlib as mpl
import matplotlib.pyplot as plt
from htsint.database import db_connect,Gene,Taxon,GoTerm
from htsint.blast import BlastMapper
try:
... | ajrichards/htsint | htsint/GeneSet.py | Python | bsd-3-clause | 18,200 |
#!/usr/bin/env python
# Copyright (c) 2009 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.
"""Helper script to generate file lists for idl.gyp."""
import os.path
import sys
import types
# Read in the manifest files (whi... | rwatson/chromium-capsicum | o3d/plugin/idl/get_idl_files.py | Python | bsd-3-clause | 744 |
import json
import pytest
import stix2.exceptions
import stix2.utils
import stix2.v21
MALWARE_ANALYSIS_JSON = """{
"type": "malware-analysis",
"spec_version": "2.1",
"id": "malware-analysis--f8afc020-f92f-4906-a971-88ee5882eb46",
"created_by_ref": "identity--e0353ed3-991e-4f71-a332-114c2f10b84f",
... | oasis-open/cti-python-stix2 | stix2/test/v21/test_malware_analysis.py | Python | bsd-3-clause | 3,751 |
# Copyright 2003-2010 Jürgen Kayser <rjk23@columbia.edu>
# Copyright 2017 Federico Raimondo <federaimondo@gmail.com> and
# Denis A. Engemann <dengemann@gmail.com>
#
#
# The original CSD Toolbox can be find at
# http://psychophysiology.cpmc.columbia.edu/Software/CSDtoolbox/
# Authors: Denis A. Engeman <d... | rkmaddox/mne-python | mne/preprocessing/_csd.py | Python | bsd-3-clause | 6,170 |
"""Tests for cement.ext.ext_configobj."""
import os
import sys
from cement.core import handler, backend, log
from cement.utils import test
from cement.utils.misc import rando
APP = rando()[:12]
CONFIG = """
[my_section]
my_param = my_value
"""
class ConfigObjExtTestCase(test.CementTestCase):
def setUp(self):... | akhilman/cement | tests/ext/configobj_tests.py | Python | bsd-3-clause | 1,421 |
# -*- coding: utf-8 -*-
"""
Display the number of ongoing tickets from selected RT queues.
Configuration parameters:
cache_timeout: how often we refresh this module in seconds (default 300)
threshold_critical: set bad color above this threshold
db: database to use
format: see placeholders below
hos... | Spirotot/py3status | py3status/modules/rt.py | Python | bsd-3-clause | 3,246 |
algorithm = "fourier"
potential = "quartic"
T = 12
dt = 0.01
eps = 0.1
f = 3.0
ngn = 4096
basis_size = 64
P = 2.0j
Q = 0.5
S = 0.0
parameters = [ (P, Q, S, -0.5, 2.0) ]
coefficients = [[(0, 1.0)]]
write_nth = 2
| WaveBlocks/WaveBlocks | testsuite/basic_diagonal/test_quartic_oscillator_fourier.py | Python | bsd-3-clause | 219 |
# Copyright (c) 2007, Enthought, Inc.
# License: BSD Style.
# temp_wildcard.py --- Example of using a wildcard
# with a trait attribute name
from traits.api import Any, HasTraits
class Person(HasTraits):
temp_ = Any
| burnpanck/traits | examples/tutorials/doc_examples/examples/wildcard_name.py | Python | bsd-3-clause | 246 |
# 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.
import logging
import sys
from telemetry.core import exceptions
from telemetry.core.platform import android_platform_backend as \
android_platform_backend... | SaschaMester/delicium | tools/telemetry/telemetry/internal/backends/chrome/android_browser_backend.py | Python | bsd-3-clause | 6,738 |
#!/usr/bin/python
import sys
sys.path.append('..')
from parse import hextag
from expandmacro import expand
from datadict import *
from modulemacros import *
# check for infinite recursions
for mm in modulemacros:
expand(mm)
def addtosba(tag,element):
if element in sequencesbyattribute:
if tag not in... | Bonubase/dicom2rdf | gen_source/gen_sequencesbyattribute.py | Python | bsd-3-clause | 1,492 |
"""Unit tests for the :mod:`nc-time-axis` package."""
from __future__ import (absolute_import, division, print_function)
from six.moves import (filter, input, map, range, zip) # noqa
| lbdreyer/nc-time-axis | nc_time_axis/tests/unit/__init__.py | Python | bsd-3-clause | 185 |
from StringIO import StringIO
from datetime import datetime
from zeit.cms.checkout.helper import checked_out
from zeit.cms.interfaces import ICMSContent
from zeit.cms.related.interfaces import IRelatedContent
from zeit.cms.testcontenttype.testcontenttype import ExampleContentType
from zeit.cms.workflow.interfaces impor... | ZeitOnline/zeit.cms | src/zeit/workflow/tests/test_publish.py | Python | bsd-3-clause | 15,439 |
'''
Created on 22.07.2015
@author: mEDI
'''
import sqlite3
from datetime import datetime, timedelta
import os
class loader(object):
mydb = None
con = None
dbPath = None
def __init__(self, mydb):
self.mydb = mydb
def connect_BPC_DB(self, dbPath=None):
... | mEDI-S/mEDI_s-Elite-Tools | elite/loader/bpc/prices.py | Python | bsd-3-clause | 5,236 |
# proxy module
from traitsui.wx.array_editor import *
| enthought/etsproxy | enthought/traits/ui/wx/array_editor.py | Python | bsd-3-clause | 54 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/DeviceRequest) on 2017-03-22.
# 2017, SMART Health IT.
from . import domainresource
class DeviceRequest(domainresource.DomainResource):
""" Medical device request.
Represents a re... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_3_0_0/models/devicerequest.py | Python | bsd-3-clause | 9,502 |
# speaker.py
# Group 7 ECE 4900
# Edward Reehorst w/ help from
# http://minhdo.ece.illinois.edu/teaching/speaker_recognition/
# Text independent speaker recognition system based on mel frequency coeffiecient
# features and vector quantization
import array
import numpy as np
import scipy.fftpack as fft
import ... | yekaylee/capstone | capstoneRepo/Demo_version/speaker.py | Python | bsd-3-clause | 7,194 |
"""
flask_slack
~~~~~~~~~~~~~~~
Slack extension for Flask.
:copyright: (c) 2014 by VeryCB.
:license: BSD, see LICENSE for more details.
"""
from .slack import Slack
from .exceptions import SlackError
from .utils import link_string
__all__ = ['Slack', 'SlackError', 'link_string']
__version__ = '0... | VeryCB/flask-slack | flask_slack/__init__.py | Python | bsd-3-clause | 369 |
from .client import OCDAPI, SunlightOCDAPI
| opencivicdata/python-opencivicdata-api | opencivicdata/api/__init__.py | Python | bsd-3-clause | 43 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# lp_errors.py
"""
Declaration of all the errors used by latchpony classes
"""
__all__ = ['LatchPonyError', 'LatchPonyTreeError',
'CompetitionError', 'CompetitionFormatError',
'DuplicateNodeError', 'CompetitionValidationError',
'Competitio... | pythonpro-dev/pp-latchpony | Model/pp/latchpony/model/lp_errors.py | Python | bsd-3-clause | 1,045 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | CartoDB/cartoframes | docs/conf.py | Python | bsd-3-clause | 5,394 |
"""
================================================================
Robust covariance estimation and Mahalanobis distances relevance
================================================================
An example to show covariance estimation with the Mahalanobis
distances on Gaussian distributed data.
For Gaussian dist... | loli/sklearn-ensembletrees | examples/covariance/plot_mahalanobis_distances.py | Python | bsd-3-clause | 6,203 |
#!/usr/bin/env python
"""
Transform DescriptorFileElement instances into Postgres version
"""
import cPickle
import logging
import multiprocessing
import os
import re
from smqtk.representation import DescriptorElementFactory
from smqtk.representation.descriptor_element.local_elements import DescriptorFileElement
from... | Purg/SMQTK | bin/memex/machine_run_scripts/hbase_gpu_machine/transfer_file_descriptors_to_psql.py | Python | bsd-3-clause | 2,993 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# 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 file.
#
# All configurati... | astrofrog/montage-wrapper | docs/conf.py | Python | bsd-3-clause | 5,347 |
class frei0r:
name = "frei0r 1.5.0"
proto = "git"
url = "https://github.com/dyne/frei0r.git"
dirname = "" # leave empty to auto guess
ffmpeg_opts = [ "--enable-frei0r" ]
def has_builtin(self):
return pkg_config_builtin("frei0r");
def skip(self, prefix, force):
if force: re... | chunying/ffmpeg3 | module/frei0r.py | Python | bsd-3-clause | 1,126 |
"""Copyright (c) 2014 Grimod Antoine
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 following di... | sofamaniac/jeu-casse-brique | initialisation.py | Python | bsd-3-clause | 2,194 |
"""
Testing for the forest module (sklearn.ensemble.forest).
"""
# Authors: Gilles Louppe,
# Brian Holt,
# Andreas Mueller,
# Arnaud Joly
# License: BSD 3 clause
import pickle
from collections import defaultdict
from itertools import combinations
from itertools import product
import numpy ... | BiaDarkia/scikit-learn | sklearn/ensemble/tests/test_forest.py | Python | bsd-3-clause | 43,488 |
"""
Models for the Financial Aid App
"""
from django.contrib.auth.models import User
from django.db import (
models,
transaction,
)
from rest_framework.exceptions import ValidationError
from courses.models import Program
from financialaid.constants import FinancialAidStatus
from micromasters.models import (
... | mitodl/micromasters | financialaid/models.py | Python | bsd-3-clause | 4,580 |
# Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import stix
from stix.common import VocabString, Identity
from cybox.core import Observables
import stix.bindings.ttp as ttp_binding
from stix.common.vocabs import SystemType, InformationType
class VictimTargeting(... | benjamin9999/python-stix | stix/ttp/victim_targeting.py | Python | bsd-3-clause | 5,507 |
import webview
from .util import run_test
def test_simple_browser():
window = webview.create_window('Simple browser test', 'https://www.example.org')
run_test(webview, window)
| r0x0r/pywebview | tests/test_simple_browser.py | Python | bsd-3-clause | 186 |
import datetime
from django.db import models
from django.db.models import Q
from django.utils import timezone
class ScrapedObjClass(models.Model):
class Meta:
verbose_name = "Scraped object class"
verbose_name_plural = "Scraped object classes"
name = models.CharField(max_length=200)
scrape... | tanzaho/django-dynamic-scraper | models.py | Python | bsd-3-clause | 7,894 |