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
23999295068
import os import pickle import numpy as np import pandas as pd import sdv from imblearn.over_sampling import RandomOverSampler from imblearn.under_sampling import RandomUnderSampler from scipy.stats import pearsonr from sklearn import preprocessing from sklearn.feature_selection import VarianceThreshold from sklearn.li...
PHAIR-Consortium/POPF-Predictor
utils.py
utils.py
py
6,758
python
en
code
3
github-code
1
28747607922
from logger import Logger l = Logger() @l.logging_func def test_func(): [i**i for i in range(1000)] for _ in range(3): test_func() l.logging_start() for _ in range(3): [i**i for i in range(1000)] l.logging_end('cycle') l.print_results()
maximchikAlexandr/Logger
main.py
main.py
py
256
python
en
code
0
github-code
1
29720274088
from mako import runtime, filters, cache UNDEFINED = runtime.UNDEFINED __M_dict_builtin = dict __M_locals_builtin = locals _magic_number = 4 _modified_time = 1224684001.22454 _template_filename='/media/disk/Pylons Book/Code/chapter06/FormExample-01/formexample/templates/derived/form.html' _template_uri='/derived/form.h...
Apress/def-guide-to-pylons
Code/chapter06/FormExample-01/data/templates/derived/form.html.py
form.html.py
py
5,241
python
en
code
1
github-code
1
74270410272
## modified the code: args.batch_size_val == 1 import os import random import numpy as np import torch import torch.backends.cudnn as cudnn import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data from visdom_logger import VisdomLogger from collections import defaultdict f...
glbreeze/RePRI_FSS
src/test_ida.py
test_ida.py
py
12,481
python
en
code
0
github-code
1
8139533988
class Solution: def lexicalOrder(self, n: int) -> list: datas = [[] for _ in range(10)] for i in range(1, n+1): s = str(i) datas[int(s[0])].append(s) for tmp in datas: tmp.sort() ans = [] for tmp in datas: tmp = list(map(int, ...
MinecraftDawn/LeetCode
Medium/386. Lexicographical Numbers.py
386. Lexicographical Numbers.py
py
421
python
en
code
1
github-code
1
36585832061
# Idea was thought of back in June of 2016 in regards to creating a way for qvpython script to easily manipulate an excel spreadsheet. After obtaining help from Vaso Vasich, this script was actually made in an effort by Vaso Vasich under the SDEP business, which is a subset of Arce Enterprises. # 2016 # First Author: V...
serbboy23/SDEP
addProducts.py
addProducts.py
py
10,350
python
en
code
0
github-code
1
18927725262
#!/usr/bin/env python3.8 """ Author : Kashif Khan This script helps to search Endpoint in following criteria. 1: All results 2: Filter by Node ID 3: Filter by EPG 4: Filter by VLAN ID 5: Filter by Interface Name 6: Filter by Tenant Name 7: Filter by MAC Address """ # Imports block from connectivity import get_aci_tok...
me-kashif/dcops
get_ep_details.py
get_ep_details.py
py
7,553
python
en
code
0
github-code
1
16914709414
import discord import os import json import gspread from oauth2client.service_account import ServiceAccountCredentials import asyncio import random from keep_alive import keep_alive scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.f...
amberosia/SecretSantaBot2022
main.py
main.py
py
12,031
python
en
code
0
github-code
1
24679754870
class Solution: def findKthLargest(self, nums: List[int], k: int) -> int: #bucket sort bucket = [0]* (2*(10**4 )+ 1) counts = Counter(nums) # print(counts) for idx in range(len(bucket)-1, -1, -1): k -= counts[idx - 10**4] ...
YosefAyele/Leetcode-and-Codeforces-Problems
0215-kth-largest-element-in-an-array/0215-kth-largest-element-in-an-array.py
0215-kth-largest-element-in-an-array.py
py
397
python
en
code
2
github-code
1
36085919680
# Задание 1 def Work1(): a = ['one', 'two', 'one', 'three', 'two'] b={} for i in a: if i not in b.keys(): b[i] = 0 else: b[i] += 1 print(b[i], end=' ') # Задание 2 def Work2(): a = int(input('Введите количество синонимов : ')) print(a) b = [input(...
AydenRU/pythonsem1
Сборник/Модульл_7.py
Модульл_7.py
py
3,258
python
en
code
0
github-code
1
39624609295
# author: Jeremy Temple, Eli Manning import enum class Tokens(object): def __init__(self): self._data = [] def __iter__(self): return iter(self._data) def append(self, token): self._data.append(token) @property def lookahead(self): return self._data[0] def c...
ECManning/Computer-Testing-Sictc
token_v1.py
token_v1.py
py
1,593
python
en
code
0
github-code
1
13135197629
#!/usr/bin/env python3 import os import aws_cdk as cdk # from eks_rds.eks_flask_rds_stack import EksFlaskRdsStack from _stacks.eks_rds import EksRdsStack env = cdk.Environment( account=os.environ.get("CDK_DEPLOY_ACCOUNT", os.environ["CDK_DEFAULT_ACCOUNT"]), region=os.environ.get("CDK_DEPLOY_REGION", os.environ...
rafty/eks_flask_rds
app.py
app.py
py
423
python
en
code
0
github-code
1
40572030080
#! /usr/bin/env python # -*- coding : utf-8 -*- import os import re import ujson from dotmap import DotMap from subprocess import check_output from datetime import datetime, timedelta # output = '(Connected)' in check_output( "scutil --nc list".split( ' ' ) ).decode( 'utf-8' ) # print( output ) refresh_delt...
subokita/dashboard
api/modules/test.py
test.py
py
801
python
en
code
0
github-code
1
42811137748
''' 이름, 전화번호, 이메일, 주소를 받아서 연락처 입력, 출력, 삭제하는 프로그램을 개발하시오. 단, 인명은 여러명 저장 가능합니다. ''' class Contacts(object): def __init__(self, name, tel, email, adress): self.name = name self.tel = tel self.email = email self.adress = adress def __str__(self): return f"{self.name} {sel...
gangsanlee2/flask-program
src/uss/mpe/service/contacts.py
contacts.py
py
1,080
python
ko
code
0
github-code
1
25265155442
def palindromo(palabra): pila = [] for letra in palabra: pila.append(letra) palabra_invertida = "" while len(pila) > 0: palabra_invertida += pila.pop() return palabra == palabra_invertida palabra = "reconocer" if palindromo(palabra): print(f"La palabra: {palabra} es u...
Irving-Mtz/Tarea-Lista-PIlas-Colas
E3.py
E3.py
py
402
python
es
code
0
github-code
1
71774011234
class Coche(): ruedas=4 puertas=5 largoChasis=260 anchoChasis=130 arrancado=False def arrancar(self): self.arrancado=True def estadoCoche(self): if(self.arrancado): return "El coche está funcionando" else: return "El coche está parado" mazda...
dvidals/python
poo.py
poo.py
py
508
python
es
code
0
github-code
1
8464147040
class Product(): def __init__(self, key, transport): self.key = key self.transport = transport def Encryption(self, plaintext): # Make Key Info keyList = self.key.split(' ') tranList = self.transport.split(' ') # Encryption ciphertextList = [''] * len(ke...
YoYo860224/Information-Security-Homework
HW1/YoYo/m6_product.py
m6_product.py
py
1,337
python
en
code
0
github-code
1
6619883045
import pytesseract import os import sys from PIL import Image from reportlab.pdfbase import pdfmetrics from reportlab.pdfgen import canvas from reportlab.lib.units import cm from reportlab.pdfbase.ttfonts import TTFont from reportlab.lib.pagesizes import A4 import fitz import shutil from PyQt5.QtGui i...
bydmak/pdfconvertpdf
main.py
main.py
py
3,708
python
en
code
0
github-code
1
39951557453
import pygame import sys class UI: def __init__(self, UIdeck): self.drawMap = {0:self.drawPlayer1, 1:self.drawPlayer2, 2:self.drawPlayer3, 3:self.drawPlayer4} self.discardMap = {0:self.discardCardP1, 1:self.discardCardP2, 2:self.discardCardP3, 3:self.discardCardP4} pygame.init() wi...
mseverinov/Uno
draw.py
draw.py
py
15,510
python
en
code
0
github-code
1
22357192638
# 该程序用动态规划算法 # 判断回文串可用判断s == s[::-1] def longestPalindrome(s): length = len(s) # 如果本身为回文数,则直接返回 if s == s[::-1]: return s # 设置最大长度和开始索引 max_len, begin = 1, 0 for i in range(1, length): odd = s[i - max_len - 1:i + 1] even = s[i - max_len:i + 1] if i - max_len >= ...
handsome-fish/Leetcode
question_bank/medium/最长回文子串.py
最长回文子串.py
py
743
python
en
code
1
github-code
1
39411332651
import pyrealsense2 as rs import numpy as np from pybot.cmn_structs import * from pybot.sensor_structs import * class RealsenseInterface(): def __init__(self): self.pipeline = rs.pipeline() config = rs.config() config.enable_stream(rs.stream.depth,1280, 720, rs.format.z16, 30) confi...
glebshevchukk/pybot
pybot/interfaces/realsense_interface.py
realsense_interface.py
py
2,167
python
en
code
0
github-code
1
19963060538
import os import sys import numpy as np from collections import OrderedDict def groupSinglets(comp_name): d = { "sm": "SM", "lin": "L ", "quad": "Q ", "lin_mixed": "M ", "sm_lin_quad": "SM+L+Q ", "quad_mixed": "Q+Q+M ", "sm_lin_quad_mixed": "SM+L+L+Q+Q+M ...
GiacomoBoldrini/D6tomkDatacard
makeDummies.py
makeDummies.py
py
25,816
python
en
code
2
github-code
1
26211091171
import os import unittest import itertools import traceback from chesspy import players from chesspy.game import Game from chesspy.board import Board from chesspy.color import Color from multiprocessing import Pool from chesspy.analyzers import is_in_check, is_in_mate, adjacent_kings class PlayerTest: class TestP...
mikepartelow/chesspy
app/tests/test_players.py
test_players.py
py
6,059
python
en
code
0
github-code
1
71846747555
from math import tan, pi def polysum(n: int, s: float) -> float: '''Returns the sum of the area and square of the perimeter of the polygon Args: n (int) -> number of sides of the regular polygon. s (float) -> the length of each side. Returns (float) -> the sum of area an...
lcsm29/edx-mit-6.00.1x
others/polysum.py
polysum.py
py
765
python
en
code
1
github-code
1
27863867426
import torch import torch.nn as nn import torch.optim as optim import torchtext from torchtext.datasets import SST from torchtext.data import Field, LabelField, BucketIterator from torchtext.vocab import Vectors, GloVe, CharNGram, FastText import time import torch.nn.functional as F from network import LSTM i...
shiml20/Deep-Learning-Basic-Code
NLP/main.py
main.py
py
6,336
python
en
code
3
github-code
1
73062175393
# https://github.com/Pierian-Data/Complete-Python-3-Bootcamp from random import randint def display_board(board): print(' ', '|', ' ', '|', ' ') print(board[7], '|', board[8], '|', board[9]) print('_', '|', '_', '|', '_') print(' ', '|', ' ', '|', ' ') print(board[4], '|', board[5], '|'...
amazed01/Python_Games
tic_tac_toe.py
tic_tac_toe.py
py
3,113
python
en
code
0
github-code
1
8662219899
from django.core.management.base import BaseCommand from django.utils.crypto import get_random_string from django.utils import timezone from user_paste.models import User, Post import datetime import string class Command(BaseCommand): help = 'Generates fake data for a local sqlite database' def add_arguments(...
LoganHodgins/Pasta-Paste
user_paste/management/commands/gen_localdb.py
gen_localdb.py
py
1,899
python
en
code
0
github-code
1
34576692489
import argparse import os import pickle from datetime import datetime, timedelta from matplotlib.dates import YearLocator, DateFormatter, MonthLocator import numpy from matplotlib import pyplot as plt from pandas.io.data import get_data_yahoo class Investor(object): """Represents a single investor with initial c...
wgaggioli/capeval
capeval.py
capeval.py
py
9,742
python
en
code
0
github-code
1
8139560888
from collections import defaultdict class Solution: def calcEquation(self, equations: list, values: list, queries: list) -> list: graph = defaultdict(list) for i in range(len(equations)): d1, d2 = equations[i] val = values[i] graph[d1].append((d2, val)) ...
MinecraftDawn/LeetCode
Medium/399. Evaluate Division.py
399. Evaluate Division.py
py
902
python
en
code
1
github-code
1
23771212656
from connections.connection import execute_query ## SHOW ALL SUPER HEROES ## def show_all_heroes(): show_heroes = """ SELECT * FROM heroes ORDER BY name ASC """ heroes = execute_query(show_heroes).fetchall() print("The Superheroes Are:") for hero in heroes: print("- " + hero...
nmcmillen/superhero-sql
stuff_read.py
stuff_read.py
py
1,766
python
en
code
0
github-code
1
11011921362
from django.urls import path from app_feria.views import * from django.contrib.auth.views import LogoutView from app_feria import views """ urlpatterns = [ path('', inicio, name="Inicio"), path('vuelo/', vuelo), path('personal/', personal), path('pasajero/', pasajero), path('sobrenostros', sobrenos...
Luciano02-web/feriaweb
app_feria/urls.py
urls.py
py
6,629
python
es
code
0
github-code
1
28569002681
def isqrt(a): x = a while True: x1 = (x * x + a) // (2 * x) if x1 >= x: return x x = x1 print(isqrt(16)) # есть целочисленный корень print(isqrt(17)) # нет целочисленного корня print(isqrt(16.)) # есть целочисленный корень - вернется число типа float print(isqrt(17.)) # нет целоч...
danfimov/work-projects
2784366/2.1/4.py
4.py
py
488
python
ru
code
0
github-code
1
72117216034
''' Created on 17/feb/2014 @author: Fabio ''' class bicicletta: ruote = 2 def __init__(self,colore,taglia,paccoPignoni,moltipliche): self.colore=colore self.taglia=taglia self.paccoPignoni=paccoPignoni self.moltipliche=moltipliche
geosconsulting/geospatialanalaysis_python
testoli/chiamata.py
chiamata.py
py
296
python
it
code
0
github-code
1
37932378891
import csv import datetime FILE_NAME_READ = "Before Eod.csv" FILE_NAME_WRITE = "After Eod.csv" FIELDS_NAME = [ "id", "Nama", "Age", "Balanced", "No 2b Thread-No", "No 3 Thread-No", "Previous Balanced", "Average Balanced", "No 1 Thread-No", "Free Transfer", "No 2a Thread-No",...
ikhwankhaliddd/Test-Techinical-ALAMI-Backend
Python Solution/without_thread.py
without_thread.py
py
2,404
python
en
code
0
github-code
1
32425408205
import dice from timmy.command_processors.base_command import BaseCommand from timmy.data.command_data import CommandData class DiceCommand(BaseCommand): user_commands = ['roll'] interaction_checks = False help_topics = [('user', 'amusement commands', '!roll <dice string>', 'Generates a random number, a...
utoxin/TimTheWordWarBot
timmy/command_processors/amusement/dicecommand.py
dicecommand.py
py
1,605
python
en
code
14
github-code
1
17959045428
# 틀린 테스트케이스를 찾아라.(Find wrong testcase) # 코드업에서 자신이 만든 문제를 풀던 광곽이는 자신이 만들었던 문제의 테스트케이스 # 가 틀렸음을 알아냈다! 광곽이는 어쩔줄 몰라서 admin에게 사과를 하고, 다시 코드업 # 문제 만들기에 도입했다. 하지만, 광곽이는 이번에도 admin에게 틀린 테스트케이스를 # 주고 말았고, admin은 광곽이에게 문제를 만드는 권한을 없애버렸다. 그에 광곽이는 # 다시는 그러지 않겠다고 다짐하고 테스트케이스에 오류가 있는지 확인하는 프로그램을 # 만들기로 했다. 광곽이가 만든 프로그램은 세 정수를 입력하면 ...
junes7/python_algorithm
CodeUp/I_O statements and operators/1720.py
1720.py
py
1,670
python
ko
code
1
github-code
1
30076925049
from selenium import webdriver from selenium.webdriver.common.by import By from web_test_base import WebTestBase from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.keys import Keys class TestOrder(WebTestBase): def test_valid_zipcode_works(self): driver = self.dr...
NTI-Gymnasieingenjor/pizza
tests/webtests/test_order.py
test_order.py
py
1,654
python
en
code
0
github-code
1
42698701042
import socket from socket import setdefaulttimeout import ipaddress import itertools import json from multiprocessing.pool import ThreadPool import subprocess import argparse import base64 import os class IPScan(): def __init__(self): setdefaulttimeout(0.10) self.open_ports = [] self.ports ...
JetBlackHackerCat/RedPython
NetworkScan.py
NetworkScan.py
py
2,104
python
en
code
0
github-code
1
35668813832
import spacy import json nlp = spacy.load('en') json_data = open('Book_Data_Set.json',encoding="utf8") data = json.load(json_data) title = "" for i in range (0, 10): doc = nlp(data[i]['description']) for np in doc: if np.pos_ == "NOUN" or np.pos_ == "PROPN": print (np.text,end='****') print()
niraj1997/IT556_Magic-Squad_DA-IICT
Assignment 3/Q1.py
Q1.py
py
316
python
en
code
0
github-code
1
7882420998
def safe_pawns(pawns: set) -> int: chpawns = set() chpawns1 = set() chpawns2 = set() for i in pawns: x = ord(i[0]) y = ord(i[1]) chpawns.add(str(x)+str(y)) chpawns1.add(str(x-1)+str(y+1)) chpawns2.add(str(x+1) + str(y+1)) return len(chpawns & chpawns1 | chpawn...
leff9f/pytest
Python/Checkio solves/Pawn Brotherhood.py
Pawn Brotherhood.py
py
679
python
en
code
1
github-code
1
17715159341
from django.conf.urls import url from .views import ( get_articles_list, home, search_articles, ) urlpatterns = [ # url(r'^create$', collection_create, name="create"), # url(r'^(?P<slug>[\w-]+)/add$', link_add, name='add'), # url(r'^(?P<slug>[\w-]+)(?:/(?P<tag>[\w-]+))?/$', collection_detail, ...
tohidur/HN_analysis
articles/urls.py
urls.py
py
1,032
python
en
code
0
github-code
1
28729835092
from datetime import timedelta from random import randint, choices import faker_commerce from django.core.management.base import BaseCommand from django_seed import Seed from faker import Faker from catalog.models import Category, Discount, Producer, Promocode, Product class Command(BaseCommand): help = "Fillin...
maximchikAlexandr/shop
catalog/management/commands/fakedata.py
fakedata.py
py
3,802
python
en
code
0
github-code
1
21317566914
# -*- coding: utf-8 -*- ''' 本文档用于对下载回来的图片文件夹内其中文件进行整理 作者:吴厚波 创建时间:2018-5-19 更新时间:2018-5-21 15:34:35 ''' import shutil, os import re base_path = 'H:\开车\Cosplay&写真\少女映画\\' re_video = re.compile(r'mp4|mkv|avi|rmvb|MTS|flv') re_nochange_name = re.compile(r'IMG|DSC') dirs = [] for name in os.listdir(base_path): if os...
originalMemory/Excercise
PythonEx/sort_file.py
sort_file.py
py
2,280
python
en
code
1
github-code
1
7659169926
# version code 761 # Please fill out this stencil and submit using the provided submission script. from vec import Vec from GF2 import one ## Problem 1 def vec_select(veclist, k): ''' >>> D = {'a','b','c'} >>> v1 = Vec(D, {'a': 1}) >>> v2 = Vec(D, {'a': 0, 'b': 1}) >>> v3 = Vec(D, { 'b': ...
ninjatadpole/brown-linear-algebra
matrix/hw2/hw2.py
hw2.py
py
3,276
python
en
code
0
github-code
1
10412643073
class PlayFairCipher: def __init__(self, key): self.key = key self.letter2index = self.get_letter_2_index_map() def get_letter_2_index_map(self): index_map = {} for row in range(len(self.key)): for column in range(len(self.key[row])): letter = self.ke...
anishLearnsToCode/cryptography
ciphers/PlayfairCipher.py
PlayfairCipher.py
py
2,634
python
en
code
13
github-code
1
19989094351
# -*- coding: utf-8 -*- from odoo import models, fields, api class Parnter(models.Model): _inherit = 'res.partner' #odoo通过child_ids,来为当前联系人关联子联系人,地址等。 #odoo中,多个联系人和多个联系地址都是通过child_ids来实现的。修改为:多对多的联系人,用独立的many_child_ids来实现。原来的child_ids用来保存多个地址(界面中屏蔽添加联系人) many_child_ids = fields.Many2many('res.partne...
anodoo/anodoo
customer/anodoo_contacts/models/res_partner.py
res_partner.py
py
1,597
python
zh
code
12
github-code
1
2542445603
import colors as c from utils import ask intro = c.orange + ''' Welcome to the orange quiz game!!!!!! ''' + c.reset def q1(): color = ask(c.yellow + 'What is the color of an orange?' + c.reset) if color == 'orange': return True print(c.red + 'You have failed' + c.reset) return False d...
gorroth1/python-1
oranges.py
oranges.py
py
748
python
en
code
0
github-code
1
71015674275
# https://www.acmicpc.net/problem/1157 import sys def get_maximum_freq_alphabet(w): alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" dic = {a: 0 for a in alpha} for c in w.upper(): dic[c] += 1 maxs = [] max_num = -1 for c in dic: if dic[c] > max_num: max_num ...
yskang/AlgorithmPractice
baekjoon/python/word_study_1157.py
word_study_1157.py
py
581
python
en
code
1
github-code
1
3196739593
class Solution(object): def scheduleCourse(self, courses): """ :type courses: List[List[int]] :rtype: int """ courses.sort(key = lambda x : x[1]) hq = [] day = 0 res = 0 for dur, ddl in courses: heapq.heappush(hq, -dur) ...
niufenjujuexianhua/Leetcode
course-schedule-iii/course-schedule-iii.py
course-schedule-iii.py
py
463
python
en
code
0
github-code
1
43006106252
# -*- mode: python ; coding: utf-8 -*- from PyInstaller.utils.hooks import collect_submodules hiddenimports = ['scipy.spatial.transform._rotation_groups', 'sqlalchemy.sql.default_comparator', 'sklearn.metrics._pairwise_distances_reduction._datasets_pair', 'sklearn.neighbors._partition_nodes', 'sklearn.metrics._pairwis...
labsyspharm/scope2screen
scope2screen_mac.spec
scope2screen_mac.spec
spec
1,564
python
en
code
13
github-code
1
12579239104
#defino librerias import csv import datetime as ti #constantes y variables opciones=""" Bienvenido __________________________ seleccione una opcion 1.Ingresar datos 2.salir """ runTime=True datetime = ti.date.today() #funciones """Recive el nombre del archivo atraves de un input de usuario y si el...
NicolasGabM/Cheques
listado_cheques.py
listado_cheques.py
py
3,145
python
es
code
0
github-code
1
33761197643
''' Given an integer x, return true if x is a palindrome, and false otherwise. Example 1: Input: x = 121 Output: true Explanation: 121 reads as 121 from left to right and from right to left. ''' class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool ""...
lou6891/leetcode_challenges
1._Easy/challenge_9.py
challenge_9.py
py
493
python
en
code
0
github-code
1
10786776517
#!/usr/bin/env python # -*- coding: utf-8 -*- import requests from bs4 import BeautifulSoup as bs def get_historical_data(name, number_of_days): data = [] url = "https://finance.yahoo.com/quote/" + name + "/history/" content = requests.get(url).content rows = bs(content, 'html.parser').findAll('table...
missweetcxx/fragments
projects/yahoo_finance/get_historical_data.py
get_historical_data.py
py
658
python
en
code
0
github-code
1
8139571648
from functools import cmp_to_key class Solution: def reconstructQueue(self, people: list) -> list: people = sorted(people, key=cmp_to_key(self.cmp)) ans = [] for p in people: ans.insert(p[1], p) return ans def cmp(self, a: list, b: list): if a[0] > b[0]: ...
MinecraftDawn/LeetCode
Medium/406. Queue Reconstruction by Height(sort&greedy).py
406. Queue Reconstruction by Height(sort&greedy).py
py
499
python
en
code
1
github-code
1
15007520934
"""Handles different kind of browser streams.""" import copy import logging from typing import Dict import cv2 import imutils import tornado.ioloop import tornado.web from tornado.queues import Queue from viseron.config.config_camera import MJPEG_STREAM_SCHEMA from viseron.const import TOPIC_FRAME_PROCESSED, TOPIC_S...
patmosxx-v2/viseron
viseron/webserver/stream_handler.py
stream_handler.py
py
7,556
python
en
code
null
github-code
1
6536893855
import torch from torch.nn import functional as F def compute_mvg(d_latents, latent_name, mean_v, inv_cov_v): if latent_name == "W": _w = d_latents["W"] _v = F.leaky_relu(_w, negative_slope=5.0) dv = (_v - mean_v) loss = (dv.matmul(inv_cov_v).matmul(dv.T)) return loss e...
adobe-research/sam_inversion
src/loss_utils.py
loss_utils.py
py
1,421
python
en
code
168
github-code
1
16515330397
import torch import pytorch_ssim device = torch.device("cuda" if torch.cuda.is_available() else "cpu") nc = 3 imsize = 256 def ssim(img, ref,weight_ssim): img = img.reshape(1, nc, imsize, imsize) img.requires_grad_() ssim_value = pytorch_ssim.ssim(ref, img) ssim_loss = pytorch_ssim.SSIM() ...
XG196/MAD613
ssim.py
ssim.py
py
885
python
en
code
0
github-code
1
3516381702
import stanza import json,re # # stanza.download('en') # This downloads the English models for the neural pipeline nlp = stanza.Pipeline('en') # This sets up a default neural pipeline in English field = "yugioh" f = open(field+"_entitys.json") field_entitys = json.load(f) f.close() max_num = 5000 def exist(tex...
leezythu/MetaBLINK
pseudo_sample.py
pseudo_sample.py
py
3,469
python
en
code
3
github-code
1
72557088994
#!/usr/bin/env python # coding: utf-8 # In[ ]: #!/usr/bin/env python # coding: utf-8 # In[ ]: # In[ ]: #!/usr/bin/env python # coding: utf-8 # In[ ]: """ Created on Fri Oct 13 20:37:30 2023 @author: saimo """ import streamlit as st import pandas as pd import matplotlib.pyplot as plt import seaborn as sns...
saimohan16/CMSE-830-Foundations-of-Data-Science
Framingham_app/app.py
app.py
py
35,064
python
en
code
0
github-code
1
26598747074
import sqlite3 as sql import json import os from datetime import datetime db = sql.connect('MainScripts/JIRATable.sqlite') c = db.cursor() # # c.execute('drop table if exists JIRAData') c.execute('''create table if not exists JIRAData (Key text, Status text, Summary text,Reporter text,IssueCreatedOn text, IssueUpdate...
kleban31/Webscrape-JIRA-Python
MainScripts/ins_JIRAData.py
ins_JIRAData.py
py
1,055
python
en
code
0
github-code
1
32425523875
import random import time from typing import Set import schedule from timmy import core from timmy.data.war_state import WarState from timmy.data.word_war import WordWar from timmy.db_access import word_war_db class WarTicker: def __init__(self): self.loaded_wars: Set[WordWar] = set() self.activ...
utoxin/TimTheWordWarBot
timmy/core/warticker.py
warticker.py
py
6,662
python
en
code
14
github-code
1
15976848887
#!/usr/bin/env python # coding: utf-8 import numpy as np import librosa from pathlib import Path from microphone import record_audio import matplotlib.mlab as mlab from os import listdir from os.path import isfile, join import song_titles_artists as sta def load_song_from_path(path: str): """ Loads a son...
andrewyang89/spectrazam
song_loading.py
song_loading.py
py
2,915
python
en
code
2
github-code
1
12078242829
import jittor as jt from jittor import init import math from os.path import join as pjoin from collections import OrderedDict from jittor import nn def np2th(weights, conv=False): 'Possibly convert HWIO to OIHW.' if conv: weights = weights.transpose([3, 2, 0, 1]) return jt.float32(weights)...
THU-CVlab/JMedSeg
model/TransUNet/vit_seg_modeling_resnet_skip.py
vit_seg_modeling_resnet_skip.py
py
6,666
python
en
code
56
github-code
1
72858288994
def main(): # YOUR CODE GOES HERE # Please take input and print output to standard input/output (stdin/stdout) # E.g. 'input()/raw_input()' for input & 'print' for output s=int(input()) for i in range(n) : n=str(input()) a=list(n) vowel =0 constant=0 for i in range(len...
dpksinha16/Phython
Dictionary/DictFile.py
DictFile.py
py
571
python
en
code
0
github-code
1
38784164623
from flask import Flask, render_template, request import requests from flask_fontawesome import FontAwesome import folium import csv from folium.plugins import HeatMap import datetime from flask import Response import statistics import matplotlib.pyplot as plt from matplotlib.figure import Figure from matplotlib.backen...
andrew-hua/Y10Coding
trafficprogramfiles/hello.py
hello.py
py
7,155
python
en
code
0
github-code
1
33879492913
import sys, time import numpy as np import matplotlib.pyplot as pl from matplotlib.backends.backend_pdf import PdfPages import h5py from combined_model import CombinedInterpolator from spi.comparison_models import PiecewiseC3K from spi.utils import dict_struct, within_bounds from spi.plotting import get_stats, qualit...
bd-j/spi
demo/miles_irtf_c3k/loo_combined.py
loo_combined.py
py
7,722
python
en
code
3
github-code
1
36455813607
import array from math import sqrt, ceil from step_gen import Delay try: file = open("lib/cos_table.py") except FileNotFoundError: file = open("cos_table.py") finally: num = int(file.readline().strip()) TABLE = array.array("H", [0] * num) for i in range(num): TABLE[i] = int(file.readline()....
ktritz/stepper_pio
lib/scurve_delay.py
scurve_delay.py
py
5,624
python
en
code
4
github-code
1
34707682040
"""A Flask webapp. Application factory. From the ``Flask`` docs: Instead of creating a ``Flask`` instance globally, we will create it inside a function. This function is known as the application factory. Any configuration, registration, and other set up the application needs will happen inside the fu...
jshwi/jss
app/__init__.py
__init__.py
py
1,447
python
en
code
4
github-code
1
17569487689
from Connect import cursor from Connect import conn # from main import uiDisplay import mainui def deleting(): selectall() deleteno = eval(input("请选择你要删除的号码")) cursor.execute('DELETE FROM MemInfoSheet WHERE DestNo=%d',deleteno) conn.commit() selectall() def updating(): print("...
glory1213/databasehomework
TouristInfo.py
TouristInfo.py
py
5,343
python
en
code
0
github-code
1
32472415871
# func_variable_access.py ## The scope of a functions argument is limited to the running function ## returns ## returns can be used with a variable to store the result of a function ## this pratice is called a returned function value ## example 1 def calculate_exchange_usd(us_dollars, exchange_rate): return us_d...
jon-xo/python-practice
lesson-intro/functions/func_scope_and_returns.py
func_scope_and_returns.py
py
1,298
python
en
code
0
github-code
1
1146152765
import sys input = sys.stdin.readline n = int(input()) lst = [[False]*8 for _ in range(n)] ret = [] for i in range(n): ok = 9 for j in range(8): if lst[i][j] == False and lst[(i+1)%n][j] == False: ok = min(ok,j) ret.append(ok+1) lst[i][ok] = True lst[(i+1)%n][ok] = True print(*r...
seoljeongwoo/learn
algorithm/boj_21313.py
boj_21313.py
py
323
python
en
code
0
github-code
1
32808601313
# Python Program to print Prime Numbers from 1 to n import time minimum = int(input("Please Enter the Minimum Value:")) maximum = int(input("Please Enter the Maximum Value:")) Number = minimum sum = 0 start = time.time() while(Number <= maximum): count = 0 i = 2 while(i <= Number//2): if(...
StephenH69/Python-Scripts
primes.py
primes.py
py
642
python
en
code
1
github-code
1
3789596757
from django.shortcuts import render, HttpResponse, redirect # HttpResponse = texto / redirect = redirecciones from miapp.models import Article # Para usar modelos from django.db.models import Q # Para usar OR en consultas from miapp.forms import FormArticle # Para usar la clase formulario from django.contrib import mes...
jesusbritomolina/Master-Python
22-django/AprendiendoDjango/miapp/views.py
views.py
py
10,896
python
es
code
0
github-code
1
10258597621
#!/home/ha74mit/bin/miniconda3/envs/anc_virus/bin/python3.6 # The script merges contig lengths and depths on equal contig identifiers # IMPORTS import matplotlib.pyplot as plt import matplotlib.axes as axes import numpy as np import sys, os # Specify input files len_file = sys.argv[1] depth_file = sys.argv[2] outp...
marlt/MA_Methods
contig_deplen.py
contig_deplen.py
py
1,056
python
en
code
0
github-code
1
20828422696
from projects.models import * from communities.models import * from users.models import MossaicUser from risk_models.models import * from django import forms from django.forms.models import inlineformset_factory from django.forms.models import modelformset_factory from django.forms.models import BaseInlineFormSet fro...
parauchf/mossaic
risk_models/forms.py
forms.py
py
2,232
python
en
code
1
github-code
1
10785625199
# coding:utf-8 """ @file: .py @author: dannyXSC @ide: PyCharm @createTime: 2022年05月04日 21点47分 @Function: 请描述这个py文件的作用 """ from Modal.Affiliation import Affiliation from py2neo import Graph, NodeMatcher, Node class AffiliationRepo: label = "Affiliation" def __init__(self): pass @staticmethod ...
dannyXSC/BusinessIntelligence
ETL/Repository/AffiliationRepo.py
AffiliationRepo.py
py
1,653
python
en
code
0
github-code
1
27808606756
import numpy as np import tensorflow as tf gpus = tf.config.experimental.list_physical_devices('GPU') tf.config.experimental.set_memory_growth(gpus[0], True) print(tf.__version__) fashion_mnist = tf.keras.datasets.fashion_mnist (train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data() cl...
karthikrao5/tf-tutorials
mnist-fashion/mnist_cnn.py
mnist_cnn.py
py
1,650
python
en
code
0
github-code
1
6831655892
import numpy as np import imageio from skimage.transform import resize from scipy.ndimage import gaussian_filter import matplotlib.pyplot as plt import timeit def mssim( x: np.ndarray, y: np.ndarray, ) -> float: # Standard choice for the parameters K1 = 0.01 K2 = 0...
6-62x10-34Js/ImageProcessingAndPatternRecognition
interpolation_error_bluethner.py
interpolation_error_bluethner.py
py
4,093
python
en
code
0
github-code
1
1969927426
import os import json import argparse import time import logging from bs4 import BeautifulSoup from typing import Optional, Dict from doc2txt.grobid2json.grobid.grobid_client import GrobidClient from doc2txt.grobid2json.tei_to_json import convert_tei_xml_file_to_s2orc_json, convert_tei_xml_soup_to_s2orc_json from doc2...
clowder-framework/extractors-s2orc-pdf2text
doc2txt/grobid2json/process_pdf.py
process_pdf.py
py
3,947
python
en
code
1
github-code
1
1887982137
import datetime def check_hour(hour): """ Check if an hour format is valid for the bot. :param hour: :return: """ if not hour: return False # If there are not ":" in the hour, is invalid. if ":" not in hour: return False # Here it divides the hour in hours and min...
FernandooMarinn/Extra_hours_bot
Functionalities/Functionalities.py
Functionalities.py
py
18,933
python
en
code
0
github-code
1
41168930401
import math puzzle = [ [0, 0, 0, 0, 0, 0, 2, 0, 0], [0, 8, 0, 0, 0, 7, 0, 9, 0], [6, 0, 2, 0, 0, 0, 5, 0, 0], [0, 7, 0, 0, 6, 0, 0, 0, 0], [0, 0, 0, 9, 0, 1, 0, 0, 0], [0, 0, 0, 0, 2, 0, 0, 4, 0], [0, 0, 5, 0, 0, 0, 6, 0, 3], [0, 9, 0, 4, 0, 0, 0, 7, 0], [0, 0, 6, ...
bigmacd/miscPython
sudoku.py
sudoku.py
py
1,757
python
en
code
0
github-code
1
44625569644
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 26 00:02:01 2018 @author: elenabg """ import sys import time import pickle import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt import re import csv df_all = pickle.load(open("df_all.p", "rb")) # cargar dataframe...
ElenaBadilloG/Noche-y-Niebla-Project
explore_all_data.py
explore_all_data.py
py
4,608
python
en
code
0
github-code
1
37397179102
import os import os.path import sys from oa_utils import text_model_tag2id if __name__ == '__main__': base_path = "../../../" # MAIN SETUP #################### main_setup = "emotion" print("Main setup: %s" % main_setup) # LABEL PATH #################### labels_path = base_path + "da...
vadel/ACPD
adv_attacks/text/openattack/launcher_pack_tar.py
launcher_pack_tar.py
py
2,613
python
en
code
1
github-code
1
72974484835
from datetime import datetime from models.models import User, App, Lumos from api import db def resolve_users(obj, info): return User.query.all() def resolve_user(obj, info, user_id): return User.query.get(user_id) def resolve_create_user(obj, info, username, email, password): new_user = User(username=u...
EdMarzal97/dux-backend
api/resolvers.py
resolvers.py
py
2,765
python
en
code
0
github-code
1
31386333656
from lingpy import * from lingpy.evaluate.acd import * from collections import defaultdict, OrderedDict from lingpy.evaluate.acd import _get_bcubed_score def get_rhymes(dataset): csv = csv2list(dataset+'.tsv', strip_lines=False) header = [h.lower() for h in csv[0]] rest = csv[1:] out = [] ...
digling/network-in-hcp-paper
evaluation/rhymes.py
rhymes.py
py
3,252
python
en
code
3
github-code
1
8865653662
# -*- coding: utf-8 -*- """ Created on Wed Jul 31 09:10:52 2019 @author: Acer """ #%% import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns data=pd.read_csv(r"D:\projects\zomato.csv") data.describe() data.columns # Transforming rate column data['rate_new'] = data['rate'].ast...
atharva246/Machine-Learning-and-Data-Science
Zomato's Restaurant Rating Prediction.py
Zomato's Restaurant Rating Prediction.py
py
9,234
python
en
code
0
github-code
1
14386321921
# 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 buildTree(self, preorder: List[int], inorder: List[int]) -> TreeNode: """ 어떤 순회...
hyo-eun-kim/algorithm-study
ch16/yujin/week9/week9_3.py
week9_3.py
py
734
python
en
code
0
github-code
1
74540222432
# coding: utf-8 from traitlets import Type, Instance, default from .baseapp import NbGrader from ..plugins import ExportPlugin, CsvExportPlugin from ..api import Gradebook aliases = { 'log-level' : 'Application.log_level', 'db': 'CourseDirectory.db_url', 'to' : 'ExportPlugin.to', 'exporter': 'ExportAp...
jupyter/nbgrader
nbgrader/apps/exportapp.py
exportapp.py
py
2,458
python
en
code
1,232
github-code
1
22671766795
# http://codeforces.com/group/P8UZg7UOT5/contest/225111/problem/G def SuperMarkets(): markets, kilos = map(int, input().strip().split()) min_price = None while(markets > 0): weight, cost = map(int, input().strip().split()) price = weight/cost ...
ece-mohammad/CodeForces
SuperMarkets.py
SuperMarkets.py
py
536
python
en
code
0
github-code
1
30298048425
''' Created on 28 jun. 2016 @author: TomLoonen ''' class _Select_Stent_Endpoints: def __init__(self,ptcode,ctcode,basedir, clim=None): """ select start and endpoints to be used for centerline generation """ from stentseg.apps._3DPointSelector import select3dpoints # from stentseg.a...
almarklein/stentseg
nellix/_select_stent_endpoints.py
_select_stent_endpoints.py
py
1,379
python
en
code
3
github-code
1
16852470788
#import numpy as np #import cv2 #cap = cv2.VideoCapture(0) #while(True): # ret, frame = cap.read() # gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # cv2.imshow('frame', gray) # if cv2.waitKey(1) & 0xFF == ord('q'): # break #cap.release() #cv2.destroyAllWindows() if __name__ == '__main__': x = "ECE_180_D...
jcr7467/180DA-WarmUp
test.py
test.py
py
435
python
en
code
0
github-code
1
43788672806
def fun(): for i in range(20): x = yield i print('good', x) def htest(): i = 1 while i < 4: n = yield i if i == 3: return 100 i += 1 def itest(): val = yield from htest() print("hello") print(val) t = itest() t.send(None) j = 0 while j < 3: ...
kexiaomeng/python
1111test.py
1111test.py
py
1,109
python
en
code
0
github-code
1
70762640994
import time from kutuphane import * print(""" ****** İşlemler ******* 1.Kitapları Göster 2.Kitap Sorgulama 3.Kitap Ekle 4.Kitap Sil Çıkmak için q'ya basınız """) kitap = Kitap("Otomatik Portakal", "Anthony Burges","Palme", 300) kutuphane = Kutuphane(); while True: islem = input("İşlem seçiniz: ") ...
cansu846/Python-Project
Kütüphane Projesi/proje_deneme.py
proje_deneme.py
py
1,498
python
tr
code
0
github-code
1
38566471078
from time import time def ant_matrix(len_arr): start = time() prev_arr = [1] print(prev_arr) for i in range(1, len_arr): current_arr = [] prev_index = 0 prev_num = 0 flg = True prev_arr_len = len(prev_arr) while(flg): count = 0 pr...
ZombaSY/ToyCode
toy_code/Ant Sequence.py
Ant Sequence.py
py
979
python
en
code
0
github-code
1
35471149942
from .....parabank.src.base_element import BaseElement, Dropdown from .....parabank.src.pages.base_parabank_page import BaseParabankPage from .....parabank.src.pages.locators.account_services_pages_locators.transfer_funds_locators import TransferFundsLocators from .....parabank.src.pages.exceptions.custom_exceptions...
vshkugal/pythonProject
parabank/src/pages/account_services_pages/transfer_funds_page.py
transfer_funds_page.py
py
1,873
python
en
code
0
github-code
1
18555835371
import requests from bs4 import BeautifulSoup from selenium import webdriver import time import random import os from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine from model import * from user_agent import generate_user_agent import re MAIN_URL = 'https://usa.tommy.com/ProductListingView' d...
nonameuser2019/parser_tommy
parser.py
parser.py
py
9,682
python
en
code
0
github-code
1
12651433402
import requests import re # Manual PDF: https://www.correios.com.br/a-a-z/pdf/rastreamento-de-objetos/manual_rastreamentoobjetosws.pdf class Objeto(object): def __init__(self, *args, **kwargs): self.cepDestino = "" self.dataPostagem = "" self.eventos = list() self.numero = kwargs.g...
lmassaoy/docker-rastreio-correios
python/external_communication/correios.py
correios.py
py
5,318
python
pt
code
12
github-code
1
7593845965
import os # here i'll test the open() function with the "x" (exclusive creation) attribute # this should only allow me to write to file if it doesn't exist yet os.chdir(os.path.dirname(__file__))# get absolute path to the file #first time, should write only if file doesn't exist f = open("file_xc.txt", "x", encoding ...
ezxpro/learning_python
file_management/write_file_xc.py
write_file_xc.py
py
582
python
en
code
0
github-code
1
20628891853
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 5 19:54:41 2020 @author: phalinp """ import cv2 as cv import numpy as np def draw_rectangle(img): cv.rectangle(img,(384,0),(510,128),(0,255,255),3) #For rectangle if have to give top left corner i.e. (384,0) #and bottom right i....
P-H-Pancholi/opencv-python-tutorials
GUI_Features/draw_shapes_on_image.py
draw_shapes_on_image.py
py
1,190
python
en
code
0
github-code
1
21578951425
# -*- coding:utf-8 -*- """ time:2021/2/24 author:李辰旭 organization: BIT contact: QQ:316469360 —————————————————————————————— description: $ 处理二值合成轨迹图的一些函数。 主要包括: 滤波降噪 提取轮廓质心 拟合二次曲线 计算像素高度 —————————————————————————————— note: python3.7以上版本才可运行 """ import numpy as np import cv2 as cv from scipy.optimiz...
ChenXu-Li/kinect_measure_height
process.py
process.py
py
4,148
python
zh
code
2
github-code
1