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) 2014 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | esikachev/scenario | sahara/tests/tempest/scenario/data_processing/client_tests/test_jobs.py | Python | apache-2.0 | 2,479 |
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ma... | DataONEorg/d1_python | lib_common/src/d1_common/iter/bytes.py | Python | apache-2.0 | 1,660 |
# -*- coding: utf-8 -*-
"""Delimiter separated values (DSV) parser interface."""
import abc
import csv
import os
from dfvfs.helpers import text_file
from plaso.lib import errors
from plaso.lib import specification
from plaso.parsers import interface
class DSVParser(interface.FileObjectParser):
"""Delimiter separ... | Onager/plaso | plaso/parsers/dsv_parser.py | Python | apache-2.0 | 10,932 |
#!/usr/bin/python
import os
import os.path
import json
import sys
import urlparse
DIRECTORY = "/Users/tannewt/case/parts"
for dirpath, dirnames, filenames in os.walk(DIRECTORY):
if dirpath.find(".git") > -1:
continue
for filename in filenames:
if filename[-4:] != "json":
continue
fn = os.path.j... | rcbuild-info/scrape | refactor_scripts/remove_website_from_urls.py | Python | apache-2.0 | 742 |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Herald HTTP beans definition
:author: Thomas Calmant
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.0.3
:status: Alpha
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
you... | librallu/cohorte-herald | python/herald/transports/http/beans.py | Python | apache-2.0 | 3,526 |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=8, path_list=[
[TestAction.create_vm, 'vm1', ],
[TestAction.create_volume, 'volume1', 'flag=scsi'],
[TestAction.attach_volume, 'vm1', 'volume1'],
... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/vm_snapshots/paths/xsky_path9.py | Python | apache-2.0 | 2,040 |
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2005, Tim Potter <tpot@samba.org>
# Copyright 2006 John-Mark Gurney <gurney_j@resnet.uroegon.edu>
# Copyright (C) 2006 Fluendo, S.A. (www.fluendo.com).
# Copyright 2006,2007,2008,2009 Frank Scholz <coherence@beebits.net>
# Co... | bluesliverx/smartthings-src | apps/wifi-104-ssdp-server/lib/ssdp.py | Python | apache-2.0 | 8,142 |
import sys
import json
from .generic_kafka_processor import GenericKafkaProcessor
default_printer_prefix = "KPRINT_"
class KafkaPrinter(GenericKafkaProcessor):
def __init__(self, global_conf_filename, prefix=default_printer_prefix, pid=None):
# call GenericKafkaProcessor init (and others potentially)
super(... | ColumbiaDVMM/ColumbiaImageSearch | cufacesearch/cufacesearch/ingester/kafka_printer.py | Python | apache-2.0 | 1,487 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | joshuamckenty/yolo-octo-wookie | nova/endpoint/rackspace.py | Python | apache-2.0 | 7,526 |
# Copyright 2021 Spectra Logic 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. A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file ... | SpectraLogic/ds3_python3_sdk | tests/helpersTests.py | Python | apache-2.0 | 12,900 |
#!/usr/bin/python3
"""
Merges raw data from geneteka into larger json files.
"""
from collections import defaultdict
import html
import json
import os
import re
INPUT_DIR = 'data_raw'
OUTPUT_DIR = 'data'
def extractNotes(value):
match = re.search(r'i.png" title="([^"]*)"', value)
if match:
return (value.s... | PeWu/python-geneteka | merge.py | Python | apache-2.0 | 4,704 |
#coding: utf-8
from django.http import HttpResponse
from django.shortcuts import render
def index(request):
return HttpResponse('UnderConstruction')
def help(request):
return render(request, 'help.html')
| haandol/assemblyapi | main/views.py | Python | apache-2.0 | 215 |
"""umusicfy URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | CarlosMart626/umusicfy | umusicfy/umusicfy/urls.py | Python | apache-2.0 | 1,887 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Maintainer: Fad
from datetime import date, timedelta
from calendar import monthrange
def get_week_boundaries(year, week):
"""
Retoure les date du premier et du dernier jour de la semaine dont
on a le numéro.
"""
d = date(year, 1, 1)
if(... | fadiga/mstock | tools/periods.py | Python | apache-2.0 | 8,621 |
# coding=utf-8
# Copyright 2014-2016 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | richbrowne/f5-openstack-agent | f5_openstack_agent/lbaasv2/drivers/bigip/test/test_lbaas_builder.py | Python | apache-2.0 | 86,393 |
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2009-2010 Ars Aperta, Itaapy, Pierlis, Talend.
#
# Authors: Hervé Cauwelier <herve@itaapy.com>
#
# This file is part of Lpod (see: http://lpod-project.org).
# Lpod is free software; you can redistribute it and/or modify it under
# the terms of either:
#
# a) the GNU General Pub... | Agicia/lpod-python | image.py | Python | apache-2.0 | 2,333 |
# 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 | graph_compression/compression_lib/compression_op_test.py | Python | apache-2.0 | 24,111 |
import pytest
#
# Preloaded fixtures, with pytest.param that allows a nicer repr when the test runs, instead of the
# default which slaps the whole (giant) dictionary, making output unreadable.
#
def package_path(path):
"""
Produce a recognizable path name for a package. For the input of:
/usr/lib/node_... | anchore/anchore-engine | tests/functional/clients/standalone/package_list/__init__.py | Python | apache-2.0 | 1,723 |
import sys
if __name__ == '__main__':
with open('/dev/input') as input_fp:
with open('/dev/output', 'a') as output_fp:
output_fp.write(input_fp.read())
msg = 'Zapp registered!'
resp = """\
HTTP/1.1 201 Created
Content-Type: message/http
Content-Length: %(msg_len)s
%(m... | larsbutler/zpa | publish/store.py | Python | apache-2.0 | 399 |
import random
from alma.common import exception
def vector_scalar_mult(vec1, vec2):
if len(vec1) != len(vec2):
raise exception.SizeMustBeEqual(size1=len(vec1),
size2=len(vec2))
m = 0
for v1, v2 in zip(vec1, vec2):
m += v1 * v2
return m
def vec... | i-newton/AlmaNeuro | alma/util/vec_util.py | Python | apache-2.0 | 1,766 |
# Copyright 2010 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 requ... | HybridF5/jacket | jacket/api/compute/openstack/compute/flavors_extraspecs.py | Python | apache-2.0 | 6,329 |
#
# 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... | mistercrunch/airflow | airflow/sensors/external_task.py | Python | apache-2.0 | 14,311 |
# coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... | wavefrontHQ/python-client | test/test_derived_metric_definition.py | Python | apache-2.0 | 1,356 |
import os, sys
# to read dependencies from ./lib direcroty
script_dir = os.path.dirname( os.path.realpath(__file__) )
sys.path.insert(0, script_dir + os.sep + "lib")
import logging, boto3, json, random
# for dynamodb filter queries
from boto3.dynamodb.conditions import Key, Attr
# setup log level to DEBUG
log = loggi... | akranga/mafia-serverless | solutions/day.py | Python | apache-2.0 | 1,580 |
# 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 ... | sunu/oppia-test | controllers/feedback.py | Python | apache-2.0 | 1,415 |
# -*- coding: utf-8 -*-
# Minio Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2015, 2016, 2017 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.ap... | donatello/minio-py | tests/unit/minio_test.py | Python | apache-2.0 | 3,851 |
import time
import datetime
import uuid
import os
import sys
import stat
import os.path
import threading
import tarfile
import hashlib
import string
import shutil
import errno
from future.utils import iteritems
from rucio.client import Client as RucioClient
from rucio.common.exception import DataIdentifierNotFound, D... | PanDAWMS/panda-harvester | pandaharvester/harvesterstager/yoda_rucio_rse_direct_stager.py | Python | apache-2.0 | 23,712 |
#!/usr/bin/env python
net_device = {
'ip_addr' : '10.0.201.72',
'username' : 'admin',
'password' : ' inital_pass',
'vendor' : 'cisco',
'model' : '5672'
}
print
for k,v in net_device.items():
print k,v
net_device['password'] = raw_input("Enter new password: ")
net_device['secret'] = raw_input("Enter ne... | jforaker04/pynet_test | dict_ex1.py | Python | apache-2.0 | 448 |
import sys
class Vertex:
def __init__(self, node):
self.id = node
self.adjacent = {}
# Set distance to infinity for all nodes
self.distance = sys.maxint
# Mark all nodes unvisited
self.visited = False
# Predecessor
self.previous = None
... | saisankargochhayat/algo_quest | graph/dijkstra.py | Python | apache-2.0 | 4,465 |
# 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... | nolanliou/tensorflow | tensorflow/python/ops/standard_ops.py | Python | apache-2.0 | 10,999 |
# Copyright 2014 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 writ... | openstack/python-aodhclient | aodhclient/osc.py | Python | apache-2.0 | 1,844 |
from sm.so.service_orchestrator import LOG
from novaclient import client
from emm_exceptions.NotFoundException import NotFoundException
from model.Entities import Key, Flavor, Image, Quotas
__author__ = 'lto'
class Client:
def __init__(self, conf=None):
if not conf:
from util.SysUtil impor... | MobileCloudNetworking/maas | bundle/clients/nova.py | Python | apache-2.0 | 3,217 |
# Copyright 2018 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 | components/gcp/container/component_sdk/python/tests/google/dataproc/test__submit_pig_job.py | Python | apache-2.0 | 1,768 |
import codecs
import os.path
import sys
import setuptools
# READ README.md for long description on PyPi.
try:
long_description = open("README.md", encoding="utf-8").read()
except Exception as e:
sys.stderr.write(f"Failed to read README.md:\n {e}\n")
sys.stderr.flush()
long_description = ""
# Get th... | blackjax-devs/blackjax | setup.py | Python | apache-2.0 | 1,650 |
#!/usr/bin/python
# Red Hat Satellite - API Guide - 4.2.1. Creating Objects Using Python
# Link: https://access.redhat.com/documentation/en-US/Red_Hat_Satellite/6.1/html-single/API_Guide/index.html#idm4983248
#
# The following script connects to the Red Hat Satellite 6 API and creates a new organization, then creates ... | mtulio/kb | dev/satellite6_api/create_obj_env.py | Python | apache-2.0 | 3,870 |
from graph_diff.unordered_ant_algorithm import parameters
class PheromonTable:
"""Lazy pheromon table for the ant algorithm"""
P = parameters.P
def __init__(self):
self.table = {}
self.last_update = {}
self.current_iteration = 0
# O(1)
def get_element(self, u, u1, v, v1)... | alexander-bzikadze/graph_diff | graph_diff/unordered_ant_algorithm/pheromon_table.py | Python | apache-2.0 | 1,107 |
# -*- 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-analytics-admin | samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_metrics_async.py | Python | apache-2.0 | 1,592 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from flask import Flask
from config import *
# create the app
app = Flask(__name__)
# Load default config and override config from config file
app.config.from_object('config') | n8foo/cigarbox | app.py | Python | apache-2.0 | 223 |
import urllib2
import urllib
import hashlib
import json
import time
import socket
import os
import logging
import hmac
import base64
from cloud_exceptions import CloudException
from dataobject import *
__all__ = ['BaseClient', 'DataObject', 'CloudException']
logger = logging.getLogger('cloud_com.baseclient')
cla... | StefanKjartansson/Cloudstack-Python-Client | cloudstack/baseclient.py | Python | apache-2.0 | 6,613 |
# -*- coding: utf-8 -*-
"""Tests for aiohttp/client.py"""
import asyncio
import gc
import unittest
from unittest import mock
import aiohttp
from aiohttp.client import ClientSession
from aiohttp.multidict import MultiDict, CIMultiDict
from aiohttp.connector import BaseConnector, TCPConnector
class TestClientSession(... | flying-sheep/aiohttp | tests/test_client_session.py | Python | apache-2.0 | 13,926 |
'''
test iam2 vm operations by platform admin/operator/member
# 1 create project
# 2 create virtual id (project admin/operator/member)
# 3 operations on vm with virtual id
# 4 delete
@author: quarkonics
'''
import os
import time
import zstackwoodpecker.test_util as test_util
import apibinding.inventory as inventory
i... | zstackorg/zstack-woodpecker | integrationtest/vm/simulator/iam2/test_iam2_project_basic_ops_network_service.py | Python | apache-2.0 | 7,842 |
#
# Copyright 2016 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | florentchandelier/zipline | zipline/finance/trading.py | Python | apache-2.0 | 9,694 |
# -*- coding: utf-8 -*-
from wikitools.api import APIRequest
from wikitools.wiki import Wiki
from wikitools.page import Page
from urllib2 import quote
pairs = [
['"', '"'],
['(', ')'],
['[', ']'],
['{', '}'],
['<!--', '-->'],
['<', '>'],
['<gallery', '</gallery>'],
['<includeonly>', '</includeonly>'],
... | jbzdarkid/Random | mismatched.py | Python | apache-2.0 | 1,737 |
"""tf.nn.relu(features, name = None)
解释:这个函数的作用是计算激活函数relu,即max(features, 0)。
所有负数都会归一化为0,所以的正值保留为原值不变
优点在于不受"梯度消失"的影响,且取值范围在[0,+oo],缺点在于使用了较大的学习速率时,易受达到饱和的神经元的影响
使用例子:"""
import tensorflow as tf
a = tf.constant([-1.0, 2.0])
with tf.Session() as sess:
b = tf.nn.relu(a)
print(sess.run(b))
# [0. 2.]
"""输入参... | Asurada2015/TFAPI_translation | NeuralNekworks_function/Activefunction/tf_nn_relu.py | Python | apache-2.0 | 769 |
# Copyright 2015 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 agree... | noironetworks/heat | heat/engine/resources/openstack/senlin/cluster.py | Python | apache-2.0 | 15,586 |
# -*- coding: utf-8 -*-
import time
import unittest
from selenium import webdriver
import settings
class ModifyStudentInfo(unittest.TestCase):
def setUp(self):
self.driver = None
self.base_url = settings.test_parameters.get("education_base_url")
def test_E83_modify_the_student... | sysuwuhaibin/vatus | vatus/testcases/test_education/test_user_management/test_E83_modify_the_students_information.py | Python | apache-2.0 | 7,684 |
import requests
def getHTMLText(url):
try:
r=requests.get(url,timeout=30)
r.raise_for_status()
r.encoding=r.apparent_encoding
return r.text
except:
return "产生异常"
if __name__=="__main__":
url="http://www.baidu.com"
print(getHTMLText(url)) | ccto/python-demos | 06-requests/framework.py | Python | apache-2.0 | 303 |
from django.shortcuts import render
from django.http import *
from .models import *
# from django.template import RequestContext,loader
# Create your views here.
def index(request):
# return HttpResponse('hello')
# temp=loader.get_template('booktest/index.html')
# return HttpResponse(temp.render())
b... | nacker/pythonProject | Django/test1/booktest/views.py | Python | apache-2.0 | 633 |
# Copyright 2016 Google LLC
# Modifications: 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 ... | googleinterns/server-side-identity | gsi/transport/__init__.py | Python | apache-2.0 | 3,286 |
from tests.serializers.urls import urlpatterns as serializers_urls
urlpatterns = [
] + serializers_urls
| alanjds/drf-nested-routers | tests/urls.py | Python | apache-2.0 | 105 |
import glob
import os
import re
import shutil
import shlex
import subprocess
import sys
from urllib.parse import urlparse
from urllib.parse import ParseResult
import zipfile
from sys import platform as platform
import requests
WINDOWS_PLATFORMS = ['win32', 'win64']
LINUX_PLATFORMS = ['linux', 'linux2']
def printos... | spacether/pycalculix | pycalculix/installer.py | Python | apache-2.0 | 17,336 |
import logging
from google.appengine.ext import webapp
from google.appengine.ext import db
from django.utils import simplejson as json
from couch.handlers import BaseHandler
from couch import models
from couch import errors
class _BaseHandler(BaseHandler):
''' Base Handler for Document APIs '''
def _database(s... | yssk22/gaecouch | couch/handlers/document.py | Python | apache-2.0 | 2,668 |
#!/usr/bin/python
# Copyright (C) 2009 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 agr... | rockyzhang/zhangyanhit-python-for-android-mips | python-build/build.py | Python | apache-2.0 | 6,956 |
from flask import render_template, request, jsonify
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
if request.accept_mimetypes.accept_json and \
not request.accept_mimetypes.accept_html:
response = jsonify({'error': 'not found'})
response.status_code = 404
... | Tuklab/tuklab101 | app/main/errors.py | Python | apache-2.0 | 484 |
###########################################################################
#
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/l... | google/starthinker | examples/dcm_run_example.py | Python | apache-2.0 | 3,107 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | usc-isi/nova | nova/api/ec2/cloud.py | Python | apache-2.0 | 69,515 |
#
# Parse tree nodes
#
from __future__ import absolute_import
import cython
cython.declare(sys=object, os=object, copy=object,
Builtin=object, error=object, warning=object, Naming=object, PyrexTypes=object,
py_object_type=object, ModuleScope=object, LocalScope=object, ClosureScope=obje... | JelleZijlstra/cython | Cython/Compiler/Nodes.py | Python | apache-2.0 | 357,409 |
import sys, os
sys.path.insert(1, "../../")
import h2o
import random
def download_all_logs(ip,port):
# Connect to h2o
h2o.init(ip,port)
# default
log_location = h2o.download_all_logs()
assert os.path.exists(log_location), "Expected h2o logs to be saved in {0}, but they weren't".format(log_location... | ChristosChristofidis/h2o-3 | h2o-py/tests/testdir_misc/pyunit_download_all_logs.py | Python | apache-2.0 | 1,104 |
from uuid import uuid4
from Firefly import logging, scheduler
from Firefly.components.virtual_devices import AUTHOR
from Firefly.const import (COMMAND_UPDATE, DEVICE_TYPE_THERMOSTAT, LEVEL)
from Firefly.helpers.action import Command
from Firefly.helpers.device.device import Device
from Firefly.helpers.metadata.metadat... | Firefly-Automation/Firefly | Firefly/components/nest/thermostat.py | Python | apache-2.0 | 7,969 |
import synapse.common as s_common
import synapse.lib.module as s_module
prioenums = (
(0, 'none'),
(10, 'lowest'),
(20, 'low'),
(30, 'medium'),
(40, 'high'),
(50, 'highest'),
)
statusenums = (
(0, 'new'),
(10, 'in validation'),
(20, 'in backlog'),
(30, 'in sprint'),
(40, '... | vertexproject/synapse | synapse/models/proj.py | Python | apache-2.0 | 6,668 |
# Copyright 2019 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | quantumlib/Cirq | dev_tools/import_test.py | Python | apache-2.0 | 8,158 |
import re
text = 'This is some text -- with punctuation.'
pattern = 'is'
print('Text :', text)
print('Pattern :', pattern)
m = re.search(pattern, text)
print('Search :', m)
s = re.fullmatch(pattern, text)
print('Full match :', s)
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_text/re_fullmatch.py | Python | apache-2.0 | 247 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name = 'relshell',
description = '''A framework to manage shell commands\' inputs/outputs as relational data.''',
long_description = open('README.rst').read(),
url = 'https://github.com/lays... | laysakura/relshell | setup.py | Python | apache-2.0 | 1,163 |
# Copyright 2013 Cloudbase Solutions Srl
# 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 r... | alexpilotti/compute-hyperv | hyperv/nova/migrationops.py | Python | apache-2.0 | 15,767 |
#!/usr/bin/env python
# coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import tensorflow as tf
import libs.configs.config_v1 as cfg
from . import utils as preprocess_utils
FLAGS = tf.app.flags.FLAGS
def preprocess_image(image, g... | wuzheng-sjtu/FastFPN | libs/preprocessings/city_v1.py | Python | apache-2.0 | 3,441 |
from flask import Flask
server = Flask(__name__)
server.config['SERVER_NAME'] = '127.0.0.1:5001'
from app import endpoints
| buckbaskin/Insight | service1/app/__init__.py | Python | apache-2.0 | 125 |
"""This component provides select entities for UniFi Protect."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import timedelta
from enum import Enum
import logging
from typing import Any, Final
from pyunifiprotect.data import (
Camera,
DoorbellMessageType,
IRLEDMode,
... | mezz64/home-assistant | homeassistant/components/unifiprotect/select.py | Python | apache-2.0 | 13,007 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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
#... | houshengbo/nova_vmware_compute_driver | nova/utils.py | Python | apache-2.0 | 39,324 |
#!/usr/bin/python
# Copyright (c) 2013 CORE Security Technologies
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# $Id: smbrelayx.py 772 2013-07-05 22:25:53Z bethus@gmail.com $
#
# SMB Relay Module
#
# A... | hecchi777/S3-SlaacSecuritySolution | impacket-0.9.11/examples/smbrelayx.py | Python | apache-2.0 | 29,341 |
# Lint as: python3
# Copyright 2020 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/licenses/LICENSE-2.0
#
# U... | deepmind/dm_alchemy | dm_alchemy/types/helpers.py | Python | apache-2.0 | 4,418 |
import unittest
from oslash import StringWriter, MonadWriter
from oslash.monadic import compose
class TestMonadMonadic(unittest.TestCase):
def test_monad_monadic_compose(self):
unit, tell = StringWriter.unit, MonadWriter.tell
def half(x):
return tell("I just halved %s!" % x).bind(la... | dbrattli/OSlash | tests/test_monad.py | Python | apache-2.0 | 519 |
from scrapy.utils.reqser import request_to_dict, request_from_dict
try:
import cPickle as pickle
except ImportError:
import pickle
class Base(object):
"""Per-spider queue/stack base class"""
def __init__(self, server, spider, key, exchange=None):
"""Initialize per-spider RabbitMQ queue.
... | openslack/openslack-crawler | crawler/schedulers/rabbitmq/queue.py | Python | apache-2.0 | 1,960 |
# Copyright 2020 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... | tensorflow/tensorboard | tensorboard/data/server/pip_package/build_test.py | Python | apache-2.0 | 2,101 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Tue Aug 3 15:36:52 2010
# by: The Resource Compiler for PySide (Qt v4.6.2)
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore
qt_resource_data = "\
\x00\x00\x03\x54\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x... | cherry-wb/SideTools | examples/mainwindows/application/application_rc.py | Python | apache-2.0 | 37,127 |
#m04405a12:02 class to provide Tk right click menu
#import rClickclass as rC
#then do something like u = rC.rClick(root, "Pmwdemo")
#before root.mainlooop()
#add ,name= 'lbb' to any listbox to avoid an error with paste on those
#later versions will detect and disable those menu items
#should be a way to create the men... | CLPeters/DeFFNetIzer | rClickclass.py | Python | apache-2.0 | 12,183 |
import datetime
import bleach
import re
months = {
1: "jan",
2: "feb",
3: "mars",
4: ["apr\u00edl", "apr"],
5: "ma\u00ed",
6: "j\u00fan\u00ed",
7: "j\u00fal\u00ed",
8: "\u00e1g\u00fast",
9: "sept",
10: "okt",
11: "n\u00f3v",
12: "des",
}
def decode_date_string(date_st... | multiplechoice/workplace | jobs/common.py | Python | apache-2.0 | 2,436 |
import numpy as np
import random
def_alpha = ' etaoinshrdlcumwfgypbvkjxqz'
from filter import filter
class Ciphertext(object):
def __init__(self, text_indices=np.zeros(0), map_record=0, alpha=def_alpha):
if np.all(map_record == 0):
map_record = np.arange(len(alpha))
self.map_record = ma... | paulsbrookes/subcipher | index_based/ciphertext.py | Python | apache-2.0 | 3,930 |
"""Webroot plugin."""
import errno
import logging
import os
from collections import defaultdict
import zope.interface
import six
from acme import challenges
from letsencrypt import errors
from letsencrypt import interfaces
from letsencrypt.plugins import common
logger = logging.getLogger(__name__)
@zope.interfac... | thanatos/lets-encrypt-preview | letsencrypt/plugins/webroot.py | Python | apache-2.0 | 6,187 |
"""
Django settings for Photo project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impo... | jebai0521/easy_thumbnail_sample | src/Photo/settings.py | Python | apache-2.0 | 2,259 |
# flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | huggingface/pytorch-transformers | src/transformers/models/fsmt/__init__.py | Python | apache-2.0 | 1,962 |
from .cmake import BUILD_SYSTEM_CMAKE, CMakeBuildSystem
from .common import (DEFAULT_TARGET, BuildError, BuildItem, BuildSystem, ConfigRule, config_rules_from_str,
setup_logging)
BUILD_SYSTEMS = {
BUILD_SYSTEM_CMAKE: CMakeBuildSystem,
}
__all__ = [
'BuildItem',
'BuildSystem',
'Bui... | espressif/esp-idf | tools/find_build_apps/__init__.py | Python | apache-2.0 | 493 |
import unittest
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
from sqlalchemy import create_engine
from mocksqlalchemy import ScopedSessionmakerMock
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class User(Base):
__tablename__ = 'users... | levisaya/mocksqlalchemy | mocksqlalchemy/test/test_scoped_session_mock.py | Python | apache-2.0 | 1,243 |
#!/usr/bin/env python
# vim:fileencoding=utf-8
# License: Apache 2.0 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
from __future__ import absolute_import, division, print_function, unicode_literals
unicode = type('')
cdata_list_attributes = None
universal_cdata_list_attributes = None
empty = ()
def init_b... | kovidgoyal/html5-parser | src/html5_parser/soup.py | Python | apache-2.0 | 4,216 |
import mock
class MockTest(mock.Mock):
def test_fun1(self, p1, p2):
pass
m = MockTest()
m.test_fun1(1, 2)
m.test_fun1.assert_called_with(1, 2) | peter-wangxu/python_play | test/mock_test/MockChild.py | Python | apache-2.0 | 160 |
# 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... | ZhangXinNan/tensorflow | tensorflow/contrib/optimizer_v2/rmsprop_test.py | Python | apache-2.0 | 18,899 |
#!/usr/bin/env python3
# Copyright Istio 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 agr... | istio/tools | perf/load/auto-mtls/scale.py | Python | apache-2.0 | 4,271 |
##############################################################################
# Copyright 2016-2019 Rigetti Computing
#
# 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... | rigetticomputing/pyquil | pyquil/device/_isa.py | Python | apache-2.0 | 10,897 |
""" Activation functions implemented in NumPy
"""
# Sebastian Raschka 2016-2017
#
# ann is a supporting package for the book
# "Introduction to Artificial Neural Networks and Deep Learning:
# A Practical Guide with Applications in Python"
#
# Author: Sebastian Raschka <sebastianraschka.com>
#
# License: MIT
import nu... | othersite/document | machinelearning/deep-learning-book/ann/np/activations.py | Python | apache-2.0 | 7,369 |
# Copyright 2017, OpenCensus Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | census-instrumentation/opencensus-python | contrib/opencensus-ext-mysql/opencensus/ext/mysql/trace.py | Python | apache-2.0 | 1,226 |
# 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, s... | google/pyctr | core/qual_names.py | Python | apache-2.0 | 8,100 |
#!/usr/bin/env python
from gnuradio import gr
from gnuradio import blocks
from gnuradio import digital
import numpy
#applies fftshift to a vecter.
#
class FFTshift(gr.basic_block):
#constructor
def __init__(self,size,drop_when_overloaded):
gr.basic_block.__init__(self, name="FFT_Shift",
in_sig=[(numpy.float32,s... | cityscapesc/specobs | main/tools/USRP_N200_UBX40_Filter_Testing/GRC/FFTshift.py | Python | apache-2.0 | 837 |
# 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 t... | wolverineav/horizon-bsn | horizon_bsn/bsndashboard/networktemplateassignment/panel.py | Python | apache-2.0 | 858 |
"""
Ceph Version
============
Combiner for Ceph Version information. It uses the results of
the ``CephVersion``, ``CephInsights`` and ``CephReport`` parsers.
The order from most preferred to least preferred is `CephVersion``, ``CephInsights``, ``CephReport``.
"""
from insights import combiner
from insights.parsers.c... | RedHatInsights/insights-core | insights/combiners/ceph_version.py | Python | apache-2.0 | 2,860 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | superstack/nova | nova/tests/test_api.py | Python | apache-2.0 | 17,953 |
from django.conf import settings
from django.core.mail import EmailMessage
from typing import Any, Mapping, Optional
from zerver.lib.actions import internal_send_message
from zerver.lib.send_email import FromAddress
from zerver.lib.redis_utils import get_redis_client
from zerver.models import get_system_bot
import t... | rishig/zulip | zerver/lib/feedback.py | Python | apache-2.0 | 2,665 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='pullstring-python',
version='1.0.1',
description='Python SDK to access the PullString Web API',
author='PullString',
author_email='support@pullstring.com',
url='https://github.com/pullstring/pullstring-python',
... | chenjic215/nickvoice | setup.py | Python | apache-2.0 | 347 |
from c3nav.editor.models.changedobject import ChangedObject # noqa
from c3nav.editor.models.changeset import ChangeSet # noqa
from c3nav.editor.models.changesetupdate import ChangeSetUpdate # noqa
| c3nav/c3nav | src/c3nav/editor/models/__init__.py | Python | apache-2.0 | 200 |
# -*- coding: utf-8 -*-
# Copyright 2014 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 require... | dimfeld/gsutil | gslib/tests/test_signurl.py | Python | apache-2.0 | 10,904 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import datetime
import itertools
import os
import subprocess
im... | hipnusleo/laserjet | resource/pypi/cryptography-1.7.1/tests/hazmat/backends/test_openssl.py | Python | apache-2.0 | 28,781 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #rlk moved this line to fall after the #! line
## yufei.luo@gustave.roussy 22/07/2013
## Copyright © 2014 CRS4 Srl. http://www.crs4.it/
## Modified by:
## Nicola Soranzo <nicola.soranzo@crs4.it>
"""
Runs BWA on single-end or paired-end data.
Produces a SAM file containing... | jhl667/galaxy_tools | tools/bwa/bwa_mem.py | Python | apache-2.0 | 12,929 |