content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
#!/usr/bin/env python3
import os
from aws_cdk import core as cdk
# For consistency with TypeScript code, `cdk` is the preferred import name for
# the CDK's core module. The following line also imports it as `core` for use
# with examples from the CDK Developer's Guide, which are in the process of
# being updated to ... | 41.028571 | 143 | 0.769499 | [
"MIT-0"
] | aws-samples/aws-securityhub-falco-ecs-eks-integration | app.py | 1,436 | Python |
#
# Copyright(c) 2019-2021 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
import logging
from tests import conftest
from core.test_run import TestRun
from api.cas import git
from api.cas import cas_module
from test_utils import os_utils
from test_utils.output import CmdException
def rsync_opencas_sour... | 28.303922 | 89 | 0.68133 | [
"BSD-3-Clause"
] | ArkadiuszNeumann/open-cas-linux | test/functional/api/cas/installer.py | 2,887 | Python |
#
# Pyserini: Reproducible IR research with sparse and dense representations
#
# 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... | 45.691892 | 153 | 0.655507 | [
"Apache-2.0"
] | ArthurChen189/pyserini | pyserini/hsearch/__main__.py | 8,453 | Python |
import tensorflow_federated as tff
def download_and_save_stackoverflow():
tff.simulation.datasets.stackoverflow.load_data(cache_dir='./')
def download_and_save_word_counts():
tff.simulation.datasets.stackoverflow.load_word_counts(cache_dir='./')
def download_and_save_tag_counts():
tff.simulation.datas... | 29.307692 | 116 | 0.799213 | [
"Apache-2.0"
] | 11asdad/FedML | data/stackoverflow/dataset.py | 762 | Python |
from django.conf import settings
from django.urls import re_path
from django.http import HttpResponsePermanentRedirect as perma_redirect
from django.urls import reverse
from django.views.generic.base import TemplateView
urlpatterns = [
re_path(
r'^about$',
TemplateView.as_view(template_name='pages... | 30.461538 | 88 | 0.659091 | [
"BSD-3-Clause"
] | Exhorder6/addons-server | src/olympia/pages/urls.py | 1,584 | Python |
from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from sentry.models import GroupTagValue, TagKey, TagValue
from sentry.testutils import TestCase
class GroupTagExportTest(TestCase):
def test_simple(self):
key, value = 'foo', 'bar'
# Drop mic... | 32.362069 | 94 | 0.571124 | [
"BSD-3-Clause"
] | GSA/sentry | tests/sentry/web/frontend/test_group_tag_export.py | 1,877 | Python |
ifconfig -a | grep PROMISC
cat /var/log/messages |grep promisc
1 #!/usr/bin/python 2 3 import sys 4 from scapy.all import promiscping 5 6 if len(sys.argv) < 2: 7 print sys.argv[0] + " <net>" 8 sys.exit() 9 10 promiscping(sys.argv[1]) | 47.4 | 171 | 0.691983 | [
"MIT"
] | mumbo-pro/network-penetration | 05_tcp_ip_tricks/Sniffer Detection.py | 237 | Python |
# -*- coding: utf-8 -*-
from functools import cache
INPUT = 33100000
def sigma_pentagonal_numbers(limit):
"""
>>> list(sigma_pentagonal_numbers(16))
[1, 2, 5, 7, 12, 15]
"""
n = 1
p = 1
while p <= limit:
yield p
if n > 0:
n = -n
else:
n... | 16.076923 | 58 | 0.507177 | [
"Unlicense"
] | davweb/advent-of-code | advent/year2015/day20.py | 2,091 | Python |
import datetime
import functools
import os
import subprocess
def get_version(version=None):
"""Return a PEP 440-compliant version number from VERSION."""
version = get_complete_version(version)
# Now build the two parts of the version number:
# main = X.Y[.Z]
# sub = .devN - for pre-alpha release... | 29.9125 | 79 | 0.64814 | [
"MIT"
] | ch1huizong/Scode | django-src/utils/version.py | 2,393 | Python |
import django_filters
from netaddr.core import AddrFormatError
from django.db.models import Q
from extras.filters import CustomFieldFilterSet
from tenancy.models import Tenant
from utilities.filters import NullableModelMultipleChoiceFilter
from .models import (
ConsolePort, ConsoleServerPort, Device, DeviceRole, ... | 28.95 | 118 | 0.628999 | [
"Apache-2.0"
] | BILDQUADRAT/netbox | netbox/dcim/filters.py | 12,159 | Python |
#!/usr/bin/env python
#-*- coding: UTF-8 -*-
###########################################################################
#
# Copyright (c) 2018 www.codingchen.com, Inc. All Rights Reserved
#
##########################################################################
'''
@brief leetcode algorithm
@author chenhui(hui.ch... | 29.163265 | 75 | 0.46746 | [
"MIT"
] | xiaoh12/leetcode | 4+Median+of+Two+Sorted+Arrays/alg.py | 1,429 | Python |
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 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... | 32.309859 | 79 | 0.607672 | [
"Apache-2.0"
] | ONOP/nova | nova/console/vmrc.py | 4,588 | Python |
# Copyright 2017 ZTE Corporation.
#
# 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 ... | 34.956522 | 74 | 0.767413 | [
"Apache-2.0"
] | onap/vfc-gvnfm-vnfres | res/manage.py | 804 | Python |
#
# Copyright (c) 2017 Intel Corporation
# SPDX-License-Identifier: BSD-2-Clause
#
import numba
import numpy as np
import argparse
import time
@numba.njit()
def linear_regression(Y, X, w, iterations, alphaN):
for i in range(iterations):
w -= alphaN * np.dot(X.T, np.dot(X,w)-Y)
return w
def main():
... | 29.268293 | 80 | 0.661667 | [
"BSD-2-Clause"
] | ARF1/numba | examples/linear_regression/linear_regression_numba.py | 1,200 | Python |
from interface import *
class M2:
interface = Interface()
def __init__(self, tamanhoDaLista, tempoDeAtraso, charPixel = ' '):
self.guardarNumero = 0
self.interface.set_tamanhoDaLista(tamanhoDaLista)
self.interface.set_tempoDeAtraso(tempoDeAtraso)
self.interface.set... | 37.560976 | 83 | 0.518831 | [
"MIT"
] | jonasht/Python | 07-programasDeAlgoritmo/1-programaDeAlgoritmoTipo1/0versoesAntigas/9-programa/algoritmo2.py | 1,540 | Python |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | 30.034934 | 79 | 0.664728 | [
"BSD-2-Clause"
] | cselab/CubismNova | docs/source/conf.py | 6,878 | Python |
# coding: utf-8
"""
ProcessMaker API
This ProcessMaker I/O API provides access to a BPMN 2.0 compliant workflow engine api that is designed to be used as a microservice to support enterprise cloud applications. The current Alpha 1.0 version supports most of the descriptive class of the BPMN 2.0 specification... | 29.537037 | 278 | 0.731661 | [
"Apache-2.0"
] | ProcessMaker/pmio-sdk-python | test/test_input_output.py | 1,599 | Python |
from kivy.lang import Builder
from kivy.uix.widget import Widget
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.gridlayout import GridLayout
from kivy.graphics import *
from kivy.graphics.texture import Texture
from kivy.properties import ListProperty
from .gardenGraph import Plot
from .ExdLabel import *
i... | 31.372093 | 95 | 0.569311 | [
"Apache-2.0"
] | RenatoTorres/Exode | Exode/UI/polarGraph.py | 2,698 | Python |
# 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... | 40.847128 | 80 | 0.657507 | [
"Apache-2.0"
] | unnir/tensorflow | tensorflow/contrib/distribute/python/keras_test.py | 48,363 | Python |
#!/bin/python
# -*- coding: utf-8 -*-
# import numpy as np
# define additional functions used in the *.yaml.
# Of course, as this is a trivial function you could have defined it in the *.yaml directly
def calc_nu(nub):
nu = nub / (1 - nub)
return nu
| 20.153846 | 91 | 0.656489 | [
"MIT"
] | OpenSourceEconomics/ose-scientific-computing-course-pytholisks | pydsge/examples/dfi_funcs.py | 262 | Python |
import numpy as np
# fmt: off
clon, clat = 0.0, 0.0
rad_km = 800.0
area_km2 = np.pi*rad_km**2
nlat, nlon = 17, 17
lat1d = np.linspace(-8.0, 8.0, nlat)
lon1d = np.linspace(-8.0, 8.0, nlon)
lat2d, lon2d = np.meshgrid(lat1d, lon1d)
_, X = 0, 1
mask = np.array([
[_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_],
[_,_,_,_,_,X,X,X,X,X... | 26.911765 | 40 | 0.504918 | [
"MIT"
] | ruestefa/stormtrack | tests/test_stormtrack/test_core/test_features/data/circle_on_globe_clat-00_rad-800_delta-1.0_pyproj.py | 915 | Python |
#!/usr/bin/env python3
# Copyright 2018 Johns Hopkins University (author: Daniel Povey)
# Apache 2.0.
# see get_args() below for usage message.
import argparse
import os
import sys
import math
import re
# The use of latin-1 encoding does not preclude reading utf-8. latin-1
# encoding means "treat words as sequen... | 46.429612 | 115 | 0.603429 | [
"Apache-2.0"
] | Anusha-G-Rao/kaldi | egs/wsj/s5/utils/lang/make_lexicon_fst.py | 19,129 | Python |
# Copyright 2020 by Federico Caselli
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | 34.040506 | 93 | 0.622564 | [
"Apache-2.0"
] | hzdwang/falcon-1 | falcon/inspect.py | 26,938 | Python |
# -*- coding: utf-8 -*-
# Copyright 2019 Spotify AB. 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... | 45.035599 | 119 | 0.69359 | [
"Apache-2.0"
] | phanirajl/cassandra-medusa | tests/storage_test.py | 13,916 | Python |
import time
import matplotlib.pyplot as plt
import matplotlib.dates as mdate
import numpy as np
import rrdtool
start = 2628000
end = 0
if int(end) <= 0:
end = 2
if int(start) <= 0:
start = 600
epochTimeNow = int(time.time()-1)
data = rrdtool.fetch('/home/bca/rrdtoolfilesave/powerCapturenew.rrd', 'AVERAGE',
... | 29.130435 | 84 | 0.680597 | [
"MIT"
] | SelectLOL1/BeagleBoneBlack_PRU_PowerMeter | RRDGraphs/rrd_1month.py | 1,340 | Python |
# Copyright 2017 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
#
# 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
#... | 44.209302 | 121 | 0.642951 | [
"BSD-3-Clause"
] | bowang-lab/shape-attentive-unet | data/crop_and_pad_augmentations.py | 7,604 | Python |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 32.891892 | 74 | 0.771569 | [
"Apache-2.0"
] | Global19/nodejs-memcache | synth.py | 1,217 | Python |
# Data Preprocessing Template
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('Data.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, 3].values
# Splitting the dataset into the Training set and Test set
from sklear... | 29.73913 | 92 | 0.773392 | [
"MIT"
] | BharathKumarRavichandran/ML-A-Z | Part 2 - Regression/Section 4 - Simple Linear Regression/data_preprocessing_template.py | 684 | Python |
import serial
import pynmea2
# Probando con el pincho usb azul
ser = serial.Serial('/dev/ttyUSB0',4800)
while 1:
try:
data = ser.readline().decode('utf-8')
if(data.startswith("$GPGGA")):
parse = pynmea2.parse(data)
print(repr(parse))
except UnicodeDecodeError:
c... | 23.357143 | 45 | 0.617737 | [
"MIT"
] | Raniita/Accuatic-Probe | CTD_controller/gps_test1.py | 327 | Python |
####################################################################################################
"""
adres_dataset.py
This module implements several classes to perform dataset-specific downloading, saving and
data-transformation operations.
Written by Swaan Dekkers & Thomas Jongstra
"""
##########################... | 45.853821 | 184 | 0.624402 | [
"MIT"
] | petercuret/woonfraude | codebase/datasets/adres_dataset.py | 13,802 | Python |
'''
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py 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 late... | 43.555556 | 76 | 0.741071 | [
"MIT"
] | Malekhy/ws2122-lspm | ws2122-lspm/Lib/site-packages/pm4py/visualization/decisiontree/__init__.py | 784 | Python |
from __future__ import division
from keras.callbacks import Callback
from .generic_plot import PlotLosses
metric2printable = {
"acc": "Accuracy",
"mean_squared_error": "Mean squared error",
"mean_absolute_error": "Mean absolute error",
"mean_absolute_percentage_error": "Mean absolute percentage error"... | 36.142857 | 101 | 0.641107 | [
"MIT"
] | kkanska/livelossplot | livelossplot/keras_plot.py | 2,530 | Python |
import numpy as np
from .tensor import Function
# ************* unary ops *************
class ReLU(Function):
@staticmethod
def forward(ctx, input):
ctx.save_for_backward(input)
return np.maximum(input, 0)
@staticmethod
def backward(ctx, grad_output):
input, = ctx.saved_tens... | 32.193676 | 117 | 0.570166 | [
"Apache-2.0"
] | dredwardhyde/tinygrad-universal | tinygrad/ops_cpu.py | 8,145 | Python |
import numpy as np
import tensorflow as tf
# ----------------------------------------------------------------------------
def SubPixel1D_v2(I, r):
"""One-dimensional subpixel upsampling layer
Based on https://github.com/Tetrachrome/subpixel/blob/master/subpixel.py
"""
with tf.compat.v1.name_scope('subpixel')... | 36.17284 | 88 | 0.567918 | [
"MIT"
] | Lootwig/audio-super-res | src/models/layers/subpixel.py | 2,930 | Python |
import logging
import boto3
from botocore.vendored.requests.packages.urllib3.exceptions import ResponseError
from django.core.mail.backends.base import BaseEmailBackend
from django_ses import settings
from datetime import datetime, timedelta
from time import sleep
try:
import importlib.metadata as importlib_met... | 42.88806 | 119 | 0.583522 | [
"MIT"
] | mlissner/django-ses | django_ses/__init__.py | 11,494 | Python |
# -*- coding=UTF-8 -*-
# pyright: strict
from __future__ import annotations
import os
import sys
import subprocess
def main():
subprocess.call(
["npx", "pyright"],
env={
**os.environ,
"PATH": os.path.pathsep.join(
(
os.path.dirname(sy... | 15.806452 | 52 | 0.453061 | [
"MIT"
] | gentle-knight-13/auto-derby | scripts/run_pyright.py | 490 | Python |
u"foo"
| 3.5 | 6 | 0.571429 | [
"MIT"
] | jwilk-forks/python-grammar-changes | examples/py33-0012-uprefix1.py | 7 | Python |
#!/usr/bin/python
#
# linearize-hashes.py: List blocks in a linear, no-fork version of the chain.
#
# Copyright (c) 2013-2014 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from __future__ import pri... | 26.640351 | 90 | 0.682581 | [
"MIT"
] | listedlinked/sors | contrib/linearize/linearize-hashes.py | 3,037 | Python |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 41.2 | 94 | 0.548544 | [
"MIT"
] | KTH/azure-cli | src/azure-cli/azure/cli/__init__.py | 618 | Python |
#!/usr/bin/python
import os
import unittest
""" Script to run the Python tests. """
def run_python_tests():
""" Runs the Python tests.
Returns:
True if the tests all succeed, False if there are failures. """
print("Starting tests...")
loader = unittest.TestLoader()
# Get the directory this module i... | 21.2 | 68 | 0.712264 | [
"MIT"
] | djpetti/rhodopsin | run_tests.py | 636 | Python |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 42.924528 | 103 | 0.566154 | [
"MIT",
"BSD-3-Clause"
] | mkrack/aiida-core | aiida/storage/psql_dos/migrations/versions/django_0009_base_data_plugin_type_string.py | 2,275 | Python |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def VirtualMachineRuntimeInfo(vim, *args, **kwargs):
'''The RuntimeInfo data object type ... | 38.315789 | 124 | 0.644231 | [
"MIT"
] | Infinidat/pyvisdk | pyvisdk/do/virtual_machine_runtime_info.py | 1,456 | Python |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Add non-adjusted next cycle start date
Revision ID: 44047daa31a9
Revises: 1431e7094e26
Create Date: 2015-07-07 14:31:27.780564
"""
# revision identifiers, used by Alembic.
revision = '44047daa31a9'
dow... | 38.146893 | 80 | 0.598045 | [
"ECL-2.0",
"Apache-2.0"
] | zidarsk8/ggrc-core | src/ggrc_workflows/migrations/versions/20150707143127_44047daa31a9_add_non_adjusted_next_cycle_start_date.py | 6,752 | Python |
A = 'A'
B = 'B'
Environment = {
A: 'Dirty',
B: 'Dirty',
'Current': A
}
def REFLEX_VACUUM_AGENT(loc_st): # Determine action
if loc_st[1] == 'Dirty':
return 'Suck'
if loc_st[0] == A:
return 'Right'
if loc_st[0] == B:
return 'Left'
def Sensors(): # Sense Environment
... | 26.571429 | 73 | 0.592934 | [
"MIT"
] | aleksander-GD/AI-F20 | Lecture_3_Agents/Exercise1/Exercises/reflex_vacuum_agent.py | 1,302 | Python |
def average_rating(rating_list):
if not rating_list:
# if rating_list is empty return 0
return 0
return round(sum(rating_list) / len(rating_list)) | 24.571429 | 53 | 0.680233 | [
"MIT"
] | rodrigobmedeiros/Bookr | bookr/reviews/utils.py | 172 | Python |
from .check_nd_array_for_bad import check_nd_array_for_bad
def make_reflecting_grid(grid, reflecting_grid_value, raise_for_bad=True):
check_nd_array_for_bad(grid, raise_for_bad=raise_for_bad)
reflecting_grid = grid.copy()
for i, grid_value in enumerate(reflecting_grid):
if grid_value < reflect... | 25.285714 | 74 | 0.730697 | [
"MIT"
] | alex-wenzel/ccal | ccal/make_reflecting_grid.py | 531 | Python |
import operator
class Istr:
def count(self, s, k):
letters = {}
for letter in s:
if letter not in letters:
letters[letter] = 1
else:
letters[letter] += 1
for i in range(0, k):
index = max(lett... | 21.615385 | 77 | 0.455516 | [
"MIT"
] | mikefeneley/topcoder | src/SRM-684/istr.py | 562 | Python |
import asyncio
import copy
import random
from typing import Callable
import pytest
from starkware.starknet.apps.starkgate.cairo.contracts import erc20_contract_def
from starkware.starknet.apps.starkgate.conftest import str_to_felt
from starkware.starknet.testing.contract import StarknetContract
from starkware.starkne... | 40.885437 | 100 | 0.772226 | [
"Apache-2.0"
] | starkware-libs/starkgate-contracts | src/starkware/starknet/apps/starkgate/cairo/token_test.py | 21,056 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 31.756098 | 77 | 0.596774 | [
"MIT"
] | 00Kai0/azure-cli-extensions | src/virtual-network-tap/azext_vnettap/vendored_sdks/v2018_08_01/models/subnet_association.py | 1,302 | Python |
from flask import render_template, url_for, request, flash, redirect, make_response
import email
from app import app
from werkzeug.utils import secure_filename
from app.predict_email import Prediction
import tempfile
predict_email = Prediction()
def parse_email(email_raw):
parser = email.parser.BytesParser()
... | 32.157895 | 99 | 0.614403 | [
"MIT"
] | konstantingoretzki/spamdetection-web | app/routes.py | 3,055 | Python |
class ParticleData(object):
""" Class for holding particle data such as charge.
"""
def __init__(self, charge=0):
self.charge=charge
def __repr__(self):
return "charge="+str(self.charge)
class ParticleDataList(object):
""" Class for generic handling particle ids, names and ... | 42.921951 | 278 | 0.585521 | [
"Apache-2.0"
] | 7quantumphysics/cmssw | FWCore/GuiBrowsers/python/Vispa/Plugins/EdmBrowser/ParticleDataList.py | 8,799 | Python |
import torch
from torch import nn
from torch.autograd import Variable
from torch import optim
import torch.nn.functional as F
import random
import numpy as np
import scipy as sp
import gurobipy as gp
from qpthlocal.qp import QPFunction
from qpthlocal.qp import QPSolvers
from qpthlocal.qp import make_gurobi_model
import... | 34.463028 | 101 | 0.678161 | [
"MIT"
] | JayMan91/NeurIPSIntopt | shortespath/shortespath.py | 19,575 | Python |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Divi Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the zapwallettxes functionality.
- start two divid nodes
- create two transactions on node 0 - one i... | 40.903614 | 112 | 0.706922 | [
"MIT"
] | gingfinger/divi99 | test/functional/wallet_zapwallettxes.py | 3,395 | Python |
"""
Filename: RobotsParser.py
Author: Maxwell Goldberg
Last modified: 06.09.17
Description: Helper class for parsing individual robots.txt records.
"""
# CONSTANTS
from constants import RECORD_MAX_LEN
# PYTHON BUILTINS
import re, unicodedata, logging
def test_ctrl_chars(s):
return len(s) != len("".join(ch for ch in ... | 30.034483 | 82 | 0.721584 | [
"MIT"
] | wilsonsk/Node-React-Python-D3-Crawler-App | crawler/lib/RobotsParser.py | 1,742 | Python |
# -*- coding: utf-8 -*-
# @Time : 2019/5/11 15:12
# @Author : LegenDong
# @User : legendong
# @File : __init__.py.py
# @Software: PyCharm
from .channel_attention_layer import *
from .nan_attention_layer import *
| 22.3 | 38 | 0.654709 | [
"MIT"
] | LegenDong/IQIYI_VID_FACE_2019 | models/layer/__init__.py | 223 | Python |
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_example.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Djang... | 34.125 | 78 | 0.690476 | [
"Apache-2.0"
] | serverlessplus/django-example | manage.py | 546 | Python |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import src.proto.predict_pb2 as predict__pb2
class PredictionServiceStub(object):
"""Missing associated documentation comment in .proto file."""
def __... | 32.766234 | 119 | 0.67063 | [
"MIT"
] | akiueno/ml-system-in-actions | chapter2_training/cifar10/evaluate/src/proto/prediction_service_pb2_grpc.py | 2,523 | Python |
#Importing Libraries
import os
import csv
import sys, getopt
import uuid
import SimpleITK as sitk
import cv2
import numpy as np
import tensorflow as tf
from flask import Flask, flash, request, redirect, render_template
from flask import jsonify
from flask import send_from_directory
from flask_materialize import Mat... | 39.205556 | 159 | 0.540315 | [
"BSD-3-Clause"
] | kaylajanos1/TeamSpark-L3Detection | detection.py | 14,114 | Python |
# 20
num = 1
for i in range(100):
num *= i + 1
print(sum(int(n) for n in str(num)))
| 11.25 | 36 | 0.544444 | [
"MIT"
] | Martin-Gong/euler | python/p020.py | 90 | Python |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2019 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... | 41.679389 | 79 | 0.694139 | [
"BSD-3-Clause"
] | LaurenceBeard/improver | improver_tests/ensemble_copula_coupling/ensemble_copula_coupling/test_ConvertLocationAndScaleParameters.py | 5,460 | Python |
"""
Item class for Jaseci
Each item has an id, name, timestamp.
"""
from jaseci.element.element import element
class item(element):
"""Item class for Jaseci"""
def __init__(self, value=None, *args, **kwargs):
self.item_value = value
super().__init__(*args, **kwargs)
@property
def va... | 20.7 | 55 | 0.584541 | [
"MIT"
] | AshishMahendra/jaseci | jaseci_core/jaseci/attr/item.py | 621 | Python |
from __future__ import unicode_literals
from dvc.command.base import CmdBase
class CmdCheckout(CmdBase):
def run(self):
if not self.args.targets:
self.project.checkout(force=self.args.force)
else:
for target in self.args.targets:
self.project.checkout(
... | 29.047619 | 87 | 0.62377 | [
"Apache-2.0"
] | yfarjoun/dvc | dvc/command/checkout.py | 1,220 | Python |
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: Hang Zhang
## Email: zhanghang0704@gmail.com
## Copyright (c) 2020
##
## LICENSE file in the root directory of this source tree
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import os
import time
i... | 44.312329 | 110 | 0.563992 | [
"MIT"
] | YanchengWang/RegNet-Search-PyTorch | train.py | 16,174 | Python |
"""
Implements harmonic_mean() function.
"""
from .mean import mean
def harmonic_mean(x):
"""
The `harmonic mean`_ is a kind of average that is calculated as
the reciprocal_ of the arithmetic mean of the reciprocals.
It is appropriate when calculating averages of rates_.
.. _`harmonic mean`: http... | 28.446809 | 81 | 0.617801 | [
"MIT"
] | sheriferson/simple-statistics-py | simplestatistics/statistics/harmonic_mean.py | 1,337 | Python |
# Copyright 2020 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.txt" file acc... | 38.313131 | 120 | 0.676246 | [
"Apache-2.0"
] | eshpc/aws-parallelcluster | tests/integration-tests/tests/tags/test_tag_propagation.py | 7,586 | Python |
from flask import Flask, redirect, url_for
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_migrate import Migrate
from flask_bcrypt import Bcrypt
from flask_mail import Mail
app = Flask(__name__)
# Configuration
app.config.from_object('config.DevelopmentConfig')
db = SQLAlchemy... | 28.678571 | 60 | 0.809465 | [
"MIT"
] | hazzillrodriguez/flask-user-management | app/__init__.py | 803 | Python |
import torch
import random
import numpy as np
class InfiniteDataLoader(torch.utils.data.DataLoader):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.dataset_iterator = super().__iter__()
def __iter__(self):
return self
def __next__(self):
... | 38.146067 | 92 | 0.671281 | [
"MIT"
] | gmberton/CosPlace | commons.py | 3,395 | Python |
from bedlam import Game
from bedlam import Scene
from bedlam import Sprite
from balls import Ball
# __pragma__('skip')
document = window = Math = Date = console = 0 # Prevent complaints by optional static checker
# __pragma__('noskip')
# __pragma__('noalias', 'clear')
DEBUG = False
class PVector:
def __init__... | 31.44523 | 117 | 0.539049 | [
"BSD-2-Clause"
] | KeithRieck/bedlam | boids.py | 8,899 | Python |
# -*- coding: utf-8 -*-
from pandas import DataFrame
from pandas_ta.utils import get_offset, verify_series
def donchian(high, low, lower_length=None, upper_length=None, offset=None, **kwargs):
"""Indicator: Donchian Channels (DC)"""
# Validate arguments
high = verify_series(high)
low = verify_series(l... | 35.361446 | 151 | 0.69983 | [
"MIT"
] | MyBourse/pandas-ta | pandas_ta/volatility/donchian.py | 2,935 | Python |
import unittest
from unittest.mock import Mock
# PyATS
from pyats.topology import Device
from genie.metaparser.util.exceptions import SchemaEmptyParserError, \
SchemaMissingKeyError
from genie.libs.parser.asa.show_vpn import ShowVPNLoadBalancing
# ============================... | 35.408696 | 82 | 0.370088 | [
"Apache-2.0"
] | IreneZhou0129/genieparser | src/genie/libs/parser/asa/tests/test_show_vpn.py | 4,072 | Python |
from django.shortcuts import render
from django.http import HttpResponse
def feedHome(request):
return HttpResponse('<p>Welcome To My Social App</p>') | 26.166667 | 59 | 0.770701 | [
"MIT"
] | njokuifeanyigerald/django-social-media-app | feed/views.py | 157 | Python |
# <editor-fold desc="Basic Imports">
import os
import os.path as p
import requests
from time import time
from argparse import ArgumentParser
import sys
sys.path.append(p.join(p.dirname(__file__), '..'))
sys.path.append(p.join(p.dirname(__file__), '../..'))
# </editor-fold>
# <editor-fold desc="Parse Command Line Args... | 40.428571 | 90 | 0.652196 | [
"MIT"
] | usc-isi-i2/dig-text-similarity-search | py_scripts/preprocessing/prep_shard.py | 7,924 | Python |
import pytest
pmgout = pytest.importorskip("pymatgen.io.vasp.outputs")
Vasprun = pmgout.Vasprun
import os
import numpy as np
from flare.struc import Structure, get_unique_species
from flare.dft_interface.vasp_util import md_trajectory_from_vasprun
from flare.utils.flare_io import md_trajectory_to_file, md_trajectory_f... | 35.24 | 84 | 0.779796 | [
"MIT"
] | sh-divya/flare | tests/test_flare_io.py | 881 | Python |
from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.kubernetes.checks.resource.base_spec_check import BaseK8Check
strongCiphers = ["TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305","TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA... | 49.75 | 329 | 0.672111 | [
"Apache-2.0"
] | Arun-kc/checkov | checkov/kubernetes/checks/resource/k8s/KubeletCryptographicCiphers.py | 1,592 | Python |
import argparse
import os.path
import time
import numpy as np
import tensorflow as tf
from tensorflow.python import debug as tf_debug
from util.default_util import *
from util.param_util import *
from util.model_util import *
from util.eval_util import *
from util.debug_logger import *
from util.train_logger import ... | 45.682216 | 130 | 0.689195 | [
"Apache-2.0"
] | Atul-Anand-Jha/reading_comprehension_tf | reading_comprehension/reading_comprehension_run.py | 15,669 | Python |
from __future__ import print_function, absolute_import, division
import argparse
import os
import zipfile
import tarfile
import numpy as np
import h5py
from glob import glob
from shutil import rmtree
import sys
sys.path.append('../')
from common.h36m_dataset import H36M_NAMES
output_filename_pt = 'data_2d_h36m_sh_... | 31.768116 | 119 | 0.62979 | [
"Apache-2.0"
] | fullmoonhalf/SemGCN | data/prepare_data_2d_h36m_sh.py | 4,384 | Python |
# -*- coding: utf-8 -*-
# pylint: disable=C,R,W
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import sqlparse
from sqlparse.sql import Identifier, IdentifierList
from sqlparse.tokens import Keyword, N... | 34.822695 | 79 | 0.614868 | [
"Apache-2.0"
] | AmberCa/incubator-superset | superset/sql_parse.py | 4,910 | Python |
import dynet as dy
import time
import random
LAYERS = 2
INPUT_DIM = 256 #50 #256
HIDDEN_DIM = 256 # 50 #1024
VOCAB_SIZE = 0
from collections import defaultdict
from itertools import count
import argparse
import sys
import util
class RNNLanguageModel:
def __init__(self, model, LAYERS, INPUT_DIM, HIDDEN_DIM, VOC... | 32.676259 | 105 | 0.568692 | [
"Apache-2.0"
] | kashif/dynet | examples/rnnlm/rnnlm.py | 4,542 | Python |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from mcts.webapi_tests.fm_radio.fm_radio_test import FMRadioTestCommon
from mcts.webapi_tests.fm_radio.test_fm_radio_bas... | 49.571429 | 75 | 0.801153 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | Mozilla-GitHub-Standards/7842899900b1eec401075a453a03b659ec3c617f97543c62d75cb76ebb9be8b4 | mcts/webapi_tests/fm_radio/__init__.py | 347 | Python |
"""Views of problem2 app."""
from django.shortcuts import render
from .forms import FiboForm
def display(request):
"""Function view to display form in the standard manner."""
if request.method == 'POST':
form = FiboForm(request.POST)
if form.is_valid():
fibo = form.save(commit=Fa... | 29.52381 | 69 | 0.593548 | [
"BSD-3-Clause"
] | byteknacker/eulerapps | problem2/views.py | 620 | Python |
import unittest
from foucluster.plot import song_plot, diff_plot, heatmap_song
import configparser
import os
import json
from scipy.io.wavfile import read
import numpy as np
import pandas as pd
class TestPlot(unittest.TestCase):
@staticmethod
def _get_series(i=0):
"""
:return:
"""
... | 29.11236 | 93 | 0.547665 | [
"MIT"
] | cperales/Fourier-Clustering-song | test/test_b_plot.py | 2,591 | Python |
# Generated by Django 2.2.4 on 2020-06-25 17:17
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import internationalflavor.countries.models
import internationalflavor.vat_number.models
class Migration(migrations.Migration):
initial = True
dependenc... | 56.261538 | 128 | 0.637134 | [
"Apache-2.0"
] | PragmaticMates/django-commerce | commerce/migrations/0001_initial.py | 3,657 | Python |
# noqa: D400,D205
"""
Optimize
========
Multistart optimization with support for various optimizers.
"""
from .load import (
fill_result_from_history,
optimization_result_from_history,
read_result_from_file,
read_results_from_file,
)
from .optimize import minimize
from .optimizer import (
CmaesOpt... | 19.551724 | 60 | 0.746032 | [
"BSD-3-Clause"
] | m-philipps/pyPESTO | pypesto/optimize/__init__.py | 567 | Python |
from typing import Literal
from bolinette import data, types
from bolinette.data import mapping
from bolinette.exceptions import InternalError
from bolinette.utils.functions import getattr_, hasattr_, invoke
class Mapper:
def __init__(self):
self._payloads: dict[str, dict[str, mapping.Definition]] = {}
... | 35.968254 | 88 | 0.582966 | [
"MIT"
] | TheCaptainCat/bolinette | bolinette/data/mapping/mapper.py | 6,798 | Python |
#!/usr/bin/env python3
import pandas as pd
# Kestrel analytics default paths (single input variable)
INPUT_DATA_PATH = "/data/input/0.parquet.gz"
OUTPUT_DATA_PATH = "/data/output/0.parquet.gz"
OUTPUT_DISPLAY = "/data/display/ret.html"
def analytics(dataframe):
# analyze data in dataframe
# provide insights ... | 28.785714 | 68 | 0.703474 | [
"Apache-2.0"
] | IBM/kestrel-analytics | template/analytics.py | 806 | Python |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/structure/dantooine/shared_dant_boundary_post.iff"
result.attribute_tem... | 26.941176 | 84 | 0.731441 | [
"MIT"
] | SWGANHServices/GameServer_Legacy | data/scripts/templates/object/static/structure/dantooine/shared_dant_boundary_post.py | 458 | Python |
# Generated by Django 2.1.2 on 2019-03-19 22:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('partners', '0008_merge_20190307_1527'),
]
operations = [
migrations.AddField(
model_name='partner',
name='is_publish... | 22.157895 | 78 | 0.619952 | [
"MIT"
] | TEDxNTUA/tedxntua2019 | project/partners/migrations/0009_partner_is_published.py | 421 | Python |
from argparse import ArgumentParser
class ChannelMap():
channel_map = {
'master': {
'tfm': 'netcoreapp5.0',
'branch': 'master'
},
'release/3.1.2xx': {
'tfm': 'netcoreapp3.1',
'branch': 'release/3.1.2xx'
},
'release/3.1.1xx': {
... | 34.702381 | 150 | 0.575643 | [
"MIT"
] | artelk/performance | scripts/channel_map.py | 2,915 | Python |
# Copyright (c) 2019, NVIDIA CORPORATION. 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 applicabl... | 31.402857 | 85 | 0.59203 | [
"ECL-2.0",
"Apache-2.0"
] | AOE-khkhan/kaolin | examples/ImageRecon/OccNet/architectures.py | 10,991 | Python |
from .CosineSimilarityLoss import *
from .SoftmaxLoss import *
from .MultipleNegativesRankingLoss import *
from .TripletLoss import *
from .MSELoss import *
from .ContrastiveLoss import *
from .OnlineContrastiveLoss import *
from .MegaBatchMarginLoss import *
from .DenoisingAutoEncoderLoss import *
# Triplet losses
fr... | 31.6 | 45 | 0.827004 | [
"Apache-2.0"
] | WHU-Peter/sentence-transformers | sentence_transformers/losses/__init__.py | 474 | Python |
# -*- coding: utf-8 -*-
# @Time : 2020/8/8 下午4:22
# @Author : 司云中
# @File : routing.py
# @Software: Pycharm
from django.urls import path, re_path
websocket_urlpatterns = [
# 官方解释path可能存在某种bug,用re_path既可以支持正则,也可以支持path路由匹配规则
re_path(r'concern_notice',), # 用户店铺关注,当店主上架新商品的时候进行商品推送
re_path(r'buy_notice',... | 23.266667 | 61 | 0.681948 | [
"Apache-2.0"
] | syz247179876/Chsc-Shop | propel_app/routing.py | 499 | Python |
"""
WARNING: This file about to undergo major refactoring by @pydanny per
Issue #99.
"""
from importlib import import_module
from django.conf import settings
from django.conf.urls import url
from django.core.exceptions import ImproperlyConfigured
from . import apiviews
from . import types
from . import utils
from . i... | 33.927536 | 81 | 0.581803 | [
"BSD-3-Clause"
] | PowerOlive/django-admin2 | djadmin2/core.py | 7,023 | Python |
#!/usr/bin/python2
MIN = -10000
MAX = 10000
| 7.666667 | 18 | 0.630435 | [
"MIT"
] | AI-comp/Orientation2015Problems | a+b/tests/constants.py | 46 | Python |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, stripe and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestStripeSetting(unittest.TestCase):
pass
| 19.272727 | 45 | 0.764151 | [
"MIT"
] | Hitesh1595/stripe | stripe/stripe/doctype/stripe_setting/test_stripe_setting.py | 212 | Python |
"""
Save module for the console.
"""
import json
from typing import List, Optional
from spotdl.utils.search import parse_query
from spotdl.utils.m3u import create_m3u_file
def save(
query: List[str],
save_path: str,
downloader,
m3u_file: Optional[str] = None,
) -> None:
"""
Save metadata fr... | 23.510204 | 88 | 0.653646 | [
"MIT"
] | phcreery/spotdl-v4 | spotdl/console/save.py | 1,152 | Python |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from contrib.media_router_benchmarks import media_router_cpu_memory_metric
from telemetry.page import legacy_page_test
class MediaRouterCPUMemoryTest(legac... | 37.055556 | 78 | 0.803598 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | DamieFC/chromium | tools/perf/contrib/media_router_benchmarks/media_router_measurements.py | 667 | Python |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 31.857143 | 74 | 0.765695 | [
"ECL-2.0",
"Apache-2.0"
] | Channingss/paddle2onnx | tests/test_elementwise_mul_op.py | 892 | Python |
# -*- coding: utf-8 -*-
# https://github.com/cvzi/foodemoji
import sys
import os
import timeit
try:
import foodemoji
except ImportError:
include = os.path.relpath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, include)
import foodemoji
print("Imported foodemoji from %s" % os.path... | 36.952381 | 780 | 0.726804 | [
"MIT"
] | cvzi/foodemoji | tests/speed.py | 5,469 | Python |
import argparse
import scipy
from scipy import ndimage
import numpy as np
import sys
import re
from packaging import version
import torch
from torch.autograd import Variable
import torchvision.models as models
import torch.nn.functional as F
from torch.utils import data, model_zoo
from model.deeplab import Res_Deeplab... | 42.207843 | 231 | 0.632816 | [
"MIT"
] | qimw/UACDA | generate_plabel_dark_zurich.py | 10,763 | Python |
"""
WSGI config for colaboradados_django project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault... | 23.222222 | 80 | 0.796651 | [
"MIT"
] | dennys-bd/colaboradados_django | colaboradados_django/wsgi.py | 418 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.