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
69917584161
# # 이미지 로드 및 리사이징: 우선, 모든 이미지는 같은 크기로 리사이징되어야 합니다. # Mask R-CNN은 일반적으로 고정된 크기의 입력을 받아들이기 때문입니다. # 이 작업은 이미지의 가로 및 세로 크기를 조정하고, # 필요한 경우 패딩을 추가하는 것을 포함할 수 있습니다. # Ground Truth 데이터 생성: Mask R-CNN은 각 이미지에 대해 bounding box 좌표와, # 해당 bounding box 내의 모든 픽셀에 대한 mask를 필요로 합니다. # 이러한 ground truth 데이터는 훈련 데이터 세트에 대해 제공되어야 합...
sdkim96/aerius
ai/myapp/clothes/utils/preprocess.py
preprocess.py
py
3,082
python
ko
code
0
github-code
54
10533546434
from typing import Any, Dict, Optional, TypedDict __all__ = ('PropertiesPayload', 'FolderPayload', 'FilePayload') class PropertiesPayload(TypedDict): """ プロパティー情報 """ width: int height: int avg_color: Optional[str] class FolderPayload(TypedDict): """ フォルダーの情報 """ id: str ...
yupix/Mi.py
mi/types/drive.py
drive.py
py
849
python
en
code
15
github-code
54
71298283362
from django.shortcuts import render from django.views import generic from blog.models import Article, Comment class ArticlesView(generic.ListView): model = Article paginate_by = 10 def view_article_details(request, pk): try: article = Article.objects.get(pk=pk) except Question.DoesNo...
AppCrashExpress/rss-database
blog/views.py
views.py
py
669
python
en
code
0
github-code
54
18371025526
import unittest import sqlite3 from datetime import datetime import os from toadpipe.sql_task import ExecSqlList from toadpipe.db import PSQLConn import luigi TEST_DIR = os.path.dirname(__file__) SQL_FILES = ['table_people.sql','table_job.sql','join_people_jobs.sql'] SQL_PATHS = [os.path.join(TEST_DIR, f) for f in S...
scottcode/toad-pipe
test/test_sql_task.py
test_sql_task.py
py
1,422
python
en
code
0
github-code
54
72512713120
""" --------------------- PROCESSINPUT.PY --------------------- """ def processFile(file,CYK): """ ------------------ PROCESS FILE ------------------ """ """ Prints 'Accepted' if no errors found in text; 'Syntax Error' and error location if found """ # INITIALIZATION multiLine = False ...
Hambinn/Tubes-IF2124-BONMONFON
src/processInput.py
processInput.py
py
2,098
python
en
code
0
github-code
54
19009402870
from scholarly import scholarly import concurrent.futures from include.scraper_api_proxy import ScraperAPI as ProxyGenerator # from scholarly import ProxyGenerator # import logging # logging.basicConfig(level=logging.DEBUG) class MyScholarlyScraper: def __init__(self, search_term: str, n_threads=10): self....
MoritzImendoerffer/citation_network
scholar_classes.py
scholar_classes.py
py
4,219
python
en
code
0
github-code
54
40452275259
""" Advantage Actor Critic (probably not the same as the A2C algorithm described by the paper) - Learns the scale parameter - Features a policy and a value model - Policy maximizes advantage and entropy - Value model minimizes the mean squared error with actual returns """ from tensorflow.python.fra...
Gerryflap/RL_continuous_action_spaces
algorithms/beta_advantage_actor_critic.py
beta_advantage_actor_critic.py
py
9,656
python
en
code
7
github-code
54
65790727
import torch import seaborn as sns import matplotlib.pyplot as plt class Zscore: def __init__(self, tensor: torch.Tensor): self.mean = tensor.mean() self.sigma = tensor.std() def get_score(self, x): return (x - self.mean) / self.sigma def get_avarage_score(self, x): return torch.Tensor((x - self.mean) / ...
vladtsap/study
6 semester/Machine learning/lab1.py
lab1.py
py
5,230
python
en
code
0
github-code
54
12743069335
import datetime import discord from discord import app_commands from discord.ext import commands, tasks from discord_bot_owners import DiscordBotOwners class DeniedAdvertisementApplicationModal(discord.ui.Modal, title="Deny Advertisement Application"): reason = discord.ui.TextInput( label="Reason", ...
Riksou/discord-bot-owners
cogs/advertisements.py
advertisements.py
py
8,380
python
en
code
2
github-code
54
12226315013
# -*- coding: utf-8 -*- """ Created on Fri Oct 4 17:58:56 2019 @author: student-minecraft """ import numpy as np import Coin_Environment as ce import time t1 = time.time() coin = ce.coin_environment() array = np.zeros(3) for i in range(1, 4): for n in range (200): if ...
Alyho/CalTech0
CoinAlgorithmWithNumpy.py
CoinAlgorithmWithNumpy.py
py
792
python
en
code
0
github-code
54
2898263886
# coding: utf-8 # In[133]: import os import csv csvpath = os.path.join("..","Resources", "election_data.csv") outputpath = os.path.join("..", "Resources", "electionsmry.txt") totalvotes = 0 candidatelist = [] khantotal = 0 correytotal = 0 litotal = 0 otooleytotal = 0 winner=["", 0] percentagelist=[] # In[134]: ...
locketylerj/Python_DataAnalyses
PyPoll/main_PyPoll.py
main_PyPoll.py
py
2,320
python
en
code
0
github-code
54
40551127254
import numpy as np import cv2 import pyautogui while True: image = pyautogui.screenshot(region=(68, 241, 175, 200)) image = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR) blackPixel=np.sum(image<100) whitePixel=np.sum(image>100) cv2.imshow("Target", image) print("Number of bla...
sghoshm/dino-game-automization
script.py
script.py
py
644
python
en
code
1
github-code
54
28408712043
from flask import render_template, url_for, flash, redirect, request from system import app, db from system.models import User, Vehicle from system.forms import LoginForm, RegistrationForm, VehicleFrom, UpdateUserForm, UpdateVehicleFrom from flask_login import login_user, current_user, login_required # Registration Pa...
mekanhaji/Parking-System
system/route/forms.py
forms.py
py
3,757
python
en
code
0
github-code
54
46111884487
import googlemaps from datetime import datetime from geopy.geocoders import Nominatim import firebase_admin from firebase_admin import credentials, firestore import numpy as np from sklearn.linear_model import LinearRegression cred = credentials.Certificate("./activify-cf1b9-firebase-adminsdk-zk6pr-5fc5a2b292....
Glasgow19/team-3
mapsscript.py
mapsscript.py
py
1,788
python
en
code
0
github-code
54
19426807419
from dataclasses import dataclass from diamond_miner.defaults import UNIVERSE_SUBSET from diamond_miner.queries import GetInvalidPrefixes from diamond_miner.queries.query import LinksQuery, links_table from diamond_miner.typing import IPNetwork from diamond_miner.utilities import common_parameters @dataclass(frozen=...
dioptra-io/diamond-miner
diamond_miner/queries/get_links.py
get_links.py
py
2,263
python
en
code
7
github-code
54
73193561121
from surropt.caballero.problem import CaballeroReport from surropt.core.options.nlp import DockerNLPOptions, IpOptOptions from pathlib import Path import numpy as np from scipy.io import loadmat from surropt.utils.models import evaporator from surropt.caballero import Caballero RESOURCES_PATH = Path(__file__).parents[...
feslima/surropt
tests_/surropt/caballero/test_evap.py
test_evap.py
py
1,702
python
en
code
1
github-code
54
5129339187
from django.contrib.auth.models import User, Group from rest_framework import permissions from rest_framework import viewsets from rest_framework.response import Response from rest_framework.views import APIView from erp.models import Goods, UserProfile from erp.permissions import IsOwnerOrReadOnly from erp.serializer...
nenyah/jenny-app-backend
erp/views.py
views.py
py
1,766
python
en
code
0
github-code
54
37478466747
from django.urls import path from apps.roles.views import RoleViewSet urlpatterns = [ path( "", RoleViewSet.as_view({"post": "create", "get": "list"}), name="list_of_roles" ), path( "<int:pk>/", RoleViewSet.as_view({"get": "retrieve", "put": "update", "delete": "destroy"}), ...
LeandroOJeda/email_service
apps/roles/urls.py
urls.py
py
354
python
en
code
0
github-code
54
6651906026
from unittest import TestCase from app import app from general_utils import read_config import json TEST_CONFIG = read_config("test_config") PATTERS_CHECK = TEST_CONFIG["patterns_checks"] ANALYZER_PATH = "/juggling" + read_config("routes_config")["analyzer"] MESSAGES = { "success": "There are problems in siteswap...
shaharby7/Jcalc
Backend/tests/test_analyzer.py
test_analyzer.py
py
2,965
python
en
code
0
github-code
54
37768790376
### # Python flask test. # # License - MIT ### import os from urllib import request # Main function. def main(): # { url = 'https://www.kernel.org/' f = open('TestPage.html', 'wb') req = request.Request(url) with request.urlopen(req) as fd_url: data = fd_url.read() f.write(da...
Phoebus-Ma/Python-Helper
Class-2/Web.PY/client-get.py
client-get.py
py
400
python
en
code
0
github-code
54
21510080608
#!/usr/bin/env python ''' Main program module for executable turboSETI ''' import sys import os import logging import time import cProfile import pstats from argparse import ArgumentParser from blimpy import __version__ as BLIMPY_VERSION from .find_doppler import FindDoppler from .kernels import Kernels from .turbo_s...
cejkys/turboSETI
turbo_seti/find_doppler/seti_event.py
seti_event.py
py
6,173
python
en
code
0
github-code
54
7028008308
from calculate_prediction import predict import argparse import pathlib import json if __name__ == "__main__": parser = argparse.ArgumentParser(description="Let's identify the image!") parser.add_argument('--path', type=str, default=None, help='Path of the image') parser.add_argumen...
gitinpython/image_classifier_udacity
Part-2/predict.py
predict.py
py
1,553
python
en
code
0
github-code
54
17033605883
#!/usr/bin/pyhton3 """ module for base class """ class Base: """ base class that all next class will inhert from """ __nb_objects = 0 def __init__(self, id=None): if id is not None: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_o...
MohamedAlaga/alx-higher_level_programming
0x0C-python-almost_a_circle/models/base.py
base.py
py
327
python
en
code
0
github-code
54
72290801122
import base64 import os import requests from dotenv import load_dotenv load_dotenv() def get_paypal_token(): client_id = os.getenv('CLIENT_ID') client_secret = os.getenv('CLIENT_SECRET') url = "https://api.sandbox.paypal.com/v1/oauth2/token" payload = 'grant_type=client_credentials' encoded_auth =...
artikhot97/paypal-django
paypal-djnago/integration/utils.py
utils.py
py
1,307
python
en
code
0
github-code
54
41865445169
# 연속으로 문제의 답이 맞는 경우에서 두 번째 문제는 2점, 세 번째 문제는 3점, ..., K번째 문제는 K점으로 계산한다. # 틀린 문제는 0점으로 계산한다. # 시험문제의 채점 결과가 주어졌을 때, 총 점수를 계산하는 프로그램을 작성하시오. # 첫째 줄에 문제의 개수 N (1 ≤ N ≤ 100)이 주어진다. # 둘째 줄에는 N개 문제의 채점 결과를 나타내는 0 혹은 1이 빈 칸을 사이에 두고 주어진다. # 0은 문제의 답이 틀린 경우이고, 1은 문제의 답이 맞는 경우이다. import sys input = sys.stdin.readline N = int(...
IDU-IFP/ifp-2022-restart-ok
soyiyeon/백준_2506번문제.py
백준_2506번문제.py
py
889
python
ko
code
0
github-code
54
74292176800
# -*- coding: utf-8 -*- """ Autor: André Pacheco Email: pacheco.comp@gmail.com Please, use this file to set the constants that will be used to load important libs to run this code """ # The path to Raug. You may find it here: https://github.com/paaatcha/raug RAUG_PATH = "/dataset/code/SkinLesion/raug" DATA_PATH = "/...
lmlima/IM_ComplementaryData_OralLeukoplakia
my-thesis/constants.py
constants.py
py
526
python
en
code
1
github-code
54
12441697933
from dotenv import load_dotenv from pprint import pprint as pp from paho import mqtt from sys import path from os.path import abspath, dirname load_dotenv() import paho.mqtt.client as paho import datetime import time import csv import os import re # creates a regular expression to match a float number float...
maticas-org/mosquitto-client
mosquitto-client/mqtt_client.py
mqtt_client.py
py
5,140
python
en
code
0
github-code
54
37697661455
import torch import numpy as np from torch.distributions import Normal import torch.nn.functional as F import torch.nn as nn import pyro import pyro.distributions as dist from pyro.nn import PyroModule, PyroSample import torch.nn as nn from pyro.infer.autoguide import AutoNormal, AutoDiagonalNormal from torch.distribu...
quantumiracle/COS513_project
src/switch_linear/networks.py
networks.py
py
10,428
python
en
code
0
github-code
54
10088399921
parent_bags = {} for _ in range(594): outer_bag, inner_bags = input().split(' contain ') inner_bags = inner_bags[:-1].split(', ') if inner_bags[0] == 'no other bags': continue for bag in inner_bags: amount = int(bag[0]) name = bag[2:] + ('s' * (amount == 1)) if name n...
rafaelgarcia094/AdventOfCode2020
scripts/day07_pt1.py
day07_pt1.py
py
839
python
en
code
0
github-code
54
23470189460
from django.db import models from django.utils.translation import gettext_lazy as _ from config.custom_fields import clean_text_fields class Faq(models.Model): question = models.CharField(max_length=255, verbose_name=_("Question")) answer = models.TextField(blank=True, verbose_name=_("Answer")) is_publish...
idmc-labs/gidd-server
apps/good_practice/models.py
models.py
py
7,402
python
en
code
0
github-code
54
44294870251
###################################################################################################### # Package Import ###################################################################################################### import pandas as pd import dash from dash import dcc from dash import html import dash_boo...
chrismdavis/Housing-Dashboard
AppLaunch.py
AppLaunch.py
py
11,442
python
en
code
0
github-code
54
36319334983
import matplotlib.pyplot as plt from matplotlib.collections import PatchCollection from matplotlib.patches import Polygon import numpy from src.triangle import Triangle fig = None ax = None def start_draw(): global fig global ax fig, ax = plt.subplots() def draw_triangle_shade(triangle): """ ...
dobrebogdan/unibuc
second_year/gc/project/src/draw.py
draw.py
py
1,011
python
en
code
0
github-code
54
25486384814
class turn : def __init__(self,name,speed,hp) : self.name = name self.speed = speed self.hp = hp def __lt__(self,other) : return self.speed > other.speed import numpy as np X = np.random.RandomState(1) hp = int(input('Blood Start: ')) speed = int(input('Your speed: ')) classes =...
apkmew/Code
CPE KU Year 1/Lab ComPro/Lab 10 (HW)/06_Monster2.py
06_Monster2.py
py
1,849
python
en
code
2
github-code
54
45523272137
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import io import socket import sys import time import urllib from .utils import to_text, to_bytes class WSGIServer: address_family = socket.AF_INET socket_type = socket.SOCK_STREAM request_queue_size = 5 allow_reuse_address = True defa...
mozillazg/bustard
bustard/wsgi_server.py
wsgi_server.py
py
7,113
python
en
code
45
github-code
54
74271296802
# Class for ease procedure of saving and loading of classes hierarchy # each inherited class should not implement __init__ function # and should implement saveThisObjectDataOnly_ and loadThisObjectDataOnly_ functions which have to just install values of # current class, not it's parent classes values (only if necessa...
Algus-me/serializableClass
serializableClass/serializableClass.py
serializableClass.py
py
3,567
python
en
code
0
github-code
54
16812794544
#!/usr/bin/python import os import sys import json import time import pathlib class File (): def __init__(self): self.Name = "Save/Load from file" def Create(self, filepath): file = open(filepath, "w") file.close() def Save (self, filename, data): file = open(filename, "w", encoding="utf8") file.write(...
openmks/core-py
co_file.py
co_file.py
py
3,435
python
en
code
0
github-code
54
12664548357
# https://mypy.readthedocs.io/en/stable/common_issues.html#using-classes-that-are-generic-in-stubs-but-not-at-runtime from __future__ import annotations import concurrent.futures from typing import ( BinaryIO, Callable, Iterator, Literal, Optional, Sequence, TextIO, Tuple, ...
christopher-hesse/blobfile
blobfile/_ops.py
_ops.py
py
14,806
python
en
code
38
github-code
54
9531706979
import random position1 = 0 position2 = 0 temp1 = 0 temp2 = 0 global position position = 0 def dice(): # return random.randrange(1, 7, 1) n = int(input()) return n def position(n, position): ladder = {1:13, 15:34, 19:48, 27:54, 37:98, 53:65, 76:91, 9:26, 45:67} snakes = {99:45, 85:67, 67:46, 45:17,...
Sravya1511/cspp-1-assignment
Practice/snake_ladder.py
snake_ladder.py
py
1,008
python
en
code
0
github-code
54
32385608099
from collections import deque import sys input = sys.stdin.readline # 시계방향, 상 우 하 좌 DELTA = [(-1, 0), (0, 1), (1, 0), (0, -1)] def main(): def f(sy, sx): queue = deque([(sy, sx, 0, 3)]) visited = [[False] * 6 for _ in range(6)] visited[sy][sx] = True cube = [0, 0, 0, 0, 0, 0] # ...
seongjaee/algorithm-study
Codes/BOJ/2642_전개도.py
2642_전개도.py
py
1,735
python
en
code
0
github-code
54
43443452911
from fastapi import Depends, Response, HTTPException from app.auth.adapters.jwt_service import JWTData from app.auth.router.dependencies import parse_jwt_user_data from ..service import Service, get_service from . import router @router.delete("/users/contacts/{contact_id:str}") def delete_contact( contact_id: st...
LulaKebaber/BeSafeBackend
app/auth/router/router_delete_contact.py
router_delete_contact.py
py
728
python
en
code
0
github-code
54
1117994919
"""You buy an international calling card to India. The calling card company has some special offers. (a) If you charge your card with $5 or $10, you don’t get anything extra. (b) For a $25 charge, you get $3 of extra phone time. (c) For a $50 charge, you get $8 of extra phone time. (d) For a $100 charge, you get $20 of...
Sanusi1997/python_power_of_computing_exercises
functions/charges.py
charges.py
py
1,600
python
en
code
0
github-code
54
19238348772
from flask import Flask # importing home directly from the routes package because the init file imported and renamed blueprint from app.routes import home, dashboard from app.db import init_db from app.utils import filters def create_app(test_config=None): # set up app config app = Flask(__name__, static_url_path=...
emrendle/python-newsfeed
app/__init__.py
__init__.py
py
818
python
en
code
0
github-code
54
42080292851
# programme 3 page 33 # ce programme affiche les 20 premiers terme de la table de multiplication de 7 # mais il signale également par un astérisque les multiples de 3 table, compteur = 7, 0 # affectation de la table de multiplication et du compteur while compteur < 20: ...
chuck2kill/CoursPython
chapitre_4/multiply7_3.py
multiply7_3.py
py
1,091
python
fr
code
0
github-code
54
13507704580
import math from base_log_reader import BaseLogReader def to_discrete(pos): return tuple(math.floor(p) for p in pos) class PrintLogReader(BaseLogReader): def on_player_spawned(self, tick, buf_start, eid, name, pos, look): print("[{}] Player {} spawned at {}".format(tick, (eid, name), to_discrete(po...
facebookresearch/fairo
droidlet/lowlevel/minecraft/server/logging_plugin/discrete_move_log_reader.py
discrete_move_log_reader.py
py
1,597
python
en
code
826
github-code
54
31135659186
""" Aula 03 - Comentários """ # Comentário de única linha ''' Comentário de bloco ''' # Comentar VSCode Ctrl + ; # Atribui o valor 10 a variável numero_01 numero_01 = 10 numero_02 = 60 # numero_03 = 20 print(numero_01, numero_02)
josineudo-arruda/estudo-python
source/01-intro/aula03.py
aula03.py
py
239
python
pt
code
0
github-code
54
37826574325
# https://learndataanalysis.org/getting-started-with-google-photos-api-and-python-part-1/ import os from Google import Create_Service API_NAME = 'photoslibrary' API_VERSION = 'v1' CLIENT_SECRET_FILE = 'credentials.json' SCOPES = ['https://www.googleapis.com/auth/photoslibrary', 'https://www.googleapis.com/a...
baont/googlePhotoOrganizer
init_photo_service.py
init_photo_service.py
py
1,401
python
en
code
0
github-code
54
34203332498
""" This file configers logging for the project. In a file where you would like to use logging. import logging log = logging.getLogger(<name_of_logger>) Setting <name_of_logger> to console logger will log to the console Setting it to tracking_logger or main_logger will log to those files. New loggers can also be set ...
Jack-alope/tempers
backend/log_config.py
log_config.py
py
2,177
python
en
code
0
github-code
54
8630707682
# -*- coding: utf-8 -*- """ Created on Fri Mar 30 14:08:26 2018 @author: Dean """ class Node: def __init__(self, value=None): self.value = value self.next = None def show(head): if not head or not head.next: return head p = head.next i = 1 while(p): print(p.value,e...
Deanhz/normal_works
算法题/程序员面试指南/python/线性表/有序的环形单链表插入新节点.py
有序的环形单链表插入新节点.py
py
1,074
python
en
code
0
github-code
54
14106347947
#!/usr/bin/env python # scripts/examples/simple_data_store.py import logging import threading import time import random from socketserver import TCPServer from collections import defaultdict from umodbus import conf from umodbus.server.tcp import RequestHandler, get_server from umodbus.utils import log_to_stream CON...
daliworks/sensorjs-seah
test/server.1.py
server.1.py
py
52,864
python
en
code
0
github-code
54
1706954282
import scrapy from typing import Text from scrapy.http.request import Request from selenium import webdriver from selenium.webdriver.chrome.options import Options from scrapy.selector import Selector from scrapy_selenium import SeleniumRequest import time from selenium.common.exceptions import NoSuchElementException fr...
sedrof/Scrapers
building_upwork/building_upwork/spiders/building.py
building.py
py
2,947
python
en
code
0
github-code
54
33114425883
import pandas as pd # importar el archivo CSV df = pd.read_csv("test.csv") # IDs a seleccionar ids = [3, 13, 34, 56, 70, 85, 110, 120, 210, 400] # seleccionar las filas con esos ids df_sel = df.loc[df["id"].isin(ids)] # imprimir los datos de las filas seleccionadas print(df_sel) def clock_speed(): ...
ivancp54/M7_UF2_practica10
ejercicio10.py
ejercicio10.py
py
636
python
en
code
0
github-code
54
33785091366
from __future__ import annotations from datetime import datetime import enum import functools import json import logging import os import ssl from urllib.error import URLError, HTTPError from urllib.parse import urlparse from urllib.request import Request, urlopen from uuid import uuid4 import boto3 from botocore.exc...
brigaccess/staircase-skills-assesment
recognition.py
recognition.py
py
16,640
python
en
code
0
github-code
54
34499727464
""" Given a multiset of integers, return whether it can be partitioned into two subsets whose sums are the same. For example, given the multiset {15, 5, 20, 10, 35, 15, 10}, it would return true, since we can split it up into {15, 5, 10, 15, 10} and {20, 35}, which both add up to 55. Given the multiset {15, 5, 20, 10...
gyan42/interview-preparation-qna
python/array/find_subset_sum.py
find_subset_sum.py
py
1,679
python
en
code
0
github-code
54
11978896886
#Напишите функцию, которая для заданного в аргументах списка, возвращает как результат перевернутый список def revers(a, b): old_list = [] for i in range(a, b): l = i+1 old_list.append(l) i+= 3 new_list = list(reversed(old_list)) print(old_list) print(new_list) ...
psycoleptic/Python_class
Funk Task 10.py
Funk Task 10.py
py
486
python
ru
code
0
github-code
54
73592694883
import time """ 中间变量 初始值为[0] 用中间变量和 strs的每一个元素比较 得出中间共同元素 赋值给中间变量 """ class Solution: def longestCommonPrefix(self, strs) -> str: temp_str = strs[0] for i in range(1, len(strs)): index = 0 len_list_two = len(strs[i]) if len(strs[i]) <= len(temp_str) else len(temp_str) ...
gj-hat/Leetcode
14-最长公共前缀/question1.py
question1.py
py
850
python
en
code
1
github-code
54
8973416441
import os from os import path from time import time, localtime, strftime import random import shutil import mkdirs import random import filecmp class RevisionedStorage(object): def __init__(self, dir): self.rootdir = dir mkdirs.mkdirs(self.rootdir) class TempRevFile(file): """Class for a temporary re...
pascalfleury/shelltoys
python/lib/storage/revdir.py
revdir.py
py
2,113
python
en
code
0
github-code
54
11786809432
import requests, json, random from utils import buildQuery rootParams = { "endpoint": "", "token": None, "payload": {}, "params": { "type": None, "q": None } } def getSearchQuery(searchList): return ('genre:"' + random.choice(searchList) + '"') def by(token, type, searchList, ...
MartinGassner/mydailymix
lib/searchItems.py
searchItems.py
py
958
python
en
code
3
github-code
54
16594479587
#-*- coding: utf-8 -*- __author__ = "coolfire" import re import urllib import os import sys def get_html_pic(url): html_file = urllib.urlopen(url) html = html_file.read() html_file.close() regex = re.compile(r'<img.*?src="(http://.+?)".*?>') #定义正则表达式对象 links_list = regex.finditer(html) ...
llybood/My_python
exercise/0013.py
0013.py
py
1,192
python
en
code
0
github-code
54
26607210967
import wx, mysql.connector, time from datetime import datetime createdb_query = "CREATE DATABASE IF NOT EXISTS mysql_python_banking;" table_query = """ CREATE TABLE mysql_python_banking.account ( account_no int(11) NOT NULL AUTO_INCREMENT, name_on_account varchar(100) NOT NULL, balance floa...
amar-sinha/mysql-python-banking
panels.py
panels.py
py
18,941
python
en
code
1
github-code
54
73155760161
# network wrappers for vision transformer # Created: 6/16/2021 # Status: in progress import torch import os, sys import glob import math import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import torch.nn as nn import torch.optim as optim import numpy as np from torch.utils.data import DataLoader...
IceFireCloud/Event-Prediction
models/transformer_torch/networks.py
networks.py
py
12,025
python
en
code
3
github-code
54
4374721557
from typing import Optional import numpy as np import matplotlib.pyplot as plt from matplotlib.backend_bases import PickEvent def coord_formatter(data_xy, coord_xyz): """Formatter for matplotlib that finds the nearest point on the plot (defined by data_xy) and shows the corresponding coord_xyz values""" ...
alexandrovteam/ims-direct-control
remote_control/preview.py
preview.py
py
4,197
python
en
code
3
github-code
54
24531975499
import requests import logging import sys # Configuration of application logs logging.basicConfig(stream=sys.stdout) logger = logging.getLogger('POKEMON') logger.setLevel(logging.DEBUG) class Extrac(): def __init__(self,i): self.data = requests.get(f'https://pokeapi.co/api/v2/pokemon/{i}').json() logge...
phandinhhuyptit/etl-pipeline
pokemon/extract.py
extract.py
py
349
python
en
code
0
github-code
54
32408104574
import pandas as pd course = ['Chinese', 'English', 'Math', 'Natural', 'Society'] chinese = [14, 12, 13, 10, 13] eng = [13, 14, 11, 10, 15] math = [15, 9, 12, 8, 15] nature = [15, 10, 13, 1011, 15] social = [12, 11, 14, 9, 14] A=pd.DataFrame([chinese,eng,math,nature,social],columns=course,) total=[A.iloc[i]...
gitnimo/noob
jump/01/ACT.py
ACT.py
py
511
python
en
code
0
github-code
54
37260496042
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Build a trial loop Step 2 Use this template to turn Step 1 into a loop @author: katherineduncan """ #%% Required set up import numpy as np import pandas as pd import os, sys import random from psychopy import visual, core, event, gui, logging #%% identify who th...
UofTPsychProg-fall-2019/trialloops-extreme-LauraLise
Step2_LoopIt_updated.py
Step2_LoopIt_updated.py
py
4,943
python
en
code
0
github-code
54
19153724003
# https://leetcode.com/problems/rotate-image/ # https://leetcode.com/problems/rotate-image/discuss/2503184/Python-oror-Easily-Understood-oror-Faster-than-99-oror-Less-than-99 import math class Solution: def rotate(self, matrix: List[List[int]]) -> None: n = len(matrix) for row in range(math.ceil(n...
wingskh/CompetitiveProgrammingExercises
LeetCode/Rotate_Image.py
Rotate_Image.py
py
966
python
en
code
4
github-code
54
22658635287
# Implements the Bag ADT container using a Python list. # create this Class class thisClass: def __init__(self): self._ourNames = list() #How many are we? def _counter_(self): return len(self._ourNames) #Is (one of us's name e.g Mercy) in this room? def __isIn__(self,_nameholder_): check = _nameholder_ in...
Viscount-S/_intro_py
_dataStructuresAndAlgorithmicThinking_.py
_dataStructuresAndAlgorithmicThinking_.py
py
5,390
python
en
code
0
github-code
54
31437740871
def azureml_main(frame1): import matplotlib matplotlib.use('agg') # Set backend import pandas as pd import numpy as np import matplotlib.pyplot as plt import statsmodels.graphics.boxplots as sm Azure = True ## Compute a column with the score accruacy for each row. ...
rogergranada/MOOCs
edX/Microsoft/DAT203x/Module 4/DiabetesEval.py
DiabetesEval.py
py
2,485
python
en
code
3
github-code
54
26293134771
from __future__ import print_function import datetime import os.path from google.auth.transport.requests import Request from google.oauth2.credentials import Credentials from google_auth_oauthlib.flow import InstalledAppFlow from googleapiclient.discovery import build from googleapiclient.errors import HttpError #! ...
NNMCoder/GoogleCalendarApi
quickstart.py
quickstart.py
py
2,867
python
ru
code
0
github-code
54
29417125786
#!/usr/bin/python2 ''' Peer management This class handles sending / receiving The sending part handles window management and retransmits The recv part handles acks and reassembly, then spits out to parent for dispatch To implement the QoS portion, we have a queue at each priority level One message at each priority is ...
arpg/udp_mesh
RUdpPeer.py
RUdpPeer.py
py
12,157
python
en
code
0
github-code
54
1780380520
from Utils.IntInput import get_int_input from Utils.Strings import capitalise def get_yes_no_input(prompt): new_prompt = (f"{prompt}\n" "1: Yes\n" "2: No\n") yes_no_input = get_int_input(new_prompt, lower_bound=1, upper_bound=2) return yes_no_input def get_non_repeating...
HenryGinn/Einstein-s-Riddle-Solver-5
Utils/Input.py
Input.py
py
2,109
python
en
code
0
github-code
54
74752249121
# Python Script para criar o modelo de predição para a Temperatura pelo MLFlow import os import warnings import sys import pandas as pd import numpy as np from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score from sklearn.linear_model import Ridge from urllib.parse import urlparse i...
afraniofilho/IEL_MLFlow_Temp
main.py
main.py
py
2,827
python
en
code
0
github-code
54
1410217818
import os os.chdir('./SpaGE/STARmap') import numpy as np import pandas as pd import scipy.stats as st import pickle from viz import GetQHulls ###################### STEP 1: load #################### counts = np.load('cell_barcode_count.npy') Genes = pd.read_csv('genes.csv',header=None) Genes = (Genes.iloc[:,0]) count...
JinNing329/SpatialMap
Methods/SpaGE/STARmap/preprocess.py
preprocess.py
py
1,181
python
en
code
0
github-code
54
2686243467
import numpy as np import pickle as pkl from sklearn.feature_extraction.text import CountVectorizer from sklearn.linear_model import LassoCV, LassoLarsCV, LassoLarsIC from sklearn.cross_validation import StratifiedKFold,train_test_split from sklearn.metrics import classification_report from sklearn.linear_model import...
Froskekongen/content-consumption
src/conversion_tag_effect.py
conversion_tag_effect.py
py
3,442
python
en
code
0
github-code
54
45504600847
from backend import db from backend.general_utils import create_zip, delete_files, parse_img_tag, create_schema_json, send_tests_zip from backend.models import Activity, Checkpoint import backend.activities as activity_utils import backend.hooks as hook_utils import requests # Function to update card data def update_...
bitprj/bit-backend
backend/hooks/update_utils.py
update_utils.py
py
4,165
python
en
code
5
github-code
54
14109963307
import getpass import logging import re from argparse import Namespace from functools import partial from typing import Dict, List, Optional import attr import psutil from . import pg, queries from .pg import Connection, sql from .types import ( NO_FILTER, BlockingProcess, FailedQueriesInfo, Filters, ...
dalibo/pg_activity
pgactivity/data.py
data.py
py
20,005
python
en
code
2,309
github-code
54
24120050552
from setuptools import setup import setuptools from setuptools.command.test import test as TestCommand import sys import os class PyTest(TestCommand): test_package_name = 'api' def finalize_options(self): TestCommand.finalize_options(self) _test_args = [ '--ignore=build', ...
rdelassus/angele_dm1
setup.py
setup.py
py
1,074
python
en
code
0
github-code
54
14347985329
# © 2021-2023 Intel Corporation # SPDX-License-Identifier: MPL-2.0 import dev_util import simics import stest def expect_value(value): def callback(connection, access, handle, user_data): stest.expect_equal(access.value(handle), value) return callback def test(bank): subscribe = bank.iface.bank_i...
intel/device-modeling-language
test/common/instrumentation_endianness.py
instrumentation_endianness.py
py
739
python
en
code
74
github-code
54
24250413330
# 导入os, shutil, re模块,分别用于操作系统,文件复制和移动,正则表达式 import os import shutil import re # 定义antRE, formRE, renameRE三个正则表达式,分别用于匹配文件的前缀名,后缀名,和去掉下划线后的部分 antRE = '^.+?(?=[_])' #public ante title of files formRE = '.png$' #file type renameRE = '[^_]+$' #new name of files # 定义一个filepack类,用于封装文件的信息和操作 class filepack(object): # 初...
kusurin/scripts
enpack.py
enpack.py
py
4,894
python
zh
code
0
github-code
54
35198568068
import functools import json import os from hfutils.arg_parser import TestArguments from hfutils.constants import TASK_TO_LABELS from hfutils.loader import DatasetLoader, ModelLoader from hfutils.plot import distplot from numpy import random from packaging.version import parse import torch from transformers.data.data_c...
drunkcoding/model-inference
tests/test_cost_model.py
test_cost_model.py
py
5,835
python
en
code
1
github-code
54
15475149068
__author__ = 'cwang' class Solution(object): def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str """ sz = len(strs) if not sz: return '' digit = 0 while True: intialized = False ch = '' for i ...
chongliw/algorithm_py
Leetcode/014longestCommonPrefix.py
014longestCommonPrefix.py
py
708
python
en
code
0
github-code
54
15882573776
import argparse import logging import math import matplotlib.pyplot as plt from repository import * root = logging.getLogger() root.setLevel(logging.DEBUG) ch = logging.StreamHandler(sys.stdout) ch.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') ch.setFo...
stefan-matcovici/Neural-Networks--Homework
Homework1/src/main.py
main.py
py
3,004
python
en
code
0
github-code
54
32522351559
# See readme for information about this file. ''' Modified version, for reduce processing time ''' #v1.1 #!/usr/bin/python3 import numpy as np from scipy.optimize import curve_fit import math import time import pandas as pd import itertools as it from scipy import spatial import matplotlib.path as mplP...
LabDig/DAGAPy
SourceCode/kriging.py
kriging.py
py
12,410
python
en
code
1
github-code
54
35462311680
N = int(input()) A = list(map(int, input().split())) M = 1 << 15 # dp[i][j]: i番目までの数字でjにできるかどうか dp = [False] * (M + 1) dp[0] = True for i in range(N): ndp = [False] * (M + 1) for j in range(M + 1): ndp[j] = dp[j] if j ^ A[i] < M + 1: ndp[j] |= dp[j ^ A[i]] dp = ndp print(sum(...
kiccho1101/atcoder
yukicoder/470.py
470.py
py
357
python
en
code
1
github-code
54
26256416204
"""BbB Coefficients Module.""" import numpy as _np from qtpy.QtCore import Qt from qtpy.QtGui import QColor from qtpy.QtWidgets import QLabel, QWidget, QGridLayout, QGroupBox, QTabWidget import qtawesome as qta from pydm.widgets import PyDMEnumComboBox, PyDMLineEdit, PyDMPushButton from siriuspy.envars import VACA_PR...
lnls-sirius/hla
pyqt-apps/siriushla/si_di_bbb/coefficients.py
coefficients.py
py
15,121
python
en
code
3
github-code
54
2132609248
#*******************************START OF NEW SCRIPT***************************** import random atkrolls=[] #------------------------------------------------------------------------------- #--ATTACK ROLL SECTION-- #------------------------------------------------------------------------------- def SingleRoll(mod): ...
MelodicCodes/Attack-and-Damage-Roller
master.py
master.py
py
2,752
python
en
code
0
github-code
54
3576821702
import logging from marshmallow import ValidationError, fields, post_load, pre_dump from azure.ai.ml._restclient.v2023_02_01_preview.models import RandomSamplingAlgorithmRule, SamplingAlgorithmType from azure.ai.ml._schema.core.fields import StringTransformedEnum, UnionField from azure.ai.ml._schema.core.schema impor...
Azure/azure-sdk-for-python
sdk/ml/azure-ai-ml/azure/ai/ml/_schema/_sweep/sweep_sampling_algorithm.py
sweep_sampling_algorithm.py
py
2,972
python
en
code
3,916
github-code
54
14993407663
from collections import deque n, m, k = map(int, input().split()) q = deque() for i in range(n): q.append(i + 1) isleft = False cnt = 0 while q: if not isleft : for i in range(m - 1): q.append(q.popleft()) print(q.popleft()) else : for i in range(m - 1): ...
5P2RS5/Python_for_infra
BOJ/20301.py
20301.py
py
430
python
en
code
0
github-code
54
22522327742
import contextlib import logging import time from argparse import Namespace from pathlib import Path from typing import Any import torch import torch.nn.functional as F from fairseq import checkpoint_utils, utils from fairseq.dataclass.configs import FairseqConfig from fairseq.distributed import utils as distributed_...
tran-khoa/joint-training-cascaded-st
projects/speech_translation/cli/trainer.py
trainer.py
py
30,562
python
en
code
2
github-code
54
36312688057
# -*- coding: utf-8 -*- """ Created on Sat Jun 16 00:42:31 2018 @author: NP """ dr = list(map(int, input().split())) dd = list(map(int, input().split())) f = 0 if dr[2] > dd[2]: f = 10000 elif dr[2] == dd[2] and dr[1] > dd[1]: m = dr[1] - dd[1] f = 500 * m elif dr[2] == dd[2] and dr[1] ...
akki8087/HackerRank
Nested Logic.py
Nested Logic.py
py
402
python
en
code
0
github-code
54
21622587169
import numpy as np import pandas as pd from otlang.sdk.syntax import Keyword, Positional, OTLType from pp_exec_env.base_command import BaseCommand, Syntax class SubtractCommand(BaseCommand): """ Make subtraction of two columns of the dataframe a, b - columns or numbers must be subtracted | subtract a ...
ISGNeuroTeam/pp_cmd_subtract
subtract/command.py
command.py
py
2,814
python
en
code
0
github-code
54
31573247001
import time import subprocess def low_power_alert(time_remaining): """somehow informs the user that the battery is running low then returns the time to sleep (in minutes) to wait before checking again note that a time less than MIN_SLEEP_TIME will still wait the min sleep time. """ p = subprocess.P...
tadhgmister/dotfiles
battery_script.py
battery_script.py
py
2,588
python
en
code
0
github-code
54
12041242950
import tkinter as tk class LinkedIntStringVar(tk.StringVar): '''Takes a dictionary of int to strings. default 'get' function will return strings as normal, but there is also special function for returning based on the integer values 'get_int'. Setting the variable requires using the integer val...
Soopyboo32/School-2021-pay-calculator
CODE/guiComponents/OptionMenu.py
OptionMenu.py
py
3,431
python
en
code
0
github-code
54
21800490450
# -*- coding: utf-8 -*- """ Created on Tue Aug 15 17:12:36 2023 @author: Teja Ram Pooniya @Programming-Topic: Python Learn classes, modules, Str(String), Ellipsis Object, Numm Object, Ellipsis Debug """ """ Overview of these concepts in Python: Sure, I can provide you with an overview of these concepts in Python: 1...
Teja-Ram-Pooniya/Python-Master-Course
Classes-Objects-Module-String-Ellipsis-Debugging.py
Classes-Objects-Module-String-Ellipsis-Debugging.py
py
4,077
python
en
code
0
github-code
54
28254575108
import time import datetime import psutil import json import sysparam import os import signal import requests import socket import platform import logging import sys import math import signal from subprocess import Popen logging.basicConfig(filename='events.log',format='%(asctime)s %(message)s', level=logging.DEBUG) ...
wdonat/adway-controller
demo_controller.py
demo_controller.py
py
27,329
python
en
code
0
github-code
54
42696410446
from flask import url_for, redirect, render_template, request, flash, \ send_from_directory, send_file, session, Blueprint, current_app, make_response from io import BytesIO from openpyxl import load_workbook import os upload = Blueprint('upload', __name__, url_prefix='/upload') ALLOWED_EXTENSIONS = set(['xlsx', '...
PyYourDaYe/flask_dataplate
up.py
up.py
py
6,498
python
en
code
0
github-code
54
70859084643
from PySide import QtGui, QtCore, QtOpenGL import models import analyzers from ui.analyzer_dialog import Ui_AnalyzerDialog class AnalyzerWidget(QtGui.QGraphicsView): """ The main display widget for the acquired waveforms and their analyzer labels. """ showMessage = QtCore.Signal(object) def...
dbridges/logician
ui/widgets.py
widgets.py
py
14,262
python
en
code
1
github-code
54
26109961906
# -*- coding: utf-8 -*- """ Created on Mon Nov 12 10:05:46 2018 @author: yann """ import matplotlib.pyplot as plt import numpy as np #import time #import os import re #################################### filename = '/home/cyyan/projects/CaSoGP/result/log_ValidationFeature.log' f = open(filename,'r') content = f.rea...
gatsby2016/DLforWSI
codes/_lossPlot.py
_lossPlot.py
py
1,041
python
en
code
2
github-code
54
4832336223
# 2121. Intervals Between Identical Elements def getDistances(self, arr: List[int]) -> List[int]: N = len(arr) dic = {} c = {} temp = Counter() for i,val in enumerate(arr): if val in dic: dic[val].append(dic[val][-1] + i) c[val] += 1 else: dic[val...
Bidipto/DSApedia
Leetcode/Dictionary/2121. Intervals Between Identical Elements.py
2121. Intervals Between Identical Elements.py
py
655
python
en
code
0
github-code
54
27344249513
from time import time from collections import defaultdict class Solution: def findRepeatedDnaSequences(self, s: str) -> list[str]: sequences = defaultdict(int) for i in range(len(s) - 9): sequences[s[i:i+10]] += 1 return [key for key, value in sequences.items() if value > 1] ...
Sadomtsevvs/Leetcode
187. Repeated DNA Sequences.py
187. Repeated DNA Sequences.py
py
587
python
en
code
0
github-code
54
42684972438
""" Name: Measure Contributor: Guo Yi, Gu Chengyang Last update: 2019/4/24 Objective: 计算一系列的评价指标 Run successfully on macOS 10.14.3, Python 3.7.2 """ import pandas as pd import numpy as np from functools import wraps from pandas.plotting import register_matplotlib_converters from warnings import warn from multiprocessi...
bridgream/Backtest-Framework
mylib/measure.py
measure.py
py
13,144
python
zh
code
3
github-code
54