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
15773352826
film_v1 = { "A Fish Called Wanda" : [130,170], "Lord of the Rings" : 223 } print(film_v1["A Fish Called Wanda"]) film_v2 = { "A Fish Called Wanda" : { "runtime" : 130, "directors" : ["John Cleese", "Charles Cricton"], "rating" : 7.5 }, "A Fish Called Jo Bjørnar" : { ...
hausnes/IT2-2023-2024
intro-serie/dictionary-tips.py
dictionary-tips.py
py
695
python
en
code
1
github-code
90
74043669098
from bot import bot import threading from essential.reader import reader from essential.writer import writer from essential.exceptionf import exceptionf import os from essential.constants import m, h from automate.prayerazkar import prayerazkar def prayerreminder(): dic = reader() pc = dic["pc"] # ---- ...
jnzal/Islamic_TG_BOT
automate/prayerreminder.py
prayerreminder.py
py
1,413
python
en
code
0
github-code
90
17979133999
import sys N, P = map(int, sys.stdin.readline().rstrip().split()) A = list(map(int, sys.stdin.readline().rstrip().split())) kisu = 0 gusu = 0 for a in A: if a % 2 == 1: kisu += 1 else: gusu += 1 total = 2 ** N # 全場合の数 # 階乗の事前計算 x = [1] res = 1 for i in range(1, N + 1): res *= i x.appe...
Aasthaengg/IBMdataset
Python_codes/p03665/s715584646.py
s715584646.py
py
654
python
ja
code
0
github-code
90
73173574055
"""Support for Modbus Register sensors.""" import logging from typing import Any, Optional, Union from .IModifiedModbusHub import IModifiedModbusHub from .ModifiedModbus.Helper import Helper #import pydevd from .unit_scanner import UnitScanner from .ModifiedModbus import IDeviceEventConsumer from homeassistant.compone...
jlola/homeassistant-config
custom_components/modified_modbus/sensor.py
sensor.py
py
7,207
python
en
code
0
github-code
90
11126732827
from models.cluster.CluFunc import GetPara, MainFunc from utils.tuning import ListPara, ParaStr2Dict, UpdateOpt import os ################################# # experiment setting ################################# PerformanceTest = { 'ClusM': ['str', ['DBSCAN', 'KM']], 'SetName': ['str', ['A']], '...
newbee-ML/Velocity-Picking-UEL
utils/SingleClusterMain.py
SingleClusterMain.py
py
1,159
python
en
code
1
github-code
90
42267926704
# 조건 : 문자일 때 숫자 숫자일 때 문자로 답변하기 # 방법 : key(문자):value(숫자) 와 key(숫자):value(문자)인 두 개의 Dictionary를 만들기 import sys input = sys.stdin.readline N, M = map(int, input().split()) name = {} num = {} for i in range(1, N+1): v = input().rstrip() name[v], num[i] = i, v for _ in range(M): a = input().rstrip() if...
junhong625/TIL
Algorithm/Baekjoon/클래스/class 3/1620_나는야 포켓몬 마스터 이다솜.py
1620_나는야 포켓몬 마스터 이다솜.py
py
471
python
ko
code
2
github-code
90
17963244169
s = input() alphabets = 'abcdefghijklmnopqrstuvwxyz' for i in s: alphabets = alphabets.replace(i, '') s = s.replace(i, '') alphabets = [i for i in alphabets] alphabets.sort() if len(alphabets) > 0: print(alphabets[0]) else: print('None')
Aasthaengg/IBMdataset
Python_codes/p03624/s995355385.py
s995355385.py
py
247
python
en
code
0
github-code
90
18531062819
#!/usr/bin/env python3 import sys from collections import deque, Counter from heapq import heappop, heappush from bisect import bisect_right from itertools import accumulate sys.setrecursionlimit(10**6) INF = 10**12 m = 10**9 + 7 def main(): N = int(input()) A = list(map(int, input().split())) # しゃくとり法の練...
Aasthaengg/IBMdataset
Python_codes/p03340/s457481725.py
s457481725.py
py
746
python
en
code
0
github-code
90
30950478090
class Solution(object): def minPartitions(self, n): """ :type n: str :rtype: int """ self.n = n n = self.n max = 0 for i in n: if int(i) > max: max = int(i) print(max) s= Solution() s.minPartitions("32") ...
AaroneGeorge/LEETCODE
string/1689/Solution.py
Solution.py
py
384
python
en
code
0
github-code
90
5291027998
from __future__ import annotations import functools import logging import warnings from typing import Optional, Sequence, Union import numpy as np import torch from torch.optim import Optimizer from composer.algorithms.blurpool.blurpool_layers import BlurConv2d, BlurMaxPool2d from composer.algorithms.warnings import...
mosaicml/composer
composer/algorithms/blurpool/blurpool.py
blurpool.py
py
7,959
python
en
code
4,712
github-code
90
18272150315
import itertools class Node: def __init__(self, nodes, prob=0, name=None, level=0, parent=None): self.prob = prob self.nodes = nodes self.name = name self.level=level self.parent = parent def add_node(self,node): node.parent = self self.nodes.append(node) def is_exhaustive(self): i...
weriko/groups
groups/Node.py
Node.py
py
2,346
python
en
code
0
github-code
90
6279255915
""" Utility functions """ CURRENT_POSITION = "CurrentPosition" DRAWN = " drawn " GAMEREC = "gamerec" CLOCKV = "%clk" PNAMES = "pnbrq" POINTS = [1, 3, 3, 5, 9] def comp_time(movep): """ Compute time value Args: movep -- text of time information extracted from game log Returns time left as an ...
wusui/chess_career
utilities.py
utilities.py
py
1,872
python
en
code
0
github-code
90
21456252054
## write dictionaries to CSV files for Kunal / Yu-ying outputDir = './CSV_FILES_PROCESSED/' f = open(outputDir + 'd_bp_status_pt_level_clinician.csv','w') for key in d_bp_status_pt_level_clinician: f.write(str(key) + ',' + str(d_bp_status_pt_level_clinician[key]) + '\n') # python will convert \n to os.linesep f.cl...
rchenmit/htn_pheno_code_20140330
write_dict_to_csv_for_kunal_yuying.py
write_dict_to_csv_for_kunal_yuying.py
py
741
python
en
code
0
github-code
90
71659882858
# Named entity extraction from NLTK. Works well. # Also consider terminology extraction: https://pypi.python.org/pypi/topia.termextract/1.1.0 # Named entity extraction with ML: # http://nlpforhackers.io/named-entity-extraction/ # http://nlpforhackers.io/training-ner-large-dataset/ import nltk import code sampl...
zw2326/NewsFeed
legacy/test-nee.py
test-nee.py
py
1,312
python
en
code
0
github-code
90
8634924038
""" Question link - https://leetcode.com/problems/max-area-of-island/description/ """ class Solution: def maxAreaOfIsland(self, grid: List[List[int]]) -> int: seen=set() m,n = len(grid), len(grid[0]) def dfs(row,col): if row<0 or row>=m or col<0 or col>= n: ret...
akshayavb99/learning_track
Leetcode Solutions/695_Max_Area_of_Island.py
695_Max_Area_of_Island.py
py
751
python
en
code
0
github-code
90
3873979120
# Import pygame import pygame import time import math class Textbox: def __init__(self, game, x, y, width, text, callback): self.game = game self.x = x self.y = y self.text = text self.color = (255,255,255) self.callback = callback self.width = width ...
RektInator/infprj2
infprj2/textbox.py
textbox.py
py
4,691
python
en
code
4
github-code
90
17963634219
n=int(input()) t = list(map(int,input().split())) t.sort() memo = [] check = 1 for i in range(n-1): if t[i] == t[i+1] and i == n-2: check += 1 memo.extend([t[i]]*(check//2)) elif t[i] == t[i+1]: check += 1 elif t[i] != t[i+1] and check>1: memo.extend([t[i]]*(check//2)) ...
Aasthaengg/IBMdataset
Python_codes/p03625/s479801972.py
s479801972.py
py
422
python
en
code
0
github-code
90
18004401169
N = int(input()) A = list(map(int,input().split())) ret = 0 def count(nega): ret = 0 s = 0 for e in A: nega = not nega #print(e,ret,s,s+e) if nega and 0 <= s + e: ret += abs(s + e) + 1 s = -1 elif not nega and s + e <= 0: ret += abs(s + e) + 1 s = 1 else: s += e ...
Aasthaengg/IBMdataset
Python_codes/p03739/s989096717.py
s989096717.py
py
369
python
en
code
0
github-code
90
8289705426
# from random import randint # from django.http import HttpResponse # from django.shortcuts import render # from django.urls import path # def home_page(request): # context = {'name': 'John Smith'} # response = render(request, 'index.html', context) # return HttpResponse(response) # def portfolio(request...
yfove/django-blog
my_first_web_app/urls.py
urls.py
py
1,448
python
en
code
0
github-code
90
10312351466
#!/usr/bin/env python3 from datetime import datetime import os def two_dates(): now = datetime.now() today = [now.year, now.month, now.day] bday = [] os.system("clear||cls") ymd = input("\nEnter birthdate in YYYY-MM-DD format: ") # while True: if ymd: try: bday = [int(i...
R3DDY97/Days_in_2dates
input_days.py
input_days.py
py
533
python
en
code
0
github-code
90
35444712116
from pages.main_page import MainPage from pages.basket_page import BasketPage import pytest link = "http://selenium1py.pythonanywhere.com/" def go_to_login_page(browser): login_link = browser.find_element_by_css_selector("#login_link") login_link.click() @pytest.mark.login_guest class TestLoginFromMainPage()...
traffhub/final-test-project
test_main_page.py
test_main_page.py
py
865
python
en
code
0
github-code
90
3173763967
#!/usr/bin/env python # -*- coding: utf-8 -*- import re import os import sys import shutil print ("Welcome to preapre ppa package...") dists = [] ''' # Not supported qt5: dists.append({ "dist_name": "trusty", "ppa_name_suffix": "ppa-ubuntu-14-04-trusty", "end": "April 2019", "version": "14.04 LTS" }) ''' dists...
freehackquest/fhq-server
contrib/ppa/build_source_pkg_for_ppa.py
build_source_pkg_for_ppa.py
py
5,269
python
en
code
35
github-code
90
13156894658
""" The classes in this module implement two permutations of the Quartznet model. It is an extension of Jasper with separable convolutions and larger filters. Only two are trained since the third permutation would be a randomly initialized model identical to Jasper. QuartzNet models are made up of blocks and convoluti...
maeganlucas/CS490-ATC
NeMo/Code/lib/asr-project/source/models/quartznet.py
quartznet.py
py
2,789
python
en
code
3
github-code
90
34679415112
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals AUTHOR = 'Rødt Østensjø' SITENAME = 'Rødt Østensjø' SITEURL = 'http://www.rodtostensjo.no/beta' PATH = 'content' TIMEZONE = 'Europe/Oslo' DEFAULT_LANG = 'no' STATIC_PATHS = [ 'pdfs', 'images', 'extra', # this ] EXT...
lilizoey/R-dtBlogg
pelicanconf.py
pelicanconf.py
py
1,675
python
en
code
0
github-code
90
18232176919
def read_int(): return int(input().strip()) def read_ints(): return list(map(int, input().strip().split(' '))) def solve(): N = read_int() A = read_ints() dp = [ [0]*(N+1) for _ in range(N+1) ] AI = sorted(((a, i) for i, a in enumerate(A)), reverse=True) for i, (a, ix) in e...
Aasthaengg/IBMdataset
Python_codes/p02709/s076302253.py
s076302253.py
py
752
python
en
code
0
github-code
90
24800212577
import numpy as np import matplotlib.pyplot as plt #Unos varijabla i postavljanje liste vremena vo=float(input("Upisite pocetnu brzinu")) kut=float(input("Upisite kut(stupnjevi)")) tmax=10 ay=-9.81 #Konverzija u radijane kut=np.deg2rad(kut) #Lista sa vremenima dt=0.01 T=[0] while T[-1]<=tmax: T.a...
KloDragun/PAF
Vjezbe/Vjezbe_2/zad2.py
zad2.py
py
1,136
python
sr
code
0
github-code
90
3394887428
import pandas as pd import matplotlib.pyplot as plt # read csv file and load to data frame df = pd.read_csv('data/covid-19-cases.csv') # group by country column and sum over the different states/regions of each country grouped = df.groupby('Country/Region') df_countries = grouped.sum() def make_plot(coun...
jason11501/MSA-Classification
MSA-CLC-CLASSIFICATION-404 NoName/Exercise /19127517- Hồ Thiên Phước/Lab02 - Visualization/source/p_week02_source/main-covid.py
main-covid.py
py
1,187
python
en
code
0
github-code
90
10368604832
try: from tkinter import Toplevel, ttk, Canvas, StringVar, BooleanVar, PhotoImage, Tk from tkinter.filedialog import askdirectory, askopenfilename from os.path import basename, abspath from time import sleep from threading import Thread from json import load from json.decoder import JSONDeco...
MateuszPerczak/Sounder5
src/Components/Setup.py
Setup.py
py
16,064
python
en
code
7
github-code
90
6836812289
from math import ceil # 기능 개발 # n개의 기능의 개발 진행도와 개발 속도가 주어지고 # 이전 기능들이 모두 배포되고 진행도가 100이 될 때 배포 가능하며 # 배포는 하루에 한번만 가능하다고 할 때 # 모든 기능을 배포할 때 까지 각 배포마다 배포된 기능의 수를 구하는 문제 def solution(progresses, speeds): answer = [] n = len(progresses) day = 0 for i in range(n): # 남은 진도 remain = 100 - pro...
Scalas/Programmers
solution/sol42586.py
sol42586.py
py
889
python
ko
code
0
github-code
90
23999359222
from openerp.osv import fields, osv from openerp.tools.translate import _ from openerp.tools import config from openerp import SUPERUSER_ID from openerp import api import time class hr_employee(osv.osv): _inherit = 'hr.employee' def get_parent_emp(self, cr, uid, context=None): i...
OpenAT/cu_hofe
cam_hr/hr.py
hr.py
py
6,537
python
en
code
0
github-code
90
16469731874
from dataset.datasets import MixamoDatasetForSkeleton, MixamoDatasetForView, MixamoDatasetForFull from torch.utils.data import DataLoader from dataset.base_dataset import get_meanpose import numpy as np def get_dataloader(phase, config, batch_size=64, num_workers=4): assert config.name is not None if config.n...
ChrisWu1997/2D-Motion-Retargeting
dataset/__init__.py
__init__.py
py
1,053
python
en
code
406
github-code
90
34241074233
#!/usr/bin/env python3 """ Module to test papers.py """ __author__ = "Shuai Wang" __email__ = "info.shuai@gmail.com" # imports one per line import pytest from papers import decide def test_complete_info(): """ Test if required info is complete """ # 8 entries: 1st is complete, and the rest 7 miss...
jayinai/inf1340
inf1340_ass2/test_papers.py
test_papers.py
py
2,844
python
en
code
0
github-code
90
73324072937
#!/usr/bin/env python3 import socket import json import code s = socket.socket() s.connect(("localhost", 25565)) h = b"\x00\x00\x01h\x63\xdd\x01" h = bytes([len(h)]) + h r = b"\x01\x00" code.interact("", local=locals()) s.close()
friedkeenan/dolor-go
test.py
test.py
py
235
python
en
code
2
github-code
90
41779766958
import os import csv import random import numpy as np import pandas as pd #import matplotlib.pyplot as plt import csv #Script to be run def main(): outpath='../output/simulation/' datapath='../../datastore/' sim_designs = [] with open('designs_to_run.csv', newline='') as inputfile: for row i...
SimonFreyaldenhoven/example_template
analysis/source/simulation/summary_stats.py
summary_stats.py
py
1,484
python
en
code
0
github-code
90
70706038058
from cogs.imports import * class Guess(commands.Cog): def __init__(self, client): self.client = client @commands.command(aliases=["guess"]) async def Guess(self,message, *, PlayerGuess:int, name="playerguess"): CPUGUESS = random.randint(1,10) #!Unless its Less ...
NoNameNeededStudios/NoNameNeeded-bot
Bot/cogs/Commands/Guess.py
Guess.py
py
1,146
python
en
code
3
github-code
90
71790973737
import time import queue import threading q = queue.Queue(10) # 生成一个队列,用来保存“包子”,最大数量为10 # 生产者 def productor(i): # 厨师不停地每2s做一个包子 while True: q.put("厨师%s做的包子!" % i) time.sleep(2) def consumer(i): # 顾客不停地每1s吃一个包子 while True: print("顾客%s吃了一个%s" % (j, q.get())) time.sle...
LIMr1209/design_patterns
algorithm/双端队列.py
双端队列.py
py
681
python
zh
code
0
github-code
90
29120998173
import time import pandas as pd import numpy as np CITY_DATA = { 'chicago': 'chicago.csv', 'new york city': 'new_york_city.csv', 'washington': 'washington.csv' } list_months = ['january', 'february', 'march', 'april', 'may', 'june'] list_days = ['saturday','sunday','monday','tuesday','wedn...
amrmaali/bikeshare-data-project
bikeshare.py
bikeshare.py
py
6,795
python
en
code
0
github-code
90
86584955542
''' Created on 20 ago. 2019 @author: Francisco Prieto (Orishiku) ''' import os import git from django.conf import settings from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): help = 'Update apricot-flavor sources from git repository.' __path = os.path.join(settings.B...
softapr/django-apricot-flavor
apricot_flavor/management/commands/updateflavor.py
updateflavor.py
py
1,222
python
en
code
0
github-code
90
10227347547
import sys input = sys.stdin.readline n = int(input()) numbers = list(map(int, input().split())) result = 0 def merge_sort(unsortedList): if len(unsortedList) <= 1: return unsortedList mid = len(unsortedList)//2 # 리스트 반으로 쪼개기 left = unsortedList[:mid] right = unsortedList[mid:] ...
SOHEELEE408/Algorithms
백준/Platinum/1517. 버블 소트/버블 소트.py
버블 소트.py
py
1,155
python
ko
code
0
github-code
90
41870473906
#!/usr/bin/env python # -*- coding: utf-8 -*- import des def encode(p,key): key1=key>>64 key2=key-(key1<<64) return des.encode(des.decode(des.encode(p,key1),key2),key1) def decode(p,key): key1=key>>64 key2=key-(key1<<64) return des.decode(des.encode(des.decode(p,key1),key2),key1) if __name__...
0xdaidai/crypto-homework
4/tri_des.py
tri_des.py
py
675
python
en
code
0
github-code
90
10415682516
import logging from fabric.api import env, task, require from neckbeard.actions.contrib_hooks import notifies_hipchat from neckbeard.environment_manager import Deployment REPAIR_START_MSG = ( '%(deployer)s <strong>Repairing</strong> ' '<em>%(deployment_name)s</em>' ) REPAIR_END_MSG = ( '%(deployer)s <str...
winhamwr/neckbeard
neckbeard/actions/repair.py
repair.py
py
1,307
python
en
code
34
github-code
90
18174080989
import math N, K = map(int, input().split()) A = list(map(float, input().split())) min_A = 0 max_A = 10**10 while( max_A - min_A > 1): now = (min_A + max_A) // 2 temp = 0 for i in A: if i > now: temp += (i // now) if temp > K: min_A = now else: max_A = now print(int(min_A) + 1)
Aasthaengg/IBMdataset
Python_codes/p02598/s100255065.py
s100255065.py
py
311
python
en
code
0
github-code
90
15650473472
import pyshark import sys from time import time from shutil import copyfileobj interface_name = "br-attack" capture = pyshark.LiveCapture(interface=interface_name) log_file = open("data/packet_log.csv", mode="r+") try: log_file.write("Source IP;Destination IP\n") for packet in capture.sniff_continuously(): ...
Sommerrolle/it-sicherheit-prakitkum
src/logger.py
logger.py
py
1,011
python
en
code
0
github-code
90
441477091
import math epsilon = float(input("epsilon: ")) x = float(input("x: ")) S = 2 n = 1 adder = epsilon+1 while adder > epsilon: adder = (((x-1)/(x+1)) ** (2*n-1)) / (2*n - 1) S += adder n += 1 print(math.log(x)) print(S)
AntalDima1/labwork
5/5_3.py
5_3.py
py
235
python
en
code
0
github-code
90
5705107770
import heapq class Solution(object): def kSmallestPairs(self, nums1, nums2, k): """ :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]] """ combine=[[x,y] for x in nums1 for y in nums2] return heapq.nsmallest(k,...
lll109512/LeetCode
heap/Find K Pairs with Smallest Sums.py
Find K Pairs with Smallest Sums.py
py
467
python
en
code
0
github-code
90
1188872227
#!/user/bin/env python # -*- coding:utf-8 -*- # Code created by teacher and modified by gongfuture # Create Time: 2023/3/3 # Create User: gongf # This file is a part of Homework_test_environment n = eval(input("请输入整数N:")) sum = 0 for i in range(n): sum += i + 1 print("1到N求和的结果:{}".format(sum))
gongfuture/Homework_test_environment
Python/作业3/成品/3.获得用户输入的一个整数N,计算并输出1到N相加的和.py
3.获得用户输入的一个整数N,计算并输出1到N相加的和.py
py
326
python
en
code
5
github-code
90
15235804667
import time DEFAULT_FMT = '[{elapsed:0.8f}s] {name}({args})->{result}' def clock(fmt=DEFAULT_FMT): def decorate(func): def clocked(*args, **kwargs): start_time = time.perf_counter() result = func(*args, **kwargs) end_time = time.perf_counter() elapsed = end...
ElvinKim/python_master
fluent_python/decorator_and_closure/clockdeco_with_param.py
clockdeco_with_param.py
py
1,021
python
en
code
2
github-code
90
21199669171
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def reverseKGroup(self, head: Optional[ListNode], k: int) -> Optional[ListNode]: if head == None or head.next == None: return head dummy = ListNode(0) dummy.n...
endermeihl/ender.github.io
leetcode2023/L25.py
L25.py
py
829
python
en
code
0
github-code
90
23045506821
''' 704. Binary Search Easy Given a sorted (in ascending order) integer array nums of n elements and a target value, write a function to search target in nums. If target exists, then return its index, otherwise return -1. Example 1: Input: nums = [-1,0,3,5,9,12], target = 9 Output: 4 Explanation: 9 exists in nums a...
aditya-doshatti/Leetcode
binary_search_704.py
binary_search_704.py
py
727
python
en
code
0
github-code
90
29092971061
#import resource import sys # Will segfault without this line. #resource.setrlimit(resource.RLIMIT_STACK, [0x10000000, resource.RLIM_INFINITY]) sys.setrecursionlimit(0x100000) def BronKerbosch(graph, node): #P is nodes in graph report = set() def BronKerboschHelper(r=set(),p=set(graph[node]+[node]),x=set()): if ...
AgentEnder/OpenKattis
PartialSolutions/Difficulty/5/SevenKingdoms/seven_kingdoms.py
seven_kingdoms.py
py
2,155
python
en
code
3
github-code
90
18650700488
def shortest_path_length(length_by_edge, startnode, goalnode): unvisited_nodes = MinHeap() # FibHeap containing (node, distance) pairs unvisited_nodes.insert(startnode, 0) visited_nodes = set() while len(unvisited_nodes) > 0: node, distance = unvisited_nodes.pop() if node is goalnode: ...
jkoppel/quixey_challenger
problems/python/shortest_path_length.py
shortest_path_length.py
py
1,257
python
en
code
4
github-code
90
36844321887
# coding=gbk import json import os import re import subprocess import sys import pymysql from multiprocessing import Queue, Process from pymongo import MongoClient def write(q, commit_list): for value in commit_list: q.put(value) def read(q): if q.qsize() > 0: value = q.get...
Silence-worker-02/Golang_Empirical_Analysis
generate_safe_range.py
generate_safe_range.py
py
4,024
python
en
code
0
github-code
90
25806595530
# read the file with open("input.txt", "r") as input_file: input = input_file.readlines() validcount = 0 invalidcount = 0 for line in input: entry = line.rstrip().split(' ') counts = entry[0].split("-") min_count = int(counts[0]) max_count = int(counts[1]) test_letter = entry[1][0] i...
blewa/advent2020
day2/p1.py
p1.py
py
546
python
en
code
0
github-code
90
18072891259
class Combination: """ SIZEが10^6程度以下の二項係数を何回も呼び出したいときに使う 使い方: comb = Combination(SIZE, MOD) comb(10, 3) => 120 """ def __init__(self, N, MOD=10 ** 9 + 7): self.MOD = MOD self.fact, self.inv = self._make_factorial_list(N) def __call__(self, n, k): if k < 0 or k >...
Aasthaengg/IBMdataset
Python_codes/p04046/s887423083.py
s887423083.py
py
1,306
python
en
code
0
github-code
90
24889232898
import os import time from youtube_dl import YoutubeDL from yt_concate.pipeline.steps.step import Step from yt_concate.pipeline.steps.step import StepException class DownloadCaptions(Step): def process(self, data, inputs, utils): start = time.time() for url in data: print('downloadi...
sing0510/yt-concate
yt_concate/pipeline/steps/download_caption.py
download_caption.py
py
1,155
python
en
code
0
github-code
90
5284800731
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 24 11:33:21 2019 @author: toukir """ import mysql.connector import csv import pandas as pd def mydb(): return mysql.connector.connect(host="10.10.10.209", \ user="appropolis", \ passwd="appropolis123", \ ...
TonyJZ/AppAI
exploration/src/appai_lib/my_io.py
my_io.py
py
2,262
python
en
code
0
github-code
90
72140233257
#!/usr/bin/env python3 # # done: March, 31th 2020 # # Given 3 integers a ,b ,c, return the largest number obtained # after inserting the following operators and brackets: +, *, () # In other words , try every combination of a,b,c with [*+()] , # and return the Maximum Obtained #EXAMPLE # With the numbers are 1, 2 an...
rebrnje/codewars-katas
8kyu/expressions_matter.py
expressions_matter.py
py
1,344
python
en
code
0
github-code
90
36848101179
""" Support functions for the 'lite" version of LMR driver for Python2. Originator: Greg Hakim University of Washington 26 February 2018 Modifications: 20 April 2018: new routine prior_regrid for regridding prior (GJH) 21 March 2018: mod get_valid_proxes to accept proxy indices for filtering (rather than use all) (G...
modons/LMR
LMR_lite_utils.py
LMR_lite_utils.py
py
42,791
python
en
code
23
github-code
90
33116304532
""" Ejercico 1 """ from io import open nombre_texto = open("E:/CURSO PYTHON MARZO/nombre.txt", "w") frase = "Geovanny \n Elsa \n Alejandro \n Mafer \n Elizabeth " nombre_texto.write(frase) nombre_texto.close() archivo_texto = open("E:/CURSO PYTHON MARZO/archivo.txt", "r") texto = archivo_texto.readlines() arc...
Steven191919/CURSO-PYTHON-MARZO
Fichero/ejercicio.py
ejercicio.py
py
352
python
es
code
0
github-code
90
27746733661
# Netwrok Mapping Nmap Python Code. import nmap # Prompt user for subnet to scan subnet = input("Enter subnet to scan: ") # Create a new nmap scanner object nm = nmap.PortScanner() # Perform network mapping scan on the specified subnet nm.scan(hosts=subnet, arguments='-sn') # Print out the list of hosts that wer...
NavkarShah1137/IS-IA1-Navkar-Saksham-Aayush
NetworkMapping.py
NetworkMapping.py
py
419
python
en
code
0
github-code
90
155869110
import utils import os import unittest TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) utils.set_search_paths(TOPDIR) import ihm.protocol class Tests(unittest.TestCase): def test_step(self): """Test protocol Step class""" s = ihm.protocol.Step(assembly='foo', dataset_grou...
ihmwg/python-ihm
test/test_protocol.py
test_protocol.py
py
1,342
python
en
code
14
github-code
90
71794947177
# -*- coding: utf-8 -*- import scrapy from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from mysina.items import MysinaItem class Sina1Spider(CrawlSpider): name = 'sina1' allowed_domains = ['sina.com.cn'] start_urls = ['http://sina.com.cn/'] rules = ( ...
LIMr1209/Internet-worm
day10/my/mysina/mysina/spiders/sina1.py
sina1.py
py
1,180
python
en
code
0
github-code
90
33876799966
"""Faça um programa usando vetores que armazene o código, o nome e o telefone de 100 pessoas. O programa deve permitir que o usuário faça uma consulta dos dados de uma pessoa a partir de seu código. Esta consulta pode ser repetida se o usuário desejar, caso contrário, o programa deve ser encerrado.""" codigos =...
iMatheusouza/Pyquest
Pyquest5/pyquest5 quest3 - CLARA.py
pyquest5 quest3 - CLARA.py
py
1,157
python
pt
code
0
github-code
90
44147897692
import numpy as np #Funciones #--- Conversión a años romanos con digitos y agregar el BC o AC según corresponda el año en el rango --- def romanonumero (year): era = "" roman = 0 if year < 0: era = "BC" roman = 754 + year else: era = "AC" roman = 753 + year return (roman, era) #--- Conversión de años r...
MauGiles/LogicTests
Ejercicio2.py
Ejercicio2.py
py
3,003
python
es
code
0
github-code
90
17594808320
from django.contrib import admin from django.db.models import Count from django.db.transaction import atomic from modeltranslation.admin import TranslationAdmin from crawler.admin import CardSetAliasInline from crawler.models import CardSetAlias from crawler.spiders.products import ProductsInfoSpider from oracle impor...
satyrius/mtgforge
backend/oracle/admin/card_set.py
card_set.py
py
3,431
python
en
code
0
github-code
90
7188467840
# -*- coding: utf-8 -*- import scrapy, logging """ https://www.klimaundenergiemodellregionen.at/modellregionen/liste-der-regionen/ """ class GetcontactsSpider(scrapy.Spider): name = 'getcontacts' allowed_domains = ['www.klimaundenergiemodellregionen.at'] start_urls = ['https://www.klimaundenergiemodellre...
MaxValue/KEM-Contacts
kem/kem/spiders/getcontacts.py
getcontacts.py
py
9,592
python
en
code
1
github-code
90
18557938609
a,b = input().split() count = 0 anum = int(a) bnum = int(b) # a = list(a) # b = list(b) for i in range(anum,bnum+1): stra = str(i) if stra == stra[::-1]: count += 1 print(count)
Aasthaengg/IBMdataset
Python_codes/p03416/s763764224.py
s763764224.py
py
215
python
en
code
0
github-code
90
3273221260
#!/usr/bin/env python3 # Imports import os import time from pwd import getpwnam # Camera basedir camera_dir = '/media/large/camera' # Get the uid/gid for user pi pi_uid = getpwnam('pi').pw_uid pi_gid = getpwnam('pi').pw_gid # Add a folder '''Class that contains the number of days to keep each folder''' class Folder...
mythvolta/pi
motion_cleanup.py
motion_cleanup.py
py
1,374
python
en
code
0
github-code
90
33737909808
import pandas as pd import os from airflow_project.project_settings import BASE_PATH import datetime import logging logger = logging.getLogger(__name__) def create_path(folder): """ Create folders to save arquives. """ arquive_folder = os.path.join(BASE_PATH, 'arquives') path_create = os.path.joi...
JuanCarvalho/airflow-curso-alura
airflow_project/common_lib/path_lib.py
path_lib.py
py
1,341
python
en
code
0
github-code
90
17984250379
import sys input = sys.stdin.readline enum = enumerate import collections import random def linput(ty=int, cvt=list): return cvt(map(ty,input().split())) def gcd(a: int, b: int): while b: a, b = b, a%b return a def lcm(a: int, b: int): return a * b // gcd(a, b) def dist(x1,y1,x2,y2): return abs(x1-x2)+abs(y1-...
Aasthaengg/IBMdataset
Python_codes/p03687/s030328598.py
s030328598.py
py
930
python
en
code
0
github-code
90
70510587497
import sys import argparse import logging import traceback from cexp.driving_batch import DrivingBatch from cexp.agents import NPCAgent from agents.navigation.basic_agent import BasicAgent def collect_data_loop(renv, agent, draw_pedestrians=True): # The first step is to set sensors that are going to be produce...
yixiao1/Action-Based-Representation-Learning
carl/cexp/testing/film_pedestrians.py
film_pedestrians.py
py
4,397
python
en
code
13
github-code
90
11428564205
# https://www.w3schools.com/html/ # 좌측 목록 다수 별도의 스크롤 import time from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains browser = webdriver.Chrome("./chromedriver_92.exe") browser.maximize_window() browser.get('https://www.w3schools.com/html/') time.sleep(3) # /...
sc2bat/rpa_web
9_scroll_nested.py
9_scroll_nested.py
py
793
python
en
code
0
github-code
90
18574985139
N = int(input()) TXY = [list(map(int, input().split())) for _ in range(N)] pre_t, pre_x, pre_y = 0, 0, 0 for t, x, y in TXY: diff_t = t - pre_t diff_pos = abs(x-pre_x) + abs(y-pre_y) if diff_t < diff_pos or (diff_t-diff_pos) % 2 == 1: print('No') exit() else: pre_t, pre_x, pre_y = t, x, y print('Y...
Aasthaengg/IBMdataset
Python_codes/p03457/s906551144.py
s906551144.py
py
324
python
en
code
0
github-code
90
4344912040
import tensorflow as tf from u_net import U_Net from preprocessing import process_data import numpy as np import random import time import os from matplotlib import pyplot as plt class Model(tf.keras.Model): def __init__(self): super(Model, self).__init__() # low learning rate to comp...
Jeremy-Lutz/Low-Light-Image-Enhancement
main.py
main.py
py
5,274
python
en
code
0
github-code
90
37867724241
#!/usr/bin/python from math_methods import * from pulse_data import * def pulse_analysis(data_raw): del data_raw[0] x = [] for i in range(len(data_raw)): x.append(float(data_raw[i])) data_th = 1000.0 x_clean = [] for i in range(len(x)): if x[i] > data_th: x_clea...
oakleyKatt/ArduinoPulseMonitor
final-pulse-monitor/temp_pulse_analysis.py
temp_pulse_analysis.py
py
632
python
en
code
0
github-code
90
70193376616
import gc import sys import weakref import unittest import platform # pygobject from gi.repository import GObject try: from gi.repository import Gtk from pygtkcompat.generictreemodel import GenericTreeModel from pygtkcompat.generictreemodel import _get_user_data_as_pyobject has_gtk = True except Impor...
GNOME/pygobject
tests/test_generictreemodel.py
test_generictreemodel.py
py
13,986
python
en
code
144
github-code
90
18216932689
N = int(input()) Up = [] Down = [] for _ in range(N): S = input() L = [0] mi = 0 now = 0 for __ in range(len(S)): if S[__] == '(': now += 1 else: now -= 1 mi = min(mi, now) if now > 0: Up.append((mi, now)) else: Down.append(...
Aasthaengg/IBMdataset
Python_codes/p02686/s205702766.py
s205702766.py
py
638
python
en
code
0
github-code
90
18403026889
def comb(n, k, mod=10**9+7): num = den = 1 for i in range(k): num = num * (n-i) % mod den = den * (i+1) % mod return num * pow(den, mod-2, mod) % mod N, M, K = map(int, input().split()) mod = 10**9 + 7 ans = 0 for i in range(N): for j in range(M): ans += (i+1)*j*(j+1)//2 + i*(M-...
Aasthaengg/IBMdataset
Python_codes/p03039/s824748076.py
s824748076.py
py
415
python
en
code
0
github-code
90
18046588439
def main(): n, t, *a = map(int, open(0).read().split()) b = 0 c = float("Inf") ans = 1 for i in range(n): x = a[i] ans = 1 if x - c > b else ans + int(x - c == b) b = max(b, x - c) c = min(c, x) print(ans) if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p03946/s290551028.py
s290551028.py
py
303
python
en
code
0
github-code
90
34949068935
#!/usr/bin/python3 import json import numpy as np import pandas import pylab from sklearn.utils import shuffle from keras.models import load_model from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array from keras.models import Sequential,Model from keras.layers.core import Dense, Activati...
frk2/behavioral-cloning
model.py
model.py
py
7,215
python
en
code
0
github-code
90
25308560857
import socket from time import sleep import memcache # The 500MB value will go in slab 40, which stores chunks of size up # to 616944KB and can store 1 chunk per page. # 64 sets with unique keys will fill up the cache. # The 100MB value will go in slab 32, which stores chunks of size up # to 103496KB and can store 1...
tdpreece/memcached_knowledge
automove_example.py
automove_example.py
py
4,522
python
en
code
0
github-code
90
10490230332
from .meta import Input from formful import widgets from markupsafe import Markup class Select(widgets.Select): def __call__(self, field, **kwargs): kwargs.setdefault("id", field.id) if self.multiple: kwargs["multiple"] = True flags = getattr(field, "flags", {}) for k ...
HorsemanWSGI/formful-bootstrap
src/formful_bootstrap/select.py
select.py
py
1,555
python
en
code
0
github-code
90
26969479837
import os import sys import datetime import logging import subprocess import locale from tempfile import mkdtemp from shutil import rmtree from git import Repo logger = logging.getLogger() class LocalBuild(object): """ Class to handle running a local build and updating the BuildInfo object with the resu...
jantman/rebuildbot
rebuildbot/local_build.py
local_build.py
py
6,047
python
en
code
0
github-code
90
28010447890
# coding: utf-8 import re from django.contrib.sitemaps import Sitemap from django.utils.encoding import smart_unicode, force_unicode from django.core import urlresolvers, paginator from dynamic_pages.models import Page from django.core.cache import get_cache class Siteurls(object): def get_urls(self, patt...
matllubos/django-dynamicpages
dynamic_pages/sitemap/__init__.py
__init__.py
py
2,422
python
en
code
3
github-code
90
4424283028
# # trigger_word_detection.py # # Keras deep learning model designed to detect a specific # tigger word in a live audio stream. Model is designed to # take in a 10 second spectrograph and output predictions # of which timesteps immediately floow a trigger word. # This model is then adapted for use with a live audio # ...
ArthurlotLi/kotakee_companion
trigger_word_detection/trigger_word_detection.py
trigger_word_detection.py
py
30,708
python
en
code
2
github-code
90
8848881180
add_library("minim") from buttons import button from mode2 import songFunctions from visuals import star import random import time song = None class setUps(): def start(self): global starterBg starterBg = loadImage("pastel.jpg") global f f = loadFont("Trebuchet-BoldItalic-100.vlw"...
akalkar15/15-112-Term-Project
allSetups.py
allSetups.py
py
3,102
python
en
code
0
github-code
90
71327927658
from django_celery_beat.models import PeriodicTask from rest_framework import mixins from rest_framework.decorators import action from rest_framework.response import Response from applications.task.filters import VarTableFilter, TaskFilter from applications.task.models import Task, VarTable from applications.task.seri...
xhongc/streamflow
applications/task/views.py
views.py
py
4,292
python
en
code
81
github-code
90
40581724496
""" 459. Repeated Substring Pattern Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase English letters only and its length will not exceed 10000. Example 1: Input: "abab"...
venkatsvpr/Problems_Solved
LC_Repeated_Substring_Pattern.py
LC_Repeated_Substring_Pattern.py
py
1,266
python
en
code
3
github-code
90
27693183984
class Solution: def __init__(self, change, coins): self.change = change self.coins = coins self.look_up_table = [0] * (change + 1) def returnMinimum(self, change): minimum_coins = change if change in self.coins: return 1 elif self.look_up_table[ch...
xyzacademic/LeetCode
Practice/CoinChange.py
CoinChange.py
py
887
python
en
code
0
github-code
90
18325729739
n = int(input()) cnt = 0 for i in range(1, 10): if len(str(n//i)) == 1 and n%i == 0: cnt +=1 if cnt >= 1: print('Yes') else : print('No')
Aasthaengg/IBMdataset
Python_codes/p02880/s047773393.py
s047773393.py
py
160
python
en
code
0
github-code
90
72211385258
# PyPy3 제출 import heapq # 도시의 개수(노드의 개수) n = int(input()) # 버스의 개수(간선의 개수) m = int(input()) # 버스 정보(그래프) graph = [[] for _ in range(n+1)] for i in range(m): # 출발 도시, 도착 도시, 버스 비용 a, b, c = map(int, input().split()) graph[a].append([b, c]) # 시작 도시, 도착 도시 start, end = map(int, input().split()) ...
khyup0629/Algorithm
다익스트라 최단 경로/최소비용 구하기.py
최소비용 구하기.py
py
2,683
python
ko
code
3
github-code
90
31650929793
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters import logging from Interfaces import inter import tkinter as tk import os root = tk.Tk() app = inter.Application(master=root) token = os.environ.get("cortex_tg") logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)...
TuHechiceroFavorito/cortex
tests/tg.py
tg.py
py
1,611
python
en
code
0
github-code
90
39731296988
#Author Kaihao Zhao 09/21/2016 # Read data file with open("breast_cancer.data") as data_file: data = [ map(float, line.split()) for line in data_file ] # Read whole Label file with open("breast_cancer.labels") as label_file: labels = { int(i.split()[1]) : int(i.split()[0]) for i in label_file } # Read Training La...
mcgG/Machine-Learning
Navie-Bayes/Navie-Bayes-Cancer.py
Navie-Bayes-Cancer.py
py
2,127
python
en
code
0
github-code
90
34443935200
from collections import deque s = list(input()) s2 = deque(list(reversed(s))) s = deque(s) Q = int(input()) q = [] f = [] c = [] count = 0 for _ in range(Q): tmp = list(map(str,input().split())) if len(tmp) == 1: count += 1 q.append(int(tmp[0])) f.append(0) c.append('') els...
Hoshino0116/Programs
AtCoderBeginnerContest158-D.py
AtCoderBeginnerContest158-D.py
py
725
python
en
code
0
github-code
90
15091706743
from datetime import datetime from flask import render_template, request, flash, \ redirect, url_for, Markup from app import db from app.main import main from app.main.forms import URLForm, EditURLForm from app.models import Url @main.route("/", methods=["GET", "POST"]) def index(): urls = Url.query.all() ...
vdranyy/flask-url-shortener
app/main/views.py
views.py
py
2,077
python
en
code
0
github-code
90
21285041696
import cv2 import os current_path = os.path.abspath(__file__) path = os.path.abspath(os.path.dirname(current_path) + os.path.sep + ".") path_in = os.path.join(path, 'lena.jpg') path_out = os.path.join(path, 'output.jpg') img = cv2.imread(path_in) flip = cv2.flip(img, 0) #3个参数控制翻转,1:水平翻转,0:垂直翻转,-1:水平垂直翻转 cv2.imwrite(...
CNFranc11s/Useful_Python
PicFilp_Demo/pic_Filp_Demo.py
pic_Filp_Demo.py
py
385
python
en
code
0
github-code
90
18564773899
n = int(input()) arr = list(map(int, input().split())) alice = 0 bob = 0 chance = "A" for _ in range(len(arr)): i = max(arr) if chance == "A": alice += i chance = "B" else: bob += i chance = "A" indx = arr.index(i) del arr[indx] print(alice - bob)
Aasthaengg/IBMdataset
Python_codes/p03434/s249107047.py
s249107047.py
py
260
python
en
code
0
github-code
90
37421961731
import os import numpy as np import pandas as pd from src.utils import random_day_offset, outlier_removal # Load raw data df = pd.read_csv("data/raw/kc_house_data.csv") # Drop duplicates df = df.drop_duplicates(subset=["id"], keep="first") # Create an artificial "listed" date to help mimic production scenario np.ra...
cloudera/CML_AMP_Continuous_Model_Monitoring
scripts/prepare_data.py
prepare_data.py
py
1,412
python
en
code
8
github-code
90
23046101311
''' 1048. Longest String Chain Medium Given a list of words, each word consists of English lowercase letters. Let's say word1 is a predecessor of word2 if and only if we can add exactly one letter anywhere in word1 to make it equal to word2. For example, "abc" is a predecessor of "abac". A word chain is a sequence o...
aditya-doshatti/Leetcode
longest_string_chain_1048.py
longest_string_chain_1048.py
py
1,217
python
en
code
0
github-code
90
36219362107
# 2468 : 안전 영역 import sys from collections import deque input = sys.stdin.readline N = int(input()) graph = [list(map(int, input().split())) for _ in range(N)] height = set(sum(graph, [])) result = 1 def bfs(x, y, rain): q = deque() q.append((x, y)) visited[x][y] = True while q: x, y = q.p...
yuhalog/algorithm
BOJ/DFS・BFS/2468.py
2468.py
py
901
python
en
code
0
github-code
90