code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/clusterfuzz | src/clusterfuzz/_internal/bot/untrusted_runner/remote_process.py | Python | apache-2.0 | 3,341 |
import gevent
import gevent.pool
import uuid
import logging
def get_trace(greenlet=None):
greenlet = greenlet or gevent.getcurrent()
if not hasattr(greenlet, '_iris_trace'):
greenlet._iris_trace = {}
return greenlet._iris_trace
def spawn(*args, **kwargs):
greenlet = gevent.Greenlet(*args, **... | kpanic/lymph | iris/core/trace.py | Python | apache-2.0 | 983 |
default_app_config = 'leonardo.apps.LeonardoConfig'
__import__('pkg_resources').declare_namespace(__name__)
try:
from leonardo.base import leonardo # noqa
except ImportError:
import warnings
def simple_warn(message, category, filename, lineno, file=None, line=None):
return '%s: %s' % (category... | amboycharlie/Child-Friendly-LCMS | leonardo/__init__.py | Python | apache-2.0 | 520 |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from .common import BaseTest
import jmespath
class TestApacheAirflow(BaseTest):
def test_airflow_environment_value_filter(self):
session_factory = self.replay_flight_data('test_airflow_environment_value_filter')
p = sel... | thisisshi/cloud-custodian | tests/test_airflow.py | Python | apache-2.0 | 3,504 |
'''
Created on Aug 29, 2015
@author: kevinchien
'''
import datetime
# from bson import ObjectId
from tornado.gen import Task, Return
from tornado.gen import coroutine
from src.common.logutil import get_logger
# from src.core.mongoutil import get_instance
#
# @coroutine
# def update_auth(auth_info):
# new_auth_in... | cchienhao/data_collector | src/collectors/fitbit/dao.py | Python | apache-2.0 | 841 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the Google Drive database plugin."""
from __future__ import unicode_literals
import unittest
from plaso.formatters import gdrive as _ # pylint: disable=unused-import
from plaso.lib import definitions
from plaso.parsers.sqlite_plugins import gdrive
from te... | rgayon/plaso | tests/parsers/sqlite_plugins/gdrive.py | Python | apache-2.0 | 2,876 |
# -*- 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-error-reporting | google/cloud/errorreporting_v1beta1/services/report_errors_service/client.py | Python | apache-2.0 | 22,790 |
from boten.core import BaseBot
import payloads
class TestBot(BaseBot):
def command_arg_bot(self, user_name):
yield "hello {}".format(user_name)
def command_no_arg_bot(self):
yield "hello"
def command_optional_arg_bot(self, optional="default"):
yield "hello {}".format(optional)
... | forter/boten | test/test_botparse.py | Python | apache-2.0 | 2,177 |
# -*- coding: utf-8 -*-
# Copyright Tom SF Haines
#
# 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... | Panda3D-google-code-repositories/naith | game/plugins/simpleweapon/simpleweapon.py | Python | apache-2.0 | 7,962 |
__source__ = 'https://leetcode.com/problems/balanced-binary-tree/#/description'
# https://github.com/kamyu104/LeetCode/blob/master/Python/balanced-binary-tree.py
# Time: O(n)
# Space: O(h), h is height of binary tree
# divide and conquer
#
# Description: Leetcode # 110. Balanced Binary Tree
#
# Given a binary tree, de... | JulyKikuAkita/PythonPrac | cs15211/BalancedBinaryTree.py | Python | apache-2.0 | 5,434 |
#!/usr/bin/env python3
#
# This file is open source software, licensed to you under the terms
# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
# distributed with this work for additional information regarding copyright
# ownership. You may not use this file except in compliance with the Licen... | ducthangho/imdb | test.py | Python | apache-2.0 | 5,282 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# Copyright (c) 2013 Hewlett-Pa... | CloudServer/nova | nova/virt/libvirt/guest.py | Python | apache-2.0 | 9,019 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cd_subscription', '0004_auto_20161125_1901'),
]
operations = [
migrations.AlterField(
model_name='cdsubscription... | cropr/bjk2017 | cd_subscription/migrations/0005_auto_20161125_1908.py | Python | apache-2.0 | 2,446 |
# Copyright 2021 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-web/cirq_web/circuits/symbols.py | Python | apache-2.0 | 5,383 |
#!/usr/bin/env python
# Copyright 2014, Rackspace US, 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 applicabl... | stevelle/rpc-openstack | maas/plugins/rabbitmq_status.py | Python | apache-2.0 | 7,579 |
# -*- coding: utf-8 -*-
"""
Authors: Tim Hessels
UNESCO-IHE 2017
Contact: t.hessels@unesco-ihe.org
Repository: https://github.com/wateraccounting/wa
Module: Collect/JRC
Description:
This module downloads JRC water occurrence data from http://storage.googleapis.com/global-surface-water/downloads/.
Use the JRC... | wateraccounting/wa | Collect/JRC/__init__.py | Python | apache-2.0 | 647 |
def handle(controller_slice):
from core.models import ControllerSlice, Slice
try:
my_status_code = int(controller_slice.backend_status[0])
try:
his_status_code = int(controller_slice.slice.backend_status[0])
except:
his_status_code = 0
if (my_status_... | wathsalav/xos | xos/model_policies/model_policy_ControllerSlice.py | Python | apache-2.0 | 573 |
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | ozamiatin/oslo.messaging | oslo_messaging/tests/notify/test_notifier.py | Python | apache-2.0 | 20,524 |
from __future__ import absolute_import
import json
from changes.config import db
from changes.constants import Result
from changes.models.jobplan import JobPlan
from changes.utils.http import build_web_uri
from .base import ArtifactHandler, ArtifactParseError
class CollectionArtifactHandler(ArtifactHandler):
""... | dropbox/changes | changes/artifacts/collection_artifact.py | Python | apache-2.0 | 1,917 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated Fri Dec 2 15:05:18 2011 by generateDS.py version 2.7b.
#
import sys
import getopt
import re as re_
etree_ = None
Verbose_import_ = False
( XMLParser_import_none, XMLParser_import_lxml,
XMLParser_import_elementtree
) = range(3)
XMLParser_import_li... | Dhandapani/gluster-ovirt | backend/manager/tools/engine-image-uploader/src/ovf/ovfenvelope.py | Python | apache-2.0 | 398,478 |
from citrination_client.search.pif.query.chemical.chemical_field_operation import ChemicalFieldOperation
from citrination_client.search.pif.query.core.base_object_query import BaseObjectQuery
from citrination_client.search.pif.query.core.field_operation import FieldOperation
class CompositionQuery(BaseObjectQuery):
... | calfonso/python-citrination-client | citrination_client/search/pif/query/chemical/composition_query.py | Python | apache-2.0 | 4,113 |
#
# Copyright 2014 Telefonica Investigacion y Desarrollo, S.A.U
#
# 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 unde... | telefonicaid/fiware-keystone-spassword | keystone_spassword/tests/unit/contrib/spassword/test_checker.py | Python | apache-2.0 | 1,246 |
#
# 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... | wooga/airflow | tests/providers/google/cloud/operators/test_dataflow.py | Python | apache-2.0 | 11,898 |
import wasp
def onConflict():
"""
Optional.
A conflict happened during the solving
"""
pass
def onDeletion():
"""
Optional.
The method for deleting clauses is invoked.
"""
pass
def onLearningClause(lbd, size, *lits):
"""
Optional.
When a clause is learnt.
:para... | alviano/wasp | python_libraries/heuristics/heuristic-instructions.py | Python | apache-2.0 | 2,804 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | google-research/language | language/compgen/nqg/tasks/compare_predictions.py | Python | apache-2.0 | 1,653 |
# -*- 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-kms | google/cloud/kms_v1/services/key_management_service/transports/grpc.py | Python | apache-2.0 | 50,118 |
#!/usr/bin/python
######################################################################
#
# File: kafka_to_mysql.py
#
# Copyright 2015 TiVo Inc. All Rights Reserved.
#
######################################################################
"""
Usage: kafka_to_mysql.py <kafka_topic> <kafka_broker> <mysql-ip> <mysql-port... | TiVo/wombat | correctness/kafka_to_mysql.py | Python | apache-2.0 | 5,895 |
from __future__ import division
import datetime as dt
missing = object()
try:
import numpy as np
except ImportError:
np = None
def int_to_rgb(number):
"""Given an integer, return the rgb"""
number = int(number)
r = number % 256
g = (number // 256) % 256
b = (number // (256 * 256)) % 25... | Juanlu001/xlwings | xlwings/utils.py | Python | apache-2.0 | 2,171 |
#!/usr/bin/python
# Copyright 2015 Comcast Cable Communications Management, 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 ... | Comcast/rulio | examples/stockfs.py | Python | apache-2.0 | 4,418 |
import os
from torch.utils.ffi import create_extension
sources = ["src/lib_cffi.cpp"]
headers = ["src/lib_cffi.h"]
extra_objects = ["src/bn.o"]
with_cuda = True
this_file = os.path.dirname(os.path.realpath(__file__))
extra_objects = [os.path.join(this_file, fname) for fname in extra_objects]
ffi = create_extension(... | Diyago/Machine-Learning-scripts | DEEP LEARNING/segmentation/Kaggle TGS Salt Identification Challenge/v2/modules/build.py | Python | apache-2.0 | 544 |
# Copyright 2015 Palo Alto Networks, 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... | PaloAltoNetworks/minemeld-core | minemeld/ft/dag.py | Python | apache-2.0 | 20,185 |
from django.contrib.staticfiles import storage
# Configure the permissions used by ./manage.py collectstatic
# See https://docs.djangoproject.com/en/1.10/ref/contrib/staticfiles/
class TTStaticFilesStorage(storage.StaticFilesStorage):
def __init__(self, *args, **kwargs):
kwargs['file_permissions_mode'] = 0... | Goodly/TextThresher | thresher_backend/storage.py | Python | apache-2.0 | 446 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-12 16:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tocayoapp', '0007_gender_description'),
]
operations = [
migrations.AlterField... | philpot/tocayo | tocayoproj/tocayoapp/migrations/0008_auto_20151212_1607.py | Python | apache-2.0 | 455 |
import logging
import os
import os.path
import shutil
import subprocess
import tempfile
import time
from six.moves import urllib
import uuid
from six.moves.urllib.parse import urlparse # pylint: disable=E0611,F0401
from test.service import ExternalService, SpawnedService
from test.testutil import get_open_port
log =... | gamechanger/kafka-python | test/fixtures.py | Python | apache-2.0 | 9,197 |
# Copyright (c) 2012 NetApp, Inc. All rights reserved.
# Copyright (c) 2014 Ben Swartzlander. All rights reserved.
# Copyright (c) 2014 Navneet Singh. All rights reserved.
# Copyright (c) 2014 Clinton Knight. All rights reserved.
# Copyright (c) 2014 Alex Meade. All rights reserved.
# Copyright (c) 2014 Andrew Ker... | julianwang/cinder | cinder/volume/drivers/netapp/dataontap/block_base.py | Python | apache-2.0 | 37,442 |
# Copyright 2013-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | chase-qi/workload-automation | wlauto/instrumentation/misc/__init__.py | Python | apache-2.0 | 17,103 |
# Copyright 2021 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/experimental/linalg/no_pivot_ldl_test.py | Python | apache-2.0 | 4,358 |
# Copyright 2014 Open Source Robotics Foundation, 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... | xqms/catkin_tools | catkin_tools/verbs/catkin_build/cli.py | Python | apache-2.0 | 9,623 |
# 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... | vmturbo/nova | nova/tests/functional/db/test_instance_mapping.py | Python | apache-2.0 | 7,062 |
# -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License"... | crate/crate-python | src/crate/client/sqlalchemy/tests/create_table_test.py | Python | apache-2.0 | 6,206 |
import numpy as np
import matplotlib.pyplot as plt #Used for graphing audio tests
import pyaudio as pa
import wave
from time import sleep
#Constants used for sampling audio
CHUNK = 1024
FORMAT = pa.paInt16
CHANNELS = 1
RATE = 44100 # Must match rate at which mic actually samples sound
RECORD_TIMEFRAME = 1.0 #Time in s... | cornell-cup/cs-minibot-platform | python-interface/src/MiniBotFramework/Sound/live_audio_sample.py | Python | apache-2.0 | 3,940 |
# Copyright 2014-2018 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
#
# Unless required by appl... | gkc1000/pyscf | pyscf/nao/m_ao_eval_libnao.py | Python | apache-2.0 | 3,652 |
# Azure will execute first file.
# sys.path.append is required by Azure Web Jobs. It requires that all packages are provided to it in zip file.
# env\Lib\site-packages is virtual env path in Windows
import sys
sys.path.append("env\Lib\site-packages")
import logging
import logging.config
from datetime import datetime
... | ttu/cubesensors-iot-azure | src/python_checker/checker.py | Python | apache-2.0 | 1,550 |
#
# 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
# ... | redixin/rally-ci | tests/integrated/test_services_status.py | Python | apache-2.0 | 1,144 |
# Copyright (c) 2016 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/crypto/api.py | Python | apache-2.0 | 2,580 |
# -*- encoding: utf-8 -*-
from django.db import models
import reversion
from base.model_utils import TimeStampedModel
from base.singleton import SingletonModel
from block.models import (
Page,
PageSection,
Section,
)
| pkimber/cms | cms/models.py | Python | apache-2.0 | 233 |
#!/usr/bin/env python
#!-*- coding:utf-8 -*-
def read(filename):
dic=[]
with open(filename,'r') as fp:
while True:
lines = fp.readlines(10000)
if not lines :
break
for line in lines:
#line = line.strip('\n')
dic.append(... | momomoxiaoxi/security | Scripts/Check.py | Python | apache-2.0 | 574 |
# Copyright 2013 OpenStack Foundation
# Copyright 2013 Rackspace Hosting
# Copyright 2013 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 co... | changsimon/trove | trove/tests/api/mgmt/malformed_json.py | Python | apache-2.0 | 12,085 |
#
# 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/conary | conary_test/recipes.py | Python | apache-2.0 | 40,164 |
# Copyright 2020 Tensorforce Team. 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 la... | reinforceio/tensorforce | tensorforce/core/optimizers/linesearch_step.py | Python | apache-2.0 | 4,502 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-09-06 09:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hackerspace', '0009_verbal_subcategory'),
]
operations = [
migrations.Remove... | SJIT-Hackerspace/SJIT-CodingPortal | hackerspace/migrations/0010_auto_20160906_1442.py | Python | apache-2.0 | 2,386 |
from .base import Base
from .helper import select_item_by_user
from .actions import Actions
from .browser import Browser
__all__ = ['select_item_by_user', 'Base', 'Actions', 'Browser']
| yegorshr/CDNetworksAPI | cdnetworks/__init__.py | Python | apache-2.0 | 186 |
# Copyright 2013-2015 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | Sticklyman1936/workload-automation | wlauto/instrumentation/fps/__init__.py | Python | apache-2.0 | 21,087 |
_base_ = './cascade_mask_rcnn_r50_fpn_mstrain_3x_coco.py'
model = dict(
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=8,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=False),
... | open-mmlab/mmdetection | configs/cascade_rcnn/cascade_mask_rcnn_x101_32x8d_fpn_mstrain_3x_coco.py | Python | apache-2.0 | 1,878 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'maxim'
import os
# noinspection PyUnresolvedReferences
from models import *
from util import *
class ModelInfo(object):
def __init__(self, path, model_class, model_params, run_params):
self.path = path
self.model_class = model_class
self.mod... | maxim5/time-series-machine-learning | predict/model_io.py | Python | apache-2.0 | 1,222 |
'''
Created on Apr 30, 2012
@author: h87966
'''
from unit5.blog_datastore_memory import BlogMemoryDataStore
from unit5.blog_datastore_appengine import BlogAppengineDataStore
class BlogDataStoreFactory():
'''
classdocs
'''
storage_implementations = {'memory':BlogMemoryDataStore(),
... | cdoremus/udacity-python_web_development-cs253 | src/unit5/blog_datastore_factory.py | Python | apache-2.0 | 683 |
"""ACME protocol messages."""
import collections
import six
from acme import challenges
from acme import errors
from acme import fields
from acme import jose
from acme import util
OLD_ERROR_PREFIX = "urn:acme:error:"
ERROR_PREFIX = "urn:ietf:params:acme:error:"
ERROR_CODES = {
'badCSR': 'The CSR is unacceptable ... | jsha/letsencrypt | acme/acme/messages.py | Python | apache-2.0 | 14,264 |
# Copyright 2015, A10 Networks
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | a10networks/a10-horizon | a10_horizon/dashboard/a10networks/a10appliances/urls.py | Python | apache-2.0 | 1,056 |
import os
import random
import time
import json
from locust import HttpLocust, TaskSet, task
from lib.baseTaskSet import baseTaskSet
# TODO - make these config-driven
from lib.openstack.keystone import get_auth_token
from lib.openstack.nova import list_servers
from lib.openstack.nova import list_servers_detail
from ... | pcrews/rannsaka | test_files/server_exp2.py | Python | apache-2.0 | 3,914 |
"""Base class for IKEA TRADFRI."""
from __future__ import annotations
from collections.abc import Callable
from functools import wraps
import logging
from typing import Any
from pytradfri.command import Command
from pytradfri.device import Device
from pytradfri.device.air_purifier import AirPurifier
from pytradfri.de... | aronsky/home-assistant | homeassistant/components/tradfri/base_class.py | Python | apache-2.0 | 4,045 |
import urllib
import twython
def Crowd_twitter(query):
consumer_key = '*****';
consumer_secret = '*****';
access_token = '******';
access_token_secret = '******';
client_args = {'proxies': {'https': 'http://10.93.0.37:3333'}}
t = twython.Twython(app_key=consumer_key,
app_secret=c... | SuFizz/Dealer-Loves-Code | starter_first.py | Python | apache-2.0 | 14,255 |
"""
Copyright 2013 Shine Wang
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
distrib... | shinexwang/Classy | Main/webParser.py | Python | apache-2.0 | 10,545 |
# Copyright 2012 the V8 project authors. 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 conditi... | nextsmsversion/macchina.io | platform/JS/V8/v8-3.28.4/PRESUBMIT.py | Python | apache-2.0 | 7,096 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | google-research/language | language/xsp/data_preprocessing/convert_to_tfrecords.py | Python | apache-2.0 | 17,885 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | core/polyaxon/proxies/schemas/streams/base.py | Python | apache-2.0 | 1,940 |
# Copyright (c) 2012 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... | igor-toga/local-snat | neutron/api/v2/base.py | Python | apache-2.0 | 33,385 |
import logging
import os
import json
import shutil
import sys
import datetime
import csv, math
from tld import get_tld
from collections import OrderedDict
from utils import Util
from components.data.data import Data
from components.iana.iana_transform import IanaTransform
from components.nc.network_context import Net... | kpeiruza/incubator-spot | spot-oa/oa/dns/dns_oa.py | Python | apache-2.0 | 17,663 |
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DATABASE... | edfungus/Music-Server | app/db_create.py | Python | apache-2.0 | 466 |
# -*- 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-pubsublite | samples/generated_samples/pubsublite_v1_generated_topic_stats_service_compute_time_cursor_async.py | Python | apache-2.0 | 1,540 |
import unittest
from biothings_explorer.registry import Registry
from biothings_explorer.user_query_dispatcher import SingleEdgeQueryDispatcher
from .utils import get_apis
reg = Registry()
class TestSingleHopQuery(unittest.TestCase):
def test_disease2protein(self):
"""Test gene-protein"""
seqd = ... | biothings/biothings_explorer | tests/test_apis/test_corddisease.py | Python | apache-2.0 | 4,836 |
# coding=utf-8
#
# Copyright 2016 F5 Networks 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 a... | F5Networks/f5-common-python | f5/iworkflow/shared/resolver/device_groups/cm_cloud_managed_devices.py | Python | apache-2.0 | 2,330 |
#!/usr/bin/env python
'''
Use Netmiko to execute 'show arp' on pynet-rtr1, pynet-rtr2, and juniper-srx.
'''
from netmiko import ConnectHandler
from getpass import getpass
from routers import pynet_rtr1, pynet_rtr2, pynet_jnpr_srx1
def main():
'''
Use Netmiko to execute 'show arp' on pynet-rtr1, pynet-rtr2, an... | adleff/python_ansible | class4/ex6.py | Python | apache-2.0 | 1,008 |
# Copyright 2012 majgis Contributors
#
# Individuals comprising majgis Contributors are identified in
# the NOTICE file found in the root directory of this project.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Y... | majgis/majgis | experiments/iterateArcMapDocsByFolder.py | Python | apache-2.0 | 2,315 |
# -*- coding: utf-8 -*-
"""
gspread
~~~~~~~
Google Spreadsheets client library.
"""
__version__ = '0.2.1'
__author__ = 'Anton Burnashev'
from .client import Client, login
from .models import Spreadsheet, Worksheet, Cell
from .exceptions import (GSpreadException, AuthenticationError,
Spread... | CPedrini/TateTRES | gspread/__init__.py | Python | apache-2.0 | 475 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2010 Anso Labs, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... | sorenh/cc | nova/__init__.py | Python | apache-2.0 | 1,336 |
# -*- coding: utf-8 -*-
import pytest
# ``py.test --runslow`` causes the entire testsuite to be run, including test
# that are decorated with ``@@slow`` (scaffolding tests).
# see http://pytest.org/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option # Noqa
## def pytest_addoption... | bird-house/pyramid-phoenix | phoenix/tests/conftest.py | Python | apache-2.0 | 542 |
from steps.bdd_test_util import cli_call
def after_scenario(context, scenario):
if 'doNotDecompose' in scenario.tags:
print("Not going to decompose after scenario {0}, with yaml '{1}'".format(scenario.name, context.compose_yaml))
else:
if 'compose_yaml' in context:
print("Decomposing with yaml '{0}' after sc... | ghaskins/obc-peer | openchain/peer/bddtests/environment.py | Python | apache-2.0 | 1,357 |
# -*- coding: utf-8 -*-
#
# Copyright(c) 2010 poweredsites.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... | felinx/poweredsites | poweredsites/libs/decorators.py | Python | apache-2.0 | 3,016 |
# -*- coding: utf-8 -*-
"""
Problem Statement
Samantha and Sam are playing a game. They have 'N' balls in front of them, each ball numbered from 0 to 9, except the
first ball which is numbered from 1 to 9. Samantha calculates all the sub-strings of the number thus formed, one by one.
If the sub-string is S, Sam has to... | algorhythms/HackerRankAlgorithms | Sam and sub-strings.py | Python | apache-2.0 | 1,919 |
from functools import update_wrapper
from django.http import Http404, HttpResponseRedirect
from django.contrib.admin import ModelAdmin, actions
from django.contrib.admin.forms import AdminAuthenticationForm
from django.contrib.auth import logout as auth_logout, REDIRECT_FIELD_NAME
from django.contrib.contenttypes impor... | edisonlz/fruit | web_project/base/site-packages/django/contrib/admin/sites.py | Python | apache-2.0 | 18,705 |
# Copyright 2016 Rackspace Australia
# 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... | rahulunair/nova | nova/tests/functional/test_metadata.py | Python | apache-2.0 | 7,360 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | MobinRanjbar/hue | apps/oozie/src/oozie/views/dashboard.py | Python | apache-2.0 | 44,447 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-07 22:51
from __future__ import unicode_literals
import c3nav.mapdata.fields
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateMod... | c3nav/c3nav | src/c3nav/site/migrations/0001_announcement.py | Python | apache-2.0 | 1,128 |
# -*- 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/v9/services/services/account_budget_proposal_service/client.py | Python | apache-2.0 | 26,197 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2015 clowwindy
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | plus1s/shadowsocks-py-mu | shadowsocks/asyncdns.py | Python | apache-2.0 | 17,651 |
if __name__ == '__main__':
x = int(input())
y = int(input())
z = int(input())
n = int(input())
L = [[a,b,c] for a in range(x+1) for b in range(y+1) for c in range(z+1)]
L = list(filter(lambda x : sum(x) != n, L))
print(L)
| kakaba2009/MachineLearning | python/src/algorithm/coding/basic/comprehension.py | Python | apache-2.0 | 240 |
from django import forms
from captcha.fields import CaptchaField
class CaptchaTestForm(forms.Form):
myfield = AnyOtherField()
captcha = CaptchaField()
def some_view(request):
if request.POST:
form = CaptchaTestForm(request.POST)
# Validate the form: the captcha field will automatically
... | Andrew0701/coursework-web | progress/home/captcha.py | Python | apache-2.0 | 497 |
# Load pickled data
import pickle
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
import numpy as np
import tensorflow as tf
from tensorflow.contrib.layers import flatten
from sklearn.utils import shuffle
class Data:
def __init__(self):
training_file = 'data/train.p'
... | ssarangi/self_driving_cars | traffic_sign_classifier/classify.py | Python | apache-2.0 | 6,030 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
DOCUMENTATION = '''
---
module: softlayer_vs_ip
short_description: Retrieves instance ip addresses from Softlayer
description:
- Retrieves instance ip addresses of all adapters from Softlayer
- the result is stored in the "result" dict entry of he registered variable
... | hubward/ansible-softlayer | softlayer_vs_ip.py | Python | apache-2.0 | 1,999 |
"""Bitcoin information service that uses blockchain.info."""
from datetime import timedelta
import logging
from blockchain import exchangerates, statistics
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import ATTR_ATTRIBUTION, CONF_CURRENCY, CONF_DISPLAY... | Teagan42/home-assistant | homeassistant/components/bitcoin/sensor.py | Python | apache-2.0 | 6,395 |
#
# Copyright 2013 Quantopian, 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 wr... | mattcaldwell/zipline | zipline/protocol.py | Python | apache-2.0 | 14,487 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
COHORTE configuration file parser: converts a parsed configuration file to
beans
:author: Thomas Calmant
:license: Apache Software License 2.0
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
you may n... | ahmadshahwan/cohorte-runtime | python/cohorte/config/parser.py | Python | apache-2.0 | 14,427 |
# Copyright 2017, OpenCensus 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... | census-instrumentation/opencensus-python | opencensus/trace/attributes.py | Python | apache-2.0 | 2,383 |
#!/usr/bin/python
# 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
# ... | nathanbjenx/cairis | cairis/bin/at2om.py | Python | apache-2.0 | 5,006 |
# coding=utf-8
#
# Copyright 2016 F5 Networks 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 a... | F5Networks/f5-common-python | f5/bigip/tm/net/tunnels.py | Python | apache-2.0 | 3,153 |
#!/usr/bin/env python
'''
Extract reads which aren't mapped from a SAM or SAM.gz file.
Behavior for PE:
-Write out PE only if both do not map (if either of the pair maps, neither is retained)
Behavior for SE:
-Write out SE if they don't map
Iterate over a SAM or SAM.gz file. take everything where the 3rd and
4th ... | msettles/expHTS | expHTS/extract_unmapped_reads.py | Python | apache-2.0 | 7,685 |
from ionotomo import *
import numpy as np
import pylab as plt
def test_turbulent_realisation(plot=True):
xvec = np.linspace(-100,100,100)
zvec = np.linspace(0,1000,1000)
M = np.zeros([100,100,1000])
TCI = TriCubic(xvec,xvec,zvec,M)
print("Matern 1/2 kernel")
cov_obj = Covariance(tci=TCI)
si... | Joshuaalbert/IonoTomo | src/ionotomo/tests/test_turbulent_realisation.py | Python | apache-2.0 | 5,260 |
# Copyright (c) 2016 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 required by applicable law... | olivierlemasle/murano | murano_tempest_tests/tests/api/application_catalog/test_environments_negative.py | Python | apache-2.0 | 3,454 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | googleapis/python-compute | samples/snippets/tests/test_sample_images.py | Python | apache-2.0 | 1,097 |
from functools import wraps
from itertools import chain
from django.db.models import Prefetch, Q
from django.urls import Resolver404, resolve
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from rest_framework.authentication import SessionAuthentication
from ... | c3nav/c3nav | src/c3nav/editor/api.py | Python | apache-2.0 | 29,810 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.