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 |
|---|---|---|---|---|---|---|
leetcode/2141.py | ShengyuanWang/ShengyuanWang.github.io | 1 | 12798651 | class Solution:
def maxRunTime(self, n: int, batteries: List[int]) -> int:
left, right, ans = 0, sum(batteries) // n, 0
while left <= right:
mid = (left + right) // 2
total = 0
for cap in batteries:
total += min(cap, mid)
if total >= n ... | 3.046875 | 3 |
src/Data.py | Abdulla-binissa/Matrix | 0 | 12798652 | import random
from random import randint
class State():
def __init__(self):
self.dictionary = {} #{(row, col): (pieceIMG, brightness)}
def addDrop(self, width, top):
screenTop = top - 1
screenLeft = -width // 2
screenRight = width // 2
column = random.randint(screenLef... | 3.21875 | 3 |
generate-excel/src/__init__.py | spencercjh/SpringCloudCrabScore | 1 | 12798653 | import logging
import sys
import traceback
from flask import Flask, jsonify
def create_app(script_info=None):
# instantiate the app
app = Flask(
__name__, template_folder='../templates'
)
# set config
app.logger.setLevel(logging.INFO)
from src.controller import excel_service
app... | 2.328125 | 2 |
jprq/tunnel_tcp.py | AbduazizZiyodov/jprq-python-client | 9 | 12798654 | <reponame>AbduazizZiyodov/jprq-python-client
import sys
import ssl
import json
import certifi
import threading
import websockets
from rich import print as pretty_print
from .tcp import Client
ssl_context = ssl.create_default_context()
ssl_context.load_verify_locations(certifi.where())
async def open_tcp_tunnel(ws_... | 2.78125 | 3 |
ex087.py | honeyhugh/PythonCurso | 0 | 12798655 | <reponame>honeyhugh/PythonCurso<filename>ex087.py
matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
par = []
maior = 0
for l in range(0, 3):
for c in range(0, 3):
matriz[l][c] = int(input(f'Digite um valor para [{l},{c}]: '))
if matriz[l][c] % 2 == 0:
par.append(matriz[l][c])
print('=' * 30)
fo... | 3.671875 | 4 |
streamlit/utils/ui.py | T-Sumida/ObjectDetection-Streamlit | 1 | 12798656 | # -*- coding:utf-8 -*-
from typing import Optional, Tuple, List
import cv2
import numpy as np
import streamlit as st
from PIL import Image
from utils.model import MODEL_TYPE, draw_bboxes
def description(header: str, description: str):
"""show description
Args:
header (str): header message
d... | 2.890625 | 3 |
DoubanTop250/top250.py | qinyunkone/Web-Crawler | 2 | 12798657 | from urllib import request, error
from fake_useragent import UserAgent
import re
import time
def request_(url):
try:
ua = UserAgent()
headers = {'User-Agent': ua.chrome}
req = request.Request(url, headers=headers)
return request.urlopen(req).read().decode('utf-8')
except error ... | 2.609375 | 3 |
fdf-cpp/test/unzipall.py | valgarn/fraud-detection-framework | 0 | 12798658 | <gh_stars>0
import os
import sys
import uuid
import zipfile
def extract(source, destination):
z = zipfile.ZipFile(source)
for f in z.namelist():
if(f.upper().endswith(".JPG") or f.upper().endswith(".JPEG")):
with open(os.path.join(destination, "{}.jpg".format(str(uuid.uuid4()))), "wb") as ... | 2.734375 | 3 |
tune_hyperopt/__init__.py | fugue-project/tune | 14 | 12798659 | # flake8: noqa
from tune_hyperopt.optimizer import HyperoptLocalOptimizer
| 1.085938 | 1 |
morm/model.py | neurobin/python-morm | 4 | 12798660 | <gh_stars>1-10
"""Model.
"""
__author__ = '<NAME> <<EMAIL>>'
__copyright__ = 'Copyright © <NAME> <https://github.com/neurobin/>'
__license__ = '[BSD](http://www.opensource.org/licenses/bsd-license.php)'
__version__ = '0.0.1'
import inspect
import typing
from typing import Optional, Dict, List, Tuple, TypeVar, Union, ... | 1.945313 | 2 |
sql_demo.py | Piyuyang/Flask_demo | 0 | 12798661 | from datetime import datetime
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
class MySQLConfig(object):
SQLALCHEMY_DATABASE_URI = "mysql://root:[email protected]:3306/toutiao"
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_ECHO = True
app.config.from_object(MySQL... | 2.546875 | 3 |
src/app_conf.py | kb2ma/nethead-ui | 0 | 12798662 | """
Copyright 2020 <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 of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distribu... | 1.117188 | 1 |
app/migrations/0015_rename_users_list_user.py | djyasin/GrocerEase | 1 | 12798663 | # Generated by Django 4.0.1 on 2022-01-22 15:53
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0014_alter_list_users'),
]
operations = [
migrations.RenameField(
model_name='list',
old_name='users',
ne... | 1.710938 | 2 |
Strip_Method.py | BeenashPervaiz/Command_Line_Task | 0 | 12798664 | <filename>Strip_Method.py
name = " Pervaiz "
dots = " ........."
print(name.lstrip() + dots) #lstrip Method
print(name.rstrip() + dots) #rstrip Method
print(name.strip() + dots) #strip Method
print(name.replace(" ", "") + dots) #Replace Method | 3.234375 | 3 |
micromelon/_robot_comms/_rover_read_cache.py | timmyhadwen/mm-pymodule | 3 | 12798665 | <reponame>timmyhadwen/mm-pymodule
from enum import Enum
import time
from ._comms_constants import MicromelonType as OPTYPE
class BUFFER_POSITIONS(Enum):
ULTRASONIC = 0
ACCL = 2
GYRO = 8
COLOUR_ALL = 20
TIME_OF_FLIGHT = 50
BATTERY_VOLTAGE = 54
BATTERY_PERCENTAGE = 56
PERCENTAGE_PADDING ... | 2.5625 | 3 |
Data Science With Python/13-introduction-to-data-visualization-with-python/04-analyzing-time-series-and-images/08-cumulative-distribution-function-from-an-image-historgram.py | aimanahmedmoin1997/DataCamp | 3 | 12798666 | '''
Cumulative Distribution Function from an image histogram
A histogram of a continuous random variable is sometimes called a Probability Distribution Function (or PDF). The area under a PDF (a definite integral) is called a Cumulative Distribution Function (or CDF). The CDF quantifies the probability of observing ce... | 3.359375 | 3 |
src/models/heads/__init__.py | takedarts/skipresnet | 3 | 12798667 | <gh_stars>1-10
from .mobilenet import MobileNetV2Head, MobileNetV3Head
from .nfnet import NFHead
from .none import NoneHead
from .pre_activation import PreActivationHead
from .swin import SwinHead
from .vit import ViTHead
| 1.03125 | 1 |
ce_tools-TESTER.py | ArezalGame89/Corn-Engine | 0 | 12798668 | ####################################################=
###################CE_TOOLS TEST####################
####################################################=
# A functional tester for the famous Corn Engine Utillity "CE_tools.py"
# This can also be used as a template on how to make a tester correctly
import ce_... | 3.171875 | 3 |
louvain_to_gephi_graphx.py | ErathosthemesAmmoro/track-communities | 12 | 12798669 | #
# Copyright 2016 Sotera Defense Solutions Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 1.890625 | 2 |
src/board/models.py | woongchoi84/BLEX | 1 | 12798670 | <reponame>woongchoi84/BLEX
import requests
import datetime
import random
from django.db import models
from django.contrib.auth.models import User
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils import timezone
from tagging.fields import TagField
font_mapping = {
... | 2.078125 | 2 |
testsuite/modulegraph-dir/renamed_package/__init__.py | xoviat/modulegraph2 | 9 | 12798671 | from sys import path as the_path
| 1.140625 | 1 |
02.Button/09.SwitchFun.py | sarincr/Python-App-Development-using-Kivy | 1 | 12798672 | <gh_stars>1-10
from kivy.app import App
from kivy.uix.switch import Switch
class SwitchApp(App):
def build(self):
switch = Switch()
switch.bind(active=self.switch_state)
return switch
def switch_state(self, instance, value):
print('Switch is', value)
SwitchApp().run()
| 2.546875 | 3 |
python/559.maximum-depth-of-n-ary-tree.py | fengbaoheng/leetcode | 1 | 12798673 | <reponame>fengbaoheng/leetcode
#
# @lc app=leetcode.cn id=559 lang=python3
#
# [559] N叉树的最大深度
#
class Node:
def __init__(self, val, children):
self.val = val
self.children = children
class Solution:
# 递归子树求深度
def maxDepth(self, root: 'Node') -> int:
if root is None:
re... | 3.28125 | 3 |
conf/gunicorn.ini.py | tkosht/wsgis | 0 | 12798674 | # import multiprocessing
bind = "0.0.0.0:8000"
# workers = multiprocessing.cpu_count() * 2 + 1
workers = 2
threads = 2
backlog = 4096
| 1.890625 | 2 |
src/healthvaultlib/tests/methods/test_getservicedefinition.py | rajeevs1992/pyhealthvault | 1 | 12798675 | from healthvaultlib.tests.testbase import TestBase
from healthvaultlib.methods.getservicedefinition import GetServiceDefinition
class TestGetServiceDefinition(TestBase):
def test_getservicedefinition(self):
method = GetServiceDefinition(['platform', 'shell', 'topology',
... | 2.328125 | 2 |
sta/980004006.py | IntSPstudio/vslst-python | 0 | 12798676 | #|==============================================================|#
# Made by IntSPstudio
# Project Visual Street
# ID: 980004006
# Twitter: @IntSPstudio
#|==============================================================|#
#SYSTEM
import os
import sys
#import time
import turtle
import math
#ALG
#Ympyrän kehän koko
def c... | 3.09375 | 3 |
OpenCV/goalTracker.py | cyamonide/FRC-2017 | 0 | 12798677 | <filename>OpenCV/goalTracker.py
import os
import numpy as np
import cv2
from networktables import NetworkTable
os.system("sudo bash /home/pi/vision/init.sh")
NetworkTable.setIPAddress("roboRIO-4914-FRC.local")
NetworkTable.setClientMode()
NetworkTable.initialize()
table = NetworkTable.getTable("HookContoursReport")
... | 2.484375 | 2 |
sonnenblume/account/dal_models.py | Sylver11/sonnenblume | 0 | 12798678 | from sqlalchemy.orm import Session, noload
from sqlalchemy.future import select
from sqlalchemy import update
from uuid import UUID
from . import models, schemas
class UserDAL():
def __init__(self, db_session: Session):
self.db_session = db_session
async def get_user_by_email(self, email: str):
... | 2.5625 | 3 |
source_code_tokenizer/languages/c/regex.py | matteogabburo/source-code-tokenizer | 1 | 12798679 | LIST_KEYWORDS = [
r"_Alignas",
r"_Alignof",
r"_Atomic",
r"_Bool",
r"_Complex",
r"_Decimal128",
r"_Decimal32",
r"_Decimal64",
r"_Generic",
r"_Imaginary",
r"_Noreturn",
r"_Static_assert",
r"_Thread_local",
r"asm",
r"auto",
r"break",
r"case",
r"char",... | 2.390625 | 2 |
svg_ultralight/strings/svg_strings.py | ShayHill/svg_ultralight | 1 | 12798680 | #!/usr/bin/env python3
# _*_ coding: utf-8 _*_
"""Explicit string formatting calls for arguments that aren't floats or strings.
:author: <NAME>
:created: 10/30/2020
The `string_conversion` module will format floats or strings. Some other formatters can
make things easier.
"""
from typing import Iterable, Tuple
from... | 4.25 | 4 |
2020/day4/day4.py | andrejkurusiov/advent-of-code-2020 | 0 | 12798681 | import re
# initial data input
infilename = "./day4.txt"
# required fields for checking
required = {"byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"}
def readfile():
with open(infilename, "rt", encoding="utf-8") as file:
inlist = [line.strip() for line in file]
return inlist
def parse_input(inlist=... | 3.203125 | 3 |
tests/test_finite_automaton.py | caiopo/kleeneup | 0 | 12798682 | <filename>tests/test_finite_automaton.py
from kleeneup import FiniteAutomaton, Sentence, State, Symbol
def test_copy():
a, b = Symbol('a'), Symbol('b')
A, B = State('A'), State('B')
transitions = {
(A, a): {B},
(A, b): {A},
(B, a): {A},
(B, b): {B},
}
fa1 = Finite... | 2.71875 | 3 |
data.py | Goteia000/simple_dcf_model | 2 | 12798683 | <filename>data.py
from util import retrieve_from
# 3b732d31142b79d4e8d659612f55181a
class API_Data:
def __init__(self, ticker, apikey='2bd6ce6f77da18e51c3e254ed9060702', url='https://financialmodelingprep.com', verbose=True):
self.url = url
self.ticker = ticker
self.verbose = verbose
... | 2.71875 | 3 |
meteocat_api_client/xarxes/pronostic/__init__.py | herrera-lu/meteocat-api-client | 0 | 12798684 | from ..pronostic.pronostic import Pronostic
| 1.0625 | 1 |
main_store/migrations/0002_auto_20201116_1214.py | Melto007/medical_store_project | 0 | 12798685 | <filename>main_store/migrations/0002_auto_20201116_1214.py<gh_stars>0
# Generated by Django 3.1.1 on 2020-11-16 06:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main_store', '0001_initial'),
]
operations = [
migrations.AlterField(
... | 1.34375 | 1 |
PWGPP/FieldParam/fitsol.py | maroozm/AliPhysics | 114 | 12798686 | #!/usr/bin/env python
debug = True # enable trace
def trace(x):
global debug
if debug: print(x)
trace("loading...")
from itertools import combinations, combinations_with_replacement
from glob import glob
from math import *
import operator
from os.path import basename
import matplotlib.pyplot as plt
import numpy as... | 2.625 | 3 |
Examples/example_magnetic_symmetry.py | DanPorter/Dans_Diffaction | 22 | 12798687 | <gh_stars>10-100
"""
Dans_Diffraction Examples
Load space groups and look at the information contained.
"""
import sys,os
import numpy as np
import matplotlib.pyplot as plt # Plotting
cf = os.path.dirname(__file__)
sys.path.insert(0,os.path.join(cf, '..'))
import Dans_Diffraction as dif
f = '../Dans_Diffraction/Stru... | 2.828125 | 3 |
distances/migrations/0011_auto_20170602_1044.py | tkettu/rokego | 0 | 12798688 | <filename>distances/migrations/0011_auto_20170602_1044.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-06-02 07:44
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('distances', '0010_au... | 1.5 | 2 |
blog/urls.py | yanfreitas/Django-blog-project | 0 | 12798689 | from django.urls import path
from blog import views
from blog.views import (
PostListView,
PostDetailView,
PostCreateView,
PostUpdateView,
PostDeleteView,
CommentDeleteView,
UserPostListView,
LikeView,
)
urlpatterns = [
path('', PostListView.as_view(), name='index'),
path('post/... | 2.09375 | 2 |
benchmarking/pfire_benchmarking/analysis_routines.py | willfurnass/pFIRE | 9 | 12798690 | <filename>benchmarking/pfire_benchmarking/analysis_routines.py
#!/usr/bin/env python3
""" Mathematical analysis functions for image and map comparison
"""
from collections import namedtuple
from textwrap import wrap
import os
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as sps
from tabulate... | 2.671875 | 3 |
fonts/FreeSerifItalic9pt7b.py | cnobile2012/Python-TFT | 0 | 12798691 | FreeSerifItalic9pt7bBitmaps = [
0x11, 0x12, 0x22, 0x24, 0x40, 0x0C, 0xDE, 0xE5, 0x40, 0x04, 0x82, 0x20,
0x98, 0x24, 0x7F, 0xC4, 0x82, 0x23, 0xFC, 0x24, 0x11, 0x04, 0x83, 0x20,
0x1C, 0x1B, 0x99, 0x4D, 0x26, 0x81, 0xC0, 0x70, 0x1C, 0x13, 0x49, 0xA4,
0xDA, 0xC7, 0xC1, 0x00, 0x80, 0x1C, 0x61, 0xCF, 0x0E, 0x... | 1.03125 | 1 |
travello/migrations/0004_auto_20200607_1817.py | KaushikAlwala/COVID-19---a-DBMS-approach | 0 | 12798692 | # Generated by Django 3.0.6 on 2020-06-07 12:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('travello', '0003_travel_history2'),
]
operations = [
migrations.RenameField(
model_name='medical_history',
old... | 1.765625 | 2 |
src/leetcode_1996_the_number_of_weak_characters_in_the_game.py | sungho-joo/leetcode2github | 0 | 12798693 | <filename>src/leetcode_1996_the_number_of_weak_characters_in_the_game.py
# @l2g 1996 python3
# [1996] The Number of Weak Characters in the Game
# Difficulty: Medium
# https://leetcode.com/problems/the-number-of-weak-characters-in-the-game
#
# You are playing a game that contains multiple characters,
# and each of the c... | 4.15625 | 4 |
pydsstools/examples/example4.py | alai-arpas/pydsstools | 54 | 12798694 | <reponame>alai-arpas/pydsstools
'''
Read irregular time-series data
'''
from pydsstools.heclib.dss import HecDss
dss_file = "example.dss"
pathname = "/IRREGULAR/TIMESERIES/FLOW//IR-DECADE/Ex3/"
with HecDss.Open(dss_file) as fid:
ts = fid.read_ts(pathname,regular=False,window_flag=0)
print(ts.pytimes)
pr... | 2.234375 | 2 |
src/fuzzingtool/decorators/plugin_meta.py | NESCAU-UFLA/FuzzyingTool | 0 | 12798695 | # Copyright (c) 2020 - present <NAME> <https://github.com/VitorOriel>
#
# 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 without limitation the rights
# to use, ... | 1.90625 | 2 |
app.py | heminsatya/free_notes | 0 | 12798696 | <filename>app.py
# Dependencies
from aurora import Aurora
# Instantiate the root app
root = Aurora()
# Run the root app
if __name__ == '__main__':
root.run()
| 1.570313 | 2 |
_states/ctags.py | mdavezac/pepper | 0 | 12798697 | def run(name, fields="+l", exclude=None, ctags="/usr/local/bin/ctags",
creates='tags'):
from os.path import join
if fields is None:
fields = []
elif isinstance(fields, str):
fields = [fields]
fields = " --fields=".join([""] + fields)
if exclude is None:
exclude = []
... | 2.296875 | 2 |
setup.py | Cray-HPE/manifestgen | 0 | 12798698 | # MIT License
#
# (C) Copyright [2020] Hewlett Packard Enterprise Development LP
#
# 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 without limitation
# the righ... | 1.398438 | 1 |
examples/zhexiantu.py | lora-chen/DeepCTR | 0 | 12798699 | print( -1.7280e+01 ) | 1.335938 | 1 |
dropup/up.py | Mr8/dropup | 0 | 12798700 | <reponame>Mr8/dropup
#!/usr/bin/env python
# encoding: utf-8
import upyun
import os
from .config import UPYUNCONFIG
from .trans import TranslatorIf
class UpyunCli(TranslatorIf):
'''Implemented of up yun client, inhanced from Translator'''
BUCKETNAME = UPYUNCONFIG.BUCKETNAME
def __init__(self):
se... | 2.5 | 2 |
01-first-flask-app/dynamic_routing_2.py | saidulislam/flask-bootcamp-2 | 0 | 12798701 | """An example application to demonstrate Dynamic Routing"""
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
""""View for the Home page of the Website"""
return "Welcome to the HomePage!"
@app.route('/square/<int:number>')
def show_square(number):
"""View that shows the... | 3.984375 | 4 |
logitch/discord_log.py | thomaserlang/logitch | 0 | 12798702 | try:
import discord
except ImportError:
raise Exception('''
The discord libary must be installed manually:
pip install https://github.com/Rapptz/discord.py/archive/rewrite.zip
''')
import logging, asyncio, json, aiohttp
from dateutil.parser import parse
from datetime import datetime
from... | 2.53125 | 3 |
bin/Package/PipPackageBase.py | Inokinoki/craft | 0 | 12798703 | from BuildSystem.PipBuildSystem import *
from Package.PackageBase import *
from Packager.PackagerBase import *
from Package.VirtualPackageBase import *
from Source.MultiSource import *
class PipPackageBase(PackageBase, PipBuildSystem, PackagerBase):
"""provides a base class for pip packages"""
def __init__(se... | 2.359375 | 2 |
2_Advanced_Images_3_TransferLearningAndFIneTuning2.py | BrunoDatoMeneses/TensorFlowTutorials | 0 | 12798704 | <reponame>BrunoDatoMeneses/TensorFlowTutorials
import matplotlib.pyplot as plt
import numpy as np
import os
import tensorflow as tf
from tensorflow.keras.preprocessing import image_dataset_from_directory
_URL = 'https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip'
path_to_zip = tf.keras.utils.get... | 2.984375 | 3 |
utils/__init__.py | Ilya-koala/VSL_Bot | 0 | 12798705 | <filename>utils/__init__.py
from . import misc
from .db_api.json_db import Database
from .notify_admins import on_startup_notify
from .voice_recognition import voice_to_text
from .pages import *
| 1.09375 | 1 |
15/15.py | hiszm/python-train | 0 | 12798706 | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 12 13:21:44 2021
@author: hiszm
"""
from sys import argv
script,filename = argv
txt = open (filename)
print ("Here's your file %r:" % filename)
print (txt.read())
print ("Type the filename again:")
file_again = input ("> ")
txt_again = open (file_again)
print (txt_... | 3.859375 | 4 |
mt/base/ndarray.py | inteplus/mtbase | 0 | 12798707 | <gh_stars>0
'''Useful functions dealing with numpy array.'''
import numpy as _np
__all__ = ['ndarray_repr']
def ndarray_repr(a):
'''Gets a one-line representation string for a numpy array.
Parameters
----------
a : numpy.ndarray
input numpy array
Returns
-------
str
a... | 3.453125 | 3 |
normalize_shape.py | alexandor91/Data-Generation-Tool | 22 | 12798708 | '''
Normalize shapenet obj files to [-0.5, 0.5]^3.
author: ynie
date: Jan, 2020
'''
import sys
sys.path.append('.')
from data_config import shape_scale_padding, \
shapenet_path, shapenet_normalized_path
import os
from multiprocessing import Pool
from tools.utils import append_dir, normalize_obj_file
from tools.rea... | 2.25 | 2 |
lochlanandcatherinecom/urls.py | Lochlan/LochlanAndCatherine.com | 1 | 12798709 | from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
from rsvps.views import GuestRsvpView
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name="home.html"), name='home'),
url(r'^about/$', TemplateView.as_view(template_name="about.ht... | 1.742188 | 2 |
test.py | latte488/smth-smth-v2 | 2 | 12798710 | import toml
import random
def main():
filename = 'test'
n_hidden = 64
mutual_infos = []
for i in range(n_hidden):
mutual_infos.append(random.random())
mutual_info_dict = {}
for i in range(n_hidden):
mutual_info_dict[f'{i:04}'] = mutual_infos[i]
with open(f'mutual_info_{fil... | 2.5 | 2 |
app/mocks/bme280.py | mygulamali/pi-sensors | 0 | 12798711 | from mocks.base import Base
class BME280(Base):
@property
def humidity(self) -> float: # %
return 100.0 * self.value
@property
def pressure(self) -> float: # hPa
return 1013.25 * self.value
@property
def temperature(self) -> float: # ºC
return 100.0 * self.value
| 2.4375 | 2 |
PythonExercicio/jogodavelha.py | fotavio16/PycharmProjects | 0 | 12798712 | import random
# Pedir ao Jogador para escolher uma letra O ou X
def escolhaLetraJogador():
l = ""
while l != "O" and l != "X":
l = str(input('Escolha a letra que prefere jogar (O ou X): ')).upper()
if l == "O":
letras = ['O', "X"]
else:
letras = ['X', "O"]
return letras
# S... | 3.921875 | 4 |
model.py | yanjingmao/NC_paper_source_code | 0 | 12798713 | import torch
import torch.nn as nn
class SeparableConv2D(nn.Module):
'''
Definition of Separable Convolution.
'''
def __init__(self, in_channels, out_channels, kernel_size, depth_multiplier=1, stride=1, padding=0, dilation=1, bias=True, padding_mode='zeros'):
super(SeparableConv2D, self).__ini... | 3.25 | 3 |
trump/extensions/source/tx-bbfetch/__init__.py | Equitable/trump | 8 | 12798714 | <reponame>Equitable/trump
from bbfetchext import * | 0.820313 | 1 |
dtask/task/apps.py | ysjiang4869/python_task | 0 | 12798715 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class TaskConfig(AppConfig):
name = 'task'
| 1.140625 | 1 |
units/jit_optimizations/image_loader_to_dataframe.py | dereina/pypreprocessing | 0 | 12798716 | <filename>units/jit_optimizations/image_loader_to_dataframe.py
import imageio
import utils
import os
import pandas as pd
import units.unit as unit
import time
from numba import njit, jit
@jit(cache=False, forceobj = True)
def getMetaData(append_by_name_meta_data, meta_data_extensions):
out = []
for ... | 2.34375 | 2 |
utils/trainer.py | niqbal996/ViewAL | 126 | 12798717 | import os
import torch
import constants
from utils.misc import get_learning_rate
from utils.summary import TensorboardSummary
from utils.loss import SegmentationLosses
from utils.calculate_weights import calculate_weights_labels
from torch.utils.data import DataLoader
import numpy as np
from utils.metrics import Evalua... | 2.015625 | 2 |
queries/variables/schedule_vars.py | CaladBlogBaal/Victorique | 0 | 12798718 | <gh_stars>0
def get_schedule(page: str):
if not page.isdecimal():
return False
variables = {"page": page}
return variables
| 2.1875 | 2 |
ComplementaryScripts/Step_02_DraftModels/Branch_carveme_draft.py | HaoLuoChalmers/Lactobacillus_reuteri_MM41A_GEM | 0 | 12798719 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by lhao at 2019-05-17
'''
input: L.reuteri protein sequence
output: draft model
'''
import os
import cobra
import My_def
import pandas as pd
os.chdir('../../ComplementaryData/Step_02_DraftModels/')
case = 'other' #'first' or 'other'
# %% <build>
if case =='... | 2.03125 | 2 |
tools/cal_effect_field_tool.py | yuanliangxie/YOLOv3_simple_baseline | 1 | 12798720 | import torch.nn as nn
import torch
import numpy as np
import cv2 as cv
def calculate_EPR(model): #TODO:尝试通过加载预训练权重计算有效感受野
for module in model.modules():
try:
nn.init.constant_(module.weight, 0.05)
nn.init.zeros_(module.bias)
nn.init.zeros_(module.running_mean)
nn.init.ones_(module.running_var)
except E... | 2.59375 | 3 |
Projects/Foreign_Exchange/helper_python/help_display.py | pedwards95/Springboard_Class | 0 | 12798721 | from flask import Flask, flash
def display_error(error,preface="",postface=""):
flash(f"{preface} {error} {postface}") | 2.296875 | 2 |
typing_protocol_intersection/mypy_plugin.py | klausweiss/typing-protocol-intersection | 0 | 12798722 | import sys
import typing
from collections import deque
from typing import Callable, Optional
import mypy.errorcodes
import mypy.errors
import mypy.nodes
import mypy.options
import mypy.plugin
import mypy.types
if sys.version_info >= (3, 10): # pragma: no cover
from typing import TypeGuard
else: # pragma: no cov... | 1.867188 | 2 |
epuap_watchdog/institutions/migrations/0014_auto_20170718_0443.py | ad-m/epuap-watchdog | 2 | 12798723 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-18 04:43
from __future__ import unicode_literals
from django.db import migrations, models
def update_names(apps, schema_editor):
for x in apps.get_model('institutions', 'regon').objects.exclude(data=None).iterator():
x.name = x.data.get('naz... | 1.960938 | 2 |
main/auth/github.py | chdb/DhammaMap1 | 0 | 12798724 | # coding: utf-8
# pylint: disable=missing-docstring, invalid-name
import flask
import auth
import config
from main import app
import model.user as user #import User#, UserVdr
github_config = dict(
access_token_method='POST',
access_token_url='https://github.com/login/oauth/access_token',
authorize_url='ht... | 2.46875 | 2 |
src/amtrakconn/__init__.py | scienceopen/amtrak-connections | 0 | 12798725 | <reponame>scienceopen/amtrak-connections
from pathlib import Path
from urllib.request import urlopen
from numpy import nan, in1d, atleast_1d, logical_and
from datetime import timedelta
from zipfile import ZipFile
from bs4 import BeautifulSoup
from re import compile
from io import StringIO
from time import sleep
import ... | 3.203125 | 3 |
joplin/pages/service_page/factories.py | cityofaustin/joplin | 15 | 12798726 | from pages.service_page.models import ServicePage
from pages.topic_page.factories import JanisBasePageWithTopicsFactory
from pages.base_page.fixtures.helpers.streamfieldify import streamfieldify
class ServicePageFactory(JanisBasePageWithTopicsFactory):
@classmethod
def create(cls, *args, **kwargs):
if... | 2 | 2 |
src/pyfonycore/bootstrap/config/Config.py | pyfony/core | 0 | 12798727 | <filename>src/pyfonycore/bootstrap/config/Config.py
class Config:
def __init__(
self,
container_init_function: callable,
kernel_class: type,
root_module_name: str,
allowed_environments: list,
):
self.__container_init_function = container_init_function
self... | 2.1875 | 2 |
leetcode/majority-element.py | zhangao0086/Python-Algorithm | 3 | 12798728 | <reponame>zhangao0086/Python-Algorithm
#!/usr/bin/python3
# -*-coding:utf-8-*-
__author__ = "Bannings"
from typing import List
class Solution:
def majorityElement(self, nums: List[int]) -> int:
count, candidate = 0, 0
for num in nums:
if count == 0:
candidate = num
... | 3.703125 | 4 |
python/dlbs/utils.py | tfindlay-au/dlcookbook-dlbs | 0 | 12798729 | # (c) Copyright [2017] Hewlett Packard Enterprise Development LP
#
# 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... | 2.46875 | 2 |
sickbeard/lib/tidysub/cleaner.py | Branlala/docker-sickbeardfr | 0 | 12798730 | <reponame>Branlala/docker-sickbeardfr<filename>sickbeard/lib/tidysub/cleaner.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
import re
from datetime import timedelta
from datetime import datetime
from regex import strings
from sickbeard import logger
#Definition of the TidySub class
class TidySub:
... | 2.34375 | 2 |
pystratis/api/wallet/requestmodels/pubkeyrequest.py | TjadenFroyda/pyStratis | 8 | 12798731 | <reponame>TjadenFroyda/pyStratis
from pydantic import Field
from pystratis.api import Model
from pystratis.core.types import Address
# noinspection PyUnresolvedReferences
class PubKeyRequest(Model):
"""A request model used for /wallet/pubkey endpoint.
Args:
wallet_name (str): The name of the wallet ... | 2.546875 | 3 |
aivle-worker/apis.py | edu-ai/aivle-worker | 0 | 12798732 | import json
import os
import requests
from client import Submission
from settings import API_BASE_URL, ACCESS_TOKEN
def get_task_url(task_id: int):
return API_BASE_URL + f"/tasks/{task_id}/download_grader/"
def get_agent_url(submission_id: int):
return API_BASE_URL + f"/submissions/{submission_id}/downloa... | 2.546875 | 3 |
utils/GraphThread.py | vonNiklasson/graph-client | 0 | 12798733 | import time
import logging
from extended_networkx_tools import Analytics, AnalyticsGraph
from timeit import default_timer as timer
from utils import Solvers
from utils.GraphUtils import GraphUtils
from utils.ServerUtil import ServerUtil
from datetime import datetime
class GraphThread:
@staticmethod
def sta... | 2.546875 | 3 |
src/entities/__init__.py | alliance-genome/agr_neo4j_qc | 2 | 12798734 | <filename>src/entities/__init__.py
from .generic import GenericEntities | 1.078125 | 1 |
zusha/registrations/forms.py | samsonmuoki/zusha_web_app | 1 | 12798735 | from django import forms
SACCO_DRIVER_STATUS_OPTIONS = [
('Approved', ('Approved to operate')),
('Suspended', ('Suspended for the time being')),
('Blacklisted', ('Blacklisted from operating'))
]
class VehicleForm(forms.Form):
# sacco = forms.CharField(label="Sacco", max_length=100)
regno = forms.... | 2.28125 | 2 |
terminal/test zips/outlab_3_boilerplate_files/q4.py | Phantom-Troupe-CS251/RedPlag | 0 | 12798736 | <gh_stars>0
class Node(object):
"""
Node contains two objects - a left and a right child, both may be a Node or both None,
latter representing a leaf
"""
def __init__(self, left=None, right=None):
super(Node, self).__init__()
self.left = left
self.right = right
def __str__(self):
"""
Default inorder pr... | 3.90625 | 4 |
emacs/formatting.py | jcaw/talon_conf | 9 | 12798737 | from typing import Optional
from talon import Context
from user.emacs.utils.voicemacs import rpc_call
from user.utils.formatting import SurroundingText
context = Context()
context.matches = r"""
tag: user.emacs
"""
@context.action_class("self")
class UserActions:
def surrounding_text() -> Optional[Surroundin... | 2.6875 | 3 |
tests/python-reference/scope/unboundlocal-augassign.py | jpolitz/lambda-py-paper | 25 | 12798738 | <gh_stars>10-100
# the variable in f() is lifted as a local and assigned
# unbound, because it is the left side of an assignment.
global_x = 1
def f():
global_x += 1
___assertRaises(UnboundLocalError, f)
| 3.078125 | 3 |
archive/hackerrank/nearby_attraction.py | tanchao/algo | 2 | 12798739 | <filename>archive/hackerrank/nearby_attraction.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'tanchao'
import sys
import math
PI = 3.14159265359
EARTH_RADIUS = 6371 # in km
TRANSPORTS = {
'metro': 20,
'bike': 15,
'foot': 5
}
'''
{'15': (52.357895, 4.892835), '14': (52.368832, 4.892744),... | 3.140625 | 3 |
config/settings/base.py | hussu010/Backend-1 | 1 | 12798740 | from decouple import config
import os
from datetime import timedelta
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '<KEY>
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG =... | 1.601563 | 2 |
my_lambdata/my_test.py | CurdtMillion/Lambdata-DSPT6 | 0 | 12798741 | <filename>my_lambdata/my_test.py
import unittest
from my_mod import enlarge, decimate
class TestMathFunctions(unittest.TestCase):
def test_enlarge(self):
self.assertEqual(enlarge(10), 1000)
def test_decimate(self):
self.assertEqual(decimate(100), 90)
if __name__ == '__main__':
unittest.... | 2.765625 | 3 |
kbc.py | JayPrakash916/KBC-CLI-Game | 1 | 12798742 | <gh_stars>1-10
# question_list=["1.who wrote the mahabharat?","2.what is the capital of India?","3.what is apples colour?","4.what is tree colour?","5.how many months there are in a year?","6.who is the computer invetor?","7.What was the of the first computer?","8.When was the search for a modern computer first?","9.w... | 2.6875 | 3 |
clumpy/__init__.py | bkimmig/clump | 0 | 12798743 | <filename>clumpy/__init__.py
__version__ = 1.0
from .em import *
from .functions_em import *
from .py3 import *
from .rotation import * | 1.179688 | 1 |
ztfin2p3/calibration/flat.py | MickaelRigault/ztfin2p3 | 0 | 12798744 | <filename>ztfin2p3/calibration/flat.py
""" library to build the ztfin2p3 pipeline screen flats """
import os
import numpy as np
import dask
import dask.array as da
import warnings
from astropy.io import fits
from ztfimg.base import _Image_, FocalPlane
LED_FILTER = {"zg":[2,3,4,5],
"zr":[7,8,9,10],
... | 2.5625 | 3 |
python/2020/day4/part1.py | CalebRoberts65101/AdventOfCode | 0 | 12798745 | <reponame>CalebRoberts65101/AdventOfCode
with open('python\\2020\day4\data.txt') as f:
all_text = f.read()
chuncks = all_text.split('\n\n')
# print(chuncks)
valid_count = 0
# for each chunck split and check if valid
for text in chuncks:
parts = text.split()
print(text)
print(parts)
parts_found =... | 3.53125 | 4 |
scripts/make_nvz.py | NON906/NVC_train | 0 | 12798746 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import zipfile
def make_nvz_main(output_file, nvm_file, target_file, pitch_file=None):
if pitch_file is not None:
files = [nvm_file, target_file, pitch_file]
arc_names = ['target.nvm', 'target.pb', 'pitch.pb']
else:
... | 2.84375 | 3 |
mutacc/cli/remove_command.py | northwestwitch/mutacc | 1 | 12798747 | import click
from mutacc.mutaccDB.remove_case import remove_case_from_db
@click.command('remove')
@click.argument('case_id')
@click.pass_context
def remove_command(context, case_id):
"""
Deletes case from mutacc DB
"""
adapter = context.obj['adapter']
remove_case_from_db(adapter, case_id)
| 2.09375 | 2 |
src/masonite/authentication/guards/__init__.py | cercos/masonite | 1,816 | 12798748 | <reponame>cercos/masonite
from .WebGuard import WebGuard
| 1.085938 | 1 |
Reversing/FullColor.py | LeanVel/Tools | 130 | 12798749 | # encoding: utf-8
# http://www.hexblog.com/?p=120
# Default IDA Pro Paths:
# MAC /Applications/IDA\ Pro\ X/idaq.app/Contents/MacOS/plugins/
# Windows C:\Program Files (x86)\IDA X\plugins
# to make it autoexec on openfile
# add this to plugins.cfg
# ; Other plugins
#FullColor FullColor.py 0... | 2.234375 | 2 |
random_sample.py | zimolzak/glacier-tools | 1 | 12798750 | import os
import random
import subprocess
MYPATH = './out-of-dropbox-2020-08to12-'
FILES = os.listdir(MYPATH)
INP = ''
while INP != 'q':
INP = input('q to quit, enter anything else to continue')
file_choice = random.choice(FILES)
pathname_choice = MYPATH + '/' + file_choice
subprocess.run(["open", path... | 2.6875 | 3 |