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
39260413778
# import system modules import traceback import os import sys import errno import subprocess import time import signal import functools # import I/O modules import RPi.GPIO as GPIO import smbus2 import spidev # import utility modules import math import numpy as np import scipy.constants as const from dataclasses import...
ExplodingONC/Flash_LiDAR_Microscan
LidarControl.py
LidarControl.py
py
10,164
python
en
code
0
github-code
36
2820524990
from django.contrib import admin from .models import CalendarEvent, CalendarEventAttendee, UserCalendar class CalendarEventAttendeeInline(admin.TabularInline): model = CalendarEventAttendee extra = 0 autocomplete_fields = ( 'user', ) class UserCalendarInline(admin.TabularInline): model...
rimvydaszilinskas/organize-it
apps/calendars/admin.py
admin.py
py
584
python
en
code
0
github-code
36
28299895707
from train import get_model from torchvision import transforms from PIL import Image import matplotlib.pyplot as plt import torch import os from torchvision.models import resnet18, ResNet18_Weights import torch.nn as nn import numpy as np class Make_Test(nn.Module): def __init__(self, weight_path): super(...
kienptitit/Dog_Cat_Classification
image_test.py
image_test.py
py
1,821
python
en
code
0
github-code
36
1243604019
from math import cos, pi, sin import pygame as pg from constants import consts as c from id_mapping import id_map from images import img as i from ui.game_ui import ui def move_player(keys_pressed): if keys_pressed[pg.K_UP] or keys_pressed[pg.K_w]: c.player_y -= c.player_speed * c.dt if c.player_...
chanrt/py-factory
utils.py
utils.py
py
5,214
python
en
code
11
github-code
36
33517643066
from manimlib.imports import * #Visualización de Gráficas (Va después de Gráficas) def Range(in_val,end_val,step=1): return list(np.arange(in_val,end_val+step,step)) ### VISUALIZACIÓN DE GRÁFICAS (DIVIDO EN 3 CLASES, PERO ES UN SÓLO VIDEO) ### #EJEMPLO 1 R -> R# class Visualización_Gráficas_1(GraphScene,Scen...
animathica/calcanim
Límite y continuidad en funciones multivariable/visualizacion.py
visualizacion.py
py
28,718
python
es
code
19
github-code
36
36351466606
from flask import Blueprint, render_template, request import logging import functions loader_blueprint = Blueprint('loader_blueprint', __name__, template_folder="templates") logging.basicConfig(filename="basic.log") @loader_blueprint.route("/post") def post_page(): return render_template("post_form.html") @load...
PetrGurev/Lesson_121_homework
loader/views.py
views.py
py
1,229
python
en
code
0
github-code
36
37421002377
#coding:utf-8 #用户输入摄氏温度 #接收用户输入 celsius = float(input("输入摄氏温度:")) #计算华氏温度 fahrenheit = (celsius*1.8) +32 print("%0.1f 摄氏温度转为华氏温度为%0.1f"%(celsius,fahrenheit)) """ #coding:utf-8 fahrenheit = float(input("输入华氏温度:")) celsius = (fahrenheit - 32)/1.8 print("%0.1f华氏温度转为摄氏温度为%0.1f" %(fahrenheit,celsius)) ...
kanbujiandefengjing/python
python实例/℃to℉.py
℃to℉.py
py
437
python
zh
code
0
github-code
36
30740067431
#!/usr/bin/env python # -*- coding: utf-8 -*- import random class Lotery: """ this class is representing the process""" def __init__(self): self.ret__M = 0 self.res__M = 0 self.esp__M = 0 #retorno = step(process executou) - step(process exc = 0) def work(self, process): step = 0 inc = 0 ret = 0.0 res...
VictorCampelo/Operating-System-Algorithms
Process Sheduling/lotery.py
lotery.py
py
1,541
python
en
code
0
github-code
36
13168287871
import numpy as np import matplotlib from matplotlib import pyplot as plt plt.switch_backend('agg') import matplotlib.patches from scipy import stats import pandas as pd import math from mpi4py import MPI import sys import itertools import glob import os plt.ioff() design = str(sys.argv[1]) all_IDs = ['3600687', '70...
antonia-had/rival_framings_demand
output_analysis/shortage_duration_curves.py
shortage_duration_curves.py
py
5,340
python
en
code
0
github-code
36
34709810555
import random from scipy import linalg import numpy as np import scipy class Hill: def find_multiplicative_inverse(self, determinant, len_alfabeto): print(f"DETERMINANTE: {determinant}") for i in range(len_alfabeto): inverse = determinant * i if int(round(inverse % len_alfab...
andersoney/andersoney
criptografia/hills/hills.py
hills.py
py
6,232
python
pt
code
0
github-code
36
40306775358
import numpy as np import pandas as pd from collections import OrderedDict import matplotlib as mlt import matplotlib.pyplot as plt from scipy import optimize def get_data(): data = OrderedDict( amount_spent = [50, 10, 20, 5, 65, 70, 80, 81, 1], send_discount = [0, 1, 1, 1, 0, 0, 0, ...
guruprasaad123/ml_for_life
from_scratch/logistic_regression/Newtons method/optimize.py
optimize.py
py
2,692
python
en
code
4
github-code
36
1763129188
""" Implements a mixin for remote communication. """ import re import json import socket whitespace_re = re.compile(r"\s+") class RemoteActor: ENCODING = "utf-8" DECODER = json.JSONDecoder() def __init__(self, socket): """ Creates a new remote actor able to send and receive from the given s...
lukasberger/evolution-game
evolution/common/remote_actor_2.py
remote_actor_2.py
py
2,413
python
en
code
0
github-code
36
432875678
import numpy as np from torch.utils import data import torch as t import matplotlib.pyplot as plt import h5py from .utils.utils import mat2gray_nocrop, plot_img_with_labels import os import random import ipdb from .visualize_predictions import draw_label_img from scipy.ndimage import gaussian_filter import monai def ...
SalamanderXing/dna_foci_detection
dna_foci_detection/data_loaders/foci/dataset.py
dataset.py
py
4,646
python
en
code
0
github-code
36
25418445648
#!/usr/bin/env python from utils.analysis import AbsMovingAvg, Threshold, Derivative from utils.chaser import Chaser import os import sys parentDir = os.path.dirname(os.getcwd()) sys.path.append(parentDir) def checkImport(lib): if not os.path.exists(os.path.join(parentDir, lib)): print("%s library not fou...
andrewbooker/audiotomidi
scanWavFile.py
scanWavFile.py
py
1,495
python
en
code
1
github-code
36
28515039147
# 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.logger import logger from opus_core.resources import Resources from opus_core.storage_factory import StorageFactory from numpy import ...
psrc/urbansim
opus_matsim/archive/tests/generate_test_data.py
generate_test_data.py
py
3,310
python
en
code
4
github-code
36
20871041067
import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches import logic UI_BOARD_SIZE = (8, 6) UI_BOARD_OFFSET = 0.25 UI_BOARD_CELL_COLORS = [(0,0,0,0.4), (0,0.9,1,0.7)] ''' UI front-end implementation ''' class Board: def __init__(self): # Create figure and axes sel...
manu-ho/game_of_life
board.py
board.py
py
5,007
python
en
code
0
github-code
36
72170355625
import pandas as pd import pickle from pathlib import Path def preprocess_test_df(test_clin_df, test_prot_df, test_pep_df, save_data=False): if 'upd23b_clinical_state_on_medication' in test_clin_df.columns: # drop the medication column test_clin_df = test_clin_df.drop(columns=['upd23b_clini...
dagartga/Boosted-Models-for-Parkinsons-Prediction
src/data/pred_pipeline.py
pred_pipeline.py
py
2,509
python
en
code
0
github-code
36
26255667961
""" Here I will read access tokens from txt file for safety """ import json class Token: def __init__(self): with open('tokens.json', 'r') as f: data = json.loads(f.readline()) self.community = data['comm_token'] self.user = data['usr_token'] self.comm_id = -167621445 ...
maxikfu/community
auth.py
auth.py
py
393
python
en
code
0
github-code
36
86340516810
from openpyxl import load_workbook # from openpyxl.cell import Cell if __name__ == '__main__': wb = load_workbook('data/FINODAYS_Доп. материал для Почта Банк_Диалоги.xlsx') for sn in wb.sheetnames: print(sn) marks = [] for row in wb[sn]: if row[1].value == 'CLIENT': ...
eivankin/finodays-2nd-stage
get_user_messages.py
get_user_messages.py
py
546
python
en
code
0
github-code
36
40689449383
with open("2021\Day_14\input.txt") as f: template = f.readline().strip() elements = {e.split()[0]:e.split()[-1] for e in f.read().splitlines() if e != ""} # # Example data # template = "NNCB" # elements = { # "CH": "B", # "HH": "N", # "CB": "H", # "NH": "C", # "HB": "C", # "HC": "B", #...
furbank/AdventOf
2021/Day_14/part1.py
part1.py
py
823
python
en
code
0
github-code
36
5538635649
# drawing the Earth on equirectangular projection import matplotlib.pyplot as plt import cartopy.crs as ccrs import cartopy.feature as cfeature import numpy import matplotlib.ticker as mticker fig = plt.figure(figsize=(64,32), frameon=False) ax = fig.add_subplot(1,1,1, projection=ccrs.PlateCarree(central_longitude=18...
shuyo/xr
earth.py
earth.py
py
1,349
python
en
code
0
github-code
36
31063851875
from ..utils import Object class MessageReplyInfo(Object): """ Contains information about replies to a message Attributes: ID (:obj:`str`): ``MessageReplyInfo`` Args: reply_count (:obj:`int`): Number of times the message was directly or indirectly replied recent...
iTeam-co/pytglib
pytglib/api/types/message_reply_info.py
message_reply_info.py
py
2,077
python
en
code
20
github-code
36
31352733665
# Import all the modules to determine the cofusion matrix import itertools import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import confusion_matrix import os # This function calculates the confusion matrix and visualizes it def plot_confusion_matrix(y_test, y_pred, file_path, ...
martinferianc/PatternRecognition-EIE4
Coursework 2/post_process.py
post_process.py
py
1,935
python
en
code
1
github-code
36
4313052823
import torch from gms_loss import * from PIL import Image from torchvision import transforms from gms_loss import MSGMS_Loss image_path_1= './lj_test_image/1118_visdon_HR_downsampling_2loss_visstyle/0_SR_x_1105_4.png' image_path_2 = './lj_test_image/1116_tcl_bright/6_SR_x_1105_4.png' img_ycbcr_1 = Image.open(image_pa...
JOY2020-Mh/SR_2.0
gsmd_LOSS/image_calculate_gmsd.py
image_calculate_gmsd.py
py
795
python
en
code
0
github-code
36
20219614528
# match close atoms in two moleculas by maximum weighted bipartite matching import numpy as np import logging # weights - numpy 2-dimensional array def wbm(weights): import pulp pulp.LpSolverDefault.msg = False prob = pulp.LpProblem("WBM_Problem", pulp.LpMinimize) m,n = weights.shape # ...
gudasergey/pyFitIt
pyfitit/wbm.py
wbm.py
py
2,829
python
en
code
28
github-code
36
70744489704
import fileinput import glob import os import random import time import re from urllib.error import HTTPError from arghandler import ArgumentHandler, subcmd from google import search from subprocess import call from procurer import ultimate_guitar, lastfm, postulate_url from rules import rules, clean from songbook...
arpheno/songbook
main.py
main.py
py
4,443
python
en
code
0
github-code
36
10302743850
import pandas as pd import numpy as np f = open("u.user", 'r') d = f.readlines() f.close() n = np.array(d) user_index = ["user id", "age", "gender", "occupation", "zip_code"] user = np.char.strip(n) user = np.char.split(user, '|', 4) user_df = pd.DataFrame(list(user), columns=user_index) user_df["user id"] = user_df["...
MyuB/OpenSW_Exercise
hw_02/ml-100k/temp.py
temp.py
py
2,716
python
en
code
0
github-code
36
19924785078
input_value = { 'hired': { 'be': { 'to': { 'deserve': 'I' } } } } def reverse_nested_dict(input_value) : for first, second_layer in input_value.items(): for second, third_layer in second_layer.items(): for third, forth_layer in third_layer.items(): ...
LiviaChen/my_codes_record
Interview question for Python 3/Interview question for Python 3.py
Interview question for Python 3.py
py
745
python
en
code
0
github-code
36
30600682231
from django.dispatch import receiver from django.db.models.signals import post_save from expensense.models import Expense, ApprovalConditions from django.utils import timezone @receiver(post_save, sender=Expense) def auto_approve_expense(sender, instance, **kwargs): """ Method to auto approve expense requests """...
praharsh05/ExpenSense
expensense_main/expensense/signals.py
signals.py
py
2,303
python
en
code
0
github-code
36
36955207429
import random, string import wiredtiger, wttest from helper import copy_wiredtiger_home from wtdataset import SimpleDataSet from wtscenario import filter_scenarios, make_scenarios # test_cursor12.py # Test cursor modify call class test_cursor12(wttest.WiredTigerTestCase): keyfmt = [ ('recno', dict(keyfm...
mongodb/mongo
src/third_party/wiredtiger/test/suite/test_cursor12.py
test_cursor12.py
py
15,173
python
en
code
24,670
github-code
36
23048227631
#!/usr/bin/env python # coding: utf-8 # # 積み上げ棒グラフを作成する # In[1]: get_ipython().run_line_magic('matplotlib', 'inline') from matplotlib import pyplot as plt import numpy as np #数値は適当 bar1 = [100, 50, 200] #積み上げ棒グラフの一段目 bar2 = [100, 200, 50] #積み上げ棒グラフの二段目 bar3 = [100, 250, 100] #積み上げ棒グラフの三段目 bar3_st = np.add(bar1, b...
workskt/book
_build/jupyter_execute/python_plot_cumulativebar.py
python_plot_cumulativebar.py
py
5,462
python
ja
code
0
github-code
36
1141389329
from werkzeug.security import check_password_hash from db.SedmDb import SedmDB import datetime import os import json import re import pandas as pd import numpy as np import requests import glob import time from decimal import Decimal from bokeh.io import curdoc from bokeh.layouts import row, column from bokeh.models im...
scizen9/sedmpy
web/model.py
model.py
py
117,058
python
en
code
5
github-code
36
21877547543
from TeamCloud_Modul.Blockchain import Transaction import requests import json import os from TeamCloud_Modul.Node import Node from TeamCloud_Modul.json_parser import Message, JSON_Parser, get_checksum from cryptography.hazmat.primitives import serialization from requests.api import request from create_Keys import c...
Marcus11Dev/Blockchain_Lesson_Agent
agent.py
agent.py
py
13,436
python
en
code
0
github-code
36
12212813324
#!/usr/bin/env python ''' This is the parallel recursive solution to the Tower of Hanoi and is copied from the code written in the parallel/rebuilding-the-tower-of-hanoi/ page of www.drdobbs.com. The solution has been modified from drdobbs' solution to work with my limited knowledge of mpi4py. If you use the sleep() f...
icluster/demos
hanoi/src/hanoi_soln_par.py
hanoi_soln_par.py
py
4,912
python
en
code
0
github-code
36
30075701833
# This file contains several global settings used across the rest of the scripts in the style # of a `startup.m` file in Matlab. I quite like this format, so I'll use it here as well :) # This is the location of the data on my computer # The data takes up about 24GB, so I store it on an # external hard drive # This is...
Jfeatherstone/FailurePrediction
geogran_old/toolbox/Settings.py
Settings.py
py
629
python
en
code
0
github-code
36
18896618824
from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^johnjot/', include('johnjot.foo.urls')), (r'^api/', include('core.api.urls')), (r'^admin/', include(admin.site.u...
maraca/JohnJot
core/urls.py
urls.py
py
329
python
en
code
4
github-code
36
20707090879
import os, time from Crypto.Random import get_random_bytes, random from lib.logger import * log = Logger() ''' This class handles the BLE Beacon Transmission (TX). Because after some time of BLE advertising, a restart of the BLE stack (hciconfig hci0 down / up) might be required, and because the pybleno class can't be...
mh-/exposure-notification-ble-python
lib/en_tx_service.py
en_tx_service.py
py
2,883
python
en
code
28
github-code
36
71511379944
import math import random import collections import Artist import os LINE_LENGTH_MIN = 8 LINE_LENGTH_MAX = 12 EPSILON = 0.20 UNIGRAM_WEIGHT = 1 BIGRAM_WEIGHT = 10 TRIGRAM_WEIGHT = 100 # Preparatory code: Setting Up All Artists' N-grams # ------------------------------------------------- # Uni/bi/tri-grams from A...
ch-plattner/musical_croding
code/line_generator.py
line_generator.py
py
7,323
python
en
code
3
github-code
36
44255065901
trials = int(input()) input() for trial in range(trials): l = [] for i in range(8): l.append(list(input())) if trial!= trials-1: input() x = 0 y = 0 p = 2 for k in range(1,8): i = l[k] if '#' in i and i.count('#')==1: p = 1 elif '#' in i an...
Ghanashyam-Bhat/CompetitiveProgramming
6-1-2022/3.py
3.py
py
532
python
en
code
1
github-code
36
35397910028
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import glob import os from textwrap import dedent import xml.dom.minidom as DOM import coverage from pants.backend.python.targets.python_library import PythonLibrary...
fakeNetflix/square-repo-pants
tests/python/pants_test/backend/python/test_test_builder.py
test_test_builder.py
py
8,998
python
en
code
0
github-code
36
33759274918
import json import codecs import sys if len(sys.argv) != 3: print('Usage: ' + sys.argv[0] + " <input json path> <output csv path>") exit() infilename = sys.argv[1] outfilename = sys.argv[2] sep = "|" out = open(outfilename, 'w') def processSource(sourceStr): source = sourceStr.lower() listOfAppleDe...
ador/trial
scripts/twitterJsonToCsv.py
twitterJsonToCsv.py
py
4,212
python
en
code
1
github-code
36
35872181243
__author__ = 'Dennis Qiu' from PIL import Image def de_steg(encrypted_file): f, e = encrypted_file.split('.') steg = Image.open(encrypted_file) out = Image.new('RGB', (steg.width,steg.height)) for x in range(steg.width): for y in range(steg.height): r, g, b = steg.getpixel(...
denqiu/Python-ImageProcessing
image_steg.py
image_steg.py
py
1,570
python
en
code
0
github-code
36
73424753064
# -*- coding: utf-8 -*- from __future__ import print_function import os import re import json from importlib import import_module from inspect import stack from traceback import print_exc from urllib.parse import unquote from utils import * from config import * @retry(Exception, cdata='method={}'.format(stack()[0...
belodetek/unzoner-api
src/vpns.py
vpns.py
py
16,340
python
en
code
3
github-code
36
72738108584
#!/bin/python3 import os import sys import pathlib from amp_database import download_DRAMP def check_samplelist(samplelist, tools, path): if(samplelist==[]): print('<--sample-list> was not given, sample names will be inferred from directory names') for dirpath, subdirs, files in os.walk(path): ...
Darcy220606/AMPcombi
ampcombi/check_input.py
check_input.py
py
5,496
python
en
code
4
github-code
36
875238035
class Grade: def __init__(self, topic, mark, student_name): self.topic = topic self.mark = mark self.student_name = student_name def print_info(self): print("Topic", self.topic) print("Grade", self.mark) print("Student", self.student_name) return self ...
jwaine44/ClassLecture
Student.py
Student.py
py
3,202
python
en
code
0
github-code
36
4810054439
from __future__ import (absolute_import, division, print_function, unicode_literals) import pygame from .shape import Shape from .arrow import Arrow from .line import Line from .label import Label class Pointer(Shape): def __init__(self, element, text, direction="ul.middle", ...
JoaoFelipe/Data-Structures-Drawer
ds_drawer/shapes/pointer.py
pointer.py
py
1,056
python
en
code
0
github-code
36
28552898211
#-*-coding:utf-8-*- import argparse import pyspark from pyspark.sql.types import IntegerType from pyspark.sql.functions import * from generic_utils import execute_compute_stats def extract_tbau_documento(spark): columns = [ col("DOCU_DK").alias("DOAT_DOCU_DK"), col("DOCU_NR_EXTERNO").alias("DOAT_DOCU_NR_EXTE...
rhenanbartels/scripts-bda
extract_tbau/src/extractor.py
extractor.py
py
25,402
python
pt
code
0
github-code
36
41165253893
# -*- coding: utf-8 -*- ''' This file is part of Habitam. Habitam is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Habitam is distr...
habitam/habitam-core
habitam/ui/forms/fund.py
fund.py
py
3,821
python
en
code
1
github-code
36
12366447292
import glob import os import shutil import tempfile import unittest from ample import constants from ample.testing import test_funcs from ample.util import ample_util, spicker @unittest.skip("unreliable test cases") @unittest.skipUnless(test_funcs.found_exe("spicker" + ample_util.EXE_EXT), "spicker exec missing") cl...
rigdenlab/ample
ample/util/tests/test_spicker.py
test_spicker.py
py
2,160
python
en
code
6
github-code
36
1252911352
class SmallestStringStartingFromLeaf(object): def smallestFromLeaf(self, root): self.ans = "~" def dfs(node, A): if node: A.append(chr(node.val + ord('a'))) if not node.left and not node.right: self.ans = min(self.ans, "".join(reversed...
lyk4411/untitled
beginPython/leetcode/SmallestStringStartingFromLeaf.py
SmallestStringStartingFromLeaf.py
py
1,227
python
en
code
0
github-code
36
8342129346
from django.http import request from django.http.response import HttpResponse from django.shortcuts import redirect, render from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required from core.models import Medico, Hora, Cita, Paciente from core.forms import Pa...
felipe-quirozlara/arquit-proyect
arquitGalenos/pages/views.py
views.py
py
7,814
python
en
code
0
github-code
36
3903968215
#!/usr/bin/env python from __future__ import with_statement import logging import logging.handlers LOG_FILE_HDL = '/tmp/logging_example.out' mylogger = logging.getLogger("MyLogger") mylogger.setLevel(logging.DEBUG) ch_handler = logging.StreamHandler() ch_handler.setLevel(logging.DEBUG+1) mylogger.addHandler(ch_han...
bondgeek/pythonhacks
recipes/logger_example.py
logger_example.py
py
756
python
en
code
3
github-code
36
11612639350
# -*- coding:utf-8 -*- # ========================================== # author: ZiChen # mail: 1538185121@qq.com # time: 2021/05/03 # 歌词下载脚本 # ========================================== # 请求及数据处理库 import re from urllib import request import json import traceback import os # 本...
Zichen3317/demo18-lyricsDownloader
fc_lyricsDownloader.py
fc_lyricsDownloader.py
py
17,698
python
en
code
0
github-code
36
25607520371
class Solution: def minDistance(self, word1: str, word2: str) -> int: r, c = len(word1), len(word2) dp=[[0]*(c+1) for i in range(r+1)] for i in range(1,r+1): for j in range(1,c+1): if word1[i-1] == word2[j-1]: dp[i][j] = 1 + dp[i-1][...
Nirmalkumarvs/programs
Dynamic programming/Delete Operation for Two Strings.py
Delete Operation for Two Strings.py
py
468
python
en
code
0
github-code
36
39400543792
import numpy as np; import cv2; #load image from file #cv2.imwrite('imageName.png', img); rgb_red_pos = 2; rgb_blue_pos = 0; rgb_green_pos = 1; img_1 = cv2.imread('red1.png',1); ##img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY); ##extract the red component image 1 red_only1 = np.int16( np.matrix(img_1[:,:,rgb_red_pos]))...
botchway44/computer-Vision
image diffrencing.py
image diffrencing.py
py
2,160
python
en
code
0
github-code
36
15019927918
# This is a sample Python script. import pandas as pd import csv from datetime import datetime import json import paho.mqtt.client as mqtt from itertools import count import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation # Press Mayús+F10 to execute it or replace it with your code. # Press Dou...
JordiLazo/embedded_and_ubiquitous_systems_103056
ReceiverMQTT/main.py
main.py
py
1,463
python
en
code
0
github-code
36
31064957465
from ..utils import Object class ThemeParameters(Object): """ Contains parameters of the application theme Attributes: ID (:obj:`str`): ``ThemeParameters`` Args: background_color (:obj:`int`): A color of the background in the RGB24 format secondary_background_...
iTeam-co/pytglib
pytglib/api/types/theme_parameters.py
theme_parameters.py
py
2,062
python
en
code
20
github-code
36
38264973809
import importlib from copy import deepcopy from os import path as osp from collections import OrderedDict from pyiqa.utils import get_root_logger, scandir from pyiqa.utils.registry import ARCH_REGISTRY from pyiqa.default_model_configs import DEFAULT_CONFIGS __all__ = ['build_network', 'create_metric'] # automatical...
Sskun04085/IQA_PyTorch
pyiqa/archs/__init__.py
__init__.py
py
1,637
python
en
code
0
github-code
36
25084775362
# This Golf class will be responsible for scraping the latest # Trump golf outing located on trumpgolfcount.com from bs4 import BeautifulSoup import requests import json import twitter import lxml import pyrebase def main(): get_latest_outing() def push_db(data): # db.child("time").push(data) db.child("t...
navonf/isTrumpGolfing
Golf.py
Golf.py
py
2,033
python
en
code
0
github-code
36
33540666683
"""HTTP Archive dataflow pipeline for generating HAR data on BigQuery.""" from __future__ import absolute_import import json import logging from copy import deepcopy from hashlib import sha256 import apache_beam as beam from modules import utils, constants, transformation # BigQuery can handle rows up to 100 MB. M...
HTTPArchive/data-pipeline
modules/non_summary_pipeline.py
non_summary_pipeline.py
py
17,297
python
en
code
3
github-code
36
5259209115
# import libraries import datetime from airflow import DAG from airflow.contrib.operators.emr_create_job_flow_operator import EmrCreateJobFlowOperator from airflow.contrib.operators.emr_add_steps_operator import EmrAddStepsOperator from airflow.contrib.sensors.emr_step_sensor import EmrStepSensor from airflow.contrib.o...
stefanjaro/data-engineering-nanodegree-capstone-project
airflow/dags/prepare-data-for-redshift.py
prepare-data-for-redshift.py
py
8,900
python
en
code
0
github-code
36
71252887144
from datetime import datetime import glob import os import time import anim import threading print(datetime.timestamp(datetime.now())) class User: def __init__(self, name: str): self.name = name class Chat: def __init__(self, username: str, text: str, score: int = 0): self.author = User(usern...
ij5/ace-ainize
app.py
app.py
py
1,475
python
en
code
0
github-code
36
13186345837
def selection_sort(nums) : size = len(nums) for i in range(0 , size-1): min_pos = i for j in range (i+1 , size): if nums[j] < nums[min_pos] : min_pos = j if min_pos != i: nums[i] , nums[min_pos] = nums[min_pos] , nums[i] return nums sortValu...
Dulal-12/sortinga-Algorithm
sle.py
sle.py
py
372
python
en
code
0
github-code
36
11798416126
from math import log10 def calculate(balance, apr, payment): x = -0.33 apr = apr/100 w = 1-((1+(apr/365))**30) z = log10((1 + ((balance/payment)*w))) y = log10(1 + apr) months = divmod(((x * (z//y)) * 365), 12) return int(months[0]) balance = int(input("What is your balance? ")) apr = int...
matryosh/Programming-Exercises
python/Chapter_5/months-to-payoff-credit.py
months-to-payoff-credit.py
py
543
python
en
code
0
github-code
36
6241263490
def btr(depth): global max_num num = int(''.join(nums)) if num in num_set: return else: num_set.add(num) if depth == n: num = int() if max_num < max(num_set): max_num = max(num_set) return for i in range(size): for j in range(i+1, si...
daehyun1023/Algorithm
python/swea/swea1244.py
swea1244.py
py
725
python
en
code
0
github-code
36
8368222279
from itertools import groupby def checkgroup(word): group = [key for key, item in groupby(word)] values =[(k, [i for i in range(len(word)) if word[i] == k]) for k in group] groupword = 0 for items in values: if items[1].__len__() == 0: groupword += 1 continue ...
hyelimchoi1223/Algorithm-Study
백준/[백준]1316 그룹 단어 체커/python.py
python.py
py
789
python
en
code
1
github-code
36
34545951895
'Chat room client' import threading import socket class chatRoomClient: ALIAS = "johnDoe" client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server = "127.0.0.1" port = 6969 encoding = "utf-8" def __init__(self, ip="127.0.0.1", port=6967): self.ALIAS = input("Choose an alias ...
MrMetrik/chatRoom
client/client2.py
client2.py
py
1,308
python
en
code
0
github-code
36
15775777498
from enum import Enum from dataclasses import dataclass class TokenType(Enum): NUMBER = 0 PLUS = 1 MINUS = 2 ASTERISK = 3 SLASH = 4 LPAR = 5 RPAR = 6 @dataclass class Token: type: TokenType value: str def __repr__(self) -> str: return f"({self.type.name}, '{self.valu...
ricdip/py-math-interpreter
src/model/token.py
token.py
py
326
python
en
code
0
github-code
36
42498915540
from sequ_error import * # Converts an integer to a roman numeral def int_to_roman(input): try: if type(input) != type(1): raise FormatError("expected integer, got %s" % type(input)) if not 0 < input < 4000: raise FormatError("argument must be between 1 and 3999") except...
razanur37/sequ.py
sequ_roman.py
sequ_roman.py
py
2,135
python
en
code
1
github-code
36
31371160161
# 4- Напишите программу, которая будет преобразовывать десятичное число в двоичное. # Подумайте, как это можно решить с помощью рекурсии. # Пример: # 45 -> 101101 # 3 -> 11 # 2 -> 10 from function import CheckInputIntNumbers def binar_sys (number:int,list:list) -> int: """ Преобразовывает десятичное число...
AlexandrFeldsherov/lessonTreeSeminar
task004.py
task004.py
py
906
python
ru
code
0
github-code
36
18394317715
import sys import numpy as np import tiledb # Name of the array to create. array_name = "reading_dense_layouts" def create_array(): # The array will be 4x4 with dimensions "rows" and "cols", with domain [1,4]. dom = tiledb.Domain( tiledb.Dim(name="rows", domain=(1, 4), tile=2, dtype=np.int32), ...
TileDB-Inc/TileDB-Py
examples/reading_dense_layouts.py
reading_dense_layouts.py
py
2,729
python
en
code
165
github-code
36
37453777335
from .textbox import Textbox from engine.device import Device from engine.action import Action from typing import List from .clickable import BLUE, RED from numpy.random import randn as random from engine.player import Player from user_interface.show_money_textbox import Money_Textbox BACKSPACE: int = 8 ENTER: int = 13...
talacounts/game_of_life
user_interface/game_textbox.py
game_textbox.py
py
1,425
python
en
code
0
github-code
36
9169632462
# coding=utf-8 import os import sys import platform import subprocess import shutil Python = "python" if platform.system() == "Windows" else "python3" def executCommand(command): out = open(os.devnull, 'w') err = subprocess.STDOUT return subprocess.call(command, shell=True, stdout=out, stderr=err) def...
Thenecromance/TMake
python/TLoader.py
TLoader.py
py
1,073
python
en
code
0
github-code
36
32417088655
import json from typing import Dict from influxdb_client import InfluxDBClient, Point, WritePrecision from influxdb_client.client.write_api import SYNCHRONOUS import pandas as pd import logging class InfluxDB: def __init__(self, local) -> None: # Create a config.json file and store your INFLUX token as a k...
pattty847/Crypto-Market-Watch
app/api/influx.py
influx.py
py
3,453
python
en
code
2
github-code
36
74087426982
import requests, datetime, csv from flask import Flask from flask import request, render_template response = requests.get("http://api.nbp.pl/api/exchangerates/tables/C?format=json") data_as_json= response.json() app = Flask(__name__) for item in data_as_json: only_rates = item.get('rates') current_date = ite...
gorkamarlena/currency_calculator
app.py
app.py
py
1,803
python
en
code
0
github-code
36
34981855639
from flask import Flask, request, render_template from googlesearch import search app = Flask(__name__) def search_pdfs(query, num_results=5): search_results = [] try: for j in search(query + " filetype:pdf", num_results=num_results): search_results.append(j) return search_results...
suryagowda/booksearcherr
booksearcher/app.py
app.py
py
764
python
en
code
0
github-code
36
32072082706
from flask import Flask, request, jsonify from sklearn.ensemble import GradientBoostingRegressor import pickle import matplotlib import joblib import pandas as pd from sklearn.preprocessing import LabelEncoder from load_data import ( get_binance_dataframe, get_bingx_dataframe, get_bitget_dataframe, get_...
PhatcharaNarinrat/adamas-arbitrage
prediction.py
prediction.py
py
2,279
python
en
code
0
github-code
36
20857572237
#https://leetcode.com/problems/pascals-triangle-ii/ class Solution: def getRow(self, rowIndex: int) -> List[int]: lis=[[1]] print(lis) for x in range(1,rowIndex+1): temp=lis[x-1] #we have temp temp.insert(0,0) temp.append(0) ...
manu-karenite/Problem-Solving
DP/pascalsTriangle.py
pascalsTriangle.py
py
482
python
en
code
0
github-code
36
44599845798
class Node: def __init__(self, data= None, next_node= None): self.data = data self.next_node = next_node class LinkedList: def __init__(self): self.head = None self.last_node= None def print_ll(self): ll_string = "" node = self.head if node is None:...
ada-nai/fcc-ds-flask
linked_list.py
linked_list.py
py
2,052
python
en
code
0
github-code
36
27335304681
#!/usr/bin/python3 from Random import * import turtle import numpy import random import math r = Random(517 ,0 ,8999) scale = 10 def reset(x,y): root = turtle.getscreen()._root turtle.clear() root.withdraw() root.quit() def getDirection(): return r.random()%4 def draw(x, y): reset(None, No...
PapyRedstone/SimulationSystemesTP2
main.py
main.py
py
4,702
python
en
code
0
github-code
36
73335571623
import unittest from pathlib import Path from tempfile import TemporaryDirectory import pytest from tpk.hypervalidation.hyperparameter_search import ( run_model_cmd_parallel, run_study, ) from tpk.torch import TSMixerModel @pytest.mark.asyncio async def test_num_workers() -> None: results = await run_mo...
airtai/temporal-data-kit
tests/hypervalidation/test_hyperparameter_search.py
test_hyperparameter_search.py
py
1,039
python
en
code
2
github-code
36
19475555146
from django.shortcuts import render from django.contrib.auth.decorators import login_required from django.shortcuts import render, HttpResponse, redirect, get_object_or_404 from django.core.paginator import Paginator from django.contrib.auth import authenticate, login, logout from django.contrib import messages from dj...
Asif-Biswas/instagram-clone
instagram2/views.py
views.py
py
24,038
python
en
code
1
github-code
36
72791854185
""" Tags: Arrays Pattern: Two-pointers Notes: We're making use of the two-pointer pattern and overwriting (swapping). - We use two pointers to swap the zeros with non-zero numbers, hence gradually pushing the zeros towards the end of the array. - The right pointer traverses the array without stopping, when it gets t...
cs50victor/dsa
leetcode/283-move-zeroes.py
283-move-zeroes.py
py
1,045
python
en
code
0
github-code
36
21135616107
import subprocess, os, urllib, platform def get_value(input_data, key, default=False): """ Lấy giá trị key trong input_data. Nếu không có thì sẽ trả về: - False nếu không có default - default nếu có default """ try: return input_data[key] except: return def...
nguyenxuanhoa493/LMS
API/until.py
until.py
py
1,775
python
vi
code
0
github-code
36
70323989225
#Menggambar graf dengan 8 nodes import matplotlib import networkx as nx import itertools G = nx.Graph() #Menambah node L = ['a','b','c','d','e','f','g','h'] G.add_nodes_from(L) ''' Kak ini kenapa nodesnya selalu kerandom ya? :( ''' #Menambah edge pairs = itertools.combinations(L,2) edges = list() ...
dionesiusap/matplotlib-networkx-example
graph.py
graph.py
py
515
python
en
code
0
github-code
36
24593161716
def summ(x, y): result = (x+y) return result # a = summ(15, 33) # print(a) def revers(lstr): revl = [] for element in lstr: element = element[::-1] revl.append(element) return revl # b = revers(["i want to become a python developer", "it will be hard", "i am learning"]) # prin...
MikitaTsiarentsyeu/Md-PT1-69-23
Tasks/Stansky/Task5/Task 5.py
Task 5.py
py
1,708
python
en
code
0
github-code
36
23210851418
from config import Config import requests, json from app.models import news_article, news_source MOVIE_API_KEY = Config.API_KEY News_Article = news_article.Article News_Source = news_source.Source def configure_request(app): global api_key api_key = app.config['API_KEY'] def get_news(): request = reque...
Joshua-Barawa/news-app
app/requests.py
requests.py
py
1,570
python
en
code
1
github-code
36
36613114839
import os import enum # Folder projet interphone LOG_DIR = "src_backend/Repport/" # Information des trace d'erreur ERROR_TRACE_FILE_PATH = os.path.join(LOG_DIR, 'Error.trace') # Information des logs pour des log général LOG_FILENAME = "APP_Window.log" #Structure du code LOG_FORMAT = "%(asctime)s [%(lev...
ClemGRob/InterPhoneVisiaScan
src_backend/constants_log.py
constants_log.py
py
745
python
fr
code
0
github-code
36
70891405863
from flask import Flask, render_template, request from transformers import VisionEncoderDecoderModel, ViTFeatureExtractor, AutoTokenizer import torch from PIL import Image import io import base64 app = Flask(__name__) model = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning") feature_ex...
AtchayaPraba/Listed-Inc-image-captioning
app.py
app.py
py
2,759
python
en
code
0
github-code
36
12315568695
import sys import time import numpy as np from numpy import matlib from Functions import constants from Functions.FDTD_Core_Ez import FDTD_Core_Ez from Functions.FDTD_Core_H import FDTD_Core_H np.set_printoptions(threshold=sys.maxsize) def FDTD_2D(prepared, Debye_model, phantom, antennas_setup, gaussi...
philorfa/FDTD_2D
pythonProject/Functions/FDTD_2D.py
FDTD_2D.py
py
11,969
python
en
code
0
github-code
36
15589484398
import requests from lxml import etree import os '''if __name__=='__main__': try: url='https://pic.netbian.com/4kmeinv/' headers={'user-agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36'} response=requests.get(url=url,h...
BrotherIsHere/pythonProject
7.xpath解析案例-下载图片数据.py
7.xpath解析案例-下载图片数据.py
py
1,746
python
en
code
0
github-code
36
73739222823
# Milestone Project 2 - Blackjack Game """ In this milestone project you will be creating a Complete BlackJack Card Game in Python. Here are the requirements: You need to create a simple text-based BlackJack game The game needs to have one player versus an automated dealer. The player can stand or hit. The p...
TomasMantero/Milestone-Project-2-Blackjack-Game
milestone_project2_blackjack_game.py
milestone_project2_blackjack_game.py
py
11,595
python
en
code
0
github-code
36
25023256
import sys input = sys.stdin.readline def find(n): if n != city[n]: city[n] = find(city[n]) return city[n] return n def union(a, b): parent = find(a) child = find(b) if parent>child: parent, child = child, parent if parent != child: city[child] = parent n = int(inpu...
kmgyu/baekJoonPractice
Graph/분리 집합/여행 가자.py
여행 가자.py
py
683
python
en
code
0
github-code
36
73498685865
class BankAccount: def __init__(self, int_rate=0.01, checking_balance=0, savings_balance=0): self.interest_rate = int_rate self.account_balance_checking = checking_balance self.account_balance_savings = savings_balance def deposit(self, acct_type, amount): if acct_type =...
carlamiles/users_with_bank_accounts.py
users_with_bank_accounts.py
users_with_bank_accounts.py
py
3,951
python
en
code
0
github-code
36
28231150156
#!/usr/bin/env python # -*- coding: utf-8 -*- import netCDF4 from utils import * def write_jules_overbank_props_1d(overbank_fn, overbank_maps, grid_dim_name): nco = netCDF4.Dataset(overbank_fn, 'w', format='NETCDF4') mask = LAND_FRAC > 0. nland = mask.sum() for key, value in overbank_maps.items()...
simonmoulds/jamr
src/python/write_jules_overbank_props.py
write_jules_overbank_props.py
py
2,611
python
en
code
0
github-code
36
7813600766
"""add region column for sample Create Date: 2021-04-05 17:09:26.078925 """ import enumtables # noqa: F401 import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "20210405_170924" down_revision = "20210401_211915" branch_labels = None depends_on = None def upgrade(): ...
chanzuckerberg/czgenepi
src/backend/database_migrations/versions/20210405_170924_add_region_column_for_sample.py
20210405_170924_add_region_column_for_sample.py
py
1,818
python
en
code
11
github-code
36
37635298543
""" Reversing a list: Various methods of reversing a list : - by creating another list. - by updating the existing list. """ # Method1: using range function(iterating towards backward) property: #>> does not update the existing list L1 = [1,2,3,4] Reverselist = [] leng = len(L1)-1 for i in range(leng ,...
Anchals24/General-Basic-Programs
Reversing a list.py
Reversing a list.py
py
2,049
python
en
code
7
github-code
36
20968378807
# * 4. Задайте список из произвольных вещественных чисел, количество задаёт пользователь. # Напишите программу, которая найдёт разницу между максимальным # и минимальным значением дробной части элементов. # in # 5 # out # [5.16, 8.62, 6.57, 7.92, 9.22] # Min: 0.16, Max: 0.92. Difference: 0.76 # in # 3 # out # [9.26,...
Nadzeya25/Python_GB
seminar3_Python/home_work3_tester/task3_4.py
task3_4.py
py
1,320
python
ru
code
0
github-code
36
26424981939
#coding: utf-8 # # example 11.4 # import numpy as np from geothermal_md import * from matplotlib.pyplot import * from scipy.optimize import curve_fit # # donnees du probleme # gam = 0.5772157 M = np.loadtxt("..\\data\\pumping_test2.txt") t = M[:,0] # time in minutes sf = M[:,1] # drawndown in meters nt = len(...
LouisLamarche/Fundamentals-of-Geothermal-Heat-Pump-Systems
chapter11/Example11_4.py
Example11_4.py
py
1,363
python
en
code
1
github-code
36
28981485311
from tendrl.commons import flows from tendrl.monitoring_integration.flows.delete_resource_from_graphite import \ graphite_delete_utils class DeleteResourceFromGraphite(flows.BaseFlow): def run(self): super(DeleteResourceFromGraphite, self).run() integration_id = self.parameters.get("TendrlCon...
Tendrl/monitoring-integration
tendrl/monitoring_integration/flows/delete_resource_from_graphite/__init__.py
__init__.py
py
625
python
en
code
4
github-code
36