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
6002465831
import numpy as np import cv2 #function that needs to find colonies, I pass the image and the mask that contains the rectangle def GetColonies(image,mask): #convert image to grayscale image_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) #I isolate the image contained in the rectangle writing_...
filyps98/colony_counting
CLED_program/ExctractColonies.py
ExctractColonies.py
py
782
python
en
code
0
github-code
90
1959024610
import sys sys.stdin = open('input.txt') width, height = map(int, input().split()) num = int(input()) width_arr = [0, width] height_arr = [0, height] for _ in range(num): dir, pnt = map(int, input().split()) if dir: width_arr.append(pnt) else: height_arr.append(pnt) width_arr.sort() heigh...
ycchoi419/baekjun
BOJ2628/boj2628.py
boj2628.py
py
590
python
en
code
0
github-code
90
18326948309
#-*-coding:utf-8-*- import sys input=sys.stdin.readline def main(): n = int(input()) ans=10**12 tmp=[] for a in range(1,10**6+1): if n%a==0 and n >=a: b=n//a elif n <a: break #a,bの最小値を記憶してくれてる? ans=min(ans,a+b-2) print(ans) if __name__=="__ma...
Aasthaengg/IBMdataset
Python_codes/p02881/s561029261.py
s561029261.py
py
365
python
ja
code
0
github-code
90
28441219104
import sys from random import randrange my_num = sys.argv[1] if __name__ == '__main__': while True: rand_num = randrange(0, 2) if my_num == rand_num: print('Great!') break else: print(f'Try again it was {rand_num}') my_num = int(input('guess a n...
BarSnir/ztm-course-python
section-8/args/main.py
main.py
py
331
python
en
code
0
github-code
90
37871092200
import os import clip import torch ## PAOT TASK_NAME = ['Scattering correction', 'removing circular artifacts', 'converting low-energy images to high-energy images', 'temporal CT', 'MRI image conversion'] # Load the model device = "cuda" if torch.cuda.is_available()...
tianliang774/CLIP-env-Model-tianliang
pretrained_weights/clip_embedding.py
clip_embedding.py
py
717
python
en
code
0
github-code
90
18027096695
import numpy as np import pandas as pd import argparse # python doStep1.py --FileNumber 1 if __name__ == '__main__': parser = argparse.ArgumentParser(description = "Receive the parameters") parser.add_argument('--FileNumber', action = 'store', type = str, dest = 'FileNumber', help = 'Which file number to tak...
fmanteca/HighPt_DNN
processing/doStep1.py
doStep1.py
py
18,267
python
en
code
0
github-code
90
18070647799
a=list(map(int,input().split())) lst=[0,0] for i in range(3): if a[i]==5: lst[0]+=1 elif a[i]==7: lst[1]+=1 if lst[0]==2 and lst[1]==1: print("YES") else: print("NO")
Aasthaengg/IBMdataset
Python_codes/p04043/s091343729.py
s091343729.py
py
198
python
en
code
0
github-code
90
14519914970
import re import spacy nlp = spacy.load("en_core_web_sm") def clean_text(search_results): for result in search_results: title = result.title snippet = result.snippet title = re.sub(r"[^a-zA-Z0-9\s-]", "", title) snippet = re.sub(r"[^a-zA-Z0-9\s-]", "", snippet) title = ...
ErikaMelt/search_engine_optimization
scraper/data_preprocessing/text_processing.py
text_processing.py
py
776
python
en
code
0
github-code
90
35716356311
""" Getting everything ready to work with the data. """ import logging from secfsdstools.a_config.configmgt import ConfigurationManager from secfsdstools.a_config.configmodel import Configuration from secfsdstools.c_update.updateprocess import Updater LOGGER = logging.getLogger(__name__) def update(config: Configur...
HansjoergW/sec-fincancial-statement-data-set
secfsdstools/update.py
update.py
py
1,246
python
en
code
12
github-code
90
24406649437
import xlrd import json from django.shortcuts import render from import_export.formats.base_formats import XLS from rest_framework.views import APIView from rest_framework.parsers import MultiPartParser, FormParser from rest_framework.response import Response from rest_framework import status from fileapp.model...
joyshaha/ReactDjangoCRUD
backend/fileapp/views.py
views.py
py
5,783
python
en
code
0
github-code
90
18901497185
from random import randint # makes the items stack like in connect 4 class Stack: def __init__(self): self._list = [] def __len__(self): return len(self._list) def push(self, element): if len(self._list) <= 6: self._list.append(element) else: ...
gkeeble2003/Connect-4-Ultimate-Showdown
Connect4_Keeble_Gareth.py
Connect4_Keeble_Gareth.py
py
4,658
python
en
code
0
github-code
90
18539953269
def main(): n = int(input()) M = 55555 Int = [i for i in range(M+1)] for i in range(2,len(Int)): if Int[i]!=0: for k in range(2,M//Int[i]): Int[i*k] = 0 prm = [] for i in Int: if i!=0 and i%5==1: prm.append(i) prm = prm[1:] print(' ...
Aasthaengg/IBMdataset
Python_codes/p03362/s540530085.py
s540530085.py
py
395
python
en
code
0
github-code
90
19253489065
from sys import stdin # [row, col] moving_dir = { 'R': [0, 1], 'L': [0, -1], 'B': [1, 0], 'T': [-1, 0], 'RT': [-1, 1], 'LT': [-1, -1], 'RB': [1, 1], 'LB': [1, -1] } def convert_pos(position, type): col, row = position if type == "CHAR_TO_NUM": return [ord(col) - ord('A'), 8 - int(row)] eli...
ag502/algorithm
Problem/BOJ_1063_킹/main.py
main.py
py
2,033
python
en
code
1
github-code
90
38253397610
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(10**6) def find(node): if node == group[node]: return node else: root = find(group[node]) weight[node] += weight[group[node]] group[node] = root return root def union(a, b, w): ...
Z1Park/baekjoon
백준/Platinum/3830. 교수님은 기다리지 않는다/교수님은 기다리지 않는다.py
교수님은 기다리지 않는다.py
py
952
python
en
code
0
github-code
90
4804990810
import uuid import itertools from ..models import Component class _LogicElement(object): def __init__(self): pass def __and__(self, other): if not isinstance(other, _LogicElement): raise TypeError('The second operand is of invalid type') return _LogicGate('AND', self, othe...
avallonking/SYSU-iGEM-2014
server/algorithms/circuit_schemes.py
circuit_schemes.py
py
5,797
python
en
code
0
github-code
90
15806601147
from locust import HttpUser, task input_data = { "CHAS":{ "0":0 }, "RM":{ "0":6.575 }, "TAX":{ "0":296.0 }, "PTRATIO":{ "0":15.3 }, "B":{ "0":396.9 }, "LSTAT":{ "0":4.98 } } class LocustTaskSet(HttpUser): @task def get_site(self): self.clien...
ry-v1/Building-a-CI-CD-Pipeline
locust.py
locust.py
py
414
python
uk
code
0
github-code
90
22762096569
from __future__ import absolute_import from __future__ import division from __future__ import print_function import functools from dragon.vm import torch from dragon.vm.torch import nn from seetadet.core.config import cfg from seetadet.models.build import NECKS from seetadet.ops.build import build_activation from se...
seetaresearch/seetadet
seetadet/models/necks/bifpn.py
bifpn.py
py
4,994
python
en
code
1
github-code
90
18315819779
N, M = list(map(int, input().split(' '))) S = input() # print("%d,%d" % (N, M)) # print(S) if S[0] == 1 or S[-1] == 1: print(-1) # no route exit(0) pos = len(S) - 1 move = [] while pos >= 0: if pos - M <= 0: move.append(pos) break found = False for idx in range(pos - M, pos): ...
Aasthaengg/IBMdataset
Python_codes/p02852/s778010214.py
s778010214.py
py
602
python
en
code
0
github-code
90
4659168599
#!/usr/bin/python3 ''' This module contains a class that defines a square. ''' class Square: """ Represents a square. """ def __init__(self, size=0, position=(0, 0)): ''' Initializes a new instance of the Square class. Args: size (int): The size of the square. Def...
Nadene381/alx-higher_level_programming
0x06-python-classes/6-square.py
6-square.py
py
2,726
python
en
code
0
github-code
90
10369293472
from os.path import join, abspath from os import listdir, remove from PIL import Image from PIL.ImageOps import invert, colorize from typing import ClassVar def printProgressBar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='█', printEnd="\r"): """ Call in a loop to create terminal prog...
MateuszPerczak/Sounder5
src/convert.py
convert.py
py
3,372
python
en
code
7
github-code
90
37902390268
#Exercise Question 10: Given an input string, count occurrences of all characters within a string #count("pynativepynvepynative") = {'p': 3, 'y': 3, 'n': 3, 'a': 2, 't': 2, 'i': 2, 'v': 3, 'e': 3} import sys inputStr="pynativepynvepynative" countDict=dict() for char in inputStr: count=inputStr.count(char) ...
sevilaybayatli/PYTHS19
Ex10.py
Ex10.py
py
361
python
en
code
0
github-code
90
18347604819
#import math #import bisect #import numpy as np #import itertools #import copy import collections import sys ipti = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): n = int(input()) print((n-1)*n//2) if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p02924/s113703214.py
s113703214.py
py
299
python
en
code
0
github-code
90
28406483137
class Solution(object): def minSetSize(self, arr): n = len(arr) d = {} for element in arr: if element in d: d[element] += 1 else: d[element] = 1 data = list(d.items()) data.sort(key = lambda x:...
psp515/LeetCode
1338-reduce-array-size-to-the-half/1338-reduce-array-size-to-the-half.py
1338-reduce-array-size-to-the-half.py
py
531
python
en
code
1
github-code
90
18290856579
N = int(input()) t = [] index = {} for n in range(N): si, ti = input().split() ti = int(ti) index[si] = n t.append(ti) X = input() ans = 0 for i in range(index[X]+1, N): ans += t[i] print(ans)
Aasthaengg/IBMdataset
Python_codes/p02806/s825056925.py
s825056925.py
py
215
python
en
code
0
github-code
90
41006814288
#!/usr/bin/python3 import sys import os asmName = '' if len(sys.argv) > 2 and sys.argv[1] == '-f' and len(sys.argv[2]) > 0: asmName = sys.argv[2] else: print("Usage: optimize.py -f assembly.asm") exit() asmFile = open(asmName, 'r') dotIndex = asmName.rfind('.') if dotIndex < 0: print("Input file shoul...
minkcv/vm
compiler/optimize.py
optimize.py
py
7,756
python
en
code
28
github-code
90
20305265691
# -*- coding: utf-8 -*- """ @attention: 定义全局上下文变量 @author: lizheng @date: 2011-11-28 """ def config(request): """ @attention: Adds settings-related context variables to the context. """ import datetime from django.conf import settings from www.misc import consts return { 'DEBUG':...
lantianlz/eqcj
www/misc/context_processors.py
context_processors.py
py
686
python
en
code
0
github-code
90
1987952869
# -*- coding:utf-8 -*- ''' 面试64 如何得到一个数据流中的中位数?如果从数据流中读出奇数个数值,那么中位数就是所有数值排序之后位于中间的数值。 如果从数据流中读出偶数个数值,那么中位数就是所有数值排序之后中间两个数的平均值。 面试题64:数据流中的中位数:构建一个最大堆和一个最小堆,分别存储比中位数小的数和大的数。 当目前两堆总数为偶数的时候,把数字存入最大堆,然后重排最大堆,如果最大堆的堆顶数字大于最小堆堆顶数字, 则把两个堆顶数字交换,重排两堆,此时两堆数字总数为奇数,直接输出最大堆堆顶数字即为中位数; 如果当前两堆总数为技术的时候,把数字存入最小堆,重排最小堆, 如果最大堆的堆...
chimuuu/offercode
offer64.py
offer64.py
py
3,110
python
zh
code
6
github-code
90
36346991997
# 画像関係 import cv2 import numpy as np # システム関係 import os import sys # 画面情報 from screeninfo import get_monitors # json import json # GUI関係 import pyautogui def main(): # コマンドライン引数 args = sys.argv # 入力ファイル名 input_fname = args[1] if not os.path.exists(input_fname): print("ファイルが存在しません") ...
KinoshitaYstr/keppeki_movie_transform_system
cui/1_cui.py
1_cui.py
py
4,140
python
ja
code
0
github-code
90
41630359125
import tkinter as tk from tkinter import ttk import ui.admin.admin_page as admin from entities.student import Student from repositories.semi_year_repo import get_semi_years_values from repositories.student_group_repo import get_student_groups_values from repositories.student_repo import get_students, delete_student fr...
rares01/OrarQA
ui/admin/views/students_view.py
students_view.py
py
9,470
python
en
code
0
github-code
90
44238822535
import os import numpy as np import time import shutil ROOT_PATH = "/home/umut/datasets_raw/Roboflow" SAVE_ROOT_PATH = "/home/umut/dataset_no_duplicate_names" sub_dirs = os.listdir(ROOT_PATH) print(sub_dirs) all_paths_images = [] all_paths_labels = [] saved_names = dict() for dir in sub_dirs: current_sub_dir ...
ozy5/Apply_YOLO_Annotations
get_unique_images_and_annotations.py
get_unique_images_and_annotations.py
py
1,985
python
en
code
0
github-code
90
24223398639
import argparse from freewillai.contract import TokenContract from freewillai.common import Provider from freewillai.exceptions import UserRequirement from freewillai.utils import get_account, load_global_env def cli(): parser = argparse.ArgumentParser() parser.add_argument('-m', '--mint', type=int) pars...
hackcheek/gnosis-freewillai-hackaton
token_owner.py
token_owner.py
py
2,184
python
en
code
0
github-code
90
17668439002
#!/usr/bin/env python # coding: utf-8 # Import standard libraries import glob import pickle from collections import defaultdict import json import pandas as pd # Import custom libraries import utils property_set='p10' partitions=['partial', 'full'] extractors=['gold', 'auto'] datasets=['PD1', 'PD2', 'PD3', 'PD4', 'F...
cltl/LongTailIdentity
analysis/distinguishability.py
distinguishability.py
py
7,928
python
en
code
1
github-code
90
3391379584
from src.database import db from dataclasses import dataclass import datetime @dataclass class Buscar: userId : str nick : str timestamp : datetime.datetime agent : bool profileLink : str # perfil LA profileLink2 : str # perfil comunidad...
leafylemontree/nati_amino-bot
src/special/lideramino/buscar.py
buscar.py
py
8,172
python
es
code
5
github-code
90
11797538051
from datetime import datetime, timedelta import random from flask.helpers import get_root_path from dashlib import * def register_dashapp(my_app, title, base_pathname, layout, register_callbacks_fun): # Meta tags for viewport responsiveness meta_viewport = {"name": "viewport", "content": "width=device-width, i...
sidec15/user-dashboard
app.py
app.py
py
2,211
python
en
code
0
github-code
90
44778630136
import gym import numpy as np import tensorflow as tf from tf_agents.networks import actor_distribution_network from tf_agents.agents.reinforce import reinforce_agent train_env = gym.make('gym_terminal:terminal-v0') # step = env.reset() # print('Reset:') # print(step) # action = "ls -R /" # next_step = env.step(act...
sniper7kills/PY-Gym-Terminal-Env
main.py
main.py
py
981
python
en
code
0
github-code
90
22056660052
#-*- coding: UTF-8 -*- import datetime import time import json import uuid import os import os.path import hashlib import platform import traceback from collections import OrderedDict import functools #// The internal representation of Time uses FILETIME, whose epoch is 1601-01-01 #// 00:00:00 UTC. ((19...
reinhardtken/refresh_phone
python/ctp_py/util/utility.py
utility.py
py
13,546
python
en
code
0
github-code
90
17950125039
h,w=map(int,input().split()) a=[] for _ in range(h): a+=list(input()) four=(h//2)*(w//2) two=h%2*w//2+w%2*h//2 one=(h%2)*(w%2) import collections c = collections.Counter(a) #print(four,two,one) d=list(c.values()) d.sort() for item in d: if item==1: if one==1: one-=1 else: ...
Aasthaengg/IBMdataset
Python_codes/p03593/s741760295.py
s741760295.py
py
1,119
python
en
code
0
github-code
90
43494674304
import logging import time import pandas as pd from src.data_preprocessing import TrainTestGenerator logger = logging.getLogger(__name__) def compute_ranks(train, test, recommended): train = train.copy() test = test.copy() recommended = recommended.copy() # Remove train items from recommended ...
tm1897/mlg_cs224w_project
src/evaluator.py
evaluator.py
py
7,498
python
en
code
8
github-code
90
23720602668
#coding: utf-8 from datetime import datetime from flask import render_template, url_for, redirect, request, Blueprint import mistune from official.models import db, Stb, ImageVote, Post, PeopleShow, Weibo, ListImage from config import YOUKU_CLIENT_ID user_view = Blueprint("user_view", __name__, template_folder="templ...
zhangshy/myofficial
official/userView.py
userView.py
py
2,837
python
en
code
0
github-code
90
17590711446
import gym import pygame from ursina import * from ursina.prefabs.first_person_controller import FirstPersonController from pygame.locals import * import os, sys from controller.ai_controller import Learner, QLearner, SARSALearner from controller.game_controller import GameController, UniColoredGameController from cont...
Miguel26-pixel/FEUP-IART
Project2/view/menu.py
menu.py
py
3,802
python
en
code
1
github-code
90
6326909267
import mock import crittercism.client from tests.base import BaseTestCase class CrittercismClientTestCase(BaseTestCase): def setUp(self): self.standard_headers = { 'Accept-Encoding': 'gzip, deflate, sdch', 'Accept-Language': 'en-US,en;q=0.8', 'Accept': 'application/j...
crittercism/integration_newrelic
tests/test_crittercism_client.py
test_crittercism_client.py
py
2,512
python
en
code
2
github-code
90
18420024999
def main(): s = list(input()) n = len(s) cnt0, cnt1 = 0, 0 for i in range(n): if i % 2 == 0 and s[i] != "0": cnt0 += 1 elif i % 2 == 1 and s[i] != "1": cnt0 += 1 for i in range(n): if i % 2 == 0 and s[i] != "1": cnt1 += 1 elif i %...
Aasthaengg/IBMdataset
Python_codes/p03073/s888884605.py
s888884605.py
py
435
python
en
code
0
github-code
90
18265339239
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") n,k = map(int , input().split()) i = 0 while pow(k, i)<=n: i += 1 print(i)
Aasthaengg/IBMdataset
Python_codes/p02766/s211593479.py
s211593479.py
py
221
python
en
code
0
github-code
90
71226620776
import argparse import os import platform import shutil import time from pathlib import Path import cv2 import torch import copy import torch.backends.cudnn as cudnn from numpy import random from torch import nn import numpy as np import matplotlib.pyplot as plt from PIL import Image from models.experimental import a...
zigangzhao-ai/yolov5_dms
yolov5s_dms/detect_class_hand_pinjie.py
detect_class_hand_pinjie.py
py
15,700
python
en
code
1
github-code
90
18441636459
#!/usr/bin/python3 import bisect # from collections import Counter, deque, OrderedDict, defaultdict # from copy import copy, deepcopy # pythonのみ.copyは1次元,deepcopyは多次元. # from functools import reduce # from heapq import heapify, heappop, heappush # from itertools import accumulate, permutations, combinations, combinatio...
Aasthaengg/IBMdataset
Python_codes/p03112/s659307789.py
s659307789.py
py
1,534
python
en
code
0
github-code
90
3096493722
# -*- coding: utf-8 -*- __author__ = 'Marc Tudurí' __email__ = 'marctc@gmail.com' __version__ = '0.8' PUPUT_APPS = ( # Wagtail apps 'wagtail', 'wagtail.admin', 'wagtail.documents', 'wagtail.snippets', 'wagtail.users', 'wagtail.images', 'wagtail.embeds', 'wagtail.search', 'wagta...
madicorp/wafa
puput/__init__.py
__init__.py
py
572
python
en
code
0
github-code
90
18571905089
import sys import io import math import string # solution sys.setrecursionlimit(100001) def input(): return sys.stdin.readline()[:-1] def dfs(v): ret = True for u, d in es[v]: if x[u] == None: x[u] = x[v] + d ret = ret and dfs(u) elif x[u] != x[v] + d: r...
Aasthaengg/IBMdataset
Python_codes/p03450/s105333857.py
s105333857.py
py
744
python
en
code
0
github-code
90
74785456617
import math class Solution: # @param n, an integer # @return an integer def reverseBits(self, n): g=31 answer=0 for i in range(32): i=n%2 if(i==1): answer+=int(math.pow(2, g)) n=n//2 g-=1 return answer var=Sol...
codejigglers/leetcodes
reverseBiths.py
reverseBiths.py
py
356
python
en
code
0
github-code
90
72221695658
# Receives a file as an input and filters a specific number in the file, # and puts out the average of that number fname = input('Enter file name: ') read_file = open(fname) count = 0 line_float = 0 for line in read_file: line = line.rstrip() if not line.startswith("X-DSPAM-Confidence:"): continue ...
AmanuelFeyissa/Runway
Python/Projects To Show/file manipulation/file_man.py
file_man.py
py
559
python
en
code
0
github-code
90
37016914823
import time import alarm import supervisor import alarm from adafruit_magtag.magtag import MagTag # Change this to the hour you want to check the data at, for us its 8pm # local time (eastern), which is 20:00 hrs DAILY_UPDATE_HOUR = 20 # Set up where we'll be fetching data from DATA_SOURCE = "http://gas-monitor.isiai...
iainnash/ethdenver-hardware-hack-demos
magtag/device/gas_price_display.py
gas_price_display.py
py
2,159
python
en
code
3
github-code
90
10121444857
import datetime as dt import requests import json import base64 import os import secrets import sys sys.path.insert(0, '../') from utils import * class MosipSession: def __init__(self, server, user, password, appid='regproc', ssl_verify=True): self.server = server self.user = user self.pass...
mosip/mosip-infra
deployment/sandbox-v2/test/regproc/api.py
api.py
py
9,916
python
en
code
15
github-code
90
29868651390
#-*-coding:utf-8-*-# import jieba jieba.load_userdict("mydict.txt") diction = {} fr = open("./model/2.txt","r") line = fr.readline() c = 0 while line: c +=1 res = jieba.lcut(line)#分词为list for word in res: if word in diction: diction[word] += 1 else: diction[word] = ...
LiXianyao/mesgTreeTest
wordCount.py
wordCount.py
py
383
python
en
code
0
github-code
90
1273779230
#encoding: utf-8 import json from django import template from django.conf import settings register = template.Library() @register.inclusion_tag('laws/bill_full_name.html') def bill_full_name(bill): return { 'bill': bill } @register.inclusion_tag('laws/bill_list_item.html') def bill_list_item(bill, add_li=True,...
ofri/Open-Knesset
laws/templatetags/bills_tags.py
bills_tags.py
py
5,488
python
en
code
96
github-code
90
21392778969
x, y = symbols("x y", positive=True, real=True) def g(x, ac, bc, cabc): return (1-x)*ac + x * bc - x*(1-x)*cabc cgainp = 0.65 cgainas = 0.477 cinasp = 0.1 cgaasp = 0.19 gaas = 1.423 inas = 0.356 inp = 1.353 gap = 2.777 fgainasp=x*(1-x)*((1-y)*g(x,gap,inp,cgainp)\ + y*g(x, gaas, inas, cgainas))\ ...
sposs/Documents
Paris_NOTEDEV_Python/sympy2.py
sympy2.py
py
445
python
en
code
1
github-code
90
72705012137
# Binary Search Algorithm # TO DO # pass the array # Add case where 1 element #import sys arr = [5, 17, 23, 33, 39, 44, 58, 62, 70, 74, 82, 99] end = len(arr) start = 0 #sys.setrecursionlimit(40000) def binarySearch(arr, start, end, x): #print("This is end: {}".format(end)) mid = int((end + start)/2) #p...
geekchick/search
binarysearch.py
binarysearch.py
py
890
python
en
code
0
github-code
90
73346641257
import os import argparse from exputils.configurations import Config, create_object_from_config from exputils.utils import eprint def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument('--config-file', dest='config_file') return parser.parse_args() if __name__ == '__main__': ...
danielecastellana22/exputils
preprocess.py
preprocess.py
py
690
python
hi
code
0
github-code
90
2797763916
import random # prompt the user for the names of the players # use the names entered to build up a list of dictionaries # players = [{'name': 'Billy', 'chips': 3}, {'name': 'Janice', 'chips': 3}, {'name': 'Beatrice', 'chips': 3}] def get_players(): players = [] while True: name = input('Enter a name ...
PdxCodeGuild/class_salmon
1 Python/solutions/mob06_lcr.py
mob06_lcr.py
py
4,127
python
en
code
5
github-code
90
71375040938
def print_tree(node): width, height, pos_root, block = pretty_tree(node) for value in block: print(value) def pretty_tree(node): value = str(node.value) length = len(value) if node.left is None and node.right is None: return length, 1, length / 2, [value] bottom_left_block =...
ivanna-ostrovets/compilation-theory
scripts/draw_tree.py
draw_tree.py
py
2,709
python
en
code
0
github-code
90
18419269109
N = int(input()) H = list(map(int,input().split())) Hmax=H[0] cnt = 1 for i in range(1,N): if Hmax<=H[i]: cnt += 1 Hmax = max(Hmax,H[i]) print(cnt)
Aasthaengg/IBMdataset
Python_codes/p03072/s957386040.py
s957386040.py
py
163
python
en
code
0
github-code
90
44447940363
from causallearn.search.ScoreBased.GES import ges import pandas as pd # Visualization using pydot from causallearn.utils.GraphUtils import GraphUtils import matplotlib.image as mpimg import matplotlib.pyplot as plt import io import pydot import numpy as np from sklearn.manifold import TSNE from causallearn.score.Loc...
Maurice-1235/vis-dashboard
backend/func.py
func.py
py
3,122
python
en
code
0
github-code
90
70620089897
# -*- coding: utf-8 -*- """ Created on Fri Aug 31 21:40:12 2018 @author: xuanm """ import numpy as np import tensorflow as tf import nexfile from my_nex_class import my_nex_class from sklearn.metrics import r2_score from sklearn.metrics import explained_variance_score def get_one_minute_data(bin_size,start_min,X,y): ...
xuanma/python_for_neuroexplorer
greyson_emg.py
greyson_emg.py
py
3,999
python
en
code
0
github-code
90
70995487337
import math import chess ''' Given a FEN, the program returns the best move. Has opening lines, basic endgame knowledge. consider moves -> min_max evaluation using alpha beta -> evaluate Criteria: 1. Material imbalance 2. Piece Activity ''' class ChessEngine: def __init__(self, depth=4, fen=chess.STARTING_FEN)...
hiradd0306/Chess-Engine
engine_2022.py
engine_2022.py
py
11,502
python
en
code
0
github-code
90
10561098384
import nfl_veripy.constraints as constraints import numpy as np from nfl_veripy.dynamics import ISS dynamics = ISS() init_state_range = 1 * np.ones((dynamics.n, 2)) init_state_range[:, 0] = init_state_range[:, 0] - 0.5 init_state_range[:, 1] = init_state_range[:, 1] + 0.5 iss_xs, iss_us = dynamics.collect_data( t...
afronautsam/nfl_veripy
src/nfl_veripy/utils/iss_data_generating.py
iss_data_generating.py
py
778
python
en
code
null
github-code
90
38721492506
import cv2 import numpy as np import tensorflow as tf import keras.backend as K def to_rgb(bgr): ''' Convert an image's channels from BGR to RGB. ''' return cv2.cvtColor(bgr, cv2.COLOR_BGR2RGB) def rgb_read(img_path): ''' Read an image file as a RGB image. ''' return to_rgb(cv2.i...
christeefy/LimeLight
limelight/pkg_utils.py
pkg_utils.py
py
2,732
python
en
code
1
github-code
90
17515396745
import torch import open3d import numpy as np from torch.utils.data import Dataset try: from torch_points_kernels import knn USING_TORCH_POINTS_KERNELS = True except(ModuleNotFoundError, ImportError): USING_TORCH_POINTS_KERNELS = False class RandLaNetDataset(Dataset): def __init__(self, clouds_coords, cloud...
ToyOwl/classified_pixels
segmentation_models/datasets/RandLaNetDataset.py
RandLaNetDataset.py
py
7,112
python
en
code
0
github-code
90
42950059527
#!/usr/bin/env python3 import sys import os import re import time from os.path import isdir, isfile, join, splitext from termcolor import colored VIDEOQUALITY = ["480p", "720p", "1080p"] FORMAT = ["BluRay", "Bluray", "Web-DL", "WEB-DL", "WebRip", "WEBRip", "AMZN", "NF", "WEB", "PROPER", "REPACK", "UNRATED", "REMASTE...
nasfiles/organiser
filerename.py
filerename.py
py
7,457
python
en
code
0
github-code
90
12333673887
#!/usr/bin/env python3 # 2020-04 # https://www.python-course.eu/python3_class_and_instance_attributes.php # Class and Instance Attributes # Static Methods # # We can make public (class) attributes private as well. # # We want a method, which we can call via the class name or via the instance # name without the necessi...
philippdrebes/MSCIDS_PDS01
Pycharm/SW09/python-course.eu/oop2/22_class-and-instance-attributes-static-methods-robo-01.py
22_class-and-instance-attributes-static-methods-robo-01.py
py
1,455
python
en
code
0
github-code
90
41116805848
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="AsyncExclusivePeriods", version="1.12", author="Antas", author_email="", description="Think about such scene, some object has different state or periods, well we call periods.Among these p...
monk-after-90s/AsyncExclusivePeriods
setup.py
setup.py
py
918
python
en
code
0
github-code
90
25302548552
# Version info __version__ = '0.9.1' __license__ = 'MIT' # Project description(s) __description__ = 'Pretty console printing of tabular data' # The project's main homepage. __url__ = 'https://github.com/nirum/tableprint' # Author details __author__ = 'Niru Maheswaranathan' __author_email__ = 'niru@hey.com'
nirum/tableprint
tableprint/metadata.py
metadata.py
py
311
python
en
code
169
github-code
90
23815936347
from __future__ import annotations import typing as t import click from globus_cli.parsing import command from globus_cli.reflect import walk_contexts from globus_cli.types import ClickContextTree def _print_command(cmd_ctx: click.Context) -> None: # print commands with short_help short_help = cmd_ctx.comm...
globus/globus-cli
src/globus_cli/commands/list_commands.py
list_commands.py
py
1,844
python
en
code
67
github-code
90
17358717624
from common import * CHAINS=sess.get("https://relay-api-33e56.ondigitalocean.app/api/crosschain-config").json() res = [HEADER] for c1 in CHAINS: cid = c1["chainId"] name = chainid2name(c1["networkId"]) print(cid, name) rpcs = chain2rpcs(c1["networkId"]) if not rpcs: print("no such r...
DeFiEye/BridgeEye
crosschain/relay.py
relay.py
py
1,646
python
en
code
45
github-code
90
24426560888
import numpy as np import glob import os from scipy import spatial import pickle # Please change this to your location data_root = '/data/xincoder/ApolloScape/' history_frames = 6 # 3 second * 2 frame/second future_frames = 6 # 3 second * 2 frame/second total_frames = history_frames + future_frames # xy_range = 1...
xincoder/GRIP
data_process.py
data_process.py
py
8,124
python
en
code
143
github-code
90
37088487652
from typing import Optional import streamlit as st from langchain.chat_models import ChatOpenAI from langchain.prompts import ChatPromptTemplate from langchain.chains import SequentialChain, LLMChain poem_title_suggestion_prompt_template = ChatPromptTemplate.from_template( """Suggest a title for a poem with ...
rexsimiloluwah/streamlit-llm-apps
src/utils/poem_generator.py
poem_generator.py
py
1,640
python
en
code
9
github-code
90
44750449779
# -*- coding: utf-8 -*- """ 本模块提供一些通用的功能 """ from __future__ import print_function import sys import json import math import time import matplotlib.pyplot as plt import matplotlib.ticker as ticker import torch import jieba from torch.autograd import Variable CONNECT_TAG = u'TAG_CON' BEGIN_TAG = u'TAG_BEG' END_...
P79N6A/Summer
Python/NLP/WordMap.py
WordMap.py
py
5,147
python
en
code
0
github-code
90
27089163238
from spack import * class Archer(CMakePackage): """ARCHER, a data race detection tool for large OpenMP applications.""" homepage = "https://github.com/PRUNERS/ARCHER" url = "https://github.com/PRUNERS/archer/archive/v1.0.0.tar.gz" version('1.0.0', '790bfaf00b9f57490eb609ecabfe954a') depend...
matzke1/spack
var/spack/repos/builtin/packages/archer/package.py
package.py
py
694
python
en
code
2
github-code
90
18317076009
import sys n = int(input()) a = list(map(int, input().split())) cnt = 0 ave = sum(a)/2 for i in range(n): cnt += a[i] if cnt == ave: print(0) sys.exit() elif cnt > ave: x = ave -cnt +a[i] if x >= cnt -ave: x = cnt -ave break print(int(x*2))
Aasthaengg/IBMdataset
Python_codes/p02854/s323375737.py
s323375737.py
py
314
python
en
code
0
github-code
90
18686622826
# -*- coding: utf-8 -*- """ Created on Wed May 2 20:13:51 2018 @author: Administrator """ import func_def as func def analysis_protocol(protocol_str): protocol_info = func.data_split(protocol_str,'DATA_INFO_for_switch') if func.data_verify(protocol_str) == 0: print("数据有错误") re...
VicWang233/tools_for_S31
protocol_config_apply_to_get_switching_value.py
protocol_config_apply_to_get_switching_value.py
py
4,550
python
en
code
1
github-code
90
18323610019
from collections import* n=input() a=list(map(int,input().split())) d=dict(Counter(a)) mod=998244353 ans=a[0]==0 and d[0]==1 for i in d: if i==0:continue ans*=pow(d.get(i-1,0),d[i],mod) ans%=mod print(ans)
Aasthaengg/IBMdataset
Python_codes/p02866/s439758401.py
s439758401.py
py
211
python
en
code
0
github-code
90
42499489901
#!/usr/bin/python3 '''API module - Task 0''' import requests import sys def show_user_status(): '''Show the currtent state of tasks for the given user id''' url_tasks = 'https://jsonplaceholder.typicode.com/todos?userId=' url_users = 'https://jsonplaceholder.typicode.com/users?id=' userId = sys.arg...
gorgyboy/holberton-system_engineering-devops
0x15-api/0-gather_data_from_an_API.py
0-gather_data_from_an_API.py
py
1,357
python
en
code
0
github-code
90
15469544148
import argparse import colorsys import itertools import math import pprint import re import matplotlib.pyplot as pl pattern_chip = re.compile(r'^(NV.{2,3})[^\t]*\t(.*)$') pattern_paren = re.compile(r'([^(]*)\(([^)]*)\)(.*)') pattern_bracket = re.compile(r'([^[]*)\(([^]]*)\)(.*)') pattern_names = [ [re.compile('...
martin-ueding/graphics-chip-plot
nvidia.py
nvidia.py
py
6,039
python
en
code
0
github-code
90
34292926827
# coding=utf-8 """Unit tests for :mod:`pulp_smash.api`.""" import unittest from unittest import mock from packaging.version import Version from requests import Response from pulp_smash import api, config _HANDLER_ARGS = ("client", "response") @mock.patch.object(api, "safe_handler", lambda *_: _[1]) @mock.patch.ob...
pulp/pulp-smash
tests/test_api.py
test_api.py
py
11,236
python
en
code
3
github-code
90
15331902155
import tensorflow as tf import numpy as np from tensorflow import keras from keras.preprocessing import image np.set_printoptions(threshold=np.inf) classifier = keras.models.load_model('softmax.h5') # for p in classifier.get_weights(): # print(p.shape) """ Achieve the ouput of the ChestNet in advance """ for i ...
Callmejp/DiplomaProject
ChestNet/convert_to_tf.py
convert_to_tf.py
py
3,431
python
en
code
0
github-code
90
29737487065
from sql_models.util import is_bigquery, is_athena from tests.functional.bach.test_data_and_utils import assert_equals_data, get_df_with_test_data EXPECTED_DATA = [ [1, 1, 'Ljouwert', 'Leeuwarden', 93485, 1285], [2, 2, 'Snits', 'Súdwest-Fryslân', 33520, 1456], [3, 3, 'Drylts', 'Súdwest-Fryslân', 3055, 1268...
massimo1220/objectiv-analytics-main
bach/tests/functional/bach/test_df_rename.py
test_df_rename.py
py
1,955
python
en
code
5
github-code
90
21306327668
from typing import Any import pandas as pd import requests from fastapi.logger import logger def send_get(url: str, headers: dict[str, str] | None = None) -> requests.Response | None: if headers is None: headers = {} response = requests.get(url, headers=headers) if response.status_code == 403: ...
Samoed/EthicsAnalysis
api/app/utils.py
utils.py
py
766
python
en
code
0
github-code
90
17208475896
#! /usr/bin/env python3 from collections import OrderedDict, defaultdict import datetime import weakref from PyQt4 import QtCore import traceback class Stream(QtCore.QObject): """Class representing a data stream. A stream can have multiple channels. Each time a channel value is updated the updated s...
luxusv/quadcopter-basestation
stream.py
stream.py
py
1,846
python
en
code
0
github-code
90
18017420771
from __future__ import absolute_import import itertools import numpy as np from pytorch_toolbelt.utils.torch_utils import tensor_from_rgb_image def plot_confusion_matrix( cm, class_names, figsize=(16, 16), normalize=False, title="Confusion matrix", fname=None, noshow=False, ): """Ren...
SysCV/transfiner
pytorch_toolbelt/utils/visualization.py
visualization.py
py
1,961
python
en
code
501
github-code
90
14477789566
from flask import Flask, request, render_template, redirect, session from user import User app = Flask(__name__) app.secret_key = "key it safe" @app.route('/') def index(): users = User.get_all() return render_template('index.html', users = users) # Add a New User @app.route('/new_user') def new_user(): ...
ttoews6/Codingdojo-Assignments
Python/flask_mysql/users_cr/server.py
server.py
py
519
python
en
code
0
github-code
90
42751214725
import asyncio import aiosqlite import logging as LOGGER async def create_conn(): db = Sqlite3Class() await db._init() return db class Sqlite3Class: # async def __init__(self, loop): # pass # self.conn = await aiosqlite.connect("pythonsqlite.db", loop=loop) # self.cursor = await self.co...
kmnx/wombot-asyncio
aiosqliteclass.py
aiosqliteclass.py
py
5,787
python
en
code
5
github-code
90
34888094553
#!/usr/bin/env python # -*- coding:utf-8 -*- import tensorflow as tf import numpy as np class CNN(object): """ define all the layers in the convolutional neural network. tensorflow version is r1.4. basiclly we use an embedding layer, then a convolutional layer, followed by a pooling layer, end with a ...
yijianTX/58_info_classification
TextClassification/conv_neural_network.py
conv_neural_network.py
py
5,873
python
en
code
0
github-code
90
5985047920
from __future__ import print_function from collections import OrderedDict import numpy as np class TorchZND: def __init__(self): self.data = OrderedDict([]) self.npdata = None self.file_objs = [] self.header = [] def readcat(self,fnames): self.__init__() # fnames: list of Torch output files to concatena...
Flash-Star/nucplotlib
Torch.py
Torch.py
py
2,403
python
en
code
2
github-code
90
18439807259
N = int(input()) ans = 0 b = 380000.0 for i in range(N): s = list(input().split()) if s[1] == "JPY": ans += int(s[0]) else: ans += float(s[0]) * b print(ans)
Aasthaengg/IBMdataset
Python_codes/p03110/s370789283.py
s370789283.py
py
171
python
en
code
0
github-code
90
18586468749
# import numpy as np import sys, math from itertools import permutations, combinations from collections import defaultdict, Counter, deque from math import factorial, gcd from bisect import bisect_left, bisect_right sys.setrecursionlimit(10 ** 7) enu = enumerate MOD = 10 ** 9 + 7 input = lambda: sys.stdin.readline()[:...
Aasthaengg/IBMdataset
Python_codes/p03486/s112519270.py
s112519270.py
py
716
python
en
code
0
github-code
90
18409991299
import sys readline = sys.stdin.readline def main(): N = int(readline()) cnt = 0; leftB = 0; rightA = 0; same = 0 for _ in range(N): s = readline()[:-1] for i in range(len(s)-1): subs = s[i:i+2] cnt += subs == 'AB' leftB += s[0] == 'B' rightA += s[-...
Aasthaengg/IBMdataset
Python_codes/p03049/s415498149.py
s415498149.py
py
565
python
en
code
0
github-code
90
1535470662
# level order traversal in binary search tree ''' approach: find hight h, print nodes of all levels, from 1 to h ''' class Node: def __init__(self, val): self.value = val self.left = None self.right = None def insert(self, data): # no dups allowed if self...
nirva098/generaltricks
codes/bstlot.py
bstlot.py
py
2,349
python
en
code
0
github-code
90
2033830665
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Player', fields=[ ('id', models.AutoField(verbo...
JonesAndrew/ChallongeGen
gen/migrations/0001_initial.py
0001_initial.py
py
655
python
en
code
0
github-code
90
18290544539
import sys input = sys.stdin.readline N = int(input()) musics = [] for _ in range(N): s, t = input().split() musics.append((s.strip(), int(t))) X = input().strip() ans = 0 flag = False for s, t in musics: if flag: ans += t if s == X: flag = True print(ans)
Aasthaengg/IBMdataset
Python_codes/p02806/s408659426.py
s408659426.py
py
291
python
en
code
0
github-code
90
14192087288
import cv2 import numpy as np def resize_to_even(im): """ Resizes an image to have even spatial dimensions. """ shape = np.array(im.shape) shape[shape % 2 == 1] += 1 height, width, _ = shape im = cv2.resize(im, (width, height)) return im def build_gauss_pyramid(im, max_layer=None): """ B...
maxcrous/magnify_motion
pyramids.py
pyramids.py
py
3,810
python
en
code
6
github-code
90
73395281898
# -*- coding: utf8 -*- from FGAme import * from random import uniform import kivy from kivy.app import App from kivy.lang import Builder from kivy.clock import Clock from kivy.uix.floatlayout import FloatLayout #========================================================================= # Cria o mundo #===============...
bernardohrl/PDS_2016.2
FGAme/src/FGAme/demos/old/games/kivy3.py
kivy3.py
py
2,200
python
en
code
0
github-code
90
25007939904
from typing import List, Optional, Any, Dict # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class inorderIterator: def __init__(self, root) -> None: self.stack =...
hvijaycse/Leetcode
problems/1305.py
1305.py
py
1,565
python
en
code
0
github-code
90
37663776584
import hmac import random import string from fastapi import APIRouter, Request from starlette.responses import JSONResponse from src.cache.cache import redis_cache from src.database.account.account import Account, TwoFactorLoginData from src.database.database_sessions import sessions from src.management_api.admin.aut...
MJ-API-Development/api-gateway
src/management_api/routers/authorization/authorization.py
authorization.py
py
5,953
python
en
code
3
github-code
90