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
7272651469
def main(filename): part_one(filename) part_two(filename) def part_one(filename): """Starting with a frequency of zero, what is the resulting frequency after all of the changes in frequency have been applied """ with open(filename, "r") as f: print(sum([int(num) for num in f.readlines...
jonabantao/advent_of_code
2018/day01/day1.py
day1.py
py
1,179
python
en
code
0
github-code
90
16849667560
import sys from enum import Enum import serial import serial.tools.list_ports from serial.threaded import ReaderThread, Protocol from PySide2.QtGui import QPalette from PySide2.QtCore import Qt, QObject, Slot, Signal from PySide2.QtWidgets import QApplication, qApp, QWidget from PySide2.QtWidgets import QPushButton, ...
imxood/imxood.github.io
src/program/python/app/serial_tool/app.py
app.py
py
15,654
python
en
code
0
github-code
90
71273055977
import re def parse_vertex_and_square_ids( data: str, start_string: str = "Square ID", end_string: str = "# Edges", ) -> dict: """Return a dictionary of vertex ID & square ID pairs. This function will parse through the read-in input data between ''start_string'' and ''end_string'' to return the filte...
jeannadark/search_alchemy
constructor/input_reader.py
input_reader.py
py
4,847
python
en
code
1
github-code
90
18404691999
S = int(input()) YYMM = 0 MMYY = 0 if S % 100 >= 1 and S % 100 <= 12: YYMM = 1 if S // 100 >= 1 and S // 100 <= 12: MMYY = 1 if YYMM == 0 and MMYY == 0: print('NA') elif YYMM == 0 and MMYY == 1: print('MMYY') elif YYMM == 1 and MMYY == 0: print('YYMM') else: print('AMBIGUOUS')
Aasthaengg/IBMdataset
Python_codes/p03042/s889911714.py
s889911714.py
py
306
python
en
code
0
github-code
90
18406265649
import sys sys.setrecursionlimit(10**8) N = int(input()) graph = [[] for _ in range(N)] for i in range(1, N): u, v, w = map(int, input().split()) graph[u-1].append((v-1, w)) graph[v-1].append((u-1, w)) color = [0 for _ in range(N)] visited = [False for _ in range(N)] def dfs(now): for adj in graph[n...
Aasthaengg/IBMdataset
Python_codes/p03044/s848594458.py
s848594458.py
py
651
python
en
code
0
github-code
90
72660149416
import numpy as np from tensorflow.keras.datasets.cifar10 import load_data from keras.utils.np_utils import to_categorical import tensorflow as tf def cifar10_load(): (x_train_n, y_train_n), (x_test, y_test) = load_data() x_train = np.copy(x_train_n[:45000]) y_train = np.copy(y_train_n[:45000]) x_dev =...
HaojieYuan/RobustNN
Benchmark_detection/utils.py
utils.py
py
1,016
python
en
code
0
github-code
90
41010176788
from datetime import datetime import matplotlib as mpl mpl.use('Agg') # NOQA from lasagnekit.easy import BatchOptimizer, BatchIterator, get_batch_slice from lasagnekit.nnet.capsule import Capsule from lasagnekit.easy import iterate_minibatches from lasagne import updates from lasagnekit.updates import santa_sss updat...
mehdidc/zoo
train.py
train.py
py
14,630
python
en
code
0
github-code
90
13454650838
# https://leetcode.com/problems/kth-smallest-element-in-a-bst/ from typing import Optional, List # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right def bst_to_list(node: Optional[Tree...
petercrackthecode/LeetcodePractice
kth_smallest_element_in_bst/my_solution.py
my_solution.py
py
640
python
en
code
1
github-code
90
43032629147
t = int(input()) def getLongestSubsequence(lcs_matrix,str1,str2,x,y): revseq = "" while (x>0) and (y>0): if str1[x-1] != str2[y-1]: if lcs_matrix[x-1][y] == lcs_matrix[x][y]: x -= 1 elif lcs_matrix[x][y-1] == lcs_matrix[x][y]: y -= 1 else: revseq += str1[x-1...
kaustav1808/Data-Structure-And-Algorithm-Implementation
Dynamic Programming/longestCommonSubSequence.py
longestCommonSubSequence.py
py
972
python
en
code
0
github-code
90
5544444752
import sys from collections import deque si = sys.stdin.readline N, P = map(int, si().split()) def bfs(): q = deque() q.append(N) visited = [0 for _ in range(1000000 + 1)] visited[N] += 1 # 방문처리 while q: val = q.popleft() val = str(val) if val == 3: break ...
SteadyKim/Algorism
language_PYTHON/백준/BJ2331.py
BJ2331.py
py
635
python
en
code
0
github-code
90
33153442746
import streamlit as st import numpy as np import pandas as pd import plotly.express as px def run(): st.markdown("# How does data become a line?") st.markdown(""" Alice measured the rate of reaction for the decomposition of hydrogen peroxide at several temperatures. What should she plot to get a li...
ryanpdwyer/pchem
apps/arrhen.py
arrhen.py
py
2,482
python
en
code
0
github-code
90
74543542695
import json import boto3 import json import boto3 import random import string import datetime from custom_encoder import CustomEncoder, error_response email_client = boto3.client("ses") dynamo_client = boto3.resource(service_name='dynamodb', region_name='us-east-1') product_table_email = dynamo_client.Table('email_ot...
NovoSphere/Login-Sigup-with-React-and-AWS
AWS/email.py
email.py
py
3,197
python
en
code
0
github-code
90
9301503264
import datetime import logging import os import urllib.parse from typing import Any, Dict, Generator, List, Tuple from .base import Fetcher logger = logging.getLogger(__name__) class S3Fetcher(Fetcher): def __init__( self, storage_config: Dict[str, Any], storage_paths: List[str], local_dir: str ) ->...
JorgedDiego/determined-ai
harness/determined/tensorboard/fetchers/s3.py
s3.py
py
2,764
python
en
code
0
github-code
90
16404050149
if __name__ == '__main__': test_cnt = int(input()) for t in range(test_cnt): digits = [int(digit) for digit in input()] length = len(digits) queue = [] if length%2 == 0: queue.append((0,length-1)) else: queue.append((0,length-2)) queue....
HacoK/SolutionsOJ
3-11/solution.py
solution.py
py
1,056
python
en
code
3
github-code
90
13859571082
import collections import operator def getDistance(startX, endX, startY, endY): # Get difference of every point with every co-ordinate dist={} for i in range(startX, endX+1): for j in range(startY, endY+1): for index,coord in coords.items(): if (i,j) not in dist.keys(): ...
arvinddoraiswamy/blahblah
adventofcode/2018/6.py
6.py
py
4,971
python
en
code
6
github-code
90
73114691495
import tkinter as tk import tkinter.font as tkFont class UiManager: def __init__(self, window, handle_entry_logic_callback): self.handle_entry_logic_callback = handle_entry_logic_callback print(f"Debug: handle_entry_logic_callback is {self.handle_entry_logic_callback}") self.window = wind...
ryancarolina/ai-dungeon-master
UiManager.py
UiManager.py
py
5,126
python
en
code
0
github-code
90
29544035647
# -*- coding: utf-8 -*- # @Time : 2022/2/20 10:29 # @Author : 模拟卷 # @Github : https://github.com/monijuan # @CSDN : https://blog.csdn.net/qq_34451909 # @File : 6014AC. 构造限制重复的字符串.py # @Software: PyCharm # =================================== """给你一个字符串 s 和一个整数 repeatLimit ,用 s 中的字符构造一个新字符串 repeatLimitedStrin...
monijuan/leetcode_python
code/competition/2022/20220220/6014AC. 构造限制重复的字符串.py
6014AC. 构造限制重复的字符串.py
py
3,709
python
zh
code
0
github-code
90
20297921984
import tkinter as tk def converter(): i=var1.get() o=var2.get() val=int(entry_input.get()) op_value=0 entry_output.delete(0,tk.END) if i=='c': if o=='f': op_value=(val*(9/5))+32 elif o=='k': op_value=val+273.15 else: op_value=val ...
shiva341/python-projects
tinkter.py
tinkter.py
py
1,981
python
en
code
0
github-code
90
17978127939
import queue import sys sys.setrecursionlimit(10 ** 7) N = int(input()) ab = [] for _ in range(N - 1): ab.append(tuple(map(int, input().split()))) G = [[] for _ in range(N + 1)] for el in ab: a, b = el G[a].append(b) G[b].append(a) seen = [False] * (N + 1) todo = queue.Queue() dist = [0] * (N + 1) pr...
Aasthaengg/IBMdataset
Python_codes/p03660/s458913990.py
s458913990.py
py
1,222
python
en
code
0
github-code
90
18999055483
import myhdl from avalon_buses import PipelineST from common_functions import conditional_reg_assign, simple_wire_assign, simple_reg_assign class Activation(): def __init__( self , DATAWIDTH = 32, CHANNEL_WIDTH = 1, ...
krsheshu/luttappi
lib/frameworks/activation/myhdl/activation.py
activation.py
py
2,590
python
en
code
1
github-code
90
44554577427
""" Get Maximum Gold In a gold mine grid of size m x n, each cell in this mine has an integer representing the amount of gold in that cell, 0 if it is empty. Return the maximum amount of gold you can collect under the conditions: - Every time you are located in a cell you will collect all the gold in that cell. - Fr...
kpham841/LeetCode_Python
Matrix/Get_Max_Gold.py
Get_Max_Gold.py
py
2,671
python
en
code
0
github-code
90
18544286859
import sys N, C = map(int, sys.stdin.readline().split()) sushi_set = [] for i in range(N): x, v = map(int, sys.stdin.readline().split()) sushi_set.append((x, v)) sushi_set.sort() ans = -1 # 方向転換は一回まででと考えて良いのではないか? # right right = [0 for _ in range(N)] max_n = -float("inf") energy = 0 right_back = [0 for _ i...
Aasthaengg/IBMdataset
Python_codes/p03372/s840505934.py
s840505934.py
py
1,183
python
en
code
0
github-code
90
25212861337
# -*- coding: utf-8 -*- ''' Модули с описанием смежных классов ''' from PyQt5.QtWidgets import QWidget, QDialog, QLabel, QPushButton, QVBoxLayout, QProgressBar from PyQt5.QtGui import QFont from PyQt5.QtCore import Qt, QObject, pyqtSignal, pyqtSlot from work_lib import work_time, web_time, shutdown_lib from work_setti...
SelYui/working-hours
work_setting/adjacent_classes.py
adjacent_classes.py
py
8,730
python
ru
code
0
github-code
90
25589025634
import os from absl.testing import absltest from framework import xds_url_map_testcase # Needed for xDS flags _TEST_CASE_FOLDER = os.path.dirname(__file__) def load_tests(loader: absltest.TestLoader, unused_tests, unused_pattern): return loader.discover( _TEST_CASE_FOLDER, pattern="*" + xds_ur...
grpc/grpc
tools/run_tests/xds_k8s_test_driver/tests/url_map/__main__.py
__main__.py
py
420
python
en
code
39,468
github-code
90
19502849374
import csv disease_lsit = ['AF', 'BBB', 'TAC', 'normal'] file_path = 'D:/data/ECG/result/20210330/' file_path_AF = file_path + 'AF.csv' file_path_BBB = file_path + 'BBB.csv' file_path_TAC = file_path + 'TAC.csv' file_path_normal = file_path + 'normal.csv' def read_file(file_path): result = [] with open(file_...
hezhongyu/EEG
exps/temp.py
temp.py
py
2,495
python
en
code
0
github-code
90
73888829418
from decimal import Decimal n = int(input()) ab = [list(map(int, input().split())) for _ in range(n)] data = [] for i in range(n): a, b = ab[i] data.append((-Decimal(a) / Decimal(a + b), i)) data.sort() print(*[x[1] + 1 for x in data])
ia7ck/competitive-programming
AtCoder/abc308/c/main.py
main.py
py
247
python
en
code
0
github-code
90
73620508137
class Solution: # @param {string} path # @return {string} def simplifyPath(self, path): stack = [] res = '' for i in range(len(path)): end = i + 1 while end < len(path) and path[end] != '/': end += 1 sub = path[i+1:end] if len(sub) > 0: if sub == '..': ...
xiangzuo2022/leetcode_python
python/71.simplify_path.py
71.simplify_path.py
py
1,374
python
en
code
0
github-code
90
17374932941
import requests from django.shortcuts import render, redirect from django.views.generic.base import View from .forms import NewOrdertForm from .models import Category, Product, ShopInfo, TelegramBot from main.models import Contact def catalog(request): """Страница каталог""" products = Product.objects.all() ...
Eldar1988/mir_divanov
HelloDjango/shop/views.py
views.py
py
2,142
python
en
code
0
github-code
90
18066593969
import math import collections import fractions import itertools import functools import operator def solve(): s = input() edge = collections.deque() for i in s: if i == "0": edge.append("0") elif i == "1": edge.append("1") elif len(edge) > 0: edg...
Aasthaengg/IBMdataset
Python_codes/p04030/s077220293.py
s077220293.py
py
406
python
en
code
0
github-code
90
39804163775
# -*- coding:utf-8 -*- from websocket import create_connection import sys import io import picamera import numpy as np import base64 import cv2 CAMERA_WIDTH = 320 CAMERA_HEIGHT = 240 stream = io.BytesIO() camera = picamera.PiCamera() camera.resolution = (CAMERA_WIDTH,CAMERA_HEIGHT) def Capture(): camera.captur...
YonDeraPP/sotsuken
ws_client.py
ws_client.py
py
723
python
en
code
0
github-code
90
22126271946
# You will be given a number and you will need to return it as a string in Expanded Form. For example: # expanded_form(12) # Should return '10 + 2' # expanded_form(42) # Should return '40 + 2' # expanded_form(70304) # Should return '70000 + 300 + 4' # NOTE: All numbers will be whole numbers greater than 0. def expand...
cloudkevin/codewars
expandedFormNumber.py
expandedFormNumber.py
py
559
python
en
code
1
github-code
90
9512423407
import numpy as np INPUT = """467..114.. ...*...... ..35..633. ......#... 617*...... .....+.58. ..592..... ......755. ...$.*.... .664.598..""" def parse_grid(input): return np.asarray([list(line) for line in input.split('\n')]) def find_gear_candidates(grid): candidates = [] for i in range(grid.shape[...
iptch/2023-advent-of-code
DHE/day3.py
day3.py
py
4,759
python
en
code
2
github-code
90
22074328125
"Functions implementing respond page editing" import collections from .... import editresponder, utils from skipole import ValidateError, FailPage, ServerError, GoTo, SectionData from .. import adminutils def _ident_to_str(ident): "Returns string ident or label" if ident is None: return '' i...
bernie-skipole/skilift
skilift/skiadmin/skiadminpackages/editresponders/editrespondpage.py
editrespondpage.py
py
58,966
python
en
code
0
github-code
90
30149630117
import os import sys import pytest def run_tests(args): year = args[1] day = int(args[2]) print("Running tests for puzzle {} {}".format(year, day)) pytest.main(["-v", "tests/aoc/aoc{}/test_q{:02d}.py".format(year, day)]) def main(): sys.path.append(os.path.join(os.getcwd())) run_tests(sys.ar...
ifosch/aoc-utils
aoc_utils/run_tests.py
run_tests.py
py
364
python
en
code
1
github-code
90
34356066510
antw1 = str(input('antwoord 1: ')) antw2 = str(input('antwoord 2: ')) #if antw1 == 'ja' and antw2 == 'ja': # doden = 2 #elif antw1 == 'ja' and antw2 == 'nee': # doden = 1 #elif antw1 == 'nee' and antw2 == 'ja': # doden = 1 #else: # doden = 5 #berekening if antw1 != antw2: doden = 1 elif antw1 == 'ja': ...
ArthurCallewaert/5WWIPython
06_Condities/Trolleyprobleem.py
Trolleyprobleem.py
py
377
python
en
code
0
github-code
90
4295604262
from rlutils import dic_2tex_table import yaml import matplotlib.pyplot as plt import numpy as np import pandas as pd import plotly.express as px import plotly.graph_objects as go import os, sys, re from pathlib import Path # pd.options.plotting.backend='plotly' from rlutils import * from rlutils.plot_utils import conf...
ss555/deepFish
0-identification-static/plots.py
plots.py
py
2,253
python
en
code
0
github-code
90
71794438697
import tornado.ioloop from tornado.escape import json_decode from tornado.web import RequestHandler, Application, url, RedirectHandler class BaseHandler(tornado.web.RequestHandler): def get_current_user(self): user_id = self.get_secure_cookie("user") if not user_id: return None return "张三" ...
LIMr1209/test
tornado/base.py
base.py
py
1,626
python
en
code
0
github-code
90
42219496031
import numpy as np #코딩해서 80 출력 #1. 데이터 x = np.array([[1,2,3], [2,3,4], [3,4,5], [4,5,6], [5,6,7], [6,7,8], [7,8,9], [8,9,10], [9,10,11], [10,11,12], [20,30,40], [30,40,50], [40,50,60]]) y = np.array([4,5,6,7,8,9,10,11,12,13,50,60,70]) x_pred=np.array([50,60,70]) print("x :...
TaeYeon-kim-ai/keras
keras27_LSTM_DNN.py
keras27_LSTM_DNN.py
py
2,179
python
en
code
0
github-code
90
6319385334
from part1 import File from part2 import Directory class Dataset(Directory): def __init__(self, name: str, max_size: int, category: str): super().__init__(name, max_size) self.category = category def get_category(self): return self.category def final_test(): file1 = File('...
goOdyaga/PYTHON
code4/part3.py
part3.py
py
2,226
python
en
code
0
github-code
90
18246248309
# E - Red and Green Apples from collections import deque X,Y,A,B,C = map(int,input().split()) P = list(map(int,input().split())) Q = list(map(int,input().split())) R = list(map(int,input().split())) P.sort(reverse=True) Q.sort(reverse=True) R.sort(reverse=True) P = deque(P) Q = deque(Q) R = deque(R) red,green = 0,0 ap...
Aasthaengg/IBMdataset
Python_codes/p02727/s536825375.py
s536825375.py
py
831
python
en
code
0
github-code
90
20804833657
import torch import clip from PIL import Image # 检查gpu device = "cuda" if torch.cuda.is_available() else "cpu" print("device state: ",device) # 加载模型 model, transform = clip.load("ViT-B/32", device=device) # 处理图片 image = transform(Image.open("/mnt/c/users/dwc20/pictures/dataset/search/flickr30k/test_img/36979.jpg"))....
mmllllyyy/multi_model_search
clip_test.py
clip_test.py
py
1,667
python
en
code
0
github-code
90
32409030976
import os badcase_txt = r'E:\Data\landmarks\HFB\test\badcase.txt' json_path = r'E:\Data\landmarks\HFB\HFB\annotations\person_keypoints_val2017.json' save_path = r'E:\Data\landmarks\HFB\test\crop_badcase.json' def main(): # 得到所有badcase的图片名 image_name_list = list() with open(badcase_txt, 'r') as f_txt: ...
Daming-TF/HandData
scripts/Data_Interface/halpe_full_body/draw_out_badcase_json.py
draw_out_badcase_json.py
py
565
python
en
code
1
github-code
90
15274591707
class Solution: def maximumBags(self, capacity: List[int], rocks: List[int], additionalRocks: int) -> int: for i in range(len(capacity)): capacity[i] -= rocks[i] capacity.sort() for i in range(len(capacity)): additionalRocks -= capacity[i] if additionalRoc...
kelvinleong0529/Leet-Code
2279-maximum-bags-with-full-capacity-of-rocks/2279-maximum-bags-with-full-capacity-of-rocks.py
2279-maximum-bags-with-full-capacity-of-rocks.py
py
442
python
en
code
3
github-code
90
40730330779
import tensorflow as tf import pickle import time import os from tensorflow.python.keras.layers import Dense, Embedding, Conv2D, Dropout, Masking from tensorflow.python.keras.regularizers import l1, l2 import numpy as np #原版 class ADMN(): def __init__(self,args): tf.set_random_seed(0) np.random.see...
wiio12/ADMN
Model/ADMN.py
ADMN.py
py
30,985
python
en
code
4
github-code
90
18541045409
from itertools import accumulate from collections import Counter n=int(input()) a=list(map(int,input().split())) a=[0]+a A=list(accumulate(a)) B=Counter(A) ans=0 for i in B: ans=ans+int((B[i]*(B[i]-1)/2)) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03363/s863473237.py
s863473237.py
py
217
python
en
code
0
github-code
90
23045412671
''' 923. 3Sum With Multiplicity Medium Given an integer array arr, and an integer target, return the number of tuples i, j, k such that i < j < k and arr[i] + arr[j] + arr[k] == target. As the answer can be very large, return it modulo 109 + 7. Example 1: Input: arr = [1,1,2,2,3,3,4,4,5,5], target = 8 Output: 20...
aditya-doshatti/Leetcode
3sum_with_multiplicity_923.py
3sum_with_multiplicity_923.py
py
942
python
en
code
0
github-code
90
18558931219
N,K = map(int,input().split()) ans = 0 for b in range(K+1,N+1): tmp = 0 multi = int(N/b) tmp += (b-K) * multi if K==0: tmp += max(0,N%b) else: tmp += max(0,(N%b-K+1)) ans += tmp print(ans)
Aasthaengg/IBMdataset
Python_codes/p03418/s014451154.py
s014451154.py
py
230
python
en
code
0
github-code
90
16543319519
import array import os import time import wasp from micropython import const TICK_PERIOD = const(6 * 60) DUMP_LENGTH = const(30) DUMP_PERIOD = const(DUMP_LENGTH * TICK_PERIOD) class StepIterator: def __init__(self, fname, data=None): self._fname = fname self._f = None self._d = data ...
wasp-os/wasp-os
wasp/steplogger.py
steplogger.py
py
4,091
python
en
code
752
github-code
90
5909488510
source(findFile("scripts", "dawn_global_startup.py")) source(findFile("scripts", "dawn_global_plot_tests.py")) source(findFile("scripts", "swt_treeitems.py")) source(findFile("scripts", "dawn_global_ui_controls.py")) # Start Function fitting on metalmix.mca def startFunctionFitting(): #Start using clean workspace ...
DawnScience/dawn-test
org.dawnsci.squishtests/suite_tools1d_functionfitting/shared/scripts/function_fitting_common.py
function_fitting_common.py
py
3,880
python
en
code
3
github-code
90
5423634237
import jittor as jt import jittor.nn as nn from dataset import TsinghuaDog from jittor import transform from jittor.optim import Adam, SGD from tqdm import tqdm import numpy as np from model import Net import argparse jt.flags.use_cuda=1 def train(model, train_loader, optimizer, epoch): model.train() tot...
Jittor/TsinghuaDogBaseline
main.py
main.py
py
3,388
python
en
code
9
github-code
90
18331868319
N=int(input()) L=list(map(int,input().split())) L = sorted(L) def binary_search(func, array, left=0): right=len(array)-1 y_left, y_right = func(array[left]), func(array[right]) if y_left==False:return 0 while True: middle = (left+right)//2 y_middle = func(array[middle]) if y_lef...
Aasthaengg/IBMdataset
Python_codes/p02888/s638158726.py
s638158726.py
py
615
python
en
code
0
github-code
90
34361093960
#documentation and comments for the main and create random array can be found in the mergeTime program import random import time def createRanArray(n): randArr = [None] * n for i in range(0, n): randArr[i] = random.randrange(10001) return randArr #Insert sort function takes in an array and sorts it #iterates t...
jwright303/Algorithm-Analysis
SortingAlgorithms/insertTime.py
insertTime.py
py
1,266
python
en
code
0
github-code
90
1303597880
# Create an empty adjacency list for each node in the graph graph = {} num_nodes = int(input("Enter number of nodes: ")) for node in range(num_nodes): graph[node] = [] # Add each edge to the adjacency list of its source and destination nodes num_edges = int(input("Enter number of edges: ")) for i in range(num_edge...
KunalNathani/prax
p_dfs.py
p_dfs.py
py
1,027
python
en
code
0
github-code
90
72676095338
from math import ceil avg_speed = float(input()) gas_for_100km = float(input()) total_1 = 384400 * 2 total = ceil(total_1 / avg_speed) total += 3 fuel = (gas_for_100km * total_1) / 100 print(total) print(f'{fuel:.0f}')
Yani-Jivkov/Basic-Python-Exams
EXAM2/2.1.py
2.1.py
py
238
python
en
code
0
github-code
90
73904907175
''' Prompt #1 Clusters of Activity # # Problem Link: https://repl.it/student/submissions/9814047 # Write a function that accepts a 2D plane as a dictionary. The dictionary represents a segment of a map, and it contains map coordinates as keys, and a count of outbreaks in the area as values. The map may be huge, which i...
campbellmarianna/Code-Challenges
python/abcs_course_remote/mod_9_prob.py
mod_9_prob.py
py
3,299
python
en
code
0
github-code
90
70779174058
import yaml import sys import os with open("settings.conf", "r") as ymlfile: cfg = yaml.full_load(ymlfile) courses_downloaded = [] with open(cfg["save_location"] + "course_list.txt", "r") as f: for line in f: course = line[:-1] courses_downloaded.append(course) for i in range(len(courses_downlo...
colbyjanecka/canvas-scraper
rename_folders.py
rename_folders.py
py
632
python
en
code
0
github-code
90
33702652057
# 문제 : 색칠하기 # 어린 토니킴은 색칠공부를 좋아한다. # 토니킴은 먼저 여러 동그라미와 동그라미 두 개를 연결하는 직선들 만으로 그림을 그리고 (모든 동그라미들 사이에 직선이 있을 필요는 없다), # 연결된 두 동그라미는 서로 색이 다르게 되도록 색을 칠하고자 한다. # 이 그림을 색칠하는데 필요한 최소의 색의 개수를 구하는 문제는 어렵기 때문에 토니킴은 2 가지 색상으로 색칠이 가능한지의 여부만을 알고 싶어한다. # 동그라미들의 번호와 동그라미들이 서로 연결된 직선에 대한 정보가 주어졌을 때, 이 동그라미들이 2 가지 색상으로 색칠이 가능한지 알아내자. im...
kimujinu/python_PS
13265.py
13265.py
py
1,389
python
ko
code
0
github-code
90
18535829499
import sys sys.setrecursionlimit(10 ** 6) def dfs(s, pos): global N, K ns = {} if len(A) > K: return for i in pos: ni = i + 1 if ni < N: x = s + S[ni] if x in ns: ns[x].append(ni) else: ns[x] = [ni] candida...
Aasthaengg/IBMdataset
Python_codes/p03353/s380139072.py
s380139072.py
py
810
python
en
code
0
github-code
90
9275603948
import os import pkg_resources import sys import imp ignore_types = [imp.C_EXTENSION, imp.C_BUILTIN] init_names = ['__init__%s' % x[0] for x in imp.get_suffixes() if x[0] and x[2] not in ignore_types] def caller_path(path, level=2): if not os.path.isabs(path): module = caller_module(level ...
mozilla-services/metlog-py
metlog/path.py
path.py
py
10,676
python
en
code
37
github-code
90
548197620
from django.shortcuts import render,get_object_or_404,redirect from django.contrib.auth.decorators import login_required from .models import Profile,Project from .forms import PostProject,UpdateUser,UpdateProfile,Votes from django.contrib.auth.models import User from rest_framework.views import APIView from rest_framew...
James19stack/awards
project/views.py
views.py
py
6,462
python
en
code
0
github-code
90
23470978741
import csv f = open('/Users/cdelbasso/Desktop/SPD4FX.csv', 'r') reader = csv.reader(f) spd = {} for row in reader: spd[row[0]] = {'Italian':row[1], 'Croatian':row[2], 'English':row[3]}
spirito123/SanPierinDictionary
SPD.py
SPD.py
py
193
python
en
code
0
github-code
90
42716613329
from django.contrib import admin from django.urls import path from student import views urlpatterns = [ path('/Signout',views.signout), path('/dashboard', views.index), path('/Signup',views.signup), path('/Login', views.Signin, name="login"), path('/Register',views.register), # path('/dashboard...
Prathm-s/PlacementMangementSystem
student/urls.py
urls.py
py
493
python
en
code
0
github-code
90
18309858739
import sys def solve(): input = sys.stdin.readline N = int(input()) S = input().strip("\n") Left = [set() for _ in range(N)] Right = [set() for _ in range(N)] Left[0] |= {S[0]} Right[N-1] |= {S[N-1]} for i in range(1, N): Left[i] = Left[i-1] | {S[i]} Right[N-i-1] = Right...
Aasthaengg/IBMdataset
Python_codes/p02844/s455333574.py
s455333574.py
py
578
python
en
code
0
github-code
90
70219890857
from pwn import * HOST, PORT = 'edu-ctf.zoolab.org', 30211 if args.HOST: HOST = args.HOST if args.PORT: PORT = args.PORT exe = context.binary = ELF('./easyheap/share/easyheap') libc = ELF('/lib/x86_64-linux-gnu/libc.so.6') if args.REMOTE: io = remote(HOST,PORT) else: env = {} io = process(exe.path) p...
nella17/NYCU-Secure-Programming-2021
Pwn/HW-2/easyheap/exploit.py
exploit.py
py
2,050
python
en
code
3
github-code
90
4295970182
# + import requests HEADERS = { "Accept": 'application/json', } BASE_URL = "https://data.brreg.no/enhetsregisteret/api/" def get_json(url, params={}): url = BASE_URL + url req = requests.Request("GET", url=url, headers=HEADERS, params=params) #print(req.url, req.headers, req.params) print("Full...
statisticsnorway/speshelse
experimental/brreg_api_test.py
brreg_api_test.py
py
553
python
en
code
0
github-code
90
2354928047
import numpy as np from place import Place from transition import Transition from scheduler import BLOCKED, FINISHED BEGINNING = 0 END = 1 ANYWHERE = -1 class Conveyor: def __init__(self, name, capacity, delay=0, exitPredicateFn = lambda p: True): self.capacity = capacity self.delayFn = lambda: d...
vparonov/rlwh
conveyor.py
conveyor.py
py
4,493
python
en
code
0
github-code
90
71823058538
class Scheduler(): def __init__(self, optimizer, lr, decay=0.3, lr_decay_epoch=100): """ Args: optimizer: optimizer to scheduler the parameters lr: initial learning rate decay: decay rate lr_decay_epoch: epoch each learning rate decay """ ...
haohq19/snn-assessment
tools/optimizer.py
optimizer.py
py
714
python
en
code
0
github-code
90
42940227572
"""Modul obsahující funkce týkající se Komens zpráv.""" from __future__ import annotations from datetime import datetime from typing import cast from bs4 import BeautifulSoup from bs4.element import Tag # Kvůli mypy - https://github.com/python/mypy/issues/10826 from ..bakalari import BakalariAPI, Endpoint, _registe...
Hackrrr/BakalariAPI
src/bakalariapi/modules/komens.py
komens.py
py
3,992
python
en
code
4
github-code
90
42008616083
__revision__ = "src/engine/SCons/Tool/yacc.py 5134 2010/08/16 23:02:40 bdeegan" import os.path import SCons.Defaults import SCons.Tool import SCons.Util YaccAction = SCons.Action.Action("$YACCCOM", "$YACCCOMSTR") def _yaccEmitter(target, source, env, ysuf, hsuf): yaccflags = env.subst("$YACCFLAGS", target=targe...
cloudant/bigcouch
couchjs/scons/scons-local-2.0.1/SCons/Tool/yacc.py
yacc.py
py
3,371
python
en
code
570
github-code
90
14641021383
#!/usr/bin/env python # _*_ coding:utf-8 _*_ ''' 随机生成1000个点,选取任意3个点组成三角形,问,如何判断其余的997个点在三角形内或外? ''' import numpy as np import random # 定义点 class Vertex(object): def __init__(self, x, y): self.x = x self.y = y def __str__(self): return ("x坐标:%s,y坐标:%s" % (self.x, self.y)) # "Fre...
ares5221/Data-Structures-and-Algorithms
09概率组合数学/02RandomPos/判断点是否在三角形内部.py
判断点是否在三角形内部.py
py
3,172
python
en
code
1
github-code
90
9779190700
#!/usr/bin/python import zipfile import io import urllib.request import json import zipfile import shutil def getZipData(url): result = urllib.request.urlopen(url) return result.read() url = 'https://raw.githubusercontent.com/VirtoCommerce/vc-modules/master/modules_v3.json' response = urllib.request.urlope...
VirtoCommerce/vc-module-training-docker
src/VirtoCommerce.TrainingModule.Web/InstallLatestModules.py
InstallLatestModules.py
py
935
python
en
code
5
github-code
90
29571909426
# Parts of this code were adapted from the pytorch example at # https://github.com/pytorch/examples/blob/master/reinforcement_learning/reinforce.py # which is licensed under the license found in LICENSE. import os import random # pytype: disable=import-error import gym import numpy as np import torch from absl import...
Surya-77/rl-snn-norse
reinforce.py
reinforce.py
py
8,395
python
en
code
0
github-code
90
5011453605
import os from datetime import datetime from unittest.mock import MagicMock from unittest.mock import PropertyMock from unittest.mock import patch import cauldron as cd from cauldron.session import exposed from cauldron.test import support from cauldron.test.support import scaffolds ROOT = 'cauldron.session.exposed' ...
sernst/cauldron
cauldron/test/projects/test_exposed.py
test_exposed.py
py
11,244
python
en
code
78
github-code
90
4483613818
from flask import render_template from . import main import plotly import plotly.graph_objs as go import json def create_plot(): trace_1 = go.Scatter( x=(1,2,3), y=(1,2,3), mode='lines+markers', name ='Player_1') tr...
rbekeris/databakery
Dash_app_0_1/Webapp/Bakerapp/main/views.py
views.py
py
746
python
en
code
0
github-code
90
18989244981
import psycopg2 from base64 import encode from numpy import disp try: conexion = psycopg2.connect( host = "localhost", port = "5432", user = "postgres", password = "2807289050109", dbname = "postgres" ) print("Conexión exitosa") except psycopg2.Error as...
kiwiii22/tareaprep1
P14.py
P14.py
py
1,493
python
es
code
0
github-code
90
5219369166
# -*-coding:utf-8 -*- import requests import json import folium #pip install folium def getSido(): url = 'https://www.starbucks.co.kr/store/getSidoList.do' resp = requests.post(url) #print(resp.json()) #print(resp.json()['list']) sido_json = resp.json()['list'] sido_code = list(ma...
YuDeokRin/Encore_Python
Python06/star/starbucks03.py
starbucks03.py
py
4,903
python
ko
code
0
github-code
90
39849008693
from trytond.model import ModelView, ModelSQL, fields from trytond.transaction import Transaction from trytond.pool import Pool from trytond.pyson import If, Eval, Bool import datetime __all__ = ['Domain', 'Renewal', 'DomainProduct'] class Domain(ModelSQL, ModelView): 'Domain' __name__ = 'internetdomain.doma...
NaN-tic/trytond-internetdomain
internetdomain.py
internetdomain.py
py
5,670
python
en
code
0
github-code
90
12675139791
"""Utility methods.""" import hashlib def equal_dicts(a, b, ignore_keys): """Compare two dicts, withholding a set of keys. From: http://stackoverflow.com/a/10480904/383744 """ ka = set(a).difference(ignore_keys) kb = set(b).difference(ignore_keys) return ka == kb and all(a[k] == b[k] for k in ...
radusuciu/ip2api
ip2api/utils.py
utils.py
py
826
python
en
code
1
github-code
90
1757847495
from django.db.models import Count from Level_Up_App.models import CareerSkills, CareerPosition, Skill, Job, GenericInfo, CareerPathMap, ChatbotVar from Level_Up_App.courserecommendationrules import CourseRecommender, SkillGapsFact, recommendedcourses from Level_Up_App.jobrecommendationrules import getJobRecommendation...
raymondng76/IRS-MR-RS-2019-07-01-IS1FT-GRP-Team10-LevelUp
SystemCode/Level_Up/Level_Up_App/chatbot_util.py
chatbot_util.py
py
12,615
python
en
code
2
github-code
90
13109668945
#Este programa irá calcula os juros compostos baseado em uma % de x parcelas de qualquer valor class Calculadora: def __init__(self, valor1=0.0, valor2=0.0): self.valor1= valor1 self.valor2= valor2 def calcular(self, quantidadeParcelas): valorParcela= (self.valor2)/quantidadeParcelas ...
YuriFogaca/EstudosPY
calculadoraComposto.py
calculadoraComposto.py
py
1,004
python
pt
code
0
github-code
90
35043100501
#! /usr/bin/python3 class DrNabi: father_of = "Dr.Ayoubzai" def __init__(self, job, marital): self.job = job self.marital = marital def __str__(self): return f"({self.job}, {self.marital})" def like_travel(self): print(like_travel) atal = DrNabi("Doctor", "mar...
atal2003/Python-Hack-script
linux/ninteenclass.py
ninteenclass.py
py
437
python
en
code
0
github-code
90
18283031369
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n = int(input()) cnt = [[0] * 10 for _ in range(10)] for i in range(1, n + 1): i = str(i) head = int(i[0]) foot = int(i[-1]) cnt[head][foot] += 1 ...
Aasthaengg/IBMdataset
Python_codes/p02792/s112589516.py
s112589516.py
py
519
python
en
code
0
github-code
90
42598355546
import re def matched(string): d = { '&&': 'and', '||': 'or' } return d[string.group(0)] pattern = re.compile(r'(?<=\s)&&(?=\s)|(?<=\s)\|\|(?=\s)') for _ in range(int(input())): print(re.sub(pattern, matched, input()))
praneeth14/Hackerrank
Python/Regex and Parsing/Regex Substitution.py
Regex Substitution.py
py
255
python
en
code
1
github-code
90
18548954009
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, K = map(int, readline().split()) if B - A + 1 < 2 * K: ans = list(range(A, B + 1)) else: ans = list(range(A, A + ...
Aasthaengg/IBMdataset
Python_codes/p03386/s651267619.py
s651267619.py
py
435
python
en
code
0
github-code
90
11523225301
import sqlite3 conn = sqlite3.connect("sqlite.db") print("Student id","Student name","Student class","Student fees") #inner join # data = conn.execute("SELECT f.st_id,s.st_name,s.st_class,f.fees_amount from fees as f inner join students as s on f.st_id=s.st_id ") #left join data = conn.execute("SELECT f.st_id,s.st_n...
mrcreator2022/python_database_sqlite3
join.py
join.py
py
506
python
en
code
0
github-code
90
7165686230
import numpy as np US_IMBLEARN = 'imblearn_undersampled' US_RANDOM = 'random_undersampled' US_NO = 'not_undersampled' SPECIES_ECOLI = 'Escherichia coli' SPECIES_SAUREUS = 'Staphylococcus aureus' SPECIES_KLEBSIELLA = 'Klebsiella pneumoniae' SPECIES_EPIDERMIS = 'Staphylococcus epidermis' ANTIBIOTIC_CIPROFLOXACIN ='Cip...
irmlerjo/maldi-prediction
const.py
const.py
py
17,266
python
en
code
0
github-code
90
1301149986
import numpy as np class vmedian(object): def __init__(self, order=0, dimensions=None): """Compute running median of a video stream :param order: depth of median filter: 3^(order + 1) images :param dimensions: (width, height) of images :returns: :rtype: """ ...
laltman2/CNNLorenzMie
experiments/vmedian.py
vmedian.py
py
2,351
python
en
code
6
github-code
90
20752854713
## INFO ## ## INFO ## # Import python modules from json import load from math import radians # Import pop modules from db.models import Artist from db.database import initialise, session #------------------------------------------------------------------------------# def populate(path): # Initialise database ...
petervaro/pop
db/populate.py
populate.py
py
776
python
en
code
0
github-code
90
6472327971
def binary_search(arr, value): low = 0 high = len(arr)-1 while low >= 0 and high <= len(arr)-1 and low <= high: mid = (low+high)//2 if arr[mid] == value: return True elif value > arr[mid]: low = mid+1 else: high = mid-1 return False inp...
AishwaryaTalapuru/Data-Structures-Algorithms
Searching_techniques/Iterative/binary_search.py
binary_search.py
py
677
python
en
code
0
github-code
90
18814491827
import datetime as dt import lxml.html import tempfile import os import re from collections import defaultdict from openstates.scrape import Scraper, Bill, VoteEvent from openstates.utils import convert_pdf from openstates.exceptions import EmptyScrape from utils import LXMLMixin # from . import actions from .actions ...
openstates/openstates-scrapers
scrapers/la/bills.py
bills.py
py
12,028
python
en
code
820
github-code
90
71111360937
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 8 16:34:35 2018 @author: bernardo carvalho https://pypi.org/project/influxdb/ http://influxdb-python.readthedocs.io/en/latest/api-documentation.html#influxdb.DataFrameClient.write_points """ import epics import time import os import sys import ...
bernardocarvalho/isttok-epics
epics/isttok_influx.py
isttok_influx.py
py
4,564
python
en
code
0
github-code
90
5291439568
import logging import warnings from typing import Any, Dict, Optional from torch.utils.data import DataLoader from composer.core import DataSpec from composer.utils import MissingConditionalImportError, dist log = logging.getLogger(__name__) __all__ = ['build_streaming_c4_dataloader'] def build_streaming_c4_datal...
mosaicml/composer
composer/datasets/c4.py
c4.py
py
5,199
python
en
code
4,712
github-code
90
36275889917
# coding: utf-8 import time, datetime import os, json import numpy as np import matplotlib.pyplot as plt import nltk from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array from cs231n.rnn_layers import * from cs231n.captioning_solver import CaptioningSolver from cs231n.cl...
hccho2/cs231n-Assignment
assignment3/test-LSTM.py
test-LSTM.py
py
3,995
python
en
code
0
github-code
90
1622578155
import logging class Loggers: """ Application's logging interface. """ main_name = "ingestation_main_logger" main_fmt = "%(asctime)s [%(levelname)s]: %(message)s" console_fmt = f"\n{main_fmt}" def __init__(self, cli_options: dict): self.options = cli_options self.logger =...
LegenJCdary/ingeSTation
src/modules/outputs/loggers.py
loggers.py
py
2,029
python
en
code
1
github-code
90
36437158025
# -*- coding: utf-8 -*- from typing import Any, Generic, Iterable, Optional, Type, TypeVar, Union from decimal import Decimal from enum import Enum from operator import attrgetter from pydantic import ValidationError import requests from .config import config from .models import CurrencyInfo, FarmingPoolInfo, PairIn...
espdev/flatqube-client
flatqube/client.py
client.py
py
10,814
python
en
code
2
github-code
90
71177298217
import gi gi.require_version('Gtk', '4.0') from gi.repository import Gtk, Pango class DocumentStatsView(Gtk.Box): def __init__(self): Gtk.Box.__init__(self) self.set_orientation(Gtk.Orientation.VERTICAL) self.get_style_context().add_class('document-stats') description = Gtk.Label...
cvfosammmm/Setzer
setzer/workspace/sidebar/document_stats/document_stats_viewgtk.py
document_stats_viewgtk.py
py
1,242
python
en
code
362
github-code
90
21366567452
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler, StableDiffusionInstructPix2PixPipeline import torch import discord from discord.ext import commands import io import PIL import math import concurrent.futures import asyncio class ImageGenerator(commands.Cog): def __init__(self, bot): t...
Simon-Kotchou/DiscBot
DiffusionClient.py
DiffusionClient.py
py
4,394
python
en
code
1
github-code
90
27711857886
# importing the pygame module import pygame import random import os import time # initialize the pygame module pygame.init() # load and set the logo logo = pygame.image.load("logo.png") pygame.display.set_icon(logo) pygame.display.set_caption("Running Jack") # screen size WIDTH = 800 HEIGHT = 600 # colors YELLOW = (...
muhammadabdullah329/SideScollerPygame
sideScoller.py
sideScoller.py
py
3,872
python
en
code
0
github-code
90
2430465786
# 检查档案在不在 import os # operating system products = [] if os.path.isfile('products.csv'): print('yes') #读取档案 with open('products.csv', 'r', encoding = 'utf-8') as f: for line in f: if '商品, 价格' in line: continue #继续 name , price = line.strip().split(',') #先把换行符号去除,再用逗点当作切割的标准 products.append([name, pri...
ccpstcc4330/products
p.py
p.py
py
1,549
python
zh
code
0
github-code
90
75025564776
# -*- coding: utf-8 -*- from odoo import fields, models, api class ContextWizard(models.TransientModel): _name = "context.wizard" _description = "Context Wizard" first_name = fields.Char(string="First Name") middle_name = fields.Char(string="Middle Name") last_name = fields.Char(string="Last Nam...
muchhalaamit/custom_addons_15
library_management/wizards/context_wizard.py
context_wizard.py
py
669
python
en
code
0
github-code
90