code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# 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... | gunan/tensorflow | tensorflow/python/eager/tape.py | Python | apache-2.0 | 7,733 |
# 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... | Accelerite/cinder | cinder/tests/targets/test_tgt_driver.py | Python | apache-2.0 | 11,627 |
from functools import lru_cache
import os
import rethinkdb as r
from sondra.document.schema_parser import ValueHandler
try:
from werkzeug.utils import secure_filename
except ImportError:
import re
def secure_filename(name):
name = re.sub(r'\s+', '-', name) # Replace white space with dash
... | JeffHeard/sondra | sondra/files.py | Python | apache-2.0 | 7,919 |
# Copyright 2008-2014 Nokia Solutions and 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 l... | userzimmermann/robotframework-python3 | src/robot/running/arguments/javaargumentcoercer.py | Python | apache-2.0 | 4,502 |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 23 11:15:12 2016
@author: suraj
"""
import random
import numpy as np
import pickle
import matplotlib.pyplot as plt
attachRateList = []
for i in range(3360):
attachRateList.append(random.uniform(4,6))
attachRateList = np.array(attachRateList)
encoded_attach_rate... | suraj-jayakumar/lstm-rnn-ad | src/testdata/random_data_time_series/generate_data.py | Python | apache-2.0 | 1,042 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import, unicode_literals
from pong import swing_agent
from pong import track_agent
SwingAgent = swing_agent.SwingAgent
TrackAgent = track_agent.TrackAgent
| marevol/gym-starter-kit-example | pong/__init__.py | Python | apache-2.0 | 240 |
def pytest_addoption(parser):
parser.addoption(
'--integration',
action='store_true',
help='run integration tests',
)
def pytest_ignore_collect(path, config):
if not config.getoption('integration') and 'integration' in str(path):
return True
| malinoff/amqproto | tests/conftest.py | Python | apache-2.0 | 288 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@hp.com>
#
# 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/L... | NeCTAR-RC/designate | designate/api/v2/controllers/limits.py | Python | apache-2.0 | 1,347 |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2017
import unittest
from streamsx.topology.topology import *
from streamsx.topology.tester import Tester
from streamsx.topology import context
from streamsx.topology.context import ConfigParams
from streamsx import rest
import streamsx.ec as ... | ddebrunner/streamsx.topology | test/python/topology/test2_unicode.py | Python | apache-2.0 | 2,624 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
import tokenize
from builtins import range
from collections import defaultdict... | foursquare/pants | contrib/python/src/python/pants/contrib/python/checks/tasks/checkstyle/trailing_whitespace.py | Python | apache-2.0 | 2,252 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | savi-dev/heat | heat/engine/parameters.py | Python | apache-2.0 | 14,053 |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import re
from cfgm_common import jsonutils as json
import time
import gevent
import disc_consts
import disc_exceptions
from datetime import datetime
from gevent.coros import BoundedSemaphore
import pycassa
import pycassa.util
from pycassa.system_ma... | facetothefate/contrail-controller | src/discovery/disc_cassdb.py | Python | apache-2.0 | 14,755 |
#!/usr/bin/env python
import os
import sys
from setuptools import setup
SETUP_DIR = os.path.dirname(__file__)
README = os.path.join(SETUP_DIR, "README.rst")
NEEDS_PYTEST = {"pytest", "test", "ptr"}.intersection(sys.argv)
PYTEST_RUNNER = ["pytest-runner", "pytest-cov"] if NEEDS_PYTEST else []
setup(
name="cwl-u... | common-workflow-language/cwl-upgrader | setup.py | Python | apache-2.0 | 2,104 |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=1, faild_point=100000, path_list=[
[TestAction.create_mini_vm, 'vm1', 'cluster=cluster1'],
[TestAction.reboot_vm, 'vm1'],
[TestAction.create_mini_v... | zstackio/zstack-woodpecker | integrationtest/vm/mini/multiclusters/paths/multi_path173.py | Python | apache-2.0 | 2,948 |
# coding=utf-8
# Copyright 2022 The init2winit 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 la... | google/init2winit | init2winit/dataset_lib/ogbg_molpcba.py | Python | apache-2.0 | 8,040 |
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
res = []
common = [res.append(list(set(a))[0]) for a in itertools.takewhile(lambda x: len(set(x)) == 1, [x for x in zip(*strs)])]
return "".join(res)
# Enumeration soln
# def longestCommonPrefix(s... | saisankargochhayat/algo_quest | leetcode/14.LongestCommonPrefix/soln.py | Python | apache-2.0 | 684 |
from ichnaea.async.app import celery_app
from ichnaea.async.task import BaseTask
from ichnaea.data import area
from ichnaea.data import export
from ichnaea.data.internal import InternalUploader
from ichnaea.data.mapstat import MapStatUpdater
from ichnaea.data import monitor
from ichnaea.data import ocid
from ichnaea.da... | therewillbecode/ichnaea | ichnaea/data/tasks.py | Python | apache-2.0 | 6,387 |
# 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 by applicable law or a... | VitalLabs/gcloud-python | gcloud/storage/blob.py | Python | apache-2.0 | 37,138 |
# 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
# distrib... | mgeisler/satori | satori/sysinfo/ohai_solo.py | Python | apache-2.0 | 6,696 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c)2012 Rackspace US, 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.ap... | emonty/pyos | samples/cloud_blockstorage/create_snapshot.py | Python | apache-2.0 | 1,828 |
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# @author: Antonio Sagliocco <antonio@midokura.com>, Midokura
import logging
import subprocess
from collections import Counter
import os
from injector import inject, singleton
from requests.exceptions import ConnectionError
from yaml import load
from midonet_s... | midonet/midonet-sandbox | src/midonet_sandbox/logic/composer.py | Python | apache-2.0 | 9,157 |
#
# $Id: pwiz-setup.py 9964 2016-08-09 20:32:10Z chambm $
#
#
# Original author: Matt Chambers <matt.chambers .@. vanderbilt.edu>
#
# Copyright 2012 Vanderbilt University - Nashville, TN 37232
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... | biospi/mzmlb | pwiz/scripts/wix/pwiz-setup.py | Python | apache-2.0 | 3,683 |
import logging
import os
import re
import select
import subprocess
import threading
import time
__all__ = [
'ExternalService',
'SpawnedService',
]
log = logging.getLogger(__name__)
class ExternalService(object):
def __init__(self, host, port):
log.info("Using already running service at %s:%d",... | gamechanger/kafka-python | test/service.py | Python | apache-2.0 | 3,648 |
#
# Test-Related Pages
#
import pscheduler
from pschedulerapiserver import application
from flask import request
from .dbcursor import dbcursor_query
from .json import *
from .response import *
#
# Tests
#
# All tests
@application.route("/tests", methods=['GET'])
def tests():
return json_query("SELECT json FR... | mfeit-internet2/pscheduler-dev | pscheduler-server/pscheduler-server/api-server/pschedulerapiserver/tests.py | Python | apache-2.0 | 4,144 |
from sqlalchemy import *
from migrate import *
meta = MetaData()
def upgrade(migrate_engine):
meta.bind = migrate_engine
nodes_table = Table('nodes', meta, autoload=True)
nodes_table_is_deleted = Column('is_deleted', Integer, default=False)
nodes_table_is_deleted.create(nodes_table)
def downgrade(mig... | kevenli/scrapydd | scrapydd/migrates/versions/018_nodes_is_deleted.py | Python | apache-2.0 | 458 |
# -*- 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-appengine-admin | samples/generated_samples/appengine_v1_generated_services_get_service_sync.py | Python | apache-2.0 | 1,416 |
import os
import json
import logging
import numpy
from osgeo import gdal
from ground_surveyor import gsconfig
def pick_best_pile_layer(pile_md_filename,
selection_options):
pile_md = json.load(open(pile_md_filename))
best_i = -1
best_value = 0
target_field = selec... | bmenard1/GroundSurveyor | ground_surveyor/uf_mosaic.py | Python | apache-2.0 | 5,019 |
from copy import deepcopy
import numpy as np
import pandas as pd
import pytest
from xarray import DataArray, Dataset, Variable, concat
from xarray.core import dtypes, merge
from . import (
InaccessibleArray,
assert_array_equal,
assert_equal,
assert_identical,
raises_regex,
requires_dask,
)
fr... | xray/xray | xarray/tests/test_concat.py | Python | apache-2.0 | 21,946 |
"""
This module contains classes for data and graph visualization.
For that purpose, there are classes for the creation of simple graph's images,
images with path (critical, shortest, strongest) depiction and giving to a user
the chance to customize images and the way nodes and edges are depicted.
Apart from this, th... | theosotr/netxanal | mvc/controller/visualization.py | Python | apache-2.0 | 21,545 |
# 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 agreed to in writing, ... | google/tink | testing/cross_language/key_generation_consistency_test.py | Python | apache-2.0 | 15,388 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | okoye/spinnaker-monitoring | spinnaker-monitoring-daemon/spinnaker-monitoring/spectator_handlers.py | Python | apache-2.0 | 16,780 |
import re
a="2+1+3+3123123"
r=re.findall(r"\d{0,}[\+\-]{0,}",a)
print(r)
with open("re.txt","w") as re:
for i in r:
re.write(i)
with open("re.txt","r") as r:
r=r.read()
print(r) | xiaoyongaa/ALL | 函数和常用模块/cash3.py | Python | apache-2.0 | 193 |
#!/usr/bin/env python
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | jmvrbanac/barbican | bin/barbican-keystone-listener.py | Python | apache-2.0 | 2,403 |
import mfr
import json
from tests import utils
from tornado import testing
class TestRenderHandler(utils.HandlerTestCase):
@testing.gen_test
def test_options_skips_prepare(self):
# Would crash b/c lack of mocks
yield self.http_client.fetch(
self.get_url('/render'),
met... | haoyuchen1992/modular-file-renderer | tests/server/handlers/test_render.py | Python | apache-2.0 | 344 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/adamatch | semi_supervised_domain_adaptation/adamatch.py | Python | apache-2.0 | 10,175 |
"""
ARM 32-bit definitions.
Commonly used definitions.
"""
from __future__ import absolute_import
from cdsl.isa import TargetISA, CPUMode
import base.instructions
from base.legalize import narrow
ISA = TargetISA('arm32', [base.instructions.GROUP])
# CPU modes for 32-bit ARM and Thumb2.
A32 = CPUMode('A32', ISA)
T32 ... | sunfishcode/cretonne | lib/cretonne/meta/isa/arm32/defs.py | Python | apache-2.0 | 417 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 OpenStack, LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache... | rcbops/glance-buildpackage | glance/api/policy.py | Python | apache-2.0 | 3,392 |
# -*- coding: utf-8 -*-
# Copyright 2015 Metaswitch 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 applicab... | anortef/calico | calico/felix/test/test_frules.py | Python | apache-2.0 | 11,864 |
import random
from numpy.random import normal, uniform
import numpy as np
import math
from heapq import heapify, heappush, heappop
import os
MIN = 0
MAX = 10000000
POINTS_COUNT = 1000000
QUERIES_COUNT = 200000
def save_dataset(filename, intervals, queries):
intervals_copy = [value for value in intervals]
qu... | mavlyutovrus/interval_index | python/create_datasets.py | Python | apache-2.0 | 14,048 |
#!/usr/bin/env python
import sys,re,time,argparse
def main(args):
# print >>sys.stdout, "Start analysis: " + time.strftime("%a,%d %b %Y %H:%M:%S")
convert(args.input,args.output)
# print >>sys.stdout, "Finish analysis: " + time.strftime("%a,%d %b %Y %H:%M:%S")
def extract_exon_length_from_cigar(cigar):
cigar_m = ["... | yunhaowang/IDP-APA | utilities/py_idpapa_sam2gpd.py | Python | apache-2.0 | 3,045 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | iemejia/incubator-beam | sdks/python/apache_beam/io/external/xlang_kafkaio_it_test.py | Python | apache-2.0 | 4,950 |
input = """
q("1","2","3").
q("3","te,s,t!","new").
q(1,2,"Work?").
p(f(f(X,Y),Z)) :- q(X,Y,Z).
r(X,Y,Z) :- p(f(f(X,Y),Z)).
"""
output = """
q("1","2","3").
q("3","te,s,t!","new").
q(1,2,"Work?").
p(f(f(X,Y),Z)) :- q(X,Y,Z).
r(X,Y,Z) :- p(f(f(X,Y),Z)).
"""
| veltri/DLV2 | tests/parser/functions.5.test.py | Python | apache-2.0 | 271 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
# sudo sysctl -w net.ipv4.ip_forward=1
from libmproxy.protocol.http import decoded
def response(context, flow):
with decoded(flow.response): # automatically decode gzipped res... | xiilei/pytools | mitm-savecookies.py | Python | apache-2.0 | 702 |
# Copyright 2016 Internap
#
# 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, sof... | mat128/python-ubersmith-remote-module-server | ubersmith_remote_module_server/server.py | Python | apache-2.0 | 915 |
#!/usr/bin/env python
'''
1. Use Paramiko to retrieve the entire 'show version' output from pynet-rtr2.
2. Use Paramiko to change the 'logging buffered <size>' configuration on pynet-rtr2. This will require that you enter into configuration mode.
'''
import paramiko
from getpass import getpass
ip_addr = '50.76.53... | joeyb182/pynet_ansible | byers-paid/exercise_week_4_1-2.py | Python | apache-2.0 | 1,154 |
# @MUNTJAC_COPYRIGHT@
# @MUNTJAC_LICENSE@
from muntjac.event.action import IListener
from muntjac.event.shortcut_action import ShortcutAction
class ShortcutListener(ShortcutAction, IListener):
def __init__(self, *args):
nargs = len(args)
if nargs == 1:
shorthandCaption, = args
... | rwl/muntjac | muntjac/event/shortcut_listener.py | Python | apache-2.0 | 1,032 |
# 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... | openstack/python-openstacksdk | openstack/image/_base_proxy.py | Python | apache-2.0 | 9,912 |
# Copyright 2017-2021 TensorHub, 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... | guildai/guild | guild/commands/stop.py | Python | apache-2.0 | 965 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Configuration loader to support multi file types along with environmental
variable ``PYTHON_CLITOOL_ENV``. Default variable is
:const:`clitool.DEFAULT_RUNNING_MODE` (``development``).
Supported file types are:
* ini/cfg
* json
* yaml (if "pyyaml_" is installed)
.. _... | skitazaki/python-clitool | clitool/config.py | Python | apache-2.0 | 3,300 |
import asyncio
from functools import wraps
from nose.tools import nottest
from datetime import datetime
from datetime import timedelta
from unittest import SkipTest
from flaky import flaky
from acouchbase.cluster import (Cluster, get_event_loop,
close_event_loop)
from couchbase_tests.as... | couchbase/couchbase-python-client | acouchbase/tests/cases/collection_t.py | Python | apache-2.0 | 16,041 |
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | kayhayen/Nuitka | nuitka/codegen/LineNumberCodes.py | Python | apache-2.0 | 2,550 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.teal
~~~~~~~~~~~~~~~~~~~~
Lexer for TEAL.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, bygroups, include, words
from pygments.token import Comment, ... | sonntagsgesicht/regtest | .aux/venv/lib/python3.9/site-packages/pygments/lexers/teal.py | Python | apache-2.0 | 3,519 |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""Core control stuff for coverage.py."""
import atexit
import inspect
import os
import platform
import sys
import traceback
from coverage import env, files
from ... | jayhetee/coveragepy | coverage/control.py | Python | apache-2.0 | 44,134 |
#!/usr/bin/python2.4 -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic string exercises
# D. verbing
# Given a string, if its length is a... | jobiaj/Google_Python | basic/string2.py | Python | apache-2.0 | 2,995 |
# 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... | keras-team/keras | keras/layers/convolutional/conv3d_transpose.py | Python | apache-2.0 | 14,187 |
# -*- 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-secret-manager | samples/generated_samples/secretmanager_v1_generated_secret_manager_service_set_iam_policy_sync.py | Python | apache-2.0 | 1,501 |
#!/usr/bin/env python
import time
from talonspider import Spider, Item, TextField, AttrField
from talonspider.utils import get_random_user_agent
import os
os.environ['MODE'] = 'PRO'
from owllook.database.mongodb import MotorBase
from owllook.utils.tools import async_callback
class RankingItem(Item):
target_item ... | zhiyue/owllook | owllook/spiders/qidian_ranking.py | Python | apache-2.0 | 3,084 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------
# Project : Stock commision fee calculator
#
# File name : stock.py
#
# Author : Cheang Shian Chin
#
# Date created : 20 Nov 2015
#
# Purpose : Calculate stoc... | shianchin/mini_projects | stock_commision_fee_cal/stock.py | Python | apache-2.0 | 6,253 |
#!/usr/local/bin/python2.7
# -*-coding:UTF-8-sig -*-
"""
Module for getting alerts according to learning program
Learning Algorithm - 2015 - Subena
"""
import package.learning.parameter as learningParameter
def execute():
#calculate alerts according to the last values
#learningParameter.getP... | subena-io/subena | package/alerts/main.py | Python | apache-2.0 | 391 |
"""Support for ESPHome binary sensors."""
import logging
from typing import TYPE_CHECKING, Optional
from homeassistant.components.binary_sensor import BinarySensorDevice
from . import EsphomeEntity, platform_async_setup_entry
if TYPE_CHECKING:
# pylint: disable=unused-import
from aioesphomeapi import BinaryS... | jamespcole/home-assistant | homeassistant/components/esphome/binary_sensor.py | Python | apache-2.0 | 2,003 |
import os
import shutil
import yaml
from time import ctime
import cv2
print ctime()
datasetPath = '/home/huligang/data/myVoc/'
dataset_new = 'dataset/'
if os.path.exists(dataset_new):
shutil.rmtree(dataset_new)
os.system('mkdir ' + dataset_new)
Annotations = datasetPath + 'Annotations/'
JPEGImages = datasetPath + '... | huligagn/hello | generate_dataset.py | Python | apache-2.0 | 1,785 |
# Copyright 2021, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | tensorflow/federated | tensorflow_federated/python/simulation/baselines/task_data_test.py | Python | apache-2.0 | 18,038 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | Tan0/ironic | ironic/tests/test_raid.py | Python | apache-2.0 | 10,900 |
from gym.spaces import Dict
from ray.rllib.models.tf.fcnet import FullyConnectedNetwork
from ray.rllib.models.tf.tf_modelv2 import TFModelV2
from ray.rllib.models.torch.torch_modelv2 import TorchModelV2
from ray.rllib.models.torch.fcnet import FullyConnectedNetwork as TorchFC
from ray.rllib.utils.framework import try_... | ray-project/ray | rllib/examples/models/action_mask_model.py | Python | apache-2.0 | 4,271 |
# -*- coding: utf-8 -*-
# Copyright 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 requi... | SmartInfrastructures/fuel-web-dev | nailgun/nailgun/api/v1/validators/json_schema/cluster.py | Python | apache-2.0 | 6,304 |
from django.conf import settings
from django.contrib.auth.models import Group
from django.contrib.sites.models import Site
from django.core.cache import caches
from django.db import models
from django.utils.translation import ugettext_lazy as _
from rdmo.conditions.models import Condition
from rdmo.core.constants impo... | DMPwerkzeug/DMPwerkzeug | rdmo/questions/models.py | Python | apache-2.0 | 27,506 |
#!/usr/bin/env python
#
# Appcelerator Titanium Module Packager
#
#
import os, sys, glob, string
import zipfile
from datetime import date
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
os.chdir(cwd)
required_module_keys = ['name','version','moduleid','description','copyright','license','co... | fatbox/TestFlight-Appcelerator-Module | build.py | Python | apache-2.0 | 5,843 |
#!/usr/bin/env python3
"""Loads an HDF5 file representing Landsat data into a triple store via
SPARQL."""
from argparse import ArgumentParser
from base64 import b64encode
from io import StringIO, BytesIO
from itertools import islice, chain
from dateutil.parser import parse as date_parse
import h5py
import numpy as n... | ANU-Linked-Earth-Data/middleware | batch-demo/import_agdc_data.py | Python | apache-2.0 | 12,109 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
''''''
'''
此处接收分段 先接收大小 然后分段接收数据
'''
import socket,struct,json
phone=socket.socket(socket.AF_INET,socket.SOCK_STREAM) #等同于服务端
phone.connect(('127.0.0.1',8080)) #拨通电话 注意此处是一个元组的形式
while True:
cmd=input('>>:').strip()
if not cmd:continue
phone.send(cmd.encode... | 5StevenWu/Coursepy | L08/网络编程3.2粘包/client端.py | Python | apache-2.0 | 1,009 |
from panda3d.core import *
from panda3d.direct import *
from toontown.toonbase.ToonBaseGlobal import *
from toontown.distributed.ToontownMsgTypes import *
from toontown.hood import ZoneUtil
from direct.directnotify import DirectNotifyGlobal
from toontown.hood import Place
from direct.showbase import DirectObject
from d... | silly-wacky-3-town-toon/SOURCE-COD | toontown/safezone/SafeZoneLoader.py | Python | apache-2.0 | 9,369 |
# coding=utf-8
# Copyright 2020 The TF-Agents 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 applicable la... | tensorflow/agents | tf_agents/environments/suite_mujoco_test.py | Python | apache-2.0 | 2,182 |
# 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... | Akrog/cinder | cinder/api/common.py | Python | apache-2.0 | 15,127 |
"""
Django settings for recomendation project.
Generated by 'django-admin startproject' using Django 1.9.7.
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/
"""
from __... | bkosawa/admin-recommendation | admin_recommendation/settings.py | Python | apache-2.0 | 6,881 |
#----------------------------------------------------------------------
# Copyright (c) 2014 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including witho... | dana-i2cat/felix | modules/resource/orchestrator/src/extensions/sfa/trust/speaksfor_util.py | Python | apache-2.0 | 18,996 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | RyanSkraba/beam | sdks/python/apache_beam/transforms/external_test_py37.py | Python | apache-2.0 | 2,471 |
import codecs
import json
import select
import socket
import sys
import time
import urllib.parse
# Slim HTTP client written directly on top of the UNIX socket API.
# Therefore it can be used with both UNIX and TCP sockets.
#
# Its intended use is limited to rocker (the restclient API should not be
# considered stabl... | mreithub/rocker | rocker/restclient.py | Python | apache-2.0 | 16,781 |
#!/usr/bin/env python
'''
alltests.py - This module runs the automated tests in all the components.
To run specific test cases, pass one or more names of package/module names
on the command line which contain the test cases to be run.
Usage:
python AllTests.py - Runs all the unittests
python... | cboling/SDNdbg | docs/old-stuff/pydzcvr/pydzcvr/tests/alltests.py | Python | apache-2.0 | 2,190 |
from django.test import TestCase
from versiontools.models import AssemblyInfo
from django.utils.timesince import timesince
from django.utils.datetime_safe import datetime
# Create your tests here.
class AssembyInfoTest(TestCase):
def test_create(self):
data = {'fullpath' : r'C:\Users\lberrocal\Doc... | luiscberrocal/rango_tutorial | versiontools/tests.py | Python | apache-2.0 | 948 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Archive',
fields=[
('id', models.AutoField(verb... | emory-libraries/findingaids | findingaids/fa/migrations/0001_initial.py | Python | apache-2.0 | 1,937 |
# -*- coding: utf-8 -*-
#
# 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
#... | Fokko/incubator-airflow | airflow/contrib/sensors/bigquery_sensor.py | Python | apache-2.0 | 1,138 |
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2017, John Westcott IV <john.westcott.iv@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': ... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx_collection/plugins/modules/tower_receive.py | Python | apache-2.0 | 5,506 |
"""Auto-generated file, do not edit by hand. RU metadata"""
from phonenumbers.phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_RU = PhoneMetadata(id='RU', country_code=7, international_prefix='810',
general_desc=PhoneNumberDesc(national_number_pattern='[347-9]\\d{9}', possible_lengt... | daviddrysdale/python-phonenumbers | python/tests/testdata/region_RU.py | Python | apache-2.0 | 630 |
# Copyright 2015 NEC 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. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | openstack/tempest-lib | tempest_lib/tests/services/compute/test_interfaces_client.py | Python | apache-2.0 | 3,944 |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | openstack/octavia | octavia/tests/unit/controller/worker/v1/flows/test_amphora_flows.py | Python | apache-2.0 | 20,294 |
input = """
% Simplified version of a program by Michael Fink, which segfaults
% with the Jun 11 2001 Release.
object(o1,4).
object(o2,5).
object(o3,17).
bid(1,14).
bid(2,34).
bid(3,14).
contains(1,o1,2).
contains(1,o2,4).
contains(1,o3,2).
contains(2,o3,10).
contains(3,o2,5).
%#maxint=62.
selec... | veltri/DLV2 | tests/parser/bug.69_working.test.py | Python | apache-2.0 | 1,691 |
import re
from setuptools import setup
init_py = open('overlay_parse/__init__.py').read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", init_py))
metadata['doc'] = re.findall('"""(.+)"""', init_py)[0]
setup(
name='overlay-parse',
version=metadata['version'],
description=metadata['doc'],
autho... | fakedrake/overlay_parse | setup.py | Python | apache-2.0 | 568 |
from draftmim import app
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.restless import APIManager
db = SQLAlchemy(app)
api_manager = APIManager(app, flask_sqlalchemy_db=db)
| markalansmith/draftmim | web/draftmim/core.py | Python | apache-2.0 | 189 |
"""
RPC / REST client implementation module
"""
import re
import requests
from twentyc.rpc import RestClient
from twentyc.rpc.client import (
InvalidRequestException,
NotFoundException,
PermissionDeniedException,
)
import peeringdb
class CompatibilityError(Exception):
pass
class Fetcher(RestClient... | peeringdb/peeringdb-py | src/peeringdb/_fetch.py | Python | apache-2.0 | 3,326 |
# 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... | tqchen/tvm | python/tvm/relay/frontend/tflite.py | Python | apache-2.0 | 137,911 |
# Copyright 2018 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... | ros2/launch | launch/doc/source/conf.py | Python | apache-2.0 | 6,246 |
#!/usr/bin/env python
import argparse
import numpy as np
import pickle
from detectron2.config import get_cfg
def convert_config(cfg):
ret = []
ret.append(("MODE_MASK", cfg.MODEL.MASK_ON))
has_fpn = "fpn" in cfg.MODEL.BACKBONE.NAME
ret.append(("MODE_FPN", has_fpn))
if not has_fpn:
# we onl... | ppwwyyxx/tensorpack | examples/FasterRCNN/convert_d2/convert_d2.py | Python | apache-2.0 | 5,712 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | QiJune/Paddle | python/paddle/fluid/op.py | Python | apache-2.0 | 10,014 |
import requests
import json
import yaml
import pandas as pd
import pprint
from jsonld_processor import jsonld2nquads, fetchvalue
from utils import int2str
class SmartAPIHandler:
def __init__(self):
# description info about endpoint, bioentity and api
self.endpoint_info = {}
self.bioentity_i... | kevinxin90/biothings_explorer_jupyter_notebook | api_handler.py | Python | apache-2.0 | 7,479 |
# 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, ... | googleinterns/vm-network-migration | vm_network_migration/module_helpers/instance_group_helper.py | Python | apache-2.0 | 4,376 |
#!/usr/bin/env python3
'''
Factutil: helper scripts for source code entities
Copyright 2012-2021 Codinuum Software Lab <https://codinuum.com>
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... | codinuum/cca | python/src/cca/factutil/rdf.py | Python | apache-2.0 | 9,601 |
# Copyright 2019 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... | alsrgv/tensorflow | tensorflow/examples/saved_model/integration_tests/mnist_util.py | Python | apache-2.0 | 1,944 |
# SDT3PrintPlain.py
#
# Print SDT3 to Plain text
from .SDT3Classes import *
hideDetails = False
# tabulator level
tab = 0
def incTab():
global tab
tab += 1
def decTab():
global tab
if (tab > 0):
tab -= 1
def newLine():
global tab
result = '\n'
for i in range(tab):
result += '\t'
return result
#
# Pr... | Homegateway/SDTTool | sdtv3/SDT3PrintPlain.py | Python | apache-2.0 | 8,166 |
#
# 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
# ... | rh-s/heat | contrib/rackspace/rackspace/resources/cloudnetworks.py | Python | apache-2.0 | 5,069 |
# Copyright 2011 Hakan Kjellerstrand hakank@gmail.com
#
# 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 ... | google/or-tools | examples/contrib/volsay.py | Python | apache-2.0 | 1,860 |
"""Test for RFLink light components.
Test setup of RFLink lights component/platform. State tracking and
control of RFLink switch devices.
"""
from homeassistant.components.light import ATTR_BRIGHTNESS
from homeassistant.components.rflink import EVENT_BUTTON_PRESSED
from homeassistant.const import (
ATTR_ENTITY_I... | tinloaf/home-assistant | tests/components/light/test_rflink.py | Python | apache-2.0 | 18,573 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.