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
40811770527
from django.conf.urls import url, include from rest_framework import routers from django.contrib import admin from thaifood.viewset import * # Routers provide an easy way of automatically determining the URL conf. router = routers.DefaultRouter() # router.register(r'users', UserViewSet) router.register(r'foods', FoodV...
ohmini/thaifoodapi
mysite/urls.py
urls.py
py
861
python
en
code
0
github-code
90
1859427275
# Program which counts the appearances of each word in a file import sys import string FILE_NAME = input("Enter the file's name: ") counts = dict() # Empty dictionary try: f_in = open(FILE_NAME, 'r') # open file handler except FileNotFoundError: print('File not found:', FILE_NAME) sys.exit() for line ...
rubengr16/OSSU
ComputerScience/1_PY4E_Python_for_Everybody/10_Dictionaries/count_words.py
count_words.py
py
1,279
python
en
code
0
github-code
90
10299382975
import numpy as np import scipy as s import scipy.special as special from .basic_distributions import Distribution from ... import config class Gamma(Distribution): """ Class to define Gamma distributions Equations: p(x|a,b) = (1/Gamma(a)) * b^a * x^(a-1) * e^(-b*x) log p(x|a,b) = -log(Gamma(a)) ...
Starlitnightly/omicverse
omicverse/mofapy2/core/distributions/gamma.py
gamma.py
py
2,061
python
en
code
119
github-code
90
4398456486
import pandas as pd # initialize list of lists data = [['tom', 10], ['nick', 15], ['juli', 14]] # Create the pandas DataFrame df = pd.DataFrame(data, columns = ['Name', 'Age']) # print dataframe. print(df) # write to .csv df.to_csv('names.csv')
eeshabarua/gears
webscraping/posts/dataframe_demo.py
dataframe_demo.py
py
250
python
en
code
0
github-code
90
73979124455
import os import glob import hydra import torch import numpy as np import pytorch_lightning as pl from lib.trainer import SNARFModel @hydra.main(config_path="config", config_name="config") def main(opt): print(opt.pretty()) pl.seed_everything(42, workers=True) torch.set_num_threads(10) datamodule ...
xuchen-ethz/fast-snarf
test.py
test.py
py
1,586
python
en
code
228
github-code
90
21538130275
""" 需求: 获取悟空问答平台特定关键字搜索答案保存为excel文件 如搜python会跳转到:https://www.wukong.com/search/?keyword=python 保存为:悟空问答_python.xlsx """ import os import requests import time import xlsxwriter # excel读写 xlsxwriter from collections import OrderedDict TITLE_NAMES = ["问题pid", "问题", "提问时间", "提问者名称", "提问者uid", ...
MisterZZL/web_Crawler
xlsxwriter.py
xlsxwriter.py
py
4,600
python
en
code
0
github-code
90
27493717799
#!/usr/bin/env python3 import unittest import pandas as pd from pandas.testing import assert_frame_equal from colwiseproportion import migrate_params, render from cjwmodule.testing.i18n import i18n_message class MigrateParamsTest(unittest.TestCase): def test_v0_no_colnames(self): self.assertEqual(migrate...
CJWorkbench/colwiseproportion
test_colwiseproportion.py
test_colwiseproportion.py
py
2,175
python
en
code
0
github-code
90
4306326679
# Import socket module from socket import * import sys # In order to terminate the program # Create a TCP client socket # (AF_INET is used for IPv4 protocols) # (SOCK_STREAM is used for TCP) clientSocket = socket(AF_INET, SOCK_STREAM) # arguments of the client command serverName = sys.argv[1] serverPort = int(sys.ar...
Opty-BSc/CN
Lab_4/weblab/client/webclient.py
webclient.py
py
990
python
en
code
0
github-code
90
43843763680
""" 给定一个字符串数组,将字母异位词组合在一起。字母异位词指字母相同,但排列不同的字符串。 示例: 输入: ["eat", "tea", "tan", "ate", "nat", "bat"], 输出: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ] 说明: 所有输入均为小写字母。 不考虑答案输出的顺序。 """ # 解答:利用字典,由于每个字母异位词排序后都是一样的,所以可以将其作为key,value即为字符串数组 class Solution: def groupAnagrams(self, strs): """ :t...
wtrnash/LeetCode
python/049字母异位词分组/049字母异位词分组.py
049字母异位词分组.py
py
918
python
zh
code
2
github-code
90
43739889256
print("\n*****************\nQUIZ\n*****************\n") print("Realmente deseja jogar?\n 1- SIM\n 2- NÃO\n") decisao_inicial = int(input("Informe a sua decisão: ")) if decisao_inicial == 1: print("Perfeito!!!\n\nIniciando o game...\n") elif decisao_inicial == 2: print("És um peidão kkkkkkk\n\nDeseja realmente e...
ocarlosmonteiro/Python
Testes/quiz teste v1.py
quiz teste v1.py
py
761
python
pt
code
1
github-code
90
70019423656
''' Optional SSH server based on Twisted Conch if you don't want to use OpenSSH. ''' from twisted.cred.portal import Portal from twisted.cred.checkers import FilePasswordDB from twisted.conch.checkers import SSHPublicKeyDatabase from twisted.conch.ssh.factory import SSHFactory from twisted.internet import reactor from ...
zielmicha/gitjoin
gitjoin/sshd.py
sshd.py
py
4,822
python
en
code
1
github-code
90
18409114277
# 2 – Crie um dicionário em que suas chaves serão os números 1, 4, 5, 6, 7, e 9 # (que podem ser armazenados em uma lista) # e seus valores correspondentes aos quadrados desses números. l = [1,4,5,6,7,9] numeros_ao_quadrado = dict() for i in l: numeros_ao_quadrado[i] = i**2 print(numeros_ao_quadrado) print("="*...
lucasmbrute2/Blue_mod1
Aula11/Exercício01.py
Exercício01.py
py
562
python
pt
code
0
github-code
90
6425979426
from lab1.tokenizer import to_tokens import pandas as pd import pickle import copy import os import re import numpy as np import nltk nltk.download('stopwords', quiet=True) from nltk.corpus import stopwords stop_words = set(stopwords.words("english")) def freq_vectorizer(text): tokenized_text = to_tokens(text) ...
MANASLU8/nlp-22-autumn
projects/petrenko-lab/lab4/main.py
main.py
py
3,881
python
en
code
0
github-code
90
18121521079
class Dice: def __init__(self, top, south, east, west, north, bottom): self.top = top self.south = south self.east = east self.west = west self.north = north self.bottom = bottom def toN(self): tmp = self.top self.top = self.south self.sou...
Aasthaengg/IBMdataset
Python_codes/p02383/s987087544.py
s987087544.py
py
1,230
python
en
code
0
github-code
90
36397467004
from __future__ import print_function import time import numpy as np import logging class ReidentificationOutput(object): """Class to hold the output of Reidentifier.identify Members: votes : Number of votes per ID distances : Distance ID : time : Time (in sec...
idiap/pytopenface
pytopenface/reidentifier.py
reidentifier.py
py
11,493
python
en
code
2
github-code
90
25587193744
from __future__ import print_function import argparse import json import uuid from apiclient import discovery from apiclient.errors import HttpError import httplib2 from oauth2client.client import GoogleCredentials # 30 days in milliseconds _EXPIRATION_MS = 30 * 24 * 60 * 60 * 1000 NUM_RETRIES = 3 def create_big_q...
grpc/grpc
tools/gcp/utils/big_query_utils.py
big_query_utils.py
py
5,951
python
en
code
39,468
github-code
90
18348312289
import sys sys.setrecursionlimit(10000) n=int(input()) a=[[0]*(n-1) for i in range(n)] id=[[-1]*(n) for i in range(n)] MAXV=n*(n-1)//2 to=[[]*(n) for i in range(MAXV)] def toId(i,j): if (i>j): i,j=j,i return id[i][j] visited=[False]*MAXV calculated=[False]*MAXV dp=[0]*MAXV def dfs(v): if visited[v]: ...
Aasthaengg/IBMdataset
Python_codes/p02925/s025834459.py
s025834459.py
py
1,032
python
en
code
0
github-code
90
30828066791
import discord import asyncio import datetime import json from discord.ext import commands f = open("rules.txt", "r") rules = f.readlines() class main_cog(commands.Cog): def __init__(self, bot): self.bot = bot self.help_message = """ ``` Comandos Generales: !Help - Despliega todos los comandos ...
MarioVirgilio/Bot
main_cog.py
main_cog.py
py
8,694
python
es
code
0
github-code
90
20018105582
f = open("/home/t18476nt/db/GO/test.txt") lines = f.readlines() f.close() len_f = len(lines) class term: def __init__(self, term): self.term = term self.pos = [i for i in range( len_f) if "id: {}".format(term) in lines[i]][0] self.name = lines[self.pos].split("name: ")[1].spli...
TANEO-bio/archaeal_core
UniProt_to_GO.py
UniProt_to_GO.py
py
1,047
python
en
code
0
github-code
90
44680211184
#!/usr/bin/env python import sys while True: line = sys.stdin.readline() if not line: break str1,str2 = map(list,line.split()) for each in str2: if each == str1[0]: str1.pop(0) if len(str1) == 0: break if len(str1) == 0: print('Yes') else...
Lzeyuan/Algorithm
洛谷/Lg_python/UVA10340/UVA10340.PY
UVA10340.PY
py
356
python
en
code
0
github-code
90
72577205096
""" This is a LED Flash program on Raspberry Pi 3 onboard (LED0). """ # -*- coding: utf-8 -*- import time FLASH_TIMES = 5 FLASH_INTERVAL = 0.2 FILEPATH = '/sys/class/leds/led0/brightness' def led_on(): f = open(FILEPATH, 'w') f.write('1') f.close() def led_off(): f = open(FILEPATH, 'w') f.wri...
kikuzo/sakuraio-filedownload
led_flash.py
led_flash.py
py
543
python
en
code
0
github-code
90
34856035203
#Reverse a string in Python def rev_str(str): newstr = "" for i in range(len(str)-1, -1, -1): print(str[i]) newstr = newstr + str[i] print(newstr) rev_str("Mukul")
mukulverma2408/PracticeGeeksforGeeks
PythonPracticeQuestion-Part2/PracticeExample-3.py
PracticeExample-3.py
py
193
python
en
code
0
github-code
90
3115205439
""" Purpose: Ulam number algorithm Date created: 2020-01-05 URI: https://en.wikipedia.org/wiki/Ulam_number Contributor(s): Mark M. From Wikipedia: An Ulam number is a member of an integer sequence devised by and named after Stanislaw Ulam, who introduced it in 1964. The standard Ulam sequence (the...
MarkMoretto/python-examples-main
algorithms/sequences/ulam.py
ulam.py
py
7,011
python
en
code
1
github-code
90
3825962468
from nltk.corpus import stopwords from nltk.tokenize import word_tokenize, sent_tokenize #sample text text = '''Data science is an interdisciplinary field of scientific methods, processes, algorithms and systems to extract knowledge or insights from data in various forms, either structured or unstructured, simi...
yuckyfang/Frankie
text_summarizer.py
text_summarizer.py
py
3,369
python
en
code
0
github-code
90
74785427177
class Solution(object): def convert(self, s, numRows): if numRows == 1: return s rows = [''] * numRows num = (numRows-1)*2 for i, item in enumerate(s): if i % num >= numRows: rows[(num - i % num) % numRows] += item else: rows[i ...
codejigglers/leetcodes
leetcode/zigzag_iterator.py
zigzag_iterator.py
py
419
python
en
code
0
github-code
90
35810116263
# import the necessary packages from keras.preprocessing.image import ImageDataGenerator from keras.optimizers import Adam,SGD from keras.preprocessing.image import img_to_array import keras from keras import layers from keras import models from sklearn.preprocessing import MultiLabelBinarizer from sklearn...
Adnan8622/Wild-Animal-Classification
Main.py
Main.py
py
8,358
python
en
code
0
github-code
90
18059812479
def main(): import sys input=sys.stdin.readline h,w,n=map(int,input().split()) ans=[0]*10 p=set() q=set() for i in range(n): a,b=map(int,input().split()) for j in range(-1,2): for k in range(-1,2): if 2<=a+j<=h-1 and 2<=b+k<=w-1: r=(a+j)*(10**10)+b+k p.add(r) q.add(a*(10**10)+b) p=list(p)...
Aasthaengg/IBMdataset
Python_codes/p04000/s673597695.py
s673597695.py
py
551
python
en
code
0
github-code
90
18541405869
# coding: utf-8 a=input() b=list(a) x=700 lis={"o":1,"x":0} for i in b: y=lis[i] if y==1: x=x+100 print(x)
Aasthaengg/IBMdataset
Python_codes/p03369/s266840326.py
s266840326.py
py
116
python
en
code
0
github-code
90
12597985287
import boto3 def lambda_handler(event, context): # create an SQS resource object using Boto3 sqs = boto3.resource('sqs') # define the name of your SQS queue queue_name = 'my-sqs-queue' # create an SQS queue with the given name queue = sqs.create_queue(QueueName=queue_name) # return a suc...
hogtai/Public_Repo
Lambda_Python_Scripts/Create_SQS_Queue.py
Create_SQS_Queue.py
py
484
python
en
code
4
github-code
90
28135229000
# -*- coding:utf-8 -*- ''' SQL Table [Basic] = ID, Name, Abstraction, Structure, Status, Description, Extended_Description, Background_Detail, Likelihood_Of_Exploit, Functional_Area, Affected_Resource ''' import xml.etree.ElementTree as elemTree from xml.etree.ElementTree import parse import xmltodict import json ...
roytravel/Cybersecurity
01. Parser/parser_xml_basic.py
parser_xml_basic.py
py
3,170
python
en
code
0
github-code
90
17964212569
import math import copy from operator import mul from functools import reduce from collections import defaultdict from collections import Counter from collections import deque # 直積 A={a, b, c}, B={d, e}:のとき,A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B) from itertools import product # 階乗 P!: permutations(seq)...
Aasthaengg/IBMdataset
Python_codes/p03626/s217698698.py
s217698698.py
py
1,869
python
en
code
0
github-code
90
42297516787
from __future__ import absolute_import, division, print_function import numpy as np import pandas as pd import sys if not sys.warnoptions: import warnings warnings.simplefilter("ignore") import torch from torch.autograd import Variable import torch.nn.functional as nnf from torch.utils.data import random_s...
AlaaLab/deep-learning-uncertainty
models/base_models.py
base_models.py
py
3,228
python
en
code
561
github-code
90
19966422451
import tensorflow as tf import numpy as np import random random_seed = 1 np.random.seed(random_seed) random.seed(random_seed) tf.random.set_seed(random_seed) import flwr as fl import common num_clients=2 num_rounds=10 fraction_fit=1.0 losses=[] accuracies=[] def get_evaluate_fn(model): """Return an evalu...
ThalesGroup/federated-learning-frameworks
Flower/dp-sgd_flower_mnist_cnn/server.py
server.py
py
1,629
python
en
code
2
github-code
90
18499702799
from cmath import exp from math import pi x1, y1, x2, y2 = map(int, input().split()) v = x2 - x1 + (y2-y1)*1j v_ = v*exp(pi/2*1j) x3 = round(x2+v_.real) y3 = round(y2+v_.imag) x4 = round(x1+v_.real) y4 = round(y1+v_.imag) print(x3, y3, x4, y4)
Aasthaengg/IBMdataset
Python_codes/p03265/s652007916.py
s652007916.py
py
246
python
en
code
0
github-code
90
10148880249
# -*- coding: utf-8 -*- """ Created on Wed May 1 22:51:13 2019 @author: xiong """ import cv2 import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np PATH='C:/Users/xiong/OneDrive - McMaster University/Data and files/algae_project/0514/' FILENAME='2_fl' cap=cv2.VideoCapture(PATH + FILENAME...
xiongbo5416/algae-0514
video2images.py
video2images.py
py
771
python
en
code
0
github-code
90
32900265405
import os from datetime import datetime from flask import Flask, request, make_response from json import JSONDecoder from controllers import DatabaseController from finq import FINQ, Identity from constants import Fields, Errors, quote_fields from controllers import MailController from finq_extensions import extract_...
FacelessLord/web-dhtml-project
server/app.py
app.py
py
8,388
python
en
code
0
github-code
90
31972016191
#simular to the count words lab from datetime import datetime with open('rain_data.txt') as f: rows = f.readlines() offset = 0 for row in rows: offset += 1 row = row.strip() if set(row) == set('-'): break #get row list at index one and index two ...
davidl0673/pythonstuff
lab24.py
lab24.py
py
1,281
python
en
code
0
github-code
90
23044481858
# -*- coding: utf-8 -*- import random class Gerar(): def gera(num_populacao, num_cromossomo): x = 0 populacao = [] cromossomo = [] while x in range(num_populacao): for i in range(num_cromossomo): cromossomo.append(random.randint(0, 1)) ...
ficorrea/data_science
geneticos/algo_genetico/gera.py
gera.py
py
422
python
en
code
0
github-code
90
18174414549
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..) import sys def main(N, K, A): lo = 0 hi = 10**9 while hi - lo > 1: m = (lo + hi) // 2 if sum((a + m - 1) // m - 1 for a in A) <= K: hi = m else: lo = m print(hi) if __name__ == '__main__': input = sys.stdin.readline N, K = m...
Aasthaengg/IBMdataset
Python_codes/p02598/s494945400.py
s494945400.py
py
403
python
en
code
0
github-code
90
13738553358
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ############################################################################ # # gpx2csv.py # 04/17/2020 (c) Juan M. Casillas <juanm.casillas@gmail.com> # # read a gpx, generate a CSV list, and do some funky works on this # # #############################################...
juanmcasillas/RoadTools
roadtools/core/gpx2csv.py
gpx2csv.py
py
1,906
python
en
code
1
github-code
90
71044972776
from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt from rest_framework.response import Response from django.http import HttpResponseRedirect from rest_framework import status from accounts.models import UserAccount # def index(request): # return render(request,'index.html') @...
Roshankc682/Mood_Music_player
core/views.py
views.py
py
1,531
python
en
code
0
github-code
90
5501568848
import openslide import os import argparse import glob import torch from scipy.io import loadmat import numpy as np import cv2 from tqdm.autonotebook import tqdm import time from rasterio import features from shapely.geometry import shape from shapely.geometry import mapping import geojson from util.util import hover...
phyranja/DNA_estimation
regions_conv.py
regions_conv.py
py
3,762
python
en
code
0
github-code
90
14614597587
from datetime import datetime import logging import gspread from gspread_dataframe import get_as_dataframe, set_with_dataframe from oauth2client.service_account import ServiceAccountCredentials from pytz import timezone logging.basicConfig() logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) class G...
brandenc40/gsheet-api
gsheet_api/gsheet_api.py
gsheet_api.py
py
7,292
python
en
code
4
github-code
90
3692533087
import argparse import logging import subprocess import os import re from tempfile import NamedTemporaryFile from lxml import etree from .exceptions import SysException logger = logging.getLogger(__name__) def cmd_parser(): parser = argparse.ArgumentParser(description='Replicate a MySQL database to MongoDB') ...
njordr/mymongo
mymongolib/utils.py
utils.py
py
8,821
python
en
code
6
github-code
90
32409536696
''' 通过肢体姿态检测,得到左右手label ''' import os import cv2 from json_tools import make_json_head from pose_tool import PoseLandmark, landmark_to_box, bb_iou import numpy as np import json from tqdm import tqdm from convert_coco_format import convert_coco_format_left_label from copy import deepcopy mode = 'val' # E:\whole_bo...
Daming-TF/HandData
scripts/Tools/Mark_Tools/Left_label_data/run_pose.py
run_pose.py
py
2,448
python
en
code
1
github-code
90
41915684581
from django.core.management.base import BaseCommand from django.utils import timezone from pokemon import utilities class Command(BaseCommand): help = 'Displays current time' def add_arguments(self, parser): parser.add_argument('evolutionChainRangeID', nargs='+', ...
andresRah/PokemonDjango
pokemon/management/commands/poblate_database.py
poblate_database.py
py
1,227
python
en
code
0
github-code
90
19115465322
from http import HTTPStatus from uuid import UUID from fastapi import APIRouter, Depends, HTTPException from app.constants import Role from app.exceptions import ( AccountNotFoundError, ) from app.schemas import AccountSchema, TransactionSchema, UserSchema from app.use_cases.accounts import ( GetTransactionsU...
nikvst/async-arch-course
accounting/app/api/accounts.py
accounts.py
py
1,925
python
en
code
0
github-code
90
16001510475
from picozero import pico_led, LED, Switch from time import sleep # Allumer et éteindre la LED sur la carte Pico pico_led.on() sleep(1) pico_led.off() luciole = LED(13) # Utiliser GP13 interrupteur = Switch(18) # Utiliser GP18 while True: if interrupteur.is_closed: # L'interrupteur est connecté luciole.o...
raspberrypilearning/led-firefly
fr-FR/solutions/led_firefly_complete.py
led_firefly_complete.py
py
474
python
fr
code
2
github-code
90
2481395631
from django.shortcuts import render, get_object_or_404 from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.core.mail import send_mail from django.views.generic import ListView from django.db.models import Count # from django.contrib.postgres.search import SearchVector, SearchQuery, Sear...
koluchiynick/django_first_blog
blog/views.py
views.py
py
5,606
python
ru
code
0
github-code
90
18176399769
A,B,C = map(int,input().split()) N = int(input()) stack = [(A,B,C,N)] flag = False while stack: a,b,c,n = stack.pop() if a<b and b<c: flag = True break if n>0: stack.append((a*2,b,c,n-1)) stack.append((a,b*2,c,n-1)) stack.append((a,b,c*2,n-1)) print('Yes') if flag else print('No')
Aasthaengg/IBMdataset
Python_codes/p02601/s993853045.py
s993853045.py
py
309
python
en
code
0
github-code
90
74380440937
#+----------------------------------------------------+ #| 23/03/2019 - Report page for teachers #| Created by Sahar Hosseini - Roman Blond #| chart description, #| report data as a table, chart and teachers enable to apply coherence, weight and penalty #+----------------------------------------------------+ from PyQt5...
Arthlec/AMC
Project/View/report_page/pageReport.py
pageReport.py
py
12,829
python
en
code
1
github-code
90
17955254869
import sys input = sys.stdin.readline # sys.setrecursionlimit(100000) def main(): N = int(input().strip()) ans = set() for _ in range(N): A = int(input().strip()) if A in ans: ans.remove(A) else: ans.add(A) return len(ans) if __name__ == "__main__": ...
Aasthaengg/IBMdataset
Python_codes/p03607/s095112277.py
s095112277.py
py
337
python
en
code
0
github-code
90
7155690346
import logging import logging.config import time from typing import Callable logger = logging.getLogger() class Timer(object): # Just for type hinting metadata: dict setState: Callable def __init__(self): super().__init__() self.timerRunning = False def runTimer(self, mqttclie...
csanz91/IotCloud
python-modules2/source/timer.py
timer.py
py
1,017
python
en
code
3
github-code
90
73405790695
from fastapi import APIRouter, HTTPException, Depends from server import auth from rest.model.buy import BuyReq, BuyResp from backend.buy import buy_products buy = APIRouter( prefix = '/buy', tags = ['buy'], ) @buy.post('', status_code = 200, description = 'Buy Products', response_model = Buy...
louis-riviere-xyz/vending
rest/routes/buy.py
buy.py
py
583
python
en
code
0
github-code
90
3350074566
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np import random from Train.data_gen import Generator from tqdm import tqdm def train(net=None, model_name_and_path='./Models_weights/model',device= torch.device("cuda:0" if torch.cuda.is_available() else "c...
ALI7861111/Hand-Pose-Estimation
Train/trainer_CNN.py
trainer_CNN.py
py
3,698
python
en
code
0
github-code
90
16548487004
from django.urls import path from . import views app_name = "main" urlpatterns = [ path("", views.homepage, name="Home"), path("discussion/<str:dis_t>", views.discussion, name="Discussion"), path("newmessage", views.newmessage_request, name="NewMessage"), path("login", views.login_request, na...
SmauDistribution/Fortheum
main/urls.py
urls.py
py
984
python
en
code
0
github-code
90
31313692565
""" Homework 5: In this assignment we are creating a tool that trains Decision tree, K nearest neighbors and neural network machine learning models to perform the task of classifying online reviews. """ # Importing libraries import joblib import json import math import nltk import requests from sklearn import model_s...
nishusingh11/MIS-515_Object-Oriented-Programming-for-Business-Applications
Assignment5/Assignment5.py
Assignment5.py
py
5,155
python
en
code
0
github-code
90
18714456105
import random def twoNums(): stNum = int(input('Введи 1е число: ')) ndNum = int(input('Введи 2е число: ')) compNum = random.randint(stNum, ndNum) return compNum def answer(): print('Thinking of number... ') answer = int(input('Как ты думаешь какое число я выбрал?: ')) return answer def cor...
HiikiToSS/The_Oldest_One
тест.py
тест.py
py
881
python
ru
code
0
github-code
90
33702808077
# 문제 : 계란으로 계린치기 N = int(input()) array = [[0]*N for _ in range(N)] for i in range(N): array[i] = list(map(int,input().split())) result = 0 def dfs(level,array): global result if len(array) == level: count = 0 for i in range(len(array)): if array[i][0] <= 0: co...
kimujinu/python_PS
16987.py
16987.py
py
911
python
en
code
0
github-code
90
28712034857
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 20 21:45:29 2022 @author: yanbing_wang Get the statistics of a collection - tmin/tmax/xymin/xymax/# trajectories Compare raw and reconciled (unsupervised) - what fragments are filtered out - unmatched fragments - (done)y deviation - (done)speed distr...
DerekGloudemans/trajectory-eval-toolkit
unsup_statistics2.py
unsup_statistics2.py
py
18,493
python
en
code
1
github-code
90
22390803940
''' Teste de Aptidão - Para ser apto é necessário ter mais ou igual a 18 anos, 1.75 ou igual de altura, ter mais ou igual a 60 kg. ''' idade = int(input('Escreva sua idade: ')) altura = float(input('Esceva sua altura: ')) peso = float(input('Escreva seu peso: ')) if idade >= 18 and peso >= 60 and altu...
KesslerBarreto/curso-python-solyd
Teste de aptidão.py
Teste de aptidão.py
py
418
python
pt
code
0
github-code
90
22323486690
import json import telebot from telebot import types,util from decouple import config from googletrans import Translator BOT_TOKEN = config("BOT_TOKEN") bot= telebot.TeleBot(BOT_TOKEN) bot_data={ "name" : ["stone","حجر"] } text_messages={ "welcome": "welcome to stone بوت مجموعة تليجرام ☺", "welcomeNew...
morethancoder/telebot-groupchat
#3/main.py
main.py
py
5,144
python
en
code
7
github-code
90
72805147176
from http.server import HTTPServer, BaseHTTPRequestHandler from json import dumps, loads from urllib.parse import urlparse, parse_qs from cowpy import cow ADDRESS = ('127.0.0.1', 3000) INDEX = b'''<!DOCTYPE html> <html> <head> <title> cowsay </title> </head> <body> <header> <nav> <ul> ...
asakatida/http-server
src/server.py
server.py
py
4,327
python
en
code
0
github-code
90
36659354717
import numpy as np import math def coord(debut,fin, df): cord=[] for debut in range(fin): cord.append(df.iloc[debut,1,2]) return cord #fonction pour matrice euclidienne def matrice_euclide(dataframe1,dataframe2, len_lig, len_col): #leng_lig= dataframe1.shape[0] #leng_col= dataframe2.shape...
didadya/Distance_Frechet
FrechetDiscret.py
FrechetDiscret.py
py
2,629
python
fr
code
0
github-code
90
19292510278
import tensorflow as tf import numpy as np ################################################################################################### Define Edge Network class EdgeNet(tf.keras.layers.Layer): def __init__(self, name='EdgeNet', hid_dim=10): super(EdgeNet, self).__init__(name=name) s...
QTrkX/qtrkx-gnn-tracking
qnetworks/CGNN.py
CGNN.py
py
3,249
python
en
code
12
github-code
90
11585001158
from __future__ import annotations import uuid from typing import TypedDict from data_zipcaster import __version__ DEFAULT_USER_AGENT = f"data_zipcaster/{__version__}" # From S3S class NAMESPACES: STATINK = uuid.UUID("b3a2dbf5-2c09-4792-b78c-00b548b70aeb") class Mode(TypedDict): name: str key: str ...
cesaregarza/DataZipcaster
data_zipcaster/constants.py
constants.py
py
2,812
python
en
code
4
github-code
90
37820735401
# ________ # / # \ / # \ / # \/ # Main reference: Hoff and Niu (2012) # Hoff, P. and Niu, X., A Covariance Regression Model. # Statistica Sinica, Institute of Statistical Science, 2012, 22(2), 729–753. import textwrap import numpy as np import group_lasso import pandas as pd impo...
Cole-vJ/CovRegpy
CovRegpy_RCR.py
CovRegpy_RCR.py
py
39,406
python
en
code
1
github-code
90
3349980416
import os from stackclass import stack from stackclasswithLL import stack as LLstack import copy class bcolors: ##color fo console PURPLE = '\033[95m' BLUE = '\033[94m' CYAN = '\033[96m' GREEN = '\033[92m' YELLOW = '\033[93m' RED = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERL...
ali79hm/DSfinalproject
DSfinalproject/question1.py
question1.py
py
5,503
python
en
code
0
github-code
90
27069636458
# STEP4 文字を翻訳する # https://github.com/DeepLcom/deepl-python import deepl import os API_KEY = os.environ["API_KEY"] def translate(lang: int, txt: str) -> str: translator = deepl.Translator(API_KEY) if lang == 0: # 英語を日本語に翻訳する result = translator.translate_text(txt, target_lang="JA") else: ...
YutoKatsuno/image_and_language
translate.py
translate.py
py
493
python
ja
code
1
github-code
90
11086654517
import pyglet window = pyglet.window.Window() # Create a document to hold the input text document = pyglet.text.document.FormattedDocument() # Set the color of the text and the background document.set_style(0, len(document.text), dict(color=(255, 0, 0, 255), background_color=(0, 255, 0, 255))) # Create a layout to ...
themangokid/gen_dev_slides
pyglet_testing.py
pyglet_testing.py
py
989
python
en
code
0
github-code
90
13840490905
from prism import __version__ from discord.ext import commands # Command class class Version(commands.Cog): def __init__(self, bot) -> None: self.bot = bot self.core = bot.core self.github_repo = "https://github.com/ii-Python/Prism-v3" @commands.slash_command(description = "Show Prism'...
iiPythonx/Prism-v3
prism/cmds/general/version.py
version.py
py
1,266
python
en
code
3
github-code
90
40655365787
import logging import os import sqlalchemy import unittest from studi import app from studi import sqlalchemy_orm, upload, util, custom_error from studi.sqlalchemy_orm import Notes, Clauses, ClausePoints def gen_logger(test_name): logger = logging.getLogger(test_name) logger.setLevel(logging.DEBUG) logge...
GTedHa/studi
tests/test_delete.py
test_delete.py
py
5,511
python
en
code
0
github-code
90
5670011418
#!/usr/bin/env python from WxMAP2 import * ropt='' #ropt='norun' brOpt='-alv ' # -- web-config # wdirs=['config','configa','tceps','jtdiag','tcact','tcdiag','tceps','tcgen'] wsdir='/data/w22/web-config' usdir='/usb1/w22/web-config' for wdir in wdirs: Source='%s/%s/'%(wsdir,wdir) Target='%s/%s/'%(usdir,w...
tenkiman/wxmap2
etc/p-rsync-w22-usb1.py
p-rsync-w22-usb1.py
py
1,099
python
en
code
0
github-code
90
11726597443
import numpy as np from scipy import stats import matplotlib.pyplot as plt def C2F(c): return (c*9/5)+32 with open("timeTemp.txt", 'r') as f: lines = f.readlines() print(lines[0:5]) # create arrays for time and temperature t = [] T = [] for i in lines[1:]: # do every line except the first # print(i...
lurbano/DataAnalysis
fileGraph.py
fileGraph.py
py
781
python
en
code
0
github-code
90
30377004903
from datetime import datetime from aiogram import types from aiogram.dispatcher import FSMContext from tortoise import timezone from datetime import timezone as tz from data import messages from keyboards.default.events import get_event_buttons from keyboards.inline.events import created_event_buttons from models.base...
ghostnoop/BotTimeSpentManager
handlers/text.py
text.py
py
2,676
python
en
code
0
github-code
90
73613659177
#!/usr/bin/env python3 #web3fusion from web3fsnpy import Fsn linkToChain = { 'network' : 'mainnet', # One of 'testnet', or 'mainnet' 'provider' : 'WebSocket', # One of 'WebSocket', 'HTTP', or 'IPC' 'gateway' : 'wss://mainnetpublicgateway1.fusionnetwork.io:10001', #'gateway' : 'ws...
FUSIONFoundation/web3fsnpy
fusion_tests/fsnGetTransaction.py
fsnGetTransaction.py
py
803
python
en
code
4
github-code
90
5499279655
#! /usr/bin/python ## \file scr_handler.py # \brief holds all functions and variables related to the screen # \author John Stone # \date 2016 # \version 1.0.1 # import pygame from menu import * # Used to represent changes made to the background image # that can be reflected when the screen is blit every run thr...
jojoC0de/CapstoneProject2016
Capstone Spring 2016/scr_handler.py
scr_handler.py
py
2,688
python
en
code
1
github-code
90
7581904632
import sys from PyQt5.QtWidgets import * from PyQt5 import uic #UI파일 연결 #단, UI파일은 Python 코드 파일과 같은 디렉토리에 위치해야한다. form_class = uic.loadUiType("plus.ui")[0] class WindowClass(QMainWindow, form_class): def __init__(self): super().__init__() self.setupUi(self) self.pb.clicked.connect(...
seaweedy/python
HelloPython/day04/plus.py
plus.py
py
925
python
ko
code
0
github-code
90
70213348456
import copy import numpy as np import matplotlib.pyplot as plt from matplotlib.backends.backend_wxagg \ import FigureCanvasWxAgg as FigureCanvas import wx from wx.lib.agw import aui import wx.lib.agw.floatspin as agwfs from cebl import ml from cebl import util from cebl.rt import widgets from .standard import Sta...
idfah/cebl
cebl/rt/pages/mentaltasks.py
mentaltasks.py
py
39,727
python
en
code
10
github-code
90
40239750028
# -*- coding: utf-8 -*- """ Created on Thu Dec 31 18:57:54 2020 @author: SethHarden """ import math # Add any extra import statements you may need here # Add any helper functions you may need here # Split an array into two subsequences (a, b) # to see if the sum of of the integers in both are == def findSplitPoin...
sethmh82/SethDevelopment
Python/00-Sorting/Sorting-Balanced-Split-Question.py
Sorting-Balanced-Split-Question.py
py
1,805
python
en
code
1
github-code
90
18172676809
import sys def main(): k = int(input()) a =7%k if a == 0: print(1) sys.exit() for i in range(2,10**7): a = (10*a+7) % k if a == 0: print(i) sys.exit() print(-1) main()
Aasthaengg/IBMdataset
Python_codes/p02596/s405067634.py
s405067634.py
py
251
python
en
code
0
github-code
90
10876473985
import pygame class spritesheet(object): def __init__(self, filename, blocksize): self.sheet = pygame.image.load(filename)#.convert_alpha() self.blocksize = blocksize def image_at_block(self, pos, colorkey = None): xStart = pos[0] * self.blocksize[0] yStart = pos[1] * s...
stojanov/dungeon-crawler
Spritesheet.py
Spritesheet.py
py
1,069
python
en
code
0
github-code
90
34727386037
#!/usr/bin/python3 """ Rectangle class definition. """ from .base import Base class Rectangle(Base): """Define a rectangle.""" def __init__(self, width, height, x=0, y=0, id=None): """Initialize rectangle.""" super().__init__(id) self.width = width self.height = height ...
keysmusician/holbertonschool-higher_level_programming
0x0C-python-almost_a_circle/models/rectangle.py
rectangle.py
py
3,124
python
en
code
0
github-code
90
22201247708
import json from scholarly import ProxyGenerator, scholarly # Set up a ProxyGenerator object to use free proxies # This needs to be done only once per session print("Setting up proxy generator...") pg = ProxyGenerator() pg.FreeProxies() scholarly.use_proxy(pg) author_ID = "KLIjERgAAAAJ" scholar_sections = ["basics",...
eurunuela/eurunuela.github.io
workflows/fetch_from_scholar.py
fetch_from_scholar.py
py
1,067
python
en
code
0
github-code
90
29683751557
from use_cases.rent_use_cases import RentUseCases from repositories.rent_repository import RentRepository from repositories.movie_repository import MovieRepository from flask import Blueprint, redirect, session rent_bp = Blueprint("rent", __name__) @rent_bp.route("/rent/<int:id>", methods=["POST"]) def rent(id) : ...
MatheusLuizSoares/locadora
server/src/routes/rent_routes.py
rent_routes.py
py
1,147
python
en
code
1
github-code
90
23419379088
from django.urls import path from rest_framework.urlpatterns import format_suffix_patterns from .views import RequestCreateList, RequestRetrieveUpdate, GetActiveRequests, \ AcceptRequests, CancelRequests, GetMyRequests, GetMyAcceptedRequests urlpatterns = [ path('requests/active/', GetActiveRequests.as_view()...
SineRaja/FoodWasteManagement
FoodRequest/urls.py
urls.py
py
907
python
en
code
0
github-code
90
24841224312
#_*_ coding:UTF-8 _*_ # @author: jacky # 百度云语音识别Demo,实现对本地语音文件的识别。 # 需安装好python-SDK,录音文件不不超过60s,文件类型为wav格式。 # 音频参数需设置为 单通道 采样频率为16K PCM格式 可以先采用官方音频进行测试 # 导入AipSpeech AipSpeech是语音识别的Python SDK客户端 from aip import AipSpeech import os import importlib,sys importlib.reload(sys) #sys.setdefaultencoding('utf8') ''' 你的APPI...
buliugucloud/Che-Bao-A-smart-car-voice-control-assistant-based-on-Raspberry-Pi
Source code/speech_recognition.py
speech_recognition.py
py
2,252
python
zh
code
2
github-code
90
24758046975
nama = 'Muh Hamzah Tsalis N' program = 'Gerak Lurus' print(f'Program {program} oleh {nama}') def hitung_kecepatan(jarak, waktu): kecepatan = jarak / waktu print(f'jarak ={jarak / 1000} ditempuh dalam waktu = {waktu / 60}menit') print(f'Sehingga kecepatan = {kecepatan} m/s') return jarak / waktu # jar...
KaNirullah/uin_modularization
main.py
main.py
py
729
python
id
code
0
github-code
90
27090669638
from spack import * class Glfmultiples(MakefilePackage): """glfMultiples is a GLF-based variant caller for next-generation sequencing data. It takes a set of GLF format genotype likelihood files as input and generates a VCF-format set of variant calls as output. """ homepage = "https://g...
matzke1/spack
var/spack/repos/builtin/packages/glfmultiples/package.py
package.py
py
935
python
en
code
2
github-code
90
18004433449
import sys input = sys.stdin.readline def read(): N = int(input().strip()) A = list(map(int, input().strip().split())) return N, A def solve(N, A): B = [A[0]] prev = A[0] for a in A: if prev != a: B.append(a) prev = a count = 1 up = False down = Fa...
Aasthaengg/IBMdataset
Python_codes/p03745/s048864173.py
s048864173.py
py
754
python
en
code
0
github-code
90
40178307729
from flask_jwt_extended import jwt_required, get_jwt_identity from app.models.user_model import UserModel from flask import current_app, session from app.exc import UserNotFound @jwt_required() def delete_user_controller(): session = current_app.db.session current_user = get_jwt_identity() try: u...
Kenzie-Academy-Brasil-Developers/q3-sprint6-autenticacao-e-autorizacao-brunotetzner
app/controllers/delete_user_controller.py
delete_user_controller.py
py
631
python
en
code
0
github-code
90
18000220909
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): A, B, C = map(int, readline().split()) def judge(): for i in range(0, 100000): cur = A * i if cur % B == C: return True return Fals...
Aasthaengg/IBMdataset
Python_codes/p03730/s804966524.py
s804966524.py
py
430
python
en
code
0
github-code
90
10531799062
import logging from openerp.osv import fields, osv _logger = logging.getLogger(__name__) class ir_actions_report_xml(osv.osv): _inherit = 'ir.actions.report.xml' _columns = { 'report_type': fields.selection([('qweb-pdf', 'PDF'), ('qweb-html', 'HTML'), ('contr...
JoryWeb/illuminati
poi_x_pretensa/ir_actions.py
ir_actions.py
py
897
python
en
code
1
github-code
90
2797917246
from jsondb import JsonDB # db = JsonDB() # db.load() # print(db) # print(db['contacts'][0]) # print(db['contacts'][0]['first_name']) # db['contacts'][0]['blood_type'] = 'A-' # db['contacts'].append({ # 'first_name': 'Eleanor', # 'last_name': 'Johnston', # 'phone': '814-398-4326', # 'email': 'Eleano...
PdxCodeGuild/class_salmon
2 Flask + HTML + CSS/solutions/contact_list/app.py
app.py
py
1,493
python
en
code
5
github-code
90
29741298799
""" 输入一个字符串,按字典序打印出该字符串中字符的所有排列。例如输入字符串abc,则打印出由字符a,b,c所能排列出来的所有字符串abc,acb,bac,bca,cab和cba。 思路:循环数组中字母,取第一个,后续组成一部分数据,第一个数据 + 后续数据进行递归的结果 """ def full_prmutate(alpth_list): if len(alpth_list) == 1: return alpth_list[0] else: result = [] for i in range(len(alpth_list)): full...
misoomang/offer_test
27.py
27.py
py
734
python
zh
code
0
github-code
90
40572016286
from typing import List # # @lc app=leetcode id=78 lang=python3 # # [78] Subsets # # @lc code=start class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: res = [] def helper(idx, lst: List[int]): if (idx == len(nums)): res.append(lst.copy()) ...
VenkatSBitra/leetcode
78.subsets.py
78.subsets.py
py
513
python
en
code
0
github-code
90
44020028542
import unittest """ Fermet Little Theorem: If n is prime, then for all integers 'a' such that 2 <= a <= n-1, a**(n-1) % n = 1. Idea is to chose a random 'a' from the above mentioned range, k times, and return True if remainder is 1 for each time. This is a probabilistic method: It returns true for all primes, it may re...
prathamtandon/g4gproblems
Math/is_prime_fermet_method.py
is_prime_fermet_method.py
py
1,378
python
en
code
3
github-code
90
38163990005
import os.path as osp from tempfile import NamedTemporaryFile import mmcv import numpy as np import pytest import torch import mmdeploy.backend.ncnn as ncnn_apis import mmdeploy.backend.onnxruntime as ort_apis from mmdeploy.codebase import import_codebase from mmdeploy.utils import Backend, Codebase from mmdeploy.uti...
fengbingchun/PyTorch_Test
src/mmdeploy/tests/test_codebase/test_mmdet/test_object_detection_model.py
test_object_detection_model.py
py
20,797
python
en
code
14
github-code
90
71248188457
from collections import deque from sys import maxsize def citire(nume_fisier="graf.in"): n=0 la=[] with open(nume_fisier) as f: n, m = (int(x) for x in f.readline().split()) la = [[] for i in range(n+2)] for i in range(m): i, j = (int(x) for x in f.readline().split()) ...
DanNimara/FundamentalAlgorithms-Graphs
Lab5/2.py
2.py
py
4,193
python
en
code
0
github-code
90
36014623587
import random import wave import pyaudio import sys import socket import asyncio from sio import sio, run_server from processing import process_audio from config import FORMAT, CHANNELS, RATE, CHUNK, RECORD_SECONDS, TOTAL_CHUNKS from threading import Thread @sio.on('message') async def print_message(sid, message): ...
David-Happel/realtime_deepfake_audio_detection
server/server.py
server.py
py
1,429
python
en
code
0
github-code
90