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
39455791168
def even_odd(data, redata): if len(data) == 0: return redata else: if data[0] % 2 == 0: redata.insert(0, data[0]) return even_odd(data[1:], redata) else: redata.append(data[0]) return even_odd(data[1:], redata) if __name__ == '__main__': ...
huyuan95/Learn-Python
data structure/ch04/C4_19.py
C4_19.py
py
401
python
en
code
0
github-code
36
38567808559
adjList = { 'a' : ['b','c','d'], 'b' : ['a','c'], 'c' : ['a','b','d','e'], 'd' : ['a','c','e'], 'e' : ['c','d','f'], 'f' : ['e'] } ''' visited = {a:1} # parent = {} dfsTraversal = [] for node in adjList.keys(): visited[node] = 0 # # parent[node] = None def dfs(source): vis...
archanakalburgi/Algorithms
Graphs/depthFirstSeaarch.py
depthFirstSeaarch.py
py
863
python
en
code
1
github-code
36
34338800542
# https://leetcode.com/problems/n-ary-tree-level-order-traversal/ from typing import List # Definition for a Node. class Node: def __init__(self, val=None, children=None): self.val = val self.children = children class Solution: def levelOrder(self, root: 'Node') -> List[List[int]]: rs...
0x0400/LeetCode
p429.py
p429.py
py
714
python
en
code
0
github-code
36
34734577549
import numpy as np import time pi = np.pi naxis = np.newaxis F_2D = lambda x: np.fft.fft2(x, axes=(0, 1)) IF_2D = lambda x: np.fft.ifft2(x, axes=(0, 1)) F_3D = lambda x: np.fft.fftn(x, axes=(0, 1, 2)) IF_3D = lambda x: np.fft.ifftn(x, axes=(0, 1, 2)) def pupilGen(fxlin, fylin, wavelength, na, na_in=0.0): ''' pu...
Waller-Lab/3DQuantitativeDPC
python_code/algorithm_3ddpc.py
algorithm_3ddpc.py
py
16,007
python
en
code
11
github-code
36
35000621242
import os import torch import pandas as pd import torchaudio import cv2 import torchaudio.transforms as T from torch.utils.data import Dataset import numpy as np from .utils_dataset import get_transform class BatvisionV2Dataset(Dataset): def __init__(self, cfg, annotation_file, location_blacklist=None): ...
AmandineBtto/Batvision-Dataset
UNetSoundOnly/dataloader/BatvisionV2_Dataset.py
BatvisionV2_Dataset.py
py
3,853
python
en
code
6
github-code
36
44033939735
import sys import heapq n = int(sys.stdin.readline()) heap = [] computers = [0 for _ in range(n)] count = [0 for _ in range(n)] su = 0 for _ in range(n): p,q = map(int, sys.stdin.readline().split()) heapq.heappush(heap, [p,q]) while heap: temp = heapq.heappop(heap) for i in range(l...
GluteusStrength/Algorithm
๋ฐฑ์ค€/Gold/12764.โ€…์‹ธ์ง€๋ฐฉ์—โ€…๊ฐ„โ€…์ค€ํ•˜/์‹ธ์ง€๋ฐฉ์—โ€…๊ฐ„โ€…์ค€ํ•˜.py
์‹ธ์ง€๋ฐฉ์—โ€…๊ฐ„โ€…์ค€ํ•˜.py
py
615
python
en
code
0
github-code
36
40776965677
def minimumSwaps(arr): count = 0 for i in range(len(arr)): while arr[i] != i+1: temp = arr[i]; arr[i] = arr[temp-1]; arr[temp-1] = temp; count +=1; return count; n=int(input()) a=list(map(int,input().split())) print(minimumSwaps(a))
keshavsingh4522/Python
HackerRank/Interview Preparation Kit/Arrays/Minimum-Swaps-2.py
Minimum-Swaps-2.py
py
302
python
en
code
67
github-code
36
72489930665
import numpy as np import itertools import argparse cards = ['A', 'K', 'Q', 'J', '10', '9', '8', '7', '6', '5', '4', '3', '2'] suits = ['S', 'H', 'C', 'D'] class Card: def __init__(self, val, suit): self.val = val self.suit = suit def __str__(self): return f'{self.val} {self.suit}' c...
arpit-1110/Poker
poker_odds.py
poker_odds.py
py
7,581
python
en
code
0
github-code
36
3642645644
#!/usr/bin/python import json import sys out_file = sys.argv[1] document_entities_file = sys.argv[2] query_file = sys.argv[3] query_docs = {} docs = set() with open(out_file) as f: for line in f: query, _, document, rank, _, _ = line.split() rank = int(rank) if rank > 10: continue if query not in query_...
gtsherman/entities-experiments
src/query_entities.py
query_entities.py
py
992
python
en
code
0
github-code
36
74105621545
from django.shortcuts import render # se importan los modelos from .models import Author, Genre, Book, BookInstance # se crea la funcion index def index (request) : # se optiene el numero de libros num_books = Book.objects.all().count() # se optiene el numero de instancias num_inctances = Book...
MallicTesla/Mis_primeros_pasos
Programacion/002 ejemplos/002 - 13 django catalogo/catalog/views.py
views.py
py
1,201
python
es
code
1
github-code
36
31508455076
import asyncio import json from aiogram import Bot, Dispatcher, executor, types from aiogram.utils.markdown import hbold, hunderline, hcode, hlink from aiogram.dispatcher.filters import Text from config import token from test import morph from main import check_news_update bot = Bot(token=token, parse_mode=types.Par...
KondratevProgi/news
tg_bot.py
tg_bot.py
py
2,254
python
en
code
0
github-code
36
6568975593
#6588 from sys import stdin array = [True for i in range(1000001)] # ์ „์ฒด ์ˆ˜ ๋งŒํผ True์˜ ๋ฆฌ์ŠคํŠธ ์ƒ์„ฑ for i in range(2, 1001): # 1001 = int(math.sqrt(1000000)) + 1, ์—๋ผํ† ์Šคํ…Œ๋„ค์Šค ์ฒด -> 1000^2 = 1000000: ์ œ๊ณฑ๊ทผ๊นŒ์ง€๋งŒ ๊ฒ€์ฆํ•ด ์ฝ”๋“œ ๊ฐ™๋‹ค. if array[i]: for k in range(i + i, 1000001, i): #range(์‹œ์ž‘ ์ˆซ์ž, ์ข…๋ฃŒ์ˆซ์ž, step) array[k] = False...
jjun-ho/Baekjoon
์•Œ๊ณ ๋ฆฌ์ฆ˜ ๊ธฐ์ดˆ 1/2-1. ์ˆ˜ํ•™ 1/6_๊ณจ๋“œ๋ฐ”ํ์˜_์ถ”์ธก.py
6_๊ณจ๋“œ๋ฐ”ํ์˜_์ถ”์ธก.py
py
2,100
python
ko
code
0
github-code
36
33939924493
import unittest import random from sortedkeycollections import AVLTree, SortedKeyList, SortedArrayList class TestSortedKeyList(unittest.TestCase): def setUp(self): self.test_class = SortedKeyList def test_insert(self): values_integer = [(21, '113'), (71, 'wcwf'), (-6, (121, 32, 'x')), (11, 23...
i1red/oop-3rd-sem
lab1/tests/test_sortedkeycollections.py
test_sortedkeycollections.py
py
2,935
python
en
code
0
github-code
36
71578942183
import vtk def main(): colors = vtk.vtkNamedColors() # Set the background color. colors.SetColor("bkg", [0.2, 0.3, 0.4, 1.0]) # Create a sphere to deform sphere = vtk.vtkSphereSource() sphere.SetThetaResolution(51) sphere.SetPhiResolution(17) sphere.Update() bounds = sphere.G...
lorensen/VTKExamples
src/Python/Meshes/DeformPointSet.py
DeformPointSet.py
py
3,526
python
en
code
319
github-code
36
45556966628
"""Calcula el precio de la energรญa diario a partir de los precio horarios""" import pathlib from utils import read_format_hourly_prices, resample_hourly_prices base_path = pathlib.Path.cwd() cleansed_path = base_path.joinpath("data_lake/cleansed") business_path = base_path.joinpath("data_lake/business") def compute...
productos-de-datos/proyecto-albetancurqu42
src/data/compute_daily_prices.py
compute_daily_prices.py
py
1,216
python
es
code
0
github-code
36
71119081063
def minigame(): import pygame import sys import pictures import random status = 'alive' zombie_size = [50,100,150,200,250,300] obstacle_list = [] bg_pos = 0 move= 0 side = 0 score = 0 game_screen = pygame.display.set_mode((608,342)) #creates a screen 1024 pixels wide and 576 pixels long clock = pygame...
jadeyujinlee/Smithpocalypse-v.1
minigame.py
minigame.py
py
3,488
python
en
code
0
github-code
36
37677063476
#!/usr/bin/env python3 import os import sys import urllib.request from flask import ( Flask, flash, jsonify, make_response, redirect, render_template, request, ) from werkzeug.utils import secure_filename from scripts import predict_model from scripts import mongodb from scripts import tr...
projectasteria/PlaceholderAPI
app.py
app.py
py
6,137
python
en
code
0
github-code
36
74267310505
# -*- coding: utf-8 -*- # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
line/line-bot-sdk-python
linebot/models/actions.py
actions.py
py
9,405
python
en
code
1,739
github-code
36
30788452362
import sys input = sys.stdin.readline from queue import PriorityQueue queue = PriorityQueue() # ์šฐ์„ ์ˆœ์œ„ ํ N = int(input()) for i in range(N): a = int(input()) if a == 0: if queue.empty(): print(0) else: print(-queue.get()) # ๊ฐ€์žฅ ํฐ ๊ฐ’ ์ œ๊ฑฐํ•˜๊ณ  - ๋ถ™์—ฌ์„œ ์ถœ๋ ฅํ•˜๊ธฐ (๋„ฃ์„ ๋•Œ ์Œ์ˆ˜๋กœ ...
sojungpp/Algorithm
๋ฐฑ์ค€/Silver/11279.โ€…์ตœ๋Œ€โ€…ํž™/์ตœ๋Œ€โ€…ํž™.py
์ตœ๋Œ€โ€…ํž™.py
py
480
python
ko
code
0
github-code
36
17789850439
class SLList(): class node(): def __init__(self,data): self.element=data self.next = None #declares and intializes to NONE #NODE class is visible to every method in SLLIST class def __init__(self):#happens at every obj creation for SLList class self.head = se...
abi2189/DBMS-Electricity-Bill-Payment-System
AP-WORK/python/linkedList.py
linkedList.py
py
2,831
python
en
code
0
github-code
36
24788364259
import collections import heapq class Solution: def networkDelayTime(self, times: list[list[int]], n: int, k: int) -> int: graph = collections.defaultdict(list) for u, v, w in times: graph[u].append((w, v)) hq = [(0, k)] dist = collections.defaultdict(int) while h...
inhyeokJeon/AALGGO
Python/LeetCode/shortest_path/743_network_delay_time.py
743_network_delay_time.py
py
772
python
en
code
0
github-code
36
70943557223
from pyspark.sql import SparkSession spark = SparkSession.builder.appName('test_rdd').getOrCreate() sc = spark.sparkContext class TestRDD(): # Creations def test_create_from_dataframe(self): df = spark.range(10).toDF('id') rdd = df.rdd rows = rdd.collect() assert len(rows) == ...
bablookr/big-data-experiments
pyspark-experiments/test/test_rdd.py
test_rdd.py
py
4,725
python
en
code
0
github-code
36
71578941543
#!/usr/bin/env python import os.path import vtk def get_program_parameters(): import argparse description = 'Decimate polydata.' epilogue = ''' This is an example using vtkDecimatePro to decimate input polydata, if provided, or a sphere otherwise. ''' parser = argparse.ArgumentParser(descrip...
lorensen/VTKExamples
src/Python/Meshes/Decimation.py
Decimation.py
py
5,683
python
en
code
319
github-code
36
43034357184
import datetime import os import time import xarray as xr from app.dataprocessing.benchmark import Timer from app.dataprocessing.datasource_interface import IDatasource from app.dataprocessing.local.local_reader import LocalReader from app.dataprocessing.remote.opendap_access_cas import OpendapAccessCAS from app.datas...
oyjoh/adaptive-data-retrieval
app/dataprocessing/data_handler.py
data_handler.py
py
5,439
python
en
code
0
github-code
36
16173071673
""" Count the number of occurrences of each character and return it as a (list of tuples) in order of appearance. For empty output return (an empty list). Consult the solution set-up for the exact data structure implementation depending on your language. Example: ordered_count("abracadabra") == [('a', 5), ('b', 2), ...
genievy/codewars
tasks_from_codewars/7kyu/Ordered Count of Characters.py
Ordered Count of Characters.py
py
752
python
en
code
0
github-code
36
9108378468
from setuptools import setup, find_packages from os import path from io import open here = path.abspath(path.dirname(__file__)) reqs = [] with open(path.join(here, "README.md"), encoding="utf-8") as f: long_description = f.read() with open(path.join(here, "requirements.txt"), encoding="utf-8") as f: read_lin...
kirankotari/decimaljs
setup.py
setup.py
py
1,323
python
en
code
1
github-code
36
451086909
#!/usr/bin/python3 from .config_utils import get_base_config from .crypto_utils import hash_file from .file_utils import profile_url_file, clean_up from .filter_utils import filter_url_list from .log_utils import get_module_logger from .plugin_utils import load_plugins from .viper_utils import upload_to_viper from .vi...
phage-nz/ph0neutria
core/malware_utils.py
malware_utils.py
py
5,478
python
en
code
299
github-code
36
30714122215
import math from re import L import cv2 import mediapipe as mp import matplotlib.pyplot as plt import matplotlib.image as mpimg from moviepy.editor import VideoFileClip mp_drawing = mp.solutions.drawing_utils mp_drawing_styles = mp.solutions.drawing_styles mp_pose = mp.solutions.pose subjectpath = '/Volumes/Transcend...
wenxxi/LESS-video-slicing
s_ankle_slicing.py
s_ankle_slicing.py
py
6,489
python
en
code
0
github-code
36
74050760424
import unittest import parlai.utils.testing as testing_utils class TestAlice(unittest.TestCase): def test_alice_runs(self): """ Test that the ALICE agent is stable over time. """ valid, test = testing_utils.eval_model(dict(task='convai2', model='alice')) self.assertEqual(va...
facebookresearch/ParlAI
tests/nightly/cpu/test_alice.py
test_alice.py
py
389
python
en
code
10,365
github-code
36
13038148522
import fresh_tomatoes import media import requests import json import config youtube_suffix = config.youtube_key youtube_prefix = 'https://www.youtube.com/watch?v=' # Movie list -- Here you can add and subtract movies as your tastes change movie_list = ["There Will Be Blood", "The Life Aquatic", "Unforgiven", ...
aaronbjohnson/movie-trailer-website
entertainment_center.py
entertainment_center.py
py
1,862
python
en
code
0
github-code
36
43612785268
# -*- coding: utf-8 -*- from odoo import api, fields, models class reader(models.Model): _name = 'rfid.reader' _description = 'RFID Reader' name = fields.Char(string="Reader Name") alias = fields.Char(string="Reader Alias") mac_address = fields.Char(string="MAC Address") tag_reads = fields....
Maralai/fx-connect
models/models.py
models.py
py
2,276
python
en
code
0
github-code
36
23420997070
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('ventas', '0075_auto_20161016_1522'), ] operations = [ migrations.RenameField( model_name='comanda', ...
pmmrpy/SIGB
ventas/migrations/0076_auto_20161016_1554.py
0076_auto_20161016_1554.py
py
1,288
python
en
code
0
github-code
36
40885362078
import numpy as np # Things that were changed from the original: # - Reformatted code and variable names to conform with PEP8 # - Added legal header # This file contains routines from Lisbon Machine Learning summer school. # The code is freely distributed under a MIT license. https://github.com/LxMLS/lxmls-toolkit/...
IntelLabs/nlp-architect
nlp_architect/models/bist/decoder.py
decoder.py
py
4,909
python
en
code
2,921
github-code
36
40067300798
import pandas as pd import numpy as np from sklearn import preprocessing i = 5 train_mice = '../data/five_imps/train_mice_%d.csv' % i all_mice = '../data/five_imps/all_mice_%d.csv' % i train_hot = '../data/five_imps/train_mice_hot_%d.csv' % i test_hot = '../data/five_imps/test_mice_hot_%d.csv' % i # Read dataframe...
Pold87/ml-final-ass
Python/onehot.py
onehot.py
py
915
python
en
code
0
github-code
36
6798346511
import celery import logging import requests from django.conf import settings from ..models import Job from ..helper import data_job_for_applicant JOB_URL_CREATE = 'api/admin/' JOB_URL_DETAIL = 'api/admin/{}/' logger = logging.getLogger('celery-task') class ApplicantJobMixin: host = settings.EXOLEVER_HOST + ...
tomasgarzon/exo-services
service-exo-opportunities/jobs/tasks/applicant.py
applicant.py
py
2,899
python
en
code
0
github-code
36
28692702951
# Demander ร  l'utilisateur de saisir une phrase phrase_utilisateur = input("Veuillez saisir une phrase : ") # Initialiser le compteur de mots nombre_mots = 0 mot = False # Parcourir chaque caractรจre de la phrase for caractere in phrase_utilisateur: if caractere != ' ': # Si le caractรจre n'est pas un espac...
felixgetaccess/dc5-freyss-felix-baignoire-data
ex1-b.py
ex1-b.py
py
1,386
python
fr
code
0
github-code
36
20360966046
from tkinter import * from tkinter import ttk from tkinter.filedialog import askdirectory from tkinter.filedialog import askopenfilename from PIL import Image # ================================================================================= def convertion(): u_path = str(t1.get()) d_path = str(t2....
sagnik403/Image-Converter-Tkinter
main.py
main.py
py
2,752
python
en
code
1
github-code
36
39366415760
from data_preparation import Preprocessing import pickle import tensorflow as tf import os from tensorflow.python.framework import ops from sklearn.metrics.classification import accuracy_score from sklearn.metrics import precision_recall_fscore_support import warnings warnings.filterwarnings("ignore") os.environ['TF_...
PacktPublishing/Deep-Learning-with-TensorFlow-Second-Edition
Chapter06/LSTM_Sentiment/predict.py
predict.py
py
3,018
python
en
code
48
github-code
36
15138075498
""" test cli module """ import subprocess from typing import List, Tuple def capture(command: List[str]) -> Tuple[bytes, bytes, int]: proc = subprocess.Popen( command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) out, err = proc.communicate() return out, err, proc.returnco...
entelecheia/super-duper-waddle
tests/sdwaddle/test_cli.py
test_cli.py
py
469
python
en
code
19
github-code
36
18515803588
class Solution(object): def removeComments(self, source): """ :type source: List[str] :rtype: List[str] """ inblock = False result = [] remain = [] for line in source: blockStart = -2 blockEnd = -2 for i,c in enumer...
jimmy623/LeetCode
Solutions/Remove Comments.py
Remove Comments.py
py
1,081
python
en
code
0
github-code
36
16645056447
import re import pandas as pd pd.set_option('display.max_rows', None) from pathlib import Path file_path = Path('texts/wf_anthology.txt') # Read in the text file as a string with open(file_path, 'r') as f: text = f.read() # define the regular expression pattern to match the section title, author's name, and intr...
kspicer80/weird_fiction_experiments
author_story_similarity.py
author_story_similarity.py
py
1,727
python
en
code
0
github-code
36
25546091528
# def sum_of_intervals(intervals): # sum_of_length = [] # for char in intervals: # length_of_intervals = char[1]-char[0] # print(sum_of_length) # def sum_of_intervals(intervals): # # Sort the intervals # sorted_intervals = sorted(intervals) # # Initialize variables to keep track of ...
LeaBani/algo-training
python/sumIntervals.py
sumIntervals.py
py
2,076
python
en
code
0
github-code
36
18767587589
# ะ—ะฐะดะฐั‡ะฐ 26: ะะฐะฟะธัˆะธั‚ะต ะฟั€ะพะณั€ะฐะผะผัƒ, ะบะพั‚ะพั€ะฐั ะฝะฐ ะฒั…ะพะด ะฟั€ะธะฝะธะผะฐะตั‚ ะดะฒะฐ ั‡ะธัะปะฐ A ะธ B, # ะธ ะฒะพะทะฒะพะดะธั‚ ั‡ะธัะปะพ ะ ะฒ ั†ะตะปัƒัŽ ัั‚ะตะฟะตะฝัŒ B ั ะฟะพะผะพั‰ัŒัŽ ั€ะตะบัƒั€ัะธะธ. import my_functions my_functions.show_header("ะŸั€ะพะณั€ะฐะผะผะฐ ะฒะพะทะฒะพะดะธั‚ ะฒะฒะตะดะตะฝะฝะพะต ั‡ะธัะปะพ ะฒ ะฒะฒะตะดะตะฝัƒัŽ ัั‚ะตะฟะตะฝัŒ") num = my_functions.get_number("ะ’ะฒะตะดะธั‚ะต ั‡ะธัะปะพ:") degree = my_functions.get_num...
AntonkinAnton/Python_HomeWork
task026.py
task026.py
py
639
python
ru
code
0
github-code
36
72170366505
import pandas as pd import numpy as np import joblib import pickle import warnings import os from data.make_dataset import preprocess_train_df warnings.filterwarnings("ignore") def make_categorical_dataset(processed_dfs, proteins_df): """ Turns the train_updrs.csv into a categorical dataset based on the ...
dagartga/Boosted-Models-for-Parkinsons-Prediction
src/pred_pipeline.py
pred_pipeline.py
py
9,293
python
en
code
0
github-code
36
17585289452
import requests from starwhale import Link, Image, Point, dataset, Polygon, MIMEType # noqa: F401 from starwhale.utils.retry import http_retry PATH_ROOT = "https://starwhale-examples.oss-cn-beijing.aliyuncs.com/dataset/cityscapes" ANNO_PATH = "disparity/train" DATA_PATH_LEFT = "leftImg8bit/train" DATA_PATH_RIGHT = "...
star-whale/starwhale
example/datasets/cityscapes/disparity/dataset.py
dataset.py
py
2,278
python
en
code
171
github-code
36
17883497405
import time t_start_script = time.time() print(__name__) import matplotlib.pyplot as plt import numpy as np a = np.random.randn(1000 * 100* 100) print('start_time and prepare data:', time.time() - t_start_script) print(a.shape) print(sys.argv) # >>> #print('11123',a) if __name__ == '__main__': t0 = time.time()...
pyminer/pyminer
pyminer/packages/applications_toolbar/apps/cftool/test1.py
test1.py
py
542
python
en
code
77
github-code
36
15442911590
import argparse from . import completion_helpers class ArgumentParser(argparse.ArgumentParser): def enable_print_header(self): self.add_argument( '-q', action='store_true', help="Suppresses printing of headers when multiple tasks are " + "being examined" ...
mesosphere-backup/mesos-cli
mesos/cli/parser.py
parser.py
py
1,067
python
en
code
116
github-code
36
15948222705
import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import OneHotEncoder def get_data_splits(X, Y, train_size=0.8): """This function splits the whole dataset into train, test and validation sets. Args: X (pd.DataFrame): DataFrame containing feature valu...
rahbararman/AnoShiftIDS
IDSAnoShift/data.py
data.py
py
5,408
python
en
code
0
github-code
36
15009189438
import pathlib from typing import Optional import essentia.standard as es import numpy as np import pyrubberband as pyrb from madmom.features.downbeats import DBNDownBeatTrackingProcessor, RNNDownBeatProcessor from mixer.logger import logger SAMPLE_RATE = 44100 # Sample rate fixed for essentia class TrackProcesso...
joekitsmith/mixer
mixer/processors/track.py
track.py
py
5,050
python
en
code
0
github-code
36
22163777058
#!/usr/bin/env python import csv import gzip import os import re import sys from pyproj import Transformer csv.field_size_limit(sys.maxsize) AMOUNT_REGEX = re.compile('Both Installment[\s\S]+?\$([\d,\.]+)') # California Zone 3 # https://epsg.io/2227 transformer = Transformer.from_crs(2227, 4326) def get_val(row, ...
typpo/ca-property-tax
scrapers/santa_cruz/parse.py
parse.py
py
2,041
python
en
code
89
github-code
36
15514519322
import json import os import shutil import sys import tempfile import unittest from compare_perf_tests import LogParser from compare_perf_tests import PerformanceTestResult from compare_perf_tests import ReportFormatter from compare_perf_tests import ResultComparison from compare_perf_tests import TestComparator from ...
apple/swift
benchmark/scripts/test_compare_perf_tests.py
test_compare_perf_tests.py
py
38,114
python
en
code
64,554
github-code
36
6198215490
def check(want, ten): flag = 1 for one in want: if one not in ten or ten[one] < want[one]: flag = 0 break return flag # ๊ทธ๋Ÿฌ๋ฉด discount์— ์žˆ๋Š” ๊ฐ’์ด 100000 ๊นŒ์ง€ ์กด์žฌํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ ์ด๊ฑธ 10๊ฐœ์”ฉ ๋ฏธ๋ฃจ๋ฉด์„œ ๋”•์…”๋„ˆ๋ฆฌ ๋งŒ๋“ค๋ฉด.. # def solution(want, number, discount): dic = {} want_dic = {} answer = 0 f...
byeong-chang/Baekjoon-programmers
ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค/lv2/131127.โ€…ํ• ์ธโ€…ํ–‰์‚ฌ/ํ• ์ธโ€…ํ–‰์‚ฌ.py
ํ• ์ธโ€…ํ–‰์‚ฌ.py
py
854
python
en
code
2
github-code
36
41551247368
from importlib.resources import path from kubernetes import client as kclient from kubernetes import config config.load_incluster_config() v1 = kclient.CoreV1Api() # Trainer Pod deletes itself try: api_response = v1.delete_namespaced_pod( name='trainer', namespace='mlbuffet') except Exception as e: p...
zylklab/mlbuffet
modules/trainer/apoptosis.py
apoptosis.py
py
408
python
en
code
6
github-code
36
22783063408
# # @lc app=leetcode id=347 lang=python3 # # [347] Top K Frequent Elements # # https://leetcode.com/problems/top-k-frequent-elements/description/ # # algorithms # Medium (62.25%) # Likes: 4564 # Dislikes: 260 # Total Accepted: 550.4K # Total Submissions: 881.4K # Testcase Example: '[1,1,1,2,2,3]\n2' # # Given a ...
Zhenye-Na/leetcode
python/347.top-k-frequent-elements.py
347.top-k-frequent-elements.py
py
2,170
python
en
code
17
github-code
36
73744186345
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('lexicon', '0112_auto_20160929_1340'), ] operations = [ migrations.AlterModelOptions( name='meaning', ...
lingdb/CoBL-public
ielex/lexicon/migrations/0113_auto_20161004_1315.py
0113_auto_20161004_1315.py
py
682
python
en
code
3
github-code
36
19340358372
import json import logging import math from django.db import IntegrityError from django.db.models import F from datetime import datetime, timedelta from django.template.loader import render_to_string from anodyne import settings from api.models import Reading, Station, StationInfo, StationParameter, \ Exceedance,...
anodyneweb/aw_backend
anodyne/anodyne/connectors/to_database.py
to_database.py
py
6,957
python
en
code
0
github-code
36
42026376598
# -*- coding: utf-8 -*- from django.conf.urls import url from .views import HomeView, ArchivesView, AboutView, PhotoView, MusicView, ArticleDetailView, CategoryView, TagListView, TagsView, CategoryListView, search urlpatterns = [ url(r'^$', HomeView.as_view(), name='home'), url(r'^archives/(?P<year>[0-...
JustBreaking/myblog
apps/myblog/urls.py
urls.py
py
1,101
python
en
code
0
github-code
36
43911017589
import datetime import zadanie2lista6 import zadanie22lista6 plik = 'plik_do_szyfrowania.txt.txt' openplik = open(plik,"r").read() a = int(input("Podaj liczbe od 1-10: ")) date_today = datetime.date.today() month = date_today.month year = date_today.year day = date_today.day g = ['plik_zaszyfrowany','_',a,year,'-'...
AWyszynska/JSP2022
lista8/zadanie1i2.py
zadanie1i2.py
py
898
python
pl
code
0
github-code
36
72498628583
import os import sys import zipfile import urllib.request import filecmp import shutil import errno import typing import orjson VERSIONS_JSON = "https://launchermeta.mojang.com/mc/game/version_manifest.json" RELEASE_TYPES = typing.Literal["release", "snapshot"] def fetch_json(url: str): response = urllib.request...
AstreaTSS/mc-texture-changes
compare.py
compare.py
py
3,236
python
en
code
1
github-code
36
71001076263
#!/usr/bin/env python # # This script downloads a game from OGS and produces a .game file # that can be used by our test estimator. # import requests import sys def fetch_game(game_id): res = requests.get('https://online-go.com/termination-api/game/%d/state' % game_id) if res.status_code != 200: sys.s...
online-go/score-estimator
tools/fetch_ogs_game.py
fetch_ogs_game.py
py
1,827
python
en
code
51
github-code
36
28780254481
""" Python Crash Course, Third Edition https://ehmatthes.github.io/pcc_3e/ My notes: https://github.com/egalli64/pythonesque/pcc3 Chapter 15 - Generating Data - Plotting a Simple Line Graph - Plotting a Series of Points with scatter() """ import matplotlib.pyplot as plt plt.style.use('seaborn') fig, ax = plt.subplots...
egalli64/pythonesque
pcc3/ch15/e1f_scatter_points.py
e1f_scatter_points.py
py
587
python
en
code
17
github-code
36
11032901468
import sys # Bottom-up implementation of the classic rod-cut problem def bottom_up_rod(p, n): r = [-1] * (n + 1) r[0] = 0 for j in range(1, n+1): q = -sys.maxsize + 1 for i in range(1, j+1): q = max(q, p[i] + r[j -i]) r[j] = q return r[n] prices = {1:1, 2:5, 3:8, 4...
tonydelanuez/python-ds-algos
probs/bottom-up-rod.py
bottom-up-rod.py
py
433
python
en
code
0
github-code
36
70376331945
import XInput from pynput import keyboard from pygame import mixer mixer.init() import time class XinputHandler(XInput.EventHandler): def __init__(self, keyMan): super().__init__(0, 1, 2, 3) self.keyMan = keyMan def process_button_event(self, event): if event.type == XInput.EVENT_BUTTO...
tsoushi/SimpleRealtimeTJAEditor
taiko_nothread.py
taiko_nothread.py
py
2,738
python
en
code
0
github-code
36
72426420905
from rest_framework.test import APITestCase from restapi.models import Companies, Countries class FilterTest(APITestCase): @classmethod def setUpTestData(cls): companies = 10 Countries.objects.create(name="c", continent="c", population=1, capital="c", surface=1) country = Countries.ob...
UBB-SDI-23/lab-5x-andrei-crisan27
backend-project/tests/test_filter.py
test_filter.py
py
939
python
en
code
0
github-code
36
7004144868
# define a function that take list of words as argument and # return list with reverse of every element in that list # example : # ['abc','xyz','tuv'] ---> ['cba', 'zyx', 'vut'] def reverse_item(l): r_list = [] for i in l: r_list.append(i[::-1]) return r_list l = ['abc','xyz','tuv'] print(revers...
salmansaifi04/python
chapter5(list)/14_exercise_03.py
14_exercise_03.py
py
330
python
en
code
0
github-code
36
17811935337
import numpy as np import logo import words print('\n') print(logo.h_logo) random_word = np.random.choice(words.words).lower() print('\n') print("Randomly chosen word for sample game: ", random_word) display = [] for i in range(len(random_word)): display += '_' game = True life = 5 while game == True: prin...
SachinSaj/Python-Course-Projects
Hangman/hangman.py
hangman.py
py
928
python
en
code
0
github-code
36
1137077324
import json # things we need for NLP import nltk from nltk.stem.lancaster import LancasterStemmer nltk.download('punkt') stemmer = LancasterStemmer() # things we need for Tensorflow import numpy as np import tflearn import tensorflow as tf import random import pickle class ModelBuilder(object): def __init__(self):...
nlokare/chatbot
chat_model.py
chat_model.py
py
4,023
python
en
code
0
github-code
36
22430840352
# Import SQLite3 import sqlite3 #create a database connection called "cars" conn = sqlite3.connect("cars.db") #Create the cursor to execute commands cursor = conn.cursor() #create a table/query called inventory that includes "make, model and quantity" #use the cursor to execute this! cursor.execute("""CREATE TABLE i...
JackM15/sql
car_sql.py
car_sql.py
py
438
python
en
code
0
github-code
36
74430232105
from django.urls import path from . import views urlpatterns = [ path( '', views.all_products, name='products'), path( 'ranked/', views.products_ranking, name='products_ranking'), path( '<int:product_id>/', views.product_detail, name='...
neil314159/portfolio-project-5
products/urls.py
urls.py
py
1,650
python
en
code
0
github-code
36
8400219894
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 24 13:08:39 2022 @author: luisdsaco (C) 2017-2022 Luis Dรญaz Saco This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundat...
luisdsaco/sacagents
sample.py
sample.py
py
3,298
python
en
code
0
github-code
36
2721632683
class Solution(object): # Time:O(N^2) Space: O(N) def ThreeSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ nums.sort() res = [] for i in range(len(nums)-2): l = i + 1 r = len(nums)...
ZhengLiangliang1996/Leetcode_ML_Daily
Array/3Sum.py
3Sum.py
py
739
python
en
code
1
github-code
36
10793744334
import copy def polygonal(s, n): if s == 3: # Triangle return n * (n + 1) // 2 elif s == 4: # Square return n * n elif s == 5: # Pentagonal return n * (3 * n - 1) // 2 elif s == 6: # Hexagonal return n * (2 * n - 1) elif s == 7: # Heptagonal return n * (5 * n ...
WilliamLP/solvegpt
project_euler/gpt-4/61.py
61.py
py
1,597
python
en
code
0
github-code
36
39350644450
import copy import numpy as np import cv2 import time import random import argparse def draw_obstacles(canvas,clr=5,unknown=False, map_flag=1): """ @brief: This function goes through each node in the canvas image and checks for the obstacle space using the half plane equations. If the node is in obsta...
okritvik/MOD-RRT-Star-Implementation-Point-Robot
mod_rrt_star.py
mod_rrt_star.py
py
22,275
python
en
code
4
github-code
36
71326379303
import numpy as np import sympy as sp import math from matplotlib import pyplot as plt #BEGIN EXERCISE 1 def left_endpoint_sum(f,a,b,n): d = (b-a) / n sum = 0 for i in range(0,n): sum += f(a + i*d) return d*sum def right_endpoint_sum(f,a,b,n): d = (b-a) / n sum = 0 for i in range(1,n+1): sum +=...
Drew-Morris/Real-Analysis-PY
Integration/Integration-Vim.py
Integration-Vim.py
py
6,124
python
en
code
0
github-code
36
37372176191
import pyconll from configuration import ( UD_PATH, UD_STDCH_PATH, UD_CANTO_PATH, UD_STDCH_CONLLU, UD_CANTO_CONLLU ) import os if not os.path.exists(UD_CANTO_CONLLU): raise IOError("You need to download yue_hk-ud-test.conllu from\n" " https://github.com/UniversalDependencies/UD_Canton...
kiking0501/Cantonese-Chinese-Translation
code/v2/dao_UD.py
dao_UD.py
py
2,441
python
en
code
6
github-code
36
14416840611
#!/usr/bin/env python # -*- coding:utf-8 -*- # ไปŽๆ•ฐๆฎๅบ“้‡Œ้ขๅฏผๅ‡บไธ€ๅฎšๆ—ถ้—ดๅ‰็š„่ฟ˜ๆŒๆœ‰ไปฝ้ข็š„ไบบๅ‘˜ๅ’Œไบงๅ“ๆ•ฐๆฎ๏ผŒๆฏไธชไบงๅ“ๆ˜ฏไธ€ไธชExcel import pymysql from openpyxl import * import os #ๆฃ€็ดขๆฏไธ€่กŒ็š„็ฌฌไธ€ไธชไบงๅ“ไปฃ็ ๅญ—ๆฎต๏ผŒๅฆ‚ๆžœๆ˜ฏๅŒไธ€ไธชไปฃ็ ๏ผŒ่ฆไฟๅญ˜ๅœจไธ€ไธชExcel้‡Œ๏ผŒไธๅŒไบงๅ“็š„ๆ•ฐๆฎ๏ผŒ็”จไธๅŒ็š„Excelไฟๅญ˜ #fieldsๆ˜ฏๅˆ—ๅ๏ผŒdataๆ˜ฏๆ•ฐๆฎ้›†๏ผŒpathๆ˜ฏไฟๅญ˜็š„่ทฏๅพ„๏ผŒๅฆ‚ๆžœ็ฉบ๏ผŒๅˆ™ไฟๅญ˜ๅœจๅฝ“ๅ‰็›ฎๅฝ•ไธ‹ def SaveData2Excel(fields, data, path = ''): if path == '': path = os.getcw...
matthew59gs/Projects
python/market/export_fund_share2.py
export_fund_share2.py
py
2,544
python
en
code
0
github-code
36
28031460700
import pickle import numpy as np import sklearn.base from matplotlib.figure import figaspect from sklearn.linear_model import LogisticRegression from dataclasses import dataclass from sklearn.preprocessing import StandardScaler from . import network from tqdm import tqdm from sklearn.decomposition import PCA import m...
pni-lab/connattractor
connattractor/analysis.py
analysis.py
py
16,176
python
en
code
2
github-code
36
7405277670
import numpy as np import math import re import feedparser as fp def loadDataSet(): postingList = [['my', 'dog', 'has', 'flea', 'problems', 'help', 'please'], ['maybe', 'not', 'take', 'him', 'to', 'dog', 'park', 'stupid'], ['my', 'dalmation', 'is', 'so', 'cute', 'I', 'love', 'h...
GuoBayern/MachineLearning
bayes.py
bayes.py
py
5,884
python
en
code
0
github-code
36
70553069544
import os, datetime, time import torch import torch.optim as optim import numpy as np import math import cv2 import tqdm import config import constants from utils.trainer_utils import ( AverageMeter, get_HHMMSS_from_second, save_checkpoint, save_all_img, save_joints3d_img, save_mesh, save...
JunukCha/SSPSE
trainer.py
trainer.py
py
45,916
python
en
code
6
github-code
36
17170052915
import logging from flask import Flask, request from picstitch import load_review_stars, load_amazon_prime, load_fonts, \ PicStitch from gcloud import storage import boto import io import time import os # # ---- Logging prefs ----- log_format = "[%(asctime)s] [%(process)d] [%(levelname)-1s] %(message)s" d...
Interface-Foundry/IF-root
src/image_processing/server.py
server.py
py
3,767
python
en
code
1
github-code
36
74131826985
import pytest from framework.base_case import BaseCase from framework.my_requests import MyRequests from tests.assertions import Assertions from tests.data_list_for_test import DataForCommon id_req = '123-abc-321' name = 'Jack' surname = 'Lee' age = 50 method = 'select' filter_phone = '1234567890' class TestCommon(B...
Bozmanok/qa-test
tests/test_common.py
test_common.py
py
1,229
python
en
code
0
github-code
36
5114570440
# settings.py import json, os, yaml appName = "logunittest" cmdsUt = ["pipenv", "run", "python", "-m", "unittest"] # cmds_pt = ["pipenv", "run", "pytest", "--capture=sys"] cmdsPt = ["pipenv", "run", "pytest", "--capture=sys", "-v", "-s"] packageDir = os.path.dirname(__file__) projectDir = os.path.dirname(packageDir) ...
lmielke/logunittest
logunittest/settings.py
settings.py
py
2,631
python
en
code
0
github-code
36
21527384857
# -*- coding: utf-8 -*- """Document directory_store here.""" import codecs import logging import os import platform from six import string_types from six.moves.urllib import parse as urllib from oaiharvest.record import Record class DirectoryRecordStore(object): def __init__(self, directory, createSubDirs=False...
bloomonkey/oai-harvest
oaiharvest/stores/directory_store.py
directory_store.py
py
2,189
python
en
code
62
github-code
36
20603617401
from selenium import webdriver page_type = -1 # set default driver = webdriver.Firefox(executable_path="./geckodriver") driver.fullscreen_window() driver.implicitly_wait(30) # for signal import signal ''' driver.window_handles[0] : Happy face (default) driver.window_handles[1] : Map driver.window_handles[2] : Sad ...
INYEONGKIM/tony-and-naeyo
ref/display-switching/selenium-ver/firefoxOpener.py
firefoxOpener.py
py
2,350
python
en
code
0
github-code
36
42097295687
# Date Printer # Converting date from one format to another # Anatoli Penev # 11.01.2018 def main(): date = input('Enter a date in the form mm/dd/yyyy: ') print_date(date) def print_date(date): month, day, year = date.split("/") try: print("The date is: {} {} {}".format(get_mon...
tolipenev/pythonassignments
date_print.py
date_print.py
py
837
python
en
code
0
github-code
36
43914132518
# ์‹œ๊ฐ import sys input = sys.stdin.readline n = int(input()) result = 0 for h in range(n + 1): for m in range(60): for s in range(60): if "3" in str(h)+str(m)+str(s): result += 1 print(result)
yesjuhee/study-ps
2023_study/02_implementation/2.py
2.py
py
241
python
en
code
0
github-code
36
31835774368
import math d = listFontVariations("MutatorMathTest") print(list(d.keys())) for fontName in installedFonts(): variations = listFontVariations(fontName) if variations: print(fontName) for axis_name, dimensions in variations.items(): print (axis_name, dimensions) print () w...
LettError/mutatorSans
drawbot/animateMutatorSans.py
animateMutatorSans.py
py
1,320
python
en
code
112
github-code
36
40403373260
from dash import Dash, html, dcc import plotly.express as px import pandas as pd import numpy as np import statsmodels as sm from scipy.stats import ttest_1samp from statsmodels.stats.power import TTestPower import plotly.express as px import plotly.offline as pyo import plotly.io as pio from jupyter_dash import Jupyte...
ashton77/statistical-simulations
simulation_app.py
simulation_app.py
py
3,106
python
en
code
0
github-code
36
38971244001
from django.db import models from datetime import datetime from multiselectfield import MultiSelectField from realtors.models import Realtor from areaprops.models import Area # Create your models here # Choices for amenities amenities_choices = ( ('security','security'), ('gymnasium','gymnasium'), ('waste...
Saxena611/bp_real_estate
listings/models.py
models.py
py
2,835
python
en
code
0
github-code
36
72907254504
#Zadanie: Utwรณrz metodฤ™, ktรณra pobierze liczbฤ™ i wypisze kaลผdy znak w osobnej #linii zaczynajฤ…c od ostatniej cyfry (np. dla liczby 123 bฤ™dฤ… to trzy #linie z 3, 2 i 1). # Utworzenie funkcji showReverseWord def showReverseWord(): # Zapisanie do zmiennej userInput liczby pobranej od uลผytkownika userInput = input(...
szymon7890/python-1TP
1 TP programowanie semestr 2/python3 09.06.2021 zadanie2.py
python3 09.06.2021 zadanie2.py
py
663
python
pl
code
0
github-code
36
74516968424
#!/usr/bin/env python import score from ctypes import * class PenMLScore(score.Score): def __init__(self, data, scoref, do_cache=True, do_storage=True, cachefile=None): self.scoref = scoref self.scoref.restype = c_double self.scoref.argtypes = [c_void_p, c_int, c_int, POINT...
tomisilander/bn
bn/learn/pen_ml_score.py
pen_ml_score.py
py
562
python
en
code
1
github-code
36
8097925766
import vk_api from secret import secret from vk_api.utils import get_random_id class Vk: def __init__(self): vk_session = vk_api.VkApi(token=secret.vk_token2) self.vk = vk_session.get_api() def send_group_message(self, cht_id, msg): self.vk.messages.send( key=secret.key, ...
vgtstptlk/question_bot
api_vk.py
api_vk.py
py
464
python
en
code
0
github-code
36
32322430246
import random import sys MAX_SIZE = sys.maxsize MIN_SIZE = 0 # Call program as python3 create_test_inputs.py $NUM_PAIRS def get_random_pair(min_size, max_size): x = random.randint(min_size, max_size) y = random.randint(min_size, max_size) return (x, y) def write_pairs(pairs): with open(f'testinput...
jemisonf/closest_pair_of_points
create_test_inputs.py
create_test_inputs.py
py
668
python
en
code
2
github-code
36
15131224068
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def getMinimumDifference(self, root: TreeNode) -> int: # ํ’€์–ด์„œ ๋‹ด์„ ๋นˆ๊ณต๊ฐ„ self.stack = [] # ํ’€์–ด์„œ stack์— ์˜ค๋ฆ„์ฐจ์ˆœ์œผ๋กœ ์ •๋ฆฌ ...
EnteLee/practice_algorithm
leetcode/530_minimum_absolute_difference_in_bst/minimum_absolute_difference_in_bst_LJS.py
minimum_absolute_difference_in_bst_LJS.py
py
798
python
en
code
0
github-code
36
21577690614
import yaml import torch import torch.nn as nn from . import layers class Model(nn.Module): def __init__(self, yaml_file): super(Model, self).__init__() with open(yaml_file, 'r') as file: try: model_cfg = yaml.load(file.read(), Loader=yaml.FullLoader) excep...
IMath123/imath
Model/__init__.py
__init__.py
py
2,826
python
en
code
0
github-code
36
19452353827
# Two sum O(N) O(N) # Check 1497. Check If Array Pairs Are Divisible by k # The difference in 1497 is once used need to delete it from lookup table class Solution: def numPairsDivisibleBy60(self, time: List[int]) -> int: lookup = collections.defaultdict(int) count = 0 for time in time: ...
whocaresustc/Leetcode-Summary
1010. Pairs of Songs With Total Durations Divisible by 60.py
1010. Pairs of Songs With Total Durations Divisible by 60.py
py
439
python
en
code
0
github-code
36
22889044030
import sys from PyQt5 import QtCore, QtWidgets, uic import mysql.connector as mc from PyQt5.QtWidgets import QTableWidgetItem from PyQt5.QtWidgets import QMessageBox from FrmMatakuliah import WindowMatakuliah qtcreator_file = "dashboard_admin.ui" # Enter file here. Ui_MainWindow, QtBaseClass = uic.loadUiType(...
freddywicaksono/python_login_multiuser
DashboardAdmin.py
DashboardAdmin.py
py
1,432
python
en
code
2
github-code
36
32998879166
def exec_op(instructions): x = 1 for inst in instructions: yield x if inst[0] == 'addx': yield x x += int(inst[1]) def main() -> None: """ Day Ten Advent of Code problem :return: None """ file = open('./input/dayTen.txt', 'r') instructions = [l...
smenon18/AdventOfCode2022
day_ten.py
day_ten.py
py
701
python
en
code
0
github-code
36
30239035937
""" This module provides functions for justifying Unicode text in a monospaced display such as a terminal. We used to have our own implementation here, but now we mostly rely on the 'wcwidth' library. """ from unicodedata import normalize from wcwidth import wcswidth, wcwidth from ftfy.fixes import remove_terminal_es...
rspeer/python-ftfy
ftfy/formatting.py
formatting.py
py
5,798
python
en
code
3,623
github-code
36
37635874200
# Given an integer array with no duplicates. A maximum tree building on this array is defined as follow: # The root is the maximum number in the array. # The left subtree is the maximum tree constructed from left part subarray divided by the maximum number. # The right subtree is the maximum tree constructed from righ...
sunnyyeti/Leetcode-solutions
654_Maximum_Binary_tree.py
654_Maximum_Binary_tree.py
py
2,946
python
en
code
0
github-code
36