code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from __future__ import print_function, division
import sys, os
sys.path.append(os.path.abspath("."))
__author__ = 'panzer'
def eucledian(one, two):
"""
Compute Eucledian Distance between
2 vectors. We assume the input vectors
are normalized.
:param one: Vector 1
:param two: Vector 2
:return:
"""
dis... | ai-se/parGALE | measures/igd.py | Python | unlicense | 760 |
from awxkit.api.resources import resources
from . import page
class Subscriptions(page.Page):
def get_possible_licenses(self, **kwargs):
return self.post(json=kwargs).json
page.register_page(resources.subscriptions, Subscriptions)
| GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awxkit/awxkit/api/pages/subscriptions.py | Python | apache-2.0 | 248 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | graph_embedding/dmon/train_gcn_randomfeatures.py | Python | apache-2.0 | 3,521 |
#!/usr/bin/env python3
# usage
#
# with bazel:
#
# $ bazel run //tools/code_format:python_check -- -h
#
# $ bazel run //tools/code_format:python_check
#
# with pip:
#
# $ pip install envoy.code_format.python_check
# $ envoy.code_format.python_check -h
#
# usage with pip requires a path, eg
#
# $ envoy.code_format... | lyft/envoy | tools/code_format/python_check.py | Python | apache-2.0 | 1,107 |
"""
this module generates markdown format test report for throughput test.
The test report contains 2 parts:
1. throughput with different configs
2. throughput with RSSI
"""
import os
class ThroughputForConfigsReport(object):
THROUGHPUT_TYPES = ['tcp_tx', 'tcp_rx', 'udp_tx', 'udp_rx']
REPORT_FILE_NAME = 'T... | espressif/esp-idf | tools/ci/python_packages/idf_iperf_test_util/TestReport.py | Python | apache-2.0 | 9,169 |
#!/usr/bin/env python
# -*- encoding: UTF-8 -*-
# Copyright Skyscape Cloud Services
#
# 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
#
# U... | skyscape-cloud-services/maloja | maloja/workflow/test/test_path.py | Python | apache-2.0 | 10,228 |
# Copyright (c) 2017-2018 {Flair Inc.} WESLEY PENG
#
# 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... | WesleyPeng/uiXautomation | src/main/python/taf/foundation/plugins/web/selenium/support/browserwaithandler.py | Python | apache-2.0 | 1,826 |
import os
import sys
import argparse
import requests
import codecs
import multiprocessing as mp
import urllib
def main():
odir, wiki_list, depth, cpus, ldir = parse_args()
pages = read_list(wiki_list, depth)
npages = len(pages)
pages_per_cpu = npages / cpus
jobs = []
pid = 0
log_prefix = ... | kedz/cuttsum | old/install-scripts/python/wiki_list2html.py | Python | apache-2.0 | 4,737 |
# Copyright (c) 2013-2018 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
#
# http://... | quarkslab/irma-cli | setup.py | Python | apache-2.0 | 1,136 |
# Copyright 2018 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, ... | GoogleCloudPlatform/marketplace-k8s-app-tools | marketplace/deployer_util/constants.py | Python | apache-2.0 | 640 |
from Bio.config.FormatRegistry import FormatObject, FormatGroup
embl65 = FormatObject(
name = "embl/65",
abbrev = "embl65",
expression = "Bio.expressions.embl.embl65.format",
)
embl = FormatGroup(
name = "embl",
)
embl.add(embl65)
from Bio.formatdefs import sequence
sequence.sequence.add(embl... | dbmi-pitt/DIKB-Micropublication | scripts/mp-scripts/Bio/formatdefs/embl.py | Python | apache-2.0 | 322 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-bigquery-storage | google/cloud/bigquery_storage_v1/services/big_query_read/transports/grpc.py | Python | apache-2.0 | 16,017 |
# Copyright (c) 2014 Andrew Kerr. All rights reserved.
# Copyright (c) 2015 Tom Barron. All rights reserved.
# 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
... | HybridF5/jacket | jacket/tests/storage/unit/volume/drivers/netapp/dataontap/test_nfs_base.py | Python | apache-2.0 | 21,509 |
# Lint as: python3
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | google/automl-video-ondevice | automl_video_ondevice/object_tracking/config.py | Python | apache-2.0 | 967 |
#!/usr/bin/env python
# Author : Pierre Schnizer <pierre@itp.tu-graz.ac.at>
# Date : January 2003
"""
The functions described in this section can be used to perform
least-squares fits to a straight line model, Y = c_0 + c_1 X. For
weighted data the best-fit is found by minimizing the weighted sum of
squared resid... | poojavade/Genomics_Docker | Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/pygsl/fit.py | Python | apache-2.0 | 3,618 |
#!/home/venturi/django/cms/env/bin/python
#
# The Python Imaging Library
# $Id$
#
# split an animation into a number of frame files
#
from __future__ import print_function
from PIL import Image
import os
import sys
class Interval(object):
def __init__(self, interval="0"):
self.setinterval(interval)
... | Venturi/oldcms | env/bin/explode.py | Python | apache-2.0 | 2,461 |
from six import PY2, PY3
import unittest
import re
from robot.utils import unic, prepr, DotDict, JYTHON, IRONPYTHON
from robot.utils.asserts import assert_equals, assert_true
if JYTHON:
from java.lang import String, Object, RuntimeException
import JavaObject
import UnicodeJavaLibrary
class TestJa... | userzimmermann/robotframework | utest/utils/test_unic.py | Python | apache-2.0 | 8,251 |
from insights.combiners.user_namespaces import UserNamespaces
from insights.parsers.cmdline import CmdLine
from insights.parsers.grub_conf import Grub2Config
from insights.tests import context_wrap
ENABLE_TOK_A = '''
user_namespaces.enable=1
'''.strip() # noqa
ENABLE_TOK_B = '''
user-namespaces.enable=1
'''.strip() ... | RedHatInsights/insights-core | insights/combiners/tests/test_user_namespaces.py | Python | apache-2.0 | 4,553 |
# 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, ... | googleapis/protoc-docs-plugin | protoc_docs/code.py | Python | apache-2.0 | 4,774 |
#!/usr/bin/python2.7
# Copyright 2015 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 ... | gimite/personfinder | app/add_note.py | Python | apache-2.0 | 7,635 |
SECRET_KEY = '\xef)*\xbc\xd7\xa9t\x7f\xbc3pH1o\xc1\xe2\xb0\x19\\L\xeb\xe3\x00\xa3'
| ludovicchabant/Wikked | wikked/settings.py | Python | apache-2.0 | 85 |
"""
TLTK
Thai Language Toolkit
:See Also:
* \
https://pypi.org/project/tltk/
"""
from tltk.nlp import spell_candidates
from typing import List
def spell(text: str) -> List[str]:
return spell_candidates(text)
| PyThaiNLP/pythainlp | pythainlp/spell/tltk.py | Python | apache-2.0 | 228 |
import sys
import requests
from time import time
from functools import wraps
from urlparse import urlparse
from os import unlink, makedirs
from os.path import isdir, exists
from optparse import OptionParser
from azure.storage import BlobService
VERSION = 'v1.0.0'
USAGE = 'usage: python %prog -u url -k account_key -p ... | shiehinms/vminspector | util.py | Python | apache-2.0 | 3,436 |
# Lint as: python3
# Copyright 2019 The AdaNet 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless requir... | tensorflow/adanet | adanet/experimental/phases/keras_trainer_phase.py | Python | apache-2.0 | 2,844 |
""" Cisco_IOS_XR_ipv6_ma_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR ipv6\-ma package configuration.
This YANG module augments the
Cisco\-IOS\-XR\-ifmgr\-cfg
module with configuration data.
Copyright (c) 2013\-2015 by Cisco Systems, Inc.
All rights reserved.
"""
import re
import... | abhikeshav/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ipv6_ma_cfg.py | Python | apache-2.0 | 2,508 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 PolyBeacon, Inc.
#
# Author: Paul Belanger <paul.belanger@polybeacon.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
#
#... | kickstandproject/sarlacc | sarlacc/tests/asterisk/agi/test_say_date.py | Python | apache-2.0 | 2,178 |
# -*- coding: utf-8 -*-
# Copyright 2015 Mirantis, 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 requi... | SmartInfrastructures/fuel-web-dev | nailgun/nailgun/api/v1/validators/json_schema/master_node_settings.py | Python | apache-2.0 | 887 |
# -*- 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/v10/services/types/ad_group_service.py | Python | apache-2.0 | 6,155 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fluentcms_teaser', '0002_auto_20150903_0711'),
]
operations = [
migrations.AddField(
model_name='teaseritem',
... | bashu/fluentcms-teaser | fluentcms_teaser/migrations/0003_teaseritem_url_title.py | Python | apache-2.0 | 466 |
# -*- coding: utf-8 -*-
"""Pylab (matplotlib) support utilities."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from io import BytesIO
from IPython.core.display import _pngxy
from IPython.utils.decorators import flag_calls
# If user specifies a GUI, that dict... | Foxfanmedium/python_training | OnlineCoursera/mail_ru/Python_1/env/Lib/site-packages/IPython/core/pylabtools.py | Python | apache-2.0 | 14,262 |
from troposphere import (
Parameter,
Ref,
Output,
Tags,
GetAtt,
Base64,
Join,
Equals,
ec2,
elasticloadbalancing as elb,
autoscaling as asg
)
from cfn.utils.cfn import get_recent_ami
from cfn.utils.constants import (
ALLOW_ALL_CIDR,
EC2_INSTANCE_TYPES,
HTTP,
... | WikiWatershed/model-my-watershed | deployment/cfn/application.py | Python | apache-2.0 | 29,879 |
# encoding: utf-8
import os
import sys
sys.path.append( os.path.join(os.path.dirname(__file__), '..', '..') )
import airflow
from dcmp.models import DcmpDag
from dcmp.dag_converter import dag_converter
from airflow.utils.db import provide_session
@provide_session
def main(session=None):
dcmp_dags = session.quer... | lattebank/airflow-dag-creation-manager-plugin | plugins/dcmp/tools/clean_dag_conf.py | Python | apache-2.0 | 685 |
import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
from phyllo.phyllo_logger import logger
# good to go!
def main():
# The collection URL below.
collURL = 'http://www.thelatinlibrary.com/eucherius.html'
collOpen = urllib.request.urlopen(collURL)
co... | oudalab/phyllo | phyllo/extractors/eucheriusDB.py | Python | apache-2.0 | 3,202 |
"""
Lvm - Combiner for lvm information
==================================
This shared combiner for LVM parsers consolidates all of the information for
the following information:
* LVS
* PVS
* VGS
The parsers gather this information from multiple locations such as Insights
data and SOS Report data and combines the da... | RedHatInsights/insights-core | insights/combiners/lvm.py | Python | apache-2.0 | 13,715 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import sqlite3
from builtins import object, str
from contextlib import contextm... | foursquare/pants | src/python/pants/stats/statsdb.py | Python | apache-2.0 | 5,022 |
"""py-motmetrics - metrics for multiple object tracker (MOT) benchmarking.
Christoph Heindl, 2017
https://github.com/cheind/py-motmetrics
"""
import numpy as np
import numpy.ma as ma
import pandas as pd
from collections import OrderedDict
from itertools import count
from motmetrics.lap import linear_sum_assignment
c... | e2crawfo/dps | motmetrics/mot.py | Python | apache-2.0 | 14,443 |
# Copyright (C) 2014 VA Linux Systems Japan K.K.
# Copyright (C) 2014 Fumihiko Kakuma <kakuma at valinux co jp>
# 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... | bigswitch/neutron | neutron/tests/unit/plugins/ml2/drivers/l2pop/rpc_manager/test_l2population_rpc.py | Python | apache-2.0 | 12,378 |
'''Slickbird base class for tests'''
import sys
import re
import os
import shutil
import tempfile
import json
import requests
from requests.utils import quote
from concurrent.futures import ThreadPoolExecutor
from tornado.concurrent import run_on_executor
from tornado import gen
from tornado.testing import AsyncHTTPT... | lpenz/slickbird | tests/base.py | Python | apache-2.0 | 2,667 |
# stdlib
from datetime import timedelta
from typing import Any
# third party
from fastapi import APIRouter
from fastapi import Body
from fastapi import HTTPException
from fastapi.responses import JSONResponse
from loguru import logger
# syft absolute
from syft import serialize # type: ignore
from syft.core.node.comm... | OpenMined/PySyft | packages/grid/backend/grid/api/auth/login.py | Python | apache-2.0 | 1,640 |
#Copyright 2013 Isotoma 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... | yaybu/callsign | callsign/tests/test_restapi.py | Python | apache-2.0 | 6,051 |
# 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
# d... | a10networks/acos-client | acos_client/tests/unit/v30/test_port.py | Python | apache-2.0 | 3,881 |
# -*- encoding: utf-8 -*-
"""Pinpoints a file path given the __name__ of the calling module.
**Usage**
Example coded on home/repo/drawing_app/draw/smart_draw.py:
::
from pyghosts.ioioio.pinpoint import projectfile_fullpath
print(projectfile_fullpath(__file__))
>> home/repo/drawing_app/draw
print... | timitee/pyghosts | ghosts/ioioio/pinpoint.py | Python | apache-2.0 | 3,615 |
import json
class ConfigHelper(object):
@staticmethod
def load_json_data(config_file):
with open(config_file, 'r') as reader:
json_data = json.loads(reader.read())
reader.close()
return json_data
@staticmethod
def update_config(json_data, config_file):
with... | ShifuML/pyshifu | pyshifu/util/config_helper.py | Python | apache-2.0 | 452 |
import os
import time
import docker
import requests
from docker.models.containers import Container
from requests import Response
from ..utils import (
CONTAINER_NAME,
get_logs,
get_nginx_config,
get_response_text1,
remove_previous_container,
)
client = docker.from_env()
def verify_container(con... | tiangolo/uwsgi-nginx-flask-docker | tests/test_01_main/test_env_vars_03.py | Python | apache-2.0 | 3,769 |
#!/usr/bin/env python2.7
#####################################################################
#
# Copyright 2015 Mayur Patel
#
# 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.... | drone115b/dirb | test.py | Python | apache-2.0 | 36,632 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Defines some constants for the logger handler
:author: Thomas Calmant
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.5.7
:status: Beta
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the... | isandlaTech/cohorte-3rdparty | pelix/src/test/resources/samples/handler/constants.py | Python | apache-2.0 | 1,152 |
import os
import sys
import time
import numpy as np
import pytest
import ray
import ray.ray_constants as ray_constants
@pytest.mark.parametrize(
"ray_start_cluster", [{
"num_cpus": 4,
"num_nodes": 3,
"do_init": True
}],
indirect=True)
def test_actor_creation_node_failure(ray_star... | stephanie-wang/ray | python/ray/tests/test_component_failures_3.py | Python | apache-2.0 | 4,164 |
# Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | tensorflow/probability | tensorflow_probability/python/distributions/gumbel.py | Python | apache-2.0 | 8,933 |
# Copyright 2017 AT&T Intellectual Property. All other 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... | att-comdev/drydock | tests/unit/test_auth_middleware.py | Python | apache-2.0 | 3,874 |
from distutils.core import setup, Extension
import numpy
# define the extension module
chain_forwards_backwards_native = Extension('chain_forwards_backwards_native', sources=['chain_forwards_backwards_native.c'],
include_dirs=[numpy.get_include()])
# run the setup
setup(ext_modules=[... | sebastien-bratieres/pygpstruct | src/chain_forwards_backwards_native/setup.py | Python | apache-2.0 | 355 |
""" Vanilla RNN
lmao
@author Graham Taylor
"""
import numpy as np
import theano
import theano.tensor as T
from sklearn.base import BaseEstimator
import logging
import time
import os
import datetime
import cPickle as pickle
logger = logging.getLogger(__name__)
import matplotlib.pyplot as plt
plt.ion()
mode = theano.M... | CDSFinance/zipline | theano_rnn/rnn.py | Python | apache-2.0 | 23,219 |
#
# 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 ... | openstack/tacker | tacker/tests/functional/sol/vnflcm/base.py | Python | apache-2.0 | 55,167 |
# Create your views here.
import datetime
from django.shortcuts import (render_to_response, HttpResponseRedirect, RequestContext, Http404)
from django.contrib.auth.decorators import login_required
import stripe
from profiles.models import Profile
from profiles.forms import AddressForm
from products.models import Prod... | ferdyrod/basic-ecommerce | cart/views.py | Python | apache-2.0 | 5,568 |
import sys
import os
# To run this on your local machine, you need to setup kafka and create a producer first:
# http://kafka.apache.org/documentation.html#quickstart
# Path for spark source folder
os.environ['SPARK_HOME'] = "/path/to/spark"
# Append pyspark to Python Path
sys.path.append("/path/to/spark/python")
... | MarioPerezEsteso/Network-Anomaly-Detection-Apache-Spark-Kafka | src/main/python/kafka_consumer/kafkaconsumerrandomforest.py | Python | apache-2.0 | 1,737 |
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Django
from django.conf import settings # noqa
from django.db import connection
from django.db.models.signals import pre_delete # noqa
# AWX
from awx.main.models.base import ( # noqa
BaseModel, PrimordialModel, prevent_search, accepts_json,
CLOUD_I... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx/main/models/__init__.py | Python | apache-2.0 | 9,309 |
# -*- 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/v10/resources/types/remarketing_action.py | Python | apache-2.0 | 2,279 |
import asyncio
from unittest import mock
import pytest
from aiohttp import errors, web
@asyncio.coroutine
def test_simple_server(raw_test_server, test_client):
@asyncio.coroutine
def handler(request):
return web.Response(text=str(request.rel_url))
server = yield from raw_test_server(handler)
... | z2v/aiohttp | tests/test_web_server.py | Python | apache-2.0 | 3,207 |
# coding=utf-8
# Copyright 2022 The Balloon Learning Environment Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | google/balloon-learning-environment | balloon_learning_environment/env/balloon/altitude_safety_test.py | Python | apache-2.0 | 5,465 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
TensorLayer provides rich layer implementations trailed for
various benchmarks and domain-specific problems. In addition, we also
support transparent access to native TensorFlow parameters.
For example, we provide not only layers for local response normalization, but also
... | zsdonghao/tensorlayer | tensorlayer/logging/contrib/__init__.py | Python | apache-2.0 | 536 |
# coding=utf-8
import pytz
import datetime
"""
Copyright 2015 Samuel Góngora García
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
... | satnet-project/protocol | ampauth/misc.py | Python | apache-2.0 | 3,639 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import configparser
class Config():
def __init__(self, file):
self.config = configparser.ConfigParser();
self.file = file
self.dict = {}
def get(self):
try:
self.config.read(self.file)
for section in self... | Dirilean/Road | Server/Config.py | Python | apache-2.0 | 583 |
# Copyright (C) Mesosphere, Inc. See LICENSE file for details.
import copy
import logging
import os
import time
import urllib
import pytest
import requests
from generic_test_code.common import (
generic_upstream_headers_verify_test,
generic_verify_response_test,
overridden_file_content,
verify_header... | dcos/dcos | packages/adminrouter/extra/src/test-harness/tests/test_master.py | Python | apache-2.0 | 10,790 |
#
# 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
# ... | eayunstack/neutron | neutron/tests/unit/extensions/test_availability_zone.py | Python | apache-2.0 | 5,803 |
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | bigswitch/nova | nova/tests/unit/test_context.py | Python | apache-2.0 | 11,335 |
# Copyright 2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group 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
#
# Un... | sony/nnabla | python/src/nnabla/backward_function/prelu.py | Python | apache-2.0 | 1,735 |
#!/usr/bin/env python
# Copyright 2014-2021 The PySCF Developers. 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
#
# U... | sunqm/pyscf | pyscf/cc/ccsd_rdm_slow.py | Python | apache-2.0 | 9,115 |
#pylint: disable=W0703,R0912,R0915,R0904,W0105
""" Thread to perform creation of a service """
import os
import traceback
from agent.lib.utils import islink
from agent.lib.utils import readlink
from agent.lib.errors import Errors
from agent.lib.errors import AgentException
from agent.lib.agent_thread.manife... | cronuspaas/cronusagent | agent/agent/lib/agent_thread/useraction_service.py | Python | apache-2.0 | 2,919 |
# Copyright 2017--2022 Amazon.com, Inc. or its affiliates. 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. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fi... | awslabs/sockeye | sockeye/output_handler.py | Python | apache-2.0 | 8,543 |
from pybbn.pptc.evidencecollector import EvidenceCollector
from pybbn.pptc.evidencedistributor import EvidenceDistributor
class Propagator(object):
"""
Evidence propagator.
"""
@staticmethod
def propagate(join_tree):
"""
Propagates evidence.
:param join_tree: Join tree.
... | vangj/py-bbn | pybbn/pptc/propagator.py | Python | apache-2.0 | 1,294 |
# Copyright 2019 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... | ageron/tensorflow | tensorflow/python/saved_model/load_v1_in_v2_test.py | Python | apache-2.0 | 9,405 |
"""This module contains the general information for GpuInventory ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class GpuInventoryConsts:
pass
class GpuInventory(ManagedObject):
"""This is GpuInventory class."""
... | ragupta-git/ImcSdk | imcsdk/mometa/gpu/GpuInventory.py | Python | apache-2.0 | 1,876 |
from random import random
import requests
import ray
from ray import serve
ray.init(num_cpus=8)
serve.start()
# Our pipeline will be structured as follows:
# - Input comes in, the composed model sends it to model_one
# - model_one outputs a random number between 0 and 1, if the value is
# greater than 0.5, then the... | pcmoritz/ray-1 | python/ray/serve/examples/doc/snippet_model_composition.py | Python | apache-2.0 | 1,883 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import time
from pprint import pprint
import click
from kael.microservice import micro_server
from kael.work_frame import WORK_FRAME
file_path = os.path.abspath(os.path.dirname(__file__))
if file_path not in sys.path:
sys.path.insert(0, file_path... | 360skyeye/kael | examples/micro_service/run.py | Python | apache-2.0 | 3,373 |
# Copyright 2017 The Chromium Authors.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd.
from __future__ import absolute_import
import unittest
from .messages import Message, message, XrefSignature, I... | karlinjf/ChromiumXRefs | third_party/codesearch/test_messages.py | Python | apache-2.0 | 6,287 |
# 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... | rew4332/tensorflow | tensorflow/contrib/metrics/python/ops/set_ops.py | Python | apache-2.0 | 11,549 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | coltran/utils/datasets_utils.py | Python | apache-2.0 | 1,912 |
import logging
import tempfile
import time
from googleapiclient import discovery
from googleapiclient import http
from oauth2client.client import GoogleCredentials
# Some of this is copied from:
# https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/storage/api/crud_object.py
# and:
# https://githu... | hammerlab/kubeface | kubeface/bucket_storage.py | Python | apache-2.0 | 6,275 |
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. 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
#
# U... | gkc1000/pyscf | pyscf/dft/test/test_libxc.py | Python | apache-2.0 | 13,507 |
from common import * # NOQA
import yaml
from cattle import ApiError
def _create_service(client, env, image_uuid, service_kind):
labels = {'foo': "bar"}
if service_kind == "service":
launch_config = {"imageUuid": image_uuid, "labels": labels}
service = client.create_service(name=random_str(),
... | vincent99/cattle | tests/integration-v1/cattletest/core/test_svc_selectors.py | Python | apache-2.0 | 7,736 |
# coding: utf-8
# Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | prashanthpai/swift | test/unit/obj/test_server.py | Python | apache-2.0 | 326,271 |
from subprocess import call
from mininet.net import Mininet
from mininet.link import TCLink
from wireless import WirelessHost
class TsaHost(WirelessHost):
def __init__(self, net, name, *args, **kwargs):
super(TsaHost, self).__init__(name, *args, **kwargs)
self.net = net
self.host = net.a... | cgiraldo/tsa-mininet | tsanet.py | Python | apache-2.0 | 6,658 |
#!/usr/bin/env python
"""
Hostname Release
================
This is a simple rule and can be run against the local host
using the following command::
$ insights-run -p examples.rules.hostname_rel
or from the examples/rules directory::
$ ./hostname_rel.py
"""
from insights.core.plugins import make_fail, make... | RedHatInsights/insights-core | examples/rules/hostname_rel.py | Python | apache-2.0 | 1,406 |
#
# 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... | axbaretto/beam | sdks/python/apache_beam/io/gcp/resource_identifiers.py | Python | apache-2.0 | 1,411 |
import os
import errno
import time
import json
import yaml
import boto3
import dulwich
import shutil
import giturlparse
from cStringIO import StringIO
from unidiff import PatchSet
from dulwich import porcelain
from dulwich.contrib.paramiko_vendor import ParamikoSSHVendor
from botocore.exceptions import ClientError
R... | getsocial-rnd/git2params | handler.py | Python | apache-2.0 | 13,966 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-dialogflow-cx | samples/generated_samples/dialogflow_v3beta1_generated_webhooks_get_webhook_sync.py | Python | apache-2.0 | 1,458 |
#!/usr/bin/env python
import os
import rpy2.robjects as robjects
import env
import glm
import utils
lus = ['cropland', 'pasture', 'primary', 'secondary', 'urban']
model_dir = utils.lui_model_dir()
for lu in lus:
print('%s:' % lu)
with open(os.path.join(model_dir, lu + '.py'), 'w') as ofile:
fname = "out/_d5... | ricardog/raster-project | projections/tests/ctest.py | Python | apache-2.0 | 544 |
# Copyright 2015 The Shaderc 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... | fuchsia-mirror/third_party-shaderc | glslc/test/option_shader_stage.py | Python | apache-2.0 | 7,802 |
"""
Biothings API
Support running biothings.web as a module
>> python -m biothings.web
>> python -m biothings.web --dir=~/mygene.info/src
>> python -m biothings.web --dir=~/mygene.info/src --conf=config_web
>> python -m biothings.web --conf=biothings.web.settings.default
See more supp... | biothings/biothings.api | biothings/web/__main__.py | Python | apache-2.0 | 418 |
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | townbull/mtaaas-openstack | mtaaas/openstack/common/notifier/rpc_notifier2.py | Python | apache-2.0 | 1,916 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.23
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | kubernetes-client/python | kubernetes/client/models/v2beta1_container_resource_metric_source.py | Python | apache-2.0 | 7,856 |
# -*- coding: utf-8 -*-
# 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, softw... | jkoelker/plow | plow/manager.py | Python | apache-2.0 | 2,106 |
# Copyright 2017 AT&T Intellectual Property. All other 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... | att-comdev/drydock | tests/integration/postgres/test_orch_generic.py | Python | apache-2.0 | 2,797 |
from django.http import HttpResponse
from django.core.exceptions import PermissionDenied
from django.dispatch import receiver
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_POST
from gui.decorators import ajax_req... | erigones/esdc-ce | gui/vm/replication/views.py | Python | apache-2.0 | 2,656 |
# Copyright (c) 2016-2019 Chris Reed
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | flit/cmdis | cmdis/decoder.py | Python | apache-2.0 | 12,607 |
# Copyright 2013 - Noorul Islam K M
#
# 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... | kevin-zhaoshuai/zun | zun/api/config.py | Python | apache-2.0 | 873 |
# -*- coding: utf-8 -*-
"""
Created on Mar 13, 2012
@author: moloch
Copyright 2012 Root the Box
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/licen... | moloch--/RootTheBox | handlers/UserHandlers.py | Python | apache-2.0 | 12,489 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | platformio/platformio-core | platformio/commands/home/helpers.py | Python | apache-2.0 | 1,738 |
__author__ = 'Joe Linn'
from pylastica.param import Param
class Suggest(Param):
"""
@see: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters.html
"""
def __init__(self, suggestion=None):
"""
@param suggestion: optional
@type suggestion: py... | jlinn/pylastica | pylastica/suggest/suggest.py | Python | apache-2.0 | 1,028 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-08-10 07:29
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depend... | unicef/un-partner-portal | backend/unpp_api/apps/project/migrations/0070_auto_20180810_0729.py | Python | apache-2.0 | 1,173 |
import pytest
import aiohttp
from aiohttp import content_disposition_filename, parse_content_disposition
class TestParseContentDisposition:
# http://greenbytes.de/tech/tc2231/
def test_parse_empty(self) -> None:
disptype, params = parse_content_disposition(None)
assert disptype is None
... | arthurdarcet/aiohttp | tests/test_multipart_helpers.py | Python | apache-2.0 | 27,327 |