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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
35885471303 | """
This script ensures that the specefied network devices are operating as desired.
This includes:
* Are up and configured via NMCLI
* Are using manual IP addresses
* Are using an MTU of 9000
* Finally, that the DHCP Server is running on these adapters
Background: For an unknown reason on the FOPS machine, the 10GBi... | PlantandFoodResearch/machine-vision-acquisition | src/utils/nmcli-dhcp-manager.py | nmcli-dhcp-manager.py | py | 6,720 | python | en | code | 4 | github-code | 90 |
17616094138 | import datetime
import json
import re
import os
from io import BytesIO
from git import Repo, Git
import requests
import subprocess
import tempfile
import uuid
import bson
import zipfile
import base64
import shutil
from bson.binary import Binary
from pathlib import Path
from dotted_dict import DottedDict
from subprocess... | grmono/openapi-ui | app/celery_task/generate_tasks.py | generate_tasks.py | py | 6,621 | python | en | code | 4 | github-code | 90 |
38906526920 | from lc import *
class Solution:
def originalDigits(self, s: str) -> str:
res = ""
res += "0"*s.count('z')
res += "1"*(s.count('o')-s.count('z')-s.count('w')-s.count('u'))
res += "2"*s.count('w')
res += "3"*(s.count('h') - s.count('g'))
res += "4"*s.count('u')
... | joric/oneliners | leetcode/reconstruct-original-digits-from-english.py | reconstruct-original-digits-from-english.py | py | 1,293 | python | en | code | 23 | github-code | 90 |
26407541373 | import requests
from time import sleep
# takes server list outputs locations (each only once) the servers are in.
def get_unique_locations(list_of_servers):
unique_locations = []
resolved_locations = []
for aServer in list_of_servers:
latLongDic = {"lat": aServer["location"]["lat"], "long": aServe... | elanozturk/openpyn-nordvpn | openpyn/locations.py | locations.py | py | 2,190 | python | en | code | null | github-code | 90 |
36842242517 | import unittest
import time
from sources.web.national_archives import NationalArchivesScraper
from sources.web.history_net import HistoryNetScraper
from sources.web.bbc import BBCScraper
from sources.web.google_scholar import GoogleScholarScraper
from sources.web.reuters import ReutersScraper
from sources.web.nature im... | silasnevstad/verifi | sources/web/web_tests.py | web_tests.py | py | 3,162 | python | en | code | 0 | github-code | 90 |
74085720617 | from .daily_dialog import load_daily_dialog
from .curiosity_dialogs import load_curiosity_dialogs
from .multiwoz_v22 import load_multiwoz_v22
from .metawoz import load_metawoz
from .taskmaster import load_taskmaster1, load_taskmaster2, load_taskmaster3
def load_multiple_datasets(datasets, split):
dsets = []
f... | ErikEkstedt/datasets_turntaking | datasets_turntaking/dataset/conversational/utils.py | utils.py | py | 944 | python | en | code | 7 | github-code | 90 |
12187897404 | import os
import pickle
import random
import re
class model:
right_words = {}
word_pattern = r'[\w]+[.,...?!;:]{0,3}'
def fit(self, directory, model):
if directory == None:
text = input("Введите текст: ")
else:
text = ""
files = os.listdir(directory)
... | PKovyrzin/text-generator | train.py | train.py | py | 1,792 | python | en | code | 0 | github-code | 90 |
7613256658 | from django.urls import path
from .views import UserListView,UserDetailView,UserCreateView,VerifyEmail,UserUpdateView, CreateBlog,BlogDetailView,BlogListView,EditBLog
# ,BlogCreateView
urlpatterns=[
path('User',UserListView.as_view()),
path('User/<email>',UserDetailView.as_view()),
path('create/account... | ThetEstinGsalt/RavenScribe | Backend/Publishing_Fetching/api/urls.py | urls.py | py | 805 | python | en | code | 1 | github-code | 90 |
44554676957 | """
Lowest Common Ancestor of Binary Search Tree
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.
According to the definition of LCA on Wikipedia:
“The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as desc... | kpham841/LeetCode_Python | Tree/Lowest_Common_Ancestor_BST.py | Lowest_Common_Ancestor_BST.py | py | 1,760 | python | en | code | 0 | github-code | 90 |
37361272561 | from fractions import Fraction
from typing import List
import concurrent.futures
import time
"""
cuncurrent features
parallelized only LU matrices inversion
23.0 secs on d-500
"""
class Matrix:
def __init__(self, matrix:List[List[int|float]]) -> None:
self.input_matrix = matrix
self.size = len(ma... | SosnoviyBor/CourseWerk-y3-s2 | algorithms/failures/gauss/1_cf_onlyLU.py | 1_cf_onlyLU.py | py | 4,232 | python | en | code | 0 | github-code | 90 |
31972061921 | ITEM_NAME_COLUMN = 0
QUANTITY_COLUMN = 1
# This function, reads a text file and returns a list of dictionaries
def load_orders(path):
orders = []
# Open the file as read only
with open(path, 'r') as order_file:
# Read each line
for line in order_file.readlines():
# Split by... | davidl0673/pythonstuff | order_cli/orders.py | orders.py | py | 1,162 | python | en | code | 0 | github-code | 90 |
37436729671 | #!/usr/bin/env python
from PyQt4 import QtCore, QtGui
import time, re, hashlib, datetime
from urllib.request import urlopen, urlretrieve
from bs4 import BeautifulSoup
class FetchThread(QtCore.QThread):
signal = QtCore.pyqtSignal(list)
def __init__(self):
QtCore.QThread.__init__(self)
self.v... | fukuta0614/xxx | fc2/fc2_downloader_gui.py | fc2_downloader_gui.py | py | 7,128 | python | en | code | 0 | github-code | 90 |
5543734592 | #덩치
N = int(input())
frames = []
for i in range(1,N+1):
a,b = map(int,input().split())
frames.append([a,b])
for i in range(len(frames)):
score = 1
for j in range(len(frames)):
if(i != j and frames[i][0]<frames[j][0] and frames[i][1]<frames[j][1]):
score += 1
print(score, end=" ... | SteadyKim/Algorism | language_PYTHON/BJ7568.py | BJ7568.py | py | 357 | python | en | code | 0 | github-code | 90 |
25010191286 | import pandas as pd
import requests
from dotenv import dotenv_values
from sqlalchemy import create_engine
import mysql.connector
env_variables = dotenv_values()
DB_PASSWORD = env_variables.get('DB_PASSWORD')
engine = create_engine(f"mysql+mysqlconnector://root:{DB_PASSWORD}@localhost:3306/nyt")
warehouse_engi... | danishminhas1/articles_etl_pipeline | Articles_ETL_Pipeline/warehouse.py | warehouse.py | py | 3,595 | python | en | code | 0 | github-code | 90 |
36219305617 | # 10026 : 적록색약
import sys
from collections import deque
n = int(sys.stdin.readline())
graph = [list(sys.stdin.readline().rstrip()) for _ in range(n)]
visited = [[0 for _ in range(n)] for _ in range(n)]
d = [(1, 0), (-1, 0), (0, 1), (0, -1)]
q = deque()
normal = 0
weakness = 0
def bfs(x, y):
visited[x][y] = 1
... | yuhalog/algorithm | BOJ/DFS・BFS/10026.py | 10026.py | py | 1,296 | python | en | code | 0 | github-code | 90 |
37173811834 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.management import call_command
from django.db import models, migrations
def load_groups_fixture(apps, schema_editor):
call_command('loaddata', 'groups_initial_data', app_label='recipes')
def load_users_fixture(apps, schema_editor):... | nessa/serenity | amuseapi/recipes/migrations/0004_auto_20160720_1252.py | 0004_auto_20160720_1252.py | py | 1,004 | python | en | code | 0 | github-code | 90 |
3067863976 | import requests
from .. import tbot
from telethon import Button, events
@tbot.on(events.NewMessage(pattern="[/!]anime"))
async def _(e):
f = requests.get('https://anime-news-api-production-5b50.up.railway.app/').json()
y = f['image']
z = f['post_url']
lol = f['title']
ok = f['info']
msg = (f'**Titl... | TAMILVIP007/anime-news | anime/plugins/anime.py | anime.py | py | 440 | python | en | code | 0 | github-code | 90 |
18539773039 | n = int(input())
nmax = 55556
prime = [True]*nmax
prime[0] = prime[1] = False
for i in range(2, int(nmax**0.5)+1):
if not prime[i]: continue
for j in range(2*i, nmax, i):
prime[j] = False
arr = []
for i in range(2, nmax):
if not prime[i]: continue
if i%10 == 3:
arr.append(i)
if len(arr) == n: brea... | Aasthaengg/IBMdataset | Python_codes/p03362/s323872639.py | s323872639.py | py | 343 | python | en | code | 0 | github-code | 90 |
18020223749 | n, m = map(int,input().split())
A = [[] for _ in range(n)]
for i in range(n):
A[i] = input()
B = [[] for _ in range(m)]
for i in range(m):
B[i] = input()
flag = False
for tate_begin in range(n-m+1):
for yoko_begin in range(len(A[0])-len(B[0])+1):
for check in range(m):
a_yoko = A[ta... | Aasthaengg/IBMdataset | Python_codes/p03804/s586428216.py | s586428216.py | py | 537 | python | en | code | 0 | github-code | 90 |
24342137855 | import numpy as np
import pickle
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from get_parameters import *
############################################
####Initialization of Parameters############
############################################
l=32
lattice_shape=(l,l)
nsamples=1000
index_set=ran... | japneet644/Random-codes | extracting_graphs.py | extracting_graphs.py | py | 1,993 | python | en | code | 0 | github-code | 90 |
18589080739 | import sys
n=int(input())
a = list(map(int,input().split()))
b=0
while(True):
for i in range(n):
if(a[i]%2!=0):
print(b)
sys.exit()
a[i]=a[i]//2
b+=1
print(b) | Aasthaengg/IBMdataset | Python_codes/p03494/s413446503.py | s413446503.py | py | 182 | python | en | code | 0 | github-code | 90 |
38616041810 | from .base_options import BaseOptions
from datetime import datetime
class InferOptions(BaseOptions):
"""This class includes inference options.
It also includes shared options defined in BaseOptions.
"""
def initialize(self, parser):
parser = BaseOptions.initialize(self, parser) # define sha... | bennyguo/sketch2model | options/infer_options.py | infer_options.py | py | 983 | python | en | code | 47 | github-code | 90 |
18588731039 | s = input()
x,y = map(int,input().split())
move = [0]
for si in s:
if(si == 'F'):
move[-1] += 1
else:
move.append(0)
move_x = move[2::2]
move_y = move[1::2]
for a,move_a in zip([x-move[0],y],[move_x,move_y]):
m_max = sum(move_a)
if(m_max < abs(a)):
print('No')
exit()
... | Aasthaengg/IBMdataset | Python_codes/p03488/s936757886.py | s936757886.py | py | 496 | python | en | code | 0 | github-code | 90 |
17687715458 | # 4. Реализуйте базовый класс Car. У данного класса должны быть следующие атрибуты: speed, color, name,
# is_police (булево). А также методы: go, stop, turn(direction), которые должны сообщать, что машина поехала,
# остановилась, повернула (куда). Опишите несколько дочерних классов: TownCar, SportCar, WorkCar, PoliceCa... | Xuhen17/Python_Basic | lesson6/less6_task4.py | less6_task4.py | py | 3,812 | python | ru | code | 0 | github-code | 90 |
35524029383 | import geometry
import pygame
from vector2 import Vector2, UP, DOWN, LEFT, RIGHT
from vector2 import ZERO as ZERO_VECTOR
from bindable_event import BindableEvent
from input_handler import InputHandler
from geometry import Ray_Result
GRAVITY = Vector2(0, 100)
class InteractiveRectangle(geometry.Rectangle):
def __i... | PhantomShift/pygame-platformer | src/game_objects.py | game_objects.py | py | 5,272 | python | en | code | 1 | github-code | 90 |
29260294521 | class Solution(object):
def integerBreak(self, n):
dp = [0]*(n+1)
for i in range(2,n+1):
#从j处拆分
for j in range(i):
dp[i] = max(dp[i],j*(i-j),j*dp[i-j])
return dp[n]
print(list(range(-1,-5,-1)))
print(list(range(-5,-1))) | johnkle/FunProgramming | Leetcode/动态规划/343整数拆分.py | 343整数拆分.py | py | 296 | python | en | code | 0 | github-code | 90 |
42278799770 | ''' Problem Statement : Insertion sort in a Linked list
Algorithm: 1) Create an empty sorted (or result) list
2) Traverse the given list, do following for every node.
a) Insert current node in sorted way in sorted or result list.
3) Change head of given linked list to head of sort... | manvi0308/100DaysOfAlgo | Day 22/InsertionSortInLinkedList.py | InsertionSortInLinkedList.py | py | 2,504 | python | en | code | 33 | github-code | 90 |
25742985094 | from f_utils import u_tester
from algo.ucs import UCS
from algo.astar import AStar
from model.point import Point
from model.grid_blocks import GridBlocks
class TestUCS:
def __init__(self):
u_tester.print_start(__file__)
self.__tester_optimal_path()
self.__tester_expanded_nodes()
u... | valdas1966/kg | algo/testers/t_ucs.py | t_ucs.py | py | 1,274 | python | en | code | 0 | github-code | 90 |
35585294135 | import re
def uncollapse(digits):
b = []
temper = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
while len(digits) != 0:
for i in temper:
if re.match(i, digits):
b.append(i)
digits = re.sub(i, '', digits, 1)
return ' ... | atebelskis/CodeWars-tasks | CD_7.py | CD_7.py | py | 1,667 | python | en | code | 0 | github-code | 90 |
70858527978 | #!/usr/bin/python
from datetime import datetime, date, timedelta
class Student:
def __init__(self, sid, name, address, birthday):
self.id = sid
self.name = name
self.address = address
self.birthday = birthday
self.datetime_birthday = datetime.strptime(birthday, "%d-%m-%Y")
... | vampy/university | individual-project/lab-src/code/student.py | student.py | py | 1,189 | python | en | code | 4 | github-code | 90 |
15536541369 | class Node:
def __init__(self, value = None):
self.data = value
self.nextNode = None
class Stack:
def __init__(self):
self.head = None
self.listSize = 0
def push(self, value):
newNode = Node(value)
newNode.nextNode = self.head
self.h... | ravi-prakash1907/Problem-Solving-with-Python | notes/sem2/LL_Stack.py | LL_Stack.py | py | 1,213 | python | en | code | 0 | github-code | 90 |
18450448899 | N,K=map(int,input().split())
A=list(map(int,input().split()))
One=[0]*40
OneK=format(K, '040b')
flg=True
for i in range(40):
for j in range(N):
if A[j]==0:
continue
flg=False
One[39-i]+=A[j]&1
A[j]=A[j]>>1
if flg:
break
flg=True
ans=0
i=0
while i<40:
if OneK[i]=='1':
break
ans+=p... | Aasthaengg/IBMdataset | Python_codes/p03138/s568974552.py | s568974552.py | py | 576 | python | en | code | 0 | github-code | 90 |
18323905919 | n = int(input())
D = list(map(int, input().split()))
MOD = 998244353
cnt = [0] * n
for d in D:
cnt[d] += 1
if D[0] == 0 and cnt[0] == 1:
res = 1
else:
res = 0
for i in range(1, n):
res *= pow(cnt[i - 1], cnt[i], MOD)
res %= MOD
print(res) | Aasthaengg/IBMdataset | Python_codes/p02866/s810724902.py | s810724902.py | py | 262 | python | en | code | 0 | github-code | 90 |
38235035592 | # just look for duplicate section of 16 bytes
with open('08.txt', 'rb') as f:
ciphertexts = f.readlines()
ciphertexts = [line.strip() for line in ciphertexts]
for ciphertext in ciphertexts:
blocks = []
for i in range(0, len(ciphertext), 32):
blocks.append(ciphertext[i:i+32])
for i in rang... | prasantadh/cryptopals | challenge08.py | challenge08.py | py | 562 | python | en | code | 0 | github-code | 90 |
17438158780 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os.path
import tensorflow as tf
from moonlight.image import decode_music_score_png
from moonlight.staves import staffline_distance
class StafflineDistanceTest(tf.test.TestCase):
def testCorpusImag... | tensorflow/moonlight | moonlight/staves/staffline_distance_test.py | staffline_distance_test.py | py | 1,994 | python | en | code | 321 | github-code | 90 |
25252678642 | import os
import re
FULLPRINT = False
COMPACTPRINT = False
BETTERPRINT = True
def extract_number(text):
# Regular expression pattern to match the number
pattern = r":\s*([-+]?\d*\.\d+|\d+)"
# Search for the pattern in the input text
match = re.search(pattern, text)
if match:
numb... | EMJzero/COaT_Project | get_vivado_results.py | get_vivado_results.py | py | 4,577 | python | en | code | 0 | github-code | 90 |
36678354113 | import json
import os.path
from apiclient import errors
from oauth2client.client import AccessTokenCredentialsError
from django.conf import settings
from django.db.models import F
from django.shortcuts import get_object_or_404, redirect
from django.http import (
HttpResponse, HttpResponseBadRequest, HttpResponseS... | universalcore/unicore-mc | unicoremc/views.py | views.py | py | 12,876 | python | en | code | 0 | github-code | 90 |
34343582220 | """This module contains inclusion (subsethood) measures for type-1 sets."""
from decimal import Decimal
from .. import global_settings as gs
def szmidt_pacprzyk(fs):
"""Calculate the ratio between the upper & lower membership functions."""
ent1 = 0
ent2 = 0
for x in gs.get_x_points():
l, u =... | arthurcaio92/pyT2FTS | fuzzycreator/measures/entropy_it2.py | entropy_it2.py | py | 755 | python | en | code | 0 | github-code | 90 |
44490256758 | def simpleIt(a, b):
(r0, r1) = (a, b)
while r1!=0:
(r0, r1) = (r1, r0%r1)
return r0
def simpleRec(a, b):
r = a%b
if r!=0:
return simpleRec(b, a%b)
else:
return b
def extendedIt(a, b):
(r0,r1) = (a, b)
(u0, u1) = (1, 0)
(v0, v1) = (0, 1)
while r1!=... | Sebibebi67/Projet_Crypto | Euclide.py | Euclide.py | py | 1,208 | python | en | code | 0 | github-code | 90 |
15819195727 |
def compressing(string):
frequncy_arry =[]
letters=[]
for letter in string:
if letter not in letters :
letters.append(letter)
frequncy_arry.append(f"{string.count(letter)}_{letter}")
return frequncy_arry
if __name__=="__main__":
result =compressing("z")
result = sorted(result... | abdallah-abdelsabour/mastring_4_critical_Skills_USing_python | list/compressing.py | compressing.py | py | 337 | python | en | code | 2 | github-code | 90 |
38789775461 | import tensorflow as tf
from tensorflow.keras.layers import Embedding, LSTM, Dense, Dropout
class Encoder(tf.keras.Model):
def __init__(self, inp_vocab_size, embedding_dim, lstm_size, input_length):
super().__init__()
seed = 42
self.inp_vocab_size = inp_vocab_size
self.embedding_d... | renata-nerenata/Formal-vs-informal-translator | src/models/transformer.py | transformer.py | py | 9,462 | python | en | code | 0 | github-code | 90 |
8009571585 | from splinter import Browser
from bs4 import BeautifulSoup as bs
import time
def init_browser():
# @NOTE: Replace the path with your actual path to the chromedriver
executable_path = {"executable_path": "chromedriver.exe"}
return Browser("chrome", **executable_path, headless=False)
def scrape_info():
... | jcgraham440/Mars-scraper | scrape_mars.py | scrape_mars.py | py | 3,580 | python | en | code | 1 | github-code | 90 |
24682339539 | import os
import sys
import crayons
import subprocess
# List the things in the directory
# Check if there's a cmdline argument for directory provided
if len(sys.argv) < 2:
print("No input directory provided!")
exit()
# get the folder
input_path = sys.argv[1]
# If we can't find the folder in the directory
... | kenanarica/QOL_handbrake_script | compress.py | compress.py | py | 1,633 | python | en | code | 0 | github-code | 90 |
5363348726 | import os
from datacube_ows.cube_pool import cube
from datacube_ows.ows_configuration import OWSConfig, get_config, read_config
src_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def test_metadata_export():
cfg = get_config(refresh=True)
export = cfg.export_metadata()
assert "folder.0... | opendatacube/datacube-ows | integration_tests/test_layers.py | test_layers.py | py | 3,685 | python | en | code | 62 | github-code | 90 |
35281039147 | from yacs.config import CfgNode as CN
_C = CN()
_C.DATASET = CN()
# Path to directory containing the train, validation and test dataset.
_C.DATASET.DATA_DIR = ''
# Path to input mfcc features.
_C.DATASET.TRAIN_FILE = ''
# Path to labels.
_C.DATASET.VAL_FILE = ''
# Path to original labels.
_C.DATASET.TEST_FILE = ''
_... | zili98/ELEC576-Deep-Learning-Final-Project | src/config.py | config.py | py | 2,559 | python | en | code | 0 | github-code | 90 |
41836235585 | import logging
import socket
import sys
from threading import Event, Thread
import communicate
import flask
import serial
from flask import Flask, flash, json, render_template
from flask.config import Config
from flask_socketio import SocketIO, emit
from pymongo import MongoClient, errors
# On startup the app has to ... | arborin/part_information_tracking_system | PartInformationTrackingSystem_v1/app.py | app.py | py | 14,450 | python | en | code | 0 | github-code | 90 |
15622954928 | import os
import fnmatch
import pickle
start_dir = "fortune1"
dirfileinfo=[]
filepathtemp=' '
filecontenttemp=' '
for dirpath, dirs, files in os.walk("fortune1"):
for single_file in files:
if fnmatch.fnmatch(single_file, "*txt"):
filepathtemp=str(os.path.abspath(single_file));
f = open(os.path.join(dirpath, s... | prashanth291989/Python | fifth_week_python_assignment/FileTraverse.py | FileTraverse.py | py | 570 | python | en | code | 0 | github-code | 90 |
19019440385 | import io, os, sys, bisect
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
def subset_sum_in_range ():
n, a, b = map(int, input().decode().split()) ; nums_arr = [int(input().decode()) for i in range(n)]
def generate_subset_sum_array (left, right):
size = 2 ** (right - left + 1) ; ssa = []... | Tejas07PSK/lb_dsa_cracker | Searching & Sorting/Subset Sums/solution.py | solution.py | py | 914 | python | en | code | 2 | github-code | 90 |
38304416150 |
# given a list of ints of even length, return a new list length 2 containing the middle two elements from the original list
# the original list will be length 2 or more
def make_middle(nums):
new_list = []
if len(nums) > 1 and len(nums) % 2 == 0:
new_list.append(nums[int(len(nums)/2)-1])
new_l... | jemtca/CodingBat | Python/List-1/make_middle.py | make_middle.py | py | 476 | python | en | code | 0 | github-code | 90 |
18419333669 | s = input()
e0=e1=o0=o1=0
for i in range(len(s)):
if s[i]=="0" :
if i%2!=0 :
e0+=1
else:
o0+=1
else:
if i%2!=0 :
e1+=1
else:
o1+=1
# print(e0,e1,o0,o1)
ot = len(s)//2 if len(s)%2==0 else (len(s)+1)//2
et = len(s)//2
ans = min(ab... | Aasthaengg/IBMdataset | Python_codes/p03073/s042605926.py | s042605926.py | py | 375 | python | fr | code | 0 | github-code | 90 |
42078303223 | from setuptools import setup
from pkg_resources import parse_requirements
with open('requirements.txt') as f:
requirements = [str(req) for req in parse_requirements(f)]
setup(
name='AudioBookBot',
version='1.0.0',
author='Agcon, pr0maxxx, MrGreys0n',
description='Converts text from boo... | Agcon/AudioBookBot | setup.py | setup.py | py | 638 | python | en | code | 0 | github-code | 90 |
11223656299 | import pygame
from sys import exit
from pygame.locals import *
import random
import math
def list_duplicates_of(seq,item):
start_at = -1
locs = []
while True:
try:
loc = seq.index(item,start_at+1)
except ValueError:
break
else:
locs.append(loc)
... | ossan05/blixtlas | pygame-test.py | pygame-test.py | py | 5,590 | python | en | code | 0 | github-code | 90 |
6438584611 | # 애초에 전체를 뒤집을 일이 있나요,,,?
S = list(input())
idx = []
start = S[0] # 최초 문자 초기화
for i in range(len(S)):
if S[i] != start: # 최초 문자와 다른 문자의 인덱스를
idx.append(i) # 빈 리스트에 추가
start = S[i] # 그 문자를 최초문자로 설정
# 문자가 바뀌는 지점이 1, 2개->최소횟수 1회 / 3, 4개->최소횟수... | namoo1818/SSAFY_Algorithm_Study | 배민지/3-3.py | 3-3.py | py | 758 | python | ko | code | 0 | github-code | 90 |
3995225488 | #a~b 정수의 합 구하기 with 정렬
#for문
print('a부터 b까지 정수의 합 구하기')
a = int(input('a : '))
b = int(input('b : '))
if a>b :
a,b = b,a #a,b 오름차순으로 정렬(순서 바꾸기)
sum = 0
for i in range(a, b+1):
sum += i
print(sum) | WonyJeong/algorithm-study | kkxxh/basic/b35.py | b35.py | py | 275 | python | ko | code | 2 | github-code | 90 |
20369185391 | class Solution:
def champagneTower(self, poured: int, query_row: int, query_glass: int) -> float:
levels = [[0]*i for i in range(1,query_row+2)]
levels[0] = [poured]
for i in range(len(levels)-1):
for j in range(len(levels[i])):
if levels[i][j]-1 <= 0: co... | RishabhSinha07/Competitive_Problems_Daily | 799-champagne-tower/799-champagne-tower.py | 799-champagne-tower.py | py | 560 | python | en | code | 1 | github-code | 90 |
19116925832 | import sqlite3
from datetime import date
import yfinance as yf
import config
def updatePrice(max_date):
connection = sqlite3.connect(config.DB_FILE)
cursor = connection.cursor()
cursor.execute("""SELECT count(id) from stock where Special IS NULL OR Special='SNP500'""")
rows = cursor.fetchall()
t... | adityakdevin/trading | lateststockprices.py | lateststockprices.py | py | 998 | python | en | code | 0 | github-code | 90 |
29626764057 | #
# @lc app=leetcode id=9 lang=python
#
# [9] Palindrome Number
#
class Solution(object):
# def isPalindrome(self, x):
# """
# :type x: int
# :rtype: bool
# """
# s = str(x)
# return s == s[::-1]
def isPalindrome(self, x):
"""
:type x: int
... | zhch-sun/leetcode_szc | 9.palindrome-number.py | 9.palindrome-number.py | py | 1,037 | python | en | code | 0 | github-code | 90 |
18279034029 | from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")
# 処理内容
def main():
H, N = map(int, input().split())
A = [0]*N
B = [0]*N
for i in range(N):
A[i], B[i] = map(in... | Aasthaengg/IBMdataset | Python_codes/p02787/s169833720.py | s169833720.py | py | 680 | python | en | code | 0 | github-code | 90 |
74056775016 | import time
import imaplib
import RPi.GPIO as GPIO
chan_list = (18, 25, 12, 16, 23, 21)
print('press ctl-c to stop')
try:
while True:
M = imaplib.IMAP4_SSL('imap.gmail.com')
M.login('drewatkinson5@gmail.com', 'password')
M.select()
unread_count = len(M.search(None, 'UnSeen')[1][0].... | drewatk/raspberry-pi | gmailchecker.py | gmailchecker.py | py | 1,126 | python | en | code | 0 | github-code | 90 |
15296528812 | import datetime
from django.forms import (ModelForm, inlineformset_factory, forms)
from django import forms
from django.forms.extras.widgets import SelectDateWidget
from core.forms import LibraryForm, LibraryQuantificationAndStorageForm, SaveDefault, SequencingForm, LaneForm
from .models import *
class TenxChipForm(... | molonc/colossus | tenx/forms.py | forms.py | py | 4,775 | python | en | code | 3 | github-code | 90 |
18396866789 | from itertools import product
#入力
N,M=map(int,input().split())
ks=[list(map(int,input().split())) for _ in range(M)]
p=[int(x) for x in input().split()]
#print(ks)
ans=0
for i in product([0,1],repeat=N):
ok=True
for j in range(M):
j_on_cnt=0
for k in ks[j][1:]:
j_on_cnt+=i[k-1]
... | Aasthaengg/IBMdataset | Python_codes/p03031/s187554410.py | s187554410.py | py | 440 | python | en | code | 0 | github-code | 90 |
73173158696 | import matplotlib
matplotlib.use('Agg')
import datetime
import os
import argparse
import csv
import numpy as np
import scipy
from scipy.stats import norm
import matplotlib.pyplot as plt
# setting graphs
font = {'size' : 14}
fontLeg = {'fontsize': 11}
matplotlib.rc('font', **font)
matplotlib.rc('legend', **fontLeg)... | balde73/SPE-assignment-1 | main.py | main.py | py | 5,742 | python | en | code | 0 | github-code | 90 |
18321848069 | n, T = map(int, input().split())
food = []
for _ in range(n):
a, b = map(int, input().split())
food.append((a, b))
dp1 = [[0]*T for _ in range(1+n)]
dp2 = [[0]*T for _ in range(1+n)]
for i in range(n):
for j in range(T):
dp1[i+1][j] = dp1[i][j]
if j - food[i][0] >= 0:
dp1[i+1][... | Aasthaengg/IBMdataset | Python_codes/p02863/s250319356.py | s250319356.py | py | 696 | python | en | code | 0 | github-code | 90 |
18520983309 | import sys
import sqlite3
from sqlite3 import Error
import pickle
michelin = pickle.load(open('michelin_restaurants.bin', 'rb'))
yelp_restaurants = pickle.load(open('yelp_restaurants.bin', 'rb'))
yelp_reviews = pickle.load(open('yelp_reviews.bin', 'rb'))
create_table_sql = """PRAGMA foreign_keys = ON;
... | a-rich/Yelp-with-Michelin-Restaurants | data_processing_database_scripts/build_database.py | build_database.py | py | 5,326 | python | en | code | 1 | github-code | 90 |
13135059923 | import csv
reader1=csv.reader(open('rest_byzip', 'r'), delimiter=',')
reader2=csv.reader(open('rest_zip_crossjoin0', 'r'), delimiter=',')
writer=csv.writer(open('rest_zip_crossjoin', 'w'), delimiter=',')
for row1 in reader1:
for row2 in reader2:
if row1[0] == row2[0] and row1[1] == row2[1]:
row2.append(row1[2]... | DiHou/RestaurantSiteRecommend | Hive/2 rest_number_match_python/rest_zip_match.py | rest_zip_match.py | py | 511 | python | en | code | 0 | github-code | 90 |
18578818389 | N, Y = map(int, input().split())
c =False
for i in range(N+1):
for j in range(N+1-i):
if Y == 10000*i + 5000*j + 1000*(N-i-j):
a = [str(i), str(j), str(N-i-j)]
print(" ".join(a))
c = True
break
if c:
break
if not c:
print("-1 -1 -1")
| Aasthaengg/IBMdataset | Python_codes/p03471/s637447754.py | s637447754.py | py | 311 | python | en | code | 0 | github-code | 90 |
40026570216 | class Solution:
def largestRectangleArea(self, heights):
"""
:type heights: List[int]
:rtype: int
"""
heights.append(0)
stack=[heights[0]]
res = 0
for i,h in enumerate(heights[1:]):
if h>=stack[-1]:
stack.append(h)
... | lanpartis/LeetCodePractice | 84.py | 84.py | py | 625 | python | en | code | 0 | github-code | 90 |
70036864297 | from django.urls import path
from . import views
from .views import *
urlpatterns = [
path('register/', register, name='register'),
path('login/', user_login, name='login'),
path('logout/', user_logout, name='logout'),
path('test/', test, name='test'),
path('', Home.as_view(), name='home'),
p... | Bagrat88/D9.5. | News_Portal/urls.py | urls.py | py | 780 | python | en | code | 0 | github-code | 90 |
32110384485 | #import os
import re
data=open("data.txt","r")
def delete(d):
pattern=re.compile("[co]")
r=re.sub(pattern,"",d)
yield r
# for d in data:
# s=delete(d)
# print(next(s))
s=delete(data.read())
print(next(s))
| pp2-22B030444/pp2-22B030444 | TSIS6/generator.py | generator.py | py | 232 | python | en | code | 0 | github-code | 90 |
33681478915 | # Required Imports
import os
from flask import Flask, request, jsonify
from firebase_admin import credentials, firestore, initialize_app
from flask_cors import CORS
# Initialize Flask App
app = Flask(__name__)
CORS(app)
# Initialize Firestore DB
cred = credentials.Certificate('key.json')
default_app = ini... | bluesunkennie/BE_API | app.py | app.py | py | 2,061 | python | en | code | 0 | github-code | 90 |
73361224298 | import cv2
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
import math
#%%
# Start of problem 1
def GaussianFilt(img,win,sigma):
g=np.ones((win,win))
d = np.int((win-1)/2)
for x in range(-d,d+1):
for y in range(-d,d+1):
g[x+2,y+2]=np.exp(-(... | kkkacey/ImageAndVideoProcessing | Homework/5/HW5_problem1_3.py | HW5_problem1_3.py | py | 7,017 | python | en | code | 0 | github-code | 90 |
24216307881 | import csv
import json
csv_file = open('kinoafisha_data.csv', 'r', encoding='cp1251')
json_file = open('kinoafisha_data.json', 'w', encoding='utf-8')
with open('kinoafisha_data.csv') as f:
size = len(f.readlines())
fieldnames = ('position', 'title', 'genres', 'year', 'countries', 'rate', 'link')
reader... | VladHound/Information_Retrieval | csv_to_json.py | csv_to_json.py | py | 562 | python | en | code | 0 | github-code | 90 |
27682122627 | #this is in work, it is not finished yet
import math
def mitternachtsformel (a,b,c):
x1 = (-b + math.sqrt(b**2 - 4*a*c)) / (2*a)
x2 = (-b - math.sqrt(b**2 - 4*a*c)) / (2*a)
return x1, x2
def discriminant(a,b,c):
return b**2 - 4*a*c
a = int(input("Enter a: "))
b = int(input("Enter b: "))
c = int(input(... | dazyfreez/smaller-python-projects | math/even_better_calc.py | even_better_calc.py | py | 394 | python | en | code | 2 | github-code | 90 |
18227593159 | # C - gacha
n = int(input())
s = []
c = 1
for i in range(n):
s.append(input())
s.sort()
for j in range(1,n):
if s[j-1] != s[j]:
c += 1
print(c)
| Aasthaengg/IBMdataset | Python_codes/p02701/s376075235.py | s376075235.py | py | 166 | python | en | code | 0 | github-code | 90 |
19418977938 | import cv2
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
import numpy as np
import base64,time
import os
import xlwt
import xlrd
from xlutils.copy import copy
from PIL import Image
from io import BytesIO
import re
cred = credentials.Certificate("smkitchendb-firebase-admins... | KajavathananM/NutritionTracking_DesktopApplication | NutritionTracking_DesktopApplication/NutritionTracking/ImageClassifier_and_MeasureImageDifference/TestStorageController.py | TestStorageController.py | py | 26,118 | python | en | code | 0 | github-code | 90 |
8900736306 | import h5py
import numpy as np
import matplotlib.pyplot as plt
import os
import core
from scipy.ndimage import gaussian_filter1d
plt.rcParams['pdf.fonttype'] = 42
fig, ax = plt.subplots(
nrows=1, ncols=1, figsize = (8, 6), constrained_layout = True)
datasets, dataset_names = core.dataset_search()
dset_colors = [... | smail031/behavior_analysis | postrev_performance.py | postrev_performance.py | py | 1,538 | python | en | code | 0 | github-code | 90 |
69964892136 | import cv2
import numpy as np
import mxnet as mx
from sklearn.preprocessing import normalize
from reid.insightface.mtcnn import MtcnnDetector
from reid.insightface.utils import preprocess
def get_embedder(ctx, image_size, model_prefix: str, layer):
sym, arg_params, aux_params = mx.model.load_checkpoint(model_pre... | amirassov/topcoder-facial-marathon | reid/insightface/model.py | model.py | py | 2,267 | python | en | code | 10 | github-code | 90 |
18320583769 | class Town:
def __init__(self,x,y):
self.x = x
self.y = y
from itertools import permutations
N = int(input())
towns = []
for n in range(N):
d = input().split()
x, y = map(int, d)
towns.append(Town(x,y))
roots = list(permutations(towns))
distances = 0
for root in roots:
distance = 0
for i in rang... | Aasthaengg/IBMdataset | Python_codes/p02861/s621417423.py | s621417423.py | py | 530 | python | en | code | 0 | github-code | 90 |
5528616791 | """
Back Testing - Trading Strategy - RSI , MV and Bollianger Band
"""
import os
import backtrader.sizers
import pandas as pd
import yfinance as yf
import backtrader as bt
import backtrader.analyzers as btanalyzer
import numpy as np
from self.tradingSetup.backtrader.Strategy.RSI import rsi
from self.tradingSetup.bac... | ankitrawat85/QuantProjects | Backtesting_backtrader/code/backtest_backTrader.py | backtest_backTrader.py | py | 2,951 | python | en | code | 0 | github-code | 90 |
27087872038 | import os
import stat
import re
import llnl.util.tty as tty
import spack.paths
import spack.modules
# Character limit for shebang line. Using Linux's 127 characters
# here, as it is the shortest I could find on a modern OS.
shebang_limit = 127
def shebang_too_long(path):
"""Detects whether a file has a sheban... | matzke1/spack | lib/spack/spack/hooks/sbang.py | sbang.py | py | 3,033 | python | en | code | 2 | github-code | 90 |
43573604211 | from array import *
from pip._vendor.distlib.compat import raw_input
import random
def randomNumbers():
n = int(input("Write the number of elements: "))
con = 1
total = 0
for i in range(n):
elements = int(input("Write the numbers: "))
total = total + elements
con += 1
print... | Jhalinson/Python | Practices/Practice2.py | Practice2.py | py | 3,198 | python | en | code | 1 | github-code | 90 |
36267913983 | # Convert Word Document to PDF
# !pip install pypiwin32 (this is a pre installed library if not found install it)
import win32com.client
# Access MS Word application to read the file
word = win32com.client.Dispatch("Word.Application")
word.visible = 0
# File Paths
pdfDoc = "path\\to\\pdf\\samplepdf.pdf"
... | sprao-cs/Python-Scripts | pdf2word.py | pdf2word.py | py | 654 | python | en | code | 0 | github-code | 90 |
18378147079 | import sys
input = sys.stdin.readline
def MI():
return map(int,input().split())
def main():
n,m=MI()
G=[[] for _ in range(n)]
for _ in range(m):
u,v=MI()
u-=1
v-=1
G[u].append(v)
s,t=MI()
s-=1
t-=1
fi=[True]*n
se=[True]*n
th=[True]*n
th[s]=False
dq=[s]
depth=0
while dq... | Aasthaengg/IBMdataset | Python_codes/p02991/s989191603.py | s989191603.py | py | 814 | python | en | code | 0 | github-code | 90 |
25122708676 | # Utilizando a função input para coletar dados do usuário
nome = input('Qual seu nome? ') #o programa só continua se o usuario apertar enter
print(f'O seu nome é {nome}')
numero1 = input('Digite um número: ')
numero2 = input('Digite outro número: ')
int_numero_1 = int(numero1)
int_numero_2 = int(numero2)
print(f'A... | Remoguima/Curso_Python | aula15.py | aula15.py | py | 368 | python | pt | code | 0 | github-code | 90 |
37780740399 | """
From Map to Graph
Universidad Panamericana Campus Mixcoac
Inteligencia Artificial
Enrique Ulises Báez Gómez Tagle
Iván Cruz Ledesma
Mauricio Pérez Aguirre
April 26 2023
v 1.0
R:: Mauricio Pérez Aguirre
"""
from queue import PriorityQueue
import time
def BeamSearch(graph, heuristics, start, goal):... | HeinrichGomTag/Artificial-Intelligence-Projects | Kikin-Informed-Search-Algorithms/Beam.py | Beam.py | py | 2,411 | python | en | code | 0 | github-code | 90 |
22126818016 | """
General Character commands usually available to all characters
"""
from django.conf import settings
from evennia.utils import utils, evtable
COMMAND_DEFAULT_CLASS = utils.class_from_module(settings.COMMAND_DEFAULT_CLASS)
# limit symbol import for API
__all__ = ("CmdLook", "CmdInventory", "CmdSetDesc", "CmdGet", "... | CloudKeeper/SimpleEvennia | commands/general.py | general.py | py | 9,781 | python | en | code | 0 | github-code | 90 |
72143624618 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from gratipay.testing.billing import BillingHarness
class TestNMassPays(BillingHarness):
def setUp(self):
BillingHarness.setUp(self)
self.make_participant('admin', claimed_time='now', is_ad... | gratipay/gratipay.com | tests/py/test_dashboard.py | test_dashboard.py | py | 1,963 | python | en | code | 1,121 | github-code | 90 |
3784498806 | import re
from bs4 import BeautifulSoup
from pre_commit_test.local_lib import LocalLibClass
GLOBAL_VARIABLE = 10
# change for tests
class MainClass(object):
def __init__(self):
self.first_variable = 1
self.second_variable = [
value for value in range(10, 1000, 2) if value % 10 == 3
... | fvendrameto/pre-commit-test | main_file.py | main_file.py | py | 747 | python | en | code | 0 | github-code | 90 |
73530702698 | import os, sys
import argparse
from tqdm import tqdm
from functools import partial
from argparse import Namespace
# jnp.set_default_tensor_type(torch.FloatTensor)
argparser = argparse.ArgumentParser()
# general args:
argparser.add_argument("--seed", type=int, help="seed", default = 0)
argparser.add_argument("--visib... | ChenkaiMao97/MAML_EM_simulation | DDM/overlapping_solver_JAX_steady_flow/overlapping_solver_jax_video.py | overlapping_solver_jax_video.py | py | 23,288 | python | en | code | 3 | github-code | 90 |
20749920079 | import sys
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n = int(input().rstrip('\n'))
ab = []
takahashi = 0
aoki = 0
for i in range(n):
a, b = list(map(int, input().rstrip('\n').split()))
aoki += a
ab.append([2 * a + b, a, b])
ab.sort(reverse=True)
... | tabi-code/AtCoder | problems/abc187/abc187_d.py | abc187_d.py | py | 531 | python | en | code | 0 | github-code | 90 |
38724537579 | import numpy as np
from utils.vocab import Vocab
def padding(sentence, max_len, vocab):
"""
给句子加上<START><PAD><UNK><END>
:param sentence:
:param max_len:
:param vocab:
:return:
"""
words = sentence.strip().split()
words = words[:max_len]
sentence = [word if word in vocab.word2i... | yikisng/NLP-Project-01-QA_Abstract_Reasoning | data_processor/dataset_processor.py | dataset_processor.py | py | 1,682 | python | en | code | 0 | github-code | 90 |
36759592183 | from datetime import datetime, time
from itertools import groupby
import requests
from flask import Flask, jsonify, render_template, request
from pymongo import MongoClient
app = Flask(__name__)
app.jinja_env.add_extension('jinja2.ext.do')
client = MongoClient('localhost', 27017)
db = client.metcast
API_KEY = 'cd6... | dbond762/metcast | app.py | app.py | py | 4,850 | python | en | code | 0 | github-code | 90 |
2806683956 | import random
def pick6():
return [random.randint(1,99) for x in range(6)]
# ticket = []
# for x in range(6):
# ticket.append(random.randint(1,99))
# return ticket
def num_matches(winning, ticket):
matches = 0
# for i in range(len(winning)):
# if winning[i] == ticket[i]:
# ... | PdxCodeGuild/class_salmon | code/merritt/archive/lab14.py | lab14.py | py | 1,814 | python | en | code | 5 | github-code | 90 |
25538736091 | '''
1. check directions of reads containing DNM
2. if there are indels in reads, if any, could be misaligned reads
Author: Y.Lin
'''
import pysam, vcfpy
import sys, os
def main():
VCF = sys.argv[1]
PEDfile = sys.argv[2]
#child, father, mother = getPED(PED)
#CHROM, POS = getVCFInfo (VCF)
try:
reader = vcfpy.... | Lin-Yuying/GuppyGermlineDNMs | BAMfilter.py | BAMfilter.py | py | 3,350 | python | en | code | 1 | github-code | 90 |
32428571135 | """
TorchText로 언어 번역하기
===================================
이 튜토리얼에서는 ``torchtext`` 의 유용한 여러 클래스들과 시퀀스 투 시퀀스(sequence-to-sequence, seq2seq)모델을 통해
영어와 독일어 문장들이 포함된 유명한 데이터 셋을 이용해서 독일어 문장을 영어로 번역해 볼 것입니다.
이 튜토리얼은
PyTorch 커뮤니티 멤버인 `Ben Trevett <https://github.com/bentrevett>`__ 이 작성한
`튜토리얼 <https://github.com/bentrevett... | uramoon/oss15 | docs/_downloads/e733d8cec5d7c07a409a12a4273a4a28/torchtext_translation_tutorial.py | torchtext_translation_tutorial.py | py | 17,278 | python | ko | code | 0 | github-code | 90 |
25254478412 | import sys
from itertools import combinations
numList = [int(sys.stdin.readline()) for i in range(9)]
sumList = sum(numList) - 100
for comb in combinations(numList, 2):
if sum(comb) == sumList :
numList.remove(comb[0])
numList.remove(comb[1])
break
print('\n'.join(map(str, numList))) | choinara0/Algorithm | Baekjoon/BruteForce Algorithm/3040번 - 백설 공주와 일곱 난쟁이/3040번 - 백설 공주와 일곱 난쟁이.py | 3040번 - 백설 공주와 일곱 난쟁이.py | py | 315 | python | en | code | 0 | github-code | 90 |
43954736860 | import re
from collections import *
from functools import *
inp = []
arr = []
for l in open("i1"):
l = l.strip()
a,b = l.split("|")
arr.append(b.split())
inp.append(a.split())
res = 0
for x in arr:
for y in x:
if len(y) in (2,3,4,7):
res += 1
print(res)
res = 0
for i, x in enu... | Scheir/AdventOfCode | AoC21/d8/8.py | 8.py | py | 1,184 | python | en | code | 0 | github-code | 90 |
18363814759 | N = int(input())
P = list(map(int,input().split()))
R = sorted(P)
import copy
answer = 'NO'
for i in range(0,N-1):
for j in range(i+1,N):
Q = copy.deepcopy(P)
A = Q[i]
B = Q[j]
Q[i] = B
Q[j] = A
if Q == R:
answer = 'YES'
break
if P == R:
an... | Aasthaengg/IBMdataset | Python_codes/p02958/s236343760.py | s236343760.py | py | 347 | python | en | code | 0 | github-code | 90 |
11871104175 | import json
from datetime import datetime
from django.test import TestCase
from blog import views
class BlogURLTest(TestCase):
def test_url_blog_redirection(self):
response = self.client.get("/blog/")
self.assertEqual(response.status_code, 200)
def test_blogs_template_is_called(self):
... | xrochard/personal_portfolio | blog/tests/test_views.py | test_views.py | py | 2,296 | python | en | code | 0 | github-code | 90 |
17933261429 | import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9
def main():
x,y = input().split()
if x == y:
print('=')
elif x < y:
print('<')
else:
print('>')
if __name__ == '__main__':
main()
| Aasthaengg/IBMdataset | Python_codes/p03547/s840871523.py | s840871523.py | py | 244 | python | en | code | 0 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.