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 |
|---|---|---|---|---|---|
from binascii import unhexlify
from ...base import TestBase
from ....messaging.anonymization.tunnel import DataChecker
class TestDataChecker(TestBase):
def setUp(self):
super(TestDataChecker, self).setUp()
def test_could_be_dht_correct(self):
"""
Check if a valid DHT packet is corre... | qstokkink/py-ipv8 | ipv8/test/messaging/anonymization/test_datachecker.py | Python | lgpl-3.0 | 1,142 |
"""
One dimensional solitary waves of the n=3, m=0 magma equation
of D. McKenzie. Makes use of the first integral from
Barcilon & Richter.
Gideon Simpson
simpson@math.toronto.edu
"""
import numpy
import scipy
from numpy import sqrt, log
from scipy.optimize.zeros import brentq
def solwave_amp_mck(c):
"""
Compute ... | TerraFERMA/TerraFERMA | tutorials/porositywaves/python/pysolwave/magma1d.py | Python | lgpl-3.0 | 1,462 |
###################################################################################
#
# Copyright (c) 2017-2019 MuK IT GmbH.
#
# This file is part of MuK Documents
# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Ge... | muk-it/muk_dms | muk_dms/models/__init__.py | Python | lgpl-3.0 | 1,197 |
input = b"""
module test.empty_type;
type Empty = {};
""";
rules = ['compare_exit_status']
| FLIHABI/Farango | check/tests/syntax/types/empty.py | Python | lgpl-3.0 | 93 |
'''
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed,
the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and
it will automatically contact the police if two adjacent houses were broken i... | zzzzzzzlmy/MyLeetCode | 198. House Robber.py | Python | unlicense | 994 |
from mDist import mDist
from Centroid import Centroid
epsilon=1e-03
def nSect(p, ca):
dists= [mDist(c,p) for c in ca]
minDist,maxDist = min(dists),max(dists)
if maxDist-minDist>epsilon: return False
for c in Centroid.centroids:
if not c in ca:
if mDist(c,p) <= minDist:
return False
return True
| bobbysoon/Taxi3 | nSect.py | Python | unlicense | 312 |
"""
Returns the array of cumulative density function values
for the Students-T probability distribution
using the given arrays for the abscissa or template
values and each of the parameters values.
"""
import numpy
import pyferret
import pyferret.stats
DISTRIB_NAME = "Students-T"
FUNC_NAME = "cdf"
def ferret_init(id... | NOAA-PMEL/PyFerret | pyfermod/stats/stats_t_cdf.py | Python | unlicense | 723 |
from threading import Lock
class Graph:
def __init__(self, num_nodes, delta_mat, tau_mat=None):
print len(delta_mat)
if len(delta_mat) != num_nodes:
raise Exception("len(delta) is not num_nodes")
self.num_nodes = num_nodes
self.delta_mat = delta_mat
self.lock =... | neale/CS-program | 325-Algorithms/project4/antgraph.py | Python | unlicense | 1,864 |
from collections import Counter
def matching_spots(s1, s2):
return sum(s1[i]==s2[i] for i in range(len(s1)))
def matching_unordered(c1, c2):
return sum(min(c1[d], c2[d]) for d in c1.keys())
class Solution:
def getHint(self, secret: str, guess: str) -> str:
bulls = matching_spots(secret, guess)
... | SelvorWhim/competitive | LeetCode/BullsAndCows.py | Python | unlicense | 477 |
import numpy as np
def kMeansInitCentroids(X, K):
"""returns K initial centroids to be
used with the K-Means on the dataset X
"""
return np.random.permutation(X)[:K]
| robotenique/mlAlgorithms | unsupervised/kmeansPCA/kMeansInitCentroids.py | Python | unlicense | 184 |
# coding: utf-8
from __future__ import unicode_literals
import itertools
import json
import os.path
import re
import time
import traceback
from .common import InfoExtractor, SearchInfoExtractor
from ..jsinterp import JSInterpreter
from ..swfinterp import SWFInterpreter
from ..compat import (
compat_chr,
com... | Nikoli/youtube-dl | youtube_dl/extractor/youtube.py | Python | unlicense | 80,612 |
"""
Multiclass and multilabel classification strategies
===================================================
This module implements multiclass learning algorithms:
- one-vs-the-rest / one-vs-all
- one-vs-one
- error correcting output codes
The estimators provided in this module are meta-estimators: they re... | seckcoder/lang-learn | python/sklearn/sklearn/multiclass.py | Python | unlicense | 18,151 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: dbapi2.py
import datetime
import time
from _sqlite3 import *
paramstyle = 'qmark'
threadsafety = 1
apilevel = '2.0'
Date = datetime.date
Time = datet... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/sqlite3/dbapi2.py | Python | unlicense | 1,749 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: __init__.py
import dsz
import dsz.cmd
import dsz.data
import dsz.lp
class RemoteExecute(dsz.data.Task):
def __init__(self, cmd=None):
d... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/ZBng/PyScripts/Lib/zbng/mca/process/cmd/remoteexecute/data/dsz/__init__.py | Python | unlicense | 1,714 |
import numpy as np
import tensorflow as tf
import covtype_data
import time
import random
x = covtype_data.feature
y = covtype_data.label
epochs = 100
batch_size = 100
input_num_units = x.shape[1]
hidden_num_units_1 = 10**5
hidden_num_units_2 = 10**5
num_class = y.shape[1]
sess = tf.InteractiveSession()
tf.set_r... | Knight13/Exploring-Deep-Neural-Decision-Trees | Covertype/NN.py | Python | unlicense | 2,436 |
"""
Generate a wordcloud from text
"""
from collections import Counter
from os import path
import matplotlib.pyplot as plt
from nltk.corpus import stopwords as S
from wordcloud import WordCloud
d = path.dirname(__file__)
# Read the whole text.
words = [
# Getting better
('Practice planning', 15),
('Leadi... | punchagan/thatte-idli | scripts/word-cloud.py | Python | unlicense | 1,633 |
import os
import decimal
import json
import unittest
from winnow.models.base import WinnowVersion
from winnow.values.option_values import OptionResourceWinnowValue
from winnow.options import OptionsSet
from winnow.inline import _merge_option_dicts
from winnow.utils import json_dumps
from winnow.values import value_fac... | opendesk/winnow | src/winnow/tests/taxonomy_tests.py | Python | unlicense | 8,814 |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.tri as mtri
import matplotlib.delaunay as mdel
from nose.tools import assert_equal
from numpy.testing import assert_array_equal, assert_array_almost_equal,\
assert_array_less
from matplotlib.testing.decorators import image_comparison
import matplo... | cactusbin/nyt | matplotlib/lib/matplotlib/tests/test_triangulation.py | Python | unlicense | 36,658 |
# 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... | virtualopensystems/nova | nova/network/model.py | Python | apache-2.0 | 15,726 |
"""
Datetime field demo run
"""
import enaml
from enaml.qt.qt_application import QtApplication
def run_demo():
with enaml.imports():
from datetime_field import Main
app = QtApplication()
view = Main()
view.show()
# Start the application event loop
app.start()
run_demo() | viz4biz/PyDataNYC2015 | tutorial/datetime_field_run.py | Python | apache-2.0 | 310 |
# http://www.bionicbunny.org/
#
# Copyright (c) 2014 Oleksandr Sviridenko
#
# 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... | robionica/b3 | src/main/python/b3/steps/fs/mkdir_step.py | Python | apache-2.0 | 1,153 |
# -*- coding: utf-8 -*-
import os
from setuptools import find_packages, setup
def prerelease_local_scheme(version):
"""Return local scheme version unless building on master in CircleCI.
This function returns the local scheme version number
(e.g. 0.0.0.dev<N>+g<HASH>) unless building on CircleCI for a
... | jbeezley/girder | plugins/ldap/setup.py | Python | apache-2.0 | 1,731 |
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Administrator
#
# Created: 08/10/2011
# Copyright: (c) Administrator 2011
# Licence: <your licence>
#--------------------------------------------------------------------... | hemmerling/codingdojo | src/game_of_life/python_coderetreat_socramob/cr_socramob04/gol04.py | Python | apache-2.0 | 450 |
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function
import os
import os.path as op
try:
import ushlex as shlex
except ImportError:
import shlex
from collections import defaultdict, namedtuple
from glob import glob
import logging
from flask import (Flask, render_template, abort, json... | AmadeusITGroup/GraphDash | graphdash/routes.py | Python | apache-2.0 | 10,317 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.conf import settings
import django.db.models.deletion
import cpro.models
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
migrations.s... | SchoolIdolTomodachi/CinderellaProducers | cpro/migrations/0001_initial.py | Python | apache-2.0 | 18,022 |
from functools import reduce
import operator as op
import numpy as np
import pandas as pd
from zipline.lib.labelarray import LabelArray
from zipline.pipeline import Classifier
from zipline.pipeline.data.testing import TestingDataSet
from zipline.pipeline.expression import methods_to_ops
from zipline.testing import pa... | quantopian/zipline | tests/pipeline/test_classifier.py | Python | apache-2.0 | 23,691 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import random
import numpy as np # type: ignore
from onnx import helper, defs, numpy_helper, checker
from onnx import AttributeProto, TensorProto, GraphProto
from typi... | mlperf/training_results_v0.7 | Fujitsu/benchmarks/resnet/implementations/implementation_open/mxnet/3rdparty/onnx-tensorrt/third_party/onnx/onnx/test/helper_test.py | Python | apache-2.0 | 12,423 |
"""
Cloud Administrator model for atmosphere
"""
from django.db import models
from core.models.user import AtmosphereUser
from core.models.provider import Provider
import uuid
class CloudAdministrator(models.Model):
"""
This model is reserved exclusively for users who are in control of an
entire 'cloud' p... | CCI-MOC/GUI-Backend | core/models/cloud_admin.py | Python | apache-2.0 | 1,722 |
# 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 agreed to in writing, software
#... | yeming233/rally | tests/unit/plugins/openstack/scenarios/ec2/test_servers.py | Python | apache-2.0 | 1,228 |
from django.core.exceptions import PermissionDenied
from django.utils.translation import ugettext as _
from pretix.base.models import EventPermission, OrganizerPermission
def event_permission_required(permission):
"""
This view decorator rejects all requests with a 403 response which are not from
users h... | Flamacue/pretix | src/pretix/control/permissions.py | Python | apache-2.0 | 4,614 |
# Copyright 2018 The Cirq Developers
#
# 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 ... | quantumlib/Cirq | cirq-core/cirq/contrib/paulistring/__init__.py | Python | apache-2.0 | 1,555 |
"""
Test of sink processor behaviour
"""
import unittest.mock as mock
import winton_kafka_streams.processor as wks_processor
from winton_kafka_streams.processor.task_id import TaskId
_expected_timestamp = 1234567890
def test_createSinkProcessorObject():
wks_processor.SinkProcessor('topic1')
def test_sinkProc... | wintoncode/winton-kafka-streams | tests/processor/test_sink_processor.py | Python | apache-2.0 | 1,284 |
# -*- python -*-
# Copyright (C) 2009-2016 Free Software Foundation, Inc.
# This program 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 versio... | ATM-HSW/mbed_target | buildtools/gcc-arm-none-eabi-6-2017-q2/arm-none-eabi/lib/thumb/v7-ar/libstdc++.a-gdb.py | Python | apache-2.0 | 2,533 |
import pytest
from ispyb.cli import last_data_collections_on
_header = "------Date------ Beamline --DCID-- ---Visit---\n"
def test_basic(capsys, testconfig):
last_data_collections_on.main(["i03", f"--credentials={testconfig}"])
captured = capsys.readouterr()
assert not captured.err
assert captured.o... | DiamondLightSource/ispyb-api | tests/cli/test_last_data_collections_on.py | Python | apache-2.0 | 2,229 |
"""The roomba component."""
import asyncio
import logging
import async_timeout
from roombapy import Roomba, RoombaConnectionError
from homeassistant import exceptions
from homeassistant.const import CONF_DELAY, CONF_HOST, CONF_NAME, CONF_PASSWORD
from .const import BLID, COMPONENTS, CONF_BLID, CONF_CONTINUOUS, DOMAI... | turbokongen/home-assistant | homeassistant/components/roomba/__init__.py | Python | apache-2.0 | 3,953 |
#
# 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... | Azure/qpid-proton | tests/python/proton_tests/common.py | Python | apache-2.0 | 18,954 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | Magnetic/luigi | luigi/task.py | Python | apache-2.0 | 31,860 |
# coding=utf-8
# Copyright 2014 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 os
import re
... | jtrobec/pants | src/python/pants/backend/core/tasks/builddictionary.py | Python | apache-2.0 | 5,076 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ListTranscriptions
# Returns a list of transcriptions for the specified account.
#
# Python version 2.6
#
###############################################################################
from temboo.core.choreog... | egetzel/wecrow | truehand2014/temboo/Library/Twilio/Transcriptions/ListTranscriptions.py | Python | apache-2.0 | 3,803 |
# Copyright 2012 Cloudbase Solutions 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 l... | whiteear/cloudbase-init | cloudbaseinit/utils/windows/winrmconfig.py | Python | apache-2.0 | 7,967 |
from __future__ import absolute_import
from typing import Any, Callable, Iterable, Tuple
from collections import defaultdict
import datetime
import six
from six import text_type
from django.db.models import Q, QuerySet
from django.template import loader
from django.conf import settings
from zerver.lib.notifications ... | grave-w-grave/zulip | zerver/lib/digest.py | Python | apache-2.0 | 9,131 |
# -*- coding: utf-8 -*-
import json
import os
import datetime
import time
import random
from urllib import parse
from math import ceil
from collections import defaultdict
from uuid import uuid4
from copy import deepcopy
from bson import ObjectId, json_util
from itertools import chain
from flask_admin import BaseView, e... | seasonstar/bibi | application/controllers/admin/content/item.py | Python | apache-2.0 | 12,348 |
#!/usr/bin/python
#
# 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 b... | vanant/googleads-dfa-reporting-samples | python/v2.0/create_creative_group.py | Python | apache-2.0 | 2,337 |
LOGGING = {
'version': 1,
# When set to True this will disable all logging except
# for loggers specified in this configuration dictionary. Note that
# if nothing is specified here and disable_existing_loggers is True,
# django.db.backends will still log unless it is disabled explicitly.
'disabl... | NECCSiPortal/NECCSPortal-dashboard | openstack_dashboard/local/local_settings.d/_31_operation_log.py | Python | apache-2.0 | 5,505 |
#!/usr/bin/env python
#
# Copyright 2018 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 require... | googlearchive/simian | src/simian/mac/client/preflight.py | Python | apache-2.0 | 13,175 |
#!/usr/bin/env python3
# Copyright 2018 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... | kubeflow/kfp-tekton-backend | sdk/python/tests/compiler/testdata/timeout.py | Python | apache-2.0 | 1,439 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | m3z/HT | openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/tests.py | Python | apache-2.0 | 3,898 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('subscribers', '0012_auto_20150407_2220'),
]
operations = [
migrations.AlterField(
m... | bryanveloso/avalonstar-tv | apps/subscribers/migrations/0013_auto_20150527_1642.py | Python | apache-2.0 | 496 |
import _compression
from io import BytesIO, UnsupportedOperation, DEFAULT_BUFFER_SIZE
import os
import pickle
import random
import unittest
from test.support import (
_4G, TESTFN, import_module, bigmemtest, run_unittest, unlink
)
lzma = import_module("lzma")
from lzma import LZMACompressor, LZMADecompressor, LZMA... | batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.5.9/Python-3.5.9/Lib/test/test_lzma.py | Python | apache-2.0 | 78,431 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Blog',
fields=[
('id', models.AutoField(verbose... | cryanperkins/PoolRyde | poolryde/blog/migrations/0001_initial.py | Python | apache-2.0 | 733 |
# Copyright (c) 2014 Marist SDN Innovation lab Joint with Plexxi 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/license... | ekcs/congress | congress/datasources/vCenter_driver.py | Python | apache-2.0 | 13,671 |
#################################################
# (c) Copyright 2014 Hyojoon Kim
# All Rights Reserved
#
# email: deepwater82@gmail.com
#################################################
import operator
import string
import pickle
import sys
import re
import time
import os
import sqlite3 as db
import shlex, subproc... | PrincetonUniversity/AdvNet-OF_Scripts | evaluation/switch/flowmod_test/plot_scripts/plot_lib.py | Python | apache-2.0 | 8,554 |
from os.path import join
import shutil
from sys import argv, stderr
from os import walk
from os.path import isfile
import subprocess
from common import TAG_PATH, CRANE_YML_PATH, MODIFIED_YML_PATH, call_crane
from crane_yml import modify_yaml
import loader
import yaml
def install_getty(dest):
src = '/getty'
# ... | rmoorman/ship | vm/loader/root/main.py | Python | apache-2.0 | 3,472 |
# Copyright DataStax, 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, softwa... | datastax/python-driver | tests/integration/cqlengine/columns/test_value_io.py | Python | apache-2.0 | 6,935 |
#!/usr/bin/env python3
import os,sys
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(base_dir)
from conf import config
from core import main
#$ 设置一个标记位,标记位数等于总的回合数
round_num = config.ROUND
#$ 设置一个标记,标记等游戏的回合数,循环一次数值加1
num = 1
$$ 使用总的回合数循环,没次循环数值减1,数值等0的时候循环结束,也代表游戏结束
while round... | binges/Python_Study | day6/bin/start.py | Python | apache-2.0 | 1,844 |
# Copyright (c) 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 requi... | vedujoshi/tempest | tempest/common/credentials_factory.py | Python | apache-2.0 | 13,216 |
# Copyright 2017 Battelle Energy Alliance, 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 t... | idaholab/raven | framework/Models/PostProcessor.py | Python | apache-2.0 | 11,353 |
from rest_framework import status
def test_update_list_entry(
api_client,
enable_premium_requirement,
profile_list_entry_factory,
user_factory,
):
"""
The owner of a profile item list entry should be able to update it
if they have an active premium subscription.
"""
password = "pas... | knowmetools/km-api | km_api/functional_tests/know_me/profile/profile_items/list_entries/test_update_list_entry.py | Python | apache-2.0 | 814 |
from __future__ import absolute_import, print_function
class Manager(object):
def __init__(self, handlers):
self.handlers = tuple(handlers)
def can_process(self, artifact_name):
return any(cls.can_process(artifact_name) for cls in self.handlers)
def process(self, artifact, fp=None):
... | dropbox/changes | changes/artifacts/manager.py | Python | apache-2.0 | 882 |
# -*- coding: utf-8 -*-
# Copyright Reinier de Blois
#
# 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... | StephenLujan/Naith | game/plugins/developerconsole/developerconsole.py | Python | apache-2.0 | 6,001 |
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
import hashlib
import os
from django.conf import settings
from django.core import urlresolvers
from django.core.files.base import ContentFile
from django.db import models
from django.utils.translation import ugettext_lazy as _
from filer.utils.compatibili... | amboycharlie/Child-Friendly-LCMS | leonardo/module/media/models/filemodels.py | Python | apache-2.0 | 11,248 |
#!/usr/bin/env python3
#
# Copyright (c) 2015-2017 Nest Labs, 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/lice... | openweave/happy | happy/HappyShell.py | Python | apache-2.0 | 3,560 |
from master.persistence.users_store import UserStore
from master.persistence.pws_store import PwsStore
from master.sesscontroller.session_controller import SessionController
from master.httpcontroller.redirect_controller import RedirectController
from master.httpcontroller.base_controller import BaseHttpController
fr... | hungh/masterpass | master/httpcontroller/account_controller.py | Python | apache-2.0 | 3,358 |
#!/usr/bin/python
# Copyright (c) 2012-2014 CORE Security Technologies
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# $Id: lookupsid.py 1101 2014-01-14 22:15:30Z bethus@gmail.com $
#
# DCE/RPC lookup s... | hecchi777/S3-SlaacSecuritySolution | impacket-0.9.11/examples/lookupsid.py | Python | apache-2.0 | 5,922 |
"""Testing for postgresql backend."""
# pylama:ignore=D101,D102,D103,E501
import os
import unittest
import gludb.config
import simple_data_tests
from simple_data_tests import SimpleStorage
import index_tests
from index_tests import IndexedData
if os.environ.get('travis', False):
# Testing on travis CI
PG... | memphis-iis/GLUDB | tests/postgresql_tests.py | Python | apache-2.0 | 2,537 |
#!/usr/bin/env python
import os, sys, pwd
from twisted.internet import epollreactor
# Epoll scales better on linux than select()
epollreactor.install()
from collections import defaultdict
import pcapy
from pcapy import open_live
from twisted.internet.protocol import Protocol, Factory
from twisted.internet import r... | rodders/darklaunch | caphead/capturehead_post.py | Python | apache-2.0 | 4,017 |
# =============================================================================
# _ _ _ _ _ _
# _ __ _ _ / \ | |_| |_ _ __(_) |__ _ _| |_ ___ ___
# | '_ \| | | | / _ \| __| __| '__| | '_ \| | | | __/ _ \/ __|
# | |_) | |_| |/ ___ \ |_| |_| | | | |_) | |_| | || __/\__... | Paebbels/pyAttribute | tests/unit/__init__.py | Python | apache-2.0 | 2,705 |
from itertools import cycle
__author__ = 'krr428'
import sys
if __name__ == "__main__":
filehandles = {}
for i in xrange(16):
filehandles[i] = open(sys.argv[1] + "." + str(i) + ".submatrix")
with open(sys.argv[1] + ".matrix", 'w') as m:
for i, j in zip(cycle(xrange(16)), xrange(100000))... | krrg/consensus-sequence-alignment | Utils/submatrix_to_matrix.py | Python | apache-2.0 | 487 |
from django.contrib.admin.options import IncorrectLookupParameters
from django.utils.http import urlencode
from django.utils.encoding import smart_str
from django.db import models
from django.db.models.fields.related import RelatedField
from django.db.models.fields import FieldDoesNotExist
from django.utils.text import... | edisonlz/fruit | web_project/base/site-packages/reporting/base.py | Python | apache-2.0 | 11,157 |
# -*- coding: utf-8 -*-
"""
requests_toolbelt.source_adapter
================================
This file contains an implementation of the SourceAddressAdapter originally
demonstrated on the Requests GitHub page.
"""
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.poolmanager import PoolManager... | czgu/metaHack | env/lib/python2.7/site-packages/requests_toolbelt/adapters/source.py | Python | apache-2.0 | 1,248 |
# Copyright 2016 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 ag... | google/ctfscoreboard | scoreboard/utils.py | Python | apache-2.0 | 8,546 |
# 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... | mlperf/training_results_v0.7 | Fujitsu/benchmarks/resnet/implementations/implementation_open/mxnet/python/mxnet/gluon/model_zoo/model_store.py | Python | apache-2.0 | 6,067 |
# 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, so... | googleapis/python-automl | samples/snippets/vision_classification_create_model.py | Python | apache-2.0 | 1,972 |
from google.appengine.ext import ndb
from heroes import fields
from heroes.models import Base
from heroes.squadmembers.models import Squadmember
from heroes.representatives.models import Rep
from heroes.roles.models import Role
from heroes.positions.models import Position
class Matchteammember(Base):
# Parent = MATC... | bentilly/heroes | heroes/matchteammembers/models.py | Python | apache-2.0 | 739 |
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
import datetime
import hashlib
import hmac
import uuid
# Django
from django.conf import settings
from django.db import models, connection
from django.contrib.auth.models import User
from django.utils.timezone import now as tz_now
from django.utils.tra... | snahelou/awx | awx/main/models/organization.py | Python | apache-2.0 | 7,689 |
"""Support for setting the Transmission BitTorrent client Turtle Mode."""
import logging
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME, STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatch... | mezz64/home-assistant | homeassistant/components/transmission/switch.py | Python | apache-2.0 | 3,991 |
# 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... | chris-chris/tensorflow | tensorflow/contrib/tfprof/python/tools/tfprof/pprof_profiler_test.py | Python | apache-2.0 | 5,193 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2017-07-22 23:05:28
# @Author : mayongze (1014057907@qq.com)
# @Link : https://github.com/mayongze
# @Version : $Id$
import ctypes,os,hashlib
dll = None
path = None
def init():
global dll
global path
path = os.getcwd()
dll = ctypes.windll... | mayongze/URPHelper | captcha/app.py | Python | apache-2.0 | 1,649 |
import abc
import asyncio
import collections
import inspect
import keyword
import os
import re
import sys
import warnings
from collections.abc import Container, Iterable, Sized
from pathlib import Path
from types import MappingProxyType
from urllib.parse import unquote, urlencode
from . import hdrs
from .abc import Ab... | mind1master/aiohttp | aiohttp/web_urldispatcher.py | Python | apache-2.0 | 23,865 |
from django.conf.urls import patterns
urlpatterns = patterns('timeline.views',
(r'^timeline.html$', 'main_page', {'export':'html'}),
(r'^timeline.shtml$', 'main_page', {'export':'shtml'}),
(r'^dn/status.json', 'backlog_poll'),
... | asrashley/ieee-802-11-timeline | timeline/urls.py | Python | apache-2.0 | 404 |
'''
Implements the RTS generic Target fabric classes.
This file is part of RTSLib.
Copyright (c) 2011-2013 by Datera, Inc.
Copyright (c) 2011-2014 by 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 ... | cvubrugier/rtslib-fb | rtslib/target.py | Python | apache-2.0 | 55,505 |
# 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_ingress.py | Python | apache-2.0 | 7,106 |
import unittest
import wepy as we
class TestDumb(unittest.TestCase):
def test_dumb(self):
temp_str = we.joke()
self.assertIsInstance(temp_str, str)
| Jul13/wepy | tests/test_dumb.py | Python | apache-2.0 | 170 |
from __future__ import absolute_import
from __future__ import print_function
import datetime
from boto.s3.key import Key
from boto.s3.connection import S3Connection
from django.conf import settings
from django.db import connection
from django.forms.models import model_to_dict
from django.utils import timezone
import gl... | ahmadassaf/zulip | zerver/lib/export.py | Python | apache-2.0 | 61,291 |
import unittest
import json
import flask
from panoptes_aggregation import extractors
from panoptes_aggregation.extractors.test_utils import annotation_by_task
classification = {
"annotations": [
{
"task": "T0",
"task_label": "Add a point directly below the centre of every word that ... | CKrawczyk/python-reducers-for-caesar | panoptes_aggregation/tests/extractor_tests/test_poly_line_text_extractor.py | Python | apache-2.0 | 3,954 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | google-research/language | language/casper/retrieve/cache_query_retrievals.py | Python | apache-2.0 | 4,871 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for UTMPX file parser."""
import unittest
from plaso.parsers import utmpx
from tests.parsers import test_lib
class UtmpxParserTest(test_lib.ParserTestCase):
"""Tests for utmpx file parser."""
def testParse(self):
"""Tests the Parse function."""
p... | Onager/plaso | tests/parsers/utmpx.py | Python | apache-2.0 | 1,666 |
from __future__ import division # py3 "true division"
import logging
import sys
import os
import heapq
from timeit import default_timer
from copy import deepcopy
from collections import defaultdict
import threading
import itertools
import gensim
from gensim.utils import keep_vocab_item
try:
from queue import Qu... | erccarls/vectorsearch | vectorsearch/word2vec.py | Python | apache-2.0 | 4,242 |
# -*- coding: utf-8 -*-
########
# Copyright (c) 2016-2020 Cloudify Platform Ltd. 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... | cloudify-cosmo/cloudify-gcp-plugin | cloudify_gcp/compute/tests/test_firewall.py | Python | apache-2.0 | 2,942 |
# stdlib
from typing import Any
from typing import Dict
# third party
from fastapi import APIRouter
from fastapi.responses import JSONResponse
router = APIRouter()
@router.get("/{domain_id}/{step}", status_code=200, response_class=JSONResponse)
def remote_ping(domain_id: str, step: int) -> Dict[str, Any]:
if st... | OpenMined/PySyft | packages/grid/backend/grid/api/meta/exam.py | Python | apache-2.0 | 742 |
# Copyright 2013 Nebula 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... | openstack/python-openstackclient | openstackclient/tests/unit/identity/v2_0/test_project.py | Python | apache-2.0 | 21,977 |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | PaddlePaddle/Paddle | python/paddle/vision/__init__.py | Python | apache-2.0 | 5,413 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Famille.pseudo'
db.add_column(u'famille_famille', 'pseudo... | huguesmayolle/famille | famille/migrations/0030_auto__add_field_famille_pseudo.py | Python | apache-2.0 | 21,821 |
#!/usr/local/env python
#
# Copyright 2017 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... | FirebaseExtended/protobuf-rules-gen | integration_test.py | Python | apache-2.0 | 2,569 |
import math
x = 0.0000000000000000000000001
print(x)
print(math.exp(x) - 1)
print(math.expm1(x))
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_mathematics/math_expm1.py | Python | apache-2.0 | 99 |
# This is BFS with a Priority Queue instead of a Normal Queue and also
# we dont maintain seen as we want to explore another route and its directed and without cycles.
# The most cost efficient routes are explored first but if they exceed k stop they are discarded.
from collections import defaultdict
from heapq impo... | saisankargochhayat/algo_quest | leetcode/787. Cheapest Flights Within K Stops/soln.py | Python | apache-2.0 | 2,241 |
# Copyright 2018 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, ... | tseaver/gcloud-python | websecurityscanner/nox.py | Python | apache-2.0 | 3,054 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2017-01-27 23:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0006_contacto_notificar_sms'),
]
operations = [
migrations.AddField(... | mava-ar/sgk | src/core/migrations/0007_auto_20170127_2031.py | Python | apache-2.0 | 743 |
#!/usr/bin/python2
from __future__ import print_function
import unittest
import logging
logging.basicConfig(level=logging.INFO)
import datetime
import gzip
import json
import os
# own modules
import Advanced
from DataLogger import DataLogger as DataLogger
from Timeseries import Timeseries as Timeseries
from TimeseriesA... | gunny26/datalogger | datalogger/Test_Advanced.py | Python | apache-2.0 | 2,926 |
import logging
from datetime import timedelta
from core.errors import ObservableValidationError
from core.feed import Feed
from core.observables import Ip, Url
class SSLBlackListIP(Feed):
default_values = {
"frequency": timedelta(minutes=1440),
"name": "SSLBlackListIPs",
"source": "https:... | yeti-platform/yeti | plugins/feeds/public/sslblacklist_ip.py | Python | apache-2.0 | 1,674 |