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
20312544908
from typing import Optional, List, Union from hisim.simulator import SimulationParameters from hisim.components import occupancy from hisim.components import price_signal from hisim.components import weather from hisim.components import pvs from hisim.components import smart_device from hisim.components import building...
2022Yalin/MSc
examples/modular_household.py
modular_household.py
py
15,378
python
en
code
0
github-code
90
12511396881
"""Sc is a distributed service manager.""" import subprocess import collections import pathlib import datetime import re import json import yaml import flask import argh import tabulate # pyxtermjs imports import flask_socketio import pty import os import select import termios import struct import fcntl app = fl...
dvolk/sc
app.py
app.py
py
25,130
python
en
code
0
github-code
90
12572266194
from setuptools import setup, find_packages with open('README.md') as f: description = f.read() setup( name="libproton", version="3.0", packages=find_packages(), description=description, author="Peter Law", author_email="PeterJCLaw@gmail.com", install_requires=[ 'PyYAML >=3.11,...
srobo-legacy/comp-libproton
setup.py
setup.py
py
435
python
en
code
0
github-code
90
33242279996
import cx_Oracle def queryLastElement(): con = cx_Oracle.connect('arushi/harkersoftball') cur=con.cursor() obj = cur.execute('''select * from beeGenes where ref_num=147907436''') for x in obj: print(x) print(x[1].read()) cur.close() con.close() queryLastElement(...
netyarushi/genome_sequence
4060Final/qLastElement.py
qLastElement.py
py
323
python
en
code
0
github-code
90
33857068662
lista = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] lista1 = max([ szam for szam in lista if szam % 2 == 0]) a = [] for sor in lista: if sor % 2 == 0: a.append(sor) print(max(a)) _____________________________________ ''' N�v;Oszt�ly;Els� nap;Utols� nap;Mulasztott �r�k Balogh P�ter;6a;1;1;5 ''' class Hianyzas: ...
kovacsbalazspeter21/balazs
python/proz.py
proz.py
py
1,665
python
hu
code
0
github-code
90
42967356298
import logging import requests import uuid LOGGER = logging.getLogger(__name__) class BridgeInfo(object): """Lightweight helper class for storing bridge information.""" def __init__(self, name='', bridge_type=''): """Constructor. Keyword Arguments: name -- The name of the ...
asterisk/testsuite
tests/rest_api/bridges/error/error.py
error.py
py
10,618
python
en
code
30
github-code
90
18360532959
import numpy as np N = int(input()) l = np.array(list(map(int,input().split()))) ans = 'Yes' M = l[0] for i in range(1,N): if l[i] > l[i-1]: M = l[i] if l[i]< M-1: ans ='No' break print(ans)
Aasthaengg/IBMdataset
Python_codes/p02953/s149825130.py
s149825130.py
py
224
python
en
code
0
github-code
90
217730967
import argparse import time import numpy as np import os import errno import sys from object_detector import ObjectDetector as TFObjectDetector from object_detector_lite import ObjectDetector as LiteObjectDetector import cv2 description_text = """\ Use this script to visualize network output on each frame of a video. ...
google/ftc-object-detection
training/camera_cv.py
camera_cv.py
py
5,453
python
en
code
40
github-code
90
41191854000
# Surfs Up from flask import Flask, jsonify # Add Dependencies import numpy as np import pandas as pd import datetime from dateutil.relativedelta import relativedelta import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func, inspec...
shaymusmc/sqlalchemy-challenge
app.py
app.py
py
5,854
python
en
code
0
github-code
90
73781566055
import simdata_gen_func as sfunc from scipy import stats import numpy as np import db_connect as dbc import json def trial_gen(prior, history, lott_mag, lott_prob, sure_mag, alpha0, beta0): # generate trial by trial simulated data # inputs: # prior: prior prob of each strategy ...
boptimism/strategy_tagging
simdata_gen.py
simdata_gen.py
py
2,712
python
en
code
0
github-code
90
17037824833
from tkinter import * from random import * koloda = [2, 3, 4, 5, 6, 7, 8, 9, 10, 'Валет', 'Дама', 'Король', 'Туз'] * 4 shuffle(koloda) count = 0 game_version = 0.1 def take(): global count, koloda karta = koloda.pop() if karta == 'Валет' or karta == 'Дама' or karta == 'Король': karta = 10 ...
rudiq4/BlackJack
main.py
main.py
py
2,092
python
en
code
0
github-code
90
3720584561
# class A: # def __init__(self): # self.x = 0 # public переменная # self._x = 0 # private - не использовать! # self.__x = 0 # hidden # # # a = A() # print(a.x) # print(a._x) # #print(a.__x) # # print(vars(a)) # # print(a._A__x) # class A: # def __init__(self): #...
alexzinoviev/itea_c
advance/advance_04_3.py
advance_04_3.py
py
1,234
python
ru
code
0
github-code
90
13717372228
import logging from gym.spaces import Box, Discrete import numpy as np from typing import Dict, Tuple from maddpg_torch_model import build_maddpg_models, _make_continuous_space from ray.rllib.utils.torch_ops import apply_grad_clipping, huber_loss, l2_loss from ray.rllib.utils.typing import TrainerConfigDict, TensorTy...
Rohan138/rllib-torch-maddpg
maddpg_torch_policy.py
maddpg_torch_policy.py
py
11,922
python
en
code
8
github-code
90
35032378083
#!/usr/bin/env python from Bio import SeqIO from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from selenium import webdriver import re from Bio import SeqIO from math import log2 VAXIJEN_TARGET = "virus" # You need to replace the field VAXIJEN_THRESHOLD = 0.5 # You need to replace the field # The...
lioj/bioinformatics
py/sele_MHCII.py
sele_MHCII.py
py
5,048
python
en
code
0
github-code
90
441495921
import math def el(i,j): if (i*j) % 2 == 0: return math.factorial(j) else: s = 0 for x in range(1, i+1): s += x return s n = int(input("n: ")) m = int(input("m: ")) A = [ [el(i,j) for j in range(1,m+1)] for i in range(1,n+1) ] A1 = [] for row in A: A1 +=...
AntalDima1/labwork
7/7_2.py
7_2.py
py
335
python
en
code
0
github-code
90
41579343127
import torch import time import os import shutil import numpy as np import random as rd import argparse from loguru import logger from rdkit import Chem from model.Lmser_Transformerr import MFT as DrugTransformer # from model.Transformer import MFT as DrugTransformer # from model.Transformer_Encoder import MFT as Drug...
CMACH508/AlphaDrug
mcts.py
mcts.py
py
10,440
python
en
code
28
github-code
90
16902149307
# 人物出现次数 import re def item_num(hero): with open('sanguo.txt') as f: data = f.read().replace('/n', '') name_num = re.findall(hero, data) # print('主角 %s 出现 %s 次' % (hero, len(name_num))) return len(name_num) # 读取人物信息 name_dict = {} with open('name.txt') as f: names = f.re...
bobiwang/study
class_func/sanguo_v2.py
sanguo_v2.py
py
460
python
en
code
0
github-code
90
73211685418
# # @lc app=leetcode id=124 lang=python # # [124] Binary Tree Maximum Path Sum # # @lc code=start # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object...
ashshekhar/leetcode-problems-solutions
124.binary-tree-maximum-path-sum.py
124.binary-tree-maximum-path-sum.py
py
1,391
python
en
code
0
github-code
90
17971128559
def solve(): h, w = map(int, input().split()) n = int(input()) a = list(map(int, input().split())) a_line = [] for i, i_cnt in enumerate(a): color = i+1 for j in range(i_cnt): a_line.append(color) # wごとに区切ってlistに詰める ans = [['']*w for _ in range(h)] cur = 0 ...
Aasthaengg/IBMdataset
Python_codes/p03638/s776620575.py
s776620575.py
py
547
python
en
code
0
github-code
90
74750508455
""" Buttons: 0 - A 1 - B 2 - X 3 - Y 4 - left shoulder button 5 - right shoulder button 6 - SYS 7 - Menu 11 - Stadia 12 - Box """ import os # this will fool the system to think it has video access os.environ["SDL_VIDEODRIVER"] = "dummy" import asyncio import pprint import pygame import threading class GoogleStadia...
home9464/battletank
pad.py
pad.py
py
5,482
python
en
code
0
github-code
90
17999607430
# 18 - Python Kivy - Propriedades e atribuição simultânea # https://www.youtube.com/watch?v=kDu1HJPruIE&list=PLsMpSZTgkF5AV1FmALMgW8W-TvrfR3nrs&index=18 from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.screenmanager import ScreenManager, Screen from kivy.core.window import Window from ki...
LivioAlvarenga/Tutoriais_Kivy_KivyMD
Tutorial_Kivy_HashLDash/21kivy.py
21kivy.py
py
4,003
python
pt
code
1
github-code
90
29335905117
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 16 00:42:57 2018 @author: jan """ import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('mushrooms.csv') X = dataset.iloc[:, 1:23].values y = dataset.iloc[:, 0].values # Encoding cat...
omerkocbil/Artificial-Neural-Networks
my_ann_tensorflow_different_dataset.py
my_ann_tensorflow_different_dataset.py
py
4,619
python
en
code
0
github-code
90
34191516368
"""Testing module graph case study.""" from graph import Graph from copy import deepcopy from dfs import DFS_complete from bfs import BFS_complete from topological_sort import topological_sort from answers import * def read_file(path): """Reads file and generates graph graph.""" # Text file parsing. data...
vbshuliar/Programming_Projects_and_Labs_from_Ukrainian_Catholic_University
02/programming/labs/12_data_structures_graphs/01_graph_map_testing/graph_map_testing.py
graph_map_testing.py
py
2,326
python
en
code
1
github-code
90
8803799392
import sys import json import numpy as np from PIL import Image from glob import glob import os import pandas as pd import albumentations as alb import cv2 def load_json(path): d = {} with open(path, mode="r") as f: d = json.load(f) return d def IoUfrom2bboxes(boxA, boxB): # determine the (x, y)-coordinate...
mapooon/SelfBlendedImages
src/utils/funcs.py
funcs.py
py
3,527
python
en
code
147
github-code
90
31058411493
# 第一种方式:csv文件,建立行列关键词。一个文件保存,太大,不建议。https://www.cnblogs.com/xiaozi/p/10488653.html # 第二种方式:直接写无格式文件。来尝试。f.open() python 写入中文文本文件。 # 关于数据格式问题,选择字典dict方式考虑最合适。 import time # 第一种情况: # f = open("中文输入测试", "rt", encoding="utf-8") # data = f.read() # # print(data) # f.close() # 第二种情况: # with open("中文输入测试", "rt", encoding=...
byst4nder/knowledge-structure
temp/配附/01数据存储和读取.py
01数据存储和读取.py
py
2,451
python
en
code
0
github-code
90
18292809519
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): from itertools import permutations N = int(readline()) P = tuple(map(int, readline().split())) Q = tuple(map(int, readline().split())) d = {x: i for i, x in enumerate(permuta...
Aasthaengg/IBMdataset
Python_codes/p02813/s227841911.py
s227841911.py
py
414
python
en
code
0
github-code
90
18172410499
import sys input = sys.stdin.readline #n = int(input()) #l = list(map(int, input().split())) ''' a=[] b=[] for i in range(): A, B = map(int, input().split()) a.append(A) b.append(B)''' k=int(input()) if k%2==0: print("-1") sys.exit() flg=False cnt=0 a=7 for i in range(k): cnt+=1 a%=k ...
Aasthaengg/IBMdataset
Python_codes/p02596/s060973254.py
s060973254.py
py
418
python
en
code
0
github-code
90
73696376615
import pytest import requests import json import re class TestMethods(): @pytest.yield_fixture() def setUp(self): self.url = "https://samples.openweathermap.org/data/2.5/forecast/hourly?q=London,us&appid=b6907d289e10d714a6e88b30761fae22" response = requests.get(self.url) # Response da...
govind794/APIAutomation
AllTestCase/TestMethods.py
TestMethods.py
py
3,279
python
en
code
1
github-code
90
16144618405
# -*- coding: utf-8 -*- """ 对原始数据进行处理,获取神经网络模型输入的特征值。 @author:chenli0830(李辰) @source:https://github.com/happynoom/DeepTrade """ import numpy import talib from LSTM_LOSS_MODEL.rawdate import read_sample_data class ChartFeature(object): def __init__(self, selector): self.selector = selector ...
flag625/Stock_trade_predition
LSTM_LOSS_MODEL/chart.py
chart.py
py
13,336
python
en
code
0
github-code
90
35224597569
""" TODO: - Sorting by standard deviation: Use coefficient of variation (std/mean) or quartile coefficient of dispersion (Q3 - Q1) / (Q3 + Q1) - Standard deviation for nominal: try out Variation ratio (1 - n_mode/N) """ import datetime from enum import IntEnum from itertools import chain from typing import An...
biolab/orange3
Orange/widgets/data/owfeaturestatistics.py
owfeaturestatistics.py
py
36,801
python
en
code
4,360
github-code
90
6778904582
import pandas as pd from bs4 import BeautifulSoup import re import nltk from nltk.corpus import stopwords from sklearn.ensemble import RandomForestClassifier import pickle def testdata(): test = pd.read_csv("songs_test_set_data.csv") def lyrics_to_words(raw_lyric): lyric_text = BeautifulSoup(raw_lyr...
sohini-roy/major_project
songdata_test.py
songdata_test.py
py
1,974
python
en
code
0
github-code
90
71168343977
""" Clean String DESCRIPTION/CONTEXT --------------------- Orginally, used to remove crap from an email that I got from Google. Here's a small passage of that email: '...<1t1a1b1l1e1 1c1l1a1s1s1=1'1s1i1t1e1s1-1l1a1y1o1u1t1-1n1a1m1e1-1o1n1e1-1c1' Basically, the process was to... 1) Copy email into string.txt 2...
eltonlaw/misc-scripts
clean_string.py
clean_string.py
py
770
python
en
code
0
github-code
90
4399927922
import pygame class Explosion(pygame.sprite.Sprite): def __init__(self, x, y): super(Explosion, self).__init__() self.images = [] for num in range(1,6): img = pygame.image.load(f"./assets/explosion/exp{num}.png") img = pygame.transform.scale(img, (100,100)) ...
ronaldo-ramos-dev/space-ghost
explosion.py
explosion.py
py
1,155
python
en
code
0
github-code
90
18373697819
from collections import deque N, K = map(int, input().split()) X = [list(map(int, input().split())) for _ in range(N - 1)] tree = [[] for _ in range(N + 1)] for a, b in X: tree[a].append(b) tree[b].append(a) MAX = 10 ** 5 + 1 MOD = 10 ** 9 + 7 # Factorial fac = [0] * (MAX + 1) fac[0] = 1 fac[1] = 1 for i in...
Aasthaengg/IBMdataset
Python_codes/p02985/s466569212.py
s466569212.py
py
1,024
python
en
code
0
github-code
90
1622518975
import torch import torch.nn as nn from torch.nn.utils import weight_norm def Conv2d(*args, **kwargs): return weight_norm(nn.Conv2d(*args, **kwargs)) class Encoder(nn.Module): def __init__(self, d_model): super().__init__() model = [ # 28 -> 28 Conv2d(1, d_model, (1,...
lgestin/generative_dl_toy_experiements
vae/unconditional/vae_uncond.py
vae_uncond.py
py
2,785
python
en
code
0
github-code
90
12887079589
# Import statements from datetime import date from django.template.loader import render_to_string from django.db.models import Max, Avg from django.http import JsonResponse import django.utils.datetime_safe from django.shortcuts import render, redirect, get_object_or_404 from item.models import ItemStats from offer.for...
steinarb1234/Fire-Sale
fire_sale/offer/views.py
views.py
py
10,494
python
en
code
0
github-code
90
17967558929
from collections import defaultdict,deque import sys finput=lambda: sys.stdin.readline().strip() def main(): n=int(finput()) edges=[tuple(map(int,finput().split())) for _ in range(n-1)] q,k=map(int,finput().split()) xy=[tuple(map(int,finput().split())) for _ in range(q)] ed=defaultdict(deque) wt=defaultdic...
Aasthaengg/IBMdataset
Python_codes/p03634/s327647374.py
s327647374.py
py
858
python
en
code
0
github-code
90
73875789738
"""beta_vae_train.py""" import argparse import sys import os import torch import torch.nn.parallel from torch.autograd import Variable import torch.optim as optim BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.abspath(os.path.join(BASE_DIR, '../../'))) sys.path.append(os.path.abspath(o...
ArthLeu/beta-capsnet
main/AE/train_ae.py
train_ae.py
py
6,406
python
en
code
0
github-code
90
13002951418
''' 1 10 6 12 8 9 4 1 3 ''' def code(queue): while True: for k in range(1, 5+1): last = queue.pop(0)-k if last <= 0: last = 0 queue.append(last) return queue queue.append(last) T = 10 for tc in range(1, T+1): N = int(i...
hyeinkim1305/Algorithm
SWEA/D3/SWEA_1225_암호생성기.py
SWEA_1225_암호생성기.py
py
592
python
en
code
0
github-code
90
18419573079
#import numpy as np #import functools #import operator #from itertools import combinations as comb #from itertools import combinations_with_replacement as comb_with #from itertools import permutations as perm #import collections as C #most_common #N = int(input()) #N,M= map(int,input().split()) #P = list(map(int,input...
Aasthaengg/IBMdataset
Python_codes/p03073/s288742088.py
s288742088.py
py
604
python
en
code
0
github-code
90
41917554204
# person = ["Quý", 20, 0, "Vĩnh Phúc", 2, ["Manga","Coding"], 3, 20] #dictionary person = { "name": "Quy", "Age": 20, "ex": 0, "favs": ["Manga","Coding"] } # print(person) # name = person["favs"] # print(name) person["length"] = 20 # print(person) person["length"] = 10 # print(person) # key = "le...
duyvukhanh/vukhanhduy-fundamental-c4e18
session5/test.py
test.py
py
585
python
en
code
0
github-code
90
33885507418
""" business days module """ from datetime import timedelta, date from collections.abc import Generator import holidays def business_days_list(start_date: date, end_date: date) -> list[date]: """ business days func """ working_days = [] us_holidays = holidays.UnitedStates() for num in range((end_da...
t4d-classes/advanced-python_04192021
python-demos/datetime_demos/business_days.py
business_days.py
py
1,313
python
en
code
1
github-code
90
44790022216
from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response from math import ceil class PaginationToFrontEnd(PageNumberPagination): """ Paginacao criada para facilitar a implementacao do front-end com algumas novas variaveis retornadas """ page_size = 15 ...
SobrancelhaDoDragao/Sistema-Biblioteca
ApiBiblioteca/Api/pagination.py
pagination.py
py
2,204
python
en
code
5
github-code
90
7462326139
import argparse import os from bs4 import BeautifulSoup from urllib.request import urlopen from urllib.request import URLopener import sanity_check BASE_URL = "http://flibusta.is/sql/" parser = argparse.ArgumentParser(description="Downloads data dumps and converts to sqlite3") parser.add_argument('--skip_downloa...
sgzmd/flibustier
import/importer.py
importer.py
py
1,807
python
en
code
0
github-code
90
8447024767
''' wapp to check if given string are anagrams s1 = listen s2 = silent ''' s1 = input("enter first string ") s2 = input("enter second string ") ls1= sorted(s1) ls2= sorted(s2) if(ls1 == ls2): print("anagram") else: print(" no anagram")
dravya08/workshop-python
L5/p4.py
p4.py
py
241
python
en
code
0
github-code
90
22771344786
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select import time import pyrebase config = { "apiKey": "AIzaSyAHYW60cI1kChuFx3Z__DeLvKBGyrGLkZg", "authDomain": "gnu6-d9c5b.firebaseapp.com", "databaseURL": "https://gnu6-d9c5b-default-rtdb.f...
GoSeongJin/gnu-app
Server_gnu/DB_Initialization.py
DB_Initialization.py
py
2,328
python
en
code
0
github-code
90
17984992819
s=input() an=[] for m in "qwertyuiopasdfghjklzxcvbnm": i=0 d=[len(s)-j for j in range(len(s))] while s.find(m,i)>=0: t=s.find(m,i) for j in range(t+1): d[j]=min(t-j,d[j]) i=t+1 mi=0 for i in range(len(s)): mi=max(mi,d[i]) an.append(max(d)) print(min(an))
Aasthaengg/IBMdataset
Python_codes/p03687/s944262960.py
s944262960.py
py
290
python
en
code
0
github-code
90
35225743429
import os import shutil from argparse import ArgumentParser from os import path as osp from pathlib import Path import pandas as pd def file_info(f): split = f.split('_') cid, assessment, group, date, time, camera = split return cid, assessment, group, date, time, camera def get_data_from_pc(src_root, ds...
TalBarami/SkeletonTools
skeleton_tools/utils/autism_center_data_storage.py
autism_center_data_storage.py
py
3,035
python
en
code
0
github-code
90
35615688597
import hypothesis import numpy as np import pytest from epyg import epyg as epyg from epyg import operators from hypothesis import assume, example, given @pytest.fixture def state(): return epyg.epg() def test_call_multiply(): a = epyg.epg() b = epyg.epg() T = operators.Transform(alpha=90.0, phi=0.0...
brennerd11/EpyG
tests/test_operators.py
test_operators.py
py
2,895
python
en
code
4
github-code
90
12333429097
#!/usr/bin/env python3 # robot_say_hi.py class Robot: def __init__(self, name=None, build_year=None): self.name = name self.build_year = build_year def say_hi(self): if self.name: print("Hi, I am " + self.name) else...
philippdrebes/MSCIDS_PDS01
Pycharm/SW08/exercise/_01_Robots_parts1/robot_say_hi.py
robot_say_hi.py
py
674
python
en
code
0
github-code
90
22945145608
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os from typing import Dict, Any, List from datetime import datetime from collections import Counter from tabun_stat import utils from tabun_stat.processors.base import BaseProcessor class CharsProcessor(BaseProcessor): def __init__(self) -> None: sup...
andreymal/stuff
tabun_stat/tabun_stat/processors/chars.py
chars.py
py
2,376
python
en
code
7
github-code
90
72685904936
import jieba def preprocess(ctx): import re pattern = re.compile(r'\t|\n|\.|-|:|;|\)|\(|\?|" ') ctx = re.sub(pattern, '', ctx) return ctx def readfile(path: str, suff: str = "txt"): with open(path + "." + suff, mode="r", encoding="utf-8") as file: f = file.read() return f def genp...
DaoMingze/yztool
wordart.py
wordart.py
py
2,527
python
en
code
1
github-code
90
18527272609
import sys input=sys.stdin.readline N,C=map(int,input().split()) d=[list(map(int,input().split())) for i in range(C)] c=[list(map(int,input().split())) for i in range(N)] ans=10**18 mod0=[] mod1=[] mod2=[] for i in range(N): for j in range(N): k=(i+j+2)%3 if k==0: mod0.append((i,j)) elif k==1: ...
Aasthaengg/IBMdataset
Python_codes/p03330/s773407191.py
s773407191.py
py
861
python
en
code
0
github-code
90
44187470435
import numpy as np from numpy import linalg as la np.set_printoptions(precision=3) class DiGraph: """A class for representing directed graphs via their adjacency matrices. Attributes: Labellist (list(str)): List of labels for the n nodes in the graph. A_hat ((n,n) ndarray): Th...
Tubnielsen/LinAlg
asg5-pagerank/asg5.py
asg5.py
py
6,777
python
en
code
0
github-code
90
43577004451
class ThreeStacks: def __init__(self, stack_size): self.stack_size = stack_size self.array = [None] * (stack_size * 3) self.tops = [-1, -1, -1] # pointers to the tops of the three stacks def push(self, stack_num, value): if self.is_full(): raise Exception("Stack...
mostafijur-rahman299/cracking-coding-interview-solutions
Stack & Queue/three-in-one-stack.py
three-in-one-stack.py
py
1,966
python
en
code
0
github-code
90
75167582056
import warnings from copy import deepcopy from typing import List, Tuple, Union import qiskit import qiskit.ignis.mitigation.measurement as mit import qiskit.ignis.verification.tomography as tomo from qiskit import QuantumCircuit from qiskit.providers import BaseBackend from qiskit.pulse import InstructionScheduleMap,...
BramDo/custom-cx-gate-on-Casablanca
utils/qpt_utils.py
qpt_utils.py
py
6,278
python
en
code
1
github-code
90
3392942558
import os def writeData(fileName='', data='', openMode='a'): data = data # 'Hello, world' with open(fileName, openMode) as f: data = f.write(data) f.close() def openFile(fileName=''): if fileName != '': with open(fileName, 'r') as f: data = f.read() print...
JasonAlkain/Python_Projects
Test7/importTesting.py
importTesting.py
py
608
python
en
code
0
github-code
90
14117717006
from gambling.trade_checker import payoff_calculator, payoff_for_multiple_parlays, Bet, BetType def test_payoff_calculator_five_bet_flex_five_wins(): lines = [29.5, 32.0, 1.5, 0.5, 4.5] results = [30.0, 31.0, 2.0, 1.0, 4.0] bets = [Bet.OVER, Bet.UNDER, Bet.OVER, Bet.OVER, Bet.UNDER] bet_type = BetType...
RishiChillara/gambling
tests/test_trade_checker.py
test_trade_checker.py
py
2,531
python
en
code
0
github-code
90
19193044767
class Solution: def monotoneIncreasingDigits(self, N: int) -> int: digit = list(str(N)) check = len(digit) for i in range(len(digit) - 1, 0, -1): if digit[i] < digit[i - 1]: k = (int(digit[i - 1]) - 1) digit[i - 1] = str(k) check = ...
23ksw10/LeetCode_Python
738. Monotone Increasing Digits/solution.py
solution.py
py
498
python
en
code
0
github-code
90
3325929128
import torch import numpy as np from torch.utils.data import Dataset import pickle class HandwrittenWords(Dataset): """Ensemble de donnees de mots ecrits a la main.""" def __init__(self, filename): # Lecture du text self.pad_symbol = pad_symbol = '<pad>' self.start_symbol = star...
IliassBour/S7-APP3
dataset.py
dataset.py
py
2,396
python
en
code
0
github-code
90
18403346917
import os import shutil print("************************************************") print("**** SCRPIT DE BACKUP MANUAL COM PYTHON ******") print("* [Autor]: Lucas Martins *") print("* [Versão do Script]: 0.2 *") print("* [Status]: Em desenvolvimento *") print...
lucasmcampos/PythonBackup
ScriptBackup.py
ScriptBackup.py
py
1,516
python
pt
code
0
github-code
90
42801880950
from Layer import Layer import numpy as np class Convolutional(Layer): ''' input_shape: 3d_tensor [channels, width, height] filter_size: 2d_tensor [width_len, height_len] ''' def __init__(self, input_shape, n_filters, filter_size, stride=1): super(Convolutional, self).__init__() as...
kongjiellx/Frech
Layers/Convolutional.py
Convolutional.py
py
1,949
python
en
code
0
github-code
90
27532297779
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import streamlit as st import tensorflow.keras import pickle import os import tensorflow as tf import h5py from wordcloud import WordCloud, STOPWORDS def run_eda_app() : st.subheader('EDA 화면입니다.') st.write('RNN 딥러닝 학습에...
jaechang3456/Stramlit_MySQL_Spam_Classifier
eda_app.py
eda_app.py
py
1,694
python
ko
code
0
github-code
90
72598761896
# - * - coding:utf-8 - * - # - * - coding:utf-8 - * - from django.urls import path,re_path from . import views urlpatterns = [ re_path(r'^$', views.show,name='index_show'), #评论点赞 re_path(r'^comment_affirm/$',views.comment_affirm,name='comment_affirm'), # 博客点赞 re_path(r'^affirm_blog/$',views.affirm_...
ziyiLike/csdn_blog
blog_home/apps/blog/urls.py
urls.py
py
537
python
en
code
1
github-code
90
22156416088
import pandas as pd import numpy as np """Sample Test Data Creation """ x = pd.DataFrame(np.random.random((10,6)), columns=['a','b', 'gradeDetail', 'gradeRecordId', 'lossGivenDefault', 'factorDetai...
velamathi/Utilities
data_generator.py
data_generator.py
py
1,629
python
en
code
0
github-code
90
35219879309
n = int(input()) data = [] for _ in range(n): line = list(map(int, input().split())) if len(line) != n: line = line + [0] * (n -len(line)) data.append(line) for i in range(1, n): for j in range(i+1): data[i][j] += max(data[i-1][j], data[i-1][j-1]) print(max(data[-1]))
yongwoo97/algorithm
silver/1932_정수삼각형.py
1932_정수삼각형.py
py
302
python
en
code
0
github-code
90
18332683389
import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline inputs= sys.stdin.buffer.readlines #rstrip().decode('utf-8') import numpy as np #import operator #import bisect #from heapq import heapify,heappop,heappush #from math import gcd #from fractions import gcd #from collections import deque #from col...
Aasthaengg/IBMdataset
Python_codes/p02889/s676188469.py
s676188469.py
py
1,415
python
en
code
0
github-code
90
10486475246
# range(stop) # range(start, stop) # range(start, stop, step) # we cannot use range() in this scenario s = [0, 1, 4, 6, 13] for i in range(len(s)): print(s[i]) # we can use the above code as v = [0, 1, 4, 6, 13] for i in v: print(i) # Enumerate: # It constructes an iterable of (index, value) tuples around a...
iswetha522/Plural_Sight
corepy/range_and_enumerate.py
range_and_enumerate.py
py
668
python
en
code
0
github-code
90
18588349059
s = input().split('T') dx = list(map(len, s[0::2])) dy = list(map(len, s[1::2])) x, y = map(int, input().split()) def check(start, ds, goal): cands = {start} for d in ds: new_cands = set() for c in cands: new_cands.add(c - d) new_cands.add(c + d) cands = new_cand...
Aasthaengg/IBMdataset
Python_codes/p03488/s468301167.py
s468301167.py
py
443
python
en
code
0
github-code
90
35752496461
#!/usr/bin/env python import sys input= sys.stdin.readline import heapq INF = int(1e9) n,m,k,x = map(int,input().split()) graph = [[] for i in range(n+1)] dist = [INF]*(n+1) for _ in range(m): a,b=map(int,input().split()) graph[a].append((b,1)) def dij(x): q=[] heapq.heappush(q,(0,x)) dist[x]=0 ...
hansojin/python
graph/bj18352.py
bj18352.py
py
722
python
en
code
0
github-code
90
72211290858
def solution(places): def dfs(i, j, depth, trace): if depth == 1 and trace == 'P': result.append(0) return if depth == 2: if trace == 'OP': result.append(0) return for di, dj in dij: ni = i + di nj = j ...
khyunchoi/Algo
Programmers/python/2021 카카오 인턴/test2.py
test2.py
py
1,214
python
en
code
0
github-code
90
41305068184
import re import re # Given path file_path = r"C:\Users\soulo\PaperMate\PaperMate_ui\GUI\source_documents\2307.06435v1.pdf" # Extract the ID using regular expression match = re.search(r'\\(\d+\.\d+v\d+)\.pdf$', file_path) if match: id_with_version = match.group(1) print("Extracted ID with version:", id_with...
Zaheer-10/PaperMate-RecSys
PaperMate_ui/GUI/check.py
check.py
py
365
python
en
code
0
github-code
90
19512175676
''' Usage: python main.py <url> <depth> <modulename> Example: python main.py http://www.pyregex.com/ 3 pyregex ''' import lib.scraper as webscraper import lib.plotter as plotter import os import sys import pickle if __name__ == '__main__': try: _, url, depth, module_name = sys.argv ...
GertMadsen/WebScraper
main.py
main.py
py
1,803
python
en
code
0
github-code
90
29046649416
import unittest import json import csv import sqlite3 from si507_finalproject import * class TestDatabase(unittest.TestCase): def test_restaurants_table(self): conn = sqlite3.connect(DBNAME) cur = conn.cursor() sql_1 = ''' SELECT Name FROM Restaurants WHERE PriceRange = '$' ORDER BY Name DESC '''...
pansyjia/Programming-Final-Project
si507_finalproject_test.py
si507_finalproject_test.py
py
3,381
python
en
code
0
github-code
90
4668978872
#Course: CSCI 4140 #Name: Huan-Yun Chen #Date: 1/29/2018 #Tabs: 8 #The following program is program in Python 3 and Python IDLE #========================================================== import nltk from nltk.corpus import brown #import matplotlib #matplotlib.use('TKagg') from nltk import FreqDist, ConditionalFreqDis...
oliver0616/my_work2
Natural Language Processing/NLTK/Assignment/Assignment1/c2e19.py
c2e19.py
py
2,093
python
en
code
1
github-code
90
7341978148
# -*- coding: utf8 -*- from telebot import TeleBot from telebot.types import ReplyKeyboardMarkup, ReplyKeyboardRemove, KeyboardButton, InlineKeyboardMarkup, InlineKeyboardButton import random import time import requests from pathlib import Path from keyboards import * from date_validator import * from word_validator im...
phony51/LocalSight
bot.py
bot.py
py
46,074
python
ru
code
0
github-code
90
18278525463
#################################################################################################### ## ## Project: Embedded Learning Library (ELL) ## File: buildtools.py ## Authors: Chris Lovett ## ## Requires: Python 3.x ## ####################################################################################...
Crott/ELL
tools/utilities/pythonlibs/buildtools.py
buildtools.py
py
5,899
python
en
code
null
github-code
90
41227617629
from easy_wave import AWG_Writer, REAL_CHANNELS from wave_library import Empty import pyqtgraph as pg def plot_wave(wave, plot_zeros=True, downsample=10, downsample_mode='peak'): win = pg.GraphicsWindow() cs = lambda ch: ['y','b','#FF00FF','g'][ch.value[0]-1] plt = win.addPlot() plt.hideAxis('left') ...
AlexBourassa/Easy-Wave
visual_wave.py
visual_wave.py
py
2,356
python
en
code
0
github-code
90
18420423119
n,k=map(int, input().split()) s=input() def rle(string): _rle_str = string[0] _rle_cnt = 1 _ans_l = [] for _i in range(1, len(string)): if _rle_str == string[_i]: _rle_cnt += 1 else: _ans_l.append([_rle_str, _rle_cnt]) _rle_str = string[_i] ...
Aasthaengg/IBMdataset
Python_codes/p03074/s398939429.py
s398939429.py
py
1,307
python
en
code
0
github-code
90
37137940616
from proj1_helpers import * from implementations import * DATA_TRAIN_PATH = '../data/train.csv' y_train, x_train, ids_train = load_csv_data(DATA_TRAIN_PATH) column_names = np.genfromtxt(DATA_TRAIN_PATH, delimiter=",", dtype=str)[0, 2:] # FEATURE PROCESSING #handle invalid values x_train, column_names = handle_invali...
lichangling3/ML-Project-1
src/run.py
run.py
py
2,276
python
en
code
0
github-code
90
19400166767
import re from http import HTTPStatus from yacut.error_handlers import InvalidAPIUsage from yacut.models import URLMap URL_PATTERN = ( '^https?:\\/{1,2}(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}' '\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*)$' ) SHORT_URL_PATTERN = r'^[a-zA-Z\d]+$' def requir...
iamTroyanskiy/yacut
yacut/api_validators.py
api_validators.py
py
1,603
python
ru
code
0
github-code
90
44019856382
import unittest """ Given a string, find the minimum number of characters to be inserted to convert it to palindrome. Input: ab Output: 1 (bab) Input: aa Output: 0 Input: abcd Output: 3 (dcbabcd) Input: abcda Output: 2 (adcbcda) which is same as insertions for bcd. """ """ Approach 1: 1. Let min_insertions(str, start...
prathamtandon/g4gproblems
DP/min_insertions_to_make_palindrome.py
min_insertions_to_make_palindrome.py
py
1,682
python
en
code
3
github-code
90
18527541609
n = int(input()) total=10*100 def sum_digits(num): sum = 0 while True: if num == 0: break sum += num%10 num //= 10 return sum for a in range(1, n): b = n - a total = min(total, sum_digits(a)+sum_digits(b)) print(total)
Aasthaengg/IBMdataset
Python_codes/p03331/s115336163.py
s115336163.py
py
278
python
en
code
0
github-code
90
71631055016
from django.shortcuts import render, redirect,HttpResponse from .forms import RagistrationForm, LoginForm from django.contrib.auth.models import User from django.contrib.auth import authenticate,login,logout # from django.contrib.auth.forms import UserCreationForm from django.contrib import messages from django.contrib...
Brajesh0/mypoetry
post/views.py
views.py
py
1,872
python
en
code
0
github-code
90
6859123072
while True: n=[int(i) for i in input().split()] r=0 if n==[0,0]: break n_1=n[0] n_2=n[1] if n_1%n_2!=0: if n_2%n_1==0: print("factor") else: print("neither") else: if n_1>n_2: print("multiple")
dltbwoddl/Algorithmuslearning
수학3/배수와 약수.py
배수와 약수.py
py
305
python
en
code
0
github-code
90
22126557089
from django.db import models from django.contrib.auth.models import User from django.utils import timezone class forum_post(models.Model): semester = ( ('I', 'I Semestr'), ('II', 'II Semestr'), ('III', 'III Semestr'), ('IV', 'IV Semestr'), ('V', 'V Semestr'), ('VI',...
Przemoosz/WikipediaUsingDjango
wikipedia/wiki/models.py
models.py
py
1,138
python
en
code
0
github-code
90
15180546770
# Simple Pong in Python3 # Used "turtle module" import turtle import os player1score = 0 player2score = 0 wn = turtle.Screen() wn.title("PONG") wn.bgcolor("black") wn.setup(width = 1280, height = 720) wn.tracer(0) # Paddle A paddle_a = turtle.Turtle() paddle_a.speed(0) paddle_a.shape("square") paddle_a.color("white...
KillerQueen-BitesZaDusto/pythonPong
Pong.py
Pong.py
py
3,020
python
en
code
0
github-code
90
28441415400
#! /usr/bin/env python3 import os import ast import json from difflib import SequenceMatcher from configparser import (ConfigParser, NoSectionError, NoOptionError, DuplicateSectionError) def get_defaults(filename): """Returns a dictionary of the configuration properties""" configs =...
omushpapa/telkombalance
configreader.py
configreader.py
py
7,028
python
en
code
0
github-code
90
7569850737
import unittest from scrapper.bayes import NaiveBayesClassifier from scrapper.utils import load_data from sklearn.naive_bayes import MultinomialNB from sklearn.pipeline import Pipeline from sklearn.feature_extraction.text import TfidfVectorizer class TestNaiveBayesClassifier(unittest.TestCase): def setUp(self): ...
toofnf/dementiy
homework06/tests/test_bayes.py
test_bayes.py
py
5,716
python
en
code
1
github-code
90
17728121871
#! /usr/bin/python __author__ = "Alexander Rush <srush@csail.mit.edu>" __date__ = "$Sep 12, 2012" import json import sys import os import cky """ replace infrequent words Count(x)<5 in parse_train.dat into parse_train.RARE.dat """ class Tree: def __init__(self): self.terminal_count = {}; def count...
Christine-Tan/4705NLP
hw3/parser.py
parser.py
py
3,469
python
en
code
1
github-code
90
18460288919
from collections import deque def main(): H, W = list(map(int, input().split())) S = [input() for _ in range(H)] visited = [[0] * W for _ in range(H)] ans = 0 for h in range(H): for w in range(W): if S[h][w] == '#' or visited[h][w] == 1: continue n_w...
Aasthaengg/IBMdataset
Python_codes/p03157/s765861500.py
s765861500.py
py
1,140
python
en
code
0
github-code
90
41167805408
import subprocess from subprocess import check_output import re def delete_branch(merged): # makes a storage to delete and stores all the ones approved and deletes them all together delete_storage = [] for i in range(len(merged)): t = triple_check(merged[i]) if t: delete_storag...
davidmojica/Q2-Internship
git_tools/Python/remove_merged.py
remove_merged.py
py
3,135
python
en
code
0
github-code
90
4311445597
import abc from historico import Historico from tributavel import Tributavel from excecoes import SaldoInsuficienteError class Conta(abc.ABC): ''' Representação de uma Conta bancária. Atributos: numero: número da conta titular: objeto do tipo Cliente representando o titular da conta saldo: sa...
mvfrasca/Caelum-Python
oo/conta.py
conta.py
py
9,056
python
pt
code
0
github-code
90
70762185578
""" Hacer un programa que pida las calificaciones de 15 alumnos y que nos muestre cuantos han pasado y cuantos reprobaron """ aprobados = 0 reprobados = 0 contador = 0 numero_alumnos = int(input("Cúantos alumnos tienes: ")) while contador < numero_alumnos: calificacion = float(input(f"Escribe la calificación para el ...
AlexSR2590/curso-python
07-ejercicios/ejercicio10.py
ejercicio10.py
py
580
python
es
code
0
github-code
90
9221177261
# coding: utf-8 # # Sistemas Lineales. Metodos directos # Ax=b; A es un array nxn b es un array nx1 import numpy as np import scipy.linalg as scla # El comando para resolver sistemas lineales es solve A = np.array([[1,2,3],[2,4,1],[-1,-1,2]]) b = np.array([[1],[5],[3]]) scla.solve(A,b) # ## Factorizacion LU ...
diegobartolome-proyectos/Ejercicios-matematicos-en-Python
Sistemas_Lineales.py
Sistemas_Lineales.py
py
6,709
python
es
code
0
github-code
90
30387097937
class Solution: def multiply(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ # def str2int(num): # res = 0 # for i in range(len(num)-1, 0, -1): # res += int(num[i]) * pow(10, len(num)-1-i) # re...
VRER1997/leetcode_python
middle/043 Multiply Strings.py
043 Multiply Strings.py
py
1,047
python
en
code
1
github-code
90
19295028042
import sys import pyperclip from PyQt5.QtCore import QRegExp, QObject, QThread, pyqtSignal from PyQt5.QtGui import QRegExpValidator, QIcon from PyQt5.QtWidgets import ( QApplication, QDialog, QMainWindow, QMessageBox, QDialogButtonBox, QLineEdit, QTableWidgetItem, QRadioButton, QFileDialog ) from PyQt5 import QtWi...
kinshukdua/gUPI-recon
app.py
app.py
py
8,188
python
en
code
13
github-code
90
22144001820
import os import skbuild import memtrace uname = os.uname() memtrace_dir = os.path.join(os.path.dirname(__file__), 'memtrace') tracer_dir = os.path.join( memtrace_dir, 'tracer', f'{uname.sysname}-{uname.machine}') memtrace_data = [ 'memtrace.ipynb', ] for dirpath, dirnames, filenames in os.walk(tracer_dir): ...
mephi42/memtrace
setup.py
setup.py
py
1,487
python
en
code
10
github-code
90
71889156457
from flask import Flask, render_template, request from k_nearest_neighbors.k_nearest_neighbors import D2KNearestNeighbors, my_distance, poly_weights_recommend, poly_weights_evaluate from logistic_regression.logistic_regression import D2LogisticRegression from engine import Engine import json URL_PREFIX = '' app = Fla...
Lrisingr/Dota2ML
app.py
app.py
py
1,545
python
en
code
0
github-code
90
70828694056
from tkinter import * def just_buttons(): print("i got clicked") new_text = input.get() my_label.config(text=new_text) window = Tk() window.minsize(width=500, height=300) window.title("button creation") window.config(pady=200, padx=100) button = Button(text="click here", command=just_buttons) ...
reykhalid/Daniel-projects
practice.py
practice.py
py
869
python
en
code
0
github-code
90