max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
rses/__init__.py | iScrE4m/RSES | 1 | 5400 | # coding=utf-8
"""RSES :)"""
| 1.117188 | 1 |
sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_gremlin_resources_operations.py | adewaleo/azure-sdk-for-python | 2 | 5401 | # 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 may ... | 1.695313 | 2 |
homeassistant/components/tasmota/discovery.py | yura505/core | 0 | 5402 | """Support for MQTT discovery."""
import asyncio
import logging
from hatasmota.discovery import (
TasmotaDiscovery,
get_device_config as tasmota_get_device_config,
get_entities_for_platform as tasmota_get_entities_for_platform,
get_entity as tasmota_get_entity,
has_entities_with_platform as tasmota... | 2.09375 | 2 |
tfx/components/infra_validator/executor.py | TimoKerr/tfx | 1 | 5403 | # Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 1.265625 | 1 |
learning_python/org/allnix/util.py | ykyang/org.allnix.python | 0 | 5404 | def write(message: str):
print("org.allnix", message)
def read() -> str:
"""Returns a string"""
return "org.allnix"
| 2.8125 | 3 |
metr-la/model/Double_C_STTN.py | happys2333/DL-2021-fall | 1 | 5405 | <filename>metr-la/model/Double_C_STTN.py<gh_stars>1-10
# from folder workMETRLA
# MODEL CODE
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 10:28:06 2020
@author: wb
"""
import torch
import torch.nn as nn
import math
# from GCN_models import GCN
# from One_hot_encoder import One_hot_encoder
impor... | 2.125 | 2 |
tetrisanim3.py | daniel-chuang/tetris | 0 | 5406 | <reponame>daniel-chuang/tetris
# animation for medium article
from termcolor import colored
import time
import imageio
import pyautogui
pyautogui.FAILSAFE = True
matrix = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, ... | 3.0625 | 3 |
inventories/models.py | destodasoftware/kately_api | 0 | 5407 | from django.db import models
from products.models import Product
from utils.models import Utility
class Inventory(Utility):
inventory_number = models.CharField(unique=True, max_length=100, blank=True, null=True)
supplier = models.CharField(max_length=100, blank=True, null=True)
user = models.ForeignKey('... | 2.28125 | 2 |
hierarchical_app/views.py | stephken/Hierarchical_assessment | 0 | 5408 | from django.shortcuts import render
from hierarchical_app.models import Folder
# Create your views here.
def index_view(request):
return render(request, 'index.html', {'welcome': "Welcome to Kens Hierarchical Data and You assessment", 'folders': Folder.objects.all()})
| 1.867188 | 2 |
bin/train_vit.py | ramizdundar/Chexpert | 0 | 5409 | import sys
import os
import argparse
import logging
import json
import time
import subprocess
from shutil import copyfile
import numpy as np
from sklearn import metrics
from easydict import EasyDict as edict
import torch
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torch.nn import DataP... | 1.921875 | 2 |
Sets/the capaint s room.py | AndreasGeiger/hackerrank-python | 0 | 5410 | groupSize = input()
groups = list(map(int,input().split(' ')))
tmpArray1 = set()
tmpArray2 = set()
for i in groups:
if i in tmpArray1:
tmpArray2.discard(i)
else:
tmpArray1.add(i)
tmpArray2.add(i)
for i in tmpArray2:
print(i)
| 3.25 | 3 |
tests/testsoma.py | gtmadureira/Python | 4 | 5411 | import unittest
from hf_src.main import soma
class TestSoma(unittest.TestCase):
def test_retorno_soma_15_30(self):
self.assertEqual(soma(15, 30), 45)
| 2.375 | 2 |
src/oictest/setup.py | rohe/oictest | 32 | 5412 | import copy
import json
from oic.utils.authn.client import CLIENT_AUTHN_METHOD
from oic.utils.keyio import KeyJar
from oic.utils.keyio import KeyBundle
__author__ = 'roland'
import logging
logger = logging.getLogger(__name__)
class OIDCError(Exception):
pass
def flow2sequence(operations, item):
flow = o... | 2.234375 | 2 |
HLTrigger/Configuration/python/HLT_75e33/modules/hltPFPuppiNoLep_cfi.py | PKUfudawei/cmssw | 1 | 5413 | <gh_stars>1-10
import FWCore.ParameterSet.Config as cms
hltPFPuppiNoLep = cms.EDProducer("PuppiProducer",
DeltaZCut = cms.double(0.1),
DeltaZCutForChargedFromPUVtxs = cms.double(0.2),
EtaMaxCharged = cms.double(99999.0),
EtaMaxPhotons = cms.double(2.5),
EtaMinUseDeltaZ = cms.double(-1.0),
MinPu... | 1.164063 | 1 |
wizbin/build.py | RogueScholar/debreate | 97 | 5414 | # -*- coding: utf-8 -*-
## \package wizbin.build
# MIT licensing
# See: docs/LICENSE.txt
import commands, os, shutil, subprocess, traceback, wx
from dbr.functions import FileUnstripped
from dbr.language import GT
from dbr.log import DebugEnabled
from dbr.log import Logger
from dbr.md5 import WriteMD5
from ... | 1.5 | 2 |
__main__.py | maelstromdat/YOSHI | 6 | 5415 | from YoshiViz import Gui
if __name__ == '__main__':
#file director
gui = Gui.Gui()
"""
report_generator.\
generate_pdf_report(fileDirectory, repositoryName, tempCommunityType)
"""
print('the type of', repositoryName, 'is', tempCommunityType, '\n"check .\YoshiViz\output"')
| 1.84375 | 2 |
hpotter/src/lazy_init.py | LarsenClose/dr.hpotter | 1 | 5416 | ''' Wrap an __init__ function so that I don't have to assign all the
parameters to a self. variable. '''
# https://stackoverflow.com/questions/5048329/python-decorator-for-automatic-binding-init-arguments
import inspect
from functools import wraps
def lazy_init(init):
''' Create an annotation to assign all the p... | 3.359375 | 3 |
main.py | technojam/MLian | 1 | 5417 | # def register_feed():
import os
import cv2
path = '/UserImage'
cam = cv2.VideoCapture(0)
name=input("Name: ")
cv2.namedWindow("test")
img_counter = 0
while True:
ret, frame = cam.read()
if not ret:
print("failed to grab frame")
break
else:
cv2.imshow("test", frame)
k = c... | 3.046875 | 3 |
models/train.py | Hiwyl/keras_cnn_finetune | 1 | 5418 | # -*- encoding: utf-8 -*-
'''
@Author : lance
@Email : <EMAIL>
'''
import time
from model_cx.inceptionresnet import inceptionresnet
from model_cx.vgg19two import vgg19_all_lr
from model_cx.inceptionv3 import inceptionv3
from model_cx.densenet import densenet
from model_cx.nasnet import nasnet
from ... | 2.1875 | 2 |
src/probnum/randprocs/markov/integrator/_preconditioner.py | alpiges/probnum | 0 | 5419 | """Coordinate changes in state space models."""
import abc
try:
# cached_property is only available in Python >=3.8
from functools import cached_property
except ImportError:
from cached_property import cached_property
import numpy as np
import scipy.special # for vectorised factorial
from probnum impor... | 2.109375 | 2 |
allauth/socialaccount/providers/linkedin/provider.py | mina-gaid/scp | 1 | 5420 | <filename>allauth/socialaccount/providers/linkedin/provider.py
from allauth.socialaccount import providers
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth.provider import OAuthProvider
from allauth.socialaccount import app_settings
class LinkedInAccount(Pro... | 2.484375 | 2 |
game2048/myNew.py | CCTQL/2048-api | 0 | 5421 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets
from torch.autograd import Variable
from sklearn.model_selection import train_test_split
import time
import pandas as pd
import numpy as np
import csv
batch_size = 128
NUM_EPOC... | 2.6875 | 3 |
HW2/dbsys-hw2/Database.py | yliu120/dbsystem | 0 | 5422 | import json, io, os, os.path
from Catalog.Schema import DBSchema, DBSchemaEncoder, DBSchemaDecoder
from Query.Plan import PlanBuilder
from Storage.StorageEngine import StorageEngine
class Database:
"""
A top-level database engine class.
For now, this primarily maintains a simple catalog,
... | 2.5625 | 3 |
tests/test_arr_add_value.py | dboyliao/TaipeiPy-pybind11-buffer-array | 1 | 5423 | <reponame>dboyliao/TaipeiPy-pybind11-buffer-array
import numpy as np
import mylib
def test_arr_add_value():
for _ in range(10):
shape = np.random.randint(1, 10, size=np.random.randint(3, 10)).tolist()
in_arr = np.random.rand(*shape).astype(np.double)
ok = np.allclose(mylib.array_add_value... | 2.28125 | 2 |
moderngl_window/resources/data.py | DavideRuzza/moderngl-window | 142 | 5424 | <reponame>DavideRuzza/moderngl-window
"""
Registry general data files
"""
from typing import Any
from moderngl_window.resources.base import BaseRegistry
from moderngl_window.meta import DataDescription
class DataFiles(BaseRegistry):
"""Registry for requested data files"""
settings_attr = "DATA_LOADERS"
... | 1.828125 | 2 |
tests/test_units/test_mapper_str.py | frewsxcv/routes | 1 | 5425 | import unittest
from routes import Mapper
class TestMapperStr(unittest.TestCase):
def test_str(self):
m = Mapper()
m.connect('/{controller}/{action}')
m.connect('entries', '/entries', controller='entry', action='index')
m.connect('entry', '/entries/{id}', controller='entry',... | 3.375 | 3 |
quarkchain/tools/config_slave.py | HAOYUatHZ/pyquarkchain | 1 | 5426 | <gh_stars>1-10
"""
python config_slave.py 127.0.0.1 38000 38006 127.0.0.2 18999 18002
will generate 4 slave server configs accordingly. will be used in deployment automation to configure a cluster.
usage: python config_slave.py <host1> <port1> <port2> <host2> <port3> ...
"""
import argparse
import collections
impo... | 2.484375 | 2 |
python-function-files-dictionaries/week4-assignment1.py | MauMendes/python3-programming-specialization | 0 | 5427 | <filename>python-function-files-dictionaries/week4-assignment1.py
#1) Write a function, sublist, that takes in a list of numbers as the parameter. In the function, use a while loop to return a sublist of the input list.
# The sublist should contain the same values of the original list up until it reaches the number 5 ... | 4.21875 | 4 |
saas/backend/apps/group/views.py | Canway-shiisa/bk-iam-saas | 0 | 5428 | # -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-权限中心(BlueKing-IAM) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with th... | 1.351563 | 1 |
towers.py | fillest/7drl2013 | 1 | 5429 | <filename>towers.py<gh_stars>1-10
import util
import libtcodpy as tcod
import enemies
import operator
class Missile (util.Entity):
sym = '*'
color = tcod.white
class BasicMissile (Missile):
color = tcod.yellow
class IceMissile (Missile):
color = tcod.light_blue
class AoeMissile (Missile):
color = tcod.red
c... | 2.890625 | 3 |
python/mandelbrot.py | lukasjoc/random | 1 | 5430 | #!/usr/bin/python3
from PIL import Image
from numpy import complex, array
from tqdm import tqdm
import colorsys
W=512
#W=142
def mandelbrot(x, y):
def get_colors(i):
color = 255 * array(colorsys.hsv_to_rgb(i / 255.0, 1.0, 0.5))
return tuple(color.astype(int))
c, cc = 0, complex(x, y)
fo... | 2.953125 | 3 |
tests/unit/commands/test_deploy.py | tonyreina/mlt | 1 | 5431 | <reponame>tonyreina/mlt
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 Intel 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
#
... | 1.875 | 2 |
packages/mccomponents/tests/mccomponentsbpmodule/sample/Broadened_E_Q_Kernel_TestCase.py | mcvine/mcvine | 5 | 5432 | #!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# <NAME>
# California Institute of Technology
# (C) 2006-2010 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | 1.976563 | 2 |
baseline/ns-vqa/reason/options/test_options.py | robinzixuan/Video-Question-Answering-HRI | 52 | 5433 | from .base_options import BaseOptions
class TestOptions(BaseOptions):
"""Test Option Class"""
def __init__(self):
super(TestOptions, self).__init__()
self.parser.add_argument('--load_checkpoint_path', required=True, type=str, help='checkpoint path')
self.parser.add_argument('--save_re... | 2.390625 | 2 |
Model_setup/NEISO_data_file/downsampling_generators_v1.py | keremakdemir/ISONE_UCED | 0 | 5434 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 24 18:45:34 2020
@author: kakdemi
"""
import pandas as pd
#importing generators
all_generators = pd.read_excel('generators2.xlsx', sheet_name='NEISO generators (dispatch)')
#getting all oil generators
all_oil = all_generators[all_generators['typ']=='oil'].copy()
#gett... | 2.546875 | 3 |
GUI1.py | otmanabdoun/IHM-Python | 3 | 5435 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 16 19:47:41 2021
@author: User
"""
import tkinter as tk
racine = tk . Tk ()
label = tk . Label ( racine , text ="J ' adore Python !")
bouton = tk . Button ( racine , text =" Quitter ", command = racine . destroy )
label . pack ()
bouton . pack ... | 2.71875 | 3 |
app/routes/v1/endpoints/clickup.py | ertyurk/bugme | 0 | 5436 | from fastapi import APIRouter, status, Body, HTTPException
from fastapi.encoders import jsonable_encoder
from starlette.responses import JSONResponse
from app.models.common import *
from app.models.clickup import *
from app.database.crud.clickup import *
router = APIRouter()
@router.get("/", response_description="C... | 2.5625 | 3 |
cellfinder_core/main.py | npeschke/cellfinder-core | 5 | 5437 | <filename>cellfinder_core/main.py<gh_stars>1-10
"""
N.B imports are within functions to prevent tensorflow being imported before
it's warnings are silenced
"""
import os
import logging
from imlib.general.logging import suppress_specific_logs
tf_suppress_log_messages = [
"multiprocessing can interact badly with Te... | 1.71875 | 2 |
server.py | rezist-ro/rezistenta.tv | 0 | 5438 | # coding=utf-8
import dateutil.parser
import flask
import json
import os
import time
import urllib
import yaml
EPISODES = yaml.load(open("episodes.yaml").read())
app = flask.Flask(__name__,
static_path="/assets",
static_folder="assets")
app.jinja_env.filters["strftime"] = \
... | 2.546875 | 3 |
problem020.py | mazayus/ProjectEuler | 0 | 5439 | #!/usr/bin/env python3
from functools import *
import operator
def factorial(number):
assert number >= 1
return reduce(operator.mul, range(1, number+1))
def digits(number):
yield from (int(digit) for digit in str(number))
print(sum(digits(factorial(100))))
| 3.984375 | 4 |
transformer.py | ghafran/KerasPersonLab | 0 | 5440 | <reponame>ghafran/KerasPersonLab
import numpy as np
from math import cos, sin, pi
import cv2
import random
from config import config, TransformationParams
from data_prep import map_coco_to_personlab
class AugmentSelection:
def __init__(self, flip=False, degree = 0., crop = (0,0), scale = 1.):
self.flip =... | 2.796875 | 3 |
enan/__init__.py | mizuno-group/enan | 0 | 5441 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 25 15:46:32 2019
@author: tadahaya
"""
from .binom import BT
from .connect import Connect
from .fet import FET
from .gsea import GSEA
from .ssgsea import ssGSEA
__copyright__ = 'Copyright (C) 2020 MIZUNO Tadahaya'
__version__ = '1.0.3'
__license__... | 1.25 | 1 |
app/helpers/__init__.py | Hacker-1202/Selfium | 14 | 5442 | <filename>app/helpers/__init__.py
"""
Selfium Helper Files
~~~~~~~~~~~~~~~~~~~
All Helper Files used in Selfium project;
:copyright: (c) 2021 - Caillou and ZeusHay;
:license: MIT, see LICENSE for more details.
"""
from .getUser import *
from .getGuild import *
from .params import *
from .notify import *
from .sendEmb... | 1.070313 | 1 |
NLP/UNIMO/src/finetune/visual_entailment.py | zhangyimi/Research | 1,319 | 5443 | <gh_stars>1000+
# Copyright (c) 2021 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... | 1.679688 | 2 |
src/records.py | oth-datapipeline/ingestion-scripts | 0 | 5444 | <filename>src/records.py
from faust import Record
class RssFeed(Record, serializer='json'):
feed_source: str
title: str
link: str
published: str = None
author: str = None
summary: str = None
published_parsed: list = None
authors: list = None
tags: list = None
comments: str = No... | 2.578125 | 3 |
leetcode/102-Medium-Binary-Tree-Level-Order-Traversal/answer.py | vaishali-bariwal/Practice-Coding-Questions | 25 | 5445 | #!/usr/bin/python3
#------------------------------------------------------------------------------
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def levelOrder(self, root):
... | 4.09375 | 4 |
setup.py | shirayu/fitbit-dumper | 0 | 5446 | <gh_stars>0
#!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name="",
version="0.01",
packages=find_packages(),
install_requires=[
"fitbit"
],
dependency_links=[
],
extras_require={
"tests": [
"flake8",
"autopep8",
... | 1.109375 | 1 |
src/main.py | mtnmunuklu/SigmaToExcel | 10 | 5447 | <filename>src/main.py
import sys
sys.path.append("../")
from src.app.sigma import SigmaConverter
if __name__ == "__main__":
sigmaconverter = SigmaConverter()
sigmaconverter.read_from_file()
sigmaconverter.write_to_excel()
| 1.875 | 2 |
server/processes/migrations/0132_auto_20201108_0540.py | CloudReactor/task_manager | 0 | 5448 | # Generated by Django 2.2.14 on 2020-11-08 05:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('processes', '0131_auto_20201107_2316'),
]
operations = [
migrations.RunSQL(
"UPDATE processes_workflow SET run_environ... | 1.523438 | 2 |
sparsely_lstmvae_main.py | pengkangzaia/usad | 0 | 5449 | <gh_stars>0
from model.sparsely_lstm_vae import *
import torch.utils.data as data_utils
from sklearn import preprocessing
from utils.eval_methods import *
device = get_default_device()
# Read data
# normal = pd.read_csv("data/SWaT_Dataset_Normal_v1.csv") # , nrows=1000)
normal = pd.read_csv("data/SWaT/SWaT_Dataset_N... | 2.375 | 2 |
src/demo/tasks.py | MexsonFernandes/AsynchronousTasks-Django-Celery-RabbitMQ-Redis | 1 | 5450 | from __future__ import absolute_import, unicode_literals
from dcs.celeryconf import app
import time
from django.core.mail import EmailMessage
@app.task(bind=True, ignore_result=False, max_retries=3)
def demo_task1(self):
result = {
'val1': 1,
'val2': 2,
'val3': 3,
}
print("hellp")
... | 1.945313 | 2 |
pytorch_translate/models/__init__.py | Ayansam1152/translate | 748 | 5451 | <reponame>Ayansam1152/translate
#!/usr/bin/env python3
import importlib
import os
# automatically import any Python files in the models/ directory
for file in sorted(os.listdir(os.path.dirname(__file__))):
if file.endswith(".py") and not file.startswith("_"):
model_name = file[: file.find(".py")]
... | 2.28125 | 2 |
app/config/secure.py | mapeimapei/awesome-flask-webapp | 2 | 5452 | # -*- coding: utf-8 -*-
__author__ = '带土'
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:mapei123@127.0.0.1:3306/awesome'
SECRET_KEY = <KEY>'
# Email 配置
MAIL_SERVER = 'smtp.exmail.qq.com'
MAIL_PORT = 465
MAIL_USE_SSL = True
MAIL_USE_TSL = False
MAIL_USERNAME = '<EMAIL>'
MAIL_PASSWORD = '<PASSWORD>'
MAIL_SUBJECT_PREF... | 2 | 2 |
src/users/migrations/0014_auto_20200801_1008.py | aliharby12/Simple-vezeeta-project | 0 | 5453 | <reponame>aliharby12/Simple-vezeeta-project<gh_stars>0
# Generated by Django 2.2 on 2020-08-01 08:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0013_auto_20200731_1810'),
]
operations = [
m... | 1.75 | 2 |
caller_v3/app/api/v1/docker.py | tienthegainz/pipeline_executor_docker_call | 0 | 5454 | from typing import Any, List, Callable
from fastapi import APIRouter, HTTPException, status, BackgroundTasks
from app import schemas
from app.core import docker_client
import json
from copy import deepcopy
router = APIRouter()
@router.get("/images", response_model=schemas.DockerImageRespond)
def get_docker_image(... | 2.3125 | 2 |
keras/models.py | kalyc/keras-apache-mxnet | 300 | 5455 | <filename>keras/models.py
"""Model-related utilities.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from . import backend as K
from .utils.generic_utils import has_arg
from .utils.generic_utils import to_list
from .engine.input_layer import Input
from ... | 2.515625 | 3 |
pythonFiles/tests/testing_tools/adapter/test_functional.py | erinxocon/vscode-python | 0 | 5456 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from __future__ import unicode_literals
import json
import os
import os.path
import subprocess
import sys
import unittest
import pytest
from ...__main__ import TESTING_TOOLS_ROOT
CWD = os.getcwd()
DATA_DIR = os.path.join... | 1.914063 | 2 |
mmgp/kernels/wavelet_slice.py | axdahl/SC-MMGP | 0 | 5457 | '''
Wavelet kernel
slice allows kernel operation on feature subset
active_dims is iterable of feature dimensions to extract
input_dim must equal dimension defined by active_dims
'''
import numpy as np
import tensorflow as tf
from .. import util
from . import kernel
from .kernel_extras import *
class WaveletSlice(ke... | 2.6875 | 3 |
transform.py | latenite4/python3 | 0 | 5458 |
#!/usr/bin/python3
#program to parse png images and change images
# cmd: python3 transform.py
# you must have local input/ and output/ directories
#
# name: <NAME>
# date: 12/27/20
# cmdline: python transform.py cmd show image='city.png' --ulx=1 --uly=2 --brx=0 --bry=9
# python transform.py show city.png
# ... | 3.5 | 4 |
plugins/wyr.py | Jeglet/pcbot | 0 | 5459 | <gh_stars>0
""" Would you rather? This plugin includes would you rather functionality
"""
import asyncio
import random
import re
import discord
import bot
import plugins
from pcbot import Config
client = plugins.client # type: bot.Client
db = Config("would-you-rather", data=dict(timeout=10, responses=["**{name}** ... | 3.265625 | 3 |
suit_tool/argparser.py | bergzand/suit-manifest-generator | 16 | 5460 | # -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Copyright 2019-2020 ARM Limited or its affiliates
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the... | 2.015625 | 2 |
python/process/process_pool.py | y2ghost/study | 0 | 5461 | <reponame>y2ghost/study
import random
import time
from multiprocessing import Pool
def worker(name: str) -> None:
print(f'Started worker {name}')
worker_time = random.choice(range(1, 5))
time.sleep(worker_time)
print(f'{name} worker finished in {worker_time} seconds')
if __name__ == '__main__':
... | 3.375 | 3 |
Project/Support-NotSourced/generic_pydicom_ns.py | mazalgarab-git/OSICpypy | 1 | 5462 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 7 11:48:59 2020
@author: mazal
"""
"""
=========================================
Support functions of pydicom (Not sourced)
=========================================
Purpose: Create support functions for the pydicom project
"""
"""
Test mode 1 | Basics... | 2.484375 | 2 |
paperscraper/scrapers/keywords.py | ahmed-shariff/scraper | 1 | 5463 | <gh_stars>1-10
import re
regex = re.compile(r'[\n\r\t]')
def acm_digital_library(soup):
try:
keywords = set()
keywords_parent_ol = soup.find('ol', class_="rlist organizational-chart")
keywords_divs = keywords_parent_ol.findChildren('div', recursive=True)
for kw_parent in keywords_... | 2.703125 | 3 |
topobank/publication/models.py | ContactEngineering/TopoBank | 3 | 5464 | from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.safestring import mark_safe
from django.conf import settings
MAX_LEN_AUTHORS_FIELD = 512
CITATION_FORMAT_FLAVORS = ['html', 'ris', 'bibtex', 'biblatex']
DEFAULT_KEYWORDS = ['surface', 'topography']
class... | 2.109375 | 2 |
vendor/migrations/0003_store_password.py | rayhu-osu/vcube | 1 | 5465 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-07-24 19:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('vendor', '0002_store_image'),
]
operations = [
migrations.AddField(
... | 1.570313 | 2 |
lec2.py | widnerlr/isat252 | 0 | 5466 | <gh_stars>0
"""
Your module description
"""
"""
this is my second py code
for my second lecture
"""
#print ('hello world') # this is a single line commment
# this is my second line comment
#print(type("123."))
#print ("Hello World".upper())
#print("Hello World".lower())
#print("hello" + "world" + ".")
#print(2... | 3.3125 | 3 |
day_22_b.py | Gyaha/AOC2020 | 0 | 5467 | <reponame>Gyaha/AOC2020<filename>day_22_b.py
def play_recursively_combat(p1: list, p2: list) -> bool:
rounds = set()
winner = None
while len(p1) > 0 and len(p2) > 0:
r = tuple(p1 + [-1] + p2)
if r in rounds:
return True
else:
rounds.add(r)
c1 = p1.pop... | 3.375 | 3 |
Auth/Constants/LoginOpCode.py | sundayz/idewave-core | 0 | 5468 | <reponame>sundayz/idewave-core
from enum import Enum
class LoginOpCode(Enum):
''' Opcodes during login process '''
LOGIN_CHALL = 0x00
LOGIN_PROOF = 0x01
RECON_CHALL = 0x02 # currently do not in use
RECON_PROOF = 0x03 # currently do not in use
REALMLIST = 0x10
class LoginResult(Enum):
... | 2.203125 | 2 |
LINETOKEN/__init__.py | pratannaimjoi/tokenIpad | 0 | 5469 | <reponame>pratannaimjoi/tokenIpad
# -*- coding: utf-8 -*-
from .LineApi import LINE
from .lib.Gen.ttypes import *
| 0.839844 | 1 |
main.py | seton-develops/PDF-Camelot-Folder-Executable | 0 | 5470 | <filename>main.py
'''
Created on Jun 17, 2021
@author: Sean
'''
import PDF2CSV_GUI
def main():
j = PDF2CSV_GUI.Convert_GUI()
if __name__ == "__main__":
main() | 1.9375 | 2 |
Part1/bot_read.py | Mildlyoffbeat/RedditBot-1 | 0 | 5471 | #!/usr/bin/python
import praw
reddit = praw.Reddit('mob-secondbot')
subreddit = reddit.subreddit("learnpython")
for submission in subreddit.hot(limit=5):
print("Title: ", submission.title)
print("Text: ", submission.selftext)
print("Score: ", submission.score)
print("---------------------------------... | 2.90625 | 3 |
17/kazuate_liar.cpp.py | Siketyan/Programming-I | 0 | 5472 | <filename>17/kazuate_liar.cpp.py
from subprocess import Popen, PIPE, call
name = "kazuate_liar.o"
src = """
#include <iostream>
#include <random>
using namespace std;
int main()
{
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> randfive(0, 4);
uniform_int_distribution<int> randint(... | 2.671875 | 3 |
src/terrafort/main.py | silvercar/terrafort | 1 | 5473 | <gh_stars>1-10
"""
Terrafort
Generate terraform templates for specific resources
"""
import click
from .providers.aws import Aws
@click.group()
@click.option('--commands',
is_flag=True,
help="Output import commands instead of a terraform template")
@click.version_option()
@click.pass_con... | 1.960938 | 2 |
src/ping.py | jnsougata/rich-embed | 0 | 5474 | <gh_stars>0
import discord
import app_util
class Ping(app_util.Cog):
def __init__(self, bot: app_util.Bot):
self.bot = bot
@app_util.Cog.command(
command=app_util.SlashCommand(
name='ping', description='shows avg ping of client'
),
guild_id=877399405056102431
... | 2.53125 | 3 |
2020/24/visualization.py | AlbertVeli/AdventOfCode | 0 | 5475 | #!/usr/bin/env python3
import sys
import re
import numpy as np
from PIL import Image
moves = { 'e': (2, 0), 'se': (1, 2), 'sw': (-1, 2), 'w': (-2, 0), 'nw': (-1, -2), 'ne': (1, -2) }
# Save (x, y): True/False in tiles. True = black, False = white.
tiles = {}
for line in open(sys.argv[1]).read().splitlines():
po... | 3.0625 | 3 |
experimental/tracing/bin/diff_heap_profiler.py | BearerPipelineTest/catapult | 1,894 | 5476 | #!/usr/bin/env python
# Copyright 2017 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 __future__ import absolute_import
from __future__ import print_function
import argparse
import gzip
import json
import os
import s... | 2.203125 | 2 |
mne_bids/commands/mne_bids_raw_to_bids.py | kingjr/mne-bids | 0 | 5477 | """Write raw files to BIDS format.
example usage: $ mne_bids raw_to_bids --subject_id sub01 --task rest
--raw data.edf --bids_root new_path
"""
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import mne_bids
from mne_bids import write_raw_bids, BIDSPath
from mne_bids.read import _... | 2.390625 | 2 |
lab1oop.py | NastiaK/NewRepository | 0 | 5478 | <gh_stars>0
class Calculations:
def __init__(self, first, second):
self.first = first
self.second = second
def add(self):
print(self.first + self.second)
def subtract(self):
print(self.first - self.second)
def multiply(self):
print(self.first * self... | 3.984375 | 4 |
Arrays/cyclic_rotation.py | Jeans212/codility-dev-training | 0 | 5479 | <reponame>Jeans212/codility-dev-training
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
'''
Rotate an array A to the right by a given number of steps K.
Covert the array to a deque
Apply the rotate() method the rotate the deque in positive K steps
Convert... | 3.859375 | 4 |
tests/test_apis.py | hatzel/markdown-spoilers | 2 | 5480 | # -*- coding: utf-8 -*-
"""
Python Markdown
A Python implementation of <NAME>'s Markdown.
Documentation: https://python-markdown.github.io/
GitHub: https://github.com/Python-Markdown/markdown/
PyPI: https://pypi.org/project/Markdown/
Started by <NAME> (http://www.dwerg.net/).
Maintained for a few years by <NAME> (ht... | 2.1875 | 2 |
nervous/utility/config.py | csxeba/nervous | 1 | 5481 | import os
class StressedNetConfig:
def __init__(self,
synaptic_environmental_constraint=0.8,
group_environmental_constraint=0.6,
stress_factor=0.8,
save_folder=os.path.expanduser("~/.nervous/models/")):
self._synaptic_environmental_const... | 2.5625 | 3 |
mindspore/nn/optim/ftrl.py | XinYao1994/mindspore | 2 | 5482 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 1.929688 | 2 |
aws_utils/region_selector.py | skimhub/aws-utils | 0 | 5483 | <gh_stars>0
import datetime
import boto3
US_EAST_REGION = {'us-east-1'}
US_EAST_AVAILABILITY_ZONES = {'us-east-1a', 'us-east-1b', 'us-east-1c', 'us-east-1e'} # note d is missing
INSTANCE_VERSION = 'Linux/UNIX (Amazon VPC)'
def fetch_spot_prices(region, start_time, end_time, instance_type, instance_version=INSTANC... | 2.5 | 2 |
pynn/__init__.py | jkae/knn-exercise | 0 | 5484 |
from .nearest_neighbor_index import NearestNeighborIndex
from .kd_tree import *
| 1.039063 | 1 |
tests/test_try.py | threecifanggen/python-functional-programming | 3 | 5485 | '''
Author: huangbaochen<<EMAIL>>
Date: 2021-12-11 20:04:19
LastEditTime: 2021-12-11 21:46:16
LastEditors: huangbaochen<<EMAIL>>
Description: 测试Try单子
No MERCY
'''
import pytest
from fppy.try_monad import Try, Success, Fail
from fppy.option import Just, Nothing
@pytest.mark.try_monad
def test_try_apply():
assert Tr... | 2.703125 | 3 |
app/internal/daily_quotes.py | yammesicka/calendar | 0 | 5486 | <reponame>yammesicka/calendar<filename>app/internal/daily_quotes.py
from datetime import date
from typing import Dict, Optional
from sqlalchemy.orm import Session
from sqlalchemy.sql.expression import func
from app.database.models import Quote
TOTAL_DAYS = 366
def create_quote_object(quotes_fields: Dict[str, Optio... | 3.078125 | 3 |
src/789A.py | viing937/codeforces | 2 | 5487 | n, k = map(int, input().split())
w = list(map(int, input().split()))
r = sum(map(lambda x: (x+k-1)//k, w))
print((r+1)//2)
| 2.65625 | 3 |
platform/server/detect.py | leyyin/godot | 24 | 5488 | <reponame>leyyin/godot<gh_stars>10-100
import os
import sys
def is_active():
return True
def get_name():
return "Server"
def can_build():
if (os.name!="posix"):
return False
return True # enabled
def get_opts():
return [
('use_llvm','Use llvm compiler','no'),
('force_32_bits','Force 32 bits binary','... | 2.1875 | 2 |
telemetry/Truck.py | SnipsMine/ETS2-Speedrun-Tool | 0 | 5489 | <reponame>SnipsMine/ETS2-Speedrun-Tool<filename>telemetry/Truck.py
from telemetry.TruckConstants import ConstantValues
from telemetry.TruckCurrent import CurrentValues
from telemetry.TruckPositioning import Positioning
class TruckValues:
constant_values = None
current_values = None
positioning = None
... | 2.234375 | 2 |
IntroToSpark/Assign4_Q1-6_action.py | petersontylerd/spark-courses | 0 | 5490 |
import csv
from pyspark.sql import SparkSession
from pyspark.sql.types import IntegerType
spark = SparkSession.builder.appName("Assignment4").getOrCreate()
sc = spark.sparkContext
# load data to dataframe
path = 'fake_data.csv'
df = spark.read.format('csv').option('header','true').load(path)
# cast income as an int... | 3.484375 | 3 |
src/firebot/tests/factories.py | zipmex/fire | 52 | 5491 | <reponame>zipmex/fire<gh_stars>10-100
import factory
from django.contrib.auth import get_user_model
class UserFactory(factory.DjangoModelFactory):
class Meta:
model = get_user_model()
first_name = factory.Faker('name')
last_name = factory.Faker('name')
email = factory.Faker('email')
| 1.992188 | 2 |
reamber/o2jam/O2JHold.py | Bestfast/reamberPy | 0 | 5492 | <filename>reamber/o2jam/O2JHold.py
from dataclasses import dataclass, field
from reamber.base.Hold import Hold, HoldTail
from reamber.o2jam.O2JNoteMeta import O2JNoteMeta
@dataclass
class O2JHoldTail(HoldTail, O2JNoteMeta):
pass
@dataclass
class O2JHold(Hold, O2JNoteMeta):
""" Defines the O2Jam Bpm Object
... | 2.796875 | 3 |
peacebot/core/plugins/Miscellaneous/__init__.py | Peacebot-Development/Peacebot-v2 | 3 | 5493 | <filename>peacebot/core/plugins/Miscellaneous/__init__.py<gh_stars>1-10
import lightbulb
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from peacebot.core.utils.time import TimeConverter
def fetch_scheduler(ctx: lightbulb.Context) -> AsyncIOScheduler:
return ctx.bot.d.scheduler
async def convert_t... | 2.0625 | 2 |
example/android/python/msite_simple_default_browser.py | laichimirum/docker-appium-emulator | 8 | 5494 | import unittest
from appium import webdriver
class MSiteDefaultBrowserAndroidUITests(unittest.TestCase):
def setUp(self):
# Default browser does not exist for android >= 6.0
desired_caps = {
'platformName': 'Android',
'deviceName': 'Android Emulator',
'appPac... | 2.71875 | 3 |
src/nn/dataset_utils/types_processing.py | sola-st/Nalin | 0 | 5495 | <gh_stars>0
"""
Created on 17-June-2020
@author <NAME>
The types extracted during runtime usually look something like --> <class 'numpy.ndarray'> or
<class 'seaborn.palettes._ColorPalette'> change them to --> ndarray, ColorPalette
"""
import re
remove_chars = re.compile(r'>|\'|<|(class )|_|(type)')
def process_ty... | 2.640625 | 3 |
src/canvas.py | soootaleb/spare | 1 | 5496 | <filename>src/canvas.py<gh_stars>1-10
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from matplotlib import pyplot as plt
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
import matplotlib.ticker as ticker
import ... | 2.515625 | 3 |
src/cpg_scpi/test/__init__.py | GeorgBraun/cpg_scpi_python | 0 | 5497 | '''Functional tests for CPG'''
from .. import CircuitPlayground
from .. import __version__ as CircuitPlaygroundVersion
import time
def funcTest(timestamps: bool = False) -> None:
cpg = CircuitPlayground()
if timestamps:
_printFuncTestHeadingWithDeliLine(f'cpg_scpi v{CircuitPlaygroundVersion}\nRUNNING... | 2.609375 | 3 |
main/models.py | yejun1060/SbjctSclctn | 0 | 5498 | from django.db import models
class Account(models.Model):
clsNb = models.IntegerField()
Name = models.CharField(max_length=10)
pw = models.IntegerField()
def __str__(self):
return self.Name | 2.421875 | 2 |
test/utils/test_geodesic.py | shrey-bansal/pytorch_geometric | 2 | 5499 | from math import sqrt
import torch
from torch_geometric.utils import geodesic_distance
def test_geodesic_distance():
pos = torch.Tensor([[0, 0, 0], [2, 0, 0], [0, 2, 0], [2, 2, 0]])
face = torch.tensor([[0, 1, 3], [0, 2, 3]]).t()
out = geodesic_distance(pos, face)
expected = [
[0, 1, 1, sqrt... | 2.5 | 2 |