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
28129219881
puzzle_input = [0,5,10,0,11,14,13,4,11,8,8,7,1,4,12,11] class InfiniteCheck: def __init__(self, arr): self.input = arr self.input_len = len(arr) self.distributions = [] self.invocations = self.loop_cnt = 0 self.evalInfinite() def maxIdx(self): # print(f'START INPUT: {self.inp...
brianlellis/100-days-of-code
PYTHON/20_infinite_looper.py
20_infinite_looper.py
py
2,063
python
en
code
0
github-code
1
40806840179
from datetime import date from selenium import webdriver from selenium.webdriver.common.by import By driver = webdriver.Chrome(executable_path="C:\\Users\\mukunth\\PycharmProjects\\pythonProject\\mypackage\\chromedriver.exe") #def datastream(value): # send1 = driver.get("http://demo.automationtesting.in/Alerts....
Mukunth-arya/selenium
data1.py
data1.py
py
1,315
python
en
code
0
github-code
1
20853184226
"""empty message Revision ID: 405b9e06626f Revises: Create Date: 2022-05-20 13:44:53.601560 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '405b9e06626f' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
PeJot86/blog
migrations/versions/405b9e06626f_.py
405b9e06626f_.py
py
1,476
python
en
code
0
github-code
1
28892835565
n, m = map(int, input().split()) array = [] for i in range(n): array.append(input()) answer = 64 x = 0 y = 0 for x in range(n - 8 + 1): for y in range(m - 8 + 1): cnt = 0 start = "W" for i in range(x, x + 8): for j in range(y, y + 8): if j % 2 == 0 and arra...
m0mt/Algorithm-practice
python/backjoon/silver5/1018.py
1018.py
py
582
python
en
code
0
github-code
1
30298034975
""" Script to do the segmentation and store the result. Store graph in _save_segmentation_nellix """ import os import numpy as np import visvis as vv from visvis import ssdf from stentseg.utils import PointSet, _utils_GUI from stentseg.utils.datahandling import select_dir, loadvol, loadmodel from stentseg.stentdire...
almarklein/stentseg
nellix/_do_segmentation_nellix_versievoortom.py
_do_segmentation_nellix_versievoortom.py
py
10,415
python
en
code
3
github-code
1
73184185314
""" Defines User resource's endpoints. """ from application import api, db, app from application.models import User, Student, Course, BadSignature, TeamProjectGrade, StudentMilestoneGrade, StudentQuizGrade, Submission from flask.ext.restful import Resource, abort, marshal, marshal_with from fields import user_fields, c...
amrdraz/java-project-runner
application/resources/user.py
user.py
py
9,566
python
en
code
0
github-code
1
21255341912
from sys import stdin from collections import defaultdict stdin = open("input.txt", "r") memory = defaultdict(int) def apply_mask(val): return val | ones_mask def set_bit(val, idx, bit): if bit == 1: val |= 2 ** idx else: val &= 2 ** 64 - 1 - 2 ** idx return val def gen_floating(bas...
mmehas/advent_of_code_2020
src/14_hard.py
14_hard.py
py
1,346
python
en
code
0
github-code
1
5305293579
import random import torch import numpy as np import argparse import torch.nn as nn import torch.optim as optim import numpy as np import os from torchvision import transforms from torchvision.utils import save_image #import sys from utils.dataframe import UCIDatasets from utils.experiment import exp_imputation from m...
bravo583771/Variational-inference-and-Missing-not-at-random-imputation
main.py
main.py
py
3,881
python
en
code
1
github-code
1
72149412834
from sqlmodel import SQLModel, create_engine, Session, select from finance_app_database_service.models import Ticker import csv import os #engine = create_engine("postgresql://postgres:topsecretpassword@172.19.0.2:5432/testdb") engine = create_engine("postgresql://postgres:topsecretpassword@127.0.0.1:5432/testdb") de...
lward27/finance_app_database_service
src/finance_app_database_service/database.py
database.py
py
1,072
python
en
code
0
github-code
1
73866758434
from mmcv.runner import HOOKS, Hook from mmcv.runner import EpochBasedRunner from mpa.utils.logger import get_logger logger = get_logger() @HOOKS.register_module() class CancelInterfaceHook(Hook): def __init__(self, init_callback: callable, interval=5): self.on_init_callback = init_callback self...
openvinotoolkit/model_preparation_algorithm
mpa/modules/hooks/cancel_interface_hook.py
cancel_interface_hook.py
py
1,159
python
en
code
20
github-code
1
72310587555
""" sounder function rules: http://logical.ai/arma/ 1. identifies potential vowel sounds (1 letter) 2. designates all other letters as consonants (1 letter) 3. pairs together stop + liquid, dipthong, aspirates, and qu (2 letters) 4. ellides and removes letters: vowel + (m +) (h +) vowel 5: TODO prodelides forms of 'ess...
chenmasterandrew/latinsyllabifier
latinsyllabifier.py
latinsyllabifier.py
py
9,972
python
en
code
2
github-code
1
39011961976
# -*- coding: utf-8 -*- """ Created on Thr Jan 10 09:13:24 2018 @author: Takashi Tokuda Keigan Inc. """ import argparse import sys import pathlib import serial import msvcrt import serial.tools.list_ports from time import sleep current_dir = pathlib.Path(__file__).resolve().parent sys.path.insert(0, str(current_dir)...
keigan-motor/pykeigan_motor
examples/windows_examples/baudrate_change.py
baudrate_change.py
py
1,977
python
en
code
10
github-code
1
8702115205
import streamlit as st import altair as alt import inspect from vega_datasets import data @st.experimental_memo def get_chart_19705(use_container_width: bool): import altair as alt source = "https://frdata.wikimedia.org/donationdata-vs-day.csv" chart = alt.Chart(source).mark_line().encode( ...
streamlit/release-demos
1.16.0/demo_app_altair/pages/109_Cumulative_Wiki_Donations.py
109_Cumulative_Wiki_Donations.py
py
1,004
python
en
code
78
github-code
1
11834770844
""" Author: @sohamroy19 Date: 16/11/2021 This script prints the number of messages sent by a WhatsApp user, given the exported chat as 'chat.txt'. """ import re # open the file f = open("chat.txt", encoding="utf8") # now I know how to use map data structure stats = {} total = 0 # read line by line,...
sohamroy19/miscellaneous
Tools/WhatsapperStats.py
WhatsapperStats.py
py
1,071
python
en
code
0
github-code
1
32917234276
import numpy as np import matplotlib.pyplot as plt import matplotlib import matplotlib.animation as ani matplotlib.rcParams['mathtext.fontset'] = 'stix' matplotlib.rcParams['font.family'] = 'STIXGeneral' def NACA4Camber_line(x, max_camber, pos_camber): """ Function to generate camber line for NACA 4 digit ser...
MazenZohiry/Unsteady-Vortex-Panel-Method
Program/Generic_Functions.py
Generic_Functions.py
py
7,469
python
en
code
0
github-code
1
13120698347
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: cur = pre = head appear = set() while cur: if cur.val in appear: ...
funbp6/LeetCode-Record-C-Python-
Remove_Duplicates_from_Sorted_List.py
Remove_Duplicates_from_Sorted_List.py
py
526
python
en
code
0
github-code
1
9707196048
from botocore.exceptions import ClientError import services from .service import Service from services.response import ServicesApiResponse from typing import Dict from boto3.dynamodb.conditions import Key from services import const import services.utils as utils class DynamoDbService(Service): """ This class ...
CianGrimnir/JourneySharing-Backend
services/dynamodb.py
dynamodb.py
py
6,736
python
en
code
0
github-code
1
15857854141
import sys import load #Quick framework to load the plugin from the cmd line / pycharm load.plugin_start('.') if sys.version_info[0] < 3: anyKey = raw_input("Enter command..") else: anyKey = input("Enter command...") print(anyKey + " isn't the any key, but I'll stop anyway!") load.plugin_stop()
Lutonite/EDMC_Podcast_Player
runme.py
runme.py
py
304
python
en
code
0
github-code
1
6651127391
import os import json import zipfile def zip_files_and_folders(file_paths, zip_name): with zipfile.ZipFile(zip_name, 'w', zipfile.ZIP_DEFLATED) as zipf: for file_path in file_paths: if os.path.isdir(file_path): for root, dirs, files in os.walk(file_path): for...
cphxj123/Dol-BJX-Mods
自制衣服模组生成器/dol衣服美化模组自动生成器.py
dol衣服美化模组自动生成器.py
py
4,526
python
en
code
2
github-code
1
13415005966
# vip_cleaned_.csv # vip_cleaned_for_time_perturbed_.csv if __name__ == '__main__': with open('vip_files/vip_sorted_.csv', 'r') as vip: with open('vip_files/vip_cleaned_for_time_perturbed_.csv', 'w') as vip_cleaned: time = -1 vip_cleaned.write(vip.readline().strip() + '\n') ...
NiramayVaidya/Differential_Privacy_Hemodialysis_SBP_Prediction
clean_vip_sorted_.py
clean_vip_sorted_.py
py
778
python
en
code
2
github-code
1
20065181006
"""Example configurations.""" from spectralcluster import autotune from spectralcluster import constraint from spectralcluster import laplacian from spectralcluster import refinement from spectralcluster import spectral_clusterer AutoTune = autotune.AutoTune ConstraintName = constraint.ConstraintName ConstraintOption...
wq2012/SpectralCluster
spectralcluster/configs.py
configs.py
py
2,729
python
en
code
464
github-code
1
29161122794
import pyautogui import time #-Fail Safe Activated-# pyautogui.FAILSAFE = True currentMouseX, currentMouseY = pyautogui.position() print("X Cordinate is: ", currentMouseX) print("Y Cordinate is: ", currentMouseY) #-Set your Y-start point here yStartPoint = 566 #---INPUT HOW MANY OF YOUR ODERS HERE...
CuiMoo/POSCO_PC
AutoHR/AutoHr.py
AutoHr.py
py
1,500
python
en
code
0
github-code
1
72374240994
#!/usr/bin/python3 import asyncio import random import time import threading from quart import Quart, request, jsonify from servo import Servo from wheel import Wheel from broadcast import VideoBroadcastThread ################################################### # start a thread to broadcast video only start_video = ...
home9464/selfdrivingcar
rest_main.py
rest_main.py
py
2,172
python
en
code
0
github-code
1
6034111414
import typing as t """ Summary: Brute force in the D&C manner consider all possibilities for * OR a smart way with a couple of passes keeping track of the ( and ) occurrences _______________________________________________________________________________ https://leetcode.com/problems/valid-parenthesis-string/ Given...
EvgeniiTitov/coding-practice
coding_practice/sample_problems/leet_code/medium/678_valid_parenthesis_string.py
678_valid_parenthesis_string.py
py
6,664
python
en
code
1
github-code
1
23112442511
import pandas as pd import numpy as np from multiprocessing import cpu_count, Pool cores = cpu_count() def parallelize(df, func): data_split = np.array_split(df, cores) pool = Pool(cores) data = pd.concat(pool.map(func, data_split)) pool.close() pool.join() return data if __name__ == '__mai...
minlik/TextSummarization
utils/multi_proc_utils.py
multi_proc_utils.py
py
343
python
en
code
16
github-code
1
29228421218
import sys from typing import Any # I cant help but wonder how much overhead is added by including QObject, pyqtSignal, and QWidget solely for type hinting from PyQt5.QtCore import QObject, Qt, pyqtSignal from PyQt5.QtWidgets import QAction, QLayout, QStyleFactory, QWidget, QApplication, QMainWindow from utilities.Com...
StaticPH/Split_Hub
utilities/QtHelpers.py
QtHelpers.py
py
5,466
python
en
code
0
github-code
1
6500121637
import cs50 print("Height: ", end="") while True: height = cs50.get_int() if height >= 0 or height <= 23: break print("Retry: ", end="") for i in range(height): j = height - 1 while j > i: print(" ", end="") j -= 1 for k in range(i + 2): print("#", end="") ...
sohamrajput7/CS50x
workspace/pset6/mario.py
mario.py
py
327
python
en
code
0
github-code
1
1527675383
import pickle import math import numpy as np def compress_model(ckpt_path, path="safe_expert.npz", remove_value_network=False): with open(ckpt_path, "rb") as f: data = f.read() unpickled = pickle.loads(data) worker = pickle.loads(unpickled.pop("worker")) if "_optimizer_variables" in worker["st...
metadriverse/TS2C
egpo_utils/save_expert.py
save_expert.py
py
1,017
python
en
code
8
github-code
1
21317574984
#!/user/bin/env python # coding=utf-8 """ @project : PythonEx @ide : PyCharm @file : str_encrypt @author : wuhoubo @desc : @create : 2019/8/4 0:21:49 @update : """ import requests import re def is_chinese(char): """ 判断是否是中文 :param char: 要判断的字符 :return: """ if '\u4e00' <= char <=...
originalMemory/Excercise
PythonEx/string_encrypt.py
string_encrypt.py
py
1,187
python
en
code
1
github-code
1
28392038169
PATH = 'ex1.txt' with open(PATH) as f: lines = [line.strip() for line in f.readlines()] N_STEPS = 10 rules = {} # using a char list to prevent unnecessary string instantiation when we insert chars polymer = list(lines[0]) for line in lines[2:]: toks = line.split('->') pair = toks[0].strip() middle = toks[1].st...
batanete/advent-of-code-2021
day14/ex1/ex1.py
ex1.py
py
675
python
en
code
0
github-code
1
37964376441
import os from pathlib import Path def return_config(factor, mail, private_plugin, uid, tid): base_path = Path(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), "static/upload", str(uid), str(tid)).as_posix() initial_path = base_path + "/initial/" predict_o...
Eric-1986/faCRSA
facrsa_code/library/analysis/config.py
config.py
py
947
python
en
code
0
github-code
1
33800342350
import socket # 缓冲区大小 BUFF_SIZE = 1024 """ UDP发送数据 @parma data: 数据 @param ip_addr: 接收方IP地址 @param port: 接收方端口号 @return 发送数据的字节数 """ def send(data, ip_addr, port): # 创建套接字 udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # 绑定端口,发送数据时会从绑定的端口发送,不会再生成随机端口 #udp_socket.bind(("", 800...
Chentingz/VMMigration
udpmodule.py
udpmodule.py
py
1,340
python
zh
code
0
github-code
1
34101353349
from tkinter import * import pandas import random BACKGROUND_COLOR = "#B1DDC6" current_card = {} try: data = pandas.read_csv("./Flashcard_App/data/unknown_words.csv") except FileNotFoundError: original_data = pandas.read_csv("./Flashcard_App/data/french_words.csv") to_learn = original_data.to_dict(orient="...
Ministerh/first-projects
Flashcard_App/main.py
main.py
py
2,458
python
en
code
0
github-code
1
37285589833
def dutch_flag_sort(balls): start = 0 end = len(balls)-1 while balls[start] =="R" and start < end: start += 1 while balls[end] == "B" and start < end: end -= 1 ## now the bounds of the problem begin at start and end at end inclusively. i = start while i <= end: if ba...
David-S-Hunsicker/learningpython
Sort/dutch_national_flag.py
dutch_national_flag.py
py
601
python
en
code
0
github-code
1
73420122275
import sys import xbmc import xbmcvfs import xbmcgui import json import hashlib import xml.etree.ElementTree as ET from contextlib import contextmanager XML_HEADER = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>' @contextmanager def isactive_winprop(name, value='True', windowid=10000): xbmcgui.Wind...
Atrion/Kodi_18_Repo
script.skinvariables/resources/lib/utils.py
utils.py
py
7,084
python
en
code
1
github-code
1
74345441634
from re import match regex_to_have = "....o" letters_not_have = "c" not_positions = { "a": [0], "b": [1] } file = open("words.txt", 'r') parole = [line.rstrip() for line in file.readlines()] filtered_values = list(filter(lambda v: match("^"+regex_to_have+"$", v), parole)) re_filtered_values = list(filter(lambda...
kratess/findword
main.py
main.py
py
1,294
python
en
code
0
github-code
1
18934358632
#--------------------------------------------------- # 21/05/2020 - начато # программа по переименованию .jpg # под нужды проги База Эльф # #--------------------------------------------------- # import os, configparser, fnmatch from shutil import copyfile from PySide2.QtWidgets import * from PySide2.QtCore import * fr...
MatveyKenya/jpg_RenameAndCopy_Elf
main_my_os.pyw
main_my_os.pyw
pyw
17,687
python
ru
code
0
github-code
1
27192970669
import json import requests import time from apscheduler.schedulers.blocking import BlockingScheduler # 引入后台 import os from utils.file import FileUtil # from utils.requst import postres # from detect import run,main,parse_opt from detect import run,main,parse_opt SPATH = './testfile/input' TPATH = './testfile/output' ...
HypoQ/waterProject
main.py
main.py
py
2,449
python
en
code
0
github-code
1
34994535568
import random def choose_serie(): netflix_series = ["MONEY HEIST", "DARK", "ELITE", "UNORTHODOX", "SEX EDUCATION", "NARCOS", "THE LAST KINGDOM", "MAKING A MURDERER", "STRANGER THINGS", "YOU", "PEAKY BLINDERS", "TIGER KING", "MODERN FAMILY", "BLACKLIST", "BABIES", "BREAKING BAD", "PRISON BREAK"] word = random.c...
medinaale91/miniproject_week1
Hangman_game.py
Hangman_game.py
py
3,540
python
en
code
0
github-code
1
31831184436
from dotenv import load_dotenv import json from utils import * from db import * import jwt import time load_dotenv() def handle_post(c, request: HttpRequest): filename_type = request.path[len("/api/files/?file=") :].split("&type=") filename = filename_type[0] file_type = filename_type[1] size = int(r...
jeff-901/CN2022FallFinal
handle_file.py
handle_file.py
py
2,816
python
en
code
0
github-code
1
25339418278
from fastapi import APIRouter, Depends, HTTPException router = APIRouter( prefix="/companies", tags=["Companies"], responses={ 404: {"description": "Company or companies not found"}, 403: {"description": "Operation not allowed"} } ) fake_companies_db = [ { "id": 1, ...
MikelMC96byte/digital-inventory-service
app/routers/companies.py
companies.py
py
813
python
en
code
0
github-code
1
16017099364
from django.urls import path app_label='api' from .views import * urlpatterns=[ path('books',BookApiViewAll.as_view(),name='book-list'), path('books/<slug:slug>',BookApiView.as_view(),name='book-detail'), path('books/book/create',BookCreateApiView.as_view(),name='book-create'), path('books/<slug:slug>',...
devGauravTiwari/Library-Python
apibook/urls.py
urls.py
py
902
python
en
code
1
github-code
1
15479925188
# -*- coding: utf-8 -*- """ Filename: hsb_trade_tracker.py Date created: Fri Aug 21 12:17:57 2020 @author: Julio Hong Purpose: Tracks all the ongoing trades in the bazaar of Hypixel Skyblock. Focus on lapis lazuli for now. Track how the amount per price changes over time for buy/sell orders. Mayb...
LioHong/Hypixel-Skyblock
hsb_trade_tracker.py
hsb_trade_tracker.py
py
17,030
python
en
code
0
github-code
1
72887707553
from django.contrib.auth.models import AbstractUser from django.core.validators import RegexValidator from django.db import models class User(AbstractUser): POSITIONS = ( ('data', 'Дата-Квантум'), ('it', 'IT-Квантум'), ('robot', 'Робо-Квантум'), ('hightech', 'Хайтек'), ...
nastya-mishina/kvantorium-dms
users/models.py
models.py
py
1,535
python
en
code
0
github-code
1
21080220144
class tables: def __init__(self): self.names = [] self.names_dict = {} self.fields = [] self.types = [] # # # # # self.names.append("permissions") self.fields.append(["tid", "owner", "admin", "manager", "moderator"]) self.types.append(["INT(12) PRIMAR...
6a16ec/bot_7483934
new_main/database_config.py
database_config.py
py
946
python
en
code
0
github-code
1
73184183074
""" Pagination helpers. """ import itertools import math def paginate_iterable(iterable, page, per_page): """ Pagination for custom iterables. returns an iterator. """ start = (page -1) * per_page end = start + per_page return itertools.islice(iterable, start, end) def mongo_paginate_to_d...
amrdraz/java-project-runner
application/resources/pagination.py
pagination.py
py
1,336
python
en
code
0
github-code
1
36648565632
from splinter import Browser from bs4 import BeautifulSoup as bs import pandas as pd from selenium import webdriver def init_browser(): executable_path = {'executable_path': 'chromedriver.exe'} options = webdriver.ChromeOptions() options.add_argument("--start-maximized") options.add_argument("--disabl...
alexrayperry/Web-Scraping-Challenge
mission-to-mars/scrape_mars.py
scrape_mars.py
py
4,276
python
en
code
0
github-code
1
70888274595
# -*- coding: utf-8 -*- # 문자열 S가 주어졌을 때, 모든 접미사를 사전순으로 정렬한 다음 출력하는 프로그램을 작성하시오. # baekjoon의 접미사는 baekjoon, aekjoon, ekjoon, kjoon, joon, oon, on, n 으로 총 8가지 s = input() res = [] for i in range(len(s)): res.append(s[i:]) res.sort() for el in res: print(el)
rhkddud3917/Algorithm-Practice
BOJ/11656-접미사배열.py
11656-접미사배열.py
py
365
python
ko
code
0
github-code
1
32669237793
from genericpath import isfile import os from fnmatch import fnmatch ############################################################################### def hooks_before_user_overrides(worker): print("## Hooks before user overrides\n") append_dir_with_image_to_doxyfile(worker) propose_a_placeholder_for_the_pr...
ProjectPaperwork/ppaperwork
gherkin_paperwork/hooks_before_user_overrides.py
hooks_before_user_overrides.py
py
1,365
python
en
code
4
github-code
1
25410794735
import optparse import os import sys from util import build_device from util import build_utils BUILD_ANDROID_DIR = os.path.abspath( os.path.join(os.path.dirname(__file__), '..')) sys.path.append(BUILD_ANDROID_DIR) import devil_chromium def main(argv): parser = optparse.OptionParser() parser.add_option('--...
hanpfei/chromium-net
build/android/gyp/get_device_configuration.py
get_device_configuration.py
py
2,051
python
en
code
289
github-code
1
27800830147
# -*- coding: utf-8 -*- import numpy as np from glob import glob import math import matplotlib.pyplot as plt from collections import defaultdict from collections import OrderedDict from collections import namedtuple import pickle import re import os.path from scipy import stats # used for label sorting #import operat...
sealuzh/benchmarking_online_appendix
scripts/requests_per_second_v2.py
requests_per_second_v2.py
py
22,852
python
en
code
0
github-code
1
40257620103
'''Given an array of positive and negative numbers, arrange them in an alternate fashion such that every positive number is followed by negative and vice-versa maintaining the order of appearance. Number of positive and negative numbers need not be equal. If there are more positive numbers they appear at the end of t...
barvaliyavishal/DataStructure
GeeksForGeeks/RearrangeArray.py
RearrangeArray.py
py
1,806
python
en
code
2
github-code
1
11815448576
import threading from urllib import parse from urllib.request import urlopen from django.contrib import admin from django.contrib import messages from django.urls import reverse from django.utils.safestring import mark_safe from mysite import settings from vodmanagement.models import Vod from epg.models import Channel...
xahhy/Django-vod
epg/admin.py
admin.py
py
2,411
python
en
code
16
github-code
1
29796134871
CREATE_ACCOUNT = "create_account" AUTH = "auth" STOP_SELF = "stop_self" GET_MESSAGE = "get_message" ADD_MESSAGE = "add_message" SEND_BROADCAST = "send_broadcast" GLOBAL_MESSAGE = "global_message" GET_GLOBAL_MESSAGES = "get_global_messages" GET_ONLINE_PLAYERS = "get_online_players" GAME_REQUEST = "game_request"...
SanarDev/minroob-backend
types/request_types.py
request_types.py
py
821
python
en
code
0
github-code
1
40884002735
import os import glob import json import datetime from collections import defaultdict import cv2 import numpy as np import pandas as pd from sklearn.neighbors import KDTree from PySide6.QtCore import QObject, Signal from ..utils.common import get_immediate_subdirectories, to_celsius from ..utils.geojson import load_g...
LukasBommes/PV-Hawk-Viewer
src/analysis/temperatures.py
temperatures.py
py
8,344
python
en
code
6
github-code
1
42390106843
import numpy as np from scipy.interpolate import RectBivariateSpline def LucasKanade_new(It0, It1, rect, p0 = np.zeros(2)): x1, y1, x2, y2 = rect[0], rect[1], rect[2], rect[3] p, threshold = p0, 0.1 H, W = It1.shape x = np.linspace(0, H, H) y = np.linspace(0, W, W) It0_BiRect = RectBivariateSpline(x, y, It...
danenigma/Traditional-Computer-Vision
LK-Tracking/code/testing/LucasKanade_new.py
LucasKanade_new.py
py
1,024
python
en
code
0
github-code
1
11787865317
from collections import Counter import transformers import os import torch import numpy as np import pyterrier as pt if not pt.started(): pt.init() import pandas as pd from more_itertools import chunked import deepct def _subword_weight_to_word_weight(tokens, logits, smoothing="none", m=100, keep_all_terms=False):...
terrierteam/pyterrier_deepct
pyterrier_deepct/__init__.py
__init__.py
py
6,447
python
en
code
4
github-code
1
2423273127
from odoo import fields, models class RefReference(models.Model): _inherit = 'ref.reference' _name = _inherit tagging_ids = fields.Many2many( comodel_name='tagging.tags', relation='tagging_ref_reference', column1='reference_id', column2='tag_id', string='Tags', ...
decgroupe/odoo-addons-dec
product_reference_tagging/models/ref_reference.py
ref_reference.py
py
323
python
en
code
2
github-code
1
7974408338
import os import numpy as np from matplotlib import pyplot as plt from time import perf_counter_ns import python_impl import numba_impl import ray_impl import opencl_impl MATRIX_MIN_VALUE = -10 MATRIX_MAX_VALUE = 10 def test_correctness(method, max_size): for i in range(3, max_size): matrix = np.random....
DocentSzachista/akceleracja
main.py
main.py
py
2,693
python
en
code
0
github-code
1
70270417955
from django.db import models from edc_base.model.models import BaseUuidModel from .panel import Panel class PanelMapping(BaseUuidModel): panel_text = models.CharField( max_length=50, help_text='text name of external panel', ) panel = models.ForeignKey(Panel, null=True, help_text="local...
botswana-harvard/edc-lab
old/lab_clinic_api/models/panel_mapping.py
panel_mapping.py
py
448
python
en
code
0
github-code
1
22932207040
#!/bin/env python3 # Authors: ## Alexandre Santos 80106 ## Leonardo Costa 80162 from ass1_classes import CorpusReader, SimpleTokenizer, ImprovedTokenizer, Indexer, results import time import sys import tracemalloc import json #Start time time1 = time.time() data = CorpusReader.read('all_sources_metadata_2020-03-1...
tuxPT/RI_Assignment1
RI_ass1.py
RI_ass1.py
py
1,088
python
en
code
1
github-code
1
11946989578
from django.db.models import Sum from debts.models import Debt def get_users(debts): """will get users""" users = [] for debt in debts: if debt.creditor not in users: users.append(debt.creditor) if debt.debtor not in users: users.append(debt.debtor) return users...
Rven721/my_crm
debts/busines_logic/debt_calc.py
debt_calc.py
py
2,986
python
en
code
0
github-code
1
22538270080
""" Семинар занятие №8 Базовые задания: Реализовать класс Matrix (матрица). Обеспечить перегрузку конструктора класса (метод init()), который должен принимать данные (список списков) для формирования матрицы. [[], [], []] Следующий шаг — реализовать перегрузку метода str() для вывода матрицы в привычном виде. Далее ре...
AlexandrGrishchenko/Python_2-_quarter_seminar_GB
Basik task/lesson 8/Seminar 8 basik task 1.py
Seminar 8 basik task 1.py
py
2,911
python
ru
code
0
github-code
1
25327899692
import datetime import pandas as pd import random import simpy import numpy as np from scipy.stats import uniform class Elevator: """ Elevator that move people from floor to floor Has a max compatity Uses a event to notifiy passengers when they can get on the elevator ...
jeroensimacan/simulating_logistics_processes
elevator.py
elevator.py
py
9,910
python
en
code
0
github-code
1
14281799287
from q2generator import * import math import numpy as np from collections import Counter import matplotlib.pyplot as plt import pdb import random def make_deepcopy( Switches, Graph_sz ): """ Creates a deep copy of all switch settiings within a graph""" return [[Switches[y][x] for x in range(Graph_sz)] for y in range...
sebastianstaahl/Statistical-Methods-in-Applied-Computer-Science
q2.py
q2.py
py
14,249
python
en
code
0
github-code
1
6150757713
# coding: utf-8 import os import random import typing as t from PIL.Image import new as createImage, Image, QUAD, BILINEAR from PIL.ImageDraw import Draw, ImageDraw from PIL.ImageFilter import SMOOTH from PIL.ImageFont import FreeTypeFont, truetype from io import BytesIO import time ColorTuple = t.Union[t.Tuple[int, i...
Ya0h4cker/MyCTFproblems
ACTF 2023/story/story/utils/captcha.py
captcha.py
py
5,858
python
en
code
0
github-code
1
3367828967
#!/usr/bin/env python3 import json import sys import http.client as http import subprocess import re import os ### # COLOR CONSTANTS ### RED='\033[0;31m' GREEN='\033[0;32m' BLUE='\033[0;34m' NC='\033[0m' # No Color ### # CONFIGURABLE ### JIRA_HOST = 'jira.atlassian.com' JIRA_API_VERSION = '2' GITLAB_HOST = 'gitlab.c...
Xez99/openmr
open-mr.py
open-mr.py
py
7,676
python
en
code
0
github-code
1
74246109472
def day_cal(list_in): month_day = {1: 31, 2: 28, 3: 31, 4: 30, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31} start_month = list_in[0] finish_month = list_in[2] start_day = list_in[1] finish_day = list_in[3] result = 0 if start_month == finish_month: retu...
jinyoong/SWEA
problem/D2/1948. 날짜 계산기.py
1948. 날짜 계산기.py
py
715
python
en
code
0
github-code
1
22711366106
'''@file feature_reader.py reading features and applying cmvn and splicing them''' import copy from nabu.processing import ark from nabu.processing import readfiles import numpy as np class FeatureReader(object): '''Class that can read features from a Kaldi archive and process them (cmvn and splicing)''' ...
JeroenBosmans/nabu
nabu/processing/feature_reader.py
feature_reader.py
py
4,262
python
en
code
0
github-code
1
7518700892
#!/usr/bin/python3 """ script that takes in a URL and an email, sends a POST request """ import urllib.parse import urllib.request import sys if __name__ == "__main__": url = sys.argv[1] email = {'email': sys.argv[2]} data = urllib.parse.urlencode(email) data = data.encode('utf-8') req = urllib.r...
kyeimuda/alx-higher_level_programming
0x11-python-network_1/2-post_email.py
2-post_email.py
py
467
python
en
code
0
github-code
1
32704990583
from itertools import permutations def isPrime(n): if n < 2: return False for i in range(2, int(n ** 0.5) + 1): if n % i == 0: return False return True def solution(numbers): result = [] # numbers에서 나올 수 있는 숫자 리스트 도출 arr = [] numbers = [n for n in numbers...
Min-su-Jeong/Algorithm_Study
프로그래머스/lv2/42839. 소수 찾기/소수 찾기.py
소수 찾기.py
py
645
python
ko
code
0
github-code
1
33458341126
""" http://stackoverflow.com/questions/3612094/better-way-to-zip-files-in-python-zip-a-whole-directory-with-a-single-command?lq=1 http://stackoverflow.com/questions/10060069/safely-extract-zip-or-tar-using-python """ import os import string import zipfile from .log import warning def zipdir(target_dir, dest_file, c...
soundmud/soundrts
soundrts/lib/zipdir.py
zipdir.py
py
1,722
python
en
code
37
github-code
1
17342271468
from tkinter import * import tkinter.messagebox import PIL.Image import PIL.ImageTk import pickle import winsound # main (root) GUI menu class MainMenu: def __init__(self, master): self.master = master self.master.title('Welcome Menu') self.top_frame = tkinter.Frame(self.mas...
JamesNowak/final_project
final.py
final.py
py
15,107
python
en
code
0
github-code
1
41033760594
"""Installs some sample data. Here we have a handful of postal codes for a few US/Canadian cities. Then, 100 Person records are installed, each with a randomly selected postal code. """ import random from .environment import Base from .environment import Session from .model import Address from .model import City ...
sqlalchemy/sqlalchemy
examples/dogpile_caching/fixture_data.py
fixture_data.py
py
1,764
python
en
code
8,024
github-code
1
11510531692
# Released under the MIT License. See LICENSE for details. # """Implements a flag used for marking bases, capture-the-flag games, etc.""" from __future__ import annotations from dataclasses import dataclass from typing import TYPE_CHECKING from bascenev1lib.gameutils import SharedObjects import bascenev1 as bs if T...
efroemling/ballistica
src/assets/ba_data/python/bascenev1lib/actor/flag.py
flag.py
py
12,189
python
en
code
468
github-code
1
73703380194
import socket import struct import matplotlib.pyplot as plt import threading import queue from queue import Queue bone_map = [ "Hips", # 0 "Spine", # 1 None, # 2 "Chest", # 3 None, # 4 "UpperChest", # 5 None, # 6 "-", # 7 "-", # 8 "Neck", # 9 "Head", # 10 "Rig...
gangadhara691/mocopi_read
mcp_receiver/receiver1.py
receiver1.py
py
6,416
python
en
code
0
github-code
1
42747893077
from pwn import * #context.log_level = 'debug' context.terminal = ['tmux', 'splitw', '-h'] file = "./bookstore" bin = ELF(file) libc = ELF("/lib/x86_64-linux-gnu/libc.so.6") conn = process(file) #gdb.attach(conn) def menu(choice, ch=None): conn.recvuntil("Submit\n") if ch is None: conn.sendline(str(choice))...
DhavalKapil/ctf-writeups
hacklu-2015/bookstore/exploit.py
exploit.py
py
2,547
python
en
code
22
github-code
1
14771653745
# Importing the Agent class from the mesa module. # The above code is importing the random and math modules. import random import math from mesa import Agent # ---------------------------------------------------------- # Actividad Integradora agents.py # # Date: 21-Nov-2022 # Authors: # Sergio Manuel Gonzale...
SergioGonzalez24/Movilidad-Urbana-MSMGC-GPO-302
ActividadIntegradora/Server/agents.py
agents.py
py
17,573
python
en
code
3
github-code
1
28987698317
from enum import IntEnum import numpy as np from libcbm.storage.series import Series import numba class SpinupState(IntEnum): """The possible spinup states for stands during spinup""" AnnualProcesses = 1 HistoricalEvent = 2 LastPassEvent = 3 GrowToFinalAge = 4 Delay = 5 End = 6 @numba....
cat-cfs/libcbm_py
libcbm/model/model_definition/spinup_engine.py
spinup_engine.py
py
5,178
python
en
code
6
github-code
1
3526135645
# Erros de Sintaxe x = 10 y = 5 print(x + y) if x == 3: print('x é igual à 3') print('fim do bloco de código') # Erros em Tempo de Execução a = 1000 print(a) b = 0 print(b) #c = a / b #print(c) cidade = 'Belo Horizonte' print(cidade) estado = 'Minas Gerais' print(estado) #print(cidade, estado, pais) cidad...
ubiratantavares/python
xp educacao/bootcamp desenvolvedor python/capitulo02_aula03.py
capitulo02_aula03.py
py
623
python
pt
code
0
github-code
1
18096915998
import requests import csv import bs4 as bs from calendar import monthrange as mr import pandas as pd import arrow # Grabs the url for the selected month and parses it using html urls = ['http://clubomgsf.com/calendar/month/2019/01/'] for url in urls: response = requests.get(url) soup = bs.BeautifulSoup(respon...
Astatham98/EventWebScrape
webscrape1/clubomg.py
clubomg.py
py
5,250
python
en
code
0
github-code
1
72374385954
import MySQLdb import MySQLdb.cursors as cursors from Pattern import Pattern import datetime from pprint import pprint import uuid from pypika import MySQLQuery, Table, Field, Order, functions as fn, JoinType import time import json import socket from openpyxl import Workbook import copy import requests import time imp...
hlmn/TA
checkReplikasi.py
checkReplikasi.py
py
3,402
python
en
code
0
github-code
1
17909885754
from openerp import models, fields, api class MroOperationMaintenanceProperty(models.Model): _name = "mro.operation_maintenance_property" _inherit = [ "mro.operation_maintenance_common" ] _description = "MRO Operation Maintenance for Property" @api.multi @api.depends( "type_id...
open-synergy/opnsynid-property
property_mro/models/mro_operation_maintenance_property.py
mro_operation_maintenance_property.py
py
1,315
python
en
code
0
github-code
1
73003816033
import random from game import * class Tournament(object): GAME_SIZE = 5 def __init__(self, players, rounds): self.players = players while len(self.players) < 5: self.players = self.players + players self.rounds = rounds self.victories = {i:0 for i,_ in enumerate(s...
DanielStoyell/nothanksgame
tournament.py
tournament.py
py
1,436
python
en
code
1
github-code
1
27508929995
from django.urls import reverse from django.utils.html import format_html from wagtail.contrib.modeladmin.helpers import PageAdminURLHelper, PageButtonHelper from wagtail.contrib.modeladmin.mixins import ThumbnailMixin from wagtail.contrib.modeladmin.options import ( ModelAdmin, ModelAdminGroup, modeladmin_...
WesternFriend/WF-website
magazine/wagtail_hooks.py
wagtail_hooks.py
py
5,501
python
en
code
46
github-code
1
72662594595
import re from dice import Dice, BufferedDice dice_pattern = re.compile('\d+(d|D)\d+') def extract_dice_from_string(s): s = str.lower(s) arr = s.split('d') dices = arr[0] sides = arr[1] return dices, sides def throw_the_dice(command): dices, sides = extract_dice_from_string(command) d ...
EarthModule/TrulyRandomDiceThrower
truerandomdice/diceroller.py
diceroller.py
py
1,882
python
en
code
2
github-code
1
25312889494
from django.urls import path from .views import blog, blogDetail, TagView, CategoryDetailView , CreateBlog ,Categorylist, UpdateBlog , DeleteBlog, Privacy urlpatterns = [ path('', blog, name="blog"), path('detail/<slug:slug_name>', blogDetail, name="detail"), path('tags/<slug:slug_tag>',TagView, name = 'ta...
AnvarNarzullayev/blog
blog/urls.py
urls.py
py
727
python
en
code
1
github-code
1
72858901474
import re import pandas as pd with open('./months_test/month.txt') as month_file: month_reader = month_file.readlines() global index global output index = 1 for line in month_reader: if re.match(r'[A-Z][A-Z][A-Z]/[0-9][0-9][0-9][0-9]', line): output = line # print(st...
Dev-Lyh/system-jm
months_test/months.py
months.py
py
1,041
python
en
code
1
github-code
1
25476349860
# -*- coding: utf-8 -*- import datetime from pathlib import Path import emoji import os import re from logzero import logger as log from peewee import fn from telegram import ( ForceReply, InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, ReplyKeyboardMarkup, TelegramError, ) from tel...
JosXa/BotListBot
botlistbot/components/admin.py
admin.py
py
38,333
python
en
code
56
github-code
1
18709079200
# Append Dictionary Keys and Values ( In order ) in dictionary # Input : test_dict = {“Gfg” : 1, “is” : 2, “Best” : 3} # Output : [‘Gfg’, ‘is’, ‘Best’, 1, 2, 3] # Explanation : All the keys before all the values in list. test_dict = {"Gfg" : 1, "is" : 3, "Best" : 2} print("======= 1) Naive Method ======") lst = [] ...
dilipksahu/Python-Programming-Example
Dictionary Programs/appendDictKeysValues.py
appendDictKeysValues.py
py
753
python
en
code
0
github-code
1
41690429860
# Функция file_date создает новый файл в текущем рабочем каталоге, проверяет дату изменения файла и возвращает только дату временной метки в формате гггг-мм-дд. Заполните пробелы, чтобы создать файл с именем «newfile.txt», и проверьте дату его изменения. import os import datetime def file_date(filename): # Create...
pers5not/my_rep
Google/Using_Python_to_Interact_with_the_Operating_System/week_2/ex_02_5.py
ex_02_5.py
py
976
python
ru
code
0
github-code
1
41977926388
#!/usr/bin/python import os import sys sys.path.append(os.path.join(os.getcwd(), '../')) import pytest import blackjack.card as card import random import string def test_functional(): for suit in ('hearts', 'diamonds', 'spades', 'clubs'): for number in xrange(1, 14): newCard = card.Card(numb...
suhasgaddam/blackjack-python
blackjack/test/test_card.py
test_card.py
py
1,989
python
en
code
0
github-code
1
20157899929
import os os.environ['PYOPENGL_PLATFORM'] = 'egl' from render_utils import load_obj_mesh, param_to_tensor, rotate_mesh, \ pers_get_depth_maps, get_depth_maps, pers_add_lights, add_lights from tqdm import tqdm import numpy as np import pickle import smplx import cv2 import torch from scipy.spatial.transform import R...
SangHunHan92/2K2K
render/render.py
render.py
py
18,787
python
en
code
170
github-code
1
34549453728
from batch import Batch from student import Student class DemoDB: def __init__(self): self.__batches = [] def existing_records(self): batch1 = Batch() # batch1 1 info batch1.b_id = 1001 batch1.b_name = "RIT AI - AP" # course info batch1.course.c_id = 10...
rizwan-ai/AI-AP
UMLPyOOPProject/demo_db.py
demo_db.py
py
4,291
python
en
code
1
github-code
1
28459659487
import os import sys sys.path.append(os.path.dirname(os.path.dirname(__file__))) from autowsgr.constants.other_constants import ALL_SHIP_TYPES_CN, CN_TYPE_TO_EN_TYPE from autowsgr.ocr.ship_name import get_allow, recognize DEBUG = False def split_str(str, keywords): res = [] while len(str): flag = 0...
huan-yp/Auto-WSGR
tools/get_decisive_enemy.py
get_decisive_enemy.py
py
1,271
python
en
code
40
github-code
1
26466912861
''' Created on 17.2.2016 @author: Claire ''' import urllib, codecs from requests import Request, Session import requests, json, logging logger = logging.getLogger('lasQuery') hdlr = logging.FileHandler('/tmp/linguistics.log') formatter = logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s') hdlr.setForm...
SemanticComputing/aatos
las_query.py
las_query.py
py
5,981
python
en
code
0
github-code
1
15643038724
import csv import re from utils import get_star_elements, get_soup, is_last_page, get_key, get_item_from_star_element import os from print import print_yellow, print_blue, print_red hash = {} page_number = 1 file_name = './data.csv' does_file_exists = bool(os.path.isfile(file_name)) if does_file_exists: with ope...
shibisuriya/indian-e-commerce-scaper
amazon/main.py
main.py
py
2,363
python
en
code
9
github-code
1
12450613973
import boto3 from datetime import datetime import time TABLE_NAME = 'VisitorData' dynamodb = boto3.resource('dynamodb') table = dynamodb.Table(TABLE_NAME) def get_unix_time(): """Returns current unix timestamp""" d = datetime.utcnow() return str(time.mktime(d.timetuple())) def add_visit(user_agent): ...
mgochoa/sam-udea-demo
src/index.py
index.py
py
829
python
en
code
0
github-code
1
17844225463
# -*- test-case-name: imaginary.test -*- from twisted.trial import unittest from axiom import store from imaginary import eimaginary, objects class ContainerTestCase(unittest.TestCase): def setUp(self): self.store = store.Store() self.containmentCore = objects.Thing(store=self.store, name=u"cont...
rcarmo/divmod.org
Imaginary/imaginary/test/test_container.py
test_container.py
py
2,536
python
en
code
10
github-code
1
35151983955
""" This module defines a degradable lunar-lander environment derived from OpenAI gym. """ import numpy as np from sklearn.base import BaseEstimator from gym.envs.box2d import lunar_lander from gym.envs.box2d import LunarLander as OGLunarLander import matplotlib.pyplot as plt import matplotlib.patches as mpatches cla...
hazrmard/AirplaneFaultTolerance
systems/lunarlander.py
lunarlander.py
py
2,017
python
en
code
0
github-code
1