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
33367768493
#! /usr/bin/env python3 from sys import stdin, stderr from re import match def extract_feats(input_word, gold_word): if len(input_word) != len(gold_word): print(input_word + " " + gold_word) exit(1) if len(input_word) == 0: return iletters = [] gletters = [] if match("<....
mpsilfve/mpsilfve
crf_ocr_post_proc/extract_features.py
extract_features.py
py
1,745
python
en
code
0
github-code
90
1332577252
''' aabcdea a|abcde|a abacaea a bac ae a loop through string if char in set append curr segment to res reset segment and set (always) add char i to set (always) add char to segment ''' def nonRepeatingSegments(s): found = set() segment = '' res = [] for i in s: if i in found: res.append(se...
dariusnguyen/algorithm_data_structure_replit
aaa_Amazon/nonRepeatingSegments.py
nonRepeatingSegments.py
py
571
python
en
code
0
github-code
90
30304700468
import os path = "D:\\movies\\witcher\\The.Witcher.S01.COMPLETE.720p.NF.WEBRip.x264-GalaxyTV[TGx]" os.chdir(path) for i in os.listdir(): name, extension = os.path.splitext(i) label = name.split(".")[2][:-2] print(label) os.rename(path+"\\"+i, path+"\\"+label)
v4nh4n/small-projects
rename.py
rename.py
py
312
python
en
code
0
github-code
90
7983844358
class Solution(object): def two_sum_SS(self, nums:list, target:int)-> list: # Convert list to dictionary with items' indices as keys result_dict = {} for index, item in enumerate(nums): search_value = target - item if search_value in result_dict: r...
SahandSomi/algorithms-exercise
Array & Hashing/Two Sum/two_sum.py
two_sum.py
py
995
python
en
code
0
github-code
90
2702906447
import numpy as np def arctan(x,n): """Returns series expansion of arctan(x); n = iterations.""" answer = 0 for i in range (0,n+1): if -1<=x<0 or 0<x<=1: answer += (((-1)**i) / (2*i + 1)) * x ** (2*i +1) return answer elif x<-1: ...
tedible/Arctan-series-expansion
arctan_series.py
arctan_series.py
py
598
python
en
code
0
github-code
90
18523977359
n,m = map(int,input().split()) xyz = [[int(i) for i in input().split()] for j in range(n)] ans = 0 num = 2**3 for i in range(num): tmp = format(i,'0'+str(3)+'b') li = [] for j in range(n): kari = 0 for k in range(3): kari += xyz[j][k]*(-1)**int(tmp[k]) li.append(kari) ...
Aasthaengg/IBMdataset
Python_codes/p03326/s709411903.py
s709411903.py
py
443
python
en
code
0
github-code
90
33707211523
import numpy as np def __coefficients(oracle): A = np.asarray(oracle[:, 0], dtype=bool) B = np.asarray(oracle[:, 1], dtype=bool) a = np.sum(A * B) # A right, B right b = np.sum(~A * B) # A wrong, B right c = np.sum(A * ~B) # A right, B wrong d = np.sum(~A * ~B) ...
viisar/brew
brew/metrics/diversity/paired.py
paired.py
py
3,722
python
en
code
301
github-code
90
30940533157
import time from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.keys import Keys import pandas as pd nomePLA = "" nomeCVS = "" caminhoPlanilha = r"C:\Users\Micro\Desktop\pla...
AndreyWBS/botWPP_multiprocessing
main.py
main.py
py
5,329
python
pt
code
0
github-code
90
32461483288
import numpy as np from sklearn import preprocessing, cross_validation, neighbors import pandas as pd df = pd.read_csv('breast-cancer-wisconsin.data') df.replace('?', -99999, inplace = True) df.drop(['id'],1, inplace = True)#drop ID as this messes up the accuracy of the data X = np.array(df.drop(['class'],1)) Y = np....
ross39/ML
ApplyingKNearestNeighbours/k_nearest_neighbors.py
k_nearest_neighbors.py
py
777
python
en
code
0
github-code
90
9127820805
# -*- coding:utf-8 -*- from flask import request from flask_login import login_required, current_user from flask_restful import Resource, reqparse, fields, marshal, marshal_with from werkzeug.exceptions import NotFound, Forbidden import services from controllers.console import api from controllers.console.datasets.err...
parity-asia/hackathon-2023-summer
projects/26-Dynamo/src/ai-project/api/controllers/console/datasets/datasets.py
datasets.py
py
12,677
python
en
code
14
github-code
90
6075658035
import requests import time import json import os import pandas as pd #this script takes the Matches ID in Database and request the match information from OpenDota through their api and store it in a json file #path is assigned in Database Manager # path = #assign this variable if you want to use this script by itsel...
RRDito/Dota-Fantasy-Database
OpenDotaScrap.py
OpenDotaScrap.py
py
2,007
python
en
code
0
github-code
90
8963025874
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Setup script for FireHole You can install FireHole with python setup.py install """ from setuptools import setup from os import path DIR = path.dirname(path.abspath(__file__)) DESCRIPTION = "FireHole (fh) is a Python package for Data Analyst." AUTHORS = 'Xia Tian' ...
xSumner/firehole
setup.py
setup.py
py
1,479
python
en
code
6
github-code
90
18406870899
def main(): import sys input = sys.stdin.buffer.readline N, M = (int(i) for i in input().split()) par = [i for i in range(N)] rank = [1 for i in range(N)] def find_root(x): if par[x] == x: return x else: par[x] = find_root(par[x]) return par[x...
Aasthaengg/IBMdataset
Python_codes/p03045/s572998664.py
s572998664.py
py
885
python
en
code
0
github-code
90
70547415017
import tensorflow as tf import argparse import numpy as np import cv2 parser = argparse.ArgumentParser() parser.add_argument('--h5', type=str, default=None, help='Mode "train" or "predict"') parser.add_argument('--size', type=int, default=160, help='Input size to the model') parser.add_argument('-images','--images', n...
cabjr/tf2_suite
predict.py
predict.py
py
1,413
python
en
code
0
github-code
90
18152768119
c=0 for _ in range(int(input())): x,y = map(int,input().split()) if x==y: c+=1 else: c=0 if c==3: c=-1 print('Yes') break if c!=-1: print('No')
Aasthaengg/IBMdataset
Python_codes/p02547/s752537331.py
s752537331.py
py
205
python
en
code
0
github-code
90
25290909080
from builtins import bytes from future.utils import PY2 import os import shutil import tarfile from tempfile import mkdtemp from itertools import islice from pimlico.utils.pimarc.reader import StartAfterFilenameNotFound class PimarcTarBackend(object): def __init__(self, archive_filename): self.archive_...
markgw/pimlico
src/python/pimlico/utils/pimarc/tar.py
tar.py
py
4,932
python
en
code
6
github-code
90
18942853319
import csv import numpy as np import math from sklearn.preprocessing import minmax_scale def onehot_enc(lbl, min_val=0): mi = int(min(lbl)) mx = int(max(lbl)) enc = np.full((len(lbl), (mx - mi + 1)), min_val, np.int8) for i, x in enumerate(lbl): enc[i, int(x) - mi] = 1 return enc...
nafismuhammd/ActivationFunction-TEST-
main1_nafis.py
main1_nafis.py
py
16,319
python
en
code
0
github-code
90
24552643877
from ... import core as c from ... import ctrlstru as cs from . import modcurpl as cp from . import byterw as bm @c.EUDFunc def f_repmovsd_epd(dstepdp, srcepdp, copydwn): epd_diff = dstepdp - srcepdp tempv = c.Forward() # Backup original cp. origcp = cp.f_getcurpl() cp.f_setcurpl(srcepdp) ...
phu54321/eudplib
eudplib/eudlib/memiof/mblockio.py
mblockio.py
py
2,825
python
en
code
13
github-code
90
21129777517
from __future__ import print_function from __future__ import absolute_import from __future__ import division import math from compas_igs.rhino.diagramobject import DiagramObject from compas_igs.rhino.forceinspector import ForceDiagramVertexInspector __all__ = ['ForceObject'] class ForceObject(DiagramObject): "...
BlockResearchGroup/compas-IGS
src/compas_igs/rhino/forceobject.py
forceobject.py
py
11,501
python
en
code
1
github-code
90
73748656296
import requests import json import webbrowser def gugu(): my_endpoint = 'https://dog.ceo/api/breeds/image/random' facts = requests.get(my_endpoint) print(facts.text) data = json.loads(facts.text) webbrowser.open_new_tab(data['message']) print("Your welcome for the cool dog image") gugu() ...
guleidmuse20/Experimenting-with-API-in-class
ghggg.py
ghggg.py
py
321
python
en
code
1
github-code
90
25947059182
from django.conf import settings from rest_framework.routers import DefaultRouter, SimpleRouter from django.urls import include, path if settings.DEBUG: router = DefaultRouter() else: router = SimpleRouter() app_name = "api" urlpatterns = [ path('geocoding/', include('geo_coding_platform_test.apps.geocodi...
aduquehd/geo-coding-platform-test
config/api_router.py
api_router.py
py
338
python
en
code
0
github-code
90
25323748445
# import part import glfw from OpenGL.GL import * import numpy as np # define glbal variables val_degree=0 val_translate=0 val_switch=0 val_scale=1 S=np.array([[val_scale,0.,0.], [0.,1.,0.], [0.,0.,1.]]) T=np.array([[1,0.,0.], [0.,1.,0.], [0.,0.,1.]]) ...
anatamy/CG
CG_weekly_practice_04_2016024866.py
CG_weekly_practice_04_2016024866.py
py
4,307
python
en
code
0
github-code
90
18373361569
N, K = (int(i) for i in input().split()) graph = [[] for i in range(N)] for i in range(N-1): a, b = (int(i) for i in input().split()) graph[a-1].append(b-1) graph[b-1].append(a-1) from collections import deque def BFS(N, K, graph, start): c = [-1 for i in range(N)] Q = deque([]) Q.append(start...
Aasthaengg/IBMdataset
Python_codes/p02985/s037240749.py
s037240749.py
py
786
python
en
code
0
github-code
90
38927495470
#-------------------- # Bootstrap in Python #-------------------- import pandas as pd import numpy as np from scipy.stats import bootstrap sample1 = pd.read_csv("C:/Users/julia/OneDrive/Desktop/github/sample1.csv") sample1 # example 1 sample1 = np.array([8.26, 6.33, 10.4, 5.27, 5.35, 5.61, 6.12, 6.19, 5....
JRigh/Bootstrap-in-R-and-Python
Bootstrap_Python.py
Bootstrap_Python.py
py
800
python
en
code
0
github-code
90
29868764373
import copy import glob import os from spectral_cube import SpectralCube from spectral_cube.io import fits as scfits from astropy.io import fits from astropy import wcs for fn in glob.glob("FITS/*.image.pbcor.fits"): print(fn) outfn = 'FITS/max/'+os.path.basename(fn.replace(".image.pbcor.fits","max.fits")) ...
keflavich/FeO_2015.1.00262.S
analysis/peakmaps.py
peakmaps.py
py
892
python
en
code
0
github-code
90
5921130910
import kivy #kivy.require('1.10.0') # replace with your current Kivy version from kivy.uix.behaviors import ButtonBehavior from kivy.uix.image import Image from kivy.factory import Factory class PlayPauseButton(ButtonBehavior, Image): def __init__(self, **kwargs): super(PlayPauseButton, self).__init__(*...
inteplus/kivymt
kivymt/playpause_btn.py
playpause_btn.py
py
722
python
en
code
0
github-code
90
18231125126
#! /usr/bin/env python import sys import os def rename(old, new): stat = os.stat(old) os.rename(old, new) os.utime(new, (stat.st_atime, stat.st_mtime)) if os.path.isfile(sys.argv[1]): basenameOld = os.path.splitext(sys.argv[1])[0] basenameNew = os.path.splitext(sys.argv[2])[0] for ext in ["...
lahwaacz/Scripts
pyre-mv.py
pyre-mv.py
py
593
python
en
code
181
github-code
90
25829683720
import os from pathlib import Path import glob import csv def set_output_directory(out_dir): if not os.path.exists(out_dir): os.makedirs(out_dir) def csv_read(filename): list_of_rows = [] with open(filename, 'r') as read_obj: csv_reader = csv.reader(read_obj) list_of...
shivaheidari/Opinion_Prediction
Select_main_users.py
Select_main_users.py
py
2,835
python
en
code
1
github-code
90
18570673069
# n, m, l = map(int, input().split()) # list_n = list(map(int, input().split())) # n = input() # list = [input() for i in range(N) # list = [[i for i in range(N)] for _ in range(M)] import sys input = sys.stdin.readline A = int(input()) B = int(input()) C = int(input()) X = int(input()) ans = 0 for i in range(0, ...
Aasthaengg/IBMdataset
Python_codes/p03448/s548286122.py
s548286122.py
py
496
python
en
code
0
github-code
90
27712605632
""" site is automatically imported each time the interpreter starts up. As it is being imported, it extends sys.path with site-specific names that are constructed by combining the prefix values sys.prefix and sys.exec_prefix with several suffixes. The prefix values used are saved in the module-level variable PREFIXES f...
rakkaalhazimi/Python_Std_Library
Ch17RunTimeFeatures/site/part01_site_import_path.py
part01_site_import_path.py
py
955
python
en
code
0
github-code
90
43306124139
import numpy as np import pandas as pd import matplotlib.pyplot as plt from collections import Counter from sklearn import feature_extraction, model_selection, naive_bayes, metrics, svm from IPython.display import Image import warnings warnings.filterwarnings("ignore") data = pd.read_csv('ReviewsHotel.csv', encoding='...
thombreankita/Review-Spam-Detection
7. Feature Engineering.py
7. Feature Engineering.py
py
1,875
python
en
code
0
github-code
90
1814550006
# -*- coding: utf-8 -*- """ Created on Fri Apr 3 19:58:49 2020 @author: Rajesh Q2. (Create a program that fulfills the following specification.) tshirts.csv T-Shirt Factory: You own a clothing factory. You know how to make a T-shirt given the height and weight of a customer. You want to standardize the productio...
Rajesh-sharma92/FTSP_2020
Mechine Learning Forsk/Un-Superwised ML/tshirts.csv_KMeans_(UNSP_ML).py
tshirts.csv_KMeans_(UNSP_ML).py
py
4,921
python
en
code
3
github-code
90
13567902529
import os import sys from message.receive import listen from events.beans_event import BeansEvent exchange = 'beans' beans_silo_load = 0 def beans_callback(ch, method, properties, body: bytes): beans_event_json = body.decode() print(f'Beans event received: {beans_event_json}') beans_event = BeansEven...
adrianojp1/utfpr-distributed-systems
project1/src/grain_stock_mgmt.py
grain_stock_mgmt.py
py
698
python
en
code
0
github-code
90
29571463035
import cv2 # Step 1: Read the image image_path = '/Users/cwchan/Desktop/IMG_1946.PNG' # Replace with the path to your image image = cv2.imread(image_path) # Check if the image was loaded successfully if image is None: print("Error: Unable to load image.") else: # Step 2: Display the image cv2.imshow('Ima...
kd110544/hw_code
read_image.py
read_image.py
py
707
python
en
code
1
github-code
90
12163843497
#!/usr/bin/env python3 import unittest import os import daftask import tempfile def vector2file(x, filename): x = ['\t'.join([str(z) for z in y]) for y in x] x = '\n'.join([y for y in x]) with open(filename, 'wb') as f: f.write(bytes(x, 'ascii')) class TestDatabase(unittest.TestCase): def set...
arendsee/daftask
test.py
test.py
py
2,257
python
en
code
0
github-code
90
21191609850
import sys; sys.path.insert(0, '../../'); import PEUQSE as PEUQSE import PEUQSE.UserInput as UserInput if __name__ == "__main__": import observed_values_00 #Just a simple example. The user can also put the values in directly into the runfile or extract from a csv, for example. import simulation_model_00 #Sim...
AdityaSavara/PEUQSE
Examples/Example00/runfile_Example_00a7_BPE_MetropolisHastings.py
runfile_Example_00a7_BPE_MetropolisHastings.py
py
3,099
python
en
code
12
github-code
90
27164859764
class Warrior: def __init__(self, health = 50, attack=5): self.health = health self.attack = attack @property def is_alive(self): if self.health > 0: return True else: return False def suffer(self, damage): self.health -= damage def hit(self, enemy): enemy.suffer(...
gaidamakinaas/Checkio
incinerator/army_battles_update.py
army_battles_update.py
py
2,358
python
en
code
0
github-code
90
40565102838
import frappe import pandas as pd import json def make_booking_service_item(doc, method): if doc.booking_item == 1: create_service_item(doc) validate_service_item(doc) def create_service_item(item): if not frappe.db.exists("Item", item.item_code + "_service"): book_service_setting = f...
Khatavahi-BI-Solutions/mat_customization
mat_customization/utils.py
utils.py
py
7,487
python
en
code
0
github-code
90
32664535251
import argparse import time import torch import torch.nn.parallel import torch.optim import torch.utils.data.distributed from torch.optim import lr_scheduler from src_files.data_loading.data_loader import create_data_loaders from src_files.helper_functions.distributed import print_at_master, to_ddp, num_distrib, setup...
Alibaba-MIIL/ImageNet21K
train_semantic_softmax.py
train_semantic_softmax.py
py
4,464
python
en
code
665
github-code
90
14064535711
from os import PathLike from typing import Callable, List, Optional import netCDF4 import numpy as np from netCDF4 import Dataset, Variable from improver.constants import DEFAULT_TOLERANCE def compare_netcdfs( actual_path: PathLike, desired_path: PathLike, rtol: float = DEFAULT_TOLERANCE, atol: floa...
metoppv/improver
improver/utilities/compare.py
compare.py
py
10,707
python
en
code
95
github-code
90
14704809428
import gymnasium as gym import torch import torch.nn as nn # import the skrl components to build the RL system from skrl.agents.torch.td3 import TD3, TD3_DEFAULT_CONFIG from skrl.envs.wrappers.torch import wrap_env from skrl.memories.torch import RandomMemory from skrl.models.torch import DeterministicMixin, Model fr...
gabe00122/rl-practice
rl-practice/main_td3.py
main_td3.py
py
4,066
python
en
code
0
github-code
90
24243767398
import pathlib import dash import dash_core_components as dcc import dash_html_components as html import pandas as pd from dash.dependencies import Input, Output, State import cufflinks as cf import numpy as np import plotly.express as px import plotly.graph_objects as go from june.visualization.plotter import DashPl...
fneuhaus/JUNE_germany
june/visualization/app.py
app.py
py
20,102
python
en
code
2
github-code
90
17735479100
#!/usr/local/bin/python3 #-*- coding: utf-8 -*- # Глава 14. Почтовый клиент PyMailGUI. # Реализация PyMailGUI. # wraplines: инструменты разбиения строк. # Пример 14.7 (Лутц Т2 стр.427) """ # ---------------------------------------------------------------------------- # разбивает строки по фиксированной позиции или по п...
TreasureMaster/ch14
wraplines.py
wraplines.py
py
6,366
python
ru
code
0
github-code
90
22659586050
import simplejson as json from django.conf import settings from django.shortcuts import render_to_response from django.template.context import RequestContext from django.http import Http404, HttpResponseRedirect, \ HttpResponse from apps.library.api_wrapper import ApiWrapper LIB_OBJ = ApiWrapper() TICKET_STATUS...
atsiddiqui/zendesk
apps/views.py
views.py
py
1,872
python
en
code
1
github-code
90
7321238247
import astropy.units as u import wx from astropy.coordinates import EarthLocation, Latitude, Longitude from astropy.table import Table from dataclasses import dataclass from os import PathLike from pathlib import Path from threading import Lock from typing import List, Union, Sequence, Tuple MIN_WAVELEN = 3000 MAX_W...
mgeselle/spectra
config.py
config.py
py
13,623
python
en
code
0
github-code
90
13257982096
import requests def response_test(): response = requests.post( 'http://34.64.254.235:5001/result', data = { 'sentence': 'dddd dd efqwecd dfdedd' } ) return response.status_code def test_function(): assert response_test() == 200
cjh1212/Internship-Project-CICD
dynamic_test.py
dynamic_test.py
py
298
python
en
code
0
github-code
90
30559384289
import requests as req from PyInquirer import style_from_dict, prompt, Token from pprint import pprint import os from os.path import join, dirname from dotenv import load_dotenv dotenv_path = join(dirname(__file__), '../.env') load_dotenv(dotenv_path) API_KEY_EMAIL = os.environ.get("REVERSE_EMAIL_KEY") class Reverse...
Kody-Bentley/who-they-bee
Reverse_Email/reverse_email.py
reverse_email.py
py
1,066
python
en
code
0
github-code
90
24116035285
# -*- coding: utf-8 -*- """ Created on Wed Sep 7 22:15:26 2016 @author: Sivanand Achanta """ import numpy as np import scipy from scipy.io import wavfile def synthDumb(units,synth_path, fname, parser): wav_segpath = parser['paths'].get('wav_segpath') zstr_full = parser['strs'].get('zstr_full') for i ...
SivanandAchanta/Blizzard16
python_codes/Voice_Synthesis/unitsConcat.py
unitsConcat.py
py
707
python
en
code
2
github-code
90
71510722537
import hashlib import random from django.forms.models import model_to_dict # from Task.models import tasks def taskidMD5(string): hash=hashlib.md5() hash.update(string.encode('utf-8')) res=hash.hexdigest() return res def tagcolor(): color_list= [ # "label-default", "label-primary",...
liudl240/JamesDjango
Task/makeTaskid.py
makeTaskid.py
py
1,272
python
en
code
1
github-code
90
25035488115
from dateutil.parser import parse as parsedate from urllib.parse import urlparse from datetime import datetime import traceback import requests import wget import time import os def sizeof_fmt(num, suffix='B'): for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']: if abs(num) < 1024.0: return "%...
Rarioty/DataFlow-Components
webdownloader.py
webdownloader.py
py
5,168
python
en
code
2
github-code
90
28052196617
from flask import Flask, jsonify, request from typing import List, Tuple, Dict import os import boto3 from boto3.dynamodb.conditions import Key import math import datetime import uuid import json from flask_cors import CORS from utils import convert_processed_pitch_to_response, convert_config_to_response from pitch im...
Decerguyer/BaseballSimulator
backend/App/app.py
app.py
py
6,520
python
en
code
0
github-code
90
74573009575
#!/usr/bin/env python """Listeners for handling streaming events.""" import os import logging from .base import BaseListener from rotating_out_file import RotatingOutFile log = logging.getLogger(__name__) class FileListener(BaseListener): """File Listener.""" def __init__(self, base_dir, collection_name...
geosoco/twitter_capture_client
listeners/file.py
file.py
py
2,891
python
en
code
1
github-code
90
18387083259
import sys from bisect import bisect_left input = sys.stdin.readline def main(): N = int(input()) A = list(map(int, input().split())) A.sort() idx = bisect_left(A[1:-1], 0) m_group = A[1:1 + idx] p_group = A[1 + idx: -1] ans = [] MAX = A[-1] for m in m_group: ans.append...
Aasthaengg/IBMdataset
Python_codes/p03007/s049822446.py
s049822446.py
py
570
python
en
code
0
github-code
90
7419837433
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('cmp_index', '0007_p_category_category_id'), ] operations = [ migrations.AddField( model_name='p_category', ...
kukuZ/BeerFest
mysite/cmp_index/migrations/0008_p_category_image.py
0008_p_category_image.py
py
443
python
en
code
0
github-code
90
18473779269
def main(): burgur = [0] * 51 burgur[0] = 1 pate = [0] * 51 pate[0] = 1 for i in range(50): burgur[i+1] = burgur[i] * 2 + 3 pate[i+1] = pate[i] * 2 + 1 N, X = map(int, input().split()) X -= 1 ans = 0 for i in reversed(range(1, N+1)): if X == burgur[i] -...
Aasthaengg/IBMdataset
Python_codes/p03209/s448136792.py
s448136792.py
py
596
python
en
code
0
github-code
90
42039580600
""" You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. You may assume that you have an infinite number of ea...
nilay-gpt/LeetCode-Solutions
recursions_and_DP/DP/coin_change.py
coin_change.py
py
970
python
en
code
2
github-code
90
20045043241
class LinkedList: def __init__(self): self.head = None def create_ll(self, array): if self.head is None: self.head = Node(array[0]) if len(array) > 0: curr = self.head for i in array[1:]: curr.next = Node(i) curr = cur...
dkarthicks27/ML_Database
contest/codeforces_latoken_div1_div2/color_the_flag.py
color_the_flag.py
py
1,266
python
en
code
0
github-code
90
34121950425
#rat facts import random ratFacts = [ 'Rat lives in Kissimmee, Fl.', 'Rat is a registered Democrat.', "Rat's house got ran over by a black man", "Jullian is Rat's cousin, he ran over Rat's Grandma's foot", "Rats sister stole his identity and ruined his credit."] pri...
NEDMInsane/quick-scripts
Python/ratFacts.py
ratFacts.py
py
369
python
en
code
0
github-code
90
18659206350
import torch import torch.nn as nn import torch.optim as optim import selection.layers as layers class MSELoss(nn.Module): '''MSE loss that sums over output dimensions and allows weights.''' def __init__(self, reduction='mean'): super().__init__() assert reduction in ('none', 'mean') s...
iancovert/dl-selection
selection/models/utils.py
utils.py
py
6,980
python
en
code
13
github-code
90
5629508091
from scapy.all import * from datetime import datetime import pytz import firebase_admin from firebase_admin import credentials from firebase_admin import firestore import socket from main import send_packet_data def get_host_ip_address(): hostname = socket.gethostname() ip_address = socket.gethost...
DavidOP1/dnsfp
get_packet_data.py
get_packet_data.py
py
1,998
python
en
code
0
github-code
90
25588285884
from collections import defaultdict import json import logging import urllib3 logging.basicConfig(level=logging.WARNING) content_header = """Draft Release Notes For {version} -- Final release notes will be generated from the PR titles that have *"release notes:yes"* label. If you have any additional notes please add...
grpc/grpc
tools/release/release_notes.py
release_notes.py
py
10,903
python
en
code
39,468
github-code
90
17436724930
import requests from bs4 import BeautifulSoup from warnings import warn class Kompas: ''' Scraper untuk kompas.com ''' def extractData(htmlFile): """ Mengekstrak isi berita kompas.com INPUT: htmlFile -- request.models.Response Sebuah request.models.Response yang...
ristek-deepstudy/gemastik-2017-prediksi-kurs
src/Scraper/Kompas.py
Kompas.py
py
2,957
python
id
code
1
github-code
90
74079873256
from requirements import coffees,coins,stock while True: print("Welcome to Coffee Machine, Which one do you want to buy? (cappuccino,latte,espresso)") user_input = input() if stock["milk"]>=coffees[user_input]["milk"] and stock["coffee"]>=coffees[user_input]["coffee"] and stock["water"]>=coffees[user_inp...
BahadirAkdemir/basic-python-projects
basic python projects/Coffee Machine/app.py
app.py
py
1,163
python
en
code
0
github-code
90
35360138515
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ @Project :test @File :distinct.py @Author :Wang @Date :2022/5/19 0:18 @Show : """ def distinct2(l): #运行时间太长 lst = list(l) num = [] tmp = [] for it in lst: if it[0] not in num: num.append(it[0]) tmp.append(it) ...
wang0717/test
gaokao/distinct.py
distinct.py
py
766
python
en
code
0
github-code
90
20600579346
import pkgutil from datetime import datetime from decimal import Decimal from typing import Iterable, List, Optional from flask import request from sqlalchemy.engine.row import Row from sqlalchemy.orm.decl_api import DeclarativeMeta from vault import app from vault.views.api import RequestError def load_module_recu...
jizhang/vault-server
vault/utils.py
utils.py
py
2,536
python
en
code
0
github-code
90
34423612327
from functools import reduce from operator import or_ import django_filters from django.db.models import Count, Q from django_filters import CharFilter, ModelChoiceFilter, ChoiceFilter from django_filters.constants import EMPTY_VALUES from django_filters.widgets import CSVWidget from .models import Paper, StudentClub...
skni-kod/StronaPraceKol
papers/filters.py
filters.py
py
6,469
python
en
code
0
github-code
90
37314367109
#!/usr/bin/python import sys import os sys.path.append(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), "..", "repos", "mesa_ci")) import build_support as bs class CrucibleBuilder(bs.AutoBuilder): def __init__(self): self._pm = bs.ProjectMap() glslc = "GLSLC=" + self._pm.build_root() + ...
cmarcelo/mesa_jenkins
crucible/build.py
build.py
py
1,187
python
en
code
null
github-code
90
24436503058
# # @lc app=leetcode.cn id=27 lang=python3 # # [27] 移除元素 # # @lc code=start class Solution: def removeElement(self, nums, val: int) -> int: self.nums = nums self.val = val n = len(nums) slow = 0 fast = 0 while fast < n: if nums[fast] != val: ...
chenbingcheng1994/Leecode_practice
27.移除元素.py
27.移除元素.py
py
550
python
en
code
0
github-code
90
18508797689
from collections import defaultdict from itertools import accumulate N,M=map(int,input().split()) A=list(map(int,input().split())) acc=list(accumulate(A)) d=defaultdict(int) ans=0 for i in range(N): if acc[i]%M==0: d[acc[i]%M]+=1 ans+=d[acc[i]%M] else: d[acc[i]%M]+=1 ans+=d[a...
Aasthaengg/IBMdataset
Python_codes/p03287/s887428985.py
s887428985.py
py
341
python
en
code
0
github-code
90
28170161259
import argparse import csv from collections import OrderedDict import numpy as np import pandas as pd HEADER = [ 'chrom', 'chromStart', 'chromEnd', 'name', 'SeqCounts', 'strandPerturbationTarget', 'PerturbationTargetID', 'chrTSS', 'startTSS', 'endTSS', 'strandGene', 'measuredGeneSymbol', 'measuredEnsem...
sjgosai/casa
casa/encode2casa.py
encode2casa.py
py
5,692
python
en
code
2
github-code
90
17548865727
import numpy as np import tensorflow as tf from tensorflow.keras.layers import ( Conv1D, LeakyReLU, BatchNormalization, Conv1DTranspose, Input, Concatenate, MultiHeadAttention, Add, Activation, Multiply, MaxPooling1D) from tensorflow.keras.callbacks import ModelCheckpoint from tensorflow.keras.models import Model f...
mrknorman/noisenet
train_model.py
train_model.py
py
13,578
python
en
code
0
github-code
90
5011394425
from unittest.mock import MagicMock from unittest.mock import patch from cauldron import environ from cauldron.cli.sync import threads from cauldron.test.support import scaffolds class TestSyncThreading(scaffolds.ResultsTest): """ Tests for the cauldron.cli.sync.sync_comm module.""" @patch('cauldron.cli.syn...
sernst/cauldron
cauldron/test/cli/sync/test_sync_threading.py
test_sync_threading.py
py
2,013
python
en
code
78
github-code
90
23239394031
from fastapi import APIRouter, Depends, HTTPException from sqlmodel import Session, select from typing import List from database import get_session from models import Emp, EmpOutput, Performance router = APIRouter(prefix="/api/employees") @router.get("/") def get_cars( # EMPLOYEE_NAME: str | None = None, ...
krishnakesari/Fast_API_Nest
routers/endpoints.py
endpoints.py
py
1,176
python
en
code
0
github-code
90
28319305542
def odd_even(num): if num == 1 or num == 0: print("not even or odd ") elif num % 2 == 0: print("even number") else: print("Odd number") inp = int(input("Enter your number")) odd_even(inp)
pribhat06/python
yt_100_qs/06_odd_even.py
06_odd_even.py
py
252
python
en
code
0
github-code
90
16250798080
from PyQt5.Qt import * import sys # 1. 创建一个应用程序对象 app = QApplication(sys.argv) # 2.控件的操作 # 2.1创建控件 window = QWidget() # 2.2设置控件 window.setWindowTitle("QToolButton箭头") window.resize(500, 500) window.move(400, 250) tb = QToolButton(window) tb.setText("这是一个QToolButton") # 注意:即使设置了文字和图标,也不一定显示 tb.setIcon(QIcon('../Icons...
CJH0220/PyQt_practice
06-QToolButton/03-QToolButton-箭头.py
03-QToolButton-箭头.py
py
770
python
zh
code
null
github-code
90
1958316980
import sys print('Python: {}'.format(sys.version)) # scipy import scipy print('scipy: {}'.format(scipy.__version__)) # numpy import numpy print('numpy: {}'.format(numpy.__version__)) # matplotlib import matplotlib print('matplotlib: {}'.format(matplotlib.__version__)) # pandas import pandas print('pandas: {}'.format(pa...
Oapinzon/Regresion-lineal
regresion.py
regresion.py
py
2,213
python
en
code
0
github-code
90
25415781571
#! python3 # converter.py - Converts filenames of images in a directory such that they can be imported into Opentoonz as a single level. import os, re, sys if len(sys.argv) > 1: image_name = sys.argv[1] files = os.listdir() directory_name = os.path.basename(os.getcwd()) images = [] # TO-DO: Check filenames for im...
ttpham2/OpenToonzImageNameConverter
converter.py
converter.py
py
839
python
en
code
0
github-code
90
17584034716
import pytest from simplemaths.simplemaths import SimpleMaths as sm class TestSimpleMaths(): def test_constructor(self): x = sm(5) assert x.number == 5 def test_negative_constructor(self): with pytest.raises(TypeError): x = sm(5.5) def test_square_factorial(self): x = sm(5) ...
uceclz0/last-year-python-exam
test_simplemaths.py
test_simplemaths.py
py
739
python
en
code
0
github-code
90
36070139731
""" *Script calculates SI-x trends over the entire CESM Control run* """ from control_SIX_datareader import ccsm import numpy as np from scipy import stats as sts import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap ### Call CESM Control Data years = 'b.e11.B1850C5CN.f09_g16.005.cam.h1.TRE.SI-x.40...
zmlabe/EarlySpringOnset
Scripts/control_SIx_totaltrends.py
control_SIx_totaltrends.py
py
2,972
python
en
code
3
github-code
90
41168354168
from autoinject import injector from pipeman.util import caps_to_snake from pipeman.util import System from pipeman.db import Database import pipeman.db.orm as orm import sqlalchemy as sa import datetime import zirconium as zr import zrlog from pipeman.entity import EntityRegistry from pipeman.dataset import MetadataRe...
dfo-meds/data-manager
src/pipeman/core/__init__.py
__init__.py
py
6,887
python
en
code
0
github-code
90
10400147688
# -*- coding: utf-8 -*- """ Created on Wed Jul 3 14:29:09 2019 @author: admin """ ''' 编写一个函数来查找字符串数组中的最长公共前缀。 如果不存在公共前缀,返回空字符串 ""。 示例 1: 输入: ["flower","flow","flight"] 输出: "fl" 示例 2: 输入: ["dog","racecar","car"] 输出: "" 解释: 输入不存在公共前缀。 说明: 所有输入只包含小写字母 a-z 。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/long...
k8godzilla/-Leetcode
1-100/L014.py
L014.py
py
1,506
python
zh
code
0
github-code
90
25847187625
from IFC2BOT.util import build_URI def classify_buildings(ifc_file): triples = "\n# BUILDINGS\n" for item in ifc_file.by_type('IfcBuilding'): triples+= "%s a bot:Building .\n" % (build_URI(item.GlobalId)) return triples def classify_storeys(ifc_file): triples = "\n# STOREYS\n" for item in ...
NIRAS-MHRA/IFC2BOT
IFC2BOT/classify.py
classify.py
py
842
python
en
code
6
github-code
90
2060289574
from os.path import join as pathjoin from .helper import mk_pca_dir, transform_ims_to_vecs from dataset.load_dataset.data_generator import SkaterbotDataGenerator from sklearn.decomposition import IncrementalPCA from joblib import dump, load """ constants """ window_size = 11.61 time_size = 100 freq_size = 108 transfor...
emvasilopoulos/ai_auto_dj
poi_detector/src/training_testing/pre_training/pca/fit_incremental_pca.py
fit_incremental_pca.py
py
1,645
python
en
code
1
github-code
90
18326714279
import math N = int(input()) even = False if N % 2 == 0: even = True factor1 = int(math.floor(N ** (1/2))) # if even: # Nが偶数の時はfactor1を偶数にしておく # if factor1 % 2 == 1: # factor1 -= 1 # else: # if factor1 % 2 == 0: # factor1 -= 1 while True: if N % factor1 == 0: factor2 = int(...
Aasthaengg/IBMdataset
Python_codes/p02881/s248051463.py
s248051463.py
py
436
python
en
code
0
github-code
90
18039024159
S = input()[::-1] W = ['dream','dreamer','erase','eraser'] i = 0 while i < len(S): for w in W: if S[i:i+len(w)] == w[::-1]: i += len(w) break else: print('NO') exit() print('YES')
Aasthaengg/IBMdataset
Python_codes/p03854/s882755798.py
s882755798.py
py
235
python
en
code
0
github-code
90
29309109951
from sqlalchemy import func, text from sqlalchemy.orm import sessionmaker, aliased from homework_blog_post.data import USERS, POSTS, COMMENTS, REACTIONS from homework_blog_post.models import User, engine, Base, Post, Comment, Reaction Session = sessionmaker(bind=engine) session: Session = Session() Base.metadata.crea...
milena-marcinik/Database-Programming_SDA
homework_blog_post/main.py
main.py
py
5,343
python
pl
code
0
github-code
90
32040205079
from flask import Flask from flask import request from flask import redirect, url_for, render_template, jsonify from flask import after_this_request #For adding steps after a request from flask import make_response #For adding custom headers from flask_cors import CORS #This package makes Cross Origins Resource Sharing...
anthony-nguyen-04/Trading-Card-Simulator
python/flaskServer.py
flaskServer.py
py
2,381
python
en
code
0
github-code
90
18532493899
N = int(input()) ps = [] for i in range(N): ps.append(int(input())) memo = {} for i,p in enumerate(ps): memo[p] = 0 if p-1 in memo: memo[p-1] = 1 dct = sorted(memo.items()) result = 0 c = 0 for k,v in dct: if v == 1: c += 1 else: if c > result: result = c ...
Aasthaengg/IBMdataset
Python_codes/p03346/s258305951.py
s258305951.py
py
344
python
en
code
0
github-code
90
26120322160
# Import tkinter module from tkinter import * from tkinter import ttk import os # Import the module os class fe: # define the part of the gui:fe def __init__(self, root, srow, scol): # set initions self.root = root self.srow = srow self.scol = scol self.pd = os.getcwd() # Get the...
lkrkerry/My-AI
modules/gui/fe.py
fe.py
py
1,044
python
en
code
0
github-code
90
37726332534
from template import * running = True sound = Sound(1202,652) byAaron = customTitle(113,678,60,'By Aaron') exitButton = Button(LIGHT_RED,111,42,200,66,'Quit') while running: #Keep the loop running at the correct speed clock.tick(FPS) #input and events for event in pygame.event.get(): ...
AaronCohen21/Aarons-Game
menu.py
menu.py
py
3,424
python
en
code
0
github-code
90
26810465868
try: # ignore ShapelyDeprecationWarning from fvcore import warnings from shapely.errors import ShapelyDeprecationWarning warnings.filterwarnings('ignore', category=ShapelyDeprecationWarning) except: pass import contextlib import copy import io import itertools import logging import os import shutil...
renwang435/video-ttt-release
train_ttt_mae.py
train_ttt_mae.py
py
28,623
python
en
code
45
github-code
90
15976442365
from copy import deepcopy N, M, K = map(int, input().split()) board = [[0] * M for _ in range(N)] def rotate(fig): rotated_fig = [[0]* len(fig) for _ in range(len(fig[0]))] for i in range(len(fig)): # Row for j in range(len(fig[0])): # column rotated_fig[j][i] = fig[len(fig)-i-1][j...
OnMyWave/Algorithm
Baekjoon/18808 : 스티커 붙이기.py
18808 : 스티커 붙이기.py
py
1,771
python
en
code
0
github-code
90
73910550055
#!/usr/bin/python # -*- coding:utf-8 -*- __author__ = 'Ydface' import pygame try: import pygame.mixer as mixer except ImportError: import android.mixer as mixer import mypygame import game_ui.mission_ui import random import gameresource import label import util.node import gamestate import bu...
ydface/pygame
battle.py
battle.py
py
11,251
python
en
code
0
github-code
90
34322419988
# coding=utf-8 import logging from mongoengine import ValidationError from zspider import models as zsm from zspider.utils import models __author__ = "zephor" logger = logging.getLogger(__name__) class CappedStorePipeLine(object): def __init__(self, task_id): self.task = models.Task.objects.get(id=tas...
Zephor5/zspider
zspider/pipelines/store.py
store.py
py
831
python
en
code
6
github-code
90
2512489261
from collections import deque n = int(input()) arr = list(map(int, input().split())) stack = [] result = [0] * n for i in range(n-1, -1, -1): while stack: if stack[-1][0] <= arr[i]: result[stack[-1][1]] = i+1 stack.pop() else: break stack.append((arr.pop(), ...
0dOj/0dOj_Algorithm
Python/2000~2999/2493.py
2493.py
py
339
python
en
code
0
github-code
90
25330893153
def getNamefromConsole()->str: name: str = None while(name == None) or len(name) < 2: print("adja meg a nevet: ") name = str(input()) if(len(name) < 2): print("nem megfelelo nev") return name.strip().capitalize() def color(s: str)->str: value: int = len(s) re...
zalulw/python
09 - Függvények/Feladat 04/consoleIO.py
consoleIO.py
py
372
python
en
code
0
github-code
90
25189318380
import psutil import time import threading def checkCPU(): cpuUsage=psutil.cpu_percent(interval=1) print(cpuUsage) return cpuUsage def useCPU(interval=.000001): while True: time.sleep(interval) checkCPU() checkThread=threading.Thread(target=checkCPU) checkThread.start() useCPU() useThread=threading.Thread(targ...
zatouichi/Test-Tools
cpuEater.py
cpuEater.py
py
402
python
en
code
0
github-code
90
18147624839
def main(): while True: cards = input(); if cards == '-': break n = int(input()) for _ in range(n): s = int(input()) cards = (cards*2)[s:s+len(cards)] print(cards) if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p02420/s339918855.py
s339918855.py
py
288
python
en
code
0
github-code
90
69995808938
from django import forms from django.forms import DateInput, RadioSelect from courseapp.models import Student, Course,Department class StudentCreationForm(forms.ModelForm): MATERIAL_CHOICES = ( ('pen', 'Pen'), ('pencil', 'Pencil'), ('paper', 'Paper'), ('eraser', 'Eraser'), ...
sujiths44/storeproject
courseapp/forms.py
forms.py
py
1,867
python
en
code
0
github-code
90
25859744552
""" File: MemObj.py Author: Edward Hanson (edward.t.hanson@duke.edu) Desc: Memory object simulation. Parameters are initialized using integrated CACTI """ import os import subprocess import configparser as cp class MemObj: def __init__(self, config_path, num_ports, CACTI_path, config_fname, memstats_fn...
Rudedaisy/PhotonicAccelerator
MemObj.py
MemObj.py
py
4,036
python
en
code
0
github-code
90