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 |
|---|---|---|---|---|---|
# coding=utf-8
import numpy as np
from numpy import random
# a=np.array([[2,3,4,1,2],[1,3,4,5,4],[4,2,3,10,2],[3,5,6,7,9],[10,3,4,2,9]])
# # for i in xrange(5):
# # a[i,i]=1000
# #b=a.argmin(axis=1)
# print a
# a=random.randint(1,100,size=(8,8))
MAX = 1000
MIN = 0
CARSEATS = 6
distMat = np.array([[0, 1, 15, 1... | Octoberr/swmcdh | Schedul/unceshi.py | Python | apache-2.0 | 1,831 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-04-24 08:25
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
def populate_status(apps, schema_editor):
Status = apps.get_model("emgapi", "Status")
st = (
(1, "draft"),
... | EBI-Metagenomics/emgapi | emgapi/migrations/0007_split_run.py | Python | apache-2.0 | 7,178 |
'''
Wamp utility methods.
'''
from autobahn.twisted import wamp, websocket
from autobahn.twisted.wamp import ApplicationSession
from autobahn.wamp.types import ComponentConfig
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks, Deferred
from twisted.internet.protocol import Reconne... | ParadropLabs/Paradrop | paradrop/daemon/paradrop/base/cxbr.py | Python | apache-2.0 | 7,211 |
"""
Check the measured process sizes. If we are on a platform which supports
multiple measuring facilities (e.g. Linux), check if the reported sizes match.
This should help to protect against scaling errors (e.g. Byte vs KiB) or using
the wrong value for a different measure (e.g. resident in physical memory vs
virtual... | pympler/pympler | test/test_process.py | Python | apache-2.0 | 5,151 |
from __future__ import unicode_literals
import boto
import boto3
from boto3.dynamodb.conditions import Key
import sure # noqa
from freezegun import freeze_time
from boto.exception import JSONResponseError
from moto import mock_dynamodb2
from tests.helpers import requires_boto_gte
try:
from boto.dynamodb2.fields i... | im-auld/moto | tests/test_dynamodb2/test_dynamodb_table_without_range_key.py | Python | apache-2.0 | 14,869 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | datacommonsorg/data | scripts/ourworldindata/covid19/preprocess_csv_test.py | Python | apache-2.0 | 2,497 |
"""Functional tests for main views."""
import os
import unittest
from webtest import TestApp
import app_engine_test_utils
from gae import main
from test import test_models
app = TestApp(main.app)
class WelcomeTest(unittest.TestCase):
def setUp(self):
app_engine_test_utils.activate_app_engine_testbed_and_cle... | babybunny/rebuildingtogethercaptain | test/test_main.py | Python | apache-2.0 | 1,940 |
from leapp.utils.clicmd import command
_LONG_DESCRIPTION = '''
Leapp Workflow related commands.
For more information please consider reading the documentation at:
https://red.ht/leapp-docs
'''
@command('workflow', help='Workflow related commands', description=_LONG_DESCRIPTION)
def workflow(*args):
pass
| vinzenz/prototype | leapp/snactor/commands/workflow/__init__.py | Python | apache-2.0 | 313 |
# -*- 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-redis | samples/generated_samples/redis_v1beta1_generated_cloud_redis_reschedule_maintenance_async.py | Python | apache-2.0 | 1,639 |
#!/usr/bin/python
from planetlab.model import *
from users import user_list
# NOTE: The legacy network remap is used to re-order the automatically
# generated, sequential list of ipaddresses to a legacy order to preserve
# pre-existing slice-and-IP assignments. Otherwise, slices would be assigned
# to new IPs,... | m-lab/operator | plsync/sites.py | Python | apache-2.0 | 25,116 |
#!/usr/bin/python
# -*- coding=utf-8 -*-
import os
import os.path
import re
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='get jsfm version....')
parser.add_argument("-path", type=str, help="jsfm path")
args = parser.parse_args()
f = open(args.path, 'r')
content =... | gurisxie/weex-test | test/tools/getjsfm.py | Python | apache-2.0 | 398 |
# 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... | aldian/tensorflow | tensorflow/python/ops/image_ops_impl.py | Python | apache-2.0 | 217,245 |
import json
from datetime import date
from factory import Sequence, post_generation, SubFactory
from factory.alchemy import SQLAlchemyModelFactory
from factory.fuzzy import FuzzyChoice, FuzzyText, FuzzyDate, FuzzyInteger
from lemur.database import db
from lemur.authorities.models import Authority
from lemur.certifica... | Netflix/lemur | lemur/tests/factories.py | Python | apache-2.0 | 11,320 |
# 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... | e0ne/python-brickagentclient | brickclient/tests/test_service_catalog.py | Python | apache-2.0 | 10,473 |
""" This is a set of tests which are expected to run on root Marathon and marathon on marathon (MoM).
"""
import common
import os
import pytest
import retrying
import shakedown
import time
import uuid
from common import event_fixture
from common import (app, app_mesos, block_port, cluster_info, ensure_mom, group,
... | natemurthy/marathon | tests/system/marathon_common_tests.py | Python | apache-2.0 | 39,173 |
"""
Openflow tests on an l2 table
"""
import sys
import os
import logging
from oftest import config
import oftest.base_tests as base_tests
import ofp
from oftest.testutils import *
from oftest.parse import parse_mac
import openflow_base_tests
sys.path.append(os.path.join(sys.path[0], '..', '..', '..', '..',
... | p4lang/p4factory | targets/l2_switch/tests/of-tests/openflow.py | Python | apache-2.0 | 7,004 |
"""
Module for managing ext2/3/4 file systems
"""
import logging
import salt.utils.platform
log = logging.getLogger(__name__)
def __virtual__():
"""
Only work on POSIX-like systems
"""
if salt.utils.platform.is_windows():
return (
False,
"The extfs execution module ... | saltstack/salt | salt/modules/extfs.py | Python | apache-2.0 | 8,988 |
import pytest
@pytest.fixture(scope="module")
def states(loaders):
return loaders.states
@pytest.fixture(scope="module")
def modules(loaders):
return loaders.modules
| saltstack/salt | tests/pytests/functional/states/conftest.py | Python | apache-2.0 | 178 |
#
# Copyright 2019 The FATE 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 appli... | FederatedAI/FATE | python/federatedml/feature/binning/quantile_tool.py | Python | apache-2.0 | 3,447 |
# 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... | wooga/airflow | tests/kubernetes/test_pod_generator.py | Python | apache-2.0 | 28,223 |
#!/usr/bin/env python
"""The MySQL database methods for foreman rule handling."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from grr_response_core.lib import rdfvalue
from grr_response_server import foreman_rules
from grr_response_server.databases im... | demonchild2112/travis-test | grr/server/grr_response_server/databases/mysql_foreman_rules.py | Python | apache-2.0 | 1,746 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2017 Snowflake Computing Inc. All right reserved.
#
import pytest
import snowflake.connector
@pytest.mark.skipif(True, reason="""
No commit or rollback is supported as of today until we support the implicit
transaction.
""")
def test_transaction(... | mayfield/snowflake-connector-python | test/test_transaction.py | Python | apache-2.0 | 4,294 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2016 Twitter. 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... | lucperkins/heron | heron/instance/tests/python/utils/tuple_helper_unittest.py | Python | apache-2.0 | 2,170 |
for i in range (10):
print i
| montgok/Python_Class | python_test2.py | Python | apache-2.0 | 31 |
import docapi
import docbuilder
import testtools
g_trace = """\
lint-syntax.js:3:32 JSLintWarning: Unexpected trailing space.
lint-syntax.js:7:10 JSLintWarning: Redefinition of 'some_function' from line 2.
lint-syntax.js:8:16 JSLintWarning: Expected '{' and instead saw 'return'.
lint-syntax.js:9:2 JSLintWarnin... | opentext/storyteller | docplatform/distribution/py/pfdesigns/javascript/lint.py | Python | apache-2.0 | 1,390 |
from setuptools import find_packages, setup
version = '0.0.1'
setup(
name='alerta-transient',
version=version,
description='Example Alerta plugin for transient flapping alerts',
url='https://github.com/alerta/alerta-contrib',
license='Apache License 2.0',
author='Your name',
author_email='... | guardian/alerta | examples/plugins/transient/setup.py | Python | apache-2.0 | 609 |
"""A WSGI application that simply serves up files from the file system.
.. warning::
This is an early version of this module. It has no tests, limited
documentation, and is subject to major changes.
Configuration Options::
[wsgi_fs]
call = brim.wsgi_fs.WSGIFS
# path = <path>
# The request ... | gholt/python-brim | brim/wsgi_fs.py | Python | apache-2.0 | 9,657 |
# Copyright (c) 2016 IBM
# 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 appli... | eayunstack/neutron | neutron/plugins/ml2/extensions/dns_integration.py | Python | apache-2.0 | 23,051 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Tom-Trumper/selenium | py/selenium/__init__.py | Python | apache-2.0 | 812 |
# -*- 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-datacatalog | samples/generated_samples/datacatalog_generated_datacatalog_v1_policy_tag_manager_serialization_import_taxonomies_sync.py | Python | apache-2.0 | 1,711 |
# Copyright 2015 Cisco Systems, 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 requi... | CiscoSystems/fabric_enabler | dfa/server/services/firewall/native/drivers/phy_asa.py | Python | apache-2.0 | 4,614 |
import re
import unicodedata
from injector import inject, AssistedBuilder
import cx_Oracle as pyoracle
class Oracle(object):
"""Wrapper to connect to Oracle Servers and get all the metastore information"""
@inject(oracle=AssistedBuilder(callable=pyoracle.connect), logger='logger')
def __init__(self, orac... | scm-spain/slippin-jimmy | src/slippinj/databases/drivers/oracle.py | Python | apache-2.0 | 7,437 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cd_subscription', '0005_auto_20161125_1908'),
]
operations = [
migrations.AddField(
model_name='cdsubscription',... | cropr/bjk2017 | cd_subscription/migrations/0006_cdsubscription_badgemimetype.py | Python | apache-2.0 | 478 |
#! /bin/python2
import numpy
import cv2
import os
import struct
BLACK = (0,)
WHITE = (255,)
DIR_OUT = "./img/"
SIZE_CANVAS = 50
SIZE_FEATURE = 28
SIZE_BLOCK = 32
DIGITS = tuple([chr(ord("0") + i) for i in range(10)] + [""])
FONTS = (cv2.FONT_HERSHEY_SIMPLEX, cv2.FONT_HERSHEY_PLAIN,
cv2.FONT_HERSHEY_DUPLEX, c... | t-lou/JSudokuSolver | digit_generator/digit_gen.py | Python | apache-2.0 | 4,207 |
# Copyright (c) OpenMMLab. All rights reserved.
import itertools
import os
from collections import defaultdict
import mmcv
import numpy as np
from mmcv.utils import print_log
from terminaltables import AsciiTable
from mmdet.core import INSTANCE_OFFSET
from .api_wrappers import COCO, pq_compute_multi_core
from .builde... | open-mmlab/mmdetection | mmdet/datasets/coco_panoptic.py | Python | apache-2.0 | 24,271 |
# 1. Convert 1024 to binary and hexadecimal representation:
x = 1024
y = bin(x)
z = hex(x) | dmchu/selenium_gr_5 | git_tests/second_file.py | Python | apache-2.0 | 93 |
import deuce.tests.db_mocking.mongodb_mocking
| rackerlabs/deuce | deuce/tests/db_mocking/__init__.py | Python | apache-2.0 | 46 |
#!/usr/bin/env python
'''
Created on 18 gru 2014
@author: ghalajko
'''
from lvstop.screen import Screen
from lvstop import loop
if __name__ == '__main__':
with Screen() as scr:
try:
scr.main_loop(loop)
except KeyboardInterrupt:
pass
except:
... | cybermaniax/lvstop | src/main/python/ipvstop.py | Python | apache-2.0 | 332 |
#
# Symbol Table
#
import re
from Cython import Utils
from Errors import warning, error, InternalError
from StringEncoding import EncodedString
import Options, Naming
import PyrexTypes
from PyrexTypes import py_object_type, unspecified_type
import TypeSlots
from TypeSlots import \
pyfunction_signature, pymethod_... | bzzzz/cython | Cython/Compiler/Symtab.py | Python | apache-2.0 | 80,141 |
import copy
from pybbn.graph.jointree import JoinTreeListener
from pybbn.pptc.initializer import Initializer
from pybbn.pptc.moralizer import Moralizer
from pybbn.pptc.potentialinitializer import PotentialInitializer
from pybbn.pptc.propagator import Propagator
from pybbn.pptc.transformer import Transformer
from pybbn... | vangj/py-bbn | pybbn/pptc/inferencecontroller.py | Python | apache-2.0 | 2,747 |
# Copyright 2020 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 agr... | deepmind/deepmind-research | catch_carry/trajectories.py | Python | apache-2.0 | 8,650 |
# -*- coding: utf-8 -*-
import libvirt, re
import virtinst.util as util
from django.utils.translation import ugettext_lazy as _
from virtmgr.network.IPy import IP
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from virtmgr.model.models import *
def index(request, host_id):... | retspen/virtmgr | network/views.py | Python | apache-2.0 | 10,948 |
import logging
from savu.plugins.base_recon import BaseRecon
from savu.data.process_data import CitationInfomration
from savu.plugins.cpu_plugin import CpuPlugin
import skimage.transform as transform
import numpy as np
from scipy import ndimage
class ScikitimageFilterBackProjection(BaseRecon, CpuPlugin):
"""
... | swtp1v07/Savu | savu/plugins/scikitimage_filter_back_projection.py | Python | apache-2.0 | 3,515 |
#!/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import json
import requests
url = "http://127.0.0.1:3000/api"
#登录并获取token
def login(username,password):
rep_url = "%s/login?username=%s&passwd=%s" % (url,username,password)
r = requests.get(rep_url)
result... | liu-jian/seos1.0 | test/select_test.py | Python | apache-2.0 | 1,329 |
"""Support for EDP re:dy sensors."""
import logging
from homeassistant.const import POWER_WATT
from homeassistant.helpers.entity import Entity
from . import EDP_REDY, EdpRedyDevice
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['edp_redy']
# Load power in watts (W)
ATTR_ACTIVE_POWER = 'active_power'
async... | jamespcole/home-assistant | homeassistant/components/edp_redy/sensor.py | Python | apache-2.0 | 3,481 |
import urllib, urllib2, re
from bs4 import BeautifulSoup
def scrape(url):
home = 'http://www.moray.gov.uk/'
datePattern = r'[0-9][0-9]-[0-9][0-9]-20[0-9][0-9]'
departments = r'(Chief Executive\'s Office|Corporate Services|Education and Social Care|Environmental Services|Multiple Services)'
html = urllib2.urlopen... | ormiret/tinfoil-hat | scrape_moray.py | Python | apache-2.0 | 1,124 |
# 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... | dmlc/tvm | python/tvm/meta_schedule/testing/relay_workload.py | Python | apache-2.0 | 6,298 |
# ##
# Francois Maillet, 11 janvier 2016
# This file is part of MLDB. Copyright 2016 mldb.ai inc. All rights reserved.
# ##
import unittest
import random
import datetime
from mldb import mldb, ResponseException
class SampledDatasetTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
# Create ... | mldbai/mldb | testing/MLDB-1242_sampled_dataset.py | Python | apache-2.0 | 6,502 |
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long
"""List of static anomalies that can be injected.
Before using, replace mittn.org domain references with something you
have control over.
These injections should be designed to cause a detectable problem at
the server end. The tool doesn't check for reflected da... | F-Secure/mittn | mittn/httpfuzzer/static_anomalies.py | Python | apache-2.0 | 13,401 |
#!/usr/bin/env python3
# Copyright 2019 The Kapitan Authors
# SPDX-FileCopyrightText: 2020 The Kapitan Authors <kapitan-admins@googlegroups.com>
#
# SPDX-License-Identifier: Apache-2.0
"lint module"
import logging
import os
import sys
from pprint import pformat
from kapitan.errors import KapitanError
from kapitan.u... | ademariag/kapitan | kapitan/lint.py | Python | apache-2.0 | 8,531 |
# coding: utf-8
#
# 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 requi... | prasanna08/oppia | core/domain/rating_services_test.py | Python | apache-2.0 | 8,107 |
#
# Copyright (c) SAS Institute, 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 ... | sassoftware/mirrorball | updatebot/artifactory.py | Python | apache-2.0 | 11,601 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 Yahoo! 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... | junneyang/taskflow | taskflow/tests/unit/test_progress.py | Python | apache-2.0 | 5,259 |
#########################################################################################
#################### HOW TO USE ##########################
#########################################################################################
# This takes input from the terminal so run (in th... | CraigglesO/Ciphers | vigenere_plaintext_encrypt.py | Python | apache-2.0 | 3,166 |
import sys
from cliff import app
from cliff import commandmanager as cm
from conf import default
import tacoclient
class TacoClientApp(app.App):
def __init__(self, **kwargs):
super(TacoClientApp, self).__init__(
description='tacoclient - CLI client for TACO(SKT All Container \
Ope... | powerds/python-tacoclient | tacoclient/shell.py | Python | apache-2.0 | 904 |
import pytest
from json_sample_server import app
from cloudevents.http import CloudEvent, to_binary, to_structured
@pytest.fixture
def client():
app.testing = True
return app.test_client()
def test_binary_request(client):
# This data defines a binary cloudevent
attributes = {
"type": "com.e... | cloudevents/sdk-python | samples/http-json-cloudevents/json_sample_test.py | Python | apache-2.0 | 1,022 |
# -*- coding: utf-8 -*-
{
'name': "Módulo de Ejemplo",
'summary': """Manage trainings""",
'description': """
Módulo01 for managing trainings:
- training courses
- training sessions
- attendees registration
""",
'author': "Alvaro Villavicencio Ramírez",
... | AlvaroOdoo/openacademy-project | modulo01/__openerp__.py | Python | apache-2.0 | 881 |
from io import BytesIO
from threading import Lock
import contextlib
import itertools
import os.path
import pickle
import shutil
import tempfile
import unittest
import sys
import numpy as np
import pandas as pd
import xray
from xray import Dataset, open_dataset, open_mfdataset, backends, save_mfdataset
from xray.backe... | cpaulik/xray | xray/test/test_backends.py | Python | apache-2.0 | 38,439 |
#!/usr/bin/python
#
# 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 ag... | google/segy-stack | python/test_StackFile.py | Python | apache-2.0 | 6,283 |
# -*- coding: utf-8 -*-
#
# Copyright 2014-2015 BigML
#
# 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 ... | brokendata/bigmler | bigmler/command.py | Python | apache-2.0 | 6,139 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | abhikeshav/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_controller_optics_oper.py | Python | apache-2.0 | 95,722 |
# !/usr/bin/env python
# coding=utf-8
"""
Configuration for vcr samples.
"""
import logging
from baidubce.bce_client_configuration import BceClientConfiguration
from baidubce.auth.bce_credentials import BceCredentials
HOST = 'http://vcr.bj.baidubce.com'
AK = 'Fill AK here'
SK = 'Fill SK here'
logger = logging.getLogg... | baidubce/bce-sdk-python | sample/vcr/vcr_sample_conf.py | Python | apache-2.0 | 675 |
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse, HttpResponseRedirect
from django.template.context_processors import csrf
from common import post_required, login_required, redirect_if_loggedin, __redirect
# Create your views here.
def index(request):
data = {'title': 'Error', 'p... | amitdhiman000/dais | error/views.py | Python | apache-2.0 | 920 |
from django.contrib.auth.backends import ModelBackend
from .client import remote_user_client
class WocatCMSAuthenticationBackend(ModelBackend):
"""
Authentication against new (2017) wocat website.
"""
def authenticate(self, username=None, password=None, **kwargs):
"""
Custom authentic... | CDE-UNIBE/qcat | apps/accounts/authentication.py | Python | apache-2.0 | 589 |
# Copyright 2019 The TensorNetwork 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 ... | google/TensorNetwork | examples/wavefunctions/wavefunctions_test.py | Python | apache-2.0 | 4,311 |
from db import DB
from itertools import groupby
import operator
from datetime import datetime, timedelta
import classifiers, re
class Season:
def __init__(self, number, isRewatch):
self.number = number
self.episodes = []
self.is_rewatch = isRewatch
def addEpisode(self, episode):
... | chasedog/EpisodeDiscussions | stats.py | Python | apache-2.0 | 4,633 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
from __future__ import unicode_literals
from django.db import models
class Contact(models.Model):
step_user = models.CharField(max_length=128)
username = models.CharField(max_length=128)
action_time = models.CharField(max_length=32, blank=True, null=True)
... | zouyapeng/instance_monitor_server | contact/models.py | Python | apache-2.0 | 562 |
# 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 appli... | jacquesqiao/Paddle | python/paddle/fluid/tests/unittests/test_sum_mkldnn_op.py | Python | apache-2.0 | 805 |
"""This script checks whether DOM has embedded tweet tag or not and
creates and returns the ETweet object"""
import bs4
from data_models.embedded_tweet import ETweet
from extraction.content_extractors.interface_content_extractor import \
IContentExtractor
class ETweetExtractor(IContentExtractor):
"""This cl... | googleinterns/stampify | extraction/content_extractors/embedded_tweet_extractor.py | Python | apache-2.0 | 946 |
import os
import sys
__author__ = 'Davide Caroselli'
def escape(string):
escaped = ''
for c in string:
if ('0' <= c <= '9') or ('A' <= c <= 'Z') or ('a' <= c <= 'z'):
escaped += c
else:
escaped += '\\' + c
return escaped
def _abspath(root, path):
if not os.pa... | ModernMT/MMT | src/textprocessing/script/pyflex.py | Python | apache-2.0 | 6,428 |
class Solution:
def findKthLargest(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
return sorted(nums)[-k]
# return heapq.nlargest(k, nums)[k-1] | stuti-rastogi/leetcodesolutions | 215_kthLargestElement.py | Python | apache-2.0 | 228 |
"""
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, software
d... | googleinterns/adversarial-0th-order-optimization | discretezoo/loss/semantic_similarity.py | Python | apache-2.0 | 9,072 |
# Copyright 2016 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 writing... | muxi/grpc | src/python/grpcio/grpc/_channel.py | Python | apache-2.0 | 57,932 |
"""Abstraction of an OF table."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2019 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fi... | trungdtbk/faucet | faucet/valve_table.py | Python | apache-2.0 | 11,432 |
#
# Copyright 2015 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | wilsonkichoi/zipline | tests/test_benchmark.py | Python | apache-2.0 | 6,927 |
# 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... | dhuang/incubator-airflow | airflow/timetables/interval.py | Python | apache-2.0 | 3,585 |
# Copyright 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 agreed to in... | jamielennox/keystone | keystone/tests/unit/test_v2_keystoneclient.py | Python | apache-2.0 | 58,102 |
# 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... | steveb/heat | heat_integrationtests/common/clients.py | Python | apache-2.0 | 8,193 |
#prerequisites: none, just a range from 0-9
# Each number is from 0-9, when raised to the power of 5
#will produce a the same number as when all are put together
def armstrong5():
print("These are the five digit Armstrong numbers:")
for first in range (1, 10):
for second in range (0, 10):
f... | khoanguyen0791/cs170 | CS170_homework/Armstrong.py | Python | apache-2.0 | 1,312 |
import statistics
from datetime import datetime
class Benchmark():
def __init__(self, n_runs: int = 5, print_checkpoint: bool = True):
self.n_runs = n_runs
self.print_checkpoint = print_checkpoint
@staticmethod
def log(message: str) -> None:
print('[%s] - %s' % (datetime.now(), m... | numerai/submission-criteria | tests/benchmark_base.py | Python | apache-2.0 | 1,174 |
#
# 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... | dhuang/incubator-airflow | tests/providers/google/cloud/hooks/test_cloud_memorystore.py | Python | apache-2.0 | 25,373 |
# -*- coding: utf-8 -*-
##
# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U.
# This file is part of openmano
# 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 ... | me-ankur/openmano | openmano/nfvo.py | Python | apache-2.0 | 79,462 |
from __future__ import print_function
import argparse
import datetime
import logging
import random
import sys
import time
import threading
from oslo.config import cfg
from oslo.utils import timeutils
from ceilometer.publisher import utils
from ceilometer import sample
from ceilometer import storage
from sqlalchemy ... | srsakhamuri/ceilometer-tools | retry_test.py | Python | apache-2.0 | 1,499 |
import hashlib
import urllib2
from test_services import GET
from akara import pipeline
def test_pipeline_missing_stages():
for stages in (None, [], ()):
try:
pipeline.register_pipeline("blah", stages=stages)
except TypeError:
pass
else:
raise AssertErro... | uogbuji/akara | test/test_pipeline.py | Python | apache-2.0 | 3,268 |
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 5.1, s, q"
tags = "CocosNode.remove"
import cocos
from cocos.director import director
from cocos.sprite import Sprite
from coco... | shadowmint/nwidget | lib/cocos2d-0.5.5/test/test_remove.py | Python | apache-2.0 | 1,052 |
"""
A testing program that utilizes Googles Text To Speech (GTTS) engine and pyglet to speak text.
Ensure that AVbin is installed for pyglet to run properly: https://avbin.github.io/AVbin/Download.html
"""
from gtts import gTTS
import time
import os
from sys import platform
if platform == "linux" or platform == "linux... | SPARC-Auburn/Lab-Assistant | assistant/tests/gttstest.py | Python | apache-2.0 | 1,149 |
# 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... | tensorflow/tpu | models/official/efficientnet/condconv/condconv_layers.py | Python | apache-2.0 | 19,899 |
from office import Office
from bank import Bank
bank = Bank("Open Bank")
office = Office("Timisoara", bank)
office.open()
| vtemian/university_projects | practic_stage/hmw7/main.py | Python | apache-2.0 | 125 |
from azure.servicebus import ServiceBusService, Message, Queue
#c-types
bus_service = ServiceBusService(
service_namespace='SimplyPaper',
shared_access_key_name='RootManageSharedAccessKey',
shared_access_key_value='1Y4YNh7uQ/buNi1v3xunn6F6vfSsJ5+nrmiwKY2WM04')
#Endpoint=sb://simplypaper.servicebus.wi... | SimplyPaper/SimplyPaper.github.io | AzureBus.py | Python | apache-2.0 | 842 |
"""This file is intentionally left blank."""
| voicecom/pgtool | tests/__init__.py | Python | apache-2.0 | 45 |
from unitconversion import UnitConversion
| LabAdvComp/osdc_cloud_accounting | unitconversion/__init__.py | Python | apache-2.0 | 42 |
#!/usr/bin/env python
"""
battery_simulator.py - Version 1.0 2013-03-18
Publish a simulated battery level (0-100) with a configurable runtime.
Created for the Pi Robot Project: http://www.pirobot.org
Copyright (c) 2013 Patrick Goebel. All rights reserved.
This program is free software; ... | Leontes/ROS-ATP | atp_utils/nodes/battery_simulator.py | Python | apache-2.0 | 5,429 |
# -*- coding: utf-8 -*-
import os, sys
so = os.path.join(os.path.dirname(__file__), "cpp", "libstopwords.so")
stopwords = os.path.join(os.path.dirname(__file__), "outfile.txt").encode("utf-8")
from cffi import FFI
ffi = FFI()
ffi.cdef("""
uint32_t init( const char* infile, void** lg);
void deinit(void* ctx);
con... | jbzdak/finna-be-octo-robot | stopwords_cffi.py | Python | apache-2.0 | 688 |
# -*- 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-service-usage | samples/generated_samples/serviceusage_v1_generated_service_usage_list_services_async.py | Python | apache-2.0 | 1,497 |
from .iview import IView
from .iview import IViewModel
from .model import Model
class StreamView(IView):
def __init__(self, stream):
super(StreamView, self).__init__()
self.stream = stream
self.separator = '\t'
def update(self):
if self.viewmodel is None:
raise At... | pdyban/dicombrowser | dicomviewer/streamview.py | Python | apache-2.0 | 1,408 |
# Generated by Django 2.2.10 on 2020-02-13 17:41
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wells', '0107_auto_20200116_2328'),
]
operations = [
migrations.AlterField(
model_name='activi... | bcgov/gwells | app/backend/wells/migrations/0108_auto_20200213_1741.py | Python | apache-2.0 | 3,936 |
#!/usr/bin/env python3
#
# (c) Christian Sommerfeldt OEien
# All rights reserved
from rmg.color import Color, InkColor, white_ink
from rmg.board import Photo, Image, Board
from rmg.plane import XY
from argparse import ArgumentParser
from sys import stderr
from math import sqrt, floor
from copy import copy
... | biotty/rmg | graphics/py/posterize.py | Python | bsd-2-clause | 3,589 |
"""
Defines the Sumatra version control interface for Git.
Classes
-------
GitWorkingCopy
GitRepository
:copyright: Copyright 2006-2015 by the Sumatra team, see doc/authors.txt
:license: BSD 2-clause, see LICENSE for details.
"""
from __future__ import print_function
from __future__ import absolute_import
from __fu... | maxalbert/sumatra | sumatra/versioncontrol/_git.py | Python | bsd-2-clause | 6,219 |
import arcpy
import msparkdb
# input parameters
index_string = arcpy.GetParameterAsText(0)
view_name_in = arcpy.GetParameterAsText(1)
# find table view name
view_space = view_name_in.find('svw')
view_name = view_name_in[view_space:]
table_name = 'tbl' + view_name[3:]
# # conver string of variables to tu... | bhankins210/ArcTools_Production | composite_index.py | Python | bsd-2-clause | 1,777 |
#!/usr/bin/env python3
import socket, struct
def hex_ifaddr(byte_s):
""" bytes硬件地址到16进制字符串
"""
seq = []
for n in byte_s:
t = hex(n)[2:]
if len(t) == 1:
t = "0%s" % t
seq.append(t)
return ":".join(seq)
def ifaddr_to_bytes(s):
seq = s.split(":")
result... | fdslight/fdslight | pywind/lib/netutils.py | Python | bsd-2-clause | 4,002 |