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
10400575398
# -*- coding: utf-8 -*- """ Created on Sun Jul 21 17:44:32 2019 @author: admin """ ''' 一个“快乐数”定义为:对于一个正整数,每一次将该数替换为它每个位置上的数字的平方和,然后重复这个过程直到这个数变为 1,也可能是无限循环但始终变不到 1。如果可以变为 1,那么这个数就是快乐数。 示例:  输入: 19 输出: true 解释: 12 + 92 = 82 82 + 22 = 68 62 + 82 = 100 12 + 02 + 02 = 1 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/prob...
k8godzilla/-Leetcode
1-100/L202.py
L202.py
py
1,253
python
zh
code
0
github-code
90
28010149382
import boto3 import json transcribe = boto3.client('transcribe') def lambda_handler(event, context): print("Received event: " + json.dumps(event)) transcriptJobName = event['s3_key'] response = transcribe.get_transcription_job( TranscriptionJobName=transcriptJobName ) event['transcriptJo...
markjamesross/aws-recording-ingest-transform
src/transcribe-check-status.py
transcribe-check-status.py
py
404
python
en
code
2
github-code
90
20404090834
from clients.AbstractClient import AbstractClient import config import MySQLdb class MySQLClient(AbstractClient): def __init__(self): self.connection = MySQLdb.connect(host=config.MYSQL_HOST, user=config.MYSQL_USER, passw...
robertclaus/python-database-concurrency-control
clients/MySQLClient.py
MySQLClient.py
py
862
python
en
code
0
github-code
90
72620483818
import numpy as np import torch from alg_constrants_amd_packages import * # from alg_logger import run class ActorNet(nn.Module): """ obs_size: observation/state size of the environment n_actions: number of discrete actions available in the environment # hidden_size: size of hidden layers """ ...
Arseni1919/SAC_algorithm
alg_net.py
alg_net.py
py
2,775
python
en
code
0
github-code
90
18149421759
# AOJ ITP1_9_D def numinput(): a = input().split() for i in range(len(a)): a[i] = int(a[i]) return a def main(): string = input() n = int(input()) for i in range(n): command = input().split() a = int(command[1]) b = int(command[2]) if command[0][0] == 'r...
Aasthaengg/IBMdataset
Python_codes/p02422/s550146963.py
s550146963.py
py
669
python
en
code
0
github-code
90
29145138234
# Author: Josefine Graebener # # Jan 24th 2020 # # Specifications for an Automated Valet Parking System Supervisory Layer # Environment includes failure cases: 1. Steering Problem, 2. Stop, 3. Lot Full # # System simplified into 8 states: # 'approaching' (X0) # 'wait_dropoff' (X1) # 'omw2park' (X2) # 'parked' (P) # '...
jgraeb/AutoValetParking
tulip_spec/supervisor/supervisor.py
supervisor.py
py
6,170
python
en
code
14
github-code
90
38052295900
import os import re import glob import shutil from tkinter import * from tkinter import filedialog from subprocess import check_output import BackEnd labels = [] master = Tk() master.title("Media Sorter and Mover") master.geometry('640x480') LC = 1 W = "w" count = 0 def fileshowcase(): cwd = os.getcwd() ...
michaeldavidjohnson/File-name-changer-and-sorter
Media Sorter/GUI Attempt/FrontEnd.py
FrontEnd.py
py
7,619
python
en
code
0
github-code
90
9777608980
from PyQt5.QtWidgets import QDialog from brickv.plugin_system.plugins.red.ui_program_info_files_permissions import Ui_ProgramInfoFilesPermissions class ProgramInfoFilesPermissions(QDialog, Ui_ProgramInfoFilesPermissions): def __init__(self, parent, title, permissions): QDialog.__init__(self, parent) ...
Tinkerforge/brickv
src/brickv/plugin_system/plugins/red/program_info_files_permissions.py
program_info_files_permissions.py
py
2,051
python
en
code
18
github-code
90
33666783515
""" Написать программу, высчитывающую площадь круга. Необходимые параметры запрашиваются у пользователя. Алгоритм: https://goo.gl/BX2XDM """ import math radius = float(input("Enter the radius of the circle: ")) area = math.pi * radius ** 2 print("The area of the circle is: %.2f" % area)
AlesyaKovaleva/IT-Academy-tasks
tasks_1/radius_circle_4.py
radius_circle_4.py
py
387
python
ru
code
0
github-code
90
21344818803
grid = [ ['7', 'i', '3'], ['T', 's', 'i'], ['h', '%', 'x'], ['i', ' ', '#'], ['s', 'M', ' '], ['$', 'a', ' '], ['#', 't', '%'], ['^', 'r', '!'] ] cols = [] for row in grid: for i, char in enumerate(row): if len(cols) == i: cols.append([]) cols[i].append...
TomerNoy/DI
week4/day4/challenge.py
challenge.py
py
606
python
en
code
0
github-code
90
24059534602
#!/usr/bin/python3 # coding = UTF-8 # i = 3^5 # j = i^5 # print(j) def Find_One(list): re = 0 for i in list: re = re ^ i return re list1 = [3, 4, 5, 7, 3, 4, 5,] result = Find_One(list1) print('唯一不重复的值是:', result)
Vaild/python-learn
homework/20200704位运算/5_统计出现一次的个数.py
5_统计出现一次的个数.py
py
255
python
en
code
0
github-code
90
18205158559
N = int(input()) As = [] Bs = [] for _ in range(N): a,b = map(int,input().split()) As.append(a) Bs.append(b) As.sort() Bs.sort() if N%2 == 1: ma = As[N//2] mb = Bs[N//2] print(mb-ma+1) else: ma = (As[N//2-1] + As[N//2])/2 mb = (Bs[N//2-1] + Bs[N//2])/2 print(int((mb-ma)*2)+1)
Aasthaengg/IBMdataset
Python_codes/p02661/s602126439.py
s602126439.py
py
299
python
en
code
0
github-code
90
18230756599
def main(): N = int(input()) A_ls = map(int, input().split(' ')) ls = [0] * N for i in A_ls: ls[i - 1] += 1 for i in ls: print(i) if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p02707/s409311511.py
s409311511.py
py
205
python
en
code
0
github-code
90
14189432323
import heapq from typing import List class Solution: # O(n*log(n)) Solution (Runtime: 54 ms (86.3%) | Memory: 13.9 MB (91.37%)) def topKFrequent(self, words: List[str], k: int) -> List[str]: d = {} for word in words: if word in d: d[word] += 1 else: ...
Minho16/leetcode
Leetcode_75/TopKFrequentWords_Samu.py
TopKFrequentWords_Samu.py
py
1,216
python
en
code
0
github-code
90
23297003068
import sys, os class Solution: def climbStairs(self, n): if n == 1: return 1 elif n == 2: return 2 dp = [0] * (n+1) dp[1] = 1 dp[2] = 2 for i in range(3, n+1): dp[i] = dp[i-1] + dp[i-2] return dp[n] def climbStairs...
OhOHOh/LeetCodePractice
python/No70.py
No70.py
py
858
python
en
code
0
github-code
90
36347000067
# 画像関係 import cv2 import numpy as np # 画面情報 from screeninfo import get_monitors # システム関係 import os import sys # json import json # GUI関係 import pyautogui # GUI(tkinter) import tkinter import tkinter.filedialog as fd class GUI(): def __init__(self): # 画面作成 self.root = tkinter.Tk() # 変数(グローバ...
KinoshitaYstr/keppeki_movie_transform_system
gui/1_setting_transform.py
1_setting_transform.py
py
7,072
python
ja
code
0
github-code
90
33312141912
def location(path, create_full_url = False): scheme = urlparse.urlparse(path)[0] if scheme: return path else: if create_full_url: # URL is always going to be http://localhost:8001 (unless we will # implement https scheme), the other alternative to get hostname would # be using gethost...
edrikL/gears
gears/test/testcases/cgi/server_redirect.py
server_redirect.py
py
1,003
python
en
code
2
github-code
90
21171886927
# flake8: noqa import pathlib import os import csv import time import argparse import itertools from datetime import datetime from cognitiveMaps.deCognitiveMap import DECognitiveMap from cognitiveMaps import baseCognitiveMap from transformingData import cmeans from main import load_preprocessed_data, cross_validation_...
JakubBilski/mini-fcm
src/main_sigmoid.py
main_sigmoid.py
py
6,705
python
en
code
0
github-code
90
4203694958
import os import cv2 import numpy as np import subprocess def getBMP(directory): output = dict() for file in os.listdir(directory): filename = os.fsdecode(file) path = f'{directory}/{filename}/' img = cv2.imread(f'{path}/{filename}.bmp') output[chr(int(filename))] = img ret...
MaloMn/handwritten-font
convert.py
convert.py
py
1,336
python
en
code
0
github-code
90
71095392297
import bpy import random def add_high_resolution_sphere(location=(0, 0, 0)): bpy.ops.mesh.primitive_uv_sphere_add( segments=128, ring_count=64, radius=1, location=location ) def delete_random_faces(obj, percentage=0.4): bpy.context.view_layer.objects.active = obj obj.se...
GermanVerde/bpy
esfera40.py
esfera40.py
py
1,270
python
en
code
0
github-code
90
43067354437
from typing import List # O(n^2)으로 시간 초과 Time Limit Exceeded class Solution1: def twoSum(self, nums: List[int], target: int) -> List[int]: for i in range(len(nums)): for j in range(i+1, len(nums)): if nums[j] == target - nums[i]: return [i, j] class Solutio...
dongyun3586/Problem_solving_using_programming
online_judge_site_problems/LeetCode1_Two Sum.py
LeetCode1_Two Sum.py
py
1,053
python
en
code
0
github-code
90
29759459068
#%% This function creates labels for the Fonts and Characters and update the Dataset replacing them by those numbers def create_labels(data_y): font_names = list(set(data_y[:,0])) char_names = list(set(data_y[:,1])) #font name encoding we will convert the names into number, #so that they ...
ngorovitch/Characters-Recognition
src/model_module.py
model_module.py
py
1,281
python
en
code
1
github-code
90
12461650704
# content from kids can code: http://kidscancode.org/blog/ # import libraries and modules import pygame as pg from pygame.sprite import Sprite import random # game settings WIDTH = 360 HEIGHT = 480 FPS = 30 # define colors WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0,...
Owen1225/videoGame
main.py
main.py
py
1,909
python
en
code
0
github-code
90
18310993919
import sys mod = 10**9 + 7 input = sys.stdin.readline N = int(input()) A = list(map(int, input().split())) ans = 1 xyz = [0] * 3 for i in range(N): tmp = 0 index = -1 for j in range(3): if A[i] == xyz[j]: tmp += 1 if index == -1: index = j xyz[index] +=...
Aasthaengg/IBMdataset
Python_codes/p02845/s783229062.py
s783229062.py
py
399
python
en
code
0
github-code
90
4035583478
import sublime, sublime_plugin import os.path class OpenOtherCommand(sublime_plugin.WindowCommand): def run( self ) : vw = self.window.active_view() if not vw.is_scratch() : fname = vw.file_name() if fname : #Read the extensions setting from the view. exts = vw.settings().get("ext...
GuyCarver/OpenOther
OpenOther.py
OpenOther.py
py
2,694
python
en
code
0
github-code
90
45822885529
''' This file contains the api functions for phylobuilder. ''' import re from piston.handler import BaseHandler from pfacts003.protein_analysis.models import ProteinAnalysisJob from pfacts003.protein_analysis.consts import * from pfacts003.phylofacts.models import OhanaJobs from datetime import datetime from django.co...
berkeleyphylogenomics/BPG_utilities
pfacts003/protein_analysis/api.py
api.py
py
10,710
python
en
code
1
github-code
90
42572709013
n = int(input()) price = [int(i) for i in input().split(' ')] days = [] buy = 0 sell = 0 for i in range(1, n): if price[i] >= price[i - 1] and i != buy: sell = i elif buy == sell: buy = sell = i else: days.append([buy + 1, sell + 1]) buy = sell = i if buy != n - 1 and s...
Suvetha03/ProblemSolving
stockBuyAndSell1.py
stockBuyAndSell1.py
py
431
python
en
code
0
github-code
90
3393335298
#!/usr/bin/env python import pandas as pd from sklearn.cross_validation import cross_val_score from sklearn.linear_model import LogisticRegression INPUT_FILE = '../datasets/beer.tsv' NUM_FOLDS = 10 def stouter(k): """cast target variable to integer binary value""" try: return int('Stout' in k) e...
jason137/gads_26
lec07/beer.py
beer.py
py
1,174
python
en
code
6
github-code
90
2590055571
from flask_restful import abort, Resource from db import db_session, Process, ProcessPerformer, ProcessParameter, ProcessQuota, ProcessStartCondition # DELETE process and all its parameters from tables class ProcessesDelete(Resource): def delete(self, process_id): user_query = db_session.query(Process).fi...
petrovao87/test_api
delete_methods.py
delete_methods.py
py
1,247
python
en
code
0
github-code
90
73869073577
import validators import streamlit as st from langchain.chat_models import ChatOpenAI from langchain.document_loaders import UnstructuredURLLoader from langchain.chains.summarize import load_summarize_chain from langchain.prompts import PromptTemplate from transformers import AutoProcessor, MusicgenForConditional...
rsaba5612/MusicGen
audiocraft_app.py
audiocraft_app.py
py
3,650
python
en
code
1
github-code
90
2637332168
#!/usr/bin/env python from sys import path as syspath; syspath.append('./backend/scripts') from utils.census import load_wrangled_census from utils.covid import WRANGLED_PATH as DEST_PATH from utils.utils import days_between, loggy from utils.settings import US_NATION_VALUES import csv from collections import defaultd...
dannguyen/covidusa
backend/scripts/wrangle/wrangle_covid_series.py
wrangle_covid_series.py
py
5,910
python
en
code
1
github-code
90
70510610857
#!/usr/bin/env python import json import numpy as np import glob import re import scipy import argparse import math import time import os from collections import deque import scipy.ndimage from cexp.cexp import CEXP from cexp.env.environment import NoDataGenerated # Configurations for this script sensors = {'R...
yixiao1/Action-Based-Representation-Learning
carl/tools/image_process.py
image_process.py
py
6,203
python
en
code
13
github-code
90
27866032470
'''9.3 Write a program to read through a mail log, build a histogram using a dictionary to count how many messages have come from each email address, and print the dictionary.''' name = input("Enter file name: ") if len(name) < 1: name = "C:\\Users\\bills\\Desktop\\PY4E\\mbox-short.txt" handle = open(name) ...
BillyA7/PY4E
ex_9.3.py
ex_9.3.py
py
541
python
en
code
0
github-code
90
31778166728
import base64 from Cryptodome.Cipher import AES def aes128_decrypt(block, key): cipher = AES.new(key, AES.MODE_ECB) return cipher.decrypt(block) def main(): with open('1.txt', 'r') as file1: encoded = file1.read() text = base64.b64decode(encoded) decrypted = aes128_decrypt(text, b'YELLO...
tinkerscript/gb_crypto_02
01.py
01.py
py
395
python
en
code
0
github-code
90
32959824614
import torch from torch import nn import torch.nn.functional as F import torch import cv2 import numpy as np import os torch.backends.cudnn.enabled = False torch.backends.cudnn.benchmark = False torch.backends.cudnn.deterministic = False class ConvNormLReLU(nn.Sequential): def __init__(self, in_ch, out_ch, kernel...
fengwang/ImagePlayer
models/facepaint/facepaint_implementation.py
facepaint_implementation.py
py
5,102
python
en
code
1
github-code
90
27095126968
from spack import * class RBroom(RPackage): """Convert statistical analysis objects from R into tidy data frames, so that they can more easily be combined, reshaped and otherwise processed with tools like 'dplyr', 'tidyr' and 'ggplot2'. The package provides three S3 generics: tidy, which summ...
matzke1/spack
var/spack/repos/builtin/packages/r-broom/package.py
package.py
py
1,205
python
en
code
2
github-code
90
3753959238
#This is a simple app which lets you open multiple applications from one place without navigating to the particular folder. All from one place. import tkinter as tk from tkinter import filedialog, Text import os root = tk.Tk() apps=[] #Taking the app list if os.path.isfile('apps.txt'): with open('apps...
Sounav201/itworkshop
Tkinter/Workspace.py
Workspace.py
py
1,566
python
en
code
0
github-code
90
19492347687
import pandas as pd import os from os import path import pickle #Choose input file input_file = "GSE2366698_beta.csv" # Change name of output folder name_of_folder = "GSE2366698" # Create the folder if not os.path.exists(name_of_folder): os.mkdir(name_of_folder) # List all chromosomes chrom_lst = ["1", "2", "3...
nicolasloucheu/BetaToMethAnnot
BetaToMethAnnot.py
BetaToMethAnnot.py
py
2,584
python
en
code
0
github-code
90
37538748077
import os, time, sys from teplo500.core import * from teplo500 import core from teplo500.salus.salus_connect import SalusConnect class AbstractApp: def __init__(self): core.app = self self.timezone = '' ## example: Europe/Moscow self.lang = '' ## example: en self.config = {} ## dictionary with system....
MaxBazarov/teplo500py
lib/teplo500/abstract_app.py
abstract_app.py
py
1,760
python
en
code
0
github-code
90
17970609389
h,w = map(int,input().split()) n = int(input()) lst1 = list(map(int,input().split())) ans = [[0]*w for _ in range(h)] ret = lst1[0] color = 1 for i in range(h): if i%2 == 0: for j in range(w): if ret: ans[i][j] = color ret -= 1 else: re...
Aasthaengg/IBMdataset
Python_codes/p03638/s131022080.py
s131022080.py
py
731
python
en
code
0
github-code
90
21963766360
# https://docs.djangoproject.com/en/3.0/topics/db/queries/ from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse, HttpResponseRedirect from django.template import loader from django.shortcuts import render from django.utils.dateparse import parse_datetime from datetime import date...
mankey101/Inventory-Management
polls/views.py
views.py
py
2,871
python
en
code
0
github-code
90
30786718874
""" Testing dynamic text and images """ import time, unittest from selenium import webdriver from selenium.webdriver.common.by import By from webdriver_manager.chrome import ChromeDriverManager from OOP_the_internet_herokuapp.src.page.dynamic_content_page import DynamicContent class TestDynamicContent(unittest.Test...
AntonioIonica/Automation_testing
OOP_the_internet_herokuapp/src/test/test_dynamic_content.py
test_dynamic_content.py
py
1,700
python
en
code
0
github-code
90
22304158962
from altprint.printable.base import BasePrint from altprint.slicer import STLSlicer from altprint.layer import Layer, Raster from altprint.height_method import StandartHeightMethod from altprint.infill.rectilinear_infill import RectilinearInfill from altprint.gcode import GcodeExporter from altprint.settingsparser impo...
couto0/altprint
altprint/printable/standart.py
standart.py
py
4,433
python
en
code
1
github-code
90
73555201255
import httpagentparser from django.conf import settings from .models import Rule class TraceService: @classmethod def load_rules(cls): try: object_list = Rule.objects.filter(is_active=True).values( "content_type__model", "check_create", "check_edit", "check_delete" ...
dbsiavichay/django-tracing
tracing/services.py
services.py
py
1,244
python
en
code
0
github-code
90
43100530054
def bellman_ford(src, edgelist, V): dist = [float('inf')] * V dist[src] = 0 # Relax all edges V-1 times for _ in range(V): # For each edge check if the distance from src # to vertex v including this edge is shorter # if it is update dist[v] for edge in edgelist: u, v, w = edge if d...
ashish91/competitive-cheatsheet.py
graphs/bellman-ford.py
bellman-ford.py
py
401
python
en
code
0
github-code
90
25173474285
'''25. Знайти добуток елементів лінійного масиву цілих чисел, які кратні 5. Розмірність масиву - 10. Заповнення масиву здійснити випадковими числами від 10 до 100. Виконав: Лещенко В. О.''' import numpy as np A = np.random.randint(10, 100, 10) print(f'Вихідний масив: {A}.\n') prod = 1 for i in A: if ...
lgl90pro/colloquium2
25.py
25.py
py
790
python
uk
code
0
github-code
90
42268287164
def len(s): cnt = 0 for _ in s: cnt += 1 return cnt for _ in range(1, 11): T = int(input()) target = input() sentence = input() idx = 0 cnt = 0 while idx != len(sentence) - len(target) + 1: if sentence[idx:idx + len(target)] == target: cnt += 1 id...
junhong625/TIL
Algorithm/SWEA/D3/1213_String.py
1213_String.py
py
351
python
en
code
2
github-code
90
35034473590
from ProgramException import myException import math class DirectedGraph(object): def __init__(self,vertices): self.__dictIn = {} self.__dictOut = {} self.__dictCosts = {} for i in range(vertices): self.__dictOut[i]=[] self.__d...
alexovidiupopa/GraphAlgorithms
LabWork3/DirectedGraph.py
DirectedGraph.py
py
5,546
python
en
code
1
github-code
90
36270708827
"""projects_relationship_not_null Revision ID: 6b47c5bd9dd7 Revises: 61025b2d2ab8 Create Date: 2021-02-03 14:34:45.243463 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = '6b47c5bd9dd7' down_revision = '61025b2d2ab8' branch_l...
guldfisk/fml
migrations/versions/6b47c5bd9dd7_projects_relationship_not_null.py
6b47c5bd9dd7_projects_relationship_not_null.py
py
826
python
en
code
1
github-code
90
39811219645
class Node: def __init__(self, v): self.value = v self.prev = None self.next = None class OrderedList: def __init__(self, asc): self.head = None self.tail = None self.__ascending = asc def _isempty(self): if not self.head: return True ...
YonderMeizster/ADS-1
ordered_list/ordered_list.py
ordered_list.py
py
2,944
python
en
code
0
github-code
90
13478239364
# -*- coding: utf-8 -*- """ Created on Tue Feb 02 11:03:13 2016 Randonneur avec Python @author: Grrrrrrrrrrr """ # On part d'un profil de montagne envoyé par E.Trouvé - Glacier des Bossons moyenné à 8m # sample = nb de colo, lines = nd de lignes # split : sans rien préciser de plus: enlève saut de ligne espaces t...
dufauga/Rando
randonneur_2.py
randonneur_2.py
py
2,723
python
fr
code
0
github-code
90
4699424296
from vidstream import ScreenShareClient import threading IP = "" sender = ScreenShareClient(IP, 9999) sender.start_stream() t = threading.Thread(target=sender.start_stream()) t.start() while input("") != "STOP": continue sender.stop_stream() # Для запуска без консоли надо start pythonw название_файла
dronikosha/ScreenStreaming
sender.py
sender.py
py
352
python
ru
code
0
github-code
90
346622389
import zipfile from pathlib import Path import os from subprocess import call import argparse import sys ignore = (Path("project\\.gitattributes"), Path("project\\.gitignore"), Path("project\\.git")) def searchDirectory(path, myZip): for x in Path(path).iterdir(): if os.path.isdir(str(x)): se...
dugging1/bc
compile.py
compile.py
py
1,559
python
en
code
0
github-code
90
18814534867
import re import xlrd import lxml.html from openstates.scrape import Scraper, Organization class MECommitteeScraper(Scraper): def scrape(self, chamber=None): if chamber in ["upper", None]: yield from self.scrape_senate_comm() if chamber in ["lower", None]: yield from self....
openstates/openstates-scrapers
scrapers/me/committees.py
committees.py
py
4,006
python
en
code
820
github-code
90
41166710645
#!/usr/bin/python3 import re import argparse import os ''' --key: the keys that need to be desensitized in the file, support multiple input,eg:view_id --path: the path of the file, eg:./log/ applies to all files in the directory; eg:./log/log1 applies to the specified file ''' parser = argparse.ArgumentParser('the key...
ran1995ml/Notebook
Python/src/scripts/LogDesensitize.py
LogDesensitize.py
py
1,469
python
en
code
0
github-code
90
26903725323
# input getal = int(input('Geef een getal: ')) deler = 1 uitkomst = 0 output = '{} is geen priemgetal'.format(getal) # programma while deler < getal and uitkomst != getal // deler: deler += 1 uitkomst = getal / deler if uitkomst == 1: output = '{} is een priemgetal'.format(getal) print(output) ...
xander27481/informatica5
07b - iteraties Fortus/Priemgetallen.py
Priemgetallen.py
py
756
python
nl
code
0
github-code
90
16427654821
# Logging utility code import logging from functools import wraps from flask import request, current_app import time def log_request(f): """ A decorator that logs incoming requests. """ @wraps(f) def decorated_function(*args, **kwargs): current_app.logger.info( f"Request: {req...
KrishnaSolo/lendsimplev1
backend/utils/logging.py
logging.py
py
1,489
python
en
code
0
github-code
90
18354789723
import json class KeyNode: def __init__(self): self.parent = None self.children = [] self.action = "" def is_leaf(self): return len(self.children) == 0 @staticmethod def createFromDic(dic): node = KeyNode() if "input_char" in dic: node.actio...
alanbondarun/GestureTextInputAnalysis
keynode.py
keynode.py
py
858
python
en
code
0
github-code
90
32631346031
#!/usr/bin/python3 def replace(d, v, e): """ d, a dictionary v, a value to be replaced e, the new value This function mutates the dictionary and dows not return anything """ for key in d.keys(): if d[key] == v: d[key] = e # code to test the function d1 = {1: 2, 3: 4, ...
dmr-git/py
getprogramming/q27_2_3.py
q27_2_3.py
py
1,478
python
en
code
0
github-code
90
44420410906
import asyncio from discord.ext import commands import discord from utils.utils import * from youtubesearchpython import * class YoutbeSearchTo(commands.Cog): def __init__(self, client): self.client = client @commands.command() @commands.cooldown(rate=1, per=5, type=commands.BucketType.user) ...
Jourdelune/Symphonia
commands/YoutubeSearch.py
YoutubeSearch.py
py
1,989
python
en
code
0
github-code
90
35752466871
#!/usr/bin/env python import sys input= sys.stdin.readline from collections import deque n,m=map(int,input().split()) li=[] for _ in range(n): li.append(list(map(int,input().split()))) zero=0 for i in range(n): zero+=li[i].count(0) visit = [[False]*m for _ in range(n)] for i in range(n): for j in rang...
hansojin/python
graph/bj14940.py
bj14940.py
py
1,276
python
en
code
0
github-code
90
37651173782
#!/usr/bin/env python from apiclient import discovery import argparse from datetime import datetime, timedelta import httplib2 from oauth2client import client from oauth2client import tools from oauth2client.file import Storage import os import pandas VERSION = "1.0.0" # If modifying these scopes, delete your previo...
mareuter/python_scripts
running/race_training_scheduler.py
race_training_scheduler.py
py
6,891
python
en
code
0
github-code
90
70353644137
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def oddEvenList(head): if not head or not head.next: return head oddDummy = ListNode() evenDummy = ListNode() odd = oddDummy even = evenDummy isOdd = True while head: ...
mihirkudale/PPT-iNueron
DSA/Assignment 14/Q5.py
Q5.py
py
852
python
en
code
2
github-code
90
27088496118
import os import pytest from llnl.util.filesystem import working_dir, is_exe import spack.repo import spack.config from spack.fetch_strategy import from_list_url, URLFetchStrategy from spack.spec import Spec from spack.version import ver import spack.util.crypto as crypto @pytest.fixture(params=list(crypto.hashes.k...
matzke1/spack
lib/spack/spack/test/url_fetch.py
url_fetch.py
py
4,561
python
en
code
2
github-code
90
18262869819
def main(): import sys sys.setrecursionlimit(10**5+10) N, M, K = map(int,input().split()) class UnionFind: def __init__(self, N): self.par = [-1 for i in range(N+1)] self.rank = [1]*(N+1) def find(self, x): if self.par[x] < 0: return x else: ...
Aasthaengg/IBMdataset
Python_codes/p02762/s143782782.py
s143782782.py
py
1,519
python
en
code
0
github-code
90
29742568476
import os from joblib import parallel_backend from torch.autograd.grad_mode import F from torch.serialization import save import torchvision.utils as vutils import numpy as np import torch from models.dcgan import discriminator,generator from dataset import PairImage, PairVoice,PairText import torchaudio import matplot...
ravenSanstete/data-hiding
TaskModel.py
TaskModel.py
py
13,722
python
en
code
0
github-code
90
43485939873
from django.urls import path from dataworkspace.apps.dw_admin.views import ( DataWorkspaceStatsView, ReferenceDatasetAdminEditView, ReferenceDatasetAdminDeleteView, ReferenceDatasetAdminDeleteAllView, SourceLinkUploadView, ReferenceDatasetAdminUploadView, ) urlpatterns = [ path( "a...
uktrade/data-workspace
dataworkspace/dataworkspace/apps/dw_admin/urls.py
urls.py
py
1,773
python
en
code
42
github-code
90
18324481579
s = list(input()) l2r = [0] r2l = [0] n = len(s) for i in range(n): if s[i] == '<': l = l2r[i] l2r.append(l+1) else: l2r.append(0) for j in range(n): if s[n-1-j] == '>': r2l.append(r2l[j]+1) else: r2l.append(0) invr2l = r2l[::-1] ans = [] for i in range(n+1): m = max(l2r[i],invr2l[i]) a...
Aasthaengg/IBMdataset
Python_codes/p02873/s473947144.py
s473947144.py
py
350
python
en
code
0
github-code
90
19583646372
import sys from itertools import tee from collections import Counter def main(): polymer, template = read_input(sys.stdin) for _ in range(10): polymer = template.apply(polymer) counts = Counter(polymer).most_common() _, most = counts[0] _, least = counts[-1] print(most - least) de...
mccredie/aoc
2021/dec14/ex1.py
ex1.py
py
1,131
python
en
code
1
github-code
90
8936263137
# 动态生成一个字典 url_dict = dict() url_dict2 = dict() # 三层嵌套,第三层返回第二层闭包的对象引用,必须第三层都有参数 def set_args(data): def set_fun(func): print("func%s" % str(func)) url_dict[data] = func def call_fun(*args, **kwargs): print("show") return func(*args, **kwargs) url_dict2[...
liu11639000200/workspace
02_装饰器路由.py
02_装饰器路由.py
py
732
python
zh
code
0
github-code
90
7237425914
#!/usr/bin/env python # -*- coding: utf-8 -*- from kivy.app import App from kivy.properties import ObjectProperty from kivy.core.text import LabelBase from kivy.core.window import Window from kivy.clock import Clock from kivy.utils import get_color_from_hex from kivy.lang.builder import Builder from time import strft...
bdastur/notes
python/kivyapp/blueprints/clock/clock.py
clock.py
py
2,890
python
en
code
4
github-code
90
40951300827
import glob import os from typing import Union from bole.config.dict import CascadingConfigDictionary from bole.exceptions import BoleException from bole.utils import resolve_path class CascadingConfigImport(CascadingConfigDictionary): """Implements a config import.""" @property def path(self) -> str: ...
LamaAni/bole
bole/config/built_in.py
built_in.py
py
3,307
python
en
code
0
github-code
90
41599650085
''' CCDG-compliant SDK for common use functions in pipeline ''' from time import sleep import boto3 import os import shutil import subprocess import sys import uuid import yaml s3 = boto3.resource('s3') class Task: ''' A step in the pipeline to run. ''' def __init__(self, step, prefix, in_files, para...
shulp2211/psychcore-compute-platform
docker/SDK.py
SDK.py
py
25,911
python
en
code
null
github-code
90
18357000989
# import sys # sys.setrecursionlimit(10 ** 6) # import bisect # from collections import deque # from decorator import stop_watch # # # @stop_watch def solve(N, Ss): for i in range(N): Ss[i] = ''.join(sorted(list(Ss[i]))) Ss.sort() ans = 0 flg = False counter = 0 for i in range(N - 1): ...
Aasthaengg/IBMdataset
Python_codes/p02947/s803771426.py
s803771426.py
py
872
python
en
code
0
github-code
90
42370367215
import re from django.contrib.sites.models import Site from django.db import IntegrityError from django.utils import timezone from tweets2text.models import ( AccountActivity, FollowHistory, TweetTextCompilation ) from zappa.asynchronous import task from tweets2text.twitter_api import Tweet, TwitterUser @task() d...
rji-futures-lab/tweets-to-text
tweets2text/handlers.py
handlers.py
py
4,109
python
en
code
1
github-code
90
18536052769
# solution data = input() qwe = int(input()) dic = set() for i in range(len(data)): for j in range(qwe): if i+j+1 <= len(data): dic.add(data[i:i+j+1]) di = list(dic) di.sort() print(di[qwe-1])
Aasthaengg/IBMdataset
Python_codes/p03353/s671912629.py
s671912629.py
py
220
python
en
code
0
github-code
90
73820303337
# """ # This is the interface that allows for creating nested lists. # You should not implement it, or speculate about its implementation # """ #class NestedInteger(object): # def __init__(self, value=None): # """ # If value is not specified, initializes an empty list. # Otherwise initializes a ...
HarrrrryLi/LeetCode
364. Nested List Weight Sum II/Python 2/solution.py
solution.py
py
2,184
python
en
code
0
github-code
90
22402914163
#!/usr/bin/env python3 import pandas import seaborn as sns import matplotlib.pylab as plt # Load data data_full = pandas.read_csv("/tmp/aprilgrid_detect-pthreads_fullsize.csv") data_50 = pandas.read_csv("/tmp/aprilgrid_detect-pthreads_resized_50.csv") data_75 = pandas.read_csv("/tmp/aprilgrid_detect-pthreads_resized_7...
chutsu/yac
scripts/plot_aprilgrid_detection.py
plot_aprilgrid_detection.py
py
1,690
python
en
code
34
github-code
90
34659119218
from bs4 import BeautifulSoup from bs4.element import NavigableString, Tag import re import sqlite3 import glob import logging import traceback import sys import os # https://beautiful-soup-4.readthedocs.io/en/latest/#kinds-of-objects # https://www.mssqltips.com/sqlservertip/7041/python-example-web-scraping-project/ #...
eissko/aws
iam-scrapper/iam-html-to-db.py
iam-html-to-db.py
py
4,174
python
en
code
0
github-code
90
18431648489
''' 研究室PCでの解答 ''' import math #import numpy as np import queue import bisect from collections import deque,defaultdict import heapq as hpq from sys import stdin,setrecursionlimit #from scipy.sparse.csgraph import dijkstra #from scipy.sparse import csr_matrix ipt = stdin.readline setrecursionlimit(10**7) mod = 10**9+7 #...
Aasthaengg/IBMdataset
Python_codes/p03096/s325104020.py
s325104020.py
py
791
python
en
code
0
github-code
90
17960798959
#A - Ice Tea Store Q,H,S,D = map(int,input().split()) N = int(input()) Q1,H1 = 4*Q,2*H S = min(Q1,H1,S) if 2*S>D: cnt_2 = N//2 cnt_1 = N%2 pay = D*cnt_2 + S*cnt_1 else: pay = N * S print(pay)
Aasthaengg/IBMdataset
Python_codes/p03617/s963963898.py
s963963898.py
py
209
python
en
code
0
github-code
90
36761399870
import matplotlib.pyplot as plt import numpy as np if __name__ == '__main__': table = np.genfromtxt('data1.csv', delimiter=';') array1 = table[1:, 0] array4 = table[1:, 3] array5 = table[1:, 4] correlation = np.subtract(array5, array4) plt.plot(array1, array4, "pink") plt.pl...
ElizavetaSalinaR3138/-7
2.py
2.py
py
572
python
ru
code
0
github-code
90
13966858966
import telebot import instaloader import requests import timeit import time from config import DONAT_MESSAGE, CONTACT_MESSAGE, TOO_MANY, ENTER_LOGIN, WRONG_INST_USERNAME, MUTUAL_TEXT, TELEGRAM_TOKEN, INST_USERNAME_BOT, INST_PASSWORD_BOT, START_TEXT, ERROR_MESSAGE, HELP_TEXT from Log import Log from DataBase import Dat...
navacar/InstSubChecker
bot.py
bot.py
py
11,076
python
ru
code
1
github-code
90
70267130857
def twoStrings(s1: str, s2: str) -> str: """ :param s1: a string :param s2: another string :return: either "YES" or "NO" """ if set.intersection(set(s1), set(s2)): return "YES" return "NO" if __name__ == '__main__': q = int(input()) for q_itr in range(q): print(tw...
atorulia/hackerrank-python
Interview Preparation Kit/Dictionaries and Hashmaps/two-strings/two-strings.py
two-strings.py
py
348
python
en
code
0
github-code
90
72718296617
import unittest import os from src.utils import replce, mapping_csv, select_smtp_provider BASE_DIR_EXAMPLE = os.path.join(os.path.expanduser('~'), os.path.dirname( os.path.dirname( os.path.abspath(__file__)))) ...
Azrood/pymailer
tests/test_utils.py
test_utils.py
py
2,642
python
en
code
0
github-code
90
12164844102
import numpy as np import pandas as pd import os from PyLyrics import * data_file = os.path.join(os.pardir, "data", "raw_data.xls") destination_file = os.path.join(os.pardir, "data", "data_with_lyrics.csv") df = pd.read_excel(data_file, header = None, names = ['pos', 'track', 'artist', 'year']) df['lyrics'] = '' fo...
Vishengel/top2000
scripts/lyric_scraper.py
lyric_scraper.py
py
889
python
en
code
0
github-code
90
19026157322
#!/usr/bin/env python3 # author: Ole Schuett import re import sys from pathlib import Path def main() -> None: if len(sys.argv) != 2: print("Usage: format_makefile.py <file>") sys.exit(1) makefile = Path(sys.argv[1]) lines_out = [] continuation = False for line in makefile.read_...
cp2k/cp2k
tools/precommit/format_makefile.py
format_makefile.py
py
1,002
python
en
code
703
github-code
90
75032036136
import cv2 import numpy as np class flag: def __init__(self, length, width): self.length = length self.width = width def Austria(self): image_size = (self.length,self.width,3) # flag-of-Austria flag_of_Austria = np.ones((image_size[0],image_size[1],image_size[2]), dtype...
ikkear99/BAP-Software-AI-team-Training
image_processing/country_flag.py
country_flag.py
py
3,646
python
en
code
0
github-code
90
72095303977
#!/usr/bin/env python from flexbe_core import EventState, Logger from flexbe_core.proxy import ProxyActionClient # example import of required action from flir_pantilt_d46.msg import PtuGotoAction, PtuGotoGoal class MoveCameraState(EventState): ''' Moves the camera. ># pan float Pan angle [-180, 180) ># tilt ...
FlexBE/flexbe_strands
strands_flexbe_states/src/strands_flexbe_states/move_camera_state.py
move_camera_state.py
py
1,569
python
en
code
0
github-code
90
19616265230
import os import pygame def get_valid_music_files(directory): valid_extensions = ['.mp3', '.wav', '.ogg'] # Add more if needed music_files = [] for root, _, files in os.walk(directory): for file in files: if os.path.splitext(file)[1].lower() in valid_extensions: ...
Trivenirajput46/CodeClause_project_name
project 2.py
project 2.py
py
1,739
python
en
code
0
github-code
90
17678768521
import discord import asyncio import os from discord.ext import commands from discord import app_commands import yandex_music from spotipy import Spotify from spotipy.oauth2 import SpotifyClientCredentials from ..config import * from .player.player import Player from .messages.music_answers import * class PlayQuery(c...
LeMeA/Umi
bot/cogs/music.py
music.py
py
9,565
python
en
code
0
github-code
90
14008443670
# Imports import numpy as np import matplotlib.pyplot as plt import mpl_toolkits.axisartist as AA # Creat a new figure of size 10x6 points ,using 100 pots per inch fig = plt.figure(figsize=(10, 6), dpi=80) # Creat a new subplot from a grid of 1x1 # 使用Axes来创建axisartist图像 ax = AA.Axes(fig, [0.1, 0.1, 0.8, 0.8]) fig.add_...
nigaknight/Practice
Matploylib/Axisartist.py
Axisartist.py
py
2,153
python
en
code
0
github-code
90
18043766629
H,W=map(int,input().split()) A=[list(input()) for _ in range(H)] h=0 w=0 ans="Possible" for i in range(H): for j in range(W): if A[i][j]=="#": if (i==h and j-w<2) or (i-h<2 and j==w): h=i w=j else: ans="Impossible" print(ans)
Aasthaengg/IBMdataset
Python_codes/p03937/s769140849.py
s769140849.py
py
268
python
en
code
0
github-code
90
18337275219
import sys def input(): return sys.stdin.readline().rstrip() def main(): n, m = map(int, input().split()) price = [0]*m typesnum = [0]*m keybit=[0]*m for i in range(m): price[i], typesnum[i] = map(int, input().split()) keybit[i] = sum(map(lambda x: 2**(int(x)-1), input().split())) ...
Aasthaengg/IBMdataset
Python_codes/p02901/s335392956.py
s335392956.py
py
593
python
en
code
0
github-code
90
17955459309
import collections N = int(input()) lsA = [] for i in range(N): lsA.append(int(input())) counterA = collections.Counter(lsA) ans = 0 for i in counterA.values(): ans += i%2 print(ans)
Aasthaengg/IBMdataset
Python_codes/p03607/s314035766.py
s314035766.py
py
191
python
en
code
0
github-code
90
66458884
# logical operators isTrue = False isGood = True if isTrue and isGood: # AND : both conditions should be true print("you are insane") if isTrue or isGood: # OR : either one condition should be true print("are you sure") if not isTrue and isGood: # NOT : reverts the value print("this is loopception")
vedang-jammy/Python-Programs
operators/a7.py
a7.py
py
320
python
en
code
0
github-code
90
45822753719
from django.shortcuts import render_to_response from pfacts003.kegg.forms import * from pfacts003.phylofacts.models import OrthologTypes, KEGG_Map, KEGG_Map_EC, \ EC, UniProtEC, UniProtTaxonomy, TreeNode, getTreeNodeQuerySetForTreeNodes import string from django.db.models import Q ec_translation = string.maketrans('.-...
berkeleyphylogenomics/BPG_utilities
pfacts003/kegg/views.py
views.py
py
4,412
python
en
code
1
github-code
90
73805683176
from ex115.modulos import * from time import sleep arq = 'testeee.txt' if not arquivoExiste(arq): criarArquivo(arq) while True: quest = menu(['Verificar um arquivo', 'Ver pessoas cadastradas', 'Cadastrar nova pessoa', 'Sair do sistema']) if quest == 1: cab('VERIFICAÇÃO DE ARQUIVOS', 31, 47)...
lucasptcastro/projetos-curso-em-video-python
ex115.py
ex115.py
py
1,511
python
pt
code
1
github-code
90
5229790151
import discord from discord.ext import commands, tasks from set_up.settings import SettingTypes, SettingChangeState from set_up.server_settings import ServerSettings from set_up.user_settings import UserSettings import set_up.group_settings as GroupSetup from tools.embed import Embed import tools.error as Error import ...
Alex-Au1/Haku_Bot
set_up/setting_client.py
setting_client.py
py
7,659
python
en
code
0
github-code
90
40695008391
from math import * #math module. gives us access to a lot more math functions # this function is in linear time given_array = [1,4,3,2,5,10] def find_sum(given_array): total = 0 for nums in given_array: total += nums return total #time complexity = # # linear time O(n) # constant ti...
tsabz/python_practice
big_O_notation.py
big_O_notation.py
py
352
python
en
code
0
github-code
90