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
2563693416
import time import schedule from django.utils import timezone from django.conf import settings from users.models import LandLordPaymentDetails from .models import Payment, TransactionDetail # from .paystack import PayStack # Paystack = PayStack(settings.PAY_SECRET_KEY) # Paystack = settings.PAYSTACK true = True ...
Great-special/Test_Duloft
payment_manager/auto_transfer.py
auto_transfer.py
py
4,317
python
en
code
0
github-code
90
39645833070
command = input() numbers = [int(num) for num in input().split()] def print_results(nums): print(sum(nums) * len(numbers)) def needed_numbers(nums): if command == "Odd": nums = [num for num in nums if num % 2 != 0] else: nums = [num for num in nums if num % 2 == 0] print_results(nums)...
achkataa/Python-Advanced
Functions Advanced/5.Odd or Even.py
5.Odd or Even.py
py
352
python
en
code
0
github-code
90
2374419706
import socket def myfunc(e): return len(e) try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print("Server Socket Creation Successful!") except: print("Server Socket Creation Failed!") print() host = socket.gethostname() port = 3000 s.bind((host, port)) s.listen(5) c, address = s.accept(...
sangzzz/Networks-Lab
Week 3/Q2/server.py
server.py
py
870
python
en
code
0
github-code
90
41344839760
from collections import deque from imutils.video import VideoStream import numpy as np import argparse import cv2 import imutils import time ap = argparse.ArgumentParser() ap.add_argument("-b", "--buffer", type=int, default=64, help="max buffer size") ap.add_argument("-v", "--video", help="path to video file") args = ...
underhmj/ballTracker
ballTracking.py
ballTracking.py
py
2,628
python
en
code
0
github-code
90
70663394218
from abc import ABCMeta, abstractmethod import functools import inspect from typing import ( Any, Callable, Dict, Optional, Sequence, Set, Tuple, Type, Union, cast ) import click from autoclick.core import ( DEC, BaseDecorator, ParameterInfo, SignatureError, ...
jdidion/autoclick
autoclick/composites/__init__.py
__init__.py
py
14,724
python
en
code
11
github-code
90
17146366486
#file to find all connected components in a graph import sys sys.setrecursionlimit(100000) class Graph: # init function def __init__(self,nodes): self.nodes = nodes self.adj = [[] for i in range(nodes)] def DFSUtil(self, temp, v, visited): # Mark the current vertex as visit...
nguyenethan01/graph_analysis
components.py
components.py
py
1,879
python
en
code
0
github-code
90
37523802438
a = input() a = int(a) s = input() mapi = input().split() t = [] flag = False c = 0 for i in range(a): if(s[i]<mapi[int(s[i])-1]): print(mapi[int(s[i])-1], end="") flag = True elif(s[i]==mapi[int(s[i])-1]): print(s[i], end="") elif(flag): break else: print(s[i], end="") c+=1 for i in range(c, a): pri...
emanueljuliano/Competitive_Programming
cf/cf_555/b.py
b.py
py
345
python
en
code
1
github-code
90
6544202242
def Binarysearch(subarr,n): maxm = len(subarr)-1 minm = 0 mid = (maxm+minm)//2 # middle is integer while True: if n >subarr[mid]: minm = mid+1 mid = (maxm+minm)//2 elif n <subarr[mid]: maxm = mid-1 ...
Ankuraxz/Python_DSA
Array/Array Search/Exponential_Search.py
Exponential_Search.py
py
1,163
python
ceb
code
3
github-code
90
42173916583
from datetime import datetime, timedelta def is_weekday(date, date_format): if not isinstance(date, datetime): date = datetime.strptime(date, date_format) # Python's datetime library treats Monday as 0 and Sunday as 6 return (0 <= date.weekday() < 5) def str_to_date(date_str, date_format): r...
qiushiyan/xetra
xetra_jobs/common/utils.py
utils.py
py
1,698
python
en
code
3
github-code
90
18654565948
# This is an implementation of the quicksort algorithm # as taught in CS5800 at Northeastern University Seattle # by Zhifeng Sun. # Author: Heather Fryling # Date: 12/23/2020 import random import itertools as it # Quicksort's best case time complexity is O(nlogn) # worst case = O(n^2) # average = (nlogn) # Worst case...
HeatherFryling/AlgoStudy
SortingSearching/QuickSort/quicksort_from_class.py
quicksort_from_class.py
py
2,704
python
en
code
1
github-code
90
18303219819
import sys input=sys.stdin.readline sys.setrecursionlimit(10**6) n,u,v=map(int,input().split()) node=[[]for _ in range(n)] for _ in range(n-1): a,b=map(int,input().split()) node[a-1].append(b-1) node[b-1].append(a-1) def dfs(i): visited[i]=1 for x in node[i]: if visited[x]==0: dis[x]=dis[i]+1 dfs(x) inf=10...
Aasthaengg/IBMdataset
Python_codes/p02834/s137829178.py
s137829178.py
py
582
python
en
code
0
github-code
90
27290622720
"""Main app roouting file""" from flask import Flask, render_template from app.models import db, Movies import requests def create_app(): """Creates and configures an instance of the flask application""" app = Flask(__name__) app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///db.sqlite3" app.config["S...
rhiag/unit3
Sprint3/movieapp/app/app.py
app.py
py
1,640
python
en
code
0
github-code
90
69880904298
class MaxHeap: def __init__(self, max_size): # Constructor to initialize the MaxHeap object self.max_size = max_size self.arr = [None] * max_size self.heap_size = 0 def heapify(self, idx): # Heapifies the subtree rooted at idx if not self.isLeaf(idx): left = se...
UzairNaeem3/DSA
data_structures/Heap/Max_Heap/max_heap_0_based_indexing.py
max_heap_0_based_indexing.py
py
4,085
python
en
code
0
github-code
90
25336835449
from flask import Flask, request, make_response import csv app = Flask(__name__) @app.route('/') def get_value(): key = request.args.get('key') if key: with open('data.csv', 'rb') as csvfile: data = { row[0] : row[1] for row in csv.reader(csvfile) } value = data.get(key) ...
danthemanvsqz/retrieve_value
retr_val.py
retr_val.py
py
499
python
en
code
0
github-code
90
18518296079
def koubaisu(N,M): NM = N*M if M>N: N,M = M,N while(N%M!=0): Temp = N N = M M = Temp%M return NM//M N = int(input()) print(koubaisu(N,2))
Aasthaengg/IBMdataset
Python_codes/p03307/s628038546.py
s628038546.py
py
185
python
en
code
0
github-code
90
27164921634
class Warrior: def __init__(self, health = 50, attack=5): self.health = health self.attack = attack # self.__is_alive = True @property def is_alive(self): if self.health > 0: return True else: return False class Knight(Warr...
gaidamakinaas/Checkio
incinerator/warrior.py
warrior.py
py
1,467
python
en
code
0
github-code
90
18298049639
def binary_search(*, ok, ng, is_ok): while abs(ok - ng) > 1: mid = (ng + ok) // 2 if is_ok(mid): ok = mid else: ng = mid return ok def main(): from itertools import accumulate N, M = map(int, input().split()) *A, = sorted(map(int, input().split())) ...
Aasthaengg/IBMdataset
Python_codes/p02821/s773607604.py
s773607604.py
py
1,018
python
en
code
0
github-code
90
70338097896
#Importing libraries: import smtplib import time import random import array as arr from datetime import date, datetime from time import gmtime, strftime import busio import digitalio import board import adafruit_mcp3xxx.mcp3008 as MCP from adafruit_mcp3xxx.analog_in import AnalogIn from time import sleep import socket...
borglandlab/RunningWheel
Spinner_Code/spinner_noWIFI.py
spinner_noWIFI.py
py
5,687
python
en
code
2
github-code
90
30155685155
import os import random import xml.etree.ElementTree as ET import cv2 as cv import numpy as np from PIL import Image from scipy.io import loadmat from torch.utils.data import Dataset from utils import BASE_DIR, TRANSFORMS, filter_small_boxes, prepare, swap_axes class VocAndEb(Dataset): CLASS2ID = { "ae...
adursun/wsddn.pytorch
src/datasets.py
datasets.py
py
4,630
python
en
code
47
github-code
90
17324304528
from queue import Queue, Empty from sys import platform from keywatch import Listener if platform == 'linux': from Xlib import XK from Xlib.display import Display d = Display() keycode_names = { 'a': d.keysym_to_keycode(XK.string_to_keysym('a')), 'b': d.keysym_to_keycode(XK.string_to_keysym('b')), } elif pla...
davis-b/keywatch
tests/utils.py
utils.py
py
1,362
python
en
code
0
github-code
90
32513801093
''' 实验名称:超声波传感器 版本:v1.0 日期:20120.3 作者:01Studio 【www.01Studio.org】 说明:通过超声波传感器测距,并在OLED上显示。 ''' from gpiozero import DistanceSensor #导入luma相关库,oled lib from luma.core.render import canvas from luma.oled.device import ssd1306 from time import sleep #初始化oled,I2C接口1,oled地址是0x3c device = ssd1306(port=1, address=0x3c) #...
01studio-lab/RaspberryPi_Examples
2.传感器实验/8.超声波传感器/Distance.py
Distance.py
py
954
python
en
code
10
github-code
90
27093787348
from spack import * class PyFlake8(PythonPackage): """Flake8 is a wrapper around PyFlakes, pep8 and Ned Batchelder's McCabe script.""" homepage = "https://github.com/PyCQA/flake8" url = "https://github.com/PyCQA/flake8/archive/3.0.4.tar.gz" version('3.5.0', '4e312803bbd8e4a1e566ffac887ae647...
matzke1/spack
var/spack/repos/builtin/packages/py-flake8/package.py
package.py
py
2,633
python
en
code
2
github-code
90
10511629441
import PyQt5.QtWidgets as qtw import PyQt5.QtGui as qtg class MainWindow(qtw.QWidget): def __init__(self): super().__init__() # title self.setWindowTitle('Hello world!!!') # set vertical layout self.setLayout(qtw.QVBoxLayout()) # create label my_label = qtw...
NoamElbaum/pyQt5_tutorial
spin_boxes.py
spin_boxes.py
py
1,418
python
en
code
0
github-code
90
6049858167
import re import json import ipinfo accessToken = '9f17e3535e20f4' handler = ipinfo.getHandler(accessToken) ip_address = '216.239.36.21' details = handler.getDetails(ip_address) IP = details.ip org = details.org city = details.city country = details.country region = details.region locat...
jaykv/smart-mobilization-system
drpy/app/locationFinder.py
locationFinder.py
py
508
python
en
code
1
github-code
90
30786963664
from selenium import webdriver import unittest, time from selenium.webdriver.common.by import By from webdriver_manager.chrome import ChromeDriverManager class TestClass(unittest.TestCase): def setUp(self) -> None: self.driver = webdriver.Chrome(ChromeDriverManager().install()) self.driver.get('...
AntonioIonica/Automation_testing
exercices_todo/google_maps.py
google_maps.py
py
979
python
en
code
0
github-code
90
18289498129
MAX = 10 ** 6 MOD = 10 ** 9 + 7 fac = [0] * MAX finv = [0] * MAX inv = [0] * MAX def COMinit(): fac[0] = fac[1] = 1 finv[0] = finv[1] = 1 inv[1] = 1 for i in range(2, MAX): fac[i] = fac[i - 1] * i % MOD inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD finv[i] = finv[i - 1] * inv[...
Aasthaengg/IBMdataset
Python_codes/p02804/s112915891.py
s112915891.py
py
861
python
en
code
0
github-code
90
18593158779
import sys from itertools import product input = sys.stdin.readline def main(): N = int(input()) F = [None] * N for i in range(N): F[i] = tuple(map(int, input().split())) P = [None] * N for i in range(N): P[i] = tuple(map(int, input().split())) ans = -float("inf") for com...
Aasthaengg/IBMdataset
Python_codes/p03503/s415711182.py
s415711182.py
py
699
python
en
code
0
github-code
90
18566982389
from collections import deque h, w = map(int, input().split()) s = [input() for _ in range(h)] cnt = 0 for i in s: cnt += i.count('.') queue = deque([[0, 0]]) visited = [[1] * w for _ in range(h)] visited[0][0] = 0 def bfs(): while len(queue) > 0: h1, w1 = queue.popleft() if h1 == h - 1 and ...
Aasthaengg/IBMdataset
Python_codes/p03436/s980764791.py
s980764791.py
py
809
python
en
code
0
github-code
90
21162547170
import codecs import pytesseract import glob from PIL import Image import difflib pytesseract.pytesseract.tesseract_cmd = 'C:\Program Files\Tesseract-OCR\\tesseract.exe' #mylist = [f for f in glob.glob("../generate-images-java/Output/*")] #mylist = [f for f in glob.glob("../generate-images-java/testout/*")] #mylist =...
Sangeerththan/OCRSinhala
Accuracy checker/check-tes-dic.py
check-tes-dic.py
py
1,035
python
en
code
1
github-code
90
70725665258
# -*- coding: utf-8 -*- # check scheduler job exception and send notify message def start(): from datetime import datetime from django_apscheduler.models import DjangoJobExecution from webull_trader.models import NotifiedErrorExecution from common import feishu # from scripts import clear_position...
usunyu/webull-trader
scripts/check_exception.py
check_exception.py
py
2,017
python
en
code
0
github-code
90
35447894470
if "__file__" in globals(): import os, sys sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import math import numpy as np from tensorslow import Variable, Function from tensorslow.utils import plot_dot_graph def f(x): y = x ** 4 - 2 * x ** 2 return y def gx2(x): return 12 * x ** 2 -...
chihpy/TensorSlow
steps/step29_newton_method_by_hand.py
step29_newton_method_by_hand.py
py
493
python
en
code
0
github-code
90
18364489949
#-*-coding:utf-8-*- import sys input=sys.stdin.readline import numpy as np def main(): n = int(input()) mob=np.array(list(map(int,input().split())),dtype=int) bra=np.array(list(map(int,input().split())),dtype=int) ans=0 for i in range(n): ans += min(mob[i],bra[i]) ans += min(mob[i+...
Aasthaengg/IBMdataset
Python_codes/p02959/s052133972.py
s052133972.py
py
460
python
zh
code
0
github-code
90
18262288779
n, m = map(int, input().split()) ans = [-1 for _ in range(n)] for _ in range(m): s, c = map(int, input().split()) if ans[s - 1] in [c, -1]: ans[s - 1] = c else: print(-1) exit() if ans[0] == 0: if n == 1: print(0) else: print(-1) exit() if ans[0] == -1: ...
Aasthaengg/IBMdataset
Python_codes/p02761/s403150880.py
s403150880.py
py
499
python
en
code
0
github-code
90
36123167856
import pandas as pd import ipywidgets as widgets from IPython.core.display import display, HTML import plotly.express as px from plotly.subplots import make_subplots import plotly.graph_objects as go def eda_cat_vs_target_binary(dataframe): '''dataframe: pd.DataFrame''' dataframe_cat = dataframe.select_dtypes(...
MTereM/Bank-Marketing
eda_cat_vs_target_binary.py
eda_cat_vs_target_binary.py
py
6,836
python
en
code
0
github-code
90
21101726265
import requests from bs4 import BeautifulSoup response = requests.get(url="https://www.empireonline.com/movies/features/best-movies-2/") movies_list_page = response.text soup = BeautifulSoup(movies_list_page, "html.parser") # print(soup.prettify()) # movies = soup.find_all(name="h3", class_="listicleItem_listicle-ite...
ShazadOutar/100-Days-of-Code
Day45-Web-Scraping-with-Beautiful-Soup/main.py
main.py
py
942
python
en
code
0
github-code
90
42149109487
# multiAgents.py # -------------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berke...
Jackie-Lian/cs188-multiagent
multiAgents.py
multiAgents.py
py
16,515
python
en
code
0
github-code
90
9098346480
# -*- coding: utf-8 -*- """4_Listas.ipynb Prof. Fernando Amaral www.eia.ai # Listas ## List """ array = [] array = list() array_numeros = [1,2,3] array_floats = [56.3, -2.2, 0.5] array_str = ["A","B","C"] array_misto = [ 2,2.3,"ABC"] print(array) print(array_numeros) print(array_floats) print(array_str) print(ar...
claudiaanjos/curso-python
aulas/4-listas/00.atividades.py
00.atividades.py
py
9,620
python
pt
code
2
github-code
90
44158111699
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('product', '0016_product_id_1c'), ] operations = [ migrations.AddField( model_name='category', name='...
denispan1993/vitaliy
applications/product/migrations/0017_category_bottom_description.py
0017_category_bottom_description.py
py
574
python
en
code
0
github-code
90
22028896722
# -*- coding: utf-8 -*- """ 爬取九游文章数据 @author: hch @date : 2020/10/13 """ import scrapy from scrapy.http.response.html import HtmlResponse from urllib.parse import urlparse class NineGameSpider(scrapy.Spider): domain_xpath = { 'www.9game.cn': '//div[contains(@class,"article-page-con")]/div[@class="text-...
kjhch/blog-demo
blog-python-demo/scrapy/scrapy_tutorial/scrapy_tutorial/spiders/nine_game_spider.py
nine_game_spider.py
py
1,479
python
en
code
1
github-code
90
21461153391
from django.views.generic.base import TemplateView from rest_framework import viewsets, generics, views from rest_framework.exceptions import NotFound, APIException from rest_framework.response import Response from rest_framework.response import Response from rest_framework.views import APIView from .models import Com...
himanshir21/paranuara
paranuara/views.py
views.py
py
2,467
python
en
code
0
github-code
90
36855409985
# first_name = "Benson" # last_name = "Ibeabuchi" # # print(len(last_name)) # # print(last_name[-3:]) # # list is identified with square brackets. a list permits different types of values inside # numbers = [2, 4, [6, 8], 10] # numbers[0] = 3 # # print(numbers) # a = [9, 3, 8] # b = [4, 5, 6] # c = a + b # # prin...
bensonibeabuchi/6b4_backend
Drills.py
Drills.py
py
5,179
python
en
code
0
github-code
90
13835775341
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 15 21:57:48 2022 @author: yamamotod """ """ Посчитать, сколько раз встречается определенная цифра в введенной последовательности чисел. Количество вводимых чисел и цифра, которую необходимо посчитать, задаются вводом с клавиатуры. """ import unitt...
Harddancer/Algoritm_Python
Task alg2_5.py
Task alg2_5.py
py
946
python
ru
code
0
github-code
90
70164041258
from flask import Flask, render_template, request, jsonify from flask_cors import CORS app = Flask(__name__) CORS(app, resources=r'/*') import json @app.route('/',methods=['POST'])#这里设置一下ajax的url def ba(): data = request.json.get('text') data = eval(data) filename = "target.json" with open(filename, ...
Darel777/DataSci_nlp
creep/html/JSONDOWNLOAD.py
JSONDOWNLOAD.py
py
457
python
en
code
2
github-code
90
3492044771
import scrapy from CampingWorld.items import CampingworldItem import re import pandas as pd class CwSpider(scrapy.Spider): name = 'CW' allowed_domains = ['rv.campingworld.com'] start_urls = ['https://rv.campingworld.com/state-directory'] states_dict = {'AL': 'ALABAMA', 'AZ': 'ARIZONA',...
polltter/RV
CampingWorld/CampingWorld/spiders/CW.py
CW.py
py
3,397
python
en
code
0
github-code
90
38159296111
''' Programa que lê um valor (validando a entrada para que ela seja um número inteiro maior ou igual a dois) e informa se esse valor é um número primo ''' valor = 0 while valor < 2: valor = int(input("Informe um valor: ")) for div in range(2, valor): if valor % div == 0: print(f"O número {valor} nã...
Only-S/aulas-atitus
AulasBackendPython/1º Semestre/1.Códigos Fontes das Aulas/33 (Lucas) Código-Fonte Aula 06/10-primo.py
10-primo.py
py
399
python
pt
code
0
github-code
90
71735355497
import matplotlib.pyplot as plt from math import log2, floor def draw_arrow(plt, arr_start, arr_end, color): dx = arr_end[0] - arr_start[0] dy = arr_end[1] - arr_start[1] plt.arrow(arr_start[0], arr_start[1], dx, dy, head_width=0.1, head_length=0.2, length_includes_head=True, color=color) def sh...
anirudhprabhakaran3/sodc-assignment
boolalg/visualisation/visualisation.py
visualisation.py
py
1,991
python
en
code
0
github-code
90
70298135018
import numpy as np import torch import utils def disregard_points_within_ball(data_unscaled, reference_point_unscaled, distance): """ Remove all points that are within a specified distance around a reference point. Evaluated in normalised coordinates and using the infinity norm :param data_...
jbesty/irep_2022_closing_the_loop
utils/verfication_helpers.py
verfication_helpers.py
py
3,274
python
en
code
5
github-code
90
72976809578
from sklearn.ensemble import RandomForestClassifier from sklearn.datasets import make_classification from sklearn.tree import DecisionTreeClassifier from sklearn.naive_bayes import GaussianNB import numpy as np from collections import defaultdict class NaiveBayesModelTreeClassifier(DecisionTreeClassifier): """ ...
elisim/Applied-Machine-Learning
assignment1/classifiers/random_forest_with_naive_bayes.py
random_forest_with_naive_bayes.py
py
6,349
python
en
code
3
github-code
90
34322514134
import itertools from django.shortcuts import render, redirect from eshop_sliders.models import Slider from eshop_products.models import Product from eshop_settings.models import SiteSettings # Header Code Behind def header(request, *args, **kwargs): site_settings = SiteSettings.objects.first() context = { ...
rahimaee/eshop
eshop/views.py
views.py
py
1,574
python
en
code
1
github-code
90
68877276
import os import jieba import numpy as np def get_feature_word(file_path): words = [] f = open(file_path,encoding='utf-8') lines = f.readlines() for line in lines: words.append(line.strip()) # print(words) return words class QuestionClassifier: def __init__(self): cur_dir = os.path.split(os.path.realpat...
JaniceWuo/PoetryQA
question_classifier.py
question_classifier.py
py
5,229
python
en
code
7
github-code
90
11283718539
import cv2 import sys import cvlib as cv import threading import time import requests import os os.environ['NO_PROXY'] = '127.0.0.1' frames = [] ROOM_NAME = 'B350' faces = [] iteration = 0 maxValue = 0 class ImageGrabber(threading.Thread): def __init__(self, ID): threading.Thread.__init__(self) ...
softeng-feup/open-cx-bit-counter
rpi/OpenCV.py
OpenCV.py
py
2,184
python
en
code
0
github-code
90
43228953420
# coding=utf8 import sublime,sublime_plugin,os,json MTOOLS_PKGNAME = "MyTools" USER_SETTING_FILE = MTOOLS_PKGNAME+".sublime-settings" DEFAULT_SETTING_RESOURCE = "Packages/"+MTOOLS_PKGNAME+"/"+USER_SETTING_FILE USER_CONTEXT_FILE = "Context.sublime-menu" def create_menu_children(): children=[] for path in s.get...
newnight/MyTools
MTools.py
MTools.py
py
3,790
python
en
code
2
github-code
90
71690364778
# Add folders to python path to run this from command line import sys import os # NOTE: Adjust the number of ".." to get to the project's root directory (i.e. where doc, ex, and ss are, NOT inside ss # where cim, util, etc. are) sys.path.append(os.path.normpath(os.path.join(os.path.abspath(os.path.dirname(__file__)), "...
lipusal/ss
python/ss/final/na-sch.py
na-sch.py
py
7,780
python
en
code
0
github-code
90
19443817395
import functools import logging import traceback def catch_exception(func): @functools.wraps(func) def catch_exception_wrapper(*args, **kwargs): try: funcRet = func(*args, **kwargs) return funcRet except Exception as e: retMsg = "[EXCEPTION]: 函数[%s]异常:%s" % (...
LianjiaTech/sosotest
AutotestWebD/apps/common/func/WebNormalFunctions.py
WebNormalFunctions.py
py
545
python
en
code
489
github-code
90
25007810784
from typing import List, Optional, Any, Dict # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def increasingBST(self, root: TreeNode) -> TreeNode: def dfs(r...
hvijaycse/Leetcode
Weekly Contest 289/897.py
897.py
py
1,397
python
en
code
0
github-code
90
44087440019
from collections import OrderedDict import json import os import numpy as np def get_max_len_max_len_a(data_bundle, max_len=10): """ :param data_bundle: :param max_len: :return: """ max_len_a = -1 for name, ds in data_bundle.iter_datasets(): if name=='train':continue src_se...
drrndrrnprn/ABST
BARTABSA/peng/model/utils.py
utils.py
py
3,731
python
en
code
0
github-code
90
31480351521
#!/usr/bin/python import time import serial # "/dev/ttyUSB0", port =serial.Serial( "/dev/ttyUSB0", baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, writeTimeout = 0, timeout = 10) # $serial->sendMessage("\xFF\x01\x01"); #data=...
jones2126/tractor_laptop_ROS_workspace
project_support_files/python/usb_8_channel_relay_test_1.py
usb_8_channel_relay_test_1.py
py
656
python
en
code
0
github-code
90
9346506964
import numpy as np import cv2 from PySide6.QtWidgets import * from PySide6.QtCore import * from PySide6.QtGui import * import sys import numpy as np import threading import time import redis import kafka import sounddevice as sd import soundfile as sf class Window(QMainWindow): def __init__(self): super()....
SimonPlazar/Projekt-repo
driver_attention_monitoring/start-up/SISvideo.py
SISvideo.py
py
10,053
python
en
code
0
github-code
90
9164759885
import time, itertools start_time = time.time() with open("18.txt", "r") as file: lines = [line.strip() for line in file.readlines()] data = {tuple(map(int, line.split(","))) for line in lines} neighbours = [(1, 0, 0), (-1, 0, 0), (0, 1, 0), (0, -1, 0), (0, 0, 1), (0, 0, -1)] print(sum(sum(0 if (cube[0]+x, c...
rrickfox/AdventOfCode
2022/18.py
18.py
py
1,307
python
en
code
0
github-code
90
37119901624
import tensorflow as tf import os from glob import glob # Remove all files previously created in this script try: os.remove('./checkpoint') except FileNotFoundError: pass for i in range(100): # one iteration per file try: os.remove(glob('./*model.ckpt*.*', recursive=False)[0]) #...
ivanbgd/Udacity-Deep-Learning-ND101
03_CNNs/03_Deep_NNs/06_save_and_restore.py
06_save_and_restore.py
py
5,192
python
en
code
1
github-code
90
32405087520
import resampy import torch #from .audio_utils import MAX_WAV_VALUE, mel_spectrogram, normalize from scipy.io.wavfile import read from librosa.util import normalize from librosa.filters import mel as librosa_mel_fn import os, sys from speaker_encoder.voice_encoder import SpeakerEncoder from speaker_encoder.audio import...
warisqr007/vc-spk-loss
3_compute_spk_dvecs_2.py
3_compute_spk_dvecs_2.py
py
6,509
python
en
code
0
github-code
90
73549791976
import cPickle import operator import os import re import requests import time import pandas as pd from bs4 import BeautifulSoup class CollectNewUser(): def __init__(self, popular_games): self.popular_games = popular_games self.uid = self.determine_user_input() self.key = os.environ["ACCE...
johnnysand7/steam-study
script/collect_new_user.py
collect_new_user.py
py
5,665
python
en
code
0
github-code
90
26091808159
from flask import Flask, jsonify, request import time import requests import threading import os app = Flask(__name__) class WebsiteChecker(threading.Thread): def __init__(self, website, interval, status_code): threading.Thread.__init__(self) self.website = website self.status = None ...
Moiseicho/WOT-App
api.py
api.py
py
2,551
python
en
code
0
github-code
90
1661171670
from django import forms from django.template.loader import get_template from django.core.mail import EmailMultiAlternatives from captcha.fields import CaptchaField class ContactForm(forms.Form): contact_name = forms.CharField() contact_email = forms.EmailField() contact_phone = forms.CharField() co...
paulnicholsen27/tutoring
mainsite/forms.py
forms.py
py
1,593
python
en
code
0
github-code
90
7436760228
import logging from minimax.patate import Patate from minimax.minimax import Minimax from minimax.smartminimax import SmartMinimax from randomplayer import RandomPlayer from context import TurnContext from piece import create_listofpieces from grid import Grid class Game: def configure(self): logging.basi...
Martin-Renaud/quarto-python-o
src/game.py
game.py
py
1,863
python
en
code
0
github-code
90
16656573901
''' Lin Huang EE660 Project: Facebook Comment Volume Predicition Regression: Using LASSO algorithm to predict the comment volume Cross Validation is used to do model selection with respect to different lambda MAE, Hits, and AUC 3 types of error measure are utilized Parameter: numOfRun: number of iterations numOfFold: ...
whosyourfarmer/machine_learning
Regression/LASSO_Rand.py
LASSO_Rand.py
py
4,293
python
en
code
0
github-code
90
43813907444
# intro def average(array): # your code goes here s = set(array) # print(s) return sum(s)/len(s) # no idea input() arr = input().split() a,b = (set(input().split()) for i in range(2)) print(sum((i in a) - (i in b) for i in arr)) # symmetric difference a,b = [set(input().split(' ')) for i in ran...
SlipShabby/Hackerrank
Python/sets.py
sets.py
py
2,079
python
en
code
0
github-code
90
33690339927
import json import re from nltk.metrics import accuracy import os from .utils import * eval_type = 'dev' orginal_data_path = "~/snowball/data/spider/raw/" mapping_path = "~/snowball/data/spider/preprocessed/{}.json".format(eval_type) raw_test_path = "~/snowball/data/spider/raw/{}.json".format(eval_type) result_json_p...
AlibabaResearch/DAMO-ConvAI
star/data_systhesis/snowball/preprocess/sql_auto_evaluation/eval.py
eval.py
py
11,898
python
en
code
781
github-code
90
18253656569
a,b,c=map(int,input().split()) def ab_lt_c(a,b,c): d=c-a-b if d>0 and d*d > 4*a*b: return 'Yes' else: return 'No' print(ab_lt_c(a,b,c))
Aasthaengg/IBMdataset
Python_codes/p02743/s742196176.py
s742196176.py
py
153
python
en
code
0
github-code
90
23103578618
""" Class to explain query plan (without execution) """ import json import logging import psycopg2 from query_plan_parser.parser import parse_plan from voice_the_string.vocalize import Vocalizator class Explain: """ Class to explain query """ def __init__( self, host, port, dbname, user, password...
cacad-ntu/vocalize-your-plan
query_executor/explain_query.py
explain_query.py
py
3,141
python
en
code
4
github-code
90
34932670614
import numpy as np import logging import os import sys import fixed_network_env as f_env import meppo as network import tensorflow as tf os.environ['CUDA_VISIBLE_DEVICES'] = '-1' S_DIM = [4, 20] #[4, 224, 224, 3] A_DIM = 21 N_DIM = 6 ACTOR_LR_RATE =1e-4 RANDOM_SEED = 42 RAND_RANGE = 1000 # log in format of time_stam...
thu-media/deepladder
deepladder-cbr/rl_test.py
rl_test.py
py
2,687
python
en
code
2
github-code
90
71447709737
import subprocess import csv from PIL import Image from PIL import ImageDraw from PIL import ImageFont archivo=input("Ingrese el nombre del archivo con el listado de sitios a revisar: ") rutaout=input("Ingrese el nombre del archivo de salida: ") correlativo = input("Ingrese su correlativo: ") rutaout = ru...
Crypt0Cr1s/scanheaders
headers.py
headers.py
py
3,426
python
es
code
0
github-code
90
18314316069
""" 参考 yy4さん 2019-11-24 21:24:43 516 ms PyPy3 (2.4.0) """ #def solve(): from collections import deque import sys input = sys.stdin.readline n = int(input()) connection = tuple(set() for _ in range(n)) for idx in range(n - 1): a, b = (int(x) - 1 for x in input().split()) connection[a].add((b, idx)...
Aasthaengg/IBMdataset
Python_codes/p02850/s875171875.py
s875171875.py
py
962
python
en
code
0
github-code
90
71791368937
from models import networks from torchvision import transforms as T from PIL import Image import torch from util.util import tensor2im transforms = T.Compose([ T.Resize([256, 256], Image.BICUBIC), T.RandomCrop(256), T.ToTensor(), T.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)) ]) def __patch_instance_...
LIMr1209/machine-learn
style_migration/demo_cycle.py
demo_cycle.py
py
2,324
python
en
code
6
github-code
90
4239184128
# # @lc app=leetcode id=32 lang=python3 # # [32] Longest Valid Parentheses # # @lc code=start class Solution: def longestValidParentheses(self, s: str) -> int: n = len(s) if n == 0: return 0 max_ = 0 idx_stack = [-1] for i, cur_tok in enumerate(s): ...
wangyerdfz/python_lc
32.longest-valid-parentheses.py
32.longest-valid-parentheses.py
py
1,383
python
en
code
0
github-code
90
9814287212
import pandas as pd from glob import glob import argparse import cv2 import os.path as osp import numpy as np import torch from tqdm import tqdm import cpbd def read_mp4(input_fn, to_rgb=False, to_gray=False, to_nchw=False): frames = [] cap = cv2.VideoCapture(input_fn) while True: ret, frame = cap...
dc3ea9f/vico_challenge_baseline
evaluations/compute_cpbd.py
compute_cpbd.py
py
1,515
python
en
code
68
github-code
90
42434440474
class Graph: def __init__(self, Nodes, directed=False): self.nodes = Nodes self.adj_list = {node: [] for node in self.nodes} self.directed = directed def add_node(self, node): if node in self.nodes: print(node, "is already in the list") else: self...
leomensah/TreeAlgorithms
Amalitech/dfs.py
dfs.py
py
1,331
python
en
code
0
github-code
90
36925323013
#https://codeforces.com/problemset/problem/1220/A #10Apr2020 main1=int(input()) main2=input() zeros=int(main2.count('z')) ones=int(main2.count('n')) res="" for x in range(0,ones): res=res+"1 " for x in range(0,zeros): res=res+"0 " print(res.strip())
NitishGadangi/Code-Jungle
cards.py
cards.py
py
252
python
en
code
0
github-code
90
31542963886
# Statement for enabling the development environment import os DEBUG = True # Define the application directory BASE_DIR = os.path.abspath(os.path.dirname(__file__)) SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(os.path.abspath('.'), 'SpiderKeeper.db') SQLALCHEMY_TRACK_MODIFICATIONS = False DATABASE_CONNECT...
zlcting/spider_keeper_beta
SpiderKeeper/config.py
config.py
py
1,326
python
en
code
0
github-code
90
44771835274
from rest_framework import serializers from tests.test_case import AppTestCase from wip.models import JobStatus from wip.serializers import JobStatusSerializer class TestSerializer(AppTestCase): fixtures = ['wip/tests/fixtures/test.yaml'] def test_subclass(self): self.assertTrue(issubclass(JobStatus...
bigmassa/task-management
wip/tests/serializers/test_job_status.py
test_job_status.py
py
1,217
python
en
code
0
github-code
90
37438986655
import tkinter as tk import telnetlib class TelnetClient: def __init__(self): self.host = None self.port = None self.tn = None def connect(self, host, port): self.host = host self.port = port self.tn = telnetlib.Telnet(host, port) def disconnect(self): ...
Midnigh2/PolyCode
amrcode/telnet_application.py
telnet_application.py
py
2,772
python
en
code
0
github-code
90
21034105132
#!/usr/bin/env python # coding: utf-8 # In[1]: import os # In[6]: folderpath = r"/Users/helenamagaldi/Dropbox/My Mac (MacBook Pro de Helena)/Downloads" os.chdir(folderpath) # In[7]: os.getcwd() # In[8]: os.listdir() # In[ ]:
helenamagaldi/projects_python
File Management System/management_system.py.py
management_system.py.py
py
247
python
en
code
3
github-code
90
70007688936
from django.shortcuts import render, redirect, get_object_or_404 from django.contrib.auth.decorators import login_required from django.contrib.auth import get_user_model from .models import Comment from .forms import CommentForm from blog.models import Post User = get_user_model() @login_required def add_comment(requ...
Sydefix/blog
comments/views.py
views.py
py
1,094
python
en
code
0
github-code
90
2461707601
class Solution(object): def manhattanDist(self,x1,x2,y1,y2): return abs(x1 - x2) + abs(y1 - y2) def nearestValidPoint(self, x, y, points): """ :type x: int :type y: int :type points: List[List[int]] :rtype: int """ min_dist = sys.maxint ...
petrosDemetrakopoulos/Leetcode
code/Python/1779-FindNearestPointThatHasTheSameXOrYCoordinate.py
1779-FindNearestPointThatHasTheSameXOrYCoordinate.py
py
758
python
en
code
0
github-code
90
72483564778
from typing import List class Solution: """ Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Notice that the solution set must not contain duplicate triplets. Input: nums = [-1,0,1,2,-1,-4] ...
ymurong/tech-interview-2023
tech-interview-handbook/src/week1/n15_3sum.py
n15_3sum.py
py
1,701
python
en
code
0
github-code
90
33659813807
""" # Definition for a Node. class Node: def __init__(self, val, children): self.val = val self.children = children """ class Solution: def preorder(self, root: 'Node') -> List[int]: res = [] self.mid_loop(root, res) return res def mid_loop...
algorithm004-04/algorithm004-04
Week 02/id_659/LeetCode_589_659.py
LeetCode_589_659.py
py
561
python
en
code
66
github-code
90
18575506913
from __future__ import absolute_import, division, unicode_literals import io import numpy as np import logging from scipy.stats import spearmanr, pearsonr import scikits.bootstrap as bstrap from senteval.utils import cosine class STSEval(object): def loadFile(self, fpath): self.data = {} self.sam...
babylonhealth/fuzzymax
senteval/sts.py
sts.py
py
7,488
python
en
code
42
github-code
90
18511681369
import sys import math from collections import defaultdict sys.setrecursionlimit(10**7) def input(): return sys.stdin.readline()[:-1] mod = 10**9 + 7 def I(): return int(input()) def II(): return map(int, input().split()) def III(): return list(map(int, input().split())) def Line(N): read_all = [tuple(map(in...
Aasthaengg/IBMdataset
Python_codes/p03291/s397776371.py
s397776371.py
py
1,612
python
en
code
0
github-code
90
70127505896
""" Investment created by Herman Tai 3/20/2008 """ from math import * TOLERANCE = 0.0000001 def equals(n1,n2): return abs(n1-n2) <TOLERANCE def calculate_monthly_payment(principle,year,rate_percent): terms = year * 12.0 rate = rate_percent/100.0 monthly_rate = rate/12.0 # special case if mo...
hermantai/beta-programs
OwnVsRent/Investment.py
Investment.py
py
3,162
python
en
code
0
github-code
90
18301748389
N = int(input()) A = tuple(map(int, input().split())) x = [[] for _ in range(N + 1)] for i, a in enumerate(A): x[a].append(i) maxcount = 0 todo = [(1, i) for i in x[1]] while todo: a, i = todo.pop() maxcount = max(maxcount, a) if a == N: continue na = a + 1 for ni in x[na]: if n...
Aasthaengg/IBMdataset
Python_codes/p02832/s327385000.py
s327385000.py
py
438
python
en
code
0
github-code
90
35524438266
# https://www.reddit.com/r/adventofcode/comments/a61ojp/2018_day_14_solutions/ebr8abv/ recipes = open('day14.in','r').read().strip() score = '37' elf1 = 0 elf2 = 1 while recipes not in score[-7:]: score += str(int(score[elf1]) + int(score[elf2])) elf1 = (elf1 + int(score[elf1]) + 1) % len(score) elf2 = (e...
urianchang/Algorithms
AdventOfCode/2018/14_chocolate_charts/better_code.py
better_code.py
py
455
python
en
code
17
github-code
90
38758450411
''' Create an algorithm to determine if someone has won a game of tic tac toe. Peter Koppelman Jan 4, 2018 There are nine boxes on a tic tac toe board. They will be numbered: 1 2 3 4 5 6 7 8 9 In case there are 16 boxes (4 x 4) on the board... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 There are (2x...
PeterKoppelman/Cracking-the-coding-interview---Chapter-16
tictactoe.py
tictactoe.py
py
4,334
python
en
code
1
github-code
90
17939803509
import re S = input().replace('?', '.') T = input() n = len(S) m = len(T) j = -1 for i in range(n-m, -1, -1): if re.match(S[i:i+m], T): j = i break if j == -1: print('UNRESTORABLE') else: ans = ''.join(['a' if t == '.' else t for t in S]) ans = ans[:j] + T + ans[j+m:] print(ans)
Aasthaengg/IBMdataset
Python_codes/p03565/s940126498.py
s940126498.py
py
318
python
en
code
0
github-code
90
32783489737
def days_of_the_week(): print("Monday") print("Tuesday") print("Wednesday") print("Thursday") print("Friday") def replace_words_with_hello(sentence): # split the sentence split_sentence = sentence.split(" ") new_split_sentence = "" index = 0 for word in split_sentence: ...
Wickendom/Hyperion-Dev-Work
Task 24/my_function.py
my_function.py
py
819
python
en
code
0
github-code
90
13805413306
"""https://adventofcode.com/2022/day/1""" from itertools import groupby from pathlib import Path # Input file located relative to this file using Path input_file = Path(__file__).parent / "input.txt" # Read input file into a list line by line with input_file.open() as f: data = [line.strip() for line in f] # Spl...
miketheman/advent-of-code-2022
day_01/solve.py
solve.py
py
1,021
python
en
code
0
github-code
90
72377233897
from flask import Flask import os def create_app(test_config=None): app = Flask(__name__, instance_relative_config=True) app.config.from_mapping( SECRET_KEY='dev', DATABASE=os.path.join(app.instance_path, 'bookreviews.db') ) try: os.makedirs(app.instance_path) except OSErr...
astrojneil/bookRec
flaskr/__init__.py
__init__.py
py
723
python
en
code
1
github-code
90
599234986
import argparse tank_fish = {'tank_a': 'shark, tuna, herring', 'tank_b': 'cod, founder'} my_parser = argparse.ArgumentParser(description='List the fish in aquarium') my_parser.add_argument('tank', type=str, help='Tank to print fish from') my_parser.add_argument('--upper_case', default=False, action='stor...
Nakulan89/Automation_practice
arg_parsing/aquarium.py
aquarium.py
py
456
python
en
code
0
github-code
90
43167344428
import argparse import logging import textwrap from . helpers import PaginatedQuery, Raw, Result, Results from . user import User class Repository(PaginatedQuery): log = logging.getLogger("yoshiki.Repository") connection = '' def __init__(self, args: argparse.Namespace) -> None: super().__init__...
morucci/yoshiki
yoshiki/repository.py
repository.py
py
2,213
python
en
code
2
github-code
90
18454750209
s = int(input()) answer = 1 an = {1:s} i = 2 while(True): if an[i-1]%2 == 0: if (an[i-1]//2) in an.values(): answer = i break else : an[i] = an[i-1]//2 else : if (3*an[i-1]+1) in an.values(): answer = i break else : an[i] = 3*an[i-1]+1 i += 1 print(ans...
Aasthaengg/IBMdataset
Python_codes/p03146/s935565963.py
s935565963.py
py
324
python
en
code
0
github-code
90
31025203517
cases = int(input()) # c complexity for case in range(cases): result = 0 inp = input().split() divisor = int(inp[0]) sequence_length = int(inp[1]) sequence = input().split() prefix_sum_mod = [] counter = 0 for elem in sequence: #n if counter == 0: prefix_sum_mod.app...
Thobla/Algorithm-Solutions
Sliding, searching and sorting/Divisible-Subsequences.py
Divisible-Subsequences.py
py
941
python
en
code
0
github-code
90