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 -*-
# Copyright 2016 Yelp 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 ... | Yelp/kafka-utils | tests/util/zookeeper_test.py | Python | apache-2.0 | 15,746 |
#!/usr/bin/env python
import csv, sys
mapping = {}
totalTruth, totalTesting, hit, miss, errors = (0, 0, 0, 0, 0)
with open(sys.argv[1], 'rb') as groundtruth:
reader = csv.reader(groundtruth)
for row in reader:
totalTruth += 1
mapping[(row[1], row[2])] = row[0]
with open(sys.argv[2], 'rb') ... | whoww/peel-flink-kmeans | VarianceBenchmarkResults/AccuracyMeasure.py | Python | apache-2.0 | 815 |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | cp16net/trove | trove/db/sqlalchemy/mappers.py | Python | apache-2.0 | 3,298 |
from molotov.api import pick_scenario, scenario, get_scenarios, setup
from molotov.tests.support import TestLoop, async_test
class TestUtil(TestLoop):
def test_pick_scenario(self):
@scenario(weight=10)
async def _one(self):
pass
@scenario(weight=90)
async def _two(self... | loads/molotov | molotov/tests/test_api.py | Python | apache-2.0 | 2,203 |
"""
IOStore class originated here
https://github.com/BD2KGenomics/hgvm-graph-bakeoff-evaluations/blob/master/scripts/toillib.py
and was then here:
https://github.com/cmarkello/toil-lib/blob/master/src/toil_lib/toillib.py
In a perfect world, this would be deprecated and replaced with Toil's stores.
Actually did t... | vgteam/toil-vg | src/toil_vg/iostore.py | Python | apache-2.0 | 36,706 |
#
# 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
# ... | Hybrid-Cloud/conveyor | conveyor/conveyorheat/engine/resources/huawei/elb/listener.py | Python | apache-2.0 | 9,416 |
import logging
from constance import config
from dateutil.relativedelta import relativedelta
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework i... | saukrIppl/seahub | seahub/api2/endpoints/share_links.py | Python | apache-2.0 | 9,155 |
# Generated by Django 2.1 on 2018-08-13 08:04
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ibms', '0006_auto_20180813_1603'),
]
operations = [
migrations.RenameField(
model_name='serviceprioritymappings',
old_name='co... | parksandwildlife/ibms | ibms_project/ibms/migrations/0007_auto_20180813_1604.py | Python | apache-2.0 | 391 |
"""
Python wrapper for functionality exposed in the TemcaGraph dll.
@author: jayb
"""
from ctypes import *
import logging
import threading
import time
import os
import sys
import numpy as np
from pytemca.image.imageproc import fit_sin
from numpy.ctypeslib import ndpointer
if sys.flags.debug:
rel = "../x64/Debug... | jaybo/OpenCVGraph | TemcaGraphPy/temca_graph.py | Python | apache-2.0 | 21,780 |
# --------------------------------------------------------
# Deformable Convolutional Networks
# Copyright (c) 2016 by Contributors
# Copyright (c) 2017 Microsoft
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Modified by Zheng Zhang
# --------------------------------------------------------
impor... | deepinsight/Deformable-ConvNets | deeplab/core/loader.py | Python | apache-2.0 | 9,374 |
# coding=utf-8
import json
from django.utils.translation import ugettext_lazy as _
from django.http import HttpResponse
import django.views
from django.template import defaultfilters as template_filters
from horizon import tables
from horizon import exceptions
from cloudkittydashboard.api import cloudkitty as api
f... | FNST-OpenStack/cloudkitty-dashboard | cloudkittydashboard/dashboards/project/billing_overview/views.py | Python | apache-2.0 | 14,849 |
# Copyright 2017 reinforce.io. 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... | lefnire/tensorforce | tensorforce/core/optimizers/subsampling_step.py | Python | apache-2.0 | 4,026 |
# -*- coding: utf-8 -*-
# Copyright 2015 OpenMarket Ltd
#
# 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... | iot-factory/synapse | synapse/rest/client/v2_alpha/tokenrefresh.py | Python | apache-2.0 | 2,090 |
#
# 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/heat | heat/tests/openstack/sahara/test_data_source.py | Python | apache-2.0 | 4,214 |
###########################################################################
#
# 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/l... | google/starthinker | cloud_function/main.py | Python | apache-2.0 | 1,752 |
# Copyright 2015-2017 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 req... | meidli/yabgp | yabgp/message/attribute/linkstate/__init__.py | Python | apache-2.0 | 3,042 |
"""Support for the Italian train system using ViaggiaTreno API."""
import asyncio
import logging
import time
import aiohttp
import async_timeout
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import ATTR_ATTRIBUTION, HTTP_OK, TIME_MINUTES
im... | lukas-hetzenecker/home-assistant | homeassistant/components/viaggiatreno/sensor.py | Python | apache-2.0 | 5,443 |
import urllib, urllib2, sys, httplib
url = "/MELA/REST_WS"
HOST_IP="109.231.126.217:8180"
#HOST_IP="localhost:8180"
if __name__=='__main__':
connection = httplib.HTTPConnection(HOST_IP)
description_file = open("./costTest.xml", "r")
body_content = description_file.read()
headers={
... | tuwiendsg/MELA | MELA-Extensions/MELA-ComplexCostEvaluationService/tests/mela-clients/submitServiceDescription.py | Python | apache-2.0 | 589 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author: yyg
@Create: 2016MMDD
@LastUpdate: 2016-12-15 HH:MM:SS
@Version: 0.0
"""
from json import load
from logging import (Formatter, _defaultFormatter, exception,
getLogger, FileHandler, basicCon... | hipnusleo/laserjet | lib/core/loggers.py | Python | apache-2.0 | 1,506 |
#!/usr/bin/env python
# Written against python 3.3.1
# Matasano Problem 3
# The hex encoded string:
# 1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736
# has been XOR'd against a single character. Find the key, decrypt
# the message.
# Some of the 'magic' in this comes from a college crypto... | reschly/cryptopals | prob3.py | Python | apache-2.0 | 2,592 |
#!/usr/bin/env python3
"""
./e09asynctwostage.py http://camlistore.org 1 6
Found 10 urls
http://camlistore.org/ frequencies: [('camlistore', 13), ...]
...
First integer arg is depth, second is minimum word count.
"""
import re
from sys import argv
import asyncio
from e01extract import canonicalize
from e04twostage... | bslatkin/pycon2014 | e09asynctwostage.py | Python | apache-2.0 | 2,046 |
#!/usr/bin/python
# Copyright 2014 IBM Corp
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | litong01/python-monasca | kiloeyes/tests/setup_metrics.py | Python | apache-2.0 | 3,665 |
# 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... | openstack/swift | test/unit/container/test_reconciler.py | Python | apache-2.0 | 96,529 |
"""Test suite for abdt_rbranchnaming."""
# =============================================================================
# TEST PLAN
# -----------------------------------------------------------------------------
# Here we detail the things we are concerned to test and specify which te... | valhallasw/phabricator-tools | py/abd/abdt_rbranchnaming__t.py | Python | apache-2.0 | 3,352 |
import difflib
import inflect
import itertools
import logging
import netaddr
import os
import re
import toposort
import yaml
import hotcidr.state
def inflect_a(s, p=inflect.engine()):
x = p.plural(s)
if p.compare(s, x) == 'p:s':
return s
return p.a(s)
logging.basicConfig(format='%(levelname)s %(me... | ViaSat/hotcidr | HotCIDR/hotcidr/validation.py | Python | apache-2.0 | 8,940 |
# -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | googleapis/python-aiplatform | google/cloud/aiplatform/explain/metadata/metadata_builder.py | Python | apache-2.0 | 1,054 |
#!/usr/bin/env python
"""
Demonstrate use of pysnmp walks
"""
import sys
import re
from pysnmp.entity.rfc3413.oneliner import cmdgen
cmdGen = cmdgen.CommandGenerator()
devip = sys.argv.pop(1)
errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.nextCmd(
cmdgen.CommunityData('server', 'galileo', 1),
... | patrebert/pynet_cert | class2/walk2.py | Python | apache-2.0 | 1,368 |
#! /usr/bin/env python
# Very basic script template. Use this to build new
# examples for use in the api-kickstart repository
#
""" Copyright 2015 Akamai Technologies, 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 L... | dshafik/api-kickstart | examples/python/cloudlet_edge_redirector.py | Python | apache-2.0 | 4,551 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tiagofrepereira2012/tensorflow | tensorflow/python/util/nest.py | Python | apache-2.0 | 21,628 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | manjunaths/tensorflow | tensorflow/tensorboard/plugins/debugger/plugin_test.py | Python | apache-2.0 | 3,406 |
# 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... | jiahaoliang/group-based-policy | gbpservice/neutron/tests/unit/services/grouppolicy/test_group_proxy_extension.py | Python | apache-2.0 | 8,529 |
# Copyright 2019 Canonical Ltd
#
# 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, s... | coreycb/charms.openstack | charms_openstack/plugins/__init__.py | Python | apache-2.0 | 1,179 |
# Copyright 2015, 2017 IBM Corp.
#
# 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... | phenoxim/nova | nova/virt/powervm/tasks/storage.py | Python | apache-2.0 | 14,010 |
"""
Class representing an exponential distribution, allowing us to sample from it.
"""
from numpy.random import exponential
# Exponential draws
def exponential_draw(lambdax):
scale = 1.0 / lambdax
return exponential(scale=scale,size=None)
'''
# Do 1000 draws and plot them
import matplotlib.pyplot as p... | ThomasBrouwer/BNMTF | code/models/distributions/exponential.py | Python | apache-2.0 | 569 |
# 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... | souravbadami/oppia | core/storage/exploration/gae_models.py | Python | apache-2.0 | 26,280 |
# -*- coding: utf-8 -*-
'''
The function cache system allows for data to be stored on the master so it can be easily read by other minions
'''
# Import python libs
import copy
import logging
# Import salt libs
import salt.crypt
import salt.payload
log = logging.getLogger(__name__)
def _auth():
'''
Return ... | victorywang80/Maintenance | saltstack/src/salt/modules/mine.py | Python | apache-2.0 | 6,869 |
from setuptools import find_packages
from os import path, environ
import io
import os
import re
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy as np
def read(*names, **kwargs):
with io.open(
os.path.join(os.path.dirname(__file__... | toinsson/pyrealsense | setup.py | Python | apache-2.0 | 2,524 |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import unittest
from mock import patch
from nose.tools import assert_equals, assert_raises
import pygenie
from ..utils import FakeRunningJob
assert_equals.__self__.maxDiff = None
@pygenie.adapter.genie_3.set_jobname
def... | ajoymajumdar/genie | genie-client/src/main/python/tests/job_tests/test_geniejob.py | Python | apache-2.0 | 12,048 |
# 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 | tests/python/relay/op/annotation/test_annotation.py | Python | apache-2.0 | 2,947 |
#
# SNMPv1 message syntax
#
# ASN.1 source from:
# http://www.ietf.org/rfc/rfc1157.txt
#
# Sample captures from:
# http://wiki.wireshark.org/SampleCaptures/
#
from pyasn1.type import univ, namedtype, namedval, tag
from pyasn1_modules import rfc1155
class Version(univ.Integer):
namedValues = namedval.NamedValues(
... | itielshwartz/BackendApi | lib/pyasn1_modules/rfc1157.py | Python | apache-2.0 | 3,309 |
import webapp2
from google.appengine.ext import db
import logging
import charbuilder
import traits
import traceback
import random
import string
instance_key = "".join(
(random.choice(string.ascii_uppercase + string.digits) for i in xrange(25)))
def getFile(_file):
with open(_file, "r") as f: return f.read().re... | jtsmith1287/gurpscg | main.py | Python | apache-2.0 | 5,971 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
AUTHOR : MIN
PURPOSE : the deep learning CNN model, similar as inception
VERSION : 0.1
DATE : 4.2017
"""
__author__ = 'Min'
import math
import time
import tensorflow as tf
from datetime import datetime
NUM_CLASSES = 50
slim = tf.contrib.slim
# 产生截断的正太分布
# pro... | HeavenMin/PlantImageRecognition | deepLearning/flowerNet.py | Python | apache-2.0 | 19,281 |
from django.conf.urls.defaults import patterns # noqa
from django.conf.urls.defaults import url # noqa
from openstack_dashboard.dashboards.fogbow.usage import views
from openstack_dashboard.dashboards.fogbow.usage.views import IndexView
urlpatterns = patterns('',
url(r'^$', IndexView.as_view(), name='index'),
... | fogbow/fogbow-dashboard | openstack_dashboard/dashboards/fogbow/usage/urls.py | Python | apache-2.0 | 404 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2014 IBM Corporation
# Copyright 2015 Lenovo
#
# 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/LI... | michaelfardu/thinkconfluent | confluent_server/confluent/messages.py | Python | apache-2.0 | 21,993 |
# Copyright (c) 2014 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 r... | CiscoSystems/nova-solver-scheduler | nova/tests/scheduler/solvers/constraints/test_aggregate_image_properties_isolation.py | Python | apache-2.0 | 2,908 |
# Copyright 2016 Presslabs SRL
#
# 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,... | PressLabs/cobalt | tests/unit/cobalt/test_cobalt.py | Python | apache-2.0 | 650 |
import resume.models as rmod
import random
import logging
from django.http import HttpResponse
from datetime import date
logger = logging.getLogger('default')
def generate(request):
cs_objs = rmod.Department.objects.filter(shortname='cs')
if len(cs_objs) == 0:
logger.info('created cs dept')
cs = rmod.Depa... | brownplt/k3 | dj-resume/resume/generate.py | Python | apache-2.0 | 3,738 |
import cython
def test_sizeof():
"""
>>> test_sizeof()
True
True
True
True
True
"""
x = cython.declare(cython.bint)
print(cython.sizeof(x) == cython.sizeof(cython.bint))
print(cython.sizeof(cython.char) <= cython.sizeof(cython.short) <= cython.sizeof(cython.int) <= cython.si... | bzzzz/cython | tests/run/pure_py.py | Python | apache-2.0 | 4,851 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 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... | redhat-cip/dci-control-server | tests/api/v1/test_issues.py | Python | apache-2.0 | 15,798 |
import os
from dataclasses import dataclass
from typing import Iterable
from dbt.contracts.graph.manifest import SourceFile
from dbt.contracts.graph.parsed import ParsedSqlNode, ParsedMacro
from dbt.contracts.graph.unparsed import UnparsedMacro
from dbt.exceptions import InternalException
from dbt.node_types import No... | analyst-collective/dbt | core/dbt/parser/sql.py | Python | apache-2.0 | 2,013 |
"""Test the Balboa Spa Client config flow."""
from unittest.mock import patch
from homeassistant import config_entries, data_entry_flow
from homeassistant.components.balboa.const import CONF_SYNC_TIME, DOMAIN
from homeassistant.config_entries import SOURCE_USER
from homeassistant.const import CONF_HOST
from homeassist... | jawilson/home-assistant | tests/components/balboa/test_config_flow.py | Python | apache-2.0 | 5,737 |
# 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... | UTSA-ICS/keystone-kerberos | keystone/tests/unit/test_cache_backend_mongo.py | Python | apache-2.0 | 27,559 |
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | jjmleiro/hue | desktop/libs/aws/src/aws/s3/s3fs.py | Python | apache-2.0 | 11,345 |
# Copyright 2017 SAS Project 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 requ... | gregbillock/Spectrum-Access-System | src/prop/model.py | Python | apache-2.0 | 6,985 |
# 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... | tensorflow/benchmarks | scripts/tf_cnn_benchmarks/variable_mgr_util.py | Python | apache-2.0 | 26,469 |
from bson import ObjectId
import jsonschema
import numpy
from girder.exceptions import ValidationException
from girder.models.file import File
from girder.models.model_base import Model
from girder.models.upload import Upload
from girder.utility.acl_mixin import AccessControlMixin
from .image import Image
from .segme... | ImageMarkup/isic-archive | isic_archive/models/annotation.py | Python | apache-2.0 | 10,692 |
#!/usr/bin/env python
#
# 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 writin... | matteobertozzi/RaleighSL | src/raleigh-client/pyraleigh/sql/expr.py | Python | apache-2.0 | 14,678 |
"""Plugin common functions."""
import logging
import os
import re
import shutil
import tempfile
import OpenSSL
import pkg_resources
import zope.interface
from acme.jose import util as jose_util
from certbot import constants
from certbot import crypto_util
from certbot import errors
from certbot import interfaces
fro... | jsha/letsencrypt | certbot/plugins/common.py | Python | apache-2.0 | 16,182 |
#
# 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 w... | sassoftware/mint | mint/rest/middleware/error.py | Python | apache-2.0 | 3,212 |
#!/usr/local/bin/python3
# Find the number of elements of a list
def lenOf(mylist):
return (len(mylist))
print (lenOf("Hello"))
print (lenOf(""))
print (lenOf([123,123,123]))
| mocovenwitch/haskell-learning-notes | python/problem04.py | Python | apache-2.0 | 181 |
#!/usr/bin/python
#credits : https://gist.github.com/TheCrazyT/11263599
import socket
import ssl
import select
import time
import re
import sys
from thread import start_new_thread
from struct import pack
from random import randint
from subprocess import call
import os
import fnmatch
import argparse
import logging
c... | srirajan/lakkucast | lakkucast.py | Python | apache-2.0 | 21,535 |
import os
import sys
def test(arg):
return os.system('bin/nosetests -s -d -v %s' % arg)
def main(args):
if not args:
print("Run as bin/python run_failure.py <test>, for example: \n"
"bin/python run_failure.py "
"kazoo.tests.test_watchers:KazooChildrenWatcherTests")
... | bsanders/kazoo | run_failure.py | Python | apache-2.0 | 536 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | rouge/tokenizers.py | Python | apache-2.0 | 1,661 |
# Copyright 2012 NetApp
# 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 applic... | sniperganso/python-manilaclient | manilaclient/v2/share_snapshots.py | Python | apache-2.0 | 6,363 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from textwrap import dedent
import pytest
from pants.backend.docker.subsystems.dockerfile_parser import rules as parser_rules
from pants.backend.docke... | patricklaw/pants | src/python/pants/backend/docker/util_rules/docker_build_context_test.py | Python | apache-2.0 | 7,173 |
__all__ = [
'ComponentStore',
]
from pathlib import Path
import copy
import requests
from typing import Callable
from . import _components as comp
from .structures import ComponentReference
class ComponentStore:
def __init__(self, local_search_paths=None, url_search_prefixes=None):
self.local_search_p... | kubeflow/kfp-tekton-backend | sdk/python/kfp/components/_component_store.py | Python | apache-2.0 | 6,197 |
from django.apps import AppConfig
class BugzConfig(AppConfig):
name = 'Bugz'
| jessica-younker/I-Got-Bugs | api/Bugz/apps.py | Python | apache-2.0 | 83 |
from django import template
import randomcolor
register = template.Library()
CATEGORY_NAMES = {
'cs.AI': 'Artificial Intelligence',
'cs.CL': 'Computation and Language',
'cs.CC': 'Computational Complexity',
'cs.CE': 'Computational Engineering',
'cs.CG': 'Computational Geometry',
'cs.GT': 'Game ... | arxiv-vanity/arxiv-vanity | arxiv_vanity/papers/templatetags/papers.py | Python | apache-2.0 | 1,851 |
import os
import csv
def get_value_or_default(value, default=None):
result = value.strip()
if len(result) == 0:
result = default
return result
def read_csv_file(csv_file_name,
delimiter,
quote_char='"',
skip_header=True,
e... | CALlanoR/virtual_environments | medical_etls/part1/etls/utils.py | Python | apache-2.0 | 607 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2022, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
from unittest import TestCase
import numpy as np
import pandas as pd
import h5py
from exatomic import Universe
from exatomic.base import resource
from exatomic.molcas.output import O... | exa-analytics/exatomic | exatomic/molcas/tests/test_output.py | Python | apache-2.0 | 8,381 |
# Copyright 2011 James McCauley
#
# This file is part of POX.
#
# POX is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# POX is distri... | PrincetonUniversity/AdvNet-OF_Scripts | evaluation/switch/flowmod_test/pox/pox/samples/l2_bell_burst_mod.py | Python | apache-2.0 | 7,313 |
# -*- 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
#... | owlabs/incubator-airflow | tests/contrib/hooks/test_gcp_video_intelligence_hook.py | Python | apache-2.0 | 3,290 |
#!/usr/bin/env python
"""
conference.py -- Udacity conference server-side Python App Engine API;
uses Google Cloud Endpoints
$Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $
created by wesc on 2014 apr 21
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
from datetime import datetime
import ... | befeltingu/UdacityFinalProject4 | conference.py | Python | apache-2.0 | 33,399 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.23
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | kubernetes-client/python | kubernetes/client/models/v1_server_address_by_client_cidr.py | Python | apache-2.0 | 5,238 |
# Copyright 2014 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... | saeki-masaki/cinder | cinder/openstack/common/report/views/text/process.py | Python | apache-2.0 | 1,233 |
#
# OpenCenter(TM) is Copyright 2013 by Rackspace US, Inc.
##############################################################################
#
# OpenCenter is licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. This
# version of ... | rcbops/opencenter | tests/test_expressions.py | Python | apache-2.0 | 11,034 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2017 Georgi Georgiev
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with th... | ge0rgi/cinder | cinder/volume/manager.py | Python | apache-2.0 | 211,218 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/as_external_lsa/__init__.py | Python | apache-2.0 | 19,446 |
__author__ = 'thatcher'
from django.contrib import admin
# from django.contrib.auth.models import User
# from django.contrib.auth.admin import UserAdmin
# from django.contrib.sessions.
from django.contrib.sessions.models import Session
from .models import *
from base.forms import *
def images_thubmnail(self):
ret... | ZmG/trywsk | base/admin.py | Python | apache-2.0 | 1,654 |
#!/usr/bin/python
import json
import time
import parcon
import operator
import pprint
import os
import sys
import getopt
import re
import optparse
import string
import hashlib
import parse_objc as parser
import sign
#### tool version:
VERSION = parser.VERSION
VERSION_STR = sign.source_file_signature(__file__, VERSION... | korovkin/WNNotifier | notifier/gen_notifier.py | Python | apache-2.0 | 23,166 |
# Lint as: python3
# Copyright 2020 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 ... | tombstone/models | research/delf/delf/python/training/model/export_global_model.py | Python | apache-2.0 | 5,972 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# 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... | meowlab/shadowsocks-comment | shadowsocks/lru_cache.py | Python | apache-2.0 | 4,886 |
#!/usr/bin/env python
def run_test(n, m, power, bullet):
prev_dict = {}
cur_dict = {}
for i in xrange(n):
ri = n-1-i
for j in xrange(m):
if i == 0:
cur_dict[power[ri][j]] = power[ri][j]
else:
new_k = power[ri][j]
for k... | SwordYoung/cutprob | hackerrank/contest/w13/a-super-hero/a.py | Python | artistic-2.0 | 1,849 |
import ptypes, pecoff
from ptypes import *
from . import error, ldrtypes, rtltypes, umtypes, ketypes, Ntddk, heaptypes, sdkddkver
from .datatypes import *
class PEB_FREE_BLOCK(pstruct.type): pass
class PPEB_FREE_BLOCK(P(PEB_FREE_BLOCK)): pass
PEB_FREE_BLOCK._fields_ = [(PPEB_FREE_BLOCK, 'Next'), (ULONG, 'Size')]
cla... | arizvisa/syringe | lib/ndk/pstypes.py | Python | bsd-2-clause | 57,087 |
import ConfigParser
from .settings import SECTIONS, CONFIG
config = ConfigParser.ConfigParser()
config.read(CONFIG)
if not config.has_section(SECTIONS['INCREMENTS']):
config.add_section(SECTIONS['INCREMENTS'])
with open(CONFIG, 'w') as f:
config.write(f)
def read_since_ids(users):
"""
Read ... | wenli810620/twitter-photos | twphotos/increment.py | Python | bsd-2-clause | 1,165 |
#!/usr/bin/env python3
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2020 Antmicro <www.antmicro.com>
# Copyright (c) 2019 David Shah <dave@ds0.me>
# SPDX-License-Identifier: BSD-2-Clause
import os
import argparse
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
from litex_bo... | litex-hub/litex-boards | litex_boards/targets/xilinx_zcu104.py | Python | bsd-2-clause | 4,423 |
from JumpScale import j
from GitFactory import GitFactory
j.base.loader.makeAvailable(j, 'clients')
j.clients.git = GitFactory()
| Jumpscale/jumpscale6_core | lib/JumpScale/baselib/git/__init__.py | Python | bsd-2-clause | 131 |
def fat(n):
result = 1
while n > 0:
result = result * n
n = n - 1
return result
# testes
print("Fatorial de 3: ", fat(3));
| Gigers/data-struct | algoritimos/Python/fatorial-while.py | Python | bsd-2-clause | 158 |
import warnings
class DeprecatedCallableStr(str):
do_no_call_in_templates = True
def __new__(cls, value, *args, **kwargs):
return super(DeprecatedCallableStr, cls).__new__(cls, value)
def __init__(self, value, warning, warning_cls):
self.warning, self.warning_cls = warning, warning_cls
... | takeflight/wagtailnews | wagtailnews/deprecation.py | Python | bsd-2-clause | 609 |
# --------------------------------------------------------
# TensorFlow for Dragon
# Copyright(c) 2017 SeetaTech
# Written by Ting Pan
# -------------------------------------------------------- | neopenx/Dragon | Dragon/python/dragon/vm/tensorflow/training/__init__.py | Python | bsd-2-clause | 193 |
import sympy.core.cache
# Why doesn't it work to use "import sympy.core.compatibility" and call "with_metaclass" as "sympy.core.compatibility.with_metaclass"?
from sympy.core.compatibility import with_metaclass
from sympy.core.function import AppliedUndef, FunctionClass
from sympy.core.core import BasicMeta
from sympy... | LindaLinsefors/EinSumConv | EinSumConv/tensor.py | Python | bsd-2-clause | 6,432 |
#
# Sending emails in combination
# with Motion surveillance software
#
# (c) Dr. Yves J. Hilpisch
# The Python Quants GmbH
#
import smtplib
from datetime import datetime
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
def prompt(prompt):
return raw_input(prompt).strip()
fromad... | yhilpisch/rpi | doc/_store/mail.py | Python | bsd-2-clause | 1,304 |
from actstream.models import Action
from django.test import TestCase
from cyidentity.cyfullcontact.tests.util import create_sample_contact_info
class FullContactActivityStreamTestCase(TestCase):
def test_contact_create(self):
contact_info = create_sample_contact_info()
action = Action.objects.acto... | shawnhermans/cyborgcrm | cyidentity/cyfullcontact/tests/test_activity_stream.py | Python | bsd-2-clause | 433 |
#!/usr/bin/env python3
# Copyright (C) 2016 Job Snijders <job@instituut.net>
#
# This file is part of rtrsub
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above co... | job/rtrsub | setup.py | Python | bsd-2-clause | 3,054 |
# -*- coding: utf-8 -*-
"""
Barycenters
===========
This example shows three methods to compute barycenters of time series.
For an overview over the available methods see the :mod:`tslearn.barycenters`
module.
*tslearn* provides three methods for calculating barycenters for a given set of
time series:
* *Euclidean b... | rtavenar/tslearn | tslearn/docs/examples/clustering/plot_barycenters.py | Python | bsd-2-clause | 3,323 |
import pump
import pump_bfd
class BFDSinkEx(pump_bfd.BFDSink):
def __init__(self, opts, spec, source_bucket, source_node,
source_map, sink_map, ctl, cur):
super(pump_bfd.BFDSink, self).__init__(opts, spec, source_bucket, source_node,
source_map, sink_... | TOTVS/mdmpublic | couchbase-cli/lib/python/pump_bfd2.py | Python | bsd-2-clause | 1,621 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django_google_dork.models
import model_utils.fields
import django.utils.timezone
class Migration(migrations.Migration):
replaces = [('django_google_dork', '0001_initial'), ('django_google_dork', '0002... | chgans/django-google-dork | django_google_dork/migrations/0001_initial.py | Python | bsd-2-clause | 4,143 |
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "Amazon Mechanical Turk"
prefix = "mechanicalturk"
class Action(BaseAction):
def __init__(self, action: str = None) -> ... | cloudtools/awacs | awacs/mechanicalturk.py | Python | bsd-2-clause | 4,190 |
# Copyright (c) 2020, DjaoDjin inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | djaodjin/djaodjin-survey | survey/api/campaigns.py | Python | bsd-2-clause | 3,013 |
import unittest
from nose2 import events, loader, session
from nose2.plugins.loader import functions
from nose2.tests._common import TestCase
class TestFunctionLoader(TestCase):
def setUp(self):
self.session = session.Session()
self.loader = loader.PluggableTestLoader(self.session)
self.p... | ptthiem/nose2 | nose2/tests/unit/test_functions_loader.py | Python | bsd-2-clause | 1,464 |