code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# Copyright (c) 2016 SwiftStack, 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... | matthewoliver/swift | test/functional/s3api/test_presigned.py | Python | apache-2.0 | 9,841 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.thermal_zones_and_surfaces import GlazedDoorInterzone
log = logging.getLogger(__name__)
class TestGlazedDoorInterzone(unittest.TestCase):
def setUp(self):
self.fd, ... | rbuffat/pyidf | tests/test_glazeddoorinterzone.py | Python | apache-2.0 | 2,670 |
import pymysql.cursors
from model.group import Group
from model.contact import Contact
class DbFixture():
def __init__(self, host, name, user, password):
self.host = host
self.name = name
self.user = user
self.password = password
self.connection = pymysql.connect(host=host... | zbikowa/python_training | fixture/db.py | Python | apache-2.0 | 1,332 |
"""sdb module initialization; sets value for base decorator."""
from .models import sdb_backends
from ..core.models import base_decorator
mock_sdb = base_decorator(sdb_backends)
| spulec/moto | moto/sdb/__init__.py | Python | apache-2.0 | 179 |
# -*- coding: utf8 -*-
import base64
import hashlib
import io
import nose
import requests
import aliyunauth.utils
import aliyunauth.consts
def test_cal_b64md5():
s_data = b"foo"
l_data = b"bar" * aliyunauth.consts.MD5_CHUNK_SIZE
# normal data, None
nose.tools.eq_(aliyunauth.utils.cal_b64md5(None), ... | SkyLothar/requests-aliyun | tests/test-utils.py | Python | apache-2.0 | 2,134 |
from . import list
| mliberty1/embc | py/embc/collections/__init__.py | Python | apache-2.0 | 19 |
#
# Hubblemon - Yet another general purpose system monitor
#
# Copyright 2015 NAVER Corp.
#
# 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... | naver/hubblemon | redis_mon/redis_view.py | Python | apache-2.0 | 2,771 |
import numpy as np
import pandas
import scipy, scipy.spatial
import sklearn
import sklearn.svm
import sys
import argparse
import pickle
sys.path.append('codes/')
from utilities_v2 import *
ymin = 157
ysplit = 160
ymax = 161
feat_threshold = 0.01
# C=10.0000 Gamma=0.0080
optimal_c = 10.00
optimal_gamma = 0.008
... | mirjalil/ml-visual-recognition | codes/classify_half5.py | Python | apache-2.0 | 4,215 |
import collections
g=open("depth_29.txt","w")
with open('depth_28.txt') as infile:
counts = collections.Counter(l.strip() for l in infile)
for line, count in counts.most_common():
g.write(str(line))
#g.write(str(count))
g.write("\n") | join2saurav/Lexical-syntax-semantic-analysis-of-Hindi-text- | test10.py | Python | apache-2.0 | 256 |
# coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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
#... | ljjt/azure-sdk-for-python | tests/test_tableservice.py | Python | apache-2.0 | 44,444 |
# Copyright 2017 The Imaging Source Europe GmbH
#
# 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 ... | TheImagingSource/tiscamera | tools/tcam-capture/tcam_capture/TcamView.py | Python | apache-2.0 | 21,385 |
# Copyright 2014 Diamond Light Source Ltd.
#
# 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 t... | swtp1v07/Savu | savu/data/structures.py | Python | apache-2.0 | 17,375 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from abc i... | dturner-tw/pants | src/python/pants/fs/archive.py | Python | apache-2.0 | 5,886 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-08 15:45
from __future__ import unicode_literals
from django.db import migrations
import share.robot
class Migration(migrations.Migration):
dependencies = [
('share', '0001_initial'),
('djcelery', '0001_initial'),
]
operatio... | zamattiac/SHARE | providers/org/biorxiv/migrations/0001_initial.py | Python | apache-2.0 | 658 |
# Copyright 2014 IBM Corp.
#
# 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... | rajalokan/keystone | keystone/tests/unit/test_cli.py | Python | apache-2.0 | 57,490 |
#!/usr/bin/env python3
# Copyright 2017 The Kubernetes 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 appl... | krzyzacy/test-infra | triage/summarize.py | Python | apache-2.0 | 21,103 |
"""Cascade on Delete
Revision ID: 5ca019edf61f
Revises: 469f428604aa
Create Date: 2019-06-23 05:49:26.061932
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "5ca019edf61f"
down_revision = "469f428604aa"
branch_labels = None
depends_on = None
def upgrade():
... | moloch--/RootTheBox | alembic/versions/5ca019edf61f_cascade_on_delete.py | Python | apache-2.0 | 12,722 |
# Copyright (c) 2017 CorpNewt
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
import discord
def name(member : discord.Member):
# A helper function to return the member's display name
nick = name = None
try:
nick = member.nick
except AttributeError:
... | StarbotDiscord/Starbot | libs/displayname.py | Python | apache-2.0 | 6,488 |
# Copyright (c) <2016> <GUANGHAN NING>. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable l... | Guanghan/ROLO | ROLO_evaluation.py | Python | apache-2.0 | 54,621 |
"""
Utilities for all views
Ben Adida (12-30-2008)
"""
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import loader
import helios_auth
from helios_auth.security import get_user
##
## BASICS
##
SUCCESS = HttpResponse("SUCCES... | shirlei/helios-server | helios_auth/view_utils.py | Python | apache-2.0 | 1,428 |
import argparse
import mlflow
from ax.service.ax_client import AxClient
from iris import IrisClassification
from iris_data_module import IrisDataModule
import pytorch_lightning as pl
def train_evaluate(params, max_epochs=100):
model = IrisClassification(**params)
dm = IrisDataModule()
dm.setup(stage="fit"... | mlflow/mlflow | examples/pytorch/AxHyperOptimizationPTL/ax_hpo_iris.py | Python | apache-2.0 | 2,854 |
"""
This code was generated by Codezu.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
"""
from mozurestsdk.mozuclient import default as default_client
from mozurestsdk.mozuurl import MozuUrl;
from mozurestsdk.urllocation import UrlLocation
from mozure... | Mozu/mozu-python-sdk | mozurestsdk/commerce/catalog/storefront/shipping.py | Python | apache-2.0 | 1,607 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-04-08 23:26
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0006_author_has_github_task'),
('app', '0006_auto_20170405_1957'),
]
operati... | TeamAADGT/CMPUT404-project-socialdistribution | social/app/migrations/0007_merge_20170408_2326.py | Python | apache-2.0 | 334 |
import unittest
import broccoli.parser
class BroccoliTest(unittest.TestCase):
def test_job_creation(self):
config = broccoli.parser.parse('input.json')
job = broccoli.job.Job(config)
self.assertEqual(job.name, 'Job1')
self.assertEqual(job.description, 'Job1 Description')
... | mcmartins/broccoli | broccoli/test/parse/test.py | Python | apache-2.0 | 711 |
# coding=utf8
from cStringIO import StringIO
import time
import random
from twisted.internet import reactor, task
from twisted.internet.defer import (
inlineCallbacks,
returnValue,
Deferred,
succeed,
)
from twisted.internet.endpoints import TCP4ClientEndpoint
from twisted.internet.protocol import Prot... | seraphlnWu/creditor | observer/utils/http.py | Python | apache-2.0 | 7,090 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Nicira 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/lice... | wallnerryan/quantum_migrate | quantumclient/quantum/v2_0/nvp_qos_queue.py | Python | apache-2.0 | 2,899 |
import os
import re
import shutil
import zipfile
import requests
import json
from shutil import copy2
from urllib.request import urlretrieve, urlopen
# Input parameters
version_param = os.environ.get('RELEASE_VERSION')
is_latest_param = True if version_param == "master" else False
# build constants
m2repo_path = '/m2... | gravitee-io/jenkins-scripts | src/main/python/package_bundles.py | Python | apache-2.0 | 19,869 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2010-2012 Asidev s.r.l.
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... | asidev/aybu-manager | tests/test_activity_log.py | Python | apache-2.0 | 7,363 |
"""Validate requirements."""
from __future__ import annotations
from collections import deque
import json
import operator
import os
import re
import subprocess
import sys
from awesomeversion import AwesomeVersion, AwesomeVersionStrategy
from stdlib_list import stdlib_list
from tqdm import tqdm
from homeassistant.con... | aronsky/home-assistant | script/hassfest/requirements.py | Python | apache-2.0 | 8,128 |
"""
Django settings for cui project.
Generated by 'django-admin startproject' using Django 1.10.2.
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
# ... | ignacionf/cui | cui/settings.py | Python | apache-2.0 | 3,265 |
from sevenbridges.meta.resource import Resource
from sevenbridges.meta.fields import StringField
class Breakdown(Resource):
"""
Breakdown resource contains price breakdown by storage and computation.
"""
storage = StringField(read_only=True)
computation = StringField(read_only=True)
data_trans... | sbg/sevenbridges-python | sevenbridges/models/compound/price_breakdown.py | Python | apache-2.0 | 733 |
from nltk.tree import Tree
from np_shallow_neural_classifier import ShallowNeuralClassifier
from np_rnn_classifier import RNNClassifier
from np_autoencoder import Autoencoder
from np_tree_nn import TreeNN
import numpy as np
import pytest
import utils
__author__ = "Christopher Potts"
__version__ = "CS224u, Stanford, Sp... | cgpotts/cs224u | test/test_np_model_gradients.py | Python | apache-2.0 | 7,151 |
# 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... | DavidNorman/tensorflow | tensorflow/python/keras/mixed_precision/experimental/policy.py | Python | apache-2.0 | 24,791 |
# 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, ... | google-research/falken | service/learner/brains/observation_preprocessor_test.py | Python | apache-2.0 | 9,414 |
"""An implementation of Matching Layer."""
import typing
import tensorflow as tf
from keras.engine import Layer
class MatchingLayer(Layer):
"""
Layer that computes a matching matrix between samples in two tensors.
:param normalize: Whether to L2-normalize samples along the
dot product axis befor... | faneshion/MatchZoo | matchzoo/layers/matching_layer.py | Python | apache-2.0 | 5,753 |
#!/usr/bin/env python
# Copyright (C) 2012 Zulip, Inc.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, m... | samatdav/zulip | bots/zephyr_mirror_backend.py | Python | apache-2.0 | 48,314 |
"""Offer time listening automation rules."""
from datetime import datetime
import logging
import voluptuous as vol
from homeassistant.const import CONF_AT, CONF_PLATFORM
from homeassistant.core import callback
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.event import (
asyn... | titilambert/home-assistant | homeassistant/components/homeassistant/triggers/time.py | Python | apache-2.0 | 4,049 |
#
# 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 ... | hbeatty/incubator-trafficcontrol | traffic_control/clients/python/to_access/__init__.py | Python | apache-2.0 | 16,838 |
# -*- 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_v3_generated_agents_export_agent_async.py | Python | apache-2.0 | 1,539 |
"""
Django settings for findtorun project.
Generated by 'django-admin startproject' using Django 1.11.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import ... | maheshp212/find-to-run | findtorun/findtorun/settings.py | Python | apache-2.0 | 3,920 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
Created on Jan 17, 2017
@author: hegxiten
'''
import sys
import geo.haversine as haversine
from imposm.parser import OSMParser
import geo.haversine as haversine
import numpy
import time
from scipy import spatial
import csv
import codecs
import math
default_encoding='u... | hegxiten/Worldwide-Railway-Network | WorldRailNetwork_WRN_workspace/src/network_process.py | Python | apache-2.0 | 7,862 |
# 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 wri... | google/tangent | tangent/tangents.py | Python | apache-2.0 | 6,571 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2017 Fedele Mantuano (https://www.linkedin.com/in/fmantuano/)
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/... | SpamScope/spamscope | tests/test_phishing.py | Python | apache-2.0 | 4,631 |
import logging
from typing import Union, cast
import great_expectations.exceptions as ge_exceptions
from great_expectations.data_context.store import (
CheckpointStore,
ConfigurationStore,
StoreBackend,
)
from great_expectations.data_context.types.base import BaseYamlConfig, CheckpointConfig
from great_exp... | great-expectations/great_expectations | great_expectations/data_context/store/util.py | Python | apache-2.0 | 5,702 |
import abc
import random
import fudge
from contextlib import contextmanager
from ..support.models import *
class BackendTestCaseMixin(object):
__metaclass__ = abc.ABCMeta
@abc.abstractproperty # pragma: no cover
def backend_class(self):
"""backend_class = TestThisBackend"""
def __init__(se... | armstrong/armstrong.core.arm_layout | tests/backends/_common.py | Python | apache-2.0 | 4,747 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | thauser/pnc-cli | pnc_cli/swagger_client/models/license.py | Python | apache-2.0 | 5,572 |
"""Dev server used for running a chalice app locally.
This is intended only for local development purposes.
"""
from __future__ import print_function
import re
import threading
import time
import uuid
import base64
import functools
import warnings
from collections import namedtuple
import json
from six.moves.BaseHTT... | awslabs/chalice | chalice/local.py | Python | apache-2.0 | 29,826 |
# ==========================================================================
#
# Copyright NumFOCUS
#
# 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/... | vfonov/ITK | Wrapping/Generators/Python/Tests/getNameOfClass.py | Python | apache-2.0 | 3,326 |
import pytest
import time
import ray
from ray import serve
def test_redeploy_start_time(serve_instance):
"""Check that redeploying a deployment doesn't reset its start time."""
controller = serve.api._global_client._controller
@serve.deployment
def test(_):
return "1"
test.deploy()
... | ray-project/ray | python/ray/serve/tests/test_controller.py | Python | apache-2.0 | 842 |
#!/usr/bin/env python
#
# Update a redis server cache when an evenement is trigger
# in MySQL replication log
#
from pymysqlreplication import BinLogStreamReader
from pymysqlreplication.row_event import *
mysql_settings = {'host': '127.0.0.1', 'port': 3306, 'user': 'root', 'passwd': ''}
import json
import cherrypy
c... | scharron/elasticsearch-river-mysql | http_stream/http_stream.py | Python | apache-2.0 | 1,681 |
# (c) Copyright 2014 Cisco Systems Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | hguemar/cinder | cinder/zonemanager/drivers/cisco/cisco_fc_zone_driver.py | Python | apache-2.0 | 23,043 |
#from flask.templating import render_template
# Also installed redis
from app import app
from flask import Flask, request, url_for, Response, redirect
from extended_client import extended_client
import json
from jinja2 import Environment, PackageLoader
import logging
from time import sleep
#To access JMX Rest api
impo... | johankaito/fufuka | microblog/app/views.py | Python | apache-2.0 | 10,442 |
"""ParameterConfig wraps ParameterConfig and ParameterSpec protos."""
import collections
import copy
import enum
import math
from typing import Generator, List, Optional, Sequence, Tuple, Union
from absl import logging
import attr
from vizier.pyvizier.shared import trial
class ParameterType(enum.IntEnum):
"""Val... | google/vizier | vizier/pyvizier/shared/parameter_config.py | Python | apache-2.0 | 21,349 |
"""
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 use this ... | arenadata/ambari | ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/service_check.py | Python | apache-2.0 | 3,213 |
import datetime
import mock
from django.utils import timezone
from mock import Mock, call, PropertyMock
from django.test import TestCase
from django.contrib.sessions.models import Session
from mysite.celery import send_outcome, check_anonymous
class CeleryTasksTest(TestCase):
@mock.patch('mysite.celery.UserSess... | raccoongang/socraticqs2 | mysite/mysite/tests/celery.py | Python | apache-2.0 | 2,987 |
# Copyright 2015 EMC Corporation
# 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... | bswartz/manila | manila/share/drivers/dell_emc/plugins/isilon/isilon.py | Python | apache-2.0 | 20,977 |
# Copyright 2021 The HuggingFace 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 applicabl... | huggingface/pytorch-transformers | tests/test_modeling_flax_gpt2.py | Python | apache-2.0 | 14,464 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | citrix-openstack-build/debtcollector | debtcollector/removals.py | Python | apache-2.0 | 3,792 |
__source__ = 'https://leetcode.com/problems/minimum-window-substring/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/minimum-window-substring.py
# Time: O(n)
# Space: O(k), k is the number of different characters
# Hashtable
#
# Description: Leetcode # 76. Minimum Window Substring
#
# Given a string S and ... | JulyKikuAkita/PythonPrac | cs15211/MinimumWindowSubstring.py | Python | apache-2.0 | 7,107 |
# coding: utf-8
from __future__ import unicode_literals
from django.contrib import admin
from core.admin import SubcategoryAdmin, DetailAdmin
from .models import FinishDetail, FinishSubcategory
class FinishSubcategoryAdmin(SubcategoryAdmin):
def get_form(self, request, obj=None, **kwargs):
from . impor... | michaupl/materialsapp | finishes/admin.py | Python | apache-2.0 | 1,110 |
#!/usr/bin/python3
import cgi
import cgitb
import datetime
import json
import os
import re
import requests
import subprocess
import sys
import time
from bmdjson import check_address
print("Content-Type: text/plain\n")
print("testing keybase")
print()
print("PASS:")
signature = "BEGIN KEYBASE SALTPACK SIGNED MESSAG... | joezippy/paywall | test-keybase.py | Python | apache-2.0 | 1,556 |
# 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 | kws_streaming/models/ds_tc_resnet_test.py | Python | apache-2.0 | 3,076 |
# Copyright 2020 The Kubeflow 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... | kubeflow/pipelines | sdk/python/kfp/compiler_cli_tests/test_data/two_step_pipeline.py | Python | apache-2.0 | 2,004 |
from __future__ import absolute_import, unicode_literals
import os
import os.path
from freight.constants import PROJECT_ROOT
from freight.exceptions import CommandError
class UnknownRevision(CommandError):
pass
class Vcs(object):
ssh_connect_path = os.path.join(PROJECT_ROOT, 'bin', 'ssh-connect')
def... | jkimbo/freight | freight/vcs/base.py | Python | apache-2.0 | 1,988 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Xeralux/tensorflow | tensorflow/python/keras/_impl/keras/layers/advanced_activations.py | Python | apache-2.0 | 8,770 |
import torch
from allennlp.data.vocabulary import Vocabulary
from allennlp.models.model import Model
class FakeModelForTestingNormalizationBiasVerification(Model):
def __init__(self, use_bias=True):
super().__init__(vocab=Vocabulary())
self.conv = torch.nn.Conv2d(3, 5, kernel_size=1, bias=use_bias... | allenai/allennlp | allennlp/common/testing/confidence_check_test.py | Python | apache-2.0 | 488 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. module:: redgem
:platform: Unix, Windows
:synopsis: RedGEM Algorithm
.. moduleauthor:: pyTFA team
Model class
"""
from pytfa.redgem.network_expansion import NetworkExpansion
from pytfa.redgem.lumpgem import LumpGEM
from cobra import Reaction
from .utils im... | EPFL-LCSB/pytfa | pytfa/redgem/redgem.py | Python | apache-2.0 | 7,632 |
# 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 agreed ... | google-research/large_scale_mmdma | lsmmdma/metrics.py | Python | apache-2.0 | 10,204 |
# Copyright 2011 Nicholas Bray
#
# 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... | ncbray/pystream | sandbox/sese/bracket.py | Python | apache-2.0 | 2,128 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the Docker JSON parser."""
import unittest
from plaso.lib import definitions
from plaso.parsers import docker
from tests.parsers import test_lib
class DockerJSONUnitTest(test_lib.ParserTestCase):
"""Tests for the Docker JSON parser."""
def testParseC... | kiddinn/plaso | tests/parsers/docker.py | Python | apache-2.0 | 4,229 |
# -*- coding: utf-8 -*-
from framework.tasks import app
from framework.tasks.handlers import enqueue_task
from website import settings
from . import piwik
@app.task(bind=True, max_retries=5, default_retry_delay=60)
def _update_node(self, node_id, updated_fields=None):
# Avoid circular imports
from framewor... | AndrewSallans/osf.io | framework/analytics/tasks.py | Python | apache-2.0 | 822 |
# coding=utf-8
from ..base import BitbucketBase
class BitbucketCloudBase(BitbucketBase):
def __init__(self, url, *args, **kwargs):
"""
Init the rest api wrapper
:param url: string: The base url used for the rest api.
:param *args: list: The fixed arguments for the Atlassian... | AstroTech/atlassian-python-api | atlassian/bitbucket/cloud/base.py | Python | apache-2.0 | 3,104 |
#!/usr/bin/env python3
#
# (C) Copyright 2015 by Marek Hakala <hakala.marek@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 ... | marekhakala/temperaturehub | Thermometer_DUMMY_server/classes/file_loader.py | Python | apache-2.0 | 957 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | mbohlool/client-python | kubernetes/test/test_v1beta1_user_info.py | Python | apache-2.0 | 953 |
# 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 Bob Callaway. All rights reserved.
#
# Licensed under the Apac... | Datera/cinder | cinder/tests/unit/volume/drivers/netapp/dataontap/client/test_api.py | Python | apache-2.0 | 23,756 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/fixmatch | imagenet/augment/rand_augment.py | Python | apache-2.0 | 5,934 |
# -*- coding: utf-8 -*-
from django.shortcuts import render, redirect
from django.views.generic import View
from django.http import HttpResponse
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import inch
from... | CallmeTorre/Idalia | ESCOM/ConsultarDocumento/views.py | Python | apache-2.0 | 2,955 |
#!/usr/bin/python
#
# 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 ag... | google/layered-scene-inference | lsi/loss/loss.py | Python | apache-2.0 | 4,153 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 03 09:37:33 2018
@author: tih
"""
import os
import sys
from DataAccess import DownloadData
def main(Dir, Startdate='', Enddate='', latlim=[-60, 70], lonlim=[-180, 180], Waitbar = 1):
"""
This function downloads monthly ETmonitor data
Keyword arguments:
... | wateraccounting/wa | Collect/ETmonitor/Ew_monthly.py | Python | apache-2.0 | 803 |
# Copyright 2013 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 required by applicab... | alanquillin/quark | quark/tests/plugin_modules/test_floating_ips.py | Python | apache-2.0 | 30,810 |
# Copyright (c) 2015 Scality SA
#
# 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... | scality/scality-manila-utils | setup.py | Python | apache-2.0 | 663 |
class Solution(object):
def strStr(self, haystack, needle):
"""
:type haystack: str
:type needle: str
:rtype: int
"""
for i in range(len(haystack)-len(needle) + 1):
if haystack[i: i + len(needle)] == needle:
return i
return -1
| scream7/leetcode | algorithms/python/28.py | Python | apache-2.0 | 315 |
# Copyright (c) 2013-2014 Rackspace, 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 ... | jmvrbanac/barbican | barbican/common/resources.py | Python | apache-2.0 | 1,430 |
from __future__ import annotations
import logging
from collections import OrderedDict
import scipy.sparse
import numpy as np
from typing import (
Any,
Dict,
Text,
List,
Tuple,
Callable,
Set,
Optional,
Type,
Union,
)
from rasa.engine.graph import ExecutionContext, GraphComponent... | RasaHQ/rasa_nlu | rasa/nlu/featurizers/sparse_featurizer/lexical_syntactic_featurizer.py | Python | apache-2.0 | 21,849 |
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run(host='0.0.0.0', port=5000, debug=True, threaded=True)
| ipedrazas/dotmarks-api | src/app.py | Python | apache-2.0 | 197 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Openstack, LLC.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... | nii-cloud/dodai-compute | nova/scheduler/driver.py | Python | apache-2.0 | 14,688 |
from django.test import TestCase
from restclients.mock_http import MockHTTP
from myuw.util.cache_implementation import MyUWCache
from restclients.models import CacheEntryTimed
from datetime import timedelta
CACHE = 'myuw.util.cache_implementation.MyUWCache'
class TestCustomCachePolicy(TestCase):
def test_sws_de... | fanglinfang/myuw | myuw/test/cache.py | Python | apache-2.0 | 5,375 |
# Copyright 2017 Capital One Services, 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... | sixfeetup/cloud-custodian | tools/c7n_logexporter/c7n_logexporter/exporter.py | Python | apache-2.0 | 26,318 |
from string import digits, ascii_letters
valid_values = list(digits + ascii_letters) # приводим строку к списку
radix = len(valid_values) #основание
def convert(number):
result =[] #будем сюда складывать остатки от деления
while number:
result.insert(0,valid_values[number % radix])
number //=... | ksigorodetskaya/Python_Ifmo | Part1/url-shorter/url_shorter/converter.py | Python | apache-2.0 | 675 |
"""
Created on Sep 14, 2015
@author: Mikhail
"""
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.expected_conditions import visibility_of_element_located, visibility_of
from selenium.common.exceptions import TimeoutException
__author__ = 'Mikhail'
class Page(object):
def... | MikeLaptev/sandbox_python | mera/selenium_training_automation/pages/page.py | Python | apache-2.0 | 913 |
import requests
from requests.auth import HTTPBasicAuth
def get_data(config):
auth = HTTPBasicAuth(config['authentication']['username'], config['authentication']['password'])
resp = requests.get(config['host'] + '/api/queues', auth=auth)
queues = resp.json()
data = {}
for queue in queues:
... | kierenbeckett/sentinel | sentinel/alert_plugins/rabbit_queues.py | Python | apache-2.0 | 1,275 |
# pylint: disable=missing-docstring
# this fails on Python 2.6 but Slurm environment is 2.7
import unittest
from datetime import datetime
from reporting.plugins.slurm import SlurmInput
class SlurmTestCase(unittest.TestCase):
"""Test cases for slurm module"""
def test_all_heros(self):
"""Slurm plugin:... | eResearchSA/reporting-producers | tests/test_plugin_slurm.py | Python | apache-2.0 | 2,011 |
#BOOTSTRAP CODE
try:
from urllib3.request import urlopen
except ImportError:
from urllib import urlopen
import random
handle = urlopen("https://raw.githubusercontent.com/Jumpscale/jumpscale_core7/master/install/InstallTools.py?%s"%random.randint(1, 10000000)) #this is to protect against caching proxy servers
ex... | Jumpscale/docker | install/bootstrap_js.py | Python | apache-2.0 | 978 |
# -*- coding: utf-8 -*-
# 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 agr... | googleapis/python-domains | docs/conf.py | Python | apache-2.0 | 12,378 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | brchiu/tensorflow | tensorflow/python/kernel_tests/scatter_ops_test.py | Python | apache-2.0 | 11,256 |
import logging
def init_logger():
formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]')
logger = logging.getLogger('redberry')
logger.setLevel(logging.DEBUG)
console = logging.StreamHandler()
console.setFormatter(formatter)
logger.addHandler(co... | michaelcho/redberry | redberry/utils/logger.py | Python | apache-2.0 | 327 |
import os, sys
import unittest
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
import logging
import csv
from slicer.util import VTKObservationMixin
import platform
import time
import urllib
import shutil
from CommonUtilities import *
from packaging import version
def _setSectionResizeMode(head... | bpaniagua/SPHARM-PDM | Modules/Scripted/ShapeAnalysisModule/ShapeAnalysisModule.py | Python | apache-2.0 | 88,012 |
"""Authentication for HTTP component."""
import base64
import logging
from aiohttp import hdrs
from aiohttp.web import middleware
import jwt
from homeassistant.auth.providers import legacy_api_password
from homeassistant.auth.util import generate_secret
from homeassistant.const import HTTP_HEADER_HA_AUTH
from homeass... | fbradyirl/home-assistant | homeassistant/components/http/auth.py | Python | apache-2.0 | 7,407 |
import android
class SMSPoolMember:
def __init__(self, query):
self.droid = android.Android()
self.query = str(query).lstrip().rstrip()
def wifiConnected(self):
none = "<unknown ssid>"
return not self.droid.wifiGetConnectionInfo().result["ssid"] == none
def dataConnected... | wallarelvo/eneza-server | smsserver/poolmember.py | Python | apache-2.0 | 584 |
import re
from django.db import models, transaction
from django.utils import timezone
from django.utils.six import iteritems, with_metaclass
from django.utils.translation import ugettext_lazy as _
from django.core.cache import cache
from django.core.exceptions import SuspiciousOperation
from django.contrib.contenttype... | erigones/esdc-ce | vms/models/base.py | Python | apache-2.0 | 22,882 |