seq_id
stringlengths
7
11
text
stringlengths
156
1.7M
repo_name
stringlengths
7
125
sub_path
stringlengths
4
132
file_name
stringlengths
4
77
file_ext
stringclasses
6 values
file_size_in_byte
int64
156
1.7M
program_lang
stringclasses
1 value
lang
stringclasses
38 values
doc_type
stringclasses
1 value
stars
int64
0
24.2k
dataset
stringclasses
1 value
pt
stringclasses
1 value
42117272334
from django.conf.urls import url from django.contrib import admin from users import views as usersViews from bookmark import views as bookmarkViews urlpatterns = [ url(r'^login', usersViews.login), url(r'^logout', usersViews.logout), url(r'^register', usersViews.register), url(r'^bookmark/$', bookmarkV...
jlneto15/bookmark
web/app/urls.py
urls.py
py
589
python
en
code
0
github-code
6
4558179615
import subprocess from sanic import Sanic, response # import os app = Sanic(__name__) app.ctx.restarting = False @app.route("/") async def test(_): return response.html(open("index.html", encoding='utf-8').read()) def is_github_request(request): # check if the request is from github, with the api key, the ...
sooswastaken/continuous-integration
server.py
server.py
py
994
python
en
code
0
github-code
6
22189104094
import numpy as np import cv2 as cv capture = cv.VideoCapture(0) lastNorm = 0.0 lastCounter = 0 counter = 0 currentState = 0 onList = [] offList = [] onDuration = 0 offDuration = 0 if not capture.isOpened(): print("Cannot open camera") exit() while True: # Capture frame-by-frame ret, frame = captu...
musaceylan/handy_codes
on_off_detector.py
on_off_detector.py
py
1,577
python
en
code
0
github-code
6
3863123970
import socket import os with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect(("scrap",55554)) pid=os.fork() if pid > 0: while True: data=s.recv(4096) print(data.decode("utf-8"),end="") else: while True: cmd=input()+"\n" ...
fusillator/babysteps64
socket_test.py
socket_test.py
py
352
python
en
code
0
github-code
6
22713126804
import os import sys from os import listdir from PIL import Image import mysql.connector as database #Environment variables / default values DB_HOST = os.getenv('DB_HOST','localhost') DB_USER = os.getenv('DB_USER','root') DB_PASSWORT = os.getenv('DB_PASSWORT','secret') FILE_PATH = os.getenv('FILE_PATH','files') pathar...
AnSieger/find_corrupt_media_files
checkimages.py
checkimages.py
py
2,239
python
en
code
0
github-code
6
19327457883
a='india is my country' a=a+' ' count=0 maximum=0 word='' for i in range(len(a)): if a[i]==' ': if count>maximum: maximum=count longestword=word count=0 word='' else: count=count+1 word=word+a[i] print(maximum,longestword)
NARIKODANHRIDUL/python-sample-codes
lab 11/lab 11 5.py
lab 11 5.py
py
313
python
en
code
1
github-code
6
7924878639
from tools import adaptive, parse import numpy as np from imutils import resize import matplotlib import matplotlib.pyplot as plt import cv2 as cv import argparse matplotlib.use('TKAgg') PATH = "images/adaptive/{}" function_map = { 'mean': adaptive.threshold_mean, 'median': adaptive.threshold_median } parser ...
YvesAugusto/project_vc
adaptive.py
adaptive.py
py
1,682
python
en
code
0
github-code
6
5125390370
""" Demonstration of the GazeTracking library. Check the README.md for complete documentation. """ import time import threading import cv2 import numpy as np from gaze_tracking import GazeTracking import sys from PyQt5 import QtCore from PyQt5.QtCore import QCoreApplication from PyQt5.QtGui import QImage,...
jinho17/eye_tracking_project
eye_tracking/Eyetracking/Eyetracking0501.py
Eyetracking0501.py
py
10,223
python
en
code
0
github-code
6
19707721662
class Solution: def maxSubarraySumCircular(self, nums): d=nums d+=nums ans=max(nums) for i in range(len(nums)//2): if(d[i]<=0): continue tmp=d[i] if(tmp>ans): ans=tmp for k in range(1,len(nums)//2): ...
admaxpanda/LeetCode
918. Maximum Sum Circular Subarray.py
918. Maximum Sum Circular Subarray.py
py
476
python
en
code
1
github-code
6
30395906732
#https://www.codingame.com/training/easy/max-area #MAX AREA import math from operator import itemgetter n=int(input()) a=[int(i) for i in input().split()] area=0 for i in range(max(a),min(a),-1): b=[x for x in range(n) if a[x]>=i] #print(b) area=max(area,(max(b)-min(b))*i) print(area)
AllanccWang/CodingGame
classic puzzle-easy/max-area.py
max-area.py
py
298
python
en
code
1
github-code
6
22634603016
#using while loop num=int(input("Enter the Number: ")) temp=num fact=1 while temp != 1: fact=fact*temp temp-=1 print(f"Factorial of a Number is {fact}") #using Math Module print("Factorial Using Math Module") from math import factorial n=int(input("Enter the Number: ")) print(f"Factorial...
arironman/MSU-Python
ex-8/37.py
37.py
py
354
python
en
code
0
github-code
6
18231210208
import pandas as pd from astropy.coordinates import SkyCoord from astropy import units as u import glob import concurrent.futures # Read in catalog data catalog = pd.read_csv('observations.txt', delimiter=' ') master_catalog = pd.read_csv('master_catalog_jan_2023.csv', delimiter=',') print(master_catalog) pr...
WilliamOrringe/Indentifying-Candidate-Star-Clusters-in-M31
multi.py
multi.py
py
2,519
python
en
code
0
github-code
6
38931021069
from typing import Callable from PySide2.QtWidgets import QListWidget, QAbstractItemView, QAction, QPushButton, QListWidgetItem, QGridLayout from PySide2.QtCore import QSize, QThread, Signal, Slot, Qt import damaker from damaker.pipeline import * import damaker_gui import damaker_gui.widgets as widgets class Pipelin...
subski/DAMAKER
damaker_gui/widgets/PipelineWidget.py
PipelineWidget.py
py
3,049
python
en
code
0
github-code
6
18245658241
import pandas as pd import dataprofiler as dp import numpy as np from pymongo import MongoClient try: conn = MongoClient() except: print("Could not connct to Mongo DB") db = conn.database collection = db.my_gfg_collection data = { "calories": [420,380, 390,390, 80, 350], "duration": [50,45,40...
arbecker620/DataQuality
DataQuality.py
DataQuality.py
py
1,082
python
en
code
2
github-code
6
12731828005
#Visualizing data with Matplotlib #Matplotlib config #import matplotlib as mpl #mpl.rcParams['lines.linewidth'] = 2 #mpl.rcParams['lines.color'] = 'r' #plt.rcParams['figure.figsize'] = (8,4) #plt.gcf().set_size_inches(8,4) #example 1 import numpy as np import pandas as pd from datetime import date import matplotlib.py...
ndlopez/learn_python
source/plot_test.py
plot_test.py
py
1,965
python
en
code
0
github-code
6
34385625845
# -*- coding: utf-8 -*- """ Created on Sat Jun 10 17:20:34 2017 @author: admin """ from table import TABLE from copy import deepcopy import random, sub_structure import numpy as np from value_function import NODE from vv import values values[()]='d' def divine(table,row): temp=[] new=[] ...
youki-cao/Gomoku-AI
Code_AI_Gomoku/newmethod(1).py
newmethod(1).py
py
1,661
python
en
code
0
github-code
6
45526650896
btc_positions = [{'symbol: BTC', 'margin_balance: 0.15', 'margin_position: 0.05', 'margin_frozen: 0.01'}, {'symbol: BTC2', 'margin_balance: 0.15', 'margin_position: 0.05', 'margin_frozen: 0.01'}] def test(value): """ value: sets of strings """ d = dict(s.split(': ') for s in p) # tur...
DeulinYakov/TelegramBotCollege
tests.py
tests.py
py
640
python
en
code
1
github-code
6
6858043580
### Introduction to Pytorch Workflow timestamp to where it starts (link: https://www.youtube.com/watch?v=V_xro1bcAuA): 4:22:01 import torch from torch import nn #nn contains all of pytorch's building blocks for neuro networks, pytorch documentation has a lot of building blocks for all sorts of layers #you can combine...
attackGoose/AI-Notebook-and-projects
pytorch/Learning stuff/2_Learning_pytorch_workflow.py
2_Learning_pytorch_workflow.py
py
15,967
python
en
code
0
github-code
6
34357687621
import argparse, subprocess, socket, json, io, os, notify2 verbose = False def get_metadata_id_from(meta): # meta is a user/application definable metapackage data = call_application(meta) # application meta will create a timestamp entry of the relavent metadata, and then pass back the id number to log in the data...
Tadashi-Hikari/Sapphire-Assistant-Framework-Python
assistant/selflib.py
selflib.py
py
4,305
python
en
code
1
github-code
6
74923077307
import numpy as np import pyautogui import time import imutils import cv2 import mediapipe as mp from pynput.keyboard import Key, Controller keyboard = Controller() mp_hands = mp.solutions.hands hands = mp_hands.Hands() mp_draw = mp.solutions.drawing_utils cap = cv2.VideoCapture(0) finger_tips = [8, 12, 16, 20] th...
diganta121/PRO-C109
take_screenshot.py
take_screenshot.py
py
2,789
python
en
code
0
github-code
6
36895861215
from __future__ import print_function from builtins import chr from builtins import zip from builtins import map from builtins import str from builtins import filter from builtins import range from builtins import object import getopt import gzip import locale import operator import os import re import shutil import ...
cfv-project/cfv
test/test.py
test.py
py
74,606
python
en
code
46
github-code
6
19432133852
import sqlite3 import os lat = list() with open('latitude.dat', 'r') as lats: lat = lats.read().split('\n') with open('longitude.dat', 'r') as lons: lon = lons.read().split('\n') with open('dates.dat', 'r') as dates: tmp = [i[1:-1] for i in dates.read().split('\n')] base = os.path.abspath(os.path.join('...
juliansibaja84/GPStracking
lib/data_parser.py
data_parser.py
py
784
python
en
code
1
github-code
6
42663275089
import os import numpy as np from src.deid import plot_grid if __name__=='__main__': ctvol_directory = '/scratch/rlb61/2019-10-BigData-DEID/' #First select a random set of 3,000 CT volumes all_cts = os.listdir(ctvol_directory) assert len(all_cts)==36316 assert len([x for x in all_cts if '.npz...
rachellea/explainable-ct-ai
runs/2021-04/2021-04-13-random-3000-grid-and-mip-plots-of-radchestct.py
2021-04-13-random-3000-grid-and-mip-plots-of-radchestct.py
py
1,078
python
en
code
3
github-code
6
43219992037
#!/usr/bin/env python #-*- coding: utf-8 -*- import gtk class MyApp(object): def __init__(self): win = gtk.Window() vbox = gtk.HBox() win.add(vbox) treeview = gtk.TreeView() column = gtk.TreeViewColumn("Column 1") treeview.append_column(column) vbox.pack_start(tr...
texttest/storytext-selftest
pygtk/error_handling/tree_views/no_model/target_ui.py
target_ui.py
py
595
python
en
code
0
github-code
6
43347091848
import tikzplotlib from tensorboard.data.experimental import ExperimentFromDev import re from collections import defaultdict import matplotlib.pyplot as plt import numpy as np import pickle def group_by_repetition(scalars): runs = scalars.run.unique() # each run has name job*_A --> no repetition...
charleswilmot/coppelia_sim_inverse_model
src/aggregate_runs.py
aggregate_runs.py
py
5,903
python
en
code
0
github-code
6
4730565575
__author__ = 'Dih0r' import AVT #--------------------------------------------------------------------------------------------------------------------- #--------------------------------------------------T1U2Exchange------------------------------------------------------- #-----------------------------------------------...
mvladarean/swaprec
T1U2Exchange.py
T1U2Exchange.py
py
2,036
python
en
code
0
github-code
6
71756196989
#!/usr/bin/env python # File created on 07 May 2013 from __future__ import division __author__ = "Yoshiki Vazquez Baeza" __copyright__ = "Copyright 2013, ApocaQIIME" __credits__ = ["Yoshiki Vazquez Baeza"] __license__ = "GPL" __version__ = "1.6.0-dev" __maintainer__ = "Yoshiki Vazquez Baeza" __email__ = "yoshiki89@gma...
ElDeveloper/apocaqiime
scripts/merge_columns_in_mapping_file.py
merge_columns_in_mapping_file.py
py
2,420
python
en
code
1
github-code
6
39722795672
from logger.logger import Logger class Branch: logger = None master = 'master' support = 'support' develop = 'develop' mainBranch = '' developBranch = '' def __init__(self, customer, config, version = ''): self.logger = Logger.getInstance() branchPrefix = customer.lower() self.master = config.get('mas...
Dominik93/version-management
git/branch.py
branch.py
py
1,088
python
en
code
0
github-code
6
20147878245
""" Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 """ class Solution: def reverse(self, x: int) -> int: s = (x > 0) - (x < 0) r = int(str(x*s)[::-1]) return r*s*(r < ...
pansinyoung/pythod-leet
7_Reverse_Integer.py
7_Reverse_Integer.py
py
524
python
en
code
0
github-code
6
71049150269
from functools import reduce import time def add(x, y): return x + y # 匿名函数 f = lambda x, y: x + y # 三元表达式 x, y = 2,3 r = x if x > y else y # map list_x = [1, 2, 3, 4] m = map(lambda x: x*x, list_x) print(list(m)) # [1, 4, 9, 16] # map 多个参数 list_y = [2, 3, 4, 5] m2 = map(lambda x, y: x*x + y , list_x, list...
xxg3053/learn-python
lang/high.py
high.py
py
942
python
en
code
0
github-code
6
32150085277
# Upload BOJ Gold-5 Stack 2504번 괄호의 값 # exp = input() # result = "" # stack = [] # operator = [] # beforeValue = "" # op = { # ")":"(", # "]":"[", # "(": 2, # "[": 3, # } # for value in exp: # if value in ["(","["]: # stack.append(value) # if beforeValue: # ...
HS980924/Algorithm
src/7.Stack/B#2504_괄호의값.py
B#2504_괄호의값.py
py
2,009
python
en
code
2
github-code
6
19109140061
from django.shortcuts import render, redirect from time import strftime def index(request): data = { "date": strftime("%B %d, %Y"), # automatically adds localtime() as parameter "time": strftime("%I:%M %p") } return render(request,'myapp/index.html', data)
klandon94/django_intro
time_display/apps/myapp/views.py
views.py
py
286
python
en
code
0
github-code
6
12454720392
from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager # Configurações do ChromeDriver chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--headless') # Para executar em modo headless (sem janela do navegador) # Iniciar o ChromeDriver driver = webdriver.Chrome(Ch...
hericmr/OlhoVivo
sms.py
sms.py
py
481
python
pt
code
0
github-code
6
6814769507
### Zadanie 2.1 | Zagadka matematyczna # Program losuje dwie liczby z zakresu od 0 do 99 (patrz poniżej). # Podaje te dwie liczby i pyta jaka jest ich suma (nie podaje jej). Użytkownik ma odgadnąć (no, policzyć w głowie) wynik. # Program pyta o wynik wielokrotnie, tak długo, aż użytkownik poda prawidłowy wynik. from r...
dawidradziwoniuk/python_zadania
zadanie_2.1.py
zadanie_2.1.py
py
769
python
pl
code
0
github-code
6
42408411037
# Телеграмм-бот для конвертации валют: @valuta_course_bot import telebot from config import keys, TOKEN from extensions import APIException, CurrencyConverter bot = telebot.TeleBot(TOKEN) @bot.message_handler(commands=['start']) def function_start(message: telebot.types.Message): bot.send_message(message.chat.id,...
TamaraRiga/Control-project-18.6
app.py
app.py
py
2,545
python
ru
code
0
github-code
6
30477916720
# Lowest Common Ancestor in Binary Tree def lca(root, n1, n2): if root is None: return None if root.data == n1 or root.data == n2: return root leftAns = lca(root.left, n1, n2) rightAns = lca(root.right, n1, n2) if leftAns is not None and rightAns is not None: retu...
prabhat-gp/GFG
Binary Trees/Love Babbar/21_lca_tree.py
21_lca_tree.py
py
629
python
en
code
0
github-code
6
32150077207
# 1부터 n까지의 수를 스택에 넣었다가 뽑아 늘어놓음으로써 하나의 수열을 만들 수 있다 # 이때, 스택에 push하는 순서는 반드시 오름차순을 지키도록 한다고 하자. # 임의의 수열이 주어졌을 때 스택을 이용해 그 수열을 만들 수 있는지 없는지 # , 있다면 어떤 순서로 push와 pop 연산을 수행해야 하는지를 알아낼 수 있다. # 이를 계산하는 프로그램을 작성하라. import sys Num = [] stack = [] result = [] N = int(input()) for i in range(N): Num.append...
HS980924/Algorithm
src/7.Stack/B#1874.py
B#1874.py
py
955
python
ko
code
2
github-code
6
40333382628
from loguru import logger from gpiozero import Button from fabiotobox.camera import Camera from fabiotobox.diaporama import Diaporama from fabiotobox.photohandler import PhotoHandler from fabiotobox.tumblr import Tumblr from enum import IntEnum import pendulum import time SCREENSAVER_DELAY = 1 class PhotoFormat(IntE...
fabiolab/photobox
fabiotobox/fabiotobox.py
fabiotobox.py
py
3,580
python
en
code
0
github-code
6
71802647227
import pefile import sys import os import json def locate_data_sections(pe): data_sections = [] for section in pe.sections: if section.Name == b'.text\x00\x00\x00': data_sections.append({ 'name': section.Name, 'virtual_address': hex(section.VirtualAddress), 'virtual_size': hex(sec...
luiz-cesar/CDadosSeg
T2/Parte2/exe_analysis.py
exe_analysis.py
py
715
python
en
code
0
github-code
6
36767766109
''' Author : knight_byte File : A_Die_Roll.py Created on : 2021-04-14 09:25:32 ''' from fractions import Fraction def main(): y, w = map(int, input().split()) d = 6-max(y, w)+1 print(Fraction(d, 6) if d != 6 else "1/1") if __name__ == '__main__': main()
arbkm22/Codeforces-Problemset-Solution
Python/A_Die_Roll.py
A_Die_Roll.py
py
284
python
en
code
0
github-code
6
716738610
import pytest import json from sovrin_client.test.cli.constants import INVALID_SYNTAX from sovrin_client.test.cli.helper import createUuidIdentifier, addNym attrib_name = 'dateOfBirth' ATTRIBUTE_ADDED = 'Attribute added for nym {valid_dest}' RETURNED_DATA = ['Found attribute', attrib_name, 'dayOfMonth', 'year', 'mon...
hyperledger-archives/indy-client
sovrin_client/test/cli/test_send_get_attr.py
test_send_get_attr.py
py
2,791
python
en
code
18
github-code
6
47509541
from typing import * import math # 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 maxAncestorDiff(self, root: Optional[TreeNode]) -> int: ans = 0 ...
code-cp/leetcode
solutions/1026/main.py
main.py
py
1,395
python
en
code
0
github-code
6
25008864271
from osv import fields, osv class res_partner_address(osv.osv): _inherit = 'res.partner.address' def _complete_name_get_fnc(self, cr, uid, ids, prop, unknow_none, unknow_dict): table = self.name_get(cr, uid, ids, {'contact_display':'contact'}) return dict(table) _columns = { ...
factorlibre/openerp-extra-6.1
sale_supplier_direct_delivery/partner.py
partner.py
py
476
python
en
code
9
github-code
6
9064742045
from utils import readEdgeList, split_between_last_char import numpy as np import time from ResultWritter import ResultWritter import os class KTupleFeatureGenerator: def __init__(self, path, k = 5, sample_times = 100, thread_num = 40): self.path = path self.k = k self.sample_times = sample...
anonydeepgraphlet/DeepGraphlet
src/k_tuple_feature_generator.py
k_tuple_feature_generator.py
py
1,538
python
en
code
0
github-code
6
40145168774
#!/usr/bin/env python from lxml import html import wikipedia with open('movies.txt','r') as f: movies = f.read().strip().split('\n') m = movies[0] html = wikipedia.page(m).html() tree = html.fromstring(html) director = tree.xpath('//')
luster/is-pepsi-okay
script/scrape.py
scrape.py
py
245
python
en
code
0
github-code
6
39477906211
st1={1,2,3,4} st2={5,4,6,7,8} z=st1.union(st2) z2=st1.intersection(st2) z3=st1-st2 #difference in set z4=st1^st2 #symmetric Difference print(z) print(z2) print(z3) print(z4)
satyamsingh-stack/Python-Programming
set.py
set.py
py
186
python
en
code
1
github-code
6
40504216527
import os import subprocess import tempfile import nbformat import pytest IGNORE_NOTEBOOKS: list[str] = [ "12_ResDMD.ipynb", "12_koopman_mpc.ipynb", "koopman_mpc.ipynb", ] def _notebook_run(path): """Execute a notebook via nbconvert and collect output. Returns the parsed notebook object and the ...
datafold-dev/datafold
tutorials/tests/test_notebooks.py
test_notebooks.py
py
1,932
python
en
code
13
github-code
6
23731980444
from collections import abc from typing import Any, Callable, Dict, List, Optional, Union def remove_nulls(data: Union[List, Dict], value_filter: Optional[Callable[[Any], bool]] = None) -> Union[List, Dict]: """ Given a list or dict, returns an object of the same structure without filtered values...
rylativity/python-utils
dataprep.py
dataprep.py
py
2,193
python
en
code
0
github-code
6
910883870
import numpy as np, h5py as h5 from horton import * # pylint: disable=wildcard-import,unused-wildcard-import from horton.part.test.common import get_proatomdb_cp2k from horton.test.common import tmpdir def test_db_basics(): padb = ProAtomDB.from_refatoms(numbers=[8, 1], max_cation=1, max_anion=1) assert pad...
theochem/horton
horton/part/test/test_proatomdb.py
test_proatomdb.py
py
7,845
python
en
code
83
github-code
6
73954150588
import cv2 import sys from emot import emo_det cascPath = "webcam.xml" faceCascade = cv2.CascadeClassifier(cascPath) font = cv2.FONT_HERSHEY_SIMPLEX video_capture = cv2.VideoCapture(0) while True: # Capture frame-by-frame ret, frame = video_capture.read() gray = cv2.cvtColor(frame, cv2.COL...
allansuresh/face-emo-detect
det.py
det.py
py
1,087
python
en
code
0
github-code
6
75282246908
import hashlib import re import sys import time re_three_same = re.compile(r'(.)\1\1') pi = 'yjdafjpo' i = 0 p = 2 counting_map = {} found_indexes = [] max_found_indexes = 80 def get_hash(plain_text, p): if p == 1: return hashlib.md5(plain_text.encode('utf-8')).hexdigest() elif p == 2: h = plain_text for x ...
elitan/adventofcode
2016/14/main.py
main.py
py
1,289
python
en
code
1
github-code
6
17891204899
from typing import List from game.GameState import GameState, Move from policy.Policy import EstimatingPolicy from policy.exceptions import * import random import numpy.random import torch import torch.cuda class ModelBasedPolicy(EstimatingPolicy): def __init__(self, model, feature_extractor, h, w, exploration=...
nkorobkov/virus-game
policy/ModelBasedPolicy.py
ModelBasedPolicy.py
py
2,183
python
en
code
1
github-code
6
8385089331
from __future__ import absolute_import import os import sys import re import xml.dom.minidom import random from sumolib.files.additional import write_additional_minidom try: from typing import Any, List, Tuple, Union except ImportError: # there are python2 versions on MacOS coming without typing pass """ C...
ngctnnnn/DRL_Traffic-Signal-Control
sumo-rl/sumo/tools/sumolib/vehicletype.py
vehicletype.py
py
12,625
python
en
code
17
github-code
6
71648693307
#!/usr/bin/env python3 import asyncio import socket from keyword import kwlist from typing import Tuple as tuple MAX_KEYWORD_LEN = 4 # <1> async def probe(domain: str) -> tuple[str, bool]: # <2> loop = asyncio.get_running_loop() # <3> try: await loop.getaddrinfo(domain, None) # <4> except soc...
yangguang8112/fluentPy
new_chapter18/21-async/domains/asyncio/blogdom.py
blogdom.py
py
1,205
python
en
code
0
github-code
6
16119990604
H, W = map(int, input().split()) N = int(input()) sticker = [list(map(int, input().split())) for _ in range(N)] result = 0 for i in range(N): for j in range(i+1, N): row1, col1 = sticker[i] row2, col2 = sticker[j] # 스티커 2개 모두 90도 회전하지 않을 경우 if (row1 + row2 <= H and max(col1, col2) ...
sujeong11/Algorithm
완전탐색/16937.py
16937.py
py
1,138
python
ko
code
0
github-code
6
19491319237
from Permission import Permission import pandas as pd import requests class Get_info: urlMarvel = 'http://gateway.marvel.com/v1/public/characters/' #Marvel API's url def __init__ (self, id): """Accessing Marvel API to get information about desired character using its id. Information retri...
Guibas1812/create-api-marvel-characters
Get_Info.py
Get_Info.py
py
2,168
python
en
code
0
github-code
6
23190704074
import csv from django.core.management.base import BaseCommand from recipes.models import Tag class Command(BaseCommand): help = 'Добавить список тэгов в базу (цвет и наименование)' def handle(self, *args, **options): with open('recipes/presets/tags.csv', 'r', en...
mechnotech/foodgram-project
recipes/management/commands/add_tags.py
add_tags.py
py
825
python
en
code
0
github-code
6
43734236645
# -*- coding: utf-8 -*- """ Created on Fri Apr 16 13:14:57 2021 @author: Samael Olascoaga @email: olaskuaga@gmail.com """ import pandas as pd import gseapy as gp import matplotlib.pyplot as plt from gseapy.plot import barplot, dotplot import numpy as np import seaborn as sns sns.set_style("whitegrid")...
Olascoaga/Senotherapy
ora.py
ora.py
py
1,448
python
en
code
1
github-code
6
74912417468
import time from src.game import * # Controale # E - Rotire spre stanga # R - Rotire spre dreapta # F - Foc # Sageti - Miscare # ESC - Iesire joc if __name__ == '__main__': g = Game() start_time = int(time.time()) while True: g.events() g.start_screen() if int(time.time()) - sta...
lupusg/the-explorer-game
playable-version/main.py
main.py
py
424
python
en
code
0
github-code
6
73554593149
import numpy as np from functions import mean_absolute_percentage_error import torch data = np.load('predictions.npz') h_label = data['labels'] h_pred = data['pred'] indices_under_1500 = h_label < 1500 indices_under_1300 = h_label < 1300 h_pred = torch.Tensor(h_pred) h_label = torch.Tensor(h_label) h_pred_under_1500...
arseniybelkov/Determining_HOCB
auxillary_functions/analizePredictions.py
analizePredictions.py
py
1,015
python
en
code
0
github-code
6
22290767213
# -*- coding: utf-8 -*- import streamlit as st from st_aggrid import AgGrid import pandas as pd import pymysql from sqlalchemy import create_engine engine = create_engine('mysql+pymysql://root:chiangcw@localhost/python?charset=utf8') uploaded_file = st.file_uploader("请选择要上传的csv格式表格!") if uploaded_file is not None: df1...
chiangcw0410/mysql_test
test/test.py
test.py
py
904
python
en
code
0
github-code
6
23448112816
## ---------------------------------------------------------------------------- # Import import unittest from arf_python.DataVector import DataVector from arf_python.Point import Point import os ## ---------------------------------------------------------------------------- # Constant PATH_REPO = "./arf_python/tests" N...
jfolleas1/ProjetSpecifique
arf_python/tests/test_dataVector.py
test_dataVector.py
py
1,101
python
en
code
1
github-code
6
20615133935
# Usage: python3 parse_and_collate_logs.py /path/to/logs/ /path/to/dest/ # Parameters: # /path/to/logs/: contains directories, each containing log files # /path/to/dest/: where the parsed and collated file will be placed # Output: # A CSV file of altitude-deadline pairs import csv import os import sys def calc_jul...
CMUAbstract/cote
examples/generate-deadlines/analysis/parse_and_collate_logs.py
parse_and_collate_logs.py
py
3,468
python
en
code
15
github-code
6
17791637310
# Download the audio files for all of the video URLs given in the input file import argparse import os import sys youtube_cmd = \ "youtube-dl --extract-audio --audio-format mp3 -o \"{file_name}\" {url}" def download_song(artist, song, url): artist_part = '-'.join(artist.lower().split()) song_part = '...
S0l0m4n/random-code
python/download_songs/youtube_download.py
youtube_download.py
py
3,450
python
en
code
0
github-code
6
5299866462
from proxy_checker import ProxyChecker from pathlib import Path import os.path class GettingProxyException(Exception): def __str__(self): return f"{super().__str__()}: Error while getting proxy!\n" class ListEmptyException(Exception): def __str__(self): return f"{super().__str__()}...
pawel-krakowiak/trovo_viewer_bot
proxy_config.py
proxy_config.py
py
1,499
python
en
code
1
github-code
6
5308237700
# Bottom-up 방식 n = int(input()) d = [0] * (n+1) d[1] = 0 for i in range(2, n+1): # +1 d[i] = d[i-1]+1 # /2 한 경우, +1 은 / 연산 횟수 추가한 것 # 2로 나누어 떨어지는 경우 / 2로 나눈 것에 1 더한 값이 현재 값보다 작으면 바꿈 if i % 2 == 0 and d[i] > d[i//2] + 1: d[i] = d[i//2]+1 # /3 한 경우, +1 은 / 연산 횟수 추가한 것 # 3로 나누어 떨어지는 경우...
louisuss/Algorithms-Code-Upload
Python/Baekjoon/DP/1463.py
1463.py
py
1,165
python
ko
code
0
github-code
6
19052725448
''' 6075 : [기초-반복실행구조] 정수 1개 입력받아 그 수까지 출력하기1 본 문제는 python 의 빠른 기초 학습을 위해 설계된 문제로서 python 코드 제출을 기준으로 설명되어 있습니다. ------ 정수(0 ~ 100) 1개를 입력받아 0부터 그 수까지 순서대로 출력해보자. ''' n = int(input()) tmp = 0 while n >= tmp: print(tmp) tmp += 1
parkjunga/algorithm
코드업/6075 [기초-반복실행구조] 정수 1개 입력받아 그 수까지 출력하기1.py
6075 [기초-반복실행구조] 정수 1개 입력받아 그 수까지 출력하기1.py
py
407
python
ko
code
0
github-code
6
42241289409
# -*- coding:utf-8 -*- # author:DragonCheng # Data: 2022/9/14 # function: socket通信 import socket import time # 1.创建socket通信对象 client = socket.socket() # 2.连接服务器 client.connect(('192.168.2.58',8090)) while True: # send_data = input("client send data >>>") # client.send(send_data.encode('utf-8')...
Dragonchengllc/Socket
socket_client.py
socket_client.py
py
726
python
en
code
0
github-code
6
33625318941
from util import logging from training.util import monitor_loss import tensorflow as tf import streamlit as st import os import time import numpy as np import pandas as pd def batch_loss(model, inp, aux, targ, loss_funct, opt = None): loss = 0 with tf.GradientTape() as tape: pred = model(inp, aux, tr...
giobbu/ML-streamlit-apps
geo-ML/road-traffic-forecasting-belgium/training/train_module.py
train_module.py
py
3,373
python
en
code
1
github-code
6
6998246271
from csv import DictReader from glob import glob from random import choices from datetime import date import numpy as np import matplotlib.pyplot as plt from statistics import mean from dataclasses import dataclass ''' for traders with less than 25k in their brokerage accounts, three day trades are allowed per five d...
joshparkerj/day-trader
simulate.py
simulate.py
py
3,898
python
en
code
0
github-code
6
21093087761
from Stack import Stack def sortArray(arr): if arr is None: return None if len(arr) == 0: return None st1 = Stack() st2 = Stack() for i in arr: if st1.isEmpty(): st1.push(i) else: top = st1.top() if i <= top: st1.p...
fahadfahim13/Problem_Solve
Python/Coding Simplified/Stack_Python/getMinO(1).py
getMinO(1).py
py
742
python
en
code
0
github-code
6
15422153495
from os import path from setuptools import setup # read the contents of your description file this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name="pyswahili", version="0.1.4", descripti...
Kalebu/pyswahili
setup.py
setup.py
py
1,661
python
en
code
79
github-code
6
28352614903
from django.shortcuts import render, HttpResponseRedirect, HttpResponse from django.core.urlresolvers import reverse from django.contrib.auth.models import User from django.contrib.auth import login, authenticate, logout from django.core.context_processors import csrf from django.views.decorators.csrf import csrf_prote...
sanjayramesh005/chat-app
second/views.py
views.py
py
2,958
python
en
code
0
github-code
6
37182738964
from abc import ABC, abstractmethod from typing import List import requests from config import EnvConfig from models.Note import Card, DeckServiceCard class DeckServiceAPIInterface(ABC): @abstractmethod def save_cards(self, user_id: str, deck_id: str, cards: List[Card]): pass class DeckServiceAPI(D...
MoShrank/card-generation-service
external/DeckServiceAPI.py
DeckServiceAPI.py
py
1,105
python
en
code
0
github-code
6
35428259157
import pickle from typing import List, Tuple import matplotlib.pyplot as plt import matplotlib.patches as mpatches def plot_segments( true_segment_list: List[Tuple[float, float]], pred_segment_list: List[Tuple[float, float]], t_min: float = None, t_max: float = None, zoom: bool = True, marker...
robincourant/FunnyNet
laughter_detection/core/utils.py
utils.py
py
3,805
python
en
code
1
github-code
6
43974550604
import re from collections import defaultdict from typing import List class Solution: def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: counter = defaultdict() # 딕셔너리 선언 split = re.split('[! ?.,;\']', paragraph) # multiple delimiter for word in split: # 잘라둔 문자열 순회 ...
HJ-Rich/leetcode
819-most-common-word/819-most-common-word.py
819-most-common-word.py
py
980
python
ko
code
1
github-code
6
11783374292
""" Homework 2 Server Cameron Sprowls """ # Imports import socket import os class Server: @staticmethod def main(): """ Does the normal function of the program """ # Prompt the user for the port from which the server will run ip = '35.40.114.88' port = 5000 ...
CameronSprowls/PythonClientServerTCP
src/ServerUDP.py
ServerUDP.py
py
2,048
python
en
code
0
github-code
6
23312692887
import discord import os from data_loader import input_text_parser from data_loader import input_image_parser image_path = "./images" text_path = "./text" token = open("token.txt", "r").read() # change cwd in case this is called from shell script os.chdir(os.path.dirname(os.path.abspath(__file__))) # create data ob...
WireHallMedic/Encyclopedia-Bottanica
encyclopedia_bottanica.py
encyclopedia_bottanica.py
py
1,802
python
en
code
0
github-code
6
20632320396
import struct import typing from .base_bean import BaseBean from .config import Config from .ctrl_enum import EnumDevice, EnumCmdType, EnumFanDirection, EnumOutDoorRunCond, EnumFanVolume, EnumControl, \ EnumSensor, FreshAirHumidification, ThreeDFresh from .dao import Room, AirCon, Geothermic, Ventilation, HD, Devi...
mypal/ha-dsair
custom_components/ds_air/ds_air_service/decoder.py
decoder.py
py
27,763
python
en
code
65
github-code
6
3024078044
import socket class PortChecker: @staticmethod def is_open(ip:str, port:str) -> None: """ Checks if a port is open on an IP. Args: ip (str): The IP address to check. port (int): The port number to check. Returns: bool: True if...
LopeKinz/project-evoli
src/check_port.py
check_port.py
py
751
python
en
code
17
github-code
6
27661384502
import torch import torch.nn as nn import torch.nn.functional as F import random from base import BaseModel class Encoder(nn.Module): def __init__(self, embedding, hidden_size, rnn_cell='GRU', bidirectional=False, n_layers=1, dropout=0.0, device='cpu'): super(Encoder, self).__init__() self.hidden_...
vincent861223/ChatBot
model/model.py
model.py
py
7,730
python
en
code
0
github-code
6
4352669045
from flask import Flask, render_template, request, redirect, session app = Flask(__name__) app.secret_key = "No secrets on github or youtube" @app.route('/') def index(): return render_template('index.html') @app.route('/submit', methods=['POST']) def submit(): print(request.form) session['name'] = reque...
kwersland/coding_dojo-Python
flask/fundamentals/post_form/server.py
server.py
py
601
python
en
code
0
github-code
6
19271398173
# coding=utf-8 from __future__ import unicode_literals from django.contrib import admin from django.http import HttpResponseRedirect from django.conf.urls import url from django.utils.html import format_html from django.core.urlresolvers import reverse from ordered_model.admin import OrderedModelAdmin from monitoreo....
datosgobar/monitoreo-apertura
monitoreo/apps/dashboard/admin/indicator_types.py
indicator_types.py
py
4,952
python
en
code
5
github-code
6
27165563628
# Author: José Rodolfo (jric2002) s = str(input()) t = str(input()) is_correct = True size_s = len(s) size_t = len(t) i = 0 j = size_s - 1 if (size_s == size_t): while (i < size_s): if (s[i] != t[j]): is_correct = False break i += 1 j -= 1 else: is_correct = False print("YES") if (is_correct...
jric2002/algorithms
codeforces/low_difficulty/difficulty_800/21.translation_[41A]/translation.py
translation.py
py
339
python
en
code
2
github-code
6
2534597571
import copy import json import os import time from flask import Blueprint, request, Response import pm4py from pm4py.algo.filtering.log.attributes import attributes_filter from pm4py.objects.conversion.process_tree.converter import to_petri_net_transition_bordered as converter from pm4py.visualization.common.utils imp...
luisfsts/KPIAlgebras
KPIAlgebras/rest/endpoints.py
endpoints.py
py
7,463
python
en
code
0
github-code
6
42688926971
import logging import time import uuid from queue import Queue from threading import Event, Thread import zmq class ControlClient(Thread): def __init__(self, port: int): super(ControlClient, self).__init__() self.daemon = True self.command_queue = Queue() self.command_return = {} ...
ograsdijk/CeNTREX-compressorcabinet
centrex_compressorcabinet/networking/controller_client.py
controller_client.py
py
2,107
python
en
code
0
github-code
6
34832241170
import cv2 import numpy as np img = np.zeros((600, 600, 3), np.uint8) #全为0表示是黑色 """ img.shape[1]代表图片的宽度 img.shape[0]代表图片的高度(长度) """ #画直线 cv2.line(img, (0,0), (img.shape[1], img.shape[0]), (255,255,255), 2) #参数:物件、起始座标、终点座标、颜色、粗度 #画方型 (cv2.FILLED代表填满) cv2.rectangle(img, (100, 100), (200, 200), (0,255,255), 2) cv2.re...
jim2832/Image-Recognition
draw.py
draw.py
py
1,114
python
zh
code
0
github-code
6
38679091876
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import shutil import subprocess import sys from setuptools import setup, find_packages, Distribution import setuptools.command.build_ext as _build_ext # Ideally, we could include these files by putt...
ray-project/sandbox
python/setup.py
setup.py
py
4,842
python
en
code
4
github-code
6
4492425254
import xml.etree.ElementTree as ET from fastapi import FastAPI, Path from fastapi.responses import Response app = FastAPI() @app.get("/IF01/{name}") async def get( name: str = Path(title="名前"), ): root = ET.Element("root") # 「番号タグ」というどうしようもないゴミ nameElement = ET.SubElement(root, "DT0001") nameEl...
ikemo3/conveni-pdf-example
terrible-api/src/main.py
main.py
py
809
python
en
code
0
github-code
6
314473279
import os from util.IO import IO from util.Event import Event import matplotlib.pyplot as plt from matplotlib import rc import numpy as np from datetime import date, timedelta, datetime import pandas as pd class Calendar: def __init__(self, username): self.usernames = username io = IO(self.user...
noahfranz13/IOU
util/Calendar.py
Calendar.py
py
4,071
python
en
code
1
github-code
6
4108607988
import sys from PySide import QtGui, QtCore # mendeklrasikan QtGui applikasi app = QtGui.QApplication(sys.argv) window = QtGui.QWidget() icon = QtGui.QIcon('../smile.png') button = QtGui.QPushButton('Exit', window) button.resize(button.sizeHint()) button.move(10, 10) button.clicked.connect(QtCore.QCoreApplication.in...
ibnujakaria/tutorial-pyside
05. Pembahasan Window/05-pembahasan-window.py
05-pembahasan-window.py
py
877
python
en
code
3
github-code
6
21836138389
import sys from pprint import pprint sys.stdin = open('../input.txt', 'r') ds = [(-1, 0), (1, 0), (0, -1), (0, 1)] def dfs(i, j): stack = [(i, j)] while stack: si, sj = stack.pop() for di, dj in ds: ni, nj = si+di, sj+dj if 0 <= ni < M and 0 <= nj < N: ...
liza0525/algorithm-study
BOJ/boj_1012_cabbage.py
boj_1012_cabbage.py
py
857
python
en
code
0
github-code
6
74842403066
def read_raw(filename): infile = open(filename,"rb") indata = infile.read() infile.close() return indata def makeString(ASCII_list): bdata = bytes(ASCII_list) s = bdata.decode("utf-8") return s def decodeFasta(data): ou = [] nameList = [] proteinList = [] dat...
aaronstanek-bucket/fasta_parser
fasta_parser.py
fasta_parser.py
py
2,328
python
en
code
0
github-code
6
29486210493
# Exercise 1: Write a program which repeatedly reads numbers # until the user enters "done". Once "done" is entered, print # out the total, count, and average of the numbers. If the user # enters anything other than a number, detect their mistake using # try and except and print an error message and skip to the nex...
tuyojr/pythonUdacity
exercises/iterationsI.py
iterationsI.py
py
1,689
python
en
code
0
github-code
6
18227651268
from flask import Flask, render_template, session, request, url_for, redirect, flash app = Flask(__name__) @app.route("/") def hello(): print ("hello there") return render_template("home.html") if __name__ == "__main__": app.debug = True app.run()
TimMarder/determinants--marderT_canaleB_liuA_hasanA
app.py
app.py
py
269
python
en
code
2
github-code
6
38867577492
from inspect import signature from functools import wraps import werdsazxc from platforms.config import CODE_DICT as config import json import threading import inspect import pickle import time import requests import logging import re logger = logging.getLogger('robot') requests.packages.urllib3.disable_warnings() ale...
gleam542/platforms
platforms/wg/utils.py
utils.py
py
16,213
python
zh
code
0
github-code
6
36108675828
from calendar import weekday import os import zipfile import numpy as np import torch import sklearn.metrics as metrics import matplotlib.pyplot as plt # if dataset == "alpha": # if (not os.path.isfile("DC_STGCN/data/adj_mat_alpha.npy") # or not os.path.isfile("DC_STGCN/data/node_values_alpha.n...
oscarcrowley1/thesis
interpret_csv_bravoplus/make_bravoplus_tensor.py
make_bravoplus_tensor.py
py
2,378
python
en
code
2
github-code
6
24287753323
def consecutive_bits(number): result = 0 count = 0 while number > 0: modulus = number % 2 if modulus == 1: count += 1 else: count = 0 if count > result: result = count number //= 2 return result def main(): assert consecut...
ckallum/Daily-Coding-Problem
solutions/#214.py
#214.py
py
379
python
en
code
0
github-code
6
9781702318
def insertionSort(tab,l,r): dl=len(tab) for i in range(l+1,r+1): klucz=tab[i] j=i-1 while j>=0 and klucz<tab[j]: tab[j+1],tab[j]=tab[j],tab[j+1] j-=1 tab[j+1]=klucz def partition(tab,p,r): x=tab[r] i=p-1 for j in range(p,r): if tab[j]<=...
wiksat/AlghorithmsAndDataStructures
ASD/Algorithms/magicFives.py
magicFives.py
py
2,002
python
pl
code
0
github-code
6
38902490932
import scrapy from sanic.log import logger reviews_tag_identifier = "//span[@data-hook='review-body']/span/text()" next_page_tag_identifier = "//li[@class='a-last']/a/@href" class AmazonSpider(scrapy.Spider): name = 'amazon_spider' allowed_domains = ['amazon.in'] def __init__(self, name=None, uid=None, ...
Mahi-developer/review-analyzer
app/scrapper/spiders/amazon_spider.py
amazon_spider.py
py
1,683
python
en
code
0
github-code
6