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
71133547387
from Logic.crud import add_cheltuiala, delete_cheltuiala from Domain.cheltuiala import to_str def new_menu(): ''' Meniu pentru consola noua :return: ''' print(''' Tasteaza comenzile separate prin ";". Comenzi acceptate: add, delete, showall, exit, help. Tasteaza "help" pentru a afla detalii ...
AP-MI-2021/lab-567-mirunaxb
UI/command_line_console.py
command_line_console.py
py
1,700
python
en
code
0
github-code
6
14593025601
from Atum.models.hpo import HPOManageService if __name__ == '__main__': hpo_service = HPOManageService() config = dict() config['search_space'] = { 'learning_rate': {'_type': 'uniform', '_value': [0.001, 0.005]}, 'batch_size': {'_type': 'choice', '_value': [32, 64, 128]} } config['p...
TrellixVulnTeam/classification_LJ3O
tools/automl_tools/run_hpo.py
run_hpo.py
py
809
python
en
code
0
github-code
6
34660221121
print('Are you ready to play!') start=input('Yes(or)No :').lower() score=0 if start !='yes': quit() print("let's play :)") ans=input("which is the smallest ocean in the world? ").lower() if ans=='arctic': print('correct!') score +=1 else: print('incorrect!') ans=input("which is the oldest language...
Itischandru/quiz_game
quiz game.py
quiz game.py
py
773
python
en
code
0
github-code
6
31501456333
from django.urls import path, include from . import views from django.conf.urls.static import static from django.conf import settings urlpatterns = [ path("", views.index, name='index'), path("news/<int:id>/", views.see_full_news), path("main_page/", views.main_page, name='main_page'), path("dataselect/...
AlekseiMuryskin/SiteGS
gsras/urls.py
urls.py
py
809
python
en
code
0
github-code
6
44900991873
import torch import torch.nn as nn from argparse import Namespace from layers.Layers import DualAttenion, Transpose class CARD(nn.Module): def __init__(self, args: Namespace) -> None: super(CARD, self).__init__() self.patch_len = args.patch_len self.stride = args.stride self.embed...
Jarlene/AlgoRepo
models/ts/card.py
card.py
py
3,357
python
en
code
0
github-code
6
9202556126
#!/usr/bin/env python # -*- coding: utf-8 -*- from PIL import Image def make_data_index(args, index): ''' :param args: :param index: :return: ''' # K is for K-fold cross-validation # k is The k-th fold used for test K = args.K_fold # Here, we don't use this because we use 10-fold cro...
SuperBruceJia/NLNet-IQA
Cross Database Evaluations/lib/make_index.py
make_index.py
py
2,658
python
en
code
8
github-code
6
29969829561
""" MongoDB Interaction - A simple example for future developments Fabio Bove | fabio.bove.dr@gmail.com """ #!/usr/bin/env python # coding: utf-8 # Imports from pymongo import MongoClient class MongoUtils: def __init__(self, auth_param: str, collection_name: str, database_name: str, data: dict) -> None: ...
fabiobove-dr/mongo-db-interaction-utils
src/MongoUtils.py
MongoUtils.py
py
5,532
python
en
code
0
github-code
6
71357251707
import socket from _thread import * import json def global_logging(type_d, data): if type_d == "v": print("[*] VERBOSE :" + str(data)) elif type_d == "i": print("[I] INFO :" + str(data)) elif type_d == 'd': print("[D] DEBUG :" + str(data)) elif type_d == "a": print("[A...
HyeonBell/Tool
python/simple_socket_server/server.py
server.py
py
3,051
python
en
code
0
github-code
6
25069811529
"""TC:O(n*m),SC:O(m or n)""" class Solution(object): def matrixReshape(self, mat, r, c): """ :type mat: List[List[int]] :type r: int :type c: int :rtype: List[List[int]] """ result = [[0 for _ in range(c)]for _ in range(r)] if (r*c)!=(len(mat)*len(mat...
ankitarm/Leetcode
Python/566.Reshapethematrix.py
566.Reshapethematrix.py
py
705
python
en
code
0
github-code
6
31263506941
from selenium import webdriver from ordered_set import OrderedSet import time import os import csv os.system("cls") f=open("99acres.csv","w",encoding='utf-8') csv_writer= csv.writer(f) csv_writer.writerow(['Project', 'specification', 'area','Value']) driver = webdriver.Chrome('D:/virtualenvs_muthu/sele...
Muthu1612/Optimizing-real-estate-price-prediction-with-various-machine-learning-algorithms
Data extraction/extract_data.py
extract_data.py
py
1,450
python
en
code
1
github-code
6
10917250777
from collections import namedtuple from backend.DBEntry import DBEntry, to_db_obj_name from backend.Ingredient import Ingredient class Recipe(DBEntry): """A recipe of a dish. Consists of ingredients with optional amount (in optional units).""" table_main = "recipes" associations = [ ("user_meals"...
Longneko/demo_food_app
backend/Recipe.py
Recipe.py
py
10,035
python
en
code
0
github-code
6
6951483307
def plot_sine_1D(amp,wavelength,phase): x = np.arange(-500, 501, 1) y = np.sin((2 * np.pi * x / wavelength)+phase) plt.plot(x, y) plt.show() plot_sine_1D(1,300,0) def plot_sine_2D(amp,wavelength,phase,angle): x = np.arange(-500, 501, 1) X, Y = np.meshgrid(x, x) wavelength = 100 sine_2D ...
rvats/PyRAVE
UnBlurImage.py
UnBlurImage.py
py
3,425
python
en
code
0
github-code
6
73876831548
from os import path from .dictbuilder import DictBuilder # Dictionary is an in-memory representation of the dictionary of terms for a given corpus # Internally, we represent the volume as a set, since that gives us O(1) access, which makes # constructing an index much faster. class Dictionary: # key = dictionary ...
tsontario/minerva
pkg/dictionary/dictionary.py
dictionary.py
py
1,072
python
en
code
2
github-code
6
39991774220
import os from glob import glob from pathlib import Path SOURCE_DIRECTORY = "CSVdatabases" TARGET_DIRECTORY = "cleaned_databases" CURRENT_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) DATABASES_FOLDER = f"{CURRENT_DIRECTORY}/{SOURCE_DIRECTORY}" CLEANED_FOLDER = f"{CURRENT_DIRECTORY}/{TARGET_DIRECTORY}" def...
DekunZhang/UCL_IFRC_IXN_PUBLIC
DesInventar/data_cleaner.py
data_cleaner.py
py
1,417
python
en
code
0
github-code
6
44904287123
import torch from experiment import Experiment, AutoDateSet, train, get_args from model.Tree import Tree from dataset.criteo import CriteoDataset def get_model(args): model = Tree(args) return model def get_dataset(args): dataset = CriteoDataset(dataset_path=args.dataset_paths[0]) train_length = in...
Jarlene/Experiment
tree_main.py
tree_main.py
py
1,237
python
en
code
0
github-code
6
74416657149
# Ten program dzieli jedną liczbę przez drugą. def main(): # Pobranie dwóch liczb. num1 = int(input('Podaj liczbę : ')) num2 = int(input('Podaj następną liczbę: ')) # Jeżeli wartość num2 jest inna niż 0, następuje # podzielenie num1 przez num2 i wyświetlenie wyniku. if num2 != 0: resul...
JeanneBM/Python
Owoce Programowania/R06/06. Division2.py
06. Division2.py
py
506
python
pl
code
0
github-code
6
18598085905
from __future__ import annotations from .base import BaseDAO from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from dto import PlayerDTO class PlayerDAO(BaseDAO): def create(self, data: PlayerDTO) -> None: self._db_gateway.cursor.execute("INSERT INTO profiles (phone, username, description, age, ...
pyteacher123/py35-onl
sports_db_project/data_access/dao/player.py
player.py
py
1,747
python
en
code
2
github-code
6
2298576928
#!/usr/bin/env python import sys import logging import time import argparse import pyBigWig import math import numpy as np from sklearn import preprocessing from MSTS.version import __version__ from MSTS.Parser.SimpleGffParser import SimpleGffParser from MSTS.Db.FeatureDB import FeatureDB from MSTS.Graphics import Gr...
nlapalu/MSTS
bin/MSTS_feature_phasogram.py
MSTS_feature_phasogram.py
py
18,845
python
en
code
0
github-code
6
6365552957
import threading from flask import Flask, jsonify, Response import asyncio from camera import Camera from websocketServer import VideoWs from flask_cors import CORS from config import ip, http_port from queue import Queue app = Flask(__name__) CORS(app) camera = Camera() event = threading.Event() queue = Queue() @a...
l5769389/py-vue-ws-camera
router.py
router.py
py
1,400
python
en
code
0
github-code
6
27215468512
# # Dependency for album cover download # from urllib import request # # thumbnail_path = "https://i.ytimg.com/vi/uijHb5U1pD8/default.jpg" # album_cover = request.urlretrieve(thumbnail_path, "albumcover.jpg") import requests f = open('image.jpg', 'wb') f.write(requests.get('https://i.ytimg.com/vi/uijHb5U1pD8/default.j...
iostate/PythonProjects
DownloadMP4/open_image.py
open_image.py
py
343
python
en
code
0
github-code
6
23753938918
# -*- coding: utf-8 -*- ''' Created on 2019��3��5�� @author: Administrator ''' def is_palindrome(n): str_n = str(n) half_length = len(str_n)/2 for i in range(half_length): if str_n[i] != str_n[len(str_n)-1-i]: return False return True if __name__ == '__main__': output = filter(...
chptcleo/PythonPractice
com/list/palindrome/palindrome_num.py
palindrome_num.py
py
637
python
en
code
0
github-code
6
71897328507
import os import time import psutil def run_excel(): while True: os.system(f'start excel possible_duplicate_people.xlsx') while True: time.sleep(1) excel_running = False for process in psutil.process_iter(attrs=['pid', 'name']): if "EXCEL.EXE" in ...
FrontendPony/XML-parser
open_excel.py
open_excel.py
py
550
python
en
code
0
github-code
6
72489782587
# This program computes hardcoded values with 4th-order Rutta-Kunge for testing. # It takes reference from the below link, but is modified to converge on a solution # and uses two differentials instead of one. # https://www.codesansar.com/numerical-methods/runge-kutta-fourth-order-rk4-python-program.htm import math ...
curz46/bholetrace
rk4_r0.py
rk4_r0.py
py
2,381
python
en
code
1
github-code
6
11740151374
''' Author: Ganesh Manal Example code: Check if text is palindrome ''' def is_palindrome(input_string): ''' check if input text is palindrome Input: text Output: boolean - True if text is palindrome ''' start_index, last_index = 0, len(input_string)-1 while start_index <= last_index: ...
GaneshManal/TestCodes
python/training/module-01/03-check_palindrome.py
03-check_palindrome.py
py
823
python
en
code
2
github-code
6
12161841216
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 26 14:10:45 2021 @author: manssandsjo """ import matplotlib.animation as ani import matplotlib.pyplot as plt import numpy as np import pandas as pd lstm_lw = pd.read_pickle('./pickle_graphs/totValueLSTM_LW.pkl') #.to_numpy() lstm_scm = pd.read_pick...
MansSandsjo/StockBot
src/Data/testGraphs.py
testGraphs.py
py
1,267
python
en
code
0
github-code
6
10012294494
#!/usr/bin/python # coding=utf-8 import paramiko import xlrd import time import os import handle_file server_info_list = handle_file.read_excel_xlsx('documents/server_info.xlsx', 'Sheet1') Host = server_info_list[0][0] Port = server_info_list[0][1] Username = server_info_list[0][2] Password = server_info_list[0][3] d...
July666/python_workspace_component
main.py
main.py
py
8,134
python
en
code
0
github-code
6
41675461400
# 전역 임무 """ 1. 기지에 진입 2. 숫자가 작은 순서대로 정렬한다. 3. -1의 숫자를 저장해놓고 제일 약한 몬스터부터 조진다. 4. 몬스터를 죽일 파워가 부족하다면 -1을 하나 소비한다. 5. 파워가 부족하고 소비할 -1이 없다면 임무 달성 실패 6. 끝까지 올라간다면 기지 파괴 성공 (나가기 전에 가진 아이템을 모두 소진한다) """ import sys input = sys.stdin.readline N, M, power = map(int, input().split()) bases = [list(map(int, input().split()))...
jisupark123/Python-Coding-Test
contest/제2회 보라매컵 본선/30205.py
30205.py
py
1,124
python
ko
code
1
github-code
6
3668384154
#!/usr/local/bin/python3 import boto3 networkAclId = 'acl-26cc1243' ignoreEntries = [100, 32767] session = boto3.Session() client = session.client('ec2') acls = client.describe_network_acls() def getMaxOfRuleNumbers(): result = [0] for acl in acls['NetworkAcls']: if acl['NetworkAclId'] == netw...
debeando/MyScripts
aws/aws_network_acl_block_ip.py
aws_network_acl_block_ip.py
py
1,606
python
en
code
1
github-code
6
71750331067
from flask import Flask, render_template, request, session, redirect, url_for from flask_session import Session import sqlite3 from ast import literal_eval import datetime app = Flask(__name__) # Set the secret key to some random bytes. Keep this really secret! app.secret_key = b'_5#y2L"F4Q8z\n\xec]/' @app.route('/...
mason-landry/lighttimer
lighttimer_app/app.py
app.py
py
4,048
python
en
code
0
github-code
6
73307642428
import pandas as pd import psycopg2 as ps import datetime as dt from datetime import datetime from dateutil import tz from config import POSTGRES_DBNAME, POSTGRES_PASSWORD, POSTGRES_USERNAME, POSTGRES_PORT, POSTGRES_ADDRESS, API_KEY """ Functions for Flask App """ # dict with available exchange/trading pair for trade...
dbreddyAI/cryptolyticapp
api_source_code/Flask_App/utils.py
utils.py
py
9,012
python
en
code
2
github-code
6
20955203674
from selenium import webdriver from selenium.webdriver.common.by import By import time # from selenium.webdriver.common.keys import Keys # from selenium.webdriver.support import expected_conditions as EC # from selenium.webdriver.support.ui import WebDriverWait def Scrape(today): # setup chrome_options = webd...
colin-lankau/Crossword-Practice-Tool
Scrape.py
Scrape.py
py
1,416
python
en
code
0
github-code
6
21700191213
# Reference : https://textgears.com/api/ import requests text = input() text = text.replace(' ','+') url = "https://api.textgears.com/check.php?text=" + text + "&key=DEMO_KEY" resp = requests.get(url) resp = resp.json() if resp['result']: for err in resp['errors']: print("Error at position : ",err['offset']+1) ...
kapoor-rakshit/pyfiddle
grammar.py
grammar.py
py
475
python
en
code
0
github-code
6
13638156261
#!/usr/bin/env python import RPi.GPIO as GPIO import time # Pin Definitions output_pins = [17 , 22, 6, 19] # BCM pin def main(): # Pin Setup: # Board pin-numbering scheme GPIO.setmode(GPIO.BCM) # set pin as an output pin with optional initial state of HIGH for p in output_pins: GPIO.setup...
p513817/Custom_Coral_Teachable_Machine
project_teachable_v3/check_leds.py
check_leds.py
py
806
python
en
code
1
github-code
6
3037264375
import os import numpy as np import pandas as pd from PIL import Image import matplotlib.pyplot as plt import seaborn as sns; sns.set() from sklearn.manifold import TSNE from sklearn.manifold import Isomap from sklearn.decomposition import PCA from sklearn.cluster import KMeans from matplotlib import offsetbox #direct...
estimatrixPipiatrix/decision-scientist
pythonCode/kmeans/kmeans_avatars.py
kmeans_avatars.py
py
1,534
python
en
code
0
github-code
6
72528403069
import os, csv from random import sample import nltk as nlp import pandas as pd import matplotlib.pyplot as plt sampleSize = 200 sampleTimes = 50 TTR = [] years =[] # Iterate through word count/list file with open('wordCountsNLTK.csv', 'r', encoding="ISO-8859-1") as csvFile: reader = csv.reader(csvFile) next(reader...
stkeller/Replication-Thesis
Code/LexicalTTRSampling.py
LexicalTTRSampling.py
py
1,075
python
en
code
0
github-code
6
23559591731
import numpy as np import matplotlib.pyplot as plt N = 1000 #Nombre de tirages X = np.random.rand(N) #Tirages independants de la loi uniforme sur [0,1] ##################################### # But: calculer la suite des moyennes # empiriques pour n de 1 a N ##################################### ## Calcul d...
FanJiang718/Courses-Exercises
MAP556/TP1/TP1 Python solutions-20181211/MAP556_PC1_Exo1_1_sol.py
MAP556_PC1_Exo1_1_sol.py
py
1,073
python
fr
code
0
github-code
6
27281672101
import math import time import sys import numpy as np import operator import random import os from kll import KLL random.seed(30) #def get_approx_res(value, i): def get_approx_res(value, true_median, true_avg, true_tail): #global all_median #global all_avg #global all_tail #Using sketch to store dige...
deltaint-project/deltaint
Mininet-DINT/generate_delay_results_PINT.py
generate_delay_results_PINT.py
py
9,232
python
en
code
1
github-code
6
16233043242
from flask import Flask, url_for, request, json, session from flask_cors import CORS from flask_sqlalchemy import SQLAlchemy import random from passlib.hash import sha256_crypt app = Flask(__name__) app.secret_key = "alon" app.config.from_object(__name__) app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///site.db" a...
nivschuman/QuizServer
main.py
main.py
py
12,314
python
en
code
0
github-code
6
22449340075
""" Реализация программу взаимодействия виджетов друг с другом: Форма для приложения (ui/d_eventfilter_settings.ui) Программа должна обладать следующим функционалом: 1. Добавить для dial возможность установки значений кнопками клавиатуры(+ и -), выводить новые значения в консоль 2. Соединить между собой QDial, QS...
julsmi/DevPyQt
scripts/Практика 2/b_Самостоятельная + домашняя работа/d_eventfilter_settings.py
d_eventfilter_settings.py
py
3,953
python
ru
code
null
github-code
6
18211764194
import argparse import os import unittest from bin.get_alleles_from_srst2_mlst import get_mismatch_and_depth, get_new_and_existing_alleles, write_alleles_file, get_arguments class TestProcessResults(unittest.TestCase): TEST_OUTPUT_PREFIX = 'test' TEST_FILE = 'tests/test_data/input/test__mlst__Streptococcus_aga...
sanger-bentley-group/GBS-Typer-sanger-nf
tests/get_alleles_from_srst2_mlst_test.py
get_alleles_from_srst2_mlst_test.py
py
3,532
python
en
code
0
github-code
6
72931175228
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns #Leio os datasets e retiro o que preciso df= pd.read_csv('DATASET_MobileRobotNav.csv', sep=';') #Mostra a descrição do dataset (Média, Conta o número de tuplas, min, máx, etc) print(df.describe()) #print(df) #Sep...
jpavargasf/ML_RandomForest_ANN
Pedro/neural_network.py
neural_network.py
py
1,716
python
en
code
0
github-code
6
31824180951
import tarfile def extract(tar_path, target_path): try: tar = tarfile.open(tar_path, "r:gz") filenames = tar.getnames() for filename in filenames: tar.extract(filename, target_path) tar.close() except Exception as e: print('extract error %s' %e) extract('/...
Jerry-Luo/geek-python
stdlib/UnCompressFile.py
UnCompressFile.py
py
351
python
en
code
0
github-code
6
41550685644
import os, sys, serial, time, traceback from . codes import CMDTYPE, LEDTYPE, SPIChipsets, BufferChipsets from . devices import Devices from . import io from .. channel_order import ChannelOrder from .. driver_base import DriverBase from ... util import exception, log, util from ... drivers.return_codes import ( R...
ManiacalLabs/BiblioPixel
bibliopixel/drivers/serial/driver.py
driver.py
py
7,526
python
en
code
263
github-code
6
70292952188
# define the function def hi(lang): # function body if lang=="en": print("Hello!!!") elif lang=="ro": print("Salut!!!") elif lang=="ru": print("Привет!!!") else: print(lang,":SORRY, WE DON'T KNOW THIS LANGUAGE") def bye(lang): if lang=="en": ...
Axelum-tech/functions
function_ex1.py
function_ex1.py
py
670
python
en
code
0
github-code
6
29358752973
from math import sqrt from Qt import QtCore, QtGui, QtWidgets, Qt from ts2 import utils from ts2.routing import position from ts2.scenery import lineitem, enditem from ts2.scenery.signals import signalaspect, signalitem translate = QtWidgets.qApp.translate class TrainStatus(QtCore.QObject): """Holds the enum de...
ts2/ts2
ts2/trains/train.py
train.py
py
31,937
python
en
code
43
github-code
6
36414916188
# Solution1 class Solution: def isRobotBounded(self, instructions: str) -> bool: directions = [1, 1, -1, -1] cur_direction = 0 cur_position = [0, 0] for instruction in instructions: if instruction == "G": cur_position[(cur_direction % 2 + 1)%2] +...
eyosiasbitsu/Competitive-programming-A2SV
A2SV - Squid Game/Robot Bounded In Circle/robot-bounded-in-circle.py
robot-bounded-in-circle.py
py
1,458
python
en
code
3
github-code
6
31886163933
import random class ValueHighError(Exception): def __init__(self, msg, value): self.msg = msg self.value = value class ValueLowError(Exception): def __init__(self, msg, value): self.msg = msg self.value = value def test_input_value(value: str, desired_range: tuple): try...
NikolaVasilev/WeaponFactoryOOP
validations.py
validations.py
py
1,199
python
en
code
0
github-code
6
18100446664
""" https://leetcode.com/problems/jump-game-iv/ 1345. Jump Game IV Given an array of integers arr, you are initially positioned at the first index of the array. In one step you can jump from index i to index: i + 1 where: i + 1 < arr.length. i - 1 where: i - 1 >= 0. j where: arr[i] == arr[j] and i != j. Return the mi...
hirotake111/leetcode_diary
leetcode/1345/solution.py
solution.py
py
2,162
python
en
code
0
github-code
6
74180016507
import json poptab = [ x.split(', ') for x in open('country-list.csv').read().split('\n')] captab = [ x.split(', ') for x in open('country-capitals.csv').read().split('\n')] flgtab = [ x.split(', ') for x in open('country-flags.csv').read().split('\n')] curtab = [ x.split(', ') for x in open('country-currency.csv').re...
GnsP/countries
assemble.py
assemble.py
py
1,156
python
en
code
0
github-code
6
34570396569
from django import forms from .models import Post, Comment, Category2 from treebeard.forms import movenodeform_factory, MoveNodeForm # from markdownx.fields import MarkdownxFormField class CategoryForm(MoveNodeForm): class Meta: model = Category2 exclude = ('sib_order', 'parent') class Po...
MohammadGoodarzi/hamkav_core
HamkavBlog/forms.py
forms.py
py
1,271
python
en
code
0
github-code
6
71992716667
# -*- coding: utf-8 -*- # python3 from loguru import logger import time import socket import re import psycopg2 from psycopg2 import Error from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT import time logger.add("/var/log/cdr_collector/cdr_collector_{time:DD-MM-YYYY}.log", format="{time:DD-MM-YYYY at HH...
jgnom/avaya_cdr_collector
main.py
main.py
py
3,660
python
en
code
0
github-code
6
35384638116
from setuptools import setup with open('README.md', 'r') as f: readme = f.read() if __name__ == '__main__': setup( name='youtube-dl-service', version='0.0.2', author='Dmitriy Pleshevskiy', author_email='dmitriy@ideascup.me', description='Using youtube-dl as service in...
pleshevskiy/youtube-dl-service
setup.py
setup.py
py
655
python
en
code
0
github-code
6
32149738267
# Upload BOJ Gold-3 Topological Sorting & Graph 2252번 줄세우기 # https://velog.io/@kimdukbae/%EC%9C%84%EC%83%81-%EC%A0%95%EB%A0%AC-Topological-Sorting # 참고 링크 from collections import deque N, M = map(int,input().split()) graph = [ [] for _ in range(N+1)] indegree = [0]*(N+1) result = [] for i in range(M): ...
HS980924/Algorithm
src/14.그래프/B#2252_줄세우기.py
B#2252_줄세우기.py
py
808
python
en
code
2
github-code
6
30338343377
key = [[0,0,0],[1,0,0],[0,1,1]] lock = [[1,1,1],[1,1,0],[1,0,1]] def rotate(arr): for i in range(len(arr)): tmp = arr[i][0] arr[i][0] = arr[i][1] arr[i][1] = len(arr)-1-tmp key_one = [] lock_zero = [] for i, n in enumerate(key): for j, num in enumerate(n): if num == 1: ...
minju7346/CordingTest
programmers/60059.py
60059.py
py
1,226
python
en
code
0
github-code
6
16319784906
"""ZIP - Compactando / Descompactando arquivos""" from zipfile import ZipFile import os """ Este módulo fornece ferramentas para: criar, ler, escrever, adicionar, e listar um arquivo ZIP -https://docs.python.org/pt-br/3/library/zipfile.html """ way = (r'C:\Users\Igor\Desktop\Estudos\Programação-em-Python' r'\M...
igorfreits/Studies-Python
Udemy/4-Módulos-Python/aula 87 - ZIP.py
aula 87 - ZIP.py
py
814
python
pt
code
1
github-code
6
33526996747
''' 测试预训练VGG文件,与CNN_DPL为同一预训练模型 ''' import torch as t import torch.optim as optim from torch.utils.data import Dataset, DataLoader import data from torchvision import transforms, datasets import model import warnings warnings.filterwarnings('ignore') batch_size = 128 test_dataset = datasets.ImageFolder(...
huifeidetiaotu96/CNN_DPL
test_VGG.py
test_VGG.py
py
1,266
python
en
code
0
github-code
6
21359432660
"""Clean Code in Python - Chapter 5: Decorators Composition over inheritance, tests for examples 1 & 2 """ import unittest from composition_1 import Customer as Customer1 from composition_2 import Customer as Customer2 class BaseTestMixin: def test_resolver_finds_attributes(self): with self.subTest(tes...
rmariano/Clean-code-in-Python
book/src/ch05/tests/test_composition.py
test_composition.py
py
1,193
python
en
code
145
github-code
6
3337691584
''' reres替换本地文件有问题 起一个端口用http试一试 ''' from flask import Flask app = Flask(__name__) @app.route("/udc.js") def udc(): fill=open('/Users/xiaodu/Desktop/udc2.js','r',encoding='utf-8') js_dt=fill.read() return js_dt if __name__ == '__main__': app.run()
zml1996/learn_record
myflask/file2link.py
file2link.py
py
307
python
en
code
2
github-code
6
17510524283
''' 2. use BFS to find shortest length a. establish neighbors: go through alphabet, change 1 letter, if in wordList, add neighbor to dict for this word b. BFS -- add that nb word to queue c. stop BFS when endWord is found. d. return length 3. use DFS to find routes with shortest l...
soji-omiwade/cs
dsa/before_rubrik/word_ladder_ii.py
word_ladder_ii.py
py
2,654
python
en
code
0
github-code
6
42931952334
import re class Solution: def trailingZeros(self, num): ans, i, div = 0, 5, num/5 while div > 0: ans += div i *= 5 div = num/i return int(ans) obj = Solution() print(obj.trailingZeros(25))
shwetakumari14/Practice-Problems
Pythons Solutions/Trailing Zeros in Factorial.py
Trailing Zeros in Factorial.py
py
265
python
en
code
0
github-code
6
21864334971
"""9-3: Users 1. Make a class called User. Create two attributes called first_name and last_name, and then 2. create several other attributes that are typically stored in a user profile. 3. Make a method called describe_user() that prints a summary of the user’s information. 4. Make another method called greet_user() ...
kawing13328/Basics
My Homework/Ex_9-3.py
Ex_9-3.py
py
1,656
python
en
code
0
github-code
6
39861129033
"""Imports xml statements from privatbank, optained via p24-cli. See https://github.com/dimboknv/p24-cli The xml format is identical to that of p24 merchant api. """ import datetime from xml.etree import ElementTree as ET import beangulp import dateutil.parser from beancount.core import data, flags from beancount.c...
OSadovy/uabean
src/uabean/importers/privatbank_xml.py
privatbank_xml.py
py
3,577
python
en
code
18
github-code
6
71567935547
class Library: def __init__(self): self.user_records = [] self.books_available = {} self.rented_books = {} def get_book(self, author: str, book_name: str, days_to_return: int, user): if author in self.books_available and book_name in self.books_available[author]: use...
lorindi/SoftUni-Software-Engineering
Python-OOP/Classes and Objects - Exercise/08_library/project/library.py
library.py
py
1,255
python
en
code
3
github-code
6
7035699251
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 21 13:24:47 2018 @author: kausic """ import os import cv2 import numpy as np from tqdm import tqdm root="/home/kausic/Desktop/My_research/dataset/sunrgbd/SUNRGBD" save_location="/home/kausic/ASU_MS/SML/project/sunrgbd_images/" data_file=open(save_...
Bharathgc/Evaluating-Fusion-points-for-multi-stream-networks-handling-cross-modal-data
data_extractor_script.py
data_extractor_script.py
py
1,306
python
en
code
11
github-code
6
24176685864
import paho.mqtt.client as mqtt from Adafruit_IO import * import time broker_address = "192.168.82.100" broker_port = 1883 topic_gas = "sensor/gas" topic_flame = "sensor/flame" topic_control = "control" ADAFRUIT_IO_USERNAME = "chovy96de" ADAFRUIT_IO_KEY = "aio_DbIt49hzcNtwelmritEnVKmugtTL" aio = Client(ADAFRUIT_IO_U...
Shihab-007/Advanced-Embedded-System-Hardware-Enginnering
Advanced Embedded System/Codes/adafruit.py
adafruit.py
py
2,679
python
en
code
1
github-code
6
31454964996
from typing import Any from django.db.models import ( Model, CharField, ForeignKey, BooleanField, ManyToManyField, UniqueConstraint, DateTimeField, CASCADE, ) from abstracts.models import AbstractDateTime from subjectss.models import Topic from subjectss.models import Student class Q...
NNaraB/education_site_back
apps/tests/models.py
models.py
py
4,723
python
en
code
0
github-code
6
9699684266
import tkinter from initController import * from tkinter import Menu from tkinter.ttk import * from bridge import MouseMotionToController from controller.canvasController import CanvasController from controller.modeController import CompositionObjectController top = tkinter.Tk() buttonsContainer = tkinter.Frame(top)...
j611062000/umlEditorByPython
main.py
main.py
py
1,545
python
en
code
0
github-code
6
9000442932
# 测试 # 开发时间:2022/8/5 9:26 from thop import profile # import torchvision.models as models # import torch from ptflops import get_model_complexity_info from models.basicblock import DRB, PALayer, CALayer, CCALayer, SRB from models.SwinT import SwinT # from .FCVit import fcvit_block # from .FCA import MultiSpectralAttenti...
sad192/LISN-Infrared-Image-SR
models/network_hybrid.py
network_hybrid.py
py
9,368
python
en
code
0
github-code
6
34596295886
import argparse import itertools import re import sys from typing import Optional from graphviz import Digraph import numpy as np import wandb from app.type import APPSProblem, Node from app.const import ( CONCURRENCY_LIMIT, DEFAULT_WANDB_PROJECT_NAME, K, NO_CUDA, NUM_ROLLOUTS, TERMINAL_TOKEN,...
cavaunpeu/mcts-llm-codegen
app/util.py
util.py
py
4,017
python
en
code
1
github-code
6
26804269841
import sys from bisect import bisect_left input = sys.stdin.readline num_gates = int(input()) num_planes = int(input()) undocked = [gate + 1 for gate in range(num_gates)] def binary_search(max_dock): idx = bisect_left(undocked, max_dock) if idx == len(undocked) or undocked[idx] > max_dock and idx > 0: ...
Stevan-Zhuang/DMOJ
CCC/CCC '15 S3 - Gates.py
CCC '15 S3 - Gates.py
py
574
python
en
code
1
github-code
6
5430829069
#CODING BY ARYAN KHAN import os import random try: color_table = "#00FF00" except FileNotFoundError: color_table = "#00FF00" #--(Dark@Colours)---# r="\033[1;91m" g="\033[1;92m" y="\033[1;93m" b="\033[1;94m" p="\033[1;95m" c="\033[1;96m" l="\033[1;97m" s="\033[0m" #--(light@Colours)---# lr="\033[0;91m" lg="\033[0;92m"...
TEAM-KRS/Useragents
ua.py
ua.py
py
3,522
python
en
code
1
github-code
6
41039653002
from __future__ import annotations import json import atexit import datetime import functools import logging import multiprocessing import os import shutil import signal import socket import subprocess import tempfile import threading import time import webbrowser from collections import namedtuple from contextlib imp...
vegaprotocol/vega-market-sim
vega_sim/null_service.py
null_service.py
py
36,719
python
en
code
19
github-code
6
27472315206
from flask import Flask, request,jsonify import util from flask_cors import CORS app= Flask(__name__) CORS(app) @app.route('/get_location_names',methods=['GET']) def get_location_names(): response = jsonify({ 'location': util.get_location() }) response.headers.add('Access-Control-Allow-Or...
Shinchan3/Home_price_linear_regression
server/server.py
server.py
py
922
python
en
code
0
github-code
6
42963274647
# 시퀀스형 # 컨테이너형 container : 서로다른 자료형을 담음. list , tuple , collections.deque # 플랫 flat : 한개의 자료형 str , bytes , bytearray , array.array , memoryview # 가변() mutable : list , bytearray , array.array, memoryview , deque # 불변() immutable : tuple , str , bytes # 해시 테이블 # key 에 value 를 저장하는 구조 # 키값의 연산결과에 따라 직접접근이 가능! # key 값을...
elbum/py_inter
chap04_03.py
chap04_03.py
py
1,202
python
ko
code
0
github-code
6
27132094648
import logging from operations.operation_manager import Operation from operations import * logging.config.fileConfig('/opt/TopPatch/conf/logging.config') logger = logging.getLogger('rvapi') #process that data!! def process_queue_data(rqueue, queue_exists, agent_id, username, customer_name, u...
SteelHouseLabs/vFense
tp/src/receiver/corehandler.py
corehandler.py
py
837
python
en
code
5
github-code
6
70396698747
import lcqp_manip import casadi import numpy as np import lcqpow # create the objects box_ly = 0.15 vmax = 0.035 wmax = 0.035 box = lcqp_manip.Box(w=0.24, h=0.08, m=0.1, g=9.81, vmax=casadi.SX([vmax, vmax, wmax])) gripper = lcqp_manip.Gripper(h=0.08, rmax=0.115, rmin=0, vmax=casadi.SX([vmax, vmax, wmax, vmax])) groun...
omron-sinicx/lcqp
examples/pivot.py
pivot.py
py
6,805
python
en
code
1
github-code
6
18537251439
# prob_link: https://www.codingninjas.com/studio/problems/rod-cutting-problem_8230727?challengeSlug=striver-sde-challenge&leftPanelTab=0 from sys import stdin import sys def cutRod(prices, n): # Write your code here. mat = [[0 for i in range(n+1)]for j in range(n+1)] for i in range(1, n+1): ...
Red-Pillow/Strivers-SDE-Sheet-Challenge
P181_Rod_cutting_problem.py
P181_Rod_cutting_problem.py
py
894
python
en
code
0
github-code
6
1101626454
import random def comparar_lista(): lista1=[] # Inicializamos dos listas vacías para almacenar los números generados lista2=[] n=int(input("ingrese el tamaño de la lista1:")) # El usuario ingresa el tamaño de ambas listas y=int(input("ingrese el tamaño de la lista2:")) for i in range(n): ...
Diego1229/mejoramiento_Gonzalez
listas/lista2.py
lista2.py
py
1,721
python
es
code
0
github-code
6
19240398722
N = int(input()) S = [] for _ in range(N): tot = 0 L = list(map(int, input().split())) L.sort() if L[0] == L[2]: tot = 10000 + 1000 * L[0] elif L[0] == L[1] or L[1] == L[2]: tot = 1000 + 100 * L[1] else: tot = L[2] * 100 S.append(tot) print(max(S))
sdh98429/dj2_alg_study
백준/Bronze/2476. 주사위 게임/주사위 게임.py
주사위 게임.py
py
291
python
en
code
0
github-code
6
28204866764
from automata.Automata import Automata from tokenizer.Tokenizer import tokenizerSimple ''' Leemos los datos necesarios para empezar a procesar el automata. Tokenizamos las entradas para obtenerlas en forma de array. ''' simbolos_entrada = tokenizerSimple(input("Simbolos de entrada >> ")) estados = tokenizerSimple(inp...
ephelsa/Teoria_Lenguaje
1. Automata/proyecto/__init__.py
__init__.py
py
799
python
es
code
0
github-code
6
20512905913
def merge(arr,l,r): i = j = k = 0 while i < len(l) and j < len(r): if l[i] < r[j]: arr[k] = l[i] i += 1 else: arr[k] = r[j] j += 1 k += 1 if i == len(l) and j < len(r): while j < len(r): arr[k] = r[j] j +...
chaithanyasubramanyam/pythonfiles
mergesort.py
mergesort.py
py
721
python
en
code
0
github-code
6
349034442
import pandas as pd import numpy as np from zipfile import ZipFile import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from pathlib import Path import matplotlib.pyplot as plt from keras.layers import Concatenate, Dense, Dropout from keras.layers import Add, Activation, Lambda from ...
wmcfarlan/health_recommender
src/helper/keras_class.py
keras_class.py
py
3,069
python
en
code
0
github-code
6
17451718192
import numpy as np import pandas as pd from model_zoo.xgb import train_xgb from model_zoo.catboost import train_catboost from model_zoo.lgbm import train_lgbm from sklearn.metrics import roc_auc_score from sklearn.model_selection import KFold TRAIN_FCTS = { "lgbm": train_lgbm, "xgb": train_xgb, "catboost":...
TheoViel/kaggle_foursquare
src/training/main_boosting.py
main_boosting.py
py
3,551
python
en
code
13
github-code
6
34389873363
import sys import numpy as np def main(): import crayimage from crayimage.runutils import map_run, load_index data_root, index_file, run_name, bins, window = [ t(arg) for t, arg in zip([str, str, str, int, int], sys.argv[1:]) ] run = load_index(index_file, data_root)[run_name] sample_img = run.get_i...
yandexdataschool/crayimage
examples/hotpixel_suppression.py
hotpixel_suppression.py
py
658
python
en
code
5
github-code
6
15819759637
HEX_CHARS = "0123456789ABCDEF" ZKARRAY = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_" SUN_MAGICS = [1030, 1029, 4088] def unhash_cell(raw_cell): return [ZKARRAY.index(i) for i in raw_cell] class Cell: def __init__(self, raw_data=None, index=-1): self.index = index ...
XeLiT/retro-dbot
utils/cell.py
cell.py
py
2,203
python
en
code
11
github-code
6
37204907362
# 打开数据库连接 import pymysql as pymysql import math EARTH_REDIUS = 6378.137 pi = 3.1415926 def rad(d): return d * pi / 180.0 def getDistan(lat1, lng1, lat2, lng2): radLat1 = rad(lat1) radLat2 = rad(lat2) a = radLat1 - radLat2 b = rad(lng1) - rad(lng2) s = 2 * math.asin(math.sqrt(math.pow(math.sin(...
tangleibest/untitled
test/a.py
a.py
py
1,444
python
en
code
0
github-code
6
72066473469
from .qtImport import * class NewNoteForm(QWidget): def __init__(self, parent, category_list): super().__init__() self._parent = parent self._category = category_list self.initUI() def initUI(self): layout = QGridLayout() self.setLayout( layout ) labe...
basileMarchand/wnm
wnm/forms.py
forms.py
py
4,370
python
en
code
0
github-code
6
13900998846
from flask import Flask,render_template,request,send_file; from flask_wtf import FlaskForm; from wtforms import FileField,SubmitField; import pandas as pd import logging as logger from werkzeug.utils import secure_filename from openpyxl.styles import Border, Side, Alignment,PatternFill from openpyxl.utils import get_co...
Swapnil-mindbrick-2022/reportgen
App.py
App.py
py
18,656
python
en
code
0
github-code
6
26703437835
import argparse from math import sqrt, floor, ceil from os import listdir import io from Player import Player import pygame import time from View import View import matplotlib.pyplot as plt import pandas as pd import numpy as np import cv2 BUTTONPRESS_CSV = "buttonpress.csv" GAME_CSV = "game.csv" FACE_FILES = ["faces...
LanyK/TheAngerGames
bombangerman/client/GameReplay.py
GameReplay.py
py
14,488
python
en
code
1
github-code
6
71578351547
""" An example trainer for a simply policy gradient implementation. """ import time import json import torch from torch.optim import Adam import gym from oxentiel import Oxentiel from asta import dims, shapes from vpg import ( get_action, compute_policy_loss, compute_value_loss, finish, ActorCri...
langfield/polstead
demos/vpg/primitive/trainer.py
trainer.py
py
2,664
python
en
code
0
github-code
6
6118839537
# define a closer def charge(price) : def calc(num): return price * num return calc # new 2 closers child = charge(400) adult = charge(1000) price1 = child(3) price2 = adult(2) print(price1) print(price2)
longniu/pylesson
note/price.py
price.py
py
224
python
en
code
0
github-code
6
5484857647
import ROOT import uproot from hipe4ml.tree_handler import TreeHandler import numpy as np import argparse import yaml import sys sys.path.append('utils') import utils as utils utils.set_style() kBlueC = ROOT.TColor.GetColor('#1f78b4') kOrangeC = ROOT.TColor.GetColor('#ff7f00') ROOT.gROOT.SetBatch() ## create signa...
lbariogl/HyperRoutine
signal_extraction.py
signal_extraction.py
py
16,102
python
en
code
0
github-code
6
73829652666
import asyncio import multiprocessing as mp import os import time from bs4 import BeautifulSoup from src.download_utils import download_page class DownloadRepository: def __init__(self, address: str): self.files = [] self.address = address self.queue = mp.Queue() self.process = m...
FeltsAzn/TestTaskRadium
src/download_recursive.py
download_recursive.py
py
3,102
python
en
code
0
github-code
6
38049949342
from gtts import gTTS from pydub import AudioSegment from pydub.playback import play from screeninfo import get_monitors import numpy as np import cv2 import json import tempfile import os import time def get_screen_resolution(use_default): if use_default: return 640, 480 # Default resolution...
aman071/Smartphone-audio-cues-for-visually-impaired
audio_generation.py
audio_generation.py
py
2,862
python
en
code
0
github-code
6
24348533870
import shutil import zipfile import os import sys import warnings from urllib.request import urlretrieve from tqdm import tqdm from zrp import about # This is used to show progress when downloading. # see here: https://github.com/tqdm/tqdm#hooks-and-callbacks class TqdmUpTo(tqdm): """Provides `update_to(n)` which...
zestai/zrp
zrp/download.py
download.py
py
9,695
python
en
code
25
github-code
6
17436250579
import sys import pdb def count_primes(n): isPrime = [False] * 2 + [True] * (n - 2) i = 2 while i * i < n: if not isPrime[i]: i += 1 continue j = i * i while j < n: isPrime[j] = False j += i i += 1 print(isPrime) retur...
naubull2/codingtests
leetcode/test.py
test.py
py
361
python
en
code
0
github-code
6
70628519869
class NrPdu: def __init__(self, byteStream=None): if byteStream==None: self.PduByteArray = bytearray() else: if isinstance(byteStream, str): self.PduByteArray = bytearray.fromhex(byteStream) else: if hasattr(byteStream, 'decode'): ...
leoneilcdasco/5GNR-UserPlane-Utilities
nruplane/nrcommon/nrpdu.py
nrpdu.py
py
804
python
no
code
7
github-code
6
32740927638
#!/bin/python3 import re import getopt, sys from kazoo.client import KazooClient import json def getRollupRules(zookeeperHostsIn, zNodePath): zk = KazooClient(hosts=zookeeperHostsIn); zk.start(); result = {}; if zk.exists(zNodePath): for zookeeperChild in zk.get_children(zNodePath): ...
ModdingFox/AutomaticDruidRollup
Zookeeper/Fetch_Druid_Rules.py
Fetch_Druid_Rules.py
py
682
python
en
code
0
github-code
6
37828901284
#!/usr/bin/env python3 import random import sys STRENGTH = { "All Star": 2, "Angry Bird": 1, "GOAT": 1, "MKatz": 3, "Pegasus": 1, "Piston": 4, } CARDIO = { 22: 2, "Abacus": 3, "Empire": 2, "Mont Blanc": 1, "MVP": 4, "Quarterbacks": 1, } def pick_random_vid(videos: dic...
dbatten5/dotfiles
scripts/f45.py
f45.py
py
839
python
en
code
3
github-code
6
29785322466
import turtle as t import random t.colormode(255) def random_color_finder(): r = random.randint(0, 255) g = random.randint(0, 255) b = random.randint(0, 255) random_color = (r, g, b) return random_color directions = [0, 90, 180, 270] t.pensize(15) t.speed('fastest') for _ in range(200): t....
NiramayThaker/Python-Topics
turtle_graphics/turtle_random_walk_rgb.py
turtle_random_walk_rgb.py
py
486
python
en
code
1
github-code
6