seq_id
stringlengths
7
11
text
stringlengths
156
1.7M
repo_name
stringlengths
7
125
sub_path
stringlengths
4
132
file_name
stringlengths
4
77
file_ext
stringclasses
6 values
file_size_in_byte
int64
156
1.7M
program_lang
stringclasses
1 value
lang
stringclasses
38 values
doc_type
stringclasses
1 value
stars
int64
0
24.2k
dataset
stringclasses
1 value
pt
stringclasses
1 value
27066073984
import datetime def print_progress_bar(curr_time, start_time, stop_time, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█', printEnd = "\r"): """ Call in a loop to create terminal progress bar @params: curr_time - Required : current time (datetime.datetime) start_time - R...
ak5793/stopwatch
stopwatch.py
stopwatch.py
py
1,386
python
en
code
0
github-code
6
28969370099
from django.urls import path from apps.cafes.urls import CAFE_URL_KEYWORD from apps.products import views CATEGORY_LIST_URL_NAME = "category-list" CATEGORY_DETAIL_URL_NAME = "category-detail" CATEGORY_URL_KEYWORD = "category_id" OPTION_GROUP_LIST_URL_NAME = "optiongroup-list" OPTION_GROUP_DETAIL_URL_NAME = "optiongr...
TGoddessana/cafehere
apps/products/urls.py
urls.py
py
1,800
python
en
code
0
github-code
6
41489732999
import numpy as np from gym import spaces import gym import json import pickle class StateNormWrapper(gym.Wrapper): """ Normalize state value for environments. """ def __init__(self, env, file_name): super(StateNormWrapper, self).__init__(env) with open(file_name, "r") as read_file: ...
quantumiracle/Cascading-Decision-Tree
src/rl/env_wrapper.py
env_wrapper.py
py
1,617
python
en
code
32
github-code
6
39005364665
import numpy as np import datetime import math def anagram(s1,s2): s1=list(s1) s2=list(s2) if len(s1)==(len(s2)): s1=set(s1) s2=set(s2) s3=set() if s1^s2==s3: print("Anagram") else: print("not an anagram") else: print("String are ****NOT*** Anagram") def primerange(num): newarr=[] for num in ...
Rohan2596/Python_1_moth
Python_1_Month/Algorithms_programs/AlogoUtility.py
AlogoUtility.py
py
4,962
python
en
code
0
github-code
6
26629807154
import random nomes = ["nome1","nome2","nome3","nome4","nome5","nome6","nome7","nome8","nome9","nome10","nome11","nome12","nome13","nome14","nome15"] qtd_times = 3 random.shuffle(nomes) separar_times = [nomes[i::qtd_times] for i in range(qtd_times)] times = list(separar_times) indice = 1 for time in times: print(...
flaviofontes29/sorteio_divisao_times
Escolha_time.py
Escolha_time.py
py
361
python
pt
code
0
github-code
6
41380069765
from functools import wraps import time from utils.mics import colorstr def fun_run_time(func): ''' 装饰器,用于获取函数的执行时间 放在函数前,如 @fun_run_time() def xxx(): ''' @wraps(func)#可删去,是用来显示原始函数名的 def _inner(*args, **kwargs): s_time = time.time() ret = func(*args, **kwargs) ...
Backlory/motionDetection
utils/timers.py
timers.py
py
1,229
python
en
code
0
github-code
6
10422312368
import math def main(): times = int(input()) local_best_length = 0.0000000000 best_length = 0.0000000000 for i in range(times): # test cases conjunt = int(input()) for j in range(conjunt): # number of conjunts robocopies = int(input()) list_points = [] ...
epaes90/uri-problems
1625.py
1625.py
py
1,540
python
en
code
0
github-code
6
21764619292
# Approach 1: Backtracking with Trie class Solution: def findWords(self, board: List[List[str]], words: List[str]) -> List[str]: WORD_KEY = '$' trie = {} for word in words: node = trie for letter in word: node = node.setdefault(letter, {}) ...
jimit105/leetcode-submissions
problems/word_search_ii/solution.py
solution.py
py
1,831
python
en
code
0
github-code
6
1008765012
'''Problem 37: Truncatable primes''' #g = open('primelist.txt','r') g = open('primes1.txt','r') print("g:",type(g),"Opened Prime list. Now reading it...") h = g.read() print("h: ",type(h),"Now splitting it into a list...") j = h.split() k = [int(x) for x in j] print("PrimeList is",len(j),"numbers long") prin...
hackingmath/Project-Euler
euler37.py
euler37.py
py
1,521
python
en
code
0
github-code
6
27213609715
from collections import deque, defaultdict def bfs(n, adj): visited = [False] * (n+1) min_dist = [1e9] * (n+1) visited[1] = True min_dist[1] = 0 q = deque([1]) while q: cur = q.popleft() for a in adj[cur]: if not visited[a]: q.append...
hammii/Algorithm
Programmers_python/가장_먼_노드.py
가장_먼_노드.py
py
677
python
en
code
2
github-code
6
42739931950
import os import pickle import shutil import numpy as np from tqdm import tqdm import time class ModelManager: ''' Model manager is designed to load and save all models No matter what dataset name. ''' path_name = './checkpoints/' @classmethod def __init__(cls, cfg): if not cfg.MOD...
Jack-Lio/RecommenderSystem
utls.py
utls.py
py
11,868
python
en
code
0
github-code
6
33344135925
import os import logging from pathlib import Path from llama_index import ( GPTSimpleVectorIndex, GPTSimpleKeywordTableIndex, SimpleDirectoryReader ) from llama_index.indices.composability import ComposableGraph # Initialise Logger logging.basicConfig(level=logging.INFO, format="[{asctime}] - {funcName}...
gilgamesh7/iliad_llama
04_local_data_update_index.py
04_local_data_update_index.py
py
2,482
python
en
code
0
github-code
6
24988570911
from osv import fields, osv class account_journal_simulation(osv.osv): _name = "account.journal.simulation" _description = "Simulation level" _columns = { 'name': fields.char('Simulation name', size=32, required=True), 'code': fields.char('Simulation code', size=8, required=True), } ...
factorlibre/openerp-extra-6.1
account_simulation/account_simulation.py
account_simulation.py
py
2,781
python
en
code
9
github-code
6
10548067106
#!/usr/bin/env python3 """ From a set of zone transits representing trips between stops, work out the effective trip time for a passenger arriving at the the origin every minute from the departure time of the first bus to the departure time of the last one """ import collections import datetime import logging import ...
SmartCambridge/milton_road_study
initial_investigation/expand_transits.py
expand_transits.py
py
4,037
python
en
code
0
github-code
6
22799615615
from django.shortcuts import render from django.http import HttpResponse from myapp.models import City,Country,Person from myapp.forms import PersonForm from django.shortcuts import redirect # Create your views here. def index(request): country=Country.objects.all() context={ 'country':country, } ...
pappubca005/dynamic-dropdown
myapp/views.py
views.py
py
1,346
python
en
code
0
github-code
6
20289549716
from stat_arb.src.data_loader.dao.dataframe.RawPostgresSampledDataLoader import RawPostgresSampledDataLoader from stat_arb.src.data_loader.dao.dataframe.ClickhouseTradesDataLoader import ClickhouseTradesDataLoader from stat_arb.src.data_loader.database import database_config from datetime import datetime from stat_arb....
v-buchkov/statistical_arbitrage_backtester
download_hourly_data.py
download_hourly_data.py
py
1,939
python
en
code
2
github-code
6
15398422361
# Реализуйте RLE алгоритм: реализуйте модуль сжатия и восстановления данных. # Входные и выходные данные хранятся в отдельных текстовых файлах. def get_coding(text): with open(text, 'r') as data: txt = data.readline() count = 1 res = '' for i in range(len(txt)-1): if txt[i] == txt[i+1]...
iiiivanCh/dz05python
task05_04.py
task05_04.py
py
1,135
python
ru
code
0
github-code
6
73439288188
import argparse from subcommands.setup.parser import parser as setup_parser from subcommands.export.parser import parser as export_parser from subcommands.info.parser import parser as info_parser from subcommands.process.parser import parser as process_parser from subcommands.prune.parser import parser as prun...
zruan/hotspur_command
hotspur.py
hotspur.py
py
1,681
python
en
code
0
github-code
6
27578228523
#!/usr/bin/env python3 import argparse import configparser from pathlib import Path from rich import console import sys sys.path.append("/home/vermin/IdeaProjects/summalarva") from summalarva.openai_client import OpenAIClient from summalarva.orgnoter import OrgNoter console = console.Console() config = configparser....
nhannht/summalarva
summalarva/summarize_pdf.py
summarize_pdf.py
py
1,484
python
en
code
1
github-code
6
36621325200
import pygame import sys from moviepy.editor import VideoFileClip from PIL import Image pygame.init() music_background = pygame.mixer.music.load("assets/LostCompanionTomboFry.mp3") pygame.mixer.music.play() pygame.mixer.music.set_volume(0.2) lar = 550 hut = 700 screen = pygame.display.set_mode((lar, hut)) pygame.di...
RuFiripo/Pythongoras-Game
menu.py
menu.py
py
2,712
python
en
code
0
github-code
6
32100325594
import jittor as jt from jittor import Module from jittor import nn import pygmtools as pygm import numpy as np import parameter class AlexNet(Module): def __init__(self, *args, **kw) -> None: super().__init__(*args, **kw) self.padsize = parameter.parameters().pad self.kernel_...
kizunawl/SJTU-AI-courses
Deep Learning/Task4/model.py
model.py
py
2,616
python
en
code
1
github-code
6
28383267446
import copy import functools import os import random import torch import torch.nn.functional as F import blobfile as bf import torchvision.utils as vutils import numpy as np import torch as th import torch.distributed as dist from torch.nn.parallel.distributed import DistributedDataParallel as DDP from torch.optim impo...
JTT94/schrodinger_bridge
bridge/trainer/ipf_base.py
ipf_base.py
py
10,216
python
en
code
0
github-code
6
40024543800
import datetime,time,os,sys if(sys.platform.lower().startswith('linux')): OS_TYPE = 'linux' elif(sys.platform.lower().startswith('mac')): OS_TYPE = 'macintosh' elif(sys.platform.lower().startswith('win')): OS_TYPE = 'windows' else: OS_TYPE = 'invalid' # Get our current directory OUTPUT_FILE_DIRECTORY ...
isajediknight/Sleep-Is-Overrated
scripts/watch_v4.py
watch_v4.py
py
4,274
python
en
code
0
github-code
6
8407981184
from abc import ABC, abstractmethod import threading import boto3 import botocore import sys import logging import logging.config from enum import Enum from itertools import cycle from botocore.config import Config from botocore.endpoint import MAX_POOL_CONNECTIONS from collections.abc import Iterable class AWS_SVC_B...
prisma-cloud/IAMFinder
aws_svc/aws_service_base.py
aws_service_base.py
py
3,839
python
en
code
102
github-code
6
38381779624
# 给定一个二叉搜索树,编写一个函数 kthSmallest 来查找其中第 k 个最小的元素。 # 说明: # 你可以假设 k 总是有效的,1 ≤ k ≤ 二叉搜索树元素个数。 # 示例 1: # 输入: root = [3,1,4,null,2], k = 1 # 3 # / \ # 1 4 # \ #   2 # 输出: 1 # 示例 2: # 输入: root = [5,3,6,2,4,null,null,1], k = 3 # 5 # / \ # 3 6 # / \ # 2 4 # / # 1 # 输出: 3 # Definiti...
1lch2/PythonExercise
leetcode/binary_tree/230.py
230.py
py
2,160
python
en
code
1
github-code
6
30704086585
from collections import deque with open('day6.txt') as day6: lines = day6.readlines() target_size = 14 current = 0 buffer = deque([''] * target_size) for line in lines: for char in line: current = current + 1 buffer.popleft() buffer.append(char) if current > target_size and len(set(buffer)) == t...
shanetreacy/aoc2022
day6aoc.py
day6aoc.py
py
365
python
en
code
0
github-code
6
35303233339
from pages.investment_proposal.predefined_plan.predefined_plan import PredefinedPlanPage from pages.investment_proposal.customized_plan.customized_plan import CustomizedPlanPage from pages.investment_proposal.investment_proposal import InvestmentProposalPage from pages.investment_proposal.investment_proposal_config im...
qateam-neo/fe-connect-automation
tests/investment_proposal_page_tests.py
investment_proposal_page_tests.py
py
989
python
en
code
0
github-code
6
15257337134
# -*- coding: utf-8 -*- """ Created on Sat Nov 10 17:30:55 2018 @author: Wioletta """ import cv2 from localbinarypatterns import LocalBinaryPatterns img = cv2.imread('yaleB01_P00A+000E+00.pgm') cv2.imshow('Image',img) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) desc = LocalBinaryPatterns(24, 8) hist = desc.descr...
wiolettakolasa/IO
test.py
test.py
py
360
python
en
code
0
github-code
6
5762269283
import os scriptPath = os.path.dirname(os.path.abspath(__file__)) projRootPath = os.path.abspath( os.path.join(scriptPath , os.path.join('..', '..'))) import numpy as np # matplotlib for displaying the output import matplotlib.pyplot as plt import seaborn as sns sns.set() from scipy import sign...
mariusdgm/AudioMining
src/visualization/spectrogram.py
spectrogram.py
py
1,360
python
en
code
0
github-code
6
33489081133
def isACoveredByB(a, b): return a[0] >= b[0] and a[1] <= b[1] class Solution: def removeCoveredIntervals(self, intervals: List[List[int]]) -> int: cntIntervals = len(intervals) cntToRemove = 0 for i in range(cntIntervals): isCovered = 0 for j in range(cntInterva...
sxu11/Algorithm_Design
Daily/20210316_1288_RemoveCoveredIntervals.py
20210316_1288_RemoveCoveredIntervals.py
py
582
python
en
code
0
github-code
6
41688432470
from tkinter import * from threading import Thread from unpacker import * from lookupData import * from telemetryModule import * import math root = Tk() root.title("F1 2021 Telemetry App") root.geometry("{}x{}".format(1200, 800)) root.configure(background="#212026") telemetry_modules = [] telemetry_data = [None] ...
smuldoon1/F1-2021-Telemetry-App
telemetryApp.py
telemetryApp.py
py
1,601
python
en
code
1
github-code
6
12417770443
from redirect import config, cryptoDecrypt, datetime, GenericException,jwt, logger, messages, timezone def getClientServerTimeDiff(auth): try: token = auth.split(' ')[-1] decrypted = cryptoDecrypt(token) client_timestamp = float(decrypted)/1000 dt = datetime.datetime.now(timezone.u...
capitalch/bika
dev/KaterServer/data_handlers/graphql_sub_worker.py
graphql_sub_worker.py
py
1,467
python
en
code
0
github-code
6
36578088832
# MIT 6.001 pset 1c total_cost = 1000000.0 portion_down_payment = 0.25 total_down_payment = total_cost * portion_down_payment current_savings = 0.0 r = 0.04 base_annual_sallary = 0.0 semi_annual_raise = 0.07 best_saving_rate = 0.0 money_range = 100.0 months = 36 init_upper = 10000 upper_bound = init_upper lower_bound ...
1kaLn/MIT-60001
pset1/ps1c.py
ps1c.py
py
1,599
python
en
code
0
github-code
6
4714847905
import requests import ast import sys import getopt class XkcdClient(): def api_call(self, url): self.urls = url r = requests.get(url = self.urls) byte_str = r.content dict_str = byte_str.decode("UTF-8") my_data = ast.literal_eval(dict_str) return my_data de...
nishantasarma/XkcdClientApp
client.py
client.py
py
2,527
python
en
code
0
github-code
6
31533763236
groups_number = int(input()) total_people = 0 musala_people = 0 mont_blanc_people = 0 kilimanjaro_people = 0 k2_people = 0 everest_people = 0 percent_musala = 0 percent_mont_blanc = 0 percent_kilimanjaro = 0 percent_k2 = 0 percent_everest = 0 for group in range(groups_number): current_people = int(input()) if c...
iliyan-pigeon/Soft-uni-Courses
programming_basics_python/exams/exam_march_2020/trekking_mania.py
trekking_mania.py
py
1,210
python
en
code
0
github-code
6
30827675825
import os import sys import json import logging from time import time from PyQt5.Qt import PYQT_VERSION_STR from PyQt5.QtCore import ( QT_VERSION_STR, QStandardPaths, QSysInfo, QLocale, QLibraryInfo, QTranslator ) from novelwriter.error import logException, formatException from novelwriter.common import spli...
vaelue/novelWriter
novelwriter/config.py
config.py
py
38,609
python
en
code
null
github-code
6
26355881815
# this is nima nikrouz's midterm project #=============================================library===================================================== from tabulate import tabulate #=============================================library===================================================== #==============================...
nimankz/8queen-project
midterm1.2.py
midterm1.2.py
py
11,209
python
en
code
0
github-code
6
22657330763
# ----------------- # Extension Details # ----------------- name = "Space Station" version = "0.1" developer = "Type Supply" developerURL = "http://typesupply.com" roboFontVersion = "3.2" pycOnly = False menuItems = [ dict( path="menu_glyphEditorSpaceStation.py", preferredName="Glyph Editor", ...
typesupply/spacestation
build.py
build.py
py
2,958
python
en
code
12
github-code
6
25005501771
import wizard import pooler def _check_sections(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) data_obj = pool.get('ir.model.data') sec_obj = pool.get('crm.case.section') bug_id = sec_obj.search(cr, uid, [('code','=','BugSup')]) if not bug_id: raise wizard.except_wizard(_(...
factorlibre/openerp-extra-6.1
portal_project/wizard/wizard_check_section.py
wizard_check_section.py
py
1,342
python
en
code
9
github-code
6
19208530297
''' This program is used to get information from a user and make an email from that information ''' #asking for the user's first name and then storing it in the variable firstName firstName = input("Enter your first name: ") #asking for the user's last name and then storing it in the variable lastName lastName = inpu...
kelvincaoyx/UTEA-PYTHON
Week 1/pythonUnitOnePractice/email.py
email.py
py
740
python
en
code
0
github-code
6
11932438017
from env import data from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.support.ui import Select from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by...
bangef/pz
python/post-test/module/program.py
program.py
py
4,797
python
en
code
0
github-code
6
34294693162
import random as r class node: def __init__(self,val) -> None: self.data=val self.left=None self.right=None class BST: def __init__(self) -> None: self.root=None def insertR(self,data,root): if root==None: return node(data) else: if dat...
farhan1503001/Data-Structures-203-IUB
Binary Search Tree/insertR.py
insertR.py
py
917
python
en
code
2
github-code
6
35839328750
import argparse from distutils.util import strtobool import pathlib import siml import convert_raw_data def main(): parser = argparse.ArgumentParser() parser.add_argument( 'settings_yaml', type=pathlib.Path, help='YAML file name of settings.') parser.add_argument( 'raw_da...
yellowshippo/isogcn-iclr2021
src/preprocess_raw_data_with_preprocessors.py
preprocess_raw_data_with_preprocessors.py
py
3,638
python
en
code
42
github-code
6
7874667169
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jun 22 16:48:54 2019 @author: xiaohaoren """ import json import pickle import numpy as np negative_word = ['悶熱','吵雜','髒','髒亂','加強','改進','缺點'] def Load_All_Info(json_path,pickle_path): with open(json_path,'r') as fp: json_data = json....
e841018/DinnerSelector
utils/Filtering.py
Filtering.py
py
2,301
python
en
code
0
github-code
6
28120118270
import numpy as np import pandas as pd class Model: def __init__(self, bias: float, age_y: float, bmi: float, bmisq, gender: float, dysrhythmia: float, heart_failure: float, dys_hf_interaction: float, discharge_home_self: float, discharge_facility: float, ed_visits: float, psych_...
zimolzak/py-medical-functions
ortho_readmission.py
ortho_readmission.py
py
3,867
python
en
code
1
github-code
6
71175312187
import re import time import textwrap from copy import copy import torch.nn.functional as F from training_utils import * BASH_FORMATTING = { 'PURPLE': '\033[95m', 'CYAN': '\033[96m', 'DARKCYAN': '\033[36m', 'BLUE': '\033[94m', ...
amauriciorr/AubreyBot
chat_utils.py
chat_utils.py
py
2,389
python
en
code
2
github-code
6
33359786284
from unittest import TestCase import unittest import requests # import sys # # sys.path.insert(0, '../../src') class TestLoadTimeSeries(TestCase): def test_load_data_success(self): f = open("tests/routes/time_series_covid19_recovered_global.csv", "rb") file = f.read() url = 'https://covid...
shin19991207/CSC301-A2
tests/routes/test_time_series.py
test_time_series.py
py
1,255
python
en
code
0
github-code
6
25254340151
import numpy as np import sys from vispy import app, visuals, scene # build visuals Plot3D = scene.visuals.create_visual_node(visuals.line.line.LineVisual) # build canvas canvas = scene.SceneCanvas(keys='interactive', title='plot3d', show=True) # Add a ViewBox to let the user zoom/rotate view = canvas.central_widg...
ptmorris03/Clip3D
lines.py
lines.py
py
1,152
python
en
code
0
github-code
6
22312741825
#Considere uma tupla que guarde temperaturas em Celsius (C) ou Fahrenheit (F) # como um valor em duas partes: temperatura e escala. Por exemplo: # 32,5 graus Celsius é representado como (32.5, ‘C’) e 45,2 graus Fahrenheit # é representado como (45.2, ‘F’). Desenvolva uma função que soma duas # temperaturas que pode...
AlcionePereira/semana-14-1-parte
soma.py
soma.py
py
1,109
python
pt
code
0
github-code
6
333459228
import argparse import glob import os import h5py import hdbscan import numpy as np from scipy.ndimage import binary_erosion from skimage.filters import gaussian from skimage.segmentation import watershed from sklearn.cluster import MeanShift def expand_labels_watershed(seg, raw, erosion_iters=4): bg_mask = seg ...
kreshuklab/takafumi_embryos_segmentation
utils/cluster.py
cluster.py
py
4,632
python
en
code
0
github-code
6
25965027391
import json import os from contextlib import suppress from math import sqrt from typing import Tuple import numpy as np import pandas as pd from openpyxl import load_workbook, styles, utils from PIL import Image def to_excel( image: Image, path: str, lower_image_size_by: int = 10, **spreadsheet_kwargs ) -> None:...
Henrique-CSS/unexpected-isaves
src/unexpected_isaves/save_image.py
save_image.py
py
24,926
python
en
code
null
github-code
6
19167044996
""" A collection of neural network code. The first part of the script includes blocks, which are the building blocks of our models. The second part includes the actual Pytorch models. """ import torch import torchvision.transforms as transforms class ConvBlock(torch.nn.Module): """ A ConvBlock represents a co...
notkarol/derplearning
derp/model.py
model.py
py
9,661
python
en
code
40
github-code
6
26096479620
from typing import final import pandas as pd import numpy as np import os final_df=pd.read_csv("prepared_final_data.csv") print(final_df) values=final_df["pollution"].values print(values) print(final_df.columns) """# Normalized the data""" from sklearn.preprocessing import MinMaxScaler # values = final_df.values pr...
manisha841/Air-Quality-Index-Prediction
train.py
train.py
py
3,028
python
en
code
0
github-code
6
32311173285
#import networkx as nx #import matplotlib.pyplot as plt import json import pprint from TwitterModule import * import time from datetime import datetime #Set up api and global variables twitter_api = oauth_login()#twitter api for grabbing data #dates = [330,331,401,402,403] dates = [401,402,403,404,405,406,407] for day...
drewpj/cis400tweetfrequency
searchTweets.py
searchTweets.py
py
4,925
python
en
code
1
github-code
6
71477060028
import sys input = sys.stdin.readline def BFS(y, x, word): global ans ans = max(ans, len(word)) for dy, dx in ((0, 1), (0, -1), (1, 0), (-1, 0)): ny = y + dy nx = x + dx if 0 <= ny < R and 0 <= nx < C and data[ny][nx] not in word: BFS(ny, nx, word+data[ny][nx]) R, C...
YOONJAHYUN/Python
BOJ/1987_2.py
1987_2.py
py
451
python
en
code
2
github-code
6
40709996191
# coding=utf-8 from __future__ import absolute_import, division, print_function import torch import torch.nn as nn from torch.utils.data import DataLoader, Dataset from util.custom_dataset import FaceLandmarksDataset, Rescale, ToTensor import torchvision.models as models from torchvision import transforms impor...
hanluyt/gACNN_pytorch
model_roi.py
model_roi.py
py
7,947
python
en
code
2
github-code
6
1002077560
import g2d from boardgame import BoardGame from time import time W, H = 40, 40 LONG_PRESS = 0.5 class BoardGameGui: def __init__(self, g: BoardGame): self._game = g self._downtime = 0 self.update_buttons() def tick(self): if g2d.key_pressed("LeftButton"): self._dow...
refedico/3-in-a-Row
boardgamegui.py
boardgamegui.py
py
2,063
python
en
code
3
github-code
6
36562134507
import sys import json import time import numpy as np import argparse from operator import itemgetter from scipy.sparse import csc_matrix from scipy.sparse import csr_matrix from scipy.sparse import dok_matrix from math import sqrt from math import log from upper_learning_corpus import LearningCorpus from sparse_matr...
mfaruqui/vector-semantics
src/svd/convert_counts_to_pmi.py
convert_counts_to_pmi.py
py
4,114
python
en
code
5
github-code
6
25026171656
from flask import abort from flask_restx import Resource, Namespace, Model, fields, reqparse from infraestructura.alumnos_repo import AlumnosRepo from api.cursos_api import modeloCurso from flask_restx.inputs import date repo = AlumnosRepo() nsAlumno = Namespace('Alumnos', description='Administrador de Alumno') mo...
PepoPalo/Final-Laboratorio-Diciembre2021
Backend/api/alumnos_api.py
alumnos_api.py
py
3,258
python
es
code
1
github-code
6
32144899005
import pandas as pd def read_fasta(file_path): sequences = {"Header": [], "Sequence": []} current_header = None current_sequence = "" with open(file_path, "r") as file: for line in file: line = line.strip() if line.startswith(">"): # New header found ...
txz32102/paper
util/sample.py
sample.py
py
3,139
python
en
code
0
github-code
6
25575152305
from unicodedata import mirrored import numpy as np import inspect import unittest def select_alternating_columns(a: np.ndarray) -> np.ndarray: """ Select alternating columns starting from the 0-th index of `a`. `a` will be at least 2 dimensions. >>> a = np.array([[0, 1, 2], ... ...
ThadeuFerreira/python_code_challengers
numpyArrays.py
numpyArrays.py
py
11,852
python
en
code
0
github-code
6
26735943730
import numpy as np from .utils import LinearAnnealer,ExponentialAnnealer import tqdm import torch import torch.nn as nn import wandb from progress.bar import Bar from array2gif import write_gif import copy from .utils import set_seed from .utils import save_rewards_meanvar_plot,get_logger,MLP,ReplayMemory import loggi...
gauthierboeshertz/reel
algos/plearners/vpg.py
vpg.py
py
5,225
python
en
code
0
github-code
6
70541333949
import os import re import spotipy from moviepy.editor import * from urllib.parse import quote from urllib import request as rq from youtube_dl import YoutubeDL from spotipy.oauth2 import SpotifyClientCredentials ## fix to skip use for PYTHONPATH sys.path.append(os.getcwd()) sys.path.append(os.path.join(os.getcwd(),"....
alejan2x/FuckDownload
spotify/spotify.py
spotify.py
py
4,850
python
en
code
0
github-code
6
23873824195
import cv2 import os # Input folder containing the saved images image_folder = '/Users/tobieabel/Desktop/video_frames/ConcatVideo/' # Output video file path output_video_path = '/Users/tobieabel/Desktop/video_frames/Youtube/v3_a demo.mp4' # Get the list of image files in the input folder image_files = os.listdir(ima...
tobieabel/demo-v3-People-Counter
Create_video.py
Create_video.py
py
1,633
python
en
code
0
github-code
6
35929199029
#!/usr/bin/python3 """base geometry class""" BaseGeometry = __import__('7-base_geometry').BaseGeometry Rectangle = __import__('9-rectangle').Rectangle """class to represent a square""" class Square(Rectangle): """square Class""" def __init__(self, size): """init""" self.integer_valid...
philimon-reset/alx-higher_level_programming
0x0A-python-inheritance/10-square.py
10-square.py
py
411
python
en
code
2
github-code
6
32731778878
# 피보나치 수 - 재귀호출 def fib(n): if(n == 1 or n == 2): return 1 else: global count count += 1 return fib(n-1) + fib(n-2) # 피보나치 수 - 동적 프로그래밍 def fibonacci(n): f = [] f.append(1) f.append(1) cnt = 0 for i in range(2, n): cnt += 1 f.append(f[i-1] + f...
woo222/baekjoon
python/동적프로그램/b1_24416_알고리즘 수업-피보나치 수1.py
b1_24416_알고리즘 수업-피보나치 수1.py
py
445
python
ko
code
0
github-code
6
29262983646
import sys import socket import platform import psutil import wmi import urllib.request from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QPushButton, QTextEdit, QWidget from PyQt5.QtCore import Qt from PyQt5.QtGui import QFont, QColor class App(QMainWindow): def __init__(self, app): supe...
miko7ajradziw1llowicz/Zadanie-3-python
main.py
main.py
py
4,160
python
en
code
0
github-code
6
1363723921
from typing import Any, Dict, List, Type, TypeVar, Union from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset T = TypeVar("T", bound="FollowUpPriorityV2ResponseBody") @_attrs_define class FollowUpPriorityV2ResponseBody: """ Example: {'de...
expobrain/python-incidentio-client
incident_io_client/models/follow_up_priority_v2_response_body.py
follow_up_priority_v2_response_body.py
py
2,629
python
en
code
4
github-code
6
37407208814
from jinja2 import Environment, BaseLoader from io import BytesIO import plotly import base64 ''' export = ExportHTML('testclass.html') export.render() ''' class ExportHTML: __template_vars = {'title':'Hello World','body':'Hello World !!!'} __template_html = ''' <html> <head lang="en"> ...
etq-quant/etqbankloan
Lib/etiqalib/export_html.py
export_html.py
py
2,768
python
en
code
0
github-code
6
26656448918
#the code partial borrowed from # "Neural Network-based Reconstruction in Compressed Sensing #MRI Without Fully-sampled Training Data" import torch import torch.nn as nn import numpy as np import torch.nn.functional as F import util_torch as util_torch def absval(arr): """ Takes absolute value of last dimensio...
ikjalata/MRIunsup
model.py
model.py
py
3,925
python
en
code
0
github-code
6
28118192230
# -*- coding:utf-8 -*- from PySide2.QtCore import Signal from PySide2.QtWidgets import QDialog from core.options import MultiOption from ui.base.constants import ITEM_SEPARATORS from ui.base.ui_add_items import Ui_AddItemsDialog # noinspection PyTypeChecker from utils import warn, splitItems, isEmpty # noinspection P...
zimolab/PyInstallerGUI
ui/add_items_ui.py
add_items_ui.py
py
2,937
python
en
code
10
github-code
6
31975334850
import numpy as np import scipy.ndimage import scipy.misc import glob import torch from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F import torch.optim as optim def loadPsf(psftype, fileformat): path='/gdata/zhoutk/Deconv/'+psftype files=glob.glob(path+'/'+'*'+filefor...
rickyim/DeconvNet
source/PSFConv.py
PSFConv.py
py
2,123
python
en
code
0
github-code
6
74182199547
def EatUp (n): if n > 1: EatUp(n-1) print("eat %d" %n) elif n == 1: print("eat 1") def EatDown (n): if n > 1: print("eat %d" %n) EatDown(n-1) elif n == 1: print("eat 1") def Fac(n): result = 1 for i in range(2,n+1): print(...
chollsak/KMITL-Object-Oriented-Data-Structures-2D
Recursive/recursive.py
recursive.py
py
1,049
python
en
code
0
github-code
6
71989647867
from tkinter import * import tkinter as tk import tkinter.messagebox from PIL import ImageTk, Image HEIGHT = 500 WIDTH = 600 root = tk.Tk() def restart(): ans = tkinter.messagebox.askyesno('Starting New Game','Are you sure?') if ans: root.destroy() from BallShooterLimit import Lim...
Alfred-Akinkoye/reacTen
GameServer/MainMenuPage.py
MainMenuPage.py
py
2,800
python
en
code
0
github-code
6
19809320159
import time import constants as cons import matplotlib.pyplot as plt from preprocessing.images_reader import ImagesReader start_time = time.time() print('reading images...') reader = ImagesReader(cons.PREPROCESSED_DATASET_DIR) train_images = reader.read_train_images() classes = [None] * len(train_images) samples = ...
sachokFoX/caltech_256
code/run_data_distribution_analysis.py
run_data_distribution_analysis.py
py
589
python
en
code
0
github-code
6
12948066350
import matplotlib.pyplot as plt tiempo = [0,1,2,3,4,5] sensor = [4,5,6,8,9, 10] plt.plot(tiempo,sensor,'--,r') plt.title('Grafico sensor contra el tiempo') plt.xlabel('Tiempo(s)') plt.ylabel('Voltaje(v)') plt.savefig('sensor.png') plt.show() # Nota: se le puede poner el simbolo para que se grafique('--'), si no se pon...
vero-obando/Programacion
Clases/Graficos/curvas.py
curvas.py
py
679
python
es
code
0
github-code
6
11353054992
# Licensed under a 3-clause BSD style license - see LICENSE from __future__ import print_function, division import Icarus from Icarus.Utils.import_modules import * ##### Welcome message print( "Analysing some mock data. It is recommended to run it within the `ipython --pylab' environment.\n" ) ##### Loading the da...
bretonr/Icarus
Examples/Example1/example1.py
example1.py
py
4,839
python
en
code
11
github-code
6
42345298259
def getLongestLine(img): longest = 0 for i in range(0, len(img)): if len(img[i]) > longest: longest = len(img[i]) return longest def rotate(img): width = getLongestLine(img) height = len(img) longest = width answer = [] if(width < height): longest = height ...
yodigi7/kattis
CompetitionASCIIRotation.py
CompetitionASCIIRotation.py
py
890
python
en
code
2
github-code
6
41152382829
from tkinter import * import tkinter as tk from tkinter import ttk from tkinter import messagebox import pandas as pd class Tabla: def __init__(self,root, dataFrame, anchos, fechas, bgColor, posX, posY): self.anchos = anchos self.fechas = fechas self.nuevoDatos = [] self.componentes...
Moisesmp75/TkinterForms
Trabajo4/programa.py
programa.py
py
11,298
python
es
code
0
github-code
6
23341249880
import json as js import csv import sys import jinja2 import os from datetime import datetime # import smtplib # read customers file to get information about customers def get_customers(customers_file, error): TITLE = [] FIRST_NAME = [] LAST_NAME = [] EMAIL = [] with open(customers_file, mode='...
thanhthien272/sendEmailPython
send_email.py
send_email.py
py
2,750
python
en
code
0
github-code
6
36079551198
import sys import glob from log.logdb import LogDb from log.loader import LogLoader from gcp.storage import LogStorage from log.timeutil import timestamp class DbLoader: def __init__(self): self.book_last_time = 0 self.funding_last_time = 0 self.trade_last_time = 0 self.log_db = Non...
yasstake/mmf
log/dbloader.py
dbloader.py
py
2,864
python
en
code
1
github-code
6
73730402429
import boto3 import logging import os import json import time from datetime import datetime from jsonpath_ng.ext import parse import helpers logger = logging.getLogger() logger.setLevel(logging.INFO) utl = helpers.Utils() dyn = helpers.Dyn() ssm = boto3.client('ssm') ec2 = boto3.client('ec2') appValue = os.getenv('T...
arturlr/minecraft-server-dashboard
lambdas/configServer/index.py
index.py
py
8,475
python
en
code
2
github-code
6
22043825261
from flask import Response import json from presentation.contracts import HttpController, HttpRequest def adapt_route(flask_request, controller: HttpController): request = HttpRequest( params=flask_request.args, body=flask_request.json ) data = controller.handle(request) return Respons...
panda-coder/py-clean-flask
src/main/adapters/flask_route_adapter.py
flask_route_adapter.py
py
924
python
en
code
1
github-code
6
51262091
from typing import * # class Solution: # def atMostNGivenDigitSet(self, digits: List[str], n: int) -> int: # n_str = str(n) # k = len(n_str) # res = 0 # for i in range(1, k): # res += len(digits) ** i # def dfs(cur, pos, res): # # base case #...
code-cp/leetcode
solutions/902/main.py
main.py
py
1,623
python
en
code
0
github-code
6
70929713788
# -*- coding: utf-8 -*- """ Created on Wed Sep 6 11:55:47 2023 @author: Gilberto """ import pandas as pd from datetime import datetime, timedelta class StraightLineAmortization: def __init__(self, settlement_date, maturity_date, first_payment_date, notional_amount, rate, basis_numerator, basis_deno...
gdelacruzv/Amortization_calculator
straightline_v2.py
straightline_v2.py
py
4,582
python
en
code
0
github-code
6
26396707826
# Establish the Python Logger import logging # built in python library that does not need to be installed import time from datetime import datetime import os import talking_code as tc speaking_log = False speaking_steps = False def set_speaking_log(on_off_setting = False): global speaking_log speak...
JoeEberle/kids_ABC_book
quick_logger.py
quick_logger.py
py
5,079
python
en
code
1
github-code
6
26120509391
import os import sys import csv from collections import Counter, defaultdict import pandas as pd from statsmodels.stats.inter_rater import aggregate_raters, fleiss_kappa #from pptx import Presentation # configure Django so we can use models from the annotate app sys.path.append('/home/nejl/Dropbox/projects/tator/rep...
ned2/tator
notebooks/utils.py
utils.py
py
11,139
python
en
code
0
github-code
6
71174455228
# -*- coding: utf-8 -*- import time, functools def metric(fn): def decorator(func): @functools.wraps(func) def wrapper(*args,**kw): print(fn) if fn.__str__()==fn else print('no metric args') start_time=time.time() return (func(*args,**kw),print('%s executed in %s...
kfusac/LearnPython
LiaoxuefengPython/5_FunctionalProgramming/decorator.py
decorator.py
py
756
python
en
code
0
github-code
6
23995078592
import os from collections import deque from typing import Dict, List, Optional, Any import langchain import openai import pinecone from langchain.chains import LLMChain from langchain.chains.base import Chain from langchain.agents import AgentType, ZeroShotAgent, Tool, AgentExecutor, initialize_agent from langchain...
satpat2590/somelangchainfun
main.py
main.py
py
13,333
python
en
code
2
github-code
6
30728237360
import fileinput import sys from collections import deque, defaultdict, Counter from functools import lru_cache from itertools import permutations, combinations, combinations_with_replacement, product sys.setrecursionlimit(10000000) dd = defaultdict(lambda: 0) dx = [0, 0, -1, 1] # NSWE dy = [-1, 1, 0, 0] # NSWE p1 =...
mdaw323/alg
adventofcode2021/21.py
21.py
py
1,904
python
en
code
0
github-code
6
72052703228
import sys, json from urllib.request import urlopen from collections import OrderedDict list_host = 'http://localhost:5000' list_url = list_host + '/api/3/action/organization_list' get_url = list_host + '/api/3/action/organization_show' contents = urlopen(list_url) org_list = json.load(contents)['result'] for org_n...
italia/public-opendata-sources
export_orgs.py
export_orgs.py
py
888
python
en
code
17
github-code
6
20538743319
# https://leetcode.com/problems/rotting-oranges/ """ Time complexity:- O(N) Space Complexity:- O(N) """ """ Intuition: The algorithm uses Breadth-First Search (BFS) to simulate the rotting process, starting from initially rotten oranges. The queue (q) is used to keep track of the rotten oranges and their coordinates...
Amit258012/100daysofcode
Day92/rotten_oranges.py
rotten_oranges.py
py
2,532
python
en
code
0
github-code
6
19582017966
import socket host = "192.168.0.1" port = 80 s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.connect((host,port)) buf = b'-' * 30 s.send(b'GET /HTTP/1.1\r\n\r\n') resp = s.recv(2048) print("Number of bytes",len(resp)) print(buf.decode()) s.close()
indrajithbandara/py-studies
client3.py
client3.py
py
255
python
en
code
0
github-code
6
2694410426
import os import sys import signal import threading import multiprocessing import atexit import time from ctypes import c_bool from .module import StateIO from .config import Config class Controller: def __init__(self, config: Config) -> None: args, self.cfg = config.load() self.pidfile_pa...
bitula/minipupper-dev
controller/controller.py
controller.py
py
12,689
python
en
code
2
github-code
6
35449426767
n = input().split() def with_c(c): temp = [] for i in n: if c in i: temp.append(i) return temp def vowel_count(pairs): for i in pairs: i = i.lower() if i.count('a') + i.count('e') + i.count('i') + i.count('o') + i.count('u') != 2: return False else: ...
robinroy03/CompetitiveProgramming
VPROPEL POD/09-03-23/main.py
main.py
py
567
python
en
code
0
github-code
6
16616067005
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager from selenium.common.exceptions import NoSuchElementException import logging def has_booking_started(url: str) -> bool: options ...
CreatorSky/cineplex-notifier
utils/selenium_utils.py
selenium_utils.py
py
1,128
python
en
code
0
github-code
6
14223858027
# Clase 1 import machine, time from machine import ADC # file=open("data.csv","w") # creation and opening of a CSV file in Write mode # # Type Program Logic Here # file.write(str(value)+",") # Writing data in the opened file # # file.flush() # Internal buffer is flushed (not necessary if close() function is used) # ...
giulianopalmisano/PDMyE
main.py
main.py
py
877
python
en
code
0
github-code
6
14187604894
from kingadmin.admin_base import BaseKingAdmin class AdminSite(): """用于注册用的类""" def __init__(self): self.enabled_admins = {} def register(self, model_class, admin_class = None): """注册admin表""" app_name = model_class._meta.app_label model_name = model_class._meta.model_nam...
MurrayXiao/SchoolCRM
kingadmin/sites.py
sites.py
py
789
python
en
code
3
github-code
6
35613748044
from collections import OrderedDict # from datetime import datetime from django.conf import settings from django.db import models from django.utils import timezone from jsonfield import JSONField # Create your models here. class fhir_Consent(models.Model): """ Store User:application consent in fhir format ...
shihuaxing/hhs_oauth_server
apps/fhir/fhir_consent/models.py
models.py
py
2,578
python
en
code
null
github-code
6
36517071630
import time def reverseTimSort(array): for i in range(len(array)): for j in range(i): if array[j] > array[i]: array[j], array[i] = array[i], array[j] return array def getBiggerValue(array): biggerValue = 0 for item in array: if item > biggerValue: ...
taylorbyks/paa-coins-change
utils.py
utils.py
py
1,273
python
en
code
0
github-code
6