seq_id stringlengths 4 11 | text stringlengths 113 2.92M | repo_name stringlengths 4 125 ⌀ | sub_path stringlengths 3 214 | file_name stringlengths 3 160 | file_ext stringclasses 18
values | file_size_in_byte int64 113 2.92M | program_lang stringclasses 1
value | lang stringclasses 93
values | doc_type stringclasses 1
value | stars int64 0 179k ⌀ | dataset stringclasses 3
values | pt stringclasses 78
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
71000949458 | import time
def start(npc, player, town):
count = 0
exists = any(q for q in player.inventory if q.name.lower() == npc.quest.name.lower())
if exists:
for item in player.inventory:
if item.name.lower() == npc.quest.name.lower():
count += 1
if count == npc.quest.qu... | Taylor365/Python | DungeonHeroes/Functions/questing.py | questing.py | py | 2,232 | python | en | code | 0 | github-code | 13 |
16863712353 | from __future__ import division
from __future__ import print_function
from builtins import str
from past.utils import old_div
import sys
#import networkx as nx
if __name__=="__main__":
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-c','--correction',required=True)... | DovetailGenomics/HiRise_July2015_GR | scripts/apply_contiguity_correction.py | apply_contiguity_correction.py | py | 1,185 | python | en | code | 28 | github-code | 13 |
11071308543 | from PyQt5.QtWidgets import QAction, qApp, QMenu
from PyQt5.QtGui import QIcon, QFont
from FileAction.openFileAction import *
from FileAction.saveFileAction import *
from FileAction.saveAsFileAction import *
from FileAction.openFileSequenceAction import *
from ImageProcessingAction.ToolAction.lassoAction import *
# fro... | ChengLongDeng/MedicalImageProcessingTool | MainGUI/BarInformation/MenuBar.py | MenuBar.py | py | 6,619 | python | en | code | 0 | github-code | 13 |
37965072936 | import sys
import os
import jax
import tensorflow_datasets as tfds
import tensorflow as tf
import numpy as np
import jax.numpy as jnp
import optax
import wandb
import logging
from galsim_jax.dif_models import AutoencoderKLModule
from galsim_jax.utils import (
save_checkpoint,
load_checkpoint,
get_wandb_lo... | JonnyyTorres/Galsim_JAX | VAE_SD_C.py | VAE_SD_C.py | py | 15,814 | python | en | code | 1 | github-code | 13 |
8841104776 | from django.urls import path
from . import views
urlpatterns = [
path('',views.home, name='home'),
path('additem',views.additem, name='additem'),
path('edit/<str:pk>',views.edit, name='edit'),
path('crossoff/<str:pk>',views.crossoff, name='crossoff'),
path('uncrossoff/<str:pk>',views.uncrossoff, n... | EpicGL/ToDolist | todolist/urls.py | urls.py | py | 400 | python | en | code | 0 | github-code | 13 |
15568512225 | from tkinter import *
from tkinter import scrolledtext
from tkinter.filedialog import askopenfilename
from tkinter import messagebox
import os
import os.path
import sys
import Ice
import IceGrid
import time
from random import randrange
import vlc
Ice.loadSlice('Server.ice')
import Server
# Window instance
window =... | qanastek/DeepMusic | ICE/client.py | client.py | py | 8,264 | python | en | code | 1 | github-code | 13 |
41767420402 | class Solution:
def frequencySort(self, s: str) -> str:
freq = collections.Counter(s)
freq = sorted([(k,v) for k, v in freq.items()], key= lambda x : x[1], reverse=True)
ans = []
for s, f in freq:
ans = ans + [s]*f
... | ritwik-deshpande/LeetCode | 451-sort-characters-by-frequency/451-sort-characters-by-frequency.py | 451-sort-characters-by-frequency.py | py | 352 | python | en | code | 0 | github-code | 13 |
40492650831 | import unittest
import csv
import json
import os
from datetime import datetime
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions imp... | ParasVc98/ScriptyCrawler | instc.py | instc.py | py | 7,625 | python | en | code | 0 | github-code | 13 |
33556647326 | import boto3
import os
from PIL import Image
from io import BytesIO
# Please Note, Lambda Layers Need to Be Created for External Libraries
class ProcessThumbnail:
def __init__(self):
self.s3_client = boto3.client('s3')
self.bucket_name = os.environ['BUCKET_NAME']
self.thumbnai... | mohitverma158/image-thumbnail-generator | GenerateThumbnail.py | GenerateThumbnail.py | py | 3,251 | python | en | code | 0 | github-code | 13 |
6269580537 | import numpy as np
import cv2
from matplotlib import pyplot as plt
def getBitPlane(image,bit_plane):
img_bitplane = np.mod(np.floor(image/np.power(2, bit_plane)), 2)
return img_bitplane.astype('uint8')
imge_path='A1_resources/DIP_2019_A1/cameraman.png'
image = cv2.imread(imge_path,0)
plt.title("Original Ima... | ddurgaprasad/DIP | Assignment1/bitslicing.py | bitslicing.py | py | 1,972 | python | en | code | 0 | github-code | 13 |
26068897738 | def read():
return list(map(int, input().split()))
global d
n, d = read()
G = []
for i in range(int(n)):
G.append(read())
from math import sqrt
def get_distance(a, b):
return sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
def is_safe(vector):
if vector[0] + d >= 50 or vector[0] - d <= -50 or vector[1] ... | piglaker/PTA_ZJU_mooc | src16.py | src16.py | py | 1,286 | python | en | code | 0 | github-code | 13 |
73910579539 | import json
import os
import sys
import time
from pathlib import Path
import click
import yaml
from distutils.dir_util import copy_tree
from loguru import logger
from slugify import slugify
from dataherb.serve.mkdocs_templates import index_template as _index_template
from dataherb.serve.mkdocs_templates import site_c... | DataHerb/dataherb-python | dataherb/serve/save_mkdocs.py | save_mkdocs.py | py | 5,064 | python | en | code | 3 | github-code | 13 |
12881670384 | #!/bin/python3
import sys
from game import Person
import random
"""
def save_in_file():
"""
#def battle_options(options):
def battle_ground(character, enemy, levels):
counter_levels = 1
print(character[0], character[1])
print(enemy)
print("select your option")
options = input("insert (a) for a... | imorenoma/pst2020 | practica1/main.py | main.py | py | 4,077 | python | en | code | 0 | github-code | 13 |
18089566768 | import os
import sys
import numpy as np
import pandas as pd
from datetime import datetime
from socket import socket, AF_INET, SOCK_DGRAM, timeout, gethostname, gethostbyname
from time import sleep, time
from dotenv import load_dotenv
from paramiko import SSHClient, AutoAddPolicy
# Read connection values from .env
... | varrrro/container-metrics | response-time/benchmark.py | benchmark.py | py | 3,208 | python | en | code | 0 | github-code | 13 |
70352954578 | class letterCombos: #combination sum
# https://leetcode.com/problems/letter-combinations-of-a-phone-number/
def letterCombinations(self, digits: str) -> List[str]:
phone = {'2': ['a', 'b', 'c'],
'3': ['d', 'e', 'f'],
'4': ['g', 'h', 'i'],
... | eriktoor/interview-practice | kevinUber.py | kevinUber.py | py | 13,054 | python | en | code | 0 | github-code | 13 |
40726707824 | from dtaidistance import dtw
from scipy import stats
import numpy as np
import json
import os
import re
from natsort import natsorted
from dtaidistance import dtw_ndim
# 手勢密碼檢查
def pinch_check(sign, template_list):
PINCH_RANK = {
"index": 0.1,
"middle": 0.2,
"ring": 0.3,
"pinky": 0... | RainMeoCat/CipherAirSig | backend/app/gesturesign/sign_validate.py | sign_validate.py | py | 4,082 | python | en | code | 0 | github-code | 13 |
3348781226 | #!/uisr/bin/env python
#Tiago de Freitas Pereira <tiagofrepereira@gmail.com>
#Mon Dec 05 12:08:00 CEST 2013
import numpy
import bob
import os
import array
class FileLoader:
"""This class load features files from different formats"""
def __init__(self, dim=40):
self.dim = dim
def load_lists_from_databas... | tiagofrepereira2012/parallel_trainers | parallel_trainers/trainers/utils/file_loader.py | file_loader.py | py | 3,085 | python | en | code | 4 | github-code | 13 |
19147360954 | import os
os.environ["MUJOCO_GL"] = "egl"
# ruff: noqa: E402
from absl import app
from dm_control import suite
import dm_env_wrappers
import jax
import numpy as np
import optax
import reverb
import tensorflow as tf
import tensorflow_datasets as tfds
from baselines.drq_bc import drq_frame_stacking
from baselines.drq_... | ethanluoyc/corax | projects/baselines/baselines/drq_bc/main.py | main.py | py | 3,913 | python | en | code | 27 | github-code | 13 |
32252516305 | import sys
from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QPushButton,
QLabel, QGridLayout, QVBoxLayout, QHBoxLayout,
QMenu, QAction)
class MainUI(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
... | JungHeumYoo/Window-Calculator | Original.py | Original.py | py | 4,982 | python | ko | code | 0 | github-code | 13 |
72717293777 | import pandas
import re
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics import f1_score, precision_score, recall_score
from sklearn.model_selection import train_test_split
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
from nltk.tokenize... | AlexanDelimi/DecisionTheory | eyclidian.py | eyclidian.py | py | 4,762 | python | en | code | 0 | github-code | 13 |
26690083296 | # --------------------------------------------------
# Script de criação/atualização de BD, com dados do Zabbix
# Guilherme Braga, 2022
# https://github.com/gui1080/testes_PyZabbix_FISF3
# --------------------------------------------------
# dependências secundárias
import time
from datetime import datetime
import sys... | FSLobao/RF.Fusion | src/zabbix/automation/criaBD_Zabbix/main.py | main.py | py | 7,020 | python | pt | code | 0 | github-code | 13 |
11603465671 | #
# @lc app=leetcode.cn id=128 lang=python3
#
# [128] 最长连续序列
#
# @lc code=start
class Solution:
def longestConsecutive(self, nums: List[int]) -> int:
nums_set = set(nums)
max_curve = 0
for i in range(len(nums)):
cur_num = nums[i]
current_curve = 1
if cur... | RGBRYANT24/LeetCodePractice_PY | 128.最长连续序列.py | 128.最长连续序列.py | py | 578 | python | en | code | 0 | github-code | 13 |
19048264042 |
from PyQt4 import QtCore, QtGui
from tvInfo import seasonBuilder, episodeBuilder
from torrentSearch import torrentSearch
import sys
import time
import datetime
import webbrowser
import urllib
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding... | sobotadom/torrent | showSearch.py | showSearch.py | py | 11,784 | python | en | code | 0 | github-code | 13 |
34893289409 | import logging
from pyrogram import Client
from Config import Config
logging.basicConfig(level=logging.INFO)
plugins = dict(
root="plugins",
include=[
"forceSub",
"start"
]
)
pbot = Client(
'ForceSubscribeRobot',
bot_token = Config.BOT_TOKEN,
api_id = Config.APP_ID,
... | Bot-support/ForceSub-Bot | main.py | main.py | py | 387 | python | en | code | 0 | github-code | 13 |
24564528579 | from collections import namedtuple
import pygame
from pygame import USEREVENT
from pygame.locals import K_ESCAPE, KEYDOWN, KEYUP, K_UP, K_DOWN, \
K_w, K_s, QUIT
from menu_ui import MenuPause, MenuEnd
from ball import Ball
from field import Field, L_GOAL_LINE, R_GOAL_LINE
from slider import Slider, SLIDER_DIST... | kehlerr/airpong | battle.py | battle.py | py | 8,721 | python | en | code | 0 | github-code | 13 |
39148363578 | #!/bin/python3
#https://www.hackerrank.com/challenges/the-birthday-bar/problem
import sys
def solve(n, s, d, m):
count = 0
for i in range(n - m + 1):
sum = 0
for j in range(m):
sum = sum + s[i + j]
if sum == d:
count = count + 1
return count
n = int(input... | saumya-singh/CodeLab | HackerRank/Implementation/Birthday_Chocolate.py | Birthday_Chocolate.py | py | 477 | python | en | code | 0 | github-code | 13 |
16924724242 | from types import DynamicClassAttribute
import unittest
from selenium import webdriver
from pyunitreport import HTMLTestRunner
from selenium.webdriver.support.ui import Select
class RegisterNewUer(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome(executable_path = r'F:\John\Proyectos\Pyth... | JohnJNinoP/pythonbasic | Basic5/Selenium/test_select_lenguague.py | test_select_lenguague.py | py | 1,381 | python | en | code | 0 | github-code | 13 |
36594566455 | from time import sleep
board1 = [] #what player 2 would see
board2 = [] #what player 1 would see
for x in range(5):
board1.append(["O"] * 5) #creating the board
for x in range(5):
board2.append(["O"] * 5)
def print_board(board): #stylizing the board
for row in board:
print (" ".join(row))
... | csmidt95/pythonproj | Mbattleship2.py | Mbattleship2.py | py | 2,305 | python | en | code | 0 | github-code | 13 |
24167406575 |
import random
import pickle
from nltk.classify import ClassifierI
from statistics import mode
from nltk.tokenize import word_tokenize
class VoteClassifier(ClassifierI):
def __init__(self, *classifiers):
self._classifiers = classifiers
def classify(self, features):
print ("ho gya 3")
... | vpn1997/NLP | Projects in NLP/Twitter sentiment analysis/Sentiment_mod.py | Sentiment_mod.py | py | 2,640 | python | en | code | 4 | github-code | 13 |
32449572446 | # -*- coding: utf-8 -*-
import knack_tools as kt
import os
from datetime import date
name = "Get Schedules For Knack Import"
## Default textbox width is 60 characters.
## To keep text from wrapping, it's best to keep
## lines shorter than that.
description = \
"""
This is the same as "Get Schedules"... | geo3550/theknack | scripts/get_schedules_for_import.py | get_schedules_for_import.py | py | 6,073 | python | en | code | 0 | github-code | 13 |
5188601156 | from typing import Optional, Tuple, Sequence, Mapping, Callable
from mdp_rl_tabular import MDPForRLTabular
from TD_zero import TD0
from helper_func import S, SAf, get_rv_gen_func_single, get_expected_action_value, get_epsilon_greedy_action
class TD_control(TD0):
def __init__(
self,
mdp... | annie0808/cme241 | MP+MRP+MDP+RL/td_control.py | td_control.py | py | 2,706 | python | en | code | 1 | github-code | 13 |
23002251900 | number=int(input())
text=""
for x in range(number):
gap = " " * number
number -= 1
text=text+"*"
print(gap,text)
text=text+"*"
# ตัวอย่างของคนอื่น (บอกแล้ววิธีเขียนโปรแกรมมีหลายแบบ)
"""
number = int(input("กรอกตัวเลข : "))
print("จำนวน",number,"แถว")
for i in range(number):
print(" "*(number-i... | mrxtenten/CP3-Woravisudt-Rattanabenjapat | Exercise11_Woravisudt_R.py | Exercise11_Woravisudt_R.py | py | 617 | python | th | code | 0 | github-code | 13 |
14412218600 | # This file is part of Korman.
#
# Korman is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Korman is distributed i... | H-uru/korman | korman/properties/modifiers/base.py | base.py | py | 11,666 | python | en | code | 31 | github-code | 13 |
21092599387 | import requests
import sqlite3
from flask import jsonify
import shutil
#most popular
URL = "https://api.rawg.io/api/games?dates=2019-01-01,2019-12-31&ordering=-added" #page url
def getJson():
r = requests.get(url= URL) #get the json data from the website with an http requ... | MatteoAllemandi/School | TPSIT/RequestGameApi/api_clientRequest.py | api_clientRequest.py | py | 4,503 | python | en | code | 0 | github-code | 13 |
17057833604 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class PaymentSchedule(object):
def __init__(self):
self._date = None
self._repaid_interest_total = None
self._repaid_penalty_total = None
self._repaid_principal_total = ... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/PaymentSchedule.py | PaymentSchedule.py | py | 5,689 | python | en | code | 241 | github-code | 13 |
33568386288 | import boto3
import logging
import json
import io
import pandas as pd
from datetime import datetime
import pytz
bucket = "kmk-practice"
file_name = "KRX_holiday_calendar.csv"
s3 = boto3.client('s3')
obj = s3.get_object(Bucket= bucket, Key= file_name)
df = pd.read_csv(obj['Body'])
list = list(df['일자 및 요일'])
#print(l... | data04190/AWS_KRX_AutoCrawler | Lambda/EC2_AutoStart.py | EC2_AutoStart.py | py | 1,408 | python | en | code | 0 | github-code | 13 |
30918123073 | # import package:numpy、pandas
import numpy as np
import datetime
import sys
import random as rand
def semi_km(ori, label, label_data, label_2, max_iter):
attr_num = len(ori[0]) # number of attributes
tup_num = len(ori) # number of tuples
labeled_num = len(label_data) # number of labeled sampl... | zkxshg/Test_of_machine_learning | Cluster/Cluster_semi_k_means_path.py | Cluster_semi_k_means_path.py | py | 5,867 | python | en | code | 0 | github-code | 13 |
24268125556 | import tensorflow as tf
import numpy as np
from models.unsupervised.autoencoders import dense_encoder,dense_decoder
from models.supervised.applications import ConditioningLayer
import matplotlib.pyplot as plt
input_shape=(224,224,3)
latent_dim=15
class CVAE(tf.keras.Model):
def __init__(self,latent_dim,input_shap... | pmwaniki/perch-analysis | models/unsupervised/vae.py | vae.py | py | 10,330 | python | en | code | 0 | github-code | 13 |
37792705995 | # -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from functools import partial
from itertools import groupby
from odoo import api, fields, models, SUPERUSER_ID, _
from odoo.exceptions import AccessError, UserError, ValidationError, Warning
from odoo.tools.misc import formatLang, get_lang
from odoo.osv... | MattPedrosa/haque-13 | pakistan_wht/models/purchase_order.py | purchase_order.py | py | 6,664 | python | en | code | 0 | github-code | 13 |
31277851485 |
import logging
import db_api as db
from swapper import swap
import configparser
from telegram import KeyboardButton, ReplyKeyboardMarkup, Update
from telegram.ext import (
Application,
CommandHandler,
ContextTypes,
ConversationHandler,
MessageHandler,
filters,
)
logging.basicConfig(
forma... | maratsher/FaceSwapperBot | bot.py | bot.py | py | 3,737 | python | ru | code | 1 | github-code | 13 |
20082270452 | # TRS-80 MC-10 Micro Color Computer
# This code is part of the process to convert a .vb file to .wav 'cassette' file for the MC-10
# Step 1: C10Builder.py: Convert .vb code to .C10 format
# Step 2: C10ToWav.py: Convert .C10 code to .WAV format
# This file covers step 1
# Albert M Thalheim
# January 2021... | athalheim/TRS-80-MC-10 | vbToC10.py | vbToC10.py | py | 10,312 | python | en | code | 1 | github-code | 13 |
31070979639 | # -*- encoding: utf-8 -*-
"""
PyCharm main
2022年07月11日
by littlefean
"""
from typing import *
class Position:
__slots__ = ["x", "y"]
def __init__(self, x, y):
self.x = x
self.y = y
def main():
p = Position(1, 3)
p.__class__.__slots__.append("z")
p.__slots__.append("z")
p.z =... | Littlefean/SmartPython | 043 面向对象-slots/main.py | main.py | py | 386 | python | en | code | 173 | github-code | 13 |
12003406903 | import copy
import itertools
import sys
def run(program):
pc = 0
input = None
output = None
def parameter(index):
return program[pc + index] \
if program[pc] // (10 ** (index + 1)) % 10 \
else program[program[pc + index]]
while True:
opcode = program[pc] % ... | tkieft/adventofcode-2019 | day07/day07.py | day07.py | py | 2,111 | python | en | code | 0 | github-code | 13 |
24877563882 | import tweepy
name_list = []
save_to = open('name_list.txt', 'a')
# API keys that yous saved earlier (have to be a twitter dev)
api_key = "x"
api_secrets = "x"
access_token = "x"
access_secret = "x"
# Authenticate to Twitter
auth = tweepy.OAuthHandler(api_key,api_secrets)
auth.set_access_token(access_token,access_... | mfurkanatac/Botometer-Calc | follower_finder.py | follower_finder.py | py | 1,050 | python | en | code | 0 | github-code | 13 |
70427120657 | from solutions import BaseSolution
class Solution(BaseSolution):
input_file = '16.txt'
def __str__(self):
return 'Day 16: Permutation Promenade'
def _move(self, programs, m, i):
l = len(programs)
if m == 's':
r = int(i)
return programs[-r:] + programs[:l -... | madr/julkalendern | 2017-python/solutions/day_16.py | day_16.py | py | 1,635 | python | en | code | 3 | github-code | 13 |
42638229896 | from __future__ import print_function, division, absolute_import
from threading import Thread
import scipy.ndimage
import numpy as np
from torch.multiprocessing import Pool, Process
import pdb
import os
import torch
def worker_distance_transform(args):
bid = args[0]
image = args[1]
return_indices = args[2... | nileshkulkarni/acsm | acsm/nnutils/signed_distance.py | signed_distance.py | py | 1,780 | python | en | code | 64 | github-code | 13 |
73853359696 | import requests
def get_intelligence(hero_name):
token = "2619421814940190"
request_one = f"https://www.superheroapi.com/api.php/{token}/search/{hero_name}"
resp = requests.get(request_one)
if resp.status_code != 200 or resp.headers['content-type'] != "application/json":
return None
d = ... | mariabimatova/home-work | request/request_hw_task1.py | request_hw_task1.py | py | 993 | python | en | code | 0 | github-code | 13 |
13612282540 | class Solution(object):
def minWindow(self, s, t):
count = collections.defaultdict(int)
for c in t:
count[c] += 1
total_cnt = len(t)
min_len = len(s) + 1
start_idx = res_idx = idx = 0
while True:
if idx >= len(s):
break
... | clovery410/mycode | interview_qa/snapchat/76minimum_window_substring.py | 76minimum_window_substring.py | py | 961 | python | en | code | 1 | github-code | 13 |
37621969000 | #!/usr/bin/env python
# -*- coding: utf8 -*-
from gimpfu import *
def mattefade( img, draw, useColor, colorScheme, orientation, flipColors, colorOpacity, colorOffset, overExposure, oeAmount, addVignette, sharpAmount):
current_f=pdb.gimp_context_get_foreground()
current_b=pdb.gimp_context_get_background()
#clean... | Nikkinoodl/Matte-Fade | gimp_matte_fade.py | gimp_matte_fade.py | py | 7,010 | python | en | code | 1 | github-code | 13 |
24634439184 | import torchaudio
import os
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
from scipy import signal
import multiprocessing
import pandas as pd
from paths import *
from preproc_mfccTransform import MFCCTransform
from misc_progress_bar import draw_progress_bar
transformer = MFCCTransform()
def pro... | Frankalexej/featln | preproc_wav2mfcc_multiprocessing.py | preproc_wav2mfcc_multiprocessing.py | py | 2,091 | python | en | code | 0 | github-code | 13 |
38271380643 | #!/usr/bin/env python
# coding: utf-8
import plotly as py
# import plotly.express as px
import plotly.graph_objs as go
import plotly.io as pio
import pandas as pd
pio.templates.default = "plotly_white"
pylt = py.offline.plot
def weekly_and_monthly(file_path, sheet_names, view_path):
data1_1 = pd.read_... | zystudent/zystudent | DWH_BI/view_first_half.py | view_first_half.py | py | 4,153 | python | en | code | 0 | github-code | 13 |
34346159442 | import asyncio
import logging
import ssl
import time
from collections import ChainMap
from time import monotonic
from types import MappingProxyType
from typing import (
Any,
AnyStr,
Dict,
List,
Mapping,
Optional,
Sequence,
Tuple,
Type,
Union,
)
from async_timeout import timeout ... | DriverX/aioredis-cluster | src/aioredis_cluster/cluster.py | cluster.py | py | 29,490 | python | en | code | 24 | github-code | 13 |
29222301431 | import dataclasses
import logging
from typing import TYPE_CHECKING
import algosdk.transaction
from algosdk.account import address_from_private_key
from algosdk.atomic_transaction_composer import AccountTransactionSigner
from algosdk.transaction import AssetTransferTxn, PaymentTxn, SuggestedParams
from algokit_utils.m... | algorandfoundation/algokit-utils-py | src/algokit_utils/_transfer.py | _transfer.py | py | 5,947 | python | en | code | 4 | github-code | 13 |
40104755522 | """The module wallet.accounting.balance_sheet test the BalanceSheet implementation."""
from datetime import datetime
from zeppelin_cash.accounting.america import usd
from zeppelin_cash.accounting.balance_sheet import BalanceSheet
from zeppelin_cash.accounting.money import Money
def test_balance_sheet_init() -> None:... | GeorgeSaussy/zeplin_cash | src/zeppelin_cash/accounting/balance_sheet_test.py | balance_sheet_test.py | py | 4,319 | python | en | code | 0 | github-code | 13 |
4512128210 | #
# @lc app=leetcode.cn id=84 lang=python
#
# [84] 柱状图中最大的矩形
#
# https://leetcode-cn.com/problems/largest-rectangle-in-histogram/description/
#
# algorithms
# Hard (42.74%)
# Likes: 1213
# Dislikes: 0
# Total Accepted: 126.1K
# Total Submissions: 294.1K
# Testcase Example: '[2,1,5,6,2,3]'
#
# 给定 n 个非负整数,用来表示柱状图中... | lagoueduCol/Algorithm-Dryad | 16.Rectangle/84.柱状图中最大的矩形.dq.py | 84.柱状图中最大的矩形.dq.py | py | 2,250 | python | zh | code | 134 | github-code | 13 |
74174163539 | import socket
import numpy as np
socketUDP = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
transmissor = ("127.0.0.1", 2020)
receptor = ("127.0.0.1", 3030)
socketUDP.bind(receptor)
buff_size = 10000
sequence = 0
def rdt_rcv():
while True:
message, source = socketUDP.recvfrom(buff_size)
if sou... | gabrigabe/pythonredes | receiver.py | receiver.py | py | 1,207 | python | en | code | 0 | github-code | 13 |
31235876639 | def homework_4(Str): # 请同学记得把档案名称改成自己的学号(ex.1104813.py)
if len(Str) < 100:
if len(Str)<2: #若字串长度小于2(即字串中只有一个字或没有字)则符合回文条件
return True
if Str[0]!=Str[-1]: #检查字串头尾是否相同
return False
else:
return homework_4(Str[1:-1]) #若字串头尾相同,则删除头尾再执行一次function
else:... | daniel880423/Member_System | file/hw4/1100415/hw4_s1100415_3.py | hw4_s1100415_3.py | py | 740 | python | zh | code | 0 | github-code | 13 |
29825019954 | import copy
import math
import os
import pickle
import random
import re
import time
import zipfile
import requests
import torch
import unicodedata
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import matplotlib.ticker as ticker
import numpy as np
def download_dataset(url, save_file_name, save_folder):
... | anthony-chukwuemeka-nwachukwu/Translation | preprocess.py | preprocess.py | py | 11,717 | python | en | code | 0 | github-code | 13 |
70527727057 | import re, string, unicodedata
import nltk
import contractions
import inflect
from bs4 import BeautifulSoup
from nltk import word_tokenize, sent_tokenize
from nltk.corpus import stopwords
from Sastrawi.Stemmer.StemmerFactory import StemmerFactory
def strip_html(text):
soup = BeautifulSoup(text, "html.parser")
... | Yuriowindiatmoko2401/tugas-text-analytics-1 | preprocessing.py | preprocessing.py | py | 2,212 | python | en | code | 0 | github-code | 13 |
21051238045 | T = int(input())
coin_types = [50000, 10000, 5000, 1000, 500, 100, 50, 10]
for t in range(1, T+1):
n = int(input())
result = []
for coin in coin_types:
result.append(n//coin)
n %= coin
print(f'#{t}')
for i in result:
print(i, end=' ')
print()
| jinho9610/py_algo | sw_academy/1970.py | 1970.py | py | 293 | python | en | code | 0 | github-code | 13 |
8452969954 | from z3 import *
def display(board):
for i in range(len(board)):
print(board[i])
def intialize():
n = int(input("Please input an int: "))
board = []
for i in range(n):
temp = []
for x in range(n):
temp.append(0)
board.append(temp)
return board
def ma... | GreyLight02/CSE-260-Project | Main.py | Main.py | py | 520 | python | en | code | 0 | github-code | 13 |
17051536314 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.InsPeriodDTO import InsPeriodDTO
from alipay.aop.api.domain.EcomLogisticsOrderDTO import EcomLogisticsOrderDTO
from alipay.aop.api.domain.PayOrderDTO import PayOrderDTO
from alipay.... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/EcomOrderDTO.py | EcomOrderDTO.py | py | 16,934 | python | en | code | 241 | github-code | 13 |
23152453435 | # -*- coding: utf-8 -*-
"""
Averages the results per fold over all folds and stores them in a new csv file.
Created on Tue Feb 2 10:29:48 2021
@author: lbechberger
"""
import argparse
from code.util import read_csv_results_files, write_csv_results_file
parser = argparse.ArgumentParser(description='Average fold res... | lbechberger/LearningPsychologicalSpaces | code/ml/regression/average_folds.py | average_folds.py | py | 788 | python | en | code | 10 | github-code | 13 |
41745841225 | import pandas as pd
pd.set_option("display.max_columns", 500)
pd.set_option("display.expand_frame_repr", False)
import matplotlib.pyplot as plt
import numpy as np
import sys
import os
from scipy.stats import gaussian_kde
sys.path.insert(1, os.path.abspath("../ionsrcopt"))
import load_data as ld
from source_features ... | mihailescum/ionsrcopt | visualization/cluster_distributions.py | cluster_distributions.py | py | 5,185 | python | en | code | 0 | github-code | 13 |
9771088976 | class Solution:
def hIndex(self, citations: List[int]) -> int:
n= len(citations)
left = 0
right = n - 1
maximum = float(-inf)
while left <= right:
mid = (right - left)//2 + left
if citations[mid] <= n - mid:
... | Matiyas1994/A2svcompitative-Programming | Camp Progress sheet/275. H-Index II.py | 275. H-Index II.py | py | 511 | python | en | code | 2 | github-code | 13 |
33251891840 | #tarjan 算法
#https://blog.csdn.net/jeryjeryjery/article/details/52829142?locationNum=4&fps=1
#求任意顶点开始的联通图 有且仅存在一个 且dfn[u] == low[u]
from collections import OrderedDict
matric = [[0,1,1,0,0,0],[0,0,0,1,0,0],[0,0,0,1,1,0],[1,0,0,0,0,1],[0,0,0,0,0,1],[0,0,0,0,0,0]]
dfn = OrderedDict()
low = OrderedDict()
flag = dict()
coun... | donydex/Saasi-dony | 3.tarjan.py | 3.tarjan.py | py | 1,677 | python | en | code | 0 | github-code | 13 |
2354729301 | from itertools import chain
import numpy as np
import Markov_Chain
def stationery_distribution_convergence(Q, nsim):
chain = Markov_Chain.Markov_Chain(Q)
for n in range(nsim):
n = 10**(n+1)
stat_dist = chain.simulate(n)
print("After {} runs the stationary distrubution has converged to: ... | Scolpe/Stat-ML | Markov_Chain/Presentations.py | Presentations.py | py | 770 | python | en | code | 0 | github-code | 13 |
39829638470 | from rest_framework import serializers
from restaurants.models import MenuItem, Restaurant
from restaurants.serializers import RestaurantSerializer
class MenuItemSerializer(serializers.ModelSerializer):
restaurant = serializers.SlugRelatedField(
slug_field='name',
queryset=Restaurant.objects.all()... | brightmorkli37/food_delivery | restaurants/serializers/menu_item_serializer.py | menu_item_serializer.py | py | 516 | python | en | code | 0 | github-code | 13 |
27187996913 | from collections import deque
import sys
input = sys.stdin.readline
def bfs(start):
global cnt
global check
queue = deque([start])
tmp_cnt = 1
population = arr[start[0]][start[1]]
visited[start[0]][start[1]] = cnt + 1
di, dj = [0, 1, 0, -1], [1, 0, -1, 0]
while queue... | Nam4o/Algorithm | 백준/Gold/16234. 인구 이동/인구 이동.py | 인구 이동.py | py | 1,856 | python | en | code | 1 | github-code | 13 |
22102595042 | import os
import numpy as np
import torch
from torch import nn
from torch import optim
from torch.optim.lr_scheduler import CosineAnnealingWarmRestarts, CosineAnnealingLR, LinearLR
from torch.utils.data import DataLoader
from torchvision import transforms, datasets
from torch.utils.tensorboard import SummaryWri... | Jlevan25/resnet | executors/experiment_2.py | experiment_2.py | py | 5,190 | python | en | code | 0 | github-code | 13 |
35128492329 | # github python link - https://github.com/mission-peace/interview/blob/master/python/geometry/skylinedrawing.py
# tushar roy video - https://www.youtube.com/watch?v=GSBLe8cKu0s&t=867s&ab_channel=TusharRoy-CodingMadeSimple
# build list of object to store points in sorted order according to (point, height, is_start)
# s... | aakanksha-j/LeetCode | 218. The Skyline Problem/nlogn_using_priority_queue_1.py | nlogn_using_priority_queue_1.py | py | 3,019 | python | en | code | 0 | github-code | 13 |
26617611902 | import argparse
if __name__ == '__main__':
# argument parsing to grab input file
parser = argparse.ArgumentParser(description="Process a list of binary numbers for diagnostic report")
required = parser.add_argument_group("required arguments")
required.add_argument("-i", "--input_file", help="path to th... | gmurr20/advent_of_code_2021 | day3/day3_p1.py | day3_p1.py | py | 1,488 | python | en | code | 0 | github-code | 13 |
32873672373 | # Parts of code inspired from SuperPoint[https://github.com/rpautrat/SuperPoint]
import cv2
import numpy as np
import torch
from numpy.random import uniform
from scipy.stats import truncnorm
from superpoint.data.data_utils.config_update import dict_update
from superpoint.data.data_utils.kp_utils import filter_points, ... | AliYoussef97/SuperPoint-NeRF-Pytorch | superpoint/superpoint/data/data_utils/homographic_augmentation.py | homographic_augmentation.py | py | 6,993 | python | en | code | 5 | github-code | 13 |
398709141 | from django.urls import path
from familia import views
urlpatterns = [
path('', views.inicio2, name='inicio2'),
path('verfamilia/', views.verfamilia, name='verfamilia'),
path('vermascota/', views.vermascota, name='vermascota'),
path('cargarpersona/', views.cargar_persona, name='cargar_persona'),
pa... | rmc-git/Entrega1Carcer | entregablemvt/familia/urls.py | urls.py | py | 534 | python | es | code | 0 | github-code | 13 |
3647406109 | from twython import TwythonStreamer
from twython import TwythonError
from twython import TwythonRateLimitError
from twython import TwythonAuthError
from time import sleep
from .config import db
from credentials import app_key
from credentials import app_secret
from credentials import auth_token
from credentials import... | taylorrees/penemue | penemue/utils/monitor_tweets.py | monitor_tweets.py | py | 2,157 | python | en | code | 2 | github-code | 13 |
25112971269 | import calendar as pycal
from datetime import datetime
from dateutil.relativedelta import relativedelta
from flaskr.python_helpers import cal_helpers as chs
cal = pycal.Calendar(6)
current_date = datetime.today()
day = current_date.day
month = current_date.month
year = current_date.year
week, index = chs.get_week()... | npaolini-8/CalendarPlusPlus_public | flaskr/python_helpers/week_functions.py | week_functions.py | py | 4,190 | python | en | code | 0 | github-code | 13 |
72704226897 | # -*- coding: utf8 -*-
import os
from time import *
import subprocess
import re
import json
from collections import Counter
import mysql.connector
BITCOIND_PATH = '/home/abrochec/blockchain/bitcoin-0.16.1'
cnx =mysql.connector.connect(user='root',password='Alexis2018!',host='localhost',database='miners') #10... | alexisbrochec/blockchain | newgraph.py | newgraph.py | py | 6,954 | python | en | code | 0 | github-code | 13 |
35827838529 | #!/usr/bin/env python3
def string_to_list(line: str) -> list:
arr = []
for letter in line:
if letter == '\n':
continue
arr.append(int(letter))
return arr
def sum_matching_digits(array: list) -> int:
sum = 0
previous = array[0]
for idx in range(1, len(array)):
... | KyleSpicer/advent_of_code | 2017/day1/day1.py | day1.py | py | 1,570 | python | en | code | 0 | github-code | 13 |
16239393031 | import jetson.inference # NVIDIA module for object detection
import jetson.utils # NVIDIA module for camera capture
import sys # to call functions
net= jetson.inference.detectNet("SSD-Mobilenet-v2", threshold=0.5) # load the object ... | priyankasaini24/Object_detection_on_road_with_driver_monitoring | objects_detection.py | objects_detection.py | py | 1,349 | python | en | code | 0 | github-code | 13 |
10269887416 | import tensorflow as tf
def repeat_end(val, n, k):
return [val for i in range(n)] + [k]
def reduce_with(vec, sizes, fn, final_shape):
n_groups = tf.shape(sizes)[0]
start_array = tf.TensorArray(dtype=tf.float32, size=n_groups, infer_shape=False).split(value=vec, lengths=sizes)
end_array = tf.TensorAr... | dselsam/neurosat | python/util.py | util.py | py | 1,911 | python | en | code | 253 | github-code | 13 |
71314195857 | import numpy as np
from collections import Counter, defaultdict
from minimize import minimize
import scipy as sp
import copy
import hashlib
class memoize(object):
def __init__(self, func):
self.func = func
self.lu = {}
def __call__(self, *args):
try:
ha = hash(args)
... | kastnerkyle/pachet_experiments | maxent.py | maxent.py | py | 10,813 | python | en | code | 17 | github-code | 13 |
24147360884 | guests = ['Петя', 'Ваня', 'Саша', 'Лиза', 'Катя']
all_guests = 5
answer = ""
while answer != "пора спать":
print(f"Сейчас на вечеринке {all_guests} человек. {guests}")
answer = input("Гость пришел или ушел: ")
if answer == "пришел":
name = input("Имя гостя: ")
if all_guests >= 6:
... | ilnrzakirov/Python_basic | Module16/04_party/main.py | main.py | py | 896 | python | ru | code | 0 | github-code | 13 |
13539090247 | from odoo import models, fields
class StudentRecord(models.Model):
_name = "student.student"
name = fields.Char(string='Name', required=True)
middle_name = fields.Char(string='Middle Name', required=True)
last_name = fields.Char(string='Last Name', required=True)
photo = fields.Binary(string='Photo... | Raju-dev/smart-hemp | raju/models.py | models.py | py | 8,998 | python | en | code | 0 | github-code | 13 |
38024554208 | from AthenaCommon import CfgMgr
from AthenaCommon.Constants import * # FATAL,ERROR etc.
from AthenaCommon.SystemOfUnits import *
def getParticleBrokerSvcNoOrdering(name="ISF_ParticleBrokerSvcNoOrdering", **kwargs):
kwargs.setdefault('EntryLayerTool', 'ISF_EntryLayerTool')
kwargs.setdefault('GeoIDSvc', 'ISF_... | rushioda/PIXELVALID_athena | athena/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfig.py | ISF_ServicesConfig.py | py | 11,722 | python | en | code | 1 | github-code | 13 |
70292793618 | from abc import abstractmethod
class PrintEdition:
def __init__(self,title ='', format = '',pages = 0):
self.__title = title
self.__format = format
self.__pages = pages
def print(self):
print(f'Название: {self.__title}\nФормат: {self.__format}\nКоличество страниц: ... | speedevil123/python_labs | labs_python/lab_13/13lab.py | 13lab.py | py | 6,682 | python | en | code | 0 | github-code | 13 |
15726100490 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
#请将组员名单详列如下,并将范例说明用的“王大锤”及其学号取代为你的组员。若你的组员超过三人,请自行加上。
crewDICT = {1: {"姓名": "林容与",
"学号": "B05505006"},
2: {"姓名":"冯美玲",
"学号":"B05505041"},
3: {"姓名":"陈怡瑄",
"学号":"B05505046"},
}
# 第一题:请利用 wa... | PeterWolf-tw/ESOE-CS101-2016 | homework04_group1.py | homework04_group1.py | py | 2,892 | python | zh | code | 15 | github-code | 13 |
39841420756 | import sys
from collections.abc import Mapping
from typing import Any, Optional
import pymaid
from . import __version__
from .constants import DATA_DIR
if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib
def get_data_dir(dname=__version__):
return DATA_DIR / "output/raw" / dnam... | clbarnes/catmaid_publish | src/catmaid_publish/io_helpers.py | io_helpers.py | py | 2,265 | python | en | code | 0 | github-code | 13 |
70956257938 | from PyQt5.QtWidgets import QWidget, QVBoxLayout
from PyQt5.QtCore import Qt
from services.WindowService import WindowService
from widgets.Map.MapMode import MapMode
from widgets.Map.Createbox.TableList import TableList
class CreateboxWidget(QWidget):
def __init__(self, parent=None):
super(CreateboxWidge... | GeorgeHulpoi/piu-restaurant-management | widgets/Map/Createbox/CreateboxWidget.py | CreateboxWidget.py | py | 1,256 | python | en | code | 0 | github-code | 13 |
70953487378 | import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import copy
dataset = np.loadtxt("one.csv", delimiter=",")
# split into input (X) and output (Y) variables
X = dataset[:,1:27]
Y = dataset[:,0]-624
Y = Y.astype(int)
s = X.shape
for i in rang... | gauravshelangia/MTarget_Server | contour plots /interpolate.py | interpolate.py | py | 2,213 | python | en | code | 1 | github-code | 13 |
73708422736 | import os
import shutil
import traceback
from abc import abstractmethod
from typing import Dict, List, Optional, Tuple
from keras_preprocessing.image import save_img
from src.datasets.abstract_dataset import AbstractDataset
from src.datasets.dataset_path_creator import DatasetPathCreator
ImageLabel = Dict[str, str]
... | thearod5/calorie-predictor | src/preprocessing/base_processor.py | base_processor.py | py | 6,933 | python | en | code | 1 | github-code | 13 |
6948619834 | from typing import *
import math
class Solution:
def visiblePoints(self, points: List[List[int]], angle: int, location: List[int]) -> int:
angles = []
cnt = 0
for point in points:
if point[0] == location[0] and point[1] == location[1]:
cnt += 1
c... | Xiaoctw/LeetCode1_python | 数学/可见点的最大数目_1610.py | 可见点的最大数目_1610.py | py | 926 | python | en | code | 0 | github-code | 13 |
46397372994 | import base64
import hashlib
import os
import logging
import select
import socket
import struct
import sys
import threading
import time
from aiy.vision.streaming.presence import PresenceServer
import aiy.vision.streaming.proto.messages_pb2 as pb2
from http.server import BaseHTTPRequestHandler
from io import BytesIO
f... | abnerjacobsen/Smart_Office | WaitingRoomAPI/aiy/vision/streaming/server.py | server.py | py | 24,279 | python | en | code | 1 | github-code | 13 |
5719521172 | from __future__ import annotations
import pytest
from aiohttp import BasicAuth
from aioresponses import CallbackResult
from aioresponses import aioresponses
from tests import normalize_item
from vdirsyncer.exceptions import UserError
from vdirsyncer.storage.http import HttpStorage
from vdirsyncer.storage.http import ... | pimutils/vdirsyncer | tests/storage/test_http.py | test_http.py | py | 4,094 | python | en | code | 1,382 | github-code | 13 |
36907268197 | import itertools
# Polygonal Numbers
def P(k, n):
if k == 3:
return (n*(n+1)) // 2 # Triangle
elif k == 4:
return n*n # Square
elif k == 5:
return (n*(3*n-1)) // 2 # Pentagonal
elif k == 6:
return n*(2*n-1) # Hexagonal
elif k == ... | ekeilty17/Project_Euler | P061.py | P061.py | py | 4,601 | python | en | code | 1 | github-code | 13 |
40336550035 | import tensorflow as tf
import os
class Summarizer_eager:
def __init__(self, config):
self.config = config
self.summary_placeholders = {}
self.summary_ops = {}
self.train_summary_writer = tf.summary.create_file_writer(
os.path.join(self.config.log.summary_dir, "train")
... | yigitozgumus/Polimi_Thesis | utils/summarizer_eager.py | summarizer_eager.py | py | 468 | python | en | code | 5 | github-code | 13 |
41645536415 | #!/usr/bin/env python3
import sys
import string
def react_polymer(polymer):
lst = list(polymer)
reaction_occured = True
while reaction_occured:
reaction_occured = False
char = 0
while char < len(lst) - 1:
if abs(ord(lst[char]) - ord(lst[char+1])) == 32:
... | billyoverton/advent2018 | day5/puzzle2.py | puzzle2.py | py | 1,275 | python | en | code | 0 | github-code | 13 |
36588683426 | class Solution:
def removeCoveredIntervals(self, intervals: List[List[int]]) -> int:
intervals.sort(key = lambda x: (x[0], -x[1]))
merge = 0
max_right = 0
for cur in intervals:
if cur[1] <= max_right:
merge += 1
else:
max_right ... | ysonggit/leetcode_python | 1288_RemoveCoveredIntervals.py | 1288_RemoveCoveredIntervals.py | py | 364 | python | en | code | 1 | github-code | 13 |
6692109502 | # Напишите программу, которая найдёт произведение пар чисел списка.
# Парой считаем первый и последний элемент, второй и предпоследний и т.д.
# Пример:
# - [2, 3, 4, 5, 6] => [12, 15, 16];
# - [2, 3, 5, 6] => [12, 15]
a = [2, 3, 4, 5, 6]
b = len(a) / 2
if type(b) == float:
b += 0.5
b = int(b)
print(b)
c = ... | Rrider11/python2 | task3.2.py | task3.2.py | py | 623 | python | ru | code | 0 | github-code | 13 |
38275082175 | from telegram_bot import *
import urllib.request
import urllib.parse
import ssl
import bs4
import datetime
def check_saleinfo_and_send_alarm(bot):
url = 'https://quasarzone.co.kr/bbs/qb_saleinfo'
prefix = 'https://quasarzone.co.kr'
with urllib.request.urlopen(url, context=CONTEXT) as response... | shinners1/quasarzone-saleinfo-bot | check_saleinfo_board.py | check_saleinfo_board.py | py | 2,919 | python | en | code | 0 | github-code | 13 |
73565975696 | MANUAL_SEED = 1773
NUM_LOCAL_EPOCHS = 10
NUMBER_OF_ROUNDS = 10
BATCH_SIZE = 5
ALPHA_COEF = 0.01
DC_ROUND = 1
AGG_ROUND = 10
NUMBER_FOLDS = 5
NUMBER_CLIENTS = NUMBER_FOLDS - 1
PERCENTAGE_PERTURBED_SAMPLES = 22
NUMBER_REPLICAS = 5
ALGORITHM = None
LR = 0.1
OPTIM = "sgd"
GLOBAL_RUN_NAME = 'replicas_distribution'
RUN... | basiralab/RepFL | constants.py | constants.py | py | 910 | python | en | code | 0 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.