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
28642568225
from itertools import product from pprint import pformat import sys def main(): coefficients = [1,4,3,0,1,2] run(*coefficients) def run(*coefficients): for p in [2,3,5]: print(f'\n{p}:\n') results = factor(p, coefficients) for result in results: print(list(result[0]),...
kylesadler/Zn-Polynomial-Factorizer
factorizer.py
factorizer.py
py
3,792
python
en
code
0
github-code
90
7554816405
import requests import base64 import os from pyquery import PyQuery as pq from fake_useragent import UserAgent def us_proxy_crawler(proxy_ip, headers): count = 0 response = requests.get('https://www.us-proxy.org/', headers=headers).text doc = pq(response) rows = doc('tr') for row in rows: ...
Hank-07/proxy-pool
crawler.py
crawler.py
py
4,460
python
en
code
0
github-code
90
18351701689
import sys def input(): return sys.stdin.readline().strip() def main(): n = int(input()) a = list(map(int, input().split())) sum = 0 for i in a: sum += 1/i print(1/sum) main()
Aasthaengg/IBMdataset
Python_codes/p02934/s231832097.py
s231832097.py
py
221
python
en
code
0
github-code
90
13118147899
"""This module contains a Scrapy pipeline class for sending data to the Flask API.""" from http import HTTPStatus from scrapy.exceptions import CloseSpider, DropItem from scrapy.pipelines.images import ImagesPipeline from scrapy.http import Request from app.performance_scraper.performance_scraper.flask_api.api_client...
EricMontague/MailChimp-Newsletter-Project
server/app/performance_scraper/performance_scraper/pipelines.py
pipelines.py
py
5,594
python
en
code
0
github-code
90
18461421409
# B - Frog 2 N,K = map(int,input().split()) h = list(map(int,input().split())) # 無限大の値 INF = 10**10 # DP テーブル dp = [0]*(100010) # DP テーブル全体を初期化 for i in range(100010): dp[i] = INF # 初期条件 dp[0] = 0 for v in range(1,N): for k in range(1,K+1): # 遷移元の足場がないとき if v-k < 0: continue ...
Aasthaengg/IBMdataset
Python_codes/p03161/s190220802.py
s190220802.py
py
507
python
ja
code
0
github-code
90
13640284898
"""Build Helm Geometry file.""" import zlib from BuildClasses import ROMPointerFile from BuildEnums import TableNames from BuildLib import ROMName geo_file = "helm.bin" with open(ROMName, "rb") as rom: geo_f = ROMPointerFile(rom, TableNames.MapGeometry, 0x11) rom.seek(geo_f.start) data = rom.read(geo_f....
2dos/DK64-Randomizer
base-hack/Build/create_helm_geo.py
create_helm_geo.py
py
748
python
en
code
44
github-code
90
5286885321
import numpy as np import glob import json from tqdm import tqdm import string from nltk.tokenize import regexp_tokenize from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer from gensim.models import KeyedVectors print("Downloading the wordnet from nltk...") import nltk nltk.download('wordnet') ...
sidthakur08/article_search
on_technology_data/sent_vec.py
sent_vec.py
py
1,926
python
en
code
3
github-code
90
37947130429
import sys sys.path.append('../py') from iroha import * from iroha.iroha import * d = IDesign() mod = IModule(d, "mod") def CreateTable(mod): tab = ITable(mod) st0 = IState(tab) st1 = IState(tab) tab.initialSt = st0 design_tool.AddNextState(st0, st1) tab.states.append(st0) tab.states.appe...
nlsynth/iroha
examples/dataflow_chain.py
dataflow_chain.py
py
1,773
python
en
code
34
github-code
90
4399933302
import pygame from settings import SCREEN_HEIGHT, SCREEN_WIDTH, PLAYER_SPEED from projectile import Projectile from pygame.locals import ( RLEACCEL, K_UP, K_DOWN, K_LEFT, K_RIGHT, K_ESCAPE, KEYDOWN, QUIT, ) class Player(pygame.sprite.Sprite): def __init__(self): supe...
ronaldo-ramos-dev/space-ghost
player.py
player.py
py
1,574
python
en
code
0
github-code
90
1117458028
#!/usr/bin/python3 import os import json import packages.configuration_generator as cg root_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) config_file = os.path.join(root_dir, 'config.json') if not os.path.isfile(config_file): cg.__main__() with open(config_file, ...
edimusxero/Comic-Grabber
packages/shared_variables/__init__.py
__init__.py
py
1,502
python
en
code
0
github-code
90
3360877674
# -*- coding: utf-8 -*- ''' last modified 2012-9-29 @author: slieer ''' class Person: i = 10 def __init__(self, name): self.name = name def sayHi(self): print('Hello, my name is', self.name) def f1(self,x, y): return min(x, x+y) class C: f = f1 def g(self):...
slieer/py
py-dev-study/src/simple/class_init.py
class_init.py
py
769
python
en
code
1
github-code
90
18426577839
#-*-coding:utf-8-*- import sys input=sys.stdin.readline def main(): strings = input() answers=[] counter=0 for string in strings: if "A" in string or "C" in string or "G" in string or "T" in string: counter+=1 else: answers.append(counter) counter=0 ...
Aasthaengg/IBMdataset
Python_codes/p03086/s004056038.py
s004056038.py
py
381
python
en
code
0
github-code
90
20292200280
#!/usr/bin/env python # -*- coding: UTF-8 -*- # # get text from BeautifulSoup # from BeautifulSoup import BeautifulSoup, Comment import re import urllib,urlparse,cgi def remove_params(url=None,remove=None,keep_only=None): """ remove parameters from a url remove : tuple of parameters to remove, keep a...
nod/boombot
plugins/webutil/textutils.py
textutils.py
py
4,643
python
en
code
11
github-code
90
9593403320
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Mar 22 12:00:37 2020 @author: tianyu """ import numpy as np import pandas as pd import scipy.sparse as sp import torch from sklearn.preprocessing import Normalizer import math from torch.autograd import Variable import torch.nn.functional as F import t...
tianyu-github/sigGCN
lib/utilsdata.py
utilsdata.py
py
27,784
python
en
code
0
github-code
90
15274255457
class Solution: def numIslands(self, grid: List[List[str]]) -> int: if not grid: return 0 visited = set() island = 0 ROW, COL = len(grid), len(grid[0]) def bfs(row,col): q = collections.deque() visited.add((row,col)) q.append...
kelvinleong0529/Leet-Code
200-number-of-islands/200-number-of-islands.py
200-number-of-islands.py
py
963
python
en
code
3
github-code
90
28230562521
import json import tldextract from pprint import pp from retrieval_importance import learn_importance, encode_retrievals, encode_groups, v_grouped, \ most_important_groups, least_important_groups from retrieval_importance import cal_acc, generate_val_test_set, sort_values, get_retain_urls, cal_acc_reweight, cal_loo...
amsterdata/retrieval_importance
webquestions.py
webquestions.py
py
6,864
python
en
code
0
github-code
90
3443788854
#!/usr/bin/env python3 import random import re from flask import Flask, jsonify from flask_cors import CORS from pymongo import MongoClient MONGO_URI = 'mongodb://admin:aaWyedsDgy03jcLc@cluster0-shard-00-00-kwnae.gcp.mongodb.net:27017,cluster0-shard-00-01-kwnae.gcp.mongodb.net:27017,cluster0-shard-00-02-kwnae.gcp.mon...
amanj120/WordsWordsWords
main.py
main.py
py
2,236
python
en
code
0
github-code
90
18215003959
import itertools n, m, x = map(int, input().split()) ca = [] for _ in range(n): ca.append(list(map(int, input().split()))) prices = [] best_skill = [0]*m for i in range(1, n+1): n_list = [i for i in range(n)] for N in itertools.combinations(n_list, i): skill = [0]*m price = 0 for j ...
Aasthaengg/IBMdataset
Python_codes/p02683/s842849211.py
s842849211.py
py
546
python
en
code
0
github-code
90
7927881591
SHRIMP_MINVER = (0, 1, 0, ) SHRIMP_PLATFORM = ('all', ) SHRIMP_INFO = { 'name': u'江大侠', 'ver': u'0.1.0', 'author': [ u'\u738b\u96ea\u745e@\u6570\u5a92\u5b66\u9662 (xenon@JNRain)', u'\u5c0fC@\u6570\u5a92\u5b66\u9662 (TheC@JNRain)', u'\u848b\u9a04\u5929@\u7269...
xen0n/gingerprawn
gingerprawn/shrimp/lobster/lobster_main.py
lobster_main.py
py
13,109
python
en
code
1
github-code
90
19031015460
import torch import torch.nn.functional as F from math import exp def gaussian(window_size, sigma): gauss = torch.Tensor([exp(-(x - window_size//2)**2/float(2*sigma**2)) for x in range(window_size)]) return gauss / (gauss.sum()) def create_window(window_size, channel): _1D_window = gaussian(window_size,...
makedede/MEFNet
mefssim.py
mefssim.py
py
5,525
python
en
code
68
github-code
90
72344172776
from copy import deepcopy from typing import TYPE_CHECKING from loguru import logger if TYPE_CHECKING: from simpsom import SOMNet class EarlyStop: """ Monitors the convergence of a map and activates a switch to interrupt the training if a certain tolerance map difference threshold is hit. Warni...
fcomitani/simpsom
simpsom/early_stop.py
early_stop.py
py
2,598
python
en
code
152
github-code
90
7171795377
''' Interpolation Package MAINLY USING FOR TERM STRUCTURE ''' def linear(R1,t1,R2,t2,t) : ''' input : R1,R2: the interest rate of two terminals of the interval t1,t2: the time point of the two terminals and t1<t2 t: the time point of the interpolated interest rate output : R: ...
whyecofiliter/Options
interpolation.py
interpolation.py
py
21,040
python
en
code
3
github-code
90
554785275
def blue(text): blue_text = "" for character in text: blue_text += f"\033[38;2;0;0;255m{character}\033[0m" return blue_text def green(text): green_text = "" for character in text: green_text += f"\033[38;2;0;255;0m{character}\033[0m" return green_text def orange(text): or...
Benzo-Fury/PyBet
Utility/Colour/colour.py
colour.py
py
1,394
python
en
code
1
github-code
90
641131581
import os.path def task(): print(f"Лабораторная работа №3\nВариант №6. Выполнила студентка группы 6101-090301D Горбунцова А.А\nЗадание: " f"написать программу, которая для каждой строки исходного файла будет выводить в результирующий файл " f"последовательность цифр\n('0','1'..'9') из входной ...
litirnntir/lab-py-1sem
lab3.py
lab3.py
py
1,690
python
ru
code
0
github-code
90
21199653031
# You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. # You may assume the two numbers do not contain any leading zero, except the number 0 itsel...
endermeihl/ender.github.io
leetcode2023/L2.py
L2.py
py
1,302
python
en
code
0
github-code
90
43334129656
#!/usr/bin/env python3 import sys from operator import add, mul def run(p): pc = 0 while p[pc] != 99: opcode, in1, in2, out = p[pc:pc + 4] op = add if opcode == 1 else mul p[out] = op(p[in1], p[in2]) pc += 4 def initrun(p, noun, verb): p = list(p) p[1:3] = noun, verb ...
taddeus/advent-of-code
2019/02_intcode.py
02_intcode.py
py
708
python
en
code
2
github-code
90
8589183275
import os import difflib from gi.repository import Gtk as gtk from gi.repository import WebKit as webkit from parsers.trs_parser import TRSParser from utils.ui_utils import UIUtils from utils.progress_dialog import ProgressDialog from utils.backend_utils import BackendUtils from ui.verifier_app.diff_win import DiffWin...
babylanguagelab/bll_app
wayne/ui/verifier_app/open_pair_window.py
open_pair_window.py
py
6,766
python
en
code
0
github-code
90
28008451984
from __future__ import print_function from __future__ import division import numpy as np import numpy.linalg as la import numbers np.set_printoptions(precision=3) import matplotlib.pyplot as plt import scipy.fftpack as spfft #import time #import itertools from abc import abstractmethod import pywt try: from itert...
MartKl/CS_image_recovery_demo
pit.py
pit.py
py
12,178
python
en
code
28
github-code
90
18086279303
# -*- coding: utf-8 -*- import os import numpy as np import pandas as pd import xgboost as xgb import warnings warnings.filterwarnings('ignore') # 不显示警告 os.environ["TF_CPP_MIN_LOG_LEVEL"] = '3' def prepare(dataset): # 复制 data = dataset.copy() # 折扣处理 data['is_manjian'] = data['Discount_rate'].map(l...
sarailQAQ/ml-prac
main.py
main.py
py
18,279
python
en
code
0
github-code
90
32923533752
Name = [] Set = [] def read_data(inF,name): Name.append(name) L = [] inFile = open(inF) for line in inFile: line = line.strip() fields = line.split('\t') L.append(fields[0]) inFile.close() Set.append(set(L)) read_data('split-mapped-deletion.normal.seq.filtered.num.gene.m...
wanghuanwei-gd/SIBS
RNAseqMSMS/21-rna-seq-stats/13-set.py
13-set.py
py
715
python
en
code
0
github-code
90
21317189815
import pickle import torch import torch.nn as nn with open('train.feature.pickle', 'rb') as f: train_vectors = pickle.load(f) class Net(nn.Module): def __init__(self): super().__init__() self.fc = nn.Linear(300, 4) nn.init.xavier_normal_(self.fc.weight) def forward(self, x): ...
KazumaAkiyama/100knocks
第8章/Net_8_71.py
Net_8_71.py
py
817
python
en
code
0
github-code
90
18189626499
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines import numpy as np def main(): n = int(input()) if n == 1: print(1) sys.exit() divs = np.arange(1, n + 1) divs2 = n // divs divs3 = divs2 * (divs2 + 1) // 2 divs3 = divs3 * divs r =...
Aasthaengg/IBMdataset
Python_codes/p02624/s370921365.py
s370921365.py
py
385
python
en
code
0
github-code
90
40065524104
from typing import Dict, List from einops import rearrange import torch import torch.nn as nn import torch.nn.functional as F from collections import defaultdict from dynamic_stereo.models.core.update import ( BasicUpdateBlock, SequenceUpdateBlock3D, TimeAttnBlock, ) from dynamic_stereo.models.core.extrac...
facebookresearch/dynamic_stereo
models/core/dynamic_stereo.py
dynamic_stereo.py
py
16,065
python
en
code
132
github-code
90
12551281505
""" The HaxBall gym environment. """ from typing import Dict, List, Tuple, Union import numpy as np from gym import Env from haxballgym.envs.match import Match class Gym(Env): def __init__(self, match: Match): super().__init__() self._match = match self.observation_space = match.ob...
HaxballGym/HaxballGym
haxballgym/gym.py
gym.py
py
2,812
python
en
code
8
github-code
90
30642300843
def wordBreak(s, wordDict): table = [False] * (len(s) + 1) table[0] = True for i in range(0, len(table)): if (table[i] == True): for j in range(i + 1, len(table)): word = s[i:j] if word in wordDict: table[j] = True return table[-1] n = wor...
tombetthauser/aa_october_cohort_files_2
classworks/test.py
test.py
py
395
python
en
code
0
github-code
90
71719502698
#!/usr/bin/env python3 import argparse def do_argparse(): parser = argparse.ArgumentParser( description="Prints the number of unique strings " + "separated by newlines in a file." ) parser.add_argument("file", help="path to a valid file") return parser.parse_args() def main(): a...
kenny-kelley/cli-utilities
get-set-size.py
get-set-size.py
py
670
python
en
code
0
github-code
90
32613626998
import xlrd import dishsql import re import os import datetime import thedish import jinja2 import codecs def render(tpl_path, context): path, filename = os.path.split(tpl_path) return jinja2.Environment( loader=jinja2.FileSystemLoader(path or './') ).get_template(filename).render(context) def up...
brunobeltran/the-dish-on-science
cgi-bin/dishutil.py
dishutil.py
py
3,047
python
en
code
0
github-code
90
15086601210
from app.forms.login_form import LoginForm from datetime import date, timedelta from app import application, login_manager from flask import session, redirect, render_template, flash, redirect, url_for from flask_login import login_required, login_user, logout_user, current_user import bcrypt from app.models.produtor...
pedroferronato/gerenciamento-rural
app/controllers/server_controller.py
server_controller.py
py
4,685
python
pt
code
0
github-code
90
9268077410
import json import os from statistics import mean from typing import Dict, Union from collector import DATA_FILE class SolarProvider: forecasts: Dict def __init__(self): if not os.path.isfile(DATA_FILE): self.forecasts = {} else: with open(DATA_FILE, "rb") as file: ...
frak/energy-advisor
solar_provider.py
solar_provider.py
py
721
python
en
code
1
github-code
90
7266480536
import json import random, string import Geohash from app.util import Sample def pin_lst(_x, _y) : lst = list() try : for i in range(0, 10) : x = float(_x) + ( random.choice([-1, 1]) * random.randrange(0,9) / 1000 ) + ( random.choice([-1, 1]) * random.randrange(0,9) / 10000 ) ...
korMaple0428/firebase-in-flask
app/util/Test.py
Test.py
py
1,259
python
en
code
0
github-code
90
21944446776
# --- # jupyter: # jupytext: # formats: ipynb,py:percent # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.14.2 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- # %% [ma...
rambalachandran/ISLR
py_notebooks/Chapter 3.py
Chapter 3.py
py
13,186
python
en
code
0
github-code
90
1789223655
# https://www.geeksforgeeks.org/greedy-algorithm-to-find-minimum-number-of-coins/ def findMin(V): coins = [1,2,5,10,20,50,100,500,1000] n=len(coins) res=[] for i in range(n-1,-1,-1): while V>=coins[i]: V-=coins[i] res.append(coins[i]) print(res) # Driver Code ...
danish-faisal/Striver-s-SDE-Sheet
Greedy - Day 8/min-coins-using-greedy.py
min-coins-using-greedy.py
py
459
python
en
code
0
github-code
90
11162324300
from flask import Flask, render_template, Response,url_for,redirect,jsonify from main import out import time import cv2 app = Flask(__name__) m = False @app.route('/') def index(): while True: global m return render_template('index.html',enable = m) @app.route('/huh') def test(): ...
NeelGaji/online-attendance
web.py
web.py
py
983
python
en
code
1
github-code
90
18114231179
N,K = map(int,input().split()) W = [] for _ in range(N): W.append(int(input())) def is_OK(P): track_index = 0 w_index = 0 while w_index < N and track_index < K: tmp_sum = 0 while w_index < N and tmp_sum+W[w_index] <= P: tmp_sum += W[w_index] w_index += 1 ...
Aasthaengg/IBMdataset
Python_codes/p02270/s962445463.py
s962445463.py
py
567
python
en
code
0
github-code
90
18021614479
# https://atcoder.jp/contests/abc054/submissions/4360181 def main(): from collections import defaultdict INF = 40 * 100 + 1 N, Ma, Mb = map(int, input().split()) memo = defaultdict(lambda: INF) for _ in range(N): ai, bi, ci = map(int, input().split()) x = Ma * bi - Mb * ai # Σa...
Aasthaengg/IBMdataset
Python_codes/p03806/s328835675.py
s328835675.py
py
676
python
en
code
0
github-code
90
36127095180
import multiprocessing import os import random from math import * from NetworkV2 import * # def calculate(value): # return value * 10 # # if __name__ == '__main__': # pool = multiprocessing.Pool(None) # tasks = range(10000) # results = [] # r = pool.map_async(calculate, tasks, callback=results.appe...
NetLab/reservation-testbed
TestController.py
TestController.py
py
1,887
python
en
code
1
github-code
90
37085421051
import numpy as np import cv2 img = cv2.imread("p2.jpg") def bgrtogray(image,r,g,b): # blue = [0] 7% # green = [1] 72% # red = [2] 21% grayValue = r * image[:,:,2] + g * image[:,:,1] + b * image[:,:,0] # convert uint8 to image gray gray_img = grayValue.astype(np.uint8) return g...
overzon/image_processing
lab1/bgrtogray.py
bgrtogray.py
py
808
python
en
code
0
github-code
90
6257770959
#!/usr/bin/env python # -*- charset utf8 -*- # from https://gist.github.com/netom/8221b3588158021704d5891a4f9c0edd import pyaudio import numpy import tkinter as tk from PIL import Image, ImageTk from util.spectrogram_generator import Params, generator VERBOSE = True class MicrophoneDisplayer: def __init__(self,...
colaprograms/speechify
util/mic_display.py
mic_display.py
py
3,557
python
en
code
7
github-code
90
5280114668
import requests def get_subdomains(domain): url = "https://api.hackertarget.com/hostsearch/?q="+domain subd = [] res = requests.get(url) for line in res.text.split("\n"): subd.append(line.split(",")[0]) return subd
Fundacio-i2CAT/InfoHound
infohound/tool/data_sources/hacker_target.py
hacker_target.py
py
224
python
en
code
123
github-code
90
72106055018
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: Heming """ import numpy as np from naivebayesPY import naivebayesPY from naivebayesPXY import naivebayesPXY def naivebayes(x, y, x1): # ============================================================================= #function logratio = naivebayes(x,y,x1); # #...
heming-zhang/MachineLearning-Projects
project2/naivebayes.py
naivebayes.py
py
1,952
python
en
code
0
github-code
90
45144534626
import hmac import json from hashlib import sha512 from io import BytesIO from time import time from urllib.parse import urlencode from twisted.logger import Logger from twisted.internet import reactor, defer from twisted.web.client import Agent, HTTPConnectionPool, readBody, \ FileBodyProducer, ContentDecoderAge...
congruency/txpoloniex
txpoloniex/base.py
base.py
py
2,581
python
en
code
2
github-code
90
42658622233
#region """ + = concatenation (birleştirme) * = replication (tekrarlama) """ a = "A" b = "B" c = "C" yaz = a + b + c print (yaz) ad= "Büşra" soyad = "Derbazlar" print(ad + " " + soyad) print("-"*50) #bukadarkez tekrarla demek print("aziz"*3)
busraderbazlar/VS-Code-Pyhton
01_python_giris/0127_string_operatorleri.py
0127_string_operatorleri.py
py
249
python
tr
code
0
github-code
90
26745773907
import sys import re prefixes = ["fix", "feat", "release"] def main(): pr_title = sys.argv[1] prefix = pr_title.split("(")[0] if prefix not in prefixes: exit_with_error() subject = pr_title.split(prefix)[1] if re.match('\(R-(\d+)\):', subject) is None: exit_with_error() def exit_...
sutirthak/validate-pr-title
verify-pr.py
verify-pr.py
py
642
python
en
code
0
github-code
90
73404950696
# get the two binary inputs separated by spaces bnum1, bnum2 = input("Enter two binary numbers: ").split() # get the maximum length among the two binaries max_len = max(len(bnum1), len(bnum2)) # fill out the zeros of those shorter binary numbers bnum1 = bnum1.zfill(max_len) bnum2 = bnum2.zfill(max_len) result = '' ...
arielmagbanua/python-training
exercises/binary_subtraction.py
binary_subtraction.py
py
909
python
en
code
2
github-code
90
70910171497
class Solution: def reconstructQueue(self, people): # 两个维度需要考虑,先排序搞定其中一个,在解决另一个维度 # 先按照身高降序排序 按照k升序排列 前面的人身高一定比后面的高 people.sort(key=lambda x:(-x[0], x[1])) print(people) result = [] n = len(people) for i in range(n): result.insert(people[i][1], pe...
Ericshunjie/algorithm
贪心算法/406根据身高重建队列.py
406根据身高重建队列.py
py
560
python
zh
code
0
github-code
90
39175338540
''' pre-processing.py Author: Adam Swart Pre-processing to normalise MCQ sheets ''' import cv2 import os import numpy as np import cvutils import math from operator import itemgetter ''' Finds the corners in an image ''' def findCorners(img): img2 = img.copy() template = cv2.imread('images/templates/cnr_templ...
Swartacus/IP
Project - MCQ/pre_processing.py
pre_processing.py
py
2,804
python
en
code
0
github-code
90
6768975870
import sqlite3 import pytz import datetime db = sqlite3.connect("accounts.sqlite", detect_types=sqlite3.PARSE_DECLTYPES) db.execute("CREATE TABLE IF NOT EXISTS accounts (name TEXT PRIMARY KEY NOT NULL, balance INTEGER NOT NULL)") db.execute("CREATE TABLE IF NOT EXISTS history (time TIMESTAMP NOT NULL, " "ac...
ZhaoyangChen101/Python-Course
database/RollingBack/rollback.py
rollback.py
py
5,693
python
en
code
0
github-code
90
33544404579
import telebot import random import functools def my_map(func, iterable): result = [] for item in iterable: result.append(func(item)) return result numbers = [1, 2, 3, 4, 5] squared_numbers = my_map(lambda x: x**2, numbers) print(squared_numbers) def repeat(times): def decorator(func): ...
SKYWWALKER777/GB_Python
homework-07.py
homework-07.py
py
1,575
python
en
code
0
github-code
90
16302577972
import numpy as np import glob import logging import subprocess as sub import os from astropy import units as u from astropy.coordinates import SkyCoord from astropy.io import fits logging.basicConfig(filename='FitsToCats.log', filemode='w', format='%(levelname)s:%(message)s', ...
KamilRaczka12/Analyze-fits
FitsToCats.py
FitsToCats.py
py
5,322
python
en
code
0
github-code
90
41463447234
#Author guo #利用条件算数符学习成绩》=90 A points=int(input("请输入学生成绩")) if points>=90: grade='A' elif points<60: grade="C" else:grade='B' print(grade) #这个题目要设置边界条件 #设计测试用例 #输入的学生成绩 #1.非数字型 预期期望为输出 输入类型错误 #2.数字型 但》100或者小于0 输入提示范围 #3.输入的为边界值 #4.输入的为小数值 转换为int是可以的,因为只保留整数部分,靠整数部分来进行判定
guojia60180/guo.github-io
python实例/分数归档.py
分数归档.py
py
516
python
zh
code
0
github-code
90
9546215256
from manim import * class M1_part1(Scene): def construct(self): M1_formula_1 = MathTex(r"V_A \derivative{P_A}{t}=\dot V_A(P_I-P_A)+\lambda Q(P_v^*-P_a) \tag{1}").shift(UP * 3) M1_formula_2 = MathTex(r"V_m \derivative{P_m}{t} = \frac {M_m} {k} + Q_m(P_a^*-P_m) \tag{2} ").shift(UP * 1.5) M1...
TwilightSpar/CO2_Manim
M1_part1.py
M1_part1.py
py
5,963
python
en
code
0
github-code
90
18336540849
import numpy as np def divisor(n): i = 1 table = [] while i * i <= n: if n%i == 0: table.append(i) table.append(n//i) i += 1 table = list(set(table)) table = sorted(table) return table def make_prime(U): is_prime = np.zeros(U,np.bool) is_prime[2...
Aasthaengg/IBMdataset
Python_codes/p02900/s360824964.py
s360824964.py
py
867
python
en
code
0
github-code
90
74934323176
import os import cv2 root_dir = "D:/BaiduNetdiskDownload/image/CMEImages/NoCME" target_dir = "D:/BaiduNetdiskDownload/image/CMEImages/NoCME_polar" os.makedirs(target_dir, exist_ok=True) index = 0 for filename1 in os.listdir((root_dir)): index += 1 filename = os.path.join(root_dir, filename1) img = cv2.imre...
bazingayu/machineLearningGroupProject
transform_to_polar.py
transform_to_polar.py
py
618
python
en
code
2
github-code
90
74214505576
from PIL import Image, ImageDraw, ImageFont import os from io import BytesIO import requests # meme_there = os.path.isfile("worthless.jpg") # if meme_there: # os.remove("worthless.jpg") def worthless(name): name = name image = Image.open('./assets/worthless/meme.jpg') draw = ImageDraw.Draw(image) fontsize = 32...
Araon/AraonJR
helper.py
helper.py
py
1,597
python
en
code
1
github-code
90
35782490035
import tkinter as tk from tkinter import ttk from tkinter import messagebox import sqlite3 as sq # объявляем главный класс class Main(tk.Tk): def __init__(self): super().__init__() self.db = db self.btns() self.treeview() self.view_records() #добавля...
Dispondi/final-dz
main.py
main.py
py
9,861
python
ru
code
0
github-code
90
44569732885
#!/usr/bin/python3 import numpy as np import tensorflow as tf import sys from os.path import join from sklearn.utils import shuffle from utils import conv_layer, fc_layer from utils import Cursors from sklearn.decomposition import PCA ############################################# ############### IMPORT DATA ########...
TalarG/challenge-mdi341
challenge_main.py
challenge_main.py
py
22,298
python
en
code
0
github-code
90
5487666997
# Write a merge sort algorithm to sort an array. # The function should return the sorted array. # two examples array1 = [45, 98, 3, 24, 15, 77, 9, 50] # output: [3, 9, 15, 24, 45, 50, 77, 98] array2 = [18, 16, 27, 4, 12] # output: [4, 12, 16, 18, 27] import math def mergeSort(arr): mergeSortTwo(arr, 0, len(arr)-...
kandelin16/TechnicalInterviewCourse
Class_06_Frontend_Interviews_And_Merge_Sort/Frontend_Interviews_and_Merge_Sort_Homework/Problems/merge_sort_problem.py
merge_sort_problem.py
py
979
python
en
code
null
github-code
90
31744423360
# -*- coding:utf-8 -*- # 需要用到api 直接从__init__里面导过来无需重复创建api对象 from flask.json import jsonify from . import api @api.route('/login') def login(): my_dict = { 'name': 'aaa', 'age': 18, } # jsonify 命名参数和传字典都会转换为json对象 return jsonify(my_dict) # return '123'
qq453388937/Flask_ihome_Git
ihome/api/login.py
login.py
py
363
python
zh
code
0
github-code
90
6812271420
import sys from PyQt5.QtWidgets import QApplication, QMainWindow from GUI.Login import Login if __name__ == "__main__": app = QApplication([]) index = QMainWindow() main_window = Login() main_window.setup_ui(index) index.show() sys.exit(app.exec_())
alexlealr/Software_Horarios_UQ
GUI/Main.py
Main.py
py
276
python
en
code
0
github-code
90
72211386858
# 라빈-카프 : 시간초과, KMP : 해결 # 배운 이론을 토대로 코드를 작성했으나 시간초과가 나는 이유를 알 수 없다. # 코드상으로 O(n)이 소요되는 것 같은데 내가 간과한 무엇인가가 있는 것 같다. # 같은 문자열인지 비교하는 for 같은 경우에는 해시값이 충돌하는 문자열이 # 거의 없기 때문에 웬만하면 한 번에 끝이 난다. S = input() P = input() result = 0 value_S, value_P = 0, 0 n = len(P) arr = [i for i in range(n-1, -1, -1)] for i in ra...
khyup0629/Algorithm
라빈 카프(Rabin-Karp)/부분 문자열(★★★).py
부분 문자열(★★★).py
py
1,210
python
ko
code
3
github-code
90
12202794700
from mainfuncs import * def main(): ip_add = extract_ip() cont = True while cont: try: choice = int(input("Would you like to do a quick sweep or extensive sweep? Type 1 for quick or 2 for extensive\n(Note: An extensive sweep will take longer, but be more accurate, especially for devices that take a while to re...
Velocities/ping-sweep
main.py
main.py
py
581
python
en
code
0
github-code
90
2744655096
from collections import namedtuple from typing import Tuple from algorithm import Genome, List Thing = namedtuple('Thing', ['name', 'value', 'weight']) ThingList = List[Thing] max_weight = 3000 first_example = [ Thing('Laptop', 500, 2200), Thing('Headphones', 150, 160), Thing('Coffee Mug', 60, 350), ...
weszerzad/genetic_algorithm
knapsack_problem/knapsack_problem.py
knapsack_problem.py
py
1,604
python
en
code
0
github-code
90
15773360896
gyldig = False while not gyldig: tall = input("Skriv et tall: ") try: tall = int(tall) gyldig = True except ValueError: print("Du må skrive inn et heltall.") print(f"Du skrev inn {tall}.")
hausnes/IT2-2023-2024
intro-serie/validering_av_input.py
validering_av_input.py
py
228
python
no
code
1
github-code
90
11366524811
import os import subprocess import matplotlib.pyplot as plt import numpy as np os.system("cmake . -B build/") threads = 1 os.chdir("build") print("make") os.system("make") accelerations = [] efficiencies = [] sizes = [] threads = 1 cmd = "./Integral " + str(threads) + " 0.000000001" result = subpro...
KhankharaevArdan/lab2
acceleration.py
acceleration.py
py
1,721
python
en
code
0
github-code
90
18340567779
#C - Attack Survival N,K,Q = map(int,input().split()) A = list(int(input()) for i in range(Q)) score = [0]*(N) for i in range(Q): score[A[i]-1] += 1 score = [(K-Q+j) for j in score] for k in score: if k > 0: print('Yes') else: print('No')
Aasthaengg/IBMdataset
Python_codes/p02911/s406077652.py
s406077652.py
py
266
python
en
code
0
github-code
90
1420852452
class Node: def __init__(self, data): self.data = data self.ref = None class LinkedList: def __init__(self): self.head = None def print_LL(self): if self.head is None: print("Linked list is empty") else: n = self.head while n is ...
AswathiMohan23/Python_Basics
LinkedList/single_linkedList.py
single_linkedList.py
py
1,939
python
en
code
0
github-code
90
2205831950
import sys from random import * import matplotlib.pyplot as plt import numpy as np import scipy.ndimage import scipy.signal import scipy.special from keras.datasets import mnist class MyNN: def __init__(self, rate, inputs, hiddens, outputs): # добавляем один вход под bias self.i_count = inputs + ...
makaryb/nn2s5k
lab1/src/mnistWorker.py
mnistWorker.py
py
5,079
python
ru
code
0
github-code
90
35985437085
import torch import torch.nn as nn from .arches import conv3x3, conv5x5, ResBlock from thop import profile class RNNCell(nn.Module): def __init__(self, dual_cell=True): super(RNNCell, self).__init__() self.dual_cell = dual_cell # F_B: blur feature extraction part self.F_B = nn.Sequ...
zzh-tech/ESTRNN
model/IFIRNN.py
IFIRNN.py
py
3,298
python
en
code
273
github-code
90
11518305369
t = int(input()) for i in range(t): n = int(input()) mxa = 0 mxb = 0 k = input().split() # print(k) k = [int(i) for i in k] k = sorted(k) # print(k) mxa = 0 mxb = 0 for i in k: if i>=mxa: mxb = mxa mxa = i if mxa - mxb > 1: p...
Sagor31h2/LeetcodeGroup
Rimon/Codeforces/div3_780_b.py
div3_780_b.py
py
362
python
en
code
0
github-code
90
19318369247
import cv2 import numpy as np import os from PIL import Image in_dir = "./result/pre/" out_dir = "./result/postprocessor_pre/" if not os.path.exists(out_dir): os.makedirs(out_dir) for file_name in os.listdir(in_dir): file_path = in_dir + file_name # read gray image img_orign = cv2.imread(file_path,...
tangzhenjie/KnifeGate_Pan
postprocessor.py
postprocessor.py
py
1,020
python
en
code
0
github-code
90
2481758781
def make_shirt(size='L', word="I love Python"): print(f"The shirt's size is: {size}, word is {word}.") make_shirt("M", "Hello world") make_shirt() make_shirt("M") make_shirt(word='I love Java') make_shirt(size='S') def describe_city(city_name='beijing', country_name='china'): print(f"{city_name.title()} is ...
kopstill/python-crush-course-2nd-edition
chapter_8/exercises.py
exercises.py
py
524
python
en
code
0
github-code
90
23005318301
import json import logging import os import re import sqlalchemy import sys import zipfile from gi.repository import GLib, Gio, Gtk, WebKit2 from .models import create_session from .web_view_api import WebViewApi from . import utils logger = logging.getLogger(__name__) APPLICATION_NAME = "Kolibri WebView Demo" cl...
endlessm/kolibri-webview-demo
kolibri_webview_demo/application.py
application.py
py
8,689
python
en
code
0
github-code
90
26775743263
import torch import torch.nn as nn import numpy as np from flask import Flask, jsonify, request import io from PIL import Image import smart_open app = Flask(__name__) class TanhScale(nn.Module): def __init__(self, mean, scale): super().__init__() device = torch.device("cuda:0" if torch.cuda.is_av...
IzzyPutterman/cs194
api_server/app.py
app.py
py
3,137
python
en
code
0
github-code
90
5366931811
import math import torch import torch.nn as nn class BottleNeck(nn.Module): expansion = 4 def __init__(self, inplanes, planes, stride=1, downsample=None): super(BottleNeck, self).__init__() self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=1, bias=False) self.bn1 = nn.BatchNorm(plan...
limingcv/Classification-template-with-PyTorch
models/resnext.py
resnext.py
py
4,704
python
en
code
1
github-code
90
94951297
# Majority Element """ Given an array nums of size n, return the majority element. The majority element is the element that appears more than [n / 2] times. You may assume that the majority element always exists in the array. Strategy: first approach: - create two lists: one list to save the occuring numbe...
Talin-Estiban/leetcode
MajorityElement.py
MajorityElement.py
py
1,492
python
en
code
0
github-code
90
32534059418
import pqtable # (1) Make sure you have already downloaded siftsmall data in data/ by scripts/download_siftsmall.sh # (2) Read vectors queries = pqtable.ReadTopN("data/siftsmall/siftsmall_query.fvecs", "fvecs") # Because top_n is not set, read all vectors bases = pqtable.ReadTopN("data/siftsmall/siftsmall_base.fvec...
manvendratomar/pyPQTable
demo_siftsmall.py
demo_siftsmall.py
py
1,090
python
en
code
1
github-code
90
7019406726
from django.contrib.auth.models import User from django.db import models class Todo(models.Model): title = models.CharField(max_length=255) user = models.ForeignKey(User, blank=True, on_delete=models.CASCADE, null=True) completed = models.BooleanField(default=False) datetime = models.DateTimeField(auto...
Nepul321/Todo-List-with-ReactJS-and-Django-Backend
base/models.py
models.py
py
384
python
en
code
0
github-code
90
18579595799
import sys def input():return sys.stdin.readline().strip() def main(): N, H = map(int, input().split()) info = [tuple(map(int, input().split())) for _ in range(N)] A_MAX = max(a for a, _ in info) Bs = [b for _, b in info if b > A_MAX] Bs.sort(reverse=True) ans = 0 for b in Bs: if H...
Aasthaengg/IBMdataset
Python_codes/p03472/s632326082.py
s632326082.py
py
481
python
en
code
0
github-code
90
35727014248
import os,json,io,logging class DataManager: def __init__(self,path="\\cqpy_data\\"): self.path = os.getcwd() + path if not os.path.exists(self.path): os.mkdir(self.path) def getFileFullPath(self,file_name:str)->str: full_path = self.path + file_name if no...
xyazh/xyazhServer
xyazhServer/DataManager.py
DataManager.py
py
3,425
python
en
code
1
github-code
90
35791458497
# -*- coding: utf-8 -*- """ Created on Thu Jun 3 10:23:08 2021 @author: sebbe """ import streamlit as st import pandas as pd import xgboost as xgb import os from sklearn.metrics import accuracy_score from xgboost import XGBClassifier from sklearn.pipeline import make_pipeline from sklearn.metrics import r2_score f...
eirihoyh/TIN200_jun2021
StreamLit.py
StreamLit.py
py
4,702
python
en
code
0
github-code
90
18980696315
from newspaper import build, Article class NewsScrapper: def __init__(self, src_url): self.src_url = src_url def __create_news_with(self, url): news = Article(url, language='ko') news.download() news.parse() return news def __get_news_urls(self, nu...
emplam27/github-action-test
news_scrapper.py
news_scrapper.py
py
861
python
en
code
0
github-code
90
35648490302
import numpy as np import matplotlib.pyplot as plt from scipy import stats import os import codecs from datastationary import * from dataconst import * from dataweight import * from funcv import * from functhrust import * n_r = 3 # Round to number of digits usealldata = 2 # 0 = manual data, 1 = manual data + trim data...
mvdwaals/SVV
domas/mainstationary.py
mainstationary.py
py
5,350
python
en
code
0
github-code
90
19931484806
import numpy as np import pandas as pd from sklearn.utils import shuffle import matplotlib.pyplot as plt def softmax(input): return np.exp(input) / np.exp(input).sum(axis = 1, keepdims = True) # def cross_entropy_loss(Y, T): # N = len(T) # return -np.log(Y[np.arange(N), T.astype(np.int32)]).mean() def cr...
sid86malhotra/Actor-images
FFN in Numpy.py
FFN in Numpy.py
py
5,143
python
en
code
0
github-code
90
19031026220
from math import sqrt x=9.8**201 y=10.2**199 z1=sqrt(x**2+y**2) z2=y*sqrt(pow((x/y),2)+1) print(z1) print(z2) #Wniosek: W pierwszym działaniu podnosimy i tak już ogromne liczby do kolejnej potęgi, co może powodować przekroczenie limitu kompilatora. #W drugim działaniu x i y są przez siebie dzielone, a iloraz dwóch ogro...
pstatkiewicz/lista-4
zad 3.py
zad 3.py
py
504
python
pl
code
0
github-code
90
1281047765
import logging import traceback from flask_restplus import Api from itsajungleoutthere import settings from sqlalchemy.orm.exc import NoResultFound log = logging.getLogger(__name__) api = Api(version='1.0', title='Mini Dataguru API', description='A simple web API to help a Machine Learning team organize its...
Policonickolu/itsajungleoutthere
itsajungleoutthere/api/restplus.py
restplus.py
py
766
python
en
code
0
github-code
90
20368876041
class Solution: def maxSubArray(self, nums: List[int]) -> int: ''' keep track of the cmax untill it is > 0 if it goes below 0 reset the value to 0 [-2,1,-3,4,-1,2,1,-5,4] max = 6 cmax = 4-1+2+1 so on ''' max_value = -float('inf') ...
RishabhSinha07/Competitive_Problems_Daily
53-maximum-subarray/53-maximum-subarray.py
53-maximum-subarray.py
py
511
python
en
code
1
github-code
90
113041697
#!/usr/bin/env python3 """This is a multi-line commenter So, here we can describe sucintly whats this scrip do. Atention, keep this block in 20 lines. """ __version__ = "0.0.1" __author__ = "Raphael Viana" __license__ = "Unlicense" import os # Here we get the environment variable called LANG and with don't exists...
rnvdev/python-scripts
python-base/hello-world.py
hello-world.py
py
487
python
en
code
0
github-code
90
7047374650
import copy import re bag_rules = {} # process input file with open('input.txt') as f: for line in f: # remove 'bag(s)' strings and final periods # number of bags also does not matter so remove those too clean_line = re.sub(r'(bags?|\.|[0-9])', '', line) bag_rule_key = re.split(r'c...
naobot/advent-of-code
2020/day/7/part1.py
part1.py
py
1,879
python
en
code
0
github-code
90
5680784871
def input(path): f = open(path, "r") lines = f.read().splitlines() f.close() return lines[0] xs, ys = [[int(j) for j in i[2:].split('..')] for i in input('Day17/in.txt')[13:].split(', ')] y1 = abs(min(ys)) print(y1 * ((y1 - 1) / 2))
zhangandy437/aoc-2021
Day17/p1.py
p1.py
py
251
python
en
code
0
github-code
90
13584478158
import itertools import pydot_ng as pd from load import load_all def apply_style(floor, map, name): style = {} label_style = { 'label': '''< <table cellborder="0" border="0"> <tr> <td>{floor}</td> </tr> <tr> <td><img src="da...
Cyanogenoid/asakura-p-routing
make_graph.py
make_graph.py
py
2,667
python
en
code
0
github-code
90