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 sys
from ast import literal_eval
import tensorflow as tf
import numpy as np
from grpc.beta import implementations
# reference local copy of Tensorflow Serving API Files
sys.path.append(os.path.join(os.getcwd(), os.pardir, os.pardir, 'ext_libs'))
import lib.predict_pb2 as predict_pb2
import lib.predi... | 5agado/recurrent-neural-networks-intro | src/model/servingClient.py | Python | apache-2.0 | 2,662 |
# 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... | brk3/ekko | tests/test_noop.py | Python | apache-2.0 | 753 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-08 15:45
from __future__ import unicode_literals
from django.db import migrations
import share.robot
class Migration(migrations.Migration):
dependencies = [
('share', '0001_initial'),
('djcelery', '0001_initial'),
]
operatio... | zamattiac/SHARE | providers/org/sldr/migrations/0001_initial.py | Python | apache-2.0 | 649 |
# Copyright 2015 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... | MehdiSfr/tensor-flow | tensorflow/g3doc/how_tos/reading_data/fully_connected_preloaded.py | Python | apache-2.0 | 5,244 |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... | Willem23/mbed | workspace_tools/export/__init__.py | Python | apache-2.0 | 4,602 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-03-28 19:36
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_n... | lyubomir1993/AlohaServer | api/migrations/0002_auto_20170328_1936.py | Python | apache-2.0 | 448 |
#!/usr/bin/env python
import sys
import glob
import hdfs3
from hdfs3 import HDFileSystem
hdfs_nn = '192.168.33.10'
hdfs = HDFileSystem(host=hdfs_nn, port=8020)
class TransparentFileSystem:
def __init__(self):
self.hdfs_flag = False
return
def set_hdfs_flag(self, flag=True):
self.hd... | hirolovesbeer/tfs | tfs.py | Python | apache-2.0 | 1,111 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | tuskar/tuskar-ui | openstack_dashboard/dashboards/admin/info/tests.py | Python | apache-2.0 | 3,281 |
__author__ = 'olga.ostapenko'
import pytest
from fixture.application import Application
@pytest.fixture(scope="session")
def app(request):
fixture = Application()
request.addfinalizer(fixture.destroy)
return fixture | oostapenko84/python_training | conftest.py | Python | apache-2.0 | 230 |
import csv
import rdflib
from rdflib.namespace import RDFS, RDF, OWL
from rdflib.term import URIRef
import threading
from apimarkdown import Markdown
from apirdflib import RDFLIBLOCK
import logging
logging.basicConfig(level=logging.INFO) # dev_appserver.py --log_level debug .
log = logging.getLogger(__name__)
class ... | unor/schemaorg | sdordf2csv.py | Python | apache-2.0 | 11,152 |
'''
Created on August 21, 2017
This file is subject to the terms and conditions defined in the
file 'LICENSE.txt', which is part of this source code package.
@author: David Moss
'''
from devices.light.light import LightDevice
class LevitonDecoraLightswitchDevice(LightDevice):
"""Leviton Decora in-wall switch l... | peoplepower/botengine | com.ppc.Bot/devices/light/lightswitch_leviton_decora.py | Python | apache-2.0 | 4,740 |
import unittest, sys
sys.path.extend(['.','..','../..','py'])
import os
import h2o2 as h2o
import h2o_cmd, h2o_import as h2i, h2o_browse as h2b
from h2o_test import find_file, dump_json, verboseprint
expectedZeros = [0 for i in range(11)]
CAUSE_FAIL = False
def assertEqualMsg(a, b): assert a == b, "%s %s" % (a, b)
... | bikash/h2o-dev | py2/testdir_single_jvm/test_parse_nfs.py | Python | apache-2.0 | 2,673 |
import requests
import json
DOCKER_HUB = "https://hub.docker.com"
FILE_SAVE_TAGS="officials_images_tags.json"
FILE_SAVE="officials_images.json"
def pull_officials():
payload = {'page': 1, 'page_size': 100}
count = 0
try:
res = requests.get(DOCKER_HUB+"/v2/repositories/library",params=payload)
... | di-unipi-socc/DockerFinder | storage/crawl_officials.py | Python | apache-2.0 | 3,338 |
import unittest
import ray
from ray.rllib.agents.a3c import A2CTrainer
from ray.rllib.execution.common import STEPS_SAMPLED_COUNTER, \
STEPS_TRAINED_COUNTER
from ray.rllib.utils.test_utils import framework_iterator
class TestDistributedExecution(unittest.TestCase):
"""General tests for the distributed execut... | pcmoritz/ray-1 | rllib/tests/test_exec_api.py | Python | apache-2.0 | 2,301 |
# -*- coding: utf-8 -*-
# Copyright 2012-2013 UNED
#
# 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... | OpenMOOC/moocng | moocng/courses/urls.py | Python | apache-2.0 | 2,701 |
# Copyright (c) 2012 NetApp, Inc. All rights reserved.
# Copyright (c) 2014 Navneet Singh. All rights reserved.
# Copyright (c) 2014 Glenn Gobeli. All rights reserved.
# Copyright (c) 2014 Clinton Knight. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not us... | julianwang/cinder | cinder/volume/drivers/netapp/dataontap/client/api.py | Python | apache-2.0 | 21,951 |
import re
import json
import requests
from flask import request
from constants import MOBIL_ITU_AUTH_URL
from middlewares import auth_func
from server import app
from models.setupdb import lecturers
@app.route('/api/lecturers', methods=['GET', 'POST', 'DELETE', 'PUT'])
def lecturer():
"""
GET request sho... | ITU-DB-MANAGEMENT-HM/itunder-backend-rest | controllers/lecturers.py | Python | apache-2.0 | 2,001 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | iwm911/plaso | plaso/analysis/browser_search.py | Python | apache-2.0 | 6,727 |
import argparse
import os
import struct
import tqdm
from program_synthesis.karel.tools import indexed_file
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--input', required=True)
parser.add_argument('--num-pieces', required=True, type=int)
args = parser.parse_args... | nearai/program_synthesis | program_synthesis/karel/scripts/split_indexed.py | Python | apache-2.0 | 1,949 |
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from django.urls import reverse
from django.utils.encoding import python_2_unicode_compatible
from extras.models import CustomFieldModel, CustomFieldValue
from utilities.models import CreatedUpdatedModel
from utilities.utils im... | Alphalink/netbox | netbox/tenancy/models.py | Python | apache-2.0 | 1,852 |
import FBBot
fb_client = FBBot.FBBotClient()
class WebhookView(FBBot.FBBotWebhookView):
def handle_message(self, message, sender_id):
if message == "logo":
fb_client.send_image(sender_id, "https://d2for33x7as0fp.cloudfront.net/static/images/53-logo.71a393299d20.png")
else:
... | GhalebKhaled/fb-bot-test | bot/api/views.py | Python | apache-2.0 | 406 |
# Copyright 2017 The Forseti Security 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 ap... | forseti-security/forseti-security | google/cloud/forseti/services/model/modeller.py | Python | apache-2.0 | 3,684 |
# -*- 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-data-qna | samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_create_question_sync.py | Python | apache-2.0 | 1,661 |
# Copyright (C) 2014 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | googleglass/mirror-catfacts-python | push/handler.py | Python | apache-2.0 | 3,418 |
#!/usr/bin/env python
from mongoengine import connect
from flask import Flask
from api import blueprint as api
app = Flask(__name__)
app.register_blueprint(api)
connect('przepisnik001')
if __name__ == '__main__':
app.run(debug=True)
| piedev/przepisnik | przepisnik/app.py | Python | apache-2.0 | 242 |
import os
import time
import ping
import threading
import ConfigParser
import paho.mqtt.client as mqtt
class Pinger(threading.Thread):
def _readConfig(self):
update = False
if not os.path.isdir(self._homeDir):
print "Creating homeDir"
os.makedirs(self._homeDir)
i... | AnsgarSchmidt/sensomatic | server/Pinger.py | Python | apache-2.0 | 2,983 |
from dataingestion.initial_input import InitialInput
from const.constants import Constants
from dataingestion.preprocessing import preprocess_basic
from dataingestion.window import get_windows
from dataingestion.cache_control import *
from analysis.preparation import permutate
from analysis.preparation import split_tes... | joergsimon/gesture-analysis | main.py | Python | apache-2.0 | 1,322 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf8')
#sys.path.append("/home/pi/oprint/lib/python2.7/site-packages/tornado-4.0.1-py2.7-linux-armv7l.egg/")
#sys.path.append("/home/pi/oprint/lib/python2.7/site-packages/backports.ssl_match_hostname-3.4.0.2-py2.7.egg/")
imp... | mohou/Mohou_Box-master | boxUpdate/boxUpdate.py | Python | apache-2.0 | 19,795 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation.
# Copyright 2012, Red Hat, 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:/... | townbull/mtaaas-openstack | mtaaas/openstack/common/excutils.py | Python | apache-2.0 | 1,791 |
# Copyright 2014 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 required by applicable ... | raju249/oppia | core/domain/feedback_services_test.py | Python | apache-2.0 | 27,168 |
import subprocess
from typing import List, Optional
from approvaltests import ensure_file_exists
from approvaltests.command import Command
from approvaltests.core.reporter import Reporter
from approvaltests.utils import to_json
PROGRAM_FILES = "{ProgramFiles}"
class GenericDiffReporterConfig:
def __init__(self,... | approvals/ApprovalTests.Python | approvaltests/reporters/generic_diff_reporter.py | Python | apache-2.0 | 2,752 |
# -*- coding: utf-8 -*-
##############################################################################################
# This file is deprecated because Python 2.x is deprecated #
# A Python 3.x version of this file can be found at: #
# ... | Guymer/PyGuymer | MPLS/load_PlayListMark.py | Python | apache-2.0 | 2,438 |
# Copyright 2013 Big Switch Networks, 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... | CingHu/neutron-ustack | neutron/db/firewall/firewall_db.py | Python | apache-2.0 | 23,675 |
# Copyright 2017 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import json
from .common import BaseTest, functional, Bag
from botocore.exceptions import ClientError
from c7n.exceptions import PolicyValidationError
from c7n.resources.ecr import lifecycle_rule_... | capitalone/cloud-custodian | tests/test_ecr.py | Python | apache-2.0 | 10,970 |
import requests
from hashlib import md5
from xml.etree import ElementTree
from django.core.cache import cache
from functools import cmp_to_key
# class Cache(object):
# params = {}
#
# def get(self,key):
# if key in self.params:
# return self.params[key]
# else:
# return N... | chadoneba/django-planfix | planfix/classes.py | Python | apache-2.0 | 6,136 |
# You will need maestro.py from https://github.com/FRC4564/Maestro
#
# This is also just a place holder, it has not be tested with an actual
# bot.
import sys
import time
try:
import hardware/maestro
except ImportError:
print "You are missing the maestro.py file from the hardware subdirectory."
print "Plea... | Nocturnal42/runmyrobot | hardware/maestro-servo.py | Python | apache-2.0 | 1,417 |
# Copyright 2018 The Exoplanet ML 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 t... | google-research/exoplanet-ml | exoplanet-ml/astrowavenet/astrowavenet_model_test.py | Python | apache-2.0 | 33,881 |
# 142. Linked List Cycle II
# Given a linked list, return the node where the cycle begins.
# If there is no cycle, return null.
#
# Note: Do not modify the linked list.
#
# Follow up:
# Can you solve it without using extra space?
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):... | gengwg/leetcode | 142_linked_list_cycle_ii.py | Python | apache-2.0 | 976 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
import rocketbear
chromatic_numbers = {
"graphs/queen5_5.col": 5,
"graphs/queen6_6.col": 7,
"graphs/queen7_7.col": 7,
"graphs/jean.col": 10,
"graphs/huck.col": 11,
"graphs/myciel3.col": 4,
"graphs/myciel... | wallarelvo/rocketbear | experiments/ordering_exp.py | Python | apache-2.0 | 1,231 |
# @author: Zhongyuan Sun
# time: O(log(m*n)), space: O(1)
class Solution(object):
def searchMatrix(self, matrix, target):
"""
:type matrix: List[List[int]]
:type target: int
:rtype: bool
"""
# Solution One: 122ms, beats 50.00%
# if not matrix or not matrix[0]... | danielsunzhongyuan/my_leetcode_in_python | search_a_2d_matrix_ii_240.py | Python | apache-2.0 | 895 |
from ajenti.api import *
from ajenti.plugins import *
info = PluginInfo(
title='Supervisor',
icon='play',
dependencies=[
PluginDependency('main'),
PluginDependency('services'),
BinaryDependency('supervisord'),
],
)
def init():
import main
| lupyuen/RaspberryPiImage | usr/share/pyshared/ajenti/plugins/supervisor/__init__.py | Python | apache-2.0 | 287 |
import pytest
@pytest.mark.usefixtures("smart_setup")
class TestObjectValue:
def test_get_sheet_object_value(self, smart_setup):
smart = smart_setup['smart']
sheet = smart.Sheets.get_sheet(smart_setup['sheet'].id, include='objectValue')
assert isinstance(sheet.rows[0].cells[0].object_valu... | smartsheet-platform/smartsheet-python-sdk | tests/integration/test_object_value.py | Python | apache-2.0 | 4,224 |
from core.views import initRequest
from django.shortcuts import render_to_response
from django.utils.cache import patch_response_headers
import urllib.request
from urllib.error import HTTPError, URLError
from core.settings.config import IDDS_HOST
import json
SELECTION_CRITERIA = '/monitor_request_relation'
def query... | PanDAWMS/panda-bigmon-core | core/iDDS/DAGvisualization.py | Python | apache-2.0 | 2,510 |
# Copyright 2013 Nebula 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... | BjoernT/python-openstackclient | openstackclient/object/v1/container.py | Python | apache-2.0 | 7,719 |
# Copyright 2015, Yahoo Inc.
# Licensed under the terms of the Apache License, Version 2.0. See the LICENSE file associated with the project for terms.
import heapq
from collections import defaultdict, namedtuple
from itertools import count
import numpy as np
import array
from .utils import iterate_splits, compute_code... | yahoo/lopq | python/lopq/search.py | Python | apache-2.0 | 11,638 |
from st2actions.runners.pythonrunner import Action
from st2client.client import Client
# Keep Compatability with 0.8 and 0.11 until st2build is upgraded
try:
from st2client.models.datastore import KeyValuePair
except ImportError:
from st2client.models.keyvalue import KeyValuePair
class KVPAction(Action):
... | StackStorm/st2cd | actions/kvstore.py | Python | apache-2.0 | 1,061 |
from setuptools import setup, find_packages
SRC_DIR = 'src'
def get_version():
import sys
sys.path[:0] = [SRC_DIR]
return __import__('artifactcli').__version__
setup(
name='artifact-cli',
version=get_version(),
description='Private Artifact Manager using Amazon S3',
author='mogproject'... | mogproject/artifact-cli | setup.py | Python | apache-2.0 | 822 |
#Keeping data in .py file example
from model.group import Group
import random
import string
testdata = [
Group(name="name1",header="header1", footer="footer1"),
Group(name="name2",header="header2", footer="footer2"),
Group(name="name3",header="header3", footer="footer3")
]
def random_string(prefix, maxle... | lyudmill/python_training | data/groups.py | Python | apache-2.0 | 944 |
# ------------------------------------------------------------------------------
#
# Various helpers.
#
# Author: Stefan Heule <stefanheule@gmail.com>
#
# ------------------------------------------------------------------------------
import time
def get_time_str():
"""
Returns a string of the current time.
"""
... | stefanheule/putil | putil/util.py | Python | apache-2.0 | 378 |
# -*- 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 i... | ramielrowe/python-magnumclient | magnumclient/exceptions.py | Python | apache-2.0 | 2,751 |
# Create your views here.
from django.contrib.auth.models import Group
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestConte... | Ecotrust/PEW-EFH | mp/visualize/views.py | Python | apache-2.0 | 11,227 |
# -*- coding: utf-8 -*-
"""The LVM path specification resolver helper implementation."""
# This is necessary to prevent a circular import.
import dfvfs.file_io.lvm_file_io
import dfvfs.vfs.lvm_file_system
from dfvfs.lib import definitions
from dfvfs.resolver import resolver
from dfvfs.resolver import resolver_helper
... | dc3-plaso/dfvfs | dfvfs/resolver/lvm_resolver_helper.py | Python | apache-2.0 | 1,206 |
#!/usr/bin/env python
import logging
import json
import netifaces
import netaddr
import socket
import fcntl
import struct
import array
import time
import ast
import copy
import subprocess
import os
from netaddr import IPNetwork, IPAddress
from operations import configOpts
from vyos_session import utils
from netifaces i... | jiahaoliang/group-based-policy | gbpservice/nfp/service_vendor_agents/vyos/oc_config_server/vpn_api_server.py | Python | apache-2.0 | 17,163 |
# 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 the Li... | ismail-s/warehouse | tests/unit/utils/test_paginate.py | Python | apache-2.0 | 2,849 |
import unittest
import bencode
from rtrss import torrentfile
testdata = dict({'some key': 'some value'})
encoded_testdata = bencode.bencode(testdata)
class TorrentFileTestCase(unittest.TestCase):
def test_torrentfile_decoded_equals_encoded(self):
tf = torrentfile.TorrentFile(encoded_testdata)
... | notapresent/rtrss | tests/test_torrentfile.py | Python | apache-2.0 | 2,078 |
from synergine.synergy.event.Action import Action
from tests.src.event.LonelinessSuicideEvent import LonelinessSuicideEvent
from tests.src.event.TooMuchBeansAction import TooMuchBeansAction
class LonelinessSuicideAction(Action):
_listen = LonelinessSuicideEvent
_depend = [TooMuchBeansAction]
def run(sel... | buxx/synergine | tests/src/event/LonelinessSuicideAction.py | Python | apache-2.0 | 402 |
#Embedded file name: scripts/client/WeatherManager.py
import BigWorld
import db.DBLogic
from debug_utils import *
def InitWeather():
arenaData = db.DBLogic.g_instance.getArenaData(BigWorld.player().arenaType)
LOG_DEBUG("WeatherManager:InitWeather() '%s': %s, %s" % (arenaData.geometry, arenaData.weatherWindSpee... | Monstrofil/wowp_free_camera | install/scripts/client/WeatherManager.py | Python | apache-2.0 | 1,201 |
#
# Copyright (c) 2008-2015 Citrix 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/aaa/aaagroup_vpnurl_binding.py | Python | apache-2.0 | 6,287 |
# Copyright 2022 The jax3d 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... | google-research/jax3d | jax3d/projects/nesf/nerfstatic/utils/camera_utils_test.py | Python | apache-2.0 | 1,892 |
# -*- 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-api-gateway | samples/generated_samples/apigateway_v1_generated_api_gateway_service_create_api_async.py | Python | apache-2.0 | 1,588 |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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
... | kdart/pycopia | WWW/pycopia/WWW/fcgiserver.py | Python | apache-2.0 | 5,953 |
class Events(object):
"""
Events Enum
"""
UI_BTN_PRESSED = 100
UI_BTN_RELEASED = 101
UI_BTN_CLICKED = 102
SET_UI_BTN_STATE = 150
| rituven/winston | core/Events.py | Python | apache-2.0 | 163 |
# coding: utf-8
"""
twitcher.oauth2
---------------
This module implements the `OAuth2 <https://oauthlib.readthedocs.io/en/latest/oauth2/oauth2.html>`_
model to generate access tokens.
These tokens are used to access the compute services (*scope=compute*).
The compute services are accessed via the OWS proxy.
The impl... | bird-house/pywps-proxy | twitcher/oauth2.py | Python | apache-2.0 | 10,573 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
import numpy as np
import tensorflow as tf
from sklearn.utils import shuffle
from tqdm import tqdm
import tensorlayer as tl
from tensorlayer.cost import cross_entropy_seq
from tensorlayer.models.seq2seq import Seq2seq
from tests.utils import Cus... | zsdonghao/tensorlayer | tests/models/test_seq2seq_model.py | Python | apache-2.0 | 3,088 |
"""
Some codes from https://github.com/Newmu/dcgan_code
"""
from __future__ import division
import math
import json
import random
import pprint
import scipy.misc
import numpy as np
from time import gmtime, strftime
pp = pprint.PrettyPrinter()
get_stddev = lambda x, k_h, k_w: 1/math.sqrt(k_w*k_h*x.get_shape()[-1])
de... | LarsDu/DeepPixelMonster | dpixelmonster/kim_utils.py | Python | apache-2.0 | 7,612 |
# Copyright 2018 - Nokia 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 or agre... | openstack/mistral | mistral/scheduler/scheduler_server.py | Python | apache-2.0 | 2,019 |
import time
from sqlalchemy.orm import relationship, backref
import sqlalchemy as sa
from sqlalchemy import (
Column,
String,
ForeignKey,
Integer,
CheckConstraint,
BigInteger,
PrimaryKeyConstraint,
Boolean,
)
from mlflow.entities import (
Experiment,
RunTag,
Metric,
Param... | mlflow/mlflow | mlflow/store/tracking/dbmodels/models.py | Python | apache-2.0 | 14,421 |
#!/usr/bin/env python
from __future__ import print_function
import sys
import os
from androguard import __version__
from setuptools import setup, find_packages
# We do not support python versions <2.7 and python <3.4
if (sys.version_info.major == 3 and sys.version_info.minor < 4) or (sys.version_info.major == 2 and ... | shuxin/androguard | setup.py | Python | apache-2.0 | 3,939 |
#!/Users/wuga/Documents/website/wuga/env/bin/python2.7
#
# The Python Imaging Library
# $Id$
#
from __future__ import print_function
import sys
if sys.version_info[0] > 2:
import tkinter
else:
import Tkinter as tkinter
from PIL import Image, ImageTk
#
# an image viewer
class UI(tkinter.Label):
def _... | wuga214/Django-Wuga | env/bin/viewer.py | Python | apache-2.0 | 1,056 |
#***********************************************************************
# This code is part of pyCMPL
#
# Copyright (C) 2013
# Mike Steglich - Technical University of Applied Sciences
# Wildau, Germany
#
# pyCMPL is a project of the Technical University of
# Applied Sciences Wildau and the Institute f... | Mangara/ArboralExplorer | lib/Cmpl/pyCmpl/lib/pyCmpl/CmplInstance.py | Python | apache-2.0 | 7,151 |
import sys
import math
def process(filepath):
with open(sys.argv[1]) as prob_file:
with open("mrd_neis.txt") as orig_file:
with open("mrd_neis_prob_summary.txt", "w") as outfile:
orig_file.readline()
pattern = ''
prob = 0
orig_prob = 0
for line in prob_file:
new_prob = float(line.strip(... | imminfo/mrd-paper | process_neis_prob.py | Python | apache-2.0 | 827 |
import requests
import json
import datetime
import logging
Config = {
'url' : 'http://198.199.98.147:5000/data_point',
'agent' : 'Default',
'user': 'urbanuser',
'password' : 'urbankey'
}
# send (latitud, longitud, extra)
# Sends a bundle of data to the server as a geojson point
# usage :
#send( 1... | DuGuille/urban-data | client/urbandata.py | Python | apache-2.0 | 1,412 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Kylin OS, 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
#
#... | Havate/havate-openstack | proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/dashboards/admin/instances/forms.py | Python | apache-2.0 | 3,609 |
# 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... | hurricanerix/swift | test/unit/proxy/controllers/test_container.py | Python | apache-2.0 | 15,514 |
# Copyright 2018 Microsoft 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
#
# Unless required by applicable law or agreed to in... | hglkrijger/WALinuxAgent | tests/common/osutil/test_default.py | Python | apache-2.0 | 36,933 |
from moli.client import Client
c = Client('http://127.0.0.1:8013/')
@c.on('ss')
def user_event(connection):
pass
#print('ss event is trigger', connection)
c.emit('mybaby', 'aaaa')
c.run_forever()
| stormeyes/moli | tests/testClient.py | Python | apache-2.0 | 210 |
# Copyright 2015 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 agreed ... | yebrahim/pydatalab | google/datalab/bigquery/commands/_bigquery.py | Python | apache-2.0 | 49,966 |
# -*- coding: utf-8 -*-
import yaml
def getRows(cur, col, table):
cur.execute("select %s from %s" % (col, table))
rows = [row[0] for row in cur]
return rows
def printYamlDump(d):
try:
print(yaml.dump(d, default_flow_style=False))
except yaml.YAMLError as err:
print(err)
def fil... | nttdots/go-dots | config-helper/utils.py | Python | apache-2.0 | 492 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PyQt5.QtCore import *
from collections import OrderedDict
from signalmanager import signalManager
class CqsscWorker(QObject):
def __init__(self, parent=None):
super(CqsscWorker, self).__init__(parent)
self._rawDataLines = []
self._rawDat... | dragondjf/cqssl | app/cqsscworker.py | Python | apache-2.0 | 3,057 |
from typing import Any
from argparse import ArgumentParser
from zerver.lib.actions import do_rename_stream
from zerver.lib.str_utils import force_text
from zerver.lib.management import ZulipBaseCommand
from zerver.models import get_stream
import sys
class Command(ZulipBaseCommand):
help = """Change the stream ... | amanharitsh123/zulip | zerver/management/commands/rename_stream.py | Python | apache-2.0 | 1,181 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('Alarma', '0004_auto_20151025_0206'),
]
operations = [
migrations.CreateModel(
name='DjkombuMessage',
... | Oriphiel/Python | AlarmaTecno/Alarma/migrations/0005_djkombumessage_djkombuqueue.py | Python | apache-2.0 | 1,116 |
# Copyright 2019 The gRPC 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 writ... | firebase/grpc-SwiftPM | src/python/grpcio_tests/tests_aio/interop/methods.py | Python | apache-2.0 | 17,437 |
#!/usr/bin/env python
import requests as r
import sys, json, re
import StringIO as StringIO
API_KEY = 'ea04b1f16b56a1b1a21b0159b8b1990e'
def _getPhoneNumber(inPhone):
re.sub("\D", "", inPhone)
inPhone = inPhone.replace('-', '')
if inPhone[0] == '1':
inPhone = inPhone[1:]
assert len(inPhone) =... | shiny-fortnight/auto_id | whitepages_api.py | Python | apache-2.0 | 1,774 |
#! /Users/nsanthony/miniconda3/bin/python
import rooms.room_class as rc
blank = rc.room()
blank.name = 'blank room'
blank.descript = 'This is a blank room'
blank.size = 'You cant see the edge'
blank.occupied = 0
blank.people = 'There is no one in this room with you'
blank.coord = [0,0,0] | nsanthony/super-fortnight | wwk/py/rooms/room_directory/blank_room.py | Python | apache-2.0 | 289 |
class KEY(object):
def __init__(self, internal_name, external_name):
self.internalName = internal_name
self.externalName = external_name
class REQUEST(object):
def __init__(self, internal_name, external_name):
self.internalName = internal_name
self.externalName = external_name
... | stephentyrone/swift | utils/gyb_sourcekit_support/UIDs.py | Python | apache-2.0 | 23,110 |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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... | our-city-app/oca-backend | src/rogerthat/exceptions/news.py | Python | apache-2.0 | 3,868 |
"""
Component to keep track of user controlled booleans for within automation.
For more details about this component, please refer to the documentation
at https://home-assistant.io/components/input_boolean/
"""
import logging
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID, CONF_ICON, C... | tinloaf/home-assistant | homeassistant/components/input_boolean.py | Python | apache-2.0 | 3,609 |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | HybridF5/jacket | jacket/api/compute/openstack/compute/deferred_delete.py | Python | apache-2.0 | 3,026 |
#!/usr/bin/python3
#
# $Id:$
#
# We test a bit of the atrshmlog here.
#
# This is for the first starter, so only the basic things.
import sys
import atrshmlog
r = atrshmlog.attach()
id = atrshmlog.get_clock_id()
print('clock id : ' + str(id) + ' : ')
oldid = atrshmlog.set_clock_id(2)
print('clock id : ' + str(old... | atrsoftgmbh/atrshmlog | python/src/tests/t_clock_id.py | Python | apache-2.0 | 594 |
__author__ = 'jcorbett'
import logging
from ujson import dumps
from .app import app
from .model.serialize import serialize_this
from .model.slickLogEvent import SlickLogEvent, EventTypes
from kombu import producers
import sys
event_topic_mapping = {
}
class SlickEventError(Exception):
pass
class Event(objec... | slickqa/slickqaweb | slickqaweb/events.py | Python | apache-2.0 | 4,747 |
import json
import datetime
import http.client
from time import time
########################################################################################################################
##################################################### ENVIRONMENTS #####################################################
########... | CALlanoR/virtual_environments | web/api_rest/mini_facebook/python_users_relationships_service_api_llano/manual_tests/consumer.py | Python | apache-2.0 | 1,939 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'$', views.index, name="index"),
]
| joshuar500/mcratesv1 | mcratesv1_project/blog_rankings/urls.py | Python | apache-2.0 | 115 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2013 Tobias Weber <tobi-weber@gmx.de>
#
# 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 ... | tobi-weber/levitas | src/levitas/middleware/__init__.py | Python | apache-2.0 | 22,256 |
# -*- coding: utf-8 -*-
"""
Design Chebychev 1 filters (LP, HP, BP, BS) with fixed or minimum order, return
the filter design in zpk (zeros, poles, gain) format
Attention:
This class is re-instantiated dynamically everytime the filter design method
is selected, calling the __init__ method.
Author: Christian Münker
""... | honahursey/pyFDA | pyfda/filter_design/cheby1.py | Python | apache-2.0 | 9,053 |
#!/usr/bin/env python
#
# Bessel function with scipy and matplotlib.
#
#
# agomez (at) tacc.utexas.edu
# 30 Oct 2014
#
# ---------------------------------------------------------------------
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from scipy import *
from scipy... | antoniogi/HPC | Python/TACC_HPC/3_scipy/bessel.py | Python | apache-2.0 | 841 |
#
# 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 ... | mkhutornenko/incubator-aurora | src/test/python/apache/aurora/executor/test_thermos_executor.py | Python | apache-2.0 | 18,559 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Image'
db.create_table('images_image', (
('content_ptr', self.gf('django.db.mo... | armstrong/armstrong.apps.images | armstrong/apps/images/migrations/0001_initial.py | Python | apache-2.0 | 8,342 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 OpenStack, LLC.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... | citrix-openstack-build/cinder | cinder/scheduler/simple.py | Python | apache-2.0 | 3,857 |
# -*- coding: utf-8 -*-
#
# ADMICloud documentation build configuration file, created by
# sphinx-quickstart on Wed May 18 09:56:03 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | ADMIcloud/www | docs/source/conf.py | Python | apache-2.0 | 14,197 |
from bisect import bisect_left
class Solution(object):
def kEmptySlots(self, flowers, k):
"""
:type flowers: List[int]
:type k: int
:rtype: int
"""
S = []
for ithday, n in enumerate(flowers):
idx = bisect_left(S, n)
if idx > 0 and n - S[idx-1] == k+1:
return ithday + 1
elif idx < len(S) an... | xiaonanln/myleetcode-python | src/683. K Empty Slots.py | Python | apache-2.0 | 479 |