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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from collections import OrderedDict as odict
from copy import deepcopy
from functools import partial
import sys
import bindings as bi
from custom import get_customizations_for, reformat_block
PY3 = sys.version_info[0] == 3
str_typ... | h2oai/h2o-3 | h2o-bindings/bin/gen_R.py | Python | apache-2.0 | 15,516 |
# ===============================================================================
# Copyright 2013 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/canvas/canvas2D/uv_mask_canvas.py | Python | apache-2.0 | 1,409 |
__all__ = ["AnalyzeScope"]
| MaxMorgenstern/EmeraldAI | EmeraldAI/Pipelines/ScopeAnalyzer/__init__.py | Python | apache-2.0 | 27 |
# Copyright 2017 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 agree... | shinfan/artman | artman/tasks/publish/github.py | Python | apache-2.0 | 8,365 |
# Copyright 2018 PerfKitBenchmarker 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 appli... | GoogleCloudPlatform/PerfKitBenchmarker | tests/linux_benchmarks/t2t_benchmark_test.py | Python | apache-2.0 | 8,587 |
# Copyright 2016 by Raytheon BBN Technologies Corp. All Rights Reserved.
from qgl2.qgl2 import qgl2decl, qreg, QRegister
from qgl2.qgl1 import Id, X, MEAS, X90, flat_top_gaussian_edge, echoCR, Y90m
from qgl2.basic_sequences.helpers import create_cal_seqs, measConcurrently, cal_descriptor, delay_descriptor
from qgl2... | BBN-Q/pyqgl2 | src/python/qgl2/basic_sequences/CR.py | Python | apache-2.0 | 15,939 |
from functools import wraps
from iso8601 import parse_date
from munch import munchify
from restkit import BasicAuth, errors, request, Resource
from retrying import retry
from simplejson import dumps, loads
from urlparse import parse_qs, urlparse
import logging
logger = logging.getLogger(__name__)
IGNORE_PARAMS = ('ur... | Leits/openprocurement.client.python | openprocurement_client/client.py | Python | apache-2.0 | 17,177 |
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | keras-team/keras | keras/integration_test/preprocessing_applied_in_model_test.py | Python | apache-2.0 | 3,512 |
"""HighThroughputExecutor builds on the Swift/T EMEWS architecture to use MPI for fast task distribution
"""
from concurrent.futures import Future
import logging
import threading
import queue
import pickle
from multiprocessing import Process, Queue
from ipyparallel.serialize import pack_apply_message # ,unpack_apply... | swift-lang/swift-e-lab | parsl/executors/high_throughput/executor.py | Python | apache-2.0 | 21,673 |
# -*- coding: utf-8 -*-
from model.group import Group
import random
import pytest
def test_delete_random_group(app, db, check_ui):
with pytest.allure.step('Предусловие: Проверяем, есть ли на странице групп - группы, которые можно удалить, если их нет, то создаем группу'):
if len(db.get_group_list()) == 0... | MaxDavion/Python_traning | test/test_del_group.py | Python | apache-2.0 | 1,298 |
# Copyright 2015 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 required by applicabl... | izadorozhna/tempest | tempest/cmd/init.py | Python | apache-2.0 | 6,245 |
from armstrong.apps.embeds.backends import get_backend
from .._utils import TestCase
class GetBackendTestCase(TestCase):
def test_load_no_backend_raises_error(self):
with self.assertRaises(ImportError):
get_backend('')
def test_load_missing_backend_raises_error(self):
with self.as... | armstrong/armstrong.apps.embeds | tests/backends/_init.py | Python | apache-2.0 | 377 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Cisco Systems, Inc.
# Copyright 2012 NEC Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use... | redhat-cip/horizon | openstack_dashboard/api/neutron.py | Python | apache-2.0 | 48,033 |
# -*- coding: utf-8 -*-
import wx
from wx.lib.scrolledpanel import ScrolledPanel
from classes.ui import MultiSplitterWindow
class WellPlotInternal(wx.SplitterWindow):
SASH_POSITION = 100
def __init__(self, parent):
super().__init__(parent, style=wx.SP_THIN_SASH)
self._top_panel = BaseScroll... | giruenf/GRIPy | classes/ui/wellplot_internal.py | Python | apache-2.0 | 2,105 |
# 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/examples/random_time_series.py | Python | apache-2.0 | 2,622 |
from common_fixtures import * # NOQA
logger = logging.getLogger(__name__)
def create_environment_with_linked_services(
super_client, client, service_scale, consumed_service_scale, port,
ssh_port="22", isnetworkModeHost_svc=False,
isnetworkModeHost_consumed_svc=False):
if not isnetworkMo... | aruneli/validation-tests | tests/validation/cattlevalidationtest/core/test_services_links.py | Python | apache-2.0 | 24,550 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Openstack, LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | russellb/nova | nova/vnc/__init__.py | Python | apache-2.0 | 1,887 |
# coding: utf-8
__author__ = 'Administrator'
import re
import os
from bs4 import BeautifulSoup
import urllib
import urllib2
def getHtml(url):
html = urllib.urlopen(url)
scode = html.read()
return scode
def getImage(source):
#images = re.findall(r'input src=.*?img.picuphost.com/img/upload... | wangfengfighting/Caoliu-master | DecodeHTML.py | Python | apache-2.0 | 2,125 |
"""
Prints ExifTags from an image using PIL
"""
from yapsy.IPlugin import IPlugin
try:
from PIL import Image, ExifTags
except ImportError:
Image = None
import os
from flask import render_template_string
TEMPLATE = """
<!DOCTYPE html>
<html>
<head>
<style>
table {
overflow-... | maurermj08/efetch | efetch_server/plugins/fa_exif/fa_exif.py | Python | apache-2.0 | 5,586 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Mini Fantasy War
# https://www.acmicpc.net/problem/12790
import sys
num = int(sys.stdin.readline().strip())
for cnt in range(num):
power_list = str(sys.stdin.readline().strip()).split(' ')
HP = 1 if (int(power_list[0]) + int(power_list[4])) < 1 else (int(power... | youngjun0528/moheeto | BaekjoonOnlineJudge/acmicpc_12790.py | Python | apache-2.0 | 688 |
import abc
from lab.with_log import WithLogMixIn
class TestCaseWorker(WithLogMixIn):
STATUS_CREATED = 'created'
STATUS_SETUP_RUNING = 'status=NonParallelSetupRunning'
STATUS_SETUP_FINISHED = 'status=NonParallelSetupFinished ' + 47 * '-'
STATUS_DELAYED = 'delayed'
STATUS_LOOPING = 'looping'
STA... | CiscoSystems/os-sqe | lab/test_case_worker.py | Python | apache-2.0 | 8,762 |
# Copyright 2013 Josh Durgin
# 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 a... | usc-isi/extra-specs | nova/tests/api/openstack/compute/contrib/test_volumes.py | Python | apache-2.0 | 16,379 |
#!/usr/bin/python
#-----------------------------------------------------------------------------------------------
'''-------------------------------------------------------------------------
Copyright IBM Corp. 2015, 2015 All Rights Reserved
Licensed under the Apache License, Version 2.0 (the "License");
you may not u... | Open-I-Beam/swift-storlets | Engine/SBus/SBusPythonFacade/setup.py | Python | apache-2.0 | 1,009 |
#!/usr/bin/python
"""
Setup script for Gittle.
"""
import platform
windows = platform.system() == 'Windows'
try:
from setuptools import setup
except ImportError:
has_setuptools = False
from distutils.core import setup
else:
has_setuptools = True
version_string = '0.4.0'
setup_kwargs = {
'name': ... | 0asa/gittle | setup.py | Python | apache-2.0 | 2,136 |
import asyncio
import ipaddress
import socket
from unittest.mock import Mock, patch
import pytest
from aiohttp.resolver import AsyncResolver, DefaultResolver, ThreadedResolver
try:
import aiodns
gethostbyname = hasattr(aiodns.DNSResolver, 'gethostbyname')
except ImportError:
aiodns = None
gethostbyn... | playpauseandstop/aiohttp | tests/test_resolver.py | Python | apache-2.0 | 7,611 |
# 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... | danielfrg/jupyterhub-kubernetes_spawner | kubernetes_spawner/swagger_client/models/v1_component_condition.py | Python | apache-2.0 | 5,391 |
# -*- coding: utf-8 -*-
from apps.bigcz.clients.usgswqp.models import USGSResource
from apps.bigcz.clients.usgswqp.serializers import USGSResourceSerializer
# Import catalog name and search function, so it can be exported from here
from apps.bigcz.clients.usgswqp.search import CATALOG_NAME, search # NOQA
model = USG... | WikiWatershed/model-my-watershed | src/mmw/apps/bigcz/clients/usgswqp/__init__.py | Python | apache-2.0 | 366 |
#!/usr/bin/env python
# Licensed to Pioneers in Engineering under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Pioneers in Engineering licenses
# this file to you under the Apache License, Version 2.0 (the
#... | zentner-kyle/tenshi-old | tools/docu-packet-gen.py | Python | apache-2.0 | 3,744 |
"""Test the Minecraft Server config flow."""
from asynctest import patch
from mcstatus.pinger import PingResponse
from homeassistant.components.minecraft_server.const import (
DEFAULT_NAME,
DEFAULT_PORT,
DOMAIN,
)
from homeassistant.config_entries import SOURCE_USER
from homeassistant.const import CONF_HO... | postlund/home-assistant | tests/components/minecraft_server/test_config_flow.py | Python | apache-2.0 | 7,108 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, print_function
import contextlib
import os
import platform
import random
import subprocess
import sys
from contextlib import contextmanager
from te... | jsirois/pex | pex/testing.py | Python | apache-2.0 | 18,590 |
# Copyright 2022 The Brax 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 wri... | google/brax | brax/experimental/braxlines/common/logger_utils.py | Python | apache-2.0 | 9,975 |
import re
from setuptools import setup
init_py = open('wikipediabase/__init__.py').read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", init_py))
metadata['doc'] = re.findall('"""(.+)"""', init_py)[0]
setup(
name='wikipediabase',
version=metadata['version'],
description=metadata['doc'],
autho... | fakedrake/WikipediaBase | setup.py | Python | apache-2.0 | 1,174 |
from setuptools import setup
setup(
name="code_block_timer",
version="0.0.1",
packages=[
"code_block_timer",
],
author_email='jeskew@edx.org'
)
| doctoryes/code_block_timer | setup.py | Python | apache-2.0 | 173 |
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | Brocade-OpenSource/OpenStack-DNRM | dnrm/openstack/common/notifier/api.py | Python | apache-2.0 | 5,503 |
"""
Tests for salt.loader.lazy
"""
import sys
import pytest
import salt.loader
import salt.loader.context
import salt.loader.lazy
import salt.utils.files
@pytest.fixture
def loader_dir(tmp_path):
"""
Create a simple directory with a couple modules to load and run tests
against.
"""
mod_contents =... | saltstack/salt | tests/pytests/unit/loader/test_lazy.py | Python | apache-2.0 | 3,761 |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import torch
from torch.utils.data import DataLoader, Dataset
from torchvision.transforms import Compose, functional
from pyro.contrib.examples.util import MNIST
class CVAEMNIST(Dataset):
def __init__(self, ro... | uber/pyro | examples/cvae/mnist.py | Python | apache-2.0 | 3,204 |
#
# 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
# ... | hkumarmk/oslo.messaging | oslo_messaging/tests/functional/test_functional.py | Python | apache-2.0 | 11,782 |
# Copyright 2016 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... | siddartha1992/cloud-custodian | tests/test_appelb.py | Python | apache-2.0 | 13,328 |
# -*- coding: utf-8 -*-
#
# MLDB-558-python-unicode.py
# mldb.ai inc, 2015
# Mich, 2016-02-08
# this file is part of mldb. copyright 2015 mldb.ai inc. all rights reserved.
#
from urllib.parse import quote
from mldb import mldb, MldbUnitTest
class Utf8IdsTest(MldbUnitTest): # noqa
def test_mldb_create_dataset(self... | mldbai/mldb | testing/MLDB-558-python-unicode.py | Python | apache-2.0 | 5,796 |
"""Pytentd test suite"""
from flask import current_app, g
from py.test import main
from tentd.tests.http import *
from tentd.tests.mock import *
def profile_url_for(entity, _external=False):
"""Get an entity profile url without using url_for"""
base_url = 'http://{server}' if _external else ''
profile_... | pytent/pytentd | tentd/tests/__init__.py | Python | apache-2.0 | 906 |
# 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, ... | kubeflow/kfp-tekton-backend | backend/src/apiserver/visualization/test_exporter.py | Python | apache-2.0 | 2,980 |
"""
"""
from crispy_forms.layout import Layout, Row, Column
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from fluentcms_contactform import appsettings
from fluentcms_contactform.forms.base import AbstractContactForm, ContactFormHelper, SubmitButton
from f... | edoburu/fluentcms-contactform | fluentcms_contactform/forms/compact.py | Python | apache-2.0 | 2,356 |
from __future__ import print_function
import hashlib
from calendar import timegm
from datetime import datetime
from builtins import int
import fake_gen
def now():
return timegm(datetime.utcnow().utctimetuple())
class PayloadFactory(fake_gen.DictFactory):
iat = fake_gen.Constant(now())
exp = fake_gen.... | EMBL-EBI-TSI/aap-client-python | tests/payload_gen.py | Python | apache-2.0 | 2,438 |
"""Tests for evaluating Celtic initial consonant mutations."""
import unittest
import normalize_breton_lib
class TestStringMethods(unittest.TestCase):
"""Tests for evaluating initial consonant mutations."""
def test_normalize_breton(self):
'Test the output of normalize_breton.'
with open("te... | googleinterns/text-norm-for-low-resource-languages | starter_project/normalize_breton_test.py | Python | apache-2.0 | 3,173 |
"""
.. module:: lm_lstm_crf
:synopsis: lm_lstm_crf
.. moduleauthor:: Liyuan Liu
"""
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.optim as optim
import numpy as np
import model.crf as crf
import model.utils as utils
import model.highway as highway
class LM_LSTM... | LiyuanLucasLiu/LM-LSTM-CRF | model/lm_lstm_crf.py | Python | apache-2.0 | 10,371 |
#!/usr/bin/env python
"""
Integration (not unit) tests for pylast.py
"""
import time
import unittest
import pylast
from .test_pylast import TestPyLastWithLastFm
class TestPyLastNetwork(TestPyLastWithLastFm):
def test_scrobble(self):
# Arrange
artist = "test artist"
title = "test title"
... | hugovk/pylast | tests/test_network.py | Python | apache-2.0 | 12,784 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from _pyio import __metaclass__
'''
接口定义和规范设计
抽象类加抽象方法就叫接口
'''
from abc import ABCMeta, abstractmethod #下面的定义接口是的固定设计
class Alert:
__metaclass__ = ABCMeta
@abstractmethod #指定接口的方法,在继承接口是必须定义这个方法,要不报错
def Send(self):
pass
cl... | zhangyage/Python-oldboy | day04/oop/class_study10.py | Python | apache-2.0 | 711 |
# coding=utf-8
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
from pants.backend.jvm.targets.jvm_target import JvmTarget
class JavaProtobufLibrary(Jv... | twitter/pants | src/python/pants/backend/codegen/protobuf/java/java_protobuf_library.py | Python | apache-2.0 | 395 |
"""
Integrate with namecheap DNS services.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/namecheapdns/
"""
import logging
from datetime import timedelta
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.... | PetePriority/home-assistant | homeassistant/components/namecheapdns/__init__.py | Python | apache-2.0 | 2,123 |
# Lint as: python3
# 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 a... | google/glazier | glazier/lib/timers.py | Python | apache-2.0 | 1,820 |
#!/usr/bin/env python
"""
Module defining the LINE-MOD detector to find objects in a scene
"""
from object_recognition_core.pipelines.detection import DetectorBase
import ecto_cells.ecto_linemod as ecto_linemod
###########################################################################################################... | WalkingMachine/sara_commun | wm_ork/linemod/python/object_recognition_linemod/detector.py | Python | apache-2.0 | 535 |
# Copyright 2014-2020 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... | sunqm/pyscf | pyscf/agf2/ragf2_slow.py | Python | apache-2.0 | 8,709 |
# Copyright 2016 Isotoma Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | yaybu/touchdown | touchdown/aws/waf/waf.py | Python | apache-2.0 | 7,256 |
#!/usr/bin/env python3
#
# Copyright (c) 2016 Roberto Riggio
#
# 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... | LokiNetworks/empower-runtime | empower/core/lvnf.py | Python | apache-2.0 | 9,109 |
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | j-griffith/cinder | cinder/volume/drivers/rbd.py | Python | apache-2.0 | 74,922 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... | EricssonResearch/calvin-base | calvin/actorstore/systemactors/std/DelayToken.py | Python | apache-2.0 | 1,975 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/ldif | ldif/training/eval_step.py | Python | apache-2.0 | 15,487 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-06-23 03:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('applications', '0013_location_local_government_authority'),... | ropable/statdev | applications/migrations/0014_application_supporting_info_demonstrate_compliance_trust_policies.py | Python | apache-2.0 | 706 |
# -*- coding: utf-8 -*-
# Copyright (2018) Hewlett Packard Enterprise Development LP
#
# 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... | HewlettPackard/oneview-redfish-toolkit | oneview_redfish_toolkit/blueprints/processor_collection.py | Python | apache-2.0 | 1,717 |
from typing import List
import torch
from torch import nn
class Normalize(nn.Module):
mean: torch.Tensor
std: torch.Tensor
def __init__(self, n_features: int):
super().__init__()
# initialize to NaN so the code fails hard when this layer has not been initialized
mean = torch.ful... | googleinterns/out-of-distribution | src/modules/normalize.py | Python | apache-2.0 | 1,083 |
## Copyright 2016 Kurt Cutajar, Edwin V. Bonilla, Pietro Michiardi, Maurizio Filippone
##
## 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... | mauriziofilippone/deep_gp_random_features | code/experiments/dgp_rff_mnist.py | Python | apache-2.0 | 5,142 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import zmq
import sys
import os
import signal
import threading
try:
from PyQt4 import QtGui, QtCore, uic
except ImportError:
print("you have to have PyQt4 for your version of Python (%s) installed"
% ".".join(str(x) for x in sys.version_info))
sys.ex... | frans-fuerst/music_scheduler | client/pyclient.py | Python | apache-2.0 | 5,018 |
import re,os
from collections import namedtuple
def check_comment(full_string,index):
#Check if index is in a comment line or not
is_comment = 0
for i in range(index,0):
if full_string[i] == "\n":
break
if full_string[i] == "#":
is_comment = 1;
return is_comment
def find_all(a_string, sub):
result = ... | phunghv/mesos-framework-demo | change_comment.py | Python | apache-2.0 | 6,877 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | chunfengh/seq2seq | seq2seq/contrib/seq2seq/helper.py | Python | apache-2.0 | 20,836 |
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | atheendra/access_keys | keystone/tests/test_sql_upgrade.py | Python | apache-2.0 | 54,893 |
########
# Copyright (c) 2013 GigaSpaces Technologies Ltd. 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... | geokala/cloudify-plugins-common | setup.py | Python | apache-2.0 | 1,607 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013, 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
#
#... | r-icarus/openstack_microserver | openstack_dashboard/dashboards/project/vpn/views.py | Python | apache-2.0 | 4,302 |
# coding: utf-8
from __future__ import absolute_import
import requests
import json
import flockos
def call_api(resource_path, params=None):
base_url = flockos.base_url
url = base_url + resource_path
response_data = requests.post(url, data=json.dumps(params))
return json.loads(response_data.text)
| flockchat/pyflock | flockos/api_client.py | Python | apache-2.0 | 316 |
from win32com.client import Dispatch;
from win32com.client import VARIANT as variant;
from pythoncom import *;
import sys;
import matplotlib.pyplot as plt;
fileName = sys.argv[1];
obj = Dispatch('MSFileReader.XRawFile');
obj.open(fileName);
obj.SetCurrentController(0, 1);
numSpec = obj.GetNumSpectra();
print(' ');... | PhysicalChemist/ThermoRaw | thermoRawReader.py | Python | apache-2.0 | 1,392 |
import unittest
class WheelTests(unittest.TestCase):
def _getTargetClass(self):
from pkginfo.wheel import Wheel
return Wheel
def _makeOne(self, filename=None, metadata_version=None):
if metadata_version is not None:
return self._getTargetClass()(filename, metadata_version)... | sonntagsgesicht/regtest | .aux/venv/lib/python3.9/site-packages/pkginfo/tests/test_wheel.py | Python | apache-2.0 | 3,582 |
# =========================================================================
# Copyright 2016-present Yunify, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the Licens... | yunify/qingcloud-cli | qingcloud/cli/qs_client/actions/key.py | Python | apache-2.0 | 6,790 |
import unittest
import subprocess
class TestJupyterNbconvert(unittest.TestCase):
def test_nbconvert(self):
result = subprocess.run([
'jupyter',
'nbconvert',
'--to',
'notebook',
'--template',
'/opt/kaggle/nbconvert-extensions.tpl',
... | Kaggle/docker-python | tests/test_jupyter_nbconvert.py | Python | apache-2.0 | 545 |
#!/usr/bin/python
def a(val):
return b(val)
def b(val):
return c(val)
def c(val):
return d(val)
def d(val):
return e(val)
def e(val):
return f(val)
def f(val):
return g(val, 2)
def g(v1, v2):
return h(v1, v2, 3)
def h(v1, v2, v3):
return i(v1, v2, v3, 4)
def i(v1, v2, v3, v4):
return j(v1, v2, v3, v4, 5)
d... | bitkeeper-scm/bitkeeper | src/gui/tcltk/tcl/tests/langbench/proc.py | Python | apache-2.0 | 440 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gym
import numpy as np
import time
import unittest
import ray
from ray.rllib.agents.ppo import PPOTrainer
from ray.rllib.agents.ppo.ppo_policy import PPOTFPolicy
from ray.rllib.evaluation import SampleB... | atumanov/ray | python/ray/rllib/tests/test_optimizers.py | Python | apache-2.0 | 9,360 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.core_task... | baroquebobcat/pants | tests/python/pants_test/core_tasks/test_bash_completion.py | Python | apache-2.0 | 855 |
"""Test zha device discovery."""
import re
from unittest import mock
import pytest
import homeassistant.components.zha.core.const as zha_const
import homeassistant.components.zha.core.discovery as disc
import homeassistant.components.zha.core.gateway as core_zha_gw
import homeassistant.helpers.entity_registry
from ... | postlund/home-assistant | tests/components/zha/test_discover.py | Python | apache-2.0 | 2,626 |
# Copyright 2017, Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | tartavull/google-cloud-python | core/tests/unit/future/test_operation.py | Python | apache-2.0 | 6,408 |
# 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... | airbnb/caravel | superset/tasks/celery_app.py | Python | apache-2.0 | 1,017 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unles... | probcomp/cgpm | src/uncorrelated/xcross.py | Python | apache-2.0 | 1,552 |
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.core.urlresolvers import reverse
from django.template import RequestContext, loader
from django.views.decorators.csrf import csrf_exempt
from redigit import clf
capacity = 10
pointer = 0
def index(request):
... | osgee/redigit | redigit/views.py | Python | apache-2.0 | 1,901 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/global_/config/__init__.py | Python | apache-2.0 | 21,009 |
"""
Hiss is a minimalist language built on function composition.
"""
VERSION = '1.0'
from callable_tuple import s, run
| vic/hiss | src/hiss/__init__.py | Python | apache-2.0 | 127 |
""" Copyright 2014 Luis Ruiz Ruiz
Copyright 2014 Ana Isabel Lopera Martínez
Copyright 2014 Miguel Ortega Moreno
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.o... | lruizr/pol-brick | src/excepciones_metodos_base.py | Python | apache-2.0 | 1,170 |
from catkin_tools.jobs.utils import merge_envs
def test_merge_envs_basic():
job_env = { 'PATH': '/usr/local/bin:/usr/bin', 'FOO': 'foo' }
merge_envs(job_env, [
{ 'PATH': '/usr/local/bin:/bar/baz/bin' },
{ 'BAR': 'bar' } ])
# Validate that the known path was not moved from the existing or... | rhaschke/catkin_tools | tests/unit/test_jobs.py | Python | apache-2.0 | 1,160 |
#!/usr/bin/env python
# EASY-INSTALL-SCRIPT: 'Pillow==2.7.0','pilfile.py'
__requires__ = 'Pillow==2.7.0'
__import__('pkg_resources').run_script('Pillow==2.7.0', 'pilfile.py')
| fkolacek/FIT-VUT | bp-revok/python/bin/pilfile.py | Python | apache-2.0 | 175 |
# -*- coding: utf-8 -*-
#
# Doric Stacks - Installation Guide documentation build configuration file, created by
# sphinx-quickstart on Fri Dec 4 10:26:47 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
#... | janislejins/DoricStacksInstallGuide | docs/conf.py | Python | artistic-2.0 | 10,483 |
"""
Test the Prime Finder class
Still working on getting dependency injection working.
Injecting the Generator into the Finder allows for many possibilities.
From the testing perspective this would allow me to inject a mock object
for the Generator that returns a set value speeding up the testing of the
Prime Finder c... | bigfatpanda-training/pandas-practical-python-primer | training/level-2-command-line-interfaces/dragon-warrior/tmarsha1/primes/Tests/PrimeFinderTests.py | Python | artistic-2.0 | 639 |
#!/usr/bin/env python2
"""
Generates a wholesale order form in spreadsheet form.
"""
import argparse
import datetime
import itertools
import logging
import os
import ConfigParser
import calc_price
import cctools
import notify_send_handler
import openpyxl # sudo pip install openpyxl
CHECK_FOR_LACK_OF_ANY = False #... | tschutter/cctools | gen-wholesale-order.py | Python | bsd-2-clause | 15,604 |
# Coin sums
#
# Problem 31
#
# In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
#
# 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
# It is possible to make £2 in the following way:
#
# 1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
# How many different ways... | chjdev/euler | python/problem31.py | Python | bsd-2-clause | 634 |
import datetime
import os
import sys
import unittest
from pathlib import Path, PosixPath, WindowsPath
from unittest.mock import Mock, call, patch
import freezegun
import streamlink_cli.main
import tests.resources
from streamlink.session import Streamlink
from streamlink.stream.stream import Stream
from streamlink_cli... | bastimeyer/streamlink | tests/test_cli_main.py | Python | bsd-2-clause | 29,440 |
#!/usr/bin/env python
# Copyright (C) 2014-2015 Job Snijders <job@instituut.net>
#
# This file is part of ACLHound
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the ab... | job/aclhound | tests/test_regression.py | Python | bsd-2-clause | 6,698 |
class Data(dict):
def __init__(self, xml, status=None, messages=None):
"""Process the xml instance into a friendly dictionary."""
content = {
'data': None,
'status': status or 200,
'messages': messages or []
}
struct_nodes = xml.findall('./')
... | JorrandeWit/ithenticate-api-python | iThenticate/API/Object/data.py | Python | bsd-2-clause | 1,868 |
from datetime import datetime, date, timedelta
import unittest
from businesstime import BusinessTime
from businesstime.holidays.usa import USFederalHolidays
class BusinessTimeTest(unittest.TestCase):
def setUp(self):
"""
Tests mostly based around January 2014, where two holidays, New Years Day
... | seatgeek/businesstime | businesstime/test/__init__.py | Python | bsd-2-clause | 11,646 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
import unittest
from io import StringIO
from ...vml import Vml
class TestWriteOshapelayout(unittest.TestC... | jmcnamara/XlsxWriter | xlsxwriter/test/vml/test_write_shapelayout.py | Python | bsd-2-clause | 804 |
from django.db import models
from django.utils.safestring import mark_safe
class Code(models.Model):
"""
Registration codes
"""
code = models.CharField(max_length=255, unique=True)
is_active = models.BooleanField(default=True)
class Meta:
app_label = 'profiles'
ordering = ('cod... | incuna/django-extensible-profiles | profiles/modules/codes/models.py | Python | bsd-2-clause | 389 |
""" The Threaded cache returns immediately on writes, then sends to the upstream
in a thread.
"""
from . import Cache, PassthroughCache
from . import copy_file_or_flo
from Queue import Queue, Empty
from threading import Thread
import signal
upload_queue = Queue(2000)
keep_alive = True # Don't need a mutex on a bool... | CivicKnowledge/ckcache | ckcache/async.py | Python | bsd-2-clause | 7,854 |
import cv2
import numpy as np
import CropImage
from random import randint
def imDiff(im1, im2):
# im1 = im1[0:im1.shape[0]-8, 0:im1.shape[1]]
# im2 = im2[0:im2.shape[0]-8, 0:im2.shape[1]]
imGray1 = cv2.cvtColor(im1, cv2.COLOR_BGR2GRAY)
imGray2 = cv2.cvtColor(im2, cv2.COLOR_BGR2GRAY)
... | SoumyajitPal/YinYang | ImDiff.py | Python | bsd-2-clause | 3,451 |
#!/usr/bin/env python
from __future__ import print_function
import numpy as np
import time
import re
import cv2
import os
import sys
from collections import defaultdict
from classifySoftmax import Net
from sklearn.metrics import pairwise_distances
def parse_args():
print( ' '.join(sys.argv))
import argparse
... | DCGM/EmotionService | src/testFaceRecognition.py | Python | bsd-2-clause | 2,571 |
from enum import IntEnum
import copy
class Type(IntEnum):
UNKNOWN = 0
FLOAT = 1
DOUBLE = 2
INT8_T = 3
UINT8_T = 4
INT16_T = 5
UINT16_T = 6
INT32_T = 7
UINT32_T = 8
INT64_T = 9
UINT64_T = 10
STRING = 11
VOID = 12
BOOL = 13
class Availability(IntEnum):
UNKNO... | GeosoftInc/gxapi | spec/gxdefs.py | Python | bsd-2-clause | 2,304 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
from gdcmdtools.base import BASE_INFO
from gdcmdtools.base import DEBUG_LEVEL
from gdcmdtools.auth import GDAuth
import argparse
from argparse import RawTextHelpFormatter
from gdcmdtools.auth import DICT_OF_REDIRECT_URI
import logging
logger = log... | commonssibi/gdcmdtools | gdauth.py | Python | bsd-2-clause | 2,528 |