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 2011 Justin Santa Barbara # 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...
NeCTAR-RC/cinder
cinder/api/v1/snapshots.py
Python
apache-2.0
8,175
import pytest import doctest from insights.parsers import docker_inspect, SkipException from insights.tests import context_wrap DOCKER_CONTAINER_INSPECT = """ [ { "Id": "97d7cd1a5d8fd7730e83bb61ecbc993742438e966ac5c11910776b5d53f4ae07", "Created": "2016-06-23T05:12:25.433469799Z", "Path": "/bin/bash", ...
RedHatInsights/insights-core
insights/parsers/tests/test_docker_inspect.py
Python
apache-2.0
10,303
# Copyright 2012-2014 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file ac...
pplu/botocore
tests/__init__.py
Python
apache-2.0
17,369
#!/usr/bin/env python """ Ex 1. Construct a script that retrieves NAPALM facts from two IOS routers, two Arista switches, and one Junos device. pynet-rtr1 (Cisco IOS) 184.105.247.70 pynet-rtr2 (Cisco IOS) 184.105.247.71 pynet-sw1 (Arista EOS) 184.105.247.72 pynet-sw2 (Arista EOS) 184.105.247.73 ​juniper-srx...
jrslocum17/pynet_test
Bonus3/napalm_get_model.py
Python
apache-2.0
1,612
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2011 Justin Santa Barbara # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance wi...
alexandrucoman/vbox-nova-driver
nova/utils.py
Python
apache-2.0
42,459
# Copyright 2014 Google Inc. All rights reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agre...
dhamaniasad/caniusepython3
caniusepython3/test/test_command.py
Python
apache-2.0
1,792
import fractions import math print('PI =', math.pi) f_pi = fractions.Fraction(str(math.pi)) print('No limit =', f_pi) for i in [1, 6, 11, 60, 70, 90, 100]: limited = f_pi.limit_denominator(i) print('{0:8} = {1}'.format(i, limited))
jasonwee/asus-rt-n14uhp-mrtg
src/lesson_mathematics/fractions_limit_denominator.py
Python
apache-2.0
249
#!/usr/bin/python import sqlite3 conn = sqlite3.connect('accesslist.db') conn.execute('''CREATE TABLE USUARIO (CELLPHONE CHAR(11) PRIMARY KEY NOT NULL, PASSWD CHAR(138) NOT NULL);''') print "Table created successfully"; conn.close()
aepereyra/smslock
creatabla.py
Python
apache-2.0
264
import random import requests import shutil import logging import os import traceback import ujson from typing import List, Dict, Any, Optional, Set, Callable, Iterable, Tuple, TypeVar from django.forms.models import model_to_dict from zerver.models import Realm, RealmEmoji, Subscription, Recipient, \ Attachment,...
jackrzhang/zulip
zerver/data_import/import_util.py
Python
apache-2.0
21,272
# Copyright 2012 Managed I.T. # # Author: Kiall Mac Innes <kiall@managedit.ie> # # 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...
openstack/designate
designate/tests/unit/test_context.py
Python
apache-2.0
3,468
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
beomyeol/models
inception/inception/slim/ops.py
Python
apache-2.0
18,781
#!/usr/bin/python __version__='0.2.1' import argparse import logging import os import os.path import sys import requests import getpass import ConfigParser def _persist( export, rcfile ): f = open( rcfile, 'w' ) logging.debug( "writing to {}".format( rcfile ) ) f.write( "\n".join( export ) ) f.close(...
FredHutch/swift-switch-account
sw2account/sw2account.py
Python
apache-2.0
11,887
# Copyright 2021 DeepMind Technologies Limited. 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 ...
deepmind/deepmind-research
nfnets/resnet.py
Python
apache-2.0
7,567
# Copyright 2019 kubeflow.org. # # 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,...
kubeflow/kfserving-lts
test/e2e/predictor/test_torchserve.py
Python
apache-2.0
2,082
# -*- coding: utf-8 -*- import os basedir=os.path.abspath(os.path.dirname(__file__))#get basedir of the project WTF_CSRF_ENABLED = True SECRET_KEY = 'you-will-guess' #for database # SQLALCHEMY_DATABASE_URI = 'mysql:///' + os.path.join(basedir, 'app.db') SQLALCHEMY_DATABASE_URI = "mysql://username:password@server_ip:...
SpeedMe/leihuang.org
config.py
Python
apache-2.0
665
# Copyright (C) 2013 eNovance SAS <licensing@enovance.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...
openstack/tempest
tempest/api/object_storage/test_container_acl_negative.py
Python
apache-2.0
10,958
# Copyright 2017 AT&T Intellectual Property. All other 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...
att-comdev/drydock
tests/unit/test_reference_resolver.py
Python
apache-2.0
2,055
__author__ = 'ray' import wave import numpy as np wav_1_path = "origin.wav" wav_2_path = "clap.wav" wav_out_path = "mixed.wav" wav_1 = wave.open(wav_1_path, 'rb') wav_2 = wave.open(wav_2_path, 'rb') wav_out = wave.open(wav_out_path, 'wb') len_1 = wav_1.getnframes() len_2 = wav_2.getnframes() if len_1>len_2: w...
raybrshen/pattern_recognition
noise_detection/tools/mix_wav.py
Python
apache-2.0
864
# Copyright 2017, Google 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 by applicable law or a...
tseaver/gcloud-python
videointelligence/tests/unit/gapic/v1beta2/test_video_intelligence_service_client_v1beta2.py
Python
apache-2.0
3,394
import asyncio from functools import partial class AsyncWrapper: def __init__(self, target_instance, executor=None): self._target_inst = target_instance self._loop = asyncio.get_event_loop() self._executor = executor def __getattribute__(self, name): try: return su...
KeepSafe/translation-real-time-validaton
notifier/executor.py
Python
apache-2.0
708
# Copyright 2018 Mycroft AI 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 writin...
linuxipho/mycroft-core
mycroft/skills/skill_data.py
Python
apache-2.0
5,706
#!/usr/bin/env python # Copyright 2015-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 ...
Yelp/paasta
paasta_tools/monitoring/check_mesos_active_frameworks.py
Python
apache-2.0
1,748
""" @author waziz """ import logging import sys import traceback import os import argparse import numpy as np from functools import partial from multiprocessing import Pool from chisel.decoder import MBR, MAP, consensus from chisel.util.iotools import read_sampled_derivations, read_block, list_numbered_files from chise...
wilkeraziz/chisel
python/chisel/fast_consensus.py
Python
apache-2.0
6,459
#!/usr/bin/env python # # Copyright 2011 Google Inc. All Rights Reserved. import unittest from google.appengine.api import files from google.appengine.ext import db from mapreduce import control from mapreduce import model from mapreduce import output_writers from mapreduce import test_support from testlib impor...
bslatkin/8-bits
appengine-mapreduce/python/test/mapreduce/output_writers_end_to_end_test.py
Python
apache-2.0
7,023
# Copyright (c) 2015 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 ...
mandeepdhami/neutron
neutron/agent/l3/dvr_local_router.py
Python
apache-2.0
20,535
# -*- coding: utf-8 -*- # Copyright (c) 2015-2016 MIT Probabilistic Computing Project # 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 # Unles...
probcomp/cgpm
src/cgpm.py
Python
apache-2.0
7,812
#!/usr/bin/env python # Copyright 2015 ARM Limited # # Licensed under the Apache License, Version 2.0 # See LICENSE file for details. # standard library modules, , , import unittest import os import tempfile # internal modules: from yotta.lib.fsutils import mkDirP, rmRf from yotta.lib.detect import systemDefaultTarg...
BlackstoneEngineering/yotta
yotta/test/ignores.py
Python
apache-2.0
6,131
"""Gauge watcher configuration.""" # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation. # Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer. # Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd. # Copyright (C) 2015--2017 The Contributors # # Licensed under the Apac...
byllyfish/faucet
faucet/watcher_conf.py
Python
apache-2.0
2,593
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-07-10 07:31 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('person', '0049_patient_photo'), ] operations = [ migrations.RenameField( ...
nanomolina/JP
src/odontology/person/migrations/0050_auto_20160710_0431.py
Python
apache-2.0
422
#!/usr/bin/env python # Copyright 2012 Google Inc. All Rights Reserved. """Tests for grr.lib.flows.general.services.""" from grr.lib import aff4 from grr.lib import rdfvalue from grr.lib import test_lib class ServicesTest(test_lib.FlowTestsBaseclass): def testEnumerateRunningServices(self): class ClientMo...
MiniSEC/GRR_clone
lib/flows/general/services_test.py
Python
apache-2.0
1,398
"""Converting BAM to BEDPE and normalized BigWig files.""" import os from resolwe.process import ( Cmd, DataField, FileField, FloatField, Process, SchedulingClass, StringField, ) class BamToBedpe(Process): """Takes in a BAM file and calculates a normalization factor in BEDPE format. ...
genialis/resolwe-bio
resolwe_bio/processes/support_processors/bam_conversion.py
Python
apache-2.0
4,807
# The content of this file was generated using the Python profile of libCellML 0.2.0. from enum import Enum from math import * __version__ = "0.3.0" LIBCELLML_VERSION = "0.2.0" STATE_COUNT = 1 VARIABLE_COUNT = 2 class VariableType(Enum): VARIABLE_OF_INTEGRATION = 1 STATE = 2 CONSTANT = 3 COMPUTED_...
nickerso/libcellml
tests/resources/generator/dependent_eqns/model.py
Python
apache-2.0
1,256
#!/usr/bin/env python # BEGIN ALL import rospy import math from std_msgs.msg import String from geometry_msgs.msg import Twist key_mapping = { 'w': [ 0, 1], 'x': [ 0, -1], 'a': [ 1, 0], 'd': [-1, 0], 's': [ 0, 0] } g_twist_pub = None g_target_twist = None g_last_twist = None g_last_...
osrf/rosbook
teleop_bot/keys_to_twist_with_ramps.py
Python
apache-2.0
2,634
# -*- coding: utf-8 -*- from tm import TuringMachine class TuringMachineBuilder: """ Creates a turing machine step by step by retrieving all the necessary information. By default (can be specified) sets the halt state to 'HALT and the blank symbol to '#' """ def __init__(self): ...
jainpranav/Turing_Machine_Simulator
Simulator/tmbuilder.py
Python
apache-2.0
7,293
# # Copyright 2015 Intel 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 in writin...
ityaptin/ceilometer
ceilometer/tests/unit/hardware/pollsters/test_generic.py
Python
apache-2.0
7,408
from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from . import models class WPSiteAdmin(admin.ModelAdmin): list_display = ('name', 'url', 'hook') readonly_fields = ('name', 'description') def save_model(self, request, obj, form, change): # TODO do this sync as...
texastribune/wjordpress
wjordpress/admin.py
Python
apache-2.0
1,830
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
google/embedding-tests
thought/image_text_model.py
Python
apache-2.0
11,824
""" pygments.styles.sas ~~~~~~~~~~~~~~~~~~~ Style inspired by SAS' enhanced program editor. Note This is not meant to be a complete style. It's merely meant to mimic SAS' program editor syntax highlighting. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, s...
sonntagsgesicht/regtest
.aux/venv/lib/python3.9/site-packages/pygments/styles/sas.py
Python
apache-2.0
1,417
from JumpScale9 import j redisFound = False try: from .Redis import Redis from .RedisQueue import RedisQueue from redis._compat import nativestr # import itertools import socket redisFound = True except: pass import os import time # import sys from JumpScale9 import tcpPortConnectionTest f...
Jumpscale/core9
JumpScale9/clients/redis/RedisFactory.py
Python
apache-2.0
7,379
# Copyright 2016 Quora, 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 writing, so...
quora/qcore
qcore/enum.py
Python
apache-2.0
12,142
# Copyright 2015 PerfKitBenchmarker 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...
mateusz-blaszkowski/PerfKitBenchmarker
perfkitbenchmarker/providers/azure/provider_info.py
Python
apache-2.0
872
#!python import sys import io import re import urllib import urllib2 import urlparse import lxml.etree def get_outlinks(url): ''' url: the url to the page to crawl ''' result = [] if url is None: return result html = None resp = None try: url = url.strip() resp = url...
ecologylab/BigSemanticsService
Scripts/utils/crawl.py
Python
apache-2.0
3,552
import logging from datetime import timedelta from core import Feed import pandas as pd from core.observables import Ip, Observable from core.errors import ObservableValidationError class ThreatFox(Feed): default_values = { "frequency": timedelta(hours=1), "name": "ThreatFox", "source": "...
yeti-platform/yeti
plugins/feeds/public/threatfox.py
Python
apache-2.0
2,925
# -*- 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...
google/gnxi
oc_config_validate/oc_config_validate/models/macsec.py
Python
apache-2.0
391,144
"""Module to train sequence model. Vectorizes training and validation texts into sequences and uses that for training a sequence model - a sepCNN model. We use sequence model for text classification when the ratio of number of samples to number of words per sample for the given dataset is very large (>~15K). """ from ...
google/eng-edu
ml/guides/text_classification/train_sequence_model.py
Python
apache-2.0
5,062
try: from setuptools import setup except ImportError: from ez_setup import use_setuptools use_setuptools() from setuptools import setup import sys test_suite = "tests" tests_require = ["mongo-orchestration >= 0.2, < 0.4", "requests >= 2.5.1"] if sys.version_info[:2] == (2, 6): # Need unittest2 to...
LaoLiulaoliu/hzkgelastic2-doc-manager
setup.py
Python
apache-2.0
2,047
# -*- coding: utf-8 -*- # # scanpdf documentation build configuration file, created by # sphinx-quickstart on Wed Oct 23 13:43:29 2013. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # A...
virantha/scanpdf
docs/conf.py
Python
apache-2.0
10,696
#!/usr/bin/python # Copyright 2014 Google. # # 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...
google/compare-codecs
lib/file_codec.py
Python
apache-2.0
7,774
import pytest import logging from dtest import Tester from tools.data import rows_to_list since = pytest.mark.since logger = logging.getLogger(__name__) @since('3.0') class TestStressSparsenessRatio(Tester): """ @jira_ticket CASSANDRA-9522 Tests for the `row-population-ratio` parameter to `cassandra-st...
beobal/cassandra-dtest
stress_tool_test.py
Python
apache-2.0
2,137
#!/usr/bin/env python import os import sys import sqlite3 import re import itertools import collections import json import abc import re import numpy as np # gemini imports import gemini_utils as util from gemini_constants import * from gemini_utils import OrderedSet, OrderedDict, itersubclasses, partition import com...
poojavade/Genomics_Docker
Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/gemini-0.10.0-py2.7.egg/gemini/GeminiQuery.py
Python
apache-2.0
43,429
#!/usr/bin/env python # Copyright 2011-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/LI...
openstack/glance
glance/cmd/cache_prefetcher.py
Python
apache-2.0
1,880
from utils.header import MagicField, Field from load_command import LoadCommandHeader, LoadCommandCommand class PrebindCksumCommand(LoadCommandHeader): ENDIAN = None FIELDS = ( MagicField('cmd', 'I', {LoadCommandCommand.COMMANDS['LC_DYSYMTAB']: 'LC_DYSYMTAB'}), Field('cmdsize', 'I'), F...
hkkwok/MachOTool
mach_o/headers/prebind_cksum_command.py
Python
apache-2.0
488
#!/usr/bin/python ############################################################################## # Copyright 2016-2017 Rigetti Computing # # 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 ...
balopat/pyquil
pyquil/tests/test_quil.py
Python
apache-2.0
11,288
# 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 agreed to in writing, ...
google/gazoo-device
gazoo_device/utility/retry.py
Python
apache-2.0
3,404
# 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...
Huyuwei/tvm
tests/python/nightly/quantization/test_quantization_accuracy.py
Python
apache-2.0
6,399
#!/usr/bin/env python # -*- coding: utf-8 -*- import pymongo from pymongo import MongoClient from pymongo import errors import re class Database(object): '''Database creation''' def __init__(self, database_name): self.client = MongoClient('mongodb://localhost,localhost:27017') self.db_name = database_name sel...
c24b/mango
database.py
Python
apache-2.0
5,004
# Django settings for ssssss project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS import os if 'SERVER_SOFTWARE' in os.environ: from sae.const import ( MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASS, MYSQL_DB ) else: # Make `...
huaijiefeng/contact-sync-server
contactsync/settings.py
Python
apache-2.0
5,270
import os import subprocess import sys deltext="" if sys.platform.startswith("linux") : deltext="rm" copytext="cp" if sys.platform.startswith("darwin") : deltext="rm" copytext="cp" if sys.platform.startswith("win") : deltext="del" copytext="copy" def run_in_shell(cmd): subprocess.check_call(cmd, shell=Tru...
miracl/amcl
version3/c/config64.py
Python
apache-2.0
19,998
################################################### # This is a basic script to carry on a conversation # with ghost ################################################### # create service ghost = Runtime.start("ghost", "WebGui") ear = Runtime.start("ear", "WebkitSpeechRecognition") ghostchat = Runtime.start("ghostchat"...
MyRobotLab/pyrobotlab
home/Humanoid/ghost.py
Python
apache-2.0
934
from __future__ import unicode_literals import json import unittest from mopidy.models import ( Album, Artist, ModelJSONEncoder, Playlist, Ref, SearchResult, TlTrack, Track, model_json_decoder) class GenericCopyTest(unittest.TestCase): def compare(self, orig, other): self.assertEqual(orig, other...
woutervanwijk/mopidy
tests/test_models.py
Python
apache-2.0
38,697
from oauth2client.service_account import ServiceAccountCredentials from googleapiclient.discovery import build from google.oauth2 import service_account from common.methods import set_progress from infrastructure.models import CustomField, Environment from pathlib import Path import json, tempfile import os import zipf...
CloudBoltSoftware/cloudbolt-forge
blueprints/google_cloud_function/create.py
Python
apache-2.0
9,886
# -*- coding: utf-8 -*- """ Created on Thu Apr 27 13:35:59 2017 @author: mkammoun.lct """ import numpy as np import matplotlib.pyplot as pl from bisect import bisect import math n=200 n2=10000 def per(theta,n): perm=[] for i in range(1,n+1): if np.random.binomial(1,theta/(float(th...
kammmoun/PFE
codes/Ewens&uniform+RSK_rho_1.py
Python
apache-2.0
2,011
""" This code was Ported from CPython's sha512module.c """ import _struct as struct SHA_BLOCKSIZE = 128 SHA_DIGESTSIZE = 64 def new_shaobject(): return { 'digest': [0]*8, 'count_lo': 0, 'count_hi': 0, 'data': [0]* SHA_BLOCKSIZE, 'local': 0, 'digestsize': 0 } ...
aisk/grumpy
third_party/pypy/_sha512.py
Python
apache-2.0
14,181
# Copyright 2015 Netflix, 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...
stackArmor/security_monkey
security_monkey/watchers/elasticsearch_service.py
Python
apache-2.0
4,759
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # 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 # ...
sridevikoushik31/nova
nova/scheduler/rpcapi.py
Python
apache-2.0
4,921
# -*- encoding: utf-8 -*- """ Django settings for login project. """ from django.core.urlresolvers import reverse_lazy DEBUG = True TESTING = False SESSION_COOKIE_SECURE = False CSRF_COOKIE_SECURE = False # We use the 'SITE_NAME' for the name of the database and the name of the # cloud files container. SITE_NAME = '...
pkimber/login
example_login/base.py
Python
apache-2.0
6,137
# -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the Apache License, Version 2.0 (the "License"...
crate/crate-python
src/crate/client/sqlalchemy/tests/bulk_test.py
Python
apache-2.0
2,714
from __future__ import unicode_literals import boto import copy import itertools import re import six from collections import defaultdict from datetime import datetime from boto.ec2.instance import Instance as BotoInstance, Reservation from boto.ec2.blockdevicemapping import BlockDeviceMapping, BlockDeviceType from b...
mrucci/moto
moto/ec2/models.py
Python
apache-2.0
121,494
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013 New Dream Network, LLC (DreamHost) # # 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/li...
armando-migliaccio/neutron
neutron/services/loadbalancer/drivers/haproxy/agent_manager.py
Python
apache-2.0
9,680
# Copyright 2016 Rudrajit Tapadar # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
rtapadar/pscan
pscan/tests/test_scan.py
Python
apache-2.0
5,489
# !/usr/bin/python # # Copyright 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 ...
TAJaroszewski/lma_contrail_monitoring
deployment_scripts/puppet/modules/lma_contrail_monitoring/files/scripts/check-api-contrail-9081.py
Python
apache-2.0
4,630
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('transactions', '0001_initial'), ] operations = [ migrations.AddField( model_name='transaction', name...
erickdom/restAndroid
transactions/migrations/0002_transaction_response.py
Python
apache-2.0
436
# -*- coding: utf-8 -*- # Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
GoogleCloudPlatform/cloud-pubsub-logging-python
pubsub_logging/errors.py
Python
apache-2.0
759
# # Copyright 2015 VTT Technical Research Center of Finland # # 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...
ollitapa/VTT-Raytracer
python_source/pyraytracer/scatteringTools.py
Python
apache-2.0
7,251
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Data access functions to read from and write to the SQLite backend. """ import sqlite3 import codecs import os import re def setup_db(): dbpath = os.path.dirname(os.path.realpath(__file__)) + os.sep +".."+os.sep+"gitdox.db" conn = sqlite3.connect(dbpath) cur = co...
cligu/gitdox
modules/gitdox_sql.py
Python
apache-2.0
8,292
# -*- coding: utf-8 -*- import collections from pyramid.view import view_defaults, view_config from kubb_match.data.models import Round @view_defaults(request_method='GET', accept='text/html') class HtmlView(object): def __init__(self, request): self.request = request self.data_manager = request.d...
BartSaelen/kubb_match
kubb_match/views/html.py
Python
apache-2.0
4,089
from requests import HTTPError from database import Database import simplejson as json db = Database.getDatabaseConnection()["cras"] from log_session import LogSession import datetime class DB: def __init__(self): pass @staticmethod def add_user(user_id, user_name, mail,picture,fcm_token): ...
tweiss1234/Cras
db_actions.py
Python
apache-2.0
5,095
import ConfigParser as configparser import os import sys from pyspark import SparkContext, SparkConf, SparkFiles from pyspark.sql import SQLContext, Row from datetime import datetime from os_utils import make_directory, preparing_path, time_execution_log, check_file_exists from subprocess import Popen, PIPE from vina_u...
rodrigofaccioli/drugdesign
virtualscreening/vina/spark/prepare_receptor.py
Python
apache-2.0
2,232
import copy import datetime import json import os from typing import Dict, List, Optional import jinja2 import jsonschema import yaml from ray_release.anyscale_util import find_cloud_by_name from ray_release.exception import ReleaseTestConfigError from ray_release.logger import logger from ray_release.util import dee...
ray-project/ray
release/ray_release/config.py
Python
apache-2.0
6,617
#!/usr/bin/env python """ Create generic LPU and simple pulse input signal. """ from itertools import product import sys import numpy as np import h5py import networkx as nx def create_lpu_graph(lpu_name, N_sensory, N_local, N_proj): """ Create a generic LPU graph. Creates a graph containing the neuron...
AdamRTomkins/Neurokernel-singularity-container
examples/data/gen_generic_lpu.py
Python
apache-2.0
12,988
# -*- coding: utf-8 -*- from pyramid.interfaces import IRequest from openprocurement.api.interfaces import IContentConfigurator from openprocurement.tender.belowthreshold.models import Tender, IBelowThresholdTender from openprocurement.tender.belowthreshold.adapters import TenderBelowThersholdConfigurator def includ...
openprocurement/openprocurement.tender.belowthreshold
openprocurement/tender/belowthreshold/includeme.py
Python
apache-2.0
716
""" * Copyright (C) Caleb Marshall and others... - All Rights Reserved * Written by Caleb Marshall <anythingtechpro@gmail.com>, May 27th, 2017 * Licensing information can found in 'LICENSE', which is part of this source code package. """ import struct class Endianness(object): """ A enum that stores networ...
AnythingTechPro/curionet
curionet/io.py
Python
apache-2.0
3,368
from element import BasePageElement from locators import PageFooterLocators from selenium.webdriver.common.action_chains import ActionChains class BasePage(object): def __init__(self, driver): self.driver = driver class FooterPage(BasePage): def is_copyright_matches(self): return "Lauren...
technolotrix/tests
tests/selenium/footer/page.py
Python
apache-2.0
1,389
# -*- 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-datacatalog
samples/generated_samples/datacatalog_v1_generated_data_catalog_update_tag_sync.py
Python
apache-2.0
1,524
import re import os, sys import json import csv import shutil import ctypes import logging import datetime import fileinput import subprocess import xml.etree.ElementTree as etree DEFAULT_HELPER_PATH = "helper" class Logger(object): def __init__(self): """Init method """ ...
skoli0/vmbuilder
helper/helper.py
Python
apache-2.0
5,599
# 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...
jhseu/tensorflow
tensorflow/python/compiler/tensorrt/trt_convert_windows.py
Python
apache-2.0
5,368
from abc import ABC, abstractmethod from .utils import FileUtils, LoggingUtils import os import subprocess class Build(ABC): def __init__(self, configuration): super().__init__() self.configuration = configuration @abstractmethod def before_build(self): raise NotImplementedError(...
PublicHealthEngland/animal-welfare-assessment-grid
prepare-build/uk_gov_phe_erdst_sc/build.py
Python
apache-2.0
2,643
#!/usr/bin/python NWID=1 NR_NODES=20 #Controllers=[{"ip":'127.0.0.1', "port":6633}, {"ip":'10.0.1.28', "port":6633}] Controllers=[{"ip":'10.0.1.28', "port":6633}] """ Start up a Simple topology """ from mininet.net import Mininet from mininet.node import Controller, RemoteController from mininet.log import setLogLeve...
opennetworkinglab/spring-open
old-scripts/test-network/mininet/net.sprint5-templete.py
Python
apache-2.0
4,452
# 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...
thomasquintana/freepy
freepy/lib/actors/errors.py
Python
apache-2.0
1,220
# The following comment should be removed at some point in the future. # mypy: disallow-untyped-defs=False from __future__ import absolute_import import json import logging from multiprocessing.dummy import Pool from pip._vendor import six from pip._vendor.requests.adapters import DEFAULT_POOLSIZE from pip._interna...
mdworks2016/work_development
Python/20_Third_Certification/venv/lib/python3.7/site-packages/pip/_internal/commands/list.py
Python
apache-2.0
10,511
""" Copyright 2017-present Airbnb, 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 writing, sof...
airbnb/streamalert
streamalert_cli/athena/helpers.py
Python
apache-2.0
9,745
#!/usr/bin/env python # -*- coding: utf-8 -*- """Script to extract a catalog of Windows Registry keys and values.""" import argparse import logging import sys from dfwinreg import creg as dfwinreg_creg from dfwinreg import regf as dfwinreg_regf from dfwinreg import registry as dfwinreg_registry from winregrc import ...
libyal/winreg-kb
scripts/catalog.py
Python
apache-2.0
2,974
import sqlite3 import logging from time import sleep logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from scapy.all import * import sweetSecurityDB dbPath="/opt/sweetsecurity/client/SweetSecurity.db" def convertMAC(mac): newMac="%s%s:%s%s:%s%s:%s%s:%s%s:%s%s" % (mac[0],mac[1],mac[2],mac[3],mac[4],mac[5],m...
TravisFSmith/SweetSecurity
sweetSecurity/client/spoof.py
Python
apache-2.0
1,267
import zstackwoodpecker.test_state as ts_header import os TestAction = ts_header.TestAction def path(): return dict(initial_formation="template5", checking_point=8, path_list=[ [TestAction.create_vm, 'vm1', ], [TestAction.create_volume, 'volume1', 'flag=scsi'], [TestAction.attach_volume, 'vm1', 'volume1'], ...
zstackio/zstack-woodpecker
integrationtest/vm/multihosts/vm_snapshots/paths/xsky_path45.py
Python
apache-2.0
1,722
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2014 Klaudiusz Staniek # # 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 # # ...
kstaniek/fiblary
examples/info.py
Python
apache-2.0
1,435
from nets import vgg import tensorflow as tf from preprocessing import vgg_preprocessing from ..utils.upsampling import bilinear_upsample_weights slim = tf.contrib.slim # Mean values for VGG-16 from preprocessing.vgg_preprocessing import _R_MEAN, _G_MEAN, _B_MEAN def extract_vgg_16_mapping_without_fc8(vgg_16_variab...
aakashsinha19/Aspectus
Image Segmentation/tf-image-segmentation/tf_image_segmentation/models/fcn_32s.py
Python
apache-2.0
6,382
import factory from zeus import models from zeus.utils import timezone from .base import ModelFactory from .types import GUIDFactory class UserFactory(ModelFactory): id = GUIDFactory() email = factory.Faker("email") date_created = factory.LazyAttribute(lambda o: timezone.now()) date_active = factory...
getsentry/zeus
zeus/factories/user.py
Python
apache-2.0
406
"""Unit tests for result_form_functional_tests.py Systems: - indicators.views.ResultCreate - bad indicator id 404 - get with good ids gives form - initial form data is correct - correct disaggregation values - form valid returns appropriate response - form invalid ret...
mercycorps/TolaActivity
indicators/tests/form_tests/result_form_unittests.py
Python
apache-2.0
9,175
# Copyright (C) 2015 Universidad Politecnica de Madrid # # 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...
ging/keystone
keystone/tests/test_v3_two_factor_auth.py
Python
apache-2.0
19,566
import threading from mock import patch from uuid import uuid4 from changes_lxc_wrapper.cli.wrapper import WrapperCommand def generate_jobstep_data(): # this must generic a *valid* dataset that should result in a full # run return { 'status': {'id': 'queued'}, 'data': {}, 'expect...
dropbox/changes-lxc-wrapper
tests/cli/test_wrapper.py
Python
apache-2.0
3,544