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 |
|---|---|---|---|---|---|---|
html_form_parser/__init__.py | gkunde/py_html_form_parser | 0 | 12795951 | <gh_stars>0
import re
from typing import List
from bs4 import BeautifulSoup, Tag
from html_form_parser.models.form_data import FormData
from html_form_parser.models.form_data_entry import FormDataEntry
from html_form_parser.parsers import form_data_entry_parser
class HtmlFormParser:
"""
Parse and extract HT... | 2.953125 | 3 |
xicam/gui/connections/__init__.py | JulReinhardt/Xi-cam | 6 | 12795952 | <reponame>JulReinhardt/Xi-cam
import requests
from qtpy.QtCore import *
from qtpy.QtGui import *
from qtpy.QtWidgets import *
from xicam.gui.static import path
from xicam.gui.widgets.searchlineedit import SearchLineEdit
from copy import deepcopy
from xicam.plugins import SettingsPlugin, manager
class ConnectionSetti... | 1.84375 | 2 |
testing_dataset/download_vot2018lt.py | tsingqguo/AttackTracker | 11 | 12795953 | import json
import os
import requests
data_file = './description.json'
with open(data_file) as f:
data = json.load(f)
home_page = data['homepage']
seqs = data['sequences']
for v in seqs:
link = '%s%s' % (home_page,v['annotations']['url'])
print('download %s' % link)
os.system('wget %s -O %s_ann.zip' %... | 2.75 | 3 |
effects/police.py | vexofp/hyperion | 725 | 12795954 | import hyperion
import time
import colorsys
# Get the parameters
rotationTime = float(hyperion.args.get('rotation-time', 2.0))
colorOne = hyperion.args.get('color_one', (255,0,0))
colorTwo = hyperion.args.get('color_two', (0,0,255))
colorsCount = hyperion.args.get('colors_count', hyperion.ledCount/2)
reverse = bool(hy... | 2.90625 | 3 |
labml_nn/transformers/alibi/experiment.py | BioGeek/annotated_deep_learning_paper_implementations | 3,714 | 12795955 | """
---
title: Attention with Linear Biases (ALiBi) Experiment
summary: This experiment trains an Attention with Linear Biases (ALiBi) based model on Tiny Shakespeare dataset.
---
# [Attention with Linear Biases (ALiBi)](index.html) Experiment
This is an annotated PyTorch experiment to train a [ALiBi model](index.htm... | 2.609375 | 3 |
code_week8_615_621/remove_duplicates_from_sorted_list.py | dylanlee101/leetcode | 0 | 12795956 | <gh_stars>0
'''
给定一个排序链表,删除所有重复的元素,使得每个元素只出现一次。
示例 1:
输入: 1->1->2
输出: 1->2
示例 2:
输入: 1->1->2->3->3
输出: 1->2->3
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list
'''
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# ... | 3.6875 | 4 |
semia/generator.py | ddlee-cn/SemIA | 3 | 12795957 | <reponame>ddlee-cn/SemIA
from torch.autograd import Variable as Vb
from semia.network import *
class Encoder(BaseNetwork):
"""
Encoder for both Condition Signal(Segmentation map) and Image(+Noise)
params: num_down, base_nc, out_nc
return: [features] + [Code]
"""
def __init__(self, num_down, ... | 2.21875 | 2 |
teamcat_service/doraemon/doraemon/ci/pagefactory/ci_service_pageworker.py | zhangyin2088/Teamcat | 6 | 12795958 | #coding=utf-8
'''
Created on 2015-9-24
@author: Devuser
'''
from doraemon.ci.pagefactory.ci_pageworker import CIPageWorker
from doraemon.ci.viewmodels.ci_left_nav_bar import CIServiceLeftNavBar
from doraemon.ci.viewmodels.ci_sub_nav_bar import CIServiceSubNavBar
from doraemon.ci.viewmodels.vm_ci_deploy_service import ... | 1.9375 | 2 |
app/auth/login.py | ishiundu/bucketlist-cp2 | 3 | 12795959 | <filename>app/auth/login.py
import json
import jwt
from app.models.bucketlist_models import Users
from config import Config
from datetime import datetime, timedelta
from flask import jsonify, request
from flask_restful import abort, Resource
class Index(Resource):
def get(self):
return({"message": "Welco... | 2.5625 | 3 |
troposphere_mate/mediaconnect.py | tsuttsu305/troposphere_mate-project | 0 | 12795960 | <filename>troposphere_mate/mediaconnect.py
# -*- coding: utf-8 -*-
"""
This code is auto generated from troposphere_mate.code_generator.__init__.py scripts.
"""
import sys
if sys.version_info.major >= 3 and sys.version_info.minor >= 5: # pragma: no cover
from typing import Union, List, Any
import troposphere.me... | 1.875 | 2 |
tests/test_bitable_sample.py | chyroc/pylark | 7 | 12795961 | # Code generated by lark_sdk_gen. DO NOT EDIT.
import unittest
import pylark
import pytest
from tests.test_conf import app_all_permission, app_no_permission
from tests.test_helper import mock_get_tenant_access_token_failed
def mock(*args, **kwargs):
raise pylark.PyLarkError(scope="scope", func="func", code=1, ms... | 1.953125 | 2 |
irop_hook.py | PLSysSec/pitchfork-angr | 5 | 12795962 | import angr
from taint import is_tainted, taintedUnconstrainedBits
import logging
l = logging.getLogger(__name__)
class IROpHook(angr.SimStatePlugin):
"""
Allows hooking the computation of operations performed in the symbolic execution.
(requires our fork of angr to actually respect the hook)
"""
... | 2.390625 | 2 |
people/views.py | GreenBankObservatory/django-perf | 0 | 12795963 | <gh_stars>0
import inspect
from django.shortcuts import render
from people.get_people import (
get_people_naive,
get_people_select_related_only,
get_people_select_related,
get_people_qs_only,
get_people_values,
)
def index(request):
return render(request, "people/index.html")
def list_peop... | 2.21875 | 2 |
LeetCode-All-Solution/Python3/LC-0217-Contains-Duplicate.py | YuweiYin/Algorithm_YuweiYin | 0 | 12795964 | <filename>LeetCode-All-Solution/Python3/LC-0217-Contains-Duplicate.py<gh_stars>0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""=================================================================
@Project : Algorithm_YuweiYin/LeetCode-All-Solution/Python3
@File : LC-0217-Contains-Duplicate.py
@Author : [YuweiYin](ht... | 3.890625 | 4 |
model/model.py | sreeji10/movie-recomendation-flask-python | 3 | 12795965 | import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import cosine_similarity
def get_title_from_index(index):
return df[df.index == index]["title"].values[0]
def get_index_from_title(title):
return df[df.title.str.lower() == title.lower()... | 3.15625 | 3 |
kwat/array_array/__init__.py | KwatME/ccal | 5 | 12795966 | from .apply import apply
from .separate_and_apply import separate_and_apply
| 1.15625 | 1 |
calories/filters.py | DHEERAJPRAKASH/CALORIE_TRACKER | 0 | 12795967 | import django_filters
from django_filters import CharFilter
from .models import *
class FoodFilter(django_filters.FilterSet):
food_name = CharFilter(field_name = 'name' , lookup_expr = 'icontains',label='search food items')
class Meta:
model = Food
fields = ['food_name']
| 1.945313 | 2 |
setup.py | akaraspt/ms-gait-calibrate | 2 | 12795968 | <filename>setup.py
from setuptools import setup, find_packages
install_requires = [
'numpy',
'pandas',
'scipy',
'matplotlib',
'scikit-learn',
'flask',
'flask-script',
'flask-bootstrap',
'werkzeug',
'bokeh',
'Jinja2',
]
setup(
name='gait-calibrate',
version='1.1',
... | 1.320313 | 1 |
tasks-around-university/rest/maingame/views.py | JaliJuhola/tasks-around-tampere | 0 | 12795969 | <reponame>JaliJuhola/tasks-around-tampere
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
#from django.views.decorators.csrf import csrf_exempt
from rest_framework.renderers import JSONRenderer
from rest_framework.parsers import JSONParser
from rest.maingame.models import Hotspot,... | 2.171875 | 2 |
app.py | clearminds/flask-tts | 0 | 12795970 | # -*- coding: utf-8 -*-
import os
from config import Config
from flask import Flask, send_from_directory
from werkzeug.contrib.fixers import ProxyFix
import logging
from gtts import gTTS
from pydub import AudioSegment
import hashlib
try:
from urllib.parse import unquote_plus
except:
from urllib import unquote_p... | 2.15625 | 2 |
pySpatialTools/Discretization/Discretization_3d/__init__.py | tgquintela/pySpatialTools | 8 | 12795971 |
"""
3D discretization
=================
Space discretization module groups functions to discretize 3-dimensional spaces
in regions and facilitate the retrieve by regions or define neighbourhood with
fixed regions.
"""
| 2.15625 | 2 |
Chapter_14/simulation_model.py | pauldevos/Mastering-Object-Oriented-Python-Second-Edition | 108 | 12795972 | <reponame>pauldevos/Mastering-Object-Oriented-Python-Second-Edition
#!/usr/bin/env python3.7
"""
Mastering Object-Oriented Python 2e
Code Examples for Mastering Object-Oriented Python 2nd Edition
Chapter 14. Example 1 -- simulation model.
"""
from dataclasses import dataclass, astuple, asdict, field
from typing impo... | 3.71875 | 4 |
CursoIntensivoPython/Aula15_visualizacao_de_dados/die_visual.py | SweydAbdul/estudos-python | 0 | 12795973 | <reponame>SweydAbdul/estudos-python<gh_stars>0
import pygal
from CursoIntensivoPython.Aula15_visualizacao_de_dados.die import Die
# Cria um D6
die = Die()
# Faz alguns lancamentos e armazena os resultados em uma lista
results = []
for roll_num in range(100):
result = die.roll()
results.append(result)
# Anal... | 3.328125 | 3 |
Medio 2/ex043.py | Gustavsantos/python1 | 0 | 12795974 | peso = float(input('Qual é seu peso? (KG) '))
altura = float(input('Qual é sua altura? (M) '))
imc = peso / (altura * altura)
print('Seu imc é de {:.1f}'.format(imc))
if imc <= 18.5:
print('Você esta abaixo do peso!')
elif imc <= 25:
print('Seu peso é ideal!')
elif imc <= 30:
print('Você esta com sobrepeso... | 3.8125 | 4 |
arrival/arrival/galaxy.py | paiv/icfpc2020 | 0 | 12795975 | import ctypes
import sys
from pathlib import Path
from .space import SpaceClient
_known_tokens = 'ap cons nil neg c b s isnil car eq mul add lt div i t f cdr SCAN number FUN DEF galaxy GG'
_Tokens = {s:i for i, s in enumerate(_known_tokens.split(), 1)}
class AlienProxy:
def __init__(self):
pass
class ... | 2.5 | 2 |
violation/fields/rule.py | adepeter/django-violations | 1 | 12795976 | from django import forms
class RulesModelMultipleChoiceField(forms.ModelMultipleChoiceField):
def label_from_instance(self, obj):
return '%(rule_name)s' % {'rule_name': obj.name}
| 1.984375 | 2 |
harness/training/model_trainer.py | cmu-sei/augur-code | 0 | 12795977 | # Augur: A Step Towards Realistic Drift Detection in Production MLSystems - Code
# Copyright 2022 Carnegie Mellon University.
#
# NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITH... | 1.164063 | 1 |
temp/trail.py | fauzaanirsyaadi/Travel | 0 | 12795978 | <gh_stars>0
from flask import Flask, render_template,request, url_for,redirect,send_file,session,abort
from flask_sqlalchemy import SQLAlchemy
from io import BytesIO
from sqlalchemy.orm import scoped_session,sessionmaker
from base64 import b64encode
import base64
from sqlalchemy import func
import sqlite3
from sqlalche... | 2.078125 | 2 |
stranding/stranding.py | 23andMe/stranding | 6 | 12795979 | <reponame>23andMe/stranding
import logging
import warnings
from Bio.pairwise2 import align, format_alignment
from Bio.Seq import Seq
from seqseek import Chromosome
from .exceptions import (MissingReferenceFlank,
InconsistentAlignment,
Unstrandable,
... | 2.375 | 2 |
source/utils.py | ogencoglu/Language-agnostic_BERT_COVID19_Twitter | 2 | 12795980 | '''
utility functions
'''
__author__ = '<NAME>'
import os
from os.path import join
from os.path import abspath
import json
import pandas as pd
import numpy as np
from configs import config as cf
def is_available(filename):
'''
[filename] : str
'''
return os.path.isfile(filename)
def chunks(lst,... | 2.46875 | 2 |
Mundo2/URI_1042.py | NOBarbosa/Exercicios_Python | 0 | 12795981 | <reponame>NOBarbosa/Exercicios_Python
n = input().split()
lista = [int(i) for i in n]
lista.sort() # sort ordena a lista em ordem crescente
print(*lista, sep='\n') # * serve para imprimir toda a lista
print()
print(*n, sep='\n') | 3.671875 | 4 |
fraud_poc/live/predict.py | leosmerling-hopeit/fraud-poc | 2 | 12795982 | <gh_stars>1-10
# AUTOGENERATED! DO NOT EDIT! File to edit: 08_predict.ipynb (unless otherwise specified).
__all__ = ['OrderInfo', '__steps__', '__api__', 'logger', 'model', 'db', 'features', '__init_event__',
'lookup_features', 'predict', '__postprocess__']
# Cell
from typing import Dict, Optional
from dat... | 2.015625 | 2 |
src/ODM2Sensor/settings/production.py | UCHIC/ODM2Sensor | 7 | 12795983 | # TODO: write configuration for production | 1.070313 | 1 |
order/admin.py | Habeebhassan/zarawa_express | 0 | 12795984 | from django.contrib import admin
from .models import Order
# Register your models here.
class OrderAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'phone_number', 'submitted')
list_filter = ('name', 'submitted')
readonly_fields = ('submitted',)
fieldsets = (
(None, {'fields': ('name', ... | 1.820313 | 2 |
rapt/cmds/add/buildpack.py | yougov/rapt | 1 | 12795985 | import click
from rapt.connection import get_vr
from rapt.models import query, models
from rapt.util import edit_yaml, dump_yaml
from pprint import pformat
@click.command()
def buildpack():
tmpl = {
'repo_url': '',
'repo_type': ['git', 'hg'],
'description': '',
'order': 0,
}
... | 2.203125 | 2 |
dcclient/rpc.py | asgard-lab/driver | 0 | 12795986 | # Copyright (c) 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | 2.0625 | 2 |
python/decorator/vanishing_ret_fixed.py | zeroam/TIL | 0 | 12795987 | <reponame>zeroam/TIL
def debug_transformer(func):
def wrapper():
print(f'Function `{func.__name__}` called')
ret = func()
print(f'Function `{func.__name__}` finished')
return ret
return wrapper
@debug_transformer
def walkout():
print('Bye Felical')
@debug_transformer
def... | 2.34375 | 2 |
example_project/example_project/views.py | groupe-conseil-nutshimit-nippour/django-geoprisma | 0 | 12795988 | # -*- coding: utf-8 -*-
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from geoprisma import views as geoprisma_views
@login_required
def maprender(request, *args, **kwargs):
wsName = kwargs.get('wsName')
viewId = kwargs.get('viewId')
if not viewId:
... | 2.015625 | 2 |
model.py | marcelkunze/trackml | 3 | 12795989 | <filename>model.py
########################################################################
# ====================== TrackML CHALLENGE MODEL =====================
########################################################################
# Author: <NAME>
# Date: Dec. 2018
from __future__ import print_function
from __f... | 2.25 | 2 |
src/morphforgecontrib/indev/meshtools/core.py | mikehulluk/morphforge | 1 | 12795990 | <filename>src/morphforgecontrib/indev/meshtools/core.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 <NAME>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permit... | 1.054688 | 1 |
predict.py | event-driven-robotics/movenet.pytorch | 0 | 12795991 | """
@Fire
https://github.com/fire717
"""
from lib import init, Data, MoveNet, Task
from config import cfg
from lib.utils.utils import arg_parser
# Script to create and save as images all the various outputs of the model
def main(cfg):
init(cfg)
model = MoveNet(num_classes=cfg["num_classes"],
... | 2.4375 | 2 |
python/elec-p2sh-hodl.py | brianddk/redd | 7 | 12795992 | #!/usr/bin/env python3
# [rights] Copyright 2020 brianddk at github https://github.com/brianddk
# [license] Apache 2.0 License https://www.apache.org/licenses/LICENSE-2.0
# [repo] github.com/brianddk/reddit/blob/master/python/elec-p2sh-hodl.py
# [btc] BTC-b32: bc1qwc2203uym96u0nmq04pcgqfs9ldqz9l3mz8fpj
# [tipja... | 2.046875 | 2 |
image_rw_matplot.py | lotlucky/opencv | 0 | 12795993 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : image_rw_matplot.py
# @Date : 2019-03-14
# @Author : wudan
import cv2
import numpy as pd
from matplotlib import pyplot as plt
"""
CV2处理图像使用的是BGR模式,而matplotlib使用的是RGB模式
"""
img = cv2.imread('zhuzhu_1.jpeg',1)
b,g,r = cv2.split(img)
img2 = cv2.m... | 2.671875 | 3 |
network-delay-time/network-delay-time.py | rams1996/Graphs | 0 | 12795994 | class Solution:
def networkDelayTime(self, times: List[List[int]], N: int, K: int) -> int:
import heapq
from collections import defaultdict
createGraph=defaultdict(list)
for i in times:
createGraph[i[0]].append((i[2],i[1]))
heap=[]
heapq.heapify(heap)
... | 3.0625 | 3 |
deal/linter/_extractors/__init__.py | m4ta1l/deal | 1 | 12795995 | <reponame>m4ta1l/deal
# app
from .asserts import get_asserts
from .common import get_name
from .contracts import get_contracts
from .exceptions import get_exceptions
from .exceptions_stubs import get_exceptions_stubs
from .globals import get_globals
from .imports import get_imports
from .pre import get_pre
from .prints... | 1.289063 | 1 |
vmtkScripts/vmtksurfaceregiondrawing.py | michelebucelli/vmtk | 1 | 12795996 | <reponame>michelebucelli/vmtk<filename>vmtkScripts/vmtksurfaceregiondrawing.py
#!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtksurfaceregiondrawing.py,v $
## Language: Python
## Date: $Date: 2006/05/26 12:35:13 $
## Version: $Revision: 1.9 $
## Copyright (c) <NAME>, <NAME>. All rights r... | 2.078125 | 2 |
tests/exception_test.py | gglin001/poptorch | 128 | 12795997 | <gh_stars>100-1000
#!/usr/bin/env python3
# Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import pytest
import torch
import poptorch
def harness(setting, Model, args):
opts = poptorch.Options()
if setting == "true":
opts.Precision.enableFloatingPointExceptions(True)
elif setting == "fals... | 2.15625 | 2 |
src/orbmatch_video.py | mtc-20/augmented-reality | 0 | 12795998 | <gh_stars>0
'''
Created on Saturday, 3rd October 2020 8:13::01 pm
@author: mtc-20
Coded on VS Code 2019
------
Overview:
------
Last Modified: Sat Oct 03 2020
'''
import cv2
import numpy as np
def display(frame):
cv2.imshow("check", frame)
cv2.waitKey(0)
if cv2.waitKey(1):
cv2.destroyAllWindows(... | 2.34375 | 2 |
architect/test_jit.py | MIT-REALM/architect | 2 | 12795999 | <filename>architect/test_jit.py<gh_stars>1-10
import time
import jax
import jax.numpy as jnp
def f(x):
return jnp.dot(x, x.T)
N_trials = 1
total_time = 0.0
x = jnp.ones((1000, 1))
f = jax.jit(f)
start = time.perf_counter()
f(x)
end = time.perf_counter()
print(f"jit_time: {end - start}")
g = jax.vmap(f)
y = j... | 2.546875 | 3 |
stree/Splitter.py | Doctorado-ML/STree | 7 | 12796000 | <gh_stars>1-10
"""
Oblique decision tree classifier based on SVM nodes
Splitter class
"""
import os
import warnings
import random
from math import log, factorial
import numpy as np
from sklearn.feature_selection import SelectKBest, mutual_info_classif
from sklearn.preprocessing import StandardScaler
from sklearn.svm i... | 2.828125 | 3 |
Conference/app/admin.py | amit-sgwn/Conference | 0 | 12796001 | from django.contrib import admin
from app.models import *
class TrackAdmin(admin.ModelAdmin):
list_display=('title','description',)
class SessionAdmin(admin.ModelAdmin):
list_display = ('title','status',)
search_fields = ['title','abstract']
list_filter = ('track','speaker',)
actions =... | 2.015625 | 2 |
hms-core/tests/test_hms_core/test_data_objects.py | PacktPublishing/Hands-On-Software-Engineering-with-Python | 40 | 12796002 | #!/usr/bin/env python
"""
Defines unit-tests for the module at hms_core.data_objects.
"""
#######################################
# Any needed from __future__ imports #
# Create an "__all__" list to support #
# "from module import member" use #
#######################################
__all__ = [
# Test-case... | 2.0625 | 2 |
runtime/test/specs/V1_3_cts_only/concat_invalid_rank.mod.py | aosp-goes-brrbrr/packages_modules_NeuralNetworks | 0 | 12796003 | <reponame>aosp-goes-brrbrr/packages_modules_NeuralNetworks
#
# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.or... | 1.75 | 2 |
python/handwritten_baseline/pipeline/model/scripts/train_predict_optimize.py | UKPLab/cdcr-beyond-corpus-tailored | 10 | 12796004 | <filename>python/handwritten_baseline/pipeline/model/scripts/train_predict_optimize.py
import copy
import json
import pickle
import pprint
from logging import Logger
from pathlib import Path
from typing import Dict, Optional, List, Union, Tuple
import numpy as np
import optuna
import pandas as pd
import seaborn as sns... | 1.828125 | 2 |
src/bakalarishell/main.py | Hackrrr/BakalariAPI | 5 | 12796005 | from __future__ import annotations
import argparse
import asyncio
import getpass
import inspect
import json
import logging
import logging.config
import os
import threading
import time
import traceback
import warnings
import webbrowser
from dataclasses import dataclass, field
from datetime import datetime, timedelta
fr... | 1.828125 | 2 |
controller/ui.py | timmyArch/timmyPaste | 2 | 12796006 |
from controller.base import *
class UI(FlaskView):
def index(self):
return render_template('index.haml')
def get(self, key=None):
try:
flash=None
if key == 'new':
return render_template('new.haml')
elif key:
return self.__s... | 2.4375 | 2 |
source/run_tests.py | andrzejgorski/pascalis | 2 | 12796007 | #!/usr/bin/env python
import subprocess
import re
tests_raw = subprocess.check_output(["ls", "tests"])
tests = re.sub("[^\w]", " ", tests_raw).split()
OUTPUTS = {
'program': "1",
'test_if': "1",
'test_if_false': "",
'test_if_el': "1",
'test_if_el_false': "0",
'test_eq_int': "1",
'test_eq... | 2.46875 | 2 |
LeetCode/Session3/FindTilt.py | shobhitmishra/CodingProblems | 0 | 12796008 | class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
tilt = 0
def findTilt(self, root: TreeNode) -> int:
self.findTiltHelper(root)
return self.tilt
def findTiltHelper(self, root):
if not root:
... | 3.421875 | 3 |
put_json_to_dynamodb.py | kykasper/konomania-bot | 0 | 12796009 | import json
import codecs
import pandas as pd
import boto3
csv_path = "./fixed_tweets.csv"
save_path = "./fixed_tweets.json"
df = pd.read_csv(csv_path, header=None, encoding = "utf-8")
df.columns =["tweet"]
df_json = df.to_dict(orient='records')
resource = boto3.resource('dynamodb', region_name='ap-northeast-1')
#... | 2.734375 | 3 |
2018/day07/part2.py | zagura/aoc-2017 | 2 | 12796010 | <reponame>zagura/aoc-2017
#!/usr/bin/python3
# Example line: Step A must be finished before step L can begin.
edges = [(ord(x[1]) - ord('A'), ord(x[7]) - ord('A')) for x in
map(lambda x: x.split(), open('input.in').readlines())]
workers = 5
for e in edges:
print('{} → {}'.format(chr(ord('A') + e[0]),chr(ord('A') + ... | 2.984375 | 3 |
keeper/api/auth.py | lsst-sqre/ltd-keeper | 5 | 12796011 | """Authentication routes."""
from __future__ import annotations
from flask import g
from flask_accept import accept_fallback
from keeper.api import api
from keeper.auth import password_auth
from keeper.logutils import log_route
from ._models import AuthTokenResponse
@api.route("/token")
@accept_fallback
@log_rout... | 2.84375 | 3 |
tests/acceptance/selene_page_factory_test.py | pupsikpic/selene | 572 | 12796012 | <filename>tests/acceptance/selene_page_factory_test.py
# MIT License
#
# Copyright (c) 2015-2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including withou... | 2.09375 | 2 |
testflows/_core/exceptions.py | testflows/TestFlows-Core | 3 | 12796013 | <filename>testflows/_core/exceptions.py<gh_stars>1-10
import sys
import traceback
def exception(exc_type=None, exc_value=None, exc_traceback=None):
"""Get exception string.
"""
if (exc_type, exc_value, exc_traceback) == (None, None, None):
exc_type, exc_value, exc_traceback = sys.exc_info()
re... | 2.53125 | 3 |
services/Compute/ec2_standalone.py | asurion/Hibernate | 9 | 12796014 | <reponame>asurion/Hibernate
from utils.randomGen import generateRandomString
from asyncProducerUtil.utils.connect import Connect
class ElasticComputeDefinition(Connect):
api_name = 'ec2'
table_name = 'scheduler_state_logs'
def ec2_def(self, i, schedule):
OS = i.platform
if OS is None:
... | 2.28125 | 2 |
gridspectra.py | mahdiqezlou/vw_spectra | 0 | 12796015 | <filename>gridspectra.py
# -*- coding: utf-8 -*-
"""Class to generate spectra in the positions where there is a DLA, as known from the grid generation."""
from __future__ import print_function
import numpy as np
import hdfsim
import h5py
import vw_spectra
import os.path as path
class GridSpectra(vw_spectra.VWSpectra)... | 2.625 | 3 |
demos/princomp_test.py | bmcmenamin/hebbnets | 0 | 12796016 | """
Test princomp extraction from CLI
"""
import argparse
import os
import numpy as np
from demo_utils import get_random_data
from hebbnets.networks import MultilayerHahNetwork
np.set_printoptions(suppress=True)
def _argparse():
parser = argparse.ArgumentParser(
prog="Testing HebbNet principal c... | 2.578125 | 3 |
Chapter01/bias_variance.py | bpbpublications/Getting-started-with-Deep-Learning-for-Natural-Language-Processing | 0 | 12796017 | # -*- coding: utf-8 -*-
"""
## Author: <NAME>
## Copyright: Copyright 2018-2019, Packt Publishing Limited
## Version: 0.0.1
## Maintainer: <NAME>
## Email: <EMAIL>
## Linkedin: https://www.linkedin.com/in/linus1/
## Contributor : {if you debug, append your name here}
## Contributor Email : {if you debug, appen... | 3.171875 | 3 |
fjord/settings/test.py | DESHRAJ/fjord | 0 | 12796018 | <reponame>DESHRAJ/fjord<filename>fjord/settings/test.py
DEBUG = TEMPLATE_DEBUG = True
CELERY_ALWAYS_EAGER = True
SESSION_COOKIE_SECURE = False
| 0.933594 | 1 |
days/day101/Bite 10. Practice exceptions/divide.py | alex-vegan/100daysofcode-with-python-course | 2 | 12796019 | <filename>days/day101/Bite 10. Practice exceptions/divide.py
def positive_divide(numerator, denominator):
try:
result = numerator / denominator
except ZeroDivisionError:
return 0
except Exception as x:
raise x
if result < 0:
raise ValueError
return result
... | 3.0625 | 3 |
embed.py | Top34051/stargan-zsvc | 8 | 12796020 | import numpy as np
import argparse
from utils import Audio
def sample_wav_audio(path):
audio = Audio()
mel = audio.audio_to_mel(path)
samples = audio.mel_sample(mel, width=128, k=5)
return samples
def save_embeddings(name, samples):
audio = Audio()
avg_embed = np.zeros(256, dtype=np.float32)
... | 3.015625 | 3 |
python-lib/modellightgbm/dku_lightgbm.py | shippeo/dss-plugin-model-lightgbm | 3 | 12796021 | <reponame>shippeo/dss-plugin-model-lightgbm
from lightgbm import LGBMClassifier, LGBMRegressor
class DkuLGBMClassifier(LGBMClassifier):
def __init__(self, boosting_type='gbdt', num_leaves=31, max_depth=-1, learning_rate=0.1, n_estimators=100,
subsample_for_bin=200000, objective=None,... | 2.140625 | 2 |
experiments/recall_rate_vs_accuracy.py | happygirlzt/soft_alignment_model_bug_deduplication | 2 | 12796022 | import argparse
import logging
import os
import pickle
import random
import ujson
import sys
import math
from ctypes import c_ulong
from multiprocessing import Array, Queue
from multiprocessing.sharedctypes import RawArray
from queue import Empty
from time import time
import numpy as np
import resource
from scipy.spa... | 2.09375 | 2 |
examples/pruning_two_instances.py | laudv/veritas | 6 | 12796023 | <gh_stars>1-10
import xgboost as xgb
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
import veritas
import veritas.xgb
# Generate a random dataset
np.random.seed(14)
N = 2000
x = np.random.randint(0, 100, size=(N, 1)).astype(float)
y = np.random.randint(0, 100, size=(N, 1))... | 2.671875 | 3 |
create_academic.py | hulecom/hulecom.github.io | 0 | 12796024 | <reponame>hulecom/hulecom.github.io
import argparse
import os
#-- command line parameters
#-- Read the system arguments listed after the program
parser = argparse.ArgumentParser(
description="""Read a bibtex file to create website architecture for Hugo website
"""
)
parser.add_argument("--file","-f",
h... | 3.015625 | 3 |
p2ner/components/scheduler/spullclient/spullclient/core.py | schristakidis/p2ner | 2 | 12796025 | <reponame>schristakidis/p2ner<filename>p2ner/components/scheduler/spullclient/spullclient/core.py
# -*- coding: utf-8 -*-
# Copyright 2012 <NAME>, <NAME>
#
# 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... | 2 | 2 |
pyramid_openapi3/tests/test_add_formatter.py | niteoweb/pyramid_openapi | 74 | 12796026 | """Tests for registering custom formatters."""
from pyramid.testing import DummyRequest
from pyramid.testing import testConfig
def test_add_formatter() -> None:
"""Test registration of a custom formatter."""
with testConfig() as config:
request = DummyRequest()
config.include("pyramid_opena... | 2.484375 | 2 |
test/m366_22_test.py | schwehr/ais-areanotice-py | 7 | 12796027 | #!/usr/bin/env python
"""Test USCG specific 8:367:22 area notice message Version 23 samples."""
import datetime
import unittest
from ais_area_notice import m366_22
# from m366_22 import AreaNotice
# from m366_22 import AreaNoticeCircle
# from m366_22 import AreaNoticeRectangle
# from m366_22 import AreaNoticeSector
... | 2.71875 | 3 |
model/CNN_data/load_train_data.py | nicolepanek/Thermophile_classification | 0 | 12796028 | <gh_stars>0
import pandas as pd
import numpy as np
import torch
from torch.utils.data import TensorDataset, DataLoader
from sklearn.model_selection import train_test_split
def load_data():
#Load data
X = torch.load('/gscratch/stf/jgershon/tensor_x.pt')
Y = torch.load('/gscratch/stf/jgershon/tensor_y.pt')
return X... | 2.59375 | 3 |
test/media/qa_test/test_create_thumbnail.py | yunfan/bce-sdk-python | 22 | 12796029 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
########################################################################
#
# Copyright 2015 Baidu, Inc.
#
########################################################################
"""
File: test_create_thumbnail.py
Date: 2015/06/10 15:15:40
"""
import os
import sys
impo... | 2.078125 | 2 |
ML/Pytorch/GANs/5. ProGAN/test.py | ZonePG/Machine-Learning-Collection | 9 | 12796030 | <filename>ML/Pytorch/GANs/5. ProGAN/test.py
def func(x=1, y=2, **kwargs):
print(x, y)
print(func(x=3, y=4))
| 1.984375 | 2 |
uranai.py | heeeedgehog/chat2021 | 0 | 12796031 | <reponame>heeeedgehog/chat2021
import re
import time
import random
import IPython
from google.colab import output
n = 0
def chat(text, **kw): #チャット用の関数(ここを書き換える)
global n
n += 1
return 'ほ' * n
# アイコンの指定
BOT_ICON = 'https://3.bp.blogspot.com/-qbORCFE5qhk/UmTBJwEYKjI/AAAAAAAAZYY/nbjieynFcLQ/s800/job_uranaishi.... | 2.8125 | 3 |
mex/apps.py | coblo/mex | 5 | 12796032 | # -*- coding: utf-8 -*-
from django.conf import settings
from django.apps import AppConfig
from django.contrib.admin import AdminSite
class MexConfig(AppConfig):
name = "mex"
verbose_name = settings.MEX_BRAND
def ready(self):
AdminSite.site_title = settings.MEX_BRAND
AdminSite.site_heade... | 1.6875 | 2 |
cryptoalarm-app/python/cryptoalarm/monitor.py | nesfit/jane-cryptoalarm | 3 | 12796033 | #!/usr/bin/env python3
"""
This module specifies class Monitored designated for processing of cryptocurrencies blocks
"""
import threading
import logging
from timeit import default_timer as timer
from datetime import datetime, timedelta
from .coin import BTC, BCH, DASH, ZEC, LTC, ETH
from .database import Database
from... | 2.875 | 3 |
examples/opencv_stream/sender.py | Rubilmax/python-p2p | 2 | 12796034 | <filename>examples/opencv_stream/sender.py
import sys
import os
# allow the example to be run without installing the package, from this repository's root directory
sys.path.append(os.path.abspath(os.path.join('.')))
"""
OpenCV Stream sender example
This example is made to be run from one python shell,
waiting for con... | 2.65625 | 3 |
streaming_event_compliance/services/build_automata/case_thread.py | lvzheqi/StreamingEventCompliance | 3 | 12796035 | <filename>streaming_event_compliance/services/build_automata/case_thread.py<gh_stars>1-10
from streaming_event_compliance import app
from streaming_event_compliance.objects.variable.globalvar import gVars, CL, T, C
from streaming_event_compliance.objects.automata import automata
from streaming_event_compliance.objects.... | 2.046875 | 2 |
reduce_demo.py | zdenek-nemec/python-tutorial-socratica | 1 | 12796036 | <reponame>zdenek-nemec/python-tutorial-socratica
import functools
numbers = list(range(1, 11))
print(numbers)
product = functools.reduce(lambda x, y: x*y, numbers)
print(product)
| 3.515625 | 4 |
common/plotter.py | tianluyuan/pyutils | 1 | 12796037 | <reponame>tianluyuan/pyutils<gh_stars>1-10
import functools
import numpy as np
from scipy import optimize
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib import colors
import matplotlib.patheffects as path_effects
import matplotlib.pyplot as plt
from collections import namedtuple
CoordSys = named... | 2.578125 | 3 |
JsonCodeTools/jinja2_codegen/templates/base/backend_api.py | kamlam/EAGLE-Open-Model-Profile-and-Tools-1 | 0 | 12796038 | import sys
from flask import Response, Blueprint
from flask.views import MethodView
from backend.backend import save_state, load_state
setattr(sys.modules[__name__], __name__, Blueprint(__name__, __name__))
urls = [("/backend/save_state/" , "BackendSaveState", ["POST"]),
("/backend/load_state/" , "BackendLo... | 2.34375 | 2 |
website/API/generate_pairs.py | marcinkaczmarek10/pairs_generator_flask | 0 | 12796039 | <reponame>marcinkaczmarek10/pairs_generator_flask<filename>website/API/generate_pairs.py
import operator
import itertools
from flask import jsonify, abort, Blueprint, request
from website.database.DB import SessionFactory, SessionContextManager
from website.database.models import UsersPerson, RandomPair, DrawCount
from... | 2.359375 | 2 |
utils/multi_threading.py | othmbela/fifa-21-web-scraping | 2 | 12796040 | import threading
class MultiThreading(object):
def __init__(self, scrapers):
self.scrapers = scrapers
def run(self):
threads = []
for i in range(len(self.scrapers)):
t = threading.Thread(target=self.scrapers[i].start)
t.start()
threads.append(t)
... | 3.359375 | 3 |
shisell/extenders/__init__.py | Soluto/shisell-python | 2 | 12796041 | from .create_scoped import create_scoped
from .with_context import with_context
from .with_extras import with_extra, with_extras, Extras
from .with_filter import with_filter, Filter
from .with_identities import with_identity, with_identities, Identities
from .with_meta import with_meta
| 1.023438 | 1 |
data types and variables LAB/special numbers.py | nrgxtra/fundamentals | 0 | 12796042 | <filename>data types and variables LAB/special numbers.py
n = int(input())
for i in range(1, n + 1):
sum_of_digits = 0
for cd in range(len(str(i))):
sum_of_digits += int(str(i)[cd])
if (sum_of_digits == 5) or (sum_of_digits == 7) or (sum_of_digits == 11):
print(f'{i} -> True')
... | 3.84375 | 4 |
app/vehicle.py | harnoor-g/trademebot | 0 | 12796043 | #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#>> this class creates an instance of each vehicle that has been parsed
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
class Vehicle:
num_vehicles = 0
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#>> init method creates a range of variables t... | 3.59375 | 4 |
pypeerassets/transactions.py | sparklecoin/pypeerassets | 0 | 12796044 | <gh_stars>0
'''transaction assembly/dissasembly'''
from decimal import Decimal
from math import ceil
from time import time
from btcpy.structs.address import Address
from btcpy.structs.script import (
NulldataScript,
P2pkhScript,
ScriptSig,
StackData,
)
from btcpy.structs.transaction import (
Lockt... | 2.046875 | 2 |
day5/image.py | termoshtt/sevendayshpc | 39 | 12796045 | import glob
import numpy as np
from matplotlib import pyplot as plt
for filename in glob.glob("*.dat"):
print(filename)
name = filename.split(".")[0]
data = np.loadtxt(filename, delimiter=",")
size = int(np.sqrt(len(data)))
data = data.reshape((size, size))
fig, ax = plt.subplots(figsize=(5.12,... | 2.78125 | 3 |
code/main2_xgb.py | wayinone/NYtaxi | 0 | 12796046 | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 6 00:25:27 2017
@author: Wayne
"""
import pandas as pd
import xgboost as xgb
import numpy as np
from sklearn.model_selection import train_test_split
import pickle
#%%
mydf1= mydf[outliers.outliers==False]
z = np.log(data.trip_duration+1)
X = mydf1
Xtest ... | 2.34375 | 2 |
CNIC-C/detector.py | CSnode/Multimodal-Captioning | 2 | 12796047 | # -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
import cPickle
import ipdb
class Detector():
def __init__(self,weight_file_path,n_labels):
self.image_mean=[103.939,116.779,123.68]
self.n_labels=n_labels
with open(weight_file_path)as f:
self.pretrained_weights=cPickle.load(f)
def get_weight... | 2.453125 | 2 |
analysis/linearprobe.py | paulgavrikov/torchbox | 0 | 12796048 | <reponame>paulgavrikov/torchbox
import torch
from torch.nn import Flatten, LazyLinear, Softmax
class LinearProbe:
def __init__(self, device="cpu", verbose=False):
self.device = device
self.max_epochs = 10
self.verbose = verbose
rep = None
def _hook(model, inp, out):
rep ... | 2.5 | 2 |
problems/reversing/obfuscatedPython1/debug/obfuscatedPython1_explained.py | wanqizhu/treectf | 1 | 12796049 | <reponame>wanqizhu/treectf<gh_stars>1-10
""" woo pretty code!!!
"description": "There are two characters wrong with the code. What's that pretty face doing?"
treeCTF{110_105_99_101}
Actually though, the code may look fancy, but all it's doing is doing some random stuff with an array of characters
but instead of... | 2.859375 | 3 |
utilities/utility.py | kwanj-k/flask_sm | 0 | 12796050 | <reponame>kwanj-k/flask_sm<filename>utilities/utility.py
from helpers.database import db_session
class Utility(object):
def save(self):
"""Function for saving new objects"""
db_session.add(self)
db_session.commit()
def delete(self):
"""Function for deleting objects"""
... | 2.6875 | 3 |