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
26694182467
from collections import deque # Challenge 1 def balanced_symbols(input_string: str="")->bool: """ Checks whether an input string is properly balanced with respect to '(' and ')', '[' and ']' and '{' and '}'. The function ignores the symbols within comments, a comment starts with a '/*' and end...
alvarodiez20/challenge_adiez
cats_and_cheese.py
cats_and_cheese.py
py
10,495
python
en
code
0
github-code
90
38533972677
import pygame import random pygame.init() clock = pygame.time.Clock() WIN_WIDTH = 280 WIN_HEIGHT = 500 FPS = 1 BLACK = (0,0,0) GROUND_HEIGHT = 400 GROUND_SPEED = 2 SWING = 20 background_image = pygame.image.load("background.png") ground_image = pygame.image.load("ground.png") pipe_image = pygame.image.load("pip...
Poppynator/Flappy-Bird
game.py
game.py
py
4,435
python
en
code
0
github-code
90
39603083509
# Input: deadends = ["0201","0101","0102","1212","2002"], target = "0202" # Output: 6 # Explanation: # A sequence of valid moves would be "0000" -> "1000" -> "1100" -> "1200" -> "1201" -> "1202" -> "0202". # Note that a sequence like "0000" -> "0001" -> "0002" -> "0102" -> "0202" would be invalid, # because the wheels ...
konstantinosBlatsoukasRepo/leet-code-problems
bfs/open_the_lock.py
open_the_lock.py
py
2,271
python
en
code
0
github-code
90
13334870434
from rest_framework.serializers import\ ModelSerializer, SerializerMethodField from recommendations.models import * class RCSerializer(ModelSerializer): class Meta: fields = ( 'id', 'title', 'description', 'image', ) model = Recommendatio...
madjar-code/Career-Routes
backend/apps/recommendations/api/serializers.py
serializers.py
py
1,724
python
en
code
0
github-code
90
20532253195
# Devin Hurley # import math, pylab, random def fnc(x,mu): y = mu*x*(1-x) return y random.seed() N = 500.0 mu = [0.0]*500*20 ex = [0.0]*500*20 delMu = 0.01 ## move very slowly for i in range(500): m = i*delMu for j in range(20): x = random.random() for k in range(300): x =...
dhurley14/CSIS310
logMap2.py
logMap2.py
py
625
python
en
code
0
github-code
90
24657271425
''''Given an integer array nums, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: nums = [1,2,3,4,5,6,7], k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the right: [7,1,2,3,4,5,6] rotate 2 steps to the right: [6,7,1,2,3,4,5] rotate 3 steps to the right: [5,6,7,1,2,...
abz1997/algorithms
rotate_array.py
rotate_array.py
py
1,384
python
en
code
0
github-code
90
12874205246
# -*- coding: utf-8 -*- """ Group filters """ from django import template from django.core.urlresolvers import reverse from django.core.context_processors import request from django.db.models import Count from gorod.models import ArticleRubric register = template.Library() @register.inclusion_tag('gorod/templat...
karbachinsky/gorod_io
gorod/templatetags/group_filters.py
group_filters.py
py
1,094
python
en
code
1
github-code
90
30593423473
#!/usr/bin/env python from __future__ import unicode_literals import codecs import numpy as np def pad(sequences, pad_token='<pad>', pad_left=False): """ input sequences is a list of text sequence [[str]] pad each text sequence to the length of the longest :param sequences: :param pad_token: :param pad_l...
xalanq/chinese-sentiment-classification
elmoformanylangs/dataloader.py
dataloader.py
py
1,233
python
en
code
131
github-code
90
26327061955
import sys import io sys.setrecursionlimit(10**8) _INPUT = """\ 200000 314 318 """ sys.stdin = io.StringIO(_INPUT) readline = sys.stdin.readline N, M, P = map(int, input().split()) print(int((N-M) / P + 1))
Amano-take/Atcoder
300/10/318/A.py
A.py
py
207
python
en
code
0
github-code
90
5173612111
import random as rnd suits = ('Hearts', 'Diamonds', 'Spades', 'Clubs') numbers = ('2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A') values = {'2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, '10':10, 'J':10, 'Q':10, 'K':10, 'A':11} playing = True # Creating Cards # class Card: ...
ba1019/resume-projects
Blackjack.py
Blackjack.py
py
6,011
python
en
code
0
github-code
90
41154446861
from rest_framework import serializers from faces.models import Event, EventNotification class EventSerializer(serializers.ModelSerializer): """Event serializer to read.""" class Meta: model = Event fields = ( 'id', 'img', 'confidence', 'meta',...
vitasoftua/findface
src/faces/ws_serializers.py
ws_serializers.py
py
714
python
en
code
0
github-code
90
35729198528
#1. Дано целое число N(>0). Найти значение выражения # 1.1-1.2+1.3-...(N слагаемых, знаки чередуются). # Условный оператор не использовать. # term_p_sum = 0 # term_p = 1.1 # term_o_sum = 0 # term_o = -1.2 # N_num=int(input("Введите число больше 0: ")) # for i in range(0, N_num // 2): # term_p_sum += term_p # te...
Xqyat/PZ.py
Pz_4/Pz_4.py
Pz_4.py
py
1,002
python
ru
code
0
github-code
90
9662442092
import sys, json, os from threading import Thread from threading import Semaphore import queue writeLock = Semaphore(value=1) in_queue = queue.Queue() tree = json.loads(open(sys.argv[1]).read()) mapping = {} for otu in tree: for member in tree[otu]["member"]: shortname = tree[otu]["m...
dgg32/acido_tree
hpc_map_to_backbone.py
hpc_map_to_backbone.py
py
2,114
python
en
code
0
github-code
90
43508713497
import mmcv import numpy as np from os import path as osp import cv2 from mmdet.core.visualization import imshow_gt_det_bboxes def show_result_mtv2d(data_root, out_dir, result, eval_thresh, show=True, show_gt=True, show...
solapark/ddet
projects/mmdet3d_plugin/core/visualization/show_result_mtv2d.py
show_result_mtv2d.py
py
5,670
python
en
code
0
github-code
90
70040773738
import uuid import datetime from flask import json, jsonify, request from app.main import db from app.main.model import SmeUser def save_new_sme_user(data): sme_user = SmeUser.query.filter_by(email=data['email']).first() if not sme_user: new_sme_user = SmeUser( role_id=2, email...
bmaritim/float-transfer-python
app/main/service/sme_user_service.py
sme_user_service.py
py
3,231
python
en
code
0
github-code
90
21793053582
import copy # f = open('./input.txt') # arr = [[int(x) for x in row.split()] for row in f.readlines()] arr = [] try: while True: e = [int(x) for x in input().split()] arr.append(e) except EOFError: pass w = 0 h = 0 index = copy.deepcopy(arr) for i in range(len(arr)): for j in range(len(...
kaiwk/playground
online_judge/nju/week-1/2_max_child_matrix.py
2_max_child_matrix.py
py
807
python
en
code
3
github-code
90
70803535338
import warnings from unicodedata import category from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from bs4 import BeautifulSoup from time import sleep import datetime import pandas as pd import numpy as np import requests import axios import json...
Arc1el/2023AWSCloudBootcamp
Crawler/crawler.py
crawler.py
py
8,473
python
en
code
0
github-code
90
20260528381
# Good vs Evil # https://www.codewars.com/kata/52761ee4cffbc69732000738 from unittest import TestCase good_values = [1, 2, 3, 3, 4, 10] evil_values = [1, 2, 2, 2, 3, 5, 10] def evaluating(counts, target_values): return sum([target_values[v[0]] * int(v[1]) for v in enumerate(counts.split(" "))]) def goodVsEvil...
polyglotm/coding-dojo
coding-challange/codewars/6kyu/2020-04-15~2020-06-01/good-vs-evil/good-vs-evil.py
good-vs-evil.py
py
1,137
python
en
code
2
github-code
90
41330652624
import logging import sys from logging.handlers import TimedRotatingFileHandler import os FORMATTER = logging.Formatter("%(asctime)s - %(name)-20s - %(lineno)d - %(levelname)-8s - %(message)s") def get_logger(logger_name, log_file_path): def configure_handlers(): console_handler = logging.StreamHandler(s...
VLU19/sync-folders
logger.py
logger.py
py
947
python
en
code
0
github-code
90
22126261186
# You want to create secret messages which can be deciphered by the Decipher this! kata. Here are the conditions: # Your message is a string containing space separated words. # You need to encrypt each word in the message using the following rules: # The first letter needs to be converted to its ASCII code. # The seco...
cloudkevin/codewars
encryptThis.py
encryptThis.py
py
1,139
python
en
code
1
github-code
90
17569479276
#!/usr/bin/python3 """Script that takes our Github credentials""" import requests from sys import argv from requests.auth import HTTPBasicAuth if __name__ == '__main__': response = requests.get('https://api.github.com/user', auth=HTTPBasicAuth(argv[1], argv[2])) if response.status...
Miguel22247/holbertonschool-higher_level_programming
0x11-python-network_1/10-my_github.py
10-my_github.py
py
433
python
en
code
2
github-code
90
12132504922
from Cart import Cart from ProductInventoryImpl import ProductInventoryImpl from Product import Product class CartImpl(Cart): _userCart = {} def getAllCartItems(self, userId): if userId in self._userCart.keys(): return self._userCart[userId] else: raise Exception("User...
Vishesh-Mukherjee/Gdzone-V2
src/main/CartImpl.py
CartImpl.py
py
1,276
python
en
code
0
github-code
90
43718328981
# dict = {'Emp': {'GK': {'ID': '001', 'Salary': '2000', 'Designation': 'ASE'}, # 'KK': {'ID': '002', 'Salary': '2500', 'Designation': 'Tech-Lead'}, # 'AK': {'ID': '003', 'Salary': '3000', 'Designation': 'Senior Tech-Lead'}, # 'OK': {'ID': '004', 'Salary': '4000', 'Desi...
KrishnakanthSrikanth/Python_Simple_Projects
Test.py
Test.py
py
1,990
python
en
code
0
github-code
90
34675700376
import pandas as pd import numpy as np from tqdm import tqdm import xmltodict, json from itertools import product from collections import defaultdict from utils.utils import timer import pickle import pandas as pd from deuces.evaluator import * from deuces.deck import * from collections import defaultdict, OrderedDict...
snowii/nash_srv
ml/a2_board/b0_common.py
b0_common.py
py
12,479
python
en
code
0
github-code
90
18386542569
from collections import Counter n=int(input()) if n==1: print(1) exit() xy=[tuple(map(int,input().split())) for _ in range(n)] # print(xy) xy.sort() # print(xy) l=[] for i in range(n-1): for j in range(i+1,n): l.append((xy[j][0]-xy[i][0],xy[j][1]-xy[i][1])) #most_common(): (要素、出現回数)という形のタプルを出現回数順に並べたリストを返す ...
Aasthaengg/IBMdataset
Python_codes/p03006/s396296767.py
s396296767.py
py
423
python
en
code
0
github-code
90
21746855518
import requests import json from tqdm import tqdm TMDB_API_KEY = '9186d5ace54e142f44d4f7e7a96d0043' with open("../api/fixtures/actor.json", "r", encoding="UTF-8") as f: actors = json.load(f) with open("../api/fixtures/director.json", "r", encoding="UTF-8") as f: directors = json.load(f) with open("../api/fix...
vinitus/WhatToWatch
final-pjt-back/request_data/1.py
1.py
py
2,638
python
en
code
0
github-code
90
25892960589
# lista de restaurantes def busca_restaurantes(lista, categoria, valor): i = 0 resultado = [] while i < len(lista): n = lista[i][0] c = lista[i][1] a = lista[i][2] gm = lista[i][3] if categoria == 'culinaria': if c == valor: resultado.appe...
kikepuppi/2023.1-Dessoft
Aula 6/listarestaurantes.py
listarestaurantes.py
py
921
python
pt
code
0
github-code
90
11196858365
import typer import os import time from githubclass import Github from typing import Optional def main(name: str, gith: Optional[str] ) -> str: typer.secho('Creating Your Project! 📦', fg=typer.colors.BRIGHT_MAGENTA, bold=True) cuf = os.getcwd() os.mkdir(name) pro_file = cuf + f'/{name}' time.sleep(1) os...
pratushrai0309/cpro
cpro/main.py
main.py
py
1,571
python
en
code
1
github-code
90
73052606376
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Feb 28 15:11:37 2020 @author: jain """ import numpy as np import matplotlib.pyplot as plt import time ## Import extra files import Cal_moments_samples as MOM import transform_domain as td import Initial_lam as Initlam import GLeg_pts as GL import pdf_M...
axj307/Moment-Calculation
Airplane2D/Airplane2D.py
Airplane2D.py
py
12,540
python
en
code
0
github-code
90
72810199977
#!/usr/bin/python # -*- coding: utf-8 -*- from flask import Flask, request, Response import json import traceback from toy.module_a.logic import cut from toy.utils.exception import * from toy.utils.logger import LoggerFactory from toy.utils.timer import Timer app = Flask(__name__) # create a Flask instan...
simoncos/practical-python
rest-api-deploy/toy_project_v2/toy/toy/__init__.py
__init__.py
py
2,673
python
en
code
7
github-code
90
42227143700
from edge import DummyEdgeEnd from simulation_event import AbstractSimulationEvent from stats import TripStats class AbstractAntMove(AbstractSimulationEvent): def __init__(self, ant, origin, destination, end_time, pheromone_to_drop, trip_stats): self.ant = ant self.origin = origin self.dest...
ppolewicz/ant-colony
antcolony/ant_move.py
ant_move.py
py
3,648
python
en
code
0
github-code
90
35176446416
from letters import Letter from letter_box import LetterBox from postoffice import PostOffice class Person: def __init__(self, addressee=None, letter=None): self._letter = letter self._addressee = addressee def deliver_letter(self, location=False, post_office=None, letter_box=None): ...
SamW2121/C-App-Prog-Python-AT2
C-App-Prog-Python-AT2/person.py
person.py
py
1,064
python
en
code
0
github-code
90
18028016679
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(): N = int(readline()) S = readline().strip() x = ans = 0 for s in S: if s == 'I': x += 1 if x > ans: ...
Aasthaengg/IBMdataset
Python_codes/p03827/s259561193.py
s259561193.py
py
444
python
en
code
0
github-code
90
28857865135
# The mono-alphabetic substitution cipher (to encrypt and decrpt text) #Predefine values PDC = "XEUADNBKVMROCQFSYHWGLZIJPT" PDP = "abcdefghijklmnopqrstuvwxyz" def Decryption(a): for i in range(len(PDC)): if a[0]==PDC[i]: print(PDP[i], end="") break def Encription(a): for ...
vinodkumavat/Cryptography
Mono-alphabetic-substitution-cipher/Main.py
Main.py
py
516
python
en
code
0
github-code
90
35281076807
import numpy as np import torch class Normalize(object): def __call__(self, sample): label, wavname, mfcc = sample['label'], sample['wavname'], sample['mfcc'] mean = np.mean(mfcc[0]) std = np.std(mfcc[0]) if std>0: mfcc[0] = (mfcc[0]-mean)/std mean = np.mean(mfcc[1]) std = np.std(m...
zili98/ELEC576-Deep-Learning-Final-Project
src/utils/transforms.py
transforms.py
py
1,377
python
en
code
0
github-code
90
18275268029
from sys import stdin from functools import lru_cache N = int(stdin.readline().rstrip()) K = int(stdin.readline().rstrip()) @lru_cache(None) def f(N, K): #大きい桁から小さい桁へ if K < 0: return 0 if N < 10: if K == 0: # 0のみ return 1 elif K == 1: # 例えばN=4 なら...
Aasthaengg/IBMdataset
Python_codes/p02781/s515810955.py
s515810955.py
py
703
python
ja
code
0
github-code
90
18200230479
a, v = [int(i) for i in input().split()] b, w = [int(i) for i in input().split()] t = int(input()) if w >= v: print("NO") exit() #print((b-a) / (v-w)) if b > a: if a + v*t >= b + w*t: print("YES") else: print("NO") else : if a - v*t <= b - w*t: print("YES") else: print("NO")
Aasthaengg/IBMdataset
Python_codes/p02646/s549465814.py
s549465814.py
py
308
python
en
code
0
github-code
90
14412535470
from typing import TYPE_CHECKING, Any, Dict, Type, TypeVar, Union import attr from ..types import UNSET, Unset if TYPE_CHECKING: from ..models.code_name_pair import CodeNamePair from ..models.post_order_line_free_values import PostOrderLineFreeValues from ..models.post_order_line_prices import PostOrderL...
Undefined-Stories-AB/ongoing_wms_rest_api_client
ongoing_wms_rest_api_client/models/post_order_line.py
post_order_line.py
py
7,972
python
en
code
1
github-code
90
73879761898
import csv import random CostMed = [] DistMed = [] RateMed = [] RecMed = [] def fitness(cost,distance,rating): return 0.2*float(cost)+0.4*distance+0.4*float(rating) with open(r"assets/Hospital_Data.csv","r") as file: readdata=csv.reader(file) data = list(readdata) data.pop(0) costdata = sorted(da...
AdvaySanketi/MedIQal
assets/datatime.py
datatime.py
py
1,685
python
en
code
0
github-code
90
5865595937
import dataclasses import uuid import typing import io import struct import cbor2 import json import base64 import binascii import hashlib import certvalidator import datetime import cryptography.hazmat.primitives.asymmetric.rsa import cryptography.hazmat.primitives.asymmetric.padding import cryptography.hazmat.primiti...
AS207960/python-webauthn
src/webauthn/attestation.py
attestation.py
py
19,606
python
en
code
4
github-code
90
3492060911
import pandas as pd import numpy as np df1 = pd.read_csv("rvtoolcom.csv") df2 = pd.read_csv("limpa_usa.csv") df3 = pd.read_csv("limpa_canada.csv") result = df1.append(df2).append(df3) #df = df.drop_duplicates(subset='favorite_color', keep="first") result = result.drop_duplicates(subset='address', keep="first") res...
polltter/RV
Proxy+Tool/junta.py
junta.py
py
362
python
en
code
0
github-code
90
19514626195
from psycopg2 import sql import bcrypt def query_select_fields_from_table(table: str, columns: list = None) -> sql.Composed: """Returns an executable SQL SELECT statement. At execution, it fetches the data from the selected column(s) from a table. Parameters: table (str): Table name colum...
CodecoolGlobal/ask-mate-3-python-mllorand
util.py
util.py
py
7,013
python
en
code
0
github-code
90
32619910768
# Eliza Knapp, Rachel Xiao, Thomas Yu # SoftDev # K05 -- Print A SoftDev Student's Name (Amalgamated) # 2021-09-27 ''' Summary: - How to approach the list of names - Read in names from a text file instead of having list created with names - Allows the lists to be changed easily - One text file per period ...
thomasyu21/Workshop
05_py/printNameAmalgamate.py
printNameAmalgamate.py
py
2,940
python
en
code
0
github-code
90
72273825896
import json from channels.generic.websocket import AsyncWebsocketConsumer from asgiref.sync import sync_to_async from django.contrib.auth.models import Permission from chatapp.models import Room,Message,User from ventes.models import Comment, Vente class ChatConsumer(AsyncWebsocketConsumer): async def connect(se...
vanelleNgadjui/CaPotage
core/consumers.py
consumers.py
py
3,511
python
en
code
0
github-code
90
23557134053
# 练习代码 # coding=utf-8 import requests from bs4 import BeautifulSoup import pickle # # url = 'http://www.mzitu.com/26685' # header = { # 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 ' # '(KHTML, like Gecko) Chrome/50.0.2661.102 UBrowser/6.1.2107.204 Safari/537.36', # ...
programday/crawler
练习小例子/爬取妹子网.py
爬取妹子网.py
py
6,800
python
zh
code
6
github-code
90
30790482268
# -*- coding: utf-8 -*- # 因为是学习 python, 所以用了很多 print() 来观察 import os, shutil, glob source_dir = "images/" # 透过 os 模组来取得 / 目录相关状态 disk = os.statvfs("/") print(disk) # 目前可用空间计算 freespace = disk.f_bsize * disk.f_blocks print(freespace) # 透过 glob 模组来取得目前档案, 以 list 型态存放 pngfiles = glob.glob(source_dir+"*.png") jpgfiles = ...
LukaHuang/LearnPython
books/Python程式設計實務_博碩/chapter5/5-2.py
5-2.py
py
1,961
python
zh
code
null
github-code
90
39750084101
import calendar from io import StringIO import boto3 import discord from discord.ext import commands, tasks import numpy as np import pandas as pd import datetime import re import asyncio import os target_guild_id = 730215239760740353 target_channel_id = 806691390372708362 main_embed = None access_key_id = os.envir...
chanelton/dssdiscordbot
cogs/checkingPoints.py
checkingPoints.py
py
5,977
python
en
code
1
github-code
90
21484335652
#Project Euler Number 25 #What is the first term in the Fibonacci sequence to contain 1000 digits?# #David Etler #22 NOV 2011 f1=1 f2=1 c=2 d=0 while d == 0: i=f1+f2 f1=f2 f2=i if len(str(i)) == 1000: d=1 c+=1 print [c, len(str(i))]
davidretler/Project-Euler-Solutions
python/p25.py
p25.py
py
259
python
en
code
0
github-code
90
28066292217
import pytest from selenium import webdriver from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager driver = None # from selenium.webdriver.firefox.service import Service # Parsing switches to the python cmd line def pytest_addoption(parser): parser.addoption(...
dechan84/PythonSeleniumFrontEnd
test/conftest.py
conftest.py
py
2,907
python
en
code
1
github-code
90
2366610636
from django.urls import path , include from django.contrib import admin from .views import saludo, resgistroPaciente, resgistroMedico, modificar, modificar2,modificarMedico,modificarMedico2,elimindarcli,registroContacto from .views import saludo2, gestion, servicios, nosotros from django.conf import settings fro...
aj130142/pagina-web
web/usuarios/urls.py
urls.py
py
1,162
python
es
code
0
github-code
90
34871900749
from typing import List from collections import Counter num_friends = [100.0, 49, 41, 40, 25, 21, 21, 19, 19, 18, 18, 16, 15, 15, 15, 15, 14, 14, 13, 13, 13, 13, 12, 12, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, ...
ilirsheraj/DataScienceScratch
chapter_05_Statistics/central_tendency.py
central_tendency.py
py
2,344
python
en
code
0
github-code
90
18285608389
#pdf見た n = int(input()) xl = [list(map(int,input().split())) for i in range(n)] sf = [] choice = -1e+9 for x,l in xl: sf.append([x-l,x+l]) sf.sort(key=lambda x:x[1]) cnt = 0 for s,f in sf: if choice <= s: cnt += 1 choice = f print(cnt)
Aasthaengg/IBMdataset
Python_codes/p02796/s341082845.py
s341082845.py
py
272
python
en
code
0
github-code
90
18487936739
import math import sys MOD = 1000000007 n, m = map(int, input().split()) if n == 1: print(m) sys.exit() ans = 1 for i in range(1, int(math.sqrt(m))+1): if m % i == 0: j = m / i if i <= m/n: ans = max(ans, i) if j <= m/n: ans = max(ans, j) print(int(ans))
Aasthaengg/IBMdataset
Python_codes/p03241/s037429924.py
s037429924.py
py
319
python
en
code
0
github-code
90
16314392443
import argparse from pathlib import Path import mrcfile from skimage import exposure import skimage import skimage.io import tifffile parser = argparse.ArgumentParser(description="Convert MRC files") parser.add_argument("--raw", default="raw", help="The input location of the raw MRC files") parser.add_argument("--ti...
milliams/thin_filament_data
convert_tiff.py
convert_tiff.py
py
1,049
python
en
code
0
github-code
90
43622968401
import nltk import string import pandas as pd import seaborn as sns from sklearn import svm from nltk import tokenize import matplotlib.pyplot as plt from wordcloud import WordCloud from nltk.corpus import stopwords from sklearn.pipeline import Pipeline from sklearn.naive_bayes import MultinomialNB from sklearn.tree im...
Fake-News-Detection-2B5/ai-1
Week 1 Run/main.py
main.py
py
5,982
python
en
code
0
github-code
90
26079305035
import numpy as np import matplotlib.pyplot as plt import logging import sys import src.config as config def get_console_handler(): console_handler = logging.StreamHandler(sys.stdout) console_handler.setFormatter(config.LOG_FORMATTER) return console_handler def get_file_handler(file_path): file_handl...
isaadbashir/coarse_segmentation
src/utils.py
utils.py
py
4,726
python
en
code
0
github-code
90
18410074689
import sys #input = sys.stdin.buffer.readline def main(): N = int(input()) AB = [0,0,0] ans = 0 for _ in range(N): s = input() l = len(s) if s[0] == "B" and s[-1] == "A": AB[2] += 1 else: if s[0] == "B": AB[1] += 1 if s...
Aasthaengg/IBMdataset
Python_codes/p03049/s482614109.py
s482614109.py
py
624
python
en
code
0
github-code
90
42970484847
# BH1750 Documentation: https://www.mouser.com/datasheet/2/348/bh1750fvi-e-186247.pdf # SG90 Documentation : http://www.ee.ic.ac.uk/pcheung/teaching/DE1_EE/stores/sg90_datasheet.pdf from machine import I2C, Pin, PWM import time class BH1750NotFoundError(Exception): pass class BH1750(): # light intensity sensor ...
Math3mat1x/sloth-curtains
sensors.py
sensors.py
py
4,145
python
en
code
1
github-code
90
23338482714
import requests from bs4 import BeautifulSoup class GoNaver(): def sijak(self): url = "https://datalab.naver.com/keyword/realtimeList.naver?ahe=all" page = requests.get(url, headers={ 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko'}) # 서비스에 ...
SolDDAENG/py_pandas
pack2/bs09.py
bs09.py
py
796
python
ko
code
0
github-code
90
40707845070
class InputCheck: @classmethod def check_location_coordinate(cls, request) -> str: """ 取得 request 驗證參數並回傳 :params request (flask.request): request instance """ request_body = request.get_json() location = request_body.get('location') lat, long = map(lambd...
Real-time-On-street-Parking-System/Backend
src/InputCheck.py
InputCheck.py
py
565
python
en
code
0
github-code
90
18566355619
from collections import deque Y, X = map(int, input().split()) Map = list(input() for _ in range(Y)) def bfs(sy, sx, gy, gx): seen = list([-1]*X for _ in range(Y)) queue = deque() queue.append((sy, sx)) seen[sy][sx] = 0 while queue: y, x = queue.popleft() search_around(y, x, seen, ...
Aasthaengg/IBMdataset
Python_codes/p03436/s232465155.py
s232465155.py
py
876
python
en
code
0
github-code
90
5543987452
# 복습 횟수:0, 00:10:00, 복습필요X import sys si = sys.stdin.readline N = int(si()) myset = set() li = list(map(int, si().split())) for elem in li: myset.add(elem) print(len(myset))
SteadyKim/Algorism
language_PYTHON/codetree/lv5_hashset_서로_다른_숫자.py
lv5_hashset_서로_다른_숫자.py
py
196
python
en
code
0
github-code
90
18428506569
# D - We Like AGC from collections import defaultdict MOD = 10**9+7 N = int(input()) charactors = ['A', 'G', 'C', 'T'] # dp[l][s] := 長さがlで、末尾3文字がsである文字列の個数 dp = [defaultdict(int) for _ in range(N+1)] # 無関係の文字で初期化しておく dp[0]['ZZZ'] = 1 # NGケース: AGC, ACG, GAC, A?GC, AG?C def check(s, c): if c=='C': if s[1...
Aasthaengg/IBMdataset
Python_codes/p03088/s394609379.py
s394609379.py
py
965
python
ja
code
0
github-code
90
73844657576
import matplotlib.pyplot as plt def plotData(x, y): """Plots the data points x and y into a new figure """ training_data_plot = plt.plot(x, y, linestyle='None', color='red', marker='x', markersize=10, label="Training data") plt.xlabel('Profit in $10,000') plt.ylabel('Population of city in 10,000s')...
hzitoun/machine_learning_from_scratch_matlab_python
algorithms_in_python/week_2/ex1/plotData.py
plotData.py
py
382
python
en
code
30
github-code
90
28846335793
import json import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt # from matplotlib.font_manager import _rebuild # # _rebuild() #reload一下 mpl.use('agg') plt.rcParams['font.sans-serif'] = ['SimSun'] plt.rcParams['axes.unicode_minus'] = False # 解决负号'-'显示为方块的问题 train_final_lozz = [] val_final_lo...
NileZhou/NHG
summarunner_weather/little/checkpoints/stat.py
stat.py
py
1,579
python
en
code
1
github-code
90
72596056937
#link https://leetcode.com/problems/boats-to-save-people/ class Solution: def numRescueBoats(self, people, limit): people.sort() left = 0 right = len(people)-1 boats_number = 0 while(left<=right): if(left==right): boats_number+=1 ...
chandanverma07/Python_LeetCodeSolution
BoatstoSavePeople_881.py
BoatstoSavePeople_881.py
py
498
python
en
code
0
github-code
90
652577689
from django.shortcuts import redirect, render from django.http import HttpResponse from django.views import View from django.views.generic.detail import DetailView from django.views.generic.list import ListView from django.contrib.auth.models import User from .forms import ContactForm from .models import Category, Pos...
27b/django-modern-blog
blog/views.py
views.py
py
6,604
python
en
code
0
github-code
90
15992961654
def minimum_score(mt1_score, mt2_score, desired_grade, ec_points = 0, recovery_points = 0): grade_bins = {'A+':0, 'A':15,'A-':30,'B+':50,'B':75,'B-':95,'C+':105,'C':115,'C-':125,'D+':130,'D':135,'D-':140} # max points that can be lost for each letter grade assert desired_grade in grade_bins, "Your desired_grad...
shoumikc/cs61a-final-exam-calculator
calculator.py
calculator.py
py
2,166
python
en
code
0
github-code
90
72910589416
from yogi import read from turtle import * # Dibuixa un cercle. def cercle(r): circle(r) # Dibuixa un quadrat. def quadrat(c): i = 1 while i <= 4: forward(c) left(90) i = i + 1 # Dibuixa un rectangle. def rectangle(a, b): i = 1 while i <= 2: forw...
lluc-palou/ap1-jutge
beginning/P33134.py
P33134.py
py
780
python
ca
code
0
github-code
90
4670558059
#!/usr/bin/python3 """a class Student that defines a studen""" class Student: """Public instance attributes""" def __init__(self, first_name, last_name, age): self.first_name = first_name self.last_name = last_name self.age = age def to_json(self): dictionnary = {} ...
Nadely/holbertonschool-higher_level_programming
python-input_output/9-student.py
9-student.py
py
426
python
en
code
0
github-code
90
18242224069
#!/usr/bin python3 # -*- coding: utf-8 -*- import sys input = sys.stdin.readline def make_divisors(n): divisors = [] for i in range(2, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) return divisors def main(): N=i...
Aasthaengg/IBMdataset
Python_codes/p02722/s530279636.py
s530279636.py
py
692
python
en
code
0
github-code
90
74091629737
""" csv_to_catalog is used to parse, validate and import item data from a CSV file into a json peji catalog. """ import os import csv import json import sys import requests from datetime import date from peji import buttons PUBLISH_DATE_ENV_VAR = 'PUBLISH_DATE' IMAGE_URL_PREFIX_ENV_VAR = 'IMAGE_URL_PREFIX' IMAGE_URL...
darkowlzz/peji
peji/csv_to_catalog.py
csv_to_catalog.py
py
9,633
python
en
code
0
github-code
90
72555450858
import os import pathlib import sys def prepare_plaidml(): # Linux if installed plaidml with pip3 install --user if sys.platform.startswith("linux"): local_user_plaidml = pathlib.Path("~/.local/share/plaidml/").expanduser().absolute() if local_user_plaidml.exists(): os.environ["RUNF...
invesalius/invesalius3
invesalius/segmentation/deep_learning/utils.py
utils.py
py
2,761
python
en
code
536
github-code
90
10485148994
import csv # READ # with open("data/addresses.csv") as csvfile: # reader = csv.reader(csvfile, skipinitialspace=True) # for row in reader: # print(row[1]) # with open("data/biostats.csv") as csvfile: # reader = csv.DictReader(csvfile, skipinitialspace=True) # for row in reader: # # ro...
trouni/batch-719
lectures/data-sourcing/csv_demo.py
csv_demo.py
py
781
python
en
code
1
github-code
90
21034024432
from tkinter import * expression = "" def press(num): global expression expression = expression + str(num) equation.set(expression) def equalpress(): try: global expression total = str(eval(expression)) equation.set(total) expression = "" except: equation...
helenamagaldi/projects_python
Calculator/main.py
main.py
py
528
python
en
code
3
github-code
90
18363674879
N = int(input()) LP = list(map(int, input().split())) LPS = [] LPS = sorted(LP) cnt = 0 for i in range(N): if LP[i] != LPS[i]: cnt += 1 if cnt == 3: print("NO") exit() print("YES")
Aasthaengg/IBMdataset
Python_codes/p02958/s082951606.py
s082951606.py
py
227
python
en
code
0
github-code
90
18302396679
#!/usr/bin/env python n = int(input()) if n%2 == 1: print(0) exit() mp = tmp = 0 while True: if 5**tmp > n: break mp = tmp tmp += 1 ans = 0 for i in range(1, mp+1): ans += n//(2*(5**i)) print(ans)
Aasthaengg/IBMdataset
Python_codes/p02833/s114723796.py
s114723796.py
py
237
python
en
code
0
github-code
90
2895246832
quant=int(input("сколько билетов планируете купить:")) count=0 for i in range(1, quant+1): text='возраст ' + str(i) + ' клиента:' age = int(input (text)) if age >25: count += 1390 print ("стоимость билета 1390 рублей") else: if age>=18: count += 990 pr...
frankenhtejn/origin
main.py
main.py
py
814
python
ru
code
0
github-code
90
18103299019
def gcd(a, b): """calculate the greatest common divisor of a, b >>> gcd(54, 20) 2 >>> gcd(147, 105) 21 >>> gcd(100000002, 39273000) 114 """ if a > b: a, b = b, a if a == 0: return b return gcd(b % a, a) def run(): a, b = [int(i) for i in input().split...
Aasthaengg/IBMdataset
Python_codes/p02256/s422498097.py
s422498097.py
py
385
python
en
code
0
github-code
90
18360592139
N = int(input()) H = list(map(int, input().split())) flg = 1 for i in range(N-1): if H[i+1] - 1 >= H[i]: H[i+1] -= 1 elif H[i+1] < H[i]: flg = 0 break if flg == 1: print('Yes') elif flg == 0: print('No')
Aasthaengg/IBMdataset
Python_codes/p02953/s235802736.py
s235802736.py
py
244
python
en
code
0
github-code
90
29450566289
#!/usr/bin/env python from operator import itemgetter """ conflates 'objective' into neutral """ def conflate (tweetData, trainingExList, conf): dictSent = {} neg = 0.0 pos =0.0 neutral =0.0 obj =0.0 objNeut =0.0 for t in trainingExList: if len(tweetData['tweets'][t]['answers']) =...
dyelsey/SemEval
helper.py
helper.py
py
1,518
python
en
code
0
github-code
90
1383961785
# # Sorteador de facturas para 'x' día de la semana # levanta los datos de un json, lee los datos y determina # de acuerdo al día parametrizado y la cantidad de gente, # los días que se debe llevar facturas y quien las lleva import json # from datetime import datetime import modules.facturas_classes as fClasse...
andresj-io/facturas
facturas.py
facturas.py
py
771
python
es
code
0
github-code
90
495505821
import requests from lxml import etree baseurl = "https://huggingface.co/models?" if __name__ == '__main__': #初始化拼接请求url url = '' #初始化结果列表 result_list = [] #封装的api前缀 base_api = "https://api-inference.huggingface.co/models/" model_url = "https://huggingface.co/" # 定制请求头,加入cookie防止网站出现...
xglds99/pythonSpider
spider/huggingface.py
huggingface.py
py
1,596
python
en
code
0
github-code
90
11254225459
from nltk.corpus import wordnet as wn from nltk import pos_tag,ne_chunk from nltk.tokenize import word_tokenize,wordpunct_tokenize,sent_tokenize import re, collections from nltk.stem import WordNetLemmatizer from nltk.tag import pos_tag from collections import Counter from nltk import FreqDist import nltk from nltk imp...
arvindtota/Python-Lab-Assignments
Lab Assignment 3/Source/three.py
three.py
py
1,681
python
en
code
0
github-code
90
18402817069
N,M,K =map(int, input().split()) mod = 10**9 + 7 # cmbが10**10くらいだけど求められるか?って感じ # 問題読み違えていた。。。N*M <= 2*10**5だ。。。まあ普通だ。 # もうライブラリ使おう。昔nCrのrが小さい時の工夫とかあったけど今回は大丈夫だ。 # https://ikatakos.com/pot/programming_algorithm/number_theory/mod_combination import numpy as np def prepare(n, MOD): nrt = int(n ** 0.5) + 1 nsq ...
Aasthaengg/IBMdataset
Python_codes/p03039/s550189886.py
s550189886.py
py
2,054
python
ja
code
0
github-code
90
30590851909
import asyncio from aiogram import types from aiogram.dispatcher.filters import Text from loader import dp, bot with open("pictures/lyceum.jpg", "rb") as file: photo = file.read() @dp.message_handler(Text(equals="TKTI qoshidagi akademik litsey")) async def lyceum_uz(message: types.Message): await bot.send...
dostonbokhodirov/tktiuzbot
handlers/structure_handlers/lyceum_handler.py
lyceum_handler.py
py
3,655
python
en
code
1
github-code
90
18370421248
# -*- coding: utf-8 -*- from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt from PyQt5 import QtWidgets from PyQt5.QtWidgets import QDialog, QApplication, QHBoxLayout, QListWidgetItem, QListWidget, QMessageBox from Ui_InputDlg import Ui_InputDlg from data_handling.material import MaterialListLibrary from widgetparam imp...
theysp/FDSNMH_GUI
src/InputDlg.py
InputDlg.py
py
8,120
python
en
code
1
github-code
90
29416857899
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import csv import logging import os import re import sys from os import path from typing import List import h5py import numpy # noinspection PyPackageRequirements import progressbar _CSV_FILE_PATTERN = r'\.?\d{8}T\d{6}-\d{8}T\d{6}(?:-\d+)?(?:-\d{8}T\d{6,...
MarlonCajamarca/Keras-LSTM-Trajectory-Prediction
dataset-creator/dataset-creator.py
dataset-creator.py
py
6,708
python
en
code
101
github-code
90
11698250227
import os import sys import itertools import re adirProj=os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(adirProj) from lib.resource.altname_paths import * from lib.diskgenmem import * from lib.resource.chem_altnames import * from lib.resource.fetch_mesh_to_unii import * ...
jeffhhk/datriples
bin/benchmarks/mesh_chem_altnames.py
mesh_chem_altnames.py
py
2,092
python
en
code
0
github-code
90
31429373257
""" 该模块是一个基于 PySide6 的多线程模块,通过创建实例 RunInThread 然后设置函数运行的方式无痛开启多线程 该模块同样可以传递参数给被调用函数,可以直接 return 后在被接受的函数里面定义对应数量的函数参数即可 Examples: >>> import time >>> a = RunInThread() >>> a.set_start_func(lambda: time.sleep(5)) >>> a.set_finished_func(lambda: print('运行结束')) >>> a.start() >>> '运行结束' # 非阻塞主线程 "...
271374667/NuitkaGUI
src/utils/run_in_thread.py
run_in_thread.py
py
4,121
python
en
code
12
github-code
90
15482106525
from typing import Union as _Union from typing import List as _List from typing import Tuple as _Tuple from .._network import Network from .._networks import Networks from .._population import Population from .._variableset import VariableSets, VariableSet from .._outputfiles import OutputFiles from ._profiler impor...
chryswoods/MetaWards
src/metawards/utils/_run_models.py
_run_models.py
py
18,892
python
en
code
null
github-code
90
27314725045
from requests import Request, Session import json from novalabs.utils.helpers import interval_to_oanda_granularity, interval_to_milliseconds import pandas as pd from datetime import datetime import time class Oanda: def __init__(self, key: str = "", secret: str = "", ...
bryansx/nova-backtest-doc
novalabs/clients/oanda.py
oanda.py
py
8,721
python
en
code
0
github-code
90
18921013212
from utilities import * from greedy import greedy from gym import Env, spaces import numpy as np from numpy.random import choice from copy import deepcopy def softmax(x): return np.exp(-x)/np.sum(np.exp(-x)) class MCTS_DAG(): class Node: action_indexes = {} UCB = [] N = [] Q =...
MathisFederico/Metaheuristiques
tree_search.py
tree_search.py
py
12,747
python
en
code
0
github-code
90
25227659105
import numpy as np import matplotlib.pyplot as plt Histo_Bg = np.genfromtxt("Histo_Bg.csv", delimiter=',') Bino_Bg = np.genfromtxt("Bins_Bg.csv", delimiter=',') Histo_Sig = np.genfromtxt("Histo_Sig.csv", delimiter=',') Bino_Sig = np.genfromtxt("Bins_Sig.csv", delimiter=',') Features = ["pt", "eta", 'dphi', 'energy', '...
kaifulam/Hbb_ML
archive/Var_histo_plots/Test-ML_Hbb_feature_plot_rev3.py
Test-ML_Hbb_feature_plot_rev3.py
py
940
python
en
code
0
github-code
90
45309913208
from ast import Pass import numpy as np import random as rand import reversi import math import copy MAX = math.inf MIN = -math.inf MAX_SEARCH_DEPTH = 4 SCORE_RATIO_NORMALIZER = 100.0 / 63.0 MOBILITY_NORMALIZER = 100.0 / 13.0 class ReversiBot: def __init__(self, move_num): self.move_num = move_num d...
mrchristensen/ReversiAI
ReversiBot_Python3/reversi_bot.py
reversi_bot.py
py
7,829
python
en
code
0
github-code
90
26163639225
from math import sqrt import sys def getfactor(n): prim=set() while n%2==0: prim.add(2) n//=2 for i in range(3, int(sqrt(n))+1, 2): while n%i==0: prim.add(i) n//=i if n>2: prim.add(n) return prim rem=set() s=set() val=0 x=31627 for _ in ...
smitgajjar/Competitive-Programming
codechef/GUESSPRM.py
GUESSPRM.py
py
1,090
python
en
code
0
github-code
90
33062760156
import re import pytest import sly import mckit.parser.common as cmn from mckit.parser.common.Lexer import Lexer as LexerBase, LexError # noinspection PyUnboundLocalVariable,PyPep8Naming,PyUnresolvedReferences class DerivedLexer(LexerBase): tokens = {FRACTION, FLOAT, INTEGER, ZERO} FRACTION = r"\d+(?:\.\d+...
rorni/mckit
tests/parser/common/test_common_lexer.py
test_common_lexer.py
py
3,284
python
en
code
3
github-code
90
27228324932
# File: Work.py # Description: This program # Student Name: Michel Gonzalez # Student UT EID: Mag9989 # Course Name: CS 313E # Unique Number: 86610 # Date Created: 06/30/2021 # Date Last Modified: 06/30/2021 import sys import time # Input: v an integer representing the minimum lin...
Michel-A-Gonzalez/Coursework-Python
Data Structures and Algorithms/Python Code/Work.py
Work.py
py
4,743
python
en
code
0
github-code
90
29802073970
import setuptools with open("README.md", "r", encoding='utf-8') as fh: long_description = fh.read() setuptools.setup( name="xiaoxiao_lhy", version="0.0.1", author="Lhy", author_email="lhuaye@163.com", description="IC hardware design tools", long_description=long_des...
belang/blackbean
xiaoxiao/setup.py
setup.py
py
693
python
en
code
0
github-code
90
19734899610
import numpy as np import argparse import os import sys def find_nearest(array, value): array = np.asarray(array) idx = (np.abs(array - value)).argmin() return array[idx], idx def cfar_din_generator(N): fn_1 = N // 100 * 83 SNR_dB = 3 # signal and 1st clutter zone s ...
sumitdarak/radar-hls-python
py_scripts/cfar_generator.py
cfar_generator.py
py
3,627
python
en
code
0
github-code
90