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 |
|---|---|---|---|---|---|---|---|---|
import QueueLinkedList as queue
"""
n1
/\
n2 n3
/\ /\
n4 n5 n6 n7
"""
class BinaryTree:
def __init__(self, size) -> None:
self.customList = size * [None]
self.lastUsedIndex = 0
self.maxSize = size
def inserNode(self, value):
if self.lastUsedIndex + 1 == self.m... | 25.705882 | 72 | 0.621663 | [
"MIT"
] | eferroni/Data-Structure-and-Algorithms | Trees/BinaryTreePL.py | 2,622 | Python |
"""hackernews URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
... | 35.136364 | 78 | 0.690815 | [
"MIT"
] | Saltiest-Hacker-News-Trolls-2/DS | hackernews/hackernews/urls.py | 773 | Python |
import numpy as np
import cv2 as cv
import math
from server.cv_utils import *
def filterGaussian(img,size=(5,5),stdv=0):
"""Summary of filterGaussian
This will apply a noise reduction filter, we will use s 5x5 Gaussian filter to smooth
the image to lower the sensitivity to noise. (The smaller the size... | 36.149123 | 152 | 0.665372 | [
"BSD-3-Clause"
] | eamorgado/Car-Self-driving-Simulator | CarlaDriving/server/lane_detection/utils.py | 8,242 | Python |
"""
A small utility aiming to create programatically sound.
"""
from __future__ import annotations
from importlib import metadata
__version__ = metadata.version("sarada")
| 19.222222 | 55 | 0.791908 | [
"MIT"
] | wikii122/sarada | sarada/__init__.py | 173 | Python |
import imp
from tkinter import *
from sys import exit
from teste.testeCores.corFunc import formatar
conta2x2 = 'x2y=5\n3x-5y=4'
root = Tk()
text = Text(root, width=20, height=10)
text.config(font='arial 20 bold')
text.insert(END, conta2x2)
text.pack()
def q_evento(event):
exit()
root.bind('q', q_evento)
cs = cont... | 21.76087 | 63 | 0.656344 | [
"MIT"
] | jonasht/python | 06-sistemaLinear/sistemaLinear_v11/teste/testeCores/cores2.py | 1,001 | Python |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | 33.303279 | 81 | 0.629461 | [
"Apache-2.0"
] | 1upon0/cotyledon | cotyledon/_service.py | 8,126 | Python |
# Copyright 2013 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.
"""
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit API built into depot_tools.
"""
def GetPr... | 37.15493 | 80 | 0.736164 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | Ron423c/chromium | tools/metrics/histograms/PRESUBMIT.py | 5,276 | Python |
import config
from twitter import *
def main():
t = Twitter(
auth=OAuth(config.TW_TOKEN, config.TW_TOKEN_SECRET, config.TW_CONSUMER_KEY, config.TW_CONSUMER_SECRET))
# Post a message
msg = 'テスト投稿ですm(_ _)m'
t.statuses.update(status=msg)
if __name__ == '__main__':
main()
| 19.375 | 111 | 0.66129 | [
"MIT"
] | maroemon58/twitter-bot | main.py | 324 | Python |
import cv2
import pose_detection as pose_d
pose_model = pose_d.load_pose_model('pre_trained\AFLW2000.pkl')
def detect_face(img_PATH, model_PATH):
# Load the cascade
face_cascade = cv2.CascadeClassifier(model_PATH)
# Read the input image
img = cv2.imread(img_PATH)
# Convert into grayscale
gray = cv2.cvtCo... | 31.875 | 103 | 0.645588 | [
"MIT"
] | HDWilliams/User_Verification_HPE | face_detection_cv2.py | 2,040 | Python |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the isBalanced function below.
def isBalanced(s):
left_symbol = [ '{', '[', '(']
right_symbol = [ '}', ']', ')']
# fast checking of symbol counting equality
for i in range(3):
left_count = s.count( left_symbo... | 17.702703 | 63 | 0.499237 | [
"MIT"
] | brianchiang-tw/HackerRank | Data Structures/Stack/Balanced Bracket/balanced_bracket.py | 1,310 | Python |
import unittest
import attr
import numpy as np
from robogym.randomization.env import (
EnvActionRandomizer,
EnvObservationRandomizer,
EnvParameterRandomizer,
EnvRandomization,
EnvSimulationRandomizer,
build_randomizable_param,
)
from robogym.randomization.observation import ObservationRandomiz... | 31.976563 | 87 | 0.658441 | [
"MIT"
] | 0xflotus/robogym | robogym/randomization/tests/test_randomization.py | 4,093 | Python |
# COMBINATION:
# combination is all the different ways that we can group something where the order does not matter.
# PERMUTATION:
# permutation is all the different ways that we can group something where the order does matter.
import itertools
my_list=[1,2,3]
my_combinations=itertools.combinations(my_list,2)# here fi... | 29.35 | 156 | 0.748722 | [
"MIT"
] | ahammadshawki8/Proggraming-Terms | term06 (permutation and combination).py | 1,174 | Python |
import logging
from flask import request, flash, abort, Response
from flask_admin import expose
from flask_admin.babel import gettext, ngettext, lazy_gettext
from flask_admin.model import BaseModelView
from flask_admin.model.form import wrap_fields_in_fieldlist
from flask_admin.model.fields import ListEditableFieldLi... | 31.095679 | 114 | 0.551663 | [
"Apache-2.0"
] | hexlism/css_platform | sleepyenv/lib/python2.7/site-packages/Flask_Admin-1.2.0-py2.7.egg/flask_admin/contrib/mongoengine/view.py | 20,150 | Python |
import requests, json, os, time
from PIL import Image
from io import BytesIO
import img2pdf
class jumpplus_downloader:
def __init__(self):
self.file=0
self.h=1200
self.w=760
def auto_list_download(self, url, next=False, sleeptime=20,pdfConversion=True):
self.json_download(url)
... | 35.414414 | 159 | 0.583821 | [
"MIT"
] | Lutwidse/jumpplus-downloader | py/lib/jumpplus_downloader.py | 3,931 | Python |
import os
import sys
import numpy as np
from PIL import Image
import torch
#TODO - add save function, these functions can be used to check movement
def crop_image(image_array, bb):
image_array_copy = image_array.clone()
y_min = int(bb[0])
x_min = int(bb[1])
height = int(bb[2])
width = int(bb[3])
... | 31.764706 | 77 | 0.683333 | [
"MIT"
] | richielo/Medical_Localization_RL | pneumoRL/image_util.py | 2,160 | Python |
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PRO... | 40.175439 | 124 | 0.624672 | [
"Apache-2.0"
] | Imperas/force-riscv | tests/riscv/vector/vector_wide_operand_conflict_force.py | 4,580 | Python |
import numpy as np
import matplotlib.pyplot as plt
def estimate(particles, weights):
"""returns mean and variance of the weighted particles"""
pos = particles
mean = np.average(pos, weights=weights, axis=0)
var = np.average((pos - mean)**2, weights=weights, axis=0)
return mean, var
def s... | 29.05 | 93 | 0.650602 | [
"MIT"
] | zhyongquan/Automotive-Software-Blog | 002_Particle_Filter/Particle_Filter.py | 1,939 | Python |
#
# PySNMP MIB module ADIC-INTELLIGENT-STORAGE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ADIC-INTELLIGENT-STORAGE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:13:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python vers... | 123.405028 | 4,464 | 0.774735 | [
"Apache-2.0"
] | agustinhenze/mibs.snmplabs.com | pysnmp-with-texts/ADIC-INTELLIGENT-STORAGE-MIB.py | 44,179 | Python |
"""Tests to ensure that the html.parser tree builder generates good
trees."""
from pdb import set_trace
import pickle
from bs4.testing import SoupTest, HTMLTreeBuilderSmokeTest
from bs4.builder import HTMLParserTreeBuilder
from bs4.builder._htmlparser import BeautifulSoupHTMLParser
class HTMLParserTreeBuilderSmokeTes... | 35.166667 | 79 | 0.690758 | [
"Unlicense"
] | AG371/bus-reservation-system | virtual/lib/python3.6/site-packages/bs4/tests/test_htmlparser.py | 1,688 | Python |
from flask import render_template,redirect,url_for,request,flash
from . import auth
from ..models import Group
from .forms import RegistrationForm,LoginForm
from .. import db
from flask_login import login_user,logout_user,login_required
@auth.route('/login', methods=["GET", "POST"])
def login():
login_form = Logi... | 24.517857 | 91 | 0.697742 | [
"MIT"
] | mwerumuchai/jukebox | app/auth/views.py | 1,373 | Python |
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
import settings.base
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'profiles.views.index', name='index'),
url(r'^accou... | 40.305556 | 73 | 0.669194 | [
"MIT"
] | Reinaldowijaya/explorind | explorind_project/explorind_project/urls.py | 1,451 | Python |
import _plotly_utils.basevalidators
class ColorbarValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="colorbar", parent_name="volume", **kwargs):
super(ColorbarValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | 47.359833 | 79 | 0.526372 | [
"MIT"
] | 1abner1/plotly.py | packages/python/plotly/plotly/validators/volume/_colorbar.py | 11,319 | Python |
from django.urls import path, include
from . import views
app_name = 'users'
urlpatterns = [
path('login/', views.LoginView.as_view(), name = 'login'),
path('logout/', views.LogoutView.as_view(), name = 'logout'),
path('register/', views.RegisterView.as_view(), name = 'register'),
path('', include('d... | 26.923077 | 71 | 0.66 | [
"Apache-2.0"
] | CMPUT404-F21T0/CMPUT404-Project-BetterSocial | socialdistribution/users/urls.py | 350 | Python |
"""GoodWe PV inverter numeric settings entities."""
from __future__ import annotations
from collections.abc import Awaitable, Callable
from dataclasses import dataclass
import logging
from goodwe import Inverter, InverterError
from homeassistant.components.number import NumberEntity, NumberEntityDescription
from hom... | 32.081818 | 85 | 0.706999 | [
"Apache-2.0"
] | kubawolanin/core | homeassistant/components/goodwe/number.py | 3,529 | Python |
from unittest import TestCase
from doccano_transformer import utils
class TestUtils(TestCase):
def test_get_offsets(self):
text = ' This is Doccano Transformer . '
tokens = text.split()
result = utils.get_offsets(text, tokens)
expected = [1, 6, 9, 17, 29]
self.assertListE... | 35.722222 | 72 | 0.623639 | [
"MIT"
] | 7brokenmirrors/doccano-transformer | tests/test_utils.py | 1,286 | Python |
# -*- coding: utf-8 -*-
"""Configuration file for sniffer."""
# pylint: disable=superfluous-parens,bad-continuation
import time
import subprocess
from sniffer.api import select_runnable, file_validator, runnable
try:
from pync import Notifier
except ImportError:
notify = None
else:
notify = Notifier.notif... | 22.94898 | 78 | 0.636727 | [
"Apache-2.0",
"BSD-2-Clause"
] | EazeAI/AI-WS | scent.py | 2,255 | Python |
"""Provide useful functions for using PTLFlow."""
# =============================================================================
# Copyright 2021 Henrique Morimitsu
#
# 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... | 34.440476 | 123 | 0.689019 | [
"Apache-2.0"
] | hmorimitsu/ptlflow | ptlflow/__init__.py | 8,679 | Python |
# _*_ coding: utf-8 _*_
"""
Created by Allen7D on 2018/5/12.
"""
from app import create_app
__author__ = 'Allen7D'
from app.models.base import db
from app.models.user import User
app = create_app()
with app.app_context():
with db.auto_commit():
# 创建一个超级管理员
user = User()
user.openid = '99... | 22.53125 | 34 | 0.568655 | [
"MIT"
] | HuaiGuang10/mini-shop-server | fake.py | 757 | Python |
import requests
import pprint
from config import API_KEY
base_url = f'https://api.telegram.org/bot{API_KEY}/'
api_response = requests.get(base_url + 'getUpdates').json()
for update in api_response['result']:
message = update['message']
chat_id = message['chat']['id']
text = message['text']
reply_... | 24.7 | 63 | 0.668016 | [
"Apache-2.0"
] | keys4words/bots | telegramsLibs/api_telega_intro.py | 494 | Python |
# Metafier V2: writes directly to output.mc
# Uses numpy and memoization to speed up a crap ton & compress data a bit
# ===REQUIRES metatemplate11.mc===
import golly as g
import numpy as np
from shutil import copyfile
#Get the selection
selection = g.getselrect()
if not selection: g.exit("No selection.")
... | 40.379747 | 167 | 0.551097 | [
"MIT"
] | IkeoluwaStat/QFT | MetafierV2.py | 3,190 | Python |
import os
import pickle
import math
import pandas as pd
from const import *
def middle_save(obj, inf):
pickle.dump(obj, open(inf, "wb"), True)
def middle_load(inf):
return pickle.load(open(inf, "rb"))
def word2idx(sents, word2idx):
return [[word2idx[w] if w in word2idx else UNK for w in s] for s in ... | 29.689655 | 87 | 0.532172 | [
"MIT"
] | ne7ermore/deeping-flow | hierarchical-sc/corpus.py | 4,305 | Python |
from .Essential_Functions import URL_Maker, Negative_Detector
from .Scrape_Index import Scrape_Index
from .Scrape_StockInfo import StockInfo
from .Scrape_StockData_Realtime import Realtime_StockData
| 40.6 | 62 | 0.871921 | [
"MIT"
] | Farhad-Shabani/TSETMC_Dashboard | src/__init__.py | 203 | Python |
from boa3.builtin import public
@public
def test_raise(arg: int):
x = Exception
if arg < 0:
raise x
| 13.111111 | 31 | 0.627119 | [
"Apache-2.0"
] | CityOfZion/neo3-boa | boa3_test/test_sc/exception_test/RaiseVariableException.py | 118 | Python |
#!/bin/env
"""
Help new users configure the database for use with social networks.
"""
import os
from datetime import datetime
# Fix Python 2.x.
try:
input = raw_input
except NameError:
pass
import django
from django.conf import settings
from django.core.management.utils import get_random_secret_key
BASE_DI... | 26.699187 | 101 | 0.624848 | [
"MIT"
] | dodo325/demo-allauth-bootstrap-ru | configure_new.py | 3,284 | Python |
import os
import openprocurement.agreement.cfaua
from logging import getLogger
from pyramid.interfaces import IRequest
from openprocurement.api.interfaces import IContentConfigurator
from openprocurement.agreement.cfaua.interfaces import IClosedFrameworkAgreementUA
from openprocurement.agreement.cfaua.models.agreemen... | 32.645161 | 96 | 0.8083 | [
"Apache-2.0"
] | BohdanBorkivskyi/openprocurement.api | src/openprocurement/agreement/cfaua/includeme.py | 1,012 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script to demonstrate vaspy.incar functionality.
"""
import argparse
import vaspy
import vaspy.incar
from logging import DEBUG, INFO, Formatter, StreamHandler, getLogger
LOGLEVEL = DEBUG
logger = getLogger(__name__)
fmt = "%(asctime)s %(levelname)s %(name)s :%(messa... | 27.310345 | 87 | 0.703283 | [
"BSD-3-Clause"
] | arafune/vaspy | scripts/vaspy-incar.py | 1,584 | Python |
'''
blackbody.py - Color of thermal blackbodies.
Description:
Calculate the spectrum of a thermal blackbody at an arbitrary temperature.
Constants:
PLANCK_CONSTANT - Planck's constant, in J-sec
SPEED_OF_LIGHT - Speed of light, in m/sec
BOLTZMAN_CONSTANT - Boltzman's constant, in J/K
SUN_TEMPERATURE - Surface... | 35.852632 | 116 | 0.695831 | [
"MIT"
] | gmweir/QuasiOptics | colorpy/colorpy-0.1.0/blackbody.py | 6,812 | Python |
import mugReader
from flask import Flask, request
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class readMugRFID(Resource):
def get(self):
return {'mugId': mugReader.readMug()}
api.add_resource(brewSettings, '/mugReader/')
if __name__ == "__main__":
#remove host for production... | 17.65 | 45 | 0.733711 | [
"MPL-2.0"
] | joelhaasnoot/MugsyDev | endpoints/mugReader.py | 353 | Python |
#!/usr/bin/env python
#from .core import *
import numpy as np
import pandas as pd
import shutil
import urllib
import urlparse
from os.path import splitext, basename
import os
from os import sys, path
from pprint import pprint
import StringIO
import db
from gp import *
from core import *
from IPython.core.debugger impor... | 25.965517 | 115 | 0.759628 | [
"Apache-2.0"
] | cozy9/Metascape | database/task_class/annotation.py | 753 | Python |
# -*- coding: utf-8 -*-
import io
import json
import os
import sys
import shutil
from os import path
import django
from django.core.management.base import CommandError
from django.core.management.templates import TemplateCommand
from django.conf import settings
import blueapps
PY_VER = sys.version
class Command(Tem... | 39.093923 | 95 | 0.535048 | [
"Apache-2.0"
] | xianmao/bk-sops | blueapps/contrib/bk_commands/management/commands/startweixin.py | 7,390 | Python |
"""
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... | 44.587189 | 484 | 0.58624 | [
"MIT"
] | Crypto-APIs/Crypto_APIs_2.0_SDK_Python | cryptoapis/model/coins_forwarding_success_data.py | 12,529 | Python |
#!usr/bin/env python3.7
#-*-coding:utf-8-*-
import json
import discord
PATH = "config.json"
def singleton(class_):
instances = {}
def getinstance(*args, **kwargs):
if class_ not in instances:
instances[class_] = class_(*args, **kwargs)
return instances[class_]
return getinstan... | 38.85 | 80 | 0.640927 | [
"MIT"
] | ttgc/zigotoland | src/utils/config.py | 2,331 | Python |
from __future__ import unicode_literals
import pytest
import itertools
import boto
import boto3
from botocore.exceptions import ClientError
from boto.exception import EC2ResponseError
from boto.ec2.instance import Reservation
import sure # noqa
from moto import mock_ec2_deprecated, mock_ec2
import pytest
from tests... | 33.60198 | 137 | 0.687194 | [
"Apache-2.0"
] | monty16597/moto | tests/test_ec2/test_tags.py | 16,969 | Python |
from celery.loaders.base import BaseLoader
class AppLoader(BaseLoader):
def on_worker_init(self):
self.import_default_modules()
def read_configuration(self):
return {}
| 17.818182 | 42 | 0.709184 | [
"BSD-3-Clause"
] | frac/celery | celery/loaders/app.py | 196 | Python |
class AvalaraExceptionResponse(Exception):
pass | 25.5 | 42 | 0.823529 | [
"MIT"
] | SendOutCards/py-avalara | avalara/exceptions.py | 51 | Python |
'''define the config file for ade20k and resnet101os16'''
import os
from .base_cfg import *
# modify dataset config
DATASET_CFG = DATASET_CFG.copy()
DATASET_CFG.update({
'type': 'ade20k',
'rootdir': os.path.join(os.getcwd(), 'ADE20k'),
})
# modify dataloader config
DATALOADER_CFG = DATALOADER_CFG.copy()
# mod... | 25.913043 | 106 | 0.71896 | [
"MIT"
] | CharlesPikachu/sssegmentation | ssseg/cfgs/deeplabv3/cfgs_ade20k_resnet101os16.py | 1,192 | Python |
# Generated by Django 2.1.2 on 2018-11-01 14:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("jbank", "0024_auto_20180425_1704"),
]
operations = [
migrations.AddField(
model_name="payout",
name="reference",
... | 26.833333 | 110 | 0.604037 | [
"MIT"
] | bachvtuan/django-jbank | jbank/migrations/0025_auto_20181101_1430.py | 644 | Python |
import os
import sys
import numpy as np
import caffe
import argparse
parser = argparse.ArgumentParser(description='Computes 5-fold cross-validation results over Twitter five-agrees dataset')
parser.add_argument('-ov', '--oversampling', help='Enables (1) or disables (0) oversampling')
args = parser.parse_args()
if ar... | 31.590909 | 160 | 0.58964 | [
"MIT"
] | imatge-upc/sentiment-2015-asm | compute_cross_validation_accuracy.py | 3,475 | Python |
"""
Make sure that tiddler fields which are not strings
are stringified, otherwise, the text serialization will
assplode.
"""
from tiddlyweb.serializer import Serializer
from tiddlyweb.model.tiddler import Tiddler
def setup_module(module):
pass
def test_float_field():
tiddler = Tiddler('foo', 'bar')
t... | 20.909091 | 56 | 0.719565 | [
"BSD-3-Clause"
] | funkyeah/tiddlyweb | test/test_tiddler_fields_as_strings.py | 460 | Python |
# a simple script to rename multiple files
import os
import re
path = 'myimages/'
files = os.listdir(path)
files.sort(key=lambda var:[int(x) if x.isdigit() else x for x in re.findall(r'[^0-9]|[0-9]+', var)])
for i, file in enumerate(files):
os.rename(path + file, path + "rename_{}".format(i)+".jpg")
print('do... | 27.166667 | 100 | 0.653374 | [
"CC0-1.0"
] | sagorbrur/sagorbrur.github.io | simple_task_python/rename.py | 326 | Python |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# vcdomainprovisioningconfig filter
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# --------------------------------------------... | 33.076923 | 99 | 0.495349 | [
"BSD-3-Clause"
] | ewwwcha/noc | vc/migrations/0010_vcdomainprobvisioningconfig_vcfilter.py | 860 | Python |
# Overloading Methods
class Point():
def __init__(self, x=0, y=0):
self.x = x
self.y = y
self.coords = (self.x, self.y)
def move(self, x, y):
self.x += x
self.y += y
# Overload __dunder__
def __add__(self, p):
return Point(self.x + p.x, self.y + p.y)
... | 21.52381 | 80 | 0.539823 | [
"MIT"
] | JeffreyAsuncion/TWT_TheCompletePythonCourse | ObjectOrientedProgramming/OOPpart4.py | 1,356 | Python |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 36.64 | 81 | 0.683816 | [
"Apache-2.0"
] | 13927729580/TensorFlowOnSpark | examples/cifar10/cifar10.py | 14,656 | Python |
# Funcoes servem para quando tivermos coisas repetitivas poder simplificar o programa
def lin(): # para definir um afuncao ela tem que ter parenteses no finalk
print('=-'*30)
lin()
print('Bem Vindo')
lin()
nome = str(input('Qual seu nome? '))
lin()
print(f'Tenha um otimo dia {nome}!')
lin()
def mensagem(msg):... | 20.416667 | 98 | 0.677551 | [
"MIT"
] | GabrielBrotas/Python | modulo 3/aulas/4.0 - Funcoes.py | 490 | Python |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
from .generation import (
TRANSFORM_FACTORIES,
colorspace_factory,
group_transform_factory,
look_factory,
named_transform_factory,
produce_transform,
transform_factory,
transform_factory_clf_tra... | 24.185185 | 57 | 0.743236 | [
"BSD-3-Clause"
] | michdolan/OpenColorIO-Config-ACES | opencolorio_config_aces/config/__init__.py | 1,959 | Python |
import logging
from logging.handlers import SMTPHandler, RotatingFileHandler
import os
from flask import Flask, request, current_app
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
from flask_mail import Mail
from flask_bootstrap import Bootstrap
from flask... | 33.686869 | 79 | 0.664168 | [
"MIT"
] | natalia-rios/flask-mega-tutorial | app/__init__.py | 3,335 | Python |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 21 15:49:49 2017
@author: tkoller
"""
import numpy as np
import numpy.linalg as nLa
from ..utils import unavailable
try:
import matplotlib.pyplot as plt
_has_matplotlib = True
except:
_has_matplotlib = False
@unavailable(not _has_matplotlib, "matplotlib")
... | 26.791667 | 82 | 0.591757 | [
"MIT"
] | Pathetiue/safe-exploration | safe_exploration/visualization/utils_visualization.py | 2,572 | Python |
import sys
import os
import argparse
import json
import numpy as np
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'lib'))
import inputparser
import clustermaker
def write_ssms(variants, outfn):
_stringify = lambda A: ','.join([str(V) for V in A])
mu_r = 0.999
cols = ('id', 'gene', 'a', 'd'... | 28.824561 | 83 | 0.656726 | [
"MIT"
] | J-Moravec/pairtree | comparison/pwgs/convert_inputs.py | 1,643 | Python |
from pandas import DataFrame
import matplotlib.pyplot as plt
import seaborn as sns
import csv,sys
ExperimentName=sys.argv[1]
with open(ExperimentName+'.csv', newline='') as f:
reader = csv.reader(f)
data = list(reader)
if ExperimentName == "pod-delete":
Index = ['Validation','For deployment application',... | 136.659574 | 675 | 0.763973 | [
"Apache-2.0"
] | ved432/test | utils/heatmap-coverage.py | 12,846 | Python |
# -*- coding: utf-8 -*-
"""
Created on 2013-2014
Author : Edouard Cuvelier
Affiliation : Université catholique de Louvain - ICTEAM - UCL Crypto Group
Address : Place du Levant 3, 1348 Louvain-la-Neuve, BELGIUM
email : firstname.lastname@uclouvain.be
"""
from numpy import *
import gmpy
from Crypto.Random.random import... | 33.584054 | 132 | 0.494208 | [
"Apache-2.0"
] | ecuvelier/PPAT | mathTools/field.py | 34,962 | Python |
# -*- coding: utf-8 -*-
# Copyright (C) 2019 - 2020 by Pedro Mendes, Rector and Visitors of the
# University of Virginia, University of Heidelberg, and University
# of Connecticut School of Medicine.
# All rights reserved.
# Copyright (C) 2017 - 2018 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc.,... | 32.162791 | 95 | 0.721981 | [
"Artistic-2.0"
] | MedAnisse/COPASI | copasi/bindings/python/unittests/Test_CFunctionParameter.py | 2,766 | Python |
#!/usr/bin/python
#
# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | 29.980315 | 113 | 0.548785 | [
"MIT"
] | audevbot/autorest.cli.debug | generated/intermediate/ansible-module-rest/azure_rm_apimanagementapiexport_info.py | 7,615 | Python |
# TODO: By PySCF-1.5 release
# Copyright 2014-2020 The PySCF Developers. 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.... | 37.158516 | 274 | 0.621103 | [
"Apache-2.0"
] | JFurness1/pyscf | pyscf/tools/Molpro2Pyscf/wmme.py | 22,035 | Python |
__author__ = 'aakilomar'
import requests, json, time
from timeit import default_timer as timer
requests.packages.urllib3.disable_warnings()
host = "https://localhost:8443"
def cancel_event(eventid):
post_url = host + "/api/event/cancel/" + str(eventid)
return requests.post(post_url,None, verify=False).json(... | 40.485714 | 159 | 0.702541 | [
"BSD-3-Clause"
] | Siyanda-Mzam/grassroot-platform | docs/tests/adhoc_requests.py | 5,668 | Python |
CLOUDFORMATION_TEMPLATE = """
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
s3FileName:
Type: String
environment:
Type: String
deploymentBucket:
Type: String
Resources:
# Place your AWS resources here
"""
| 13.764706 | 38 | 0.709402 | [
"MIT"
] | totalpunch/TPD-Pete | tpd_pete/template/template.py | 234 | Python |
from .attributions import Attributions, LIGAttributions
from .explainer import BaseExplainer
from .explainers.question_answering import QuestionAnsweringExplainer
from .explainers.sequence_classification import SequenceClassificationExplainer
| 48.6 | 79 | 0.901235 | [
"Apache-2.0"
] | MichalMalyska/transformers-interpret | transformers_interpret/__init__.py | 243 | Python |
#!---------------------------------------------------------------------!
#! Written by Madu Manathunga on 07/01/2021 !
#! !
#! Copyright (C) 2020-2021 Merz lab !
#! Copyright (C) 2020-2021 G... | 63.807292 | 214 | 0.476941 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | Madu86/QUICK-GenInt | src/oei/iclass/PFint.py | 12,254 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('workshops', '0062_no_invoice_for_historic_events'),
('workshops', '0062_add_stalled_unresponsive_tags'),
]
operations = [
... | 20.25 | 61 | 0.685185 | [
"MIT"
] | aditnryn/amy | workshops/migrations/0063_merge.py | 324 | Python |
"""
Django settings for project_name project.
Generated by 'django-admin startproject' using Django 3.2.8.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import ... | 28.08982 | 106 | 0.715412 | [
"Unlicense"
] | YoggyPutra/cobaq | project_name/settings.py | 4,691 | Python |
#!/usr/bin/env python
# Copyright 2015 The Kubernetes 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 appli... | 36.878848 | 79 | 0.683819 | [
"Apache-2.0"
] | BaiHuoYu/nbp | vendor/k8s.io/kubernetes/cluster/juju/layers/kubernetes-master/reactive/kubernetes_master.py | 37,137 | Python |
from ..api import rule
from ..api._endpoint import ApiEndpoint, maybe_login_required
from ..entities._entity import NotFound
from ..entities.commit import Commit, CommitSerializer
class CommitListAPI(ApiEndpoint):
serializer = CommitSerializer()
@maybe_login_required
def get(self):
"""
--... | 23.362319 | 73 | 0.584367 | [
"MIT"
] | Christian8491/conbench | conbench/api/commits.py | 1,612 | Python |
from django.apps import AppConfig
class Events(AppConfig):
name = 'events'
| 13.5 | 33 | 0.728395 | [
"MIT"
] | DeanORourke1996/haco | HacoWeb/haco/events/apps.py | 81 | Python |
############################################################################
# examples/multi_webcamera/host/test_module/__init__.py
#
# Copyright 2019, 2020 Sony Semiconductor Solutions Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the ... | 49.777778 | 76 | 0.717634 | [
"Apache-2.0"
] | Curly386/spresense | examples/multi_webcamera/host/test_module/__init__.py | 1,792 | Python |
import io
import logging
import os
import json
import time
import boto3
import botocore
from markov.utils import log_and_exit, Logger, get_boto_config, \
SIMAPP_EVENT_ERROR_CODE_500, SIMAPP_EVENT_ERROR_CODE_400, \
SIMAPP_S3_DATA_STORE_EXCEPTION
LOG = Logger(__name__, l... | 44.589552 | 125 | 0.604017 | [
"MIT"
] | Ending2015a/deepracer-local | src/rl_coach_2020_v2/src/markov/s3_client.py | 5,975 | Python |
"""Components for use in `CycleGroup`. For details, see `CycleGroup`."""
from __future__ import division, print_function
from six.moves import range
import numpy as np
import scipy.sparse as sparse
import unittest
from openmdao.core.explicitcomponent import ExplicitComponent
PSI = 1.
_vec_terms = {}
def _compu... | 41.802885 | 103 | 0.552444 | [
"Apache-2.0"
] | hwangjt/blue | openmdao/test_suite/components/cycle_comps.py | 17,390 | Python |
import tensorflow as tf
from TransformerNet.layers import Encoder, Decoder
def Decoder_test(*args, **kwargs):
inputs = tf.random.uniform((64, 62), dtype=tf.int64, minval=0, maxval=200) # (batch_size, input_seq_len)
enc_output = Encoder(num_layers=2, d_model=512, num_heads=8,
d... | 45.111111 | 111 | 0.602627 | [
"MIT"
] | TeaKatz/Models_Corpus | TransformerNet/layers/Decoder_test.py | 1,218 | Python |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# vim: expandtab:tabstop=4:shiftwidth=4
'''
oo_option lookup plugin for openshift-ansible
Usage:
- debug:
msg: "{{ lookup('oo_option', '<key>') | default('<default_value>', True) }}"
This returns, by order of priority:
* if it exists, the `cli_<key>` ansible... | 33.688312 | 143 | 0.653045 | [
"Apache-2.0"
] | Acidburn0zzz/openshift-ansible | lookup_plugins/oo_option.py | 2,604 | Python |
def show_function(protein):
from sabueso.entity.protein import get_function_card
return card
| 14.857143 | 56 | 0.769231 | [
"MIT"
] | dprada/Sabueso | sabueso/protein/show_function.py | 104 | Python |
from setuptools import setup
setup(name='mws',
version='0.2',
description='Multi window sender',
url='https://github.com/TheWorldOfCode/MWS',
author='TheWorldOfCode',
author_email='dannj75@gmail.com',
install_requires=[
"python-daemon>=2.2.4",
"python-xlib>=0.27... | 24.411765 | 50 | 0.561446 | [
"BSD-3-Clause"
] | TheWorldOfCode/MWS | packages/setup.py | 415 | Python |
from opentrons import protocol_api, types
metadata = {
"protocolName": "Testosaur Version 3",
"author": "Opentrons <engineering@opentrons.com>",
"description": 'A variant on "Dinosaur" for testing with Protocol API v3',
"source": "Opentrons Repository",
"apiLevel": "3.0",
}
def run(ctx: protocol_... | 35.083333 | 78 | 0.690024 | [
"Apache-2.0"
] | Opentrons/labware | api/tests/opentrons/data/testosaur_v3.py | 842 | Python |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import json
import os
import itertools
from datetime import datetime
from dateutil.relativedelta import relativedelta
import subprocess
from ..train_utils import TSCVSplitter
class ParameterSweeper:
"""
The function of this class i... | 38.771574 | 97 | 0.626997 | [
"MIT"
] | Grkrish2002/Time-Series-Forecasting | contrib/tsperf/cross_validation/cross_validation.py | 7,638 | Python |
# coding: utf-8
# In[ ]:
import os
import re
import tarfile
import requests
from pugnlp.futil import path_status, find_files
# In[ ]:
# From the nlpia package for downloading data too big for the repo
BIG_URLS = {
'w2v': (
'https://www.dropbox.com/s/965dir4dje0hfi4/GoogleNews-vectors-negative300.... | 23.73838 | 215 | 0.669762 | [
"MIT"
] | brusic/nlpia | nlpia/book/examples/ch09.py | 17,875 | Python |
from dataloaders.datasets import cityscapes, coco, combine_dbs, pascal, sbd, rip
from torch.utils.data import DataLoader
def make_data_loader(args, **kwargs):
if args.dataset == 'pascal':
train_set = pascal.VOCSegmentation(args, split='train')
val_set = pascal.VOCSegmentation(args, split='val')
... | 48.211268 | 112 | 0.684487 | [
"MIT"
] | dzwallkilled/pytorch-deeplab-xception | dataloaders/__init__.py | 3,423 | Python |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2009 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://genshi.edgewall.org/wiki/License.
#
# This software consist... | 37.134204 | 82 | 0.521604 | [
"Apache-2.0"
] | 262877348/Data | Packages/OmniMarkupPreviewer/OmniMarkupLib/Renderers/libs/python2/genshi/output.py | 31,267 | Python |
import torch
from nnunet.network_architecture.generic_UNet import Generic_UNet
from nnunet.network_architecture.initialization import InitWeights_He
from nnunet.training.network_training.nnUNet_variants.data_augmentation.nnUNetTrainerV2_insaneDA import \
nnUNetTrainerV2_insaneDA
from nnunet.utilities.nd_softmax imp... | 43.639344 | 117 | 0.657776 | [
"Apache-2.0"
] | ADVasculatureProject/nnUNet | nnunet/training/network_training/competitions_with_custom_Trainers/MMS/nnUNetTrainerV2_MMS.py | 2,662 | Python |
import numpy as np # import numpy
with open("data/day4.txt") as f:
drawing_numbers = f.readline()
board_lst = []
board_line = []
counter = 0
for line in f:
if line != '\n':
board_line.append(line.strip())
if len(board_line) == 5:
board_lst.append(board_li... | 31.72 | 94 | 0.552333 | [
"MIT"
] | rogall-e/advent_of_code | 2021/day4_part1.py | 1,586 | Python |
import torch
from torch_geometric.utils import k_hop_subgraph, subgraph
def test_subgraph():
edge_index = torch.tensor([
[0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6],
[1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5],
])
edge_attr = torch.Tensor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
idx = torch.tensor... | 33.886792 | 79 | 0.505011 | [
"MIT"
] | LingxiaoShawn/pytorch_geometric | test/utils/test_subgraph.py | 1,796 | Python |
# -*- coding: utf-8 -*-
# Begin CVS Header
# $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/bindings/python/unittests/Test_CMoiety.py,v $
# $Revision: 1.11 $
# $Name: $
# $Author: shoops $
# $Date: 2010/07/16 18:55:59 $
# End CVS Header
# Copyright (C) 2010 by Pedro Mendes, Virginia Tech I... | 30.119048 | 108 | 0.696838 | [
"Artistic-2.0"
] | bmoreau/COPASI | copasi/bindings/python/unittests/Test_CMoiety.py | 2,530 | Python |
# build_features.py
# This module holds utility classes and functions that creates and manipulates input features
# This module also holds the various input transformers
import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
def correlation_columns(dataset: pd.DataFrame, targe... | 29.660377 | 119 | 0.692112 | [
"MIT"
] | samie-hash/data-science-repo | credit-card-fraud/src/features/build_features.py | 1,572 | Python |
# Generated by Django 3.0 on 2019-12-12 08:54
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('team', '0002_auto_20191210_2330'),
('members', '0001_initial'),
]
operations = [
migrations.AddField(... | 29.176471 | 197 | 0.693548 | [
"MIT"
] | AroraShreshth/officialWebsite | backend/members/migrations/0002_member_team.py | 496 | Python |
#
# 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 us... | 32.721025 | 100 | 0.527 | [
"BSD-2-Clause",
"Apache-2.0",
"CC0-1.0",
"MIT",
"MIT-0",
"ECL-2.0",
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | XpressAI/spark | python/pyspark/pandas/generic.py | 104,770 | Python |
import importlib
import sys
import argparse
from multi_sample_factory.algorithms.utils.algo_utils import ExperimentStatus
from multi_sample_factory.runner.run_ngc import add_ngc_args
from multi_sample_factory.runner.run_slurm import add_slurm_args
from multi_sample_factory.utils.utils import log
def runner_argparser... | 40.545455 | 180 | 0.721226 | [
"MIT"
] | PG642/multi-sample-factory | multi_sample_factory/runner/run.py | 2,676 | Python |
import base64
def decode_img(img_string):
img_data = base64.b64decode(img_string)
filename = "temp_img.jpg"
with open(filename, "wb") as f:
f.write(img_data)
| 20 | 43 | 0.677778 | [
"MIT"
] | Eye-Remocon/Face_Recognition | example/decode_image.py | 180 | Python |
"""
Showcases *LLAB(l:c)* colour appearance model computations.
"""
import numpy as np
import colour
from colour.appearance.llab import CAM_ReferenceSpecification_LLAB
from colour.utilities import message_box
message_box('"LLAB(l:c)" Colour Appearance Model Computations')
XYZ = np.array([19.01, 20.00, 21.78])
XYZ_0... | 30.953488 | 76 | 0.728024 | [
"BSD-3-Clause"
] | soma2000-lang/colour | colour/examples/appearance/examples_llab.py | 1,331 | Python |
import re
from mail_app.mail import Mail
from mail_app.mail_processors.abstract_processor import AbstractProcessor
from mail_app.processed_mail import ProcessedMail
class PasswordProcessor(AbstractProcessor):
general_keywords = ["password (reset|request|update|updated)", "(new|reset|change|updated|changed your) ... | 48.52 | 130 | 0.666117 | [
"Apache-2.0"
] | teamsaucisse/Data-Mailing | mail_app/mail_processors/password_processor.py | 1,213 | Python |
# stdlib
from typing import Any
from typing import Dict
# syft absolute
import syft as sy
from syft import serialize
from syft.core.io.address import Address
from syft.grid.messages.group_messages import CreateGroupMessage
from syft.grid.messages.group_messages import CreateGroupResponse
from syft.grid.messages.group_... | 27.228137 | 68 | 0.606898 | [
"Apache-2.0"
] | H4LL/PySyft | tests/syft/grid/messages/group_msg_test.py | 7,161 | Python |
import random
import math
import os.path
import numpy as np
import pandas as pd
from pysc2.agents import base_agent
from pysc2.lib import actions
from pysc2.lib import features
_NO_OP = actions.FUNCTIONS.no_op.id
_SELECT_POINT = actions.FUNCTIONS.select_point.id
_BUILD_SUPPLY_DEPOT = actions.FUNCTIONS.Build_SupplyDe... | 36.503356 | 119 | 0.602041 | [
"Apache-2.0"
] | Tao-Chengyang/PySC2-Tutorial | 7. Using Reward for Agent/reward_agent.py | 10,878 | Python |
"""
# Sheets Account
Read a Google Sheet as if it were are realtime source of transactions
for a GL account. Columns are mapped to attributes. The
assumption is that the sheet maps to a single account, and the
rows are the credit/debits to that account.
Can be used as a plugin, which will write new entries (for ref... | 31.650485 | 100 | 0.58456 | [
"MIT"
] | runarp/coolbeans | src/coolbeans/plugins/sheetsaccount.py | 9,782 | Python |
"""
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
from test.unit.rules import BaseRuleTestCase
from cfnlint.rules.resources.properties.OnlyOne import OnlyOne # pylint: disable=E0401
class TestPropertyOnlyOne(BaseRuleTestCase):
"""Test OnlyOne Property ... | 29.92 | 87 | 0.696524 | [
"MIT-0"
] | awkspace/cfn-python-lint | test/unit/rules/resources/properties/test_onlyone.py | 748 | Python |
import unittest
from unittest.mock import patch, call, Mock, MagicMock, mock_open
from botocore.exceptions import ClientError
from ground_truth.src import ground_truth
from common import _utils
required_args = [
'--region', 'us-west-2',
'--role', 'arn:aws:iam::123456789012:user/Development/product_1234/*',
'-... | 51.747191 | 205 | 0.594072 | [
"Apache-2.0"
] | Intellicode/pipelines | components/aws/sagemaker/tests/unit_tests/tests/test_ground_truth.py | 9,211 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.