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 2014,2017 Hewlett-Packard
#
# 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... | sapcc/monasca-api | monasca_api/common/messaging/kafka_publisher.py | Python | apache-2.0 | 2,843 |
from port_range import PortRange
pr = PortRange('1027/15')
print(pr.bounds)
pr = PortRange('4242-42')
print(pr)
| VRaviTheja/SDN-policy | testing/testing_portrange.py | Python | apache-2.0 | 112 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 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/LIC... | rickerc/neutron_audit | neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py | Python | apache-2.0 | 31,636 |
#! /usr/bin/env python3
import sys
import re
def uso():
"""Imprime instruções de uso do programa."""
uso = """
Este programa gera a ordem correta de inclusão em um banco de dados.
Passe o nome dos arquivos na linha de comando. Caso queira imprimir
ocorrências de referência circular ou inexistente ... | andredalton/bcc | 2014/MAC0242/miniep3/miniep3.py | Python | apache-2.0 | 5,396 |
# Copyright 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.org/licenses/LICENSE-2.0
#
# Unless required b... | salv-orlando/MyRepo | nova/tests/scheduler/test_distributed_scheduler.py | Python | apache-2.0 | 10,588 |
#####
# splunkkvstore.py - Class for manipulating kvstore collections in Splunk
#####
import sys
import requests
import json
import logging
logging.getLogger(__name__)
class splunkkvstore(object):
# On instaniation, only collect the details. Do not do anything until login is called.
def __init__(self,url,*args):
... | delink/SA-kvstore_migrator | bin/splunkkvstore.py | Python | apache-2.0 | 6,834 |
"""
Coroutine streaming module
==========================
.. note::
In a break with tradition, some classes in this module have lower case
names because they tend to be used as function decorators.
We use coroutines to communicate messages between different components
in the Noodles runtime. Coroutines can ha... | NLeSC/noodles | noodles/lib/__init__.py | Python | apache-2.0 | 3,960 |
import plotly.plotly as py
import plotly.graph_objs as go
data = open('Real_Final_database_02.csv')
alldata = data.readlines()
listdata = []
for i in alldata:
listdata.append(i.strip().split(','))
type_z = ['Flood', 'Epidemic', 'Drought', 'Earthquake', 'Storm']
fill_colors = ['#00d0f5', '#ff4a2e', 'a36800', '#ad99... | pdeesawat/PSIT58_test_01 | Test_Python_code/last/01_Cambodia/total_death_cambodia.py | Python | apache-2.0 | 1,383 |
#
# PKCS#1 syntax
#
# ASN.1 source from:
# ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1.asn
#
# Sample captures could be obtained with "openssl genrsa" command
#
from pyasn1_modules.rfc2437 import *
class OtherPrimeInfo(univ.Sequence):
componentType = namedtype.NamedTypes(
namedtype.NamedType('pri... | itielshwartz/BackendApi | lib/pyasn1_modules/rfc3447.py | Python | apache-2.0 | 1,399 |
from setuptools import setup, find_packages
import sys, os
version = '2.3.0'
setup(name='apibinding',
version=version,
description="ZStack API Python bindings library",
long_description="""\
ZStack API Python bindings library""",
classifiers=[], # Get strings from http://pypi.python.org/pypi?%... | live4thee/zstack-utility | apibinding/setup.py | Python | apache-2.0 | 797 |
# -*- coding: utf-8 -*-
from Node import Node
res = float("-inf")
# 只有顶层root节点才可能即经过左边 又经过右边
def maxPathSum(root):
if not root:
return 0
max_l = maxPathSum(root.left)
max_r = maxPathSum(root.right)
max_single = max(max(max_l, max_r) + root.data, root.data)
max_top = max(max_single, ma... | sonymoon/algorithm | src/main/python/geeksforgeeks/tree/max-path-sum.py | Python | apache-2.0 | 707 |
# coding=utf-8
from slideatlas.core import create_app, create_celery_app
| SlideAtlas/SlideAtlas-Server | slideatlas/__init__.py | Python | apache-2.0 | 74 |
from requests_oauthlib import OAuth1Session
import argparse
import json
from datetime import datetime
#import dateutil.tz
import pytz
import logging
import sys
from kametwi.settings import Settings
"""
This is a command line tool of watching twitter timelines
"""
__status__ = "production"
__date__ = "11 Apr 2015"... | okusama27/kametwi | kametwi/twitter.py | Python | apache-2.0 | 3,518 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 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.... | aristanetworks/arista-ovs-quantum | quantum/plugins/cisco/tests/unit/v2/ucs/test_ucs_inventory_v2.py | Python | apache-2.0 | 4,700 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | platform/coreapi/polyaxon/apis/apps.py | Python | apache-2.0 | 1,334 |
# utils/SwiftBuildSupport.py - Utilities for Swift build scripts -*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.tx... | adrfer/swift | utils/SwiftBuildSupport.py | Python | apache-2.0 | 6,845 |
# Copyright (c) 2013 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... | bigswitch/neutron | neutron/tests/unit/extensions/test_agent.py | Python | apache-2.0 | 7,074 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print("Hello, world!")
# EOF
| tnotstar/talgostar | classics/hello/hello.py | Python | apache-2.0 | 77 |
# 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | uni2u/neutron | neutron/plugins/openvswitch/common/config.py | Python | apache-2.0 | 4,210 |
import hashlib
from tango.ast import *
from tango.builtin import Int, Double, String
from tango.types import FunctionType, NominalType, TypeUnion
def transpile(module, header_stream, source_stream):
transpiler = Transpiler(header_stream, source_stream)
transpiler.visit(module)
def compatibilize(name):
... | kyouko-taiga/tango | tango/transpilers/cpp.py | Python | apache-2.0 | 8,789 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | skuda/client-python | kubernetes/test/test_v1_node_selector.py | Python | apache-2.0 | 851 |
# 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, ... | google/CFU-Playground | proj/hps_accel/gateware/gen1/set.py | Python | apache-2.0 | 4,133 |
# Copyright 2012 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... | Vaidyanath/tempest | tempest/api/identity/admin/test_users_negative.py | Python | apache-2.0 | 10,286 |
# @MUNTJAC_COPYRIGHT@
# @MUNTJAC_LICENSE@
from unittest import TestCase
from muntjac.ui.label import Label
from muntjac.ui.tab_sheet import TabSheet
class TestTabSheet(TestCase):
def testAddExistingComponent(self):
c = Label('abc')
tabSheet = TabSheet()
tabSheet.addComponent(c)
t... | rwl/muntjac | muntjac/test/server/component/test_tab_sheet.py | Python | apache-2.0 | 3,921 |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2021] EMBL-European Bioinformatics Institute
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... | RNAcentral/rnacentral-import-pipeline | rnacentral_pipeline/cli/cpat.py | Python | apache-2.0 | 1,587 |
# Copyright 2015-2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | ozamiatin/oslo.messaging | oslo_messaging/_drivers/zmq_driver/client/publishers/dealer/zmq_dealer_publisher_direct.py | Python | apache-2.0 | 6,687 |
# 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... | thenetcircle/dino | test/api/test_api_disconnect.py | Python | apache-2.0 | 1,009 |
from jenova.resources.user import (
UserResource, UserListResource, AuthenticationResource,
ScopeResource, PermissionsResource, UserChangeStateResource,
ScopeUserResource, ScopeListResource, ScopeListUserResource
)
from jenova.resources.cos import (CosResource, DomainCosResource)
from jenova.resources.domain impo... | inova-tecnologias/jenova | src/jenova/resources/__init__.py | Python | apache-2.0 | 1,788 |
""" DataReader code lives here. All DataReader classes should extend DataReader
and implement the following methods:
- help()
- get_data()
"""
from datetime import datetime
import requests
class DataReader(object):
""" Class-level constants that can be defined in code until we get around
to putt... | exleym/IWBT | iwbt/data/readers.py | Python | apache-2.0 | 2,496 |
# Copyright 1999-2000 by Jeffrey Chang. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
# Patches by Mike Poidinger to support multiple databases.
# Updated by Peter Cock in 2007... | poojavade/Genomics_Docker | Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/Bio/Blast/NCBIStandalone.py | Python | apache-2.0 | 74,333 |
# -*- coding: utf-8 -*-
import re
from django.forms import ValidationError, ModelForm, Form, CharField, PasswordInput, TextInput
from django.utils.translation import ugettext_lazy as _
from accounts.models import MyUser
class SignUpForm(ModelForm):
"""
Регистрационная форма.
"""
password = CharField... | IlyaGusev/PoetryCorpus | poetry/apps/accounts/forms.py | Python | apache-2.0 | 2,884 |
# Copyright 2017 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 ... | deepmind/pysc2 | pysc2/lib/renderer_human.py | Python | apache-2.0 | 73,287 |
# Lint as: python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | google/automl-video-ondevice | automl_video_ondevice/object_tracking/mediapipe_track_validator.py | Python | apache-2.0 | 5,835 |
import luigi
from preprocess_data import ScaleDirectorFeatureValues, ScaleTeacherFeatureValues
from split_data import SplitAvgSchoolData, SplitOutstandingSchoolData
class AllDataTasks(luigi.WrapperTask):
def requires(self):
return SplitAvgSchoolData(), SplitOutstandingSchoolData(), ScaleTeacherFeatureVal... | ffmmjj/desafio-dados-2016 | data_preparation_pipeline/run_all_data_tasks.py | Python | apache-2.0 | 356 |
#! /usr/bin/env python3
# Copyright (c) 2015 SONATA-NFV, Thales Communications & Security
# 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/... | cgeoffroy/son-analyze | scripts/all.py | Python | apache-2.0 | 2,996 |
#!/usr/bin/env python3
# Copyright 2014, 2016 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
#
# Unl... | ros-infrastructure/ros_buildfarm | scripts/devel/build_and_test.py | Python | apache-2.0 | 6,218 |
import locale
import os
import uuid
import pytest
from funcy import cached_property
from dvc.utils import env2bool
from .base import Base
from .path_info import CloudURLInfo
TEST_AWS_REPO_BUCKET = os.environ.get("DVC_TEST_AWS_REPO_BUCKET", "dvc-temp")
TEST_AWS_ENDPOINT_URL = "http://127.0.0.1:{port}/"
class S3(Ba... | dmpetrov/dataversioncontrol | tests/remotes/s3.py | Python | apache-2.0 | 4,225 |
"""
Object representing a helper file for an OCR app.
"""
import datetime
from django.db import models
from django.contrib.auth.models import User
from tagging.fields import TagField
import tagging
class OcrModel(models.Model):
"""
OCR model objects.
"""
user = models.ForeignKey(User, related_nam... | vitorio/ocropodium | ocradmin/ocrmodels/models.py | Python | apache-2.0 | 1,928 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# __init__.py
"""
Convert colormaps to amira format
Copyright (c) 2018, David Hoffman
"""
import os
import matplotlib.cm
import colorcet
header = """# AmiraMesh 3D ASCII 2.0
define Lattice {N:d}
Parameters {{
ContentType "Colormap"
MinMax 0 {N:d}{extra:}
}}
L... | david-hoffman/scripts | colormaps.py | Python | apache-2.0 | 1,832 |
# coding=utf-8
# Copyright 2022 The Trax 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 a... | google/trax | trax/tf_numpy/examples/mnist/train_test.py | Python | apache-2.0 | 1,761 |
import functools
import os
import re
import shutil
import subprocess
import sys
import tempfile
from io import StringIO
from subprocess import TimeoutExpired
from catkin_tools.commands.catkin import main as catkin_main
TESTS_DIR = os.path.dirname(__file__)
MOCK_DIR = os.path.join(TESTS_DIR, 'mock_resources')
def c... | catkin/catkin_tools | tests/utils.py | Python | apache-2.0 | 4,974 |
# Copyright 2016-2017 Capital One Services, 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 ... | jdubs/cloud-custodian | tests/test_appelb.py | Python | apache-2.0 | 14,379 |
# Copyright (c) 2012 Cloudera, 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 o... | kapilrastogi/Impala | tests/common/impala_test_suite.py | Python | apache-2.0 | 23,340 |
# 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/optimizers/optimizer_v2/nadam_test.py | Python | apache-2.0 | 6,798 |
# pylint: disable=function-redefined
import copy
import salt.utils.json
import salt.utils.schema as schema
import salt.utils.stringutils
import salt.utils.yaml
from salt.utils.versions import LooseVersion as _LooseVersion
from tests.support.unit import TestCase, skipIf
try:
import jsonschema
import jsonschema... | saltstack/salt | tests/unit/utils/test_schema.py | Python | apache-2.0 | 94,904 |
"""
pyapi-gitlab tests
"""
import unittest2 as unittest
import gitlab
import os
import time
import random
import string
try:
from Crypto.PublicKey import RSA
ssh_test = True
except ImportError:
ssh_test = False
user = os.environ.get('gitlab_user', 'root')
password = os.environ.get('gitlab_password', '5ive... | adfinis-sygroup/pyapi-gitlab | gitlab_tests/pyapi-gitlab_test.py | Python | apache-2.0 | 20,830 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 PolyBeacon, Inc.
#
# Author: Paul Belanger <paul.belanger@polybeacon.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
#
#... | kickstandproject/sarlacc | sarlacc/tests/asterisk/agi/test_wait_for_digit.py | Python | apache-2.0 | 2,080 |
from django_cassandra_engine.serializers import DjangoCassandraModelSerializer
from .models import CassandraAdventuresModel\
, CassandraAdventuresModel_M, CassandraFamilyMember
class CassandraFamilyMemberSerializer(DjangoCassandraModelSerializer):
class Meta:
model = CassandraFamilyMember
f... | LowerSilesians/drf-cassandra-boilerplate | drf_cassandra_boilerplate/api_sample/serializers.py | Python | apache-2.0 | 652 |
# Copyright 2017 IBM Corp.
from zvmconnector import connector
import os
import time
print("Setup client: client=connector.ZVMConnector('9.60.18.170', 8080)\n")
client=connector.ZVMConnector('9.60.18.170', 8080)
print("Test: send_request('vswitch_get_list')")
list = client.send_request('vswitch_get_list')
print("Resu... | mfcloud/python-zvm-sdk | sample/vlan/createvm_vlan_v1s2.py | Python | apache-2.0 | 4,094 |
# 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, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
impor... | dbentley/pants | src/python/pants/pantsd/process_manager.py | Python | apache-2.0 | 18,348 |
#!/usr/bin/env python
import loops
import argparse, itertools, sys, os, json
import gc
import logging, logging.config
import logutils.queue, Queue
import threading, multiprocessing
logger = logging.getLogger(__name__)
def perms(n,r):
assert n >= r
return reduce(lambda x,y: x*y, xrange(n,n-r,-1), 1)
def prefix_si... | rutgers-apl/alive-loops | find-simple-loops.py | Python | apache-2.0 | 8,360 |
import cv2
import cv2.cv
import numpy as np
import time
COLOR_TOLERANCE = 25
# GOLD = (207, 176, 79)
GOLD = (51, 255, 255)
GOLD_MIN = (41, 100, 100)
GOLD_MAX = (61, 255, 255)
# GOLD = (255, 215, 0)
SILVER = (0, 0, int(255 * 0.75))
SILVER_MIN = (0, 0, SILVER[2] * 0.75)
SILVER_MAX = (10, 100, SILVER[2] * 1.25)
# SILV... | jorisroovers/opencv-playground | coin_dectector/coins/detector2.py | Python | apache-2.0 | 7,609 |
# Copyright 2020-2021 The Kubeflow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | kubeflow/pipelines | manifests/kustomize/base/installs/multi-user/pipelines-profile-controller/sync.py | Python | apache-2.0 | 16,824 |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.template.defaultfilters import slugify
from django.conf import settings
from django... | uclastudentmedia/django-massmedia | massmedia/models.py | Python | apache-2.0 | 14,915 |
# Copyright 2011 Nicholas Bray
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | ncbray/pystream | bin/util/application/async.py | Python | apache-2.0 | 1,436 |
# Copyright (c) 2017-2018 {Flair Inc.} WESLEY PENG
#
# 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... | WesleyPeng/uiXautomation | src/test/python/bpt/pages/binghomepage.py | Python | apache-2.0 | 1,210 |
import inspect
import logging
import time
from collections import namedtuple
from datetime import datetime, timedelta
from functools import partial
from threading import Timer
from types import LambdaType
import parsedatetime
WaitForResult = namedtuple("WaitForResult", ["out", "duration"])
calendar = parsedatetime.C... | RedHatQE/wait_for | wait_for/__init__.py | Python | apache-2.0 | 12,038 |
#
# 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
# ... | dims/heat | heat/engine/resources/openstack/keystone/user.py | Python | apache-2.0 | 9,242 |
from devices.models import Platform
from utils.testing import ViewTestCases
class PlatformTestCase(
ViewTestCases.CreateObjectViewTestCase,
ViewTestCases.EditObjectViewTestCase,
ViewTestCases.DeleteObjectViewTestCase,
ViewTestCases.ListObjectsViewTestCase,
):
model = Platform
@classmethod
... | respawner/peering-manager | devices/tests/test_views.py | Python | apache-2.0 | 772 |
for i in zip([1, 2, 3], ['a', 'b', 'c']):
print(i)
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_algorithms/itertools_zip.py | Python | apache-2.0 | 55 |
import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup, NavigableString
from phyllo.phyllo_logger import logger
import nltk
from itertools import cycle
nltk.download('punkt')
from nltk import sent_tokenize
# Case 1: Sections split by numbers (Roman or not) followed b... | oudalab/phyllo | phyllo/extractors/tungerDB.py | Python | apache-2.0 | 3,235 |
# Scripts are mainly used for stress testing of different databases,
# The way to test is to use Python modules to connect database then
# Repeatedly insert data.
#
# You can use this script in the following ways:
# such as:
#
# python db_stresstesting_multi_thread.py -i <mysql_server_ipaddr> -u root \
# ... | JmilkFan/my-code-repertory | DBStressTesting/db_stresstesting_gevent.py | Python | apache-2.0 | 6,680 |
#!/usr/bin/env python3
import sys
from os import listdir, chdir
from os.path import isfile, abspath
UNTIL = '/build/'
REPLACE_WITH = '/b/f/w'
def bangchange(file_path):
script = File(file_path)
if script.flist[0].find("#!") == 0:
if script.flist[0].find(UNTIL) > 0:
print("\033[92m" + "[M... | antmicro/distant-rec | tools/shebang-replace.py | Python | apache-2.0 | 1,211 |
import numpy as np
from sklearn.base import BaseEstimator
import pandas as pd
import operator
from estimator_base import *
from features_base import *
BINARY = "Binary"
CATEGORICAL = "Categorical"
NUMERICAL = "Numerical"
class FeatureMapper:
def __init__(self, features):
self.features = features
... | waynezhanghk/FastCausation | features.py | Python | apache-2.0 | 23,932 |
import sys
from abci.wire import hex2bytes, decode_big_endian, encode_big_endian
from abci.server import ABCIServer
from abci.reader import BytesBuffer
class CounterApplication():
def __init__(self):
sys.exit("The python example is out of date. Upgrading the Python examples is currently left as an exer... | tendermint/tmsp | example/python3/app.py | Python | apache-2.0 | 2,169 |
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.dashboards.groups import dashboard
class Instances(horizon.Panel):
name = _("Groups")
slug = "instances"
dashboard.Groups.register(Instances)
| icloudrnd/automation_tools | openstack_dashboard/dashboards/groups/instances/panel.py | Python | apache-2.0 | 250 |
# Copyright (c) 2015 Scopely, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distrib... | scopely-devops/rolemodel | rolemodel/role.py | Python | apache-2.0 | 1,204 |
import endpoints
from api_user import UserAPI
from api_posts import PostsAPI
from api_comments import ReactionAPI
from api_image import ImageAPI
APPLICATION = endpoints.api_server([PostsAPI, ReactionAPI, UserAPI, ImageAPI]) | secret-transaction/RipOff9Gag | server/ripoff9gag/api.py | Python | apache-2.0 | 225 |
import logging
import json
from skybase.skytask import SkyTask
from skybase.artiball import Artiball
from skybase.utils.logger import Logger
from skybase.actions.dbstate import write_service_state_record
from skybase import skytask
from skybase.planet import Planet
from skybase.utils import simple_error_format
import ... | lithiumtech/skybase.io | skybase/skytask/service/record_state.py | Python | apache-2.0 | 3,815 |
# 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, ... | GoogleCloudPlatform/jupyter-extensions | jupyterlab_gitsync/setup.py | Python | apache-2.0 | 1,836 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Isaku Yamahata <yamahata at private email ne jp>
# <yamahata at valinux co jp>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with... | savi-dev/quantum | quantum/plugins/ryu/nova/linux_net.py | Python | apache-2.0 | 2,805 |
import django.dispatch
# Whenever a permission object is saved, it sends out the signal. This allows
# models to keep their permissions in sync
permission_changed = django.dispatch.Signal(providing_args=('to_whom', 'to_what')) | callowayproject/django-objectpermissions | objectpermissions/signals.py | Python | apache-2.0 | 227 |
from contextlib import ContextDecorator
from unittest import mock
import httpx
import pytest
from util.working_directory import working_directory
from .http import pull_http
class MockedHttpxStreamResponse(ContextDecorator):
"""
VCR does not like recording HTTPX stream requests so mock it.
"""
def... | stencila/hub | worker/jobs/pull/http_test.py | Python | apache-2.0 | 1,623 |
def large_sum(numbers, wanted_digits):
return str(sum(numbers))[:wanted_digits] | plilja/project-euler | problem_13/large_sum.py | Python | apache-2.0 | 83 |
#!/usr/bin/env python
# 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 require... | zhaochao/fuel-web | network_checker/network_checker/net_check/api.py | Python | apache-2.0 | 25,801 |
#!/usr/bin/python
# 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/
import sys
import re
"""Baby Names exercise
Define the extract_names() function below and c... | starlure/google_python_class | babynames/babynames.py | Python | apache-2.0 | 2,697 |
from django.test import TestCase
from zentral.core.secret_engines import decrypt, decrypt_str, encrypt, encrypt_str, rewrap
class ClearTextSecretEngineTestCase(TestCase):
def test_encrypt_default_noop_secret_engine(self):
self.assertEqual(encrypt(b"le temps des cerises", yolo=1, fomo=2),
... | zentralopensource/zentral | tests/secret_engines/test_cleartext.py | Python | apache-2.0 | 1,178 |
from django.conf.urls import include, url
urlpatterns = [
url(r'^$', 'main.views.index', name='index'),
url(r'^register/$', 'main.views.register', name='register'),
url(r'^login/$', 'main.views.login', name='login'),
url(r'^logout/$', 'main.views.logout', name='logout'),
url(r'^create-post/$', 'm... | mosbasik/message_board | main/urls.py | Python | apache-2.0 | 784 |
import time
import threading
from time import gmtime, strftime
from muntjac.api import Button, VerticalLayout, Label, TextArea
from muntjac.terminal.theme_resource import ThemeResource
from muntjac.ui.button import IClickListener
class JSApiExample(VerticalLayout):
def __init__(self):
super(JSApiExamp... | rwl/muntjac | muntjac/demo/sampler/features/commons/JSApiExample.py | Python | apache-2.0 | 4,137 |
# coding=utf-8
# Copyright 2018 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
class ClasspathEntry(object):
"""Represents a java classpath entry.
:API: public
... | twitter/pants | src/python/pants/backend/jvm/tasks/classpath_entry.py | Python | apache-2.0 | 4,098 |
#
# Copyright 2014 Red Hat, Inc.
#
# Author: Nejc Saje <nsaje@redhat.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 requir... | m1093782566/openstack_org_ceilometer | ceilometer/tests/test_coordination.py | Python | apache-2.0 | 8,270 |
WORDS = (
'Aaron',
'Abdul',
'Abe',
'Abel',
'Abraham',
'Abram',
'Adalberto',
'Adam',
'Adan',
'Adolfo',
'Adolph',
'Adrian',
'Agustin',
'Ahmad',
'Ahmed',
'Al',
'Alan',
'Albert',
'Alberto',
'Alden',
'Aldo',
'Alec',
'Alejandro',
'Alex',
'Alexander',
'Alexis',
'Alfonso',
'Alfonzo',
'Alfred',
'Al... | geradcoles/random-name | randomname/lists/names_male.py | Python | apache-2.0 | 28,040 |
# Copyright 2013-2015 Blockbridge Networks, 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 appl... | saeki-masaki/cinder | cinder/volume/drivers/blockbridge.py | Python | apache-2.0 | 21,533 |
"""
Helper utilities for creating and testing benchmarks using NYC Taxi data (yellow_tripdata_sample_2019-01.csv)
found in the tests/test_sets/taxi_yellow_tripdata_samples directory, and used extensively in unittest and
integration tests for Great Expectations.
"""
import os
from typing import List, Optional
f... | great-expectations/great_expectations | tests/performance/taxi_benchmark_util.py | Python | apache-2.0 | 15,245 |
# Copyright (C) 2012-2013 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | hanlind/nova | nova/virt/libvirt/blockinfo.py | Python | apache-2.0 | 22,853 |
from typing import Optional, Tuple, List
import torch
from torch.nn.utils.rnn import PackedSequence, pack_padded_sequence, pad_packed_sequence
from allennlp.modules.augmented_lstm import AugmentedLstm
from allennlp.modules.input_variational_dropout import InputVariationalDropout
from allennlp.common.checks import Confi... | allenai/allennlp | allennlp/modules/stacked_bidirectional_lstm.py | Python | apache-2.0 | 6,459 |
from functools import reduce
from typing import TYPE_CHECKING, List, Optional, Union
import boto3
from boto3.session import Session
from datahub.configuration import ConfigModel
from datahub.configuration.common import AllowDenyPattern
from datahub.emitter.mce_builder import DEFAULT_ENV
if TYPE_CHECKING:
from m... | linkedin/WhereHows | metadata-ingestion/src/datahub/ingestion/source/aws/aws_common.py | Python | apache-2.0 | 3,857 |
#!/usr/bin/python -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/
"""Wordcount exercise
Google's Python class
The main() below is already defined and comp... | bobbyphilip/learn_python | google-python-exercises/basic/wordcount.py | Python | apache-2.0 | 3,007 |
'''
Created on 13/set/2014
@author: Vincenzo Pirrone <pirrone.v@gmail.com>
'''
from conf.node import stations, NAME, DESCRIPTION
from osnf.api import Node, Network, set_network_object
class LocalNode(Node):
def _init_station(self, key, desc):
if not desc.has_key('enabled') or desc['enabled'... | sp4x/osnf | osnf/core.py | Python | apache-2.0 | 1,570 |
# Copyright 2020 The TensorFlow 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 law or agreed to i... | tensorflow/graphics | tensorflow_graphics/geometry/representation/mesh/tests/mesh_test_utils.py | Python | apache-2.0 | 1,686 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Netheos (http://www.netheos.net)
#
# 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 req... | netheosgithub/pcs_api | python/pcs_api/cexceptions.py | Python | apache-2.0 | 3,661 |
# Copyright 2016, 2017 Peter Zybrick and others.
#
# 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... | petezybrick/iote2e | iote2e-pyclient/src/iote2epyclient/processsim/processsimhumiditytomister.py | Python | apache-2.0 | 3,105 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
nmap.py - version and date, see below
Source code : https://bitbucket.org/xael/python-nmap
Author :
* Alexandre Norman - norman at xael.org
Contributors:
* Steve 'Ashcrow' Milner - steve at gnulinux.net
* Brian Bustin - brian at bustin.us
* old.schepperhand
* Joha... | VillanCh/vscanner | vplugin/nmap/nmap.py | Python | apache-2.0 | 41,045 |
#-*- coding: UTF-8 -*-
from numpy import *
import operator
def classifyPerson():
resultList = ['not at all','in small doses','in large doses']
percentTats = float(raw_input("percentage of time spent playing video games?"))
ffMiles = float(raw_input("frequent filter miles earned per year?"))
iceCream = float(raw_in... | xinghalo/DMInAction | src/mlearning/chap02-knn/dating/knn.py | Python | apache-2.0 | 2,943 |
from collections import defaultdict
import paddle.v2.framework.framework as framework
from paddle.v2.framework.backward import append_backward_ops
from paddle.v2.framework.regularizer import append_regularization_ops
__all__ = [
'SGDOptimizer', 'MomentumOptimizer', 'AdagradOptimizer', 'AdamOptimizer',
'Adamax... | pengli09/Paddle | python/paddle/v2/framework/optimizer.py | Python | apache-2.0 | 21,289 |
from pymongo import MongoClient, ASCENDING
from bson.min_key import MinKey
from bson.max_key import MaxKey
from bson import ObjectId, Timestamp
from chunk import Chunk
from chunk_distribution import ChunkDistribution
from config_parser import ConfigParser
from copy import copy, deepcopy
from dateutil import parser
f... | rueckstiess/configparser | mconfcheck.py | Python | apache-2.0 | 9,553 |
from django import template as template_
from django.conf import settings
from django.utils.safestring import mark_safe
from extras.plugins import PluginTemplateExtension
from extras.registry import registry
register = template_.Library()
def _get_registered_content(obj, method, template_context):
"""
Given... | digitalocean/netbox | netbox/extras/templatetags/plugins.py | Python | apache-2.0 | 2,412 |
import requests
import time
import string
import os.path
import urllib2
import sys
import getopt
from time import gmtime, strftime
#variables
class Downloader:
extension = "pdf"
signature = [0x25, 0x50, 0x44, 0x46]
searchChars = ['a', 'a']
outputDir = "downloaded_"
downloaded = []
successCou... | riusksk/riufuzz | tools/coverage/Utilities/Download.py | Python | apache-2.0 | 8,118 |
'''
New Test For cpu bill Operations
1.test vm stop
2.test vm destory
3.test vm live migration
4.test vm clean
@author Antony WeiJiang
'''
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.operations.b... | zstackorg/zstack-woodpecker | integrationtest/vm/simulator/public_billing/test_check_vm_lifecycle_with_cpu_billing.py | Python | apache-2.0 | 3,329 |
import os
import hashlib
import flask
from sparkpost import SparkPost
from infosystem.common import exception
from infosystem.common.subsystem import manager
from infosystem.common.subsystem import operation
_HTML_EMAIL_TEMPLATE = """
<div style="width: 100%; text-align: center">
<h1>{app_name}</h1>
... | samueldmq/infosystem | infosystem/subsystem/user/manager.py | Python | apache-2.0 | 6,277 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.