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
28319252944
""" ########################################## 1. 定义各种类型 2. 开始填充类型中需要的属性和方法 3. 回顾填充好的类型,检查封装过程有木有遗漏 ########################################## 4. 开发注册、登录【任何项目,最简单的功能 登录/注册】 最重要的功能【登录、注册】 ########################################## """ import time import random # 定义用户类型 class User: # 定义用户的属性 def __init__(self,...
laomu/py_1709
python-base/days13_code/demo01_案例.py
demo01_案例.py
py
10,883
python
zh
code
0
github-code
36
39169556179
from PIL import Image def convertToSeamless(originalImg, outputPath): imgH, imgW = originalImg.size dim = imgW if imgW > imgH: dim = imgH tempImg = originalImg.crop((0, 0, dim, dim)) seamlessImg = Image.new("RGB", (dim * 2, dim * 2), "white") seamlessImg.paste(tempImg, (0, 0)) tempI...
Ktlas/Seamless-Noise-Generator
ConvertToSeamless.py
ConvertToSeamless.py
py
644
python
en
code
0
github-code
36
20004398484
from matrix import Matrix import random import matplotlib.pyplot as plt import numpy as np class TicTacToe: def __init__(self, player1, player2): self.board = Matrix(3, 3, 0) self.player1 = player1 self.player2 = player2 def board_copy(self): return self.board.copy() ...
matteopaz/cm_exercises
nevl/tictactoe.py
tictactoe.py
py
7,864
python
en
code
0
github-code
36
11424600276
import abc import datetime import logging import multiprocessing import signal import socket import threading import six import edera.helpers from edera.consumers import InterProcessConsumer from edera.flags import InterProcessFlag from edera.flags import InterThreadFlag from edera.helpers import Sasha from edera.he...
thoughteer/edera
edera/daemon/daemon.py
daemon.py
py
10,308
python
en
code
3
github-code
36
73547216103
#!/usr/local/bin/python3 # coding=utf-8 import random import copy import math import Utils def value_by_duration(duration, table, default): keys = list(table.keys()) sorted(keys, reverse=True) value = default for n in keys: if duration >= n: value = table[n] break return value def is_percen...
psenzee/MuGen
src/MusicUtils.py
MusicUtils.py
py
2,520
python
en
code
0
github-code
36
25619711613
# importing necessary libraries import numpy as np from scipy import linalg import pickle import sys import getopt # defining a function to run the Randomized Kaczmarz (RK) algorithm def run_RK(A, E, F, b, e, n_run, n_iter, eta, sigma_A, sigma_b, folder): """ The arguments for the run_RK() function are th...
SoumiaBouch/doubly_Noisy_Randomized_Kaczmarz
RK_multiplicative_noise.py
RK_multiplicative_noise.py
py
7,176
python
en
code
1
github-code
36
31414950672
def swapNibbles(test_num): swapped = int((test_num & 0x0F) << 4 | (test_num & 0xF0) >> 4) print("Number after swapping Nibbles through bytes: \n", swapped) num = swapped return isPower(num) def decimalToBinary(new_num): # Function to calculation if new_num >= 1: decimalToBinary(new_num //...
AkashBG3010/PythonPracticePrograms
PyTestingPrograms/PowerOfTwoBinary.py
PowerOfTwoBinary.py
py
1,101
python
en
code
0
github-code
36
12338358378
####################################### ### XLinst.neoCL ###################### ### by neo ###################### ### 2019 ###################### ####################################### ### neoCL | iParameters Editor ######## ####################################### import neo_xl_selected_instances as xli...
0neo/pyRevit.neoCL
neoCL.extension/lib/xl/neo_xl_selected_instances_import.py
neo_xl_selected_instances_import.py
py
2,348
python
en
code
7
github-code
36
12020327682
## Just a fun little utility to plot line-of-code statistics. import subprocess import numpy import pylab def measureLines(): baseCommand = 'find . -name "*py" | grep -v data | xargs cat' totalLines = int(subprocess.Popen( '%s | wc -l' % baseCommand, stdout = subprocess.PIPE, shell = ...
Valoren/Angpy
meta/plotFileStats.py
plotFileStats.py
py
1,655
python
en
code
1
github-code
36
29618692349
from datetime import datetime, timedelta from flask import Blueprint, send_from_directory, jsonify, request, session, redirect, url_for from playhouse.shortcuts import dict_to_model, model_to_dict from app.model import QueryType from app.model import Product, ProductRegion, ProductCategory, ProductImage from app.mode...
revectores/online-shopping-simulator
src/app/handler/product/product.py
product.py
py
3,502
python
en
code
0
github-code
36
17411563971
# import os # os.environ["NUMBA_ENABLE_CUDASIM"] = "1" dont do this ... import numpy as np from numba import cuda from numba.core.errors import NumbaPerformanceWarning import warnings warnings.simplefilter('ignore', category=NumbaPerformanceWarning) import gc import time import threading cuda.select_device(0) # con...
Mherder89/PythonLCDSlicer
LCD_slicer.py
LCD_slicer.py
py
6,432
python
en
code
0
github-code
36
25625901143
def areaofIsland(nums,i,j,count): if i<0 or j<0 or len(nums)-1<i or len(nums[0])-1<j or nums[i][j] == 0: return count nums[i][j] = 0 areaofIsland(nums,i-1,j-1,count) areaofIsland (nums,i - 1, j, count) areaofIsland(nums,i-1,j+1,count) areaofIsland (nums, i, j - 1,...
Akashdeepsingh1/project
F/areaofisland.py
areaofisland.py
py
1,923
python
en
code
0
github-code
36
17932783747
def get_cookie(cookie: str, name: str) -> str: cookies = cookie.split(";") cookie_dict = {} for cookie in cookies: cookie = cookie.strip() equals_idx = cookie.find("=") k, v = cookie[:equals_idx], cookie[equals_idx+1:] cookie_dict[k] = v return cookie_dict[name] if __...
witekosz/checkio-solutions-py
github/cookies.py
cookies.py
py
692
python
en
code
0
github-code
36
72493576743
import re; import collections; warnings = []; classStack = []; def arrayJoin(arr, delim = " "): result = ""; first = True; for line in arr: if len(line) == 0: continue; if not first: result += delim; first = False; result += line; return result; def warning(message): warnings.append(arrayJoin(cla...
astrellon/Rouge
python/luaDocs.py
luaDocs.py
py
11,114
python
en
code
2
github-code
36
9262854569
import time, yaml from operator import itemgetter from .keys import * from .helpers import * def flags_compile(flags): first = flags[0] faction = { "id": f"compile_flags_{len(flags)}", "do": "flags", "from": first["from"], "flags": flags, } return faction class ActionT...
TheSwanFactory/cqml
src/cqml/vm.py
vm.py
py
5,297
python
en
code
0
github-code
36
3469842733
import discord client = discord.Client() @client.event async def on_ready(): print('We have logged in as {0.user}'.format(client)) for guild in client.guilds: for channel in guild.channels: print(channel, channel.id) while True: channel = client.get_channel(int(input("Entrez l'...
antoinech2/DiscordMessageLogBot
bot.py
bot.py
py
789
python
en
code
0
github-code
36
37371783451
# Send a heartbeat every 5 minutes to Slack # This uses the slack-cli library: https://github.com/rockymadden/slack-cli from requests import get import time import subprocess import json import datetime def get_date_time(): return str(datetime.datetime.now()) def send_slack(): try: query = ["../../sla...
Kladdy/pi-python
heartbeat/heartbeat.py
heartbeat.py
py
2,175
python
en
code
0
github-code
36
74906934824
#!/usr/bin/python # -*- coding: utf-8 -*- # Contributors: # * Vladimir Zaytsev <vzaytsev@isi.edu> (2013) import re class POSHelper(object): def __init__(self, word): self.word = word def __nonzero__(self): return True class VBHelper(POSHelper): @property def subj(self): ...
eovchinn/ADP-pipeline
pipelines/Russian/conll.py
conll.py
py
9,934
python
en
code
16
github-code
36
25547237634
from django.db import models class Sauceproduct(models.Model): sauces = models.ForeignKey( 'sauce.Sauce', on_delete=models.SET_NULL, null=True, blank=True) product = models.ForeignKey( 'products.Product', on_delete=models.SET_NULL, null=True, blank=True) description = models.CharField(max_...
Jeffer-UAO/backend-menuinteractivo
saucesproduct/models.py
models.py
py
464
python
en
code
0
github-code
36
31018033202
""" Given a non-negative integer x, return the square root of x rounded down to the nearest integer. The returned integer should be non-negative as well. You must not use any built-in exponent function or operator. For example, do not use pow(x, 0.5) in c++ or x ** 0.5 in python. Example 1: Input: x = 4 Output: 2 ...
ravivanjarapu/ProblemSolving
LeetCode/69. Sqrt(x).py
69. Sqrt(x).py
py
1,207
python
en
code
0
github-code
36
73518710823
import sys import socket import time from variables import ACTION, PRESENCE, TIME, USER, ACCOUNT_NAME, RESPONSE from utils import port_check, addres, get_message, send_message def create_presence(name: str = 'Guest'): message = { ACTION: PRESENCE, TIME: time.time(), USER: { ACC...
Kederly84/async_chat_python
HomeWork4/client.py
client.py
py
1,068
python
en
code
0
github-code
36
3494585194
#!/usr/bin/env python3 def sum_to_k(lst, k): s = set() for i in range(0, len(lst)): element = k - lst[i] if (element in s): return True else: s.add(lst[i]) return False lst = [1, 50, 65, 7, 50] k = 100 print(sum_to_k(lst, k))
debuitc4/CA268
week2/numbers.py
numbers.py
py
291
python
en
code
0
github-code
36
37529358270
# Clase en vídeo: https://youtu.be/_y9qQZXE24A?t=12475 ### Products API ### from fastapi import APIRouter router = APIRouter(prefix="/products", tags=["products"], responses={404: {"message": "No encontrado"}}) products_list = ["Producto 1", "Producto 2", "Prod...
mouredev/Hello-Python
Backend/FastAPI/routers/products.py
products.py
py
505
python
es
code
17,209
github-code
36
19257210633
import pytest from app import create_app from app.models import TaskEntity from app.services import tasks @pytest.fixture() def client(): app = create_app() app.config.update( { 'TESTING': True, } ) yield app.test_client() tasks.clear() TaskEntity.reset_id()
macoyshev/to_Do_list
tests/app/conftest.py
conftest.py
py
316
python
en
code
0
github-code
36
41344219426
from sys import argv from cs50 import get_string def main(): """Main Method""" if len(argv) != 2: print("Number of supplied arguments is illegal") exit(1) is_number, key = is_number_string(argv[1]) if not is_number: print("Key is not a number") exit(1) plaintext = g...
chiptus/cs50x-solutions
pset6/crypt/caesar/caesar.py
caesar.py
py
1,193
python
en
code
0
github-code
36
40370154292
import pyautogui import socket import logging #import sys import threading import time #todo: might need refactoring def log(msg): #will always get a reference to an existing logger #with the name indicated logger=logging.getLogger("log") logger.info(msg) class MySocket(object): def __init__(self...
gpuma/karu
karu-server/prueba.py
prueba.py
py
3,327
python
en
code
0
github-code
36
72854617705
import gzip import json import networkx as nx def writeobj(filename, obj): with gzip.open(filename, 'wb') as f: f.write(json.dumps(obj, indent=4)) def readobj(filename): with gzip.open(filename, 'r') as f: return json.loads(f.read()) def mkdict(obj, key='id'): return dict((x[key], x) fo...
maksim2042/PyCon2013_SNA
src/govtrack/net.py
net.py
py
1,002
python
en
code
18
github-code
36
7775004719
m = int(input()) n = int(input()) l = [] for i in range(m): l.append(list(map(int, input().split()))) src, des = map(int, input().split()) d = {} for i in range(m): for j in range(len(l[i])): d[l[i][j]] = [] for i in range(m): for j in range(len(l[i])): d[l[i][j]].append(i) queue = [] b_s_v = s...
nishu959/graphpepcoding
busroutes.py
busroutes.py
py
887
python
en
code
0
github-code
36
31802340359
# /usr/bin/python3.6 # -*- coding:utf-8 -*- class Solution(object): def reverseParentheses(self, s): """ :type s: str :rtype: str """ def reverse(s, flag): """ :type s: str :type flag: bool :return: """ ...
bobcaoge/my-code
python/leetcode/1190_Reverse_Substrings_Between_Each_Pair_of_Parentheses.py
1190_Reverse_Substrings_Between_Each_Pair_of_Parentheses.py
py
1,280
python
en
code
0
github-code
36
23603010540
# -*- coding: utf-8 -*- # NOTES # ALl mask related mathematics happens assuming (and only after conversion to) the mask image as a 2D array [... x ...] # No channels=1 are used for the mask. Ofcourse while reading, it is read as [.. x .. x 1]; import os, cv2, pickle as pk, numpy as np import params from clustering imp...
murali1996/semantic_segmentation_of_nuclei_images
data_m3.py
data_m3.py
py
23,748
python
en
code
0
github-code
36
33521223297
#!/usr/bin/env python import os import ADC0832 import multiLED import RPi.GPIO as GPIO import time import math from decimal import * def init(): GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location ADC0832.setup() #PWM pin settings GPIO.setup(7, GPIO.OUT) GPIO.setup(11, GPIO.OUT)...
gregornemec/Delavnice_RPi-OS
Projekti/Ulicna_rasvetljava/code/ulicna_rasvetljava_new.py
ulicna_rasvetljava_new.py
py
1,107
python
en
code
0
github-code
36
75270142825
from src.common.read_input import read_input # bit_position is index from the left side of the number def most_common_value(digits, bit_position): num_lines = len(digits) num_ones = sum(list(zip(*digits))[bit_position]) return num_ones >= num_lines/2 def least_common_value(digits, bit_position): ret...
dipeshmanandhar/advent-of-code
src/2021/day3/puzzle2.py
puzzle2.py
py
1,165
python
en
code
0
github-code
36
9020601076
import os from matplotlib.pyplot import imread import random import numpy as np # set seed: seed_value = 1 os.environ['PYTHONHASHSEED']=str(seed_value) random.seed(seed_value) np.random.seed(seed_value) def getListOfFiles(dirName): # create a list of file and sub directories # names in the give...
MeitalRann/Music-Genre-Detection-using-Deep-CNN-Architecture
lib/get_images.py
get_images.py
py
1,088
python
en
code
0
github-code
36
20857564167
# https://leetcode.com/problems/number-of-1-bits/ class Solution: def hammingWeight(self, n: int) -> int: x = (bin(n)[2:]) l = x.split("0") sum = 0 for y in l: sum = sum+len(y) return sum
manu-karenite/Problem-Solving
Bits/numberOf1Bits.py
numberOf1Bits.py
py
246
python
en
code
0
github-code
36
27036725509
# ========================================================================= # Copyright (C) 2022. Huawei Technologies Co., Ltd. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the...
xue-pai/FuxiCTR
fuxictr/features.py
features.py
py
5,503
python
en
code
671
github-code
36
2926069987
# -*- coding: utf-8 -*- """ Created on Wed Nov 29 21:18:31 2017 @author: jagan """ #Import Library import matplotlib.pyplot as plt import numpy as np #Main Function def main(): N= 5 width = 0.35 #Data for the bar chart men_score=(75,70,98,62,55) wom_score=(65,77,98,85,63) ind = np.a...
shalabh250284/test-python-project
bar_chart.py
bar_chart.py
py
642
python
en
code
0
github-code
36
42366406042
class cipher: """ Class used to cipher/decipher a message, using the vigenere cipher. """ def __init__(self, key = "a"): """ key: the key used to cipher/decipher the message """ self.change_key(key) self.SPECIAL_CHAR = -1 def change_key(self, key): """ ...
Cezari0o/Cifra-Vigenere
vigenere.py
vigenere.py
py
3,785
python
en
code
0
github-code
36
74642998503
# -*- coding: utf-8 -*- """ @author: Florian Koch @license: All rights reserved """ import pandas as pd import json with open('../../data/Öffentliche Beleuchtung der Stadt Zürich/beleuchtung.json') as data_file: data = json.load(data_file) df = pd.io.json.json_normalize(data, ['features', ['geometry', 'coordinates...
limo1996/ETH-DataScience
src/preprocess/beleuchtung.py
beleuchtung.py
py
450
python
en
code
0
github-code
36
32413575452
import math import os from pathlib import Path from typing import Any, Optional, Tuple, Union from warnings import warn import torch from renate.types import NestedTensors def mmap_tensor( filename: str, size: Union[int, Tuple[int, ...]], dtype: torch.dtype ) -> torch.Tensor: """Creates or accesses a memory...
awslabs/Renate
src/renate/memory/storage.py
storage.py
py
6,650
python
en
code
251
github-code
36
28122729709
#PE-FA MRM Generator 2.0 import pandas as pd fatty_acids = ['14:0', '14:1', '16:0', '16:1', '18:0', '18:1', '18:2', '18:3', '20:0', '20:1', '20:2', '20:3', '20:4', '20:5', '22:4', '22:5', '22:6'] # FAs pulled from Lipidyzer def mrm_output(fa1): carbon = 12.000000 hydrogen = 1.007825 oxygen = 15.99...
tromsdahl/UNT-lipidomics
02_Python_scripts/pe_fa_mrm_generator.py
pe_fa_mrm_generator.py
py
4,270
python
en
code
0
github-code
36
10933710251
from django.shortcuts import render, get_object_or_404 from django.shortcuts import redirect from allauth.socialaccount.models import SocialAccount from .models import Repository, Milestone, Task import requests from .scripts import sync_repos from .forms import MilestoneForm, TaskForm def homepage(request): retur...
MichalKozlowskii/git-roadmap
roadmap/views.py
views.py
py
3,907
python
en
code
0
github-code
36
5558299385
from unidecode import unidecode import unittest class Event: def __init__(self, name, player, quantity): self.name = name self.player = player self.quantity = quantity def __str__(self): return ', '.join([self.name, unidecode(self.player), str(self.quantity)]) def __eq__(s...
arxoclay/fpl-updates
event.py
event.py
py
5,007
python
en
code
0
github-code
36
18363748651
import argparse from pwm import main as pwm_main from pwm import * ''' -m pour le fichier contenant la matrice (option longue --pfm, pas de valeur par défaut) ; -t pour le seuil de score de matrice (option longue --threshold, pas de valeur par défaut) ; -l pour la longueur du promoteur (option longue --promotor-length...
fayssalElAnsari/Bioinformatics-python-sequence-analyser
app/src/putative_TFBS.py
putative_TFBS.py
py
1,622
python
fr
code
0
github-code
36
6508824338
import numpy as np import chainer import argparse import csv import chainer.functions as F import chainer.links as L from chainer import cuda from chainer import serializers from fix_data import OneDimSensorData """ LSTMを書いて, 訓練するクラス """ class LSTM(chainer.Chain): def __init__(self): super().__init__...
awkrail/laugh_maker
lstm_new.py
lstm_new.py
py
4,159
python
en
code
0
github-code
36
75068295464
#MODULO 1 #EJERCICIO 1 nombre = input("¿Cual es su nombre? ") print('Hello {}'.format(nombre)) #EJERCICO 2 import string print(string.ascii_lowercase) a = input("Ingrese el abecedario alterado que desea: ") s = input("Ingrese oracion que quiere encriptar con el abecedario anteriormente proporcionado...
jeancitojdx/Final_de_Datux
Modulo1/Modulo 1 visualcode/MODULO1.py
MODULO1.py
py
1,701
python
es
code
0
github-code
36
74059454504
from ansible.module_utils.basic import AnsibleModule from PyPowerStore.utils.exception import PowerStoreException from ansible.module_utils import dellemc_ansible_utils as utils import logging from uuid import UUID __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['prev...
avs6/ansible-powerstore
dellemc_ansible/powerstore/library/dellemc_powerstore_volumegroup.py
dellemc_powerstore_volumegroup.py
py
26,850
python
en
code
0
github-code
36
1818949289
import fileinput from multiprocessing import Process import os import shutil import sys from node import Node from observer import Observer from utils import pipeName, Pipes def createNode(node_id, money): n = Node(node_id, money) n.listen() def createObserver(): obs = Observer() obs.listen() pas...
a-yun/distributed-snapshot
master.py
master.py
py
6,692
python
en
code
0
github-code
36
32961827103
import numpy as np import cv2 from scipy.misc import imresize from imageio import imread from tensorflow.keras.preprocessing import image from keras.applications import imagenet_utils import os def get_bounding_box_coordinates(projection): combined_channels = np.sum(projection[0], axis=2) arg_positions = np.ar...
benygood/deconv
base/image_ops.py
image_ops.py
py
6,496
python
en
code
0
github-code
36
32143208930
""" 1) Imprimir a quantidade de números pares entre dois números solicitados para o usuário. """ comeco = int(input("Digite o valor do inicio do intervalo: ")) final = int(input("Digite o valor do final do intervalo: ")) quantidadePares = 0; while comeco <= final: if comeco % 2 == 0: quant...
grazielags/cp12
Gizelle/Modulo3/Modulo3dia3/Exercicio 1 - M3 - A3.py
Exercicio 1 - M3 - A3.py
py
444
python
pt
code
0
github-code
36
74572265062
# needed to see solution import sys def re_spaced(document, dictionary): memo = [None] * len(document) result = re_space(document, dictionary, 0, memo) return result.parsed def re_space(document, dictionary, start, memo): if start == len(document): return ResultParse("", 0) elif memo[st...
gabrielmcg44/cracking-the-code
chapter 17/17.13/17.13.py
17.13.py
py
1,344
python
en
code
0
github-code
36
30619611761
#****************************************************************************** #Interfaz gráfica para gestionar las películas guardadas por Trailers.py #Un doble click en la película abre el link asociado #El botón > permite asociar una fecha al nombre de una película #@angalaagl #https://github.com/aglpy #https://ana...
aglpy/Estrenos
TrailersReader.py
TrailersReader.py
py
6,150
python
es
code
1
github-code
36
38715613362
#!/usr/bin/env python3 import json def sum_numbers(data, ignore_red=False): if isinstance(data, list): total = 0 for e in data: total += sum_numbers(e, ignore_red) return total elif isinstance(data, str): return 0 elif isinstance(data, int): return data ...
lvaughn/advent
2015/12/accounting.py
accounting.py
py
778
python
en
code
1
github-code
36
42591766267
from re import M from pyrailbaron.map.svg import MapSvg, transform_lcc, transform_dxf from pyrailbaron.map.datamodel import Map, Coordinate from pyrailbaron.map.states import get_border_data from pathlib import Path from typing import List ROOT_DIR = (Path(__file__) / '../../..').resolve() border_data = get_border_da...
bmboucher/rail_baron
python/scripts/test_draw_border.py
test_draw_border.py
py
3,293
python
en
code
0
github-code
36
72163196264
#a1,b1,c1 = str(input("Please enter 3 words separated by a comma and the programm will print the first letter of each word: ")) # for i in a1,b1,c1: # print(course[0]) #word1=input("Enter first word") #word2=input("Enter second word") #word3=input("Enter third word") # print(word1[0]) # print(word2[0]) # print(...
alejjuuu/Code-work
Python/CCM/prints_first_letter.py
prints_first_letter.py
py
415
python
en
code
2
github-code
36
3770442163
from fastai.vision.widgets import * from fastai.vision.all import * from pathlib import Path import PIL from PIL import Image import matplotlib.pyplot as plt import matplotlib.image as mpimg import color file_name='style.pkl' learn_inference = load_learner(Path()/file_name) #defining wallpaper class for testing class...
leahuriarte/recfromimage
style.py
style.py
py
1,926
python
en
code
0
github-code
36
24524063847
from django.core.paginator import Paginator from django.shortcuts import get_object_or_404, render from .models import News, Tag def page_list(set, request): paginator = Paginator(set, 10) page_number = request.GET.get('page') page_obj = paginator.get_page(page_number) return page_obj # Главная стр...
Gabrie1002/zavodnews
zavodnews/news/views.py
views.py
py
1,127
python
en
code
0
github-code
36
69826559463
import os import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Rectangle from mpl_toolkits.mplot3d.art3d import Poly3DCollection, pathpatch_2d_to_3d import seaborn as sns from scipy import spatial from utils import update_matplotlib_rc_parameters from utils import sph2cart from utils impo...
akapet00/phd-qualifying-exam
code/spherical_surface.py
spherical_surface.py
py
2,736
python
en
code
0
github-code
36
26613007464
class Animal: def __init__(self, kind, name, next = None): """ Initializes an instance of the Animal class. Args: kind (str): The type or kind of the animal. name (str): The name of the animal. next (Animal, optional): The reference to...
Malek-Abdelal/data-structures-and-algorithms
stack-and-queue/stack_queue_animal_shelter/animal_shelter.py
animal_shelter.py
py
3,664
python
en
code
0
github-code
36
19764321263
from __future__ import annotations import json import os import requests from typing import Tuple from .common import * from .jws import sign, rsa, x509 INTERACTIVE_PAYMENT = "interactive_payment" AUTOMATED_PAYMENT = "automated_payment" EXPECTED_PAYMENT = "expected_payment" class PayinDebtor: """The debtor (orig...
shinkansenfinance/python-shinkansen
shinkansen/payins.py
payins.py
py
12,652
python
en
code
1
github-code
36
40213018002
from flask import Flask, request, render_template from selenium import webdriver from bs4 import BeautifulSoup import pandas as pd from utils import scroll_to_page_end, extract_videos_data app = Flask(__name__) @app.route("/") def index(): return render_template("index.html") @app.route("/result", methods=["POST...
aftabgit786/youtube-videos-data-with-selenium
app.py
app.py
py
862
python
en
code
0
github-code
36
17067227665
import os import sys import difflib import unittest import subprocess import distutils.file_util import getnose import nose.plugins import nose.plugins.builtin import makeloadertests class JsTest(nose.plugins.Plugin): def options(self, parser, env=os.environ): nose.plugins.Plugin.options(self, parser, env...
mozillalabs-syncer/weave-backup
tools/scripts/runtests.py
runtests.py
py
3,767
python
en
code
1
github-code
36
23331707809
from size_based_ecosystem import * import matplotlib.animation as animation tableau20 = [(31, 119, 180), (174, 199, 232), (255, 127, 14), (255, 187, 120), (44, 160, 44), (152, 223, 138), (214, 39, 40), (255, 152, 150), (148, 103, 189), (197, 176, 213), (140, 86, 75), (196, 156, 148), ...
jemff/food_web
old_sims/eco_HD_hillclimb.py
eco_HD_hillclimb.py
py
2,353
python
en
code
0
github-code
36
13682438400
from PIL import Image import numpy as np import pandas as pd from shutil import copyfile import os # Add instructions to copy .csv to test/train directory if not os.path.isdir("./data/"): print('Creating Data Directory') os.mkdir("./data/") if os.path.isdir("./data/smiles_valset/"): print("You already have...
ssanchez2000/CS229-Project
preprocessing.py
preprocessing.py
py
2,462
python
en
code
0
github-code
36
1967983354
# do some analysis of variance import sys import csv from tabulate import tabulate from scipy import stats ANOVA_HEADERS = ['src', 'DF', 'SS', 'MS', 'F', 'p'] def sum_x(data): total = 0 for row in data: total += sum(row) return total def sum_xsq(data): total = 0 for row in data: ...
Koellewe/anova
anova.py
anova.py
py
7,268
python
en
code
0
github-code
36
19686747044
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns; sns.set() import matplotlib.pyplot as plt import csv import numpy as np import matplotlib.mlab def plotDecisionRegionQDA(sampleMean, CV_, training, data): all_res = [] minX, maxX, minY, maxY = 0., 8., 0., 8. # create one-dimensio...
aaravamudan2014/DiscriminantAnalysisClassifier
classifier.py
classifier.py
py
7,883
python
en
code
0
github-code
36
74319708582
import questionTools as qTools import dataTools as dTools import aiTools def main(): # define the question # and question column set problem = 2 csv = 'project510Data.csv' dataTotal = dTools.dataTotal(csv) q = qTools.Question(problem) q.getInputDataAndLabels(dataTotal._dataList) trainToTestRatio = 0.9 dat...
dcat52/AI-510-Grad-Project
run_classic.py
run_classic.py
py
560
python
en
code
0
github-code
36
5354168903
import sys import os parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(parent_dir) import unittest from ngsi_ld_models.models.sensor import Sensor class Sensors(unittest.TestCase): def test_interface(self): self.assertIsInstance( Sensor.parse_file( ...
daniel-gonzalez-sanchez/ngsi-ld-client-tester
sensor-tester/tests/test_sensor.py
test_sensor.py
py
434
python
en
code
0
github-code
36
72686973865
import problem1 import problem2 import problem3 import sys def print_help(): print('Uso: python3 main.py problema[ 1 | 2 | 3 ] m L delta1 delta2 alpha beta') print(' - Ejemplo: python3 main.py problema1 100 0.51302 0.008 0.004 2 5.45') def main(): if (len(sys.argv) != 8): print_help() return m = int(sys...
federicotdn/mna-tp1
src/main.py
main.py
py
1,163
python
en
code
0
github-code
36
8446754298
import os import re import shutil import tempfile import unittest from cupy import testing from example_tests import example_test os.environ['MPLBACKEND'] = 'Agg' @testing.with_requires('matplotlib') class TestKmeans(unittest.TestCase): def test_default(self): output = example_test.run_example( ...
cupy/cupy
tests/example_tests/test_kmeans.py
test_kmeans.py
py
1,190
python
en
code
7,341
github-code
36
329200388
# -*- coding: UTF-8 -*- from flask import Flask, jsonify, current_app, render_template, request import os import sys import json # http query responses handled as json # (in python requests/grequests and ajax calls) import requests # for http get/post calls from time import...
gil-k/yelp
atitan.py
atitan.py
py
3,587
python
en
code
0
github-code
36
29820114329
class Hero: def __init__(self, name, health): self.name: str = name self.health: int = health self.max_health: int = 20 self.attack: int = 0 self.money: int = 0 self.lvl: int = 1 self.kills: int = 0 self.limit_kills = 10 def __str__(self): ...
s3r3ga/SurvivalGame
src/Hero.py
Hero.py
py
1,407
python
en
code
1
github-code
36
21009250510
import math import time from collections import OrderedDict import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import utils from agent.sarsa import Sarsa class GeneratorB(nn.Module): def __init__(self, tau_dim, skill_dim, hidden_dim): super().__init__() self.ski...
Rooshy-yang/Four_Room_For_Exploartion
agent/ourc.py
ourc.py
py
8,693
python
en
code
0
github-code
36
35269645288
### ### starting damage 40 ### starting commander damage 21 ### starting infect damage 15 import time starting_health = 40 starting_commander_health = 21 starting_infect = 15 def commander_menu(): print(""" 1. Life Damage 2. Commander Damage 3. Infect Damage 4. Exit """) choice = int...
Jdeje002/My_py_learning-main
Projects/magic_life_counter.py
magic_life_counter.py
py
1,940
python
en
code
0
github-code
36
5279400185
class Tictactoe: def __init__(self): self.ttt = '012345678' self.line = '' def add_X(self, position): i = 0 while i < 9: if self.ttt[i] == position and self.ttt[i]: self.ttt = self.ttt[:i] + 'X' + self.ttt[i+1:] i += 1...
sophietandonnet/learning-python
Classes/tictactoe-class.py
tictactoe-class.py
py
3,230
python
en
code
0
github-code
36
36683242978
import config import telebot import requests from telebot import types bot = telebot.TeleBot(config.token) # Декодую json response = requests.get(config.url).json() @bot.message_handler(commands=['start', 'help']) def send_welcome(message): markup = types.ReplyKeyboardMarkup(resize_keyboard=True, row...
Yaroslav29/H_W_3.....9-codewars-
Telegram bot (курс П.Б.)/telegram bot P_B_.py
telegram bot P_B_.py
py
1,805
python
en
code
0
github-code
36
19420197734
import logging.handlers import re import sys import tqdm class Utilities(object): """ Utility functions. """ HEADERS = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xm...
coldfusion39/domi-owned
domi_owned/utilities.py
utilities.py
py
3,743
python
en
code
114
github-code
36
73952796902
# PARKING MANAGEMENT # # import datetime # # For insurance purposes, the management of an office building is required to # maintain, at all time, an accurate list of all the vehicles in the dedicated # parking. In addition, for billing the different companies, the office # building management wants to record occ...
ashokpanigrahi88/ashokpython
Exercises/Pre-Programming/parking_management.py
parking_management.py
py
10,446
python
en
code
0
github-code
36
42998943496
''' 243. Shortest Word Distance II Design a data structure that will be initialized with a string array, and then it should answer queries of the shortest distance between two different strings from the array. Implement the WordDistance class: WordDistance(String[] wordsDict) initializes the object with the string...
ahritik/leetcode
ShortestWordDistanceII244.py
ShortestWordDistanceII244.py
py
947
python
en
code
0
github-code
36
21459957483
#! python3 # This is to print fizzBuzz. # if number divisiable by 3 and 5 print fizz buzz. # if number divisable by 3 print fizz. # if number is divisable by 5 print buzz. nums = input('Enter a number:') # Asks for a number. nums = int(nums) # Converts a string into a interger. def fizzBuzz(nums): # Thi...
tenguterror/personal-growth
fizzBuzz.py
fizzBuzz.py
py
1,015
python
en
code
0
github-code
36
12487233830
def no_vowels(): print("".join([letter for letter in input() if letter not in ['a', 'o', 'u', 'e', 'i']])) def trains(): train = [0 for count in range(int(input()))] while True: command = input().split(" ") if command[0] == "End": print(train) break ...
SimeonTsvetanov/Coding-Lessons
SoftUni Lessons/Python Development/Python Fundamentals September 2019/Problems And Files/15 LISTS ADVANCED - Дата 16-ти октомври, 1830 - 2130/Redoing all the tasks.py
Redoing all the tasks.py
py
2,044
python
en
code
9
github-code
36
5555921496
""" Created on October 19, 2018 @author: mae-ma @attention: evaluation of the architectures @contact: albus.marcel@gmail.com (Marcel Albus) @version: 1.3.1 ############################################################################################# History: - v1.3.1: cleanup - v1.3.0: plot for q-vals - v1.2.1: chan...
maralbus/safety
architectures/evaluation.py
evaluation.py
py
6,362
python
en
code
0
github-code
36
37936161747
import apache_beam as beam with beam.Pipeline() as pipeline: plants = ( pipeline | 'Garden plants' >> beam.Create([ ('🍓', 'Strawberry'), ('🥕', 'Carrot'), ('🍆', 'Eggplant'), ('🍅', 'Tomato'), ('🥔', 'Potato'), ]) | 'Values' >> beam.Values() ...
ezeparziale/apache-beam-start
examples/values.py
values.py
py
354
python
en
code
0
github-code
36
23380216576
""" Viết chương trình và in giá trị theo công thức cho trước: Q = √([(2 * C * D)/H]) (bằng chữ: Q bằng căn bậc hai của [(2 nhân C nhân D) chia H]. Với giá trị cố định của C là 50, H là 30. D là dãy giá trị tùy biến, được nhập vào từ giao diện người dùng, các giá trị của D được phân cách bằng dấu phẩy. Ví dụ: Giả...
nguyenbuitk/python-tutorial
04_100_Assignments/assignment_9.py
assignment_9.py
py
803
python
vi
code
0
github-code
36
2769915489
# coding= utf-8 import json import mitmproxy.http # 存在中文乱码情况 class GetJson: def response(self, flow: mitmproxy.http.HTTPFlow): if "https://stock.xueqiu.com/v5/stock/batch/quote.json?_t" in flow.request.url and "x=" in flow.request.url: # 数据的模拟 data = json.loads(flow.response.text)...
liwanli123/HogwartProjectPractice
test_mock/get_json.py
get_json.py
py
677
python
en
code
0
github-code
36
32521250931
# _*_ coding: utf-8 _*_ from flask import render_template, redirect, url_for, flash, request from ..models import User, News, Weather from . import main from .. import HWMonitor from flask_login import login_required, current_user, login_user from sqlalchemy import desc from random import sample # 首页 @main.route('/'...
panshuo/News-Weather
app/main/views.py
views.py
py
1,752
python
en
code
0
github-code
36
3247799211
import datetime # Types of fields. CHAR = "C" NUMERAL = "N" DATE = "D" LOGICAL = "L" # System encoding which is used to convert field names between bytes and string. SYSTEM_ENCODING = "ascii" # Reference data ENCODINGS = { # got from dbf description [dbfspec] # id name description 0x00: ("asci...
y10h/ydbf
ydbf/lib.py
lib.py
py
5,038
python
en
code
15
github-code
36
16076538490
import csv import pandas as pd def parse_flat_output_to_csv(flat_output_path, csv_output_path): # Read the flat output file (assuming it's a text file with newline-separated records) with open(flat_output_path, 'r') as flat_file: flat_data = flat_file.read().strip().split('\n') # Split each lin...
shayansaha85/PythonGenAIChaos_Solution
report-generator/test.py
test.py
py
1,057
python
en
code
0
github-code
36
42191776626
from flask import Flask, render_template from flask import url_for app = Flask(__name__) @app.route('/') @app.route('/list_prof/<list>') def list_prof(list): jobs_list = ['Капитан', 'Штурман', 'Врач', 'Солдат', 'Гей'] return render_template('list_prof.html', list=list, jobs=jobs_list) if _...
Xanderstp/html
pr/flask2-3.py
flask2-3.py
py
451
python
en
code
0
github-code
36
7707012374
from utilities import excel_reader from text_processing import text_normalizer class ColumnFiller: def __init__(self, dict_filename, keyword_column = "Keyword", high_level_label_column = "High level label", status_logger = None): self.load_dictionary(dict_filename, keyword_column, high_level_label_column)...
MariyaIvanina/articles_processing
src/text_processing/column_filler.py
column_filler.py
py
4,277
python
en
code
3
github-code
36
3460040213
import numpy as np import pandas as pd import sys import os import logging import math NUMBER_CHAR = 1000 def get_logger(name): _log_format = f"%(asctime)s - [%(levelname)s] - %(name)s - (%(filename)s).%(funcName)s(%(lineno)d) - %(message)s" def get_file_handler(): file_handler = logging.FileHandler...
Dif13/Thesis_clustering
prepare_abstract.py
prepare_abstract.py
py
8,101
python
en
code
0
github-code
36
10076611848
### MODULE 3 ########### ### ASSESSMENT ######### ### Sod's Shock Tube ### import numpy as np nx = 81 dx = .25 dt = .0002 gamma = 1.4 T = 0.01 nt = 50 # Pressure given by equation of state def p(u): return (gamma - 1)*(u[2] - 0.5*(u[1]**2/u[0])) # Flux terms vector given by u def computef(u): f = np.zer...
ijmadrid/NumMooc
richtmyer2.py
richtmyer2.py
py
1,380
python
en
code
1
github-code
36
16065759660
#!/usr/bin/env python """@package topo Wireless Network topology creation. @author Ramon Fontes (ramonrf@dca.fee.unicamp.br) This package includes code to represent network topologies. """ from mininet.util import irange from mininet.topo import Topo from mn_iot.mac802154.link import mac802154Link class Topo_sixl...
rubiruchi/mininet-iot
mn_iot/mac802154/topo.py
topo.py
py
3,031
python
en
code
1
github-code
36
32413588902
import copy from abc import ABC, abstractmethod from typing import Any, Callable, List, Optional, Set import torch from renate.models.layers import ContinualNorm from renate.types import NestedTensors from renate.utils.deepspeed import convert_to_tensor, recover_object_from_tensor class RenateModule(torch.nn.Module...
awslabs/Renate
src/renate/models/renate_module.py
renate_module.py
py
11,332
python
en
code
251
github-code
36
27317809082
def solution(n, m): prime = [i for i in range(1, min(n,m)+1) if min(n,m) % i == 0] answer = [] for i in reversed(prime): if max(n, m) % i == 0: answer.append(i) break answer.append(answer[0] * (n/answer[0]) * (m/answer[0])) return answer
ykgod7/code-practice
lv1/최대공약수와 최소공배수.py
최대공약수와 최소공배수.py
py
292
python
en
code
0
github-code
36
22604148885
import os import pypdfium2 as pdfium files = [] for file in os.listdir('.'): #split the file name and get the extension extension = os.path.splitext(file)[1] if extension == '.pdf': files.append(os.path.abspath(file)) # Load a pdf document for filepath in files: filena...
Lethaldroid/Python_PDF_to_JPG
pdf_to_jpeg.py
pdf_to_jpeg.py
py
1,122
python
en
code
0
github-code
36
8503125846
from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from .models import Thread, Post class MySignUpForm(UserCreationForm): # imie_i_nazwisko = forms.CharField(max_length=100, required=False, help_text='Nie wymagane') first_name = forms.Ch...
TZdybel/Django-forum
forum/forms.py
forms.py
py
2,532
python
en
code
0
github-code
36
12834655399
import webapp2 import jinja2 import os import datetime from google.appengine.api import users from google.appengine.ext import ndb from model import RoomModel, BookingModel JINJA_ENVIRONMENT = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), extensions=['jinja2.ext.autoescape'], ...
hari-ar/cc_assignment2
add.py
add.py
py
7,428
python
en
code
0
github-code
36
5213172460
from unittest import TestCase class Solution(object): def canCompleteCircuit(self, gas, cost): """ :type gas: List[int] :type cost: List[int] :rtype: int """ # First go through and see where the cost to get to the next station is possible_starting_points = s...
tugloo1/leetcode
problem_134.py
problem_134.py
py
1,899
python
en
code
0
github-code
36
25169647710
import numpy as np import matplotlib.pyplot as plt def main(): N_bandits = 10 bandits_probs = abs(np.random.normal(size=N_bandits)) N_experiments = 100 N_episodes = 100 class Bandit: def __init__(self,bandits_probs): self.N = len(bandits_probs) self.probs = bandits...
rohilrg/Online-Learning-Bandits-Reinforcement-Learning
IU.py
IU.py
py
1,870
python
en
code
0
github-code
36
31186639545
from flask import Flask, request, jsonify from flask_cors import CORS from pymongo import MongoClient import subprocess import json import os app = Flask(__name__) CORS(app) # Load the config from config.json with open('config/config.json') as config_file: config_data = json.load(config_file) # Connect to the M...
PetteriDev/spotify1
search.py
search.py
py
1,041
python
en
code
0
github-code
36