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
31194615398
import time import requests # Takes in a schedule dictionary and sends instructions at specified times # Exits when mode is changed to manual def send_instructions(schedule): manual = False while not manual: for scheduled_time in schedule.keys(): if int(time.strftime('%H')) == int(schedule...
apangasa/hackumass-blindcontrol
cloudFxns/scheduler.py
scheduler.py
py
1,384
python
en
code
2
github-code
36
24952050763
from selenium import webdriver import time import json import os from selenium.webdriver.common.by import By import subprocess import difflib import re from urllib.parse import unquote from colorama import * class Voltaire: def __init__(self): options = webdriver.ChromeOptions() opt...
Sshinx/Voltaire-is-Over
Voltaire.py
Voltaire.py
py
3,406
python
en
code
11
github-code
36
15573580960
import argparse import json import os import cv2 import imageio import numpy as np import pims def _get_box(annot_box): x, y, w, h = annot_box["x"], annot_box["y"], annot_box["width"], annot_box["height"] return (int(x), int(y), int(x + w), int(y + h)) def extract_crop_from_image(image, box): x1, y1, x...
EGO4D/episodic-memory
VQ2D/visualizations/visualize_annotations.py
visualize_annotations.py
py
5,766
python
en
code
80
github-code
36
74262373225
import torch from torch.utils.data import (DataLoader, RandomSampler, SequentialSampler, TensorDataset) from tqdm import tqdm from transformers import ElectraForTokenClassification, ElectraConfig, WEIGHTS_NAME, CONFIG_NAME from transformers import ElectraTokenizer import time import pandas...
lindvalllab/MLSym
inference/run_and_predict.py
run_and_predict.py
py
9,557
python
en
code
7
github-code
36
73599802024
from typing import List def insert_at(original: List, value: int, target_index: int) -> List: #return original[:i] + [value] + original[i:] (python version) new_list = [0] * (len(original)+1) #(java version) index = -1 for index in range(target_index): new_list[index] = original[index] new...
amark02/ICS4U-Classwork
Lists/list_functions.py
list_functions.py
py
778
python
en
code
0
github-code
36
28523456157
# Opus/UrbanSim urban simulation software. # Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington # See opus_core/LICENSE from opus_core.variables.variable import Variable from numpy import ma, clip, where from opus_core.logger import logger, log_block class total_SS...
psrc/urbansim
zurich_parcel/building/total_SSS_job_space.py
total_SSS_job_space.py
py
3,263
python
en
code
4
github-code
36
569761706
import os, tempfile, shutil from . import utilityFunctions as uF from .output import message def medToGeo(medFile, geoFile, tmpdir, opt=[], verbose=0): medLoc=os.path.dirname(medFile) medName=os.path.basename(medFile) inpFile=os.path.join(tmpdir,'import.inp') zfile = open(inpFile,'w') zfile.write('****mesher...
luzpaz/occ-smesh
src/Tools/ZCracksPlug/Zset.py
Zset.py
py
4,844
python
en
code
2
github-code
36
74569463783
import sys, random, string, poplib from PyQt5 import QtCore, uic from PyQt5.QtWidgets import QApplication, QComboBox, \ QPushButton, QLineEdit, QLabel def on_cross_pushbutton_clicked(): if method_combo_box.currentText() == "Corte Simples": offsprings = simple_cut_crossover() son1_label_3.setVi...
gabbarco/IA-Projects-2022
7_crossover_operation/crossover_operation.py
crossover_operation.py
py
4,508
python
en
code
1
github-code
36
35220926762
import json import requests from bs4 import BeautifulSoup URL = 'https://www.zr.ru/news/' HEADERS = {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:93.0) Gecko/20100101 Firefox/93.0', 'accept': '*/*'} HOST = 'https://www.zr.ru' # Функция получения данных с сервера def get_html(url, params=None): ...
dimedrolex/parser-news-zr
www-zr-ru.py
www-zr-ru.py
py
2,503
python
ru
code
0
github-code
36
40072930878
# 标准库 import io as _io import os as _os import sys as _sys import imp as _imp import codecs as _codecs import traceback as _traceback import pathlib as _pathlib def enhance_init(work_dir=__file__, python_version_require=0, check_module_list=[]): """ :param pythonVersionRequire(int): 最低python所需版本 :param ch...
IceTiki/tikilib
enhance.py
enhance.py
py
4,584
python
en
code
1
github-code
36
2920450419
#coding:utf-8 import urllib import http.cookiejar import json class Qqpush: pushurl='https://wx.scjtqs.com/qq/push/pushMsg' def push(self,qq,token,data): url = self.pushurl+"?token="+token post={} post['qq']=qq post['content']=[{"msgtype":"text","text":data}] postdata=byt...
scjtqs2/fqsign
utils/qqpush.py
qqpush.py
py
861
python
en
code
0
github-code
36
25743739281
__all__ = [ "EBCOTCodec" ] from copy import deepcopy from multiprocessing import Pool import numpy as np from fpeg.base import Codec from fpeg.config import read_config from fpeg.funcs import parse_marker, cat_arrays_2d config = read_config() D = config.get("jpeg2000", "D") G = config.get("jpeg2000", "G") QCD = co...
yetiansh/fpeg
fpeg/codec/EBCOT_codec.py
EBCOT_codec.py
py
31,395
python
en
code
1
github-code
36
22349362845
import tqdm from tensorboardX import SummaryWriter import cv2 import numpy as np import os import torch import torch.optim as optim from torch.utils.data import DataLoader from models.lbs import batch_rodrigues from utils import misc from pytorch3d.io import save_obj from opt_params import OptParams def process_visua...
SamsungLabs/NeuralHaircut
src/multiview_optimization/runner.py
runner.py
py
10,207
python
en
code
453
github-code
36
31556525378
import copy import numpy as np import Applications.general_ci.config as config import Applications.general_ci.state as state def one_elec_hamiltonian(state_obj, h_mat, rec_num_states): # # h1 = \sum_pq h_pq p+ q # # h_pq = Kinetic E + Nuclear Attraction E # num_mol = len(rec_num_states) # print("num spin o...
sskhan67/GPGPU-Programming-
QODE/Applications/component_tests/ccsd/attic/oscillator_ccsd/attic/osc_explicit_state/hamiltonian_operator.py
hamiltonian_operator.py
py
2,576
python
en
code
0
github-code
36
2654931278
import matplotlib.pyplot as graph from usrfuncs import * from time import * def desmos(FUNC, X_MIN, X_MAX): error = 0 if (len(FUNC) != len(X_MIN)) or (len(FUNC) != len(X_MAX)) or (len(X_MIN) != len(X_MAX)): exit('Недопустимые вводные данные!') for c in range(len(FUNC)): t = time() ...
TIIGR/Python_in_SPbAU
funcs_operation/desmos.py
desmos.py
py
2,541
python
ru
code
0
github-code
36
28566611991
def get_bed_files(config): if 'genotype_bed' not in config: raise ValueError('No genotype_bed in config.') file_prefix = config['genotype_bed'] files = [ file_prefix + '.' + ss for ss in ['bim', 'bed', 'fam'] ] command = '--bfile ' + file_prefix return files, command def get_parquet_fil...
liangyy/ukb_idp_genetic_arch
preprocessing/subset_genotypes/lib.py
lib.py
py
797
python
en
code
2
github-code
36
16571425861
from __future__ import print_function import re import sys from infi.execute import execute_assert_success import pkg_resources from ..depends.dependencies import get_dependencies def run_easy_install(package_name, package): cmd = "easy_install -U \"{}\"".format(package) print("Running:", cmd, end=' ') sy...
Infinidat/infi.pypi_manager
src/infi/pypi_manager/scripts/hard_install.py
hard_install.py
py
1,658
python
en
code
2
github-code
36
10895202904
from __future__ import unicode_literals import six def python_2_unicode_compatible(klass): """ A decorator that defines __unicode__ and __str__ methods under Python 2. Under Python 3 it does nothing. To support Python 2 and 3 with a single code base, define a __str__ method returning text and app...
akloster/table-cleaner
table_cleaner/utils.py
utils.py
py
1,509
python
en
code
0
github-code
36
13898975323
import numpy as np import functools from functools import total_ordering import bisect import matplotlib.pyplot as plt # Ryan Filgas # AI Fall 2022 STATESIZE = 8 MAXFITNESS = 28 # Allow for sorting of individuals @functools.total_ordering class member: def __init__(self, fitness, position): self.fitness,...
rfilgas/ML-AI-CV
AI-Genetic-Algorithm/8-queens.py
8-queens.py
py
5,883
python
en
code
1
github-code
36
6527845396
from django.shortcuts import render,get_object_or_404 from .models import Post,Category from markdown import markdown from django.views.generic import ListView from comment.forms import CommentForm from django.http import HttpResponse # def index(request): # post_list = Post.objects.all() # return render(requ...
Sunnysunflowers/danjo
blogproject/blog/views.py
views.py
py
1,581
python
en
code
0
github-code
36
19839810739
import torch import torch.nn as nn def test_reflectionPad(padding): m = nn.ReflectionPad2d(padding) input = torch.arange(16, dtype=torch.float).reshape(1, 1, 4, 4) out = m(input) return out if __name__ == '__main__': print(test_reflectionPad(1)) x = torch.arange(4, dtype=torch.float).reshape...
AnhVietPham/Deep-Learning
DL-Pytorch/padding/main.py
main.py
py
696
python
en
code
0
github-code
36
4004966963
#!/usr/local/bin/python """ File allowing to create all kind of useful files like saving targets's primers pair in bed file or save target object into file for example. """ import dill from config import * def create_fasta_file(targets): """ Creates a fasta file containing all sequences of targets :para...
gloubsi/oncodna_primers_design
code/fileCreation.py
fileCreation.py
py
3,515
python
en
code
0
github-code
36
34651163338
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import os from datetime import datetime from xml.dom.minidom import Document from xml.etree import cElementTree as cET class TagBase: def __init__(self): pass def setTextNode(self, tag, data): if data != ...
carlos-ferras/Sequence-ToolKit
model/handle_rlf.py
handle_rlf.py
py
15,117
python
en
code
2
github-code
36
25540391488
import random from typing import Container def generar_contrasena(): MAYUS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'Ñ', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'X', 'Y', 'Z'] MINUS = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'ñ', 'o', 'p', 'q', 'r',...
MorenoChristian/Curso-Basico-de-Python-Platzi
Proyectos/Generador de Contraseñas/Generador.py
Generador.py
py
926
python
es
code
0
github-code
36
26079061227
if __name__ == "__main__": inp = open("enc").read().strip() res = "" for i in inp: chrval = ord(i) first_chr = chrval >> 8 second_chr = chrval & 0xff res += chr(first_chr) + chr(second_chr) print(res)
alfredronning/picoCTF
2021/transformation/solver.py
solver.py
py
250
python
en
code
0
github-code
36
31860619045
import numpy as np from Blackbox import problem_1, problem_2, problem_3 def PSO(func, no_inputs, c1=0.1, c2=0.9, pop_size=300, num_iter=1000, max_count=100, runs=10, seed=2): np.random.seed(seed) # comment if you want def cost(a): if(a.shape[1] == 2): return func(a[:, 0], a[:, 1]) ...
Danny7R/Metaheuristic_Optimization
3_blackbox_GS_RS_PSO_GA/Particle_Swarm_Optimization.py
Particle_Swarm_Optimization.py
py
1,618
python
en
code
1
github-code
36
18258292580
from . import common class TestIrActionsHelpers(common.TestOdootilCommon): """Test class for ir.action helpers.""" @classmethod def setUpClass(cls): """Set up ir.actions helpers data.""" super(TestIrActionsHelpers, cls).setUpClass() cls.act_partner_xml_id = 'base.action_partner_fo...
focusate/misc
odootil/tests/test_ir_actions_helpers.py
test_ir_actions_helpers.py
py
6,581
python
en
code
1
github-code
36
2185921772
import ping3 from apscheduler.schedulers.asyncio import AsyncIOScheduler from apscheduler.schedulers.base import STATE_RUNNING import myhome.tgbot import myhome.core class Cron: def __init__(self): self.presence = True self.leave_home_count_down = 0 self.leave_home_count_down_max = myhome...
hldh214/myhome
myhome/cron.py
cron.py
py
3,864
python
en
code
0
github-code
36
10848555614
from datetime import datetime from uuid import UUID import uuid from fastapi import HTTPException from starlette.responses import Response from starlette import status from http import HTTPStatus from ..app import app from ..api.schemas import CreateOrderSchema, GetOrderSchema, GetOrdersSchema, Status ORDERS = [] o...
BlackJack2021/microservice-api
src/ch02/orders/api/api.py
api.py
py
3,040
python
en
code
0
github-code
36
38191760011
""" GIW 2020-21 Práctica 07 Grupo 05 Autores: XX, YY, ZZ, (Nombres completos de los autores) declaramos que esta solución es fruto exclusivamente de nuestro trabajo personal. No hemos sido ayudados por ninguna otra persona ni hemos obtenido la solución de fuentes externas, y tampoco hemos compartido nuestra solu...
dalevale/GIW2020-21
practica8.py
practica8.py
py
7,670
python
es
code
0
github-code
36
73198221223
import functools import json import sys import traceback from flask import jsonify import sql_graph from backend.bq import BackendBQClient from backend.validation import ValidationError def _convert_bq_obj_to_rf(obj): data_dict = json.loads(obj["object_data"]) converted_obj = { "id": obj["object_id"], "...
google/grizzly
grizzly_data_lineage/backend/utils.py
utils.py
py
2,755
python
en
code
51
github-code
36
37750664568
# coding=utf-8 from global_test_case import GlobalTestCase as TestCase from subdomains.utils import reverse from instance.models import WriteItInstance from ..models import Message from popit.models import Person class MessagesPerPersonViewTestCase(TestCase): def setUp(self): super(MessagesPerPersonViewTe...
ciudadanointeligente/write-it
nuntium/tests/messages_per_person_view_test.py
messages_per_person_view_test.py
py
4,401
python
en
code
38
github-code
36
42296323474
import threading from typing import ContextManager, Optional from liquidctl.driver.kraken3 import KrakenX3 from liquidctl.driver.hydro_platinum import HydroPlatinum from .sensor import Sensor from .log import LogManager class AIODeviceSensor(Sensor, ContextManager): is_valid: bool device: Optional[any] ...
maclarsson/cfancontrol
cfancontrol/devicesensor.py
devicesensor.py
py
4,944
python
en
code
3
github-code
36
8605383597
#!/bin/python import math import os import random import re import sys # Complete the sockMerchant function below. def sockMerchant(n, ar): pairs = {} for i in ar: if i in pairs: pairs[i]+=1 else: pairs[i]=1 result = 0 for i in pairs.values(): res...
AyazRahman/HackerRank
Interview Prep Kit/Sock Merchant/sol.py
sol.py
py
587
python
en
code
0
github-code
36
5030099218
# Desenvolva uma lógica que leia o peso e a altura de uma pessoa, calcule seu Índice de # Massa Corporal (IMC) e mostre seu status, de acordo com a tabela abaixo: # - IMC abaixo de 18,5: Abaixo do Peso # - Entre 18,5 e 25: Peso Ideal # - 25 até 30: Sobrepeso # - 30 até 40: Obesidade # - Acima de 40: Obesidade Mórbida...
hdtorrad/Estudos-Python3
Só exercícios/ex043-IMC.py
ex043-IMC.py
py
981
python
pt
code
1
github-code
36
31113875208
""" The main script that serves as the entry-point for all kinds of training experiments. """ from __future__ import annotations import logging from functools import partial from typing import TYPE_CHECKING, Any, Callable, Mapping, Optional, Sequence, Tuple, Union, cast import torch from al.core.data.collators impo...
saifullah3396/doc_al
src/al/core/training/waal_trainer.py
waal_trainer.py
py
18,690
python
en
code
0
github-code
36
37068047547
from django.shortcuts import render,HttpResponseRedirect,reverse,redirect from django.contrib.auth import authenticate,login,logout from .forms import login_form,addressform from .models import guestuser # Create your views here. def user_login(request): if request.method=='POST': loginform=login_form(requ...
MohamedHany2002/online-shop
account/views.py
views.py
py
2,121
python
en
code
0
github-code
36
41472328146
# Import Pickle Module import pickle # Open the pickle file for Write Byte Mode pickle_file = open( "E:\\Python\\Code\\Tutorial\\Pickling\\PickleFile.txt", "wb") # A Dictionary my_dict = { "Name": "Shilajit Acharjee", "Roll": 16500120028, "Dept": "Computer Science & Engineering" } # Store the diction...
Shilajit2002/Python
Tutorial/Pickling/Pickling.py
Pickling.py
py
602
python
en
code
0
github-code
36
1808652
def read_wd_graph(edge_number): graph = {} for i in range(edge_number): v1, v2, w = list(map(str, input().split())) w = int(w) graph[v1] = [(v2, w)] + graph.get(v1, []) return graph e = int(input()) my_graph = read_wd_graph(e) print(my_graph)
andrewsonin/4sem_fin_test
_02_read_weighted_directed_graph.py
_02_read_weighted_directed_graph.py
py
291
python
en
code
0
github-code
36
69844963625
import cv2 from tensorflow.keras.models import load_model from keras_preprocessing import image import numpy as np import cv2 from pygame import mixer import os IMG_SIZE = 250 song_iter = 0 start_flag = False next_flag = True model = load_model('C:/Users/ANUJ/Desktop/gesture-recognition/model/gesture_model.h5') ...
anuj1501/Gesture-music-controller
src_files/tester.py
tester.py
py
2,854
python
en
code
0
github-code
36
1020567975
# ********************************************************************************************************************* # league_of_legends_api.py # import cogs.helper.api.league_of_legends_api as lol_api # *****************************************************************************************************************...
nartgnoh/BeeBot.py
cogs/helper/api/league_of_legends_api.py
league_of_legends_api.py
py
2,024
python
en
code
0
github-code
36
33324441730
import numpy as np import time class OptimModel: def __init__(self, f, grad_f, disable_progressbar=True): self.f = f self.grad_f = grad_f self.times = [] self.f_vals = [] self.zero_time = None self.disable_progressbar = disable_progressbar def init_time(self): ...
PierreBoyeau/optim_illustrations
image_reconstruction/optim_mdl.py
optim_mdl.py
py
734
python
en
code
0
github-code
36
12451384199
n = int(input()) i = 0 animals = { "C": 0, "R": 0, "S": 0 } while i < n: inp = input().split(" ") quantity = int(inp[0]) animal = inp[1] animals[animal] += quantity i += 1 total = 0 for t in animals: total += int(animals[t]) print(f"Total: {total} cobaias") print(f"Total de coel...
sergipe085/beecrowd-solutions
lista_4/experiments_1094.py
experiments_1094.py
py
612
python
en
code
0
github-code
36
3969690299
# Este programa coge un string y le pone raya al piso # alrededor de cada caracter. Por ejemplo: # Python --> _P_y_t_h_o_n_ def add_underscores(word): new_word = "_" for i in range(len(word)): # Original: new_word = word[i] + "_" new_word = new_word + word[i] + "_" # arreglado return new_wo...
jbbenavidesr/curso-python-prea
Clase7/buggy.py
buggy.py
py
604
python
es
code
0
github-code
36
1144916079
#!/usr/bin/env python3 import database with open('zonefile') as f: zone_file = f.readlines() db, cursor = database.get_mysql_db_cursor() for domain in zone_file: sql = "INSERT INTO " + database.database + ".domains " \ "(domain, created_at) " \ "VALUES (%s, NOW())" ...
jwindelborg/aau-security
knas/db_loader.py
db_loader.py
py
419
python
en
code
0
github-code
36
17448094011
from lumicube.standard_library import * import opensimplex # Enter the address or hostname of your lumicube cube = None if isRunningOnCube(): # connect locally if running locally cube = LumiCube(); else: # connect to my remote cube if not running locally (eg from my Mac) cube = LumiCube("cube.local")...
paultough/lumicube
lava.py
lava.py
py
1,210
python
en
code
0
github-code
36
24711363173
# KLIB - variables # wykys 2021 from pathlib import Path PATH_KLIB = f'{Path.home()}/projects/klib' PATH_KICAD = '/usr/share/kicad-nightly' PATH_KICAD_CONFIG = f'{Path.home()}/.config/kicad/6.99' PATH_KICAD_COMMON = f'{PATH_KICAD_CONFIG}/kicad_common.json' PATH_FP_LIB_TABLE = f'{PATH_KICAD_CONFIG}/fp-lib-table' PATH_...
wykys/klib
scripts/klib_vars.py
klib_vars.py
py
1,892
python
en
code
5
github-code
36
70222738664
import telebot from telebot import types import sqlite3 bot = telebot.TeleBot('1835870307:AAHlXuytmI_rtPbjNLj3PzBU3oaeGe7yboY') # Получение списка администраторов def get_administrators(): list = [] for i in get_db_connection().execute('SELECT * FROM administrators').fetchall(): list.append(i[1]) ...
bygimen01/SerhiiBot
bot.py
bot.py
py
24,230
python
ru
code
0
github-code
36
24477186
import sys input = sys.stdin.readline def find(n): if n != node[n]: node[n] = find(node[n]) return node[n] return n def union(a, b): parent = find(a) child = find(b) if parent>child: parent, child = child, parent if parent != child: node[child] = parent return T...
kmgyu/baekJoonPractice
Amazing Platinum/graph/행성 터널.py
행성 터널.py
py
723
python
en
code
0
github-code
36
41978072202
import time from flask import Blueprint, jsonify, request import requests import part2.health_check as health_check from dbBrokerManager.config import async_session, engine, BaseBroker from dbBrokerManager.AsyncDAL import DAL import datetime import asyncio server = Blueprint("broker_manager_Read_Only", __name__) brok...
DistributedSystemsGroup-IITKGP/Assignment-2
BrokerManagerReadOnly.py
BrokerManagerReadOnly.py
py
7,333
python
en
code
1
github-code
36
26665766366
from metrics import * import numpy as np import pandas as pd from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences from keras.utils.vis_utils import plot_model from keras.utils import to_categorical from sklearn.preprocessing import LabelEncoder from sklearn.metrics impor...
hpabst/CS680Project
src/utils.py
utils.py
py
7,487
python
en
code
0
github-code
36
42903865352
import glob import cv2 as cv method = cv.TM_SQDIFF_NORMED # Path / Threshold # Thresholds were set manually, by careful examination of examples template_blue_locks = ([img for img in glob.glob("./templates_heist/blue_lock/*.png")],0.05) template_blue_keys = ([img for img in glob.glob("./templates_heist/blue_key/*...
neuroevolution-ai/ProcgenAutoencoder
data_generation/balance_data.py
balance_data.py
py
3,236
python
en
code
1
github-code
36
3266365657
# forms.py from django import forms from .models import Mensaje, Conversacion from django.contrib.auth.models import User class MensajeForm(forms.ModelForm): class Meta: model = Mensaje fields = ('contenido',) class EnviarMensajeForm(forms.Form): contenido = forms.CharField(label="Mensaje", wid...
arielgodoy/EntregafinalPython-Agodoy
chat/forms.py
forms.py
py
863
python
es
code
0
github-code
36
16823303848
from uuid import uuid4 def randId(): return uuid4().hex def loggedIn(session, LoggedIn): if ('user' in session) and (session['user'] is not None): userLoggedIn = LoggedIn.query.filter_by(rand_id=str(session['user'])).first() if userLoggedIn: return userLoggedIn.username ret...
billz96/Pycourses
helpers.py
helpers.py
py
669
python
en
code
3
github-code
36
23294451309
import random as r print("Let's start! -> ok/no") start = input('>>>') if start == 'ok': def number_find(n): x = r.randint(1,n) # Number is thought by Computer print(f"I thought a from {1} to {n} number try to find") i = 0 # Attemp(s) while True: i += 1 ...
yeldashbaev1/simple_game
main.py
main.py
py
1,872
python
en
code
1
github-code
36
20244314041
#!/usr/bin/env python # Download individual checksum files for Electron zip files from S3, # concatenate them, and upload to GitHub. from __future__ import print_function import argparse import sys from lib.config import s3_config from lib.util import boto_path_dirs sys.path.extend(boto_path_dirs()) from boto.s3.c...
brave/muon
script/merge-electron-checksums.py
merge-electron-checksums.py
py
1,189
python
en
code
970
github-code
36
17250898175
import numpy as np import pandas as pd import os import sys np.random.seed(0) X_train_fpath = sys.argv[3] #'./X_train' Y_train_fpath = sys.argv[4] #'./Y_train' X_test_fpath = sys.argv[5] #'./X_test' output_fpath = sys.argv[6] #'./output.csv' with open(X_train_fpath) as f: next(f) X_train = np.array(...
Peter870512/ML_2020Spring
HW2/hw2_best_train.py
hw2_best_train.py
py
8,539
python
en
code
0
github-code
36
24011947026
# -------------------------------------------------------- # Licensed under The MIT License [see LICENSE for details] # -------------------------------------------------------- import torch from torch import nn import numpy as np from core.utils import * import torch.nn.functional as F from torch.distributions import N...
liruiw/HCG
core/networks.py
networks.py
py
11,936
python
en
code
13
github-code
36
10178404139
import logging import multiprocessing import random import signal import sys import time import traceback from typing import Callable, Dict, List, Optional from pebble import ProcessPool, sighandler from .client import Client from .util import constants as C from .util import helper from .util.enums import State cl...
ghilesmeddour/faktory_worker_python
src/pyfaktory/consumer.py
consumer.py
py
9,583
python
en
code
11
github-code
36
40094265357
def hn(a): sum=0 while a>0: rem=a%10 sum=sum+rem a=a//10 return sum a=int(input()) sum=hn(a) if a%sum==0: print("True") else: print("False")
YAMINISARIKI/codemind-python
Harshed_number.py
Harshed_number.py
py
184
python
en
code
0
github-code
36
40713013689
from datetime import datetime import pytz import requests from config import NO_IMG_URL, TIMEZONE def convert_timezone( time=None, format="%Y-%m-%dT%H:%M:%SZ", ori_timezone=None, desire_timezone=TIMEZONE ): date_time = datetime.strptime(time, "%Y-%m-%dT%H:%M:%SZ") ori_timezone = pytz.timezone(ori_timezo...
timho102003/newsfriend
util.py
util.py
py
689
python
en
code
0
github-code
36
14824615177
from pathlib import Path import csv import random from faker import Faker fake=Faker() p = Path('.') # Find all files in folder fileslist=list(p.glob('**/*.csv')) # Set the folder for the anonymized files outfolder = 'anon' for file in fileslist: randid=random.randint(10000,99999) randid2=random.randint(10...
carluri/pythonscripts
anonymize_csv.py
anonymize_csv.py
py
994
python
en
code
0
github-code
36
31803456709
# /usr/bin/python3.6 # -*- coding:utf-8 -*- import heapq class Solution(object): def minCost(self, grid): """ :type grid: List[List[int]] :rtype: int """ heap = [[0,[0, 0]]] row = len(grid) col = len(grid[0]) m = {1 : [0, 1], 2: [0, -1], ...
bobcaoge/my-code
python/leetcode/5347_Minimum_Cost_to_Make_at_Least_One_Valid_Path_in_a_Grid.py
5347_Minimum_Cost_to_Make_at_Least_One_Valid_Path_in_a_Grid.py
py
1,160
python
en
code
0
github-code
36
40395330066
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.preprocessing import StandardScaler # Data preprocessing data = pd.read_csv("data.csv") # Converting Pandas dataframe to numpy array X = data.x.values.reshape(-1, 1) Y = data.y.values.reshape(-1, 1) # Add bias m = X.shape[0] # sampl...
arnakoguzhan/machine-learning
3-polynomial-regression/plr_from_scratch_GD.py
plr_from_scratch_GD.py
py
2,424
python
en
code
0
github-code
36
72784702823
#Import Module import random from hangman_words import word_list chosen_word = random.choice(word_list) word_length = len(chosen_word) lives = 6 from hangman_ascii import logo, stages print(logo) print(f"the choosen word is {chosen_word}") #Making blanks display display = [] for _ in range(word_length): ...
Jotripa/small_project
hangman/hangman.py
hangman.py
py
1,355
python
en
code
1
github-code
36
43194853510
import torch from HDGCN import HDGCN from utils import DatasetLoader, accuracy from torch.utils.data import DataLoader from adabelief_pytorch import AdaBelief import torch.nn.functional as F # # Settings. # torch.cuda.set_device(4) learning_rate = 0.001 device = torch.device("cuda" if torch.cuda.is_avail...
MathIsAll/HDGCN-pytorch
main.py
main.py
py
3,791
python
en
code
5
github-code
36
24257124225
# Program prints a user-input list separated by commas and a final "and". def enum(list): a = '' for i in list[:-1]: a = a + i + ', ' a = a + 'and ' + list[-1] return a sampleList = [] while True: print('Enter list item ' + str(len(sampleList) + 1) + ' (Or enter nothing t...
mstykow/commacode
commacode.py
commacode.py
py
527
python
en
code
0
github-code
36
36328275962
class Car: def __init__(self, color, kind, brand, year): self.color = color self.kind = kind self.brand = brand self.year = year def whatCar(self): print("This car is a " + self.color + " " + self.year + " " + self.brand + ".") def carPrice(self): if (self.brand == "Mercedes-Benz"): price = 5000...
sorrykhari/random-python-practice
Car.py
Car.py
py
757
python
en
code
0
github-code
36
20621567775
# -------------- import numpy as np import warnings warnings.filterwarnings('ignore') import sys import csv # Command to display all the columns of a numpy array np.set_printoptions(threshold=sys.maxsize) # Load the data. Data is already given to you in variable `path` sales_data=np.genfromtxt(path,delimiter=',',skip...
hn1201/manipulating-data-with-numpy
code.py
code.py
py
2,075
python
en
code
0
github-code
36
36236100422
from django.shortcuts import render from django.http import * from django.contrib.auth import authenticate, login, logout from django.urls import reverse from django.contrib.auth.decorators import login_required from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger # Create your views here. # from d...
hrsh-4/blood-bank
bank/views.py
views.py
py
7,332
python
en
code
0
github-code
36
3962898112
#Dijkstra's Algorithm with D-ary Heap INF = 1000000 class heap_node: def __init__(self, name, distance): self.name = name #jayi ke hastim self.distance = distance #fasele ash ta start def size(heap): return len(heap) def heap_parent(i, d): return (i-1) // d def heap_chi...
pardisbasiri/Dijkstra-s-Algorithm-with-D-ary-Heap
Dijkstra.py
Dijkstra.py
py
3,667
python
en
code
0
github-code
36
31474695571
# encoding: utf-8 """ Core """ import json import pytz from typing import Any, Dict from base64 import b64decode from datetime import datetime from google.cloud import datastore from jsonschema import validate from jsonschema.exceptions import ValidationError, SchemaError import config import log def current_dateti...
rogerjestefani/schema-publish
src/core.py
core.py
py
2,605
python
en
code
0
github-code
36
27943726192
import os, sys, statistics as stats tags = [] #Outliner v1.0 #Copyright Richard Gustafsson #Release: Oct 15 2019 def spc(i=1337): if i != 1337: print(i) print("") if os.path.isfile("tags.txt"): with open("tags.txt") as file: tags = [line.strip() for line in file] print("Tags loaded:") for index in range(...
Weeaboo420/pythonCollection
Outliner/outliner.py
outliner.py
py
2,263
python
en
code
0
github-code
36
18824548340
import weibull # the current run time of the test or the # time that the test was suspended completely current_run_time = 4200.0 fail_times = [current_run_time] * 10 fail_times[7] = 1034.5 fail_times[8] = 2550.9 fail_times[6] = 3043.4 suspended = [True, True, True, True, True, False, False, False, True,...
slightlynybbled/weibull_orig
examples/weibull_fit_censored.py
weibull_fit_censored.py
py
847
python
en
code
null
github-code
36
30181281709
"""Deep Q learning graph with action masks The functions in this file can are used to create the following functions: ======= act ======== Function to chose an action given an observation Parameters ---------- observation: object Observation that can be feed into the output of make_obs_ph ...
RodrigoToroIcarte/reward_machines
reward_machines/rl_agents/dhrm/build_graph.py
build_graph.py
py
12,350
python
en
code
49
github-code
36
29612502663
import unittest from tree import TreeNode, build_tree from checkIdenticalTree import checkIdenticalTree, checkIdenticalTree_iter class CheckIdenticalTreeTestCase(unittest.TestCase): def test_identical_tree(self): test_in = [1,2,3,4,5] t1 = build_tree(test_in) t2 = build_tree(test_in) ...
jungwook-lee/coding-practice
tree/test_checkIdenticalTree.py
test_checkIdenticalTree.py
py
1,417
python
en
code
0
github-code
36
29767005499
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('qsource_user', '0005_auto_20151118_2237'), ] operations = [ migrations.CreateModel( name='QuestionsAnswered', ...
SamuelWenninger/QSource-app
qsource_user/migrations/0006_questionsanswered_questionsasked.py
0006_questionsanswered_questionsasked.py
py
971
python
en
code
0
github-code
36
72743725223
import os import pandas as pd import numpy as np import os from sklearn.preprocessing import MinMaxScaler, StandardScaler from sklearn.pipeline import make_pipeline, Pipeline import platform import sys import sklearn import tensorflow as tf file_path = 'H:/Study/Hackarthon/dacon/shopping/dataset/dataset' ...
KMLEE1989/Study
Dacon/shopping/shopping_1.py
shopping_1.py
py
4,021
python
en
code
0
github-code
36
32923615588
import torch import json speakers = torch.load('../models/vits_ca/speakers.pth') print(type(speakers)) conv = [line.strip().split(',') for line in open('speakers_conversion.csv').readlines()] new_speakers = {} for source, target in conv: id = speakers.get(source) if id: new_speakers[target] = source wi...
projecte-aina/tts-api
scripts/change_model.py
change_model.py
py
414
python
en
code
7
github-code
36
30647902648
#!/usr/bin/python3 import matplotlib.pyplot as plt import numpy as np x = np.linspace(-10,10,100) # 创建一个包含-10到10之间100个等距点的数组作为x坐标 y= x ** 2 # 计算y坐标 plt.plot(x, y) # 绘制曲线 plt.xlabel('x') # 设置x轴标签 plt.xlabel('y') # 设置y轴标签 plt.title('y = x^2') # 设置图标题 plt.grid(True) # 显示网格线 plt .show() #显示图形
Hsurpass/ElegantTest
test_python/python3/test_matplot/x_square.py
x_square.py
py
397
python
zh
code
0
github-code
36
25809988661
#!/usr/bin/env python3 import multiprocessing import time import os from src.model.load_json import load_json_to_dict from src.model.load_script import load_script_file from src.model.shunt import Shunt from src.tools.engine.code.github.clone import CodeClone from src.tools.log4py.log4py import print_log from src.too...
MongoliaCavalry/BronzeMan
main.py
main.py
py
2,464
python
en
code
0
github-code
36
25236981098
''' Has two pointers for the rear and front''' class CircularQueue: def __init__(self, max_size): self.items = max_size * [None] self.max_size = max_size self.rear = -1 self.front = -1 def __str__(self) -> str: return ' '.join([ str(item) for item in self.items ]) ...
dukelester/geek_for_geek_DSA
circular_queue.py
circular_queue.py
py
580
python
en
code
0
github-code
36
8128511000
#Run old_indexer first! import sys import whoosh.index as index import whoosh.qparser as qparser from whoosh.searching import Searcher correct = 0 queries = 0 #Opens index ix = index.open_dir("oldIndex") #Opens test file with open(sys.argv[1], 'r') as f: while True: #Reads next query/u...
gale2307/Jarvis
old_ir_tester.py
old_ir_tester.py
py
1,596
python
en
code
1
github-code
36
31256076584
# 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed u...
nerdicbynature/ospurge
ospurge/tests/resources/test_cinder.py
test_cinder.py
py
4,466
python
en
code
1
github-code
36
11565107048
import morse, keras import numpy as np from scipy import signal channels = 1 samples_per_sec = 100 max_seconds = 5 max_samples = max_seconds * samples_per_sec trans_seconds = 5 trans_samples = trans_seconds * samples_per_sec latent_dim = 100 TOKENS = "$^0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ " num_decoder_tokens = len(...
sehugg/cwkeras
cwmodel.py
cwmodel.py
py
10,643
python
en
code
1
github-code
36
31471559038
import itertools import operator import re import dataclasses from dataclasses import dataclass, field from typing import List, Tuple, Iterable, Dict, Optional, Set from robotoff import settings from robotoff.ml.langid import DEFAULT_LANGUAGE_IDENTIFIER, LanguageIdentifier from robotoff.products import ProductDataset...
alexouille123/robotoff
robotoff/ingredients.py
ingredients.py
py
13,629
python
en
code
null
github-code
36
28775797055
from src import source_kitten from helpers import path_helper from helpers import file_contents_helper import unittest import time class TestSourceKitten(unittest.TestCase): # Here we test (within the "Monkey" example) that # # print("Eating the \(banana. # ^ # comes up wi...
Dan2552/SublimeTextSwiftAutocomplete
test/source_kitten_test.py
source_kitten_test.py
py
6,325
python
en
code
155
github-code
36
25162153371
import json import logging import os import requests import uuid from typing import Dict LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.INFO) class TestGCWebhook: def setup(self): self.tenant = os.getenv("TENANT", "rapha") self.stage = os.getenv("STAGE", "x") self.base_u...
NewStore/int-cinori
integrations/adyen_gift_card/tests/integration/test_gc_api.py
test_gc_api.py
py
1,692
python
en
code
0
github-code
36
38221038133
from itertools import permutations def is_Prime(number): if number == 1 or number == 0: return False for i in range(2, int(number ** 0.5) + 1): if number % i == 0: return False return True def solution(numbers): answer = set() number = list(map(str, numbers)) comb_n...
kh-min7/Programmers
42839(소수 찾기).py
42839(소수 찾기).py
py
597
python
en
code
0
github-code
36
74105448422
#!/usr/bin/env python3 """Convert font to images of letters.""" import sys import os from PIL import Image, ImageFont, ImageDraw LETTER_SIZE = 60 try: font_file = sys.argv[1] output_folder = sys.argv[2] except IndexError: sys.stderr.write("Usage: {} [ttf file] [output folder]\n".format(sys.argv[0])) s...
kirilenkobm/floating_letters
font_to_letters.py
font_to_letters.py
py
1,280
python
en
code
2
github-code
36
31149579423
def Euclide(a, b): # return (x1, x2, x3) # With x1 PGCD(a,b) # x2 first bezout coef # x3 second bezout coef (a, u0, v0, b, u1, v1) = (a, 1, 0, b, 0, 1) while b != 0: (a_pred, u0_pred, v0_pred, b_pred, u1_pred, v1_pred) = (a, u0, v0, b, u1, v1) q = int(a // b) a = b_pred u0 = u1_pred v0 = v1_pred b =...
GuiMarion/Cryptography
q7.py
q7.py
py
1,023
python
en
code
0
github-code
36
21505751947
import tkinter as tk from tkinter import ttk class ToolbarWidget: def _bind_hovers(self): self.default_background = self['background'] self.config(relief=tk.FLAT, bd=0, activebackground="#d8e6f2") self.bind("<Enter>", self.on_enter) self.bind("<Leave>", self.on_leave) def on_en...
amsdc/gurutracker-college
gurutracker/views/widgets.py
widgets.py
py
2,461
python
en
code
1
github-code
36
39637785711
import constants from game.casting.actor import Actor from game.scripting.action import Action from game.shared.point import Point class HandleCollisionsAction(Action): """ An update action that handles interactions between the actors. The responsibility of HandleCollisionsAction is to handle the situ...
rich20053/cse210-frogger
game/scripting/handle_collisions_action.py
handle_collisions_action.py
py
5,103
python
en
code
0
github-code
36
8806894100
import requests ## HTTP GET Request req = requests.get('https://beomi.github.io/beomi.github.io_old/') ## HTML 소스 가져오기 html = req.text ## HTTP Header 가져오기 header = req.headers ## HTTP Status 가져오기 (200: 정상) status = req.status_code ## HTTP가 정상적으로 되었는지 (True/False) is_ok = req.ok print(html) print(header) print(status...
astinaus/python_study
crawler/requests_test.py
requests_test.py
py
386
python
ko
code
1
github-code
36
21160011627
import matplotlib.pyplot as plt import networkx as nx from queue import PriorityQueue import time start_time = time.time() G = nx.Graph() file = open("data.csv",'r') lines = file.readlines() edges = [] for row in range(0,len(lines[0:]),2): header = lines[row] header = header[:len(header)-1].split(',') ...
UsamaA99/Krus-Prim
primsAlgo.py
primsAlgo.py
py
3,164
python
en
code
0
github-code
36
31804715629
# /usr/bin/python3.6 # -*- coding:utf-8 -*- class Solution(object): def compress(self, chars): """ :type chars: List[str] :rtype: int """ length = len(chars) if length <= 1: return length last = 0 old = chars[0] i = 1 whil...
bobcaoge/my-code
python/leetcode_bak/443_String_Compression.py
443_String_Compression.py
py
1,443
python
en
code
0
github-code
36
12323060348
def bubbleSort(arr): n = len(arr) # Traverse through all array elements for i in range(n): # Last i elements are already in place for j in range(0, n-i-1): # traverse the array from 0 to n-i-1 # Swap if the element found is greater # than the next el...
bitprj/curriculum
Data-Structures-and-Algos-Topic/Module2-Intermediate-Data-Structures/Lab7_Zoologist/Student Starter/Checkpoint/checkpoint3_ans.py
checkpoint3_ans.py
py
1,569
python
en
code
52
github-code
36
17455031519
#!/usr/bin/env python # # Author: Greg Hellings - <ghelling@redhat.com> or <greg.hellings@gmail.com> # # Module to configure users in Jenkins authorized to use CLI import xml.etree.ElementTree as ET import os from ansible.module_utils.basic import AnsibleModule DOCUMENTATION = """ --- version_added: "2.1" module: jen...
devroles/ansible_collection_system
plugins/modules/jenkins_cli_user.py
jenkins_cli_user.py
py
3,843
python
en
code
3
github-code
36
22247301648
import sys import numpy as np import matplotlib.pyplot as plt fname = sys.argv[1] # get filename from argument samples = [] for s in sys.argv[2:len(sys.argv)]: samples.append(s) data = open(fname, "r") # Open file from BMG (export as table) and store in a list file_stored = [] for i in data: file_stored.appen...
Brad0440/BioTools
BMG_Plot.py
BMG_Plot.py
py
2,496
python
en
code
0
github-code
36
11311047474
#!/usr/bin/env python import npyscreen import curses class ActionControllerSearch(npyscreen.ActionControllerSimple): def create(self): self.add_action('^/.*', self.set_search, True) def set_search(self, command_line, widget_proxy, live): self.parent.value.set_filter(command_line[1:]) ...
npcole/npyscreen
EXAMPLE-muttactivetraditional.py
EXAMPLE-muttactivetraditional.py
py
878
python
en
code
436
github-code
36