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
72289356138
#! /usr/bin/python import os import argparse parser=argparse.ArgumentParser() parser.add_argument('-f', nargs='+',required=True,\ help='[required] input files') parser.add_argument('-d', required=True,\ help='[required] Specify the date the data was taken on in the form \ mm-dd-yyyy. This is used to generat...
jlazar17/EKA_quantum_conductance
code/analysis/igor_binary_convert.py
igor_binary_convert.py
py
995
python
en
code
0
github-code
90
23932846439
from django.shortcuts import render , redirect from django.contrib.auth.decorators import login_required from .models import Cart_Added , Order_done ,User_orders from django.contrib import messages from accounts.models import Billing ,Curency from random import randint @login_required(login_url='login') def car...
rezapaul/django-onnline-shop
order/views.py
views.py
py
6,041
python
en
code
0
github-code
90
24539236913
#number is even #function with argument and return type def even(num): num=int(input("Enter the number")) if(num%2==0):#9%2==0 result="Even" else: result="Not Even" return result data=even(2) print(data)
toncysara17/luminarpythonprograms
Core_Python/Functions/evenoroddthirdmethod.py
evenoroddthirdmethod.py
py
236
python
en
code
0
github-code
90
34871752800
""" test partial slicing on Series/Frame """ from datetime import datetime import numpy as np import pytest from pandas import ( DataFrame, DatetimeIndex, Index, MultiIndex, Series, Timedelta, Timestamp, date_range, ) import pandas._testing as tm class TestSlicing: def test_stri...
pandas-dev/pandas
pandas/tests/indexes/datetimes/test_partial_slicing.py
test_partial_slicing.py
py
16,495
python
en
code
40,398
github-code
90
39755864827
import os from pathlib import Path from configurations import Configuration from django.core.exceptions import ImproperlyConfigured BASE_DIR = Path(__file__).parent.parent class _NOT_PROVIDED: pass def get_env_setting(env_var: str | list[str], default=_NOT_PROVIDED) -> str: """ Get an environment sett...
levic/django-multitenancy-presentation
examples/django_site/settings.py
settings.py
py
5,571
python
en
code
2
github-code
90
3451700232
import numpy as np #Libreria para conversion de imagenes from tensorflow.keras.preprocessing.image import load_img, img_to_array #Libreria para cargar el modelo from tensorflow.keras.models import load_model #import os.path from django.conf import settings import os #funcion de predicion de enfermedad recibe(Imagen JP...
BrandonGrande/smart-web-system
apps/appDiagnostico/prediccion.py
prediccion.py
py
1,454
python
es
code
0
github-code
90
18102040099
from collections import deque n = int(input()) AL = [None for _ in range(n + 1)] for i in range(1, n + 1): ukv = [int(x) for x in input().split()] AL[ukv[0]] = ukv[2:] que = deque([1]) visited = [False] + [True] + [False] * (n - 1) dist = [-1] + [0] + [-1] * (n - 1) while que: u = que.popleft() for v ...
Aasthaengg/IBMdataset
Python_codes/p02239/s834703962.py
s834703962.py
py
489
python
en
code
0
github-code
90
18377479959
import sys input = sys.stdin.readline N, M = map(int, input().split()) L = [[] for i in range(N + 1)] for i in range(M): a, b = map(int, input().split()) L[a].append(b) # print(L) S, T = map(int, input().split()) dist = [[10**9 for i in range(N + 1)] for j in range(3)] dist[0][S] = 0 # print(dist) Q = [] for...
Aasthaengg/IBMdataset
Python_codes/p02991/s214211596.py
s214211596.py
py
770
python
en
code
0
github-code
90
44019907645
# -*- coding: utf-8 -*- """ Created on Tue Mar 23 18:23:42 2021 @author: Andres L """ import numpy as np import matplotlib.pyplot as plt from matplotlib import colors import pylab VOI = [] PriorBelief = np.arange(0.01,1,0.01) Pro_detection = np.arange(0.01,1,0.01) FirstD = [] DetectUP = [] NoDetectUP ...
edalopezga/VOI_OPTIMISATION
VOI_Analysis.py
VOI_Analysis.py
py
4,748
python
en
code
0
github-code
90
74099231018
""" Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping. Intervals can "touch", such as [0, 1] and [1, 2], but they won't be considered overlapping. For example, given the intervals (7, 9), (2, 4), (5, 8), return 1 as the last int...
danny-hunt/Problems
overlapping_intervals/overlapping_intervals.py
overlapping_intervals.py
py
2,278
python
en
code
2
github-code
90
4355938348
import torch from xtagger.utils import metrics from xtagger.utils.callbacks import Checkpointing import torch.nn as nn from tqdm.auto import tqdm from typing import List, Optional, Union try: import torchtext.legacy.data as ttext except ImportError: import torchtext.data as ttext class PyTorchTagTrainer(): ...
safakkbilici/x-tagger
xtagger/utils/trainer.py
trainer.py
py
9,144
python
en
code
9
github-code
90
43222935812
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from images import load as load_img, save as save_img def ex1(input_file: str, output_file: str) -> int: img = load_img(input_file) colours = [img[0][0]] res = count_plots(img, colours, len(img[0]), len(img)) save_img([colours], output_file) return res def cou...
devExcale/acsai-homework-y1
HW8rec/program01.py
program01.py
py
1,812
python
en
code
1
github-code
90
18305159309
def main(): s = input() s_l = len(s) cnt = 0 for i in range(s_l//2): if s[i] != s[::-1][i]: # if s[i] != s[s_l-i-1]: cnt += 1 print(cnt) if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p02836/s606524060.py
s606524060.py
py
223
python
en
code
0
github-code
90
37890387491
import socket from threading import Thread class SocketCommunication: def __init__(self, ip=None, port=None): self.mSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if ip is None: self.ip = "localhost" if port is None: self.port = 5005 return ...
SnovvyOwl/COA_PY_AutonomusCAR
Server/server_python/2Server.py
2Server.py
py
2,750
python
en
code
3
github-code
90
40488421765
N_BINS = 100 EMBD_DIM=12 # How to choose? Even 2^32 is too large for representing TRANSITION_DIM*SEQUENCE_LENGTH*N_BINS TRANSITION_DIM=8 # traffic prediction # OBSERVATION_DIM= 6 OBSERVATION_DIM= 6 # traffic prediction # OCC_RELATED_OBSERVATION_DIM = 2 OCC_EMBEDDING_DIM = 32 ACTION_DIM=2 SEQUENCE_LENGTH=40
zhangbw97/commonroad-trajectory-transformer
models/config.py
config.py
py
309
python
en
code
2
github-code
90
2972339388
#!/usr/bin/env python # -*- coding:utf-8 -*- # Time: 2019/3/6 10:33 __author__ = 'Peter.Fang' import os import sys import xlrd pwd = os.path.dirname(os.path.realpath(__file__)) sys.path.append(pwd + "../") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "df2.settings") import django django.setup() from app.acc.mo...
fy1716/df2
db_tools/acc_asyn.py
acc_asyn.py
py
1,770
python
en
code
0
github-code
90
10637639796
def binary(a): res = [0] * 4 i = 3 while a != 0: res[i] = a % 2 a = int(a / 2) i -= 1 return res def hexi(num): temp1 = int(num / 10) temp2 = num % 10 temp1 = binary(temp1) temp2 = binary(temp2) temp = temp1 + temp2 return temp pri...
MekdadGhazal/Security-Algorithms
hex.py
hex.py
py
332
python
en
code
0
github-code
90
23985686109
class Solution: def longestPalindromeSubseq(self, s: str) -> int: N = len(s) dp = [[0]*N for _ in range(N)] for i in range(N): dp[i][i] = 1 for i in range(1, N): for l in range(N - i): r = l + i if s[r] == s[l]: ...
birsnot/A2SV_Programming
longest-palindromic-subsequence.py
longest-palindromic-subsequence.py
py
468
python
en
code
0
github-code
90
23421337555
from os import path, environ, getenv from fabric.api import env from fabric.colors import green PROJECT_NAME = 'rookie_booking' LINODEAPP1 = 'ross@lnapp1:832' LINODEDB = 'ross@lndb:832' VAGRANTAPP1 = 'ross@vmapp1:22' LOCALHOST_DESKTOP = 'UbuntuBox' LOCALHOST_LAPTOP = 'ross@UbuntuPad' env.hos...
RossLYoung/rookie_booking
rookie_booking/config/fab_settings.py
fab_settings.py
py
2,158
python
en
code
3
github-code
90
40990265401
import unittest import sys import os sys.argv[0] = "plugin://plugin.video.livestreams" from tinyxbmc import stubmod from tinyxbmc import net from tinyxbmc import tools import addon stubmod.rootpath = os.path.realpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..")) base = addon.Base() def test...
boogieeeee/repository.boogie
plugin.video.livestreams/test/__init__.py
__init__.py
py
2,170
python
en
code
1
github-code
90
34516142877
from datetime import date, time from .base import * DEBUG = False TEMPLATE_DEBUG = DEBUG TEST_APPS = ("django_pdb",) TEST_MODE = True OBIEE_ZIP_PASSWORD = "test" REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"]["login"] = "10000000000/sec" TEST_RUNNER = "core.testing.CLADiscoverRunner" DATABASES["default"]["ENGINE"] = "...
ministryofjustice/cla_backend
cla_backend/settings/testing.py
testing.py
py
775
python
en
code
5
github-code
90
71369911656
from geonature.utils.env import DB from werkzeug.exceptions import NotFound class ZhRepository: """ Repository: classe permettant l'acces au données d'un modèle de type 'zh' """ def __init__(self, model): self.model = model def delete(self, id_zh, user, user_cruved): """Delet...
PnX-SI/gn_module_ZH
backend/gn_module_zh/model/repositories.py
repositories.py
py
727
python
en
code
3
github-code
90
17872642201
import requests import datetime import csv import json import base64 proxies = { "http": "http://pfrie-std.proxy.e2.rie.gouv.fr:8080", "https": "http://pfrie-std.proxy.e2.rie.gouv.fr:8080" } cle = '3FH1jzDdxIg_S0_7NcdIZAZBaoIa' secret = 'll0htvhgkItaFQjy6vVhrfRcBqIa' auth = (base64.b64encode(...
MANCodeClub/pythonfromscratch
musculation/010_sirets/siret_V0.0.py
siret_V0.0.py
py
5,685
python
fr
code
1
github-code
90
4702819146
import json def getdeletablefiles(oldpipelines, newpipelines): deletables = [] new_files = json.loads(newpipelines.read()) old_files = json.loads(oldpipelines.read()) for pipeline in new_files: new_yaml = pipeline['yamlFileName'] new_repo = pipeline['manageURL'] new_branch = p...
SachithKasthuriarachchi/scripts
delete-v2.py
delete-v2.py
py
1,188
python
en
code
0
github-code
90
37150992650
# 21.05.03 n = int(input()) person = [] for _ in range(n): weight, height = map(int,input().split()) person.append((weight,height)) bigger = [] for i in range(n): count = 0 for j in range(n): if i==j: continue if person[i][0] < person[j][0] and person[i][1] < person[j][1]...
camel-man-ims/coding-test-python
problems/backjoon_강좌참조/완전탐색/덩치.py
덩치.py
py
855
python
en
code
0
github-code
90
72141434538
import requests import sys import json import re endpoint = '/api.php?action=query&list=groupmembers&gmgroups=bot|bot-global&gmlimit=500&format=json' def get_bots_ids(base_url, offset=0): """ Query the enpoint and returns a list of bot userids """ url = base_url + endpoint + '&gmoffset={}'.format(offset)...
Grasia/wiki-scripts
get_bot_users/query_bot_users.py
query_bot_users.py
py
1,497
python
en
code
20
github-code
90
17498196972
import socket import json def Main(): host = "localhost" port = 8080 mySocket = socket.socket() mySocket.bind((host, port)) mySocket.listen(1) conn, addr = mySocket.accept() print("Connection from: " + str(addr)) data = conn.recv(1024).decode() if not data: return use...
WeStCoastSlavs/quebec
working_dir/client-server-daniel/server.py
server.py
py
531
python
en
code
0
github-code
90
17240909225
import time from celery.utils.log import get_task_logger from django.core.mail import send_mail from django.template.loader import render_to_string from images.models import Image from dominion import base from dominion.app import APP from dominion.engine import EXIT_STATUS, PiemanDocker from dominion.exceptions imp...
tolstoyevsky/dominion
dominion/tasks.py
tasks.py
py
3,520
python
en
code
0
github-code
90
34072462497
"""A module for fetching eparavolo API information.""" import datetime import functools import logging import requests import yaml import zeep from zeep.wsse.username import UsernameToken from zeep.exceptions import Error as ZeepError from .error import eParavoloErrorCode as ErrorCode from diavlos.data import IN_FIL...
ckarageorgkaneen/diavlos
diavlos/src/eparavolo/eparavolo.py
eparavolo.py
py
3,085
python
en
code
3
github-code
90
18358262599
def main(): import sys input = sys.stdin.readline N, M, P = map(int, input().split()) INF = 10 ** 9 #入力 # 入力は1-index # 内部で0-indexにして処理 G = [] for _ in range(M): #M個の辺の情報を受け取る A, B, C = map(int, input().split()) #lからrへ重みsの辺が存在 G += [[A - 1, B - 1, P - C]] #有向グラフのときは...
Aasthaengg/IBMdataset
Python_codes/p02949/s324667652.py
s324667652.py
py
1,458
python
en
code
0
github-code
90
18249444029
N = int(input()) A = list(map(int, input().split())) Cnt = [0] * (N+1) for a in A: Cnt[a] += 1 ans0 = 0 for c in Cnt: ans0 += c * (c-1) // 2 Ans = [ans0 - Cnt[a] + 1 for a in A] print("\n".join(map(str, Ans)))
Aasthaengg/IBMdataset
Python_codes/p02732/s550629335.py
s550629335.py
py
218
python
en
code
0
github-code
90
72736937577
""" KV Le CSE 163 AG Final Project A script that retrieves and cleans the data needed for my Final Project about MyAnimeList Users """ import pandas as pd from jikanpy import Jikan from time import sleep def clean_user_animelists(): """Cleans original user animelists for information relavent to the project ...
kvietcong/cse163-final
data_retrieve_cleaning.py
data_retrieve_cleaning.py
py
5,662
python
en
code
0
github-code
90
24451378828
import codecs import json import os import random import asyncio import re from cloudbot import hook from cloudbot.util import textgen nick_re = re.compile("^[A-Za-z0-9_|.\-\]\[\{\}]*$", re.I) cakes = ['Chocolate', 'Ice Cream', 'Angel', 'Boston Cream', 'Birthday', 'Bundt', 'Carrot', 'Coffee', 'Devils', 'Fruit', ...
CrushAndRun/Cloudbot-Fluke
plugins/foods.py
foods.py
py
22,246
python
en
code
0
github-code
90
19387036958
import pygame from block import Block from text import Text from ball import Ball def intersect(rect1, rect2): if (rect1.x < rect2.x + rect2.width) and (rect1.x + rect1.width > rect2.x) and ( rect1.y < rect2.y + rect2.height) and (rect1.height + rect1.y > rect2.y): return True return False...
matija-stankovic/Block_Destroyer
main.py
main.py
py
4,989
python
en
code
0
github-code
90
19018568825
from collections import deque from math import inf class Solution: def maximumDistance(self, n, m, src, edges): in_deg_arr, adj_lst = [0 for i in range(n)], [[] for i in range(n)] q, res = deque(), [-inf for i in range(n)] ; res[src] = 0 for start, end, weight in edges: in_deg_a...
Tejas07PSK/lb_dsa_cracker
Graph/Longest path in a Directed Acyclic Graph/solution.py
solution.py
py
822
python
en
code
2
github-code
90
43323232536
import sqlite3 # connect to the database conn = sqlite3.connect('players.db') # create a cursor object to execute SQL queries c = conn.cursor() # fetch and print all rows c.execute("SELECT * FROM players_table") print(c.fetchall()) # close the cursor and connection c.close() conn.close()
Ekstrom98/Fantasy-Premier-League
database_test_fetch.py
database_test_fetch.py
py
292
python
en
code
0
github-code
90
23201962598
# -*- coding:utf-8 -*- from __future__ import print_function import os parameter = dict() parameter['img_row'] = 224 parameter['img_col'] = 224 parameter['class_num'] = 102 parameter['batch_size'] = 102 parameter['iteration'] = 50000 parameter['learning_rate'] = 0.01 parameter['data_set'] = './data_set/...
lc1003/Cross_net
config.py
config.py
py
1,949
python
en
code
0
github-code
90
30214254599
#!/usr/bin/env python import numpy as np import cv2 showBackProj = False showHistMask = False frame = None hist = None def show_hist(hist): """Takes in the histogram, and displays it in the hist window.""" bin_count = hist.shape[0] bin_w = 24 img = np.zeros((256, bin_count * bin_w, 3), np.uint8) ...
Soist/waste_sorter
Activity4/Milestone2.py
Milestone2.py
py
4,398
python
en
code
0
github-code
90
16515849240
#1. Write a program called round.py. The program should take in a float and #output an int (rounded up or down) # Author: Audrey Fitzgerald # rounds, rounds to nearest even number so is not an accurate indicator # I want to round flat 5.99 to 6 # error I made was entered the float number into the programme numberToR...
G00425693/Mywork
week3/3.2 Fun with numbers/round.py
round.py
py
466
python
en
code
0
github-code
90
22347755715
import numpy as np import matplotlib.pyplot as plt from scipy import constants from scipy.signal import stft from scipy import sparse from scipy.sparse.linalg import spsolve """ We use a kaiser window to balance the main-lobe width and side lobe level. see here, ~https://numpy.org/doc/stable/reference/genera...
jjyaking/FT-and-STFT
ft_stft_functions.py
ft_stft_functions.py
py
3,932
python
en
code
0
github-code
90
27191095338
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Room', fields=[ ('id', models.AutoField(verbose...
njncalub/pct-infosys
room_manager/migrations/0001_initial.py
0001_initial.py
py
1,003
python
en
code
0
github-code
90
10400379028
# -*- coding: utf-8 -*- """ Created on Mon Jul 15 11:24:42 2019 @author: admin """ ''' 根据一棵树的中序遍历与后序遍历构造二叉树。 注意: 你可以假设树中没有重复的元素。 例如,给出 中序遍历 inorder = [9,3,15,20,7] 后序遍历 postorder = [9,15,7,20,3] 返回如下的二叉树: 3 / \ 9 20 / \ 15 7 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/construct-binary...
k8godzilla/-Leetcode
1-100/L106.py
L106.py
py
2,786
python
zh
code
0
github-code
90
39683250893
from math import sqrt from numba import njit import numpy as np def main(): def soe(n: int) -> list[bool]: """creates a Sieve of Eratosthenes array of size n""" iterlimit = int(sqrt(n)) + 1 is_prime_list = [True]*(n + 1) # for 0 and 1 is_prime_list[0] = is_prime_list[1] =...
mattblferrer/euler
601-650/650.py
650.py
py
3,471
python
en
code
0
github-code
90
70103693738
import sys import serial import serial.tools.list_ports def help(): print("Usage: startstop.py led <led> [ON|OFF]") print(" startstop.py help") def help_and_quit(): help() sys.exit(0) def set_led(port, led, state): ser = serial.Serial(port, 115200, timeout=1) ser.write(f'{led}{state}\r...
Timu5/startstop
startstop.py
startstop.py
py
1,287
python
en
code
0
github-code
90
15527995086
from uret.transformers import SubTransformer import random import os import tempfile import subprocess import numpy as np from copy import deepcopy class UPXPack(SubTransformer): name = "UPXPack" def __init__(self, compression_levels=list(range(1, 10)), seed=None, subtransformer_index=None): """ ...
IBM/URET
uret/transformers/binary/subtransformers/upx_pack.py
upx_pack.py
py
4,701
python
en
code
22
github-code
90
42318687088
""" arcface extract feature + linearSVC classifier """ from sklearn.svm import SVC, LinearSVC from sklearn.model_selection import GridSearchCV from tqdm import tqdm import numpy as np import argparse import json import pickle import time import random import os base_path = os.path.dirname(os.path.dirname(os.path....
nhlinh99/Face-Recognition-Project
src/FaceRecognition/train_SVM.py
train_SVM.py
py
6,020
python
en
code
0
github-code
90
32425343059
import torch from torch.utils.data import Dataset from tqdm import tqdm import os import random import pickle class SelectionDataset(Dataset): def __init__(self, file_path, args, tokenizer, sample_cnt=None): self.max_contexts_length = args.max_contexts_length self.data_source = [] self.tok...
chijames/zero_shot_dialogue_disentanglement
link_based_dialogue_disentanglement/dataset.py
dataset.py
py
2,682
python
en
code
7
github-code
90
15805839882
#latihan data perpustakaan kumpulan_data_buku = [] while True: judul_buku = input("Judul Buku\t: ") penulis_buku = input("Penulis\t\t: ") data_buku = [judul_buku, penulis_buku] kumpulan_data_buku.append(data_buku) print("|\tNo\t|\t\tJudul\t\t|\tPenulis\t\t|") for index,buku in enumerate(kumpul...
dikrifzn/belajar_python
28_list_latihan.py
28_list_latihan.py
py
507
python
id
code
0
github-code
90
17368127313
# 数学的な解法 K = int(input()) A, B = map(int, input().split()) # 数学的な解法 ok = False x = A // K u = B // K if x < u: ok = True if A % K == 0: ok = True if ok: print("OK") else: print("NG")
bibitto/algorithm
chokudai_text/chapter5/5.2/golf2.py
golf2.py
py
228
python
ja
code
0
github-code
90
43052069857
from asyncore import poll from nturl2path import url2pathname from client_pollution import * from client_cities import * from repository import * from service import Service import requests from config import load_config def set_city_parameters(): # Set parameters to specify city details params = GetCitiesPa...
jamin10/air-pollution-service
main.py
main.py
py
2,197
python
en
code
0
github-code
90
8770454306
def DNA_strand(dna): # code here def options(i): switcher={ 'A':'T', 'T':'A', 'G':'C', 'C':'G' } return switcher.get(i) poli = [] for l in dna: poli.append(options(l)) new_dna = str(poli).replace(',', ''...
OseiasBeu/codewars
DNA/DNA_strand.py
DNA_strand.py
py
623
python
en
code
1
github-code
90
25255973891
from config.config import VK_USER_TOKEN, VK_VERSION import requests def get_city(_city): params = {"v": VK_VERSION, "access_token": VK_USER_TOKEN, 'country_id': 1, 'count': 1, 'q': _city} url = f"https://api.vk.com/method/database.getCities" response = requests.get(url, params=params).json() if not r...
MortInsane/VKinder_mort
utils/vkinder_commands.py
vkinder_commands.py
py
1,915
python
en
code
null
github-code
90
16253474637
#!/usr/bin/env python # pylint: disable=wrong-import-position import os import time import traceback from argparse import ArgumentParser import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import tensorflow as tf from evaluation import Evaluation from one_way_evaluations impor...
furgerf/GAN-for-dermatologic-imaging
src/compare_two_to_one_models.py
compare_two_to_one_models.py
py
4,888
python
en
code
0
github-code
90
8247217025
from crypt import methods from flask import Blueprint, jsonify, request from app.models import comment, db, Tweet, Comment from flask_login import current_user, login_required from app.forms import TweetForm, DeleteForm from app.forms import CommentForm tweet_routes = Blueprint("tweet",__name__) def validation_error...
nullgar/tweettah
app/api/tweet_routes.py
tweet_routes.py
py
5,431
python
en
code
0
github-code
90
18336713009
from math import gcd def main(): def factorization(n): arr = [] temp = n for i in range(2, int(-(-n ** 0.5 // 1)) + 1): if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr.a...
Aasthaengg/IBMdataset
Python_codes/p02900/s586447775.py
s586447775.py
py
659
python
en
code
0
github-code
90
9015453971
import pygame #button class class Button(): def __init__(self, x: int, y: int, image: str, scale: int) -> None: width = image.get_width() height = image.get_height() self.image = pygame.transform.scale(image, (int(width * scale), int(height * scale))) self.rect = self.image.get_rect() self.rect.to...
Michaelllllll25/Best-Game
button.py
button.py
py
969
python
en
code
0
github-code
90
13584219992
from multiprocessing.sharedctypes import RawValue import time import random def bSort(array): # определяем длину массива length = len(array) #Внешний цикл, количество проходов N-1 for i in range(length): # Внутренний цикл, N-i-1 проходов for j in range(0, length-i-1): #Меняе...
justsupb/python_lessons
LESS_7/main.py
main.py
py
2,771
python
en
code
0
github-code
90
21523666145
import cv2 import numpy as np spoons_noise = cv2.imread('resources\\spoons_2.png', 0) # spoons_noise spoons_gaps = cv2.imread('resources\\spoons_1.png', 0) # spoons_gaps kernel = np.ones((5, 5), np.uint8) dilation = cv2.dilate(spoons_gaps, kernel, iterations=2) erode = cv2.erode(spoons_noise, kernel, iterations=2) op...
MisterZurg/Bonch_Elective_ComputerVision
CV_Lecture_3/morphology.py
morphology.py
py
687
python
en
code
1
github-code
90
21687261182
#!/usr/bin/env python # coding: utf-8 # In[6]: import pyspark # In[8]: findspark.init('/usr/local/spark') # In[9]: from pyspark import SparkContext # In[10]: conf=pyspark.SparkConf().setMaster("local").setAppName("first") # In[11]: sc=SparkContext(conf=conf) # In[5]: sc.stop() # In[12]: rdd=s...
nirati16/BootCamp
Spark Context.py
Spark Context.py
py
934
python
en
code
0
github-code
90
18354719869
s = input() t = input() n = len(s) m = len(t) s += s next = [[-1] * 26 for _ in range(len(s) + 1)] # 場所iから、次の文字jへの場所、みたいなテーブル # 後ろから更新してくと最短距離になる # next[i]は場所iを含む for i in range(len(s) - 1, -1, -1): c = ord(s[i]) - ord('a') for j in range(26): if j == c: next[i][j] = i else: ...
Aasthaengg/IBMdataset
Python_codes/p02937/s956839630.py
s956839630.py
py
674
python
ja
code
0
github-code
90
18535595469
import sys import bisect # from collections import Counter, deque, defaultdict # import copy # from heapq import heappush, heappop, heapify # from fractions import gcd # import itertools from operator import attrgetter, itemgetter # import math # import numpy as np readline = sys.stdin.readline MOD = 10 ** 9 + 7 IN...
Aasthaengg/IBMdataset
Python_codes/p03353/s087852568.py
s087852568.py
py
675
python
en
code
0
github-code
90
13842465372
import threading import time def enumerateThreads(): print("Enumeration of threads:") for i in threading.enumerate(): print(" ·", i.getName()) def numberOfThreads(): print("Number of threads: " + str(threading.active_count())) def currentThreadName(): print("Current thread name: " + threadi...
Xayiide/Threading
PCA/Python/Threads/threads.py
threads.py
py
949
python
en
code
0
github-code
90
73600828137
#! /usr/bin/env python3 from setuptools import setup url = "https://github.com/chuanconggao/TagStats" version = "0.1.2" setup( name="TagStats", packages=["tagstats"], url=url, version=version, download_url=f"{url}/tarball/{version}", license="MIT", author="Chuancong Gao", author_...
chuanconggao/TagStats
setup.py
setup.py
py
803
python
en
code
1
github-code
90
15537932021
def crc_calculation(input_bits, crc_polynomial): # Crear una copia de los bits de entrada remaining_bits = input_bits.copy() # Inicializar la lista de cálculo calculation_result = [] # Calcular los primeros bits utilizando el polinomio CRC for _ in range(len(crc_polynomial)): calculati...
fredyvelasquezgt/Lab-2-Redes
Angel/crc_emisor.py
crc_emisor.py
py
2,533
python
es
code
0
github-code
90
25023165228
#!/usr/bin/env python3 import sys from sodacomm.tools import testwrapper def all_sum(arr): do_all_sum(0, arr, 0) def do_all_sum(s, arr, i): if i == len(arr): print(s) return do_all_sum(s, arr, i+1) do_all_sum(s+arr[i], arr, i+1) def min_unformed_sum(arr): n = len(arr) _sum = ...
missingjs/soda
works/zcy2/c9/q14.py
q14.py
py
1,148
python
en
code
0
github-code
90
37355954358
import pandas as pd from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import train_test_split from sklearn.model_selection import ____ # Loading in the data pokemon = pd.read_csv('data/pokemon.csv') X = pokemon.loc[:, 'speed':'capture_rt'] y = pokemon['legendary'] X_train, X_test, y_train,...
UBC-MDS/introduction-machine-learning
exercises/en/exc_03_12.py
exc_03_12.py
py
588
python
en
code
3
github-code
90
39547446241
from flask import * import requests, os import mysql.connector.pooling, datetime import time, controller.db_conncetion from controller.token import make_token, decode_token from controller.utils import regexName, regexEmail, regexPhone from dotenv import load_dotenv load_dotenv() # Blueprint api_order = Blueprint("ap...
Tankliu6/taipei-day-trip
controller/api_order.py
api_order.py
py
8,722
python
en
code
0
github-code
90
24245319372
#!/usr/bin/python # coding: utf-8 # # @file: show.py # @date: 2015-01-30 # @brief: # @detail: # ################################################################# import cv2, time, math import numpy as np from calc import FrameSum FNAME = 'video/s.mp4' cap = cv2.VideoCapture(FNAME) cv2.namedWindow('origin') cv2.named...
sunkwei/image_anaysis
st2/show.py
show.py
py
2,166
python
en
code
0
github-code
90
5946336210
from pyspark import SparkContext from pyspark.sql import SQLContext from pyspark.sql import HiveContext import mysql.connector import math from pyspark.sql import Row, StructField, StructType, StringType, IntegerType sc = SparkContext("local", "videoDifficulty") sqlContext = HiveContext(sc) timeFrameSize=4 #timeFrame...
anurag-198/big_data_analysis
analyticalModels/src/videoDifficultySpark.py
videoDifficultySpark.py
py
21,454
python
en
code
3
github-code
90
22377544925
# [70. leetcode 211] class TrieNode: def __init__(self): self.children = {} self.isEnd = False class WordDictionary: def __init__(self): self.root = TrieNode() def addWord(self, word): cur = self.root for c in word: if c not in cur.children: cur.children[c] = TrieNode() ...
hannayangg/penwing
Quest/70.py
70.py
py
871
python
en
code
0
github-code
90
12315414163
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^$', 'server.views.home'), url(r'^server/create/$', 'server.views.create'), url(r'^server/view/(?P<server_id>\w+)/$', 'server.views.view'), url(r'^image/...
adambratt/MineHound
minehound/urls.py
urls.py
py
724
python
en
code
1
github-code
90
69984266858
from . import WatcherBaseDriver import socket import json from typing import Callable, Optional, Dict, Any class GatewayWatcher(WatcherBaseDriver): def __init__(self): self.muliticast = "224.0.0.50" self.senderip = "0.0.0.0" self.port = 9898 self._loop = True self.sock = so...
angrysoft/pyiot
pyiot/watchers/aqara.py
aqara.py
py
1,225
python
en
code
0
github-code
90
18589285179
N = input() A = list(map(int,input().split())) c = 0 d = -1 while c>d: d+=1 for i in A: if i%2 == 0: continue else : print(c) break else : A=list(map(lambda x :x/2,A)) c += 1
Aasthaengg/IBMdataset
Python_codes/p03494/s640659317.py
s640659317.py
py
216
python
en
code
0
github-code
90
19716290268
import numpy as np import matplotlib.pyplot as plt # Problem 5: def x_n(n): if 0<= n<= 2: return n+1 else: return 0 n_values = np.arange(-5, 15) # A range of n values x_values = [x_n(n) for n in n_values] plt.figure() def unit_impulse(n): if n==0: return 1 else: r...
PeterhdPham/TTT4120_Digital_Signal_Processing
Problem_sets/Problem_Set_1/figures/Problem5.py
Problem5.py
py
2,301
python
en
code
0
github-code
90
15976603765
N = int(input()) ## N = 5*a + 3*b # a: 5kg의 개수 , b: 3kg의 개수 # min (a+b) , if a and b is not integer : then print(-1) # integer programming a = N // 5 while a >= 0: b = N - a * 5 if b%3==0: b//=3 print(a+b) break if a==0: if N%3 ==0: print(N%3) else: ...
OnMyWave/Algorithm
Baekjoon/2839 : 설탕 배달.py
2839 : 설탕 배달.py
py
359
python
ko
code
0
github-code
90
4485518262
from math import * import math import cv2 import numpy as np import matplotlib.pyplot as plt from PIL import Image def Image_extrapolation(): img_path = input("Enter image path: ") img = cv2.imread(img_path, 0) interpolation_factor = float(input("Enter the interpolation factor: ")) row...
aryan10behal/Digital-Image-Processing
Task 1/Transformation_on_image.py
Transformation_on_image.py
py
12,606
python
en
code
0
github-code
90
16465344484
#!/usr/bin/env python3 from __future__ import division import copy import os import random import time from asciimatics.effects import Cycle, Stars, Print from asciimatics.renderers import FigletText from asciimatics.scene import Scene from asciimatics.screen import Screen # print welcome screen def clear_screen(): ...
chrisx8/battleship
battleship.py
battleship.py
py
8,075
python
en
code
0
github-code
90
41012051718
import logging import datetime from datetime import timedelta import requests import json from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) SCAN_INTERVAL = timedelta(minutes=10) # Replace with your API URL API_URL = ( "https://api.strom...
mfmayer/StromGedacht
sensor.py
sensor.py
py
3,381
python
en
code
2
github-code
90
27580618098
import numpy as np import pandas as pd def gen_feats(constits_info, j_info, n_constits=50, label=0): """Takes two pandas DataFrames (created by events_to_pd) and returns two pandas DataFrames with features.""" # Initialize j_info = j_info.copy() constits_info = constits_info.copy() # Add transver...
noamwunch/displaced_tracks
trash/gen_feats0.py
gen_feats0.py
py
2,747
python
en
code
0
github-code
90
18328271789
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) # 二分探索 N, K = lr() A = np.array(lr()) F = np.array(lr()) A.sort() F = np.sort(F)[::-1] def check(x): count = np.maximum(0, (A - (x // F))).sum() return count <= K left = ...
Aasthaengg/IBMdataset
Python_codes/p02883/s231295919.py
s231295919.py
py
506
python
en
code
0
github-code
90
18315149969
from itertools import accumulate n,k = map(int, input().split()) a = list(map(int, input().split())) a = [0] + a a2 = list(accumulate(a)) sa = dict() ans = 0 l = 0 for i in range(n+1): saadd = (i-a2[i]) % k try: sa[saadd] += 1 except: sa[saadd] = 1 l += 1 if l < k: continue ...
Aasthaengg/IBMdataset
Python_codes/p02851/s943767296.py
s943767296.py
py
528
python
en
code
0
github-code
90
73059218216
import numpy as np import csv import codecs import hw1.morph as morph import hw2.refer as refer from scipy.sparse import csr_matrix from sklearn import svm import gensim import gensim.downloader as api def read_annotated_dict(): annot_dict = {} f_annot_dict = 'annot_dict.csv' with codecs.open(f_annot_dict,...
KatyaKos/nlp-kr
nlp/hw3/sentiment.py
sentiment.py
py
4,697
python
en
code
0
github-code
90
3690733474
# coding=utf-8 import cv2 import sys def cutVideo(input_path, out_path, left_top_x, left_top_y, right_bottom_x, right_bottom_y): """ 视频画幅裁剪,用于实现对ROI的提取 :param input_path: 输入视频路径 :param out_path: 输出视频路径 :param left_top_x: 左上角点x坐标 :param left_top_y: 左上角点y坐标 :param right_bottom_x: 右下角点x坐标 ...
zhaoxuhui/TookitsForVideoProcessing
cutVideo.py
cutVideo.py
py
2,188
python
en
code
2
github-code
90
7820588408
# adventOfCode 2017 day 17 # https://adventofcode.com/2017/day/17 circ_buffer = [0] current_index = 0 input_filename = 'input_sample0.txt' print(f'\nUsing input file: {input_filename}\n') with open(input_filename) as f: steps_advanced = int(f.readline().rstrip()) if steps_advanced == 3: display = True else: ...
LewisStaples/advent_of_code_2017
day17/day17_partA.py
day17_partA.py
py
839
python
en
code
0
github-code
90
18127258692
import cv2 import numpy as np # Load the image image = cv2.imread("C:\\Users\mariy\Pictures\Screenshots\\yeetus.png") # Convert image to HSV color space hsv_image = cv2.cvtColor(image, cv2.COLOR_BGR2HSV) # Get the saturation channel saturation = hsv_image[:, :, 1] # Increase saturation by 30 saturation +...
retrowaveist/WiDSProject
saturation.py
saturation.py
py
771
python
en
code
0
github-code
90
4766865435
from math import sin, cos from typing import overload from pylx16a.lx16a import LX16A import time import numpy as np # from scipy.optimize import curve_fit import pandas as pd import matplotlib.pyplot as plt LX16A.initialize("COM3", 0.1) #check for errors in each motor for x in range (1,7): LX16A(x)....
TamiHime/Robotics-Project
Position Test.py
Position Test.py
py
3,248
python
en
code
0
github-code
90
74658081255
import requests import datetime from config import tg_bot_token, open_weather_token from aiogram import Bot, types from aiogram.dispatcher import Dispatcher from aiogram.utils import executor import telebot from telebot.types import BotCommand bot = Bot(token=tg_bot_token) bot1 = telebot.TeleBot(tg_bot_token, parse_m...
UmirzakovOzodbek/tg-bots
weather_bot/main_weather_tg_bot.py
main_weather_tg_bot.py
py
2,786
python
en
code
0
github-code
90
22729356576
from flask import Flask, render_template import pyodbc import pandas import requests # Specifying the ODBC driver, server name, database, etc. directly cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER=localhost;DATABASE=MyKitchen;UID=sa;PWD=password') # Create a cursor from the connection curs...
msviopavlova/MyKitchen
server.py
server.py
py
996
python
en
code
0
github-code
90
5759999905
from typing import Union, Optional from sc2 import BotAI from sc2.client import debug_pb from sc2.position import Point2, Point3 import bot.injector as injector class DebugService(): def __init__(self): self._bot: BotAI = injector.inject(BotAI) self.disabled = False async def render_...
Scottdecat/SwarmLord
bot/services/debug_service.py
debug_service.py
py
2,150
python
en
code
0
github-code
90
36779124274
from ML_Learn.com.ML.Class.KNN import kNN #========数据解析-测试集和标签测试======= #输入文件样例: #每年获得的飞行常客里程数 玩视频游戏所耗时间百分比 每周消费的冰淇淋升数 喜好权重 # 40920 8.326976 0.953952 3 # 14488 7.153469 1.673904 2 filename = '/Users/hjw/Documents/Java/python/ML/com/ML/Class/KNN/resources/datingTestSet2.txt' returnMat,classLabelVector = kNN.file2matr...
hjw199089/ML_Learn_Python
ML_Learn/com/ML/Class/KNN/kNNTest2.py
kNNTest2.py
py
1,545
python
zh
code
0
github-code
90
8979391836
from django.shortcuts import render import requests # Create your views here. def index(request): longitude = '51.5' latitude = '-0.25' if request.method == 'POST': longitude = request.POST['longitude'] latitude = request.POST['latitude'] url1 = 'https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=...
AjayYadavAi/weather-dj-app
app/views.py
views.py
py
761
python
en
code
0
github-code
90
22526815566
from read_file import read_file import random class Node(): def __init__(self, value): self.value = value self.l_child = None self.r_child = None class Tree(): def __init__(self): self.root = None self.index = 0 self.vals = [] self.in_rank = 0 def...
ReallyMonk/-ECE-16-332-573-Data-Struct-Algs
hwk3/Q5/Q5.py
Q5.py
py
2,461
python
en
code
0
github-code
90
1985733541
# -*- coding: utf-8 -*- import json import requests import scrapy import requests from lianjiascrapy.items import FangXiaoQuDetItem class LianJiaXiaoQuDet(scrapy.Spider): name = 'fangxiaoqudet' allowed_domains = ['bj.sofang.com'] def start_requests(self): start_urls = [] with open('fang...
zangree/spider-1
lianjiascrapy/spiders/box/fangxiaoqudet.py
fangxiaoqudet.py
py
5,924
python
en
code
0
github-code
90
9332144981
import csv from datetime import datetime, timedelta import numpy as np import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt import scipy.stats as st from scipy.signal import savgol_filter def read_file(): with open('data_samples/idIoTagent_6.csv', 'r') as file: result = [] csvr...
mkahe/idIoTagent
utils.py
utils.py
py
4,105
python
en
code
0
github-code
90
20437462970
from django.db import models from django.utils import timezone from django.core.validators import MaxValueValidator, MinValueValidator import json from django.contrib.auth.models import User from django.conf import settings from django.db.models.signals import post_save from django.dispatch import receiver from rest_f...
aadabi/Cruzer
server/rideshare/models.py
models.py
py
9,310
python
en
code
1
github-code
90
27924480951
import math def adam(opfunc, x, config, state=None): """ An implementation of Adam http://arxiv.org/pdf/1412.6980.pdf ARGS: - 'opfunc' : a function that takes a single input (X), the point of a evaluation, and returns f(X) and df/dX - 'x' : the initial point - 'config` : a t...
sibozhang/Text2Video
venv_vid2vid/lib/python3.7/site-packages/torch/legacy/optim/adam.py
adam.py
py
2,425
python
en
code
381
github-code
90
22238746309
import pandas as pd import matplotlib.pyplot as plt import matplotlib import squarify # 2 ways to access a column in pandas/SQL: #print(data.Growth) #print(data["Growth"]) #Because sometime the tittle of the columns come from # style that may include comma, space, semicol file_aus = "AUS_state.csv" data = pd.read_...
quangineer/australian_cities_population_dataset
main2_Pandas.py
main2_Pandas.py
py
1,215
python
en
code
0
github-code
90
22764006318
import tkinter as tk from tkinter import Grid from tkinter.filedialog import askopenfilenames from h3map.controller import MainController from h3map.gui.menubar import MenuBar from h3map.view.view import NameView, DescriptionView, MapsView class NumberOfMapsLoadedLabel(tk.Label): def __init__(self, master=None):...
chickenservice/homm3_hota_map_searcher
h3map/gui/gui.py
gui.py
py
4,520
python
en
code
1
github-code
90
70049408937
# SRI AHMAD TSAQIF # AKIP TSAQIF import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from nltk.corpus import stopwords pd.set_option('display.max_columns', None) pd.set_option('display.max_rows', None) pd.set_option('expand_frame_repr', False) # Example words d1 = 'Shipment of gold damage...
AkipTsaqif/TFIDF-Algorithm
main.py
main.py
py
3,670
python
en
code
0
github-code
90
24883696878
import pyspiel import numpy as np _SIZE = 6 _NEEDED = 4 _MARK_EMPTY = 0 _MARK_X = 1 _MARK_O = 2 _GAME_TYPE = pyspiel.GameType( short_name="ttt", long_name=f"Tic-Tac-Toe {_SIZE}x{_SIZE}", dynamics=pyspiel.GameType.Dynamics.SEQUENTIAL, chance_mode=pyspiel.GameType.ChanceMode.DETERMINISTIC, infor...
bodnara/ttt-rl-test
game.py
game.py
py
5,915
python
en
code
0
github-code
90