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 |
|---|---|---|---|---|---|
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.node import PipeUnderground
log = logging.getLogger(__name__)
class TestPipeUnderground(unittest.TestCase):
def setUp(self):
self.fd, self.path = tempfile.mkstemp()... | rbuffat/pyidf | tests/test_pipeunderground.py | Python | apache-2.0 | 3,135 |
#!/usr/bin/env python
import wx
import logging
import webbrowser
import ConfigParser
import argparse
import wx.lib.delayedresult as dr
import wx.lib.agw.hyperlink as hl
from os import path, makedirs
from distutils.version import LooseVersion
from github3 import GitHub
from GUI import UploaderAppFrame, SettingsDialog
... | phac-nml/irida-miseq-uploader | run_IRIDA_Uploader.py | Python | apache-2.0 | 5,119 |
# Copyright 2012 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 agre... | zenlambda/aeta | testdata/test_modules/sample_package/subpackage/test_ham.py | Python | apache-2.0 | 825 |
########
# Copyright (c) 2015 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... | cloudify-cosmo/cloudify-dsl-parser | dsl_parser/elements/blueprint.py | Python | apache-2.0 | 4,469 |
from setuptools import setup
setup(name='flightPredict',
version='0.3',
description='Python Library for SPark MLLIB Flight Predict sample application',
url='git+https://github.com/ibm-watson-data-lab/simple-data-pipe-connector-flightstats.git',
author='David Taieb',
author_email='david_ta... | ibm-cds-labs/simple-data-pipe-connector-flightstats | setup.py | Python | apache-2.0 | 420 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.23
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | kubernetes-client/python | kubernetes/client/models/v1beta1_policy_rules_with_subjects.py | Python | apache-2.0 | 7,013 |
class ActionError(RuntimeError):
"""
Raise when something went wrong when doing an action.
"""
class NoValidSCVError(ActionError):
"""
Raise when no valid scv can be selected according to defined rules.
"""
class NoValidBuildingLocationError(ActionError):
"""
Raise when no valid loca... | Xaxetrov/OSCAR | oscar/meta_action/meta_action_error.py | Python | apache-2.0 | 667 |
#!/usr/bin/env python
# encoding: utf-8
"""
populate_rango.py
Created by Luis C. Berrocal on 2013-10-20.
Copyright (c) 2013 __MyCompanyName__. All rights reserved.
"""
import os
import sys
def populate():
python_cat = add_cat('Python', 128,64)
add_page(cat=python_cat,
title="Official Python Tutorial"... | luiscberrocal/rango_tutorial | populate_rango.py | Python | apache-2.0 | 2,007 |
# 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... | ghchinoy/tensorflow | tensorflow/python/ops/variable_scope.py | Python | apache-2.0 | 113,647 |
from __future__ import division, print_function, absolute_import, unicode_literals
import os
from mog_commons.case_class import CaseClass
from mog_commons.functional import omap
from javactl.util import normalize_path
class AppSetting(CaseClass):
def __init__(self, name=None, home=None, jar=None, entry_point=Non... | mogproject/javactl | src/javactl/setting/app_setting.py | Python | apache-2.0 | 1,507 |
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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 ... | Yelp/kafka-utils | tests/kafka_cluster_manager/helper.py | Python | apache-2.0 | 1,295 |
# 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 a... | jdanbrown/pydatalab | solutionbox/image_classification/mltoolbox/image/classification/_api.py | Python | apache-2.0 | 6,780 |
# Copyright 2011, OpenStack Foundation
# Copyright 2012, Red Hat, Inc.
# Copyright 2013 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/li... | stevelle/glance | glance/notifier.py | Python | apache-2.0 | 31,619 |
#!/usr/bin/env python
#===============================================================================
# Copyright 2015 Geoscience Australia
#
# 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
#... | ama-jharrison/agdc | agdc/agdc/abstract_ingester/ingest_db_wrapper.py | Python | apache-2.0 | 30,969 |
# Copyright 2014: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | amit0701/rally | tests/unit/plugins/openstack/context/keystone/test_roles.py | Python | apache-2.0 | 5,275 |
# python3
# pylint: disable=g-bad-file-header
# Copyright 2019 DeepMind Technologies Limited. 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... | deepmind/bsuite | bsuite/experiments/catch/analysis.py | Python | apache-2.0 | 2,122 |
#!/usr/bin/env python3
import argparse
import logging
import os
import sys
from pylib.common.utils.misc_utils import MiscUtils
from pylib.pygitlab import Gitlab
########################################
# add script folder to python path
# allow running script from any folder location.
# without need to mess with PYTH... | abrichards5/ABRUnixScripts | bin/gitlab_group_vars.py | Python | apache-2.0 | 4,029 |
from utils.header import MagicField, Field
from load_command import LoadCommandCommand, LoadCommandHeader
class SourceVersionField(Field):
def display(self, header):
if self.mnemonic:
value = self._get_value(header)
a = (value >> 40) & 0xffffff
b = (value >> 30) & 0x3ff... | hkkwok/MachOTool | mach_o/headers/source_version_command.py | Python | apache-2.0 | 983 |
#!/usr/bin/python2.7
import os
import sys
base_dir = os.path.dirname(os.path.realpath(__file__))
python_modules_dir = os.path.join(base_dir,"python-modules")
sys.path.append(python_modules_dir)
curdir = os.path.abspath(os.path.dirname(sys.argv[0]))
from ACEStream.Plugin.EngineConsole import start
apptype = 'acestream'... | aplicatii-romanesti/allinclusive-kodi-pi | .kodi/userdata/addon_data/plugin.video.p2p-streams/acestream/ace/start.py | Python | apache-2.0 | 345 |
# Copyright 2019, The TensorFlow Federated 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/federated | tensorflow_federated/python/core/impl/executors/federating_executor_test.py | Python | apache-2.0 | 35,600 |
# Copyright 2013, Big Switch 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... | spandanb/horizon | openstack_dashboard/dashboards/project/routers/extensions/routerrules/forms.py | Python | apache-2.0 | 4,117 |
import calendar
c = calendar.TextCalendar(calendar.SUNDAY)
c.prmonth(2017, 7)
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_dates_and_times/calendar_textcalendar.py | Python | apache-2.0 | 79 |
class Loader(object):
"""
Base class of every Loaders
"""
def __init__(self, scheduler):
"""
:param host: the scheduler
"""
self._scheduler = scheduler
self._nodes = []
self._links = []
def get_nodes(self):
"""
:re... | IntegrCiTy/obnl | obnl/core/impl/loaders.py | Python | apache-2.0 | 2,342 |
from __future__ import absolute_import
from __future__ import unicode_literals
from mb.lib.memoize import memoize
class SomeClass:
def __init__(self):
self._x = 0
def _the_test(self, number):
self._x += 1
return number * self._x
@memoize
def TestCache1(self, number):
... | silverbp/master-builder | tests/memoize_test.py | Python | apache-2.0 | 916 |
##
# Copyright (c) 2005-2015 Apple 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 l... | red-hood/calendarserver | calendarserver/tools/test/test_resources.py | Python | apache-2.0 | 4,593 |
#!/usr/bin/env python
import os
from glob import glob
if os.environ.get('USE_SETUPTOOLS'):
from setuptools import setup
setup_kwargs = dict(zip_safe=0)
else:
from distutils.core import setup
setup_kwargs = dict()
storage_dirs = []
for subdir in ('whisper', 'ceres', 'rrd', 'log', 'log/webapp'):
storage_d... | SEJeff/graphite-web | setup.py | Python | apache-2.0 | 1,530 |
from tornado.httpserver import HTTPRequest
from ..functions import parse_request
def test_get_stats():
""" Test parse_request for 'Get information on the stats
returns correctly parsed request.
"""
request = {
'args': {
'method': 'GET',
'uri': '/_stats',
}... | HatPull/tornado-elasticsearch-proxy | es_proxy/tests/test_parse_request.py | Python | apache-2.0 | 8,311 |
#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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... | dpanth3r/biggraphite | tests/test_graphite_utils.py | Python | apache-2.0 | 1,444 |
# -*- coding: utf-8 -*-
'''
The crypt module manages all of the cryptography functions for minions and
masters, encrypting and decrypting payloads, preparing messages, and
authenticating peers
'''
# Import python libs
import os
import sys
import time
import hmac
import shutil
import hashlib
import logging
# Import th... | MadeiraCloud/salt | sources/salt/crypt.py | Python | apache-2.0 | 18,535 |
import re
import string
import sys
from pyspark import SparkContext
exclude = set(string.punctuation)
def get_hash_tag(word, rmPunc):
pattern = re.compile("^#(.*)")
m = pattern.match(word)
tag = None
if m:
match = m.groups()
for m_word in match:
tag = ''.join(letter for letter in m_word... | malli3131/SparkApps | Batch_sentiment/spark_hashtag.py | Python | apache-2.0 | 828 |
"""Base Command class, and related routines"""
import sys
import os
import socket
import urllib2
import urllib
from cStringIO import StringIO
import traceback
import time
from pip.log import logger
from pip.baseparser import parser, ConfigOptionParser, UpdatingDefaultsHelpFormatter
from pip.exceptions import Installat... | 2013Commons/HUE-SHARK | build/env/lib/python2.7/site-packages/pip-0.6.3-py2.7.egg/pip/basecommand.py | Python | apache-2.0 | 7,777 |
# -*- 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/types/common.py | Python | apache-2.0 | 9,405 |
"""Lists clusters."""
from baseCmd import *
from baseResponse import *
class listClustersCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "false"
"""lists clusters by allocation state"""
self.allocationstate = None
self.typeInfo['allocationstate'] = 'string'
... | MissionCriticalCloud/marvin | marvin/cloudstackAPI/listClusters.py | Python | apache-2.0 | 3,916 |
# -*- coding: utf-8 -*-
# Minio Python Library for Amazon S3 compatible cloud storage, (C) 2015 Minio, 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/licen... | krishnasrinivas/minio-py | tests/unit/compat.py | Python | apache-2.0 | 917 |
from azure.servicebus import ServiceBusService, Message, Queue
class azure_service_bus_listener(object):
def __init__(self, azure_settings):
self.bus_service = ServiceBusService(
service_namespace= azure_settings['name_space'],
shared_access_key_name = azure_settings['key_name'],
... | rumdood/martinique | src/PiDaemon/azure_service_bus_listener.py | Python | apache-2.0 | 1,135 |
import os
import logging
import time
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.backends import default_backend
from googleapiclient import discovery, errors
logger = logging.getLogger(__name__)
crm = discovery.build("cl... | stephanie-wang/ray | python/ray/autoscaler/gcp/config.py | Python | apache-2.0 | 14,384 |
# 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_service_account.py | Python | apache-2.0 | 8,051 |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright 2013 Canonical Corp.
# 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
#
# htt... | blueboxgroup/nova | nova/tests/unit/virt/vmwareapi/test_vm_util.py | Python | apache-2.0 | 58,050 |
#!/usr/bin/python
# coding=utf-8
# Copyright 2017 yaitza. All Rights Reserved.
#
# https://yaitza.github.io/2017-04-26-Python-FilterPicture
#
# My Code hope to usefull for you.
# ===================================================================
__author__ = "yaitza"
__date__ = "2017-04-26 13:59"
import os
from ... | yaitza/python | PROJECT2017/Tools/FilterPicSize.py | Python | apache-2.0 | 1,440 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/test_dataset.py | Python | apache-2.0 | 43,925 |
# Copyright 2012 VMware, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | CingHu/neutron-ustack | neutron/db/securitygroups_db.py | Python | apache-2.0 | 30,323 |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | gilbertpilz/solum | solum/tests/api/handlers/test_assembly.py | Python | apache-2.0 | 5,985 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from threading import Thread
import unreal_engine as ue
import ue_site
# Google Assistant imports
from googlesdk.assistant.embedded.v1alpha1 import embedded_assistant_pb2
from googlesamples.assistant import common_settings
# General Google imports
from google... | Jay2645/Unreal-Google-Assistant | Content/Scripts/threaded_assistant.py | Python | apache-2.0 | 4,927 |
"""
Support for Wink binary sensors.
For more details about this platform, please refer to the documentation at
at https://home-assistant.io/components/binary_sensor.wink/
"""
import asyncio
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.wink import ... | persandstrom/home-assistant | homeassistant/components/binary_sensor/wink.py | Python | apache-2.0 | 6,764 |
#!/usr/bin/env 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
# "L... | radical-cybertools/aimes.swiftrp | thrift_tests/server.py | Python | apache-2.0 | 9,371 |
#!/usr/bin/env python2.7
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from argparse import ArgumentParser
from collections import OrderedDict
from contextlib import contextmanager
import json
import logging
import multiprocessing
import os
import shutil
... | mariosgohan/infinite-trailer | infinite_trailer.py | Python | apache-2.0 | 12,916 |
# Copyright (C) 2016 Ross Wightman. 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
# =================================... | rwightman/udacity-driving-reader | script/bagutils.py | Python | apache-2.0 | 12,425 |
# Copyright (c) 2012 Rackspace Hosting
# 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... | sridevikoushik31/openstack | nova/cells/scheduler.py | Python | apache-2.0 | 5,442 |
# Copyright 2015 Vinicius Chiele. 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... | viniciuschiele/simplebus | simplebus/handlers.py | Python | apache-2.0 | 1,217 |
#!/usr/bin/python2.7
import nltk
f = open("../corpus/data.en","r")
f2 = open("../corpus/tagged_data","w")
lines = f.readlines()
for line in lines:
tokens = nltk.word_tokenize(line)
tag_list = nltk.pos_tag(tokens)
print>> f2, tag_list
# f2.write(tag_list)
| shyamjvs/cs626_project | python_code/pos_tag_corpus.py | Python | apache-2.0 | 274 |
"""Tests for aiohttp/protocol.py"""
import asyncio
import unittest
import zlib
from unittest import mock
import pytest
from multidict import CIMultiDict
from yarl import URL
import aiohttp
from aiohttp import http_exceptions, streams
from aiohttp.http_parser import (DeflateBuffer, HttpPayloadParser,
... | playpauseandstop/aiohttp | tests/test_http_parser.py | Python | apache-2.0 | 24,179 |
# 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... | NaohiroTamura/ironic | ironic_tempest_plugin/tests/api/admin/test_nodes.py | Python | apache-2.0 | 11,622 |
import Tkinter as tk
import Tkinter as tk2
import code as c
def g1():
g1 = tk.Tk()
A = tk.Button(g1, text ="About", command = c.b1)
B = tk.Button(g1, text ="Date", command = c.b2)
C = tk.Button(g1, text ="Time", command = c.b3)
D = tk.Button(g1, text ="CountSeconds", command = c.b4)
A.pack()
B.pack()
C.pack()
... | Prouser123/python-tk | py/gui.py | Python | apache-2.0 | 514 |
#!/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... | 2013Commons/HUE-SHARK | desktop/libs/liboozie/src/liboozie/oozie_api_test.py | Python | apache-2.0 | 5,769 |
#!/usr/bin/env python
#
# Copyright 2016 timercrack
#
# 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... | timercrack/pydatacoll | pydatacoll/utils/func_container.py | Python | apache-2.0 | 1,572 |
import logging
from coursedashboards.util.retry import retry
from uw_sws.registration import get_active_registrations_by_section
from restclients_core.exceptions import DataFailureException
from urllib3.exceptions import MaxRetryError
logger = logging.getLogger(__name__)
@retry(MaxRetryError, tries=5, delay=3, logg... | uw-it-aca/course-dashboards | coursedashboards/dao/registration.py | Python | apache-2.0 | 633 |
#
# Copyright 2018 Analytics Zoo 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... | intel-analytics/analytics-zoo | pyzoo/zoo/orca/learn/horovod/__init__.py | Python | apache-2.0 | 640 |
import pika
auth = 'bunny:bunny'
mq_credentials = pika.credentials.PlainCredentials(*auth.split(':'))
params = pika.ConnectionParameters(
host='bunny-vayu.sbgenomics.com',
credentials=mq_credentials,
virtual_host='bunny')
fp = open('sample/app.json', 'r')
sample_json = fp.read()
connection =... | rabix/bunny | rabix-integration-testing/backends/mock_backend/mq_send.py | Python | apache-2.0 | 700 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | RyanSkraba/beam | sdks/python/apache_beam/metrics/metric_test.py | Python | apache-2.0 | 5,846 |
"""Support for the Hive sensors."""
from datetime import timedelta
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.helpers.entity import DeviceInfo
from . import HiveEntity
from .const import DOMAIN
PARALLEL_UPDATES = 0
SCAN_INTERVAL = timedelta(seconds=15)
DEVICETYPE ... | home-assistant/home-assistant | homeassistant/components/hive/sensor.py | Python | apache-2.0 | 2,371 |
import os
import calliope
import pytest # pylint: disable=unused-import
import tempfile
from calliope.core.attrdict import AttrDict
from calliope.test.common.util import check_error_or_warning, python36_or_higher
HTML_STRINGS = AttrDict.from_yaml(
os.path.join(os.path.dirname(__file__), 'common', 'html_strings.... | brynpickering/calliope | calliope/test/test_analysis.py | Python | apache-2.0 | 8,658 |
"""
Auth module, contains of login, logout and social network authorization modules, now vk only
"""
from flask import request, redirect, render_template, url_for, g, session, Blueprint
from flask_login import login_user, logout_user, current_user
from app import lm
from app.models import User, ROLE_USER
from app.vk_ap... | Kwentar/Dream-Crusher | app/auth_views.py | Python | apache-2.0 | 3,770 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Thibaut Lapierre <git@epheo.eu>. 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
#
# ... | epheo/shaddock | shaddock/model.py | Python | apache-2.0 | 8,118 |
import requests
import pytest
import subprocess
import os
from settings import TEST_DATA
from suite.custom_resources_utils import (
create_dos_logconf_from_yaml,
create_dos_policy_from_yaml,
create_dos_protected_from_yaml,
delete_dos_policy,
delete_dos_logconf,
delete_dos_protected,
)
from suit... | nginxinc/kubernetes-ingress | tests/suite/test_dos.py | Python | apache-2.0 | 19,400 |
from adobject import *
class ADComputer(ADObject):
"""Python class representing a computer object in Active Directory."""
@classmethod
def create(cls, name, container_object, enable=True, optional_attributes={}):
"""Creates and returns a new computer object."""
assert type(name) == str
... | ECS-Security/Hive | pyad/adcomputer.py | Python | apache-2.0 | 934 |
'''
9. Find all of the crypto map entries that are using PFS group2
'''
from ciscoconfparse import CiscoConfParse
config = CiscoConfParse('cisco_ipsec.txt')
pfs_group2 = config.find_objects_w_child(parentspec=r"^crypto map CRYPTO",
childspec=r"pfs group2")
for entry in pfs_gr... | eclecticitguy/pynet_paid | class1/ex9_confparse.py | Python | apache-2.0 | 346 |
"""
Copyright 2016 adpoliak
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,... | adpoliak/NSAptr | ui/curses/versionchooser.py | Python | apache-2.0 | 4,308 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | ntt-sic/heat | heat/tests/test_clients.py | Python | apache-2.0 | 2,473 |
from django.db.transaction import atomic
from api.api_views import APIView
from api.exceptions import VmIsNotOperational, VmHasPendingTasks, VmIsLocked, PreconditionRequired
from api.task.response import FailureTaskResponse, SuccessTaskResponse
from api.task.utils import task_log_success
from api.vm.utils import get_v... | erigones/esdc-ce | api/vm/migrate/vm_dc.py | Python | apache-2.0 | 2,612 |
#!/usr/bin/env python
from __future__ import print_function
try:
# PY2
ip_addr = raw_input("Please enter IP address: ")
except NameError:
# PY3
ip_addr = input("Please enter IP address: ")
ip_addr = ip_addr.split(".")
print()
print("{:<12} {:<12} {:<12} {:<12}".format(*ip_addr))
print()
| damintote/pynet_test | string2.py | Python | apache-2.0 | 311 |
# 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/struct2tensor | struct2tensor/expression_impl/reroot_test.py | Python | apache-2.0 | 6,436 |
"""
Model classes for AppDynamics REST API
.. moduleauthor:: Todd Radel <tradel@appdynamics.com>
"""
from . import JsonObject, JsonList
class ConfigVariable(JsonObject):
"""
Represents a controller configuration variable. The following attributes are defined:
.. data:: name
Variable name.
... | tradel/AppDynamicsREST | appd/model/config_variable.py | Python | apache-2.0 | 2,002 |
"""
Knowledge combiners take:
- Encoded representations of background facts related to the sentence
- Attention weights over the background as a single tensor.
These are then combined in some way to return a single representation of the
background knowledge per sample. The simplest way for this to happen is simply
ta... | RTHMaK/RPGOne | deep_qa-master/deep_qa/layers/knowledge_combiners.py | Python | apache-2.0 | 10,674 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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... | tensorflow/datasets | tensorflow_datasets/core/utils/tree_utils_test.py | Python | apache-2.0 | 1,072 |
# Copyright 2012 Kevin Minnick
# 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... | kwminnick/rackspace-dns-cli | dnsclient/v1_0/records.py | Python | apache-2.0 | 5,748 |
from django.core.mail import send_mail
from django.core.handlers.base import BaseHandler
from django.test.client import RequestFactory, FakePayload
import collections
#####################################################
### Utility functions
def flat_attr(attrs, level=0):
'''Flattens the attribute map to a ... | lanesawyer/island | lib/__init__.py | Python | apache-2.0 | 2,512 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | sajeeshcs/nested_quota_final | nova/compute/manager.py | Python | apache-2.0 | 289,419 |
#!/usr/bin/env python2.7
# Copyright 2015 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | SivagnanamCiena/nxapi-learning-labs | python/example/show_routing.py | Python | apache-2.0 | 4,441 |
# 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 law or agreed to in... | ilay09/keystone | keystone/contrib/ec2/controllers.py | Python | apache-2.0 | 18,455 |
#!/usr/bin/env python
import os
import sys
import time
sys.path.append(os.path.join(os.path.dirname(__file__), "../../pox"))
import argparse
from collections import defaultdict
import networkx as nx
from pox.lib.packet.ethernet import ethernet
from pox.openflow.libopenflow_01 import ofp_flow_mod_command_rev_map
from... | jmiserez/sts | sts/happensbefore/hb_graph.py | Python | apache-2.0 | 72,338 |
# 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
import thr... | dbentley/pants | src/python/pants/cache/cache_setup.py | Python | apache-2.0 | 11,380 |
# -*- coding: utf-8 -*-
'''
The match module allows for match routines to be run and determine target specs
'''
# Import python libs
import logging
# Import salt libs
import salt.minion
__func_alias__ = {
'list_': 'list'
}
log = logging.getLogger(__name__)
def compound(tgt):
'''
Return True if the min... | victorywang80/Maintenance | saltstack/src/salt/modules/match.py | Python | apache-2.0 | 4,350 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | google/google-ctf | 2018/quals/re-basics/src/byteops.py | Python | apache-2.0 | 922 |
# coding=utf-8
# Copyright 2016 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 unittest
from... | dbentley/pants | tests/python/pants_test/engine/exp/test_storage.py | Python | apache-2.0 | 5,956 |
# -*- 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... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2_contexts_list_contexts_async.py | Python | apache-2.0 | 1,522 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.10.4.
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
... | kleinzh/PythonBlog | mysite/mysite/settings.py | Python | apache-2.0 | 3,558 |
class CheckPriceYDPage:
def __init__(self, driver):
self.driver = driver
def get_page_yellow_duck(self):
self.driver.find_element_by_xpath(
"//a[@href='http://localhost/litecart/en/rubber-ducks-c-1/subcategory-c-2/yellow-duck-p-1']").click()
def get_compaign_price_yd(self):
... | skostya64/Selenium_tasks | pages/check_price_yd_page.py | Python | apache-2.0 | 622 |
def brancher( # noqa: E302
self, branches=None, all_branches=False, tags=None, all_tags=False
):
"""Generator that iterates over specified revisions.
Args:
branches (list): a list of branches to iterate over.
all_branches (bool): iterate over all available branches.
tags (list): a ... | dataversioncontrol/dvc | dvc/repo/brancher.py | Python | apache-2.0 | 1,700 |
# Copyright 2010 OpenStack Foundation
# Copyright 2012 University Of Minho
#
# 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.... | felixma/nova | nova/tests/unit/virt/libvirt/test_driver.py | Python | apache-2.0 | 670,986 |
#coding=utf-8
import sys
import optparse
if len(sys.argv )!= 3:
sys.stderr.write("usage: python %s inputfile outputfile\n" % sys.argv[0])
#raise SystemExit(1)
p = optparse.OptionParser()
p.add_option("-o", action="store",dest="outfile")
p.add_option("--output", action="store", dest="outfile")
p.set_defaults(d... | wufengwhu/my_blog | exercise/io/std_in_out.py | Python | apache-2.0 | 399 |
import io
import json
import zlib
from unittest import mock
import pytest
import aiohttp
from aiohttp import payload
from aiohttp.hdrs import (CONTENT_DISPOSITION, CONTENT_ENCODING,
CONTENT_TRANSFER_ENCODING, CONTENT_TYPE)
from aiohttp.helpers import parse_mimetype
from aiohttp.multipart imp... | rutsky/aiohttp | tests/test_multipart.py | Python | apache-2.0 | 38,605 |
#!/usr/bin/env python
import os
from MentalUs import create_app, db
from MentalUs.models import MTUser, MTScale, MTAnnouncement, \
MTExtendFields, MTUserExtendInfo, MTScaleResult, MTUnfinishedScale
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
app = create_app(... | realityone/MentalUs | manage.py | Python | apache-2.0 | 1,169 |
# Copyright 2015 DataStax, 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, s... | jfelectron/python-driver | cassandra/cqlengine/models.py | Python | apache-2.0 | 33,196 |
'''
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 ... | radicalbit/ambari | ambari-server/src/test/python/TestVersion.py | Python | apache-2.0 | 3,260 |
import click
import webbrowser
import sys
import floyd
from floyd.client.auth import AuthClient
from floyd.manager.auth_config import AuthConfigManager
from floyd.model.access_token import AccessToken
from floyd.model.credentials import Credentials
from floyd.log import logger as floyd_logger
@click.command()
@click... | mckayward/floyd-cli | floyd/cli/auth.py | Python | apache-2.0 | 2,580 |
"""Unit tests for the Azure Devops Server issues collector."""
from .base import AzureDevopsTestCase
class AzureDevopsIssuesTest(AzureDevopsTestCase):
"""Unit tests for the Azure Devops Server issues metric."""
METRIC_TYPE = "issues"
async def test_nr_of_issues(self):
"""Test that the number of... | ICTU/quality-time | components/collector/tests/source_collectors/azure_devops/test_issues.py | Python | apache-2.0 | 1,498 |
# Copyright 2020 Google 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | googleapis/python-spanner | tests/unit/spanner_dbapi/test_utils.py | Python | apache-2.0 | 4,189 |
#Exercise 6
import yaml
import json
def main():
yaml_file = 'test_file.yml'
json_file = 'jsontest.json'
dict = {
'ip_add': '192.168.1.100',
'vendor': 'cisco'
}
list = [
'week one',
99,
18
]
with open(yaml_file, "w") as f:
f.write(yaml.dump(list, default_flow_style=False))
with open(js... | ttomasello/pynetclass | ttexercise6.py | Python | apache-2.0 | 406 |
"""Base OpHandler for ops that use group lasso regularizer.
This OpHandler should not be called directly. It is a virtual base class
for regularization source OpHandlers that use Group Lasso as their regularizer.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_f... | google-research/morph-net | morph_net/framework/group_lasso_base_op_handler.py | Python | apache-2.0 | 5,974 |
# Copyright 2020 Makani Technologies 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... | google/makani | avionics/bootloader/program_ui.py | Python | apache-2.0 | 20,711 |