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
41457270924
import logging from ex_2 import CORRECT_LABEL, INCORRECT_LABEL logger = logging.getLogger(__name__) iterations = 0 total_tp = 0 total_fp = 0 total_tn = 0 total_fn = 0 total_accuracy = 0 total_recall = 0 total_precision = 0 def evaluate(head, correct_prob, incorrect_prob): global tp, fp, tn, fn if correct_...
aserpi-uni/msecs-ml
ex_2/evaluation.py
evaluation.py
py
1,566
python
en
code
1
github-code
90
39875228276
#Napišite funkcijo, ki sprejme nabor podatkov v obliki dictionary-ja data in vrne največjo vrednost vsakega ključa # (vrednosti so v obliki lista). data = {"prices": [41970, 40721, 41197, 41137, 43033], "volume": [49135346712, 50768369805, 47472016405, 34809039137, 38700661463]} def najvecja_vrednost(podatki)...
BlazButara/TP
DN3/Naloga2.py
Naloga2.py
py
508
python
sl
code
0
github-code
90
1420954672
class Car: fuel = "petrol" # class variable def __init__(self): self.milage =10 #instance variable self.company = "ABC" # instance c1 = Car() c2 = Car() c1.milage =8 Car.fuel = "diesel" # need to use class name to modify class variables print(c1.company, c1.milage, c1.fuel) print(c2.company...
AswathiMohan23/Python_Basics
Variables/Class_variables/class_variables.py
class_variables.py
py
339
python
en
code
0
github-code
90
73644873257
#!/usr/bin/python3 import signal import sys import serial import time import datetime from influxdb_client.client.write_api import WriteApi, SYNCHRONOUS from influxdb_client import InfluxDBClient, Point, WritePrecision, WriteOptions import pandas as pd #Open text file where data will be written f = open('/media/rems/R...
ManexOA/UoL_Environmental_Monitoring_IoT
Liverpool_REMS_IoT_2022-11-25/Other Codes/SHT85_SerialRead_influxdb_OSS_OLD_VERSION_.py
SHT85_SerialRead_influxdb_OSS_OLD_VERSION_.py
py
3,143
python
en
code
0
github-code
90
25219911827
import tkinter as tk def aktionSF(): label3 = tk.Label(root, text="Aktion durchgeführt", bg="yellow") label3.pack() def grad_nach_kelvin(): #print(eingabefeld_wert) grad = int(eingabefeld_wert.get()) kelvin = grad + 273 textausgabe = tk.Label(root, text=kelvin, bg="lightblue").pack() root = tk...
Thieberius/python
gui/schaltflächen.py
schaltflächen.py
py
769
python
de
code
0
github-code
90
18434763509
a, b = map(int, input().split()) def f(x): if (x + 1) % 4 == 0: return 0 elif (x + 1) % 4 == 1: return x elif (x + 1) % 4 == 2: return x ^ (x - 1) else: return x ^ (x - 1) ^ (x - 2) print(f(b) ^ f(a - 1))
Aasthaengg/IBMdataset
Python_codes/p03104/s106897872.py
s106897872.py
py
252
python
en
code
0
github-code
90
13090782525
class Solution: def maxLen(self, n, arr): maxLength = 0 currSum = 0 hashMap = {} for i in range(n): currSum += arr[i] if currSum == 0: maxLength = i + 1 elif currSum in hashMap: maxLength = max(maxLength, i - hashMap...
magdumsuraj07/data-structures-algorithms
questions/striever_SDE_sheet/22_largest_subarray_with_0_sum.py
22_largest_subarray_with_0_sum.py
py
412
python
en
code
0
github-code
90
72976832618
from sklearn.model_selection import train_test_split import pandas as pd from datasets.dataset import Dataset from sklearn import preprocessing TRAIN_PATH = 'data/chess/chess.data' n_features = 6 class ChessDataset(Dataset): def __init__(self): self._raw_train_data = pd.read_csv(TRAIN_PATH, names=["...
elisim/Applied-Machine-Learning
assignment3/code/datasets/chess.py
chess.py
py
1,688
python
en
code
3
github-code
90
5098849098
#正規表現モジュール、あのブログ(対応表の方)に書く import re n=int(input()) a=list(map(int,input().split())) change_num=0 flag=True while(flag): flag=False for i in range(n-1): if(a[i] > a[i+1]): a[i],a[i+1] = a[i+1],a[i] change_num+=1 flag=True print(re.sub("[\[\]\,]","",str(a))) print(chan...
WAT36/procon_work
procon_python/src/aoj/ALDS1_2_A_BubbleSort.py
ALDS1_2_A_BubbleSort.py
py
378
python
ja
code
1
github-code
90
32057084907
from django.contrib.auth import authenticate from django.contrib.auth.models import User from rest_framework import status from rest_framework.authtoken.models import Token from rest_framework.permissions import AllowAny, IsAuthenticated from rest_framework.response import Response from rest_framework.viewsets im...
vitorqf/nadic_backend
django/CRM/CRM/api/viewsets.py
viewsets.py
py
3,294
python
en
code
0
github-code
90
18065114469
import math #import numpy as np import queue from collections import deque,defaultdict import heapq as hpq from sys import stdin,setrecursionlimit #from scipy.sparse.csgraph import dijkstra #from scipy.sparse import csr_matrix ipt = stdin.readline setrecursionlimit(10**7) def main(): n = int(ipt()) ans = 0 ...
Aasthaengg/IBMdataset
Python_codes/p04020/s205937157.py
s205937157.py
py
547
python
en
code
0
github-code
90
22824171012
import requests from django.conf import settings def apply_exchange(amount, currency, dic): url = f"https://freecurrencyapi.net/api/v2/latest?apikey={settings.CURRENCY_KEY}&base_currency=EUR" get_res_url = requests.get(url) results = get_res_url.json() rates = results["data"] rate = rates[curren...
pabdelhay/paloptl
common/students/angola_lupossa.py
angola_lupossa.py
py
1,975
python
en
code
0
github-code
90
7321227487
import queue import threading from typing import Any, Callable FINISHED = 'finished' ERROR = 'error' INFO = 'info' class Event: def __init__(self, evt_type: (ERROR, FINISHED, INFO), client_data: Any = None): self.evt_type = evt_type self.client_data = client_data class BgExec(threading.Thread):...
mgeselle/spectra
bgexec.py
bgexec.py
py
730
python
en
code
0
github-code
90
13002612478
def solution(numbers): result = [] n = len(numbers) for i in range(n-1): for j in range(i+1, n): result.append(numbers[i] + numbers[j]) result = sorted(list(set(result))) return result
hyeinkim1305/Algorithm
Programmers/Level1/Programmers_Level1_두 개 뽑아서 더하기.py
Programmers_Level1_두 개 뽑아서 더하기.py
py
226
python
en
code
0
github-code
90
18440027839
N = int(input()) X = [] U = [] for _ in range(N): x, u = input().split() X.append(float(x)) U.append(u) ans = 0 for x, u in zip(X, U): if u == 'JPY': ans += x else: ans += x*380000. print(ans)
Aasthaengg/IBMdataset
Python_codes/p03110/s659892403.py
s659892403.py
py
230
python
en
code
0
github-code
90
17053090580
import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt import numpy as np class DrawCrowd: def __init__(self, personcrowd): self.personcrowd = personcrowd def sort_and_draw(self): crowd_array = self.personcrowd.crowd.copy() crowd_array.sort(key=lambda x:x.wealth,rev...
Cantoria/StimulateWealth
Crowd/Draw.py
Draw.py
py
696
python
en
code
0
github-code
90
21483770831
from __future__ import unicode_literals from datetime import date, datetime import logging from django.conf import settings from django.contrib.auth.models import User from django.contrib.sites.models import Site from django.core.mail import send_mail from django.core.management.base import BaseCommand from django.te...
lulzzz/aira
aira/management/commands/send_notifications.py
send_notifications.py
py
3,203
python
en
code
null
github-code
90
25096766318
#!/usr/bin/env python3 import pygame import numpy as np import threading import time def wrap(angle): return angle if angle > 0 else 360 + angle class Horizon: def __init__(self, font_size=None): if font_size is None: font_size = 20 self.font = pygame.font.SysFont('timesnewroman...
MomsFriendlyRobotCompany/quadcopter
tools/pygame/horizon.py
horizon.py
py
2,793
python
en
code
0
github-code
90
18290014609
import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) MOD = 10 ** 9 + 7 # 組合せ nCr (MOD) 逆元を使う方法 def perm(n,k): if k > n or k < 0: return 0 return fact[n] * fact_inv[n-k] % MOD def cmb(n, k): if k < 0 or k > n: return 0 ...
Aasthaengg/IBMdataset
Python_codes/p02804/s768562438.py
s768562438.py
py
1,357
python
en
code
0
github-code
90
17996573269
# BFS # 現在の頂点、スコア、通過した頂点の数、を状態量としてもち、2*n個まで試す # n個より多いものが最大になるのなら'inf'を出力 from collections import deque from sys import stdin def input(): return stdin.readline().strip() inf = float('inf') n, m = map(int, input().split()) edge = [[] for _ in range(n)] weight = [[] for _ in range(n)] for _ in range(m): i, j,...
Aasthaengg/IBMdataset
Python_codes/p03722/s290853901.py
s290853901.py
py
1,013
python
en
code
0
github-code
90
26486022125
import torch import matplotlib.pyplot as plt import pandas as pd from sklearn.model_selection import KFold import numpy import torch.nn as nn import spacy # Make a github repo with cavas data fold = KFold(n_splits=5) X_Tests = [] Y_Tests = [] Epoch_loss = [] def line(x): return 0.5 * x + 1 def mae(true_y, y_pred...
Orgzales/AI-Test-Data
experiment.py
experiment.py
py
4,858
python
en
code
0
github-code
90
5346084226
#!/usr/bin/env python # python= for i in range(int(input())): print(f"Case #{i+1}:") ans_list = [] #讀取資料 for n in range(10): url,a = input().split(" ") ans_list.append([int(a),url]) #進行判斷 max_math = max(ans_list)[0] for i in ans_list : if i[0] == max_math: print(i[1])
10946009/upload_data
特殊測資/U8/zj-a130/dom/ans.py
ans.py
py
323
python
en
code
0
github-code
90
36845526850
import numpy as np import pandas as pd import glob import re import os from scipy import stats import sys sys.path.insert(1,'/scratch/c.c21013066/software/biobankAccelerometerAnalysis/accelerometer') import utils data_path='/scratch/c.c21013066/data/ukbiobank/sample/withGP/' save_path1='/scratch/c.c21013066/data/ukbio...
aschalkamp/UKBBprodromalPD
analyses/1_download_preprocess/feature_extraction_parallel.py
feature_extraction_parallel.py
py
8,395
python
en
code
8
github-code
90
14227552248
# # Imports # import os from turtle import Turtle, Screen import time # # Classes # # # Global variables # # # Private functions # # clear_console def clear_console(): """ Clears console. """ command = "clear" if os.name in ("nt", "dos"): # If Machine is running on Wind...
fjpolo/Udemy100DaysOfCodeTheCompletePyhtonProBootcamp
Day020_021/main001.py
main001.py
py
2,097
python
en
code
8
github-code
90
41153212150
from fastapi import FastAPI from gensim.models import Word2Vec from pydantic import BaseModel import logging import json from typing import List from databases import Database import os import openai import re ## 만들 함수 app = FastAPI() logging.basicConfig(level=logging.INFO) loaded_word2vec_model = Word2Vec.load('song...
OhJune/Client-Django-FastAPI
FastAPI/app/main.py
main.py
py
5,001
python
en
code
1
github-code
90
42323378370
def morse_time(time_string): t = ''.join([i.zfill(2) for i in time_string.split(":")]) y = [2, 4, 3, 4, 3, 4] x = [bin(int(t[i]))[2:].zfill(y[i]).replace('0','.').replace('1','-') for i in range(6)] return "%s %s : %s %s : %s %s" % (x[0],x[1],x[2],x[3],x[4],x[5]) if __name__ == '__main__': # Thes...
rawgni/empireofcode
morse_clock.py
morse_clock.py
py
822
python
en
code
0
github-code
90
8580456839
import os from pprint import pprint from datetime import datetime def convert2ampm(time24: str) -> str: return datetime.strptime(time24, '%H:%M').strftime('%I:%M%p') os.chdir('D:\Learn/Python/buzzdata') with open('buzzers.csv') as data: ignore = data.readline #игнорировать заголовок flights = {} #создать...
Ve1l/python_book
test_format_csv.py
test_format_csv.py
py
1,532
python
en
code
1
github-code
90
27709670916
# coding: utf-8 # In[ ]: import keras from keras.datasets import cifar10 from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Conv2D, MaxPooling2D from keras.layers import Convolution2D, Max...
sathisceg/Neural-network
problem_1_2_m.py
problem_1_2_m.py
py
5,838
python
en
code
1
github-code
90
17079310013
import aoc ROCK = "A" PAPER = "B" SCISSOR = "C" def getOutcome(myMove, opponentMove): if myMove == opponentMove: return 3 if myMove == ROCK and opponentMove == SCISSOR: return 6 if myMove == SCISSOR and opponentMove == PAPER: return 6 if myMove == PAPER and opponentMove == RO...
tchapeaux/advent-of-code-2022
day02.py
day02.py
py
1,562
python
en
code
0
github-code
90
18271095839
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 # 998244353 input=lambda:sys.stdin.readline().rstrip() def resolve(): just, less = 0, INF for d in input()[::-1]: d = int(d) njust = min(just + d, less + d + 1) nless = min(just + (10-d), less + (9-d)) just...
Aasthaengg/IBMdataset
Python_codes/p02775/s323686619.py
s323686619.py
py
382
python
en
code
0
github-code
90
34813172674
import torch from torch.nn import functional as F from torch import nn from .comm import compute_locations, aligned_bilinear def dice_coefficient(x, target): eps = 1e-5 n_inst = x.size(0) x = x.reshape(n_inst, -1) target = target.reshape(n_inst, -1) intersection = (x * target).sum(dim=1) unio...
PeizeSun/OneNet
projects/OneSeg/oneseg/mask_head_dynamic.py
mask_head_dynamic.py
py
6,648
python
en
code
640
github-code
90
21304415003
from turtle import color import cv2 as cv import numpy as np from matplotlib import pyplot as plt #read image img = cv.imread(r"C:\Users\amora\OneDrive\Documents\Visual Studio Code\Course_Imageproccesing2\photos\group 2.jpg") #________________________method 1 ______________________________# plt.hist(img.ravel() , 2...
es-OmarHani/ImageProcessing_2
#histograms/histograms.py
histograms.py
py
702
python
en
code
0
github-code
90
6507397659
import unittest import struct class Test_test1(unittest.TestCase): def test_A(self): self.assertEqual(1, 1) #self.fail("Not implemented") def test_A2(self): speed = 1000 speedInBytes = bytes(struct.pack('>h', 1500)) print('{} {}'.format(speedInBytes[0], speedInBytes[1]...
Eurostar64/RailuinoSrcp
PythonSrcpServer/test1.py
test1.py
py
442
python
en
code
0
github-code
90
24772107611
# Load model parameters to test import model import load import pandas import numpy as np import argparse import train_multiple_models as train_mm import os import train def load_trainer(model_path): trainer = model.LinearRegression(train=False) trainer.load_model(model_path) return trainer def filter_att...
kaikai4n/ML2018FALL
hw1/hw1.py
hw1.py
py
4,577
python
en
code
1
github-code
90
8967007147
import numpy as np from Sobel import get_image from PIL import Image, ImageDraw import matplotlib.pyplot as plt import matplotlib.patches as patches from IoU import get_iou, get_iou_dict import random class Anchor(): def __init__(self, width, height, x_center, y_center) -> None: self.w = width ...
huffman19/plant-rec
anchors.py
anchors.py
py
8,348
python
en
code
0
github-code
90
71580663017
import os import re import pandas as pd Draftee = { 'Rank' : [], 'Name' : [], 'Pos' : [], 'Shot' : [], 'Age' : [], 'DoB' : [], 'Height' : [], 'Weight' : [], 'Country' : [], 'Team' : [], 'Leaugue' : [], 'GP' : [], 'G' : [], 'A' : [], 'Pts' : [], '+/-' : [], 'PIM' : [], 'FI' : []...
MasonV/Ros
CSBComp.py
CSBComp.py
py
4,696
python
en
code
0
github-code
90
44055165323
from mfrc522 import MFRC522 from machine import Pin from machine import Pin, PWM import utime import tm1637 from time import sleep_ms,sleep tm = tm1637.TM1637(clk=Pin(13), dio=Pin(12)) green_led = Pin(25, Pin.OUT) red_led = Pin(15, Pin.OUT) servoPin = PWM(Pin(16)) servoPin.freq(50) #50Hz(20msec...定值,超過會亂動) def s...
feifeifeii/RaspberryPiPico-test
RFID_Read_1.py
RFID_Read_1.py
py
2,202
python
en
code
0
github-code
90
3714284428
from flask import Blueprint, redirect, request, url_for, jsonify from twilio.rest import Client from extensions import db from models import User, Candidate, Role, Vote from utils import transform_phone_number import requests import os main = Blueprint('main', __name__) account_sid = os.environ.get("ACCOUNT...
CozyBrian/voting-server
routes.py
routes.py
py
10,264
python
en
code
0
github-code
90
33687052749
import random print("==> NUMBER GUESSING GAME <==") #win_number = 500 #count = 1 #guess_number = int(input("Kindly pick a random number from 1 to 100: ")) def set_difficulty(): level = input("Choose a difficulty. Type 'EASY' or 'HARD': ").lower() if level == "easy": return 10 #reture 10 chances el...
Innocentsax/Python_Series
Bootcamp/guess_number_game.py
guess_number_game.py
py
1,323
python
en
code
29
github-code
90
2925293970
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Feb 2 19:00:58 2020 @author: bob """ import pandas as pd import numpy as np import requests import folium import webbrowser from folium.plugins import HeatMap def city(province): ''' 处理港澳地区无城市的情况 province: 类型:字典型 return: 包含以下内容的 lis...
HanMENG15990045033/Epidemic_2020
03Epidemic_2020/Epidemic_Data.py
Epidemic_Data.py
py
5,820
python
en
code
4
github-code
90
17976110439
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): A, B = map(int, read().split()) if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0: print('Possible') else: print('Impossi...
Aasthaengg/IBMdataset
Python_codes/p03657/s952517566.py
s952517566.py
py
378
python
en
code
0
github-code
90
18029735589
# -*- coding: utf-8 -*- import sys sys.setrecursionlimit(10**9) INF=10**18 MOD=10**9+7 input=lambda: sys.stdin.readline().rstrip() YesNo=lambda b: bool([print('Yes')] if b else print('No')) YESNO=lambda b: bool([print('YES')] if b else print('NO')) int1=lambda x:int(x)-1 def main(): N,A,B=map(int,input().split()) ...
Aasthaengg/IBMdataset
Python_codes/p03829/s402979084.py
s402979084.py
py
549
python
en
code
0
github-code
90
8286375281
# -*- coding: utf-8 -*- """ Created on Thu May 11 11:20:33 2017 @author: darren """ import tensorflow as tf import sys import os #versioning, urllib named differently for dif python versions if sys.version_info[0] >= 3: from urllib.request import urlretrieve else: from urllib import urlretrieve # tsv is...
darren1231/Tensorflow_tutorial
11_compare_cnn_hidden/compare_cnn_hidden.py
compare_cnn_hidden.py
py
7,911
python
en
code
0
github-code
90
41423570676
# -*- coding: utf-8 -*- """ Created on Mon Jan 24 13:41:56 2022 @author: Sasuke """ #importing neccesary modules import sys import os from collections import Counter #defining circuit start and end tokens CIRCUIT_START = ".circuit" CIRCUIT_END = ".end" ROOT_dir = os.getcwd() #gets your root directory #tokenizer def...
sasuke-ss1/EE2703
Week 1/week1_code.py
week1_code.py
py
2,809
python
en
code
1
github-code
90
15420570006
from django.conf import settings from django.conf.urls.static import static from django.urls import path from django.views.decorators.cache import cache_page from posts import views app_name = 'posts' urlpatterns = [ path('', views.HomePageView.as_view(), name='index'), path('posts', views.PostsListView.as_v...
moskalec/news
news/posts/urls.py
urls.py
py
1,278
python
en
code
0
github-code
90
18443624369
def gcd(x, y): if(y > x): tmp = y y = x x = tmp while(int(x%y)>0): r = x%y x = y y = r return y n = int(input()) a = list(map(int, input().split())) ans = gcd(a[0], a[1]) for i in range(1, n-1): ans = min(ans, gcd(a[i], a[i+1])) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03127/s136528534.py
s136528534.py
py
318
python
en
code
0
github-code
90
25323810315
import logging from telegram import Update from telegram.ext import ApplicationBuilder, ContextTypes, filters, MessageHandler, CommandHandler import settings logging.basicConfig(filename='bot.log', level=logging.INFO) async def echo(update: Update, context: ContextTypes.DEFAULT_TYPE): await context.bot.se...
anatalin/learn-python-ru-example
mybot/bot.py
bot.py
py
1,028
python
en
code
0
github-code
90
34727122417
#!/usr/bin/python3 def safe_print_division(a, b): """Divide two integers. Return None if undefined.""" try: quotient = a / b except ZeroDivisionError: quotient = None finally: print("Inside result: {}".format(quotient)) return quotient
keysmusician/holbertonschool-higher_level_programming
0x05-python-exceptions/3-safe_print_division.py
3-safe_print_division.py
py
282
python
en
code
0
github-code
90
16623239417
import gin import tensorflow as tf def get_inputs_from_file(input_filename, ignore_comments=False): """Read data from file and strip new lines.""" inputs = [line.rstrip() for line in tf.io.gfile.GFile(input_filename)] # Strip the last empty line. if not inputs[-1]: inputs.pop() if ignore_comments: ...
disi-unibo-nlp/bio-ee-egv
src/utils/t5x_utils/test_utils.py
test_utils.py
py
4,029
python
en
code
11
github-code
90
22910490334
import random import os import pygame import tkinter as tk from tkinter.filedialog import askdirectory # lets initalize the music mixer here. Why not pygame.mixer.init() # I am using Tkinter askdirectory function. Tkinter auto opens a window on your computer and this hides that window. Keep it clean. root = tk.Tk() roo...
adam-goodrich/Python_Practice
music_gamr.py
music_gamr.py
py
1,991
python
en
code
0
github-code
90
38468256059
import logging import re import unittest from StringIO import StringIO import OpenSSL import twisted from mocker import Mocker, expect from twisted.internet import defer, reactor, error as txerror, ssl from twisted.python import failure from twisted.web import client, error as web_error from twisted.trial.unittest i...
stevegood/filesync-server
src/server/tests/test_ssl_proxy.py
test_ssl_proxy.py
py
16,149
python
en
code
7
github-code
90
23650027912
#!/usr/bin/python3 # -*- coding: utf-8 -*- ######################################################### # SCRIPT : xremotemount.py # # Xnas manage remote mounts # # # # I. Helwegen 2020 ...
Helly1206/xnas
opt/xnas/xremotemount.py
xremotemount.py
py
11,557
python
en
code
0
github-code
90
15853073667
import pandas as pd import sqlalchemy from sqlalchemy import create_engine # ********************************************************************** def getDataFrame(url_address,ind): df = pd.read_html(url_address, index_col=None)[ind] return df df = getDataFrame("https://www.tiobe.com/tiobe-index/"...
julien-blanchard/personal_website
06_sqlalchemy/sqlalchemy.py
sqlalchemy.py
py
1,553
python
en
code
0
github-code
90
18184797949
MOD = 10 ** 9 + 7 n, k = map(int, input().split()) alst = list(map(int, input().split())) alst.sort() if n == k: ans = 1 for num in alst: ans *= num ans %= MOD print(ans) exit() if k == 1: print(alst[-1] % MOD) exit() if alst[0] >= 0: ans = 1 alst.sort(reverse = True...
Aasthaengg/IBMdataset
Python_codes/p02616/s333711401.py
s333711401.py
py
2,200
python
en
code
0
github-code
90
28104600577
iPrue = 0 while iPrue == 0: iCont = 0 print("-" * 70) sFras = input("Ingrese una frase (si quiere salir ingrese la letra ""q""): ") sFrasMay = sFras.upper() for i in sFrasMay: if i.upper() in "AEIOU": iCont+= 1 if sFrasMay == "Q": print("-" * 70) pr...
AlejandroP75/CampusAP75
Python/Software Review/05-Ejercicio3_Estructuras_Condicionales_Validacion.py
05-Ejercicio3_Estructuras_Condicionales_Validacion.py
py
426
python
es
code
0
github-code
90
37788487674
""" This plugin adds support for GNATcoverage. This plugin provides the following: * A new Build Mode "gnatcov" * Several new project attributes which GPS will use to drive various tools in the context of GNATcoverage * Build targets to launch runs and analyses * Menus corresponding to these buil...
AaronC98/PlaneSystem
Code/share/gps/support/ui/gnatcov.py
gnatcov.py
py
15,865
python
en
code
0
github-code
90
10511831109
import Utils import numpy as np import matplotlib.pyplot as plt import math # Centers an image based on position of dots # Not used in standard workflow because translation blurs the image def CenterImage(image, showTranslate=False): # Find center point height, width = Utils.GetImageSize(image, path=False) ...
MANATEE-UF/CrystallographyClassification
RecyclingBin/CenterImage.py
CenterImage.py
py
1,912
python
en
code
0
github-code
90
5101216298
class Solution: def oddCells(self, n: int, m: int, indices: list[list[int]]) -> int: n_point=[0 for _ in range(n)] m_point=[0 for _ in range(m)] for i in range(len(indices)): ind_i=indices[i] n_point[ind_i[0]]+=1 m_point[ind_i[1]]+=1 ans=0 ...
WAT36/procon_work
procon_python/src/leetcode/1252_Cells_with_Odd_Values_in_a_Matrix.py
1252_Cells_with_Odd_Values_in_a_Matrix.py
py
470
python
en
code
1
github-code
90
37277126593
import logging import re from oda.libs.odb.disassembler.ofd import Ofd from .instruction import * logger = logging.getLogger(__name__) class Processor(object): ''' classdocs ''' def __init__(self, odb_file): self.vma = "" self.vmaStr = [] self.branchLineHtml...
vancaho/oda
django/oda/libs/odb/disassembler/processors/processor.py
processor.py
py
2,420
python
en
code
null
github-code
90
42853919075
m,n=map(int,input().split()) k=0 for x in range(1,m+1): if(m==(n**x)): k=k+1 break if(k==1): print("yes") else: print("no")
Shamabanu/python
power or not.py
power or not.py
py
152
python
en
code
2
github-code
90
71915508776
from __future__ import division __author__ = 'lthurner' import numpy as np from pandapower.control.controller.trafo_control import TrafoController class ContinuousTapControl(TrafoController): """ Trafo Controller with local tap changer voltage control. INPUT: **net** (attrdict) - Pandapower st...
thediavel/RL-ThesisProject-ABB
env/Lib/site-packages/pandapower/control/controller/trafo/ContinuousTapControl.py
ContinuousTapControl.py
py
4,602
python
en
code
3
github-code
90
18655962128
from node import Node #Set this to True to get a full tree print out VERBOSE= True #Open the input file and read each word into a list f = open('input.txt', 'r') wordlist = f.read().splitlines() f.close() wordlist = [s.upper() for s in wordlist] #Sort this list into alphabetical order #This may be a waste of time... w...
jkoppenhaver/regexGenerator
main.py
main.py
py
1,209
python
en
code
11
github-code
90
3213772266
#!/usr/bin/env python # coding: utf-8 def find_indices(input_list, n): ht = {} counter = 0 for v in input_list: ad = n - v if ad in ht.values(): for k in ht.keys(): if ht[k] == ad: return k, counter else: ht[counter] = v ...
Bagich/AppliedPython
homeworks/homework_01/hw1_arrsearch.py
hw1_arrsearch.py
py
356
python
en
code
0
github-code
90
16931626321
""" This class provides a general Systematics class """ import copy import logging import numpy as np import pandas as pd from abc import ABC, abstractmethod from collections.abc import Sequence from typing import Union, Optional, Tuple, List from templatefitter.binned_distributions.binning import Binning from templ...
eckerpatrick/TemplateFitter
templatefitter/binned_distributions/systematics.py
systematics.py
py
14,197
python
en
code
null
github-code
90
27620099382
from setuptools import setup, find_packages from codecs import open import os import re package_name = 'mySQLace' here = os.path.abspath(os.path.dirname(__file__)) # Get the long description from the README file os.system("pandoc -f markdown -t rst README.md -o README.rst") with open(os.path.join(here, 'README.rst'),...
jordancortes/mySQLace
setup.py
setup.py
py
1,866
python
en
code
0
github-code
90
11504406141
import LifeGame as lg import LifeGameUI as lgui import numpy as np TOLERANCE = 0.1 NUMBER_ITER_INIT = 1000 class LifeGameSim: def __init__ (self, life_cols = lgui.LIFE_COLS, life_rows = lgui.LIFE_ROWS, max_gen = lg.MAX_GENERATION, tolerance = TOLERANCE): self.life_cols = life_cols self.life_rows ...
chintonp/LifeGame
LifeGame/LifeGameSim.py
LifeGameSim.py
py
2,215
python
en
code
0
github-code
90
21674879188
import os import ply.lex as lex symbolTable = {} registers = { 'AX': 'AX', 'BX': 'BX', 'CX': 'CX', 'DX': 'DX', 'AH': 'AH', 'AL': 'AL', 'BH': 'BH', 'BL': 'BL', 'CH': 'CH', 'CL': 'CL', 'DH': 'DH', 'DL': 'DL', 'DI': 'DI', 'SI': 'SI', 'BP': 'BP', 'SP': 'SP'...
giannhs694/Assembly8086Compiler
Assembly8086Lexer.py
Assembly8086Lexer.py
py
3,042
python
en
code
0
github-code
90
2345962124
import os import re import time import urllib from datetime import datetime from urllib import request, parse from lxml import html from urllib.parse import quote import _thread from multiprocessing import Process import smtplib import urllib from email.header import Header from datetime import datetime from email.mime...
June-xiaowu/Beijing-HPV
SYFYBJY/JL.py
JL.py
py
18,672
python
en
code
3
github-code
90
5544490482
# 미네랄 # 복습 횟수:2, 02:00:00, 복습필요3 import sys from collections import deque si = sys.stdin.readline R, C = map(int, si().split()) graph = [] for i in range(R): tmp = list(map(str, si().rstrip())) graph.append(tmp) N = int(si()) height_list = list(map(int, si().split())) # 떠 있다는 것을 어떻게 체크할 것인가?? # BFS()로 [0]...
SteadyKim/Algorism
language_PYTHON/백준/BJ2933.py
BJ2933.py
py
3,822
python
ko
code
0
github-code
90
23297016518
# -*- coding: UTF-8 -*- class Solution: def combine(self, n, k): self.result = [] self.tmp = [] self.dfs(n, k, 1) return self.result def dfs(self, n, k, startIndex): if len(self.tmp) == k: self.result.append(self.tmp[:]) return f...
OhOHOh/LeetCodePractice
python/No77.py
No77.py
py
497
python
en
code
0
github-code
90
13395145348
import json import os from pathlib import Path from typing import List import pandas as pd from prefect import flow, get_run_logger, task URLS = { "jan": "https://data.ibb.gov.tr/dataset/3ee6d744-5da2-40c8-9cd6-0e3e41f1928f/resource/db9c7fb3-e7f9-435a-92f4-1b917e357821/download/traffic_density_202001.csv", "f...
husnusensoy/python-workshop
week9/afternoon/traffic.py
traffic.py
py
2,517
python
en
code
2
github-code
90
26643674954
import copy class NFA: def __init__(self, description): self.transitions = description['transitions'] self.accept_states = description['accept_states'] self.start = description['start'] def is_accept(self, string): for symbol in string: if symbol in self.accept_stat...
Dsackler/Theory_Final_Project
Second_Idea/new_nfa.py
new_nfa.py
py
7,733
python
en
code
0
github-code
90
41799188754
class Counter: 'счётчик' def start_from(self, n=0): 'начинает отсчёт от числа n' self.cnt = n def increment(self): self.cnt += 1 def display(self): print(f'Текущее значение счетчика = {self.cnt}') def reset(self): self.cnt = 0 c1 = Counter() c1.start_fro...
gotcrab/oop_training
Counter.py
Counter.py
py
575
python
ru
code
0
github-code
90
16678215032
from tkinter import* from PIL import Image,ImageTk from tkinter import messagebox class Register: def __init__(self,root): self.root=root self.root.title("Registration") self.root.geometry("865x486+200+60") self.root.config(bg="white") #### BG Image #### ...
hansraj2000/Login-System-With-Registration-and-OTP-Verification
Login system/MeanMod.py
MeanMod.py
py
3,950
python
en
code
0
github-code
90
37241465421
import pytest import unittest from mockito import when from clash_royale_service import ClashRoyaleService from tests.resources import clash_royale_client_currentriverrace, clash_royale_client_responses class TestClanRemainingWarPlayers(unittest.TestCase): def test_clan_players_remaining_war_attacks(self): ...
damoster/royale_clan_card_level_ranker_bot
tests/test_clan_remaining_war_players.py
test_clan_remaining_war_players.py
py
1,393
python
en
code
2
github-code
90
34630059065
import haikugen from flask import Flask, render_template, request app = Flask(__name__) @app.route('/', methods=["GET", "POST"]) def index(): first = second = third = "" if request.method == "POST": if request.form.get("generate") == "generate": first, second, third = haikugen.genhaiku() ...
rxxed/ha1kugen
app.py
app.py
py
443
python
en
code
0
github-code
90
34947643237
"""1) Создайте новую Базу данных. Поля: id, 2 целочисленных поля. Целочисленные поля заполняются рандомно от 0 до 9. Посчитайте среднее арифметическое всех элементов без учёта id. Если среднее арифметическое больше количества записей в БД, то удалите четвёртую запись БД""" import sqlalchemy as db import random meta =...
Alesya-Laykovich/alesya_laykovich_homeworks
homework_23/task_01.py
task_01.py
py
1,743
python
ru
code
0
github-code
90
27647112354
from collections import OrderedDict # Skdaccess imports from skdaccess.framework.data_class import DataFetcherBase, ImageWrapper # 3rd party imports import h5py class DataFetcher(DataFetcherBase): ''' Generic data fetcher for loading images from a hdf file ''' def __init__(self, dataset_dict, verb...
MITHaystack/scikit-dataaccess
skdaccess/generic/images/hdf.py
hdf.py
py
1,358
python
en
code
44
github-code
90
1502520766
import asyncio import logging from asyncua import Server, ua from asyncua.common.methods import uamethod @uamethod def func(parent, value): return value * 2 async def main(): _logger = logging.getLogger("asyncua") # setup our server server = Server() await server.init() server.set_endpoint(...
scrimbley/opcua_concept_chat_server
opcua-server.py
opcua-server.py
py
1,969
python
en
code
0
github-code
90
26870552315
import numpy as np import numpy.testing as npt from saf.util.observedorder import compute_observed_order_of_accuracy from ..henrickapproximator import HenrickApproximator class TestHenrickApproximator: def test__sine_function__should_give_approximation_of_derivative(self): x, dx = np.linspace(0, 2*np.pi,...
dmitry-kabanov/fickettmodel
saf/nonlinear/tests/test_henrickapproximator.py
test_henrickapproximator.py
py
1,817
python
en
code
0
github-code
90
70278387498
import os from dotenv import load_dotenv from google.cloud import bigquery load_dotenv() project_name = os.environ.get('PROJECT_NAME') dataset_name = os.environ.get('DATASET_NAME') bucket_name = os.environ.get('BUCKET_NAME') table_name = 'source_neko' client = bigquery.Client() table_id = f"{project_name}.{dataset_...
nuevocs/gcp-bq-python
sample-scripts/create_table_rows.py
create_table_rows.py
py
938
python
en
code
0
github-code
90
71095892137
# https://leetcode.com/problems/permutation-in-string # medium # daily from collections import Counter class Solution: def checkInclusion(self, s1: str, s2: str) -> bool: d1, i, window = Counter(s1), 0, 0 while i < len(s2): if window == len(s1) and all(v == 0 for v in d1.values()): ...
gerus66/leetcode
medium/567_permutation_in_string.py
567_permutation_in_string.py
py
671
python
en
code
0
github-code
90
26612266518
#!/usr/bin/env python """ pydiction.py 1.2.3 by Ryan Kulla (rkulla AT gmail DOT com). License: BSD. Description: Creates a Vim dictionary of Python module attributes for Vim's completion feature. The created dictionary file is used by the Vim ftplugin "python_pydiction.vim". Usage: pydicti...
rkulla/pydiction
pydiction.py
pydiction.py
py
9,984
python
en
code
279
github-code
90
73384780457
# -*- coding: utf-8 -*- # @Time : 2020/5/29 22:01 # 公众号:Python自动化办公社区 # @File : xpath.py # @Software: PyCharm # @Description: 怎么定位网页中的数据?XPath的基本使用。 import requests from lxml import html # 获取网页数据 def get_html_data(url): html_code = requests.get(url) html_code.encoding = 'utf-8' html_code = html_code.tex...
zhaofeng092/python_auto_office
B站/Python爬虫案例实战(2020 · 周更)/x-xpath的使用/xpath.py
xpath.py
py
796
python
en
code
98
github-code
90
18540383669
N=int(input()) A=list(map(int,input().split())) S=[0] mp={0:1} for i in range(N): S.append(S[-1]+A[i]) mp[S[-1]]=mp.get(S[-1],0)+1 ans=0 for i in mp: ans+=mp[i]*(mp[i]-1)//2 print(ans)
Aasthaengg/IBMdataset
Python_codes/p03363/s019029768.py
s019029768.py
py
191
python
en
code
0
github-code
90
18297812919
from sys import stdout import bisect printn = lambda x: stdout.write(x) inn = lambda : int(input()) inl = lambda: list(map(int, input().split())) inm = lambda: map(int, input().split()) DBG = True # and False BIG = 999999999 R = 10**9 + 7 def ddprint(x): if DBG: print(x) def f(x): sm = 0 for i ...
Aasthaengg/IBMdataset
Python_codes/p02821/s507276259.py
s507276259.py
py
862
python
en
code
0
github-code
90
2439307886
import yaml import os import boto3 import time s3_client = boto3.client('s3') s3_resource = boto3.resource('s3') cfn_client = boto3.client('cloudformation') ''' 将错误提取出来写入到notification中 args: event = { "version": "20220622", "commit": "9f2b50e4bc89dd903f85ef1215f0b31079537450", ...
PharbersDeveloper/phlambda
devops/cicd/phcicdupdateasyncmanageyaml/src/main.py
main.py
py
9,233
python
en
code
0
github-code
90
7893164612
import cv2 import numpy as np import torch import torch.onnx from torch import nn class SuperResolutionNet(nn.Module): def __init__(self, upscale_factor): super().__init__() self.upscale_factor = upscale_factor self.img_upsampler = nn.Upsample( scale_factor=self.upscale_factor,...
zhiqing66/ONNX_Learn
SRCNN/srcnn.py
srcnn.py
py
2,301
python
en
code
1
github-code
90
6290680345
# - Scrapping information on places # - Scrapping results from a given query(e.g. "스타벅스"). # - Information including name, address, and working time # - Data from Kakao map import numpy as np import pandas as pd from selenium import webdriver from selenium.webdriver import ActionChains from selenium.web...
WusuhkJu/etc
kakaomap_scrapping.py
kakaomap_scrapping.py
py
5,602
python
en
code
0
github-code
90
22770276773
class Solution: def PrintMinNumber(self, numbers): # write code here str_list = [] length = 0 for i in numbers: str_i = str(i) length = max(length,len(str_i)) str_list.append(str_i) full_str_dict = {} for i in str_list: ...
amisyy/leetcode
printMinNumber.py
printMinNumber.py
py
825
python
en
code
0
github-code
90
18487342249
n=int(input()) data=[] for i in range(n): X,Y,H=map(int,input().split()) data.append([H,X,Y]) data.sort(reverse=True) for i in range(101): for j in range(101): H=abs(data[0][1]-i)+abs(data[0][2]-j)+data[0][0] for k in range(1,n): if max(H-abs(data[k][1]-i)-abs(data[k][2]-j),0)==d...
Aasthaengg/IBMdataset
Python_codes/p03240/s272785580.py
s272785580.py
py
453
python
en
code
0
github-code
90
18180679559
n=int(input()) x=input() val=int(x,2) cnt=x.count("1") p_cnt=cnt+1 m_cnt=cnt-1 p_amari,m_amari=0,0 p_amari=val%(cnt+1) if cnt-1!=0: m_amari=val%(cnt-1) else: m_amari=0 for i in range(n): ans=0 if x[i]=="0": amari=p_amari+pow(2,n-i-1,p_cnt) amari%=p_cnt elif x[i]=="1": if cnt-1==0: print(0...
Aasthaengg/IBMdataset
Python_codes/p02609/s313746131.py
s313746131.py
py
475
python
en
code
0
github-code
90
24009078352
compile_args = { "opt": [], "fastbuild": [], "dbg": ["-race"], } build_args = { "opt": [], "fastbuild": [], "dbg": ["-race"], } link_args = { "opt": [ "-w", "-s", ], "fastbuild": [ "-w", "-s", ], "dbg": ["-race"], } link_args_darwin = { ...
google/qrisp
tools/build_rules/go.bzl
go.bzl
bzl
12,080
python
en
code
10
github-code
90
30933307668
import datetime from typing import Any, Dict, List, Type, TypeVar, Union import attr from dateutil.parser import isoparse from ..models.cnh_answer import CNHAnswer from ..models.documento_answer import DocumentoAnswer from ..models.endereco_answer import EnderecoAnswer from ..models.face_answer import FaceAnswer from...
paulo-raca/python-serpro
serpro/datavalid/models/pf_facial_answer.py
pf_facial_answer.py
py
7,851
python
pt
code
0
github-code
90
12286378308
import os def join(paths): return os.path.join(*paths) root_path = os.path.dirname(os.path.abspath(__file__)) dirs = [ join(["data", "raw"]), join(["data", "processed"]), join(["prediction_service", "model"]), "notebooks", "saved_models"] for dir_ in dirs: filedir = join([root_path, dir_, ...
guilherme9820/wine_quality
template.py
template.py
py
1,284
python
en
code
0
github-code
90
5102881251
import base64 import os from base64 import b64encode from Crypto.Cipher import AES from base64 import b64decode from Crypto.Random import get_random_bytes from sendgrid import SendGridAPIClient from sendgrid.helpers.mail import Mail def send_email(key): message = Mail( from_email='yargoryar@gmail.com', ...
yarynka28/university_project
ransomware.py
ransomware.py
py
3,192
python
en
code
0
github-code
90
1332706372
''' 349. Intersection of Two Arrays Easy Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any order. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2] Example 2: Input: nums1 = [4,9,5], nums2 = [...
dariusnguyen/algorithm_data_structure_replit
arrays_strings/aaa_arrays_intersection.py
aaa_arrays_intersection.py
py
896
python
en
code
0
github-code
90
34946026546
# Enter your code here. Read input from STDIN. Print output to STDOUT import math AB=int(input()) BC=int(input()) x=math.atan(BC/AB) deg=math.degrees(x) a=90-deg a=round(a) a=str(a) print(a+chr(176))
redietamare/competitive-programming
find-angle-MBC.py
find-angle-MBC.py
py
201
python
en
code
0
github-code
90
7311384778
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 16 11:35:10 2018 @author: anonymous cd /home/adam/Bureau """ import shutil import random import numpy as np #These are used to write the wad file from omg.wad import WAD from scenario_generation.maze_functions import create_green_armor, create_re...
Tzekh/PAr135_AIxplicability
Programs/3dcdrl/generate_scene.py
generate_scene.py
py
4,553
python
en
code
0
github-code
90
898013209
import numpy as np from methods.oei import OEI import gpflow import sys sys.path.append('..') from benchmark_functions import scale_function, hart6 def create_model(batch_size=2): options = {} options['samples'] = 0 options['priors'] = 0 options['batch_size'] = batch_size options['iterations'] = 5...
oxfordcontrol/Bayesian-Optimization
tests/create_model.py
create_model.py
py
993
python
en
code
44
github-code
90