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 |
|---|---|---|---|---|---|
# 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 u... | MBoustani/climate | RCMES/test/test.py | Python | apache-2.0 | 8,154 |
'''
from django.core.handlers.wsgi import WSGIHandler
# setup the environment for Django
from webapp import environment
environment.setup_environ(__file__)
# set application for WSGI processing
application = WSGIHandler()
'''
import os
import sys
from django.utils.importlib import import_module
from django.core.ha... | zhiwehu/IBookmark | webapp/wsgi.py | Python | apache-2.0 | 1,719 |
from setuptools import find_packages
from setuptools import setup
package_name = 'ament_cpplint'
setup(
name=package_name,
version='0.12.1',
packages=find_packages(exclude=['test']),
data_files=[
('share/' + package_name, ['package.xml']),
('share/ament_index/resource_index/packages',
... | ament/ament_lint | ament_cpplint/setup.py | Python | apache-2.0 | 1,378 |
from vodka.app import get_application
instances = {}
def get_instance(name):
"""
wrapper function to retrieve instance
Args:
name (str): instance name - identical to appliction class handle value
Returns:
application instance with the matching name
Raises:
KeyError: No ... | 20c/vodka | src/vodka/instance.py | Python | apache-2.0 | 1,026 |
# Copyright (c) 2015 Infoblox Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | huntxu/neutron | neutron/db/ipam_pluggable_backend.py | Python | apache-2.0 | 26,071 |
# Deprecated module: Use ray.rllib.env.wrappers.recsim instead!
from ray.rllib.env.wrappers.recsim import ( # noqa: F401
make_recsim_env,
MultiDiscreteToDiscreteActionWrapper,
RecSimObservationSpaceWrapper,
RecSimResetWrapper,
)
from ray.rllib.utils.deprecation import deprecation_warning
deprecation_w... | ray-project/ray | rllib/env/wrappers/recsim_wrapper.py | Python | apache-2.0 | 437 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 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
#
# ... | Jumpscale/web | pythonlib/watchdog/version.py | Python | apache-2.0 | 974 |
# 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 u... | zhouyao1994/incubator-superset | superset/migrations/versions/80aa3f04bc82_add_parent_ids_in_dashboard_layout.py | Python | apache-2.0 | 3,646 |
from mock import Mock, patch
import unittest
from contextio.lib.errors import MissingResourceId
from contextio.lib.resources.base_resource import BaseResource
class MockResource(BaseResource):
resource_id = "id"
keys = ["id", "foo", "baz"]
def __init__(self, parent, definition):
super(MockResour... | contextio/Python-ContextIO | tests/lib/resources/test_base_resource.py | Python | apache-2.0 | 7,011 |
from .vision import VisionDataset
from PIL import Image
import os
import os.path
from typing import Any, Callable, cast, Dict, List, Optional, Tuple
def has_file_allowed_extension(filename: str,
extensions: Tuple[str, ...]) -> bool:
"""Checks if a file is an allowed extension.
... | PaddlePaddle/models | tutorials/mobilenetv3_prod/Step1-5/mobilenetv3_ref/torchvision/datasets/folder.py | Python | apache-2.0 | 11,649 |
# Copyright (c) 2016 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 ... | openstack/networking-odl | networking_odl/ml2/port_binding.py | Python | apache-2.0 | 5,233 |
# 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 | learn_to_infer/ring_models.py | Python | apache-2.0 | 6,645 |
#!/usr/bin/env python
from __future__ import print_function
import pyacc
class App(pyacc.AccCommandLineApp):
"""
List IntroscopeAgent profile fragments associated with bundles
"""
def build_arg_parser(self):
"""
Add some more args to the standard set
"""
super(App, se... | CA-APM/ca-apm-acc-api-scripts | python-library-and-examples/profiles.py | Python | apache-2.0 | 1,838 |
# -*- 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_feed_service.py | Python | apache-2.0 | 6,350 |
"""
CmdLine - file ``/proc/cmdline``
================================
This reads the ``/proc/cmdline`` file, which contains the arguments given to
the currently running kernel on boot.
Sample input::
BOOT_IMAGE=/vmlinuz-3.10.0-327.36.3.el7.x86_64 root=/dev/system_vg/Root ro rd.lvm.lv=system_vg/Root crashkernel=a... | PaulWay/insights-core | insights/parsers/cmdline.py | Python | apache-2.0 | 1,992 |
# Definition for a binary tree node
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
# @param num, a list of integers
# @return a tree node
def sortedArrayToBST(self, num):
return self.solve(num, 0, len(num))
... | xiaonanln/myleetcode-python | src/Convert Sorted Array to Binary Search Tree.py | Python | apache-2.0 | 655 |
#!/usr/bin/env python
# Copyright 2015 Coursera
#
# 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 ag... | coursera/courseraprogramming | courseraprogramming/commands/oauth2.py | Python | apache-2.0 | 17,355 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2012 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... | cvandeplas/plaso | plaso/parsers/sqlite_plugins/ls_quarantine.py | Python | apache-2.0 | 2,954 |
"""Support for AVM Fritz!Box functions."""
import logging
from fritzconnection.core.exceptions import FritzConnectionException, FritzSecurityError
from fritzconnection.core.logger import fritzlogger
from requests import exceptions
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CO... | home-assistant/home-assistant | homeassistant/components/fritz/__init__.py | Python | apache-2.0 | 2,779 |
import sys
import ConfigParser
from Crypto.Cipher import AES
import hashlib
import base64
import string
import random
import os
import time
import getpass
from os import walk
from shutil import copyfile
'''
to later set the color of some objects this is needed:
from termcolor import colored
print colored('hello', 're... | omniscent/omnirepo | omnisearch_v0.7.py | Python | apache-2.0 | 40,271 |
#
# Copyright (c) SAS Institute Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | sassoftware/restlib | restlib/http/modpython.py | Python | apache-2.0 | 4,087 |
import pytz
import json
from modularodm.exceptions import ValidationValueError
from rest_framework import serializers as ser
from rest_framework import exceptions
from api.base.utils import absolute_reverse, get_user_auth
from website.project.metadata.utils import is_prereg_admin_not_project_admin
from website.excep... | alexschiller/osf.io | api/registrations/serializers.py | Python | apache-2.0 | 15,888 |
# Copyright 2019 D-Wave Systems 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... | dwavesystems/dimod | dimod/reference/composites/truncatecomposite.py | Python | apache-2.0 | 3,601 |
from functools import wraps
import json
import flask as fl
def returns_json(f):
""" A decorator for Flask route handlers that return JSON.
Any route handler decorated by this function needs to return a pair
(dictionary, status code). The dictionary is automatically converted into
a JSON string. The s... | NICTA/dora | dora/server/response.py | Python | apache-2.0 | 688 |
# (C) Copyright 2014-2017 Hewlett Packard Enterprise Development LP
# Copyright 2017 FUJITSU 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/LICE... | openstack/monasca-notification | monasca_notification/main.py | Python | apache-2.0 | 4,356 |
# ------------------------------------------------------------
# pyos7.py - The Python Operating System
#
# Step 6 : I/O Waiting Support added
# ------------------------------------------------------------
# ------------------------------------------------------------
# === Tasks ===
# --------... | iamaris/xpython | coroutines/pyos7.py | Python | apache-2.0 | 5,040 |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | Aloomaio/googleads-python-lib | examples/ad_manager/v201811/product_template_service/create_programmatic_product_templates.py | Python | apache-2.0 | 2,979 |
# 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-common-python | support/django/tests/__init__.py | Python | apache-2.0 | 805 |
# Copyright 2017 <thenakliman@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | thenakliman/nirikshak | nirikshak/tests/unit/workers/files/test_ini.py | Python | apache-2.0 | 1,686 |
# Copyright (c) 2007-2008 The PyAMF Project.
# See LICENSE for details.
"""
General tests.
@author: U{Nick Joyce<mailto:nick@boxdesign.co.uk>}
@since: 0.1.0
"""
import unittest
import pyamf
from pyamf.tests.util import ClassCacheClearingTestCase
class Spam(object):
"""
A generic class used in class regist... | jamesward-demo/air-quick-fix | AIRQuickFixServer/pyamf/tests/test_basic.py | Python | apache-2.0 | 20,575 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | QISKit/qiskit-sdk-py | test/python/transpiler/_dummy_passes.py | Python | apache-2.0 | 6,467 |
# 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 unde... | tengqm/senlin | senlin/tests/apiv1/test_policy_types.py | Python | apache-2.0 | 4,920 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# 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... | hpproliant/ironic | ironic/tests/unit/drivers/third_party_driver_mocks.py | Python | apache-2.0 | 11,588 |
import lib.search.bing_search as bing
import lib.tweet.parseTwitter as twitter
from lib.querygen.tweets2query import QueryGenerator
import lib.summarization.tagdef as tagdef
from lib.summarization import extractor
import string
import logging
logging.basicConfig(level=logging.INFO)
logger = logging
def main():
i... | mzweilin/HashTag-Understanding | job.py | Python | apache-2.0 | 1,987 |
# Copyright 2016 Peter May
#
# 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... | pmay/storage-stats | storage_stats/__main__.py | Python | apache-2.0 | 3,645 |
from builtins import bytes
import logging
from subprocess import Popen, STDOUT, PIPE
from tempfile import gettempdir, NamedTemporaryFile
from airflow.utils import AirflowException
from airflow.models import BaseOperator
from airflow.utils import apply_defaults, TemporaryDirectory
class BashOperator(BaseOperator):
... | moritzpein/airflow | airflow/operators/bash_operator.py | Python | apache-2.0 | 2,954 |
import cv2
import numpy as np
import math
import time
from handrecog import detect_hand
VIDEO_MODE = False
def main():
cap = None
counter = 0
if VIDEO_MODE:
cap = cv2.VideoCapture(0)
while(cap.isOpened()):
if (counter % 30 == 0):
ret, img = cap.read()
warning = detect_hand(img, True)
if warning... | kamladi/Glassistant | assistant/hand_detection/main.py | Python | apache-2.0 | 644 |
#
# 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
# ... | rdo-management/heat | heat/engine/resources/aws/ec2/eip.py | Python | apache-2.0 | 17,984 |
# -*- 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-pubsub | tests/unit/gapic/pubsub_v1/test_subscriber.py | Python | apache-2.0 | 195,501 |
# 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 unde... | openstack/senlin | contrib/vdu/vdu/server.py | Python | apache-2.0 | 55,527 |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Handlers for workflow notifications.
This module contains all function needed for handling notification objects
needed by workflow notifications. The exposed functions are the entry points
for callback l... | AleksNeStu/ggrc-core | src/ggrc_workflows/notification/notification_handler.py | Python | apache-2.0 | 11,206 |
# Copyright 2012 NetApp
# 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 applic... | NetApp/manila | manila/tests/api/v1/test_shares.py | Python | apache-2.0 | 46,227 |
import os
from syncplay import constants
from syncplay.players.mpv import MpvPlayer
from syncplay.utils import playerPathExists
class MpvnetPlayer(MpvPlayer):
@staticmethod
def run(client, playerPath, filePath, args):
constants.MPV_NEW_VERSION = True
constants.MPV_OSC_VISIBILITY_CHANG... | Syncplay/syncplay | syncplay/players/mpvnet.py | Python | apache-2.0 | 1,562 |
from scriptcore.testing.testcase import TestCase
from scriptcore.process.thread import Thread
class TestThread(TestCase):
def test_thread(self):
"""
Test Thread
:return: void
"""
target, exp_out, exp_err, exp_exitcode = self._get_target_and_expected()
thread ... | LowieHuyghe/script-core | tests/process/testthread.py | Python | apache-2.0 | 1,021 |
from typing import List, Optional, Dict
import numpy as np
import tensorflow as tf
from docqa.configurable import Configurable
from docqa.data_processing.qa_training_data import ParagraphAndQuestionSpec, ContextAndQuestion
from docqa.data_processing.span_data import ParagraphSpans, TokenSpans
from docqa.data_processi... | allenai/document-qa | docqa/encoder.py | Python | apache-2.0 | 22,038 |
# 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 u... | apache/incubator-airflow | airflow/utils/log/secrets_masker.py | Python | apache-2.0 | 9,481 |
import os
def isLocal():
return os.environ["SERVER_NAME"] == "localhost"
| henrique/DistEvo | webapp/util.py | Python | apache-2.0 | 86 |
# Copyright 2011 Gilt Groupe, 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,... | downneck/mothership | mothership/configure/__init__.py | Python | apache-2.0 | 14,822 |
from .helper import MinetteForTest
| uezo/minette-python | minette/testing/__init__.py | Python | apache-2.0 | 35 |
# 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 agreed to in writing, ... | google/lightweight_mmm | lightweight_mmm/media_transforms_test.py | Python | apache-2.0 | 5,299 |
# Import library
import osisoftpy
# Authenticate
webapi = osisoftpy.webapi('https://dev.dstcontrols.com/piwebapi/')
# Get points
point_list = webapi.points(query='name:SINU*')
point_list2 = webapi.points(query='name:CDT*')
for individual_point in point_list2:
point_list.append(individual_point)
# Read latest val... | dstcontrols/osisoftpy | examples/minimal_example_for_quickstart.py | Python | apache-2.0 | 515 |
#!/usr/bin/env python
# Copyright 2013 Google Inc. All Rights Reserved.
"""Unit tests for number theory functions."""
import struct
from google.apputils import app
from google.apputils import basetest as googletest
import number
class NumberTheoryTest(googletest.TestCase):
def testGCD(self):
self.assertE... | google/encrypted-bigquery-client | src/number_test.py | Python | apache-2.0 | 4,219 |
# -*- coding: utf-8 -*-
# Copyright 2016 Open Permissions Platform Coalition
# 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... | openpermissions/repository-srv | repository/models/queries/generic.py | Python | apache-2.0 | 5,199 |
"""HTTP Validation"""
import time
import urlparse
import os
import requests
import copy
from alarmageddon.validations.validation import Validation, Priority
from alarmageddon.validations.json_expectations import \
ExpectedJsonValueLessThan, \
ExpectedJsonValueGreaterThan, \
ExpectedJsonEquality
from alar... | curtisallen/Alarmageddon | alarmageddon/validations/http.py | Python | apache-2.0 | 11,792 |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# 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/licens... | UManPychron/pychron | pychron/hardware/FerrupsUPS.py | Python | apache-2.0 | 3,433 |
# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... | viktorTarasov/PyKMIP | kmip/services/server/repo/mem_repo.py | Python | apache-2.0 | 1,657 |
from .api import api
from flask_restful import Resource
from bauth import auth
class HelloWorld(Resource):
decorators = [auth.login_required]
def get(self):
print 'request received'
return {'hello': 'world'}
api.add_resource(HelloWorld, '/somepath') | CMPUT404W16/social-dist | fbook/api/example.py | Python | apache-2.0 | 258 |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import collections
import uuid
import copy
import heapq
import json
import re
import sqlite3
import logging
import os
import numpy as np
import six
import neuroglancer
debug_graph = False
verbose_merging = False
def normalize_edge((id_a,... | seung-lab/neuroglancer | python/neuroglancer/tool/agglomeration_split_tool.py | Python | apache-2.0 | 29,368 |
import socket
def GetCurrentAddress():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 0)) # connecting to a UDP address doesn't send packets
local_ip_address = s.getsockname()[0]
return local_ip_address
def GetTurtleName():
turtle_name = socket.gethostname()
ret... | RobotTurtles/mid-level-routines | Utilities/TurtleInfo.py | Python | apache-2.0 | 336 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mig_main', '0003_officerposition_position_type'),
]
operations = [
migrations.CreateModel(
name='Committee',
... | tbpmig/mig-website | mig_main/migrations/0004_committee.py | Python | apache-2.0 | 736 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import os
from dataclasses import dataclass
from pants.backend.docker.target_types import DockerImageSourceField, DockerImageTarget
from pants.core.goa... | pantsbuild/pants | src/python/pants/backend/docker/goals/tailor.py | Python | apache-2.0 | 1,775 |
# Copyright 2011, VMware, 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... | igor-toga/local-snat | neutron/common/utils.py | Python | apache-2.0 | 24,671 |
from SALib.sample import saltelli
from SALib.analyze import sobol
from SALib.test_functions import Ishigami
import numpy as np
# buy_roc = np.arange(0.05, 0.41, 0.05)
# sell_roc = np.arange(0.05, 0.41, 0.05)
# buy_target = np.arange(0.2, 1.01, 0.2)
# sell_target = np.arange(0.2, 1.01, 0.2)
# Define the model inputs
p... | jdtogni/trader | tests/sens/sens.py | Python | apache-2.0 | 900 |
"""
Django settings for MySite project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... | tyhtao1990/BaymaxHome | MyBlog/MySite/MySite/settings.py | Python | apache-2.0 | 3,170 |
"""Platform for the iZone AC."""
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_EXCLUDE
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
from .const import DATA_... | kennedyshead/home-assistant | homeassistant/components/izone/__init__.py | Python | apache-2.0 | 1,602 |
class Users():
def __init__(self):
self.users = {
"Abaev" : "XWiki.abaev",
"Abeck" : None,
"Adam.congdon" : None,
"Addbug" : None,
"Adenisov" : None,
"Aevstratova" : "XWiki.aevstratova",
"Agolub... | daymer/xWIKI_Karma | Migration_to_xWiki/Users_association.py | Python | apache-2.0 | 6,434 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | obulpathi/cloud | dataflow/cookbook/multiple_output_pardo.py | Python | apache-2.0 | 6,213 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | DavidNorman/tensorflow | tensorflow/python/framework/func_graph.py | Python | apache-2.0 | 50,815 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | jamielennox/requests-mock | requests_mock/response.py | Python | apache-2.0 | 10,761 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/jaxopt | jaxopt/_src/fixed_point_iteration.py | Python | apache-2.0 | 4,572 |
from __future__ import annotations
from abc import abstractmethod, ABC
from typing import Optional, Text, List, Dict, Any
import logging
from rasa.engine.graph import GraphComponent
from rasa.engine.storage.storage import ModelStorage
from rasa.engine.storage.resource import Resource
from rasa.engine.runner.interface ... | RasaHQ/rasa_nlu | rasa/core/policies/ensemble.py | Python | apache-2.0 | 12,958 |
from aiohttp.test_utils import unittest_run_loop
from tests import BaseTestCase
class IndexTestCase(BaseTestCase):
@unittest_run_loop
async def test_index_page(self):
request = await self.client.request("GET", "/")
assert request.status == 200
text = await request.text()
asser... | bndr/basic-uploader | tests/frontend/test_index_page.py | Python | apache-2.0 | 391 |
'''
// Copyright 2008 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 agre... | NBor/SkyPython | src/rendererUtil/NightVisionColorBuffer.py | Python | apache-2.0 | 2,847 |
#! /usr/bin/env python3
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | google/neural-logic-machines | difflogic/nn/neural_logic/modules/neural_logic.py | Python | apache-2.0 | 1,738 |
"""Base classes for OWASP dependency check collector unit tests."""
from ..source_collector_test_case import SourceCollectorTestCase
class OWASPDependencyCheckTestCase(SourceCollectorTestCase): # skipcq: PTC-W0046
"""Base class for OWASP dependency check collector unit tests."""
SOURCE_TYPE = "owasp_depend... | ICTU/quality-time | components/collector/tests/source_collectors/owasp_dependency_check/base.py | Python | apache-2.0 | 1,744 |
from channels import Channel
from django.conf import settings
from django.core.paginator import Paginator, EmptyPage, InvalidPage
from django.core.urlresolvers import reverse
from wsgiref.util import FileWrapper
from django.contrib.sites.shortcuts import get_current_site
from django.http import Http404, HttpResponse, H... | emory-libraries/readux | readux/books/views.py | Python | apache-2.0 | 34,948 |
# -*- coding: utf-8
# 'version': '0.3'
#
# Copyright (c) 2017, Stephen B, Hope, All rights reserved.
#
# CommAI-env Copyright (c) 2016-present, Facebook, Inc., All rights reserved.
# Round1 Copyright (c) 2017-present, GoodAI All rights reserved.
#
# This source code is licensed under the BSD-style license found in the... | Intelligent-Machine-Learning/Round1 | src/tasks/competition/tests/helpers.py | Python | apache-2.0 | 5,600 |
"""
Django settings for jabbs project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# ... | Santiago-vdk/jabbs | jabbs/settings.py | Python | apache-2.0 | 3,653 |
# Copyright 2021 The QHBM Library 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 required by appl... | google/qhbm-library | tests/test_util_test.py | Python | apache-2.0 | 4,769 |
# Copyright (c) 2016 PaddlePaddle 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 applic... | kuke/models | fluid/PaddleNLP/text_matching_on_quora/configs/cdssm.py | Python | apache-2.0 | 1,159 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/transform/transformaction.py | Python | apache-2.0 | 16,497 |
"""Allows loading control_flow_programs raw data."""
import functools
import tensorflow as tf
from core.data import tf_io
_int64_feature = tf_io.int64_feature
_float_feature = tf_io.float_feature
_bytes_feature = tf_io.bytes_feature
_int64_scalar_feature = tf_io.int64_scalar_feature
_int64_sequence_feature = tf_io.... | google-research/runtime-error-prediction | core/data/cfp_data_io.py | Python | apache-2.0 | 1,243 |
def codemania_medal(user_time, gold, silver, bronze):
m = user_time.split(":")
n = gold.split(":")
o = silver.split(":")
p = bronze.split(":")
u = m[0] * 60 * 60 + m[1] * 60 + m[2]
g = n[0] * 60 * 60 + n[1] * 60 + n[2]
s = o[0] * 60 * 60 + o[1] * 60 + o[2]
b = p[0] * 60 * 60 + p[1] * 60 ... | vbsteja/code | Python/HA_CF/codefights_user_medal.py | Python | apache-2.0 | 485 |
from selenium.webdriver.firefox.webdriver import WebDriver
class Application:
def __init__(self):
self.wd = WebDriver()
self.wd.implicitly_wait(60)
def logout(self):
wd = self.wd
wd.find_element_by_link_text("Logout").click()
def return_to_group_page(self):
wd = self.wd
wd.find_element_by_link_tex... | Alex-Chizhov/python_training | home_work_4_fixture/application.py | Python | apache-2.0 | 5,253 |
class CP_HTTP_RESULT(object):
CP_HTTP_OK = 200
CP_HTTP_CREATED = 201
CP_HTTP_MULTI_STATUS = 207
CP_HTTP_BAD_REQUEST = 400
CP_HTTP_UNAUTHORIZED = 401
CP_HTTP_PAYMENT_REQUIRED = 402
CP_HTTP_FORBIDDEN = 403
CP_HTTP_NOT_FOUND = 404
CP_HTTP_NOT_ALLOWED = 405
CP_HTTP_NOT_ACCEPTABLE =... | cloudplugs/rest-python | cp_rest.py | Python | apache-2.0 | 946 |
"""Worker management and helper commands"""
import os
import logging
import argparse
from rtrss import config, scheduler, database, manager, util
_logger = logging.getLogger(__name__)
def worker_init():
_logger.debug('Initializing worker')
util.set_signal_handlers()
def worker_teardown():
_logger.deb... | notapresent/rtrss | rtrss/worker.py | Python | apache-2.0 | 2,013 |
# Copyright 2017 The Armada 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 or agreed to in w... | theyer/armada | armada/cli/validate.py | Python | apache-2.0 | 1,682 |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
i... | kubevirt/client-python | test/test_v1_ssh_public_key_access_credential_source.py | Python | apache-2.0 | 1,077 |
import pytest
from indy import agent, IndyError
from indy.error import ErrorCode
@pytest.mark.asyncio
async def test_agent_close_listener_works_for_outgoing(endpoint, wallet_with_identity):
listener_handle = await agent.agent_listen(endpoint)
assert type(listener_handle) is int
wallet_handle, did = wall... | korsimoro/indy-sdk | wrappers/python/tests/agent/test_agent_close_listener.py | Python | apache-2.0 | 1,009 |
__version__ = ".2"
WARNING_BLURB = "This report was generated by VDM Version %s. This is development software." % __version__
HTMLREPORTHEAD = """<!DOCTYPE html>
<html lang="en">
<head>
<title>%s</title>
<meta charset="utf-8" />
<link rel='stylesheet' href='http://www.caregraf.org/semanticvista/analytics/VOLDEMO... | VAchris/VOLDEMORT | vdm/vdmU.py | Python | apache-2.0 | 606 |
import os
from datetime import datetime
import django
import lightbus
from lightbus.utilities.django import uses_django_db
bus = lightbus.create()
class AnalyticsApi(lightbus.Api):
page_view = lightbus.Event(
parameters=(
lightbus.Parameter("pk", int),
lightbus.Parameter("viewed_... | adamcharnock/lightbus | lightbus_examples/ex06_django/bus.py | Python | apache-2.0 | 1,102 |
from uzentropi import PLATFORM, PYTHON, MINUTES, Agent, on_timer, on_event, asyncio
if PLATFORM is PYTHON:
try:
import requests
except ImportError as e:
raise ImportError('pip install requests')
import time
api_url = 'https://icanhazip.com'
else:
try:
import urequests as re... | zentropi/python-uzentropi | examples/07-router-rebooter/router_agent.py | Python | apache-2.0 | 1,546 |
# 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/test/blueprints/test_jobs_queue.py | Python | apache-2.0 | 5,570 |
# Copyright 2015: 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 required b... | vishnu-kumar/PeformanceFramework | rally/plugins/aws/scenario.py | Python | apache-2.0 | 2,659 |
# Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | quantumlib/Cirq | cirq-core/cirq/ion/__init__.py | Python | apache-2.0 | 1,099 |
"""Collector exceptions."""
class CollectorException(Exception):
"""Something went wrong collecting information."""
| ICTU/quality-time | components/collector/src/collector_utilities/exceptions.py | Python | apache-2.0 | 122 |
__source__ = 'https://leetcode.com/problems/word-break-ii/#/description'
# https://github.com/kamyu104/LeetCode/blob/master/Python/word-break-ii.py
# Time: O(2^n)
# Space: O(n)
# DP
#
# Description: Leetcode # 140. Word Break II
#
# Given a non-empty string s and a dictionary wordDict containing a list of non-empty wo... | JulyKikuAkita/PythonPrac | cs15211/WordBreakII.py | Python | apache-2.0 | 8,200 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#This Class extracts major Nouns using TF-IDF Algorithm
from __future__ import division, unicode_literals
import math
from ExtractNouns import *
import sys
from goose import Goose
from goose.text import StopWordsKorean
reload(sys)
sys.setdefaultencoding('utf-8')
#cla... | hanyangii/SummThing | TF_IDF.py | Python | apache-2.0 | 3,296 |
from django.conf.urls import patterns, url
from download import views
urlpatterns = patterns('',
url(r'^$', views.custom, name='download'),
url(r'^legacy/$', views.legacy, name='legacy'),
url(r'^custom/$', views.custom, name='custom'),
url(r'^register/$', views.register, name='register'),
url(r'^d... | polojacky/ehfpi | ehf/download/urls.py | Python | apache-2.0 | 428 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 14 15:54:56 2017
crnn
@@ model url https://github.com/bgshih/crnn and https://github.com/meijieru/crnn.pytorch
author = {Baoguang Shi and
Xiang Bai and
Cong Yao},
title = {An End-to-End Train... | lywen52/quantproject | model/ocr/english/ocr.py | Python | apache-2.0 | 1,618 |