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
292830537
class ListNode(object): def __init__(self, x): self.val = x self.next = None ####runner, no buffer but O(N^2) time def deleteDuplicates1(head): if not head: return head cur = head while cur: runner = cur while runner.next: if cur.val...
shaniavina/Cracking-the-Coding-Interview_python
remove_dups.py
remove_dups.py
py
1,060
python
en
code
0
github-code
90
6562507686
from django.http import JsonResponse from django.views.decorators.csrf import csrf_exempt from score.models import Score def get_score(request, pk): try: data = Score.objects.get(user=pk) r = {'success': True, 'id': data.user.pk, 'score': data.score} except Score.DoesNotExist: r = {'s...
juwaini/pacer
score/views.py
views.py
py
1,231
python
en
code
0
github-code
90
1399130545
import os import tensorflow as tf from tensorflow import keras import warnings import numpy as np import cv2 from sklearn import metrics import numpy as np from keras.models import Sequential from keras.layers import LSTM, Input, Dropout from keras.layers import Dense from keras.layers import RepeatVecto...
fromwaseem/mmWave
Python/002-auto_encoder/gestures_classification_autoencoder.py
gestures_classification_autoencoder.py
py
6,773
python
en
code
0
github-code
90
43042358873
import discord from random import randint, shuffle from scenes import scenes, images from discord.ext import commands import config bot = commands.Bot(command_prefix=config.prefix) players_list = [] gameinfo = {"started":False, "map":None, 'spy':None} @bot.command() async def ping(ctx): await ctx.send('Pong! {0...
LeonardoSola/SpyFall-discord
index.py
index.py
py
3,432
python
en
code
1
github-code
90
9972254848
import os import streamlit as st import pandas as pd import matplotlib.pyplot as plt import matplotlib matplotlib.use('Agg') import seaborn as sns def main(): """ Machine Learning Dataset Explorer""" st.title("Machine Learning Dataset Explorer") st.subheader("Simple Data Science Explorer with St...
GabrielaDS11/Domotica-Assistiva
Streamlit/data_explorer.py
data_explorer.py
py
4,670
python
en
code
0
github-code
90
70508400618
import pickle import socket HOST = '127.0.0.1' PORT = 65433 def run_receiver(): with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.bind((HOST, PORT)) s.listen() conn, addr = s.accept() with conn: data = conn.recv(2**20) return pickle.loads(data)...
Inexpediency/itmo-pt-assignments
04-files/practice/transfer/transfer_object.py
transfer_object.py
py
475
python
en
code
1
github-code
90
29327657424
import json import sys from math import sqrt def load_data(file_path): with open(file_path, 'r', encoding='utf-8') as open_file: return json.load(open_file) def get_biggest_bar(bars): biggest_bar = max( bars, key=lambda bar: bar['properties']['Attributes']['SeatsCount'], ) re...
AlekseyLeskin/3_bars
bars.py
bars.py
py
2,190
python
en
code
null
github-code
90
18527183839
def main(): N, C = (int(i) for i in input().split()) D = [[int(i) for i in input().split()] for j in range(C)] c = [[int(i) for i in input().split()] for j in range(N)] base = [[((i+1)+(j+1)) % 3 for j in range(N)] for i in range(N)] d = [{i: 0 for i in range(1, C + 1)} for j in range(3)] for i ...
Aasthaengg/IBMdataset
Python_codes/p03330/s668850972.py
s668850972.py
py
783
python
en
code
0
github-code
90
18069227479
n,m = map(int,input().split()) x_li = [0]*m y_li = [0]*m for i in range(m): x_li[i],y_li[i]=map(int,input().split()) map_li = [1]*n red = [False]*n red[0]=True for i in range(m): x,y = x_li[i],y_li[i] x,y = x-1,y-1 if red[x] and map_li[x]>1: red[y]=True elif red[x]: red[y]=True ...
Aasthaengg/IBMdataset
Python_codes/p04034/s264615963.py
s264615963.py
py
402
python
en
code
0
github-code
90
6127722990
import numpy as np import sys def load_binary_data(filename, dtype=np.float32): """ We assume that the data was written with write_binary_data() (little endian). """ f = open(filename, "rb") data = f.read() f.close() _data = np.frombuffer(data, dtype) if sys.byteorder == 'big':...
tyler-a-cox/cross-correlation
twentyonecmFAST.py
twentyonecmFAST.py
py
5,608
python
en
code
0
github-code
90
18289121529
from collections import deque from copy import deepcopy h,w = map(int,input().split()) s = [list(input()) for i in range(h)] t = ((0,1),(1,0),(-1,0),(0,-1)) m = 0 for sy in range(h): for sx in range(w): if s[sy][sx] == "#": continue ss = deepcopy(s) ss[sy][sx] = "#" q = ...
Aasthaengg/IBMdataset
Python_codes/p02803/s665606996.py
s665606996.py
py
787
python
en
code
0
github-code
90
22666407738
""" Fichier contenant tout le code relatif à la gestion de base de données. ************** Sauf mention contraire, tout le code écrit dans ce fichier à été écrit par Romain Gascoin. """ import random import sqlite3 # Création de la connection à la base de données conn = sqlite3.connect("locale/sudoku.db") c = conn....
GuilianCD/nsi-sudoku
database.py
database.py
py
5,844
python
fr
code
1
github-code
90
4364269282
#!/usr/bin/env python # coding: utf-8 # In[1]: import torch from transformers import BertTokenizer def precition(text): PRETRAINED_MODEL_NAME = "bert-base-cased" # 指定繁簡中文 BERT-BASE 預訓練模型 # 取得此預訓練模型所使用的 tokenizer tokenizer = BertTokenizer.from_pretrained(PRETRAINED_MODEL_NAME) vocab = tokenizer.vocab tokens ...
qwe8989785/Nkust_EnglishProject
EPWeb/index/code/bertTest.py
bertTest.py
py
1,563
python
en
code
0
github-code
90
41613067651
__author__ = 'anthonymace' import datetime def get_hours_from_each_day(): hours_list = [] for week in range(1, 3): number_of_days = int(input("How many days did you work week {}? ".format(week))) week_hours = [] for day in range(1, number_of_days + 1): hours = input("Enter...
amaceing/PythonProjects
HourTracker/HourTracker.py
HourTracker.py
py
2,377
python
en
code
0
github-code
90
2758812718
# В этом файле пишется функция from database import * from view import * def main(): while True: num = input_num() if num == 1: res = input_name() write_name(res) print("Успешно записано\n") if num == 2: char = input_char() search...
CeEcobot/PYTHON_2023
Lesson_8/telefone/controller.py
controller.py
py
433
python
ru
code
0
github-code
90
73567349096
import os from flask import Flask, jsonify, request, abort, Response from typing import Union, Optional, List, Any from dataclasses import asdict from utils import make_query_response, get_greetings, Greetings from greet import greetings as g app = Flask(__name__) BASE_DIR = os.path.dirname(os.path.abspath(__file__))...
cestxvcdim/SkyPro_24.2_HW
main.py
main.py
py
1,513
python
en
code
0
github-code
90
40093709920
from torch import nn from torchvision import models from src.utils.registry import REGISTRY from timm import create_model @REGISTRY.register('resnet') class ResNetModel(nn.Module): def __init__(self, num_classes=5, classify=True): super(ResNetModel, self).__init__() # onnx_model.graph.input[0].t...
Tracker1701/Smart_Contracts_Vulnerability_Detection
smart-contracts-vulnerabilities - 2D - convxnet - CNN(1)/src/modeling/network/backbone/resnet.py
resnet.py
py
1,737
python
en
code
1
github-code
90
72763998697
# -*- coding: utf-8 -*- # Adapted from lstm_text_generation.py in keras/examples from __future__ import print_function from keras.layers.recurrent import SimpleRNN from keras.models import Sequential from keras.layers import Dense, Activation import numpy as np INPUT_FILE = "../data/alice_in_wonderland.txt" # extract...
PacktPublishing/Deep-Learning-with-Keras
Chapter06/alice_chargen_rnn.py
alice_chargen_rnn.py
py
3,769
python
en
code
1,049
github-code
90
5011171155
import os import re import typing def find_default_filename(existing_names: typing.List[str]) -> dict: other_names = [split_filename(n)['name'] for n in existing_names] index = 0 for i in range(1000): index += 1 name = '{}'.format(index) if name not in other_names: ret...
sernst/cauldron
cauldron/session/naming.py
naming.py
py
4,062
python
en
code
78
github-code
90
24384473077
#! python3 import sys import gzip from signal import signal, SIGPIPE, SIG_DFL signal(SIGPIPE,SIG_DFL) import string # Get the file name from the commandline. if len(sys.argv) == 3: patient_list = sys.argv[2] gene_list = sys.argv[1] output_name = gene_list + "." + patient_list + ".generes" output_na...
MagdalenaZZ/Python_ditties
cosmic_parser.py
cosmic_parser.py
py
3,483
python
en
code
0
github-code
90
7368773164
""" Input files: papers.json methods.json and API (https://paperswithcode.com/api/v1/) Output files: papers.nt tasks.nt """ from rdflib import Graph from rdflib import URIRef, BNode, Literal from rdflib.namespace import DCTERMS, RDF, RDFS, XSD, OWL, FOAF import json i...
davidlamprecht/linkedpaperswithcode
transformation-scripts/01_papers.py
01_papers.py
py
11,898
python
en
code
1
github-code
90
30609536728
# Given a string s, return true if it is a palindrome, or false otherwise. # https://leetcode.com/problems/valid-palindrome/ class Solution: def isPalindrome(self, s: str) -> bool: s = s.lower() # List comprehension to remove special chars s = ''.join([i for i in s if i.isalnum()]) ...
aykhazanchi/leetcode
04_valid_palindrome.py
04_valid_palindrome.py
py
461
python
en
code
0
github-code
90
32153357160
from threading import Thread import time class Consumer: def __init__(self, text_list_obj, consumer_number, **kwargs): self.override_fn = kwargs.pop('override_fn', None) self.text_list_obj = text_list_obj self.is_killed = False self.consumer_number = consumer_number t = Thr...
cosmos-sajal/low_level_design
publisher_subscriber/consumer.py
consumer.py
py
1,941
python
en
code
3
github-code
90
30759105951
from Tkinter import * from tkMessageBox import * from Tkinter import Tk, Frame, BOTH import os class GUI(Frame): def __init__(self, parent = None): Frame.__init__ (self) self.pack() self.master.title("Staff GUI") self.master.minsize(width=100,height=70) ...
edmund02/Gym-Fitness-Planner
StaffGUI.py
StaffGUI.py
py
1,343
python
en
code
0
github-code
90
72208168298
''' 给你一个树,请你 按中序遍历 重新排列树,使树中最左边的结点现在是树的根,并且每个结点没有左子结点,只有一个右子结点。   示例 : 输入:[5,3,6,2,4,null,8,1,null,null,null,7,9] 5 / \ 3 6 / \ \ 2 4 8  / / \ 1 7 9 输出:[1,null,2,null,3,null,4,null,5,null,6,null,7,null,8,null,9] 1   \   2   \   3   \   4   \  ...
Asunqingwen/LeetCode
简单/递增顺序查找树.py
递增顺序查找树.py
py
1,357
python
zh
code
0
github-code
90
17941412052
from pynput.keyboard import Listener import snake snake = snake.Snake(3) def main(): with Listener(on_press=event_listener) as listener: listener.join() def event_listener(key): switch = { key.up: 'U', key.down: 'D', key.left: 'L', key.right: 'R' } snake.mov...
OmerElmaliach/SnakeGame
main.py
main.py
py
396
python
en
code
0
github-code
90
31736006426
""" The helper functions for our YOLO model. """ def get_model_from_config(name): """ :param name: The file path for the configuation file. Get the parameters of each layer of the neural network from the config file based on the given path name. """ module_params = [] module = open(name, 'r') ...
CSMYang/YOLOLOLOLOL
util.py
util.py
py
743
python
en
code
0
github-code
90
35619153316
from item import Item from errors import InvalidStateError class NPC(Item): def __init__(self, names, item_description, description, has_task, gives_task, speeches, printer, events, game): super(NPC, self).__init__(False, False, True, names, item_description, description, printer) self.speeches = speeches self....
rjmcf/HailTraveller
npc.py
npc.py
py
2,951
python
en
code
0
github-code
90
70639103016
#!/usr/bin/env python3 from bs4 import BeautifulSoup import sys import json import collections def transformHtmlTableToJson(inputPath, fileName): inputFile = open(inputPath,"r") table_data = [[cell.text for cell in row("td")] for row in BeautifulSoup(inputFile.read(), 'html.parser')("tr")] inputFile.clo...
ChianHuei/centriqe_pipeline
scripts for QMS/convertTableToJson.py
convertTableToJson.py
py
1,288
python
en
code
0
github-code
90
12356695058
import string import time from urllib.parse import quote from urllib.request import urlopen, urlretrieve from bs4 import BeautifulSoup from csvFunc import csvFunc class searchFunc(): gUrl = "" gBbsUrl = "" gSearchUrl = "" gComicTitle = None gResultFromCvs = None gCharSet = "utf-8" def __init__( self, aUrl, aB...
martinkang/Study
Python/Web_Scraping/miniToonNotifier/searchFunc.py
searchFunc.py
py
4,826
python
en
code
5
github-code
90
7438099997
import numpy from Project import functions, functions2 import matplotlib.pyplot as plt def save_ApplicationWorkingPoint_DCFs(scores, L, costs, path, applicationWorkingPoints): DCFsNormalized = [] DCFsNormalized2 = [] DCFsNormalizedMin = [] applicationWorkingPointsPrint = ['0_1', '0_5', '0_9'] for i,...
c0st0la/MachineLearning
Project/Evaluation/evaluation.py
evaluation.py
py
12,938
python
en
code
0
github-code
90
30463095817
import sys from collections import deque n = int(sys.stdin.readline()) deq = deque() for i in range(n): text = sys.stdin.readline().strip() if text.split()[0] == 'push_front': deq.appendleft(text.split()[1]) elif text.split()[0] == 'push_back': deq.append(text.split()[1]) ...
laagom/Algorithm
백준/Silver/10866. 덱/덱.py
덱.py
py
723
python
en
code
0
github-code
90
9832654609
import cv2 import numpy as np import os # 入出力共通 fp = {"gray":[], "load":[], "dump":[], "dir":"", "sample":[]} # テンプレートを生成する(0102用) def get_templates0102(): temp0 = cv2.imread("tmpnum.png") temp0g = cv2.cvtColor(temp0, cv2.COLOR_BGR2GRAY) return [ temp0g[ (0 if (i<5) else 33):(33 if (i...
symtkhr/gwreg
crop/match.py
match.py
py
13,323
python
en
code
0
github-code
90
40327336495
#!/usr/bin/python3 # coding: utf-8 import sys import os import zhconv from tqdm import tqdm # pip3 install zhconv def convert_hans(file_path): if os.path.isfile(file_path): input_files = [file_path] elif os.path.isdir(file_path): input_files = [os.path.join(file_path, f) for f in os.listdir(f...
gswyhq/hello-world
file相关/繁体转简体.py
繁体转简体.py
py
1,125
python
en
code
9
github-code
90
29702215872
""" Python Pygal常见数据图(折线图、柱状图、饼图、点图、仪表图和雷达图)详解 Pygal 同样支持各种不同的数据图,比如饼图、折线图等。Pygal 的设计很好,不管是创建哪种数据图,Pygal 的创建方式基本是一样的,都是先创建对应的数据图对象,然后添加数据,最后对数据图进行配置。因此,使用 Pygal 生成数据图是比较简单的。 折线图 折线图与柱状图很像,它们只是表现数据的方式不同,柱状图使用条柱代表数据,而折线图则使用折线点来代表数据。因此,生成折线图的方式与生成柱状图的方式基本相同。 使用 pygal.Line 类来表示折线图,程序创建 pygal.Line 对象就是创建折线图。下面程序示范了利用折线图来...
Bngzifei/PythonNotes
Python数据可视化/Python Pygal常见数据图(折线图、柱状图、饼图、点图、仪表图和雷达图)详解.py
Python Pygal常见数据图(折线图、柱状图、饼图、点图、仪表图和雷达图)详解.py
py
1,653
python
zh
code
1
github-code
90
34350274856
from __future__ import absolute_import import botocore.session import cachetools import requests from datetime import datetime from cloudperf.providers import aws_helpers # link to the newest endpoints.json in case the installed botocore doesn't # yet have a region ENDPOINTS_URL = "https://raw.githubusercontent.com/bo...
bra-fsn/cloudperf
cloudperf/providers/aws.py
aws.py
py
4,127
python
en
code
7
github-code
90
27129949095
#! /usr/bin/env python3 import argparse import logging import pathlib import pandas as pd from src import estimator, formatter, preprocessor logging.basicConfig( level=logging.INFO, format="[%(asctime)s line:%(lineno)-3d %(levelname)-8s ] %(message)s", datefmt="%Y/%m/%d %H:%M:%S", ) def main(argv): ...
misakisuna705/AOSP
main.py
main.py
py
2,811
python
en
code
0
github-code
90
18550379709
s=input() ans="" if len(s)<26: cnt_alphabet=[0]*26 for i in range(len(s)): cnt_alphabet[ord(s[i])-97]+=1 moji="" for i in range(26): if cnt_alphabet[i]<1: moji=chr(i+97) break ans=s+moji else: cnt=25 for i in range(24,-1,-1): if o...
Aasthaengg/IBMdataset
Python_codes/p03393/s443822450.py
s443822450.py
py
630
python
en
code
0
github-code
90
21916476162
# -*- coding: utf8 -*- from __future__ import division import sys import math from collections import defaultdict VOCAB_NUMBER = 10**6 UNKNOWN_PROB = 0.05 def load_trained_model(train_file): trained_model = defaultdict(float) with open(train_file, 'r') as f: for line in f: word, prob = li...
ochiaierika/nlptutorial
01_unigramlm/confirm-test-unigram.py
confirm-test-unigram.py
py
1,348
python
en
code
0
github-code
90
18004056849
# coding: utf-8 import sys #from operator import itemgetter sysread = sys.stdin.buffer.readline read = sys.stdin.buffer.read #from heapq import heappop, heappush #from collections import defaultdict sys.setrecursionlimit(10**7) #import math #from itertools import product, accumulate, combinations, product #import bisec...
Aasthaengg/IBMdataset
Python_codes/p03739/s557767856.py
s557767856.py
py
1,082
python
en
code
0
github-code
90
18216593749
MOD = 998244353 n, m, k = map(int, input().split()) c = 1 cnt = 0 for x in range(k + 1): cnt += c * m * pow(m - 1, n - 1 - x, MOD) cnt %= MOD c *= (n - x - 1) * pow(x + 1, MOD - 2, MOD) c %= MOD print(cnt)
Aasthaengg/IBMdataset
Python_codes/p02685/s804312814.py
s804312814.py
py
222
python
en
code
0
github-code
90
73531841578
from torch.utils.data import DataLoader import time import torch from torch import nn # import wandb from transformers import get_linear_schedule_with_warmup from torch.optim.lr_scheduler import CosineAnnealingLR, CyclicLR # from model.load_model import load_model_from_path # import logging # from utils import * from e...
chenkaisun/MMLI1
code/train.py
train.py
py
10,037
python
en
code
1
github-code
90
37838319925
import json from django.conf import settings from django.test import TestCase class ServerUpdateTests(TestCase): def setUp(self) -> None: settings.DEBUG = False # def test_server_release_illegal_action(self): # head = { # "User-Agent": "GitHub-Hookshot/12dd831", #...
HEYsir/blog_system
tests/test_depoly.py
test_depoly.py
py
2,359
python
en
code
1
github-code
90
1814835146
# -*- coding: utf-8 -*- """ Created on Thu Jan 16 17:24:40 2020 @author: Rajesh """ salary = '$876,001' # x=salary[1:4]+salary[5:] x=salary[1:4]+salary[5:8] x=int(x) print('Salary :', x) sal=input('Enter the salary into $ and Convert into Integer :') x=salary[1:4]+salary[5:] x=int(x) print('Salary :', x) '$777...
Rajesh-sharma92/FTSP_2020
Python_CD3/Salary_Integer.py
Salary_Integer.py
py
325
python
en
code
3
github-code
90
36318173945
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals from __future__ import absolute_import import sys from setuptools import setup, find_packages import codecs import os import re def read(*parts): path = os.path.join(os.path.dirname(__file__), *parts) with codecs.open(path,...
weiwongfaye/python_cli_template
setup.py
setup.py
py
1,345
python
en
code
0
github-code
90
26903671523
# input d = float(input('Wat was de initiële populatiedichtheid: ')) r = float(input('Wat is de vruchtbaarheids parameter: ')) s = int(input('Over hoeveel tijdstappen wil de populatie dichtheid simuleren: ')) # programma print(d) for i in range(s - 1): d = t = r * d * (1 - d) print(d)
xander27481/informatica5
07a - iteraties Fortus/+/Chaos.py
Chaos.py
py
296
python
nl
code
0
github-code
90
20070194738
import pandas as pd import numpy as np import requests import bs4 as bs from six.moves import urllib from tmdbv3api import TMDb import json from tmdbv3api import Movie link = "https://en.wikipedia.org/wiki/List_of_American_films_of_2020" source = urllib.request.urlopen(link).read() soup = bs.BeautifulSo...
adityanandgaokar/movie_recommendation_system_heroku
data_preprocessing_4.py
data_preprocessing_4.py
py
3,229
python
en
code
0
github-code
90
2502167892
import random def get_score(name): read_file = open("rating.txt", "r") for record in read_file: if name in record: score = record.split(" ")[1].strip("\n") print(f"Your rating: {score}") read_file.close() return else: read_file.close() ...
vladyslavmakartet/-rock_paper_scissors
Rock-Paper-Scissors/game.py
game.py
py
3,679
python
en
code
0
github-code
90
18216421589
n,m,k = map(int,input().split()) mod = 998244353 def comb(n,k): if n < k: return 0 if n < 0 or k < 0: return 0 return fac[n]*finv[k]%mod*finv[n-k]%mod fac = [0]*(n+1) finv = [0]*(n+1) fac[0] = finv[0] = 1 for i in range(1,n+1): fac[i] = fac[i-1]*i%mod finv[i] = pow(fac[i],mod-2,mod) ans = 0 for i i...
Aasthaengg/IBMdataset
Python_codes/p02685/s603835671.py
s603835671.py
py
407
python
en
code
0
github-code
90
5360443372
""" 1초/ 소리강약 체크 횟수 /h 체크 값 저장 비트 수 / b 트랙 채널개수 /c 시간 /s """ h, b, c, s = map(int, input().split()) result = (h * b * c * s) / 8 result /= 1024**2 print("%.1f" %result +" MB")
Damnun/CodeUp_100Q
Question_84.py
Question_84.py
py
237
python
ko
code
0
github-code
90
3898100196
# this file moves all pdf files into a folder called "reflections", which will be made if necessary import os # https://stackoverflow.com/questions/8858008/how-to-move-a-file, # answered by Peter Vlaar import os, shutil, pathlib, fnmatch def move_dir(src: str, dst: str, pattern: str = '*'): if not os.path.isdi...
ofloveandhate/python_autograder
move_reflections.py
move_reflections.py
py
615
python
en
code
0
github-code
90
6884842164
p = int(input("vvedite p (2<p<=10):")) x,y = int(1),int(1) for x in range (1,p): a=[] for y in range (1,p): z = (x*y//p)*10 + (x*y)% p a.append(z) print(a)
nmt132/132-NOVIKOV
табличбка.py
табличбка.py
py
189
python
en
code
2
github-code
90
18458777139
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) K = 0 S = 0 T = [] if sum(A) < sum(B): K = -1 else: for i in range(N): if A[i] < B[i]: K += 1 S = S + B[i] - A[i] elif A[i] > B[i]: T.append(A[i] - B[i]) else: ...
Aasthaengg/IBMdataset
Python_codes/p03151/s905709903.py
s905709903.py
py
403
python
en
code
0
github-code
90
28300553712
import pygame import sys pygame.init() display = pygame.display.set_mode((800,800)) pygame.display.set_caption('Instruction Screen') def Instruction(): width = display.get_width() height = display.get_height() s = (600,600) color_white = (225,255,255) color_light = (180,180,180) color...
ColeHeilman/Preposal-and-Github-lab
Instructions.py
Instructions.py
py
2,893
python
en
code
0
github-code
90
40549560016
from .predictorproxy import PredictorProxy from .predictor import _SAMPLE_VIDEO_FRAMES import time import cv2 import os import datetime _DEFAULT_IMG = cv2.imread(os.path.join( os.path.dirname(__file__), 'templates', 'Roboy_chef.jpg')) if _DEFAULT_IMG is None: raise ValueError("Default image was not found") ...
mfedoseeva/roboy-activity-recognition
app_code/inference/HARController.py
HARController.py
py
1,448
python
en
code
0
github-code
90
19379098686
from Functions.Tests import * from Functions.Visualizations import * def run_tests(): # first analysis master_results = {} for i in range(0, 5): test_field(master_results, i) index = ['standard', 'food_heavy', 'middle_food', 'middle_shelter', 'shelter_heavy'] master_results = pd.DataFrame...
joshfactorial/pollinator_simulation
Functions/run_tests.py
run_tests.py
py
1,898
python
en
code
1
github-code
90
18381367009
N = int(input()) tasks = [None] * N for i in range(N): tasks[i] = tuple(map(int,input().split())) tasks = sorted(tasks, key = lambda x:x[1]) time = 0 for t in tasks: if t[1] - t[0] < time: print("No") break time += t[0] else: print("Yes")
Aasthaengg/IBMdataset
Python_codes/p02996/s977400855.py
s977400855.py
py
257
python
en
code
0
github-code
90
18429507249
import sys n = int(input()) b = list(map(int, input().split())) ans = [] for i in range(n): for j in range(len(b), 0, -1): if b[j - 1] == j: ans.append(j) del b[j - 1] break else: print(-1) sys.exit() ans.reverse() for i in ans: print(i)
Aasthaengg/IBMdataset
Python_codes/p03089/s690781028.py
s690781028.py
py
310
python
en
code
0
github-code
90
10889633535
import numpy as np import numpy.linalg as la import scipy.sparse as sp import scipy.sparse.linalg as spla import sys from functools import reduce # 2022/10 現在、正方格子のみ # =============================================================================== # 1次元の tight-binding model def _D1d(N, t, bc): if N==1: ...
masaico/TB_models
tbmodels.py
tbmodels.py
py
5,237
python
en
code
0
github-code
90
35224038049
import sklearn.ensemble as skl_ensemble from Orange.base import RandomForestModel from Orange.data import Variable, ContinuousVariable from Orange.preprocess.score import LearnerScorer from Orange.regression import SklLearner, SklModel from Orange.regression.tree import SklTreeRegressor __all__ = ["RandomForestRegres...
biolab/orange3
Orange/regression/random_forest.py
random_forest.py
py
1,950
python
en
code
4,360
github-code
90
72021774698
from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required from django.db import IntegrityError from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render, redirect from django.urls import reverse from django import forms fro...
jeparalta/web50
commerce/auctions/views.py
views.py
py
8,232
python
en
code
0
github-code
90
1791370275
import os import urllib.request from flask import Flask, flash, request, redirect, url_for, render_template from werkzeug.utils import secure_filename import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import tensorflow as tf from matplotlib.image import imread from...
danish-islam/Pneumonia-Detector
xray-flask-model.py
xray-flask-model.py
py
2,956
python
en
code
1
github-code
90
16749634444
import cv2 import numpy as np import torch class LaMa: """Class is designed for image inpainting, which is the process of filling in damaged parts of an image.""" pad_mod = 8 def __init__(self, model_path: str, device: str) -> None: self.device = device self.model = torch.jit.load(model_...
logo-wizard/logo-wizard-ml-scripts
eraser/eraser.py
eraser.py
py
3,306
python
en
code
1
github-code
90
18414072029
import random from operator import itemgetter import sys sys.setrecursionlimit(1000000) ans=0 def gcd(x,y): x,y=max(abs(x),abs(y)),min(abs(x),abs(y)) if x%y==0: return y while x%y!=0: x,y=y,x%y return y def gcd_all(l): rt=l.pop() for i in l: rt=gcd(i,rt) return rt ...
Aasthaengg/IBMdataset
Python_codes/p03061/s493423004.py
s493423004.py
py
737
python
en
code
0
github-code
90
29474157511
import pandas as pd import torch from tqdm.auto import tqdm from transformers import AutoTokenizer class CustomDataset(torch.utils.data.Dataset): def __init__( self, data_file, state, text_columns, target_columns, max_length=256, model_name="klue/roberta-sma...
boostcampaitech5/level3_nlp_finalproject-nlp-08
model/Filter/dataloader.py
dataloader.py
py
2,313
python
en
code
29
github-code
90
14478284531
"""Tests for class :class:`ncdata.NcDimension`.""" from unittest import mock import numpy as np import pytest from ncdata import NcDimension class Test_NcDimension__init__: def test_simple(self): name = "dimname" # Use an array object for test size, just so we can check "is". # N.B. assu...
pp-mo/ncdata
tests/unit/core/test_NcDimension.py
test_NcDimension.py
py
2,034
python
en
code
5
github-code
90
29022786430
#!/usr/bin/env python import json import gzip import uproot import numexpr import numpy as np from coffea import hist, lookup_tools from coffea.util import load, save from coffea.hist import plot corrections = {} extractor = lookup_tools.extractor() extractor.add_weight_sets(["2016_n2ddt_ * correction_files/n2ddt_tr...
nsmith-/coffeandbacon
analysis/compile_corrections.py
compile_corrections.py
py
20,687
python
en
code
1
github-code
90
40239787688
# -*- coding: utf-8 -*- """ Created on Tue Dec 29 12:20:40 2020 @author: SethHarden """ import math # Add any extra import statements you may need here """ We receive 2 arrays (A,B) We are told their lengths with N. Determine if there is a way to make A == B by reversing any sub arrays from array B (any number of t...
sethmh82/SethDevelopment
Python/Array-Reverse-to-Make-Equal.py
Array-Reverse-to-Make-Equal.py
py
2,127
python
en
code
1
github-code
90
18323451309
def main(): n = int(input()) d = list(map(int,input().split())) mod = 998244353 if d[0]!=0: print(0) return D = {0:1} for i in range(1,n): if d[i]==0: print(0) return if D.get(d[i]) == None: D[d[i]] = 1 else: ...
Aasthaengg/IBMdataset
Python_codes/p02866/s221872293.py
s221872293.py
py
575
python
en
code
0
github-code
90
4539893840
import cv2 import numpy as np import matplotlib.pyplot as plt from scipy.signal import convolve2d from scipy.ndimage.filters import gaussian_filter import skimage.io as io from nonmaxsuppts import nonmaxsuppts K = 0.04 def detect_features(image): """ Computer Vision 600.461/661 Assignment 2 Args: image (numpy.n...
warmspringwinds/jhu_cv_homeworks
hw_2/detect_features.py
detect_features.py
py
1,188
python
en
code
0
github-code
90
15756421891
from collections import deque import pickle string_f = '''75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 17 78 39 68 17 57 91 71 52 38 17...
dzinrai/my_euler_proj
e18.py
e18.py
py
3,344
python
en
code
0
github-code
90
18407712869
from collections import deque m, k = [int(i) for i in input().split()] if k >= 2 ** m: print(-1) exit() if k == 0: q = deque([]) for i in range(2 ** m): q.append(i) q.appendleft(i) print(*q) exit() if m == 1 and k == 1: print(-1) exit() S = set(i for i in range(2 ** ...
Aasthaengg/IBMdataset
Python_codes/p03046/s624134655.py
s624134655.py
py
456
python
en
code
0
github-code
90
14316115270
from django.apps import apps from rest_framework import serializers from rest_flex_fields import FlexFieldsModelSerializer from drf_extra_fields.fields import Base64ImageField __all__ = [ 'OrderExtensionSerializer', ] Order = apps.get_model(*'order.Order'.split()) OrderExtension = apps.get_model(*'order.OrderExte...
Chaoslecion123/Diver
saleor/rest/serializers/order_extension.py
order_extension.py
py
1,357
python
en
code
0
github-code
90
14981771755
def merge_sort(arr, left, right): if left < right: mid = (left + right) // 2 # Recursively sort first half and second half merge_sort(arr, left, mid) merge_sort(arr, mid + 1, right) # Merge the sorted halves merge(arr, left, mid, right) #...
CQUer-nanzhong/ClassContents-Hw-and-Lab-of-Data-Structure-and-Algorithm
Homework-by-python/Homework-Week-9/Hw 9_1 二路归并排序.py
Hw 9_1 二路归并排序.py
py
1,159
python
en
code
1
github-code
90
20667393565
def solution(dartResult): answer = 0 temp = [] import re # 스타상 : 해당 점수와 바로 전에 얻은 점수를 각각 2배, 다른 효과(스타, 아차)와 중첩 가능 # 아차상 : 해당 점수 마이너스 # 3번의 기회 num_list = re.split(r'[^0-9]', dartResult)[:-1] bonus_option_list = re.findall(r'[\D]', dartResult) for num, bonus_option in zip(num_...
jjjk84/code_study
프로그래머스/lv1/17682. [1차] 다트 게임/[1차] 다트 게임.py
[1차] 다트 게임.py
py
950
python
ko
code
0
github-code
90
18354324439
from bisect import bisect_left s = list(input()) t = list(input()) alf=[[] for _ in range(26)] for i in range(len(s)): alf[ord(s[i])-97].append(i) now_alf = -1 sets = 0 i = 0 while i < len(t): next_alf = ord(t[i])-97 if len(alf[next_alf]) == 0: print(-1) exit() if now_alf > alf[n...
Aasthaengg/IBMdataset
Python_codes/p02937/s484666916.py
s484666916.py
py
536
python
en
code
0
github-code
90
72682869417
import streamlit as st def main(): st.title("Streamlit Session State Tutorial") st.subheader("Counter Example") # Streamlit runs from top to bottom on every iteration so # we check if 'count' has already been initialized in st.session_state # if no, the initialize count to 0 # if count is already initialized, ...
PacktPublishing/Web-App-Development-Made-Simple-with-Streamlit
Chapter15/Chapter15-session_state.py
Chapter15-session_state.py
py
1,096
python
en
code
5
github-code
90
37136471876
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @File : game_stats.py @Time : 2019/03/31 01:11:49 @Author : leacoder @Version : 1.0 @Contact : leacock1991@gmail.com @License : @Desc : None ''' # here put the import lib #在这个游戏运行期间, 我们只创建一个GameStats 实例, 但每当玩家开始新游戏时, 需要重置一些统计信息。 #我们在方法reset_...
lichangke/Python3_Project
Python编程从入门到实践/alien_invasion/game_stats.py
game_stats.py
py
1,109
python
zh
code
3
github-code
90
8868862502
from Word.Syllabizer import WordSyllabizer class Cursor(object): def __init__(self, character, characters): super(Cursor, self).__init__() self.character = character self.characters = characters self.position = 0 self.syllable_break = False self.prev_symbols = [] ...
pepperpepperpepper/WordSynth
WordSynth/Word/Syllabizer/Trouvain.py
Trouvain.py
py
4,566
python
en
code
0
github-code
90
37655136156
from flask import Flask from flask import request import requests import json import threading app = Flask(__name__) @app.route("/") def receive_code(): code = request.args.get('code', '') if code is not "": print("Code received:" + code) url = "https://iam.viessmann.com/idp/v2/token" h...
fschw/dashboard
flasktest.py
flasktest.py
py
1,335
python
en
code
0
github-code
90
28318156910
# Reversi (Othello) import random import sys def ispiši(ploča): # Ispisuje ploču. Ne vraća ništa. vodoravna = ' +---+---+---+---+---+---+---+---+' uspravne = ' | | | | | | | | |' print( ' 1 2 3 4 5 6 7 8') print(vodoravna) for y in range(8): pr...
vedgar/inventwithpython3rded
translations/hr/src/UIsim1.py
UIsim1.py
py
8,315
python
hr
code
0
github-code
90
70291264618
__author__ = "Alien" class Settings(): '''存储所有设置的类''' def __init__(self): # 屏幕长 self.screen_width = 1200 # 屏幕宽 self.screen_height = 800 # 屏幕背景色 self.bg_color = (230,230,230) # 每次移动的像素点 self.ship_speed_factor = 3.5 # 子弹设置 self.bulle...
Big-Belphegor/python-stu
Frist_project/settings.py
settings.py
py
736
python
en
code
0
github-code
90
17974160189
K = int(input()) N = 50 n = K // N ans = [49+n] * N K %= N for i in range(N): if i < K: ans[i] += N - K + 1 else: ans[i] -= K print(N) print(*ans)
Aasthaengg/IBMdataset
Python_codes/p03646/s580709218.py
s580709218.py
py
160
python
en
code
0
github-code
90
5908490599
# Problem description: # https://github.com/HackBulgaria/Programming0-1/tree/master/week3/1-Baby-Steps def square(x): return x ** 2 #print(square(5)) def fact(x): start = 1 product = 1 while start <= x: product *= start start += 1 return product #print(fac...
keremidarski/python_playground
Programming 0/week 3/01_begin_functions.py
01_begin_functions.py
py
999
python
en
code
0
github-code
90
1865113868
def leftRotate(arr, d, n): for i in range(gcd(d, n)): temp = arr[i] j = i while 1: k = j + d if k >= n: k = k - n if k == i: break arr[j] = arr[k] j = k arr[j] = temp def printArray(arr, siz...
Anjan50/Python
Basic Programs/array_roatation_n_times.py
array_roatation_n_times.py
py
624
python
en
code
17
github-code
90
376952219
from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5 import QtCore, QtGui import os, time, subprocess, sys, traceback from widget_gui import Ui_WidgetAssist from user_alert import Ui_AlertWindow import widget_module as mod icon_file=os.path.join('Dependencies', 'wInstaller.ico') thread=m...
P3nguin-M/WidgetAssist_GoToSearch
WidgetAssist_GoToSearch.py
WidgetAssist_GoToSearch.py
py
7,251
python
en
code
0
github-code
90
22309490617
from urllib import error, parse, request from configparser import ConfigParser from pprint import pp import argparse import style import json import sys # A linha de código abaixo fará todas as chamadas de API constantemente URL = "http://api.openweathermap.org/data/2.5/weather" """ Semelhante aos códigos de respos...
CarlosViniMSouza/Weather-CLI-App
main.py
main.py
py
5,216
python
pt
code
0
github-code
90
10605529190
import requests import json import pandas as pd from abc import ABC, abstractmethod import quandl import os from dotenv import load_dotenv class PricesFetcher(ABC): """ Price fetcher abstract class """ @abstractmethod def get_prices(self, symbol: str) -> pd.DataFrame: pass class QuandlPr...
PRJM1999/Airline-Stocks
server/api/data_retrieval.py
data_retrieval.py
py
2,120
python
en
code
0
github-code
90
72292578218
""" Van Eck's sequence times : python3.9: 8.9s pypy3 : 0.7s """ startseq = [9,19,1,6,0,5,4] # iterations = 2020 iterations = 30_000_000 # array of last positions pos = [0] * iterations for idx, v in enumerate(startseq[:-1], start=1): pos[v] = idx last = startseq[-1] for i in range(len(startseq), iterations...
ldgeo/adventofcode
2020/day15.py
day15.py
py
421
python
en
code
1
github-code
90
12356466256
import argparse import os from sklearn.metrics import accuracy_score, confusion_matrix import pandas as pd from tqdm import tqdm from config.conf import CONFIG import numpy as np import json from rouge import Rouge from nltk import PorterStemmer import argparse stemmer = PorterStemmer() baselines = ["single", "ppl", ...
THU-KEG/ChatLog
data/evaluation.py
evaluation.py
py
10,650
python
en
code
90
github-code
90
13221336381
from django.db import models from django.contrib.auth.models import AbstractUser class User(AbstractUser): name = models.CharField(max_length=255) class Gender(models.Model): gender = models.CharField(max_length=255) def __str__(self): return self.gender class Subject(models.Model): name ...
oktamovabdulaziz/studys
main/models.py
models.py
py
2,563
python
en
code
1
github-code
90
20574749891
import cv2 import numpy as np import time import PoseModule as pm cap = cv2.VideoCapture("AITrainer/zoom_0.mp4")#"AiTrainer/curls.mp4" detector = pm.poseDetector() count = 0 dir = 0 pTime = 0 while True: success, img = cap.read() img = cv2.resize(img, (1280, 720)) img = detector.findPose(img, False) ...
Ramasubramanya-MS/Fall-Accident-Detection-Using-CNN-CV
CV - Fall Detection - PoseModule/AITrainer.py
AITrainer.py
py
1,721
python
en
code
6
github-code
90
30947215038
# -*- coding: utf-8 -*- """ Created on Tue Jul 24 17:17:25 2018 @author: user """ test_string=input("Enter string:") l=[] l=test_string.split() wordfreq=[l.count(p) for p in l] print(dict(zip(l,wordfreq)))
ranjuinrush/excercise
ex4/untitled8.py
untitled8.py
py
218
python
en
code
0
github-code
90
5064454679
import yaml, os.path from core.config.fuzzer import FuzzerConfig from core.config.jsanlyzer import JsAnalyzerConfig from core.scanner.excluder import Excluder from core.jsanalyzer.anlysis import ExtractorsLoader from core.logger import Level from core.utils import * from core.config.builder import ConfigBuilder from c...
abdallah-elsharif/WRock
ui/cli/builder.py
builder.py
py
9,934
python
en
code
26
github-code
90
24259597894
import telebot import random from telebot import types # Загружаем список поговорок file = open('facts.txt', 'r', encoding='UTF-8') facts = file.read().split('\n') file.close() # Создаем бота bot = telebot.TeleBot('5681197522:AAG18F0ArwMg2oIKjJB2gm0EyVHlrwhRXJQ') # Команда start @bot.message_handler(comman...
ksblv/Telegram-Bot
bot.py
bot.py
py
1,493
python
ru
code
0
github-code
90
19737013946
from selenium import webdriver from selenium.webdriver import ActionChains import time #FILEDIR = "C:/Users/inasahu/PycharmProjects/SeleniumPython/" FILEDIR = "C:/Users/Anurag/PycharmProjects/Python-Selenium/" driver = webdriver.Chrome(executable_path=FILEDIR + "Drivers/chromedriver.exe") # implicit wait driver.impl...
2310anuragsahu/Python-Selenium
File Upload.py
File Upload.py
py
624
python
en
code
1
github-code
90
18506637619
N = int(input()) found = False for x in range(0, 25+1): for y in range(0, 14+1): if 4 * x + 7 * y == N: found = True if found: print("Yes") else: print("No")
Aasthaengg/IBMdataset
Python_codes/p03285/s201648764.py
s201648764.py
py
191
python
en
code
0
github-code
90
20389460079
from tg.projects.create_sagemaker_routine import SagemakerRoutine from tg.projects.alternative.alternative_task import AlternativeTrainingTask from tg.common.delivery.sagemaker import Autonamer, download_and_open_sagemaker_result from tg.common.ml.batched_training import context as btc def debug_run(in_docker = False)...
okulovsky/grammar_ru
tg/projects/alternative/run_training.py
run_training.py
py
2,005
python
en
code
11
github-code
90
28518139587
from selenium import webdriver import time import re from selenium.webdriver.common.by import By import pandas as pd import csv from selenium import webdriver from pandas import DataFrame from selenium.webdriver.common.keys import Keys from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.com...
vantugithub/crawl_cmt_fb
crawl_data_fb_photos.py
crawl_data_fb_photos.py
py
5,555
python
en
code
0
github-code
90
40315928204
''' Input: a List of integers Returns: a List of integers ''' def moving_zeroes(arr): # sort array # loop through array swapping elements from current position to last # if the current position value is 0 # append element to arr and remove element arr.sort() for i in range(len(arr)): if...
IanCarreras/first-pass-solution
moving_zeroes/moving_zeroes.py
moving_zeroes.py
py
602
python
en
code
0
github-code
90