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 2014 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | osrf/rqt_graphprofiler | src/rqt_graphprofiler/visualizer_plugin.py | Python | apache-2.0 | 5,480 |
#!/usr/bin/env python
# Author: Kelcey Jamison-Damage
# Python: 2.66 +
# OS: CentOS | Other
# Portable: True
# License: Apache 2.0
# License
#-----------------------------------------------------------------------#
# Copyright [2016] [Kelcey Jamison-Damage]
# Licensed under the Apache License, Version 2.0 ... | kelceydamage/learning | config/world/registry.py | Python | apache-2.0 | 1,169 |
#
# Copyright 2015 Red Hat. 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... | idegtiarov/gnocchi-rep | gnocchi/indexer/alembic/env.py | Python | apache-2.0 | 2,809 |
## 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
##
## https://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in ... | google-business-communications/bm-snippets-python | send-message-live-agent-request-suggestion.py | Python | apache-2.0 | 3,016 |
# 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 th... | bndl/bndl | bndl/util/tests/test_objects.py | Python | apache-2.0 | 1,955 |
__source__ = 'https://leetcode.com/problems/word-ladder-ii/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/word-ladder-ii.py
# Time: O(n * d), n is length of string, d is size of dictionary
# Space: O(d)
# Back_Track + BFS
#
# Description: Leetcode # 126. Word Ladder II
#
# Given two words (sta... | JulyKikuAkita/PythonPrac | cs15211/WordLadderII.py | Python | apache-2.0 | 14,710 |
from django.conf import settings
from django.contrib.admin import site, ModelAdmin
from site_content.settings import RTE_CONFIG_URI
from site_slider.models import Slider, SliderSlide
class SliderAdmin(ModelAdmin):
list_display = ('label', 'code', 'css_class')
list_editable = ('code', 'css_class')
site.regi... | wlashell/lyrical_page | site_slider/admin.py | Python | apache-2.0 | 886 |
from __future__ import division
import numpy as np
try:
import cPickle as pickle
except:
import pickle #--- To handle data export
import imgPage
import sys, argparse #--- To handle console arguments
def main():
parser = argparse.ArgumentParser(description='Page Layout Extraction')
parser.add_argume... | lquirosd/TFM | ILA/code/struct_sentByrow.py | Python | apache-2.0 | 2,659 |
#
#
# Copyright 2015 Marco Bartolini, bartolini@ira.inaf.it
#
# 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... | discos/discos-backend | test/run_server.py | Python | apache-2.0 | 967 |
from typing import Any, Dict, List, Optional
from django.http import HttpRequest
from django.conf import settings
from zerver.models import UserProfile, get_realm, Realm
from zproject.backends import (
any_oauth_backend_enabled,
password_auth_enabled,
require_email_format_usernames,
auth_enabled_helpe... | dhcrzf/zulip | zerver/context_processors.py | Python | apache-2.0 | 6,478 |
# Copyright 2017 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... | meteorcloudy/tensorflow | tensorflow/compiler/tests/fused_batchnorm_test.py | Python | apache-2.0 | 12,531 |
from django.apps import AppConfig
class TypesOfPaymentConfig(AppConfig):
name = 'types_of_payment'
| jojoriveraa/titulacion-NFCOW | NFCow/types_of_payment/apps.py | Python | apache-2.0 | 105 |
# Copyright (c) 2010-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 agree... | sarvesh-ranjan/swift | swift/common/db.py | Python | apache-2.0 | 32,509 |
# Copyright 2011 Nicholas Bray
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | ncbray/pystream | bin/tests/full/makelists.py | Python | apache-2.0 | 982 |
import copy
#import six
from eclcli.common import command
from eclcli.common import utils
#from ..dhclient import exceptions
#from ..dhclient import utils
class ListServer(command.Lister):
def get_parser(self, prog_name):
parser = super(ListServer, self).get_parser(prog_name)
parser.add_argum... | anythingrandom/eclcli | eclcli/dh/v2/server.py | Python | apache-2.0 | 6,761 |
# 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/v1_component_status_list.py | Python | apache-2.0 | 7,014 |
# python3
# 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... | GoogleCloudPlatform/solutions-cloud-orchestrate | cli/src/orchestrate/utils.py | Python | apache-2.0 | 3,524 |
import pytz
import json
from django.core.exceptions import ValidationError
from rest_framework import serializers as ser
from rest_framework import exceptions
from api.base.exceptions import Conflict
from api.base.utils import absolute_reverse, get_user_auth
from website.project.metadata.utils import is_prereg_admin_... | sloria/osf.io | api/registrations/serializers.py | Python | apache-2.0 | 17,984 |
# Copyright (c) 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 ... | dims/nova | nova/conf/conductor.py | Python | apache-2.0 | 1,828 |
"""
Django settings for perpustakaan project.
Generated by 'django-admin startproject' using Django 1.9.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import ... | akbarpn136/perpus-dj | perpustakaan/settings.py | Python | apache-2.0 | 3,676 |
#!/usr/bin/env python
from __future__ import print_function
description = """
Upload binary data to Midas.
Since every local Git repository contains a copy of the entire project history,
it is important to avoid adding large binary files directly to the repository.
Large binary files added and removed through the hi... | hendradarwin/SimpleITK | Utilities/UploadBinaryData.py | Python | apache-2.0 | 7,528 |
import pexpect
import getpass
version = raw_input('Version: ')
secret = getpass.getpass('Enter Passphrase: ')
github_username = 'ianjuma'
clean = pexpect.spawn('fab clean')
clean.expect('Passphrase for private key: ')
clean.sendline(secret)
deploy = pexpect.spawn('fab deploy:%s' % (version,))
deploy.expect('Passphra... | ianjuma/errand-runner | automata.py | Python | apache-2.0 | 538 |
# Copyright 2019 DeepMind Technologies 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 ag... | deepmind/mathematics_dataset | setup.py | Python | apache-2.0 | 2,458 |
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
from django.contrib import admin
# Create your models here.
class Faculty(models.Model):
user = models.OneToOneField(User)
class Meta:
verbose_name_plural = 'Faculties'
def __str__(s... | pankajlal/prabandh | users/models.py | Python | apache-2.0 | 1,093 |
# 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/envs/__init__.py | Python | apache-2.0 | 4,030 |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | huggingface/pytorch-transformers | tests/test_modeling_speech_to_text.py | Python | apache-2.0 | 32,528 |
# coding: utf-8
#
# Copyright 2018 The Oppia 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 requi... | prasanna08/oppia | core/domain/activity_domain_test.py | Python | apache-2.0 | 4,280 |
# Copyright (c) 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 ... | mikalstill/nova | nova/tests/unit/scheduler/test_host_manager.py | Python | apache-2.0 | 69,879 |
# -*- 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-bigquery-connection | samples/generated_samples/bigqueryconnection_v1_generated_connection_service_get_iam_policy_sync.py | Python | apache-2.0 | 1,526 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
:samp:`Publish resources under the ResourceSync Framework`
The class :class:`ResourceSync` is the main entrance to the rspub-core library. It is in essence a one-method
class, its main method: :func:`~ResourceSync.execute`. This method takes as argument ``filenames``... | cegesoma/rspub-core | rspub/core/rs.py | Python | apache-2.0 | 11,380 |
# 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... | UTSA-ICS/keystone-kerberos | keystone/auth/controllers.py | Python | apache-2.0 | 27,222 |
# Copyright 2018,2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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
#... | sony/nnabla | python/src/nnabla/experimental/graph_converters/identity.py | Python | apache-2.0 | 2,494 |
from sklearn.base import TransformerMixin
import pandas as pd
from time import time
class StaticTransformer(TransformerMixin):
def __init__(self, case_id_col, cat_cols, num_cols, fillna=True):
self.case_id_col = case_id_col
self.cat_cols = cat_cols
self.num_cols = num_cols
self... | irhete/predictive-monitoring-benchmark | transformers/StaticTransformer.py | Python | apache-2.0 | 1,584 |
import os
import unittest
import itk
import vtk
import qt
import ctk
import slicer
from slicer.ScriptedLoadableModule import *
import logging
class LabelMapToModel(ScriptedLoadableModule):
"""Uses ScriptedLoadableModule base class, available at:
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer... | KitwareMedical/AugmentedLabelRegistration | LabelMapToModel/LabelMapToModel.py | Python | apache-2.0 | 8,658 |
#!/usr/bin/python
import sys, os
sys.path.append('..')
import json
import ConfigParser, string
from common import tool
def LoadClusterType():
global cluster_type
global role_type
f = open('cluster_type.json')
jstr = f.read()
js = json.loads(jstr)
cluster_type = {}
role_type = {}
for k, v in js.items():
na... | codemeow5/deployment | web2/config.py | Python | apache-2.0 | 2,882 |
import mock
import pytest
import unittest
from datetime import datetime
from cloudify.models_states import VisibilityState, ExecutionState
from cloudify_rest_client.exceptions import (
CloudifyClientError,
IllegalExecutionParametersError,
)
from manager_rest.manager_exceptions import SQLStorageException, Con... | cloudify-cosmo/cloudify-manager | rest-service/manager_rest/test/endpoints/test_deployment_groups.py | Python | apache-2.0 | 58,027 |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 21 09:55:46 2017
@author: slim
"""
import matplotlib.pyplot as pl
import numpy as np
import TracyWidom as TW
import math
from multiprocessing import Pool
p = Pool(4)
c=[]
cx=[]
s343=[(i,j) for i in range(45,51)+range(52,66)+range(68,79)+range(81,88) for... | kammmoun/PFE | codes/A380.py | Python | apache-2.0 | 2,200 |
# /*******************************************************
# *
# * Copyright (C) 2015-2016 Kyriakos Naziris <kyriakos@naziris.co.uk>
# * This is a thesis project of University of Portsmouth.
# *
# * This file is part of HomeSecPi.
# *
# * Feel free to use and modify the source code as long as
# * as you give ... | naziris/HomeSecPi | functions.py | Python | apache-2.0 | 17,039 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from util import ctx2version, ctx2options
def build(ctx,image):
ctx.run("docker build -t {network}/{image}:{version} {image}".format(network=ctx.network,image=image,version=ctx2version(ctx,image)))
def run(ctx,image):
network=ctx.network
versi... | PixelDragon/pixeldragon | docker.py | Python | apache-2.0 | 2,539 |
# -*- 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, software
... | plypaul/airflow | airflow/contrib/hooks/bigquery_hook.py | Python | apache-2.0 | 34,940 |
import json
from pathlib import Path
from typing import Optional, List, Dict, Text, Type
import tensorflow as tf
import numpy as np
import pytest
from _pytest.monkeypatch import MonkeyPatch
from _pytest.logging import LogCaptureFixture
import logging
from rasa.core.featurizers.single_state_featurizer import (
Inte... | RasaHQ/rasa_nlu | tests/core/policies/test_unexpected_intent_policy.py | Python | apache-2.0 | 43,992 |
from flask import Blueprint
blueprint = Blueprint('home', __name__)
from . import errors
from . import views
| shuhari/yuhao.space | src/app/blueprints/home/__init__.py | Python | apache-2.0 | 113 |
# The Admin4 Project
# (c) 2013-2014 Andreas Pflug
#
# Licensed under the Apache License,
# see LICENSE.TXT for conditions of usage
from _objects import DatabaseObject
from _pgsql import pgQuery
from wh import xlt
class Schema(DatabaseObject):
typename=xlt("Schema")
shortname=xlt("Schema")
refreshOid="nsp.oi... | andreas-p/admin4 | modPg/Schema.py | Python | apache-2.0 | 1,423 |
#!/usr/bin/env python3
# -*- coding: utf8 -*-
import argparse
import sys
import code
import re
import os
import functools
from ansicolor import blue, red, black, green
from multiprocessing import cpu_count
from YakDB.Dump import dumpYDF, importYDFDump
import YakDB
def checkConnection(args):
import YakDB
#Chec... | ulikoehler/Translatron | Translatron/CLI.py | Python | apache-2.0 | 14,998 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright 2012 Joe Harris
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
... | meeb/txcloudfiles | examples/cdn_container_error.py | Python | apache-2.0 | 2,457 |
import setuptools
setuptools.setup(
name = "opencontrail-netns",
version = "0.2",
packages = setuptools.find_packages(),
entry_points = {
'console_scripts': [
'netns-daemon-start = opencontrail_netns.daemon_start:daemon_start',
'netns-daemon-stop = opencontrail_netns.da... | DreamLab/opencontrail-netns | setup.py | Python | apache-2.0 | 366 |
#!/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
"License");... | radicalbit/ambari | ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/params_linux.py | Python | apache-2.0 | 19,215 |
import os, sys, subprocess
def envIsInstalled():
currentPath = os.path.dirname(os.path.abspath(__file__))
if os.path.isdir(os.path.join(currentPath,"..","..", "miniconda2")):
return True
return False
def envInstall():
currentPath = os.path.dirname(os.path.abspath(__file__))
dir_install = o... | PrinceNgattaiLam/Trafic | TraficLib/envInstallTF.py | Python | apache-2.0 | 1,188 |
# config.py
host = "10.222.138.163"
port = 8080
mport = 1889 | miaolujing/python_script | hawkeye_autotest/rtp/config.py | Python | apache-2.0 | 60 |
# Copyright 2011 the Melange 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 wr... | rhyolight/nupic.son | app/soc/modules/gsoc/logic/accept_proposals.py | Python | apache-2.0 | 1,256 |
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
# Import MNIST data
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("./data/", one_hot=True)
# Parameters
learning_rate = 0.1
training_epochs = 100
batch_size = 256
display_step = 1
examples_to_show... | AhmedHani/FCIS-Machine-Learning-2017 | Session6/Practical/Template/mnist_autoencoder.py | Python | apache-2.0 | 2,278 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-pubsublite | google/cloud/pubsublite_v1/services/partition_assignment_service/__init__.py | Python | apache-2.0 | 817 |
# 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 | lego/lego/data_process/dataloader.py | Python | apache-2.0 | 33,137 |
#
# =============================================================================
# PYTHON SCRIPT FOR PLOTTING AREA RATIO v MN CHART
# creates figure 6
# =============================================================================
import pylab
import numpy
import scipy
# valid color names
# http://w3schools.com/ht... | jcchin/Hyperloop | src/hyperloop/plot/size_plot.py | Python | apache-2.0 | 2,035 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Shows how to use AWS Identity and Access Management (IAM) policies.
"""
# snippet-start:[python.example_code.iam.policy_wrapper.imports]
import json
import logging
import operator
import pprint
impo... | awsdocs/aws-doc-sdk-examples | python/example_code/iam/iam_basics/policy_wrapper.py | Python | apache-2.0 | 10,603 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016, Giacomo Cariello. 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
#
# Un... | dockeroo/dockeroo | dockeroo/docker_machine/__init__.py | Python | apache-2.0 | 8,456 |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
from collections import deque
class Solution:
def maxDepth(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if not ... | sonymoon/algorithm | src/main/python/leetcode-python/easy/maxDepth.py | Python | apache-2.0 | 2,753 |
import logging
from flask import render_template, request, redirect, url_for, flash
from flask_login import login_required
from flask_wtf import Form
from wtforms import SelectField
from kconfig import chaptersBookByName, chaptersBook
from kconfig import enablersBookByName
from kernel.Backlog import BacklogFactory, Loc... | flopezag/fiware-backlog | app/chapters/views.py | Python | apache-2.0 | 5,537 |
from shared import create_dummy_data as ccd
from semisupervised.depLabelPropagation import label_propagation
from pyspark.sql import functions as F
from shared.Plot2DGraphs import plot3D
def double_helix(sc, example, label):
spark_double_helix = ccd.create_spark_data(
sc, func=ccd.create_double_helix,
... | mssalvador/WorkflowCleaning | examples/SemisupervisedDoubleHelix.py | Python | apache-2.0 | 1,101 |
# coding: utf-8
#
# Copyright 2017 The Oppia 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 requi... | shaz13/oppia | core/domain/classifier_services_test.py | Python | apache-2.0 | 13,186 |
# 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... | mtagle/airflow | tests/providers/apache/livy/operators/test_livy.py | Python | apache-2.0 | 4,778 |
# Copyright 2018 The Batfish Open Source 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
#
# Unless required by applicab... | batfish/pybatfish | tests/datamodel/test_datamodel_element.py | Python | apache-2.0 | 1,608 |
#!/usr/bin/env python
DOCUMENTATION = '''
---
module: eapi_vlan
short_description: VLAN Commands for Arista, via eapi
'''
EXAMPLES = '''
- name: configures the vlan name
eapi_vlan: vlanid=1 name=TEST_VLAN_1
'''
from ansible.module_utils.basic import AnsibleModule
import pyeapi, sys, argparse
def valid_id(i):
##... | jrogers512/pynet | class7/library/eapi_vlan.py | Python | apache-2.0 | 3,062 |
#!/usr/bin/python
# -*- coding:utf-8 -*-
# ---------------------------
# Author: deangao
# Copyright: 2016 deangao
# Version: v1.0.0
# Created: 2016/3/16
# ---------------------------
import numpy as np
import pprint as pp
import matplotlib.pyplot as plt
"""
matplotlib是Python中一个基础的绘图模块,是其它高级绘图模块的基础。
matplotlib 官方网站... | iwhgao/python_practise | 13.matplotlib.py | Python | apache-2.0 | 2,097 |
# 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 th... | hammerlab/isovar | isovar/reference_context_helpers.py | Python | apache-2.0 | 3,404 |
while True:
s = raw_input('Enter something:')
if s == 'quit':
break
if len(s) < 3:
continue
print 'Input is of sufficient length'
| xingchaoma/github-python-study | byteofpython/ch08_modules/continue.py | Python | apache-2.0 | 162 |
#!/usr/bin/env python
# Copyright 2019 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... | GoogleCloudPlatform/ml-on-gcp | tutorials/tensorflow/mlflow_gcp/setup.py | Python | apache-2.0 | 1,062 |
from __future__ import absolute_import, print_function
import yaml
from datetime import datetime
from mock import Mock, patch
from uuid import uuid4
from changes.config import db
from changes.listeners.build_revision import revision_created_handler, CommitTrigger
from changes.models.build import Build
from changes.m... | dropbox/changes | tests/changes/listeners/test_build_revision.py | Python | apache-2.0 | 9,840 |
# -*- coding: utf-8 -*-
"""
Time-boxed development planning functions.
---
type:
python_module
validation_level:
v00_minimum
protection:
k00_public
copyright:
"Copyright 2016 High Integrity Artificial Intelligence Systems"
license:
"Licensed under the Apache License, Version 2.0 (the License);
... | wtpayne/hiai | a3_src/h70_internal/da/timebox.py | Python | apache-2.0 | 5,647 |
"""Support for WeMo device discovery."""
import logging
import requests
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.discovery import SERVICE_WEMO
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers import discovery
from homeassistan... | Cinntax/home-assistant | homeassistant/components/wemo/__init__.py | Python | apache-2.0 | 5,830 |
#!/usrbin/python
#encoding:utf-8
'''
Author: wangxu
Email: wangxu@oneniceapp.com
任务更新
'''
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import logging
import tornado.web
import json
import os
import time
import datetime
import traceback
CURRENTPATH = os.path.dirname(os.path.abspath(__file__))
sys.path.ap... | cocofree/azkaban_assistant | schedule/webapp/handler/job_api.py | Python | apache-2.0 | 4,930 |
"""Config flow to configure the Synology DSM integration."""
import logging
from urllib.parse import urlparse
from synology_dsm import SynologyDSM
from synology_dsm.exceptions import (
SynologyDSMException,
SynologyDSMLogin2SAFailedException,
SynologyDSMLogin2SARequiredException,
SynologyDSMLoginInvali... | partofthething/home-assistant | homeassistant/components/synology_dsm/config_flow.py | Python | apache-2.0 | 9,882 |
#!/usr/bin/env python
from getpass import getpass
from pprint import pprint as pp
from napalm_base import get_network_driver
host = 'nxos1.twb-tech.com'
username = 'pyclass'
password = getpass()
optional_args = {}
optional_args['nxos_protocol'] = 'https'
optional_args['port'] = 8443
driver = get_network_driver('nxos'... | ktbyers/pynet-ons-nov16 | napalm_example/test_nxos_cfg.py | Python | apache-2.0 | 990 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Image.order'
db.add_column(u'catalog_image', 'order',
... | Makeystreet/makeystreet | woot/apps/catalog/migrations/0074_auto__add_field_image_order.py | Python | apache-2.0 | 41,311 |
# Copyright 2016 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 applicable law or agreed to in writing... | ragupta-git/ImcSdk | imcsdk/apis/server/bios.py | Python | apache-2.0 | 13,690 |
# Copyright 2013 - Mirantis, Inc.
# Copyright 2015 - StackStorm, Inc.
# Copyright 2015 Huawei Technologies Co., Ltd.
# Copyright 2016 - Brocade Communications Systems, Inc.
# Copyright 2018 - Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file exc... | StackStorm/mistral | mistral/tests/unit/api/v2/test_executions.py | Python | apache-2.0 | 30,260 |
# -*- coding: utf-8 -*-
import os
from nose.tools import with_setup, eq_ as eq, ok_ as ok
from common import vim, cleanup
cid = vim.channel_id
def host_setup():
cleanup()
# Spawn the python host
vim.command(
'let pyhost_id = ' +
'rpcstart("python", ["-c", "import neovim; neovim.start_host... | fwalch/python-client | test/test_script_host.py | Python | apache-2.0 | 2,487 |
import bottle
from bottle import route, run, request, abort, debug, template , static_file
import MySQLdb as mdb
@route('/packets', method='GET')
def packets_list():
print "list all received packets and their protocols"
dbcon = mdb.connect("localhost","testuser","test123","attackdb" )
cursor = dbcon.curs... | Rashminadig/SDN | ryu/Gui/home.py | Python | apache-2.0 | 4,669 |
# Copyright 2009 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 ... | rogers0/namebench | namebench/client/reporter.py | Python | apache-2.0 | 16,903 |
#!/usr/bin/env python3
# Copyright 2020 The Pigweed 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | google/pigweed | pw_presubmit/py/pw_presubmit/pigweed_presubmit.py | Python | apache-2.0 | 29,379 |
#!/usr/bin/env python
'''
This script parses a JSON file output by Karma which contains mentions
and converts these to features and outputs a single FC chunk file.
Its architecture is that of a mini pipeline: define global functions
prefixed with ``trans_`` and run them using the ``--transform`` command
line option.
... | usc-isi-i2/dig-features | extract-mentions-features.py | Python | apache-2.0 | 4,132 |
#!/usr/bin/env python
# encoding: utf-8
"""
valid_parentheses.py
Created by Shengwei on 2014-07-24.
"""
# https://oj.leetcode.com/problems/valid-parentheses/
# tags: easy, array, parentheses, stack
"""
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is val... | CodingVault/LeetCodeInPython | valid_parentheses.py | Python | apache-2.0 | 909 |
#!/usr/bin/env python3
#
# Copyright (c) 2016-2017 Nest Labs, 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/lic... | openweave/openweave-core | src/test-apps/happy/tests/service/wdmNext/test_weave_wdm_next_service_mutual_subscribe_12.py | Python | apache-2.0 | 2,976 |
# 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... | ucloud/uai-sdk | examples/tensorflow/train/slim/train/code/datasets/download_and_convert_fer.py | Python | apache-2.0 | 4,480 |
# 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/audio-to-tactile | extras/python/psycho/sleeve_usb.py | Python | apache-2.0 | 4,262 |
from collections import defaultdict
import itertools
from horizon import exceptions
from horizon.utils.memoized import memoized
from openstack_dashboard.api import nova, cinder, network
from openstack_dashboard.api.base import is_service_enabled, QuotaSet
class QuotaUsage(dict):
""" Tracks quota limit, used, an... | 99cloud/keystone_register | openstack_dashboard/usage/quotas.py | Python | apache-2.0 | 4,420 |
#!/usr/bin/env python
from os.path import join, dirname
from cloudify import ctx
ctx.download_resource(
join('components', 'utils.py'),
join(dirname(__file__), 'utils.py'))
import utils # NOQA
def remove():
ctx.logger.info('Removing Cloudify CLI...')
utils.yum_remove('cloudify')
ctx.logger.inf... | cloudify-cosmo/cloudify-manager-blueprints | components/cli/scripts/delete.py | Python | apache-2.0 | 372 |
#!/usr/bin/python
#
# 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 required b... | dietrichc/streamline-ppc-reports | examples/adwords/v201406/advanced_operations/add_ad_customizer.py | Python | apache-2.0 | 8,087 |
import openface
import numpy as np
import os
import cv2
import pickle
from pymongo import MongoClient
import time
id_name = ["Alec", "Emil", "Greg", "Phong", "Thinh"]
def push_to_db(person_id):
client = MongoClient('mongodb://localhost:27017')
db = client['ta_sas']
# Get the userId for the classifyId
... | xphongvn/smart-attendance-system-ta | src/backend/live_classify_local_camera_connect_mongodb.py | Python | apache-2.0 | 3,578 |
async def application(scope, receive, send):
assert scope['type'] == 'http'
await send(
{
'type': 'http.response.start',
'status': 200,
'headers': [
(b'content-length', b'0'),
(b'server-port', str(scope['server'][1]).encode()),
... | nginx/unit | test/python/server_port/asgi.py | Python | apache-2.0 | 344 |
#gradient descent for training a linear unit
import numpy as np
import matplotlib.pyplot as plt
import csv
def main():
x = [[0.,0.],[0.,1.],[1.,0.],[1.,1.]]
d = [0.,1.,1.,1.]
w = [np.random.uniform(0.,1.),np.random.uniform(0.,1.)]
alfa = 0.1
w_old = []
G_E = []
while True:
E = 0.
print('start'+str(w))... | xSakix/etf_expert | py_code/neural/nn_untreasholded_grad_descent_stochastic.py | Python | apache-2.0 | 853 |
__source__ = 'https://leetcode.com/problems/longest-line-of-consecutive-one-in-matrix/'
# Time: O(m*n*4)
# Space: O(m*n*4)
#
# Description: 562. Longest Line of Consecutive One in Matrix
#
# Given a 01 matrix M, find the longest line of consecutive one in the matrix.
# The line could be horizontal, vertical, diagonal ... | JulyKikuAkita/PythonPrac | cs15211/LongestLineOfConsecutiveOneInMatrix.py | Python | apache-2.0 | 2,908 |
from appfd.models import Basemap, Feature, Order, Place, Test
from drf_queryfields import QueryFieldsMixin
from rest_framework.serializers import HiddenField, IntegerField, NullBooleanField, CharField, ChoiceField, URLField
from rest_framework.serializers import HyperlinkedModelSerializer, ModelSerializer, Serializer, ... | FirstDraftGIS/firstdraft | projfd/apifd/serializers.py | Python | apache-2.0 | 3,304 |
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googlefonts/nanoemoji | src/nanoemoji/pngquant.py | Python | apache-2.0 | 2,064 |
"""
Support for IP Cameras.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/camera.generic/
"""
import asyncio
import logging
import aiohttp
import async_timeout
import requests
from requests.auth import HTTPDigestAuth
import voluptuous as vol
from home... | persandstrom/home-assistant | homeassistant/components/camera/generic.py | Python | apache-2.0 | 5,462 |
# 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-research/ssl_detection | detection/dataset/cls_mapping_coco_voc.py | Python | apache-2.0 | 3,471 |
"""
Pipeline subroutines
"""
| SKA-ScienceDataProcessor/FastImaging-Python | src/fastimgproto/pipeline/__init__.py | Python | apache-2.0 | 29 |
# 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.python.subsystems.pex_build_util import identify_missing_init_files
fr... | twitter/pants | src/python/pants/backend/python/rules/inject_init.py | Python | apache-2.0 | 1,906 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# IkaLog
# ======
# Copyright (C) 2015 Takeshi HASEGAWA
#
# 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/l... | hrhtspr/IkaLog | ikalog/outputs/statink.py | Python | apache-2.0 | 30,510 |
class Quantifier(object):
def __init__(self):
self.behaviour = {}
self.latest_observation = None
self.latest_behaviour = None
def add(self, observation, behaviour):
self.behaviour[observation] = behaviour
self.latest_observation = observation
self.latest_behaviou... | sergiuionescu/gym-agents | agents/Quantifier.py | Python | apache-2.0 | 1,080 |