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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
9863979655 | ''' import heapq
import sys
input = sys.stdin.readline
INF = int(1e9)
n, m = map(int, input().split())
start = int(input())
# 노드 연결되어있는 노드에 대한 정보 담는 리스트
graph = [[] for i in range(n + 1)]
# 최단 거리 나타내기
distance = [INF] * (n + 1)
# a : 노드 , b : b번노드 , c : 거리
for _ in range(m):
a, b, c = map(int, input().split())
g... | KIMJINMINININN/Algorithm-Study | Python_book/Shortest_Path/chapter9/9-2.py | 9-2.py | py | 2,727 | python | ko | code | 0 | github-code | 90 |
38582123677 | # -*- coding: utf-8 -*-
import operator
from django.conf import settings
from django import forms
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from selectfilter import utils
class SelectBoxFilter(object):
def renderFilter(self, js_method_name, element_id, model, ... | gista/django-selectfilter | selectfilter/forms/widgets.py | widgets.py | py | 4,204 | python | en | code | 1 | github-code | 90 |
12455660006 |
mad_libs_1 = """Mad libs 1- Once there was a little {} who lived in the forest. The {} {} went so {} that they crashed through the cieling.
They hurt their head and had to find a nurse. The end.\n"""
mad_libs_2 = """Mad Libs 2- One day the {} {} went swimming. The {} {} participated in a swimming race.
The {} {... | mgunnhawkins/mad_libs | mad_libs.py | mad_libs.py | py | 1,362 | python | en | code | 0 | github-code | 90 |
20841444487 | #!/usr/bin/env python3
import json
import os
import re
import requests
data = {}
data_dir = os.path.abspath(os.path.pardir) + '/data/'
data_file = data_dir + 'data.json'
if os.path.isfile(data_file):
with open(data_file, 'r') as f:
data = json.load(f)
previous_ver = data['kindle_version'][0:3]
else:
... | hi-andy/python-study | check_update.py | check_update.py | py | 1,145 | python | en | code | 0 | github-code | 90 |
19018329415 | from math import inf
class Solution:
def __isPalindrome (self, i, j, string):
while (i < j):
if (string[i] != string[j]): return False
i, j = i + 1, j - 1
return True
def __palin_part_helper (self, i, j, string):
if (i >= j): return 0
if (self.__isPalindr... | Tejas07PSK/lb_dsa_cracker | Dynamic Programming/Palindrome Partitioning Problem/solution1.py | solution1.py | py | 983 | python | en | code | 2 | github-code | 90 |
18321479539 | X, Y = map(int, input().split())
mod = 10 ** 9 + 7
m = mod - 2
bin_m = []
while m:
bin_m.append(m % 2)
m >>= 1
p = 2 * X - Y
q = -X + 2 * Y
if p >= 0 and q >= 0 and p % 3 == 0:
a = p // 3
b = q // 3
n = a + b
ANS = 1
for i in range(1, a+1):
ANS = (ANS * (n+1-i)) % mod
inv = 1
for j in reversed... | Aasthaengg/IBMdataset | Python_codes/p02862/s738281720.py | s738281720.py | py | 463 | python | en | code | 0 | github-code | 90 |
11272528221 | from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
from django.views import View
# from newbatch.models import NewBatch
from common.response import responses
from .models import NewBatch,ImageFile
import json
class AddNewBatch(View):
def post(self,request):
... | J-Bhuvanesh/Mongo-Poultry | newbatch/views.py | views.py | py | 2,596 | python | en | code | 0 | github-code | 90 |
5908315749 | # Problem description:
# https://leetcode.com/problems/concatenation-of-array/
def get_concatenation(nums):
result = []
counter = len(nums)
for i in range(2):
while counter > 0:
for i in nums:
result.append(i)
counter -=... | keremidarski/python_playground | LeetCode/1929_Concatenation_of_Array.py | 1929_Concatenation_of_Array.py | py | 449 | python | en | code | 0 | github-code | 90 |
26725090564 | import curses
from .common import check_curses
class GaugeName:
def __init__(self, text, color=curses.A_NORMAL):
self.text = text
self.color = color
class GaugeBar:
def __init__(self, number, color):
self.number = number
self.color = color
@check_curses
def linear_gauge(std... | smartTomCat/jetson_stats | jtop/gui/lib/linear_gauge.py | linear_gauge.py | py | 2,681 | python | en | code | 1 | github-code | 90 |
70387450536 |
import sympy
from ..utils import get_random_number, range_list
from ..abstractgenerator import AbstractGenerator
from ...base import NumericalQuestion
class SystemOfEquations(AbstractGenerator):
"""docstring for SystemOfEquations."""
__LABELS_DEFAULT = {
"question-text": "Solve next system of equat... | chavaone/question-generator | src/questiongenerator/generators/maths/systemofequations.py | systemofequations.py | py | 2,047 | python | en | code | 0 | github-code | 90 |
48941808640 | from tkinter import *
import hashlib
root =Tk()
text = Text(root,width =30,height =5)
text.pack()
text.insert(INSERT,'i love the world!')
contents = text.get('1.0',END)
def getSig(contents):
m = hashlib.md5(contents.encode())
return m.digest()
sig = getSig(contents)
def check():
contents... | witchiman/GitDemo | Python/tk/text_check.py | text_check.py | py | 546 | python | en | code | 1 | github-code | 90 |
12125147847 |
import wx,os
# This file takes the place of wxGlade and is used to form the USER interface
# using the wxPython wrappers of wxWidgets objects
#
def LoadParametricParams(path):
paramsList=[]
lines=open(path,'r').readlines()
for line in lines:
#Strip whitespace
line=line.strip()... | CenterHighPerformanceBuildingsPurdue/ACHP | GUI/LoadGUI.py | LoadGUI.py | py | 118,599 | python | en | code | 48 | github-code | 90 |
17967246889 | from math import gcd
n = int(input())
time = list(int(input()) for _ in range(n))
ans = time[0]
for i in range(1,n):
ans = (ans * time[i]) // gcd(ans, time[i])
print(int(ans)) | Aasthaengg/IBMdataset | Python_codes/p03633/s940758017.py | s940758017.py | py | 183 | python | en | code | 0 | github-code | 90 |
4129050142 | import sys
import pandas as pd
import numpy as np
from plotnine import*
import os
class Assignment(object):
def __init__(self):
os.system('cls')
self.data1 = pd.read_csv('cars.csv', sep=';')
self.data2 = pd.read_csv('COVID19.csv')
self.data3 = pd.read_csv('film.csv', sep=... | cheekety/pandas-example | Python_Pandas.py | Python_Pandas.py | py | 26,210 | python | en | code | 0 | github-code | 90 |
28885378387 | import numpy as np
import pandas as pd
from util import *
from matplotlib import pyplot as plt
from datetime import datetime
from statsmodels.tsa.stattools import adfuller
from statsmodels.tsa.stattools import acf, pacf
from statsmodels.tsa.seasonal import seasonal_decompose
from statsmodels.tsa.arima_model import ARI... | pedromorfeu/TFM | time_series.py | time_series.py | py | 12,909 | python | en | code | 0 | github-code | 90 |
40596920155 | #!/usr/bin/python3.6
### Remove all Ns from fasta sequences
### Fernanda Trindade, 02-18-2022
## Import
from Bio import SeqIO
import sys
import re
## Prepare arguments
my_args = sys.argv
#my_args = ['./removeNs.py','examples/TESTE.fasta']
if len(my_args) == 0 or len(my_args) < 2:
print("Usage: removeNs.py input.f... | ffertrindade/proc_tools | removeNs.py | removeNs.py | py | 1,156 | python | en | code | 0 | github-code | 90 |
29898026269 | import KeywordList
import Meaning
import RecommendCourse
from SelectToSpeech import selectToSpeech
import ServiceConfig
import speech_recognition as sr
import TextToSpeech
from DownloadManager import manageFolder
from GoogleTranslate import translate
from News import getNews
from OCR import pdfToText, imgToText
from th... | 4nkitpatel/AutoMate | SmallTalk.py | SmallTalk.py | py | 8,271 | python | en | code | 1 | github-code | 90 |
31280043354 | import numpy as np
import pandas as pd
import os
# Cambio de directorio para encontrar la base de nombres
os.chdir('D:/Usuario/Pablo/Escritorio/workspace/python/matematicas_3/src/6_class/')
# Cambio los decimales a solamente 2, no anda siempre....
# np.set_printoptions(precision=2)
# pd.options.display.float_format ... | madescoces/python | matematicas_3/src/6_class/2.pandas_Series_diccionario.py | 2.pandas_Series_diccionario.py | py | 1,205 | python | es | code | 0 | github-code | 90 |
29741266519 | """
输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则。
"""
class Node:
def __init__(self, value=None, next_node=None):
self.value = value
self.next_node = next_node
def set_next(self, node):
self.next_node = node
class Array:
def __init__(self):
self.head = None
self... | misoomang/offer_test | 15.py | 15.py | py | 2,470 | python | en | code | 0 | github-code | 90 |
25755722091 | import subprocess
from vortexmq.src.errors import Alert
class Topic:
data = {
'clat': '',
'clng': ''
}
def __init__(self):
self.topic = 'local/system/track'
self.type = 'realtime'
self.args = {
'gotolat': {
'doc' : 'New latitude',
... | rulioj/vortexmq-linux | topics/local/system/track.py | track.py | py | 1,180 | python | en | code | 0 | github-code | 90 |
30080650450 | num = input()
x = [int(a) for a in str(num)]
if 0 not in x:
print(-1)
else:
x.remove(0)
x = sorted(x,reverse=True)
x= list(map(str,x))
list_str = ''.join(x)
list_int = int(list_str)
k = str(list_int)+'0'
k = int(k)
if k % 3==0:
print(k)
else:
print(-1) | stockmanager1/baejoon-study--TIL | 백준/Silver/10610. 30/30.py | 30.py | py | 295 | python | en | code | 0 | github-code | 90 |
27096111508 | from spack import *
class RRinside(RPackage):
"""C++ classes to embed R in C++ applications The 'RInside' packages makes
it easier to have "R inside" your C++ application by providing a C++
wrapperclass providing the R interpreter. As R itself is embedded into
your application, a shared library build ... | matzke1/spack | var/spack/repos/builtin/packages/r-rinside/package.py | package.py | py | 1,477 | python | en | code | 2 | github-code | 90 |
43477832140 | import threading
from tkinter import *
from pynput import keyboard
from DeliveryGame.alert import Alert
from DeliveryGame.truck import Truck
from DeliveryGame.cars_manager import CarsManager
from DeliveryGame.objects_manager import ObjectsManager
from DeliveryGame.packages_manager import PackagesManager
from DeliveryGa... | FinnMal/getinit_code_and_win | DeliveryGame/game.py | game.py | py | 8,328 | python | en | code | 1 | github-code | 90 |
7004732848 | from django.urls import path
from . import views
urlpatterns = [
path('', views.shop, name='shop'),
path('info/<int:pk>/', views.productdetail, name='productdetail'),
path('cart/', views.cart, name='cart'),
path('search/', views.search, name='search'),
] | RockaDev/EShop-Django | shop/urls.py | urls.py | py | 272 | python | en | code | 0 | github-code | 90 |
18576012719 | import math
k = int(input())
a = [int(item) for item in input().split()]
a.reverse()
max_num = 2
min_num = 2
for i in range(k):
if int(math.floor(max_num / a[i])) * a[i] < int(math.ceil(min_num / a[i])) * a[i]:
print(-1)
exit()
next_max = int(math.floor(max_num / a[i])) * a[i] + a[i] - 1
... | Aasthaengg/IBMdataset | Python_codes/p03464/s214390393.py | s214390393.py | py | 438 | python | en | code | 0 | github-code | 90 |
72355817896 | import cv2
import numpy as np
def extract_video(name):
cap = cv2.VideoCapture(name)
cnt = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) #! cnt means total frames
step = int(cnt / 10)
cnt = 0
i = 0
frame_list = []
while (cap.isOpened()):
ret, frame = cap.read() #! frame: [360, 640, 3]
... | Ther-nullptr/STD_LAB | test/noise/extract_noise_video.py | extract_noise_video.py | py | 2,380 | python | en | code | 0 | github-code | 90 |
38912146330 | # Author: Jorick Bouw
# Date: 2023-04-19
# Description: BeReal Alarm with Google Home
### Imports BeReal ###
import yaml
import requests
import schedule
import time
from datetime import datetime, timedelta
### Imports Google Home ###
import pychromecast
import time
from cryptography.hazmat.bindings.openssl.binding ... | jorickjuh/Google-BeReal-Alarm | main.py | main.py | py | 3,827 | python | en | code | 1 | github-code | 90 |
74728740135 | #!/usr/bin/env python3
# @Date : 2022/2/2
# @Filename : 2155.py
# @Tag :
# @Autor : LI YAO
# @Difficulty :
from heapq import *
from typing import List, Optional
from collections import defaultdict, deque, Counter
from itertools import product,combinations,permutations,accumulate
from random impor... | GeneralLi95/leetcode | Python/2155.py | 2155.py | py | 948 | python | en | code | 0 | github-code | 90 |
70298125418 | import copy
import numpy as np
import scipy
import dataset_creation.NSWPH_initialize_state_vector as isv
from dataset_creation.NSWPH_models_linear import calc_state_matrix
from dataset_creation.NSWPH_system_models import nswph_models
from definitions import N_SC, N_WF, N_OFF, min_damping, walk_margin, damp_to... | jbesty/irep_2022_closing_the_loop | dataset_creation/NSWPH_functions.py | NSWPH_functions.py | py | 19,522 | python | en | code | 5 | github-code | 90 |
5508549549 | import math
def is_prime(n):
if n < 2:
return False
else:
for i in range(2, int(math.sqrt(n) + 1)):
if n % i == 0:
return False
return True
def find_prime_number_next(n):
prime_next = n + 1
while is_prime(prime_next) == False:
prime_next +=... | khanhdepdai/learn-python-branium | SubjectPythonBranium/Chương3/3_1/Bai6.py | Bai6.py | py | 1,930 | python | en | code | 0 | github-code | 90 |
12974889338 |
from options.base_opt import BaseOptions
class TestOptions(BaseOptions):
"""This class includes test options.
It also includes shared options defined in BaseOptions.
"""
def init_experiment_params(self, parser):
parser = BaseOptions.init_experiment_params(self, parser) # define shared optio... | BounharAbdelaziz/Face-Image-Colorization | options/testing_opt.py | testing_opt.py | py | 867 | python | en | code | 1 | github-code | 90 |
9188835237 | import json
from collections import defaultdict
from kafka import KafkaProducer, KafkaConsumer
from feynman.etc.util import get_logger
class Kafka_queue_consumer():
def __init__(self, opt):
self._opt = opt
self._kc = KafkaConsumer(self._opt.topic,
bootstrap_serve... | kangheeyong/LIB-Feynman | feynman/database/kafka.py | kafka.py | py | 1,825 | python | en | code | 0 | github-code | 90 |
19752263637 | from django.shortcuts import render
from django.shortcuts import render, redirect,get_object_or_404
from django.urls import reverse
from django.views.generic import RedirectView, TemplateView
from django.forms import modelformset_factory
from .models import CartItem
from django.contrib import messages
from app.models i... | Helione/emporiofree | carrinho/views.py | views.py | py | 1,696 | python | en | code | 0 | github-code | 90 |
32739502780 | import time
import os
import re
import codecs
from typing import List
from random import randint
from AsunaRobot.modules.helper_funcs.chat_status import user_admin
from AsunaRobot.modules.disable import DisableAbleCommandHandler
from AsunaRobot import (
dispatcher,
WALL_API,
)
import requests as r
import wikipe... | HuntingBots/AsunaRobot | AsunaRobot/modules/misc.py | misc.py | py | 10,101 | python | en | code | 31 | github-code | 90 |
4717710987 | def dfs(a, b, c):
global res
if b > m:
return
if c == n:
if res < a:
res = a
else:
dfs(a + lst[c][0], b + lst[c][1], c + 1)
dfs(a, b, c + 1)
n, m = map(int, input().split())
lst = []
for _ in range(n):
lst.append(list(map(int, input().split())))
res = 0
... | ambosing/PlayGround | Python/Problem Solving/ETC_algorithm_problem/get_max_score.py | get_max_score.py | py | 344 | python | en | code | 0 | github-code | 90 |
2900597080 | import pathlib
import pkg_resources
from setuptools import setup
def read(fname):
this_directory = pathlib.Path(__file__).parent
long_description = (this_directory / fname).read_text()
return long_description
def read_requirements(path):
with pathlib.Path(path).open() as requirements_txt:
re... | opentensor/validators | setup.py | setup.py | py | 2,389 | python | en | code | 9 | github-code | 90 |
72665254376 | #coding=utf-8
import pymysql
import logging
import os
import json
import copy
from error import Error
from common import Common
class ModVariable(object):
"""CMS template variable access class
执行项目的变量管理
"""
db = None
core = ""
def __init__(self,webapp):
"""Init ModVariable Class
"""
self.__class__.db =... | haojingus/pycms | modvariable.py | modvariable.py | py | 2,770 | python | en | code | 1 | github-code | 90 |
12680544073 | '''
This is the simple code for PIR activated GIF
Connect your PIR and RPI as shown in schematic
Copy paste this code in Python3 and Run
'''
#ELECTRICALTECHY.BLOGSPOT.IN
import RPi.GPIO as GPIO
import time
import os , sys
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.IN)
while True:
... | absoluteabutaj/RaspberryPi | PIRGUI.py | PIRGUI.py | py | 599 | python | en | code | 0 | github-code | 90 |
15375052595 | import settings
from mastodon import *
import tweepy
TWITTER_CONSUMER_KEY = settings.twi_con_key
TWITTER_CONSUMER_SECRET = settings.twi_con_seq
TWITTER_ACCESS_TOKEN = settings.twi_acc_tkn
TWITTER_ACCESS_SECRET = settings.twi_acc_seq
class Mas2twiAuth:
def login_for_mastodon():
mastodon = Mastodon(
... | huideyeren/mastodon_to_twitter | mas2twi.py | mas2twi.py | py | 943 | python | en | code | 0 | github-code | 90 |
74573583335 | import os
from datetime import datetime
from dateutil.parser import parse
from copy import deepcopy
import requests
import satstac
from . import stac
from . import utils
class Landsat(object):
"""https://landsat.usgs.gov/landsat-collections"""
def __init__(self, parts):
self.parts = list(parts)
... | geospatial-jeff/cognition-sensors | sensors/sensors.py | sensors.py | py | 8,687 | python | en | code | 0 | github-code | 90 |
18173037269 | K = int(input())
def solve():
val = 0
for i in range(1, K + 1):
val = val * 10 + 7
val = val % K
if val == 0:
return i
return -1
print(solve()) | Aasthaengg/IBMdataset | Python_codes/p02596/s858087460.py | s858087460.py | py | 198 | python | en | code | 0 | github-code | 90 |
22530073305 | #!/usr/bin/env python
# coding: utf-8
# In[3]:
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import numpy as np
import numpy as np
from scipy.interpolate import make_interp_spline
import calcTimeNow
import getDaysInMonth
# In[2]:
#
# Make some graphs - temperature line p... | jimhnws/jimhnws | plotMonthlyTempDavis.py | plotMonthlyTempDavis.py | py | 2,256 | python | en | code | 0 | github-code | 90 |
11227804193 | from robot_vars import *
import numpy as np
from hasimpy import *
import matplotlib.pyplot as plt
import matplotlib.animation as animation
timeStamps = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
alpha = 0.1
#plt.ylim(0, 1)
def phaseCalc(timeStamps, alpha):
zVal = [None] * len(timeStamps)
for i in range(l... | verycommonname/Compass_gait_modified | compass-gait-master_modified/compass-gait-master/phase_calculation.py | phase_calculation.py | py | 986 | python | en | code | 0 | github-code | 90 |
41871810840 | #!/usr/bin/python3
"""
This prints the first State object from the database hbtn_0e_6_usa
"""
from sys import argv
from model_state import Base, State
from sqlalchemy import (create_engine)
from sqlalchemy.orm import sessionmaker
if __name__ == "__main__":
engine = create_engine('mysql+mysqldb://{}:{}@localhost:... | mr-robertamoah/alx-higher_level_programming | 0x0F-python-object_relational_mapping-droppped/11-model_state_insert.py | 11-model_state_insert.py | py | 683 | python | en | code | 1 | github-code | 90 |
70411808617 | from datetime import datetime, timedelta
c = 0
d = datetime(1901, 1, 1)
e = datetime(2000, 12, 1)
while d < e:
if d.day == 1 and d.weekday() == 6: # 6 -> sunday
c += 1
d += timedelta(days=1)
print(c) | er-knight/project-euler | solutions/problem-19.py | problem-19.py | py | 217 | python | en | code | 0 | github-code | 90 |
9334030676 | #slope of the incident ray
m = 0
#slope of the tangent
t = 0
#slope of the 법선
n = 0
#slope of the reflecting ray
s = 0
def TangentFromPoint(p):
tangent = -4*p[0]/p[1]
return tangent
point1 = (0,10.1)
point2 = (1.4,-9.6)
def GetNextPoint(point1, point2):
m = (point1[1] - point2[1]) / (point1[0] - poin... | Concarne2/ProjectEuler | PEuler_144.py | PEuler_144.py | py | 846 | python | en | code | 0 | github-code | 90 |
18221309319 | import collections
from collections import Counter
N=int(input())
a=input().split()
A=[int(number) for number in a]
pluss=[]
minuss=[]
number=1
for a in A:
plus=a+number
minus=number-a
pluss.append(plus)
minuss.append(minus)
number+=1
m=Counter(minuss)
answer=0
for p in pluss:
if p in m.keys()... | Aasthaengg/IBMdataset | Python_codes/p02691/s642159316.py | s642159316.py | py | 357 | python | en | code | 0 | github-code | 90 |
15863938425 | """Route Searcher
"""
import collections
from typing import (
Dict,
NamedTuple,
Set,
)
import route.exceptions
class Station(NamedTuple):
name: str
class Router:
def __init__(self) -> None:
Routes = Dict[Station, Set[Station]]
self._routes: Routes = collections.defaultdict(set)
... | mizzsugar/tdd-route-search | route/__init__.py | __init__.py | py | 1,382 | python | en | code | 0 | github-code | 90 |
11889600685 | import asyncio
import os
import tempfile
import time
import unittest
from unittest.mock import Mock
from config_operator.config_source import RemoteGitConfig
class TestRemoteDirConfig(unittest.TestCase):
_latest_commit = 0
def _get_origin(self):
commit = Mock()
commit.hexsha = self._latest_c... | megankbull/incubator-sdap-ingester | config_operator/tests/config_source/test_RemoteGitConfig.py | test_RemoteGitConfig.py | py | 1,179 | python | en | code | null | github-code | 90 |
73431154536 | """
@Project: 2023-HumanPose
@FileName: profile_test.py
@Description: 自动描述,请及时修改
@Author: Wei Jiangning
@version: 1.0.0a1.0
@Date: 2023/8/27 21:01 at PyCharm
"""
import os
import time
from public.config import *
from mediapipe_keypoint import mideapipe_keypoints
from public.log import logger
class Extract():
def ... | TrinityNeo99/HumanPose | Mediapipe_pose/profile_test.py | profile_test.py | py | 996 | python | en | code | 1 | github-code | 90 |
72889992617 | import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
import numpy as np
import matplotlib.pyplot as plt
import PIL.Image as Image
def read_voc_images(root='dataset/VOCdevkit/VOC2012', is_train=True, max_num=None):
... | glenn-raddars/BiYeSheJi | train.py | train.py | py | 1,332 | python | en | code | 0 | github-code | 90 |
19181386457 | import sys
from PyQt6.QtSql import QSqlQuery, QSqlDatabase
from PyQt6.QtGui import QIcon
from PyQt6.QtWidgets import (QApplication, QWidget, QVBoxLayout, QPushButton,
QHBoxLayout, QListWidget, QLineEdit, QTextEdit,
QListWidgetItem, QLabel, QMessageBox)
... | nikitka1234/test | test_project_2.py | test_project_2.py | py | 6,886 | python | en | code | 1 | github-code | 90 |
1419025942 | from msal import ConfidentialClientApplication, SerializableTokenCache
from uuid import uuid4
from logging import Logger
from typing import Any
from functools import wraps
from .context import IdentityContextData
from .constants import *
from .adapters import IdentityWebContextAdapter
from .errors import *
# TODO:
#... | Azure-Samples/ms-identity-python-samples-common | ms_identity_web/__init__.py | __init__.py | py | 15,401 | python | en | code | 34 | github-code | 90 |
70809122858 | from math import factorial
limit = 1_000_000_007
def main():
try:
while True:
word = input()
count_chars = dict()
for char in word:
if char in count_chars:
count_chars[char] += 1
else:
count_chars[... | Dsbaule/INE5452 | Simulado 06/06 - Quid Est Veritas? Est Vir Qui Adest!.py | 06 - Quid Est Veritas? Est Vir Qui Adest!.py | py | 603 | python | en | code | 0 | github-code | 90 |
30970526577 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed May 30 19:17:51 2018
@author: creanero
"""
from horizontalAzEl2stnAzEl import horizon_to_station
stn_alt_az=horizon_to_station(stnid, merge_df.az, merge_df.alt)
#stn_alt_az_t=zip(*stn_alt_az)
#
#stn_alt=np.array(stn_alt_az_t[1])*180/np.pi
#stn_az=np.a... | creanero/beamModelTester | WIP/stn_alt_az_integration_test.py | stn_alt_az_integration_test.py | py | 674 | python | en | code | 3 | github-code | 90 |
71938922216 | import itertools
import math
from tqdm import tqdm
from english_words import get_english_words_set
# # Long list of words
# with open('words_alpha.txt') as f:
# words = f.read().splitlines()
# Short list of words
words = list(get_english_words_set(['gcide'], alpha=True))
# Add in extra words, if desired
with open('... | Brandonsams/BBGrams | main.py | main.py | py | 1,214 | python | en | code | 0 | github-code | 90 |
6189764996 | from io import StringIO
import csv
def task(csv_string):
input = serialize_csv(csv_string)
result = []
return [r1_nodes(input), r2_nodes(input), r3_nodes(input), r4_nodes(input), r5_nodes(input)]
def serialize_csv(csv_string):
f = StringIO(csv_string)
reader = csv.reader(f, delimiter=','... | GavrilovaAnastasia/System_analysys_labs | task3/task3.py | task3.py | py | 1,283 | python | en | code | 0 | github-code | 90 |
2321754888 | import falcon
import time, datetime
from sqlalchemy import text, func
from sqlalchemy.orm.exc import NoResultFound
from falcon.media.validators.jsonschema import validate
from flightbooking import log
from flightbooking.schemas import load_schema
from flightbooking.resources import BaseResource
from flightbooking.model... | ayaar25/ws_flightbooking | entity-service/flightbooking/resources/schedule.py | schedule.py | py | 4,807 | python | en | code | 0 | github-code | 90 |
34998390004 | import re
import os
import os.path as P
import tkinter as Tk
from PIL import Image as I
from PIL import ImageTk as Itk
import tkinter.filedialog as D
import tkinter.messagebox as M
SIZE = 100
IMAGR_TYPES = ['gif', 'png', 'bmp', 'jpg', 'tif', 'ppm']
MAM_COLN = 6
GEO_MAIN = '+20+20'
GEO_SATE = '+750+50'
GEO_SCAL = '+750... | 96no3/PythonStudy | Python/201911/191129/2019112901.py | 2019112901.py | py | 8,249 | python | en | code | 0 | github-code | 90 |
15978042996 | from django.conf.urls import url
from .views import profile, access, email_send, email_confirm
urlpatterns = (
url(r'^profile/$', profile),
url(r'^access/$', access),
url(r'^email_confirm/$', email_confirm),
url(r'^$', profile),
)
| hms-dbmi/SciReg | app/registration/urls.py | urls.py | py | 249 | python | en | code | 1 | github-code | 90 |
34487486455 | """
A CLI engine with ctypes that moves the cursor arround and sutff.
This module is meant to be imported and used to handle the output to
the terminal
Typical usage example:
import arrays
BUFFER = arrays.Buffer()
BUFFER.set_string(5,5, 'hello')
BUUFER.flush()
"""
import ctypes
from ctypes import c_long, ... | cat-lover-of-doom/CLI-wasted-time | buffer_ex.py | buffer_ex.py | py | 6,924 | python | en | code | 1 | github-code | 90 |
13395029678 | from dataclasses import dataclass
from typing import Any, Tuple, Union
# GoLang
@dataclass
class MathResult:
value: float
success: bool
description: str
def div01(a, b: int) -> MathResult:
if b == 0:
return MathResult(value=0, success=False, description="Divison by zero")
else:
... | husnusensoy/python-workshop | week5/day2/session2/simple_div.py | simple_div.py | py | 4,842 | python | en | code | 2 | github-code | 90 |
17932260749 | import heapq
H, W = map(int, input().split())
graph = []
wall = []
for _ in range(10):
graph.append(list(map(int, input().split())))
for _ in range(H):
wall += list(map(int, input().split()))
def dijkstra(s):
INF = 10**5
hq = [(0, s)]
heapq.heapify(hq)
cost = [INF] * 10
cost[s] = 0
while hq:
c, ... | Aasthaengg/IBMdataset | Python_codes/p03546/s623748036.py | s623748036.py | py | 705 | python | en | code | 0 | github-code | 90 |
11028666113 | """
Add new Appr-specific tables.
Revision ID: 610320e9dacf
Revises: 5cbbfc95bac7
Create Date: 2018-05-24 16:46:13.514562
"""
# revision identifiers, used by Alembic.
revision = "610320e9dacf"
down_revision = "5cbbfc95bac7"
import sqlalchemy as sa
from util.migrate.table_ops import copy_table_contents
def upgrade... | quay/quay | data/migrations/versions/610320e9dacf_add_new_appr_specific_tables.py | 610320e9dacf_add_new_appr_specific_tables.py | py | 13,084 | python | en | code | 2,281 | github-code | 90 |
15206265779 | # You are given n triangles. You are required to find how many triangles are unique out of given triangles. For each triangle you are given three integers a, b and c (the sides of a triangle).
# A triangle is said to be unique if there is no other triangle with same set of sides.
# In other words, we have to find frequ... | farhan528/Coding-Problems | Problems/unique_triangle.py | unique_triangle.py | py | 982 | python | en | code | 0 | github-code | 90 |
319985934 | import sys
from typing import Tuple, Union
from torchvision import models
from torchvision.models import ResNet18_Weights, ResNet34_Weights, ResNet50_Weights, ResNet101_Weights, ResNet152_Weights
from net.model.backbone.ResNet.MyResNet101 import MyResNet101
from net.model.backbone.ResNet.MyResNet152 import MyResNet15... | cirorusso2910/GravityNet | net/model/backbone/MyResNet_models.py | MyResNet_models.py | py | 3,249 | python | en | code | 7 | github-code | 90 |
69872133417 | # BFS
from collections import deque
def bfs(tree_graph, start, visited_tf):
# queue 구현을 위해 deque 라이브러리 사용
queue = deque([start])
visited[start] = True
# queue가 빌때까지 반복
while queue:
# queue에서 원소 하나 뽑아 출력
v = queue.popleft()
print(v, end=" ")
# 해당 원소와 연결된, 아직 방문하지 않은 ... | EKYoonD/PythonPractice | CodingTest/codingpractice20.py | codingpractice20.py | py | 745 | python | ko | code | 0 | github-code | 90 |
25444389567 | import collections
from pprint import pprint
course = collections.namedtuple('course', ['name', 'field', 'attendee', 'remote'])
poop = course(name='poop', field='python', attendee=10, remote=False)
bdpy = course(name='bdpy', field='python', attendee=15, remote=True)
pykt = course(name='pykt', field='python', attendee... | viviyin/bdpy | demo22_fp6.py | demo22_fp6.py | py | 765 | python | en | code | 0 | github-code | 90 |
43213001714 | # encoding: utf-8
# !/usr/bin/env python
import configparser
import time
import os
from http import cookiejar
# import requests
import datetime
from requests_html import HTMLSession
import wechat
import pandas as pd
import numpy as np
import operator
import json
from time import sleep
import getpass
class Announcem... | siegjan6/coin2021 | program/爬虫/announcement.py | announcement.py | py | 3,609 | python | en | code | 3 | github-code | 90 |
714977466 | import logging
import numpy as np
import traceback
import scipy.stats as stats
from scipy.optimize import minimize_scalar, dual_annealing, differential_evolution
from sklearn.neighbors import KernelDensity
from scipy.spatial import distance
from scipy.stats import gaussian_kde
from rpy2.robjects.packages import importr... | unmtransinfo/PULSNAR | PULSNAR/puestimator/AlphaEstimate.py | AlphaEstimate.py | py | 10,054 | python | en | code | 3 | github-code | 90 |
10759545142 | #Import
from sys import exit
#Variables
promp = "> "
global maquina
precio_base = input("Precio Base: ")
float_pb = float(precio_base)
tipo_maquina = input("Que tipo de maquina quieres: \n 1.Low Boy\n 2.Big Arcade\n 3.Bartop\n 4.Arcade Pared\n"+promp)
#Funciones
def tipomaquina():
global maquina
if... | josemapi2012/calculadora_arcades | main.py | main.py | py | 6,348 | python | es | code | 0 | github-code | 90 |
41578509222 | import numpy as np
from sklearn.preprocessing import normalize
from math import pi
class OverlapNetwork(object):
"""
An attractor network made of two separate ring attractors: a place network
and an episode network. The two networks may overlap to a user-specified
amount.
In this model, one timest... | chingf/mixed-attractor-network | Network.py | Network.py | py | 11,721 | python | en | code | 0 | github-code | 90 |
33486475506 | from src import project_directory
import os
import platform
home_directory = os.path.expanduser('~')
data_directory = os.path.join(home_directory,'news', 'data')
database_directory = os.path.join(project_directory,'database')
cache_directory = os.path.join(home_directory, 'news', 'cache')
src_files = os.path.join(proje... | vipinanandcpp/News | src/settings.py | settings.py | py | 871 | python | en | code | 0 | github-code | 90 |
38898026516 | import pandas as pd
import matplotlib.pyplot as plt
import git
url = 'https://github.com/RikoWatanabe/MentalHelse.git'
to_path = 'ADS'
git.Repo.clone_from(
url,
to_path)
def main():
data = pd.read_csv('prevalence-by-mental-and-substance-use-disorder.csv')
population_data = pd.read_csv('prevalence-of... | RikoWatanabe/MentalHelse | src/mental_health_and_prevalence.py | mental_health_and_prevalence.py | py | 2,238 | python | en | code | 0 | github-code | 90 |
10994142650 | import detector_core
# SETTINGS
_settings = {
"IMAGE_FILE_NAME": "shirt (6).jpg",
"PIXELS_PER_INCH": 40,
"ACCEPTED_TOLERANCE_INCHES": 0.2,
"QUALITY_TOLERANCE_INCHES": 0.04,
"WIDTH_PERCENTAGE_OF_SCANNING_AREA": 30
}
detector_core.detection_api_detect_from_image(_settings)
| nipunasudha/shirt-button-detection | images_detect_buttons.py | images_detect_buttons.py | py | 294 | python | en | code | 0 | github-code | 90 |
73944662696 | # (set-logic LIA)
# (synth-fun max ((x Int) (y Int)) Int
# ((Start Int) (StartBool Bool))
# ((Start Int (0 1 x y
# (+ Start Start)
# (- Start Start)
# (ite StartBool Start Start)))
# (StartBool Bool ((and StartBool StartBool)
# (not StartBool)
# ... | yiming-fang/PyGuS | tests/test1.py | test1.py | py | 3,238 | python | en | code | 2 | github-code | 90 |
17928621179 | s = list(map(str,input()))
from collections import Counter
l = Counter(s)
abc = [l["a"],l["b"],l["c"]]
mx = max(abc)
mi = min(abc)
md = sum(abc)-mx-mi
if mx-mi == 1 or mx-mi == 0:
print("YES")
else:
print("NO") | Aasthaengg/IBMdataset | Python_codes/p03524/s099393955.py | s099393955.py | py | 214 | python | en | code | 0 | github-code | 90 |
27872426603 | import numpy as np
import torch
from torch.utils.data import DataLoader
from torchtext.datasets import IWSLT2017
from tokenizers import Tokenizer, normalizers, decoders
from tokenizers.models import BPE
from tokenizers.trainers import BpeTrainer
from tokenizers.normalizers import NFD, Lowercase, StripAccents
from token... | guyjacoby/original-transformer-pytorch | src/utils/data_utils.py | data_utils.py | py | 6,939 | python | en | code | 0 | github-code | 90 |
33564934814 | from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns = [
path("", views.index, name="index"),
path("login", views.login_view, name="login"),
path("logout", views.logout_view, name="logout"),
path("register", views.reg... | oi19/Gym | gym/urls.py | urls.py | py | 780 | python | en | code | 0 | github-code | 90 |
14052575965 | import pygame
import time
from settings import Settings
pygame.init()
s = Settings()
class ProgressBar:
# x and y are temporary testing variables. when done, remove ALL code involving the two. Pos is a set of defined y positions.
def __init__(self, length, color, pos):
displayRect = s.di... | kuhatje/workflow | progress_bar.py | progress_bar.py | py | 1,629 | python | en | code | 0 | github-code | 90 |
10610573018 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Package for for vectorizing documents
"""
import os
from typing import List, Tuple
from gensim.models import KeyedVectors
import numpy as np
from config import GLOVE_DIR
class Vectorizer:
"""
Transform a string into a vector representation
"""
... | FloP13/Ttmt_langage_naturel | amazon_reviews/document/vectorizer.py | vectorizer.py | py | 3,387 | python | en | code | 0 | github-code | 90 |
73565487656 | from pymongo import MongoClient
from gridfs import GridFS
import bson.binary
cliente = MongoClient('mongodb://localhost:27017')
class TextoNoSQL():
def __init__(self,):
self.database = cliente['web_depresion']
# crear una colección para cada objeto
self.coleccion = self.database['texto']
... | juanma7809/prueba_web_Audio | modelsNoSQL/Texto.py | Texto.py | py | 1,883 | python | es | code | 0 | github-code | 90 |
18512458779 | from math import fabs
A_num = list(map(int, input().split()))
def func(a,b,c):
cost = 0
cost += fabs(A_num[b]-A_num[a])
cost += fabs(A_num[c]-A_num[b])
return cost
print(int(min(func(0,1,2),func(0,2,1),func(1,0,2),func(1,2,0),func(2,0,1),func(2,1,0)))) | Aasthaengg/IBMdataset | Python_codes/p03292/s417183619.py | s417183619.py | py | 272 | python | en | code | 0 | github-code | 90 |
22307626368 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 20 18:39:06 2020
@author: erikarivadeneira
"""
#%%CARGANDO LIBRERIAS----------------------------------------------------------
import numpy as np
#%%FUNCIONES ADICIONALES
#Función norma para vectores
def Normalizar(v1, num):
n = len(v1)
for... | ErikaRiv/Numerical-Methods-CIMAT- | Potencia_deflación.py | Potencia_deflación.py | py | 5,515 | python | es | code | 0 | github-code | 90 |
18296419499 | from collections import defaultdict
from collections import deque
from collections import OrderedDict
import itertools
from sys import stdin
input = stdin.readline
class Eratos:
def __init__(self, n):
import math
self.all = []
self.is_prime = [True]*(n+1)
self.is_prime[0] = False
self.is_prime[... | Aasthaengg/IBMdataset | Python_codes/p02819/s723581646.py | s723581646.py | py | 763 | python | en | code | 0 | github-code | 90 |
18588825189 | N = int(input())
A = list(map(int, input().split()))
ans = float("inf")
for i in range(N):
a = A[i]
ans_tmp = 0
while a%2==0:
a = a//2
ans_tmp += 1
ans = min(ans_tmp, ans)
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03494/s062070246.py | s062070246.py | py | 200 | python | en | code | 0 | github-code | 90 |
14064121451 | from improver import cli
from improver.constants import DEFAULT_TOLERANCE
@cli.clizefy
def process(
actual: cli.inputpath,
desired: cli.inputpath,
rtol: float = DEFAULT_TOLERANCE,
atol: float = DEFAULT_TOLERANCE,
*,
ignored_attributes: cli.comma_separated_list = None,
) -> None:
"""
Co... | metoppv/improver | improver/cli/compare.py | compare.py | py | 1,151 | python | en | code | 95 | github-code | 90 |
43136616473 | import pygame
from pytmx.util_pygame import load_pygame
from scripts.common.tile import Tile
class Tilemap:
def __init__(
self,
path: str,
**kwargs: dict[str, pygame.sprite.Group],
) -> None:
self.game_map = load_pygame(path, pixelalpha=True)
self.all_sprites = kwargs... | lsglucas/hurricane-in-hawaii | scripts/common/tilemap.py | tilemap.py | py | 1,262 | python | en | code | 0 | github-code | 90 |
25859983878 | from django.shortcuts import render, get_list_or_404, get_object_or_404
from .models import Receita
def index(request):
receitas = Receita.objects.all()
dados={ #a variavel dados é um dicionário de dados, indicado por {}
'receitas' : receitas
}
return render ( request,'index.html',... | DanielCastelo/Receitas | receitas/views.py | views.py | py | 579 | python | pt | code | 0 | github-code | 90 |
40463087428 | import sys
import re
import random
import werkzeug
werkzeug.cached_property = werkzeug.utils.cached_property
from robobrowser import RoboBrowser
import datetime
import csv
import os
#Mobile user agent strings found on https://deviceatlas.com/blog/mobile-browser-user-agent-strings
mobile_agent = [
#Safari f... | praveen-manohar/digiter | grank.py | grank.py | py | 7,139 | python | en | code | 4 | github-code | 90 |
22444353613 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : train.py
# @Author: LauTrueYes
# @Date : 2021-11-25
import torch
import numpy as np
import torch.optim as optim
from utils import batch_variable
from sklearn import metrics
def train(model, train_loader, dev_loader, config, vocab):
loss_all = np.array([], ... | FreeRotate/TextClassification | train.py | train.py | py | 2,937 | python | en | code | 28 | github-code | 90 |
2889985031 | """Typing test implementation"""
from utils import *
from ucb import main, interact, trace
from datetime import datetime
###########
# Phase 1 #
###########
def choose(paragraphs, select, k):
"""Return the Kth paragraph from PARAGRAPHS for which SELECT called on the
paragraph returns true. If there are few... | akshay-patel-y/cats | typing.py | typing.py | py | 10,298 | python | en | code | 0 | github-code | 90 |
31257038557 | T = int(input())
nums = [int(input()) for _ in range(T)]
max_num = max(nums)
dp = [0] * (max_num+1)
for i in range(1,max_num+1):
now = dp[i-1]
if i-(now+1) >= (now+1)**2:
dp[i] = dp[i-1] +1
else :
dp[i] = now
for i in nums :
print(dp[i]) | sungwoo-me/Algorithm | 백준/브루트포스/10419.py | 10419.py | py | 277 | python | en | code | 0 | github-code | 90 |
2157866560 | '''
You are going to develop an application to produce numbers in a sequence.
The user will be required to enter a number, and for that number, you will:
* Divide the number by 2 if it is even
* Multiply the number by 3, and add 1 if it is odd.
* Do this until you get to 1.
Ask the user if he/she wo... | shaylatheroo/ImmersiveDAProjects | Collatz_Sequence.py | Collatz_Sequence.py | py | 1,230 | python | en | code | 0 | github-code | 90 |
18406779439 | import queue
import sys
sys.setrecursionlimit(10**6)
N, M = map(int, input().split())
XYZ = []
for _ in range(M):
XYZ.append(tuple(map(int, input().split())))
G=[[] for _ in range(N+1)]
for el in XYZ:
G[el[0]].append(el[1])
G[el[1]].append(el[0])
#print(G)
seen=[False]*(N+1)
todo=queue.Queue()
def bfs(n)... | Aasthaengg/IBMdataset | Python_codes/p03045/s455359408.py | s455359408.py | py | 518 | python | en | code | 0 | github-code | 90 |
37832512215 | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 27 13:12:34 2018
@author: 李立宗 lilizong@gmail.com
《opencv图穷匕见-python实现》 电子工业出版社
"""
import matplotlib.pyplot as plt
o=cv2.imread("rice.png",cv2.IMREAD_UNCHANGED)
k=np.ones((5,5),np.uint8)
e=cv2.erode(o,k)
b=cv2.subtract(o,e)
plt.subplot(131)
plt.imshow(o)
plt.axis('off'... | taochangwan/learnOpencv | 源代码及图像/chapter17/例17.1.py | 例17.1.py | py | 453 | python | en | code | 1 | github-code | 90 |
22998114481 | #!/usr/bin/python3
#LCG:
#X(N+1) = (X(N) * A + C) mod M
#--- нахождение инкремента ---
#A = 178521
#M = 1587518778589
#
#X0 -> X1
#
#X1 = (A * X0 + C) mod M
#
#(X1 - X0 * A) mod M = C
# --- нахождение множитель ---
# M = 1587518778589
# X1 = (X0 * A + C) mod M
# X2 = (X1 * A + C) mod M
# X2 - X1 = ((X1 * A + C) ... | kurkotoff/lcgHack | lcgHack.py | lcgHack.py | py | 3,067 | python | en | code | 0 | github-code | 90 |
40329916205 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 图片4通道转3通道 (转换RBGA图片成RGB)
# RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。虽然它有的时候被描述为一个颜色空间,但是它其实仅仅是RGB模型的附加了额外的信息。
# alpha通道一般用作不透明度参数。如果一个像素的alpha通道数值为0%,那它就是完全透明的(也就是看不见的),而数值为100%则意味着一个完全不透明的像素(传统的数字图像)。在0%和100%之间的值则使得像素可以透过背景显示出来,就像透过玻璃(半透明性),这种效果是简单的二元透明性(透明或不透明)做不到的。... | gswyhq/hello-world | 作图/颜色通道及其转换.py | 颜色通道及其转换.py | py | 4,872 | python | zh | code | 9 | github-code | 90 |
18561411399 | import sys
input = sys.stdin.readline
from itertools import combinations
def read():
N = int(input().strip())
S = []
for i in range(N):
s = input().strip()
S.append(s)
return N, S
def solve(N, S):
Z = [0 for i in range(26)]
for s in S:
a = s[0]
Z[ord(a)-ord("A... | Aasthaengg/IBMdataset | Python_codes/p03425/s116667733.py | s116667733.py | py | 609 | python | en | code | 0 | github-code | 90 |
10366853557 | from tkinter import *
from tkinter import filedialog
root=Tk()
root.geometry('500x600')
root.title('NotePad')
root.iconbitmap('logo.ico')
## functions area
def save_file():
open_file=filedialog.asksaveasfile(mode='w',defaultextension=".txt")
if open_file is None:
return
text = str(entry.get(1.0,END... | alfinarif/Simple-Python-NotePad-For-Beginners | main.py | main.py | py | 929 | python | en | code | 1 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.